@univerjs/sheets-formula-ui 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/es/index.js CHANGED
@@ -1,19 +1,17 @@
1
1
  import { AbsoluteRefType, BuildTextUtils, CellValueType, ColorKit, CommandType, DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DependentOn, Direction, Disposable, DisposableCollection, DocumentFlavor, EDITOR_ACTIVATED, FOCUSING_FX_BAR_EDITOR, HorizontalAlign, ICommandService, IConfigService, IContextService, ILogService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, LocaleService, ObjectMatrix, Plugin, RANGE_TYPE, Range, Rectangle, RichTextBuilder, RxDisposable, ThemeService, Tools, UniverInstanceType, VerticalAlign, createIdentifier, createInternalEditorID, generateRandomId, getCellValueType, getEmptyCell, isFormulaId, isFormulaString, isICellData, isRealNum, merge, noop, registerDependencies, toDisposable, touchDependencies } from "@univerjs/core";
2
- import { BaseSelectionRenderService, COPY_SPECIAL_MENU_ID, COPY_TYPE, CellAlertManagerService, CellAlertType, EMBEDDING_FORMULA_EDITOR, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, ExpandSelectionCommand, HoverManagerService, IEditorBridgeService, IMarkSelectionService, ISheetClipboardService, ISheetSelectionRenderService, JumpOver, MoveSelectionCommand, PASTE_SPECIAL_MENU_ID, PREDEFINED_HOOK_NAME_COPY, PREDEFINED_HOOK_NAME_PASTE, RANGE_SELECTOR_COMPONENT_KEY, SELECTION_SHAPE_DEPTH, SelectionControl, SetCellEditVisibleOperation, SheetPasteCommand, SheetSkeletonManagerService, SheetsUIPart, checkInHeaderRanges, genNormalSelectionStyle, getAllSelection, getCoordByOffset, getCurrentRangeDisable$, getSheetObject, menuClipboardDisabledObservable, useActiveWorkbook, whenSheetEditorActivated, whenSheetEditorFocused } from "@univerjs/sheets-ui";
3
- import { ErrorType, FormulaDataModel, FunctionType, LexerTreeBuilder, SetArrayFormulaDataMutation, SetFormulaCalculationResultMutation, SetFormulaCalculationStopMutation, deserializeRangeWithSheet, deserializeRangeWithSheetWithCache, extractFormulaError, generateStringWithSequence, getAbsoluteRefTypeWithSingleString, handleRefStringInfo, isFormulaLexerToken, matchRefDrawToken, matchToken, operatorToken, sequenceNodeType, serializeRange, serializeRangeToRefString, serializeRangeWithSheet, serializeRangeWithSpreadsheet } from "@univerjs/engine-formula";
2
+ import { BaseSelectionRenderService, COPY_SPECIAL_MENU_ID, COPY_TYPE, CellAlertManagerService, CellAlertType, EMBEDDING_FORMULA_EDITOR, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, ExpandSelectionCommand, HoverManagerService, IEditorBridgeService, IMarkSelectionService, ISheetClipboardService, ISheetSelectionRenderService, JumpOver, MoveSelectionCommand, PASTE_SPECIAL_MENU_ID, PREDEFINED_HOOK_NAME_COPY, PREDEFINED_HOOK_NAME_PASTE, RANGE_SELECTOR_COMPONENT_KEY, SELECTION_SHAPE_DEPTH, SelectionControl, SetCellEditVisibleOperation, SheetPasteCommand, SheetSkeletonManagerService, SheetsUIPart, UniverSheetsUIPlugin, checkInHeaderRanges, genNormalSelectionStyle, getAllSelection, getCoordByOffset, getCurrentRangeDisable$, getSheetObject, menuClipboardDisabledObservable, useActiveWorkbook, whenSheetEditorActivated, whenSheetEditorFocused } from "@univerjs/sheets-ui";
3
+ import { ErrorType, FormulaDataModel, FunctionType, IDescriptionService, LexerTreeBuilder, SetArrayFormulaDataMutation, SetFormulaCalculationResultMutation, SetFormulaCalculationStopMutation, UniverFormulaEnginePlugin, buildFormulaTextRuns, deserializeRangeWithSheet, deserializeRangeWithSheetWithCache, extractFormulaError, generateStringWithSequence, getAbsoluteRefTypeWithSingleString, getFormulaHighlightDataStream, getFormulaReplaceResult, handleRefStringInfo, isFormulaLexerToken, isFormulaReferenceAddingContext, isFormulaReferenceAddingTextContext, matchRefDrawToken, matchToken, operatorToken, searchFormulaFunctions, sequenceNodeType, serializeRange, serializeRangeToRefString, serializeRangeWithSheet, serializeRangeWithSpreadsheet } from "@univerjs/engine-formula";
4
4
  import { BehaviorSubject, Subject, combineLatestWith, debounceTime, distinctUntilChanged, filter, map, merge as merge$1, throttleTime } from "rxjs";
5
5
  import { DocBackScrollRenderController, DocSelectionRenderService, IEditorService, MoveCursorOperation, MoveSelectionOperation, ReplaceTextRunsCommand, RichTextEditor, createEditorUndoRedoKeyboardConfig, useKeyboardEvent, useResize } from "@univerjs/docs-ui";
6
- import { DeviceInputEventType, IRenderManagerService, SHEET_VIEWPORT_KEY, ScrollTimerType, Vector2 } from "@univerjs/engine-render";
7
- import { BEFORE_CELL_EDIT, INTERCEPTOR_POINT, IRefSelectionsService, REF_SELECTIONS_ENABLED, RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint, ReorderRangeCommand, SelectionMoveType, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetSelectionsOperation, SetWorksheetActiveOperation, SetWorksheetRowAutoHeightMutation, SheetInterceptorService, SheetSkeletonService, SheetsSelectionsService, WorkbookCopyPermission, WorkbookEditablePermission, WorksheetCopyPermission, WorksheetEditPermission, WorksheetSetCellValuePermission, attachSelectionWithCoord, convertSelectionDataToRange, getCellAtRowCol, getSheetCommandTarget, setEndForRange } from "@univerjs/sheets";
6
+ import { DeviceInputEventType, IRenderManagerService, SHEET_VIEWPORT_KEY, ScrollTimerType, UniverRenderEnginePlugin, Vector2 } from "@univerjs/engine-render";
7
+ import { BEFORE_CELL_EDIT, INTERCEPTOR_POINT, IRefSelectionsService, REF_SELECTIONS_ENABLED, RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint, ReorderRangeCommand, SelectionMoveType, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetSelectionsOperation, SetWorksheetActiveOperation, SetWorksheetRowAutoHeightMutation, SheetInterceptorService, SheetSkeletonService, SheetsSelectionsService, UniverSheetsPlugin, WorkbookCopyPermission, WorkbookEditablePermission, WorksheetCopyPermission, WorksheetEditPermission, WorksheetSetCellValuePermission, attachSelectionWithCoord, convertSelectionDataToRange, getCellAtRowCol, getSheetCommandTarget, setEndForRange } from "@univerjs/sheets";
8
8
  import { ImageFormulaCellInterceptorController, InsertFunctionCommand, PLUGIN_CONFIG_KEY_BASE, QuickSumCommand, TriggerCalculationController, UniverSheetsFormulaPlugin } from "@univerjs/sheets-formula";
9
- import { BuiltInUIPart, ComponentManager, IContextMenuService, IMenuManagerService, IShortcutService, ISidebarService, IUIPartsService, IconManager, KeyCode, MenuItemType, MetaKeys, ProgressBar, RectPopup, RibbonFormulasGroup, connectInjector, getMenuHiddenObservable, useDependency, useEvent, useObservable, useUpdateEffect } from "@univerjs/ui";
9
+ import { BuiltInUIPart, ComponentManager, IContextMenuService, IMenuManagerService, IShortcutService, ISidebarService, IUIPartsService, IconManager, KeyCode, MenuItemType, MetaKeys, ProgressBar, RectPopup, RibbonFormulasGroup, UniverUIPlugin, connectInjector, getMenuHiddenObservable, useDependency, useEvent, useObservable, useUpdateEffect } from "@univerjs/ui";
10
10
  import { DocSelectionManagerService } from "@univerjs/docs";
11
- import { IDescriptionService } from "@univerjs/formula";
12
11
  import { CheckMarkIcon, CloseIcon, DatabaseFunctionIcon, DateFunctionIcon, DeleteIcon, EngineeringFunctionIcon, FinancialFunctionIcon, FunctionIcon, IncreaseIcon, InformationFunctionIcon, LogicalFunctionIcon, LookupFunctionIcon, MathFunctionIcon, MoreRightIcon, SelectRangeIcon, StatisticalFunctionIcon, TextFunctionIcon } from "@univerjs/icons";
13
12
  import { Button, Dialog, Input, Select, Tooltip, borderClassName, borderLeftClassName, borderTopClassName, clsx, divideYClassName, scrollbarClassName } from "@univerjs/design";
14
13
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
15
14
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
- import { buildFormulaTextRuns, getFormulaHighlightDataStream, getFormulaReplaceResult, isFormulaReferenceAddingContext, isFormulaReferenceAddingTextContext, searchFormulaFunctions } from "@univerjs/formula-ui";
17
15
  import { debounceTime as debounceTime$1 } from "rxjs/operators";
18
16
 
19
17
  //#region src/commands/commands/formula-clipboard.command.ts
@@ -33,7 +31,7 @@ const SheetOnlyPasteFormulaCommand = {
33
31
  };
34
32
 
35
33
  //#endregion
36
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
34
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
37
35
  function _typeof(o) {
38
36
  "@babel/helpers - typeof";
39
37
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -44,7 +42,7 @@ function _typeof(o) {
44
42
  }
45
43
 
46
44
  //#endregion
47
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
45
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
48
46
  function toPrimitive(t, r) {
49
47
  if ("object" != _typeof(t) || !t) return t;
50
48
  var e = t[Symbol.toPrimitive];
@@ -57,14 +55,14 @@ function toPrimitive(t, r) {
57
55
  }
58
56
 
59
57
  //#endregion
60
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
58
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
61
59
  function toPropertyKey(t) {
62
60
  var i = toPrimitive(t, "string");
63
61
  return "symbol" == _typeof(i) ? i : i + "";
64
62
  }
65
63
 
66
64
  //#endregion
67
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
65
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
68
66
  function _defineProperty(e, r, t) {
69
67
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
70
68
  value: t,
@@ -75,7 +73,7 @@ function _defineProperty(e, r, t) {
75
73
  }
76
74
 
77
75
  //#endregion
78
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
76
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
79
77
  function __decorateParam(paramIndex, decorator) {
80
78
  return function(target, key) {
81
79
  decorator(target, key, paramIndex);
@@ -83,7 +81,7 @@ function __decorateParam(paramIndex, decorator) {
83
81
  }
84
82
 
85
83
  //#endregion
86
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
84
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
87
85
  function __decorate(decorators, target, key, desc) {
88
86
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
87
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -329,7 +327,8 @@ const InsertFunctionOperation = {
329
327
  editColumn = column;
330
328
  return true;
331
329
  }
332
- const formulaString = `=${value}(${serializeRange(refRange)})`;
330
+ const rangeString = serializeRange(refRange);
331
+ const formulaString = `=${value}(${rangeString})`;
333
332
  list.push({
334
333
  range,
335
334
  primary: {
@@ -342,12 +341,13 @@ const InsertFunctionOperation = {
342
341
  const { startRow, startColumn, endRow, endColumn } = range;
343
342
  if (startRow === endRow) {
344
343
  const blankCellColumn = findBlankCellOfRow(cellMatrix, startRow, endColumn, worksheet.getColumnCount() - 1);
345
- const formulaString = `=${value}(${serializeRange({
344
+ const rangeString = serializeRange({
346
345
  startRow,
347
346
  endRow,
348
347
  startColumn,
349
348
  endColumn: blankCellColumn === endColumn ? endColumn - 1 : endColumn
350
- })})`;
349
+ });
350
+ const formulaString = `=${value}(${rangeString})`;
351
351
  listOfRangeHasNumber.push({
352
352
  range,
353
353
  primary: {
@@ -364,12 +364,13 @@ const InsertFunctionOperation = {
364
364
  }
365
365
  const newEndRow = maxBlankCellRow === endRow ? endRow - 1 : endRow;
366
366
  for (let c = startColumn; c <= endColumn; c++) {
367
- const formulaString = `=${value}(${serializeRange({
367
+ const rangeString = serializeRange({
368
368
  startRow,
369
369
  endRow: newEndRow,
370
370
  startColumn: c,
371
371
  endColumn: c
372
- })})`;
372
+ });
373
+ const formulaString = `=${value}(${rangeString})`;
373
374
  listOfRangeHasNumber.push({
374
375
  range,
375
376
  primary: {
@@ -745,7 +746,7 @@ let FormulaReorderController = class FormulaReorderController extends Disposable
745
746
  const redos = [];
746
747
  const undos = [];
747
748
  const { unitId, subUnitId, range, order } = params;
748
- const workbook = this._univerInstanceService.getUniverSheetInstance(unitId);
749
+ const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
749
750
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
750
751
  if (!worksheet) return {
751
752
  redos,
@@ -994,7 +995,7 @@ const menuSchema = {
994
995
  //#endregion
995
996
  //#region package.json
996
997
  var name = "@univerjs/sheets-formula-ui";
997
- var version = "1.0.0-alpha.7";
998
+ var version = "1.0.0-alpha.8";
998
999
 
999
1000
  //#endregion
1000
1001
  //#region src/config/config.ts
@@ -1321,14 +1322,16 @@ const useFormulaDescribe = (isNeed, formulaText, editor) => {
1321
1322
  const currentSequenceNode = formulaPromptService.getCurrentSequenceNodeByIndex(nodeIndex);
1322
1323
  const nextSequenceNode = formulaPromptService.getCurrentSequenceNodeByIndex(nodeIndex + 1);
1323
1324
  if (currentSequenceNode) if (typeof currentSequenceNode !== "string" && currentSequenceNode.nodeType === 3 && !descriptionService.hasDefinedNameDescription(currentSequenceNode.token.trim()) && nextSequenceNode === matchToken.OPEN_BRACKET) {
1324
- setFunctionInfo(descriptionService.getFunctionInfo(currentSequenceNode.token));
1325
+ const info = descriptionService.getFunctionInfo(currentSequenceNode.token);
1326
+ setFunctionInfo(info);
1325
1327
  setParamIndex(-1);
1326
1328
  return;
1327
1329
  } else {
1328
1330
  const res = lexerTreeBuilder.getFunctionAndParameter(`${formulaTextRef.current}A`, startOffset - 1);
1329
1331
  if (res) {
1330
1332
  const { functionName, paramIndex } = res;
1331
- setFunctionInfo(descriptionService.getFunctionInfo(functionName));
1333
+ const info = descriptionService.getFunctionInfo(functionName);
1334
+ setFunctionInfo(info);
1332
1335
  setParamIndex(paramIndex);
1333
1336
  return;
1334
1337
  }
@@ -1933,8 +1936,8 @@ function useFormulaSelecting(opts) {
1933
1936
  const { editor, editorId, isFocus, disableOnClick, unitId, subUnitId } = opts;
1934
1937
  const renderManagerService = useDependency(IRenderManagerService);
1935
1938
  const univerInstanceService = useDependency(IUniverInstanceService);
1936
- const sheetRenderer = renderManagerService.getRenderById(unitId);
1937
- const renderer = renderManagerService.getRenderById(editorId);
1939
+ const sheetRenderer = renderManagerService.getRenderUnitById(unitId);
1940
+ const renderer = renderManagerService.getRenderUnitById(editorId);
1938
1941
  const docSelectionRenderService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocSelectionRenderService);
1939
1942
  const docSelectionManagerService = useDependency(DocSelectionManagerService);
1940
1943
  const injector = useDependency(Injector);
@@ -2163,7 +2166,7 @@ function useSheetHighlight(unitId, subUnitId) {
2163
2166
  const themeService = useDependency(ThemeService);
2164
2167
  const refSelectionsService = useDependency(IRefSelectionsService);
2165
2168
  const renderManagerService = useDependency(IRenderManagerService);
2166
- const ownerRender = renderManagerService.getRenderById(unitId);
2169
+ const ownerRender = renderManagerService.getRenderUnitById(unitId);
2167
2170
  const ownerRefSelectionsRenderService = ownerRender === null || ownerRender === void 0 ? void 0 : ownerRender.with(RefSelectionsRenderService);
2168
2171
  const getHighlightWorkbook = useEvent((refSelections) => {
2169
2172
  const ownerWorkbook = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
@@ -2175,7 +2178,7 @@ function useSheetHighlight(unitId, subUnitId) {
2175
2178
  var _currentWorkbook$getA;
2176
2179
  const currentWorkbook = getHighlightWorkbook(refSelections);
2177
2180
  if (!currentWorkbook) return;
2178
- const currentRender = renderManagerService.getRenderById(currentWorkbook.getUnitId());
2181
+ const currentRender = renderManagerService.getRenderUnitById(currentWorkbook.getUnitId());
2179
2182
  const refSelectionsRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(RefSelectionsRenderService);
2180
2183
  const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
2181
2184
  const sheetSkeletonManagerService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService);
@@ -2231,7 +2234,7 @@ function useDocHight(_leadingCharacter = "") {
2231
2234
  e.ed = e.ed + leadingCharacterLength;
2232
2235
  e.st = e.st + leadingCharacterLength;
2233
2236
  });
2234
- const highlightDataStream = getFormulaHighlightDataStream$1(_leadingCharacter, sequenceNodes, sourceText);
2237
+ const highlightDataStream = getFormulaHighlightDataStream(_leadingCharacter, sequenceNodes, sourceText);
2235
2238
  const highlightTextRuns = [{
2236
2239
  st: 0,
2237
2240
  ed: 1,
@@ -2266,9 +2269,6 @@ function createFormulaHighlightBody(dataStream, textRuns) {
2266
2269
  textRuns
2267
2270
  };
2268
2271
  }
2269
- function getFormulaHighlightDataStream$1(leadingCharacter, sequenceNodes, sourceText) {
2270
- return getFormulaHighlightDataStream(leadingCharacter, sequenceNodes, sourceText);
2271
- }
2272
2272
  function useColor() {
2273
2273
  const themeService = useDependency(ThemeService);
2274
2274
  return useMemo(() => {
@@ -2477,7 +2477,7 @@ const useRefactorEffect = (isNeed, selecting, unitId, editorId, disableContextMe
2477
2477
  const refSelectionsService = useDependency(IRefSelectionsService);
2478
2478
  const univerInstanceService = useDependency(IUniverInstanceService);
2479
2479
  const currentUnit = useObservable(useMemo(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), [univerInstanceService]));
2480
- const render = renderManagerService.getRenderById((_currentUnit$getUnitI = currentUnit === null || currentUnit === void 0 ? void 0 : currentUnit.getUnitId()) !== null && _currentUnit$getUnitI !== void 0 ? _currentUnit$getUnitI : "");
2480
+ const render = renderManagerService.getRenderUnitById((_currentUnit$getUnitI = currentUnit === null || currentUnit === void 0 ? void 0 : currentUnit.getUnitId()) !== null && _currentUnit$getUnitI !== void 0 ? _currentUnit$getUnitI : "");
2481
2481
  const refSelectionsRenderService = render === null || render === void 0 ? void 0 : render.with(RefSelectionsRenderService);
2482
2482
  useLayoutEffect(() => {
2483
2483
  if (isNeed) {
@@ -2721,7 +2721,7 @@ const useSheetSelectionChange = (isNeed, isFocus, isSelectingRef, unitId, subUni
2721
2721
  sheetName
2722
2722
  });
2723
2723
  const activeWorkbook = resolveFormulaSelectionWorkbook(useObservable(useMemo(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), [univerInstanceService])), workbook);
2724
- const render = renderManagerService.getRenderById((_activeWorkbook$getUn = activeWorkbook === null || activeWorkbook === void 0 ? void 0 : activeWorkbook.getUnitId()) !== null && _activeWorkbook$getUn !== void 0 ? _activeWorkbook$getUn : unitId);
2724
+ const render = renderManagerService.getRenderUnitById((_activeWorkbook$getUn = activeWorkbook === null || activeWorkbook === void 0 ? void 0 : activeWorkbook.getUnitId()) !== null && _activeWorkbook$getUn !== void 0 ? _activeWorkbook$getUn : unitId);
2725
2725
  const refSelectionsRenderService = render === null || render === void 0 ? void 0 : render.with(RefSelectionsRenderService);
2726
2726
  const sheetSkeletonManagerService = render === null || render === void 0 ? void 0 : render.with(SheetSkeletonManagerService);
2727
2727
  const refSelectionsService = useDependency(IRefSelectionsService);
@@ -3022,7 +3022,7 @@ const useSheetSelectionChange = (isNeed, isFocus, isSelectingRef, unitId, subUni
3022
3022
  const useSwitchSheet = (isNeed, unitId, isSupportAcrossSheet, isFocusSet, onBlur, refresh) => {
3023
3023
  const commandService = useDependency(ICommandService);
3024
3024
  const editorService = useDependency(IEditorService);
3025
- const render = useDependency(IRenderManagerService).getRenderById(unitId);
3025
+ const render = useDependency(IRenderManagerService).getRenderUnitById(unitId);
3026
3026
  const univerInstanceService = useDependency(IUniverInstanceService);
3027
3027
  const refSelectionsRenderService = render === null || render === void 0 ? void 0 : render.with(RefSelectionsRenderService);
3028
3028
  useEffect(() => {
@@ -3113,7 +3113,8 @@ const useFormulaSearch = (isNeed, nodes = [], editor) => {
3113
3113
  if (currentNode && typeof currentNode !== "string" && currentNode.nodeType === sequenceNodeType.FUNCTION) {
3114
3114
  indexRef.current = currentNodeIndex;
3115
3115
  const token = currentNode.token;
3116
- setSearchList(searchFormulaFunctions(descriptionService, token));
3116
+ const list = searchFormulaFunctions(descriptionService, token);
3117
+ setSearchList(list);
3117
3118
  setSearchText(token);
3118
3119
  return;
3119
3120
  }
@@ -3378,7 +3379,7 @@ const FormulaEditor = forwardRef((props, ref) => {
3378
3379
  disableOnClick: disableSelectionOnClick
3379
3380
  });
3380
3381
  const highTextRef = useRef("");
3381
- const renderer = useDependency(IRenderManagerService).getRenderById(editorId);
3382
+ const renderer = useDependency(IRenderManagerService).getRenderUnitById(editorId);
3382
3383
  const docSelectionRenderService = renderer === null || renderer === void 0 ? void 0 : renderer.with(DocSelectionRenderService);
3383
3384
  const isFocusing = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing;
3384
3385
  const currentDoc = useObservable(useMemo(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC), [univerInstanceService]));
@@ -3816,11 +3817,13 @@ function SelectFunction(props) {
3816
3817
  };
3817
3818
  function handleSelectChange(value) {
3818
3819
  setTypeSelected(value);
3819
- setSelectList(descriptionService.getSearchListByType(+value));
3820
+ const selectList = descriptionService.getSearchListByType(+value);
3821
+ setSelectList(selectList);
3820
3822
  }
3821
3823
  function handleSearchInputChange(value) {
3822
3824
  setSearchText(value);
3823
- setSelectList(descriptionService.getSearchListByName(value));
3825
+ const selectList = descriptionService.getSearchListByName(value);
3826
+ setSelectList(selectList);
3824
3827
  }
3825
3828
  function handleSelectListKeyDown(e) {
3826
3829
  e.stopPropagation();
@@ -4079,11 +4082,12 @@ function useRangeSelectorSelectionChange(opts) {
4079
4082
  if (!supportAcrossSheet && currentSheet.getSheetId() !== subUnitId) return;
4080
4083
  if (!(selections === null || selections === void 0 ? void 0 : selections.length)) return;
4081
4084
  const sheetName = keepSheetReference ? currentSheet.getName() : currentSheet.getSheetId() === subUnitId ? "" : currentSheet.getName();
4082
- onChange(selections.map((item) => ({
4085
+ const ranges = selections.map((item) => ({
4083
4086
  range: item.range,
4084
4087
  unitId,
4085
4088
  sheetName
4086
- })), isStart);
4089
+ }));
4090
+ onChange(ranges, isStart);
4087
4091
  });
4088
4092
  useEffect(() => {
4089
4093
  const disposableCollection = new DisposableCollection();
@@ -4196,7 +4200,8 @@ function RangeSelectorDialog(props) {
4196
4200
  });
4197
4201
  } else {
4198
4202
  newRanges.splice(focusIndex, 1, ...addedRanges);
4199
- setRanges(newRanges.slice(0, maxRangeCount));
4203
+ const finalRanges = newRanges.slice(0, maxRangeCount);
4204
+ setRanges(finalRanges);
4200
4205
  setFocusIndex(focusIndex + addedRanges.length - 1);
4201
4206
  }
4202
4207
  }
@@ -4357,10 +4362,9 @@ function RangeSelector(props) {
4357
4362
  maxRangeCount,
4358
4363
  onConfirm: (ranges) => {
4359
4364
  const resultStr = stringifyRanges(ranges);
4360
- const empty = RichTextBuilder.newEmptyData();
4361
- empty.body.dataStream = resultStr;
4365
+ const documentData = RichTextBuilder.create().insertText(resultStr).getData();
4362
4366
  editor === null || editor === void 0 || editor.replaceText(resultStr, false);
4363
- onChange === null || onChange === void 0 || onChange(empty, resultStr);
4367
+ onChange === null || onChange === void 0 || onChange(documentData, resultStr);
4364
4368
  setPopupVisible(false);
4365
4369
  setRangeSelectorRanges([]);
4366
4370
  requestAnimationFrame(() => {
@@ -4647,7 +4651,7 @@ function getSetCellFormulaMutations(unitId, subUnitId, range, matrix, accessor,
4647
4651
  const setValuesMutation = {
4648
4652
  unitId,
4649
4653
  subUnitId,
4650
- cellValue: valueMatrix.getData()
4654
+ cellValue: valueMatrix.clone()
4651
4655
  };
4652
4656
  redoMutationsInfo.push({
4653
4657
  id: SetRangeValuesMutation.id,
@@ -4990,7 +4994,7 @@ let FormulaEditorShowController = class FormulaEditorShowController extends Disp
4990
4994
  return cellInfo;
4991
4995
  }
4992
4996
  _createArrayFormulaRangeShape(arrayRange, unitId, subUnitId) {
4993
- const renderUnit = this._renderManagerService.getRenderById(unitId);
4997
+ const renderUnit = this._renderManagerService.getRenderUnitById(unitId);
4994
4998
  const skeleton = this._sheetSkeletonService.getSkeleton(unitId, subUnitId);
4995
4999
  if (!renderUnit || !skeleton) return;
4996
5000
  const { scene } = renderUnit;
@@ -5127,7 +5131,7 @@ let ImageFormulaRenderController = class ImageFormulaRenderController extends Di
5127
5131
  this._imageFormulaCellInterceptorController.registerRefreshRenderFunction(() => {
5128
5132
  const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
5129
5133
  if (!workbook) return;
5130
- const render = this._renderManagerService.getRenderById(workbook.getUnitId());
5134
+ const render = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
5131
5135
  if (!render) return;
5132
5136
  render.with(SheetSkeletonManagerService).reCalculate();
5133
5137
  const mainComponent = render.mainComponent;
@@ -5353,7 +5357,7 @@ _defineProperty(UniverSheetsFormulaUIPlugin, "packageName", name);
5353
5357
  _defineProperty(UniverSheetsFormulaUIPlugin, "version", version);
5354
5358
  _defineProperty(UniverSheetsFormulaUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
5355
5359
  UniverSheetsFormulaUIPlugin = __decorate([
5356
- DependentOn(UniverSheetsFormulaPlugin),
5360
+ DependentOn(UniverFormulaEnginePlugin, UniverRenderEnginePlugin, UniverSheetsPlugin, UniverUIPlugin, UniverSheetsFormulaPlugin, UniverSheetsUIPlugin),
5357
5361
  __decorateParam(1, Inject(Injector)),
5358
5362
  __decorateParam(2, IRenderManagerService),
5359
5363
  __decorateParam(3, IConfigService),