@univerjs/sheets 0.4.2 → 0.5.0-beta.0
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 -0
- package/lib/cjs/index.js +3 -3
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/facade.js +1806 -0
- package/lib/es/index.js +7694 -7605
- package/lib/es/locale/en-US.js +17 -0
- package/lib/es/locale/fa-IR.js +17 -0
- package/lib/es/locale/ru-RU.js +17 -0
- package/lib/es/locale/vi-VN.js +17 -0
- package/lib/es/locale/zh-CN.js +17 -0
- package/lib/es/locale/zh-TW.js +17 -0
- package/lib/types/basics/selection.d.ts +31 -20
- package/lib/types/commands/commands/add-worksheet-protection.command.d.ts +7 -0
- package/lib/types/commands/commands/delete-worksheet-protection.command.d.ts +8 -0
- package/lib/types/commands/commands/set-frozen.command.d.ts +13 -0
- package/lib/types/commands/commands/set-protection.command.d.ts +13 -0
- package/lib/types/commands/commands/set-worksheet-protection.command.d.ts +8 -0
- package/lib/types/commands/mutations/reorder-range.mutation.d.ts +1 -1
- package/lib/types/commands/operations/selection.operation.d.ts +4 -1
- package/lib/types/facade/__tests__/utils.spec.d.ts +16 -0
- package/lib/types/facade/f-permission.d.ts +106 -0
- package/lib/types/facade/f-range.d.ts +193 -0
- package/lib/types/facade/f-selection.d.ts +11 -0
- package/lib/types/facade/f-univer.d.ts +36 -0
- package/lib/types/facade/f-workbook.d.ts +105 -0
- package/lib/types/facade/f-worksheet.d.ts +408 -0
- package/lib/types/facade/index.d.ts +22 -0
- package/lib/types/facade/utils.d.ts +24 -0
- package/lib/types/index.d.ts +11 -9
- package/lib/types/model/range-protection-rule.model.d.ts +10 -1
- package/lib/types/services/permission/type.d.ts +3 -1
- package/lib/types/services/permission/worksheet-permission/worksheet-permission.service.d.ts +3 -2
- package/lib/types/services/ref-range/util.d.ts +12 -4
- package/lib/types/services/selections/index.d.ts +19 -0
- package/lib/types/services/selections/selection-data-model.d.ts +57 -0
- package/lib/types/services/selections/selection-manager.service.d.ts +15 -61
- package/lib/types/services/selections/type.d.ts +28 -0
- package/lib/types/services/sheet-interceptor/sheet-interceptor.service.d.ts +38 -7
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +3 -3
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +36 -18
- package/lib/locale/en-US.json +0 -14
- package/lib/locale/fa-IR.json +0 -14
- package/lib/locale/ru-RU.json +0 -14
- package/lib/locale/vi-VN.json +0 -14
- package/lib/locale/zh-CN.json +0 -14
- package/lib/locale/zh-TW.json +0 -14
- package/lib/types/commands/commands/set-frozen-cancel.command.d.ts +0 -2
- package/lib/types/commands/commands/set-range-protection.command.d.ts +0 -8
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
sheets: {
|
|
3
|
+
tabs: {
|
|
4
|
+
sheetCopy: "(Copy{0})",
|
|
5
|
+
sheet: "Sheet"
|
|
6
|
+
},
|
|
7
|
+
info: {
|
|
8
|
+
overlappingSelections: "Cannot use that command on overlapping selections",
|
|
9
|
+
acrossMergedCell: "Across a merged cell",
|
|
10
|
+
partOfCell: "Only part of a merged cell is selected",
|
|
11
|
+
hideSheet: "No visible sheet after you hide this"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
e as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
sheets: {
|
|
3
|
+
tabs: {
|
|
4
|
+
sheetCopy: "(کپی{0})",
|
|
5
|
+
sheet: "برگ"
|
|
6
|
+
},
|
|
7
|
+
info: {
|
|
8
|
+
overlappingSelections: "نمیتوان از این دستور روی انتخابهای همپوشانی استفاده کرد",
|
|
9
|
+
acrossMergedCell: "در سراسر سلول ادغام شده",
|
|
10
|
+
partOfCell: "فقط بخشی از سلول ادغام شده انتخاب شده است",
|
|
11
|
+
hideSheet: "پس از پنهان کردن این برگ، هیچ برگی قابل مشاهده نخواهد بود"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
e as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
sheets: {
|
|
3
|
+
tabs: {
|
|
4
|
+
sheetCopy: "(Копия{0})",
|
|
5
|
+
sheet: "Лист"
|
|
6
|
+
},
|
|
7
|
+
info: {
|
|
8
|
+
overlappingSelections: "Невозможно использовать эту команду на пересекающихся выделениях",
|
|
9
|
+
acrossMergedCell: "Через объединенную ячейку",
|
|
10
|
+
partOfCell: "Выделена только часть объединенной ячейки",
|
|
11
|
+
hideSheet: "После скрытия этого листа не будет видно ни одного листа"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
e as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const h = {
|
|
2
|
+
sheets: {
|
|
3
|
+
tabs: {
|
|
4
|
+
sheetCopy: "(Bản sao {0})",
|
|
5
|
+
sheet: "Bảng tính"
|
|
6
|
+
},
|
|
7
|
+
info: {
|
|
8
|
+
overlappingSelections: "Không thể sử dụng lệnh này trên các vùng chọn chồng chéo nhau",
|
|
9
|
+
acrossMergedCell: "Không thể vượt qua các ô đã hợp nhất",
|
|
10
|
+
partOfCell: "Chỉ chọn một phần của ô đã hợp nhất",
|
|
11
|
+
hideSheet: "Không có bảng tính nào hiển thị sau khi ẩn"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
h as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
sheets: {
|
|
3
|
+
tabs: {
|
|
4
|
+
sheetCopy: "(副本{0})",
|
|
5
|
+
sheet: "工作表"
|
|
6
|
+
},
|
|
7
|
+
info: {
|
|
8
|
+
overlappingSelections: "无法对重叠选区使用该命令",
|
|
9
|
+
acrossMergedCell: "无法跨越合并单元格",
|
|
10
|
+
partOfCell: "仅选择了合并单元格的一部分",
|
|
11
|
+
hideSheet: "隐藏后无可见工作表"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
e as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
sheets: {
|
|
3
|
+
tabs: {
|
|
4
|
+
sheetCopy: "(副本{0})",
|
|
5
|
+
sheet: "工作表"
|
|
6
|
+
},
|
|
7
|
+
info: {
|
|
8
|
+
overlappingSelections: "無法對重疊選區使用該命令",
|
|
9
|
+
acrossMergedCell: "無法跨越合併儲存格",
|
|
10
|
+
partOfCell: "僅選擇了合併儲存格的一部份",
|
|
11
|
+
hideSheet: "隱藏後無可見工作表"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
e as default
|
|
17
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRange,
|
|
1
|
+
import { ICellWithCoord, IRange, IRangeWithCoord, ISelection, ISelectionCell, Nullable } from '@univerjs/core';
|
|
2
2
|
export declare const SELECTION_CONTROL_BORDER_BUFFER_WIDTH = 1.5;
|
|
3
3
|
export declare const SELECTION_CONTROL_BORDER_BUFFER_COLOR = "rgba(255, 255, 255, 0.01)";
|
|
4
4
|
/**
|
|
@@ -61,7 +61,7 @@ export interface ISelectionStyle {
|
|
|
61
61
|
/**
|
|
62
62
|
* The volume of the touch points.
|
|
63
63
|
*/
|
|
64
|
-
widgetSize
|
|
64
|
+
widgetSize: number;
|
|
65
65
|
/**
|
|
66
66
|
* The thickness of the border of the touch points
|
|
67
67
|
*/
|
|
@@ -74,14 +74,9 @@ export interface ISelectionStyle {
|
|
|
74
74
|
* https://support.microsoft.com/en-us/office/copy-a-formula-by-dragging-the-fill-handle-in-excel-for-mac-dd928259-622b-473f-9a33-83aa1a63e218
|
|
75
75
|
* Whether to show the drop-down fill button at the bottom right corner of the selection.
|
|
76
76
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
AutofillStroke?: string;
|
|
81
|
-
/**
|
|
82
|
-
* Whether to synchronize the display of row title highlights, the highlighting range is consistent with the horizontal range of the selection.
|
|
83
|
-
*/
|
|
84
|
-
hasRowHeader?: boolean;
|
|
77
|
+
autofillSize?: number;
|
|
78
|
+
autofillStrokeWidth?: number;
|
|
79
|
+
autofillStroke?: string;
|
|
85
80
|
/**
|
|
86
81
|
* The color of the row title highlight.
|
|
87
82
|
* A level of transparency should be set to avoid covering the row title content.
|
|
@@ -95,27 +90,43 @@ export interface ISelectionStyle {
|
|
|
95
90
|
* The color of the bottom border of the row title.
|
|
96
91
|
*/
|
|
97
92
|
rowHeaderStrokeWidth?: number;
|
|
98
|
-
/**
|
|
99
|
-
* The setting of column title highlight is similar to that of row title.
|
|
100
|
-
*/
|
|
101
|
-
hasColumnHeader?: boolean;
|
|
102
93
|
columnHeaderFill?: string;
|
|
103
94
|
columnHeaderStroke?: string;
|
|
104
95
|
columnHeaderStrokeWidth?: number;
|
|
105
96
|
expandCornerSize?: number;
|
|
106
97
|
}
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Selection range Info, contains selection range & primary range
|
|
100
|
+
* primary range is the range of the highlighted cell.
|
|
101
|
+
*
|
|
102
|
+
* rangeWithCoord: IRangeWithCoord;
|
|
103
|
+
* primaryWithCoord: Nullable<ICellWithCoord>;
|
|
104
|
+
* style?
|
|
105
|
+
*/
|
|
106
|
+
export interface ISelectionWithCoord {
|
|
107
|
+
rangeWithCoord: IRangeWithCoord;
|
|
108
|
+
primaryWithCoord: Nullable<ICellWithCoord>;
|
|
109
|
+
style?: Nullable<ISelectionStyle>;
|
|
109
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* range: IRange;
|
|
113
|
+
* primary: Nullable<ISelectionCell>;
|
|
114
|
+
* style: Nullable<ISelectionStyle>;
|
|
115
|
+
*/
|
|
110
116
|
export interface ISelectionWithStyle extends ISelection {
|
|
111
|
-
|
|
117
|
+
range: IRange;
|
|
118
|
+
/**
|
|
119
|
+
* if primary is null, means clear primary cell.
|
|
120
|
+
* if primary is not defined, means not keep current primary cell.
|
|
121
|
+
*/
|
|
122
|
+
primary: Nullable<ISelectionCell>;
|
|
123
|
+
style: Nullable<Partial<ISelectionStyle>>;
|
|
112
124
|
}
|
|
113
125
|
export interface ISheetRangeLocation {
|
|
114
126
|
range: IRange;
|
|
115
127
|
subUnitId: string;
|
|
116
128
|
unitId: string;
|
|
117
129
|
}
|
|
118
|
-
export declare function getNormalSelectionStyle(themeService: ThemeService): ISelectionStyle;
|
|
119
130
|
/**
|
|
120
131
|
* Process a selection with coordinates and style,
|
|
121
132
|
* and extract the coordinate information, because the render needs coordinates when drawing.
|
|
@@ -124,8 +135,8 @@ export declare function getNormalSelectionStyle(themeService: ThemeService): ISe
|
|
|
124
135
|
* @param selectionWithCoordAndStyle Selection with coordinates and style
|
|
125
136
|
* @returns
|
|
126
137
|
*/
|
|
127
|
-
export declare function convertSelectionDataToRange(selectionWithCoordAndStyle:
|
|
128
|
-
export declare function convertPrimaryWithCoordToPrimary(primaryWithCoord:
|
|
138
|
+
export declare function convertSelectionDataToRange(selectionWithCoordAndStyle: ISelectionWithCoord): ISelectionWithStyle;
|
|
139
|
+
export declare function convertPrimaryWithCoordToPrimary(primaryWithCoord: ICellWithCoord): {
|
|
129
140
|
actualRow: number;
|
|
130
141
|
actualColumn: number;
|
|
131
142
|
isMerged: boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
import { IWorksheetProtectionRule } from '../../services/permission/type';
|
|
3
|
+
export interface IAddWorksheetProtectionParams {
|
|
4
|
+
unitId: string;
|
|
5
|
+
rule: IWorksheetProtectionRule;
|
|
6
|
+
}
|
|
7
|
+
export declare const AddWorksheetProtectionCommand: ICommand<IAddWorksheetProtectionParams>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
import { IWorksheetProtectionRule } from '../../services/permission/type';
|
|
3
|
+
export interface IDeleteWorksheetProtectionParams {
|
|
4
|
+
unitId: string;
|
|
5
|
+
subUnitId: string;
|
|
6
|
+
rule: IWorksheetProtectionRule;
|
|
7
|
+
}
|
|
8
|
+
export declare const DeleteWorksheetProtectionCommand: ICommand<IDeleteWorksheetProtectionParams>;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
import { ICommand } from '@univerjs/core';
|
|
2
|
+
export interface ISetFrozenCommandParams {
|
|
3
|
+
startRow: number;
|
|
4
|
+
startColumn: number;
|
|
5
|
+
ySplit: number;
|
|
6
|
+
xSplit: number;
|
|
7
|
+
unitId?: string;
|
|
8
|
+
subUnitId?: string;
|
|
9
|
+
}
|
|
2
10
|
export declare const SetFrozenCommand: ICommand;
|
|
11
|
+
export interface ICancelFrozenCommandParams {
|
|
12
|
+
unitId?: string;
|
|
13
|
+
subUnitId?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const CancelFrozenCommand: ICommand<ICancelFrozenCommandParams>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ICommand, IRange } from '@univerjs/core';
|
|
2
|
+
import { IRangeProtectionRule } from '../../model/range-protection-rule.model';
|
|
3
|
+
import { IWorksheetProtectionRule } from '../../services/permission/type';
|
|
4
|
+
type IPermissionRule = (IRangeProtectionRule | IWorksheetProtectionRule) & {
|
|
5
|
+
ranges: IRange[];
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
interface ISetProtectionParams {
|
|
9
|
+
rule: IPermissionRule;
|
|
10
|
+
oldRule: IPermissionRule;
|
|
11
|
+
}
|
|
12
|
+
export declare const SetProtectionCommand: ICommand<ISetProtectionParams>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
import { IWorksheetProtectionRule } from '../../services/permission/type';
|
|
3
|
+
export interface ISetWorksheetProtectionParams {
|
|
4
|
+
permissionId: string;
|
|
5
|
+
rule: IWorksheetProtectionRule;
|
|
6
|
+
oldRule: IWorksheetProtectionRule;
|
|
7
|
+
}
|
|
8
|
+
export declare const SetWorksheetProtectionCommand: ICommand<ISetWorksheetProtectionParams>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IMutation, IRange } from '@univerjs/core';
|
|
2
|
-
import { ISheetCommandSharedParams } from '
|
|
2
|
+
import { ISheetCommandSharedParams } from '../../commands/utils/interface';
|
|
3
3
|
export interface IReorderRangeMutationParams extends ISheetCommandSharedParams {
|
|
4
4
|
range: IRange;
|
|
5
5
|
order: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IOperation } from '@univerjs/core';
|
|
2
2
|
import { ISelectionWithStyle } from '../../basics/selection';
|
|
3
|
-
import { SelectionMoveType } from '../../services/selections/
|
|
3
|
+
import { SelectionMoveType } from '../../services/selections/type';
|
|
4
4
|
export interface ISetSelectionsOperationParams {
|
|
5
5
|
unitId: string;
|
|
6
6
|
subUnitId: string;
|
|
@@ -9,4 +9,7 @@ export interface ISetSelectionsOperationParams {
|
|
|
9
9
|
/** If should scroll to the selected range. */
|
|
10
10
|
reveal?: boolean;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Set selections to SelectionModel(WorkbookSelectionModel) by selectionManagerService.
|
|
14
|
+
*/
|
|
12
15
|
export declare const SetSelectionsOperation: IOperation<ISetSelectionsOperationParams>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { IRange, RangePermissionPointConstructor, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor, FBase, IAuthzIoService, ICommandService, Injector, IPermissionService } from '@univerjs/core';
|
|
2
|
+
import { RangeProtectionRuleModel, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';
|
|
3
|
+
export declare class FPermission extends FBase {
|
|
4
|
+
protected readonly _injector: Injector;
|
|
5
|
+
protected readonly _commandService: ICommandService;
|
|
6
|
+
protected readonly _permissionService: IPermissionService;
|
|
7
|
+
protected readonly _worksheetProtectionRuleModel: WorksheetProtectionRuleModel;
|
|
8
|
+
protected readonly _rangeProtectionRuleModel: RangeProtectionRuleModel;
|
|
9
|
+
protected readonly _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel;
|
|
10
|
+
protected readonly _authzIoService: IAuthzIoService;
|
|
11
|
+
constructor(_injector: Injector, _commandService: ICommandService, _permissionService: IPermissionService, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel, _rangeProtectionRuleModel: RangeProtectionRuleModel, _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel, _authzIoService: IAuthzIoService);
|
|
12
|
+
/**
|
|
13
|
+
* Configures a specific permission point for a workbook.
|
|
14
|
+
*
|
|
15
|
+
* This function sets or updates a permission point for a workbook identified by `unitId`.
|
|
16
|
+
* It creates a new permission point if it does not already exist, and updates the point with the provided value.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
19
|
+
* @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.
|
|
20
|
+
* @param {boolean} value - The boolean value to determine whether the permission point is enabled or disabled.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
setWorkbookPermissionPoint(unitId: string, FPointClass: WorkbookPermissionPointConstructor, value: boolean): void;
|
|
24
|
+
/**
|
|
25
|
+
* This function is used to set whether the workbook can be edited
|
|
26
|
+
*
|
|
27
|
+
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
28
|
+
* @param {boolean} value - A value that controls whether the workbook can be edited
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
setWorkbookEditPermission(unitId: string, value: boolean): void;
|
|
32
|
+
/**
|
|
33
|
+
* This function is used to add a base permission for a worksheet.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
36
|
+
* @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
|
|
37
|
+
*
|
|
38
|
+
* @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`.
|
|
39
|
+
*/
|
|
40
|
+
addWorksheetBasePermission(unitId: string, subUnitId: string): Promise<string | undefined>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete the entire table protection set for the worksheet and reset the point permissions of the worksheet to true
|
|
43
|
+
*
|
|
44
|
+
* @param {string} unitId - The unique identifier of the workbook for which the permission is being set.
|
|
45
|
+
* @param {string} subUnitId - The unique identifier of the worksheet for which the permission is being set.
|
|
46
|
+
*/
|
|
47
|
+
removeWorksheetPermission(unitId: string, subUnitId: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the worksheet permission point by updating or adding the permission point for the worksheet.
|
|
50
|
+
* If the worksheet doesn't have a base permission, it creates one to used render
|
|
51
|
+
*
|
|
52
|
+
* @param {string} unitId - The unique identifier of the workbook.
|
|
53
|
+
* @param {string} subUnitId - The unique identifier of the worksheet.
|
|
54
|
+
* @param {WorkSheetPermissionPointConstructor} FPointClass - The constructor for the permission point class.
|
|
55
|
+
* See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
|
|
56
|
+
* @param {boolean} value - The new permission value to be set for the worksheet.
|
|
57
|
+
*
|
|
58
|
+
* @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`.
|
|
59
|
+
*/
|
|
60
|
+
setWorksheetPermissionPoint(unitId: string, subUnitId: string, FPointClass: WorkSheetPermissionPointConstructor, value: boolean): Promise<string | undefined>;
|
|
61
|
+
/**
|
|
62
|
+
* Adds a range protection to the worksheet.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} unitId - The unique identifier of the workbook.
|
|
65
|
+
* @param {string} subUnitId - The unique identifier of the worksheet.
|
|
66
|
+
* @param {IRange[]} ranges - The ranges to be protected.
|
|
67
|
+
*
|
|
68
|
+
* @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
|
|
69
|
+
*/
|
|
70
|
+
addRangeBaseProtection(unitId: string, subUnitId: string, ranges: IRange[]): Promise<{
|
|
71
|
+
permissionId: string;
|
|
72
|
+
ruleId: string;
|
|
73
|
+
} | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* Removes the range protection from the worksheet.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} unitId - The unique identifier of the workbook.
|
|
78
|
+
* @param {string} subUnitId - The unique identifier of the worksheet.
|
|
79
|
+
* @param {string[]} ruleIds - The rule IDs of the range protection to be removed.
|
|
80
|
+
*/
|
|
81
|
+
removeRangeProtection(unitId: string, subUnitId: string, ruleIds: string[]): void;
|
|
82
|
+
/**
|
|
83
|
+
* Modify the permission points of a custom area
|
|
84
|
+
*
|
|
85
|
+
* @param {string} unitId - The unique identifier of the workbook.
|
|
86
|
+
* @param {string} subUnitId - The unique identifier of the worksheet within the workbook.
|
|
87
|
+
* @param {string} permissionId - The unique identifier of the permission that controls access to the range.
|
|
88
|
+
* @param {RangePermissionPointConstructor} FPointClass - The constructor for the range permission point class.
|
|
89
|
+
* See the [permission-point documentation](https://github.com/dream-num/univer/tree/dev/packages/sheets/src/services/permission/permission-point) for more details.
|
|
90
|
+
* @param {boolean} value - The new permission value to be set for the range (e.g., true for allowing access, false for restricting access).
|
|
91
|
+
*/
|
|
92
|
+
setRangeProtectionPermissionPoint(unitId: string, subUnitId: string, permissionId: string, FPointClass: RangePermissionPointConstructor, value: boolean): void;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the ranges for range protection in a worksheet.
|
|
95
|
+
*
|
|
96
|
+
* This method finds the rule by unitId, subUnitId, and ruleId, and updates the rule with the provided ranges.
|
|
97
|
+
* It checks for overlaps with existing ranges in the same subunit and shows an error message if any overlap is detected.
|
|
98
|
+
* If no overlap is found, it executes the command to update the range protection with the new ranges.
|
|
99
|
+
*
|
|
100
|
+
* @param {string} unitId - The unique identifier of the workbook.
|
|
101
|
+
* @param {string} subUnitId - The unique identifier of the worksheet within the workbook.
|
|
102
|
+
* @param {string} ruleId - The ruleId of the range protection rule that is being updated.
|
|
103
|
+
* @param {IRange[]} ranges - The array of new ranges to be set for the range protection rule.
|
|
104
|
+
*/
|
|
105
|
+
setRangeProtectionRanges(unitId: string, subUnitId: string, ruleId: string, ranges: IRange[]): void;
|
|
106
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { CellValue, ICellData, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable, Workbook, Worksheet, FBase, ICommandService, Injector, WrapStrategy } from '@univerjs/core';
|
|
2
|
+
import { FHorizontalAlignment, FVerticalAlignment } from './utils';
|
|
3
|
+
import { FormulaDataModel } from '@univerjs/engine-formula';
|
|
4
|
+
export type FontLine = 'none' | 'underline' | 'line-through';
|
|
5
|
+
export type FontStyle = 'normal' | 'italic';
|
|
6
|
+
export type FontWeight = 'normal' | 'bold';
|
|
7
|
+
export declare class FRange extends FBase {
|
|
8
|
+
protected readonly _workbook: Workbook;
|
|
9
|
+
protected readonly _worksheet: Worksheet;
|
|
10
|
+
protected readonly _range: IRange;
|
|
11
|
+
protected readonly _injector: Injector;
|
|
12
|
+
protected readonly _commandService: ICommandService;
|
|
13
|
+
protected readonly _formulaDataModel: FormulaDataModel;
|
|
14
|
+
constructor(_workbook: Workbook, _worksheet: Worksheet, _range: IRange, _injector: Injector, _commandService: ICommandService, _formulaDataModel: FormulaDataModel);
|
|
15
|
+
/**
|
|
16
|
+
* Get the unit ID of the current workbook
|
|
17
|
+
*
|
|
18
|
+
* @return The unit ID of the workbook
|
|
19
|
+
*/
|
|
20
|
+
getUnitId(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the name of the worksheet
|
|
23
|
+
*
|
|
24
|
+
* @return The name of the worksheet
|
|
25
|
+
*/
|
|
26
|
+
getSheetName(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the area where the statement is applied
|
|
29
|
+
*
|
|
30
|
+
* @return The area where the statement is applied
|
|
31
|
+
*/
|
|
32
|
+
getRange(): IRange;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the starting row number of the applied area
|
|
35
|
+
*
|
|
36
|
+
* @return The starting row number of the area
|
|
37
|
+
*/
|
|
38
|
+
getRow(): number;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the starting column number of the applied area
|
|
41
|
+
*
|
|
42
|
+
* @return The starting column number of the area
|
|
43
|
+
*/
|
|
44
|
+
getColumn(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the width of the applied area
|
|
47
|
+
*
|
|
48
|
+
* @return The width of the area
|
|
49
|
+
*/
|
|
50
|
+
getWidth(): number;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the height of the applied area
|
|
53
|
+
*
|
|
54
|
+
* @return The height of the area
|
|
55
|
+
*/
|
|
56
|
+
getHeight(): number;
|
|
57
|
+
/**
|
|
58
|
+
* Return first cell model data in this range
|
|
59
|
+
* @returns The cell model data
|
|
60
|
+
*/
|
|
61
|
+
getCellData(): ICellData | null;
|
|
62
|
+
/**
|
|
63
|
+
* Return range whether this range is merged
|
|
64
|
+
* @returns if true is merged
|
|
65
|
+
*/
|
|
66
|
+
isMerged(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Return first cell style data in this range
|
|
69
|
+
* @returns The cell style data
|
|
70
|
+
*/
|
|
71
|
+
getCellStyleData(): IStyleData | null;
|
|
72
|
+
/**
|
|
73
|
+
* Returns the value of the cell at the start of this range.
|
|
74
|
+
* @returns The value of the cell.
|
|
75
|
+
*/
|
|
76
|
+
getValue(): CellValue | null;
|
|
77
|
+
/**
|
|
78
|
+
* Returns the rectangular grid of values for this range.
|
|
79
|
+
* Returns a two-dimensional array of values, indexed by row, then by column.
|
|
80
|
+
* @returns A two-dimensional array of values.
|
|
81
|
+
*/
|
|
82
|
+
getValues(): Nullable<CellValue>[][];
|
|
83
|
+
/**
|
|
84
|
+
* Returns the cell data for the cells in the range.
|
|
85
|
+
* @returns A two-dimensional array of cell data.
|
|
86
|
+
*/
|
|
87
|
+
getCellDataGrid(): Nullable<ICellData>[][];
|
|
88
|
+
/**
|
|
89
|
+
* Returns the formulas (A1 notation) for the cells in the range. Entries in the 2D array are empty strings for cells with no formula.
|
|
90
|
+
* @returns A two-dimensional array of formulas in string format.
|
|
91
|
+
*/
|
|
92
|
+
getFormulas(): string[][];
|
|
93
|
+
getWrap(): boolean;
|
|
94
|
+
getWrapStrategy(): WrapStrategy;
|
|
95
|
+
getHorizontalAlignment(): string;
|
|
96
|
+
getVerticalAlignment(): string;
|
|
97
|
+
setBackgroundColor(color: string): Promise<boolean>;
|
|
98
|
+
/**
|
|
99
|
+
* The value can be a number, string, boolean, or standard cell format. If it begins with `=`, it is interpreted as a formula. The value is tiled to all cells in the range.
|
|
100
|
+
* @param value
|
|
101
|
+
*/
|
|
102
|
+
setValue(value: CellValue | ICellData): Promise<boolean>;
|
|
103
|
+
/**
|
|
104
|
+
* Set the cell wrap of the given range.
|
|
105
|
+
* Cells with wrap enabled (the default) resize to display their full content. Cells with wrap disabled display as much as possible in the cell without resizing or running to multiple lines.
|
|
106
|
+
*/
|
|
107
|
+
setWrap(isWrapEnabled: boolean): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Sets the text wrapping strategy for the cells in the range.
|
|
110
|
+
*/
|
|
111
|
+
setWrapStrategy(strategy: WrapStrategy): Promise<boolean>;
|
|
112
|
+
/**
|
|
113
|
+
* Set the vertical (top to bottom) alignment for the given range (top/middle/bottom).
|
|
114
|
+
*/
|
|
115
|
+
setVerticalAlignment(alignment: FVerticalAlignment): Promise<boolean>;
|
|
116
|
+
/**
|
|
117
|
+
* Set the horizontal (left to right) alignment for the given range (left/center/right).
|
|
118
|
+
*/
|
|
119
|
+
setHorizontalAlignment(alignment: FHorizontalAlignment): Promise<boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* Sets a different value for each cell in the range. The value can be a two-dimensional array or a standard range matrix (must match the dimensions of this range), consisting of numbers, strings, Boolean values or Composed of standard cell formats. If a value begins with `=`, it is interpreted as a formula.
|
|
122
|
+
* @param value
|
|
123
|
+
*/
|
|
124
|
+
setValues(value: CellValue[][] | IObjectMatrixPrimitiveType<CellValue> | ICellData[][] | IObjectMatrixPrimitiveType<ICellData>): Promise<boolean>;
|
|
125
|
+
/**
|
|
126
|
+
* Sets the font weight for the given range (normal/bold),
|
|
127
|
+
* @param fontWeight The font weight, either 'normal' or 'bold'; a null value resets the font weight.
|
|
128
|
+
*/
|
|
129
|
+
setFontWeight(fontWeight: FontWeight | null): this;
|
|
130
|
+
/**
|
|
131
|
+
* Sets the font style for the given range ('italic' or 'normal').
|
|
132
|
+
* @param fontStyle The font style, either 'italic' or 'normal'; a null value resets the font style.
|
|
133
|
+
*/
|
|
134
|
+
setFontStyle(fontStyle: FontStyle | null): this;
|
|
135
|
+
/**
|
|
136
|
+
* Sets the font line style of the given range ('underline', 'line-through', or 'none').
|
|
137
|
+
* @param fontLine The font line style, either 'underline', 'line-through', or 'none'; a null value resets the font line style.
|
|
138
|
+
*/
|
|
139
|
+
setFontLine(fontLine: FontLine | null): this;
|
|
140
|
+
/**
|
|
141
|
+
* Sets the font underline style of the given ITextDecoration
|
|
142
|
+
*/
|
|
143
|
+
private _setFontUnderline;
|
|
144
|
+
/**
|
|
145
|
+
* Sets the font strikethrough style of the given ITextDecoration
|
|
146
|
+
*/
|
|
147
|
+
private _setFontStrikethrough;
|
|
148
|
+
/**
|
|
149
|
+
* Sets the font family, such as "Arial" or "Helvetica".
|
|
150
|
+
* @param fontFamily The font family to set; a null value resets the font family.
|
|
151
|
+
*/
|
|
152
|
+
setFontFamily(fontFamily: string | null): this;
|
|
153
|
+
/**
|
|
154
|
+
* Sets the font size, with the size being the point size to use.
|
|
155
|
+
* @param size A font size in point size. A null value resets the font size.
|
|
156
|
+
*/
|
|
157
|
+
setFontSize(size: number | null): this;
|
|
158
|
+
/**
|
|
159
|
+
* Sets the font color in CSS notation (such as '#ffffff' or 'white').
|
|
160
|
+
* @param color The font color in CSS notation (such as '#ffffff' or 'white'); a null value resets the color.
|
|
161
|
+
*/
|
|
162
|
+
setFontColor(color: string | null): this;
|
|
163
|
+
/**
|
|
164
|
+
* Merge cells in a range into one merged cell
|
|
165
|
+
* @returns This range, for chaining
|
|
166
|
+
*/
|
|
167
|
+
merge(): Promise<FRange>;
|
|
168
|
+
/**
|
|
169
|
+
* Merges cells in a range horizontally.
|
|
170
|
+
* @returns This range, for chaining
|
|
171
|
+
*/
|
|
172
|
+
mergeAcross(): Promise<FRange>;
|
|
173
|
+
/**
|
|
174
|
+
* Merges cells in a range vertically.
|
|
175
|
+
* @returns This range, for chaining
|
|
176
|
+
*/
|
|
177
|
+
mergeVertically(): Promise<FRange>;
|
|
178
|
+
/**
|
|
179
|
+
* Returns true if cells in the current range overlap a merged cell.
|
|
180
|
+
* @returns {boolean} is overlap with a merged cell
|
|
181
|
+
*/
|
|
182
|
+
isPartOfMerge(): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Unmerge cells in the range
|
|
185
|
+
* @returns This range, for chaining
|
|
186
|
+
*/
|
|
187
|
+
breakApart(): FRange;
|
|
188
|
+
/**
|
|
189
|
+
* Iterate cells in this range. Merged cells will be respected.
|
|
190
|
+
* @param callback
|
|
191
|
+
*/
|
|
192
|
+
forEach(callback: (row: number, col: number, cell: ICellData) => void): void;
|
|
193
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Workbook, Worksheet, Injector } from '@univerjs/core';
|
|
2
|
+
import { ISelectionWithStyle } from '@univerjs/sheets';
|
|
3
|
+
import { FRange } from './f-range';
|
|
4
|
+
export declare class FSelection {
|
|
5
|
+
private readonly _workbook;
|
|
6
|
+
private readonly _worksheet;
|
|
7
|
+
private readonly _selections;
|
|
8
|
+
private readonly _injector;
|
|
9
|
+
constructor(_workbook: Workbook, _worksheet: Worksheet, _selections: Readonly<ISelectionWithStyle[]>, _injector: Injector);
|
|
10
|
+
getActiveRange(): FRange | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IWorkbookData } from '@univerjs/core';
|
|
2
|
+
import { FPermission } from './f-permission';
|
|
3
|
+
import { FWorkbook } from './f-workbook';
|
|
4
|
+
interface IFUniverSheetsMixin {
|
|
5
|
+
/**
|
|
6
|
+
* Create a new spreadsheet and get the API handler of that spreadsheet.
|
|
7
|
+
*
|
|
8
|
+
* @param {Partial<IWorkbookData>} data The snapshot of the spreadsheet.
|
|
9
|
+
* @returns {FWorkbook} FWorkbook API instance.
|
|
10
|
+
*/
|
|
11
|
+
createUniverSheet(data: Partial<IWorkbookData>): FWorkbook;
|
|
12
|
+
/**
|
|
13
|
+
* Get the currently focused Univer spreadsheet.
|
|
14
|
+
*
|
|
15
|
+
* @returns {FWorkbook | null} The currently focused Univer spreadsheet.
|
|
16
|
+
*/
|
|
17
|
+
getActiveWorkbook(): FWorkbook | null;
|
|
18
|
+
/**
|
|
19
|
+
* Get the spreadsheet API handler by the spreadsheet id.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} id The spreadsheet id.
|
|
22
|
+
* @returns {FWorkbook | null} The spreadsheet API instance.
|
|
23
|
+
*/
|
|
24
|
+
getUniverSheet(id: string): FWorkbook | null;
|
|
25
|
+
/**
|
|
26
|
+
* Get the PermissionInstance.
|
|
27
|
+
*
|
|
28
|
+
* @returns {FPermission} - The PermissionInstance.
|
|
29
|
+
*/
|
|
30
|
+
getPermission(): FPermission;
|
|
31
|
+
}
|
|
32
|
+
declare module '@univerjs/core' {
|
|
33
|
+
interface FUniver extends IFUniverSheetsMixin {
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export {};
|