@univerjs/sheets-ui 0.6.0-experimental.20250125-1d060b9 → 0.6.0-experimental.20250220-d9a8e74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +54 -52
  3. package/lib/es/facade.js +656 -563
  4. package/lib/es/index.js +8672 -8437
  5. package/lib/index.css +1 -1
  6. package/lib/types/common/keys.d.ts +1 -1
  7. package/lib/types/components/border-panel/border-line/icons/BorderDashDot.d.ts +1 -1
  8. package/lib/types/components/border-panel/border-line/icons/BorderDashDotDot.d.ts +1 -1
  9. package/lib/types/components/border-panel/border-line/icons/BorderDashed.d.ts +1 -1
  10. package/lib/types/components/border-panel/border-line/icons/BorderDotted.d.ts +1 -1
  11. package/lib/types/components/border-panel/border-line/icons/BorderHair.d.ts +1 -1
  12. package/lib/types/components/border-panel/border-line/icons/BorderMedium.d.ts +1 -1
  13. package/lib/types/components/border-panel/border-line/icons/BorderMediumDashDot.d.ts +1 -1
  14. package/lib/types/components/border-panel/border-line/icons/BorderMediumDashDotDot.d.ts +1 -1
  15. package/lib/types/components/border-panel/border-line/icons/BorderMediumDashed.d.ts +1 -1
  16. package/lib/types/components/border-panel/border-line/icons/BorderThick.d.ts +1 -1
  17. package/lib/types/components/border-panel/border-line/icons/BorderThin.d.ts +1 -1
  18. package/lib/types/components/color-picker/index.d.ts +1 -1
  19. package/lib/types/components/color-picker/interface.d.ts +1 -1
  20. package/lib/types/components/const.d.ts +1 -1
  21. package/lib/types/components/font-family/index.d.ts +1 -1
  22. package/lib/types/components/font-family/interface.d.ts +1 -1
  23. package/lib/types/components/font-size/index.d.ts +1 -1
  24. package/lib/types/components/font-size/interface.d.ts +1 -1
  25. package/lib/types/components/menu-item-input/index.d.ts +1 -1
  26. package/lib/types/consts/plugin-name.d.ts +1 -1
  27. package/lib/types/consts/ui-name.d.ts +1 -1
  28. package/lib/types/controllers/auto-fill.controller.d.ts +1 -1
  29. package/lib/types/controllers/clipboard/clipboard.controller.d.ts +3 -0
  30. package/lib/types/controllers/clipboard/const.d.ts +1 -1
  31. package/lib/types/controllers/editor/utils/{isEmbeddingFormulaEditor.d.ts → is-embedding-formula-editor.d.ts} +1 -1
  32. package/lib/types/controllers/editor/utils/{isRangeSelector.d.ts → is-range-selector.d.ts} +1 -1
  33. package/lib/types/controllers/format-painter/format-painter.controller.d.ts +0 -1
  34. package/lib/types/controllers/permission/sheet-permission-init-ui.controller.d.ts +7 -0
  35. package/lib/types/controllers/render-controllers/clipboard.render-controller.d.ts +13 -0
  36. package/lib/types/controllers/render-controllers/format-painter.render-controller.d.ts +6 -2
  37. package/lib/types/controllers/render-controllers/scroll.render-controller.d.ts +1 -0
  38. package/lib/types/controllers/render-controllers/skeleton.render-controller.d.ts +4 -2
  39. package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +1 -1
  40. package/lib/types/controllers/utils/cell-tools.d.ts +1 -1
  41. package/lib/types/facade/f-event.d.ts +6 -3
  42. package/lib/types/facade/f-univer.d.ts +4 -6
  43. package/lib/types/facade/index.d.ts +1 -1
  44. package/lib/types/index.d.ts +8 -7
  45. package/lib/types/locale/zh-CN.d.ts +1 -1
  46. package/lib/types/services/clipboard/clipboard.service.d.ts +4 -0
  47. package/lib/types/services/clipboard/utils.d.ts +1 -0
  48. package/lib/types/services/editor-bridge.service.d.ts +5 -0
  49. package/lib/types/services/scroll-manager.service.d.ts +17 -12
  50. package/lib/types/services/sheet-skeleton-manager.service.d.ts +39 -16
  51. package/lib/types/services/sheets-render.service.d.ts +1 -1
  52. package/lib/types/views/cell-alert/index.d.ts +1 -1
  53. package/lib/types/views/clipboard/ClipboardPopupMenu.d.ts +1 -1
  54. package/lib/types/views/count-bar/CountBar.d.ts +1 -1
  55. package/lib/types/views/count-bar/ZoomSlider.d.ts +1 -1
  56. package/lib/types/views/count-bar/index.d.ts +1 -1
  57. package/lib/types/views/defined-name/DefinedName.d.ts +1 -1
  58. package/lib/types/views/defined-name/DefinedNameContainer.d.ts +1 -1
  59. package/lib/types/views/defined-name/DefinedNameOverlay.d.ts +1 -1
  60. package/lib/types/views/defined-name/component-name.d.ts +1 -1
  61. package/lib/types/views/editor-container/index.d.ts +1 -1
  62. package/lib/types/views/formula-bar/FormulaBar.d.ts +6 -2
  63. package/lib/types/views/formula-bar/index.d.ts +1 -1
  64. package/lib/types/views/mobile/sheet-bar/MobileSheetBar.d.ts +1 -1
  65. package/lib/types/views/operate-container/index.d.ts +1 -1
  66. package/lib/types/views/permission/error-msg-dialog/index.d.ts +1 -1
  67. package/lib/types/views/permission/error-msg-dialog/interface.d.ts +1 -1
  68. package/lib/types/views/permission/extensions/protect-background-img.d.ts +1 -1
  69. package/lib/types/views/permission/index.d.ts +1 -1
  70. package/lib/types/views/permission/panel-list/constant.d.ts +1 -1
  71. package/lib/types/views/permission/panel-list/index.d.ts +1 -1
  72. package/lib/types/views/permission/permission-dialog/index.d.ts +1 -1
  73. package/lib/types/views/permission/user-dialog/constant.d.ts +1 -1
  74. package/lib/types/views/permission/user-dialog/index.d.ts +1 -1
  75. package/lib/types/views/sheet-bar/SheetBar.d.ts +1 -1
  76. package/lib/types/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.d.ts +1 -1
  77. package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/animate.d.ts +1 -1
  78. package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/slide-tab-bar.d.ts +2 -2
  79. package/lib/types/views/sheet-container/SheetContainer.d.ts +1 -1
  80. package/lib/types/views/status-bar/CopyableStatisticItem.d.ts +1 -1
  81. package/lib/types/views/status-bar/StatusBar.d.ts +1 -1
  82. package/lib/umd/facade.js +1 -1
  83. package/lib/umd/index.js +47 -45
  84. package/package.json +17 -17
  85. /package/lib/types/hooks/{useHighlightRange.d.ts → use-highlight-range.d.ts} +0 -0
@@ -26,7 +26,9 @@ interface ICopyContent {
26
26
  export interface ISheetClipboardService {
27
27
  showMenu$: Observable<boolean>;
28
28
  setShowMenu: (show: boolean) => void;
29
+ getPasteMenuVisible: () => boolean;
29
30
  pasteOptionsCache$: Observable<IPasteOptionCache | null>;
31
+ getPasteOptionsCache: () => IPasteOptionCache | null;
30
32
  updatePasteOptionsCache(cache: IPasteOptionCache | null): void;
31
33
  copy(): Promise<boolean>;
32
34
  cut(): Promise<boolean>;
@@ -69,6 +71,8 @@ export declare class SheetClipboardService extends Disposable implements ISheetC
69
71
  readonly showMenu$: Observable<boolean>;
70
72
  constructor(_logService: ILogService, _univerInstanceService: IUniverInstanceService, _selectionManagerService: SheetsSelectionsService, _clipboardInterfaceService: IClipboardInterfaceService, _undoRedoService: IUndoRedoService, _commandService: ICommandService, _markSelectionService: IMarkSelectionService, _notificationService: INotificationService, _platformService: IPlatformService, _renderManagerService: IRenderManagerService, _themeService: ThemeService, _localeService: LocaleService, _errorService: ErrorService, _injector: Injector);
71
73
  setShowMenu(show: boolean): void;
74
+ getPasteMenuVisible(): boolean;
75
+ getPasteOptionsCache(): IPasteOptionCache | null;
72
76
  copyContentCache(): CopyContentCache;
73
77
  generateCopyContent(workbookId: string, worksheetId: string, range: IRange): Nullable<ICopyContent>;
74
78
  copy(copyType?: COPY_TYPE): Promise<boolean>;
@@ -14,6 +14,7 @@ export declare const getRepeatRange: (sourceRange: IRange, targetRange: IRange,
14
14
  repeatRelativeRange: IRange;
15
15
  }[];
16
16
  export declare function htmlIsFromExcel(html: string): boolean;
17
+ export declare function htmlContainsImage(html: string): boolean;
17
18
  export declare function mergeCellValues(...cellValues: IObjectMatrixPrimitiveType<Nullable<ICellData>>[]): IObjectMatrixPrimitiveType<Nullable<ICellData>> | IObjectMatrixPrimitiveType<IObjectMatrixPrimitiveType<Nullable<ICellData>>>;
18
19
  export declare function getRangeValuesMergeable(m1: IMutationInfo<ISetRangeValuesMutationParams>, m2: IMutationInfo<ISetRangeValuesMutationParams>): boolean;
19
20
  export declare function mergeSetRangeValues(mutations: IMutationInfo[]): IMutationInfo<object>[];
@@ -50,7 +50,11 @@ export interface IEditorBridgeService {
50
50
  getEditCellState(): Readonly<Nullable<IEditorBridgeServiceParam>>;
51
51
  getEditCellLayout(): Readonly<Nullable<ICellEditorLayout>>;
52
52
  getEditLocation(): Readonly<Nullable<ICellEditorState>>;
53
+ updateEditLocation(row: number, col: number): void;
53
54
  getLatestEditCellState(): Readonly<Nullable<IEditorBridgeServiceParam>>;
55
+ /**
56
+ * @deprecated do not use it directly, use command SetCellEditVisibleOperation as instead.
57
+ */
54
58
  changeVisible(param: IEditorBridgeServiceVisibleParam): void;
55
59
  changeEditorDirty(dirtyStatus: boolean): void;
56
60
  getEditorDirty(): boolean;
@@ -109,6 +113,7 @@ export declare class EditorBridgeService extends Disposable implements IEditorBr
109
113
  getEditCellState(): Readonly<Nullable<IEditorBridgeServiceParam>>;
110
114
  getEditCellLayout(): Readonly<Nullable<ICellEditorLayout>>;
111
115
  getEditLocation(): Readonly<Nullable<ICellEditorState>>;
116
+ updateEditLocation(row: number, column: number): void;
112
117
  getLatestEditCellState(): {
113
118
  position: {
114
119
  startX: number;
@@ -55,7 +55,7 @@ export declare class SheetScrollManagerService implements IRenderModule {
55
55
  private readonly _context;
56
56
  private readonly _sheetSkeletonManagerService;
57
57
  /**
58
- * a map holds all scroll info for each sheet
58
+ * a map holds all scroll info for each sheet(valid value)
59
59
  */
60
60
  private readonly _scrollStateMap;
61
61
  /**
@@ -80,27 +80,32 @@ export declare class SheetScrollManagerService implements IRenderModule {
80
80
  private _searchParamForScroll;
81
81
  constructor(_context: IRenderContext<Workbook>, _sheetSkeletonManagerService: SheetSkeletonManagerService);
82
82
  dispose(): void;
83
+ calcViewportScrollFromRowColOffset(scrollInfo: Nullable<IViewportScrollState>): {
84
+ viewportScrollX: number;
85
+ viewportScrollY: number;
86
+ };
83
87
  setSearchParam(param: IScrollStateSearchParam): void;
84
- setSearchParamAndRefresh(param: IScrollStateSearchParam): void;
85
- getScrollStateByParam(param: IScrollStateSearchParam): Readonly<IScrollState>;
88
+ getScrollStateByParam(param: IScrollStateSearchParam): Readonly<Nullable<IScrollState>>;
86
89
  getCurrentScrollState(): Readonly<IScrollState>;
90
+ setValidScrollState(param: IScrollStateWithSearchParam): void;
87
91
  /**
88
- * Set scrollInfo by SetScrollOperation, call by ScrollCommand.id.
92
+ * emit raw scrollInfo by SetScrollOperation, call by ScrollCommand.id.
93
+ * raw scrollInfo means not handled by limit scroll method.
89
94
  * @param param
90
95
  */
91
- setScrollInfoAndEmitEvent(param: IScrollStateWithSearchParam): void;
96
+ emitRawScrollParam(param: IScrollStateWithSearchParam): void;
92
97
  /**
93
- * Set _scrollStateMap but no _scrollInfo$.next
98
+ * Set _scrollStateMap
94
99
  * @param scroll
95
100
  */
96
- setScrollStateToCurrSheet(scroll: IScrollState): void;
101
+ setValidScrollStateToCurrSheet(scroll: IViewportScrollState): void;
97
102
  clear(): void;
98
- calcViewportScrollFromRowColOffset(scrollInfo: Nullable<IViewportScrollState>): {
99
- viewportScrollX: number;
100
- viewportScrollY: number;
101
- };
103
+ /**
104
+ * scroll
105
+ * @param scrollInfo
106
+ */
102
107
  private _setScrollState;
103
108
  private _clearByParamAndNotify;
104
109
  private _getCurrentScroll;
105
- private _scrollStateNext;
110
+ private _emitRawScroll;
106
111
  }
@@ -1,5 +1,6 @@
1
1
  import { IRange, IRangeWithCoord, Nullable, Workbook, Disposable, Injector } from '@univerjs/core';
2
2
  import { IRender, IRenderContext, IRenderModule, SpreadsheetSkeleton } from '@univerjs/engine-render';
3
+ import { SheetSkeletonService } from '@univerjs/sheets';
3
4
  export interface ISheetSkeletonManagerParam {
4
5
  unitId: string;
5
6
  sheetId: string;
@@ -12,20 +13,14 @@ export interface ISheetSkeletonManagerSearch {
12
13
  commandId?: string;
13
14
  }
14
15
  /**
15
- * This service manages the drawing of the sheet's viewModel (skeleton).
16
- *
17
- * Each time there is a content change, it will trigger the viewModel of the render to recalculate.
18
- *
19
- * Each application and sub-table has its own viewModel (skeleton).
20
- *
21
- * The viewModel is also a temporary storage variable, which does not need to be persisted,
22
- * so it is managed uniformly through the service.
16
+ * SheetSkeletonManagerService is registered in a render unit
23
17
  */
24
18
  export declare class SheetSkeletonManagerService extends Disposable implements IRenderModule {
25
19
  private readonly _context;
26
20
  private readonly _injector;
27
- private _currentSkeletonSearchParam;
28
- private _sheetSkeletonParam;
21
+ private readonly _sheetSkService;
22
+ private _sheetId;
23
+ private _sheetSkeletonParamStore;
29
24
  private readonly _currentSkeleton$;
30
25
  readonly currentSkeleton$: import('rxjs').Observable<Nullable<ISheetSkeletonManagerParam>>;
31
26
  /**
@@ -33,29 +28,57 @@ export declare class SheetSkeletonManagerService extends Disposable implements I
33
28
  */
34
29
  private readonly _currentSkeletonBefore$;
35
30
  readonly currentSkeletonBefore$: import('rxjs').Observable<Nullable<ISheetSkeletonManagerParam>>;
36
- constructor(_context: IRenderContext<Workbook>, _injector: Injector);
31
+ constructor(_context: IRenderContext<Workbook>, _injector: Injector, _sheetSkService: SheetSkeletonService);
37
32
  private _initRemoveSheet;
38
33
  getCurrentSkeleton(): Nullable<SpreadsheetSkeleton>;
34
+ /**
35
+ * @deprecated use `getCurrentSkeleton` instead.
36
+ */
39
37
  getCurrent(): Nullable<ISheetSkeletonManagerParam>;
40
- getWorksheetSkeleton(sheetId: string): Nullable<ISheetSkeletonManagerParam>;
41
38
  /**
42
- * unitId is never read?
39
+ * get ISheetSkeletonManagerParam from _currentSkeletonSearchParam
40
+ * @returns
41
+ */
42
+ getCurrentParam(): Nullable<ISheetSkeletonManagerParam>;
43
+ /**
44
+ * Get skeleton by sheetId
45
+ * @param sheetId
46
+ */
47
+ getSkeleton(sheetId: string): Nullable<SpreadsheetSkeleton>;
48
+ /**
49
+ * Get SkeletonParam by sheetId
50
+ * @param sheetId
43
51
  */
52
+ getSkeletonParam(sheetId: string): Nullable<ISheetSkeletonManagerParam>;
53
+ /**
54
+ * @deprecated use `getSkeleton` instead.
55
+ */
56
+ getWorksheetSkeleton(sheetId: string): Nullable<ISheetSkeletonManagerParam>;
44
57
  getUnitSkeleton(unitId: string, sheetId: string): Nullable<ISheetSkeletonManagerParam>;
58
+ /**
59
+ * Command in COMMAND_LISTENER_SKELETON_CHANGE would cause setCurrent, see @packages/sheets-ui/src/controllers/render-controllers/sheet.render-controller.ts
60
+ * @param searchParam
61
+ */
45
62
  setCurrent(searchParam: ISheetSkeletonManagerSearch): Nullable<ISheetSkeletonManagerParam>;
63
+ setSkeletonParam(sheetId: string, skp: ISheetSkeletonManagerParam): void;
46
64
  private _setCurrent;
47
- reCalculate(): void;
48
- private _reCalculate;
65
+ reCalculate(param?: Nullable<ISheetSkeletonManagerParam>): void;
49
66
  /**
50
67
  * Make param dirty, if param is dirty, then the skeleton will be makeDirty in _reCalculate()
51
68
  * @param searchParm
52
69
  * @param state
53
70
  */
54
71
  makeDirty(searchParm: ISheetSkeletonManagerSearch, state?: boolean): void;
72
+ /**
73
+ * @deprecated Use function `ensureSkeleton` instead.
74
+ * @param searchParam
75
+ */
55
76
  getOrCreateSkeleton(searchParam: ISheetSkeletonManagerSearch): SpreadsheetSkeleton | undefined;
56
- disposeSkeleton(searchParm: ISheetSkeletonManagerSearch): void;
77
+ ensureSkeleton(sheetId: string): SpreadsheetSkeleton | undefined;
78
+ disposeSkeleton(sheetId: string): void;
57
79
  /** @deprecated Use function `attachRangeWithCoord` instead. */
58
80
  attachRangeWithCoord(range: IRange): Nullable<IRangeWithCoord>;
81
+ private _getSkeletonParam;
59
82
  private _getSkeleton;
60
83
  private _buildSkeleton;
61
84
  setColumnHeaderSize(render: Nullable<IRender>, sheetId: string, size: number): void;
@@ -1,7 +1,7 @@
1
1
  import { IDisposable, IContextService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
2
2
  import { IRenderManagerService } from '@univerjs/engine-render';
3
3
  /**
4
- * This controller is responsible for managing units of a specific kind (UnierSheet) to be rendered on the canvas.
4
+ * This controller is responsible for managing units of a specific kind (UniverSheet) to be rendered on the canvas.
5
5
  */
6
6
  export declare class SheetsRenderService extends RxDisposable {
7
7
  private readonly _contextService;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,4 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function FormulaBar(): import("react/jsx-runtime").JSX.Element;
16
+ interface IProps {
17
+ className?: string;
18
+ }
19
+ export declare function FormulaBar(props: IProps): import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ export declare class SlideTabItem {
42
42
  selectAll(): void;
43
43
  isEditMode(): boolean;
44
44
  classList(): DOMTokenList;
45
- translateX(x: number): 1 | 0 | -1;
45
+ translateX(x: number): 0 | 1 | -1;
46
46
  setEditor(callback?: (event: FocusEvent) => void): void;
47
47
  nameCheck(): boolean;
48
48
  animate(): SlideTabItemAnimate;
@@ -56,7 +56,7 @@ export declare class SlideTabItem {
56
56
  getMidLine(): number;
57
57
  getBoundingRect(): DOMRect;
58
58
  getWidth(): number;
59
- getTranslateXDirection(): 1 | 0 | -1;
59
+ getTranslateXDirection(): 0 | 1 | -1;
60
60
  equals(other: SlideTabItem | null): boolean | null;
61
61
  getId(): string;
62
62
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
- import { default as React } from 'react';
2
1
  import { IFunctionNames } from '@univerjs/engine-formula';
2
+ import { default as React } from 'react';
3
3
  export interface IStatisticItem {
4
4
  name: IFunctionNames;
5
5
  value: number;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2023-present DreamNum Inc.
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(f,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("@univerjs/core"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("@univerjs/sheets-ui"),require("@univerjs/sheets/facade"),require("@univerjs/ui"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs","@univerjs/engine-render","@univerjs/sheets","@univerjs/sheets-ui","@univerjs/sheets/facade","@univerjs/ui","rxjs"],d):(f=typeof globalThis<"u"?globalThis:f||self,d(f.UniverSheetsUiFacade={},f.UniverCore,f.UniverDocs,f.UniverEngineRender,f.UniverSheets,f.UniverSheetsUi,f.UniverSheetsFacade,f.UniverUi,f.rxjs))})(this,function(f,d,F,S,R,a,I,C,m){"use strict";class V extends d.FUniver{_initSheetUIEvent(e){const t=e.get(d.ICommandService);this.disposeWithMe(t.beforeCommandExecuted(r=>{if(r.id===a.SetCellEditVisibleOperation.id){if(!this._eventListend(this.Event.BeforeSheetEditStart)&&!this._eventListend(this.Event.BeforeSheetEditEnd))return;const i=this.getActiveSheet();if(!i)return;const{workbook:o,worksheet:s}=i,c=e.get(a.IEditorBridgeService),u=e.get(d.IUniverInstanceService),b=r.params,{visible:v,keycode:g,eventType:E}=b,l=c.getEditLocation();if(v){const _={row:l.row,column:l.column,eventType:E,keycode:g,workbook:o,worksheet:s,isZenEditor:!1};if(this.fireEvent(this.Event.BeforeSheetEditStart,_),_.cancel)throw new d.CanceledError}else{const _={row:l.row,column:l.column,eventType:E,keycode:g,workbook:o,worksheet:s,isZenEditor:!1,value:d.RichTextValue.create(u.getUnit(d.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:g!==C.KeyCode.ESC};if(this.fireEvent(this.Event.BeforeSheetEditEnd,_),_.cancel)throw new d.CanceledError}}if(r.id===a.SetZoomRatioCommand.id){if(!this._eventListend(this.Event.BeforeSheetZoomChange))return;const i=this.getCommandSheetTarget(r);if(!i)return;const{workbook:o,worksheet:s}=i;this.fireEvent(this.Event.BeforeSheetZoomChange,{zoom:r.params.zoomRatio,workbook:o,worksheet:s})}})),this.disposeWithMe(t.onCommandExecuted(r=>{if(r.id===a.SetCellEditVisibleOperation.id){if(!this._eventListend(this.Event.SheetEditStarted)&&!this._eventListend(this.Event.SheetEditEnded))return;const i=this.getCommandSheetTarget(r);if(!i)return;const{workbook:o,worksheet:s}=i,c=e.get(a.IEditorBridgeService),u=r.params,{visible:b,keycode:v,eventType:g}=u,E=c.getEditLocation();if(b){const l={row:E.row,column:E.column,eventType:g,keycode:v,workbook:o,worksheet:s,isZenEditor:!1};this.fireEvent(this.Event.SheetEditStarted,l)}else{const l={row:E.row,column:E.column,eventType:g,keycode:v,workbook:o,worksheet:s,isZenEditor:!1,isConfirm:v!==C.KeyCode.ESC};this.fireEvent(this.Event.SheetEditEnded,l)}}if(r.id===F.RichTextEditingMutation.id){if(!this._eventListend(this.Event.SheetEditChanging))return;const i=this.getCommandSheetTarget(r);if(!i)return;const{workbook:o,worksheet:s}=i,c=e.get(a.IEditorBridgeService),u=e.get(d.IUniverInstanceService),b=r.params;if(!c.isVisible().visible)return;const{unitId:v}=b;if(v===d.DOCS_NORMAL_EDITOR_UNIT_ID_KEY){const{row:g,column:E}=c.getEditLocation(),l={workbook:o,worksheet:s,row:g,column:E,value:d.RichTextValue.create(u.getUnit(d.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!1};this.fireEvent(this.Event.SheetEditChanging,l)}}if(r.id===a.SetZoomRatioCommand.id){if(!this._eventListend(this.Event.SheetZoomChanged))return;const i=this.getCommandSheetTarget(r);if(!i)return;const{workbook:o,worksheet:s}=i;this.fireEvent(this.Event.SheetZoomChanged,{zoom:s.getZoom(),workbook:o,worksheet:s})}})),this._initObserverListener(e)}_initObserverListener(e){const r=e.get(d.IUniverInstanceService).getFocusedUnit(),i=r==null?void 0:r.getUnitId(),o=e.get(S.IRenderManagerService);if(i){const v=e.get(d.LifecycleService),g=new d.DisposableCollection;this.disposeWithMe(v.lifecycle$.subscribe(E=>{var P,H,p,w,k,T,B,L,x,W,A,O,U,$,j;if(E<d.LifecycleStages.Rendered)return;g.dispose();const l=e.get(a.HoverManagerService),_=e.get(a.DragManagerService);l&&(g.add((P=l.currentClickedCell$)==null?void 0:P.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.CellClicked))return;const h=this.getSheetTarget(n.location.unitId,n.location.subUnitId);h&&this.fireEvent(this.Event.CellClicked,{...h,...n,row:n.location.row,column:n.location.col})})),g.add((H=l.currentRichText$)==null?void 0:H.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.CellHover))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.CellHover,{...h,...n,row:n.row,column:n.col})})),g.add((p=l.currentPointerDownCell$)==null?void 0:p.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.CellPointerDown))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.CellPointerDown,{...h,...n,row:n.row,column:n.col})})),g.add((w=l.currentPointerUpCell$)==null?void 0:w.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.CellPointerUp))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.CellPointerUp,{...h,...n,row:n.row,column:n.col})})),g.add((k=l.currentCellPosWithEvent$)==null?void 0:k.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.CellPointerMove))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.CellPointerMove,{...h,...n,row:n.row,column:n.col})})),g.add((T=_.currentCell$)==null?void 0:T.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.DragOver))return;const h=this.getSheetTarget(n.location.unitId,n.location.subUnitId);h&&this.fireEvent(this.Event.DragOver,{...h,...n,row:n.location.row,column:n.location.col})})),g.add((B=_.endCell$)==null?void 0:B.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.Drop))return;const h=this.getSheetTarget(n.location.unitId,n.location.subUnitId);h&&this.fireEvent(this.Event.Drop,{...h,...n,row:n.location.row,column:n.location.col})})),g.add((L=l.currentRowHeaderClick$)==null?void 0:L.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.RowHeaderClick))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.RowHeaderClick,{...h,row:n.index})})),g.add((x=l.currentRowHeaderPointerDown$)==null?void 0:x.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.RowHeaderPointerDown))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.RowHeaderPointerDown,{...h,row:n.index})})),g.add((W=l.currentRowHeaderPointerUp$)==null?void 0:W.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.RowHeaderPointerUp))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.RowHeaderPointerUp,{...h,row:n.index})})),g.add((A=l.currentHoveredRowHeader$)==null?void 0:A.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.RowHeaderHover))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.RowHeaderHover,{...h,row:n.index})})),g.add((O=l.currentColHeaderClick$)==null?void 0:O.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.ColumnHeaderClick))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.ColumnHeaderClick,{...h,column:n.index})})),g.add((U=l.currentColHeaderPointerDown$)==null?void 0:U.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.ColumnHeaderPointerDown))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.ColumnHeaderPointerDown,{...h,column:n.index})})),g.add(($=l.currentColHeaderPointerUp$)==null?void 0:$.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.ColumnHeaderPointerUp))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.ColumnHeaderPointerUp,{...h,column:n.index})})),g.add((j=l.currentHoveredColHeader$)==null?void 0:j.pipe(m.filter(n=>!!n)).subscribe(n=>{if(!this._eventListend(this.Event.ColumnHeaderHover))return;const h=this.getSheetTarget(n.unitId,n.subUnitId);h&&this.fireEvent(this.Event.ColumnHeaderHover,{...h,column:n.index})})))})),this.disposeWithMe(g)}const s=new Map;let c;const u=e.get(d.LifecycleService),b=m.combineLatest([o.created$,u.lifecycle$]);this.disposeWithMe(b.subscribe(([v,g])=>{var H;if(v.type===d.UniverInstanceType.UNIVER_SHEET&&(c=v),g<=d.LifecycleStages.Rendered)return;const E=new d.DisposableCollection;if(!c)return;const l=this.getWorkbook(c.unitId);if(!l)return;s.get(c.unitId)&&((H=s.get(c.unitId))==null||H.dispose()),s.set(c.unitId,E);const _=c.with(a.SheetScrollManagerService);E.add(_.validViewportScrollInfo$.subscribe(p=>{p&&this._eventListend(this.Event.Scroll)&&this.fireEvent(this.Event.Scroll,{workbook:l,worksheet:l.getActiveSheet(),...p})}));const P=c.with(R.SheetsSelectionsService);E.add(P.selectionMoveStart$.subscribe(p=>{var w;this._eventListend(this.Event.SelectionMoveStart)&&this.fireEvent(this.Event.SelectionMoveStart,{workbook:l,worksheet:l.getActiveSheet(),selections:(w=p==null?void 0:p.map(k=>k.range))!=null?w:[]})})),E.add(P.selectionMoving$.subscribe(p=>{var w;this._eventListend(this.Event.SelectionMoving)&&this.fireEvent(this.Event.SelectionMoving,{workbook:l,worksheet:l.getActiveSheet(),selections:(w=p==null?void 0:p.map(k=>k.range))!=null?w:[]})})),E.add(P.selectionMoveEnd$.subscribe(p=>{var w;this._eventListend(this.Event.SelectionMoveEnd)&&this.fireEvent(this.Event.SelectionMoveEnd,{workbook:l,worksheet:l.getActiveSheet(),selections:(w=p==null?void 0:p.map(k=>k.range))!=null?w:[]})})),E.add(P.selectionChanged$.subscribe(p=>{var w;this._eventListend(this.Event.SelectionChanged)&&this.fireEvent(this.Event.SelectionChanged,{workbook:l,worksheet:l.getActiveSheet(),selections:(w=p==null?void 0:p.map(k=>k.range))!=null?w:[]})})),c=null,this.disposeWithMe(E)})),this.disposeWithMe(o.disposed$.subscribe(v=>{var g;(g=s.get(v))==null||g.dispose(),s.delete(v)})),this.disposeWithMe(()=>{s.forEach(v=>{v.dispose()})})}_initialize(e){this._initSheetUIEvent(e);const t=e.get(d.ICommandService);this.disposeWithMe(t.beforeCommandExecuted(r=>{switch(r.id){case C.CopyCommand.id:case C.CutCommand.id:this._beforeClipboardChange();break;case a.SheetPasteShortKeyCommand.id:this._beforeClipboardPaste(r.params);break}})),this.disposeWithMe(t.onCommandExecuted(r=>{if(R.COMMAND_LISTENER_SKELETON_CHANGE.indexOf(r.id)>-1){if(!this._eventListend(this.Event.SheetSkeletonChanged))return;const i=this.getActiveSheet();if(!i)return;const o=R.getSkeletonChangedEffectedRange(r).map(s=>{var c,u;return(u=(c=this.getWorkbook(s.unitId))==null?void 0:c.getSheetBySheetId(s.subUnitId))==null?void 0:u.getRange(s.range)}).filter(Boolean);if(!o.length)return;this.fireEvent(this.Event.SheetSkeletonChanged,{workbook:i.workbook,worksheet:i.worksheet,payload:r,skeleton:i.worksheet.getSkeleton(),effectedRanges:o});return}switch(r.id){case C.CopyCommand.id:case C.CutCommand.id:this._clipboardChanged();break;case a.SheetPasteShortKeyCommand.id:this._clipboardPaste();break;case C.PasteCommand.id:this._clipboardPasteAsync();break}})),this.disposeWithMe(t.beforeCommandExecuted(async r=>{switch(r.id){case C.PasteCommand.id:await this._beforeClipboardPasteAsync();break}}))}_generateClipboardCopyParam(){const e=this.getActiveWorkbook(),t=e==null?void 0:e.getActiveSheet(),r=e==null?void 0:e.getActiveRange();if(!e||!t||!r)return;const o=this._injector.get(a.ISheetClipboardService).generateCopyContent(e.getId(),t.getSheetId(),r.getRange());if(!o)return;const{html:s,plain:c}=o;return{workbook:e,worksheet:t,text:c,html:s,fromSheet:t,fromRange:r}}_beforeClipboardChange(){if(!this.hasEventCallback(this.Event.BeforeClipboardChange))return;const e=this._generateClipboardCopyParam();if(e&&(this.fireEvent(this.Event.BeforeClipboardChange,e),e.cancel))throw new Error("Before clipboard change is canceled")}_clipboardChanged(){if(!this.hasEventCallback(this.Event.ClipboardChanged))return;const e=this._generateClipboardCopyParam();if(e&&(this.fireEvent(this.Event.ClipboardChanged,e),e.cancel))throw new Error("Clipboard changed is canceled")}_generateClipboardPasteParam(e){if(!e)return;const{htmlContent:t,textContent:r}=e,i=this.getActiveWorkbook(),o=i==null?void 0:i.getActiveSheet();return!i||!o?void 0:{workbook:i,worksheet:o,text:r,html:t}}async _generateClipboardPasteParamAsync(){const e=this.getActiveWorkbook(),t=e==null?void 0:e.getActiveSheet();if(!e||!t)return;const o=(await this._injector.get(C.IClipboardInterfaceService).read())[0];let s;if(o){const c=o.types,u=c.indexOf(C.PLAIN_TEXT_CLIPBOARD_MIME_TYPE)!==-1?await o.getType(C.PLAIN_TEXT_CLIPBOARD_MIME_TYPE).then(v=>v&&v.text()):"",b=c.indexOf(C.HTML_CLIPBOARD_MIME_TYPE)!==-1?await o.getType(C.HTML_CLIPBOARD_MIME_TYPE).then(v=>v&&v.text()):"";s={workbook:e,worksheet:t,text:u,html:b}}return s}_beforeClipboardPaste(e){if(!this.hasEventCallback(this.Event.BeforeClipboardPaste))return;const t=this._generateClipboardPasteParam(e);if(t&&(this.fireEvent(this.Event.BeforeClipboardPaste,t),t.cancel))throw new Error("Before clipboard paste is canceled")}_clipboardPaste(e){if(!this.hasEventCallback(this.Event.BeforeClipboardPaste))return;const t=this._generateClipboardPasteParam(e);if(t&&(this.fireEvent(this.Event.BeforeClipboardPaste,t),t.cancel))throw new Error("Clipboard pasted is canceled")}async _beforeClipboardPasteAsync(){if(!this.hasEventCallback(this.Event.BeforeClipboardPaste))return;if(!C.supportClipboardAPI()){this._injector.get(d.ILogService).warn("[Facade]: The navigator object only supports the browser environment");return}const e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.BeforeClipboardPaste,e),e.cancel))throw new Error("Before clipboard paste is canceled")}async _clipboardPasteAsync(){if(!this.hasEventCallback(this.Event.ClipboardPasted))return;if(!C.supportClipboardAPI()){this._injector.get(d.ILogService).warn("[Facade]: The navigator object only supports the browser environment");return}const e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.ClipboardPasted,e),e.cancel))throw new Error("Clipboard pasted is canceled")}customizeColumnHeader(e){var b,v;const t=this.getActiveWorkbook();if(!t){console.error("WorkBook not exist");return}const r=t==null?void 0:t.getId(),i=this._injector.get(S.IRenderManagerService),o=t.getActiveSheet(),s=o.getSheetId(),c=i.getRenderById(r);c&&((b=e.headerStyle)!=null&&b.size)&&(c.with(a.SheetSkeletonManagerService).setColumnHeaderSize(c,s,(v=e.headerStyle)==null?void 0:v.size),o==null||o.refreshCanvas()),this._getSheetRenderComponent(r,a.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e),o==null||o.refreshCanvas()}customizeRowHeader(e){const t=this.getActiveWorkbook();if(!t){console.error("WorkBook not exist");return}const r=t==null?void 0:t.getId();this._getSheetRenderComponent(r,a.SHEET_VIEW_KEY.ROW).setCustomHeader(e)}registerSheetRowHeaderExtension(e,...t){const r=this._getSheetRenderComponent(e,a.SHEET_VIEW_KEY.ROW),i=r.register(...t);return d.toDisposable(()=>{i.dispose(),r.makeDirty(!0)})}registerSheetColumnHeaderExtension(e,...t){const r=this._getSheetRenderComponent(e,a.SHEET_VIEW_KEY.COLUMN),i=r.register(...t);return d.toDisposable(()=>{i.dispose(),r.makeDirty(!0)})}registerSheetMainExtension(e,...t){const r=this._getSheetRenderComponent(e,a.SHEET_VIEW_KEY.MAIN),i=r.register(...t);return d.toDisposable(()=>{i.dispose(),r.makeDirty(!0)})}_getSheetRenderComponent(e,t){const i=this._injector.get(S.IRenderManagerService).getRenderById(e);if(!i)throw new Error(`Render Unit with unitId ${e} not found`);const{components:o}=i,s=o.get(t);if(!s)throw new Error("Render component not found");return s}getSheetHooks(){return this._injector.createInstance(I.FSheetHooks)}}d.FUniver.extend(V);class N extends I.FWorkbook{openSiderbar(e){return this._logDeprecation("openSiderbar"),this._injector.get(C.ISidebarService).open(e)}openDialog(e){this._logDeprecation("openDialog");const r=this._injector.get(C.IDialogService).open({...e,onClose:()=>{r.dispose()}});return r}_logDeprecation(e){this._injector.get(d.ILogService).warn("[FWorkbook]",`${e} is deprecated. Please use the function of the same name on "FUniver".`)}generateCellParams(e){const t=this.getActiveSheet();return{row:e.row,column:e.col,workbook:this,worksheet:t}}onCellClick(e){const t=this._injector.get(a.HoverManagerService);return d.toDisposable(t.currentClickedCell$.pipe(m.filter(r=>!!r)).subscribe(r=>{e(r)}))}onCellHover(e){const t=this._injector.get(a.HoverManagerService);return d.toDisposable(t.currentRichText$.pipe(m.filter(r=>!!r)).subscribe(e))}onCellPointerDown(e){const t=this._injector.get(a.HoverManagerService);return d.toDisposable(t.currentPointerDownCell$.subscribe(e))}onCellPointerUp(e){const t=this._injector.get(a.HoverManagerService);return d.toDisposable(t.currentPointerUpCell$.subscribe(e))}onCellPointerMove(e){const t=this._injector.get(a.HoverManagerService);return d.toDisposable(t.currentCellPosWithEvent$.pipe(m.filter(r=>!!r)).subscribe(r=>{e(r,r.event)}))}onDragOver(e){const t=this._injector.get(a.DragManagerService);return d.toDisposable(t.currentCell$.pipe(m.filter(r=>!!r)).subscribe(r=>{e(r)}))}onDrop(e){const t=this._injector.get(a.DragManagerService);return d.toDisposable(t.endCell$.pipe(m.filter(r=>!!r)).subscribe(r=>{e(r)}))}startEditing(){return this._injector.get(d.ICommandService).syncExecuteCommand(a.SetCellEditVisibleOperation.id,{eventType:S.DeviceInputEventType.Dblclick,unitId:this._workbook.getUnitId(),visible:!0})}async endEditing(e){return this._injector.get(d.ICommandService).syncExecuteCommand(a.SetCellEditVisibleOperation.id,{eventType:S.DeviceInputEventType.Keyboard,keycode:e?C.KeyCode.ENTER:C.KeyCode.ESC,visible:!1,unitId:this._workbook.getUnitId()}),await d.awaitTime(0),!0}endEditingAsync(e=!0){return this.endEditing(e)}getScrollStateBySheetId(e){const t=this._workbook.getUnitId(),i=this._injector.get(S.IRenderManagerService).getRenderById(t);return i?i.with(a.SheetScrollManagerService).getScrollStateByParam({unitId:t,sheetId:e}):null}disableSelection(){const e=this._workbook.getUnitId(),r=this._injector.get(S.IRenderManagerService).getRenderById(e);return r&&r.with(a.ISheetSelectionRenderService).disableSelection(),this}enableSelection(){const e=this._workbook.getUnitId(),r=this._injector.get(S.IRenderManagerService).getRenderById(e);return r&&r.with(a.ISheetSelectionRenderService).enableSelection(),this}transparentSelection(){const e=this._workbook.getUnitId(),r=this._injector.get(S.IRenderManagerService).getRenderById(e);return r&&r.with(a.ISheetSelectionRenderService).transparentSelection(),this}showSelection(){const e=this._workbook.getUnitId(),r=this._injector.get(S.IRenderManagerService).getRenderById(e);return r&&r.with(a.ISheetSelectionRenderService).showSelection(),this}}I.FWorkbook.extend(N);class K extends I.FWorksheet{refreshCanvas(){const e=this._injector.get(S.IRenderManagerService),t=this._fWorkbook.id,r=e.getRenderById(t);if(!r)throw new Error(`Render Unit with unitId ${t} not found`);r.with(a.SheetSkeletonManagerService).reCalculate();const i=r.mainComponent;if(!i)throw new Error("Main component not found");return i.makeDirty(),this}zoom(e){return this._injector.get(d.ICommandService).syncExecuteCommand(a.ChangeZoomRatioCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),zoomRatio:e}),this}getZoom(){return this._worksheet.getZoomRatio()}getVisibleRange(){const e=this._workbook.getUnitId(),r=this._injector.get(S.IRenderManagerService).getRenderById(e);let i={startColumn:0,startRow:0,endColumn:0,endRow:0};if(!r)return i;const s=r.with(a.SheetSkeletonManagerService).getCurrentSkeleton();if(!s)return i;const c=s==null?void 0:s.getVisibleRanges();if(!c)return i;i=s.getVisibleRangeByViewport(S.SHEET_VIEWPORT_KEY.VIEW_MAIN);for(const[u,b]of c)S.sheetContentViewportKeys.indexOf(u)!==-1&&(i.startColumn=Math.min(i.startColumn,b.startColumn),i.startRow=Math.min(i.startRow,b.startRow),i.endColumn=Math.max(i.endColumn,b.endColumn),i.endRow=Math.max(i.endRow,b.endRow));return i}scrollToCell(e,t){const r=this._workbook.getUnitId(),o=this._injector.get(S.IRenderManagerService).getRenderById(r);return o&&(o==null?void 0:o.with(a.SheetsScrollRenderController)).scrollToCell(e,t),this}getScrollState(){const e={offsetX:0,offsetY:0,sheetViewStartColumn:0,sheetViewStartRow:0},t=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),o=this._injector.get(S.IRenderManagerService).getRenderById(t);return o&&o.with(a.SheetScrollManagerService).getScrollStateByParam({unitId:t,sheetId:r})||e}onScroll(e){var o;const t=this._workbook.getUnitId(),i=(o=this._injector.get(S.IRenderManagerService).getRenderById(t))==null?void 0:o.with(a.SheetScrollManagerService);if(i){const s=i.validViewportScrollInfo$.subscribe(c=>{e(c)});return d.toDisposable(s)}return d.toDisposable(()=>{})}getSkeleton(){var t,r;const e=(t=this._injector.get(S.IRenderManagerService).getRenderById(this._workbook.getUnitId()))==null?void 0:t.with(a.SheetSkeletonManagerService);return(r=e==null?void 0:e.getWorksheetSkeleton(this._worksheet.getSheetId()))==null?void 0:r.skeleton}setColumnAutoWidth(e,t){const r=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(a.SetWorksheetColAutoWidthCommand.id,{unitId:r,subUnitId:i,ranges:o}),this}customizeColumnHeader(e){var u,b;const t=this,r=this._fWorkbook.getId(),i=this._injector.get(S.IRenderManagerService),o=t.getSheetId(),s=i.getRenderById(r);s&&((u=e.headerStyle)!=null&&u.size)&&(s.with(a.SheetSkeletonManagerService).setColumnHeaderSize(s,o,(b=e.headerStyle)==null?void 0:b.size),t==null||t.refreshCanvas());const c=this._getSheetRenderComponent(r,a.SHEET_VIEW_KEY.COLUMN);c&&(c.setCustomHeader(e),t==null||t.refreshCanvas())}customizeRowHeader(e){const t=this._fWorkbook.getId();this._getSheetRenderComponent(t,a.SHEET_VIEW_KEY.ROW).setCustomHeader(e)}setColumnHeaderHeight(e){const t=this,r=this._fWorkbook.getId(),i=t.getSheetId();return this._commandService.executeCommand(a.SetColumnHeaderHeightCommand.id,{unitId:r,subUnitId:i,size:e}),t==null||t.refreshCanvas(),this}setRowHeaderWidth(e){const t=this,r=this._fWorkbook.getId(),i=t.getSheetId();this._commandService.executeCommand(a.SetRowHeaderWidthCommand.id,{unitId:r,subUnitId:i,size:e});const o=this._getSheetRenderComponent(r,a.SHEET_VIEW_KEY.ROW);return o&&o.setCustomHeader({headerStyle:{size:e}}),t==null||t.refreshCanvas(),this}_getSheetRenderComponent(e,t){const i=this._injector.get(S.IRenderManagerService).getRenderById(e);if(!i)throw new Error(`Render Unit with unitId ${e} not found`);const{components:o}=i,s=o.get(t);if(!s)throw new Error("Render component not found");return s}}I.FWorksheet.extend(K);class z extends I.FPermission{setPermissionDialogVisible(e){this._permissionService.setShowComponents(e)}}I.FPermission.extend(z);class Y extends I.FSheetHooks{onCellPointerMove(e){return d.toDisposable(this._injector.get(a.HoverManagerService).currentPosition$.subscribe(e))}onCellPointerOver(e){return d.toDisposable(this._injector.get(a.HoverManagerService).currentCell$.subscribe(e))}onCellDragOver(e){return d.toDisposable(this._injector.get(a.DragManagerService).currentCell$.subscribe(e))}onCellDrop(e){return d.toDisposable(this._injector.get(a.DragManagerService).endCell$.subscribe(e))}onCellRender(e,t=d.InterceptorEffectEnum.Style,r=R.InterceptCellContentPriority.DATA_VALIDATION){return this._injector.get(R.SheetInterceptorService).intercept(R.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t,handler:(i,o,s)=>s({...i,customRender:[...(i==null?void 0:i.customRender)||[],...e||[]]}),priority:r})}onBeforeCellEdit(e){return this._injector.get(d.ICommandService).beforeCommandExecuted(t=>{const r=t.params;t.id===a.SetCellEditVisibleOperation.id&&r.visible&&e(r)})}onAfterCellEdit(e){return this._injector.get(d.ICommandService).onCommandExecuted(t=>{const r=t.params;t.id===a.SetCellEditVisibleOperation.id&&!r.visible&&e(r)})}}I.FSheetHooks.extend(Y);const y={CellClicked:"CellClicked",CellPointerDown:"CellPointerDown",CellPointerUp:"CellPointerUp",CellPointerMove:"CellPointerMove",CellHover:"CellHover",DragOver:"DragOver",Drop:"Drop",Scroll:"Scroll",SelectionMoveStart:"SelectionMoveStart",SelectionMoving:"SelectionMoving",SelectionMoveEnd:"SelectionMoveEnd",SelectionChanged:"SelectionChanged"};class Z extends d.FEventName{get BeforeClipboardChange(){return"BeforeClipboardChange"}get ClipboardChanged(){return"ClipboardChanged"}get BeforeClipboardPaste(){return"BeforeClipboardPaste"}get ClipboardPasted(){return"ClipboardPasted"}get BeforeSheetEditStart(){return"BeforeSheetEditStart"}get SheetEditStarted(){return"SheetEditStarted"}get SheetEditChanging(){return"SheetEditChanging"}get BeforeSheetEditEnd(){return"BeforeSheetEditEnd"}get SheetEditEnded(){return"SheetEditEnded"}get CellClicked(){return y.CellClicked}get CellHover(){return y.CellHover}get CellPointerDown(){return y.CellPointerDown}get CellPointerUp(){return y.CellPointerUp}get CellPointerMove(){return y.CellPointerMove}get DragOver(){return"DragOver"}get Drop(){return"Drop"}get Scroll(){return"Scroll"}get SelectionMoveStart(){return"SelectionMoveStart"}get SelectionChanged(){return"SelectionChanged"}get SelectionMoving(){return"SelectionMoving"}get SelectionMoveEnd(){return"SelectionMoveEnd"}get RowHeaderClick(){return"RowHeaderClick"}get RowHeaderPointerDown(){return"RowHeaderPointerDown"}get RowHeaderPointerUp(){return"RowHeaderPointerUp"}get RowHeaderHover(){return"RowHeaderHover"}get ColumnHeaderClick(){return"ColumnHeaderClick"}get ColumnHeaderPointerDown(){return"ColumnHeaderPointerDown"}get ColumnHeaderPointerUp(){return"ColumnHeaderPointerUp"}get ColumnHeaderHover(){return"ColumnHeaderHover"}get SheetSkeletonChanged(){return"SheetSkeletonChanged"}}d.FEventName.extend(Z);class q extends I.FRange{getCell(){var c;const e=this._injector.get(S.IRenderManagerService),t=this._injector.get(d.ILogService),r=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=e.getRenderById(r),s=(c=o==null?void 0:o.with(a.SheetSkeletonManagerService).getWorksheetSkeleton(i))==null?void 0:c.skeleton;if(!s)throw t.error("[Facade]: `FRange.getCell` can only be called in current worksheet"),new Error("`FRange.getCell` can only be called in current worksheet");return s.getCellWithCoordByIndex(this._range.startRow,this._range.startColumn)}getCellRect(){const{startX:e,startY:t,endX:r,endY:i}=this.getCell(),o={x:e,y:t,width:r-e,height:i-t,top:t,left:e,bottom:i,right:r};return{...o,toJSON:()=>JSON.stringify(o)}}generateHTML(){var t;const e=this._injector.get(a.ISheetClipboardService).generateCopyContent(this._workbook.getUnitId(),this._worksheet.getSheetId(),this._range);return(t=e==null?void 0:e.html)!=null?t:""}attachPopup(e){var s,c,u;e.direction=(s=e.direction)!=null?s:"horizontal",e.extraProps=(c=e.extraProps)!=null?c:{},e.offset=(u=e.offset)!=null?u:[0,0];const{key:t,disposableCollection:r}=D(e,this._injector.get(C.ComponentManager)),o=this._injector.get(a.SheetCanvasPopManagerService).attachPopupToCell(this._range.startRow,this._range.startColumn,{...e,componentKey:t},this.getUnitId(),this._worksheet.getSheetId());return o?(r.add(o),r):(r.dispose(),null)}attachAlertPopup(e){const t=this._injector.get(a.CellAlertManagerService),r={workbook:this._workbook,worksheet:this._worksheet,row:this._range.startRow,col:this._range.startColumn,unitId:this.getUnitId(),subUnitId:this._worksheet.getSheetId()};return t.showAlert({...e,location:r}),{dispose:()=>{t.removeAlert(e.key)}}}attachRangePopup(e){var s,c,u;e.direction=(s=e.direction)!=null?s:"top-center",e.extraProps=(c=e.extraProps)!=null?c:{},e.offset=(u=e.offset)!=null?u:[0,0];const{key:t,disposableCollection:r}=D(e,this._injector.get(C.ComponentManager)),o=this._injector.get(a.SheetCanvasPopManagerService).attachRangePopup(this._range,{...e,componentKey:t},this.getUnitId(),this._worksheet.getSheetId());return o?(r.add(o),r):(r.dispose(),null)}highlight(e,t){const r=this._injector.get(a.IMarkSelectionService),i=r.addShape({range:this._range,style:e,primary:t});if(!i)throw new Error("Failed to highlight current range");return d.toDisposable(()=>{r.removeShape(i)})}}I.FRange.extend(q);function D(M,e){const{componentKey:t,isVue3:r}=M;let i;const o=new d.DisposableCollection;return typeof t=="string"?i=t:(i=`External_${d.generateRandomId(6)}`,o.add(e.register(i,t,{framework:r?"vue3":"react"}))),{key:i,disposableCollection:o}}f.transformComponentKey=D,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
1
+ (function(f,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("@univerjs/sheets-ui"),require("@univerjs/sheets/facade"),require("@univerjs/ui"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/core/facade","@univerjs/docs","@univerjs/engine-render","@univerjs/sheets","@univerjs/sheets-ui","@univerjs/sheets/facade","@univerjs/ui","rxjs"],d):(f=typeof globalThis<"u"?globalThis:f||self,d(f.UniverSheetsUiFacade={},f.UniverCore,f.UniverCoreFacade,f.UniverDocs,f.UniverEngineRender,f.UniverSheets,f.UniverSheetsUi,f.UniverSheetsFacade,f.UniverUi,f.rxjs))})(this,function(f,d,H,D,m,P,a,w,E,p){"use strict";class T extends H.FUniver{_initSheetUIEvent(e){const r=e.get(d.ICommandService);this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>r.beforeCommandExecuted(t=>{if(t.id!==a.SetCellEditVisibleOperation.id)return;const n=this.getActiveSheet();if(!n)return;const{workbook:o,worksheet:s}=n,l=e.get(a.IEditorBridgeService),S=t.params,{visible:u,keycode:v,eventType:b}=S,C=l.getEditLocation();if(u){const g={row:C.row,column:C.column,eventType:b,keycode:v,workbook:o,worksheet:s,isZenEditor:!1};if(this.fireEvent(this.Event.BeforeSheetEditStart,g),g.cancel)throw new d.CanceledError}})),this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>r.beforeCommandExecuted(t=>{if(t.id!==a.SetCellEditVisibleOperation.id)return;const n=this.getActiveSheet();if(!n)return;const{workbook:o,worksheet:s}=n,l=e.get(a.IEditorBridgeService),S=e.get(d.IUniverInstanceService),u=t.params,{visible:v,keycode:b,eventType:C}=u,g=l.getEditLocation();if(!v){const _={row:g.row,column:g.column,eventType:C,keycode:b,workbook:o,worksheet:s,isZenEditor:!1,value:d.RichTextValue.create(S.getUnit(d.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:b!==E.KeyCode.ESC};if(this.fireEvent(this.Event.BeforeSheetEditEnd,_),_.cancel)throw new d.CanceledError}})),this.registerEventHandler(this.Event.SheetEditStarted,()=>r.onCommandExecuted(t=>{if(t.id!==a.SetCellEditVisibleOperation.id)return;const n=this.getCommandSheetTarget(t);if(!n)return;const{workbook:o,worksheet:s}=n,l=e.get(a.IEditorBridgeService),S=t.params,{visible:u,keycode:v,eventType:b}=S,C=l.getEditLocation();if(u){const g={row:C.row,column:C.column,eventType:b,keycode:v,workbook:o,worksheet:s,isZenEditor:!1};this.fireEvent(this.Event.SheetEditStarted,g)}})),this.registerEventHandler(this.Event.SheetEditEnded,()=>r.onCommandExecuted(t=>{if(t.id!==a.SetCellEditVisibleOperation.id)return;const n=this.getCommandSheetTarget(t);if(!n)return;const{workbook:o,worksheet:s}=n,l=e.get(a.IEditorBridgeService),S=t.params,{visible:u,keycode:v,eventType:b}=S,C=l.getEditLocation();if(!u){const g={row:C.row,column:C.column,eventType:b,keycode:v,workbook:o,worksheet:s,isZenEditor:!1,isConfirm:v!==E.KeyCode.ESC};this.fireEvent(this.Event.SheetEditEnded,g)}})),this.registerEventHandler(this.Event.SheetEditChanging,()=>r.onCommandExecuted(t=>{if(t.id!==D.RichTextEditingMutation.id)return;const n=this.getActiveSheet();if(!n)return;const{workbook:o,worksheet:s}=n,l=e.get(a.IEditorBridgeService),S=e.get(d.IUniverInstanceService),u=t.params;if(!l.isVisible().visible)return;const{unitId:v}=u;if(v===d.DOCS_NORMAL_EDITOR_UNIT_ID_KEY){const{row:b,column:C}=l.getEditLocation(),g={workbook:o,worksheet:s,row:b,column:C,value:d.RichTextValue.create(S.getUnit(d.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!1};this.fireEvent(this.Event.SheetEditChanging,g)}})),this.registerEventHandler(this.Event.BeforeSheetZoomChange,()=>r.beforeCommandExecuted(t=>{if(t.id!==a.SetZoomRatioCommand.id)return;const n=this.getCommandSheetTarget(t);if(!n)return;const{workbook:o,worksheet:s}=n;this.fireEvent(this.Event.BeforeSheetZoomChange,{zoom:t.params.zoomRatio,workbook:o,worksheet:s})})),this.registerEventHandler(this.Event.SheetZoomChanged,()=>r.onCommandExecuted(t=>{if(t.id!==a.SetZoomRatioCommand.id)return;const n=this.getCommandSheetTarget(t);if(!n)return;const{workbook:o,worksheet:s}=n;this.fireEvent(this.Event.SheetZoomChanged,{zoom:s.getZoom(),workbook:o,worksheet:s})}))}_initObserverListener(e){const t=e.get(d.IUniverInstanceService).getFocusedUnit(),n=t==null?void 0:t.getUnitId(),o=e.get(m.IRenderManagerService);if(n){const v=e.get(d.LifecycleService),b=new d.DisposableCollection;this.disposeWithMe(v.lifecycle$.subscribe(C=>{if(C<d.LifecycleStages.Rendered)return;b.dispose();const g=e.get(a.HoverManagerService),_=e.get(a.DragManagerService);g&&(this.registerEventHandler(this.Event.CellClicked,()=>{var h;return(h=g.currentClickedCell$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.location.unitId,i.location.subUnitId);c&&this.fireEvent(this.Event.CellClicked,{...c,...i,row:i.location.row,column:i.location.col})})}),this.registerEventHandler(this.Event.CellHover,()=>{var h;return(h=g.currentRichText$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.CellHover,{...c,...i,row:i.row,column:i.col})})}),this.registerEventHandler(this.Event.CellPointerDown,()=>{var h;return(h=g.currentPointerDownCell$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.CellPointerDown,{...c,...i,row:i.row,column:i.col})})}),this.registerEventHandler(this.Event.CellPointerUp,()=>{var h;return(h=g.currentPointerUpCell$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.CellPointerUp,{...c,...i,row:i.row,column:i.col})})}),this.registerEventHandler(this.Event.CellPointerMove,()=>{var h;return(h=g.currentCellPosWithEvent$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.CellPointerMove,{...c,...i,row:i.row,column:i.col})})}),this.registerEventHandler(this.Event.DragOver,()=>{var h;return(h=_.currentCell$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.location.unitId,i.location.subUnitId);c&&this.fireEvent(this.Event.DragOver,{...c,...i,row:i.location.row,column:i.location.col})})}),this.registerEventHandler(this.Event.Drop,()=>{var h;return(h=_.endCell$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.location.unitId,i.location.subUnitId);c&&this.fireEvent(this.Event.Drop,{...c,...i,row:i.location.row,column:i.location.col})})}),this.registerEventHandler(this.Event.RowHeaderClick,()=>{var h;return(h=g.currentRowHeaderClick$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.RowHeaderClick,{...c,row:i.index})})}),this.registerEventHandler(this.Event.RowHeaderPointerDown,()=>{var h;return(h=g.currentRowHeaderPointerDown$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.RowHeaderPointerDown,{...c,row:i.index})})}),this.registerEventHandler(this.Event.RowHeaderPointerUp,()=>{var h;return(h=g.currentRowHeaderPointerUp$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.RowHeaderPointerUp,{...c,row:i.index})})}),this.registerEventHandler(this.Event.RowHeaderHover,()=>{var h;return(h=g.currentHoveredRowHeader$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.RowHeaderHover,{...c,row:i.index})})}),this.registerEventHandler(this.Event.ColumnHeaderClick,()=>{var h;return(h=g.currentColHeaderClick$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.ColumnHeaderClick,{...c,column:i.index})})}),this.registerEventHandler(this.Event.ColumnHeaderPointerDown,()=>{var h;return(h=g.currentColHeaderPointerDown$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.ColumnHeaderPointerDown,{...c,column:i.index})})}),this.registerEventHandler(this.Event.ColumnHeaderPointerUp,()=>{var h;return(h=g.currentColHeaderPointerUp$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.ColumnHeaderPointerUp,{...c,column:i.index})})}),this.registerEventHandler(this.Event.ColumnHeaderHover,()=>{var h;return(h=g.currentHoveredColHeader$)==null?void 0:h.pipe(p.filter(i=>!!i)).subscribe(i=>{const c=this.getSheetTarget(i.unitId,i.subUnitId);c&&this.fireEvent(this.Event.ColumnHeaderHover,{...c,column:i.index})})}))})),this.disposeWithMe(b)}const s=new Map;let l;const S=e.get(d.LifecycleService),u=p.combineLatest([o.created$,S.lifecycle$]);this.disposeWithMe(u.subscribe(([v,b])=>{var i;if(v.type===d.UniverInstanceType.UNIVER_SHEET&&(l=v),b<=d.LifecycleStages.Rendered)return;const C=new d.DisposableCollection;if(!l)return;const g=this.getWorkbook(l.unitId);if(!g)return;s.get(l.unitId)&&((i=s.get(l.unitId))==null||i.dispose()),s.set(l.unitId,C);const _=l.with(a.SheetScrollManagerService),h=l.with(P.SheetsSelectionsService);C.add(this.registerEventHandler(this.Event.Scroll,()=>_.validViewportScrollInfo$.subscribe(c=>{c&&this.fireEvent(this.Event.Scroll,{workbook:g,worksheet:g.getActiveSheet(),...c})}))),C.add(this.registerEventHandler(this.Event.SelectionMoveStart,()=>h.selectionMoveStart$.subscribe(c=>{var I;this.fireEvent(this.Event.SelectionMoveStart,{workbook:g,worksheet:g.getActiveSheet(),selections:(I=c==null?void 0:c.map(M=>M.range))!=null?I:[]})}))),C.add(this.registerEventHandler(this.Event.SelectionMoving,()=>h.selectionMoving$.subscribe(c=>{var I;this.fireEvent(this.Event.SelectionMoving,{workbook:g,worksheet:g.getActiveSheet(),selections:(I=c==null?void 0:c.map(M=>M.range))!=null?I:[]})}))),C.add(this.registerEventHandler(this.Event.SelectionMoveEnd,()=>h.selectionMoveEnd$.subscribe(c=>{var I;this.fireEvent(this.Event.SelectionMoveEnd,{workbook:g,worksheet:g.getActiveSheet(),selections:(I=c==null?void 0:c.map(M=>M.range))!=null?I:[]})}))),C.add(this.registerEventHandler(this.Event.SelectionChanged,()=>h.selectionChanged$.subscribe(c=>{var I;this.fireEvent(this.Event.SelectionChanged,{workbook:g,worksheet:g.getActiveSheet(),selections:(I=c==null?void 0:c.map(M=>M.range))!=null?I:[]})}))),l=null,this.disposeWithMe(C)})),this.disposeWithMe(o.disposed$.subscribe(v=>{var b;(b=s.get(v))==null||b.dispose(),s.delete(v)})),this.disposeWithMe(()=>{s.forEach(v=>{v.dispose()})})}_initialize(e){this._initSheetUIEvent(e),this._initObserverListener(e);const r=e.get(d.ICommandService);this.registerEventHandler(this.Event.BeforeClipboardChange,()=>{const t=new d.DisposableCollection;return t.add(r.beforeCommandExecuted(n=>{switch(n.id){case E.CopyCommand.id:case E.CutCommand.id:this._beforeClipboardChange();break}})),t}),this.registerEventHandler(this.Event.ClipboardChanged,()=>{const t=new d.DisposableCollection;return t.add(r.beforeCommandExecuted(n=>{switch(n.id){case a.SheetPasteShortKeyCommand.id:this._beforeClipboardPaste(n.params);break}})),t.add(r.beforeCommandExecuted(async n=>{switch(n.id){case E.PasteCommand.id:await this._beforeClipboardPasteAsync();break}})),t}),this.disposeWithMe(r.onCommandExecuted(t=>{if(P.COMMAND_LISTENER_SKELETON_CHANGE.indexOf(t.id)>-1){const n=this.getActiveSheet();if(!n)return;const o=P.getSkeletonChangedEffectedRange(t,n.worksheet.getMaxColumns()).map(s=>{var l,S;return(S=(l=this.getWorkbook(s.unitId))==null?void 0:l.getSheetBySheetId(s.subUnitId))==null?void 0:S.getRange(s.range)}).filter(Boolean);if(!o.length)return;this.fireEvent(this.Event.SheetSkeletonChanged,{workbook:n.workbook,worksheet:n.worksheet,payload:t,skeleton:n.worksheet.getSkeleton(),effectedRanges:o})}})),this.registerEventHandler(this.Event.ClipboardChanged,()=>r.beforeCommandExecuted(t=>{switch(t.id){case E.CopyCommand.id:case E.CutCommand.id:this._clipboardChanged();break}})),this.registerEventHandler(this.Event.ClipboardPasted,()=>r.beforeCommandExecuted(t=>{switch(t.id){case a.SheetPasteShortKeyCommand.id:this._clipboardPaste(t.params);break;case E.PasteCommand.id:this._clipboardPasteAsync();break}}))}_generateClipboardCopyParam(){const e=this.getActiveWorkbook(),r=e==null?void 0:e.getActiveSheet(),t=e==null?void 0:e.getActiveRange();if(!e||!r||!t)return;const o=this._injector.get(a.ISheetClipboardService).generateCopyContent(e.getId(),r.getSheetId(),t.getRange());if(!o)return;const{html:s,plain:l}=o;return{workbook:e,worksheet:r,text:l,html:s,fromSheet:r,fromRange:t}}_beforeClipboardChange(){const e=this._generateClipboardCopyParam();if(e&&(this.fireEvent(this.Event.BeforeClipboardChange,e),e.cancel))throw new Error("Before clipboard change is canceled")}_clipboardChanged(){const e=this._generateClipboardCopyParam();if(e&&(this.fireEvent(this.Event.ClipboardChanged,e),e.cancel))throw new Error("Clipboard changed is canceled")}_generateClipboardPasteParam(e){if(!e)return;const{htmlContent:r,textContent:t}=e,n=this.getActiveWorkbook(),o=n==null?void 0:n.getActiveSheet();return!n||!o?void 0:{workbook:n,worksheet:o,text:t,html:r}}async _generateClipboardPasteParamAsync(){const e=this.getActiveWorkbook(),r=e==null?void 0:e.getActiveSheet();if(!e||!r)return;const o=(await this._injector.get(E.IClipboardInterfaceService).read())[0];let s;if(o){const l=o.types,S=l.indexOf(E.PLAIN_TEXT_CLIPBOARD_MIME_TYPE)!==-1?await o.getType(E.PLAIN_TEXT_CLIPBOARD_MIME_TYPE).then(v=>v&&v.text()):"",u=l.indexOf(E.HTML_CLIPBOARD_MIME_TYPE)!==-1?await o.getType(E.HTML_CLIPBOARD_MIME_TYPE).then(v=>v&&v.text()):"";s={workbook:e,worksheet:r,text:S,html:u}}return s}_beforeClipboardPaste(e){const r=this._generateClipboardPasteParam(e);if(r&&(this.fireEvent(this.Event.BeforeClipboardPaste,r),r.cancel))throw new Error("Before clipboard paste is canceled")}_clipboardPaste(e){const r=this._generateClipboardPasteParam(e);if(r&&(this.fireEvent(this.Event.ClipboardPasted,r),r.cancel))throw new Error("Clipboard pasted is canceled")}async _beforeClipboardPasteAsync(){if(!E.supportClipboardAPI()){this._injector.get(d.ILogService).warn("[Facade]: The navigator object only supports the browser environment");return}const e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.BeforeClipboardPaste,e),e.cancel))throw new Error("Before clipboard paste is canceled")}async _clipboardPasteAsync(){if(!E.supportClipboardAPI()){this._injector.get(d.ILogService).warn("[Facade]: The navigator object only supports the browser environment");return}const e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.ClipboardPasted,e),e.cancel))throw new Error("Clipboard pasted is canceled")}customizeColumnHeader(e){var u,v;const r=this.getActiveWorkbook();if(!r){console.error("WorkBook not exist");return}const t=r==null?void 0:r.getId(),n=this._injector.get(m.IRenderManagerService),o=r.getActiveSheet(),s=o.getSheetId(),l=n.getRenderById(t);l&&((u=e.headerStyle)!=null&&u.size)&&(l.with(a.SheetSkeletonManagerService).setColumnHeaderSize(l,s,(v=e.headerStyle)==null?void 0:v.size),o==null||o.refreshCanvas()),this._getSheetRenderComponent(t,a.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e),o==null||o.refreshCanvas()}customizeRowHeader(e){const r=this.getActiveWorkbook();if(!r){console.error("WorkBook not exist");return}const t=r==null?void 0:r.getId();this._getSheetRenderComponent(t,a.SHEET_VIEW_KEY.ROW).setCustomHeader(e)}registerSheetRowHeaderExtension(e,...r){const t=this._getSheetRenderComponent(e,a.SHEET_VIEW_KEY.ROW),n=t.register(...r);return d.toDisposable(()=>{n.dispose(),t.makeDirty(!0)})}registerSheetColumnHeaderExtension(e,...r){const t=this._getSheetRenderComponent(e,a.SHEET_VIEW_KEY.COLUMN),n=t.register(...r);return d.toDisposable(()=>{n.dispose(),t.makeDirty(!0)})}registerSheetMainExtension(e,...r){const t=this._getSheetRenderComponent(e,a.SHEET_VIEW_KEY.MAIN),n=t.register(...r);return d.toDisposable(()=>{n.dispose(),t.makeDirty(!0)})}_getSheetRenderComponent(e,r){const n=this._injector.get(m.IRenderManagerService).getRenderById(e);if(!n)throw new Error(`Render Unit with unitId ${e} not found`);const{components:o}=n,s=o.get(r);if(!s)throw new Error("Render component not found");return s}getSheetHooks(){return this._injector.createInstance(w.FSheetHooks)}}H.FUniver.extend(T);class B extends w.FWorkbook{openSiderbar(e){return this._logDeprecation("openSiderbar"),this._injector.get(E.ISidebarService).open(e)}openDialog(e){this._logDeprecation("openDialog");const t=this._injector.get(E.IDialogService).open({...e,onClose:()=>{t.dispose()}});return t}_logDeprecation(e){this._injector.get(d.ILogService).warn("[FWorkbook]",`${e} is deprecated. Please use the function of the same name on "FUniver".`)}generateCellParams(e){const r=this.getActiveSheet();return{row:e.row,column:e.col,workbook:this,worksheet:r}}onCellClick(e){const r=this._injector.get(a.HoverManagerService);return d.toDisposable(r.currentClickedCell$.pipe(p.filter(t=>!!t)).subscribe(t=>{e(t)}))}onCellHover(e){const r=this._injector.get(a.HoverManagerService);return d.toDisposable(r.currentRichText$.pipe(p.filter(t=>!!t)).subscribe(e))}onCellPointerDown(e){const r=this._injector.get(a.HoverManagerService);return d.toDisposable(r.currentPointerDownCell$.subscribe(e))}onCellPointerUp(e){const r=this._injector.get(a.HoverManagerService);return d.toDisposable(r.currentPointerUpCell$.subscribe(e))}onCellPointerMove(e){const r=this._injector.get(a.HoverManagerService);return d.toDisposable(r.currentCellPosWithEvent$.pipe(p.filter(t=>!!t)).subscribe(t=>{e(t,t.event)}))}onDragOver(e){const r=this._injector.get(a.DragManagerService);return d.toDisposable(r.currentCell$.pipe(p.filter(t=>!!t)).subscribe(t=>{e(t)}))}onDrop(e){const r=this._injector.get(a.DragManagerService);return d.toDisposable(r.endCell$.pipe(p.filter(t=>!!t)).subscribe(t=>{e(t)}))}startEditing(){return this._injector.get(d.ICommandService).syncExecuteCommand(a.SetCellEditVisibleOperation.id,{eventType:m.DeviceInputEventType.Dblclick,unitId:this._workbook.getUnitId(),visible:!0})}async endEditing(e){return this._injector.get(d.ICommandService).syncExecuteCommand(a.SetCellEditVisibleOperation.id,{eventType:m.DeviceInputEventType.Keyboard,keycode:e?E.KeyCode.ENTER:E.KeyCode.ESC,visible:!1,unitId:this._workbook.getUnitId()}),await d.awaitTime(0),!0}endEditingAsync(e=!0){return this.endEditing(e)}getScrollStateBySheetId(e){const r=this._workbook.getUnitId(),n=this._injector.get(m.IRenderManagerService).getRenderById(r);return n?n.with(a.SheetScrollManagerService).getScrollStateByParam({unitId:r,sheetId:e}):null}disableSelection(){const e=this._workbook.getUnitId(),t=this._injector.get(m.IRenderManagerService).getRenderById(e);return t&&t.with(a.ISheetSelectionRenderService).disableSelection(),this}enableSelection(){const e=this._workbook.getUnitId(),t=this._injector.get(m.IRenderManagerService).getRenderById(e);return t&&t.with(a.ISheetSelectionRenderService).enableSelection(),this}transparentSelection(){const e=this._workbook.getUnitId(),t=this._injector.get(m.IRenderManagerService).getRenderById(e);return t&&t.with(a.ISheetSelectionRenderService).transparentSelection(),this}showSelection(){const e=this._workbook.getUnitId(),t=this._injector.get(m.IRenderManagerService).getRenderById(e);return t&&t.with(a.ISheetSelectionRenderService).showSelection(),this}}w.FWorkbook.extend(B);class x extends w.FWorksheet{refreshCanvas(){const e=this._injector.get(m.IRenderManagerService),r=this._fWorkbook.id,t=e.getRenderById(r);if(!t)throw new Error(`Render Unit with unitId ${r} not found`);t.with(a.SheetSkeletonManagerService).reCalculate();const n=t.mainComponent;if(!n)throw new Error("Main component not found");return n.makeDirty(),this}zoom(e){return this._injector.get(d.ICommandService).syncExecuteCommand(a.ChangeZoomRatioCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),zoomRatio:e}),this}getZoom(){return this._worksheet.getZoomRatio()}getVisibleRange(){const e=this._workbook.getUnitId(),t=this._injector.get(m.IRenderManagerService).getRenderById(e);let n={startColumn:0,startRow:0,endColumn:0,endRow:0};if(!t)return n;const s=t.with(a.SheetSkeletonManagerService).getCurrentSkeleton();if(!s)return n;const l=s==null?void 0:s.getVisibleRanges();if(!l)return n;n=s.getVisibleRangeByViewport(m.SHEET_VIEWPORT_KEY.VIEW_MAIN);for(const[S,u]of l)m.sheetContentViewportKeys.indexOf(S)!==-1&&(n.startColumn=Math.min(n.startColumn,u.startColumn),n.startRow=Math.min(n.startRow,u.startRow),n.endColumn=Math.max(n.endColumn,u.endColumn),n.endRow=Math.max(n.endRow,u.endRow));return n}scrollToCell(e,r){const t=this._workbook.getUnitId(),o=this._injector.get(m.IRenderManagerService).getRenderById(t);return o&&(o==null?void 0:o.with(a.SheetsScrollRenderController)).scrollToCell(e,r),this}getScrollState(){const e={offsetX:0,offsetY:0,sheetViewStartColumn:0,sheetViewStartRow:0},r=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),o=this._injector.get(m.IRenderManagerService).getRenderById(r);return o&&o.with(a.SheetScrollManagerService).getScrollStateByParam({unitId:r,sheetId:t})||e}onScroll(e){var o;const r=this._workbook.getUnitId(),n=(o=this._injector.get(m.IRenderManagerService).getRenderById(r))==null?void 0:o.with(a.SheetScrollManagerService);if(n){const s=n.validViewportScrollInfo$.subscribe(l=>{e(l)});return d.toDisposable(s)}return d.toDisposable(()=>{})}getSkeleton(){var r,t;const e=(r=this._injector.get(m.IRenderManagerService).getRenderById(this._workbook.getUnitId()))==null?void 0:r.with(a.SheetSkeletonManagerService);return(t=e==null?void 0:e.getWorksheetSkeleton(this._worksheet.getSheetId()))==null?void 0:t.skeleton}setColumnAutoWidth(e,r){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=[{startColumn:e,endColumn:e+r-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(a.SetWorksheetColAutoWidthCommand.id,{unitId:t,subUnitId:n,ranges:o}),this}customizeColumnHeader(e){var S,u;const r=this,t=this._fWorkbook.getId(),n=this._injector.get(m.IRenderManagerService),o=r.getSheetId(),s=n.getRenderById(t);s&&((S=e.headerStyle)!=null&&S.size)&&(s.with(a.SheetSkeletonManagerService).setColumnHeaderSize(s,o,(u=e.headerStyle)==null?void 0:u.size),r==null||r.refreshCanvas());const l=this._getSheetRenderComponent(t,a.SHEET_VIEW_KEY.COLUMN);l&&(l.setCustomHeader(e),r==null||r.refreshCanvas())}customizeRowHeader(e){const r=this._fWorkbook.getId();this._getSheetRenderComponent(r,a.SHEET_VIEW_KEY.ROW).setCustomHeader(e)}setColumnHeaderHeight(e){const r=this,t=this._fWorkbook.getId(),n=r.getSheetId();return this._commandService.executeCommand(a.SetColumnHeaderHeightCommand.id,{unitId:t,subUnitId:n,size:e}),r==null||r.refreshCanvas(),this}setRowHeaderWidth(e){const r=this,t=this._fWorkbook.getId(),n=r.getSheetId();this._commandService.executeCommand(a.SetRowHeaderWidthCommand.id,{unitId:t,subUnitId:n,size:e});const o=this._getSheetRenderComponent(t,a.SHEET_VIEW_KEY.ROW);return o&&o.setCustomHeader({headerStyle:{size:e}}),r==null||r.refreshCanvas(),this}_getSheetRenderComponent(e,r){const n=this._injector.get(m.IRenderManagerService).getRenderById(e);if(!n)throw new Error(`Render Unit with unitId ${e} not found`);const{components:o}=n,s=o.get(r);if(!s)throw new Error("Render component not found");return s}}w.FWorksheet.extend(x);class A extends w.FPermission{setPermissionDialogVisible(e){this._permissionService.setShowComponents(e)}}w.FPermission.extend(A);class O extends w.FSheetHooks{onCellPointerMove(e){return d.toDisposable(this._injector.get(a.HoverManagerService).currentPosition$.subscribe(e))}onCellPointerOver(e){return d.toDisposable(this._injector.get(a.HoverManagerService).currentCell$.subscribe(e))}onCellDragOver(e){return d.toDisposable(this._injector.get(a.DragManagerService).currentCell$.subscribe(e))}onCellDrop(e){return d.toDisposable(this._injector.get(a.DragManagerService).endCell$.subscribe(e))}onCellRender(e,r=d.InterceptorEffectEnum.Style,t=P.InterceptCellContentPriority.DATA_VALIDATION){return this._injector.get(P.SheetInterceptorService).intercept(P.INTERCEPTOR_POINT.CELL_CONTENT,{effect:r,handler:(n,o,s)=>s({...n,customRender:[...(n==null?void 0:n.customRender)||[],...e||[]]}),priority:t})}onBeforeCellEdit(e){return this._injector.get(d.ICommandService).beforeCommandExecuted(r=>{const t=r.params;r.id===a.SetCellEditVisibleOperation.id&&t.visible&&e(t)})}onAfterCellEdit(e){return this._injector.get(d.ICommandService).onCommandExecuted(r=>{const t=r.params;r.id===a.SetCellEditVisibleOperation.id&&!t.visible&&e(t)})}}w.FSheetHooks.extend(O);const R={CellClicked:"CellClicked",CellPointerDown:"CellPointerDown",CellPointerUp:"CellPointerUp",CellPointerMove:"CellPointerMove",CellHover:"CellHover",DragOver:"DragOver",Drop:"Drop",Scroll:"Scroll",SelectionMoveStart:"SelectionMoveStart",SelectionMoving:"SelectionMoving",SelectionMoveEnd:"SelectionMoveEnd",SelectionChanged:"SelectionChanged"};class W{get BeforeClipboardChange(){return"BeforeClipboardChange"}get ClipboardChanged(){return"ClipboardChanged"}get BeforeClipboardPaste(){return"BeforeClipboardPaste"}get ClipboardPasted(){return"ClipboardPasted"}get BeforeSheetEditStart(){return"BeforeSheetEditStart"}get SheetEditStarted(){return"SheetEditStarted"}get SheetEditChanging(){return"SheetEditChanging"}get BeforeSheetEditEnd(){return"BeforeSheetEditEnd"}get SheetEditEnded(){return"SheetEditEnded"}get CellClicked(){return R.CellClicked}get CellHover(){return R.CellHover}get CellPointerDown(){return R.CellPointerDown}get CellPointerUp(){return R.CellPointerUp}get CellPointerMove(){return R.CellPointerMove}get DragOver(){return"DragOver"}get Drop(){return"Drop"}get Scroll(){return"Scroll"}get SelectionMoveStart(){return"SelectionMoveStart"}get SelectionChanged(){return"SelectionChanged"}get SelectionMoving(){return"SelectionMoving"}get SelectionMoveEnd(){return"SelectionMoveEnd"}get RowHeaderClick(){return"RowHeaderClick"}get RowHeaderPointerDown(){return"RowHeaderPointerDown"}get RowHeaderPointerUp(){return"RowHeaderPointerUp"}get RowHeaderHover(){return"RowHeaderHover"}get ColumnHeaderClick(){return"ColumnHeaderClick"}get ColumnHeaderPointerDown(){return"ColumnHeaderPointerDown"}get ColumnHeaderPointerUp(){return"ColumnHeaderPointerUp"}get ColumnHeaderHover(){return"ColumnHeaderHover"}get SheetSkeletonChanged(){return"SheetSkeletonChanged"}get BeforeSheetZoomChange(){return"BeforeSheetZoomChange"}get SheetZoomChanged(){return"SheetZoomChanged"}}H.FEventName.extend(W);class U extends w.FRange{getCell(){var l;const e=this._injector.get(m.IRenderManagerService),r=this._injector.get(d.ILogService),t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=e.getRenderById(t),s=(l=o==null?void 0:o.with(a.SheetSkeletonManagerService).getSkeletonParam(n))==null?void 0:l.skeleton;if(!s)throw r.error("[Facade]: `FRange.getCell` can only be called in current worksheet"),new Error("`FRange.getCell` can only be called in current worksheet");return s.getCellWithCoordByIndex(this._range.startRow,this._range.startColumn)}getCellRect(){const{startX:e,startY:r,endX:t,endY:n}=this.getCell(),o={x:e,y:r,width:t-e,height:n-r,top:r,left:e,bottom:n,right:t};return{...o,toJSON:()=>JSON.stringify(o)}}generateHTML(){var r;const e=this._injector.get(a.ISheetClipboardService).generateCopyContent(this._workbook.getUnitId(),this._worksheet.getSheetId(),this._range);return(r=e==null?void 0:e.html)!=null?r:""}attachPopup(e){var s,l,S;e.direction=(s=e.direction)!=null?s:"horizontal",e.extraProps=(l=e.extraProps)!=null?l:{},e.offset=(S=e.offset)!=null?S:[0,0];const{key:r,disposableCollection:t}=y(e,this._injector.get(E.ComponentManager)),o=this._injector.get(a.SheetCanvasPopManagerService).attachPopupToCell(this._range.startRow,this._range.startColumn,{...e,componentKey:r},this.getUnitId(),this._worksheet.getSheetId());return o?(t.add(o),t):(t.dispose(),null)}attachAlertPopup(e){const r=this._injector.get(a.CellAlertManagerService),t={workbook:this._workbook,worksheet:this._worksheet,row:this._range.startRow,col:this._range.startColumn,unitId:this.getUnitId(),subUnitId:this._worksheet.getSheetId()};return r.showAlert({...e,location:t}),{dispose:()=>{r.removeAlert(e.key)}}}attachRangePopup(e){var s,l,S;e.direction=(s=e.direction)!=null?s:"top-center",e.extraProps=(l=e.extraProps)!=null?l:{},e.offset=(S=e.offset)!=null?S:[0,0];const{key:r,disposableCollection:t}=y(e,this._injector.get(E.ComponentManager)),o=this._injector.get(a.SheetCanvasPopManagerService).attachRangePopup(this._range,{...e,componentKey:r},this.getUnitId(),this._worksheet.getSheetId());return o?(t.add(o),t):(t.dispose(),null)}highlight(e,r){const t=this._injector.get(a.IMarkSelectionService),n=t.addShape({range:this._range,style:e,primary:r});if(!n)throw new Error("Failed to highlight current range");return d.toDisposable(()=>{t.removeShape(n)})}}w.FRange.extend(U);function y(k,e){const{componentKey:r,isVue3:t}=k;let n;const o=new d.DisposableCollection;return typeof r=="string"?n=r:(n=`External_${d.generateRandomId(6)}`,o.add(e.register(n,r,{framework:t?"vue3":"react"}))),{key:n,disposableCollection:o}}f.transformComponentKey=y,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});