@univerjs/sheets-ui 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -3,8 +3,8 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
5
  import { DOCS_VIEW_KEY, SetInlineFormatBoldCommand, SetInlineFormatItalicCommand, SetInlineFormatUnderlineCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatFontSizeCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatTextColorCommand, SetTextSelectionsOperation, SetInlineFormatCommand, TextSelectionManagerService, BreakLineCommand, DeleteLeftCommand, CoverContentCommand, RichTextEditingMutation, DocSkeletonManagerService, VIEWPORT_KEY, DOCS_COMPONENT_MAIN_LAYER_INDEX, MoveSelectionOperation, MoveCursorOperation, IMEInputCommand, InsertCommand } from "@univerjs/docs";
6
- import { Disposable, Inject, Injector, CommandType, IUniverInstanceService, ICommandService, UniverInstanceType, LocaleService, Direction, Rectangle, getReverseDirection, RANGE_TYPE, Tools, Workbook, toDisposable, IContextService, UserManagerService, FOCUSING_COMMON_DRAWINGS, IPermissionService, RxDisposable, OnLifecycle, LifecycleStages, ObjectMatrix, isFormulaString, isFormulaId, CellValueType, numfmt, createIdentifier, IUndoRedoService, createInterceptorKey, makeCellToSelection, ColorKit, Quantity, InterceptorManager, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, EDITOR_ACTIVATED, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, ThemeService, FOCUSING_SHEET, DisposableCollection, getCellInfoInMergeData, sortRules, sequenceExecute, Dimension, ILogService, BorderStyleTypes, useDependency, DEFAULT_EMPTY_DOCUMENT_VALUE, DocumentFlavor, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, HorizontalAlign, VerticalAlign, WrapStrategy, BooleanNumber, FOCUSING_UNIVER_EDITOR, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_FX_BAR_EDITOR, LRUMap, BaselineOffset, DataStreamTreeTokenType, skipParseTagNames, ErrorService, extractPureTextFromCell, FontWeight, FontItalic, DEFAULT_STYLES, nameCharacterCheck, debounce, createInternalEditorID, AbsoluteRefType, NilCommand, connectInjector, Range, cellToRange, convertBodyToHtml, handleStyleToString, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, Optional, IConfigService, FOCUSING_EDITOR_BUT_HIDDEN, LocaleType, IResourceLoaderService, isRealNum, isICellData, IAuthzIoService, isValidRange, Plugin, mergeOverrideWithDependencies, DependentOn } from "@univerjs/core";
7
- import { SpreadsheetSkeleton, IRenderManagerService, Vector2, SHEET_VIEWPORT_KEY as SHEET_VIEWPORT_KEY$1, RENDER_RAW_FORMULA_KEY, Spreadsheet, Rect, DashedRect, Group, TRANSFORM_CHANGE_OBSERVABLE_TYPE, cancelRequestFrame, requestNewFrame, FIX_ONE_PIXEL_BLUR_OFFSET, CURSOR_TYPE, ScrollTimer, ScrollTimerType, isRectIntersect, DeviceInputEventType, getCanvasOffsetByEngine, convertTextRotation, ptToPixel, hasCJKText, ITextSelectionRenderManager, DEFAULT_PADDING_DATA, ptToPx, ScrollBar, fixLineWidthByScale, Shape, RegularPolygon, Layer, SpreadsheetRowHeader, SpreadsheetColumnHeader, Viewport, PointerInput, RENDER_CLASS_TYPE, SheetExtension } from "@univerjs/engine-render";
6
+ import { Disposable, Inject, Injector, CommandType, IUniverInstanceService, ICommandService, UniverInstanceType, LocaleService, Direction, Rectangle, getReverseDirection, RANGE_TYPE, Tools, Workbook, toDisposable, IContextService, UserManagerService, FOCUSING_COMMON_DRAWINGS, IPermissionService, RxDisposable, OnLifecycle, LifecycleStages, ObjectMatrix, isFormulaString, isFormulaId, CellValueType, numfmt, createIdentifier, IUndoRedoService, createInterceptorKey, makeCellToSelection, ColorKit, Quantity, InterceptorManager, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, EDITOR_ACTIVATED, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, ThemeService, FOCUSING_SHEET, DisposableCollection, getCellInfoInMergeData, sortRules, sequenceExecute, Dimension, ILogService, BorderStyleTypes, useDependency, DEFAULT_EMPTY_DOCUMENT_VALUE, DocumentFlavor, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, HorizontalAlign, VerticalAlign, WrapStrategy, BooleanNumber, FOCUSING_UNIVER_EDITOR, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_FX_BAR_EDITOR, LRUMap, BaselineOffset, DataStreamTreeTokenType, skipParseTagNames, ErrorService, extractPureTextFromCell, FontWeight, FontItalic, DEFAULT_STYLES, nameCharacterCheck, debounce, createInternalEditorID, AbsoluteRefType, NilCommand, connectInjector, Range, cellToRange, convertBodyToHtml, handleStyleToString, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, Optional, IConfigService, FOCUSING_EDITOR_BUT_HIDDEN, LocaleType, UNIVER_INTERNAL, IResourceLoaderService, isRealNum, isICellData, IAuthzIoService, isValidRange, Plugin, mergeOverrideWithDependencies, DependentOn } from "@univerjs/core";
7
+ import { SpreadsheetSkeleton, IRenderManagerService, Vector2, SHEET_VIEWPORT_KEY as SHEET_VIEWPORT_KEY$1, RENDER_RAW_FORMULA_KEY, Spreadsheet, Rect, DashedRect, Group, TRANSFORM_CHANGE_OBSERVABLE_TYPE, cancelRequestFrame, requestNewFrame, FIX_ONE_PIXEL_BLUR_OFFSET, CURSOR_TYPE, ScrollTimer, ScrollTimerType, isRectIntersect, DeviceInputEventType, getCanvasOffsetByEngine, convertTextRotation, ptToPixel, hasCJKText, ITextSelectionRenderManager, DEFAULT_PADDING_DATA, ScrollBar, fixLineWidthByScale, Shape, RegularPolygon, Layer, SpreadsheetRowHeader, SpreadsheetColumnHeader, Viewport, PointerInput, RENDER_CLASS_TYPE, SheetExtension } from "@univerjs/engine-render";
8
8
  import { getSheetCommandTarget, alignToMergedCellsBorders, getSelectionsService, getCellAtRowCol, SetSelectionsOperation, expandToContinuousRange, ScrollToCellOperation, SheetsSelectionsService, RangeProtectionRuleModel, WorksheetProtectionRuleModel, WorkbookEditablePermission, WorkbookManageCollaboratorPermission, generateNullCellValue, SetRangeValuesUndoMutationFactory, SetRangeValuesMutation, SELECTION_CONTROL_BORDER_BUFFER_COLOR, getNormalSelectionStyle, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, transformCellDataToSelectionData, IRefSelectionsService, SetRangeValuesCommand, SetWorksheetActiveOperation, MoveRangeMutation, RemoveRowMutation, RemoveColMutation, InsertRowMutation, InsertColMutation, MoveRowsMutation, MoveColsMutation, SetWorksheetColWidthMutation, SetWorksheetRowHeightMutation, RemoveSheetMutation, AddMergeUndoMutationFactory, RemoveWorksheetMergeMutation, AddWorksheetMergeMutation, getAddMergeMutationRangeByType, RemoveMergeUndoMutationFactory, AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, SetRowHiddenCommand, SetColHiddenCommand, SetBoldCommand, SetItalicCommand, SetUnderlineCommand, SetStrikeThroughCommand, SetFontSizeCommand, SetFontFamilyCommand, SetTextColorCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, RemoveRowCommand, RemoveColCommand, RemoveSheetCommand, SetFrozenMutationFactory, SetFrozenMutation, BorderStyleManagerService, RangeProtectionPermissionEditPoint, WorksheetSetCellValuePermission, WorksheetEditPermission, SetWorksheetOrderMutation, InsertSheetMutation, SetWorksheetNameMutation, SetWorksheetHideMutation, SetWorksheetShowCommand, SetWorksheetActivateCommand, getPrimaryForRange, WorksheetCopyPermission, WorksheetSetCellStylePermission, ResetTextColorCommand, ResetBackgroundColorCommand, SetBackgroundColorCommand, SetHorizontalTextAlignCommand, SetVerticalTextAlignCommand, SetTextWrapCommand, SetTextRotationCommand, WorkbookCopyPermission, RangeProtectionPermissionViewPoint, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, SetWorksheetRowIsAutoHeightCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedRowsVisibleCommand, SetColHiddenMutation, SetColVisibleMutation, SetSelectedColsVisibleCommand, SetRowHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetColWidthCommand, SetWorksheetNameCommand, SetWorksheetOrderCommand, WorkbookRenameSheetPermission, SetTabColorMutation, WorkbookCreateSheetPermission, InsertSheetCommand, InsertDefinedNameCommand, SetDefinedNameCommand, RemoveDefinedNameCommand, AddWorksheetProtectionMutation, DeleteWorksheetProtectionMutation, SetWorksheetProtectionMutation, AddRangeProtectionMutation, DeleteRangeProtectionMutation, SetRangeProtectionMutation, ClearSelectionContentCommand, ClearSelectionFormatCommand, ClearSelectionAllCommand, WorksheetDeleteColumnPermission, WorksheetDeleteRowPermission, WorksheetInsertColumnPermission, WorksheetInsertRowPermission, InsertRowBeforeCommand, InsertRowAfterCommand, InsertColBeforeCommand, InsertColAfterCommand, CopySheetCommand, SetTabColorCommand, SetWorksheetHideCommand, WorkbookDeleteSheetPermission, WorkbookHideSheetPermission, SetBorderBasicCommand, MergeCellController, MERGE_CELL_INTERCEPTOR_CHECK, RemoveWorksheetMergeCommand, DISABLE_NORMAL_SELECTIONS, SelectionMoveType, convertSelectionDataToRange, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowAutoHeightMutation, SetStyleCommand, SheetInterceptorService, MoveRangeCommand, MAX_CELL_PER_SHEET_KEY, SetFrozenCommand, InsertRowCommand, InsertColCommand, MoveColsCommand, MoveRowsCommand, DeltaRowHeightCommand, DeltaColumnWidthCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand, INumfmtService, COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE, RefRangeService, INTERCEPTOR_POINT, WorkbookMoveSheetPermission, WorksheetViewPermission, getAllRangePermissionPoint, getAllWorksheetPermissionPointByPointPanel, defaultWorkbookPermissionPoints, getAllWorkbookPermissionPoint, getAllWorksheetPermissionPoint, defaultWorksheetPermissionPoint, WorksheetProtectionPointModel, RangeProtectionRenderModel, DeleteRangeProtectionCommand, setEndForRange, AddRangeProtectionCommand as AddRangeProtectionCommand$1, SetWorksheetPermissionPointsCommand, UniverSheetsPlugin } from "@univerjs/sheets";
9
9
  import { BehaviorSubject, switchMap, of, combineLatest, startWith, map, takeUntil, distinctUntilChanged, Subject, merge, EMPTY, Observable, combineLatestWith, filter, Subscription, throttleTime } from "rxjs";
10
10
  import { KeyCode, IEditorService, IConfirmService, ComponentManager, useObservable, DISABLE_AUTO_FOCUS_KEY, TextEditor, ISidebarService, ProgressBar, DEFAULT_BACKGROUND_COLOR_RGB, DEFAULT_BACKGROUND_COLOR_RGBA, handleStringToStyle, textTrim, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, HTML_CLIPBOARD_MIME_TYPE, IClipboardInterfaceService, INotificationService, IPlatformService, CopyCommand, CutCommand, PasteCommand, MenuGroup, MenuItemType, MenuPosition, getMenuHiddenObservable, FONT_FAMILY_LIST, FONT_SIZE_LIST, Menu as Menu$1, IMessageService, useSimpleToolbarGroups, ToolbarItem, RangeSelector, IDialogService, MetaKeys, FontFamily, FontFamilyItem, FontSize, BuiltInUIPart, ILayoutService, IShortcutService, IMenuService, IUIPartsService, SetEditorResizeOperation, IContextMenuService, ICanvasPopupService, IRangeSelectorService, UniverMobileUIPlugin } from "@univerjs/ui";
@@ -434,6 +434,15 @@ ShortcutExperienceService = __decorateClass$S([
434
434
  __decorateParam$R(0, IUniverInstanceService),
435
435
  __decorateParam$R(1, Inject(LocaleService))
436
436
  ], ShortcutExperienceService);
437
+ const _SelectAllService = class _SelectAllService extends Disposable {
438
+ constructor() {
439
+ super(...arguments);
440
+ __publicField(this, "rangesStack", []);
441
+ __publicField(this, "selectedRangeWorksheet", "");
442
+ }
443
+ };
444
+ __name(_SelectAllService, "SelectAllService");
445
+ let SelectAllService = _SelectAllService;
437
446
  var MergeType = /* @__PURE__ */ ((MergeType2) => (MergeType2.MergeAll = "mergeAll", MergeType2.MergeVertical = "mergeVertical", MergeType2.MergeHorizontal = "mergeHorizontal", MergeType2))(MergeType || {});
438
447
  function findNextRange(startRange, direction, worksheet, boundary, isFindNext = !0, nextStep = 1, isGoBack = !0) {
439
448
  let destRange = { ...startRange };
@@ -977,34 +986,28 @@ const MoveSelectionCommand = {
977
986
  ]
978
987
  });
979
988
  }, "handler")
980
- };
981
- let RANGES_STACK = [], SELECTED_RANGE_WORKSHEET = "";
982
- const SelectAllCommand = {
989
+ }, SelectAllCommand = {
983
990
  id: "sheet.command.select-all",
984
991
  type: CommandType.COMMAND,
985
- onDispose() {
986
- RANGES_STACK = [], SELECTED_RANGE_WORKSHEET = "";
987
- },
988
992
  handler: /* @__PURE__ */ __name(async (accessor, params = { expandToGapFirst: !0, loop: !1 }) => {
989
- const selection = getSelectionsService(accessor).getCurrentLastSelection(), target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
993
+ const target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
990
994
  if (!target) return !1;
991
- const { worksheet, unitId, subUnitId } = target;
992
- if (!selection || !worksheet)
993
- return !1;
994
- const id = `${unitId}|${subUnitId}`;
995
- id !== SELECTED_RANGE_WORKSHEET && (RANGES_STACK = [], SELECTED_RANGE_WORKSHEET = id);
995
+ const selection = getSelectionsService(accessor).getCurrentLastSelection();
996
+ if (!selection) return !1;
997
+ const selectAllService = accessor.get(SelectAllService), { worksheet, unitId, subUnitId } = target, id = `${unitId}|${subUnitId}`;
998
+ id !== selectAllService.selectedRangeWorksheet && (selectAllService.rangesStack = [], selectAllService.selectedRangeWorksheet = id);
996
999
  const maxRow = worksheet.getMaxRows(), maxCol = worksheet.getMaxColumns(), { expandToGapFirst, loop } = params, { range, primary } = selection, isWholeSheetSelected = range.endColumn === maxCol - 1 && range.endRow === maxRow - 1 && range.startRow === 0 && range.startColumn === 0;
997
- RANGES_STACK.some((s) => Rectangle.equals(s, range)) || (RANGES_STACK = [], RANGES_STACK.push(range));
1000
+ selectAllService.rangesStack.some((s) => Rectangle.equals(s, range)) || (selectAllService.rangesStack = [], selectAllService.rangesStack.push(range));
998
1001
  let destRange;
999
1002
  if (isWholeSheetSelected)
1000
1003
  if (loop) {
1001
- if (RANGES_STACK.findIndex((s) => Rectangle.equals(s, range)) !== RANGES_STACK.length - 1)
1004
+ if (selectAllService.rangesStack.findIndex((s) => Rectangle.equals(s, range)) !== selectAllService.rangesStack.length - 1)
1002
1005
  return !1;
1003
- destRange = RANGES_STACK[0];
1006
+ destRange = selectAllService.rangesStack[0];
1004
1007
  } else
1005
1008
  return !1;
1006
1009
  else expandToGapFirst ? (destRange = expandToContinuousRange(range, { left: !0, right: !0, up: !0, down: !0 }, worksheet), Rectangle.equals(destRange, range) && (destRange = expandToWholeSheet(worksheet))) : destRange = expandToWholeSheet(worksheet);
1007
- return RANGES_STACK.some((s) => Rectangle.equals(s, destRange)) || RANGES_STACK.push(destRange), accessor.get(ICommandService).executeCommand(SetSelectionsOperation.id, {
1010
+ return selectAllService.rangesStack.some((s) => Rectangle.equals(s, destRange)) || selectAllService.rangesStack.push(destRange), accessor.get(ICommandService).executeCommand(SetSelectionsOperation.id, {
1008
1011
  unitId,
1009
1012
  subUnitId,
1010
1013
  selections: [
@@ -1330,7 +1333,7 @@ SheetsScrollRenderController = __decorateClass$R([
1330
1333
  __decorateParam$Q(5, IRenderManagerService),
1331
1334
  __decorateParam$Q(6, Inject(SheetScrollManagerService))
1332
1335
  ], SheetsScrollRenderController);
1333
- var I = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(I || {}), L = /* @__PURE__ */ ((E) => (E[E.View = 0] = "View", E[E.Edit = 1] = "Edit", E[E.ManageCollaborator = 2] = "ManageCollaborator", E[E.Print = 3] = "Print", E[E.Duplicate = 4] = "Duplicate", E[E.Comment = 5] = "Comment", E[E.Copy = 6] = "Copy", E[E.Share = 7] = "Share", E[E.Export = 8] = "Export", E[E.MoveWorksheet = 9] = "MoveWorksheet", E[E.DeleteWorksheet = 10] = "DeleteWorksheet", E[E.HideWorksheet = 11] = "HideWorksheet", E[E.RenameWorksheet = 12] = "RenameWorksheet", E[E.CreateWorksheet = 13] = "CreateWorksheet", E[E.SetWorksheetStyle = 14] = "SetWorksheetStyle", E[E.EditWorksheetCell = 15] = "EditWorksheetCell", E[E.InsertHyperlink = 16] = "InsertHyperlink", E[E.Sort = 17] = "Sort", E[E.Filter = 18] = "Filter", E[E.PivotTable = 19] = "PivotTable", E[E.FloatImg = 20] = "FloatImg", E[E.History = 21] = "History", E[E.RwHgtClWdt = 22] = "RwHgtClWdt", E[E.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", E[E.ViewFilter = 24] = "ViewFilter", E[E.MoveSheet = 25] = "MoveSheet", E[E.DeleteSheet = 26] = "DeleteSheet", E[E.HideSheet = 27] = "HideSheet", E[E.CopySheet = 28] = "CopySheet", E[E.RenameSheet = 29] = "RenameSheet", E[E.CreateSheet = 30] = "CreateSheet", E[E.SelectProtectedCells = 31] = "SelectProtectedCells", E[E.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", E[E.SetCellStyle = 33] = "SetCellStyle", E[E.SetCellValue = 34] = "SetCellValue", E[E.SetRowStyle = 35] = "SetRowStyle", E[E.SetColumnStyle = 36] = "SetColumnStyle", E[E.InsertRow = 37] = "InsertRow", E[E.InsertColumn = 38] = "InsertColumn", E[E.DeleteRow = 39] = "DeleteRow", E[E.DeleteColumn = 40] = "DeleteColumn", E[E.EditExtraObject = 41] = "EditExtraObject", E[E.Delete = 42] = "Delete", E[E.RecoverHistory = 43] = "RecoverHistory", E[E.ViewHistory = 44] = "ViewHistory", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(L || {}), P = /* @__PURE__ */ ((E) => (E[E.Reader = 0] = "Reader", E[E.Editor = 1] = "Editor", E[E.Owner = 2] = "Owner", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(P || {}), M = /* @__PURE__ */ ((E) => (E[E.Unkonwn = 0] = "Unkonwn", E[E.Workbook = 1] = "Workbook", E[E.Worksheet = 2] = "Worksheet", E[E.SelectRange = 3] = "SelectRange", E[E.Document = 4] = "Document", E[E.Slide = 5] = "Slide", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(M || {}), G = /* @__PURE__ */ ((E) => (E[E.SomeCollaborator = 0] = "SomeCollaborator", E[E.AllCollaborator = 1] = "AllCollaborator", E[E.OneSelf = 2] = "OneSelf", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(G || {});
1336
+ var I = /* @__PURE__ */ ((E) => (E[E.UNIVER_UNKNOWN = 0] = "UNIVER_UNKNOWN", E[E.UNIVER_DOC = 1] = "UNIVER_DOC", E[E.UNIVER_SHEET = 2] = "UNIVER_SHEET", E[E.UNIVER_SLIDE = 3] = "UNIVER_SLIDE", E[E.UNIVER_PROJECT = 4] = "UNIVER_PROJECT", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(I || {}), P = /* @__PURE__ */ ((E) => (E[E.View = 0] = "View", E[E.Edit = 1] = "Edit", E[E.ManageCollaborator = 2] = "ManageCollaborator", E[E.Print = 3] = "Print", E[E.Duplicate = 4] = "Duplicate", E[E.Comment = 5] = "Comment", E[E.Copy = 6] = "Copy", E[E.Share = 7] = "Share", E[E.Export = 8] = "Export", E[E.MoveWorksheet = 9] = "MoveWorksheet", E[E.DeleteWorksheet = 10] = "DeleteWorksheet", E[E.HideWorksheet = 11] = "HideWorksheet", E[E.RenameWorksheet = 12] = "RenameWorksheet", E[E.CreateWorksheet = 13] = "CreateWorksheet", E[E.SetWorksheetStyle = 14] = "SetWorksheetStyle", E[E.EditWorksheetCell = 15] = "EditWorksheetCell", E[E.InsertHyperlink = 16] = "InsertHyperlink", E[E.Sort = 17] = "Sort", E[E.Filter = 18] = "Filter", E[E.PivotTable = 19] = "PivotTable", E[E.FloatImg = 20] = "FloatImg", E[E.History = 21] = "History", E[E.RwHgtClWdt = 22] = "RwHgtClWdt", E[E.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", E[E.ViewFilter = 24] = "ViewFilter", E[E.MoveSheet = 25] = "MoveSheet", E[E.DeleteSheet = 26] = "DeleteSheet", E[E.HideSheet = 27] = "HideSheet", E[E.CopySheet = 28] = "CopySheet", E[E.RenameSheet = 29] = "RenameSheet", E[E.CreateSheet = 30] = "CreateSheet", E[E.SelectProtectedCells = 31] = "SelectProtectedCells", E[E.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", E[E.SetCellStyle = 33] = "SetCellStyle", E[E.SetCellValue = 34] = "SetCellValue", E[E.SetRowStyle = 35] = "SetRowStyle", E[E.SetColumnStyle = 36] = "SetColumnStyle", E[E.InsertRow = 37] = "InsertRow", E[E.InsertColumn = 38] = "InsertColumn", E[E.DeleteRow = 39] = "DeleteRow", E[E.DeleteColumn = 40] = "DeleteColumn", E[E.EditExtraObject = 41] = "EditExtraObject", E[E.Delete = 42] = "Delete", E[E.RecoverHistory = 43] = "RecoverHistory", E[E.ViewHistory = 44] = "ViewHistory", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(P || {}), G = /* @__PURE__ */ ((E) => (E[E.Reader = 0] = "Reader", E[E.Editor = 1] = "Editor", E[E.Owner = 2] = "Owner", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(G || {}), M = /* @__PURE__ */ ((E) => (E[E.Unkonwn = 0] = "Unkonwn", E[E.Workbook = 1] = "Workbook", E[E.Worksheet = 2] = "Worksheet", E[E.SelectRange = 3] = "SelectRange", E[E.Document = 4] = "Document", E[E.Slide = 5] = "Slide", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(M || {}), H = /* @__PURE__ */ ((E) => (E[E.SomeCollaborator = 0] = "SomeCollaborator", E[E.AllCollaborator = 1] = "AllCollaborator", E[E.OneSelf = 2] = "OneSelf", E[E.UNRECOGNIZED = -1] = "UNRECOGNIZED", E))(H || {});
1334
1337
  function getActiveSheet$(univerInstanceService) {
1335
1338
  return univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(switchMap((workbook) => workbook ? workbook.activeSheet$.pipe(map((worksheet) => worksheet ? { workbook, worksheet } : null)) : of(null)));
1336
1339
  }
@@ -1388,7 +1391,7 @@ function getBaseRangeMenuHidden$(accessor) {
1388
1391
  for (let row = startRow; row <= endRow; row++)
1389
1392
  for (let col = startColumn; col <= endColumn; col++) {
1390
1393
  const permission = (_b = (_a60 = worksheet.getCell(row, col)) == null ? void 0 : _a60.selectionProtection) == null ? void 0 : _b[0];
1391
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
1394
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
1392
1395
  return !0;
1393
1396
  }
1394
1397
  return !1;
@@ -1414,7 +1417,7 @@ function getInsertAfterMenuHidden$(accessor, type) {
1414
1417
  for (let row = startRow; row <= endRow; row++)
1415
1418
  for (let col = startColumn; col <= endColumn; col++) {
1416
1419
  const permission = (_b = (_a60 = worksheet.getCell(row, col)) == null ? void 0 : _a60.selectionProtection) == null ? void 0 : _b[0];
1417
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
1420
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
1418
1421
  return !0;
1419
1422
  }
1420
1423
  return !1;
@@ -1440,7 +1443,7 @@ function getInsertBeforeMenuHidden$(accessor, type) {
1440
1443
  for (let row = startRow; row <= endRow; row++)
1441
1444
  for (let col = startColumn; col <= endColumn; col++) {
1442
1445
  const permission = (_b = (_a60 = worksheet.getCell(row, col)) == null ? void 0 : _a60.selectionProtection) == null ? void 0 : _b[0];
1443
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
1446
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
1444
1447
  return !0;
1445
1448
  }
1446
1449
  return !1;
@@ -1466,7 +1469,7 @@ function getDeleteMenuHidden$(accessor, type) {
1466
1469
  for (let row = startRow; row <= endRow; row++)
1467
1470
  for (let col = startColumn; col <= endColumn; col++) {
1468
1471
  const permission = (_b = (_a60 = worksheet.getCell(row, col)) == null ? void 0 : _a60.selectionProtection) == null ? void 0 : _b[0];
1469
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
1472
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
1470
1473
  return !0;
1471
1474
  }
1472
1475
  return !1;
@@ -1492,7 +1495,7 @@ function getCellMenuHidden$(accessor, type) {
1492
1495
  for (let row = startRow; row <= endRow; row++)
1493
1496
  for (let col = startColumn; col <= endColumn; col++) {
1494
1497
  const permission = (_b = (_a60 = worksheet.getCell(row, col)) == null ? void 0 : _a60.selectionProtection) == null ? void 0 : _b[0];
1495
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
1498
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
1496
1499
  return !0;
1497
1500
  }
1498
1501
  return !1;
@@ -2500,7 +2503,9 @@ const IAutoFillService = createIdentifier("univer.auto-fill-service"), AutoFillC
2500
2503
  redoMutations: [{ id: SetRangeValuesMutation.id, params: clearMutationParams }]
2501
2504
  }), !0) : !1;
2502
2505
  }, "handler")
2503
- }, RANGE_MOVE_PERMISSION_CHECK = createInterceptorKey("rangeMovePermissionCheck"), RANGE_FILL_PERMISSION_CHECK = createInterceptorKey("rangeFillPermissionCheck"), _SelectionRenderModel = class _SelectionRenderModel {
2506
+ }, RANGE_MOVE_PERMISSION_CHECK = createInterceptorKey("rangeMovePermissionCheck"), RANGE_FILL_PERMISSION_CHECK = createInterceptorKey("rangeFillPermissionCheck");
2507
+ var SELECTION_SHAPE_DEPTH = /* @__PURE__ */ ((SELECTION_SHAPE_DEPTH2) => (SELECTION_SHAPE_DEPTH2[SELECTION_SHAPE_DEPTH2.FORMULA_EDITOR_SHOW = 100] = "FORMULA_EDITOR_SHOW", SELECTION_SHAPE_DEPTH2[SELECTION_SHAPE_DEPTH2.MARK_SELECTION = 1e4] = "MARK_SELECTION", SELECTION_SHAPE_DEPTH2))(SELECTION_SHAPE_DEPTH || {});
2508
+ const _SelectionRenderModel = class _SelectionRenderModel {
2504
2509
  constructor() {
2505
2510
  __publicField(this, "_startColumn", -1);
2506
2511
  __publicField(this, "_startRow", -1);
@@ -2633,7 +2638,7 @@ __name(_SelectionRenderModel, "SelectionRenderModel");
2633
2638
  let SelectionRenderModel = _SelectionRenderModel;
2634
2639
  var SELECTION_MANAGER_KEY = /* @__PURE__ */ ((SELECTION_MANAGER_KEY2) => (SELECTION_MANAGER_KEY2.Selection = "__SpreadsheetSelectionShape__", SELECTION_MANAGER_KEY2.top = "__SpreadsheetSelectionTopControl__", SELECTION_MANAGER_KEY2.bottom = "__SpreadsheetSelectionBottomControl__", SELECTION_MANAGER_KEY2.left = "__SpreadsheetSelectionShapeLeftControl__", SELECTION_MANAGER_KEY2.right = "__SpreadsheetSelectionShapeRightControl__", SELECTION_MANAGER_KEY2.backgroundTop = "__SpreadsheetSelectionBackgroundControlTop__", SELECTION_MANAGER_KEY2.backgroundMiddleLeft = "__SpreadsheetSelectionBackgroundControlMiddleLeft__", SELECTION_MANAGER_KEY2.backgroundMiddleRight = "__SpreadsheetSelectionBackgroundControlMiddleRight__", SELECTION_MANAGER_KEY2.backgroundBottom = "__SpreadsheetSelectionBackgroundControlBottom__", SELECTION_MANAGER_KEY2.fill = "__SpreadsheetSelectionFillControl__", SELECTION_MANAGER_KEY2.fillTopLeft = "__SpreadsheetSelectionFillControlTopLeft__", SELECTION_MANAGER_KEY2.fillBottomRight = "__SpreadsheetSelectionFillControlBottomRight__", SELECTION_MANAGER_KEY2.fillTopLeftInner = "__SpreadsheetSelectionFillControlTopLeftInner__", SELECTION_MANAGER_KEY2.fillBottomRightInner = "__SpreadsheetSelectionFillControlBottomRightInner__", SELECTION_MANAGER_KEY2.lineMain = "__SpreadsheetDragLineMainControl__", SELECTION_MANAGER_KEY2.lineContent = "__SpreadsheetDragLineContentControl__", SELECTION_MANAGER_KEY2.line = "__SpreadsheetDragLineControl__", SELECTION_MANAGER_KEY2.dash = "__SpreadsheetDragDashControl__", SELECTION_MANAGER_KEY2.rowHeaderBackground = "__SpreadSheetSelectionRowHeaderBackground__", SELECTION_MANAGER_KEY2.rowHeaderBorder = "__SpreadSheetSelectionRowHeaderBorder__", SELECTION_MANAGER_KEY2.rowHeaderGroup = "__SpreadSheetSelectionRowHeaderGroup__", SELECTION_MANAGER_KEY2.columnHeaderBackground = "__SpreadSheetSelectionColumnHeaderBackground__", SELECTION_MANAGER_KEY2.columnHeaderBorder = "__SpreadSheetSelectionColumnHeaderBorder__", SELECTION_MANAGER_KEY2.columnHeaderGroup = "__SpreadSheetSelectionColumnHeaderGroup__", SELECTION_MANAGER_KEY2.topLeftWidget = "__SpreadSheetSelectionTopLeftWidget__", SELECTION_MANAGER_KEY2.topCenterWidget = "__SpreadSheetSelectionTopCenterWidget__", SELECTION_MANAGER_KEY2.topRightWidget = "__SpreadSheetSelectionTopRightWidget__", SELECTION_MANAGER_KEY2.middleLeftWidget = "__SpreadSheetSelectionMiddleLeftWidget__", SELECTION_MANAGER_KEY2.middleRightWidget = "__SpreadSheetSelectionMiddleRightWidget__", SELECTION_MANAGER_KEY2.bottomLeftWidget = "__SpreadSheetSelectionBottomLeftWidget__", SELECTION_MANAGER_KEY2.bottomCenterWidget = "__SpreadSheetSelectionBottomCenterWidget__", SELECTION_MANAGER_KEY2.bottomRightWidget = "__SpreadSheetSelectionBottomRightWidget__", SELECTION_MANAGER_KEY2))(SELECTION_MANAGER_KEY || {});
2635
2640
  const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _SelectionControl extends Disposable {
2636
- constructor(_scene, _zIndex, _isHeaderHighlight = !0, _themeService) {
2641
+ constructor(_scene, _zIndex, _themeService, _highlightHeader = !0, options) {
2637
2642
  super();
2638
2643
  __publicField(this, "_leftControl");
2639
2644
  __publicField(this, "_rightControl");
@@ -2648,11 +2653,11 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _Selectio
2648
2653
  __publicField(this, "_rowHeaderBackground");
2649
2654
  __publicField(this, "_rowHeaderBorder");
2650
2655
  __publicField(this, "_rowHeaderGroup");
2651
- __publicField(this, "_rowHeaderHighlight");
2656
+ // private _rowHeaderHighlight!: Rect;
2652
2657
  __publicField(this, "_columnHeaderBackground");
2653
2658
  __publicField(this, "_columnHeaderBorder");
2654
2659
  __publicField(this, "_columnHeaderGroup");
2655
- __publicField(this, "_columnHeaderHighlight");
2660
+ // private _columnHeaderHighlight!: Rect;
2656
2661
  __publicField(this, "_topLeftWidget");
2657
2662
  __publicField(this, "_topCenterWidget");
2658
2663
  __publicField(this, "_topRightWidget");
@@ -2686,7 +2691,7 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _Selectio
2686
2691
  __publicField(this, "_isHelperSelection", !0);
2687
2692
  __publicField(this, "_antLineOffset", 0);
2688
2693
  __publicField(this, "_antRequestNewFrame", -1);
2689
- this._scene = _scene, this._zIndex = _zIndex, this._isHeaderHighlight = _isHeaderHighlight, this._themeService = _themeService, this._initialize();
2694
+ this._scene = _scene, this._zIndex = _zIndex, this._themeService = _themeService, this._highlightHeader = _highlightHeader, this._rowHeaderWidth = (options == null ? void 0 : options.rowHeaderWidth) || 0, this._columnHeaderHeight = (options == null ? void 0 : options.columnHeaderHeight) || 0, this._initialize();
2690
2695
  }
2691
2696
  get zIndex() {
2692
2697
  return this._zIndex;
@@ -2812,8 +2817,7 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _Selectio
2812
2817
  * invoked when update selection style & range change, invoked by updateStyle, updateRange, update
2813
2818
  */
2814
2819
  // eslint-disable-next-line max-lines-per-function
2815
- _updateControlStyleAndLayout(selectionStyle, rowHeaderWidth, columnHeaderHeight) {
2816
- this._rowHeaderWidth = rowHeaderWidth || 0, this._columnHeaderHeight = columnHeaderHeight || 0;
2820
+ _updateControlStyleAndLayout(selectionStyle) {
2817
2821
  const { startX, startY, endX, endY } = this._selectionModel, defaultStyle = this._defaultStyle, currentStyle = this.currentStyle = selectionStyle || this._currentStyle, {
2818
2822
  stroke = defaultStyle.stroke,
2819
2823
  widgets = defaultStyle.widgets,
@@ -2895,13 +2899,13 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _Selectio
2895
2899
  this.fillControl.setProps(fillProps), this.fillControl.transformByState(sizeState), this.fillControl.show();
2896
2900
  } else
2897
2901
  this.fillControl.hide();
2898
- this._updateBackgroundControl(selectionStyle), this._updateBackgroundTitle(selectionStyle, rowHeaderWidth, columnHeaderHeight), this._updateWidgets(selectionStyle), this.selectionShape.show(), this.selectionShape.translate(startX, startY), this.selectionShape.makeDirtyNoDebounce(!0);
2902
+ this._updateBackgroundControl(selectionStyle), this._updateHeaderBackground(selectionStyle), this._updateWidgets(selectionStyle), this.selectionShape.show(), this.selectionShape.translate(startX, startY), this.selectionShape.makeDirtyNoDebounce(!0);
2899
2903
  }
2900
2904
  updateStyle(style) {
2901
- this._updateControlStyleAndLayout(style, this._rowHeaderWidth, this._columnHeaderHeight);
2905
+ this._updateControlStyleAndLayout(style);
2902
2906
  }
2903
2907
  updateRange(range, primaryCell) {
2904
- this._selectionModel.setValue(range, primaryCell), this._updateControlStyleAndLayout(this._currentStyle, this._rowHeaderWidth, this._columnHeaderHeight);
2908
+ this._selectionModel.setValue(range, primaryCell), this._updateControlStyleAndLayout(this._currentStyle);
2905
2909
  }
2906
2910
  /**
2907
2911
  * update selection model with new range & primary cell(aka: highlight/current), also update row/col selection size & style.
@@ -2913,7 +2917,7 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _Selectio
2913
2917
  * @param primaryCell primary cell
2914
2918
  */
2915
2919
  update(newSelectionRange, rowHeaderWidth = 0, columnHeaderHeight = 0, style, primaryCell) {
2916
- this._selectionModel.setValue(newSelectionRange, primaryCell), this._updateControlStyleAndLayout(style || this._currentStyle, rowHeaderWidth, columnHeaderHeight);
2920
+ this._selectionModel.setValue(newSelectionRange, primaryCell), this._rowHeaderWidth = rowHeaderWidth, this._columnHeaderHeight = columnHeaderHeight, this._updateControlStyleAndLayout(style || this._currentStyle);
2917
2921
  }
2918
2922
  /**
2919
2923
  * update primary range
@@ -2923,7 +2927,7 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _Selectio
2923
2927
  this._selectionModel.setCurrentCell(primaryCell);
2924
2928
  }
2925
2929
  clearHighlight() {
2926
- this._selectionModel.clearCurrentCell(), this._updateControlStyleAndLayout(this._currentStyle, this._rowHeaderWidth, this._columnHeaderHeight);
2930
+ this._selectionModel.clearCurrentCell(), this._updateControlStyleAndLayout(this._currentStyle);
2927
2931
  }
2928
2932
  getScene() {
2929
2933
  return this._scene;
@@ -3037,12 +3041,12 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _Selectio
3037
3041
  scene.addObject(this._selectionShapeGroup, SHEET_COMPONENT_SELECTION_LAYER_INDEX), this.disposeWithMe(
3038
3042
  toDisposable(
3039
3043
  scene.onTransformChange$.subscribeEvent((state) => {
3040
- state.type === TRANSFORM_CHANGE_OBSERVABLE_TYPE.scale && this._updateControlStyleAndLayout(this._currentStyle, this._rowHeaderWidth, this._columnHeaderHeight);
3044
+ state.type === TRANSFORM_CHANGE_OBSERVABLE_TYPE.scale && this._updateControlStyleAndLayout(this._currentStyle);
3041
3045
  })
3042
3046
  )
3043
- ), this._initialTitle();
3047
+ ), this._initialHeader();
3044
3048
  }
3045
- _initialTitle() {
3049
+ _initialHeader() {
3046
3050
  const zIndex = this._zIndex;
3047
3051
  this._rowHeaderBackground = new Rect("__SpreadSheetSelectionRowHeaderBackground__" + zIndex, {
3048
3052
  zIndex: zIndex - 1,
@@ -3095,7 +3099,7 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _Selectio
3095
3099
  this._bottomRightWidget
3096
3100
  ];
3097
3101
  }
3098
- _updateBackgroundTitle(style, rowHeaderWidth, columnHeaderHeight) {
3102
+ _updateHeaderBackground(style) {
3099
3103
  const { startX, startY, endX, endY, rangeType } = this._selectionModel, defaultStyle = this._defaultStyle;
3100
3104
  style == null && (style = defaultStyle);
3101
3105
  const scale = this._getScale(), {
@@ -3111,9 +3115,11 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _Selectio
3111
3115
  rowHeaderStrokeWidth = defaultStyle.rowHeaderStrokeWidth,
3112
3116
  columnHeaderStrokeWidth = defaultStyle.columnHeaderStrokeWidth
3113
3117
  } = style;
3114
- if (rowHeaderStrokeWidth /= scale, columnHeaderStrokeWidth /= scale, hasColumnHeader === !0) {
3118
+ rowHeaderStrokeWidth /= scale, columnHeaderStrokeWidth /= scale;
3119
+ const rowHeaderWidth = this._rowHeaderWidth, columnHeaderHeight = this._columnHeaderHeight;
3120
+ if (hasColumnHeader === !0) {
3115
3121
  let highlightTitleColor = columnHeaderFill;
3116
- this._isHeaderHighlight && rangeType === RANGE_TYPE.COLUMN && (highlightTitleColor = new ColorKit(stroke).setAlpha(SELECTION_TITLE_HIGHLIGHT_ALPHA).toString()), this._columnHeaderBackground.setProps({
3122
+ this._highlightHeader && rangeType === RANGE_TYPE.COLUMN && (highlightTitleColor = new ColorKit(stroke).setAlpha(SELECTION_TITLE_HIGHLIGHT_ALPHA).toString()), this._columnHeaderBackground.setProps({
3117
3123
  fill: highlightTitleColor
3118
3124
  }), this._columnHeaderBackground.resize(endX - startX, columnHeaderHeight), this._columnHeaderBorder.setProps({
3119
3125
  fill: columnHeaderStroke
@@ -3126,7 +3132,7 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = 0.3, _SelectionControl = class _Selectio
3126
3132
  this._columnHeaderGroup.hide();
3127
3133
  if (this._columnHeaderGroup.makeDirty(!0), hasRowHeader === !0) {
3128
3134
  let highlightTitleColor = rowHeaderFill;
3129
- this._isHeaderHighlight && rangeType === RANGE_TYPE.ROW && (highlightTitleColor = new ColorKit(stroke).setAlpha(SELECTION_TITLE_HIGHLIGHT_ALPHA).toString()), this._rowHeaderBackground.setProps({
3135
+ this._highlightHeader && rangeType === RANGE_TYPE.ROW && (highlightTitleColor = new ColorKit(stroke).setAlpha(SELECTION_TITLE_HIGHLIGHT_ALPHA).toString()), this._rowHeaderBackground.setProps({
3130
3136
  fill: highlightTitleColor
3131
3137
  }), this._rowHeaderBackground.resize(rowHeaderWidth, endY - startY), this._rowHeaderBorder.setProps({
3132
3138
  fill: rowHeaderStroke
@@ -3800,6 +3806,7 @@ const ISheetSelectionRenderService = createIdentifier("univer.sheet.selection-re
3800
3806
  __publicField(this, "_selectionMoving", !1);
3801
3807
  __publicField(this, "_activeViewport");
3802
3808
  __publicField(this, "interceptor", new InterceptorManager({ RANGE_MOVE_PERMISSION_CHECK, RANGE_FILL_PERMISSION_CHECK }));
3809
+ __publicField(this, "_escapeShortcutDisposable", null);
3803
3810
  this._injector = _injector, this._themeService = _themeService, this._shortcutService = _shortcutService, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._resetSelectionStyle(), this._initMoving();
3804
3811
  }
3805
3812
  get selectionMoving() {
@@ -3837,7 +3844,7 @@ const ISheetSelectionRenderService = createIdentifier("univer.sheet.selection-re
3837
3844
  const skeleton = this._skeleton, style = (_a59 = selection.style) != null ? _a59 : getNormalSelectionStyle(this._themeService), scene = this._scene;
3838
3845
  if (!scene || !skeleton)
3839
3846
  return;
3840
- const { rangeWithCoord, primaryWithCoord } = selection, { rangeType } = rangeWithCoord, control = this.newSelectionControl(scene, rangeType || RANGE_TYPE.NORMAL);
3847
+ const { rangeWithCoord, primaryWithCoord } = selection, { rangeType } = rangeWithCoord, control = this.newSelectionControl(scene, rangeType || RANGE_TYPE.NORMAL, skeleton);
3841
3848
  new SelectionShapeExtension(control, skeleton, scene, this._themeService, this._injector, {
3842
3849
  selectionMoveEnd: /* @__PURE__ */ __name(() => {
3843
3850
  this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
@@ -3846,8 +3853,11 @@ const ISheetSelectionRenderService = createIdentifier("univer.sheet.selection-re
3846
3853
  const { rowHeaderWidth, columnHeaderHeight } = skeleton;
3847
3854
  control.update(rangeWithCoord, rowHeaderWidth, columnHeaderHeight, style, primaryWithCoord);
3848
3855
  }
3849
- newSelectionControl(scene, _rangeType) {
3850
- const selectionControls = this.getSelectionControls(), control = new SelectionControl(scene, selectionControls.length, this._isHeaderHighlight, this._themeService);
3856
+ newSelectionControl(scene, _rangeType, skeleton) {
3857
+ const zIndex = this.getSelectionControls().length, { rowHeaderWidth, columnHeaderHeight } = skeleton, control = new SelectionControl(scene, zIndex, this._themeService, this._isHeaderHighlight, {
3858
+ rowHeaderWidth,
3859
+ columnHeaderHeight
3860
+ });
3851
3861
  return this._selectionControls.push(control), control;
3852
3862
  }
3853
3863
  /**
@@ -3933,7 +3943,8 @@ const ISheetSelectionRenderService = createIdentifier("univer.sheet.selection-re
3933
3943
  return controls[controls.length - 1];
3934
3944
  }
3935
3945
  endSelection() {
3936
- this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), this._shortcutService.setDisable(!1);
3946
+ var _a59;
3947
+ this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (_a59 = this._escapeShortcutDisposable) == null || _a59.dispose(), this._escapeShortcutDisposable = null;
3937
3948
  }
3938
3949
  /**
3939
3950
  * Clear existed selections.
@@ -3996,12 +4007,13 @@ const ISheetSelectionRenderService = createIdentifier("univer.sheet.selection-re
3996
4007
  activeSelectionControl,
3997
4008
  cursorCellRangeWithRangeType,
3998
4009
  primaryCursorCellRange
3999
- ) : (activeSelectionControl = this.newSelectionControl(scene, rangeType), this._updateSelectionControlByRange(
4010
+ ) : (activeSelectionControl = this.newSelectionControl(scene, rangeType, skeleton), this._updateSelectionControlByRange(
4000
4011
  activeSelectionControl,
4001
4012
  cursorCellRangeWithRangeType,
4002
4013
  primaryCursorCellRange
4003
- )), this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), scene.disableEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (_a59 = scene.getTransformer()) == null || _a59.clearSelectedObjects(), (rangeType === RANGE_TYPE.ROW || rangeType === RANGE_TYPE.COLUMN) && (rangeType === RANGE_TYPE.ROW ? viewportPosX = 0 : rangeType === RANGE_TYPE.COLUMN && (viewportPosY = 0), this._movingHandler(viewportPosX, viewportPosY, activeSelectionControl, rangeType)), this._setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType, viewportPosX, viewportPosY), this._shortcutService.setDisable(!0), this._scenePointerUpSub = scene.onPointerUp$.subscribeEvent(() => {
4004
- this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), this._shortcutService.setDisable(!1);
4014
+ )), this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), scene.disableEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (_a59 = scene.getTransformer()) == null || _a59.clearSelectedObjects(), (rangeType === RANGE_TYPE.ROW || rangeType === RANGE_TYPE.COLUMN) && (rangeType === RANGE_TYPE.ROW ? viewportPosX = 0 : rangeType === RANGE_TYPE.COLUMN && (viewportPosY = 0), this._movingHandler(viewportPosX, viewportPosY, activeSelectionControl, rangeType)), this._setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType, viewportPosX, viewportPosY), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = scene.onPointerUp$.subscribeEvent(() => {
4015
+ var _a60;
4016
+ this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (_a60 = this._escapeShortcutDisposable) == null || _a60.dispose(), this._escapeShortcutDisposable = null;
4005
4017
  });
4006
4018
  }
4007
4019
  /**
@@ -4098,7 +4110,7 @@ const ISheetSelectionRenderService = createIdentifier("univer.sheet.selection-re
4098
4110
  rangeType === RANGE_TYPE.ROW ? offsetX = Number.POSITIVE_INFINITY : rangeType === RANGE_TYPE.COLUMN && (offsetY = Number.POSITIVE_INFINITY);
4099
4111
  const cursorCellRangeInfo = this._getCellRangeByCursorPosition(offsetX, offsetY, scaleX, scaleY, scrollXY);
4100
4112
  if (!cursorCellRangeInfo)
4101
- return !1;
4113
+ return;
4102
4114
  const { rangeWithCoord: cursorCellRange } = cursorCellRangeInfo, activeCellRange = this._startRangeWhenPointerDown;
4103
4115
  let newSelectionRange = {
4104
4116
  startRow: Math.min(cursorCellRange.startRow, activeCellRange.startRow),
@@ -4107,7 +4119,7 @@ const ISheetSelectionRenderService = createIdentifier("univer.sheet.selection-re
4107
4119
  endColumn: Math.max(cursorCellRange.endColumn, activeCellRange.endColumn)
4108
4120
  };
4109
4121
  if (this._shouldDetectMergedCells && (newSelectionRange = skeleton.getSelectionMergeBounding(newSelectionRange.startRow, newSelectionRange.startColumn, newSelectionRange.endRow, newSelectionRange.endColumn)), !newSelectionRange)
4110
- return !1;
4122
+ return;
4111
4123
  const startCellXY = skeleton.getNoMergeCellPositionByIndex(newSelectionRange.startRow, newSelectionRange.startColumn), endCellXY = skeleton.getNoMergeCellPositionByIndex(newSelectionRange.endRow, newSelectionRange.endColumn), newSelectionRangeWithCoord = {
4112
4124
  startRow: newSelectionRange.startRow,
4113
4125
  startColumn: newSelectionRange.startColumn,
@@ -4372,7 +4384,7 @@ let EditorBridgeService = (_a7 = class extends Disposable {
4372
4384
  }
4373
4385
  documentLayoutObject = blankModel;
4374
4386
  }
4375
- if ((_b = documentLayoutObject.documentModel) == null || _b.setZoomRatio(Math.max(scaleX, scaleY)), (cell == null ? void 0 : cell.isInArrayFormulaRange) === !0) {
4387
+ if (documentLayoutObject.fill = documentLayoutObject.fill || "#fff", (_b = documentLayoutObject.documentModel) == null || _b.setZoomRatio(Math.max(scaleX, scaleY)), (cell == null ? void 0 : cell.isInArrayFormulaRange) === !0) {
4376
4388
  const body = (_c = documentLayoutObject.documentModel) == null ? void 0 : _c.getBody();
4377
4389
  body && (body.textRuns = [
4378
4390
  {
@@ -5743,7 +5755,7 @@ var __defProp$K = Object.defineProperty, __getOwnPropDesc$K = Object.getOwnPrope
5743
5755
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
5744
5756
  return kind && result && __defProp$K(target, key, result), result;
5745
5757
  }, "__decorateClass$K"), __decorateParam$J = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$J");
5746
- const DEFAULT_Z_INDEX = 1e4, IMarkSelectionService = createIdentifier("univer.mark-selection-service");
5758
+ const DEFAULT_Z_INDEX = SELECTION_SHAPE_DEPTH.MARK_SELECTION, IMarkSelectionService = createIdentifier("univer.mark-selection-service");
5747
5759
  var _a11;
5748
5760
  let MarkSelectionService = (_a11 = class extends Disposable {
5749
5761
  constructor(_currentService, _renderManagerService, _themeService) {
@@ -5773,14 +5785,16 @@ let MarkSelectionService = (_a11 = class extends Disposable {
5773
5785
  this._shapeMap.forEach((shape) => {
5774
5786
  var _a60;
5775
5787
  const { unitId, subUnitId, selection, control: oldControl, zIndex } = shape;
5776
- if (oldControl && oldControl.dispose(), unitId !== currentUnitId || subUnitId !== currentSubUnitId)
5788
+ if (oldControl == null || oldControl.dispose(), unitId !== currentUnitId || subUnitId !== currentSubUnitId)
5777
5789
  return;
5778
- const { style } = selection, renderUnit = this._renderManagerService.getRenderById(unitId);
5790
+ const renderUnit = this._renderManagerService.getRenderById(unitId);
5779
5791
  if (!renderUnit) return;
5780
5792
  const skeleton = (_a60 = this._renderManagerService.withCurrentTypeOfUnit(UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService)) == null ? void 0 : _a60.getCurrentSkeleton();
5781
5793
  if (!skeleton) return;
5782
- const { scene } = renderUnit, { rowHeaderWidth, columnHeaderHeight } = skeleton, control = new SelectionControl(scene, zIndex, !1, this._themeService), { rangeWithCoord, primaryWithCoord } = renderUnit.with(ISheetSelectionRenderService).attachSelectionWithCoord(selection);
5783
- control.update(rangeWithCoord, rowHeaderWidth, columnHeaderHeight, style, primaryWithCoord), shape.control = control;
5794
+ const { scene } = renderUnit, { rowHeaderWidth, columnHeaderHeight } = skeleton, control = new SelectionControl(scene, zIndex, this._themeService, !1, { rowHeaderWidth, columnHeaderHeight }), { rangeWithCoord, primaryWithCoord } = renderUnit.with(ISheetSelectionRenderService).attachSelectionWithCoord(selection);
5795
+ control.updateRange(rangeWithCoord, primaryWithCoord);
5796
+ const { style } = selection;
5797
+ style && control.updateStyle(style), shape.control = control;
5784
5798
  });
5785
5799
  }
5786
5800
  getShapeMap() {
@@ -5790,12 +5804,12 @@ let MarkSelectionService = (_a11 = class extends Disposable {
5790
5804
  const shapeInfo = this._shapeMap.get(id);
5791
5805
  if (!shapeInfo) return;
5792
5806
  const { control } = shapeInfo;
5793
- control && control.dispose(), this._shapeMap.delete(id);
5807
+ control == null || control.dispose(), this._shapeMap.delete(id);
5794
5808
  }
5795
5809
  removeAllShapes() {
5796
5810
  for (const shape of this._shapeMap.values()) {
5797
5811
  const { control } = shape;
5798
- control && control.dispose();
5812
+ control == null || control.dispose();
5799
5813
  }
5800
5814
  this._shapeMap.clear();
5801
5815
  }
@@ -5846,7 +5860,7 @@ let FormatPainterService = (_a12 = class extends Disposable {
5846
5860
  }
5847
5861
  setStatus(status) {
5848
5862
  this._updateRangeMark(status), this._status$.next(status), this.getHooks().forEach((hook) => {
5849
- hook.onStatusChange(status);
5863
+ hook.onStatusChange !== void 0 && hook.onStatusChange(status);
5850
5864
  });
5851
5865
  }
5852
5866
  getStatus() {
@@ -5861,14 +5875,27 @@ let FormatPainterService = (_a12 = class extends Disposable {
5861
5875
  applyFormatPainter(unitId, subUnitId, range) {
5862
5876
  const hooks = this.getHooks(), redoMutationsInfo = [], undoMutationsInfo = [];
5863
5877
  hooks.forEach((h) => {
5864
- const applyReturn = h.onApply(
5878
+ if (h.onApply !== void 0) {
5879
+ const applyReturn = h.onApply(
5880
+ unitId,
5881
+ subUnitId,
5882
+ range,
5883
+ this._selectionFormat
5884
+ );
5885
+ applyReturn && (redoMutationsInfo.push(...applyReturn.redos), undoMutationsInfo.push(...applyReturn.undos));
5886
+ }
5887
+ });
5888
+ for (const beforeHook of hooks)
5889
+ if (beforeHook.onBeforeApply !== void 0 && !beforeHook.onBeforeApply({
5865
5890
  unitId,
5866
5891
  subUnitId,
5867
5892
  range,
5868
- this._selectionFormat
5869
- );
5870
- applyReturn && (redoMutationsInfo.push(...applyReturn.redos), undoMutationsInfo.push(...applyReturn.undos));
5871
- }), this._logService.log("[FormatPainterService]", "apply mutations", {
5893
+ redoMutationsInfo,
5894
+ format: this._selectionFormat,
5895
+ undoMutationsInfo
5896
+ }))
5897
+ return !1;
5898
+ this._logService.log("[FormatPainterService]", "apply mutations", {
5872
5899
  undoMutationsInfo,
5873
5900
  redoMutationsInfo
5874
5901
  });
@@ -6858,13 +6885,20 @@ const ICellEditorManagerService = createIdentifier(
6858
6885
  id: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
6859
6886
  body: {
6860
6887
  dataStream: `${DEFAULT_EMPTY_DOCUMENT_VALUE}`,
6888
+ tables: [],
6861
6889
  textRuns: [],
6862
6890
  paragraphs: [
6863
6891
  {
6864
6892
  startIndex: 0
6865
6893
  }
6894
+ ],
6895
+ sectionBreaks: [
6896
+ {
6897
+ startIndex: 1
6898
+ }
6866
6899
  ]
6867
6900
  },
6901
+ tableSource: {},
6868
6902
  documentStyle: {
6869
6903
  documentFlavor: DocumentFlavor.MODERN
6870
6904
  }
@@ -7121,12 +7155,17 @@ function FormulaBar() {
7121
7155
  body: {
7122
7156
  dataStream: `${DEFAULT_EMPTY_DOCUMENT_VALUE}`,
7123
7157
  textRuns: [],
7158
+ tables: [],
7124
7159
  paragraphs: [
7125
7160
  {
7126
7161
  startIndex: 0
7127
7162
  }
7128
- ]
7163
+ ],
7164
+ sectionBreaks: [{
7165
+ startIndex: 1
7166
+ }]
7129
7167
  },
7168
+ tableSource: {},
7130
7169
  documentStyle: {
7131
7170
  pageSize: {
7132
7171
  width: Number.POSITIVE_INFINITY,
@@ -7592,8 +7631,13 @@ function handleStyle(cssRule, cssValue, docStyles) {
7592
7631
  break;
7593
7632
  }
7594
7633
  case "color": {
7595
- const color = new ColorKit(cssValue);
7596
- color.isValid && (docStyles.cl = { rgb: color.toRgbString() });
7634
+ try {
7635
+ const color = new ColorKit(cssValue);
7636
+ color.isValid && (docStyles.cl = {
7637
+ rgb: color.toRgbString()
7638
+ });
7639
+ } catch {
7640
+ }
7597
7641
  break;
7598
7642
  }
7599
7643
  case "background-color": {
@@ -8032,7 +8076,19 @@ __name(parseProperties, "parseProperties");
8032
8076
  function parseColGroup(raw) {
8033
8077
  const COLGROUP_TAG_REGEX = /<colgroup([\s\S]*?)>(.*?)<\/colgroup>/, colgroupMatch = raw.match(COLGROUP_TAG_REGEX), COL_TAG_REGEX = /<col([\s\S]*?)>/g;
8034
8078
  let colMatches;
8035
- return colgroupMatch != null && colgroupMatch[2] ? colMatches = colgroupMatch[2].matchAll(COL_TAG_REGEX) : colMatches = raw.matchAll(COL_TAG_REGEX), colMatches ? Array.from(colMatches).map((colMatch) => parseProperties(colMatch[1])) : null;
8079
+ if (colgroupMatch != null && colgroupMatch[2] ? colMatches = colgroupMatch[2].matchAll(COL_TAG_REGEX) : colMatches = raw.matchAll(COL_TAG_REGEX), !colMatches)
8080
+ return null;
8081
+ const colPropertiesWithSpan = Array.from(colMatches).map((colMatch) => parseProperties(colMatch[1])), colProperties = [];
8082
+ return colPropertiesWithSpan.forEach((propertiesWithSpan) => {
8083
+ const span = Number(propertiesWithSpan.span);
8084
+ if (span)
8085
+ for (let i = 0; i < span; i++) {
8086
+ const propertiesWithoutSpan = { ...propertiesWithSpan };
8087
+ delete propertiesWithoutSpan.span, colProperties.push(propertiesWithoutSpan);
8088
+ }
8089
+ else
8090
+ colProperties.push(propertiesWithSpan);
8091
+ }), colProperties;
8036
8092
  }
8037
8093
  __name(parseColGroup, "parseColGroup");
8038
8094
  function decodeHTMLEntities(input) {
@@ -8549,6 +8605,7 @@ let SheetClipboardService = (_a13 = class extends Disposable {
8549
8605
  pasteType
8550
8606
  );
8551
8607
  }
8608
+ // eslint-disable-next-line max-lines-per-function
8552
8609
  async _pasteInternal(copyId, pasteType) {
8553
8610
  var _a59, _b;
8554
8611
  const cachedData = Tools.deepClone(this._copyContentCache.get(copyId)), { range, matrix: cellMatrix, unitId: copyUnitId, subUnitId: copySubUnitId } = cachedData || {};
@@ -8570,13 +8627,17 @@ let SheetClipboardService = (_a13 = class extends Disposable {
8570
8627
  });
8571
8628
  const pasteTarget = this._getPastedRange(cellMatrix);
8572
8629
  if (!pasteTarget) return !1;
8573
- const worksheet = (_b = this._univerInstanceService.getUniverSheetInstance(pasteTarget.unitId)) == null ? void 0 : _b.getSheetBySheetId(pasteTarget.subUnitId);
8574
- if (!worksheet)
8630
+ const pasteToWorksheet = (_b = this._univerInstanceService.getUniverSheetInstance(pasteTarget.unitId)) == null ? void 0 : _b.getSheetBySheetId(pasteTarget.subUnitId);
8631
+ if (!pasteToWorksheet)
8575
8632
  return !1;
8576
- const mergeData = worksheet == null ? void 0 : worksheet.getMergeData();
8633
+ const mergeData = pasteToWorksheet == null ? void 0 : pasteToWorksheet.getMergeData();
8577
8634
  if (mergeData && mergeData.some((m2) => rangeIntersectWithDiscreteRange(m2, pasteTarget.pastedRange) && !discreteRangeContainsRange(pasteTarget.pastedRange, m2)))
8578
8635
  return this._errorService.emit(this._localeService.t("clipboard.paste.overlappingMergedCells")), !1;
8579
- const colManager = worksheet.getColumnManager(), rowManager = worksheet.getRowManager(), defaultColumnWidth = worksheet.getConfig().defaultColumnWidth, defaultRowHeight = worksheet.getConfig().defaultRowHeight, colProperties = [], rowProperties = [];
8636
+ const pasteFromWorkbook = this._univerInstanceService.getUnit(copyUnitId);
8637
+ if (!pasteFromWorkbook) return !1;
8638
+ const pasteFromWorksheet = pasteFromWorkbook.getSheetBySheetId(copySubUnitId);
8639
+ if (!pasteFromWorksheet) return !1;
8640
+ const colManager = pasteFromWorksheet.getColumnManager(), rowManager = pasteFromWorksheet.getRowManager(), defaultColumnWidth = pasteFromWorksheet.getConfig().defaultColumnWidth, defaultRowHeight = pasteFromWorksheet.getConfig().defaultRowHeight, colProperties = [], rowProperties = [];
8580
8641
  if (range.cols.forEach((i) => {
8581
8642
  const column = colManager.getColumnOrCreate(i);
8582
8643
  colProperties.push({ width: `${column.w || defaultColumnWidth}` });
@@ -8758,6 +8819,7 @@ let SheetClipboardService = (_a13 = class extends Disposable {
8758
8819
  * @param cellMatrix
8759
8820
  * @param range
8760
8821
  */
8822
+ // eslint-disable-next-line max-lines-per-function, complexity
8761
8823
  _transformPastedData(rowCount, colCount, cellMatrix) {
8762
8824
  const target = this._getPastingTarget(), { selection, unitId, subUnitId } = target;
8763
8825
  if (!subUnitId || !selection)
@@ -9811,7 +9873,7 @@ function FrozenMenuItemFactory(accessor) {
9811
9873
  positions: [SHEET_FROZEN_MENU_ID, SHEET_FROZEN_HEADER_MENU_ID],
9812
9874
  title: "rightClick.freeze",
9813
9875
  icon: "FreezeToSelectedSingle",
9814
- disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
9876
+ // disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
9815
9877
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
9816
9878
  };
9817
9879
  }
@@ -9823,7 +9885,7 @@ function FrozenRowMenuItemFactory(accessor) {
9823
9885
  positions: [SHEET_FROZEN_MENU_ID],
9824
9886
  title: "rightClick.freezeRow",
9825
9887
  icon: "FreezeRowSingle",
9826
- disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
9888
+ // disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
9827
9889
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
9828
9890
  };
9829
9891
  }
@@ -9835,7 +9897,7 @@ function FrozenColMenuItemFactory(accessor) {
9835
9897
  positions: [SHEET_FROZEN_MENU_ID],
9836
9898
  title: "rightClick.freezeCol",
9837
9899
  icon: "FreezeColumnSingle",
9838
- disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
9900
+ // disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
9839
9901
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
9840
9902
  };
9841
9903
  }
@@ -9847,7 +9909,7 @@ function CancelFrozenMenuItemFactory(accessor) {
9847
9909
  positions: [SHEET_FROZEN_MENU_ID, SHEET_FROZEN_HEADER_MENU_ID],
9848
9910
  title: "rightClick.cancelFreeze",
9849
9911
  icon: "CancelFreezeSingle",
9850
- disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
9912
+ // disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
9851
9913
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET)
9852
9914
  };
9853
9915
  }
@@ -11448,36 +11510,36 @@ const _SheetPermissionUserManagerService = class _SheetPermissionUserManagerServ
11448
11510
  __name(_SheetPermissionUserManagerService, "SheetPermissionUserManagerService");
11449
11511
  let SheetPermissionUserManagerService = _SheetPermissionUserManagerService;
11450
11512
  const UNIVER_SHEET_PERMISSION_PANEL = "UNIVER_SHEET_PERMISSION_PANEL", UNIVER_SHEET_PERMISSION_PANEL_FOOTER = "UNIVER_SHEET_PERMISSION_PANEL_FOOTER", UNIVER_SHEET_PERMISSION_USER_DIALOG = "UNIVER_SHEET_PERMISSION_USER_DIALOG", UNIVER_SHEET_PERMISSION_DIALOG = "UNIVER_SHEET_PERMISSION_DIALOG", UNIVER_SHEET_PERMISSION_USER_DIALOG_ID = "UNIVER_SHEET_PERMISSION_USER_DIALOG_ID", UNIVER_SHEET_PERMISSION_DIALOG_ID = "UNIVER_SHEET_PERMISSION_DIALOG_ID", subUnitPermissionTypeMap = {
11451
- [L.Copy]: "Copy",
11452
- [L.SetCellStyle]: "SetCellStyle",
11453
- [L.SetCellValue]: "SetCellValue",
11454
- [L.SetRowStyle]: "SetRowStyle",
11455
- [L.SetColumnStyle]: "SetColumnStyle",
11456
- [L.InsertRow]: "InsertRow",
11457
- [L.InsertColumn]: "InsertColumn",
11458
- [L.InsertHyperlink]: "InsertHyperlink",
11459
- [L.DeleteRow]: "DeleteRow",
11460
- [L.DeleteColumn]: "DeleteColumn",
11461
- [L.Sort]: "Sort",
11462
- [L.Filter]: "Filter",
11463
- [L.PivotTable]: "PivotTable",
11464
- [L.EditExtraObject]: "EditExtraObject"
11513
+ [P.Copy]: "Copy",
11514
+ [P.SetCellStyle]: "SetCellStyle",
11515
+ [P.SetCellValue]: "SetCellValue",
11516
+ [P.SetRowStyle]: "SetRowStyle",
11517
+ [P.SetColumnStyle]: "SetColumnStyle",
11518
+ [P.InsertRow]: "InsertRow",
11519
+ [P.InsertColumn]: "InsertColumn",
11520
+ [P.InsertHyperlink]: "InsertHyperlink",
11521
+ [P.DeleteRow]: "DeleteRow",
11522
+ [P.DeleteColumn]: "DeleteColumn",
11523
+ [P.Sort]: "Sort",
11524
+ [P.Filter]: "Filter",
11525
+ [P.PivotTable]: "PivotTable",
11526
+ [P.EditExtraObject]: "EditExtraObject"
11465
11527
  }, defaultWorksheetUnitActionList = [
11466
- L.Copy,
11467
- L.SetCellStyle,
11468
- L.SetCellValue,
11469
- L.SetRowStyle,
11470
- L.SetColumnStyle,
11471
- L.InsertRow,
11472
- L.InsertColumn,
11473
- L.InsertHyperlink,
11474
- L.DeleteRow,
11475
- L.DeleteColumn,
11476
- L.Sort,
11477
- L.Filter,
11478
- L.PivotTable,
11479
- L.EditExtraObject,
11480
- L.View
11528
+ P.Copy,
11529
+ P.SetCellStyle,
11530
+ P.SetCellValue,
11531
+ P.SetRowStyle,
11532
+ P.SetColumnStyle,
11533
+ P.InsertRow,
11534
+ P.InsertColumn,
11535
+ P.InsertHyperlink,
11536
+ P.DeleteRow,
11537
+ P.DeleteColumn,
11538
+ P.Sort,
11539
+ P.Filter,
11540
+ P.PivotTable,
11541
+ P.EditExtraObject,
11542
+ P.View
11481
11543
  ], permissionMenuIconKey = "sheet-permission-menu-icon", permissionDeleteIconKey = "sheet-permission-delete-icon", permissionEditIconKey = "sheet-permission-edit-icon", permissionCheckIconKey = "sheet-permission-check-icon", permissionLockIconKey = "sheet-permission-lock-icon", SheetPermissionOpenPanelOperation = {
11482
11544
  type: CommandType.OPERATION,
11483
11545
  id: "sheet-permission.operation.openPanel",
@@ -13369,11 +13431,14 @@ let SheetSelectionRenderService = (_a16 = class extends BaseSelectionRenderServi
13369
13431
  }
13370
13432
  const unitId = this._context.unitId, { sheetId, skeleton } = param, { scene } = this._context, viewportMain = scene.getViewport(SHEET_VIEWPORT_KEY$1.VIEW_MAIN), prevSheetId = (_b = (_a59 = this._skeleton) == null ? void 0 : _a59.worksheet) == null ? void 0 : _b.getSheetId();
13371
13433
  if (this._changeRuntime(skeleton, scene, viewportMain), this._normalSelectionDisabled()) return;
13372
- prevSheetId !== skeleton.worksheet.getSheetId() && (this._workbookSelections.getCurrentLastSelection() || this._commandService.syncExecuteCommand(SetSelectionsOperation.id, {
13373
- unitId,
13374
- subUnitId: sheetId,
13375
- selections: [getTopLeftSelection(skeleton)]
13376
- }));
13434
+ if (prevSheetId !== skeleton.worksheet.getSheetId()) {
13435
+ const selections = this._workbookSelections.getCurrentSelections();
13436
+ this._commandService.syncExecuteCommand(SetSelectionsOperation.id, {
13437
+ unitId,
13438
+ subUnitId: sheetId,
13439
+ selections: selections.length !== 0 ? selections : [getTopLeftSelection(skeleton)]
13440
+ });
13441
+ }
13377
13442
  const currentSelections = this._workbookSelections.getCurrentSelections();
13378
13443
  currentSelections != null && this._refreshSelectionControl(currentSelections);
13379
13444
  }));
@@ -13738,11 +13803,11 @@ function getSetCellValueMutations(pasteTo, pasteFrom, matrix, accessor) {
13738
13803
  var _a59;
13739
13804
  let originNumberValue;
13740
13805
  if (!value.p && value.v && !pasteFrom) {
13741
- const content = String(value.v), numfmtValue = numfmt.parseDate(content) || numfmt.parseTime(content) || numfmt.parseNumber(content);
13742
- numfmtValue != null && numfmtValue.v && typeof numfmtValue.v == "number" && (originNumberValue = numfmtValue.v);
13806
+ const content = String(value.v), numfmtValue = numfmt.parseValue(content);
13807
+ (numfmtValue == null ? void 0 : numfmtValue.v) !== void 0 && typeof numfmtValue.v == "number" && (originNumberValue = numfmtValue.v);
13743
13808
  }
13744
13809
  const { row: realRow, col: realCol } = mapFunc(row, col);
13745
- (_a59 = value.p) != null && _a59.body ? valueMatrix.setValue(realRow, realCol, Tools.deepClone({ p: value.p, v: originNumberValue != null ? originNumberValue : value.v })) : valueMatrix.setValue(realRow, realCol, Tools.deepClone({ v: originNumberValue != null ? originNumberValue : value.v }));
13810
+ (_a59 = value.p) != null && _a59.body ? valueMatrix.setValue(realRow, realCol, Tools.deepClone({ p: value.p, v: originNumberValue != null ? originNumberValue : value.v })) : valueMatrix.setValue(realRow, realCol, Tools.deepClone({ v: originNumberValue != null ? originNumberValue : value.v, t: value.t }));
13746
13811
  });
13747
13812
  const setValuesMutation = {
13748
13813
  unitId,
@@ -13779,7 +13844,7 @@ function getSetCellStyleMutations(pasteTo, matrix, accessor, withRichFormat = !1
13779
13844
  }, value.s)
13780
13845
  };
13781
13846
  withRichFormat && ((_a59 = value.p) != null && _a59.body) && (newValue.p = value.p);
13782
- const content = String(value.v), numfmtValue = numfmt.parseDate(content) || numfmt.parseTime(content) || numfmt.parseNumber(content);
13847
+ const content = String(value.v), numfmtValue = numfmt.parseValue(content);
13783
13848
  numfmtValue != null && numfmtValue.z && (newValue.s || (newValue.s = {}), typeof newValue.s == "object" && ((_b = newValue.s) != null && _b.n ? newValue.s.n.pattern = numfmtValue.z : newValue.s.n = { pattern: numfmtValue.z }));
13784
13849
  const { row: actualRow, col: actualCol } = mapFunc(row, col);
13785
13850
  valueMatrix.setValue(actualRow, actualCol, newValue);
@@ -14012,56 +14077,44 @@ let SheetClipboardController = (_a19 = class extends RxDisposable {
14012
14077
  }), !1) : !0;
14013
14078
  },
14014
14079
  onPasteRows(pasteTo, rowProperties) {
14015
- const { range } = pasteTo, redoMutations = [], undoMutations = [], maxRow = currentSheet.getMaxRows(), addingRowsCount = range.rows[range.rows.length - 1] - maxRow, existingRowsCount = rowProperties.length - addingRowsCount, rowManager = currentSheet.getRowManager();
14080
+ const { range } = pasteTo, redoMutations = [], undoMutations = [], maxRow = currentSheet.getMaxRows(), rowCount = maxRow - 1, addingRowsCount = range.rows[range.rows.length - 1] - rowCount, existingRowsCount = rowProperties.length - addingRowsCount, rowManager = currentSheet.getRowManager();
14016
14081
  if (addingRowsCount > 0) {
14017
14082
  const rowInfo = {};
14018
14083
  rowProperties.slice(existingRowsCount).forEach((property, index) => {
14019
- const { style, height: PropertyHeight } = property || {};
14020
- if (style) {
14021
- const cssTextArray = style.split(";");
14022
- let height = DEFAULT_WORKSHEET_ROW_HEIGHT;
14023
- cssTextArray.find((css) => {
14024
- css = css.toLowerCase();
14025
- const key = textTrim(css.substr(0, css.indexOf(":"))), value = textTrim(css.substr(css.indexOf(":") + 1));
14026
- return key === "height" ? (value.endsWith("pt") ? height = ptToPx(Number.parseFloat(value)) : height = Number.parseFloat(value), !0) : !1;
14027
- }), rowInfo[index] = {
14028
- h: height,
14029
- hd: BooleanNumber.FALSE
14030
- };
14031
- } else PropertyHeight && (rowInfo[index] = {
14084
+ const { height: PropertyHeight } = property || {};
14085
+ PropertyHeight && (rowInfo[index] = {
14032
14086
  h: Number.parseFloat(PropertyHeight),
14033
14087
  hd: BooleanNumber.FALSE
14034
14088
  });
14035
14089
  });
14036
- const addRowMutation = {
14090
+ const addRowRange = {
14091
+ startColumn: range.cols[0],
14092
+ endColumn: range.cols[range.cols.length - 1],
14093
+ endRow: range.rows[range.rows.length - 1],
14094
+ startRow: maxRow
14095
+ }, addRowMutation = {
14037
14096
  unitId,
14038
14097
  subUnitId,
14039
- range: {
14040
- startColumn: range.cols[0],
14041
- endColumn: range.cols[range.cols.length - 1],
14042
- endRow: range.rows[range.rows.length - 1],
14043
- startRow: maxRow
14044
- },
14098
+ range: addRowRange,
14045
14099
  rowInfo
14046
14100
  };
14047
14101
  redoMutations.push({
14048
14102
  id: InsertRowMutation.id,
14049
14103
  params: addRowMutation
14104
+ }), undoMutations.push({
14105
+ id: RemoveRowMutation.id,
14106
+ params: {
14107
+ unitId,
14108
+ subUnitId,
14109
+ range: addRowRange
14110
+ }
14050
14111
  });
14051
14112
  }
14052
14113
  const rowHeight = {}, originRowHeight = {};
14053
- rowProperties.slice(0, existingRowsCount).forEach((property, index) => {
14114
+ if (rowProperties.slice(0, existingRowsCount).forEach((property, index) => {
14054
14115
  var _a59, _b;
14055
- const { style, height: propertyHeight } = property;
14056
- if (style) {
14057
- const cssTextArray = style.split(";");
14058
- let height = DEFAULT_WORKSHEET_ROW_HEIGHT;
14059
- cssTextArray.find((css) => {
14060
- css = css.toLowerCase();
14061
- const key = textTrim(css.substr(0, css.indexOf(":"))), value = textTrim(css.substr(css.indexOf(":") + 1));
14062
- return key === "height" ? (value.endsWith("pt") ? height = ptToPx(Number.parseFloat(value)) : height = Number.parseFloat(value), !0) : !1;
14063
- }), rowHeight[index + range.rows[0]] = height;
14064
- } else if (propertyHeight) {
14116
+ const { height: propertyHeight } = property;
14117
+ if (propertyHeight) {
14065
14118
  const rowConfigBeforePaste = rowManager.getRow(range.rows[0] + index), willSetHeight = Number.parseFloat(propertyHeight);
14066
14119
  if (rowConfigBeforePaste) {
14067
14120
  const { h = DEFAULT_WORKSHEET_ROW_HEIGHT, ah = 0 } = rowConfigBeforePaste, nowRowHeight = Math.max(h, ah);
@@ -14069,56 +14122,65 @@ let SheetClipboardController = (_a19 = class extends RxDisposable {
14069
14122
  } else
14070
14123
  rowHeight[index + range.rows[0]] = willSetHeight, originRowHeight[index + range.rows[0]] = (_b = (_a59 = rowManager.getRow(range.rows[0] + index)) == null ? void 0 : _a59.h) != null ? _b : DEFAULT_WORKSHEET_ROW_HEIGHT;
14071
14124
  }
14072
- });
14073
- const setRowPropertyMutation = {
14074
- unitId,
14075
- subUnitId,
14076
- ranges: [{
14077
- startRow: range.rows[0],
14078
- endRow: Math.min(range.rows[range.rows.length - 1], maxRow),
14079
- startColumn: range.cols[0],
14080
- endColumn: range.cols[range.cols.length - 1]
14081
- }],
14082
- rowHeight
14083
- };
14084
- return redoMutations.push({
14085
- id: SetWorksheetRowHeightMutation.id,
14086
- params: setRowPropertyMutation
14087
- }), undoMutations.push({
14088
- id: SetWorksheetRowHeightMutation.id,
14089
- params: {
14090
- ...setRowPropertyMutation,
14091
- rowHeight: 20
14092
- }
14093
- }), {
14125
+ }), Object.keys(rowHeight).length) {
14126
+ const setRowPropertyMutation = {
14127
+ unitId,
14128
+ subUnitId,
14129
+ ranges: [{
14130
+ startRow: range.rows[0],
14131
+ endRow: Math.min(range.rows[range.rows.length - 1], maxRow),
14132
+ startColumn: range.cols[0],
14133
+ endColumn: range.cols[range.cols.length - 1]
14134
+ }],
14135
+ rowHeight
14136
+ };
14137
+ redoMutations.push({
14138
+ id: SetWorksheetRowHeightMutation.id,
14139
+ params: setRowPropertyMutation
14140
+ }), undoMutations.push({
14141
+ id: SetWorksheetRowHeightMutation.id,
14142
+ params: {
14143
+ ...setRowPropertyMutation,
14144
+ rowHeight: originRowHeight
14145
+ }
14146
+ });
14147
+ }
14148
+ return {
14094
14149
  redos: redoMutations,
14095
14150
  undos: undoMutations
14096
14151
  };
14097
14152
  },
14098
14153
  onPasteColumns(pasteTo, colProperties, pasteType) {
14099
14154
  var _a59;
14100
- const { range } = pasteTo, redoMutations = [], maxColumn = currentSheet.getMaxColumns(), addingColsCount = range.cols[range.cols.length - 1] - maxColumn, existingColsCount = colProperties.length - addingColsCount, defaultColumnWidth = (_a59 = self._configService.getConfig(DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY)) != null ? _a59 : DEFAULT_WORKSHEET_COLUMN_WIDTH;
14155
+ const { range } = pasteTo, redoMutations = [], undoMutations = [], maxColumn = currentSheet.getMaxColumns(), colCount = maxColumn - 1, addingColsCount = range.cols[range.cols.length - 1] - colCount, existingColsCount = colProperties.length - addingColsCount, defaultColumnWidth = (_a59 = self._configService.getConfig(DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY)) != null ? _a59 : DEFAULT_WORKSHEET_COLUMN_WIDTH, pasteToCols = range.cols;
14101
14156
  if (addingColsCount > 0) {
14102
- const addColMutation = {
14157
+ const addColRange = {
14158
+ startRow: range.rows[0],
14159
+ endRow: range.rows[range.rows.length - 1],
14160
+ endColumn: range.cols[range.cols.length - 1],
14161
+ startColumn: maxColumn
14162
+ }, addColMutation = {
14103
14163
  unitId,
14104
14164
  subUnitId,
14105
- range: {
14106
- startRow: range.rows[0],
14107
- endRow: range.rows[range.rows.length - 1],
14108
- endColumn: range.cols[range.cols.length - 1],
14109
- startColumn: maxColumn
14110
- },
14111
- colInfo: colProperties.slice(existingColsCount).map((property) => ({
14112
- w: property.width ? +property.width : defaultColumnWidth,
14165
+ range: addColRange,
14166
+ colInfo: colProperties.slice(existingColsCount).map((property, index) => ({
14167
+ w: property.width ? Math.max(+property.width, currentSheet.getColumnWidth(pasteToCols[index])) : defaultColumnWidth,
14113
14168
  hd: BooleanNumber.FALSE
14114
14169
  }))
14115
14170
  };
14116
14171
  redoMutations.push({
14117
14172
  id: InsertColMutation.id,
14118
14173
  params: addColMutation
14174
+ }), undoMutations.push({
14175
+ id: RemoveColMutation.id,
14176
+ params: {
14177
+ unitId,
14178
+ subUnitId,
14179
+ range: addColRange
14180
+ }
14119
14181
  });
14120
14182
  }
14121
- const setColPropertyMutation = {
14183
+ const targetSetColPropertyParams = {
14122
14184
  unitId,
14123
14185
  subUnitId,
14124
14186
  ranges: [{
@@ -14126,15 +14188,30 @@ let SheetClipboardController = (_a19 = class extends RxDisposable {
14126
14188
  endRow: range.rows[range.rows.length - 1],
14127
14189
  startColumn: range.cols[0],
14128
14190
  endColumn: Math.min(range.cols[range.cols.length - 1], maxColumn)
14129
- }],
14130
- colWidth: colProperties.slice(0, existingColsCount).map((property) => property.width ? +property.width : defaultColumnWidth)
14191
+ }]
14131
14192
  };
14132
- return redoMutations.push({
14133
- id: SetWorksheetColWidthMutation.id,
14134
- params: setColPropertyMutation
14135
- }), {
14193
+ if (colProperties.length > 0) {
14194
+ const setColPropertyMutation = {
14195
+ ...targetSetColPropertyParams,
14196
+ colWidth: colProperties.slice(0, existingColsCount).map((property, index) => property.width ? Math.max(+property.width, currentSheet.getColumnWidth(pasteToCols[index])) : defaultColumnWidth)
14197
+ }, undoSetColPropertyParams = {
14198
+ ...targetSetColPropertyParams,
14199
+ colWidth: colProperties.slice(0, existingColsCount).map((_property, index) => {
14200
+ var _a60;
14201
+ return (_a60 = currentSheet.getColumnWidth(pasteToCols[index])) != null ? _a60 : defaultColumnWidth;
14202
+ })
14203
+ };
14204
+ redoMutations.push({
14205
+ id: SetWorksheetColWidthMutation.id,
14206
+ params: setColPropertyMutation
14207
+ }), undoMutations.push({
14208
+ id: SetWorksheetColWidthMutation.id,
14209
+ params: undoSetColPropertyParams
14210
+ });
14211
+ }
14212
+ return {
14136
14213
  redos: redoMutations,
14137
- undos: []
14214
+ undos: undoMutations
14138
14215
  };
14139
14216
  },
14140
14217
  onPastePlainText(pasteTo, text, payload) {
@@ -14326,7 +14403,7 @@ let SheetClipboardController = (_a19 = class extends RxDisposable {
14326
14403
  }
14327
14404
  }, __name(_a19, "SheetClipboardController"), _a19);
14328
14405
  SheetClipboardController = __decorateClass$C([
14329
- OnLifecycle(LifecycleStages.Steady, SheetClipboardController),
14406
+ OnLifecycle(LifecycleStages.Rendered, SheetClipboardController),
14330
14407
  __decorateParam$C(0, Inject(Injector)),
14331
14408
  __decorateParam$C(1, IUniverInstanceService),
14332
14409
  __decorateParam$C(2, IRenderManagerService),
@@ -15051,6 +15128,8 @@ let EditingRenderController = (_a21 = class extends Disposable {
15051
15128
  }
15052
15129
  })), d.add(this._commandService.onCommandExecuted((command) => {
15053
15130
  command.id === ClearSelectionFormatCommand.id && this._editorBridgeService.refreshEditCellState();
15131
+ })), d.add(this._commandService.onCommandExecuted((command) => {
15132
+ command.id === SetRangeValuesMutation.id && this._editorBridgeService.refreshEditCellState();
15054
15133
  }));
15055
15134
  const closeEditorOperation = [SetCellEditVisibleArrowOperation.id];
15056
15135
  d.add(this._commandService.onCommandExecuted((command) => {
@@ -15074,6 +15153,7 @@ let EditingRenderController = (_a21 = class extends Disposable {
15074
15153
  return getEditorObject(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
15075
15154
  }
15076
15155
  async _handleEditorInvisible(param) {
15156
+ var _a59, _b;
15077
15157
  const { keycode } = param;
15078
15158
  this._setOpenForCurrent(null, null), this._cursorChange = 0, this._exitInput(param);
15079
15159
  const editCellState = this._editorBridgeService.getEditCellState();
@@ -15092,11 +15172,7 @@ let EditingRenderController = (_a21 = class extends Disposable {
15092
15172
  selections && this._commandService.syncExecuteCommand(SetSelectionsOperation.id, {
15093
15173
  unitId: this._context.unit.getUnitId(),
15094
15174
  subUnitId: worksheetId,
15095
- // must be a new selectionData
15096
- // in selection-manager.service.ts@setSelections
15097
- // this._ensureWorkbookSelection(unitIdOrSelections).setSelections
15098
- // would clear selection Data on selecitonManagerInstance.
15099
- selections: [...selections]
15175
+ selections
15100
15176
  });
15101
15177
  return;
15102
15178
  }
@@ -15128,7 +15204,7 @@ let EditingRenderController = (_a21 = class extends Disposable {
15128
15204
  )(cellData, context), finalCell = await this._editorBridgeService.interceptor.fetchThroughInterceptors(
15129
15205
  this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT_ASYNC
15130
15206
  )(Promise.resolve(cell), context);
15131
- this._commandService.executeCommand(SetRangeValuesCommand.id, {
15207
+ (_b = (_a59 = finalCell == null ? void 0 : finalCell.custom) == null ? void 0 : _a59[UNIVER_INTERNAL]) != null && _b.origin && (finalCell.custom[UNIVER_INTERNAL] = null), this._commandService.executeCommand(SetRangeValuesCommand.id, {
15132
15208
  subUnitId: sheetId,
15133
15209
  unitId,
15134
15210
  range: {
@@ -15244,23 +15320,47 @@ function getCellDataByInput(cellData, documentLayoutObject, lexerTreeBuilder, ge
15244
15320
  } else if (isForceString(newDataStream)) {
15245
15321
  const v = extractStringFromForceString(newDataStream);
15246
15322
  cellData.v = v, cellData.f = null, cellData.si = null, cellData.p = null, cellData.t = CellValueType.FORCE_STRING;
15247
- } else if (isRichText(body))
15323
+ } else if (numfmt.parseDate(newDataStream) || numfmt.parseNumber(newDataStream) || numfmt.parseTime(newDataStream))
15324
+ cellData.v = newDataStream, cellData.f = null, cellData.si = null, cellData.p = null, cellData.t = CellValueType.NUMBER;
15325
+ else if (isRichText(body))
15248
15326
  body.dataStream === `\r
15249
15327
  ` ? (cellData.v = "", cellData.f = null, cellData.si = null, cellData.p = null) : (cellData.p = snapshot, cellData.v = null, cellData.f = null, cellData.si = null);
15250
15328
  else {
15251
15329
  if ((newDataStream === cellData.v || newDataStream === "" && cellData.v == null) && cellData.p == null)
15252
15330
  return null;
15253
15331
  cellData.v = newDataStream, cellData.f = null, cellData.si = null, cellData.p = null;
15332
+ const style = getCellStyleBySnapshot(snapshot);
15333
+ style && (cellData.s = style);
15254
15334
  }
15255
- return cellData;
15335
+ return cellData.custom = {
15336
+ [UNIVER_INTERNAL]: {
15337
+ origin: { ...cellData }
15338
+ }
15339
+ }, cellData;
15256
15340
  }
15257
15341
  __name(getCellDataByInput, "getCellDataByInput");
15258
15342
  function isRichText(body) {
15259
15343
  const { textRuns = [], paragraphs = [], customRanges, customBlocks = [] } = body, bodyNoLineBreak = body.dataStream.replace(`\r
15260
- `, "");
15261
- return textRuns.some((textRun) => textRun.ts && (textRun.st !== 0 || textRun.ed !== bodyNoLineBreak.length)) || paragraphs.some((paragraph) => paragraph.bullet) || paragraphs.length >= 2 || !!(customRanges != null && customRanges.length) || customBlocks.length > 0;
15344
+ `, ""), richTextStyle = ["va"];
15345
+ return textRuns.some((textRun) => {
15346
+ var _a59;
15347
+ return !!(textRun.ts && Object.keys(textRun.ts).some((property) => richTextStyle.includes(property))) || Object.keys((_a59 = textRun.ts) != null ? _a59 : {}).length && textRun.ed - textRun.st < bodyNoLineBreak.length;
15348
+ }) || paragraphs.some((paragraph) => paragraph.bullet) || paragraphs.length >= 2 || !!(customRanges != null && customRanges.length) || customBlocks.length > 0;
15262
15349
  }
15263
15350
  __name(isRichText, "isRichText");
15351
+ function getCellStyleBySnapshot(snapshot) {
15352
+ const { body } = snapshot;
15353
+ if (!body) return null;
15354
+ const { textRuns = [] } = body;
15355
+ let style = {};
15356
+ const bodyNoLineBreak = body.dataStream.replace(`\r
15357
+ `, "");
15358
+ return textRuns.forEach((textRun) => {
15359
+ const { st, ed, ts } = textRun;
15360
+ ed - st >= bodyNoLineBreak.length && (style = { ...style, ...ts });
15361
+ }), Object.keys(style).length ? style : null;
15362
+ }
15363
+ __name(getCellStyleBySnapshot, "getCellStyleBySnapshot");
15264
15364
  var __defProp$z = Object.defineProperty, __getOwnPropDesc$z = Object.getOwnPropertyDescriptor, __decorateClass$z = /* @__PURE__ */ __name((decorators, target, key, kind) => {
15265
15365
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
15266
15366
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
@@ -15387,7 +15487,7 @@ let HeaderFreezeRenderController = (_a23 = class extends Disposable {
15387
15487
  const { scene } = sheetObject;
15388
15488
  if (this._freezePointerEnterSubs = new Subscription(), this._freezePointerLeaveSubs = new Subscription(), this._freezeDownSubs = new Subscription(), freezeObjectMainRect) {
15389
15489
  const _freezeObjectMainRectEnterSub = freezeObjectMainRect.onPointerEnter$.subscribeEvent(() => {
15390
- if (!this.interceptor.fetchThroughInterceptors(FREEZE_PERMISSION_CHECK)(null, null))
15490
+ if (!this.interceptor.fetchThroughInterceptors(FREEZE_PERMISSION_CHECK)(!0, null))
15391
15491
  return !1;
15392
15492
  freezeObjectHeaderRect == null || freezeObjectHeaderRect.setProps({
15393
15493
  fill: this._freezeHoverColor,
@@ -15405,7 +15505,7 @@ let HeaderFreezeRenderController = (_a23 = class extends Disposable {
15405
15505
  }
15406
15506
  if (freezeObjectHeaderRect) {
15407
15507
  const _freezeObjHeaderPointerEnterSub = freezeObjectHeaderRect.onPointerEnter$.subscribeEvent(() => {
15408
- if (!this.interceptor.fetchThroughInterceptors(FREEZE_PERMISSION_CHECK)(null, null))
15508
+ if (!this.interceptor.fetchThroughInterceptors(FREEZE_PERMISSION_CHECK)(!0, null))
15409
15509
  return !1;
15410
15510
  freezeObjectHeaderRect == null || freezeObjectHeaderRect.setProps({
15411
15511
  fill: this._freezeHoverColor,
@@ -15470,7 +15570,7 @@ let HeaderFreezeRenderController = (_a23 = class extends Disposable {
15470
15570
  const sheetObject = this._getSheetObject();
15471
15571
  if (sheetObject == null)
15472
15572
  return;
15473
- if (!this.interceptor.fetchThroughInterceptors(FREEZE_PERMISSION_CHECK)(null, null))
15573
+ if (!this.interceptor.fetchThroughInterceptors(FREEZE_PERMISSION_CHECK)(!0, null))
15474
15574
  return !1;
15475
15575
  const { scene } = sheetObject;
15476
15576
  scene.setCursor(CURSOR_TYPE.GRABBING), scene.disableEvent();
@@ -15487,7 +15587,7 @@ let HeaderFreezeRenderController = (_a23 = class extends Disposable {
15487
15587
  activeViewport || void 0,
15488
15588
  !0
15489
15589
  );
15490
- if (!this.interceptor.fetchThroughInterceptors(FREEZE_PERMISSION_CHECK)(null, null))
15590
+ if (!this.interceptor.fetchThroughInterceptors(FREEZE_PERMISSION_CHECK)(!0, null))
15491
15591
  return !1;
15492
15592
  scene.setCursor(CURSOR_TYPE.GRABBING);
15493
15593
  const FREEZE_SIZE = FREEZE_SIZE_NORMAL / Math.max(scene.scaleX, scene.scaleY);
@@ -16769,13 +16869,13 @@ let HeaderResizeRenderController = (_a26 = class extends Disposable {
16769
16869
  ), this.disposeWithMe(
16770
16870
  toDisposable(
16771
16871
  eventBindingObject.onDblclick$.subscribeEvent(() => {
16772
- var _a59;
16872
+ var _a59, _b;
16773
16873
  initialType === 0 && (this._context.scene.resetCursor(), this._commandService.executeCommand(
16774
16874
  SetWorksheetRowIsAutoHeightCommand.id,
16775
16875
  {
16776
- anchorRow: this._currentRow
16876
+ ranges: [{ startRow: this._currentRow, endRow: this._currentRow, startColumn: 0, endColumn: ((_a59 = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : _a59.skeleton.worksheet.getColumnCount()) || 0 }]
16777
16877
  }
16778
- ), (_a59 = this._rowResizeRect) == null || _a59.hide());
16878
+ ), (_b = this._rowResizeRect) == null || _b.hide());
16779
16879
  })
16780
16880
  )
16781
16881
  ));
@@ -17305,7 +17405,7 @@ let SheetRenderController = (_a30 = class extends RxDisposable {
17305
17405
  }));
17306
17406
  }
17307
17407
  _initCommandListener() {
17308
- this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
17408
+ this.disposeWithMe(this._commandService.onCommandExecuted((command, options) => {
17309
17409
  const { unit: workbook, unitId: workbookId } = this._context, { id: commandId } = command;
17310
17410
  if (COMMAND_LISTENER_SKELETON_CHANGE.includes(commandId) || this._sheetRenderService.checkMutationShouldTriggerRerender(commandId)) {
17311
17411
  const worksheet = workbook.getActiveSheet();
@@ -17321,7 +17421,7 @@ let SheetRenderController = (_a30 = class extends RxDisposable {
17321
17421
  commandId
17322
17422
  });
17323
17423
  } else COMMAND_LISTENER_VALUE_CHANGE.includes(commandId) && this._sheetSkeletonManagerService.reCalculate();
17324
- command.type === CommandType.MUTATION && this._markUnitDirty(workbookId, command);
17424
+ command.type === CommandType.MUTATION && (options == null ? void 0 : options.onlyLocal) !== !0 && this._markUnitDirty(workbookId, command);
17325
17425
  }));
17326
17426
  }
17327
17427
  _markUnitDirty(unitId, command) {
@@ -17607,11 +17707,14 @@ let SheetCanvasPopManagerService = (_a33 = class extends Disposable {
17607
17707
  * @param viewport target viewport
17608
17708
  * @returns disposable
17609
17709
  */
17610
- attachPopupToCell(row, col, popup, viewport, showOnSelectionMoving = !1) {
17710
+ attachPopupToCell(row, col, popup, _unitId, _subUnitId, viewport, showOnSelectionMoving = !1) {
17611
17711
  const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), worksheet = workbook.getActiveSheet();
17612
17712
  if (!worksheet)
17613
17713
  return null;
17614
- const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), currentRender = this._renderManagerService.getRenderById(unitId), skeleton = currentRender == null ? void 0 : currentRender.with(SheetSkeletonManagerService).getOrCreateSkeleton({
17714
+ const unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId();
17715
+ if (_unitId && unitId !== _unitId || _subUnitId && subUnitId !== _subUnitId)
17716
+ return null;
17717
+ const currentRender = this._renderManagerService.getRenderById(unitId), skeleton = currentRender == null ? void 0 : currentRender.with(SheetSkeletonManagerService).getOrCreateSkeleton({
17615
17718
  sheetId: subUnitId
17616
17719
  }), sheetSelectionRenderService = currentRender == null ? void 0 : currentRender.with(ISheetSelectionRenderService);
17617
17720
  if (!currentRender || !skeleton || !sheetSelectionRenderService)
@@ -18481,7 +18584,7 @@ let SheetPermissionInterceptorBaseController = (_a43 = class extends Disposable
18481
18584
  const target = getSheetCommandTarget(this._univerInstanceService);
18482
18585
  if (!target)
18483
18586
  return !1;
18484
- const { worksheet, unitId, subUnitId } = target, selectionRange = (_a59 = this._selectionManagerService.getCurrentLastSelection()) == null ? void 0 : _a59.range;
18587
+ const { worksheet, unitId, subUnitId } = target, selectionRange = Tools.deepClone((_a59 = this._selectionManagerService.getCurrentLastSelection()) == null ? void 0 : _a59.range);
18485
18588
  return !(!selectionRange || (direction === "top" || direction === "bottom" ? selectionRange.endRow = worksheet.getRowCount() - 1 : (direction === "left" || direction === "right") && (selectionRange.endColumn = worksheet.getColumnCount() - 1), this._rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).map((rule) => rule.ranges).flat().some((range) => Rectangle.getIntersects(selectionRange, range))));
18486
18589
  }
18487
18590
  _permissionCheckByWorksheetCommand(types) {
@@ -18584,7 +18687,7 @@ let SheetPermissionInterceptorBaseController = (_a43 = class extends Disposable
18584
18687
  for (let row = range.startRow; row <= range.endRow; row++)
18585
18688
  for (let col = range.startColumn; col <= range.endColumn; col++) {
18586
18689
  const permission = (_b = (_a59 = worksheet.getCell(row, col)) == null ? void 0 : _a59.selectionProtection) == null ? void 0 : _b[0];
18587
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
18690
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
18588
18691
  return !1;
18589
18692
  }
18590
18693
  }), !0);
@@ -18601,7 +18704,7 @@ let SheetPermissionInterceptorBaseController = (_a43 = class extends Disposable
18601
18704
  for (let row = range.startRow; row <= range.endRow; row++)
18602
18705
  for (let col = range.startColumn; col <= range.endColumn; col++) {
18603
18706
  const permission = (_b = (_a59 = worksheet.getCell(row, col)) == null ? void 0 : _a59.selectionProtection) == null ? void 0 : _b[0];
18604
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
18707
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
18605
18708
  return !0;
18606
18709
  }
18607
18710
  return !1;
@@ -18617,7 +18720,7 @@ let SheetPermissionInterceptorBaseController = (_a43 = class extends Disposable
18617
18720
  for (let row = range.startRow; row <= range.endRow; row++)
18618
18721
  for (let col = range.startColumn; col <= range.endColumn; col++) {
18619
18722
  const permission = (_b = (_a59 = worksheet.getCell(row, col)) == null ? void 0 : _a59.selectionProtection) == null ? void 0 : _b[0];
18620
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
18723
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
18621
18724
  return !1;
18622
18725
  }
18623
18726
  }), !0);
@@ -18647,7 +18750,7 @@ let SheetPermissionInterceptorBaseController = (_a43 = class extends Disposable
18647
18750
  for (let i2 = startRow; i2 <= endRow; i2++)
18648
18751
  for (let j = startColumn; j <= endColumn; j++) {
18649
18752
  const permission = (_c = (_b = targetSheet.getCell(i2, j)) == null ? void 0 : _b.selectionProtection) == null ? void 0 : _c[0];
18650
- if ((permission == null ? void 0 : permission[L.View]) === !1)
18753
+ if ((permission == null ? void 0 : permission[P.View]) === !1)
18651
18754
  return !1;
18652
18755
  }
18653
18756
  }
@@ -18677,7 +18780,7 @@ let SheetPermissionInterceptorBaseController = (_a43 = class extends Disposable
18677
18780
  for (let i2 = startRow; i2 <= endRow; i2++)
18678
18781
  for (let j = startColumn; j <= endColumn; j++) {
18679
18782
  const permission = (_e = (_d = targetSheet.getCell(i2, j)) == null ? void 0 : _d.selectionProtection) == null ? void 0 : _e[0];
18680
- if ((permission == null ? void 0 : permission[L.View]) === !1)
18783
+ if ((permission == null ? void 0 : permission[P.View]) === !1)
18681
18784
  return !1;
18682
18785
  }
18683
18786
  }
@@ -18745,7 +18848,7 @@ let SheetPermissionInterceptorClipboardController = (_a44 = class extends Dispos
18745
18848
  for (let row = startRow; row <= endRow; row++)
18746
18849
  for (let col = startColumn; col <= endColumn; col++) {
18747
18850
  const permission = (_c = (_b = worksheet.getCell(row, col)) == null ? void 0 : _b.selectionProtection) == null ? void 0 : _c[0];
18748
- if ((permission == null ? void 0 : permission[L.Edit]) === !1) {
18851
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1) {
18749
18852
  hasPermission = !1;
18750
18853
  break;
18751
18854
  }
@@ -18783,7 +18886,7 @@ let SheetPermissionInitController = (_a45 = class extends Disposable {
18783
18886
  objectID: rule.permissionId,
18784
18887
  unitID: unitId,
18785
18888
  objectType: M.SelectRange,
18786
- actions: [L.View, L.Edit]
18889
+ actions: [P.View, P.Edit]
18787
18890
  });
18788
18891
  });
18789
18892
  }), allAllowedParams.length && this._authzIoService.batchAllowed(allAllowedParams).then((permissionMap) => {
@@ -18807,7 +18910,7 @@ let SheetPermissionInitController = (_a45 = class extends Disposable {
18807
18910
  objectID: info.rule.permissionId,
18808
18911
  unitID: info.unitId,
18809
18912
  objectType: M.SelectRange,
18810
- actions: [L.Edit, L.View]
18913
+ actions: [P.Edit, P.View]
18811
18914
  }).then((actionList) => {
18812
18915
  getAllRangePermissionPoint().forEach((F) => {
18813
18916
  if (info.type === "set") {
@@ -18852,7 +18955,7 @@ let SheetPermissionInitController = (_a45 = class extends Disposable {
18852
18955
  objectID: info.rule.permissionId,
18853
18956
  unitID: info.unitId,
18854
18957
  objectType: M.Worksheet,
18855
- actions: [L.Edit, L.View]
18958
+ actions: [P.Edit, P.View]
18856
18959
  }).then((actionList) => {
18857
18960
  getAllWorksheetPermissionPoint().forEach((F) => {
18858
18961
  const instance = new F(info.unitId, info.subUnitId), unitActionName = instance.subType, action = actionList.find((item) => item.action === unitActionName);
@@ -18891,7 +18994,7 @@ let SheetPermissionInitController = (_a45 = class extends Disposable {
18891
18994
  objectID: rule.permissionId,
18892
18995
  unitID: unitId,
18893
18996
  objectType: M.Worksheet,
18894
- actions: [L.Edit, L.View]
18997
+ actions: [P.Edit, P.View]
18895
18998
  }));
18896
18999
  const pointRule = this._worksheetProtectionPointRuleModel.getRule(unitId, subUnitId);
18897
19000
  pointRule && (permissionIdWithRuleInstanceMap.set(pointRule.permissionId, pointRule), allAllowedParams.push({
@@ -18954,7 +19057,7 @@ let SheetPermissionInitController = (_a45 = class extends Disposable {
18954
19057
  };
18955
19058
  }).filter((p2) => !!p2.ranges);
18956
19059
  if (permissionList.length) {
18957
- const isSkipRender = permissionList.some((p2) => !(p2 != null && p2[L.View])), _cellData = { ...cell, selectionProtection: permissionList };
19060
+ const isSkipRender = permissionList.some((p2) => !(p2 != null && p2[P.View])), _cellData = { ...cell, selectionProtection: permissionList };
18958
19061
  return isSkipRender ? (delete _cellData.s, delete _cellData.v, delete _cellData.p, _cellData) : next(_cellData);
18959
19062
  }
18960
19063
  return next(cell);
@@ -18973,9 +19076,9 @@ let SheetPermissionInitController = (_a45 = class extends Disposable {
18973
19076
  const { unitId, subUnitId } = context, worksheetRule = this._worksheetProtectionRuleModel.getRule(unitId, subUnitId);
18974
19077
  if (worksheetRule != null && worksheetRule.permissionId) {
18975
19078
  const selectionProtection = [{
18976
- [L.View]: (_b = (_a59 = this._permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)) == null ? void 0 : _a59.value) != null ? _b : !1,
18977
- [L.Edit]: (_d = (_c = this._permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)) == null ? void 0 : _c.value) != null ? _d : !1
18978
- }], isSkipRender = !((_e = selectionProtection[0]) != null && _e[L.View]), _cellData = { ...cell, hasWorksheetRule: !0, selectionProtection };
19079
+ [P.View]: (_b = (_a59 = this._permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)) == null ? void 0 : _a59.value) != null ? _b : !1,
19080
+ [P.Edit]: (_d = (_c = this._permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)) == null ? void 0 : _c.value) != null ? _d : !1
19081
+ }], isSkipRender = !((_e = selectionProtection[0]) != null && _e[P.View]), _cellData = { ...cell, hasWorksheetRule: !0, selectionProtection };
18979
19082
  return isSkipRender ? (delete _cellData.s, delete _cellData.v, delete _cellData.p, _cellData) : next(_cellData);
18980
19083
  }
18981
19084
  return next(cell);
@@ -18992,7 +19095,7 @@ let SheetPermissionInitController = (_a45 = class extends Disposable {
18992
19095
  objectID: permissionId,
18993
19096
  unitID: unitId,
18994
19097
  objectType: M.Worksheet,
18995
- actions: [L.Edit, L.View]
19098
+ actions: [P.Edit, P.View]
18996
19099
  }).then((actionList) => {
18997
19100
  let key = "";
18998
19101
  getAllWorksheetPermissionPoint().forEach((F) => {
@@ -19025,7 +19128,7 @@ let SheetPermissionInitController = (_a45 = class extends Disposable {
19025
19128
  objectID: permissionId,
19026
19129
  unitID: unitId,
19027
19130
  objectType: M.SelectRange,
19028
- actions: [L.Edit, L.View]
19131
+ actions: [P.Edit, P.View]
19029
19132
  }).then((actionList) => {
19030
19133
  let key = "";
19031
19134
  getAllRangePermissionPoint().forEach((F) => {
@@ -19114,7 +19217,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19114
19217
  const allPermissionId = [...allRangePermissionId, ...allSheetPermissionId], allPermissionRule = await authzIoService.list({
19115
19218
  objectIDs: allPermissionId,
19116
19219
  unitID: unitId2,
19117
- actions: [L.View, L.Edit]
19220
+ actions: [P.View, P.Edit]
19118
19221
  }), subUnitPermissionIds = rangeProtectionRuleModel.getSubunitRuleList(unitId2, subUnitId).map((item) => item.permissionId), sheetPermissionId = (_a59 = worksheetProtectionModel.getRule(unitId2, subUnitId)) == null ? void 0 : _a59.permissionId;
19119
19222
  sheetPermissionId && subUnitPermissionIds.push(sheetPermissionId);
19120
19223
  const subUnitRuleList = allPermissionRule.filter((item) => {
@@ -19204,7 +19307,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19204
19307
  const rule = allRuleMap.get(item.objectID);
19205
19308
  if (!rule)
19206
19309
  return null;
19207
- const editAction = item.actions.find((action) => action.action === L.Edit), editPermission = editAction == null ? void 0 : editAction.allowed, viewAction = item.actions.find((action) => action.action === L.View), viewPermission = viewAction == null ? void 0 : viewAction.allowed, hasManagerPermission = ((_b = (_a59 = permissionService.getPermissionPoint(new WorkbookManageCollaboratorPermission(unitId).id)) == null ? void 0 : _a59.value) != null ? _b : !1) || currentUser.userID === ((_c = item.creator) == null ? void 0 : _c.userID);
19310
+ const editAction = item.actions.find((action) => action.action === P.Edit), editPermission = editAction == null ? void 0 : editAction.allowed, viewAction = item.actions.find((action) => action.action === P.View), viewPermission = viewAction == null ? void 0 : viewAction.allowed, hasManagerPermission = ((_b = (_a59 = permissionService.getPermissionPoint(new WorkbookManageCollaboratorPermission(unitId).id)) == null ? void 0 : _a59.value) != null ? _b : !1) || currentUser.userID === ((_c = item.creator) == null ? void 0 : _c.userID);
19208
19311
  let ruleName = "";
19209
19312
  const targetSheet = workbook.getSheetBySheetId(rule.subUnitId), targetName = targetSheet == null ? void 0 : targetSheet.getName();
19210
19313
  if (rule.unitType === M.SelectRange) {
@@ -19380,7 +19483,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19380
19483
  const permissionId = activeRule == null ? void 0 : activeRule.permissionId, selectUserList2 = (await authzIoService.listCollaborators({
19381
19484
  objectID: permissionId,
19382
19485
  unitID: unitId
19383
- })).filter((user) => user.role === P.Editor);
19486
+ })).filter((user) => user.role === G.Editor);
19384
19487
  sheetPermissionUserManagerService.setSelectUserList(selectUserList2), sheetPermissionUserManagerService.setOldCollaboratorList(selectUserList2);
19385
19488
  }, "getSelectUserList");
19386
19489
  activeRule != null && activeRule.permissionId ? getSelectUserList() : (sheetPermissionUserManagerService.setSelectUserList([]), sheetPermissionUserManagerService.setOldCollaboratorList([]));
@@ -19397,7 +19500,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19397
19500
  const res = await authzIoService.list({
19398
19501
  unitID: unitId,
19399
19502
  objectIDs: [activeRule == null ? void 0 : activeRule.permissionId],
19400
- actions: [L.View, L.Edit]
19503
+ actions: [P.View, P.Edit]
19401
19504
  });
19402
19505
  if (!res.length)
19403
19506
  setViewGroupValue(viewState.othersCanView), setEditorGroupValue(editState.onlyMe), sheetPermissionPanelModel.setRule({
@@ -19405,7 +19508,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19405
19508
  editStatus: editState.onlyMe
19406
19509
  });
19407
19510
  else {
19408
- const isAllCanView = ((_a60 = res[0].scope) == null ? void 0 : _a60.read) === G.AllCollaborator, isSomeCanEdit = ((_b2 = res[0].scope) == null ? void 0 : _b2.edit) === G.SomeCollaborator, viewValue = isAllCanView ? viewState.othersCanView : viewState.noOneElseCanView, editValue = isSomeCanEdit ? editState.designedUserCanEdit : editState.onlyMe;
19511
+ const isAllCanView = ((_a60 = res[0].scope) == null ? void 0 : _a60.read) === H.AllCollaborator, isSomeCanEdit = ((_b2 = res[0].scope) == null ? void 0 : _b2.edit) === H.SomeCollaborator, viewValue = isAllCanView ? viewState.othersCanView : viewState.noOneElseCanView, editValue = isSomeCanEdit ? editState.designedUserCanEdit : editState.onlyMe;
19409
19512
  setViewGroupValue(viewValue), setEditorGroupValue(editValue), sheetPermissionPanelModel.setRule({
19410
19513
  viewStatus: viewValue,
19411
19514
  editStatus: editValue
@@ -19427,7 +19530,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19427
19530
  });
19428
19531
  userList.forEach((user) => {
19429
19532
  user != null && user.subject && userManagerService.addUser(user.subject);
19430
- }), sheetPermissionUserManagerService.setUserList(userList.filter((user) => user.role === P.Editor)), sheetPermissionUserManagerService.setAllUserList(userList.filter((user) => user.role === P.Editor || user.role === P.Reader));
19533
+ }), sheetPermissionUserManagerService.setUserList(userList.filter((user) => user.role === G.Editor)), sheetPermissionUserManagerService.setAllUserList(userList.filter((user) => user.role === G.Editor || user.role === G.Reader));
19431
19534
  }, "getListCollaborators"))();
19432
19535
  }, []), useEffect(() => {
19433
19536
  const workbook2 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
@@ -19609,11 +19712,11 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19609
19712
  let collaborators = sheetPermissionUserManagerService.selectUserList;
19610
19713
  activeRule.editStatus === editState.onlyMe && (collaborators = [], sheetPermissionUserManagerService.setSelectUserList([]));
19611
19714
  const scopeObj = {
19612
- read: activeRule.viewStatus === viewState.othersCanView ? G.AllCollaborator : G.SomeCollaborator,
19613
- edit: activeRule.editStatus === editState.designedUserCanEdit ? G.SomeCollaborator : G.OneSelf
19715
+ read: activeRule.viewStatus === viewState.othersCanView ? H.AllCollaborator : H.SomeCollaborator,
19716
+ edit: activeRule.editStatus === editState.designedUserCanEdit ? H.SomeCollaborator : H.OneSelf
19614
19717
  };
19615
- if (activeRule.editStatus === editState.designedUserCanEdit && collaborators.length === 0 && (collaborators = [], scopeObj.edit = G.OneSelf), activeRule.permissionId) {
19616
- const oldRule = sheetPermissionPanelModel.oldRule, isSameCollaborators = getUserListEqual(collaborators.filter((user) => user.role === P.Editor), sheetPermissionUserManagerService.oldCollaboratorList.filter((user) => user.role === P.Editor)), isSameReadStatus = (oldRule == null ? void 0 : oldRule.viewStatus) === activeRule.viewStatus, isSameEditStatus = (oldRule == null ? void 0 : oldRule.editStatus) === activeRule.editStatus, ruleConfigIsOrigin = activeRule.unitType === (oldRule == null ? void 0 : oldRule.unitType) && activeRule.name === oldRule.name && activeRule.description === oldRule.description && activeRule.ranges === oldRule.ranges, collaboratorsIsChange = !isSameCollaborators || !isSameReadStatus || !isSameEditStatus;
19718
+ if (activeRule.editStatus === editState.designedUserCanEdit && collaborators.length === 0 && (collaborators = [], scopeObj.edit = H.OneSelf), activeRule.permissionId) {
19719
+ const oldRule = sheetPermissionPanelModel.oldRule, isSameCollaborators = getUserListEqual(collaborators.filter((user) => user.role === G.Editor), sheetPermissionUserManagerService.oldCollaboratorList.filter((user) => user.role === G.Editor)), isSameReadStatus = (oldRule == null ? void 0 : oldRule.viewStatus) === activeRule.viewStatus, isSameEditStatus = (oldRule == null ? void 0 : oldRule.editStatus) === activeRule.editStatus, ruleConfigIsOrigin = activeRule.unitType === (oldRule == null ? void 0 : oldRule.unitType) && activeRule.name === oldRule.name && activeRule.description === oldRule.description && activeRule.ranges === oldRule.ranges, collaboratorsIsChange = !isSameCollaborators || !isSameReadStatus || !isSameEditStatus;
19617
19720
  if (ruleConfigIsOrigin && collaboratorsIsChange)
19618
19721
  await authzIoService.update({
19619
19722
  objectType: activeRule.unitType,
@@ -19634,7 +19737,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19634
19737
  collaborators,
19635
19738
  unitID: activeRule.unitId,
19636
19739
  name: activeRule.name,
19637
- strategies: [{ role: P.Editor, action: L.Edit }, { role: P.Reader, action: L.View }],
19740
+ strategies: [{ role: G.Editor, action: P.Edit }, { role: G.Reader, action: P.View }],
19638
19741
  scope: scopeObj
19639
19742
  },
19640
19743
  objectType: M.Worksheet
@@ -19659,7 +19762,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19659
19762
  collaborators,
19660
19763
  unitID: activeRule.unitId,
19661
19764
  name: activeRule.name,
19662
- strategies: [{ role: P.Editor, action: L.Edit }, { role: P.Reader, action: L.View }],
19765
+ strategies: [{ role: G.Editor, action: P.Edit }, { role: G.Reader, action: P.View }],
19663
19766
  scope: scopeObj
19664
19767
  },
19665
19768
  objectType: M.Worksheet
@@ -19727,7 +19830,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19727
19830
  }, SheetPermissionUserDialog = /* @__PURE__ */ __name(() => {
19728
19831
  const [inputValue, setInputValue] = React.useState(""), localeService = useDependency(LocaleService), dialogService = useDependency(IDialogService), sheetPermissionUserManagerService = useDependency(SheetPermissionUserManagerService), searchUserList = sheetPermissionUserManagerService.userList.filter((item) => {
19729
19832
  var _a59;
19730
- return ((_a59 = item.subject) == null ? void 0 : _a59.name.toLocaleLowerCase().includes(inputValue.toLocaleLowerCase())) && item.role === P.Editor;
19833
+ return ((_a59 = item.subject) == null ? void 0 : _a59.name.toLocaleLowerCase().includes(inputValue.toLocaleLowerCase())) && item.role === G.Editor;
19731
19834
  }), [selectUserInfo, setSelectUserInfo] = useState(sheetPermissionUserManagerService.selectUserList), handleChangeUser = /* @__PURE__ */ __name((item) => {
19732
19835
  if ((selectUserInfo == null ? void 0 : selectUserInfo.findIndex((v) => {
19733
19836
  var _a59, _b;
@@ -19818,7 +19921,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19818
19921
  actions: defaultWorksheetUnitActionList
19819
19922
  }))[0].strategies.reduce((p2, c) => (subUnitPermissionTypeMap[c.action] && (p2[c.action] = {
19820
19923
  text: localeService.t(`permission.panel.${subUnitPermissionTypeMap[c.action]}`),
19821
- allowed: c.role !== P.Owner
19924
+ allowed: c.role !== G.Owner
19822
19925
  }), p2), {});
19823
19926
  setPermissionMap(actions), setTimeout(() => {
19824
19927
  setLoading(!1);
@@ -19831,7 +19934,7 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19831
19934
  throw new Error("No active sheet found");
19832
19935
  const unitId = workbook2.getUnitId(), subUnitId = worksheet2.getSheetId(), pointRule = worksheetProtectionPointRuleModel.getRule(unitId, subUnitId), actions = Object.keys(permissionMap).map((action) => ({
19833
19936
  action: Number(action),
19834
- role: permissionMap[action].allowed ? P.Editor : P.Owner
19937
+ role: permissionMap[action].allowed ? G.Editor : G.Owner
19835
19938
  }));
19836
19939
  let permissionId = pointRule == null ? void 0 : pointRule.permissionId;
19837
19940
  permissionId ? authzIoService.update({
@@ -19842,14 +19945,14 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19842
19945
  share: void 0,
19843
19946
  name: "",
19844
19947
  scope: {
19845
- read: G.AllCollaborator,
19846
- edit: G.AllCollaborator
19948
+ read: H.AllCollaborator,
19949
+ edit: H.AllCollaborator
19847
19950
  },
19848
19951
  collaborators: void 0
19849
19952
  }).then(() => {
19850
19953
  getAllWorksheetPermissionPoint().forEach((F) => {
19851
19954
  const instance = new F(unitId, subUnitId), unitActionName = instance.subType, action = actions.find((item) => item.action === unitActionName);
19852
- action && permissionService.updatePermissionPoint(instance.id, action.role === P.Editor);
19955
+ action && permissionService.updatePermissionPoint(instance.id, action.role === G.Editor);
19853
19956
  });
19854
19957
  }) : (permissionId = await authzIoService.create({
19855
19958
  objectType: M.Worksheet,
@@ -19859,8 +19962,8 @@ const useHighlightRange = /* @__PURE__ */ __name((ranges = []) => {
19859
19962
  name: "",
19860
19963
  strategies: actions,
19861
19964
  scope: {
19862
- read: G.AllCollaborator,
19863
- edit: G.AllCollaborator
19965
+ read: H.AllCollaborator,
19966
+ edit: H.AllCollaborator
19864
19967
  }
19865
19968
  }
19866
19969
  }), commandService.executeCommand(SetWorksheetPermissionPointsCommand.id, {
@@ -19978,7 +20081,7 @@ const _RangeProtectionCanViewRenderExtension = class _RangeProtectionCanViewRend
19978
20081
  __publicField(this, "Z_INDEX", EXTENSION_CAN_VIEW_Z_INDEX$1);
19979
20082
  }
19980
20083
  shouldRender(config) {
19981
- return (config == null ? void 0 : config[L.View]) !== !1;
20084
+ return (config == null ? void 0 : config[P.View]) !== !1;
19982
20085
  }
19983
20086
  };
19984
20087
  __name(_RangeProtectionCanViewRenderExtension, "RangeProtectionCanViewRenderExtension");
@@ -19990,7 +20093,7 @@ const _RangeProtectionCanNotViewRenderExtension = class _RangeProtectionCanNotVi
19990
20093
  __publicField(this, "Z_INDEX", EXTENSION_CAN_NOT_VIEW_Z_INDEX$1);
19991
20094
  }
19992
20095
  shouldRender(config) {
19993
- return (config == null ? void 0 : config[L.View]) === !1;
20096
+ return (config == null ? void 0 : config[P.View]) === !1;
19994
20097
  }
19995
20098
  };
19996
20099
  __name(_RangeProtectionCanNotViewRenderExtension, "RangeProtectionCanNotViewRenderExtension");
@@ -20001,8 +20104,8 @@ var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPrope
20001
20104
  return kind && result && __defProp$b(target, key, result), result;
20002
20105
  }, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b"), _a46;
20003
20106
  let SheetPermissionRenderManagerController = (_a46 = class extends Disposable {
20004
- constructor(_config, _menuService, _componentManager, _injector) {
20005
- super(), this._config = _config, this._menuService = _menuService, this._componentManager = _componentManager, this._injector = _injector, this._init();
20107
+ constructor(_componentManager) {
20108
+ super(), this._componentManager = _componentManager, this._init();
20006
20109
  }
20007
20110
  _init() {
20008
20111
  this._initComponents();
@@ -20028,10 +20131,7 @@ let SheetPermissionRenderManagerController = (_a46 = class extends Disposable {
20028
20131
  }
20029
20132
  }, __name(_a46, "SheetPermissionRenderManagerController"), _a46);
20030
20133
  SheetPermissionRenderManagerController = __decorateClass$b([
20031
- OnLifecycle(LifecycleStages.Rendered, SheetPermissionRenderManagerController),
20032
- __decorateParam$b(1, IMenuService),
20033
- __decorateParam$b(2, Inject(ComponentManager)),
20034
- __decorateParam$b(3, Inject(Injector))
20134
+ __decorateParam$b(0, Inject(ComponentManager))
20035
20135
  ], SheetPermissionRenderManagerController);
20036
20136
  var _a47;
20037
20137
  let SheetPermissionRenderController = (_a47 = class extends Disposable {
@@ -20073,7 +20173,7 @@ let SheetPermissionInterceptorCanvasRenderController = (_a48 = class extends RxD
20073
20173
  constructor(_context, _univerInstanceService, _permissionService, _selectionManagerService, _rangeProtectionRuleModel, _headerMoveRenderController, _selectionRenderService, _headerFreezeRenderController, _headerResizeRenderController) {
20074
20174
  super();
20075
20175
  __publicField(this, "disposableCollection", new DisposableCollection());
20076
- this._context = _context, this._univerInstanceService = _univerInstanceService, this._permissionService = _permissionService, this._selectionManagerService = _selectionManagerService, this._rangeProtectionRuleModel = _rangeProtectionRuleModel, this._headerMoveRenderController = _headerMoveRenderController, this._selectionRenderService = _selectionRenderService, this._headerFreezeRenderController = _headerFreezeRenderController, this._headerResizeRenderController = _headerResizeRenderController, this._initHeaderMovePermissionInterceptor(), this._initHeaderResizePermissionInterceptor(), this._initRangeFillPermissionInterceptor(), this._initRangeMovePermissionInterceptor(), this._initFreezePermissionInterceptor();
20176
+ this._context = _context, this._univerInstanceService = _univerInstanceService, this._permissionService = _permissionService, this._selectionManagerService = _selectionManagerService, this._rangeProtectionRuleModel = _rangeProtectionRuleModel, this._headerMoveRenderController = _headerMoveRenderController, this._selectionRenderService = _selectionRenderService, this._headerFreezeRenderController = _headerFreezeRenderController, this._headerResizeRenderController = _headerResizeRenderController, this._initHeaderMovePermissionInterceptor(), this._initHeaderResizePermissionInterceptor(), this._initRangeFillPermissionInterceptor(), this._initRangeMovePermissionInterceptor();
20077
20177
  }
20078
20178
  _initHeaderMovePermissionInterceptor() {
20079
20179
  this.disposeWithMe(
@@ -20089,7 +20189,7 @@ let SheetPermissionInterceptorCanvasRenderController = (_a48 = class extends RxD
20089
20189
  for (let row = startRow; row <= endRow; row++)
20090
20190
  for (let col = startColumn; col <= endColumn; col++) {
20091
20191
  const permission = (_b = (_a59 = worksheet.getCell(row, col)) == null ? void 0 : _a59.selectionProtection) == null ? void 0 : _b[0];
20092
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
20192
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
20093
20193
  return !0;
20094
20194
  }
20095
20195
  return !1;
@@ -20133,7 +20233,7 @@ let SheetPermissionInterceptorCanvasRenderController = (_a48 = class extends RxD
20133
20233
  for (let row = startRow; row <= endRow; row++)
20134
20234
  for (let col = startColumn; col <= endColumn; col++) {
20135
20235
  const permission = (_b2 = (_a60 = worksheet.getCell(row, col)) == null ? void 0 : _a60.selectionProtection) == null ? void 0 : _b2[0];
20136
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
20236
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
20137
20237
  return !0;
20138
20238
  }
20139
20239
  return !1;
@@ -20154,7 +20254,7 @@ let SheetPermissionInterceptorCanvasRenderController = (_a48 = class extends RxD
20154
20254
  for (let row = startRow; row <= endRow; row++)
20155
20255
  for (let col = startColumn; col <= endColumn; col++) {
20156
20256
  const permission = (_b2 = (_a60 = worksheet.getCell(row, col)) == null ? void 0 : _a60.selectionProtection) == null ? void 0 : _b2[0];
20157
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
20257
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
20158
20258
  return !0;
20159
20259
  }
20160
20260
  return !1;
@@ -20184,7 +20284,7 @@ let SheetPermissionInterceptorCanvasRenderController = (_a48 = class extends RxD
20184
20284
  for (let row = startRow; row <= endRow; row++)
20185
20285
  for (let col = startColumn; col <= endColumn; col++) {
20186
20286
  const permission = (_c = (_b = worksheet.getCell(row, col)) == null ? void 0 : _b.selectionProtection) == null ? void 0 : _c[0];
20187
- if ((permission == null ? void 0 : permission[L.Edit]) === !1 || (permission == null ? void 0 : permission[L.View]) === !1)
20287
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1 || (permission == null ? void 0 : permission[P.View]) === !1)
20188
20288
  return !1;
20189
20289
  }
20190
20290
  return !0;
@@ -20210,7 +20310,7 @@ let SheetPermissionInterceptorCanvasRenderController = (_a48 = class extends RxD
20210
20310
  for (let row = startRow; row <= endRow; row++)
20211
20311
  for (let col = startColumn; col <= endColumn; col++) {
20212
20312
  const permission = (_b = (_a60 = worksheet.getCell(row, col)) == null ? void 0 : _a60.selectionProtection) == null ? void 0 : _b[0];
20213
- if ((permission == null ? void 0 : permission[L.Edit]) === !1)
20313
+ if ((permission == null ? void 0 : permission[P.Edit]) === !1)
20214
20314
  return !0;
20215
20315
  }
20216
20316
  return !1;
@@ -20278,7 +20378,7 @@ let SheetPermissionInterceptorFormulaRenderController = (_a49 = class extends Rx
20278
20378
  if (((_a60 = worksheet.getCellRaw(rowIndex + startRow, colIndex + startCol)) == null ? void 0 : _a60.v) === void 0)
20279
20379
  return;
20280
20380
  const permission = (_b = this._rangeProtectionRenderModel.getCellInfo(unitId, subUnitId, rowIndex + startRow, colIndex + startCol)) == null ? void 0 : _b[0];
20281
- (permission == null ? void 0 : permission[L.View]) === !1 && (itemValue[rowIndex][colIndex] = NullValueObject.create());
20381
+ (permission == null ? void 0 : permission[P.View]) === !1 && (itemValue[rowIndex][colIndex] = NullValueObject.create());
20282
20382
  });
20283
20383
  });
20284
20384
  }), originValue;
@@ -20313,7 +20413,7 @@ const worksheetProtectionKey = "worksheet-protection", EXTENSION_CAN_VIEW_Z_INDE
20313
20413
  if (this._pattern) {
20314
20414
  if (selectionProtection.length > 0) {
20315
20415
  const cellProtectionConfig = selectionProtection[0];
20316
- (cellProtectionConfig == null ? void 0 : cellProtectionConfig[L.View]) ? this.setZIndex(EXTENSION_CAN_VIEW_Z_INDEX) : this.setZIndex(EXTENSION_CAN_NOT_VIEW_Z_INDEX);
20416
+ (cellProtectionConfig == null ? void 0 : cellProtectionConfig[P.View]) ? this.setZIndex(EXTENSION_CAN_VIEW_Z_INDEX) : this.setZIndex(EXTENSION_CAN_NOT_VIEW_Z_INDEX);
20317
20417
  }
20318
20418
  ctx.fillStyle = this._pattern, hasWorksheetRule && ctx.fillRect(start.startX, start.startY, end.endX - start.startX, end.endY - start.startY), ctx.restore();
20319
20419
  }
@@ -20510,12 +20610,12 @@ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPrope
20510
20610
  return kind && result && __defProp$5(target, key, result), result;
20511
20611
  }, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), __publicField$1 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp$1(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField$1"), _a53;
20512
20612
  let UniverSheetsUIPlugin = (_a53 = class extends Plugin {
20613
+ /** @ignore */
20513
20614
  constructor(_config = {}, _injector, _renderManagerService, _univerInstanceService) {
20514
20615
  super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._config = Tools.deepMerge({}, DefaultSheetUiConfig, this._config);
20515
20616
  }
20516
20617
  onStarting() {
20517
20618
  mergeOverrideWithDependencies([
20518
- // services
20519
20619
  [ShortcutExperienceService],
20520
20620
  [IEditorBridgeService, { useClass: EditorBridgeService }],
20521
20621
  [ISheetClipboardService, { useClass: SheetClipboardService }],
@@ -20525,26 +20625,22 @@ let UniverSheetsUIPlugin = (_a53 = class extends Plugin {
20525
20625
  [IFormulaEditorManagerService, { useClass: FormulaEditorManagerService }],
20526
20626
  [IAutoFillService, { useClass: AutoFillService }],
20527
20627
  [SheetPrintInterceptorService],
20528
- // This would be removed from global injector and moved into RenderUnit provider.
20529
- // [SheetSkeletonManagerService],
20530
20628
  [IStatusBarService, { useClass: StatusBarService }],
20531
20629
  [IMarkSelectionService, { useClass: MarkSelectionService }],
20532
20630
  [HoverManagerService],
20533
20631
  [DragManagerService],
20534
20632
  [SheetCanvasPopManagerService],
20535
20633
  [CellAlertManagerService],
20634
+ [SelectAllService],
20536
20635
  // controllers
20537
20636
  [ActiveWorksheetController],
20538
20637
  [AutoHeightController],
20539
20638
  [FormulaEditorController],
20540
20639
  [SheetClipboardController],
20541
20640
  [SheetsRenderService],
20542
- [
20543
- SheetUIController,
20544
- {
20545
- useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetUIController, this._config), "useFactory")
20546
- }
20547
- ],
20641
+ [SheetUIController, {
20642
+ useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetUIController, this._config), "useFactory")
20643
+ }],
20548
20644
  [StatusBarController],
20549
20645
  [AutoFillController],
20550
20646
  [FormatPainterController],
@@ -20555,22 +20651,15 @@ let UniverSheetsUIPlugin = (_a53 = class extends Plugin {
20555
20651
  [WorksheetProtectionRenderService],
20556
20652
  [SheetPermissionInterceptorClipboardController],
20557
20653
  [SheetPermissionInterceptorBaseController],
20558
- [SheetPermissionInitController]
20559
- // [MoveRangeController],
20560
- ], this._config.override).forEach((d) => this._injector.add(d)), this._injector.add(
20561
- [
20562
- SheetPermissionRenderManagerController,
20563
- {
20564
- useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetPermissionRenderManagerController, this._config), "useFactory")
20565
- }
20566
- ]
20567
- );
20654
+ [SheetPermissionInitController],
20655
+ [SheetPermissionRenderManagerController]
20656
+ ], this._config.override).forEach((d) => this._injector.add(d));
20568
20657
  }
20569
20658
  onReady() {
20570
- this._markSheetAsFocused(), this._registerRenderBasics();
20659
+ this._config.disableAutoFocus || this._markSheetAsFocused(), this._registerRenderBasics();
20571
20660
  }
20572
20661
  onRendered() {
20573
- this._registerRenderModules();
20662
+ this._registerRenderModules(), this._injector.get(SheetPermissionRenderManagerController);
20574
20663
  }
20575
20664
  _registerRenderBasics() {
20576
20665
  [
@@ -20588,8 +20677,7 @@ let UniverSheetsUIPlugin = (_a53 = class extends Plugin {
20588
20677
  [HeaderMoveRenderController],
20589
20678
  [HeaderUnhideRenderController],
20590
20679
  [HeaderResizeRenderController],
20591
- // Caution: ScrollRenderController should placed before ZoomRenderController
20592
- // because ZoomRenderController ---> viewport.resize --> setScrollInfo, but ScrollRenderController needs scrollInfo
20680
+ // Caution: ScrollRenderController should placed before ZoomRenderController.
20593
20681
  [SheetScrollManagerService],
20594
20682
  [SheetsScrollRenderController],
20595
20683
  [HeaderFreezeRenderController],
@@ -20618,7 +20706,7 @@ let UniverSheetsUIPlugin = (_a53 = class extends Plugin {
20618
20706
  }
20619
20707
  _markSheetAsFocused() {
20620
20708
  const univerInstanceService = this._univerInstanceService;
20621
- univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(filter$1((v) => !!v)).subscribe((workbook) => univerInstanceService.focusUnit(workbook.getUnitId()));
20709
+ this.disposeWithMe(univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(filter$1((v) => !!v)).subscribe((workbook) => univerInstanceService.focusUnit(workbook.getUnitId())));
20622
20710
  }
20623
20711
  }, __name(_a53, "UniverSheetsUIPlugin"), _a53);
20624
20712
  __publicField$1(UniverSheetsUIPlugin, "pluginName", "SHEET_UI_PLUGIN");
@@ -21293,8 +21381,8 @@ SheetContextMenuMobileRenderController = __decorateClass$2([
21293
21381
  __decorateParam$2(5, Inject(SheetSkeletonManagerService))
21294
21382
  ], SheetContextMenuMobileRenderController);
21295
21383
  const _MobileSelectionControl = class _MobileSelectionControl extends SelectionControl {
21296
- constructor(_scene, _zIndex, _isHeaderHighlight = !0, _themeService, _rangeType = RANGE_TYPE.NORMAL) {
21297
- super(_scene, _zIndex, _isHeaderHighlight, _themeService);
21384
+ constructor(_scene, _zIndex, _highlightHeader = !0, _themeService, _rangeType = RANGE_TYPE.NORMAL) {
21385
+ super(_scene, _zIndex, _themeService, _highlightHeader);
21298
21386
  /**
21299
21387
  * topLeft controlPointer, it is not visible, just transparent, for handling event.
21300
21388
  */
@@ -21311,7 +21399,7 @@ const _MobileSelectionControl = class _MobileSelectionControl extends SelectionC
21311
21399
  * a very small visible point, placed in control pointer
21312
21400
  */
21313
21401
  __publicField(this, "_fillControlBottomRightInner");
21314
- this._scene = _scene, this._zIndex = _zIndex, this._isHeaderHighlight = _isHeaderHighlight, this._themeService = _themeService, this._rangeType = _rangeType, this.initControlPoints();
21402
+ this._scene = _scene, this._zIndex = _zIndex, this._highlightHeader = _highlightHeader, this._themeService = _themeService, this._rangeType = _rangeType, this.initControlPoints();
21315
21403
  }
21316
21404
  initControlPoints() {
21317
21405
  const defaultStyle = this.defaultStyle, expandCornerSize = defaultStyle.expandCornerSize || 0, expandCornerInnerSize = (defaultStyle.expandCornerSize || 0) / 4, AutofillStrokeWidth = defaultStyle.AutofillStrokeWidth || 0, stroke = defaultStyle.stroke, AutofillStroke = defaultStyle.AutofillStroke, zIndex = this.zIndex, RectCtor = Rect;
@@ -21382,11 +21470,11 @@ const _MobileSelectionControl = class _MobileSelectionControl extends SelectionC
21382
21470
  (_a59 = this._fillControlBottomRight) == null || _a59.dispose(), (_b = this._fillControlTopLeft) == null || _b.dispose(), super.dispose();
21383
21471
  }
21384
21472
  updateRange(range) {
21385
- this._selectionModel.setValue(range), this._updateControlStyleAndLayout(null, this._rowHeaderWidth, this._columnHeaderHeight);
21473
+ this._selectionModel.setValue(range);
21386
21474
  }
21387
- _updateControlStyleAndLayout(style, rowHeaderWidth, columnHeaderHeight) {
21475
+ _updateControlStyleAndLayout(style) {
21388
21476
  var _a59, _b, _c, _d;
21389
- super._updateControlStyleAndLayout(style, rowHeaderWidth, columnHeaderHeight);
21477
+ super._updateControlStyleAndLayout(style);
21390
21478
  const defaultStyle = this.defaultStyle;
21391
21479
  style == null && (style = defaultStyle);
21392
21480
  const {
@@ -21710,9 +21798,11 @@ let MobileSheetsSelectionRenderService = (_a57 = class extends BaseSelectionRend
21710
21798
  if (!activeSelectionControl) return;
21711
21799
  this._changeCurrCellWhenControlPointerDown(), this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), this._clearUpdatingListeners(), this._addEndingListeners(), this._scrollTimer = ScrollTimer.create(this._scene, scrollTimerType), this._scrollTimer.startScroll((_a59 = viewportMain == null ? void 0 : viewportMain.left) != null ? _a59 : 0, (_b = viewportMain == null ? void 0 : viewportMain.top) != null ? _b : 0, viewportMain), (_c = scene.getTransformer()) == null || _c.clearSelectedObjects();
21712
21800
  const relativeCoords = scene.getRelativeToViewportCoord(Vector2.FromArray([evt.offsetX, evt.offsetY]));
21713
- this._setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType, relativeCoords.x, relativeCoords.y), this._scenePointerUpSub = scene.onPointerUp$.subscribeEvent((_evt) => {
21714
- this.endSelection(), this._expandingSelection = !1, this.expandingControlMode = "bottom-right", this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), this._shortcutService.setDisable(!1);
21715
- }), this._shortcutService.setDisable(!0);
21801
+ this._setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType, relativeCoords.x, relativeCoords.y);
21802
+ const disposableShortcut = this._shortcutService.forceEscape();
21803
+ this._scenePointerUpSub = scene.onPointerUp$.subscribeEvent((_evt) => {
21804
+ this.endSelection(), this._expandingSelection = !1, this.expandingControlMode = "bottom-right", this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), disposableShortcut.dispose();
21805
+ });
21716
21806
  }
21717
21807
  _changeCurrCellWhenControlPointerDown() {
21718
21808
  const activeSelectionControl = this.getActiveSelectionControl(), skeleton = this._skeleton;
@@ -21834,15 +21924,12 @@ let UniverSheetsMobileUIPlugin = (_a58 = class extends Plugin {
21834
21924
  }
21835
21925
  onStarting() {
21836
21926
  [
21837
- // services
21838
21927
  [ShortcutExperienceService],
21839
21928
  [ISheetClipboardService, { useClass: SheetClipboardService }],
21840
21929
  [ISheetBarService, { useClass: SheetBarService }],
21841
21930
  [IFormatPainterService, { useClass: FormatPainterService }],
21842
21931
  [IAutoFillService, { useClass: AutoFillService }],
21843
21932
  [SheetPrintInterceptorService],
21844
- // This would be removed from global injector and moved into RenderUnit provider.
21845
- // [SheetSkeletonManagerService],
21846
21933
  [ISheetSelectionRenderService, { useClass: MobileSheetsSelectionRenderService }],
21847
21934
  [IStatusBarService, { useClass: StatusBarService }],
21848
21935
  [IMarkSelectionService, { useClass: MarkSelectionService }],
@@ -21850,35 +21937,24 @@ let UniverSheetsMobileUIPlugin = (_a58 = class extends Plugin {
21850
21937
  [DragManagerService],
21851
21938
  [SheetCanvasPopManagerService],
21852
21939
  [CellAlertManagerService],
21853
- // controllers
21940
+ [SelectAllService],
21854
21941
  [ActiveWorksheetController],
21855
21942
  [AutoHeightController],
21856
21943
  [SheetClipboardController],
21857
21944
  [SheetsRenderService],
21858
- [
21859
- SheetUIMobileController,
21860
- {
21861
- useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetUIMobileController, this._config), "useFactory")
21862
- }
21863
- ],
21945
+ [SheetUIMobileController, {
21946
+ useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetUIMobileController, this._config), "useFactory")
21947
+ }],
21864
21948
  [StatusBarController],
21865
- // [AutoFillController],
21866
- // [FormatPainterController],
21867
21949
  // permission
21868
21950
  [SheetPermissionPanelModel],
21869
21951
  [SheetPermissionUserManagerService],
21870
21952
  [WorksheetProtectionRenderService],
21871
21953
  [SheetPermissionInterceptorClipboardController],
21872
21954
  [SheetPermissionInterceptorBaseController],
21873
- [SheetPermissionInitController]
21874
- ].forEach((d) => this._injector.add(d)), this._injector.add(
21875
- [
21876
- SheetPermissionRenderManagerController,
21877
- {
21878
- useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetPermissionRenderManagerController, this._config), "useFactory")
21879
- }
21880
- ]
21881
- );
21955
+ [SheetPermissionInitController],
21956
+ [SheetPermissionRenderManagerController]
21957
+ ].forEach((d) => this._injector.add(d));
21882
21958
  }
21883
21959
  onReady() {
21884
21960
  this._markSheetAsFocused(), this._registerRenderBasics();
@@ -21907,8 +21983,7 @@ let UniverSheetsMobileUIPlugin = (_a58 = class extends Plugin {
21907
21983
  [HeaderMoveRenderController],
21908
21984
  [HeaderFreezeRenderController],
21909
21985
  // Caution: ScrollRenderController should placed before ZoomRenderController
21910
- // because ZoomRenderController would change scrollInfo in currentSkeletonBefore$
21911
- // currentSkeletonBefore$ --> ZoomRenderController ---> viewport.resize --> setScrollInfo, but ScrollRenderController needs scrollInfo
21986
+ // because ZoomRenderController would change scrollInfo in currentSkeletonBefore$.
21912
21987
  [MobileSheetsScrollRenderController],
21913
21988
  [SheetsZoomRenderController],
21914
21989
  [FormatPainterRenderController],
@@ -21929,9 +22004,9 @@ let UniverSheetsMobileUIPlugin = (_a58 = class extends Plugin {
21929
22004
  }
21930
22005
  _markSheetAsFocused() {
21931
22006
  const univerInstanceService = this._univerInstanceService;
21932
- univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(filter$1((v) => !!v)).subscribe((workbook) => {
22007
+ this.disposeWithMe(univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(filter$1((v) => !!v)).subscribe((workbook) => {
21933
22008
  univerInstanceService.focusUnit(workbook.getUnitId());
21934
- });
22009
+ }));
21935
22010
  }
21936
22011
  }, __name(_a58, "UniverSheetsMobileUIPlugin"), _a58);
21937
22012
  __publicField2(UniverSheetsMobileUIPlugin, "pluginName", "SHEET_UI_PLUGIN");
@@ -21993,6 +22068,7 @@ export {
21993
22068
  IAutoFillService,
21994
22069
  ICellEditorManagerService,
21995
22070
  IEditorBridgeService,
22071
+ IFormatPainterService,
21996
22072
  IFormulaEditorManagerService,
21997
22073
  IMarkSelectionService,
21998
22074
  ISheetClipboardService,
@@ -22015,6 +22091,7 @@ export {
22015
22091
  RenderSheetFooter,
22016
22092
  RenderSheetHeader,
22017
22093
  ResetScrollCommand,
22094
+ SELECTION_SHAPE_DEPTH,
22018
22095
  SHEET_UI_PLUGIN_NAME,
22019
22096
  SHEET_VIEW_KEY,
22020
22097
  ScrollCommand,