@univerjs/sheets-ui 1.0.0-alpha.1 → 1.0.0-alpha.3

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.
Files changed (114) hide show
  1. package/lib/cjs/facade.js +51 -40
  2. package/lib/cjs/index.js +1187 -287
  3. package/lib/cjs/locale/ar-SA.js +7 -2
  4. package/lib/cjs/locale/ca-ES.js +7 -2
  5. package/lib/cjs/locale/de-DE.js +7 -2
  6. package/lib/cjs/locale/en-US.js +5 -0
  7. package/lib/cjs/locale/es-ES.js +8 -3
  8. package/lib/cjs/locale/fa-IR.js +7 -2
  9. package/lib/cjs/locale/fr-FR.js +7 -2
  10. package/lib/cjs/locale/id-ID.js +7 -2
  11. package/lib/cjs/locale/it-IT.js +7 -2
  12. package/lib/cjs/locale/ja-JP.js +5 -0
  13. package/lib/cjs/locale/ko-KR.js +5 -0
  14. package/lib/cjs/locale/pl-PL.js +7 -2
  15. package/lib/cjs/locale/pt-BR.js +7 -2
  16. package/lib/cjs/locale/ru-RU.js +7 -2
  17. package/lib/cjs/locale/sk-SK.js +7 -2
  18. package/lib/cjs/locale/vi-VN.js +7 -2
  19. package/lib/cjs/locale/zh-CN.js +5 -0
  20. package/lib/cjs/locale/zh-HK.js +5 -0
  21. package/lib/cjs/locale/zh-TW.js +5 -0
  22. package/lib/es/facade.js +51 -40
  23. package/lib/es/index.js +1168 -264
  24. package/lib/es/locale/ar-SA.js +7 -2
  25. package/lib/es/locale/ca-ES.js +7 -2
  26. package/lib/es/locale/de-DE.js +7 -2
  27. package/lib/es/locale/en-US.js +5 -0
  28. package/lib/es/locale/es-ES.js +8 -3
  29. package/lib/es/locale/fa-IR.js +7 -2
  30. package/lib/es/locale/fr-FR.js +7 -2
  31. package/lib/es/locale/id-ID.js +7 -2
  32. package/lib/es/locale/it-IT.js +7 -2
  33. package/lib/es/locale/ja-JP.js +5 -0
  34. package/lib/es/locale/ko-KR.js +5 -0
  35. package/lib/es/locale/pl-PL.js +7 -2
  36. package/lib/es/locale/pt-BR.js +7 -2
  37. package/lib/es/locale/ru-RU.js +7 -2
  38. package/lib/es/locale/sk-SK.js +7 -2
  39. package/lib/es/locale/vi-VN.js +7 -2
  40. package/lib/es/locale/zh-CN.js +5 -0
  41. package/lib/es/locale/zh-HK.js +5 -0
  42. package/lib/es/locale/zh-TW.js +5 -0
  43. package/lib/facade.js +51 -40
  44. package/lib/index.css +42 -4
  45. package/lib/index.js +1168 -264
  46. package/lib/locale/ar-SA.js +7 -2
  47. package/lib/locale/ca-ES.js +7 -2
  48. package/lib/locale/de-DE.js +7 -2
  49. package/lib/locale/en-US.js +5 -0
  50. package/lib/locale/es-ES.js +8 -3
  51. package/lib/locale/fa-IR.js +7 -2
  52. package/lib/locale/fr-FR.js +7 -2
  53. package/lib/locale/id-ID.js +7 -2
  54. package/lib/locale/it-IT.js +7 -2
  55. package/lib/locale/ja-JP.js +5 -0
  56. package/lib/locale/ko-KR.js +5 -0
  57. package/lib/locale/pl-PL.js +7 -2
  58. package/lib/locale/pt-BR.js +7 -2
  59. package/lib/locale/ru-RU.js +7 -2
  60. package/lib/locale/sk-SK.js +7 -2
  61. package/lib/locale/vi-VN.js +7 -2
  62. package/lib/locale/zh-CN.js +5 -0
  63. package/lib/locale/zh-HK.js +5 -0
  64. package/lib/locale/zh-TW.js +5 -0
  65. package/lib/types/commands/commands/set-scroll.command.d.ts +3 -0
  66. package/lib/types/controllers/editor/editing.render-controller.d.ts +1 -0
  67. package/lib/types/controllers/editor/formula-editor.controller.d.ts +1 -0
  68. package/lib/types/controllers/render-controllers/contextmenu.render-controller.d.ts +7 -2
  69. package/lib/types/controllers/render-controllers/editor-bridge.render-controller.d.ts +7 -1
  70. package/lib/types/controllers/render-controllers/header-unhide.render-controller.d.ts +0 -1
  71. package/lib/types/embed-tab-anchor.d.ts +23 -0
  72. package/lib/types/facade/f-range.d.ts +5 -4
  73. package/lib/types/facade/f-univer.d.ts +1 -0
  74. package/lib/types/index.d.ts +16 -3
  75. package/lib/types/locale/en-US.d.ts +5 -0
  76. package/lib/types/services/canvas-pop-manager.service.d.ts +9 -0
  77. package/lib/types/services/cell-popup-manager.service.d.ts +1 -0
  78. package/lib/types/services/editor/cell-editor-resize.service.d.ts +4 -1
  79. package/lib/types/services/editor-bridge.service.d.ts +2 -0
  80. package/lib/types/services/print-interceptor.service.d.ts +8 -0
  81. package/lib/types/services/selection/base-selection-render.service.d.ts +1 -0
  82. package/lib/types/services/sheet-embed-integration.service.d.ts +126 -0
  83. package/lib/types/services/sheet-embed-runtime.service.d.ts +26 -0
  84. package/lib/types/services/sheet-host-chrome-override.service.d.ts +25 -0
  85. package/lib/types/services/sheet-skeleton-manager.service.d.ts +2 -0
  86. package/lib/types/views/border-panel/interface.d.ts +63 -2
  87. package/lib/types/views/editor-container/EditorContainer.d.ts +7 -5
  88. package/lib/types/{menu/mobile-menu.d.ts → views/editor-container/EditorContainer.spec.d.ts} +1 -1
  89. package/lib/types/views/editor-container/focus-editor.d.ts +25 -0
  90. package/lib/types/views/sheet-bar/sheet-bar-tabs/SheetBarItem.d.ts +2 -1
  91. package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-drag-sort.d.ts +1 -0
  92. package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/slide-tab-bar.d.ts +2 -1
  93. package/lib/umd/facade.js +1 -1
  94. package/lib/umd/index.js +12 -12
  95. package/lib/umd/locale/ar-SA.js +1 -1
  96. package/lib/umd/locale/ca-ES.js +1 -1
  97. package/lib/umd/locale/de-DE.js +1 -1
  98. package/lib/umd/locale/en-US.js +1 -1
  99. package/lib/umd/locale/es-ES.js +1 -1
  100. package/lib/umd/locale/fa-IR.js +1 -1
  101. package/lib/umd/locale/fr-FR.js +1 -1
  102. package/lib/umd/locale/id-ID.js +1 -1
  103. package/lib/umd/locale/it-IT.js +1 -1
  104. package/lib/umd/locale/ja-JP.js +1 -1
  105. package/lib/umd/locale/ko-KR.js +1 -1
  106. package/lib/umd/locale/pl-PL.js +1 -1
  107. package/lib/umd/locale/pt-BR.js +1 -1
  108. package/lib/umd/locale/ru-RU.js +1 -1
  109. package/lib/umd/locale/sk-SK.js +1 -1
  110. package/lib/umd/locale/vi-VN.js +1 -1
  111. package/lib/umd/locale/zh-CN.js +1 -1
  112. package/lib/umd/locale/zh-HK.js +1 -1
  113. package/lib/umd/locale/zh-TW.js +1 -1
  114. package/package.json +16 -16
package/lib/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { BreakLineCommand, CoverContentCommand, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, DOC_VERTICAL_PADDING, DeleteLeftCommand, DeleteRightCommand, DocSelectionRenderService, IEditorService, IMEInputCommand, MoveCursorOperation, MoveSelectionOperation, NodePositionConvertToCursor, ReplaceSnapshotCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand, VIEWPORT_KEY, convertBodyToHtml, getCanvasOffsetByEngine, getLineBounding } from "@univerjs/docs-ui";
2
- import { AbsoluteRefType, BaselineOffset, BooleanNumber, BorderStyleTypes, CellModeEnum, CellValueType, ColorKit, CommandType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_HEIGHT, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DependentOn, Direction, Disposable, DisposableCollection, DocumentFlavor, EDITOR_ACTIVATED, ErrorService, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_UNIVER_EDITOR, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, LocaleType, NilCommand, ObjectMatrix, Optional, Plugin, PresetListType, Quantity, RANGE_TYPE, Range, Rectangle, RxDisposable, ThemeService, Tools, UndoCommandId, UniverInstanceType, UserManagerService, VerticalAlign, Workbook, WrapStrategy, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, composeStyles, convertCellToRange, createIdentifier, createInterceptorKey, createParagraphId, dateKit, debounce, extractPureTextFromCell, fromEventSubject, generateRandomId, get, getEmptyCell, getNumfmtParseValueFilter, getReverseDirection, handleStyleToString, isDefaultFormat, isFormulaString, isNotNullOrUndefined, isRealNum, isSafeUrl, isTextFormat, isValidRange, merge, mergeOverrideWithDependencies, nameCharacterCheck, numfmt, registerDependencies, sequenceExecute, set, skipParseTagNames, sortRules, splitIntoGrid, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
2
+ import { AbsoluteRefType, BaselineOffset, BooleanNumber, BorderStyleTypes, CellModeEnum, CellValueType, ColorKit, CommandType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_HEIGHT, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DependentOn, Direction, Disposable, DisposableCollection, DocumentFlavor, EDITOR_ACTIVATED, ErrorService, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_EDITOR_BUT_HIDDEN, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_UNIVER_EDITOR, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, LocaleType, LookUp, NilCommand, ObjectMatrix, Optional, Plugin, PresetListType, Quantity, RANGE_TYPE, Range, Rectangle, RxDisposable, ThemeService, Tools, UndoCommandId, UniverInstanceType, UserManagerService, VerticalAlign, Workbook, WrapStrategy, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, composeStyles, convertCellToRange, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, dateKit, debounce, extractPureTextFromCell, fromEventSubject, generateRandomId, get, getEmptyCell, getNumfmtParseValueFilter, getReverseDirection, handleStyleToString, isDefaultFormat, isFormulaString, isInternalEditorID, isNotNullOrUndefined, isRealNum, isSafeUrl, isTextFormat, isValidRange, merge, mergeOverrideWithDependencies, nameCharacterCheck, numfmt, registerDependencies, sequenceExecute, set, skipParseTagNames, sortRules, splitIntoGrid, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
3
3
  import { AnchoredContextMenu, BuiltInUIPart, COLOR_PICKER_COMPONENT, ComponentContainer, ComponentManager, ContextMenuGroup, ContextMenuPosition, CopyCommand, CutCommand, DISABLE_AUTO_FOCUS_KEY, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HTML_CLIPBOARD_MIME_TYPE, ICanvasPopupService, IClipboardInterfaceService, IContextMenuService, IDialogService, ILayoutService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IShortcutService, ISidebarService, IUIPartsService, IconManager, KeyCode, MenuItemType, MetaKeys, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, RibbonDataGroup, RibbonPosition, RibbonStartGroup, SheetPasteShortKeyCommandName, Slider, ToolbarItem, UI_PLUGIN_CONFIG_KEY, UniverMobileUIPlugin, connectInjector, getMenuHiddenObservable, handleStringToStyle, imageMimeTypeSet, sanitizeParsedHtml, textTrim, useComponentsOfPart, useConfigValue, useDependency, useEvent, useObservable, useSidebarClick, useVirtualList } from "@univerjs/ui";
4
4
  import { CURSOR_TYPE, DashedRect, DeviceInputEventType, FIX_ONE_PIXEL_BLUR_OFFSET, Group, IRenderManagerService, Layer, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, Rect, RegularPolygon, SHEET_EXTENSION_PREFIX, SHEET_VIEWPORT_KEY, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetExtension, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetRowHeader, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Vector2, Viewport, cancelRequestFrame, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, fixLineWidthByScale, getCurrentTypeOfRenderer, getNextWheelZoomRatio, ptToPixel, requestNewFrame, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
5
5
  import { AUTO_FILL_APPLY_TYPE, AUTO_FILL_HOOK_TYPE, AddMergeUndoMutationFactory, AddRangeProtectionCommand, AddRangeProtectionMutation, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeMutation, AddWorksheetMergeVerticalCommand, AddWorksheetProtectionCommand, AutoClearContentCommand, AutoFillCommand, AutoFillController, BEFORE_CELL_EDIT, BorderStyleManagerService, COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, CancelMarkDirtyRowAutoHeightOperation, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionCommand, DeltaColumnWidthCommand, DeltaRowHeightCommand, EditStateEnum, IAutoFillService, IExclusiveRangeService, INTERCEPTOR_POINT, INumfmtService, IRefSelectionsService, InsertColBeforeCommand, InsertColCommand, InsertColMutation, InsertDefinedNameCommand, InsertMultiColsLeftCommand, InsertMultiColsRightCommand, InsertMultiRowsAboveCommand, InsertMultiRowsAfterCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowBeforeCommand, InsertRowCommand, InsertRowMutation, InsertSheetCommand, InsertSheetMutation, MAX_CELL_PER_SHEET_KEY, MERGE_CELL_INTERCEPTOR_CHECK, MarkDirtyRowAutoHeightOperation, MergeCellController, MoveColsCommand, MoveColsMutation, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, REF_SELECTIONS_ENABLED, RangeProtectionCache, RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RefRangeService, RefSelectionsService, RefillCommand, RemoveColCommand, RemoveColMutation, RemoveDefinedNameCommand, RemoveMergeUndoMutationFactory, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, RemoveSheetMutation, RemoveWorksheetMergeCommand, RemoveWorksheetMergeMutation, ResetBackgroundColorCommand, ResetTextColorCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SELECTIONS_ENABLED, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SHEETS_PLUGIN_CONFIG_KEY, ScrollToCellOperation, SelectionMoveType, SetBackgroundColorCommand, SetBoldCommand, SetBorderBasicCommand, SetBorderCommand, SetColHiddenCommand, SetColHiddenMutation, SetColVisibleMutation, SetColWidthCommand, SetDefinedNameCommand, SetFontFamilyCommand, SetFontSizeCommand, SetFrozenCommand, SetFrozenMutation, SetFrozenMutationFactory, SetHorizontalTextAlignCommand, SetItalicCommand, SetProtectionCommand, SetRangeValuesCommand, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetRowHeightCommand, SetRowHiddenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedColsVisibleCommand, SetSelectedRowsVisibleCommand, SetSelectionsOperation, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStrikeThroughCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SetWorksheetColWidthMutation, SetWorksheetColWidthMutationFactory, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetNameMutation, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetPermissionPointsCommand, SetWorksheetRowAutoHeightMutation, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowHeightMutation, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetCopyDownCommand, SheetCopyRightCommand, SheetInterceptorService, SheetPermissionCheckController, SheetPermissionInitController, SheetSkeletonService, SheetsSelectionsService, TextToNumberCommand, ToggleCellCheckboxCommand, ToggleGridlinesCommand, ToggleGridlinesMutation, UniverSheetsPlugin, ViewStateEnum, WorkbookCopyPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookEditablePermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookRenameSheetPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditPermission, WorksheetInsertColumnPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetViewPermission, adjustRangeOnMutation, alignToMergedCellsBorders, attachPrimaryWithCoord, attachRangeWithCoord, attachSelectionWithCoord, baseProtectionActions, convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, countCells, defaultLargeSheetOperationConfig, deserializeListOptions, discreteRangeToRange, expandToContinuousRange, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getCellAtRowCol, getClearContentMutationParamsForRanges, getMoveRangeCommandMutations, getPrimaryForRange, getSelectionsService, getSheetCommandTarget, rangeToDiscreteRange, serializeListOptions, setEndForRange, validateDefinedName } from "@univerjs/sheets";
6
6
  import { BehaviorSubject, EMPTY, Observable, Subject, Subscription, combineLatest, combineLatestWith, distinctUntilChanged, filter, map, merge as merge$1, of, shareReplay, startWith, switchMap, takeUntil, throttleTime, withLatestFrom } from "rxjs";
7
7
  import { DocSelectionManagerService, DocSkeletonManagerService, InsertTextCommand, RichTextEditingMutation, SetTextSelectionsOperation } from "@univerjs/docs";
8
8
  import { ObjectScope, UnitAction, UnitObject, UnitRole } from "@univerjs/protocol";
9
- import { Avatar, Button, Calendar, CascaderList, ColorPicker, Confirm, Dropdown, DropdownMenu, FormLayout, Input, InputNumber, MessageType, Radio, RadioGroup, Select, Separator, Switch, TimeInput, Tooltip, borderBottomClassName, borderClassName, borderRightClassName, borderTopClassName, clsx, scrollbarClassName } from "@univerjs/design";
10
- import { AddImageIcon, AdjustHeightDoubleIcon, AdjustWidthDoubleIcon, AlignBottomIcon, AlignTopIcon, AllBorderIcon, AutoHeightDoubleIcon, AutoWidthDoubleIcon, AutofillDoubleIcon, AutowrapIcon, BackSlashDoubleIcon, BoldIcon, BrushIcon, CancelFreezeIcon, CancelMergeIcon, CheckMarkIcon, ClearFormatDoubleIcon, CloseIcon, CodeIcon, ConvertIcon, CopyDoubleIcon, CutIcon, DeleteCellShiftLeftDoubleIcon, DeleteCellShiftUpDoubleIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DownBorderDoubleIcon, DownloadImageIcon, DropdownIcon, ErrorIcon, EyeOutlineIcon, EyelashIcon, FontColorDoubleIcon, FontSizeIncreaseIcon, FontSizeReduceIcon, FreezeColumnIcon, FreezeRowIcon, FreezeToSelectedIcon, FxIcon, HideDoubleIcon, HideGridlinesDoubleIcon, HorizontalBorderDoubleIcon, HorizontalMergeIcon, HorizontallyIcon, IncreaseIcon, InfoIcon, InnerBorderDoubleIcon, InsertCellDownDoubleIcon, InsertCellShiftRightDoubleIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, LeftBorderDoubleIcon, LeftDoubleDiagonalDoubleIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LeftRotationFortyFiveDegreesIcon, LeftRotationNinetyDegreesIcon, LeftTridiagonalDoubleIcon, LockIcon, MergeAllIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, NoBorderIcon, NoColorDoubleIcon, NoRotationIcon, OuterBorderDoubleIcon, OverflowIcon, PaintBucketDoubleIcon, PasteSpecialDoubleIcon, PenIcon, PipingIcon, ProtectIcon, ReduceDoubleIcon, RightBorderDoubleIcon, RightDoubleDiagonalDoubleIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, RightRotationFortyFiveDegreesIcon, RightRotationNinetyDegreesIcon, SlashDoubleIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, TruncationIcon, UnderlineIcon, UpBorderDoubleIcon, VerticalBorderDoubleIcon, VerticalCenterIcon, VerticalIntegrationIcon, VerticalTextIcon, WarningIcon, WriteIcon } from "@univerjs/icons";
11
- import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
9
+ import { Avatar, Button, Calendar, CascaderList, ColorPicker, ConfigContext, Confirm, Dropdown, DropdownMenu, FormLayout, Input, InputNumber, MessageType, Radio, RadioGroup, Select, Separator, Switch, TimeInput, Tooltip, borderBottomClassName, borderClassName, borderRightClassName, borderTopClassName, clsx, scrollbarClassName } from "@univerjs/design";
10
+ import { AddImageIcon, AdjustHeightDoubleIcon, AdjustWidthDoubleIcon, AlignBottomIcon, AlignTopIcon, AllBorderIcon, AutoHeightDoubleIcon, AutoWidthDoubleIcon, AutofillDoubleIcon, AutowrapIcon, BackSlashDoubleIcon, BoldIcon, BrushIcon, CancelFreezeIcon, CancelMergeIcon, CheckMarkIcon, ClearFormatDoubleIcon, CloseIcon, CodeIcon, ConvertIcon, CopyDoubleIcon, CutIcon, DeleteCellShiftLeftDoubleIcon, DeleteCellShiftUpDoubleIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DownBorderDoubleIcon, DownIcon, DownloadImageIcon, ErrorIcon, EyeIcon, EyelashIcon, FontColorDoubleIcon, FontSizeIncreaseIcon, FontSizeReduceIcon, FreezeColumnIcon, FreezeRowIcon, FreezeToSelectedIcon, FxIcon, HideDoubleIcon, HideGridlinesDoubleIcon, HorizontalBorderDoubleIcon, HorizontalMergeIcon, HorizontallyIcon, IncreaseIcon, InfoIcon, InnerBorderDoubleIcon, InsertCellDownDoubleIcon, InsertCellShiftRightDoubleIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, LeftBorderDoubleIcon, LeftDoubleDiagonalDoubleIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LeftRotationFortyFiveDegreesIcon, LeftRotationNinetyDegreesIcon, LeftTridiagonalDoubleIcon, LockIcon, MergeAllIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, NoBorderIcon, NoColorDoubleIcon, NoRotationIcon, OuterBorderDoubleIcon, OverflowIcon, PaintBucketDoubleIcon, PasteSpecialDoubleIcon, PenIcon, PipingIcon, ProtectIcon, ReduceDoubleIcon, RightBorderDoubleIcon, RightDoubleDiagonalDoubleIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, RightRotationFortyFiveDegreesIcon, RightRotationNinetyDegreesIcon, SlashDoubleIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, TruncationIcon, UnderlineIcon, UpBorderDoubleIcon, VerticalBorderDoubleIcon, VerticalCenterIcon, VerticalIntegrationIcon, VerticalTextIcon, WarningIcon, WriteIcon } from "@univerjs/icons";
11
+ import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
12
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
13
  import { FUNCTION_NAMES_MATH, FUNCTION_NAMES_STATISTICAL, FUNCTION_NAMES_TEXT, FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, LexerTreeBuilder, NullValueObject, SetFormulaCalculationNotificationMutation, deserializeRangeWithSheet, isReferenceStringWithEffectiveColumn, isReferenceStrings, matchToken, operatorToken, sequenceNodeType, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
14
14
  import { ITelemetryService } from "@univerjs/telemetry";
@@ -460,6 +460,19 @@ var BaseSelectionRenderService = class extends Disposable {
460
460
  this._initSelectionThemeFromThemeService();
461
461
  this._initMoving();
462
462
  }
463
+ dispose() {
464
+ var _this$_escapeShortcut;
465
+ if (this._disposed) return;
466
+ this._clearUpdatingListeners();
467
+ this._reset();
468
+ (_this$_escapeShortcut = this._escapeShortcutDisposable) === null || _this$_escapeShortcut === void 0 || _this$_escapeShortcut.dispose();
469
+ this._escapeShortcutDisposable = null;
470
+ this._controlFillConfig$.complete();
471
+ this._selectionMoveEnd$.complete();
472
+ this._selectionMoving$.complete();
473
+ this._selectionMoveStart$.complete();
474
+ super.dispose();
475
+ }
463
476
  /**
464
477
  * If true, the selector will respond to the range of merged cells and automatically extend the selected range. If false, it will ignore the merged cells.
465
478
  */
@@ -636,10 +649,10 @@ var BaseSelectionRenderService = class extends Disposable {
636
649
  }
637
650
  }
638
651
  endSelection() {
639
- var _this$_escapeShortcut;
652
+ var _this$_escapeShortcut2;
640
653
  this._clearUpdatingListeners();
641
654
  this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
642
- (_this$_escapeShortcut = this._escapeShortcutDisposable) === null || _this$_escapeShortcut === void 0 || _this$_escapeShortcut.dispose();
655
+ (_this$_escapeShortcut2 = this._escapeShortcutDisposable) === null || _this$_escapeShortcut2 === void 0 || _this$_escapeShortcut2.dispose();
643
656
  this._escapeShortcutDisposable = null;
644
657
  }
645
658
  /**
@@ -1087,10 +1100,7 @@ let SheetSkeletonManagerService = class SheetSkeletonManagerService extends Disp
1087
1100
  render.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM).setViewportSize({ top: size });
1088
1101
  render.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_ROW_TOP).setViewportSize({ top: size });
1089
1102
  render.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP).setViewportSize({ height: size });
1090
- const selectionService = render === null || render === void 0 ? void 0 : render.with(SheetsSelectionsService);
1091
- const selectionRenderService = render === null || render === void 0 ? void 0 : render.with(ISheetSelectionRenderService);
1092
- const currSelections = selectionService.getCurrentSelections();
1093
- selectionRenderService.resetSelectionsByModelData(currSelections);
1103
+ this._resetSelectionsIfAvailable(render);
1094
1104
  const sheetSkeletonManagerParam = this._sheetSkeletonService.getSkeletonParam(render.unitId, sheetId);
1095
1105
  if (sheetSkeletonManagerParam) {
1096
1106
  sheetSkeletonManagerParam.commandId = SetColumnHeaderHeightCommand.id;
@@ -1111,16 +1121,28 @@ let SheetSkeletonManagerService = class SheetSkeletonManagerService extends Disp
1111
1121
  const prevLeft = render.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT).left || 0;
1112
1122
  render.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT).setViewportSize({ left: prevLeft + deltaX });
1113
1123
  render.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP).setViewportSize({ width: size });
1114
- const selectionService = render === null || render === void 0 ? void 0 : render.with(SheetsSelectionsService);
1115
- const selectionRenderService = render === null || render === void 0 ? void 0 : render.with(ISheetSelectionRenderService);
1116
- const currSelections = selectionService.getCurrentSelections();
1117
- selectionRenderService.resetSelectionsByModelData(currSelections);
1124
+ this._resetSelectionsIfAvailable(render);
1118
1125
  const sheetSkeletonManagerParam = this._sheetSkeletonService.getSkeletonParam(render.unitId, sheetId);
1119
1126
  if (sheetSkeletonManagerParam) {
1120
1127
  sheetSkeletonManagerParam.commandId = SetRowHeaderWidthCommand.id;
1121
1128
  this._currentSkeleton$.next(sheetSkeletonManagerParam);
1122
1129
  }
1123
1130
  }
1131
+ _resetSelectionsIfAvailable(render) {
1132
+ const selectionService = this._tryGetRenderDependency(render, SheetsSelectionsService);
1133
+ const selectionRenderService = this._tryGetRenderDependency(render, ISheetSelectionRenderService);
1134
+ if (!selectionService || !selectionRenderService) return;
1135
+ const currSelections = selectionService.getCurrentSelections();
1136
+ selectionRenderService.resetSelectionsByModelData(currSelections);
1137
+ }
1138
+ _tryGetRenderDependency(render, dependency) {
1139
+ try {
1140
+ return render.with(dependency);
1141
+ } catch (error) {
1142
+ if (error instanceof Error && (error.message.includes("DependencyNotFoundError") || error.message.includes("Cannot find"))) return null;
1143
+ throw error;
1144
+ }
1145
+ }
1124
1146
  };
1125
1147
  SheetSkeletonManagerService = __decorate([__decorateParam(1, Inject(SheetSkeletonService))], SheetSkeletonManagerService);
1126
1148
 
@@ -1230,7 +1252,7 @@ var SelectionShapeExtension = class {
1230
1252
  ].forEach((control) => {
1231
1253
  control.onPointerEnter$.subscribeEvent(() => {
1232
1254
  var _this$_injector$get;
1233
- if (((_this$_injector$get = this._injector.get(ISheetSelectionRenderService, Quantity.OPTIONAL)) === null || _this$_injector$get === void 0 ? void 0 : _this$_injector$get.interceptor.fetchThroughInterceptors(RANGE_MOVE_PERMISSION_CHECK)(false, null)) === false) return;
1255
+ if (((_this$_injector$get = this._injector.get(ISheetSelectionRenderService, Quantity.OPTIONAL, LookUp.SELF)) === null || _this$_injector$get === void 0 ? void 0 : _this$_injector$get.interceptor.fetchThroughInterceptors(RANGE_MOVE_PERMISSION_CHECK)(false, null)) === false) return;
1234
1256
  control.setCursor(CURSOR_TYPE.MOVE);
1235
1257
  });
1236
1258
  control.onPointerLeave$.subscribeEvent(() => {
@@ -1335,7 +1357,7 @@ var SelectionShapeExtension = class {
1335
1357
  var _this$_injector$get2;
1336
1358
  if (this._disabled) return;
1337
1359
  const { offsetX: moveOffsetX, offsetY: moveOffsetY } = moveEvt;
1338
- if (((_this$_injector$get2 = this._injector.get(ISheetSelectionRenderService, Quantity.OPTIONAL)) === null || _this$_injector$get2 === void 0 ? void 0 : _this$_injector$get2.interceptor.fetchThroughInterceptors(RANGE_MOVE_PERMISSION_CHECK)(false, null)) === false) return;
1360
+ if (((_this$_injector$get2 = this._injector.get(ISheetSelectionRenderService, Quantity.OPTIONAL, LookUp.SELF)) === null || _this$_injector$get2 === void 0 ? void 0 : _this$_injector$get2.interceptor.fetchThroughInterceptors(RANGE_MOVE_PERMISSION_CHECK)(false, null)) === false) return;
1339
1361
  const { x: newMoveOffsetX, y: newMoveOffsetY } = scene.getCoordRelativeToViewport(Vector2.FromArray([moveOffsetX, moveOffsetY]));
1340
1362
  this._controlMoving(newMoveOffsetX, newMoveOffsetY);
1341
1363
  scene.setCursor(CURSOR_TYPE.MOVE);
@@ -1500,7 +1522,7 @@ var SelectionShapeExtension = class {
1500
1522
  _initialAutoFill() {
1501
1523
  const { fillControl } = this._control;
1502
1524
  fillControl.onPointerEnter$.subscribeEvent((evt) => {
1503
- if (!this._injector.get(ISheetSelectionRenderService).interceptor.fetchThroughInterceptors(RANGE_FILL_PERMISSION_CHECK)(false, {
1525
+ if (!this._injector.get(ISheetSelectionRenderService, LookUp.SELF).interceptor.fetchThroughInterceptors(RANGE_FILL_PERMISSION_CHECK)(false, {
1504
1526
  x: evt.offsetX,
1505
1527
  y: evt.offsetY,
1506
1528
  skeleton: this._skeleton,
@@ -1631,7 +1653,7 @@ var SelectionShapeExtension = class {
1631
1653
  var _this$_activeViewport;
1632
1654
  const { offsetX: moveOffsetX, offsetY: moveOffsetY } = moveEvt;
1633
1655
  const currentViewport = scene.getActiveViewportByCoord(Vector2.FromArray([moveOffsetX, moveOffsetY]));
1634
- if (!this._injector.get(ISheetSelectionRenderService).interceptor.fetchThroughInterceptors(RANGE_FILL_PERMISSION_CHECK)(false, {
1656
+ if (!this._injector.get(ISheetSelectionRenderService, LookUp.SELF).interceptor.fetchThroughInterceptors(RANGE_FILL_PERMISSION_CHECK)(false, {
1635
1657
  x: evt.offsetX,
1636
1658
  y: evt.offsetY,
1637
1659
  skeleton: this._skeleton,
@@ -7300,12 +7322,14 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
7300
7322
  this.disposeWithMe(viewportMain.onScrollByBar$.subscribeEvent((param) => {
7301
7323
  var _this$_sheetSkeletonM3;
7302
7324
  const skeleton = (_this$_sheetSkeletonM3 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM3 === void 0 ? void 0 : _this$_sheetSkeletonM3.skeleton;
7303
- if (skeleton == null || param.isTrigger === false) return;
7325
+ if (skeleton == null || param.isTrigger === false || param.isBarDragging && !param.isBarDragEnd) return;
7304
7326
  const sheetObject = this._getSheetObject();
7305
7327
  if (skeleton == null || sheetObject == null) return;
7306
7328
  const { viewportScrollX = 0, viewportScrollY = 0 } = param;
7307
7329
  const { row, column, rowOffset, columnOffset } = skeleton.getOffsetRelativeToRowCol(viewportScrollX, viewportScrollY);
7308
7330
  this._commandService.executeCommand(ScrollCommand.id, {
7331
+ unitId: this._context.unitId,
7332
+ sheetId: skeleton.getLocation()[1],
7309
7333
  sheetViewStartRow: row,
7310
7334
  sheetViewStartColumn: column,
7311
7335
  offsetX: columnOffset,
@@ -7393,8 +7417,11 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
7393
7417
  * @returns {boolean} - true if scroll is successful
7394
7418
  */
7395
7419
  scrollToCell(row, column, duration) {
7396
- const { ySplit: freezeYSplit, xSplit: freezeXSplit } = this._context.unit.getActiveSheet().getFreeze();
7420
+ const worksheet = this._context.unit.getActiveSheet();
7421
+ const { ySplit: freezeYSplit, xSplit: freezeXSplit } = worksheet.getFreeze();
7397
7422
  return this._commandService.syncExecuteCommand(ScrollCommand.id, {
7423
+ unitId: this._context.unitId,
7424
+ sheetId: worksheet.getSheetId(),
7398
7425
  sheetViewStartRow: row - freezeYSplit,
7399
7426
  sheetViewStartColumn: column - freezeXSplit,
7400
7427
  offsetX: 0,
@@ -7567,6 +7594,8 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
7567
7594
  startSheetViewRow = startSheetViewRow - hiddenRows.length;
7568
7595
  }
7569
7596
  return this._commandService.syncExecuteCommand(ScrollCommand.id, {
7597
+ unitId: this._context.unitId,
7598
+ sheetId: worksheet.getSheetId(),
7570
7599
  sheetViewStartRow: Math.max(0, startSheetViewRow - freezedRowCount),
7571
7600
  sheetViewStartColumn: Math.max(0, startSheetViewColumn - freezedColCount),
7572
7601
  offsetX,
@@ -7655,10 +7684,12 @@ const ScrollCommand = {
7655
7684
  if (!params) return false;
7656
7685
  const univerInstanceService = accessor.get(IUniverInstanceService);
7657
7686
  const renderManagerSrv = accessor.get(IRenderManagerService);
7658
- const target = getSheetCommandTarget(univerInstanceService);
7687
+ const target = params.unitId ? getScrollCommandTargetByParams(univerInstanceService, params) : getSheetCommandTarget(univerInstanceService);
7659
7688
  if (!target) return false;
7660
7689
  const { workbook, worksheet, unitId } = target;
7661
- const currentScroll = renderManagerSrv.getRenderById(unitId).with(SheetScrollManagerService).getCurrentScrollState();
7690
+ const renderUnit = renderManagerSrv.getRenderById(unitId);
7691
+ if (!renderUnit) return false;
7692
+ const currentScroll = renderUnit.with(SheetScrollManagerService).getCurrentScrollState();
7662
7693
  if (!worksheet) return false;
7663
7694
  const { sheetViewStartRow, sheetViewStartColumn, offsetX, offsetY, duration } = params;
7664
7695
  const { sheetViewStartColumn: currentColumn, sheetViewStartRow: currentRow, offsetX: currentOffsetX, offsetY: currentOffsetY } = currentScroll || {};
@@ -7674,6 +7705,18 @@ const ScrollCommand = {
7674
7705
  });
7675
7706
  }
7676
7707
  };
7708
+ function getScrollCommandTargetByParams(univerInstanceService, params) {
7709
+ if (!params.unitId) return null;
7710
+ const workbook = univerInstanceService.getUnit(params.unitId, UniverInstanceType.UNIVER_SHEET);
7711
+ const worksheet = params.sheetId ? workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(params.sheetId) : workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
7712
+ if (!workbook || !worksheet) return null;
7713
+ return {
7714
+ workbook,
7715
+ worksheet,
7716
+ unitId: params.unitId,
7717
+ subUnitId: worksheet.getSheetId()
7718
+ };
7719
+ }
7677
7720
  /**
7678
7721
  * The command is used to scroll to the specific cell if the target cell is not in the viewport.
7679
7722
  */
@@ -7869,7 +7912,7 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
7869
7912
  refreshEditCellPosition(resetSizeOnly) {
7870
7913
  if (!this._currentEditCell || !this._currentEditCellState) return;
7871
7914
  const { unitId, sheetId, primary, scene, engine } = this._currentEditCell;
7872
- const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
7915
+ const workbook = this._getWorkbookForEditUnit(unitId);
7873
7916
  if (!workbook || workbook.getUnitId() !== unitId) return;
7874
7917
  const worksheet = workbook.getActiveSheet();
7875
7918
  if (!worksheet || worksheet.getSheetId() !== sheetId) return;
@@ -7968,7 +8011,7 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
7968
8011
  var _documentLayoutObject, _documentLayoutObject2;
7969
8012
  if (!this._currentEditCell) return;
7970
8013
  const { unitId, sheetId, primary, scene, engine } = this._currentEditCell;
7971
- const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
8014
+ const workbook = this._getWorkbookForEditUnit(unitId);
7972
8015
  if (!workbook || workbook.getUnitId() !== unitId) return;
7973
8016
  const worksheet = workbook.getActiveSheet();
7974
8017
  if (!worksheet || worksheet.getSheetId() !== sheetId) return;
@@ -8046,6 +8089,10 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
8046
8089
  isInArrayFormulaRange: cell === null || cell === void 0 ? void 0 : cell.isInArrayFormulaRange
8047
8090
  };
8048
8091
  }
8092
+ _getWorkbookForEditUnit(unitId) {
8093
+ var _this$_univerInstance;
8094
+ return (_this$_univerInstance = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) !== null && _this$_univerInstance !== void 0 ? _this$_univerInstance : this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
8095
+ }
8049
8096
  getCurrentEditorId() {
8050
8097
  return this._editorUnitId;
8051
8098
  }
@@ -8424,9 +8471,15 @@ const ScrollToRangeOperation = {
8424
8471
  id: "sheet.operation.scroll-to-range",
8425
8472
  type: CommandType.OPERATION,
8426
8473
  handler: (accessor, params) => {
8474
+ var _params$unitId, _instanceService$getC;
8427
8475
  if (!params) return false;
8428
8476
  const instanceService = accessor.get(IUniverInstanceService);
8429
- return accessor.get(IRenderManagerService).getRenderById(instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId()).with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
8477
+ const renderManagerService = accessor.get(IRenderManagerService);
8478
+ const unitId = (_params$unitId = params.unitId) !== null && _params$unitId !== void 0 ? _params$unitId : (_instanceService$getC = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId();
8479
+ if (!unitId) return false;
8480
+ const renderUnit = renderManagerService.getRenderById(unitId);
8481
+ if (!renderUnit) return false;
8482
+ return renderUnit.with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
8430
8483
  }
8431
8484
  };
8432
8485
 
@@ -8738,18 +8791,19 @@ let SheetsRenderService = class SheetsRenderService extends RxDisposable {
8738
8791
  }
8739
8792
  _initWorkbookListener() {
8740
8793
  this._instanceSrv.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((event) => this._createRenderer(event.unit, event.options));
8741
- this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).forEach((workbook) => this._createRenderer(workbook));
8794
+ this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).forEach((workbook) => {
8795
+ var _this$_instanceSrv$ge;
8796
+ return this._createRenderer(workbook, (_this$_instanceSrv$ge = this._instanceSrv.getUnitCreateOptions(workbook.getUnitId())) !== null && _this$_instanceSrv$ge !== void 0 ? _this$_instanceSrv$ge : void 0);
8797
+ });
8742
8798
  this._instanceSrv.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._disposeRenderer(workbook));
8743
8799
  }
8744
8800
  _createRenderer(workbook, createUnitOptions) {
8801
+ if (createUnitOptions === null || createUnitOptions === void 0 ? void 0 : createUnitOptions.skipAutoRender) return;
8745
8802
  const unitId = workbook.getUnitId();
8746
- this._renderManagerService.created$.subscribe((renderer) => {
8747
- if (renderer.unitId === unitId) {
8748
- renderer.engine.getCanvas().setId(`${SHEET_MAIN_CANVAS_ID}_${unitId}`);
8749
- renderer.engine.getCanvas().getContext().setId(`${SHEET_MAIN_CANVAS_ID}_${unitId}`);
8750
- }
8751
- });
8752
- this._renderManagerService.createRender(unitId, createUnitOptions);
8803
+ const canvas = this._renderManagerService.createRender(unitId, createUnitOptions).engine.getCanvas();
8804
+ canvas.setId(`${SHEET_MAIN_CANVAS_ID}_${unitId}`);
8805
+ canvas.getCanvasEle().dataset.uUnitId = unitId;
8806
+ canvas.getContext().setId(`${SHEET_MAIN_CANVAS_ID}_${unitId}`);
8753
8807
  }
8754
8808
  _disposeRenderer(workbook) {
8755
8809
  const unitId = workbook.getUnitId();
@@ -8844,11 +8898,28 @@ let AutoFillUIController = class AutoFillUIController extends Disposable {
8844
8898
  }
8845
8899
  _initSelectionControlFillChanged() {
8846
8900
  const disposableCollection = new DisposableCollection();
8901
+ let pendingRetry = false;
8902
+ let retryCount = 0;
8903
+ const scheduleUpdateListener = (listener) => {
8904
+ if (pendingRetry) return;
8905
+ pendingRetry = true;
8906
+ setTimeout(() => {
8907
+ pendingRetry = false;
8908
+ listener();
8909
+ }, 0);
8910
+ };
8847
8911
  const updateListener = () => {
8848
8912
  disposableCollection.dispose();
8849
8913
  const currentRenderer = getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
8850
8914
  if (!currentRenderer) return;
8851
- currentRenderer.with(ISheetSelectionRenderService).getSelectionControls().forEach((controlSelection) => {
8915
+ const selectionRenderService = getResolvedSelectionRenderService(currentRenderer);
8916
+ if (!selectionRenderService) {
8917
+ retryCount += 1;
8918
+ if (retryCount <= 3) scheduleUpdateListener(updateListener);
8919
+ return;
8920
+ }
8921
+ retryCount = 0;
8922
+ selectionRenderService.getSelectionControls().forEach((controlSelection) => {
8852
8923
  disposableCollection.add(controlSelection.selectionFilled$.subscribe((filled) => {
8853
8924
  if (filled == null || filled.startColumn === -1 || filled.startRow === -1 || filled.endColumn === -1 || filled.endRow === -1) return;
8854
8925
  const source = {
@@ -8886,11 +8957,11 @@ let AutoFillUIController = class AutoFillUIController extends Disposable {
8886
8957
  }));
8887
8958
  });
8888
8959
  };
8889
- updateListener();
8960
+ scheduleUpdateListener(updateListener);
8890
8961
  this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
8891
- if (command.id === SetSelectionsOperation.id) updateListener();
8962
+ if (command.id === SetSelectionsOperation.id) scheduleUpdateListener(updateListener);
8892
8963
  }));
8893
- this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe(() => updateListener()));
8964
+ this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe(() => scheduleUpdateListener(updateListener)));
8894
8965
  }
8895
8966
  _handleDbClickFill(source) {
8896
8967
  const selection = this._detectFillRange(source);
@@ -8940,6 +9011,13 @@ AutoFillUIController = __decorate([
8940
9011
  __decorateParam(5, IRenderManagerService),
8941
9012
  __decorateParam(6, Inject(SheetsRenderService))
8942
9013
  ], AutoFillUIController);
9014
+ function getResolvedSelectionRenderService(renderer) {
9015
+ var _getInjector, _resolvedDependencyCo;
9016
+ const injector = (_getInjector = renderer.getInjector) === null || _getInjector === void 0 ? void 0 : _getInjector.call(renderer);
9017
+ const resolvedDependencies = injector === null || injector === void 0 || (_resolvedDependencyCo = injector.resolvedDependencyCollection) === null || _resolvedDependencyCo === void 0 ? void 0 : _resolvedDependencyCo.resolvedDependencies;
9018
+ if (!resolvedDependencies) return;
9019
+ for (const [identifier, values] of resolvedDependencies) if (identifier.decoratorName === ISheetSelectionRenderService.decoratorName) return values.length === 1 ? values[0] : void 0;
9020
+ }
8943
9021
 
8944
9022
  //#endregion
8945
9023
  //#region src/controllers/auto-height.controller.ts
@@ -9392,12 +9470,60 @@ var CellEditorManagerService = class {
9392
9470
  };
9393
9471
  const ICellEditorManagerService = createIdentifier("univer.sheet-cell-editor-manager.service");
9394
9472
 
9473
+ //#endregion
9474
+ //#region src/services/sheet-embed-integration.service.ts
9475
+ const SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = "data-embed-interaction-boundary-owner";
9476
+ const SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE = "data-embed-runtime-focus-role";
9477
+ const SHEET_EMBED_FLOAT_DOM_ATTRIBUTE = "data-embed-float-dom";
9478
+ const SHEET_EMBED_ID_ATTRIBUTE = "data-embed-id";
9479
+ const SHEET_EMBED_HOST_UNIT_ID_ATTRIBUTE = "data-embed-host-unit-id";
9480
+ const SHEET_EMBED_CHILD_UNIT_ID_ATTRIBUTE = "data-embed-child-unit-id";
9481
+ const SHEET_EMBED_CHILD_TYPE_ATTRIBUTE = "data-embed-child-type";
9482
+ const ISheetEmbedInteractionBoundaryService = createIdentifier("sheets-ui.embed-interaction-boundary.service");
9483
+ const ISheetEmbedRuntimeFocusCoordinator = createIdentifier("sheets-ui.embed-runtime-focus-coordinator");
9484
+ const ISheetEmbedFloatingGeometryService = createIdentifier("sheets-ui.embed-floating-geometry.service");
9485
+ function resolveSheetEmbedRuntimeDomScope(element) {
9486
+ var _element$closest$getA, _element$closest, _container$getAttribu, _container$getAttribu2, _container$getAttribu3;
9487
+ if (!element) return;
9488
+ const embedId = (_element$closest$getA = (_element$closest = element.closest(`[${"data-embed-interaction-boundary-owner"}]`)) === null || _element$closest === void 0 ? void 0 : _element$closest.getAttribute("data-embed-interaction-boundary-owner")) !== null && _element$closest$getA !== void 0 ? _element$closest$getA : void 0;
9489
+ const container = resolveSheetEmbedFloatDomContainer(element, embedId);
9490
+ const resolvedEmbedId = (_container$getAttribu = container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-id")) !== null && _container$getAttribu !== void 0 ? _container$getAttribu : embedId;
9491
+ if (!resolvedEmbedId) return;
9492
+ return {
9493
+ embedId: resolvedEmbedId,
9494
+ hostUnitId: (_container$getAttribu2 = container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-host-unit-id")) !== null && _container$getAttribu2 !== void 0 ? _container$getAttribu2 : void 0,
9495
+ childUnitId: (_container$getAttribu3 = container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-child-unit-id")) !== null && _container$getAttribu3 !== void 0 ? _container$getAttribu3 : void 0,
9496
+ childType: readChildType(container)
9497
+ };
9498
+ }
9499
+ function resolveActiveSheetEmbedRuntimeDomScope(ownerDocument = document) {
9500
+ const activeContainer = ownerDocument.querySelector(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"][data-embed-float-stage="stage2"]`);
9501
+ if (!activeContainer) return;
9502
+ return resolveSheetEmbedRuntimeDomScope(activeContainer);
9503
+ }
9504
+ function resolveSheetEmbedFloatDomContainer(element, embedId) {
9505
+ var _element$ownerDocumen, _ownerDocument$queryS;
9506
+ const ownContainer = element === null || element === void 0 ? void 0 : element.closest(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"]`);
9507
+ if (ownContainer && (!embedId || ownContainer.getAttribute("data-embed-id") === embedId)) return ownContainer;
9508
+ const ownerDocument = (_element$ownerDocumen = element === null || element === void 0 ? void 0 : element.ownerDocument) !== null && _element$ownerDocumen !== void 0 ? _element$ownerDocumen : typeof document === "undefined" ? void 0 : document;
9509
+ if (!ownerDocument || !embedId) return ownContainer !== null && ownContainer !== void 0 ? ownContainer : void 0;
9510
+ return (_ownerDocument$queryS = ownerDocument.querySelector(`[${"data-embed-float-dom"}="true"][${"data-embed-id"}="${escapeAttributeValue(embedId)}"]`)) !== null && _ownerDocument$queryS !== void 0 ? _ownerDocument$queryS : void 0;
9511
+ }
9512
+ function escapeAttributeValue(value) {
9513
+ return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
9514
+ }
9515
+ function readChildType(container) {
9516
+ const value = container === null || container === void 0 ? void 0 : container.getAttribute(SHEET_EMBED_CHILD_TYPE_ATTRIBUTE);
9517
+ if (value == null || value === "") return;
9518
+ return Number(value);
9519
+ }
9520
+
9395
9521
  //#endregion
9396
9522
  //#region src/services/editor/cell-editor-resize.service.ts
9397
9523
  const EDITOR_INPUT_SELF_EXTEND_GAP = 5;
9398
9524
  const EDITOR_BORDER_SIZE = 2;
9399
9525
  let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Disposable {
9400
- constructor(_layoutService, _cellEditorManagerService, _editorBridgeService, _renderManagerService, _univerInstanceService, _configService) {
9526
+ constructor(_layoutService, _cellEditorManagerService, _editorBridgeService, _renderManagerService, _univerInstanceService, _configService, _embedFloatingGeometryService) {
9401
9527
  super();
9402
9528
  this._layoutService = _layoutService;
9403
9529
  this._cellEditorManagerService = _cellEditorManagerService;
@@ -9405,6 +9531,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
9405
9531
  this._renderManagerService = _renderManagerService;
9406
9532
  this._univerInstanceService = _univerInstanceService;
9407
9533
  this._configService = _configService;
9534
+ this._embedFloatingGeometryService = _embedFloatingGeometryService;
9408
9535
  }
9409
9536
  get _currentRenderer() {
9410
9537
  return getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
@@ -9417,9 +9544,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
9417
9544
  return this._renderManagerService.getRenderById(this._editingUnitId);
9418
9545
  }
9419
9546
  get _renderer() {
9420
- var _this$_univerInstance;
9421
- const currentUnitId = (_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
9422
- return this._editingUnitId === currentUnitId ? this._editingRenderer : this._currentRenderer;
9547
+ var _this$_editingRendere;
9548
+ return (_this$_editingRendere = this._editingRenderer) !== null && _this$_editingRendere !== void 0 ? _this$_editingRendere : this._currentRenderer;
9423
9549
  }
9424
9550
  get _sheetSkeletonManagerService() {
9425
9551
  var _this$_renderer;
@@ -9523,13 +9649,14 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
9523
9649
  const { startX, startY, endX } = position;
9524
9650
  const enginWidth = engine.width;
9525
9651
  const maxHeight = height - startY - EDITOR_BORDER_SIZE * 2;
9652
+ const cellWidth = endX - startX;
9526
9653
  let maxWidth = width - startX;
9527
9654
  if (horizontalAlign === HorizontalAlign.CENTER) {
9528
9655
  const rightGap = enginWidth - endX;
9529
- const leftGap = startX;
9530
- maxWidth = endX - startX + Math.min(leftGap, rightGap) * 2;
9656
+ maxWidth = cellWidth + Math.min(startX, rightGap) * 2;
9531
9657
  } else if (horizontalAlign === HorizontalAlign.RIGHT) maxWidth = endX;
9532
9658
  maxWidth = maxWidth - EDITOR_BORDER_SIZE * 2;
9659
+ maxWidth = Math.max(maxWidth, cellWidth);
9533
9660
  return {
9534
9661
  height: maxHeight,
9535
9662
  width: maxWidth,
@@ -9586,7 +9713,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
9586
9713
  docEngine.resizeBySize(fixLineWidthByScale(editorWidth, precisionScaleX), fixLineWidthByScale(physicHeight, precisionScaleY));
9587
9714
  callback === null || callback === void 0 || callback();
9588
9715
  }, 0);
9589
- const contentBoundingRect = this._layoutService.getContentElement().getBoundingClientRect();
9716
+ const contentBoundingRect = this._getEditorContentElement().getBoundingClientRect();
9590
9717
  const canvasBoundingRect = canvasElement.getBoundingClientRect();
9591
9718
  startX = startX * scaleAdjust + (canvasBoundingRect.left - contentBoundingRect.left);
9592
9719
  startY = startY * scaleAdjust + (canvasBoundingRect.top - contentBoundingRect.top);
@@ -9601,6 +9728,10 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
9601
9728
  show: true
9602
9729
  });
9603
9730
  }
9731
+ _getEditorContentElement() {
9732
+ var _this$_embedFloatingG, _this$_embedFloatingG2;
9733
+ return (_this$_embedFloatingG = (_this$_embedFloatingG2 = this._embedFloatingGeometryService) === null || _this$_embedFloatingG2 === void 0 || (_this$_embedFloatingG2 = _this$_embedFloatingG2.getRegistrationByChildUnitId(this._editingUnitId)) === null || _this$_embedFloatingG2 === void 0 ? void 0 : _this$_embedFloatingG2.contentRoot) !== null && _this$_embedFloatingG !== void 0 ? _this$_embedFloatingG : this._layoutService.getContentElement();
9734
+ }
9604
9735
  /**
9605
9736
  * Since the document does not support cell background color, an additional rect needs to be added.
9606
9737
  */
@@ -9663,13 +9794,14 @@ SheetCellEditorResizeService = __decorate([
9663
9794
  __decorateParam(2, IEditorBridgeService),
9664
9795
  __decorateParam(3, IRenderManagerService),
9665
9796
  __decorateParam(4, IUniverInstanceService),
9666
- __decorateParam(5, IConfigService)
9797
+ __decorateParam(5, IConfigService),
9798
+ __decorateParam(6, Optional(ISheetEmbedFloatingGeometryService))
9667
9799
  ], SheetCellEditorResizeService);
9668
9800
 
9669
9801
  //#endregion
9670
9802
  //#region src/controllers/render-controllers/editor-bridge.render-controller.ts
9671
9803
  let EditorBridgeRenderController = class EditorBridgeRenderController extends RxDisposable {
9672
- constructor(_context, _instanceSrv, _commandService, _editorBridgeService, _selectionManagerService, _contextService, _renderManagerService, _sheetSkeletonManagerService) {
9804
+ constructor(_context, _instanceSrv, _commandService, _editorBridgeService, _selectionManagerService, _contextService, _renderManagerService, _sheetSkeletonManagerService, _embedRuntimeFocusCoordinator) {
9673
9805
  super();
9674
9806
  this._context = _context;
9675
9807
  this._instanceSrv = _instanceSrv;
@@ -9679,10 +9811,13 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
9679
9811
  this._contextService = _contextService;
9680
9812
  this._renderManagerService = _renderManagerService;
9681
9813
  this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
9814
+ this._embedRuntimeFocusCoordinator = _embedRuntimeFocusCoordinator;
9682
9815
  _defineProperty(this, "_d", void 0);
9683
9816
  this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {
9684
- if (workbook && workbook.getUnitId() === this._context.unitId) this._d = this._init();
9685
- else this._disposeCurrent();
9817
+ if (workbook && workbook.getUnitId() === this._context.unitId) {
9818
+ if (this._d) return;
9819
+ this._d = this._init();
9820
+ } else this._disposeCurrent();
9686
9821
  }));
9687
9822
  }
9688
9823
  _init() {
@@ -9691,6 +9826,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
9691
9826
  this._initEventListener(d);
9692
9827
  this._commandExecutedListener(d);
9693
9828
  this._initialKeyboardListener(d);
9829
+ this._initSheetFocusListener(d);
9694
9830
  return d;
9695
9831
  }
9696
9832
  _disposeCurrent() {
@@ -9707,7 +9843,9 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
9707
9843
  const primary = params === null || params === void 0 || (_params = params[params.length - 1]) === null || _params === void 0 ? void 0 : _params.primary;
9708
9844
  if (primary) {
9709
9845
  var _this$_context$unit$g, _this$_sheetSkeletonM;
9710
- const { scene, engine } = this._getSheetObject();
9846
+ const sheetObject = this._getSheetObject();
9847
+ if (!sheetObject) return;
9848
+ const { scene, engine } = sheetObject;
9711
9849
  const unitId = this._context.unitId;
9712
9850
  const sheetId = (_this$_context$unit$g = this._context.unit.getActiveSheet()) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.getSheetId();
9713
9851
  if (!sheetId) return;
@@ -9722,6 +9860,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
9722
9860
  endColumn: mergeInfo.mergeInfo.endColumn,
9723
9861
  isMergedMainCell: mergeInfo.isMergedMainCell
9724
9862
  } : primary;
9863
+ if (isSameEditCell(this._editorBridgeService.getEditLocation(), unitId, sheetId, newPrimary)) return;
9725
9864
  this._commandService.executeCommand(SetActivateCellEditOperation.id, {
9726
9865
  scene,
9727
9866
  engine,
@@ -9739,7 +9878,9 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
9739
9878
  }
9740
9879
  }
9741
9880
  _initEventListener(d) {
9742
- const { spreadsheet, spreadsheetColumnHeader, spreadsheetLeftTopPlaceholder, spreadsheetRowHeader } = this._getSheetObject();
9881
+ const sheetObject = this._getSheetObject();
9882
+ if (!sheetObject) return;
9883
+ const { spreadsheet, spreadsheetColumnHeader, spreadsheetLeftTopPlaceholder, spreadsheetRowHeader } = sheetObject;
9743
9884
  d.add(spreadsheet.onDblclick$.subscribeEvent((evt) => {
9744
9885
  if (evt.button === 2) return;
9745
9886
  this._commandService.executeCommand(SetCellEditVisibleOperation.id, {
@@ -9749,19 +9890,19 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
9749
9890
  });
9750
9891
  }));
9751
9892
  d.add(spreadsheet.onPointerDown$.subscribeEvent({
9752
- next: this._tryHideEditor.bind(this),
9893
+ next: (payload) => this._tryHideEditor(resolvePointerEventPayload(payload)),
9753
9894
  priority: -1
9754
9895
  }));
9755
9896
  d.add(spreadsheetColumnHeader.onPointerDown$.subscribeEvent({
9756
- next: this._tryHideEditor.bind(this),
9897
+ next: (payload) => this._tryHideEditor(resolvePointerEventPayload(payload)),
9757
9898
  priority: -1
9758
9899
  }));
9759
9900
  d.add(spreadsheetLeftTopPlaceholder.onPointerDown$.subscribeEvent({
9760
- next: this._tryHideEditor.bind(this),
9901
+ next: (payload) => this._tryHideEditor(resolvePointerEventPayload(payload)),
9761
9902
  priority: -1
9762
9903
  }));
9763
9904
  d.add(spreadsheetRowHeader.onPointerDown$.subscribeEvent({
9764
- next: this._tryHideEditor.bind(this),
9905
+ next: (payload) => this._tryHideEditor(resolvePointerEventPayload(payload)),
9765
9906
  priority: -1
9766
9907
  }));
9767
9908
  }
@@ -9775,9 +9916,10 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
9775
9916
  const docSelectionRenderService = render.with(DocSelectionRenderService);
9776
9917
  if (docSelectionRenderService) {
9777
9918
  disposable = toDisposable(docSelectionRenderService.onInputBefore$.subscribe((config) => {
9919
+ var _this$_embedRuntimeFo;
9778
9920
  if (!this._isCurrentSheetFocused()) return;
9779
9921
  const isFocusFormulaEditor = this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR);
9780
- const isFocusSheets = this._contextService.getContextValue(FOCUSING_SHEET);
9922
+ const isFocusSheets = this._contextService.getContextValue(FOCUSING_SHEET) || ((_this$_embedRuntimeFo = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo === void 0 ? void 0 : _this$_embedRuntimeFo.isChildUnitInActiveSession(this._context.unitId)) === true;
9781
9923
  const unitId = render.unitId;
9782
9924
  if (this._editorBridgeService.isVisible().visible) return;
9783
9925
  if (unitId && isFocusSheets && !isFocusFormulaEditor) this._showEditorByKeyboard(config);
@@ -9792,6 +9934,17 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
9792
9934
  addEvent(render);
9793
9935
  }));
9794
9936
  }
9937
+ _initSheetFocusListener(d) {
9938
+ d.add(this._contextService.subscribeContextValue$(FOCUSING_SHEET).subscribe((isFocusingSheet) => {
9939
+ if (!isFocusingSheet || !this._isCurrentSheetFocused() || this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) || this._editorBridgeService.isVisible().visible) return;
9940
+ this._focusCellEditorInput();
9941
+ }));
9942
+ }
9943
+ _focusCellEditorInput() {
9944
+ const render = this._renderManagerService.getRenderById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
9945
+ const docSelectionRenderService = render === null || render === void 0 ? void 0 : render.with(DocSelectionRenderService);
9946
+ if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
9947
+ }
9795
9948
  _commandExecutedListener(d) {
9796
9949
  const refreshCommandSet = /* @__PURE__ */ new Set([ClearSelectionFormatCommand.id, SetZoomRatioCommand.id]);
9797
9950
  d.add(this._commandService.onCommandExecuted((command) => {
@@ -9806,19 +9959,35 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
9806
9959
  }));
9807
9960
  }
9808
9961
  _showEditorByKeyboard(config) {
9962
+ var _ref, _config$content;
9809
9963
  const event = config === null || config === void 0 ? void 0 : config.event;
9810
9964
  if (config == null || !event.data && event.inputType !== "InsertParagraph") return;
9965
+ const initialValue = (_ref = (_config$content = config.content) !== null && _config$content !== void 0 ? _config$content : event.data) !== null && _ref !== void 0 ? _ref : "";
9811
9966
  this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
9812
9967
  visible: true,
9813
9968
  eventType: DeviceInputEventType.Keyboard,
9814
9969
  keycode: event.which,
9970
+ initialValue,
9815
9971
  unitId: this._context.unitId
9816
9972
  });
9817
9973
  }
9818
- _tryHideEditor() {
9974
+ _tryHideEditor(evt) {
9819
9975
  if (this._editorBridgeService.isForceKeepVisible()) return;
9976
+ if (!evt && this._isEmbeddedFormulaEditorActive()) return;
9977
+ if (this._isEmbeddedFormulaEditorActive() && this._isCurrentEmbedRuntimeEvent(evt)) return;
9978
+ if (isEmbedCellEditorInteraction(evt)) return;
9820
9979
  this._hideEditor();
9821
9980
  }
9981
+ _isEmbeddedFormulaEditorActive() {
9982
+ var _this$_embedRuntimeFo2, _this$_editorBridgeSe;
9983
+ if (((_this$_embedRuntimeFo2 = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo2 === void 0 ? void 0 : _this$_embedRuntimeFo2.isChildUnitInActiveSession(this._context.unitId)) !== true) return false;
9984
+ const dataStream = (_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 || (_this$_editorBridgeSe = _this$_editorBridgeSe.documentLayoutObject.documentModel) === null || _this$_editorBridgeSe === void 0 || (_this$_editorBridgeSe = _this$_editorBridgeSe.getSnapshot().body) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.dataStream;
9985
+ return typeof dataStream === "string" && dataStream.startsWith("=");
9986
+ }
9987
+ _isCurrentEmbedRuntimeEvent(evt) {
9988
+ var _this$_embedRuntimeFo3;
9989
+ return ((_this$_embedRuntimeFo3 = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo3 === void 0 ? void 0 : _this$_embedRuntimeFo3.isChildUnitRuntimeEvent(this._context.unitId, evt === null || evt === void 0 ? void 0 : evt.target, evt instanceof Event ? evt : evt)) === true;
9990
+ }
9822
9991
  _hideEditor() {
9823
9992
  if (this._editorBridgeService.isVisible().visible !== true) return;
9824
9993
  this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
@@ -9828,11 +9997,12 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
9828
9997
  });
9829
9998
  }
9830
9999
  _getSheetObject() {
10000
+ if (!this._context.unit) return null;
9831
10001
  return getSheetObject(this._context.unit, this._context);
9832
10002
  }
9833
10003
  _isCurrentSheetFocused() {
9834
- var _this$_instanceSrv$ge;
9835
- return ((_this$_instanceSrv$ge = this._instanceSrv.getFocusedUnit()) === null || _this$_instanceSrv$ge === void 0 ? void 0 : _this$_instanceSrv$ge.getUnitId()) === this._context.unitId;
10004
+ var _this$_instanceSrv$ge, _this$_embedRuntimeFo4;
10005
+ return ((_this$_instanceSrv$ge = this._instanceSrv.getFocusedUnit()) === null || _this$_instanceSrv$ge === void 0 ? void 0 : _this$_instanceSrv$ge.getUnitId()) === this._context.unitId || ((_this$_embedRuntimeFo4 = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo4 === void 0 ? void 0 : _this$_embedRuntimeFo4.isChildUnitInActiveSession(this._context.unitId)) === true;
9836
10006
  }
9837
10007
  };
9838
10008
  EditorBridgeRenderController = __decorate([
@@ -9842,8 +10012,46 @@ EditorBridgeRenderController = __decorate([
9842
10012
  __decorateParam(4, Inject(SheetsSelectionsService)),
9843
10013
  __decorateParam(5, IContextService),
9844
10014
  __decorateParam(6, IRenderManagerService),
9845
- __decorateParam(7, Inject(SheetSkeletonManagerService))
10015
+ __decorateParam(7, Inject(SheetSkeletonManagerService)),
10016
+ __decorateParam(8, Optional(ISheetEmbedRuntimeFocusCoordinator))
9846
10017
  ], EditorBridgeRenderController);
10018
+ function resolvePointerEventPayload(payload) {
10019
+ return Array.isArray(payload) ? payload[0] : payload;
10020
+ }
10021
+ function isEmbedCellEditorInteraction(evt) {
10022
+ return isEmbedCellEditorInteractionTarget(evt === null || evt === void 0 ? void 0 : evt.target) || isEmbedCellEditorInteractionPoint(resolvePointerEventPoint(evt));
10023
+ }
10024
+ function isEmbedCellEditorInteractionTarget(target) {
10025
+ if (typeof HTMLElement === "undefined" || !(target instanceof HTMLElement)) return false;
10026
+ return target.closest(`[${"data-embed-runtime-focus-role"}="child-editor"]`) != null || target.closest("[data-u-comp=\"editor\"]") != null || target.closest("[id^=\"__editor___INTERNAL_EDITOR__\"]") != null || target.closest("[id^=\"univer-doc-selection-container-__INTERNAL_EDITOR__\"]") != null;
10027
+ }
10028
+ function resolvePointerEventPoint(evt) {
10029
+ if (!evt) return;
10030
+ return {
10031
+ clientX: "clientX" in evt ? evt.clientX : void 0,
10032
+ clientY: "clientY" in evt ? evt.clientY : void 0,
10033
+ x: "x" in evt ? evt.x : void 0,
10034
+ y: "y" in evt ? evt.y : void 0
10035
+ };
10036
+ }
10037
+ function isEmbedCellEditorInteractionPoint(evt) {
10038
+ if (typeof document === "undefined") return false;
10039
+ const clientX = Number.isFinite(evt === null || evt === void 0 ? void 0 : evt.clientX) ? evt === null || evt === void 0 ? void 0 : evt.clientX : evt === null || evt === void 0 ? void 0 : evt.x;
10040
+ const clientY = Number.isFinite(evt === null || evt === void 0 ? void 0 : evt.clientY) ? evt === null || evt === void 0 ? void 0 : evt.clientY : evt === null || evt === void 0 ? void 0 : evt.y;
10041
+ if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) return false;
10042
+ return [...document.querySelectorAll([
10043
+ `[${SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE}="child-editor"]`,
10044
+ "[data-u-comp=\"editor\"]",
10045
+ "[id^=\"__editor___INTERNAL_EDITOR__\"]",
10046
+ "[id^=\"univer-doc-selection-container-__INTERNAL_EDITOR__\"]"
10047
+ ].join(","))].some((element) => {
10048
+ const rect = element.getBoundingClientRect();
10049
+ return rect.width > 0 && rect.height > 0 && clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;
10050
+ });
10051
+ }
10052
+ function isSameEditCell(current, unitId, sheetId, primary) {
10053
+ return (current === null || current === void 0 ? void 0 : current.unitId) === unitId && current.sheetId === sheetId && current.row === primary.startRow && current.column === primary.startColumn;
10054
+ }
9847
10055
 
9848
10056
  //#endregion
9849
10057
  //#region src/services/repeat-last-action.service.ts
@@ -10560,10 +10768,11 @@ let EditingRenderController = class EditingRenderController extends Disposable {
10560
10768
  }
10561
10769
  _initialCursorSync(d) {
10562
10770
  d.add(this._cellEditorManagerService.focus$.pipe(filter((f) => !!f)).subscribe(() => {
10563
- var _this$_renderManagerS2;
10564
- const currentDoc = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
10565
- if (!currentDoc) return;
10566
- const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderById(currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId())) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
10771
+ var _this$_univerInstance, _this$_renderManagerS2;
10772
+ const editorId = this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) ? DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : this._editorBridgeService.getCurrentEditorId();
10773
+ const docUnitId = editorId !== null && editorId !== void 0 ? editorId : (_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
10774
+ if (!docUnitId) return;
10775
+ const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderById(docUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
10567
10776
  if (!docSelectionRenderManager) return;
10568
10777
  docSelectionRenderManager.sync();
10569
10778
  }));
@@ -10684,14 +10893,17 @@ let EditingRenderController = class EditingRenderController extends Disposable {
10684
10893
  this._cursorChange = eventType === DeviceInputEventType.PointerDown || eventType === DeviceInputEventType.Dblclick ? 2 : 1;
10685
10894
  const editCellState = this._editorBridgeService.getEditLocation();
10686
10895
  if (editCellState == null) return;
10687
- this._commandService.syncExecuteCommand(ScrollToRangeOperation.id, { range: {
10688
- startRow: editCellState.row,
10689
- startColumn: editCellState.column,
10690
- endRow: editCellState.row,
10691
- endColumn: editCellState.column
10692
- } });
10693
- this._editorBridgeService.refreshEditCellPosition(false);
10694
10896
  const { unitId, isInArrayFormulaRange = false } = editCellState;
10897
+ this._commandService.syncExecuteCommand(ScrollToRangeOperation.id, {
10898
+ unitId,
10899
+ range: {
10900
+ startRow: editCellState.row,
10901
+ startColumn: editCellState.column,
10902
+ endRow: editCellState.row,
10903
+ endColumn: editCellState.column
10904
+ }
10905
+ });
10906
+ this._editorBridgeService.refreshEditCellPosition(false);
10695
10907
  const editorObject = this._getEditorObject();
10696
10908
  if (editorObject == null) return;
10697
10909
  const { document, scene } = editorObject;
@@ -11077,8 +11289,9 @@ function getCellStyleBySnapshot(snapshot) {
11077
11289
  return null;
11078
11290
  }
11079
11291
  function emptyBody(body, removeStyle = false) {
11292
+ var _body$textRuns;
11080
11293
  body.dataStream = DEFAULT_EMPTY_DOCUMENT_VALUE;
11081
- if (body.textRuns != null) if (body.textRuns.length === 1 && !removeStyle) {
11294
+ if ((_body$textRuns = body.textRuns) === null || _body$textRuns === void 0 ? void 0 : _body$textRuns.length) if (body.textRuns.length === 1 && !removeStyle) {
11082
11295
  body.textRuns[0].st = 0;
11083
11296
  body.textRuns[0].ed = 1;
11084
11297
  } else body.textRuns = void 0;
@@ -11445,7 +11658,10 @@ function generateBody(text) {
11445
11658
  return {
11446
11659
  dataStream,
11447
11660
  paragraphs,
11448
- sectionBreaks: [{ startIndex: dataStream.indexOf("\n") }]
11661
+ sectionBreaks: [{
11662
+ sectionId: createSectionId(/* @__PURE__ */ new Set()),
11663
+ startIndex: dataStream.indexOf("\n")
11664
+ }]
11449
11665
  };
11450
11666
  }
11451
11667
 
@@ -12181,11 +12397,18 @@ let FormulaEditorController = class FormulaEditorController extends RxDisposable
12181
12397
  });
12182
12398
  this._create(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12183
12399
  this.disposeWithMe(this._editorService.focus$.subscribe(() => {
12184
- var _this$_editorService$;
12185
- if (((_this$_editorService$ = this._editorService.getFocusEditor()) === null || _this$_editorService$ === void 0 ? void 0 : _this$_editorService$.getEditorId()) !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) this._contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, false);
12186
- else this._contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, true);
12400
+ this._syncFxBarFocusContext();
12187
12401
  }));
12188
12402
  }
12403
+ _syncFxBarFocusContext() {
12404
+ var _this$_editorService$;
12405
+ if (((_this$_editorService$ = this._editorService.getFocusEditor()) === null || _this$_editorService$ === void 0 ? void 0 : _this$_editorService$.getEditorId()) === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) {
12406
+ this._contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, true);
12407
+ return;
12408
+ }
12409
+ if (this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) && this._contextService.getContextValue(EDITOR_ACTIVATED)) return;
12410
+ this._contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, false);
12411
+ }
12189
12412
  _handleContentChange() {
12190
12413
  this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
12191
12414
  if (commandInfo.id === RichTextEditingMutation.id) {
@@ -12207,7 +12430,7 @@ let FormulaEditorController = class FormulaEditorController extends RxDisposable
12207
12430
  if (this._contextService.getContextValue(FOCUSING_EDITOR_BUT_HIDDEN) && !this._contextService.getContextValue(EDITOR_ACTIVATED)) {
12208
12431
  var _formulaEditorDataMod;
12209
12432
  this._univerInstanceService.setCurrentUnitForType(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12210
- const formulaEditorDataModel = this._univerInstanceService.getUniverDocInstance(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12433
+ const formulaEditorDataModel = this._univerInstanceService.getUnit(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
12211
12434
  if (this._editorBridgeService.isVisible().visible === false) this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
12212
12435
  visible: true,
12213
12436
  eventType: DeviceInputEventType.PointerDown,
@@ -12247,7 +12470,7 @@ let FormulaEditorController = class FormulaEditorController extends RxDisposable
12247
12470
  this.disposeWithMe(combineLatest([this._formulaEditorManagerService.position$, addFormulaBar$]).subscribe(([position]) => {
12248
12471
  if (!position) return this._clearScheduledCallback();
12249
12472
  const editorObject = getEditorObject(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, this._renderManagerService);
12250
- const formulaEditorDataModel = this._univerInstanceService.getUniverDocInstance(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12473
+ const formulaEditorDataModel = this._univerInstanceService.getUnit(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
12251
12474
  if (editorObject == null || formulaEditorDataModel == null) return this._clearScheduledCallback();
12252
12475
  const { width, height } = position;
12253
12476
  if (width === 0 || height === 0) return this._clearScheduledCallback();
@@ -12266,7 +12489,7 @@ let FormulaEditorController = class FormulaEditorController extends RxDisposable
12266
12489
  const position = this._formulaEditorManagerService.getPosition();
12267
12490
  const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderById(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService).getSkeleton();
12268
12491
  const editorObject = this._renderManagerService.getRenderById(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12269
- const formulaEditorDataModel = this._univerInstanceService.getUniverDocInstance(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12492
+ const formulaEditorDataModel = this._univerInstanceService.getUnit(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
12270
12493
  if (skeleton == null || position == null || editorObject == null || formulaEditorDataModel == null) return;
12271
12494
  const { marginTop = 0, marginBottom = 0 } = formulaEditorDataModel.getSnapshot().documentStyle;
12272
12495
  const { scene, mainComponent } = editorObject;
@@ -16050,6 +16273,56 @@ const BORDER_LINE_CHILDREN = [
16050
16273
  value: "mltr_bctr"
16051
16274
  }
16052
16275
  ];
16276
+ const BORDER_SIZE_CHILDREN = [
16277
+ {
16278
+ label: BorderStyleTypes.THIN,
16279
+ value: BorderStyleTypes.THIN
16280
+ },
16281
+ {
16282
+ label: BorderStyleTypes.HAIR,
16283
+ value: BorderStyleTypes.HAIR
16284
+ },
16285
+ {
16286
+ label: BorderStyleTypes.DOTTED,
16287
+ value: BorderStyleTypes.DOTTED
16288
+ },
16289
+ {
16290
+ label: BorderStyleTypes.DASHED,
16291
+ value: BorderStyleTypes.DASHED
16292
+ },
16293
+ {
16294
+ label: BorderStyleTypes.DASH_DOT,
16295
+ value: BorderStyleTypes.DASH_DOT
16296
+ },
16297
+ {
16298
+ label: BorderStyleTypes.DASH_DOT_DOT,
16299
+ value: BorderStyleTypes.DASH_DOT_DOT
16300
+ },
16301
+ {
16302
+ label: BorderStyleTypes.MEDIUM,
16303
+ value: BorderStyleTypes.MEDIUM
16304
+ },
16305
+ {
16306
+ label: BorderStyleTypes.MEDIUM_DASHED,
16307
+ value: BorderStyleTypes.MEDIUM_DASHED
16308
+ },
16309
+ {
16310
+ label: BorderStyleTypes.MEDIUM_DASH_DOT,
16311
+ value: BorderStyleTypes.MEDIUM_DASH_DOT
16312
+ },
16313
+ {
16314
+ label: BorderStyleTypes.MEDIUM_DASH_DOT_DOT,
16315
+ value: BorderStyleTypes.MEDIUM_DASH_DOT_DOT
16316
+ },
16317
+ {
16318
+ label: BorderStyleTypes.THICK,
16319
+ value: BorderStyleTypes.THICK
16320
+ },
16321
+ {
16322
+ label: BorderStyleTypes.DOUBLE,
16323
+ value: BorderStyleTypes.DOUBLE
16324
+ }
16325
+ ];
16053
16326
 
16054
16327
  //#endregion
16055
16328
  //#region src/menu/menu-util.ts
@@ -16810,6 +17083,9 @@ const MenuItemInput = (props) => {
16810
17083
  function handlePressEnter() {
16811
17084
  if (inputValue) onChange(inputValue);
16812
17085
  }
17086
+ function handleKeyDown(event) {
17087
+ event.stopPropagation();
17088
+ }
16813
17089
  return /* @__PURE__ */ jsxs("div", {
16814
17090
  className: "univer-inline-flex univer-items-center univer-gap-1",
16815
17091
  children: [
@@ -16825,6 +17101,7 @@ const MenuItemInput = (props) => {
16825
17101
  max,
16826
17102
  disabled,
16827
17103
  onPressEnter: handlePressEnter,
17104
+ onKeyDown: handleKeyDown,
16828
17105
  onChange: handleChange
16829
17106
  })
16830
17107
  }),
@@ -18060,7 +18337,7 @@ function ShowRowMenuItemFactory(accessor) {
18060
18337
  return {
18061
18338
  id: SetSelectedRowsVisibleCommand.id,
18062
18339
  type: MenuItemType.BUTTON,
18063
- icon: "EyeOutlineIcon",
18340
+ icon: "EyeIcon",
18064
18341
  title: "sheets-ui.rightClick.showHideRow",
18065
18342
  hidden$: deriveStateFromActiveSheet$(univerInstanceService, true, ({ worksheet }) => new Observable((subscriber) => {
18066
18343
  function hasHiddenRowsInSelections() {
@@ -18096,7 +18373,7 @@ function ShowColMenuItemFactory(accessor) {
18096
18373
  return {
18097
18374
  id: SetSelectedColsVisibleCommand.id,
18098
18375
  type: MenuItemType.BUTTON,
18099
- icon: "EyeOutlineIcon",
18376
+ icon: "EyeIcon",
18100
18377
  title: "sheets-ui.rightClick.showHideColumn",
18101
18378
  hidden$: deriveStateFromActiveSheet$(univerInstanceService, true, ({ worksheet }) => new Observable((subscriber) => {
18102
18379
  function hasHiddenColsInSelections() {
@@ -19381,6 +19658,25 @@ const menuSchema = {
19381
19658
  } } }
19382
19659
  };
19383
19660
 
19661
+ //#endregion
19662
+ //#region src/embed-tab-anchor.ts
19663
+ const EMBED_SHEETS_TAB_CUSTOM_KEY = "UNIVER_EMBED_SHEETS_TAB";
19664
+ function getEmbedSheetsTabCustomData(snapshot) {
19665
+ var _snapshot$custom;
19666
+ const value = (_snapshot$custom = snapshot.custom) === null || _snapshot$custom === void 0 ? void 0 : _snapshot$custom[EMBED_SHEETS_TAB_CUSTOM_KEY];
19667
+ if (!isEmbedSheetsTabCustomData(value)) return;
19668
+ return value;
19669
+ }
19670
+ function isEmbedSheetsTabCustomData(value) {
19671
+ if (!value || typeof value !== "object") return false;
19672
+ const candidate = value;
19673
+ return candidate.version === 1 && typeof candidate.embedId === "string" && typeof candidate.hostAnchorId === "string";
19674
+ }
19675
+
19676
+ //#endregion
19677
+ //#region src/services/sheet-embed-runtime.service.ts
19678
+ const ISheetEmbedRuntimeService = createIdentifier("sheet-ui.embed-runtime.service");
19679
+
19384
19680
  //#endregion
19385
19681
  //#region src/views/auto-fill-popup-menu/AutoFillPopupMenu.tsx
19386
19682
  const useUpdate = () => {
@@ -19530,6 +19826,93 @@ function AutoFillPopupMenu() {
19530
19826
  });
19531
19827
  }
19532
19828
 
19829
+ //#endregion
19830
+ //#region src/views/editor-container/focus-editor.ts
19831
+ const SHEET_CELL_EDITOR_ELEMENT_ID = `__editor_${DOCS_NORMAL_EDITOR_UNIT_ID_KEY}`;
19832
+ const SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID = `univer-doc-selection-container-${DOCS_NORMAL_EDITOR_UNIT_ID_KEY}`;
19833
+ function focusSheetCellEditorElement(ownerDocument = document) {
19834
+ const element = ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
19835
+ if (element == null || ownerDocument.activeElement === element) return false;
19836
+ if (!element.hasAttribute("tabindex")) element.tabIndex = -1;
19837
+ element.focus({ preventScroll: true });
19838
+ return ownerDocument.activeElement === element;
19839
+ }
19840
+ function registerSheetCellEditorRuntimePortal(options) {
19841
+ var _options$ownerDocumen;
19842
+ const ownerDocument = (_options$ownerDocumen = options.ownerDocument) !== null && _options$ownerDocumen !== void 0 ? _options$ownerDocumen : typeof document === "undefined" ? void 0 : document;
19843
+ if (!ownerDocument) return toDisposable(() => {});
19844
+ const collection = new DisposableCollection();
19845
+ const view = ownerDocument.defaultView;
19846
+ let disposed = false;
19847
+ let registeredPortalRoot = null;
19848
+ let portalRegistration;
19849
+ const frameHandles = [];
19850
+ let observer;
19851
+ const tryRegister = () => {
19852
+ if (disposed) return;
19853
+ const portalRoot = resolveSheetCellEditorPortalRoot(ownerDocument);
19854
+ if (portalRoot === registeredPortalRoot) return;
19855
+ portalRegistration === null || portalRegistration === void 0 || portalRegistration.dispose();
19856
+ portalRegistration = void 0;
19857
+ registeredPortalRoot = null;
19858
+ if (!portalRoot) return;
19859
+ const rootRegistration = new DisposableCollection();
19860
+ registeredPortalRoot = portalRoot;
19861
+ if (options.interactionBoundaryService) rootRegistration.add(options.interactionBoundaryService.registerOwnedElement(options.embedId, portalRoot));
19862
+ if (options.focusCoordinator) {
19863
+ rootRegistration.add(options.focusCoordinator.registerElement({
19864
+ embedId: options.embedId,
19865
+ role: "child-editor",
19866
+ element: portalRoot
19867
+ }));
19868
+ const editorElement = ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
19869
+ if (editorElement && editorElement !== portalRoot) rootRegistration.add(options.focusCoordinator.registerElement({
19870
+ embedId: options.embedId,
19871
+ role: "child-editor",
19872
+ element: editorElement
19873
+ }));
19874
+ }
19875
+ portalRegistration = rootRegistration;
19876
+ };
19877
+ const scheduleRetry = (remaining) => {
19878
+ if (remaining <= 0 || !(view === null || view === void 0 ? void 0 : view.requestAnimationFrame)) return;
19879
+ const handle = view.requestAnimationFrame(() => {
19880
+ const index = frameHandles.indexOf(handle);
19881
+ if (index >= 0) frameHandles.splice(index, 1);
19882
+ tryRegister();
19883
+ if (!registeredPortalRoot) scheduleRetry(remaining - 1);
19884
+ });
19885
+ frameHandles.push(handle);
19886
+ };
19887
+ tryRegister();
19888
+ if (!registeredPortalRoot) scheduleRetry(2);
19889
+ if ((view === null || view === void 0 ? void 0 : view.MutationObserver) && ownerDocument.body) {
19890
+ observer = new view.MutationObserver(() => tryRegister());
19891
+ observer.observe(ownerDocument.body, {
19892
+ childList: true,
19893
+ subtree: true
19894
+ });
19895
+ }
19896
+ collection.add(toDisposable(() => {
19897
+ disposed = true;
19898
+ frameHandles.forEach((handle) => {
19899
+ var _view$cancelAnimation;
19900
+ return view === null || view === void 0 || (_view$cancelAnimation = view.cancelAnimationFrame) === null || _view$cancelAnimation === void 0 ? void 0 : _view$cancelAnimation.call(view, handle);
19901
+ });
19902
+ frameHandles.length = 0;
19903
+ observer === null || observer === void 0 || observer.disconnect();
19904
+ observer = void 0;
19905
+ portalRegistration === null || portalRegistration === void 0 || portalRegistration.dispose();
19906
+ portalRegistration = void 0;
19907
+ registeredPortalRoot = null;
19908
+ }));
19909
+ return collection;
19910
+ }
19911
+ function resolveSheetCellEditorPortalRoot(ownerDocument = document) {
19912
+ var _ref;
19913
+ return (_ref = ownerDocument.getElementById(SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID)) !== null && _ref !== void 0 ? _ref : ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
19914
+ }
19915
+
19533
19916
  //#endregion
19534
19917
  //#region src/views/editor-container/hooks.ts
19535
19918
  /**
@@ -19599,19 +19982,65 @@ function isTransparentColor(color) {
19599
19982
  const normalizedColor = color.trim().toLowerCase().replace(/\s+/g, "");
19600
19983
  return normalizedColor === "transparent" || normalizedColor === "rgba(0,0,0,0)";
19601
19984
  }
19985
+ function shouldRefocusCellEditorAfterPointerDown(options) {
19986
+ const { root, target, activeElement, isEditorFocusing } = options;
19987
+ if (!root || !(target instanceof HTMLElement) || !(activeElement instanceof HTMLElement)) return true;
19988
+ const owner = root.closest(`[${SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE}]`);
19989
+ const embedId = owner === null || owner === void 0 ? void 0 : owner.getAttribute(SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE);
19990
+ if (!embedId) return true;
19991
+ const targetInOwner = target.closest(`[${SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE}="${embedId}"]`) != null;
19992
+ const activeOwnerElement = activeElement.closest(`[${SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE}="${embedId}"]`);
19993
+ if (targetInOwner && activeOwnerElement && isEmbedRuntimeInteractiveElement(activeElement)) return false;
19994
+ if (!isEditorFocusing) return true;
19995
+ return target.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`) == null || activeOwnerElement == null;
19996
+ }
19997
+ function isEmbedRuntimeInteractiveElement(element) {
19998
+ const role = element.getAttribute(SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE);
19999
+ return role === "child-editor" || role === "child-popup" || role === "floating-menu";
20000
+ }
20001
+ function shouldPreserveEmbedPopupFocus(embedId, ownerDocument) {
20002
+ var _activeElement$getAtt, _activeElement$closes;
20003
+ if (!embedId) return false;
20004
+ const activeElement = ownerDocument.activeElement;
20005
+ if (!(activeElement instanceof HTMLElement)) return false;
20006
+ if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
20007
+ const role = (_activeElement$getAtt = activeElement.getAttribute("data-embed-runtime-focus-role")) !== null && _activeElement$getAtt !== void 0 ? _activeElement$getAtt : (_activeElement$closes = activeElement.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _activeElement$closes === void 0 ? void 0 : _activeElement$closes.getAttribute(SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE);
20008
+ return role === "child-popup" || role === "floating-menu";
20009
+ }
20010
+ function shouldPreserveEmbedInteractiveFocus(embedId, ownerDocument) {
20011
+ var _activeElement$getAtt2, _activeElement$closes2;
20012
+ if (!embedId) return false;
20013
+ const activeElement = ownerDocument.activeElement;
20014
+ if (!(activeElement instanceof HTMLElement)) return false;
20015
+ if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
20016
+ const role = (_activeElement$getAtt2 = activeElement.getAttribute("data-embed-runtime-focus-role")) !== null && _activeElement$getAtt2 !== void 0 ? _activeElement$getAtt2 : (_activeElement$closes2 = activeElement.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _activeElement$closes2 === void 0 ? void 0 : _activeElement$closes2.getAttribute(SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE);
20017
+ return role == null && activeElement.tagName !== "CANVAS" || role === "child-editor" || role === "child-popup" || role === "floating-menu";
20018
+ }
20019
+ function isEmbedRuntimeEditorOrPopup(target) {
20020
+ var _target$getAttribute, _target$closest;
20021
+ if (!(target instanceof HTMLElement)) return false;
20022
+ const role = (_target$getAttribute = target.getAttribute("data-embed-runtime-focus-role")) !== null && _target$getAttribute !== void 0 ? _target$getAttribute : (_target$closest = target.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _target$closest === void 0 ? void 0 : _target$closest.getAttribute(SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE);
20023
+ return role === "child-editor" || role === "child-popup" || role === "floating-menu";
20024
+ }
19602
20025
  /**
19603
20026
  * Cell editor container.
19604
20027
  * @returns the rendered cell editor container.
19605
20028
  */
19606
- const EditorContainer = () => {
20029
+ function EditorContainer() {
19607
20030
  const [state, setState] = useState({ ...EDITOR_DEFAULT_POSITION });
19608
20031
  const cellEditorManagerService = useDependency(ICellEditorManagerService);
20032
+ const injector = useDependency(Injector);
19609
20033
  const editorService = useDependency(IEditorService);
20034
+ const instanceService = useDependency(IUniverInstanceService);
19610
20035
  const contextService = useDependency(IContextService);
19611
20036
  const themeService = useDependency(ThemeService);
19612
20037
  const componentManager = useDependency(ComponentManager);
19613
20038
  const editorBridgeService = useDependency(IEditorBridgeService);
20039
+ const cellEditorResizeService = useDependency(SheetCellEditorResizeService);
20040
+ const rootRef = useRef(null);
20041
+ const pointerRefocusTimerRef = useRef(void 0);
19614
20042
  const visible = useObservable(editorBridgeService.visible$);
20043
+ const [runtimeFocusRevision, setRuntimeFocusRevision] = useState(0);
19615
20044
  const commandService = useDependency(ICommandService);
19616
20045
  const disableAutoFocus = useObservable(() => contextService.subscribeContextValue$(DISABLE_AUTO_FOCUS_KEY), false, void 0, [contextService, DISABLE_AUTO_FOCUS_KEY]);
19617
20046
  const FormulaEditor = componentManager.get(EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY);
@@ -19644,17 +20073,54 @@ const EditorContainer = () => {
19644
20073
  sub.unsubscribe();
19645
20074
  };
19646
20075
  }, []);
20076
+ useEffect(() => {
20077
+ if (!injector.has(ISheetEmbedFloatingGeometryService)) return;
20078
+ const subscription = injector.get(ISheetEmbedFloatingGeometryService).geometryInvalidated$.subscribe(() => {
20079
+ cellEditorResizeService.resizeCellEditor();
20080
+ });
20081
+ return () => subscription.unsubscribe();
20082
+ }, [cellEditorResizeService, injector]);
20083
+ useEffect(() => {
20084
+ if (!injector.has(ISheetEmbedRuntimeFocusCoordinator)) return;
20085
+ const subscription = injector.get(ISheetEmbedRuntimeFocusCoordinator).runtimeSessionChanged$.subscribe(() => {
20086
+ setRuntimeFocusRevision((revision) => revision + 1);
20087
+ });
20088
+ return () => subscription.unsubscribe();
20089
+ }, [injector]);
19647
20090
  useEffect(() => {
19648
20091
  if (!disableAutoFocus) cellEditorManagerService.setFocus(true);
19649
20092
  }, [disableAutoFocus, state]);
19650
20093
  useEffect(() => {
20094
+ var _rootRef$current$owne, _rootRef$current, _ownerDocument$defaul;
19651
20095
  if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
20096
+ cellEditorResizeService.fitTextSize();
20097
+ if (contextService.getContextValue(FOCUSING_FX_BAR_EDITOR)) return;
20098
+ const ownerDocument = (_rootRef$current$owne = (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.ownerDocument) !== null && _rootRef$current$owne !== void 0 ? _rootRef$current$owne : document;
20099
+ const ownerWindow = (_ownerDocument$defaul = ownerDocument.defaultView) !== null && _ownerDocument$defaul !== void 0 ? _ownerDocument$defaul : window;
19652
20100
  let focusRetryFrame = 0;
19653
20101
  let finalFocusRetryFrame = 0;
20102
+ let delayedFocusTimer;
20103
+ const focusCellEditorElement = () => {
20104
+ var _resolveSheetEmbedRun;
20105
+ const scope = rootRef.current ? (_resolveSheetEmbedRun = resolveSheetEmbedRuntimeDomScope(rootRef.current)) !== null && _resolveSheetEmbedRun !== void 0 ? _resolveSheetEmbedRun : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
20106
+ if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
20107
+ focusSheetCellEditorElement(ownerDocument);
20108
+ if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
20109
+ delayedFocusTimer = ownerWindow.setTimeout(() => {
20110
+ delayedFocusTimer = void 0;
20111
+ if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
20112
+ focusSheetCellEditorElement(ownerDocument);
20113
+ }, 0);
20114
+ };
19654
20115
  const focusEditor = () => {
20116
+ var _resolveSheetEmbedRun2;
20117
+ if (contextService.getContextValue(FOCUSING_FX_BAR_EDITOR)) return;
20118
+ const scope = rootRef.current ? (_resolveSheetEmbedRun2 = resolveSheetEmbedRuntimeDomScope(rootRef.current)) !== null && _resolveSheetEmbedRun2 !== void 0 ? _resolveSheetEmbedRun2 : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
20119
+ if (shouldPreserveEmbedPopupFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
19655
20120
  const editor = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
19656
20121
  const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(DocSelectionRenderService);
19657
20122
  if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
20123
+ focusCellEditorElement();
19658
20124
  };
19659
20125
  focusEditor();
19660
20126
  focusRetryFrame = requestAnimationFrame(() => {
@@ -19664,8 +20130,185 @@ const EditorContainer = () => {
19664
20130
  return () => {
19665
20131
  cancelAnimationFrame(focusRetryFrame);
19666
20132
  cancelAnimationFrame(finalFocusRetryFrame);
20133
+ if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
19667
20134
  };
19668
- }, [editorService, visible === null || visible === void 0 ? void 0 : visible.visible]);
20135
+ }, [
20136
+ cellEditorResizeService,
20137
+ editorService,
20138
+ visible === null || visible === void 0 ? void 0 : visible.visible
20139
+ ]);
20140
+ useEffect(() => {
20141
+ var _instanceService$getF, _ref;
20142
+ if (!(visible === null || visible === void 0 ? void 0 : visible.visible) || !rootRef.current || !injector.has(ISheetEmbedRuntimeFocusCoordinator)) return;
20143
+ const focusCoordinator = injector.get(ISheetEmbedRuntimeFocusCoordinator);
20144
+ const focusedUnitId = (_instanceService$getF = instanceService.getFocusedUnit()) === null || _instanceService$getF === void 0 ? void 0 : _instanceService$getF.getUnitId();
20145
+ const rootRuntimeScope = resolveSheetEmbedRuntimeDomScope(rootRef.current);
20146
+ const unitRuntimeScope = [
20147
+ editState === null || editState === void 0 ? void 0 : editState.unitId,
20148
+ visible.unitId,
20149
+ focusedUnitId
20150
+ ].map((unitId) => focusCoordinator.resolveRuntimeScopeByChildUnitId(unitId)).find((resolvedScope) => resolvedScope != null);
20151
+ if (rootRuntimeScope && unitRuntimeScope && rootRuntimeScope.embedId !== unitRuntimeScope.embedId) return;
20152
+ const activeSessionScope = focusCoordinator.resolveActiveChildSessionRuntimeScope();
20153
+ const explicitRuntimeScope = unitRuntimeScope !== null && unitRuntimeScope !== void 0 ? unitRuntimeScope : rootRuntimeScope;
20154
+ if (activeSessionScope && rootRuntimeScope && !unitRuntimeScope && rootRuntimeScope.embedId !== activeSessionScope.embedId) return;
20155
+ const scope = (_ref = explicitRuntimeScope !== null && explicitRuntimeScope !== void 0 ? explicitRuntimeScope : activeSessionScope) !== null && _ref !== void 0 ? _ref : resolveActiveSheetEmbedRuntimeDomScope(rootRef.current.ownerDocument);
20156
+ if (!scope) return;
20157
+ const collection = new DisposableCollection();
20158
+ const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
20159
+ const editorRoot = rootRef.current;
20160
+ collection.add(focusCoordinator.acquireLease({
20161
+ embedId: scope.embedId,
20162
+ role: "child-editor",
20163
+ owner: "sheet-cell-editor",
20164
+ hostUnitId: scope.hostUnitId,
20165
+ childUnitId: scope.childUnitId,
20166
+ associatedChildUnitIds: [DOCS_NORMAL_EDITOR_UNIT_ID_KEY]
20167
+ }));
20168
+ if (interactionBoundaryService) collection.add(interactionBoundaryService.registerOwnedElement(scope.embedId, editorRoot));
20169
+ collection.add(focusCoordinator.registerElement({
20170
+ embedId: scope.embedId,
20171
+ role: "child-editor",
20172
+ element: editorRoot
20173
+ }));
20174
+ collection.add(registerSheetCellEditorRuntimePortal({
20175
+ embedId: scope.embedId,
20176
+ ownerDocument: rootRef.current.ownerDocument,
20177
+ interactionBoundaryService,
20178
+ focusCoordinator
20179
+ }));
20180
+ if (scope.childType === UniverInstanceType.UNIVER_SHEET && scope.childUnitId) {
20181
+ const ownerDocument = rootRef.current.ownerDocument;
20182
+ let pointerRetryFrame = 0;
20183
+ const focusEditor = () => {
20184
+ if (contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) || shouldPreserveEmbedPopupFocus(scope.embedId, ownerDocument)) return;
20185
+ const editor = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
20186
+ const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(DocSelectionRenderService);
20187
+ if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
20188
+ focusSheetCellEditorElement(ownerDocument);
20189
+ };
20190
+ const refocusEditorAfterRuntimePointer = (event) => {
20191
+ if (!focusCoordinator.isChildUnitRuntimeEvent(scope.childUnitId, event.target, event) || isEmbedRuntimeEditorOrPopup(event.target)) return;
20192
+ cancelAnimationFrame(pointerRetryFrame);
20193
+ pointerRetryFrame = requestAnimationFrame(focusEditor);
20194
+ };
20195
+ ownerDocument.addEventListener("pointerdown", refocusEditorAfterRuntimePointer, true);
20196
+ ownerDocument.addEventListener("pointerup", refocusEditorAfterRuntimePointer, true);
20197
+ ownerDocument.addEventListener("click", refocusEditorAfterRuntimePointer, true);
20198
+ collection.add(toDisposable(() => {
20199
+ cancelAnimationFrame(pointerRetryFrame);
20200
+ ownerDocument.removeEventListener("pointerdown", refocusEditorAfterRuntimePointer, true);
20201
+ ownerDocument.removeEventListener("pointerup", refocusEditorAfterRuntimePointer, true);
20202
+ ownerDocument.removeEventListener("click", refocusEditorAfterRuntimePointer, true);
20203
+ }));
20204
+ }
20205
+ return () => collection.dispose();
20206
+ }, [
20207
+ contextService,
20208
+ editState === null || editState === void 0 ? void 0 : editState.unitId,
20209
+ editorService,
20210
+ injector,
20211
+ instanceService,
20212
+ runtimeFocusRevision,
20213
+ visible === null || visible === void 0 ? void 0 : visible.unitId,
20214
+ visible === null || visible === void 0 ? void 0 : visible.visible
20215
+ ]);
20216
+ useEffect(() => {
20217
+ var _rootRef$current$owne2, _rootRef$current2, _ownerDocument$defaul2;
20218
+ if ((visible === null || visible === void 0 ? void 0 : visible.visible) || !injector.has(ISheetEmbedRuntimeFocusCoordinator)) return;
20219
+ const focusCoordinator = injector.get(ISheetEmbedRuntimeFocusCoordinator);
20220
+ const activeSessionScope = focusCoordinator.resolveActiveChildSessionRuntimeScope();
20221
+ const childUnitId = activeSessionScope === null || activeSessionScope === void 0 ? void 0 : activeSessionScope.childUnitId;
20222
+ if (!activeSessionScope || activeSessionScope.childType !== UniverInstanceType.UNIVER_SHEET || !childUnitId || !instanceService.getUnit(childUnitId, UniverInstanceType.UNIVER_SHEET)) return;
20223
+ const ownerDocument = (_rootRef$current$owne2 = (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.ownerDocument) !== null && _rootRef$current$owne2 !== void 0 ? _rootRef$current$owne2 : document;
20224
+ const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
20225
+ const portalRegistration = registerSheetCellEditorRuntimePortal({
20226
+ embedId: activeSessionScope.embedId,
20227
+ ownerDocument,
20228
+ interactionBoundaryService,
20229
+ focusCoordinator
20230
+ });
20231
+ const ownerWindow = (_ownerDocument$defaul2 = ownerDocument.defaultView) !== null && _ownerDocument$defaul2 !== void 0 ? _ownerDocument$defaul2 : window;
20232
+ let delayedFocusTimer;
20233
+ const focusCellEditorElement = () => {
20234
+ if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
20235
+ focusSheetCellEditorElement(ownerDocument);
20236
+ if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
20237
+ delayedFocusTimer = ownerWindow.setTimeout(() => {
20238
+ delayedFocusTimer = void 0;
20239
+ if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
20240
+ focusSheetCellEditorElement(ownerDocument);
20241
+ }, 0);
20242
+ };
20243
+ const focusHiddenEditor = () => {
20244
+ if (shouldPreserveEmbedPopupFocus(activeSessionScope.embedId, ownerDocument)) return;
20245
+ const editor = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
20246
+ const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(DocSelectionRenderService);
20247
+ if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
20248
+ focusCellEditorElement();
20249
+ };
20250
+ let retryFrame = 0;
20251
+ let finalRetryFrame = 0;
20252
+ let pointerRetryFrame = 0;
20253
+ focusHiddenEditor();
20254
+ retryFrame = requestAnimationFrame(() => {
20255
+ focusHiddenEditor();
20256
+ finalRetryFrame = requestAnimationFrame(focusHiddenEditor);
20257
+ });
20258
+ const refocusHiddenEditorAfterRuntimePointer = (event) => {
20259
+ if (!focusCoordinator.isChildUnitRuntimeEvent(childUnitId, event.target, event) || isEmbedRuntimeEditorOrPopup(event.target)) return;
20260
+ cancelAnimationFrame(pointerRetryFrame);
20261
+ pointerRetryFrame = requestAnimationFrame(focusHiddenEditor);
20262
+ };
20263
+ ownerDocument.addEventListener("pointerdown", refocusHiddenEditorAfterRuntimePointer, true);
20264
+ ownerDocument.addEventListener("pointerup", refocusHiddenEditorAfterRuntimePointer, true);
20265
+ ownerDocument.addEventListener("click", refocusHiddenEditorAfterRuntimePointer, true);
20266
+ return () => {
20267
+ cancelAnimationFrame(retryFrame);
20268
+ cancelAnimationFrame(finalRetryFrame);
20269
+ cancelAnimationFrame(pointerRetryFrame);
20270
+ if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
20271
+ ownerDocument.removeEventListener("pointerdown", refocusHiddenEditorAfterRuntimePointer, true);
20272
+ ownerDocument.removeEventListener("pointerup", refocusHiddenEditorAfterRuntimePointer, true);
20273
+ ownerDocument.removeEventListener("click", refocusHiddenEditorAfterRuntimePointer, true);
20274
+ portalRegistration.dispose();
20275
+ };
20276
+ }, [
20277
+ editorService,
20278
+ injector,
20279
+ instanceService,
20280
+ runtimeFocusRevision,
20281
+ visible === null || visible === void 0 ? void 0 : visible.visible
20282
+ ]);
20283
+ useEffect(() => {
20284
+ return () => {
20285
+ var _rootRef$current3;
20286
+ const ownerWindow = (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.ownerDocument.defaultView;
20287
+ if (ownerWindow && pointerRefocusTimerRef.current != null) ownerWindow.clearTimeout(pointerRefocusTimerRef.current);
20288
+ };
20289
+ }, []);
20290
+ const refocusEditorAfterPointerDown = useEvent((event) => {
20291
+ var _rootRef$current$owne3, _rootRef$current4, _ownerDocument$defaul3;
20292
+ if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
20293
+ const ownerDocument = (_rootRef$current$owne3 = (_rootRef$current4 = rootRef.current) === null || _rootRef$current4 === void 0 ? void 0 : _rootRef$current4.ownerDocument) !== null && _rootRef$current$owne3 !== void 0 ? _rootRef$current$owne3 : document;
20294
+ const ownerWindow = (_ownerDocument$defaul3 = ownerDocument.defaultView) !== null && _ownerDocument$defaul3 !== void 0 ? _ownerDocument$defaul3 : window;
20295
+ const editor = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
20296
+ const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(DocSelectionRenderService);
20297
+ const pointerTarget = event.target;
20298
+ const activeElementAtPointerDown = ownerDocument.activeElement;
20299
+ if (!shouldRefocusCellEditorAfterPointerDown({
20300
+ root: rootRef.current,
20301
+ target: pointerTarget,
20302
+ activeElement: activeElementAtPointerDown,
20303
+ isEditorFocusing: docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing
20304
+ })) return;
20305
+ if (pointerRefocusTimerRef.current != null) ownerWindow.clearTimeout(pointerRefocusTimerRef.current);
20306
+ pointerRefocusTimerRef.current = ownerWindow.setTimeout(() => {
20307
+ pointerRefocusTimerRef.current = void 0;
20308
+ if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
20309
+ focusSheetCellEditorElement(ownerDocument);
20310
+ }, 0);
20311
+ });
19669
20312
  useSidebarClick(useEvent(() => {
19670
20313
  if (editorBridgeService.isVisible().visible) commandService.executeCommand(SetCellEditVisibleOperation.id, {
19671
20314
  visible: false,
@@ -19684,7 +20327,10 @@ const EditorContainer = () => {
19684
20327
  });
19685
20328
  });
19686
20329
  return /* @__PURE__ */ jsx("div", {
20330
+ ref: rootRef,
20331
+ "data-u-comp": "editor",
19687
20332
  className: "univer-absolute univer-z-10 univer-flex",
20333
+ onPointerDownCapture: refocusEditorAfterPointerDown,
19688
20334
  style: {
19689
20335
  left: state.left,
19690
20336
  top: state.top,
@@ -19709,17 +20355,15 @@ const EditorContainer = () => {
19709
20355
  resetSelectionOnBlur: false,
19710
20356
  isSingle: false,
19711
20357
  autoScrollbar: false,
19712
- onFormulaSelectingChange: (isSelecting, isFocusing) => {
19713
- if (!isFocusing) return;
20358
+ onFormulaSelectingChange: (isSelecting) => {
19714
20359
  if (isSelecting) editorBridgeService.enableForceKeepVisible();
19715
20360
  else editorBridgeService.disableForceKeepVisible();
19716
20361
  },
19717
- disableSelectionOnClick: true,
19718
20362
  disableContextMenu: false,
19719
20363
  canvasStyle: { backgroundColor: "transparent" }
19720
20364
  })
19721
20365
  });
19722
- };
20366
+ }
19723
20367
 
19724
20368
  //#endregion
19725
20369
  //#region src/services/utils/defined-name-utils.ts
@@ -19764,6 +20408,7 @@ function DefinedNameOverlay({ search, isInputEvent }) {
19764
20408
  const definedNamesService = useDependency(IDefinedNamesService);
19765
20409
  const univerInstanceService = useDependency(IUniverInstanceService);
19766
20410
  const sidebarService = useDependency(ISidebarService);
20411
+ const direction = localeService.getDirection();
19767
20412
  const unitId = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId();
19768
20413
  const getDefinedNameMap = () => {
19769
20414
  const definedNameMap = definedNamesService.getDefinedNameMap(unitId);
@@ -19818,7 +20463,9 @@ function DefinedNameOverlay({ search, isInputEvent }) {
19818
20463
  definedNamesService.focusRange(unitId, id);
19819
20464
  };
19820
20465
  return /* @__PURE__ */ jsxs("div", {
19821
- className: "univer-w-[300px]",
20466
+ "data-u-comp": "defined-name-overlay",
20467
+ dir: direction,
20468
+ className: "univer-w-[300px] rtl:univer-text-right",
19822
20469
  children: [/* @__PURE__ */ jsx("div", {
19823
20470
  ref: listContainerRef,
19824
20471
  className: clsx("univer-max-h-[360px] univer-min-h-0 univer-overflow-y-auto", scrollbarClassName, { "univer-min-h-[30px]": filteredDefinedNames.length > 0 }),
@@ -19832,13 +20479,16 @@ function DefinedNameOverlay({ search, isInputEvent }) {
19832
20479
  focusDefinedName(definedName);
19833
20480
  },
19834
20481
  children: /* @__PURE__ */ jsxs("div", {
19835
- className: clsx("univer-flex univer-items-center univer-justify-between univer-gap-2 univer-py-1", borderBottomClassName),
20482
+ "data-u-comp": "defined-name-overlay-row",
20483
+ className: clsx("univer-flex univer-items-center univer-gap-2 univer-py-1 rtl:univer-flex-row-reverse", borderBottomClassName),
19836
20484
  children: [/* @__PURE__ */ jsx("div", {
19837
- className: "univer-w-[50%] univer-flex-shrink-0 univer-truncate univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
20485
+ "data-u-comp": "defined-name-overlay-name",
20486
+ className: "univer-min-w-0 univer-flex-1 univer-basis-0 univer-truncate univer-text-sm univer-text-gray-600 rtl:univer-text-right dark:!univer-text-gray-200",
19838
20487
  title: definedName.name,
19839
20488
  children: definedName.name
19840
20489
  }), /* @__PURE__ */ jsx("div", {
19841
- className: "univer-w-[50%] univer-flex-shrink-0 univer-truncate univer-text-xs univer-text-gray-400",
20490
+ "data-u-comp": "defined-name-overlay-reference",
20491
+ className: "univer-min-w-0 univer-flex-1 univer-basis-0 univer-truncate univer-text-xs univer-text-gray-400 rtl:univer-text-right",
19842
20492
  title: definedName.formulaOrRefString,
19843
20493
  children: definedName.formulaOrRefString
19844
20494
  })]
@@ -19847,7 +20497,8 @@ function DefinedNameOverlay({ search, isInputEvent }) {
19847
20497
  })
19848
20498
  })
19849
20499
  }), /* @__PURE__ */ jsxs("div", {
19850
- className: "univer-cursor-pointer univer-p-2 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-600",
20500
+ "data-u-comp": "defined-name-overlay-footer",
20501
+ className: "univer-cursor-pointer univer-p-2 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 rtl:univer-text-right dark:hover:!univer-bg-gray-600",
19851
20502
  onClick: openSlider,
19852
20503
  children: [/* @__PURE__ */ jsx("div", {
19853
20504
  className: "univer-mb-2 univer-text-sm univer-font-semibold univer-text-gray-600 dark:!univer-text-gray-200",
@@ -20035,7 +20686,7 @@ function DefinedName({ disable }) {
20035
20686
  className: "univer-relative univer-box-border univer-flex univer-h-full univer-w-24 univer-border-r-gray-200 univer-py-1.5 univer-transition-all",
20036
20687
  children: [/* @__PURE__ */ jsx("input", {
20037
20688
  ref: inputRef,
20038
- className: clsx("univer-box-border univer-size-full univer-appearance-none univer-pl-1.5 univer-pr-5 univer-text-gray-900 focus:univer-outline-none dark:!univer-border-r-gray-700 dark:!univer-bg-gray-900 dark:!univer-text-white", borderRightClassName, { "univer-cursor-not-allowed": disable }),
20689
+ className: clsx("univer-box-border univer-size-full univer-appearance-none univer-pl-1.5 univer-pr-5 univer-text-gray-900 focus:univer-outline-none rtl:univer-pl-5 rtl:univer-pr-1.5 dark:!univer-border-r-gray-700 dark:!univer-bg-gray-900 dark:!univer-text-white", borderRightClassName, { "univer-cursor-not-allowed": disable }),
20039
20690
  type: "text",
20040
20691
  value: inputValue,
20041
20692
  onChange: handleChangeSelection,
@@ -20054,7 +20705,7 @@ function DefinedName({ disable }) {
20054
20705
  onOpenChange: setOpen,
20055
20706
  onOpenAutoFocus: (e) => e.preventDefault(),
20056
20707
  children: /* @__PURE__ */ jsx("a", {
20057
- className: clsx("univer-absolute univer-right-0 univer-top-0 univer-flex univer-h-full univer-cursor-pointer univer-items-center univer-justify-center univer-px-1 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 dark:!univer-text-white dark:hover:!univer-bg-gray-800", { "univer-cursor-not-allowed univer-text-gray-300 hover:univer-bg-transparent dark:!univer-text-gray-700": disable }),
20708
+ className: clsx("univer-absolute univer-right-0 univer-top-0 univer-flex univer-h-full univer-cursor-pointer univer-items-center univer-justify-center univer-px-1 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 rtl:univer-left-0 rtl:univer-right-auto dark:!univer-text-white dark:hover:!univer-bg-gray-800", { "univer-cursor-not-allowed univer-text-gray-300 hover:univer-bg-transparent dark:!univer-text-gray-700": disable }),
20058
20709
  children: /* @__PURE__ */ jsx(MoreDownIcon, {})
20059
20710
  })
20060
20711
  })]
@@ -20202,9 +20853,9 @@ function FormulaBar(props) {
20202
20853
  const shouldSkipFocus = useRef(false);
20203
20854
  const handlePointerDown = () => {
20204
20855
  try {
20856
+ contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, true);
20205
20857
  if (editorBridgeService.isVisible().visible === false) {
20206
20858
  if (editorActivationDisable) {
20207
- contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, true);
20208
20859
  editorService.focus(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
20209
20860
  return;
20210
20861
  }
@@ -20213,12 +20864,12 @@ function FormulaBar(props) {
20213
20864
  eventType: DeviceInputEventType.PointerDown,
20214
20865
  unitId: editState.unitId
20215
20866
  })) {
20867
+ contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, false);
20216
20868
  shouldSkipFocus.current = true;
20217
- return;
20218
20869
  }
20219
20870
  }
20220
- contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, true);
20221
20871
  } catch (e) {
20872
+ contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, false);
20222
20873
  shouldSkipFocus.current = true;
20223
20874
  throw e;
20224
20875
  }
@@ -20299,7 +20950,7 @@ function FormulaBar(props) {
20299
20950
  }), /* @__PURE__ */ jsx("div", {
20300
20951
  className: clsx("univer-flex univer-h-full univer-w-5 univer-cursor-pointer univer-items-center univer-justify-center univer-text-xs univer-text-gray-700 dark:!univer-text-gray-200", { "univer-cursor-not-allowed univer-text-gray-200 dark:!univer-text-gray-700": editDisable }),
20301
20952
  onClick: handleArrowClick,
20302
- children: /* @__PURE__ */ jsx(DropdownIcon, { className: clsx({ "univer-rotate-180": arrowDirection === 1 }) })
20953
+ children: /* @__PURE__ */ jsx(DownIcon, { className: clsx({ "univer-rotate-180": arrowDirection === 1 }) })
20303
20954
  })]
20304
20955
  })]
20305
20956
  }),
@@ -20431,7 +21082,7 @@ function SheetBarMenu() {
20431
21082
  //#endregion
20432
21083
  //#region src/views/sheet-bar/sheet-bar-tabs/SheetBarItem.tsx
20433
21084
  function SheetBarItem(props) {
20434
- const { sheetId, label, color, selected, className, onKeyDown, tabIndex } = props;
21085
+ const { sheetId, label, color, selected, className, onKeyDown, onClick, tabIndex } = props;
20435
21086
  const themeService = useDependency(ThemeService);
20436
21087
  const getTextColor = (color) => {
20437
21088
  const darkTextColor = themeService.getColorFromTheme("gray.900");
@@ -20447,6 +21098,7 @@ function SheetBarItem(props) {
20447
21098
  "aria-selected": currentSelected,
20448
21099
  tabIndex: tabIndex !== null && tabIndex !== void 0 ? tabIndex : currentSelected ? 0 : -1,
20449
21100
  onKeyDown,
21101
+ onClick,
20450
21102
  className: clsx("univer-mx-1 univer-box-border univer-flex univer-flex-grow univer-cursor-pointer univer-select-none univer-flex-row univer-items-center univer-rounded univer-text-xs univer-transition-[colors,box-shadow] focus-visible:univer-ring-2 focus-visible:univer-ring-primary-500", {
20451
21103
  "dark:!univer-text-white": !color || color && !textColor,
20452
21104
  "univer-justify-center univer-bg-white univer-font-bold univer-text-primary-700 univer-shadow": currentSelected,
@@ -20489,6 +21141,49 @@ function SheetBarTabsContextMenu(props) {
20489
21141
  })] });
20490
21142
  }
20491
21143
 
21144
+ //#endregion
21145
+ //#region src/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-drag-sort.ts
21146
+ function getMidline(item) {
21147
+ return item.left + item.width / 2;
21148
+ }
21149
+ function calculateSheetTabDragSort(items, activeIndex, dragOffsetX) {
21150
+ const itemOffsets = items.map(() => 0);
21151
+ const activeItem = items[activeIndex];
21152
+ if (!activeItem) return {
21153
+ targetIndex: activeIndex,
21154
+ itemOffsets
21155
+ };
21156
+ itemOffsets[activeIndex] = dragOffsetX;
21157
+ const activeLeft = activeItem.left + dragOffsetX;
21158
+ const activeRight = activeLeft + activeItem.width;
21159
+ let targetIndex = activeIndex;
21160
+ if (dragOffsetX > 0) {
21161
+ for (let index = activeIndex + 1; index < items.length; index++) if (activeRight > getMidline(items[index])) {
21162
+ itemOffsets[index] = -activeItem.width;
21163
+ targetIndex = index;
21164
+ }
21165
+ } else if (dragOffsetX < 0) {
21166
+ for (let index = activeIndex - 1; index >= 0; index--) if (activeLeft < getMidline(items[index])) {
21167
+ itemOffsets[index] = activeItem.width;
21168
+ targetIndex = index;
21169
+ }
21170
+ }
21171
+ return {
21172
+ targetIndex,
21173
+ itemOffsets
21174
+ };
21175
+ }
21176
+ function reorderItems(items, fromIndex, toIndex) {
21177
+ if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length) return [...items];
21178
+ const nextItems = [...items];
21179
+ const [movedItem] = nextItems.splice(fromIndex, 1);
21180
+ nextItems.splice(toIndex, 0, movedItem);
21181
+ return nextItems;
21182
+ }
21183
+ function getSheetTabTargetOrder(sheetOrder, visibleSheetIds, targetIndex) {
21184
+ return sheetOrder.indexOf(visibleSheetIds[targetIndex]);
21185
+ }
21186
+
20492
21187
  //#endregion
20493
21188
  //#region src/views/sheet-bar/sheet-bar-tabs/utils/animate.ts
20494
21189
  /**
@@ -20601,46 +21296,6 @@ var Animate = class {
20601
21296
  }
20602
21297
  };
20603
21298
 
20604
- //#endregion
20605
- //#region src/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-drag-sort.ts
20606
- function getMidline(item) {
20607
- return item.left + item.width / 2;
20608
- }
20609
- function calculateSheetTabDragSort(items, activeIndex, dragOffsetX) {
20610
- const itemOffsets = items.map(() => 0);
20611
- const activeItem = items[activeIndex];
20612
- if (!activeItem) return {
20613
- targetIndex: activeIndex,
20614
- itemOffsets
20615
- };
20616
- itemOffsets[activeIndex] = dragOffsetX;
20617
- const activeLeft = activeItem.left + dragOffsetX;
20618
- const activeRight = activeLeft + activeItem.width;
20619
- let targetIndex = activeIndex;
20620
- if (dragOffsetX > 0) {
20621
- for (let index = activeIndex + 1; index < items.length; index++) if (activeRight > getMidline(items[index])) {
20622
- itemOffsets[index] = -activeItem.width;
20623
- targetIndex = index;
20624
- }
20625
- } else if (dragOffsetX < 0) {
20626
- for (let index = activeIndex - 1; index >= 0; index--) if (activeLeft < getMidline(items[index])) {
20627
- itemOffsets[index] = activeItem.width;
20628
- targetIndex = index;
20629
- }
20630
- }
20631
- return {
20632
- targetIndex,
20633
- itemOffsets
20634
- };
20635
- }
20636
- function reorderItems(items, fromIndex, toIndex) {
20637
- if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length) return [...items];
20638
- const nextItems = [...items];
20639
- const [movedItem] = nextItems.splice(fromIndex, 1);
20640
- nextItems.splice(toIndex, 0, movedItem);
20641
- return nextItems;
20642
- }
20643
-
20644
21299
  //#endregion
20645
21300
  //#region src/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-name-editor.ts
20646
21301
  const MAX_SHEET_NAME_LENGTH = 31;
@@ -20810,7 +21465,7 @@ var SlideTabItem = class SlideTabItem {
20810
21465
  startSheetTabNameEditor({
20811
21466
  slideTabItem: this._slideTabItem,
20812
21467
  canStart: () => this._slideTabBar.getConfig().onNameChangeCheck(),
20813
- checkName: (name) => this._slideTabBar.getConfig().onNameCheckAlert(name),
21468
+ checkName: (name) => this._slideTabBar.getConfig().onNameCheckAlert(name, this.getId()),
20814
21469
  setEditMode: (editing) => {
20815
21470
  this._editMode = editing;
20816
21471
  },
@@ -20819,8 +21474,12 @@ var SlideTabItem = class SlideTabItem {
20819
21474
  this._slideTabBar.updateItems();
20820
21475
  },
20821
21476
  onCommit: (name, focusEvent) => {
20822
- this._slideTabBar.getConfig().onChangeName(this.getId(), name);
20823
- if (callback) callback(focusEvent);
21477
+ try {
21478
+ this._slideTabBar.getConfig().onChangeName(this.getId(), name);
21479
+ if (callback) callback(focusEvent);
21480
+ } finally {
21481
+ this._slideTabBar.addListener();
21482
+ }
20824
21483
  }
20825
21484
  });
20826
21485
  }
@@ -20829,7 +21488,7 @@ var SlideTabItem = class SlideTabItem {
20829
21488
  const input = this._slideTabItem.querySelector("span");
20830
21489
  if (!input) return false;
20831
21490
  const text = (_input$textContent = input.textContent) !== null && _input$textContent !== void 0 ? _input$textContent : "";
20832
- return this._slideTabBar.getConfig().onNameCheckAlert(text);
21491
+ return this._slideTabBar.getConfig().onNameCheckAlert(text, this.getId());
20833
21492
  }
20834
21493
  animate() {
20835
21494
  return {
@@ -20982,6 +21641,7 @@ var SlideTabBar = class SlideTabBar {
20982
21641
  _defineProperty(this, "_downAction", void 0);
20983
21642
  _defineProperty(this, "_wheelAction", void 0);
20984
21643
  _defineProperty(this, "_scrollIncremental", 0);
21644
+ _defineProperty(this, "_dragStartScrollX", 0);
20985
21645
  _defineProperty(this, "_compareDirection", 0);
20986
21646
  _defineProperty(this, "_autoScrollTime", null);
20987
21647
  _defineProperty(this, "_slideScrollbar", void 0);
@@ -21014,7 +21674,6 @@ var SlideTabBar = class SlideTabBar {
21014
21674
  var _this$_activeTabItem2, _this$_activeTabItem3;
21015
21675
  (_this$_activeTabItem2 = this._activeTabItem) === null || _this$_activeTabItem2 === void 0 || _this$_activeTabItem2.removeEventListener("pointermove", this._moveAction);
21016
21676
  (_this$_activeTabItem3 = this._activeTabItem) === null || _this$_activeTabItem3 === void 0 || _this$_activeTabItem3.removeEventListener("pointerup", this._upAction);
21017
- this.removeListener();
21018
21677
  this._config.onChangeTab(downEvent, slideItemId);
21019
21678
  return;
21020
21679
  }
@@ -21022,6 +21681,7 @@ var SlideTabBar = class SlideTabBar {
21022
21681
  this._downActionX = downEvent.pageX;
21023
21682
  this._moveActionX = 0;
21024
21683
  this._scrollIncremental = 0;
21684
+ this._dragStartScrollX = this._slideScrollbar.getScrollX();
21025
21685
  this._activeTabItem = this._slideTabItems[slideItemIndex];
21026
21686
  if (!this._activeTabItem) {
21027
21687
  console.error("Not found active slide-tab-item in sheet bar");
@@ -21058,23 +21718,29 @@ var SlideTabBar = class SlideTabBar {
21058
21718
  }, SlideTabBar.LongPressDelay);
21059
21719
  };
21060
21720
  this._upAction = (upEvent) => {
21061
- var _this$_activeTabItem8, _this$_activeTabItem9, _this$_activeTabItem10, _this$_activeTabItem11;
21062
- if ((_this$_activeTabItem8 = this._activeTabItem) === null || _this$_activeTabItem8 === void 0 ? void 0 : _this$_activeTabItem8.isEditMode()) return;
21721
+ var _this$_activeTabItem8, _this$_activeTabItem9, _this$_activeTabItem10;
21063
21722
  if (this._longPressTimer) {
21064
21723
  clearTimeout(this._longPressTimer);
21065
21724
  this._longPressTimer = null;
21066
21725
  }
21067
21726
  if (!this._activeTabItem) return;
21727
+ if (this._activeTabItem.isEditMode()) {
21728
+ const activeSlideItemElement = this._activeTabItem.getSlideTabItem();
21729
+ const pointerId = upEvent.pointerId;
21730
+ if (pointerId != null && activeSlideItemElement.hasPointerCapture(pointerId)) activeSlideItemElement.releasePointerCapture(pointerId);
21731
+ this._activeTabItem.removeEventListener("pointerup", this._upAction);
21732
+ return;
21733
+ }
21068
21734
  const isFromScroll = this._autoScrollTime !== null;
21069
21735
  this._closeAutoScroll();
21070
21736
  this._activeTabItem.disableFixed();
21071
21737
  this.updateItems();
21072
- const activeSlideItemElement = (_this$_activeTabItem9 = this._activeTabItem) === null || _this$_activeTabItem9 === void 0 ? void 0 : _this$_activeTabItem9.getSlideTabItem();
21738
+ const activeSlideItemElement = (_this$_activeTabItem8 = this._activeTabItem) === null || _this$_activeTabItem8 === void 0 ? void 0 : _this$_activeTabItem8.getSlideTabItem();
21073
21739
  if (!activeSlideItemElement) return;
21074
21740
  activeSlideItemElement.style.cursor = "";
21075
21741
  activeSlideItemElement.releasePointerCapture(upEvent.pointerId);
21076
- (_this$_activeTabItem10 = this._activeTabItem) === null || _this$_activeTabItem10 === void 0 || _this$_activeTabItem10.removeEventListener("pointermove", this._moveAction);
21077
- (_this$_activeTabItem11 = this._activeTabItem) === null || _this$_activeTabItem11 === void 0 || _this$_activeTabItem11.removeEventListener("pointerup", this._upAction);
21742
+ (_this$_activeTabItem9 = this._activeTabItem) === null || _this$_activeTabItem9 === void 0 || _this$_activeTabItem9.removeEventListener("pointermove", this._moveAction);
21743
+ (_this$_activeTabItem10 = this._activeTabItem) === null || _this$_activeTabItem10 === void 0 || _this$_activeTabItem10.removeEventListener("pointerup", this._upAction);
21078
21744
  if (this._config.onSlideEnd && this._activeTabItemIndex !== this._compareIndex && isFromScroll) {
21079
21745
  this.removeListener();
21080
21746
  this._config.onSlideEnd(upEvent, this._compareIndex || 0);
@@ -21082,6 +21748,7 @@ var SlideTabBar = class SlideTabBar {
21082
21748
  this._scrollIncremental = 0;
21083
21749
  this._downActionX = 0;
21084
21750
  this._moveActionX = 0;
21751
+ this._dragStartScrollX = this._slideScrollbar.getScrollX();
21085
21752
  this._compareIndex = 0;
21086
21753
  };
21087
21754
  this._moveAction = (moveEvent) => {
@@ -21118,9 +21785,9 @@ var SlideTabBar = class SlideTabBar {
21118
21785
  * @param currentIndex
21119
21786
  */
21120
21787
  update(currentIndex) {
21788
+ this.removeListener();
21121
21789
  this._config.currentIndex = currentIndex;
21122
21790
  this._initConfig();
21123
- this.removeListener();
21124
21791
  this.addListener();
21125
21792
  this.scrollToItem(currentIndex);
21126
21793
  }
@@ -21257,13 +21924,13 @@ var SlideTabBar = class SlideTabBar {
21257
21924
  return scrollX;
21258
21925
  }
21259
21926
  calculateActiveTabItemScrollX() {
21260
- var _this$_activeTabItem12;
21927
+ var _this$_activeTabItem11;
21261
21928
  let scrollX = 0;
21262
21929
  const padding = 4;
21263
21930
  const containerRect = this._slideTabBar.getBoundingClientRect();
21264
21931
  const containerLeftPosition = containerRect.left;
21265
21932
  const containerRightPosition = containerRect.left + containerRect.width;
21266
- const itemReact = (_this$_activeTabItem12 = this._activeTabItem) === null || _this$_activeTabItem12 === void 0 ? void 0 : _this$_activeTabItem12.getSlideTabItem().getBoundingClientRect();
21933
+ const itemReact = (_this$_activeTabItem11 = this._activeTabItem) === null || _this$_activeTabItem11 === void 0 ? void 0 : _this$_activeTabItem11.getSlideTabItem().getBoundingClientRect();
21267
21934
  if (!itemReact) return 0;
21268
21935
  const itemLeft = itemReact.left;
21269
21936
  const itemWidth = itemReact.width;
@@ -21275,6 +21942,7 @@ var SlideTabBar = class SlideTabBar {
21275
21942
  this.removeListener();
21276
21943
  this._downActionX = 0;
21277
21944
  this._moveActionX = 0;
21945
+ this._dragStartScrollX = this._slideScrollbar.getScrollX();
21278
21946
  this._compareDirection = 0;
21279
21947
  this._compareIndex = 0;
21280
21948
  this._slideTabItems = [];
@@ -21328,17 +21996,18 @@ var SlideTabBar = class SlideTabBar {
21328
21996
  }
21329
21997
  _updateDragSortState() {
21330
21998
  if (!this._activeTabItem) return;
21999
+ const dragSortOffsetX = this._moveActionX + this._slideScrollbar.getScrollX() - this._dragStartScrollX;
21331
22000
  const dragSortResult = calculateSheetTabDragSort(this._slideTabItems.map((item) => ({
21332
22001
  id: item.getId(),
21333
22002
  left: item.getMidLine() - item.getWidth() / 2,
21334
22003
  width: item.getWidth()
21335
- })), this._activeTabItemIndex, this._moveActionX);
22004
+ })), this._activeTabItemIndex, dragSortOffsetX);
21336
22005
  this._compareIndex = dragSortResult.targetIndex;
21337
22006
  dragSortResult.itemOffsets.forEach((offset, index) => {
21338
22007
  const item = this._slideTabItems[index];
21339
22008
  if (!item) return;
21340
22009
  if (item.equals(this._activeTabItem)) {
21341
- this._compareDirection = item.translateX(offset);
22010
+ this._compareDirection = item.translateX(this._moveActionX);
21342
22011
  return;
21343
22012
  }
21344
22013
  item.animate().translateX(offset);
@@ -21392,7 +22061,9 @@ function SheetBarTabs() {
21392
22061
  const [contextMenuAnchorRect, setContextMenuAnchorRect] = useState(null);
21393
22062
  const slideTabBarRef = useRef(null);
21394
22063
  const slideTabBarContainerRef = useRef(null);
22064
+ const activeSheetIdRef = useRef(activeSheetId);
21395
22065
  const commandService = useDependency(ICommandService);
22066
+ const renderManagerService = useDependency(IRenderManagerService);
21396
22067
  const sheetBarService = useDependency(ISheetBarService);
21397
22068
  const localeService = useDependency(LocaleService);
21398
22069
  const confirmService = useDependency(IConfirmService);
@@ -21401,6 +22072,7 @@ function SheetBarTabs() {
21401
22072
  const rangeProtectionRuleModel = useDependency(RangeProtectionRuleModel);
21402
22073
  const permissionService = useDependency(IPermissionService);
21403
22074
  const workbook = useActiveWorkbook();
22075
+ const workbookRef = useRef(workbook);
21404
22076
  const resetOrder = useObservable(worksheetProtectionRuleModel.resetOrder$);
21405
22077
  const config = useConfigValue(UI_PLUGIN_CONFIG_KEY);
21406
22078
  const showContextMenu = (_config$contextMenu = config === null || config === void 0 ? void 0 : config.contextMenu) !== null && _config$contextMenu !== void 0 ? _config$contextMenu : true;
@@ -21454,9 +22126,9 @@ function SheetBarTabs() {
21454
22126
  openSheetNameErrorDialog("sheetNameSpecCharAlert", localeService.t("sheets-ui.sheetConfig.sheetNameSpecCharError"));
21455
22127
  return true;
21456
22128
  }, [localeService, openSheetNameErrorDialog]);
21457
- const nameRepeatCheck = useCallback((name) => {
21458
- var _workbook$getActiveSh;
21459
- if (((_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getName()) === name) return false;
22129
+ const nameRepeatCheck = useCallback((name, subUnitId) => {
22130
+ var _workbook$getSheetByS, _workbook$getActiveSh;
22131
+ if ((subUnitId ? (_workbook$getSheetByS = workbook.getSheetBySheetId(subUnitId)) === null || _workbook$getSheetByS === void 0 ? void 0 : _workbook$getSheetByS.getName() : (_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getName()) === name) return false;
21460
22132
  if (!workbook.checkSheetName(name)) return false;
21461
22133
  const id = "sheetNameRepeatAlert";
21462
22134
  confirmService.open({
@@ -21547,6 +22219,34 @@ function SheetBarTabs() {
21547
22219
  rightEnd: slideTabBar.isRightEnd()
21548
22220
  });
21549
22221
  }, [sheetBarService]);
22222
+ useEffect(() => {
22223
+ activeSheetIdRef.current = activeSheetId;
22224
+ }, [activeSheetId]);
22225
+ useEffect(() => {
22226
+ workbookRef.current = workbook;
22227
+ }, [workbook]);
22228
+ const syncActiveSheetRender = useCallback((subUnitId) => {
22229
+ const render = renderManagerService.getRenderById(workbookRef.current.getUnitId());
22230
+ try {
22231
+ render === null || render === void 0 || render.with(SheetSkeletonManagerService).setCurrent({ sheetId: subUnitId });
22232
+ render === null || render === void 0 || render.scene.makeDirty(true);
22233
+ render === null || render === void 0 || render.scene.render();
22234
+ } catch {}
22235
+ }, [renderManagerService]);
22236
+ const activateSheetTab = useCallback((subUnitId) => {
22237
+ if (!subUnitId || subUnitId === activeSheetIdRef.current) return;
22238
+ commandService.executeCommand(SetWorksheetActiveOperation.id, {
22239
+ subUnitId,
22240
+ unitId: workbookRef.current.getUnitId()
22241
+ }).then((result) => {
22242
+ if (result !== false) return;
22243
+ const worksheet = workbookRef.current.getSheetBySheetId(subUnitId);
22244
+ if (worksheet) {
22245
+ workbookRef.current.setActiveSheet(worksheet);
22246
+ syncActiveSheetRender(subUnitId);
22247
+ }
22248
+ });
22249
+ }, [commandService, syncActiveSheetRender]);
21550
22250
  const observeResize = useCallback((slideTabBar) => {
21551
22251
  var _slideTabBarContainer;
21552
22252
  const slideTabBarContainer = (_slideTabBarContainer = slideTabBarContainerRef.current) === null || _slideTabBarContainer === void 0 ? void 0 : _slideTabBarContainer.querySelector("[data-u-comp=slide-tab-bar]");
@@ -21655,8 +22355,8 @@ function SheetBarTabs() {
21655
22355
  slideTabBarContainer: slideTabBarContainerRef.current,
21656
22356
  currentIndex: 0,
21657
22357
  onChangeName: (subUnitId, worksheetName) => {
21658
- var _workbook$getSheetByS;
21659
- if (((_workbook$getSheetByS = workbook.getSheetBySheetId(subUnitId)) === null || _workbook$getSheetByS === void 0 ? void 0 : _workbook$getSheetByS.getName()) === worksheetName) {
22358
+ var _workbook$getSheetByS2;
22359
+ if (((_workbook$getSheetByS2 = workbook.getSheetBySheetId(subUnitId)) === null || _workbook$getSheetByS2 === void 0 ? void 0 : _workbook$getSheetByS2.getName()) === worksheetName) {
21660
22360
  updateSheetItems();
21661
22361
  return;
21662
22362
  }
@@ -21666,7 +22366,8 @@ function SheetBarTabs() {
21666
22366
  });
21667
22367
  },
21668
22368
  onSlideEnd: async (event, order) => {
21669
- await commandService.executeCommand(SetWorksheetOrderCommand.id, { order });
22369
+ const targetOrder = getSheetTabTargetOrder(workbook.getSheetOrders(), workbook.getUnhiddenWorksheets(), order);
22370
+ await commandService.executeCommand(SetWorksheetOrderCommand.id, { order: targetOrder });
21670
22371
  },
21671
22372
  onChangeTab: (_event, subUnitId) => {
21672
22373
  commandService.executeCommand(SetWorksheetActiveOperation.id, {
@@ -21677,8 +22378,8 @@ function SheetBarTabs() {
21677
22378
  onScroll: (state) => {
21678
22379
  sheetBarService.setScroll(state);
21679
22380
  },
21680
- onNameCheckAlert: (name) => {
21681
- return nameEmptyCheck(name) || sheetNameSpecCharCheck(name) || nameRepeatCheck(name);
22381
+ onNameCheckAlert: (name, subUnitId) => {
22382
+ return nameEmptyCheck(name) || sheetNameSpecCharCheck(name) || nameRepeatCheck(name, subUnitId);
21682
22383
  },
21683
22384
  onNameChangeCheck: canRenameActiveSheet
21684
22385
  });
@@ -21712,6 +22413,9 @@ function SheetBarTabs() {
21712
22413
  const renameSubscription = sheetBarService.renameId$.subscribe(() => {
21713
22414
  setTabEditor();
21714
22415
  });
22416
+ const activeSheetSubscription = workbook.activeSheet$.subscribe(() => {
22417
+ updateSheetItems();
22418
+ });
21715
22419
  return () => {
21716
22420
  commandDisposable.dispose();
21717
22421
  slideTabBar.destroy();
@@ -21719,6 +22423,7 @@ function SheetBarTabs() {
21719
22423
  scrollSubscription.unsubscribe();
21720
22424
  scrollXSubscription.unsubscribe();
21721
22425
  renameSubscription.unsubscribe();
22426
+ activeSheetSubscription.unsubscribe();
21722
22427
  disconnectResizeObserver === null || disconnectResizeObserver === void 0 || disconnectResizeObserver();
21723
22428
  };
21724
22429
  }, [
@@ -21737,6 +22442,19 @@ function SheetBarTabs() {
21737
22442
  const currentIndex = sheetList.findIndex((item) => item.sheetId === activeSheetId);
21738
22443
  (_slideTabBarRef$curre5 = slideTabBarRef.current) === null || _slideTabBarRef$curre5 === void 0 || _slideTabBarRef$curre5.update(currentIndex >= 0 ? currentIndex : 0);
21739
22444
  }, [activeSheetId, sheetList]);
22445
+ useEffect(() => {
22446
+ const handlePointerDownCapture = (event) => {
22447
+ var _tabElement$getAttrib;
22448
+ const container = slideTabBarContainerRef.current;
22449
+ const target = event.target;
22450
+ if (!container || !(target instanceof Element)) return;
22451
+ const tabElement = target.closest("[data-u-comp=slide-tab-item]");
22452
+ if (!tabElement || !container.contains(tabElement)) return;
22453
+ activateSheetTab((_tabElement$getAttrib = tabElement.getAttribute("data-id")) !== null && _tabElement$getAttrib !== void 0 ? _tabElement$getAttrib : void 0);
22454
+ };
22455
+ document.addEventListener("pointerdown", handlePointerDownCapture, true);
22456
+ return () => document.removeEventListener("pointerdown", handlePointerDownCapture, true);
22457
+ }, [activateSheetTab]);
21740
22458
  useEffect(() => {
21741
22459
  const subscription = merge$1(worksheetProtectionRuleModel.ruleChange$, rangeProtectionRuleModel.ruleChange$).subscribe(() => {
21742
22460
  updateSheetItems();
@@ -21836,7 +22554,8 @@ const SheetBar = () => {
21836
22554
  }),
21837
22555
  /* @__PURE__ */ jsx(SheetBarTabs, {}),
21838
22556
  (!leftScrollState || !rightScrollState) && /* @__PURE__ */ jsxs("div", {
21839
- className: "univer-relative univer-flex univer-items-center univer-px-2 after:univer-absolute after:univer-right-0 after:univer-top-1/2 after:univer-h-4 after:univer-w-px after:-univer-translate-y-1/2 after:univer-bg-gray-200 after:univer-content-[\"\"]",
22557
+ "data-u-comp": "sheet-bar-scroll-buttons",
22558
+ className: "univer-relative univer-flex univer-items-center univer-px-2 after:univer-absolute after:univer-right-0 after:univer-top-1/2 after:univer-h-4 after:univer-w-px after:-univer-translate-y-1/2 after:univer-bg-gray-200 after:univer-content-[\"\"] rtl:univer-flex-row-reverse rtl:after:univer-left-0 rtl:after:univer-right-auto",
21840
22559
  children: [/* @__PURE__ */ jsx(SheetBarButton, {
21841
22560
  disabled: leftScrollState,
21842
22561
  onClick: handleScrollLeft,
@@ -22083,31 +22802,52 @@ function RenderSheetFooter() {
22083
22802
  const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
22084
22803
  const menuManagerService = useDependency(IMenuManagerService);
22085
22804
  const showFooter = (_config$footer = config === null || config === void 0 ? void 0 : config.footer) !== null && _config$footer !== void 0 ? _config$footer : true;
22086
- if (!useActiveWorkbook() || !showFooter) return null;
22805
+ const workbook = useActiveWorkbook();
22806
+ const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
22807
+ const focusedUnitType = useFocusedUnitType();
22808
+ const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
22809
+ if (!workbook || !showFooter) return null;
22810
+ if (activeWorkbookEmbeddedRender) return null;
22811
+ if (!activeEmbedTab && focusedUnitType != null && focusedUnitType !== UniverInstanceType.UNIVER_SHEET) return null;
22087
22812
  const footerMenus = menuManagerService.getMenuByPositionKey(ContextMenuPosition.FOOTER_MENU);
22088
22813
  const { sheetBar = true, statisticBar = true, menus = true, zoomSlider = true } = (config === null || config === void 0 ? void 0 : config.footer) || {};
22089
- if (!sheetBar && !statisticBar && !menus && !zoomSlider) return null;
22814
+ const showStatisticBar = activeEmbedTab ? false : statisticBar;
22815
+ const showMenus = activeEmbedTab ? false : menus;
22816
+ const showZoomSlider = activeEmbedTab ? false : zoomSlider;
22817
+ if (!sheetBar && !showStatisticBar && !showMenus && !showZoomSlider) return null;
22090
22818
  return /* @__PURE__ */ jsxs("section", {
22091
22819
  className: "univer-box-border univer-grid univer-w-full univer-grid-flow-col univer-grid-cols-[1fr,auto,auto,auto] univer-items-center univer-justify-between univer-bg-white univer-px-5 univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-gray-200",
22092
22820
  style: { height: 36 },
22093
22821
  "data-range-selector": true,
22094
22822
  children: [
22095
22823
  sheetBar && /* @__PURE__ */ jsx(SheetBar, {}),
22096
- statisticBar && /* @__PURE__ */ jsx(StatusBar, {}),
22097
- menus && footerMenus.length > 0 && /* @__PURE__ */ jsx("div", {
22824
+ showStatisticBar && /* @__PURE__ */ jsx(StatusBar, {}),
22825
+ showMenus && footerMenus.length > 0 && /* @__PURE__ */ jsx("div", {
22098
22826
  className: "univer-box-border univer-flex univer-gap-2 univer-px-2",
22099
22827
  children: footerMenus.map((item) => {
22100
22828
  var _item$children;
22101
22829
  return (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.map((child) => (child === null || child === void 0 ? void 0 : child.item) && /* @__PURE__ */ jsx(ToolbarItem, { ...child.item }, child.key));
22102
22830
  })
22103
22831
  }),
22104
- zoomSlider && /* @__PURE__ */ jsx(SheetZoomSlider, {})
22832
+ showZoomSlider && /* @__PURE__ */ jsx(SheetZoomSlider, {})
22105
22833
  ]
22106
22834
  });
22107
22835
  }
22108
22836
  function RenderSheetHeader() {
22109
22837
  const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
22110
- if (!useHasWorkbook()) return null;
22838
+ const workbook = useActiveWorkbook();
22839
+ const hasWorkbook = !!workbook;
22840
+ const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
22841
+ const focusedUnitType = useFocusedUnitType();
22842
+ const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
22843
+ if (!hasWorkbook) return null;
22844
+ if (activeWorkbookEmbeddedRender) return null;
22845
+ if (activeEmbedTab) return null;
22846
+ if (focusedUnitType != null && focusedUnitType !== UniverInstanceType.UNIVER_SHEET) return /* @__PURE__ */ jsx("div", {
22847
+ "aria-hidden": true,
22848
+ className: "univer-h-7 univer-border-b univer-border-gray-200 univer-bg-white dark:!univer-border-gray-700 dark:!univer-bg-gray-900",
22849
+ "data-u-comp": "formula-bar-placeholder"
22850
+ });
22111
22851
  if ((config === null || config === void 0 ? void 0 : config.formulaBar) !== false) return /* @__PURE__ */ jsx(FormulaBar, {});
22112
22852
  return null;
22113
22853
  }
@@ -22115,19 +22855,108 @@ function RenderSheetHeader() {
22115
22855
  * @deprecated We should not write into this component anymore.
22116
22856
  */
22117
22857
  function RenderSheetContent() {
22858
+ var _componentManager$get;
22118
22859
  const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
22119
22860
  const hasWorkbook = useHasWorkbook();
22120
- const ShapeTextEditorContainer = useDependency(ComponentManager).get("ShapeTextEditorContainer");
22861
+ const componentManager = useDependency(ComponentManager);
22862
+ const workbook = useActiveWorkbook();
22863
+ const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
22864
+ const injector = useDependency(Injector);
22865
+ const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
22866
+ const ShapeTextEditorContainer = (_componentManager$get = componentManager.get("SheetShapeTextEditorContainer")) !== null && _componentManager$get !== void 0 ? _componentManager$get : componentManager.get("ShapeTextEditorContainer");
22867
+ useEffect(() => {
22868
+ var _tryGetSheetEmbedRunt;
22869
+ if (!workbook || activeEmbedTab || activeWorkbookEmbeddedRender) return;
22870
+ const instanceService = injector.get(IUniverInstanceService);
22871
+ instanceService.setCurrentUnitForType(workbook.getUnitId());
22872
+ instanceService.focusUnit(workbook.getUnitId());
22873
+ (_tryGetSheetEmbedRunt = tryGetSheetEmbedRuntimeService(injector)) === null || _tryGetSheetEmbedRunt === void 0 || _tryGetSheetEmbedRunt.clearTab();
22874
+ }, [
22875
+ activeEmbedTab,
22876
+ activeWorkbookEmbeddedRender,
22877
+ injector,
22878
+ workbook
22879
+ ]);
22121
22880
  if (!hasWorkbook) return null;
22881
+ if (activeWorkbookEmbeddedRender) return null;
22882
+ if (activeEmbedTab && workbook) return /* @__PURE__ */ jsx(RenderSheetEmbedTabHost, {
22883
+ workbook,
22884
+ worksheet: activeEmbedTab.worksheet
22885
+ });
22122
22886
  return /* @__PURE__ */ jsxs(Fragment, { children: [
22123
22887
  ShapeTextEditorContainer && /* @__PURE__ */ jsx(ShapeTextEditorContainer, {}),
22124
22888
  !(config === null || config === void 0 ? void 0 : config.disableEdit) && /* @__PURE__ */ jsx(EditorContainer, {}),
22125
22889
  /* @__PURE__ */ jsx(AutoFillPopupMenu, {})
22126
22890
  ] });
22127
22891
  }
22892
+ function RenderSheetEmbedTabHost(props) {
22893
+ const { workbook, worksheet } = props;
22894
+ const injector = useDependency(Injector);
22895
+ const embedData = getEmbedSheetsTabCustomData(worksheet.getConfig());
22896
+ const hostUnitId = workbook.getUnitId();
22897
+ const hostAnchorId = embedData === null || embedData === void 0 ? void 0 : embedData.hostAnchorId;
22898
+ const embedId = embedData === null || embedData === void 0 ? void 0 : embedData.embedId;
22899
+ useEffect(() => {
22900
+ if (!embedId || !hostAnchorId) return;
22901
+ const embedRuntimeService = tryGetSheetEmbedRuntimeService(injector);
22902
+ if (!embedRuntimeService) return;
22903
+ try {
22904
+ const disposable = embedRuntimeService.mountSheetTab({
22905
+ hostUnitId,
22906
+ hostAnchorId,
22907
+ embedId
22908
+ });
22909
+ return () => {
22910
+ disposable === null || disposable === void 0 || disposable.dispose();
22911
+ };
22912
+ } catch (error) {
22913
+ console.warn("[sheets-ui] failed to mount embedded sheet-tab block", error);
22914
+ }
22915
+ }, [
22916
+ embedId,
22917
+ hostAnchorId,
22918
+ hostUnitId,
22919
+ injector
22920
+ ]);
22921
+ return /* @__PURE__ */ jsx("div", {
22922
+ "data-embed-sheets-sheet-tab-host": hostAnchorId,
22923
+ className: "univer-absolute univer-inset-0 univer-z-40 univer-bg-white dark:!univer-bg-gray-900"
22924
+ });
22925
+ }
22128
22926
  function useHasWorkbook() {
22129
22927
  const univerInstanceService = useDependency(IUniverInstanceService);
22130
- return useMemo(() => univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).length > 0, [univerInstanceService, !!useObservable(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), null, false, [])]);
22928
+ const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), null, false, []);
22929
+ return useMemo(() => !!workbook, [workbook]);
22930
+ }
22931
+ function useActiveWorkbookIsEmbeddedRender(workbook) {
22932
+ const univerInstanceService = useDependency(IUniverInstanceService);
22933
+ return useMemo(() => {
22934
+ var _univerInstanceServic;
22935
+ if (!workbook) return false;
22936
+ return ((_univerInstanceServic = univerInstanceService.getUnitCreateOptions(workbook.getUnitId())) === null || _univerInstanceServic === void 0 ? void 0 : _univerInstanceServic.embeddedRender) === true;
22937
+ }, [univerInstanceService, workbook]);
22938
+ }
22939
+ function useFocusedUnitType() {
22940
+ const univerInstanceService = useDependency(IUniverInstanceService);
22941
+ const focusedUnitId = useObservable(() => univerInstanceService.focused$, null, false, [univerInstanceService]);
22942
+ return useMemo(() => {
22943
+ var _focusedUnit$type;
22944
+ if (!focusedUnitId) return null;
22945
+ if (isInternalEditorID(focusedUnitId) && univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) return UniverInstanceType.UNIVER_SHEET;
22946
+ const focusedUnit = univerInstanceService.getUnit(focusedUnitId);
22947
+ return (_focusedUnit$type = focusedUnit === null || focusedUnit === void 0 ? void 0 : focusedUnit.type) !== null && _focusedUnit$type !== void 0 ? _focusedUnit$type : null;
22948
+ }, [focusedUnitId, univerInstanceService]);
22949
+ }
22950
+ function useActiveSheetEmbedTabData(workbook) {
22951
+ const worksheet = useActiveWorksheet(workbook);
22952
+ return worksheet && getEmbedSheetsTabCustomData(worksheet.getConfig()) ? { worksheet } : void 0;
22953
+ }
22954
+ function tryGetSheetEmbedRuntimeService(injector) {
22955
+ try {
22956
+ return injector.get(ISheetEmbedRuntimeService);
22957
+ } catch {
22958
+ return;
22959
+ }
22131
22960
  }
22132
22961
 
22133
22962
  //#endregion
@@ -22698,10 +23527,8 @@ let SheetUIController = class SheetUIController extends Disposable {
22698
23527
  }
22699
23528
  _initFocusHandler() {
22700
23529
  this.disposeWithMe(this._layoutService.registerFocusHandler(UniverInstanceType.UNIVER_SHEET, (_unitId) => {
22701
- const renderManagerService = this._injector.get(IRenderManagerService);
22702
- const instanceService = this._injector.get(IUniverInstanceService);
22703
- const currentEditorRender = getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC, instanceService, renderManagerService);
22704
- const docSelectionRenderService = currentEditorRender === null || currentEditorRender === void 0 ? void 0 : currentEditorRender.with(DocSelectionRenderService);
23530
+ const cellEditorRender = this._injector.get(IRenderManagerService).getRenderById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
23531
+ const docSelectionRenderService = cellEditorRender === null || cellEditorRender === void 0 ? void 0 : cellEditorRender.with(DocSelectionRenderService);
22705
23532
  docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
22706
23533
  }));
22707
23534
  }
@@ -22742,7 +23569,7 @@ const useHighlightRange = (ranges = []) => {
22742
23569
  //#endregion
22743
23570
  //#region package.json
22744
23571
  var name = "@univerjs/sheets-ui";
22745
- var version = "1.0.0-alpha.1";
23572
+ var version = "1.0.0-alpha.3";
22746
23573
 
22747
23574
  //#endregion
22748
23575
  //#region src/controllers/cell-alert.controller.ts
@@ -22788,6 +23615,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
22788
23615
  this._selectionManagerService = _selectionManagerService;
22789
23616
  _defineProperty(this, "_popupMenuFeatureMap", /* @__PURE__ */ new Map());
22790
23617
  _defineProperty(this, "_popupMenuOffsetMap", /* @__PURE__ */ new Map());
23618
+ _defineProperty(this, "_popupDisposables", /* @__PURE__ */ new Set());
22791
23619
  _defineProperty(this, "_isSelectionMoving", false);
22792
23620
  this._initMoving();
22793
23621
  }
@@ -22836,6 +23664,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
22836
23664
  if (callback) return callback(unitId, subUnitId, drawingId, drawingType);
22837
23665
  }
22838
23666
  dispose() {
23667
+ Array.from(this._popupDisposables).forEach((disposable) => disposable.dispose());
23668
+ this._popupDisposables.clear();
22839
23669
  super.dispose();
22840
23670
  this._popupMenuFeatureMap.clear();
22841
23671
  this._popupMenuOffsetMap.clear();
@@ -22966,20 +23796,25 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
22966
23796
  bottom: top + height
22967
23797
  };
22968
23798
  const { position, position$, disposable } = this._createPositionObserver(bound, currentRender, skeleton, worksheet);
23799
+ const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
22969
23800
  const id = this._globalPopupManagerService.addPopup({
22970
23801
  ...popup,
22971
23802
  unitId,
22972
23803
  subUnitId,
23804
+ connectorInjector: popupInjector,
22973
23805
  anchorRect: position,
22974
23806
  anchorRect$: position$,
22975
23807
  canvasElement: currentRender.engine.getCanvasElement()
22976
23808
  });
23809
+ const disposableCollection = new DisposableCollection();
23810
+ disposableCollection.add(disposable);
23811
+ disposableCollection.add(toDisposable(() => {
23812
+ this._globalPopupManagerService.removePopup(id);
23813
+ position$.complete();
23814
+ }));
23815
+ const trackedDisposable = this._trackPopupDisposable(disposableCollection);
22977
23816
  return {
22978
- dispose: () => {
22979
- this._globalPopupManagerService.removePopup(id);
22980
- position$.complete();
22981
- disposable.dispose();
22982
- },
23817
+ dispose: () => trackedDisposable.dispose(),
22983
23818
  canDispose: () => this._globalPopupManagerService.activePopupId !== id
22984
23819
  };
22985
23820
  }
@@ -23003,28 +23838,42 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
23003
23838
  skeleton,
23004
23839
  currentRender
23005
23840
  });
23841
+ const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
23006
23842
  const id = this._globalPopupManagerService.addPopup({
23007
23843
  ...popup,
23008
23844
  unitId,
23009
23845
  subUnitId,
23846
+ connectorInjector: popupInjector,
23010
23847
  anchorRect: position,
23011
23848
  anchorRect$: position$,
23012
23849
  hiddenRects$: rects$,
23013
23850
  canvasElement: currentRender.engine.getCanvasElement()
23014
23851
  });
23852
+ const disposableCollection = new DisposableCollection();
23853
+ disposableCollection.add(disposable);
23854
+ disposableCollection.add(rectsObserverDisposable);
23855
+ disposableCollection.add(toDisposable(() => {
23856
+ this._globalPopupManagerService.removePopup(id);
23857
+ position$.complete();
23858
+ workbook = null;
23859
+ worksheet = null;
23860
+ }));
23861
+ const trackedDisposable = this._trackPopupDisposable(disposableCollection);
23015
23862
  return {
23016
- dispose: () => {
23017
- this._globalPopupManagerService.removePopup(id);
23018
- position$.complete();
23019
- disposable.dispose();
23020
- rectsObserverDisposable.dispose();
23021
- workbook = null;
23022
- worksheet = null;
23023
- },
23863
+ dispose: () => trackedDisposable.dispose(),
23024
23864
  canDispose: () => this._globalPopupManagerService.activePopupId !== id
23025
23865
  };
23026
23866
  }
23027
23867
  attachPopupToAbsolutePosition(bound, popup, _unitId, _subUnitId) {
23868
+ const position$ = new BehaviorSubject(bound);
23869
+ const disposable = this._attachAbsolutePopup(bound, position$.asObservable(), popup, _unitId, _subUnitId, () => position$.complete());
23870
+ if (!disposable) position$.complete();
23871
+ return disposable;
23872
+ }
23873
+ attachPopupToDynamicAbsolutePosition(bound, anchorRect$, popup, _unitId, _subUnitId) {
23874
+ return this._attachAbsolutePopup(bound, anchorRect$, popup, _unitId, _subUnitId);
23875
+ }
23876
+ _attachAbsolutePopup(bound, anchorRect$, popup, _unitId, _subUnitId, onDispose) {
23028
23877
  var _this$_renderManagerS3;
23029
23878
  const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
23030
23879
  const worksheet = workbook.getActiveSheet();
@@ -23036,20 +23885,24 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
23036
23885
  const currentRender = this._renderManagerService.getRenderById(unitId);
23037
23886
  if (!currentRender || !skeleton) return null;
23038
23887
  if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
23039
- const position$ = new BehaviorSubject(bound);
23888
+ const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
23040
23889
  const id = this._globalPopupManagerService.addPopup({
23041
23890
  ...popup,
23042
23891
  unitId,
23043
23892
  subUnitId,
23893
+ connectorInjector: popupInjector,
23044
23894
  anchorRect: bound,
23045
- anchorRect$: position$.asObservable(),
23895
+ anchorRect$,
23046
23896
  canvasElement: currentRender.engine.getCanvasElement()
23047
23897
  });
23898
+ const disposableCollection = new DisposableCollection();
23899
+ disposableCollection.add(toDisposable(() => {
23900
+ this._globalPopupManagerService.removePopup(id);
23901
+ onDispose === null || onDispose === void 0 || onDispose();
23902
+ }));
23903
+ const trackedDisposable = this._trackPopupDisposable(disposableCollection);
23048
23904
  return {
23049
- dispose: () => {
23050
- this._globalPopupManagerService.removePopup(id);
23051
- position$.complete();
23052
- },
23905
+ dispose: () => trackedDisposable.dispose(),
23053
23906
  canDispose: () => this._globalPopupManagerService.activePopupId !== id
23054
23907
  };
23055
23908
  }
@@ -23086,10 +23939,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
23086
23939
  skeleton,
23087
23940
  currentRender
23088
23941
  });
23942
+ const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
23089
23943
  const id = this._globalPopupManagerService.addPopup({
23090
23944
  ...popup,
23091
23945
  unitId,
23092
23946
  subUnitId,
23947
+ connectorInjector: popupInjector,
23093
23948
  anchorRect: position,
23094
23949
  anchorRect$: position$,
23095
23950
  canvasElement: currentRender.engine.getCanvasElement(),
@@ -23108,13 +23963,14 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
23108
23963
  startColumn: col,
23109
23964
  endColumn: col
23110
23965
  };
23966
+ const trackedDisposable = this._trackPopupDisposable(disposableCollection);
23111
23967
  disposableCollection.add(this._refRangeService.watchRange(unitId, subUnitId, watchedRange, (_, after) => {
23112
- if (!after) disposableCollection.dispose();
23968
+ if (!after) trackedDisposable.dispose();
23113
23969
  else updateRowCol(after.startRow, after.startColumn);
23114
23970
  }));
23115
23971
  return {
23116
23972
  dispose() {
23117
- disposableCollection.dispose();
23973
+ trackedDisposable.dispose();
23118
23974
  worksheet = null;
23119
23975
  workbook = null;
23120
23976
  },
@@ -23152,10 +24008,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
23152
24008
  skeleton,
23153
24009
  currentRender
23154
24010
  });
24011
+ const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
23155
24012
  const id = this._globalPopupManagerService.addPopup({
23156
24013
  ...popup,
23157
24014
  unitId,
23158
24015
  subUnitId,
24016
+ connectorInjector: popupInjector,
23159
24017
  anchorRect: position,
23160
24018
  anchorRect$: position$,
23161
24019
  canvasElement: currentRender.engine.getCanvasElement(),
@@ -23170,17 +24028,34 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
23170
24028
  }));
23171
24029
  disposableCollection.add(rectsObserverDisposable);
23172
24030
  const watchedRange = { ...range };
24031
+ const trackedDisposable = this._trackPopupDisposable(disposableCollection);
23173
24032
  disposableCollection.add(this._refRangeService.watchRange(unitId, subUnitId, watchedRange, (_, after) => {
23174
- if (!after) disposableCollection.dispose();
24033
+ if (!after) trackedDisposable.dispose();
23175
24034
  else updateRange(after);
23176
24035
  }));
23177
24036
  return {
23178
24037
  dispose() {
23179
- disposableCollection.dispose();
24038
+ trackedDisposable.dispose();
23180
24039
  },
23181
24040
  canDispose: () => this._globalPopupManagerService.activePopupId !== id
23182
24041
  };
23183
24042
  }
24043
+ _resolveEmbeddedPopupInjector(unitId, currentRender) {
24044
+ var _this$_univerInstance, _currentRender$getInj;
24045
+ return ((_this$_univerInstance = this._univerInstanceService.getUnitCreateOptions(unitId)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.embeddedRender) === true ? (_currentRender$getInj = currentRender.getInjector) === null || _currentRender$getInj === void 0 ? void 0 : _currentRender$getInj.call(currentRender) : void 0;
24046
+ }
24047
+ _trackPopupDisposable(disposable) {
24048
+ let disposed = false;
24049
+ const trackedDisposables = this._popupDisposables;
24050
+ const trackedDisposable = { dispose: () => {
24051
+ if (disposed) return;
24052
+ disposed = true;
24053
+ trackedDisposables.delete(trackedDisposable);
24054
+ disposable.dispose();
24055
+ } };
24056
+ trackedDisposables.add(trackedDisposable);
24057
+ return { dispose: () => trackedDisposable.dispose() };
24058
+ }
23184
24059
  /**
23185
24060
  *
23186
24061
  * @param initialRow
@@ -23196,7 +24071,10 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
23196
24071
  const position$ = new BehaviorSubject(position);
23197
24072
  const updatePosition = () => position$.next(this._calcCellPositionByCell(row, col, currentRender, skeleton, activeViewport));
23198
24073
  const disposable = new DisposableCollection();
23199
- disposable.add(currentRender.engine.clientRect$.subscribe(() => updatePosition()));
24074
+ disposable.add(currentRender.engine.clientRect$.subscribe({
24075
+ next: () => updatePosition(),
24076
+ error: () => {}
24077
+ }));
23200
24078
  disposable.add(fromEventSubject(currentRender.engine.onTransformChange$).pipe(throttleTime(16)).subscribe(() => updatePosition()));
23201
24079
  disposable.add(this._commandService.onCommandExecuted((commandInfo) => {
23202
24080
  if (commandInfo.id === SetWorksheetRowAutoHeightMutation.id) {
@@ -23273,7 +24151,10 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
23273
24151
  rightBottomPos$.next(rightBottomCoord);
23274
24152
  };
23275
24153
  const disposable = new DisposableCollection();
23276
- disposable.add(currentRender.engine.clientRect$.subscribe(() => updatePosition()));
24154
+ disposable.add(currentRender.engine.clientRect$.subscribe({
24155
+ next: () => updatePosition(),
24156
+ error: () => {}
24157
+ }));
23277
24158
  disposable.add(this._commandService.onCommandExecuted((commandInfo) => {
23278
24159
  if (commandInfo.id === SetWorksheetRowAutoHeightMutation.id) {
23279
24160
  if (commandInfo.params.rowsAutoHeightInfo.findIndex((item) => item.row === startRow) > -1) {
@@ -23445,6 +24326,23 @@ let CellPopupManagerService = class CellPopupManagerService extends Disposable {
23445
24326
  }
23446
24327
  if (!cache.horizontal && !cache.vertical) subUnitMap.realDeleteValue(row, col);
23447
24328
  }
24329
+ hidePopupsForUnit(unitId, subUnitId) {
24330
+ const unitMap = this._cellPopupMap.get(unitId);
24331
+ if (!unitMap) return;
24332
+ const targets = [];
24333
+ (subUnitId ? [[subUnitId, unitMap.get(subUnitId)]] : [...unitMap.entries()]).forEach(([currentSubUnitId, subUnitMap]) => {
24334
+ subUnitMap === null || subUnitMap === void 0 || subUnitMap.forValue((row, col) => {
24335
+ targets.push({
24336
+ subUnitId: currentSubUnitId,
24337
+ row,
24338
+ col
24339
+ });
24340
+ });
24341
+ });
24342
+ targets.forEach((target) => this.hidePopup(unitId, target.subUnitId, target.row, target.col));
24343
+ if (subUnitId) unitMap.delete(subUnitId);
24344
+ else this._cellPopupMap.delete(unitId);
24345
+ }
23448
24346
  };
23449
24347
  CellPopupManagerService = __decorate([__decorateParam(0, Inject(SheetCanvasPopManagerService))], CellPopupManagerService);
23450
24348
 
@@ -24083,56 +24981,6 @@ function BorderLine(props) {
24083
24981
 
24084
24982
  //#endregion
24085
24983
  //#region src/views/border-panel/BorderPanel.tsx
24086
- const BORDER_SIZE_CHILDREN = [
24087
- {
24088
- label: BorderStyleTypes.THIN,
24089
- value: BorderStyleTypes.THIN
24090
- },
24091
- {
24092
- label: BorderStyleTypes.HAIR,
24093
- value: BorderStyleTypes.HAIR
24094
- },
24095
- {
24096
- label: BorderStyleTypes.DOTTED,
24097
- value: BorderStyleTypes.DOTTED
24098
- },
24099
- {
24100
- label: BorderStyleTypes.DASHED,
24101
- value: BorderStyleTypes.DASHED
24102
- },
24103
- {
24104
- label: BorderStyleTypes.DASH_DOT,
24105
- value: BorderStyleTypes.DASH_DOT
24106
- },
24107
- {
24108
- label: BorderStyleTypes.DASH_DOT_DOT,
24109
- value: BorderStyleTypes.DASH_DOT_DOT
24110
- },
24111
- {
24112
- label: BorderStyleTypes.MEDIUM,
24113
- value: BorderStyleTypes.MEDIUM
24114
- },
24115
- {
24116
- label: BorderStyleTypes.MEDIUM_DASHED,
24117
- value: BorderStyleTypes.MEDIUM_DASHED
24118
- },
24119
- {
24120
- label: BorderStyleTypes.MEDIUM_DASH_DOT,
24121
- value: BorderStyleTypes.MEDIUM_DASH_DOT
24122
- },
24123
- {
24124
- label: BorderStyleTypes.MEDIUM_DASH_DOT_DOT,
24125
- value: BorderStyleTypes.MEDIUM_DASH_DOT_DOT
24126
- },
24127
- {
24128
- label: BorderStyleTypes.THICK,
24129
- value: BorderStyleTypes.THICK
24130
- },
24131
- {
24132
- label: BorderStyleTypes.DOUBLE,
24133
- value: BorderStyleTypes.DOUBLE
24134
- }
24135
- ];
24136
24984
  function getBorderColor(borderData) {
24137
24985
  if (!borderData) return;
24138
24986
  for (const key in borderData) {
@@ -24153,7 +25001,9 @@ function BorderPanel(props) {
24153
25001
  var _value$color;
24154
25002
  const iconManager = useDependency(IconManager);
24155
25003
  const borderStyleManagerService = useDependency(BorderStyleManagerService);
24156
- const { isAllValuesSame, value: currentValue } = useDependency(SheetsSelectionsService).getCellStylesProperty("bd");
25004
+ const selectionManagerService = useDependency(SheetsSelectionsService);
25005
+ const { direction } = useContext(ConfigContext);
25006
+ const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("bd");
24157
25007
  const color = isAllValuesSame ? getBorderColor(currentValue) : void 0;
24158
25008
  const type = isAllValuesSame ? getBorderStyle(currentValue) : void 0;
24159
25009
  const { onChange, value } = props;
@@ -24168,6 +25018,7 @@ function BorderPanel(props) {
24168
25018
  return Icon && /* @__PURE__ */ jsx(Icon, { className: "univer-fill-primary-600" });
24169
25019
  }
24170
25020
  return /* @__PURE__ */ jsxs("section", {
25021
+ dir: direction,
24171
25022
  className: "univer-box-border univer-grid univer-gap-2 univer-p-1.5",
24172
25023
  children: [
24173
25024
  /* @__PURE__ */ jsx("div", {
@@ -26043,7 +26894,7 @@ let ComponentsController = class ComponentsController extends Disposable {
26043
26894
  DeleteRowDoubleIcon,
26044
26895
  DownBorderDoubleIcon,
26045
26896
  DownloadImageIcon,
26046
- EyeOutlineIcon,
26897
+ EyeIcon,
26047
26898
  FontColorDoubleIcon,
26048
26899
  FontSizeIncreaseIcon,
26049
26900
  FontSizeReduceIcon,
@@ -28615,7 +29466,7 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
28615
29466
  this.disposeWithMe(viewportMain.onScrollByBar$.subscribeEvent((param) => {
28616
29467
  var _this$_sheetSkeletonM4;
28617
29468
  const skeleton = (_this$_sheetSkeletonM4 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM4 === void 0 ? void 0 : _this$_sheetSkeletonM4.skeleton;
28618
- if (skeleton == null || param.isTrigger === false) return;
29469
+ if (skeleton == null || param.isTrigger === false || param.isBarDragging && !param.isBarDragEnd) return;
28619
29470
  const sheetObject = this._getSheetObject();
28620
29471
  if (skeleton == null || sheetObject == null) return;
28621
29472
  const { viewportScrollX = 0, viewportScrollY = 0 } = param;
@@ -29490,7 +30341,7 @@ function getListDropdownValue(value, multiple) {
29490
30341
  //#endregion
29491
30342
  //#region src/views/dropdown/ListDropDown.tsx
29492
30343
  function SelectList(props) {
29493
- const { value, onChange, multiple, options, title, onEdit, style, location, showEdit: showEditOnDropdown, showSearch: showSearchOnDropdown } = props;
30344
+ const { value, onChange, multiple, options, onEdit, style, location, showEdit: showEditOnDropdown, showSearch: showSearchOnDropdown } = props;
29494
30345
  const localeService = useDependency(LocaleService);
29495
30346
  const { row, col, unitId, subUnitId } = location;
29496
30347
  const searchRef = useRef(null);
@@ -29546,7 +30397,7 @@ function SelectList(props) {
29546
30397
  }),
29547
30398
  /* @__PURE__ */ jsx("div", {
29548
30399
  className: "univer-px-3.5 univer-py-1 univer-pt-2 univer-text-xs",
29549
- children: title
30400
+ children: localeService.t(multiple ? "sheets-ui.data-validation.listMultiple.dropdown" : "sheets-ui.data-validation.list.dropdown")
29550
30401
  }),
29551
30402
  /* @__PURE__ */ jsx("div", {
29552
30403
  className: clsx("univer-flex univer-max-h-52 univer-flex-col univer-gap-1 univer-overflow-y-auto univer-px-2 univer-py-1", scrollbarClassName),
@@ -29605,7 +30456,6 @@ function ListDropDown(props) {
29605
30456
  const { location, hideFn, onChange, onEdit, options, defaultValue, multiple, showSearch, showEdit } = extraProps;
29606
30457
  const { worksheet } = location;
29607
30458
  if (!worksheet) return null;
29608
- const localeService = useDependency(LocaleService);
29609
30459
  const [localValue, setLocalValue] = useState(defaultValue);
29610
30460
  const cellWidth = ((_anchorRect$right = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.right) !== null && _anchorRect$right !== void 0 ? _anchorRect$right : 0) - ((_anchorRect$left = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.left) !== null && _anchorRect$left !== void 0 ? _anchorRect$left : 0);
29611
30461
  return /* @__PURE__ */ jsx(SelectList, {
@@ -29613,7 +30463,6 @@ function ListDropDown(props) {
29613
30463
  minWidth: cellWidth,
29614
30464
  maxWidth: Math.max(cellWidth, 200)
29615
30465
  },
29616
- title: multiple ? localeService.t("sheets-ui.data-validation.listMultiple.dropdown") : localeService.t("sheets-ui.data-validation.list.dropdown"),
29617
30466
  value: getListDropdownValue(localValue, multiple),
29618
30467
  multiple,
29619
30468
  onChange: async (newValue) => {
@@ -29689,6 +30538,28 @@ SheetCellDropdownManagerService = __decorate([
29689
30538
 
29690
30539
  //#endregion
29691
30540
  //#region src/services/print-interceptor.service.ts
30541
+ /** Tracks asynchronous resources registered by all interceptors for one print page. */
30542
+ var SheetPrintingResourceCollector = class {
30543
+ constructor() {
30544
+ _defineProperty(this, "_pending", /* @__PURE__ */ new Set());
30545
+ }
30546
+ add(resource) {
30547
+ const tracked = Promise.resolve(resource).catch(() => void 0).finally(() => this._pending.delete(tracked));
30548
+ this._pending.add(tracked);
30549
+ }
30550
+ async wait(timeout = 1e4) {
30551
+ const deadline = Date.now() + timeout;
30552
+ while (this._pending.size > 0) {
30553
+ const remaining = deadline - Date.now();
30554
+ if (remaining <= 0) return;
30555
+ let timeoutId;
30556
+ await Promise.race([Promise.allSettled(Array.from(this._pending)), new Promise((resolve) => {
30557
+ timeoutId = setTimeout(resolve, remaining);
30558
+ })]);
30559
+ if (timeoutId !== void 0) clearTimeout(timeoutId);
30560
+ }
30561
+ }
30562
+ };
29692
30563
  const PRINTING_RANGE = createInterceptorKey("PRINTING_RANGE");
29693
30564
  const PRINTING_COMPONENT_COLLECT = createInterceptorKey("PRINTING_COMPONENT_COLLECT");
29694
30565
  const PRINTING_DOM_COLLECT = createInterceptorKey("PRINTING_DOM_COLLECT");
@@ -30495,7 +31366,12 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends Plugin
30495
31366
  }
30496
31367
  _initAutoFocus() {
30497
31368
  const univerInstanceService = this._univerInstanceService;
30498
- this.disposeWithMe(univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(filter$1((v) => !!v)).subscribe((workbook) => univerInstanceService.focusUnit(workbook.getUnitId())));
31369
+ this.disposeWithMe(univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(filter$1((v) => !!v)).subscribe((workbook) => {
31370
+ const unitId = workbook.getUnitId();
31371
+ const createOptions = univerInstanceService.getUnitCreateOptions(unitId);
31372
+ if ((createOptions === null || createOptions === void 0 ? void 0 : createOptions.makeCurrent) === false) return;
31373
+ univerInstanceService.focusUnit(unitId);
31374
+ }));
30499
31375
  }
30500
31376
  };
30501
31377
  _defineProperty(UniverSheetsMobileUIPlugin, "pluginName", "SHEET_UI_PLUGIN");
@@ -30510,15 +31386,20 @@ UniverSheetsMobileUIPlugin = __decorate([
30510
31386
  __decorateParam(4, IUniverInstanceService)
30511
31387
  ], UniverSheetsMobileUIPlugin);
30512
31388
 
31389
+ //#endregion
31390
+ //#region src/services/sheet-host-chrome-override.service.ts
31391
+ const ISheetHostChromeOverrideService = createIdentifier("sheet-ui.host-chrome-override.service");
31392
+
30513
31393
  //#endregion
30514
31394
  //#region src/controllers/render-controllers/contextmenu.render-controller.ts
30515
31395
  let SheetContextMenuRenderController = class SheetContextMenuRenderController extends Disposable {
30516
- constructor(_context, _contextMenuService, _selectionManagerService, _selectionRenderService) {
31396
+ constructor(_context, _contextMenuService, _selectionManagerService, _selectionRenderService, _injector) {
30517
31397
  super();
30518
31398
  this._context = _context;
30519
31399
  this._contextMenuService = _contextMenuService;
30520
31400
  this._selectionManagerService = _selectionManagerService;
30521
31401
  this._selectionRenderService = _selectionRenderService;
31402
+ this._injector = _injector;
30522
31403
  this._init();
30523
31404
  }
30524
31405
  _init() {
@@ -30541,6 +31422,7 @@ let SheetContextMenuRenderController = class SheetContextMenuRenderController ex
30541
31422
  }
30542
31423
  };
30543
31424
  const triggerMenu = (position) => {
31425
+ if (this._shouldSuppressHostContextMenu()) return;
30544
31426
  this._contextMenuService.triggerContextMenu(event, position);
30545
31427
  };
30546
31428
  if (!isPointerInRange()) triggerMenu(ContextMenuPosition.MAIN_AREA);
@@ -30552,20 +31434,37 @@ let SheetContextMenuRenderController = class SheetContextMenuRenderController ex
30552
31434
  this.disposeWithMe(spreadsheetSubscription);
30553
31435
  const spreadsheetColumnHeader = this._context.components.get("__SpreadsheetColumnHeader__");
30554
31436
  const rowHeaderSub = this._context.components.get("__SpreadsheetRowHeader__").onPointerDown$.subscribeEvent((event) => {
30555
- if (event.button === 2) this._contextMenuService.triggerContextMenu(event, ContextMenuPosition.ROW_HEADER);
31437
+ if (event.button === 2) {
31438
+ if (this._shouldSuppressHostContextMenu()) return;
31439
+ this._contextMenuService.triggerContextMenu(event, ContextMenuPosition.ROW_HEADER);
31440
+ }
30556
31441
  });
30557
31442
  this.disposeWithMe(rowHeaderSub);
30558
31443
  const colHeaderObserver = spreadsheetColumnHeader.onPointerDown$.subscribeEvent((event) => {
30559
- if (event.button === 2) this._contextMenuService.triggerContextMenu(event, ContextMenuPosition.COL_HEADER);
31444
+ if (event.button === 2) {
31445
+ if (this._shouldSuppressHostContextMenu()) return;
31446
+ this._contextMenuService.triggerContextMenu(event, ContextMenuPosition.COL_HEADER);
31447
+ }
30560
31448
  });
30561
31449
  this.disposeWithMe(colHeaderObserver);
30562
31450
  }
31451
+ _shouldSuppressHostContextMenu() {
31452
+ var _this$_getSheetHostCh, _this$_getSheetHostCh2;
31453
+ return shouldSuppressSheetContextMenuForEmbedOverride(this._context.unitId, (_this$_getSheetHostCh = this._getSheetHostChromeOverrideService()) === null || _this$_getSheetHostCh === void 0 || (_this$_getSheetHostCh2 = _this$_getSheetHostCh.getOverride) === null || _this$_getSheetHostCh2 === void 0 ? void 0 : _this$_getSheetHostCh2.call(_this$_getSheetHostCh));
31454
+ }
31455
+ _getSheetHostChromeOverrideService() {
31456
+ return this._injector.has(ISheetHostChromeOverrideService) ? this._injector.get(ISheetHostChromeOverrideService) : void 0;
31457
+ }
30563
31458
  };
30564
31459
  SheetContextMenuRenderController = __decorate([
30565
31460
  __decorateParam(1, IContextMenuService),
30566
31461
  __decorateParam(2, Inject(SheetsSelectionsService)),
30567
- __decorateParam(3, ISheetSelectionRenderService)
31462
+ __decorateParam(3, ISheetSelectionRenderService),
31463
+ __decorateParam(4, Inject(Injector))
30568
31464
  ], SheetContextMenuRenderController);
31465
+ function shouldSuppressSheetContextMenuForEmbedOverride(hostUnitId, override) {
31466
+ return override != null && override.hostUnitId === hostUnitId && override.entry === "sheets-sheet-tab";
31467
+ }
30569
31468
 
30570
31469
  //#endregion
30571
31470
  //#region src/controllers/repeat-last-action.controller.ts
@@ -31089,7 +31988,12 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends Plugin {
31089
31988
  }
31090
31989
  _initAutoFocus() {
31091
31990
  const univerInstanceService = this._univerInstanceService;
31092
- this.disposeWithMe(univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(filter$1((v) => !!v)).subscribe((workbook) => univerInstanceService.focusUnit(workbook.getUnitId())));
31991
+ this.disposeWithMe(univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(filter$1((v) => !!v)).subscribe((workbook) => {
31992
+ const unitId = workbook.getUnitId();
31993
+ const createOptions = univerInstanceService.getUnitCreateOptions(unitId);
31994
+ if ((createOptions === null || createOptions === void 0 ? void 0 : createOptions.makeCurrent) === false) return;
31995
+ univerInstanceService.focusUnit(unitId);
31996
+ }));
31093
31997
  }
31094
31998
  };
31095
31999
  _defineProperty(UniverSheetsUIPlugin, "pluginName", "SHEET_UI_PLUGIN");
@@ -31105,4 +32009,4 @@ UniverSheetsUIPlugin = __decorate([
31105
32009
  ], UniverSheetsUIPlugin);
31106
32010
 
31107
32011
  //#endregion
31108
- export { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, ApplyFormatPainterCommand, AutoFillUIController, AutoHeightController, AutoWidthController, BaseSelectionRenderService, COPY_SPECIAL_MENU_ID, COPY_TYPE, CellAlertManagerService, CellAlertType, CellCustomRenderController, CellEditorManagerService, CellPopupManagerService, ChangeSheetProtectionFromSheetBarCommand, ChangeZoomRatioCommand, DeleteRangeMoveLeftConfirmCommand, DeleteRangeMoveUpConfirmCommand, DeleteRangeProtectionFromContextMenuCommand, DeleteWorksheetProtectionFormSheetBarCommand, DragManagerService, DragRenderController, EMBEDDING_FORMULA_EDITOR, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, EditingRenderController, EditorBridgeService, ExpandSelectionCommand, FORMULA_CLIPBOARD_MIME_TYPE, FormatPainterStatus, FormulaEditorController, HEADER_UNHIDE_RANGE_VISIBLE_CHECK, HeaderFreezeRenderController, HeaderMoveRenderController, HeaderResizeRenderController, HeaderUnhideRangeAxis, HeaderUnhideRangeService, HeaderUnhideRenderController, HideColConfirmCommand, HideRowConfirmCommand, HoverManagerService, HoverRenderController, ICellEditorManagerService, IEditorBridgeService, IFormatPainterService, IFormulaEditorManagerService, IMarkSelectionService, IRepeatLastActionService, ISheetCellDropdownManagerService, ISheetClipboardService, ISheetSelectionRenderService, IStatusBarService, InsertRangeMoveDownConfirmCommand, InsertRangeMoveRightConfirmCommand, JumpOver, MarkSelectionService, MoveSelectionCommand, MoveSelectionEnterAndTabCommand, PASTE_SPECIAL_MENU_ID, PREDEFINED_HOOK_NAME, PREDEFINED_HOOK_NAME_COPY, PREDEFINED_HOOK_NAME_PASTE, RANGE_SELECTOR_COMPONENT_KEY, RANGE_SELECTOR_SYMBOLS, RemoveColConfirmCommand, RemoveRowConfirmCommand, RemoveSheetConfirmCommand, RenameSheetOperation, RepeatLastActionPermission, ResetRangeTextColorCommand, ResetScrollCommand, SELECTION_SHAPE_DEPTH, SHEET_UI_PLUGIN_NAME, SHEET_VIEW_KEY, ScrollCommand, ScrollToCellCommand, ScrollToRangeOperation, SelectAllCommand, SelectionControl, SelectionControl as SelectionShape, SelectionShapeExtension, SetActivateCellEditOperation, SetCellEditVisibleArrowOperation, SetCellEditVisibleOperation, SetCellEditVisibleWithF2Operation, SetColumnFrozenCommand, SetColumnHeaderHeightCommand, SetFirstColumnFrozenCommand, SetFirstRowFrozenCommand, SetFormatPainterOperation, SetInfiniteFormatPainterCommand, SetOnceFormatPainterCommand, SetRangeBoldCommand, SetRangeFontDecreaseCommand, SetRangeFontFamilyCommand, SetRangeFontIncreaseCommand, SetRangeFontSizeCommand, SetRangeItalicCommand, SetRangeProtectionFromContextMenuCommand, SetRangeStrickThroughCommand, SetRangeSubscriptCommand, SetRangeSuperscriptCommand, SetRangeTextColorCommand, SetRangeUnderlineCommand, SetRowFrozenCommand, SetRowHeaderWidthCommand, SetScrollOperation, SetScrollRelativeCommand, SetSelectionFrozenCommand, SetWorksheetColAutoWidthCommand, SetZoomRatioCommand, SetZoomRatioOperation, SheetCanvasPopManagerService, SheetCellDropdownManagerService, SheetCellEditorResizeService, SheetClipboardController, SheetClipboardService, SheetCopyCommand, SheetCutCommand, SheetMenuPosition, SheetPasteBesidesBorderCommand, SheetPasteColWidthCommand, SheetPasteCommand, SheetPasteFormatCommand, SheetPasteShortKeyCommand, SheetPasteValueCommand, SheetPermissionCheckUIController, SheetPermissionOpenDialogOperation, SheetPermissionOpenPanelOperation, SheetPermissionRenderManagerService, SheetPermissionUserManagerService, SheetPrintInterceptorService, SheetRenderController, SheetScrollManagerService, SheetSelectionRenderService, SheetSkeletonManagerService, SheetUIController, SheetsRenderService, SheetsScrollRenderController, menuSchema as SheetsUIMenuSchema, SheetsUIPart, ShowMenuListCommand, SidebarDefinedNameOperation, StatusBarController, StatusBarService, UNIVER_SHEET_PERMISSION_USER_PART, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, ViewSheetPermissionFromContextMenuCommand, ViewSheetPermissionFromSheetBarCommand, calculateDocSkeletonRects, matchedSelectionByRowColIndex as checkInHeaderRanges, deriveStateFromActiveSheet$, functionDisplayNames, genNormalSelectionStyle, genSelectionByRange, selectionDataForSelectAll as getAllSelection, getCellRealRange, getCoordByCell, getCoordByOffset, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$, getCustomRangePosition, getEditingCustomRangePosition, getEditorObject, getMatrixPlainText, getObservableWithExclusiveRange$, getRepeatRange, getSheetObject, getTopLeftSelectionOfCurrSheet, getTransformCoord, getViewportByCell, isEmbeddingFormulaEditor, isRangeSelector, menuClipboardDisabledObservable, mergeSetRangeValues, useActiveWorkbook, useActiveWorksheet, useHighlightRange, useKeyEventConfig, useWorkbooks, virtualizeDiscreteRanges, whenFormulaEditorActivated, whenSheetEditorActivated, whenSheetEditorFocused };
32012
+ export { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, ApplyFormatPainterCommand, AutoFillPopupMenu, AutoFillUIController, AutoHeightController, AutoWidthController, BORDER_LINE_CHILDREN, BORDER_SIZE_CHILDREN, BaseSelectionRenderService, BorderLine, COPY_SPECIAL_MENU_ID, COPY_TYPE, CellAlertManagerService, CellAlertType, CellCustomRenderController, CellEditorManagerService, CellPopupManagerService, ChangeSheetProtectionFromSheetBarCommand, ChangeZoomRatioCommand, DeleteRangeMoveLeftConfirmCommand, DeleteRangeMoveUpConfirmCommand, DeleteRangeProtectionFromContextMenuCommand, DeleteWorksheetProtectionFormSheetBarCommand, DragManagerService, DragRenderController, EMBEDDING_FORMULA_EDITOR, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, EditingRenderController, EditorBridgeService, EditorContainer, ExpandSelectionCommand, FORMULA_CLIPBOARD_MIME_TYPE, FormatPainterStatus, FormulaBar, FormulaEditorController, HEADER_UNHIDE_RANGE_VISIBLE_CHECK, HeaderFreezeRenderController, HeaderMoveRenderController, HeaderResizeRenderController, HeaderUnhideRangeAxis, HeaderUnhideRangeService, HeaderUnhideRenderController, HideColConfirmCommand, HideRowConfirmCommand, HoverManagerService, HoverRenderController, ICellEditorManagerService, IEditorBridgeService, IFormatPainterService, IFormulaEditorManagerService, IMarkSelectionService, IRepeatLastActionService, ISheetCellDropdownManagerService, ISheetClipboardService, ISheetEmbedFloatingGeometryService, ISheetEmbedInteractionBoundaryService, ISheetEmbedRuntimeFocusCoordinator, ISheetEmbedRuntimeService, ISheetHostChromeOverrideService, ISheetSelectionRenderService, IStatusBarService, InsertRangeMoveDownConfirmCommand, InsertRangeMoveRightConfirmCommand, JumpOver, MarkSelectionService, MoveSelectionCommand, MoveSelectionEnterAndTabCommand, PASTE_SPECIAL_MENU_ID, PREDEFINED_HOOK_NAME, PREDEFINED_HOOK_NAME_COPY, PREDEFINED_HOOK_NAME_PASTE, RANGE_SELECTOR_COMPONENT_KEY, RANGE_SELECTOR_SYMBOLS, RemoveColConfirmCommand, RemoveRowConfirmCommand, RemoveSheetConfirmCommand, RenameSheetOperation, RepeatLastActionPermission, ResetRangeTextColorCommand, ResetScrollCommand, SELECTION_SHAPE_DEPTH, SHEETS_UI_PLUGIN_CONFIG_KEY, SHEET_EMBED_CHILD_TYPE_ATTRIBUTE, SHEET_EMBED_CHILD_UNIT_ID_ATTRIBUTE, SHEET_EMBED_FLOAT_DOM_ATTRIBUTE, SHEET_EMBED_HOST_UNIT_ID_ATTRIBUTE, SHEET_EMBED_ID_ATTRIBUTE, SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE, SHEET_FOOTER_BAR_HEIGHT, SHEET_UI_PLUGIN_NAME, SHEET_VIEW_KEY, ScrollCommand, ScrollToCellCommand, ScrollToRangeOperation, SelectAllCommand, SelectionControl, SelectionControl as SelectionShape, SelectionShapeExtension, SetActivateCellEditOperation, SetCellEditVisibleArrowOperation, SetCellEditVisibleOperation, SetCellEditVisibleWithF2Operation, SetColumnFrozenCommand, SetColumnHeaderHeightCommand, SetFirstColumnFrozenCommand, SetFirstRowFrozenCommand, SetFormatPainterOperation, SetInfiniteFormatPainterCommand, SetOnceFormatPainterCommand, SetRangeBoldCommand, SetRangeFontDecreaseCommand, SetRangeFontFamilyCommand, SetRangeFontIncreaseCommand, SetRangeFontSizeCommand, SetRangeItalicCommand, SetRangeProtectionFromContextMenuCommand, SetRangeStrickThroughCommand, SetRangeSubscriptCommand, SetRangeSuperscriptCommand, SetRangeTextColorCommand, SetRangeUnderlineCommand, SetRowFrozenCommand, SetRowHeaderWidthCommand, SetScrollOperation, SetScrollRelativeCommand, SetSelectionFrozenCommand, SetWorksheetColAutoWidthCommand, SetZoomRatioCommand, SetZoomRatioOperation, SheetBar, SheetCanvasPopManagerService, SheetCellDropdownManagerService, SheetCellEditorResizeService, SheetClipboardController, SheetClipboardService, SheetCopyCommand, SheetCutCommand, SheetMenuPosition, SheetPasteBesidesBorderCommand, SheetPasteColWidthCommand, SheetPasteCommand, SheetPasteFormatCommand, SheetPasteShortKeyCommand, SheetPasteValueCommand, SheetPermissionCheckUIController, SheetPermissionOpenDialogOperation, SheetPermissionOpenPanelOperation, SheetPermissionRenderManagerService, SheetPermissionUserManagerService, SheetPrintInterceptorService, SheetPrintingResourceCollector, SheetRenderController, SheetScrollManagerService, SheetSelectionRenderService, SheetSkeletonManagerService, SheetUIController, SheetsRenderService, SheetsScrollRenderController, menuSchema as SheetsUIMenuSchema, SheetsUIPart, ShowMenuListCommand, SidebarDefinedNameOperation, StatusBarController, StatusBarService, UNIVER_SHEET_PERMISSION_USER_PART, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, ViewSheetPermissionFromContextMenuCommand, ViewSheetPermissionFromSheetBarCommand, calculateDocSkeletonRects, matchedSelectionByRowColIndex as checkInHeaderRanges, deriveStateFromActiveSheet$, functionDisplayNames, genNormalSelectionStyle, genSelectionByRange, selectionDataForSelectAll as getAllSelection, getCellRealRange, getCoordByCell, getCoordByOffset, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$, getCustomRangePosition, getEditingCustomRangePosition, getEditorObject, getMatrixPlainText, getObservableWithExclusiveRange$, getRepeatRange, getSheetObject, getTopLeftSelectionOfCurrSheet, getTransformCoord, getViewportByCell, isEmbeddingFormulaEditor, isRangeSelector, menuClipboardDisabledObservable, mergeSetRangeValues, resolveActiveSheetEmbedRuntimeDomScope, resolveSheetEmbedRuntimeDomScope, useActiveWorkbook, useActiveWorksheet, useHighlightRange, useKeyEventConfig, useWorkbooks, virtualizeDiscreteRanges, whenFormulaEditorActivated, whenSheetEditorActivated, whenSheetEditorFocused };