@univerjs/sheets-formula 1.0.0-alpha.7 → 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 +3 -31
- package/lib/cjs/index.js +34 -48
- package/lib/es/facade.js +2 -30
- package/lib/es/index.js +30 -44
- package/lib/facade.js +2 -30
- package/lib/index.js +30 -44
- package/lib/types/controllers/defined-name.controller.d.ts +1 -2
- package/lib/types/controllers/sheet-formula-calculation-result-apply.controller.d.ts +1 -1
- package/lib/types/controllers/super-table.controller.d.ts +1 -2
- package/lib/types/controllers/trigger-calculation.controller.d.ts +2 -3
- package/lib/types/facade/f-formula.d.ts +1 -2
- package/lib/types/facade/index.d.ts +0 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +8 -9
- package/lib/types/facade/f-univer.d.ts +0 -49
package/lib/cjs/facade.js
CHANGED
|
@@ -1,38 +1,10 @@
|
|
|
1
1
|
let _univerjs_core = require("@univerjs/core");
|
|
2
|
-
let _univerjs_core_facade = require("@univerjs/core/facade");
|
|
3
2
|
let _univerjs_engine_formula = require("@univerjs/engine-formula");
|
|
4
|
-
let _univerjs_formula = require("@univerjs/formula");
|
|
5
|
-
require("@univerjs/formula/facade");
|
|
6
3
|
let _univerjs_engine_formula_facade = require("@univerjs/engine-formula/facade");
|
|
7
4
|
let _univerjs_sheets_formula = require("@univerjs/sheets-formula");
|
|
5
|
+
let _univerjs_core_facade = require("@univerjs/core/facade");
|
|
8
6
|
let _univerjs_sheets_facade = require("@univerjs/sheets/facade");
|
|
9
7
|
|
|
10
|
-
//#region src/facade/f-univer.ts
|
|
11
|
-
/**
|
|
12
|
-
* @ignore
|
|
13
|
-
*/
|
|
14
|
-
var FUniverSheetsFormulaMixin = class extends _univerjs_core_facade.FUniver {
|
|
15
|
-
/**
|
|
16
|
-
* Initialize the FUniver instance.
|
|
17
|
-
* @ignore
|
|
18
|
-
*/
|
|
19
|
-
_initialize() {
|
|
20
|
-
this._debouncedFormulaCalculation = (0, _univerjs_core.debounce)(() => {
|
|
21
|
-
this._commandService.executeCommand(_univerjs_engine_formula.SetTriggerFormulaCalculationStartMutation.id, {
|
|
22
|
-
commands: [],
|
|
23
|
-
forceCalculation: true
|
|
24
|
-
}, { onlyLocal: true });
|
|
25
|
-
}, 10);
|
|
26
|
-
}
|
|
27
|
-
registerFunction(config) {
|
|
28
|
-
const functionsDisposable = this._injector.get(_univerjs_formula.IRegisterFunctionService).registerFunctions(config);
|
|
29
|
-
this._debouncedFormulaCalculation();
|
|
30
|
-
return functionsDisposable;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
_univerjs_core_facade.FUniver.extend(FUniverSheetsFormulaMixin);
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
8
|
//#region src/facade/f-formula.ts
|
|
37
9
|
var FFormulaSheetsMixin = class extends _univerjs_engine_formula_facade.FFormula {
|
|
38
10
|
/**
|
|
@@ -61,7 +33,7 @@ var FFormulaSheetsMixin = class extends _univerjs_engine_formula_facade.FFormula
|
|
|
61
33
|
}
|
|
62
34
|
registerFunction(name, func, options) {
|
|
63
35
|
var _options$description;
|
|
64
|
-
const registerFunctionService = this._injector.get(
|
|
36
|
+
const registerFunctionService = this._injector.get(_univerjs_engine_formula.IRegisterFunctionService);
|
|
65
37
|
const params = {
|
|
66
38
|
name,
|
|
67
39
|
func,
|
|
@@ -74,7 +46,7 @@ var FFormulaSheetsMixin = class extends _univerjs_engine_formula_facade.FFormula
|
|
|
74
46
|
}
|
|
75
47
|
registerAsyncFunction(name, func, options) {
|
|
76
48
|
var _options$description2;
|
|
77
|
-
const registerFunctionService = this._injector.get(
|
|
49
|
+
const registerFunctionService = this._injector.get(_univerjs_engine_formula.IRegisterFunctionService);
|
|
78
50
|
const params = {
|
|
79
51
|
name,
|
|
80
52
|
func,
|
package/lib/cjs/index.js
CHANGED
|
@@ -4,7 +4,6 @@ let _univerjs_sheets = require("@univerjs/sheets");
|
|
|
4
4
|
let _univerjs_engine_formula = require("@univerjs/engine-formula");
|
|
5
5
|
let _univerjs_docs = require("@univerjs/docs");
|
|
6
6
|
let rxjs = require("rxjs");
|
|
7
|
-
let _univerjs_formula = require("@univerjs/formula");
|
|
8
7
|
let _univerjs_rpc = require("@univerjs/rpc");
|
|
9
8
|
|
|
10
9
|
//#region src/commands/commands/insert-function.command.ts
|
|
@@ -30,7 +29,7 @@ const InsertFunctionCommand = {
|
|
|
30
29
|
const { primary, formula } = item;
|
|
31
30
|
cellMatrix.setValue(primary.row, primary.column, { f: formula });
|
|
32
31
|
});
|
|
33
|
-
const setRangeValuesParams = { value: cellMatrix.
|
|
32
|
+
const setRangeValuesParams = { value: cellMatrix.clone() };
|
|
34
33
|
return commandService.executeCommand(_univerjs_sheets.SetRangeValuesCommand.id, setRangeValuesParams);
|
|
35
34
|
}
|
|
36
35
|
};
|
|
@@ -155,7 +154,7 @@ const PLUGIN_CONFIG_KEY_MOBILE = "sheets-formula.mobile.config";
|
|
|
155
154
|
const configSymbolMobile = Symbol(PLUGIN_CONFIG_KEY_MOBILE);
|
|
156
155
|
|
|
157
156
|
//#endregion
|
|
158
|
-
//#region \0@oxc-project+runtime@0.
|
|
157
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
159
158
|
function __decorateParam(paramIndex, decorator) {
|
|
160
159
|
return function(target, key) {
|
|
161
160
|
decorator(target, key, paramIndex);
|
|
@@ -163,7 +162,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
//#endregion
|
|
166
|
-
//#region \0@oxc-project+runtime@0.
|
|
165
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
167
166
|
function __decorate(decorators, target, key, desc) {
|
|
168
167
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
169
168
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -277,7 +276,7 @@ function getDataLength(copyDataPiece) {
|
|
|
277
276
|
}
|
|
278
277
|
|
|
279
278
|
//#endregion
|
|
280
|
-
//#region \0@oxc-project+runtime@0.
|
|
279
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
281
280
|
function _typeof(o) {
|
|
282
281
|
"@babel/helpers - typeof";
|
|
283
282
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -288,7 +287,7 @@ function _typeof(o) {
|
|
|
288
287
|
}
|
|
289
288
|
|
|
290
289
|
//#endregion
|
|
291
|
-
//#region \0@oxc-project+runtime@0.
|
|
290
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
292
291
|
function toPrimitive(t, r) {
|
|
293
292
|
if ("object" != _typeof(t) || !t) return t;
|
|
294
293
|
var e = t[Symbol.toPrimitive];
|
|
@@ -301,14 +300,14 @@ function toPrimitive(t, r) {
|
|
|
301
300
|
}
|
|
302
301
|
|
|
303
302
|
//#endregion
|
|
304
|
-
//#region \0@oxc-project+runtime@0.
|
|
303
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
305
304
|
function toPropertyKey(t) {
|
|
306
305
|
var i = toPrimitive(t, "string");
|
|
307
306
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
308
307
|
}
|
|
309
308
|
|
|
310
309
|
//#endregion
|
|
311
|
-
//#region \0@oxc-project+runtime@0.
|
|
310
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
312
311
|
function _defineProperty(e, r, t) {
|
|
313
312
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
314
313
|
value: t,
|
|
@@ -502,7 +501,7 @@ let TriggerCalculationController = class TriggerCalculationController extends _u
|
|
|
502
501
|
this._totalCalculationTaskCount = 0;
|
|
503
502
|
this._emitProgress();
|
|
504
503
|
}
|
|
505
|
-
constructor(_commandService, _univerInstanceService, _logService, _configService, _formulaDataModel, _localeService
|
|
504
|
+
constructor(_commandService, _univerInstanceService, _logService, _configService, _formulaDataModel, _localeService) {
|
|
506
505
|
super();
|
|
507
506
|
this._commandService = _commandService;
|
|
508
507
|
this._univerInstanceService = _univerInstanceService;
|
|
@@ -510,7 +509,6 @@ let TriggerCalculationController = class TriggerCalculationController extends _u
|
|
|
510
509
|
this._configService = _configService;
|
|
511
510
|
this._formulaDataModel = _formulaDataModel;
|
|
512
511
|
this._localeService = _localeService;
|
|
513
|
-
this._registerOtherFormulaService = _registerOtherFormulaService;
|
|
514
512
|
_defineProperty(this, "_startExecutionTime", 0);
|
|
515
513
|
_defineProperty(this, "_totalCalculationTaskCount", 0);
|
|
516
514
|
_defineProperty(this, "_doneCalculationTaskCount", 0);
|
|
@@ -620,9 +618,10 @@ let TriggerCalculationController = class TriggerCalculationController extends _u
|
|
|
620
618
|
}
|
|
621
619
|
_initialExecuteFormula() {
|
|
622
620
|
const calculationMode = this._getCalculationMode();
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
621
|
+
if (calculationMode !== 2) {
|
|
622
|
+
const params = this._getDirtyDataByCalculationMode(calculationMode);
|
|
623
|
+
this._commandService.executeCommand(_univerjs_engine_formula.SetTriggerFormulaCalculationStartMutation.id, params, lo);
|
|
624
|
+
}
|
|
626
625
|
}
|
|
627
626
|
_getDirtyDataByCalculationMode(calculationMode) {
|
|
628
627
|
return {
|
|
@@ -643,8 +642,7 @@ TriggerCalculationController = __decorate([
|
|
|
643
642
|
__decorateParam(2, _univerjs_core.ILogService),
|
|
644
643
|
__decorateParam(3, _univerjs_core.IConfigService),
|
|
645
644
|
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_engine_formula.FormulaDataModel)),
|
|
646
|
-
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))
|
|
647
|
-
__decorateParam(6, (0, _univerjs_core.Inject)(_univerjs_engine_formula.RegisterOtherFormulaService))
|
|
645
|
+
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService))
|
|
648
646
|
], TriggerCalculationController);
|
|
649
647
|
|
|
650
648
|
//#endregion
|
|
@@ -658,7 +656,7 @@ function collectUnitQualifierFormulaPatches(workbook, oldName, newName) {
|
|
|
658
656
|
const formula = (0, _univerjs_engine_formula.refactorFormulaUnitQualifier)(cell.f, oldName, newName);
|
|
659
657
|
if (formula !== cell.f) updates.setValue(row, column, { f: formula });
|
|
660
658
|
});
|
|
661
|
-
const cellValue = updates.
|
|
659
|
+
const cellValue = updates.clone();
|
|
662
660
|
return Object.keys(cellValue).length > 0 ? [{
|
|
663
661
|
unitId,
|
|
664
662
|
subUnitId: sheet.getSheetId(),
|
|
@@ -707,7 +705,7 @@ let UnitQualifierRenameController = class UnitQualifierRenameController extends
|
|
|
707
705
|
id: _univerjs_sheets.SetRangeValuesMutation.id,
|
|
708
706
|
params: {
|
|
709
707
|
...patch,
|
|
710
|
-
cellValue: undoCellValue.
|
|
708
|
+
cellValue: undoCellValue.clone()
|
|
711
709
|
}
|
|
712
710
|
});
|
|
713
711
|
}
|
|
@@ -1575,7 +1573,7 @@ function getReferenceMoveParams(workbook, command) {
|
|
|
1575
1573
|
result = handleRefRemoveRow(command, workbook);
|
|
1576
1574
|
break;
|
|
1577
1575
|
case _univerjs_sheets.RemoveColCommand.id:
|
|
1578
|
-
result = handleRefRemoveCol(command
|
|
1576
|
+
result = handleRefRemoveCol(command);
|
|
1579
1577
|
break;
|
|
1580
1578
|
case _univerjs_sheets.DeleteRangeMoveUpCommand.id:
|
|
1581
1579
|
result = handleRefDeleteRangeMoveUp(command, workbook);
|
|
@@ -1753,8 +1751,7 @@ function handleRefRemoveRow(command, workbook) {
|
|
|
1753
1751
|
var _workbook$getSheetByS3, _workbook$getSheetByS4;
|
|
1754
1752
|
const { params } = command;
|
|
1755
1753
|
if (!params) return null;
|
|
1756
|
-
const { range } = params;
|
|
1757
|
-
const { unitId, sheetId } = getCurrentSheetInfo(workbook);
|
|
1754
|
+
const { range, unitId, subUnitId: sheetId } = params;
|
|
1758
1755
|
return {
|
|
1759
1756
|
type: 5,
|
|
1760
1757
|
range,
|
|
@@ -1763,11 +1760,10 @@ function handleRefRemoveRow(command, workbook) {
|
|
|
1763
1760
|
rangeFilteredRows: (_workbook$getSheetByS3 = (_workbook$getSheetByS4 = workbook.getSheetBySheetId(sheetId)) === null || _workbook$getSheetByS4 === void 0 ? void 0 : _workbook$getSheetByS4.getRangeFilterRows(range)) !== null && _workbook$getSheetByS3 !== void 0 ? _workbook$getSheetByS3 : []
|
|
1764
1761
|
};
|
|
1765
1762
|
}
|
|
1766
|
-
function handleRefRemoveCol(command
|
|
1763
|
+
function handleRefRemoveCol(command) {
|
|
1767
1764
|
const { params } = command;
|
|
1768
1765
|
if (!params) return null;
|
|
1769
|
-
const { range } = params;
|
|
1770
|
-
const { unitId, sheetId } = getCurrentSheetInfo(workbook);
|
|
1766
|
+
const { range, unitId, subUnitId: sheetId } = params;
|
|
1771
1767
|
return {
|
|
1772
1768
|
type: 6,
|
|
1773
1769
|
range,
|
|
@@ -1931,7 +1927,7 @@ let UpdateDefinedNameController = class UpdateDefinedNameController extends _uni
|
|
|
1931
1927
|
};
|
|
1932
1928
|
if (result.type === 12) {
|
|
1933
1929
|
var _this$_univerInstance;
|
|
1934
|
-
result.oldUnitName = (_this$_univerInstance = this._univerInstanceService.getUnit(result.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.
|
|
1930
|
+
result.oldUnitName = (_this$_univerInstance = this._univerInstanceService.getUnit(result.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.name;
|
|
1935
1931
|
}
|
|
1936
1932
|
return this._getUpdateDefinedNameMutations(workbook, result);
|
|
1937
1933
|
} }));
|
|
@@ -2350,7 +2346,7 @@ let UpdateFormulaController = class UpdateFormulaController extends _univerjs_co
|
|
|
2350
2346
|
const newSequenceNodes = updateRefOffset(sequenceNodes, refChangeIds, x, y);
|
|
2351
2347
|
newFormulaDataItem.setValue(row, column, { f: `=${(0, _univerjs_engine_formula.generateStringWithSequence)(newSequenceNodes)}` });
|
|
2352
2348
|
});
|
|
2353
|
-
if (newFormulaData[unitId]) newFormulaData[unitId][sheetId] = newFormulaDataItem.
|
|
2349
|
+
if (newFormulaData[unitId]) newFormulaData[unitId][sheetId] = newFormulaDataItem.clone();
|
|
2354
2350
|
}
|
|
2355
2351
|
}
|
|
2356
2352
|
if (inCrossSheetCutRangeNewFormulas.length > 0 && targetUnitId && targetSheetId) {
|
|
@@ -2426,7 +2422,7 @@ function tableReferenceContainsColumn(columnStruct, columnNames) {
|
|
|
2426
2422
|
//#endregion
|
|
2427
2423
|
//#region package.json
|
|
2428
2424
|
var name = "@univerjs/sheets-formula";
|
|
2429
|
-
var version = "1.0.0-alpha.
|
|
2425
|
+
var version = "1.0.0-alpha.8";
|
|
2430
2426
|
|
|
2431
2427
|
//#endregion
|
|
2432
2428
|
//#region src/common/plugin-name.ts
|
|
@@ -2582,12 +2578,6 @@ let ActiveDirtyController = class ActiveDirtyController extends _univerjs_core.D
|
|
|
2582
2578
|
});
|
|
2583
2579
|
}
|
|
2584
2580
|
_initialSheet() {
|
|
2585
|
-
this._activeDirtyManagerService.register(_univerjs_engine_formula.SetTriggerFormulaCalculationStartMutation.id, {
|
|
2586
|
-
commandId: _univerjs_engine_formula.SetTriggerFormulaCalculationStartMutation.id,
|
|
2587
|
-
getDirtyData: (command) => {
|
|
2588
|
-
return { ...command.params };
|
|
2589
|
-
}
|
|
2590
|
-
});
|
|
2591
2581
|
this._activeDirtyManagerService.register(_univerjs_sheets.RemoveSheetMutation.id, {
|
|
2592
2582
|
commandId: _univerjs_sheets.RemoveSheetMutation.id,
|
|
2593
2583
|
getDirtyData: (command) => {
|
|
@@ -2646,8 +2636,8 @@ let ActiveDirtyController = class ActiveDirtyController extends _univerjs_core.D
|
|
|
2646
2636
|
_getMoveRowsMutationDirtyRange(params) {
|
|
2647
2637
|
const { subUnitId: sheetId, unitId, sourceRange, targetRange } = params;
|
|
2648
2638
|
const dirtyRanges = [];
|
|
2649
|
-
const sourceMatrix = this._rangeToMatrix(sourceRange).
|
|
2650
|
-
const targetMatrix = this._rangeToMatrix(targetRange).
|
|
2639
|
+
const sourceMatrix = this._rangeToMatrix(sourceRange).clone();
|
|
2640
|
+
const targetMatrix = this._rangeToMatrix(targetRange).clone();
|
|
2651
2641
|
dirtyRanges.push(...this._getDirtyRangesByCellValue(unitId, sheetId, sourceMatrix));
|
|
2652
2642
|
dirtyRanges.push(...this._getDirtyRangesByCellValue(unitId, sheetId, targetMatrix));
|
|
2653
2643
|
dirtyRanges.push(...this._getDirtyRangesForArrayFormula(unitId, sheetId, targetMatrix));
|
|
@@ -2655,7 +2645,7 @@ let ActiveDirtyController = class ActiveDirtyController extends _univerjs_core.D
|
|
|
2655
2645
|
}
|
|
2656
2646
|
_getReorderRangeMutationDirtyRange(params) {
|
|
2657
2647
|
const { unitId, subUnitId: sheetId, range } = params;
|
|
2658
|
-
const matrix = this._rangeToMatrix(range).
|
|
2648
|
+
const matrix = this._rangeToMatrix(range).clone();
|
|
2659
2649
|
const dirtyRanges = [];
|
|
2660
2650
|
dirtyRanges.push(...this._getDirtyRangesByCellValue(unitId, sheetId, matrix));
|
|
2661
2651
|
dirtyRanges.push(...this._getDirtyRangesForArrayFormula(unitId, sheetId, matrix));
|
|
@@ -2664,7 +2654,7 @@ let ActiveDirtyController = class ActiveDirtyController extends _univerjs_core.D
|
|
|
2664
2654
|
_getRemoveRowOrColumnMutation(params, isRow = true) {
|
|
2665
2655
|
const { subUnitId: sheetId, unitId, range } = params;
|
|
2666
2656
|
const dirtyRanges = [];
|
|
2667
|
-
const workbook = this._univerInstanceService.
|
|
2657
|
+
const workbook = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
2668
2658
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(sheetId);
|
|
2669
2659
|
const rowCount = (worksheet === null || worksheet === void 0 ? void 0 : worksheet.getRowCount()) || 0;
|
|
2670
2660
|
const columnCount = (worksheet === null || worksheet === void 0 ? void 0 : worksheet.getColumnCount()) || 0;
|
|
@@ -2682,7 +2672,7 @@ let ActiveDirtyController = class ActiveDirtyController extends _univerjs_core.D
|
|
|
2682
2672
|
endRow: rowCount,
|
|
2683
2673
|
endColumn
|
|
2684
2674
|
});
|
|
2685
|
-
const matrixData = matrix.
|
|
2675
|
+
const matrixData = matrix.clone();
|
|
2686
2676
|
dirtyRanges.push(...this._getDirtyRangesByCellValue(unitId, sheetId, matrixData));
|
|
2687
2677
|
dirtyRanges.push(...this._getDirtyRangesForArrayFormula(unitId, sheetId, matrixData));
|
|
2688
2678
|
return dirtyRanges;
|
|
@@ -2967,7 +2957,7 @@ let DefinedNameController = class DefinedNameController extends _univerjs_core.D
|
|
|
2967
2957
|
}
|
|
2968
2958
|
};
|
|
2969
2959
|
DefinedNameController = __decorate([
|
|
2970
|
-
__decorateParam(0,
|
|
2960
|
+
__decorateParam(0, _univerjs_engine_formula.IDescriptionService),
|
|
2971
2961
|
__decorateParam(1, _univerjs_engine_formula.IDefinedNamesService),
|
|
2972
2962
|
__decorateParam(2, _univerjs_core.IUniverInstanceService),
|
|
2973
2963
|
__decorateParam(3, _univerjs_core.ICommandService)
|
|
@@ -2994,11 +2984,7 @@ let FormulaController = class FormulaController extends _univerjs_core.Disposabl
|
|
|
2994
2984
|
constructor(_commandService) {
|
|
2995
2985
|
super();
|
|
2996
2986
|
this._commandService = _commandService;
|
|
2997
|
-
[
|
|
2998
|
-
InsertFunctionCommand,
|
|
2999
|
-
QuickSumCommand,
|
|
3000
|
-
_univerjs_engine_formula.OtherFormulaMarkDirty
|
|
3001
|
-
].forEach((c) => this._commandService.registerCommand(c));
|
|
2987
|
+
[InsertFunctionCommand, QuickSumCommand].forEach((c) => this._commandService.registerCommand(c));
|
|
3002
2988
|
}
|
|
3003
2989
|
};
|
|
3004
2990
|
FormulaController = __decorate([__decorateParam(0, _univerjs_core.ICommandService)], FormulaController);
|
|
@@ -3026,11 +3012,11 @@ let SheetFormulaCalculationResultApplyController = class SheetFormulaCalculation
|
|
|
3026
3012
|
this._commandService = _commandService;
|
|
3027
3013
|
this._sessionService = _sessionService;
|
|
3028
3014
|
this.disposeWithMe(this._commandService.onCommandExecuted((command, options) => {
|
|
3029
|
-
if (command.id === _univerjs_sheets.SetRangeValuesMutation.id && (options === null || options === void 0 ? void 0 : options.applyFormulaCalculationResult)) this._sessionService.markResultApplied(
|
|
3015
|
+
if (command.id === _univerjs_sheets.SetRangeValuesMutation.id && (options === null || options === void 0 ? void 0 : options.applyFormulaCalculationResult)) this._sessionService.markResultApplied(_univerjs_engine_formula.FormulaResultApplicationType.SHEET);
|
|
3030
3016
|
}));
|
|
3031
3017
|
}
|
|
3032
3018
|
};
|
|
3033
|
-
SheetFormulaCalculationResultApplyController = __decorate([__decorateParam(0, _univerjs_core.ICommandService), __decorateParam(1, (0, _univerjs_core.Inject)(
|
|
3019
|
+
SheetFormulaCalculationResultApplyController = __decorate([__decorateParam(0, _univerjs_core.ICommandService), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_engine_formula.FormulaCalculationSessionService))], SheetFormulaCalculationResultApplyController);
|
|
3034
3020
|
|
|
3035
3021
|
//#endregion
|
|
3036
3022
|
//#region src/controllers/super-table.controller.ts
|
|
@@ -3153,7 +3139,7 @@ let SuperTableController = class SuperTableController extends _univerjs_core.Dis
|
|
|
3153
3139
|
}
|
|
3154
3140
|
};
|
|
3155
3141
|
SuperTableController = __decorate([
|
|
3156
|
-
__decorateParam(0,
|
|
3142
|
+
__decorateParam(0, _univerjs_engine_formula.IDescriptionService),
|
|
3157
3143
|
__decorateParam(1, _univerjs_core.IUniverInstanceService),
|
|
3158
3144
|
__decorateParam(2, _univerjs_core.ICommandService),
|
|
3159
3145
|
__decorateParam(3, _univerjs_engine_formula.ISuperTableService)
|
|
@@ -3537,7 +3523,7 @@ let UniverSheetsFormulaPlugin = class UniverSheetsFormulaPlugin extends _univerj
|
|
|
3537
3523
|
dependencies.push([IRemoteRegisterFunctionService, { useFactory: () => (0, _univerjs_rpc.toModule)(rpcChannelService.requestChannel(RemoteRegisterFunctionServiceName)) }]);
|
|
3538
3524
|
}
|
|
3539
3525
|
dependencies.forEach((dependency) => j.add(dependency));
|
|
3540
|
-
if ((_this$_config$descrip = this._config.description) === null || _this$_config$descrip === void 0 ? void 0 : _this$_config$descrip.length) this.disposeWithMe(j.get(
|
|
3526
|
+
if ((_this$_config$descrip = this._config.description) === null || _this$_config$descrip === void 0 ? void 0 : _this$_config$descrip.length) this.disposeWithMe(j.get(_univerjs_engine_formula.IDescriptionService).registerDescriptions(this._config.description));
|
|
3541
3527
|
}
|
|
3542
3528
|
onReady() {
|
|
3543
3529
|
(0, _univerjs_core.touchDependencies)(this._injector, [
|
|
@@ -3563,7 +3549,7 @@ _defineProperty(UniverSheetsFormulaPlugin, "packageName", name);
|
|
|
3563
3549
|
_defineProperty(UniverSheetsFormulaPlugin, "version", version);
|
|
3564
3550
|
_defineProperty(UniverSheetsFormulaPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
3565
3551
|
UniverSheetsFormulaPlugin = __decorate([
|
|
3566
|
-
(0, _univerjs_core.DependentOn)(
|
|
3552
|
+
(0, _univerjs_core.DependentOn)(_univerjs_engine_formula.UniverFormulaEnginePlugin, _univerjs_sheets.UniverSheetsPlugin),
|
|
3567
3553
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
3568
3554
|
__decorateParam(2, _univerjs_core.IConfigService)
|
|
3569
3555
|
], UniverSheetsFormulaPlugin);
|
package/lib/es/facade.js
CHANGED
|
@@ -1,38 +1,10 @@
|
|
|
1
1
|
import { IConfigService, ILogService, LifecycleService, LifecycleStages, debounce } from "@univerjs/core";
|
|
2
|
-
import {
|
|
3
|
-
import { FormulaDataModel, SetTriggerFormulaCalculationStartMutation, extractFormulaError } from "@univerjs/engine-formula";
|
|
4
|
-
import { IRegisterFunctionService } from "@univerjs/formula";
|
|
5
|
-
import "@univerjs/formula/facade";
|
|
2
|
+
import { FormulaDataModel, IRegisterFunctionService, SetTriggerFormulaCalculationStartMutation, extractFormulaError } from "@univerjs/engine-formula";
|
|
6
3
|
import { FFormula } from "@univerjs/engine-formula/facade";
|
|
7
4
|
import { CalculationMode, PLUGIN_CONFIG_KEY_BASE } from "@univerjs/sheets-formula";
|
|
5
|
+
import { FEnum } from "@univerjs/core/facade";
|
|
8
6
|
import { FRange, FWorkbook } from "@univerjs/sheets/facade";
|
|
9
7
|
|
|
10
|
-
//#region src/facade/f-univer.ts
|
|
11
|
-
/**
|
|
12
|
-
* @ignore
|
|
13
|
-
*/
|
|
14
|
-
var FUniverSheetsFormulaMixin = class extends FUniver {
|
|
15
|
-
/**
|
|
16
|
-
* Initialize the FUniver instance.
|
|
17
|
-
* @ignore
|
|
18
|
-
*/
|
|
19
|
-
_initialize() {
|
|
20
|
-
this._debouncedFormulaCalculation = debounce(() => {
|
|
21
|
-
this._commandService.executeCommand(SetTriggerFormulaCalculationStartMutation.id, {
|
|
22
|
-
commands: [],
|
|
23
|
-
forceCalculation: true
|
|
24
|
-
}, { onlyLocal: true });
|
|
25
|
-
}, 10);
|
|
26
|
-
}
|
|
27
|
-
registerFunction(config) {
|
|
28
|
-
const functionsDisposable = this._injector.get(IRegisterFunctionService).registerFunctions(config);
|
|
29
|
-
this._debouncedFormulaCalculation();
|
|
30
|
-
return functionsDisposable;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
FUniver.extend(FUniverSheetsFormulaMixin);
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
8
|
//#region src/facade/f-formula.ts
|
|
37
9
|
var FFormulaSheetsMixin = class extends FFormula {
|
|
38
10
|
/**
|
package/lib/es/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AbsoluteRefType, BooleanNumber, BuildTextUtils, CellValueType, CommandType, DependentOn, Direction, Disposable, DisposableCollection, DrawingTypeEnum, ICommandService, IConfigService, ILogService, IUndoRedoService, IUniverInstanceService, ImageSourceType, Inject, Injector, InterceptorEffectEnum, LocaleService, ObjectMatrix, Plugin, PositionedObjectLayoutType, RANGE_TYPE, Rectangle, Tools, UniverInstanceType, WrapTextType, cellToRange, createDocumentModelWithStyle, createIdentifier, generateRandomId, getIntersectRange, isFormulaId, isFormulaString, isNodeEnv, isRealNum, merge, moveRangeByOffset, sequenceExecute, sequenceExecuteAsync, toDisposable, touchDependencies } from "@univerjs/core";
|
|
2
2
|
import { AUTO_FILL_APPLY_TYPE, AUTO_FILL_DATA_TYPE, ClearSelectionFormatCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, EffectRefRangId, IAutoFillService, INTERCEPTOR_POINT, InsertColCommand, InsertColMutation, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowCommand, InsertRowMutation, InsertSheetMutation, InterceptCellContentPriority, MoveColsCommand, MoveColsMutation, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, RefRangeService, RemoveColCommand, RemoveColMutation, RemoveDefinedNameCommand, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, RemoveSheetMutation, ReorderRangeMutation, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetBorderCommand, SetDefinedNameCommand, SetRangeCustomMetadataCommand, SetRangeValuesCommand, SetRangeValuesMutation, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectionsOperation, SetStyleCommand, SetWorkbookNameCommand, SetWorksheetActiveOperation, SetWorksheetNameCommand, SheetInterceptorService, SheetsSelectionsService, UniverSheetsPlugin, alignToMergedCellsBorders, expandToContinuousRange, findFirstNonEmptyCell, getSeparateEffectedRangesOnCommand, getSheetCommandTarget, handleCommonDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommands, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleIRemoveCol, handleIRemoveRow, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleMoveCols, handleMoveRange, handleMoveRows, runRefRangeMutations } from "@univerjs/sheets";
|
|
3
|
-
import { AstTreeBuilder, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT, ENGINE_FORMULA_RETURN_DEPENDENCY_TREE, ErrorType, FormulaDataModel, FormulaExecuteStageType, FormulaExecutedStateType, FunctionType, IActiveDirtyManagerService, IDefinedNamesService, IFormulaCurrentConfigService, IFunctionService, ISuperTableService, Interpreter, Lexer, LexerTreeBuilder,
|
|
3
|
+
import { AstTreeBuilder, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT, ENGINE_FORMULA_RETURN_DEPENDENCY_TREE, ErrorType, FormulaCalculationSessionService, FormulaDataModel, FormulaExecuteStageType, FormulaExecutedStateType, FormulaResultApplicationType, FunctionType, IActiveDirtyManagerService, IDefinedNamesService, IDescriptionService, IFormulaCurrentConfigService, IFunctionService, ISuperTableService, Interpreter, Lexer, LexerTreeBuilder, RemoveDefinedNameMutation, RemoveSuperTableMutation, SetArrayFormulaDataMutation, SetDefinedNameMutation, SetFormulaCalculationNotificationMutation, SetFormulaCalculationStartMutation, SetFormulaCalculationStopMutation, SetFormulaDataMutation, SetFormulaStringBatchCalculationMutation, SetImageFormulaDataMutation, SetSuperTableMutation, SetTriggerFormulaCalculationStartMutation, UniverFormulaEnginePlugin, deserializeRangeWithSheetWithCache, generateExecuteAstNodeData, generateStringWithSequence, getObjectValue, initSheetFormulaData, refactorFormulaUnitQualifier, sequenceNodeType, serializeRange, serializeRangeToRefString, serializeRangeWithSheet, serializeRangeWithSpreadsheet, splitTableStructuredRef, stripErrorMargin } from "@univerjs/engine-formula";
|
|
4
4
|
import { buildDocTransform } from "@univerjs/docs";
|
|
5
5
|
import { BehaviorSubject, map } from "rxjs";
|
|
6
|
-
import { FormulaCalculationSessionService, FormulaResultApplicationType, IDescriptionService, UniverFormulaPlugin } from "@univerjs/formula";
|
|
7
6
|
import { IRPCChannelService, fromModule, toModule } from "@univerjs/rpc";
|
|
8
7
|
|
|
9
8
|
//#region src/commands/commands/insert-function.command.ts
|
|
@@ -29,7 +28,7 @@ const InsertFunctionCommand = {
|
|
|
29
28
|
const { primary, formula } = item;
|
|
30
29
|
cellMatrix.setValue(primary.row, primary.column, { f: formula });
|
|
31
30
|
});
|
|
32
|
-
const setRangeValuesParams = { value: cellMatrix.
|
|
31
|
+
const setRangeValuesParams = { value: cellMatrix.clone() };
|
|
33
32
|
return commandService.executeCommand(SetRangeValuesCommand.id, setRangeValuesParams);
|
|
34
33
|
}
|
|
35
34
|
};
|
|
@@ -154,7 +153,7 @@ const PLUGIN_CONFIG_KEY_MOBILE = "sheets-formula.mobile.config";
|
|
|
154
153
|
const configSymbolMobile = Symbol(PLUGIN_CONFIG_KEY_MOBILE);
|
|
155
154
|
|
|
156
155
|
//#endregion
|
|
157
|
-
//#region \0@oxc-project+runtime@0.
|
|
156
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
158
157
|
function __decorateParam(paramIndex, decorator) {
|
|
159
158
|
return function(target, key) {
|
|
160
159
|
decorator(target, key, paramIndex);
|
|
@@ -162,7 +161,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
162
161
|
}
|
|
163
162
|
|
|
164
163
|
//#endregion
|
|
165
|
-
//#region \0@oxc-project+runtime@0.
|
|
164
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
166
165
|
function __decorate(decorators, target, key, desc) {
|
|
167
166
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
168
167
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -276,7 +275,7 @@ function getDataLength(copyDataPiece) {
|
|
|
276
275
|
}
|
|
277
276
|
|
|
278
277
|
//#endregion
|
|
279
|
-
//#region \0@oxc-project+runtime@0.
|
|
278
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
280
279
|
function _typeof(o) {
|
|
281
280
|
"@babel/helpers - typeof";
|
|
282
281
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -287,7 +286,7 @@ function _typeof(o) {
|
|
|
287
286
|
}
|
|
288
287
|
|
|
289
288
|
//#endregion
|
|
290
|
-
//#region \0@oxc-project+runtime@0.
|
|
289
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
291
290
|
function toPrimitive(t, r) {
|
|
292
291
|
if ("object" != _typeof(t) || !t) return t;
|
|
293
292
|
var e = t[Symbol.toPrimitive];
|
|
@@ -300,14 +299,14 @@ function toPrimitive(t, r) {
|
|
|
300
299
|
}
|
|
301
300
|
|
|
302
301
|
//#endregion
|
|
303
|
-
//#region \0@oxc-project+runtime@0.
|
|
302
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
304
303
|
function toPropertyKey(t) {
|
|
305
304
|
var i = toPrimitive(t, "string");
|
|
306
305
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
307
306
|
}
|
|
308
307
|
|
|
309
308
|
//#endregion
|
|
310
|
-
//#region \0@oxc-project+runtime@0.
|
|
309
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
311
310
|
function _defineProperty(e, r, t) {
|
|
312
311
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
313
312
|
value: t,
|
|
@@ -501,7 +500,7 @@ let TriggerCalculationController = class TriggerCalculationController extends Di
|
|
|
501
500
|
this._totalCalculationTaskCount = 0;
|
|
502
501
|
this._emitProgress();
|
|
503
502
|
}
|
|
504
|
-
constructor(_commandService, _univerInstanceService, _logService, _configService, _formulaDataModel, _localeService
|
|
503
|
+
constructor(_commandService, _univerInstanceService, _logService, _configService, _formulaDataModel, _localeService) {
|
|
505
504
|
super();
|
|
506
505
|
this._commandService = _commandService;
|
|
507
506
|
this._univerInstanceService = _univerInstanceService;
|
|
@@ -509,7 +508,6 @@ let TriggerCalculationController = class TriggerCalculationController extends Di
|
|
|
509
508
|
this._configService = _configService;
|
|
510
509
|
this._formulaDataModel = _formulaDataModel;
|
|
511
510
|
this._localeService = _localeService;
|
|
512
|
-
this._registerOtherFormulaService = _registerOtherFormulaService;
|
|
513
511
|
_defineProperty(this, "_startExecutionTime", 0);
|
|
514
512
|
_defineProperty(this, "_totalCalculationTaskCount", 0);
|
|
515
513
|
_defineProperty(this, "_doneCalculationTaskCount", 0);
|
|
@@ -619,9 +617,10 @@ let TriggerCalculationController = class TriggerCalculationController extends Di
|
|
|
619
617
|
}
|
|
620
618
|
_initialExecuteFormula() {
|
|
621
619
|
const calculationMode = this._getCalculationMode();
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
620
|
+
if (calculationMode !== 2) {
|
|
621
|
+
const params = this._getDirtyDataByCalculationMode(calculationMode);
|
|
622
|
+
this._commandService.executeCommand(SetTriggerFormulaCalculationStartMutation.id, params, lo);
|
|
623
|
+
}
|
|
625
624
|
}
|
|
626
625
|
_getDirtyDataByCalculationMode(calculationMode) {
|
|
627
626
|
return {
|
|
@@ -642,8 +641,7 @@ TriggerCalculationController = __decorate([
|
|
|
642
641
|
__decorateParam(2, ILogService),
|
|
643
642
|
__decorateParam(3, IConfigService),
|
|
644
643
|
__decorateParam(4, Inject(FormulaDataModel)),
|
|
645
|
-
__decorateParam(5, Inject(LocaleService))
|
|
646
|
-
__decorateParam(6, Inject(RegisterOtherFormulaService))
|
|
644
|
+
__decorateParam(5, Inject(LocaleService))
|
|
647
645
|
], TriggerCalculationController);
|
|
648
646
|
|
|
649
647
|
//#endregion
|
|
@@ -657,7 +655,7 @@ function collectUnitQualifierFormulaPatches(workbook, oldName, newName) {
|
|
|
657
655
|
const formula = refactorFormulaUnitQualifier(cell.f, oldName, newName);
|
|
658
656
|
if (formula !== cell.f) updates.setValue(row, column, { f: formula });
|
|
659
657
|
});
|
|
660
|
-
const cellValue = updates.
|
|
658
|
+
const cellValue = updates.clone();
|
|
661
659
|
return Object.keys(cellValue).length > 0 ? [{
|
|
662
660
|
unitId,
|
|
663
661
|
subUnitId: sheet.getSheetId(),
|
|
@@ -706,7 +704,7 @@ let UnitQualifierRenameController = class UnitQualifierRenameController extends
|
|
|
706
704
|
id: SetRangeValuesMutation.id,
|
|
707
705
|
params: {
|
|
708
706
|
...patch,
|
|
709
|
-
cellValue: undoCellValue.
|
|
707
|
+
cellValue: undoCellValue.clone()
|
|
710
708
|
}
|
|
711
709
|
});
|
|
712
710
|
}
|
|
@@ -1574,7 +1572,7 @@ function getReferenceMoveParams(workbook, command) {
|
|
|
1574
1572
|
result = handleRefRemoveRow(command, workbook);
|
|
1575
1573
|
break;
|
|
1576
1574
|
case RemoveColCommand.id:
|
|
1577
|
-
result = handleRefRemoveCol(command
|
|
1575
|
+
result = handleRefRemoveCol(command);
|
|
1578
1576
|
break;
|
|
1579
1577
|
case DeleteRangeMoveUpCommand.id:
|
|
1580
1578
|
result = handleRefDeleteRangeMoveUp(command, workbook);
|
|
@@ -1752,8 +1750,7 @@ function handleRefRemoveRow(command, workbook) {
|
|
|
1752
1750
|
var _workbook$getSheetByS3, _workbook$getSheetByS4;
|
|
1753
1751
|
const { params } = command;
|
|
1754
1752
|
if (!params) return null;
|
|
1755
|
-
const { range } = params;
|
|
1756
|
-
const { unitId, sheetId } = getCurrentSheetInfo(workbook);
|
|
1753
|
+
const { range, unitId, subUnitId: sheetId } = params;
|
|
1757
1754
|
return {
|
|
1758
1755
|
type: 5,
|
|
1759
1756
|
range,
|
|
@@ -1762,11 +1759,10 @@ function handleRefRemoveRow(command, workbook) {
|
|
|
1762
1759
|
rangeFilteredRows: (_workbook$getSheetByS3 = (_workbook$getSheetByS4 = workbook.getSheetBySheetId(sheetId)) === null || _workbook$getSheetByS4 === void 0 ? void 0 : _workbook$getSheetByS4.getRangeFilterRows(range)) !== null && _workbook$getSheetByS3 !== void 0 ? _workbook$getSheetByS3 : []
|
|
1763
1760
|
};
|
|
1764
1761
|
}
|
|
1765
|
-
function handleRefRemoveCol(command
|
|
1762
|
+
function handleRefRemoveCol(command) {
|
|
1766
1763
|
const { params } = command;
|
|
1767
1764
|
if (!params) return null;
|
|
1768
|
-
const { range } = params;
|
|
1769
|
-
const { unitId, sheetId } = getCurrentSheetInfo(workbook);
|
|
1765
|
+
const { range, unitId, subUnitId: sheetId } = params;
|
|
1770
1766
|
return {
|
|
1771
1767
|
type: 6,
|
|
1772
1768
|
range,
|
|
@@ -1930,7 +1926,7 @@ let UpdateDefinedNameController = class UpdateDefinedNameController extends Disp
|
|
|
1930
1926
|
};
|
|
1931
1927
|
if (result.type === 12) {
|
|
1932
1928
|
var _this$_univerInstance;
|
|
1933
|
-
result.oldUnitName = (_this$_univerInstance = this._univerInstanceService.getUnit(result.unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.
|
|
1929
|
+
result.oldUnitName = (_this$_univerInstance = this._univerInstanceService.getUnit(result.unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.name;
|
|
1934
1930
|
}
|
|
1935
1931
|
return this._getUpdateDefinedNameMutations(workbook, result);
|
|
1936
1932
|
} }));
|
|
@@ -2349,7 +2345,7 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2349
2345
|
const newSequenceNodes = updateRefOffset(sequenceNodes, refChangeIds, x, y);
|
|
2350
2346
|
newFormulaDataItem.setValue(row, column, { f: `=${generateStringWithSequence(newSequenceNodes)}` });
|
|
2351
2347
|
});
|
|
2352
|
-
if (newFormulaData[unitId]) newFormulaData[unitId][sheetId] = newFormulaDataItem.
|
|
2348
|
+
if (newFormulaData[unitId]) newFormulaData[unitId][sheetId] = newFormulaDataItem.clone();
|
|
2353
2349
|
}
|
|
2354
2350
|
}
|
|
2355
2351
|
if (inCrossSheetCutRangeNewFormulas.length > 0 && targetUnitId && targetSheetId) {
|
|
@@ -2425,7 +2421,7 @@ function tableReferenceContainsColumn(columnStruct, columnNames) {
|
|
|
2425
2421
|
//#endregion
|
|
2426
2422
|
//#region package.json
|
|
2427
2423
|
var name = "@univerjs/sheets-formula";
|
|
2428
|
-
var version = "1.0.0-alpha.
|
|
2424
|
+
var version = "1.0.0-alpha.8";
|
|
2429
2425
|
|
|
2430
2426
|
//#endregion
|
|
2431
2427
|
//#region src/common/plugin-name.ts
|
|
@@ -2581,12 +2577,6 @@ let ActiveDirtyController = class ActiveDirtyController extends Disposable {
|
|
|
2581
2577
|
});
|
|
2582
2578
|
}
|
|
2583
2579
|
_initialSheet() {
|
|
2584
|
-
this._activeDirtyManagerService.register(SetTriggerFormulaCalculationStartMutation.id, {
|
|
2585
|
-
commandId: SetTriggerFormulaCalculationStartMutation.id,
|
|
2586
|
-
getDirtyData: (command) => {
|
|
2587
|
-
return { ...command.params };
|
|
2588
|
-
}
|
|
2589
|
-
});
|
|
2590
2580
|
this._activeDirtyManagerService.register(RemoveSheetMutation.id, {
|
|
2591
2581
|
commandId: RemoveSheetMutation.id,
|
|
2592
2582
|
getDirtyData: (command) => {
|
|
@@ -2645,8 +2635,8 @@ let ActiveDirtyController = class ActiveDirtyController extends Disposable {
|
|
|
2645
2635
|
_getMoveRowsMutationDirtyRange(params) {
|
|
2646
2636
|
const { subUnitId: sheetId, unitId, sourceRange, targetRange } = params;
|
|
2647
2637
|
const dirtyRanges = [];
|
|
2648
|
-
const sourceMatrix = this._rangeToMatrix(sourceRange).
|
|
2649
|
-
const targetMatrix = this._rangeToMatrix(targetRange).
|
|
2638
|
+
const sourceMatrix = this._rangeToMatrix(sourceRange).clone();
|
|
2639
|
+
const targetMatrix = this._rangeToMatrix(targetRange).clone();
|
|
2650
2640
|
dirtyRanges.push(...this._getDirtyRangesByCellValue(unitId, sheetId, sourceMatrix));
|
|
2651
2641
|
dirtyRanges.push(...this._getDirtyRangesByCellValue(unitId, sheetId, targetMatrix));
|
|
2652
2642
|
dirtyRanges.push(...this._getDirtyRangesForArrayFormula(unitId, sheetId, targetMatrix));
|
|
@@ -2654,7 +2644,7 @@ let ActiveDirtyController = class ActiveDirtyController extends Disposable {
|
|
|
2654
2644
|
}
|
|
2655
2645
|
_getReorderRangeMutationDirtyRange(params) {
|
|
2656
2646
|
const { unitId, subUnitId: sheetId, range } = params;
|
|
2657
|
-
const matrix = this._rangeToMatrix(range).
|
|
2647
|
+
const matrix = this._rangeToMatrix(range).clone();
|
|
2658
2648
|
const dirtyRanges = [];
|
|
2659
2649
|
dirtyRanges.push(...this._getDirtyRangesByCellValue(unitId, sheetId, matrix));
|
|
2660
2650
|
dirtyRanges.push(...this._getDirtyRangesForArrayFormula(unitId, sheetId, matrix));
|
|
@@ -2663,7 +2653,7 @@ let ActiveDirtyController = class ActiveDirtyController extends Disposable {
|
|
|
2663
2653
|
_getRemoveRowOrColumnMutation(params, isRow = true) {
|
|
2664
2654
|
const { subUnitId: sheetId, unitId, range } = params;
|
|
2665
2655
|
const dirtyRanges = [];
|
|
2666
|
-
const workbook = this._univerInstanceService.
|
|
2656
|
+
const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
2667
2657
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(sheetId);
|
|
2668
2658
|
const rowCount = (worksheet === null || worksheet === void 0 ? void 0 : worksheet.getRowCount()) || 0;
|
|
2669
2659
|
const columnCount = (worksheet === null || worksheet === void 0 ? void 0 : worksheet.getColumnCount()) || 0;
|
|
@@ -2681,7 +2671,7 @@ let ActiveDirtyController = class ActiveDirtyController extends Disposable {
|
|
|
2681
2671
|
endRow: rowCount,
|
|
2682
2672
|
endColumn
|
|
2683
2673
|
});
|
|
2684
|
-
const matrixData = matrix.
|
|
2674
|
+
const matrixData = matrix.clone();
|
|
2685
2675
|
dirtyRanges.push(...this._getDirtyRangesByCellValue(unitId, sheetId, matrixData));
|
|
2686
2676
|
dirtyRanges.push(...this._getDirtyRangesForArrayFormula(unitId, sheetId, matrixData));
|
|
2687
2677
|
return dirtyRanges;
|
|
@@ -2993,11 +2983,7 @@ let FormulaController = class FormulaController extends Disposable {
|
|
|
2993
2983
|
constructor(_commandService) {
|
|
2994
2984
|
super();
|
|
2995
2985
|
this._commandService = _commandService;
|
|
2996
|
-
[
|
|
2997
|
-
InsertFunctionCommand,
|
|
2998
|
-
QuickSumCommand,
|
|
2999
|
-
OtherFormulaMarkDirty
|
|
3000
|
-
].forEach((c) => this._commandService.registerCommand(c));
|
|
2986
|
+
[InsertFunctionCommand, QuickSumCommand].forEach((c) => this._commandService.registerCommand(c));
|
|
3001
2987
|
}
|
|
3002
2988
|
};
|
|
3003
2989
|
FormulaController = __decorate([__decorateParam(0, ICommandService)], FormulaController);
|
|
@@ -3562,7 +3548,7 @@ _defineProperty(UniverSheetsFormulaPlugin, "packageName", name);
|
|
|
3562
3548
|
_defineProperty(UniverSheetsFormulaPlugin, "version", version);
|
|
3563
3549
|
_defineProperty(UniverSheetsFormulaPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
3564
3550
|
UniverSheetsFormulaPlugin = __decorate([
|
|
3565
|
-
DependentOn(
|
|
3551
|
+
DependentOn(UniverFormulaEnginePlugin, UniverSheetsPlugin),
|
|
3566
3552
|
__decorateParam(1, Inject(Injector)),
|
|
3567
3553
|
__decorateParam(2, IConfigService)
|
|
3568
3554
|
], UniverSheetsFormulaPlugin);
|