mirror of
https://github.com/dream-num/univer.git
synced 2026-09-24 15:32:18 +08:00
refactor: fix lint issue (#2250)
This commit is contained in:
@@ -4,7 +4,7 @@ exports.baseRules = {
|
||||
'eol-last': ['error', 'always'],
|
||||
'import/no-self-import': 'error',
|
||||
'ts/no-explicit-any': 'warn',
|
||||
'style/no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
|
||||
'style/no-multiple-empty-lines': ['error', { max: 1, maxEOF: 1 }],
|
||||
'style/brace-style': ['warn', '1tbs', { allowSingleLine: true }],
|
||||
'style/comma-dangle': ['error', {
|
||||
arrays: 'always-multiline',
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import type { IDocumentData } from '@univerjs/core';
|
||||
import {
|
||||
BooleanNumber,
|
||||
|
||||
@@ -175,7 +175,6 @@ export function SidebarMenuItemFactory(accessor: IAccessor): IMenuSelectorItem {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export function SetEditableMenuItemFactory(accessor: IAccessor): IMenuSelectorItem {
|
||||
return {
|
||||
id: SetEditable.id,
|
||||
|
||||
@@ -27,7 +27,6 @@ import { enUS as UniverSheetsZenEditorEnUS, ruRU as UniverSheetsZenEditorRuRU }
|
||||
import { enUS as UniverUIEnUS, ruRU as UniverUIRuRU } from '@univerjs/ui';
|
||||
import { enUS as UniverSheetsFilterUIEnUS, ruRU as UniverSheetsFilterUIRuRU } from '@univerjs/sheets-filter-ui';
|
||||
|
||||
|
||||
export const locales = {
|
||||
[LocaleType.EN_US]: Tools.deepMerge(
|
||||
UniverSheetsEnUS,
|
||||
|
||||
@@ -108,7 +108,6 @@ if (!IS_E2E) {
|
||||
// univer.createUnit(UniverInstanceType.UNIVER_SHEET, DEFAULT_WORKBOOK_DATA_DEMO);
|
||||
// }, 7000);
|
||||
|
||||
|
||||
// debugger plugin
|
||||
univer.registerPlugin(DebuggerPlugin);
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ export class PluginHolder extends Disposable {
|
||||
.subscribe((stage) => { this._pluginsRunLifecycle(plugins, stage); }));
|
||||
}
|
||||
|
||||
|
||||
protected _pluginsRunLifecycle(plugins: Plugin[], lifecycle: LifecycleStages): void {
|
||||
plugins.forEach((p) => {
|
||||
switch (lifecycle) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import { Disposable, toDisposable } from '../../shared/lifecycle';
|
||||
import { UniverInstanceType } from '../../common/unit';
|
||||
import type { IResourceLoaderService } from './type';
|
||||
|
||||
|
||||
export class ResourceLoaderService extends Disposable implements IResourceLoaderService {
|
||||
constructor(
|
||||
@Inject(IResourceManagerService) private readonly _resourceManagerService: IResourceManagerService,
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
import type { IUser } from '@univerjs/protocol';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
|
||||
export class UserManagerService {
|
||||
private _model = new Map<string, IUser>();
|
||||
private _userChange$ = new Subject<{ type: 'add' | 'delete'; user: IUser } | { type: 'clear' }>();
|
||||
|
||||
@@ -20,7 +20,6 @@ import type { ICommandService } from '../services/command/command.service';
|
||||
import { CommandType } from '../services/command/command.service';
|
||||
import { fromCallback } from './rxjs';
|
||||
|
||||
|
||||
export const afterInitApply = (commandService: ICommandService) => {
|
||||
return new Promise<void>((res) => {
|
||||
merge(
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
export * from './array-search';
|
||||
export * from './blob';
|
||||
export * from './color/color';
|
||||
|
||||
@@ -39,7 +39,6 @@ export function moveRangeByOffset(range: IRange, refOffsetX: number, refOffsetY:
|
||||
newRange = { ...newRange, startColumn: newRange.startColumn + refOffsetX };
|
||||
}
|
||||
|
||||
|
||||
if (endAbsoluteRefType === AbsoluteRefType.NONE) {
|
||||
newRange = { ...newRange, endRow: newRange.endRow + refOffsetY, endColumn: newRange.endColumn + refOffsetX };
|
||||
} else if (endAbsoluteRefType === AbsoluteRefType.COLUMN) {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import type { Nullable } from '../shared';
|
||||
import { ObjectMatrix, Rectangle, Tools } from '../shared';
|
||||
import { createRowColIter } from '../shared/row-col-iter';
|
||||
|
||||
@@ -155,7 +155,6 @@ export class Univer {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Register a plugin into univer. */
|
||||
registerPlugin<T extends PluginCtor<Plugin>>(plugin: T, config?: ConstructorParameters<T>[0]): void {
|
||||
this._pluginService.registerPlugin(plugin, config);
|
||||
|
||||
@@ -103,7 +103,6 @@ export class DataValidationManager<T extends IDataValidationRule> extends Dispos
|
||||
|
||||
const rule = { ...oldRule };
|
||||
|
||||
|
||||
switch (payload.type) {
|
||||
case UpdateRuleType.RANGE: {
|
||||
rule.ranges = payload.payload;
|
||||
|
||||
@@ -84,7 +84,6 @@ export class DocCanvasView extends RxDisposable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private _addNewRender() {
|
||||
const documentModel = this._currentDocumentModel;
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ describe('lexer test', () => {
|
||||
let formulaCurrentConfigService: IFormulaCurrentConfigService;
|
||||
let lexerTreeBuilder: LexerTreeBuilder;
|
||||
|
||||
|
||||
beforeEach(() => {
|
||||
const testBed = createCommandTestBed(TEST_WORKBOOK_DATA);
|
||||
univer = testBed.univer;
|
||||
@@ -82,7 +81,6 @@ describe('lexer test', () => {
|
||||
formulaCurrentConfigService = get(IFormulaCurrentConfigService);
|
||||
lexerTreeBuilder = get(LexerTreeBuilder);
|
||||
|
||||
|
||||
formulaCurrentConfigService.setExecuteUnitId('test');
|
||||
formulaCurrentConfigService.setExecuteSubUnitId('sheet1');
|
||||
|
||||
|
||||
@@ -460,7 +460,6 @@ export class LexerTreeBuilder extends Disposable {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private _getCurrentParamIndex(formulaString: string, index: number) {
|
||||
return this._nodeMaker(formulaString, undefined, index);
|
||||
}
|
||||
|
||||
@@ -161,14 +161,12 @@ export class FormulaDependencyGenerator extends Disposable {
|
||||
this._formulaASTCache.clear();
|
||||
}
|
||||
|
||||
|
||||
this._registerFormulas(formulaDataKeys, formulaData, unitData, treeList);
|
||||
|
||||
this._registerOtherFormulas(otherFormulaData, otherFormulaDataKeys, treeList);
|
||||
|
||||
this._registerFeatureFormulas(treeList);
|
||||
|
||||
|
||||
const dependencyTreeCache = new FormulaDependencyTreeCache();
|
||||
|
||||
for (let i = 0, len = treeList.length; i < len; i++) {
|
||||
@@ -658,7 +656,6 @@ export class FormulaDependencyGenerator extends Disposable {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (this._includeOtherFormula(tree) === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,6 @@ function isAccounting(pattern: string) {
|
||||
return !!currencySymbols.find((code) => pattern.includes(code)) && pattern.startsWith('_(');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The number format of the formula inherits the number format of the referenced cell, usually taking the format of the cell at the front position, but some formats have higher priority, there are some special cases.
|
||||
*
|
||||
|
||||
@@ -38,13 +38,11 @@ export function getAbsoluteRefTypeWithSingleString(singleRefString: string) {
|
||||
|
||||
let isRowAbsolute = remainChar.indexOf('$') > -1;
|
||||
|
||||
|
||||
if (Tools.isStringNumber(remainChar) && isColumnAbsolute && !isRowAbsolute) {
|
||||
isColumnAbsolute = false;
|
||||
isRowAbsolute = true;
|
||||
}
|
||||
|
||||
|
||||
if (isColumnAbsolute && isRowAbsolute) {
|
||||
return AbsoluteRefType.ALL;
|
||||
}
|
||||
@@ -354,7 +352,6 @@ export function isReferenceStrings(refString: string) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether the sheet name needs to be wrapped in quotes
|
||||
* Excel will quote the worksheet name if any of the following is true:
|
||||
|
||||
@@ -22,7 +22,6 @@ import { ErrorType } from '../../../../basics/error-type';
|
||||
import { ArrayValueObject } from '../../../../engine/value-object/array-value-object';
|
||||
import { Isodd } from '../isodd';
|
||||
|
||||
|
||||
describe('Test isodd function', () => {
|
||||
const testFunction = new Isodd(FUNCTION_NAMES_INFORMATION.ISODD);
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
export type {
|
||||
IArrayFormulaRangeType,
|
||||
IArrayFormulaUnitCellType,
|
||||
|
||||
@@ -95,7 +95,6 @@ export class UniverFormulaEnginePlugin extends Plugin {
|
||||
// Engine
|
||||
[LexerTreeBuilder],
|
||||
|
||||
|
||||
//Controllers
|
||||
[
|
||||
FormulaController,
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { RENDER_CLASS_TYPE } from '../../basics/const';
|
||||
import type { IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage } from '../../basics/i-document-skeleton-cached';
|
||||
import { PageLayoutType } from '../../basics/i-document-skeleton-cached';
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import './extensions';
|
||||
|
||||
import type { Nullable, Observer } from '@univerjs/core';
|
||||
@@ -165,7 +164,6 @@ export class Documents extends DocComponent {
|
||||
return (this.getScene() as Scene).getEngine();
|
||||
}
|
||||
|
||||
|
||||
override draw(ctx: UniverRenderingContext, bounds?: IViewportBound) {
|
||||
const skeletonData = this.getSkeleton()?.getSkeletonData();
|
||||
|
||||
@@ -424,7 +422,6 @@ export class Documents extends DocComponent {
|
||||
alignOffset
|
||||
);
|
||||
|
||||
|
||||
const extensionOffset: IExtensionConfig = {
|
||||
originTranslate,
|
||||
spanStartPoint,
|
||||
|
||||
@@ -1020,7 +1020,6 @@ function __getDrawingPosition(
|
||||
return drawings;
|
||||
}
|
||||
|
||||
|
||||
// 更新 paragraphAffectSkeDrawings 的绝对位置,相对于段落的第一行布局
|
||||
function __updateDrawingPosition(
|
||||
column: IDocumentSkeletonColumn,
|
||||
|
||||
@@ -103,7 +103,6 @@ export interface IShapedText {
|
||||
breakPointType: BreakPointType;
|
||||
}
|
||||
|
||||
|
||||
export function shaping(
|
||||
ctx: ILayoutContext,
|
||||
content: string,
|
||||
|
||||
@@ -257,7 +257,6 @@ export class DocumentSkeleton extends Skeleton {
|
||||
return glyphGroup[glyph];
|
||||
}
|
||||
|
||||
|
||||
findNodeByCoord(
|
||||
coord: Vector2,
|
||||
pageLayoutType: PageLayoutType,
|
||||
|
||||
@@ -73,7 +73,6 @@ export class Hyphen implements IDisposable {
|
||||
let pattern = await import(`./patterns/${lang}.ts`);
|
||||
pattern = pattern[snackToPascal(lang)];
|
||||
|
||||
|
||||
this._patterns.set(lang, parsePattern(pattern));
|
||||
this._loadExceptionsToCache(lang, pattern);
|
||||
}
|
||||
@@ -100,7 +99,6 @@ export class Hyphen implements IDisposable {
|
||||
|
||||
const { levelsTable, pattern } = this._patterns.get(lang)!;
|
||||
|
||||
|
||||
const levels = new Array(word.length + 1).fill(0);
|
||||
const loweredText = (`.${word.toLocaleLowerCase()}.`).split('');
|
||||
const [nextSlice, isFirstCharacter] = createStringSlicer(loweredText);
|
||||
@@ -167,7 +165,6 @@ export class Hyphen implements IDisposable {
|
||||
|
||||
let hyphenatedText = '';
|
||||
|
||||
|
||||
for (let i = 0; i < levels.length; i++) {
|
||||
hyphenatedText += (levels[i] % 2 === 1 ? '-' : '') + word.charAt(i);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ export interface IOpenTypeGlyphInfo {
|
||||
const fontCache = new Map<string, Opentype.Font>();
|
||||
const glyphCache: Map<string, IOpenTypeGlyphInfo[]> = new Map();
|
||||
|
||||
|
||||
function shapeChunk(
|
||||
content: string,
|
||||
charPosition: number,
|
||||
|
||||
@@ -499,7 +499,6 @@ export function columnIterator(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function getPositionHorizon(
|
||||
positionH: IObjectPositionH,
|
||||
column: IDocumentSkeletonColumn,
|
||||
@@ -594,7 +593,6 @@ export function getPositionHorizon(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function getPositionVertical(
|
||||
positionV: IObjectPositionV,
|
||||
page: IDocumentSkeletonPage,
|
||||
|
||||
@@ -882,7 +882,6 @@ export class SpreadsheetSkeleton extends Skeleton {
|
||||
return column;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param offsetY scaled offset y
|
||||
|
||||
@@ -52,7 +52,6 @@ const DEFAULT_SCENE_SIZE = { width: 1500, height: 1000 };
|
||||
|
||||
const SCENE_NAMESPACE = '_UNIVER_SCENE_';
|
||||
|
||||
|
||||
export class RenderManagerService extends Disposable implements IRenderManagerService {
|
||||
private _defaultEngine!: Engine;
|
||||
|
||||
|
||||
@@ -304,7 +304,6 @@ export abstract class Shape<T> extends BaseObject {
|
||||
ctx.strokeStyle = stroke!;
|
||||
}
|
||||
|
||||
|
||||
override render(mainCtx: UniverRenderingContext, bounds?: IViewportBound) {
|
||||
if (!this.visible) {
|
||||
this.makeDirty(false);
|
||||
|
||||
@@ -105,7 +105,6 @@ export interface ITestBed {
|
||||
injector: Injector;
|
||||
}
|
||||
|
||||
|
||||
export function createFacadeTestBed(workbookData?: IWorkbookData, dependencies?: Dependency[]): ITestBed {
|
||||
const univer = new Univer();
|
||||
const injector = univer.__getInjector();
|
||||
|
||||
@@ -143,7 +143,6 @@ export class FWorkbook {
|
||||
return this._injector.createInstance(FWorksheet, this._workbook, worksheet);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the given worksheet to be the active worksheet in the workbook.
|
||||
* @param sheet The worksheet to set as the active worksheet.
|
||||
|
||||
@@ -70,7 +70,6 @@ export class ImageLoadController extends Disposable {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private _floatingObjectListener() {
|
||||
this.disposeWithMe(
|
||||
toDisposable(
|
||||
|
||||
@@ -288,7 +288,6 @@ export const getColorScaleFromValue = (colorList: { color: ColorKit; value: numb
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const filterRange = (ranges: IRange[], maxRow: number, maxCol: number): IRange[] => {
|
||||
return ranges.map((range) => {
|
||||
if (range.startColumn > maxCol || range.startRow > maxRow) {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import type { ICellDataForSheetInterceptor, ICellRenderContext, Workbook } from '@univerjs/core';
|
||||
import { DataValidationRenderMode, DataValidationStatus, DataValidationType, ICommandService, IUniverInstanceService, LifecycleStages, OnLifecycle, RxDisposable, sequenceExecute, UniverInstanceType, WrapStrategy } from '@univerjs/core';
|
||||
import { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';
|
||||
|
||||
@@ -98,7 +98,6 @@ export class DataValidationController extends RxDisposable {
|
||||
this.disposeWithMe(disposableCollection);
|
||||
}
|
||||
|
||||
|
||||
private _initCommandInterceptor() {
|
||||
this._sheetInterceptorService.interceptCommand({
|
||||
getMutations: (commandInfo) => {
|
||||
|
||||
@@ -70,7 +70,6 @@ export class SheetDataValidationManager extends DataValidationManager<ISheetData
|
||||
this._ruleMatrix = new RuleMatrix(matrix);
|
||||
}
|
||||
|
||||
|
||||
private _addRuleSideEffect(rule: ISheetDataValidationRule) {
|
||||
const { unitId, subUnitId } = this;
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ const debounceExecuteFactory = (commandService: ICommandService) => debounce(
|
||||
275
|
||||
);
|
||||
|
||||
|
||||
export function DataValidationDetail() {
|
||||
const [key, setKey] = useState(0);
|
||||
const dataValidationPanelService = useDependency(DataValidationPanelService);
|
||||
|
||||
@@ -141,7 +141,6 @@ const Template = (props: { item: IDropdownItem; commonProps: any; style?: React.
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
export function ListFormulaInput(props: IFormulaInputProps) {
|
||||
const { value, onChange: _onChange = () => { /* empty */ }, unitId, subUnitId, validResult, showError, ruleId } = props;
|
||||
const { formula1 = '', formula2 = '' } = value || {};
|
||||
@@ -287,7 +286,6 @@ export function ListFormulaInput(props: IFormulaInputProps) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
onChange?.({
|
||||
formula1: isFormulaString(str) ? str : '',
|
||||
formula2,
|
||||
|
||||
@@ -166,7 +166,6 @@ export class CheckboxRender implements IBaseDataValidationWidget {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
async onPointerDown(info: ICellRenderContext, evt: IPointerEvent | IMouseEvent) {
|
||||
if (evt.button === 2) {
|
||||
return;
|
||||
|
||||
@@ -205,7 +205,6 @@ export class DropdownWidget implements IBaseDataValidationWidget {
|
||||
const map = this._ensureMap(subUnitId);
|
||||
const key = this._generateKey(row, col);
|
||||
|
||||
|
||||
const list = validator.getListWithColor(rule);
|
||||
const value = getCellValueOrigin(data);
|
||||
const valueStr = `${value ?? ''}`;
|
||||
|
||||
@@ -34,7 +34,6 @@ const SetCellEditVisibleOperation: IOperation<IEditorBridgeServiceVisibleParam>
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
function testWorkbookDataFactory(): IWorkbookData {
|
||||
return {
|
||||
id: 'test',
|
||||
|
||||
@@ -31,7 +31,6 @@ import { FilterConditionItems } from '../../models/conditions';
|
||||
import { ExtendCustomFilterOperator } from '../../models/extended-operators';
|
||||
import { SetSheetsFilterCriteriaCommand } from '../../commands/sheets-filter.command';
|
||||
|
||||
|
||||
const SetCellEditVisibleOperation: IOperation<IEditorBridgeServiceVisibleParam> = {
|
||||
id: 'sheet.operation.set-cell-edit-visible',
|
||||
type: CommandType.OPERATION,
|
||||
@@ -40,7 +39,6 @@ const SetCellEditVisibleOperation: IOperation<IEditorBridgeServiceVisibleParam>
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
function createSheetsFilterPanelServiceTestBed(workbookData: IWorkbookData) {
|
||||
const univer = new Univer();
|
||||
const injector = univer.__getInjector();
|
||||
|
||||
@@ -26,7 +26,6 @@ import { ReCalcSheetsFilterMutation, RemoveSheetsFilterMutation, SetSheetsFilter
|
||||
import type { FilterColumn } from '../models/filter-model';
|
||||
import { mergeSetFilterCriteria } from '../utils';
|
||||
|
||||
|
||||
@OnLifecycle(LifecycleStages.Ready, SheetsFilterController)
|
||||
export class SheetsFilterController extends Disposable {
|
||||
constructor(
|
||||
@@ -544,7 +543,6 @@ export class SheetsFilterController extends Disposable {
|
||||
const setNewFilterRange = { id: SetSheetsFilterRangeMutation.id, params: { unitId, subUnitId, range: newFilterRange } as ISetSheetsFilterRangeMutationParams };
|
||||
const setOldFilterRange = { id: SetSheetsFilterRangeMutation.id, params: { unitId, subUnitId, range: filterRange } as ISetSheetsFilterRangeMutationParams };
|
||||
|
||||
|
||||
redos.push(removeFilter, setNewFilterRange);
|
||||
|
||||
undos.push(removeFilter, setOldFilterRange);
|
||||
|
||||
@@ -176,7 +176,6 @@ export class ActiveDirtyController extends Disposable {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private _initialSheet() {
|
||||
this._activeDirtyManagerService.register(RemoveSheetMutation.id, {
|
||||
commandId: RemoveSheetMutation.id,
|
||||
|
||||
@@ -1885,7 +1885,6 @@ export class PromptController extends Disposable {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private _moveInEditor(keycode: Nullable<KeyCode>) {
|
||||
if (keycode == null) {
|
||||
return;
|
||||
|
||||
@@ -278,7 +278,6 @@ export class TriggerCalculationController extends Disposable {
|
||||
debouncedPushTask(completedArrayFormulasCount);
|
||||
}
|
||||
|
||||
|
||||
// if (totalArrayFormulasToCalculate > 0) {
|
||||
// console.warn(
|
||||
// `Stage ${stage} Array formula.There are ${totalArrayFormulasToCalculate} functions to be executed, ${completedArrayFormulasCount} complete.`
|
||||
@@ -331,7 +330,6 @@ export class TriggerCalculationController extends Disposable {
|
||||
this._formulaCalculationDoneCount = 0;
|
||||
}
|
||||
|
||||
|
||||
console.warn(`execution result${result}`);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { removeFormulaData } from '../offset-formula-data';
|
||||
@@ -122,7 +121,6 @@ describe('Utils offset formula data test', () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('remove blank object', () => {
|
||||
const unitId = 'workbook-01';
|
||||
const formulaData = {};
|
||||
|
||||
@@ -69,7 +69,6 @@ export const InsertRangeMoveDownConfirmCommand: ICommand = {
|
||||
return commandService.executeCommand(InsertRangeMoveDownCommand.id);
|
||||
}
|
||||
|
||||
|
||||
const result = await confirmService.confirm({
|
||||
id: InsertRangeMoveDownConfirmCommand.id,
|
||||
title: { title: localeService.t('merge.confirm.waring') },
|
||||
|
||||
@@ -169,7 +169,6 @@ export class AutoFillController extends Disposable {
|
||||
this._autoFillService.setShowMenu(false);
|
||||
}
|
||||
|
||||
|
||||
private _onSelectionControlFillChanged() {
|
||||
const disposableCollection = new DisposableCollection();
|
||||
const addListener = (disposableCollection: DisposableCollection) => {
|
||||
|
||||
@@ -22,7 +22,6 @@ import { Inject } from '@wendellhu/redi';
|
||||
import type { ISheetSkeletonManagerParam } from '../services/sheet-skeleton-manager.service';
|
||||
import { SheetSkeletonManagerService } from '../services/sheet-skeleton-manager.service';
|
||||
|
||||
|
||||
/**
|
||||
* @todo RenderUnit
|
||||
*/
|
||||
@@ -43,7 +42,6 @@ export class CellCustomRenderController extends Disposable implements IRenderCon
|
||||
this._initEventBinding();
|
||||
}
|
||||
|
||||
|
||||
// eslint-disable-next-line max-lines-per-function
|
||||
private _initEventBinding() {
|
||||
const disposableCollection = new DisposableCollection();
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { CellValueType, isRealNum, LifecycleStages, OnLifecycle, RxDisposable } from '@univerjs/core';
|
||||
import type { Workbook } from '@univerjs/core';
|
||||
import { Inject } from '@wendellhu/redi';
|
||||
|
||||
@@ -50,7 +50,6 @@ export class FormatPainterController extends Disposable {
|
||||
this._commandExecutedListener();
|
||||
}
|
||||
|
||||
|
||||
private _commandExecutedListener() {
|
||||
this.disposeWithMe(
|
||||
toDisposable(
|
||||
|
||||
@@ -1103,7 +1103,6 @@ export function ShowRowMenuItemFactory(accessor: IAccessor): IMenuButtonItem {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const disposable = commandService.onCommandExecuted((command) => {
|
||||
if (affectedCommands.findIndex((c) => c === command.id) !== -1) subscriber.next(!hasHiddenRowsInSelections());
|
||||
});
|
||||
|
||||
@@ -76,7 +76,6 @@ export class HeaderMenuRenderController extends Disposable implements IRenderCon
|
||||
const spreadsheetColumnHeader = this._context.components.get(SHEET_VIEW_KEY.COLUMN) as SpreadsheetColumnHeader;
|
||||
const spreadsheetRowHeader = this._context.components.get(SHEET_VIEW_KEY.ROW) as SpreadsheetHeader;
|
||||
|
||||
|
||||
this._observers.forEach((observer) => {
|
||||
spreadsheetRowHeader.onPointerEnterObserver.remove(observer);
|
||||
spreadsheetRowHeader.onPointerMoveObserver.remove(observer);
|
||||
@@ -110,7 +109,6 @@ export class HeaderMenuRenderController extends Disposable implements IRenderCon
|
||||
const spreadsheetColumnHeader = this._context.components.get(SHEET_VIEW_KEY.COLUMN) as SpreadsheetColumnHeader;
|
||||
const spreadsheetRowHeader = this._context.components.get(SHEET_VIEW_KEY.ROW) as SpreadsheetHeader;
|
||||
|
||||
|
||||
const eventBindingObject =
|
||||
initialType === HEADER_HOVER_TYPE.ROW ? spreadsheetRowHeader : spreadsheetColumnHeader;
|
||||
|
||||
|
||||
-3
@@ -59,7 +59,6 @@ enum HEADER_RESIZE_TYPE {
|
||||
COLUMN,
|
||||
}
|
||||
|
||||
|
||||
export class HeaderResizeRenderController extends Disposable implements IRenderController {
|
||||
private _currentRow: number = 0;
|
||||
|
||||
@@ -259,7 +258,6 @@ export class HeaderResizeRenderController extends Disposable implements IRenderC
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.disposeWithMe(
|
||||
toDisposable(
|
||||
eventBindingObject.onPointerEnterObserver.add(() => {
|
||||
@@ -443,7 +441,6 @@ export class HeaderResizeRenderController extends Disposable implements IRenderC
|
||||
this._upObserver = scene.onPointerUpObserver.add((upEvt: IPointerEvent | IMouseEvent) => {
|
||||
const scene = this._context.scene;
|
||||
|
||||
|
||||
this._clearObserverEvent();
|
||||
this._resizeHelperShape?.dispose();
|
||||
this._resizeHelperShape = null;
|
||||
|
||||
@@ -117,7 +117,6 @@ export class SelectionRenderController extends Disposable implements IRenderCont
|
||||
formulaOrRefString = formulaOrRefString.substring(1);
|
||||
}
|
||||
|
||||
|
||||
const result = isReferenceStrings(formulaOrRefString);
|
||||
|
||||
if (!result) {
|
||||
@@ -126,7 +125,6 @@ export class SelectionRenderController extends Disposable implements IRenderCont
|
||||
|
||||
const selections = await this._getSelections(workbook, unitId, formulaOrRefString);
|
||||
|
||||
|
||||
this._selectionManagerService.replace(selections);
|
||||
|
||||
this._commandService.executeCommand(ScrollToCellOperation.id, selections[0].range);
|
||||
|
||||
@@ -95,7 +95,6 @@ export class SheetsZoomRenderController extends Disposable implements IRenderCon
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
private _updateViewZoom(zoomRatio: number) {
|
||||
const sheetObject = this._getSheetObject();
|
||||
sheetObject?.scene.scale(zoomRatio, zoomRatio);
|
||||
|
||||
@@ -313,7 +313,6 @@ export class AutoFillService extends Disposable implements IAutoFillService {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const result = redos.every((m) => this._commandService.syncExecuteCommand(m.id, m.params));
|
||||
if (result) {
|
||||
// add to undo redo services
|
||||
|
||||
@@ -411,7 +411,6 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// 2. get filtered rows in the target pasting area and get the final pasting matrix
|
||||
// we also handle transpose pasting at this step
|
||||
// note: handle transpose before filtering
|
||||
@@ -430,7 +429,6 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const worksheet = this._univerInstanceService
|
||||
.getUniverSheetInstance(pasteTarget.unitId)
|
||||
?.getSheetBySheetId(pasteTarget.subUnitId);
|
||||
@@ -484,7 +482,6 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const pasteTarget = this._getPastedRange(
|
||||
cellMatrix
|
||||
);
|
||||
@@ -1009,7 +1006,6 @@ export class SheetClipboardService extends Disposable implements ISheetClipboard
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether the cells starting from the upper left corner of the range (merged or non-merged or combined) are consistent with the size of the original data
|
||||
* @param cellMatrix
|
||||
|
||||
@@ -408,7 +408,6 @@ function parseColGroup(raw: string): IClipboardPropertyItem[] | null {
|
||||
const COLGROUP_TAG_REGEX = /<colgroup([\s\S]*?)>(.*?)<\/colgroup>/;
|
||||
const colgroupMatch = raw.match(COLGROUP_TAG_REGEX);
|
||||
|
||||
|
||||
const COL_TAG_REGEX = /<col([\s\S]*?)>/g;
|
||||
let colMatches;
|
||||
if (colgroupMatch?.[2]) {
|
||||
@@ -590,7 +589,6 @@ function extractStyleProperty(styleString?: string, propertyName?: string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function getCellStyle(cell: Element) {
|
||||
let cellStyle = '';
|
||||
const hasClass = cell.getAttribute('class');
|
||||
|
||||
@@ -61,7 +61,6 @@ export function extractNodeStyle(node: HTMLElement, predefinedStyles?: CSSStyleD
|
||||
return docStyles;
|
||||
}
|
||||
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function parseStyleByProperty(styles: CSSStyleDeclaration, docStyles: ITextStyle) {
|
||||
for (let i = 0; i < styles.length; i++) {
|
||||
|
||||
@@ -153,7 +153,6 @@ export function mergeSetRangeValues(mutations: IMutationInfo[]) {
|
||||
return newMutations;
|
||||
}
|
||||
|
||||
|
||||
export function rangeIntersectWithDiscreteRange(range: IRange, discrete: IDiscreteRange) {
|
||||
const { startRow, endRow, startColumn, endColumn } = range;
|
||||
for (let i = startRow; i <= endRow; i++) {
|
||||
@@ -165,7 +164,6 @@ export function rangeIntersectWithDiscreteRange(range: IRange, discrete: IDiscre
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function discreteRangeContainsRange(discrete: IDiscreteRange, range: IRange) {
|
||||
const { startRow, endRow, startColumn, endColumn } = range;
|
||||
for (let i = startRow; i <= endRow; i++) {
|
||||
|
||||
@@ -35,7 +35,6 @@ export interface ISheetSkeletonManagerSearch {
|
||||
commandId?: string; // WTF: why?
|
||||
}
|
||||
|
||||
|
||||
// TODO@wzhudev: this should be moved to a `RenderUnit` as well.
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,6 @@ export function CellAlert({ popup }: { popup: ICanvasPopup }) {
|
||||
[CellAlertType.WARNING]: <WarningSingle className={cs(styles.cellAlertIcon, styles.cellAlertIconWarning)} />,
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div className={styles.cellAlert}>
|
||||
<div className={styles.cellAlertTitle}>
|
||||
|
||||
@@ -89,7 +89,6 @@ export const DefinedNameInput = (props: IDefinedNameInputProps) => {
|
||||
value: SCOPE_WORKBOOK_VALUE,
|
||||
}];
|
||||
|
||||
|
||||
const isFormula = (token: string) => {
|
||||
return !isReferenceStrings(token);
|
||||
};
|
||||
@@ -114,7 +113,6 @@ export const DefinedNameInput = (props: IDefinedNameInputProps) => {
|
||||
setValidString('');
|
||||
}, [state]);
|
||||
|
||||
|
||||
workbook.getSheetOrders().forEach((sheetId) => {
|
||||
const sheet = workbook.getSheetBySheetId(sheetId);
|
||||
options.push({
|
||||
|
||||
@@ -73,7 +73,6 @@ export const AutoFillPopupMenu: React.FC<{}> = () => {
|
||||
};
|
||||
const forceUpdate = useUpdate();
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const disposable = commandService.onCommandExecuted((command: ICommandInfo, options?: IExecutionOptions) => {
|
||||
if (command.id === SetScrollOperation.id) {
|
||||
|
||||
@@ -76,7 +76,6 @@ export const RemoveRowCommand: ICommand<IRemoveRowColCommandParams> = {
|
||||
endColumn: Math.max(worksheet.getMaxColumns() - 1, 0),
|
||||
};
|
||||
|
||||
|
||||
const filterOutRowsInRemove: number[] = [];
|
||||
for (let i = totalRange.startRow; i <= totalRange.endRow; i++) {
|
||||
if (worksheet.getRowFiltered(i)) {
|
||||
|
||||
@@ -72,7 +72,6 @@ export const RemoveRowMutation: IMutation<IRemoveRowsMutationParams> = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const rowCount = range.endRow - range.startRow + 1;
|
||||
spliceArray(range.startRow, rowCount, rowPrimitive);
|
||||
|
||||
|
||||
@@ -183,7 +183,6 @@ export function TextEditor(props: ITextEditorProps & Omit<MyComponentProps, 'onC
|
||||
const unitId = editor.editorUnitId;
|
||||
const isLegality = editorService.checkValueLegality(unitId);
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
const rect = editor.getBoundingClientRect();
|
||||
setValidationOffset([rect.left, rect.top - 16]);
|
||||
@@ -198,7 +197,6 @@ export function TextEditor(props: ITextEditorProps & Omit<MyComponentProps, 'onC
|
||||
}
|
||||
}, 100);
|
||||
|
||||
|
||||
const currentValue = editorService.getValue(unitId);
|
||||
|
||||
if (currentValue !== value) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import type { Nullable } from '@univerjs/core';
|
||||
* Prefer to client-side
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* To detect whether the element is displayed over the viewport
|
||||
* @param element
|
||||
|
||||
@@ -170,7 +170,6 @@ function MenuOptionsWrapper(props: IBaseMenuProps) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export const Menu = (props: IBaseMenuProps) => {
|
||||
const { overViewport, ...restProps } = props;
|
||||
const menuRef = useRef<DesignMenuRef>(null);
|
||||
|
||||
@@ -47,7 +47,6 @@ export interface IDesktopUIController extends IUIController {
|
||||
getComponents(part: DesktopUIPart): Set<() => ComponentType>;
|
||||
}
|
||||
|
||||
|
||||
export class DesktopUIController extends Disposable implements IDesktopUIController {
|
||||
private _componentsByPart: Map<DesktopUIPart, Set<() => ComponentType>> = new Map();
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ export class DesktopGlobalZoneService implements IGlobalZoneService {
|
||||
readonly componentKey$ = new Subject<string>();
|
||||
private _componentKey = '';
|
||||
|
||||
|
||||
constructor(
|
||||
@Inject(ComponentManager)
|
||||
private readonly _componentManager: ComponentManager
|
||||
|
||||
@@ -404,7 +404,6 @@ export function handleStringToStyle($dom?: HTMLElement, cssStyle: string = '') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (key === 'border-color') {
|
||||
const colors = handleBorder(value, ')');
|
||||
if (!styleList.bd) {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* TODO: @jikkai
|
||||
* 1. monaco-editor is not included in the build. User may not able to use uniscript by default.
|
||||
|
||||
Reference in New Issue
Block a user