@univerjs/sheets 0.23.0 → 0.24.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 +3 -43
- package/lib/cjs/index.js +17 -17
- package/lib/es/facade.js +4 -44
- package/lib/es/index.js +17 -17
- package/lib/facade.js +4 -44
- package/lib/index.js +17 -17
- package/lib/types/facade/f-worksheet.d.ts +3 -24
- package/lib/types/index.d.ts +7 -7
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +8 -8
- /package/lib/types/commands/commands/{set-border-command.d.ts → set-border.command.d.ts} +0 -0
- /package/lib/types/commands/mutations/{numfmt-mutation.d.ts → numfmt.mutation.d.ts} +0 -0
- /package/lib/types/commands/utils/{handle-range-mutation.d.ts → handle-range.mutation.d.ts} +0 -0
- /package/lib/types/services/exclusive-range/{exclusive-range-service.d.ts → exclusive-range.service.d.ts} +0 -0
- /package/lib/types/services/{range-theme-service.d.ts → range-theme.service.d.ts} +0 -0
package/lib/cjs/facade.js
CHANGED
|
@@ -3334,7 +3334,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends _univerjs_core_facade.FB
|
|
|
3334
3334
|
* Sets the frozen state of the current sheet.
|
|
3335
3335
|
* @param {IFreeze} freeze - the scrolling viewport start range and count of freezed rows and columns.
|
|
3336
3336
|
* that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
|
|
3337
|
-
* @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
|
|
3338
3337
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
3339
3338
|
* @example
|
|
3340
3339
|
* ```typescript
|
|
@@ -3349,7 +3348,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends _univerjs_core_facade.FB
|
|
|
3349
3348
|
* ```
|
|
3350
3349
|
*/
|
|
3351
3350
|
setFreeze(freeze) {
|
|
3352
|
-
this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead");
|
|
3353
3351
|
this._commandService.syncExecuteCommand(_univerjs_sheets.SetFrozenCommand.id, {
|
|
3354
3352
|
...freeze,
|
|
3355
3353
|
unitId: this._workbook.getUnitId(),
|
|
@@ -3605,28 +3603,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends _univerjs_core_facade.FB
|
|
|
3605
3603
|
return this._worksheet.getTabColor();
|
|
3606
3604
|
}
|
|
3607
3605
|
/**
|
|
3608
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => {})` instead
|
|
3609
|
-
*/
|
|
3610
|
-
onCellDataChange(callback) {
|
|
3611
|
-
return this._injector.get(_univerjs_core.ICommandService).onCommandExecuted((command) => {
|
|
3612
|
-
if (command.id === _univerjs_sheets.SetRangeValuesMutation.id) {
|
|
3613
|
-
const params = command.params;
|
|
3614
|
-
if (params.unitId === this._workbook.getUnitId() && params.subUnitId === this._worksheet.getSheetId() && params.cellValue) callback(new _univerjs_core.ObjectMatrix(params.cellValue));
|
|
3615
|
-
}
|
|
3616
|
-
});
|
|
3617
|
-
}
|
|
3618
|
-
/**
|
|
3619
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {})` instead
|
|
3620
|
-
*/
|
|
3621
|
-
onBeforeCellDataChange(callback) {
|
|
3622
|
-
return this._injector.get(_univerjs_core.ICommandService).beforeCommandExecuted((command) => {
|
|
3623
|
-
if (command.id === _univerjs_sheets.SetRangeValuesMutation.id) {
|
|
3624
|
-
const params = command.params;
|
|
3625
|
-
if (params.unitId === this._workbook.getUnitId() && params.subUnitId === this._worksheet.getSheetId() && params.cellValue) callback(new _univerjs_core.ObjectMatrix(params.cellValue));
|
|
3626
|
-
}
|
|
3627
|
-
});
|
|
3628
|
-
}
|
|
3629
|
-
/**
|
|
3630
3606
|
* Hides this sheet. Has no effect if the sheet is already hidden. If this method is called on the only visible sheet, it throws an exception.
|
|
3631
3607
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
3632
3608
|
* @example
|
|
@@ -3822,7 +3798,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends _univerjs_core_facade.FB
|
|
|
3822
3798
|
}
|
|
3823
3799
|
/**
|
|
3824
3800
|
* Returns a Range corresponding to the dimensions in which data is present.
|
|
3825
|
-
*
|
|
3801
|
+
* Empty cells with style or formatting will also be included in the data range. If there is no data on the sheet, returns a Range corresponding to the top-left cell of the sheet (A1).
|
|
3826
3802
|
* @returns {FRange} The range of the data in the sheet.
|
|
3827
3803
|
* @example
|
|
3828
3804
|
* ```ts
|
|
@@ -3839,14 +3815,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends _univerjs_core_facade.FB
|
|
|
3839
3815
|
return this.getRange(startRow, startColumn, endRow - startRow + 1, endColumn - startColumn + 1);
|
|
3840
3816
|
}
|
|
3841
3817
|
/**
|
|
3842
|
-
* @deprecated use `getLastColumn` instead.
|
|
3843
|
-
* Returns the column index of the last column that contains content.
|
|
3844
|
-
* @returns {number} the column index of the last column that contains content.
|
|
3845
|
-
*/
|
|
3846
|
-
getLastColumns() {
|
|
3847
|
-
return this._worksheet.getLastColumnWithContent();
|
|
3848
|
-
}
|
|
3849
|
-
/**
|
|
3850
3818
|
* Returns the column index of the last column that contains content.
|
|
3851
3819
|
* @returns {number} the column index of the last column that contains content.
|
|
3852
3820
|
* @example
|
|
@@ -3863,14 +3831,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends _univerjs_core_facade.FB
|
|
|
3863
3831
|
return this._worksheet.getLastColumnWithContent();
|
|
3864
3832
|
}
|
|
3865
3833
|
/**
|
|
3866
|
-
* @deprecated use `getLastRow` instead.
|
|
3867
|
-
* Returns the row index of the last row that contains content.
|
|
3868
|
-
* @returns {number} the row index of the last row that contains content.
|
|
3869
|
-
*/
|
|
3870
|
-
getLastRows() {
|
|
3871
|
-
return this._worksheet.getLastRowWithContent();
|
|
3872
|
-
}
|
|
3873
|
-
/**
|
|
3874
3834
|
* Returns the row index of the last row that contains content.
|
|
3875
3835
|
* @returns {number} the row index of the last row that contains content.
|
|
3876
3836
|
* @example
|
|
@@ -7250,7 +7210,7 @@ let FWorkbook = class FWorkbook extends _univerjs_core_facade.FBaseInitialable {
|
|
|
7250
7210
|
*/
|
|
7251
7211
|
onSelectionChange(callback) {
|
|
7252
7212
|
return (0, _univerjs_core.toDisposable)(this._selectionManagerService.selectionMoveEnd$.subscribe((selections) => {
|
|
7253
|
-
if (this._univerInstanceService.
|
|
7213
|
+
if (this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).getUnitId() !== this.id) return;
|
|
7254
7214
|
if (!(selections === null || selections === void 0 ? void 0 : selections.length)) callback([]);
|
|
7255
7215
|
else callback(selections.map((s) => s.range));
|
|
7256
7216
|
}));
|
|
@@ -8165,7 +8125,7 @@ var FUniverSheetsMixin = class extends _univerjs_core_facade.FUniver {
|
|
|
8165
8125
|
return this.createUniverSheet(data, options);
|
|
8166
8126
|
}
|
|
8167
8127
|
getActiveWorkbook() {
|
|
8168
|
-
const workbook = this._univerInstanceService.
|
|
8128
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
8169
8129
|
if (!workbook) return null;
|
|
8170
8130
|
return this._injector.createInstance(FWorkbook, workbook);
|
|
8171
8131
|
}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1625,7 +1625,7 @@ const MoveRangeMutation = {
|
|
|
1625
1625
|
handler: (accessor, params) => {
|
|
1626
1626
|
const { from, to } = params;
|
|
1627
1627
|
if (!from || !to) return false;
|
|
1628
|
-
const workbook = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
1628
|
+
const workbook = accessor.get(_univerjs_core.IUniverInstanceService).getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
1629
1629
|
if (!workbook) return false;
|
|
1630
1630
|
const fromWorksheet = workbook.getSheetBySheetId(params.from.subUnitId);
|
|
1631
1631
|
const toWorksheet = workbook.getSheetBySheetId(params.to.subUnitId);
|
|
@@ -3839,7 +3839,7 @@ function discreteRangeToRange(discreteRange) {
|
|
|
3839
3839
|
}
|
|
3840
3840
|
function rangeToDiscreteRange(range, accessor, unitId, subUnitId) {
|
|
3841
3841
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
3842
|
-
const workbook = unitId ? univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET) : univerInstanceService.
|
|
3842
|
+
const workbook = unitId ? univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET) : univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
3843
3843
|
const worksheet = subUnitId ? workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId) : workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
3844
3844
|
if (!worksheet) return null;
|
|
3845
3845
|
const { startRow, endRow, startColumn, endColumn } = range;
|
|
@@ -4266,7 +4266,7 @@ var WorkbookSelectionModel = class extends _univerjs_core.Disposable {
|
|
|
4266
4266
|
//#region src/services/selections/selection.service.ts
|
|
4267
4267
|
let SheetsSelectionsService = class SheetsSelectionsService extends _univerjs_core.RxDisposable {
|
|
4268
4268
|
get _currentSelectionPos() {
|
|
4269
|
-
const workbook = this._instanceSrv.
|
|
4269
|
+
const workbook = this._instanceSrv.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
4270
4270
|
if (!workbook) return null;
|
|
4271
4271
|
const worksheet = workbook.getActiveSheet();
|
|
4272
4272
|
return {
|
|
@@ -4447,7 +4447,7 @@ let SheetsSelectionsService = class SheetsSelectionsService extends _univerjs_co
|
|
|
4447
4447
|
*/
|
|
4448
4448
|
getCellStylesProperty(property) {
|
|
4449
4449
|
var _this$_instanceSrv$ge;
|
|
4450
|
-
const worksheet = (_this$_instanceSrv$ge = this._instanceSrv.
|
|
4450
|
+
const worksheet = (_this$_instanceSrv$ge = this._instanceSrv.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_instanceSrv$ge === void 0 ? void 0 : _this$_instanceSrv$ge.getActiveSheet();
|
|
4451
4451
|
const selections = this.getCurrentSelections();
|
|
4452
4452
|
if (!worksheet || selections.length === 0) return {
|
|
4453
4453
|
isAllValuesSame: false,
|
|
@@ -5374,7 +5374,7 @@ const SetRangeValuesCommand = {
|
|
|
5374
5374
|
};
|
|
5375
5375
|
|
|
5376
5376
|
//#endregion
|
|
5377
|
-
//#region src/commands/utils/handle-range
|
|
5377
|
+
//#region src/commands/utils/handle-range.mutation.ts
|
|
5378
5378
|
/**
|
|
5379
5379
|
* InsertRange is not a mutation but combination of `SetRangeValuesMutation` and `MoveRangeMutation`.
|
|
5380
5380
|
* @param accessor
|
|
@@ -8582,7 +8582,7 @@ let MergeCellController = class MergeCellController extends _univerjs_core.Dispo
|
|
|
8582
8582
|
case ClearSelectionAllCommand.id:
|
|
8583
8583
|
case ClearSelectionFormatCommand.id: {
|
|
8584
8584
|
var _self$_selectionManag;
|
|
8585
|
-
const workbook = self._univerInstanceService.
|
|
8585
|
+
const workbook = self._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
8586
8586
|
const unitId = workbook.getUnitId();
|
|
8587
8587
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
8588
8588
|
if (!worksheet) return {
|
|
@@ -9532,7 +9532,7 @@ MergeCellController = __decorate([
|
|
|
9532
9532
|
], MergeCellController);
|
|
9533
9533
|
function getWorkbook(univerInstanceService, unitId) {
|
|
9534
9534
|
if (unitId) return univerInstanceService.getUniverSheetInstance(unitId);
|
|
9535
|
-
return univerInstanceService.
|
|
9535
|
+
return univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
9536
9536
|
}
|
|
9537
9537
|
function getWorksheet(workbook, subUnitId) {
|
|
9538
9538
|
if (subUnitId) return workbook.getSheetBySheetId(subUnitId);
|
|
@@ -13094,7 +13094,7 @@ var BorderStyleManagerService = class {
|
|
|
13094
13094
|
};
|
|
13095
13095
|
|
|
13096
13096
|
//#endregion
|
|
13097
|
-
//#region src/commands/commands/set-border
|
|
13097
|
+
//#region src/commands/commands/set-border.command.ts
|
|
13098
13098
|
function forEach(range, action) {
|
|
13099
13099
|
const { startRow, startColumn, endRow, endColumn } = range;
|
|
13100
13100
|
for (let i = startRow; i <= endRow; i++) for (let j = startColumn; j <= endColumn; j++) action(i, j);
|
|
@@ -16763,7 +16763,7 @@ const SplitTextToColumnsCommand = {
|
|
|
16763
16763
|
const INumfmtService = (0, _univerjs_core.createIdentifier)("INumfmtService");
|
|
16764
16764
|
|
|
16765
16765
|
//#endregion
|
|
16766
|
-
//#region src/commands/mutations/numfmt
|
|
16766
|
+
//#region src/commands/mutations/numfmt.mutation.ts
|
|
16767
16767
|
const factorySetNumfmtUndoMutation = (accessor, option) => {
|
|
16768
16768
|
const numfmtService = accessor.get(INumfmtService);
|
|
16769
16769
|
const { values, unitId, subUnitId } = option;
|
|
@@ -18524,7 +18524,7 @@ let SheetPermissionInitController = class SheetPermissionInitController extends
|
|
|
18524
18524
|
}
|
|
18525
18525
|
async initWorkbookPermissionChange(_unitId) {
|
|
18526
18526
|
var _this$_univerInstance;
|
|
18527
|
-
const unitId = _unitId || ((_this$_univerInstance = this._univerInstanceService.
|
|
18527
|
+
const unitId = _unitId || ((_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId());
|
|
18528
18528
|
if (!unitId) return;
|
|
18529
18529
|
return this._authzIoService.allowed({
|
|
18530
18530
|
objectID: unitId,
|
|
@@ -19223,7 +19223,7 @@ RangeProtectionCache = __decorate([
|
|
|
19223
19223
|
//#endregion
|
|
19224
19224
|
//#region package.json
|
|
19225
19225
|
var name = "@univerjs/sheets";
|
|
19226
|
-
var version = "0.
|
|
19226
|
+
var version = "0.24.0";
|
|
19227
19227
|
|
|
19228
19228
|
//#endregion
|
|
19229
19229
|
//#region src/controllers/active-worksheet.controller.ts
|
|
@@ -19701,8 +19701,8 @@ SheetPermissionViewModelController = __decorate([
|
|
|
19701
19701
|
], SheetPermissionViewModelController);
|
|
19702
19702
|
|
|
19703
19703
|
//#endregion
|
|
19704
|
-
//#region src/services/exclusive-range/exclusive-range
|
|
19705
|
-
const IExclusiveRangeService = (0, _univerjs_core.createIdentifier)("univer.exclusive-range
|
|
19704
|
+
//#region src/services/exclusive-range/exclusive-range.service.ts
|
|
19705
|
+
const IExclusiveRangeService = (0, _univerjs_core.createIdentifier)("univer.exclusive-range.service");
|
|
19706
19706
|
var ExclusiveRangeService = class extends _univerjs_core.Disposable {
|
|
19707
19707
|
constructor(..._args) {
|
|
19708
19708
|
super(..._args);
|
|
@@ -19883,7 +19883,7 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
|
|
|
19883
19883
|
}
|
|
19884
19884
|
_onRefRangeChange() {
|
|
19885
19885
|
const registerRefRange = (unitId, subUnitId) => {
|
|
19886
|
-
const workbook = this._univerInstanceService.
|
|
19886
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
19887
19887
|
if (!workbook) return;
|
|
19888
19888
|
if (!(workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId))) return;
|
|
19889
19889
|
this.disposableCollection.dispose();
|
|
@@ -19912,7 +19912,7 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
|
|
|
19912
19912
|
registerRefRange(unitId, subUnitId);
|
|
19913
19913
|
}
|
|
19914
19914
|
}));
|
|
19915
|
-
const workbook = this._univerInstanceService.
|
|
19915
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
19916
19916
|
if (workbook) {
|
|
19917
19917
|
const sheet = workbook.getActiveSheet();
|
|
19918
19918
|
if (!sheet) return;
|
|
@@ -20284,7 +20284,7 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
|
|
|
20284
20284
|
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
20285
20285
|
if (mutationIdArrByMove.includes(command.id)) {
|
|
20286
20286
|
if (!command.params) return;
|
|
20287
|
-
const workbook = this._univerInstanceService.
|
|
20287
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
20288
20288
|
if (!workbook) return;
|
|
20289
20289
|
const worksheet = workbook.getSheetBySheetId(command.params.subUnitId);
|
|
20290
20290
|
if (!worksheet) return;
|
|
@@ -20563,7 +20563,7 @@ RangeProtectionService = __decorate([
|
|
|
20563
20563
|
], RangeProtectionService);
|
|
20564
20564
|
|
|
20565
20565
|
//#endregion
|
|
20566
|
-
//#region src/services/range-theme
|
|
20566
|
+
//#region src/services/range-theme.service.ts
|
|
20567
20567
|
let SheetRangeThemeService = class SheetRangeThemeService extends _univerjs_core.Disposable {
|
|
20568
20568
|
constructor(_sheetRangeThemeModel) {
|
|
20569
20569
|
super();
|
package/lib/es/facade.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BooleanNumber, CanceledError, DEFAULT_STYLES, Dimension, Direction, HorizontalAlign, IAuthzIoService, ICommandService, ILogService, IPermissionService, IResourceLoaderService, IUniverInstanceService, Inject, Injector, LocaleService, ObjectMatrix, RANGE_TYPE, Rectangle, RedoCommand, RichTextValue, TextStyleValue, Tools, UndoCommand, UniverInstanceType, VerticalAlign, WrapStrategy, cellToRange, covertCellValue, covertCellValues, generateIntervalsByPoints, generateRandomId, isNullCell, mergeWorksheetSnapshotWithDefault, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { FBase, FBaseInitialable, FEnum, FEventName, FUniver } from "@univerjs/core/facade";
|
|
3
|
-
import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCommand, AutoFillCommand, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, EditStateEnum, InsertColByRangeCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowByRangeCommand, InsertSheetCommand, MoveColsCommand, MoveRowsCommand, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RangeThemeStyle, RegisterWorksheetRangeThemeStyleCommand, RemoveColByRangeCommand, RemoveDefinedNameCommand, RemoveRowByRangeCommand, RemoveSheetCommand, RemoveWorksheetMergeCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetBorderBasicCommand, SetColDataCommand, SetColHiddenCommand, SetColWidthCommand, SetDefinedNameCommand, SetFrozenCommand, SetGridlinesColorCommand, SetHorizontalTextAlignCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeValuesCommand,
|
|
3
|
+
import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCommand, AutoFillCommand, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, EditStateEnum, InsertColByRangeCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowByRangeCommand, InsertSheetCommand, MoveColsCommand, MoveRowsCommand, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RangeThemeStyle, RegisterWorksheetRangeThemeStyleCommand, RemoveColByRangeCommand, RemoveDefinedNameCommand, RemoveRowByRangeCommand, RemoveSheetCommand, RemoveWorksheetMergeCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetBorderBasicCommand, SetColDataCommand, SetColHiddenCommand, SetColWidthCommand, SetDefinedNameCommand, SetFrozenCommand, SetGridlinesColorCommand, SetHorizontalTextAlignCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeValuesCommand, SetRowDataCommand, SetRowHeightCommand, SetRowHiddenCommand, SetSelectionsOperation, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextRotationCommand, SetTextWrapCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorksheetActiveOperation, SetWorksheetColumnCountCommand, SetWorksheetDefaultStyleMutation, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRowCountCommand, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetRangeThemeService, SheetSkeletonChangeType, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, ToggleGridlinesCommand, UnitObject, UnregisterWorksheetRangeThemeStyleCommand, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, addMergeCellsUtil, copyRangeStyles, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getNextPrimaryCell, getPrimaryForRange, getValueChangedEffectedRange, validateDefinedName } from "@univerjs/sheets";
|
|
4
4
|
import { FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, deserializeRangeWithSheet, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
5
5
|
import { ObjectScope, UnitAction, UnitObject as UnitObject$1, UnitRole } from "@univerjs/protocol";
|
|
6
6
|
|
|
@@ -3333,7 +3333,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3333
3333
|
* Sets the frozen state of the current sheet.
|
|
3334
3334
|
* @param {IFreeze} freeze - the scrolling viewport start range and count of freezed rows and columns.
|
|
3335
3335
|
* that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
|
|
3336
|
-
* @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
|
|
3337
3336
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
3338
3337
|
* @example
|
|
3339
3338
|
* ```typescript
|
|
@@ -3348,7 +3347,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3348
3347
|
* ```
|
|
3349
3348
|
*/
|
|
3350
3349
|
setFreeze(freeze) {
|
|
3351
|
-
this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead");
|
|
3352
3350
|
this._commandService.syncExecuteCommand(SetFrozenCommand.id, {
|
|
3353
3351
|
...freeze,
|
|
3354
3352
|
unitId: this._workbook.getUnitId(),
|
|
@@ -3604,28 +3602,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3604
3602
|
return this._worksheet.getTabColor();
|
|
3605
3603
|
}
|
|
3606
3604
|
/**
|
|
3607
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => {})` instead
|
|
3608
|
-
*/
|
|
3609
|
-
onCellDataChange(callback) {
|
|
3610
|
-
return this._injector.get(ICommandService).onCommandExecuted((command) => {
|
|
3611
|
-
if (command.id === SetRangeValuesMutation.id) {
|
|
3612
|
-
const params = command.params;
|
|
3613
|
-
if (params.unitId === this._workbook.getUnitId() && params.subUnitId === this._worksheet.getSheetId() && params.cellValue) callback(new ObjectMatrix(params.cellValue));
|
|
3614
|
-
}
|
|
3615
|
-
});
|
|
3616
|
-
}
|
|
3617
|
-
/**
|
|
3618
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {})` instead
|
|
3619
|
-
*/
|
|
3620
|
-
onBeforeCellDataChange(callback) {
|
|
3621
|
-
return this._injector.get(ICommandService).beforeCommandExecuted((command) => {
|
|
3622
|
-
if (command.id === SetRangeValuesMutation.id) {
|
|
3623
|
-
const params = command.params;
|
|
3624
|
-
if (params.unitId === this._workbook.getUnitId() && params.subUnitId === this._worksheet.getSheetId() && params.cellValue) callback(new ObjectMatrix(params.cellValue));
|
|
3625
|
-
}
|
|
3626
|
-
});
|
|
3627
|
-
}
|
|
3628
|
-
/**
|
|
3629
3605
|
* Hides this sheet. Has no effect if the sheet is already hidden. If this method is called on the only visible sheet, it throws an exception.
|
|
3630
3606
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
3631
3607
|
* @example
|
|
@@ -3821,7 +3797,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3821
3797
|
}
|
|
3822
3798
|
/**
|
|
3823
3799
|
* Returns a Range corresponding to the dimensions in which data is present.
|
|
3824
|
-
*
|
|
3800
|
+
* Empty cells with style or formatting will also be included in the data range. If there is no data on the sheet, returns a Range corresponding to the top-left cell of the sheet (A1).
|
|
3825
3801
|
* @returns {FRange} The range of the data in the sheet.
|
|
3826
3802
|
* @example
|
|
3827
3803
|
* ```ts
|
|
@@ -3838,14 +3814,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3838
3814
|
return this.getRange(startRow, startColumn, endRow - startRow + 1, endColumn - startColumn + 1);
|
|
3839
3815
|
}
|
|
3840
3816
|
/**
|
|
3841
|
-
* @deprecated use `getLastColumn` instead.
|
|
3842
|
-
* Returns the column index of the last column that contains content.
|
|
3843
|
-
* @returns {number} the column index of the last column that contains content.
|
|
3844
|
-
*/
|
|
3845
|
-
getLastColumns() {
|
|
3846
|
-
return this._worksheet.getLastColumnWithContent();
|
|
3847
|
-
}
|
|
3848
|
-
/**
|
|
3849
3817
|
* Returns the column index of the last column that contains content.
|
|
3850
3818
|
* @returns {number} the column index of the last column that contains content.
|
|
3851
3819
|
* @example
|
|
@@ -3862,14 +3830,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3862
3830
|
return this._worksheet.getLastColumnWithContent();
|
|
3863
3831
|
}
|
|
3864
3832
|
/**
|
|
3865
|
-
* @deprecated use `getLastRow` instead.
|
|
3866
|
-
* Returns the row index of the last row that contains content.
|
|
3867
|
-
* @returns {number} the row index of the last row that contains content.
|
|
3868
|
-
*/
|
|
3869
|
-
getLastRows() {
|
|
3870
|
-
return this._worksheet.getLastRowWithContent();
|
|
3871
|
-
}
|
|
3872
|
-
/**
|
|
3873
3833
|
* Returns the row index of the last row that contains content.
|
|
3874
3834
|
* @returns {number} the row index of the last row that contains content.
|
|
3875
3835
|
* @example
|
|
@@ -7249,7 +7209,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7249
7209
|
*/
|
|
7250
7210
|
onSelectionChange(callback) {
|
|
7251
7211
|
return toDisposable(this._selectionManagerService.selectionMoveEnd$.subscribe((selections) => {
|
|
7252
|
-
if (this._univerInstanceService.
|
|
7212
|
+
if (this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId() !== this.id) return;
|
|
7253
7213
|
if (!(selections === null || selections === void 0 ? void 0 : selections.length)) callback([]);
|
|
7254
7214
|
else callback(selections.map((s) => s.range));
|
|
7255
7215
|
}));
|
|
@@ -8164,7 +8124,7 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
8164
8124
|
return this.createUniverSheet(data, options);
|
|
8165
8125
|
}
|
|
8166
8126
|
getActiveWorkbook() {
|
|
8167
|
-
const workbook = this._univerInstanceService.
|
|
8127
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
8168
8128
|
if (!workbook) return null;
|
|
8169
8129
|
return this._injector.createInstance(FWorkbook, workbook);
|
|
8170
8130
|
}
|
package/lib/es/index.js
CHANGED
|
@@ -1624,7 +1624,7 @@ const MoveRangeMutation = {
|
|
|
1624
1624
|
handler: (accessor, params) => {
|
|
1625
1625
|
const { from, to } = params;
|
|
1626
1626
|
if (!from || !to) return false;
|
|
1627
|
-
const workbook = accessor.get(IUniverInstanceService).
|
|
1627
|
+
const workbook = accessor.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
1628
1628
|
if (!workbook) return false;
|
|
1629
1629
|
const fromWorksheet = workbook.getSheetBySheetId(params.from.subUnitId);
|
|
1630
1630
|
const toWorksheet = workbook.getSheetBySheetId(params.to.subUnitId);
|
|
@@ -3838,7 +3838,7 @@ function discreteRangeToRange(discreteRange) {
|
|
|
3838
3838
|
}
|
|
3839
3839
|
function rangeToDiscreteRange(range, accessor, unitId, subUnitId) {
|
|
3840
3840
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
3841
|
-
const workbook = unitId ? univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET) : univerInstanceService.
|
|
3841
|
+
const workbook = unitId ? univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET) : univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
3842
3842
|
const worksheet = subUnitId ? workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId) : workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
3843
3843
|
if (!worksheet) return null;
|
|
3844
3844
|
const { startRow, endRow, startColumn, endColumn } = range;
|
|
@@ -4265,7 +4265,7 @@ var WorkbookSelectionModel = class extends Disposable {
|
|
|
4265
4265
|
//#region src/services/selections/selection.service.ts
|
|
4266
4266
|
let SheetsSelectionsService = class SheetsSelectionsService extends RxDisposable {
|
|
4267
4267
|
get _currentSelectionPos() {
|
|
4268
|
-
const workbook = this._instanceSrv.
|
|
4268
|
+
const workbook = this._instanceSrv.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
4269
4269
|
if (!workbook) return null;
|
|
4270
4270
|
const worksheet = workbook.getActiveSheet();
|
|
4271
4271
|
return {
|
|
@@ -4446,7 +4446,7 @@ let SheetsSelectionsService = class SheetsSelectionsService extends RxDisposable
|
|
|
4446
4446
|
*/
|
|
4447
4447
|
getCellStylesProperty(property) {
|
|
4448
4448
|
var _this$_instanceSrv$ge;
|
|
4449
|
-
const worksheet = (_this$_instanceSrv$ge = this._instanceSrv.
|
|
4449
|
+
const worksheet = (_this$_instanceSrv$ge = this._instanceSrv.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) === null || _this$_instanceSrv$ge === void 0 ? void 0 : _this$_instanceSrv$ge.getActiveSheet();
|
|
4450
4450
|
const selections = this.getCurrentSelections();
|
|
4451
4451
|
if (!worksheet || selections.length === 0) return {
|
|
4452
4452
|
isAllValuesSame: false,
|
|
@@ -5373,7 +5373,7 @@ const SetRangeValuesCommand = {
|
|
|
5373
5373
|
};
|
|
5374
5374
|
|
|
5375
5375
|
//#endregion
|
|
5376
|
-
//#region src/commands/utils/handle-range
|
|
5376
|
+
//#region src/commands/utils/handle-range.mutation.ts
|
|
5377
5377
|
/**
|
|
5378
5378
|
* InsertRange is not a mutation but combination of `SetRangeValuesMutation` and `MoveRangeMutation`.
|
|
5379
5379
|
* @param accessor
|
|
@@ -8581,7 +8581,7 @@ let MergeCellController = class MergeCellController extends Disposable {
|
|
|
8581
8581
|
case ClearSelectionAllCommand.id:
|
|
8582
8582
|
case ClearSelectionFormatCommand.id: {
|
|
8583
8583
|
var _self$_selectionManag;
|
|
8584
|
-
const workbook = self._univerInstanceService.
|
|
8584
|
+
const workbook = self._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
8585
8585
|
const unitId = workbook.getUnitId();
|
|
8586
8586
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
8587
8587
|
if (!worksheet) return {
|
|
@@ -9531,7 +9531,7 @@ MergeCellController = __decorate([
|
|
|
9531
9531
|
], MergeCellController);
|
|
9532
9532
|
function getWorkbook(univerInstanceService, unitId) {
|
|
9533
9533
|
if (unitId) return univerInstanceService.getUniverSheetInstance(unitId);
|
|
9534
|
-
return univerInstanceService.
|
|
9534
|
+
return univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
9535
9535
|
}
|
|
9536
9536
|
function getWorksheet(workbook, subUnitId) {
|
|
9537
9537
|
if (subUnitId) return workbook.getSheetBySheetId(subUnitId);
|
|
@@ -13093,7 +13093,7 @@ var BorderStyleManagerService = class {
|
|
|
13093
13093
|
};
|
|
13094
13094
|
|
|
13095
13095
|
//#endregion
|
|
13096
|
-
//#region src/commands/commands/set-border
|
|
13096
|
+
//#region src/commands/commands/set-border.command.ts
|
|
13097
13097
|
function forEach(range, action) {
|
|
13098
13098
|
const { startRow, startColumn, endRow, endColumn } = range;
|
|
13099
13099
|
for (let i = startRow; i <= endRow; i++) for (let j = startColumn; j <= endColumn; j++) action(i, j);
|
|
@@ -16762,7 +16762,7 @@ const SplitTextToColumnsCommand = {
|
|
|
16762
16762
|
const INumfmtService = createIdentifier("INumfmtService");
|
|
16763
16763
|
|
|
16764
16764
|
//#endregion
|
|
16765
|
-
//#region src/commands/mutations/numfmt
|
|
16765
|
+
//#region src/commands/mutations/numfmt.mutation.ts
|
|
16766
16766
|
const factorySetNumfmtUndoMutation = (accessor, option) => {
|
|
16767
16767
|
const numfmtService = accessor.get(INumfmtService);
|
|
16768
16768
|
const { values, unitId, subUnitId } = option;
|
|
@@ -18523,7 +18523,7 @@ let SheetPermissionInitController = class SheetPermissionInitController extends
|
|
|
18523
18523
|
}
|
|
18524
18524
|
async initWorkbookPermissionChange(_unitId) {
|
|
18525
18525
|
var _this$_univerInstance;
|
|
18526
|
-
const unitId = _unitId || ((_this$_univerInstance = this._univerInstanceService.
|
|
18526
|
+
const unitId = _unitId || ((_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId());
|
|
18527
18527
|
if (!unitId) return;
|
|
18528
18528
|
return this._authzIoService.allowed({
|
|
18529
18529
|
objectID: unitId,
|
|
@@ -19222,7 +19222,7 @@ RangeProtectionCache = __decorate([
|
|
|
19222
19222
|
//#endregion
|
|
19223
19223
|
//#region package.json
|
|
19224
19224
|
var name = "@univerjs/sheets";
|
|
19225
|
-
var version = "0.
|
|
19225
|
+
var version = "0.24.0";
|
|
19226
19226
|
|
|
19227
19227
|
//#endregion
|
|
19228
19228
|
//#region src/controllers/active-worksheet.controller.ts
|
|
@@ -19700,8 +19700,8 @@ SheetPermissionViewModelController = __decorate([
|
|
|
19700
19700
|
], SheetPermissionViewModelController);
|
|
19701
19701
|
|
|
19702
19702
|
//#endregion
|
|
19703
|
-
//#region src/services/exclusive-range/exclusive-range
|
|
19704
|
-
const IExclusiveRangeService = createIdentifier("univer.exclusive-range
|
|
19703
|
+
//#region src/services/exclusive-range/exclusive-range.service.ts
|
|
19704
|
+
const IExclusiveRangeService = createIdentifier("univer.exclusive-range.service");
|
|
19705
19705
|
var ExclusiveRangeService = class extends Disposable {
|
|
19706
19706
|
constructor(..._args) {
|
|
19707
19707
|
super(..._args);
|
|
@@ -19882,7 +19882,7 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
|
|
|
19882
19882
|
}
|
|
19883
19883
|
_onRefRangeChange() {
|
|
19884
19884
|
const registerRefRange = (unitId, subUnitId) => {
|
|
19885
|
-
const workbook = this._univerInstanceService.
|
|
19885
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
19886
19886
|
if (!workbook) return;
|
|
19887
19887
|
if (!(workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId))) return;
|
|
19888
19888
|
this.disposableCollection.dispose();
|
|
@@ -19911,7 +19911,7 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
|
|
|
19911
19911
|
registerRefRange(unitId, subUnitId);
|
|
19912
19912
|
}
|
|
19913
19913
|
}));
|
|
19914
|
-
const workbook = this._univerInstanceService.
|
|
19914
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
19915
19915
|
if (workbook) {
|
|
19916
19916
|
const sheet = workbook.getActiveSheet();
|
|
19917
19917
|
if (!sheet) return;
|
|
@@ -20283,7 +20283,7 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
|
|
|
20283
20283
|
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
20284
20284
|
if (mutationIdArrByMove.includes(command.id)) {
|
|
20285
20285
|
if (!command.params) return;
|
|
20286
|
-
const workbook = this._univerInstanceService.
|
|
20286
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
20287
20287
|
if (!workbook) return;
|
|
20288
20288
|
const worksheet = workbook.getSheetBySheetId(command.params.subUnitId);
|
|
20289
20289
|
if (!worksheet) return;
|
|
@@ -20562,7 +20562,7 @@ RangeProtectionService = __decorate([
|
|
|
20562
20562
|
], RangeProtectionService);
|
|
20563
20563
|
|
|
20564
20564
|
//#endregion
|
|
20565
|
-
//#region src/services/range-theme
|
|
20565
|
+
//#region src/services/range-theme.service.ts
|
|
20566
20566
|
let SheetRangeThemeService = class SheetRangeThemeService extends Disposable {
|
|
20567
20567
|
constructor(_sheetRangeThemeModel) {
|
|
20568
20568
|
super();
|
package/lib/facade.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BooleanNumber, CanceledError, DEFAULT_STYLES, Dimension, Direction, HorizontalAlign, IAuthzIoService, ICommandService, ILogService, IPermissionService, IResourceLoaderService, IUniverInstanceService, Inject, Injector, LocaleService, ObjectMatrix, RANGE_TYPE, Rectangle, RedoCommand, RichTextValue, TextStyleValue, Tools, UndoCommand, UniverInstanceType, VerticalAlign, WrapStrategy, cellToRange, covertCellValue, covertCellValues, generateIntervalsByPoints, generateRandomId, isNullCell, mergeWorksheetSnapshotWithDefault, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { FBase, FBaseInitialable, FEnum, FEventName, FUniver } from "@univerjs/core/facade";
|
|
3
|
-
import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCommand, AutoFillCommand, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, EditStateEnum, InsertColByRangeCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowByRangeCommand, InsertSheetCommand, MoveColsCommand, MoveRowsCommand, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RangeThemeStyle, RegisterWorksheetRangeThemeStyleCommand, RemoveColByRangeCommand, RemoveDefinedNameCommand, RemoveRowByRangeCommand, RemoveSheetCommand, RemoveWorksheetMergeCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetBorderBasicCommand, SetColDataCommand, SetColHiddenCommand, SetColWidthCommand, SetDefinedNameCommand, SetFrozenCommand, SetGridlinesColorCommand, SetHorizontalTextAlignCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeValuesCommand,
|
|
3
|
+
import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCommand, AutoFillCommand, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, EditStateEnum, InsertColByRangeCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowByRangeCommand, InsertSheetCommand, MoveColsCommand, MoveRowsCommand, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RangeThemeStyle, RegisterWorksheetRangeThemeStyleCommand, RemoveColByRangeCommand, RemoveDefinedNameCommand, RemoveRowByRangeCommand, RemoveSheetCommand, RemoveWorksheetMergeCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetBorderBasicCommand, SetColDataCommand, SetColHiddenCommand, SetColWidthCommand, SetDefinedNameCommand, SetFrozenCommand, SetGridlinesColorCommand, SetHorizontalTextAlignCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeValuesCommand, SetRowDataCommand, SetRowHeightCommand, SetRowHiddenCommand, SetSelectionsOperation, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextRotationCommand, SetTextWrapCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorksheetActiveOperation, SetWorksheetColumnCountCommand, SetWorksheetDefaultStyleMutation, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRowCountCommand, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetRangeThemeService, SheetSkeletonChangeType, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, ToggleGridlinesCommand, UnitObject, UnregisterWorksheetRangeThemeStyleCommand, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, addMergeCellsUtil, copyRangeStyles, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getNextPrimaryCell, getPrimaryForRange, getValueChangedEffectedRange, validateDefinedName } from "@univerjs/sheets";
|
|
4
4
|
import { FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, deserializeRangeWithSheet, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
5
5
|
import { ObjectScope, UnitAction, UnitObject as UnitObject$1, UnitRole } from "@univerjs/protocol";
|
|
6
6
|
|
|
@@ -3333,7 +3333,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3333
3333
|
* Sets the frozen state of the current sheet.
|
|
3334
3334
|
* @param {IFreeze} freeze - the scrolling viewport start range and count of freezed rows and columns.
|
|
3335
3335
|
* that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
|
|
3336
|
-
* @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
|
|
3337
3336
|
* @returns {FWorksheet} This worksheet instance for chaining
|
|
3338
3337
|
* @example
|
|
3339
3338
|
* ```typescript
|
|
@@ -3348,7 +3347,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3348
3347
|
* ```
|
|
3349
3348
|
*/
|
|
3350
3349
|
setFreeze(freeze) {
|
|
3351
|
-
this._logService.warn("setFreeze is deprecated, use setFrozenRows and setFrozenColumns instead");
|
|
3352
3350
|
this._commandService.syncExecuteCommand(SetFrozenCommand.id, {
|
|
3353
3351
|
...freeze,
|
|
3354
3352
|
unitId: this._workbook.getUnitId(),
|
|
@@ -3604,28 +3602,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3604
3602
|
return this._worksheet.getTabColor();
|
|
3605
3603
|
}
|
|
3606
3604
|
/**
|
|
3607
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => {})` instead
|
|
3608
|
-
*/
|
|
3609
|
-
onCellDataChange(callback) {
|
|
3610
|
-
return this._injector.get(ICommandService).onCommandExecuted((command) => {
|
|
3611
|
-
if (command.id === SetRangeValuesMutation.id) {
|
|
3612
|
-
const params = command.params;
|
|
3613
|
-
if (params.unitId === this._workbook.getUnitId() && params.subUnitId === this._worksheet.getSheetId() && params.cellValue) callback(new ObjectMatrix(params.cellValue));
|
|
3614
|
-
}
|
|
3615
|
-
});
|
|
3616
|
-
}
|
|
3617
|
-
/**
|
|
3618
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {})` instead
|
|
3619
|
-
*/
|
|
3620
|
-
onBeforeCellDataChange(callback) {
|
|
3621
|
-
return this._injector.get(ICommandService).beforeCommandExecuted((command) => {
|
|
3622
|
-
if (command.id === SetRangeValuesMutation.id) {
|
|
3623
|
-
const params = command.params;
|
|
3624
|
-
if (params.unitId === this._workbook.getUnitId() && params.subUnitId === this._worksheet.getSheetId() && params.cellValue) callback(new ObjectMatrix(params.cellValue));
|
|
3625
|
-
}
|
|
3626
|
-
});
|
|
3627
|
-
}
|
|
3628
|
-
/**
|
|
3629
3605
|
* Hides this sheet. Has no effect if the sheet is already hidden. If this method is called on the only visible sheet, it throws an exception.
|
|
3630
3606
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
3631
3607
|
* @example
|
|
@@ -3821,7 +3797,7 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3821
3797
|
}
|
|
3822
3798
|
/**
|
|
3823
3799
|
* Returns a Range corresponding to the dimensions in which data is present.
|
|
3824
|
-
*
|
|
3800
|
+
* Empty cells with style or formatting will also be included in the data range. If there is no data on the sheet, returns a Range corresponding to the top-left cell of the sheet (A1).
|
|
3825
3801
|
* @returns {FRange} The range of the data in the sheet.
|
|
3826
3802
|
* @example
|
|
3827
3803
|
* ```ts
|
|
@@ -3838,14 +3814,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3838
3814
|
return this.getRange(startRow, startColumn, endRow - startRow + 1, endColumn - startColumn + 1);
|
|
3839
3815
|
}
|
|
3840
3816
|
/**
|
|
3841
|
-
* @deprecated use `getLastColumn` instead.
|
|
3842
|
-
* Returns the column index of the last column that contains content.
|
|
3843
|
-
* @returns {number} the column index of the last column that contains content.
|
|
3844
|
-
*/
|
|
3845
|
-
getLastColumns() {
|
|
3846
|
-
return this._worksheet.getLastColumnWithContent();
|
|
3847
|
-
}
|
|
3848
|
-
/**
|
|
3849
3817
|
* Returns the column index of the last column that contains content.
|
|
3850
3818
|
* @returns {number} the column index of the last column that contains content.
|
|
3851
3819
|
* @example
|
|
@@ -3862,14 +3830,6 @@ let FWorksheet = _FWorksheet = class FWorksheet extends FBaseInitialable {
|
|
|
3862
3830
|
return this._worksheet.getLastColumnWithContent();
|
|
3863
3831
|
}
|
|
3864
3832
|
/**
|
|
3865
|
-
* @deprecated use `getLastRow` instead.
|
|
3866
|
-
* Returns the row index of the last row that contains content.
|
|
3867
|
-
* @returns {number} the row index of the last row that contains content.
|
|
3868
|
-
*/
|
|
3869
|
-
getLastRows() {
|
|
3870
|
-
return this._worksheet.getLastRowWithContent();
|
|
3871
|
-
}
|
|
3872
|
-
/**
|
|
3873
3833
|
* Returns the row index of the last row that contains content.
|
|
3874
3834
|
* @returns {number} the row index of the last row that contains content.
|
|
3875
3835
|
* @example
|
|
@@ -7249,7 +7209,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
|
|
|
7249
7209
|
*/
|
|
7250
7210
|
onSelectionChange(callback) {
|
|
7251
7211
|
return toDisposable(this._selectionManagerService.selectionMoveEnd$.subscribe((selections) => {
|
|
7252
|
-
if (this._univerInstanceService.
|
|
7212
|
+
if (this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId() !== this.id) return;
|
|
7253
7213
|
if (!(selections === null || selections === void 0 ? void 0 : selections.length)) callback([]);
|
|
7254
7214
|
else callback(selections.map((s) => s.range));
|
|
7255
7215
|
}));
|
|
@@ -8164,7 +8124,7 @@ var FUniverSheetsMixin = class extends FUniver {
|
|
|
8164
8124
|
return this.createUniverSheet(data, options);
|
|
8165
8125
|
}
|
|
8166
8126
|
getActiveWorkbook() {
|
|
8167
|
-
const workbook = this._univerInstanceService.
|
|
8127
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
8168
8128
|
if (!workbook) return null;
|
|
8169
8129
|
return this._injector.createInstance(FWorkbook, workbook);
|
|
8170
8130
|
}
|