@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/facade.js CHANGED
@@ -1,38 +1,10 @@
1
1
  import { IConfigService, ILogService, LifecycleService, LifecycleStages, debounce } from "@univerjs/core";
2
- import { FEnum, FUniver } from "@univerjs/core/facade";
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/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, OtherFormulaMarkDirty, RegisterOtherFormulaService, 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";
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.getData() };
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.137.0/helpers/esm/decorateParam.js
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.137.0/helpers/esm/decorate.js
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.137.0/helpers/esm/typeof.js
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.137.0/helpers/esm/toPrimitive.js
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.137.0/helpers/esm/toPropertyKey.js
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.137.0/helpers/esm/defineProperty.js
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, _registerOtherFormulaService) {
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
- const params = this._getDirtyDataByCalculationMode(calculationMode);
623
- this._commandService.executeCommand(SetTriggerFormulaCalculationStartMutation.id, params, lo);
624
- this._registerOtherFormulaService.calculateStarted$.next(true);
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.getData();
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.getData()
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, workbook);
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, workbook) {
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.getName();
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.getData();
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.7";
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).getData();
2649
- const targetMatrix = this._rangeToMatrix(targetRange).getData();
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).getData();
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.getUniverSheetInstance(unitId);
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.getData();
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(UniverFormulaPlugin, UniverSheetsPlugin),
3551
+ DependentOn(UniverFormulaEnginePlugin, UniverSheetsPlugin),
3566
3552
  __decorateParam(1, Inject(Injector)),
3567
3553
  __decorateParam(2, IConfigService)
3568
3554
  ], UniverSheetsFormulaPlugin);
@@ -14,8 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
17
- import { IDefinedNamesService } from '@univerjs/engine-formula';
18
- import { IDescriptionService } from '@univerjs/formula';
17
+ import { IDefinedNamesService, IDescriptionService } from '@univerjs/engine-formula';
19
18
  /**
20
19
  * header highlight
21
20
  * column menu: show, hover and mousedown event
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Disposable, ICommandService } from '@univerjs/core';
17
- import { FormulaCalculationSessionService } from '@univerjs/formula';
17
+ import { FormulaCalculationSessionService } from '@univerjs/engine-formula';
18
18
  export declare class SheetFormulaCalculationResultApplyController extends Disposable {
19
19
  private readonly _commandService;
20
20
  private readonly _sessionService;
@@ -14,8 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
17
- import { ISuperTableService } from '@univerjs/engine-formula';
18
- import { IDescriptionService } from '@univerjs/formula';
17
+ import { IDescriptionService, ISuperTableService } from '@univerjs/engine-formula';
19
18
  /**
20
19
  * header highlight
21
20
  * column menu: show, hover and mousedown event
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Disposable, ICommandService, IConfigService, ILogService, IUniverInstanceService, LocaleService } from '@univerjs/core';
17
- import { FormulaDataModel, RegisterOtherFormulaService } from '@univerjs/engine-formula';
17
+ import { FormulaDataModel } from '@univerjs/engine-formula';
18
18
  /**
19
19
  * This interface is for the progress bar to display the calculation progress.
20
20
  */
@@ -33,7 +33,6 @@ export declare class TriggerCalculationController extends Disposable {
33
33
  private readonly _configService;
34
34
  private readonly _formulaDataModel;
35
35
  private readonly _localeService;
36
- private readonly _registerOtherFormulaService;
37
36
  private _startExecutionTime;
38
37
  private _totalCalculationTaskCount;
39
38
  private _doneCalculationTaskCount;
@@ -45,7 +44,7 @@ export declare class TriggerCalculationController extends Disposable {
45
44
  private _calculateProgress;
46
45
  private _completeProgress;
47
46
  clearProgress(): void;
48
- constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _logService: ILogService, _configService: IConfigService, _formulaDataModel: FormulaDataModel, _localeService: LocaleService, _registerOtherFormulaService: RegisterOtherFormulaService);
47
+ constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _logService: ILogService, _configService: IConfigService, _formulaDataModel: FormulaDataModel, _localeService: LocaleService);
49
48
  dispose(): void;
50
49
  private _getCalculationMode;
51
50
  private _commandExecutedListener;
@@ -14,8 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IDisposable, ILocales } from '@univerjs/core';
17
- import type { IFunctionInfo } from '@univerjs/engine-formula';
18
- import type { IRegisterAsyncFunction, IRegisterFunction } from '@univerjs/formula';
17
+ import type { IFunctionInfo, IRegisterAsyncFunction, IRegisterFunction } from '@univerjs/engine-formula';
19
18
  import type { CalculationMode } from '@univerjs/sheets-formula';
20
19
  import { FFormula } from '@univerjs/engine-formula/facade';
21
20
  /**
@@ -13,11 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import './f-univer';
17
- import '@univerjs/formula/facade';
18
16
  import './f-formula';
19
17
  import './f-enum';
20
18
  import './f-workbook';
21
19
  import './f-range';
22
20
  export type * from './f-formula';
23
- export type * from './f-univer';
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/engine-formula"),require("@univerjs/formula"),require("@univerjs/formula/facade"),require("@univerjs/engine-formula/facade"),require("@univerjs/sheets-formula"),require("@univerjs/sheets/facade")):typeof define==`function`&&define.amd?define([`@univerjs/core`,`@univerjs/core/facade`,`@univerjs/engine-formula`,`@univerjs/formula`,`@univerjs/formula/facade`,`@univerjs/engine-formula/facade`,`@univerjs/sheets-formula`,`@univerjs/sheets/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCore,e.UniverCoreFacade,e.UniverEngineFormula,e.UniverFormula,e.UniverFormulaFacade,e.UniverEngineFormulaFacade,e.UniverSheetsFormula,e.UniverSheetsFacade))})(this,function(e,t,n,r,i,a,o,s){var c=class extends t.FUniver{_initialize(){this._debouncedFormulaCalculation=(0,e.debounce)(()=>{this._commandService.executeCommand(n.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(e){let t=this._injector.get(r.IRegisterFunctionService).registerFunctions(e);return this._debouncedFormulaCalculation(),t}};t.FUniver.extend(c);var l=class extends a.FFormula{_initialize(){this._debouncedFormulaCalculation=(0,e.debounce)(()=>{this._commandService.executeCommand(n.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(t){let n=this._injector.get(e.LifecycleService).stage,r=this._injector.get(e.ILogService),i=this._injector.get(e.IConfigService);n>e.LifecycleStages.Starting&&r.warn(`[FFormula]`,`CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.`);let a=i.getConfig(o.PLUGIN_CONFIG_KEY_BASE);if(!a){i.setConfig(o.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:t});return}a.initialFormulaComputing=t}registerFunction(e,t,n){var i;let a=this._injector.get(r.IRegisterFunctionService),o={name:e,func:t,description:typeof n==`string`?n:(i=n==null?void 0:n.description)==null?``:i,locales:typeof n==`object`?n.locales:void 0},s=a.registerFunction(o);return this._debouncedFormulaCalculation(),s}registerAsyncFunction(e,t,n){var i;let a=this._injector.get(r.IRegisterFunctionService),o={name:e,func:t,description:typeof n==`string`?n:(i=n==null?void 0:n.description)==null?``:i,locales:typeof n==`object`?n.locales:void 0},s=a.registerAsyncFunction(o);return this._debouncedFormulaCalculation(),s}};a.FFormula.extend(l);var u=class extends t.FEnum{get CalculationMode(){return o.CalculationMode}};t.FEnum.extend(u);var d=class extends s.FWorkbook{getAllFormulaError(){let e=[],t=this._workbook,r=t.getUnitId(),i=t.getSheets(),a=this._injector.get(n.FormulaDataModel).getArrayFormulaCellData();return i.forEach(t=>{var i;let o=t.getName(),s=t.getSheetId(),c=t.getCellMatrix(),l=(a==null||(i=a[r])==null?void 0:i[s])||{};c.forValue((t,r,i)=>{var a;if(!i)return;let s=(0,n.extractFormulaError)(i,!!(!(l==null||(a=l[t])==null)&&a[r]));s&&e.push({sheetName:o,row:t,column:r,formula:i.f||``,errorType:s})})}),e}};s.FWorkbook.extend(d);var f=class extends s.FRange{getFormulaError(){var e;let t=[],r=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),a=this._worksheet.getName(),o=this._workbook.getSheetBySheetId(i);if(!o)return t;let s=this._injector.get(n.FormulaDataModel).getArrayFormulaCellData(),c=(s==null||(e=s[r])==null?void 0:e[i])||{},l=o.getCellMatrix(),{startRow:u,endRow:d,startColumn:f,endColumn:p}=this._range;for(let e=u;e<=d;e++)for(let r=f;r<=p;r++){var m;let i=l.getValue(e,r);if(!i)continue;let o=(0,n.extractFormulaError)(i,!!(!(c==null||(m=c[e])==null)&&m[r]));o&&t.push({sheetName:a,row:e,column:r,formula:i.f||``,errorType:o})}return t}};s.FRange.extend(f)});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/engine-formula/facade"),require("@univerjs/sheets-formula"),require("@univerjs/core/facade"),require("@univerjs/sheets/facade")):typeof define==`function`&&define.amd?define([`@univerjs/core`,`@univerjs/engine-formula`,`@univerjs/engine-formula/facade`,`@univerjs/sheets-formula`,`@univerjs/core/facade`,`@univerjs/sheets/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCore,e.UniverEngineFormula,e.UniverEngineFormulaFacade,e.UniverSheetsFormula,e.UniverCoreFacade,e.UniverSheetsFacade))})(this,function(e,t,n,r,i,a){var o=class extends n.FFormula{_initialize(){this._debouncedFormulaCalculation=(0,e.debounce)(()=>{this._commandService.executeCommand(t.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(t){let n=this._injector.get(e.LifecycleService).stage,i=this._injector.get(e.ILogService),a=this._injector.get(e.IConfigService);n>e.LifecycleStages.Starting&&i.warn(`[FFormula]`,`CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.`);let o=a.getConfig(r.PLUGIN_CONFIG_KEY_BASE);if(!o){a.setConfig(r.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:t});return}o.initialFormulaComputing=t}registerFunction(e,n,r){var i;let a=this._injector.get(t.IRegisterFunctionService),o={name:e,func:n,description:typeof r==`string`?r:(i=r==null?void 0:r.description)==null?``:i,locales:typeof r==`object`?r.locales:void 0},s=a.registerFunction(o);return this._debouncedFormulaCalculation(),s}registerAsyncFunction(e,n,r){var i;let a=this._injector.get(t.IRegisterFunctionService),o={name:e,func:n,description:typeof r==`string`?r:(i=r==null?void 0:r.description)==null?``:i,locales:typeof r==`object`?r.locales:void 0},s=a.registerAsyncFunction(o);return this._debouncedFormulaCalculation(),s}};n.FFormula.extend(o);var s=class extends i.FEnum{get CalculationMode(){return r.CalculationMode}};i.FEnum.extend(s);var c=class extends a.FWorkbook{getAllFormulaError(){let e=[],n=this._workbook,r=n.getUnitId(),i=n.getSheets(),a=this._injector.get(t.FormulaDataModel).getArrayFormulaCellData();return i.forEach(n=>{var i;let o=n.getName(),s=n.getSheetId(),c=n.getCellMatrix(),l=(a==null||(i=a[r])==null?void 0:i[s])||{};c.forValue((n,r,i)=>{var a;if(!i)return;let s=(0,t.extractFormulaError)(i,!!(l!=null&&(a=l[n])!=null&&a[r]));s&&e.push({sheetName:o,row:n,column:r,formula:i.f||``,errorType:s})})}),e}};a.FWorkbook.extend(c);var l=class extends a.FRange{getFormulaError(){var e;let n=[],r=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),a=this._worksheet.getName(),o=this._workbook.getSheetBySheetId(i);if(!o)return n;let s=this._injector.get(t.FormulaDataModel).getArrayFormulaCellData(),c=(s==null||(e=s[r])==null?void 0:e[i])||{},l=o.getCellMatrix(),{startRow:u,endRow:d,startColumn:f,endColumn:p}=this._range;for(let e=u;e<=d;e++)for(let r=f;r<=p;r++){var m;let i=l.getValue(e,r);if(!i)continue;let o=(0,t.extractFormulaError)(i,!!(c!=null&&(m=c[e])!=null&&m[r]));o&&n.push({sheetName:a,row:e,column:r,formula:i.f||``,errorType:o})}return n}};a.FRange.extend(l)});