@univerjs/sheets 1.0.0-alpha.6 → 1.0.0-alpha.8
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 +8 -7
- package/lib/cjs/index.js +154 -131
- package/lib/es/facade.js +8 -7
- package/lib/es/index.js +155 -132
- package/lib/facade.js +8 -7
- package/lib/index.js +155 -132
- package/lib/types/basics/selection.d.ts +0 -9
- package/lib/types/commands/commands/auto-fill.command.d.ts +3 -4
- package/lib/types/commands/commands/remove-row-col.command.d.ts +2 -0
- package/lib/types/commands/utils/selection-command-util.d.ts +2 -1
- package/lib/types/facade/index.d.ts +0 -1
- package/lib/types/models/range-protection-render.model.d.ts +3 -2
- package/lib/types/services/selections/selection-data-model.d.ts +0 -6
- package/lib/types/services/selections/selection.service.d.ts +0 -6
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +8 -8
- package/lib/types/facade/f-types.d.ts +0 -16
package/lib/cjs/index.js
CHANGED
|
@@ -159,7 +159,7 @@ const RangeThemeInterceptorId = "sheet.interceptor.range-theme-id";
|
|
|
159
159
|
const IgnoreRangeThemeInterceptorKey = "sheet.interceptor.ignore-range-theme";
|
|
160
160
|
|
|
161
161
|
//#endregion
|
|
162
|
-
//#region \0@oxc-project+runtime@0.
|
|
162
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
163
163
|
function _typeof(o) {
|
|
164
164
|
"@babel/helpers - typeof";
|
|
165
165
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -170,7 +170,7 @@ function _typeof(o) {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
//#endregion
|
|
173
|
-
//#region \0@oxc-project+runtime@0.
|
|
173
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
174
174
|
function toPrimitive(t, r) {
|
|
175
175
|
if ("object" != _typeof(t) || !t) return t;
|
|
176
176
|
var e = t[Symbol.toPrimitive];
|
|
@@ -183,14 +183,14 @@ function toPrimitive(t, r) {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
//#endregion
|
|
186
|
-
//#region \0@oxc-project+runtime@0.
|
|
186
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
187
187
|
function toPropertyKey(t) {
|
|
188
188
|
var i = toPrimitive(t, "string");
|
|
189
189
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
//#endregion
|
|
193
|
-
//#region \0@oxc-project+runtime@0.
|
|
193
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
194
194
|
function _defineProperty(e, r, t) {
|
|
195
195
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
196
196
|
value: t,
|
|
@@ -201,7 +201,7 @@ function _defineProperty(e, r, t) {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
//#endregion
|
|
204
|
-
//#region \0@oxc-project+runtime@0.
|
|
204
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
205
205
|
function __decorateParam(paramIndex, decorator) {
|
|
206
206
|
return function(target, key) {
|
|
207
207
|
decorator(target, key, paramIndex);
|
|
@@ -209,7 +209,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
//#endregion
|
|
212
|
-
//#region \0@oxc-project+runtime@0.
|
|
212
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
213
213
|
function __decorate(decorators, target, key, desc) {
|
|
214
214
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
215
215
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1681,7 +1681,7 @@ const MoveRowsMutation = {
|
|
|
1681
1681
|
type: _univerjs_core.CommandType.MUTATION,
|
|
1682
1682
|
handler: (accessor, params) => {
|
|
1683
1683
|
const { unitId, subUnitId, sourceRange, targetRange } = params;
|
|
1684
|
-
const univerSheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
1684
|
+
const univerSheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
1685
1685
|
if (!univerSheet) throw new Error("[MoveRowMutation] univerSheet is null!");
|
|
1686
1686
|
const worksheet = univerSheet.getSheetBySheetId(subUnitId);
|
|
1687
1687
|
if (!worksheet) throw new Error("[MoveRowMutation] worksheet is null!");
|
|
@@ -1723,7 +1723,7 @@ const MoveColsMutation = {
|
|
|
1723
1723
|
type: _univerjs_core.CommandType.MUTATION,
|
|
1724
1724
|
handler: (accessor, params) => {
|
|
1725
1725
|
const { unitId, subUnitId, sourceRange, targetRange } = params;
|
|
1726
|
-
const univerSheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
1726
|
+
const univerSheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
1727
1727
|
if (!univerSheet) throw new Error("[MoveColumnMutation] univerSheet is null!");
|
|
1728
1728
|
const worksheet = univerSheet.getSheetBySheetId(subUnitId);
|
|
1729
1729
|
if (!worksheet) throw new Error("[MoveColumnMutation] worksheet is null!");
|
|
@@ -1754,7 +1754,7 @@ const RemoveRowMutation = {
|
|
|
1754
1754
|
id: "sheet.mutation.remove-rows",
|
|
1755
1755
|
type: _univerjs_core.CommandType.MUTATION,
|
|
1756
1756
|
handler: (accessor, params) => {
|
|
1757
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
1757
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
1758
1758
|
if (universheet == null) throw new Error("universheet is null error!");
|
|
1759
1759
|
const worksheet = universheet.getSheetBySheetId(params.subUnitId);
|
|
1760
1760
|
if (!worksheet) return false;
|
|
@@ -1770,7 +1770,7 @@ const RemoveRowMutation = {
|
|
|
1770
1770
|
}
|
|
1771
1771
|
};
|
|
1772
1772
|
const RemoveColMutationFactory = (accessor, params) => {
|
|
1773
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
1773
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
1774
1774
|
if (universheet == null) throw new Error("universheet is null error!");
|
|
1775
1775
|
const worksheet = universheet.getSheetBySheetId(params.subUnitId);
|
|
1776
1776
|
if (worksheet == null) throw new Error("worksheet is null error!");
|
|
@@ -1789,7 +1789,7 @@ const RemoveColMutation = {
|
|
|
1789
1789
|
id: "sheet.mutation.remove-col",
|
|
1790
1790
|
type: _univerjs_core.CommandType.MUTATION,
|
|
1791
1791
|
handler: (accessor, params) => {
|
|
1792
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
1792
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
1793
1793
|
if (universheet == null) throw new Error("universheet is null error!");
|
|
1794
1794
|
const worksheet = universheet.getSheetBySheetId(params.subUnitId);
|
|
1795
1795
|
if (!worksheet) return false;
|
|
@@ -1957,7 +1957,7 @@ const SetColDataMutation = {
|
|
|
1957
1957
|
//#endregion
|
|
1958
1958
|
//#region src/commands/mutations/set-col-visible.mutation.ts
|
|
1959
1959
|
const SetColHiddenUndoMutationFactory = (accessor, params) => {
|
|
1960
|
-
if (accessor.get(_univerjs_core.IUniverInstanceService).
|
|
1960
|
+
if (accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET) == null) throw new Error("universheet is null error!");
|
|
1961
1961
|
return {
|
|
1962
1962
|
unitId: params.unitId,
|
|
1963
1963
|
subUnitId: params.subUnitId,
|
|
@@ -1968,7 +1968,7 @@ const SetColHiddenMutation = {
|
|
|
1968
1968
|
id: "sheet.mutation.set-col-hidden",
|
|
1969
1969
|
type: _univerjs_core.CommandType.MUTATION,
|
|
1970
1970
|
handler: (accessor, params) => {
|
|
1971
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
1971
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
1972
1972
|
if (!universheet) return false;
|
|
1973
1973
|
const manager = universheet.getSheetBySheetId(params.subUnitId).getColumnManager();
|
|
1974
1974
|
for (let i = 0; i < params.ranges.length; i++) {
|
|
@@ -1982,7 +1982,7 @@ const SetColHiddenMutation = {
|
|
|
1982
1982
|
}
|
|
1983
1983
|
};
|
|
1984
1984
|
const SetColVisibleUndoMutationFactory = (accessor, params) => {
|
|
1985
|
-
if (accessor.get(_univerjs_core.IUniverInstanceService).
|
|
1985
|
+
if (accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET) == null) throw new Error("universheet is null error!");
|
|
1986
1986
|
return {
|
|
1987
1987
|
unitId: params.unitId,
|
|
1988
1988
|
subUnitId: params.subUnitId,
|
|
@@ -1993,7 +1993,7 @@ const SetColVisibleMutation = {
|
|
|
1993
1993
|
id: "sheet.mutation.set-col-visible",
|
|
1994
1994
|
type: _univerjs_core.CommandType.MUTATION,
|
|
1995
1995
|
handler: (accessor, params) => {
|
|
1996
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
1996
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
1997
1997
|
if (!universheet) return false;
|
|
1998
1998
|
const manager = universheet.getSheetBySheetId(params.subUnitId).getColumnManager();
|
|
1999
1999
|
for (let i = 0; i < params.ranges.length; i++) {
|
|
@@ -2343,7 +2343,7 @@ function setNull(value) {
|
|
|
2343
2343
|
*/
|
|
2344
2344
|
const SetRangeValuesUndoMutationFactory = (accessor, params) => {
|
|
2345
2345
|
const { unitId, subUnitId, cellValue, isOverrideStyle } = params;
|
|
2346
|
-
const workbook = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
2346
|
+
const workbook = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
2347
2347
|
if (workbook == null) throw new Error("workbook is null error!");
|
|
2348
2348
|
const worksheet = workbook.getSheetBySheetId(subUnitId);
|
|
2349
2349
|
if (worksheet == null) throw new Error("worksheet is null error!");
|
|
@@ -2473,7 +2473,7 @@ const SetRowDataMutation = {
|
|
|
2473
2473
|
//#endregion
|
|
2474
2474
|
//#region src/commands/mutations/set-row-visible.mutation.ts
|
|
2475
2475
|
const SetRowVisibleUndoMutationFactory = (accessor, params) => {
|
|
2476
|
-
if (accessor.get(_univerjs_core.IUniverInstanceService).
|
|
2476
|
+
if (accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET) == null) throw new Error("universheet is null error!");
|
|
2477
2477
|
return {
|
|
2478
2478
|
unitId: params.unitId,
|
|
2479
2479
|
subUnitId: params.subUnitId,
|
|
@@ -2484,7 +2484,7 @@ const SetRowVisibleMutation = {
|
|
|
2484
2484
|
id: "sheet.mutation.set-row-visible",
|
|
2485
2485
|
type: _univerjs_core.CommandType.MUTATION,
|
|
2486
2486
|
handler: (accessor, params) => {
|
|
2487
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
2487
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
2488
2488
|
if (universheet == null) throw new Error("universheet is null error!");
|
|
2489
2489
|
const manager = universheet.getSheetBySheetId(params.subUnitId).getRowManager();
|
|
2490
2490
|
for (let i = 0; i < params.ranges.length; i++) {
|
|
@@ -2498,7 +2498,7 @@ const SetRowVisibleMutation = {
|
|
|
2498
2498
|
}
|
|
2499
2499
|
};
|
|
2500
2500
|
const SetRowHiddenUndoMutationFactory = (accessor, params) => {
|
|
2501
|
-
if (accessor.get(_univerjs_core.IUniverInstanceService).
|
|
2501
|
+
if (accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET) == null) throw new Error("universheet is null error!");
|
|
2502
2502
|
return {
|
|
2503
2503
|
unitId: params.unitId,
|
|
2504
2504
|
subUnitId: params.subUnitId,
|
|
@@ -2509,7 +2509,7 @@ const SetRowHiddenMutation = {
|
|
|
2509
2509
|
id: "sheet.mutation.set-row-hidden",
|
|
2510
2510
|
type: _univerjs_core.CommandType.MUTATION,
|
|
2511
2511
|
handler: (accessor, params) => {
|
|
2512
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
2512
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
2513
2513
|
if (universheet == null) throw new Error("universheet is null error!");
|
|
2514
2514
|
const manager = universheet.getSheetBySheetId(params.subUnitId).getRowManager();
|
|
2515
2515
|
for (let i = 0; i < params.ranges.length; i++) {
|
|
@@ -3553,7 +3553,8 @@ const findAllRectangle = (topMatrix) => {
|
|
|
3553
3553
|
* @returns {IRange[]}
|
|
3554
3554
|
*/
|
|
3555
3555
|
const rangeMerge = (ranges) => {
|
|
3556
|
-
|
|
3556
|
+
const topMatrix = createTopMatrixFromRanges(ranges);
|
|
3557
|
+
return findAllRectangle(topMatrix);
|
|
3557
3558
|
};
|
|
3558
3559
|
var RangeMergeUtil = class {
|
|
3559
3560
|
constructor() {
|
|
@@ -3576,7 +3577,8 @@ var RangeMergeUtil = class {
|
|
|
3576
3577
|
return this;
|
|
3577
3578
|
}
|
|
3578
3579
|
merge() {
|
|
3579
|
-
|
|
3580
|
+
const topMatrix = createTopMatrixFromMatrix(this._matrix);
|
|
3581
|
+
return findAllRectangle(topMatrix);
|
|
3580
3582
|
}
|
|
3581
3583
|
};
|
|
3582
3584
|
|
|
@@ -4246,14 +4248,6 @@ var WorkbookSelectionModel = class extends _univerjs_core.Disposable {
|
|
|
4246
4248
|
getCurrentSelections() {
|
|
4247
4249
|
return this._getCurrentSelections();
|
|
4248
4250
|
}
|
|
4249
|
-
/**
|
|
4250
|
-
* @deprecated use `getSelectionsOfWorksheet` instead.
|
|
4251
|
-
* @param sheetId
|
|
4252
|
-
* @returns
|
|
4253
|
-
*/
|
|
4254
|
-
getSelectionOfWorksheet(sheetId) {
|
|
4255
|
-
return this.getSelectionsOfWorksheet(sheetId);
|
|
4256
|
-
}
|
|
4257
4251
|
getSelectionsOfWorksheet(sheetId) {
|
|
4258
4252
|
if (!this._worksheetSelections.has(sheetId)) this._worksheetSelections.set(sheetId, []);
|
|
4259
4253
|
return this._worksheetSelections.get(sheetId);
|
|
@@ -4430,19 +4424,6 @@ let SheetsSelectionsService = class SheetsSelectionsService extends _univerjs_co
|
|
|
4430
4424
|
clearCurrentSelections() {
|
|
4431
4425
|
this._getCurrentSelections().splice(0);
|
|
4432
4426
|
}
|
|
4433
|
-
/**
|
|
4434
|
-
* Determine whether multiple current selections overlap
|
|
4435
|
-
*
|
|
4436
|
-
* @deprecated this should be extracted to an pure function
|
|
4437
|
-
*/
|
|
4438
|
-
isOverlapping() {
|
|
4439
|
-
const selectionDataList = this.getCurrentSelections();
|
|
4440
|
-
if (selectionDataList == null) return false;
|
|
4441
|
-
return selectionDataList.some(({ range }, index) => selectionDataList.some(({ range: range2 }, index2) => {
|
|
4442
|
-
if (index === index2) return false;
|
|
4443
|
-
return range.startRow <= range2.endRow && range.endRow >= range2.startRow && range.startColumn <= range2.endColumn && range.endColumn >= range2.startColumn;
|
|
4444
|
-
}));
|
|
4445
|
-
}
|
|
4446
4427
|
_getCurrentSelections() {
|
|
4447
4428
|
const current = this._currentSelectionPos;
|
|
4448
4429
|
if (!current) return [];
|
|
@@ -5057,6 +5038,9 @@ RefSelectionsService = __decorate([__decorateParam(0, _univerjs_core.IUniverInst
|
|
|
5057
5038
|
|
|
5058
5039
|
//#endregion
|
|
5059
5040
|
//#region src/commands/utils/selection-command-util.ts
|
|
5041
|
+
function hasOverlappingRanges(ranges) {
|
|
5042
|
+
return ranges.some((range, index) => ranges.slice(index + 1).some((other) => _univerjs_core.Rectangle.simpleRangesIntersect(range, other)));
|
|
5043
|
+
}
|
|
5060
5044
|
function getSelectionsService(accessor, fromCurrentSelection) {
|
|
5061
5045
|
const isInRefSelectionMode = accessor.get(_univerjs_core.IContextService).getContextValue(REF_SELECTIONS_ENABLED);
|
|
5062
5046
|
return accessor.get(isInRefSelectionMode && !fromCurrentSelection ? IRefSelectionsService : SheetsSelectionsService);
|
|
@@ -5139,7 +5123,7 @@ function _resolveMoveRangeContext(accessor, params) {
|
|
|
5139
5123
|
const toSubUnitId = (_ref2 = (_params$toSubUnitId = params.toSubUnitId) !== null && _params$toSubUnitId !== void 0 ? _params$toSubUnitId : params.fromSubUnitId) !== null && _ref2 !== void 0 ? _ref2 : target === null || target === void 0 ? void 0 : target.subUnitId;
|
|
5140
5124
|
if (!unitId || !fromSubUnitId || !toSubUnitId) return null;
|
|
5141
5125
|
if (params.fromUnitId && params.toUnitId && params.fromUnitId !== params.toUnitId) return null;
|
|
5142
|
-
const workbook = univerInstanceService.
|
|
5126
|
+
const workbook = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
5143
5127
|
const fromWorksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(fromSubUnitId);
|
|
5144
5128
|
const toWorksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(toSubUnitId);
|
|
5145
5129
|
if (!fromWorksheet || !toWorksheet) return null;
|
|
@@ -5414,7 +5398,7 @@ function getInsertRangeMutations(accessor, params) {
|
|
|
5414
5398
|
const { unitId, subUnitId, range, shiftDimension, cellValue = {} } = params;
|
|
5415
5399
|
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
5416
5400
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
5417
|
-
const workbook = instanceService.
|
|
5401
|
+
const workbook = instanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
5418
5402
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
5419
5403
|
if (worksheet) {
|
|
5420
5404
|
const cellMatrix = worksheet.getCellMatrix();
|
|
@@ -5511,7 +5495,7 @@ function getRemoveRangeMutations(accessor, params) {
|
|
|
5511
5495
|
const { unitId, subUnitId, range, shiftDimension } = params;
|
|
5512
5496
|
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
5513
5497
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
5514
|
-
const workbook = instanceService.
|
|
5498
|
+
const workbook = instanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
5515
5499
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
5516
5500
|
if (worksheet) {
|
|
5517
5501
|
const cellMatrix = worksheet.getCellMatrix();
|
|
@@ -5774,7 +5758,7 @@ const InsertRangeMoveDownCommand = {
|
|
|
5774
5758
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
5775
5759
|
const errorService = accessor.get(_univerjs_core.ErrorService);
|
|
5776
5760
|
const localeService = accessor.get(_univerjs_core.LocaleService);
|
|
5777
|
-
if (selectionManagerService.
|
|
5761
|
+
if (hasOverlappingRanges(selectionManagerService.getCurrentSelections().map(({ range }) => range))) {
|
|
5778
5762
|
errorService.emit(localeService.t("sheets.info.overlappingSelections"));
|
|
5779
5763
|
return false;
|
|
5780
5764
|
}
|
|
@@ -5882,7 +5866,7 @@ const InsertRangeMoveRightCommand = {
|
|
|
5882
5866
|
const sheetInterceptorService = accessor.get(SheetInterceptorService);
|
|
5883
5867
|
const errorService = accessor.get(_univerjs_core.ErrorService);
|
|
5884
5868
|
const localeService = accessor.get(_univerjs_core.LocaleService);
|
|
5885
|
-
if (selectionManagerService.
|
|
5869
|
+
if (hasOverlappingRanges(selectionManagerService.getCurrentSelections().map(({ range }) => range))) {
|
|
5886
5870
|
errorService.emit(localeService.t("sheets.info.overlappingSelections"));
|
|
5887
5871
|
return false;
|
|
5888
5872
|
}
|
|
@@ -6455,10 +6439,11 @@ const RemoveRowByRangeCommand = {
|
|
|
6455
6439
|
range: visibleRange
|
|
6456
6440
|
};
|
|
6457
6441
|
const undoRemoveRowsParams = RemoveRowsUndoMutationFactory(removeRowsParams, worksheet);
|
|
6442
|
+
const removedRows = worksheet.getCellMatrix().getSlice(visibleRange.startRow, visibleRange.endRow, 0, worksheet.getColumnCount() - 1);
|
|
6458
6443
|
const undoSetRangeValuesParams = {
|
|
6459
6444
|
unitId,
|
|
6460
6445
|
subUnitId,
|
|
6461
|
-
cellValue:
|
|
6446
|
+
cellValue: removedRows.getMatrix()
|
|
6462
6447
|
};
|
|
6463
6448
|
redos.push({
|
|
6464
6449
|
id: RemoveRowMutation.id,
|
|
@@ -6475,9 +6460,10 @@ const RemoveRowByRangeCommand = {
|
|
|
6475
6460
|
redoMutations.push(...redos);
|
|
6476
6461
|
undoMutations.unshift(...undos);
|
|
6477
6462
|
});
|
|
6463
|
+
const interceptorParams = params;
|
|
6478
6464
|
const intercepted = sheetInterceptorService.onCommandExecute({
|
|
6479
6465
|
id: RemoveRowCommandId,
|
|
6480
|
-
params:
|
|
6466
|
+
params: interceptorParams
|
|
6481
6467
|
});
|
|
6482
6468
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
6483
6469
|
if ((0, _univerjs_core.sequenceExecute)([
|
|
@@ -6489,7 +6475,7 @@ const RemoveRowByRangeCommand = {
|
|
|
6489
6475
|
setSelection(range, workbook, worksheet, commandService);
|
|
6490
6476
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
6491
6477
|
id: RemoveRowCommandId,
|
|
6492
|
-
params:
|
|
6478
|
+
params: interceptorParams
|
|
6493
6479
|
});
|
|
6494
6480
|
(0, _univerjs_core.sequenceExecute)(afterInterceptors.redos, commandService);
|
|
6495
6481
|
accessor.get(_univerjs_core.IUndoRedoService).pushUndoRedo({
|
|
@@ -6535,7 +6521,11 @@ const RemoveRowCommand = {
|
|
|
6535
6521
|
};
|
|
6536
6522
|
if (!await sheetInterceptorService.beforeCommandExecute({
|
|
6537
6523
|
id: RemoveRowCommand.id,
|
|
6538
|
-
params: {
|
|
6524
|
+
params: {
|
|
6525
|
+
range,
|
|
6526
|
+
unitId,
|
|
6527
|
+
subUnitId
|
|
6528
|
+
}
|
|
6539
6529
|
})) return false;
|
|
6540
6530
|
return commandService.syncExecuteCommand(RemoveRowByRangeCommand.id, {
|
|
6541
6531
|
range,
|
|
@@ -6567,9 +6557,10 @@ const RemoveColByRangeCommand = {
|
|
|
6567
6557
|
subUnitId,
|
|
6568
6558
|
cellValue: worksheet.getCellMatrix().getSlice(0, worksheet.getRowCount() - 1, range.startColumn, range.endColumn).getMatrix()
|
|
6569
6559
|
};
|
|
6560
|
+
const interceptorParams = params;
|
|
6570
6561
|
const intercepted = sheetInterceptorService.onCommandExecute({
|
|
6571
6562
|
id: RemoveColCommandId,
|
|
6572
|
-
params:
|
|
6563
|
+
params: interceptorParams
|
|
6573
6564
|
});
|
|
6574
6565
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
6575
6566
|
if ((0, _univerjs_core.sequenceExecute)([
|
|
@@ -6584,7 +6575,7 @@ const RemoveColByRangeCommand = {
|
|
|
6584
6575
|
setSelection(range, workbook, worksheet, commandService);
|
|
6585
6576
|
const afterInterceptors = sheetInterceptorService.afterCommandExecute({
|
|
6586
6577
|
id: RemoveColCommandId,
|
|
6587
|
-
params:
|
|
6578
|
+
params: interceptorParams
|
|
6588
6579
|
});
|
|
6589
6580
|
(0, _univerjs_core.sequenceExecute)(afterInterceptors.redos, commandService);
|
|
6590
6581
|
accessor.get(_univerjs_core.IUndoRedoService).pushUndoRedo({
|
|
@@ -6631,7 +6622,7 @@ const RemoveColCommand = {
|
|
|
6631
6622
|
let range = params === null || params === void 0 ? void 0 : params.range;
|
|
6632
6623
|
if (!range) range = (_selectionManagerServ2 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ2 === void 0 ? void 0 : _selectionManagerServ2.range;
|
|
6633
6624
|
if (!range) return false;
|
|
6634
|
-
const target = getSheetCommandTarget(accessor.get(_univerjs_core.IUniverInstanceService));
|
|
6625
|
+
const target = getSheetCommandTarget(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
6635
6626
|
if (!target) return false;
|
|
6636
6627
|
const { worksheet, subUnitId, unitId } = target;
|
|
6637
6628
|
range = {
|
|
@@ -6641,7 +6632,11 @@ const RemoveColCommand = {
|
|
|
6641
6632
|
};
|
|
6642
6633
|
if (!await sheetInterceptorService.beforeCommandExecute({
|
|
6643
6634
|
id: RemoveColCommand.id,
|
|
6644
|
-
params: {
|
|
6635
|
+
params: {
|
|
6636
|
+
range,
|
|
6637
|
+
unitId,
|
|
6638
|
+
subUnitId
|
|
6639
|
+
}
|
|
6645
6640
|
})) return false;
|
|
6646
6641
|
return commandService.syncExecuteCommand(RemoveColByRangeCommand.id, {
|
|
6647
6642
|
range,
|
|
@@ -6679,7 +6674,7 @@ const RemoveSheetMutation = {
|
|
|
6679
6674
|
handler: (accessor, params) => {
|
|
6680
6675
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
6681
6676
|
const { subUnitId, unitId } = params;
|
|
6682
|
-
const workbook = univerInstanceService.
|
|
6677
|
+
const workbook = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
6683
6678
|
if (!workbook) return false;
|
|
6684
6679
|
return workbook.removeSheet(subUnitId);
|
|
6685
6680
|
}
|
|
@@ -7260,7 +7255,7 @@ const handleMoveRangeCommon = (param, targetRange) => {
|
|
|
7260
7255
|
matrix.setValue(row, col, 1);
|
|
7261
7256
|
});
|
|
7262
7257
|
const fromMatrix = new _univerjs_core.ObjectMatrix();
|
|
7263
|
-
const loopFromRange = _univerjs_core.
|
|
7258
|
+
const loopFromRange = (0, _univerjs_core.getIntersectRange)(fromRange, targetRange);
|
|
7264
7259
|
loopFromRange && _univerjs_core.Range.foreach(loopFromRange, (row, col) => {
|
|
7265
7260
|
if (matrix.getValue(row, col)) {
|
|
7266
7261
|
matrix.setValue(row, col, void 0);
|
|
@@ -7290,7 +7285,7 @@ const handleBaseRemoveRange = (_removeRange, _targetRange) => {
|
|
|
7290
7285
|
const getRowLength = (range) => range.endRow - range.startRow + 1;
|
|
7291
7286
|
if (removeRange.startRow <= targetRange.startRow && removeRange.endRow >= targetRange.endRow) {
|
|
7292
7287
|
if (targetRange.startColumn < removeRange.startColumn && targetRange.endColumn >= removeRange.startColumn && targetRange.endColumn <= removeRange.endColumn || targetRange.startColumn < removeRange.startColumn && targetRange.endColumn >= removeRange.endColumn) {
|
|
7293
|
-
const intersectedRange = _univerjs_core.
|
|
7288
|
+
const intersectedRange = (0, _univerjs_core.getIntersectRange)(targetRange, removeRange);
|
|
7294
7289
|
if (intersectedRange) return {
|
|
7295
7290
|
step: 0,
|
|
7296
7291
|
length: -getLength(intersectedRange)
|
|
@@ -7298,7 +7293,7 @@ const handleBaseRemoveRange = (_removeRange, _targetRange) => {
|
|
|
7298
7293
|
}
|
|
7299
7294
|
if (targetRange.startColumn >= removeRange.startColumn && targetRange.endColumn <= removeRange.endColumn && getRowLength(removeRange) >= getRowLength(targetRange)) return null;
|
|
7300
7295
|
if (targetRange.startColumn >= removeRange.startColumn && targetRange.startColumn <= removeRange.endColumn && targetRange.endColumn > removeRange.endColumn) {
|
|
7301
|
-
const intersectedRange = _univerjs_core.
|
|
7296
|
+
const intersectedRange = (0, _univerjs_core.getIntersectRange)(targetRange, removeRange);
|
|
7302
7297
|
if (intersectedRange) {
|
|
7303
7298
|
const length = -getLength(intersectedRange);
|
|
7304
7299
|
return {
|
|
@@ -7489,7 +7484,7 @@ const handleInsertRangeMoveDownCommon = (param, targetRange) => {
|
|
|
7489
7484
|
endRow: Number.POSITIVE_INFINITY
|
|
7490
7485
|
};
|
|
7491
7486
|
const noMoveRanges = _univerjs_core.Rectangle.subtract(targetRange, bottomRange);
|
|
7492
|
-
const targetMoveRange = _univerjs_core.
|
|
7487
|
+
const targetMoveRange = (0, _univerjs_core.getIntersectRange)(bottomRange, targetRange);
|
|
7493
7488
|
if (!targetMoveRange) return [targetRange];
|
|
7494
7489
|
const matrix = new _univerjs_core.ObjectMatrix();
|
|
7495
7490
|
noMoveRanges.forEach((noMoveRange) => {
|
|
@@ -7526,7 +7521,7 @@ const handleInsertRangeMoveRightCommon = (param, targetRange) => {
|
|
|
7526
7521
|
endColumn: Number.POSITIVE_INFINITY
|
|
7527
7522
|
};
|
|
7528
7523
|
const noMoveRanges = _univerjs_core.Rectangle.subtract(targetRange, bottomRange);
|
|
7529
|
-
const targetMoveRange = _univerjs_core.
|
|
7524
|
+
const targetMoveRange = (0, _univerjs_core.getIntersectRange)(bottomRange, targetRange);
|
|
7530
7525
|
if (!targetMoveRange) return [targetRange];
|
|
7531
7526
|
const matrix = new _univerjs_core.ObjectMatrix();
|
|
7532
7527
|
noMoveRanges.forEach((noMoveRange) => {
|
|
@@ -7567,9 +7562,9 @@ const handleDeleteRangeMoveLeftCommon = (param, targetRange) => {
|
|
|
7567
7562
|
endColumn: Number.POSITIVE_INFINITY
|
|
7568
7563
|
};
|
|
7569
7564
|
const moveCount = range.endColumn - range.startColumn + 1;
|
|
7570
|
-
const targetDeleteRange = _univerjs_core.
|
|
7565
|
+
const targetDeleteRange = (0, _univerjs_core.getIntersectRange)(range, targetRange);
|
|
7571
7566
|
const noMoveRanges = _univerjs_core.Rectangle.subtract(targetRange, rightRange);
|
|
7572
|
-
const targetMoveRange = _univerjs_core.
|
|
7567
|
+
const targetMoveRange = (0, _univerjs_core.getIntersectRange)(rightRange, targetRange);
|
|
7573
7568
|
if (!targetDeleteRange && !targetMoveRange) return [targetRange];
|
|
7574
7569
|
const matrix = new _univerjs_core.ObjectMatrix();
|
|
7575
7570
|
targetMoveRange && _univerjs_core.Range.foreach(targetMoveRange, (row, col) => {
|
|
@@ -7612,9 +7607,9 @@ const handleDeleteRangeMoveUpCommon = (param, targetRange) => {
|
|
|
7612
7607
|
endRow: Number.POSITIVE_INFINITY
|
|
7613
7608
|
};
|
|
7614
7609
|
const moveCount = range.endRow - range.startRow + 1;
|
|
7615
|
-
const targetDeleteRange = _univerjs_core.
|
|
7610
|
+
const targetDeleteRange = (0, _univerjs_core.getIntersectRange)(range, targetRange);
|
|
7616
7611
|
const noMoveRanges = _univerjs_core.Rectangle.subtract(targetRange, bottomRange);
|
|
7617
|
-
const targetMoveRange = _univerjs_core.
|
|
7612
|
+
const targetMoveRange = (0, _univerjs_core.getIntersectRange)(bottomRange, targetRange);
|
|
7618
7613
|
if (!targetDeleteRange && !targetMoveRange) return [targetRange];
|
|
7619
7614
|
const matrix = new _univerjs_core.ObjectMatrix();
|
|
7620
7615
|
targetMoveRange && _univerjs_core.Range.foreach(targetMoveRange, (row, col) => {
|
|
@@ -8092,7 +8087,7 @@ function getSeparateEffectedRangesOnCommand(accessor, command) {
|
|
|
8092
8087
|
}
|
|
8093
8088
|
case EffectRefRangId.RemoveRowCommandId: {
|
|
8094
8089
|
const params = command.params;
|
|
8095
|
-
const target = getSheetCommandTarget(univerInstanceService);
|
|
8090
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
8096
8091
|
if (!target) return;
|
|
8097
8092
|
const { worksheet, unitId, subUnitId } = target;
|
|
8098
8093
|
const { range } = params;
|
|
@@ -8108,7 +8103,7 @@ function getSeparateEffectedRangesOnCommand(accessor, command) {
|
|
|
8108
8103
|
}
|
|
8109
8104
|
case EffectRefRangId.RemoveColCommandId: {
|
|
8110
8105
|
const params = command.params;
|
|
8111
|
-
const target = getSheetCommandTarget(univerInstanceService);
|
|
8106
|
+
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
8112
8107
|
if (!target) return;
|
|
8113
8108
|
const { worksheet, unitId, subUnitId } = target;
|
|
8114
8109
|
const { range } = params;
|
|
@@ -8301,7 +8296,7 @@ let RefRangeService = class RefRangeService extends _univerjs_core.Disposable {
|
|
|
8301
8296
|
}
|
|
8302
8297
|
case EffectRefRangId.RemoveRowCommandId: {
|
|
8303
8298
|
const params = command.params;
|
|
8304
|
-
const target = getSheetCommandTarget(this._univerInstanceService);
|
|
8299
|
+
const target = getSheetCommandTarget(this._univerInstanceService, params);
|
|
8305
8300
|
if (!target) return [];
|
|
8306
8301
|
const { worksheet, unitId, subUnitId } = target;
|
|
8307
8302
|
const effectRange = {
|
|
@@ -8315,7 +8310,7 @@ let RefRangeService = class RefRangeService extends _univerjs_core.Disposable {
|
|
|
8315
8310
|
}
|
|
8316
8311
|
case EffectRefRangId.RemoveColCommandId: {
|
|
8317
8312
|
const params = command.params;
|
|
8318
|
-
const target = getSheetCommandTarget(this._univerInstanceService);
|
|
8313
|
+
const target = getSheetCommandTarget(this._univerInstanceService, params);
|
|
8319
8314
|
if (!target) return [];
|
|
8320
8315
|
const { worksheet, unitId, subUnitId } = target;
|
|
8321
8316
|
const effectRange = {
|
|
@@ -8744,7 +8739,7 @@ let MergeCellController = class MergeCellController extends _univerjs_core.Dispo
|
|
|
8744
8739
|
}
|
|
8745
8740
|
_onRefRangeChange() {
|
|
8746
8741
|
const registerRefRange = (unitId, subUnitId) => {
|
|
8747
|
-
const workbook = this._univerInstanceService.
|
|
8742
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
8748
8743
|
if (!workbook) return;
|
|
8749
8744
|
const workSheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
8750
8745
|
if (!workSheet) return;
|
|
@@ -9444,7 +9439,7 @@ let MergeCellController = class MergeCellController extends _univerjs_core.Dispo
|
|
|
9444
9439
|
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
9445
9440
|
if (mutationIdArrByMove$1.includes(command.id)) {
|
|
9446
9441
|
if (!command.params) return;
|
|
9447
|
-
const workbook = this._univerInstanceService.
|
|
9442
|
+
const workbook = this._univerInstanceService.getUnit(command.params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
9448
9443
|
if (!workbook) return;
|
|
9449
9444
|
const worksheet = workbook.getSheetBySheetId(command.params.subUnitId);
|
|
9450
9445
|
if (!worksheet) return;
|
|
@@ -9493,7 +9488,7 @@ let MergeCellController = class MergeCellController extends _univerjs_core.Dispo
|
|
|
9493
9488
|
});
|
|
9494
9489
|
}
|
|
9495
9490
|
if (mutationIdByRowCol$1.includes(command.id)) {
|
|
9496
|
-
const workbook = this._univerInstanceService.
|
|
9491
|
+
const workbook = this._univerInstanceService.getUnit(command.params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
9497
9492
|
if (!workbook) return;
|
|
9498
9493
|
const worksheet = workbook.getSheetBySheetId(command.params.subUnitId);
|
|
9499
9494
|
if (!worksheet) return;
|
|
@@ -9558,7 +9553,7 @@ MergeCellController = __decorate([
|
|
|
9558
9553
|
__decorateParam(5, (0, _univerjs_core.Inject)(SheetsSelectionsService))
|
|
9559
9554
|
], MergeCellController);
|
|
9560
9555
|
function getWorkbook(univerInstanceService, unitId) {
|
|
9561
|
-
if (unitId) return univerInstanceService.
|
|
9556
|
+
if (unitId) return univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
9562
9557
|
return univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
9563
9558
|
}
|
|
9564
9559
|
function getWorksheet(workbook, subUnitId) {
|
|
@@ -9774,10 +9769,11 @@ function getClearContentMutationParamsForRanges(accessor, unitId, worksheet, ran
|
|
|
9774
9769
|
const redos = [];
|
|
9775
9770
|
const subUnitId = worksheet.getSheetId();
|
|
9776
9771
|
ranges.forEach((range) => {
|
|
9772
|
+
const redoMatrix = getClearContentMutationParamForRange(worksheet, range);
|
|
9777
9773
|
const redoMutationParams = {
|
|
9778
9774
|
unitId,
|
|
9779
9775
|
subUnitId,
|
|
9780
|
-
cellValue:
|
|
9776
|
+
cellValue: redoMatrix.clone()
|
|
9781
9777
|
};
|
|
9782
9778
|
const undoMutationParams = SetRangeValuesUndoMutationFactory(accessor, redoMutationParams);
|
|
9783
9779
|
undos.push({
|
|
@@ -11565,7 +11561,8 @@ const AutoFillRules = {
|
|
|
11565
11561
|
const dataNumArr = [];
|
|
11566
11562
|
for (let i = 0; i < data.length; i++) {
|
|
11567
11563
|
var _data$i;
|
|
11568
|
-
const
|
|
11564
|
+
const txt = `${(_data$i = data[i]) === null || _data$i === void 0 ? void 0 : _data$i.v}`;
|
|
11565
|
+
const matchResult = matchExtendNumber(txt);
|
|
11569
11566
|
if (matchResult.isExtendNumber) dataNumArr.push(matchResult.matchNumber);
|
|
11570
11567
|
}
|
|
11571
11568
|
if (isReverse) {
|
|
@@ -11631,9 +11628,11 @@ const AutoFillRules = {
|
|
|
11631
11628
|
if (isEqualDiff(dataNumArr)) {
|
|
11632
11629
|
if (hasWeek || dataNumArr[dataNumArr.length - 1] < 6 && dataNumArr[0] > 0 || dataNumArr[0] < 6 && dataNumArr[dataNumArr.length - 1] > 0) {
|
|
11633
11630
|
const dataLen = data.length;
|
|
11634
|
-
|
|
11631
|
+
const step = dataNumArr[dataLen - 1] - dataNumArr[dataLen - 2];
|
|
11632
|
+
return reverseIfNeed(fillChnWeek(data, len, step), isReverse);
|
|
11635
11633
|
}
|
|
11636
|
-
|
|
11634
|
+
const step = dataNumArr[1] - dataNumArr[0];
|
|
11635
|
+
return reverseIfNeed(fillChnNumber(data, len, step), isReverse);
|
|
11637
11636
|
}
|
|
11638
11637
|
return fillCopy$1(data, len);
|
|
11639
11638
|
} }
|
|
@@ -11674,7 +11673,8 @@ const AutoFillRules = {
|
|
|
11674
11673
|
}
|
|
11675
11674
|
if (isEqualDiff(dataNumArr)) {
|
|
11676
11675
|
const dataLen = data.length;
|
|
11677
|
-
|
|
11676
|
+
const step = dataNumArr[dataLen - 1] - dataNumArr[dataLen - 2];
|
|
11677
|
+
return reverseIfNeed(fillChnWeek(data, len, step, 1), isReverse);
|
|
11678
11678
|
}
|
|
11679
11679
|
return fillCopy$1(data, len);
|
|
11680
11680
|
} }
|
|
@@ -11714,7 +11714,8 @@ const AutoFillRules = {
|
|
|
11714
11714
|
}
|
|
11715
11715
|
if (isEqualDiff(dataNumArr)) {
|
|
11716
11716
|
const dataLen = data.length;
|
|
11717
|
-
|
|
11717
|
+
const step = dataNumArr[dataLen - 1] - dataNumArr[dataLen - 2];
|
|
11718
|
+
return reverseIfNeed(fillChnWeek(data, len, step, 2), isReverse);
|
|
11718
11719
|
}
|
|
11719
11720
|
return fillCopy$1(data, len);
|
|
11720
11721
|
} }
|
|
@@ -11759,7 +11760,8 @@ const AutoFillRules = {
|
|
|
11759
11760
|
}
|
|
11760
11761
|
if (isEqualDiff(dataNumArr)) {
|
|
11761
11762
|
const dataLen = data.length;
|
|
11762
|
-
|
|
11763
|
+
const step = dataNumArr[dataLen - 1] - dataNumArr[dataLen - 2];
|
|
11764
|
+
return reverseIfNeed(fillLoopSeries(data, len, step, series), isReverse);
|
|
11763
11765
|
}
|
|
11764
11766
|
return fillCopy$1(data, len);
|
|
11765
11767
|
} }
|
|
@@ -11847,6 +11849,8 @@ let AutoFillService = class AutoFillService extends _univerjs_core.Disposable {
|
|
|
11847
11849
|
var _this$menu$find;
|
|
11848
11850
|
if (source.startColumn === selection.startColumn && source.startRow === selection.startRow && source.endColumn === selection.endColumn && source.endRow === selection.endRow) return false;
|
|
11849
11851
|
if (selection.endColumn < source.endColumn && selection.endColumn > source.startColumn) return this._commandService.executeCommand(AutoClearContentCommand.id, {
|
|
11852
|
+
unitId,
|
|
11853
|
+
subUnitId,
|
|
11850
11854
|
clearRange: {
|
|
11851
11855
|
startRow: selection.startRow,
|
|
11852
11856
|
endRow: selection.endRow,
|
|
@@ -11856,6 +11860,8 @@ let AutoFillService = class AutoFillService extends _univerjs_core.Disposable {
|
|
|
11856
11860
|
selectionRange: selection
|
|
11857
11861
|
});
|
|
11858
11862
|
if (selection.endRow < source.endRow && selection.endRow > source.startRow) return this._commandService.executeCommand(AutoClearContentCommand.id, {
|
|
11863
|
+
unitId,
|
|
11864
|
+
subUnitId,
|
|
11859
11865
|
clearRange: {
|
|
11860
11866
|
startRow: selection.endRow + 1,
|
|
11861
11867
|
endRow: source.endRow,
|
|
@@ -11885,8 +11891,8 @@ let AutoFillService = class AutoFillService extends _univerjs_core.Disposable {
|
|
|
11885
11891
|
target.startColumn = source.endColumn + 1;
|
|
11886
11892
|
} else return false;
|
|
11887
11893
|
this.direction = direction;
|
|
11888
|
-
const autoFillSource = this._injector.invoke((accessor) => rangeToDiscreteRange(source, accessor));
|
|
11889
|
-
const autoFillTarget = this._injector.invoke((accessor) => rangeToDiscreteRange(target, accessor));
|
|
11894
|
+
const autoFillSource = this._injector.invoke((accessor) => rangeToDiscreteRange(source, accessor, unitId, subUnitId));
|
|
11895
|
+
const autoFillTarget = this._injector.invoke((accessor) => rangeToDiscreteRange(target, accessor, unitId, subUnitId));
|
|
11890
11896
|
if (!autoFillSource || !autoFillTarget) return false;
|
|
11891
11897
|
this.autoFillLocation = {
|
|
11892
11898
|
source: autoFillSource,
|
|
@@ -12242,7 +12248,7 @@ const AutoClearContentCommand = {
|
|
|
12242
12248
|
id: "sheet.command.auto-clear-content",
|
|
12243
12249
|
type: _univerjs_core.CommandType.COMMAND,
|
|
12244
12250
|
handler: async (accessor, params) => {
|
|
12245
|
-
const target = getSheetCommandTarget(accessor.get(_univerjs_core.IUniverInstanceService));
|
|
12251
|
+
const target = getSheetCommandTarget(accessor.get(_univerjs_core.IUniverInstanceService), params);
|
|
12246
12252
|
if (!target) return false;
|
|
12247
12253
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
12248
12254
|
const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
|
|
@@ -12547,7 +12553,7 @@ const InsertSheetMutation = {
|
|
|
12547
12553
|
handler: (accessor, params) => {
|
|
12548
12554
|
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
12549
12555
|
const { sheet, index, unitId, styles } = params;
|
|
12550
|
-
const workbook = univerInstanceService.
|
|
12556
|
+
const workbook = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
12551
12557
|
if (!workbook) return false;
|
|
12552
12558
|
if (styles) workbook.addStyles(styles);
|
|
12553
12559
|
return workbook.addWorksheet(sheet.id, index, (0, _univerjs_core.cloneWorksheetData)(sheet));
|
|
@@ -13458,7 +13464,7 @@ const SetBorderCommand = {
|
|
|
13458
13464
|
const setRangeValuesMutationParams = {
|
|
13459
13465
|
unitId,
|
|
13460
13466
|
subUnitId,
|
|
13461
|
-
cellValue: mr.
|
|
13467
|
+
cellValue: mr.clone()
|
|
13462
13468
|
};
|
|
13463
13469
|
const undoSetRangeValuesMutationParams = SetRangeValuesUndoMutationFactory(accessor, setRangeValuesMutationParams);
|
|
13464
13470
|
if (commandService.syncExecuteCommand(SetRangeValuesMutation.id, setRangeValuesMutationParams)) {
|
|
@@ -13905,7 +13911,7 @@ const SetDefinedNameCommand = {
|
|
|
13905
13911
|
//#endregion
|
|
13906
13912
|
//#region src/commands/mutations/set-frozen.mutation.ts
|
|
13907
13913
|
const SetFrozenMutationFactory = (accessor, params) => {
|
|
13908
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
13914
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
13909
13915
|
if (universheet == null) throw new Error("universheet is null error!");
|
|
13910
13916
|
const worksheet = universheet.getSheetBySheetId(params.subUnitId);
|
|
13911
13917
|
if (worksheet == null) throw new Error("worksheet is null error!");
|
|
@@ -13920,7 +13926,7 @@ const SetFrozenMutation = {
|
|
|
13920
13926
|
id: "sheet.mutation.set-frozen",
|
|
13921
13927
|
type: _univerjs_core.CommandType.MUTATION,
|
|
13922
13928
|
handler: (accessor, params) => {
|
|
13923
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
13929
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
13924
13930
|
if (universheet == null) throw new Error("universheet is null error!");
|
|
13925
13931
|
const worksheet = universheet.getSheetBySheetId(params.subUnitId);
|
|
13926
13932
|
if (!worksheet) return false;
|
|
@@ -14580,7 +14586,7 @@ function mergeSelections(ranges) {
|
|
|
14580
14586
|
//#endregion
|
|
14581
14587
|
//#region src/commands/mutations/set-tab-color.mutation.ts
|
|
14582
14588
|
const SetTabColorUndoMutationFactory = (accessor, params) => {
|
|
14583
|
-
const oldTabColor = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
14589
|
+
const oldTabColor = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET).getSheetBySheetId(params.subUnitId).getConfig().tabColor;
|
|
14584
14590
|
return {
|
|
14585
14591
|
..._univerjs_core.Tools.deepClone(params),
|
|
14586
14592
|
color: oldTabColor
|
|
@@ -14590,7 +14596,7 @@ const SetTabColorMutation = {
|
|
|
14590
14596
|
id: "sheet.mutation.set-tab-color",
|
|
14591
14597
|
type: _univerjs_core.CommandType.MUTATION,
|
|
14592
14598
|
handler: (accessor, params) => {
|
|
14593
|
-
const workbook = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
14599
|
+
const workbook = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
14594
14600
|
if (!workbook) return false;
|
|
14595
14601
|
const worksheet = workbook.getSheetBySheetId(params.subUnitId);
|
|
14596
14602
|
if (!worksheet) return false;
|
|
@@ -14995,7 +15001,7 @@ const SetWorksheetHideMutation = {
|
|
|
14995
15001
|
id: "sheet.mutation.set-worksheet-hidden",
|
|
14996
15002
|
type: _univerjs_core.CommandType.MUTATION,
|
|
14997
15003
|
handler: (accessor, params) => {
|
|
14998
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
15004
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
14999
15005
|
if (universheet == null) return false;
|
|
15000
15006
|
const worksheet = universheet.getSheetBySheetId(params.subUnitId);
|
|
15001
15007
|
if (!worksheet) return false;
|
|
@@ -15062,7 +15068,7 @@ const SetWorksheetNameMutation = {
|
|
|
15062
15068
|
id: "sheet.mutation.set-worksheet-name",
|
|
15063
15069
|
type: _univerjs_core.CommandType.MUTATION,
|
|
15064
15070
|
handler: (accessor, params) => {
|
|
15065
|
-
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
15071
|
+
const universheet = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
15066
15072
|
if (universheet == null) return false;
|
|
15067
15073
|
const worksheet = universheet.getSheetBySheetId(params.subUnitId);
|
|
15068
15074
|
if (!worksheet) return false;
|
|
@@ -15138,7 +15144,7 @@ const SetWorksheetOrderMutation = {
|
|
|
15138
15144
|
id: "sheet.mutation.set-worksheet-order",
|
|
15139
15145
|
type: _univerjs_core.CommandType.MUTATION,
|
|
15140
15146
|
handler: (accessor, params) => {
|
|
15141
|
-
const workbook = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
15147
|
+
const workbook = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
15142
15148
|
if (!workbook) return false;
|
|
15143
15149
|
const config = workbook.getConfig();
|
|
15144
15150
|
config.sheetOrder.splice(params.fromOrder, 1);
|
|
@@ -16375,7 +16381,7 @@ const SetWorksheetProtectionCommand = {
|
|
|
16375
16381
|
//#endregion
|
|
16376
16382
|
//#region src/commands/mutations/set-worksheet-right-to-left.mutation.ts
|
|
16377
16383
|
const SetWorksheetRightToLeftUndoMutationFactory = (accessor, params) => {
|
|
16378
|
-
const oldState = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
16384
|
+
const oldState = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET).getSheetBySheetId(params.subUnitId).getConfig().rightToLeft;
|
|
16379
16385
|
return {
|
|
16380
16386
|
..._univerjs_core.Tools.deepClone(params),
|
|
16381
16387
|
rightToLeft: oldState
|
|
@@ -16385,7 +16391,7 @@ const SetWorksheetRightToLeftMutation = {
|
|
|
16385
16391
|
id: "sheet.mutation.set-worksheet-right-to-left",
|
|
16386
16392
|
type: _univerjs_core.CommandType.MUTATION,
|
|
16387
16393
|
handler: (accessor, params) => {
|
|
16388
|
-
const workbook = accessor.get(_univerjs_core.IUniverInstanceService).
|
|
16394
|
+
const workbook = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
16389
16395
|
if (!workbook) return false;
|
|
16390
16396
|
const worksheet = workbook.getSheetBySheetId(params.subUnitId);
|
|
16391
16397
|
if (!worksheet) return false;
|
|
@@ -17603,7 +17609,7 @@ let AutoFillController = class AutoFillController extends _univerjs_core.Disposa
|
|
|
17603
17609
|
if (hasStyle) {
|
|
17604
17610
|
var _this$_univerInstance5;
|
|
17605
17611
|
const deleteMergeRanges = [];
|
|
17606
|
-
const mergeData = (_this$_univerInstance5 = this._univerInstanceService.
|
|
17612
|
+
const mergeData = (_this$_univerInstance5 = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance5 === void 0 || (_this$_univerInstance5 = _this$_univerInstance5.getSheetBySheetId(subUnitId)) === null || _this$_univerInstance5 === void 0 ? void 0 : _this$_univerInstance5.getMergeData();
|
|
17607
17613
|
if (mergeData) mergeData.forEach((merge) => {
|
|
17608
17614
|
if (_univerjs_core.Rectangle.intersects(merge, targetRange)) deleteMergeRanges.push(merge);
|
|
17609
17615
|
});
|
|
@@ -17720,7 +17726,7 @@ let CalculateResultApplyController = class CalculateResultApplyController extend
|
|
|
17720
17726
|
const redoMutationsInfo = [];
|
|
17721
17727
|
for (let i = 0; i < unitIds.length; i++) {
|
|
17722
17728
|
const unitId = unitIds[i];
|
|
17723
|
-
const workbook = this._univerInstanceService.
|
|
17729
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
17724
17730
|
if (!workbook) continue;
|
|
17725
17731
|
const sheetData = unitData[unitId];
|
|
17726
17732
|
if (sheetData == null) continue;
|
|
@@ -17756,7 +17762,7 @@ let CalculateResultApplyController = class CalculateResultApplyController extend
|
|
|
17756
17762
|
* @returns
|
|
17757
17763
|
*/
|
|
17758
17764
|
_getMergedCellData(unitId, sheetId, cellData) {
|
|
17759
|
-
const workbook = this._univerInstanceService.
|
|
17765
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
17760
17766
|
const styles = workbook === null || workbook === void 0 ? void 0 : workbook.getStyles();
|
|
17761
17767
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(sheetId);
|
|
17762
17768
|
const oldCellDataMatrix = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getCellMatrix();
|
|
@@ -19030,15 +19036,16 @@ ZebraCrossingCacheController = __decorate([
|
|
|
19030
19036
|
|
|
19031
19037
|
//#endregion
|
|
19032
19038
|
//#region src/models/range-protection-render.model.ts
|
|
19033
|
-
let RangeProtectionRenderModel = class RangeProtectionRenderModel {
|
|
19039
|
+
let RangeProtectionRenderModel = class RangeProtectionRenderModel extends _univerjs_core.Disposable {
|
|
19034
19040
|
constructor(_selectionProtectionRuleModel, _permissionService) {
|
|
19041
|
+
super();
|
|
19035
19042
|
this._selectionProtectionRuleModel = _selectionProtectionRuleModel;
|
|
19036
19043
|
this._permissionService = _permissionService;
|
|
19037
19044
|
_defineProperty(this, "_cache", new _univerjs_core.LRUMap(1e4));
|
|
19038
19045
|
this._init();
|
|
19039
19046
|
}
|
|
19040
19047
|
_init() {
|
|
19041
|
-
this._permissionService.permissionPointUpdate$.pipe((0, rxjs_operators.filter)((permission) => permission.type === _univerjs_protocol.UnitObject.SelectRange), (0, rxjs_operators.filter)((permission) => getAllRangePermissionPoint().some((F) => permission instanceof F)), (0, rxjs_operators.map)((permission) => permission)).subscribe((permission) => {
|
|
19048
|
+
this.disposeWithMe(this._permissionService.permissionPointUpdate$.pipe((0, rxjs_operators.filter)((permission) => permission.type === _univerjs_protocol.UnitObject.SelectRange), (0, rxjs_operators.filter)((permission) => getAllRangePermissionPoint().some((F) => permission instanceof F)), (0, rxjs_operators.map)((permission) => permission)).subscribe((permission) => {
|
|
19042
19049
|
const ruleMap = this._selectionProtectionRuleModel.getSubunitRuleList(permission.unitId, permission.subUnitId);
|
|
19043
19050
|
for (const rule of ruleMap) if (rule.permissionId === permission.permissionId) rule.ranges.forEach((range) => {
|
|
19044
19051
|
_univerjs_core.Range.foreach(range, (row, col) => {
|
|
@@ -19046,8 +19053,8 @@ let RangeProtectionRenderModel = class RangeProtectionRenderModel {
|
|
|
19046
19053
|
this._cache.delete(key);
|
|
19047
19054
|
});
|
|
19048
19055
|
});
|
|
19049
|
-
});
|
|
19050
|
-
this._selectionProtectionRuleModel.ruleChange$.subscribe((info) => {
|
|
19056
|
+
}));
|
|
19057
|
+
this.disposeWithMe(this._selectionProtectionRuleModel.ruleChange$.subscribe((info) => {
|
|
19051
19058
|
info.rule.ranges.forEach((range) => {
|
|
19052
19059
|
_univerjs_core.Range.foreach(range, (row, col) => {
|
|
19053
19060
|
const key = this._createKey(info.unitId, info.subUnitId, row, col);
|
|
@@ -19063,7 +19070,7 @@ let RangeProtectionRenderModel = class RangeProtectionRenderModel {
|
|
|
19063
19070
|
});
|
|
19064
19071
|
});
|
|
19065
19072
|
}
|
|
19066
|
-
});
|
|
19073
|
+
}));
|
|
19067
19074
|
}
|
|
19068
19075
|
_createKey(unitId, subUnitId, row, col) {
|
|
19069
19076
|
return `${unitId}_${subUnitId}_${row}_${col}`;
|
|
@@ -19096,6 +19103,10 @@ let RangeProtectionRenderModel = class RangeProtectionRenderModel {
|
|
|
19096
19103
|
clear() {
|
|
19097
19104
|
this._cache.clear();
|
|
19098
19105
|
}
|
|
19106
|
+
dispose() {
|
|
19107
|
+
super.dispose();
|
|
19108
|
+
this._cache.clear();
|
|
19109
|
+
}
|
|
19099
19110
|
};
|
|
19100
19111
|
RangeProtectionRenderModel = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(RangeProtectionRuleModel)), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.IPermissionService))], RangeProtectionRenderModel);
|
|
19101
19112
|
|
|
@@ -19385,7 +19396,7 @@ RangeProtectionCache = __decorate([
|
|
|
19385
19396
|
//#endregion
|
|
19386
19397
|
//#region package.json
|
|
19387
19398
|
var name = "@univerjs/sheets";
|
|
19388
|
-
var version = "1.0.0-alpha.
|
|
19399
|
+
var version = "1.0.0-alpha.8";
|
|
19389
19400
|
|
|
19390
19401
|
//#endregion
|
|
19391
19402
|
//#region src/controllers/active-worksheet.controller.ts
|
|
@@ -19410,7 +19421,7 @@ let ActiveWorksheetController = class ActiveWorksheetController extends _univerj
|
|
|
19410
19421
|
_adjustActiveSheetOnHideSheet(mutation) {
|
|
19411
19422
|
var _workbook$getActiveSh;
|
|
19412
19423
|
const { unitId, subUnitId } = mutation.params;
|
|
19413
|
-
const workbook = this._univerInstanceService.
|
|
19424
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
19414
19425
|
if (!workbook) return;
|
|
19415
19426
|
if (((_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getSheetId()) !== subUnitId) return;
|
|
19416
19427
|
const nextId = findTheNextUnhiddenSheet(workbook, workbook.getActiveSheetIndex());
|
|
@@ -19418,7 +19429,7 @@ let ActiveWorksheetController = class ActiveWorksheetController extends _univerj
|
|
|
19418
19429
|
}
|
|
19419
19430
|
_beforeAdjustActiveSheetOnRemoveSheet(mutation) {
|
|
19420
19431
|
const { unitId, subUnitId } = mutation.params;
|
|
19421
|
-
const workbook = this._univerInstanceService.
|
|
19432
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
19422
19433
|
if (!workbook) return;
|
|
19423
19434
|
const worksheet = workbook.getSheetBySheetId(subUnitId);
|
|
19424
19435
|
if (!worksheet) return;
|
|
@@ -19427,7 +19438,7 @@ let ActiveWorksheetController = class ActiveWorksheetController extends _univerj
|
|
|
19427
19438
|
_adjustActiveSheetOnRemoveSheet(mutation) {
|
|
19428
19439
|
if (this._previousSheetIndex === -1) return;
|
|
19429
19440
|
const { unitId } = mutation.params;
|
|
19430
|
-
const workbook = this._univerInstanceService.
|
|
19441
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
19431
19442
|
if (!workbook) return;
|
|
19432
19443
|
if (workbook.getActiveSheet().getSheetId() === mutation.params.subUnitId) {
|
|
19433
19444
|
const previousIndex = this._previousSheetIndex;
|
|
@@ -19894,7 +19905,7 @@ let NumfmtService = class NumfmtService extends _univerjs_core.Disposable {
|
|
|
19894
19905
|
this._logService = _logService;
|
|
19895
19906
|
}
|
|
19896
19907
|
getValue(unitId, subUnitId, row, col) {
|
|
19897
|
-
const workbook = this._univerInstanceService.
|
|
19908
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
19898
19909
|
if (!workbook) return;
|
|
19899
19910
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
19900
19911
|
if (!worksheet) return;
|
|
@@ -19907,7 +19918,7 @@ let NumfmtService = class NumfmtService extends _univerjs_core.Disposable {
|
|
|
19907
19918
|
return null;
|
|
19908
19919
|
}
|
|
19909
19920
|
deleteValues(unitId, subUnitId, values) {
|
|
19910
|
-
const workbook = this._univerInstanceService.
|
|
19921
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
19911
19922
|
if (!workbook) return;
|
|
19912
19923
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
19913
19924
|
if (!worksheet) return;
|
|
@@ -19924,7 +19935,7 @@ let NumfmtService = class NumfmtService extends _univerjs_core.Disposable {
|
|
|
19924
19935
|
});
|
|
19925
19936
|
}
|
|
19926
19937
|
setValues(unitId, subUnitId, values) {
|
|
19927
|
-
const workbook = this._univerInstanceService.
|
|
19938
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
19928
19939
|
if (!workbook) return;
|
|
19929
19940
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
19930
19941
|
if (!worksheet) return;
|
|
@@ -20440,7 +20451,7 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
|
|
|
20440
20451
|
this._selectionProtectionRenderModel.clear();
|
|
20441
20452
|
}
|
|
20442
20453
|
if (mutationIdByRowCol.includes(command.id)) {
|
|
20443
|
-
const workbook = this._univerInstanceService.
|
|
20454
|
+
const workbook = this._univerInstanceService.getUnit(command.params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
20444
20455
|
if (!workbook) return;
|
|
20445
20456
|
const worksheet = workbook.getSheetBySheetId(command.params.subUnitId);
|
|
20446
20457
|
if (!worksheet) return;
|
|
@@ -21036,11 +21047,14 @@ const getPrimaryCellUp = (scopeRange, worksheet, currentPrimary, step = 1, isFin
|
|
|
21036
21047
|
startRow: next,
|
|
21037
21048
|
endRow: next
|
|
21038
21049
|
};
|
|
21039
|
-
else if (isGoBack)
|
|
21040
|
-
|
|
21041
|
-
|
|
21042
|
-
|
|
21043
|
-
|
|
21050
|
+
else if (isGoBack) {
|
|
21051
|
+
const newPrimary = {
|
|
21052
|
+
...currentPrimary,
|
|
21053
|
+
startRow: endRow,
|
|
21054
|
+
endRow
|
|
21055
|
+
};
|
|
21056
|
+
return getPrimaryCellLeft(scopeRange, worksheet, newPrimary, step, isFindNext, false);
|
|
21057
|
+
}
|
|
21044
21058
|
};
|
|
21045
21059
|
const getPrimaryCellDown = (scopeRange, worksheet, currentPrimary, step = 1, isFindNext = true, isGoBack = true) => {
|
|
21046
21060
|
const { startRow, endRow } = _univerjs_core.Range.transformRange(scopeRange, worksheet);
|
|
@@ -21057,11 +21071,14 @@ const getPrimaryCellDown = (scopeRange, worksheet, currentPrimary, step = 1, isF
|
|
|
21057
21071
|
startRow: next,
|
|
21058
21072
|
endRow: next
|
|
21059
21073
|
};
|
|
21060
|
-
else if (isGoBack)
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21074
|
+
else if (isGoBack) {
|
|
21075
|
+
const newPrimary = {
|
|
21076
|
+
...currentPrimary,
|
|
21077
|
+
startRow,
|
|
21078
|
+
endRow: startRow
|
|
21079
|
+
};
|
|
21080
|
+
return getPrimaryCellRight(scopeRange, worksheet, newPrimary, step, isFindNext, false);
|
|
21081
|
+
}
|
|
21065
21082
|
};
|
|
21066
21083
|
const getPrimaryCellLeft = (scopeRange, worksheet, currentPrimary, step = 1, isFindNext = true, isGoBack = true) => {
|
|
21067
21084
|
const { startColumn, endColumn } = _univerjs_core.Range.transformRange(scopeRange, worksheet);
|
|
@@ -21078,11 +21095,14 @@ const getPrimaryCellLeft = (scopeRange, worksheet, currentPrimary, step = 1, isF
|
|
|
21078
21095
|
startColumn: next,
|
|
21079
21096
|
endColumn: next
|
|
21080
21097
|
};
|
|
21081
|
-
else if (isGoBack)
|
|
21082
|
-
|
|
21083
|
-
|
|
21084
|
-
|
|
21085
|
-
|
|
21098
|
+
else if (isGoBack) {
|
|
21099
|
+
const newPrimary = {
|
|
21100
|
+
...currentPrimary,
|
|
21101
|
+
startColumn: endColumn,
|
|
21102
|
+
endColumn
|
|
21103
|
+
};
|
|
21104
|
+
return getPrimaryCellUp(scopeRange, worksheet, newPrimary, step, isFindNext, false);
|
|
21105
|
+
}
|
|
21086
21106
|
};
|
|
21087
21107
|
const getPrimaryCellRight = (scopeRange, worksheet, currentPrimary, step = 1, isFindNext = true, isGoBack = true) => {
|
|
21088
21108
|
const { startColumn, endColumn } = _univerjs_core.Range.transformRange(scopeRange, worksheet);
|
|
@@ -21099,11 +21119,14 @@ const getPrimaryCellRight = (scopeRange, worksheet, currentPrimary, step = 1, is
|
|
|
21099
21119
|
endColumn: next,
|
|
21100
21120
|
startColumn: next
|
|
21101
21121
|
};
|
|
21102
|
-
else if (isGoBack)
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
|
|
21106
|
-
|
|
21122
|
+
else if (isGoBack) {
|
|
21123
|
+
const newPrimary = {
|
|
21124
|
+
...currentPrimary,
|
|
21125
|
+
startColumn,
|
|
21126
|
+
endColumn: startColumn
|
|
21127
|
+
};
|
|
21128
|
+
return getPrimaryCellDown(scopeRange, worksheet, newPrimary, step, isFindNext, false);
|
|
21129
|
+
}
|
|
21107
21130
|
};
|
|
21108
21131
|
function getCellAtRowCol$1(row, col, worksheet) {
|
|
21109
21132
|
let destRange = null;
|