@univerjs/sheets-ui 1.0.3 → 1.1.0

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 (104) hide show
  1. package/lib/cjs/index.js +775 -483
  2. package/lib/cjs/locale/ar-SA.js +15 -0
  3. package/lib/cjs/locale/ca-ES.js +15 -0
  4. package/lib/cjs/locale/de-DE.js +15 -0
  5. package/lib/cjs/locale/en-US.js +15 -0
  6. package/lib/cjs/locale/es-ES.js +15 -0
  7. package/lib/cjs/locale/fa-IR.js +15 -0
  8. package/lib/cjs/locale/fr-FR.js +15 -0
  9. package/lib/cjs/locale/id-ID.js +15 -0
  10. package/lib/cjs/locale/it-IT.js +15 -0
  11. package/lib/cjs/locale/ja-JP.js +15 -0
  12. package/lib/cjs/locale/ko-KR.js +15 -0
  13. package/lib/cjs/locale/pl-PL.js +15 -0
  14. package/lib/cjs/locale/pt-BR.js +15 -0
  15. package/lib/cjs/locale/ru-RU.js +15 -0
  16. package/lib/cjs/locale/sk-SK.js +15 -0
  17. package/lib/cjs/locale/vi-VN.js +15 -0
  18. package/lib/cjs/locale/zh-CN.js +15 -0
  19. package/lib/cjs/locale/zh-HK.js +15 -0
  20. package/lib/cjs/locale/zh-TW.js +15 -0
  21. package/lib/es/index.js +742 -451
  22. package/lib/es/locale/ar-SA.js +15 -0
  23. package/lib/es/locale/ca-ES.js +15 -0
  24. package/lib/es/locale/de-DE.js +15 -0
  25. package/lib/es/locale/en-US.js +15 -0
  26. package/lib/es/locale/es-ES.js +15 -0
  27. package/lib/es/locale/fa-IR.js +15 -0
  28. package/lib/es/locale/fr-FR.js +15 -0
  29. package/lib/es/locale/id-ID.js +15 -0
  30. package/lib/es/locale/it-IT.js +15 -0
  31. package/lib/es/locale/ja-JP.js +15 -0
  32. package/lib/es/locale/ko-KR.js +15 -0
  33. package/lib/es/locale/pl-PL.js +15 -0
  34. package/lib/es/locale/pt-BR.js +15 -0
  35. package/lib/es/locale/ru-RU.js +15 -0
  36. package/lib/es/locale/sk-SK.js +15 -0
  37. package/lib/es/locale/vi-VN.js +15 -0
  38. package/lib/es/locale/zh-CN.js +15 -0
  39. package/lib/es/locale/zh-HK.js +15 -0
  40. package/lib/es/locale/zh-TW.js +15 -0
  41. package/lib/index.css +0 -28
  42. package/lib/index.js +742 -451
  43. package/lib/locale/ar-SA.js +15 -0
  44. package/lib/locale/ca-ES.js +15 -0
  45. package/lib/locale/de-DE.js +15 -0
  46. package/lib/locale/en-US.js +15 -0
  47. package/lib/locale/es-ES.js +15 -0
  48. package/lib/locale/fa-IR.js +15 -0
  49. package/lib/locale/fr-FR.js +15 -0
  50. package/lib/locale/id-ID.js +15 -0
  51. package/lib/locale/it-IT.js +15 -0
  52. package/lib/locale/ja-JP.js +15 -0
  53. package/lib/locale/ko-KR.js +15 -0
  54. package/lib/locale/pl-PL.js +15 -0
  55. package/lib/locale/pt-BR.js +15 -0
  56. package/lib/locale/ru-RU.js +15 -0
  57. package/lib/locale/sk-SK.js +15 -0
  58. package/lib/locale/vi-VN.js +15 -0
  59. package/lib/locale/zh-CN.js +15 -0
  60. package/lib/locale/zh-HK.js +15 -0
  61. package/lib/locale/zh-TW.js +15 -0
  62. package/lib/types/commands/commands/set-selection.command.d.ts +2 -0
  63. package/lib/types/{views/editor-container/index.d.ts → common/selection-input.d.ts} +3 -2
  64. package/lib/types/config/config.d.ts +6 -0
  65. package/lib/types/controllers/editor/data-sync.controller.d.ts +1 -0
  66. package/lib/types/controllers/editor/editing.render-controller.d.ts +1 -0
  67. package/lib/types/controllers/render-controllers/contextmenu.render-controller.d.ts +6 -3
  68. package/lib/types/controllers/render-controllers/desktop-cell-edit.render-controller.d.ts +3 -1
  69. package/lib/types/index.d.ts +6 -4
  70. package/lib/types/locale/en-US.d.ts +15 -0
  71. package/lib/types/menu/zoom.menu.d.ts +2 -2
  72. package/lib/types/services/cell-alert-manager.service.d.ts +1 -0
  73. package/lib/types/services/editor/cell-editor-resize.service.d.ts +6 -0
  74. package/lib/types/services/editor-bridge.service.d.ts +4 -0
  75. package/lib/types/services/hover-manager.service.d.ts +2 -2
  76. package/lib/types/services/selection/base-selection-render.service.d.ts +2 -0
  77. package/lib/types/services/selection/selection-control.d.ts +6 -1
  78. package/lib/types/services/selection/selection-render.service.d.ts +1 -0
  79. package/lib/types/views/border-panel/interface.d.ts +37 -4
  80. package/lib/types/views/defined-name/DefinedNameOverlay.d.ts +5 -2
  81. package/lib/types/views/editor-container/focus-editor.d.ts +3 -2
  82. package/lib/umd/facade.js +3 -1
  83. package/lib/umd/index.js +12 -12
  84. package/lib/umd/locale/ar-SA.js +1 -1
  85. package/lib/umd/locale/ca-ES.js +1 -1
  86. package/lib/umd/locale/de-DE.js +1 -1
  87. package/lib/umd/locale/en-US.js +1 -1
  88. package/lib/umd/locale/es-ES.js +1 -1
  89. package/lib/umd/locale/fa-IR.js +1 -1
  90. package/lib/umd/locale/fr-FR.js +1 -1
  91. package/lib/umd/locale/id-ID.js +1 -1
  92. package/lib/umd/locale/it-IT.js +1 -1
  93. package/lib/umd/locale/ja-JP.js +1 -1
  94. package/lib/umd/locale/ko-KR.js +1 -1
  95. package/lib/umd/locale/pl-PL.js +1 -1
  96. package/lib/umd/locale/pt-BR.js +1 -1
  97. package/lib/umd/locale/ru-RU.js +1 -1
  98. package/lib/umd/locale/sk-SK.js +1 -1
  99. package/lib/umd/locale/vi-VN.js +1 -1
  100. package/lib/umd/locale/zh-CN.js +1 -1
  101. package/lib/umd/locale/zh-HK.js +1 -1
  102. package/lib/umd/locale/zh-TW.js +1 -1
  103. package/package.json +16 -16
  104. package/lib/types/views/sheet-slider/SheetZoomInput.d.ts +0 -18
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BreakLineCommand, CoverContentCommand, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, DOC_VERTICAL_PADDING, DeleteLeftCommand, DeleteRightCommand, DocSelectionRenderService, EnterCommand, IEditorService, IMEInputCommand, InnerPasteCommand, MobileRichTextToolbar, MoveCursorOperation, MoveSelectionOperation, NodePositionConvertToCursor, ReplaceSnapshotCommand, SetDocInputStyleCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand, UniverDocsUIPlugin, VIEWPORT_KEY, convertBodyToHtml, getCanvasOffsetByEngine, getLineBounding } from "@univerjs/docs-ui";
2
2
  import { AbsoluteRefType, BaselineOffset, BooleanNumber, BorderStyleTypes, BorderType, 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_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, SHEET_EDITOR_UNITS, ThemeService, Tools, UndoCommandId, UniverInstanceType, UserManagerService, VerticalAlign, Workbook, WorksheetHiddenState, WrapStrategy, cloneCellData, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, composeStyles, convertCellToRange, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, dateKit, debounce, extractPureTextFromCell, fromEventSubject, generateRandomId, get, getEmptyCell, getIntersectRange, getNumfmtLocaleTag, getNumfmtParseValueFilter, getReverseDirection, handleStyleToString, isDefaultFormat, isFormulaString, isNotNullOrUndefined, isRealNum, isSafeUrl, isTextFormat, isValidRange, merge, mergeOverrideWithDependencies, nameCharacterCheck, numberToABC, numfmt, registerDependencies, sequenceExecute, set, skipParseTagNames, sortRules, splitIntoGrid, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
3
3
  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, SetShrinkToFitCommand, 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, findFirstNonEmptyCell, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getCellAtRowCol, getCellType, getCellValue, getClearContentMutationParamsForRanges, getMoveRangeCommandMutations, getPrimaryForRange, getSelectionsService, getSheetCommandTarget, isCellImage, rangeToDiscreteRange, serializeListOptions, setEndForRange, validateDefinedName } from "@univerjs/sheets";
4
- 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, FormatPainterSessionService, HTML_CLIPBOARD_MIME_TYPE, ICanvasPopupService, IClipboardInterfaceService, IContextMenuService, IDialogService, IFontService, ILayoutService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonService, IShortcutService, ISidebarService, IUIPartsService, IUIRuntimeScopeService, IWorkbenchService, IconManager, KeyCode, MenuItemType, MetaKeys, MobileDrawer, MobileMenu, MobileZoomIndicator, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SheetPasteShortKeyCommandName, Slider, ToggleFullscreenOperation, ToolbarItem, UI_PLUGIN_CONFIG_KEY, UniverMobileUIPlugin, ZoomInput, bindFormatPainterCanvas, connectInjector, getEmbedBoundaryOwner, getEmbedChildUnitId, getMenuHiddenObservable, handleStringToStyle, imageMimeTypeSet, sanitizeParsedHtml, textTrim, useComponentsOfPart, useConfigValue, useDependency, useEvent, useObservable, useSidebarClick, useToolbarItemStatus, useVirtualList } from "@univerjs/ui";
5
- import { CURSOR_TYPE, DashedRect, DeviceInputEventType, DeviceType, 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, UniverRenderEnginePlugin, Vector2, Viewport, calculateCellImageRect, cancelRequestFrame, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, fixLineWidthByScale, getCurrentTypeOfRenderer, getNextWheelZoomRatio, ptToPixel, requestNewFrame, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
4
+ 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, FormatPainterSessionService, HTML_CLIPBOARD_MIME_TYPE, ICanvasPopupService, IClipboardInterfaceService, IContextMenuService, IDialogService, IFontService, ILayoutService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonService, IShortcutService, ISidebarService, IUIPartsService, IUIRuntimeScopeService, IWorkbenchService, IconManager, KeyCode, MenuItemType, MetaKeys, MobileDrawer, MobileMenu, MobileZoomIndicator, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SheetPasteShortKeyCommandName, Slider, ToggleFullscreenOperation, ToolbarItem, UI_PLUGIN_CONFIG_KEY, UniverMobileUIPlugin, bindFormatPainterCanvas, connectInjector, getEmbedBoundaryOwner, getEmbedChildUnitId, getMenuHiddenObservable, handleStringToStyle, imageMimeTypeSet, sanitizeParsedHtml, textTrim, useComponentsOfPart, useConfigValue, useDependency, useEvent, useObservable, useSidebarClick, useToolbarItemStatus, useVirtualList } from "@univerjs/ui";
5
+ import { CURSOR_TYPE, DashedRect, DeviceInputEventType, DeviceType, FIX_ONE_PIXEL_BLUR_OFFSET, Group, IRenderManagerService, Layer, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, 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, UniverRenderEnginePlugin, Vector2, Viewport, calculateCellImageRect, cancelRequestFrame, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, fixLineWidthByScale, getCurrentTypeOfRenderer, getNextWheelZoomRatio, ptToPixel, requestNewFrame, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
6
6
  import { BehaviorSubject, EMPTY, Observable, Subject, Subscription, combineLatest, combineLatestWith, distinctUntilChanged, filter, from, fromEvent, isObservable, map, merge as merge$1, of, shareReplay, skip, startWith, switchMap, takeUntil, tap, throttleTime, withLatestFrom } from "rxjs";
7
7
  import { DocSelectionManagerService, DocSkeletonManagerService, DocStateChangeManagerService, InsertTextCommand, RichTextEditingMutation, SetTextSelectionsOperation, UniverDocsPlugin } from "@univerjs/docs";
8
8
  import { ObjectScope, UnitAction, UnitObject, UnitRole } from "@univerjs/protocol";
@@ -12,7 +12,7 @@ import { ITelemetryService } from "@univerjs/telemetry";
12
12
  import { debounceTime, filter as filter$1, map as map$1, shareReplay as shareReplay$1, startWith as startWith$1, switchMap as switchMap$1 } from "rxjs/operators";
13
13
  import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
14
14
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
- import { AddImageIcon, AdjustHeightDoubleIcon, AdjustWidthDoubleIcon, AlignBottomIcon, AlignTopIcon, AllBorderIcon, AutoHeightDoubleIcon, AutoWidthDoubleIcon, AutofillDoubleIcon, AutowrapIcon, BackSlashDoubleIcon, BasesMultiIcon, BoardsMultiIcon, BoldIcon, BrushIcon, CancelFreezeIcon, CancelMergeIcon, CheckMarkIcon, ClearFormatDoubleIcon, CloseIcon, CodeIcon, ConvertIcon, ConvertToNumberIcon, CopyDoubleIcon, CutIcon, DeleteCellShiftLeftDoubleIcon, DeleteCellShiftUpDoubleIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DocsMultiIcon, DownBorderDoubleIcon, DownIcon, DownloadImageIcon, ErrorIcon, EyeIcon, EyelashIcon, FontColorDoubleIcon, FontSizeIncreaseIcon, FontSizeReduceIcon, FreezeColumnIcon, FreezeRowIcon, FreezeToSelectedIcon, FxIcon, HideDoubleIcon, HideGridlinesIcon, HorizontalBorderDoubleIcon, HorizontalMergeIcon, HorizontallyIcon, IncreaseIcon, InfoIcon, InnerBorderDoubleIcon, InsertCellDownDoubleIcon, InsertCellShiftRightDoubleIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, KeyboardIcon, LeftBorderDoubleIcon, LeftDoubleDiagonalDoubleIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LeftRotationFortyFiveDegreesIcon, LeftRotationNinetyDegreesIcon, LeftTridiagonalDoubleIcon, LockIcon, MenuIcon, MergeAllIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, NoBorderIcon, NoColorDoubleIcon, NoRotationIcon, OuterBorderDoubleIcon, OverflowIcon, PaintBucketDoubleIcon, PasteSpecialDoubleIcon, PenIcon, ProtectIcon, ReduceDoubleIcon, RightBorderDoubleIcon, RightDoubleDiagonalDoubleIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, RightRotationFortyFiveDegreesIcon, RightRotationNinetyDegreesIcon, SheetsMultiIcon, ShrinkToFitIcon, SlashDoubleIcon, SlidesMultiIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, TruncationIcon, UnderlineIcon, UpBorderDoubleIcon, VerticalBorderDoubleIcon, VerticalCenterIcon, VerticalIntegrationIcon, VerticalTextIcon, WarningIcon, WriteIcon } from "@univerjs/icons";
15
+ import { AddImageIcon, AdjustHeightDoubleIcon, AdjustWidthDoubleIcon, AlignBottomIcon, AlignTopIcon, AllBorderIcon, AutoHeightDoubleIcon, AutoWidthDoubleIcon, AutofillDoubleIcon, AutowrapIcon, BackSlashDoubleIcon, BasesMultiIcon, BoardsMultiIcon, BoldIcon, BrushIcon, CancelFreezeIcon, CancelMergeIcon, CheckMarkIcon, ClearFormatDoubleIcon, CloseIcon, CodeIcon, ConvertIcon, ConvertToNumberIcon, CopyDoubleIcon, CutIcon, DeleteCellShiftLeftDoubleIcon, DeleteCellShiftUpDoubleIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DocPasteOptionsIcon, DocsMultiIcon, DownBorderDoubleIcon, DownIcon, DownloadImageIcon, ErrorIcon, EyeIcon, EyelashIcon, FontColorDoubleIcon, FontSizeIncreaseIcon, FontSizeReduceIcon, FreezeColumnIcon, FreezeRowIcon, FreezeToSelectedIcon, FxIcon, HideDoubleIcon, HideGridlinesIcon, HorizontalBorderDoubleIcon, HorizontalMergeIcon, HorizontallyIcon, IncreaseIcon, InfoIcon, InnerBorderDoubleIcon, InsertCellDownDoubleIcon, InsertCellShiftRightDoubleIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, KeyboardIcon, LeftBorderDoubleIcon, LeftDoubleDiagonalDoubleIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LeftRotationFortyFiveDegreesIcon, LeftRotationNinetyDegreesIcon, LeftTridiagonalDoubleIcon, LockIcon, MenuIcon, MergeAllIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, NoBorderIcon, NoColorDoubleIcon, NoRotationIcon, OuterBorderDoubleIcon, OverflowIcon, PaintBucketDoubleIcon, PasteSpecialDoubleIcon, PenIcon, ProtectIcon, ReduceDoubleIcon, RightBorderDoubleIcon, RightDoubleDiagonalDoubleIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, RightRotationFortyFiveDegreesIcon, RightRotationNinetyDegreesIcon, SheetsMultiIcon, ShrinkToFitIcon, SlashDoubleIcon, SlidesMultiIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, TruncationIcon, UnderlineIcon, UpBorderDoubleIcon, VerticalBorderDoubleIcon, VerticalCenterIcon, VerticalIntegrationIcon, VerticalTextIcon, WarningIcon, WriteIcon, ZoomInIcon } from "@univerjs/icons";
16
16
 
17
17
  //#region src/basics/editor/get-editor-object.ts
18
18
  function getEditorObject(unitId, renderManagerService) {
@@ -240,7 +240,7 @@ let SHEET_VIEW_KEY = /* @__PURE__ */ function(SHEET_VIEW_KEY) {
240
240
  }({});
241
241
 
242
242
  //#endregion
243
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
243
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
244
244
  function _typeof(o) {
245
245
  "@babel/helpers - typeof";
246
246
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -251,7 +251,7 @@ function _typeof(o) {
251
251
  }
252
252
 
253
253
  //#endregion
254
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
254
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
255
255
  function toPrimitive(t, r) {
256
256
  if ("object" != _typeof(t) || !t) return t;
257
257
  var e = t[Symbol.toPrimitive];
@@ -264,14 +264,14 @@ function toPrimitive(t, r) {
264
264
  }
265
265
 
266
266
  //#endregion
267
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
267
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
268
268
  function toPropertyKey(t) {
269
269
  var i = toPrimitive(t, "string");
270
270
  return "symbol" == _typeof(i) ? i : i + "";
271
271
  }
272
272
 
273
273
  //#endregion
274
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
274
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
275
275
  function _defineProperty(e, r, t) {
276
276
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
277
277
  value: t,
@@ -437,6 +437,15 @@ const SetColumnHeaderHeightCommand = {
437
437
  }
438
438
  };
439
439
 
440
+ //#endregion
441
+ //#region src/common/selection-input.ts
442
+ function isSheetContextMenuGesture(event, isMac, refSelectionsEnabled) {
443
+ return event.button === 2 || isMac && !refSelectionsEnabled && event.button === 0 && event.ctrlKey;
444
+ }
445
+ function isSheetMultiSelectModifier(event, isMac) {
446
+ return isMac ? event.metaKey : event.ctrlKey;
447
+ }
448
+
440
449
  //#endregion
441
450
  //#region src/services/selection/selection-layer.ts
442
451
  var SelectionLayer = class extends Layer {
@@ -941,9 +950,15 @@ var BaseSelectionRenderService = class extends Disposable {
941
950
  rangeWithCoord
942
951
  };
943
952
  }
953
+ _isContextMenuGesture(evt) {
954
+ return isSheetContextMenuGesture(evt, this._injector.get(IPlatformService).isMac, this.inRefSelectionMode());
955
+ }
956
+ _isMultiSelectModifier(evt) {
957
+ return isSheetMultiSelectModifier(evt, this._injector.get(IPlatformService).isMac);
958
+ }
944
959
  _checkClearPreviousControls(evt) {
945
960
  if (this.getSelectionControls().length === 0) return;
946
- if (!evt.ctrlKey && !evt.metaKey && !evt.shiftKey && !this._remainLastEnabled || this._singleSelectionEnabled && !evt.shiftKey) this._clearAllSelectionControls();
961
+ if (this._isContextMenuGesture(evt) && !this.inRefSelectionMode() || !this._isMultiSelectModifier(evt) && !evt.shiftKey && !this._remainLastEnabled || this._singleSelectionEnabled && !evt.shiftKey) this._clearAllSelectionControls();
947
962
  }
948
963
  _makeSelectionByTwoCells(currentCell, startSelectionRange, skeleton, rangeType, activeControl) {
949
964
  const { actualRow, actualColumn, mergeInfo: actualMergeInfo } = currentCell;
@@ -1029,7 +1044,7 @@ function genSelectionByRange(skeleton, range) {
1029
1044
  }
1030
1045
 
1031
1046
  //#endregion
1032
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
1047
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
1033
1048
  function __decorateParam(paramIndex, decorator) {
1034
1049
  return function(target, key) {
1035
1050
  decorator(target, key, paramIndex);
@@ -1037,7 +1052,7 @@ function __decorateParam(paramIndex, decorator) {
1037
1052
  }
1038
1053
 
1039
1054
  //#endregion
1040
- //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
1055
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
1041
1056
  function __decorate(decorators, target, key, desc) {
1042
1057
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1043
1058
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1849,6 +1864,7 @@ var SelectionShapeExtension = class {
1849
1864
  //#endregion
1850
1865
  //#region src/services/selection/selection-control.ts
1851
1866
  const SELECTION_TITLE_HIGHLIGHT_ALPHA = .3;
1867
+ const SELECTION_MOVE_DURATION = 120;
1852
1868
  /**
1853
1869
  * The main selection canvas component, includes leftControl,rightControl,topControl,bottomControl,backgroundControlTop,backgroundControlMiddleLeft,backgroundControlMiddleRight,backgroundControlBottom,fillControl
1854
1870
  */
@@ -1858,6 +1874,9 @@ var SelectionControl = class extends Disposable {
1858
1874
  this._scene = _scene;
1859
1875
  this._zIndex = _zIndex;
1860
1876
  this._themeService = _themeService;
1877
+ _defineProperty(this, "_moveAnimationFrame", -1);
1878
+ _defineProperty(this, "_animatedRange", null);
1879
+ _defineProperty(this, "_restoreMoveEvents", null);
1861
1880
  _defineProperty(this, "_isHelperSelection", true);
1862
1881
  _defineProperty(this, "_enableAutoFill", true);
1863
1882
  _defineProperty(this, "_showAutoFill", false);
@@ -1969,6 +1988,7 @@ var SelectionControl = class extends Disposable {
1969
1988
  scene.addObject(this._selectionShapeGroup, 1);
1970
1989
  this.disposeWithMe(toDisposable(scene.onTransformChange$.subscribeEvent((state) => {
1971
1990
  if (state.type !== TRANSFORM_CHANGE_OBSERVABLE_TYPE.scale) return;
1991
+ this._stopMoveAnimation();
1972
1992
  this._updateLayoutOfSelectionControl(this._currentStyle);
1973
1993
  this._updateControlCoord();
1974
1994
  })));
@@ -2131,6 +2151,11 @@ var SelectionControl = class extends Disposable {
2131
2151
  if (this._controlExtension) this._controlExtension.setDisabled(disable);
2132
2152
  }
2133
2153
  setEvent(state) {
2154
+ if (this._animatedRange) {
2155
+ this._stopMoveAnimation();
2156
+ this._updateLayoutOfSelectionControl();
2157
+ this._updateControlCoord();
2158
+ }
2134
2159
  this.leftControl.evented = state;
2135
2160
  this.rightControl.evented = state;
2136
2161
  this.topControl.evented = state;
@@ -2157,7 +2182,7 @@ var SelectionControl = class extends Disposable {
2157
2182
  autofillStrokeWidth /= scale < 1 ? 1 : scale;
2158
2183
  const borderBuffer = SELECTION_CONTROL_BORDER_BUFFER_WIDTH / scale;
2159
2184
  const fixOnePixelBlurOffset = FIX_ONE_PIXEL_BLUR_OFFSET / scale;
2160
- const { startX, startY, endX, endY } = this._selectionRenderModel;
2185
+ const { startX, startY, endX, endY } = this._animatedRange ?? this._selectionRenderModel;
2161
2186
  this.leftControl.transformByState({
2162
2187
  height: endY - startY,
2163
2188
  left: -leftAdjustWidth + fixOnePixelBlurOffset,
@@ -2238,19 +2263,20 @@ var SelectionControl = class extends Disposable {
2238
2263
  this._autoFillControl.show();
2239
2264
  } else this._autoFillControl.hide();
2240
2265
  this._updateBackgroundControl(currentStyle);
2241
- this._updateHeaderBackground(currentStyle);
2266
+ if (!this._animatedRange) this._updateHeaderBackground(currentStyle);
2242
2267
  this._updateWidgets(currentStyle);
2243
2268
  }
2244
2269
  /**
2245
2270
  * update selection control coordination by curr selection model
2246
2271
  */
2247
2272
  _updateControlCoord() {
2248
- const { startX, startY } = this._selectionRenderModel;
2273
+ const { startX, startY } = this._animatedRange ?? this._selectionRenderModel;
2249
2274
  this.selectionShapeGroup.show();
2250
2275
  this.selectionShapeGroup.translate(startX, startY);
2251
2276
  this.selectionShapeGroup.makeDirtyNoDebounce(true);
2252
2277
  }
2253
2278
  updateStyle(style) {
2279
+ this._stopMoveAnimation();
2254
2280
  this._updateLayoutOfSelectionControl(style);
2255
2281
  this._updateControlCoord();
2256
2282
  }
@@ -2264,6 +2290,7 @@ var SelectionControl = class extends Disposable {
2264
2290
  * @param primaryWithCoord
2265
2291
  */
2266
2292
  updateRange(rangeWithCoord, primaryWithCoord) {
2293
+ this._stopMoveAnimation();
2267
2294
  this._selectionRenderModel.setValue(rangeWithCoord, primaryWithCoord);
2268
2295
  this._showAutoFill = primaryWithCoord !== null;
2269
2296
  this._updateLayoutOfSelectionControl();
@@ -2273,7 +2300,11 @@ var SelectionControl = class extends Disposable {
2273
2300
  * Update range and primary range and style.
2274
2301
  * @param selectionWthCoord
2275
2302
  */
2276
- updateRangeBySelectionWithCoord(selectionWthCoord, sk) {
2303
+ updateRangeBySelectionWithCoord(selectionWthCoord, sk, animate = false) {
2304
+ const previousRange = this._animatedRange ?? this.getRange();
2305
+ const targetRange = selectionWthCoord.rangeWithCoord;
2306
+ const rangeChanged = !Rectangle.equals(this.model, targetRange) || this.model.startX !== targetRange.startX || this.model.startY !== targetRange.startY || this.model.endX !== targetRange.endX || this.model.endY !== targetRange.endY;
2307
+ if (animate || rangeChanged || selectionWthCoord.primaryWithCoord === null) this._stopMoveAnimation();
2277
2308
  if (sk) {
2278
2309
  this._rowHeaderWidth = sk.rowHeaderWidth;
2279
2310
  this._columnHeaderHeight = sk.columnHeaderHeight;
@@ -2284,6 +2315,47 @@ var SelectionControl = class extends Disposable {
2284
2315
  this._showAutoFill = selectionWthCoord.primaryWithCoord !== null;
2285
2316
  this._updateLayoutOfSelectionControl(selectionWthCoord.style);
2286
2317
  this._updateControlCoord();
2318
+ if (animate && rangeChanged && !window.matchMedia("(prefers-reduced-motion: reduce)").matches) this._animateMove(previousRange);
2319
+ }
2320
+ _animateMove(from) {
2321
+ const target = this.getRange();
2322
+ const startedAt = Tools.now();
2323
+ const eventedShapes = this.selectionShapeGroup.getObjects().filter((shape) => shape.evented);
2324
+ eventedShapes.forEach((shape) => {
2325
+ shape.evented = false;
2326
+ });
2327
+ this._restoreMoveEvents = () => eventedShapes.forEach((shape) => {
2328
+ shape.evented = true;
2329
+ });
2330
+ this._animatedRange = from;
2331
+ this._updateLayoutOfSelectionControl();
2332
+ this._updateControlCoord();
2333
+ const frame = () => {
2334
+ const progress = Math.min(1, (Tools.now() - startedAt) / SELECTION_MOVE_DURATION);
2335
+ const eased = 1 - (1 - progress) ** 3;
2336
+ if (progress === 1) this._stopMoveAnimation();
2337
+ this._animatedRange = progress < 1 ? {
2338
+ ...target,
2339
+ startX: from.startX + (target.startX - from.startX) * eased,
2340
+ startY: from.startY + (target.startY - from.startY) * eased,
2341
+ endX: from.endX + (target.endX - from.endX) * eased,
2342
+ endY: from.endY + (target.endY - from.endY) * eased
2343
+ } : null;
2344
+ this._updateLayoutOfSelectionControl();
2345
+ this._updateControlCoord();
2346
+ this._moveAnimationFrame = progress < 1 ? requestNewFrame(frame) : -1;
2347
+ };
2348
+ this._moveAnimationFrame = requestNewFrame(frame);
2349
+ }
2350
+ _stopMoveAnimation() {
2351
+ var _this$_restoreMoveEve;
2352
+ if (this._moveAnimationFrame !== -1) {
2353
+ cancelRequestFrame(this._moveAnimationFrame);
2354
+ this._moveAnimationFrame = -1;
2355
+ }
2356
+ this._animatedRange = null;
2357
+ (_this$_restoreMoveEve = this._restoreMoveEvents) === null || _this$_restoreMoveEve === void 0 || _this$_restoreMoveEve.call(this);
2358
+ this._restoreMoveEvents = null;
2287
2359
  }
2288
2360
  /**
2289
2361
  * Update primary range.
@@ -2298,40 +2370,22 @@ var SelectionControl = class extends Disposable {
2298
2370
  this._selectionRenderModel.setCurrentCell(primaryCell);
2299
2371
  }
2300
2372
  clearHighlight() {
2373
+ this._stopMoveAnimation();
2301
2374
  this._showAutoFill = false;
2302
2375
  this._selectionRenderModel.clearCurrentCell();
2303
2376
  this._updateLayoutOfSelectionControl(this._currentStyle);
2377
+ this._updateControlCoord();
2304
2378
  }
2305
2379
  getScene() {
2306
2380
  return this._scene;
2307
2381
  }
2308
2382
  dispose() {
2309
- var _this$_leftBorder, _this$_rightBorder, _this$_topBorder, _this$_bottomBorder, _this$_backgroundCont, _this$_backgroundCont2, _this$_backgroundCont3, _this$_backgroundCont4, _this$_selectionShape, _this$_rowHeaderBackg, _this$_rowHeaderBorde, _this$_rowHeaderGroup, _this$_rowHeaderBackg2, _this$_columnHeaderBa, _this$_columnHeaderBo, _this$_columnHeaderGr, _this$_topLeftWidget, _this$_topCenterWidge, _this$_topRightWidget, _this$_middleLeftWidg, _this$_middleRightWid, _this$_bottomLeftWidg, _this$_bottomCenterWi, _this$_bottomRightWid, _this$_controlExtensi;
2310
- (_this$_leftBorder = this._leftBorder) === null || _this$_leftBorder === void 0 || _this$_leftBorder.dispose();
2311
- (_this$_rightBorder = this._rightBorder) === null || _this$_rightBorder === void 0 || _this$_rightBorder.dispose();
2312
- (_this$_topBorder = this._topBorder) === null || _this$_topBorder === void 0 || _this$_topBorder.dispose();
2313
- (_this$_bottomBorder = this._bottomBorder) === null || _this$_bottomBorder === void 0 || _this$_bottomBorder.dispose();
2314
- (_this$_backgroundCont = this._backgroundControlTop) === null || _this$_backgroundCont === void 0 || _this$_backgroundCont.dispose();
2315
- (_this$_backgroundCont2 = this._backgroundControlMiddleLeft) === null || _this$_backgroundCont2 === void 0 || _this$_backgroundCont2.dispose();
2316
- (_this$_backgroundCont3 = this._backgroundControlMiddleRight) === null || _this$_backgroundCont3 === void 0 || _this$_backgroundCont3.dispose();
2317
- (_this$_backgroundCont4 = this._backgroundControlBottom) === null || _this$_backgroundCont4 === void 0 || _this$_backgroundCont4.dispose();
2318
- this._autoFillControl.dispose();
2319
- (_this$_selectionShape = this._selectionShapeGroup) === null || _this$_selectionShape === void 0 || _this$_selectionShape.dispose();
2320
- (_this$_rowHeaderBackg = this._rowHeaderBackground) === null || _this$_rowHeaderBackg === void 0 || _this$_rowHeaderBackg.dispose();
2321
- (_this$_rowHeaderBorde = this._rowHeaderBorder) === null || _this$_rowHeaderBorde === void 0 || _this$_rowHeaderBorde.dispose();
2322
- (_this$_rowHeaderGroup = this._rowHeaderGroup) === null || _this$_rowHeaderGroup === void 0 || _this$_rowHeaderGroup.dispose();
2323
- (_this$_rowHeaderBackg2 = this._rowHeaderBackground) === null || _this$_rowHeaderBackg2 === void 0 || _this$_rowHeaderBackg2.dispose();
2324
- (_this$_columnHeaderBa = this._columnHeaderBackground) === null || _this$_columnHeaderBa === void 0 || _this$_columnHeaderBa.dispose();
2325
- (_this$_columnHeaderBo = this._columnHeaderBorder) === null || _this$_columnHeaderBo === void 0 || _this$_columnHeaderBo.dispose();
2326
- (_this$_columnHeaderGr = this._columnHeaderGroup) === null || _this$_columnHeaderGr === void 0 || _this$_columnHeaderGr.dispose();
2327
- (_this$_topLeftWidget = this._topLeftWidget) === null || _this$_topLeftWidget === void 0 || _this$_topLeftWidget.dispose();
2328
- (_this$_topCenterWidge = this._topCenterWidget) === null || _this$_topCenterWidge === void 0 || _this$_topCenterWidge.dispose();
2329
- (_this$_topRightWidget = this._topRightWidget) === null || _this$_topRightWidget === void 0 || _this$_topRightWidget.dispose();
2330
- (_this$_middleLeftWidg = this._middleLeftWidget) === null || _this$_middleLeftWidg === void 0 || _this$_middleLeftWidg.dispose();
2331
- (_this$_middleRightWid = this._middleRightWidget) === null || _this$_middleRightWid === void 0 || _this$_middleRightWid.dispose();
2332
- (_this$_bottomLeftWidg = this._bottomLeftWidget) === null || _this$_bottomLeftWidg === void 0 || _this$_bottomLeftWidg.dispose();
2333
- (_this$_bottomCenterWi = this._bottomCenterWidget) === null || _this$_bottomCenterWi === void 0 || _this$_bottomCenterWi.dispose();
2334
- (_this$_bottomRightWid = this._bottomRightWidget) === null || _this$_bottomRightWid === void 0 || _this$_bottomRightWid.dispose();
2383
+ var _this$_controlExtensi;
2384
+ this._stopMoveAnimation();
2385
+ this._stopAntLineAnimation();
2386
+ this._selectionShapeGroup.dispose();
2387
+ this._rowHeaderGroup.dispose();
2388
+ this._columnHeaderGroup.dispose();
2335
2389
  (_this$_controlExtensi = this._controlExtension) === null || _this$_controlExtensi === void 0 || _this$_controlExtensi.dispose();
2336
2390
  super.dispose();
2337
2391
  this._dispose$.next(this);
@@ -2431,12 +2485,12 @@ var SelectionControl = class extends Disposable {
2431
2485
  this._rowHeaderGroup.makeDirty(true);
2432
2486
  }
2433
2487
  _updateBackgroundControl(style) {
2434
- const { startX, startY, endX, endY } = this._selectionRenderModel;
2488
+ const { startX, startY, endX, endY } = this._animatedRange ?? this._selectionRenderModel;
2435
2489
  const scale = this._getScale();
2436
2490
  const { fill = style.fill } = style;
2437
2491
  let { strokeWidth } = style;
2438
2492
  strokeWidth /= scale;
2439
- const highlightSelection = this._selectionRenderModel.highlightToSelection();
2493
+ const highlightSelection = this._animatedRange ?? this._selectionRenderModel.highlightToSelection();
2440
2494
  if (!highlightSelection) {
2441
2495
  this._backgroundControlTop.resize(endX - startX, endY - startY);
2442
2496
  this._backgroundControlTop.setProps({ fill });
@@ -2497,7 +2551,7 @@ var SelectionControl = class extends Disposable {
2497
2551
  this._backgroundControlBottom.setProps({ fill });
2498
2552
  }
2499
2553
  _updateWidgets(style) {
2500
- const { startX, startY, endX, endY } = this._selectionRenderModel;
2554
+ const { startX, startY, endX, endY } = this._animatedRange ?? this._selectionRenderModel;
2501
2555
  const { stroke = style.stroke, widgets = style.widgets, widgetStroke = style.widgetStroke } = style;
2502
2556
  const scale = this._getScale();
2503
2557
  let { widgetSize, widgetStrokeWidth } = style;
@@ -3051,9 +3105,10 @@ var HtmlToUSMService = class HtmlToUSMService {
3051
3105
  cellDataStream = `${dataStream.substring(starts[i])}\r\n`;
3052
3106
  if (cellDataStream === "\r\n") continue;
3053
3107
  } else cellDataStream = `${dataStream.substring(starts[i], starts[i + 1] - 1)}\r\n`;
3108
+ const end = starts[i + 1] ?? dataStream.length;
3054
3109
  const cellTextRuns = [];
3055
3110
  textRuns === null || textRuns === void 0 || textRuns.forEach((t) => {
3056
- if (t.st >= starts[i] && t.ed <= starts[i + 1]) cellTextRuns.push({
3111
+ if (t.st >= starts[i] && t.ed <= end) cellTextRuns.push({
3057
3112
  st: t.st - starts[i],
3058
3113
  ed: t.ed - starts[i],
3059
3114
  ts: t.ts
@@ -3061,7 +3116,7 @@ var HtmlToUSMService = class HtmlToUSMService {
3061
3116
  });
3062
3117
  const cellCustomRanges = [];
3063
3118
  customRanges === null || customRanges === void 0 || customRanges.forEach((c) => {
3064
- if (c.startIndex >= starts[i] && c.endIndex <= starts[i + 1]) cellCustomRanges.push({
3119
+ if (c.startIndex >= starts[i] && c.endIndex <= end) cellCustomRanges.push({
3065
3120
  ...c,
3066
3121
  startIndex: c.startIndex - starts[i],
3067
3122
  endIndex: c.endIndex - starts[i]
@@ -3089,14 +3144,9 @@ var HtmlToUSMService = class HtmlToUSMService {
3089
3144
  payloads,
3090
3145
  customRanges
3091
3146
  };
3092
- if (!(customRanges === null || customRanges === void 0 ? void 0 : customRanges.length)) valueMatrix.setValue(0, 0, convertToCellStyle({ v: dataStream }, dataStream, textRuns));
3093
- else {
3094
- const p = this._generateDocumentDataModelSnapshot({ body: singleDocBody });
3095
- valueMatrix.setValue(0, 0, convertToCellStyle({
3096
- v: dataStream,
3097
- p
3098
- }, dataStream, textRuns));
3099
- }
3147
+ const cell = { v: dataStream };
3148
+ if ((textRuns === null || textRuns === void 0 ? void 0 : textRuns.length) || (customRanges === null || customRanges === void 0 ? void 0 : customRanges.length)) cell.p = this._generateDocumentDataModelSnapshot({ body: singleDocBody });
3149
+ valueMatrix.setValue(0, 0, convertToCellStyle(cell, dataStream, textRuns));
3100
3150
  rowProperties.push({});
3101
3151
  }
3102
3152
  if (tableStrings) tableStrings.forEach((t, index) => {
@@ -3713,7 +3763,7 @@ const LarkPastePlugin = {
3713
3763
  const UniverPastePlugin = {
3714
3764
  name: "univer-sheet-paste-plugin-univer",
3715
3765
  checkPasteType(html) {
3716
- return /UniverNormal/i.test(html);
3766
+ return /<p\b[^>]*\sclass\s*=\s*["'](?:[^"']*\s)?UniverNormal(?:\s[^"']*)?["']/i.test(html);
3717
3767
  },
3718
3768
  stylesRules: [],
3719
3769
  afterProcessRules: [{
@@ -4090,9 +4140,9 @@ function wrapHtmlForExcel(html) {
4090
4140
  /**
4091
4141
  * This service provide hooks for sheet features to supplement content or modify behavior of clipboard.
4092
4142
  */
4143
+ HtmlToUSMService.use(UniverPastePlugin);
4093
4144
  HtmlToUSMService.use(WordPastePlugin);
4094
4145
  HtmlToUSMService.use(LarkPastePlugin);
4095
- HtmlToUSMService.use(UniverPastePlugin);
4096
4146
  const ISheetClipboardService = createIdentifier("sheet.clipboard-service");
4097
4147
  let SheetClipboardService = class SheetClipboardService extends Disposable {
4098
4148
  constructor(_logService, _univerInstanceService, _selectionManagerService, _clipboardInterfaceService, _undoRedoService, _commandService, _markSelectionService, _notificationService, _platformService, _renderManagerService, _themeService, _localeService, _errorService, _injector) {
@@ -4621,6 +4671,19 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
4621
4671
  const start = pasteTarget.pastedRange.rows[0];
4622
4672
  const end = range.rows[range.rows.length - 1] - range.rows[0] + start;
4623
4673
  pasteTarget.pastedRange.rows = Array.from(new Array(end + 1).keys()).slice(start);
4674
+ if (!skipCellCopy) {
4675
+ if (!await this._injector.get(SheetInterceptorService).beforeCommandExecute({
4676
+ id: MoveRangeCommand.id,
4677
+ params: {
4678
+ fromUnitId: copyUnitId,
4679
+ fromSubUnitId: copySubUnitId,
4680
+ fromRange: discreteRangeToRange(range),
4681
+ toUnitId: target.unitId,
4682
+ toSubUnitId: target.subUnitId,
4683
+ toRange: discreteRangeToRange(pasteTarget.pastedRange)
4684
+ }
4685
+ })) return false;
4686
+ }
4624
4687
  }
4625
4688
  const pasteRes = this._pasteUSM({
4626
4689
  cellMatrix,
@@ -6874,7 +6937,7 @@ const SetSelectionFrozenCommand = {
6874
6937
  if (selectRow === 0) selectRow = 1;
6875
6938
  let selectColumn = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
6876
6939
  if (selectColumn === 0) selectColumn = 1;
6877
- const rangeType = range.rangeType;
6940
+ const rangeType = range.rangeType ?? RANGE_TYPE.NORMAL;
6878
6941
  if (rangeType === RANGE_TYPE.ROW || type === 1) {
6879
6942
  startRow = selectRow;
6880
6943
  freezedRowCount = selectRow - sheetViewStartRow;
@@ -6951,6 +7014,30 @@ const SetFirstColumnFrozenCommand = {
6951
7014
  }
6952
7015
  };
6953
7016
 
7017
+ //#endregion
7018
+ //#region src/config/config.ts
7019
+ const SHEETS_UI_PLUGIN_CONFIG_KEY = "sheets-ui.config";
7020
+ const configSymbol = Symbol(SHEETS_UI_PLUGIN_CONFIG_KEY);
7021
+ const defaultPluginConfig = {
7022
+ allowArrowKeyWrapOnSheetBoundary: true,
7023
+ formulaBar: true,
7024
+ protectedRangeShadow: true,
7025
+ maxAutoHeightCount: 1e3
7026
+ };
7027
+ /**
7028
+ * Convert the protectedRangeShadow config to shadow strategy
7029
+ * - true -> 'always'
7030
+ * - false -> 'none'
7031
+ * - string values remain unchanged
7032
+ * @param config The protectedRangeShadow config value
7033
+ * @returns The shadow strategy
7034
+ */
7035
+ function convertToShadowStrategy(config) {
7036
+ if (config === true) return "always";
7037
+ if (config === false) return "none";
7038
+ return config || "always";
7039
+ }
7040
+
6954
7041
  //#endregion
6955
7042
  //#region src/services/select-all/select-all.service.ts
6956
7043
  var SelectAllService = class extends Disposable {
@@ -7044,7 +7131,9 @@ const MoveSelectionCommand = {
7044
7131
  }
7045
7132
  }
7046
7133
  const startRange = getStartRange(range, primary, direction);
7047
- const next = jumpOver === 1 ? findNextGapRange(startRange, direction, worksheet) : findNextRange(startRange, direction, worksheet);
7134
+ const config = accessor.get(IConfigService).getConfig(SHEETS_UI_PLUGIN_CONFIG_KEY);
7135
+ const allowWrap = (config === null || config === void 0 ? void 0 : config.allowArrowKeyWrapOnSheetBoundary) ?? true;
7136
+ const next = jumpOver === 1 ? findNextGapRange(startRange, direction, worksheet) : findNextRange(startRange, direction, worksheet, void 0, true, 1, allowWrap);
7048
7137
  const destRange = getCellAtRowCol(next.startRow, next.startColumn, worksheet);
7049
7138
  if (Rectangle.equals(destRange, startRange)) return false;
7050
7139
  const unitId = workbook.getUnitId();
@@ -7167,13 +7256,7 @@ const MoveSelectionEnterAndTabCommand = {
7167
7256
  keycode: KeyCode.TAB
7168
7257
  });
7169
7258
  }
7170
- /**
7171
- * The start range is from the primary selection range.
7172
- * If the edited cell is the last row/column of the worksheet, and the submitted operation is Enter/Tab to move down/right, the next selected cell should still be the current cell (not move to the first row/column of the worksheet).
7173
- */
7174
- const isLastRowCell = keycode === KeyCode.ENTER && direction === Direction.DOWN && startRange.endRow === worksheet.getMaxRows() - 1;
7175
- const isLastColumnCell = keycode === KeyCode.TAB && direction === Direction.RIGHT && startRange.endColumn === worksheet.getMaxColumns() - 1;
7176
- const next = isLastRowCell || isLastColumnCell ? startRange : findNextRange(startRange, direction, worksheet);
7259
+ const next = findNextRange(startRange, direction, worksheet, void 0, true, 1, false);
7177
7260
  const destRange = getCellAtRowCol(next.startRow, next.startColumn, worksheet);
7178
7261
  if (Rectangle.equals(destRange, startRange)) return false;
7179
7262
  resultRange = {
@@ -7217,11 +7300,19 @@ const ExpandSelectionCommand = {
7217
7300
  const target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
7218
7301
  if (!target) return false;
7219
7302
  const { worksheet, unitId, subUnitId } = target;
7220
- const selection = getSelectionsService(accessor).getCurrentLastSelection();
7303
+ const selectionsService = getSelectionsService(accessor, params.fromCurrentSelection);
7304
+ const selection = selectionsService.getCurrentLastSelection();
7221
7305
  if (!selection) return false;
7222
7306
  const { jumpOver, direction, extra } = params;
7223
7307
  let { range: startRange, primary } = selection;
7224
7308
  if (extra === "formula-editor") {
7309
+ if (params.fromCurrentSelection && primary) startRange = {
7310
+ startRow: primary.startRow,
7311
+ endRow: primary.endRow,
7312
+ startColumn: primary.startColumn,
7313
+ endColumn: primary.endColumn,
7314
+ rangeType: RANGE_TYPE.NORMAL
7315
+ };
7225
7316
  if (startRange.startRow === startRange.endRow && startRange.startColumn === startRange.endColumn) {
7226
7317
  const mergedCell = worksheet.getMergedCell(startRange.startRow, startRange.startColumn);
7227
7318
  if (mergedCell) startRange = {
@@ -7230,18 +7321,21 @@ const ExpandSelectionCommand = {
7230
7321
  };
7231
7322
  }
7232
7323
  if (!primary) {
7233
- const lastSelectionPrimary = getSelectionsService(accessor).getCurrentLastSelectionPrimaryCell();
7324
+ const lastSelectionPrimary = selectionsService.getCurrentLastSelectionPrimaryCell();
7234
7325
  if (lastSelectionPrimary && Rectangle.contains(startRange, lastSelectionPrimary)) primary = lastSelectionPrimary;
7235
7326
  }
7236
7327
  }
7237
- const destRange = !checkIfShrink({
7328
+ const isShrink = checkIfShrink({
7238
7329
  range: startRange,
7239
7330
  primary
7240
- }, direction, worksheet) ? jumpOver === 1 ? expandToNextGapRange(startRange, direction, worksheet) : expandToNextCell(startRange, direction, worksheet) : jumpOver === 1 ? shrinkToNextGapRange(startRange, {
7331
+ }, direction, worksheet);
7332
+ let destRange;
7333
+ if (isShrink) destRange = jumpOver === 1 ? shrinkToNextGapRange(startRange, {
7241
7334
  ...Rectangle.clone(primary),
7242
7335
  rangeType: RANGE_TYPE.NORMAL
7243
7336
  }, direction, worksheet) : shrinkToNextCell(startRange, direction, worksheet);
7244
- destRange.rangeType = selection.range.rangeType;
7337
+ else destRange = jumpOver === 1 ? expandToNextGapRange(startRange, direction, worksheet) : expandToNextCell(startRange, direction, worksheet);
7338
+ destRange.rangeType = startRange.rangeType;
7245
7339
  if (Rectangle.equals(destRange, startRange)) return false;
7246
7340
  return accessor.get(ICommandService).syncExecuteCommand(SetSelectionsOperation.id, {
7247
7341
  unitId,
@@ -8142,14 +8236,17 @@ function transformPosition2Offset(x, y, scene, skeleton, worksheet) {
8142
8236
  const endSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn, false);
8143
8237
  const { rowHeaderWidth, columnHeaderHeight } = skeleton;
8144
8238
  const freezeWidth = endSheetView.startX - startSheetView.startX;
8145
- const freezeHeight = endSheetView.startY - startSheetView.startY;
8239
+ const freezeStartY = ySplit > 0 && startRow === ySplit ? 0 : startSheetView.startY;
8240
+ const freezeHeight = endSheetView.startY - freezeStartY;
8146
8241
  const { top, left, viewportScrollX, viewportScrollY } = viewMain;
8242
+ const viewportLeft = left / scaleX;
8243
+ const viewportTop = top / scaleY;
8147
8244
  let offsetX;
8148
- if (x > left) offsetX = (x - viewportScrollX) * scaleX;
8149
- else offsetX = (freezeWidth + rowHeaderWidth - (left - x)) * scaleX;
8245
+ if (x > viewportLeft) offsetX = (x - viewportScrollX) * scaleX;
8246
+ else offsetX = (freezeWidth + rowHeaderWidth - (viewportLeft - x)) * scaleX;
8150
8247
  let offsetY;
8151
- if (y > top) offsetY = (y - viewportScrollY) * scaleY;
8152
- else offsetY = (freezeHeight + columnHeaderHeight - (top - y)) * scaleX;
8248
+ if (y > viewportTop) offsetY = (y - viewportScrollY) * scaleY;
8249
+ else offsetY = (freezeHeight + columnHeaderHeight - (viewportTop - y)) * scaleY;
8153
8250
  return {
8154
8251
  x: offsetX,
8155
8252
  y: offsetY
@@ -8292,7 +8389,7 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
8292
8389
  }
8293
8390
  refreshEditCellPosition(resetSizeOnly) {
8294
8391
  if (!this._currentEditCell || !this._currentEditCellState) return;
8295
- const { unitId, sheetId, primary, scene, engine } = this._currentEditCell;
8392
+ const { unitId, sheetId, primary: selectedCell, scene, engine } = this._currentEditCell;
8296
8393
  const workbook = this._getWorkbookForEditUnit(unitId);
8297
8394
  if (!workbook || workbook.getUnitId() !== unitId) return;
8298
8395
  const worksheet = workbook.getActiveSheet();
@@ -8300,6 +8397,7 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
8300
8397
  if (!this._renderManagerService.getRenderUnitById(unitId)) return;
8301
8398
  const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
8302
8399
  if (!skeleton) return;
8400
+ const primary = worksheet.getCellInfoInMergeData(selectedCell.actualRow, selectedCell.actualColumn);
8303
8401
  const primaryWithCoord = attachPrimaryWithCoord(skeleton, primary);
8304
8402
  const actualRangeWithCoord = convertCellToRange(primaryWithCoord);
8305
8403
  const canvasOffset = getCanvasOffsetByEngine(engine);
@@ -8397,7 +8495,7 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
8397
8495
  getLatestEditCellState() {
8398
8496
  var _documentLayoutObject, _documentLayoutObject2;
8399
8497
  if (!this._currentEditCell) return;
8400
- const { unitId, sheetId, primary, scene, engine } = this._currentEditCell;
8498
+ const { unitId, sheetId, primary: selectedCell, scene, engine } = this._currentEditCell;
8401
8499
  const workbook = this._getWorkbookForEditUnit(unitId);
8402
8500
  if (!workbook || workbook.getUnitId() !== unitId) return;
8403
8501
  const worksheet = workbook.getActiveSheet();
@@ -8405,6 +8503,7 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
8405
8503
  if (!this._renderManagerService.getRenderUnitById(unitId)) return;
8406
8504
  const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
8407
8505
  if (!skeleton) return;
8506
+ const primary = worksheet.getCellInfoInMergeData(selectedCell.actualRow, selectedCell.actualColumn);
8408
8507
  const { startRow, startColumn } = primary;
8409
8508
  const primaryWithCoord = attachPrimaryWithCoord(skeleton, primary);
8410
8509
  const actualRangeWithCoord = convertCellToRange(primaryWithCoord);
@@ -8776,29 +8875,6 @@ const SetActivateCellEditOperation = {
8776
8875
  }
8777
8876
  };
8778
8877
 
8779
- //#endregion
8780
- //#region src/config/config.ts
8781
- const SHEETS_UI_PLUGIN_CONFIG_KEY = "sheets-ui.config";
8782
- const configSymbol = Symbol(SHEETS_UI_PLUGIN_CONFIG_KEY);
8783
- const defaultPluginConfig = {
8784
- formulaBar: true,
8785
- protectedRangeShadow: true,
8786
- maxAutoHeightCount: 1e3
8787
- };
8788
- /**
8789
- * Convert the protectedRangeShadow config to shadow strategy
8790
- * - true -> 'always'
8791
- * - false -> 'none'
8792
- * - string values remain unchanged
8793
- * @param config The protectedRangeShadow config value
8794
- * @returns The shadow strategy
8795
- */
8796
- function convertToShadowStrategy(config) {
8797
- if (config === true) return "always";
8798
- if (config === false) return "none";
8799
- return config || "always";
8800
- }
8801
-
8802
8878
  //#endregion
8803
8879
  //#region src/commands/operations/cell-edit.operation.ts
8804
8880
  const SetCellEditVisibleOperation = {
@@ -10316,6 +10392,18 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
10316
10392
  this._univerInstanceService = _univerInstanceService;
10317
10393
  this._configService = _configService;
10318
10394
  this._embedFloatingGeometryService = _embedFloatingGeometryService;
10395
+ _defineProperty(this, "_editorWidth", 0);
10396
+ _defineProperty(this, "_editorHeight", 0);
10397
+ _defineProperty(this, "_initialEditorSize", null);
10398
+ _defineProperty(this, "_cellSize", null);
10399
+ this.disposeWithMe(this._editorBridgeService.visible$.subscribe(({ visible }) => {
10400
+ if (!visible) {
10401
+ this._editorWidth = 0;
10402
+ this._editorHeight = 0;
10403
+ this._initialEditorSize = null;
10404
+ this._cellSize = null;
10405
+ }
10406
+ }));
10319
10407
  }
10320
10408
  get _currentRenderer() {
10321
10409
  return getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
@@ -10343,10 +10431,13 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
10343
10431
  if (!param) return;
10344
10432
  const { position, documentLayoutObject, canvasOffset, scaleX, scaleY } = param;
10345
10433
  const { startX, startY, endX, endY } = position;
10434
+ const cellWidth = endX - startX;
10435
+ const cellHeight = endY - startY;
10346
10436
  const documentDataModel = this._univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
10347
10437
  if (documentDataModel == null) return;
10348
10438
  const documentSkeleton = this._getEditorSkeleton();
10349
10439
  if (!documentSkeleton) return;
10440
+ this._syncCellSize(cellWidth / scaleX, cellHeight / scaleY);
10350
10441
  documentSkeleton.resetInitialWidth();
10351
10442
  const info = this._predictingSize(position, canvasOffset, documentSkeleton, documentLayoutObject, scaleX, scaleY);
10352
10443
  if (!info || info.actualWidth <= 0) return;
@@ -10354,17 +10445,17 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
10354
10445
  const { verticalAlign, horizontalAlign, paddingData, fill } = documentLayoutObject;
10355
10446
  actualWidth = actualWidth + (paddingData.l ?? 0) * scaleX + (paddingData.r ?? 0) * scaleX;
10356
10447
  actualHeight = actualHeight + (paddingData.t ?? 0) * scaleY + (paddingData.b ?? 0) * scaleY;
10357
- let editorWidth = endX - startX;
10358
- let editorHeight = endY - startY;
10359
- if (editorWidth < actualWidth) editorWidth = Math.ceil(actualWidth);
10360
- if (editorHeight < actualHeight) editorHeight = Math.ceil(actualHeight);
10448
+ const contentWidth = cellWidth < actualWidth ? Math.ceil(actualWidth) : cellWidth;
10449
+ const contentHeight = cellHeight < actualHeight ? Math.ceil(actualHeight) : cellHeight;
10450
+ const editorWidth = Math.max(contentWidth, Math.min(this._editorWidth * scaleX, info.maxSize.width));
10451
+ const editorHeight = Math.max(contentHeight, Math.min(this._editorHeight * scaleY, info.maxSize.height));
10361
10452
  let offsetTop = 0;
10362
10453
  if (verticalAlign === VerticalAlign.MIDDLE) offsetTop = (editorHeight - actualHeight) / 2 / scaleY;
10363
10454
  else if (verticalAlign === VerticalAlign.TOP) offsetTop = paddingData.t || 0;
10364
10455
  else offsetTop = (editorHeight - actualHeight) / scaleY;
10365
10456
  let offsetLeft = 0;
10366
- if (horizontalAlign === HorizontalAlign.CENTER) {} else if (horizontalAlign === HorizontalAlign.RIGHT) offsetLeft = (editorWidth - actualWidth) / scaleX;
10367
- else offsetLeft = paddingData.l || 0;
10457
+ if (horizontalAlign === HorizontalAlign.RIGHT) offsetLeft = (editorWidth - actualWidth) / scaleX;
10458
+ else if (horizontalAlign !== HorizontalAlign.CENTER) offsetLeft = paddingData.l || 0;
10368
10459
  offsetTop = Math.max(offsetTop, paddingData.t || 0);
10369
10460
  offsetLeft = Math.max(offsetLeft, paddingData.l || 0);
10370
10461
  documentDataModel.updateDocumentDataMargin({
@@ -10372,7 +10463,22 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
10372
10463
  l: offsetLeft
10373
10464
  });
10374
10465
  documentSkeleton.calculate();
10375
- this._editAreaProcessing(editorWidth, editorHeight, position, canvasOffset, fill, scaleX, scaleY, horizontalAlign, callback);
10466
+ this._editAreaProcessing({
10467
+ width: editorWidth,
10468
+ height: editorHeight,
10469
+ contentWidth
10470
+ }, position, canvasOffset, fill, scaleX, scaleY, horizontalAlign, callback);
10471
+ }
10472
+ _syncCellSize(width, height) {
10473
+ if (this._cellSize && (Math.abs(this._cellSize.width - width) > 1e-6 || Math.abs(this._cellSize.height - height) > 1e-6)) {
10474
+ var _this$_initialEditorS, _this$_initialEditorS2;
10475
+ this._editorWidth = ((_this$_initialEditorS = this._initialEditorSize) === null || _this$_initialEditorS === void 0 ? void 0 : _this$_initialEditorS.width) ?? 0;
10476
+ this._editorHeight = ((_this$_initialEditorS2 = this._initialEditorSize) === null || _this$_initialEditorS2 === void 0 ? void 0 : _this$_initialEditorS2.height) ?? 0;
10477
+ }
10478
+ this._cellSize = {
10479
+ width,
10480
+ height
10481
+ };
10376
10482
  }
10377
10483
  /**
10378
10484
  * Mainly used to pre-calculate the width of the editor,
@@ -10383,25 +10489,26 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
10383
10489
  const { textRotation, wrapStrategy, paddingData } = documentLayoutObject;
10384
10490
  const documentDataModel = this._univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
10385
10491
  const { vertexAngle: angle } = convertTextRotation(textRotation);
10492
+ const maxSize = this._getEditorMaxSize(actualRangeWithCoord, canvasOffset, documentLayoutObject.horizontalAlign);
10493
+ if (!maxSize) return;
10494
+ documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataMargin({
10495
+ l: paddingData.l,
10496
+ t: paddingData.t
10497
+ });
10386
10498
  if (wrapStrategy === WrapStrategy.WRAP && angle === 0) {
10387
10499
  documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataPageSize((endX - startX) / scaleX);
10388
- documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataMargin({
10389
- l: paddingData.l,
10390
- t: paddingData.t
10391
- });
10392
10500
  documentSkeleton.calculate();
10393
10501
  const { actualWidth, actualHeight } = documentSkeleton.getActualSize();
10394
10502
  return {
10395
10503
  actualWidth: actualWidth * scaleX,
10396
- actualHeight: actualHeight * scaleY
10504
+ actualHeight: actualHeight * scaleY,
10505
+ maxSize
10397
10506
  };
10398
10507
  }
10399
- const maxSize = this._getEditorMaxSize(actualRangeWithCoord, canvasOffset, documentLayoutObject.horizontalAlign);
10400
- if (!maxSize) return;
10401
10508
  documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataPageSize(maxSize.width / scaleX);
10402
10509
  documentSkeleton.calculate();
10403
10510
  const size = documentSkeleton.getActualSize();
10404
- let editorWidth = endX - startX;
10511
+ let editorWidth = Math.max(endX - startX, Math.min(this._editorWidth * scaleX, maxSize.width));
10405
10512
  if (editorWidth < size.actualWidth * scaleX + EDITOR_INPUT_SELF_EXTEND_GAP * scaleX) editorWidth = size.actualWidth * scaleX + EDITOR_INPUT_SELF_EXTEND_GAP * scaleX;
10406
10513
  documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataPageSize(editorWidth / scaleX);
10407
10514
  /**
@@ -10413,7 +10520,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
10413
10520
  });
10414
10521
  return {
10415
10522
  actualWidth: size.actualWidth * scaleX,
10416
- actualHeight: size.actualHeight * scaleY
10523
+ actualHeight: size.actualHeight * scaleY,
10524
+ maxSize
10417
10525
  };
10418
10526
  }
10419
10527
  _getEditorMaxSize(position, canvasOffset, horizontalAlign) {
@@ -10459,7 +10567,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
10459
10567
  * determine whether a scrollbar appears,
10460
10568
  * and calculate the editor's boundaries relative to the browser.
10461
10569
  */
10462
- _editAreaProcessing(editorWidth, editorHeight, actualRangeWithCoord, canvasOffset, fill, scaleX = 1, scaleY = 1, horizontalAlign, callback) {
10570
+ _editAreaProcessing(size, actualRangeWithCoord, canvasOffset, fill, scaleX = 1, scaleY = 1, horizontalAlign, callback) {
10463
10571
  const editorObject = this._getEditorObject();
10464
10572
  if (editorObject == null) return;
10465
10573
  const engine = this.engine;
@@ -10467,25 +10575,16 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
10467
10575
  const canvasElement = engine.getCanvasElement();
10468
10576
  let { startX, startY } = actualRangeWithCoord;
10469
10577
  const { document: documentComponent, scene: editorScene, engine: docEngine } = editorObject;
10470
- const viewportMain = editorScene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
10471
10578
  const { height: clientHeight, width: clientWidth, contentScaleX, contentScaleY, scaleAdjustX, scaleAdjustY } = this._getEditorMaxSize(actualRangeWithCoord, canvasOffset, horizontalAlign);
10472
- let physicHeight = editorHeight;
10473
- let scrollBar = viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.getScrollBar();
10474
- if (physicHeight > clientHeight) {
10475
- if (scrollBar == null) viewportMain && new ScrollBar(viewportMain, {
10476
- enableHorizontal: false,
10477
- barSize: 8
10478
- });
10479
- else viewportMain === null || viewportMain === void 0 || viewportMain.resetCanvasSizeAndUpdateScroll();
10480
- viewportMain === null || viewportMain === void 0 || viewportMain.scrollToViewportPos({ viewportScrollY: physicHeight - clientHeight });
10481
- physicHeight = clientHeight;
10482
- } else {
10483
- var _viewportMain$getScro;
10484
- scrollBar = null;
10485
- viewportMain === null || viewportMain === void 0 || (_viewportMain$getScro = viewportMain.getScrollBar()) === null || _viewportMain$getScro === void 0 || _viewportMain$getScro.dispose();
10486
- }
10487
- editorWidth += (scrollBar === null || scrollBar === void 0 ? void 0 : scrollBar.barSize) || 0;
10488
- if (editorWidth > clientWidth) editorWidth = clientWidth;
10579
+ const { physicHeight, scrollBarWidth } = this._fitEditorViewport(editorScene, size.height, clientHeight);
10580
+ const editorWidth = Math.min(Math.max(size.width, size.contentWidth + scrollBarWidth), clientWidth);
10581
+ const editorHeight = size.height;
10582
+ this._editorWidth = Math.max(this._editorWidth, editorWidth / scaleX);
10583
+ this._editorHeight = Math.max(this._editorHeight, physicHeight / scaleY);
10584
+ if (!this._initialEditorSize && this._editorBridgeService.isVisible().visible) this._initialEditorSize = {
10585
+ width: editorWidth / scaleX,
10586
+ height: physicHeight / scaleY
10587
+ };
10489
10588
  this._addBackground(editorScene, editorWidth / scaleX, editorHeight / scaleY, fill);
10490
10589
  const { scaleX: precisionScaleX, scaleY: precisionScaleY } = editorScene.getPrecisionScale();
10491
10590
  editorScene.transformByState({
@@ -10495,11 +10594,6 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
10495
10594
  scaleY: scaleY * scaleAdjustY
10496
10595
  });
10497
10596
  documentComponent.resize(editorWidth * scaleAdjustX / scaleX, editorHeight * scaleAdjustY / scaleY);
10498
- /**
10499
- * sometimes requestIdleCallback is invalid, so use setTimeout to ensure the successful execution of the resizeBySize method.
10500
- * resize canvas
10501
- * When modifying the selection area for a formula, it is necessary to add a setTimeout to ensure successful updating.
10502
- */
10503
10597
  setTimeout(() => {
10504
10598
  docEngine.resizeBySize(fixLineWidthByScale(editorWidth, precisionScaleX), fixLineWidthByScale(physicHeight, precisionScaleY));
10505
10599
  callback === null || callback === void 0 || callback();
@@ -10519,6 +10613,26 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
10519
10613
  show: true
10520
10614
  });
10521
10615
  }
10616
+ _fitEditorViewport(editorScene, editorHeight, clientHeight) {
10617
+ const viewportMain = editorScene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
10618
+ let scrollBar = viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.getScrollBar();
10619
+ if (editorHeight > clientHeight) {
10620
+ if (scrollBar == null) viewportMain && new ScrollBar(viewportMain, {
10621
+ enableHorizontal: false,
10622
+ barSize: 8
10623
+ });
10624
+ else viewportMain === null || viewportMain === void 0 || viewportMain.resetCanvasSizeAndUpdateScroll();
10625
+ viewportMain === null || viewportMain === void 0 || viewportMain.scrollToViewportPos({ viewportScrollY: editorHeight - clientHeight });
10626
+ } else {
10627
+ var _viewportMain$getScro;
10628
+ scrollBar = null;
10629
+ viewportMain === null || viewportMain === void 0 || (_viewportMain$getScro = viewportMain.getScrollBar()) === null || _viewportMain$getScro === void 0 || _viewportMain$getScro.dispose();
10630
+ }
10631
+ return {
10632
+ physicHeight: Math.min(editorHeight, clientHeight),
10633
+ scrollBarWidth: (scrollBar === null || scrollBar === void 0 ? void 0 : scrollBar.barSize) ?? 0
10634
+ };
10635
+ }
10522
10636
  _getEditorContentElement() {
10523
10637
  var _this$_embedFloatingG;
10524
10638
  return ((_this$_embedFloatingG = this._embedFloatingGeometryService) === null || _this$_embedFloatingG === void 0 || (_this$_embedFloatingG = _this$_embedFloatingG.getRegistrationByChildUnitId(this._editingUnitId)) === null || _this$_embedFloatingG === void 0 ? void 0 : _this$_embedFloatingG.contentRoot) ?? this._layoutService.getContentElement();
@@ -10977,27 +11091,6 @@ function generateArrowSelectionShortCutItem() {
10977
11091
  }
10978
11092
  });
10979
11093
  }
10980
- for (const [binding, macArrow, direction] of [[
10981
- KeyCode.HOME,
10982
- KeyCode.ARROW_LEFT,
10983
- Direction.LEFT
10984
- ], [
10985
- KeyCode.END,
10986
- KeyCode.ARROW_RIGHT,
10987
- Direction.RIGHT
10988
- ]]) for (const extend of [false, true]) {
10989
- const shift = extend ? MetaKeys.SHIFT : 0;
10990
- shortcutList.push({
10991
- id: extend ? MoveSelectionOperation.id : MoveCursorOperation.id,
10992
- binding: binding | shift,
10993
- mac: macArrow | MetaKeys.CTRL_COMMAND | shift,
10994
- preconditions: whenEditorDidNotInputFormulaActivated,
10995
- staticParameters: {
10996
- direction,
10997
- granularity: "line"
10998
- }
10999
- });
11000
- }
11001
11094
  return shortcutList;
11002
11095
  }
11003
11096
  const StartEditWithF2Shortcut = {
@@ -11398,15 +11491,15 @@ function getPercentOffset(editCellState, dataStream) {
11398
11491
  }
11399
11492
  function getPercentEditorSelection(editCellState, visibleParam, dataStream) {
11400
11493
  const percentOffset = getPercentOffset(editCellState, dataStream);
11401
- if (percentOffset == null) return null;
11402
- const { eventType, initialValue, keycode } = visibleParam;
11403
- if (isFormulaString(dataStream) && (eventType === DeviceInputEventType.Dblclick || keycode === KeyCode.F2)) return null;
11404
- if (eventType === DeviceInputEventType.Keyboard && keycode === KeyCode.F2) return {
11494
+ if (percentOffset == null || visibleParam.eventType !== DeviceInputEventType.Keyboard) return null;
11495
+ const { initialValue, keycode } = visibleParam;
11496
+ if (isFormulaString(dataStream) && keycode === KeyCode.F2) return null;
11497
+ if (keycode === KeyCode.F2) return {
11405
11498
  startOffset: percentOffset,
11406
11499
  endOffset: percentOffset,
11407
11500
  collapsed: true
11408
11501
  };
11409
- if (eventType !== DeviceInputEventType.Dblclick && (eventType !== DeviceInputEventType.Keyboard || keycode === KeyCode.BACKSPACE || keycode === KeyCode.DELETE || !/^\d/.test(initialValue ?? ""))) return null;
11502
+ if (keycode === KeyCode.BACKSPACE || keycode === KeyCode.DELETE || !/^\d/.test(initialValue ?? "")) return null;
11410
11503
  return {
11411
11504
  startOffset: 0,
11412
11505
  endOffset: percentOffset,
@@ -11656,7 +11749,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
11656
11749
  }));
11657
11750
  }
11658
11751
  _handleEditorVisible(param) {
11659
- var _this$_sheetCellEdito4, _documentDataModel$ge, _this$_renderManagerS5;
11752
+ var _documentDataModel$ge, _this$_renderManagerS6;
11660
11753
  const { eventType, keycode } = param;
11661
11754
  this._cursorChange = eventType === DeviceInputEventType.PointerDown || eventType === DeviceInputEventType.Dblclick ? 2 : 1;
11662
11755
  const editCellState = this._editorBridgeService.getEditLocation();
@@ -11675,21 +11768,25 @@ let EditingRenderController = class EditingRenderController extends Disposable {
11675
11768
  this._editorBridgeService.refreshEditCellPosition(false);
11676
11769
  const editorObject = this._getEditorObject();
11677
11770
  if (editorObject == null) return;
11678
- const { document, scene } = editorObject;
11771
+ const { document } = editorObject;
11679
11772
  this._contextService.setContextValue(EDITOR_ACTIVATED, true);
11680
11773
  const documentDataModel = this._getDocumentDataModel();
11681
11774
  const skeleton = this._getEditorSkeleton(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
11682
11775
  if (!skeleton || !documentDataModel) return;
11683
- (_this$_sheetCellEdito4 = this._sheetCellEditorResizeService) === null || _this$_sheetCellEdito4 === void 0 || _this$_sheetCellEdito4.fitTextSize(() => {
11684
- const viewMain = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
11685
- viewMain === null || viewMain === void 0 || viewMain.scrollToViewportPos({
11686
- viewportScrollX: Number.POSITIVE_INFINITY,
11687
- viewportScrollY: Number.POSITIVE_INFINITY
11688
- });
11689
- });
11776
+ this._resizeEditorOnOpen(param, editorObject, !!isInArrayFormulaRange);
11690
11777
  const clearAndEdit = () => {
11778
+ const resetPointerSelection = isInArrayFormulaRange && eventType === DeviceInputEventType.PointerDown;
11779
+ const editorId = this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) ? DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : this._editorBridgeService.getCurrentEditorId();
11780
+ if (resetPointerSelection) {
11781
+ var _this$_renderManagerS5;
11782
+ (_this$_renderManagerS5 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS5 === void 0 || _this$_renderManagerS5.with(DocSelectionRenderService).cancelPointerSelection();
11783
+ }
11691
11784
  this._emptyDocumentDataModel(documentDataModel.getSnapshot().documentStyle, !!isInArrayFormulaRange);
11692
11785
  document.makeDirty();
11786
+ if (resetPointerSelection) {
11787
+ var _this$_getEditorSkele;
11788
+ (_this$_getEditorSkele = this._getEditorSkeleton(editorId)) === null || _this$_getEditorSkele === void 0 || _this$_getEditorSkele.calculate();
11789
+ }
11693
11790
  if (keycode === KeyCode.BACKSPACE || eventType === DeviceInputEventType.Dblclick) {
11694
11791
  skeleton.calculate();
11695
11792
  this._editorBridgeService.changeEditorDirty(true);
@@ -11701,6 +11798,27 @@ let EditingRenderController = class EditingRenderController extends Disposable {
11701
11798
  unitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
11702
11799
  subUnitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY
11703
11800
  });
11801
+ if (resetPointerSelection && editorId !== DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
11802
+ const selectionTarget = {
11803
+ unitId: editorId,
11804
+ subUnitId: editorId
11805
+ };
11806
+ const previousSelection = this._textSelectionManagerService.getSelectionInfo(selectionTarget);
11807
+ this._textSelectionManagerService.replaceSelectionInfoWithoutRefresh({
11808
+ textRanges: [{
11809
+ startOffset: 0,
11810
+ endOffset: 0,
11811
+ collapsed: true,
11812
+ isActive: true
11813
+ }],
11814
+ rectRanges: [],
11815
+ segmentId: "",
11816
+ segmentPage: -1,
11817
+ style: (previousSelection === null || previousSelection === void 0 ? void 0 : previousSelection.style) ?? NORMAL_TEXT_SELECTION_PLUGIN_STYLE,
11818
+ isEditing: true
11819
+ }, selectionTarget);
11820
+ this._textSelectionManagerService.refreshSelection(selectionTarget, true);
11821
+ }
11704
11822
  };
11705
11823
  const replaceSelection = (selection) => {
11706
11824
  this._textSelectionManagerService.replaceDocRanges([selection], {
@@ -11711,7 +11829,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
11711
11829
  const percentSelection = getPercentEditorSelection(editCellState, param, (_documentDataModel$ge = documentDataModel.getBody()) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.dataStream);
11712
11830
  const cellImage = isCellImage(documentDataModel.getSnapshot());
11713
11831
  this._submitEmptyCellImageEdit = cellImage && eventType === DeviceInputEventType.Keyboard && keycode === KeyCode.BACKSPACE;
11714
- if (cellImage) clearAndEdit();
11832
+ if (cellImage || isInArrayFormulaRange) clearAndEdit();
11715
11833
  else if (eventType === DeviceInputEventType.Keyboard && keycode === KeyCode.F2) {
11716
11834
  var _documentDataModel$ge2;
11717
11835
  document.makeDirty();
@@ -11726,19 +11844,39 @@ let EditingRenderController = class EditingRenderController extends Disposable {
11726
11844
  endOffset,
11727
11845
  collapsed: true
11728
11846
  });
11729
- } else if (eventType === DeviceInputEventType.Keyboard || eventType === DeviceInputEventType.Dblclick && isInArrayFormulaRange) {
11847
+ } else if (eventType === DeviceInputEventType.Keyboard) {
11730
11848
  if (percentSelection) replaceSelection(percentSelection);
11731
11849
  else clearAndEdit();
11732
11850
  } else if (eventType === DeviceInputEventType.Dblclick) {
11733
11851
  if (this._contextService.getContextValue(FOCUSING_EDITOR_INPUT_FORMULA)) return;
11734
- const endOffset = documentDataModel.getBody().dataStream.length - 2 || 0;
11735
- replaceSelection(percentSelection ?? {
11736
- startOffset: 0,
11852
+ const dataStream = documentDataModel.getBody().dataStream;
11853
+ const endOffset = (!isFormulaString(dataStream) ? getPercentOffset(editCellState, dataStream) : null) ?? dataStream.length - 2;
11854
+ replaceSelection({
11855
+ startOffset: endOffset,
11737
11856
  endOffset,
11738
- collapsed: endOffset === 0
11857
+ collapsed: true
11739
11858
  });
11740
11859
  }
11741
- (_this$_renderManagerS5 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS5 === void 0 || _this$_renderManagerS5.scene.resetCursor();
11860
+ (_this$_renderManagerS6 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS6 === void 0 || _this$_renderManagerS6.scene.resetCursor();
11861
+ }
11862
+ _resizeEditorOnOpen(param, editorObject, isInArrayFormulaRange) {
11863
+ var _this$_sheetCellEdito4;
11864
+ const pointerPosition = param.eventType === DeviceInputEventType.Dblclick ? param.pointerPosition : void 0;
11865
+ (_this$_sheetCellEdito4 = this._sheetCellEditorResizeService) === null || _this$_sheetCellEdito4 === void 0 || _this$_sheetCellEdito4.fitTextSize(() => {
11866
+ var _scene$getViewport;
11867
+ if (pointerPosition && this._editorBridgeService.isVisible() !== param) return;
11868
+ const { engine, scene } = editorObject;
11869
+ (_scene$getViewport = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN)) === null || _scene$getViewport === void 0 || _scene$getViewport.scrollToViewportPos({
11870
+ viewportScrollX: pointerPosition ? 0 : Number.POSITIVE_INFINITY,
11871
+ viewportScrollY: pointerPosition ? 0 : Number.POSITIVE_INFINITY
11872
+ });
11873
+ if (!pointerPosition || isInArrayFormulaRange) return;
11874
+ const rect = engine.getCanvasElement().getBoundingClientRect();
11875
+ if (rect.width > 0 && rect.height > 0) {
11876
+ var _this$_renderManagerS7;
11877
+ (_this$_renderManagerS7 = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS7 === void 0 || _this$_renderManagerS7.with(DocSelectionRenderService).setCursorManually((pointerPosition.x - rect.left) * engine.width / rect.width, (pointerPosition.y - rect.top) * engine.height / rect.height, true, true, { strict: false });
11878
+ }
11879
+ });
11742
11880
  }
11743
11881
  _cacheEmptyCellTextStyle() {
11744
11882
  var _this$_editorBridgeSe, _sourceBody$textRuns;
@@ -11871,8 +12009,8 @@ let EditingRenderController = class EditingRenderController extends Disposable {
11871
12009
  const editorUnitId = this._editorBridgeService.getCurrentEditorId();
11872
12010
  if (editorUnitId == null || !this._editorService.isSheetEditor(editorUnitId)) return;
11873
12011
  if (editorUnitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
11874
- var _this$_getEditorSkele;
11875
- (_this$_getEditorSkele = this._getEditorSkeleton(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_getEditorSkele === void 0 || _this$_getEditorSkele.resetInitialWidth();
12012
+ var _this$_getEditorSkele2;
12013
+ (_this$_getEditorSkele2 = this._getEditorSkeleton(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_getEditorSkele2 === void 0 || _this$_getEditorSkele2.resetInitialWidth();
11876
12014
  }
11877
12015
  this._clearEditorHistory();
11878
12016
  }
@@ -11938,12 +12076,12 @@ let EditingRenderController = class EditingRenderController extends Disposable {
11938
12076
  return this._univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
11939
12077
  }
11940
12078
  _getEditorSkeleton(editorId) {
11941
- var _this$_renderManagerS6;
11942
- return (_this$_renderManagerS6 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS6 === void 0 ? void 0 : _this$_renderManagerS6.with(DocSkeletonManagerService).getSkeleton();
12079
+ var _this$_renderManagerS8;
12080
+ return (_this$_renderManagerS8 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS8 === void 0 ? void 0 : _this$_renderManagerS8.with(DocSkeletonManagerService).getSkeleton();
11943
12081
  }
11944
12082
  _getEditorViewModel(editorId) {
11945
- var _this$_renderManagerS7;
11946
- return (_this$_renderManagerS7 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS7 === void 0 ? void 0 : _this$_renderManagerS7.with(DocSkeletonManagerService).getViewModel();
12083
+ var _this$_renderManagerS9;
12084
+ return (_this$_renderManagerS9 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS9 === void 0 ? void 0 : _this$_renderManagerS9.with(DocSkeletonManagerService).getViewModel();
11947
12085
  }
11948
12086
  _getEditingUnit() {
11949
12087
  return this._editingUnit ? this._univerInstanceService.getUnit(this._editingUnit, UniverInstanceType.UNIVER_SHEET) : null;
@@ -13914,14 +14052,15 @@ let HoverManagerService = class HoverManagerService extends Disposable {
13914
14052
  location: getLocationBase(activeCell.location)
13915
14053
  });
13916
14054
  }
13917
- triggerDbClick(unitId, offsetX, offsetY) {
14055
+ triggerDbClick(unitId, event) {
13918
14056
  const deps = this._getCalcDeps(unitId);
13919
14057
  if (!deps) return;
13920
14058
  const { currentRender, workbook, worksheet, skeletonParam } = deps;
13921
- const activeCell = this._calcActiveCell(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY);
14059
+ const activeCell = this._calcActiveCell(currentRender, workbook, worksheet, skeletonParam, event.offsetX, event.offsetY);
13922
14060
  if (activeCell) this._currentDbClickedCell$.next({
13923
14061
  ...activeCell,
13924
- location: getLocationBase(activeCell.location)
14062
+ location: getLocationBase(activeCell.location),
14063
+ event
13925
14064
  });
13926
14065
  }
13927
14066
  triggerScroll() {
@@ -13991,7 +14130,7 @@ let HoverRenderController = class HoverRenderController extends Disposable {
13991
14130
  if (!skeletonParam) return;
13992
14131
  const { mainComponent, unitId, components } = this._context;
13993
14132
  if (!mainComponent) return;
13994
- disposeSet.add(mainComponent.onPointerEnter$.subscribeEvent((evt) => {
14133
+ disposeSet.add(mainComponent.onPointerEnter$.subscribeEvent(() => {
13995
14134
  this._active = true;
13996
14135
  }));
13997
14136
  disposeSet.add(fromEventSubject(mainComponent.onPointerMove$).subscribe((evt) => {
@@ -14008,7 +14147,7 @@ let HoverRenderController = class HoverRenderController extends Disposable {
14008
14147
  this._hoverManagerService.triggerClick(unitId, evt.offsetX, evt.offsetY);
14009
14148
  }));
14010
14149
  disposeSet.add(mainComponent.onDblclick$.subscribeEvent((evt) => {
14011
- this._hoverManagerService.triggerDbClick(unitId, evt.offsetX, evt.offsetY);
14150
+ this._hoverManagerService.triggerDbClick(unitId, evt);
14012
14151
  }));
14013
14152
  disposeSet.add(mainComponent.onPointerLeave$.subscribeEvent(() => {
14014
14153
  this._active = false;
@@ -14582,6 +14721,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
14582
14721
  if (row === -1 || row === 0) isTopView = false;
14583
14722
  if (column === -1 || column === 0) isLeftView = false;
14584
14723
  const startSheetView = skeleton.getNoMergeCellWithCoordByIndex(row - ySplit, column - xSplit, false);
14724
+ if (isTopView && row === ySplit) startSheetView.startY = 0;
14585
14725
  const endSheetView = skeleton.getNoMergeCellWithCoordByIndex(row, column, false);
14586
14726
  viewMainLeftTop.disable();
14587
14727
  viewMainTop.disable();
@@ -14814,6 +14954,10 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
14814
14954
  * When switching sheet tabs, it is necessary to update the frozen state of the current view.
14815
14955
  */
14816
14956
  _skeletonListener() {
14957
+ this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.pipe(switchMap((param) => {
14958
+ var _param$skeleton;
14959
+ return (param === null || param === void 0 || (_param$skeleton = param.skeleton) === null || _param$skeleton === void 0 ? void 0 : _param$skeleton.gapConfigChanged$) ?? EMPTY;
14960
+ })).subscribe(() => this._refreshCurrent()));
14817
14961
  this.disposeWithMe(toDisposable(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((param) => {
14818
14962
  if ([
14819
14963
  SetWorksheetActiveOperation.id,
@@ -17201,6 +17345,10 @@ const MoveRangeConfirmCommand = {
17201
17345
  id: "sheet.command.move-range-confirm",
17202
17346
  handler: async (accessor, params) => {
17203
17347
  if (!params) return false;
17348
+ if (!await accessor.get(SheetInterceptorService).beforeCommandExecute({
17349
+ id: MoveRangeCommand.id,
17350
+ params
17351
+ })) return false;
17204
17352
  const commandService = accessor.get(ICommandService);
17205
17353
  const univerInstanceService = accessor.get(IUniverInstanceService);
17206
17354
  const sourceTarget = getSheetCommandTarget(univerInstanceService, {
@@ -17345,51 +17493,51 @@ const BORDER_LINE_CHILDREN = [
17345
17493
  ];
17346
17494
  const BORDER_SIZE_CHILDREN = [
17347
17495
  {
17348
- label: BorderStyleTypes.THIN,
17496
+ label: "sheets-ui.borderStyle.thin",
17349
17497
  value: BorderStyleTypes.THIN
17350
17498
  },
17351
17499
  {
17352
- label: BorderStyleTypes.HAIR,
17500
+ label: "sheets-ui.borderStyle.hair",
17353
17501
  value: BorderStyleTypes.HAIR
17354
17502
  },
17355
17503
  {
17356
- label: BorderStyleTypes.DOTTED,
17504
+ label: "sheets-ui.borderStyle.dotted",
17357
17505
  value: BorderStyleTypes.DOTTED
17358
17506
  },
17359
17507
  {
17360
- label: BorderStyleTypes.DASHED,
17508
+ label: "sheets-ui.borderStyle.dashed",
17361
17509
  value: BorderStyleTypes.DASHED
17362
17510
  },
17363
17511
  {
17364
- label: BorderStyleTypes.DASH_DOT,
17512
+ label: "sheets-ui.borderStyle.dashDot",
17365
17513
  value: BorderStyleTypes.DASH_DOT
17366
17514
  },
17367
17515
  {
17368
- label: BorderStyleTypes.DASH_DOT_DOT,
17516
+ label: "sheets-ui.borderStyle.dashDotDot",
17369
17517
  value: BorderStyleTypes.DASH_DOT_DOT
17370
17518
  },
17371
17519
  {
17372
- label: BorderStyleTypes.MEDIUM,
17520
+ label: "sheets-ui.borderStyle.medium",
17373
17521
  value: BorderStyleTypes.MEDIUM
17374
17522
  },
17375
17523
  {
17376
- label: BorderStyleTypes.MEDIUM_DASHED,
17524
+ label: "sheets-ui.borderStyle.mediumDashed",
17377
17525
  value: BorderStyleTypes.MEDIUM_DASHED
17378
17526
  },
17379
17527
  {
17380
- label: BorderStyleTypes.MEDIUM_DASH_DOT,
17528
+ label: "sheets-ui.borderStyle.mediumDashDot",
17381
17529
  value: BorderStyleTypes.MEDIUM_DASH_DOT
17382
17530
  },
17383
17531
  {
17384
- label: BorderStyleTypes.MEDIUM_DASH_DOT_DOT,
17532
+ label: "sheets-ui.borderStyle.mediumDashDotDot",
17385
17533
  value: BorderStyleTypes.MEDIUM_DASH_DOT_DOT
17386
17534
  },
17387
17535
  {
17388
- label: BorderStyleTypes.THICK,
17536
+ label: "sheets-ui.borderStyle.thick",
17389
17537
  value: BorderStyleTypes.THICK
17390
17538
  },
17391
17539
  {
17392
- label: BorderStyleTypes.DOUBLE,
17540
+ label: "sheets-ui.borderStyle.double",
17393
17541
  value: BorderStyleTypes.DOUBLE
17394
17542
  }
17395
17543
  ];
@@ -19197,7 +19345,7 @@ function WrapTextMenuItemFactory(accessor) {
19197
19345
  const disposable = accessor.get(ICommandService).onCommandExecuted((c) => {
19198
19346
  var _selectionManagerServ14;
19199
19347
  const id = c.id;
19200
- if (id !== SetTextWrapCommand.id && id !== SetSelectionsOperation.id && id !== SetWorksheetActiveOperation.id) return;
19348
+ if (id !== SetRangeValuesMutation.id && id !== SetSelectionsOperation.id && id !== SetWorksheetActiveOperation.id) return;
19201
19349
  const primary = (_selectionManagerServ14 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ14 === void 0 ? void 0 : _selectionManagerServ14.primary;
19202
19350
  let tb;
19203
19351
  if (primary != null) {
@@ -19229,33 +19377,34 @@ function ShrinkToFitMenuItemFactory(accessor) {
19229
19377
  const commandService = accessor.get(ICommandService);
19230
19378
  const univerInstanceService = accessor.get(IUniverInstanceService);
19231
19379
  const selectionManagerService = accessor.get(SheetsSelectionsService);
19380
+ const style$ = deriveStateFromActiveSheet$(univerInstanceService, {}, ({ worksheet }) => new Observable((subscriber) => {
19381
+ const update = () => {
19382
+ var _selectionManagerServ16;
19383
+ const primary = (_selectionManagerServ16 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ16 === void 0 ? void 0 : _selectionManagerServ16.primary;
19384
+ subscriber.next(primary != null ? worksheet.getComposedCellStyle(primary.startRow, primary.startColumn) ?? {} : {});
19385
+ };
19386
+ const disposable = commandService.onCommandExecuted((command) => {
19387
+ if ([
19388
+ SetRangeValuesMutation.id,
19389
+ SetSelectionsOperation.id,
19390
+ SetWorksheetActiveOperation.id
19391
+ ].includes(command.id)) update();
19392
+ });
19393
+ update();
19394
+ return disposable.dispose;
19395
+ }));
19232
19396
  return {
19233
19397
  id: SetShrinkToFitCommand.id,
19234
19398
  type: MenuItemType.BUTTON,
19235
19399
  icon: "ShrinkToFitIcon",
19236
19400
  title: "sheets-ui.toolbar.shrinkToFit",
19237
19401
  tooltip: "sheets-ui.toolbar.shrinkToFit",
19238
- activated$: deriveStateFromActiveSheet$(univerInstanceService, false, ({ worksheet }) => new Observable((subscriber) => {
19239
- const update = () => {
19240
- var _selectionManagerServ16, _worksheet$getCompose;
19241
- const primary = (_selectionManagerServ16 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ16 === void 0 ? void 0 : _selectionManagerServ16.primary;
19242
- subscriber.next(primary != null && ((_worksheet$getCompose = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn)) === null || _worksheet$getCompose === void 0 ? void 0 : _worksheet$getCompose.stf) === BooleanNumber.TRUE);
19243
- };
19244
- const disposable = commandService.onCommandExecuted((command) => {
19245
- if ([
19246
- SetRangeValuesMutation.id,
19247
- SetSelectionsOperation.id,
19248
- SetWorksheetActiveOperation.id
19249
- ].includes(command.id)) update();
19250
- });
19251
- update();
19252
- return disposable.dispose;
19253
- })),
19254
- disabled$: getCurrentRangeDisable$(accessor, {
19402
+ activated$: style$.pipe(map((style) => style.stf === BooleanNumber.TRUE && style.tb !== WrapStrategy.WRAP)),
19403
+ disabled$: combineLatest([getCurrentRangeDisable$(accessor, {
19255
19404
  workbookTypes: [WorkbookEditablePermission],
19256
19405
  worksheetTypes: [WorksheetEditPermission, WorksheetSetCellStylePermission],
19257
19406
  rangeTypes: [RangeProtectionPermissionEditPoint]
19258
- }),
19407
+ }), style$]).pipe(map(([disabled, style]) => disabled || style.tb === WrapStrategy.WRAP)),
19259
19408
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
19260
19409
  };
19261
19410
  }
@@ -19418,6 +19567,7 @@ function PasteRibbonMenuItemFactory(accessor) {
19418
19567
  return {
19419
19568
  ...PasteSpacialMenuItemFactory(accessor),
19420
19569
  id: PASTE_RIBBON_MENU_ID,
19570
+ icon: "DocPasteOptionsIcon",
19421
19571
  title: "sheets-ui.rightClick.paste",
19422
19572
  hidden$: combineLatest([getObservableWithExclusiveRange$(accessor, getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)), accessor.get(IContextService).subscribeContextValue$(FOCUSING_SHAPE_TEXT_EDITOR).pipe(startWith(false))]).pipe(map(([hidden, editing]) => hidden || editing))
19423
19573
  };
@@ -19690,6 +19840,9 @@ function SetColWidthMenuItemFactory(accessor) {
19690
19840
  //#endregion
19691
19841
  //#region src/menu/merge.menu.ts
19692
19842
  function CellMergeMenuItemFactory(accessor) {
19843
+ const commandService = accessor.get(ICommandService);
19844
+ const instanceService = accessor.get(IUniverInstanceService);
19845
+ const selectionService = accessor.get(SheetsSelectionsService);
19693
19846
  const editDisabled$ = getObservableWithExclusiveRange$(accessor, getCurrentRangeDisable$(accessor, {
19694
19847
  workbookTypes: [WorkbookEditablePermission],
19695
19848
  worksheetTypes: [
@@ -19705,6 +19858,22 @@ function CellMergeMenuItemFactory(accessor) {
19705
19858
  icon: "MergeAllIcon",
19706
19859
  tooltip: "sheets-ui.toolbar.mergeCell.main",
19707
19860
  type: MenuItemType.SUBITEMS,
19861
+ activated$: deriveStateFromActiveSheet$(instanceService, false, ({ worksheet }) => new Observable((subscriber) => {
19862
+ const update = () => {
19863
+ var _selectionService$get;
19864
+ const primary = (_selectionService$get = selectionService.getCurrentLastSelection()) === null || _selectionService$get === void 0 ? void 0 : _selectionService$get.primary;
19865
+ subscriber.next(!!primary && !!worksheet.getMergedCell(primary.actualRow, primary.actualColumn));
19866
+ };
19867
+ const selectionSubscription = selectionService.selectionChanged$.subscribe(update);
19868
+ const commandDisposable = commandService.onCommandExecuted((command) => {
19869
+ if (command.id === AddWorksheetMergeMutation.id || command.id === RemoveWorksheetMergeMutation.id) update();
19870
+ });
19871
+ update();
19872
+ return () => {
19873
+ selectionSubscription.unsubscribe();
19874
+ commandDisposable.dispose();
19875
+ };
19876
+ })).pipe(distinctUntilChanged()),
19708
19877
  hidden$: combineLatest([getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET), accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false))]).pipe(map(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
19709
19878
  disabled$: editDisabled$.pipe(combineLatestWith(selectionsHasCross$), map(([disable, hasCross]) => disable || hasCross))
19710
19879
  };
@@ -20288,18 +20457,6 @@ function Text2NumberContextMenuItemFactory(accessor) {
20288
20457
  };
20289
20458
  }
20290
20459
 
20291
- //#endregion
20292
- //#region src/views/sheet-slider/SheetZoomInput.tsx
20293
- const SHEET_ZOOM_INPUT_COMPONENT = "SHEET_ZOOM_INPUT_COMPONENT";
20294
- function SheetZoomInput({ className, ...props }) {
20295
- const commandService = useDependency(ICommandService);
20296
- return /* @__PURE__ */ jsx(ZoomInput, {
20297
- ...props,
20298
- className: clsx("!univer-bg-transparent dark:!univer-bg-transparent", className),
20299
- onChange: (value) => commandService.executeCommand(SetZoomRatioFromToolbarCommand.id, { value })
20300
- });
20301
- }
20302
-
20303
20460
  //#endregion
20304
20461
  //#region src/menu/zoom.menu.ts
20305
20462
  const ZOOM_RATIO_MENU_ID = "sheet.menu.zoom-ratio";
@@ -20328,16 +20485,14 @@ function getZoomRatioValue$(accessor) {
20328
20485
  function ZoomRatioMenuItemFactory(accessor) {
20329
20486
  return {
20330
20487
  id: ZOOM_RATIO_MENU_ID,
20331
- commandId: SetZoomRatioFromToolbarCommand.id,
20332
- type: MenuItemType.BUTTON,
20333
- label: {
20334
- name: SHEET_ZOOM_INPUT_COMPONENT,
20335
- props: {
20336
- min: SHEET_ZOOM_RANGE[0],
20337
- max: SHEET_ZOOM_RANGE[1],
20338
- shortcuts: ZOOM_RATIO_LIST
20339
- }
20340
- },
20488
+ selectionsCommandId: SetZoomRatioFromToolbarCommand.id,
20489
+ type: MenuItemType.SELECTOR,
20490
+ icon: "ZoomInIcon",
20491
+ tooltip: "sheets-ui.toolbar.zoom",
20492
+ selections: ZOOM_RATIO_LIST.map((value) => ({
20493
+ value,
20494
+ label: `${value}%`
20495
+ })),
20341
20496
  value$: getZoomRatioValue$(accessor),
20342
20497
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
20343
20498
  };
@@ -20574,31 +20729,29 @@ const menuSchema = {
20574
20729
  order: 1,
20575
20730
  gridLayout: {
20576
20731
  row: 1,
20577
- column: 2,
20578
- width: 112
20732
+ column: 2
20579
20733
  },
20580
20734
  menuItemFactory: ZoomRatioMenuItemFactory
20735
+ }
20736
+ },
20737
+ [RibbonViewGroup.VISIBILITY]: {
20738
+ [ToggleGridlinesCommand.id]: {
20739
+ order: 0,
20740
+ gridLayout: {
20741
+ row: 1,
20742
+ column: 1
20743
+ },
20744
+ menuItemFactory: ToggleGridlinesMenuFactory
20581
20745
  },
20582
20746
  [ToggleFullscreenOperation.id]: {
20583
- order: 2,
20747
+ order: 1,
20584
20748
  gridLayout: {
20585
20749
  row: 2,
20586
- column: 2,
20587
- showLabel: true,
20588
- width: 112
20750
+ column: 1
20589
20751
  },
20590
20752
  menuItemFactory: FullscreenMenuItemFactory
20591
20753
  }
20592
- },
20593
- [RibbonViewGroup.VISIBILITY]: { [ToggleGridlinesCommand.id]: {
20594
- order: 0,
20595
- gridLayout: {
20596
- row: 1,
20597
- column: 1,
20598
- showLabel: true
20599
- },
20600
- menuItemFactory: ToggleGridlinesMenuFactory
20601
- } }
20754
+ }
20602
20755
  },
20603
20756
  [ContextMenuPosition.MAIN_AREA]: {
20604
20757
  [ContextMenuGroup.QUICK]: {
@@ -21106,14 +21259,12 @@ function useWorkbooks() {
21106
21259
 
21107
21260
  //#endregion
21108
21261
  //#region src/views/editor-container/focus-editor.ts
21109
- const SHEET_CELL_EDITOR_ELEMENT_ID = `__editor_${DOCS_NORMAL_EDITOR_UNIT_ID_KEY}`;
21110
- const SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID = `univer-doc-selection-container-${DOCS_NORMAL_EDITOR_UNIT_ID_KEY}`;
21111
- function focusSheetCellEditorElement(ownerDocument = document) {
21112
- const element = ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
21113
- if (element == null || ownerDocument.activeElement === element) return false;
21114
- if (!element.hasAttribute("tabindex")) element.tabIndex = -1;
21115
- element.focus({ preventScroll: true });
21116
- return ownerDocument.activeElement === element;
21262
+ function focusSheetCellEditorElement(editorService) {
21263
+ var _editorService$getEdi;
21264
+ const selection = (_editorService$getEdi = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _editorService$getEdi === void 0 ? void 0 : _editorService$getEdi.docSelectionRenderService;
21265
+ if (!selection || selection.isFocusing) return false;
21266
+ selection.focus();
21267
+ return selection.isFocusing;
21117
21268
  }
21118
21269
  function registerSheetCellEditorRuntimePortal(options) {
21119
21270
  const ownerDocument = options.ownerDocument ?? (typeof document === "undefined" ? void 0 : document);
@@ -21126,8 +21277,10 @@ function registerSheetCellEditorRuntimePortal(options) {
21126
21277
  const frameHandles = [];
21127
21278
  let observer;
21128
21279
  const tryRegister = () => {
21280
+ var _options$editorServic;
21129
21281
  if (disposed) return;
21130
- const portalRoot = resolveSheetCellEditorPortalRoot(ownerDocument);
21282
+ const selection = (_options$editorServic = options.editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _options$editorServic === void 0 ? void 0 : _options$editorServic.docSelectionRenderService;
21283
+ const portalRoot = (selection === null || selection === void 0 ? void 0 : selection.selectionContainer.isConnected) ? selection.selectionContainer : null;
21131
21284
  if (portalRoot === registeredPortalRoot) return;
21132
21285
  portalRegistration === null || portalRegistration === void 0 || portalRegistration.dispose();
21133
21286
  portalRegistration = void 0;
@@ -21142,7 +21295,7 @@ function registerSheetCellEditorRuntimePortal(options) {
21142
21295
  role: "child-editor",
21143
21296
  element: portalRoot
21144
21297
  }));
21145
- const editorElement = ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
21298
+ const editorElement = selection === null || selection === void 0 ? void 0 : selection.inputElement;
21146
21299
  if (editorElement && editorElement !== portalRoot) rootRegistration.add(options.focusCoordinator.registerElement({
21147
21300
  embedId: options.embedId,
21148
21301
  role: "child-editor",
@@ -21185,9 +21338,6 @@ function registerSheetCellEditorRuntimePortal(options) {
21185
21338
  }));
21186
21339
  return collection;
21187
21340
  }
21188
- function resolveSheetCellEditorPortalRoot(ownerDocument = document) {
21189
- return ownerDocument.getElementById(SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID) ?? ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
21190
- }
21191
21341
 
21192
21342
  //#endregion
21193
21343
  //#region src/views/editor-container/hooks.ts
@@ -21257,19 +21407,6 @@ const EDITOR_DEFAULT_POSITION = {
21257
21407
  };
21258
21408
  const CELL_EDITOR_DARK_SURFACE_THEME_COLOR = "gray.800";
21259
21409
  const CELL_EDITOR_LIGHT_SURFACE_THEME_COLOR = "gray.0";
21260
- /**
21261
- * @returns the host background color for the cell editor.
21262
- */
21263
- function getCellEditorHostBackgroundColor(editState, options = {}) {
21264
- var _options$getColorFrom;
21265
- const cellFill = editState === null || editState === void 0 ? void 0 : editState.documentLayoutObject.fill;
21266
- if (cellFill && !isTransparentColor(cellFill)) return cellFill;
21267
- return (_options$getColorFrom = options.getColorFromTheme) === null || _options$getColorFrom === void 0 ? void 0 : _options$getColorFrom.call(options, options.darkMode ? CELL_EDITOR_DARK_SURFACE_THEME_COLOR : CELL_EDITOR_LIGHT_SURFACE_THEME_COLOR);
21268
- }
21269
- function isTransparentColor(color) {
21270
- const normalizedColor = color.trim().toLowerCase().replace(/\s+/g, "");
21271
- return normalizedColor === "transparent" || normalizedColor === "rgba(0,0,0,0)";
21272
- }
21273
21410
  function shouldRefocusCellEditorAfterPointerDown(options) {
21274
21411
  const { root, target, activeElement, isEditorFocusing } = options;
21275
21412
  if (!root || !(target instanceof HTMLElement) || !(activeElement instanceof HTMLElement)) return true;
@@ -21334,10 +21471,13 @@ function EditorContainer({ hidden = false }) {
21334
21471
  const workbook = editState ? instanceService.getUnit(editState.unitId, UniverInstanceType.UNIVER_SHEET) ?? null : null;
21335
21472
  const activeSheet = useActiveWorksheet(workbook);
21336
21473
  const darkMode = useObservable(themeService.darkMode$, themeService.darkMode);
21474
+ const cellFill = editState === null || editState === void 0 ? void 0 : editState.documentLayoutObject.fill;
21475
+ const normalizedFill = cellFill === null || cellFill === void 0 ? void 0 : cellFill.trim().toLowerCase().replace(/\s+/g, "");
21476
+ const editorBackgroundColor = cellFill && normalizedFill !== "transparent" && normalizedFill !== "rgba(0,0,0,0)" ? cellFill : themeService.getColorFromTheme(darkMode ? CELL_EDITOR_DARK_SURFACE_THEME_COLOR : CELL_EDITOR_LIGHT_SURFACE_THEME_COLOR);
21337
21477
  const [showEditCellAddress, setShowEditCellAddress] = useState(false);
21338
21478
  const editSheetName = editState ? workbook === null || workbook === void 0 || (_workbook$getSheetByS = workbook.getSheetBySheetId(editState.sheetId)) === null || _workbook$getSheetByS === void 0 ? void 0 : _workbook$getSheetByS.getName() : null;
21339
21479
  const editCellAddress = editState ? `${activeSheet && editSheetName && activeSheet.getSheetId() !== editState.sheetId ? `'${quoteSheetName(editSheetName)}'!` : ""}${numberToABC(editState.column)}${editState.row + 1}` : null;
21340
- const editorBorderColor = genNormalSelectionStyle(themeService).stroke;
21480
+ const { stroke: editorBorderColor, strokeWidth: editorBorderWidth } = genNormalSelectionStyle(themeService);
21341
21481
  const focusCoordinator = injector.has(ISheetEmbedRuntimeFocusCoordinator) ? injector.get(ISheetEmbedRuntimeFocusCoordinator) : void 0;
21342
21482
  const resolveRuntimeFocusState = () => {
21343
21483
  var _instanceService$getF;
@@ -21426,21 +21566,18 @@ function EditorContainer({ hidden = false }) {
21426
21566
  const focusCellEditorElement = () => {
21427
21567
  const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
21428
21568
  if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
21429
- focusSheetCellEditorElement(ownerDocument);
21569
+ focusSheetCellEditorElement(editorService);
21430
21570
  if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
21431
21571
  delayedFocusTimer = ownerWindow.setTimeout(() => {
21432
21572
  delayedFocusTimer = void 0;
21433
21573
  if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
21434
- focusSheetCellEditorElement(ownerDocument);
21574
+ focusSheetCellEditorElement(editorService);
21435
21575
  }, 0);
21436
21576
  };
21437
21577
  const focusEditor = () => {
21438
21578
  if (contextService.getContextValue(FOCUSING_FX_BAR_EDITOR)) return;
21439
21579
  const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
21440
21580
  if (shouldPreserveEmbedControlFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
21441
- const editor = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
21442
- const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(DocSelectionRenderService);
21443
- if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
21444
21581
  focusCellEditorElement();
21445
21582
  };
21446
21583
  focusEditor();
@@ -21492,6 +21629,7 @@ function EditorContainer({ hidden = false }) {
21492
21629
  element: editorRoot
21493
21630
  }));
21494
21631
  collection.add(registerSheetCellEditorRuntimePortal({
21632
+ editorService,
21495
21633
  embedId: scope.embedId,
21496
21634
  ownerDocument: rootRef.current.ownerDocument,
21497
21635
  interactionBoundaryService,
@@ -21502,10 +21640,7 @@ function EditorContainer({ hidden = false }) {
21502
21640
  let pointerRetryFrame = 0;
21503
21641
  const focusEditor = () => {
21504
21642
  if (contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) || shouldPreserveEmbedControlFocus(scope.embedId, ownerDocument)) return;
21505
- const editor = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
21506
- const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(DocSelectionRenderService);
21507
- if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
21508
- focusSheetCellEditorElement(ownerDocument);
21643
+ focusSheetCellEditorElement(editorService);
21509
21644
  };
21510
21645
  const refocusEditorAfterRuntimePointer = (event) => {
21511
21646
  if (!focusCoordinator.isChildUnitRuntimeEvent(scope.childUnitId, event.target, event) || isEmbedRuntimeEditorOrPopup(event.target)) return;
@@ -21540,6 +21675,7 @@ function EditorContainer({ hidden = false }) {
21540
21675
  const ownerDocument = ((_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.ownerDocument) ?? document;
21541
21676
  const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
21542
21677
  const portalRegistration = registerSheetCellEditorRuntimePortal({
21678
+ editorService,
21543
21679
  embedId: activeSessionScope.embedId,
21544
21680
  ownerDocument,
21545
21681
  interactionBoundaryService,
@@ -21549,12 +21685,12 @@ function EditorContainer({ hidden = false }) {
21549
21685
  let delayedFocusTimer;
21550
21686
  const focusCellEditorElement = () => {
21551
21687
  if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
21552
- focusSheetCellEditorElement(ownerDocument);
21688
+ focusSheetCellEditorElement(editorService);
21553
21689
  if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
21554
21690
  delayedFocusTimer = ownerWindow.setTimeout(() => {
21555
21691
  delayedFocusTimer = void 0;
21556
21692
  if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
21557
- focusSheetCellEditorElement(ownerDocument);
21693
+ focusSheetCellEditorElement(editorService);
21558
21694
  }, 0);
21559
21695
  };
21560
21696
  const focusHiddenEditor = () => {
@@ -21602,9 +21738,9 @@ function EditorContainer({ hidden = false }) {
21602
21738
  visible === null || visible === void 0 ? void 0 : visible.visible
21603
21739
  ]);
21604
21740
  useEffect(() => {
21741
+ var _rootRef$current3;
21742
+ const ownerWindow = (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.ownerDocument.defaultView;
21605
21743
  return () => {
21606
- var _rootRef$current3;
21607
- const ownerWindow = (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.ownerDocument.defaultView;
21608
21744
  if (ownerWindow && pointerRefocusTimerRef.current != null) ownerWindow.clearTimeout(pointerRefocusTimerRef.current);
21609
21745
  };
21610
21746
  }, []);
@@ -21626,12 +21762,11 @@ function EditorContainer({ hidden = false }) {
21626
21762
  if (pointerRefocusTimerRef.current != null) ownerWindow.clearTimeout(pointerRefocusTimerRef.current);
21627
21763
  pointerRefocusTimerRef.current = ownerWindow.setTimeout(() => {
21628
21764
  pointerRefocusTimerRef.current = void 0;
21629
- if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
21630
- focusSheetCellEditorElement(ownerDocument);
21765
+ focusSheetCellEditorElement(editorService);
21631
21766
  }, 0);
21632
21767
  });
21633
21768
  const handleClickSideBar = useEvent(() => {
21634
- if (editorBridgeService.isVisible().visible) commandService.executeCommand(SetCellEditVisibleOperation.id, {
21769
+ if (editorBridgeService.isVisible().visible) return commandService.executeCommand(SetCellEditVisibleOperation.id, {
21635
21770
  visible: false,
21636
21771
  eventType: DeviceInputEventType.PointerUp,
21637
21772
  unitId: editState === null || editState === void 0 ? void 0 : editState.unitId
@@ -21640,7 +21775,7 @@ function EditorContainer({ hidden = false }) {
21640
21775
  useSidebarClick(handleClickSideBar);
21641
21776
  const keyCodeConfig = useKeyEventConfig(editState === null || editState === void 0 ? void 0 : editState.unitId);
21642
21777
  const onMoveInEditor = useEvent((keycode, metaKey) => {
21643
- commandService.executeCommand(SetCellEditVisibleArrowOperation.id, {
21778
+ return commandService.executeCommand(SetCellEditVisibleArrowOperation.id, {
21644
21779
  keycode,
21645
21780
  visible: false,
21646
21781
  eventType: DeviceInputEventType.Keyboard,
@@ -21660,41 +21795,51 @@ function EditorContainer({ hidden = false }) {
21660
21795
  height: state.height,
21661
21796
  opacity: hidden ? 0 : void 0,
21662
21797
  pointerEvents: hidden ? "none" : void 0,
21663
- backgroundColor: getCellEditorHostBackgroundColor(editState, {
21664
- darkMode,
21665
- getColorFromTheme: themeService.getColorFromTheme.bind(themeService)
21666
- })
21798
+ backgroundColor: editorBackgroundColor
21667
21799
  },
21668
- children: [(visible === null || visible === void 0 ? void 0 : visible.visible) && showEditCellAddress && editCellAddress && /* @__PURE__ */ jsx("div", {
21669
- "data-u-comp": "sheet-cell-editor-address",
21670
- className: "univer-pointer-events-none univer-absolute univer-left-0 univer-top-0 univer-z-10 univer-whitespace-nowrap univer-rounded-t univer-px-1.5 univer-text-xs univer-leading-5",
21671
- style: {
21672
- backgroundColor: editorBorderColor,
21673
- color: themeService.getColorFromTheme("gray.0"),
21674
- transform: "translateY(-100%)"
21675
- },
21676
- children: editCellAddress
21677
- }), FormulaEditor && /* @__PURE__ */ jsx(FormulaEditor, {
21678
- editorId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
21679
- className: "univer-relative univer-flex univer-size-full [&_canvas]:univer-absolute",
21680
- initValue: "",
21681
- onChange: () => {},
21682
- isFocus: !hidden && (visible === null || visible === void 0 ? void 0 : visible.visible),
21683
- unitId: editState === null || editState === void 0 ? void 0 : editState.unitId,
21684
- subUnitId: editState === null || editState === void 0 ? void 0 : editState.sheetId,
21685
- keyboardEventConfig: keyCodeConfig,
21686
- onMoveInEditor,
21687
- isSupportAcrossSheet: true,
21688
- resetSelectionOnBlur: false,
21689
- isSingle: false,
21690
- autoScrollbar: false,
21691
- onFormulaSelectingChange: (isSelecting) => {
21692
- if (isSelecting) editorBridgeService.enableForceKeepVisible();
21693
- else editorBridgeService.disableForceKeepVisible();
21694
- },
21695
- disableContextMenu: false,
21696
- canvasStyle: { backgroundColor: "transparent" }
21697
- })]
21800
+ children: [
21801
+ (visible === null || visible === void 0 ? void 0 : visible.visible) && showEditCellAddress && editCellAddress && /* @__PURE__ */ jsx("div", {
21802
+ "data-u-comp": "sheet-cell-editor-address",
21803
+ className: "univer-pointer-events-none univer-absolute univer-left-0 univer-top-0 univer-z-10 univer-whitespace-nowrap univer-rounded-t univer-px-1.5 univer-text-xs univer-leading-5",
21804
+ style: {
21805
+ backgroundColor: editorBorderColor,
21806
+ color: themeService.getColorFromTheme("gray.0"),
21807
+ transform: "translateY(-100%)"
21808
+ },
21809
+ children: editCellAddress
21810
+ }),
21811
+ FormulaEditor && /* @__PURE__ */ jsx(FormulaEditor, {
21812
+ editorId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
21813
+ className: "univer-relative univer-flex univer-size-full [&_canvas]:univer-absolute",
21814
+ initValue: "",
21815
+ onChange: () => {},
21816
+ isFocus: !hidden && (visible === null || visible === void 0 ? void 0 : visible.visible),
21817
+ unitId: editState === null || editState === void 0 ? void 0 : editState.unitId,
21818
+ subUnitId: editState === null || editState === void 0 ? void 0 : editState.sheetId,
21819
+ keyboardEventConfig: keyCodeConfig,
21820
+ onMoveInEditor,
21821
+ isSupportAcrossSheet: true,
21822
+ resetSelectionOnBlur: false,
21823
+ isSingle: false,
21824
+ autoScrollbar: false,
21825
+ borderless: true,
21826
+ onFormulaSelectingChange: (isSelecting) => {
21827
+ if (isSelecting) editorBridgeService.enableForceKeepVisible();
21828
+ else editorBridgeService.disableForceKeepVisible();
21829
+ },
21830
+ disableContextMenu: false,
21831
+ canvasStyle: { backgroundColor: "transparent" }
21832
+ }),
21833
+ (visible === null || visible === void 0 ? void 0 : visible.visible) && /* @__PURE__ */ jsx("div", {
21834
+ "aria-hidden": true,
21835
+ className: "univer-pointer-events-none univer-absolute univer-left-0 univer-top-0 univer-z-10 univer-box-border",
21836
+ style: {
21837
+ width: state.width + editorBorderWidth,
21838
+ height: state.height + editorBorderWidth,
21839
+ border: `${editorBorderWidth}px solid ${editorBorderColor}`
21840
+ }
21841
+ })
21842
+ ]
21698
21843
  });
21699
21844
  }
21700
21845
 
@@ -21739,7 +21884,7 @@ function getAbsoluteRefStringFromSelection(workbook, selections, lexerTreeBuilde
21739
21884
 
21740
21885
  //#endregion
21741
21886
  //#region src/views/defined-name/DefinedNameOverlay.tsx
21742
- function DefinedNameOverlay({ search, isInputEvent }) {
21887
+ function DefinedNameOverlay({ search, isInputEvent, onClose }) {
21743
21888
  const commandService = useDependency(ICommandService);
21744
21889
  const localeService = useDependency(LocaleService);
21745
21890
  const definedNamesService = useDependency(IDefinedNamesService);
@@ -21783,8 +21928,9 @@ function DefinedNameOverlay({ search, isInputEvent }) {
21783
21928
  itemHeight: 30,
21784
21929
  overscan: 6
21785
21930
  });
21786
- const openSlider = () => {
21787
- commandService.executeCommand(SidebarDefinedNameOperation.id, { value: "open" });
21931
+ const openSlider = async () => {
21932
+ onClose();
21933
+ await commandService.executeCommand(SidebarDefinedNameOperation.id, { value: "open" });
21788
21934
  };
21789
21935
  const focusDefinedName = async (definedName) => {
21790
21936
  const { formulaOrRefString, id } = definedName;
@@ -21809,8 +21955,9 @@ function DefinedNameOverlay({ search, isInputEvent }) {
21809
21955
  children: virtualDefinedNames.map(({ data: definedName, index }) => {
21810
21956
  return /* @__PURE__ */ jsx("li", {
21811
21957
  className: "univer-cursor-pointer univer-px-2 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-600",
21812
- onClick: () => {
21813
- focusDefinedName(definedName);
21958
+ onClick: async () => {
21959
+ onClose();
21960
+ await focusDefinedName(definedName);
21814
21961
  },
21815
21962
  children: /* @__PURE__ */ jsxs("div", {
21816
21963
  "data-u-comp": "defined-name-overlay-row",
@@ -21864,6 +22011,7 @@ function DefinedName({ disable }) {
21864
22011
  const themeService = useDependency(ThemeService);
21865
22012
  const [open, setOpen] = useState(false);
21866
22013
  const [isInputEvent, setIsInputEvent] = useState(false);
22014
+ const nameBoxRef = useRef(null);
21867
22015
  const inputRef = useRef(null);
21868
22016
  const getDefinedNameMap = () => {
21869
22017
  const definedNameMap = definedNamesService.getDefinedNameMap(unitId);
@@ -22016,26 +22164,34 @@ function DefinedName({ disable }) {
22016
22164
  return selections;
22017
22165
  }
22018
22166
  return /* @__PURE__ */ jsxs("div", {
22167
+ ref: nameBoxRef,
22019
22168
  "data-u-comp": "defined-name",
22169
+ onMouseDown: (e) => {
22170
+ if (disable) e.preventDefault();
22171
+ },
22020
22172
  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",
22021
22173
  children: [/* @__PURE__ */ jsx("input", {
22022
22174
  ref: inputRef,
22023
22175
  className: clsx("univer-box-border univer-size-full univer-appearance-none univer-bg-transparent univer-pl-1.5 univer-pr-5 univer-text-gray-900 focus:univer-outline-none dark:!univer-border-r-gray-700 dark:!univer-text-gray-0", borderRightClassName, { "univer-cursor-not-allowed": disable }),
22024
22176
  type: "text",
22177
+ disabled: disable,
22025
22178
  value: inputValue,
22026
22179
  onChange: handleChangeSelection,
22027
22180
  onKeyDown: handleKeyDown,
22028
22181
  onBlur: () => setIsInputEvent(false)
22029
22182
  }), /* @__PURE__ */ jsx(Dropdown, {
22183
+ align: "start",
22184
+ anchorRef: nameBoxRef,
22030
22185
  overlay: /* @__PURE__ */ jsx("div", {
22031
22186
  className: "univer-z-[1001]",
22032
22187
  children: /* @__PURE__ */ jsx(DefinedNameOverlay, {
22033
22188
  search: inputValue,
22034
- isInputEvent
22189
+ isInputEvent,
22190
+ onClose: () => setOpen(false)
22035
22191
  })
22036
22192
  }),
22037
22193
  disabled: disable,
22038
- open,
22194
+ open: !disable && open,
22039
22195
  onOpenChange: setOpen,
22040
22196
  onOpenAutoFocus: (e) => e.preventDefault(),
22041
22197
  children: /* @__PURE__ */ jsx("a", {
@@ -22216,7 +22372,7 @@ function FormulaBar(props) {
22216
22372
  children: [
22217
22373
  /* @__PURE__ */ jsx("div", {
22218
22374
  className: "univer-relative univer-box-border univer-h-full univer-w-[100px]",
22219
- children: /* @__PURE__ */ jsx(DefinedName, { disable: disableDefinedName ?? editDisable })
22375
+ children: /* @__PURE__ */ jsx(DefinedName, { disable: iconActivated || (disableDefinedName ?? editDisable) })
22220
22376
  }),
22221
22377
  /* @__PURE__ */ jsxs("div", {
22222
22378
  className: "univer-flex univer-size-full",
@@ -23407,6 +23563,7 @@ function SheetBarTabs() {
23407
23563
  const slideTabBarContainerRef = useRef(null);
23408
23564
  const activeSheetIdRef = useRef(activeSheetId);
23409
23565
  const commandService = useDependency(ICommandService);
23566
+ const layoutService = useDependency(ILayoutService);
23410
23567
  const renderManagerService = useDependency(IRenderManagerService);
23411
23568
  const sheetBarService = useDependency(ISheetBarService);
23412
23569
  const localeService = useDependency(LocaleService);
@@ -23592,6 +23749,7 @@ function SheetBarTabs() {
23592
23749
  subUnitId,
23593
23750
  unitId: workbookRef.current.getUnitId()
23594
23751
  }).then((result) => {
23752
+ requestAnimationFrame(() => layoutService.focus(workbookRef.current.getUnitId()));
23595
23753
  if (result !== false) return;
23596
23754
  const worksheet = workbookRef.current.getSheetBySheetId(subUnitId);
23597
23755
  if (worksheet) {
@@ -23599,7 +23757,11 @@ function SheetBarTabs() {
23599
23757
  syncActiveSheetRender(subUnitId);
23600
23758
  }
23601
23759
  });
23602
- }, [commandService, syncActiveSheetRender]);
23760
+ }, [
23761
+ commandService,
23762
+ layoutService,
23763
+ syncActiveSheetRender
23764
+ ]);
23603
23765
  const observeResize = useCallback((slideTabBar) => {
23604
23766
  var _slideTabBarContainer;
23605
23767
  const slideTabBarContainer = (_slideTabBarContainer = slideTabBarContainerRef.current) === null || _slideTabBarContainer === void 0 ? void 0 : _slideTabBarContainer.querySelector("[data-u-comp=slide-tab-bar]");
@@ -24909,7 +25071,7 @@ const useHighlightRange = (ranges = []) => {
24909
25071
  //#endregion
24910
25072
  //#region package.json
24911
25073
  var name = "@univerjs/sheets-ui";
24912
- var version = "1.0.3";
25074
+ var version = "1.1.0";
24913
25075
 
24914
25076
  //#endregion
24915
25077
  //#region src/views/cell-popup/config.ts
@@ -25242,7 +25404,7 @@ function CellAlert({ popup, DropdownMenuComponent = DropdownMenu }) {
25242
25404
  const [isHovered, setIsHovered] = useState(false);
25243
25405
  const alert = (_popup$extraProps = popup.extraProps) === null || _popup$extraProps === void 0 ? void 0 : _popup$extraProps.alert;
25244
25406
  if (!alert) return null;
25245
- const { type, title, message, menu } = alert;
25407
+ const { type, title, message, menu, action, width } = alert;
25246
25408
  if (menu === null || menu === void 0 ? void 0 : menu.length) {
25247
25409
  const accessibleLabel = [title, message].filter((value) => typeof value === "string").join(": ");
25248
25410
  const showMore = visible || isHovered;
@@ -25282,14 +25444,24 @@ function CellAlert({ popup, DropdownMenuComponent = DropdownMenu }) {
25282
25444
  [1]: /* @__PURE__ */ jsx(WarningIcon, { className: "univer-text-yellow-500" })
25283
25445
  };
25284
25446
  return /* @__PURE__ */ jsxs("div", {
25285
- className: "univer-z-[100] univer-box-border univer-w-[156px] univer-rounded-lg univer-bg-gray-0 univer-px-2 univer-py-1 univer-text-gray-900 univer-shadow dark:!univer-bg-gray-1000 dark:!univer-text-gray-0",
25286
- children: [/* @__PURE__ */ jsxs("div", {
25287
- className: "univer-mb-1.5 univer-flex univer-h-5 univer-flex-row univer-items-center univer-gap-x-1.5 univer-text-sm univer-font-medium",
25288
- children: [type ? iconMap[type] : null, title]
25289
- }), /* @__PURE__ */ jsx("div", {
25290
- className: "univer-text-sm",
25291
- children: message
25292
- })]
25447
+ style: { width },
25448
+ className: "univer-z-[100] univer-box-border univer-rounded-lg univer-bg-gray-0 univer-px-2 univer-py-1 univer-text-gray-900 univer-shadow dark:!univer-bg-gray-1000 dark:!univer-text-gray-0",
25449
+ children: [
25450
+ /* @__PURE__ */ jsxs("div", {
25451
+ className: "univer-mb-1.5 univer-flex univer-h-5 univer-flex-row univer-items-center univer-gap-x-1.5 univer-text-sm univer-font-medium",
25452
+ children: [type ? iconMap[type] : null, title]
25453
+ }),
25454
+ /* @__PURE__ */ jsx("div", {
25455
+ className: "univer-text-sm",
25456
+ children: message
25457
+ }),
25458
+ action && /* @__PURE__ */ jsx(Button, {
25459
+ className: "univer-mt-2",
25460
+ disabled: action.disabled,
25461
+ onClick: action.onSelect,
25462
+ children: action.label
25463
+ })
25464
+ ]
25293
25465
  });
25294
25466
  }
25295
25467
 
@@ -25317,15 +25489,17 @@ let CellAlertManagerService = class CellAlertManagerService extends Disposable {
25317
25489
  _defineProperty(this, "_currentAlert", /* @__PURE__ */ new Map());
25318
25490
  _defineProperty(this, "currentAlert$", this._currentAlert$.asObservable());
25319
25491
  this.disposeWithMe(() => {
25492
+ this.clearAlert();
25320
25493
  this._currentAlert$.complete();
25321
25494
  });
25322
25495
  }
25323
25496
  showAlert(alert) {
25324
25497
  var _alert$menu, _alert$menu2, _alert$menu3;
25325
25498
  let lastPopup = this._currentAlert.get(alert.key);
25326
- if (lastPopup) lastPopup.dispose.dispose();
25327
- if (lastPopup) lastPopup.dispose.dispose();
25328
- else {
25499
+ if (lastPopup) {
25500
+ lastPopup.dispose.dispose();
25501
+ lastPopup.alert = alert;
25502
+ } else {
25329
25503
  lastPopup = {
25330
25504
  alert,
25331
25505
  dispose: { dispose() {} }
@@ -25348,13 +25522,7 @@ let CellAlertManagerService = class CellAlertManagerService extends Disposable {
25348
25522
  extraProps: { alert },
25349
25523
  priority: 1
25350
25524
  });
25351
- if (disposable) {
25352
- if (lastPopup) {
25353
- var _lastPopup$dispose;
25354
- (_lastPopup$dispose = lastPopup.dispose) === null || _lastPopup$dispose === void 0 || _lastPopup$dispose.dispose();
25355
- }
25356
- lastPopup.dispose = disposable;
25357
- }
25525
+ if (disposable) lastPopup.dispose = disposable;
25358
25526
  this._currentAlert$.next(Array.from(this._currentAlert.entries()));
25359
25527
  }
25360
25528
  removeAlert(key) {
@@ -26206,8 +26374,8 @@ function SelectList(props) {
26206
26374
  const filteredOptions = useMemo(() => {
26207
26375
  return options.filter((item) => lowerFilter ? item.label.toLowerCase().includes(lowerFilter) : true);
26208
26376
  }, [options, lowerFilter]);
26209
- const handleSearchChange = (e) => {
26210
- setLowerFilter(e.target.value.toLowerCase());
26377
+ const handleSearchChange = (value) => {
26378
+ setLowerFilter(value.toLowerCase());
26211
26379
  };
26212
26380
  const sheetPermissionCheckController = useDependency(SheetPermissionCheckController);
26213
26381
  const hasPermission = useMemo(() => sheetPermissionCheckController.permissionCheckWithRanges({
@@ -26233,9 +26401,8 @@ function SelectList(props) {
26233
26401
  children: [
26234
26402
  showSearchOnDropdown && /* @__PURE__ */ jsx("div", {
26235
26403
  className: "univer-box-border univer-flex univer-w-full univer-px-2",
26236
- children: /* @__PURE__ */ jsx("input", {
26404
+ children: /* @__PURE__ */ jsx(Input, {
26237
26405
  ref: searchRef,
26238
- className: clsx("univer-w-full univer-rounded-md univer-bg-gray-0 univer-px-2 univer-py-1 univer-text-sm univer-text-gray-900 focus:univer-border-primary-500 focus:univer-outline-none dark:!univer-bg-gray-1000 dark:!univer-text-gray-0", borderClassName),
26239
26406
  type: "text",
26240
26407
  value: lowerFilter,
26241
26408
  autoFocus: true,
@@ -26264,14 +26431,16 @@ function SelectList(props) {
26264
26431
  const index = item.label.toLocaleLowerCase().indexOf(lowerFilter);
26265
26432
  const isThemeColor = Boolean(((_item$color = item.color) === null || _item$color === void 0 ? void 0 : _item$color.includes(".")) && themeService.isValidThemeColor(item.color));
26266
26433
  const backgroundColor = isThemeColor ? themeService.getColorFromTheme(item.color) : item.color;
26267
- const isDark = new ColorKit(backgroundColor).isDark();
26434
+ const color = new ColorKit(backgroundColor);
26435
+ const hasBackground = Boolean(backgroundColor) && backgroundColor !== "transparent" && color.getAlpha() > 0;
26436
+ const isDark = color.isDark();
26268
26437
  return /* @__PURE__ */ jsxs("div", {
26269
26438
  className: "univer-flex univer-cursor-pointer univer-flex-row univer-items-center univer-justify-between univer-rounded-md univer-px-1.5 univer-py-1 hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-700",
26270
26439
  onClick: handleClick,
26271
26440
  children: [/* @__PURE__ */ jsx("div", {
26272
26441
  className: clsx("univer-inline-flex univer-h-4 univer-w-fit univer-items-center univer-truncate univer-rounded-full univer-px-1.5 univer-text-xs", {
26273
- "univer-text-gray-900": isThemeColor || !isDark,
26274
- "univer-text-gray-0": !isThemeColor && isDark
26442
+ "univer-text-gray-900": hasBackground && (isThemeColor || !isDark),
26443
+ "univer-text-gray-0": hasBackground && !isThemeColor && isDark
26275
26444
  }),
26276
26445
  style: { background: backgroundColor },
26277
26446
  children: lowerFilter && item.label.toLowerCase().includes(lowerFilter) ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -26487,6 +26656,66 @@ const BorderDashed = ({ className }) => /* @__PURE__ */ jsxs("svg", {
26487
26656
  ]
26488
26657
  });
26489
26658
 
26659
+ //#endregion
26660
+ //#region src/views/border-panel/border-line/icons/BorderDotted.tsx
26661
+ /**
26662
+ * Copyright 2023-present DreamNum Co., Ltd.
26663
+ *
26664
+ * Licensed under the Apache License, Version 2.0 (the "License");
26665
+ * you may not use this file except in compliance with the License.
26666
+ * You may obtain a copy of the License at
26667
+ *
26668
+ * http://www.apache.org/licenses/LICENSE-2.0
26669
+ *
26670
+ * Unless required by applicable law or agreed to in writing, software
26671
+ * distributed under the License is distributed on an "AS IS" BASIS,
26672
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26673
+ * See the License for the specific language governing permissions and
26674
+ * limitations under the License.
26675
+ */
26676
+ const BorderDotted = ({ className }) => /* @__PURE__ */ jsxs("svg", {
26677
+ className,
26678
+ width: "120",
26679
+ height: "2",
26680
+ viewBox: "0 0 120 2",
26681
+ fill: "none",
26682
+ xmlns: "http://www.w3.org/2000/svg",
26683
+ children: [
26684
+ /* @__PURE__ */ jsx("path", { d: "M0.491699 1.69537H1.4917V0.695374H0.491699V1.69537Z" }),
26685
+ /* @__PURE__ */ jsx("path", { d: "M4.2981 1.69537H5.2981V0.695374H4.2981V1.69537Z" }),
26686
+ /* @__PURE__ */ jsx("path", { d: "M9.10449 1.69537H8.10449V0.695374H9.10449V1.69537Z" }),
26687
+ /* @__PURE__ */ jsx("path", { d: "M11.9109 1.69537H12.9109V0.695374H11.9109V1.69537Z" }),
26688
+ /* @__PURE__ */ jsx("path", { d: "M16.7173 1.69537H15.7173V0.695374H16.7173V1.69537Z" }),
26689
+ /* @__PURE__ */ jsx("path", { d: "M19.5237 1.69537H20.5237V0.695374H19.5237V1.69537Z" }),
26690
+ /* @__PURE__ */ jsx("path", { d: "M24.3301 1.69537H23.3301V0.695374H24.3301V1.69537Z" }),
26691
+ /* @__PURE__ */ jsx("path", { d: "M27.1365 1.69537H28.1365V0.695374H27.1365V1.69537Z" }),
26692
+ /* @__PURE__ */ jsx("path", { d: "M31.9429 1.69537H30.9429V0.695374H31.9429V1.69537Z" }),
26693
+ /* @__PURE__ */ jsx("path", { d: "M34.7493 1.69537H35.7493V0.695374H34.7493V1.69537Z" }),
26694
+ /* @__PURE__ */ jsx("path", { d: "M39.5557 1.69537H38.5557V0.695374H39.5557V1.69537Z" }),
26695
+ /* @__PURE__ */ jsx("path", { d: "M42.3621 1.69537H43.3621V0.695374H42.3621V1.69537Z" }),
26696
+ /* @__PURE__ */ jsx("path", { d: "M47.1685 1.69537H46.1685V0.695374H47.1685V1.69537Z" }),
26697
+ /* @__PURE__ */ jsx("path", { d: "M49.9749 1.69537H50.9749V0.695374H49.9749V1.69537Z" }),
26698
+ /* @__PURE__ */ jsx("path", { d: "M54.7812 1.69537H53.7812V0.695374H54.7812V1.69537Z" }),
26699
+ /* @__PURE__ */ jsx("path", { d: "M57.5876 1.69537H58.5876V0.695374H57.5876V1.69537Z" }),
26700
+ /* @__PURE__ */ jsx("path", { d: "M62.394 1.69537H61.394V0.695374H62.394V1.69537Z" }),
26701
+ /* @__PURE__ */ jsx("path", { d: "M65.2004 1.69537H66.2004V0.695374H65.2004V1.69537Z" }),
26702
+ /* @__PURE__ */ jsx("path", { d: "M70.0068 1.69537H69.0068V0.695374H70.0068V1.69537Z" }),
26703
+ /* @__PURE__ */ jsx("path", { d: "M72.8132 1.69537H73.8132V0.695374H72.8132V1.69537Z" }),
26704
+ /* @__PURE__ */ jsx("path", { d: "M77.6196 1.69537H76.6196V0.695374H77.6196V1.69537Z" }),
26705
+ /* @__PURE__ */ jsx("path", { d: "M80.426 1.69537H81.426V0.695374H80.426V1.69537Z" }),
26706
+ /* @__PURE__ */ jsx("path", { d: "M85.2324 1.69537H84.2324V0.695374H85.2324V1.69537Z" }),
26707
+ /* @__PURE__ */ jsx("path", { d: "M88.0388 1.69537H89.0388V0.695374H88.0388V1.69537Z" }),
26708
+ /* @__PURE__ */ jsx("path", { d: "M92.8452 1.69537H91.8452V0.695374H92.8452V1.69537Z" }),
26709
+ /* @__PURE__ */ jsx("path", { d: "M95.6516 1.69537H96.6516V0.695374H95.6516V1.69537Z" }),
26710
+ /* @__PURE__ */ jsx("path", { d: "M100.458 1.69537H99.458V0.695374H100.458V1.69537Z" }),
26711
+ /* @__PURE__ */ jsx("path", { d: "M103.264 1.69537H104.264V0.695374H103.264V1.69537Z" }),
26712
+ /* @__PURE__ */ jsx("path", { d: "M108.071 1.69537H107.071V0.695374H108.071V1.69537Z" }),
26713
+ /* @__PURE__ */ jsx("path", { d: "M110.877 1.69537H111.877V0.695374H110.877V1.69537Z" }),
26714
+ /* @__PURE__ */ jsx("path", { d: "M115.684 1.69537H114.684V0.695374H115.684V1.69537Z" }),
26715
+ /* @__PURE__ */ jsx("path", { d: "M118.49 1.69537H119.49V0.695374H118.49V1.69537Z" })
26716
+ ]
26717
+ });
26718
+
26490
26719
  //#endregion
26491
26720
  //#region src/views/border-panel/border-line/icons/BorderDouble.tsx
26492
26721
  /**
@@ -26860,6 +27089,7 @@ function BorderLine(props) {
26860
27089
  case BorderStyleTypes.DASH_DOT: return /* @__PURE__ */ jsx(BorderDashDot, { className });
26861
27090
  case BorderStyleTypes.DASH_DOT_DOT: return /* @__PURE__ */ jsx(BorderDashDotDot, { className });
26862
27091
  case BorderStyleTypes.DASHED: return /* @__PURE__ */ jsx(BorderDashed, { className });
27092
+ case BorderStyleTypes.DOTTED: return /* @__PURE__ */ jsx(BorderDotted, { className });
26863
27093
  case BorderStyleTypes.HAIR: return /* @__PURE__ */ jsx(BorderHair, { className });
26864
27094
  case BorderStyleTypes.MEDIUM: return /* @__PURE__ */ jsx(BorderMedium, { className });
26865
27095
  case BorderStyleTypes.MEDIUM_DASH_DOT: return /* @__PURE__ */ jsx(BorderMediumDashDot, { className });
@@ -26874,31 +27104,22 @@ function BorderLine(props) {
26874
27104
 
26875
27105
  //#endregion
26876
27106
  //#region src/views/border-panel/BorderPanel.tsx
26877
- function getBorderColor(borderData) {
26878
- if (!borderData) return;
26879
- for (const key in borderData) {
26880
- var _border$cl;
26881
- const border = borderData[key];
26882
- if (border === null || border === void 0 || (_border$cl = border.cl) === null || _border$cl === void 0 ? void 0 : _border$cl.rgb) return border.cl.rgb;
26883
- }
26884
- }
26885
- function getBorderStyle(borderData) {
26886
- if (!borderData) return;
26887
- for (const key in borderData) {
26888
- var _border$cl2;
26889
- const border = borderData[key];
26890
- if (border === null || border === void 0 || (_border$cl2 = border.cl) === null || _border$cl2 === void 0 ? void 0 : _border$cl2.rgb) return border.s;
26891
- }
26892
- }
26893
27107
  function BorderPanel(props) {
27108
+ const localeService = useDependency(LocaleService);
26894
27109
  const iconManager = useDependency(IconManager);
26895
- const borderStyleManagerService = useDependency(BorderStyleManagerService);
26896
27110
  const selectionManagerService = useDependency(SheetsSelectionsService);
26897
27111
  const { direction } = useContext(ConfigContext);
26898
27112
  const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("bd");
26899
27113
  const color = isAllValuesSame ? getBorderColor(currentValue) : void 0;
26900
- const type = isAllValuesSame ? getBorderStyle(currentValue) : void 0;
26901
27114
  const { onChange, value, ColorPickerComponent = ColorPicker, DropdownComponent = Dropdown } = props;
27115
+ function getBorderColor(borderData) {
27116
+ if (!borderData) return;
27117
+ for (const key in borderData) {
27118
+ var _border$cl;
27119
+ const border = borderData[key];
27120
+ if (border === null || border === void 0 || (_border$cl = border.cl) === null || _border$cl === void 0 ? void 0 : _border$cl.rgb) return border.cl.rgb;
27121
+ }
27122
+ }
26902
27123
  function handleClick(v, type) {
26903
27124
  onChange === null || onChange === void 0 || onChange({
26904
27125
  ...value,
@@ -26916,7 +27137,7 @@ function BorderPanel(props) {
26916
27137
  /* @__PURE__ */ jsx("div", {
26917
27138
  className: "univer-box-border univer-grid univer-grid-cols-5 univer-gap-2 univer-text-gray-600 dark:!univer-text-gray-200",
26918
27139
  children: BORDER_LINE_CHILDREN.map((item) => /* @__PURE__ */ jsx("a", {
26919
- className: clsx("univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-justify-self-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-200 dark:!univer-bg-gray-600": borderStyleManagerService.getBorderInfo().type === item.value }),
27140
+ className: clsx("univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-justify-self-center univer-rounded hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-200 dark:!univer-bg-gray-600": value.type === item.value }),
26920
27141
  onClick: (e) => {
26921
27142
  e.stopPropagation();
26922
27143
  handleClick(item.value, "type");
@@ -26948,14 +27169,17 @@ function BorderPanel(props) {
26948
27169
  className: "univer-rounded-lg univer-p-1.5",
26949
27170
  children: /* @__PURE__ */ jsx("ul", {
26950
27171
  className: "univer-m-0 univer-grid univer-list-none univer-gap-1 univer-p-0",
26951
- children: BORDER_SIZE_CHILDREN.map((item) => /* @__PURE__ */ jsxs("li", {
26952
- className: "univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-px-1 univer-py-3 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
27172
+ children: BORDER_SIZE_CHILDREN.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("button", {
27173
+ type: "button",
27174
+ "aria-label": localeService.t(item.label),
27175
+ "aria-pressed": item.value === value.style,
27176
+ className: clsx("univer-flex univer-w-full univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-border-none univer-bg-transparent univer-px-1 univer-py-3 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", { "univer-bg-gray-200 dark:!univer-bg-gray-600": item.value === value.style }),
26953
27177
  onClick: () => handleClick(item.value, "style"),
26954
- children: [item.value === type && /* @__PURE__ */ jsx(CheckMarkIcon, { className: "univer-absolute univer-left-3 univer-text-primary-600" }), /* @__PURE__ */ jsx(BorderLine, {
26955
- className: "univer-ml-6 univer-fill-gray-900 dark:!univer-fill-gray-0",
27178
+ children: /* @__PURE__ */ jsx(BorderLine, {
27179
+ className: "univer-fill-gray-900 dark:!univer-fill-gray-0",
26956
27180
  type: item.value
26957
- })]
26958
- }, item.value))
27181
+ })
27182
+ }) }, item.value))
26959
27183
  })
26960
27184
  }),
26961
27185
  children: /* @__PURE__ */ jsxs("button", {
@@ -26963,7 +27187,7 @@ function BorderPanel(props) {
26963
27187
  type: "button",
26964
27188
  children: [/* @__PURE__ */ jsx(BorderLine, {
26965
27189
  className: "univer-fill-gray-900 dark:!univer-fill-gray-0",
26966
- type: type ?? BorderStyleTypes.THIN
27190
+ type: value.style
26967
27191
  }), /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-gray-0" })]
26968
27192
  })
26969
27193
  }) })]
@@ -27495,16 +27719,35 @@ function MobileMenuItemInput(props) {
27495
27719
  const { prefix, suffix, value, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, disabled$, onChange } = props;
27496
27720
  const localeService = useDependency(LocaleService);
27497
27721
  const disabled = useObservable(disabled$ ?? null, false);
27498
- const inputValue = Math.min(max, Math.max(min, Number(value)));
27722
+ const [draft, setDraft] = useState(null);
27723
+ const inputValue = draft !== null && draft.source === value ? draft.value : Math.min(max, Math.max(min, Number(value)));
27724
+ if (draft !== null && draft.source !== value) setDraft(null);
27499
27725
  function handleChange(nextValue) {
27500
- if (nextValue == null) return;
27726
+ setDraft({
27727
+ source: value,
27728
+ value: nextValue
27729
+ });
27730
+ }
27731
+ function handleConfirm() {
27732
+ if (disabled || inputValue == null || !Number.isFinite(inputValue)) return;
27733
+ const nextValue = Math.min(max, Math.max(min, inputValue));
27734
+ setDraft({
27735
+ source: value,
27736
+ value: nextValue
27737
+ });
27501
27738
  onChange(nextValue.toString());
27502
27739
  }
27503
27740
  function handleKeyDown(event) {
27741
+ if (event.key === "Escape" && !event.nativeEvent.isComposing) return;
27504
27742
  event.stopPropagation();
27743
+ if (event.key === "Enter" && !event.nativeEvent.isComposing) {
27744
+ event.preventDefault();
27745
+ handleConfirm();
27746
+ }
27505
27747
  }
27506
27748
  return /* @__PURE__ */ jsxs("div", {
27507
- className: "univer-flex univer-min-w-0 univer-flex-1 univer-items-center univer-gap-2",
27749
+ className: "univer-flex univer-min-w-0 univer-flex-1 univer-flex-wrap univer-items-center univer-gap-2",
27750
+ onClick: (event) => event.stopPropagation(),
27508
27751
  children: [
27509
27752
  /* @__PURE__ */ jsx("span", {
27510
27753
  className: "univer-shrink-0 univer-text-base univer-font-medium",
@@ -27512,13 +27755,11 @@ function MobileMenuItemInput(props) {
27512
27755
  }),
27513
27756
  /* @__PURE__ */ jsx("div", {
27514
27757
  className: "univer-w-20 univer-shrink-0",
27515
- onClick: (event) => event.stopPropagation(),
27516
27758
  children: /* @__PURE__ */ jsx(InputNumber, {
27517
27759
  value: inputValue,
27518
27760
  size: "small",
27519
27761
  precision: 0,
27520
- min,
27521
- max,
27762
+ allowEmpty: true,
27522
27763
  disabled,
27523
27764
  onKeyDown: handleKeyDown,
27524
27765
  onChange: handleChange
@@ -27527,6 +27768,15 @@ function MobileMenuItemInput(props) {
27527
27768
  /* @__PURE__ */ jsx("span", {
27528
27769
  className: "univer-min-w-0 univer-truncate univer-text-base univer-font-medium",
27529
27770
  children: localeService.t(suffix)
27771
+ }),
27772
+ /* @__PURE__ */ jsx(Button, {
27773
+ type: "button",
27774
+ variant: "primary",
27775
+ size: "large",
27776
+ className: "univer-shrink-0",
27777
+ disabled: disabled || inputValue == null || !Number.isFinite(inputValue),
27778
+ onClick: handleConfirm,
27779
+ children: localeService.t("sheets-ui.button.confirm")
27530
27780
  })
27531
27781
  ]
27532
27782
  });
@@ -28821,6 +29071,7 @@ const sheetsUIIcons = {
28821
29071
  DeleteColumnDoubleIcon,
28822
29072
  DeleteIcon,
28823
29073
  DeleteRowDoubleIcon,
29074
+ DocPasteOptionsIcon,
28824
29075
  DownBorderDoubleIcon,
28825
29076
  DownloadImageIcon,
28826
29077
  EyeIcon,
@@ -28878,7 +29129,8 @@ const sheetsUIIcons = {
28878
29129
  VerticalCenterIcon,
28879
29130
  VerticalIntegrationIcon,
28880
29131
  VerticalTextIcon,
28881
- WriteIcon
29132
+ WriteIcon,
29133
+ ZoomInIcon
28882
29134
  };
28883
29135
 
28884
29136
  //#endregion
@@ -28894,7 +29146,6 @@ let MobileComponentsController = class MobileComponentsController extends Dispos
28894
29146
  this.disposeWithMe(componentManager.register(CascaderDropdown.componentKey, CascaderDropdown));
28895
29147
  this.disposeWithMe(componentManager.register(MENU_ITEM_INPUT_COMPONENT, MobileMenuItemInput));
28896
29148
  this.disposeWithMe(componentManager.register(MENU_ITEM_FROZEN_COMPONENT, MenuItemFrozen));
28897
- this.disposeWithMe(componentManager.register(SHEET_ZOOM_INPUT_COMPONENT, SheetZoomInput));
28898
29149
  this.disposeWithMe(componentManager.register(BORDER_PANEL_COMPONENT, MobileBorderPanel));
28899
29150
  this.disposeWithMe(componentManager.register(DEFINED_NAME_CONTAINER, MobileDefinedNameContainer));
28900
29151
  this.disposeWithMe(componentManager.register(CELL_POPUP_COMPONENT_KEY, CellPopup));
@@ -28974,7 +29225,8 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
28974
29225
  let body = Tools.deepClone((_param$documentLayout = param.documentLayoutObject.documentModel) === null || _param$documentLayout === void 0 ? void 0 : _param$documentLayout.getBody());
28975
29226
  const drawings = Tools.deepClone((_param$documentLayout2 = param.documentLayoutObject.documentModel) === null || _param$documentLayout2 === void 0 ? void 0 : _param$documentLayout2.drawings);
28976
29227
  const drawingsOrder = Tools.deepClone((_param$documentLayout3 = param.documentLayoutObject.documentModel) === null || _param$documentLayout3 === void 0 ? void 0 : _param$documentLayout3.getDrawingsOrder());
28977
- if (!body || param.isInArrayFormulaRange === true && this._editorBridgeService.isVisible().eventType === DeviceInputEventType.Dblclick) body = {
29228
+ const { visible } = this._editorBridgeService.isVisible();
29229
+ if (!body || param.isInArrayFormulaRange === true && visible) body = {
28978
29230
  dataStream: "\r\n",
28979
29231
  paragraphs: [{
28980
29232
  startIndex: 0,
@@ -29112,7 +29364,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
29112
29364
  ...formulaEditorStyle,
29113
29365
  pageSize: { ...formulaEditorStyle.pageSize },
29114
29366
  renderConfig: { ...formulaEditorStyle.renderConfig },
29115
- textStyle: { cl: { rgb: this._themeService.getColorFromTheme("gray.900") } }
29367
+ textStyle: { cl: { rgb: this._getFormulaBarTextColor() } }
29116
29368
  };
29117
29369
  else snapshot.documentStyle ??= {};
29118
29370
  let renderConfig = snapshot.documentStyle.renderConfig;
@@ -29135,6 +29387,11 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
29135
29387
  const isFocusFxBar = this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR);
29136
29388
  renderConfig.isRenderStyle = isFormulaBar === isFocusFxBar ? BooleanNumber.TRUE : BooleanNumber.FALSE;
29137
29389
  }
29390
+ _getFormulaBarTextColor() {
29391
+ var _this$_editorBridgeSe;
29392
+ const isInheritedFormula = ((_this$_editorBridgeSe = this._editorBridgeService.getEditLocation()) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.isInArrayFormulaRange) === true && !this._editorBridgeService.isVisible().visible;
29393
+ return this._themeService.getColorFromTheme(isInheritedFormula ? "gray.300" : "gray.900");
29394
+ }
29138
29395
  _getSourceStyleRenderValue(isFormulaBar) {
29139
29396
  return isFormulaBar ? BooleanNumber.FALSE : BooleanNumber.TRUE;
29140
29397
  }
@@ -30552,6 +30809,7 @@ function MobileBorderColorView(props) {
30552
30809
  }
30553
30810
  function MobileBorderStyleView(props) {
30554
30811
  const { value, onExecute } = props;
30812
+ const localeService = useDependency(LocaleService);
30555
30813
  return /* @__PURE__ */ jsx("div", {
30556
30814
  className: "univer-overflow-hidden univer-rounded-xl univer-bg-gray-0 dark:!univer-bg-gray-800",
30557
30815
  children: BORDER_SIZE_CHILDREN.map((option, index) => /* @__PURE__ */ jsxs("button", {
@@ -30571,7 +30829,7 @@ function MobileBorderStyleView(props) {
30571
30829
  }),
30572
30830
  /* @__PURE__ */ jsx("span", {
30573
30831
  className: "univer-flex-1 univer-text-left univer-text-sm",
30574
- children: option.value
30832
+ children: localeService.t(option.label)
30575
30833
  }),
30576
30834
  value.style === option.value && /* @__PURE__ */ jsx(CheckMarkIcon, { className: "univer-text-primary-600 dark:!univer-text-primary-400" })
30577
30835
  ]
@@ -31116,7 +31374,11 @@ function MobileFormulaBar() {
31116
31374
  let cursorFrame;
31117
31375
  const contentFrame = requestAnimationFrame(() => {
31118
31376
  editorBridgeService.refreshEditCellState();
31119
- editorService.focus(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
31377
+ if (editorService.getFocusId() !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) editorService.focus(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
31378
+ else {
31379
+ var _editorService$getEdi;
31380
+ (_editorService$getEdi = editorService.getEditor(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)) === null || _editorService$getEdi === void 0 || _editorService$getEdi.focus();
31381
+ }
31120
31382
  cursorFrame = requestAnimationFrame(() => {
31121
31383
  var _editor$getDocumentDa;
31122
31384
  const editor = editorService.getEditor(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
@@ -31678,7 +31940,7 @@ const MobileFormulaBarSubmitCommand = {
31678
31940
  id: MOBILE_FORMULA_BAR_SUBMIT_COMMAND_ID,
31679
31941
  type: CommandType.COMMAND,
31680
31942
  async handler(accessor) {
31681
- var _accessor$get$getCurr, _workbook$getActiveSh, _formulaModel$getBody, _accessor$get$getEdit;
31943
+ var _accessor$get$getCurr, _workbook$getActiveSh, _formulaModel$getBody;
31682
31944
  const instanceService = accessor.get(IUniverInstanceService);
31683
31945
  const workbook = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
31684
31946
  const formulaModel = instanceService.getUnit(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
@@ -31710,8 +31972,12 @@ const MobileFormulaBarSubmitCommand = {
31710
31972
  });
31711
31973
  editorBridgeService.refreshEditCellState();
31712
31974
  editorBridgeService.changeEditorDirty(false);
31975
+ const editorService = accessor.get(IEditorService);
31976
+ const formulaEditor = editorService.getEditor(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
31977
+ if (editorService.getFocusId() !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) editorService.focus(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
31978
+ else formulaEditor === null || formulaEditor === void 0 || formulaEditor.focus();
31713
31979
  const endOffset = Math.max(0, (((_formulaModel$getBody = formulaModel.getBody()) === null || _formulaModel$getBody === void 0 ? void 0 : _formulaModel$getBody.dataStream.length) ?? 2) - 2);
31714
- (_accessor$get$getEdit = accessor.get(IEditorService).getEditor(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)) === null || _accessor$get$getEdit === void 0 || _accessor$get$getEdit.setSelectionRanges([{
31980
+ formulaEditor === null || formulaEditor === void 0 || formulaEditor.setSelectionRanges([{
31715
31981
  startOffset: endOffset,
31716
31982
  endOffset
31717
31983
  }], false);
@@ -31794,6 +32060,7 @@ let SheetUIMobileController = class SheetUIMobileController extends Disposable {
31794
32060
  ScrollToRangeOperation,
31795
32061
  SetUnderlineCommand,
31796
32062
  SetZoomRatioCommand,
32063
+ SetZoomRatioFromToolbarCommand,
31797
32064
  SetZoomRatioOperation,
31798
32065
  ShowMenuListCommand,
31799
32066
  InsertRangeMoveDownConfirmCommand,
@@ -32801,7 +33068,7 @@ let MobileCellEditRenderController = class MobileCellEditRenderController extend
32801
33068
  if (cell.location.unitId !== this._context.unitId) return;
32802
33069
  const snapshot = (_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 || (_this$_editorBridgeSe = _this$_editorBridgeSe.documentLayoutObject.documentModel) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.getSnapshot();
32803
33070
  if (isCellImage(snapshot)) return;
32804
- this._commandService.executeCommand(SetCellEditVisibleOperation.id, {
33071
+ this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
32805
33072
  visible: true,
32806
33073
  eventType: DeviceInputEventType.Dblclick,
32807
33074
  unitId: this._context.unitId
@@ -33237,7 +33504,7 @@ let MobileHoverRenderController = class MobileHoverRenderController extends Disp
33237
33504
  return;
33238
33505
  }
33239
33506
  this._resetCompletedTap();
33240
- this._hoverManagerService.triggerDbClick(unitId, event.offsetX, event.offsetY);
33507
+ this._hoverManagerService.triggerDbClick(unitId, event);
33241
33508
  },
33242
33509
  priority: -1
33243
33510
  }));
@@ -33313,7 +33580,7 @@ let MobileHoverRenderController = class MobileHoverRenderController extends Disp
33313
33580
  this._suppressEngineDoubleClick = false;
33314
33581
  this._suppressEngineDoubleClickTimer = null;
33315
33582
  });
33316
- this._hoverManagerService.triggerDbClick(unitId, event.offsetX, event.offsetY);
33583
+ this._hoverManagerService.triggerDbClick(unitId, event);
33317
33584
  return;
33318
33585
  }
33319
33586
  this._resetCompletedTap();
@@ -35295,7 +35562,6 @@ let ComponentsController = class ComponentsController extends Disposable {
35295
35562
  const componentManager = this._componentManager;
35296
35563
  this.disposeWithMe(componentManager.register(MENU_ITEM_INPUT_COMPONENT, MenuItemInput));
35297
35564
  this.disposeWithMe(componentManager.register(MENU_ITEM_FROZEN_COMPONENT, MenuItemFrozen));
35298
- this.disposeWithMe(componentManager.register(SHEET_ZOOM_INPUT_COMPONENT, SheetZoomInput));
35299
35565
  this.disposeWithMe(componentManager.register(BORDER_PANEL_COMPONENT, BorderPanel));
35300
35566
  this.disposeWithMe(componentManager.register(DEFINED_NAME_CONTAINER, DefinedNameContainer));
35301
35567
  this.disposeWithMe(componentManager.register(CELL_POPUP_COMPONENT_KEY, CellPopup));
@@ -35321,20 +35587,22 @@ const ISheetHostChromeOverrideService = createIdentifier("sheet-ui.host-chrome-o
35321
35587
  //#endregion
35322
35588
  //#region src/controllers/render-controllers/contextmenu.render-controller.ts
35323
35589
  let SheetContextMenuRenderController = class SheetContextMenuRenderController extends Disposable {
35324
- constructor(_context, _contextMenuService, _selectionManagerService, _selectionRenderService, _injector) {
35590
+ constructor(_context, _contextMenuService, _selectionManagerService, _selectionRenderService, _injector, _platformService, _contextService) {
35325
35591
  super();
35326
35592
  this._context = _context;
35327
35593
  this._contextMenuService = _contextMenuService;
35328
35594
  this._selectionManagerService = _selectionManagerService;
35329
35595
  this._selectionRenderService = _selectionRenderService;
35330
35596
  this._injector = _injector;
35597
+ this._platformService = _platformService;
35598
+ this._contextService = _contextService;
35331
35599
  this._init();
35332
35600
  this._initEmbedRuntimeSessionListener();
35333
35601
  }
35334
35602
  _init() {
35335
35603
  var _this$_context;
35336
35604
  const spreadsheetSubscription = ((_this$_context = this._context) === null || _this$_context === void 0 || (_this$_context = _this$_context.mainComponent) === null || _this$_context === void 0 ? void 0 : _this$_context.onPointerDown$).subscribeEvent((event) => {
35337
- if (event.button === 2) {
35605
+ if (this._isContextMenuGesture(event)) {
35338
35606
  const selections = this._selectionManagerService.getCurrentSelections();
35339
35607
  const currentSelection = selections === null || selections === void 0 ? void 0 : selections[0];
35340
35608
  if (!currentSelection) return;
@@ -35364,20 +35632,23 @@ let SheetContextMenuRenderController = class SheetContextMenuRenderController ex
35364
35632
  this.disposeWithMe(spreadsheetSubscription);
35365
35633
  const spreadsheetColumnHeader = this._context.components.get("__SpreadsheetColumnHeader__");
35366
35634
  const rowHeaderSub = this._context.components.get("__SpreadsheetRowHeader__").onPointerDown$.subscribeEvent((event) => {
35367
- if (event.button === 2) {
35635
+ if (this._isContextMenuGesture(event)) {
35368
35636
  if (this._shouldSuppressHostContextMenu()) return;
35369
35637
  this._contextMenuService.triggerContextMenu(event, ContextMenuPosition.ROW_HEADER);
35370
35638
  }
35371
35639
  });
35372
35640
  this.disposeWithMe(rowHeaderSub);
35373
35641
  const colHeaderObserver = spreadsheetColumnHeader.onPointerDown$.subscribeEvent((event) => {
35374
- if (event.button === 2) {
35642
+ if (this._isContextMenuGesture(event)) {
35375
35643
  if (this._shouldSuppressHostContextMenu()) return;
35376
35644
  this._contextMenuService.triggerContextMenu(event, ContextMenuPosition.COL_HEADER);
35377
35645
  }
35378
35646
  });
35379
35647
  this.disposeWithMe(colHeaderObserver);
35380
35648
  }
35649
+ _isContextMenuGesture(event) {
35650
+ return isSheetContextMenuGesture(event, this._platformService.isMac, this._contextService.getContextValue(REF_SELECTIONS_ENABLED));
35651
+ }
35381
35652
  _initEmbedRuntimeSessionListener() {
35382
35653
  const runtimeFocusCoordinator = this._getSheetEmbedRuntimeFocusCoordinator();
35383
35654
  if (!runtimeFocusCoordinator) return;
@@ -35400,7 +35671,9 @@ SheetContextMenuRenderController = __decorate([
35400
35671
  __decorateParam(1, IContextMenuService),
35401
35672
  __decorateParam(2, Inject(SheetsSelectionsService)),
35402
35673
  __decorateParam(3, ISheetSelectionRenderService),
35403
- __decorateParam(4, Inject(Injector))
35674
+ __decorateParam(4, Inject(Injector)),
35675
+ __decorateParam(5, IPlatformService),
35676
+ __decorateParam(6, IContextService)
35404
35677
  ], SheetContextMenuRenderController);
35405
35678
  function shouldHideSheetHostContextMenuForEmbedSession(hostUnitId, activeScope) {
35406
35679
  return (activeScope === null || activeScope === void 0 ? void 0 : activeScope.hostUnitId) === hostUnitId && activeScope.sessionMode !== "host-passive";
@@ -35412,7 +35685,7 @@ function shouldSuppressSheetContextMenuForEmbedOverride(hostUnitId, override) {
35412
35685
  //#endregion
35413
35686
  //#region src/controllers/render-controllers/desktop-cell-edit.render-controller.ts
35414
35687
  let DesktopCellEditRenderController = class DesktopCellEditRenderController extends RxDisposable {
35415
- constructor(_context, _instanceService, _commandService, _editorBridgeService, _selectionManagerService, _contextService, _renderManagerService, _embedRuntimeFocusCoordinator) {
35688
+ constructor(_context, _instanceService, _commandService, _editorBridgeService, _selectionManagerService, _contextService, _renderManagerService, _platformService, _embedRuntimeFocusCoordinator) {
35416
35689
  super();
35417
35690
  this._context = _context;
35418
35691
  this._instanceService = _instanceService;
@@ -35421,6 +35694,7 @@ let DesktopCellEditRenderController = class DesktopCellEditRenderController exte
35421
35694
  this._selectionManagerService = _selectionManagerService;
35422
35695
  this._contextService = _contextService;
35423
35696
  this._renderManagerService = _renderManagerService;
35697
+ this._platformService = _platformService;
35424
35698
  this._embedRuntimeFocusCoordinator = _embedRuntimeFocusCoordinator;
35425
35699
  _defineProperty(this, "_d", void 0);
35426
35700
  this.disposeWithMe(this._instanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe((workbook) => {
@@ -35448,13 +35722,17 @@ let DesktopCellEditRenderController = class DesktopCellEditRenderController exte
35448
35722
  const { spreadsheet, spreadsheetColumnHeader, spreadsheetLeftTopPlaceholder, spreadsheetRowHeader } = sheetObject;
35449
35723
  d.add(spreadsheet.onDblclick$.subscribeEvent((evt) => {
35450
35724
  var _this$_editorBridgeSe;
35451
- if (evt.button === 2) return;
35725
+ if (isSheetContextMenuGesture(evt, this._platformService.isMac, this._contextService.getContextValue(REF_SELECTIONS_ENABLED))) return;
35452
35726
  const snapshot = (_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 || (_this$_editorBridgeSe = _this$_editorBridgeSe.documentLayoutObject.documentModel) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.getSnapshot();
35453
35727
  if (isCellImage(snapshot)) return;
35454
- this._commandService.executeCommand(SetCellEditVisibleOperation.id, {
35728
+ this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
35455
35729
  visible: true,
35456
35730
  eventType: DeviceInputEventType.Dblclick,
35457
- unitId: this._context.unitId
35731
+ unitId: this._context.unitId,
35732
+ pointerPosition: {
35733
+ x: evt.clientX,
35734
+ y: evt.clientY
35735
+ }
35458
35736
  });
35459
35737
  }));
35460
35738
  d.add(spreadsheet.onPointerDown$.subscribeEvent({
@@ -35583,7 +35861,8 @@ DesktopCellEditRenderController = __decorate([
35583
35861
  __decorateParam(4, Inject(SheetsSelectionsService)),
35584
35862
  __decorateParam(5, IContextService),
35585
35863
  __decorateParam(6, IRenderManagerService),
35586
- __decorateParam(7, Optional(ISheetEmbedRuntimeFocusCoordinator))
35864
+ __decorateParam(7, IPlatformService),
35865
+ __decorateParam(8, Optional(ISheetEmbedRuntimeFocusCoordinator))
35587
35866
  ], DesktopCellEditRenderController);
35588
35867
  function resolvePointerEventPayload(payload) {
35589
35868
  return Array.isArray(payload) ? payload[0] : payload;
@@ -35747,38 +36026,34 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
35747
36026
  const { spreadsheetRowHeader, spreadsheetColumnHeader, spreadsheet, spreadsheetLeftTopPlaceholder } = sheetObject;
35748
36027
  const { scene } = this._context;
35749
36028
  this.disposeWithMe(spreadsheet === null || spreadsheet === void 0 ? void 0 : spreadsheet.onPointerDown$.subscribeEvent((evt, state) => {
35750
- if (this.isSelectionDisabled()) return;
35751
- if (this.inRefSelectionMode()) return;
36029
+ if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
35752
36030
  this._onPointerDown(evt, spreadsheet.zIndex + 1, RANGE_TYPE.NORMAL, this._getActiveViewport(evt));
35753
- if (evt.button !== 2) state.stopPropagation();
36031
+ if (!this._isContextMenuGesture(evt)) state.stopPropagation();
35754
36032
  }));
35755
36033
  this.disposeWithMe(spreadsheetRowHeader === null || spreadsheetRowHeader === void 0 ? void 0 : spreadsheetRowHeader.onPointerDown$.subscribeEvent((evt, state) => {
35756
- if (this.isSelectionDisabled()) return;
35757
- if (this.inRefSelectionMode()) return;
36034
+ if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
35758
36035
  const skeleton = this._sheetSkeletonManagerService.getCurrentParam().skeleton;
35759
36036
  const { row } = getCoordByOffset(evt.offsetX, evt.offsetY, scene, skeleton);
35760
36037
  if (isThisRowSelected(this._workbookSelections.getCurrentSelections(), row)) return;
35761
36038
  this._onPointerDown(evt, (spreadsheet.zIndex || 1) + 1, RANGE_TYPE.ROW, this._getActiveViewport(evt), ScrollTimerType.Y);
35762
- if (evt.button !== 2) state.stopPropagation();
36039
+ if (!this._isContextMenuGesture(evt)) state.stopPropagation();
35763
36040
  }));
35764
36041
  this.disposeWithMe(spreadsheetColumnHeader === null || spreadsheetColumnHeader === void 0 ? void 0 : spreadsheetColumnHeader.onPointerDown$.subscribeEvent((evt, state) => {
35765
- if (this.isSelectionDisabled()) return;
35766
- if (this.inRefSelectionMode()) return;
36042
+ if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
35767
36043
  const skeleton = this._sheetSkeletonManagerService.getCurrentParam().skeleton;
35768
36044
  const { column } = getCoordByOffset(evt.offsetX, evt.offsetY, scene, skeleton);
35769
36045
  if (isThisColSelected(this._workbookSelections.getCurrentSelections(), column)) return;
35770
36046
  this._onPointerDown(evt, (spreadsheet.zIndex || 1) + 1, RANGE_TYPE.COLUMN, this._getActiveViewport(evt), ScrollTimerType.X);
35771
- if (evt.button !== 2) state.stopPropagation();
36047
+ if (!this._isContextMenuGesture(evt)) state.stopPropagation();
35772
36048
  }));
35773
36049
  this.disposeWithMe(spreadsheetLeftTopPlaceholder === null || spreadsheetLeftTopPlaceholder === void 0 ? void 0 : spreadsheetLeftTopPlaceholder.onPointerDown$.subscribeEvent((evt, state) => {
35774
- if (this.isSelectionDisabled()) return;
35775
- if (this.inRefSelectionMode()) return;
36050
+ if (this.isSelectionDisabled() || this.inRefSelectionMode()) return;
35776
36051
  this._reset();
35777
36052
  const skeleton = this._sheetSkeletonManagerService.getCurrentParam().skeleton;
35778
36053
  const selectionWithStyle = selectionDataForSelectAll(skeleton);
35779
36054
  this._addSelectionControlByModelData(selectionWithStyle);
35780
36055
  this.refreshSelectionMoveEnd();
35781
- if (evt.button !== 2) state.stopPropagation();
36056
+ if (!this._isContextMenuGesture(evt)) state.stopPropagation();
35782
36057
  }));
35783
36058
  }
35784
36059
  _initThemeChangeListener() {
@@ -35859,7 +36134,7 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
35859
36134
  const sheetId = workbook.getActiveSheet().getSheetId();
35860
36135
  if (selectionDataWithStyleList.length === 0) return;
35861
36136
  const selectionWithStyles = selectionDataWithStyleList.map((selectionDataWithStyle) => convertSelectionDataToRange(selectionDataWithStyle));
35862
- this._commandService.executeCommand(SetSelectionsOperation.id, {
36137
+ this._commandService.syncExecuteCommand(SetSelectionsOperation.id, {
35863
36138
  unitId,
35864
36139
  subUnitId: sheetId,
35865
36140
  type,
@@ -35880,6 +36155,7 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
35880
36155
  const prevSheetId = (_this$_skeleton = this._skeleton) === null || _this$_skeleton === void 0 || (_this$_skeleton = _this$_skeleton.worksheet) === null || _this$_skeleton === void 0 ? void 0 : _this$_skeleton.getSheetId();
35881
36156
  this._changeRuntime(skeleton, scene, viewportMain);
35882
36157
  if (prevSheetId !== skeleton.worksheet.getSheetId()) {
36158
+ this._reset();
35883
36159
  const selections = this._workbookSelections.getCurrentSelections();
35884
36160
  this._commandService.syncExecuteCommand(SetSelectionsOperation.id, {
35885
36161
  unitId,
@@ -35914,11 +36190,10 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
35914
36190
  this._rangeType = rangeType;
35915
36191
  const skeleton = this._skeleton;
35916
36192
  const scene = this._scene;
35917
- if (!scene || !skeleton) return;
36193
+ const viewportMain = scene === null || scene === void 0 ? void 0 : scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
36194
+ if (!scene || !skeleton || !viewportMain) return;
35918
36195
  if (viewport) this._activeViewport = viewport;
35919
36196
  const { offsetX: evtOffsetX, offsetY: evtOffsetY } = evt;
35920
- const viewportMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
35921
- if (!viewportMain) return;
35922
36197
  const relativeCoords = scene.getCoordRelativeToViewport(Vector2.FromArray([evtOffsetX, evtOffsetY]));
35923
36198
  const { x: offsetX, y: offsetY } = relativeCoords;
35924
36199
  this._startViewportPosX = offsetX;
@@ -35928,7 +36203,6 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
35928
36203
  const selectCell = this._skeleton.getCellByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
35929
36204
  if (!selectCell) return;
35930
36205
  switch (rangeType) {
35931
- case RANGE_TYPE.NORMAL: break;
35932
36206
  case RANGE_TYPE.ROW:
35933
36207
  selectCell.startColumn = 0;
35934
36208
  selectCell.endColumn = this._skeleton.getColumnCount() - 1;
@@ -35955,6 +36229,11 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
35955
36229
  selectionWithStyle.range.rangeType = rangeType;
35956
36230
  const activeSelectionControl = this._updateSelectionControl(evt, selectionWithStyle);
35957
36231
  if (!activeSelectionControl) return;
36232
+ if (this._isContextMenuGesture(evt)) {
36233
+ this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
36234
+ this.endSelection();
36235
+ return;
36236
+ }
35958
36237
  scene.disableObjectsEvent();
35959
36238
  this._clearUpdatingListeners();
35960
36239
  this._addEndingListeners();
@@ -35966,20 +36245,32 @@ let SheetSelectionRenderService = class SheetSelectionRenderService extends Base
35966
36245
  (_this$_scene$getEngin = this._scene.getEngine()) === null || _this$_scene$getEngin === void 0 || _this$_scene$getEngin.setCapture();
35967
36246
  }
35968
36247
  _updateSelectionControl(evt, selection) {
35969
- const cursorRange = attachSelectionWithCoord(selection, this._skeleton).rangeWithCoord;
36248
+ const selectionWithCoord = attachSelectionWithCoord(selection, this._skeleton);
36249
+ const cursorRange = selectionWithCoord.rangeWithCoord;
35970
36250
  this._startRangeWhenPointerDown = { ...cursorRange };
35971
36251
  const controls = this.getSelectionControls();
35972
36252
  const isSelected = controls.some((control) => Rectangle.contains(control.model, cursorRange));
35973
- if (evt.button === 2 && isSelected) return;
35974
- if (evt.button === 0 && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey && !this._singleSelectionEnabled && this._rangeType === RANGE_TYPE.NORMAL && isSelected) this._selectionBeforeModifierClick = this.getSelectionDataWithStyle().map(convertSelectionDataToRange);
36253
+ if (this._isContextMenuGesture(evt) && isSelected) return;
36254
+ if (evt.button === 0 && !this._isContextMenuGesture(evt) && this._isMultiSelectModifier(evt) && !evt.shiftKey && !this._singleSelectionEnabled && this._rangeType === RANGE_TYPE.NORMAL && isSelected) this._selectionBeforeModifierClick = this.getSelectionDataWithStyle().map(convertSelectionDataToRange);
35975
36255
  let activeControl = this.getActiveSelectionControl();
36256
+ if (activeControl && this._canAnimateSelection(evt, activeControl, cursorRange)) {
36257
+ activeControl.updateRangeBySelectionWithCoord(selectionWithCoord, this._skeleton, true);
36258
+ return activeControl;
36259
+ }
35976
36260
  this._checkClearPreviousControls(evt);
35977
36261
  const currentCell = activeControl === null || activeControl === void 0 ? void 0 : activeControl.model.currentCell;
35978
- if (evt.shiftKey && currentCell && activeControl) this._makeSelectionByTwoCells(currentCell, cursorRange, this._skeleton, this._rangeType, activeControl);
36262
+ if (!this._isContextMenuGesture(evt) && evt.shiftKey && currentCell && activeControl) this._makeSelectionByTwoCells(currentCell, cursorRange, this._skeleton, this._rangeType, activeControl);
35979
36263
  else activeControl = this.newSelectionControl(this._scene, this._skeleton, selection);
35980
36264
  for (let i = 0; i < controls.length - 1; i++) controls[i].clearHighlight();
35981
36265
  return activeControl;
35982
36266
  }
36267
+ _canAnimateSelection(evt, control, target) {
36268
+ if (this.getSelectionControls().length !== 1 || this._rangeType !== RANGE_TYPE.NORMAL || this._remainLastEnabled || evt.button !== 0 || evt.ctrlKey || evt.metaKey || evt.shiftKey || evt.altKey) return false;
36269
+ const current = control.getCurrentCellInfo();
36270
+ if (!current || !Rectangle.equals(control.model, current)) return false;
36271
+ const freeze = this._skeleton.worksheet.getFreeze();
36272
+ return current.startRow < freeze.startRow === target.startRow < freeze.startRow && current.startColumn < freeze.startColumn === target.startColumn < freeze.startColumn;
36273
+ }
35983
36274
  endSelection() {
35984
36275
  const previousSelections = this._selectionBeforeModifierClick;
35985
36276
  this._selectionBeforeModifierClick = null;
@@ -36169,4 +36460,4 @@ UniverSheetsUIPlugin = __decorate([
36169
36460
  ], UniverSheetsUIPlugin);
36170
36461
 
36171
36462
  //#endregion
36172
- 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, ISheetBarService, ISheetCellDropdownManagerService, ISheetClipboardService, ISheetEmbedFloatingGeometryService, ISheetEmbedInteractionBoundaryService, ISheetEmbedRuntimeFocusCoordinator, ISheetEmbedRuntimeService, ISheetHostChromeOverrideService, ISheetSelectionRenderService, IStatusBarService, InsertRangeMoveDownConfirmCommand, InsertRangeMoveRightConfirmCommand, JumpOver, MOBILE_CONTEXT_MENU, MOBILE_EXPANDING_SELECTION, MOBILE_FORMULA_FUNCTION_PANEL_OPEN, MOBILE_PINCH_ZOOMING, MarkSelectionService, MobileSelectionControl, 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, SheetBarService, SheetCanvasPopManagerService, SheetCellDropdownManagerService, SheetCellEditorResizeService, SheetClipboardController, SheetClipboardService, SheetContextMenuMobileRenderController, 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 };
36463
+ 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, DEFINED_NAME_CONTAINER, 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, ISheetBarService, ISheetCellDropdownManagerService, ISheetClipboardService, ISheetEmbedFloatingGeometryService, ISheetEmbedInteractionBoundaryService, ISheetEmbedRuntimeFocusCoordinator, ISheetEmbedRuntimeService, ISheetHostChromeOverrideService, ISheetSelectionRenderService, IStatusBarService, InsertRangeMoveDownConfirmCommand, InsertRangeMoveRightConfirmCommand, JumpOver, MOBILE_CONTEXT_MENU, MOBILE_EXPANDING_SELECTION, MOBILE_FORMULA_FUNCTION_PANEL_OPEN, MOBILE_PINCH_ZOOMING, MarkSelectionService, MobileSelectionControl, 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, SheetBarService, SheetCanvasPopManagerService, SheetCellDropdownManagerService, SheetCellEditorResizeService, SheetClipboardController, SheetClipboardService, SheetContextMenuMobileRenderController, 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 };