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.

refactor: data-validation model (#3383)

zhangwf61277f86a4e
diff --git a/examples/src/data/sheets/demo/default-workbook-data-demo.ts b/examples/src/data/sheets/demo/default-workbook-data-demo.ts
index c23deaf926..dd7dc36510 100644
--- a/examples/src/data/sheets/demo/default-workbook-data-demo.ts
+++ b/examples/src/data/sheets/demo/default-workbook-data-demo.ts
@@ -139,6 +139,8 @@ const dataValidation: IDataValidationRule[] = [
startColumn: 0,
endColumn: 5,
}],
+ formula1: 'TRUE',
+ formula2: 'FALSE',
},
{
uid: 'xxx-3',
diff --git a/examples/src/sheets/lazy.ts b/examples/src/sheets/lazy.ts
index 1a736aa1c5..4188c3ff26 100644
--- a/examples/src/sheets/lazy.ts
+++ b/examples/src/sheets/lazy.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import type { Plugin, PluginCtor } from '@univerjs/core';
+import { UniverActionRecorderPlugin } from '@univerjs/action-recorder';
+import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';
import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';
import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';
-import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';
import { UniverUniscriptPlugin } from '@univerjs/uniscript';
-import { UniverActionRecorderPlugin } from '@univerjs/action-recorder';
+import type { Plugin, PluginCtor } from '@univerjs/core';
export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCtor<Plugin>, unknown]> {
return [
diff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.ts
index 64b2d9d8cc..7f5ee6a8af 100644
--- a/examples/src/sheets/main.ts
+++ b/examples/src/sheets/main.ts
@@ -14,36 +14,36 @@
* limitations under the License.
*/
-import type { Nullable } from '@univerjs/core';
import { LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';
-import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
-import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
+import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { defaultTheme } from '@univerjs/design';
-import { UniverUIPlugin } from '@univerjs/ui';
import { UniverDocsPlugin } from '@univerjs/docs';
import { UniverDocsUIPlugin } from '@univerjs/docs-ui';
+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
+import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
+import { FUniver } from '@univerjs/facade';
+import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';
import { UniverSheetsPlugin } from '@univerjs/sheets';
-import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';
import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';
-import { UniverDebuggerPlugin } from '@univerjs/debugger';
-import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';
-import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment-ui';
-import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
-import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';
-import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';
-import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';
-import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
-import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';
-import { FUniver } from '@univerjs/facade';
-import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';
-import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';
import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
-import { enUS, ruRU, viVN, zhCN, zhTW } from '../locales';
+import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';
+import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';
+import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
+import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';
+import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';
+import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
+import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';
+import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';
+import { UniverUIPlugin } from '@univerjs/ui';
+import type { Nullable } from '@univerjs/core';
+import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';
+import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment-ui';
import { DEFAULT_WORKBOOK_DATA_DEMO } from '../data/sheets/demo/default-workbook-data-demo';
+import { enUS, ruRU, viVN, zhCN, zhTW } from '../locales';
/* eslint-disable-next-line node/prefer-global/process */
const IS_E2E: boolean = !!process.env.IS_E2E;
@@ -84,8 +84,12 @@ univer.registerPlugin(UniverSheetsFormulaPlugin, { notExecuteFormula: true });
univer.registerPlugin(UniverSheetsFilterPlugin);
// hyperlink
univer.registerPlugin(UniverSheetsHyperLinkUIPlugin);
-// data validation
-univer.registerPlugin(UniverSheetsDataValidationPlugin);
+
+// mock lazy load data validation
+setTimeout(() => {
+ univer.registerPlugin(UniverSheetsDataValidationPlugin);
+}, 500);
+
// sort
univer.registerPlugin(UniverSheetsSortUIPlugin);
// condition formatting
diff --git a/packages-experimental/action-recorder/src/commands/commands/replay.command.ts b/packages-experimental/action-recorder/src/commands/commands/replay.command.ts
index 61f9697d77..a8217f0b29 100644
--- a/packages-experimental/action-recorder/src/commands/commands/replay.command.ts
+++ b/packages-experimental/action-recorder/src/commands/commands/replay.command.ts
@@ -15,8 +15,8 @@
*/
import { CommandType, type ICommand } from '@univerjs/core';
-import { IMessageService } from '@univerjs/ui';
import { MessageType } from '@univerjs/design';
+import { IMessageService } from '@univerjs/ui';
import { ActionReplayService } from '../../services/replay.service';
export const ReplayLocalRecordCommand: ICommand = {
diff --git a/packages-experimental/action-recorder/src/commands/operations/operation.ts b/packages-experimental/action-recorder/src/commands/operations/operation.ts
index e518574ff5..a53a6578a0 100644
--- a/packages-experimental/action-recorder/src/commands/operations/operation.ts
+++ b/packages-experimental/action-recorder/src/commands/operations/operation.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { IOperation } from '@univerjs/core';
import { CommandType } from '@univerjs/core';
+import type { IOperation } from '@univerjs/core';
import { ActionRecorderService } from '../../services/action-recorder.service';
export const OpenRecordPanelOperation: IOperation = {
diff --git a/packages-experimental/action-recorder/src/controllers/action-recorder.controller.tsx b/packages-experimental/action-recorder/src/controllers/action-recorder.controller.tsx
index 7c4005115f..ba2d75b45f 100644
--- a/packages-experimental/action-recorder/src/controllers/action-recorder.controller.tsx
+++ b/packages-experimental/action-recorder/src/controllers/action-recorder.controller.tsx
@@ -15,16 +15,16 @@
*/
import { connectInjector, Disposable, ICommandService, Inject, Injector } from '@univerjs/core';
-import { BuiltInUIPart, ComponentManager, IMenuManagerService, IUIPartsService } from '@univerjs/ui';
+import { RecordSingle } from '@univerjs/icons';
import { CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeltaColumnWidthCommand, DeltaRowHeightCommand, InsertColAfterCommand, InsertColBeforeCommand, InsertRowAfterCommand, InsertRowBeforeCommand, InsertSheetCommand, RemoveSheetCommand, SetFrozenCancelCommand, SetFrozenCommand, SetHorizontalTextAlignCommand, SetOverlineCommand, SetRangeProtectionCommand, SetRangeValuesCommand, SetSelectionsOperation, SetStrikeThroughCommand, SetStyleCommand, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetVerticalTextAlignCommand, SetWorksheetActivateCommand, SetWorksheetActiveOperation } from '@univerjs/sheets';
-import { SetRangeBoldCommand, SetRangeFontFamilyCommand, SetRangeFontSizeCommand, SetRangeItalicCommand, SetRangeStrickThroughCommand, SetRangeSubscriptCommand, SetRangeSuperscriptCommand, SetRangeTextColorCommand, SetRangeUnderlineCommand, SheetCopyCommand, SheetCutCommand, SheetPasteBesidesBorderCommand, SheetPasteColWidthCommand, SheetPasteCommand, SheetPasteFormatCommand, SheetPasteShortKeyCommand, SheetPasteValueCommand } from '@univerjs/sheets-ui';
import { RemoveSheetFilterCommand, SetSheetFilterRangeCommand, SetSheetsFilterCriteriaCommand } from '@univerjs/sheets-filter-ui';
-import { RecordSingle } from '@univerjs/icons';
-import { CloseRecordPanelOperation, OpenRecordPanelOperation } from '../commands/operations/operation';
-import { RecorderPanel } from '../views/components/RecorderPanel';
+import { SetRangeBoldCommand, SetRangeFontFamilyCommand, SetRangeFontSizeCommand, SetRangeItalicCommand, SetRangeStrickThroughCommand, SetRangeSubscriptCommand, SetRangeSuperscriptCommand, SetRangeTextColorCommand, SetRangeUnderlineCommand, SheetCopyCommand, SheetCutCommand, SheetPasteBesidesBorderCommand, SheetPasteColWidthCommand, SheetPasteCommand, SheetPasteFormatCommand, SheetPasteShortKeyCommand, SheetPasteValueCommand } from '@univerjs/sheets-ui';
+import { BuiltInUIPart, ComponentManager, IMenuManagerService, IUIPartsService } from '@univerjs/ui';
import { CompleteRecordingActionCommand, StartRecordingActionCommand, StopRecordingActionCommand } from '../commands/commands/record.command';
-import { ActionRecorderService } from '../services/action-recorder.service';
import { ReplayLocalRecordCommand } from '../commands/commands/replay.command';
+import { CloseRecordPanelOperation, OpenRecordPanelOperation } from '../commands/operations/operation';
+import { ActionRecorderService } from '../services/action-recorder.service';
+import { RecorderPanel } from '../views/components/RecorderPanel';
import { menuSchema } from './action-recorder.menu';
export class ActionRecorderController extends Disposable {
diff --git a/packages-experimental/action-recorder/src/plugin.ts b/packages-experimental/action-recorder/src/plugin.ts
index d85ca24845..8b91f7dc42 100644
--- a/packages-experimental/action-recorder/src/plugin.ts
+++ b/packages-experimental/action-recorder/src/plugin.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { Dependency } from '@univerjs/core';
import { Inject, Injector, Plugin } from '@univerjs/core';
-import { ActionRecorderService } from './services/action-recorder.service';
+import type { Dependency } from '@univerjs/core';
import { ActionRecorderController } from './controllers/action-recorder.controller';
+import { ActionRecorderService } from './services/action-recorder.service';
import { ActionReplayService } from './services/replay.service';
/**
diff --git a/packages-experimental/action-recorder/src/services/action-recorder.service.ts b/packages-experimental/action-recorder/src/services/action-recorder.service.ts
index 262fc70513..1845f687a6 100644
--- a/packages-experimental/action-recorder/src/services/action-recorder.service.ts
+++ b/packages-experimental/action-recorder/src/services/action-recorder.service.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { ICommand, ICommandInfo, IDisposable, Nullable } from '@univerjs/core';
import { CommandType, Disposable, ICommandService, ILogService } from '@univerjs/core';
import { SetSelectionsOperation } from '@univerjs/sheets';
import { ILocalFileService } from '@univerjs/ui';
import { BehaviorSubject } from 'rxjs';
+import type { ICommand, ICommandInfo, IDisposable, Nullable } from '@univerjs/core';
/**
* This service is for recording commands. What commands should be recorded can be configured by other
diff --git a/packages-experimental/action-recorder/src/services/replay.service.ts b/packages-experimental/action-recorder/src/services/replay.service.ts
index ab588a7ac3..c9543073c0 100644
--- a/packages-experimental/action-recorder/src/services/replay.service.ts
+++ b/packages-experimental/action-recorder/src/services/replay.service.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { ICommandInfo } from '@univerjs/core';
import { Disposable, ICommandService, ILogService, IUniverInstanceService } from '@univerjs/core';
import { MessageType } from '@univerjs/design';
import { ILocalFileService, IMessageService } from '@univerjs/ui';
+import type { ICommandInfo } from '@univerjs/core';
/**
* This service is for replaying user actions.
diff --git a/packages-experimental/action-recorder/src/views/components/RecorderPanel.tsx b/packages-experimental/action-recorder/src/views/components/RecorderPanel.tsx
index a218205f75..21ce2dfd06 100644
--- a/packages-experimental/action-recorder/src/views/components/RecorderPanel.tsx
+++ b/packages-experimental/action-recorder/src/views/components/RecorderPanel.tsx
@@ -15,14 +15,14 @@
*/
import { ICommandService, useDependency } from '@univerjs/core';
-import React, { useCallback } from 'react';
-import { useObservable } from '@univerjs/ui';
import { Button } from '@univerjs/design';
import { RecordSingle } from '@univerjs/icons';
+import { useObservable } from '@univerjs/ui';
import clsx from 'clsx';
-import { ActionRecorderService } from '../../services/action-recorder.service';
+import React, { useCallback } from 'react';
import { CompleteRecordingActionCommand, StartRecordingActionCommand, StopRecordingActionCommand } from '../../commands/commands/record.command';
import { CloseRecordPanelOperation } from '../../commands/operations/operation';
+import { ActionRecorderService } from '../../services/action-recorder.service';
import styles from './index.module.less';
export function RecorderPanel() {
diff --git a/packages-experimental/uni-docs-ui/src/controllers/menu.ts b/packages-experimental/uni-docs-ui/src/controllers/menu.ts
index 833ecf8813..11dc47ead1 100644
--- a/packages-experimental/uni-docs-ui/src/controllers/menu.ts
+++ b/packages-experimental/uni-docs-ui/src/controllers/menu.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import type { IAccessor } from '@univerjs/core';
import { BooleanNumber, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, ICommandService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
import { DocSelectionManagerService, DocSkeletonManagerService, SetTextSelectionsOperation } from '@univerjs/docs';
import { SetInlineFormatCommand } from '@univerjs/docs-ui';
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
-
import { getHeaderFooterMenuHiddenObservable, getMenuHiddenObservable, type IMenuButtonItem, type IMenuItem, MenuItemType } from '@univerjs/ui';
+
import { combineLatest, Observable } from 'rxjs';
+import type { IAccessor } from '@univerjs/core';
export const DOC_ITALIC_MUTATION_ID = 'doc.command.uni-italic';
export const DOC_BOLD_MUTATION_ID = 'doc.command.uni-bold';
diff --git a/packages-experimental/uni-docs-ui/src/controllers/uni-docs-ui.controller.tsx b/packages-experimental/uni-docs-ui/src/controllers/uni-docs-ui.controller.tsx
index 986290aa3f..177bb10d44 100644
--- a/packages-experimental/uni-docs-ui/src/controllers/uni-docs-ui.controller.tsx
+++ b/packages-experimental/uni-docs-ui/src/controllers/uni-docs-ui.controller.tsx
@@ -15,10 +15,10 @@
*/
import { ICommandService, IConfigService, Inject, Injector, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
+import { IMAGE_MENU_ID as DocsImageMenuId } from '@univerjs/docs-drawing-ui';
+import { BulletListCommand, DocCreateTableOperation, DocUIController, OrderListCommand, SetInlineFormatBoldCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '@univerjs/docs-ui';
import { ComponentManager, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
import { BuiltinUniToolbarItemId, generateCloneMutation, UniToolbarService } from '@univerjs/uniui';
-import { BulletListCommand, DocCreateTableOperation, DocUIController, OrderListCommand, SetInlineFormatBoldCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '@univerjs/docs-ui';
-import { IMAGE_MENU_ID as DocsImageMenuId } from '@univerjs/docs-drawing-ui';
import { DOC_BOLD_MUTATION_ID, DOC_ITALIC_MUTATION_ID, DOC_STRIKE_MUTATION_ID, DOC_TABLE_MUTATION_ID, DOC_UNDERLINE_MUTATION_ID } from './menu';
import { menuSchema } from './menu.schema';
diff --git a/packages-experimental/uni-formula-ui/src/commands/commands/doc.command.ts b/packages-experimental/uni-formula-ui/src/commands/commands/doc.command.ts
index 930518c9f9..2475a82f37 100644
--- a/packages-experimental/uni-formula-ui/src/commands/commands/doc.command.ts
+++ b/packages-experimental/uni-formula-ui/src/commands/commands/doc.command.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { ICommand, IDocumentBody, IMutationInfo } from '@univerjs/core';
import { CommandType, CustomRangeType, generateRandomId, ICommandService, LocaleService, makeCustomRangeStream, sequenceExecute } from '@univerjs/core';
import { makeSelection, replaceSelectionFactory } from '@univerjs/docs-ui';
-import type { IAddDocUniFormulaMutationParams, IRemoveDocUniFormulaMutationParams, IUpdateDocUniFormulaMutationParams } from '@univerjs/uni-formula';
import { AddDocUniFormulaMutation, RemoveDocUniFormulaMutation, UpdateDocUniFormulaMutation } from '@univerjs/uni-formula';
+import type { ICommand, IDocumentBody, IMutationInfo } from '@univerjs/core';
+import type { IAddDocUniFormulaMutationParams, IRemoveDocUniFormulaMutationParams, IUpdateDocUniFormulaMutationParams } from '@univerjs/uni-formula';
export interface IAddDocUniFormulaCommandParams {
unitId: string;
diff --git a/packages-experimental/uni-formula-ui/src/commands/commands/slide.command.ts b/packages-experimental/uni-formula-ui/src/commands/commands/slide.command.ts
index f36a4771c7..b775223ea1 100644
--- a/packages-experimental/uni-formula-ui/src/commands/commands/slide.command.ts
+++ b/packages-experimental/uni-formula-ui/src/commands/commands/slide.command.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { ICommand, IDocumentBody } from '@univerjs/core';
import { CommandType, CustomRangeType, generateRandomId, ICommandService, LocaleService, makeCustomRangeStream } from '@univerjs/core';
-import { SLIDE_EDITOR_ID } from '@univerjs/slides-ui';
import { makeSelection, replaceSelectionFactory } from '@univerjs/docs-ui';
+import { SLIDE_EDITOR_ID } from '@univerjs/slides-ui';
+import type { ICommand, IDocumentBody } from '@univerjs/core';
import { SlideUIFormulaCacheService } from '../../services/slide-ui-formula-cache.service';
export interface IAddSlideUniFormulaCommandParams {
diff --git a/packages-experimental/uni-formula-ui/src/controllers/doc-formula-input.controller.ts b/packages-experimental/uni-formula-ui/src/controllers/doc-formula-input.controller.ts
index 032673dbf4..535868e245 100644
--- a/packages-experimental/uni-formula-ui/src/controllers/doc-formula-input.controller.ts
+++ b/packages-experimental/uni-formula-ui/src/controllers/doc-formula-input.controller.ts
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-import type { DocumentDataModel } from '@univerjs/core';
import { CustomRangeType, Disposable, ICommandService, ILogService, Inject, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
import { DocSelectionManagerService } from '@univerjs/docs';
-import { IEditorService } from '@univerjs/ui';
-import type { IInsertCommandParams } from '@univerjs/docs-ui';
import { DeleteLeftCommand, DocEventManagerService, InsertCommand, MoveCursorOperation } from '@univerjs/docs-ui';
-
-import { filter, map, mergeMap } from 'rxjs';
import { IRenderManagerService } from '@univerjs/engine-render';
+import { IEditorService } from '@univerjs/ui';
+import { filter, map, mergeMap } from 'rxjs';
+
+import type { DocumentDataModel } from '@univerjs/core';
+import type { IInsertCommandParams } from '@univerjs/docs-ui';
import { AddDocUniFormulaCommand, RemoveDocUniFormulaCommand, UpdateDocUniFormulaCommand } from '../commands/commands/doc.command';
-import type { IShowFormulaPopupOperationParams } from '../commands/operations/operation';
import { CloseFormulaPopupOperation, ShowFormulaPopupOperation } from '../commands/operations/operation';
-import { UNI_FORMULA_EDITOR_ID } from '../views/components/DocFormulaPopup';
import { UniFormulaPopupService } from '../services/formula-popup.service';
+import { UNI_FORMULA_EDITOR_ID } from '../views/components/DocFormulaPopup';
+import type { IShowFormulaPopupOperationParams } from '../commands/operations/operation';
const FORMULA_INPUT_TRIGGER_CHAR = '=';
diff --git a/packages-experimental/uni-formula-ui/src/controllers/slide-formula-input.controller.ts b/packages-experimental/uni-formula-ui/src/controllers/slide-formula-input.controller.ts
index 75488d395b..84b4363160 100644
--- a/packages-experimental/uni-formula-ui/src/controllers/slide-formula-input.controller.ts
+++ b/packages-experimental/uni-formula-ui/src/controllers/slide-formula-input.controller.ts
@@ -15,16 +15,16 @@
*/
import { Disposable, ICommandService, Inject, Injector, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
-import { IEditorService } from '@univerjs/ui';
import { DocSelectionManagerService } from '@univerjs/docs';
+import { InsertCommand } from '@univerjs/docs-ui';
import { ISlideEditorBridgeService } from '@univerjs/slides-ui';
+import { IEditorService } from '@univerjs/ui';
import type { IInsertCommandParams } from '@univerjs/docs-ui';
-import { InsertCommand } from '@univerjs/docs-ui';
import { AddSlideUniFormulaCommand } from '../commands/commands/slide.command';
-import { UNI_FORMULA_EDITOR_ID } from '../views/components/DocFormulaPopup';
+import { CloseFormulaPopupOperation, ShowFormulaPopupOperation } from '../commands/operations/operation';
import { UniFormulaPopupService } from '../services/formula-popup.service';
+import { UNI_FORMULA_EDITOR_ID } from '../views/components/DocFormulaPopup';
import type { IShowFormulaPopupOperationParams, ISlidePopupPosition } from '../commands/operations/operation';
-import { CloseFormulaPopupOperation, ShowFormulaPopupOperation } from '../commands/operations/operation';
const FORMULA_INPUT_TRIGGER_CHAR = '=';
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 430e9e2344..8679271f8a 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 { Disposable, FORMULA_EDITOR_ACTIVATED, ICommandService, IContextService, ILogService, Inject } from '@univerjs/core';
import { DocCanvasPopManagerService, makeSelection } from '@univerjs/docs-ui';
-import { BehaviorSubject, Subject } from 'rxjs';
-import type { IShortcutItem } from '@univerjs/ui';
-import { IShortcutService, KeyCode } from '@univerjs/ui';
import { FORMULA_PROMPT_ACTIVATED } from '@univerjs/sheets-formula';
+import { IShortcutService, KeyCode } from '@univerjs/ui';
import { IUniFormulaService } from '@univerjs/uni-formula';
-import type { IAddDocUniFormulaCommandParams } from '../commands/commands/doc.command';
+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 type { IPopupPosition } from '../commands/operations/operation';
+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 { AddSlideUniFormulaCommand } 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-experimental/uni-formula-ui/src/services/uni-formula.service.ts b/packages-experimental/uni-formula-ui/src/services/uni-formula.service.ts
index bfbae03977..714b94fe61 100644
--- a/packages-experimental/uni-formula-ui/src/services/uni-formula.service.ts
+++ b/packages-experimental/uni-formula-ui/src/services/uni-formula.service.ts
@@ -14,14 +14,6 @@
* limitations under the License.
*/
-import type {
- DocumentDataModel,
- ICellData,
- ICommand,
- IDisposable,
- IDocumentBody,
- Nullable,
- SlideDataModel } from '@univerjs/core';
import {
CommandType,
CustomRangeType,
@@ -36,14 +28,22 @@ import {
toDisposable,
UniverInstanceType,
} from '@univerjs/core';
+import { makeSelection, replaceSelectionFactory } from '@univerjs/docs-ui';
+import { RichText } from '@univerjs/engine-render';
import { DataSyncPrimaryController } from '@univerjs/rpc';
import { RegisterOtherFormulaService } from '@univerjs/sheets-formula';
-import type { IDocFormulaCache, ISlideFormulaCache } from '@univerjs/uni-formula';
+import { CanvasView } from '@univerjs/slides-ui';
import { DumbUniFormulaService, IUniFormulaService } from '@univerjs/uni-formula';
import { take } from 'rxjs';
-import { RichText } from '@univerjs/engine-render';
-import { CanvasView } from '@univerjs/slides-ui';
-import { makeSelection, replaceSelectionFactory } from '@univerjs/docs-ui';
+import type {
+ DocumentDataModel,
+ ICellData,
+ ICommand,
+ IDisposable,
+ IDocumentBody,
+ Nullable,
+ SlideDataModel } from '@univerjs/core';
+import type { IDocFormulaCache, ISlideFormulaCache } from '@univerjs/uni-formula';
import { type IDocPopupPosition, type ISlidePopupPosition, isSlidePosition } from '../commands/operations/operation';
const PSEUDO_SUBUNIT = 'PSEUDO_SUBUNIT';
diff --git a/packages-experimental/uni-sheets-ui/src/controllers/menu.ts b/packages-experimental/uni-sheets-ui/src/controllers/menu.ts
index e441bafd95..c255a9c8f7 100644
--- a/packages-experimental/uni-sheets-ui/src/controllers/menu.ts
+++ b/packages-experimental/uni-sheets-ui/src/controllers/menu.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import type { IAccessor } from '@univerjs/core';
import { BooleanNumber, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, EDITOR_ACTIVATED, FOCUSING_SHEET, FontItalic, FontWeight, ICommandService, IContextService, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
import { DocSelectionManagerService, SetTextSelectionsOperation } from '@univerjs/docs';
+import { SetInlineFormatCommand } from '@univerjs/docs-ui';
import {
RangeProtectionPermissionEditPoint,
SetRangeValuesMutation,
@@ -27,10 +27,10 @@ import {
WorksheetEditPermission,
WorksheetSetCellStylePermission,
} from '@univerjs/sheets';
-import { SetInlineFormatCommand } from '@univerjs/docs-ui';
import { deriveStateFromActiveSheet$, getCurrentRangeDisable$ } from '@univerjs/sheets-ui';
import { getMenuHiddenObservable, type IMenuButtonItem, MenuItemType } from '@univerjs/ui';
import { Observable } from 'rxjs';
+import type { IAccessor } from '@univerjs/core';
export const SHEET_BOLD_MUTATION_ID = 'sheet.command.uni-bold';
export const SHEET_ITALIC_MUTATION_ID = 'sheet.command.uni-italic';
diff --git a/packages/data-validation/package.json b/packages/data-validation/package.json
index fcdeb6c8f5..aa7749c8ba 100644
--- a/packages/data-validation/package.json
+++ b/packages/data-validation/package.json
@@ -64,7 +64,6 @@
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
- "@univerjs/sheets": "workspace:*",
"rxjs": ">=7.0.0"
},
"dependencies": {
@@ -74,6 +73,7 @@
},
"devDependencies": {
"@univerjs-infra/shared": "workspace:*",
+ "@univerjs/core": "workspace:*",
"rxjs": "^7.8.1",
"typescript": "^5.6.2",
"vite": "^5.4.4",
diff --git a/packages/data-validation/src/commands/commands/data-validation.command.ts b/packages/data-validation/src/commands/commands/data-validation.command.ts
index 718eb4590e..4befd96cf7 100644
--- a/packages/data-validation/src/commands/commands/data-validation.command.ts
+++ b/packages/data-validation/src/commands/commands/data-validation.command.ts
@@ -16,7 +16,6 @@
import { CommandType, ICommandService, ILogService, IUndoRedoService } from '@univerjs/core';
import type { ICommand, IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleOptions, IMutationInfo, Injector, IRange, ISheetDataValidationRule } from '@univerjs/core';
-import type { ISheetCommandSharedParams } from '@univerjs/sheets';
import type { IAddDataValidationMutationParams, IRemoveDataValidationMutationParams, IUpdateDataValidationMutationParams } from '../mutations/data-validation.mutation';
import { AddDataValidationMutation, RemoveDataValidationMutation, UpdateDataValidationMutation } from '../mutations/data-validation.mutation';
import { DataValidatorRegistryService } from '../../services/data-validator-registry.service';
@@ -24,6 +23,11 @@ import { DataValidationModel } from '../../models/data-validation-model';
import { getRuleOptions, getRuleSetting } from '../../common/util';
import { UpdateRuleType } from '../../types/enum/update-rule-type';
+interface ISheetCommandSharedParams {
+ unitId: string;
+ subUnitId: string;
+}
+
export interface IAddDataValidationCommandParams extends ISheetCommandSharedParams {
rule: Omit<IDataValidationRule, 'ranges'> & {
range: IRange;
@@ -32,14 +36,14 @@ export interface IAddDataValidationCommandParams extends ISheetCommandSharedPara
}
/**
- * @deprecated
+ * @deprecated `AddDataValidationCommand` is deprecated, please use `AddSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!
*/
export const AddDataValidationCommand: ICommand<IAddDataValidationCommandParams> = {
type: CommandType.COMMAND,
id: 'data-validation.command.addRule',
async handler(accessor, params) {
const logService = accessor.get(ILogService);
- logService.warn('[Deprecated] AddDataValidationCommand is deprecated, please use AddSheetDataValidationCommand in @univerjs/sheets-data-validation instead!');
+ logService.error('[Deprecated]: `AddDataValidationCommand` is deprecated, please use `AddSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!');
if (!params) {
return false;
}
@@ -112,10 +116,16 @@ export const removeDataValidationUndoFactory = (accessor: Injector, redoParams:
return undoMutations;
};
+/**
+ * @deprecated `RemoveDataValidationCommand` is deprecated, please use `RemoveSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!
+ */
export const RemoveDataValidationCommand: ICommand<IRemoveDataValidationCommandParams> = {
type: CommandType.COMMAND,
id: 'data-validation.command.removeRule',
handler(accessor, params) {
+ const logService = accessor.get(ILogService);
+ logService.error('[Deprecated]: `RemoveDataValidationCommand` is deprecated, please use `RemoveSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!');
+
if (!params) {
return false;
}
@@ -157,14 +167,14 @@ export interface IUpdateDataValidationOptionsCommandParams extends ISheetCommand
}
/**
- * @deprecated
+ * @deprecated `UpdateDataValidationOptionsCommand` is deprecated, please use `UpdateSheetDataValidationOptionsCommand` in `@univerjs/sheets-data-validation` instead!
*/
export const UpdateDataValidationOptionsCommand: ICommand<IUpdateDataValidationOptionsCommandParams> = {
type: CommandType.COMMAND,
id: 'data-validation.command.updateDataValidationSetting',
handler(accessor, params) {
const logService = accessor.get(ILogService);
- logService.warn('[Deprecated] UpdateDataValidationOptionsCommand is deprecated, please use UpdateSheetDataValidationOptionsCommand in @univerjs/sheets-data-validation instead!');
+ logService.warn('[Deprecated]: `UpdateDataValidationOptionsCommand` is deprecated, please use `UpdateSheetDataValidationOptionsCommand` in `@univerjs/sheets-data-validation` instead!');
if (!params) {
return false;
}
@@ -224,14 +234,15 @@ export interface IUpdateDataValidationSettingCommandParams extends ISheetCommand
}
/**
- * @deprecated
+ * @deprecated `UpdateDataValidationSettingCommand` is deprecated, please use `UpdateSheetDataValidationSettingCommand` in `@univerjs/sheets-data-validation` instead!
*/
export const UpdateDataValidationSettingCommand: ICommand<IUpdateDataValidationSettingCommandParams> = {
type: CommandType.COMMAND,
id: 'data-validation.command.updateDataValidationOptions',
handler(accessor, params) {
const logService = accessor.get(ILogService);
- logService.warn('[Deprecated] UpdateDataValidationSettingCommand is deprecated, please use UpdateSheetDataValidationSettingCommand in @univerjs/sheets-data-validation instead!');
+ logService.error('[Deprecated]: `UpdateDataValidationSettingCommand` is deprecated, please use `UpdateSheetDataValidationSettingCommand` in `@univerjs/sheets-data-validation` instead!');
+
if (!params) {
return false;
}
@@ -264,7 +275,7 @@ export const UpdateDataValidationSettingCommand: ICommand<IUpdateDataValidationS
type: UpdateRuleType.SETTING,
payload: {
...setting,
- ...validator.normlizeFormula(newRule, unitId, subUnitId),
+ ...validator.normalizeFormula(newRule, unitId, subUnitId),
},
},
};
@@ -301,10 +312,16 @@ export const UpdateDataValidationSettingCommand: ICommand<IUpdateDataValidationS
export interface IRemoveAllDataValidationCommandParams extends ISheetCommandSharedParams {
}
+/**
+ * @deprecated `RemoveAllDataValidationCommand` is deprecated, please use `RemoveSheetAllDataValidationCommand` in `@univerjs/sheets-data-validation` instead!
+ */
export const RemoveAllDataValidationCommand: ICommand<IRemoveAllDataValidationCommandParams> = {
type: CommandType.COMMAND,
id: 'data-validation.command.removeAll',
handler(accessor, params) {
+ const logService = accessor.get(ILogService);
+ logService.error('[Deprecated]: `RemoveAllDataValidationCommand` is deprecated, please use `RemoveSheetAllDataValidationCommand` in `@univerjs/sheets-data-validation` instead!');
+
if (!params) {
return false;
}
diff --git a/packages/data-validation/src/commands/mutations/data-validation.mutation.ts b/packages/data-validation/src/commands/mutations/data-validation.mutation.ts
index 5e96d22e45..8a1735b301 100644
--- a/packages/data-validation/src/commands/mutations/data-validation.mutation.ts
+++ b/packages/data-validation/src/commands/mutations/data-validation.mutation.ts
@@ -16,15 +16,16 @@
import { CommandType } from '@univerjs/core';
import type { ICommand, IDataValidationRule } from '@univerjs/core';
-import type { ISheetCommandSharedParams } from '@univerjs/sheets';
import type { IUpdateRulePayload } from '../../types/interfaces/i-update-rule-payload';
import type { DataValidationChangeSource } from '../../models/data-validation-model';
import { DataValidationModel } from '../../models/data-validation-model';
-export interface IAddDataValidationMutationParams extends ISheetCommandSharedParams {
+export interface IAddDataValidationMutationParams {
rule: IDataValidationRule | IDataValidationRule[];
index?: number;
source?: DataValidationChangeSource;
+ unitId: string;
+ subUnitId: string;
}
export const AddDataValidationMutation: ICommand<IAddDataValidationMutationParams> = {
@@ -42,9 +43,11 @@ export const AddDataValidationMutation: ICommand<IAddDataValidationMutationParam
},
};
-export interface IRemoveDataValidationMutationParams extends ISheetCommandSharedParams {
+export interface IRemoveDataValidationMutationParams {
ruleId: string | string[];
source?: DataValidationChangeSource;
+ unitId: string;
+ subUnitId: string;
}
export const RemoveDataValidationMutation: ICommand<IRemoveDataValidationMutationParams> = {
@@ -69,10 +72,12 @@ export const RemoveDataValidationMutation: ICommand<IRemoveDataValidationMutatio
},
};
-export interface IUpdateDataValidationMutationParams extends ISheetCommandSharedParams {
+export interface IUpdateDataValidationMutationParams {
payload: IUpdateRulePayload;
ruleId: string;
source?: DataValidationChangeSource;
+ unitId: string;
+ subUnitId: string;
}
export const UpdateDataValidationMutation: ICommand<IUpdateDataValidationMutationParams> = {
diff --git a/packages/data-validation/src/common/util.ts b/packages/data-validation/src/common/util.ts
index 4c1fedeabe..7045ae119f 100644
--- a/packages/data-validation/src/common/util.ts
+++ b/packages/data-validation/src/common/util.ts
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-import type { IAccessor, IDataValidationRuleBase, IDataValidationRuleOptions } from '@univerjs/core';
-import { DataValidationOperator, DataValidationType, Tools } from '@univerjs/core';
-import { SheetsSelectionsService } from '@univerjs/sheets';
+import type { IDataValidationRuleBase, IDataValidationRuleOptions } from '@univerjs/core';
export function getRuleSetting(rule: IDataValidationRuleBase): IDataValidationRuleBase {
return {
@@ -44,17 +42,3 @@ export function getRuleOptions(rule: IDataValidationRuleOptions): IDataValidatio
};
}
-export function createDefaultNewRule(accessor: IAccessor) {
- const selectionManagerService = accessor.get(SheetsSelectionsService);
- const currentRanges = selectionManagerService.getCurrentSelections().map((s) => s.range);
- const uid = Tools.generateRandomId(6);
- const rule = {
- uid,
- type: DataValidationType.DECIMAL,
- operator: DataValidationOperator.EQUAL,
- formula1: '100',
- ranges: currentRanges ?? [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }],
- };
-
- return rule;
-}
diff --git a/packages/data-validation/src/controllers/dv-resource.controller.ts b/packages/data-validation/src/controllers/dv-resource.controller.ts
index ee016cf995..eac8d95a6f 100644
--- a/packages/data-validation/src/controllers/dv-resource.controller.ts
+++ b/packages/data-validation/src/controllers/dv-resource.controller.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { ISheetDataValidationRule } from '@univerjs/core';
import { Disposable, Inject, IResourceManagerService, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
+import type { ISheetDataValidationRule } from '@univerjs/core';
import { DataValidationModel } from '../models/data-validation-model';
type DataValidationJSON = Record<string, ISheetDataValidationRule[]>;
diff --git a/packages/data-validation/src/index.ts b/packages/data-validation/src/index.ts
index 729c1e793e..71a55c408b 100644
--- a/packages/data-validation/src/index.ts
+++ b/packages/data-validation/src/index.ts
@@ -19,7 +19,6 @@ export { DataValidatorRegistryService, DataValidatorRegistryScope } from './serv
export { DataValidationModel, type DataValidationChangeSource, type IRuleChange, type IValidStatusChange } from './models/data-validation-model';
export {
- createDefaultNewRule,
getRuleOptions,
getRuleSetting,
} from './common/util';
@@ -32,27 +31,12 @@ export type { IDataValidationDropdownProps } from './types/interfaces/i-data-val
export { BaseDataValidator } from './validators/base-data-validator';
export type { IFormulaResult, IValidatorCellInfo } from './validators/base-data-validator';
export type { IBaseDataValidationWidget } from './validators/base-widget';
-export { DataValidationManager } from './models/data-validation-manager';
export type { IFormulaValidResult } from './validators/base-data-validator';
export { TWO_FORMULA_OPERATOR_COUNT } from './types/const/two-formula-operators';
export { DataValidationResourceController } from './controllers/dv-resource.controller';
-export { DataValidationSheetController } from './controllers/dv-sheet.controller';
export { TextLengthErrorTitleMap } from './types/const/operator-text-map';
// #region - all commands
-
-export {
- AddDataValidationCommand,
- RemoveDataValidationCommand,
- UpdateDataValidationOptionsCommand,
- UpdateDataValidationSettingCommand,
- RemoveAllDataValidationCommand,
- removeDataValidationUndoFactory,
- type IRemoveDataValidationCommandParams,
- type IAddDataValidationCommandParams,
- type IRemoveAllDataValidationCommandParams,
-} from './commands/commands/data-validation.command';
-
export {
AddDataValidationMutation,
RemoveDataValidationMutation,
diff --git a/packages/data-validation/src/models/data-validation-manager.ts b/packages/data-validation/src/models/data-validation-manager.ts
deleted file mode 100644
index 7527f0ff9e..0000000000
--- a/packages/data-validation/src/models/data-validation-manager.ts
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import type { ICellDataForSheetInterceptor, IDataValidationRule, Nullable } from '@univerjs/core';
-import { DataValidationStatus, Disposable } from '@univerjs/core';
-import { BehaviorSubject } from 'rxjs';
-import type { IUpdateRulePayload } from '../types/interfaces/i-update-rule-payload';
-import { UpdateRuleType } from '../types/enum/update-rule-type';
-import { getRuleOptions, getRuleSetting } from '../common/util';
-
-export interface IDataValidationPos {
- row: number;
- col: number;
- unitId: string;
- subUnitId: string;
-}
-
-export class DataValidationManager<T extends IDataValidationRule> extends Disposable {
- private _dataValidations: T[] = [];
- private _dataValidationMap = new Map<string, T>();
- private _dataValidations$ = new BehaviorSubject<T[]>(this._dataValidations);
-
- readonly unitId: string;
- readonly subUnitId: string;
- readonly dataValidations$ = this._dataValidations$.asObservable();
-
- constructor(unitId: string, subUnitId: string) {
- super();
- this.unitId = unitId;
- this.subUnitId = subUnitId;
- this._notice();
-
- this.disposeWithMe({
- dispose: () => {
- this._dataValidations$.complete();
- },
- });
- }
-
- private _notice() {
- this._dataValidations$.next(this._dataValidations);
- }
-
- getRuleById(id: string) {
- return this._dataValidationMap.get(id);
- }
-
- getRuleIndex(id: string) {
- return this._dataValidations.findIndex((rule) => rule.uid === id);
- }
-
- addRule(rule: T | T[], index?: number) {
- const _rules = Array.isArray(rule) ? rule : [rule];
- const rules = _rules.filter((item) => !this._dataValidationMap.has(item.uid));
-
- if (typeof index === 'number' && index < this._dataValidations.length) {
- this._dataValidations.splice(index, 0, ...rules);
- } else {
- this._dataValidations.push(...rules);
- }
-
- rules.forEach((item) => {
- this._dataValidationMap.set(item.uid, item);
- });
-
- this._notice();
- }
-
- removeRule(ruleId: string) {
- const index = this._dataValidations.findIndex((item) => item.uid === ruleId);
- if (index > -1) {
- this._dataValidations.splice(index, 1);
- this._dataValidationMap.delete(ruleId);
- this._notice();
- }
- }
-
- updateRule(ruleId: string, payload: IUpdateRulePayload) {
- const oldRule = this._dataValidationMap.get(ruleId);
- const index = this._dataValidations.findIndex((rule) => ruleId === rule.uid);
-
- if (!oldRule) {
- throw new Error(`Data validation rule is not found, ruleId: ${ruleId}.`);
- }
-
- const rule = { ...oldRule };
-
- switch (payload.type) {
- case UpdateRuleType.RANGE: {
- rule.ranges = payload.payload;
- break;
- }
- case UpdateRuleType.SETTING: {
- Object.assign(rule, getRuleSetting(payload.payload));
- break;
- }
-
- case UpdateRuleType.OPTIONS: {
- Object.assign(rule, getRuleOptions(payload.payload));
- break;
- }
- default:
- break;
- }
-
- this._dataValidations[index] = rule;
- this._dataValidationMap.set(ruleId, rule);
- this._notice();
- return rule;
- }
-
- getDataValidations() {
- return this._dataValidations;
- }
-
- toJSON() {
- return this._dataValidations;
- }
-
- validator(_value: Nullable<ICellDataForSheetInterceptor>, _rule: IDataValidationRule, _pos: IDataValidationPos, _onComplete: (status: DataValidationStatus, changed: boolean) => void) {
- return DataValidationStatus.VALID;
- }
-}
diff --git a/packages/data-validation/src/models/data-validation-model.ts b/packages/data-validation/src/models/data-validation-model.ts
index 2c10fa5627..3f1fe0786e 100644
--- a/packages/data-validation/src/models/data-validation-model.ts
+++ b/packages/data-validation/src/models/data-validation-model.ts
@@ -14,23 +14,24 @@
* limitations under the License.
*/
-import type { DataValidationStatus, ICellDataForSheetInterceptor, IDataValidationRule, Nullable } from '@univerjs/core';
-import { Disposable, ILogService } from '@univerjs/core';
+import type { DataValidationStatus, IDataValidationRule } from '@univerjs/core';
+import { Disposable, ILogService, Tools } from '@univerjs/core';
import { debounceTime, Subject } from 'rxjs';
import type { IUpdateRulePayload } from '../types/interfaces/i-update-rule-payload';
-import type { IDataValidationPos } from './data-validation-manager';
-import { DataValidationManager } from './data-validation-manager';
+import { UpdateRuleType } from '../types/enum/update-rule-type';
+import { getRuleOptions, getRuleSetting } from '../common/util';
-type ManagerCreator<T extends IDataValidationRule> = (unitId: string, subUnitId: string) => DataValidationManager<T>;
type DataValidationChangeType = 'update' | 'add' | 'remove';
export type DataValidationChangeSource = 'command' | 'patched';
-export interface IRuleChange<T extends IDataValidationRule> {
- rule?: T;
+export interface IRuleChange {
+ rule: IDataValidationRule;
type: DataValidationChangeType;
unitId: string;
subUnitId: string;
source: DataValidationChangeSource;
+ updatePayload?: IUpdateRulePayload;
+ oldRule?: IDataValidationRule;
}
export interface IValidStatusChange {
@@ -40,15 +41,16 @@ export interface IValidStatusChange {
status: DataValidationStatus;
}
-export class DataValidationModel<T extends IDataValidationRule = IDataValidationRule> extends Disposable {
- private readonly _model = new Map<string, Map<string, DataValidationManager<T>>>();
- private _managerCreator: ManagerCreator<T> = (unitId: string, subUnitId: string) => new DataValidationManager<T>(unitId, subUnitId);
- private readonly _ruleChange$ = new Subject<IRuleChange<T>>();
- private readonly _validStatusChange$ = new Subject<IValidStatusChange>();
+interface ISubUnitDataValidation {
+ map: Map<string, IDataValidationRule>; list: IDataValidationRule[];
+}
+
+export class DataValidationModel extends Disposable {
+ private readonly _model = new Map<string, Map<string, ISubUnitDataValidation>>();
+ private readonly _ruleChange$ = new Subject<IRuleChange>();
ruleChange$ = this._ruleChange$.asObservable();
ruleChangeDebounce$ = this.ruleChange$.pipe(debounceTime(20));
- validStatusChange$ = this._validStatusChange$.asObservable().pipe(debounceTime(20));
constructor(
@ILogService private readonly _logService: ILogService
@@ -58,16 +60,11 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
this.disposeWithMe({
dispose: () => {
this._ruleChange$.complete();
- this._validStatusChange$.complete();
},
});
}
- setManagerCreator(creator: (unitId: string, subUnitId: string) => DataValidationManager<T>) {
- this._managerCreator = creator;
- }
-
- ensureManager(unitId: string, subUnitId: string) {
+ private _ensureMap(unitId: string, subUnitId: string) {
if (!this._model.has(unitId)) {
this._model.set(unitId, new Map());
}
@@ -77,15 +74,74 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
return unitMap.get(subUnitId)!;
}
- const manager = this._managerCreator(unitId, subUnitId);
- unitMap.set(subUnitId, manager);
- this.disposeWithMe(manager);
- return manager;
+ const map = { map: new Map<string, IDataValidationRule>(), list: [] as IDataValidationRule[] };
+ unitMap.set(subUnitId, map);
+
+ return map;
}
- private _addRuleSideEffect(unitId: string, subUnitId: string, rule: T, source: DataValidationChangeSource) {
- const manager = this.ensureManager(unitId, subUnitId);
- const oldRule = manager.getRuleById(rule.uid);
+ private _addSubUnitRule(subUnit: ISubUnitDataValidation, rule: IDataValidationRule | IDataValidationRule[], index?: number) {
+ const { map: dataValidationMap, list: dataValidations } = subUnit;
+ const _rules = Array.isArray(rule) ? rule : [rule];
+ const rules = _rules.filter((item) => !dataValidationMap.has(item.uid));
+
+ if (typeof index === 'number' && index < dataValidations.length) {
+ dataValidations.splice(index, 0, ...rules);
+ } else {
+ dataValidations.push(...rules);
+ }
+
+ rules.forEach((item) => {
+ dataValidationMap.set(item.uid, item);
+ });
+ }
+
+ private _removeSubUnitRule(subUnit: ISubUnitDataValidation, ruleId: string) {
+ const { map: dataValidationMap, list: dataValidations } = subUnit;
+ const index = dataValidations.findIndex((item) => item.uid === ruleId);
+ if (index > -1) {
+ dataValidations.splice(index, 1);
+ dataValidationMap.delete(ruleId);
+ }
+ }
+
+ private _updateSubUnitRule(subUnit: ISubUnitDataValidation, ruleId: string, payload: IUpdateRulePayload): IDataValidationRule {
+ const { map: dataValidationMap, list: dataValidations } = subUnit;
+ const oldRule = dataValidationMap.get(ruleId);
+ const index = dataValidations.findIndex((rule) => ruleId === rule.uid);
+
+ if (!oldRule) {
+ throw new Error(`Data validation rule is not found, ruleId: ${ruleId}.`);
+ }
+
+ const rule = { ...oldRule };
+
+ switch (payload.type) {
+ case UpdateRuleType.RANGE: {
+ rule.ranges = payload.payload;
+ break;
+ }
+ case UpdateRuleType.SETTING: {
+ Object.assign(rule, getRuleSetting(payload.payload));
+ break;
+ }
+
+ case UpdateRuleType.OPTIONS: {
+ Object.assign(rule, getRuleOptions(payload.payload));
+ break;
+ }
+ default:
+ break;
+ }
+
+ dataValidations[index] = rule;
+ dataValidationMap.set(ruleId, rule);
+ return rule;
+ }
+
+ private _addRuleSideEffect(unitId: string, subUnitId: string, rule: IDataValidationRule, source: DataValidationChangeSource) {
+ const subUnitMap = this._ensureMap(unitId, subUnitId);
+ const oldRule = subUnitMap.map.get(rule.uid);
if (oldRule) {
return;
}
@@ -98,15 +154,15 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
});
}
- addRule(unitId: string, subUnitId: string, rule: T | T[], source: DataValidationChangeSource, index?: number) {
+ addRule(unitId: string, subUnitId: string, rule: IDataValidationRule | IDataValidationRule[], source: DataValidationChangeSource, index?: number) {
try {
- const manager = this.ensureManager(unitId, subUnitId);
+ const subUnitMap = this._ensureMap(unitId, subUnitId);
const rules = Array.isArray(rule) ? rule : [rule];
rules.forEach((item) => {
this._addRuleSideEffect(unitId, subUnitId, item, source);
});
- manager.addRule(rule, index);
+ this._addSubUnitRule(subUnitMap, rule, index);
} catch (error) {
this._logService.error(error);
}
@@ -114,15 +170,20 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
updateRule(unitId: string, subUnitId: string, ruleId: string, payload: IUpdateRulePayload, source: DataValidationChangeSource) {
try {
- const manager = this.ensureManager(unitId, subUnitId);
- const rule = manager.updateRule(ruleId, payload);
-
+ const subUnitMap = this._ensureMap(unitId, subUnitId);
+ const oldRule = Tools.deepClone(subUnitMap.map.get(ruleId));
+ if (!oldRule) {
+ throw new Error(`Data validation rule is not found, ruleId: ${ruleId}.`);
+ }
+ const rule = this._updateSubUnitRule(subUnitMap, ruleId, payload);
this._ruleChange$.next({
rule,
type: 'update',
unitId,
subUnitId,
source,
+ updatePayload: payload,
+ oldRule,
});
} catch (error) {
this._logService.error(error);
@@ -131,10 +192,10 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
removeRule(unitId: string, subUnitId: string, ruleId: string, source: DataValidationChangeSource) {
try {
- const manager = this.ensureManager(unitId, subUnitId);
- const oldRule = manager.getRuleById(ruleId);
+ const map = this._ensureMap(unitId, subUnitId);
+ const oldRule = map.map.get(ruleId);
if (oldRule) {
- manager.removeRule(ruleId);
+ this._removeSubUnitRule(map, ruleId);
this._ruleChange$.next({
rule: oldRule,
type: 'remove',
@@ -149,33 +210,18 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
}
getRuleById(unitId: string, subUnitId: string, ruleId: string) {
- const manager = this.ensureManager(unitId, subUnitId);
- return manager.getRuleById(ruleId);
+ const map = this._ensureMap(unitId, subUnitId);
+ return map.map.get(ruleId);
}
getRuleIndex(unitId: string, subUnitId: string, ruleId: string) {
- const manager = this.ensureManager(unitId, subUnitId);
- return manager.getRuleIndex(ruleId);
+ const map = this._ensureMap(unitId, subUnitId);
+ return map.list.findIndex((rule) => rule.uid === ruleId);
}
getRules(unitId: string, subUnitId: string) {
- const manager = this.ensureManager(unitId, subUnitId);
- return manager.getDataValidations();
- }
-
- validator(rule: T, pos: IDataValidationPos, value: Nullable<ICellDataForSheetInterceptor>) {
- const { unitId, subUnitId } = pos;
- const manager = this.ensureManager(unitId, subUnitId);
- return manager.validator(value, rule, pos, (status, changed) => {
- if (changed) {
- this._validStatusChange$.next({
- unitId,
- subUnitId,
- ruleId: rule.uid,
- status,
- });
- }
- });
+ const manager = this._ensureMap(unitId, subUnitId);
+ return [...manager.list];
}
getUnitRules(unitId: string) {
@@ -185,8 +231,8 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
}
const res = [] as [string, IDataValidationRule[]][];
- unitMap.forEach((manager) => {
- res.push([manager.subUnitId, manager.getDataValidations()]);
+ unitMap.forEach((manager, subUnitId) => {
+ res.push([subUnitId, manager.list]);
});
return res;
@@ -199,4 +245,8 @@ export class DataValidationModel<T extends IDataValidationRule = IDataValidation
getSubUnitIds(unitId: string) {
return Array.from(this._model.get(unitId)?.keys() ?? []);
}
+
+ getAll() {
+ return Array.from(this._model.keys()).map((unitId) => [unitId, this.getUnitRules(unitId)] as const);
+ }
}
diff --git a/packages/data-validation/src/plugin.ts b/packages/data-validation/src/plugin.ts
index 769f9642b9..df53593b20 100644
--- a/packages/data-validation/src/plugin.ts
+++ b/packages/data-validation/src/plugin.ts
@@ -21,7 +21,6 @@ import { DataValidationModel } from './models/data-validation-model';
import { AddDataValidationCommand, RemoveAllDataValidationCommand, RemoveDataValidationCommand, UpdateDataValidationOptionsCommand, UpdateDataValidationSettingCommand } from './commands/commands/data-validation.command';
import { AddDataValidationMutation, RemoveDataValidationMutation, UpdateDataValidationMutation } from './commands/mutations/data-validation.mutation';
import { DataValidationResourceController } from './controllers/dv-resource.controller';
-import { DataValidationSheetController } from './controllers/dv-sheet.controller';
import type { IUniverDataValidationConfig } from './controllers/config.schema';
import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
@@ -49,7 +48,6 @@ export class UniverDataValidationPlugin extends Plugin {
[DataValidationModel],
[DataValidatorRegistryService],
[DataValidationResourceController],
- [DataValidationSheetController],
] as Dependency[]).forEach((d) => this._injector.add(d));
[
diff --git a/packages/data-validation/src/validators/base-data-validator.ts b/packages/data-validation/src/validators/base-data-validator.ts
index 9976aa67db..965d36bd73 100644
--- a/packages/data-validation/src/validators/base-data-validator.ts
+++ b/packages/data-validation/src/validators/base-data-validator.ts
@@ -131,7 +131,7 @@ export abstract class BaseDataValidator<DataType = CellValue> {
abstract validatorFormula(rule: IDataValidationRule, unitId: string, subUnitId: string): IFormulaValidResult;
- normlizeFormula(rule: IDataValidationRule, unitId: string, subUnitId: string) {
+ normalizeFormula(rule: IDataValidationRule, unitId: string, subUnitId: string) {
return {
formula1: rule.formula1,
formula2: rule.formula2,
diff --git a/packages/docs-drawing-ui/src/commands/commands/insert-doc-drawing.command.ts b/packages/docs-drawing-ui/src/commands/commands/insert-doc-drawing.command.ts
index 40337285d3..e73b4551b9 100644
--- a/packages/docs-drawing-ui/src/commands/commands/insert-doc-drawing.command.ts
+++ b/packages/docs-drawing-ui/src/commands/commands/insert-doc-drawing.command.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
import {
CommandType,
ICommandService,
@@ -23,9 +22,10 @@ import {
TextX,
TextXActionType,
} from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { getCustomBlockIdsInSelections, getRetainAndDeleteFromReplace, getRichTextEditPath } from '@univerjs/docs-ui';
+import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { IInsertDrawingCommandParams } from './interfaces';
/**
diff --git a/packages/docs-drawing-ui/src/commands/commands/remove-doc-drawing.command.ts b/packages/docs-drawing-ui/src/commands/commands/remove-doc-drawing.command.ts
index b4da059b7a..7e11a981c1 100644
--- a/packages/docs-drawing-ui/src/commands/commands/remove-doc-drawing.command.ts
+++ b/packages/docs-drawing-ui/src/commands/commands/remove-doc-drawing.command.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
import {
CommandType,
ICommandService,
@@ -24,10 +23,11 @@ import {
TextX,
TextXActionType,
} from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { RichTextEditingMutation } from '@univerjs/docs';
-import { IRenderManagerService, type ITextRangeWithStyle } from '@univerjs/engine-render';
import { DocSelectionRenderService, getRichTextEditPath } from '@univerjs/docs-ui';
+import { IRenderManagerService, type ITextRangeWithStyle } from '@univerjs/engine-render';
+import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { IDeleteDrawingCommandParams } from './interfaces';
/**
diff --git a/packages/docs-drawing-ui/src/commands/commands/update-doc-drawing.command.ts b/packages/docs-drawing-ui/src/commands/commands/update-doc-drawing.command.ts
index 4d23094c89..898ea3a817 100644
--- a/packages/docs-drawing-ui/src/commands/commands/update-doc-drawing.command.ts
+++ b/packages/docs-drawing-ui/src/commands/commands/update-doc-drawing.command.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { DocumentDataModel, IAccessor, ICommand, IDocDrawingBase, IDocDrawingPosition, IMutationInfo, IObjectPositionH, IObjectPositionV, ISize, JSONXActions, WrapTextType } from '@univerjs/core';
import {
BooleanNumber,
CommandType,
@@ -28,11 +27,12 @@ import {
TextXActionType,
Tools,
} from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
-import type { IDocDrawing } from '@univerjs/docs-drawing';
-import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
import { DocSelectionRenderService, getRichTextEditPath } from '@univerjs/docs-ui';
+import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
+import type { DocumentDataModel, IAccessor, ICommand, IDocDrawingBase, IDocDrawingPosition, IMutationInfo, IObjectPositionH, IObjectPositionV, ISize, JSONXActions, WrapTextType } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { IDocDrawing } from '@univerjs/docs-drawing';
import { DocRefreshDrawingsService } from '../../services/doc-refresh-drawings.service';
export enum TextWrappingStyle {
diff --git a/packages/docs-drawing-ui/src/controllers/doc-drawing-transformer-update.controller.ts b/packages/docs-drawing-ui/src/controllers/doc-drawing-transformer-update.controller.ts
index fb8a06f4f8..ae4276f1df 100644
--- a/packages/docs-drawing-ui/src/controllers/doc-drawing-transformer-update.controller.ts
+++ b/packages/docs-drawing-ui/src/controllers/doc-drawing-transformer-update.controller.ts
@@ -21,11 +21,11 @@ import {
OnLifecycle, PositionedObjectLayoutType, throttle, toDisposable, Tools,
} from '@univerjs/core';
import { DocSkeletonManagerService } from '@univerjs/docs';
+import { DocSelectionRenderService, getAnchorBounding, getDocObject, getOneTextSelectionRange, NodePositionConvertToCursor, TEXT_RANGE_LAYER_INDEX } from '@univerjs/docs-ui';
import { IDrawingManagerService } from '@univerjs/drawing';
+import { DocumentSkeletonPageType, getColor, IRenderManagerService, Liquid, PageLayoutType, Rect, Vector2 } from '@univerjs/engine-render';
import type { IDocDrawingBase, IDocDrawingPosition, Nullable } from '@univerjs/core';
import type { BaseObject, Documents, IDocumentSkeletonGlyph, IDocumentSkeletonPage, Image, INodeSearch, IPoint, Viewport } from '@univerjs/engine-render';
-import { DocumentSkeletonPageType, getColor, IRenderManagerService, Liquid, PageLayoutType, Rect, Vector2 } from '@univerjs/engine-render';
-import { DocSelectionRenderService, getAnchorBounding, getDocObject, getOneTextSelectionRange, NodePositionConvertToCursor, TEXT_RANGE_LAYER_INDEX } from '@univerjs/docs-ui';
import { IMoveInlineDrawingCommand, ITransformNonInlineDrawingCommand, UpdateDrawingDocTransformCommand } from '../commands/commands/update-doc-drawing.command';
import type { IDrawingDocTransform } from '../commands/commands/update-doc-drawing.command';
diff --git a/packages/docs-drawing-ui/src/controllers/render-controllers/doc-drawing-transform-update.controller.ts b/packages/docs-drawing-ui/src/controllers/render-controllers/doc-drawing-transform-update.controller.ts
index 791b8eaefc..8704f37413 100644
--- a/packages/docs-drawing-ui/src/controllers/render-controllers/doc-drawing-transform-update.controller.ts
+++ b/packages/docs-drawing-ui/src/controllers/render-controllers/doc-drawing-transform-update.controller.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommandInfo, IDrawingParam, ITransformState } from '@univerjs/core';
import {
BooleanNumber,
Disposable,
@@ -26,14 +25,15 @@ import {
LifecycleStages,
PositionedObjectLayoutType,
} from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import { SetDocZoomRatioOperation } from '@univerjs/docs-ui';
import { IDrawingManagerService } from '@univerjs/drawing';
-import type { Documents, DocumentSkeleton, IDocumentSkeletonHeaderFooter, IDocumentSkeletonPage, Image, IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { Liquid, TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '@univerjs/engine-render';
import { IEditorService } from '@univerjs/ui';
import { debounceTime, filter } from 'rxjs';
-import { SetDocZoomRatioOperation } from '@univerjs/docs-ui';
+import type { DocumentDataModel, ICommandInfo, IDrawingParam, ITransformState } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { Documents, DocumentSkeleton, IDocumentSkeletonHeaderFooter, IDocumentSkeletonPage, Image, IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { DocRefreshDrawingsService } from '../../services/doc-refresh-drawings.service';
interface IDrawingParamsWithBehindText {
diff --git a/packages/docs-drawing-ui/src/views/doc-image-panel/DocDrawingPosition.tsx b/packages/docs-drawing-ui/src/views/doc-image-panel/DocDrawingPosition.tsx
index a1c2e67b64..2ceeb84349 100644
--- a/packages/docs-drawing-ui/src/views/doc-image-panel/DocDrawingPosition.tsx
+++ b/packages/docs-drawing-ui/src/views/doc-image-panel/DocDrawingPosition.tsx
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-import type { ICommandInfo, IObjectPositionH, IObjectPositionV, Nullable } from '@univerjs/core';
import { ICommandService, IUniverInstanceService, LocaleService, ObjectRelativeFromH, ObjectRelativeFromV, PositionedObjectLayoutType, useDependency } from '@univerjs/core';
-import React, { useEffect, useState } from 'react';
-import clsx from 'clsx';
-import type { IDocumentSkeletonDrawing } from '@univerjs/engine-render';
-import { IRenderManagerService } from '@univerjs/engine-render';
-import type { IDocDrawing } from '@univerjs/docs-drawing';
-import { IDrawingManagerService, type IDrawingParam } from '@univerjs/drawing';
import { Checkbox, InputNumber, Select } from '@univerjs/design';
-
import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { DocSelectionRenderService } from '@univerjs/docs-ui';
+import { IDrawingManagerService, type IDrawingParam } from '@univerjs/drawing';
+import { IRenderManagerService } from '@univerjs/engine-render';
+import clsx from 'clsx';
+import React, { useEffect, useState } from 'react';
+import type { ICommandInfo, IObjectPositionH, IObjectPositionV, Nullable } from '@univerjs/core';
+
+import type { IDocDrawing } from '@univerjs/docs-drawing';
+import type { IDocumentSkeletonDrawing } from '@univerjs/engine-render';
import { UpdateDrawingDocTransformCommand } from '../../commands/commands/update-doc-drawing.command';
import styles from './index.module.less';
@@ -161,7 +161,8 @@ export const DocDrawingPosition = (props: IDocDrawingPositionProps) => {
let drawing: Nullable<IDocumentSkeletonDrawing> = null;
let pageMarginLeft = 0;
const skeleton = renderManagerService.getRenderById(unitId)
- ?.with(DocSkeletonManagerService).getSkeleton();
+ ?.with(DocSkeletonManagerService)
+ .getSkeleton();
const skeletonData = skeleton?.getSkeletonData();
@@ -240,7 +241,8 @@ export const DocDrawingPosition = (props: IDocDrawingPositionProps) => {
const { drawingId, unitId } = focusDrawings[0];
const documentDataModel = univerInstanceService.getUniverDocInstance(unitId);
const skeleton = renderManagerService.getRenderById(unitId)
- ?.with(DocSkeletonManagerService).getSkeleton();
+ ?.with(DocSkeletonManagerService)
+ .getSkeleton();
const docSelectionRenderService = renderManagerService.getRenderById(unitId)?.with(DocSelectionRenderService);
diff --git a/packages/docs-drawing-ui/src/views/menu/image.menu.ts b/packages/docs-drawing-ui/src/views/menu/image.menu.ts
index 0f727c9776..bc51aef51f 100644
--- a/packages/docs-drawing-ui/src/views/menu/image.menu.ts
+++ b/packages/docs-drawing-ui/src/views/menu/image.menu.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import { getMenuHiddenObservable, type IMenuItem, MenuItemType } from '@univerjs/ui';
import { IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
-import type { IAccessor } from '@univerjs/core';
-
import { DocSelectionManagerService } from '@univerjs/docs';
+import { getMenuHiddenObservable, type IMenuItem, MenuItemType } from '@univerjs/ui';
+
import { Observable } from 'rxjs';
+import type { IAccessor } from '@univerjs/core';
import { InsertDocImageCommand } from '../../commands/commands/insert-image.command';
export const ImageUploadIcon = 'addition-and-subtraction-single';
diff --git a/packages/docs-hyper-link-ui/src/commands/commands/delete-link.command.ts b/packages/docs-hyper-link-ui/src/commands/commands/delete-link.command.ts
index 19feb11da9..a434de244d 100644
--- a/packages/docs-hyper-link-ui/src/commands/commands/delete-link.command.ts
+++ b/packages/docs-hyper-link-ui/src/commands/commands/delete-link.command.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import type { ICommand } from '@univerjs/core';
import { CommandType, ICommandService } from '@univerjs/core';
import { deleteCustomRangeFactory } from '@univerjs/docs-ui';
+import type { ICommand } from '@univerjs/core';
export interface IDeleteDocHyperLinkMutationParams {
unitId: string;
diff --git a/packages/docs-hyper-link-ui/src/commands/operations/popup.operation.ts b/packages/docs-hyper-link-ui/src/commands/operations/popup.operation.ts
index 76930e087a..346efa64ad 100644
--- a/packages/docs-hyper-link-ui/src/commands/operations/popup.operation.ts
+++ b/packages/docs-hyper-link-ui/src/commands/operations/popup.operation.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { DocumentDataModel, IAccessor, ICommand, ITextRange } from '@univerjs/core';
import { CommandType, CustomRangeType, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
import { DocSelectionManagerService } from '@univerjs/docs';
import { getCustomRangesInterestsWithRange } from '@univerjs/docs-ui';
+import type { DocumentDataModel, IAccessor, ICommand, ITextRange } from '@univerjs/core';
import { DocHyperLinkPopupService } from '../../services/hyper-link-popup.service';
export const shouldDisableAddLink = (accessor: IAccessor) => {
diff --git a/packages/docs-hyper-link-ui/src/controllers/menu.ts b/packages/docs-hyper-link-ui/src/controllers/menu.ts
index ad112f2115..5873783e75 100644
--- a/packages/docs-hyper-link-ui/src/controllers/menu.ts
+++ b/packages/docs-hyper-link-ui/src/controllers/menu.ts
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-import type { IAccessor } from '@univerjs/core';
import { UniverInstanceType } from '@univerjs/core';
-import type { IMenuButtonItem, IShortcutItem } from '@univerjs/ui';
-import { getMenuHiddenObservable, KeyCode, MenuItemType, MetaKeys } from '@univerjs/ui';
-import { debounceTime, Observable } from 'rxjs';
import { DocSelectionManagerService } from '@univerjs/docs';
import { whenDocAndEditorFocused } from '@univerjs/docs-ui';
+import { getMenuHiddenObservable, KeyCode, MenuItemType, MetaKeys } from '@univerjs/ui';
+import { debounceTime, Observable } from 'rxjs';
+import type { IAccessor } from '@univerjs/core';
+import type { IMenuButtonItem, IShortcutItem } from '@univerjs/ui';
import { shouldDisableAddLink, ShowDocHyperLinkEditPopupOperation } from '../commands/operations/popup.operation';
export const DOC_LINK_ICON = 'doc-hyper-link-icon';
diff --git a/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts b/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts
index 639b6aef78..783314bb03 100644
--- a/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts
+++ b/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { DocumentDataModel } from '@univerjs/core';
import { CustomRangeType, Disposable, ICommandService, Inject } from '@univerjs/core';
+import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
import { DocEventManagerService } from '@univerjs/docs-ui';
+import type { DocumentDataModel } from '@univerjs/core';
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
-import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
import { ClickDocHyperLinkOperation, ToggleDocHyperLinkInfoPopupOperation } from '../../commands/operations/popup.operation';
import { DocHyperLinkPopupService } from '../../services/hyper-link-popup.service';
diff --git a/packages/docs-hyper-link-ui/src/services/hyper-link-popup.service.ts b/packages/docs-hyper-link-ui/src/services/hyper-link-popup.service.ts
index 801b671e5e..cb7c34ef7c 100644
--- a/packages/docs-hyper-link-ui/src/services/hyper-link-popup.service.ts
+++ b/packages/docs-hyper-link-ui/src/services/hyper-link-popup.service.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { DocumentDataModel, IDisposable, ITextRangeParam, Nullable } from '@univerjs/core';
import { Disposable, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
+import { DocSelectionManagerService } from '@univerjs/docs';
import { DocCanvasPopManagerService } from '@univerjs/docs-ui';
import { BehaviorSubject } from 'rxjs';
-import { DocSelectionManagerService } from '@univerjs/docs';
+import type { DocumentDataModel, IDisposable, ITextRangeParam, Nullable } from '@univerjs/core';
import { DocHyperLinkEdit } from '../views/hyper-link-edit';
import { DocLinkPopup } from '../views/hyper-link-popup';
diff --git a/packages/docs-hyper-link-ui/src/views/hyper-link-edit/index.tsx b/packages/docs-hyper-link-ui/src/views/hyper-link-edit/index.tsx
index e138f13318..6222aec7aa 100644
--- a/packages/docs-hyper-link-ui/src/views/hyper-link-edit/index.tsx
+++ b/packages/docs-hyper-link-ui/src/views/hyper-link-edit/index.tsx
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-import { Button, FormLayout, Input } from '@univerjs/design';
-import React, { useEffect, useState } from 'react';
import { getBodySlice, ICommandService, IUniverInstanceService, LocaleService, Tools, UniverInstanceType, useDependency, useObservable } from '@univerjs/core';
-import type { DocumentDataModel } from '@univerjs/core';
+import { Button, FormLayout, Input } from '@univerjs/design';
import { DocSelectionManagerService } from '@univerjs/docs';
-import { KeyCode } from '@univerjs/ui';
-import { IRenderManagerService } from '@univerjs/engine-render';
import { DocSelectionRenderService, getPlainTextFormBody } from '@univerjs/docs-ui';
-import { DocHyperLinkPopupService } from '../../services/hyper-link-popup.service';
+import { IRenderManagerService } from '@univerjs/engine-render';
+import { KeyCode } from '@univerjs/ui';
+import React, { useEffect, useState } from 'react';
+import type { DocumentDataModel } from '@univerjs/core';
import { AddDocHyperLinkCommand } from '../../commands/commands/add-link.command';
import { UpdateDocHyperLinkCommand } from '../../commands/commands/update-link.command';
+import { DocHyperLinkPopupService } from '../../services/hyper-link-popup.service';
import styles from './index.module.less';
function hasProtocol(urlString: string) {
diff --git a/packages/docs-mention-ui/src/commands/commands/doc-mention.command.ts b/packages/docs-mention-ui/src/commands/commands/doc-mention.command.ts
index 9fba9c3a4d..05f21d9343 100644
--- a/packages/docs-mention-ui/src/commands/commands/doc-mention.command.ts
+++ b/packages/docs-mention-ui/src/commands/commands/doc-mention.command.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { ICommand, IDocumentBody } from '@univerjs/core';
import { CommandType, CustomRangeType, DataStreamTreeTokenType, ICommandService } from '@univerjs/core';
import { DocSelectionManagerService } from '@univerjs/docs';
import { deleteCustomRangeFactory, replaceSelectionFactory } from '@univerjs/docs-ui';
+import type { ICommand, IDocumentBody } from '@univerjs/core';
import type { IDocMention } from '../../types/interfaces/i-mention';
export interface IAddDocMentionCommandParams {
diff --git a/packages/docs-mention-ui/src/controllers/doc-mention-trigger.controller.ts b/packages/docs-mention-ui/src/controllers/doc-mention-trigger.controller.ts
index 21f3062b3c..e0cb6fbb16 100644
--- a/packages/docs-mention-ui/src/controllers/doc-mention-trigger.controller.ts
+++ b/packages/docs-mention-ui/src/controllers/doc-mention-trigger.controller.ts
@@ -16,11 +16,11 @@
import { Disposable, ICommandService, Inject, LifecycleStages, OnLifecycle, Tools } from '@univerjs/core';
import { DocSelectionManagerService } from '@univerjs/docs';
-import type { IInsertCommandParams } from '@univerjs/docs-ui';
import { DeleteLeftCommand, InsertCommand, MoveCursorOperation } from '@univerjs/docs-ui';
-import { DocMentionPopupService } from '../services/doc-mention-popup.service';
+import type { IInsertCommandParams } from '@univerjs/docs-ui';
import { CloseMentionEditPopupOperation, ShowMentionEditPopupOperation } from '../commands/operations/mention-popup.operation';
import { DocMentionService } from '../services/doc-mention.service';
+import { DocMentionPopupService } from '../services/doc-mention-popup.service';
@OnLifecycle(LifecycleStages.Rendered, DocMentionTriggerController)
export class DocMentionTriggerController extends Disposable {
diff --git a/packages/docs-mention-ui/src/views/mention-edit-popup/index.tsx b/packages/docs-mention-ui/src/views/mention-edit-popup/index.tsx
index cd2fd0d71d..220e16da11 100644
--- a/packages/docs-mention-ui/src/views/mention-edit-popup/index.tsx
+++ b/packages/docs-mention-ui/src/views/mention-edit-popup/index.tsx
@@ -15,13 +15,13 @@
*/
import { ICommandService, IUniverInstanceService, Tools, UniverInstanceType, useDependency, useObservable, UserManagerService } from '@univerjs/core';
-import React, { useEffect } from 'react';
-import { IRenderManagerService } from '@univerjs/engine-render';
import { DocSelectionRenderService } from '@univerjs/docs-ui';
-import { DocMentionPopupService } from '../../services/doc-mention-popup.service';
-import { MentionList } from '../mention-list';
+import { IRenderManagerService } from '@univerjs/engine-render';
+import React, { useEffect } from 'react';
import { AddDocMentionCommand } from '../../commands/commands/doc-mention.command';
+import { DocMentionPopupService } from '../../services/doc-mention-popup.service';
import { MentionType } from '../../types/enums/mention-type';
+import { MentionList } from '../mention-list';
import type { IMention } from '../../types/interfaces/i-mention';
export const MentionEditPopup = () => {
diff --git a/packages/docs-thread-comment-ui/src/commands/commands/add-doc-comment.command.ts b/packages/docs-thread-comment-ui/src/commands/commands/add-doc-comment.command.ts
index 14dfa1d6d7..ae985ce921 100644
--- a/packages/docs-thread-comment-ui/src/commands/commands/add-doc-comment.command.ts
+++ b/packages/docs-thread-comment-ui/src/commands/commands/add-doc-comment.command.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import type { ICommand, ITextRange } from '@univerjs/core';
import { CommandType, CustomDecorationType, ICommandService, sequenceExecuteAsync } from '@univerjs/core';
-import type { IThreadComment } from '@univerjs/thread-comment';
+import { addCustomDecorationBySelectionFactory } from '@univerjs/docs-ui';
import { AddCommentMutation, IThreadCommentDataSourceService } from '@univerjs/thread-comment';
import { SetActiveCommentOperation } from '@univerjs/thread-comment-ui';
-import { addCustomDecorationBySelectionFactory } from '@univerjs/docs-ui';
+import type { ICommand, ITextRange } from '@univerjs/core';
+import type { IThreadComment } from '@univerjs/thread-comment';
import { DEFAULT_DOC_SUBUNIT_ID } from '../../common/const';
export interface IAddDocCommentComment {
diff --git a/packages/docs-thread-comment-ui/src/commands/commands/delete-doc-comment.command.ts b/packages/docs-thread-comment-ui/src/commands/commands/delete-doc-comment.command.ts
index 844d8fcf63..f335ac9c49 100644
--- a/packages/docs-thread-comment-ui/src/commands/commands/delete-doc-comment.command.ts
+++ b/packages/docs-thread-comment-ui/src/commands/commands/delete-doc-comment.command.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import type { ICommand } from '@univerjs/core';
import { CommandType, ICommandService, sequenceExecute } from '@univerjs/core';
import { deleteCustomDecorationFactory } from '@univerjs/docs-ui';
+import type { ICommand } from '@univerjs/core';
export interface IDeleteDocCommentComment {
unitId: string;
diff --git a/packages/docs-thread-comment-ui/src/commands/operations/show-comment-panel.operation.ts b/packages/docs-thread-comment-ui/src/commands/operations/show-comment-panel.operation.ts
index f1389d68c1..4565fee378 100644
--- a/packages/docs-thread-comment-ui/src/commands/operations/show-comment-panel.operation.ts
+++ b/packages/docs-thread-comment-ui/src/commands/operations/show-comment-panel.operation.ts
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommand } from '@univerjs/core';
import { CommandType, ICommandService, IUniverInstanceService, UniverInstanceType, UserManagerService } from '@univerjs/core';
-import type { ActiveCommentInfo } from '@univerjs/thread-comment-ui';
-import { getDT, ThreadCommentPanelService } from '@univerjs/thread-comment-ui';
-import { ISidebarService } from '@univerjs/ui';
import { DocSelectionManagerService } from '@univerjs/docs';
-import { IRenderManagerService } from '@univerjs/engine-render';
import { DocSelectionRenderService, getSelectionText } from '@univerjs/docs-ui';
-import { DocThreadCommentPanel } from '../../views/doc-thread-comment-panel';
+import { IRenderManagerService } from '@univerjs/engine-render';
+import { getDT, ThreadCommentPanelService } from '@univerjs/thread-comment-ui';
+import { ISidebarService } from '@univerjs/ui';
+import type { DocumentDataModel, ICommand } from '@univerjs/core';
+import type { ActiveCommentInfo } from '@univerjs/thread-comment-ui';
import { DEFAULT_DOC_SUBUNIT_ID } from '../../common/const';
import { DocThreadCommentService } from '../../services/doc-thread-comment.service';
+import { DocThreadCommentPanel } from '../../views/doc-thread-comment-panel';
export interface IShowCommentPanelOperationParams {
activeComment: ActiveCommentInfo;
diff --git a/packages/docs-thread-comment-ui/src/controllers/menu.ts b/packages/docs-thread-comment-ui/src/controllers/menu.ts
index e221236abf..8bdcb02fa9 100644
--- a/packages/docs-thread-comment-ui/src/controllers/menu.ts
+++ b/packages/docs-thread-comment-ui/src/controllers/menu.ts
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-import type { IAccessor } from '@univerjs/core';
import { UniverInstanceType } from '@univerjs/core';
-import type { IMenuButtonItem } from '@univerjs/ui';
-import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
+import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';
import { debounceTime, Observable } from 'rxjs';
+import type { IAccessor } from '@univerjs/core';
+import type { IMenuButtonItem } from '@univerjs/ui';
import { StartAddCommentOperation, ToggleCommentPanelOperation } from '../commands/operations/show-comment-panel.operation';
export const shouldDisableAddComment = (accessor: IAccessor) => {
diff --git a/packages/docs-thread-comment-ui/src/views/doc-thread-comment-panel/index.tsx b/packages/docs-thread-comment-ui/src/views/doc-thread-comment-panel/index.tsx
index 3cb3f5b81c..35bc4daaba 100644
--- a/packages/docs-thread-comment-ui/src/views/doc-thread-comment-panel/index.tsx
+++ b/packages/docs-thread-comment-ui/src/views/doc-thread-comment-panel/index.tsx
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-import type { DocumentDataModel } from '@univerjs/core';
import { ICommandService, Injector, IUniverInstanceService, UniverInstanceType, useDependency, useObservable } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { ThreadCommentPanel } from '@univerjs/thread-comment-ui';
import React, { useEffect, useMemo, useState } from 'react';
import { debounceTime, Observable } from 'rxjs';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
-import { DEFAULT_DOC_SUBUNIT_ID } from '../../common/const';
-import { StartAddCommentOperation } from '../../commands/operations/show-comment-panel.operation';
-import { DocThreadCommentService } from '../../services/doc-thread-comment.service';
-import type { IAddDocCommentComment } from '../../commands/commands/add-doc-comment.command';
+import type { DocumentDataModel } from '@univerjs/core';
import { AddDocCommentComment } from '../../commands/commands/add-doc-comment.command';
import { DeleteDocCommentComment, type IDeleteDocCommentComment } from '../../commands/commands/delete-doc-comment.command';
+import { StartAddCommentOperation } from '../../commands/operations/show-comment-panel.operation';
+import { DEFAULT_DOC_SUBUNIT_ID } from '../../common/const';
import { shouldDisableAddComment } from '../../controllers/menu';
+import { DocThreadCommentService } from '../../services/doc-thread-comment.service';
+import type { IAddDocCommentComment } from '../../commands/commands/add-doc-comment.command';
export const DocThreadCommentPanel = () => {
const univerInstanceService = useDependency(IUniverInstanceService);
diff --git a/packages/docs-ui/src/basics/component-tools.ts b/packages/docs-ui/src/basics/component-tools.ts
index b565061e60..620cbf03ea 100644
--- a/packages/docs-ui/src/basics/component-tools.ts
+++ b/packages/docs-ui/src/basics/component-tools.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { DocumentDataModel, IUniverInstanceService, Nullable } from '@univerjs/core';
import { UniverInstanceType } from '@univerjs/core';
+import type { DocumentDataModel, IUniverInstanceService, Nullable } from '@univerjs/core';
import type { DocBackground, Documents, Engine, IRenderContext, IRenderManagerService, Scene } from '@univerjs/engine-render';
import { DOCS_VIEW_KEY } from './docs-view-key';
diff --git a/packages/docs-ui/src/basics/custom-decoration-factory.ts b/packages/docs-ui/src/basics/custom-decoration-factory.ts
index 46dfeaa252..c4a2edb63f 100644
--- a/packages/docs-ui/src/basics/custom-decoration-factory.ts
+++ b/packages/docs-ui/src/basics/custom-decoration-factory.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { CustomDecorationType, DocumentDataModel, IAccessor, IMutationInfo } from '@univerjs/core';
import { getBodySlice, IUniverInstanceService, JSONX, TextX, TextXActionType, Tools, UniverInstanceType, UpdateDocsAttributeType } from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type { CustomDecorationType, DocumentDataModel, IAccessor, IMutationInfo } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
interface IAddCustomDecorationParam {
diff --git a/packages/docs-ui/src/basics/custom-range-factory.ts b/packages/docs-ui/src/basics/custom-range-factory.ts
index 2e46fd28d7..9dbac5ae4c 100644
--- a/packages/docs-ui/src/basics/custom-range-factory.ts
+++ b/packages/docs-ui/src/basics/custom-range-factory.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { CustomRangeType, DocumentDataModel, IAccessor, IDocumentBody, IMutationInfo, ITextRange } from '@univerjs/core';
import { DataStreamTreeTokenType, IUniverInstanceService, JSONX, TextX, TextXActionType, UniverInstanceType } from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type { CustomRangeType, DocumentDataModel, IAccessor, IDocumentBody, IMutationInfo, ITextRange } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { getRichTextEditPath } from '../commands/util';
import { getSelectionForAddCustomRange, normalizeSelection } from './selection';
diff --git a/packages/docs-ui/src/basics/custom-range.ts b/packages/docs-ui/src/basics/custom-range.ts
index bbd0aeb34d..a0bfbc44bd 100644
--- a/packages/docs-ui/src/basics/custom-range.ts
+++ b/packages/docs-ui/src/basics/custom-range.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { ICustomRange, ITextRange } from '@univerjs/core';
import { DataStreamTreeTokenType, generateRandomId, Tools } from '@univerjs/core';
+import type { ICustomRange, ITextRange } from '@univerjs/core';
export function isCustomRangeSplitSymbol(text: string) {
return text === DataStreamTreeTokenType.CUSTOM_RANGE_END || text === DataStreamTreeTokenType.CUSTOM_RANGE_START;
diff --git a/packages/docs-ui/src/basics/plain-text.ts b/packages/docs-ui/src/basics/plain-text.ts
index aa17263d73..d5c67593f3 100644
--- a/packages/docs-ui/src/basics/plain-text.ts
+++ b/packages/docs-ui/src/basics/plain-text.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { IDocumentBody, IDocumentData } from '@univerjs/core';
import { DataStreamTreeTokenType } from '@univerjs/core';
+import type { IDocumentBody, IDocumentData } from '@univerjs/core';
/**
* get plain text from rich-text
diff --git a/packages/docs-ui/src/basics/replace.ts b/packages/docs-ui/src/basics/replace.ts
index fdb10a9885..51623fee59 100644
--- a/packages/docs-ui/src/basics/replace.ts
+++ b/packages/docs-ui/src/basics/replace.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { DocumentDataModel, IAccessor, IDeleteAction, IDocumentBody, IMutationInfo, IRetainAction, ITextRange, ITextRangeParam } from '@univerjs/core';
import { IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
-import type { ITextRangeWithStyle } from '@univerjs/engine-render';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type { DocumentDataModel, IAccessor, IDeleteAction, IDocumentBody, IMutationInfo, IRetainAction, ITextRange, ITextRangeParam } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { getRichTextEditPath } from '../commands/util';
import { isIntersecting, shouldDeleteCustomRange } from './custom-range';
import { getDeleteSelection } from './selection';
diff --git a/packages/docs-ui/src/basics/retain-delete-params.ts b/packages/docs-ui/src/basics/retain-delete-params.ts
index 980f3d9a21..f29b074d5f 100644
--- a/packages/docs-ui/src/basics/retain-delete-params.ts
+++ b/packages/docs-ui/src/basics/retain-delete-params.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { IDeleteAction, IDocumentBody, IRetainAction, ITextRange } from '@univerjs/core';
import { TextXActionType } from '@univerjs/core';
+import type { IDeleteAction, IDocumentBody, IRetainAction, ITextRange } from '@univerjs/core';
import { isIntersecting, shouldDeleteCustomRange } from './custom-range';
export function getRetainAndDeleteFromReplace(
diff --git a/packages/docs-ui/src/basics/selection.ts b/packages/docs-ui/src/basics/selection.ts
index 8b5c1c7823..dc168c4571 100644
--- a/packages/docs-ui/src/basics/selection.ts
+++ b/packages/docs-ui/src/basics/selection.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import type { IDocumentBody, ITextRange, Nullable } from '@univerjs/core';
import { DataStreamTreeTokenType } from '@univerjs/core';
import { isSegmentIntersects } from '@univerjs/docs';
+import type { IDocumentBody, ITextRange, Nullable } from '@univerjs/core';
import { DeleteDirection } from '../../../docs-ui/src/types/delete-direction';
import { isCustomRangeSplitSymbol } from './custom-range';
diff --git a/packages/docs-ui/src/basics/table.ts b/packages/docs-ui/src/basics/table.ts
index 317c350305..5517ed88d9 100644
--- a/packages/docs-ui/src/basics/table.ts
+++ b/packages/docs-ui/src/basics/table.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
+import { DocumentSkeletonPageType, getLastLine, lineIterator } from '@univerjs/engine-render';
import type { Nullable } from '@univerjs/core';
import type { IDocumentSkeletonCached, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonTable } from '@univerjs/engine-render';
-import { DocumentSkeletonPageType, getLastLine, lineIterator } from '@univerjs/engine-render';
export function firstLineInTable(table: IDocumentSkeletonTable) {
const firstRow = table.rows[0];
diff --git a/packages/docs-ui/src/commands/commands/__tests__/clipboard.command.spec.ts b/packages/docs-ui/src/commands/commands/__tests__/clipboard.command.spec.ts
index 5008570b95..f82dfe9047 100644
--- a/packages/docs-ui/src/commands/commands/__tests__/clipboard.command.spec.ts
+++ b/packages/docs-ui/src/commands/commands/__tests__/clipboard.command.spec.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommand, IDocumentData, Injector, IStyleBase, Univer } from '@univerjs/core';
import { BooleanNumber, ICommandService, IUniverInstanceService, UndoCommand, UniverInstanceType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
-import type { IInnerCutCommandParams, IInnerPasteCommandParams } from '../clipboard.inner.command';
+import type { DocumentDataModel, ICommand, IDocumentData, Injector, IStyleBase, Univer } from '@univerjs/core';
import { CutContentCommand, InnerPasteCommand } from '../clipboard.inner.command';
import { createCommandTestBed } from './create-command-test-bed';
+import type { IInnerCutCommandParams, IInnerPasteCommandParams } from '../clipboard.inner.command';
function getDocumentData() {
const TEST_DOCUMENT_DATA_EN: IDocumentData = {
diff --git a/packages/docs-ui/src/commands/commands/__tests__/core-editing.command.spec.ts b/packages/docs-ui/src/commands/commands/__tests__/core-editing.command.spec.ts
index 7f185984d5..8194e8f166 100644
--- a/packages/docs-ui/src/commands/commands/__tests__/core-editing.command.spec.ts
+++ b/packages/docs-ui/src/commands/commands/__tests__/core-editing.command.spec.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import type { Injector, Univer } from '@univerjs/core';
import { ICommandService } from '@univerjs/core';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+import type { Injector, Univer } from '@univerjs/core';
import { SetInlineFormatBoldCommand } from '../inline-format.command';
import { createCommandTestBed } from './create-command-test-bed';
diff --git a/packages/docs-ui/src/commands/commands/__tests__/create-command-test-bed.ts b/packages/docs-ui/src/commands/commands/__tests__/create-command-test-bed.ts
index 4e0446087a..61d556a2d0 100644
--- a/packages/docs-ui/src/commands/commands/__tests__/create-command-test-bed.ts
+++ b/packages/docs-ui/src/commands/commands/__tests__/create-command-test-bed.ts
@@ -16,7 +16,6 @@
/* eslint-disable ts/no-explicit-any */
-import type { Ctor, Dependency, DependencyIdentifier, DocumentDataModel, IDocumentData, Nullable } from '@univerjs/core';
import {
BooleanNumber,
DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
@@ -31,13 +30,14 @@ import {
Univer,
UniverInstanceType,
} from '@univerjs/core';
-import type { DocumentSkeleton, IRender, IRenderContext, IRenderModule } from '@univerjs/engine-render';
+import { DocSelectionManagerService, DocSkeletonManagerService, DocStateEmitService } from '@univerjs/docs';
import { DocumentViewModel, IRenderManagerService } from '@univerjs/engine-render';
-
import { BehaviorSubject, takeUntil } from 'rxjs';
-import { DocSelectionManagerService, DocSkeletonManagerService, DocStateEmitService } from '@univerjs/docs';
-import { DocStateChangeManagerService } from '../../../services/doc-state-change-manager.service';
+
+import type { Ctor, Dependency, DependencyIdentifier, DocumentDataModel, IDocumentData, Nullable } from '@univerjs/core';
+import type { DocumentSkeleton, IRender, IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { DocIMEInputManagerService } from '../../../services/doc-ime-input-manager.service';
+import { DocStateChangeManagerService } from '../../../services/doc-state-change-manager.service';
import { DocSelectionRenderService } from '../../../services/selection/doc-selection-render.service';
const TEST_DOCUMENT_DATA_EN: IDocumentData = {
diff --git a/packages/docs-ui/src/commands/commands/__tests__/inline-format.command.spec.ts b/packages/docs-ui/src/commands/commands/__tests__/inline-format.command.spec.ts
index d078e18467..4e4e86346d 100644
--- a/packages/docs-ui/src/commands/commands/__tests__/inline-format.command.spec.ts
+++ b/packages/docs-ui/src/commands/commands/__tests__/inline-format.command.spec.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommand, Injector, IStyleBase, Univer } from '@univerjs/core';
import { BooleanNumber, ICommandService, IUniverInstanceService, RedoCommand, UndoCommand, UniverInstanceType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
+import type { DocumentDataModel, ICommand, Injector, IStyleBase, Univer } from '@univerjs/core';
import {
SetInlineFormatBoldCommand,
SetInlineFormatCommand,
diff --git a/packages/docs-ui/src/commands/commands/__tests__/replace-content.command.spec.ts b/packages/docs-ui/src/commands/commands/__tests__/replace-content.command.spec.ts
index 13650970aa..1d8985ed5f 100644
--- a/packages/docs-ui/src/commands/commands/__tests__/replace-content.command.spec.ts
+++ b/packages/docs-ui/src/commands/commands/__tests__/replace-content.command.spec.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommand, IDocumentData, Injector, Univer } from '@univerjs/core';
import { ICommandService, IUniverInstanceService, RedoCommand, UndoCommand, UniverInstanceType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from '@univerjs/docs';
+import type { DocumentDataModel, ICommand, IDocumentData, Injector, Univer } from '@univerjs/core';
import { CoverContentCommand, ReplaceContentCommand } from '../replace-content.command';
import { createCommandTestBed } from './create-command-test-bed';
diff --git a/packages/docs-ui/src/commands/commands/break-line.command.ts b/packages/docs-ui/src/commands/commands/break-line.command.ts
index 17fe400e11..b242309af9 100644
--- a/packages/docs-ui/src/commands/commands/break-line.command.ts
+++ b/packages/docs-ui/src/commands/commands/break-line.command.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { ICommand, IParagraph } from '@univerjs/core';
import { BooleanNumber, CommandType, DataStreamTreeTokenType, getBodySlice, ICommandService, IUniverInstanceService, normalizeBody, PresetListType, Tools, updateAttributeByInsert } from '@univerjs/core';
import { DocSelectionManagerService } from '@univerjs/docs';
-import { getInsertSelection } from '../../basics/selection';
+import type { ICommand, IParagraph } from '@univerjs/core';
import { copyCustomRange } from '../../basics/custom-range';
+import { getInsertSelection } from '../../basics/selection';
import { InsertCommand } from './core-editing.command';
export function generateParagraphs(dataStream: string, prevParagraph?: IParagraph): IParagraph[] {
diff --git a/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts b/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts
index 75cdfabf41..7cc4653507 100644
--- a/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts
+++ b/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts
@@ -14,16 +14,6 @@
* limitations under the License.
*/
-import type {
- DocumentDataModel,
- ICommand,
- IDocumentBody,
- IDocumentData,
- IMutationInfo,
- ITextRange,
- JSONXActions,
- Nullable,
-} from '@univerjs/core';
import {
CommandType,
ICommandService,
@@ -34,12 +24,22 @@ import {
TextXActionType,
Tools,
} from '@univerjs/core';
-import type { DocumentViewModel, IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type {
+ DocumentDataModel,
+ ICommand,
+ IDocumentBody,
+ IDocumentData,
+ IMutationInfo,
+ ITextRange,
+ JSONXActions,
+ Nullable,
+} from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { DocumentViewModel, IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
import { getRetainAndDeleteAndExcludeLineBreak } from '../../basics/replace';
-import { getCommandSkeleton, getRichTextEditPath } from '../util';
import { getRetainAndDeleteFromReplace } from '../../basics/retain-delete-params';
+import { getCommandSkeleton, getRichTextEditPath } from '../util';
import { getDeleteRowContentActionParams, getDeleteRowsActionsParams, getDeleteTableActionParams } from './table/table';
export function getCustomBlockIdsInSelections(body: IDocumentBody, selections: ITextRange[]): string[] {
diff --git a/packages/docs-ui/src/commands/commands/core-editing.command.ts b/packages/docs-ui/src/commands/commands/core-editing.command.ts
index 1c79edc5f0..028e459759 100644
--- a/packages/docs-ui/src/commands/commands/core-editing.command.ts
+++ b/packages/docs-ui/src/commands/commands/core-editing.command.ts
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType, UniverInstanceType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import type {
DocumentDataModel,
ICommand,
@@ -23,15 +25,13 @@ import type {
ITextRange,
UpdateDocsAttributeType,
} from '@univerjs/core';
-import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType, UniverInstanceType } from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
-import { getInsertSelection } from '../../basics/selection';
import { isIntersecting, shouldDeleteCustomRange } from '../../basics/custom-range';
+import { getRetainAndDeleteFromReplace } from '../../basics/retain-delete-params';
+import { getInsertSelection } from '../../basics/selection';
import { DeleteDirection } from '../../types/delete-direction';
import { getRichTextEditPath } from '../util';
-import { getRetainAndDeleteFromReplace } from '../../basics/retain-delete-params';
export interface IInsertCommandParams {
unitId: string;
diff --git a/packages/docs-ui/src/commands/commands/delete.command.ts b/packages/docs-ui/src/commands/commands/delete.command.ts
index 79c6f01cc0..05d7dcbfb2 100644
--- a/packages/docs-ui/src/commands/commands/delete.command.ts
+++ b/packages/docs-ui/src/commands/commands/delete.command.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { IAccessor, ICommand, ICustomBlock, IDocumentBody, IMutationInfo, IParagraph, ITextRange, ITextRun, JSONXActions, Nullable } from '@univerjs/core';
import {
CommandType,
DataStreamTreeTokenType,
@@ -30,14 +29,15 @@ import {
Tools,
UpdateDocsAttributeType,
} from '@univerjs/core';
-import type { IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { getParagraphByGlyph, hasListGlyph, isFirstGlyph, isIndentByGlyph } from '@univerjs/engine-render';
+import type { IAccessor, ICommand, ICustomBlock, IDocumentBody, IMutationInfo, IParagraph, ITextRange, ITextRun, JSONXActions, Nullable } from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type { IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
import { getDeleteSelection } from '../../basics/selection';
-import { getCommandSkeleton, getRichTextEditPath } from '../util';
import { DeleteDirection } from '../../types/delete-direction';
+import { getCommandSkeleton, getRichTextEditPath } from '../util';
import { CutContentCommand } from './clipboard.inner.command';
import { DeleteCommand, UpdateCommand } from './core-editing.command';
diff --git a/packages/docs-ui/src/commands/commands/doc-paragraph-setting.command.ts b/packages/docs-ui/src/commands/commands/doc-paragraph-setting.command.ts
index 71e5025c47..8a85fa9c98 100644
--- a/packages/docs-ui/src/commands/commands/doc-paragraph-setting.command.ts
+++ b/packages/docs-ui/src/commands/commands/doc-paragraph-setting.command.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { DocumentDataModel, IAccessor, ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
import { CommandType, ICommandService, IUniverInstanceService, JSONX, MemoryCursor, TextX, TextXActionType, UniverInstanceType, UpdateDocsAttributeType } from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type { DocumentDataModel, IAccessor, ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { getRichTextEditPath } from '../util';
import { getParagraphsInRanges } from './list.command';
diff --git a/packages/docs-ui/src/commands/commands/ime-input.command.ts b/packages/docs-ui/src/commands/commands/ime-input.command.ts
index 8afc28040c..b9f630f27f 100644
--- a/packages/docs-ui/src/commands/commands/ime-input.command.ts
+++ b/packages/docs-ui/src/commands/commands/ime-input.command.ts
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-import type { ICommand, ICommandInfo } from '@univerjs/core';
import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
+import { RichTextEditingMutation } from '@univerjs/docs';
import { IRenderManagerService, type ITextRangeWithStyle } from '@univerjs/engine-render';
+import type { ICommand, ICommandInfo } from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import { RichTextEditingMutation } from '@univerjs/docs';
-import { DocIMEInputManagerService } from '../../services/doc-ime-input-manager.service';
+import { getRetainAndDeleteFromReplace } from '../../basics/retain-delete-params';
import { getInsertSelection } from '../../basics/selection';
+import { DocIMEInputManagerService } from '../../services/doc-ime-input-manager.service';
import { getRichTextEditPath } from '../util';
-import { getRetainAndDeleteFromReplace } from '../../basics/retain-delete-params';
export interface IIMEInputCommandParams {
unitId: string;
diff --git a/packages/docs-ui/src/commands/commands/inline-format.command.ts b/packages/docs-ui/src/commands/commands/inline-format.command.ts
index adf74e8530..396eea2a1c 100644
--- a/packages/docs-ui/src/commands/commands/inline-format.command.ts
+++ b/packages/docs-ui/src/commands/commands/inline-format.command.ts
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-import type {
- ICommand, IDocumentBody, IMutationInfo, IStyleBase, ITextDecoration, ITextRun,
-} from '@univerjs/core';
import {
BaselineOffset, BooleanNumber, CommandType,
ICommandService, IUniverInstanceService,
JSONX, MemoryCursor,
TextX, TextXActionType,
} from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type {
+ ICommand, IDocumentBody, IMutationInfo, IStyleBase, ITextDecoration, ITextRun,
+} from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { getRichTextEditPath } from '../util';
diff --git a/packages/docs-ui/src/commands/commands/list.command.ts b/packages/docs-ui/src/commands/commands/list.command.ts
index 7805223f8a..15dd38e2ae 100644
--- a/packages/docs-ui/src/commands/commands/list.command.ts
+++ b/packages/docs-ui/src/commands/commands/list.command.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { ICommand, IListData, IMutationInfo, IParagraph, IParagraphRange, ISectionBreak } from '@univerjs/core';
import {
CommandType,
GridType,
@@ -30,12 +29,13 @@ import {
Tools,
UpdateDocsAttributeType,
} from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
-import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { getCharSpaceApply, getNumberUnitValue } from '@univerjs/engine-render';
-import { getRichTextEditPath } from '../util';
+import type { ICommand, IListData, IMutationInfo, IParagraph, IParagraphRange, ISectionBreak } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { hasParagraphInTable } from '../../basics/paragraph';
+import { getRichTextEditPath } from '../util';
interface IListOperationCommandParams {
listType: PresetListType;
diff --git a/packages/docs-ui/src/commands/commands/paragraph-align.command.ts b/packages/docs-ui/src/commands/commands/paragraph-align.command.ts
index 1044a824fa..e713a47d55 100644
--- a/packages/docs-ui/src/commands/commands/paragraph-align.command.ts
+++ b/packages/docs-ui/src/commands/commands/paragraph-align.command.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
import {
CommandType, HorizontalAlign,
ICommandService,
@@ -25,9 +24,10 @@ import {
TextXActionType,
UpdateDocsAttributeType,
} from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type { ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { getRichTextEditPath } from '../util';
import { getParagraphsInRanges } from './list.command';
diff --git a/packages/docs-ui/src/commands/commands/replace-content.command.ts b/packages/docs-ui/src/commands/commands/replace-content.command.ts
index e235126edc..a17be47e88 100644
--- a/packages/docs-ui/src/commands/commands/replace-content.command.ts
+++ b/packages/docs-ui/src/commands/commands/replace-content.command.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommand, IDocumentBody, IMutationInfo, ITextRange } from '@univerjs/core';
import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type { DocumentDataModel, ICommand, IDocumentBody, IMutationInfo, ITextRange } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { getRetainAndDeleteAndExcludeLineBreak } from '../../basics/replace';
import { getRichTextEditPath } from '../util';
diff --git a/packages/docs-ui/src/commands/commands/set-doc-zoom-ratio.command.ts b/packages/docs-ui/src/commands/commands/set-doc-zoom-ratio.command.ts
index e36fe5ac31..62b2f0a789 100644
--- a/packages/docs-ui/src/commands/commands/set-doc-zoom-ratio.command.ts
+++ b/packages/docs-ui/src/commands/commands/set-doc-zoom-ratio.command.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import type { IAccessor, ICommand } from '@univerjs/core';
import { CommandType, ICommandService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';
+import type { IAccessor, ICommand } from '@univerjs/core';
-import type { ISetDocZoomRatioOperationParams } from '../operations/set-doc-zoom-ratio.operation';
import {
SetDocZoomRatioOperation,
SetDocZoomRatioUndoMutationFactory,
} from '../operations/set-doc-zoom-ratio.operation';
+import type { ISetDocZoomRatioOperationParams } from '../operations/set-doc-zoom-ratio.operation';
export interface ISetDocZoomRatioCommandParams {
zoomRatio?: number;
diff --git a/packages/docs-ui/src/commands/commands/table/doc-table-create.command.ts b/packages/docs-ui/src/commands/commands/table/doc-table-create.command.ts
index b2d4fb2d94..f27b27bed2 100644
--- a/packages/docs-ui/src/commands/commands/table/doc-table-create.command.ts
+++ b/packages/docs-ui/src/commands/commands/table/doc-table-create.command.ts
@@ -15,13 +15,13 @@
*/
import { CommandType, DataStreamTreeTokenType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { getInsertSelection } from '../../../basics/selection';
import { getCommandSkeleton, getRichTextEditPath } from '../../util';
import { generateParagraphs } from '../break-line.command';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
-import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { genEmptyTable, genTableSource } from './table';
export const CreateDocTableCommandId = 'doc.command.create-table';
diff --git a/packages/docs-ui/src/commands/commands/table/doc-table-delete.command.ts b/packages/docs-ui/src/commands/commands/table/doc-table-delete.command.ts
index f31f6a3a67..967e3ef90f 100644
--- a/packages/docs-ui/src/commands/commands/table/doc-table-delete.command.ts
+++ b/packages/docs-ui/src/commands/commands/table/doc-table-delete.command.ts
@@ -15,10 +15,10 @@
*/
import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
-import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { getCommandSkeleton, getRichTextEditPath } from '../../util';
import { getDeleteColumnsActionParams, getDeleteRowsActionsParams, getDeleteTableActionParams, getRangeInfoFromRanges } from './table';
diff --git a/packages/docs-ui/src/commands/commands/table/doc-table-insert.command.ts b/packages/docs-ui/src/commands/commands/table/doc-table-insert.command.ts
index 0171df3345..cb146528b3 100644
--- a/packages/docs-ui/src/commands/commands/table/doc-table-insert.command.ts
+++ b/packages/docs-ui/src/commands/commands/table/doc-table-insert.command.ts
@@ -15,10 +15,10 @@
*/
import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
-import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { getCommandSkeleton, getRichTextEditPath } from '../../util';
import { getColumnWidths, getEmptyTableCell, getEmptyTableRow, getInsertColumnActionsParams, getInsertColumnBody, getInsertRowActionsParams, getInsertRowBody, getRangeInfoFromRanges, getTableColumn, INSERT_COLUMN_POSITION, INSERT_ROW_POSITION } from './table';
diff --git a/packages/docs-ui/src/commands/commands/table/doc-table-tab.command.ts b/packages/docs-ui/src/commands/commands/table/doc-table-tab.command.ts
index 44cdd8857d..b13567f705 100644
--- a/packages/docs-ui/src/commands/commands/table/doc-table-tab.command.ts
+++ b/packages/docs-ui/src/commands/commands/table/doc-table-tab.command.ts
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-import type { ICommand, Nullable } from '@univerjs/core';
import { CommandType, ICommandService, IUniverInstanceService } from '@univerjs/core';
import { DocSelectionManagerService } from '@univerjs/docs';
+import type { ICommand, Nullable } from '@univerjs/core';
import { getCommandSkeleton } from '../../util';
-import type { IOffsets } from './table';
-import { CellPosition, getCellOffsets, INSERT_ROW_POSITION } from './table';
import { DocTableInsertRowCommand } from './doc-table-insert.command';
+import { CellPosition, getCellOffsets, INSERT_ROW_POSITION } from './table';
+import type { IOffsets } from './table';
export interface IDocTableTabCommandParams {
shift: boolean;
diff --git a/packages/docs-ui/src/commands/commands/table/table.ts b/packages/docs-ui/src/commands/commands/table/table.ts
index 22140c73bf..5e88c24462 100644
--- a/packages/docs-ui/src/commands/commands/table/table.ts
+++ b/packages/docs-ui/src/commands/commands/table/table.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { IParagraph, ISectionBreak, ITable, ITableCell, ITableColumn, ITableRow, Nullable } from '@univerjs/core';
import { DataStreamTreeTokenType, generateRandomId, ObjectRelativeFromH, ObjectRelativeFromV, TableAlignmentType, TableCellHeightRule, TableSizeType, TableTextWrapType, Tools } from '@univerjs/core';
+import type { IParagraph, ISectionBreak, ITable, ITableCell, ITableColumn, ITableRow, Nullable } from '@univerjs/core';
import type { DataStreamTreeNode, DocumentViewModel, ITextRangeWithStyle } from '@univerjs/engine-render';
export enum INSERT_ROW_POSITION {
diff --git a/packages/docs-ui/src/commands/operations/doc-create-table.operation.ts b/packages/docs-ui/src/commands/operations/doc-create-table.operation.ts
index ec58356b13..2cc1078137 100644
--- a/packages/docs-ui/src/commands/operations/doc-create-table.operation.ts
+++ b/packages/docs-ui/src/commands/operations/doc-create-table.operation.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import type { IAccessor, ICommand } from '@univerjs/core';
import { CommandType, ICommandService, LocaleService } from '@univerjs/core';
import { IConfirmService } from '@univerjs/ui';
+import type { IAccessor, ICommand } from '@univerjs/core';
import { COMPONENT_DOC_CREATE_TABLE_CONFIRM } from '../../views/table/create/component-name';
import { CreateDocTableCommand } from '../commands/table/doc-table-create.command';
diff --git a/packages/docs-ui/src/commands/operations/doc-cursor.operation.ts b/packages/docs-ui/src/commands/operations/doc-cursor.operation.ts
index e9d148f09b..7ec93fc4dd 100644
--- a/packages/docs-ui/src/commands/operations/doc-cursor.operation.ts
+++ b/packages/docs-ui/src/commands/operations/doc-cursor.operation.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { Direction, IOperation } from '@univerjs/core';
import { CommandType } from '@univerjs/core';
+import type { Direction, IOperation } from '@univerjs/core';
export interface IMoveCursorOperationParams {
direction: Direction;
diff --git a/packages/docs-ui/src/commands/operations/select-all.operation.ts b/packages/docs-ui/src/commands/operations/select-all.operation.ts
index d8b75a7265..7b5bef1592 100644
--- a/packages/docs-ui/src/commands/operations/select-all.operation.ts
+++ b/packages/docs-ui/src/commands/operations/select-all.operation.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import type { ICommand } from '@univerjs/core';
import { CommandType, IUniverInstanceService } from '@univerjs/core';
import { DocSelectionManagerService } from '@univerjs/docs';
+import type { ICommand } from '@univerjs/core';
interface ISelectAllOperationParams { }
diff --git a/packages/docs-ui/src/commands/operations/set-doc-zoom-ratio.operation.ts b/packages/docs-ui/src/commands/operations/set-doc-zoom-ratio.operation.ts
index 85e3fc6c8b..a8b8eb9b4e 100644
--- a/packages/docs-ui/src/commands/operations/set-doc-zoom-ratio.operation.ts
+++ b/packages/docs-ui/src/commands/operations/set-doc-zoom-ratio.operation.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { IAccessor, IOperation } from '@univerjs/core';
import { CommandType, IUniverInstanceService, Tools } from '@univerjs/core';
+import type { IAccessor, IOperation } from '@univerjs/core';
export interface ISetDocZoomRatioOperationParams {
zoomRatio: number;
diff --git a/packages/docs-ui/src/commands/util.ts b/packages/docs-ui/src/commands/util.ts
index 0d846af525..a9ec3c80c8 100644
--- a/packages/docs-ui/src/commands/util.ts
+++ b/packages/docs-ui/src/commands/util.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
+import { DocSkeletonManagerService } from '@univerjs/docs';
import { IRenderManagerService } from '@univerjs/engine-render';
import type { DocumentDataModel, IAccessor } from '@univerjs/core';
-import { DocSkeletonManagerService } from '@univerjs/docs';
/**
* Get the skeleton of the command's target.
diff --git a/packages/docs-ui/src/controllers/doc-auto-format.controller.ts b/packages/docs-ui/src/controllers/doc-auto-format.controller.ts
index 63b43b9222..da2577c04f 100644
--- a/packages/docs-ui/src/controllers/doc-auto-format.controller.ts
+++ b/packages/docs-ui/src/controllers/doc-auto-format.controller.ts
@@ -16,13 +16,13 @@
import { Disposable, Inject, LifecycleStages, OnLifecycle, QuickListTypeMap } from '@univerjs/core';
import type { Nullable } from 'vitest';
-import { DocAutoFormatService } from '../services/doc-auto-format.service';
-import type { ITabCommandParams } from '../commands/commands/auto-format.command';
import { AfterSpaceCommand, EnterCommand, TabCommand } from '../commands/commands/auto-format.command';
+import { BreakLineCommand } from '../commands/commands/break-line.command';
import { ChangeListNestingLevelCommand, ChangeListNestingLevelType, ListOperationCommand, QuickListCommand } from '../commands/commands/list.command';
import { DocTableTabCommand } from '../commands/commands/table/doc-table-tab.command';
+import { DocAutoFormatService } from '../services/doc-auto-format.service';
import { isInSameTableCell } from '../services/selection/convert-rect-range';
-import { BreakLineCommand } from '../commands/commands/break-line.command';
+import type { ITabCommandParams } from '../commands/commands/auto-format.command';
@OnLifecycle(LifecycleStages.Rendered, DocAutoFormatController)
export class DocAutoFormatController extends Disposable {
diff --git a/packages/docs-ui/src/controllers/doc-header-footer.controller.ts b/packages/docs-ui/src/controllers/doc-header-footer.controller.ts
index df2c589be1..6d3a1b658b 100644
--- a/packages/docs-ui/src/controllers/doc-header-footer.controller.ts
+++ b/packages/docs-ui/src/controllers/doc-header-footer.controller.ts
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-import type { DocumentDataModel } from '@univerjs/core';
import { BooleanNumber, Disposable, DocumentFlavor, ICommandService, Inject, IUniverInstanceService, LocaleService, toDisposable, Tools } from '@univerjs/core';
-import type { Documents, DocumentViewModel, IMouseEvent, IPageRenderConfig, IPathProps, IPointerEvent, IRenderContext, IRenderModule, RenderComponentType } from '@univerjs/engine-render';
+import { DocSkeletonManagerService } from '@univerjs/docs';
import { DocumentEditArea, IRenderManagerService, PageLayoutType, Path, Rect, Vector2 } from '@univerjs/engine-render';
-
import { ComponentManager, IEditorService } from '@univerjs/ui';
-import { DocSkeletonManagerService } from '@univerjs/docs';
+
+import type { DocumentDataModel } from '@univerjs/core';
+import type { Documents, DocumentViewModel, IMouseEvent, IPageRenderConfig, IPathProps, IPointerEvent, IRenderContext, IRenderModule, RenderComponentType } from '@univerjs/engine-render';
import type { Nullable } from 'vitest';
-import { TextBubbleShape } from '../views/header-footer/text-bubble';
+import { neoGetDocObject } from '../basics/component-tools';
import { CoreHeaderFooterCommand } from '../commands/commands/doc-header-footer.command';
+import { DocSelectionRenderService } from '../services/selection/doc-selection-render.service';
import { COMPONENT_DOC_HEADER_FOOTER_PANEL } from '../views/header-footer/panel/component-name';
import { DocHeaderFooterPanel } from '../views/header-footer/panel/DocHeaderFooterPanel';
-import { DocSelectionRenderService } from '../services/selection/doc-selection-render.service';
-import { neoGetDocObject } from '../basics/component-tools';
+import { TextBubbleShape } from '../views/header-footer/text-bubble';
const HEADER_FOOTER_STROKE_COLOR = 'rgba(58, 96, 247, 1)';
const HEADER_FOOTER_FILL_COLOR = 'rgba(58, 96, 247, 0.08)';
diff --git a/packages/docs-ui/src/controllers/doc-move-cursor.controller.ts b/packages/docs-ui/src/controllers/doc-move-cursor.controller.ts
index c1ba465563..d40bce0cc0 100644
--- a/packages/docs-ui/src/controllers/doc-move-cursor.controller.ts
+++ b/packages/docs-ui/src/controllers/doc-move-cursor.controller.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { ICommandInfo, Nullable } from '@univerjs/core';
import {
DataStreamTreeTokenType,
Direction,
@@ -26,6 +25,9 @@ import {
OnLifecycle,
RANGE_DIRECTION,
} from '@univerjs/core';
+import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
+import { DocumentSkeletonPageType, IRenderManagerService } from '@univerjs/engine-render';
+import type { ICommandInfo, Nullable } from '@univerjs/core';
import type {
DocumentSkeleton,
IDocumentSkeletonCached,
@@ -36,15 +38,13 @@ import type {
INodePosition,
INodeSearch,
} from '@univerjs/engine-render';
-import { DocumentSkeletonPageType, IRenderManagerService } from '@univerjs/engine-render';
-import type { Subscription } from 'rxjs';
-import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
+import type { Subscription } from 'rxjs';
+import { getDocObject } from '../basics/component-tools';
+import { findAboveCell, findBellowCell, findLineBeforeAndAfterTable, findTableAfterLine, findTableBeforeLine, firstLineInCell, firstLineInTable, lastLineInCell, lastLineInTable } from '../basics/table';
+import { MoveCursorOperation, MoveSelectionOperation } from '../commands/operations/doc-cursor.operation';
import { NodePositionConvertToCursor } from '../services/selection/convert-text-range';
import type { IMoveCursorOperationParams } from '../commands/operations/doc-cursor.operation';
-import { MoveCursorOperation, MoveSelectionOperation } from '../commands/operations/doc-cursor.operation';
-import { findAboveCell, findBellowCell, findLineBeforeAndAfterTable, findTableAfterLine, findTableBeforeLine, firstLineInCell, firstLineInTable, lastLineInCell, lastLineInTable } from '../basics/table';
-import { getDocObject } from '../basics/component-tools';
@OnLifecycle(LifecycleStages.Rendered, DocMoveCursorController)
export class DocMoveCursorController extends Disposable {
@@ -105,7 +105,8 @@ export class DocMoveCursorController extends Disposable {
}
const skeleton = this._renderManagerService.getRenderById(docDataModel.getUnitId())
- ?.with(DocSkeletonManagerService).getSkeleton();
+ ?.with(DocSkeletonManagerService)
+ .getSkeleton();
const docObject = this._getDocObject();
if (activeRange == null || skeleton == null || docObject == null) {
@@ -218,7 +219,8 @@ export class DocMoveCursorController extends Disposable {
}
const skeleton = this._renderManagerService.getRenderById(docDataModel.getUnitId())
- ?.with(DocSkeletonManagerService).getSkeleton();
+ ?.with(DocSkeletonManagerService)
+ .getSkeleton();
const docObject = this._getDocObject();
if (activeRange == null || skeleton == null || docObject == null || allRanges == null) {
return;
diff --git a/packages/docs-ui/src/controllers/doc-ui.controller.ts b/packages/docs-ui/src/controllers/doc-ui.controller.ts
index acba681f1c..e8e64c1f41 100644
--- a/packages/docs-ui/src/controllers/doc-ui.controller.ts
+++ b/packages/docs-ui/src/controllers/doc-ui.controller.ts
@@ -26,10 +26,12 @@ import {
OnLifecycle,
UniverInstanceType,
} from '@univerjs/core';
-import { BuiltInUIPart, ComponentManager, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
-
import { IRenderManagerService } from '@univerjs/engine-render';
+
import { TodoList } from '@univerjs/icons';
+import { BuiltInUIPart, ComponentManager, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
+import { CoreHeaderFooterCommand, OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
+import { SidebarDocHeaderFooterPanelOperation } from '../commands/operations/doc-header-footer-panel.operation';
import { COLOR_PICKER_COMPONENT, ColorPicker } from '../components/color-picker';
import {
FONT_FAMILY_COMPONENT,
@@ -38,9 +40,9 @@ import {
FontFamilyItem,
} from '../components/font-family';
import { FONT_SIZE_COMPONENT, FontSize } from '../components/font-size';
-import { CoreHeaderFooterCommand, OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
-import { SidebarDocHeaderFooterPanelOperation } from '../commands/operations/doc-header-footer-panel.operation';
-import { DocFooter } from '../views/doc-footer';
+import { BULLET_LIST_TYPE_COMPONENT, BulletListTypePicker, ORDER_LIST_TYPE_COMPONENT, OrderListTypePicker } from '../components/list-type-picker';
+import { DocSelectionRenderService } from '../services/selection/doc-selection-render.service';
+import { TabShortCut } from '../shortcuts/format.shortcut';
import {
AlignCenterShortCut,
AlignJustifyShortCut,
@@ -55,12 +57,10 @@ import {
SuperscriptShortCut,
UnderlineShortCut,
} from '../shortcuts/toolbar.shortcut';
-import { TabShortCut } from '../shortcuts/format.shortcut';
-import { BULLET_LIST_TYPE_COMPONENT, BulletListTypePicker, ORDER_LIST_TYPE_COMPONENT, OrderListTypePicker } from '../components/list-type-picker';
-import { DocSelectionRenderService } from '../services/selection/doc-selection-render.service';
+import { DocFooter } from '../views/doc-footer';
+import { PLUGIN_CONFIG_KEY } from './config.schema';
import { menuSchema } from './menu.schema';
import type { IUniverDocsUIConfig } from './config.schema';
-import { PLUGIN_CONFIG_KEY } from './config.schema';
// FIXME: LifecycleStages.Rendered must be used, otherwise the menu cannot be added to the DOM, but the sheet ui plug-in can be added in LifecycleStages.Ready
@OnLifecycle(LifecycleStages.Rendered, DocUIController)
diff --git a/packages/docs-ui/src/controllers/menu.schema.ts b/packages/docs-ui/src/controllers/menu.schema.ts
index bd220d88ed..1179ebba46 100644
--- a/packages/docs-ui/src/controllers/menu.schema.ts
+++ b/packages/docs-ui/src/controllers/menu.schema.ts
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-import type { MenuSchemaType } from '@univerjs/ui';
import { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup } from '@univerjs/ui';
-import { DocCreateTableOperation } from '../commands/operations/doc-create-table.operation';
-import { OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
+import type { MenuSchemaType } from '@univerjs/ui';
import { DocCopyCommand, DocCutCommand, DocPasteCommand } from '../commands/commands/clipboard.command';
-import { DocParagraphSettingPanelOperation } from '../commands/operations/doc-paragraph-setting-panel.operation';
+import { DeleteLeftCommand } from '../commands/commands/delete.command';
+import { OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
import { ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatBoldCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '../commands/commands/inline-format.command';
-
import { BulletListCommand, CheckListCommand, OrderListCommand } from '../commands/commands/list.command';
+
import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignRightCommand } from '../commands/commands/paragraph-align.command';
-import { DeleteLeftCommand } from '../commands/commands/delete.command';
-import { DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand } from '../commands/commands/table/doc-table-insert.command';
import { DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand } from '../commands/commands/table/doc-table-delete.command';
+import { DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand } from '../commands/commands/table/doc-table-insert.command';
+import { DocCreateTableOperation } from '../commands/operations/doc-create-table.operation';
+import { DocParagraphSettingPanelOperation } from '../commands/operations/doc-paragraph-setting-panel.operation';
import {
CopyMenuFactory,
CutMenuFactory,
diff --git a/packages/docs-ui/src/controllers/menu/context-menu.ts b/packages/docs-ui/src/controllers/menu/context-menu.ts
index f72ae2d6e3..299afa105a 100644
--- a/packages/docs-ui/src/controllers/menu/context-menu.ts
+++ b/packages/docs-ui/src/controllers/menu/context-menu.ts
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-import type { IAccessor } from '@univerjs/core';
import { IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
-import type { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
+import { DocSelectionManagerService } from '@univerjs/docs';
import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';
import { combineLatest, Observable } from 'rxjs';
+import type { IAccessor } from '@univerjs/core';
import type { IRectRangeWithStyle } from '@univerjs/engine-render';
-import { DocSelectionManagerService } from '@univerjs/docs';
+import type { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
import { DocCopyCommand, DocCutCommand, DocPasteCommand } from '../../commands/commands/clipboard.command';
-import { DocParagraphSettingPanelOperation } from '../../commands/operations/doc-paragraph-setting-panel.operation';
import { DeleteLeftCommand } from '../../commands/commands/delete.command';
-import { DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand } from '../../commands/commands/table/doc-table-insert.command';
import { DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand } from '../../commands/commands/table/doc-table-delete.command';
+import { DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand } from '../../commands/commands/table/doc-table-insert.command';
+import { DocParagraphSettingPanelOperation } from '../../commands/operations/doc-paragraph-setting-panel.operation';
const getDisableOnCollapsedObservable = (accessor: IAccessor) => {
const docSelectionManagerService = accessor.get(DocSelectionManagerService);
diff --git a/packages/docs-ui/src/controllers/menu/menu.ts b/packages/docs-ui/src/controllers/menu/menu.ts
index 879eeee28c..020bfd964a 100644
--- a/packages/docs-ui/src/controllers/menu/menu.ts
+++ b/packages/docs-ui/src/controllers/menu/menu.ts
@@ -28,7 +28,7 @@ import {
DocSkeletonManagerService,
SetTextSelectionsOperation,
} from '@univerjs/docs';
-import type { IMenuButtonItem, IMenuItem, IMenuSelectorItem } from '@univerjs/ui';
+import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
import {
FONT_FAMILY_LIST,
FONT_SIZE_LIST,
@@ -36,21 +36,21 @@ import {
getMenuHiddenObservable,
MenuItemType,
} from '@univerjs/ui';
-import type { IAccessor, PresetListType } from '@univerjs/core';
-import type { Subscription } from 'rxjs';
import { combineLatest, map, Observable } from 'rxjs';
+import type { IAccessor, PresetListType } from '@univerjs/core';
+import type { IMenuButtonItem, IMenuItem, IMenuSelectorItem } from '@univerjs/ui';
-import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
+import type { Subscription } from 'rxjs';
+import { OpenHeaderFooterPanelCommand } from '../../commands/commands/doc-header-footer.command';
+import { ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '../../commands/commands/inline-format.command';
+import { BulletListCommand, CheckListCommand, getParagraphsInRange, OrderListCommand } from '../../commands/commands/list.command';
+import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand } from '../../commands/commands/paragraph-align.command';
+import { DocCreateTableOperation } from '../../commands/operations/doc-create-table.operation';
+import { getCommandSkeleton } from '../../commands/util';
import { COLOR_PICKER_COMPONENT } from '../../components/color-picker';
import { FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT } from '../../components/font-family';
import { FONT_SIZE_COMPONENT } from '../../components/font-size';
-import { OpenHeaderFooterPanelCommand } from '../../commands/commands/doc-header-footer.command';
import { BULLET_LIST_TYPE_COMPONENT, ORDER_LIST_TYPE_COMPONENT } from '../../components/list-type-picker';
-import { DocCreateTableOperation } from '../../commands/operations/doc-create-table.operation';
-import { getCommandSkeleton } from '../../commands/util';
-import { ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '../../commands/commands/inline-format.command';
-import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand } from '../../commands/commands/paragraph-align.command';
-import { BulletListCommand, CheckListCommand, getParagraphsInRange, OrderListCommand } from '../../commands/commands/list.command';
function getInsertTableHiddenObservable(
accessor: IAccessor
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 c6b5263f68..b16c57ecf5 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
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ITextRange, Nullable } from '@univerjs/core';
import { Inject, IUniverInstanceService, RxDisposable } from '@univerjs/core';
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
-import type { INodePosition, IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { IRenderManagerService } from '@univerjs/engine-render';
import { IEditorService } from '@univerjs/ui';
import { takeUntil } from 'rxjs';
+import type { DocumentDataModel, ITextRange, Nullable } from '@univerjs/core';
+import type { INodePosition, IRenderContext, IRenderModule } from '@univerjs/engine-render';
+import { getDocObject } from '../../basics/component-tools';
+import { VIEWPORT_KEY } from '../../basics/docs-view-key';
import { NodePositionConvertToCursor } from '../../services/selection/convert-text-range';
import { getAnchorBounding } from '../../services/selection/text-range';
-import { VIEWPORT_KEY } from '../../basics/docs-view-key';
-import { getDocObject } from '../../basics/component-tools';
const ANCHOR_WIDTH = 1.5;
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-checklist.render-controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-checklist.render-controller.ts
index 0dd14e910f..24103e27e0 100644
--- a/packages/docs-ui/src/controllers/render-controllers/doc-checklist.render-controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/doc-checklist.render-controller.ts
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-import type { Documents, IRenderContext, IRenderModule, Viewport } from '@univerjs/engine-render';
-import { CURSOR_TYPE, Vector2 } from '@univerjs/engine-render';
-import type { DocumentDataModel } from '@univerjs/core';
import { Disposable, ICommandService, Inject } from '@univerjs/core';
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
-import { DocEventManagerService } from '../../services/doc-event-manager.service';
+import { CURSOR_TYPE, Vector2 } from '@univerjs/engine-render';
+import type { DocumentDataModel } from '@univerjs/core';
+import type { Documents, IRenderContext, IRenderModule, Viewport } from '@univerjs/engine-render';
import { ToggleCheckListCommand } from '../../commands/commands/list.command';
+import { DocEventManagerService } from '../../services/doc-event-manager.service';
export class DocChecklistRenderController extends Disposable implements IRenderModule {
constructor(
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-clipboard.controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-clipboard.controller.ts
index 537f500cc9..d44b93d93a 100644
--- a/packages/docs-ui/src/controllers/render-controllers/doc-clipboard.controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/doc-clipboard.controller.ts
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-import type { DocumentDataModel } from '@univerjs/core';
import {
ICommandService,
IContextService,
Inject,
RxDisposable,
} from '@univerjs/core';
+import { takeUntil } from 'rxjs';
+import type { DocumentDataModel } from '@univerjs/core';
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
-import { takeUntil } from 'rxjs';
import { whenDocOrEditor, whenFocusEditor } from '../../commands/commands/clipboard.command';
import { IDocClipboardService } from '../../services/clipboard/clipboard.service';
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-contextmenu.render-controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-contextmenu.render-controller.ts
index 7970e19345..f02d48d5c6 100644
--- a/packages/docs-ui/src/controllers/render-controllers/doc-contextmenu.render-controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/doc-contextmenu.render-controller.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { Workbook } from '@univerjs/core';
import {
DEFAULT_EMPTY_DOCUMENT_VALUE,
Disposable,
@@ -24,8 +23,9 @@ import {
ICommandService,
} from '@univerjs/core';
import { RichTextEditingMutation } from '@univerjs/docs';
-import type { Documents, IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { ContextMenuPosition, IContextMenuService } from '@univerjs/ui';
+import type { Workbook } from '@univerjs/core';
+import type { Documents, IRenderContext, IRenderModule } from '@univerjs/engine-render';
const SKIP_UNIT_IDS = [
DEFAULT_EMPTY_DOCUMENT_VALUE,
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-editor-bridge.controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-editor-bridge.controller.ts
index 0dfa2d45df..f4e965609f 100644
--- a/packages/docs-ui/src/controllers/render-controllers/doc-editor-bridge.controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/doc-editor-bridge.controller.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommandInfo, Nullable, Workbook } from '@univerjs/core';
import { checkForSubstrings, Disposable, ICommandService, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
-import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
-import { IRenderManagerService, ScrollBar } from '@univerjs/engine-render';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
+import { IRenderManagerService, ScrollBar } from '@univerjs/engine-render';
import { IEditorService, SetEditorResizeOperation } from '@univerjs/ui';
import { fromEvent } from 'rxjs';
+import type { DocumentDataModel, ICommandInfo, Nullable, Workbook } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { VIEWPORT_KEY } from '../../basics/docs-view-key';
import { CoverContentCommand } from '../../commands/commands/replace-content.command';
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-ime-input.controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-ime-input.controller.ts
index 2281de03a7..1bd3b0f1aa 100644
--- a/packages/docs-ui/src/controllers/render-controllers/doc-ime-input.controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/doc-ime-input.controller.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { DocumentDataModel, Nullable } from '@univerjs/core';
import {
Disposable,
ICommandService,
@@ -22,15 +21,16 @@ import {
IUniverInstanceService,
Tools,
} from '@univerjs/core';
-import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
+import { DocSkeletonManagerService } from '@univerjs/docs';
import { IRenderManagerService } from '@univerjs/engine-render';
-import type { Subscription } from 'rxjs';
+import type { DocumentDataModel, Nullable } from '@univerjs/core';
+import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
-import { DocSkeletonManagerService } from '@univerjs/docs';
+import type { Subscription } from 'rxjs';
import { IMEInputCommand } from '../../commands/commands/ime-input.command';
import { DocIMEInputManagerService } from '../../services/doc-ime-input-manager.service';
-import type { IEditorInputConfig } from '../../services/selection/doc-selection-render.service';
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
+import type { IEditorInputConfig } from '../../services/selection/doc-selection-render.service';
export class DocIMEInputController extends Disposable implements IRenderModule {
private _previousIMEContent: string = '';
@@ -111,7 +111,8 @@ export class DocIMEInputController extends Disposable implements IRenderModule {
}
const skeleton = this._renderManagerSrv.getRenderById(documentModel.getUnitId())
- ?.with(DocSkeletonManagerService).getSkeleton();
+ ?.with(DocSkeletonManagerService)
+ .getSkeleton();
const { event, activeRange } = config;
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-input.controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-input.controller.ts
index e93967d4c5..8d709ca590 100644
--- a/packages/docs-ui/src/controllers/render-controllers/doc-input.controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/doc-input.controller.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import type { DocumentDataModel, Nullable } from '@univerjs/core';
import { Disposable, ICommandService, Inject } from '@univerjs/core';
+import { DocSkeletonManagerService } from '@univerjs/docs';
+import type { DocumentDataModel, Nullable } from '@univerjs/core';
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
import type { Subscription } from 'rxjs';
-import { DocSkeletonManagerService } from '@univerjs/docs';
-import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
-import { InsertCommand } from '../../commands/commands/core-editing.command';
import { AfterSpaceCommand } from '../../commands/commands/auto-format.command';
+import { InsertCommand } from '../../commands/commands/core-editing.command';
+import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
export class DocInputController extends Disposable implements IRenderModule {
private _onInputSubscription: Nullable<Subscription>;
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts
index 57139c5c04..9a9ce1063a 100644
--- a/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts
@@ -15,10 +15,10 @@
*/
import { Disposable, DOCS_ZEN_EDITOR_UNIT_ID_KEY, fromEventSubject, Inject, isInternalEditorID } from '@univerjs/core';
-import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
+import { DocSelectionManagerService } from '@univerjs/docs';
import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '@univerjs/engine-render';
import { animationFrameScheduler, filter, throttleTime } from 'rxjs';
-import { DocSelectionManagerService } from '@univerjs/docs';
+import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { DocPageLayoutService } from '../../services/doc-page-layout.service';
export class DocResizeRenderController extends Disposable implements IRenderModule {
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-selection-render.controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-selection-render.controller.ts
index 7c908b84ca..75fa83baf9 100644
--- a/packages/docs-ui/src/controllers/render-controllers/doc-selection-render.controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/doc-selection-render.controller.ts
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommandInfo } from '@univerjs/core';
import { Disposable, ICommandService, Inject, isInternalEditorID, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
-import type { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, RenderComponentType } from '@univerjs/engine-render';
+import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
import { CURSOR_TYPE, DocumentEditArea, PageLayoutType, Vector2 } from '@univerjs/engine-render';
-
import { IEditorService } from '@univerjs/ui';
-import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
-import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
+
+import type { DocumentDataModel, ICommandInfo } from '@univerjs/core';
+import type { IMouseEvent, IPointerEvent, IRenderContext, IRenderModule, RenderComponentType } from '@univerjs/engine-render';
import { neoGetDocObject } from '../../basics/component-tools';
-import type { ISetDocZoomRatioOperationParams } from '../../commands/operations/set-doc-zoom-ratio.operation';
import { SetDocZoomRatioOperation } from '../../commands/operations/set-doc-zoom-ratio.operation';
+import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
+import type { ISetDocZoomRatioOperationParams } from '../../commands/operations/set-doc-zoom-ratio.operation';
export class DocTextSelectionRenderController extends Disposable implements IRenderModule {
private _loadedMap = new WeakSet<RenderComponentType>();
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc.render-controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc.render-controller.ts
index c72af43d36..5c69638838 100644
--- a/packages/docs-ui/src/controllers/render-controllers/doc.render-controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/doc.render-controller.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import type { DocumentDataModel, EventState, ICommandInfo, Nullable } from '@univerjs/core';
import { FOCUSING_DOC, ICommandService, IConfigService, IContextService, Inject, RxDisposable } from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
-import type { DocumentSkeleton, IRenderContext, IRenderModule, IWheelEvent } from '@univerjs/engine-render';
import { DocBackground, Documents, IRenderManagerService, Layer, PageLayoutType, ScrollBar, Viewport } from '@univerjs/engine-render';
import { IEditorService } from '@univerjs/ui';
import { takeUntil } from 'rxjs';
+import type { DocumentDataModel, EventState, ICommandInfo, Nullable } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { DocumentSkeleton, IRenderContext, IRenderModule, IWheelEvent } from '@univerjs/engine-render';
import { DOCS_COMPONENT_BACKGROUND_LAYER_INDEX, DOCS_COMPONENT_DEFAULT_Z_INDEX, DOCS_COMPONENT_HEADER_LAYER_INDEX, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, VIEWPORT_KEY } from '../../basics/docs-view-key';
export class DocRenderController extends RxDisposable implements IRenderModule {
diff --git a/packages/docs-ui/src/controllers/render-controllers/zoom.render-controller.ts b/packages/docs-ui/src/controllers/render-controllers/zoom.render-controller.ts
index 0231c0879f..8dee5f234e 100644
--- a/packages/docs-ui/src/controllers/render-controllers/zoom.render-controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/zoom.render-controller.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommandInfo } from '@univerjs/core';
import {
Disposable,
FOCUSING_DOC,
@@ -23,15 +22,16 @@ import {
Inject,
IUniverInstanceService,
} from '@univerjs/core';
-
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
-import type { IRenderContext, IRenderModule, IWheelEvent } from '@univerjs/engine-render';
+
import { IEditorService } from '@univerjs/ui';
-import { DocPageLayoutService } from '../../services/doc-page-layout.service';
+import type { DocumentDataModel, ICommandInfo } from '@univerjs/core';
+import type { IRenderContext, IRenderModule, IWheelEvent } from '@univerjs/engine-render';
+import { neoGetDocObject } from '../../basics/component-tools';
import { SetDocZoomRatioCommand } from '../../commands/commands/set-doc-zoom-ratio.command';
-import type { ISetDocZoomRatioOperationParams } from '../../commands/operations/set-doc-zoom-ratio.operation';
import { SetDocZoomRatioOperation } from '../../commands/operations/set-doc-zoom-ratio.operation';
-import { neoGetDocObject } from '../../basics/component-tools';
+import { DocPageLayoutService } from '../../services/doc-page-layout.service';
+import type { ISetDocZoomRatioOperationParams } from '../../commands/operations/set-doc-zoom-ratio.operation';
export class DocZoomRenderController extends Disposable implements IRenderModule {
constructor(
diff --git a/packages/docs-ui/src/docs-ui-plugin.ts b/packages/docs-ui/src/docs-ui-plugin.ts
index 903a063583..51f4e524d7 100644
--- a/packages/docs-ui/src/docs-ui-plugin.ts
+++ b/packages/docs-ui/src/docs-ui-plugin.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { Dependency } from '@univerjs/core';
import { ICommandService,
IConfigService,
ILogService,
@@ -24,9 +23,61 @@ import { ICommandService,
mergeOverrideWithDependencies,
Plugin, UniverInstanceType,
} from '@univerjs/core';
-import { IEditorService, IShortcutService } from '@univerjs/ui';
-import { IRenderManagerService } from '@univerjs/engine-render';
import { DocInterceptorService, DocSkeletonManagerService } from '@univerjs/docs';
+import { IRenderManagerService } from '@univerjs/engine-render';
+import { IEditorService, IShortcutService } from '@univerjs/ui';
+import type { Dependency } from '@univerjs/core';
+import { DOC_UI_PLUGIN_NAME } from './basics/const/plugin-name';
+import { AfterSpaceCommand, EnterCommand, TabCommand } from './commands/commands/auto-format.command';
+import { BreakLineCommand } from './commands/commands/break-line.command';
+import { DocCopyCommand, DocCutCommand, DocPasteCommand } from './commands/commands/clipboard.command';
+import { CutContentCommand, InnerPasteCommand } from './commands/commands/clipboard.inner.command';
+import { DeleteCommand, InsertCommand, UpdateCommand } from './commands/commands/core-editing.command';
+import { DeleteCustomBlockCommand, DeleteLeftCommand, DeleteRightCommand, MergeTwoParagraphCommand } from './commands/commands/delete.command';
+import { DocParagraphSettingCommand } from './commands/commands/doc-paragraph-setting.command';
+import { IMEInputCommand } from './commands/commands/ime-input.command';
+import { ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from './commands/commands/inline-format.command';
+import { BulletListCommand, ChangeListNestingLevelCommand, ChangeListTypeCommand, CheckListCommand, ListOperationCommand, OrderListCommand, QuickListCommand, ToggleCheckListCommand } from './commands/commands/list.command';
+import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand } from './commands/commands/paragraph-align.command';
+import { CoverContentCommand, ReplaceContentCommand } from './commands/commands/replace-content.command';
+import { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command';
+import { CreateDocTableCommand } from './commands/commands/table/doc-table-create.command';
+import { DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand } from './commands/commands/table/doc-table-delete.command';
+import { DocTableInsertColumnCommand, DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertRowCommand } from './commands/commands/table/doc-table-insert.command';
+import { DocTableTabCommand } from './commands/commands/table/doc-table-tab.command';
+import { MoveCursorOperation, MoveSelectionOperation } from './commands/operations/doc-cursor.operation';
+import { DocParagraphSettingPanelOperation } from './commands/operations/doc-paragraph-setting-panel.operation';
+import { SelectAllOperation } from './commands/operations/select-all.operation';
+import { SetDocZoomRatioOperation } from './commands/operations/set-doc-zoom-ratio.operation';
+import { AppUIController } from './controllers';
+import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
+import { DocAutoFormatController } from './controllers/doc-auto-format.controller';
+import { DocHeaderFooterController } from './controllers/doc-header-footer.controller';
+import { DocMoveCursorController } from './controllers/doc-move-cursor.controller';
+import { DocParagraphSettingController } from './controllers/doc-paragraph-setting.controller';
+import { DocTableController } from './controllers/doc-table.controller';
+import { DocUIController } from './controllers/doc-ui.controller';
+import { DocBackScrollRenderController } from './controllers/render-controllers/back-scroll.render-controller';
+import { DocRenderController } from './controllers/render-controllers/doc.render-controller';
+import { DocChecklistRenderController } from './controllers/render-controllers/doc-checklist.render-controller';
+import { DocClipboardController } from './controllers/render-controllers/doc-clipboard.controller';
+import { DocContextMenuRenderController } from './controllers/render-controllers/doc-contextmenu.render-controller';
+import { DocEditorBridgeController } from './controllers/render-controllers/doc-editor-bridge.controller';
+import { DocIMEInputController } from './controllers/render-controllers/doc-ime-input.controller';
+import { DocInputController } from './controllers/render-controllers/doc-input.controller';
+import { DocResizeRenderController } from './controllers/render-controllers/doc-resize.render-controller';
+import { DocTextSelectionRenderController } from './controllers/render-controllers/doc-selection-render.controller';
+import { DocZoomRenderController } from './controllers/render-controllers/zoom.render-controller';
+import { DocClipboardService, IDocClipboardService } from './services/clipboard/clipboard.service';
+import { DocAutoFormatService } from './services/doc-auto-format.service';
+import { DocEventManagerService } from './services/doc-event-manager.service';
+import { DocIMEInputManagerService } from './services/doc-ime-input-manager.service';
+import { DocPageLayoutService } from './services/doc-page-layout.service';
+import { DocCanvasPopManagerService } from './services/doc-popup-manager.service';
+import { DocStateChangeManagerService } from './services/doc-state-change-manager.service';
+import { DocsRenderService } from './services/docs-render.service';
+import { DocSelectionRenderService } from './services/selection/doc-selection-render.service';
+import { BreakLineShortcut, DeleteLeftShortcut, DeleteRightShortcut } from './shortcuts/core-editing.shortcut';
import {
MoveCursorDownShortcut,
MoveCursorLeftShortcut,
@@ -38,59 +89,8 @@ import {
MoveSelectionUpShortcut,
SelectAllShortcut,
} from './shortcuts/cursor.shortcut';
-import { DOC_UI_PLUGIN_NAME } from './basics/const/plugin-name';
-import { AppUIController } from './controllers';
-import { DocUIController } from './controllers/doc-ui.controller';
-import { BreakLineShortcut, DeleteLeftShortcut, DeleteRightShortcut } from './shortcuts/core-editing.shortcut';
-import { DocClipboardService, IDocClipboardService } from './services/clipboard/clipboard.service';
-import { DocClipboardController } from './controllers/render-controllers/doc-clipboard.controller';
-import { DocEditorBridgeController } from './controllers/render-controllers/doc-editor-bridge.controller';
-import { DocRenderController } from './controllers/render-controllers/doc.render-controller';
-import { DocZoomRenderController } from './controllers/render-controllers/zoom.render-controller';
-import { DocTextSelectionRenderController } from './controllers/render-controllers/doc-selection-render.controller';
-import { DocBackScrollRenderController } from './controllers/render-controllers/back-scroll.render-controller';
-import { DocCanvasPopManagerService } from './services/doc-popup-manager.service';
-import { DocsRenderService } from './services/docs-render.service';
-import { DocHeaderFooterController } from './controllers/doc-header-footer.controller';
-import { DocContextMenuRenderController } from './controllers/render-controllers/doc-contextmenu.render-controller';
-import { DocPageLayoutService } from './services/doc-page-layout.service';
-import { DocResizeRenderController } from './controllers/render-controllers/doc-resize.render-controller';
-import { DocEventManagerService } from './services/doc-event-manager.service';
-import { DocAutoFormatController } from './controllers/doc-auto-format.controller';
import { ShiftTabShortCut } from './shortcuts/format.shortcut';
-import { DocChecklistRenderController } from './controllers/render-controllers/doc-checklist.render-controller';
-import { DocParagraphSettingController } from './controllers/doc-paragraph-setting.controller';
-import { DocParagraphSettingPanelOperation } from './commands/operations/doc-paragraph-setting-panel.operation';
-import { DocParagraphSettingCommand } from './commands/commands/doc-paragraph-setting.command';
-import { DocTableController } from './controllers/doc-table.controller';
import type { IUniverDocsUIConfig } from './controllers/config.schema';
-import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
-import { DocSelectionRenderService } from './services/selection/doc-selection-render.service';
-import { DocIMEInputManagerService } from './services/doc-ime-input-manager.service';
-import { IMEInputCommand } from './commands/commands/ime-input.command';
-import { DocIMEInputController } from './controllers/render-controllers/doc-ime-input.controller';
-import { DocMoveCursorController } from './controllers/doc-move-cursor.controller';
-import { MoveCursorOperation, MoveSelectionOperation } from './commands/operations/doc-cursor.operation';
-import { DocCopyCommand, DocCutCommand, DocPasteCommand } from './commands/commands/clipboard.command';
-import { DeleteCustomBlockCommand, DeleteLeftCommand, DeleteRightCommand, MergeTwoParagraphCommand } from './commands/commands/delete.command';
-import { ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from './commands/commands/inline-format.command';
-import { BreakLineCommand } from './commands/commands/break-line.command';
-import { DeleteCommand, InsertCommand, UpdateCommand } from './commands/commands/core-editing.command';
-import { SetDocZoomRatioOperation } from './commands/operations/set-doc-zoom-ratio.operation';
-import { BulletListCommand, ChangeListNestingLevelCommand, ChangeListTypeCommand, CheckListCommand, ListOperationCommand, OrderListCommand, QuickListCommand, ToggleCheckListCommand } from './commands/commands/list.command';
-import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand } from './commands/commands/paragraph-align.command';
-import { CreateDocTableCommand } from './commands/commands/table/doc-table-create.command';
-import { DocTableInsertColumnCommand, DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertRowCommand } from './commands/commands/table/doc-table-insert.command';
-import { DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand } from './commands/commands/table/doc-table-delete.command';
-import { DocTableTabCommand } from './commands/commands/table/doc-table-tab.command';
-import { AfterSpaceCommand, EnterCommand, TabCommand } from './commands/commands/auto-format.command';
-import { CutContentCommand, InnerPasteCommand } from './commands/commands/clipboard.inner.command';
-import { CoverContentCommand, ReplaceContentCommand } from './commands/commands/replace-content.command';
-import { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command';
-import { SelectAllOperation } from './commands/operations/select-all.operation';
-import { DocAutoFormatService } from './services/doc-auto-format.service';
-import { DocStateChangeManagerService } from './services/doc-state-change-manager.service';
-import { DocInputController } from './controllers/render-controllers/doc-input.controller';
export class UniverDocsUIPlugin extends Plugin {
static override pluginName = DOC_UI_PLUGIN_NAME;
diff --git a/packages/docs-ui/src/index.ts b/packages/docs-ui/src/index.ts
index 5d2f4fb281..cf87225e2a 100644
--- a/packages/docs-ui/src/index.ts
+++ b/packages/docs-ui/src/index.ts
@@ -14,117 +14,117 @@
* limitations under the License.
*/
+// #endregion
+export { DocAutoFormatService } from '../../docs-ui/src/services/doc-auto-format.service';
+export * from './basics';
+export type { IDocObjectParam } from './basics/component-tools';
+export { getDocObject, getDocObjectById, neoGetDocObject } from './basics/component-tools';
+export { addCustomDecorationBySelectionFactory, addCustomDecorationFactory, deleteCustomDecorationFactory } from './basics/custom-decoration-factory';
export { getCustomRangesInterestsWithRange } from './basics/custom-range';
-export { makeSelection, getSelectionText, getDeleteSelection, getInsertSelection } from './basics/selection';
+export { addCustomRangeBySelectionFactory, addCustomRangeFactory, deleteCustomRangeFactory } from './basics/custom-range-factory';
+export * from './basics/docs-view-key';
export { hasParagraphInTable } from './basics/paragraph';
+export { getPlainTextFormBody, getPlainTextFormDocument } from './basics/plain-text';
export { replaceSelectionFactory } from './basics/replace';
-export type { IDocObjectParam } from './basics/component-tools';
-export { getDocObject, neoGetDocObject, getDocObjectById } from './basics/component-tools';
-export { getRichTextEditPath, getCommandSkeleton } from './commands/util';
-export { addCustomRangeFactory, addCustomRangeBySelectionFactory, deleteCustomRangeFactory } from './basics/custom-range-factory';
-export { addCustomDecorationBySelectionFactory, addCustomDecorationFactory, deleteCustomDecorationFactory } from './basics/custom-decoration-factory';
export { getRetainAndDeleteFromReplace } from './basics/retain-delete-params';
-export { getPlainTextFormDocument, getPlainTextFormBody } from './basics/plain-text';
-export * from './basics/docs-view-key';
-export { whenDocAndEditorFocused } from './shortcuts/utils';
-export { IDocClipboardService } from './services/clipboard/clipboard.service';
-export { DocBackScrollRenderController } from './controllers/render-controllers/back-scroll.render-controller';
-export * from './basics';
-export * from './docs-ui-plugin';
-export { DocRenderController } from './controllers/render-controllers/doc.render-controller';
-export * from './services';
-export { DocsRenderService } from './services/docs-render.service';
-export { DocCanvasPopManagerService } from './services/doc-popup-manager.service';
+export { getDeleteSelection, getInsertSelection, getSelectionText, makeSelection } from './basics/selection';
export { docDrawingPositionToTransform, transformToDocDrawingPosition } from './basics/transform-position';
-export { DocEventManagerService } from './services/doc-event-manager.service';
-export { DocUIController } from './controllers/doc-ui.controller';
-
-export { menuSchema } from './controllers/menu.schema';
-
-// #region - all commands
-export { RectRange, convertPositionsToRectRanges } from './services/selection/rect-range';
-export { getCanvasOffsetByEngine } from './services/selection/selection-utils';
-export type { IEditorInputConfig } from './services/selection/doc-selection-render.service';
-export { getAnchorBounding, TEXT_RANGE_LAYER_INDEX, TextRange, getLineBounding } from './services/selection/text-range';
-export { NodePositionConvertToCursor } from './services/selection/convert-text-range';
-export { getOneTextSelectionRange } from './services/selection/convert-text-range';
-export type { IDocRange } from './services/selection/range-interface';
-export { isInSameTableCell, isValidRectRange, NodePositionConvertToRectRange } from './services/selection/convert-rect-range';
-
-export { DocSelectionRenderService } from './services/selection/doc-selection-render.service';
-export { DocStateChangeManagerService } from './services/doc-state-change-manager.service';
-export { DocIMEInputManagerService } from './services/doc-ime-input-manager.service';
-
-export { getParagraphsInRange, getParagraphsInRanges } from './commands/commands/list.command';
+export { AfterSpaceCommand, EnterCommand, type ITabCommandParams, TabCommand } from './commands/commands/auto-format.command';
export { BreakLineCommand } from './commands/commands/break-line.command';
+export { generateParagraphs } from './commands/commands/break-line.command';
+export { DocCopyCommand, DocCutCommand, DocPasteCommand } from './commands/commands/clipboard.command';
export { CutContentCommand, InnerPasteCommand } from './commands/commands/clipboard.inner.command';
+export type { IInnerCutCommandParams } from './commands/commands/clipboard.inner.command';
+export { getCustomBlockIdsInSelections, getCutActionsFromDocRanges } from './commands/commands/clipboard.inner.command';
export {
- InsertCommand,
DeleteCommand,
- UpdateCommand,
EditorInsertTextCommandId,
type ICoverCommandParams,
type IDeleteCommandParams,
type IInsertCommandParams,
+ InsertCommand,
type IUpdateCommandParams,
+ UpdateCommand,
} from './commands/commands/core-editing.command';
-export { DeleteLeftCommand, DeleteRightCommand, DeleteCustomBlockCommand, MergeTwoParagraphCommand, type IDeleteCustomBlockParams } from './commands/commands/delete.command';
+export { DeleteCustomBlockCommand, DeleteLeftCommand, DeleteRightCommand, type IDeleteCustomBlockParams, MergeTwoParagraphCommand } from './commands/commands/delete.command';
+export { getCursorWhenDelete } from './commands/commands/delete.command';
+
+export { IMEInputCommand } from './commands/commands/ime-input.command';
+
export {
+ ResetInlineFormatTextBackgroundColorCommand,
SetInlineFormatBoldCommand,
+ SetInlineFormatCommand,
+ SetInlineFormatFontFamilyCommand,
+ SetInlineFormatFontSizeCommand,
SetInlineFormatItalicCommand,
- SetInlineFormatUnderlineCommand,
SetInlineFormatStrikethroughCommand,
SetInlineFormatSubscriptCommand,
SetInlineFormatSuperscriptCommand,
- SetInlineFormatFontSizeCommand,
- SetInlineFormatFontFamilyCommand,
- SetInlineFormatTextColorCommand,
SetInlineFormatTextBackgroundColorCommand,
- ResetInlineFormatTextBackgroundColorCommand,
- SetInlineFormatCommand,
+ SetInlineFormatTextColorCommand,
+ SetInlineFormatUnderlineCommand,
} from './commands/commands/inline-format.command';
+export { getParagraphsInRange, getParagraphsInRanges } from './commands/commands/list.command';
export {
- ListOperationCommand,
BulletListCommand,
- OrderListCommand,
ChangeListNestingLevelCommand,
ChangeListTypeCommand,
CheckListCommand,
- ToggleCheckListCommand,
+ ListOperationCommand,
+ OrderListCommand,
QuickListCommand,
+ ToggleCheckListCommand,
} from './commands/commands/list.command';
+export { ChangeListNestingLevelType } from './commands/commands/list.command';
export {
- AlignOperationCommand,
- AlignLeftCommand,
AlignCenterCommand,
- AlignRightCommand,
AlignJustifyCommand,
+ AlignLeftCommand,
+ AlignOperationCommand,
+ AlignRightCommand,
} from './commands/commands/paragraph-align.command';
-export { IMEInputCommand } from './commands/commands/ime-input.command';
-export { ReplaceContentCommand, CoverContentCommand } from './commands/commands/replace-content.command';
+export { CoverContentCommand, ReplaceContentCommand } from './commands/commands/replace-content.command';
export { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command';
-export { AfterSpaceCommand, TabCommand, EnterCommand, type ITabCommandParams } from './commands/commands/auto-format.command';
-export { SetDocZoomRatioOperation, type ISetDocZoomRatioOperationParams } from './commands/operations/set-doc-zoom-ratio.operation';
-export { MoveSelectionOperation } from './commands/operations/doc-cursor.operation';
-
-// #endregion
-export { DocAutoFormatService } from '../../docs-ui/src/services/doc-auto-format.service';
-export { ChangeListNestingLevelType } from './commands/commands/list.command';
-export { generateParagraphs } from './commands/commands/break-line.command';
-export type { IInnerCutCommandParams } from './commands/commands/clipboard.inner.command';
-export { getCutActionsFromDocRanges, getCustomBlockIdsInSelections } from './commands/commands/clipboard.inner.command';
export { CreateDocTableCommand, type ICreateDocTableCommandParams } from './commands/commands/table/doc-table-create.command';
-export { DocTableDeleteRowsCommand, DocTableDeleteColumnsCommand, DocTableDeleteTableCommand } from './commands/commands/table/doc-table-delete.command';
-export type { IDocTableDeleteRowsCommandParams, IDocTableDeleteColumnsCommandParams, IDocTableDeleteTableCommandParams } from './commands/commands/table/doc-table-delete.command';
-export type { IDocTableInsertColumnCommandParams, IDocTableInsertRowCommandParams, IDocTableInsertColumnRightCommandParams, IDocTableInsertRowAboveCommandParams, IDocTableInsertRowBellowCommandParams, IDocTableInsertColumnLeftCommandParams } from './commands/commands/table/doc-table-insert.command';
-export { DocTableInsertColumnCommand, DocTableInsertRowCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertColumnLeftCommand } from './commands/commands/table/doc-table-insert.command';
+
+export { DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand } from './commands/commands/table/doc-table-delete.command';
+export type { IDocTableDeleteColumnsCommandParams, IDocTableDeleteRowsCommandParams, IDocTableDeleteTableCommandParams } from './commands/commands/table/doc-table-delete.command';
+export type { IDocTableInsertColumnCommandParams, IDocTableInsertColumnLeftCommandParams, IDocTableInsertColumnRightCommandParams, IDocTableInsertRowAboveCommandParams, IDocTableInsertRowBellowCommandParams, IDocTableInsertRowCommandParams } from './commands/commands/table/doc-table-insert.command';
+
+export { DocTableInsertColumnCommand, DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertRowCommand } from './commands/commands/table/doc-table-insert.command';
export type { IDocTableTabCommandParams } from './commands/commands/table/doc-table-tab.command';
export { DocTableTabCommand } from './commands/commands/table/doc-table-tab.command';
-
-export { genTableSource, getEmptyTableRow, getEmptyTableCell, getTableColumn } from './commands/commands/table/table';
-export { getCursorWhenDelete } from './commands/commands/delete.command';
-export { DocCopyCommand, DocCutCommand, DocPasteCommand } from './commands/commands/clipboard.command';
+export { genTableSource, getEmptyTableCell, getEmptyTableRow, getTableColumn } from './commands/commands/table/table';
export { DocCreateTableOperation } from './commands/operations/doc-create-table.operation';
-export { SelectAllOperation } from './commands/operations/select-all.operation';
+export { MoveSelectionOperation } from './commands/operations/doc-cursor.operation';
export { MoveCursorOperation } from './commands/operations/doc-cursor.operation';
+export { SelectAllOperation } from './commands/operations/select-all.operation';
+export { type ISetDocZoomRatioOperationParams, SetDocZoomRatioOperation } from './commands/operations/set-doc-zoom-ratio.operation';
+export { getCommandSkeleton, getRichTextEditPath } from './commands/util';
+export { DocUIController } from './controllers/doc-ui.controller';
+export { menuSchema } from './controllers/menu.schema';
+export { DocBackScrollRenderController } from './controllers/render-controllers/back-scroll.render-controller';
+export { DocRenderController } from './controllers/render-controllers/doc.render-controller';
+
+export * from './docs-ui-plugin';
+export * from './services';
+export { IDocClipboardService } from './services/clipboard/clipboard.service';
+export { DocEventManagerService } from './services/doc-event-manager.service';
+export { DocIMEInputManagerService } from './services/doc-ime-input-manager.service';
+export { DocCanvasPopManagerService } from './services/doc-popup-manager.service';
+export { DocStateChangeManagerService } from './services/doc-state-change-manager.service';
+export { DocsRenderService } from './services/docs-render.service';
+export { isInSameTableCell, isValidRectRange, NodePositionConvertToRectRange } from './services/selection/convert-rect-range';
+export { NodePositionConvertToCursor } from './services/selection/convert-text-range';
+export { getOneTextSelectionRange } from './services/selection/convert-text-range';
+export type { IEditorInputConfig } from './services/selection/doc-selection-render.service';
+
+export { DocSelectionRenderService } from './services/selection/doc-selection-render.service';
+export type { IDocRange } from './services/selection/range-interface';
+// #region - all commands
+export { convertPositionsToRectRanges, RectRange } from './services/selection/rect-range';
+export { getCanvasOffsetByEngine } from './services/selection/selection-utils';
+export { getAnchorBounding, getLineBounding, TEXT_RANGE_LAYER_INDEX, TextRange } from './services/selection/text-range';
+export { whenDocAndEditorFocused } from './shortcuts/utils';
// #endregion
diff --git a/packages/docs-ui/src/services/clipboard/clipboard.service.ts b/packages/docs-ui/src/services/clipboard/clipboard.service.ts
index 03a72534c9..a62b8860ec 100644
--- a/packages/docs-ui/src/services/clipboard/clipboard.service.ts
+++ b/packages/docs-ui/src/services/clipboard/clipboard.service.ts
@@ -14,21 +14,21 @@
* limitations under the License.
*/
-import type { ICustomRange, IDisposable, IDocumentBody, IDocumentData, IParagraph, Nullable } from '@univerjs/core';
import { createIdentifier, CustomRangeType, DataStreamTreeTokenType, Disposable, DOC_RANGE_TYPE, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, generateRandomId, getBodySlice, ICommandService, ILogService, Inject, IUniverInstanceService, normalizeBody, SliceBodyType, toDisposable, Tools, UniverInstanceType } from '@univerjs/core';
+import { DocSelectionManagerService } from '@univerjs/docs';
import { HTML_CLIPBOARD_MIME_TYPE, IClipboardInterfaceService, PLAIN_TEXT_CLIPBOARD_MIME_TYPE } from '@univerjs/ui';
+import type { ICustomRange, IDisposable, IDocumentBody, IDocumentData, IParagraph, Nullable } from '@univerjs/core';
import type { IRectRangeWithStyle, ITextRangeWithStyle } from '@univerjs/engine-render';
-import { DocSelectionManagerService } from '@univerjs/docs';
-import { getCursorWhenDelete } from '../../commands/commands/delete.command';
-import { CutContentCommand, InnerPasteCommand } from '../../commands/commands/clipboard.inner.command';
-import { getDeleteSelection } from '../../basics/selection';
import { copyCustomRange } from '../../basics/custom-range';
+import { getDeleteSelection } from '../../basics/selection';
+import { CutContentCommand, InnerPasteCommand } from '../../commands/commands/clipboard.inner.command';
+import { getCursorWhenDelete } from '../../commands/commands/delete.command';
import { copyContentCache, extractId, genId } from './copy-content-cache';
import { HtmlToUDMService } from './html-to-udm/converter';
import PastePluginLark from './html-to-udm/paste-plugins/plugin-lark';
-import PastePluginWord from './html-to-udm/paste-plugins/plugin-word';
import PastePluginUniver from './html-to-udm/paste-plugins/plugin-univer';
+import PastePluginWord from './html-to-udm/paste-plugins/plugin-word';
import { UDMToHtmlService } from './udm-to-html/convertor';
HtmlToUDMService.use(PastePluginWord);
diff --git a/packages/docs-ui/src/services/clipboard/html-to-udm/converter.ts b/packages/docs-ui/src/services/clipboard/html-to-udm/converter.ts
index fc56219b03..63a9c4669b 100644
--- a/packages/docs-ui/src/services/clipboard/html-to-udm/converter.ts
+++ b/packages/docs-ui/src/services/clipboard/html-to-udm/converter.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { IDocumentBody, IDocumentData, ITable, ITextStyle, Nullable } from '@univerjs/core';
import { CustomRangeType, DataStreamTreeTokenType, generateRandomId, skipParseTagNames, Tools } from '@univerjs/core';
+import type { IDocumentBody, IDocumentData, ITable, ITextStyle, Nullable } from '@univerjs/core';
import { genTableSource, getEmptyTableCell, getEmptyTableRow, getTableColumn } from '../../../commands/commands/table/table';
import { extractNodeStyle } from './parse-node-style';
diff --git a/packages/docs-ui/src/services/doc-auto-format.service.ts b/packages/docs-ui/src/services/doc-auto-format.service.ts
index 74574d3eb2..36357eafdd 100644
--- a/packages/docs-ui/src/services/doc-auto-format.service.ts
+++ b/packages/docs-ui/src/services/doc-auto-format.service.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommandInfo, ICustomRange, IDisposable, IParagraph, IParagraphRange, ITextRange, Nullable } from '@univerjs/core';
import { Disposable, Inject, IUniverInstanceService, toDisposable, UniverInstanceType } from '@univerjs/core';
import { DocSelectionManagerService } from '@univerjs/docs';
+import type { DocumentDataModel, ICommandInfo, ICustomRange, IDisposable, IParagraph, IParagraphRange, ITextRange, Nullable } from '@univerjs/core';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { getCustomRangesInterestsWithRange } from '../basics/custom-range';
diff --git a/packages/docs-ui/src/services/doc-event-manager.service.ts b/packages/docs-ui/src/services/doc-event-manager.service.ts
index 23f86c875e..0567c9ce89 100644
--- a/packages/docs-ui/src/services/doc-event-manager.service.ts
+++ b/packages/docs-ui/src/services/doc-event-manager.service.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICustomRange, IParagraph, ITextRangeParam, Nullable } from '@univerjs/core';
import { Disposable, fromEventSubject, Inject } from '@univerjs/core';
import { DocSkeletonManagerService } from '@univerjs/docs';
-import type { Documents, DocumentSkeleton, IBoundRectNoAngle, IDocumentSkeletonGlyph, IMouseEvent, IPointerEvent, IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { CURSOR_TYPE, TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '@univerjs/engine-render';
import { distinctUntilChanged, filter, map, mergeMap, Subject, take, throttleTime } from 'rxjs';
+import type { DocumentDataModel, ICustomRange, IParagraph, ITextRangeParam, Nullable } from '@univerjs/core';
+import type { Documents, DocumentSkeleton, IBoundRectNoAngle, IDocumentSkeletonGlyph, IMouseEvent, IPointerEvent, IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { transformOffset2Bound } from './doc-popup-manager.service';
import { NodePositionConvertToCursor } from './selection/convert-text-range';
import { getLineBounding } from './selection/text-range';
diff --git a/packages/docs-ui/src/services/doc-page-layout.service.ts b/packages/docs-ui/src/services/doc-page-layout.service.ts
index 15ac11a06c..2f11bf26ab 100644
--- a/packages/docs-ui/src/services/doc-page-layout.service.ts
+++ b/packages/docs-ui/src/services/doc-page-layout.service.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { DocumentDataModel } from '@univerjs/core';
import { Disposable } from '@univerjs/core';
+import type { DocumentDataModel } from '@univerjs/core';
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { neoGetDocObject } from '../basics/component-tools';
import { VIEWPORT_KEY } from '../basics/docs-view-key';
diff --git a/packages/docs-ui/src/services/doc-popup-manager.service.ts b/packages/docs-ui/src/services/doc-popup-manager.service.ts
index cfd70d4741..73add0d28e 100644
--- a/packages/docs-ui/src/services/doc-popup-manager.service.ts
+++ b/packages/docs-ui/src/services/doc-popup-manager.service.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import type { IDisposable, ITextRangeParam } from '@univerjs/core';
import { Disposable, DisposableCollection, ICommandService, Inject, IUniverInstanceService } from '@univerjs/core';
+import { DocSkeletonManagerService } from '@univerjs/docs';
import { IRenderManagerService, pxToNum } from '@univerjs/engine-render';
-import type { BaseObject, Documents, IBoundRectNoAngle, IRender, Scene } from '@univerjs/engine-render';
-import type { IPopup } from '@univerjs/ui';
import { ICanvasPopupService } from '@univerjs/ui';
import { BehaviorSubject, map } from 'rxjs';
-import { DocSkeletonManagerService } from '@univerjs/docs';
+import type { IDisposable, ITextRangeParam } from '@univerjs/core';
+import type { BaseObject, Documents, IBoundRectNoAngle, IRender, Scene } from '@univerjs/engine-render';
+import type { IPopup } from '@univerjs/ui';
import { VIEWPORT_KEY } from '../basics/docs-view-key';
import { SetDocZoomRatioOperation } from '../commands/operations/set-doc-zoom-ratio.operation';
import { NodePositionConvertToCursor } from './selection/convert-text-range';
diff --git a/packages/docs-ui/src/services/doc-state-change-manager.service.ts b/packages/docs-ui/src/services/doc-state-change-manager.service.ts
index 239c098db0..7ca314e451 100644
--- a/packages/docs-ui/src/services/doc-state-change-manager.service.ts
+++ b/packages/docs-ui/src/services/doc-state-change-manager.service.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { JSONXActions, Nullable } from '@univerjs/core';
import { ICommandService, Inject, IUndoRedoService, IUniverInstanceService, JSONX, LifecycleStages, OnLifecycle, RedoCommandId, RxDisposable, UndoCommandId } from '@univerjs/core';
import { DocStateEmitService, type IDocStateChangeParams, type IRichTextEditingMutationParams } from '@univerjs/docs';
import { IRenderManagerService } from '@univerjs/engine-render';
import { BehaviorSubject, takeUntil } from 'rxjs';
+import type { JSONXActions, Nullable } from '@univerjs/core';
import { DocIMEInputManagerService } from './doc-ime-input-manager.service';
type ChangeStateCacheType = 'history' | 'collaboration';
diff --git a/packages/docs-ui/src/services/selection/convert-rect-range.ts b/packages/docs-ui/src/services/selection/convert-rect-range.ts
index 6ba4ae098e..d665018a6d 100644
--- a/packages/docs-ui/src/services/selection/convert-rect-range.ts
+++ b/packages/docs-ui/src/services/selection/convert-rect-range.ts
@@ -15,8 +15,8 @@
*/
import { type Nullable, Tools } from '@univerjs/core';
-import type { DocumentSkeleton, IDocumentOffsetConfig, IDocumentSkeletonGlyph, IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonTable, INodePosition, IPoint } from '@univerjs/engine-render';
import { DocumentSkeletonPageType, getPageFromPath, getTableIdAndSliceIndex, Liquid } from '@univerjs/engine-render';
+import type { DocumentSkeleton, IDocumentOffsetConfig, IDocumentSkeletonGlyph, IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonTable, INodePosition, IPoint } from '@univerjs/engine-render';
import { compareNodePositionLogic, pushToPoints } from './convert-text-range';
// The anchor and focus need to be in the same table,
diff --git a/packages/docs-ui/src/services/selection/convert-text-range.ts b/packages/docs-ui/src/services/selection/convert-text-range.ts
index a4d413e9f2..e910940b2d 100644
--- a/packages/docs-ui/src/services/selection/convert-text-range.ts
+++ b/packages/docs-ui/src/services/selection/convert-text-range.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
+import { DocumentSkeletonPageType, getPageFromPath, GlyphType, Liquid } from '@univerjs/engine-render';
import type { IPosition, ITextRange, Nullable } from '@univerjs/core';
import type { DocumentSkeleton, IDocumentOffsetConfig, IDocumentSkeletonColumn, IDocumentSkeletonDivide, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonSection, INodePosition, IPoint } from '@univerjs/engine-render';
-import { DocumentSkeletonPageType, getPageFromPath, GlyphType, Liquid } from '@univerjs/engine-render';
export enum NodePositionStateType {
NORMAL,
diff --git a/packages/docs-ui/src/services/selection/doc-selection-render.service.ts b/packages/docs-ui/src/services/selection/doc-selection-render.service.ts
index 57db450fae..c42af33310 100644
--- a/packages/docs-ui/src/services/selection/doc-selection-render.service.ts
+++ b/packages/docs-ui/src/services/selection/doc-selection-render.service.ts
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-import type { Documents, Engine, IDocSelectionInnerParam, IFindNodeRestrictions, IMouseEvent, INodeInfo, INodePosition, IPointerEvent, IRenderContext, IRenderModule, IScrollObserverParam, ISuccinctDocRangeParam, ITextRangeWithStyle, ITextSelectionStyle, Viewport } from '@univerjs/engine-render';
+import { DataStreamTreeTokenType, DOC_RANGE_TYPE, ILogService, Inject, RxDisposable } from '@univerjs/core';
+import { DocSkeletonManagerService } from '@univerjs/docs';
import { CURSOR_TYPE, getSystemHighlightColor, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, PageLayoutType, ScrollTimer, Vector2 } from '@univerjs/engine-render';
+import { ILayoutService } from '@univerjs/ui';
+import { BehaviorSubject, fromEvent, Subject } from 'rxjs';
import type { DocumentDataModel, Nullable } from '@univerjs/core';
-import { DataStreamTreeTokenType, DOC_RANGE_TYPE, ILogService, Inject, RxDisposable } from '@univerjs/core';
+import type { Documents, Engine, IDocSelectionInnerParam, IFindNodeRestrictions, IMouseEvent, INodeInfo, INodePosition, IPointerEvent, IRenderContext, IRenderModule, IScrollObserverParam, ISuccinctDocRangeParam, ITextRangeWithStyle, ITextSelectionStyle, Viewport } from '@univerjs/engine-render';
import type { Subscription } from 'rxjs';
-import { BehaviorSubject, fromEvent, Subject } from 'rxjs';
-import { ILayoutService } from '@univerjs/ui';
-import { DocSkeletonManagerService } from '@univerjs/docs';
-import type { RectRange } from './rect-range';
import { getCanvasOffsetByEngine, getParagraphInfoByGlyph, getRangeListFromCharIndex, getRangeListFromSelection, getRectRangeFromCharIndex, getTextRangeFromCharIndex, serializeRectRange, serializeTextRange } from './selection-utils';
import { TextRange } from './text-range';
+import type { RectRange } from './rect-range';
export interface IEditorInputConfig {
event: Event | CompositionEvent | KeyboardEvent;
diff --git a/packages/docs-ui/src/services/selection/rect-range.ts b/packages/docs-ui/src/services/selection/rect-range.ts
index 44a82f2e25..14f985c1c5 100644
--- a/packages/docs-ui/src/services/selection/rect-range.ts
+++ b/packages/docs-ui/src/services/selection/rect-range.ts
@@ -15,11 +15,11 @@
*/
import { COLORS, DOC_RANGE_TYPE, type Nullable, RANGE_DIRECTION, Rectangle, Tools } from '@univerjs/core';
-import type { Documents, DocumentSkeleton, INodePosition, IPoint, ITextSelectionStyle, ThinScene } from '@univerjs/engine-render';
import { getColor, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, RegularPolygon } from '@univerjs/engine-render';
-import type { IDocRange } from './range-interface';
+import type { Documents, DocumentSkeleton, INodePosition, IPoint, ITextSelectionStyle, ThinScene } from '@univerjs/engine-render';
import { compareNodePositionInTable, NodePositionConvertToRectRange } from './convert-rect-range';
import { TEXT_RANGE_LAYER_INDEX } from './text-range';
+import type { IDocRange } from './range-interface';
const RECT_RANGE_KEY_PREFIX = '__DocTableRectRange__';
const ID_LENGTH = 6;
diff --git a/packages/docs-ui/src/services/selection/selection-utils.ts b/packages/docs-ui/src/services/selection/selection-utils.ts
index 8ec81c2aea..ba355de959 100644
--- a/packages/docs-ui/src/services/selection/selection-utils.ts
+++ b/packages/docs-ui/src/services/selection/selection-utils.ts
@@ -31,11 +31,11 @@
*/
import { type Nullable, RANGE_DIRECTION, Tools } from '@univerjs/core';
-import type { Documents, DocumentSkeleton, Engine, IDocumentSkeletonGlyph, INodePosition, IRectRangeWithStyle, ITextRangeWithStyle, ITextSelectionStyle, Scene } from '@univerjs/engine-render';
import { getOffsetRectForDom } from '@univerjs/engine-render';
+import type { Documents, DocumentSkeleton, Engine, IDocumentSkeletonGlyph, INodePosition, IRectRangeWithStyle, ITextRangeWithStyle, ITextSelectionStyle, Scene } from '@univerjs/engine-render';
+import { isInSameTableCell, isValidRectRange } from './convert-rect-range';
import { convertPositionsToRectRanges, RectRange } from './rect-range';
import { TextRange } from './text-range';
-import { isInSameTableCell, isValidRectRange } from './convert-rect-range';
import type { IDocRange } from './range-interface';
interface IDocRangeList {
diff --git a/packages/docs-ui/src/services/selection/text-range.ts b/packages/docs-ui/src/services/selection/text-range.ts
index 792b507804..4bda36f8dd 100644
--- a/packages/docs-ui/src/services/selection/text-range.ts
+++ b/packages/docs-ui/src/services/selection/text-range.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { ITextRange, Nullable } from '@univerjs/core';
import { BooleanNumber, COLORS, DOC_RANGE_TYPE, RANGE_DIRECTION, Tools } from '@univerjs/core';
-import type { Documents, DocumentSkeleton, IDocumentSkeletonGlyph, INodePosition, IPoint, ISuccinctDocRangeParam, ITextSelectionStyle, Scene, ThinScene } from '@univerjs/engine-render';
import { getColor, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, Rect, RegularPolygon } from '@univerjs/engine-render';
+import type { ITextRange, Nullable } from '@univerjs/core';
+import type { Documents, DocumentSkeleton, IDocumentSkeletonGlyph, INodePosition, IPoint, ISuccinctDocRangeParam, ITextSelectionStyle, Scene, ThinScene } from '@univerjs/engine-render';
import {
compareNodePosition,
compareNodePositionLogic,
diff --git a/packages/docs-ui/src/shortcuts/core-editing.shortcut.ts b/packages/docs-ui/src/shortcuts/core-editing.shortcut.ts
index 79efddc84c..202fa87cc4 100644
--- a/packages/docs-ui/src/shortcuts/core-editing.shortcut.ts
+++ b/packages/docs-ui/src/shortcuts/core-editing.shortcut.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { IShortcutItem } from '@univerjs/ui';
import { KeyCode } from '@univerjs/ui';
+import type { IShortcutItem } from '@univerjs/ui';
import { EnterCommand } from '../commands/commands/auto-format.command';
import { DeleteLeftCommand, DeleteRightCommand } from '../commands/commands/delete.command';
import { whenDocAndEditorFocused, whenDocAndEditorFocusedWithBreakLine } from './utils';
diff --git a/packages/docs-ui/src/shortcuts/cursor.shortcut.ts b/packages/docs-ui/src/shortcuts/cursor.shortcut.ts
index 63b7f1c4a0..0a5fd974da 100644
--- a/packages/docs-ui/src/shortcuts/cursor.shortcut.ts
+++ b/packages/docs-ui/src/shortcuts/cursor.shortcut.ts
@@ -15,8 +15,8 @@
*/
import { Direction, EDITOR_ACTIVATED, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR } from '@univerjs/core';
-import type { IShortcutItem } from '@univerjs/ui';
import { KeyCode, MetaKeys } from '@univerjs/ui';
+import type { IShortcutItem } from '@univerjs/ui';
import { MoveCursorOperation, MoveSelectionOperation } from '../commands/operations/doc-cursor.operation';
import { SelectAllOperation } from '../commands/operations/select-all.operation';
import { whenDocAndEditorFocused } from './utils';
diff --git a/packages/docs-ui/src/shortcuts/toolbar.shortcut.ts b/packages/docs-ui/src/shortcuts/toolbar.shortcut.ts
index 2017594c8c..8e1ea710d3 100644
--- a/packages/docs-ui/src/shortcuts/toolbar.shortcut.ts
+++ b/packages/docs-ui/src/shortcuts/toolbar.shortcut.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { IShortcutItem } from '@univerjs/ui';
import { KeyCode, MetaKeys } from '@univerjs/ui';
+import type { IShortcutItem } from '@univerjs/ui';
import { SetInlineFormatBoldCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatUnderlineCommand } from '../commands/commands/inline-format.command';
-import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignRightCommand } from '../commands/commands/paragraph-align.command';
import { BulletListCommand, OrderListCommand } from '../commands/commands/list.command';
+import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignRightCommand } from '../commands/commands/paragraph-align.command';
import { whenDocAndEditorFocused } from './utils';
export const BoldShortCut: IShortcutItem = {
diff --git a/packages/docs-ui/src/views/count-bar/ZoomSlider.tsx b/packages/docs-ui/src/views/count-bar/ZoomSlider.tsx
index e52e90ef59..0ee8abc694 100644
--- a/packages/docs-ui/src/views/count-bar/ZoomSlider.tsx
+++ b/packages/docs-ui/src/views/count-bar/ZoomSlider.tsx
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { DocumentDataModel } from '@univerjs/core';
import {
ICommandService,
IUniverInstanceService,
@@ -24,6 +23,7 @@ import {
} from '@univerjs/core';
import { Slider } from '@univerjs/design';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
+import type { DocumentDataModel } from '@univerjs/core';
import { SetDocZoomRatioOperation } from '../../commands/operations/set-doc-zoom-ratio.operation';
const ZOOM_MAP = [50, 80, 100, 130, 150, 170, 200, 400];
diff --git a/packages/docs-ui/src/views/header-footer/panel/DocHeaderFooterOptions.tsx b/packages/docs-ui/src/views/header-footer/panel/DocHeaderFooterOptions.tsx
index a66710eb2c..43aa0f8039 100644
--- a/packages/docs-ui/src/views/header-footer/panel/DocHeaderFooterOptions.tsx
+++ b/packages/docs-ui/src/views/header-footer/panel/DocHeaderFooterOptions.tsx
@@ -15,11 +15,11 @@
*/
import { BooleanNumber, ICommandService, IUniverInstanceService, LocaleService, Tools, useDependency } from '@univerjs/core';
-import React, { useEffect, useState } from 'react';
import { Button, Checkbox, InputNumber } from '@univerjs/design';
-import clsx from 'clsx';
-import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
+import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
+import clsx from 'clsx';
+import React, { useEffect, useState } from 'react';
import { CoreHeaderFooterCommandId, type IHeaderFooterProps } from '../../../commands/commands/doc-header-footer.command';
import { DocSelectionRenderService } from '../../../services/selection/doc-selection-render.service';
import styles from './index.module.less';
diff --git a/packages/docs-ui/src/views/paragraph-setting/hook/utils.ts b/packages/docs-ui/src/views/paragraph-setting/hook/utils.ts
index 9ebfd4bd74..78a03b3e5f 100644
--- a/packages/docs-ui/src/views/paragraph-setting/hook/utils.ts
+++ b/packages/docs-ui/src/views/paragraph-setting/hook/utils.ts
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-import type { DocumentDataModel, IParagraph, ISectionBreak } from '@univerjs/core';
import { ICommandService, IUniverInstanceService, SpacingRule, UniverInstanceType, useDependency } from '@univerjs/core';
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
-import { useEffect, useMemo, useRef, useState } from 'react';
import { getNumberUnitValue, IRenderManagerService } from '@univerjs/engine-render';
+import { useEffect, useMemo, useRef, useState } from 'react';
import { BehaviorSubject } from 'rxjs';
import { bufferTime, filter, map } from 'rxjs/operators';
-import type { IDocParagraphSettingCommandParams } from '../../../commands/commands/doc-paragraph-setting.command';
+import type { DocumentDataModel, IParagraph, ISectionBreak } from '@univerjs/core';
import { DocParagraphSettingCommand } from '../../../commands/commands/doc-paragraph-setting.command';
-import { DocParagraphSettingController } from '../../../controllers/doc-paragraph-setting.controller';
import { findNearestSectionBreak, getParagraphsInRanges } from '../../../commands/commands/list.command';
+import { DocParagraphSettingController } from '../../../controllers/doc-paragraph-setting.controller';
+import type { IDocParagraphSettingCommandParams } from '../../../commands/commands/doc-paragraph-setting.command';
const useDocRanges = () => {
const docSelectionManagerService = useDependency(DocSelectionManagerService);
@@ -89,7 +89,8 @@ export const useCurrentSections = (currentParagraphs: IParagraph[]) => {
}
}
return a;
- }, { map: {}, result: [] } as { map: Record<string, ISectionBreak>; result: ISectionBreak[] }).result;
+ }, { map: {}, result: [] } as { map: Record<string, ISectionBreak>; result: ISectionBreak[] })
+ .result;
return currentSectionBreaks;
};
diff --git a/packages/docs/src/commands/mutations/core-editing.mutation.ts b/packages/docs/src/commands/mutations/core-editing.mutation.ts
index 0073ff5271..1c6304600d 100644
--- a/packages/docs/src/commands/mutations/core-editing.mutation.ts
+++ b/packages/docs/src/commands/mutations/core-editing.mutation.ts
@@ -15,12 +15,12 @@
*/
import { CommandType, IUniverInstanceService, JSONX } from '@univerjs/core';
-import type { IMutation, IMutationCommonParams, JSONXActions, Nullable } from '@univerjs/core';
import { IRenderManagerService, type ITextRangeWithStyle } from '@univerjs/engine-render';
+import type { IMutation, IMutationCommonParams, JSONXActions, Nullable } from '@univerjs/core';
import { DocSelectionManagerService } from '../../services/doc-selection-manager.service';
import { DocSkeletonManagerService } from '../../services/doc-skeleton-manager.service';
-import type { IDocStateChangeInfo } from '../../services/doc-state-emit.service';
import { DocStateEmitService } from '../../services/doc-state-emit.service';
+import type { IDocStateChangeInfo } from '../../services/doc-state-emit.service';
export interface IRichTextEditingMutationParams extends IMutationCommonParams {
unitId: string;
diff --git a/packages/docs/src/commands/mutations/docs-rename.mutation.ts b/packages/docs/src/commands/mutations/docs-rename.mutation.ts
index 53ff91dc4d..2751d59da1 100644
--- a/packages/docs/src/commands/mutations/docs-rename.mutation.ts
+++ b/packages/docs/src/commands/mutations/docs-rename.mutation.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommand } from '@univerjs/core';
import { CommandType, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
+import type { DocumentDataModel, ICommand } from '@univerjs/core';
export interface IDocsRenameMutationParams {
name: string;
diff --git a/packages/docs/src/controllers/custom-range.controller.ts b/packages/docs/src/controllers/custom-range.controller.ts
index 29c911d7be..a176bcfcbd 100644
--- a/packages/docs/src/controllers/custom-range.controller.ts
+++ b/packages/docs/src/controllers/custom-range.controller.ts
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-import type { DocumentDataModel } from '@univerjs/core';
import { Disposable, ICommandService, Inject, IUniverInstanceService, LifecycleStages, OnLifecycle } from '@univerjs/core';
+import type { DocumentDataModel } from '@univerjs/core';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
-import type { ISetTextSelectionsOperationParams } from '../commands/operations/text-selection.operation';
+import { isSegmentIntersects } from '../basics/selection';
import { SetTextSelectionsOperation } from '../commands/operations/text-selection.operation';
import { DocSelectionManagerService } from '../services/doc-selection-manager.service';
-import { isSegmentIntersects } from '../basics/selection';
+import type { ISetTextSelectionsOperationParams } from '../commands/operations/text-selection.operation';
@OnLifecycle(LifecycleStages.Ready, DocCustomRangeController)
export class DocCustomRangeController extends Disposable {
diff --git a/packages/docs/src/doc-plugin.ts b/packages/docs/src/doc-plugin.ts
index acd2d39896..fe74745cf0 100644
--- a/packages/docs/src/doc-plugin.ts
+++ b/packages/docs/src/doc-plugin.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { Dependency, ICommand } from '@univerjs/core';
import {
ICommandService,
IConfigService,
@@ -23,13 +22,14 @@ import {
Plugin,
UniverInstanceType,
} from '@univerjs/core';
+import type { Dependency, ICommand } from '@univerjs/core';
import { RichTextEditingMutation } from './commands/mutations/core-editing.mutation';
import { DocsRenameMutation } from './commands/mutations/docs-rename.mutation';
import { SetTextSelectionsOperation } from './commands/operations/text-selection.operation';
-import { DocSelectionManagerService } from './services/doc-selection-manager.service';
+import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
import { DocCustomRangeController } from './controllers/custom-range.controller';
+import { DocSelectionManagerService } from './services/doc-selection-manager.service';
import { DocStateEmitService } from './services/doc-state-emit.service';
-import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
export interface IUniverDocsConfig {
hasScroll?: boolean;
diff --git a/packages/docs/src/index.ts b/packages/docs/src/index.ts
index aa8138890d..6dab41456a 100644
--- a/packages/docs/src/index.ts
+++ b/packages/docs/src/index.ts
@@ -15,22 +15,22 @@
*/
export { isSegmentIntersects } from './basics/selection';
-export { type IUniverDocsConfig, UniverDocsPlugin } from './doc-plugin';
-
-export { DocInterceptorService } from './services/doc-interceptor/doc-interceptor.service';
-export { DOC_INTERCEPTOR_POINT } from './services/doc-interceptor/interceptor-const';
-export { DocSkeletonManagerService } from './services/doc-skeleton-manager.service';
-export { DocSelectionManagerService } from './services/doc-selection-manager.service';
-export type { IDocStateChangeParams, IDocStateChangeInfo } from './services/doc-state-emit.service';
-export { DocStateEmitService } from './services/doc-state-emit.service';
-
// #region - all commands
export {
- RichTextEditingMutation,
type IRichTextEditingMutationParams,
+ RichTextEditingMutation,
} from './commands/mutations/core-editing.mutation';
+
export {
- SetTextSelectionsOperation,
type ISetTextSelectionsOperationParams,
+ SetTextSelectionsOperation,
} from './commands/operations/text-selection.operation';
+export { type IUniverDocsConfig, UniverDocsPlugin } from './doc-plugin';
+export { DocInterceptorService } from './services/doc-interceptor/doc-interceptor.service';
+export { DOC_INTERCEPTOR_POINT } from './services/doc-interceptor/interceptor-const';
+export { DocSelectionManagerService } from './services/doc-selection-manager.service';
+export { DocSkeletonManagerService } from './services/doc-skeleton-manager.service';
+
+export type { IDocStateChangeInfo, IDocStateChangeParams } from './services/doc-state-emit.service';
+export { DocStateEmitService } from './services/doc-state-emit.service';
// #endregion
diff --git a/packages/docs/src/services/doc-selection-manager.service.ts b/packages/docs/src/services/doc-selection-manager.service.ts
index d675909d19..9b00d8f4ea 100644
--- a/packages/docs/src/services/doc-selection-manager.service.ts
+++ b/packages/docs/src/services/doc-selection-manager.service.ts
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-import type { Nullable } from '@univerjs/core';
import { ICommandService, RxDisposable } from '@univerjs/core';
+import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE } from '@univerjs/engine-render';
+import { BehaviorSubject } from 'rxjs';
+import type { Nullable } from '@univerjs/core';
import type {
IDocSelectionInnerParam,
IRectRangeWithStyle,
ISuccinctDocRangeParam,
ITextRangeWithStyle,
} from '@univerjs/engine-render';
-import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE } from '@univerjs/engine-render';
-import { BehaviorSubject } from 'rxjs';
import { SetTextSelectionsOperation } from '../commands/operations/text-selection.operation';
interface IDocSelectionManagerSearchParam {
diff --git a/packages/docs/src/services/doc-state-emit.service.ts b/packages/docs/src/services/doc-state-emit.service.ts
index 307f4709c9..8763ac6c23 100644
--- a/packages/docs/src/services/doc-state-emit.service.ts
+++ b/packages/docs/src/services/doc-state-emit.service.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { JSONXActions, Nullable } from '@univerjs/core';
import { RxDisposable } from '@univerjs/core';
-import type { ITextRangeWithStyle } from '@univerjs/engine-render';
import { BehaviorSubject } from 'rxjs';
+import type { JSONXActions, Nullable } from '@univerjs/core';
+import type { ITextRangeWithStyle } from '@univerjs/engine-render';
interface IDocChangeState {
actions: JSONXActions;
diff --git a/packages/engine-formula/src/engine/value-object/array-value-object.ts b/packages/engine-formula/src/engine/value-object/array-value-object.ts
index 3766810f07..19454fde9f 100644
--- a/packages/engine-formula/src/engine/value-object/array-value-object.ts
+++ b/packages/engine-formula/src/engine/value-object/array-value-object.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { Nullable } from '@univerjs/core';
import { isRealNum } from '@univerjs/core';
+import type { Nullable } from '@univerjs/core';
import { BooleanValue } from '../../basics/common';
import { ERROR_TYPE_SET, ErrorType } from '../../basics/error-type';
@@ -23,9 +23,9 @@ import { CELL_INVERTED_INDEX_CACHE } from '../../basics/inverted-index-cache';
import { $ARRAY_VALUE_REGEX } from '../../basics/regex';
import { compareToken } from '../../basics/token';
import { ArrayBinarySearchType, ArrayOrderSearchType, getCompare } from '../utils/compare';
-import type { callbackMapFnType, IArrayValueObject } from './base-value-object';
import { BaseValueObject, ErrorValueObject } from './base-value-object';
import { BooleanValueObject, createBooleanValueObjectByRawValue, createNumberValueObjectByRawValue, createStringValueObjectByRawValue, NullValueObject, NumberValueObject, StringValueObject } from './primitive-object';
+import type { callbackMapFnType, IArrayValueObject } from './base-value-object';
enum BatchOperatorType {
MINUS,
diff --git a/packages/engine-formula/src/functions/logical/function-map.ts b/packages/engine-formula/src/functions/logical/function-map.ts
index 6398e83c13..2f7b9afe49 100644
--- a/packages/engine-formula/src/functions/logical/function-map.ts
+++ b/packages/engine-formula/src/functions/logical/function-map.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { FUNCTION_NAMES_LOGICAL } from './function-names';
import { And } from './and';
import { Bycol } from './bycol';
import { Byrow } from './byrow';
import { False } from './false';
+import { FUNCTION_NAMES_LOGICAL } from './function-names';
import { If } from './if';
import { Iferror } from './iferror';
import { Ifna } from './ifna';
diff --git a/packages/engine-render/src/components/docs/layout/doc-skeleton.ts b/packages/engine-render/src/components/docs/layout/doc-skeleton.ts
index 8a310d12a7..6b4c8d287d 100644
--- a/packages/engine-render/src/components/docs/layout/doc-skeleton.ts
+++ b/packages/engine-render/src/components/docs/layout/doc-skeleton.ts
@@ -14,29 +14,29 @@
* limitations under the License.
*/
-import type { ColumnSeparatorType, ISectionColumnProperties, LocaleService, Nullable } from '@univerjs/core';
import { PRESET_LIST_TYPE, SectionType } from '@univerjs/core';
import { Subject } from 'rxjs';
+import type { ColumnSeparatorType, ISectionColumnProperties, LocaleService, Nullable } from '@univerjs/core';
+import { DocumentSkeletonPageType, GlyphType, LineType, PageLayoutType } from '../../../basics/i-document-skeleton-cached';
+import { Skeleton } from '../../skeleton';
+import { Liquid } from '../liquid';
+import { DocumentEditArea } from '../view-model/document-view-model';
+import { dealWithSection } from './block/section';
+import { Hyphen } from './hyphenation/hyphen';
+import { LanguageDetector } from './hyphenation/language-detector';
+import { createSkeletonPage } from './model/page';
+import { createSkeletonSection } from './model/section';
+import { getLastPage, getNullSkeleton, getPageFromPath, prepareSectionBreakConfig, resetContext, setPageParent, updateBlockIndex, updateInlineDrawingCoords } from './tools';
import type {
IDocumentSkeletonCached,
IDocumentSkeletonGlyph,
IDocumentSkeletonPage,
ISkeletonResourceReference,
} from '../../../basics/i-document-skeleton-cached';
-import { DocumentSkeletonPageType, GlyphType, LineType, PageLayoutType } from '../../../basics/i-document-skeleton-cached';
import type { IDocsConfig, INodeInfo, INodePosition, INodeSearch } from '../../../basics/interfaces';
import type { IViewportInfo, Vector2 } from '../../../basics/vector2';
-import { Skeleton } from '../../skeleton';
-import { Liquid } from '../liquid';
import type { DocumentViewModel } from '../view-model/document-view-model';
-import { DocumentEditArea } from '../view-model/document-view-model';
-import { getLastPage, getNullSkeleton, getPageFromPath, prepareSectionBreakConfig, resetContext, setPageParent, updateBlockIndex, updateInlineDrawingCoords } from './tools';
import type { ILayoutContext } from './tools';
-import { createSkeletonSection } from './model/section';
-import { dealWithSection } from './block/section';
-import { createSkeletonPage } from './model/page';
-import { Hyphen } from './hyphenation/hyphen';
-import { LanguageDetector } from './hyphenation/language-detector';
export enum DocumentSkeletonState {
PENDING = 'pending',
diff --git a/packages/engine-render/src/components/docs/layout/tools.ts b/packages/engine-render/src/components/docs/layout/tools.ts
index 25194238fb..353cbf39f0 100644
--- a/packages/engine-render/src/components/docs/layout/tools.ts
+++ b/packages/engine-render/src/components/docs/layout/tools.ts
@@ -14,18 +14,6 @@
* limitations under the License.
*/
-import type {
- DocumentDataModel,
- IBullet,
- INumberUnit,
- IObjectPositionH,
- IObjectPositionV,
- IParagraph,
- IParagraphStyle,
- ISectionBreak,
- ITextStyle,
- Nullable,
-} from '@univerjs/core';
import {
AlignTypeH,
AlignTypeV,
@@ -44,8 +32,25 @@ import {
VerticalAlign,
WrapStrategy,
} from '@univerjs/core';
+import type {
+ DocumentDataModel,
+ IBullet,
+ INumberUnit,
+ IObjectPositionH,
+ IObjectPositionV,
+ IParagraph,
+ IParagraphStyle,
+ ISectionBreak,
+ ITextStyle,
+ Nullable,
+} from '@univerjs/core';
import { DEFAULT_DOCUMENT_FONTSIZE } from '../../../basics/const';
+import { GlyphType } from '../../../basics/i-document-skeleton-cached';
+import { getFontStyleString, isFunction } from '../../../basics/tools';
+import { updateInlineDrawingPosition } from './block/paragraph/layout-ruler';
+import { getCustomDecorationStyle } from './style/custom-decoration';
+import { getCustomRangeStyle } from './style/custom-range';
import type {
IDocumentSkeletonCached,
IDocumentSkeletonColumn,
@@ -58,16 +63,11 @@ import type {
IDocumentSkeletonSection,
ISkeletonResourceReference,
} from '../../../basics/i-document-skeleton-cached';
-import { GlyphType } from '../../../basics/i-document-skeleton-cached';
import type { IDocsConfig, IParagraphConfig, ISectionBreakConfig } from '../../../basics/interfaces';
-import { getFontStyleString, isFunction } from '../../../basics/tools';
import type { DataStreamTreeNode } from '../view-model/data-stream-tree-node';
import type { DocumentViewModel } from '../view-model/document-view-model';
import type { Hyphen } from './hyphenation/hyphen';
import type { LanguageDetector } from './hyphenation/language-detector';
-import { getCustomDecorationStyle } from './style/custom-decoration';
-import { getCustomRangeStyle } from './style/custom-range';
-import { updateInlineDrawingPosition } from './block/paragraph/layout-ruler';
export function getLastPage(pages: IDocumentSkeletonPage[]) {
return pages[pages.length - 1];
diff --git a/packages/engine-render/src/components/sheets/extensions/border.ts b/packages/engine-render/src/components/sheets/extensions/border.ts
index f844583b6e..3382923237 100644
--- a/packages/engine-render/src/components/sheets/extensions/border.ts
+++ b/packages/engine-render/src/components/sheets/extensions/border.ts
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-import type { IRange, IScale, ObjectMatrix } from '@univerjs/core';
import { BorderStyleTypes } from '@univerjs/core';
+import type { IRange, IScale, ObjectMatrix } from '@univerjs/core';
import { BORDER_TYPE, COLOR_BLACK_RGB, FIX_ONE_PIXEL_BLUR_OFFSET } from '../../../basics/const';
import { drawDiagonalLineByBorderType, drawLineByBorderType, getLineWidth, setLineType } from '../../../basics/draw';
-import type { UniverRenderingContext } from '../../../context';
import { SpreadsheetExtensionRegistry } from '../../extension';
+import { SheetExtension } from './sheet-extension';
+import type { UniverRenderingContext } from '../../../context';
import type { BorderCacheItem } from '../interfaces';
import type { SpreadsheetSkeleton } from '../sheet-skeleton';
-import { SheetExtension } from './sheet-extension';
const UNIQUE_KEY = 'DefaultBorderExtension';
diff --git a/packages/engine-render/src/components/sheets/extensions/custom.ts b/packages/engine-render/src/components/sheets/extensions/custom.ts
index 62c8c449c3..009503227e 100644
--- a/packages/engine-render/src/components/sheets/extensions/custom.ts
+++ b/packages/engine-render/src/components/sheets/extensions/custom.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import type { IRange, IScale } from '@univerjs/core';
import { Range, sortRules } from '@univerjs/core';
-import type { UniverRenderingContext } from '../../../context';
-import type { SpreadsheetSkeleton } from '../sheet-skeleton';
+import type { IRange, IScale } from '@univerjs/core';
import { SpreadsheetExtensionRegistry } from '../../extension';
import { SheetExtension } from './sheet-extension';
+import type { UniverRenderingContext } from '../../../context';
+import type { SpreadsheetSkeleton } from '../sheet-skeleton';
const UNIQUE_KEY = 'DefaultCustomExtension';
diff --git a/packages/engine-render/src/components/sheets/extensions/font.ts b/packages/engine-render/src/components/sheets/extensions/font.ts
index 001925b546..c932ce29b4 100644
--- a/packages/engine-render/src/components/sheets/extensions/font.ts
+++ b/packages/engine-render/src/components/sheets/extensions/font.ts
@@ -16,20 +16,20 @@
/* eslint-disable max-lines-per-function */
-import type { ICellData, IRange, IScale, ObjectMatrix } from '@univerjs/core';
import { HorizontalAlign, WrapStrategy } from '@univerjs/core';
+import type { ICellData, IRange, IScale, ObjectMatrix } from '@univerjs/core';
import { FIX_ONE_PIXEL_BLUR_OFFSET } from '../../../basics';
import { VERTICAL_ROTATE_ANGLE } from '../../../basics/text-rotation';
import { expandRangeIfIntersects, inRowViewRanges, inViewRanges } from '../../../basics/tools';
+import { SpreadsheetExtensionRegistry } from '../../extension';
+import { getDocsSkeletonPageSize, type SpreadsheetSkeleton } from '../sheet-skeleton';
+import { SheetExtension } from './sheet-extension';
import type { UniverRenderingContext } from '../../../context';
import type { Documents } from '../../docs/document';
import type { IDrawInfo } from '../../extension';
-import { SpreadsheetExtensionRegistry } from '../../extension';
import type { IFontCacheItem } from '../interfaces';
import type { SheetComponent } from '../sheet-component';
-import { getDocsSkeletonPageSize, type SpreadsheetSkeleton } from '../sheet-skeleton';
-import { SheetExtension } from './sheet-extension';
const UNIQUE_KEY = 'DefaultFontExtension';
diff --git a/packages/engine-render/src/components/sheets/extensions/marker.ts b/packages/engine-render/src/components/sheets/extensions/marker.ts
index 901aff2c62..1e020905a1 100644
--- a/packages/engine-render/src/components/sheets/extensions/marker.ts
+++ b/packages/engine-render/src/components/sheets/extensions/marker.ts
@@ -16,10 +16,10 @@
import { Range } from '@univerjs/core';
import type { IRange, IScale } from '@univerjs/core';
-import type { UniverRenderingContext } from '../../../context';
-import type { SpreadsheetSkeleton } from '../sheet-skeleton';
import { SpreadsheetExtensionRegistry } from '../../extension';
import { SheetExtension } from './sheet-extension';
+import type { UniverRenderingContext } from '../../../context';
+import type { SpreadsheetSkeleton } from '../sheet-skeleton';
const UNIQUE_KEY = 'DefaultMarkerExtension';
diff --git a/packages/engine-render/src/index.ts b/packages/engine-render/src/index.ts
index 65f1ad2615..e3496cc645 100644
--- a/packages/engine-render/src/index.ts
+++ b/packages/engine-render/src/index.ts
@@ -16,37 +16,37 @@
export * from './base-object';
export * from './basics';
+export { getOffsetRectForDom } from './basics/position';
export * from './canvas';
export * from './components';
+export { DocBackground } from './components/docs/doc-background';
+export { Documents } from './components/docs/document';
+export type { IPageRenderConfig } from './components/docs/document';
+export type { IDocumentOffsetConfig } from './components/docs/document';
+export { getTableIdAndSliceIndex } from './components/docs/layout/block/table';
+export { DocumentSkeleton } from './components/docs/layout/doc-skeleton';
+export type { IFindNodeRestrictions } from './components/docs/layout/doc-skeleton';
+export { getCharSpaceApply, getLastLine, getNumberUnitValue, getPageFromPath, glyphIterator, lineIterator } from './components/docs/layout/tools';
+export { Liquid } from './components/docs/liquid';
+export { DataStreamTreeNode } from './components/docs/view-model/data-stream-tree-node';
+export { DocumentViewModel } from './components/docs/view-model/document-view-model';
+export { DocumentEditArea } from './components/docs/view-model/document-view-model';
+
+export { parseDataStreamToTree } from './components/docs/view-model/document-view-model';
+export { DEFAULT_PADDING_DATA } from './components/sheets/sheet-skeleton';
export * from './context';
export * from './custom';
export * from './engine';
export * from './group';
export * from './layer';
export { IRenderingEngine, UniverRenderEnginePlugin } from './render-engine';
-export { type RenderComponentType, IRenderManagerService, RenderManagerService } from './render-manager/render-manager.service';
-export { RenderUnit, type IRender, type IRenderModule, type IRenderContext } from './render-manager/render-unit';
+export { IRenderManagerService, type RenderComponentType, RenderManagerService } from './render-manager/render-manager.service';
+export { type IRender, type IRenderContext, type IRenderModule, RenderUnit } from './render-manager/render-unit';
export * from './scene';
+export { type IChangeObserverConfig } from './scene.transformer';
export * from './scene-viewer';
export * from './scroll-timer';
export * from './shape';
-export * from './viewport';
-
-export { DocumentViewModel } from './components/docs/view-model/document-view-model';
-export { Liquid } from './components/docs/liquid';
-export { Documents } from './components/docs/document';
-export { DocBackground } from './components/docs/doc-background';
-export type { IPageRenderConfig } from './components/docs/document';
-export { DocumentSkeleton } from './components/docs/layout/doc-skeleton';
export { ThinEngine } from './thin-engine';
-export { type IChangeObserverConfig } from './scene.transformer';
-export { DEFAULT_PADDING_DATA } from './components/sheets/sheet-skeleton';
-export { DocumentEditArea } from './components/docs/view-model/document-view-model';
-export { lineIterator, glyphIterator, getPageFromPath, getLastLine, getNumberUnitValue, getCharSpaceApply } from './components/docs/layout/tools';
-export { DataStreamTreeNode } from './components/docs/view-model/data-stream-tree-node';
-export { parseDataStreamToTree } from './components/docs/view-model/document-view-model';
-export type { IDocumentOffsetConfig } from './components/docs/document';
-export { getTableIdAndSliceIndex } from './components/docs/layout/block/table';
export { ThinScene } from './thin-scene';
-export { getOffsetRectForDom } from './basics/position';
-export type { IFindNodeRestrictions } from './components/docs/layout/doc-skeleton';
+export * from './viewport';
diff --git a/packages/engine-render/src/viewport.ts b/packages/engine-render/src/viewport.ts
index ead83de555..abcbb4650e 100644
--- a/packages/engine-render/src/viewport.ts
+++ b/packages/engine-render/src/viewport.ts
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-import type { EventState, IPosition, IRange, Nullable } from '@univerjs/core';
import { EventSubject, Tools } from '@univerjs/core';
+import type { EventState, IPosition, IRange, Nullable } from '@univerjs/core';
-import type { BaseObject } from './base-object';
import { FIX_ONE_PIXEL_BLUR_OFFSET, RENDER_CLASS_TYPE } from './basics/const';
-import type { IWheelEvent } from './basics/i-events';
import { PointerInput } from './basics/i-events';
import { fixLineWidthByScale, toPx } from './basics/tools';
import { Transform } from './basics/transform';
-import type { IBoundRectNoAngle, IViewportInfo } from './basics/vector2';
import { Vector2 } from './basics/vector2';
import { subtractViewportRange } from './basics/viewport-subtract';
import { Canvas as UniverCanvas } from './canvas';
+import type { BaseObject } from './base-object';
+import type { IWheelEvent } from './basics/i-events';
+import type { IBoundRectNoAngle, IViewportInfo } from './basics/vector2';
import type { UniverRenderingContext } from './context';
import type { BaseScrollBar } from './shape/base-scroll-bar';
import type { ThinScene } from './thin-scene';
diff --git a/packages/facade/src/apis/__tests__/create-test-bed.ts b/packages/facade/src/apis/__tests__/create-test-bed.ts
index afd00b1089..97fad4c0d4 100644
--- a/packages/facade/src/apis/__tests__/create-test-bed.ts
+++ b/packages/facade/src/apis/__tests__/create-test-bed.ts
@@ -57,7 +57,7 @@ import { ISheetSelectionRenderService, SheetRenderController, SheetSelectionRend
import { IPlatformService, IShortcutService, PlatformService, ShortcutService } from '@univerjs/ui';
import { ConditionalFormattingFormulaService, ConditionalFormattingRuleModel, ConditionalFormattingService, ConditionalFormattingViewModel } from '@univerjs/sheets-conditional-formatting';
import { UniverDataValidationPlugin } from '@univerjs/data-validation';
-import { DataValidationCacheService, DataValidationCustomFormulaService, DataValidationFormulaService, DataValidationModel, SheetDataValidationManager, SheetsDataValidationValidatorService } from '@univerjs/sheets-data-validation';
+import { DataValidationCacheService, DataValidationCustomFormulaService, DataValidationFormulaService, SheetDataValidationModel, SheetsDataValidationValidatorService } from '@univerjs/sheets-data-validation';
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
import { SheetsThreadCommentModel } from '@univerjs/sheets-thread-comment';
import { IThreadCommentDataSourceService, ThreadCommentDataSourceService, ThreadCommentModel } from '@univerjs/thread-comment';
@@ -184,6 +184,7 @@ export function createFacadeTestBed(workbookData?: IWorkbookData, dependencies?:
[RegisterOtherFormulaService],
[IActiveDirtyManagerService, { useClass: ActiveDirtyManagerService }],
[SheetsDataValidationValidatorService],
+ [SheetDataValidationModel],
// sheets filter
// comment
@@ -220,16 +221,6 @@ export function createFacadeTestBed(workbookData?: IWorkbookData, dependencies?:
logService.setLogLevel(LogLevel.SILENT); // NOTE: change this to `LogLevel.VERBOSE` to debug tests via logs
// init data validation
- const createSheetDataValidationManager = (unitId: string, subUnitId: string) => {
- return new SheetDataValidationManager(
- unitId,
- subUnitId,
- injector
- );
- };
- const dataValidationModel = injector.get(DataValidationModel);
- dataValidationModel.setManagerCreator(createSheetDataValidationManager);
-
const univerAPI = FUniver.newAPI(injector);
return {
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 7e01a9880e..3c2fffef30 100644
--- a/packages/facade/src/apis/docs/__tests__/create-test-bed.ts
+++ b/packages/facade/src/apis/docs/__tests__/create-test-bed.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { Dependency, DocumentDataModel, IDocumentData } from '@univerjs/core';
import {
ILogService,
Inject,
@@ -26,11 +25,12 @@ import {
Univer,
UniverInstanceType,
} from '@univerjs/core';
-import enUS from '@univerjs/sheets-formula/locale/en-US';
-import zhCN from '@univerjs/sheets-formula/locale/zh-CN';
import { DocSelectionManagerService, DocSkeletonManagerService, DocStateEmitService } from '@univerjs/docs';
-import { IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';
import { DocIMEInputManagerService, DocsRenderService, DocStateChangeManagerService } from '@univerjs/docs-ui';
+import { IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';
+import enUS from '@univerjs/sheets-formula/locale/en-US';
+import zhCN from '@univerjs/sheets-formula/locale/zh-CN';
+import type { Dependency, DocumentDataModel, IDocumentData } from '@univerjs/core';
import { FUniver } from '../../facade';
diff --git a/packages/facade/src/apis/docs/__tests__/f-document.spec.ts b/packages/facade/src/apis/docs/__tests__/f-document.spec.ts
index c864985543..94aae44e2f 100644
--- a/packages/facade/src/apis/docs/__tests__/f-document.spec.ts
+++ b/packages/facade/src/apis/docs/__tests__/f-document.spec.ts
@@ -15,13 +15,13 @@
*/
import { ICommandService } from '@univerjs/core';
-import type { Injector } from '@univerjs/core';
-import { beforeEach, describe, expect, it } from 'vitest';
-
import { RichTextEditingMutation } from '@univerjs/docs';
import { InsertCommand } from '@univerjs/docs-ui';
-import type { FUniver } from '../../facade';
+
+import { beforeEach, describe, expect, it } from 'vitest';
+import type { Injector } from '@univerjs/core';
import { createTestBed } from './create-test-bed';
+import type { FUniver } from '../../facade';
describe('Test FDocument', () => {
let get: Injector['get'];
diff --git a/packages/facade/src/apis/docs/f-document.ts b/packages/facade/src/apis/docs/f-document.ts
index 430b244346..5f3fbe6b26 100644
--- a/packages/facade/src/apis/docs/f-document.ts
+++ b/packages/facade/src/apis/docs/f-document.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { DocumentDataModel, IDocumentData } from '@univerjs/core';
import { DOC_RANGE_TYPE, ICommandService,
Inject,
Injector,
@@ -26,6 +25,7 @@ import { DOC_RANGE_TYPE, ICommandService,
} from '@univerjs/core';
import { DocSelectionRenderService, InsertCommand } from '@univerjs/docs-ui';
import { IRenderManagerService } from '@univerjs/engine-render';
+import type { DocumentDataModel, IDocumentData } from '@univerjs/core';
export class FDocument {
readonly id: string;
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 3a55fb0908..3af5d1762a 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
@@ -57,7 +57,7 @@ import { ISheetSelectionRenderService, SheetRenderController, SheetSelectionRend
import { IPlatformService, IShortcutService, PlatformService, ShortcutService } from '@univerjs/ui';
import { ConditionalFormattingFormulaService, ConditionalFormattingRuleModel, ConditionalFormattingService, ConditionalFormattingViewModel } from '@univerjs/sheets-conditional-formatting';
import { UniverDataValidationPlugin } from '@univerjs/data-validation';
-import { DataValidationCacheService, DataValidationCustomFormulaService, DataValidationFormulaService, DataValidationModel, SheetDataValidationManager, SheetsDataValidationValidatorService } from '@univerjs/sheets-data-validation';
+import { DataValidationCacheService, DataValidationCustomFormulaService, DataValidationFormulaService, SheetDataValidationModel, SheetsDataValidationValidatorService } from '@univerjs/sheets-data-validation';
import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';
import { FUniver } from '../../facade';
@@ -180,6 +180,7 @@ export function createWorksheetTestBed(workbookData?: IWorkbookData, dependencie
[RegisterOtherFormulaService],
[IActiveDirtyManagerService, { useClass: ActiveDirtyManagerService }],
[SheetsDataValidationValidatorService],
+ [SheetDataValidationModel],
// sheets filter
] as Dependency[]).forEach((d) => {
@@ -211,17 +212,6 @@ export function createWorksheetTestBed(workbookData?: IWorkbookData, dependencie
const logService = injector.get(ILogService);
logService.setLogLevel(LogLevel.SILENT); // NOTE: change this to `LogLevel.VERBOSE` to debug tests via logs
- // init data validation
- const createSheetDataValidationManager = (unitId: string, subUnitId: string) => {
- return new SheetDataValidationManager(
- unitId,
- subUnitId,
- injector
- );
- };
- const dataValidationModel = injector.get(DataValidationModel);
- dataValidationModel.setManagerCreator(createSheetDataValidationManager);
-
const univerAPI = FUniver.newAPI(injector);
return {
diff --git a/packages/facade/src/apis/sheets/f-workbook.ts b/packages/facade/src/apis/sheets/f-workbook.ts
index 87f115d2d1..bf2229cd5b 100644
--- a/packages/facade/src/apis/sheets/f-workbook.ts
+++ b/packages/facade/src/apis/sheets/f-workbook.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { CommandListener, ICommandInfo, IDisposable, IExecutionOptions, IRange, ISheetDataValidationRule, IWorkbookData, Nullable, ObjectMatrix, Workbook } from '@univerjs/core';
import {
ICommandService,
ILogService,
@@ -29,22 +28,23 @@ import {
UndoCommand,
UniverInstanceType,
} from '@univerjs/core';
+import { getPrimaryForRange, InsertSheetCommand, RemoveSheetCommand, SetSelectionsOperation, SetWorksheetActiveOperation, SheetsSelectionsService, WorkbookEditablePermission } from '@univerjs/sheets';
+import { AddSheetDataValidationCommand, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, SheetDataValidationModel, SheetsDataValidationValidatorService, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand } from '@univerjs/sheets-data-validation';
+import { AddCommentCommand, DeleteCommentCommand, DeleteCommentTreeCommand, ThreadCommentModel, UpdateCommentCommand } from '@univerjs/thread-comment';
+import { filter } from 'rxjs';
+import type { CommandListener, ICommandInfo, IDisposable, IExecutionOptions, IRange, IWorkbookData, Nullable, ObjectMatrix, Workbook } from '@univerjs/core';
+import type { IRuleChange, IValidStatusChange } from '@univerjs/data-validation';
+import type { IUpdateCommandParams } from '@univerjs/docs-ui';
import type {
ISetSelectionsOperationParams,
ISheetCommandSharedParams,
} from '@univerjs/sheets';
-import { getPrimaryForRange, InsertSheetCommand, RemoveSheetCommand, SetSelectionsOperation, SetWorksheetActiveOperation, SheetsSelectionsService, WorkbookEditablePermission } from '@univerjs/sheets';
-import type { ICanvasFloatDom } from '@univerjs/sheets-drawing-ui';
import type { IAddSheetDataValidationCommandParams, IDataValidationResCache, IRemoveSheetAllDataValidationCommandParams, IRemoveSheetDataValidationCommandParams, IUpdateSheetDataValidationOptionsCommandParams, IUpdateSheetDataValidationRangeCommandParams, IUpdateSheetDataValidationSettingCommandParams } from '@univerjs/sheets-data-validation';
-import { AddSheetDataValidationCommand, DataValidationModel, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, SheetsDataValidationValidatorService, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand } from '@univerjs/sheets-data-validation';
-import type { IRuleChange, IValidStatusChange } from '@univerjs/data-validation';
+import type { ICanvasFloatDom } from '@univerjs/sheets-drawing-ui';
import type { CommentUpdate, IAddCommentCommandParams, IDeleteCommentCommandParams } from '@univerjs/thread-comment';
-import { AddCommentCommand, DeleteCommentCommand, DeleteCommentTreeCommand, ThreadCommentModel, UpdateCommentCommand } from '@univerjs/thread-comment';
-import { filter } from 'rxjs';
-import type { IUpdateCommandParams } from '@univerjs/docs-ui';
-import type { IFComponentKey } from './utils';
-import { FWorksheet } from './f-worksheet';
import { FRange } from './f-range';
+import { FWorksheet } from './f-worksheet';
+import type { IFComponentKey } from './utils';
export interface IFICanvasFloatDom extends Omit<ICanvasFloatDom, 'componentKey' | 'unitId' | 'subUnitId'>, IFComponentKey {
@@ -67,8 +67,8 @@ export class FWorkbook {
this.id = this._workbook.getUnitId();
}
- private get _dataValidationModel(): DataValidationModel {
- return this._injector.get(DataValidationModel);
+ private get _dataValidationModel(): SheetDataValidationModel {
+ return this._injector.get(SheetDataValidationModel);
}
private get _threadCommentModel(): ThreadCommentModel {
@@ -368,7 +368,7 @@ export class FWorkbook {
* @param callback Callback function that will be called when the event is fired
* @returns A disposable object that can be used to unsubscribe from the event
*/
- onDataValidationChange(callback: (ruleChange: IRuleChange<ISheetDataValidationRule>) => void): IDisposable {
+ onDataValidationChange(callback: (ruleChange: IRuleChange) => void): IDisposable {
return toDisposable(this._dataValidationModel.ruleChange$.pipe(filter((change) => change.unitId === this._workbook.getUnitId())).subscribe(callback));
}
diff --git a/packages/sheets-conditional-formatting/src/render/data-bar.render.ts b/packages/sheets-conditional-formatting/src/render/data-bar.render.ts
index 2b7516a4e5..e0aa701026 100644
--- a/packages/sheets-conditional-formatting/src/render/data-bar.render.ts
+++ b/packages/sheets-conditional-formatting/src/render/data-bar.render.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { IRange, IScale } from '@univerjs/core';
import { Range } from '@univerjs/core';
-import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
import { FIX_ONE_PIXEL_BLUR_OFFSET, SheetExtension, SpreadsheetExtensionRegistry } from '@univerjs/engine-render';
+import type { IRange, IScale } from '@univerjs/core';
+import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
import type { IDataBarCellData } from './type';
export const dataBarUKey = 'sheet-conditional-rule-data-bar';
diff --git a/packages/sheets-conditional-formatting/src/render/icon.render.ts b/packages/sheets-conditional-formatting/src/render/icon.render.ts
index bd74e152dc..0bb374aab5 100644
--- a/packages/sheets-conditional-formatting/src/render/icon.render.ts
+++ b/packages/sheets-conditional-formatting/src/render/icon.render.ts
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-import type { IRange, IScale } from '@univerjs/core';
import { Range } from '@univerjs/core';
-import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
import { SheetExtension, SpreadsheetExtensionRegistry } from '@univerjs/engine-render';
-import type { IIconType } from '../models/icon-map';
+import type { IRange, IScale } from '@univerjs/core';
+import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
import { EMPTY_ICON_TYPE, iconMap } from '../models/icon-map';
+import type { IIconType } from '../models/icon-map';
import type { IIconSetCellData } from './type';
export const IconUKey = 'sheet-conditional-rule-icon';
diff --git a/packages/sheets-data-validation/package.json b/packages/sheets-data-validation/package.json
index b5fc161206..cf9a17e480 100644
--- a/packages/sheets-data-validation/package.json
+++ b/packages/sheets-data-validation/package.json
@@ -71,6 +71,7 @@
"@univerjs/engine-render": "workspace:*",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-formula": "workspace:*",
+ "@univerjs/sheets-numfmt": "workspace:*",
"@univerjs/sheets-ui": "workspace:*",
"@univerjs/ui": "workspace:*",
"clsx": ">=2.0.0",
@@ -90,6 +91,7 @@
"@univerjs/protocol": "0.1.39-alpha.15",
"@univerjs/sheets": "workspace:*",
"@univerjs/sheets-formula": "workspace:*",
+ "@univerjs/sheets-numfmt": "workspace:*",
"@univerjs/sheets-ui": "workspace:*",
"@univerjs/ui": "workspace:*",
"clsx": "^2.1.1",
diff --git a/packages/sheets-data-validation/src/commands/commands/data-validation.command.ts b/packages/sheets-data-validation/src/commands/commands/data-validation.command.ts
index 79111f7c0b..7a5ec37ff7 100644
--- a/packages/sheets-data-validation/src/commands/commands/data-validation.command.ts
+++ b/packages/sheets-data-validation/src/commands/commands/data-validation.command.ts
@@ -15,16 +15,17 @@
*/
import { CommandType, DataValidationType, ICommandService, IUndoRedoService, IUniverInstanceService, ObjectMatrix, Range, sequenceExecute, sequenceExecuteAsync, Tools } from '@univerjs/core';
-import type { CellValue, IAccessor, ICellData, ICommand, IDataValidationRuleBase, IDataValidationRuleOptions, IMutationInfo, IRange, ISheetDataValidationRule, Nullable } from '@univerjs/core';
-import type { DataValidationChangeSource, IAddDataValidationMutationParams, IUpdateDataValidationMutationParams } from '@univerjs/data-validation';
-import { AddDataValidationMutation, createDefaultNewRule, DataValidationModel, DataValidatorRegistryService, getRuleOptions, getRuleSetting, RemoveDataValidationMutation, UpdateDataValidationMutation, UpdateRuleType } from '@univerjs/data-validation';
-import type { ISetRangeValuesMutationParams, ISheetCommandSharedParams } from '@univerjs/sheets';
+import { AddDataValidationMutation, DataValidatorRegistryService, getRuleOptions, getRuleSetting, RemoveDataValidationMutation, UpdateDataValidationMutation, UpdateRuleType } from '@univerjs/data-validation';
import { getSheetCommandTarget, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory } from '@univerjs/sheets';
-import type { SheetDataValidationManager } from '../../models/sheet-data-validation-manager';
+import type { CellValue, IAccessor, ICellData, ICommand, IDataValidationRuleBase, IDataValidationRuleOptions, IMutationInfo, Injector, IRange, ISheetDataValidationRule, Nullable } from '@univerjs/core';
+import type { DataValidationChangeSource, IAddDataValidationMutationParams, IRemoveDataValidationMutationParams, IUpdateDataValidationMutationParams } from '@univerjs/data-validation';
+import type { ISetRangeValuesMutationParams, ISheetCommandSharedParams } from '@univerjs/sheets';
+import { SheetDataValidationModel } from '../../models/sheet-data-validation-model';
+import { createDefaultNewRule } from '../../utils/create';
+import { getStringCellValue } from '../../utils/get-cell-data-origin';
+import { CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2, type CheckboxValidator } from '../../validators';
import { OpenValidationPanelOperation } from '../operations/data-validation.operation';
import type { RangeMutation } from '../../models/rule-matrix';
-import { CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2, type CheckboxValidator } from '../../validators';
-import { getStringCellValue } from '../../utils/get-cell-data-origin';
export interface IUpdateSheetDataValidationRangeCommandParams {
unitId: string;
@@ -57,8 +58,7 @@ export function getDataValidationDiffMutations(
) {
const redoMutations: IMutationInfo[] = [];
const undoMutations: IMutationInfo[] = [];
- const model = accessor.get(DataValidationModel);
- const manager = model.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
+ const sheetDataValidationModel = accessor.get(SheetDataValidationModel);
const univerInstanceService = accessor.get(IUniverInstanceService);
const target = getSheetCommandTarget(univerInstanceService, { unitId, subUnitId });
if (!target) {
@@ -139,9 +139,9 @@ export function getDataValidationDiffMutations(
source,
} as IUpdateDataValidationMutationParams,
});
- const rule = manager.getRuleById(diff.ruleId);
+ const rule = sheetDataValidationModel.getRuleById(unitId, subUnitId, diff.ruleId);
if (rule && rule.type === DataValidationType.CHECKBOX) {
- const validator = manager.getValidator(DataValidationType.CHECKBOX) as CheckboxValidator;
+ const validator = sheetDataValidationModel.getValidator(DataValidationType.CHECKBOX) as CheckboxValidator;
const formula = validator.parseFormulaSync(rule, unitId, subUnitId);
setRangesDefaultValue(diff.newRanges, formula.formula2!);
}
@@ -167,9 +167,9 @@ export function getDataValidationDiffMutations(
},
});
if (diff.rule.type === DataValidationType.CHECKBOX) {
- const validator = manager.getValidator(DataValidationType.CHECKBOX) as CheckboxValidator;
+ const validator = sheetDataValidationModel.getValidator(DataValidationType.CHECKBOX) as CheckboxValidator;
const formula = validator.parseFormulaSync(diff.rule, unitId, subUnitId);
- setRangesDefaultValue(diff.rule.ranges, formula.formula2!);
+ setRangesDefaultValue(diff.rule.ranges, formula.originFormula2!);
}
break;
}
@@ -209,18 +209,17 @@ export const UpdateSheetDataValidationRangeCommand: ICommand<IUpdateSheetDataVal
return false;
}
const { unitId, subUnitId, ranges, ruleId } = params;
- const dataValidationModel = accessor.get(DataValidationModel);
+ const sheetDataValidationModel = accessor.get(SheetDataValidationModel);
const commandService = accessor.get(ICommandService);
const undoRedoService = accessor.get(IUndoRedoService);
- const manager = dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- const currentRule = manager.getRuleById(ruleId);
+ const currentRule = sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
if (!currentRule) {
return false;
}
const oldRanges = currentRule.ranges;
- const matrix = manager.getRuleObjectMatrix().clone();
+ const matrix = sheetDataValidationModel.getRuleObjectMatrix(unitId, subUnitId).clone();
matrix.updateRange(ruleId, oldRanges, ranges);
- const diffs = matrix.diff(manager.getDataValidations());
+ const diffs = matrix.diff(sheetDataValidationModel.getRules(unitId, subUnitId));
const { redoMutations, undoMutations } = getDataValidationDiffMutations(unitId, subUnitId, diffs, accessor);
@@ -248,14 +247,13 @@ export const AddSheetDataValidationCommand: ICommand<IAddSheetDataValidationComm
return false;
}
const { unitId, subUnitId, rule } = params;
- const dataValidationModel = accessor.get(DataValidationModel);
+ const sheetDataValidationModel = accessor.get(SheetDataValidationModel);
const commandService = accessor.get(ICommandService);
const undoRedoService = accessor.get(IUndoRedoService);
- const manager = dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- const matrix = manager.getRuleObjectMatrix().clone();
+ const matrix = sheetDataValidationModel.getRuleObjectMatrix(unitId, subUnitId).clone();
matrix.addRule(rule);
- const diffs = matrix.diff(manager.getDataValidations());
+ const diffs = matrix.diff(sheetDataValidationModel.getRules(unitId, subUnitId));
const mutationParams: IAddDataValidationMutationParams = {
unitId,
@@ -339,7 +337,7 @@ export const UpdateSheetDataValidationSettingCommand: ICommand<IUpdateSheetDataV
}
const commandService = accessor.get(ICommandService);
const redoUndoService = accessor.get(IUndoRedoService);
- const dataValidationModel = accessor.get(DataValidationModel);
+ const sheetDataValidationModel = accessor.get(SheetDataValidationModel);
const dataValidatorRegistryService = accessor.get(DataValidatorRegistryService);
const { unitId, subUnitId, ruleId, setting } = params;
@@ -348,7 +346,7 @@ export const UpdateSheetDataValidationSettingCommand: ICommand<IUpdateSheetDataV
if (!validator) {
return false;
}
- const rule = dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
+ const rule = sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
if (!rule) {
return false;
}
@@ -366,7 +364,7 @@ export const UpdateSheetDataValidationSettingCommand: ICommand<IUpdateSheetDataV
type: UpdateRuleType.SETTING,
payload: {
...setting,
- ...validator.normlizeFormula(newRule, unitId, subUnitId),
+ ...validator.normalizeFormula(newRule, unitId, subUnitId),
},
},
};
@@ -461,11 +459,11 @@ export const UpdateSheetDataValidationOptionsCommand: ICommand<IUpdateSheetDataV
}
const commandService = accessor.get(ICommandService);
const redoUndoService = accessor.get(IUndoRedoService);
- const dataValidationModel = accessor.get(DataValidationModel);
+ const sheetDataValidationModel = accessor.get(SheetDataValidationModel);
const { unitId, subUnitId, ruleId, options } = params;
- const rule = dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
+ const rule = sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
if (!rule) {
return false;
}
@@ -526,16 +524,15 @@ export const ClearRangeDataValidationCommand: ICommand<IClearRangeDataValidation
const commandService = accessor.get(ICommandService);
const univerInstanceService = accessor.get(IUniverInstanceService);
const target = getSheetCommandTarget(univerInstanceService, { unitId, subUnitId });
- const dataValidationModel = accessor.get(DataValidationModel);
+ const sheetDataValidationModel = accessor.get(SheetDataValidationModel);
if (!target) return false;
const undoRedoService = accessor.get(IUndoRedoService);
- const manager = dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- const matrix = manager.getRuleObjectMatrix().clone();
+ const matrix = sheetDataValidationModel.getRuleObjectMatrix(unitId, subUnitId).clone();
matrix.removeRange(ranges);
- const diffs = matrix.diff(manager.getDataValidations());
+ const diffs = matrix.diff(sheetDataValidationModel.getRules(unitId, subUnitId));
const { redoMutations, undoMutations } = getDataValidationDiffMutations(unitId, subUnitId, diffs, accessor);
undoRedoService.pushUndoRedo({
@@ -547,3 +544,123 @@ export const ClearRangeDataValidationCommand: ICommand<IClearRangeDataValidation
return sequenceExecute(redoMutations, commandService).result;
},
};
+
+export interface IRemoveSheetAllDataValidationCommandParams extends ISheetCommandSharedParams {
+}
+
+export const RemoveSheetAllDataValidationCommand: ICommand<IRemoveSheetAllDataValidationCommandParams> = {
+ type: CommandType.COMMAND,
+ id: 'sheet.command.remove-all-data-validation',
+ handler(accessor, params) {
+ if (!params) {
+ return false;
+ }
+ const { unitId, subUnitId } = params;
+ const commandService = accessor.get(ICommandService);
+ const sheetDataValidationModel = accessor.get(SheetDataValidationModel);
+ const undoRedoService = accessor.get(IUndoRedoService);
+ const currentRules = [...sheetDataValidationModel.getRules(unitId, subUnitId)];
+
+ const redoParams: IRemoveDataValidationMutationParams = {
+ unitId,
+ subUnitId,
+ ruleId: currentRules.map((rule) => rule.uid),
+ };
+ const redoMutations: IMutationInfo[] = [{
+ id: RemoveDataValidationMutation.id,
+ params: redoParams,
+ }];
+
+ const undoMutations: IMutationInfo[] = [{
+ id: AddDataValidationMutation.id,
+ params: {
+ unitId,
+ subUnitId,
+ rule: currentRules,
+ },
+ }];
+
+ undoRedoService.pushUndoRedo({
+ redoMutations,
+ undoMutations,
+ unitID: unitId,
+ });
+
+ commandService.executeCommand(RemoveDataValidationMutation.id, redoParams);
+ return true;
+ },
+};
+
+export interface IRemoveSheetDataValidationCommandParams extends ISheetCommandSharedParams {
+ ruleId: string;
+}
+
+export const removeDataValidationUndoFactory = (accessor: Injector, redoParams: IRemoveDataValidationMutationParams) => {
+ const sheetDataValidationModel = accessor.get(SheetDataValidationModel);
+ const { unitId, subUnitId, ruleId, source } = redoParams;
+ if (Array.isArray(ruleId)) {
+ const rules = ruleId.map((id) => sheetDataValidationModel.getRuleById(unitId, subUnitId, id)).filter(Boolean) as ISheetDataValidationRule[];
+ return [{
+ id: AddDataValidationMutation.id,
+ params: {
+ unitId,
+ subUnitId,
+ rule: rules,
+ source,
+ } as IAddDataValidationMutationParams,
+ }];
+ }
+
+ const undoMutations: IMutationInfo[] = [{
+ id: AddDataValidationMutation.id,
+ params: {
+ unitId,
+ subUnitId,
+ rule: {
+ ...sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId),
+ },
+ index: sheetDataValidationModel.getRuleIndex(unitId, subUnitId, ruleId),
+ } as IAddDataValidationMutationParams,
+ }];
+
+ return undoMutations;
+};
+
+export const RemoveSheetDataValidationCommand: ICommand<IRemoveSheetDataValidationCommandParams> = {
+ type: CommandType.COMMAND,
+ id: 'sheet.command.remove-data-validation-rule',
+ handler(accessor, params) {
+ if (!params) {
+ return false;
+ }
+ const { unitId, subUnitId, ruleId } = params;
+ const commandService = accessor.get(ICommandService);
+ const undoRedoService = accessor.get(IUndoRedoService);
+ const sheetDataValidationModel = accessor.get(SheetDataValidationModel);
+
+ const redoMutations: IMutationInfo[] = [{
+ id: RemoveDataValidationMutation.id,
+ params,
+ }];
+ const undoMutations: IMutationInfo[] = [{
+ id: AddDataValidationMutation.id,
+ params: {
+ unitId,
+ subUnitId,
+ rule: {
+ ...sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId),
+ },
+ index: sheetDataValidationModel.getRuleIndex(unitId, subUnitId, ruleId),
+ } as IAddDataValidationMutationParams,
+ }];
+
+ undoRedoService.pushUndoRedo({
+ undoMutations,
+ redoMutations,
+ unitID: params.unitId,
+ });
+
+ commandService.executeCommand(RemoveDataValidationMutation.id, params);
+ return true;
+ },
+};
diff --git a/packages/sheets-data-validation/src/controllers/dv-alert.controller.ts b/packages/sheets-data-validation/src/controllers/dv-alert.controller.ts
index 6afee7d312..554093b713 100644
--- a/packages/sheets-data-validation/src/controllers/dv-alert.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-alert.controller.ts
@@ -19,6 +19,7 @@ import { DataValidationStatus, Disposable, Inject, IUniverInstanceService, Lifec
import { CellAlertManagerService, CellAlertType, HoverManagerService } from '@univerjs/sheets-ui';
import type { BaseDataValidator } from '@univerjs/data-validation';
import { debounceTime } from 'rxjs';
+import { IZenZoneService } from '@univerjs/ui';
const ALERT_KEY = 'SHEET_DATA_VALIDATION_ALERT';
@@ -28,7 +29,8 @@ export class DataValidationAlertController extends Disposable {
@Inject(HoverManagerService) private readonly _hoverManagerService: HoverManagerService,
@Inject(CellAlertManagerService) private readonly _cellAlertManagerService: CellAlertManagerService,
@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
- @Inject(LocaleService) private readonly _localeService: LocaleService
+ @Inject(LocaleService) private readonly _localeService: LocaleService,
+ @IZenZoneService private readonly _zenZoneService: IZenZoneService
) {
super();
this._init();
@@ -36,6 +38,7 @@ export class DataValidationAlertController extends Disposable {
private _init() {
this._initCellAlertPopup();
+ this._initZenService();
}
private _initCellAlertPopup() {
@@ -80,4 +83,12 @@ export class DataValidationAlertController extends Disposable {
this._cellAlertManagerService.removeAlert(ALERT_KEY);
}));
}
+
+ private _initZenService() {
+ this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {
+ if (visible) {
+ this._cellAlertManagerService.removeAlert(ALERT_KEY);
+ }
+ }));
+ }
}
diff --git a/packages/sheets-data-validation/src/controllers/dv-auto-fill.controller.ts b/packages/sheets-data-validation/src/controllers/dv-auto-fill.controller.ts
index dd8a749d58..0f26f64d28 100644
--- a/packages/sheets-data-validation/src/controllers/dv-auto-fill.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-auto-fill.controller.ts
@@ -17,16 +17,15 @@
import { DataValidationType, Disposable, Inject, Injector, LifecycleStages, OnLifecycle, Range, Rectangle } from '@univerjs/core';
import type { IAutoFillLocation, ISheetAutoFillHook } from '@univerjs/sheets-ui';
import { APPLY_TYPE, getAutoFillRepeatRange, IAutoFillService, virtualizeDiscreteRanges } from '@univerjs/sheets-ui';
-import { DataValidationModel } from '@univerjs/data-validation';
import { DATA_VALIDATION_PLUGIN_NAME } from '../common/const';
-import type { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
import { getDataValidationDiffMutations } from '../commands/commands/data-validation.command';
+import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
@OnLifecycle(LifecycleStages.Ready, DataValidationAutoFillController)
export class DataValidationAutoFillController extends Disposable {
constructor(
@IAutoFillService private readonly _autoFillService: IAutoFillService,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
+ @Inject(SheetDataValidationModel) private readonly _dataValidationModel: SheetDataValidationModel,
@Inject(Injector) private readonly _injector: Injector
) {
super();
@@ -39,8 +38,7 @@ export class DataValidationAutoFillController extends Disposable {
const generalApplyFunc = (location: IAutoFillLocation, applyType: APPLY_TYPE) => {
const { source: sourceRange, target: targetRange, unitId, subUnitId } = location;
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- const ruleMatrixCopy = manager.getRuleObjectMatrix().clone();
+ const ruleMatrixCopy = this._dataValidationModel.getRuleObjectMatrix(unitId, subUnitId).clone();
const virtualRange = virtualizeDiscreteRanges([sourceRange, targetRange]);
const [vSourceRange, vTargetRange] = virtualRange.ranges;
@@ -76,7 +74,7 @@ export class DataValidationAutoFillController extends Disposable {
sourceRange
);
const { row: sourceRow, col: sourceCol } = mapFunc(sourcePositionRange.startRow, sourcePositionRange.startColumn);
- const ruleId = manager.getRuleIdByLocation(sourceRow, sourceCol);
+ const ruleId = this._dataValidationModel.getRuleIdByLocation(unitId, subUnitId, sourceRow, sourceCol);
if (ruleId) {
const targetPositionRange = Rectangle.getPositionRange(
{
@@ -94,7 +92,7 @@ export class DataValidationAutoFillController extends Disposable {
});
});
- const diffs = ruleMatrixCopy.diff(manager.getDataValidations());
+ const diffs = ruleMatrixCopy.diff(this._dataValidationModel.getRules(unitId, subUnitId));
const { redoMutations, undoMutations } = getDataValidationDiffMutations(unitId, subUnitId, diffs, this._injector, 'patched', applyType === APPLY_TYPE.ONLY_FORMAT);
return {
undos: undoMutations,
@@ -108,10 +106,9 @@ export class DataValidationAutoFillController extends Disposable {
id: DATA_VALIDATION_PLUGIN_NAME,
onBeforeFillData: (location) => {
const { source: sourceRange, unitId, subUnitId } = location;
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
for (const row of sourceRange.rows) {
for (const col of sourceRange.cols) {
- const dv = manager.getRuleByLocation(row, col);
+ const dv = this._dataValidationModel.getRuleByLocation(unitId, subUnitId, row, col);
if (dv && disabledDataVallation.indexOf(dv.type) > -1) {
this._autoFillService.setDisableApplyType(APPLY_TYPE.SERIES, true);
return;
diff --git a/packages/sheets-data-validation/src/controllers/dv-copy-paste.controller.ts b/packages/sheets-data-validation/src/controllers/dv-copy-paste.controller.ts
index 58563f6c7e..d9853077a6 100644
--- a/packages/sheets-data-validation/src/controllers/dv-copy-paste.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-copy-paste.controller.ts
@@ -18,10 +18,9 @@ import type { IRange, ISheetDataValidationRule, Nullable } from '@univerjs/core'
import { Disposable, Inject, Injector, LifecycleStages, ObjectMatrix, OnLifecycle, Rectangle } from '@univerjs/core';
import type { IDiscreteRange } from '@univerjs/sheets-ui';
import { COPY_TYPE, getRepeatRange, ISheetClipboardService, PREDEFINED_HOOK_NAME, rangeToDiscreteRange, virtualizeDiscreteRanges } from '@univerjs/sheets-ui';
-import { DataValidationModel } from '@univerjs/data-validation';
-import type { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
import { DATA_VALIDATION_PLUGIN_NAME } from '../common/const';
import { getDataValidationDiffMutations } from '../commands/commands/data-validation.command';
+import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
@OnLifecycle(LifecycleStages.Ready, DataValidationCopyPasteController)
export class DataValidationCopyPasteController extends Disposable {
@@ -33,7 +32,7 @@ export class DataValidationCopyPasteController extends Disposable {
constructor(
@ISheetClipboardService private _sheetClipboardService: ISheetClipboardService,
- @Inject(DataValidationModel) private _dataValidationModel: DataValidationModel,
+ @Inject(SheetDataValidationModel) private _sheetDataValidationModel: SheetDataValidationModel,
@Inject(Injector) private _injector: Injector
) {
super();
@@ -61,8 +60,6 @@ export class DataValidationCopyPasteController extends Disposable {
matrix,
};
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
-
const discreteRange = this._injector.invoke((accessor) => {
return rangeToDiscreteRange(range, accessor, unitId, subUnitId);
});
@@ -72,8 +69,7 @@ export class DataValidationCopyPasteController extends Disposable {
const { rows, cols } = discreteRange;
rows.forEach((row, rowIndex) => {
cols.forEach((col, colIndex) => {
- const ruleId = manager.getRuleIdByLocation(row, col);
-
+ const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
matrix.setValue(rowIndex, colIndex, ruleId ?? '');
});
});
@@ -117,9 +113,7 @@ export class DataValidationCopyPasteController extends Disposable {
const { unitId, subUnitId } = this._copyInfo;
if (copyInfo.unitId !== unitId || subUnitId !== copyInfo.subUnitId) {
- const originManager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- const manager = this._dataValidationModel.ensureManager(copyInfo.unitId, copyInfo.subUnitId) as SheetDataValidationManager;
- const ruleMatrix = manager.getRuleObjectMatrix().clone();
+ const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(copyInfo.unitId, copyInfo.subUnitId).clone();
const { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]);
@@ -138,9 +132,9 @@ export class DataValidationCopyPasteController extends Disposable {
startRange
);
const transformedRuleId = `${subUnitId}-${ruleId}`;
- const oldRule = originManager.getRuleById(ruleId);
+ const oldRule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
- if (!manager.getRuleById(transformedRuleId) && oldRule) {
+ if (!this._sheetDataValidationModel.getRuleById(copyInfo.unitId, copyInfo.subUnitId, transformedRuleId) && oldRule) {
additionRules.set(transformedRuleId, { ...oldRule, uid: transformedRuleId });
}
@@ -152,7 +146,7 @@ export class DataValidationCopyPasteController extends Disposable {
const { redoMutations, undoMutations } = getDataValidationDiffMutations(
copyInfo.unitId,
copyInfo.subUnitId,
- ruleMatrix.diffWithAddition(manager.getDataValidations(), additionRules.values()),
+ ruleMatrix.diffWithAddition(this._sheetDataValidationModel.getRules(copyInfo.unitId, copyInfo.subUnitId), additionRules.values()),
this._injector,
'patched'
);
@@ -162,8 +156,7 @@ export class DataValidationCopyPasteController extends Disposable {
undos: undoMutations,
};
} else {
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- const ruleMatrix = manager.getRuleObjectMatrix().clone();
+ const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(unitId, subUnitId).clone();
const { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]);
@@ -188,7 +181,7 @@ export class DataValidationCopyPasteController extends Disposable {
const { redoMutations, undoMutations } = getDataValidationDiffMutations(
unitId,
subUnitId,
- ruleMatrix.diff(manager.getDataValidations()),
+ ruleMatrix.diff(this._sheetDataValidationModel.getRules(unitId, subUnitId)),
this._injector,
'patched'
);
diff --git a/packages/sheets-data-validation/src/controllers/dv-model.controller.ts b/packages/sheets-data-validation/src/controllers/dv-model.controller.ts
deleted file mode 100644
index 304dfe55ae..0000000000
--- a/packages/sheets-data-validation/src/controllers/dv-model.controller.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Disposable, Inject, Injector, IResourceManagerService, IUniverInstanceService, LifecycleStages, OnLifecycle } from '@univerjs/core';
-import { DataValidationModel } from '@univerjs/data-validation';
-import { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
-
-@OnLifecycle(LifecycleStages.Starting, DataValidationModelController)
-export class DataValidationModelController extends Disposable {
- constructor(
- @IResourceManagerService private readonly _resourceManagerService: IResourceManagerService,
- @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
- @Inject(Injector) private readonly _injector: Injector
- ) {
- super();
- this._initDataValidationDataSource();
- }
-
- private _createSheetDataValidationManager(unitId: string, subUnitId: string) {
- return new SheetDataValidationManager(
- unitId,
- subUnitId,
- this._injector
- );
- }
-
- private _initDataValidationDataSource() {
- this._dataValidationModel.setManagerCreator(this._createSheetDataValidationManager.bind(this));
- }
-}
diff --git a/packages/sheets-data-validation/src/controllers/dv-permission.controller.ts b/packages/sheets-data-validation/src/controllers/dv-permission.controller.ts
index a460d1aebf..8d6a3faa50 100644
--- a/packages/sheets-data-validation/src/controllers/dv-permission.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-permission.controller.ts
@@ -17,10 +17,9 @@
import type { ICommandInfo } from '@univerjs/core';
import { Disposable, ICommandService, Inject, LifecycleStages, LocaleService, OnLifecycle } from '@univerjs/core';
import { SheetPermissionInterceptorBaseController } from '@univerjs/sheets-ui';
-import { AddDataValidationCommand } from '@univerjs/data-validation';
import { RangeProtectionPermissionEditPoint, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission } from '@univerjs/sheets';
import type { IUpdateSheetDataValidationRangeCommandParams } from '../commands/commands/data-validation.command';
-import { UpdateSheetDataValidationRangeCommand } from '../commands/commands/data-validation.command';
+import { AddSheetDataValidationCommand, UpdateSheetDataValidationRangeCommand } from '../commands/commands/data-validation.command';
@OnLifecycle(LifecycleStages.Ready, DataValidationPermissionController)
export class DataValidationPermissionController extends Disposable {
@@ -36,7 +35,7 @@ export class DataValidationPermissionController extends Disposable {
private _commandExecutedListener() {
this.disposeWithMe(
this._commandService.beforeCommandExecuted((command: ICommandInfo) => {
- if (command.id === AddDataValidationCommand.id) {
+ if (command.id === AddSheetDataValidationCommand.id) {
const permission = this._sheetPermissionInterceptorBaseController.permissionCheckWithRanges({
workbookTypes: [WorkbookEditablePermission],
rangeTypes: [RangeProtectionPermissionEditPoint],
diff --git a/packages/sheets-data-validation/src/controllers/dv-ref-range.controller.ts b/packages/sheets-data-validation/src/controllers/dv-ref-range.controller.ts
index a9a1c89d3a..f7a64d4012 100644
--- a/packages/sheets-data-validation/src/controllers/dv-ref-range.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-ref-range.controller.ts
@@ -19,10 +19,11 @@ import { DataValidationType, Disposable, Inject, Injector, isRangesEqual, Lifecy
import type { EffectRefRangeParams } from '@univerjs/sheets';
import { handleCommonDefaultRangeChangeWithEffectRefCommands, RefRangeService } from '@univerjs/sheets';
import type { IRemoveDataValidationMutationParams, IUpdateDataValidationMutationParams } from '@univerjs/data-validation';
-import { DataValidationModel, RemoveDataValidationMutation, removeDataValidationUndoFactory, UpdateDataValidationMutation, UpdateRuleType } from '@univerjs/data-validation';
+import { DataValidationModel, RemoveDataValidationMutation, UpdateDataValidationMutation, UpdateRuleType } from '@univerjs/data-validation';
import { FormulaRefRangeService } from '@univerjs/sheets-formula';
import { DataValidationCustomFormulaService } from '../services/dv-custom-formula.service';
import { DataValidationFormulaService } from '../services/dv-formula.service';
+import { removeDataValidationUndoFactory } from '../commands/commands/data-validation.command';
@OnLifecycle(LifecycleStages.Starting, DataValidationRefRangeController)
export class DataValidationRefRangeController extends Disposable {
@@ -131,7 +132,7 @@ export class DataValidationRefRangeController extends Disposable {
if (formula2) {
const disposable = this._formulaRefRangeService.registerFormula(
formula2.text,
- (newFormulaString) => handleFormulaChange('formula1', newFormulaString)
+ (newFormulaString) => handleFormulaChange('formula2', newFormulaString)
);
disposeSet.add(() => disposable.dispose());
}
@@ -210,13 +211,17 @@ export class DataValidationRefRangeController extends Disposable {
}
case 'remove': {
const disposeSet = this._disposableMap.get(this._getIdWithUnitId(unitId, subUnitId, rule!.uid));
- disposeSet && disposeSet.forEach((dispose) => dispose());
+ if (disposeSet) {
+ disposeSet.forEach((dispose) => dispose());
+ }
break;
}
case 'update': {
const rule = option.rule!;
const disposeSet = this._disposableMap.get(this._getIdWithUnitId(unitId, subUnitId, rule!.uid));
- disposeSet && disposeSet.forEach((dispose) => dispose());
+ if (disposeSet) {
+ disposeSet.forEach((dispose) => dispose());
+ }
this.registerRule(option.unitId, option.subUnitId, rule);
break;
}
diff --git a/packages/sheets-data-validation/src/controllers/dv-reject-input.controller.ts b/packages/sheets-data-validation/src/controllers/dv-reject-input.controller.ts
index 345641015b..611dacc9ef 100644
--- a/packages/sheets-data-validation/src/controllers/dv-reject-input.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-reject-input.controller.ts
@@ -15,19 +15,19 @@
*/
import { DataValidationErrorStyle, Disposable, Inject, LifecycleStages, LocaleService, OnLifecycle, UNIVER_INTERNAL } from '@univerjs/core';
-import { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';
+import { DataValidatorRegistryService } from '@univerjs/data-validation';
import { IEditorBridgeService } from '@univerjs/sheets-ui';
import { IDialogService } from '@univerjs/ui';
import React from 'react';
import { Button } from '@univerjs/design';
-import type { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
import { getCellValueOrigin } from '../utils/get-cell-data-origin';
+import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
@OnLifecycle(LifecycleStages.Ready, DataValidationRejectInputController)
export class DataValidationRejectInputController extends Disposable {
constructor(
@IEditorBridgeService private readonly _editorBridgeService: IEditorBridgeService,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
+ @Inject(SheetDataValidationModel) private readonly _dataValidationModel: SheetDataValidationModel,
@Inject(DataValidatorRegistryService) private readonly _dataValidatorRegistryService: DataValidatorRegistryService,
@IDialogService private readonly _dialogService: IDialogService,
@Inject(LocaleService) private readonly _localeService: LocaleService
@@ -43,9 +43,8 @@ export class DataValidationRejectInputController extends Disposable {
handler: async (cellPromise, context, next) => {
const cell = await cellPromise;
const { worksheet, row, col, unitId, subUnitId, workbook } = context;
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- const ruleId = manager.getRuleIdByLocation(row, col);
- const rule = ruleId ? manager.getRuleById(ruleId) : undefined;
+ const ruleId = this._dataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
+ const rule = ruleId ? this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId) : undefined;
if (!rule || rule.errorStyle !== DataValidationErrorStyle.STOP) {
return next(Promise.resolve(cell));
}
diff --git a/packages/sheets-data-validation/src/controllers/dv-render.controller.ts b/packages/sheets-data-validation/src/controllers/dv-render.controller.ts
index fc1943f208..937b715ea4 100644
--- a/packages/sheets-data-validation/src/controllers/dv-render.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-render.controller.ts
@@ -16,7 +16,7 @@
import type { ICellDataForSheetInterceptor, ICellRenderContext, IRange, Workbook } from '@univerjs/core';
import { DataValidationRenderMode, DataValidationStatus, DataValidationType, ICommandService, Inject, IUniverInstanceService, LifecycleStages, OnLifecycle, Optional, RxDisposable, sequenceExecute, UniverInstanceType, WrapStrategy } from '@univerjs/core';
-import { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';
+import { DataValidatorRegistryService } from '@univerjs/data-validation';
import { IMenuManagerService } from '@univerjs/ui';
import { AutoHeightController, IEditorBridgeService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
import type { Spreadsheet } from '@univerjs/engine-render';
@@ -25,8 +25,8 @@ import { InterceptCellContentPriority, INTERCEPTOR_POINT, SheetInterceptorServic
import { bufferTime, debounceTime, filter } from 'rxjs';
import { getCellValueOrigin } from '../utils/get-cell-data-origin';
import type { ListValidator } from '../validators';
-import type { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
import { DataValidationDropdownManagerService } from '../services/dropdown-manager.service';
+import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
import { menuSchema } from './menu.schema';
const INVALID_MARK = {
@@ -45,7 +45,7 @@ export class SheetsDataValidationRenderController extends RxDisposable {
@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
@Inject(AutoHeightController) private readonly _autoHeightController: AutoHeightController,
@Inject(DataValidationDropdownManagerService) private readonly _dropdownManagerService: DataValidationDropdownManagerService,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
+ @Inject(SheetDataValidationModel) private readonly _sheetDataValidationModel: SheetDataValidationModel,
@Inject(DataValidatorRegistryService) private readonly _dataValidatorRegistryService: DataValidatorRegistryService,
@Inject(SheetInterceptorService) private readonly _sheetInterceptorService: SheetInterceptorService,
@Optional(IEditorBridgeService) private readonly _editorBridgeService?: IEditorBridgeService
@@ -83,8 +83,7 @@ export class SheetsDataValidationRenderController extends RxDisposable {
if (!workbook) {
return;
}
- const manager = this._dataValidationModel.ensureManager(unitId, sheetId) as SheetDataValidationManager;
- const rule = manager.getRuleByLocation(row, column);
+ const rule = this._sheetDataValidationModel.getRuleByLocation(unitId, sheetId, row, column);
if (!rule) {
return;
@@ -152,8 +151,8 @@ export class SheetsDataValidationRenderController extends RxDisposable {
}
};
- this.disposeWithMe(this._dataValidationModel.ruleChange$.pipe(debounceTime(16)).subscribe(() => markSkeletonDirty()));
- this.disposeWithMe(this._dataValidationModel.validStatusChange$.pipe(debounceTime(16)).subscribe(() => markSkeletonDirty()));
+ this.disposeWithMe(this._sheetDataValidationModel.ruleChange$.pipe(debounceTime(16)).subscribe(() => markSkeletonDirty()));
+ this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe(debounceTime(16)).subscribe(() => markSkeletonDirty()));
}
// eslint-disable-next-line max-lines-per-function
@@ -167,10 +166,6 @@ export class SheetsDataValidationRenderController extends RxDisposable {
// eslint-disable-next-line max-lines-per-function, complexity
handler: (cell, pos, next) => {
const { row, col, unitId, subUnitId, workbook, worksheet } = pos;
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- if (!manager) {
- return next(cell);
- }
const skeleton = this._renderManagerService.getRenderById(unitId)
?.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)
@@ -181,18 +176,19 @@ export class SheetsDataValidationRenderController extends RxDisposable {
const styleMap = pos.workbook.getStyles();
const defaultStyle = (typeof cell?.s === 'string' ? styleMap.get(cell?.s) : cell?.s) || {};
- const ruleId = manager.getRuleIdByLocation(row, col);
+ const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
if (!ruleId) {
return next(cell);
}
- const rule = manager.getRuleById(ruleId);
+ const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
if (!rule) {
return next(cell);
}
- const validStatus = this._dataValidationModel.validator(rule, pos, cell);
+ const validStatus = this._sheetDataValidationModel.validator(cell, rule, pos);
const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
- const cellValue = getCellValueOrigin(cell);
+ const cellOrigin = worksheet.getCellRaw(row, col);
+ const cellValue = getCellValueOrigin(cellOrigin);
let extra: ICellDataForSheetInterceptor = {};
if (rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) {
@@ -215,7 +211,7 @@ export class SheetsDataValidationRenderController extends RxDisposable {
if (rule.type === DataValidationType.LIST && (rule.renderMode === DataValidationRenderMode.ARROW || rule.renderMode === DataValidationRenderMode.TEXT)) {
const colorMap = (validator as ListValidator).getListWithColorMap(rule);
- const valueStr = `${getCellValueOrigin(cell) ?? ''}`;
+ const valueStr = `${getCellValueOrigin(cellOrigin) ?? ''}`;
const color = colorMap[valueStr];
if (color) {
extra = {
@@ -294,7 +290,7 @@ export class SheetsDataValidationRenderController extends RxDisposable {
}
private _initAutoHeight() {
- this._dataValidationModel.ruleChange$
+ this._sheetDataValidationModel.ruleChange$
.pipe(
// patched data-validation change don't need to re-calc row height
// re-calc of row height will be triggered precisely by the origin command
@@ -325,9 +321,9 @@ export class SheetsDataValidationMobileRenderController extends RxDisposable {
@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,
@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
@Inject(AutoHeightController) private readonly _autoHeightController: AutoHeightController,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
@Inject(DataValidatorRegistryService) private readonly _dataValidatorRegistryService: DataValidatorRegistryService,
- @Inject(SheetInterceptorService) private readonly _sheetInterceptorService: SheetInterceptorService
+ @Inject(SheetInterceptorService) private readonly _sheetInterceptorService: SheetInterceptorService,
+ @Inject(SheetDataValidationModel) private readonly _sheetDataValidationModel: SheetDataValidationModel
) {
super();
@@ -358,8 +354,8 @@ export class SheetsDataValidationMobileRenderController extends RxDisposable {
}
};
- this.disposeWithMe(this._dataValidationModel.ruleChange$.pipe(debounceTime(16)).subscribe(() => markSkeletonDirty()));
- this.disposeWithMe(this._dataValidationModel.validStatusChange$.pipe(debounceTime(16)).subscribe(() => markSkeletonDirty()));
+ this.disposeWithMe(this._sheetDataValidationModel.ruleChange$.pipe(debounceTime(16)).subscribe(() => markSkeletonDirty()));
+ this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe(debounceTime(16)).subscribe(() => markSkeletonDirty()));
}
// eslint-disable-next-line max-lines-per-function
@@ -372,10 +368,6 @@ export class SheetsDataValidationMobileRenderController extends RxDisposable {
// eslint-disable-next-line max-lines-per-function, complexity
handler: (cell, pos, next) => {
const { row, col, unitId, subUnitId, workbook, worksheet } = pos;
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- if (!manager) {
- return next(cell);
- }
const skeleton = this._renderManagerService.getRenderById(unitId)
?.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)
@@ -386,18 +378,19 @@ export class SheetsDataValidationMobileRenderController extends RxDisposable {
const styleMap = pos.workbook.getStyles();
const defaultStyle = (typeof cell?.s === 'string' ? styleMap.get(cell?.s) : cell?.s) || {};
- const ruleId = manager.getRuleIdByLocation(row, col);
+ const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
if (!ruleId) {
return next(cell);
}
- const rule = manager.getRuleById(ruleId);
+ const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
if (!rule) {
return next(cell);
}
- const validStatus = this._dataValidationModel.validator(rule, pos, cell);
+ const validStatus = this._sheetDataValidationModel.validator(cell, rule, pos);
const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
- const cellValue = getCellValueOrigin(cell);
+ const cellOrigin = worksheet.getCellRaw(row, col);
+ const cellValue = getCellValueOrigin(cellOrigin);
let extra: ICellDataForSheetInterceptor = {};
if (rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) {
@@ -421,7 +414,7 @@ export class SheetsDataValidationMobileRenderController extends RxDisposable {
if (rule.type === DataValidationType.LIST && (rule.renderMode === DataValidationRenderMode.ARROW || rule.renderMode === DataValidationRenderMode.TEXT)) {
const colorMap = (validator as ListValidator).getListWithColorMap(rule);
- const valueStr = `${getCellValueOrigin(cell) ?? ''}`;
+ const valueStr = `${getCellValueOrigin(cellOrigin) ?? ''}`;
const color = colorMap[valueStr];
if (color) {
extra = {
@@ -498,7 +491,7 @@ export class SheetsDataValidationMobileRenderController extends RxDisposable {
}
private _initAutoHeight() {
- this._dataValidationModel.ruleChange$
+ this._sheetDataValidationModel.ruleChange$
.pipe(
filter((change) => change.source === 'command'),
bufferTime(16)
diff --git a/packages/data-validation/src/controllers/dv-sheet.controller.ts b/packages/sheets-data-validation/src/controllers/dv-sheet.controller.ts
similarity index 82%
rename from packages/data-validation/src/controllers/dv-sheet.controller.ts
rename to packages/sheets-data-validation/src/controllers/dv-sheet.controller.ts
index 511c104ed9..4de3255d3c 100644
--- a/packages/data-validation/src/controllers/dv-sheet.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv-sheet.controller.ts
@@ -16,18 +16,18 @@
import type { Workbook } from '@univerjs/core';
import { Disposable, Inject, IUniverInstanceService, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
+import type { IAddDataValidationMutationParams, IRemoveDataValidationMutationParams } from '@univerjs/data-validation';
+import { AddDataValidationMutation, RemoveDataValidationMutation } from '@univerjs/data-validation';
import type { IRemoveSheetCommandParams } from '@univerjs/sheets';
import { RemoveSheetCommand, SheetInterceptorService } from '@univerjs/sheets';
-import type { IAddDataValidationMutationParams, IRemoveDataValidationMutationParams } from '../commands/mutations/data-validation.mutation';
-import { AddDataValidationMutation, RemoveDataValidationMutation } from '../commands/mutations/data-validation.mutation';
-import { DataValidationModel } from '../models/data-validation-model';
+import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
-@OnLifecycle(LifecycleStages.Ready, DataValidationSheetController)
-export class DataValidationSheetController extends Disposable {
+@OnLifecycle(LifecycleStages.Ready, SheetDataValidationSheetController)
+export class SheetDataValidationSheetController extends Disposable {
constructor(
@Inject(SheetInterceptorService) private _sheetInterceptorService: SheetInterceptorService,
@Inject(IUniverInstanceService) private _univerInstanceService: IUniverInstanceService,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel
+ @Inject(SheetDataValidationModel) private readonly _sheetDataValidationModel: SheetDataValidationModel
) {
super();
this._initSheetChange();
@@ -50,12 +50,7 @@ export class DataValidationSheetController extends Disposable {
return { redos: [], undos: [] };
}
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
- if (!manager) {
- return { redos: [], undos: [] };
- }
-
- const rules = manager.getDataValidations();
+ const rules = this._sheetDataValidationModel.getRules(unitId, subUnitId);
const ids = rules.map((i) => i.uid);
const redoParams: IRemoveDataValidationMutationParams = {
unitId,
diff --git a/packages/sheets-data-validation/src/controllers/dv.controller.ts b/packages/sheets-data-validation/src/controllers/dv.controller.ts
index 6ee3456b41..b493a99019 100644
--- a/packages/sheets-data-validation/src/controllers/dv.controller.ts
+++ b/packages/sheets-data-validation/src/controllers/dv.controller.ts
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-import type { Workbook } from '@univerjs/core';
import { Inject, Injector, IUniverInstanceService, LifecycleStages, OnLifecycle, RxDisposable, UniverInstanceType } from '@univerjs/core';
-import { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';
+import { DataValidatorRegistryService } from '@univerjs/data-validation';
import { DataValidationSingle } from '@univerjs/icons';
-import { ComponentManager } from '@univerjs/ui';
import { ClearSelectionAllCommand, SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';
-import { CustomFormulaValidator } from '../validators/custom-validator';
-import { CheckboxValidator, DateValidator, DecimalValidator, ListValidator, TextLengthValidator } from '../validators';
-import { WholeValidator } from '../validators/whole-validator';
-import { ListMultipleValidator } from '../validators/list-multiple-validator';
-import type { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
+import { ComponentManager } from '@univerjs/ui';
+import type { Workbook } from '@univerjs/core';
import { getDataValidationDiffMutations } from '../commands/commands/data-validation.command';
import { DATA_VALIDATION_PANEL } from '../commands/operations/data-validation.operation';
+import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
+import { CheckboxValidator, DateValidator, DecimalValidator, ListValidator, TextLengthValidator } from '../validators';
+import { CustomFormulaValidator } from '../validators/custom-validator';
+import { ListMultipleValidator } from '../validators/list-multiple-validator';
+import { WholeValidator } from '../validators/whole-validator';
import { DataValidationPanel, DATE_DROPDOWN_KEY, DateDropdown, LIST_DROPDOWN_KEY, ListDropDown } from '../views';
import { CellDropdown, DROP_DOWN_KEY } from '../views/drop-down';
import { FORMULA_INPUTS } from '../views/formula-input';
@@ -43,7 +43,7 @@ export class DataValidationController extends RxDisposable {
@Inject(ComponentManager) private readonly _componentManger: ComponentManager,
@Inject(SheetsSelectionsService) private _selectionManagerService: SheetsSelectionsService,
@Inject(SheetInterceptorService) private readonly _sheetInterceptorService: SheetInterceptorService,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel
+ @Inject(SheetDataValidationModel) private readonly _sheetDataValidationModel: SheetDataValidationModel
) {
super();
this._init();
@@ -92,12 +92,12 @@ export class DataValidationController extends RxDisposable {
const subUnitId = worksheet.getSheetId();
const selections = this._selectionManagerService.getCurrentSelections()?.map((s) => s.range);
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
-
- const ruleMatrix = manager.getRuleObjectMatrix().clone();
+ const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(unitId, subUnitId).clone();
- selections && ruleMatrix.removeRange(selections);
- const diffs = ruleMatrix.diff(manager.getDataValidations());
+ if (selections) {
+ ruleMatrix.removeRange(selections);
+ }
+ const diffs = ruleMatrix.diff(this._sheetDataValidationModel.getRules(unitId, subUnitId));
const { redoMutations, undoMutations } = getDataValidationDiffMutations(unitId, subUnitId, diffs, this._injector, 'patched');
return {
diff --git a/packages/sheets-data-validation/src/index.ts b/packages/sheets-data-validation/src/index.ts
index 48218516e3..46dc0eedd4 100644
--- a/packages/sheets-data-validation/src/index.ts
+++ b/packages/sheets-data-validation/src/index.ts
@@ -22,18 +22,9 @@ export { DataValidationFormulaService } from './services/dv-formula.service';
export { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
export { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
export { SheetsDataValidationValidatorService } from './services/dv-validator-service';
-export {
- DataValidationModel,
- RemoveAllDataValidationCommand as RemoveSheetAllDataValidationCommand,
- type IRemoveAllDataValidationCommandParams as IRemoveSheetAllDataValidationCommandParams,
-} from '@univerjs/data-validation';
-export { SheetDataValidationManager } from './models/sheet-data-validation-manager';
-
+export { SheetDataValidationModel } from './models/sheet-data-validation-model';
+export { DataValidationModel } from '@univerjs/data-validation';
// #region - all commands
-export {
- RemoveDataValidationCommand as RemoveSheetDataValidationCommand,
- type IRemoveDataValidationCommandParams as IRemoveSheetDataValidationCommandParams,
-} from '@univerjs/data-validation';
export {
UpdateSheetDataValidationRangeCommand,
UpdateSheetDataValidationOptionsCommand,
@@ -41,11 +32,15 @@ export {
AddSheetDataValidationCommand,
AddSheetDataValidationAndOpenCommand,
ClearRangeDataValidationCommand,
+ RemoveSheetAllDataValidationCommand,
+ RemoveSheetDataValidationCommand,
+ type IRemoveSheetDataValidationCommandParams,
type IAddSheetDataValidationCommandParams,
type IUpdateSheetDataValidationRangeCommandParams,
type IUpdateSheetDataValidationOptionsCommandParams,
type IUpdateSheetDataValidationSettingCommandParams,
type IClearRangeDataValidationCommandParams,
+ type IRemoveSheetAllDataValidationCommandParams,
} from './commands/commands/data-validation.command';
export {
diff --git a/packages/sheets-data-validation/src/mobile-plugin.ts b/packages/sheets-data-validation/src/mobile-plugin.ts
index 09ccba6e74..ddd9b09d5e 100644
--- a/packages/sheets-data-validation/src/mobile-plugin.ts
+++ b/packages/sheets-data-validation/src/mobile-plugin.ts
@@ -25,28 +25,28 @@ import { type Dependency, Inject, Injector } from '@univerjs/core';
import { UniverDataValidationPlugin } from '@univerjs/data-validation';
import { UniverSheetsPlugin } from '@univerjs/sheets';
import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
-import { SheetsDataValidationMobileRenderController } from './controllers/dv-render.controller';
-import { DataValidationController } from './controllers/dv.controller';
-import { DataValidationAlertController } from './controllers/dv-alert.controller';
-import { AddSheetDataValidationAndOpenCommand, AddSheetDataValidationCommand, UpdateSheetDataValidationRangeCommand } from './commands/commands/data-validation.command';
-import { DataValidationCacheService } from './services/dv-cache.service';
-import { DataValidationFormulaService } from './services/dv-formula.service';
-import { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
-import { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';
-import { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
-import { DataValidationCopyPasteController } from './controllers/dv-copy-paste.controller';
-import { DataValidationModelController } from './controllers/dv-model.controller';
-import { DataValidationDropdownManagerService } from './services/dropdown-manager.service';
+import { AddSheetDataValidationAndOpenCommand, AddSheetDataValidationCommand, ClearRangeDataValidationCommand, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand } from './commands/commands/data-validation.command';
import { CloseValidationPanelOperation, HideDataValidationDropdown, OpenValidationPanelOperation, ShowDataValidationDropdown, ToggleValidationPanelOperation } from './commands/operations/data-validation.operation';
-import { DataValidationPanelService } from './services/data-validation-panel.service';
-import { DataValidationFormulaController } from './controllers/dv-formula.controller';
-import { DataValidationPermissionController } from './controllers/dv-permission.controller';
-import { SheetsDataValidationValidatorService } from './services/dv-validator-service';
+import { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
import {
defaultPluginConfig,
type IUniverSheetsDataValidationConfig,
PLUGIN_CONFIG_KEY,
} from './controllers/config.schema';
+import { DataValidationController } from './controllers/dv.controller';
+import { DataValidationAlertController } from './controllers/dv-alert.controller';
+import { DataValidationCopyPasteController } from './controllers/dv-copy-paste.controller';
+import { DataValidationFormulaController } from './controllers/dv-formula.controller';
+import { DataValidationPermissionController } from './controllers/dv-permission.controller';
+import { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';
+import { SheetsDataValidationMobileRenderController } from './controllers/dv-render.controller';
+import { SheetDataValidationModel } from './models/sheet-data-validation-model';
+import { DataValidationPanelService } from './services/data-validation-panel.service';
+import { DataValidationDropdownManagerService } from './services/dropdown-manager.service';
+import { DataValidationCacheService } from './services/dv-cache.service';
+import { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
+import { DataValidationFormulaService } from './services/dv-formula.service';
+import { SheetsDataValidationValidatorService } from './services/dv-validator-service';
@DependentOn(UniverDataValidationPlugin, UniverSheetsPlugin, UniverSheetsUIPlugin)
export class UniverSheetsDataValidationMobilePlugin extends Plugin {
@@ -77,9 +77,8 @@ export class UniverSheetsDataValidationMobilePlugin extends Plugin {
[DataValidationCustomFormulaService],
[DataValidationDropdownManagerService],
[SheetsDataValidationValidatorService],
-
+ [SheetDataValidationModel],
// controller
- [DataValidationModelController],
[DataValidationController],
[SheetsDataValidationMobileRenderController],
[DataValidationAlertController],
@@ -95,6 +94,11 @@ export class UniverSheetsDataValidationMobilePlugin extends Plugin {
AddSheetDataValidationCommand,
AddSheetDataValidationAndOpenCommand,
UpdateSheetDataValidationRangeCommand,
+ UpdateSheetDataValidationSettingCommand,
+ UpdateSheetDataValidationOptionsCommand,
+ RemoveSheetDataValidationCommand,
+ RemoveSheetAllDataValidationCommand,
+ ClearRangeDataValidationCommand,
// operation
ShowDataValidationDropdown,
diff --git a/packages/sheets-data-validation/src/models/sheet-data-validation-manager.ts b/packages/sheets-data-validation/src/models/sheet-data-validation-manager.ts
deleted file mode 100644
index 35738bb66e..0000000000
--- a/packages/sheets-data-validation/src/models/sheet-data-validation-manager.ts
+++ /dev/null
@@ -1,202 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import type { ICellDataForSheetInterceptor, Injector, ISheetDataValidationRule, Nullable, Workbook } from '@univerjs/core';
-import { DataValidationManager, DataValidatorRegistryService, UpdateRuleType } from '@univerjs/data-validation';
-import { DataValidationStatus, DataValidationType, IUniverInstanceService, ObjectMatrix, UniverInstanceType } from '@univerjs/core';
-import type { IUpdateRulePayload } from '@univerjs/data-validation';
-import type { ISheetLocation } from '@univerjs/sheets';
-import { isReferenceString } from '@univerjs/engine-formula';
-import type { IDataValidationResCache } from '../services/dv-cache.service';
-import { DataValidationCacheService } from '../services/dv-cache.service';
-import { DataValidationFormulaService } from '../services/dv-formula.service';
-import { DataValidationCustomFormulaService } from '../services/dv-custom-formula.service';
-import { getCellValueOrigin } from '../utils/get-cell-data-origin';
-import { RuleMatrix } from './rule-matrix';
-
-export class SheetDataValidationManager extends DataValidationManager<ISheetDataValidationRule> {
- /**
- * save cell's ruleId
- */
- private _ruleMatrix: RuleMatrix;
- private _dataValidatorRegistryService: DataValidatorRegistryService;
- private _dataValidationCacheService: DataValidationCacheService;
- private _dataValidationFormulaService: DataValidationFormulaService;
- private _dataValidationCustomFormulaService: DataValidationCustomFormulaService;
- private _cache: ObjectMatrix<Nullable<IDataValidationResCache>>;
-
- constructor(
- unitId: string,
- subUnitId: string,
- private readonly _injector: Injector
- ) {
- super(unitId, subUnitId);
- this._dataValidatorRegistryService = this._injector.get(DataValidatorRegistryService);
- this._dataValidationCacheService = this._injector.get(DataValidationCacheService);
- this._dataValidationFormulaService = this._injector.get(DataValidationFormulaService);
- this._dataValidationCustomFormulaService = this._injector.get(DataValidationCustomFormulaService);
- this._cache = this._dataValidationCacheService.ensureCache(unitId, subUnitId);
-
- const univerInstanceService = this._injector.get(IUniverInstanceService);
- const worksheet = univerInstanceService.getUnit<Workbook>(unitId, UniverInstanceType.UNIVER_SHEET)!.getSheetBySheetId(subUnitId)!;
- const matrix = new ObjectMatrix<string>();
-
- this._ruleMatrix = new RuleMatrix(matrix, worksheet);
- }
-
- private _addRuleSideEffect(rule: ISheetDataValidationRule) {
- const { unitId, subUnitId } = this;
-
- if (rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) {
- if (isReferenceString(rule.formula1 ?? '')) {
- // polyfill old-version ref-string, transform to formula
- rule.formula1 = `=${rule.formula1}`;
- }
- }
-
- this._ruleMatrix.addRule(rule);
- this._dataValidationCacheService.addRule(unitId, subUnitId, rule);
- this._dataValidationFormulaService.addRule(unitId, subUnitId, rule.uid, rule.formula1, rule.formula2);
- this._dataValidationCustomFormulaService.addRule(unitId, subUnitId, rule);
- }
-
- override addRule(rule: ISheetDataValidationRule | ISheetDataValidationRule[], index?: number): void {
- const rules = Array.isArray(rule) ? rule : [rule];
-
- rules.forEach((item) => {
- this._addRuleSideEffect(item);
- });
-
- super.addRule(rule, index);
- }
-
- override updateRule(ruleId: string, payload: IUpdateRulePayload) {
- const oldRule = this.getRuleById(ruleId);
-
- if (!oldRule) {
- throw new Error(`Rule not found! id: ${ruleId}`);
- }
-
- if (payload.type === UpdateRuleType.RANGE) {
- this._ruleMatrix.updateRange(ruleId, oldRule.ranges, payload.payload);
- this._dataValidationCacheService.updateRuleRanges(this.unitId, this.subUnitId, ruleId, payload.payload, oldRule.ranges);
- this._dataValidationCustomFormulaService.updateRuleRanges(this.unitId, this.subUnitId, ruleId, oldRule.ranges, payload.payload);
- } else if (payload.type === UpdateRuleType.SETTING) {
- this._dataValidationCacheService.markRangeDirty(this.unitId, this.subUnitId, oldRule.ranges);
- this._dataValidationFormulaService.updateRuleFormulaText(this.unitId, this.subUnitId, ruleId, payload.payload.formula1, payload.payload.formula2);
- this._dataValidationCustomFormulaService.updateRuleFormula(this.unitId, this.subUnitId, ruleId, oldRule.ranges, payload.payload.formula1!);
- }
-
- return super.updateRule(ruleId, payload);
- }
-
- override removeRule(ruleId: string): void {
- const oldRule = this.getRuleById(ruleId);
- if (oldRule) {
- this._ruleMatrix.removeRule(oldRule);
- this._dataValidationCacheService.removeRule(this.unitId, this.subUnitId, oldRule);
- }
- super.removeRule(ruleId);
- }
-
- getValidator(type: DataValidationType) {
- return this._dataValidatorRegistryService.getValidatorItem(type);
- }
-
- getRuleIdByLocation(row: number, col: number): string | undefined {
- return this._ruleMatrix.getValue(row, col);
- }
-
- getRuleByLocation(row: number, col: number): ISheetDataValidationRule | undefined {
- const ruleId = this.getRuleIdByLocation(row, col);
- if (!ruleId) {
- return undefined;
- }
-
- return this.getRuleById(ruleId);
- }
-
- override validator(cell: Nullable<ICellDataForSheetInterceptor>, rule: ISheetDataValidationRule, pos: ISheetLocation, onCompete: (status: DataValidationStatus, changed: boolean) => void): DataValidationStatus {
- const { col, row, unitId, subUnitId, worksheet } = pos;
- const ruleId = rule.uid;
- const validator = this.getValidator(rule.type);
- const cellRaw = worksheet.getCellRaw(row, col);
- const cellValue = getCellValueOrigin(cellRaw);
- const interceptValue = getCellValueOrigin(cell);
-
- if (validator) {
- const current = this._cache.getValue(row, col);
- if (!current || current.value !== cellValue || current.interceptValue !== interceptValue || current.ruleId !== ruleId) {
- this._cache.setValue(row, col, {
- value: cellValue,
- interceptValue,
- status: DataValidationStatus.VALIDATING,
- ruleId,
- });
- validator.validator(
- {
- value: cellValue,
- unitId,
- subUnitId,
- row,
- column: col,
- worksheet: pos.worksheet,
- workbook: pos.workbook,
- interceptValue: getCellValueOrigin(cell),
- t: cellRaw?.t,
- },
- rule
- ).then((status) => {
- const realStatus = status ? DataValidationStatus.VALID : DataValidationStatus.INVALID;
- this._cache.setValue(row, col, {
- value: cellValue,
- status: realStatus,
- ruleId,
- interceptValue,
- });
- onCompete(realStatus, true);
- });
- return DataValidationStatus.VALIDATING;
- }
- onCompete(current.status, false);
- return current.status;
- } else {
- onCompete(DataValidationStatus.VALID, false);
- return DataValidationStatus.VALID;
- }
- }
-
- getRuleErrorMsg(ruleId: string) {
- const rule = this.getRuleById(ruleId);
- if (!rule) {
- return '';
- }
- const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
- if (rule.error) {
- return rule.error;
- }
-
- if (validator) {
- return validator.getRuleFinalError(rule);
- }
-
- return '';
- }
-
- getRuleObjectMatrix() {
- return this._ruleMatrix;
- }
-}
diff --git a/packages/sheets-data-validation/src/models/sheet-data-validation-model.ts b/packages/sheets-data-validation/src/models/sheet-data-validation-model.ts
new file mode 100644
index 0000000000..0b01847518
--- /dev/null
+++ b/packages/sheets-data-validation/src/models/sheet-data-validation-model.ts
@@ -0,0 +1,285 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { ICellDataForSheetInterceptor, ISheetDataValidationRule, Nullable, Workbook } from '@univerjs/core';
+import { DataValidationStatus, DataValidationType, Disposable, Inject, IUniverInstanceService, LifecycleStages, ObjectMatrix, OnLifecycle, UniverInstanceType } from '@univerjs/core';
+import type { IRuleChange, IUpdateRulePayload, IValidStatusChange } from '@univerjs/data-validation';
+import { DataValidationModel, DataValidatorRegistryService, UpdateRuleType } from '@univerjs/data-validation';
+import { isReferenceString } from '@univerjs/engine-formula';
+import type { ISheetLocation } from '@univerjs/sheets';
+import { Subject } from 'rxjs';
+import { DataValidationCacheService } from '../services/dv-cache.service';
+import { DataValidationCustomFormulaService } from '../services/dv-custom-formula.service';
+import { DataValidationFormulaService } from '../services/dv-formula.service';
+import { getCellValueOrigin } from '../utils/get-cell-data-origin';
+import { RuleMatrix } from './rule-matrix';
+
+@OnLifecycle(LifecycleStages.Starting, SheetDataValidationModel)
+export class SheetDataValidationModel extends Disposable {
+ private readonly _ruleMatrixMap = new Map<string, Map<string, RuleMatrix>>();
+ private readonly _validStatusChange$ = new Subject<IValidStatusChange>();
+ private readonly _ruleChange$ = new Subject<IRuleChange>();
+
+ readonly ruleChange$ = this._ruleChange$.asObservable();
+ readonly validStatusChange$ = this._validStatusChange$.asObservable();
+
+ constructor(
+ @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
+ @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
+ @Inject(DataValidatorRegistryService) private _dataValidatorRegistryService: DataValidatorRegistryService,
+ @Inject(DataValidationCacheService) private _dataValidationCacheService: DataValidationCacheService,
+ @Inject(DataValidationFormulaService) private _dataValidationFormulaService: DataValidationFormulaService,
+ @Inject(DataValidationCustomFormulaService) private _dataValidationCustomFormulaService: DataValidationCustomFormulaService
+ ) {
+ super();
+ this._initRuleUpdateListener();
+
+ this.disposeWithMe(() => {
+ this._ruleChange$.complete();
+ this._validStatusChange$.complete();
+ });
+ }
+
+ private _initRuleUpdateListener() {
+ const allRules = this._dataValidationModel.getAll();
+ for (const [unitId, subUnitMap] of allRules) {
+ for (const [subUnitId, rules] of subUnitMap) {
+ for (const rule of rules) {
+ this._ruleChange$.next({
+ type: 'add',
+ unitId,
+ subUnitId,
+ rule,
+ source: 'patched',
+ });
+ this._addRule(unitId, subUnitId, rule);
+ }
+ }
+ }
+
+ this.disposeWithMe(
+ this._dataValidationModel.ruleChange$.subscribe((ruleChange) => {
+ this._ruleChange$.next(ruleChange);
+ switch (ruleChange.type) {
+ case 'add':
+ this._addRule(ruleChange.unitId, ruleChange.subUnitId, ruleChange.rule);
+ break;
+ case 'update':
+ this._updateRule(ruleChange.unitId, ruleChange.subUnitId, ruleChange.rule.uid, ruleChange.oldRule!, ruleChange.updatePayload!);
+ break;
+ case 'remove':
+ this._removeRule(ruleChange.unitId, ruleChange.subUnitId, ruleChange.rule);
+ break;
+ }
+ })
+ );
+ }
+
+ private _ensureRuleMatrix(unitId: string, subUnitId: string) {
+ let unitMap = this._ruleMatrixMap.get(unitId);
+ const workbook = this._univerInstanceService.getUnit<Workbook>(unitId, UniverInstanceType.UNIVER_SHEET);
+ if (!workbook) {
+ throw new Error(`workbook not found, unitId: ${unitId}`);
+ }
+ if (!unitMap) {
+ unitMap = new Map();
+ this._ruleMatrixMap.set(unitId, unitMap);
+ }
+ const worksheet = workbook.getSheetBySheetId(subUnitId);
+ if (!worksheet) {
+ throw new Error(`worksheet not found, unitId: ${unitId}, subUnitId: ${subUnitId}`);
+ }
+ let matrix = unitMap.get(subUnitId);
+ if (!matrix) {
+ matrix = new RuleMatrix(new ObjectMatrix(), worksheet);
+ unitMap.set(subUnitId, matrix);
+ }
+
+ return matrix;
+ }
+
+ private _addRuleSideEffect(unitId: string, subUnitId: string, rule: ISheetDataValidationRule) {
+ if (rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE) {
+ if (isReferenceString(rule.formula1 ?? '')) {
+ // polyfill old-version ref-string, transform to formula
+ rule.formula1 = `=${rule.formula1}`;
+ }
+ }
+ const ruleMatrix = this._ensureRuleMatrix(unitId, subUnitId);
+ ruleMatrix.addRule(rule);
+ this._dataValidationCacheService.addRule(unitId, subUnitId, rule);
+ this._dataValidationFormulaService.addRule(unitId, subUnitId, rule.uid, rule.formula1, rule.formula2);
+ this._dataValidationCustomFormulaService.addRule(unitId, subUnitId, rule);
+ }
+
+ private _addRule(unitId: string, subUnitId: string, rule: ISheetDataValidationRule | ISheetDataValidationRule[], index?: number): void {
+ const rules = Array.isArray(rule) ? rule : [rule];
+
+ rules.forEach((item) => {
+ this._addRuleSideEffect(unitId, subUnitId, item);
+ });
+ }
+
+ private _updateRule(unitId: string, subUnitId: string, ruleId: string, oldRule: ISheetDataValidationRule, payload: IUpdateRulePayload) {
+ const ruleMatrix = this._ensureRuleMatrix(unitId, subUnitId);
+ if (payload.type === UpdateRuleType.RANGE) {
+ ruleMatrix.updateRange(ruleId, oldRule.ranges, payload.payload);
+ this._dataValidationCacheService.updateRuleRanges(unitId, subUnitId, ruleId, payload.payload, oldRule.ranges);
+ this._dataValidationCustomFormulaService.updateRuleRanges(unitId, subUnitId, ruleId, oldRule.ranges, payload.payload);
+ } else if (payload.type === UpdateRuleType.SETTING) {
+ this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, oldRule.ranges);
+ this._dataValidationFormulaService.updateRuleFormulaText(unitId, subUnitId, ruleId, payload.payload.formula1, payload.payload.formula2);
+ this._dataValidationCustomFormulaService.updateRuleFormula(unitId, subUnitId, ruleId, oldRule.ranges, payload.payload.formula1!);
+ }
+ }
+
+ private _removeRule(unitId: string, subUnitId: string, oldRule: ISheetDataValidationRule): void {
+ const ruleMatrix = this._ensureRuleMatrix(unitId, subUnitId);
+ ruleMatrix.removeRule(oldRule);
+ this._dataValidationCacheService.removeRule(unitId, subUnitId, oldRule);
+ }
+
+ getValidator(type: DataValidationType) {
+ return this._dataValidatorRegistryService.getValidatorItem(type);
+ }
+
+ getRuleIdByLocation(unitId: string, subUnitId: string, row: number, col: number): string | undefined {
+ const ruleMatrix = this._ensureRuleMatrix(unitId, subUnitId);
+ return ruleMatrix.getValue(row, col);
+ }
+
+ getRuleByLocation(unitId: string, subUnitId: string, row: number, col: number): ISheetDataValidationRule | undefined {
+ const ruleId = this.getRuleIdByLocation(unitId, subUnitId, row, col);
+ if (!ruleId) {
+ return undefined;
+ }
+
+ return this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
+ }
+
+ validator(cell: Nullable<ICellDataForSheetInterceptor>, rule: ISheetDataValidationRule, pos: ISheetLocation, _onCompete?: (status: DataValidationStatus, changed: boolean) => void): DataValidationStatus {
+ const { col, row, unitId, subUnitId, worksheet } = pos;
+ const ruleId = rule.uid;
+ const onCompete = (status: DataValidationStatus, changed: boolean) => {
+ if (_onCompete) {
+ _onCompete(status, changed);
+ }
+ if (changed) {
+ this._validStatusChange$.next({
+ unitId,
+ subUnitId,
+ ruleId: rule.uid,
+ status,
+ });
+ }
+ };
+ const validator = this.getValidator(rule.type);
+ const cellRaw = worksheet.getCellRaw(row, col);
+ const cellValue = getCellValueOrigin(cellRaw);
+ const interceptValue = getCellValueOrigin(cell);
+
+ if (validator) {
+ const cache = this._dataValidationCacheService.ensureCache(unitId, subUnitId);
+ const current = cache.getValue(row, col);
+ if (!current || current.value !== cellValue || current.interceptValue !== interceptValue || current.ruleId !== ruleId) {
+ cache.setValue(row, col, {
+ value: cellValue,
+ interceptValue,
+ status: DataValidationStatus.VALIDATING,
+ ruleId,
+ });
+ validator.validator(
+ {
+ value: cellValue,
+ unitId,
+ subUnitId,
+ row,
+ column: col,
+ worksheet: pos.worksheet,
+ workbook: pos.workbook,
+ interceptValue: getCellValueOrigin(cell),
+ t: cellRaw?.t,
+ },
+ rule
+ ).then((status) => {
+ const realStatus = status ? DataValidationStatus.VALID : DataValidationStatus.INVALID;
+ cache.setValue(row, col, {
+ value: cellValue,
+ status: realStatus,
+ ruleId,
+ interceptValue,
+ });
+ onCompete(realStatus, true);
+ });
+ return DataValidationStatus.VALIDATING;
+ }
+ onCompete(current.status, false);
+ return current.status;
+ } else {
+ onCompete(DataValidationStatus.VALID, false);
+ return DataValidationStatus.VALID;
+ }
+ }
+
+ getRuleErrorMsg(unitId: string, subUnitId: string, ruleId: string) {
+ const rule = this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
+ if (!rule) {
+ return '';
+ }
+ const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
+ if (rule.error) {
+ return rule.error;
+ }
+
+ if (validator) {
+ return validator.getRuleFinalError(rule);
+ }
+
+ return '';
+ }
+
+ getRuleObjectMatrix(unitId: string, subUnitId: string) {
+ return this._ensureRuleMatrix(unitId, subUnitId);
+ }
+
+ getRuleById(unitId: string, subUnitId: string, ruleId: string): ISheetDataValidationRule | undefined {
+ return this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
+ }
+
+ getRuleIndex(unitId: string, subUnitId: string, ruleId: string) {
+ return this._dataValidationModel.getRuleIndex(unitId, subUnitId, ruleId);
+ }
+
+ getRules(unitId: string, subUnitId: string): ISheetDataValidationRule[] {
+ return [...this._dataValidationModel.getRules(unitId, subUnitId)];
+ }
+
+ getUnitRules(unitId: string): [string, ISheetDataValidationRule[]][] {
+ return this._dataValidationModel.getUnitRules(unitId);
+ }
+
+ deleteUnitRules(unitId: string) {
+ return this._dataValidationModel.deleteUnitRules(unitId);
+ }
+
+ getSubUnitIds(unitId: string) {
+ return this._dataValidationModel.getSubUnitIds(unitId);
+ }
+
+ getAll() {
+ return this._dataValidationModel.getAll();
+ }
+}
diff --git a/packages/sheets-data-validation/src/plugin.ts b/packages/sheets-data-validation/src/plugin.ts
index 84a5cc1c6e..f233b1ecc0 100644
--- a/packages/sheets-data-validation/src/plugin.ts
+++ b/packages/sheets-data-validation/src/plugin.ts
@@ -23,31 +23,32 @@ import {
} from '@univerjs/core';
import { type Dependency, Inject, Injector } from '@univerjs/core';
import { UniverDataValidationPlugin } from '@univerjs/data-validation';
-import { UniverSheetsPlugin } from '@univerjs/sheets';
+import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';
import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
-import { SheetsDataValidationRenderController } from './controllers/dv-render.controller';
+import { AddSheetDataValidationAndOpenCommand, AddSheetDataValidationCommand, ClearRangeDataValidationCommand, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand } from './commands/commands/data-validation.command';
+import { CloseValidationPanelOperation, HideDataValidationDropdown, OpenValidationPanelOperation, ShowDataValidationDropdown, ToggleValidationPanelOperation } from './commands/operations/data-validation.operation';
+import { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
+import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
import { DataValidationController } from './controllers/dv.controller';
import { DataValidationAlertController } from './controllers/dv-alert.controller';
-import { AddSheetDataValidationAndOpenCommand, AddSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand } from './commands/commands/data-validation.command';
-import { DataValidationCacheService } from './services/dv-cache.service';
-import { DataValidationFormulaService } from './services/dv-formula.service';
-import { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
-import { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';
-import { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
import { DataValidationAutoFillController } from './controllers/dv-auto-fill.controller';
import { DataValidationCopyPasteController } from './controllers/dv-copy-paste.controller';
-import { DataValidationModelController } from './controllers/dv-model.controller';
-import { DataValidationDropdownManagerService } from './services/dropdown-manager.service';
-import { CloseValidationPanelOperation, HideDataValidationDropdown, OpenValidationPanelOperation, ShowDataValidationDropdown, ToggleValidationPanelOperation } from './commands/operations/data-validation.operation';
-import { DataValidationRejectInputController } from './controllers/dv-reject-input.controller';
-import { DataValidationPanelService } from './services/data-validation-panel.service';
import { DataValidationFormulaController } from './controllers/dv-formula.controller';
import { DataValidationPermissionController } from './controllers/dv-permission.controller';
+import { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';
+import { DataValidationRejectInputController } from './controllers/dv-reject-input.controller';
+import { SheetsDataValidationRenderController } from './controllers/dv-render.controller';
+import { SheetDataValidationSheetController } from './controllers/dv-sheet.controller';
+import { SheetDataValidationModel } from './models/sheet-data-validation-model';
+import { DataValidationPanelService } from './services/data-validation-panel.service';
+import { DataValidationDropdownManagerService } from './services/dropdown-manager.service';
+import { DataValidationCacheService } from './services/dv-cache.service';
+import { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
+import { DataValidationFormulaService } from './services/dv-formula.service';
import { SheetsDataValidationValidatorService } from './services/dv-validator-service';
import type { IUniverSheetsDataValidationConfig } from './controllers/config.schema';
-import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
-@DependentOn(UniverDataValidationPlugin, UniverSheetsPlugin, UniverSheetsUIPlugin)
+@DependentOn(UniverSheetsNumfmtPlugin, UniverDataValidationPlugin, UniverSheetsUIPlugin)
export class UniverSheetsDataValidationPlugin extends Plugin {
static override pluginName = DATA_VALIDATION_PLUGIN_NAME;
static override type = UniverInstanceType.UNIVER_SHEET;
@@ -76,9 +77,8 @@ export class UniverSheetsDataValidationPlugin extends Plugin {
[DataValidationCustomFormulaService],
[DataValidationDropdownManagerService],
[SheetsDataValidationValidatorService],
-
+ [SheetDataValidationModel],
// controller
- [DataValidationModelController],
[DataValidationController],
[SheetsDataValidationRenderController],
[DataValidationAlertController],
@@ -88,6 +88,7 @@ export class UniverSheetsDataValidationPlugin extends Plugin {
[DataValidationCopyPasteController],
[DataValidationFormulaController],
[DataValidationRejectInputController],
+ [SheetDataValidationSheetController],
] as Dependency[]).forEach((dep) => {
this._injector.add(dep);
});
@@ -98,6 +99,9 @@ export class UniverSheetsDataValidationPlugin extends Plugin {
UpdateSheetDataValidationRangeCommand,
UpdateSheetDataValidationSettingCommand,
UpdateSheetDataValidationOptionsCommand,
+ RemoveSheetDataValidationCommand,
+ RemoveSheetAllDataValidationCommand,
+ ClearRangeDataValidationCommand,
// operation
ShowDataValidationDropdown,
diff --git a/packages/sheets-data-validation/src/services/dropdown-manager.service.ts b/packages/sheets-data-validation/src/services/dropdown-manager.service.ts
index 1d3d656840..cf54c2c724 100644
--- a/packages/sheets-data-validation/src/services/dropdown-manager.service.ts
+++ b/packages/sheets-data-validation/src/services/dropdown-manager.service.ts
@@ -19,11 +19,11 @@ import { Disposable, DisposableCollection, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,
import { type ISheetLocation, SheetsSelectionsService } from '@univerjs/sheets';
import { Subject } from 'rxjs';
import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
-import { DataValidationModel, DataValidatorRegistryService } from '@univerjs/data-validation';
+import { DataValidatorRegistryService } from '@univerjs/data-validation';
import { IZenZoneService } from '@univerjs/ui';
import { IRenderManagerService } from '@univerjs/engine-render';
import { DROP_DOWN_KEY } from '../views/drop-down';
-import type { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
+import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
export interface IDropdownParam {
location: ISheetLocation;
@@ -57,7 +57,7 @@ export class DataValidationDropdownManagerService extends Disposable {
@Inject(DataValidatorRegistryService) private readonly _dataValidatorRegistryService: DataValidatorRegistryService,
@IZenZoneService private readonly _zenZoneService: IZenZoneService,
@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
+ @Inject(SheetDataValidationModel) private readonly _dataValidationModel: SheetDataValidationModel,
@Inject(SheetsSelectionsService) private readonly _sheetsSelectionsService: SheetsSelectionsService
) {
super();
@@ -91,8 +91,7 @@ export class DataValidationDropdownManagerService extends Disposable {
return;
}
- const manager = this._dataValidationModel.ensureManager(workbook.getUnitId(), worksheet.getSheetId()) as SheetDataValidationManager;
- const rule = manager.getRuleByLocation(row, col);
+ const rule = this._dataValidationModel.getRuleByLocation(workbook.getUnitId(), worksheet.getSheetId(), row, col);
if (!rule) {
return;
}
@@ -179,8 +178,7 @@ export class DataValidationDropdownManagerService extends Disposable {
return;
}
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- const rule = manager.getRuleByLocation(row, col);
+ const rule = this._dataValidationModel.getRuleByLocation(workbook.getUnitId(), worksheet.getSheetId(), row, col);
if (!rule) {
return;
}
diff --git a/packages/sheets-data-validation/src/services/dv-custom-formula.service.ts b/packages/sheets-data-validation/src/services/dv-custom-formula.service.ts
index 9f762a560b..60243e3fa6 100644
--- a/packages/sheets-data-validation/src/services/dv-custom-formula.service.ts
+++ b/packages/sheets-data-validation/src/services/dv-custom-formula.service.ts
@@ -17,8 +17,8 @@
import type { IRange, ISheetDataValidationRule } from '@univerjs/core';
import { DataValidationType, Disposable, ILogService, Inject, isFormulaString, IUniverInstanceService, ObjectMatrix, Range, UniverInstanceType } from '@univerjs/core';
import { LexerTreeBuilder } from '@univerjs/engine-formula';
-import { DataValidationModel } from '@univerjs/data-validation';
import { RegisterOtherFormulaService } from '@univerjs/sheets-formula';
+import { DataValidationModel } from '@univerjs/data-validation';
import { DataValidationCacheService } from './dv-cache.service';
interface IDataValidationFormula {
@@ -86,11 +86,10 @@ export class DataValidationCustomFormulaService extends Disposable {
for (const subUnitId in unitMap) {
const results = unitMap[subUnitId];
const { formulaCellMap, ruleFormulaMap } = this._ensureMaps(unitId, subUnitId);
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
results.forEach((result) => {
const ruleInfo = ruleFormulaMap.get(result.extra?.ruleId);
const cellInfo = formulaCellMap.get(result.formulaId);
- const rule = manager.getRuleById(result.extra?.ruleId);
+ const rule = this._dataValidationModel.getRuleById(unitId, subUnitId, result.extra?.ruleId);
if (rule && ruleInfo && !ruleInfo.isTransformable) {
this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges);
diff --git a/packages/sheets-data-validation/src/services/dv-formula.service.ts b/packages/sheets-data-validation/src/services/dv-formula.service.ts
index b25ec8cb4c..123e0d3f5f 100644
--- a/packages/sheets-data-validation/src/services/dv-formula.service.ts
+++ b/packages/sheets-data-validation/src/services/dv-formula.service.ts
@@ -16,9 +16,9 @@
import type { Nullable } from '@univerjs/core';
import { Disposable, Inject, isFormulaString, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
-import { DataValidationModel } from '@univerjs/data-validation';
import type { IFormulaInfo, IOtherFormulaResult } from '@univerjs/sheets-formula';
import { RegisterOtherFormulaService } from '@univerjs/sheets-formula';
+import { DataValidationModel } from '@univerjs/data-validation';
import { DataValidationCacheService } from './dv-cache.service';
type RuleId = string;
@@ -49,10 +49,9 @@ export class DataValidationFormulaService extends Disposable {
for (const subUnitId in unitMap) {
const results = unitMap[subUnitId];
const formulaMap = this._ensureRuleFormulaMap(unitId, subUnitId);
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
results.forEach((result) => {
if (formulaMap.get(result.extra?.ruleId)) {
- const rule = manager.getRuleById(result.extra?.ruleId);
+ const rule = this._dataValidationModel.getRuleById(unitId, subUnitId, result.extra?.ruleId);
if (rule) {
this._dataValidationCacheService.markRangeDirty(unitId, subUnitId, rule.ranges);
}
diff --git a/packages/sheets-data-validation/src/services/dv-validator-service.ts b/packages/sheets-data-validation/src/services/dv-validator-service.ts
index a4c0e09bc9..00b9a403f3 100644
--- a/packages/sheets-data-validation/src/services/dv-validator-service.ts
+++ b/packages/sheets-data-validation/src/services/dv-validator-service.ts
@@ -16,15 +16,14 @@
import type { IDataValidationRule, IRange, Nullable, ObjectMatrix, Workbook } from '@univerjs/core';
import { DataValidationStatus, Inject, IUniverInstanceService, Range, Tools, UniverInstanceType } from '@univerjs/core';
-import { DataValidationModel } from '@univerjs/data-validation';
-import type { SheetDataValidationManager } from '../models/sheet-data-validation-manager';
+import { SheetDataValidationModel } from '../models/sheet-data-validation-model';
import type { IDataValidationResCache } from './dv-cache.service';
import { DataValidationCacheService } from './dv-cache.service';
export class SheetsDataValidationValidatorService {
constructor(
@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
- @Inject(DataValidationModel) private readonly _dataValidationModel: DataValidationModel,
+ @Inject(SheetDataValidationModel) private readonly _sheetDataValidationModel: SheetDataValidationModel,
@Inject(DataValidationCacheService) private readonly _dataValidationCacheService: DataValidationCacheService
) {
@@ -45,15 +44,14 @@ export class SheetsDataValidationValidatorService {
throw new Error(`row or col is not defined, row: ${row}, col: ${col}`);
}
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
const cell = worksheet.getCell(row, col);
- const rule = manager.getRuleByLocation(row, col);
+ const rule = this._sheetDataValidationModel.getRuleByLocation(unitId, subUnitId, row, col);
if (!rule) {
return DataValidationStatus.VALID;
}
return new Promise<DataValidationStatus>((resolve) => {
- manager.validator(cell, rule, { unitId, subUnitId, row, col, worksheet, workbook }, resolve);
+ this._sheetDataValidationModel.validator(cell, rule, { unitId, subUnitId, row, col, worksheet, workbook }, resolve);
});
}
@@ -68,8 +66,7 @@ export class SheetsDataValidationValidatorService {
}
async validatorWorksheet(unitId: string, subUnitId: string) {
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- const rules = manager.getDataValidations();
+ const rules = this._sheetDataValidationModel.getRules(unitId, subUnitId);
await Promise.all(rules.map((rule) => {
return Promise.all(rule.ranges.map((range) => {
const promises: Promise<DataValidationStatus>[] = [];
@@ -84,7 +81,7 @@ export class SheetsDataValidationValidatorService {
}
async validatorWorkbook(unitId: string) {
- const sheetIds = this._dataValidationModel.getSubUnitIds(unitId);
+ const sheetIds = this._sheetDataValidationModel.getSubUnitIds(unitId);
const results = await Promise.all(sheetIds.map((id) => this.validatorWorksheet(unitId, id)));
const map: Record<string, ObjectMatrix<Nullable<IDataValidationResCache>>> = {};
@@ -97,8 +94,7 @@ export class SheetsDataValidationValidatorService {
}
getDataValidations(unitId: string, subUnitId: string, ranges: IRange[]): IDataValidationRule[] {
- const manager = this._dataValidationModel.ensureManager(unitId, subUnitId) as SheetDataValidationManager;
- const ruleMatrix = manager.getRuleObjectMatrix();
+ const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(unitId, subUnitId);
const ruleIdSet = new Set<string>();
ranges.forEach((range) => {
Range.foreach(range, (row, col) => {
@@ -109,7 +105,7 @@ export class SheetsDataValidationValidatorService {
});
});
- const rules = Array.from(ruleIdSet).map((id) => manager.getRuleById(id)).filter(Boolean) as IDataValidationRule[];
+ const rules = Array.from(ruleIdSet).map((id) => this._sheetDataValidationModel.getRuleById(unitId, subUnitId, id)).filter(Boolean) as IDataValidationRule[];
return rules;
}
diff --git a/packages/sheets-data-validation/src/utils/create.ts b/packages/sheets-data-validation/src/utils/create.ts
new file mode 100644
index 0000000000..9784c22c29
--- /dev/null
+++ b/packages/sheets-data-validation/src/utils/create.ts
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import type { IAccessor } from '@univerjs/core';
+import { DataValidationOperator, DataValidationType, Tools } from '@univerjs/core';
+import { SheetsSelectionsService } from '@univerjs/sheets';
+
+export function createDefaultNewRule(accessor: IAccessor) {
+ const selectionManagerService = accessor.get(SheetsSelectionsService);
+ const currentRanges = selectionManagerService.getCurrentSelections().map((s) => s.range);
+ const uid = Tools.generateRandomId(6);
+ const rule = {
+ uid,
+ type: DataValidationType.DECIMAL,
+ operator: DataValidationOperator.EQUAL,
+ formula1: '100',
+ ranges: currentRanges ?? [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }],
+ };
+
+ return rule;
+}
diff --git a/packages/sheets-data-validation/src/validators/checkbox-validator.ts b/packages/sheets-data-validation/src/validators/checkbox-validator.ts
index 7a7977ec21..1107cdc924 100644
--- a/packages/sheets-data-validation/src/validators/checkbox-validator.ts
+++ b/packages/sheets-data-validation/src/validators/checkbox-validator.ts
@@ -15,17 +15,22 @@
*/
import { DataValidationType, isFormulaString, Tools } from '@univerjs/core';
-import type { CellValue, DataValidationOperator, IDataValidationRule, IDataValidationRuleBase, ISheetDataValidationRule, LocaleService, Nullable } from '@univerjs/core';
import { BaseDataValidator } from '@univerjs/data-validation';
+import type { CellValue, DataValidationOperator, IDataValidationRule, IDataValidationRuleBase, ISheetDataValidationRule, LocaleService, Nullable } from '@univerjs/core';
import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
-import { CheckboxRender } from '../widgets/checkbox-widget';
import { DataValidationFormulaService } from '../services/dv-formula.service';
import { getFormulaResult } from '../utils/formula';
import { CHECKBOX_FORMULA_INPUT_NAME } from '../views/formula-input';
+import { CheckboxRender } from '../widgets/checkbox-widget';
export const CHECKBOX_FORMULA_1 = 1;
export const CHECKBOX_FORMULA_2 = 0;
+interface ICheckboxFormulaResult extends IFormulaResult {
+ originFormula1: Nullable<CellValue>;
+ originFormula2: Nullable<CellValue>;
+}
+
function getFailMessage(formula: string | undefined, localeService: LocaleService) {
if (Tools.isBlank(formula)) {
return localeService.t('dataValidation.validFail.value');
@@ -38,6 +43,13 @@ function getFailMessage(formula: string | undefined, localeService: LocaleServic
return '';
}
+export const transformCheckboxValue = (value: Nullable<CellValue>) =>
+ Tools.isDefine(value) && String(value).toLowerCase() === 'true'
+ ? '1'
+ : String(value).toLowerCase() === 'false'
+ ? '0'
+ : value;
+
export class CheckboxValidator extends BaseDataValidator {
override id: string = DataValidationType.CHECKBOX;
override title: string = 'dataValidation.checkbox.title';
@@ -86,32 +98,46 @@ export class CheckboxValidator extends BaseDataValidator {
};
}
- override async parseFormula(rule: IDataValidationRule, unitId: string, subUnitId: string): Promise<IFormulaResult> {
+ override async parseFormula(rule: IDataValidationRule, unitId: string, subUnitId: string): Promise<ICheckboxFormulaResult> {
const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule;
const results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
+ const originFormula1 = isFormulaString(formula1) ? getFormulaResult(results?.[0]?.result) : formula1;
+ const originFormula2 = isFormulaString(formula2) ? getFormulaResult(results?.[1]?.result) : formula2;
return {
- formula1: isFormulaString(formula1) ? getFormulaResult(results?.[0]?.result) : formula1,
- formula2: isFormulaString(formula2) ? getFormulaResult(results?.[1]?.result) : formula2,
+ formula1: transformCheckboxValue(originFormula1),
+ formula2: transformCheckboxValue(originFormula2),
+ originFormula1,
+ originFormula2,
};
}
parseFormulaSync(rule: IDataValidationRule, unitId: string, subUnitId: string) {
const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule;
const results = this._formulaService.getRuleFormulaResultSync(unitId, subUnitId, rule.uid);
+ const originFormula1 = isFormulaString(formula1) ? getFormulaResult(results?.[0]?.result) : formula1;
+ const originFormula2 = isFormulaString(formula2) ? getFormulaResult(results?.[1]?.result) : formula2;
+
return {
- formula1: isFormulaString(formula1) ? getFormulaResult(results?.[0]?.result) : formula1,
- formula2: isFormulaString(formula2) ? getFormulaResult(results?.[1]?.result) : formula2,
+ formula1: transformCheckboxValue(originFormula1),
+ formula2: transformCheckboxValue(originFormula2),
+ originFormula1,
+ originFormula2,
};
}
override async isValidType(cellInfo: IValidatorCellInfo<CellValue>, formula: IFormulaResult, rule: IDataValidationRule): Promise<boolean> {
const { value, unitId, subUnitId } = cellInfo;
- const { formula1, formula2 } = await this.parseFormula(rule, unitId, subUnitId);
+ const { formula1, formula2, originFormula1, originFormula2 } = await this.parseFormula(rule, unitId, subUnitId);
if (!Tools.isDefine(formula1) || !Tools.isDefine(formula2)) {
return true;
}
- return Tools.isDefine(value) && (String(value) === String(formula1) || String(value) === String(formula2));
+ return Tools.isDefine(value) && (
+ String(value) === String(formula1)
+ || String(value) === String(formula2)
+ || String(value) === String(originFormula1 ?? '')
+ || String(value) === String(originFormula2 ?? '')
+ );
}
override generateRuleErrorMessage(rule: IDataValidationRuleBase): string {
diff --git a/packages/sheets-data-validation/src/validators/date-validator.ts b/packages/sheets-data-validation/src/validators/date-validator.ts
index 44199bb16e..337e68017d 100644
--- a/packages/sheets-data-validation/src/validators/date-validator.ts
+++ b/packages/sheets-data-validation/src/validators/date-validator.ts
@@ -133,17 +133,23 @@ export class DateValidator extends BaseDataValidator<number> {
};
}
- override normlizeFormula(rule: IDataValidationRule, unitId: string, subUnitId: string): { formula1: string | undefined; formula2: string | undefined } {
+ override normalizeFormula(rule: IDataValidationRule, _unitId: string, _subUnitId: string): { formula1: string | undefined; formula2: string | undefined } {
const { formula1, formula2, bizInfo } = rule;
const normlizeSingleFormula = (formula: string | undefined) => {
if (!formula) {
return formula;
}
- const res = numfmt.parseDate(formula)?.v as number;
- if (res === undefined || res === null) {
- return '';
+ let date;
+ if (!Number.isNaN(+formula)) {
+ date = numfmt.dateFromSerial(+formula) as unknown as [number, number, number, number, number, number];
+ } else {
+ const res = numfmt.parseDate(formula)?.v as number;
+ if (res === undefined || res === null) {
+ return '';
+ }
+ date = numfmt.dateFromSerial(res) as unknown as [number, number, number, number, number, number];
}
- const date = numfmt.dateFromSerial(res) as unknown as [number, number, number, number, number, number];
+
return dayjs(`${date[0]}/${date[1]}/${date[2]} ${date[3]}:${date[4]}:${date[5]}`).format(bizInfo?.showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD');
};
diff --git a/packages/sheets-data-validation/src/views/date-dropdown/index.tsx b/packages/sheets-data-validation/src/views/date-dropdown/index.tsx
index 5cd69e019e..f2d3862989 100644
--- a/packages/sheets-data-validation/src/views/date-dropdown/index.tsx
+++ b/packages/sheets-data-validation/src/views/date-dropdown/index.tsx
@@ -14,18 +14,19 @@
* limitations under the License.
*/
-import React, { useState } from 'react';
-import type { CellValue, Nullable } from '@univerjs/core';
import { CellValueType, DataValidationErrorStyle, ICommandService, LocaleService, numfmt, useDependency } from '@univerjs/core';
import { Button, DatePanel } from '@univerjs/design';
import { SetRangeValuesCommand } from '@univerjs/sheets';
+import { getPatternType } from '@univerjs/sheets-numfmt';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
-import type { IDropdownComponentProps } from '../../services/dropdown-manager.service';
-import type { DateValidator } from '../../validators';
-import { getCellValueOrigin } from '../../utils/get-cell-data-origin';
+import React, { useState } from 'react';
+import type { CellValue, Nullable } from '@univerjs/core';
import { DataValidationRejectInputController } from '../../controllers/dv-reject-input.controller';
+import { getCellValueOrigin } from '../../utils/get-cell-data-origin';
import styles from './index.module.less';
+import type { IDropdownComponentProps } from '../../services/dropdown-manager.service';
+import type { DateValidator } from '../../validators';
dayjs.extend(utc);
@@ -71,6 +72,9 @@ export function DateDropdown(props: IDropdownComponentProps) {
// convert current date to utc date
const dateStr = newValue.format(showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD 00:00:00');
const serialTime = numfmt.parseDate(dateStr)?.v as number;
+ const cellStyle = workbook.getStyles().getStyleByCell(cellData);
+ const format = cellStyle?.n?.pattern ?? '';
+ const patternType = getPatternType(format);
if (
rule.errorStyle !== DataValidationErrorStyle.STOP ||
@@ -103,7 +107,9 @@ export function DateDropdown(props: IDropdownComponentProps) {
si: null,
s: {
n: {
- pattern: showTime ? 'yyyy-MM-dd hh:mm:ss' : 'yyyy-MM-dd',
+ pattern: showTime
+ ? patternType === 'datetime' ? format : 'yyyy-MM-dd hh:mm:ss'
+ : patternType === 'date' ? format : 'yyyy-MM-dd',
},
},
},
diff --git a/packages/sheets-data-validation/src/views/detail/index.tsx b/packages/sheets-data-validation/src/views/detail/index.tsx
index 3f1609ab97..2f1fe3aa5b 100644
--- a/packages/sheets-data-validation/src/views/detail/index.tsx
+++ b/packages/sheets-data-validation/src/views/detail/index.tsx
@@ -16,13 +16,13 @@
import type { DataValidationOperator, DataValidationType, IDataValidationRuleBase, IDataValidationRuleOptions, IExecutionOptions, ISheetDataValidationRule, IUnitRange } from '@univerjs/core';
import { createInternalEditorID, debounce, ICommandService, isUnitRangesEqual, isValidRange, LocaleService, RedoCommand, shallowEqual, UndoCommand, useDependency } from '@univerjs/core';
-import { DataValidationModel, DataValidatorRegistryScope, DataValidatorRegistryService, getRuleOptions, getRuleSetting, RemoveDataValidationCommand, TWO_FORMULA_OPERATOR_COUNT } from '@univerjs/data-validation';
+import { DataValidationModel, DataValidatorRegistryScope, DataValidatorRegistryService, getRuleOptions, getRuleSetting, TWO_FORMULA_OPERATOR_COUNT } from '@univerjs/data-validation';
import { Button, FormLayout, Select } from '@univerjs/design';
import { ComponentManager, RangeSelector, useEvent, useObservable } from '@univerjs/ui';
import React, { useEffect, useMemo, useState } from 'react';
import { serializeRange } from '@univerjs/engine-formula';
import type { IUpdateSheetDataValidationRangeCommandParams } from '../../commands/commands/data-validation.command';
-import { UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand } from '../../commands/commands/data-validation.command';
+import { RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand } from '../../commands/commands/data-validation.command';
import { DataValidationOptions } from '../options';
import { DataValidationPanelService } from '../../services/data-validation-panel.service';
import styles from './index.module.less';
@@ -34,9 +34,8 @@ const debounceExecuteFactory = (commandService: ICommandService) => debounce(
) => {
const res = await commandService.executeCommand(id, params, options);
callback?.(res);
- }
- ,
- 275
+ },
+ 1000
);
export function DataValidationDetail() {
@@ -140,7 +139,7 @@ export function DataValidationDetail() {
};
const handleDelete = async () => {
- await commandService.executeCommand(RemoveDataValidationCommand.id, {
+ await commandService.executeCommand(RemoveSheetDataValidationCommand.id, {
ruleId,
unitId,
subUnitId,
diff --git a/packages/sheets-data-validation/src/views/item/index.tsx b/packages/sheets-data-validation/src/views/item/index.tsx
index d1044d8f18..ffdb5d62cd 100644
--- a/packages/sheets-data-validation/src/views/item/index.tsx
+++ b/packages/sheets-data-validation/src/views/item/index.tsx
@@ -15,12 +15,13 @@
*/
import { ICommandService, type ISheetDataValidationRule } from '@univerjs/core';
-import { DataValidatorRegistryService, RemoveDataValidationCommand } from '@univerjs/data-validation';
+import { DataValidatorRegistryService } from '@univerjs/data-validation';
import { useDependency } from '@univerjs/core';
import React, { useEffect, useRef, useState } from 'react';
import { serializeRange } from '@univerjs/engine-formula';
import { DeleteSingle } from '@univerjs/icons';
import { IMarkSelectionService } from '@univerjs/sheets-ui';
+import { RemoveSheetDataValidationCommand } from '../../commands/commands/data-validation.command';
import styles from './index.module.less';
export interface IDataValidationDetailProps {
@@ -40,7 +41,7 @@ export const DataValidationItem = (props: IDataValidationDetailProps) => {
const ids = useRef<(string | null)[]>();
const [isHover, setIsHover] = useState(false);
const handleDelete = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
- commandService.executeCommand(RemoveDataValidationCommand.id, {
+ commandService.executeCommand(RemoveSheetDataValidationCommand.id, {
ruleId: rule.uid,
unitId,
subUnitId,
diff --git a/packages/sheets-data-validation/src/views/list-dropdown/index.tsx b/packages/sheets-data-validation/src/views/list-dropdown/index.tsx
index 998aa55469..7b5f07a03f 100644
--- a/packages/sheets-data-validation/src/views/list-dropdown/index.tsx
+++ b/packages/sheets-data-validation/src/views/list-dropdown/index.tsx
@@ -14,27 +14,27 @@
* limitations under the License.
*/
-import type { DocumentDataModel } from '@univerjs/core';
import { DataValidationRenderMode, DataValidationType, ICommandService, IUniverInstanceService, LocaleService, UniverInstanceType, useDependency } from '@univerjs/core';
-import type { ISetRangeValuesCommandParams } from '@univerjs/sheets';
-import { SetRangeValuesCommand } from '@univerjs/sheets';
-import React, { useEffect, useMemo, useState } from 'react';
+import { DataValidationModel } from '@univerjs/data-validation';
+import { RectPopup, Scrollbar } from '@univerjs/design';
+import { RichTextEditingMutation } from '@univerjs/docs';
+import { getPlainTextFormDocument } from '@univerjs/docs-ui';
+import { DeviceInputEventType } from '@univerjs/engine-render';
import { CheckMarkSingle } from '@univerjs/icons';
+import { SetRangeValuesCommand } from '@univerjs/sheets';
import { IEditorBridgeService } from '@univerjs/sheets-ui';
import { KeyCode, useObservable } from '@univerjs/ui';
-import { DeviceInputEventType } from '@univerjs/engine-render';
-import { RectPopup, Scrollbar } from '@univerjs/design';
-import { DataValidationModel } from '@univerjs/data-validation';
+import React, { useEffect, useMemo, useState } from 'react';
import { debounceTime } from 'rxjs';
+import type { DocumentDataModel } from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import { RichTextEditingMutation } from '@univerjs/docs';
-import { getPlainTextFormDocument } from '@univerjs/docs-ui';
-import type { ListMultipleValidator } from '../../validators/list-multiple-validator';
-import { deserializeListOptions, getDataValidationCellValue, serializeListOptions } from '../../validators/util';
-import type { IDropdownComponentProps } from '../../services/dropdown-manager.service';
-import { DROP_DOWN_DEFAULT_COLOR } from '../../common/const';
+import type { ISetRangeValuesCommandParams } from '@univerjs/sheets';
import { OpenValidationPanelOperation } from '../../commands/operations/data-validation.operation';
+import { DROP_DOWN_DEFAULT_COLOR } from '../../common/const';
+import { deserializeListOptions, getDataValidationCellValue, serializeListOptions } from '../../validators/util';
import styles from './index.module.less';
+import type { IDropdownComponentProps } from '../../services/dropdown-manager.service';
+import type { ListMultipleValidator } from '../../validators/list-multiple-validator';
interface ISelectListProps {
value: string[];
diff --git a/packages/sheets-data-validation/src/views/list/index.tsx b/packages/sheets-data-validation/src/views/list/index.tsx
index da5a2bf655..d87a2ed569 100644
--- a/packages/sheets-data-validation/src/views/list/index.tsx
+++ b/packages/sheets-data-validation/src/views/list/index.tsx
@@ -17,14 +17,15 @@
import React, { useEffect, useState } from 'react';
import { ICommandService, Injector, IUniverInstanceService, LocaleService, UniverInstanceType, useDependency } from '@univerjs/core';
import type { ISheetDataValidationRule, Workbook } from '@univerjs/core';
-import { createDefaultNewRule, DataValidationModel, RemoveAllDataValidationCommand } from '@univerjs/data-validation';
import { Button } from '@univerjs/design';
import { useObservable } from '@univerjs/ui';
import { checkRangesEditablePermission } from '@univerjs/sheets';
import { DataValidationItem } from '../item';
import type { IAddSheetDataValidationCommandParams } from '../../commands/commands/data-validation.command';
-import { AddSheetDataValidationCommand } from '../../commands/commands/data-validation.command';
+import { AddSheetDataValidationCommand, RemoveSheetAllDataValidationCommand } from '../../commands/commands/data-validation.command';
import { DataValidationPanelService } from '../../services/data-validation-panel.service';
+import { SheetDataValidationModel } from '../../models/sheet-data-validation-model';
+import { createDefaultNewRule } from '../../utils/create';
import styles from './index.module.less';
export function DataValidationList() {
@@ -41,7 +42,7 @@ export function DataValidationList() {
}
function DataValidationListWithWorkbook(props: { workbook: Workbook }) {
- const dataValidationModel = useDependency(DataValidationModel);
+ const sheetDataValidationModel = useDependency(SheetDataValidationModel);
const univerInstanceService = useDependency(IUniverInstanceService);
const commandService = useDependency(ICommandService);
const injector = useDependency(Injector);
@@ -53,19 +54,20 @@ function DataValidationListWithWorkbook(props: { workbook: Workbook }) {
const worksheet = useObservable(workbook.activeSheet$, undefined, true)!;
const unitId = workbook.getUnitId();
const subUnitId = worksheet?.getSheetId();
- const manager = dataValidationModel.ensureManager(unitId, subUnitId);
useEffect(() => {
- setRules(manager.getDataValidations());
+ setRules(sheetDataValidationModel.getRules(unitId, subUnitId));
- const subscription = manager.dataValidations$.subscribe((currentRules) => {
- setRules([...currentRules]);
+ const subscription = sheetDataValidationModel.ruleChange$.subscribe((change) => {
+ if (change.unitId === unitId && change.subUnitId === subUnitId) {
+ setRules(sheetDataValidationModel.getRules(unitId, subUnitId));
+ }
});
return () => {
subscription.unsubscribe();
};
- }, [manager]);
+ }, [unitId, subUnitId, sheetDataValidationModel]);
const handleAddRule = async () => {
const rule = createDefaultNewRule(injector);
@@ -83,7 +85,7 @@ function DataValidationListWithWorkbook(props: { workbook: Workbook }) {
};
const handleRemoveAll = () => {
- commandService.executeCommand(RemoveAllDataValidationCommand.id, {
+ commandService.executeCommand(RemoveSheetAllDataValidationCommand.id, {
unitId,
subUnitId,
});
diff --git a/packages/sheets-data-validation/src/widgets/checkbox-widget.ts b/packages/sheets-data-validation/src/widgets/checkbox-widget.ts
index f6c36186d5..18d185fcea 100644
--- a/packages/sheets-data-validation/src/widgets/checkbox-widget.ts
+++ b/packages/sheets-data-validation/src/widgets/checkbox-widget.ts
@@ -22,7 +22,7 @@ import type { ISetRangeValuesCommandParams } from '@univerjs/sheets';
import { SetRangeValuesCommand } from '@univerjs/sheets';
import type { BaseDataValidator, IBaseDataValidationWidget, IFormulaResult } from '@univerjs/data-validation';
import type { CheckboxValidator } from '../validators/checkbox-validator';
-import { CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2 } from '../validators/checkbox-validator';
+import { CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2, transformCheckboxValue } from '../validators/checkbox-validator';
import { DataValidationFormulaService } from '../services/dv-formula.service';
import { getFormulaResult } from '../utils/formula';
import { getCellValueOrigin } from '../utils/get-cell-data-origin';
@@ -191,7 +191,7 @@ export class CheckboxRender implements IBaseDataValidationWidget {
endRow: primaryWithCoord.actualRow,
},
value: {
- v: String(value) === String(formula1) ? formula2 : formula1,
+ v: String(value) === transformCheckboxValue(String(formula1)) ? formula2 : formula1,
p: null,
},
};
diff --git a/packages/sheets-drawing-ui/src/controllers/sheet-drawing-update.controller.ts b/packages/sheets-drawing-ui/src/controllers/sheet-drawing-update.controller.ts
index 5b7c775dc2..3d21745d8a 100644
--- a/packages/sheets-drawing-ui/src/controllers/sheet-drawing-update.controller.ts
+++ b/packages/sheets-drawing-ui/src/controllers/sheet-drawing-update.controller.ts
@@ -14,26 +14,26 @@
* limitations under the License.
*/
-import type { IRange, Nullable, Workbook } from '@univerjs/core';
import { Disposable, FOCUSING_COMMON_DRAWINGS, ICommandService, IContextService, Inject, LocaleService } from '@univerjs/core';
-import type { IImageData, IImageIoServiceParam } from '@univerjs/drawing';
+import { MessageType } from '@univerjs/design';
import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_ALLOW_SIZE, DRAWING_IMAGE_COUNT_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_WIDTH_LIMIT, DrawingTypeEnum, getImageSize, IDrawingManagerService, IImageIoService, ImageUploadStatusType } from '@univerjs/drawing';
-import type { ISheetDrawing, ISheetDrawingPosition } from '@univerjs/sheets-drawing';
-import { ISheetDrawingService } from '@univerjs/sheets-drawing';
-import type { WorkbookSelections } from '@univerjs/sheets';
import { SheetsSelectionsService } from '@univerjs/sheets';
+import { ISheetDrawingService } from '@univerjs/sheets-drawing';
import { attachRangeWithCoord, ISheetSelectionRenderService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
import { ILocalFileService, IMessageService } from '@univerjs/ui';
-import { MessageType } from '@univerjs/design';
+import type { IRange, Nullable, Workbook } from '@univerjs/core';
+import type { IImageData, IImageIoServiceParam } from '@univerjs/drawing';
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
+import type { WorkbookSelections } from '@univerjs/sheets';
+import type { ISheetDrawing, ISheetDrawingPosition } from '@univerjs/sheets-drawing';
+import { drawingPositionToTransform, transformToDrawingPosition } from '../basics/transform-position';
+import { GroupSheetDrawingCommand } from '../commands/commands/group-sheet-drawing.command';
import { InsertSheetDrawingCommand } from '../commands/commands/insert-sheet-drawing.command';
-import type { IInsertDrawingCommandParams, ISetDrawingCommandParams } from '../commands/commands/interfaces';
-import { SetSheetDrawingCommand } from '../commands/commands/set-sheet-drawing.command';
-import type { ISetDrawingArrangeCommandParams } from '../commands/commands/set-drawing-arrange.command';
import { SetDrawingArrangeCommand } from '../commands/commands/set-drawing-arrange.command';
-import { GroupSheetDrawingCommand } from '../commands/commands/group-sheet-drawing.command';
+import { SetSheetDrawingCommand } from '../commands/commands/set-sheet-drawing.command';
import { UngroupSheetDrawingCommand } from '../commands/commands/ungroup-sheet-drawing.command';
-import { drawingPositionToTransform, transformToDrawingPosition } from '../basics/transform-position';
+import type { IInsertDrawingCommandParams, ISetDrawingCommandParams } from '../commands/commands/interfaces';
+import type { ISetDrawingArrangeCommandParams } from '../commands/commands/set-drawing-arrange.command';
export class SheetDrawingUpdateController extends Disposable implements IRenderModule {
private readonly _workbookSelections: WorkbookSelections;
diff --git a/packages/sheets-filter/src/controllers/sheets-filter.controller.ts b/packages/sheets-filter/src/controllers/sheets-filter.controller.ts
index a5764d7b97..5f2b32c2ed 100644
--- a/packages/sheets-filter/src/controllers/sheets-filter.controller.ts
+++ b/packages/sheets-filter/src/controllers/sheets-filter.controller.ts
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-import type { ICellData, ICommandInfo, IMutationInfo, IObjectArrayPrimitiveType, IRange, Nullable, Workbook } from '@univerjs/core';
import { Disposable, DisposableCollection, ICommandService, Inject, IUniverInstanceService, moveMatrixArray, Rectangle } from '@univerjs/core';
-import type { EffectRefRangeParams, IAddWorksheetMergeMutationParams, IInsertColCommandParams, IInsertRowCommandParams, IInsertRowMutationParams, IMoveColsCommandParams, IMoveRangeCommandParams, IMoveRowsCommandParams, IRemoveColMutationParams, IRemoveRowsMutationParams, IRemoveSheetCommandParams, ISetRangeValuesMutationParams, ISetWorksheetActivateCommandParams, ISheetCommandSharedParams } from '@univerjs/sheets';
import { EffectRefRangId, expandToContinuousRange, getSheetCommandTarget, InsertColCommand, InsertRowCommand, InsertRowMutation, INTERCEPTOR_POINT, MoveRangeCommand, MoveRowsCommand, RefRangeService, RemoveColCommand, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, SetRangeValuesMutation, SetWorksheetActivateCommand, SheetInterceptorService } from '@univerjs/sheets';
+import type { ICellData, ICommandInfo, IMutationInfo, IObjectArrayPrimitiveType, IRange, Nullable, Workbook } from '@univerjs/core';
+import type { EffectRefRangeParams, IAddWorksheetMergeMutationParams, IInsertColCommandParams, IInsertRowCommandParams, IInsertRowMutationParams, IMoveColsCommandParams, IMoveRangeCommandParams, IMoveRowsCommandParams, IRemoveColMutationParams, IRemoveRowsMutationParams, IRemoveSheetCommandParams, ISetRangeValuesMutationParams, ISetWorksheetActivateCommandParams, ISheetCommandSharedParams } from '@univerjs/sheets';
+import { ReCalcSheetsFilterMutation, RemoveSheetsFilterMutation, SetSheetsFilterCriteriaMutation, SetSheetsFilterRangeMutation } from '../commands/mutations/sheets-filter.mutation';
import { SheetsFilterService } from '../services/sheet-filter.service';
+import { mergeSetFilterCriteria } from '../utils';
import type { ISetSheetsFilterCriteriaMutationParams, ISetSheetsFilterRangeMutationParams } from '../commands/mutations/sheets-filter.mutation';
-import { ReCalcSheetsFilterMutation, RemoveSheetsFilterMutation, SetSheetsFilterCriteriaMutation, SetSheetsFilterRangeMutation } from '../commands/mutations/sheets-filter.mutation';
import type { FilterColumn } from '../models/filter-model';
-import { mergeSetFilterCriteria } from '../utils';
export class SheetsFilterController extends Disposable {
private _disposableCollection: DisposableCollection = new DisposableCollection();
diff --git a/packages/sheets-formula/src/views/prompt/help-function/HelpFunction.tsx b/packages/sheets-formula/src/views/prompt/help-function/HelpFunction.tsx
index ce3ade4ea3..d06a7993ae 100644
--- a/packages/sheets-formula/src/views/prompt/help-function/HelpFunction.tsx
+++ b/packages/sheets-formula/src/views/prompt/help-function/HelpFunction.tsx
@@ -16,17 +16,17 @@
import { IUniverInstanceService, LocaleService, useDependency, useInjector } from '@univerjs/core';
import { Popup } from '@univerjs/design';
-import type { IFunctionInfo, IFunctionParam } from '@univerjs/engine-formula';
import { CloseSingle, DetailsSingle, MoreSingle } from '@univerjs/icons';
+import { IEditorService, ILayoutService, ISidebarService } from '@univerjs/ui';
import React, { useEffect, useState } from 'react';
-import { IEditorService, ILayoutService, ISidebarService } from '@univerjs/ui';
import { throttleTime } from 'rxjs';
-import type { IHelpFunctionOperationParams } from '../../../services/prompt.service';
+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-hyper-link-ui/src/controllers/set-range.controller.ts b/packages/sheets-hyper-link-ui/src/controllers/set-range.controller.ts
index a74c2ecdd8..595b1b3660 100644
--- a/packages/sheets-hyper-link-ui/src/controllers/set-range.controller.ts
+++ b/packages/sheets-hyper-link-ui/src/controllers/set-range.controller.ts
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-import type { IMutationInfo, Workbook } from '@univerjs/core';
import { CellValueType, CustomRangeType, Disposable, Inject, Injector, IUniverInstanceService, LifecycleStages, ObjectMatrix, OnLifecycle, Range, Tools, UniverInstanceType } from '@univerjs/core';
-import type { ISetRangeValuesMutationParams } from '@univerjs/sheets';
+import { getPlainTextFormDocument } from '@univerjs/docs-ui';
import { ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, getSheetCommandTarget, SetRangeValuesCommand, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';
import { AddHyperLinkMutation, HyperLinkModel, RemoveHyperLinkMutation } from '@univerjs/sheets-hyper-link';
import { IEditorBridgeService } from '@univerjs/sheets-ui';
-import { getPlainTextFormDocument } from '@univerjs/docs-ui';
+import type { IMutationInfo, Workbook } from '@univerjs/core';
+import type { ISetRangeValuesMutationParams } from '@univerjs/sheets';
+import { AddHyperLinkCommand } from '../commands/commands/add-hyper-link.command';
+import { UpdateHyperLinkCommand } from '../commands/commands/update-hyper-link.command';
import { isLegalLink, serializeUrl } from '../common/util';
import type { IAddHyperLinkCommandParams } from '../commands/commands/add-hyper-link.command';
-import { AddHyperLinkCommand } from '../commands/commands/add-hyper-link.command';
import type { IUpdateHyperLinkCommandParams } from '../commands/commands/update-hyper-link.command';
-import { UpdateHyperLinkCommand } from '../commands/commands/update-hyper-link.command';
@OnLifecycle(LifecycleStages.Starting, SheetHyperLinkSetRangeController)
export class SheetHyperLinkSetRangeController extends Disposable {
diff --git a/packages/sheets-numfmt/src/components/more-numfmt-type/MoreNumfmtType.tsx b/packages/sheets-numfmt/src/components/more-numfmt-type/MoreNumfmtType.tsx
index 4ebff171b6..2db35984f5 100644
--- a/packages/sheets-numfmt/src/components/more-numfmt-type/MoreNumfmtType.tsx
+++ b/packages/sheets-numfmt/src/components/more-numfmt-type/MoreNumfmtType.tsx
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-// FIXME: DO NOT USE GLOBAL STYLES
-import './index.less';
-
import { ICommandService, LocaleService, Range, useDependency, useInjector } from '@univerjs/core';
-import type { FormatType } from '@univerjs/sheets';
+
import { SheetsSelectionsService } from '@univerjs/sheets';
+import { ILayoutService } from '@univerjs/ui';
import React from 'react';
+import type { FormatType } from '@univerjs/sheets';
-import { ILayoutService } from '@univerjs/ui';
import { MENU_OPTIONS } from '../../base/const/MENU-OPTIONS';
import { SetNumfmtCommand } from '../../commands/commands/set-numfmt.command';
import { OpenNumfmtPanelOperator } from '../../commands/operations/open.numfmt.panel.operation';
import { getPatternPreview, getPatternType } from '../../utils/pattern';
+// FIXME: DO NOT USE GLOBAL STYLES
+import './index.less';
export const MORE_NUMFMT_TYPE_KEY = 'sheet.numfmt.moreNumfmtType';
export const OPTIONS_KEY = 'sheet.numfmt.moreNumfmtType.options';
diff --git a/packages/sheets-numfmt/src/controllers/numfmt.cell-content.controller.ts b/packages/sheets-numfmt/src/controllers/numfmt.cell-content.controller.ts
index 9c2df780d6..6a46c92bd2 100644
--- a/packages/sheets-numfmt/src/controllers/numfmt.cell-content.controller.ts
+++ b/packages/sheets-numfmt/src/controllers/numfmt.cell-content.controller.ts
@@ -14,11 +14,6 @@
* limitations under the License.
*/
-import type {
- ICellData,
- ICellDataForSheetInterceptor,
- Workbook,
-} from '@univerjs/core';
import {
CellValueType,
Disposable,
@@ -33,10 +28,15 @@ import {
ThemeService,
UniverInstanceType,
} from '@univerjs/core';
-import type { ISetNumfmtMutationParams, ISetRangeValuesMutationParams } from '@univerjs/sheets';
import { InterceptCellContentPriority, INTERCEPTOR_POINT, INumfmtService, SetNumfmtMutation, SetRangeValuesMutation, SheetInterceptorService } from '@univerjs/sheets';
-
import { of, skip, switchMap } from 'rxjs';
+import type {
+ ICellData,
+ ICellDataForSheetInterceptor,
+ Workbook,
+} from '@univerjs/core';
+
+import type { ISetNumfmtMutationParams, ISetRangeValuesMutationParams } from '@univerjs/sheets';
import { getPatternPreview } from '../utils/pattern';
@OnLifecycle(LifecycleStages.Rendered, SheetsNumfmtCellContentController)
diff --git a/packages/sheets-numfmt/src/index.ts b/packages/sheets-numfmt/src/index.ts
index 24f8c89665..bd0e00ac47 100644
--- a/packages/sheets-numfmt/src/index.ts
+++ b/packages/sheets-numfmt/src/index.ts
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-export { UniverSheetsNumfmtPlugin } from './numfmt-plugin';
-export { getPatternPreview } from './utils/pattern';
-export { MenuCurrencyService } from './service/menu.currency.service';
export { countryCurrencyMap } from './base/const/CURRENCY-SYMBOLS';
-
-// #region - all commands
-
export { AddDecimalCommand } from './commands/commands/add-decimal.command';
export { SetCurrencyCommand } from './commands/commands/set-currency.command';
export { type ISetNumfmtCommandParams, SetNumfmtCommand } from './commands/commands/set-numfmt.command';
+
+// #region - all commands
+
export { SetPercentCommand } from './commands/commands/set-percent.command';
export { SubtractDecimalCommand } from './commands/commands/subtract-decimal.command';
export { CloseNumfmtPanelOperator } from './commands/operations/close.numfmt.panel.operation';
export { OpenNumfmtPanelOperator } from './commands/operations/open.numfmt.panel.operation';
+export { UniverSheetsNumfmtPlugin } from './numfmt-plugin';
+export { MenuCurrencyService } from './service/menu.currency.service';
+export { getPatternPreview, getPatternType } from './utils/pattern';
// #endregion
diff --git a/packages/sheets-ui/src/basics/editor/get-editor-object.ts b/packages/sheets-ui/src/basics/editor/get-editor-object.ts
index b4189f0a69..f56e4b9265 100644
--- a/packages/sheets-ui/src/basics/editor/get-editor-object.ts
+++ b/packages/sheets-ui/src/basics/editor/get-editor-object.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import type { Nullable } from '@univerjs/core';
import { DOCS_VIEW_KEY } from '@univerjs/docs-ui';
+import type { Nullable } from '@univerjs/core';
import type { DocBackground, Documents, Engine, IRenderManagerService, Scene } from '@univerjs/engine-render';
export interface IDocObjectParam {
diff --git a/packages/sheets-ui/src/commands/commands/inline-format.command.ts b/packages/sheets-ui/src/commands/commands/inline-format.command.ts
index b0cf6f8fe0..893fc645b8 100644
--- a/packages/sheets-ui/src/commands/commands/inline-format.command.ts
+++ b/packages/sheets-ui/src/commands/commands/inline-format.command.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { ICommand } from '@univerjs/core';
import { CommandType, EDITOR_ACTIVATED, ICommandService, IContextService } from '@univerjs/core';
import { SetInlineFormatBoldCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '@univerjs/docs-ui';
import {
@@ -26,6 +25,7 @@ import {
SetTextColorCommand,
SetUnderlineCommand,
} from '@univerjs/sheets';
+import type { ICommand } from '@univerjs/core';
/**
* It is used to set the bold style of selections or one cell, need to distinguish between
diff --git a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts
index c748d1851f..4a48c1c225 100644
--- a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts
+++ b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts
@@ -37,6 +37,7 @@ import {
RxDisposable, UniverInstanceType,
} from '@univerjs/core';
import { MessageType } from '@univerjs/design';
+import { DocSelectionRenderService } from '@univerjs/docs-ui';
import { IRenderManagerService } from '@univerjs/engine-render';
import {
InsertColMutation,
@@ -49,7 +50,9 @@ import {
SetWorksheetColWidthMutation,
SetWorksheetRowHeightMutation,
} from '@univerjs/sheets';
+
import { IMessageService } from '@univerjs/ui';
+import { takeUntil } from 'rxjs';
import type {
ICellData,
@@ -69,9 +72,6 @@ import type {
ISetWorksheetColWidthMutationParams,
ISetWorksheetRowHeightMutationParams,
} from '@univerjs/sheets';
-
-import { takeUntil } from 'rxjs';
-import { DocSelectionRenderService } from '@univerjs/docs-ui';
import {
SheetCopyCommand,
SheetCutCommand,
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 6fd499b012..fe4623e620 100644
--- a/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts
+++ b/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts
@@ -16,7 +16,6 @@
/* eslint-disable max-lines-per-function */
-import type { DocumentDataModel, ICellData, ICommandInfo, IDisposable, IDocumentBody, IDocumentData, IPosition, IStyleData, Nullable, UnitModel, Workbook } from '@univerjs/core';
import {
CellValueType, DEFAULT_EMPTY_DOCUMENT_VALUE, Direction, Disposable, DisposableCollection, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, EDITOR_ACTIVATED,
FOCUSING_EDITOR_BUT_HIDDEN,
@@ -42,13 +41,13 @@ import {
VerticalAlign,
WrapStrategy,
} from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import {
DocSelectionManagerService,
DocSkeletonManagerService,
RichTextEditingMutation,
} from '@univerjs/docs';
-import type { DocumentSkeleton, IDocumentLayoutObject, IRenderContext, IRenderModule, Scene } from '@univerjs/engine-render';
+import { VIEWPORT_KEY as DOC_VIEWPORT_KEY, DOCS_COMPONENT_MAIN_LAYER_INDEX, DocSelectionRenderService, MoveCursorOperation, MoveSelectionOperation } from '@univerjs/docs-ui';
+import { IFunctionService, LexerTreeBuilder, matchToken } from '@univerjs/engine-formula';
import {
convertTextRotation,
DeviceInputEventType,
@@ -58,24 +57,25 @@ import {
Rect,
ScrollBar,
} from '@univerjs/engine-render';
-import { IEditorService, ILayoutService, KeyCode, SetEditorResizeOperation } from '@univerjs/ui';
-import type { WorkbookSelections } from '@univerjs/sheets';
import { ClearSelectionFormatCommand, SetRangeValuesCommand, SetRangeValuesMutation, SetSelectionsOperation, SetWorksheetActivateCommand, SheetsSelectionsService } from '@univerjs/sheets';
+import { IEditorService, ILayoutService, KeyCode, SetEditorResizeOperation } from '@univerjs/ui';
import { distinctUntilChanged, filter } from 'rxjs';
-import { IFunctionService, LexerTreeBuilder, matchToken } from '@univerjs/engine-formula';
-
+import type { DocumentDataModel, ICellData, ICommandInfo, IDisposable, IDocumentBody, IDocumentData, IPosition, IStyleData, Nullable, UnitModel, Workbook } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { IEditorInputConfig } from '@univerjs/docs-ui';
-import { VIEWPORT_KEY as DOC_VIEWPORT_KEY, DOCS_COMPONENT_MAIN_LAYER_INDEX, DocSelectionRenderService, MoveCursorOperation, MoveSelectionOperation } from '@univerjs/docs-ui';
+
+import type { DocumentSkeleton, IDocumentLayoutObject, IRenderContext, IRenderModule, Scene } from '@univerjs/engine-render';
+import type { WorkbookSelections } from '@univerjs/sheets';
import { getEditorObject } from '../../basics/editor/get-editor-object';
+import { MoveSelectionCommand, MoveSelectionEnterAndTabCommand } from '../../commands/commands/set-selection.command';
import { SetCellEditVisibleArrowOperation, SetCellEditVisibleOperation, SetCellEditVisibleWithF2Operation } from '../../commands/operations/cell-edit.operation';
-import type { IEditorBridgeServiceVisibleParam } from '../../services/editor-bridge.service';
-import { IEditorBridgeService } from '../../services/editor-bridge.service';
import { ICellEditorManagerService } from '../../services/editor/cell-editor-manager.service';
+import { IEditorBridgeService } from '../../services/editor-bridge.service';
import styles from '../../views/sheet-container/index.module.less';
-import { MoveSelectionCommand, MoveSelectionEnterAndTabCommand } from '../../commands/commands/set-selection.command';
import { MOVE_SELECTION_KEYCODE_LIST } from '../shortcuts/editor.shortcut';
import { extractStringFromForceString, isForceString } from '../utils/cell-tools';
import { normalizeString } from '../utils/char-tools';
+import type { IEditorBridgeServiceVisibleParam } from '../../services/editor-bridge.service';
const HIDDEN_EDITOR_POSITION = -1000;
diff --git a/packages/sheets-ui/src/controllers/editor/formula-editor.controller.ts b/packages/sheets-ui/src/controllers/editor/formula-editor.controller.ts
index a2c9e14012..75cd8db9fe 100644
--- a/packages/sheets-ui/src/controllers/editor/formula-editor.controller.ts
+++ b/packages/sheets-ui/src/controllers/editor/formula-editor.controller.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { DocumentDataModel, ICommandInfo, IParagraph, ITextRun, JSONXActions, Nullable } from '@univerjs/core';
import {
BooleanNumber,
DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,
@@ -34,24 +33,25 @@ import {
Tools,
UniverInstanceType,
} from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import {
DocSelectionManagerService,
DocSkeletonManagerService,
RichTextEditingMutation,
} from '@univerjs/docs';
-import type { DocumentViewModel, RenderComponentType } from '@univerjs/engine-render';
+import { CoverContentCommand, VIEWPORT_KEY as DOC_VIEWPORT_KEY } from '@univerjs/docs-ui';
import { DeviceInputEventType, IRenderManagerService, ScrollBar } from '@univerjs/engine-render';
-import type { IMoveRangeMutationParams, ISetRangeValuesMutationParams } from '@univerjs/sheets';
import { MoveRangeMutation, RangeProtectionRuleModel, SetRangeValuesMutation, WorksheetProtectionRuleModel } from '@univerjs/sheets';
+import { SetEditorResizeOperation } from '@univerjs/ui';
import { takeUntil } from 'rxjs';
+import type { DocumentDataModel, ICommandInfo, IParagraph, ITextRun, JSONXActions, Nullable } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import { SetEditorResizeOperation } from '@univerjs/ui';
-import { CoverContentCommand, VIEWPORT_KEY as DOC_VIEWPORT_KEY } from '@univerjs/docs-ui';
+import type { DocumentViewModel, RenderComponentType } from '@univerjs/engine-render';
+import type { IMoveRangeMutationParams, ISetRangeValuesMutationParams } from '@univerjs/sheets';
import { getEditorObject } from '../../basics/editor/get-editor-object';
-import type { IEditorBridgeServiceParam } from '../../services/editor-bridge.service';
-import { IEditorBridgeService } from '../../services/editor-bridge.service';
import { IFormulaEditorManagerService } from '../../services/editor/formula-editor-manager.service';
+import { IEditorBridgeService } from '../../services/editor-bridge.service';
+import type { IEditorBridgeServiceParam } from '../../services/editor-bridge.service';
@OnLifecycle(LifecycleStages.Rendered, FormulaEditorController)
export class FormulaEditorController extends RxDisposable {
diff --git a/packages/sheets-ui/src/controllers/menu/menu.ts b/packages/sheets-ui/src/controllers/menu/menu.ts
index 519d70f61f..7f0cd74b35 100644
--- a/packages/sheets-ui/src/controllers/menu/menu.ts
+++ b/packages/sheets-ui/src/controllers/menu/menu.ts
@@ -33,6 +33,8 @@ import {
WrapStrategy,
} from '@univerjs/core';
import { DocSelectionManagerService, SetTextSelectionsOperation } from '@univerjs/docs';
+import { SetInlineFormatCommand } from '@univerjs/docs-ui';
+
import {
RangeProtectionPermissionEditPoint,
RangeProtectionPermissionViewPoint,
@@ -67,8 +69,6 @@ import {
WorksheetSetColumnStylePermission,
WorksheetSetRowStylePermission,
} from '@univerjs/sheets';
-
-import type { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
import {
CutCommand,
FONT_FAMILY_LIST,
@@ -77,10 +77,10 @@ import {
IClipboardInterfaceService,
MenuItemType,
} from '@univerjs/ui';
-import type { IAccessor } from '@univerjs/core';
import { combineLatestWith, map, Observable } from 'rxjs';
+import type { IAccessor } from '@univerjs/core';
-import { SetInlineFormatCommand } from '@univerjs/docs-ui';
+import type { IMenuButtonItem, IMenuSelectorItem } from '@univerjs/ui';
import {
SheetCopyCommand,
SheetCutCommand,
diff --git a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts
index 06044cefd1..b3aa4d8b90 100644
--- a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts
+++ b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts
@@ -15,6 +15,9 @@
*/
import { connectInjector, Disposable, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, ICommandService, Inject, Injector, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core';
+import { DocSelectionRenderService } from '@univerjs/docs-ui';
+import { IRenderManagerService } from '@univerjs/engine-render';
+
import {
SetBoldCommand,
SetFontFamilyCommand,
@@ -24,15 +27,13 @@ import {
SetUnderlineCommand,
} from '@univerjs/sheets';
import { BuiltInUIPart, ComponentManager, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
-
-import { IRenderManagerService } from '@univerjs/engine-render';
-import { DocSelectionRenderService } from '@univerjs/docs-ui';
import {
AddWorksheetMergeAllCommand,
AddWorksheetMergeCommand,
AddWorksheetMergeHorizontalCommand,
AddWorksheetMergeVerticalCommand,
} from '../commands/commands/add-worksheet-merge.command';
+import { AutoClearContentCommand, AutoFillCommand } from '../commands/commands/auto-fill.command';
import { DeleteRangeMoveLeftConfirmCommand } from '../commands/commands/delete-range-move-left-confirm.command';
import { DeleteRangeMoveUpConfirmCommand } from '../commands/commands/delete-range-move-up-confirm.command';
import { HideColConfirmCommand, HideRowConfirmCommand } from '../commands/commands/hide-row-col-confirm.command';
@@ -49,6 +50,7 @@ import {
} from '../commands/commands/inline-format.command';
import { InsertRangeMoveDownConfirmCommand } from '../commands/commands/insert-range-move-down-confirm.command';
import { InsertRangeMoveRightConfirmCommand } from '../commands/commands/insert-range-move-right-confirm.command';
+import { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, DeleteRangeProtectionFromContextMenuCommand, SetProtectionCommand, SetRangeProtectionFromContextMenuCommand, ViewSheetPermissionFromContextMenuCommand, ViewSheetPermissionFromSheetBarCommand } from '../commands/commands/range-protection.command';
import { RefillCommand } from '../commands/commands/refill.command';
import { RemoveColConfirmCommand, RemoveRowConfirmCommand } from '../commands/commands/remove-row-col-confirm.command';
import { RemoveSheetConfirmCommand } from '../commands/commands/remove-sheet-confirm.command';
@@ -72,6 +74,7 @@ import {
} from '../commands/commands/set-selection.command';
import { ChangeZoomRatioCommand, SetZoomRatioCommand } from '../commands/commands/set-zoom-ratio.command';
import { ShowMenuListCommand } from '../commands/commands/unhide.command';
+import { AddWorksheetProtectionCommand, ChangeSheetProtectionFromSheetBarCommand, DeleteWorksheetProtectionCommand, DeleteWorksheetProtectionFormSheetBarCommand, SetWorksheetProtectionCommand } from '../commands/commands/worksheet-protection.command';
import { SetActivateCellEditOperation } from '../commands/operations/activate-cell-edit.operation';
import {
SetCellEditVisibleArrowOperation,
@@ -80,8 +83,12 @@ import {
} from '../commands/operations/cell-edit.operation';
import { RenameSheetOperation } from '../commands/operations/rename-sheet.operation';
import { SetScrollOperation } from '../commands/operations/scroll.operation';
+import { ScrollToRangeOperation } from '../commands/operations/scroll-to-range.operation';
import { SetFormatPainterOperation } from '../commands/operations/set-format-painter.operation';
import { SetZoomRatioOperation } from '../commands/operations/set-zoom-ratio.operation';
+import { SheetPermissionOpenDialogOperation } from '../commands/operations/sheet-permission-open-dialog.operation';
+import { SheetPermissionOpenPanelOperation } from '../commands/operations/sheet-permission-open-panel.operation';
+import { SidebarDefinedNameOperation } from '../commands/operations/sidebar-defined-name.operation';
import { BorderPanel } from '../components/border-panel/BorderPanel';
import { BORDER_PANEL_COMPONENT } from '../components/border-panel/interface';
import { COLOR_PICKER_COMPONENT, ColorPicker } from '../components/color-picker';
@@ -91,19 +98,13 @@ import {
FontFamily,
FontFamilyItem,
} from '../components/font-family';
+
import { FONT_SIZE_COMPONENT, FontSize } from '../components/font-size';
import { MENU_ITEM_INPUT_COMPONENT, MenuItemInput } from '../components/menu-item-input';
-import { RenderSheetContent, RenderSheetFooter, RenderSheetHeader } from '../views/sheet-container/SheetContainer';
import { DEFINED_NAME_CONTAINER } from '../views/defined-name/component-name';
import { DefinedNameContainer } from '../views/defined-name/DefinedNameContainer';
-import { SidebarDefinedNameOperation } from '../commands/operations/sidebar-defined-name.operation';
-import { AutoClearContentCommand, AutoFillCommand } from '../commands/commands/auto-fill.command';
-
-import { SheetPermissionOpenPanelOperation } from '../commands/operations/sheet-permission-open-panel.operation';
-import { SheetPermissionOpenDialogOperation } from '../commands/operations/sheet-permission-open-dialog.operation';
-import { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, DeleteRangeProtectionFromContextMenuCommand, SetProtectionCommand, SetRangeProtectionFromContextMenuCommand, ViewSheetPermissionFromContextMenuCommand, ViewSheetPermissionFromSheetBarCommand } from '../commands/commands/range-protection.command';
-import { AddWorksheetProtectionCommand, ChangeSheetProtectionFromSheetBarCommand, DeleteWorksheetProtectionCommand, DeleteWorksheetProtectionFormSheetBarCommand, SetWorksheetProtectionCommand } from '../commands/commands/worksheet-protection.command';
-import { ScrollToRangeOperation } from '../commands/operations/scroll-to-range.operation';
+import { RenderSheetContent, RenderSheetFooter, RenderSheetHeader } from '../views/sheet-container/SheetContainer';
+import { menuSchema } from './menu.schema';
import {
EditorBreakLineShortcut,
EditorCursorEnterShortcut,
@@ -154,7 +155,6 @@ import {
ZoomInShortcutItem,
ZoomOutShortcutItem,
} from './shortcuts/view.shortcut';
-import { menuSchema } from './menu.schema';
@OnLifecycle(LifecycleStages.Ready, SheetUIController)
export class SheetUIController extends Disposable {
diff --git a/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts b/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts
index aca866d4b1..661dc81595 100644
--- a/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts
+++ b/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
+import { BreakLineCommand, DeleteLeftCommand } from '@univerjs/docs-ui';
import { DeviceInputEventType } from '@univerjs/engine-render';
-import type { IShortcutItem } from '@univerjs/ui';
import { KeyCode, MetaKeys } from '@univerjs/ui';
-import { BreakLineCommand, DeleteLeftCommand } from '@univerjs/docs-ui';
+import type { IShortcutItem } from '@univerjs/ui';
import {
SetCellEditVisibleArrowOperation,
SetCellEditVisibleOperation,
diff --git a/packages/sheets-ui/src/services/editor-bridge.service.ts b/packages/sheets-ui/src/services/editor-bridge.service.ts
index 570e2e0568..046753a41c 100644
--- a/packages/sheets-ui/src/services/editor-bridge.service.ts
+++ b/packages/sheets-ui/src/services/editor-bridge.service.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { ICellDataForSheetInterceptor, IDisposable, IPosition, ISelectionCell, Nullable, Workbook } from '@univerjs/core';
import {
CellValueType,
createIdentifier,
@@ -33,19 +32,20 @@ import {
toDisposable,
UniverInstanceType,
} from '@univerjs/core';
-import type { Engine, IDocumentLayoutObject, Scene } from '@univerjs/engine-render';
+import { getCanvasOffsetByEngine } from '@univerjs/docs-ui';
import { convertTextRotation, DeviceInputEventType, IRenderManagerService } from '@univerjs/engine-render';
-import type { ISheetLocation, SheetsSelectionsService } from '@univerjs/sheets';
import { IRefSelectionsService } from '@univerjs/sheets';
import { IEditorService } from '@univerjs/ui';
-import type { KeyCode } from '@univerjs/ui';
-import type { Observable } from 'rxjs';
import { BehaviorSubject } from 'rxjs';
+import type { ICellDataForSheetInterceptor, IDisposable, IPosition, ISelectionCell, Nullable, Workbook } from '@univerjs/core';
+import type { Engine, IDocumentLayoutObject, Scene } from '@univerjs/engine-render';
+import type { ISheetLocation, SheetsSelectionsService } from '@univerjs/sheets';
+import type { KeyCode } from '@univerjs/ui';
-import { getCanvasOffsetByEngine } from '@univerjs/docs-ui';
-import { SheetSkeletonManagerService } from './sheet-skeleton-manager.service';
+import type { Observable } from 'rxjs';
import { ISheetSelectionRenderService } from './selection/base-selection-render.service';
import { attachPrimaryWithCoord } from './selection/util';
+import { SheetSkeletonManagerService } from './sheet-skeleton-manager.service';
export interface IEditorBridgeServiceVisibleParam {
visible: boolean;
diff --git a/packages/sheets-ui/src/services/scroll-manager.service.ts b/packages/sheets-ui/src/services/scroll-manager.service.ts
index d3ade3f576..d92694be80 100644
--- a/packages/sheets-ui/src/services/scroll-manager.service.ts
+++ b/packages/sheets-ui/src/services/scroll-manager.service.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { Nullable, Workbook } from '@univerjs/core';
+import { Inject } from '@univerjs/core';
import { BehaviorSubject } from 'rxjs';
+import type { Nullable, Workbook } from '@univerjs/core';
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
-import { Inject } from '@univerjs/core';
import { SheetSkeletonManagerService } from './sheet-skeleton-manager.service';
export interface IScrollState {
diff --git a/packages/sheets-ui/src/views/permission/extensions/range-protection.render.ts b/packages/sheets-ui/src/views/permission/extensions/range-protection.render.ts
index 6ba3945f59..65ee43ad96 100644
--- a/packages/sheets-ui/src/views/permission/extensions/range-protection.render.ts
+++ b/packages/sheets-ui/src/views/permission/extensions/range-protection.render.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { ICellDataForSheetInterceptor, IScale } from '@univerjs/core';
import { Range } from '@univerjs/core';
-import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
import { SheetExtension } from '@univerjs/engine-render';
import { UnitAction } from '@univerjs/protocol';
+import type { ICellDataForSheetInterceptor, IScale } from '@univerjs/core';
+import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
import type { ICellPermission } from '@univerjs/sheets';
import { base64 } from './protect-background-img';
diff --git a/packages/sheets-ui/src/views/permission/extensions/worksheet-permission.render.ts b/packages/sheets-ui/src/views/permission/extensions/worksheet-permission.render.ts
index 7ed7224532..c1849a3862 100644
--- a/packages/sheets-ui/src/views/permission/extensions/worksheet-permission.render.ts
+++ b/packages/sheets-ui/src/views/permission/extensions/worksheet-permission.render.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { IScale } from '@univerjs/core';
-import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
import { SheetExtension } from '@univerjs/engine-render';
import { UnitAction } from '@univerjs/protocol';
+import type { IScale } from '@univerjs/core';
+import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
import type { IWorksheetProtectionRenderCellData } from '@univerjs/sheets';
import { base64 } from './protect-background-img';
diff --git a/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts b/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts
index fa08c0b917..334d51d6b8 100644
--- a/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts
+++ b/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { ICommandInfo, ICustomBlock, ICustomRange, IDocumentData, IDrawings, IParagraph, ITextRun } from '@univerjs/core';
import {
DEFAULT_EMPTY_DOCUMENT_VALUE,
DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,
@@ -30,21 +29,22 @@ import {
RxDisposable,
UniverInstanceType,
} from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import {
DocSelectionManagerService,
DocSkeletonManagerService,
RichTextEditingMutation,
} from '@univerjs/docs';
-import type { Viewport } from '@univerjs/engine-render';
+import { VIEWPORT_KEY as DOC_VIEWPORT_KEY, getDocObject } from '@univerjs/docs-ui';
import { DeviceInputEventType, IRenderManagerService } from '@univerjs/engine-render';
-import type { IEditorBridgeServiceParam } from '@univerjs/sheets-ui';
import { getEditorObject, IEditorBridgeService } from '@univerjs/sheets-ui';
import { IZenZoneService } from '@univerjs/ui';
import { takeUntil } from 'rxjs';
-
+import type { ICommandInfo, ICustomBlock, ICustomRange, IDocumentData, IDrawings, IParagraph, ITextRun } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { IDocObjectParam } from '@univerjs/docs-ui';
-import { VIEWPORT_KEY as DOC_VIEWPORT_KEY, getDocObject } from '@univerjs/docs-ui';
+
+import type { Viewport } from '@univerjs/engine-render';
+import type { IEditorBridgeServiceParam } from '@univerjs/sheets-ui';
import { OpenZenEditorOperation } from '../commands/operations/zen-editor.operation';
import { IZenEditorManagerService } from '../services/zen-editor.service';
diff --git a/packages/sheets/src/commands/commands/set-range-values.command.ts b/packages/sheets/src/commands/commands/set-range-values.command.ts
index 043555198c..339cc4d52a 100644
--- a/packages/sheets/src/commands/commands/set-range-values.command.ts
+++ b/packages/sheets/src/commands/commands/set-range-values.command.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { IAccessor, ICellData, ICommand, IObjectMatrixPrimitiveType, IRange } from '@univerjs/core';
import {
CommandType,
ICommandService,
@@ -26,13 +25,14 @@ import {
sequenceExecute,
Tools,
} from '@univerjs/core';
+import type { IAccessor, ICellData, ICommand, IObjectMatrixPrimitiveType, IRange } from '@univerjs/core';
+import { WorksheetEditPermission } from '../../services/permission/permission-point';
import { SheetsSelectionsService } from '../../services/selections/selection-manager.service';
import { SheetInterceptorService } from '../../services/sheet-interceptor/sheet-interceptor.service';
import { SetRangeValuesMutation, SetRangeValuesUndoMutationFactory } from '../mutations/set-range-values.mutation';
-import type { ISheetCommandSharedParams } from '../utils/interface';
-import { WorksheetEditPermission } from '../../services/permission/permission-point';
import { getSheetCommandTarget } from './utils/target-util';
+import type { ISheetCommandSharedParams } from '../utils/interface';
export interface ISetRangeValuesCommandParams extends Partial<ISheetCommandSharedParams> {
range?: IRange;
diff --git a/packages/slides-ui/src/commands/operations/insert-image.operation.ts b/packages/slides-ui/src/commands/operations/insert-image.operation.ts
index 7649020249..aba40c58da 100644
--- a/packages/slides-ui/src/commands/operations/insert-image.operation.ts
+++ b/packages/slides-ui/src/commands/operations/insert-image.operation.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import type { ICommand, SlideDataModel } from '@univerjs/core';
import { CommandType, IUniverInstanceService, PageElementType, UniverInstanceType } from '@univerjs/core';
import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, getImageSize, IImageIoService } from '@univerjs/drawing';
import { ILocalFileService } from '@univerjs/ui';
+import type { ICommand, SlideDataModel } from '@univerjs/core';
import { CanvasView } from '../../controllers/canvas-view';
export const InsertSlideFloatImageCommand: ICommand<{}> = {
diff --git a/packages/slides-ui/src/controllers/shortcuts/editor.shortcuts.ts b/packages/slides-ui/src/controllers/shortcuts/editor.shortcuts.ts
index dd4176fe2f..75f98b0c49 100644
--- a/packages/slides-ui/src/controllers/shortcuts/editor.shortcuts.ts
+++ b/packages/slides-ui/src/controllers/shortcuts/editor.shortcuts.ts
@@ -14,10 +14,10 @@
* limitations under the License.
*/
+import { DeleteLeftCommand } from '@univerjs/docs-ui';
import { DeviceInputEventType } from '@univerjs/engine-render';
-import type { IShortcutItem } from '@univerjs/ui';
import { KeyCode, MetaKeys } from '@univerjs/ui';
-import { DeleteLeftCommand } from '@univerjs/docs-ui';
+import type { IShortcutItem } from '@univerjs/ui';
import { SetTextEditArrowOperation } from '../../commands/operations/text-edit.operation';
import {
whenEditorActivated,
diff --git a/packages/slides-ui/src/controllers/slide-editing.render-controller.ts b/packages/slides-ui/src/controllers/slide-editing.render-controller.ts
index ef4c729597..0185062442 100644
--- a/packages/slides-ui/src/controllers/slide-editing.render-controller.ts
+++ b/packages/slides-ui/src/controllers/slide-editing.render-controller.ts
@@ -14,14 +14,6 @@
* limitations under the License.
*/
-import type {
- ICommandInfo,
- IDisposable,
- IDocumentBody,
- IPosition,
- Nullable,
- SlideDataModel,
- UnitModel } from '@univerjs/core';
import {
DEFAULT_EMPTY_DOCUMENT_VALUE,
Direction,
@@ -48,15 +40,7 @@ import {
DocSkeletonManagerService,
RichTextEditingMutation,
} from '@univerjs/docs';
-import type {
- DocBackground,
- Documents,
- DocumentSkeleton,
- IDocumentLayoutObject,
- IRenderContext,
- IRenderModule,
- Scene,
-} from '@univerjs/engine-render';
+import { VIEWPORT_KEY as DOC_VIEWPORT_KEY, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, DocSelectionRenderService, MoveCursorOperation, MoveSelectionOperation } from '@univerjs/docs-ui';
import {
convertTextRotation,
DeviceInputEventType,
@@ -68,14 +52,30 @@ import {
} from '@univerjs/engine-render';
import { IEditorService, ILayoutService, KeyCode } from '@univerjs/ui';
import { filter } from 'rxjs';
+import type {
+ ICommandInfo,
+ IDisposable,
+ IDocumentBody,
+ IPosition,
+ Nullable,
+ SlideDataModel,
+ UnitModel } from '@univerjs/core';
import type { IDocObjectParam, IEditorInputConfig } from '@univerjs/docs-ui';
-import { VIEWPORT_KEY as DOC_VIEWPORT_KEY, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, DocSelectionRenderService, MoveCursorOperation, MoveSelectionOperation } from '@univerjs/docs-ui';
-import type { IEditorBridgeServiceVisibleParam } from '../services/slide-editor-bridge.service';
+import type {
+ DocBackground,
+ Documents,
+ DocumentSkeleton,
+ IDocumentLayoutObject,
+ IRenderContext,
+ IRenderModule,
+ Scene,
+} from '@univerjs/engine-render';
+import { SetTextEditArrowOperation } from '../commands/operations/text-edit.operation';
+import { SLIDE_EDITOR_ID } from '../const';
import { ISlideEditorBridgeService } from '../services/slide-editor-bridge.service';
import { ISlideEditorManagerService } from '../services/slide-editor-manager.service';
-import { SetTextEditArrowOperation } from '../commands/operations/text-edit.operation';
import { CursorChange } from '../type';
-import { SLIDE_EDITOR_ID } from '../const';
+import type { IEditorBridgeServiceVisibleParam } from '../services/slide-editor-bridge.service';
const HIDDEN_EDITOR_POSITION = -1000;
diff --git a/packages/slides-ui/src/services/slide-popup-manager.service.ts b/packages/slides-ui/src/services/slide-popup-manager.service.ts
index 6f0829c644..fd29708241 100644
--- a/packages/slides-ui/src/services/slide-popup-manager.service.ts
+++ b/packages/slides-ui/src/services/slide-popup-manager.service.ts
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-import type { IDisposable } from '@univerjs/core';
import { Disposable, DisposableCollection, ICommandService, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
import { IRenderManagerService, pxToNum } from '@univerjs/engine-render';
-import type { BaseObject, IBoundRectNoAngle, IRender, Scene } from '@univerjs/engine-render';
import { SLIDE_KEY } from '@univerjs/slides';
-import type { IPopup } from '@univerjs/ui';
import { ICanvasPopupService } from '@univerjs/ui';
import { BehaviorSubject } from 'rxjs';
+import type { IDisposable } from '@univerjs/core';
+import type { BaseObject, IBoundRectNoAngle, IRender, Scene } from '@univerjs/engine-render';
+import type { IPopup } from '@univerjs/ui';
export interface ISlideCanvasPopup extends Pick<IPopup,
'direction' | 'excludeOutside' | 'closeOnSelfTarget' | 'componentKey' | 'offset' | 'onClickOutside' | 'hideOnInvisible'
diff --git a/packages/slides/src/slides-plugin.ts b/packages/slides/src/slides-plugin.ts
index 4e6c4d2d26..a9e642b0f7 100644
--- a/packages/slides/src/slides-plugin.ts
+++ b/packages/slides/src/slides-plugin.ts
@@ -15,9 +15,9 @@
*/
import { IConfigService, Inject, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
-import type { Engine } from '@univerjs/engine-render';
import { IRenderingEngine, IRenderManagerService } from '@univerjs/engine-render';
import type { Dependency } from '@univerjs/core';
+import type { Engine } from '@univerjs/engine-render';
import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
// import { DocSelectionManagerService } from '@univerjs/docs';
// import { CanvasView } from './views/render';
diff --git a/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx b/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx
index 04e1bdbbd9..282bd3cd0c 100644
--- a/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx
+++ b/packages/thread-comment-ui/src/views/thread-comment-editor/index.tsx
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-import type { IThreadComment } from '@univerjs/thread-comment';
-import type { MentionProps } from '@univerjs/design';
-import { Button, Mention, Mentions } from '@univerjs/design';
-import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';
import { ICommandService, LocaleService, UniverInstanceType, useDependency } from '@univerjs/core';
-import type { IDocumentBody } from '@univerjs/core';
+import { Button, Mention, Mentions } from '@univerjs/design';
import { DocSelectionManagerService } from '@univerjs/docs';
-import { KeyCode } from '@univerjs/ui';
-import { IRenderManagerService } from '@univerjs/engine-render';
import { DocSelectionRenderService } from '@univerjs/docs-ui';
-import { IThreadCommentMentionDataService } from '../../services/thread-comment-mention-data.service';
+import { IRenderManagerService } from '@univerjs/engine-render';
+import { KeyCode } from '@univerjs/ui';
+import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';
+import type { IDocumentBody } from '@univerjs/core';
+import type { MentionProps } from '@univerjs/design';
+import type { IThreadComment } from '@univerjs/thread-comment';
import { SetActiveCommentOperation } from '../../commands/operations/comment.operations';
+import { IThreadCommentMentionDataService } from '../../services/thread-comment-mention-data.service';
import styles from './index.module.less';
import { parseMentions, transformDocument2TextNodes, transformMention, transformTextNode2Text, transformTextNodes2Document } from './util';
@@ -123,7 +123,8 @@ export const ThreadCommentEditor = forwardRef<IThreadCommentEditorInstance, IThr
key={mentionDataService.trigger}
trigger={mentionDataService.trigger}
data={(query, callback) => mentionDataService.getMentions!(query, unitId, subUnitId)
- .then((res) => res.map(transformMention)).then(callback) as any}
+ .then((res) => res.map(transformMention))
+ .then(callback) as any}
displayTransform={(id, label) => `@${label} `}
renderSuggestion={mentionDataService.renderSuggestion ?? defaultRenderSuggestion}
diff --git a/packages/ui/src/components/editor/TextEditor.tsx b/packages/ui/src/components/editor/TextEditor.tsx
index 3a8c572786..ebc6a9033c 100644
--- a/packages/ui/src/components/editor/TextEditor.tsx
+++ b/packages/ui/src/components/editor/TextEditor.tsx
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-import type { IDocumentData, Nullable } from '@univerjs/core';
import { debounce, isInternalEditorID, LocaleService, useDependency } from '@univerjs/core';
import React, { useEffect, useRef, useState } from 'react';
-import type { Editor, IEditorCanvasStyle } from '../../services/editor/editor.service';
+import type { IDocumentData, Nullable } from '@univerjs/core';
import { IEditorService } from '../../services/editor/editor.service';
import { isElementVisible } from '../../utils/util';
import styles from './index.module.less';
+import type { Editor, IEditorCanvasStyle } from '../../services/editor/editor.service';
type MyComponentProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index 790f87a2e8..9820ea6244 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -14,13 +14,25 @@
* limitations under the License.
*/
+export { SetEditorResizeOperation } from './commands/operations/editor/set-editor-resize.operation';
+export { ToggleShortcutPanelOperation } from './commands/operations/toggle-shortcut-panel.operation';
export * from './common';
-export { getMenuHiddenObservable, getHeaderFooterMenuHiddenObservable } from './common/menu-hidden-observable';
+export { getHeaderFooterMenuHiddenObservable, getMenuHiddenObservable } from './common/menu-hidden-observable';
+export { mergeMenuConfigs } from './common/menu-merge-configs';
export * from './components';
+export { TextEditor } from './components/editor/TextEditor';
+export { useEvent } from './components/hooks/event';
export { t } from './components/hooks/locale';
export { useObservable } from './components/hooks/observable';
-export { useEvent } from './components/hooks/event';
export { useVirtualList } from './components/hooks/virtual-list';
+export { Menu } from './components/menu/desktop/Menu';
+export { type INotificationOptions, type NotificationType } from './components/notification/Notification';
+export { ProgressBar } from './components/progress-bar/ProgressBar';
+export { RangeSelector } from './components/range-selector/RangeSelector';
+export { UNI_DISABLE_CHANGING_FOCUS_KEY } from './const';
+export { type IUniverUIConfig } from './controllers/config.schema';
+export { ErrorController } from './controllers/error/error.controller';
+export { menuSchema } from './controllers/menus/menu.schema';
export {
CopyShortcutItem,
CutShortcutItem,
@@ -28,11 +40,10 @@ export {
SharedController,
UndoShortcutItem,
} from './controllers/shared-shortcut.controller';
+export { ShortcutPanelController } from './controllers/shortcut-display/shortcut-panel.controller';
export { IUIController, type IWorkbenchOptions } from './controllers/ui/ui.controller';
-export { type IUniverUIConfig } from './controllers/config.schema';
export { DesktopUIController } from './controllers/ui/ui-desktop.controller';
-export { IUIPartsService, BuiltInUIPart, UIPartsService } from './services/parts/parts.service';
-export { type IOpenFileOptions, ILocalFileService } from './services/local-file/file-opener.service';
+export { UniverMobileUIPlugin } from './mobile-ui-plugin';
export { DesktopBeforeCloseService, IBeforeCloseService } from './services/before-close/before-close.service';
export { CopyCommand, CutCommand, PasteCommand } from './services/clipboard/clipboard.command';
export {
@@ -49,9 +60,14 @@ export {
IContextMenuService,
} from './services/contextmenu/contextmenu.service';
export { DesktopDialogService } from './services/dialog/desktop-dialog.service';
-export { type IDialogPartMethodOptions } from './views/components/dialog-part/interface';
export { IDialogService } from './services/dialog/dialog.service';
-export { ILayoutService, DesktopLayoutService } from './services/layout/layout.service';
+export { CanvasFloatDomService, type IFloatDomLayout } from './services/dom/canvas-dom-layer.service';
+export { Editor, EditorService, IEditorService } from './services/editor/editor.service';
+export { DesktopGlobalZoneService } from './services/global-zone/desktop-global-zone.service';
+export { IGlobalZoneService } from './services/global-zone/global-zone.service';
+export { DesktopLayoutService, ILayoutService } from './services/layout/layout.service';
+export { ILocalFileService, type IOpenFileOptions } from './services/local-file/file-opener.service';
+export { DesktopLocalStorageService } from './services/local-storage/local-storage.service';
export {
type ICustomComponentProps,
type IDisplayMenuItem,
@@ -62,84 +78,68 @@ export {
type IValueOption,
type MenuConfig,
MenuGroup,
+ type MenuItemDefaultValueType,
MenuItemType,
MenuPosition,
- type MenuItemDefaultValueType,
} from './services/menu/menu';
-export { MenuService, IMenuService } from './services/menu/menu.service';
+export { IMenuService, MenuService } from './services/menu/menu.service';
+export { IMenuManagerService, MenuManagerService, type MenuSchemaType } from './services/menu/menu-manager.service';
+export { type IMenuSchema } from './services/menu/menu-manager.service';
+export {
+ ContextMenuGroup,
+ ContextMenuPosition,
+ MenuManagerPosition,
+ RibbonDataGroup,
+ RibbonFormulasGroup,
+ RibbonInsertGroup,
+ RibbonOthersGroup,
+ RibbonPosition,
+ RibbonStartGroup,
+ RibbonViewGroup,
+} from './services/menu/types';
export { DesktopMessageService } from './services/message/desktop-message.service';
export { IMessageService } from './services/message/message.service';
export { DesktopNotificationService } from './services/notification/desktop-notification.service';
-export { type NotificationType, type INotificationOptions } from './components/notification/Notification';
export { INotificationService } from './services/notification/notification.service';
-export { PlatformService, IPlatformService } from './services/platform/platform.service';
-export { DesktopGlobalZoneService } from './services/global-zone/desktop-global-zone.service';
-export { IGlobalZoneService } from './services/global-zone/global-zone.service';
+export { BuiltInUIPart, IUIPartsService, UIPartsService } from './services/parts/parts.service';
+export { IPlatformService, PlatformService } from './services/platform/platform.service';
+export { CanvasPopupService, ICanvasPopupService, type IPopup } from './services/popup/canvas-popup.service';
+export { type IProgressCount, IProgressService, type IProgressStep, ProgressService } from './services/progress/progress.service';
+export { type IRangeSelectorRange, IRangeSelectorService, RangeSelectorService } from './services/range-selector/range-selector.service';
export { KeyCode, MetaKeys } from './services/shortcut/keycode';
-export { ShortcutService, type IShortcutItem, IShortcutService } from './services/shortcut/shortcut.service';
-export { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';
-export { ISidebarService, ILeftSidebarService } from './services/sidebar/sidebar.service';
-export { IZenZoneService } from './services/zen-zone/zen-zone.service';
-export { UniverUIPlugin, DISABLE_AUTO_FOCUS_KEY } from './ui-plugin';
-export { UniverMobileUIPlugin } from './mobile-ui-plugin';
-export * from './utils';
-export { Menu } from './components/menu/desktop/Menu';
-export { type IConfirmPartMethodOptions } from './views/components/confirm-part/interface';
-export { ComponentContainer, useComponentsOfPart, type IComponentContainerProps } from './views/components/ComponentContainer';
-export { IEditorService, EditorService, Editor } from './services/editor/editor.service';
-export { TextEditor } from './components/editor/TextEditor';
-export { RangeSelector } from './components/range-selector/RangeSelector';
-export { ProgressBar } from './components/progress-bar/ProgressBar';
-export { type IMenuGroup, useSimpleToolbarGroups, useToolbarGroups, useToolbarItemStatus } from './views/components/ribbon/hook';
-export { mergeMenuConfigs } from './common/menu-merge-configs';
-export { ShortcutPanelController } from './controllers/shortcut-display/shortcut-panel.controller';
+export { type IShortcutItem, IShortcutService, ShortcutService } from './services/shortcut/shortcut.service';
export { ShortcutPanelService } from './services/shortcut/shortcut-panel.service';
-export { IProgressService, type IProgressCount, type IProgressStep, ProgressService } from './services/progress/progress.service';
-export { type IRangeSelectorRange, IRangeSelectorService, RangeSelectorService } from './services/range-selector/range-selector.service';
-export { CanvasPopupService, ICanvasPopupService, type IPopup } from './services/popup/canvas-popup.service';
-export { UNIVER_UI_PLUGIN_NAME } from './ui-plugin';
-export { ErrorController } from './controllers/error/error.controller';
+export { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';
+export { ILeftSidebarService, ISidebarService } from './services/sidebar/sidebar.service';
export { DesktopZenZoneService } from './services/zen-zone/desktop-zen-zone.service';
-export { DesktopLocalStorageService } from './services/local-storage/local-storage.service';
-export { UNI_DISABLE_CHANGING_FOCUS_KEY } from './const';
+export { IZenZoneService } from './services/zen-zone/zen-zone.service';
-export { menuSchema } from './controllers/menus/menu.schema';
+export { DISABLE_AUTO_FOCUS_KEY, UniverUIPlugin } from './ui-plugin';
-export { IMenuManagerService, type MenuSchemaType, MenuManagerService } from './services/menu/menu-manager.service';
-export {
- MenuManagerPosition,
- RibbonPosition,
- RibbonStartGroup,
- RibbonInsertGroup,
- RibbonFormulasGroup,
- RibbonDataGroup,
- RibbonViewGroup,
- RibbonOthersGroup,
- ContextMenuGroup,
- ContextMenuPosition,
-} from './services/menu/types';
-export { type IMenuSchema } from './services/menu/menu-manager.service';
+export { UNIVER_UI_PLUGIN_NAME } from './ui-plugin';
+export * from './utils';
+export { ComponentContainer, type IComponentContainerProps, useComponentsOfPart } from './views/components/ComponentContainer';
// #region - workbench components
-export { GlobalZone } from './views/components/global-zone/GlobalZone';
-export { builtInGlobalComponents } from './views/parts';
+export { type IConfirmPartMethodOptions } from './views/components/confirm-part/interface';
export { DesktopContextMenu as ContextMenu } from './views/components/context-menu/ContextMenu';
-export { Sidebar } from './views/components/sidebar/Sidebar';
-export { type ISidebarMethodOptions } from './views/components/sidebar/interface';
-export { ZenZone } from './views/components/zen-zone/ZenZone';
-export { CanvasPopup } from './views/components/popup/CanvasPopup';
-export { CanvasFloatDomService, type IFloatDomLayout } from './services/dom/canvas-dom-layer.service';
-export { FloatDom } from './views/components/dom/FloatDom';
export { MobileContextMenu } from './views/components/context-menu/MobileContextMenu';
+export { type IDialogPartMethodOptions } from './views/components/dialog-part/interface';
+export { FloatDom } from './views/components/dom/FloatDom';
+export { GlobalZone } from './views/components/global-zone/GlobalZone';
+export { CanvasPopup } from './views/components/popup/CanvasPopup';
+export { ToolbarButton } from './views/components/ribbon/Button/ToolbarButton';
+export { type IMenuGroup, useSimpleToolbarGroups, useToolbarGroups, useToolbarItemStatus } from './views/components/ribbon/hook';
export { Ribbon } from './views/components/ribbon/Ribbon';
export { ToolbarItem } from './views/components/ribbon/ToolbarItem';
-export { ToolbarButton } from './views/components/ribbon/Button/ToolbarButton';
+export { type ISidebarMethodOptions } from './views/components/sidebar/interface';
+export { Sidebar } from './views/components/sidebar/Sidebar';
// #endregion
// #region - all commands
-export { ToggleShortcutPanelOperation } from './commands/operations/toggle-shortcut-panel.operation';
-export { SetEditorResizeOperation } from './commands/operations/editor/set-editor-resize.operation';
+export { ZenZone } from './views/components/zen-zone/ZenZone';
+export { builtInGlobalComponents } from './views/parts';
// #endregion
diff --git a/packages/ui/src/services/editor/editor.service.ts b/packages/ui/src/services/editor/editor.service.ts
index 63946a086e..d2f9e29370 100644
--- a/packages/ui/src/services/editor/editor.service.ts
+++ b/packages/ui/src/services/editor/editor.service.ts
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-import type { DocumentDataModel, IDisposable, IDocumentBody, IDocumentData, IDocumentStyle, IPosition, Nullable, Workbook } from '@univerjs/core';
import { createIdentifier, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, Disposable, EDITOR_ACTIVATED, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, HorizontalAlign, IContextService, Inject, IUniverInstanceService, toDisposable, UniverInstanceType, VerticalAlign } from '@univerjs/core';
-import type { Observable } from 'rxjs';
+import { isReferenceStrings, LexerTreeBuilder, operatorToken } from '@univerjs/engine-formula';
+import { IRenderManagerService } from '@univerjs/engine-render';
import { Subject } from 'rxjs';
+import type { DocumentDataModel, IDisposable, IDocumentBody, IDocumentData, IDocumentStyle, IPosition, Nullable, Workbook } from '@univerjs/core';
import type { IRender, ISuccinctDocRangeParam, Scene } from '@univerjs/engine-render';
-import { IRenderManagerService } from '@univerjs/engine-render';
-import { isReferenceStrings, LexerTreeBuilder, operatorToken } from '@univerjs/engine-formula';
+import type { Observable } from 'rxjs';
export interface IEditorStateParam extends Partial<IPosition> {
visible?: boolean;
diff --git a/packages/ui/src/services/local-file/desktop-file-opener.service.tsx b/packages/ui/src/services/local-file/desktop-file-opener.service.tsx
index d6e5e92ec5..4c57260bb5 100644
--- a/packages/ui/src/services/local-file/desktop-file-opener.service.tsx
+++ b/packages/ui/src/services/local-file/desktop-file-opener.service.tsx
@@ -16,13 +16,13 @@
/* eslint-disable react-refresh/only-export-components */
-import React, { useCallback, useEffect, useRef } from 'react';
-
import { connectInjector, Disposable, Inject, Injector, useDependency, useObservable } from '@univerjs/core';
+
+import React, { useCallback, useEffect, useRef } from 'react';
import { Subject } from 'rxjs';
import { BuiltInUIPart, IUIPartsService } from '../parts/parts.service';
-import type { IOpenFileOptions } from './file-opener.service';
import { ILocalFileService } from './file-opener.service';
+import type { IOpenFileOptions } from './file-opener.service';
interface IOpenFileRequest extends IOpenFileOptions {
onFileSelected: (files: File[]) => void;
diff --git a/packages/ui/src/ui-plugin.ts b/packages/ui/src/ui-plugin.ts
index 2e3f89d0b5..08a324ef72 100644
--- a/packages/ui/src/ui-plugin.ts
+++ b/packages/ui/src/ui-plugin.ts
@@ -15,14 +15,12 @@
*/
import { DependentOn, IConfigService, IContextService, ILocalStorageService, Inject, Injector, mergeOverrideWithDependencies, Plugin } from '@univerjs/core';
-import type { Dependency } from '@univerjs/core';
import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
+import type { Dependency } from '@univerjs/core';
-import { CanvasPopupService, ICanvasPopupService } from './services/popup/canvas-popup.service';
-import { DesktopGlobalZoneService } from './services/global-zone/desktop-global-zone.service';
-import { IGlobalZoneService } from './services/global-zone/global-zone.service';
import { ComponentManager } from './common/component-manager';
import { ZIndexManager } from './common/z-index-manager';
+import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
import { ErrorController } from './controllers/error/error.controller';
import { SharedController } from './controllers/shared-shortcut.controller';
import { ShortcutPanelController } from './controllers/shortcut-display/shortcut-panel.controller';
@@ -35,30 +33,32 @@ import { DesktopConfirmService } from './services/confirm/desktop-confirm.servic
import { ContextMenuService, IContextMenuService } from './services/contextmenu/contextmenu.service';
import { DesktopDialogService } from './services/dialog/desktop-dialog.service';
import { IDialogService } from './services/dialog/dialog.service';
+import { CanvasFloatDomService } from './services/dom/canvas-dom-layer.service';
+import { EditorService, IEditorService } from './services/editor/editor.service';
+import { DesktopGlobalZoneService } from './services/global-zone/desktop-global-zone.service';
+import { IGlobalZoneService } from './services/global-zone/global-zone.service';
import { DesktopLayoutService, ILayoutService } from './services/layout/layout.service';
+import { DesktopLocalFileService } from './services/local-file/desktop-file-opener.service';
+import { ILocalFileService } from './services/local-file/file-opener.service';
import { DesktopLocalStorageService } from './services/local-storage/local-storage.service';
import { IMenuService, MenuService } from './services/menu/menu.service';
+import { IMenuManagerService, MenuManagerService } from './services/menu/menu-manager.service';
import { DesktopMessageService } from './services/message/desktop-message.service';
import { IMessageService } from './services/message/message.service';
import { DesktopNotificationService } from './services/notification/desktop-notification.service';
import { INotificationService } from './services/notification/notification.service';
+import { IUIPartsService, UIPartsService } from './services/parts/parts.service';
import { IPlatformService, PlatformService } from './services/platform/platform.service';
+import { CanvasPopupService, ICanvasPopupService } from './services/popup/canvas-popup.service';
+import { IProgressService, ProgressService } from './services/progress/progress.service';
+import { IRangeSelectorService, RangeSelectorService } from './services/range-selector/range-selector.service';
import { IShortcutService, ShortcutService } from './services/shortcut/shortcut.service';
import { ShortcutPanelService } from './services/shortcut/shortcut-panel.service';
import { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';
import { ISidebarService } from './services/sidebar/sidebar.service';
import { DesktopZenZoneService } from './services/zen-zone/desktop-zen-zone.service';
import { IZenZoneService } from './services/zen-zone/zen-zone.service';
-import { EditorService, IEditorService } from './services/editor/editor.service';
-import { IRangeSelectorService, RangeSelectorService } from './services/range-selector/range-selector.service';
-import { IProgressService, ProgressService } from './services/progress/progress.service';
-import { IUIPartsService, UIPartsService } from './services/parts/parts.service';
-import { CanvasFloatDomService } from './services/dom/canvas-dom-layer.service';
-import { IMenuManagerService, MenuManagerService } from './services/menu/menu-manager.service';
import type { IUniverUIConfig } from './controllers/config.schema';
-import { defaultPluginConfig, PLUGIN_CONFIG_KEY } from './controllers/config.schema';
-import { ILocalFileService } from './services/local-file/file-opener.service';
-import { DesktopLocalFileService } from './services/local-file/desktop-file-opener.service';
export const UNIVER_UI_PLUGIN_NAME = 'UNIVER_UI_PLUGIN';
diff --git a/packages/ui/src/views/components/context-menu/ContextMenu.tsx b/packages/ui/src/views/components/context-menu/ContextMenu.tsx
index a987181fc4..b233318e12 100644
--- a/packages/ui/src/views/components/context-menu/ContextMenu.tsx
+++ b/packages/ui/src/views/components/context-menu/ContextMenu.tsx
@@ -16,8 +16,8 @@
import { ICommandService, useDependency, useInjector } from '@univerjs/core';
import { Popup } from '@univerjs/design';
-import type { IMouseEvent } from '@univerjs/engine-render';
import React, { useEffect, useRef, useState } from 'react';
+import type { IMouseEvent } from '@univerjs/engine-render';
import { Menu } from '../../../components/menu/desktop/Menu';
import { IContextMenuService } from '../../../services/contextmenu/contextmenu.service';
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9f7fa010af..6558e23bd8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -31,7 +31,7 @@ importers:
'@storybook/react':
specifier: 8.2.9
'@types/node':
specifier: ^22.5.4
version: 22.5.4
@@ -133,7 +133,7 @@ importers:
'@storybook/addon-interactions':
specifier: 8.2.9
'@storybook/addon-links':
specifier: 8.2.9
@@ -151,7 +151,7 @@ importers:
'@storybook/react':
specifier: 8.2.9
'@storybook/react-webpack5':
specifier: 8.2.9
@@ -175,7 +175,7 @@ importers:
storybook:
specifier: 8.2.9
- version: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ version: 8.2.9(@babel/[email protected])
storybook-addon-swc:
specifier: ^1.2.0
@@ -1923,6 +1923,9 @@ importers:
'@univerjs/sheets-formula':
specifier: workspace:*
version: link:../sheets-formula
+ '@univerjs/sheets-numfmt':
+ specifier: workspace:*
+ version: link:../sheets-numfmt
'@univerjs/sheets-ui':
specifier: workspace:*
version: link:../sheets-ui
@@ -11233,7 +11236,7 @@ snapshots:
'@stylistic/eslint-plugin': 2.8.0([email protected]([email protected]))([email protected])
'@typescript-eslint/parser': 8.5.0([email protected]([email protected]))([email protected])
eslint: 9.10.0([email protected])
eslint-config-flat-gitignore: 0.3.0([email protected]([email protected]))
eslint-flat-config-utils: 0.4.0
@@ -12239,7 +12242,7 @@ snapshots:
filesize: 10.1.4
jsonfile: 6.1.0
react-confetti: 6.1.0([email protected])
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
strip-ansi: 7.1.0
transitivePeerDependencies:
- '@chromatic-com/cypress'
@@ -13179,21 +13182,21 @@ snapshots:
'@types/uuid': 9.0.8
dequal: 2.0.3
polished: 4.3.1
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
uuid: 9.0.1
dependencies:
'@storybook/global': 5.0.0
memoizerific: 1.11.3
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
ts-dedent: 2.2.0
dependencies:
dequal: 2.0.3
lodash: 4.17.21
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
ts-dedent: 2.2.0
@@ -13203,14 +13206,14 @@ snapshots:
'@storybook/csf-plugin': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
'@storybook/global': 5.0.0
'@types/react': 18.3.5
fs-extra: 11.2.0
react: 18.3.1
react-dom: 18.3.1([email protected])
rehype-external-links: 3.0.0
rehype-slug: 6.0.0
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
ts-dedent: 2.2.0
transitivePeerDependencies:
- supports-color
@@ -13226,7 +13229,7 @@ snapshots:
'@storybook/addon-outline': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
'@storybook/addon-toolbars': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
'@storybook/addon-viewport': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
ts-dedent: 2.2.0
transitivePeerDependencies:
- supports-color
@@ -13234,15 +13237,15 @@ snapshots:
dependencies:
'@storybook/global': 5.0.0
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
dependencies:
'@storybook/global': 5.0.0
'@storybook/instrumenter': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
polished: 4.3.1
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
ts-dedent: 2.2.0
transitivePeerDependencies:
- '@jest/globals'
@@ -13255,7 +13258,7 @@ snapshots:
dependencies:
'@storybook/csf': 0.1.11
'@storybook/global': 5.0.0
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
ts-dedent: 2.2.0
optionalDependencies:
react: 18.3.1
@@ -13263,13 +13266,13 @@ snapshots:
dependencies:
'@storybook/global': 5.0.0
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
tiny-invariant: 1.3.3
dependencies:
'@storybook/global': 5.0.0
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
ts-dedent: 2.2.0
@@ -13279,12 +13282,12 @@ snapshots:
dependencies:
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
dependencies:
memoizerific: 1.11.3
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
dependencies:
@@ -13307,7 +13310,7 @@ snapshots:
memoizerific: 1.11.3
polished: 4.3.1
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
telejson: 7.2.0
ts-dedent: 2.2.0
util-deprecate: 1.0.2
@@ -13334,7 +13337,7 @@ snapshots:
path-browserify: 1.0.1
process: 0.11.10
semver: 7.6.3
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
ts-dedent: 2.2.0
@@ -13365,7 +13368,7 @@ snapshots:
'@types/cross-spawn': 6.0.6
cross-spawn: 7.0.3
globby: 14.0.2
- jscodeshift: 0.15.2(@babel/[email protected](@babel/[email protected]))
+ jscodeshift: 0.15.2(@babel/[email protected])
lodash: 4.17.21
prettier: 3.3.3
recast: 0.23.9
@@ -13375,14 +13378,14 @@ snapshots:
- supports-color
- utf-8-validate
dependencies:
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
dependencies:
'@types/node': 18.19.47
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
ts-dedent: 2.2.0
'@storybook/[email protected]':
@@ -13405,7 +13408,7 @@ snapshots:
dependencies:
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
unplugin: 1.12.2
'@storybook/[email protected]':
@@ -13423,19 +13426,19 @@ snapshots:
dependencies:
'@storybook/global': 5.0.0
'@vitest/utils': 1.6.0
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
util: 0.12.5
dependencies:
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
'@storybook/[email protected]': {}
dependencies:
'@storybook/core-webpack': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
'@storybook/react-docgen-typescript-plugin': 1.0.6--canary.9.0c3f3b7.0([email protected])([email protected](@swc/[email protected])([email protected]))
'@types/node': 18.19.47
'@types/semver': 7.5.8
@@ -13447,7 +13450,7 @@ snapshots:
react-dom: 18.3.1([email protected])
resolve: 1.22.8
semver: 7.6.3
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
tsconfig-paths: 4.2.0
webpack: 5.94.0(@swc/[email protected])([email protected])
optionalDependencies:
@@ -13459,9 +13462,9 @@ snapshots:
- uglify-js
- webpack-cli
dependencies:
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
dependencies:
@@ -13477,21 +13480,21 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
react: 18.3.1
react-dom: 18.3.1([email protected])
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
dependencies:
'@types/node': 18.19.47
react: 18.3.1
react-dom: 18.3.1([email protected])
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
optionalDependencies:
typescript: 5.6.2
transitivePeerDependencies:
@@ -13502,14 +13505,14 @@ snapshots:
- uglify-js
- webpack-cli
dependencies:
- '@storybook/components': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
+ '@storybook/components': 8.2.9([email protected](@babel/[email protected]))
'@storybook/global': 5.0.0
- '@storybook/manager-api': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
- '@storybook/preview-api': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
- '@storybook/theming': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
+ '@storybook/manager-api': 8.2.9([email protected](@babel/[email protected]))
+ '@storybook/preview-api': 8.2.9([email protected](@babel/[email protected]))
+ '@storybook/theming': 8.2.9([email protected](@babel/[email protected]))
'@types/escodegen': 0.0.6
'@types/estree': 0.0.51
'@types/node': 18.19.47
@@ -13524,23 +13527,23 @@ snapshots:
react-dom: 18.3.1([email protected])
react-element-to-jsx-string: 15.0.0([email protected]([email protected]))([email protected])
semver: 7.6.3
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
ts-dedent: 2.2.0
type-fest: 2.19.0
util-deprecate: 1.0.2
optionalDependencies:
typescript: 5.6.2
dependencies:
'@storybook/csf': 0.1.11
'@storybook/instrumenter': 8.2.9([email protected](@babel/[email protected](@babel/[email protected])))
'@testing-library/dom': 10.1.0
'@testing-library/user-event': 14.5.2(@testing-library/[email protected])
'@vitest/expect': 1.6.0
'@vitest/spy': 1.6.0
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
util: 0.12.5
transitivePeerDependencies:
- '@jest/globals'
@@ -13549,13 +13552,13 @@ snapshots:
- jest
- vitest
dependencies:
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
dependencies:
- storybook: 8.2.9(@babel/[email protected](@babel/[email protected]))
+ storybook: 8.2.9(@babel/[email protected])
dependencies:
@@ -13636,7 +13639,7 @@ snapshots:
lz-string: 1.5.0
pretty-format: 27.5.1
dependencies:
'@adobe/css-tools': 4.4.0
'@babel/runtime': 7.25.4
@@ -14006,7 +14009,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
eslint: 9.10.0([email protected])
optionalDependencies:
@@ -17173,7 +17176,7 @@ snapshots:
dependencies:
'@babel/core': 7.25.2
'@babel/parser': 7.25.4
@@ -19556,7 +19559,7 @@ snapshots:
webpack: 5.94.0(@swc/[email protected])([email protected])
dependencies:
'@babel/core': 7.25.2
'@babel/types': 7.25.4
@@ -19576,7 +19579,7 @@ snapshots:
fs-extra: 11.2.0
giget: 1.2.3
globby: 14.0.2
- jscodeshift: 0.15.2(@babel/[email protected](@babel/[email protected]))
+ jscodeshift: 0.15.2(@babel/[email protected])
leven: 3.1.0
ora: 5.4.1
prettier: 3.3.3