@univerjs/sheets 0.2.10 → 0.2.12
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/index.js +1 -1
- package/lib/es/index.js +139 -86
- package/lib/types/commands/commands/add-worksheet-merge.command.d.ts +2 -1
- package/lib/types/commands/mutations/set-worksheet-col-width.mutation.d.ts +8 -2
- package/lib/types/commands/mutations/set-worksheet-row-height.mutation.d.ts +4 -4
- package/lib/types/controllers/__tests__/util.d.ts +2 -2
- package/lib/types/controllers/config.schema.d.ts +13 -0
- package/lib/types/index.d.ts +4 -2
- package/lib/types/model/range-protection-rule.model.d.ts +1 -0
- package/lib/types/services/__tests__/util.d.ts +2 -2
- package/lib/types/services/exclusive-range/exclusive-range-service.d.ts +60 -0
- package/lib/types/services/permission/worksheet-permission/worksheet-permission-rule.model.d.ts +1 -0
- package/lib/types/services/ref-range/__tests__/__testing__.d.ts +2 -2
- package/lib/types/services/ref-range/__tests__/ref-range.service.spec.d.ts +2 -2
- package/lib/types/services/sheet-interceptor/__tests__/create-core-test-bed.d.ts +2 -2
- package/lib/types/sheets-plugin.d.ts +5 -13
- package/lib/umd/index.js +1 -1
- package/package.json +11 -11
package/lib/es/index.js
CHANGED
|
@@ -2767,9 +2767,9 @@ const RemoveRowCommandId = "sheet.command.remove-row", RemoveRowCommand = {
|
|
|
2767
2767
|
type: CommandType.COMMAND,
|
|
2768
2768
|
id: "sheet.command.remove-worksheet-merge",
|
|
2769
2769
|
// eslint-disable-next-line max-lines-per-function
|
|
2770
|
-
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
2770
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
2771
2771
|
var _a20;
|
|
2772
|
-
const selectionManagerService = accessor.get(SheetsSelectionsService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), selections = (_a20 = selectionManagerService.getCurrentSelections()) == null ? void 0 : _a20.map((s) => s.range);
|
|
2772
|
+
const selectionManagerService = accessor.get(SheetsSelectionsService), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), univerInstanceService = accessor.get(IUniverInstanceService), selections = (params == null ? void 0 : params.ranges) || ((_a20 = selectionManagerService.getCurrentSelections()) == null ? void 0 : _a20.map((s) => s.range));
|
|
2773
2773
|
if (!(selections != null && selections.length)) return !1;
|
|
2774
2774
|
const target = getSheetCommandTarget(univerInstanceService);
|
|
2775
2775
|
if (!target) return !1;
|
|
@@ -3992,14 +3992,8 @@ const SetStyleCommand = {
|
|
|
3992
3992
|
}, SET_WORKSHEET_ACTIVE_DELAY);
|
|
3993
3993
|
});
|
|
3994
3994
|
}, "handler")
|
|
3995
|
-
}, SetWorksheetColWidthMutationFactory = /* @__PURE__ */ __name((
|
|
3996
|
-
const
|
|
3997
|
-
if (universheet == null)
|
|
3998
|
-
throw new Error("universheet is null error!");
|
|
3999
|
-
const worksheet = universheet.getSheetBySheetId(params.subUnitId);
|
|
4000
|
-
if (worksheet == null)
|
|
4001
|
-
throw new Error("universheet is null error!");
|
|
4002
|
-
const colWidth = {}, manager = worksheet.getColumnManager(), ranges = params.ranges;
|
|
3995
|
+
}, SetWorksheetColWidthMutationFactory = /* @__PURE__ */ __name((params, worksheet) => {
|
|
3996
|
+
const { unitId, subUnitId, ranges } = params, colWidth = {}, manager = worksheet.getColumnManager();
|
|
4003
3997
|
for (let i = 0; i < ranges.length; i++) {
|
|
4004
3998
|
const range = ranges[i];
|
|
4005
3999
|
for (let j = range.startColumn; j < range.endColumn + 1; j++) {
|
|
@@ -4008,9 +4002,9 @@ const SetStyleCommand = {
|
|
|
4008
4002
|
}
|
|
4009
4003
|
}
|
|
4010
4004
|
return {
|
|
4011
|
-
unitId
|
|
4012
|
-
subUnitId
|
|
4013
|
-
ranges
|
|
4005
|
+
unitId,
|
|
4006
|
+
subUnitId,
|
|
4007
|
+
ranges,
|
|
4014
4008
|
colWidth
|
|
4015
4009
|
};
|
|
4016
4010
|
}, "SetWorksheetColWidthMutationFactory"), SetWorksheetColWidthMutation = {
|
|
@@ -4018,18 +4012,14 @@ const SetStyleCommand = {
|
|
|
4018
4012
|
type: CommandType.MUTATION,
|
|
4019
4013
|
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
4020
4014
|
var _a20;
|
|
4021
|
-
const
|
|
4022
|
-
if (
|
|
4023
|
-
|
|
4024
|
-
const worksheet = universheet.getSheetBySheetId(params.subUnitId);
|
|
4025
|
-
if (!worksheet)
|
|
4026
|
-
return !1;
|
|
4027
|
-
const defaultColumnWidth = worksheet.getConfig().defaultColumnWidth, manager = worksheet.getColumnManager(), ranges = params.ranges;
|
|
4015
|
+
const univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
|
|
4016
|
+
if (!target) return !1;
|
|
4017
|
+
const { worksheet } = target, defaultColumnWidth = worksheet.getConfig().defaultColumnWidth, manager = worksheet.getColumnManager(), ranges = params.ranges;
|
|
4028
4018
|
for (let i = 0; i < ranges.length; i++) {
|
|
4029
4019
|
const range = ranges[i];
|
|
4030
4020
|
for (let j = range.startColumn; j < range.endColumn + 1; j++) {
|
|
4031
4021
|
const column = manager.getColumnOrCreate(j);
|
|
4032
|
-
typeof params.colWidth == "number" ? column.w = params.colWidth : column.w = (_a20 = params.colWidth[j
|
|
4022
|
+
typeof params.colWidth == "number" ? column.w = params.colWidth : column.w = (_a20 = params.colWidth[j]) != null ? _a20 : defaultColumnWidth;
|
|
4033
4023
|
}
|
|
4034
4024
|
}
|
|
4035
4025
|
return !0;
|
|
@@ -4040,7 +4030,7 @@ const SetStyleCommand = {
|
|
|
4040
4030
|
// eslint-disable-next-line max-lines-per-function
|
|
4041
4031
|
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
4042
4032
|
const selections = accessor.get(SheetsSelectionsService).getCurrentSelections();
|
|
4043
|
-
if (
|
|
4033
|
+
if (!(selections != null && selections.length))
|
|
4044
4034
|
return !1;
|
|
4045
4035
|
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
|
|
4046
4036
|
if (!target) return !1;
|
|
@@ -4081,8 +4071,8 @@ const SetStyleCommand = {
|
|
|
4081
4071
|
id: DeltaColumnWidthCommand.id,
|
|
4082
4072
|
params: redoMutationParams
|
|
4083
4073
|
}), undoMutationParams = SetWorksheetColWidthMutationFactory(
|
|
4084
|
-
|
|
4085
|
-
|
|
4074
|
+
redoMutationParams,
|
|
4075
|
+
worksheet
|
|
4086
4076
|
), setColWidthResult = commandService.syncExecuteCommand(
|
|
4087
4077
|
SetWorksheetColWidthMutation.id,
|
|
4088
4078
|
redoMutationParams
|
|
@@ -4102,18 +4092,12 @@ const SetStyleCommand = {
|
|
|
4102
4092
|
if (!(selections != null && selections.length)) return !1;
|
|
4103
4093
|
const target = getSheetCommandTarget(accessor.get(IUniverInstanceService), params);
|
|
4104
4094
|
if (!target) return !1;
|
|
4105
|
-
const { subUnitId, unitId } = target, redoMutationParams = {
|
|
4095
|
+
const { subUnitId, unitId, worksheet } = target, redoMutationParams = {
|
|
4106
4096
|
subUnitId,
|
|
4107
4097
|
unitId,
|
|
4108
4098
|
ranges: selections,
|
|
4109
4099
|
colWidth: params.value
|
|
4110
|
-
}, undoMutationParams = SetWorksheetColWidthMutationFactory(
|
|
4111
|
-
accessor,
|
|
4112
|
-
redoMutationParams
|
|
4113
|
-
), setColWidthResult = commandService.syncExecuteCommand(
|
|
4114
|
-
SetWorksheetColWidthMutation.id,
|
|
4115
|
-
redoMutationParams
|
|
4116
|
-
), { undos, redos } = accessor.get(SheetInterceptorService).onCommandExecute({
|
|
4100
|
+
}, undoMutationParams = SetWorksheetColWidthMutationFactory(redoMutationParams, worksheet), setColWidthResult = commandService.syncExecuteCommand(SetWorksheetColWidthMutation.id, redoMutationParams), { undos, redos } = accessor.get(SheetInterceptorService).onCommandExecute({
|
|
4117
4101
|
id: SetColWidthCommand.id,
|
|
4118
4102
|
params: redoMutationParams
|
|
4119
4103
|
}), intercepted = sheetInterceptorService.onCommandExecute({
|
|
@@ -4248,11 +4232,8 @@ const SetStyleCommand = {
|
|
|
4248
4232
|
redoMutations: [{ id: SetWorksheetOrderMutation.id, params: setWorksheetOrderMutationParams }]
|
|
4249
4233
|
}), !0) : !1;
|
|
4250
4234
|
}, "handler")
|
|
4251
|
-
}, MAXIMUM_ROW_HEIGHT = 2e3, SetWorksheetRowHeightMutationFactory = /* @__PURE__ */ __name((
|
|
4252
|
-
const { unitId, subUnitId, ranges } = params,
|
|
4253
|
-
if (worksheet == null)
|
|
4254
|
-
throw new Error("worksheet is null error!");
|
|
4255
|
-
const rowHeight = {}, manager = worksheet.getRowManager();
|
|
4235
|
+
}, MAXIMUM_ROW_HEIGHT = 2e3, SetWorksheetRowHeightMutationFactory = /* @__PURE__ */ __name((params, worksheet) => {
|
|
4236
|
+
const { unitId, subUnitId, ranges } = params, rowHeight = {}, manager = worksheet.getRowManager();
|
|
4256
4237
|
for (const { startRow, endRow } of ranges)
|
|
4257
4238
|
for (let rowIndex = startRow; rowIndex < endRow + 1; rowIndex++) {
|
|
4258
4239
|
const row = manager.getRowOrCreate(rowIndex);
|
|
@@ -4264,8 +4245,8 @@ const SetStyleCommand = {
|
|
|
4264
4245
|
ranges,
|
|
4265
4246
|
rowHeight
|
|
4266
4247
|
};
|
|
4267
|
-
}, "SetWorksheetRowHeightMutationFactory"), SetWorksheetRowIsAutoHeightMutationFactory = /* @__PURE__ */ __name((
|
|
4268
|
-
const { unitId, subUnitId, ranges } = params,
|
|
4248
|
+
}, "SetWorksheetRowHeightMutationFactory"), SetWorksheetRowIsAutoHeightMutationFactory = /* @__PURE__ */ __name((params, worksheet) => {
|
|
4249
|
+
const { unitId, subUnitId, ranges } = params, autoHeightHash = {}, manager = worksheet.getRowManager();
|
|
4269
4250
|
for (const { startRow, endRow } of ranges)
|
|
4270
4251
|
for (let rowIndex = startRow; rowIndex <= endRow; rowIndex++) {
|
|
4271
4252
|
const row = manager.getRowOrCreate(rowIndex);
|
|
@@ -4277,21 +4258,11 @@ const SetStyleCommand = {
|
|
|
4277
4258
|
ranges,
|
|
4278
4259
|
autoHeightInfo: autoHeightHash
|
|
4279
4260
|
};
|
|
4280
|
-
}, "SetWorksheetRowIsAutoHeightMutationFactory"), SetWorksheetRowAutoHeightMutationFactory = /* @__PURE__ */ __name((
|
|
4281
|
-
const { unitId, subUnitId, rowsAutoHeightInfo } = params,
|
|
4282
|
-
if (!worksheet)
|
|
4283
|
-
return {
|
|
4284
|
-
unitId,
|
|
4285
|
-
subUnitId,
|
|
4286
|
-
rowsAutoHeightInfo: []
|
|
4287
|
-
};
|
|
4288
|
-
const results = [], manager = worksheet.getRowManager();
|
|
4261
|
+
}, "SetWorksheetRowIsAutoHeightMutationFactory"), SetWorksheetRowAutoHeightMutationFactory = /* @__PURE__ */ __name((params, worksheet) => {
|
|
4262
|
+
const { unitId, subUnitId, rowsAutoHeightInfo } = params, results = [], manager = worksheet.getRowManager();
|
|
4289
4263
|
for (const rowInfo of rowsAutoHeightInfo) {
|
|
4290
4264
|
const { row } = rowInfo, { ah } = manager.getRowOrCreate(row);
|
|
4291
|
-
results.push({
|
|
4292
|
-
row,
|
|
4293
|
-
autoHeight: ah
|
|
4294
|
-
});
|
|
4265
|
+
results.push({ row, autoHeight: ah });
|
|
4295
4266
|
}
|
|
4296
4267
|
return {
|
|
4297
4268
|
unitId,
|
|
@@ -4303,10 +4274,9 @@ const SetStyleCommand = {
|
|
|
4303
4274
|
type: CommandType.MUTATION,
|
|
4304
4275
|
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
4305
4276
|
var _a20;
|
|
4306
|
-
const {
|
|
4307
|
-
if (!
|
|
4308
|
-
|
|
4309
|
-
const defaultRowHeight = worksheet.getConfig().defaultRowHeight, manager = worksheet.getRowManager();
|
|
4277
|
+
const { ranges, rowHeight } = params, univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
|
|
4278
|
+
if (!target) return !1;
|
|
4279
|
+
const { worksheet } = target, defaultRowHeight = worksheet.getConfig().defaultRowHeight, manager = worksheet.getRowManager();
|
|
4310
4280
|
for (const { startRow, endRow } of ranges)
|
|
4311
4281
|
for (let rowIndex = startRow; rowIndex <= endRow; rowIndex++) {
|
|
4312
4282
|
const row = manager.getRowOrCreate(rowIndex);
|
|
@@ -4319,14 +4289,13 @@ const SetStyleCommand = {
|
|
|
4319
4289
|
type: CommandType.MUTATION,
|
|
4320
4290
|
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
4321
4291
|
var _a20;
|
|
4322
|
-
const {
|
|
4323
|
-
if (!
|
|
4324
|
-
|
|
4325
|
-
const defaultRowIsAutoHeight = void 0, manager = worksheet.getRowManager();
|
|
4292
|
+
const { ranges, autoHeightInfo } = params, univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
|
|
4293
|
+
if (!target) return !1;
|
|
4294
|
+
const manager = target.worksheet.getRowManager();
|
|
4326
4295
|
for (const { startRow, endRow } of ranges)
|
|
4327
4296
|
for (let rowIndex = startRow; rowIndex <= endRow; rowIndex++) {
|
|
4328
4297
|
const row = manager.getRowOrCreate(rowIndex);
|
|
4329
|
-
typeof autoHeightInfo == "number" ? row.ia = autoHeightInfo : row.ia = (_a20 = autoHeightInfo[rowIndex]) != null ? _a20 :
|
|
4298
|
+
typeof autoHeightInfo == "number" ? row.ia = autoHeightInfo : row.ia = (_a20 = autoHeightInfo[rowIndex]) != null ? _a20 : void 0;
|
|
4330
4299
|
}
|
|
4331
4300
|
return !0;
|
|
4332
4301
|
}, "handler")
|
|
@@ -4334,10 +4303,9 @@ const SetStyleCommand = {
|
|
|
4334
4303
|
id: "sheet.mutation.set-worksheet-row-auto-height",
|
|
4335
4304
|
type: CommandType.MUTATION,
|
|
4336
4305
|
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
4337
|
-
const {
|
|
4338
|
-
if (!
|
|
4339
|
-
|
|
4340
|
-
const rowManager = worksheet.getRowManager();
|
|
4306
|
+
const { rowsAutoHeightInfo } = params, univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
|
|
4307
|
+
if (!target) return !1;
|
|
4308
|
+
const rowManager = target.worksheet.getRowManager();
|
|
4341
4309
|
for (const { row, autoHeight } of rowsAutoHeightInfo) {
|
|
4342
4310
|
const curRow = rowManager.getRowOrCreate(row);
|
|
4343
4311
|
curRow.ah = autoHeight;
|
|
@@ -4388,15 +4356,12 @@ const SetStyleCommand = {
|
|
|
4388
4356
|
}
|
|
4389
4357
|
]
|
|
4390
4358
|
};
|
|
4391
|
-
const undoMutationParams = SetWorksheetRowHeightMutationFactory(
|
|
4392
|
-
accessor,
|
|
4393
|
-
redoMutationParams
|
|
4394
|
-
), redoSetIsAutoHeightParams = {
|
|
4359
|
+
const undoMutationParams = SetWorksheetRowHeightMutationFactory(redoMutationParams, worksheet), redoSetIsAutoHeightParams = {
|
|
4395
4360
|
unitId,
|
|
4396
4361
|
subUnitId,
|
|
4397
4362
|
ranges: redoMutationParams.ranges,
|
|
4398
4363
|
autoHeightInfo: BooleanNumber.FALSE
|
|
4399
|
-
}, undoSetIsAutoHeightParams = SetWorksheetRowIsAutoHeightMutationFactory(
|
|
4364
|
+
}, undoSetIsAutoHeightParams = SetWorksheetRowIsAutoHeightMutationFactory(redoSetIsAutoHeightParams, worksheet), commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), intercepted = sheetInterceptorService.onCommandExecute({
|
|
4400
4365
|
id: DeltaRowHeightCommand.id,
|
|
4401
4366
|
params: redoMutationParams
|
|
4402
4367
|
}), result = sequenceExecute([
|
|
@@ -4448,20 +4413,17 @@ const SetStyleCommand = {
|
|
|
4448
4413
|
return !1;
|
|
4449
4414
|
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
4450
4415
|
if (!target) return !1;
|
|
4451
|
-
const { unitId, subUnitId } = target, redoMutationParams = {
|
|
4416
|
+
const { unitId, subUnitId, worksheet } = target, redoMutationParams = {
|
|
4452
4417
|
subUnitId,
|
|
4453
4418
|
unitId,
|
|
4454
4419
|
ranges: selections,
|
|
4455
4420
|
rowHeight: params.value
|
|
4456
|
-
}, undoMutationParams = SetWorksheetRowHeightMutationFactory(
|
|
4457
|
-
accessor,
|
|
4458
|
-
redoMutationParams
|
|
4459
|
-
), redoSetIsAutoHeightParams = {
|
|
4421
|
+
}, undoMutationParams = SetWorksheetRowHeightMutationFactory(redoMutationParams, worksheet), redoSetIsAutoHeightParams = {
|
|
4460
4422
|
unitId,
|
|
4461
4423
|
subUnitId,
|
|
4462
4424
|
ranges: redoMutationParams.ranges,
|
|
4463
4425
|
autoHeightInfo: BooleanNumber.FALSE
|
|
4464
|
-
}, undoSetIsAutoHeightParams = SetWorksheetRowIsAutoHeightMutationFactory(
|
|
4426
|
+
}, undoSetIsAutoHeightParams = SetWorksheetRowIsAutoHeightMutationFactory(redoSetIsAutoHeightParams, worksheet), result = sequenceExecute([
|
|
4465
4427
|
{
|
|
4466
4428
|
id: SetWorksheetRowHeightMutation.id,
|
|
4467
4429
|
params: redoMutationParams
|
|
@@ -4509,7 +4471,7 @@ const SetStyleCommand = {
|
|
|
4509
4471
|
var _a20, _b;
|
|
4510
4472
|
const commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), selectionManagerService = accessor.get(SheetsSelectionsService), univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, params);
|
|
4511
4473
|
if (!target) return !1;
|
|
4512
|
-
const { unitId, subUnitId } = target, ranges = (_a20 = params == null ? void 0 : params.ranges) != null && _a20.length ? params.ranges : (_b = selectionManagerService.getCurrentSelections()) == null ? void 0 : _b.map((s) => s.range);
|
|
4474
|
+
const { unitId, subUnitId, worksheet } = target, ranges = (_a20 = params == null ? void 0 : params.ranges) != null && _a20.length ? params.ranges : (_b = selectionManagerService.getCurrentSelections()) == null ? void 0 : _b.map((s) => s.range);
|
|
4513
4475
|
if (!(ranges != null && ranges.length))
|
|
4514
4476
|
return !1;
|
|
4515
4477
|
const redoMutationParams = {
|
|
@@ -4518,7 +4480,7 @@ const SetStyleCommand = {
|
|
|
4518
4480
|
ranges,
|
|
4519
4481
|
autoHeightInfo: BooleanNumber.TRUE
|
|
4520
4482
|
// Hard code first, maybe it will change by the menu item in the future.
|
|
4521
|
-
}, undoMutationParams = SetWorksheetRowIsAutoHeightMutationFactory(
|
|
4483
|
+
}, undoMutationParams = SetWorksheetRowIsAutoHeightMutationFactory(redoMutationParams, worksheet), setIsAutoHeightResult = commandService.syncExecuteCommand(
|
|
4522
4484
|
SetWorksheetRowIsAutoHeightMutation.id,
|
|
4523
4485
|
redoMutationParams
|
|
4524
4486
|
), { undos, redos } = accessor.get(SheetInterceptorService).onCommandExecute({
|
|
@@ -4842,6 +4804,9 @@ let WorksheetProtectionRuleModel = (_a4 = class {
|
|
|
4842
4804
|
changeRuleInitState(state) {
|
|
4843
4805
|
this._worksheetRuleInitStateChange.next(state);
|
|
4844
4806
|
}
|
|
4807
|
+
getSheetRuleInitState() {
|
|
4808
|
+
return this._worksheetRuleInitStateChange.value;
|
|
4809
|
+
}
|
|
4845
4810
|
addRule(unitId, rule) {
|
|
4846
4811
|
this._ensureSubUnitMap(unitId).set(rule.subUnitId, rule), this._ruleChange.next({ unitId, rule, type: "add", subUnitId: rule.subUnitId });
|
|
4847
4812
|
}
|
|
@@ -4949,6 +4914,9 @@ let RangeProtectionRuleModel = (_a5 = class {
|
|
|
4949
4914
|
ruleRefresh(id) {
|
|
4950
4915
|
this._ruleRefresh.next(id);
|
|
4951
4916
|
}
|
|
4917
|
+
getRangeRuleInitState() {
|
|
4918
|
+
return this._rangeRuleInitStateChange.value;
|
|
4919
|
+
}
|
|
4952
4920
|
changeRuleInitState(state) {
|
|
4953
4921
|
this._rangeRuleInitStateChange.next(state);
|
|
4954
4922
|
}
|
|
@@ -6457,9 +6425,11 @@ const MERGE_REDO = createInterceptorKey("MERGE_REDO"), MERGE_UNDO = createInterc
|
|
|
6457
6425
|
if (!this._range)
|
|
6458
6426
|
return;
|
|
6459
6427
|
if (this._skipIntersects) {
|
|
6428
|
+
if (mutation.id === RemoveSheetMutation.id)
|
|
6429
|
+
return;
|
|
6460
6430
|
const effectRanges = getEffectedRangesOnMutation(mutation);
|
|
6461
6431
|
if (effectRanges != null && effectRanges.some((effectRange) => Rectangle.intersects(effectRange, this._range)))
|
|
6462
|
-
return
|
|
6432
|
+
return;
|
|
6463
6433
|
}
|
|
6464
6434
|
const afterRange = adjustRangeOnMutation(this._range, mutation);
|
|
6465
6435
|
if (afterRange && Rectangle.equals(afterRange, this._range))
|
|
@@ -8114,6 +8084,66 @@ NumberCellDisplayController = __decorateClass$1([
|
|
|
8114
8084
|
OnLifecycle(LifecycleStages.Ready, NumberCellDisplayController),
|
|
8115
8085
|
__decorateParam$1(0, Inject(SheetInterceptorService))
|
|
8116
8086
|
], NumberCellDisplayController);
|
|
8087
|
+
const IExclusiveRangeService = createIdentifier("univer.exclusive-range-service"), _ExclusiveRangeService = class _ExclusiveRangeService extends Disposable {
|
|
8088
|
+
constructor() {
|
|
8089
|
+
super(...arguments);
|
|
8090
|
+
/**
|
|
8091
|
+
* Exclusive range data structure is as follows: unitId -> sheetId -> feature -> range
|
|
8092
|
+
*/
|
|
8093
|
+
__publicField(this, "_exclusiveRanges", /* @__PURE__ */ new Map());
|
|
8094
|
+
}
|
|
8095
|
+
_ensureUnitMap(unitId) {
|
|
8096
|
+
return this._exclusiveRanges.has(unitId) || this._exclusiveRanges.set(unitId, /* @__PURE__ */ new Map()), this._exclusiveRanges.get(unitId);
|
|
8097
|
+
}
|
|
8098
|
+
_ensureSubunitMap(unitId, sheetId) {
|
|
8099
|
+
const unitMap = this._ensureUnitMap(unitId);
|
|
8100
|
+
return unitMap.has(sheetId) || unitMap.set(sheetId, /* @__PURE__ */ new Map()), unitMap.get(sheetId);
|
|
8101
|
+
}
|
|
8102
|
+
_ensureFeature(unitId, sheetId, feature) {
|
|
8103
|
+
const subunitMap = this._ensureSubunitMap(unitId, sheetId);
|
|
8104
|
+
return subunitMap.has(feature) || subunitMap.set(feature, []), subunitMap.get(feature);
|
|
8105
|
+
}
|
|
8106
|
+
addExclusiveRange(unitId, sheetId, feature, ranges) {
|
|
8107
|
+
this._ensureFeature(unitId, sheetId, feature).push(...ranges);
|
|
8108
|
+
}
|
|
8109
|
+
getExclusiveRanges(unitId, sheetId, feature) {
|
|
8110
|
+
var _a20, _b;
|
|
8111
|
+
return (_b = (_a20 = this._exclusiveRanges.get(unitId)) == null ? void 0 : _a20.get(sheetId)) == null ? void 0 : _b.get(feature);
|
|
8112
|
+
}
|
|
8113
|
+
clearExclusiveRanges(unitId, sheetId, feature) {
|
|
8114
|
+
this._ensureFeature(unitId, sheetId, feature), this._exclusiveRanges.get(unitId).get(sheetId).set(feature, []);
|
|
8115
|
+
}
|
|
8116
|
+
clearExclusiveRangesByGroupId(unitId, sheetId, feature, groupId) {
|
|
8117
|
+
const featureMap = this.getExclusiveRanges(unitId, sheetId, feature);
|
|
8118
|
+
if (featureMap) {
|
|
8119
|
+
const newFeatureMap = featureMap.filter((item) => item.groupId !== groupId);
|
|
8120
|
+
this._exclusiveRanges.get(unitId).get(sheetId).set(feature, newFeatureMap);
|
|
8121
|
+
}
|
|
8122
|
+
}
|
|
8123
|
+
getInterestGroupId(selections) {
|
|
8124
|
+
const interestGroupId = [];
|
|
8125
|
+
return selections.forEach((selection) => {
|
|
8126
|
+
var _a20;
|
|
8127
|
+
const range = selection.range, { unitId, sheetId } = range;
|
|
8128
|
+
if (!unitId || !sheetId) return;
|
|
8129
|
+
const featureMap = (_a20 = this._exclusiveRanges.get(unitId)) == null ? void 0 : _a20.get(sheetId);
|
|
8130
|
+
if (featureMap)
|
|
8131
|
+
for (const feature of featureMap.keys()) {
|
|
8132
|
+
const featureMapRanges = featureMap.get(feature);
|
|
8133
|
+
if (featureMapRanges) {
|
|
8134
|
+
for (const featureMapRange of featureMapRanges)
|
|
8135
|
+
if (Rectangle.intersects(range, featureMapRange.range)) {
|
|
8136
|
+
interestGroupId.push(feature);
|
|
8137
|
+
break;
|
|
8138
|
+
}
|
|
8139
|
+
}
|
|
8140
|
+
}
|
|
8141
|
+
}), interestGroupId;
|
|
8142
|
+
}
|
|
8143
|
+
};
|
|
8144
|
+
__name(_ExclusiveRangeService, "ExclusiveRangeService");
|
|
8145
|
+
let ExclusiveRangeService = _ExclusiveRangeService;
|
|
8146
|
+
const PLUGIN_CONFIG_KEY = "sheets.config", defaultPluginConfig = {};
|
|
8117
8147
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
8118
8148
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8119
8149
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -8122,8 +8152,10 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
|
|
|
8122
8152
|
const PLUGIN_NAME = "SHEET_PLUGIN";
|
|
8123
8153
|
var _a19;
|
|
8124
8154
|
let UniverSheetsPlugin = (_a19 = class extends Plugin {
|
|
8125
|
-
constructor(_config,
|
|
8126
|
-
super(), this._config = _config, this.
|
|
8155
|
+
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
8156
|
+
super(), this._config = _config, this._injector = _injector, this._configService = _configService;
|
|
8157
|
+
const { ...rest } = this._config;
|
|
8158
|
+
this._configService.setConfig(PLUGIN_CONFIG_KEY, rest), this._initConfig(), this._initDependencies(_injector);
|
|
8127
8159
|
}
|
|
8128
8160
|
onRendered() {
|
|
8129
8161
|
}
|
|
@@ -8154,19 +8186,23 @@ let UniverSheetsPlugin = (_a19 = class extends Plugin {
|
|
|
8154
8186
|
[RangeProtectionRenderModel],
|
|
8155
8187
|
[RangeProtectionRuleModel],
|
|
8156
8188
|
[RangeProtectionRefRangeService],
|
|
8157
|
-
[RangeProtectionService]
|
|
8189
|
+
[RangeProtectionService],
|
|
8190
|
+
[IExclusiveRangeService, {
|
|
8191
|
+
useClass: ExclusiveRangeService,
|
|
8192
|
+
deps: [SheetsSelectionsService]
|
|
8193
|
+
}]
|
|
8158
8194
|
];
|
|
8159
8195
|
(_a20 = this._config) != null && _a20.notExecuteFormula || dependencies.push([CalculateResultApplyController]), mergeOverrideWithDependencies(dependencies, (_b = this._config) == null ? void 0 : _b.override).forEach((d) => {
|
|
8160
8196
|
sheetInjector.add(d);
|
|
8161
|
-
}), this._injector.get(SheetInterceptorService), this._injector.get(RangeProtectionService);
|
|
8197
|
+
}), this._injector.get(SheetInterceptorService), this._injector.get(RangeProtectionService), this._injector.get(IExclusiveRangeService);
|
|
8162
8198
|
}
|
|
8163
8199
|
}, __name(_a19, "UniverSheetsPlugin"), _a19);
|
|
8164
8200
|
__publicField2(UniverSheetsPlugin, "pluginName", PLUGIN_NAME);
|
|
8165
8201
|
__publicField2(UniverSheetsPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
8166
8202
|
UniverSheetsPlugin = __decorateClass([
|
|
8167
8203
|
DependentOn(UniverFormulaEnginePlugin),
|
|
8168
|
-
__decorateParam(1,
|
|
8169
|
-
__decorateParam(2,
|
|
8204
|
+
__decorateParam(1, Inject(Injector)),
|
|
8205
|
+
__decorateParam(2, IConfigService)
|
|
8170
8206
|
], UniverSheetsPlugin);
|
|
8171
8207
|
const COMMAND_LISTENER_SKELETON_CHANGE = [
|
|
8172
8208
|
SetWorksheetRowHeightMutation.id,
|
|
@@ -8634,7 +8670,21 @@ const AddWorksheetMergeCommand = {
|
|
|
8634
8670
|
subUnitId
|
|
8635
8671
|
});
|
|
8636
8672
|
}, "handler")
|
|
8637
|
-
}
|
|
8673
|
+
};
|
|
8674
|
+
async function addMergeCellsUtil(injector, unitId, subUnitId, ranges) {
|
|
8675
|
+
const univerInstanceService = injector.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService, { unitId, subUnitId });
|
|
8676
|
+
if (!target) return;
|
|
8677
|
+
const { worksheet } = target;
|
|
8678
|
+
if (worksheet.getMergeData().some((mergeRange) => ranges.some((range) => Rectangle.intersects(range, mergeRange))))
|
|
8679
|
+
throw new Error("The ranges to be merged overlap with the existing merged cells");
|
|
8680
|
+
await injector.get(ICommandService).executeCommand(AddWorksheetMergeCommand.id, {
|
|
8681
|
+
unitId,
|
|
8682
|
+
subUnitId,
|
|
8683
|
+
selections: ranges
|
|
8684
|
+
});
|
|
8685
|
+
}
|
|
8686
|
+
__name(addMergeCellsUtil, "addMergeCellsUtil");
|
|
8687
|
+
const SetHideGridlinesUndoMutationFactory = /* @__PURE__ */ __name((accessor, params) => {
|
|
8638
8688
|
const oldStatus = accessor.get(IUniverInstanceService).getUniverSheetInstance(params.unitId).getSheetBySheetId(params.subUnitId).getConfig().showGridlines;
|
|
8639
8689
|
return {
|
|
8640
8690
|
...Tools.deepClone(params),
|
|
@@ -8751,9 +8801,11 @@ export {
|
|
|
8751
8801
|
DeltaRowHeightCommand,
|
|
8752
8802
|
EffectRefRangId,
|
|
8753
8803
|
EmptyMutation,
|
|
8804
|
+
ExclusiveRangeService,
|
|
8754
8805
|
FactoryAddRangeProtectionMutation,
|
|
8755
8806
|
FactoryDeleteRangeProtectionMutation,
|
|
8756
8807
|
FactorySetRangeProtectionMutation,
|
|
8808
|
+
IExclusiveRangeService,
|
|
8757
8809
|
INTERCEPTOR_POINT,
|
|
8758
8810
|
INumfmtService,
|
|
8759
8811
|
IRefSelectionsService,
|
|
@@ -8933,6 +8985,7 @@ export {
|
|
|
8933
8985
|
WorksheetSetRowStylePermission,
|
|
8934
8986
|
WorksheetSortPermission,
|
|
8935
8987
|
WorksheetViewPermission,
|
|
8988
|
+
addMergeCellsUtil,
|
|
8936
8989
|
alignToMergedCellsBorders,
|
|
8937
8990
|
checkRangesEditablePermission,
|
|
8938
8991
|
convertPrimaryWithCoordToPrimary,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICommand, IRange, Dimension } from '@univerjs/core';
|
|
1
|
+
import { ICommand, Injector, IRange, Dimension } from '@univerjs/core';
|
|
2
2
|
export interface IAddMergeCommandParams {
|
|
3
3
|
value?: Dimension.ROWS | Dimension.COLUMNS;
|
|
4
4
|
selections: IRange[];
|
|
@@ -9,3 +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>;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IMutation, IObjectArrayPrimitiveType, IRange, Nullable, Worksheet } from '@univerjs/core';
|
|
2
2
|
export interface ISetWorksheetColWidthMutationParams {
|
|
3
3
|
unitId: string;
|
|
4
4
|
subUnitId: string;
|
|
5
5
|
ranges: IRange[];
|
|
6
6
|
colWidth: number | IObjectArrayPrimitiveType<Nullable<number>>;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* This factory is for generating undo mutations for command {@link DeltaColumnWidthCommand}.
|
|
10
|
+
*
|
|
11
|
+
* Note that this mutation may return multi mutations params if the column width is different
|
|
12
|
+
* for each column in the range.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SetWorksheetColWidthMutationFactory: (params: ISetWorksheetColWidthMutationParams, worksheet: Worksheet) => ISetWorksheetColWidthMutationParams;
|
|
9
15
|
export declare const SetWorksheetColWidthMutation: IMutation<ISetWorksheetColWidthMutationParams>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BooleanNumber,
|
|
1
|
+
import { BooleanNumber, IMutation, IObjectArrayPrimitiveType, IRange, IRowAutoHeightInfo, Nullable, Worksheet } from '@univerjs/core';
|
|
2
2
|
export interface ISetWorksheetRowHeightMutationParams {
|
|
3
3
|
unitId: string;
|
|
4
4
|
subUnitId: string;
|
|
@@ -16,9 +16,9 @@ export interface ISetWorksheetRowAutoHeightMutationParams {
|
|
|
16
16
|
subUnitId: string;
|
|
17
17
|
rowsAutoHeightInfo: IRowAutoHeightInfo[];
|
|
18
18
|
}
|
|
19
|
-
export declare const SetWorksheetRowHeightMutationFactory: (
|
|
20
|
-
export declare const SetWorksheetRowIsAutoHeightMutationFactory: (
|
|
21
|
-
export declare const SetWorksheetRowAutoHeightMutationFactory: (
|
|
19
|
+
export declare const SetWorksheetRowHeightMutationFactory: (params: ISetWorksheetRowHeightMutationParams, worksheet: Worksheet) => ISetWorksheetRowHeightMutationParams;
|
|
20
|
+
export declare const SetWorksheetRowIsAutoHeightMutationFactory: (params: ISetWorksheetRowIsAutoHeightMutationParams, worksheet: Worksheet) => ISetWorksheetRowIsAutoHeightMutationParams;
|
|
21
|
+
export declare const SetWorksheetRowAutoHeightMutationFactory: (params: ISetWorksheetRowAutoHeightMutationParams, worksheet: Worksheet) => ISetWorksheetRowAutoHeightMutationParams;
|
|
22
22
|
export declare const SetWorksheetRowHeightMutation: IMutation<ISetWorksheetRowHeightMutationParams>;
|
|
23
23
|
export declare const SetWorksheetRowIsAutoHeightMutation: IMutation<ISetWorksheetRowIsAutoHeightMutationParams>;
|
|
24
24
|
export declare const SetWorksheetRowAutoHeightMutation: IMutation<ISetWorksheetRowAutoHeightMutationParams>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dependency, IWorkbookData, Univer } from '@univerjs/core';
|
|
1
|
+
import { Dependency, IWorkbookData, Workbook, Univer } from '@univerjs/core';
|
|
2
2
|
export declare function createTestBase(workbookData?: IWorkbookData, dependencies?: Dependency[]): {
|
|
3
3
|
univer: Univer;
|
|
4
4
|
get: {
|
|
@@ -9,5 +9,5 @@ export declare function createTestBase(workbookData?: IWorkbookData, dependencie
|
|
|
9
9
|
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity?: import('@univerjs/core').Quantity, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
10
10
|
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantityOrLookup?: import('@univerjs/core').Quantity | import('@univerjs/core').LookUp, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
11
11
|
};
|
|
12
|
-
sheet:
|
|
12
|
+
sheet: Workbook;
|
|
13
13
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DependencyOverride } from '@univerjs/core';
|
|
2
|
+
export declare const PLUGIN_CONFIG_KEY = "sheets.config";
|
|
3
|
+
export declare const configSymbol: unique symbol;
|
|
4
|
+
export interface IUniverSheetsConfig {
|
|
5
|
+
notExecuteFormula?: boolean;
|
|
6
|
+
override?: DependencyOverride;
|
|
7
|
+
/**
|
|
8
|
+
* Only register the mutations related to the formula calculation. Especially useful for the
|
|
9
|
+
* web worker environment or server-side-calculation.
|
|
10
|
+
*/
|
|
11
|
+
onlyRegisterFormulaRelatedMutations?: true;
|
|
12
|
+
}
|
|
13
|
+
export declare const defaultPluginConfig: IUniverSheetsConfig;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export {
|
|
16
|
+
export { UniverSheetsPlugin } from './sheets-plugin';
|
|
17
17
|
export { COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE } from './basics/const/command-listener-const';
|
|
18
18
|
export { type IAddWorksheetMergeMutationParams, type IDeleteRangeMutationParams, type IInsertColMutationParams, type IInsertRangeMutationParams, type IInsertRowMutationParams, type IInsertSheetMutationParams, type IRemoveColMutationParams, type IRemoveRowsMutationParams, type IRemoveSheetMutationParams, type IRemoveWorksheetMergeMutationParams, } from './basics/interfaces/mutation-interface';
|
|
19
19
|
export { convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, getNormalSelectionStyle, type ISelectionStyle, type ISelectionWidgetConfig, type ISelectionWithCoordAndStyle, type ISelectionWithStyle, type ISheetRangeLocation, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, transformCellDataToSelectionData, } from './basics/selection';
|
|
@@ -49,6 +49,7 @@ export { MergeCellController, MERGE_CELL_INTERCEPTOR_CHECK } from './controllers
|
|
|
49
49
|
export { AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory } from './commands/utils/handle-merge-operation';
|
|
50
50
|
export type { FormatType } from './services/numfmt/type';
|
|
51
51
|
export { expandToContinuousRange } from './basics/expand-range';
|
|
52
|
+
export { ExclusiveRangeService, IExclusiveRangeService } from './services/exclusive-range/exclusive-range-service';
|
|
52
53
|
export { defaultWorksheetPermissionPoint, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel } from './services/permission';
|
|
53
54
|
export type { IWorksheetProtectionRule } from './services/permission/type';
|
|
54
55
|
export { WorksheetProtectionRuleModel, WorksheetProtectionPointModel } from './services/permission/worksheet-permission';
|
|
@@ -67,7 +68,7 @@ export { RangeProtectionPermissionViewPoint } from './services/permission/permis
|
|
|
67
68
|
export { generateNullCellValue, generateNullCell } from './basics/utils';
|
|
68
69
|
export { copyRangeStyles } from './commands/commands/utils/selection-utils';
|
|
69
70
|
export { AddRangeProtectionCommand, type IAddRangeProtectionCommandParams } from './commands/commands/add-range-protection.command';
|
|
70
|
-
export { AddWorksheetMergeCommand, AddWorksheetMergeAllCommand, AddWorksheetMergeVerticalCommand, AddWorksheetMergeHorizontalCommand, } from './commands/commands/add-worksheet-merge.command';
|
|
71
|
+
export { AddWorksheetMergeCommand, AddWorksheetMergeAllCommand, AddWorksheetMergeVerticalCommand, AddWorksheetMergeHorizontalCommand, addMergeCellsUtil, } from './commands/commands/add-worksheet-merge.command';
|
|
71
72
|
export { ClearSelectionAllCommand } from './commands/commands/clear-selection-all.command';
|
|
72
73
|
export { ClearSelectionContentCommand } from './commands/commands/clear-selection-content.command';
|
|
73
74
|
export { ClearSelectionFormatCommand } from './commands/commands/clear-selection-format.command';
|
|
@@ -136,6 +137,7 @@ export { SetWorksheetHideMutation, type ISetWorksheetHideMutationParams } from '
|
|
|
136
137
|
export { SetWorksheetNameMutation, type ISetWorksheetNameMutationParams } from './commands/mutations/set-worksheet-name.mutation';
|
|
137
138
|
export { SetWorksheetOrderMutation, type ISetWorksheetOrderMutationParams } from './commands/mutations/set-worksheet-order.mutation';
|
|
138
139
|
export { SetWorksheetPermissionPointsMutation } from './commands/mutations/set-worksheet-permission-points.mutation';
|
|
140
|
+
export type { ISetWorksheetPermissionPointsMutationParams } from './commands/mutations/set-worksheet-permission-points.mutation';
|
|
139
141
|
export { SetWorksheetProtectionMutation } from './commands/mutations/set-worksheet-protection.mutation';
|
|
140
142
|
export { SetWorksheetRightToLeftMutation } from './commands/mutations/set-worksheet-right-to-left.mutation';
|
|
141
143
|
export { SetWorksheetRowHeightMutation, SetWorksheetRowIsAutoHeightMutation, SetWorksheetRowAutoHeightMutation, SetWorksheetRowAutoHeightMutationFactory, type ISetWorksheetRowHeightMutationParams, type ISetWorksheetRowIsAutoHeightMutationParams, type ISetWorksheetRowAutoHeightMutationParams, } from './commands/mutations/set-worksheet-row-height.mutation';
|
|
@@ -32,6 +32,7 @@ export declare class RangeProtectionRuleModel {
|
|
|
32
32
|
ruleRefresh(id: string): void;
|
|
33
33
|
private _rangeRuleInitStateChange;
|
|
34
34
|
rangeRuleInitStateChange$: import('rxjs').Observable<boolean>;
|
|
35
|
+
getRangeRuleInitState(): boolean;
|
|
35
36
|
changeRuleInitState(state: boolean): void;
|
|
36
37
|
addRule(unitId: string, subUnitId: string, rule: IRangeProtectionRule): void;
|
|
37
38
|
deleteRule(unitId: string, subUnitId: string, id: string): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dependency, IWorkbookData, Univer } from '@univerjs/core';
|
|
1
|
+
import { Dependency, IWorkbookData, Workbook, Univer } from '@univerjs/core';
|
|
2
2
|
export declare const TEST_WORKBOOK_DATA_DEMO: IWorkbookData;
|
|
3
3
|
export declare function createTestBase(workbookData?: IWorkbookData, dependencies?: Dependency[]): {
|
|
4
4
|
univer: Univer;
|
|
@@ -10,5 +10,5 @@ export declare function createTestBase(workbookData?: IWorkbookData, dependencie
|
|
|
10
10
|
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity?: import('@univerjs/core').Quantity, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
11
11
|
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantityOrLookup?: import('@univerjs/core').Quantity | import('@univerjs/core').LookUp, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
12
12
|
};
|
|
13
|
-
sheet:
|
|
13
|
+
sheet: Workbook;
|
|
14
14
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { IRange, Disposable } from '@univerjs/core';
|
|
2
|
+
import { ISelectionWithStyle } from '../../basics/selection';
|
|
3
|
+
interface IFeatureRange {
|
|
4
|
+
groupId: string;
|
|
5
|
+
range: IRange;
|
|
6
|
+
}
|
|
7
|
+
export interface IExclusiveRangeService {
|
|
8
|
+
/**
|
|
9
|
+
* @description Add an exclusive range to the service
|
|
10
|
+
* @param {string} unitId The unitId of the exclusive range
|
|
11
|
+
* @param {string} sheetId The sheetId of the exclusive range
|
|
12
|
+
* @param {string} feature The feature of the exclusive range
|
|
13
|
+
* @param {IFeatureRange} range The exclusive range
|
|
14
|
+
*/
|
|
15
|
+
addExclusiveRange(unitId: string, sheetId: string, feature: string, ranges: IFeatureRange[]): void;
|
|
16
|
+
/**
|
|
17
|
+
* @description Get the exclusive ranges
|
|
18
|
+
* @param {string} unitId The unitId of the exclusive range
|
|
19
|
+
* @param {string} sheetId The sheetId of the exclusive range
|
|
20
|
+
* @param {string} feature The feature of the exclusive range
|
|
21
|
+
* @returns {undefined | IFeatureRange[]} The exclusive ranges
|
|
22
|
+
*/
|
|
23
|
+
getExclusiveRanges(unitId: string, sheetId: string, feature: string): undefined | IFeatureRange[];
|
|
24
|
+
/**
|
|
25
|
+
* @description Clear the exclusive ranges
|
|
26
|
+
* @param {string} unitId The unitId of the exclusive range
|
|
27
|
+
* @param {string} sheetId The sheetId of the exclusive range
|
|
28
|
+
* @param {string} feature The feature of the exclusive range
|
|
29
|
+
*/
|
|
30
|
+
clearExclusiveRanges(unitId: string, sheetId: string, feature: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* @description Clear the exclusive ranges by groupId
|
|
33
|
+
* @param {string} unitId The unitId of the exclusive range
|
|
34
|
+
* @param {string} sheetId The sheetId of the exclusive range
|
|
35
|
+
* @param {string} feature The feature of the exclusive range
|
|
36
|
+
* @param {string} groupId The groupId of the exclusive range
|
|
37
|
+
*/
|
|
38
|
+
clearExclusiveRangesByGroupId(unitId: string, sheetId: string, feature: string, groupId: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Check the interest group id of the giving selection
|
|
41
|
+
* @param {ISelectionWithStyle[]} selections The selections to check
|
|
42
|
+
*/
|
|
43
|
+
getInterestGroupId(selections: ISelectionWithStyle[]): string[];
|
|
44
|
+
}
|
|
45
|
+
export declare const IExclusiveRangeService: import('@univerjs/core').IdentifierDecorator<IExclusiveRangeService>;
|
|
46
|
+
export declare class ExclusiveRangeService extends Disposable implements IExclusiveRangeService {
|
|
47
|
+
/**
|
|
48
|
+
* Exclusive range data structure is as follows: unitId -> sheetId -> feature -> range
|
|
49
|
+
*/
|
|
50
|
+
private _exclusiveRanges;
|
|
51
|
+
private _ensureUnitMap;
|
|
52
|
+
private _ensureSubunitMap;
|
|
53
|
+
private _ensureFeature;
|
|
54
|
+
addExclusiveRange(unitId: string, sheetId: string, feature: string, ranges: IFeatureRange[]): void;
|
|
55
|
+
getExclusiveRanges(unitId: string, sheetId: string, feature: string): undefined | IFeatureRange[];
|
|
56
|
+
clearExclusiveRanges(unitId: string, sheetId: string, feature: string): void;
|
|
57
|
+
clearExclusiveRangesByGroupId(unitId: string, sheetId: string, feature: string, groupId: string): void;
|
|
58
|
+
getInterestGroupId(selections: ISelectionWithStyle[]): string[];
|
|
59
|
+
}
|
|
60
|
+
export {};
|