@univerjs/sheets 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/es/facade.js +1959 -500
- package/lib/es/index.js +3640 -3263
- package/lib/types/basics/cell-position.d.ts +25 -0
- package/lib/types/basics/index.d.ts +1 -0
- package/lib/types/basics/selection.d.ts +1 -1
- package/lib/types/basics/split-range-text.d.ts +42 -0
- package/lib/types/commands/commands/__tests__/set-gridlines-command.spec.d.ts +16 -0
- package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +1 -1
- package/lib/types/commands/commands/set-gridlines-color.command.d.ts +7 -0
- package/lib/types/commands/commands/set-worksheet-show.command.d.ts +0 -1
- package/lib/types/commands/commands/split-text-to-columns.command.d.ts +15 -0
- package/lib/types/commands/mutations/set-gridlines-color.mutation.d.ts +12 -0
- package/lib/types/controllers/defined-name-data.controller.d.ts +1 -0
- package/lib/types/facade/f-defined-name.d.ts +294 -0
- package/lib/types/facade/f-permission.d.ts +49 -1
- package/lib/types/facade/f-range.d.ts +96 -5
- package/lib/types/facade/f-selection.d.ts +71 -1
- package/lib/types/facade/f-univer.d.ts +17 -3
- package/lib/types/facade/f-workbook.d.ts +345 -7
- package/lib/types/facade/f-worksheet.d.ts +350 -11
- package/lib/types/index.d.ts +13 -2
- package/lib/types/services/__tests__/move-active-cell.spec.d.ts +16 -0
- package/lib/types/services/exclusive-range/exclusive-range-service.d.ts +12 -0
- package/lib/types/services/permission/permission-point/const.d.ts +82 -0
- package/lib/types/services/ref-range/util.d.ts +1 -1
- package/lib/types/services/selections/index.d.ts +1 -1
- package/lib/types/services/selections/move-active-cell-util.d.ts +10 -0
- package/lib/types/services/selections/selection-data-model.d.ts +5 -10
- package/lib/types/services/selections/selection.service.d.ts +21 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +8 -8
|
@@ -0,0 +1,25 @@
|
|
|
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 interface ICellOverGridPosition {
|
|
17
|
+
column: number;
|
|
18
|
+
columnOffset: number;
|
|
19
|
+
row: number;
|
|
20
|
+
rowOffset: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ISheetOverGridPosition {
|
|
23
|
+
from: ICellOverGridPosition;
|
|
24
|
+
to: ICellOverGridPosition;
|
|
25
|
+
}
|
|
@@ -120,7 +120,7 @@ export interface ISelectionWithStyle extends ISelection {
|
|
|
120
120
|
* if primary is not defined, means not keep current primary cell.
|
|
121
121
|
*/
|
|
122
122
|
primary: Nullable<ISelectionCell>;
|
|
123
|
-
style
|
|
123
|
+
style?: Nullable<Partial<ISelectionStyle>>;
|
|
124
124
|
}
|
|
125
125
|
export interface ISheetRangeLocation {
|
|
126
126
|
range: IRange;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IRange, Worksheet } from '@univerjs/core';
|
|
2
|
+
/**
|
|
3
|
+
* The default delimiter to split the text.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum SplitDelimiterEnum {
|
|
6
|
+
/**
|
|
7
|
+
* The tab character
|
|
8
|
+
*/
|
|
9
|
+
Tab = 1,
|
|
10
|
+
/**
|
|
11
|
+
* The comma character
|
|
12
|
+
*/
|
|
13
|
+
Comma = 2,
|
|
14
|
+
/**
|
|
15
|
+
* The semicolon character
|
|
16
|
+
*/
|
|
17
|
+
Semicolon = 4,
|
|
18
|
+
/**
|
|
19
|
+
* The space character
|
|
20
|
+
*/
|
|
21
|
+
Space = 8,
|
|
22
|
+
/**
|
|
23
|
+
* The custom delimiter
|
|
24
|
+
*/
|
|
25
|
+
Custom = 16
|
|
26
|
+
}
|
|
27
|
+
interface ISplitRangeTextResult {
|
|
28
|
+
rs: (string[] | undefined)[];
|
|
29
|
+
maxLength: number;
|
|
30
|
+
lastRow: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Split the text in the range into a two-dimensional array.
|
|
34
|
+
* @param {Worksheet} sheet The worksheet which range belongs to.
|
|
35
|
+
* @param {IRange} range The range to split.
|
|
36
|
+
* @param {SplitDelimiterEnum} [delimiter] The delimiter to split the text.
|
|
37
|
+
* @param {string} [customDelimiter] The custom delimiter to split the text. An error will be thrown if customDelimiter is not a character.
|
|
38
|
+
* @param {boolean} [treatMultipleDelimitersAsOne] split multiple delimiters as one.
|
|
39
|
+
* @returns {ISplitRangeTextResult} The two-dimensional array of the split text and max column length.
|
|
40
|
+
*/
|
|
41
|
+
export declare function splitRangeText(sheet: Worksheet, range: IRange, delimiter?: SplitDelimiterEnum, customDelimiter?: string, treatMultipleDelimitersAsOne?: boolean): ISplitRangeTextResult;
|
|
42
|
+
export {};
|
|
@@ -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 {};
|
|
@@ -9,4 +9,4 @@ export declare const AddWorksheetMergeCommand: ICommand;
|
|
|
9
9
|
export declare const AddWorksheetMergeAllCommand: ICommand;
|
|
10
10
|
export declare const AddWorksheetMergeVerticalCommand: ICommand;
|
|
11
11
|
export declare const AddWorksheetMergeHorizontalCommand: ICommand;
|
|
12
|
-
export declare function addMergeCellsUtil(injector: Injector, unitId: string, subUnitId: string, ranges: IRange[]): Promise<void>;
|
|
12
|
+
export declare function addMergeCellsUtil(injector: Injector, unitId: string, subUnitId: string, ranges: IRange[], defaultMerge: boolean): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IAccessor, IRange, CommandType } from '@univerjs/core';
|
|
2
|
+
import { SplitDelimiterEnum } from '../../basics/split-range-text';
|
|
3
|
+
export interface ISplitTextToColumnsCommandParams {
|
|
4
|
+
unitId: string;
|
|
5
|
+
subUnitId: string;
|
|
6
|
+
range: IRange;
|
|
7
|
+
delimiter?: SplitDelimiterEnum;
|
|
8
|
+
customDelimiter?: string;
|
|
9
|
+
treatMultipleDelimitersAsOne?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const SplitTextToColumnsCommand: {
|
|
12
|
+
type: CommandType;
|
|
13
|
+
id: string;
|
|
14
|
+
handler: (accessor: IAccessor, params: ISplitTextToColumnsCommandParams) => Promise<boolean>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IAccessor, IMutation } from '@univerjs/core';
|
|
2
|
+
export interface ISetGridlinesColorMutationParams {
|
|
3
|
+
color: string | undefined;
|
|
4
|
+
unitId: string;
|
|
5
|
+
subUnitId: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const SetGridlinesColorUndoMutationFactory: (accessor: IAccessor, params: ISetGridlinesColorMutationParams) => {
|
|
8
|
+
unitId: string;
|
|
9
|
+
subUnitId: string;
|
|
10
|
+
color: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare const SetGridlinesColorMutation: IMutation<ISetGridlinesColorMutationParams>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Disposable, IResourceManagerService } from '@univerjs/core';
|
|
2
2
|
import { IDefinedNamesService } from '@univerjs/engine-formula';
|
|
3
|
+
export declare const SCOPE_WORKBOOK_VALUE_DEFINED_NAME = "AllDefaultWorkbook";
|
|
3
4
|
export declare class DefinedNameDataController extends Disposable {
|
|
4
5
|
private readonly _definedNamesService;
|
|
5
6
|
private _resourceManagerService;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { FWorksheet } from './f-worksheet';
|
|
2
|
+
import { FBase, IAuthzIoService, ICommandService, Injector, IPermissionService, LocaleService } from '@univerjs/core';
|
|
3
|
+
import { IDefinedNamesService, ISetDefinedNameMutationParam } from '@univerjs/engine-formula';
|
|
4
|
+
import { RangeProtectionRuleModel, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';
|
|
5
|
+
export declare class FDefinedNameBuilder {
|
|
6
|
+
private _definedNameParam;
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Sets the name of the defined name builder.
|
|
10
|
+
* @param name The name of the defined name.
|
|
11
|
+
* @returns The defined name builder.
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
15
|
+
* const definedNameBuilder = UniverAPI.newDefinedName()
|
|
16
|
+
* .setName('MyDefinedName')
|
|
17
|
+
* .build();
|
|
18
|
+
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
setName(name: string): FDefinedNameBuilder;
|
|
22
|
+
/**
|
|
23
|
+
* Sets the formula of the defined name builder.
|
|
24
|
+
* @param formula The formula of the defined name.
|
|
25
|
+
* @returns The defined name builder.
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
29
|
+
* const definedNameBuilder = UniverAPI.newDefinedName()
|
|
30
|
+
* .setFormula('SUM(Sheet1!$A$1)')
|
|
31
|
+
* .setName('MyDefinedName')
|
|
32
|
+
* .build();
|
|
33
|
+
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
setFormula(formula: string): FDefinedNameBuilder;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the reference of the defined name builder.
|
|
39
|
+
* @param refString The reference of the defined name.
|
|
40
|
+
* @returns The defined name builder.
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
44
|
+
* const definedNameBuilder = UniverAPI.newDefinedName()
|
|
45
|
+
* .setRef('Sheet1!$A$1')
|
|
46
|
+
* .build();
|
|
47
|
+
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
setRef(a1Notation: string): FDefinedNameBuilder;
|
|
51
|
+
/**
|
|
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.
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
61
|
+
* const definedNameBuilder = UniverAPI.newDefinedName()
|
|
62
|
+
* .setRefByRange(1, 3, 2, 5)
|
|
63
|
+
* .build();
|
|
64
|
+
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
setRefByRange(row: number, column: number, numRows: number, numColumns: number): FDefinedNameBuilder;
|
|
68
|
+
/**
|
|
69
|
+
* Sets the comment of the defined name builder.
|
|
70
|
+
* @param comment The comment of the defined name.
|
|
71
|
+
* @returns The defined name builder.
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
75
|
+
* const definedNameBuilder = UniverAPI.newDefinedName()
|
|
76
|
+
* .setComment('This is a comment')
|
|
77
|
+
* .build();
|
|
78
|
+
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
setComment(comment: string): FDefinedNameBuilder;
|
|
82
|
+
/**
|
|
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.
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
89
|
+
* const definedNameBuilder = UniverAPI.newDefinedName()
|
|
90
|
+
* .setHidden(true)
|
|
91
|
+
* .build();
|
|
92
|
+
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
setHidden(hidden: boolean): FDefinedNameBuilder;
|
|
96
|
+
/**
|
|
97
|
+
* Builds the defined name.
|
|
98
|
+
* @returns The defined name mutation parameter.
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
102
|
+
* const definedNameBuilder = UniverAPI.newDefinedName()
|
|
103
|
+
* .setRef('Sheet1!$A$1')
|
|
104
|
+
* .setName('MyDefinedName')
|
|
105
|
+
* .build();
|
|
106
|
+
* workbook.insertDefinedNameBuilder(definedNameBuilder);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
build(): ISetDefinedNameMutationParam;
|
|
110
|
+
load(param: ISetDefinedNameMutationParam): FDefinedNameBuilder;
|
|
111
|
+
}
|
|
112
|
+
export declare class FDefinedName extends FBase {
|
|
113
|
+
protected _definedNameParam: ISetDefinedNameMutationParam;
|
|
114
|
+
protected readonly _injector: Injector;
|
|
115
|
+
protected readonly _commandService: ICommandService;
|
|
116
|
+
protected readonly _permissionService: IPermissionService;
|
|
117
|
+
protected readonly _worksheetProtectionRuleModel: WorksheetProtectionRuleModel;
|
|
118
|
+
protected readonly _rangeProtectionRuleModel: RangeProtectionRuleModel;
|
|
119
|
+
protected readonly _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel;
|
|
120
|
+
protected readonly _authzIoService: IAuthzIoService;
|
|
121
|
+
protected readonly _localeService: LocaleService;
|
|
122
|
+
protected readonly _definedNamesService: IDefinedNamesService;
|
|
123
|
+
constructor(_definedNameParam: ISetDefinedNameMutationParam, _injector: Injector, _commandService: ICommandService, _permissionService: IPermissionService, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel, _rangeProtectionRuleModel: RangeProtectionRuleModel, _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel, _authzIoService: IAuthzIoService, _localeService: LocaleService, _definedNamesService: IDefinedNamesService);
|
|
124
|
+
private _apply;
|
|
125
|
+
/**
|
|
126
|
+
* Gets the name of the defined name.
|
|
127
|
+
* @returns The name of the defined name.
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
131
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
132
|
+
* console.log(definedName.getName());
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
getName(): string;
|
|
136
|
+
/**
|
|
137
|
+
* Sets the name of the defined name.
|
|
138
|
+
* @param name The name of the defined name.
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
142
|
+
* const definedName = workbook.getDefinedName('MyDefinedName');
|
|
143
|
+
* definedName.setName('NewDefinedName');
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
setName(name: string): void;
|
|
147
|
+
/**
|
|
148
|
+
* Sets the formula of the defined name.
|
|
149
|
+
* @param formula The formula of the defined name.
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
153
|
+
* const definedName = workbook.getDefinedName('MyDefinedName');
|
|
154
|
+
* definedName.setFormula('SUM(Sheet1!$A$1)');
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
setFormula(formula: string): void;
|
|
158
|
+
/**
|
|
159
|
+
* Sets the reference of the defined name.
|
|
160
|
+
* @param refString The reference of the defined name.
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
164
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
165
|
+
* definedName.setRef('Sheet1!$A$1');
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
setRef(refString: string): void;
|
|
169
|
+
/**
|
|
170
|
+
* Gets the reference of the defined name.
|
|
171
|
+
* @returns The reference of the defined name.
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
175
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
176
|
+
* console.log(definedName.getFormulaOrRefString());
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
getFormulaOrRefString(): string;
|
|
180
|
+
/**
|
|
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.
|
|
186
|
+
* @example
|
|
187
|
+
* ```ts
|
|
188
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
189
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
190
|
+
* definedName.setRefByRange(1, 3, 2, 5);
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
setRefByRange(row: number, column: number, numRows: number, numColumns: number): void;
|
|
194
|
+
/**
|
|
195
|
+
* Gets the comment of the defined name.
|
|
196
|
+
* @returns The comment of the defined name.
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
200
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
201
|
+
* console.log(definedName.getComment());
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
getComment(): string | undefined;
|
|
205
|
+
/**
|
|
206
|
+
* Sets the comment of the defined name.
|
|
207
|
+
* @param comment The comment of the defined name.
|
|
208
|
+
* @example
|
|
209
|
+
* ```ts
|
|
210
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
211
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
212
|
+
* definedName.setComment('This is a comment');
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
setComment(comment: string): void;
|
|
216
|
+
/**
|
|
217
|
+
* Sets the scope of the defined name to the worksheet.
|
|
218
|
+
* @param worksheet The worksheet to set the scope to.
|
|
219
|
+
* @example
|
|
220
|
+
* ```ts
|
|
221
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
222
|
+
* const worksheet = workbook.getWorksheets[0];
|
|
223
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
224
|
+
* definedName.setScopeToWorksheet(worksheet);
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
setScopeToWorksheet(worksheet: FWorksheet): void;
|
|
228
|
+
/**
|
|
229
|
+
* Sets the scope of the defined name to the workbook.
|
|
230
|
+
* @example
|
|
231
|
+
* ```ts
|
|
232
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
233
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
234
|
+
* definedName.setScopeToWorkbook();
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
setScopeToWorkbook(): void;
|
|
238
|
+
/**
|
|
239
|
+
* Sets the hidden status of the defined name.
|
|
240
|
+
* @param hidden The hidden status of the defined name.
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
244
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
245
|
+
* definedName.setHidden(true);
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
setHidden(hidden: boolean): void;
|
|
249
|
+
/**
|
|
250
|
+
* Deletes the defined name.
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
254
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
255
|
+
* definedName.delete();
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
delete(): void;
|
|
259
|
+
/**
|
|
260
|
+
* Gets the local sheet id of the defined name.
|
|
261
|
+
* @returns The local sheet id of the defined name.
|
|
262
|
+
* @example
|
|
263
|
+
* ```ts
|
|
264
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
265
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
266
|
+
* console.log(definedName.getLocalSheetId());
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
getLocalSheetId(): string | undefined;
|
|
270
|
+
/**
|
|
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.
|
|
273
|
+
* @example
|
|
274
|
+
* ```ts
|
|
275
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
276
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
277
|
+
* console.log(definedName.isWorkbookScope());
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
isWorkbookScope(): boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Converts the defined name to a defined name builder.
|
|
283
|
+
* @returns The defined name builder.
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* const workbook = UniverAPI.getActiveWorkbook();
|
|
287
|
+
* const definedName = workbook.getDefinedNames[0];
|
|
288
|
+
* const definedNameBuilder = definedName.toBuilder();
|
|
289
|
+
* const param definedNameBuilder.setName('NewDefinedName').setFormula('SUM(Sheet1!$A$1)').build();
|
|
290
|
+
* workbook.updateDefinedNameBuilder(param);
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
toBuilder(): FDefinedNameBuilder;
|
|
294
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRange, RangePermissionPointConstructor, WorkbookPermissionPointConstructor, WorkSheetPermissionPointConstructor, FBase, IAuthzIoService, ICommandService, Injector, IPermissionService } from '@univerjs/core';
|
|
2
|
-
import { RangeProtectionRuleModel, WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from '@univerjs/sheets';
|
|
2
|
+
import { RangeProtectionRuleModel, WorkbookEditablePermission, WorksheetEditPermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetViewPermission } from '@univerjs/sheets';
|
|
3
3
|
export declare class FPermission extends FBase {
|
|
4
4
|
protected readonly _injector: Injector;
|
|
5
5
|
protected readonly _commandService: ICommandService;
|
|
@@ -8,6 +8,48 @@ export declare class FPermission extends FBase {
|
|
|
8
8
|
protected readonly _rangeProtectionRuleModel: RangeProtectionRuleModel;
|
|
9
9
|
protected readonly _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel;
|
|
10
10
|
protected readonly _authzIoService: IAuthzIoService;
|
|
11
|
+
permissionPointsDefinition: {
|
|
12
|
+
WorkbookCommentPermission: typeof import('@univerjs/sheets').WorkbookCommentPermission;
|
|
13
|
+
WorkbookCopyPermission: typeof import('@univerjs/sheets').WorkbookCopyPermission;
|
|
14
|
+
WorkbookCreateProtectPermission: typeof import('@univerjs/sheets').WorkbookCreateProtectPermission;
|
|
15
|
+
WorkbookCreateSheetPermission: typeof import('@univerjs/sheets').WorkbookCreateSheetPermission;
|
|
16
|
+
WorkbookDeleteSheetPermission: typeof import('@univerjs/sheets').WorkbookDeleteSheetPermission;
|
|
17
|
+
WorkbookDuplicatePermission: typeof import('@univerjs/sheets').WorkbookDuplicatePermission;
|
|
18
|
+
WorkbookEditablePermission: typeof WorkbookEditablePermission;
|
|
19
|
+
WorkbookExportPermission: typeof import('@univerjs/sheets').WorkbookExportPermission;
|
|
20
|
+
WorkbookHideSheetPermission: typeof import('@univerjs/sheets').WorkbookHideSheetPermission;
|
|
21
|
+
WorkbookHistoryPermission: typeof import('@univerjs/sheets').WorkbookHistoryPermission;
|
|
22
|
+
WorkbookManageCollaboratorPermission: typeof import('@univerjs/sheets').WorkbookManageCollaboratorPermission;
|
|
23
|
+
WorkbookMoveSheetPermission: typeof import('@univerjs/sheets').WorkbookMoveSheetPermission;
|
|
24
|
+
WorkbookPrintPermission: typeof import('@univerjs/sheets').WorkbookPrintPermission;
|
|
25
|
+
WorkbookRecoverHistoryPermission: typeof import('@univerjs/sheets').WorkbookRecoverHistoryPermission;
|
|
26
|
+
WorkbookRenameSheetPermission: typeof import('@univerjs/sheets').WorkbookRenameSheetPermission;
|
|
27
|
+
WorkbookSharePermission: typeof import('@univerjs/sheets').WorkbookSharePermission;
|
|
28
|
+
WorkbookViewHistoryPermission: typeof import('@univerjs/sheets').WorkbookViewHistoryPermission;
|
|
29
|
+
WorkbookViewPermission: typeof import('@univerjs/sheets').WorkbookViewPermission;
|
|
30
|
+
WorksheetCopyPermission: typeof import('@univerjs/sheets').WorksheetCopyPermission;
|
|
31
|
+
WorksheetDeleteColumnPermission: typeof import('@univerjs/sheets').WorksheetDeleteColumnPermission;
|
|
32
|
+
WorksheetDeleteProtectionPermission: typeof import('@univerjs/sheets').WorksheetDeleteProtectionPermission;
|
|
33
|
+
WorksheetDeleteRowPermission: typeof import('@univerjs/sheets').WorksheetDeleteRowPermission;
|
|
34
|
+
WorksheetEditExtraObjectPermission: typeof import('@univerjs/sheets').WorksheetEditExtraObjectPermission;
|
|
35
|
+
WorksheetEditPermission: typeof WorksheetEditPermission;
|
|
36
|
+
WorksheetFilterPermission: typeof import('@univerjs/sheets').WorksheetFilterPermission;
|
|
37
|
+
WorksheetInsertColumnPermission: typeof import('@univerjs/sheets').WorksheetInsertColumnPermission;
|
|
38
|
+
WorksheetInsertHyperlinkPermission: typeof import('@univerjs/sheets').WorksheetInsertHyperlinkPermission;
|
|
39
|
+
WorksheetInsertRowPermission: typeof import('@univerjs/sheets').WorksheetInsertRowPermission;
|
|
40
|
+
WorksheetManageCollaboratorPermission: typeof import('@univerjs/sheets').WorksheetManageCollaboratorPermission;
|
|
41
|
+
WorksheetPivotTablePermission: typeof import('@univerjs/sheets').WorksheetPivotTablePermission;
|
|
42
|
+
WorksheetSelectProtectedCellsPermission: typeof import('@univerjs/sheets').WorksheetSelectProtectedCellsPermission;
|
|
43
|
+
WorksheetSelectUnProtectedCellsPermission: typeof import('@univerjs/sheets').WorksheetSelectUnProtectedCellsPermission;
|
|
44
|
+
WorksheetSetCellStylePermission: typeof import('@univerjs/sheets').WorksheetSetCellStylePermission;
|
|
45
|
+
WorksheetSetCellValuePermission: typeof import('@univerjs/sheets').WorksheetSetCellValuePermission;
|
|
46
|
+
WorksheetSetColumnStylePermission: typeof import('@univerjs/sheets').WorksheetSetColumnStylePermission;
|
|
47
|
+
WorksheetSetRowStylePermission: typeof import('@univerjs/sheets').WorksheetSetRowStylePermission;
|
|
48
|
+
WorksheetSortPermission: typeof import('@univerjs/sheets').WorksheetSortPermission;
|
|
49
|
+
WorksheetViewPermission: typeof WorksheetViewPermission;
|
|
50
|
+
RangeProtectionPermissionEditPoint: typeof import('@univerjs/sheets').RangeProtectionPermissionEditPoint;
|
|
51
|
+
RangeProtectionPermissionViewPoint: typeof import('@univerjs/sheets').RangeProtectionPermissionViewPoint;
|
|
52
|
+
};
|
|
11
53
|
constructor(_injector: Injector, _commandService: ICommandService, _permissionService: IPermissionService, _worksheetProtectionRuleModel: WorksheetProtectionRuleModel, _rangeProtectionRuleModel: RangeProtectionRuleModel, _worksheetProtectionPointRuleModel: WorksheetProtectionPointModel, _authzIoService: IAuthzIoService);
|
|
12
54
|
/**
|
|
13
55
|
* Configures a specific permission point for a workbook.
|
|
@@ -103,4 +145,10 @@ export declare class FPermission extends FBase {
|
|
|
103
145
|
* @param {IRange[]} ranges - The array of new ranges to be set for the range protection rule.
|
|
104
146
|
*/
|
|
105
147
|
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;
|
|
106
154
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CellValue, ICellData, IObjectMatrixPrimitiveType, IRange, IStyleData, Nullable, Workbook, Worksheet, FBase, ICommandService, Injector, WrapStrategy } from '@univerjs/core';
|
|
2
|
+
import { SplitDelimiterEnum } from '@univerjs/sheets';
|
|
2
3
|
import { FHorizontalAlignment, FVerticalAlignment } from './utils';
|
|
3
4
|
import { FormulaDataModel } from '@univerjs/engine-formula';
|
|
4
5
|
export type FontLine = 'none' | 'underline' | 'line-through';
|
|
@@ -94,7 +95,21 @@ export declare class FRange extends FBase {
|
|
|
94
95
|
getWrapStrategy(): WrapStrategy;
|
|
95
96
|
getHorizontalAlignment(): string;
|
|
96
97
|
getVerticalAlignment(): string;
|
|
98
|
+
/**
|
|
99
|
+
* Set background color for current range.
|
|
100
|
+
* @example
|
|
101
|
+
* ```
|
|
102
|
+
* univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackgroundColor('red')
|
|
103
|
+
* ```
|
|
104
|
+
* @param color {string}
|
|
105
|
+
*/
|
|
97
106
|
setBackgroundColor(color: string): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* Set background color for current range.
|
|
109
|
+
* e.g. `univerAPI.getActiveWorkbook().getActiveSheet().getActiveRange().setBackground('red')`
|
|
110
|
+
* @param color {string}
|
|
111
|
+
*/
|
|
112
|
+
setBackground(color: string): Promise<boolean>;
|
|
98
113
|
/**
|
|
99
114
|
* 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
115
|
* @param value
|
|
@@ -162,32 +177,108 @@ export declare class FRange extends FBase {
|
|
|
162
177
|
setFontColor(color: string | null): this;
|
|
163
178
|
/**
|
|
164
179
|
* Merge cells in a range into one merged cell
|
|
180
|
+
*
|
|
181
|
+
* @param [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
182
|
+
*
|
|
165
183
|
* @returns This range, for chaining
|
|
166
184
|
*/
|
|
167
|
-
merge(): Promise<FRange>;
|
|
185
|
+
merge(defaultMerge?: boolean): Promise<FRange>;
|
|
168
186
|
/**
|
|
169
187
|
* Merges cells in a range horizontally.
|
|
188
|
+
*
|
|
189
|
+
* @param [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
190
|
+
*
|
|
170
191
|
* @returns This range, for chaining
|
|
171
192
|
*/
|
|
172
|
-
mergeAcross(): Promise<FRange>;
|
|
193
|
+
mergeAcross(defaultMerge?: boolean): Promise<FRange>;
|
|
173
194
|
/**
|
|
174
195
|
* Merges cells in a range vertically.
|
|
196
|
+
*
|
|
197
|
+
* @param [defaultMerge] - If true, only the value in the upper left cell is retained.
|
|
198
|
+
*
|
|
175
199
|
* @returns This range, for chaining
|
|
176
200
|
*/
|
|
177
|
-
mergeVertically(): Promise<FRange>;
|
|
201
|
+
mergeVertically(defaultMerge?: boolean): Promise<FRange>;
|
|
178
202
|
/**
|
|
179
203
|
* Returns true if cells in the current range overlap a merged cell.
|
|
180
204
|
* @returns {boolean} is overlap with a merged cell
|
|
181
205
|
*/
|
|
182
206
|
isPartOfMerge(): boolean;
|
|
183
207
|
/**
|
|
184
|
-
*
|
|
208
|
+
* Break all horizontally- or vertically-merged cells contained within the range list into individual cells again.
|
|
185
209
|
* @returns This range, for chaining
|
|
186
210
|
*/
|
|
187
211
|
breakApart(): FRange;
|
|
188
212
|
/**
|
|
189
213
|
* Iterate cells in this range. Merged cells will be respected.
|
|
190
|
-
* @param callback
|
|
214
|
+
* @param callback the callback function to be called for each cell in the range
|
|
215
|
+
* @param {number} callback.row the row number of the cell
|
|
216
|
+
* @param {number} callback.col the column number of the cell
|
|
217
|
+
* @param {ICellData} callback.cell the cell data
|
|
218
|
+
* ```ts
|
|
219
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
220
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
221
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
222
|
+
* fRange.forEach((row, col, cell) => {
|
|
223
|
+
* console.log(row, col, cell);
|
|
224
|
+
* });
|
|
225
|
+
* ```
|
|
191
226
|
*/
|
|
192
227
|
forEach(callback: (row: number, col: number, cell: ICellData) => void): void;
|
|
228
|
+
/**
|
|
229
|
+
* Returns a string description of the range, in A1 notation.
|
|
230
|
+
* @returns {string} The A1 notation of the range.
|
|
231
|
+
* ```ts
|
|
232
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
233
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
234
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
235
|
+
* console.log(fRange.getA1Notation()); // A1:B2
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
getA1Notation(withSheet?: boolean): string;
|
|
239
|
+
/**
|
|
240
|
+
* Sets the specified range as the active range, with the top left cell in the range as the current cell.
|
|
241
|
+
* @returns {FRange} This range, for chaining.
|
|
242
|
+
* @example
|
|
243
|
+
* ```ts
|
|
244
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
245
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
246
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
247
|
+
* fRange.activate(); // the active cell will be A1
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
activate(): FRange;
|
|
251
|
+
/**
|
|
252
|
+
* Sets the specified cell as the current cell.
|
|
253
|
+
* If the specified cell is present in an existing range, then that range becomes the active range with the cell as the current cell.
|
|
254
|
+
* If the specified cell is not part of an existing range, then a new range is created with the cell as the active range and the current cell.
|
|
255
|
+
* @returns {FRange} This range, for chaining.
|
|
256
|
+
* @description If the range is not a single cell, an error will be thrown.
|
|
257
|
+
*/
|
|
258
|
+
activateAsCurrentCell(): FRange;
|
|
259
|
+
/**
|
|
260
|
+
* Splits a column of text into multiple columns based on an auto-detected delimiter.
|
|
261
|
+
* @param {boolean} [treatMultipleDelimitersAsOne] Whether to treat multiple continuous delimiters as one. The default value is false.
|
|
262
|
+
* @example
|
|
263
|
+
* // A1:A3 has following values:
|
|
264
|
+
* // A | B | C
|
|
265
|
+
* // 1,2,3 | |
|
|
266
|
+
* // 4,,5,6 | |
|
|
267
|
+
* // After calling splitTextToColumns(true), the range will be:
|
|
268
|
+
* // A | B | C
|
|
269
|
+
* // 1 | 2 | 3
|
|
270
|
+
* // 4 | 5 | 6
|
|
271
|
+
* // After calling splitTextToColumns(false), the range will be:
|
|
272
|
+
* // A | B | C | D
|
|
273
|
+
* // 1 | 2 | 3 |
|
|
274
|
+
* // 4 | | 5 | 6
|
|
275
|
+
*/
|
|
276
|
+
splitTextToColumns(treatMultipleDelimitersAsOne?: boolean): void;
|
|
277
|
+
/**
|
|
278
|
+
* Splits a column of text into multiple columns based on a specified delimiter.
|
|
279
|
+
* @param {boolean} [treatMultipleDelimitersAsOne] Whether to treat multiple continuous delimiters as one. The default value is false.
|
|
280
|
+
* @param {SplitDelimiterEnum} [delimiter] The delimiter to use to split the text. The default delimiter is Tab(1)、Comma(2)、Semicolon(4)、Space(8)、Custom(16).A delimiter like 6 (SplitDelimiterEnum.Comma|SplitDelimiterEnum.Semicolon) means using Comma and Semicolon to split the text.
|
|
281
|
+
* @returns {void}
|
|
282
|
+
*/
|
|
283
|
+
splitTextToColumns(treatMultipleDelimitersAsOne?: boolean, delimiter?: SplitDelimiterEnum): void;
|
|
193
284
|
}
|