@univerjs/sheets 0.5.3 → 0.5.4

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.
@@ -1,7 +1,15 @@
1
1
  import { ICellData, IStyleData, Nullable, Styles } from '@univerjs/core';
2
+ /**
3
+ *
4
+ * @param styles
5
+ * @param oldVal
6
+ * @param newVal
7
+ */
2
8
  export declare function handleStyle(styles: Styles, oldVal: ICellData, newVal: ICellData): void;
3
9
  /**
4
10
  * Convert old style data for storage
5
11
  * @param style
12
+ * @param oldStyle
13
+ * @param newStyle
6
14
  */
7
15
  export declare function transformStyle(oldStyle: Nullable<IStyleData>, newStyle: Nullable<IStyleData>): Nullable<IStyleData>;
@@ -0,0 +1,33 @@
1
+ import { IPermissionTypes, IRange, Disposable, DisposableCollection, ICommandService, IContextService, IPermissionService, IUniverInstanceService, LocaleService } from '@univerjs/core';
2
+ import { IDefinedNamesService, LexerTreeBuilder } from '@univerjs/engine-formula';
3
+ import { RangeProtectionRuleModel } from '../../model/range-protection-rule.model';
4
+ import { WorksheetProtectionRuleModel } from '../../services/permission/worksheet-permission';
5
+ import { SheetsSelectionsService } from '../../services/selections';
6
+ export declare class SheetPermissionCheckController extends Disposable {
7
+ private readonly _commandService;
8
+ private readonly _univerInstanceService;
9
+ private readonly _permissionService;
10
+ private readonly _selectionManagerService;
11
+ private _rangeProtectionRuleModel;
12
+ private _worksheetProtectionRuleModel;
13
+ private readonly _localeService;
14
+ private readonly _lexerTreeBuilder;
15
+ private readonly _contextService;
16
+ private readonly _definedNamesService;
17
+ disposableCollection: DisposableCollection;
18
+ private _triggerPermissionUIEvent$;
19
+ triggerPermissionUIEvent$: import('rxjs').Observable<string>;
20
+ constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _permissionService: IPermissionService, _selectionManagerService: SheetsSelectionsService, _rangeProtectionRuleModel: RangeProtectionRuleModel, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel, _localeService: LocaleService, _lexerTreeBuilder: LexerTreeBuilder, _contextService: IContextService, _definedNamesService: IDefinedNamesService);
21
+ blockExecuteWithoutPermission(errorMsg: string): void;
22
+ private _getPermissionCheck;
23
+ private _initialize;
24
+ private _commandExecutedListener;
25
+ private _permissionCheckWithInsertRangeMove;
26
+ private _permissionCheckByWorksheetCommand;
27
+ permissionCheckWithoutRange(permissionTypes: IPermissionTypes): boolean;
28
+ permissionCheckWithRanges(permissionTypes: IPermissionTypes, selectionRanges?: IRange[], unitId?: string, subUnitId?: string): boolean;
29
+ private _permissionCheckByMoveCommand;
30
+ private _permissionCheckByMoveRangeCommand;
31
+ private _permissionCheckBySetRangeValue;
32
+ private _permissionCheckWithFormula;
33
+ }
@@ -0,0 +1,29 @@
1
+ import { Disposable, IAuthzIoService, ICommandService, IPermissionService, IUndoRedoService, IUniverInstanceService, UserManagerService } from '@univerjs/core';
2
+ import { RangeProtectionRuleModel } from '../../model/range-protection-rule.model';
3
+ import { RangeProtectionCache } from '../../model/range-protection.cache';
4
+ import { WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '../../services/permission/worksheet-permission';
5
+ import { SheetInterceptorService } from '../../services/sheet-interceptor/sheet-interceptor.service';
6
+ export declare class SheetPermissionInitController extends Disposable {
7
+ private readonly _univerInstanceService;
8
+ private _permissionService;
9
+ private _authzIoService;
10
+ private _rangeProtectionRuleModel;
11
+ private _worksheetProtectionRuleModel;
12
+ private _userManagerService;
13
+ private _worksheetProtectionPointRuleModel;
14
+ private _sheetInterceptorService;
15
+ private _undoRedoService;
16
+ private _commandService;
17
+ private _rangeProtectionCache;
18
+ constructor(_univerInstanceService: IUniverInstanceService, _permissionService: IPermissionService, _authzIoService: IAuthzIoService, _rangeProtectionRuleModel: RangeProtectionRuleModel, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel, _userManagerService: UserManagerService, _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel, _sheetInterceptorService: SheetInterceptorService, _undoRedoService: IUndoRedoService, _commandService: ICommandService, _rangeProtectionCache: RangeProtectionCache);
19
+ private _initRangePermissionFromSnapshot;
20
+ private _initRangePermissionChange;
21
+ initWorkbookPermissionChange(_unitId?: string): Promise<void>;
22
+ private _initWorkbookPermissionFromSnapshot;
23
+ private _initWorksheetPermissionChange;
24
+ private _initWorksheetPermissionPointsChange;
25
+ private _initWorksheetPermissionFromSnapshot;
26
+ private _initUserChange;
27
+ refreshPermission(unitId: string, permissionId: string): void;
28
+ private _refreshPermissionByCollaCreate;
29
+ }
@@ -0,0 +1,13 @@
1
+ import { Disposable, IPermissionService } from '@univerjs/core';
2
+ import { RangeProtectionCache } from '../../model/range-protection.cache';
3
+ import { WorksheetProtectionRuleModel } from '../../services/permission/worksheet-permission';
4
+ import { SheetInterceptorService } from '../../services/sheet-interceptor/sheet-interceptor.service';
5
+ export declare class SheetPermissionViewModelController extends Disposable {
6
+ private _permissionService;
7
+ private _worksheetProtectionRuleModel;
8
+ private _sheetInterceptorService;
9
+ private _rangeProtectionCache;
10
+ constructor(_permissionService: IPermissionService, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel, _sheetInterceptorService: SheetInterceptorService, _rangeProtectionCache: RangeProtectionCache);
11
+ private _initViewModelByRangeInterceptor;
12
+ private _initViewModelBySheetInterceptor;
13
+ }
@@ -7,12 +7,12 @@ export declare class FDefinedNameBuilder {
7
7
  constructor();
8
8
  /**
9
9
  * Sets the name of the defined name builder.
10
- * @param name The name of the defined name.
11
- * @returns The defined name builder.
10
+ * @param {string} name The name of the defined name.
11
+ * @returns {FDefinedNameBuilder} The defined name builder.
12
12
  * @example
13
13
  * ```ts
14
- * const workbook = UniverAPI.getActiveWorkbook();
15
- * const definedNameBuilder = UniverAPI.newDefinedName()
14
+ * const workbook = univerAPI.getActiveWorkbook();
15
+ * const definedNameBuilder = univerAPI.newDefinedName()
16
16
  * .setName('MyDefinedName')
17
17
  * .build();
18
18
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
@@ -21,12 +21,12 @@ export declare class FDefinedNameBuilder {
21
21
  setName(name: string): FDefinedNameBuilder;
22
22
  /**
23
23
  * Sets the formula of the defined name builder.
24
- * @param formula The formula of the defined name.
25
- * @returns The defined name builder.
24
+ * @param {string }formula The formula of the defined name.
25
+ * @returns {FDefinedNameBuilder} The defined name builder.
26
26
  * @example
27
27
  * ```ts
28
- * const workbook = UniverAPI.getActiveWorkbook();
29
- * const definedNameBuilder = UniverAPI.newDefinedName()
28
+ * const workbook = univerAPI.getActiveWorkbook();
29
+ * const definedNameBuilder = univerAPI.newDefinedName()
30
30
  * .setFormula('SUM(Sheet1!$A$1)')
31
31
  * .setName('MyDefinedName')
32
32
  * .build();
@@ -36,12 +36,12 @@ export declare class FDefinedNameBuilder {
36
36
  setFormula(formula: string): FDefinedNameBuilder;
37
37
  /**
38
38
  * Sets the reference of the defined name builder.
39
- * @param refString The reference of the defined name.
40
- * @returns The defined name builder.
39
+ * @param {string} a1Notation The reference of the defined name.
40
+ * @returns {FDefinedNameBuilder} The defined name builder.
41
41
  * @example
42
42
  * ```ts
43
- * const workbook = UniverAPI.getActiveWorkbook();
44
- * const definedNameBuilder = UniverAPI.newDefinedName()
43
+ * const workbook = univerAPI.getActiveWorkbook();
44
+ * const definedNameBuilder = univerAPI.newDefinedName()
45
45
  * .setRef('Sheet1!$A$1')
46
46
  * .build();
47
47
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
@@ -50,15 +50,15 @@ export declare class FDefinedNameBuilder {
50
50
  setRef(a1Notation: string): FDefinedNameBuilder;
51
51
  /**
52
52
  * Sets the reference of the defined name builder by range .
53
- * @param row The start row of the range.
54
- * @param column The start column of the range.
55
- * @param numRows The number of rows in the range.
56
- * @param numColumns The number of columns in the range.
57
- * @returns The defined name builder.
53
+ * @param {number} row The start row of the range.
54
+ * @param {number} column The start column of the range.
55
+ * @param {number} numRows The number of rows in the range.
56
+ * @param {number} numColumns The number of columns in the range.
57
+ * @returns {FDefinedNameBuilder} The defined name builder.
58
58
  * @example
59
59
  * ```ts
60
- * const workbook = UniverAPI.getActiveWorkbook();
61
- * const definedNameBuilder = UniverAPI.newDefinedName()
60
+ * const workbook = univerAPI.getActiveWorkbook();
61
+ * const definedNameBuilder = univerAPI.newDefinedName()
62
62
  * .setRefByRange(1, 3, 2, 5)
63
63
  * .build();
64
64
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
@@ -67,12 +67,12 @@ export declare class FDefinedNameBuilder {
67
67
  setRefByRange(row: number, column: number, numRows: number, numColumns: number): FDefinedNameBuilder;
68
68
  /**
69
69
  * Sets the comment of the defined name builder.
70
- * @param comment The comment of the defined name.
71
- * @returns The defined name builder.
70
+ * @param {string} comment The comment of the defined name.
71
+ * @returns {FDefinedNameBuilder} The defined name builder.
72
72
  * @example
73
73
  * ```ts
74
- * const workbook = UniverAPI.getActiveWorkbook();
75
- * const definedNameBuilder = UniverAPI.newDefinedName()
74
+ * const workbook = univerAPI.getActiveWorkbook();
75
+ * const definedNameBuilder = univerAPI.newDefinedName()
76
76
  * .setComment('This is a comment')
77
77
  * .build();
78
78
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
@@ -81,12 +81,12 @@ export declare class FDefinedNameBuilder {
81
81
  setComment(comment: string): FDefinedNameBuilder;
82
82
  /**
83
83
  * Sets the hidden status of the defined name builder.
84
- * @param hidden The hidden status of the defined name.
85
- * @returns The defined name builder.
84
+ * @param {boolean} hidden The hidden status of the defined name.
85
+ * @returns {FDefinedNameBuilder} The defined name builder.
86
86
  * @example
87
87
  * ```ts
88
- * const workbook = UniverAPI.getActiveWorkbook();
89
- * const definedNameBuilder = UniverAPI.newDefinedName()
88
+ * const workbook = univerAPI.getActiveWorkbook();
89
+ * const definedNameBuilder = univerAPI.newDefinedName()
90
90
  * .setHidden(true)
91
91
  * .build();
92
92
  * workbook.insertDefinedNameBuilder(definedNameBuilder);
@@ -95,11 +95,11 @@ export declare class FDefinedNameBuilder {
95
95
  setHidden(hidden: boolean): FDefinedNameBuilder;
96
96
  /**
97
97
  * Builds the defined name.
98
- * @returns The defined name mutation parameter.
98
+ * @returns {FDefinedNameBuilder} The defined name mutation parameter.
99
99
  * @example
100
100
  * ```ts
101
- * const workbook = UniverAPI.getActiveWorkbook();
102
- * const definedNameBuilder = UniverAPI.newDefinedName()
101
+ * const workbook = univerAPI.getActiveWorkbook();
102
+ * const definedNameBuilder = univerAPI.newDefinedName()
103
103
  * .setRef('Sheet1!$A$1')
104
104
  * .setName('MyDefinedName')
105
105
  * .build();
@@ -124,10 +124,10 @@ export declare class FDefinedName extends FBase {
124
124
  private _apply;
125
125
  /**
126
126
  * Gets the name of the defined name.
127
- * @returns The name of the defined name.
127
+ * @returns {string} The name of the defined name.
128
128
  * @example
129
129
  * ```ts
130
- * const workbook = UniverAPI.getActiveWorkbook();
130
+ * const workbook = univerAPI.getActiveWorkbook();
131
131
  * const definedName = workbook.getDefinedNames[0];
132
132
  * console.log(definedName.getName());
133
133
  * ```
@@ -135,10 +135,10 @@ export declare class FDefinedName extends FBase {
135
135
  getName(): string;
136
136
  /**
137
137
  * Sets the name of the defined name.
138
- * @param name The name of the defined name.
138
+ * @param {string} name The name of the defined name.
139
139
  * @example
140
140
  * ```ts
141
- * const workbook = UniverAPI.getActiveWorkbook();
141
+ * const workbook = univerAPI.getActiveWorkbook();
142
142
  * const definedName = workbook.getDefinedName('MyDefinedName');
143
143
  * definedName.setName('NewDefinedName');
144
144
  * ```
@@ -146,10 +146,10 @@ export declare class FDefinedName extends FBase {
146
146
  setName(name: string): void;
147
147
  /**
148
148
  * Sets the formula of the defined name.
149
- * @param formula The formula of the defined name.
149
+ * @param {string} formula The formula of the defined name.
150
150
  * @example
151
151
  * ```ts
152
- * const workbook = UniverAPI.getActiveWorkbook();
152
+ * const workbook = univerAPI.getActiveWorkbook();
153
153
  * const definedName = workbook.getDefinedName('MyDefinedName');
154
154
  * definedName.setFormula('SUM(Sheet1!$A$1)');
155
155
  * ```
@@ -157,10 +157,10 @@ export declare class FDefinedName extends FBase {
157
157
  setFormula(formula: string): void;
158
158
  /**
159
159
  * Sets the reference of the defined name.
160
- * @param refString The reference of the defined name.
160
+ * @param {string} refString The reference of the defined name.
161
161
  * @example
162
162
  * ```ts
163
- * const workbook = UniverAPI.getActiveWorkbook();
163
+ * const workbook = univerAPI.getActiveWorkbook();
164
164
  * const definedName = workbook.getDefinedNames[0];
165
165
  * definedName.setRef('Sheet1!$A$1');
166
166
  * ```
@@ -168,10 +168,10 @@ export declare class FDefinedName extends FBase {
168
168
  setRef(refString: string): void;
169
169
  /**
170
170
  * Gets the reference of the defined name.
171
- * @returns The reference of the defined name.
171
+ * @returns {string} The reference of the defined name.
172
172
  * @example
173
173
  * ```ts
174
- * const workbook = UniverAPI.getActiveWorkbook();
174
+ * const workbook = univerAPI.getActiveWorkbook();
175
175
  * const definedName = workbook.getDefinedNames[0];
176
176
  * console.log(definedName.getFormulaOrRefString());
177
177
  * ```
@@ -179,13 +179,13 @@ export declare class FDefinedName extends FBase {
179
179
  getFormulaOrRefString(): string;
180
180
  /**
181
181
  * Sets the reference of the defined name by range.
182
- * @param row The start row of the range.
183
- * @param column The start column of the range.
184
- * @param numRows The number of rows in the range.
185
- * @param numColumns The number of columns in the range.
182
+ * @param {number} row The start row of the range.
183
+ * @param {number} column The start column of the range.
184
+ * @param {number} numRows The number of rows in the range.
185
+ * @param {number} numColumns The number of columns in the range.
186
186
  * @example
187
187
  * ```ts
188
- * const workbook = UniverAPI.getActiveWorkbook();
188
+ * const workbook = univerAPI.getActiveWorkbook();
189
189
  * const definedName = workbook.getDefinedNames[0];
190
190
  * definedName.setRefByRange(1, 3, 2, 5);
191
191
  * ```
@@ -193,10 +193,10 @@ export declare class FDefinedName extends FBase {
193
193
  setRefByRange(row: number, column: number, numRows: number, numColumns: number): void;
194
194
  /**
195
195
  * Gets the comment of the defined name.
196
- * @returns The comment of the defined name.
196
+ * @returns {string | undefined} The comment of the defined name.
197
197
  * @example
198
198
  * ```ts
199
- * const workbook = UniverAPI.getActiveWorkbook();
199
+ * const workbook = univerAPI.getActiveWorkbook();
200
200
  * const definedName = workbook.getDefinedNames[0];
201
201
  * console.log(definedName.getComment());
202
202
  * ```
@@ -204,10 +204,10 @@ export declare class FDefinedName extends FBase {
204
204
  getComment(): string | undefined;
205
205
  /**
206
206
  * Sets the comment of the defined name.
207
- * @param comment The comment of the defined name.
207
+ * @param {string} comment The comment of the defined name.
208
208
  * @example
209
209
  * ```ts
210
- * const workbook = UniverAPI.getActiveWorkbook();
210
+ * const workbook = univerAPI.getActiveWorkbook();
211
211
  * const definedName = workbook.getDefinedNames[0];
212
212
  * definedName.setComment('This is a comment');
213
213
  * ```
@@ -215,10 +215,10 @@ export declare class FDefinedName extends FBase {
215
215
  setComment(comment: string): void;
216
216
  /**
217
217
  * Sets the scope of the defined name to the worksheet.
218
- * @param worksheet The worksheet to set the scope to.
218
+ * @param {FWorksheet} worksheet The worksheet to set the scope to.
219
219
  * @example
220
220
  * ```ts
221
- * const workbook = UniverAPI.getActiveWorkbook();
221
+ * const workbook = univerAPI.getActiveWorkbook();
222
222
  * const worksheet = workbook.getWorksheets[0];
223
223
  * const definedName = workbook.getDefinedNames[0];
224
224
  * definedName.setScopeToWorksheet(worksheet);
@@ -229,7 +229,7 @@ export declare class FDefinedName extends FBase {
229
229
  * Sets the scope of the defined name to the workbook.
230
230
  * @example
231
231
  * ```ts
232
- * const workbook = UniverAPI.getActiveWorkbook();
232
+ * const workbook = univerAPI.getActiveWorkbook();
233
233
  * const definedName = workbook.getDefinedNames[0];
234
234
  * definedName.setScopeToWorkbook();
235
235
  * ```
@@ -237,10 +237,10 @@ export declare class FDefinedName extends FBase {
237
237
  setScopeToWorkbook(): void;
238
238
  /**
239
239
  * Sets the hidden status of the defined name.
240
- * @param hidden The hidden status of the defined name.
240
+ * @param {boolean} hidden The hidden status of the defined name.
241
241
  * @example
242
242
  * ```ts
243
- * const workbook = UniverAPI.getActiveWorkbook();
243
+ * const workbook = univerAPI.getActiveWorkbook();
244
244
  * const definedName = workbook.getDefinedNames[0];
245
245
  * definedName.setHidden(true);
246
246
  * ```
@@ -250,7 +250,7 @@ export declare class FDefinedName extends FBase {
250
250
  * Deletes the defined name.
251
251
  * @example
252
252
  * ```ts
253
- * const workbook = UniverAPI.getActiveWorkbook();
253
+ * const workbook = univerAPI.getActiveWorkbook();
254
254
  * const definedName = workbook.getDefinedNames[0];
255
255
  * definedName.delete();
256
256
  * ```
@@ -258,10 +258,10 @@ export declare class FDefinedName extends FBase {
258
258
  delete(): void;
259
259
  /**
260
260
  * Gets the local sheet id of the defined name.
261
- * @returns The local sheet id of the defined name.
261
+ * @returns {string | undefined} The local sheet id of the defined name.
262
262
  * @example
263
263
  * ```ts
264
- * const workbook = UniverAPI.getActiveWorkbook();
264
+ * const workbook = univerAPI.getActiveWorkbook();
265
265
  * const definedName = workbook.getDefinedNames[0];
266
266
  * console.log(definedName.getLocalSheetId());
267
267
  * ```
@@ -269,10 +269,10 @@ export declare class FDefinedName extends FBase {
269
269
  getLocalSheetId(): string | undefined;
270
270
  /**
271
271
  * Checks if the defined name is in the workbook scope.
272
- * @returns True if the defined name is in the workbook scope, false otherwise.
272
+ * @returns {boolean} True if the defined name is in the workbook scope, false otherwise.
273
273
  * @example
274
274
  * ```ts
275
- * const workbook = UniverAPI.getActiveWorkbook();
275
+ * const workbook = univerAPI.getActiveWorkbook();
276
276
  * const definedName = workbook.getDefinedNames[0];
277
277
  * console.log(definedName.isWorkbookScope());
278
278
  * ```
@@ -280,10 +280,10 @@ export declare class FDefinedName extends FBase {
280
280
  isWorkbookScope(): boolean;
281
281
  /**
282
282
  * Converts the defined name to a defined name builder.
283
- * @returns The defined name builder.
283
+ * @returns {FDefinedNameBuilder} The defined name builder.
284
284
  * @example
285
285
  * ```ts
286
- * const workbook = UniverAPI.getActiveWorkbook();
286
+ * const workbook = univerAPI.getActiveWorkbook();
287
287
  * const definedName = workbook.getDefinedNames[0];
288
288
  * const definedNameBuilder = definedName.toBuilder();
289
289
  * const param definedNameBuilder.setName('NewDefinedName').setFormula('SUM(Sheet1!$A$1)').build();
@@ -1,26 +1,110 @@
1
- import { IEventBase, IWorksheetData, FEventName } from '@univerjs/core';
1
+ import { IEventBase, IWorkbookData, IWorksheetData, UniverInstanceType, FEventName } from '@univerjs/core';
2
2
  import { FWorkbook } from './f-workbook';
3
3
  import { FWorksheet } from './f-worksheet';
4
4
  export interface IFSheetEventMixin {
5
+ /**
6
+ * Event fired after a sheet is created
7
+ * @see {@link ISheetCreatedEventParams}
8
+ * @example
9
+ * ```ts
10
+ * univerAPI.addEvent(univerAPI.event.SheetCreated, (params) => {
11
+ * const { workbook, worksheet } = params;
12
+ * console.log('unit created', params);
13
+ * });
14
+ * ```
15
+ */
5
16
  get SheetCreated(): 'SheetCreated';
17
+ /**
18
+ * Event fired before a sheet is created
19
+ * @see {@link IBeforeSheetCreateEventParams}
20
+ * @example
21
+ * ```ts
22
+ * univerAPI.addEvent(univerAPI.event.BeforeSheetCreate, (params) => {
23
+ * const { workbook, index, sheet } = params;
24
+ * console.log('unit created', params);
25
+ * });
26
+ * ```
27
+ */
6
28
  get BeforeSheetCreate(): 'BeforeSheetCreate';
29
+ /**
30
+ * Event fired after a workbook is created
31
+ * @see {@link IWorkbookCreateParam}
32
+ * @example
33
+ * ```ts
34
+ * univerAPI.addEvent(univerAPI.event.WorkbookCreated, (params) => {
35
+ * const { unitId, type, workbook, unit } = params;
36
+ * console.log('unit created', params);
37
+ * });
38
+ * ```
39
+ */
40
+ get WorkbookCreated(): 'WorkbookCreated';
41
+ /**
42
+ * Event fired after a workbook is disposed
43
+ * @see {@link IWorkbookDisposedEvent}
44
+ * @example
45
+ * ```ts
46
+ * univerAPI.addEvent(univerAPI.event.WorkbookDisposed, (params) => {
47
+ * const { unitId, unitType, snapshot } = params;
48
+ * console.log('unit disposed', params);
49
+ * });
50
+ * ```
51
+ */
52
+ get WorkbookDisposed(): 'WorkbookDisposed';
53
+ }
54
+ export interface IWorkbookCreateParam extends IEventBase {
55
+ unitId: string;
56
+ type: UniverInstanceType.UNIVER_SHEET;
57
+ workbook: FWorkbook;
58
+ unit: FWorkbook;
59
+ }
60
+ export interface IWorkbookDisposedEvent extends IEventBase {
61
+ unitId: string;
62
+ unitType: UniverInstanceType.UNIVER_SHEET;
63
+ snapshot: IWorkbookData;
7
64
  }
8
65
  export declare class FSheetEventName extends FEventName implements IFSheetEventMixin {
9
66
  get SheetCreated(): 'SheetCreated';
10
67
  get BeforeSheetCreate(): 'BeforeSheetCreate';
68
+ get WorkbookCreated(): 'WorkbookCreated';
69
+ get WorkbookDisposed(): 'WorkbookDisposed';
11
70
  }
71
+ /**
72
+ * Event interface triggered before creating a new worksheet
73
+ * @interface IBeforeSheetCreateEventParams
74
+ * @augments {IEventBase}
75
+ */
12
76
  export interface IBeforeSheetCreateEventParams extends IEventBase {
77
+ /** The workbook instance */
13
78
  workbook: FWorkbook;
79
+ /** Optional index where the new sheet will be inserted */
14
80
  index?: number;
81
+ /** Optional initial worksheet data */
15
82
  sheet?: IWorksheetData;
16
83
  }
84
+ /**
85
+ * Event interface triggered after a worksheet is created
86
+ * @interface ISheetCreatedEventParams
87
+ * @augments {IEventBase}
88
+ */
17
89
  export interface ISheetCreatedEventParams extends IEventBase {
90
+ /** The workbook instance */
18
91
  workbook: FWorkbook;
92
+ /** The newly created worksheet */
19
93
  worksheet: FWorksheet;
20
94
  }
95
+ /**
96
+ * Configuration interface for sheet-related events
97
+ * @interface ISheetEventParamConfig
98
+ */
21
99
  export interface ISheetEventParamConfig {
100
+ /** Event fired after a worksheet is created */
22
101
  SheetCreated: ISheetCreatedEventParams;
102
+ /** Event fired before creating a worksheet */
23
103
  BeforeSheetCreate: IBeforeSheetCreateEventParams;
104
+ /** Event fired after a workbook is created */
105
+ WorkbookCreated: IWorkbookCreateParam;
106
+ /** Event fired when a workbook is disposed */
107
+ WorkbookDisposed: IWorkbookDisposedEvent;
24
108
  }
25
109
  declare module '@univerjs/core' {
26
110
  interface FEventName extends IFSheetEventMixin {
@@ -1,4 +1,5 @@
1
1
  import { IRange, RangePermissionPointConstructor, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor, FBase, IAuthzIoService, ICommandService, Injector, IPermissionService } from '@univerjs/core';
2
+ import { Observable } from 'rxjs';
2
3
  import { RangeProtectionRuleModel, WorkbookEditablePermission, WorksheetEditPermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetViewPermission } from '@univerjs/sheets';
3
4
  export declare class FPermission extends FBase {
4
5
  protected readonly _injector: Injector;
@@ -50,39 +51,34 @@ export declare class FPermission extends FBase {
50
51
  RangeProtectionPermissionEditPoint: typeof import('@univerjs/sheets').RangeProtectionPermissionEditPoint;
51
52
  RangeProtectionPermissionViewPoint: typeof import('@univerjs/sheets').RangeProtectionPermissionViewPoint;
52
53
  };
54
+ rangeRuleChangedAfterAuth$: Observable<unknown>;
55
+ sheetRuleChangedAfterAuth$: Observable<unknown>;
53
56
  constructor(_injector: Injector, _commandService: ICommandService, _permissionService: IPermissionService, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel, _rangeProtectionRuleModel: RangeProtectionRuleModel, _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel, _authzIoService: IAuthzIoService);
54
57
  /**
55
58
  * Configures a specific permission point for a workbook.
56
59
  *
57
60
  * This function sets or updates a permission point for a workbook identified by `unitId`.
58
61
  * It creates a new permission point if it does not already exist, and updates the point with the provided value.
59
- *
60
62
  * @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
61
63
  * @param {WorkbookPermissionPointConstructor} FPointClass - The constructor function for creating a permission point instance. Other point constructors can See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
62
64
  * @param {boolean} value - The boolean value to determine whether the permission point is enabled or disabled.
63
- *
64
65
  */
65
66
  setWorkbookPermissionPoint(unitId: string, FPointClass: WorkbookPermissionPointConstructor, value: boolean): void;
66
67
  /**
67
68
  * This function is used to set whether the workbook can be edited
68
- *
69
69
  * @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
70
70
  * @param {boolean} value - A value that controls whether the workbook can be edited
71
- *
72
71
  */
73
72
  setWorkbookEditPermission(unitId: string, value: boolean): void;
74
73
  /**
75
74
  * This function is used to add a base permission for a worksheet.
76
- *
77
75
  * @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
78
76
  * @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
79
- *
80
77
  * @returns {Promise<string | undefined>} - Returns the `permissionId` if the permission is successfully added. If the operation fails or no result is returned, it resolves to `undefined`.
81
78
  */
82
79
  addWorksheetBasePermission(unitId: string, subUnitId: string): Promise<string | undefined>;
83
80
  /**
84
81
  * Delete the entire table protection set for the worksheet and reset the point permissions of the worksheet to true
85
- *
86
82
  * @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
87
83
  * @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
88
84
  */
@@ -90,23 +86,19 @@ export declare class FPermission extends FBase {
90
86
  /**
91
87
  * Sets the worksheet permission point by updating or adding the permission point for the worksheet.
92
88
  * If the worksheet doesn't have a base permission, it creates one to used render
93
- *
94
89
  * @param {string} unitId - The unique identifier of the workbook.
95
90
  * @param {string} subUnitId - The unique identifier of the worksheet.
96
91
  * @param {WorkSheetPermissionPointConstructor} FPointClass - The constructor for the permission point class.
97
92
  * See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
98
93
  * @param {boolean} value - The new permission value to be set for the worksheet.
99
- *
100
94
  * @returns {Promise<string | undefined>} - Returns the `permissionId` if the permission point is successfully set or created. If no permission is set, it resolves to `undefined`.
101
95
  */
102
96
  setWorksheetPermissionPoint(unitId: string, subUnitId: string, FPointClass: WorkSheetPermissionPointConstructor, value: boolean): Promise<string | undefined>;
103
97
  /**
104
98
  * Adds a range protection to the worksheet.
105
- *
106
99
  * @param {string} unitId - The unique identifier of the workbook.
107
100
  * @param {string} subUnitId - The unique identifier of the worksheet.
108
101
  * @param {IRange[]} ranges - The ranges to be protected.
109
- *
110
102
  * @returns {Promise<{ permissionId: string, ruleId: string } | undefined>} - Returns an object containing the `permissionId` and `ruleId` if the range protection is successfully added. If the operation fails or no result is returned, it resolves to `undefined`. permissionId is used to stitch permission point ID,ruleId is used to store permission rules
111
103
  */
112
104
  addRangeBaseProtection(unitId: string, subUnitId: string, ranges: IRange[]): Promise<{
@@ -115,7 +107,6 @@ export declare class FPermission extends FBase {
115
107
  } | undefined>;
116
108
  /**
117
109
  * Removes the range protection from the worksheet.
118
- *
119
110
  * @param {string} unitId - The unique identifier of the workbook.
120
111
  * @param {string} subUnitId - The unique identifier of the worksheet.
121
112
  * @param {string[]} ruleIds - The rule IDs of the range protection to be removed.
@@ -123,7 +114,6 @@ export declare class FPermission extends FBase {
123
114
  removeRangeProtection(unitId: string, subUnitId: string, ruleIds: string[]): void;
124
115
  /**
125
116
  * Modify the permission points of a custom area
126
- *
127
117
  * @param {string} unitId - The unique identifier of the workbook.
128
118
  * @param {string} subUnitId - The unique identifier of the worksheet within the workbook.
129
119
  * @param {string} permissionId - The unique identifier of the permission that controls access to the range.
@@ -138,17 +128,10 @@ export declare class FPermission extends FBase {
138
128
  * This method finds the rule by unitId, subUnitId, and ruleId, and updates the rule with the provided ranges.
139
129
  * It checks for overlaps with existing ranges in the same subunit and shows an error message if any overlap is detected.
140
130
  * If no overlap is found, it executes the command to update the range protection with the new ranges.
141
- *
142
131
  * @param {string} unitId - The unique identifier of the workbook.
143
132
  * @param {string} subUnitId - The unique identifier of the worksheet within the workbook.
144
133
  * @param {string} ruleId - The ruleId of the range protection rule that is being updated.
145
134
  * @param {IRange[]} ranges - The array of new ranges to be set for the range protection rule.
146
135
  */
147
136
  setRangeProtectionRanges(unitId: string, subUnitId: string, ruleId: string, ranges: IRange[]): void;
148
- /**
149
- * Set visibility of unauthorized pop-up window
150
- *
151
- * @param {boolean} visible
152
- */
153
- setPermissionDialogVisible(visible: boolean): void;
154
137
  }