@univerjs/sheets 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/lib/cjs/index.js +2 -2
  2. package/lib/es/index.js +5300 -3785
  3. package/lib/locale/en-US.json +14 -0
  4. package/lib/locale/ru-RU.json +14 -0
  5. package/lib/locale/zh-CN.json +14 -0
  6. package/lib/types/commands/commands/add-range-protection.command.d.ts +8 -0
  7. package/lib/types/commands/commands/delete-range-protection.command.d.ts +9 -0
  8. package/lib/types/commands/commands/set-range-protection.command.d.ts +9 -0
  9. package/lib/types/commands/commands/set-worksheet-permission-points.command.d.ts +7 -0
  10. package/lib/types/commands/mutations/add-range-protection.mutation.d.ts +13 -0
  11. package/lib/types/commands/mutations/add-worksheet-protection.mutation.d.ts +8 -0
  12. package/lib/types/commands/mutations/delete-range-protection.mutation.d.ts +11 -0
  13. package/lib/types/commands/mutations/delete-worksheet-protection.mutation.d.ts +7 -0
  14. package/lib/types/commands/mutations/set-range-protection.mutation.d.ts +12 -0
  15. package/lib/types/commands/mutations/set-worksheet-permission-points.mutation.d.ts +9 -0
  16. package/lib/types/commands/mutations/set-worksheet-protection.mutation.d.ts +9 -0
  17. package/lib/types/controllers/config.d.ts +16 -0
  18. package/lib/types/index.d.ts +29 -5
  19. package/lib/types/model/range-protection-render.model.d.ts +18 -0
  20. package/lib/types/model/range-protection-rule.model.d.ts +48 -0
  21. package/lib/types/render/image/protect-background-img.d.ts +16 -0
  22. package/lib/types/render/range-protection/range-protection.render.d.ts +32 -0
  23. package/lib/types/render/worksheet-protection/worksheet-permission.render.d.ts +13 -0
  24. package/lib/types/services/permission/index.d.ts +1 -3
  25. package/lib/types/services/permission/permission-point/index.d.ts +51 -0
  26. package/lib/types/services/permission/permission-point/range/edit.d.ts +14 -0
  27. package/lib/types/services/permission/permission-point/range/view.d.ts +14 -0
  28. package/lib/types/services/permission/permission-point/workbook/comment.d.ts +12 -0
  29. package/lib/types/services/permission/permission-point/workbook/copy-sheet.d.ts +12 -0
  30. package/lib/types/services/permission/permission-point/workbook/copy.d.ts +12 -0
  31. package/lib/types/services/permission/permission-point/workbook/create-sheet.d.ts +12 -0
  32. package/lib/types/services/permission/permission-point/workbook/delete-sheet.d.ts +12 -0
  33. package/lib/types/services/permission/permission-point/workbook/duplicate.d.ts +12 -0
  34. package/lib/types/services/permission/permission-point/workbook/editable.d.ts +12 -0
  35. package/lib/types/services/permission/permission-point/workbook/export.d.ts +12 -0
  36. package/lib/types/services/permission/permission-point/workbook/hide-sheet.d.ts +12 -0
  37. package/lib/types/services/permission/permission-point/workbook/history.d.ts +12 -0
  38. package/lib/types/services/permission/permission-point/workbook/manage-collaborator.d.ts +12 -0
  39. package/lib/types/services/permission/permission-point/workbook/move-sheet.d.ts +12 -0
  40. package/lib/types/services/permission/permission-point/workbook/print.d.ts +12 -0
  41. package/lib/types/services/permission/permission-point/workbook/rename-sheet.d.ts +12 -0
  42. package/lib/types/services/permission/permission-point/workbook/share.d.ts +12 -0
  43. package/lib/types/services/permission/permission-point/workbook/view.d.ts +12 -0
  44. package/lib/types/services/permission/permission-point/worksheet/copy.d.ts +13 -0
  45. package/lib/types/services/permission/permission-point/worksheet/delete-column.d.ts +13 -0
  46. package/lib/types/services/permission/permission-point/worksheet/delete-row.d.ts +13 -0
  47. package/lib/types/services/permission/permission-point/worksheet/edit-extra-object.d.ts +13 -0
  48. package/lib/types/services/permission/permission-point/worksheet/edit.d.ts +13 -0
  49. package/lib/types/services/permission/permission-point/worksheet/filter.d.ts +13 -0
  50. package/lib/types/services/permission/permission-point/worksheet/insert-column.d.ts +13 -0
  51. package/lib/types/services/permission/permission-point/worksheet/insert-hyperlink.d.ts +13 -0
  52. package/lib/types/services/permission/permission-point/worksheet/insert-row.d.ts +13 -0
  53. package/lib/types/services/permission/permission-point/worksheet/manage-collaborator.d.ts +13 -0
  54. package/lib/types/services/permission/permission-point/worksheet/pivot-table.d.ts +13 -0
  55. package/lib/types/services/permission/permission-point/worksheet/select-protected-cells.d.ts +13 -0
  56. package/lib/types/services/permission/permission-point/worksheet/select-un-protected-cells.d.ts +13 -0
  57. package/lib/types/services/permission/permission-point/worksheet/set-cell-style.d.ts +13 -0
  58. package/lib/types/services/permission/permission-point/worksheet/set-cell-value.d.ts +13 -0
  59. package/lib/types/services/permission/permission-point/worksheet/set-column-style.d.ts +13 -0
  60. package/lib/types/services/permission/permission-point/worksheet/set-row-style.d.ts +13 -0
  61. package/lib/types/services/permission/permission-point/worksheet/sort.d.ts +13 -0
  62. package/lib/types/services/permission/permission-point/worksheet/view.d.ts +13 -0
  63. package/lib/types/services/permission/range-permission/range-protection.ref-range.d.ts +35 -0
  64. package/lib/types/services/permission/range-permission/range-protection.service.d.ts +11 -0
  65. package/lib/types/services/permission/range-permission/util.d.ts +7 -0
  66. package/lib/types/services/permission/type.d.ts +19 -0
  67. package/lib/types/{locale → services/permission/workbook-permission}/index.d.ts +1 -3
  68. package/lib/types/services/permission/workbook-permission/util.d.ts +5 -0
  69. package/lib/types/services/permission/workbook-permission/workbook-permission.service.d.ts +8 -0
  70. package/lib/types/services/permission/worksheet-permission/index.d.ts +19 -0
  71. package/lib/types/services/permission/worksheet-permission/type.d.ts +12 -0
  72. package/lib/types/services/permission/worksheet-permission/utils.d.ts +6 -0
  73. package/lib/types/services/permission/worksheet-permission/worksheet-permission-point.model.d.ts +18 -0
  74. package/lib/types/services/permission/worksheet-permission/worksheet-permission-render.service.d.ts +10 -0
  75. package/lib/types/services/permission/worksheet-permission/worksheet-permission-rule.model.d.ts +36 -0
  76. package/lib/types/services/permission/worksheet-permission/worksheet-permission.service.d.ts +22 -0
  77. package/lib/types/services/ref-range/ref-range.service.d.ts +1 -1
  78. package/lib/types/services/ref-range/util.d.ts +11 -1
  79. package/lib/types/sheets-plugin.d.ts +11 -3
  80. package/lib/umd/index.js +2 -2
  81. package/package.json +14 -10
  82. package/lib/types/services/permission/permission-point.d.ts +0 -10
  83. package/lib/types/services/permission/sheet-permission.service.d.ts +0 -16
  84. package/lib/types/services/permission/tool.d.ts +0 -3
@@ -0,0 +1,12 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorkbookManageCollaboratorPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ id: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ subType: UnitAction;
11
+ constructor(unitId: string);
12
+ }
@@ -0,0 +1,12 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorkbookMoveSheetPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ id: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ subType: UnitAction;
11
+ constructor(unitId: string);
12
+ }
@@ -0,0 +1,12 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorkbookPrintPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ id: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ subType: UnitAction;
11
+ constructor(unitId: string);
12
+ }
@@ -0,0 +1,12 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorkbookRenameSheetPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ id: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ subType: UnitAction;
11
+ constructor(unitId: string);
12
+ }
@@ -0,0 +1,12 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorkbookSharePermission implements IPermissionPoint {
5
+ unitId: string;
6
+ id: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ subType: UnitAction;
11
+ constructor(unitId: string);
12
+ }
@@ -0,0 +1,12 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorkbookViewPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ id: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ subType: UnitAction;
11
+ constructor(unitId: string);
12
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetCopyPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetDeleteColumnPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetDeleteRowPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetEditExtraObjectPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetEditPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetFilterPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetInsertColumnPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetInsertHyperlinkPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetInsertRowPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetManageCollaboratorPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetPivotTablePermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetSelectProtectedCellsPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetSelectUnProtectedCellsPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetSetCellStylePermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetSetCellValuePermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetSetColumnStylePermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetSetRowStylePermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetSortPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,13 @@
1
+ import { IPermissionPoint, PermissionStatus } from '@univerjs/core';
2
+ import { UnitAction, UnitObject } from '@univerjs/protocol';
3
+
4
+ export declare class WorksheetViewPermission implements IPermissionPoint {
5
+ unitId: string;
6
+ subUnitId: string;
7
+ value: boolean;
8
+ type: UnitObject;
9
+ status: PermissionStatus;
10
+ id: string;
11
+ subType: UnitAction;
12
+ constructor(unitId: string, subUnitId: string);
13
+ }
@@ -0,0 +1,35 @@
1
+ import { Disposable, DisposableCollection, ICommandService, IUniverInstanceService } from '@univerjs/core';
2
+ import { RangeProtectionRuleModel } from '../../../model/range-protection-rule.model';
3
+ import { RangeProtectionRenderModel } from '../../../model/range-protection-render.model';
4
+ import { ISetRangeProtectionMutationParams } from '../../../commands/mutations/set-range-protection.mutation';
5
+ import { EffectRefRangeParams } from '../../../services/ref-range/type';
6
+ import { RefRangeService } from '../../../services/ref-range/ref-range.service';
7
+
8
+ export declare class RangeProtectionRefRangeService extends Disposable {
9
+ private _selectionProtectionRuleModel;
10
+ private _univerInstanceService;
11
+ private readonly _commandService;
12
+ private readonly _refRangeService;
13
+ private readonly _selectionProtectionRenderModel;
14
+ disposableCollection: DisposableCollection;
15
+ constructor(_selectionProtectionRuleModel: RangeProtectionRuleModel, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _refRangeService: RefRangeService, _selectionProtectionRenderModel: RangeProtectionRenderModel);
16
+ private _onRefRangeChange;
17
+ refRangeHandle(config: EffectRefRangeParams, unitId: string, subUnitId: string): {
18
+ redos: {
19
+ id: string;
20
+ params: ISetRangeProtectionMutationParams;
21
+ }[];
22
+ undos: {
23
+ id: string;
24
+ params: ISetRangeProtectionMutationParams;
25
+ }[];
26
+ };
27
+ private _getRefRangeMutationsByDeleteCols;
28
+ private _getRefRangeMutationsByDeleteRows;
29
+ private _getRefRangeMutationsByInsertCols;
30
+ private _getRefRangeMutationsByInsertRows;
31
+ private _getRefRangeMutationsByMoveRows;
32
+ private _getRefRangeMutationsByMoveCols;
33
+ private _correctPermissionRange;
34
+ private _checkIsRightRange;
35
+ }
@@ -0,0 +1,11 @@
1
+ import { Disposable, IPermissionService, IResourceManagerService } from '@univerjs/core';
2
+ import { RangeProtectionRuleModel } from '../../../model/range-protection-rule.model';
3
+
4
+ export declare class RangeProtectionService extends Disposable {
5
+ private _selectionProtectionRuleModel;
6
+ private _permissionService;
7
+ private _resourceManagerService;
8
+ constructor(_selectionProtectionRuleModel: RangeProtectionRuleModel, _permissionService: IPermissionService, _resourceManagerService: IResourceManagerService);
9
+ private _initRuleChange;
10
+ private _initSnapshot;
11
+ }
@@ -0,0 +1,7 @@
1
+ import { UnitAction } from '@univerjs/protocol';
2
+ import { RangeProtectionPermissionEditPoint } from '../permission-point/range/edit';
3
+ import { RangeProtectionPermissionViewPoint } from '../permission-point/range/view';
4
+
5
+ export type IRangePermissionPoint = RangeProtectionPermissionEditPoint | RangeProtectionPermissionViewPoint;
6
+ export declare const getAllRangePermissionPoint: () => (typeof RangeProtectionPermissionEditPoint)[];
7
+ export declare const getDefaultRangePermission: (unitId?: string, subUnitId?: string, permissionId?: string) => Record<UnitAction, boolean>;
@@ -0,0 +1,19 @@
1
+ import { UnitObject } from '@univerjs/protocol';
2
+
3
+ export interface IWorksheetProtectionRule {
4
+ permissionId: string;
5
+ name: string;
6
+ description?: string;
7
+ unitType: UnitObject;
8
+ unitId: string;
9
+ subUnitId: string;
10
+ }
11
+ export interface IWorksheetProtectionPointRule {
12
+ unitId: string;
13
+ subUnitId: string;
14
+ permissionId: string;
15
+ }
16
+ export type IObjectModel = Record<string, IWorksheetProtectionRule[]>;
17
+ export type IModel = Map<string, Map<string, IWorksheetProtectionRule>>;
18
+ export type IObjectPointModel = Record<string, IWorksheetProtectionPointRule[]>;
19
+ export type IPointRuleModel = Map<string, Map<string, IWorksheetProtectionPointRule>>;
@@ -13,6 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export { default as enUS } from './en-US';
17
- export { default as zhCN } from './zh-CN';
18
- export { default as ruRU } from './ru-RU';
16
+ export { getAllWorkbookPermissionPoint, defaultWorkbookPermissionPoints } from './util';
@@ -0,0 +1,5 @@
1
+ import { UnitAction } from '@univerjs/protocol';
2
+ import { WorkbookCommentPermission } from '../permission-point';
3
+
4
+ export declare const getAllWorkbookPermissionPoint: () => (typeof WorkbookCommentPermission)[];
5
+ export declare const defaultWorkbookPermissionPoints: UnitAction[];
@@ -0,0 +1,8 @@
1
+ import { Disposable, IPermissionService, IUniverInstanceService } from '@univerjs/core';
2
+
3
+ export declare class WorkbookPermissionService extends Disposable {
4
+ private _permissionService;
5
+ private _univerInstanceService;
6
+ constructor(_permissionService: IPermissionService, _univerInstanceService: IUniverInstanceService);
7
+ private _init;
8
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export { WorksheetPermissionService } from './worksheet-permission.service';
17
+ export { WorksheetProtectionRuleModel } from './worksheet-permission-rule.model';
18
+ export { WorksheetProtectionPointModel } from './worksheet-permission-point.model';
19
+ export { WorksheetProtectionRenderService } from './worksheet-permission-render.service';
@@ -0,0 +1,12 @@
1
+ import { ICellDataForSheetInterceptor } from '@univerjs/core';
2
+ import { UnitAction } from '@univerjs/protocol';
3
+
4
+ export declare const defaultSheetActions: UnitAction[];
5
+ export type IWorksheetProtectionRenderCellData = ICellDataForSheetInterceptor & {
6
+ hasWorksheetRule: boolean;
7
+ } & {
8
+ selectionProtection: {
9
+ [UnitAction.View]: boolean;
10
+ [UnitAction.Edit]: boolean;
11
+ }[];
12
+ };
@@ -0,0 +1,6 @@
1
+ import { UnitAction } from '@univerjs/protocol';
2
+ import { WorksheetCopyPermission, WorksheetViewPermission } from '../permission-point';
3
+
4
+ export declare const getAllWorksheetPermissionPoint: () => (typeof WorksheetViewPermission)[];
5
+ export declare const getAllWorksheetPermissionPointByPointPanel: () => (typeof WorksheetCopyPermission)[];
6
+ export declare const defaultWorksheetPermissionPoint: UnitAction[];
@@ -0,0 +1,18 @@
1
+ import { IObjectPointModel, IWorksheetProtectionPointRule } from '../type';
2
+
3
+ export declare class WorksheetProtectionPointModel {
4
+ private _model;
5
+ private _pointChange;
6
+ pointChange$: import('rxjs').Observable<{
7
+ unitId: string;
8
+ subUnitId: string;
9
+ permissionId: string;
10
+ }>;
11
+ addRule(rule: IWorksheetProtectionPointRule): void;
12
+ deleteRule(unitId: string, subUnitId: string): void;
13
+ getRule(unitId: string, subUnitId: string): IWorksheetProtectionPointRule | undefined;
14
+ toObject(): IObjectPointModel;
15
+ fromObject(obj: IObjectPointModel): void;
16
+ deleteUnitModel(): void;
17
+ private _ensureSubUnitMap;
18
+ }
@@ -0,0 +1,10 @@
1
+ import { IRenderManagerService } from '@univerjs/engine-render';
2
+ import { Disposable, IUniverInstanceService } from '@univerjs/core';
3
+
4
+ export declare class WorksheetProtectionRenderService extends Disposable {
5
+ private _renderManagerService;
6
+ private _univerInstanceService;
7
+ private _worksheetProtectionRenderExtension;
8
+ constructor(_renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService);
9
+ private _initRender;
10
+ }
@@ -0,0 +1,36 @@
1
+ import { IObjectModel, IWorksheetProtectionRule } from '../type';
2
+
3
+ type IRuleChangeType = 'add' | 'set' | 'delete';
4
+ export declare class WorksheetProtectionRuleModel {
5
+ /**
6
+ *
7
+ * Map<unitId, Map<subUnitId, Map<ruleId, IWorksheetProtectionRule>>>
8
+ */
9
+ private _model;
10
+ private _ruleChange;
11
+ private _ruleRefresh;
12
+ private _resetOrder;
13
+ ruleChange$: import('rxjs').Observable<{
14
+ unitId: string;
15
+ subUnitId: string;
16
+ rule: IWorksheetProtectionRule;
17
+ oldRule?: IWorksheetProtectionRule | undefined;
18
+ type: IRuleChangeType;
19
+ }>;
20
+ ruleRefresh$: import('rxjs').Observable<unknown>;
21
+ resetOrder$: import('rxjs').Observable<unknown>;
22
+ private _worksheetRuleInitStateChange;
23
+ worksheetRuleInitStateChange$: import('rxjs').Observable<boolean>;
24
+ changeRuleInitState(state: boolean): void;
25
+ addRule(unitId: string, rule: IWorksheetProtectionRule): void;
26
+ deleteRule(unitId: string, subUnitId: string): void;
27
+ setRule(unitId: string, subUnitId: string, rule: IWorksheetProtectionRule): void;
28
+ getRule(unitId: string, subUnitId: string): IWorksheetProtectionRule | undefined;
29
+ toObject(): IObjectModel;
30
+ fromObject(obj: IObjectModel): void;
31
+ deleteUnitModel(): void;
32
+ private _ensureSubUnitMap;
33
+ ruleRefresh(permissionId: string): void;
34
+ resetOrder(): void;
35
+ }
36
+ export {};
@@ -0,0 +1,22 @@
1
+ import { IPermissionService, IResourceManagerService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
2
+ import { Injector } from '@wendellhu/redi';
3
+ import { SheetInterceptorService } from '../../sheet-interceptor/sheet-interceptor.service';
4
+ import { WorksheetProtectionRuleModel } from './worksheet-permission-rule.model';
5
+ import { WorksheetProtectionPointModel } from './worksheet-permission-point.model';
6
+
7
+ export declare const RULE_MODEL_PLUGIN_NAME = "SHEET_WORKSHEET_PROTECTION_PLUGIN";
8
+ export declare const POINT_MODEL_PLUGIN_NAME = "SHEET_WORKSHEET_PROTECTION_POINT_PLUGIN";
9
+ export declare class WorksheetPermissionService extends RxDisposable {
10
+ private _permissionService;
11
+ private _univerInstanceService;
12
+ readonly _injector: Injector;
13
+ private _worksheetProtectionRuleModel;
14
+ private _worksheetProtectionPointRuleModel;
15
+ private _resourceManagerService;
16
+ private _sheetInterceptorService;
17
+ constructor(_permissionService: IPermissionService, _univerInstanceService: IUniverInstanceService, _injector: Injector, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel, _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel, _resourceManagerService: IResourceManagerService, _sheetInterceptorService: SheetInterceptorService);
18
+ private _init;
19
+ private _initRuleChange;
20
+ private _initRuleSnapshot;
21
+ private _initPointSnapshot;
22
+ }
@@ -25,7 +25,7 @@ export declare class RefRangeService extends Disposable {
25
25
  }>;
26
26
  private _watchRanges;
27
27
  constructor(_commandService: ICommandService, _sheetInterceptorService: SheetInterceptorService, _univerInstanceService: IUniverInstanceService, _selectionManagerService: SelectionManagerService);
28
- watchRange(unitId: string, subUnitId: string, range: IRange, callback: WatchRangeCallback): IDisposable;
28
+ watchRange(unitId: string, subUnitId: string, range: IRange, callback: WatchRangeCallback, skipIntersects?: boolean): IDisposable;
29
29
  private _refRangeManagerMap;
30
30
  private _serializer;
31
31
  private _onRefRangeChange;
@@ -3,7 +3,8 @@ import { IMoveColumnsMutationParams, IMoveRowsMutationParams } from '../../comma
3
3
  import { IInsertColMutationParams, IInsertRowMutationParams, IRemoveColMutationParams, IRemoveRowsMutationParams, IRemoveSheetMutationParams } from '../../basics';
4
4
  import { IMoveRangeMutationParams } from '../../commands/mutations/move-range.mutation';
5
5
  import { ISheetCommandSharedParams } from '../../commands/utils/interface';
6
- import { IDeleteRangeMoveLeftCommand, IDeleteRangeMoveUpCommand, IInsertColCommand, IInsertRangeMoveDownCommand, IInsertRangeMoveRightCommand, IInsertRowCommand, IMoveColsCommand, IMoveRangeCommand, IMoveRowsCommand, IOperator, IRemoveRowColCommand } from './type';
6
+ import { SelectionManagerService } from '../selection-manager.service';
7
+ import { EffectRefRangeParams, IDeleteRangeMoveLeftCommand, IDeleteRangeMoveUpCommand, IInsertColCommand, IInsertRangeMoveDownCommand, IInsertRangeMoveRightCommand, IInsertRowCommand, IMoveColsCommand, IMoveRangeCommand, IMoveRowsCommand, IOperator, IRemoveRowColCommand } from './type';
7
8
 
8
9
  export declare const handleRangeTypeInput: (range: IRange) => {
9
10
  startColumn: number;
@@ -74,4 +75,13 @@ export declare const handleCommonDefaultRangeChangeWithEffectRefCommands: (range
74
75
  * @returns the adjusted range
75
76
  */
76
77
  export declare function adjustRangeOnMutation(range: Readonly<IRange>, mutation: IMutationInfo<MutationsAffectRange>): Nullable<IRange>;
78
+ export declare function getEffectedRangesOnCommand(command: EffectRefRangeParams, deps: {
79
+ selectionManagerService: SelectionManagerService;
80
+ }): {
81
+ startRow: number;
82
+ startColumn: number;
83
+ endColumn: number;
84
+ endRow: number;
85
+ }[];
86
+ export declare function getEffectedRangesOnMutation(mutation: IMutationInfo<MutationsAffectRange>): IRange[] | undefined;
77
87
  export {};