@univerjs/sheets 0.5.4 → 0.5.5-experimental.20250123-34738ff
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/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +2664 -1499
- package/lib/es/index.js +9211 -8683
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/lib/types/basics/const/command-listener-const.d.ts +149 -13
- package/lib/types/commands/commands/remove-sheet.command.d.ts +1 -1
- package/lib/types/commands/commands/split-text-to-columns.command.d.ts +1 -1
- package/lib/types/commands/operations/selection.operation.d.ts +1 -0
- package/lib/types/commands/utils/selection-command-util.d.ts +1 -1
- package/lib/types/controllers/config.schema.d.ts +4 -0
- package/lib/types/facade/f-defined-name.d.ts +22 -16
- package/lib/types/facade/f-enum.d.ts +24 -0
- package/lib/types/facade/f-event.d.ts +474 -24
- package/lib/types/facade/f-permission.d.ts +141 -9
- package/lib/types/facade/f-range.d.ts +416 -98
- package/lib/types/facade/f-selection.d.ts +27 -1
- package/lib/types/facade/f-sheet-hooks.d.ts +3 -0
- package/lib/types/facade/f-univer.d.ts +39 -3
- package/lib/types/facade/f-workbook.d.ts +57 -60
- package/lib/types/facade/f-worksheet.d.ts +654 -209
- package/lib/types/facade/index.d.ts +2 -0
- package/lib/types/index.d.ts +2 -1
- package/lib/types/model/range-protection-rule.model.d.ts +1 -1
- package/lib/types/model/range-theme-util.d.ts +3 -3
- package/lib/types/services/permission/permission-point/const.d.ts +117 -4
- package/lib/types/services/permission/range-permission/range-protection.ref-range.d.ts +1 -1
- package/lib/types/services/permission/range-permission/range-protection.service.d.ts +1 -1
- package/lib/types/services/permission/worksheet-permission/worksheet-permission-rule.model.d.ts +1 -1
- package/lib/types/services/selections/selection-data-model.d.ts +7 -7
- package/lib/types/services/selections/selection.service.d.ts +4 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +8 -8
- package/LICENSE +0 -176
- package/lib/types/basics/__tests__/cell-type.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/cell-value.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/expand.data.d.ts +0 -2
- package/lib/types/basics/__tests__/expand.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/rangeMerge.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/row-column-value.spec.d.ts +0 -16
- package/lib/types/basics/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/add-merge-command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/clear-selection.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/copy-worksheet.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +0 -7
- package/lib/types/commands/commands/__tests__/delete-range.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/insert-range.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/insert-remove-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/move-range-commands.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/move-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/range-template-command.sepc.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/remove-rows-cols.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/remove-sheet.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-border.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-col-data.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-col-width.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-frozen.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-gridlines-command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-range-values.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-col-visible.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-data.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-row-height.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-style.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-tab-color.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-default-style.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-hide.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-name.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-order.command.spec.d.ts +0 -16
- package/lib/types/commands/commands/__tests__/set-worksheet-show.command.spec.d.ts +0 -16
- package/lib/types/commands/mutations/__tests__/create-command-test-bed.d.ts +0 -8
- package/lib/types/commands/mutations/__tests__/move-rows-cols.mutation.spec.d.ts +0 -16
- package/lib/types/commands/mutations/__tests__/remove-row-col.mutation.spec.d.ts +0 -16
- package/lib/types/controllers/__tests__/util.d.ts +0 -13
- package/lib/types/facade/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/services/__tests__/move-active-cell.spec.d.ts +0 -16
- package/lib/types/services/__tests__/numfmt.service.test.d.ts +0 -16
- package/lib/types/services/__tests__/ref-range.setvice.spec.d.ts +0 -16
- package/lib/types/services/__tests__/util.d.ts +0 -14
- package/lib/types/services/ref-range/__tests__/__testing__.d.ts +0 -14
- package/lib/types/services/ref-range/__tests__/ref-range.service.spec.d.ts +0 -13
- package/lib/types/services/ref-range/__tests__/utils.spec.d.ts +0 -16
- package/lib/types/services/ref-range/__tests__/watch-range.spec.d.ts +0 -16
- package/lib/types/services/sheet-interceptor/__tests__/create-core-test-bed.d.ts +0 -13
- package/lib/types/services/sheet-interceptor/__tests__/sheet-interceptor.service.spec.d.ts +0 -16
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RangePermissionPointConstructor, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor, FBase, IAuthzIoService, ICommandService, Injector, IPermissionService } from '@univerjs/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { FRange } from './f-range';
|
|
3
4
|
import { RangeProtectionRuleModel, WorkbookEditablePermission, WorksheetEditPermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetViewPermission } from '@univerjs/sheets';
|
|
5
|
+
/**
|
|
6
|
+
* @description Used to generate permission instances to control permissions for the entire workbook
|
|
7
|
+
* @hideconstructor
|
|
8
|
+
*/
|
|
4
9
|
export declare class FPermission extends FBase {
|
|
5
10
|
protected readonly _injector: Injector;
|
|
6
11
|
protected readonly _commandService: ICommandService;
|
|
@@ -9,6 +14,9 @@ export declare class FPermission extends FBase {
|
|
|
9
14
|
protected readonly _rangeProtectionRuleModel: RangeProtectionRuleModel;
|
|
10
15
|
protected readonly _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel;
|
|
11
16
|
protected readonly _authzIoService: IAuthzIoService;
|
|
17
|
+
/**
|
|
18
|
+
* Permission point definition, can read the point constructor want to modify from here
|
|
19
|
+
*/
|
|
12
20
|
permissionPointsDefinition: {
|
|
13
21
|
WorkbookCommentPermission: typeof import('@univerjs/sheets').WorkbookCommentPermission;
|
|
14
22
|
WorkbookCopyPermission: typeof import('@univerjs/sheets').WorkbookCopyPermission;
|
|
@@ -40,8 +48,6 @@ export declare class FPermission extends FBase {
|
|
|
40
48
|
WorksheetInsertRowPermission: typeof import('@univerjs/sheets').WorksheetInsertRowPermission;
|
|
41
49
|
WorksheetManageCollaboratorPermission: typeof import('@univerjs/sheets').WorksheetManageCollaboratorPermission;
|
|
42
50
|
WorksheetPivotTablePermission: typeof import('@univerjs/sheets').WorksheetPivotTablePermission;
|
|
43
|
-
WorksheetSelectProtectedCellsPermission: typeof import('@univerjs/sheets').WorksheetSelectProtectedCellsPermission;
|
|
44
|
-
WorksheetSelectUnProtectedCellsPermission: typeof import('@univerjs/sheets').WorksheetSelectUnProtectedCellsPermission;
|
|
45
51
|
WorksheetSetCellStylePermission: typeof import('@univerjs/sheets').WorksheetSetCellStylePermission;
|
|
46
52
|
WorksheetSetCellValuePermission: typeof import('@univerjs/sheets').WorksheetSetCellValuePermission;
|
|
47
53
|
WorksheetSetColumnStylePermission: typeof import('@univerjs/sheets').WorksheetSetColumnStylePermission;
|
|
@@ -51,36 +57,83 @@ export declare class FPermission extends FBase {
|
|
|
51
57
|
RangeProtectionPermissionEditPoint: typeof import('@univerjs/sheets').RangeProtectionPermissionEditPoint;
|
|
52
58
|
RangeProtectionPermissionViewPoint: typeof import('@univerjs/sheets').RangeProtectionPermissionViewPoint;
|
|
53
59
|
};
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
/**
|
|
61
|
+
* An observable object used to monitor permission change events within a range, thereby triggering corresponding subsequent processing.
|
|
62
|
+
*/
|
|
63
|
+
rangeRuleChangedAfterAuth$: Observable<string>;
|
|
64
|
+
/**
|
|
65
|
+
* An observable object used to monitor permission change events within a worksheet, thereby triggering corresponding subsequent processing.
|
|
66
|
+
*/
|
|
67
|
+
sheetRuleChangedAfterAuth$: Observable<string>;
|
|
56
68
|
constructor(_injector: Injector, _commandService: ICommandService, _permissionService: IPermissionService, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel, _rangeProtectionRuleModel: RangeProtectionRuleModel, _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel, _authzIoService: IAuthzIoService);
|
|
57
69
|
/**
|
|
58
70
|
* Configures a specific permission point for a workbook.
|
|
59
|
-
*
|
|
60
71
|
* This function sets or updates a permission point for a workbook identified by `unitId`.
|
|
61
72
|
* It creates a new permission point if it does not already exist, and updates the point with the provided value.
|
|
62
73
|
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
63
74
|
* @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.
|
|
64
75
|
* @param {boolean} value - The boolean value to determine whether the permission point is enabled or disabled.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
80
|
+
* const permission = workbook.getPermission();
|
|
81
|
+
* const unitId = workbook.getId();
|
|
82
|
+
* permission.setWorkbookPermissionPoint(unitId, permission.permissionPointsDefinition.WorkbookEditablePermission, false)
|
|
83
|
+
* ```
|
|
65
84
|
*/
|
|
66
85
|
setWorkbookPermissionPoint(unitId: string, FPointClass: WorkbookPermissionPointConstructor, value: boolean): void;
|
|
67
86
|
/**
|
|
68
87
|
* This function is used to set whether the workbook can be edited
|
|
69
88
|
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
70
89
|
* @param {boolean} value - A value that controls whether the workbook can be edited
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
94
|
+
* const permission = workbook.getPermission();
|
|
95
|
+
* const unitId = workbook.getId();
|
|
96
|
+
* permission.setWorkbookEditPermission(unitId, false);
|
|
97
|
+
* ```
|
|
71
98
|
*/
|
|
72
99
|
setWorkbookEditPermission(unitId: string, value: boolean): void;
|
|
73
100
|
/**
|
|
74
101
|
* This function is used to add a base permission for a worksheet.
|
|
102
|
+
* Note that after adding, only the background mask of the permission module will be rendered. If you want to modify the function permissions,
|
|
103
|
+
* you need to modify the permission points with the permissionId returned by this function.
|
|
75
104
|
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
76
105
|
* @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
|
|
77
106
|
* @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`.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
111
|
+
* const permission = workbook.getPermission();
|
|
112
|
+
* const unitId = workbook.getId();
|
|
113
|
+
* const worksheet = workbook.getActiveSheet();
|
|
114
|
+
* const subUnitId = worksheet.getSheetId();
|
|
115
|
+
* // Note that there will be no permission changes after this step is completed. It only returns an ID for subsequent permission changes.
|
|
116
|
+
* // For details, please see the example of the **`setWorksheetPermissionPoint`** API.
|
|
117
|
+
* const permissionId = await permission.addWorksheetBasePermission(unitId, subUnitId)
|
|
118
|
+
* // Can still edit and read it.
|
|
119
|
+
* console.log('debugger', permissionId)
|
|
120
|
+
* ```
|
|
78
121
|
*/
|
|
79
122
|
addWorksheetBasePermission(unitId: string, subUnitId: string): Promise<string | undefined>;
|
|
80
123
|
/**
|
|
81
124
|
* Delete the entire table protection set for the worksheet and reset the point permissions of the worksheet to true
|
|
82
125
|
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
83
126
|
* @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
131
|
+
* const permission = workbook.getPermission();
|
|
132
|
+
* const unitId = workbook.getId();
|
|
133
|
+
* const worksheet = workbook.getActiveSheet();
|
|
134
|
+
* const subUnitId = worksheet.getSheetId();
|
|
135
|
+
* permission.removeWorksheetPermission(unitId, subUnitId);
|
|
136
|
+
* ```
|
|
84
137
|
*/
|
|
85
138
|
removeWorksheetPermission(unitId: string, subUnitId: string): void;
|
|
86
139
|
/**
|
|
@@ -92,16 +145,46 @@ export declare class FPermission extends FBase {
|
|
|
92
145
|
* See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
|
|
93
146
|
* @param {boolean} value - The new permission value to be set for the worksheet.
|
|
94
147
|
* @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`.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
152
|
+
* const permission = workbook.getPermission();
|
|
153
|
+
* const unitId = workbook.getId();
|
|
154
|
+
* const worksheet = workbook.getActiveSheet();
|
|
155
|
+
* const subUnitId = worksheet.getSheetId();
|
|
156
|
+
* const permissionId = await permission.addWorksheetBasePermission(unitId, subUnitId)
|
|
157
|
+
* // After this line of code , the worksheet will no longer be editable
|
|
158
|
+
* permission.setWorksheetPermissionPoint(unitId, subUnitId, permission.permissionPointsDefinition.WorksheetEditPermission, false);
|
|
95
159
|
*/
|
|
96
160
|
setWorksheetPermissionPoint(unitId: string, subUnitId: string, FPointClass: WorkSheetPermissionPointConstructor, value: boolean): Promise<string | undefined>;
|
|
97
161
|
/**
|
|
98
162
|
* Adds a range protection to the worksheet.
|
|
163
|
+
* Note that after adding, only the background mask of the permission module will be rendered. If you want to modify the function permissions,
|
|
164
|
+
* you need to modify the permission points with the permissionId returned by this function.
|
|
99
165
|
* @param {string} unitId - The unique identifier of the workbook.
|
|
100
166
|
* @param {string} subUnitId - The unique identifier of the worksheet.
|
|
101
|
-
* @param {
|
|
167
|
+
* @param {FRange[]} ranges - The ranges to be protected.
|
|
102
168
|
* @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
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
*const workbook = univerAPI.getActiveWorkbook();
|
|
173
|
+
* const permission = workbook.getPermission();
|
|
174
|
+
* const unitId = workbook.getId();
|
|
175
|
+
* const worksheet = workbook.getActiveSheet();
|
|
176
|
+
* const subUnitId = worksheet.getSheetId();
|
|
177
|
+
* const range = worksheet.getRange(0,0,2,2);
|
|
178
|
+
* const ranges = [];
|
|
179
|
+
* ranges.push(range);
|
|
180
|
+
* // Note that there will be no permission changes after this step is completed. It only returns an ID for subsequent permission changes.
|
|
181
|
+
* // For details, please see the example of the **`setRangeProtectionPermissionPoint`** API.
|
|
182
|
+
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
|
|
183
|
+
* const {permissionId, ruleId} = res;
|
|
184
|
+
* console.log('debugger', permissionId, ruleId);
|
|
185
|
+
* ```
|
|
103
186
|
*/
|
|
104
|
-
addRangeBaseProtection(unitId: string, subUnitId: string, ranges:
|
|
187
|
+
addRangeBaseProtection(unitId: string, subUnitId: string, ranges: FRange[]): Promise<{
|
|
105
188
|
permissionId: string;
|
|
106
189
|
ruleId: string;
|
|
107
190
|
} | undefined>;
|
|
@@ -110,6 +193,21 @@ export declare class FPermission extends FBase {
|
|
|
110
193
|
* @param {string} unitId - The unique identifier of the workbook.
|
|
111
194
|
* @param {string} subUnitId - The unique identifier of the worksheet.
|
|
112
195
|
* @param {string[]} ruleIds - The rule IDs of the range protection to be removed.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
200
|
+
* const permission = workbook.getPermission();
|
|
201
|
+
* const unitId = workbook.getId();
|
|
202
|
+
* const worksheet = workbook.getActiveSheet();
|
|
203
|
+
* const subUnitId = worksheet.getSheetId();
|
|
204
|
+
* const range = worksheet.getRange(0,0,2,2);
|
|
205
|
+
* const ranges = [];
|
|
206
|
+
* ranges.push(range);
|
|
207
|
+
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
|
|
208
|
+
* const ruleId = res.ruleId;
|
|
209
|
+
* permission.removeRangeProtection(unitId, subUnitId, [ruleId]);
|
|
210
|
+
* ```
|
|
113
211
|
*/
|
|
114
212
|
removeRangeProtection(unitId: string, subUnitId: string, ruleIds: string[]): void;
|
|
115
213
|
/**
|
|
@@ -120,6 +218,24 @@ export declare class FPermission extends FBase {
|
|
|
120
218
|
* @param {RangePermissionPointConstructor} FPointClass - The constructor for the range permission point class.
|
|
121
219
|
* See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
|
|
122
220
|
* @param {boolean} value - The new permission value to be set for the range (e.g., true for allowing access, false for restricting access).
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
225
|
+
* const permission = workbook.getPermission();
|
|
226
|
+
* const unitId = workbook.getId();
|
|
227
|
+
* const worksheet = workbook.getActiveSheet();
|
|
228
|
+
* const subUnitId = worksheet.getSheetId();
|
|
229
|
+
* const range = worksheet.getRange(0, 0, 2, 2);
|
|
230
|
+
* const ranges = [];
|
|
231
|
+
* ranges.push(range);
|
|
232
|
+
* // Note that there will be no permission changes after this step is completed. It only returns an ID for subsequent permission changes.
|
|
233
|
+
* // For details, please see the example of the **`setRangeProtectionPermissionPoint`** API.
|
|
234
|
+
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
|
|
235
|
+
* const {permissionId, ruleId} = res;
|
|
236
|
+
* // After passing the following line of code, the range set above will become uneditable
|
|
237
|
+
* permission.setRangeProtectionPermissionPoint(unitId,subUnitId,permissionId, permission.permissionPointsDefinition.RangeProtectionPermissionEditPoint, false);
|
|
238
|
+
* ```
|
|
123
239
|
*/
|
|
124
240
|
setRangeProtectionPermissionPoint(unitId: string, subUnitId: string, permissionId: string, FPointClass: RangePermissionPointConstructor, value: boolean): void;
|
|
125
241
|
/**
|
|
@@ -132,6 +248,22 @@ export declare class FPermission extends FBase {
|
|
|
132
248
|
* @param {string} subUnitId - The unique identifier of the worksheet within the workbook.
|
|
133
249
|
* @param {string} ruleId - The ruleId of the range protection rule that is being updated.
|
|
134
250
|
* @param {IRange[]} ranges - The array of new ranges to be set for the range protection rule.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
255
|
+
* const permission = workbook.getPermission();
|
|
256
|
+
* const unitId = workbook.getId();
|
|
257
|
+
* const worksheet = workbook.getActiveSheet();
|
|
258
|
+
* const subUnitId = worksheet.getSheetId();
|
|
259
|
+
* const range = worksheet.getRange(0, 0, 2, 2);
|
|
260
|
+
* const ranges = [];
|
|
261
|
+
* ranges.push(range);
|
|
262
|
+
* const res = await permission.addRangeBaseProtection(unitId, subUnitId, ranges);
|
|
263
|
+
* const {permissionId, ruleId} = res;
|
|
264
|
+
* const newRange = worksheet.getRange(3, 3, 2, 2);
|
|
265
|
+
* permission.setRangeProtectionRanges(unitId, subUnitId, ruleId, [newRange]);
|
|
266
|
+
* ```
|
|
135
267
|
*/
|
|
136
|
-
setRangeProtectionRanges(unitId: string, subUnitId: string, ruleId: string, ranges:
|
|
268
|
+
setRangeProtectionRanges(unitId: string, subUnitId: string, ruleId: string, ranges: FRange[]): void;
|
|
137
269
|
}
|