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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix: fix import error (#2384)
Wenzhao Hu3345064bbcdb
diff --git a/packages/docs-ui/src/controllers/doc-floating-object.controller.ts b/packages/docs-ui/src/controllers/doc-floating-object.controller.tsindex 9567211579..b5bca74aaa 100644--- a/packages/docs-ui/src/controllers/doc-floating-object.controller.ts+++ b/packages/docs-ui/src/controllers/doc-floating-object.controller.ts@@ -20,8 +20,6 @@ import {DEFAULT_DOCUMENT_SUB_COMPONENT_ID,Disposable,ICommandService,- IDrawingManagerService,- IUniverInstanceService,LifecycleStages,OnLifecycle,PositionedObjectLayoutType,@@ -41,10 +39,8 @@ export class DocFloatingObjectController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ICommandService private readonly _commandService: ICommandService,- @IDrawingManagerService private readonly _drawingManagerService: IDrawingManagerService,@IEditorService private readonly _editorService: IEditorService) {super();diff --git a/packages/docs-ui/src/controllers/drawing.controller.ts b/packages/docs-ui/src/controllers/drawing.controller.tsindex 9567211579..b5bca74aaa 100644--- a/packages/docs-ui/src/controllers/drawing.controller.ts+++ b/packages/docs-ui/src/controllers/drawing.controller.ts@@ -20,8 +20,6 @@ import {DEFAULT_DOCUMENT_SUB_COMPONENT_ID,Disposable,ICommandService,- IDrawingManagerService,- IUniverInstanceService,LifecycleStages,OnLifecycle,PositionedObjectLayoutType,@@ -41,10 +39,8 @@ export class DocFloatingObjectController extends Disposable {constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,- @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ICommandService private readonly _commandService: ICommandService,- @IDrawingManagerService private readonly _drawingManagerService: IDrawingManagerService,@IEditorService private readonly _editorService: IEditorService) {super();diff --git a/packages/docs-ui/src/shortcuts/utils.ts b/packages/docs-ui/src/shortcuts/utils.tsindex cdd79056c2..d69fd6499d 100644--- a/packages/docs-ui/src/shortcuts/utils.ts+++ b/packages/docs-ui/src/shortcuts/utils.ts@@ -18,9 +18,14 @@ import type { IContextService } from '@univerjs/core';import { FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE } from '@univerjs/core';export function whenDocAndEditorFocused(contextService: IContextService): boolean {- return contextService.getContextValue(FOCUSING_DOC) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && !contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);+ return contextService.getContextValue(FOCUSING_DOC)+ && contextService.getContextValue(FOCUSING_UNIVER_EDITOR)+ && !contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);}export function whenDocAndEditorFocusedWithBreakLine(contextService: IContextService): boolean {- return contextService.getContextValue(FOCUSING_DOC) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && !contextService.getContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE) && !contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);+ return contextService.getContextValue(FOCUSING_DOC)+ && contextService.getContextValue(FOCUSING_UNIVER_EDITOR)+ && !contextService.getContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE)+ && !contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);}diff --git a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.tsindex a43edd6f83..7c0395bb80 100644--- a/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts+++ b/packages/sheets-filter-ui/src/controllers/__tests__/sheets-filter.menu.spec.ts@@ -15,14 +15,13 @@*/import type { IRange, IWorkbookData } from '@univerjs/core';-import { AuthzIoLocalService, DisposableCollection, IAuthzIoService, ICommandService, IDrawingManagerService, LocaleType, Plugin, RANGE_TYPE, Univer, UniverInstanceType } from '@univerjs/core';+import { AuthzIoLocalService, DisposableCollection, IAuthzIoService, ICommandService, LocaleType, Plugin, RANGE_TYPE, Univer, UniverInstanceType } from '@univerjs/core';import { NORMAL_SELECTION_PLUGIN_NAME, RangeProtectionRuleModel, RefRangeService, SelectionManagerService, SetWorksheetActiveOperation, SheetInterceptorService, WorkbookPermissionService, WorksheetPermissionService, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';import type { ISetSheetsFilterCriteriaMutationParams, ISetSheetsFilterRangeMutationParams } from '@univerjs/sheets-filter';import { RemoveSheetsFilterMutation, SetSheetsFilterCriteriaMutation, SetSheetsFilterRangeMutation, UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import { DesktopMenuService, DesktopPlatformService, DesktopShortcutService, IMenuService, IPlatformService, IShortcutService } from '@univerjs/ui';import { Injector } from '@wendellhu/redi';import { afterEach, beforeEach, describe, expect, it } from 'vitest';-import { DrawingManagerService } from '@univerjs/drawing';import { ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, SmartToggleSheetsFilterCommand } from '../../commands/sheets-filter.command';import { CloseFilterPanelOperation, OpenFilterPanelOperation } from '../../commands/sheets-filter.operation';import { ClearFilterCriteriaMenuItemFactory, ReCalcFilterMenuItemFactory, SmartToggleFilterMenuItemFactory } from '../sheets-filter.menu';@@ -74,7 +73,6 @@ function createSheetsFilterMenuTestBed() {injector.add([WorksheetProtectionRuleModel]);injector.add([SheetInterceptorService]);injector.add([RangeProtectionRuleModel]);- injector.add([IDrawingManagerService, { useClass: DrawingManagerService }]);const commandService = injector.get(ICommandService);[diff --git a/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.ts b/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.tsindex eb1073e7fe..1e5aac9fb0 100644--- a/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.ts+++ b/packages/sheets-ui/src/controllers/menu/__tests__/create-menu-test-bed.ts@@ -15,7 +15,7 @@*/import type { IWorkbookData } from '@univerjs/core';-import { IDrawingManagerService, LocaleType, Plugin, Univer, UniverInstanceType } from '@univerjs/core';+import { LocaleType, Plugin, Univer, UniverInstanceType } from '@univerjs/core';import { RangeProtectionRefRangeService, RangeProtectionRenderModel, RangeProtectionRuleModel, RangeProtectionService, RefRangeService, SelectionManagerService,SheetInterceptorService,WorkbookPermissionService,@@ -26,7 +26,6 @@ import { RangeProtectionRefRangeService, RangeProtectionRenderModel, RangeProtecimport { DesktopMenuService, DesktopPlatformService, DesktopShortcutService, IMenuService, IPlatformService, IShortcutService } from '@univerjs/ui';import { Inject, Injector } from '@wendellhu/redi';import { IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';-import { DrawingManagerService } from '@univerjs/drawing';const TEST_WORKBOOK_DATA_DEMO: IWorkbookData = {id: 'test',@@ -79,7 +78,6 @@ export function createMenuTestBed() {injector.add([WorksheetProtectionRuleModel]);injector.add([IRenderManagerService, { useClass: RenderManagerService }]);injector.add([RefRangeService]);- injector.add([IDrawingManagerService, { useClass: DrawingManagerService }]);injector.add([RangeProtectionRefRangeService]);injector.add([RangeProtectionRenderModel]);diff --git a/packages/sheets-ui/src/controllers/menu/menu-util.ts b/packages/sheets-ui/src/controllers/menu/menu-util.tsindex ac42113909..db977ec125 100644--- a/packages/sheets-ui/src/controllers/menu/menu-util.ts+++ b/packages/sheets-ui/src/controllers/menu/menu-util.ts@@ -15,7 +15,7 @@*/import type { ICellDataForSheetInterceptor, IPermissionTypes, IRange, Nullable, Workbook, Worksheet } from '@univerjs/core';-import { IDrawingManagerService, IPermissionService, IUniverInstanceService, Rectangle, Tools, UniverInstanceType, UserManagerService } from '@univerjs/core';+import { FOCUSING_COMMON_DRAWINGS, IContextService, IPermissionService, IUniverInstanceService, Rectangle, Tools, UniverInstanceType, UserManagerService } from '@univerjs/core';import { UnitAction } from '@univerjs/protocol';import type { ICellPermission } from '@univerjs/sheets';@@ -53,13 +53,15 @@ export function getCurrentRangeDisable$(accessor: IAccessor, permissionTypes: IPconst worksheetRuleModel = accessor.get(WorksheetProtectionRuleModel);const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET)!;const userManagerService = accessor.get(UserManagerService);- const drawingManagerService = accessor.get(IDrawingManagerService);+ const contextService = accessor.get(IContextService);+ const focusedOnDrawing$ = contextService.subscribeContextValue$(FOCUSING_COMMON_DRAWINGS);if (!workbook) {return of(true);}- return combineLatest([userManagerService.currentUser$, workbook.activeSheet$, selectionManagerService.selectionMoveEnd$, drawingManagerService.focus$]).pipe(- switchMap(([user, sheet, selection, drawings]) => {- if (drawings.length > 0) {++ return combineLatest([userManagerService.currentUser$, workbook.activeSheet$, selectionManagerService.selectionMoveEnd$, focusedOnDrawing$]).pipe(+ switchMap(([_, __, ___, focusOnDrawings]) => {+ if (focusOnDrawings) {return of(true);}@@ -115,17 +117,21 @@ export function getCommentDisable$(accessor: IAccessor, permissionTypes: IPermisconst rangeProtectionRuleModel = accessor.get(RangeProtectionRuleModel);const worksheetRuleModel = accessor.get(WorksheetProtectionRuleModel);const userManagerService = accessor.get(UserManagerService);- const drawingManagerService = accessor.get(IDrawingManagerService);- return combineLatest([userManagerService.currentUser$, selectionManagerService.selectionMoveEnd$, drawingManagerService.focus$]).pipe(- switchMap(([_, __, drawings]) => {++ const contextService = accessor.get(IContextService);+ const focusedOnDrawing$ = contextService.subscribeContextValue$(FOCUSING_COMMON_DRAWINGS);++ return combineLatest([userManagerService.currentUser$, selectionManagerService.selectionMoveEnd$, focusedOnDrawing$]).pipe(+ switchMap(([_, __, focusOnDrawing]) => {const workbook = univerInstanceService.getCurrentUnitForType<Workbook>(UniverInstanceType.UNIVER_SHEET);if (!workbook) {return of(true);}- if (drawings.length > 0) {+ if (focusOnDrawing) {return of(true);}+const worksheet = workbook.getActiveSheet();const unitId = workbook.getUnitId();const subUnitId = worksheet.getSheetId();diff --git a/packages/sheets-ui/src/controllers/menu/permission-menu-util.ts b/packages/sheets-ui/src/controllers/menu/permission-menu-util.tsindex e49032136d..744735eb55 100644--- a/packages/sheets-ui/src/controllers/menu/permission-menu-util.ts+++ b/packages/sheets-ui/src/controllers/menu/permission-menu-util.ts@@ -15,7 +15,7 @@*/import type { ICellData, Workbook } from '@univerjs/core';-import { IDrawingManagerService, IPermissionService, IUniverInstanceService, Rectangle, UniverInstanceType, UserManagerService } from '@univerjs/core';+import { FOCUSING_COMMON_DRAWINGS, IContextService, IPermissionService, IUniverInstanceService, Rectangle, UniverInstanceType, UserManagerService } from '@univerjs/core';import type { ISheetRenderExtension } from '@univerjs/engine-render';import { RangeProtectionRuleModel, SelectionManagerService, WorkbookEditablePermission, WorkbookManageCollaboratorPermission, WorksheetProtectionRuleModel } from '@univerjs/sheets';import type { IAccessor } from '@wendellhu/redi';@@ -156,13 +156,15 @@ export function getAddPermissionDisableBase$(accessor: IAccessor) {const selectionManagerService = accessor.get(SelectionManagerService);const userManagerService = accessor.get(UserManagerService);const permissionService = accessor.get(IPermissionService);- const drawingManagerService = accessor.get(IDrawingManagerService);+ const contextService = accessor.get(IContextService);+ const focusingDrawing$ = contextService.subscribeContextValue$(FOCUSING_COMMON_DRAWINGS);- return combineLatest([workbook.activeSheet$, userManagerService.currentUser$, drawingManagerService.focus$]).pipe(- switchMap(([sheet, _, drawings]) => {- if (!sheet || drawings.length > 0) {+ return combineLatest([workbook.activeSheet$, userManagerService.currentUser$, focusingDrawing$]).pipe(+ switchMap(([sheet, _, focusOnDrawing]) => {+ if (!sheet || focusOnDrawing) {return of(true);}+const subUnitId = sheet.getSheetId();const permission$ = permissionService.getPermissionPoint$(new WorkbookManageCollaboratorPermission(unitId).id)?.pipe(map((e) => !!e.value)) ?? of(false);const ruleChange$ = merge(