@univerjs/sheets 0.5.2 → 0.5.3-experimental.20250106-e3b7a39
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 +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/es/facade.js +747 -497
- package/lib/es/index.js +5559 -4090
- package/lib/types/basics/interfaces/mutation-interface.d.ts +7 -0
- package/lib/types/commands/commands/__tests__/range-template-command.sepc.d.ts +16 -0
- package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +1 -1
- package/lib/types/commands/commands/add-worksheet-range-theme.command.d.ts +2 -0
- package/lib/types/commands/commands/delete-worksheet-range-theme.command.d.ts +2 -0
- package/lib/types/commands/commands/insert-row-col.command.d.ts +2 -0
- package/lib/types/commands/commands/register-range-theme.command.d.ts +7 -0
- package/lib/types/commands/commands/remove-row-col.command.d.ts +12 -0
- package/lib/types/commands/commands/unregister-range-theme.command.d.ts +6 -0
- package/lib/types/commands/mutations/add-worksheet-range-theme.mutation.d.ts +9 -0
- package/lib/types/commands/mutations/delete-worksheet-range-theme.mutation.d.ts +9 -0
- package/lib/types/commands/mutations/register-range-theme.mutation.d.ts +8 -0
- package/lib/types/commands/mutations/unregister-range-theme-style.mutation.d.ts +6 -0
- package/lib/types/controllers/permission/sheet-permission-check.controller.d.ts +33 -0
- package/lib/types/controllers/permission/sheet-permission-init.controller.d.ts +29 -0
- package/lib/types/controllers/permission/sheet-permission-view-model.controller.d.ts +13 -0
- package/lib/types/facade/f-defined-name.d.ts +61 -61
- package/lib/types/facade/f-event.d.ts +30 -0
- package/lib/types/facade/f-permission.d.ts +0 -6
- package/lib/types/facade/f-range.d.ts +121 -36
- package/lib/types/facade/f-selection.d.ts +1 -1
- package/lib/types/facade/f-univer.d.ts +22 -6
- package/lib/types/facade/f-workbook.d.ts +78 -31
- package/lib/types/facade/f-worksheet.d.ts +130 -117
- package/lib/types/facade/index.d.ts +2 -1
- package/lib/types/facade/utils.d.ts +38 -2
- package/lib/types/index.d.ts +17 -3
- package/lib/types/model/range-theme-model.d.ts +66 -0
- package/lib/types/model/range-theme-util.d.ts +97 -0
- package/lib/types/model/range-themes/build-in-theme.factory.d.ts +5 -0
- package/lib/types/model/range-themes/default.d.ts +2 -0
- package/lib/types/services/range-theme-service.d.ts +34 -0
- package/lib/types/services/sheet-interceptor/interceptor-const.d.ts +2 -0
- package/lib/types/services/sheet-interceptor/sheet-interceptor.service.d.ts +5 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +8 -31
- package/LICENSE +0 -176
|
@@ -1,24 +1,60 @@
|
|
|
1
1
|
import { CellValue, ICellData, IObjectMatrixPrimitiveType, IRange, IRangeWithCoord, Worksheet, HorizontalAlign, VerticalAlign } from '@univerjs/core';
|
|
2
2
|
export type FHorizontalAlignment = 'left' | 'center' | 'normal';
|
|
3
3
|
export type FVerticalAlignment = 'top' | 'middle' | 'bottom';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param value
|
|
7
|
+
*/
|
|
4
8
|
export declare function transformFacadeHorizontalAlignment(value: FHorizontalAlignment): HorizontalAlign;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param value
|
|
12
|
+
*/
|
|
5
13
|
export declare function transformCoreHorizontalAlignment(value: HorizontalAlign): FHorizontalAlignment;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param value
|
|
17
|
+
*/
|
|
6
18
|
export declare function transformFacadeVerticalAlignment(value: FVerticalAlignment): VerticalAlign;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param value
|
|
22
|
+
*/
|
|
7
23
|
export declare function transformCoreVerticalAlignment(value: VerticalAlign): FVerticalAlignment;
|
|
8
24
|
/**
|
|
9
|
-
*
|
|
25
|
+
* Covert cell value to cell data.
|
|
10
26
|
* @param value
|
|
11
27
|
* @returns
|
|
12
28
|
*/
|
|
13
29
|
export declare function covertCellValue(value: CellValue | ICellData): ICellData;
|
|
14
30
|
/**
|
|
15
|
-
*
|
|
31
|
+
* Covert cell value array or matrix to cell data.
|
|
16
32
|
* @param value
|
|
17
33
|
* @param range
|
|
18
34
|
* @returns
|
|
19
35
|
*/
|
|
20
36
|
export declare function covertCellValues(value: CellValue[][] | IObjectMatrixPrimitiveType<CellValue> | ICellData[][] | IObjectMatrixPrimitiveType<ICellData>, range: IRange): IObjectMatrixPrimitiveType<ICellData>;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param mergeInfo
|
|
40
|
+
* @param range
|
|
41
|
+
*/
|
|
21
42
|
export declare function isCellMerged(mergeInfo: IRangeWithCoord, range: IRange): boolean;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param mergeInfo
|
|
46
|
+
* @param range
|
|
47
|
+
*/
|
|
22
48
|
export declare function isSingleCell(mergeInfo: IRangeWithCoord, range: IRange): boolean;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param range
|
|
52
|
+
* @param worksheet
|
|
53
|
+
*/
|
|
23
54
|
export declare function covertToRowRange(range: IRange, worksheet: Worksheet): IRange;
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param range
|
|
58
|
+
* @param worksheet
|
|
59
|
+
*/
|
|
24
60
|
export declare function covertToColRange(range: IRange, worksheet: Worksheet): IRange;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export { UniverSheetsPlugin } from './sheets-plugin';
|
|
17
17
|
export { COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE } from './basics/const/command-listener-const';
|
|
18
|
-
export { type IAddWorksheetMergeMutationParams, type IDeleteRangeMutationParams, type IInsertColMutationParams, type IInsertRangeMutationParams, type IInsertRowMutationParams, type IInsertSheetMutationParams, type IRemoveColMutationParams, type IRemoveRowsMutationParams, type IRemoveSheetMutationParams, type IRemoveWorksheetMergeMutationParams, } from './basics/interfaces/mutation-interface';
|
|
18
|
+
export { type IAddWorksheetMergeMutationParams, type IDeleteRangeMutationParams, type IInsertColMutationParams, type IInsertRangeMutationParams, type IInsertRowMutationParams, type IInsertSheetMutationParams, type IRemoveColMutationParams, type IRemoveRowsMutationParams, type IRemoveSheetMutationParams, type IRemoveWorksheetMergeMutationParams, type IWorksheetRangeThemeStyleMutationParams, } from './basics/interfaces/mutation-interface';
|
|
19
19
|
export { convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, type ISelectionStyle, type ISelectionWidgetConfig, type ISelectionWithCoord, type ISelectionWithStyle, type ISheetRangeLocation, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, } from './basics/selection';
|
|
20
20
|
export { createTopMatrixFromMatrix, createTopMatrixFromRanges, findAllRectangle, rangeMerge, RangeMergeUtil } from './basics/rangeMerge';
|
|
21
21
|
export { type IUniverSheetsConfig } from './controllers/config.schema';
|
|
22
22
|
export { MAX_CELL_PER_SHEET_KEY } from './controllers/config/config';
|
|
23
23
|
export { BorderStyleManagerService, type IBorderInfo } from './services/border-style-manager.service';
|
|
24
|
+
export { SheetRangeThemeService } from './services/range-theme-service';
|
|
24
25
|
export * from './services/permission/permission-point';
|
|
25
26
|
export { WorksheetPermissionService } from './services/permission/worksheet-permission/worksheet-permission.service';
|
|
26
27
|
export { WorkbookPermissionService } from './services/permission/workbook-permission/workbook-permission.service';
|
|
@@ -48,6 +49,8 @@ export { getNextPrimaryCell } from './services/selections/move-active-cell-util'
|
|
|
48
49
|
export { ExclusiveRangeService, IExclusiveRangeService } from './services/exclusive-range/exclusive-range-service';
|
|
49
50
|
export { defaultWorksheetPermissionPoint, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel } from './services/permission';
|
|
50
51
|
export type { IWorksheetProtectionRule } from './services/permission/type';
|
|
52
|
+
export { SheetPermissionCheckController } from './controllers/permission/sheet-permission-check.controller';
|
|
53
|
+
export { SheetPermissionInitController } from './controllers/permission/sheet-permission-init.controller';
|
|
51
54
|
export { WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from './services/permission/worksheet-permission';
|
|
52
55
|
export { defaultWorkbookPermissionPoints, getAllWorkbookPermissionPoint } from './services/permission/workbook-permission';
|
|
53
56
|
export { WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookHistoryPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPivotTablePermission, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, } from './services/permission/permission-point';
|
|
@@ -76,11 +79,14 @@ export { getInsertRangeMutations, getRemoveRangeMutations } from './commands/uti
|
|
|
76
79
|
export { handleInsertRangeMutation } from './commands/utils/handle-range-mutation';
|
|
77
80
|
export { type ISheetCommandSharedParams } from './commands/utils/interface';
|
|
78
81
|
export { copyRangeStyles } from './commands/commands/utils/selection-utils';
|
|
82
|
+
export { RangeThemeStyle } from './model/range-theme-util';
|
|
79
83
|
export { AddRangeProtectionCommand, type IAddRangeProtectionCommandParams } from './commands/commands/add-range-protection.command';
|
|
80
84
|
export { AddWorksheetProtectionCommand } from './commands/commands/add-worksheet-protection.command';
|
|
81
85
|
export { SetWorksheetProtectionCommand } from './commands/commands/set-worksheet-protection.command';
|
|
82
86
|
export { DeleteWorksheetProtectionCommand } from './commands/commands/delete-worksheet-protection.command';
|
|
83
87
|
export { addMergeCellsUtil, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeVerticalCommand, } from './commands/commands/add-worksheet-merge.command';
|
|
88
|
+
export { SetWorksheetRangeThemeStyleCommand } from './commands/commands/add-worksheet-range-theme.command';
|
|
89
|
+
export { DeleteWorksheetRangeThemeStyleCommand } from './commands/commands/delete-worksheet-range-theme.command';
|
|
84
90
|
export { ClearSelectionAllCommand } from './commands/commands/clear-selection-all.command';
|
|
85
91
|
export { ClearSelectionContentCommand } from './commands/commands/clear-selection-content.command';
|
|
86
92
|
export { ClearSelectionFormatCommand } from './commands/commands/clear-selection-format.command';
|
|
@@ -98,12 +104,12 @@ export { type ISetRowDataMutationParams, SetRowDataMutation, SetRowDataMutationF
|
|
|
98
104
|
export { type ISetRowDataCommandParams, SetRowDataCommand } from './commands/commands/set-row-data.command';
|
|
99
105
|
export { type ISetColDataMutationParams, SetColDataMutation, SetColDataMutationFactory } from './commands/mutations/set-col-data.mutation';
|
|
100
106
|
export { type ISetColDataCommandParams, SetColDataCommand } from './commands/commands/set-col-data.command';
|
|
101
|
-
export { type IInsertColCommandParams, type IInsertRowCommandParams, InsertColAfterCommand, InsertColBeforeCommand, InsertColCommand, InsertRowAfterCommand, InsertRowBeforeCommand, InsertRowCommand, } from './commands/commands/insert-row-col.command';
|
|
107
|
+
export { type IInsertColCommandParams, type IInsertRowCommandParams, InsertColAfterCommand, InsertColBeforeCommand, InsertColByRangeCommand, InsertColCommand, InsertRowAfterCommand, InsertRowBeforeCommand, InsertRowByRangeCommand, InsertRowCommand, } from './commands/commands/insert-row-col.command';
|
|
102
108
|
export { type IInsertSheetCommandParams, InsertSheetCommand } from './commands/commands/insert-sheet.command';
|
|
103
109
|
export { getMoveRangeUndoRedoMutations, type IMoveRangeCommandParams, MoveRangeCommand } from './commands/commands/move-range.command';
|
|
104
110
|
export { type IMoveColsCommandParams, type IMoveRowsCommandParams, MoveColsCommand, MoveRowsCommand, } from './commands/commands/move-rows-cols.command';
|
|
105
111
|
export { RemoveDefinedNameCommand } from './commands/commands/remove-defined-name.command';
|
|
106
|
-
export { type IRemoveRowColCommandInterceptParams, type IRemoveRowColCommandParams, RemoveColCommand, RemoveRowCommand } from './commands/commands/remove-row-col.command';
|
|
112
|
+
export { type IRemoveColByRangeCommandParams, type IRemoveRowByRangeCommandParams, type IRemoveRowColCommandInterceptParams, type IRemoveRowColCommandParams, RemoveColByRangeCommand, RemoveColCommand, RemoveRowByRangeCommand, RemoveRowCommand } from './commands/commands/remove-row-col.command';
|
|
107
113
|
export { type IRemoveSheetCommandParams, RemoveSheetCommand } from './commands/commands/remove-sheet.command';
|
|
108
114
|
export { RemoveWorksheetMergeCommand } from './commands/commands/remove-worksheet-merge.command';
|
|
109
115
|
export { type IReorderRangeCommandParams, ReorderRangeCommand } from './commands/commands/reorder-range.command';
|
|
@@ -130,6 +136,12 @@ export { DeltaRowHeightCommand, type IDeltaRowHeightCommand, type ISetWorksheetR
|
|
|
130
136
|
export { SetWorksheetShowCommand } from './commands/commands/set-worksheet-show.command';
|
|
131
137
|
export { SplitTextToColumnsCommand } from './commands/commands/split-text-to-columns.command';
|
|
132
138
|
export type { ISplitTextToColumnsCommandParams } from './commands/commands/split-text-to-columns.command';
|
|
139
|
+
export { UnregisterWorksheetRangeThemeStyleCommand } from './commands/commands/unregister-range-theme.command';
|
|
140
|
+
export type { IUnregisterWorksheetRangeThemeStyleCommandParams } from './commands/commands/unregister-range-theme.command';
|
|
141
|
+
export { RegisterWorksheetRangeThemeStyleCommand } from './commands/commands/register-range-theme.command';
|
|
142
|
+
export type { IRegisterWorksheetRangeThemeStyleCommandParams } from './commands/commands/register-range-theme.command';
|
|
143
|
+
export { type IRegisterWorksheetRangeThemeStyleMutationParams, RegisterWorksheetRangeThemeStyleMutation } from './commands/mutations/register-range-theme.mutation';
|
|
144
|
+
export { type IUnregisterWorksheetRangeThemeStyleMutationParams, UnregisterWorksheetRangeThemeStyleMutation } from './commands/mutations/unregister-range-theme-style.mutation';
|
|
133
145
|
export type { ISetWorksheetShowCommandParams } from './commands/commands/set-worksheet-show.command';
|
|
134
146
|
export { AddRangeProtectionMutation, FactoryAddRangeProtectionMutation, type IAddRangeProtectionMutationParams } from './commands/mutations/add-range-protection.mutation';
|
|
135
147
|
export { SetProtectionCommand } from './commands/commands/set-protection.command';
|
|
@@ -161,6 +173,8 @@ export { type ISetWorksheetColWidthMutationParams, SetWorksheetColWidthMutation,
|
|
|
161
173
|
export { type ISetWorksheetHideMutationParams, SetWorksheetHideMutation } from './commands/mutations/set-worksheet-hide.mutation';
|
|
162
174
|
export { type ISetWorksheetNameMutationParams, SetWorksheetNameMutation } from './commands/mutations/set-worksheet-name.mutation';
|
|
163
175
|
export { type ISetWorksheetOrderMutationParams, SetWorksheetOrderMutation } from './commands/mutations/set-worksheet-order.mutation';
|
|
176
|
+
export { SetWorksheetRangeThemeStyleMutation, SetWorksheetRangeThemeStyleMutationFactory } from './commands/mutations/add-worksheet-range-theme.mutation';
|
|
177
|
+
export { DeleteWorksheetRangeThemeStyleMutation, DeleteWorksheetRangeThemeStyleMutationFactory } from './commands/mutations/delete-worksheet-range-theme.mutation';
|
|
164
178
|
export { SetWorksheetPermissionPointsMutation } from './commands/mutations/set-worksheet-permission-points.mutation';
|
|
165
179
|
export type { ISetWorksheetPermissionPointsMutationParams } from './commands/mutations/set-worksheet-permission-points.mutation';
|
|
166
180
|
export { SetWorksheetProtectionMutation } from './commands/mutations/set-worksheet-protection.mutation';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { IRange, Nullable, Disposable, IResourceManagerService } from '@univerjs/core';
|
|
2
|
+
import { IRangeThemeStyleItem, IRangeThemeStyleJSON, RangeThemeStyle } from './range-theme-util';
|
|
3
|
+
import { SheetInterceptorService } from '../services/sheet-interceptor/sheet-interceptor.service';
|
|
4
|
+
export interface IRangeThemeRangeInfo {
|
|
5
|
+
range: IRange;
|
|
6
|
+
unitId: string;
|
|
7
|
+
subUnitId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IRangeThemeStyleRule {
|
|
10
|
+
rangeInfo: IRangeThemeRangeInfo;
|
|
11
|
+
themeName: string;
|
|
12
|
+
}
|
|
13
|
+
interface ISheetRangeThemeModelJSON {
|
|
14
|
+
rangeThemeStyleRuleMap: Record<string, IRangeThemeStyleRule>;
|
|
15
|
+
rangeThemeStyleMapJson: Record<string, IRangeThemeStyleJSON>;
|
|
16
|
+
}
|
|
17
|
+
export declare class SheetRangeThemeModel extends Disposable {
|
|
18
|
+
private _sheetInterceptorService;
|
|
19
|
+
private _resourceManagerService;
|
|
20
|
+
private _rangeThemeStyleMap;
|
|
21
|
+
private _rangeThemeStyleRuleMap;
|
|
22
|
+
private _rTreeCollection;
|
|
23
|
+
private _defaultRangeThemeMap;
|
|
24
|
+
constructor(_sheetInterceptorService: SheetInterceptorService, _resourceManagerService: IResourceManagerService);
|
|
25
|
+
private _initDefaultTheme;
|
|
26
|
+
private _ensureRangeThemeStyleMap;
|
|
27
|
+
private _ensureRangeThemeStyleRuleMap;
|
|
28
|
+
private _ensureRTreeCollection;
|
|
29
|
+
getDefaultRangeThemeStyle(name: string): RangeThemeStyle;
|
|
30
|
+
/**
|
|
31
|
+
* Register range theme styles
|
|
32
|
+
* @param {string} themeName
|
|
33
|
+
* @param {IRangeThemeRangeInfo} rangeInfo
|
|
34
|
+
*/
|
|
35
|
+
registerRangeThemeRule(themeName: string, rangeInfo: IRangeThemeRangeInfo): void;
|
|
36
|
+
getRegisteredRangeThemeStyle(rangeInfo: IRangeThemeRangeInfo): string | undefined;
|
|
37
|
+
removeRangeThemeRule(themeName: string, rangeInfo: IRangeThemeRangeInfo): void;
|
|
38
|
+
registerDefaultRangeTheme(rangeThemeStyle: RangeThemeStyle): void;
|
|
39
|
+
getRegisteredRangeThemes(): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Register custom range theme style.
|
|
42
|
+
* @param {string} unitId The unit id.
|
|
43
|
+
* @param {RangeThemeStyle} rangeThemeStyle The range theme style.
|
|
44
|
+
*/
|
|
45
|
+
registerRangeThemeStyle(unitId: string, rangeThemeStyle: RangeThemeStyle): void;
|
|
46
|
+
/**
|
|
47
|
+
* Unregister custom range theme style.
|
|
48
|
+
* @param {string} unitId The unit id.
|
|
49
|
+
* @param {string} name The name of the range theme style.
|
|
50
|
+
*/
|
|
51
|
+
unregisterRangeThemeStyle(unitId: string, name: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Gets all custom register themes
|
|
54
|
+
* @return {string[]} The array of all custom registered themes.
|
|
55
|
+
*/
|
|
56
|
+
getALLRegisteredTheme(): string[];
|
|
57
|
+
getRangeThemeStyle(unitId: string, name: string): RangeThemeStyle;
|
|
58
|
+
getCellStyle(unitId: string, subUnitId: string, row: number, col: number): Nullable<IRangeThemeStyleItem>;
|
|
59
|
+
private _registerIntercept;
|
|
60
|
+
toJson(unitId: string): string;
|
|
61
|
+
fromJSON(json: ISheetRangeThemeModelJSON): void;
|
|
62
|
+
deleteUnitId(unitId: string): void;
|
|
63
|
+
private _initSnapshot;
|
|
64
|
+
dispose(): void;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { IStyleData, Nullable } from '@univerjs/core';
|
|
2
|
+
export type IRangeThemeStyleItem = Pick<IStyleData, 'bg' | 'ol' | 'bd' | 'cl' | 'ht' | 'vt' | 'bl'>;
|
|
3
|
+
export interface IRangeThemeStyleJSON {
|
|
4
|
+
name: string;
|
|
5
|
+
wholeStyle?: IRangeThemeStyleItem;
|
|
6
|
+
headerRowStyle?: IRangeThemeStyleItem;
|
|
7
|
+
headerColumnStyle?: IRangeThemeStyleItem;
|
|
8
|
+
firstRowStyle?: IRangeThemeStyleItem;
|
|
9
|
+
secondRowStyle?: IRangeThemeStyleItem;
|
|
10
|
+
lastRowStyle?: IRangeThemeStyleItem;
|
|
11
|
+
firstColumnStyle?: IRangeThemeStyleItem;
|
|
12
|
+
secondColumnStyle?: IRangeThemeStyleItem;
|
|
13
|
+
lastColumnStyle?: IRangeThemeStyleItem;
|
|
14
|
+
}
|
|
15
|
+
export declare function composeStyles(styles: IStyleData[]): IRangeThemeStyleItem;
|
|
16
|
+
/**
|
|
17
|
+
* Range theme style
|
|
18
|
+
* @description The range theme style is used to set the style of the range.This class is used to create a build-in theme style or a custom theme style.
|
|
19
|
+
*/
|
|
20
|
+
export declare class RangeThemeStyle {
|
|
21
|
+
private _name;
|
|
22
|
+
/**
|
|
23
|
+
* @property {Nullable<IRangeThemeStyleItem>} wholeStyle effect for the whole range.
|
|
24
|
+
*/
|
|
25
|
+
wholeStyle: Nullable<IRangeThemeStyleItem>;
|
|
26
|
+
/**
|
|
27
|
+
* @property {Nullable<IRangeThemeStyleItem>} headerRowStyle effect for the header row.
|
|
28
|
+
*/
|
|
29
|
+
headerRowStyle: Nullable<IRangeThemeStyleItem>;
|
|
30
|
+
/**
|
|
31
|
+
* @property {Nullable<IRangeThemeStyleItem>} headerColumnStyle effect for the header column.
|
|
32
|
+
*/
|
|
33
|
+
headerColumnStyle: Nullable<IRangeThemeStyleItem>;
|
|
34
|
+
/**
|
|
35
|
+
* @property {Nullable<IRangeThemeStyleItem>} firstRowStyle effect for the first row.
|
|
36
|
+
*/
|
|
37
|
+
firstRowStyle: Nullable<IRangeThemeStyleItem>;
|
|
38
|
+
/**
|
|
39
|
+
* @property {Nullable<IRangeThemeStyleItem>} secondRowStyle effect for the second row.
|
|
40
|
+
*/
|
|
41
|
+
secondRowStyle: Nullable<IRangeThemeStyleItem>;
|
|
42
|
+
/**
|
|
43
|
+
* @property {Nullable<IRangeThemeStyleItem>} lastRowStyle effect for the last row.
|
|
44
|
+
*/
|
|
45
|
+
lastRowStyle: Nullable<IRangeThemeStyleItem>;
|
|
46
|
+
/**
|
|
47
|
+
* @property {Nullable<IRangeThemeStyleItem>} effect for the first column.
|
|
48
|
+
*/
|
|
49
|
+
firstColumnStyle: Nullable<IRangeThemeStyleItem>;
|
|
50
|
+
/**
|
|
51
|
+
* @property {Nullable<IRangeThemeStyleItem>} effect for the second column.
|
|
52
|
+
*/
|
|
53
|
+
secondColumnStyle: Nullable<IRangeThemeStyleItem>;
|
|
54
|
+
/**
|
|
55
|
+
* @property {Nullable<IRangeThemeStyleItem>} effect for the last column.
|
|
56
|
+
*/
|
|
57
|
+
lastColumnStyle: Nullable<IRangeThemeStyleItem>;
|
|
58
|
+
/**
|
|
59
|
+
* @property {Nullable<IRangeThemeStyleItem>} quickly get merge style
|
|
60
|
+
*/
|
|
61
|
+
private _mergeCacheMap;
|
|
62
|
+
/**
|
|
63
|
+
* @constructor
|
|
64
|
+
* @param {string} name The name of the range theme style, it used to identify the range theme style.
|
|
65
|
+
* @param {IRangeThemeStyleJSON} [options] The options to initialize the range theme style.
|
|
66
|
+
*/
|
|
67
|
+
constructor(name: string, options?: Omit<IRangeThemeStyleJSON, 'name'>);
|
|
68
|
+
/**
|
|
69
|
+
* Gets the name of the range theme style.The name is read only, and use to identifier the range theme style.
|
|
70
|
+
* @returns {string} The name of the range theme style.
|
|
71
|
+
*/
|
|
72
|
+
getName(): string;
|
|
73
|
+
getWholeStyle(): Nullable<IRangeThemeStyleItem>;
|
|
74
|
+
setWholeStyle(style: Nullable<IRangeThemeStyleItem>): void;
|
|
75
|
+
getFirstRowStyle(): Nullable<IRangeThemeStyleItem>;
|
|
76
|
+
setFirstRowStyle(style: Nullable<IRangeThemeStyleItem>): void;
|
|
77
|
+
getSecondRowStyle(): Nullable<IRangeThemeStyleItem>;
|
|
78
|
+
setSecondRowStyle(style: Nullable<IRangeThemeStyleItem>): void;
|
|
79
|
+
getLastRowStyle(): Nullable<IRangeThemeStyleItem>;
|
|
80
|
+
setLastRowStyle(style: Nullable<IRangeThemeStyleItem>): void;
|
|
81
|
+
getFirstColumnStyle(): Nullable<IRangeThemeStyleItem>;
|
|
82
|
+
setFirstColumnStyle(style: Nullable<IRangeThemeStyleItem>): void;
|
|
83
|
+
getSecondColumnStyle(): Nullable<IRangeThemeStyleItem>;
|
|
84
|
+
setSecondColumnStyle(style: Nullable<IRangeThemeStyleItem>): void;
|
|
85
|
+
getLastColumnStyle(): Nullable<IRangeThemeStyleItem>;
|
|
86
|
+
setLastColumnStyle(style: Nullable<IRangeThemeStyleItem>): void;
|
|
87
|
+
getHeaderRowStyle(): Nullable<IRangeThemeStyleItem>;
|
|
88
|
+
setHeaderRowStyle(style: Nullable<IRangeThemeStyleItem>): void;
|
|
89
|
+
getHeaderColumnStyle(): Nullable<IRangeThemeStyleItem>;
|
|
90
|
+
setHeaderColumnStyle(style: Nullable<IRangeThemeStyleItem>): void;
|
|
91
|
+
getStyle(offsetRow: number, offsetCol: number, isLastRow: boolean, isLastCol: boolean): IRangeThemeStyleItem | null;
|
|
92
|
+
private _getMergeStyle;
|
|
93
|
+
private _mergeStyle;
|
|
94
|
+
toJson(): IRangeThemeStyleJSON;
|
|
95
|
+
fromJson(json: IRangeThemeStyleJSON): void;
|
|
96
|
+
dispose(): void;
|
|
97
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RangeThemeStyle } from '../range-theme-util';
|
|
2
|
+
export declare const lightRangeThemeBuilder: (baseName: string, header: string, color: string) => RangeThemeStyle;
|
|
3
|
+
export declare const middleRangeThemeBuilder: (baseName: string, rowHeader: string, colHeader: string) => RangeThemeStyle;
|
|
4
|
+
export declare const darkRangeThemeBuilder: (baseName: string, rowHeader: string, firstRow: string, secondRow: string) => RangeThemeStyle;
|
|
5
|
+
export declare const buildInThemes: RangeThemeStyle[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IRangeThemeRangeInfo, SheetRangeThemeModel } from '../model/range-theme-model';
|
|
2
|
+
import { RangeThemeStyle } from '../model/range-theme-util';
|
|
3
|
+
import { Disposable } from '@univerjs/core';
|
|
4
|
+
export declare class SheetRangeThemeService extends Disposable {
|
|
5
|
+
private _sheetRangeThemeModel;
|
|
6
|
+
constructor(_sheetRangeThemeModel: SheetRangeThemeModel);
|
|
7
|
+
/**
|
|
8
|
+
* Register a custom range theme style.
|
|
9
|
+
* @param {string} unitId Which unit to register the range theme style.
|
|
10
|
+
* @param {RangeThemeStyle} rangeThemeStyle The range theme style to register.
|
|
11
|
+
*/
|
|
12
|
+
registerRangeTheme(unitId: string, rangeThemeStyle: RangeThemeStyle): void;
|
|
13
|
+
/**
|
|
14
|
+
* Get custom register themes name list
|
|
15
|
+
* @returns {string[]} The list of custom register themes name.
|
|
16
|
+
*/
|
|
17
|
+
getALLRegisterThemes(): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Register range theme style to the range.
|
|
20
|
+
* @param {string} themeName The defined theme name.
|
|
21
|
+
* @param {IRangeThemeRangeInfo} rangeInfo The range info to apply the theme style.
|
|
22
|
+
*/
|
|
23
|
+
registerRangeThemeStyle(themeName: string, rangeInfo: IRangeThemeRangeInfo): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get applied range theme style name.
|
|
26
|
+
* @param {IRangeThemeRangeInfo} rangeInfo The range info to get the applied theme style.
|
|
27
|
+
* @returns {string | undefined} The applied theme style name or not exist.
|
|
28
|
+
*/
|
|
29
|
+
getAppliedRangeThemeStyle(rangeInfo: IRangeThemeRangeInfo): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Get registered build-in range theme style
|
|
32
|
+
*/
|
|
33
|
+
getRegisteredRangeThemes(): string[];
|
|
34
|
+
}
|
|
@@ -11,3 +11,5 @@ export declare enum InterceptCellContentPriority {
|
|
|
11
11
|
NUMFMT = 10,
|
|
12
12
|
CELL_IMAGE = 11
|
|
13
13
|
}
|
|
14
|
+
export declare const RangeThemeInterceptorId = "sheet.interceptor.range-theme-id";
|
|
15
|
+
export declare const IgnoreRangeThemeInterceptorKey = "sheet.interceptor.ignore-range-theme";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellData, ICellDataForSheetInterceptor, ICommandInfo, IDisposable, IInterceptor, IRange, IUndoRedoCommandInfosByInterceptor, Nullable, Workbook, Worksheet, Disposable, InterceptorEffectEnum, InterceptorManager, IUniverInstanceService } from '@univerjs/core';
|
|
1
|
+
import { ICellData, ICellDataForSheetInterceptor, ICommandInfo, IComposeInterceptors, IDisposable, IInterceptor, IRange, IUndoRedoCommandInfosByInterceptor, Nullable, Workbook, Worksheet, Disposable, InterceptorEffectEnum, InterceptorManager, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { ISheetLocation } from './utils/interceptor';
|
|
3
3
|
export interface IBeforeCommandInterceptor {
|
|
4
4
|
priority?: number;
|
|
@@ -35,6 +35,8 @@ export declare class SheetInterceptorService extends Disposable {
|
|
|
35
35
|
private _afterCommandInterceptors;
|
|
36
36
|
private readonly _workbookDisposables;
|
|
37
37
|
private readonly _worksheetDisposables;
|
|
38
|
+
private _interceptorsDirty;
|
|
39
|
+
private _composedInterceptorByKey;
|
|
38
40
|
readonly writeCellInterceptor: InterceptorManager<{
|
|
39
41
|
BEFORE_CELL_EDIT: IInterceptor<ICellDataForSheetInterceptor, ISheetLocationForEditor>;
|
|
40
42
|
AFTER_CELL_EDIT: IInterceptor<ICellDataForSheetInterceptor, ISheetLocationForEditor>;
|
|
@@ -61,7 +63,7 @@ export declare class SheetInterceptorService extends Disposable {
|
|
|
61
63
|
interceptAfterCommand(interceptor: ICommandInterceptor): IDisposable;
|
|
62
64
|
afterCommandExecute(info: ICommandInfo): IUndoRedoCommandInfosByInterceptor;
|
|
63
65
|
/**
|
|
64
|
-
* Add a listener function to a specific command to
|
|
66
|
+
* Add a listener function to a specific command to determine if the command can execute mutations. It should be
|
|
65
67
|
* called in controllers.
|
|
66
68
|
*
|
|
67
69
|
* Pairs with {@link beforeCommandExecute}.
|
|
@@ -85,7 +87,7 @@ export declare class SheetInterceptorService extends Disposable {
|
|
|
85
87
|
generateMutationsByRanges(info: IRangesInfo): IUndoRedoCommandInfosByInterceptor;
|
|
86
88
|
onWriteCell(workbook: Workbook, worksheet: Worksheet, row: number, col: number, cellData: ICellData): Promise<Nullable<ICellDataForSheetInterceptor>>;
|
|
87
89
|
intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): IDisposable;
|
|
88
|
-
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>, effect?: InterceptorEffectEnum
|
|
90
|
+
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>, effect?: InterceptorEffectEnum, _key?: string, filter?: (interceptor: IInterceptor<any, any>) => boolean): ReturnType<IComposeInterceptors<T, C>>;
|
|
89
91
|
private _interceptWorkbook;
|
|
90
92
|
private _disposeWorkbookInterceptor;
|
|
91
93
|
private _disposeSheetInterceptor;
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(m,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/sheets"],r):(m=typeof globalThis<"u"?globalThis:m||self,r(m.UniverSheetsFacade={},m.UniverCore,m.UniverEngineFormula,m.UniverSheets))})(this,function(m,r,_,a){"use strict";var re=Object.defineProperty;var se=(m,r,_)=>r in m?re(m,r,{enumerable:!0,configurable:!0,writable:!0,value:_}):m[r]=_;var C=(m,r,_)=>se(m,typeof r!="symbol"?r+"":r,_);var N=Object.defineProperty,E=Object.getOwnPropertyDescriptor,F=(h,i,e,t)=>{for(var n=t>1?void 0:t?E(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&N(i,e,n),n},w=(h,i)=>(e,t)=>i(e,t,h);function j(h,i,e){const t=e.getDefinedNameMap(h);if(t==null)return i.t("definedName.defaultName")+1;const o=Array.from(Object.values(t)).length+1,s=i.t("definedName.defaultName")+o;if(e.getValueByName(h,s)==null)return s;let d=o+1;for(;;){const c=i.t("definedName.defaultName")+d;if(e.getValueByName(h,c)==null)return c;d++}}class I{constructor(){C(this,"_definedNameParam");this._definedNameParam={id:r.generateRandomId(10),unitId:"",name:"",formulaOrRefString:""}}setName(i){return this._definedNameParam.name=i,this}setFormula(i){return this._definedNameParam.formulaOrRefString=`=${i}`,this}setRef(i){return this._definedNameParam.formulaOrRefString=i,this}setRefByRange(i,e,t,n){return this._definedNameParam.formulaOrRefString=_.serializeRange({startRow:i,endRow:i+(t!=null?t:1)-1,startColumn:e,endColumn:e+(n!=null?n:1)-1}),this}setComment(i){return this._definedNameParam.comment=i,this}setHidden(i){return this._definedNameParam.hidden=i,this}build(){return this._definedNameParam}load(i){return this._definedNameParam=i,this}}let f=class extends r.FBase{constructor(h,i,e,t,n,o,s,d,c,u){super(),this._definedNameParam=h,this._injector=i,this._commandService=e,this._permissionService=t,this._worksheetProtectionRuleModel=n,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=s,this._authzIoService=d,this._localeService=c,this._definedNamesService=u}_apply(){this._definedNameParam.name===""&&(this._definedNameParam.name=j(this._definedNameParam.unitId,this._localeService,this._definedNamesService)),this._commandService.syncExecuteCommand(a.SetDefinedNameCommand.id,this._definedNameParam)}getName(){return this._definedNameParam.name}setName(h){this._definedNameParam.name=h,this._apply()}setFormula(h){this._definedNameParam.formulaOrRefString=`=${h}`,this._apply()}setRef(h){this._definedNameParam.formulaOrRefString=h,this._apply()}getFormulaOrRefString(){return this._definedNameParam.formulaOrRefString}setRefByRange(h,i,e,t){this._definedNameParam.formulaOrRefString=_.serializeRange({startRow:h,endRow:h+(e!=null?e:1)-1,startColumn:i,endColumn:i+(t!=null?t:1)-1}),this._apply()}getComment(){return this._definedNameParam.comment}setComment(h){this._definedNameParam.comment=h,this._apply()}setScopeToWorksheet(h){this._definedNameParam.localSheetId=h.getSheetId(),this._apply()}setScopeToWorkbook(){this._definedNameParam.localSheetId=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this._apply()}setHidden(h){this._definedNameParam.hidden=h,this._apply()}delete(){this._commandService.syncExecuteCommand(a.RemoveDefinedNameCommand.id,this._definedNameParam)}getLocalSheetId(){return this._definedNameParam.localSheetId}isWorkbookScope(){return this._definedNameParam.localSheetId===a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME}toBuilder(){const h=this._injector.createInstance(I);return h.load(this._definedNameParam),h}};f=F([w(1,r.Inject(r.Injector)),w(2,r.ICommandService),w(3,r.IPermissionService),w(4,r.Inject(a.WorksheetProtectionRuleModel)),w(5,r.Inject(a.RangeProtectionRuleModel)),w(6,r.Inject(a.WorksheetProtectionPointModel)),w(7,r.Inject(r.IAuthzIoService)),w(8,r.Inject(r.LocaleService)),w(9,_.IDefinedNamesService)],f);var W=Object.defineProperty,A=Object.getOwnPropertyDescriptor,D=(h,i,e,t)=>{for(var n=t>1?void 0:t?A(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&W(i,e,n),n},k=(h,i)=>(e,t)=>i(e,t,h);m.FPermission=class extends r.FBase{constructor(e,t,n,o,s,d,c){super();C(this,"permissionPointsDefinition",a.PermissionPointsDefinitions);this._injector=e,this._commandService=t,this._permissionService=n,this._worksheetProtectionRuleModel=o,this._rangeProtectionRuleModel=s,this._worksheetProtectionPointRuleModel=d,this._authzIoService=c}setWorkbookPermissionPoint(e,t,n){const o=new t(e);this._permissionService.getPermissionPoint(o.id)||this._permissionService.addPermissionPoint(o),this._permissionService.updatePermissionPoint(o.id,n)}setWorkbookEditPermission(e,t){this.setWorkbookPermissionPoint(e,a.WorkbookEditablePermission,t)}async addWorksheetBasePermission(e,t){if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length>0)throw new Error("sheet protection cannot intersect with range protection");const o=await this._authzIoService.create({objectType:a.UnitObject.Worksheet,worksheetObject:{collaborators:[],unitID:e,strategies:[],name:"",scope:void 0}});if(this._commandService.syncExecuteCommand(a.AddWorksheetProtectionMutation.id,{unitId:e,subUnitId:t,rule:{permissionId:o,unitType:a.UnitObject.Worksheet,unitId:e,subUnitId:t}}))return o}removeWorksheetPermission(e,t){this._commandService.syncExecuteCommand(a.DeleteWorksheetProtectionMutation.id,{unitId:e,subUnitId:t}),[...a.getAllWorksheetPermissionPoint(),...a.getAllWorksheetPermissionPointByPointPanel()].forEach(n=>{const o=new n(e,t);this._permissionService.updatePermissionPoint(o.id,!0)}),this._worksheetProtectionPointRuleModel.deleteRule(e,t)}async setWorksheetPermissionPoint(e,t,n,o){const s=this._worksheetProtectionRuleModel.getRule(e,t);let d;if(n===a.WorksheetEditPermission||n===a.WorksheetViewPermission)if(s)d=s.permissionId;else{if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length>0)throw new Error("sheet protection cannot intersect with range protection");d=await this.addWorksheetBasePermission(e,t)}else{const g=this._worksheetProtectionPointRuleModel.getRule(e,t);g?d=g.permissionId:(d=await this._authzIoService.create({objectType:a.UnitObject.Worksheet,worksheetObject:{collaborators:[],unitID:e,strategies:[],name:"",scope:void 0}}),this._commandService.executeCommand(a.SetWorksheetPermissionPointsMutation.id,{unitId:e,subUnitId:t,permissionId:d}))}const u=new n(e,t);return this._permissionService.getPermissionPoint(u.id)||this._permissionService.addPermissionPoint(u),this._permissionService.updatePermissionPoint(u.id,o),d}async addRangeBaseProtection(e,t,n){const o=await this._authzIoService.create({objectType:a.UnitObject.SelectRange,selectRangeObject:{collaborators:[],unitID:e,name:"",scope:void 0}}),s=`ruleId_${r.generateRandomId(6)}`;if(this._worksheetProtectionRuleModel.getRule(e,t))throw new Error("sheet protection cannot intersect with range protection");if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).some(g=>g.ranges.some(U=>n.some(R=>r.Rectangle.intersects(R,U)))))throw new Error("range protection cannot intersect");if(this._commandService.syncExecuteCommand(a.AddRangeProtectionMutation.id,{unitId:e,subUnitId:t,rules:[{permissionId:o,unitType:a.UnitObject.SelectRange,unitId:e,subUnitId:t,ranges:n,id:s}]}))return{permissionId:o,ruleId:s}}removeRangeProtection(e,t,n){this._commandService.syncExecuteCommand(a.DeleteRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleIds:n})&&this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e,t),[...a.getAllWorksheetPermissionPointByPointPanel()].forEach(d=>{const c=new d(e,t);this._permissionService.updatePermissionPoint(c.id,c.value)}))}setRangeProtectionPermissionPoint(e,t,n,o,s){const d=new o(e,t,n);this._permissionService.getPermissionPoint(d.id)||this._permissionService.addPermissionPoint(d),this._permissionService.updatePermissionPoint(d.id,s)}setRangeProtectionRanges(e,t,n,o){const s=this._rangeProtectionRuleModel.getRule(e,t,n);if(s){if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).filter(u=>u.id!==n).some(u=>u.ranges.some(l=>o.some(g=>r.Rectangle.intersects(g,l)))))throw new Error("range protection cannot intersect");this._commandService.syncExecuteCommand(a.SetRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleId:n,rule:{...s,ranges:o}})}}setPermissionDialogVisible(e){this._permissionService.setShowComponents(e)}},m.FPermission=D([k(0,r.Inject(r.Injector)),k(1,r.ICommandService),k(2,r.IPermissionService),k(3,r.Inject(a.WorksheetProtectionRuleModel)),k(4,r.Inject(a.RangeProtectionRuleModel)),k(5,r.Inject(a.WorksheetProtectionPointModel)),k(6,r.Inject(r.IAuthzIoService))],m.FPermission);function O(h){switch(h){case"left":return r.HorizontalAlign.LEFT;case"center":return r.HorizontalAlign.CENTER;case"normal":return r.HorizontalAlign.RIGHT;default:throw new Error(`Invalid horizontal alignment: ${h}`)}}function M(h){switch(h){case r.HorizontalAlign.LEFT:return"left";case r.HorizontalAlign.CENTER:return"center";case r.HorizontalAlign.RIGHT:return"normal";default:throw new Error(`Invalid horizontal alignment: ${h}`)}}function T(h){switch(h){case"top":return r.VerticalAlign.TOP;case"middle":return r.VerticalAlign.MIDDLE;case"bottom":return r.VerticalAlign.BOTTOM;default:throw new Error(`Invalid vertical alignment: ${h}`)}}function x(h){switch(h){case r.VerticalAlign.TOP:return"top";case r.VerticalAlign.MIDDLE:return"middle";case r.VerticalAlign.BOTTOM:return"bottom";default:throw new Error(`Invalid vertical alignment: ${h}`)}}function b(h){return r.isFormulaString(h)?{f:h}:r.isCellV(h)?{v:h}:(r.isICellData(h),h)}function B(h,i){const e=new r.ObjectMatrix,{startRow:t,startColumn:n,endRow:o,endColumn:s}=i;if(r.Tools.isArray(h))for(let d=0;d<=o-t;d++)for(let c=0;c<=s-n;c++)e.setValue(d+t,c+n,b(h[d][c]));else new r.ObjectMatrix(h).forValue((c,u,l)=>{e.setValue(c,u,b(l))});return e.getMatrix()}function P(h,i){return{startRow:h.startRow,endRow:h.endRow,startColumn:0,endColumn:i.getColumnCount()-1,rangeType:r.RANGE_TYPE.ROW}}function y(h,i){return{startRow:0,endRow:i.getRowCount()-1,startColumn:h.startColumn,endColumn:h.endColumn,rangeType:r.RANGE_TYPE.COLUMN}}var L=Object.defineProperty,V=Object.getOwnPropertyDescriptor,z=(h,i,e,t)=>{for(var n=t>1?void 0:t?V(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&L(i,e,n),n},p=(h,i)=>(e,t)=>i(e,t,h);m.FRange=class extends r.FBase{constructor(i,e,t,n,o,s){super(),this._workbook=i,this._worksheet=e,this._range=t,this._injector=n,this._commandService=o,this._formulaDataModel=s}getUnitId(){return this._workbook.getUnitId()}getSheetName(){return this._worksheet.getName()}getRange(){return this._range}getRow(){return this._range.startRow}getColumn(){return this._range.startColumn}getWidth(){return this._range.endColumn-this._range.startColumn+1}getHeight(){return this._range.endRow-this._range.startRow+1}getCellData(){var i;return(i=this._worksheet.getCell(this._range.startRow,this._range.startColumn))!=null?i:null}isMerged(){const{startColumn:i,startRow:e,endColumn:t,endRow:n}=this._range;return this._worksheet.getMergedCellRange(e,i,n,t).some(s=>r.Rectangle.equals(s,this._range))}getCellStyleData(){var t;const i=this.getCellData(),e=this._workbook.getStyles();return i&&e&&(t=e.getStyleByCell(i))!=null?t:null}getValue(){var i,e;return(e=(i=this._worksheet.getCell(this._range.startRow,this._range.startColumn))==null?void 0:i.v)!=null?e:null}getValues(){var s,d;const{startRow:i,endRow:e,startColumn:t,endColumn:n}=this._range,o=[];for(let c=i;c<=e;c++){const u=[];for(let l=t;l<=n;l++)u.push((d=(s=this._worksheet.getCell(c,l))==null?void 0:s.v)!=null?d:null);o.push(u)}return o}getCellDataGrid(){const{startRow:i,endRow:e,startColumn:t,endColumn:n}=this._range,o=[];for(let s=i;s<=e;s++){const d=[];for(let c=t;c<=n;c++)d.push(this._worksheet.getCellRaw(s,c));o.push(d)}return o}getFormulas(){const i=[],{startRow:e,endRow:t,startColumn:n,endColumn:o}=this._range,s=this._worksheet.getSheetId(),d=this._workbook.getUnitId();for(let c=e;c<=t;c++){const u=[];for(let l=n;l<=o;l++){const g=this._formulaDataModel.getFormulaStringByCell(c,l,s,d);u.push(g||"")}i.push(u)}return i}getWrap(){return this._worksheet.getRange(this._range).getWrap()===r.BooleanNumber.TRUE}getWrapStrategy(){return this._worksheet.getRange(this._range).getWrapStrategy()}getHorizontalAlignment(){return M(this._worksheet.getRange(this._range).getHorizontalAlignment())}getVerticalAlignment(){return x(this._worksheet.getRange(this._range).getVerticalAlignment())}setBackgroundColor(i){return this._commandService.executeCommand(a.SetStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:{type:"bg",value:{rgb:i}}})}setBackground(i){return this.setBackgroundColor(i)}setValue(i){const e=b(i);if(!e)throw new Error("Invalid value");return this._commandService.executeCommand(a.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:e})}setWrap(i){return this._commandService.executeCommand(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:i?r.WrapStrategy.WRAP:r.WrapStrategy.UNSPECIFIED})}setWrapStrategy(i){return this._commandService.executeCommand(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:i})}setVerticalAlignment(i){return this._commandService.executeCommand(a.SetVerticalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:T(i)})}setHorizontalAlignment(i){return this._commandService.executeCommand(a.SetHorizontalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:O(i)})}setValues(i){const e=B(i,this._range);return this._commandService.executeCommand(a.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:e})}setFontWeight(i){let e;if(i==="bold")e=r.BooleanNumber.TRUE;else if(i==="normal")e=r.BooleanNumber.FALSE;else if(i===null)e=null;else throw new Error("Invalid fontWeight");const t={type:"bl",value:e},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.executeCommand(a.SetStyleCommand.id,n),this}setFontStyle(i){let e;if(i==="italic")e=r.BooleanNumber.TRUE;else if(i==="normal")e=r.BooleanNumber.FALSE;else if(i===null)e=null;else throw new Error("Invalid fontStyle");const t={type:"it",value:e},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.executeCommand(a.SetStyleCommand.id,n),this}setFontLine(i){if(i==="underline")this._setFontUnderline({s:r.BooleanNumber.TRUE});else if(i==="line-through")this._setFontStrikethrough({s:r.BooleanNumber.TRUE});else if(i==="none")this._setFontUnderline({s:r.BooleanNumber.FALSE}),this._setFontStrikethrough({s:r.BooleanNumber.FALSE});else if(i===null)this._setFontUnderline(null),this._setFontStrikethrough(null);else throw new Error("Invalid fontLine");return this}_setFontUnderline(i){const e={type:"ul",value:i},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.executeCommand(a.SetStyleCommand.id,t)}_setFontStrikethrough(i){const e={type:"st",value:i},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.executeCommand(a.SetStyleCommand.id,t)}setFontFamily(i){const e={type:"ff",value:i},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.executeCommand(a.SetStyleCommand.id,t),this}setFontSize(i){const e={type:"fs",value:i},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.executeCommand(a.SetStyleCommand.id,t),this}setFontColor(i){const t={type:"cl",value:i===null?null:{rgb:i}},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.executeCommand(a.SetStyleCommand.id,n),this}async merge(i=!0){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return await a.addMergeCellsUtil(this._injector,e,t,[this._range],i),this}async mergeAcross(i=!0){const e=a.getAddMergeMutationRangeByType([this._range],r.Dimension.ROWS),t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return await a.addMergeCellsUtil(this._injector,t,n,e,i),this}async mergeVertically(i=!0){const e=a.getAddMergeMutationRangeByType([this._range],r.Dimension.COLUMNS),t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return await a.addMergeCellsUtil(this._injector,t,n,e,i),this}isPartOfMerge(){const{startRow:i,startColumn:e,endRow:t,endColumn:n}=this._range;return this._worksheet.getMergedCellRange(i,e,t,n).length>0}breakApart(){return this._commandService.executeCommand(a.RemoveWorksheetMergeCommand.id,{ranges:[this._range]}),this}forEach(i){const{startColumn:e,startRow:t,endColumn:n,endRow:o}=this._range;this._worksheet.getMatrixWithMergedCells(t,e,o,n).forValue((s,d,c)=>{i(s,d,c)})}getA1Notation(i){return i?_.serializeRangeWithSheet(this._worksheet.getName(),this._range):_.serializeRange(this._range)}activate(){return this._injector.createInstance(m.FWorkbook,this._workbook).setActiveRange(this),this}activateAsCurrentCell(){const i=this._worksheet.getMergedCell(this._range.startRow,this._range.startColumn);if(i&&r.Rectangle.equals(i,this._range)||!i&&this._range.startRow===this._range.endRow&&this._range.startColumn===this._range.endColumn)return this.activate();throw new Error("The range is not a single cell")}splitTextToColumns(i,e,t){this._commandService.executeCommand(a.SplitTextToColumnsCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,delimiter:e,customDelimiter:t,treatMultipleDelimitersAsOne:i})}},m.FRange=z([p(3,r.Inject(r.Injector)),p(4,r.ICommandService),p(5,r.Inject(_.FormulaDataModel))],m.FRange);var H=Object.defineProperty,$=Object.getOwnPropertyDescriptor,G=(h,i,e,t)=>{for(var n=t>1?void 0:t?$(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&H(i,e,n),n},Y=(h,i)=>(e,t)=>i(e,t,h);m.FSelection=class{constructor(i,e,t,n){this._workbook=i,this._worksheet=e,this._selections=t,this._injector=n}getActiveRange(){const i=this._selections.find(e=>!!e.primary);return i?this._injector.createInstance(m.FRange,this._workbook,this._worksheet,i.range):null}getActiveRangeList(){return this._selections.map(i=>this._injector.createInstance(m.FRange,this._workbook,this._worksheet,i.range))}getCurrentCell(){const i=this._selections.find(e=>!!e.primary);return i?i.primary:null}getActiveSheet(){const i=this._injector.createInstance(m.FWorkbook,this._workbook);return this._injector.createInstance(m.FWorksheet,i,this._workbook,this._worksheet)}async updatePrimaryCell(i){const e=this._injector.get(r.ICommandService);let t=[],n=!1;for(const{range:s,style:d}of this._selections)r.Rectangle.contains(s,i.getRange())?(t.push({range:s,primary:a.getPrimaryForRange(i.getRange(),this._worksheet),style:d}),n=!0):t.push({range:s,primary:null,style:d});n||(t=[{range:i.getRange(),primary:a.getPrimaryForRange(i.getRange(),this._worksheet)}]);const o={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),selections:t};return await e.syncExecuteCommand(a.SetSelectionsOperation.id,o),new m.FSelection(this._workbook,this._worksheet,t,this._injector)}getNextDataRange(i){if(!this._selections.find(n=>!!n.primary))return null;const t=a.getNextPrimaryCell(this._selections.concat(),i,this._worksheet);return t?this._injector.createInstance(m.FRange,this._workbook,this._worksheet,t):null}},m.FSelection=G([Y(3,r.Inject(r.Injector))],m.FSelection);var q=Object.defineProperty,K=Object.getOwnPropertyDescriptor,J=(h,i,e,t)=>{for(var n=t>1?void 0:t?K(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&q(i,e,n),n},v=(h,i)=>(e,t)=>i(e,t,h);m.FWorksheet=class extends r.FBase{constructor(e,t,n,o,s,d,c){super();C(this,"setActiveSelection",this.setActiveRange);this._fWorkbook=e,this._workbook=t,this._worksheet=n,this._injector=o,this._selectionManagerService=s,this._logService=d,this._commandService=c}getInject(){return this._injector}getWorkbook(){return this._workbook}getSheetId(){return this._worksheet.getSheetId()}getSheetName(){return this._worksheet.getName()}getSelection(){const e=this._selectionManagerService.getCurrentSelections();return e?this._injector.createInstance(m.FSelection,this._workbook,this._worksheet,e):null}getDefaultStyle(){return this._worksheet.getDefaultCellStyle()}getRowDefaultStyle(e,t=!1){return this._worksheet.getRowStyle(e,t)}getColumnDefaultStyle(e,t=!1){return this._worksheet.getColumnStyle(e,t)}async setDefaultStyle(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return await this._commandService.executeCommand(a.SetWorksheetDefaultStyleMutation.id,{unitId:t,subUnitId:n,defaultStyle:e}),this._worksheet.setDefaultCellStyle(e),this}async setColumnDefaultStyle(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={unitId:n,subUnitId:o,columnData:{[e]:{s:t}}};return await this._commandService.executeCommand(a.SetColDataCommand.id,s),this}async setRowDefaultStyle(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={unitId:n,subUnitId:o,rowData:{[e]:{s:t}}};return await this._commandService.executeCommand(a.SetRowDataCommand.id,s),this}getRange(e,t,n,o){let s,d;if(typeof e=="string"){const{range:c,sheetName:u}=_.deserializeRangeWithSheet(e),l=u?this._workbook.getSheetBySheetName(u):this._worksheet;if(!l)throw new Error("Range not found");d=l,s={...c,unitId:this._workbook.getUnitId(),sheetId:d.getSheetId(),rangeType:r.RANGE_TYPE.NORMAL,startRow:c.rangeType===r.RANGE_TYPE.COLUMN?0:c.startRow,endRow:c.rangeType===r.RANGE_TYPE.COLUMN?d.getMaxRows()-1:c.endRow,startColumn:c.rangeType===r.RANGE_TYPE.ROW?0:c.startColumn,endColumn:c.rangeType===r.RANGE_TYPE.ROW?d.getMaxColumns()-1:c.endColumn}}else if(typeof e=="number"&&t!==void 0)d=this._worksheet,s={startRow:e,endRow:e+(n!=null?n:1)-1,startColumn:t,endColumn:t+(o!=null?o:1)-1,unitId:this._workbook.getUnitId(),sheetId:this._worksheet.getSheetId()};else throw new Error("Invalid range specification");return this._injector.createInstance(m.FRange,this._workbook,d,s)}getMaxColumns(){return this._worksheet.getMaxColumns()}getMaxRows(){return this._worksheet.getMaxRows()}async insertRowAfter(e){return this.insertRowsAfter(e,1)}async insertRowBefore(e){return this.insertRowsBefore(e,1)}async insertRows(e,t=1){return this.insertRowsBefore(e,t)}async insertRowsAfter(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=r.Direction.DOWN,d=e+1,c=e+t,u=0,l=this._worksheet.getColumnCount()-1,g=a.copyRangeStyles(this._worksheet,d,c,u,l,!0,e);return await this._commandService.executeCommand(a.InsertRowCommand.id,{unitId:n,subUnitId:o,direction:s,range:{startRow:d,endRow:c,startColumn:u,endColumn:l},cellValue:g}),this}async insertRowsBefore(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=r.Direction.UP,d=e,c=e+t-1,u=0,l=this._worksheet.getColumnCount()-1,g=a.copyRangeStyles(this._worksheet,d,c,u,l,!0,e-1);return await this._commandService.executeCommand(a.InsertRowCommand.id,{unitId:n,subUnitId:o,direction:s,range:{startRow:d,endRow:c,startColumn:u,endColumn:l},cellValue:g}),this}async deleteRow(e){return this.deleteRows(e,1)}async deleteRows(e,t){const n={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return await this._commandService.executeCommand(a.RemoveRowCommand.id,{range:n}),this}async moveRows(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=P(e.getRange(),this._worksheet),d=s,c={startRow:t,endRow:t,startColumn:s.startColumn,endColumn:s.endColumn};return await this._commandService.executeCommand(a.MoveRowsCommand.id,{unitId:n,subUnitId:o,range:s,fromRange:d,toRange:c}),this}async hideRow(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=P(e.getRange(),this._worksheet);return await this._commandService.executeCommand(a.SetRowHiddenCommand.id,{unitId:t,subUnitId:n,ranges:[o]}),this}async hideRows(e,t=1){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:r.RANGE_TYPE.ROW};return await this._commandService.executeCommand(a.SetRowHiddenCommand.id,{unitId:n,subUnitId:o,ranges:[s]}),this}async unhideRow(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=P(e.getRange(),this._worksheet);return await this._commandService.executeCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:t,subUnitId:n,ranges:[o]}),this}async showRows(e,t=1){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:r.RANGE_TYPE.ROW};return await this._commandService.executeCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:n,subUnitId:o,ranges:[s]}),this}async setRowHeight(e,t){return this.setRowHeights(e,1,t)}async setRowHeights(e,t,n){var l;const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=this._worksheet.getRowManager(),c=[],u=[];for(let g=e;g<e+t;g++){const U=((l=d.getRow(g))==null?void 0:l.ah)||this._worksheet.getConfig().defaultRowHeight,R={startRow:g,endRow:g,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};n<=U?c.push(R):u.push(R)}return u.length>0&&await this._commandService.executeCommand(a.SetRowHeightCommand.id,{unitId:o,subUnitId:s,ranges:u,value:n}),c.length>0&&await this._commandService.executeCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:o,subUnitId:s,ranges:c}),this}async setRowHeightsForced(e,t,n){const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return await this._commandService.executeCommand(a.SetRowHeightCommand.id,{unitId:o,subUnitId:s,ranges:d,value:n}),this}async setRowCustom(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o={};for(const[d,c]of Object.entries(e))o[Number(d)]={custom:c};const s={unitId:t,subUnitId:n,rowData:o};return await this._commandService.executeCommand(a.SetRowDataCommand.id,s),this}async insertColumnAfter(e){return this.insertColumnsAfter(e,1)}async insertColumnBefore(e){return this.insertColumnsBefore(e,1)}async insertColumns(e,t=1){return this.insertColumnsBefore(e,t)}async insertColumnsAfter(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=r.Direction.RIGHT,d=0,c=this._worksheet.getRowCount()-1,u=e+1,l=e+t,g=a.copyRangeStyles(this._worksheet,d,c,u,l,!1,e);return await this._commandService.executeCommand(a.InsertColCommand.id,{unitId:n,subUnitId:o,direction:s,range:{startRow:d,endRow:c,startColumn:u,endColumn:l},cellValue:g}),this}async insertColumnsBefore(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=r.Direction.LEFT,d=0,c=this._worksheet.getRowCount()-1,u=e,l=e+t-1,g=a.copyRangeStyles(this._worksheet,d,c,u,l,!1,e-1);return await this._commandService.executeCommand(a.InsertColCommand.id,{unitId:n,subUnitId:o,direction:s,range:{startRow:d,endRow:c,startColumn:u,endColumn:l},cellValue:g}),this}async deleteColumn(e){return this.deleteColumns(e,1)}async deleteColumns(e,t){const n={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1};return await this._commandService.executeCommand(a.RemoveColCommand.id,{range:n}),this}async moveColumns(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=y(e.getRange(),this._worksheet),d=s,c={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:t,endColumn:t};return await this._commandService.executeCommand(a.MoveColsCommand.id,{unitId:n,subUnitId:o,range:s,fromRange:d,toRange:c}),this}async hideColumn(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=y(e.getRange(),this._worksheet);return await this._commandService.executeCommand(a.SetColHiddenCommand.id,{unitId:t,subUnitId:n,ranges:[o]}),this}async hideColumns(e,t=1){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:r.RANGE_TYPE.COLUMN};return await this._commandService.executeCommand(a.SetColHiddenCommand.id,{unitId:n,subUnitId:o,ranges:[s]}),this}async unhideColumn(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=y(e.getRange(),this._worksheet);return await this._commandService.executeCommand(a.SetSpecificColsVisibleCommand.id,{unitId:t,subUnitId:n,ranges:[o]}),this}async showColumns(e,t=1){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:r.RANGE_TYPE.COLUMN};return await this._commandService.executeCommand(a.SetSpecificColsVisibleCommand.id,{unitId:n,subUnitId:o,ranges:[s]}),this}async setColumnWidth(e,t){return this.setColumnWidths(e,1,t)}async setColumnWidths(e,t,n){const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return await this._commandService.executeCommand(a.SetColWidthCommand.id,{unitId:o,subUnitId:s,ranges:d,value:n}),this}async setColumnCustom(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o={};for(const[d,c]of Object.entries(e))o[Number(d)]={custom:c};const s={unitId:t,subUnitId:n,columnData:o};return await this._commandService.executeCommand(a.SetColDataCommand.id,s),this}getMergedRanges(){return this._worksheet.getSnapshot().mergeData.map(t=>this._injector.createInstance(m.FRange,this._workbook,this._worksheet,t))}getCellMergeData(e,t){const o=this._worksheet.getMergedCell(e,t);if(o)return this._injector.createInstance(m.FRange,this._workbook,this._worksheet,o)}getActiveRange(){return this._fWorkbook.getActiveRange()}setActiveRange(e){const{unitId:t,sheetId:n}=e.getRange();if(t!==this._workbook.getUnitId()||n!==this._worksheet.getSheetId())throw new Error("Specified range must be part of the sheet.");this._fWorkbook.setActiveRange(e)}setFreeze(e){return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"),this._commandService.syncExecuteCommand(a.SetFrozenCommand.id,{...e,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()})}cancelFreeze(){return this._commandService.syncExecuteCommand(a.CancelFrozenCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()})}getFreeze(){return this._worksheet.getFreeze()}setFrozenColumns(...e){const t=this.getFreeze();if(arguments.length===1){const n=e[0];this.setFreeze({...t,startColumn:n>0?n:-1,xSplit:n})}else if(arguments.length===2){let[n=0,o=0]=e;n>o&&([n,o]=[o,n]),this._commandService.syncExecuteCommand(a.SetFrozenCommand.id,{startColumn:o+1,xSplit:o-n+1,startRow:t.startRow,ySplit:t.ySplit,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()})}}setFrozenRows(...e){const t=this.getFreeze();if(arguments.length===1){const n=e[0];this.setFreeze({...t,startRow:n>0?n:-1,ySplit:n})}else if(arguments.length===2){let[n=0,o=0]=e;n>o&&([n,o]=[o,n]),this._commandService.syncExecuteCommand,this._commandService.syncExecuteCommand(a.SetFrozenCommand.id,{startRow:o+1,ySplit:o-n+1,startColumn:t.startColumn,xSplit:t.xSplit,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()})}}getFrozenColumns(){const e=this.getFreeze();return e.startColumn===-1?0:e.startColumn}getFrozenRows(){const e=this.getFreeze();return e.startRow===-1?0:e.startRow}getFrozenRowRange(){const e=this._worksheet.getFreeze();return{startRow:e.startRow-e.ySplit,endRow:e.startRow-1}}getFrozenColumnRange(){const e=this._worksheet.getFreeze();return{startColumn:e.startColumn-e.xSplit,endColumn:e.startColumn-1}}hasHiddenGridLines(){return this._worksheet.getConfig().showGridlines===r.BooleanNumber.FALSE}setHiddenGridlines(e){return this._commandService.executeCommand(a.ToggleGridlinesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),showGridlines:e?r.BooleanNumber.FALSE:r.BooleanNumber.TRUE})}setGridLinesColor(e){return this._commandService.executeCommand(a.SetGridlinesColorCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),color:e})}getGridLinesColor(){return this._worksheet.getGridlinesColor()}setTabColor(e){return this._commandService.executeCommand(a.SetTabColorCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),color:e})}getTabColor(){return this._worksheet.getTabColor()}onCellDataChange(e){return this._injector.get(r.ICommandService).onCommandExecuted(n=>{if(n.id===a.SetRangeValuesMutation.id){const o=n.params;o.unitId===this._workbook.getUnitId()&&o.subUnitId===this._worksheet.getSheetId()&&o.cellValue&&e(new r.ObjectMatrix(o.cellValue))}})}onBeforeCellDataChange(e){return this._injector.get(r.ICommandService).beforeCommandExecuted(n=>{if(n.id===a.SetRangeValuesMutation.id){const o=n.params;o.unitId===this._workbook.getUnitId()&&o.subUnitId===this._worksheet.getSheetId()&&o.cellValue&&e(new r.ObjectMatrix(o.cellValue))}})}hideSheet(){const e=this._injector.get(r.ICommandService);if(this._workbook.getSheets().filter(s=>s.isSheetHidden()!==r.BooleanNumber.TRUE).length<=1)throw new Error("Cannot hide the only visible sheet");e.executeCommand(a.SetWorksheetHideCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()})}showSheet(){return this._injector.get(r.ICommandService).executeCommand(a.SetWorksheetShowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()})}isSheetHidden(){return this._worksheet.isSheetHidden()===r.BooleanNumber.TRUE}setName(e){return this._commandService.executeCommand(a.SetWorksheetNameCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),name:e})}activate(){return this._fWorkbook.setActiveSheet(this),this}getIndex(){return this._workbook.getSheetIndex(this._worksheet)}clear(e){if(e&&e.contentsOnly&&!e.formatOnly)return this.clearContents();if(e&&e.formatOnly&&!e.contentsOnly)return this.clearFormats();const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=this._injector.get(r.ICommandService),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return o.executeCommand(a.ClearSelectionAllCommand.id,{unitId:t,subUnitId:n,ranges:[s],options:e})}clearContents(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),n=this._injector.get(r.ICommandService),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return n.executeCommand(a.ClearSelectionContentCommand.id,{unitId:e,subUnitId:t,ranges:[o]})}clearFormats(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),n=this._injector.get(r.ICommandService),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return n.executeCommand(a.ClearSelectionFormatCommand.id,{unitId:e,subUnitId:t,ranges:[o]})}getDataRange(){const e=this.getLastRows(),t=this.getLastColumns();return this.getRange(0,0,e+1,t+1)}getLastColumns(){return this._worksheet.getLastColumnWithContent()}getLastColumn(){return this._worksheet.getLastColumnWithContent()}getLastRows(){return this._worksheet.getLastRowWithContent()}getLastRow(){return this._worksheet.getLastRowWithContent()}equalTo(e){return e instanceof m.FWorksheet?this._worksheet.getSheetId()===e.getSheetId()&&this._workbook.getUnitId()===e.getWorkbook().getUnitId():!1}insertDefinedName(e,t){const o=this._injector.createInstance(I).setName(e).setRef(t).build();o.localSheetId=this.getSheetId(),this._fWorkbook.insertDefinedNameBuilder(o)}getDefinedNames(){return this._fWorkbook.getDefinedNames().filter(t=>t.getLocalSheetId()===this.getSheetId())}},m.FWorksheet=J([v(3,r.Inject(r.Injector)),v(4,r.Inject(a.SheetsSelectionsService)),v(5,r.Inject(r.ILogService)),v(6,r.ICommandService)],m.FWorksheet);var Q=Object.defineProperty,X=Object.getOwnPropertyDescriptor,Z=(h,i,e,t)=>{for(var n=t>1?void 0:t?X(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&Q(i,e,n),n},S=(h,i)=>(e,t)=>i(e,t,h);m.FWorkbook=class extends r.FBase{constructor(e,t,n,o,s,d,c,u,l,g){super();C(this,"id");this._workbook=e,this._injector=t,this._resourceLoaderService=n,this._selectionManagerService=o,this._univerInstanceService=s,this._commandService=d,this._permissionService=c,this._logService=u,this._localeService=l,this._definedNamesService=g,this.id=this._workbook.getUnitId()}getId(){return this.id}getName(){return this._workbook.name}setName(e){this._workbook.setName(e)}save(){return this._resourceLoaderService.saveUnit(this._workbook.getUnitId())}getSnapshot(){return this._logService.warn("use 'save' instead of 'getSnapshot'"),this.save()}getActiveSheet(){const e=this._workbook.getActiveSheet();return this._injector.createInstance(m.FWorksheet,this,this._workbook,e)}getSheets(){return this._workbook.getSheets().map(e=>this._injector.createInstance(m.FWorksheet,this,this._workbook,e))}create(e,t,n){const o=r.mergeWorksheetSnapshotWithDefault({});o.rowCount=t,o.columnCount=n,o.name=e,o.id=e.toLowerCase().replace(/ /g,"-"),this._commandService.syncExecuteCommand(a.InsertSheetCommand.id,{unitId:this.id,index:this._workbook.getSheets().length,sheet:o}),this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[this._workbook.getSheets().length-1].getSheetId()});const s=this._workbook.getActiveSheet();if(!s)throw new Error("No active sheet found");return this._injector.createInstance(m.FWorksheet,this,this._workbook,s)}getSheetBySheetId(e){const t=this._workbook.getSheetBySheetId(e);return t?this._injector.createInstance(m.FWorksheet,this,this._workbook,t):null}getSheetByName(e){const t=this._workbook.getSheetBySheetName(e);return t?this._injector.createInstance(m.FWorksheet,this,this._workbook,t):null}setActiveSheet(e){return this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:e.getSheetId()}),e}insertSheet(e){e!=null?this._commandService.syncExecuteCommand(a.InsertSheetCommand.id,{sheet:{name:e}}):this._commandService.syncExecuteCommand(a.InsertSheetCommand.id);const t=this.id,n=this._workbook.getSheets()[this._workbook.getSheets().length-1].getSheetId();this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:t,subUnitId:n});const o=this._workbook.getActiveSheet();if(!o)throw new Error("No active sheet found");return this._injector.createInstance(m.FWorksheet,this,this._workbook,o)}deleteSheet(e){const t=this.id,n=e.getSheetId();return this._commandService.executeCommand(a.RemoveSheetCommand.id,{unitId:t,subUnitId:n})}undo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.executeCommand(r.UndoCommand.id)}redo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.executeCommand(r.RedoCommand.id)}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted(t=>{var n;((n=t.params)==null?void 0:n.unitId)===this.id&&e(t)})}onCommandExecuted(e){return this._commandService.onCommandExecuted(t=>{var n;((n=t.params)==null?void 0:n.unitId)===this.id&&e(t)})}onSelectionChange(e){return r.toDisposable(this._selectionManagerService.selectionMoveEnd$.subscribe(t=>{this._univerInstanceService.getCurrentUnitForType(r.UniverInstanceType.UNIVER_SHEET).getUnitId()===this.id&&(t!=null&&t.length?e(t.map(n=>n.range)):e([]))}))}setEditable(e){const t=new a.WorkbookEditablePermission(this._workbook.getUnitId());this._permissionService.getPermissionPoint(t.id)||this._permissionService.addPermissionPoint(t),this._permissionService.updatePermissionPoint(t.id,e)}setActiveRange(e){const t=this.getActiveSheet(),n=e.getRange().sheetId||t.getSheetId(),o=n?this._workbook.getSheetBySheetId(n):this._workbook.getActiveSheet(!0);if(!o)throw new Error("No active sheet found");o.getSheetId()!==t.getSheetId()&&this.setActiveSheet(this._injector.createInstance(m.FWorksheet,this,this._workbook,o));const s={unitId:this.getId(),subUnitId:n,selections:[e].map(d=>({range:d.getRange(),primary:a.getPrimaryForRange(d.getRange(),o),style:null}))};this._commandService.syncExecuteCommand(a.SetSelectionsOperation.id,s)}getActiveRange(){const e=this._workbook.getActiveSheet(),n=this._selectionManagerService.getCurrentSelections().find(o=>!!o.primary);return n?this._injector.createInstance(m.FRange,this._workbook,e,n.range):null}deleteActiveSheet(){const e=this.getActiveSheet();return this.deleteSheet(e)}duplicateSheet(e){return this._commandService.executeCommand(a.CopySheetCommand.id,{unitId:e.getWorkbook().getUnitId(),subUnitId:e.getSheetId()})}duplicateActiveSheet(){const e=this.getActiveSheet();return this.duplicateSheet(e)}getNumSheets(){return this._workbook.getSheets().length}getLocale(){return this._localeService.getCurrentLocale()}setLocale(e){this._localeService.setLocale(e)}getUrl(){return location.href}moveSheet(e,t){let n=t;return n<0?n=0:n>this._workbook.getSheets().length-1&&(n=this._workbook.getSheets().length-1),this._commandService.executeCommand(a.SetWorksheetOrderCommand.id,{unitId:e.getWorkbook().getUnitId(),order:n,subUnitId:e.getSheetId()})}moveActiveSheet(e){const t=this.getActiveSheet();return this.moveSheet(t,e)}getPermission(){return this._injector.createInstance(m.FPermission)}getDefinedName(e){const t=this._definedNamesService.getValueByName(this.id,e);return t?this._injector.createInstance(f,{...t,unitId:this.id}):null}getDefinedNames(){const e=this._definedNamesService.getDefinedNameMap(this.id);return e?Object.values(e).map(t=>this._injector.createInstance(f,{...t,unitId:this.id})):[]}insertDefinedName(e,t){const o=this._injector.createInstance(I).setName(e).setRef(t).build();o.localSheetId=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this.insertDefinedNameBuilder(o)}deleteDefinedName(e){const t=this.getDefinedName(e);return t?(t.delete(),!0):!1}insertDefinedNameBuilder(e){e.unitId=this.getId(),this._commandService.syncExecuteCommand(a.SetDefinedNameCommand.id,e)}updateDefinedNameBuilder(e){this._commandService.syncExecuteCommand(a.SetDefinedNameCommand.id,e)}},m.FWorkbook=Z([S(1,r.Inject(r.Injector)),S(2,r.Inject(r.IResourceLoaderService)),S(3,r.Inject(a.SheetsSelectionsService)),S(4,r.IUniverInstanceService),S(5,r.ICommandService),S(6,r.IPermissionService),S(7,r.ILogService),S(8,r.Inject(r.LocaleService)),S(9,_.IDefinedNamesService)],m.FWorkbook);class ee extends r.FUniver{createUniverSheet(i){const t=this._injector.get(r.IUniverInstanceService).createUnit(r.UniverInstanceType.UNIVER_SHEET,i);return this._injector.createInstance(m.FWorkbook,t)}getActiveWorkbook(){const i=this._univerInstanceService.getCurrentUnitForType(r.UniverInstanceType.UNIVER_SHEET);return i?this._injector.createInstance(m.FWorkbook,i):null}getUniverSheet(i){const e=this._univerInstanceService.getUnit(i,r.UniverInstanceType.UNIVER_SHEET);return e?this._injector.createInstance(m.FWorkbook,e):null}getPermission(){return this._injector.createInstance(m.FPermission)}onUniverSheetCreated(i){const e=this._univerInstanceService.getTypeOfUnitAdded$(r.UniverInstanceType.UNIVER_SHEET).subscribe(t=>{const n=this._injector.createInstance(m.FWorkbook,t);i(n)});return r.toDisposable(e)}newDefinedName(){return this._injector.createInstance(I)}}r.FUniver.extend(ee);var te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,ie=(h,i,e,t)=>{for(var n=t>1?void 0:t?ne(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&te(i,e,n),n},oe=(h,i)=>(e,t)=>i(e,t,h);m.FSheetHooks=class extends r.FBase{constructor(i){super(),this._injector=i}},m.FSheetHooks=ie([oe(0,r.Inject(r.Injector))],m.FSheetHooks),Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(m,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-formula"],r):(m=typeof globalThis<"u"?globalThis:m||self,r(m.UniverSheetsFacade={},m.UniverCore,m.UniverSheets,m.UniverEngineFormula))})(this,function(m,r,a,w){"use strict";var se=Object.defineProperty;var ae=(m,r,a)=>r in m?se(m,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):m[r]=a;var I=(m,r,a)=>ae(m,typeof r!="symbol"?r+"":r,a);var N=Object.defineProperty,F=Object.getOwnPropertyDescriptor,j=(h,i,e,t)=>{for(var n=t>1?void 0:t?F(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&N(i,e,n),n},_=(h,i)=>(e,t)=>i(e,t,h);function W(h,i,e){const t=e.getDefinedNameMap(h);if(t==null)return i.t("definedName.defaultName")+1;const o=Array.from(Object.values(t)).length+1,s=i.t("definedName.defaultName")+o;if(e.getValueByName(h,s)==null)return s;let d=o+1;for(;;){const c=i.t("definedName.defaultName")+d;if(e.getValueByName(h,c)==null)return c;d++}}class C{constructor(){I(this,"_definedNameParam");this._definedNameParam={id:r.generateRandomId(10),unitId:"",name:"",formulaOrRefString:""}}setName(i){return this._definedNameParam.name=i,this}setFormula(i){return this._definedNameParam.formulaOrRefString=`=${i}`,this}setRef(i){return this._definedNameParam.formulaOrRefString=i,this}setRefByRange(i,e,t,n){return this._definedNameParam.formulaOrRefString=w.serializeRange({startRow:i,endRow:i+(t!=null?t:1)-1,startColumn:e,endColumn:e+(n!=null?n:1)-1}),this}setComment(i){return this._definedNameParam.comment=i,this}setHidden(i){return this._definedNameParam.hidden=i,this}build(){return this._definedNameParam}load(i){return this._definedNameParam=i,this}}let v=class extends r.FBase{constructor(h,i,e,t,n,o,s,d,c,u){super(),this._definedNameParam=h,this._injector=i,this._commandService=e,this._permissionService=t,this._worksheetProtectionRuleModel=n,this._rangeProtectionRuleModel=o,this._worksheetProtectionPointRuleModel=s,this._authzIoService=d,this._localeService=c,this._definedNamesService=u}_apply(){this._definedNameParam.name===""&&(this._definedNameParam.name=W(this._definedNameParam.unitId,this._localeService,this._definedNamesService)),this._commandService.syncExecuteCommand(a.SetDefinedNameCommand.id,this._definedNameParam)}getName(){return this._definedNameParam.name}setName(h){this._definedNameParam.name=h,this._apply()}setFormula(h){this._definedNameParam.formulaOrRefString=`=${h}`,this._apply()}setRef(h){this._definedNameParam.formulaOrRefString=h,this._apply()}getFormulaOrRefString(){return this._definedNameParam.formulaOrRefString}setRefByRange(h,i,e,t){this._definedNameParam.formulaOrRefString=w.serializeRange({startRow:h,endRow:h+(e!=null?e:1)-1,startColumn:i,endColumn:i+(t!=null?t:1)-1}),this._apply()}getComment(){return this._definedNameParam.comment}setComment(h){this._definedNameParam.comment=h,this._apply()}setScopeToWorksheet(h){this._definedNameParam.localSheetId=h.getSheetId(),this._apply()}setScopeToWorkbook(){this._definedNameParam.localSheetId=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this._apply()}setHidden(h){this._definedNameParam.hidden=h,this._apply()}delete(){this._commandService.syncExecuteCommand(a.RemoveDefinedNameCommand.id,this._definedNameParam)}getLocalSheetId(){return this._definedNameParam.localSheetId}isWorkbookScope(){return this._definedNameParam.localSheetId===a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME}toBuilder(){const h=this._injector.createInstance(C);return h.load(this._definedNameParam),h}};v=j([_(1,r.Inject(r.Injector)),_(2,r.ICommandService),_(3,r.IPermissionService),_(4,r.Inject(a.WorksheetProtectionRuleModel)),_(5,r.Inject(a.RangeProtectionRuleModel)),_(6,r.Inject(a.WorksheetProtectionPointModel)),_(7,r.Inject(r.IAuthzIoService)),_(8,r.Inject(r.LocaleService)),_(9,w.IDefinedNamesService)],v);var A=Object.defineProperty,T=Object.getOwnPropertyDescriptor,D=(h,i,e,t)=>{for(var n=t>1?void 0:t?T(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&A(i,e,n),n},k=(h,i)=>(e,t)=>i(e,t,h);m.FPermission=class extends r.FBase{constructor(e,t,n,o,s,d,c){super();I(this,"permissionPointsDefinition",a.PermissionPointsDefinitions);this._injector=e,this._commandService=t,this._permissionService=n,this._worksheetProtectionRuleModel=o,this._rangeProtectionRuleModel=s,this._worksheetProtectionPointRuleModel=d,this._authzIoService=c}setWorkbookPermissionPoint(e,t,n){const o=new t(e);this._permissionService.getPermissionPoint(o.id)||this._permissionService.addPermissionPoint(o),this._permissionService.updatePermissionPoint(o.id,n)}setWorkbookEditPermission(e,t){this.setWorkbookPermissionPoint(e,a.WorkbookEditablePermission,t)}async addWorksheetBasePermission(e,t){if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length>0)throw new Error("sheet protection cannot intersect with range protection");const o=await this._authzIoService.create({objectType:a.UnitObject.Worksheet,worksheetObject:{collaborators:[],unitID:e,strategies:[],name:"",scope:void 0}});if(this._commandService.syncExecuteCommand(a.AddWorksheetProtectionMutation.id,{unitId:e,subUnitId:t,rule:{permissionId:o,unitType:a.UnitObject.Worksheet,unitId:e,subUnitId:t}}))return o}removeWorksheetPermission(e,t){this._commandService.syncExecuteCommand(a.DeleteWorksheetProtectionMutation.id,{unitId:e,subUnitId:t}),[...a.getAllWorksheetPermissionPoint(),...a.getAllWorksheetPermissionPointByPointPanel()].forEach(n=>{const o=new n(e,t);this._permissionService.updatePermissionPoint(o.id,!0)}),this._worksheetProtectionPointRuleModel.deleteRule(e,t)}async setWorksheetPermissionPoint(e,t,n,o){const s=this._worksheetProtectionRuleModel.getRule(e,t);let d;if(n===a.WorksheetEditPermission||n===a.WorksheetViewPermission)if(s)d=s.permissionId;else{if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length>0)throw new Error("sheet protection cannot intersect with range protection");d=await this.addWorksheetBasePermission(e,t)}else{const g=this._worksheetProtectionPointRuleModel.getRule(e,t);g?d=g.permissionId:(d=await this._authzIoService.create({objectType:a.UnitObject.Worksheet,worksheetObject:{collaborators:[],unitID:e,strategies:[],name:"",scope:void 0}}),this._commandService.executeCommand(a.SetWorksheetPermissionPointsMutation.id,{unitId:e,subUnitId:t,permissionId:d}))}const u=new n(e,t);return this._permissionService.getPermissionPoint(u.id)||this._permissionService.addPermissionPoint(u),this._permissionService.updatePermissionPoint(u.id,o),d}async addRangeBaseProtection(e,t,n){const o=await this._authzIoService.create({objectType:a.UnitObject.SelectRange,selectRangeObject:{collaborators:[],unitID:e,name:"",scope:void 0}}),s=`ruleId_${r.generateRandomId(6)}`;if(this._worksheetProtectionRuleModel.getRule(e,t))throw new Error("sheet protection cannot intersect with range protection");if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).some(g=>g.ranges.some(U=>n.some(R=>r.Rectangle.intersects(R,U)))))throw new Error("range protection cannot intersect");if(this._commandService.syncExecuteCommand(a.AddRangeProtectionMutation.id,{unitId:e,subUnitId:t,rules:[{permissionId:o,unitType:a.UnitObject.SelectRange,unitId:e,subUnitId:t,ranges:n,id:s}]}))return{permissionId:o,ruleId:s}}removeRangeProtection(e,t,n){this._commandService.syncExecuteCommand(a.DeleteRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleIds:n})&&this._rangeProtectionRuleModel.getSubunitRuleList(e,t).length===0&&(this._worksheetProtectionPointRuleModel.deleteRule(e,t),[...a.getAllWorksheetPermissionPointByPointPanel()].forEach(d=>{const c=new d(e,t);this._permissionService.updatePermissionPoint(c.id,c.value)}))}setRangeProtectionPermissionPoint(e,t,n,o,s){const d=new o(e,t,n);this._permissionService.getPermissionPoint(d.id)||this._permissionService.addPermissionPoint(d),this._permissionService.updatePermissionPoint(d.id,s)}setRangeProtectionRanges(e,t,n,o){const s=this._rangeProtectionRuleModel.getRule(e,t,n);if(s){if(this._rangeProtectionRuleModel.getSubunitRuleList(e,t).filter(u=>u.id!==n).some(u=>u.ranges.some(l=>o.some(g=>r.Rectangle.intersects(g,l)))))throw new Error("range protection cannot intersect");this._commandService.syncExecuteCommand(a.SetRangeProtectionMutation.id,{unitId:e,subUnitId:t,ruleId:n,rule:{...s,ranges:o}})}}},m.FPermission=D([k(0,r.Inject(r.Injector)),k(1,r.ICommandService),k(2,r.IPermissionService),k(3,r.Inject(a.WorksheetProtectionRuleModel)),k(4,r.Inject(a.RangeProtectionRuleModel)),k(5,r.Inject(a.WorksheetProtectionPointModel)),k(6,r.Inject(r.IAuthzIoService))],m.FPermission);function M(h){switch(h){case"left":return r.HorizontalAlign.LEFT;case"center":return r.HorizontalAlign.CENTER;case"normal":return r.HorizontalAlign.RIGHT;default:throw new Error(`Invalid horizontal alignment: ${h}`)}}function O(h){switch(h){case r.HorizontalAlign.LEFT:return"left";case r.HorizontalAlign.CENTER:return"center";case r.HorizontalAlign.RIGHT:return"normal";default:throw new Error(`Invalid horizontal alignment: ${h}`)}}function x(h){switch(h){case"top":return r.VerticalAlign.TOP;case"middle":return r.VerticalAlign.MIDDLE;case"bottom":return r.VerticalAlign.BOTTOM;default:throw new Error(`Invalid vertical alignment: ${h}`)}}function B(h){switch(h){case r.VerticalAlign.TOP:return"top";case r.VerticalAlign.MIDDLE:return"middle";case r.VerticalAlign.BOTTOM:return"bottom";default:throw new Error(`Invalid vertical alignment: ${h}`)}}function b(h){return r.isFormulaString(h)?{f:h}:r.isCellV(h)?{v:h}:(r.isICellData(h),h)}function L(h,i){const e=new r.ObjectMatrix,{startRow:t,startColumn:n,endRow:o,endColumn:s}=i;if(r.Tools.isArray(h))for(let d=0;d<=o-t;d++)for(let c=0;c<=s-n;c++)e.setValue(d+t,c+n,b(h[d][c]));else new r.ObjectMatrix(h).forValue((c,u,l)=>{e.setValue(c,u,b(l))});return e.getMatrix()}function y(h,i){return{startRow:h.startRow,endRow:h.endRow,startColumn:0,endColumn:i.getColumnCount()-1,rangeType:r.RANGE_TYPE.ROW}}function P(h,i){return{startRow:0,endRow:i.getRowCount()-1,startColumn:h.startColumn,endColumn:h.endColumn,rangeType:r.RANGE_TYPE.COLUMN}}var z=Object.defineProperty,V=Object.getOwnPropertyDescriptor,H=(h,i,e,t)=>{for(var n=t>1?void 0:t?V(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&z(i,e,n),n},p=(h,i)=>(e,t)=>i(e,t,h);m.FRange=class extends r.FBaseInitialable{constructor(i,e,t,n,o,s){super(n),this._workbook=i,this._worksheet=e,this._range=t,this._injector=n,this._commandService=o,this._formulaDataModel=s}getUnitId(){return this._workbook.getUnitId()}getSheetName(){return this._worksheet.getName()}getRange(){return this._range}getRow(){return this._range.startRow}getColumn(){return this._range.startColumn}getWidth(){return this._range.endColumn-this._range.startColumn+1}getHeight(){return this._range.endRow-this._range.startRow+1}getCellData(){var i;return(i=this._worksheet.getCell(this._range.startRow,this._range.startColumn))!=null?i:null}isMerged(){const{startColumn:i,startRow:e,endColumn:t,endRow:n}=this._range;return this._worksheet.getMergedCellRange(e,i,n,t).some(s=>r.Rectangle.equals(s,this._range))}getCellStyleData(){var t;const i=this.getCellData(),e=this._workbook.getStyles();return i&&e&&(t=e.getStyleByCell(i))!=null?t:null}getValue(){var i,e;return(e=(i=this._worksheet.getCell(this._range.startRow,this._range.startColumn))==null?void 0:i.v)!=null?e:null}getValues(){var s,d;const{startRow:i,endRow:e,startColumn:t,endColumn:n}=this._range,o=[];for(let c=i;c<=e;c++){const u=[];for(let l=t;l<=n;l++)u.push((d=(s=this._worksheet.getCell(c,l))==null?void 0:s.v)!=null?d:null);o.push(u)}return o}getCellDataGrid(){const{startRow:i,endRow:e,startColumn:t,endColumn:n}=this._range,o=[];for(let s=i;s<=e;s++){const d=[];for(let c=t;c<=n;c++)d.push(this._worksheet.getCellRaw(s,c));o.push(d)}return o}getFormulas(){const i=[],{startRow:e,endRow:t,startColumn:n,endColumn:o}=this._range,s=this._worksheet.getSheetId(),d=this._workbook.getUnitId();for(let c=e;c<=t;c++){const u=[];for(let l=n;l<=o;l++){const g=this._formulaDataModel.getFormulaStringByCell(c,l,s,d);u.push(g||"")}i.push(u)}return i}getWrap(){return this._worksheet.getRange(this._range).getWrap()===r.BooleanNumber.TRUE}getWrapStrategy(){return this._worksheet.getRange(this._range).getWrapStrategy()}getHorizontalAlignment(){return O(this._worksheet.getRange(this._range).getHorizontalAlignment())}getVerticalAlignment(){return B(this._worksheet.getRange(this._range).getVerticalAlignment())}setBackgroundColor(i){return this._commandService.syncExecuteCommand(a.SetStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:{type:"bg",value:{rgb:i}}}),this}setBackground(i){return this.setBackgroundColor(i),this}setValue(i){const e=b(i);if(!e)throw new Error("Invalid value");return this._commandService.syncExecuteCommand(a.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:e}),this}setWrap(i){return this._commandService.syncExecuteCommand(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:i?r.WrapStrategy.WRAP:r.WrapStrategy.UNSPECIFIED}),this}setWrapStrategy(i){return this._commandService.syncExecuteCommand(a.SetTextWrapCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:i}),this}setVerticalAlignment(i){return this._commandService.syncExecuteCommand(a.SetVerticalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:x(i)}),this}setHorizontalAlignment(i){return this._commandService.syncExecuteCommand(a.SetHorizontalTextAlignCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:M(i)}),this}setValues(i){const e=L(i,this._range);return this._commandService.syncExecuteCommand(a.SetRangeValuesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,value:e}),this}setFontWeight(i){let e;if(i==="bold")e=r.BooleanNumber.TRUE;else if(i==="normal")e=r.BooleanNumber.FALSE;else if(i===null)e=null;else throw new Error("Invalid fontWeight");const t={type:"bl",value:e},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.executeCommand(a.SetStyleCommand.id,n),this}setFontStyle(i){let e;if(i==="italic")e=r.BooleanNumber.TRUE;else if(i==="normal")e=r.BooleanNumber.FALSE;else if(i===null)e=null;else throw new Error("Invalid fontStyle");const t={type:"it",value:e},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.executeCommand(a.SetStyleCommand.id,n),this}setFontLine(i){if(i==="underline")this._setFontUnderline({s:r.BooleanNumber.TRUE});else if(i==="line-through")this._setFontStrikethrough({s:r.BooleanNumber.TRUE});else if(i==="none")this._setFontUnderline({s:r.BooleanNumber.FALSE}),this._setFontStrikethrough({s:r.BooleanNumber.FALSE});else if(i===null)this._setFontUnderline(null),this._setFontStrikethrough(null);else throw new Error("Invalid fontLine");return this}_setFontUnderline(i){const e={type:"ul",value:i},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.executeCommand(a.SetStyleCommand.id,t)}_setFontStrikethrough(i){const e={type:"st",value:i},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};this._commandService.executeCommand(a.SetStyleCommand.id,t)}setFontFamily(i){const e={type:"ff",value:i},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.executeCommand(a.SetStyleCommand.id,t),this}setFontSize(i){const e={type:"fs",value:i},t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:e};return this._commandService.executeCommand(a.SetStyleCommand.id,t),this}setFontColor(i){const t={type:"cl",value:i===null?null:{rgb:i}},n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,style:t};return this._commandService.executeCommand(a.SetStyleCommand.id,n),this}merge(i=!0){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,e,t,[this._range],i),this}mergeAcross(i=!0){const e=a.getAddMergeMutationRangeByType([this._range],r.Dimension.ROWS),t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,t,n,e,i),this}mergeVertically(i=!0){const e=a.getAddMergeMutationRangeByType([this._range],r.Dimension.COLUMNS),t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return a.addMergeCellsUtil(this._injector,t,n,e,i),this}isPartOfMerge(){const{startRow:i,startColumn:e,endRow:t,endColumn:n}=this._range;return this._worksheet.getMergedCellRange(i,e,t,n).length>0}breakApart(){return this._commandService.executeCommand(a.RemoveWorksheetMergeCommand.id,{ranges:[this._range]}),this}forEach(i){const{startColumn:e,startRow:t,endColumn:n,endRow:o}=this._range;this._worksheet.getMatrixWithMergedCells(t,e,o,n).forValue((s,d,c)=>{i(s,d,c)})}getA1Notation(i){return i?w.serializeRangeWithSheet(this._worksheet.getName(),this._range):w.serializeRange(this._range)}activate(){return this._injector.createInstance(m.FWorkbook,this._workbook).setActiveRange(this),this}activateAsCurrentCell(){const i=this._worksheet.getMergedCell(this._range.startRow,this._range.startColumn);if(i&&r.Rectangle.equals(i,this._range)||!i&&this._range.startRow===this._range.endRow&&this._range.startColumn===this._range.endColumn)return this.activate();throw new Error("The range is not a single cell")}splitTextToColumns(i,e,t){this._commandService.executeCommand(a.SplitTextToColumnsCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,delimiter:e,customDelimiter:t,treatMultipleDelimitersAsOne:i})}useThemeStyle(i){if(i==null){const e=this.getUsedThemeStyle();e&&this.removeThemeStyle(e)}else this._commandService.executeCommand(a.SetWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:i})}removeThemeStyle(i){this._commandService.executeCommand(a.DeleteWorksheetRangeThemeStyleCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range,themeName:i})}getUsedThemeStyle(){return this._injector.get(a.SheetRangeThemeService).getAppliedRangeThemeStyle({unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),range:this._range})}},m.FRange=H([p(3,r.Inject(r.Injector)),p(4,r.ICommandService),p(5,r.Inject(w.FormulaDataModel))],m.FRange);var $=Object.defineProperty,G=Object.getOwnPropertyDescriptor,Y=(h,i,e,t)=>{for(var n=t>1?void 0:t?G(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&$(i,e,n),n},q=(h,i)=>(e,t)=>i(e,t,h);m.FSelection=class{constructor(i,e,t,n){this._workbook=i,this._worksheet=e,this._selections=t,this._injector=n}getActiveRange(){const i=this._selections.find(e=>!!e.primary);return i?this._injector.createInstance(m.FRange,this._workbook,this._worksheet,i.range):null}getActiveRangeList(){return this._selections.map(i=>this._injector.createInstance(m.FRange,this._workbook,this._worksheet,i.range))}getCurrentCell(){const i=this._selections.find(e=>!!e.primary);return i?i.primary:null}getActiveSheet(){const i=this._injector.createInstance(m.FWorkbook,this._workbook);return this._injector.createInstance(m.FWorksheet,i,this._workbook,this._worksheet)}updatePrimaryCell(i){const e=this._injector.get(r.ICommandService);let t=[],n=!1;for(const{range:s,style:d}of this._selections)r.Rectangle.contains(s,i.getRange())?(t.push({range:s,primary:a.getPrimaryForRange(i.getRange(),this._worksheet),style:d}),n=!0):t.push({range:s,primary:null,style:d});n||(t=[{range:i.getRange(),primary:a.getPrimaryForRange(i.getRange(),this._worksheet)}]);const o={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),selections:t};return e.syncExecuteCommand(a.SetSelectionsOperation.id,o),new m.FSelection(this._workbook,this._worksheet,t,this._injector)}getNextDataRange(i){if(!this._selections.find(n=>!!n.primary))return null;const t=a.getNextPrimaryCell(this._selections.concat(),i,this._worksheet);return t?this._injector.createInstance(m.FRange,this._workbook,this._worksheet,t):null}},m.FSelection=Y([q(3,r.Inject(r.Injector))],m.FSelection);var K=Object.defineProperty,J=Object.getOwnPropertyDescriptor,Q=(h,i,e,t)=>{for(var n=t>1?void 0:t?J(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&K(i,e,n),n},f=(h,i)=>(e,t)=>i(e,t,h);m.FWorksheet=class extends r.FBaseInitialable{constructor(e,t,n,o,s,d,c){super(o);I(this,"setActiveSelection",this.setActiveRange);this._fWorkbook=e,this._workbook=t,this._worksheet=n,this._injector=o,this._selectionManagerService=s,this._logService=d,this._commandService=c}getInject(){return this._injector}getWorkbook(){return this._workbook}getSheetId(){return this._worksheet.getSheetId()}getSheetName(){return this._worksheet.getName()}getSelection(){const e=this._selectionManagerService.getCurrentSelections();return e?this._injector.createInstance(m.FSelection,this._workbook,this._worksheet,e):null}getDefaultStyle(){return this._worksheet.getDefaultCellStyle()}getRowDefaultStyle(e,t=!1){return this._worksheet.getRowStyle(e,t)}getColumnDefaultStyle(e,t=!1){return this._worksheet.getColumnStyle(e,t)}setDefaultStyle(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.syncExecuteCommand(a.SetWorksheetDefaultStyleMutation.id,{unitId:t,subUnitId:n,defaultStyle:e}),this._worksheet.setDefaultCellStyle(e),this}setColumnDefaultStyle(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={unitId:n,subUnitId:o,columnData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(a.SetColDataCommand.id,s),this}setRowDefaultStyle(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={unitId:n,subUnitId:o,rowData:{[e]:{s:t}}};return this._commandService.syncExecuteCommand(a.SetRowDataCommand.id,s),this}getRange(e,t,n,o){let s,d;if(typeof e=="string"){const{range:c,sheetName:u}=w.deserializeRangeWithSheet(e),l=u?this._workbook.getSheetBySheetName(u):this._worksheet;if(!l)throw new Error("Range not found");d=l,s={...c,unitId:this._workbook.getUnitId(),sheetId:d.getSheetId(),rangeType:r.RANGE_TYPE.NORMAL,startRow:c.rangeType===r.RANGE_TYPE.COLUMN?0:c.startRow,endRow:c.rangeType===r.RANGE_TYPE.COLUMN?d.getMaxRows()-1:c.endRow,startColumn:c.rangeType===r.RANGE_TYPE.ROW?0:c.startColumn,endColumn:c.rangeType===r.RANGE_TYPE.ROW?d.getMaxColumns()-1:c.endColumn}}else if(typeof e=="number"&&t!==void 0)d=this._worksheet,s={startRow:e,endRow:e+(n!=null?n:1)-1,startColumn:t,endColumn:t+(o!=null?o:1)-1,unitId:this._workbook.getUnitId(),sheetId:this._worksheet.getSheetId()};else throw new Error("Invalid range specification");return this._injector.createInstance(m.FRange,this._workbook,d,s)}getMaxColumns(){return this._worksheet.getMaxColumns()}getMaxRows(){return this._worksheet.getMaxRows()}insertRowAfter(e){return this.insertRowsAfter(e,1)}insertRowBefore(e){return this.insertRowsBefore(e,1)}insertRows(e,t=1){return this.insertRowsBefore(e,t)}insertRowsAfter(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=r.Direction.DOWN,d=e+1,c=e+t,u=0,l=this._worksheet.getColumnCount()-1,g=a.copyRangeStyles(this._worksheet,d,c,u,l,!0,e);return this._commandService.syncExecuteCommand(a.InsertRowByRangeCommand.id,{unitId:n,subUnitId:o,direction:s,range:{startRow:d,endRow:c,startColumn:u,endColumn:l},cellValue:g}),this}insertRowsBefore(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=r.Direction.UP,d=e,c=e+t-1,u=0,l=this._worksheet.getColumnCount()-1,g=a.copyRangeStyles(this._worksheet,d,c,u,l,!0,e-1);return this._commandService.syncExecuteCommand(a.InsertRowByRangeCommand.id,{unitId:n,subUnitId:o,direction:s,range:{startRow:d,endRow:c,startColumn:u,endColumn:l},cellValue:g}),this}deleteRow(e){return this.deleteRows(e,1)}deleteRows(e,t){const n={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return this._commandService.syncExecuteCommand(a.RemoveRowByRangeCommand.id,{range:n,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}moveRows(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=y(e.getRange(),this._worksheet),d=s,c={startRow:t,endRow:t,startColumn:s.startColumn,endColumn:s.endColumn};return this._commandService.syncExecuteCommand(a.MoveRowsCommand.id,{unitId:n,subUnitId:o,range:s,fromRange:d,toRange:c}),this}hideRow(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=y(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetRowHiddenCommand.id,{unitId:t,subUnitId:n,ranges:[o]}),this}hideRows(e,t=1){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:r.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(a.SetRowHiddenCommand.id,{unitId:n,subUnitId:o,ranges:[s]}),this}unhideRow(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=y(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:t,subUnitId:n,ranges:[o]}),this}showRows(e,t=1){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1,rangeType:r.RANGE_TYPE.ROW};return this._commandService.syncExecuteCommand(a.SetSpecificRowsVisibleCommand.id,{unitId:n,subUnitId:o,ranges:[s]}),this}setRowHeight(e,t){return this.setRowHeights(e,1,t)}setRowHeights(e,t,n){var l;const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=this._worksheet.getRowManager(),c=[],u=[];for(let g=e;g<e+t;g++){const U=((l=d.getRow(g))==null?void 0:l.ah)||this._worksheet.getConfig().defaultRowHeight,R={startRow:g,endRow:g,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};n<=U?c.push(R):u.push(R)}return u.length>0&&this._commandService.syncExecuteCommand(a.SetRowHeightCommand.id,{unitId:o,subUnitId:s,ranges:u,value:n}),c.length>0&&this._commandService.syncExecuteCommand(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:o,subUnitId:s,ranges:c}),this}setRowHeightsForced(e,t,n){const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(a.SetRowHeightCommand.id,{unitId:o,subUnitId:s,ranges:d,value:n}),this}setRowCustom(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o={};for(const[d,c]of Object.entries(e))o[Number(d)]={custom:c};const s={unitId:t,subUnitId:n,rowData:o};return this._commandService.syncExecuteCommand(a.SetRowDataCommand.id,s),this}insertColumnAfter(e){return this.insertColumnsAfter(e,1)}insertColumnBefore(e){return this.insertColumnsBefore(e,1)}insertColumns(e,t=1){return this.insertColumnsBefore(e,t)}insertColumnsAfter(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=r.Direction.RIGHT,d=0,c=this._worksheet.getRowCount()-1,u=e+1,l=e+t,g=a.copyRangeStyles(this._worksheet,d,c,u,l,!1,e);return this._commandService.syncExecuteCommand(a.InsertColByRangeCommand.id,{unitId:n,subUnitId:o,direction:s,range:{startRow:d,endRow:c,startColumn:u,endColumn:l},cellValue:g}),this}insertColumnsBefore(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=r.Direction.LEFT,d=0,c=this._worksheet.getRowCount()-1,u=e,l=e+t-1,g=a.copyRangeStyles(this._worksheet,d,c,u,l,!1,e-1);return this._commandService.syncExecuteCommand(a.InsertColByRangeCommand.id,{unitId:n,subUnitId:o,direction:s,range:{startRow:d,endRow:c,startColumn:u,endColumn:l},cellValue:g}),this}deleteColumn(e){return this.deleteColumns(e,1)}deleteColumns(e,t){const n={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1};return this._commandService.syncExecuteCommand(a.RemoveColByRangeCommand.id,{range:n,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}moveColumns(e,t){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s=P(e.getRange(),this._worksheet),d=s,c={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:t,endColumn:t};return this._commandService.syncExecuteCommand(a.MoveColsCommand.id,{unitId:n,subUnitId:o,range:s,fromRange:d,toRange:c}),this}hideColumn(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=P(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetColHiddenCommand.id,{unitId:t,subUnitId:n,ranges:[o]}),this}hideColumns(e,t=1){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:r.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(a.SetColHiddenCommand.id,{unitId:n,subUnitId:o,ranges:[s]}),this}unhideColumn(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=P(e.getRange(),this._worksheet);return this._commandService.syncExecuteCommand(a.SetSpecificColsVisibleCommand.id,{unitId:t,subUnitId:n,ranges:[o]}),this}showColumns(e,t=1){const n=this._workbook.getUnitId(),o=this._worksheet.getSheetId(),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:e,endColumn:e+t-1,rangeType:r.RANGE_TYPE.COLUMN};return this._commandService.syncExecuteCommand(a.SetSpecificColsVisibleCommand.id,{unitId:n,subUnitId:o,ranges:[s]}),this}setColumnWidth(e,t){return this.setColumnWidths(e,1,t)}setColumnWidths(e,t,n){const o=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),d=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(a.SetColWidthCommand.id,{unitId:o,subUnitId:s,ranges:d,value:n}),this}setColumnCustom(e){const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o={};for(const[d,c]of Object.entries(e))o[Number(d)]={custom:c};const s={unitId:t,subUnitId:n,columnData:o};return this._commandService.syncExecuteCommand(a.SetColDataCommand.id,s),this}getMergedRanges(){return this._worksheet.getSnapshot().mergeData.map(t=>this._injector.createInstance(m.FRange,this._workbook,this._worksheet,t))}getCellMergeData(e,t){const o=this._worksheet.getMergedCell(e,t);if(o)return this._injector.createInstance(m.FRange,this._workbook,this._worksheet,o)}getActiveRange(){return this._fWorkbook.getActiveRange()}setActiveRange(e){const{unitId:t,sheetId:n}=e.getRange();if(t!==this._workbook.getUnitId()||n!==this._worksheet.getSheetId())throw new Error("Specified range must be part of the sheet.");return this._fWorkbook.setActiveRange(e),this}setFreeze(e){return this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead"),this._commandService.syncExecuteCommand(a.SetFrozenCommand.id,{...e,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()}),this}cancelFreeze(){return this._commandService.syncExecuteCommand(a.CancelFrozenCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()}),this}getFreeze(){return this._worksheet.getFreeze()}setFrozenColumns(...e){const t=this.getFreeze();if(arguments.length===1){const n=e[0];this.setFreeze({...t,startColumn:n>0?n:-1,xSplit:n})}else if(arguments.length===2){let[n=0,o=0]=e;n>o&&([n,o]=[o,n]),this._commandService.syncExecuteCommand(a.SetFrozenCommand.id,{startColumn:o+1,xSplit:o-n+1,startRow:t.startRow,ySplit:t.ySplit,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()})}return this}setFrozenRows(...e){const t=this.getFreeze();if(arguments.length===1){const n=e[0];this.setFreeze({...t,startRow:n>0?n:-1,ySplit:n})}else if(arguments.length===2){let[n=0,o=0]=e;n>o&&([n,o]=[o,n]),this._commandService.syncExecuteCommand(a.SetFrozenCommand.id,{startRow:o+1,ySplit:o-n+1,startColumn:t.startColumn,xSplit:t.xSplit,unitId:this._workbook.getUnitId(),subUnitId:this.getSheetId()})}return this}getFrozenColumns(){const e=this.getFreeze();return e.startColumn===-1?0:e.startColumn}getFrozenRows(){const e=this.getFreeze();return e.startRow===-1?0:e.startRow}getFrozenRowRange(){const e=this._worksheet.getFreeze();return{startRow:e.startRow-e.ySplit,endRow:e.startRow-1}}getFrozenColumnRange(){const e=this._worksheet.getFreeze();return{startColumn:e.startColumn-e.xSplit,endColumn:e.startColumn-1}}hasHiddenGridLines(){return this._worksheet.getConfig().showGridlines===r.BooleanNumber.FALSE}setHiddenGridlines(e){return this._commandService.executeCommand(a.ToggleGridlinesCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),showGridlines:e?r.BooleanNumber.FALSE:r.BooleanNumber.TRUE}),this}setGridLinesColor(e){return this._commandService.syncExecuteCommand(a.SetGridlinesColorCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),color:e}),this}getGridLinesColor(){return this._worksheet.getGridlinesColor()}setTabColor(e){return this._commandService.executeCommand(a.SetTabColorCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),color:e}),this}getTabColor(){return this._worksheet.getTabColor()}onCellDataChange(e){return this._injector.get(r.ICommandService).onCommandExecuted(n=>{if(n.id===a.SetRangeValuesMutation.id){const o=n.params;o.unitId===this._workbook.getUnitId()&&o.subUnitId===this._worksheet.getSheetId()&&o.cellValue&&e(new r.ObjectMatrix(o.cellValue))}})}onBeforeCellDataChange(e){return this._injector.get(r.ICommandService).beforeCommandExecuted(n=>{if(n.id===a.SetRangeValuesMutation.id){const o=n.params;o.unitId===this._workbook.getUnitId()&&o.subUnitId===this._worksheet.getSheetId()&&o.cellValue&&e(new r.ObjectMatrix(o.cellValue))}})}hideSheet(){const e=this._injector.get(r.ICommandService);if(this._workbook.getSheets().filter(s=>s.isSheetHidden()!==r.BooleanNumber.TRUE).length<=1)throw new Error("Cannot hide the only visible sheet");return e.syncExecuteCommand(a.SetWorksheetHideCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}showSheet(){return this._injector.get(r.ICommandService).syncExecuteCommand(a.SetWorksheetShowCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()}),this}isSheetHidden(){return this._worksheet.isSheetHidden()===r.BooleanNumber.TRUE}setName(e){return this._commandService.syncExecuteCommand(a.SetWorksheetNameCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),name:e}),this}activate(){return this._fWorkbook.setActiveSheet(this),this}getIndex(){return this._workbook.getSheetIndex(this._worksheet)}clear(e){e&&e.contentsOnly&&!e.formatOnly&&this.clearContents(),e&&e.formatOnly&&!e.contentsOnly&&this.clearFormats();const t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),o=this._injector.get(r.ICommandService),s={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return o.syncExecuteCommand(a.ClearSelectionAllCommand.id,{unitId:t,subUnitId:n,ranges:[s],options:e}),this}clearContents(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),n=this._injector.get(r.ICommandService),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return n.syncExecuteCommand(a.ClearSelectionContentCommand.id,{unitId:e,subUnitId:t,ranges:[o]}),this}clearFormats(){const e=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),n=this._injector.get(r.ICommandService),o={startRow:0,endRow:this._worksheet.getRowCount()-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1};return n.syncExecuteCommand(a.ClearSelectionFormatCommand.id,{unitId:e,subUnitId:t,ranges:[o]}),this}getDataRange(){const e=this.getLastRows(),t=this.getLastColumns();return this.getRange(0,0,e+1,t+1)}getLastColumns(){return this._worksheet.getLastColumnWithContent()}getLastColumn(){return this._worksheet.getLastColumnWithContent()}getLastRows(){return this._worksheet.getLastRowWithContent()}getLastRow(){return this._worksheet.getLastRowWithContent()}equalTo(e){return e instanceof m.FWorksheet?this._worksheet.getSheetId()===e.getSheetId()&&this._workbook.getUnitId()===e.getWorkbook().getUnitId():!1}insertDefinedName(e,t){const o=this._injector.createInstance(C).setName(e).setRef(t).build();o.localSheetId=this.getSheetId(),this._fWorkbook.insertDefinedNameBuilder(o)}getDefinedNames(){return this._fWorkbook.getDefinedNames().filter(t=>t.getLocalSheetId()===this.getSheetId())}getMergeData(){return this._worksheet.getMergeData().map(e=>this._injector.createInstance(m.FRange,this._workbook,this._worksheet,e))}},m.FWorksheet=Q([f(3,r.Inject(r.Injector)),f(4,r.Inject(a.SheetsSelectionsService)),f(5,r.Inject(r.ILogService)),f(6,r.ICommandService)],m.FWorksheet);var X=Object.defineProperty,Z=Object.getOwnPropertyDescriptor,ee=(h,i,e,t)=>{for(var n=t>1?void 0:t?Z(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&X(i,e,n),n},S=(h,i)=>(e,t)=>i(e,t,h);m.FWorkbook=class extends r.FBaseInitialable{constructor(e,t,n,o,s,d,c,u,l,g){super(t);I(this,"id");this._workbook=e,this._injector=t,this._resourceLoaderService=n,this._selectionManagerService=o,this._univerInstanceService=s,this._commandService=d,this._permissionService=c,this._logService=u,this._localeService=l,this._definedNamesService=g,this.id=this._workbook.getUnitId()}getId(){return this.id}getName(){return this._workbook.name}setName(e){this._workbook.setName(e)}save(){return this._resourceLoaderService.saveUnit(this._workbook.getUnitId())}getSnapshot(){return this._logService.warn("use 'save' instead of 'getSnapshot'"),this.save()}getActiveSheet(){const e=this._workbook.getActiveSheet();return this._injector.createInstance(m.FWorksheet,this,this._workbook,e)}getSheets(){return this._workbook.getSheets().map(e=>this._injector.createInstance(m.FWorksheet,this,this._workbook,e))}create(e,t,n){const o=r.mergeWorksheetSnapshotWithDefault({});o.rowCount=t,o.columnCount=n,o.name=e,o.id=e.toLowerCase().replace(/ /g,"-"),this._commandService.syncExecuteCommand(a.InsertSheetCommand.id,{unitId:this.id,index:this._workbook.getSheets().length,sheet:o}),this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:this._workbook.getSheets()[this._workbook.getSheets().length-1].getSheetId()});const s=this._workbook.getActiveSheet();if(!s)throw new Error("No active sheet found");return this._injector.createInstance(m.FWorksheet,this,this._workbook,s)}getSheetBySheetId(e){const t=this._workbook.getSheetBySheetId(e);return t?this._injector.createInstance(m.FWorksheet,this,this._workbook,t):null}getSheetByName(e){const t=this._workbook.getSheetBySheetName(e);return t?this._injector.createInstance(m.FWorksheet,this,this._workbook,t):null}setActiveSheet(e){return this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:this.id,subUnitId:e.getSheetId()}),e}insertSheet(e){e!=null?this._commandService.syncExecuteCommand(a.InsertSheetCommand.id,{sheet:{name:e}}):this._commandService.syncExecuteCommand(a.InsertSheetCommand.id);const t=this.id,n=this._workbook.getSheets()[this._workbook.getSheets().length-1].getSheetId();this._commandService.syncExecuteCommand(a.SetWorksheetActiveOperation.id,{unitId:t,subUnitId:n});const o=this._workbook.getActiveSheet();if(!o)throw new Error("No active sheet found");return this._injector.createInstance(m.FWorksheet,this,this._workbook,o)}deleteSheet(e){const t=this.id,n=e.getSheetId();return this._commandService.syncExecuteCommand(a.RemoveSheetCommand.id,{unitId:t,subUnitId:n})}undo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.syncExecuteCommand(r.UndoCommand.id),this}redo(){return this._univerInstanceService.focusUnit(this.id),this._commandService.syncExecuteCommand(r.RedoCommand.id),this}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted(t=>{var n;((n=t.params)==null?void 0:n.unitId)===this.id&&e(t)})}onCommandExecuted(e){return this._commandService.onCommandExecuted(t=>{var n;((n=t.params)==null?void 0:n.unitId)===this.id&&e(t)})}onSelectionChange(e){return r.toDisposable(this._selectionManagerService.selectionMoveEnd$.subscribe(t=>{this._univerInstanceService.getCurrentUnitForType(r.UniverInstanceType.UNIVER_SHEET).getUnitId()===this.id&&(t!=null&&t.length?e(t.map(n=>n.range)):e([]))}))}setEditable(e){const t=new a.WorkbookEditablePermission(this._workbook.getUnitId());return this._permissionService.getPermissionPoint(t.id)||this._permissionService.addPermissionPoint(t),this._permissionService.updatePermissionPoint(t.id,e),this}setActiveRange(e){const t=this.getActiveSheet(),n=e.getRange().sheetId||t.getSheetId(),o=n?this._workbook.getSheetBySheetId(n):this._workbook.getActiveSheet(!0);if(!o)throw new Error("No active sheet found");o.getSheetId()!==t.getSheetId()&&this.setActiveSheet(this._injector.createInstance(m.FWorksheet,this,this._workbook,o));const s={unitId:this.getId(),subUnitId:n,selections:[e].map(d=>({range:d.getRange(),primary:a.getPrimaryForRange(d.getRange(),o),style:null}))};return this._commandService.syncExecuteCommand(a.SetSelectionsOperation.id,s),this}getActiveRange(){const e=this._workbook.getActiveSheet(),n=this._selectionManagerService.getCurrentSelections().find(o=>!!o.primary);return n?this._injector.createInstance(m.FRange,this._workbook,e,n.range):null}deleteActiveSheet(){const e=this.getActiveSheet();return this.deleteSheet(e)}duplicateSheet(e){return this._commandService.syncExecuteCommand(a.CopySheetCommand.id,{unitId:e.getWorkbook().getUnitId(),subUnitId:e.getSheetId()}),this._injector.createInstance(m.FWorksheet,this,this._workbook,this._workbook.getActiveSheet())}duplicateActiveSheet(){const e=this.getActiveSheet();return this.duplicateSheet(e)}getNumSheets(){return this._workbook.getSheets().length}getLocale(){return this._localeService.getCurrentLocale()}setLocale(e){this._localeService.setLocale(e)}setSpreadsheetLocale(e){return this._localeService.setLocale(e),this}getUrl(){return location.href}moveSheet(e,t){let n=t;return n<0?n=0:n>this._workbook.getSheets().length-1&&(n=this._workbook.getSheets().length-1),this._commandService.syncExecuteCommand(a.SetWorksheetOrderCommand.id,{unitId:e.getWorkbook().getUnitId(),order:n,subUnitId:e.getSheetId()}),this}moveActiveSheet(e){const t=this.getActiveSheet();return this.moveSheet(t,e)}getPermission(){return this._injector.createInstance(m.FPermission)}getDefinedName(e){const t=this._definedNamesService.getValueByName(this.id,e);return t?this._injector.createInstance(v,{...t,unitId:this.id}):null}getDefinedNames(){const e=this._definedNamesService.getDefinedNameMap(this.id);return e?Object.values(e).map(t=>this._injector.createInstance(v,{...t,unitId:this.id})):[]}insertDefinedName(e,t){const o=this._injector.createInstance(C).setName(e).setRef(t).build();return o.localSheetId=a.SCOPE_WORKBOOK_VALUE_DEFINED_NAME,this.insertDefinedNameBuilder(o),this}deleteDefinedName(e){const t=this.getDefinedName(e);return t?(t.delete(),!0):!1}insertDefinedNameBuilder(e){e.unitId=this.getId(),this._commandService.syncExecuteCommand(a.SetDefinedNameCommand.id,e)}updateDefinedNameBuilder(e){this._commandService.syncExecuteCommand(a.SetDefinedNameCommand.id,e)}getRegisteredRangeThemes(){return this._injector.get(a.SheetRangeThemeService).getRegisteredRangeThemes()}registerRangeTheme(e){this._commandService.syncExecuteCommand(a.RegisterWorksheetRangeThemeStyleCommand.id,{unitId:this.getId(),rangeThemeStyle:e})}unregisterRangeTheme(e){this._commandService.syncExecuteCommand(a.UnregisterWorksheetRangeThemeStyleCommand.id,{unitId:this.getId(),themeName:e})}},m.FWorkbook=ee([S(1,r.Inject(r.Injector)),S(2,r.Inject(r.IResourceLoaderService)),S(3,r.Inject(a.SheetsSelectionsService)),S(4,r.IUniverInstanceService),S(5,r.ICommandService),S(6,r.IPermissionService),S(7,r.ILogService),S(8,r.Inject(r.LocaleService)),S(9,w.IDefinedNamesService)],m.FWorkbook);class te extends r.FUniver{_initialize(i){const e=i.get(r.ICommandService);this.disposeWithMe(e.beforeCommandExecuted(t=>{var n;switch(t.id){case a.InsertSheetCommand.id:{const o=t.params,{unitId:s,index:d,sheet:c}=o||{},u=s?this.getUniverSheet(s):(n=this.getActiveWorkbook)==null?void 0:n.call(this);if(!u)return;const l={workbook:u,index:d,sheet:c};if(this.fireEvent(this.Event.BeforeSheetCreate,l),l.cancel)throw new Error("Sheet create canceled by facade api.");break}}})),this.disposeWithMe(e.onCommandExecuted(t=>{var n;switch(t.id){case a.InsertSheetCommand.id:{const o=t.params,{unitId:s}=o||{},d=s?this.getUniverSheet(s):(n=this.getActiveWorkbook)==null?void 0:n.call(this);if(!d)return;const c=d.getActiveSheet();if(!c)return;const u={workbook:d,worksheet:c};this.fireEvent(this.Event.SheetCreated,u);break}}}))}createUniverSheet(i){const t=this._injector.get(r.IUniverInstanceService).createUnit(r.UniverInstanceType.UNIVER_SHEET,i);return this._injector.createInstance(m.FWorkbook,t)}getActiveUniverSheet(){const i=this._univerInstanceService.getCurrentUnitForType(r.UniverInstanceType.UNIVER_SHEET);return i?this._injector.createInstance(m.FWorkbook,i):null}getActiveWorkbook(){return this.getActiveUniverSheet()}getUniverSheet(i){const e=this._univerInstanceService.getUnit(i,r.UniverInstanceType.UNIVER_SHEET);return e?this._injector.createInstance(m.FWorkbook,e):null}getPermission(){return this._injector.createInstance(m.FPermission)}onUniverSheetCreated(i){const e=this._univerInstanceService.getTypeOfUnitAdded$(r.UniverInstanceType.UNIVER_SHEET).subscribe(t=>{const n=this._injector.createInstance(m.FWorkbook,t);i(n)});return r.toDisposable(e)}newDefinedName(){return this._injector.createInstance(C)}}r.FUniver.extend(te);class E extends r.FEventName{get SheetCreated(){return"SheetCreated"}get BeforeSheetCreate(){return"BeforeSheetCreate"}}r.FEventName.extend(E);var ne=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,oe=(h,i,e,t)=>{for(var n=t>1?void 0:t?ie(i,e):i,o=h.length-1,s;o>=0;o--)(s=h[o])&&(n=(t?s(i,e,n):s(n))||n);return t&&n&&ne(i,e,n),n},re=(h,i)=>(e,t)=>i(e,t,h);m.FSheetHooks=class extends r.FBase{constructor(i){super(),this._injector=i}},m.FSheetHooks=oe([re(0,r.Inject(r.Injector))],m.FSheetHooks),m.FSheetEventName=E,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|