Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(sheets-ui): editor state not correctly reset when active (#3668)

zhangw16a08bf4cd40
diff --git a/packages-experimental/uni-formula-ui/src/services/formula-popup.service.ts b/packages-experimental/uni-formula-ui/src/services/formula-popup.service.ts
index e31f612e40..168802f027 100644
--- a/packages-experimental/uni-formula-ui/src/services/formula-popup.service.ts
+++ b/packages-experimental/uni-formula-ui/src/services/formula-popup.service.ts
@@ -14,20 +14,20 @@
* limitations under the License.
*/
+import type { IDisposable, Nullable } from '@univerjs/core';
+import type { IShortcutItem } from '@univerjs/ui';
+import type { IAddDocUniFormulaCommandParams } from '../commands/commands/doc.command';
+import type { IAddSlideUniFormulaCommandParams } from '../commands/commands/slide.command';
+import type { IPopupPosition } from '../commands/operations/operation';
import { BuildTextUtils, Disposable, FORMULA_EDITOR_ACTIVATED, ICommandService, IContextService, ILogService, Inject } from '@univerjs/core';
import { DocCanvasPopManagerService } from '@univerjs/docs-ui';
import { FORMULA_PROMPT_ACTIVATED } from '@univerjs/sheets-formula-ui';
import { IShortcutService, KeyCode } from '@univerjs/ui';
import { IUniFormulaService } from '@univerjs/uni-formula';
import { BehaviorSubject, Subject } from 'rxjs';
-import type { IDisposable, Nullable } from '@univerjs/core';
-import type { IShortcutItem } from '@univerjs/ui';
import { AddDocUniFormulaCommand } from '../commands/commands/doc.command';
import { AddSlideUniFormulaCommand } from '../commands/commands/slide.command';
import { ConfirmFormulaPopupCommand, isSlidePosition } from '../commands/operations/operation';
-import type { IAddDocUniFormulaCommandParams } from '../commands/commands/doc.command';
-import type { IAddSlideUniFormulaCommandParams } from '../commands/commands/slide.command';
-import type { IPopupPosition } from '../commands/operations/operation';
export const DOC_FORMULA_POPUP_KEY = 'DOC_FORMULA_POPUP' as const;
diff --git a/packages/core/src/docs/data-model/text-x/build-utils/text-x-utils.ts b/packages/core/src/docs/data-model/text-x/build-utils/text-x-utils.ts
index 6e3b596b4a..dee68c37d5 100644
--- a/packages/core/src/docs/data-model/text-x/build-utils/text-x-utils.ts
+++ b/packages/core/src/docs/data-model/text-x/build-utils/text-x-utils.ts
@@ -31,7 +31,7 @@ export interface IDeleteCustomRangeParam {
segmentId?: string;
documentDataModel: DocumentDataModel;
insert?: Nullable<IDocumentBody>;
- textRange?: { startOffset: number; endOffset: number };
+ textRange?: { index: number };
}
export function deleteCustomRangeTextX(accessor: IAccessor, params: IDeleteCustomRangeParam) {
@@ -62,11 +62,8 @@ export function deleteCustomRangeTextX(accessor: IAccessor, params: IDeleteCusto
line: 0,
});
if (textRange) {
- if (textRange.startOffset >= startIndex) {
- textRange.startOffset--;
- }
- if (textRange.endOffset > startIndex) {
- textRange.endOffset--;
+ if (textRange.index > startIndex) {
+ textRange.index--;
}
}
@@ -86,11 +83,8 @@ export function deleteCustomRangeTextX(accessor: IAccessor, params: IDeleteCusto
});
if (textRange) {
- if (textRange.startOffset > endIndex) {
- textRange.startOffset--;
- }
- if (textRange.endOffset > endIndex) {
- textRange.endOffset--;
+ if (textRange.index > endIndex) {
+ textRange.index--;
}
}
@@ -104,11 +98,8 @@ export function deleteCustomRangeTextX(accessor: IAccessor, params: IDeleteCusto
});
if (textRange) {
- if (textRange.startOffset >= endIndex) {
- textRange.startOffset += insert.dataStream.length;
- }
- if (textRange.endOffset > endIndex) {
- textRange.endOffset += insert.dataStream.length;
+ if (textRange.index > endIndex) {
+ textRange.index += insert.dataStream.length;
}
}
}
diff --git a/packages/core/src/services/resource-manager/type.ts b/packages/core/src/services/resource-manager/type.ts
index f03e32c5d0..c3d72c4c74 100644
--- a/packages/core/src/services/resource-manager/type.ts
+++ b/packages/core/src/services/resource-manager/type.ts
@@ -16,8 +16,8 @@
import type { UniverInstanceType } from '@univerjs/core';
import type { Observable } from 'rxjs';
-import { createIdentifier } from '../../common/di';
import type { IDisposable } from '../../common/di';
+import { createIdentifier } from '../../common/di';
export type IResources = Array<{ id?: string; name: string; data: string }>;
diff --git a/packages/docs-ui/src/basics/custom-range-factory.ts b/packages/docs-ui/src/basics/custom-range-factory.ts
index b7e9378144..bbc12ba659 100644
--- a/packages/docs-ui/src/basics/custom-range-factory.ts
+++ b/packages/docs-ui/src/basics/custom-range-factory.ts
@@ -124,7 +124,8 @@ export function deleteCustomRangeFactory(accessor: IAccessor, params: IDeleteCus
if (!documentDataModel) {
return false;
}
- const textRange = selection ? { startOffset: selection.startOffset, endOffset: selection.endOffset } : undefined;
+
+ const textRange = selection?.collapsed ? { index: selection.startOffset } : undefined;
const doMutation: IMutationInfo<IRichTextEditingMutationParams> = {
id: RichTextEditingMutation.id,
params: {
@@ -150,6 +151,6 @@ export function deleteCustomRangeFactory(accessor: IAccessor, params: IDeleteCus
const path = getRichTextEditPath(documentDataModel, segmentId);
doMutation.params.actions = jsonX.editOp(textX.serialize(), path);
- doMutation.params.textRanges = textRange ? [{ startOffset: textRange.startOffset, endOffset: textRange.endOffset, collapsed: textRange.startOffset === textRange.endOffset }] : undefined;
+ doMutation.params.textRanges = textRange ? [{ startOffset: textRange.index, endOffset: textRange.index, collapsed: true }] : undefined;
return doMutation;
}
diff --git a/packages/docs-ui/src/controllers/render-controllers/back-scroll.render-controller.ts b/packages/docs-ui/src/controllers/render-controllers/back-scroll.render-controller.ts
index ea9aeba2cd..efda9461b4 100644
--- a/packages/docs-ui/src/controllers/render-controllers/back-scroll.render-controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/back-scroll.render-controller.ts
@@ -16,7 +16,7 @@
import type { DocumentDataModel, ITextRange, Nullable } from '@univerjs/core';
import type { Documents, INodePosition, IRenderContext, IRenderModule } from '@univerjs/engine-render';
-import { Inject, RxDisposable } from '@univerjs/core';
+import { DOCS_NORMAL_EDITOR_UNIT_ID_KEY, Inject, RxDisposable } from '@univerjs/core';
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
import { takeUntil } from 'rxjs';
import { VIEWPORT_KEY } from '../../basics/docs-view-key';
@@ -50,6 +50,10 @@ export class DocBackScrollRenderController extends RxDisposable implements IRend
return;
}
+ if (this._context.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
+ return;
+ }
+
this._scrollToSelection();
});
}
diff --git a/packages/engine-formula/src/commands/mutations/set-formula-calculation.mutation.ts b/packages/engine-formula/src/commands/mutations/set-formula-calculation.mutation.ts
index 4affefd874..bae88ec4bf 100644
--- a/packages/engine-formula/src/commands/mutations/set-formula-calculation.mutation.ts
+++ b/packages/engine-formula/src/commands/mutations/set-formula-calculation.mutation.ts
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-import { CommandType } from '@univerjs/core';
import type { IExecutionOptions, IMutation, Nullable } from '@univerjs/core';
-
import type {
IRuntimeOtherUnitDataType,
IRuntimeUnitDataPrimitiveType,
} from '../../basics/common';
+
import type { IFormulaDirtyData } from '../../services/current-data.service';
import type { FormulaExecutedStateType, IExecutionInProgressParams } from '../../services/runtime.service';
+import { CommandType } from '@univerjs/core';
export interface ISetFormulaCalculationStartMutation extends IFormulaDirtyData {
options: Nullable<IExecutionOptions>;
diff --git a/packages/engine-formula/src/commands/mutations/set-formula-data.mutation.ts b/packages/engine-formula/src/commands/mutations/set-formula-data.mutation.ts
index 10fca59b00..5d9687fe08 100644
--- a/packages/engine-formula/src/commands/mutations/set-formula-data.mutation.ts
+++ b/packages/engine-formula/src/commands/mutations/set-formula-data.mutation.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { CommandType } from '@univerjs/core';
import type { IAccessor, IMutation } from '@univerjs/core';
-
import type { IFormulaData } from '../../basics/common';
+import { CommandType } from '@univerjs/core';
+
export interface ISetFormulaDataMutationParams {
formulaData: IFormulaData;
}
diff --git a/packages/engine-formula/src/controller/calculate.controller.ts b/packages/engine-formula/src/controller/calculate.controller.ts
index c8815cbc3b..a006cfbda5 100644
--- a/packages/engine-formula/src/controller/calculate.controller.ts
+++ b/packages/engine-formula/src/controller/calculate.controller.ts
@@ -14,9 +14,14 @@
* limitations under the License.
*/
-import { Disposable, ICommandService, Inject, IUniverInstanceService, LifecycleStages, OnLifecycle } from '@univerjs/core';
import type { ICommandInfo, IUnitRange } from '@univerjs/core';
+import type { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFormulaData } from '../basics/common';
+import type { ISetArrayFormulaDataMutationParams } from '../commands/mutations/set-array-formula-data.mutation';
+import type { ISetFormulaCalculationStartMutation } from '../commands/mutations/set-formula-calculation.mutation';
+import type { ISetFormulaDataMutationParams } from '../commands/mutations/set-formula-data.mutation';
+import type { IAllRuntimeData } from '../services/runtime.service';
+import { Disposable, ICommandService, Inject, IUniverInstanceService, LifecycleStages, OnLifecycle } from '@univerjs/core';
import { convertRuntimeToUnitData } from '../basics/runtime';
import { SetArrayFormulaDataMutation } from '../commands/mutations/set-array-formula-data.mutation';
import {
@@ -29,11 +34,6 @@ import { SetFormulaDataMutation } from '../commands/mutations/set-formula-data.m
import { FormulaDataModel } from '../models/formula-data.model';
import { CalculateFormulaService } from '../services/calculate-formula.service';
import { FormulaExecutedStateType } from '../services/runtime.service';
-import type { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap, IFormulaData } from '../basics/common';
-import type { ISetArrayFormulaDataMutationParams } from '../commands/mutations/set-array-formula-data.mutation';
-import type { ISetFormulaCalculationStartMutation } from '../commands/mutations/set-formula-calculation.mutation';
-import type { ISetFormulaDataMutationParams } from '../commands/mutations/set-formula-data.mutation';
-import type { IAllRuntimeData } from '../services/runtime.service';
@OnLifecycle(LifecycleStages.Ready, CalculateController)
export class CalculateController extends Disposable {
diff --git a/packages/engine-formula/src/functions/compatibility/betadist/index.ts b/packages/engine-formula/src/functions/compatibility/betadist/index.ts
index 68d11793ce..46ea905235 100644
--- a/packages/engine-formula/src/functions/compatibility/betadist/index.ts
+++ b/packages/engine-formula/src/functions/compatibility/betadist/index.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';
import { ErrorType } from '../../../basics/error-type';
import { betaCDF } from '../../../basics/statistical';
import { expandArrayValueObject } from '../../../engine/utils/array-object';
@@ -21,7 +22,6 @@ import { checkVariantsErrorIsStringToNumber } from '../../../engine/utils/check-
import { type BaseValueObject, ErrorValueObject } from '../../../engine/value-object/base-value-object';
import { NumberValueObject } from '../../../engine/value-object/primitive-object';
import { BaseFunction } from '../../base-function';
-import type { ArrayValueObject } from '../../../engine/value-object/array-value-object';
export class Betadist extends BaseFunction {
override minParams = 3;
diff --git a/packages/engine-formula/src/services/active-dirty-manager.service.ts b/packages/engine-formula/src/services/active-dirty-manager.service.ts
index 8157306d28..39764333b4 100644
--- a/packages/engine-formula/src/services/active-dirty-manager.service.ts
+++ b/packages/engine-formula/src/services/active-dirty-manager.service.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import { createIdentifier, Disposable } from '@univerjs/core';
import type { ICommandInfo, IUnitRange, Nullable } from '@univerjs/core';
import type { IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetDefinedNameMap, IDirtyUnitSheetNameMap } from '../basics/common';
+import { createIdentifier, Disposable } from '@univerjs/core';
export interface IDirtyConversionManagerParams {
commandId: string;
diff --git a/packages/facade/src/apis/__tests__/create-test-bed.ts b/packages/facade/src/apis/__tests__/create-test-bed.ts
index 7aeb6c8737..500128a126 100644
--- a/packages/facade/src/apis/__tests__/create-test-bed.ts
+++ b/packages/facade/src/apis/__tests__/create-test-bed.ts
@@ -16,6 +16,8 @@
/* eslint-disable max-lines-per-function */
+import type { Dependency, IWorkbookData, UnitModel } from '@univerjs/core';
+import type { IRender } from '@univerjs/engine-render';
import {
ILogService,
Inject,
@@ -44,9 +46,9 @@ import {
WorksheetProtectionRuleModel,
} from '@univerjs/sheets';
import { ConditionalFormattingFormulaService, ConditionalFormattingRuleModel, ConditionalFormattingService, ConditionalFormattingViewModel } from '@univerjs/sheets-conditional-formatting';
+
import { DataValidationCacheService, DataValidationCustomFormulaService, DataValidationFormulaService, SheetDataValidationModel, SheetsDataValidationValidatorService } from '@univerjs/sheets-data-validation';
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
-
import {
DescriptionService,
IDescriptionService,
@@ -60,8 +62,6 @@ import { SheetsThreadCommentModel } from '@univerjs/sheets-thread-comment';
import { ISheetSelectionRenderService, SheetRenderController, SheetSelectionRenderService, SheetSkeletonManagerService, SheetsRenderService } from '@univerjs/sheets-ui';
import { IThreadCommentDataSourceService, ThreadCommentDataSourceService, ThreadCommentModel } from '@univerjs/thread-comment';
import { IPlatformService, IShortcutService, PlatformService, ShortcutService } from '@univerjs/ui';
-import type { Dependency, IWorkbookData, UnitModel } from '@univerjs/core';
-import type { IRender } from '@univerjs/engine-render';
import { FUniver } from '../facade';
function getTestWorkbookDataDemo(): IWorkbookData {
diff --git a/packages/facade/src/apis/docs/__tests__/create-test-bed.ts b/packages/facade/src/apis/docs/__tests__/create-test-bed.ts
index ad4f025795..6eea2c5764 100644
--- a/packages/facade/src/apis/docs/__tests__/create-test-bed.ts
+++ b/packages/facade/src/apis/docs/__tests__/create-test-bed.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import type { Dependency, DocumentDataModel, IDocumentData } from '@univerjs/core';
import {
ILogService,
Inject,
@@ -30,7 +31,6 @@ import { DocIMEInputManagerService, DocsRenderService, DocStateChangeManagerServ
import { IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';
import enUS from '@univerjs/sheets-formula-ui/locale/en-US';
import zhCN from '@univerjs/sheets-formula-ui/locale/zh-CN';
-import type { Dependency, DocumentDataModel, IDocumentData } from '@univerjs/core';
import { FUniver } from '../../facade';
diff --git a/packages/facade/src/apis/sheets/__tests__/create-formula-test-bed.ts b/packages/facade/src/apis/sheets/__tests__/create-formula-test-bed.ts
index e0fa87295a..307ffe7350 100644
--- a/packages/facade/src/apis/sheets/__tests__/create-formula-test-bed.ts
+++ b/packages/facade/src/apis/sheets/__tests__/create-formula-test-bed.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import type { Dependency, IWorkbookData, Workbook } from '@univerjs/core';
import {
ILogService,
Inject,
@@ -37,9 +38,8 @@ import {
RegisterFunctionService,
} from '@univerjs/sheets-formula';
import enUS from '@univerjs/sheets-formula-ui/locale/en-US';
-import zhCN from '@univerjs/sheets-formula-ui/locale/zh-CN';
-import type { Dependency, IWorkbookData, Workbook } from '@univerjs/core';
+import zhCN from '@univerjs/sheets-formula-ui/locale/zh-CN';
import { FUniver } from '../../facade';
function getTestWorkbookDataDemo(): IWorkbookData {
diff --git a/packages/facade/src/apis/sheets/__tests__/create-worksheet-test-bed.ts b/packages/facade/src/apis/sheets/__tests__/create-worksheet-test-bed.ts
index ef7bc2e921..3d6b59b9f2 100644
--- a/packages/facade/src/apis/sheets/__tests__/create-worksheet-test-bed.ts
+++ b/packages/facade/src/apis/sheets/__tests__/create-worksheet-test-bed.ts
@@ -16,6 +16,7 @@
/* eslint-disable max-lines-per-function */
+import type { Dependency, IWorkbookData, UnitModel } from '@univerjs/core';
import {
ILogService,
Inject,
@@ -44,8 +45,8 @@ import {
WorksheetProtectionRuleModel,
} from '@univerjs/sheets';
import { ConditionalFormattingFormulaService, ConditionalFormattingRuleModel, ConditionalFormattingService, ConditionalFormattingViewModel } from '@univerjs/sheets-conditional-formatting';
-import { DataValidationCacheService, DataValidationCustomFormulaService, DataValidationFormulaService, SheetDataValidationModel, SheetsDataValidationValidatorService } from '@univerjs/sheets-data-validation';
+import { DataValidationCacheService, DataValidationCustomFormulaService, DataValidationFormulaService, SheetDataValidationModel, SheetsDataValidationValidatorService } from '@univerjs/sheets-data-validation';
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
import {
DescriptionService,
@@ -58,7 +59,6 @@ import enUS from '@univerjs/sheets-formula-ui/locale/en-US';
import zhCN from '@univerjs/sheets-formula-ui/locale/zh-CN';
import { ISheetSelectionRenderService, SheetRenderController, SheetSelectionRenderService, SheetSkeletonManagerService, SheetsRenderService } from '@univerjs/sheets-ui';
import { IPlatformService, IShortcutService, PlatformService, ShortcutService } from '@univerjs/ui';
-import type { Dependency, IWorkbookData, UnitModel } from '@univerjs/core';
import { FUniver } from '../../facade';
function getTestWorkbookDataDemo(): IWorkbookData {
diff --git a/packages/sheets-data-validation-ui/src/views/components/detail/index.tsx b/packages/sheets-data-validation-ui/src/views/components/detail/index.tsx
index 7d7adf263f..7837d30f8c 100644
--- a/packages/sheets-data-validation-ui/src/views/components/detail/index.tsx
+++ b/packages/sheets-data-validation-ui/src/views/components/detail/index.tsx
@@ -21,6 +21,7 @@ import { DataValidationModel, DataValidatorRegistryScope, DataValidatorRegistryS
import { Button, FormLayout, Select } from '@univerjs/design';
import { RangeSelector } from '@univerjs/docs-ui';
import { serializeRange } from '@univerjs/engine-formula';
+import { SheetsSelectionsService } from '@univerjs/sheets';
import { RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand } from '@univerjs/sheets-data-validation';
import { ComponentManager, useEvent, useObservable } from '@univerjs/ui';
import React, { useEffect, useMemo, useState } from 'react';
@@ -57,6 +58,17 @@ export function DataValidationDetail() {
const [localRanges, setLocalRanges] = useState<IUnitRange[]>(() => localRule.ranges.map((i) => ({ unitId: '', sheetId: '', range: i })));
const debounceExecute = useMemo(() => debounceExecuteFactory(commandService), [commandService]);
+ const sheetSelectionService = useDependency(SheetsSelectionsService);
+
+ useEffect(() => {
+ return () => {
+ const currentSelection = sheetSelectionService.getCurrentLastSelection();
+ if (currentSelection) {
+ sheetSelectionService.setSelections([currentSelection]);
+ }
+ };
+ }, [sheetSelectionService]);
+
useEffect(() => {
commandService.onCommandExecuted((commandInfo) => {
if (commandInfo.id === UndoCommand.id || commandInfo.id === RedoCommand.id) {
diff --git a/packages/sheets-drawing/src/controllers/sheet-drawing.controller.ts b/packages/sheets-drawing/src/controllers/sheet-drawing.controller.ts
index b04122573f..75bb168923 100644
--- a/packages/sheets-drawing/src/controllers/sheet-drawing.controller.ts
+++ b/packages/sheets-drawing/src/controllers/sheet-drawing.controller.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
+import type { IDrawingSubunitMap } from '@univerjs/drawing';
+import type { ISheetDrawing } from '../services/sheet-drawing.service';
import { Disposable, ICommandService, IResourceManagerService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
import { IDrawingManagerService } from '@univerjs/drawing';
-import type { IDrawingSubunitMap } from '@univerjs/drawing';
import { SetDrawingApplyMutation } from '../commands/mutations/set-drawing-apply.mutation';
import { ISheetDrawingService } from '../services/sheet-drawing.service';
-import type { ISheetDrawing } from '../services/sheet-drawing.service';
export const SHEET_DRAWING_PLUGIN = 'SHEET_DRAWING_PLUGIN';
diff --git a/packages/sheets-formula-ui/src/commands/commands/formula-clipboard.command.ts b/packages/sheets-formula-ui/src/commands/commands/formula-clipboard.command.ts
index 349d0dfb9d..881da3494a 100644
--- a/packages/sheets-formula-ui/src/commands/commands/formula-clipboard.command.ts
+++ b/packages/sheets-formula-ui/src/commands/commands/formula-clipboard.command.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
+import type { ICommand } from '@univerjs/core';
import { CommandType, ICommandService } from '@univerjs/core';
import { PREDEFINED_HOOK_NAME, SheetPasteCommand } from '@univerjs/sheets-ui';
-import type { ICommand } from '@univerjs/core';
export const SheetOnlyPasteFormulaCommand: ICommand = {
id: 'sheet.command.paste-formula',
diff --git a/packages/sheets-formula-ui/src/commands/operations/__tests__/create-command-test-bed.ts b/packages/sheets-formula-ui/src/commands/operations/__tests__/create-command-test-bed.ts
index 3b254b232b..47c3be71a7 100644
--- a/packages/sheets-formula-ui/src/commands/operations/__tests__/create-command-test-bed.ts
+++ b/packages/sheets-formula-ui/src/commands/operations/__tests__/create-command-test-bed.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import type { Dependency, IWorkbookData } from '@univerjs/core';
import { AuthzIoLocalService, IAuthzIoService, ILogService, Inject, Injector, IUniverInstanceService, LocaleType, LogLevel, Plugin, Univer, UniverInstanceType } from '@univerjs/core';
import { DocSelectionManagerService } from '@univerjs/docs';
import { EditorService, IEditorService } from '@univerjs/docs-ui';
@@ -21,7 +22,6 @@ import { LexerTreeBuilder } from '@univerjs/engine-formula';
import { IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';
import { RangeProtectionRuleModel, SheetInterceptorService, SheetsSelectionsService, WorkbookPermissionService, WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';
import { EditorBridgeService, IEditorBridgeService, ISheetSelectionRenderService, SheetSelectionRenderService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
-import type { Dependency, IWorkbookData } from '@univerjs/core';
import { FormulaPromptService, IFormulaPromptService } from '../../../services/prompt.service';
const TEST_WORKBOOK_DATA_DEMO = (): IWorkbookData => ({
diff --git a/packages/sheets-formula-ui/src/commands/operations/__tests__/insert-function.operation.spec.ts b/packages/sheets-formula-ui/src/commands/operations/__tests__/insert-function.operation.spec.ts
index 226c8222d5..42c39d5bc7 100644
--- a/packages/sheets-formula-ui/src/commands/operations/__tests__/insert-function.operation.spec.ts
+++ b/packages/sheets-formula-ui/src/commands/operations/__tests__/insert-function.operation.spec.ts
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import type { Injector, Univer } from '@univerjs/core';
+import type { IInsertFunctionOperationParams } from '../insert-function.operation';
import { ICommandService, IUniverInstanceService, RANGE_TYPE, RedoCommand, UndoCommand } from '@univerjs/core';
import {
SetRangeValuesCommand,
@@ -21,10 +23,9 @@ import {
SetSelectionsOperation,
SheetsSelectionsService,
} from '@univerjs/sheets';
+
import { InsertFunctionCommand } from '@univerjs/sheets-formula';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-
-import type { Injector, Univer } from '@univerjs/core';
import {
InsertFunctionOperation,
isMultiRowsColumnsRange,
@@ -32,7 +33,6 @@ import {
isSingleCell,
} from '../insert-function.operation';
import { createCommandTestBed } from './create-command-test-bed';
-import type { IInsertFunctionOperationParams } from '../insert-function.operation';
describe('Test insert function operation', () => {
let univer: Univer;
diff --git a/packages/sheets-formula-ui/src/commands/operations/editor-formula.operation.ts b/packages/sheets-formula-ui/src/commands/operations/editor-formula.operation.ts
index 34f3ffe5bf..265e2c4e93 100644
--- a/packages/sheets-formula-ui/src/commands/operations/editor-formula.operation.ts
+++ b/packages/sheets-formula-ui/src/commands/operations/editor-formula.operation.ts
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-import { CommandType } from '@univerjs/core';
import type { IOperation } from '@univerjs/core';
import type { DeviceInputEventType } from '@univerjs/engine-render';
import type { KeyCode, MetaKeys } from '@univerjs/ui';
-
import type { META_KEY_CTRL_AND_SHIFT } from '../../common/prompt';
+import { CommandType } from '@univerjs/core';
+
export interface ISelectEditorFormulaOperationParam {
eventType: DeviceInputEventType;
keycode?: KeyCode;
diff --git a/packages/sheets-formula-ui/src/commands/operations/help-function.operation.ts b/packages/sheets-formula-ui/src/commands/operations/help-function.operation.ts
index 8de0e6e801..2e53317182 100644
--- a/packages/sheets-formula-ui/src/commands/operations/help-function.operation.ts
+++ b/packages/sheets-formula-ui/src/commands/operations/help-function.operation.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { CommandType } from '@univerjs/core';
import type { IAccessor, ICommand } from '@univerjs/core';
+import type { IHelpFunctionOperationParams } from '../../services/prompt.service';
+import { CommandType } from '@univerjs/core';
import { IFormulaPromptService } from '../../services/prompt.service';
-import type { IHelpFunctionOperationParams } from '../../services/prompt.service';
export const HelpFunctionOperation: ICommand = {
id: 'formula-ui.operation.help-function',
diff --git a/packages/sheets-formula-ui/src/commands/operations/insert-function.operation.ts b/packages/sheets-formula-ui/src/commands/operations/insert-function.operation.ts
index 5d0a5517c5..482727cfd6 100644
--- a/packages/sheets-formula-ui/src/commands/operations/insert-function.operation.ts
+++ b/packages/sheets-formula-ui/src/commands/operations/insert-function.operation.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import type { IAccessor, ICellData, ICommand, IRange, Nullable, ObjectMatrix } from '@univerjs/core';
import {
CellValueType,
CommandType,
@@ -26,15 +27,14 @@ import {
} from '@univerjs/core';
import { IEditorService } from '@univerjs/docs-ui';
import { serializeRange } from '@univerjs/engine-formula';
+
import {
getCellAtRowCol,
getSheetCommandTarget,
SetSelectionsOperation,
SheetsSelectionsService,
} from '@univerjs/sheets';
-
import { type IInsertFunction, InsertFunctionCommand } from '@univerjs/sheets-formula';
-import type { IAccessor, ICellData, ICommand, IRange, Nullable, ObjectMatrix } from '@univerjs/core';
export interface IInsertFunctionOperationParams {
/**
diff --git a/packages/sheets-formula-ui/src/commands/operations/more-functions.operation.ts b/packages/sheets-formula-ui/src/commands/operations/more-functions.operation.ts
index 5ae32842e0..83e93f8872 100644
--- a/packages/sheets-formula-ui/src/commands/operations/more-functions.operation.ts
+++ b/packages/sheets-formula-ui/src/commands/operations/more-functions.operation.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
+import type { IAccessor, ICommand } from '@univerjs/core';
import { CommandType } from '@univerjs/core';
import { ISidebarService } from '@univerjs/ui';
-import type { IAccessor, ICommand } from '@univerjs/core';
import { MORE_FUNCTIONS_COMPONENT } from '../../views/more-functions/interface';
diff --git a/packages/sheets-formula-ui/src/commands/operations/reference-absolute.operation.ts b/packages/sheets-formula-ui/src/commands/operations/reference-absolute.operation.ts
index 1966441dbd..1ce473b17c 100644
--- a/packages/sheets-formula-ui/src/commands/operations/reference-absolute.operation.ts
+++ b/packages/sheets-formula-ui/src/commands/operations/reference-absolute.operation.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import { CommandType } from '@univerjs/core';
import type { IAccessor, ICommand } from '@univerjs/core';
+import { CommandType } from '@univerjs/core';
export const ReferenceAbsoluteOperation: ICommand = {
id: 'formula-ui.operation.change-ref-to-absolute',
diff --git a/packages/sheets-formula-ui/src/commands/operations/search-function.operation.ts b/packages/sheets-formula-ui/src/commands/operations/search-function.operation.ts
index f72428b889..3338be6fea 100644
--- a/packages/sheets-formula-ui/src/commands/operations/search-function.operation.ts
+++ b/packages/sheets-formula-ui/src/commands/operations/search-function.operation.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { CommandType } from '@univerjs/core';
import type { IAccessor, ICommand } from '@univerjs/core';
+import type { ISearchFunctionOperationParams } from '../../services/prompt.service';
+import { CommandType } from '@univerjs/core';
import { IFormulaPromptService } from '../../services/prompt.service';
-import type { ISearchFunctionOperationParams } from '../../services/prompt.service';
export const SearchFunctionOperation: ICommand = {
id: 'formula-ui.operation.search-function',
diff --git a/packages/sheets-formula-ui/src/common/selection.ts b/packages/sheets-formula-ui/src/common/selection.ts
index e7adb25f31..d2a54c5ce7 100644
--- a/packages/sheets-formula-ui/src/common/selection.ts
+++ b/packages/sheets-formula-ui/src/common/selection.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import { ColorKit, type ThemeService } from '@univerjs/core';
import type { ISelectionStyle } from '@univerjs/sheets';
+import { ColorKit, type ThemeService } from '@univerjs/core';
export const FORMULA_REF_SELECTION_PLUGIN_NAME = 'formula_reference_selection_plugin_name';
diff --git a/packages/sheets-formula-ui/src/controllers/__tests__/create-command-test-bed.ts b/packages/sheets-formula-ui/src/controllers/__tests__/create-command-test-bed.ts
index 6c71233fb8..ae6b9bae2c 100644
--- a/packages/sheets-formula-ui/src/controllers/__tests__/create-command-test-bed.ts
+++ b/packages/sheets-formula-ui/src/controllers/__tests__/create-command-test-bed.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import type { Dependency, IWorkbookData, Workbook } from '@univerjs/core';
import { ILogService, Inject, Injector, IUniverInstanceService, LocaleType, LogLevel, Plugin, Univer, UniverInstanceType } from '@univerjs/core';
import { DocSelectionManagerService } from '@univerjs/docs';
import { EditorService, IEditorService } from '@univerjs/docs-ui';
@@ -21,7 +22,6 @@ import { CalculateFormulaService, DefinedNamesService, FormulaCurrentConfigServi
import { IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';
import { IRefSelectionsService, RangeProtectionRuleModel, SheetInterceptorService, SheetsSelectionsService, WorkbookPermissionService, WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';
import { EditorBridgeService, IEditorBridgeService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
-import type { Dependency, IWorkbookData, Workbook } from '@univerjs/core';
const TEST_WORKBOOK_DATA_DEMO: IWorkbookData = {
id: 'test',
diff --git a/packages/sheets-formula-ui/src/controllers/__tests__/formula-auto-fill.controller.spec.ts b/packages/sheets-formula-ui/src/controllers/__tests__/formula-auto-fill.controller.spec.ts
index b8c6202afc..d8405f6d18 100644
--- a/packages/sheets-formula-ui/src/controllers/__tests__/formula-auto-fill.controller.spec.ts
+++ b/packages/sheets-formula-ui/src/controllers/__tests__/formula-auto-fill.controller.spec.ts
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import type { ICellData, Injector, Nullable, Univer } from '@univerjs/core';
import {
ICommandService,
IUniverInstanceService,
@@ -42,7 +43,6 @@ import {
} from '@univerjs/sheets-ui';
import { IPlatformService, IShortcutService, PlatformService, ShortcutService } from '@univerjs/ui';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import type { ICellData, Injector, Nullable, Univer } from '@univerjs/core';
import { FormulaAutoFillController } from '../formula-auto-fill.controller';
import { createCommandTestBed } from './create-command-test-bed';
diff --git a/packages/sheets-formula-ui/src/controllers/__tests__/formula-clipboard.controller.spec.ts b/packages/sheets-formula-ui/src/controllers/__tests__/formula-clipboard.controller.spec.ts
index 173fc1e6ef..095e28740b 100644
--- a/packages/sheets-formula-ui/src/controllers/__tests__/formula-clipboard.controller.spec.ts
+++ b/packages/sheets-formula-ui/src/controllers/__tests__/formula-clipboard.controller.spec.ts
@@ -14,13 +14,13 @@
* limitations under the License.
*/
+import type { ICellData, Injector, Nullable, Univer } from '@univerjs/core';
+import type { ICellDataWithSpanInfo } from '@univerjs/sheets-ui';
import { ICommandService, IUniverInstanceService, ObjectMatrix } from '@univerjs/core';
import { FormulaDataModel, LexerTreeBuilder } from '@univerjs/engine-formula';
import { type ISetRangeValuesMutationParams, SetRangeValuesMutation } from '@univerjs/sheets';
import { COPY_TYPE, ISheetSelectionRenderService, PREDEFINED_HOOK_NAME, SheetSelectionRenderService } from '@univerjs/sheets-ui';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import type { ICellData, Injector, Nullable, Univer } from '@univerjs/core';
-import type { ICellDataWithSpanInfo } from '@univerjs/sheets-ui';
import { getSetCellFormulaMutations } from '../formula-clipboard.controller';
import { createCommandTestBed } from './create-command-test-bed';
diff --git a/packages/sheets-formula-ui/src/controllers/__tests__/update-formula.controller.spec.ts b/packages/sheets-formula-ui/src/controllers/__tests__/update-formula.controller.spec.ts
index 28c4bad415..9549e68113 100644
--- a/packages/sheets-formula-ui/src/controllers/__tests__/update-formula.controller.spec.ts
+++ b/packages/sheets-formula-ui/src/controllers/__tests__/update-formula.controller.spec.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
+import type { ICellData, Injector, IObjectMatrixPrimitiveType, IWorkbookData, Nullable, Univer } from '@univerjs/core';
+import type { IDeleteRangeMoveLeftCommandParams, IDeleteRangeMoveUpCommandParams, IInsertColCommandParams, IInsertRowCommandParams, IMoveColsCommandParams, IMoveRangeCommandParams, IMoveRowsCommandParams, InsertRangeMoveDownCommandParams, InsertRangeMoveRightCommandParams, IRemoveRowColCommandParams, IRemoveSheetCommandParams, ISetRangeValuesCommandParams, ISetWorksheetNameCommandParams } from '@univerjs/sheets';
import { CellValueType, Direction, ICommandService, IUniverInstanceService, LocaleType, RANGE_TYPE, RedoCommand, UndoCommand } from '@univerjs/core';
import { SetArrayFormulaDataMutation, SetFormulaDataMutation } from '@univerjs/engine-formula';
import { DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, InsertColCommand, InsertColMutation, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowCommand, InsertRowMutation, MoveColsCommand, MoveColsMutation, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, RemoveColCommand, RemoveColMutation, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, RemoveSheetMutation, SetRangeValuesCommand, SetRangeValuesMutation, SetSelectionsOperation, SetWorksheetNameCommand, SetWorksheetNameMutation, SheetsSelectionsService } from '@univerjs/sheets';
+
import { UpdateFormulaController } from '@univerjs/sheets-formula';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-
-import type { ICellData, Injector, IObjectMatrixPrimitiveType, IWorkbookData, Nullable, Univer } from '@univerjs/core';
-import type { IDeleteRangeMoveLeftCommandParams, IDeleteRangeMoveUpCommandParams, IInsertColCommandParams, IInsertRowCommandParams, IMoveColsCommandParams, IMoveRangeCommandParams, IMoveRowsCommandParams, InsertRangeMoveDownCommandParams, InsertRangeMoveRightCommandParams, IRemoveRowColCommandParams, IRemoveSheetCommandParams, ISetRangeValuesCommandParams, ISetWorksheetNameCommandParams } from '@univerjs/sheets';
import { createCommandTestBed } from './create-command-test-bed';
const TEST_WORKBOOK_DATA_DEMO = (): IWorkbookData => ({
diff --git a/packages/sheets-formula-ui/src/controllers/formula-alert-render.controller.ts b/packages/sheets-formula-ui/src/controllers/formula-alert-render.controller.ts
index 05d9321529..20d09250d1 100644
--- a/packages/sheets-formula-ui/src/controllers/formula-alert-render.controller.ts
+++ b/packages/sheets-formula-ui/src/controllers/formula-alert-render.controller.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
+import type { Workbook } from '@univerjs/core';
+import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { Disposable, Inject, isICellData, LocaleService } from '@univerjs/core';
import { ErrorType } from '@univerjs/engine-formula';
import { CellAlertManagerService, CellAlertType, HoverManagerService } from '@univerjs/sheets-ui';
import { IZenZoneService } from '@univerjs/ui';
-import type { Workbook } from '@univerjs/core';
-import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { extractFormulaError } from './utils/utils';
const ALERT_KEY = 'SHEET_FORMULA_ALERT';
diff --git a/packages/sheets-formula-ui/src/controllers/formula-auto-fill.controller.ts b/packages/sheets-formula-ui/src/controllers/formula-auto-fill.controller.ts
index 43c92667cf..099332d3c8 100644
--- a/packages/sheets-formula-ui/src/controllers/formula-auto-fill.controller.ts
+++ b/packages/sheets-formula-ui/src/controllers/formula-auto-fill.controller.ts
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import type { ICellData, Nullable } from '@univerjs/core';
+import type { AutoFillService, IAutoFillRule, ICopyDataInTypeIndexInfo, ICopyDataPiece } from '@univerjs/sheets-ui';
import {
Direction,
Disposable,
@@ -26,8 +28,6 @@ import {
} from '@univerjs/core';
import { LexerTreeBuilder } from '@univerjs/engine-formula';
import { APPLY_TYPE, DATA_TYPE, IAutoFillService } from '@univerjs/sheets-ui';
-import type { ICellData, Nullable } from '@univerjs/core';
-import type { AutoFillService, IAutoFillRule, ICopyDataInTypeIndexInfo, ICopyDataPiece } from '@univerjs/sheets-ui';
@OnLifecycle(LifecycleStages.Ready, FormulaAutoFillController)
export class FormulaAutoFillController extends Disposable {
diff --git a/packages/sheets-formula-ui/src/controllers/formula-clipboard.controller.ts b/packages/sheets-formula-ui/src/controllers/formula-clipboard.controller.ts
index 0cb859a177..2828539a81 100644
--- a/packages/sheets-formula-ui/src/controllers/formula-clipboard.controller.ts
+++ b/packages/sheets-formula-ui/src/controllers/formula-clipboard.controller.ts
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+import type { IAccessor, ICellData, IMutationInfo, Workbook } from '@univerjs/core';
+import type { ISetRangeValuesMutationParams } from '@univerjs/sheets';
+import type { ICellDataWithSpanInfo, ICopyPastePayload, IDiscreteRange, ISheetClipboardHook, ISheetDiscreteRangeLocation } from '@univerjs/sheets-ui';
import {
DEFAULT_EMPTY_DOCUMENT_VALUE,
Disposable,
@@ -31,9 +34,6 @@ import {
import { FormulaDataModel, LexerTreeBuilder } from '@univerjs/engine-formula';
import { SetRangeValuesMutation, SetRangeValuesUndoMutationFactory } from '@univerjs/sheets';
import { COPY_TYPE, ISheetClipboardService, PREDEFINED_HOOK_NAME } from '@univerjs/sheets-ui';
-import type { IAccessor, ICellData, IMutationInfo, Workbook } from '@univerjs/core';
-import type { ISetRangeValuesMutationParams } from '@univerjs/sheets';
-import type { ICellDataWithSpanInfo, ICopyPastePayload, IDiscreteRange, ISheetClipboardHook, ISheetDiscreteRangeLocation } from '@univerjs/sheets-ui';
export const DEFAULT_PASTE_FORMULA = 'default-paste-formula';
diff --git a/packages/sheets-formula-ui/src/controllers/formula-ui.controller.ts b/packages/sheets-formula-ui/src/controllers/formula-ui.controller.ts
index 0e1a5d1f1c..e3047b140a 100644
--- a/packages/sheets-formula-ui/src/controllers/formula-ui.controller.ts
+++ b/packages/sheets-formula-ui/src/controllers/formula-ui.controller.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
+import type { Dependency } from '@univerjs/core';
import { connectInjector, Disposable, ICommandService, Inject, Injector, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
import { IRenderManagerService } from '@univerjs/engine-render';
-import { BuiltInUIPart, ComponentManager, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
-import type { Dependency } from '@univerjs/core';
+import { BuiltInUIPart, ComponentManager, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
import { SheetOnlyPasteFormulaCommand } from '../commands/commands/formula-clipboard.command';
import { SelectEditorFormulaOperation } from '../commands/operations/editor-formula.operation';
import { HelpFunctionOperation } from '../commands/operations/help-function.operation';
diff --git a/packages/sheets-formula-ui/src/controllers/menu.schema.ts b/packages/sheets-formula-ui/src/controllers/menu.schema.ts
index b4bf30b56a..ef2ea7109d 100644
--- a/packages/sheets-formula-ui/src/controllers/menu.schema.ts
+++ b/packages/sheets-formula-ui/src/controllers/menu.schema.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
+import type { MenuSchemaType } from '@univerjs/ui';
import { PASTE_SPECIAL_MENU_ID } from '@univerjs/sheets-ui';
import { RibbonStartGroup } from '@univerjs/ui';
-import type { MenuSchemaType } from '@univerjs/ui';
import { SheetOnlyPasteFormulaCommand } from '../commands/commands/formula-clipboard.command';
import { InsertFunctionOperation } from '../commands/operations/insert-function.operation';
import { MoreFunctionsOperation } from '../commands/operations/more-functions.operation';
diff --git a/packages/sheets-formula-ui/src/controllers/menu.ts b/packages/sheets-formula-ui/src/controllers/menu.ts
index 5c54d2c037..031941514c 100644
--- a/packages/sheets-formula-ui/src/controllers/menu.ts
+++ b/packages/sheets-formula-ui/src/controllers/menu.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
+import type { IAccessor, Workbook } from '@univerjs/core';
+import type { IMenuItem } from '@univerjs/ui';
import { IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
import { RangeProtectionPermissionEditPoint, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellValuePermission } from '@univerjs/sheets';
import { getCurrentRangeDisable$ } from '@univerjs/sheets-ui';
import { getMenuHiddenObservable, IClipboardInterfaceService, MenuItemType } from '@univerjs/ui';
-import { combineLatestWith, map, Observable, of, switchMap } from 'rxjs';
-import type { IAccessor, Workbook } from '@univerjs/core';
-import type { IMenuItem } from '@univerjs/ui';
+import { combineLatestWith, map, Observable, of, switchMap } from 'rxjs';
import { SheetOnlyPasteFormulaCommand } from '../commands/commands/formula-clipboard.command';
import { InsertFunctionOperation } from '../commands/operations/insert-function.operation';
import { MoreFunctionsOperation } from '../commands/operations/more-functions.operation';
diff --git a/packages/sheets-formula-ui/src/controllers/shortcuts/prompt.shortcut.ts b/packages/sheets-formula-ui/src/controllers/shortcuts/prompt.shortcut.ts
index 9e3fe812e4..7285f05fa3 100644
--- a/packages/sheets-formula-ui/src/controllers/shortcuts/prompt.shortcut.ts
+++ b/packages/sheets-formula-ui/src/controllers/shortcuts/prompt.shortcut.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
+import type { IShortcutItem } from '@univerjs/ui';
import { DeviceInputEventType } from '@univerjs/engine-render';
import { whenFormulaEditorActivated } from '@univerjs/sheets-ui';
import { KeyCode, MetaKeys } from '@univerjs/ui';
-import type { IShortcutItem } from '@univerjs/ui';
import { SelectEditorFormulaOperation } from '../../commands/operations/editor-formula.operation';
import { ReferenceAbsoluteOperation } from '../../commands/operations/reference-absolute.operation';
diff --git a/packages/sheets-formula-ui/src/controllers/utils/__tests__/ref-range-formula.spec.ts b/packages/sheets-formula-ui/src/controllers/utils/__tests__/ref-range-formula.spec.ts
index 37c07d08c2..3efdf51f8e 100644
--- a/packages/sheets-formula-ui/src/controllers/utils/__tests__/ref-range-formula.spec.ts
+++ b/packages/sheets-formula-ui/src/controllers/utils/__tests__/ref-range-formula.spec.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import { describe, expect, it } from 'vitest';
-
import type { IFormulaDataItem } from '@univerjs/engine-formula';
+
+import { describe, expect, it } from 'vitest';
import { formulaDataItemToCellData, formulaDataToCellData, isFormulaDataItem } from '../ref-range-formula';
describe('Ref range formula test', () => {
diff --git a/packages/sheets-formula-ui/src/controllers/utils/ref-range-formula.ts b/packages/sheets-formula-ui/src/controllers/utils/ref-range-formula.ts
index 2a85859634..794a38620c 100644
--- a/packages/sheets-formula-ui/src/controllers/utils/ref-range-formula.ts
+++ b/packages/sheets-formula-ui/src/controllers/utils/ref-range-formula.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { cellToRange, Direction, isFormulaId, isFormulaString, ObjectMatrix } from '@univerjs/core';
-import { EffectRefRangId, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveCols, handleMoveRange, handleMoveRows, runRefRangeMutations, SetRangeValuesMutation } from '@univerjs/sheets';
import type { ICellData, IMutationInfo, IObjectMatrixPrimitiveType, IRange, Nullable } from '@univerjs/core';
import type { IFormulaData, IFormulaDataItem, IRangeChange } from '@univerjs/engine-formula';
import type { ISetRangeValuesMutationParams } from '@univerjs/sheets';
+import { cellToRange, Direction, isFormulaId, isFormulaString, ObjectMatrix } from '@univerjs/core';
+import { EffectRefRangId, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveCols, handleMoveRange, handleMoveRows, runRefRangeMutations, SetRangeValuesMutation } from '@univerjs/sheets';
import { checkFormulaDataNull } from './offset-formula-data';
export enum FormulaReferenceMoveType {
diff --git a/packages/sheets-formula-ui/src/controllers/utils/utils.ts b/packages/sheets-formula-ui/src/controllers/utils/utils.ts
index 272d240120..46df255b1d 100644
--- a/packages/sheets-formula-ui/src/controllers/utils/utils.ts
+++ b/packages/sheets-formula-ui/src/controllers/utils/utils.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import { CellValueType, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, isFormulaId, isFormulaString } from '@univerjs/core';
-import { ERROR_TYPE_SET, stripErrorMargin } from '@univerjs/engine-formula';
import type { ICellData, IContextService, Nullable } from '@univerjs/core';
import type { ErrorType } from '@univerjs/engine-formula';
+import { CellValueType, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, isFormulaId, isFormulaString } from '@univerjs/core';
+import { ERROR_TYPE_SET, stripErrorMargin } from '@univerjs/engine-formula';
export function whenEditorStandalone(contextService: IContextService) {
return (
diff --git a/packages/sheets-formula-ui/src/services/prompt.service.ts b/packages/sheets-formula-ui/src/services/prompt.service.ts
index a884556075..466b394753 100644
--- a/packages/sheets-formula-ui/src/services/prompt.service.ts
+++ b/packages/sheets-formula-ui/src/services/prompt.service.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import { createIdentifier, IContextService } from '@univerjs/core';
-import { type IFunctionInfo, type ISequenceNode, sequenceNodeType } from '@univerjs/engine-formula';
-import { Subject } from 'rxjs';
import type { Direction, IDisposable } from '@univerjs/core';
import type { ISearchItem } from '@univerjs/sheets-formula';
import type { Observable } from 'rxjs';
+import { createIdentifier, IContextService } from '@univerjs/core';
+import { type IFunctionInfo, type ISequenceNode, sequenceNodeType } from '@univerjs/engine-formula';
+import { Subject } from 'rxjs';
/** If the formula prompt is visible. */
export const FORMULA_PROMPT_ACTIVATED = 'FORMULA_PROMPT_ACTIVATED';
diff --git a/packages/sheets-formula-ui/src/sheets-formula-ui.plugin.ts b/packages/sheets-formula-ui/src/sheets-formula-ui.plugin.ts
index cf84fac633..70f398f270 100644
--- a/packages/sheets-formula-ui/src/sheets-formula-ui.plugin.ts
+++ b/packages/sheets-formula-ui/src/sheets-formula-ui.plugin.ts
@@ -14,11 +14,12 @@
* limitations under the License.
*/
+import type { Dependency } from '@univerjs/core';
+import type { IUniverSheetsFormulaBaseConfig } from './controllers/config.schema';
import { DependentOn, IConfigService, Inject, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
import { IRenderManagerService } from '@univerjs/engine-render';
import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
-import type { Dependency } from '@univerjs/core';
import { FORMULA_UI_PLUGIN_NAME } from './common/plugin-name';
import {
defaultPluginBaseConfig,
@@ -33,7 +34,6 @@ import { FormulaUIController } from './controllers/formula-ui.controller';
import { PromptController } from './controllers/prompt.controller';
import { FormulaPromptService, IFormulaPromptService } from './services/prompt.service';
import { RefSelectionsRenderService } from './services/render-services/ref-selections.render-service';
-import type { IUniverSheetsFormulaBaseConfig } from './controllers/config.schema';
/**
* The configuration of the formula UI plugin.
diff --git a/packages/sheets-formula-ui/src/views/more-functions/MoreFunctions.tsx b/packages/sheets-formula-ui/src/views/more-functions/MoreFunctions.tsx
index 1c3d3f0988..886c42df9a 100644
--- a/packages/sheets-formula-ui/src/views/more-functions/MoreFunctions.tsx
+++ b/packages/sheets-formula-ui/src/views/more-functions/MoreFunctions.tsx
@@ -14,12 +14,12 @@
* limitations under the License.
*/
+import type { IFunctionInfo } from '@univerjs/engine-formula';
import { LocaleService, useDependency } from '@univerjs/core';
import { Button } from '@univerjs/design';
import { IEditorService } from '@univerjs/docs-ui';
import { useActiveWorkbook } from '@univerjs/sheets-ui';
import React, { useState } from 'react';
-import type { IFunctionInfo } from '@univerjs/engine-formula';
import styles from './index.module.less';
import { InputParams } from './input-params/InputParams';
import { SelectFunction } from './select-function/SelectFunction';
diff --git a/packages/sheets-formula-ui/src/views/more-functions/function-help/FunctionHelp.tsx b/packages/sheets-formula-ui/src/views/more-functions/function-help/FunctionHelp.tsx
index dc938a31b1..7953be140c 100644
--- a/packages/sheets-formula-ui/src/views/more-functions/function-help/FunctionHelp.tsx
+++ b/packages/sheets-formula-ui/src/views/more-functions/function-help/FunctionHelp.tsx
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import React from 'react';
import type { IFunctionParam } from '@univerjs/engine-formula';
+import React from 'react';
import { generateParam } from '../../../services/utils';
interface IFunctionHelpProps {
diff --git a/packages/sheets-formula-ui/src/views/more-functions/input-params/InputParams.tsx b/packages/sheets-formula-ui/src/views/more-functions/input-params/InputParams.tsx
index 09d8b15da0..5e1dbf6677 100644
--- a/packages/sheets-formula-ui/src/views/more-functions/input-params/InputParams.tsx
+++ b/packages/sheets-formula-ui/src/views/more-functions/input-params/InputParams.tsx
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import React, { useState } from 'react';
import type { IFunctionInfo, IFunctionParam } from '@univerjs/engine-formula';
+import React, { useState } from 'react';
import { FunctionHelp } from '../function-help/FunctionHelp';
import { FunctionParams } from '../function-params/FunctionParams';
diff --git a/packages/sheets-formula-ui/src/views/more-functions/select-function/SelectFunction.tsx b/packages/sheets-formula-ui/src/views/more-functions/select-function/SelectFunction.tsx
index babbfb5cf7..5e49a77301 100644
--- a/packages/sheets-formula-ui/src/views/more-functions/select-function/SelectFunction.tsx
+++ b/packages/sheets-formula-ui/src/views/more-functions/select-function/SelectFunction.tsx
@@ -14,14 +14,14 @@
* limitations under the License.
*/
+import type { IFunctionInfo, IFunctionParam } from '@univerjs/engine-formula';
+import type { ISearchItem } from '@univerjs/sheets-formula';
import { LocaleService, useDependency } from '@univerjs/core';
import { Input, Select } from '@univerjs/design';
import { FunctionType } from '@univerjs/engine-formula';
import { CheckMarkSingle } from '@univerjs/icons';
import { IDescriptionService } from '@univerjs/sheets-formula';
import React, { useEffect, useState } from 'react';
-import type { IFunctionInfo, IFunctionParam } from '@univerjs/engine-formula';
-import type { ISearchItem } from '@univerjs/sheets-formula';
import { getFunctionTypeValues } from '../../../services/utils';
import { FunctionHelp } from '../function-help/FunctionHelp';
import { FunctionParams } from '../function-params/FunctionParams';
diff --git a/packages/sheets-formula-ui/src/views/prompt/help-function/HelpFunction.tsx b/packages/sheets-formula-ui/src/views/prompt/help-function/HelpFunction.tsx
index 08aa12f4ff..6815a48c8e 100644
--- a/packages/sheets-formula-ui/src/views/prompt/help-function/HelpFunction.tsx
+++ b/packages/sheets-formula-ui/src/views/prompt/help-function/HelpFunction.tsx
@@ -14,20 +14,20 @@
* limitations under the License.
*/
+import type { IFunctionInfo, IFunctionParam } from '@univerjs/engine-formula';
+import type { IHelpFunctionOperationParams } from '../../../services/prompt.service';
import { IUniverInstanceService, LocaleService, useDependency, useInjector } from '@univerjs/core';
import { Popup } from '@univerjs/design';
import { IEditorService } from '@univerjs/docs-ui';
import { CloseSingle, DetailsSingle, MoreSingle } from '@univerjs/icons';
+
import { ILayoutService, ISidebarService } from '@univerjs/ui';
import React, { useEffect, useState } from 'react';
-
import { throttleTime } from 'rxjs';
-import type { IFunctionInfo, IFunctionParam } from '@univerjs/engine-formula';
import { IFormulaPromptService } from '../../../services/prompt.service';
import { generateParam } from '../../../services/utils';
import { useResizeScrollObserver } from '../resize-scroll-observer';
import styles from './index.module.less';
-import type { IHelpFunctionOperationParams } from '../../../services/prompt.service';
export function HelpFunction() {
const [visible, setVisible] = useState(false);
diff --git a/packages/sheets-formula-ui/src/views/prompt/search-function/SearchFunction.tsx b/packages/sheets-formula-ui/src/views/prompt/search-function/SearchFunction.tsx
index 352763f9cc..2239822aff 100644
--- a/packages/sheets-formula-ui/src/views/prompt/search-function/SearchFunction.tsx
+++ b/packages/sheets-formula-ui/src/views/prompt/search-function/SearchFunction.tsx
@@ -14,15 +14,15 @@
* limitations under the License.
*/
+import type { ISearchItem } from '@univerjs/sheets-formula';
+import type { INavigateParam, ISearchFunctionOperationParams } from '../../../services/prompt.service';
+
import { Direction, IUniverInstanceService, useDependency } from '@univerjs/core';
import { Popup } from '@univerjs/design';
-
import { IEditorService } from '@univerjs/docs-ui';
import React, { useEffect, useRef, useState } from 'react';
-import type { ISearchItem } from '@univerjs/sheets-formula';
import { IFormulaPromptService } from '../../../services/prompt.service';
import styles from './index.module.less';
-import type { INavigateParam, ISearchFunctionOperationParams } from '../../../services/prompt.service';
export function SearchFunction() {
const [visible, setVisible] = useState(false);
diff --git a/packages/sheets-formula/src/commands/mutations/formula.mutation.ts b/packages/sheets-formula/src/commands/mutations/formula.mutation.ts
index 4e7cb5fd4d..fb1892ec79 100644
--- a/packages/sheets-formula/src/commands/mutations/formula.mutation.ts
+++ b/packages/sheets-formula/src/commands/mutations/formula.mutation.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import { CommandType } from '@univerjs/core';
import type { IMutation } from '@univerjs/core';
+import { CommandType } from '@univerjs/core';
export interface IOtherFormulaMarkDirtyParams { [unitId: string]: { [sunUnitId: string]: { [formulaId: string]: boolean } } }
diff --git a/packages/sheets-formula/src/controllers/array-formula-cell-interceptor.controller.ts b/packages/sheets-formula/src/controllers/array-formula-cell-interceptor.controller.ts
index f1b78f271e..569de3209d 100644
--- a/packages/sheets-formula/src/controllers/array-formula-cell-interceptor.controller.ts
+++ b/packages/sheets-formula/src/controllers/array-formula-cell-interceptor.controller.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
+import type { ICommandInfo } from '@univerjs/core';
+import type { ISetArrayFormulaDataMutationParams } from '@univerjs/engine-formula';
import { CellValueType, Disposable, ICommandService, Inject, InterceptorEffectEnum, LifecycleStages, OnLifecycle } from '@univerjs/core';
import { FormulaDataModel, SetArrayFormulaDataMutation, stripErrorMargin } from '@univerjs/engine-formula';
import { INTERCEPTOR_POINT, SheetInterceptorService } from '@univerjs/sheets';
-import type { ICommandInfo } from '@univerjs/core';
-import type { ISetArrayFormulaDataMutationParams } from '@univerjs/engine-formula';
@OnLifecycle(LifecycleStages.Ready, ArrayFormulaCellInterceptorController)
export class ArrayFormulaCellInterceptorController extends Disposable {
diff --git a/packages/sheets-formula/src/controllers/defined-name.controller.ts b/packages/sheets-formula/src/controllers/defined-name.controller.ts
index e54c4e89df..5bc028374a 100644
--- a/packages/sheets-formula/src/controllers/defined-name.controller.ts
+++ b/packages/sheets-formula/src/controllers/defined-name.controller.ts
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+import type { ICommandInfo, IExecutionOptions, Nullable, Workbook } from '@univerjs/core';
+import type { IFunctionInfo, ISetDefinedNameMutationParam } from '@univerjs/engine-formula';
+import type { ISetDefinedNameCommandParams } from '@univerjs/sheets';
import {
Disposable,
ICommandService,
@@ -25,9 +28,6 @@ import {
} from '@univerjs/core';
import { FunctionType, IDefinedNamesService } from '@univerjs/engine-formula';
import { InsertDefinedNameCommand, RemoveDefinedNameCommand, SetDefinedNameCommand, SetWorksheetActiveOperation } from '@univerjs/sheets';
-import type { ICommandInfo, IExecutionOptions, Nullable, Workbook } from '@univerjs/core';
-import type { IFunctionInfo, ISetDefinedNameMutationParam } from '@univerjs/engine-formula';
-import type { ISetDefinedNameCommandParams } from '@univerjs/sheets';
import { IDescriptionService } from '../services/description.service';
export const SCOPE_WORKBOOK_VALUE = 'AllDefaultWorkbook';
diff --git a/packages/sheets-formula/src/controllers/trigger-calculation.controller.ts b/packages/sheets-formula/src/controllers/trigger-calculation.controller.ts
index b875ae2026..075a992fd1 100644
--- a/packages/sheets-formula/src/controllers/trigger-calculation.controller.ts
+++ b/packages/sheets-formula/src/controllers/trigger-calculation.controller.ts
@@ -14,6 +14,16 @@
* limitations under the License.
*/
+import type { ICommandInfo, IUnitRange, Nullable } from '@univerjs/core';
+import type {
+ IDirtyUnitFeatureMap,
+ IDirtyUnitOtherFormulaMap,
+ IDirtyUnitSheetNameMap,
+ IExecutionInProgressParams,
+ IFormulaDirtyData,
+ ISetFormulaCalculationNotificationMutation,
+} from '@univerjs/engine-formula';
+import type { ISetRangeValuesMutationParams } from '@univerjs/sheets';
import { Disposable, ICommandService, throttle } from '@univerjs/core';
import {
FormulaExecutedStateType,
@@ -30,16 +40,6 @@ import {
SetStyleCommand,
} from '@univerjs/sheets';
import { BehaviorSubject } from 'rxjs';
-import type { ICommandInfo, IUnitRange, Nullable } from '@univerjs/core';
-import type {
- IDirtyUnitFeatureMap,
- IDirtyUnitOtherFormulaMap,
- IDirtyUnitSheetNameMap,
- IExecutionInProgressParams,
- IFormulaDirtyData,
- ISetFormulaCalculationNotificationMutation,
-} from '@univerjs/engine-formula';
-import type { ISetRangeValuesMutationParams } from '@univerjs/sheets';
/**
* This interface is for the progress bar to display the calculation progress.
diff --git a/packages/sheets-formula/src/controllers/update-formula.controller.ts b/packages/sheets-formula/src/controllers/update-formula.controller.ts
index df80480046..5c1a6c0832 100644
--- a/packages/sheets-formula/src/controllers/update-formula.controller.ts
+++ b/packages/sheets-formula/src/controllers/update-formula.controller.ts
@@ -14,6 +14,32 @@
* limitations under the License.
*/
+import type {
+ ICommandInfo,
+ IExecutionOptions,
+ IRange,
+ IUnitRange,
+ Nullable,
+ Workbook } from '@univerjs/core';
+import type { IFormulaData, IFormulaDataItem, ISequenceNode, IUnitSheetNameMap } from '@univerjs/engine-formula';
+import type {
+ IDeleteRangeMoveLeftCommandParams,
+ IDeleteRangeMoveUpCommandParams,
+ IInsertColCommandParams,
+ IInsertRowCommandParams,
+ IInsertSheetMutationParams,
+ IMoveColsCommandParams,
+ IMoveRangeCommandParams,
+ IMoveRowsCommandParams,
+ InsertRangeMoveDownCommandParams,
+ InsertRangeMoveRightCommandParams,
+ IRemoveRowColCommandParams,
+ IRemoveSheetCommandParams,
+ IRemoveSheetMutationParams,
+ ISetRangeValuesMutationParams,
+ ISetWorksheetNameCommandParams,
+} from '@univerjs/sheets';
+
import {
Direction,
Disposable,
@@ -42,6 +68,7 @@ import { deserializeRangeWithSheet,
SetFormulaCalculationStartMutation,
SetFormulaDataMutation,
} from '@univerjs/engine-formula';
+
import {
ClearSelectionFormatCommand,
DeleteRangeMoveLeftCommand,
@@ -77,34 +104,7 @@ import {
SetWorksheetNameCommand,
SheetInterceptorService,
} from '@univerjs/sheets';
-
import { map } from 'rxjs';
-import type {
- ICommandInfo,
- IExecutionOptions,
- IRange,
- IUnitRange,
- Nullable,
- Workbook } from '@univerjs/core';
-
-import type { IFormulaData, IFormulaDataItem, ISequenceNode, IUnitSheetNameMap } from '@univerjs/engine-formula';
-import type {
- IDeleteRangeMoveLeftCommandParams,
- IDeleteRangeMoveUpCommandParams,
- IInsertColCommandParams,
- IInsertRowCommandParams,
- IInsertSheetMutationParams,
- IMoveColsCommandParams,
- IMoveRangeCommandParams,
- IMoveRowsCommandParams,
- InsertRangeMoveDownCommandParams,
- InsertRangeMoveRightCommandParams,
- IRemoveRowColCommandParams,
- IRemoveSheetCommandParams,
- IRemoveSheetMutationParams,
- ISetRangeValuesMutationParams,
- ISetWorksheetNameCommandParams,
-} from '@univerjs/sheets';
import { removeFormulaData } from './utils/offset-formula-data';
import { formulaDataToCellData, getFormulaReferenceMoveUndoRedo } from './utils/ref-range-formula';
diff --git a/packages/sheets-formula/src/services/description.service.ts b/packages/sheets-formula/src/services/description.service.ts
index 3ace4df222..91cab1cd29 100644
--- a/packages/sheets-formula/src/services/description.service.ts
+++ b/packages/sheets-formula/src/services/description.service.ts
@@ -14,7 +14,11 @@
* limitations under the License.
*/
+import type { IDisposable } from '@univerjs/core';
+import type { IFunctionInfo, IFunctionNames } from '@univerjs/engine-formula';
+import type { IUniverSheetsFormulaBaseConfig } from '../controllers/config.schema';
import { createIdentifier, IConfigService, Inject, LocaleService, toDisposable } from '@univerjs/core';
+
import {
functionArray,
functionCompatibility,
@@ -36,13 +40,9 @@ import {
IFunctionService,
isReferenceStrings,
} from '@univerjs/engine-formula';
-import type { IDisposable } from '@univerjs/core';
-import type { IFunctionInfo, IFunctionNames } from '@univerjs/engine-formula';
-
import { PLUGIN_CONFIG_KEY_BASE } from '../controllers/config.schema';
import { FUNCTION_LIST } from './function-list/function-list';
import { getFunctionName } from './utils';
-import type { IUniverSheetsFormulaBaseConfig } from '../controllers/config.schema';
export interface ISearchItem {
name: string;
diff --git a/packages/sheets-formula/src/sheets-formula.plugin.ts b/packages/sheets-formula/src/sheets-formula.plugin.ts
index 48220d62c1..295ec17674 100644
--- a/packages/sheets-formula/src/sheets-formula.plugin.ts
+++ b/packages/sheets-formula/src/sheets-formula.plugin.ts
@@ -14,12 +14,16 @@
* limitations under the License.
*/
+import type { Dependency } from '@univerjs/core';
+import type {
+ IUniverSheetsFormulaBaseConfig,
+ IUniverSheetsFormulaRemoteConfig,
+} from './controllers/config.schema';
import { DependentOn, IConfigService, Inject, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
+
import { fromModule, IRPCChannelService, toModule } from '@univerjs/rpc';
import { UniverSheetsPlugin } from '@univerjs/sheets';
-
-import type { Dependency } from '@univerjs/core';
import { SHEETS_FORMULA_PLUGIN_NAME } from './common/plugin-name';
import { ActiveDirtyController } from './controllers/active-dirty.controller';
import { ArrayFormulaCellInterceptorController } from './controllers/array-formula-cell-interceptor.controller';
@@ -38,10 +42,6 @@ import { FormulaRefRangeService } from './services/formula-ref-range.service';
import { IRegisterFunctionService, RegisterFunctionService } from './services/register-function.service';
import { RegisterOtherFormulaService } from './services/register-other-formula.service';
import { IRemoteRegisterFunctionService, RemoteRegisterFunctionService, RemoteRegisterFunctionServiceName } from './services/remote/remote-register-function.service';
-import type {
- IUniverSheetsFormulaBaseConfig,
- IUniverSheetsFormulaRemoteConfig,
-} from './controllers/config.schema';
@DependentOn(UniverFormulaEnginePlugin)
export class UniverRemoteSheetsFormulaPlugin extends Plugin {
diff --git a/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts b/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts
index 762c10265c..923663a443 100644
--- a/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts
+++ b/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts
@@ -564,6 +564,8 @@ export class EditingRenderController extends Disposable implements IRenderModule
? CursorChange.CursorChange
: CursorChange.StartEditor;
+ this._editorBridgeService.refreshEditCellState();
+
const editCellState = this._editorBridgeService.getEditCellState();
if (editCellState == null) {
return;
@@ -635,10 +637,6 @@ export class EditingRenderController extends Disposable implements IRenderModule
// TODO: @JOCS, Get the position close to the cursor after clicking on the cell.
const cursor = documentDataModel.getBody()!.dataStream.length - 2 || 0;
- scene.getViewport(DOC_VIEWPORT_KEY.VIEW_MAIN)?.scrollToViewportPos({
- viewportScrollX: Number.POSITIVE_INFINITY,
- });
-
this._textSelectionManagerService.replaceTextRanges([
{
startOffset: cursor,
@@ -647,6 +645,15 @@ export class EditingRenderController extends Disposable implements IRenderModule
]);
}
+ const viewMain = scene.getViewport(DOC_VIEWPORT_KEY.VIEW_MAIN);
+ // TODO@weird94, this should be optimized.
+ // currently, we must wait for the resize to complete before scrolling to the selection,
+ setTimeout(() => {
+ viewMain?.scrollToViewportPos({
+ viewportScrollX: Number.POSITIVE_INFINITY,
+ viewportScrollY: Number.POSITIVE_INFINITY,
+ });
+ }, 10);
this._renderManagerService.getRenderById(unitId)?.scene.resetCursor();
}
@@ -969,6 +976,11 @@ export class EditingRenderController extends Disposable implements IRenderModule
this._cellEditorManagerService.setState({
show: param.visible,
});
+ const editorObject = this._getEditorObject();
+ editorObject?.scene.getViewport(DOC_VIEWPORT_KEY.VIEW_MAIN)?.scrollToViewportPos({
+ viewportScrollX: 0,
+ viewportScrollY: 0,
+ });
const editorUnitId = this._editorBridgeService.getCurrentEditorId();
if (editorUnitId == null || !this._editorService.isSheetEditor(editorUnitId)) {
return;
diff --git a/packages/sheets-ui/src/sheets-ui-plugin.ts b/packages/sheets-ui/src/sheets-ui-plugin.ts
index 08e66ecf6d..fccc9d9440 100644
--- a/packages/sheets-ui/src/sheets-ui-plugin.ts
+++ b/packages/sheets-ui/src/sheets-ui-plugin.ts
@@ -14,14 +14,15 @@
* limitations under the License.
*/
+import type { Dependency, Workbook } from '@univerjs/core';
+import type { IUniverUIConfig } from '@univerjs/ui';
+import type { IUniverSheetsUIConfig } from './controllers/config.schema';
+
import { DependentOn, IConfigService, Inject, Injector, IUniverInstanceService, mergeOverrideWithDependencies, Plugin, UniverInstanceType } from '@univerjs/core';
import { IRenderManagerService } from '@univerjs/engine-render';
import { IRefSelectionsService, RefSelectionsService, UniverSheetsPlugin } from '@univerjs/sheets';
-
import { PLUGIN_CONFIG_KEY as UI_PLUGIN_CONFIG_KEY } from '@univerjs/ui';
import { filter } from 'rxjs/operators';
-import type { Dependency, Workbook } from '@univerjs/core';
-import type { IUniverUIConfig } from '@univerjs/ui';
import { ActiveWorksheetController } from './controllers/active-worksheet/active-worksheet.controller';
import { AutoFillController } from './controllers/auto-fill.controller';
import { AutoHeightController } from './controllers/auto-height.controller';
@@ -84,7 +85,6 @@ import { SheetSkeletonManagerService } from './services/sheet-skeleton-manager.s
import { SheetsRenderService } from './services/sheets-render.service';
import { ShortcutExperienceService } from './services/shortcut-experience.service';
import { IStatusBarService, StatusBarService } from './services/status-bar.service';
-import type { IUniverSheetsUIConfig } from './controllers/config.schema';
@DependentOn(UniverSheetsPlugin)
export class UniverSheetsUIPlugin extends Plugin {
diff --git a/packages/sheets/src/controllers/calculate-result-apply.controller.ts b/packages/sheets/src/controllers/calculate-result-apply.controller.ts
index 1c9d17b7dd..e261a4a657 100644
--- a/packages/sheets/src/controllers/calculate-result-apply.controller.ts
+++ b/packages/sheets/src/controllers/calculate-result-apply.controller.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import { Disposable, ICommandService, Inject, IUniverInstanceService, LifecycleStages, ObjectMatrix, OnLifecycle } from '@univerjs/core';
-import { handleNumfmtInCell, SetFormulaCalculationResultMutation } from '@univerjs/engine-formula';
import type { ICellData, ICommandInfo, IObjectMatrixPrimitiveType, Nullable } from '@univerjs/core';
import type { ISetFormulaCalculationResultMutation } from '@univerjs/engine-formula';
+import { Disposable, ICommandService, Inject, IUniverInstanceService, LifecycleStages, ObjectMatrix, OnLifecycle } from '@univerjs/core';
+import { handleNumfmtInCell, SetFormulaCalculationResultMutation } from '@univerjs/engine-formula';
import { SetRangeValuesMutation } from '../commands/mutations/set-range-values.mutation';
diff --git a/packages/ui/src/services/progress/progress.service.ts b/packages/ui/src/services/progress/progress.service.ts
index 8004fd2db6..999e5bdb16 100644
--- a/packages/ui/src/services/progress/progress.service.ts
+++ b/packages/ui/src/services/progress/progress.service.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import { createIdentifier, Disposable } from '@univerjs/core';
-import { Subject } from 'rxjs';
import type { IDisposable } from '@univerjs/core';
import type { Observable } from 'rxjs';
+import { createIdentifier, Disposable } from '@univerjs/core';
+import { Subject } from 'rxjs';
export interface IProgressCount {
count: number;