@univerjs/sheets-ui 1.0.0-rc.0 → 1.0.1
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.
- package/lib/cjs/facade.js +5 -13
- package/lib/cjs/index.js +7439 -6538
- package/lib/cjs/locale/ar-SA.js +0 -1
- package/lib/cjs/locale/ca-ES.js +0 -1
- package/lib/cjs/locale/de-DE.js +0 -1
- package/lib/cjs/locale/en-US.js +0 -1
- package/lib/cjs/locale/es-ES.js +0 -1
- package/lib/cjs/locale/fa-IR.js +0 -1
- package/lib/cjs/locale/fr-FR.js +0 -1
- package/lib/cjs/locale/id-ID.js +0 -1
- package/lib/cjs/locale/it-IT.js +0 -1
- package/lib/cjs/locale/ja-JP.js +0 -1
- package/lib/cjs/locale/ko-KR.js +0 -1
- package/lib/cjs/locale/pl-PL.js +0 -1
- package/lib/cjs/locale/pt-BR.js +0 -1
- package/lib/cjs/locale/ru-RU.js +0 -1
- package/lib/cjs/locale/sk-SK.js +0 -1
- package/lib/cjs/locale/vi-VN.js +0 -1
- package/lib/cjs/locale/zh-CN.js +0 -1
- package/lib/cjs/locale/zh-HK.js +0 -1
- package/lib/cjs/locale/zh-TW.js +0 -1
- package/lib/es/facade.js +5 -13
- package/lib/es/index.js +7444 -6543
- package/lib/facade.js +5 -13
- package/lib/index.js +7444 -6543
- package/lib/types/controllers/auto-fill-ui.controller.d.ts +7 -1
- package/lib/types/controllers/render-controllers/desktop-cell-edit.render-controller.d.ts +49 -0
- package/lib/types/controllers/render-controllers/editor-bridge.render-controller.d.ts +2 -17
- package/lib/types/controllers/render-controllers/format-painter.render-controller.d.ts +5 -1
- package/lib/types/controllers/render-controllers/mobile/mobile-cell-edit.render-controller.d.ts +30 -0
- package/lib/types/controllers/render-controllers/mobile/mobile-hover.render-controller.d.ts +9 -0
- package/lib/types/controllers/render-controllers/mobile/mobile-scroll.render-controller.d.ts +0 -12
- package/lib/types/facade/f-range.d.ts +4 -4
- package/lib/types/facade/f-workbook.d.ts +2 -2
- package/lib/types/facade/f-worksheet.d.ts +12 -8
- package/lib/types/menu/mobile-schema.d.ts +17 -0
- package/lib/types/services/canvas-pop-manager.service.d.ts +2 -3
- package/lib/types/services/clipboard/html-to-usm/utils.d.ts +2 -0
- package/lib/types/services/selection/selection-render.service.d.ts +3 -0
- package/lib/types/views/auto-fill-popup-menu/AutoFillPopupMenu.d.ts +1 -5
- package/lib/types/views/auto-fill-popup-menu/component-name.d.ts +16 -0
- package/lib/types/views/sheet-container/SheetContainer.d.ts +1 -8
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +10 -28
- package/package.json +16 -16
- package/lib/types/services/sheet-loading-render.service.d.ts +0 -65
|
@@ -17,6 +17,7 @@ import type { IRange, Workbook, Worksheet } from '@univerjs/core';
|
|
|
17
17
|
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
18
18
|
import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
19
19
|
import { AutoFillController, IAutoFillService, SheetsSelectionsService } from '@univerjs/sheets';
|
|
20
|
+
import { SheetCanvasPopManagerService } from '../services/canvas-pop-manager.service';
|
|
20
21
|
import { IEditorBridgeService } from '../services/editor-bridge.service';
|
|
21
22
|
import { ISheetSelectionRenderService } from '../services/selection/base-selection-render.service';
|
|
22
23
|
import { SheetsRenderService } from '../services/sheets-render.service';
|
|
@@ -26,13 +27,18 @@ export declare class AutoFillUIController extends Disposable {
|
|
|
26
27
|
private readonly _autoFillService;
|
|
27
28
|
private _autoFillController;
|
|
28
29
|
private _sheetsRenderService;
|
|
30
|
+
private readonly _sheetCanvasPopManagerService;
|
|
29
31
|
private _currentLocation;
|
|
30
|
-
|
|
32
|
+
private _popupDisposable;
|
|
33
|
+
constructor(_univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _autoFillService: IAutoFillService, _autoFillController: AutoFillController, _sheetsRenderService: SheetsRenderService, _sheetCanvasPopManagerService: SheetCanvasPopManagerService);
|
|
31
34
|
private _init;
|
|
35
|
+
private _initPopup;
|
|
36
|
+
private _disposePopup;
|
|
32
37
|
private _initSkeletonChange;
|
|
33
38
|
private _initDefaultHook;
|
|
34
39
|
private _initQuitListener;
|
|
35
40
|
private _quit;
|
|
41
|
+
dispose(): void;
|
|
36
42
|
}
|
|
37
43
|
export declare class AutoFillRenderController extends Disposable implements IRenderModule {
|
|
38
44
|
private readonly _context;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Workbook } from '@univerjs/core';
|
|
17
|
+
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
18
|
+
import { ICommandService, IContextService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
19
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
20
|
+
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
21
|
+
import { IEditorBridgeService } from '../../services/editor-bridge.service';
|
|
22
|
+
import { ISheetEmbedRuntimeFocusCoordinator } from '../../services/sheet-embed-integration.service';
|
|
23
|
+
export declare class DesktopCellEditRenderController extends RxDisposable implements IRenderModule {
|
|
24
|
+
private readonly _context;
|
|
25
|
+
private readonly _instanceService;
|
|
26
|
+
private readonly _commandService;
|
|
27
|
+
private readonly _editorBridgeService;
|
|
28
|
+
private readonly _selectionManagerService;
|
|
29
|
+
private readonly _contextService;
|
|
30
|
+
private readonly _renderManagerService;
|
|
31
|
+
private readonly _embedRuntimeFocusCoordinator?;
|
|
32
|
+
private _d;
|
|
33
|
+
constructor(_context: IRenderContext<Workbook>, _instanceService: IUniverInstanceService, _commandService: ICommandService, _editorBridgeService: IEditorBridgeService, _selectionManagerService: SheetsSelectionsService, _contextService: IContextService, _renderManagerService: IRenderManagerService, _embedRuntimeFocusCoordinator?: ISheetEmbedRuntimeFocusCoordinator | undefined);
|
|
34
|
+
private _init;
|
|
35
|
+
private _disposeCurrent;
|
|
36
|
+
private _initEventListener;
|
|
37
|
+
private _initialKeyboardListener;
|
|
38
|
+
private _initSheetFocusListener;
|
|
39
|
+
private _initInputPositionListener;
|
|
40
|
+
private _updateInputPosition;
|
|
41
|
+
private _focusCellEditorInput;
|
|
42
|
+
private _showEditorByKeyboard;
|
|
43
|
+
private _tryHideEditor;
|
|
44
|
+
private _isEmbeddedFormulaEditorActive;
|
|
45
|
+
private _isCurrentEmbedRuntimeEvent;
|
|
46
|
+
private _hideEditor;
|
|
47
|
+
private _getSheetObject;
|
|
48
|
+
private _isCurrentSheetFocused;
|
|
49
|
+
}
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { Workbook } from '@univerjs/core';
|
|
17
17
|
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
18
|
-
import { ICommandService,
|
|
19
|
-
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
18
|
+
import { ICommandService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
20
19
|
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
21
20
|
import { IEditorBridgeService } from '../../services/editor-bridge.service';
|
|
22
21
|
import { ISheetEmbedRuntimeFocusCoordinator } from '../../services/sheet-embed-integration.service';
|
|
@@ -27,32 +26,18 @@ export declare class EditorBridgeRenderController extends RxDisposable implement
|
|
|
27
26
|
private readonly _commandService;
|
|
28
27
|
private readonly _editorBridgeService;
|
|
29
28
|
private readonly _selectionManagerService;
|
|
30
|
-
private readonly _contextService;
|
|
31
|
-
private readonly _renderManagerService;
|
|
32
29
|
private readonly _sheetSkeletonManagerService;
|
|
33
30
|
private readonly _embedRuntimeFocusCoordinator?;
|
|
34
31
|
private _d;
|
|
35
|
-
constructor(_context: IRenderContext<Workbook>, _instanceSrv: IUniverInstanceService, _commandService: ICommandService, _editorBridgeService: IEditorBridgeService, _selectionManagerService: SheetsSelectionsService,
|
|
32
|
+
constructor(_context: IRenderContext<Workbook>, _instanceSrv: IUniverInstanceService, _commandService: ICommandService, _editorBridgeService: IEditorBridgeService, _selectionManagerService: SheetsSelectionsService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _embedRuntimeFocusCoordinator?: ISheetEmbedRuntimeFocusCoordinator | undefined);
|
|
36
33
|
private _init;
|
|
37
34
|
private _disposeCurrent;
|
|
38
35
|
private _initSelectionChangeListener;
|
|
39
36
|
private _updateEditorPosition;
|
|
40
|
-
private _updateInputPosition;
|
|
41
37
|
refreshEditorPosition(): void;
|
|
42
|
-
private _initEventListener;
|
|
43
|
-
/**
|
|
44
|
-
* Should activate the editor when the user inputs text.
|
|
45
|
-
* @param d DisposableCollection
|
|
46
|
-
*/
|
|
47
|
-
private _initialKeyboardListener;
|
|
48
|
-
private _initSheetFocusListener;
|
|
49
|
-
private _focusCellEditorInput;
|
|
50
38
|
private _commandExecutedListener;
|
|
51
|
-
private _showEditorByKeyboard;
|
|
52
39
|
private _tryHideEditor;
|
|
53
40
|
private _isEmbeddedFormulaEditorActive;
|
|
54
|
-
private _isCurrentEmbedRuntimeEvent;
|
|
55
41
|
private _hideEditor;
|
|
56
42
|
private _getSheetObject;
|
|
57
|
-
private _isCurrentSheetFocused;
|
|
58
43
|
}
|
|
@@ -16,14 +16,18 @@
|
|
|
16
16
|
import type { Workbook } from '@univerjs/core';
|
|
17
17
|
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
18
18
|
import { Disposable, ICommandService } from '@univerjs/core';
|
|
19
|
+
import { SheetsSelectionsService } from '@univerjs/sheets';
|
|
20
|
+
import { FormatPainterSessionService } from '@univerjs/ui';
|
|
19
21
|
import { IFormatPainterService } from '../../services/format-painter/format-painter.service';
|
|
20
22
|
import { ISheetSelectionRenderService } from '../../services/selection/base-selection-render.service';
|
|
21
23
|
export declare class FormatPainterRenderController extends Disposable implements IRenderModule {
|
|
22
24
|
private readonly _context;
|
|
23
25
|
private readonly _formatPainterService;
|
|
24
26
|
private readonly _selectionRenderService;
|
|
27
|
+
private readonly _session;
|
|
28
|
+
private readonly _selections;
|
|
25
29
|
private readonly _commandService;
|
|
26
|
-
constructor(_context: IRenderContext<Workbook>, _formatPainterService: IFormatPainterService, _selectionRenderService: ISheetSelectionRenderService, _commandService: ICommandService);
|
|
30
|
+
constructor(_context: IRenderContext<Workbook>, _formatPainterService: IFormatPainterService, _selectionRenderService: ISheetSelectionRenderService, _session: FormatPainterSessionService, _selections: SheetsSelectionsService, _commandService: ICommandService);
|
|
27
31
|
private _initialize;
|
|
28
32
|
private _commandExecutedListener;
|
|
29
33
|
private _bindFormatPainterStatus;
|
package/lib/types/controllers/render-controllers/mobile/mobile-cell-edit.render-controller.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Workbook } from '@univerjs/core';
|
|
17
|
+
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
18
|
+
import { Disposable, ICommandService } from '@univerjs/core';
|
|
19
|
+
import { IEditorBridgeService } from '../../../services/editor-bridge.service';
|
|
20
|
+
import { HoverManagerService } from '../../../services/hover-manager.service';
|
|
21
|
+
export declare class MobileCellEditRenderController extends Disposable implements IRenderModule {
|
|
22
|
+
private readonly _context;
|
|
23
|
+
private readonly _commandService;
|
|
24
|
+
private readonly _editorBridgeService;
|
|
25
|
+
constructor(_context: IRenderContext<Workbook>, _commandService: ICommandService, _editorBridgeService: IEditorBridgeService, hoverManagerService: HoverManagerService);
|
|
26
|
+
private _initPointerDownListener;
|
|
27
|
+
private _isCurrentEditCell;
|
|
28
|
+
private _hideEditor;
|
|
29
|
+
private _getSheetObject;
|
|
30
|
+
}
|
|
@@ -27,8 +27,13 @@ export declare class MobileHoverRenderController extends Disposable implements I
|
|
|
27
27
|
private readonly _contextService;
|
|
28
28
|
private _active;
|
|
29
29
|
private _tapState;
|
|
30
|
+
private _lastCompletedTap;
|
|
31
|
+
private _completedTapTimer;
|
|
32
|
+
private _suppressEngineDoubleClick;
|
|
33
|
+
private _suppressEngineDoubleClickTimer;
|
|
30
34
|
get active(): boolean;
|
|
31
35
|
constructor(_context: IRenderContext<Workbook>, _hoverManagerService: HoverManagerService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _scrollManagerService: SheetScrollManagerService, _contextService: IContextService);
|
|
36
|
+
dispose(): void;
|
|
32
37
|
private _initPointerEvent;
|
|
33
38
|
private _bindMainComponentEvents;
|
|
34
39
|
private _bindRowHeaderEvents;
|
|
@@ -36,5 +41,9 @@ export declare class MobileHoverRenderController extends Disposable implements I
|
|
|
36
41
|
private _startTap;
|
|
37
42
|
private _updateTapState;
|
|
38
43
|
private _finishTap;
|
|
44
|
+
private _completeTap;
|
|
45
|
+
private _resetCompletedTap;
|
|
46
|
+
private _resetTapSequence;
|
|
47
|
+
private _clearEngineDoubleClickSuppression;
|
|
39
48
|
private _initScrollEvent;
|
|
40
49
|
}
|
package/lib/types/controllers/render-controllers/mobile/mobile-scroll.render-controller.d.ts
CHANGED
|
@@ -46,18 +46,6 @@ export declare class MobileSheetsScrollRenderController extends Disposable imple
|
|
|
46
46
|
* to avoid interfering with header events
|
|
47
47
|
*/
|
|
48
48
|
private _initPointerScrollEvent;
|
|
49
|
-
/**
|
|
50
|
-
* Create zoom indicator overlay element
|
|
51
|
-
*/
|
|
52
|
-
private _createZoomIndicator;
|
|
53
|
-
/**
|
|
54
|
-
* Show zoom indicator with percentage
|
|
55
|
-
*/
|
|
56
|
-
private _showZoomIndicator;
|
|
57
|
-
/**
|
|
58
|
-
* Hide zoom indicator with fade out
|
|
59
|
-
*/
|
|
60
|
-
private _hideZoomIndicator;
|
|
61
49
|
private _updateSceneSize;
|
|
62
50
|
private _getSheetObject;
|
|
63
51
|
private _scrollToSelection;
|
|
@@ -144,8 +144,8 @@ interface IFRangeSheetsUIMixin {
|
|
|
144
144
|
attachAlertPopup(alert: Omit<ICellAlert, 'location'>): IDisposable;
|
|
145
145
|
/**
|
|
146
146
|
* Attach a DOM popup to the current range.
|
|
147
|
-
* @param {IFCanvasPopup}
|
|
148
|
-
* @returns {Nullable<IDisposable>}
|
|
147
|
+
* @param {IFCanvasPopup} popup The popup to attach.
|
|
148
|
+
* @returns {Nullable<IDisposable>} A disposable that detaches the popup, or `null` if the popup cannot be attached.
|
|
149
149
|
* @example
|
|
150
150
|
* ```ts
|
|
151
151
|
* // Register a custom popup component
|
|
@@ -173,8 +173,8 @@ interface IFRangeSheetsUIMixin {
|
|
|
173
173
|
attachRangePopup(popup: IFCanvasPopup): Nullable<IDisposable>;
|
|
174
174
|
/**
|
|
175
175
|
* Highlight the range with the specified style and primary cell.
|
|
176
|
-
* @param {Nullable<Partial<ISelectionStyle>>} style - style for highlight range.
|
|
177
|
-
* @param {Nullable<ISelectionCell>} primary - primary cell for highlight range.
|
|
176
|
+
* @param {Nullable<Partial<ISelectionStyle>>} [style] - style for highlight range.
|
|
177
|
+
* @param {Nullable<ISelectionCell>} [primary] - primary cell for highlight range.
|
|
178
178
|
* @returns {IDisposable} The disposable object to remove the highlight.
|
|
179
179
|
* @example
|
|
180
180
|
* ```ts
|
|
@@ -83,7 +83,7 @@ export interface IFWorkbookSheetsUIMixin {
|
|
|
83
83
|
startEditing(): boolean;
|
|
84
84
|
/**
|
|
85
85
|
* End the editing process of the current active cell
|
|
86
|
-
* @param {boolean} save - Whether to save the changes, default is true
|
|
86
|
+
* @param {boolean} [save] - Whether to save the changes, default is true
|
|
87
87
|
* @returns {Promise<boolean>} Whether the editing process is ended successfully
|
|
88
88
|
* @example
|
|
89
89
|
* ```ts
|
|
@@ -116,7 +116,7 @@ export interface IFWorkbookSheetsUIMixin {
|
|
|
116
116
|
/**
|
|
117
117
|
* Get scroll state of specified sheet.
|
|
118
118
|
* @param {string} sheetId - sheet id
|
|
119
|
-
* @returns {IScrollState} scroll state
|
|
119
|
+
* @returns {Nullable<IScrollState>} The sheet scroll state, or a nullish value when no state is available.
|
|
120
120
|
* @example
|
|
121
121
|
* ``` ts
|
|
122
122
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -39,8 +39,8 @@ export interface IFWorksheetUIMixin {
|
|
|
39
39
|
/**
|
|
40
40
|
* Highlight multiple ranges on the worksheet.
|
|
41
41
|
* @param {FRange[]} ranges The ranges to highlight.
|
|
42
|
-
* @param {Nullable<Partial<ISelectionStyle>>} style - style for highlight ranges.
|
|
43
|
-
* @param {Nullable<ISelectionCell>} primary - primary cell for highlight ranges.
|
|
42
|
+
* @param {Nullable<Partial<ISelectionStyle>>} [style] - style for highlight ranges.
|
|
43
|
+
* @param {Nullable<ISelectionCell>} [primary] - primary cell for highlight ranges.
|
|
44
44
|
* @return {IDisposable} An IDisposable to remove the highlights.
|
|
45
45
|
* @example
|
|
46
46
|
* ```ts
|
|
@@ -87,7 +87,7 @@ export interface IFWorksheetUIMixin {
|
|
|
87
87
|
getZoom(): number;
|
|
88
88
|
/**
|
|
89
89
|
* Get visible range of main viewport.
|
|
90
|
-
* @returns {IRange}
|
|
90
|
+
* @returns {IRange | null} The visible range of the main viewport, or `null` if no sheet skeleton is available.
|
|
91
91
|
* @example
|
|
92
92
|
* ```ts
|
|
93
93
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -95,13 +95,15 @@ export interface IFWorksheetUIMixin {
|
|
|
95
95
|
* if (!fWorksheet) return;
|
|
96
96
|
* const visibleRange = fWorksheet.getVisibleRange();
|
|
97
97
|
* console.log(visibleRange);
|
|
98
|
-
*
|
|
98
|
+
* if (visibleRange) {
|
|
99
|
+
* console.log(fWorksheet.getRange(visibleRange).getA1Notation());
|
|
100
|
+
* }
|
|
99
101
|
* ```
|
|
100
102
|
*/
|
|
101
103
|
getVisibleRange(): IRange | null;
|
|
102
104
|
/**
|
|
103
105
|
* Get visible ranges of all viewports.
|
|
104
|
-
* @returns {
|
|
106
|
+
* @returns {Map<SHEET_VIEWPORT_KEY, IRange> | null} Visible ranges keyed by viewport in a `Map`, or `null` if no sheet skeleton is available.
|
|
105
107
|
* @example
|
|
106
108
|
* ```ts
|
|
107
109
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
@@ -110,7 +112,9 @@ export interface IFWorksheetUIMixin {
|
|
|
110
112
|
* const visibleRanges = fWorksheet.getVisibleRangesOfAllViewports();
|
|
111
113
|
* console.log(visibleRanges);
|
|
112
114
|
* const mainLeftTopViewportRange = visibleRanges?.get(univerAPI.Enum.SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP);
|
|
113
|
-
*
|
|
115
|
+
* if (mainLeftTopViewportRange) {
|
|
116
|
+
* console.log(fWorksheet.getRange(mainLeftTopViewportRange).getA1Notation());
|
|
117
|
+
* }
|
|
114
118
|
* ```
|
|
115
119
|
*/
|
|
116
120
|
getVisibleRangesOfAllViewports(): Map<SHEET_VIEWPORT_KEY, IRange> | null;
|
|
@@ -257,7 +261,7 @@ export interface IFWorksheetUIMixin {
|
|
|
257
261
|
*/
|
|
258
262
|
customizeRowHeader(cfg: IRowsHeaderCfgParam): void;
|
|
259
263
|
/**
|
|
260
|
-
*
|
|
264
|
+
* Sets the height of the column header in pixels.
|
|
261
265
|
* @param {number} height - The height to set.
|
|
262
266
|
* @returns {FWorksheet} - The FWorksheet instance for chaining.
|
|
263
267
|
* @example
|
|
@@ -270,7 +274,7 @@ export interface IFWorksheetUIMixin {
|
|
|
270
274
|
*/
|
|
271
275
|
setColumnHeaderHeight(height: number): FWorksheet;
|
|
272
276
|
/**
|
|
273
|
-
*
|
|
277
|
+
* Sets the width of the row header in pixels.
|
|
274
278
|
* @param {number} width - The width to set.
|
|
275
279
|
* @returns {FWorksheet} - The FWorksheet instance for chaining.
|
|
276
280
|
* @example
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { MenuSchemaType } from '@univerjs/ui';
|
|
17
|
+
export declare const mobileMenuSchema: MenuSchemaType;
|
|
@@ -101,7 +101,7 @@ export declare class SheetCanvasPopManagerService extends Disposable {
|
|
|
101
101
|
* @param _unitId
|
|
102
102
|
* @param _subUnitId
|
|
103
103
|
* @param viewport
|
|
104
|
-
* @returns
|
|
104
|
+
* @returns A disposable that detaches the popup, or `null` if it cannot be attached.
|
|
105
105
|
*/
|
|
106
106
|
attachPopupToCell(row: number, col: number, popup: ICanvasPopup, _unitId?: string, _subUnitId?: string, viewport?: Viewport): Nullable<INeedCheckDisposable>;
|
|
107
107
|
/**
|
|
@@ -128,8 +128,7 @@ export declare class SheetCanvasPopManagerService extends Disposable {
|
|
|
128
128
|
private _calcCellPositionByCell;
|
|
129
129
|
/**
|
|
130
130
|
* Unlike _createCellPositionObserver, this accept a range not a single cell.
|
|
131
|
-
* @param
|
|
132
|
-
* @param initialCol
|
|
131
|
+
* @param range
|
|
133
132
|
* @param currentRender
|
|
134
133
|
* @param skeleton
|
|
135
134
|
* @param activeViewport
|
|
@@ -24,6 +24,8 @@ export declare function convertToCellStyle(cell: ICellDataWithSpanInfo, dataStre
|
|
|
24
24
|
v?: Nullable<import("@univerjs/core").CellValue>;
|
|
25
25
|
t?: Nullable<import("@univerjs/core").CellValueType>;
|
|
26
26
|
f?: Nullable<string>;
|
|
27
|
+
ft?: Nullable<import("@univerjs/core").FormulaType>;
|
|
28
|
+
fd?: Nullable<import("@univerjs/core").BooleanNumber>;
|
|
27
29
|
ref?: Nullable<string>;
|
|
28
30
|
xf?: Nullable<string>;
|
|
29
31
|
si?: Nullable<string>;
|
|
@@ -32,6 +32,7 @@ export declare class SheetSelectionRenderService extends BaseSelectionRenderServ
|
|
|
32
32
|
protected readonly _contextService: IContextService;
|
|
33
33
|
private readonly _workbookSelections;
|
|
34
34
|
private _renderDisposable;
|
|
35
|
+
private _selectionBeforeModifierClick;
|
|
35
36
|
constructor(_context: IRenderContext<Workbook>, injector: Injector, themeService: ThemeService, shortcutService: IShortcutService, selectionManagerService: SheetsSelectionsService, sheetSkeletonManagerService: SheetSkeletonManagerService, _logService: ILogService, _commandService: ICommandService, _contextService: IContextService);
|
|
36
37
|
private _init;
|
|
37
38
|
dispose(): void;
|
|
@@ -73,4 +74,6 @@ export declare class SheetSelectionRenderService extends BaseSelectionRenderServ
|
|
|
73
74
|
* @param scrollTimerType
|
|
74
75
|
*/
|
|
75
76
|
protected _onPointerDown(evt: IPointerEvent | IMouseEvent, _zIndex: number | undefined, rangeType: RANGE_TYPE | undefined, viewport: Nullable<Viewport>, scrollTimerType?: ScrollTimerType): void;
|
|
77
|
+
private _updateSelectionControl;
|
|
78
|
+
endSelection(): void;
|
|
76
79
|
}
|
|
@@ -15,10 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { DropdownMenu } from '@univerjs/design';
|
|
17
17
|
import { AUTO_FILL_APPLY_TYPE } from '@univerjs/sheets';
|
|
18
|
-
export interface IAnchorPoint {
|
|
19
|
-
row: number;
|
|
20
|
-
col: number;
|
|
21
|
-
}
|
|
22
18
|
export interface IAutoFillPopupMenuItem {
|
|
23
19
|
label: string;
|
|
24
20
|
value: AUTO_FILL_APPLY_TYPE;
|
|
@@ -28,4 +24,4 @@ export interface IAutoFillPopupMenuItem {
|
|
|
28
24
|
export interface IAutoFillPopupMenuProps {
|
|
29
25
|
DropdownMenuComponent?: typeof DropdownMenu;
|
|
30
26
|
}
|
|
31
|
-
export declare function AutoFillPopupMenu({ DropdownMenuComponent }?: IAutoFillPopupMenuProps): import("react").JSX.Element
|
|
27
|
+
export declare function AutoFillPopupMenu({ DropdownMenuComponent }?: IAutoFillPopupMenuProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const AUTO_FILL_POPUP_MENU_COMPONENT = "sheets.component.auto-fill-popup-menu";
|
|
@@ -13,14 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { AutoFillPopupMenu } from '../auto-fill-popup-menu/AutoFillPopupMenu';
|
|
17
16
|
export declare const SHEET_FOOTER_BAR_HEIGHT = 36;
|
|
18
17
|
export declare function RenderSheetFooter(): import("react").JSX.Element | null;
|
|
19
18
|
export declare function RenderSheetHeader(): import("react").JSX.Element | null;
|
|
20
|
-
|
|
21
|
-
* We should not write into this component anymore.
|
|
22
|
-
*/
|
|
23
|
-
export interface IRenderSheetContentProps {
|
|
24
|
-
AutoFillPopupMenuComponent?: typeof AutoFillPopupMenu | null;
|
|
25
|
-
}
|
|
26
|
-
export declare function RenderSheetContent({ AutoFillPopupMenuComponent }?: IRenderSheetContentProps): import("react").JSX.Element | null;
|
|
19
|
+
export declare function RenderSheetContent(): import("react").JSX.Element | null;
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/sheets/facade")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/core/facade`,`@univerjs/docs`,`@univerjs/engine-render`,`@univerjs/sheets`,`@univerjs/sheets-ui`,`@univerjs/ui`,`rxjs`,`@univerjs/sheets/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsUiFacade={},e.UniverCore,e.UniverCoreFacade,e.UniverDocs,e.UniverEngineRender,e.UniverSheets,e.UniverSheetsUi,e.UniverUi,e.rxjs,e.UniverSheetsFacade))})(this,function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var u=class extends n.FUniver{_initSheetUIEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>n.beforeCommandExecuted(n=>{if(n.id!==o.SetCellEditVisibleOperation.id)return;let r=this.getActiveSheet();if(!r)return;let{workbook:i,worksheet:a}=r,s=e.get(o.IEditorBridgeService),{visible:c,keycode:l,eventType:u}=n.params,d=s.getEditLocation();if(!c)return;let f={row:d.row,column:d.column,eventType:u,keycode:l,workbook:i,worksheet:a};if(this.fireEvent(this.Event.BeforeSheetEditStart,f),f.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>n.beforeCommandExecuted(n=>{if(n.id!==o.SetCellEditVisibleOperation.id)return;let r=this.getActiveSheet();if(!r)return;let{workbook:i,worksheet:a}=r,c=e.get(o.IEditorBridgeService),l=e.get(t.IUniverInstanceService),{visible:u,keycode:d,eventType:f}=n.params,p=c.getEditLocation();if(u)return;let m={row:p.row,column:p.column,eventType:f,keycode:d,workbook:i,worksheet:a,value:t.RichTextValue.create(l.getUnit(t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:d!==s.KeyCode.ESC};if(this.fireEvent(this.Event.BeforeSheetEditEnd,m),m.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>n.onCommandExecuted(t=>{if(t.id!==o.SetCellEditVisibleOperation.id)return;let n=t.params,r=this.getSheetCommandTarget(n);if(!r)return;let{workbook:i,worksheet:a}=r,{visible:s,keycode:c,eventType:l}=n;if(!s)return;let u=e.get(o.IEditorBridgeService).getEditLocation(),d={row:u.row,column:u.column,eventType:l,keycode:c,workbook:i,worksheet:a};this.fireEvent(this.Event.SheetEditStarted,d)}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>n.onCommandExecuted(t=>{if(t.id!==o.SetCellEditVisibleOperation.id)return;let n=t.params,r=this.getSheetCommandTarget(n);if(!r)return;let{workbook:i,worksheet:a}=r,{visible:c,keycode:l,eventType:u}=n;if(c)return;let d=e.get(o.IEditorBridgeService).getEditLocation(),f={row:d.row,column:d.column,eventType:u,keycode:l,workbook:i,worksheet:a,isConfirm:l!==s.KeyCode.ESC};this.fireEvent(this.Event.SheetEditEnded,f)}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>n.onCommandExecuted(n=>{if(n.id!==r.RichTextEditingMutation.id)return;let i=n.params,a=this.getActiveSheet();if(!a)return;let{workbook:s,worksheet:c}=a,l=e.get(o.IEditorBridgeService),u=e.get(t.IUniverInstanceService);if(!l.isVisible().visible)return;let{unitId:d}=i;if(d===t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY){let{row:e,column:n}=l.getEditLocation(),r={workbook:s,worksheet:c,row:e,column:n,value:t.RichTextValue.create(u.getUnit(t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot())};this.fireEvent(this.Event.SheetEditChanging,r)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetZoomChange,()=>n.beforeCommandExecuted(e=>{if(e.id!==o.SetZoomRatioCommand.id)return;let n=e.params,r=this.getSheetCommandTarget(n);if(!r)return;let{workbook:i,worksheet:a}=r,{zoomRatio:s}=n,c={workbook:i,worksheet:a,zoom:s};if(this.fireEvent(this.Event.BeforeSheetZoomChange,c),c.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetZoomChanged,()=>n.onCommandExecuted(e=>{if(e.id!==o.SetZoomRatioCommand.id)return;let t=e.params,n=this.getSheetCommandTarget(t);if(!n)return;let{workbook:r,worksheet:i}=n,{zoomRatio:a}=t,s={workbook:r,worksheet:i,zoom:a};this.fireEvent(this.Event.SheetZoomChanged,s)})))}_initObserverListener(e){let n=e.get(i.IRenderManagerService),r=e.get(t.LifecycleService),s=e.get(t.IUniverInstanceService),l=new t.DisposableCollection,u=()=>{let t=e.get(o.HoverManagerService),n=e.get(o.DragManagerService);l.add(this.registerEventHandler(this.Event.CellClicked,()=>{var e;return(e=t.currentClickedCell$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e.location,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:r,column:i};this.fireEvent(this.Event.CellClicked,c)})})),l.add(this.registerEventHandler(this.Event.CellHover,()=>{var e;return(e=t.currentRichText$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:r,column:i};this.fireEvent(this.Event.CellHover,c)})})),l.add(this.registerEventHandler(this.Event.CellPointerDown,()=>{var e;return(e=t.currentPointerDownCell$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:r,column:i};this.fireEvent(this.Event.CellPointerDown,c)})})),l.add(this.registerEventHandler(this.Event.CellPointerUp,()=>{var e;return(e=t.currentPointerUpCell$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:r,column:i};this.fireEvent(this.Event.CellPointerUp,c)})})),l.add(this.registerEventHandler(this.Event.CellPointerMove,()=>{var e;return(e=t.currentCellPosWithEvent$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:r,column:i};this.fireEvent(this.Event.CellPointerMove,c)})})),l.add(this.registerEventHandler(this.Event.DragOver,()=>{var e;return(e=n.currentCell$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e.location,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,...e,row:r,column:i};this.fireEvent(this.Event.DragOver,c)})})),l.add(this.registerEventHandler(this.Event.Drop,()=>{var e;return(e=n.endCell$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e.location,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,...e,row:r,column:i};this.fireEvent(this.Event.Drop,c)})})),l.add(this.registerEventHandler(this.Event.RowHeaderClick,()=>{var e;return(e=t.currentRowHeaderClick$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r};this.fireEvent(this.Event.RowHeaderClick,s)})})),l.add(this.registerEventHandler(this.Event.RowHeaderPointerDown,()=>{var e;return(e=t.currentRowHeaderPointerDown$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r};this.fireEvent(this.Event.RowHeaderPointerDown,s)})})),l.add(this.registerEventHandler(this.Event.RowHeaderPointerUp,()=>{var e;return(e=t.currentRowHeaderPointerUp$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r};this.fireEvent(this.Event.RowHeaderPointerUp,s)})})),l.add(this.registerEventHandler(this.Event.RowHeaderHover,()=>{var e;return(e=t.currentHoveredRowHeader$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r};this.fireEvent(this.Event.RowHeaderHover,s)})})),l.add(this.registerEventHandler(this.Event.ColumnHeaderClick,()=>{var e;return(e=t.currentColHeaderClick$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,column:r};this.fireEvent(this.Event.ColumnHeaderClick,s)})})),l.add(this.registerEventHandler(this.Event.ColumnHeaderPointerDown,()=>{var e;return(e=t.currentColHeaderPointerDown$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,column:r};this.fireEvent(this.Event.ColumnHeaderPointerDown,s)})})),l.add(this.registerEventHandler(this.Event.ColumnHeaderPointerUp,()=>{var e;return(e=t.currentColHeaderPointerUp$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,column:r};this.fireEvent(this.Event.ColumnHeaderPointerUp,s)})})),l.add(this.registerEventHandler(this.Event.ColumnHeaderHover,()=>{var e;return(e=t.currentHoveredColHeader$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,column:r};this.fireEvent(this.Event.ColumnHeaderHover,s)})})),this.disposeWithMe(l)},d=s.getAllUnitsForType(t.UniverInstanceType.UNIVER_SHEET).length>0?(0,c.of)(!0):s.getTypeOfUnitAdded$(t.UniverInstanceType.UNIVER_SHEET).pipe((0,c.take)(1));this.disposeWithMe((0,c.combineLatest)([d,r.lifecycle$]).pipe((0,c.filter)(([,e])=>e>=t.LifecycleStages.Rendered),(0,c.take)(1)).subscribe(()=>u()));let f,p=(0,c.combineLatest)([n.created$,r.lifecycle$]),m=new t.DisposableCollection;this.disposeWithMe(p.subscribe(([e,n])=>{if(e.type===t.UniverInstanceType.UNIVER_SHEET&&(f=e),n<=t.LifecycleStages.Rendered||!f)return;let r=this.getWorkbook(f.unitId);if(!r)return;m.dispose();let i=f.with(o.SheetScrollManagerService),s=this._tryGetRenderDependency(f,a.SheetsSelectionsService);m.add(this.registerEventHandler(this.Event.Scroll,()=>i.validViewportScrollInfo$.subscribe(e=>{if(!e)return;let t={workbook:r,worksheet:r.getActiveSheet(),...e};this.fireEvent(this.Event.Scroll,t)}))),s&&(m.add(this.registerEventHandler(this.Event.SelectionMoveStart,()=>s.selectionMoveStart$.subscribe(e=>{let t={workbook:r,worksheet:r.getActiveSheet(),selections:(e==null?void 0:e.map(e=>e.range))??[]};this.fireEvent(this.Event.SelectionMoveStart,t)}))),m.add(this.registerEventHandler(this.Event.SelectionMoving,()=>s.selectionMoving$.subscribe(e=>{let t={workbook:r,worksheet:r.getActiveSheet(),selections:(e==null?void 0:e.map(e=>e.range))??[]};this.fireEvent(this.Event.SelectionMoving,t)}))),m.add(this.registerEventHandler(this.Event.SelectionMoveEnd,()=>s.selectionMoveEnd$.subscribe(e=>{let t={workbook:r,worksheet:r.getActiveSheet(),selections:(e==null?void 0:e.map(e=>e.range))??[]};this.fireEvent(this.Event.SelectionMoveEnd,t)}))),m.add(this.registerEventHandler(this.Event.SelectionChanged,()=>s.selectionChanged$.subscribe(e=>{let t={workbook:r,worksheet:r.getActiveSheet(),selections:(e==null?void 0:e.map(e=>e.range))??[]};this.fireEvent(this.Event.SelectionChanged,t)})))),f=null,this.disposeWithMe(m)}))}_tryGetRenderDependency(e,t){try{return e.with(t)}catch(e){if(e instanceof Error&&(e.message.includes(`DependencyNotFoundError`)||e.message.includes(`Cannot find`)))return null;throw e}}_initialize(e){this._initSheetUIEvent(e),this._initObserverListener(e);let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeClipboardChange,()=>n.beforeCommandExecuted(e=>{switch(e.id){case s.CopyCommand.id:case s.CutCommand.id:this._beforeClipboardChange();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.ClipboardChanged,()=>n.onCommandExecuted(e=>{switch(e.id){case s.CopyCommand.id:case s.CutCommand.id:this._clipboardChanged();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeClipboardPaste,()=>n.beforeCommandExecuted(e=>{switch(e.id){case o.SheetPasteShortKeyCommand.id:this._beforeClipboardPaste(e.params);break;case s.PasteCommand.id:this._beforeClipboardPasteAsync();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.ClipboardPasted,()=>n.onCommandExecuted(e=>{switch(e.id){case o.SheetPasteShortKeyCommand.id:this._clipboardPaste(e.params);break;case s.PasteCommand.id:this._clipboardPasteAsync();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetSkeletonChanged,()=>n.onCommandExecuted(e=>{if(a.COMMAND_LISTENER_SKELETON_CHANGE.indexOf(e.id)>-1){let t=this.getActiveSheet();if(!t)return;let n=(0,a.getSkeletonChangedEffectedRange)(e,t.worksheet.getMaxColumns()).map(e=>{var t;return(t=this.getWorkbook(e.unitId))==null||(t=t.getSheetBySheetId(e.subUnitId))==null?void 0:t.getRange(e.range)}).filter(Boolean);if(!n.length)return;let r={workbook:t.workbook,worksheet:t.worksheet,payload:e,skeleton:t.worksheet.getSkeleton(),effectedRanges:n};this.fireEvent(this.Event.SheetSkeletonChanged,r)}})))}_generateClipboardCopyParam(){let e=this.getActiveWorkbook(),t=e==null?void 0:e.getActiveSheet(),n=e==null?void 0:e.getActiveRange();if(!e||!t||!n)return;let r=this._injector.get(o.ISheetClipboardService).generateCopyContent(e.getId(),t.getSheetId(),n.getRange());if(!r)return;let{html:i,plain:a}=r;return{workbook:e,worksheet:t,text:a,html:i,fromSheet:t,fromRange:n}}_beforeClipboardChange(){let e=this._generateClipboardCopyParam();if(e&&(this.fireEvent(this.Event.BeforeClipboardChange,e),e.cancel))throw new t.CanceledError}_clipboardChanged(){let e=this._generateClipboardCopyParam();e&&this.fireEvent(this.Event.ClipboardChanged,e)}_generateClipboardPasteParam(e){if(!e)return;let{htmlContent:t,textContent:n}=e,r=this.getActiveWorkbook(),i=r==null?void 0:r.getActiveSheet();if(!(!r||!i))return{workbook:r,worksheet:i,text:n,html:t}}async _generateClipboardPasteParamAsync(){let e=this.getActiveWorkbook(),t=e==null?void 0:e.getActiveSheet();if(!e||!t)return;let n=(await this._injector.get(s.IClipboardInterfaceService).read())[0],r;if(n){let i=n.types;r={workbook:e,worksheet:t,text:i.indexOf(s.PLAIN_TEXT_CLIPBOARD_MIME_TYPE)===-1?``:await n.getType(s.PLAIN_TEXT_CLIPBOARD_MIME_TYPE).then(e=>e&&e.text()),html:i.indexOf(s.HTML_CLIPBOARD_MIME_TYPE)===-1?``:await n.getType(s.HTML_CLIPBOARD_MIME_TYPE).then(e=>e&&e.text())}}return r}_beforeClipboardPaste(e){let n=this._generateClipboardPasteParam(e);if(n&&(this.fireEvent(this.Event.BeforeClipboardPaste,n),n.cancel))throw new t.CanceledError}_clipboardPaste(e){let n=this._generateClipboardPasteParam(e);if(n&&(this.fireEvent(this.Event.ClipboardPasted,n),n.cancel))throw new t.CanceledError}async _beforeClipboardPasteAsync(){if(!(0,s.supportClipboardAPI)()){this._injector.get(t.ILogService).warn(`[Facade]: The navigator object only supports the browser environment`);return}let e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.BeforeClipboardPaste,e),e.cancel))throw new t.CanceledError}async _clipboardPasteAsync(){if(!(0,s.supportClipboardAPI)()){this._injector.get(t.ILogService).warn(`[Facade]: The navigator object only supports the browser environment`);return}let e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.ClipboardPasted,e),e.cancel))throw new t.CanceledError}registerSheetRowHeaderExtension(e,...n){let r=this._getSheetRenderComponent(e,o.SHEET_VIEW_KEY.ROW),i=r.register(...n);return(0,t.toDisposable)(()=>{i.dispose(),r.makeDirty(!0)})}registerSheetColumnHeaderExtension(e,...n){let r=this._getSheetRenderComponent(e,o.SHEET_VIEW_KEY.COLUMN),i=r.register(...n);return(0,t.toDisposable)(()=>{i.dispose(),r.makeDirty(!0)})}registerSheetMainExtension(e,...n){let r=this._getSheetRenderComponent(e,o.SHEET_VIEW_KEY.MAIN),i=r.register(...n);return(0,t.toDisposable)(()=>{i.dispose(),r.makeDirty(!0)})}registerCellCustomRender(e,n=t.InterceptorEffectEnum.Style,r){return this._injector.get(a.SheetInterceptorService).intercept(a.INTERCEPTOR_POINT.CELL_CONTENT,{effect:n,handler:(t,n,r)=>(t&&!t.customRender&&e&&(t.customRender=[...e]),r(t)),priority:r})}_getSheetRenderComponent(e,t){let n=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,a=r.get(t);if(!a)throw Error(`Render component not found`);return a}pasteIntoSheet(e,t,n){return this._commandService.executeCommand(o.SheetPasteShortKeyCommand.id,{htmlContent:e,textContent:t,files:n})}setProtectedRangeShadowStrategy(e){this._injector.get(o.SheetPermissionRenderManagerService).setProtectedRangeShadowStrategy(e)}getProtectedRangeShadowStrategy(){return this._injector.get(o.SheetPermissionRenderManagerService).getProtectedRangeShadowStrategy()}getProtectedRangeShadowStrategy$(){return this._injector.get(o.SheetPermissionRenderManagerService).getProtectedRangeShadowStrategy$()}setPermissionDialogVisible(e){this._injector.get(t.IPermissionService).setShowComponents(e)}};n.FUniver.extend(u);var d=class extends l.FWorkbook{customizeColumnHeader(e){let t=this._workbook.getUnitId();this._getSheetRenderComponent(t,o.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e)}customizeRowHeader(e){let t=this._workbook.getUnitId();this._getSheetRenderComponent(t,o.SHEET_VIEW_KEY.ROW).setCustomHeader(e)}_getSheetRenderComponent(e,t){let n=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,a=r.get(t);if(!a)throw Error(`Render component not found`);return a}_logDeprecation(e){this._injector.get(t.ILogService).warn(`[FWorkbook]`,`${e} is deprecated. Please use the function of the same name on "FUniver".`)}startEditing(){let e=this._injector.get(t.ICommandService);return this._injector.get(o.IEditorBridgeService).isVisible().visible?!0:e.syncExecuteCommand(o.SetCellEditVisibleOperation.id,{eventType:i.DeviceInputEventType.Dblclick,unitId:this._workbook.getUnitId(),visible:!0})}async endEditingAsync(e=!0){let n=this._injector.get(t.ICommandService);return this._injector.get(o.IEditorBridgeService).isVisible().visible&&n.syncExecuteCommand(o.SetCellEditVisibleOperation.id,{eventType:i.DeviceInputEventType.Keyboard,keycode:e?s.KeyCode.ENTER:s.KeyCode.ESC,visible:!1,unitId:this._workbook.getUnitId()}),await(0,t.awaitTime)(0),!0}abortEditingAsync(){return this.endEditingAsync(!1)}isCellEditing(){return this._injector.get(o.IEditorBridgeService).isVisible().visible}getScrollStateBySheetId(e){let t=this._workbook.getUnitId(),n=this._injector.get(i.IRenderManagerService).getRenderUnitById(t);return n?n.with(o.SheetScrollManagerService).getScrollStateByParam({unitId:t,sheetId:e}):null}disableSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);return t&&t.with(o.ISheetSelectionRenderService).disableSelection(),this}enableSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);return t&&t.with(o.ISheetSelectionRenderService).enableSelection(),this}transparentSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);return t&&t.with(o.ISheetSelectionRenderService).transparentSelection(),this}showSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);return t&&t.with(o.ISheetSelectionRenderService).showSelection(),this}};l.FWorkbook.extend(d);var f=class extends l.FWorksheet{refreshCanvas(){let e=this._injector.get(i.IRenderManagerService),t=this._fWorkbook.id,n=e.getRenderUnitById(t);if(!n)throw Error(`Render Unit with unitId ${t} not found`);return n.with(o.SheetSkeletonManagerService).reCalculate(),n.components.forEach(e=>{var t;(t=e.makeDirty)==null||t.call(e)}),this}highlightRanges(e,n,r){let i=this._injector.get(o.IMarkSelectionService),a=[];for(let t of e){let e=t.getRange(),o=i.addShapeWithNoFresh({range:e,style:n,primary:r});o&&a.push(o)}if(i.refreshShapes(),a.length===0)throw Error(`Failed to highlight current range`);return(0,t.toDisposable)(()=>{a.forEach(e=>{i.removeShape(e)})})}zoom(e){let n=this._injector.get(t.ICommandService),r=Math.min(Math.max(e,.1),4);return n.executeCommand(o.SetZoomRatioCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),zoomRatio:r}),this}getZoom(){return this._worksheet.getZoomRatio()}getVisibleRange(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);if(!t)return null;let n=t.with(o.SheetSkeletonManagerService).getCurrentSkeleton();return n?n.getVisibleRangeByViewport(i.SHEET_VIEWPORT_KEY.VIEW_MAIN):null}getVisibleRangesOfAllViewports(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);if(!t)return null;let n=t.with(o.SheetSkeletonManagerService).getCurrentSkeleton();return n?n.getVisibleRanges():null}scrollToCell(e,t,n){let r=this._workbook.getUnitId(),a=this._injector.get(i.IRenderManagerService).getRenderUnitById(r);return a&&(a==null?void 0:a.with(o.SheetsScrollRenderController)).scrollToCell(e,t,n),this}getScrollState(){let e={offsetX:0,offsetY:0,sheetViewStartColumn:0,sheetViewStartRow:0},t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),r=this._injector.get(i.IRenderManagerService).getRenderUnitById(t);return r&&r.with(o.SheetScrollManagerService).getScrollStateByParam({unitId:t,sheetId:n})||e}getSkeleton(){var e;let t=(e=this._injector.get(i.IRenderManagerService).getRenderUnitById(this._workbook.getUnitId()))==null?void 0:e.with(o.SheetSkeletonManagerService);return t==null?void 0:t.getSkeleton(this._worksheet.getSheetId())}autoResizeColumns(e,t=1){let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(o.SetWorksheetColAutoWidthCommand.id,{unitId:n,subUnitId:r,ranges:i}),this}autoResizeRows(e,t=1){let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:n,subUnitId:r,ranges:i}),this}customizeColumnHeader(e){var t;let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),a=this._injector.get(i.IRenderManagerService).getRenderUnitById(n);if(a&&(t=e.headerStyle)!=null&&t.size){var s;a.with(o.SheetSkeletonManagerService).setColumnHeaderSize(a,r,(s=e.headerStyle)==null?void 0:s.size)}this._getSheetRenderComponent(n,o.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e,r)}customizeRowHeader(e){var t;let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),a=this._injector.get(i.IRenderManagerService).getRenderUnitById(n);if(a&&(t=e.headerStyle)!=null&&t.size){var s;a.with(o.SheetSkeletonManagerService).setRowHeaderSize(a,r,(s=e.headerStyle)==null?void 0:s.size)}this._getSheetRenderComponent(n,o.SHEET_VIEW_KEY.ROW).setCustomHeader(e,r)}setColumnHeaderHeight(e){let t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.executeCommand(o.SetColumnHeaderHeightCommand.id,{unitId:t,subUnitId:n,size:e}),this}setRowHeaderWidth(e){let t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.executeCommand(o.SetRowHeaderWidthCommand.id,{unitId:t,subUnitId:n,size:e}),this}_getSheetRenderComponent(e,t){let n=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,a=r.get(t);if(!a)throw Error(`Render component not found`);return a}};l.FWorksheet.extend(f);var p=class extends n.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`CellClicked`}get CellHover(){return`CellHover`}get CellPointerDown(){return`CellPointerDown`}get CellPointerUp(){return`CellPointerUp`}get CellPointerMove(){return`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`}};n.FEventName.extend(p);var m=class extends n.FEnum{get SHEET_VIEWPORT_KEY(){return i.SHEET_VIEWPORT_KEY}};n.FEnum.extend(m);var h=class extends l.FRange{getCell(){var e;let n=this._injector.get(i.IRenderManagerService),r=this._injector.get(t.ILogService),a=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),c=n.getRenderUnitById(a),l=c==null||(e=c.with(o.SheetSkeletonManagerService).getSkeletonParam(s))==null?void 0:e.skeleton;if(!l)throw r.error("[Facade]: `FRange.getCell` can only be called in current worksheet"),Error("`FRange.getCell` can only be called in current worksheet");return l.getCellWithCoordByIndex(this._range.startRow,this._range.startColumn)}getCellRect(){let{startX:e,startY:t,endX:n,endY:r}=this.getCell(),i={x:e,y:t,width:n-e,height:r-t,top:t,left:e,bottom:r,right:n};return{...i,toJSON:()=>JSON.stringify(i)}}generateHTML(){let e=this._injector.get(o.ISheetClipboardService).generateCopyContent(this._workbook.getUnitId(),this._worksheet.getSheetId(),this._range);return(e==null?void 0:e.html)??``}attachPopup(e){e.direction=e.direction??`horizontal`,e.extraProps=e.extraProps??{},e.offset=e.offset??[0,0];let{key:t,disposableCollection:n}=g(e,this._injector.get(s.ComponentManager)),r=this._injector.get(o.SheetCanvasPopManagerService).attachPopupToCell(this._range.startRow,this._range.startColumn,{...e,componentKey:t},this.getUnitId(),this._worksheet.getSheetId());return r?(n.add(r),n):(n.dispose(),null)}attachAlertPopup(e){let t=this._injector.get(o.CellAlertManagerService),n={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:n}),{dispose:()=>{t.removeAlert(e.key)}}}attachRangePopup(e){e.direction=e.direction??`top-center`,e.extraProps=e.extraProps??{},e.offset=e.offset??[0,0];let{key:t,disposableCollection:n}=g(e,this._injector.get(s.ComponentManager)),r=this._injector.get(o.SheetCanvasPopManagerService).attachRangePopup(this._range,{...e,componentKey:t},this.getUnitId(),this._worksheet.getSheetId());return r?(n.add(r),n):(n.dispose(),null)}highlight(e,n){let r=this._injector.get(o.IMarkSelectionService),i=r.addShape({range:this._range,style:e,primary:n});if(!i)throw Error(`Failed to highlight current range`);return(0,t.toDisposable)(()=>{r.removeShape(i)})}showDropdown(e){return this._injector.get(o.ISheetCellDropdownManagerService).showDropdown(e)}};l.FRange.extend(h);function g(e,n){let{componentKey:r,framework:i}=e,a,o=new t.DisposableCollection;if(typeof r==`string`)a=r;else{let e=i??`react`;a=e===`web-component`?`external-${(0,t.generateRandomId)(6).toLowerCase()}`:`External_${(0,t.generateRandomId)(6)}`,o.add(n.register(a,r,{framework:e}))}return{key:a,disposableCollection:o}}e.FSheetsUIEnumMixin=m,e.transformComponentKey=g});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/sheets/facade")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/core/facade`,`@univerjs/docs`,`@univerjs/engine-render`,`@univerjs/sheets`,`@univerjs/sheets-ui`,`@univerjs/ui`,`rxjs`,`@univerjs/sheets/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsUiFacade={},e.UniverCore,e.UniverCoreFacade,e.UniverDocs,e.UniverEngineRender,e.UniverSheets,e.UniverSheetsUi,e.UniverUi,e.rxjs,e.UniverSheetsFacade))})(this,function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var u=class extends n.FUniver{_initSheetUIEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>n.beforeCommandExecuted(n=>{if(n.id!==o.SetCellEditVisibleOperation.id)return;let r=this.getActiveSheet();if(!r)return;let{workbook:i,worksheet:a}=r,s=e.get(o.IEditorBridgeService),{visible:c,keycode:l,eventType:u}=n.params,d=s.getEditLocation();if(!c)return;let f={row:d.row,column:d.column,eventType:u,keycode:l,workbook:i,worksheet:a};if(this.fireEvent(this.Event.BeforeSheetEditStart,f),f.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>n.beforeCommandExecuted(n=>{if(n.id!==o.SetCellEditVisibleOperation.id)return;let r=this.getActiveSheet();if(!r)return;let{workbook:i,worksheet:a}=r,c=e.get(o.IEditorBridgeService),l=e.get(t.IUniverInstanceService),{visible:u,keycode:d,eventType:f}=n.params,p=c.getEditLocation();if(u)return;let m={row:p.row,column:p.column,eventType:f,keycode:d,workbook:i,worksheet:a,value:t.RichTextValue.create(l.getUnit(t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:d!==s.KeyCode.ESC};if(this.fireEvent(this.Event.BeforeSheetEditEnd,m),m.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>n.onCommandExecuted(t=>{if(t.id!==o.SetCellEditVisibleOperation.id)return;let n=t.params,r=this.getSheetCommandTarget(n);if(!r)return;let{workbook:i,worksheet:a}=r,{visible:s,keycode:c,eventType:l}=n;if(!s)return;let u=e.get(o.IEditorBridgeService).getEditLocation(),d={row:u.row,column:u.column,eventType:l,keycode:c,workbook:i,worksheet:a};this.fireEvent(this.Event.SheetEditStarted,d)}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>n.onCommandExecuted(t=>{if(t.id!==o.SetCellEditVisibleOperation.id)return;let n=t.params,r=this.getSheetCommandTarget(n);if(!r)return;let{workbook:i,worksheet:a}=r,{visible:c,keycode:l,eventType:u}=n;if(c)return;let d=e.get(o.IEditorBridgeService).getEditLocation(),f={row:d.row,column:d.column,eventType:u,keycode:l,workbook:i,worksheet:a,isConfirm:l!==s.KeyCode.ESC};this.fireEvent(this.Event.SheetEditEnded,f)}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>n.onCommandExecuted(n=>{if(n.id!==r.RichTextEditingMutation.id)return;let i=n.params,a=this.getActiveSheet();if(!a)return;let{workbook:s,worksheet:c}=a,l=e.get(o.IEditorBridgeService),u=e.get(t.IUniverInstanceService);if(!l.isVisible().visible)return;let{unitId:d}=i;if(d===t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY){let{row:e,column:n}=l.getEditLocation(),r={workbook:s,worksheet:c,row:e,column:n,value:t.RichTextValue.create(u.getUnit(t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot())};this.fireEvent(this.Event.SheetEditChanging,r)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetZoomChange,()=>n.beforeCommandExecuted(e=>{if(e.id!==o.SetZoomRatioCommand.id)return;let n=e.params,r=this.getSheetCommandTarget(n);if(!r)return;let{workbook:i,worksheet:a}=r,{zoomRatio:s}=n,c={workbook:i,worksheet:a,zoom:s};if(this.fireEvent(this.Event.BeforeSheetZoomChange,c),c.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetZoomChanged,()=>n.onCommandExecuted(e=>{if(e.id!==o.SetZoomRatioCommand.id)return;let t=e.params,n=this.getSheetCommandTarget(t);if(!n)return;let{workbook:r,worksheet:i}=n,{zoomRatio:a}=t,s={workbook:r,worksheet:i,zoom:a};this.fireEvent(this.Event.SheetZoomChanged,s)})))}_initObserverListener(e){let n=e.get(i.IRenderManagerService),r=e.get(t.LifecycleService),s=e.get(t.IUniverInstanceService),l=new t.DisposableCollection,u=()=>{let t=e.get(o.HoverManagerService),n=e.get(o.DragManagerService);l.add(this.registerEventHandler(this.Event.CellClicked,()=>{var e;return(e=t.currentClickedCell$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e.location,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:r,column:i};this.fireEvent(this.Event.CellClicked,c)})})),l.add(this.registerEventHandler(this.Event.CellHover,()=>{var e;return(e=t.currentRichText$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:r,column:i};this.fireEvent(this.Event.CellHover,c)})})),l.add(this.registerEventHandler(this.Event.CellPointerDown,()=>{var e;return(e=t.currentPointerDownCell$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:r,column:i};this.fireEvent(this.Event.CellPointerDown,c)})})),l.add(this.registerEventHandler(this.Event.CellPointerUp,()=>{var e;return(e=t.currentPointerUpCell$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:r,column:i};this.fireEvent(this.Event.CellPointerUp,c)})})),l.add(this.registerEventHandler(this.Event.CellPointerMove,()=>{var e;return(e=t.currentCellPosWithEvent$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,row:r,column:i};this.fireEvent(this.Event.CellPointerMove,c)})})),l.add(this.registerEventHandler(this.Event.DragOver,()=>{var e;return(e=n.currentCell$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e.location,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,...e,row:r,column:i};this.fireEvent(this.Event.DragOver,c)})})),l.add(this.registerEventHandler(this.Event.Drop,()=>{var e;return(e=n.endCell$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,row:r,col:i}=e.location,a=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!a)return;let{workbook:o,worksheet:s}=a,c={workbook:o,worksheet:s,...e,row:r,column:i};this.fireEvent(this.Event.Drop,c)})})),l.add(this.registerEventHandler(this.Event.RowHeaderClick,()=>{var e;return(e=t.currentRowHeaderClick$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r};this.fireEvent(this.Event.RowHeaderClick,s)})})),l.add(this.registerEventHandler(this.Event.RowHeaderPointerDown,()=>{var e;return(e=t.currentRowHeaderPointerDown$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r};this.fireEvent(this.Event.RowHeaderPointerDown,s)})})),l.add(this.registerEventHandler(this.Event.RowHeaderPointerUp,()=>{var e;return(e=t.currentRowHeaderPointerUp$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r};this.fireEvent(this.Event.RowHeaderPointerUp,s)})})),l.add(this.registerEventHandler(this.Event.RowHeaderHover,()=>{var e;return(e=t.currentHoveredRowHeader$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,row:r};this.fireEvent(this.Event.RowHeaderHover,s)})})),l.add(this.registerEventHandler(this.Event.ColumnHeaderClick,()=>{var e;return(e=t.currentColHeaderClick$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,column:r};this.fireEvent(this.Event.ColumnHeaderClick,s)})})),l.add(this.registerEventHandler(this.Event.ColumnHeaderPointerDown,()=>{var e;return(e=t.currentColHeaderPointerDown$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,column:r};this.fireEvent(this.Event.ColumnHeaderPointerDown,s)})})),l.add(this.registerEventHandler(this.Event.ColumnHeaderPointerUp,()=>{var e;return(e=t.currentColHeaderPointerUp$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,column:r};this.fireEvent(this.Event.ColumnHeaderPointerUp,s)})})),l.add(this.registerEventHandler(this.Event.ColumnHeaderHover,()=>{var e;return(e=t.currentHoveredColHeader$)==null?void 0:e.pipe((0,c.filter)(e=>!!e)).subscribe(e=>{let{unitId:t,subUnitId:n,index:r}=e,i=this.getSheetCommandTarget({unitId:t,subUnitId:n});if(!i)return;let{workbook:a,worksheet:o}=i,s={workbook:a,worksheet:o,column:r};this.fireEvent(this.Event.ColumnHeaderHover,s)})})),this.disposeWithMe(l)},d=s.getAllUnitsForType(t.UniverInstanceType.UNIVER_SHEET).length>0?(0,c.of)(!0):s.getTypeOfUnitAdded$(t.UniverInstanceType.UNIVER_SHEET).pipe((0,c.take)(1));this.disposeWithMe((0,c.combineLatest)([d,r.lifecycle$]).pipe((0,c.filter)(([,e])=>e>=t.LifecycleStages.Rendered),(0,c.take)(1)).subscribe(()=>u()));let f,p=(0,c.combineLatest)([n.created$,r.lifecycle$]),m=new t.DisposableCollection;this.disposeWithMe(p.subscribe(([e,n])=>{if(e.type===t.UniverInstanceType.UNIVER_SHEET&&(f=e),n<=t.LifecycleStages.Rendered||!f)return;let r=this.getWorkbook(f.unitId);if(!r)return;m.dispose();let i=f.with(o.SheetScrollManagerService),s=this._tryGetRenderDependency(f,a.SheetsSelectionsService);m.add(this.registerEventHandler(this.Event.Scroll,()=>i.validViewportScrollInfo$.subscribe(e=>{if(!e)return;let t={workbook:r,worksheet:r.getActiveSheet(),...e};this.fireEvent(this.Event.Scroll,t)}))),s&&(m.add(this.registerEventHandler(this.Event.SelectionMoveStart,()=>s.selectionMoveStart$.subscribe(e=>{let t={workbook:r,worksheet:r.getActiveSheet(),selections:(e==null?void 0:e.map(e=>e.range))??[]};this.fireEvent(this.Event.SelectionMoveStart,t)}))),m.add(this.registerEventHandler(this.Event.SelectionMoving,()=>s.selectionMoving$.subscribe(e=>{let t={workbook:r,worksheet:r.getActiveSheet(),selections:(e==null?void 0:e.map(e=>e.range))??[]};this.fireEvent(this.Event.SelectionMoving,t)}))),m.add(this.registerEventHandler(this.Event.SelectionMoveEnd,()=>s.selectionMoveEnd$.subscribe(e=>{let t={workbook:r,worksheet:r.getActiveSheet(),selections:(e==null?void 0:e.map(e=>e.range))??[]};this.fireEvent(this.Event.SelectionMoveEnd,t)}))),m.add(this.registerEventHandler(this.Event.SelectionChanged,()=>s.selectionChanged$.subscribe(e=>{let t={workbook:r,worksheet:r.getActiveSheet(),selections:(e==null?void 0:e.map(e=>e.range))??[]};this.fireEvent(this.Event.SelectionChanged,t)})))),f=null,this.disposeWithMe(m)}))}_tryGetRenderDependency(e,t){try{return e.with(t)}catch(e){if(e instanceof Error&&(e.message.includes(`DependencyNotFoundError`)||e.message.includes(`Cannot find`)))return null;throw e}}_initialize(e){this._initSheetUIEvent(e),this._initObserverListener(e);let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeClipboardChange,()=>n.beforeCommandExecuted(e=>{switch(e.id){case s.CopyCommand.id:case s.CutCommand.id:this._beforeClipboardChange()}}))),this.disposeWithMe(this.registerEventHandler(this.Event.ClipboardChanged,()=>n.onCommandExecuted(e=>{switch(e.id){case s.CopyCommand.id:case s.CutCommand.id:this._clipboardChanged()}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeClipboardPaste,()=>n.beforeCommandExecuted(e=>{switch(e.id){case o.SheetPasteShortKeyCommand.id:this._beforeClipboardPaste(e.params);break;case s.PasteCommand.id:this._beforeClipboardPasteAsync()}}))),this.disposeWithMe(this.registerEventHandler(this.Event.ClipboardPasted,()=>n.onCommandExecuted(e=>{switch(e.id){case o.SheetPasteShortKeyCommand.id:this._clipboardPaste(e.params);break;case s.PasteCommand.id:this._clipboardPasteAsync()}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetSkeletonChanged,()=>n.onCommandExecuted(e=>{if(a.COMMAND_LISTENER_SKELETON_CHANGE.indexOf(e.id)>-1){let t=this.getActiveSheet();if(!t)return;let n=(0,a.getSkeletonChangedEffectedRange)(e,t.worksheet.getMaxColumns()).map(e=>{var t;return(t=this.getWorkbook(e.unitId))==null||(t=t.getSheetBySheetId(e.subUnitId))==null?void 0:t.getRange(e.range)}).filter(Boolean);if(!n.length)return;let r={workbook:t.workbook,worksheet:t.worksheet,payload:e,skeleton:t.worksheet.getSkeleton(),effectedRanges:n};this.fireEvent(this.Event.SheetSkeletonChanged,r)}})))}_generateClipboardCopyParam(){let e=this.getActiveWorkbook(),t=e==null?void 0:e.getActiveSheet(),n=e==null?void 0:e.getActiveRange();if(!e||!t||!n)return;let r=this._injector.get(o.ISheetClipboardService).generateCopyContent(e.getId(),t.getSheetId(),n.getRange());if(!r)return;let{html:i,plain:a}=r;return{workbook:e,worksheet:t,text:a,html:i,fromSheet:t,fromRange:n}}_beforeClipboardChange(){let e=this._generateClipboardCopyParam();if(e&&(this.fireEvent(this.Event.BeforeClipboardChange,e),e.cancel))throw new t.CanceledError}_clipboardChanged(){let e=this._generateClipboardCopyParam();e&&this.fireEvent(this.Event.ClipboardChanged,e)}_generateClipboardPasteParam(e){if(!e)return;let{htmlContent:t,textContent:n}=e,r=this.getActiveWorkbook(),i=r==null?void 0:r.getActiveSheet();if(r&&i)return{workbook:r,worksheet:i,text:n,html:t}}async _generateClipboardPasteParamAsync(){let e=this.getActiveWorkbook(),t=e==null?void 0:e.getActiveSheet();if(!e||!t)return;let n=(await this._injector.get(s.IClipboardInterfaceService).read())[0],r;if(n){let i=n.types;r={workbook:e,worksheet:t,text:i.indexOf(s.PLAIN_TEXT_CLIPBOARD_MIME_TYPE)===-1?``:await n.getType(s.PLAIN_TEXT_CLIPBOARD_MIME_TYPE).then(e=>e&&e.text()),html:i.indexOf(s.HTML_CLIPBOARD_MIME_TYPE)===-1?``:await n.getType(s.HTML_CLIPBOARD_MIME_TYPE).then(e=>e&&e.text())}}return r}_beforeClipboardPaste(e){let n=this._generateClipboardPasteParam(e);if(n&&(this.fireEvent(this.Event.BeforeClipboardPaste,n),n.cancel))throw new t.CanceledError}_clipboardPaste(e){let n=this._generateClipboardPasteParam(e);if(n&&(this.fireEvent(this.Event.ClipboardPasted,n),n.cancel))throw new t.CanceledError}async _beforeClipboardPasteAsync(){if(!(0,s.supportClipboardAPI)()){this._injector.get(t.ILogService).warn(`[Facade]: The navigator object only supports the browser environment`);return}let e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.BeforeClipboardPaste,e),e.cancel))throw new t.CanceledError}async _clipboardPasteAsync(){if(!(0,s.supportClipboardAPI)()){this._injector.get(t.ILogService).warn(`[Facade]: The navigator object only supports the browser environment`);return}let e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.ClipboardPasted,e),e.cancel))throw new t.CanceledError}registerSheetRowHeaderExtension(e,...n){let r=this._getSheetRenderComponent(e,o.SHEET_VIEW_KEY.ROW),i=r.register(...n);return(0,t.toDisposable)(()=>{i.dispose(),r.makeDirty(!0)})}registerSheetColumnHeaderExtension(e,...n){let r=this._getSheetRenderComponent(e,o.SHEET_VIEW_KEY.COLUMN),i=r.register(...n);return(0,t.toDisposable)(()=>{i.dispose(),r.makeDirty(!0)})}registerSheetMainExtension(e,...n){let r=this._getSheetRenderComponent(e,o.SHEET_VIEW_KEY.MAIN),i=r.register(...n);return(0,t.toDisposable)(()=>{i.dispose(),r.makeDirty(!0)})}registerCellCustomRender(e,n=t.InterceptorEffectEnum.Style,r){return this._injector.get(a.SheetInterceptorService).intercept(a.INTERCEPTOR_POINT.CELL_CONTENT,{effect:n,handler:(t,n,r)=>(t&&!t.customRender&&e&&(t.customRender=[...e]),r(t)),priority:r})}_getSheetRenderComponent(e,t){let n=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,a=r.get(t);if(!a)throw Error(`Render component not found`);return a}pasteIntoSheet(e,t,n){return this._commandService.executeCommand(o.SheetPasteShortKeyCommand.id,{htmlContent:e,textContent:t,files:n})}setProtectedRangeShadowStrategy(e){this._injector.get(o.SheetPermissionRenderManagerService).setProtectedRangeShadowStrategy(e)}getProtectedRangeShadowStrategy(){return this._injector.get(o.SheetPermissionRenderManagerService).getProtectedRangeShadowStrategy()}getProtectedRangeShadowStrategy$(){return this._injector.get(o.SheetPermissionRenderManagerService).getProtectedRangeShadowStrategy$()}setPermissionDialogVisible(e){this._injector.get(t.IPermissionService).setShowComponents(e)}};n.FUniver.extend(u);var d=class extends l.FWorkbook{customizeColumnHeader(e){let t=this._workbook.getUnitId();this._getSheetRenderComponent(t,o.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e)}customizeRowHeader(e){let t=this._workbook.getUnitId();this._getSheetRenderComponent(t,o.SHEET_VIEW_KEY.ROW).setCustomHeader(e)}_getSheetRenderComponent(e,t){let n=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,a=r.get(t);if(!a)throw Error(`Render component not found`);return a}_logDeprecation(e){this._injector.get(t.ILogService).warn(`[FWorkbook]`,`${e} is deprecated. Please use the function of the same name on "FUniver".`)}startEditing(){let e=this._injector.get(t.ICommandService);return this._injector.get(o.IEditorBridgeService).isVisible().visible?!0:e.syncExecuteCommand(o.SetCellEditVisibleOperation.id,{eventType:i.DeviceInputEventType.Dblclick,unitId:this._workbook.getUnitId(),visible:!0})}async endEditingAsync(e=!0){let n=this._injector.get(t.ICommandService);return this._injector.get(o.IEditorBridgeService).isVisible().visible&&n.syncExecuteCommand(o.SetCellEditVisibleOperation.id,{eventType:i.DeviceInputEventType.Keyboard,keycode:e?s.KeyCode.ENTER:s.KeyCode.ESC,visible:!1,unitId:this._workbook.getUnitId()}),await(0,t.awaitTime)(0),!0}abortEditingAsync(){return this.endEditingAsync(!1)}isCellEditing(){return this._injector.get(o.IEditorBridgeService).isVisible().visible}getScrollStateBySheetId(e){let t=this._workbook.getUnitId(),n=this._injector.get(i.IRenderManagerService).getRenderUnitById(t);return n?n.with(o.SheetScrollManagerService).getScrollStateByParam({unitId:t,sheetId:e}):null}disableSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);return t&&t.with(o.ISheetSelectionRenderService).disableSelection(),this}enableSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);return t&&t.with(o.ISheetSelectionRenderService).enableSelection(),this}transparentSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);return t&&t.with(o.ISheetSelectionRenderService).transparentSelection(),this}showSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);return t&&t.with(o.ISheetSelectionRenderService).showSelection(),this}};l.FWorkbook.extend(d);var f=class extends l.FWorksheet{refreshCanvas(){let e=this._injector.get(i.IRenderManagerService),t=this._fWorkbook.id,n=e.getRenderUnitById(t);if(!n)throw Error(`Render Unit with unitId ${t} not found`);return n.with(o.SheetSkeletonManagerService).reCalculate(),n.components.forEach(e=>{var t;(t=e.makeDirty)==null||t.call(e)}),this}highlightRanges(e,n,r){let i=this._injector.get(o.IMarkSelectionService),a=[];for(let t of e){let e=t.getRange(),o=i.addShapeWithNoFresh({range:e,style:n,primary:r});o&&a.push(o)}if(i.refreshShapes(),a.length===0)throw Error(`Failed to highlight current range`);return(0,t.toDisposable)(()=>{a.forEach(e=>{i.removeShape(e)})})}zoom(e){let n=this._injector.get(t.ICommandService),r=Math.min(Math.max(e,.1),4);return n.executeCommand(o.SetZoomRatioCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),zoomRatio:r}),this}getZoom(){return this._worksheet.getZoomRatio()}getVisibleRange(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);if(!t)return null;let n=t.with(o.SheetSkeletonManagerService).getCurrentSkeleton();return n?n.getVisibleRangeByViewport(i.SHEET_VIEWPORT_KEY.VIEW_MAIN):null}getVisibleRangesOfAllViewports(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);if(!t)return null;let n=t.with(o.SheetSkeletonManagerService).getCurrentSkeleton();return n?n.getVisibleRanges():null}scrollToCell(e,t,n){let r=this._workbook.getUnitId(),a=this._injector.get(i.IRenderManagerService).getRenderUnitById(r);return a&&(a==null?void 0:a.with(o.SheetsScrollRenderController)).scrollToCell(e,t,n),this}getScrollState(){let e={offsetX:0,offsetY:0,sheetViewStartColumn:0,sheetViewStartRow:0},t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),r=this._injector.get(i.IRenderManagerService).getRenderUnitById(t);return r&&r.with(o.SheetScrollManagerService).getScrollStateByParam({unitId:t,sheetId:n})||e}getSkeleton(){var e;let t=(e=this._injector.get(i.IRenderManagerService).getRenderUnitById(this._workbook.getUnitId()))==null?void 0:e.with(o.SheetSkeletonManagerService);return t==null?void 0:t.getSkeleton(this._worksheet.getSheetId())}autoResizeColumns(e,t=1){let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(o.SetWorksheetColAutoWidthCommand.id,{unitId:n,subUnitId:r,ranges:i}),this}autoResizeRows(e,t=1){let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:n,subUnitId:r,ranges:i}),this}customizeColumnHeader(e){var t;let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),a=this._injector.get(i.IRenderManagerService).getRenderUnitById(n);if(a&&(t=e.headerStyle)!=null&&t.size){var s;a.with(o.SheetSkeletonManagerService).setColumnHeaderSize(a,r,(s=e.headerStyle)==null?void 0:s.size)}this._getSheetRenderComponent(n,o.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e,r)}customizeRowHeader(e){var t;let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),a=this._injector.get(i.IRenderManagerService).getRenderUnitById(n);if(a&&(t=e.headerStyle)!=null&&t.size){var s;a.with(o.SheetSkeletonManagerService).setRowHeaderSize(a,r,(s=e.headerStyle)==null?void 0:s.size)}this._getSheetRenderComponent(n,o.SHEET_VIEW_KEY.ROW).setCustomHeader(e,r)}setColumnHeaderHeight(e){let t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.executeCommand(o.SetColumnHeaderHeightCommand.id,{unitId:t,subUnitId:n,size:e}),this}setRowHeaderWidth(e){let t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.executeCommand(o.SetRowHeaderWidthCommand.id,{unitId:t,subUnitId:n,size:e}),this}_getSheetRenderComponent(e,t){let n=this._injector.get(i.IRenderManagerService).getRenderUnitById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,a=r.get(t);if(!a)throw Error(`Render component not found`);return a}};l.FWorksheet.extend(f);var p=class extends n.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`CellClicked`}get CellHover(){return`CellHover`}get CellPointerDown(){return`CellPointerDown`}get CellPointerUp(){return`CellPointerUp`}get CellPointerMove(){return`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`}};n.FEventName.extend(p);var m=class extends n.FEnum{get SHEET_VIEWPORT_KEY(){return i.SHEET_VIEWPORT_KEY}};n.FEnum.extend(m);var h=class extends l.FRange{getCell(){var e;let n=this._injector.get(i.IRenderManagerService),r=this._injector.get(t.ILogService),a=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),c=n.getRenderUnitById(a),l=c==null||(e=c.with(o.SheetSkeletonManagerService).getSkeletonParam(s))==null?void 0:e.skeleton;if(!l)throw r.error("[Facade]: `FRange.getCell` can only be called in current worksheet"),Error("`FRange.getCell` can only be called in current worksheet");return l.getCellWithCoordByIndex(this._range.startRow,this._range.startColumn)}getCellRect(){let{startX:e,startY:t,endX:n,endY:r}=this.getCell(),i={x:e,y:t,width:n-e,height:r-t,top:t,left:e,bottom:r,right:n};return{...i,toJSON:()=>JSON.stringify(i)}}generateHTML(){let e=this._injector.get(o.ISheetClipboardService).generateCopyContent(this._workbook.getUnitId(),this._worksheet.getSheetId(),this._range);return(e==null?void 0:e.html)??``}attachPopup(e){e.direction=e.direction??`horizontal`,e.extraProps=e.extraProps??{},e.offset=e.offset??[0,0];let{key:t,disposableCollection:n}=g(e,this._injector.get(s.ComponentManager)),r=this._injector.get(o.SheetCanvasPopManagerService).attachPopupToCell(this._range.startRow,this._range.startColumn,{...e,componentKey:t},this.getUnitId(),this._worksheet.getSheetId());return r?(n.add(r),n):(n.dispose(),null)}attachAlertPopup(e){let t=this._injector.get(o.CellAlertManagerService),n={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:n}),{dispose:()=>{t.removeAlert(e.key)}}}attachRangePopup(e){e.direction=e.direction??`top-center`,e.extraProps=e.extraProps??{},e.offset=e.offset??[0,0];let{key:t,disposableCollection:n}=g(e,this._injector.get(s.ComponentManager)),r=this._injector.get(o.SheetCanvasPopManagerService).attachRangePopup(this._range,{...e,componentKey:t},this.getUnitId(),this._worksheet.getSheetId());return r?(n.add(r),n):(n.dispose(),null)}highlight(e,n){let r=this._injector.get(o.IMarkSelectionService),i=r.addShape({range:this._range,style:e,primary:n});if(!i)throw Error(`Failed to highlight current range`);return(0,t.toDisposable)(()=>{r.removeShape(i)})}showDropdown(e){return this._injector.get(o.ISheetCellDropdownManagerService).showDropdown(e)}};l.FRange.extend(h);function g(e,n){let{componentKey:r,framework:i}=e,a,o=new t.DisposableCollection;if(typeof r==`string`)a=r;else{let e=i??`react`;a=e===`web-component`?`external-${(0,t.generateRandomId)(6).toLowerCase()}`:`External_${(0,t.generateRandomId)(6)}`,o.add(n.register(a,r,{framework:e}))}return{key:a,disposableCollection:o}}e.FSheetsUIEnumMixin=m,e.transformComponentKey=g});
|