@univerjs/sheets-ui 1.0.0-beta.1 → 1.0.0-beta.2

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/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { BreakLineCommand, CoverContentCommand, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, DOC_VERTICAL_PADDING, DeleteLeftCommand, DeleteRightCommand, DocSelectionRenderService, IEditorService, IMEInputCommand, MoveCursorOperation, MoveSelectionOperation, NodePositionConvertToCursor, ReplaceSnapshotCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand, UniverDocsUIPlugin, VIEWPORT_KEY, convertBodyToHtml, getCanvasOffsetByEngine, getLineBounding } from "@univerjs/docs-ui";
2
- import { AbsoluteRefType, BaselineOffset, BooleanNumber, BorderStyleTypes, CellModeEnum, CellValueType, ColorKit, CommandType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_HEIGHT, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DependentOn, Direction, Disposable, DisposableCollection, DocumentFlavor, EDITOR_ACTIVATED, ErrorService, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_UNIVER_EDITOR, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, LocaleType, LookUp, NilCommand, ObjectMatrix, Optional, Plugin, PresetListType, Quantity, RANGE_TYPE, Range, Rectangle, RxDisposable, SHEET_EDITOR_UNITS, ThemeService, Tools, UndoCommandId, UniverInstanceType, UserManagerService, VerticalAlign, Workbook, WrapStrategy, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, composeStyles, convertCellToRange, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, dateKit, debounce, extractPureTextFromCell, fromEventSubject, generateRandomId, get, getEmptyCell, getIntersectRange, getNumfmtParseValueFilter, getReverseDirection, handleStyleToString, isDefaultFormat, isFormulaString, isInternalEditorID, isNotNullOrUndefined, isRealNum, isSafeUrl, isTextFormat, isValidRange, merge, mergeOverrideWithDependencies, nameCharacterCheck, numberToABC, numfmt, registerDependencies, sequenceExecute, set, skipParseTagNames, sortRules, splitIntoGrid, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
1
+ import { BreakLineCommand, CoverContentCommand, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, DOC_VERTICAL_PADDING, DeleteLeftCommand, DeleteRightCommand, DocSelectionRenderService, IEditorService, IMEInputCommand, MoveCursorOperation, MoveSelectionOperation, NodePositionConvertToCursor, ReplaceSnapshotCommand, SetDocInputStyleCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand, UniverDocsUIPlugin, VIEWPORT_KEY, convertBodyToHtml, getCanvasOffsetByEngine, getLineBounding } from "@univerjs/docs-ui";
2
+ import { AbsoluteRefType, BaselineOffset, BooleanNumber, BorderStyleTypes, CellModeEnum, CellValueType, ColorKit, CommandType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_HEIGHT, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DependentOn, Direction, Disposable, DisposableCollection, DocumentFlavor, EDITOR_ACTIVATED, ErrorService, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_UNIVER_EDITOR, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, LocaleType, LookUp, NilCommand, ObjectMatrix, Optional, Plugin, PresetListType, Quantity, RANGE_TYPE, Range, Rectangle, RxDisposable, SHEET_EDITOR_UNITS, ThemeService, Tools, UndoCommandId, UniverInstanceType, UserManagerService, VerticalAlign, Workbook, WrapStrategy, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, composeStyles, convertCellToRange, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, dateKit, debounce, extractPureTextFromCell, fromEventSubject, generateRandomId, get, getEmptyCell, getIntersectRange, getNumfmtParseValueFilter, getReverseDirection, handleStyleToString, isDefaultFormat, isFormulaString, isNotNullOrUndefined, isRealNum, isSafeUrl, isTextFormat, isValidRange, merge, mergeOverrideWithDependencies, nameCharacterCheck, numberToABC, numfmt, registerDependencies, sequenceExecute, set, skipParseTagNames, sortRules, splitIntoGrid, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
3
3
  import { AUTO_FILL_APPLY_TYPE, AUTO_FILL_HOOK_TYPE, AddMergeUndoMutationFactory, AddRangeProtectionCommand, AddRangeProtectionMutation, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeMutation, AddWorksheetMergeVerticalCommand, AddWorksheetProtectionCommand, AutoClearContentCommand, AutoFillCommand, AutoFillController, BEFORE_CELL_EDIT, BorderStyleManagerService, COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, CancelMarkDirtyRowAutoHeightOperation, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionCommand, DeltaColumnWidthCommand, DeltaRowHeightCommand, EditStateEnum, IAutoFillService, IExclusiveRangeService, INTERCEPTOR_POINT, INumfmtService, IRefSelectionsService, InsertColBeforeCommand, InsertColCommand, InsertColMutation, InsertDefinedNameCommand, InsertMultiColsLeftCommand, InsertMultiColsRightCommand, InsertMultiRowsAboveCommand, InsertMultiRowsAfterCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowBeforeCommand, InsertRowCommand, InsertRowMutation, InsertSheetCommand, InsertSheetMutation, MAX_CELL_PER_SHEET_KEY, MERGE_CELL_INTERCEPTOR_CHECK, MarkDirtyRowAutoHeightOperation, MergeCellController, MoveColsCommand, MoveColsMutation, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, REF_SELECTIONS_ENABLED, RangeProtectionCache, RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RefRangeService, RefSelectionsService, RefillCommand, RemoveColCommand, RemoveColMutation, RemoveDefinedNameCommand, RemoveMergeUndoMutationFactory, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, RemoveSheetMutation, RemoveWorksheetMergeCommand, RemoveWorksheetMergeMutation, ResetBackgroundColorCommand, ResetTextColorCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SELECTIONS_ENABLED, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SHEETS_PLUGIN_CONFIG_KEY, ScrollToCellOperation, SelectionMoveType, SetBackgroundColorCommand, SetBoldCommand, SetBorderBasicCommand, SetBorderCommand, SetColHiddenCommand, SetColHiddenMutation, SetColVisibleMutation, SetColWidthCommand, SetDefinedNameCommand, SetFontFamilyCommand, SetFontSizeCommand, SetFrozenCommand, SetFrozenMutation, SetFrozenMutationFactory, SetHorizontalTextAlignCommand, SetItalicCommand, SetProtectionCommand, SetRangeValuesCommand, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetRowHeightCommand, SetRowHiddenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedColsVisibleCommand, SetSelectedRowsVisibleCommand, SetSelectionsOperation, SetShrinkToFitCommand, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStrikeThroughCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SetWorksheetColWidthMutation, SetWorksheetColWidthMutationFactory, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetNameMutation, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetPermissionPointsCommand, SetWorksheetRowAutoHeightMutation, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowHeightMutation, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetCopyDownCommand, SheetCopyRightCommand, SheetInterceptorService, SheetPermissionCheckController, SheetPermissionInitController, SheetSkeletonService, SheetsSelectionsService, TextToNumberCommand, ToggleCellCheckboxCommand, ToggleGridlinesCommand, ToggleGridlinesMutation, UniverSheetsPlugin, ViewStateEnum, WorkbookCopyPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookEditablePermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookRenameSheetPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditPermission, WorksheetInsertColumnPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetViewPermission, adjustRangeOnMutation, alignToMergedCellsBorders, attachPrimaryWithCoord, attachRangeWithCoord, attachSelectionWithCoord, baseProtectionActions, convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, countCells, defaultLargeSheetOperationConfig, deserializeListOptions, discreteRangeToRange, expandToContinuousRange, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getCellAtRowCol, getClearContentMutationParamsForRanges, getMoveRangeCommandMutations, getPrimaryForRange, getSelectionsService, getSheetCommandTarget, isCellImage, rangeToDiscreteRange, serializeListOptions, setEndForRange, validateDefinedName } from "@univerjs/sheets";
4
- import { AnchoredContextMenu, BuiltInUIPart, COLOR_PICKER_COMPONENT, ComponentContainer, ComponentManager, ContextMenuGroup, ContextMenuPosition, CopyCommand, CutCommand, DISABLE_AUTO_FOCUS_KEY, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HTML_CLIPBOARD_MIME_TYPE, ICanvasPopupService, IClipboardInterfaceService, IContextMenuService, IDialogService, ILayoutService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IShortcutService, ISidebarService, IUIPartsService, IconManager, KeyCode, MenuItemType, MetaKeys, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SheetPasteShortKeyCommandName, Slider, ToggleFullscreenOperation, ToolbarItem, UI_PLUGIN_CONFIG_KEY, UniverMobileUIPlugin, ZoomInput, connectInjector, getMenuHiddenObservable, handleStringToStyle, imageMimeTypeSet, sanitizeParsedHtml, textTrim, useComponentsOfPart, useConfigValue, useDependency, useEvent, useObservable, useSidebarClick, useVirtualList } from "@univerjs/ui";
4
+ import { AnchoredContextMenu, BuiltInUIPart, COLOR_PICKER_COMPONENT, ComponentContainer, ComponentManager, ContextMenuGroup, ContextMenuPosition, CopyCommand, CutCommand, DISABLE_AUTO_FOCUS_KEY, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HTML_CLIPBOARD_MIME_TYPE, ICanvasPopupService, IClipboardInterfaceService, IContextMenuService, IDialogService, ILayoutService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IShortcutService, ISidebarService, IUIPartsService, IWorkbenchService, IconManager, KeyCode, MenuItemType, MetaKeys, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SheetPasteShortKeyCommandName, Slider, ToggleFullscreenOperation, ToolbarItem, UI_PLUGIN_CONFIG_KEY, UniverMobileUIPlugin, ZoomInput, connectInjector, getMenuHiddenObservable, handleStringToStyle, imageMimeTypeSet, sanitizeParsedHtml, textTrim, useComponentsOfPart, useConfigValue, useDependency, useEvent, useObservable, useSidebarClick, useVirtualList } from "@univerjs/ui";
5
5
  import { CURSOR_TYPE, DashedRect, DeviceInputEventType, FIX_ONE_PIXEL_BLUR_OFFSET, Group, IRenderManagerService, Layer, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, Rect, RegularPolygon, SHEET_EXTENSION_PREFIX, SHEET_VIEWPORT_KEY, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetExtension, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetRowHeader, TRANSFORM_CHANGE_OBSERVABLE_TYPE, UniverRenderEnginePlugin, Vector2, Viewport, calculateCellImageRect, cancelRequestFrame, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, fixLineWidthByScale, getCurrentTypeOfRenderer, getNextWheelZoomRatio, ptToPixel, requestNewFrame, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
6
6
  import { BehaviorSubject, EMPTY, Observable, Subject, Subscription, combineLatest, combineLatestWith, distinctUntilChanged, filter, from, fromEvent, map, merge as merge$1, of, shareReplay, skip, startWith, switchMap, takeUntil, throttleTime, withLatestFrom } from "rxjs";
7
- import { DocSelectionManagerService, DocSkeletonManagerService, InsertTextCommand, RichTextEditingMutation, SetTextSelectionsOperation, UniverDocsPlugin } from "@univerjs/docs";
7
+ import { DocSelectionManagerService, DocSkeletonManagerService, DocStateChangeManagerService, InsertTextCommand, RichTextEditingMutation, SetTextSelectionsOperation, UniverDocsPlugin } from "@univerjs/docs";
8
8
  import { ObjectScope, UnitAction, UnitObject, UnitRole } from "@univerjs/protocol";
9
9
  import { Avatar, Button, Calendar, CascaderList, ColorPicker, ConfigContext, Confirm, Dropdown, DropdownMenu, FormLayout, Input, InputNumber, MessageType, Radio, RadioGroup, Select, Separator, Switch, TimeInput, Tooltip, borderBottomClassName, borderClassName, borderRightClassName, borderTopClassName, clsx, scrollbarClassName } from "@univerjs/design";
10
10
  import { AddImageIcon, AdjustHeightDoubleIcon, AdjustWidthDoubleIcon, AlignBottomIcon, AlignTopIcon, AllBorderIcon, AutoHeightDoubleIcon, AutoWidthDoubleIcon, AutofillDoubleIcon, AutowrapIcon, BackSlashDoubleIcon, BasesMultiIcon, BoardsMultiIcon, BoldIcon, BrushIcon, CancelFreezeIcon, CancelMergeIcon, CheckMarkIcon, ClearFormatDoubleIcon, CloseIcon, CodeIcon, ConvertIcon, ConvertToNumberIcon, CopyDoubleIcon, CutIcon, DeleteCellShiftLeftDoubleIcon, DeleteCellShiftUpDoubleIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DocsMultiIcon, DownBorderDoubleIcon, DownIcon, DownloadImageIcon, ErrorIcon, EyeIcon, EyelashIcon, FontColorDoubleIcon, FontSizeIncreaseIcon, FontSizeReduceIcon, FreezeColumnIcon, FreezeRowIcon, FreezeToSelectedIcon, FxIcon, HideDoubleIcon, HideGridlinesIcon, HorizontalBorderDoubleIcon, HorizontalMergeIcon, HorizontallyIcon, IncreaseIcon, InfoIcon, InnerBorderDoubleIcon, InsertCellDownDoubleIcon, InsertCellShiftRightDoubleIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, LeftBorderDoubleIcon, LeftDoubleDiagonalDoubleIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LeftRotationFortyFiveDegreesIcon, LeftRotationNinetyDegreesIcon, LeftTridiagonalDoubleIcon, LockIcon, MergeAllIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, NoBorderIcon, NoColorDoubleIcon, NoRotationIcon, OuterBorderDoubleIcon, OverflowIcon, PaintBucketDoubleIcon, PasteSpecialDoubleIcon, PenIcon, ProtectIcon, ReduceDoubleIcon, RightBorderDoubleIcon, RightDoubleDiagonalDoubleIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, RightRotationFortyFiveDegreesIcon, RightRotationNinetyDegreesIcon, SheetsMultiIcon, ShrinkToFitIcon, SlashDoubleIcon, SlidesMultiIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, TruncationIcon, UnderlineIcon, UpBorderDoubleIcon, VerticalBorderDoubleIcon, VerticalCenterIcon, VerticalIntegrationIcon, VerticalTextIcon, WarningIcon, WriteIcon } from "@univerjs/icons";
@@ -3123,6 +3123,7 @@ var HtmlToUSMService = class HtmlToUSMService {
3123
3123
  let value = numfmtMatch[1].trim();
3124
3124
  if (value.startsWith("\"") && value.endsWith("\"")) value = value.slice(1, -1);
3125
3125
  const decoded = decodeMsoNumberFormat(value);
3126
+ if (!numfmt.isValidFormat(decoded)) continue;
3126
3127
  selectors.split(",").forEach((sel) => {
3127
3128
  this._msoNumfmtMap.set(sel.trim(), decoded);
3128
3129
  });
@@ -8348,7 +8349,8 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
8348
8349
  sheetId,
8349
8350
  documentLayoutObject,
8350
8351
  editorUnitId: this._editorUnitId,
8351
- isInArrayFormulaRange: cell === null || cell === void 0 ? void 0 : cell.isInArrayFormulaRange
8352
+ isInArrayFormulaRange: cell === null || cell === void 0 ? void 0 : cell.isInArrayFormulaRange,
8353
+ isPercentFormat: cell === null || cell === void 0 ? void 0 : cell.isPercentFormat
8352
8354
  };
8353
8355
  }
8354
8356
  _getWorkbookForEditUnit(unitId) {
@@ -10020,25 +10022,25 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
10020
10022
  _initialKeyboardListener(d) {
10021
10023
  let disposable = null;
10022
10024
  const addEvent = (render) => {
10025
+ disposable === null || disposable === void 0 || disposable.dispose();
10026
+ disposable = null;
10023
10027
  const docSelectionRenderService = render.with(DocSelectionRenderService);
10024
- if (docSelectionRenderService) {
10025
- disposable = toDisposable(docSelectionRenderService.onInputBefore$.subscribe((config) => {
10026
- var _this$_embedRuntimeFo;
10027
- if (!this._isCurrentSheetFocused()) return;
10028
- const isFocusFormulaEditor = this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR);
10029
- const isFocusSheets = this._contextService.getContextValue(FOCUSING_SHEET) || ((_this$_embedRuntimeFo = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo === void 0 ? void 0 : _this$_embedRuntimeFo.isChildUnitInActiveSession(this._context.unitId)) === true;
10030
- const unitId = render.unitId;
10031
- if (this._editorBridgeService.isVisible().visible) return;
10032
- if (unitId && isFocusSheets && !isFocusFormulaEditor) this._showEditorByKeyboard(config);
10033
- }));
10034
- d.add(disposable);
10035
- }
10028
+ if (docSelectionRenderService) disposable = toDisposable(docSelectionRenderService.onInputBefore$.subscribe((config) => {
10029
+ var _this$_embedRuntimeFo;
10030
+ if (!this._isCurrentSheetFocused()) return;
10031
+ const isFocusFormulaEditor = this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR);
10032
+ const isFocusSheets = this._contextService.getContextValue(FOCUSING_SHEET) || ((_this$_embedRuntimeFo = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo === void 0 ? void 0 : _this$_embedRuntimeFo.isChildUnitInActiveSession(this._context.unitId)) === true;
10033
+ const unitId = render.unitId;
10034
+ if (this._editorBridgeService.isVisible().visible) return;
10035
+ if (unitId && isFocusSheets && !isFocusFormulaEditor) this._showEditorByKeyboard(config);
10036
+ }));
10036
10037
  };
10037
10038
  const render = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
10038
10039
  if (render) addEvent(render);
10039
- else this.disposeWithMe(this._renderManagerService.created$.pipe(filter((render) => render.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY)).subscribe((render) => {
10040
+ d.add(this._renderManagerService.created$.pipe(filter((render) => render.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY)).subscribe(addEvent));
10041
+ d.add(toDisposable(() => {
10040
10042
  disposable === null || disposable === void 0 || disposable.dispose();
10041
- addEvent(render);
10043
+ disposable = null;
10042
10044
  }));
10043
10045
  }
10044
10046
  _initSheetFocusListener(d) {
@@ -10787,8 +10789,29 @@ const isRangeSelector = (unitId) => {
10787
10789
  //#endregion
10788
10790
  //#region src/controllers/editor/editing.render-controller.ts
10789
10791
  const HIDDEN_EDITOR_POSITION$1 = -1e3;
10792
+ function getPercentOffset(editCellState, dataStream) {
10793
+ if (!editCellState.isPercentFormat || editCellState.isInArrayFormulaRange) return null;
10794
+ const percentSuffix = `%${DEFAULT_EMPTY_DOCUMENT_VALUE}`;
10795
+ return (dataStream === null || dataStream === void 0 ? void 0 : dataStream.endsWith(percentSuffix)) ? dataStream.length - percentSuffix.length : null;
10796
+ }
10797
+ function getPercentEditorSelection(editCellState, visibleParam, dataStream) {
10798
+ const percentOffset = getPercentOffset(editCellState, dataStream);
10799
+ if (percentOffset == null) return null;
10800
+ const { eventType, initialValue, keycode } = visibleParam;
10801
+ if (eventType === DeviceInputEventType.Dblclick || eventType === DeviceInputEventType.Keyboard && keycode === KeyCode.F2) return {
10802
+ startOffset: percentOffset,
10803
+ endOffset: percentOffset,
10804
+ collapsed: true
10805
+ };
10806
+ if (eventType !== DeviceInputEventType.Keyboard || keycode === KeyCode.BACKSPACE || keycode === KeyCode.DELETE || !/^\d/.test(initialValue ?? "")) return null;
10807
+ return {
10808
+ startOffset: 0,
10809
+ endOffset: percentOffset,
10810
+ collapsed: false
10811
+ };
10812
+ }
10790
10813
  let EditingRenderController = class EditingRenderController extends Disposable {
10791
- constructor(_undoRedoService, _contextService, _renderManagerService, _editorBridgeService, _cellEditorManagerService, _lexerTreeBuilder, _functionService, _textSelectionManagerService, _commandService, _localService, _editorService, _univerInstanceService, _sheetInterceptorService, _sheetCellEditorResizeService, _selectionManagerService, _configService) {
10814
+ constructor(_undoRedoService, _contextService, _renderManagerService, _editorBridgeService, _cellEditorManagerService, _lexerTreeBuilder, _functionService, _textSelectionManagerService, _commandService, _localService, _editorService, _univerInstanceService, _sheetInterceptorService, _sheetCellEditorResizeService, _selectionManagerService, _configService, _docStateChangeManagerService) {
10792
10815
  super();
10793
10816
  this._undoRedoService = _undoRedoService;
10794
10817
  this._contextService = _contextService;
@@ -10806,6 +10829,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
10806
10829
  this._sheetCellEditorResizeService = _sheetCellEditorResizeService;
10807
10830
  this._selectionManagerService = _selectionManagerService;
10808
10831
  this._configService = _configService;
10832
+ this._docStateChangeManagerService = _docStateChangeManagerService;
10809
10833
  _defineProperty(this, "_cursorChange", 0);
10810
10834
  _defineProperty(this, "_editingUnit", "");
10811
10835
  _defineProperty(this, "_submitEmptyCellImageEdit", false);
@@ -10880,6 +10904,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
10880
10904
  const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(docUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
10881
10905
  if (!docSelectionRenderManager) return;
10882
10906
  docSelectionRenderManager.sync();
10907
+ this._cacheEmptyCellTextStyle();
10883
10908
  }));
10884
10909
  }
10885
10910
  _initSkeletonListener(d) {
@@ -10960,6 +10985,30 @@ let EditingRenderController = class EditingRenderController extends Disposable {
10960
10985
  * Listen to document edits to refresh the size of the sheet editor, not for normal editor.
10961
10986
  */
10962
10987
  _commandExecutedListener(d) {
10988
+ d.add(this._commandService.beforeCommandExecuted((command) => {
10989
+ var _this$_getDocumentDat;
10990
+ if (command.id !== InsertTextCommand.id) return;
10991
+ const params = command.params;
10992
+ const visibleParam = this._editorBridgeService.isVisible();
10993
+ const editCellState = this._editorBridgeService.getEditLocation();
10994
+ if (params.unitId !== DOCS_NORMAL_EDITOR_UNIT_ID_KEY || !visibleParam.visible || editCellState == null) return;
10995
+ const dataStream = (_this$_getDocumentDat = this._getDocumentDataModel()) === null || _this$_getDocumentDat === void 0 || (_this$_getDocumentDat = _this$_getDocumentDat.getBody()) === null || _this$_getDocumentDat === void 0 ? void 0 : _this$_getDocumentDat.dataStream;
10996
+ if (dataStream == null) return;
10997
+ const percentOffset = getPercentOffset(editCellState, dataStream);
10998
+ if (percentOffset != null && !this._editorBridgeService.getEditorDirty() && visibleParam.eventType === DeviceInputEventType.Keyboard && /^\d/.test(visibleParam.initialValue ?? "") && /^\d/.test(params.body.dataStream)) {
10999
+ params.range = {
11000
+ startOffset: 0,
11001
+ endOffset: percentOffset,
11002
+ collapsed: false
11003
+ };
11004
+ return;
11005
+ }
11006
+ if (percentOffset != null && params.body.dataStream === "%" && params.range.collapsed && params.range.startOffset === percentOffset && params.range.endOffset === percentOffset) params.range = {
11007
+ ...params.range,
11008
+ endOffset: percentOffset + 1,
11009
+ collapsed: false
11010
+ };
11011
+ }));
10963
11012
  d.add(this._commandService.onCommandExecuted((command) => {
10964
11013
  if (command.id === RichTextEditingMutation.id) {
10965
11014
  const { unitId: commandUnitId } = command.params;
@@ -10992,12 +11041,13 @@ let EditingRenderController = class EditingRenderController extends Disposable {
10992
11041
  }));
10993
11042
  }
10994
11043
  _handleEditorVisible(param) {
10995
- var _this$_sheetCellEdito4, _this$_renderManagerS5;
11044
+ var _this$_sheetCellEdito4, _documentDataModel$ge, _this$_renderManagerS5;
10996
11045
  const { eventType, keycode } = param;
10997
11046
  this._cursorChange = eventType === DeviceInputEventType.PointerDown || eventType === DeviceInputEventType.Dblclick ? 2 : 1;
10998
11047
  const editCellState = this._editorBridgeService.getEditLocation();
10999
11048
  if (editCellState == null) return;
11000
11049
  const { unitId, isInArrayFormulaRange = false } = editCellState;
11050
+ this._clearEditorHistory();
11001
11051
  this._commandService.syncExecuteCommand(ScrollToRangeOperation.id, {
11002
11052
  unitId,
11003
11053
  range: {
@@ -11037,35 +11087,51 @@ let EditingRenderController = class EditingRenderController extends Disposable {
11037
11087
  subUnitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY
11038
11088
  });
11039
11089
  };
11090
+ const replaceSelection = (selection) => {
11091
+ this._textSelectionManagerService.replaceDocRanges([selection], {
11092
+ unitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
11093
+ subUnitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY
11094
+ });
11095
+ };
11096
+ const percentSelection = getPercentEditorSelection(editCellState, param, (_documentDataModel$ge = documentDataModel.getBody()) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.dataStream);
11040
11097
  const cellImage = isCellImage(documentDataModel.getSnapshot());
11041
11098
  this._submitEmptyCellImageEdit = cellImage && eventType === DeviceInputEventType.Keyboard && keycode === KeyCode.BACKSPACE;
11042
11099
  if (cellImage) clearAndEdit();
11043
11100
  else if (eventType === DeviceInputEventType.Keyboard && keycode === KeyCode.F2) {
11044
- var _documentDataModel$ge;
11101
+ var _documentDataModel$ge2;
11045
11102
  document.makeDirty();
11046
11103
  this._textSelectionManagerService.replaceDocRanges([{
11047
11104
  startOffset: 0,
11048
11105
  endOffset: 0
11049
11106
  }]);
11050
- const endOffset = (((_documentDataModel$ge = documentDataModel.getBody()) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.dataStream.length) ?? 2) - 2;
11051
- this._textSelectionManagerService.replaceDocRanges([{
11107
+ const endOffset = (((_documentDataModel$ge2 = documentDataModel.getBody()) === null || _documentDataModel$ge2 === void 0 ? void 0 : _documentDataModel$ge2.dataStream.length) ?? 2) - 2;
11108
+ if (percentSelection) replaceSelection(percentSelection);
11109
+ else this._textSelectionManagerService.replaceDocRanges([{
11052
11110
  startOffset: endOffset,
11053
11111
  endOffset
11054
11112
  }], {
11055
11113
  unitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
11056
11114
  subUnitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY
11057
11115
  });
11058
- } else if (eventType === DeviceInputEventType.Keyboard || eventType === DeviceInputEventType.Dblclick && isInArrayFormulaRange) clearAndEdit();
11116
+ } else if (eventType === DeviceInputEventType.Keyboard || eventType === DeviceInputEventType.Dblclick && isInArrayFormulaRange) if (percentSelection) replaceSelection(percentSelection);
11117
+ else clearAndEdit();
11059
11118
  else if (eventType === DeviceInputEventType.Dblclick) {
11060
11119
  if (this._contextService.getContextValue(FOCUSING_EDITOR_INPUT_FORMULA)) return;
11061
11120
  const cursor = documentDataModel.getBody().dataStream.length - 2 || 0;
11062
- this._textSelectionManagerService.replaceDocRanges([{
11121
+ if (percentSelection) replaceSelection(percentSelection);
11122
+ else this._textSelectionManagerService.replaceDocRanges([{
11063
11123
  startOffset: cursor,
11064
11124
  endOffset: cursor
11065
11125
  }]);
11066
11126
  }
11067
11127
  (_this$_renderManagerS5 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS5 === void 0 || _this$_renderManagerS5.scene.resetCursor();
11068
11128
  }
11129
+ _cacheEmptyCellTextStyle() {
11130
+ var _this$_editorBridgeSe, _sourceBody$textRuns;
11131
+ const sourceBody = (_this$_editorBridgeSe = this._editorBridgeService.getEditLocation()) === null || _this$_editorBridgeSe === void 0 || (_this$_editorBridgeSe = _this$_editorBridgeSe.documentLayoutObject.documentModel) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.getBody();
11132
+ const textRun = (sourceBody === null || sourceBody === void 0 || (_sourceBody$textRuns = sourceBody.textRuns) === null || _sourceBody$textRuns === void 0 ? void 0 : _sourceBody$textRuns.length) === 1 ? sourceBody.textRuns[0] : null;
11133
+ if ((sourceBody === null || sourceBody === void 0 ? void 0 : sourceBody.dataStream) === DEFAULT_EMPTY_DOCUMENT_VALUE && (textRun === null || textRun === void 0 ? void 0 : textRun.st) === 0 && textRun.ed === 0) this._commandService.syncExecuteCommand(SetDocInputStyleCommand.id, { style: Tools.deepClone(textRun.ts) });
11134
+ }
11069
11135
  _refreshCurrentSelections(sheetId) {
11070
11136
  const selections = this._workbookSelections.getSelectionsOfWorksheet(sheetId);
11071
11137
  if (selections) {
@@ -11189,8 +11255,13 @@ let EditingRenderController = class EditingRenderController extends Disposable {
11189
11255
  var _this$_getEditorSkele;
11190
11256
  (_this$_getEditorSkele = this._getEditorSkeleton(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_getEditorSkele === void 0 || _this$_getEditorSkele.resetInitialWidth();
11191
11257
  }
11192
- this._undoRedoService.clearUndoRedo(editorUnitId);
11258
+ this._clearEditorHistory();
11259
+ }
11260
+ _clearEditorHistory() {
11261
+ this._undoRedoService.clearUndoRedo(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
11193
11262
  this._undoRedoService.clearUndoRedo(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
11263
+ this._docStateChangeManagerService.clearHistory(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
11264
+ this._docStateChangeManagerService.clearHistory(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
11194
11265
  }
11195
11266
  _moveSelection(keycode, currentUnitId, worksheetId) {
11196
11267
  if (keycode == null || !MOVE_SELECTION_KEYCODE_LIST.includes(keycode)) {
@@ -11294,7 +11365,8 @@ EditingRenderController = __decorate([
11294
11365
  __decorateParam(12, Inject(SheetInterceptorService)),
11295
11366
  __decorateParam(13, Inject(SheetCellEditorResizeService)),
11296
11367
  __decorateParam(14, Inject(SheetsSelectionsService)),
11297
- __decorateParam(15, IConfigService)
11368
+ __decorateParam(15, IConfigService),
11369
+ __decorateParam(16, Inject(DocStateChangeManagerService))
11298
11370
  ], EditingRenderController);
11299
11371
  function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService, functionService, styles) {
11300
11372
  var _styles$get;
@@ -23124,11 +23196,11 @@ function RenderSheetFooter() {
23124
23196
  const showFooter = (config === null || config === void 0 ? void 0 : config.footer) ?? true;
23125
23197
  const workbook = useRootWorkbenchWorkbook();
23126
23198
  const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
23127
- const focusedUnitType = useFocusedUnitType();
23199
+ const rootUnitType = useWorkbenchRootUnitType();
23128
23200
  const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
23129
23201
  if (!workbook || !showFooter) return null;
23130
23202
  if (activeWorkbookEmbeddedRender) return null;
23131
- if (!activeEmbedTab && focusedUnitType != null && focusedUnitType !== UniverInstanceType.UNIVER_SHEET) return null;
23203
+ if (rootUnitType !== UniverInstanceType.UNIVER_SHEET) return null;
23132
23204
  const footerMenus = menuManagerService.getMenuByPositionKey(ContextMenuPosition.FOOTER_MENU);
23133
23205
  const { sheetBar = true, statisticBar = true, menus = true, zoomSlider = true } = (config === null || config === void 0 ? void 0 : config.footer) || {};
23134
23206
  const showStatisticBar = activeEmbedTab ? false : statisticBar;
@@ -23158,16 +23230,12 @@ function RenderSheetHeader() {
23158
23230
  const workbook = useRootWorkbenchWorkbook();
23159
23231
  const hasWorkbook = !!workbook;
23160
23232
  const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
23161
- const focusedUnitType = useFocusedUnitType();
23233
+ const rootUnitType = useWorkbenchRootUnitType();
23162
23234
  const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
23163
23235
  if (!hasWorkbook) return null;
23164
23236
  if (activeWorkbookEmbeddedRender) return null;
23165
23237
  if (activeEmbedTab) return null;
23166
- if (focusedUnitType != null && focusedUnitType !== UniverInstanceType.UNIVER_SHEET) return /* @__PURE__ */ jsx("div", {
23167
- "aria-hidden": true,
23168
- className: "univer-h-7 univer-border-b univer-border-gray-200 univer-bg-gray-0 dark:!univer-border-gray-700 dark:!univer-bg-gray-900",
23169
- "data-u-comp": "formula-bar-placeholder"
23170
- });
23238
+ if (rootUnitType !== UniverInstanceType.UNIVER_SHEET) return null;
23171
23239
  if ((config === null || config === void 0 ? void 0 : config.formulaBar) !== false) return /* @__PURE__ */ jsx(FormulaBar, {});
23172
23240
  return null;
23173
23241
  }
@@ -23181,8 +23249,7 @@ function RenderSheetContent() {
23181
23249
  const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
23182
23250
  const injector = useDependency(Injector);
23183
23251
  const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
23184
- const focusedUnitType = useFocusedUnitType();
23185
- const rootWorkbenchOwnsSheet = activeEmbedTab != null || focusedUnitType == null || focusedUnitType === UniverInstanceType.UNIVER_SHEET;
23252
+ const rootWorkbenchOwnsSheet = useWorkbenchRootUnitType() === UniverInstanceType.UNIVER_SHEET;
23186
23253
  const ShapeTextEditorContainer = componentManager.get("SheetShapeTextEditorContainer") ?? componentManager.get("ShapeTextEditorContainer");
23187
23254
  useEffect(() => {
23188
23255
  var _tryGetSheetEmbedRunt;
@@ -23279,15 +23346,8 @@ function useRootWorkbenchWorkbook() {
23279
23346
  useObservable(() => (runtimeFocusCoordinator === null || runtimeFocusCoordinator === void 0 ? void 0 : runtimeFocusCoordinator.runtimeSessionChanged$) ?? EMPTY, null, false, [runtimeFocusCoordinator])
23280
23347
  ]);
23281
23348
  }
23282
- function useFocusedUnitType() {
23283
- const univerInstanceService = useDependency(IUniverInstanceService);
23284
- const focusedUnitId = useObservable(() => univerInstanceService.focused$, null, false, [univerInstanceService]);
23285
- return useMemo(() => {
23286
- if (!focusedUnitId) return null;
23287
- if (isInternalEditorID(focusedUnitId) && univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) return UniverInstanceType.UNIVER_SHEET;
23288
- const focusedUnit = univerInstanceService.getUnit(focusedUnitId);
23289
- return (focusedUnit === null || focusedUnit === void 0 ? void 0 : focusedUnit.type) ?? null;
23290
- }, [focusedUnitId, univerInstanceService]);
23349
+ function useWorkbenchRootUnitType() {
23350
+ return useObservable(useDependency(IWorkbenchService).rootUnitType$, null, true);
23291
23351
  }
23292
23352
  function useActiveSheetEmbedTabData(workbook) {
23293
23353
  const worksheet = useActiveWorksheet(workbook);
@@ -23912,7 +23972,7 @@ const useHighlightRange = (ranges = []) => {
23912
23972
  //#endregion
23913
23973
  //#region package.json
23914
23974
  var name = "@univerjs/sheets-ui";
23915
- var version = "1.0.0-beta.1";
23975
+ var version = "1.0.0-beta.2";
23916
23976
 
23917
23977
  //#endregion
23918
23978
  //#region src/views/cell-popup/config.ts
@@ -24133,6 +24193,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
24133
24193
  const canvasElement = currentRender.engine.getCanvasElement();
24134
24194
  const scaleAdjust = canvasElement.getBoundingClientRect().width / pxToNum(canvasElement.style.width);
24135
24195
  const { scaleX, scaleY } = currentRender.scene.getAncestorScale();
24196
+ const viewMain = currentRender.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
24136
24197
  const id = this._globalPopupManagerService.addPopup({
24137
24198
  ...popup,
24138
24199
  unitId,
@@ -24142,8 +24203,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
24142
24203
  anchorRect$: position$,
24143
24204
  canvasElement,
24144
24205
  boundaryInsets: popup.constrainToCanvas ? {
24145
- left: skeleton.rowHeaderWidth * scaleAdjust * scaleX,
24146
- top: skeleton.columnHeaderHeight * scaleAdjust * scaleY
24206
+ left: ((viewMain === null || viewMain === void 0 ? void 0 : viewMain.left) ?? skeleton.rowHeaderWidth * scaleX) * scaleAdjust,
24207
+ top: ((viewMain === null || viewMain === void 0 ? void 0 : viewMain.top) ?? skeleton.columnHeaderHeight * scaleY) * scaleAdjust
24147
24208
  } : popup.boundaryInsets
24148
24209
  });
24149
24210
  const disposableCollection = new DisposableCollection();
@@ -27866,10 +27927,11 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
27866
27927
  if (unitId === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) this._formulaEditorController.autoScroll();
27867
27928
  }
27868
27929
  _checkAndSetRenderStyleConfig(documentDataModel) {
27869
- var _snapshot$body;
27930
+ var _snapshot$documentSty, _snapshot$body;
27870
27931
  const snapshot = documentDataModel.getSnapshot();
27871
27932
  if (snapshot.id !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY && snapshot.id !== DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
27872
27933
  const isFormulaBar = snapshot.id === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
27934
+ const previousPageWidth = (_snapshot$documentSty = snapshot.documentStyle) === null || _snapshot$documentSty === void 0 || (_snapshot$documentSty = _snapshot$documentSty.pageSize) === null || _snapshot$documentSty === void 0 ? void 0 : _snapshot$documentSty.width;
27873
27935
  if (isFormulaBar) snapshot.documentStyle = {
27874
27936
  ...formulaEditorStyle,
27875
27937
  textStyle: { cl: { rgb: this._themeService.getColorFromTheme("gray.900") } }
@@ -27882,8 +27944,8 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
27882
27944
  }
27883
27945
  const position = isFormulaBar ? this._formulaEditorManagerService.getPosition() : null;
27884
27946
  if (isFormulaBar && position) {
27885
- const width = position.width;
27886
- snapshot.documentStyle.pageSize = {
27947
+ const width = position.width > 0 ? position.width : previousPageWidth;
27948
+ if (width != null && width > 0) snapshot.documentStyle.pageSize = {
27887
27949
  width,
27888
27950
  height: Infinity
27889
27951
  };
@@ -29246,35 +29308,37 @@ FormatPainterRenderController = __decorate([
29246
29308
  //#region src/controllers/render-controllers/header-menu.render-controller.ts
29247
29309
  const HEADER_MENU_CONTROLLER_SHAPE = "__SpreadsheetHeaderMenuSHAPEControllerShape__";
29248
29310
  const HEADER_MENU_CONTROLLER_MENU = "__SpreadsheetHeaderMenuMAINControllerShape__";
29249
- const HEADER_MENU_CONTROLLER_SHAPE_COLOR = "gray.100";
29311
+ const HEADER_MENU_CONTROLLER_SHAPE_ALPHA = .1;
29250
29312
  let HeaderMenuRenderController = class HeaderMenuRenderController extends Disposable {
29251
- constructor(_context, _sheetSkeletonManagerService, _contextMenuService, _commandService, _selectionManagerService) {
29313
+ constructor(_context, _sheetSkeletonManagerService, _contextMenuService, _commandService, _selectionManagerService, _themeService) {
29252
29314
  super();
29253
29315
  this._context = _context;
29254
29316
  this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
29255
29317
  this._contextMenuService = _contextMenuService;
29256
29318
  this._commandService = _commandService;
29257
29319
  this._selectionManagerService = _selectionManagerService;
29320
+ this._themeService = _themeService;
29258
29321
  _defineProperty(this, "_hoverRect", void 0);
29259
29322
  _defineProperty(this, "_hoverMenu", void 0);
29260
29323
  _defineProperty(this, "_currentColumn", Number.POSITIVE_INFINITY);
29261
- _defineProperty(this, "_headerPointerSubs", void 0);
29262
- _defineProperty(this, "_colHeaderPointerSubs", void 0);
29324
+ _defineProperty(this, "_headerPointerSubs", new Subscription());
29263
29325
  this._initialize();
29264
29326
  }
29265
29327
  dispose() {
29266
- var _this$_hoverRect, _this$_hoverMenu, _this$_headerPointerS;
29328
+ var _this$_hoverRect, _this$_hoverMenu;
29329
+ super.dispose();
29267
29330
  (_this$_hoverRect = this._hoverRect) === null || _this$_hoverRect === void 0 || _this$_hoverRect.dispose();
29268
29331
  (_this$_hoverMenu = this._hoverMenu) === null || _this$_hoverMenu === void 0 || _this$_hoverMenu.dispose();
29269
- (_this$_headerPointerS = this._headerPointerSubs) === null || _this$_headerPointerS === void 0 || _this$_headerPointerS.unsubscribe();
29270
- this._headerPointerSubs = null;
29332
+ this._headerPointerSubs.unsubscribe();
29271
29333
  }
29272
29334
  _initialize() {
29273
29335
  const scene = this._context.scene;
29274
- this._hoverRect = new Rect(HEADER_MENU_CONTROLLER_SHAPE, {
29275
- fill: HEADER_MENU_CONTROLLER_SHAPE_COLOR,
29276
- evented: false
29277
- });
29336
+ this._hoverRect = new Rect(HEADER_MENU_CONTROLLER_SHAPE, { evented: false });
29337
+ this.disposeWithMe(this._themeService.currentTheme$.subscribe(() => {
29338
+ var _this$_hoverRect2;
29339
+ const color = this._themeService.getColorFromTheme("gray.900");
29340
+ (_this$_hoverRect2 = this._hoverRect) === null || _this$_hoverRect2 === void 0 || _this$_hoverRect2.setProps({ fill: new ColorKit(color).setAlpha(HEADER_MENU_CONTROLLER_SHAPE_ALPHA).toRgbString() });
29341
+ }));
29278
29342
  this._hoverMenu = new HeaderMenuShape(HEADER_MENU_CONTROLLER_MENU, {
29279
29343
  zIndex: 100,
29280
29344
  visible: false
@@ -29285,7 +29349,6 @@ let HeaderMenuRenderController = class HeaderMenuRenderController extends Dispos
29285
29349
  this._initialHoverMenu();
29286
29350
  }
29287
29351
  _initialHover(initialType = 0) {
29288
- var _this$_headerPointerS2, _this$_headerPointerS3, _this$_headerPointerS4;
29289
29352
  const spreadsheetColumnHeader = this._context.components.get("__SpreadsheetColumnHeader__");
29290
29353
  const spreadsheetRowHeader = this._context.components.get("__SpreadsheetRowHeader__");
29291
29354
  const eventBindingObject = initialType === 0 ? spreadsheetRowHeader : spreadsheetColumnHeader;
@@ -29296,17 +29359,17 @@ let HeaderMenuRenderController = class HeaderMenuRenderController extends Dispos
29296
29359
  const { rowBaseWidth, rowGutterWidth, columnBaseHeight, columnGutterHeight } = getHeaderBaseLayout(skeleton);
29297
29360
  const { startX, startY, endX, endY, column } = getCoordByOffset(evt.offsetX, evt.offsetY, this._context.scene, skeleton);
29298
29361
  if (initialType === 0) {
29299
- var _this$_hoverRect2;
29300
- (_this$_hoverRect2 = this._hoverRect) === null || _this$_hoverRect2 === void 0 || _this$_hoverRect2.transformByState({
29362
+ var _this$_hoverRect3;
29363
+ (_this$_hoverRect3 = this._hoverRect) === null || _this$_hoverRect3 === void 0 || _this$_hoverRect3.transformByState({
29301
29364
  width: rowBaseWidth,
29302
29365
  height: endY - startY,
29303
29366
  left: rowGutterWidth,
29304
29367
  top: startY
29305
29368
  });
29306
29369
  } else {
29307
- var _this$_hoverRect3;
29370
+ var _this$_hoverRect4;
29308
29371
  this._currentColumn = column;
29309
- (_this$_hoverRect3 = this._hoverRect) === null || _this$_hoverRect3 === void 0 || _this$_hoverRect3.transformByState({
29372
+ (_this$_hoverRect4 = this._hoverRect) === null || _this$_hoverRect4 === void 0 || _this$_hoverRect4.transformByState({
29310
29373
  width: endX - startX,
29311
29374
  height: columnBaseHeight,
29312
29375
  left: startX,
@@ -29327,21 +29390,20 @@ let HeaderMenuRenderController = class HeaderMenuRenderController extends Dispos
29327
29390
  }
29328
29391
  };
29329
29392
  const pointerEnterHandler = () => {
29330
- var _this$_hoverRect4;
29331
- (_this$_hoverRect4 = this._hoverRect) === null || _this$_hoverRect4 === void 0 || _this$_hoverRect4.show();
29393
+ var _this$_hoverRect5;
29394
+ (_this$_hoverRect5 = this._hoverRect) === null || _this$_hoverRect5 === void 0 || _this$_hoverRect5.show();
29332
29395
  };
29333
29396
  const pointerLeaveHandler = () => {
29334
- var _this$_hoverRect5, _this$_hoverMenu2;
29335
- (_this$_hoverRect5 = this._hoverRect) === null || _this$_hoverRect5 === void 0 || _this$_hoverRect5.hide();
29397
+ var _this$_hoverRect6, _this$_hoverMenu2;
29398
+ (_this$_hoverRect6 = this._hoverRect) === null || _this$_hoverRect6 === void 0 || _this$_hoverRect6.hide();
29336
29399
  (_this$_hoverMenu2 = this._hoverMenu) === null || _this$_hoverMenu2 === void 0 || _this$_hoverMenu2.hide();
29337
29400
  };
29338
- this._headerPointerSubs = new Subscription();
29339
29401
  const headerPointerMoveSub = eventBindingObject.onPointerMove$.subscribeEvent(pointerMoveHandler);
29340
29402
  const headerPointerEnterSub = eventBindingObject.onPointerEnter$.subscribeEvent(pointerEnterHandler);
29341
29403
  const headerPointerLeaveSub = eventBindingObject.onPointerLeave$.subscribeEvent(pointerLeaveHandler);
29342
- (_this$_headerPointerS2 = this._headerPointerSubs) === null || _this$_headerPointerS2 === void 0 || _this$_headerPointerS2.add(headerPointerMoveSub);
29343
- (_this$_headerPointerS3 = this._headerPointerSubs) === null || _this$_headerPointerS3 === void 0 || _this$_headerPointerS3.add(headerPointerEnterSub);
29344
- (_this$_headerPointerS4 = this._headerPointerSubs) === null || _this$_headerPointerS4 === void 0 || _this$_headerPointerS4.add(headerPointerLeaveSub);
29404
+ this._headerPointerSubs.add(headerPointerMoveSub);
29405
+ this._headerPointerSubs.add(headerPointerEnterSub);
29406
+ this._headerPointerSubs.add(headerPointerLeaveSub);
29345
29407
  }
29346
29408
  _initialHoverMenu() {
29347
29409
  if (this._hoverMenu == null) return;
@@ -29412,7 +29474,8 @@ HeaderMenuRenderController = __decorate([
29412
29474
  __decorateParam(1, Inject(SheetSkeletonManagerService)),
29413
29475
  __decorateParam(2, IContextMenuService),
29414
29476
  __decorateParam(3, ICommandService),
29415
- __decorateParam(4, Inject(SheetsSelectionsService))
29477
+ __decorateParam(4, Inject(SheetsSelectionsService)),
29478
+ __decorateParam(5, Inject(ThemeService))
29416
29479
  ], HeaderMenuRenderController);
29417
29480
  function getHeaderBaseLayout(skeleton) {
29418
29481
  var _skeleton$worksheet$g, _skeleton$worksheet, _config$rowHeader, _config$columnHeader;
@@ -31793,6 +31856,7 @@ let SheetContextMenuRenderController = class SheetContextMenuRenderController ex
31793
31856
  this._selectionRenderService = _selectionRenderService;
31794
31857
  this._injector = _injector;
31795
31858
  this._init();
31859
+ this._initEmbedRuntimeSessionListener();
31796
31860
  }
31797
31861
  _init() {
31798
31862
  var _this$_context;
@@ -31840,6 +31904,13 @@ let SheetContextMenuRenderController = class SheetContextMenuRenderController ex
31840
31904
  });
31841
31905
  this.disposeWithMe(colHeaderObserver);
31842
31906
  }
31907
+ _initEmbedRuntimeSessionListener() {
31908
+ const runtimeFocusCoordinator = this._getSheetEmbedRuntimeFocusCoordinator();
31909
+ if (!runtimeFocusCoordinator) return;
31910
+ this.disposeWithMe(runtimeFocusCoordinator.runtimeSessionChanged$.subscribe(() => {
31911
+ if (shouldHideSheetHostContextMenuForEmbedSession(this._context.unitId, runtimeFocusCoordinator.resolveActiveChildSessionRuntimeScope())) this._contextMenuService.hideContextMenu();
31912
+ }));
31913
+ }
31843
31914
  _shouldSuppressHostContextMenu() {
31844
31915
  var _this$_getSheetHostCh, _this$_getSheetHostCh2;
31845
31916
  return shouldSuppressSheetContextMenuForEmbedOverride(this._context.unitId, (_this$_getSheetHostCh = this._getSheetHostChromeOverrideService()) === null || _this$_getSheetHostCh === void 0 || (_this$_getSheetHostCh2 = _this$_getSheetHostCh.getOverride) === null || _this$_getSheetHostCh2 === void 0 ? void 0 : _this$_getSheetHostCh2.call(_this$_getSheetHostCh));
@@ -31847,6 +31918,9 @@ let SheetContextMenuRenderController = class SheetContextMenuRenderController ex
31847
31918
  _getSheetHostChromeOverrideService() {
31848
31919
  return this._injector.has(ISheetHostChromeOverrideService) ? this._injector.get(ISheetHostChromeOverrideService) : void 0;
31849
31920
  }
31921
+ _getSheetEmbedRuntimeFocusCoordinator() {
31922
+ return this._injector.has(ISheetEmbedRuntimeFocusCoordinator) ? this._injector.get(ISheetEmbedRuntimeFocusCoordinator) : void 0;
31923
+ }
31850
31924
  };
31851
31925
  SheetContextMenuRenderController = __decorate([
31852
31926
  __decorateParam(1, IContextMenuService),
@@ -31854,6 +31928,9 @@ SheetContextMenuRenderController = __decorate([
31854
31928
  __decorateParam(3, ISheetSelectionRenderService),
31855
31929
  __decorateParam(4, Inject(Injector))
31856
31930
  ], SheetContextMenuRenderController);
31931
+ function shouldHideSheetHostContextMenuForEmbedSession(hostUnitId, activeScope) {
31932
+ return (activeScope === null || activeScope === void 0 ? void 0 : activeScope.hostUnitId) === hostUnitId && activeScope.sessionMode !== "host-passive";
31933
+ }
31857
31934
  function shouldSuppressSheetContextMenuForEmbedOverride(hostUnitId, override) {
31858
31935
  return override != null && override.hostUnitId === hostUnitId && override.entry === "sheets-sheet-tab";
31859
31936
  }
@@ -295,8 +295,8 @@ const locale = { "sheets-ui": {
295
295
  allowedPermissionType: "Tipus de permisos permesos",
296
296
  alert: "Alerta",
297
297
  search: "Cercar",
298
- ownerInherit: "Propietario del documento, herencia de permisos habilitada",
299
- ownerWithoutInherit: "Propietario del documento, herencia de permisos no habilitada",
298
+ ownerInherit: "Propietari del document, herència de permisos activada",
299
+ ownerWithoutInherit: "Propietari del document, herència de permisos desactivada",
300
300
  alertContent: "Aquest interval està protegit i actualment no hi ha permisos d'edició disponibles. Si necessiteu editar, contacteu amb el creador.",
301
301
  userEmpty: "cap persona designada, compartiu l'enllaç per convidar persones específiques.",
302
302
  listEmpty: "No heu configurat cap interval o full com a protegit.",
@@ -295,8 +295,8 @@ const locale = { "sheets-ui": {
295
295
  allowedPermissionType: "Povolené typy oprávnení",
296
296
  alert: "Upozornenie",
297
297
  search: "Hľadať",
298
- ownerInherit: "Vlastník dokumentu, dědičnost oprávnění povolena",
299
- ownerWithoutInherit: "Vlastník dokumentu, dědičnost oprávnění není povolena",
298
+ ownerInherit: "Vlastník dokumentu, dedenie oprávnení je povolené",
299
+ ownerWithoutInherit: "Vlastník dokumentu, dedenie oprávnení nie je povolené",
300
300
  alertContent: "Tento rozsah je chránený a momentálne nemáte povolenie na úpravy. Ak potrebujete upravovať, kontaktujte autora.",
301
301
  userEmpty: "žiadna určená osoba, zdieľajte odkaz na pozvanie konkrétnych ľudí.",
302
302
  listEmpty: "Nenastavili ste žiadne rozsahy ani hárky ako chránené.",
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { DocumentDataModel, ICellData, IDocumentBody, IDocumentData, IStyleData, Nullable, Styles } from '@univerjs/core';
17
17
  import { Disposable, ICommandService, IConfigService, IContextService, IUndoRedoService, IUniverInstanceService, LocaleService } from '@univerjs/core';
18
- import { DocSelectionManagerService } from '@univerjs/docs';
18
+ import { DocSelectionManagerService, DocStateChangeManagerService } from '@univerjs/docs';
19
19
  import { IEditorService } from '@univerjs/docs-ui';
20
20
  import { IFunctionService, LexerTreeBuilder } from '@univerjs/engine-formula';
21
21
  import { IRenderManagerService } from '@univerjs/engine-render';
@@ -40,6 +40,7 @@ export declare class EditingRenderController extends Disposable {
40
40
  private readonly _sheetCellEditorResizeService;
41
41
  private readonly _selectionManagerService;
42
42
  private readonly _configService;
43
+ private readonly _docStateChangeManagerService;
43
44
  /**
44
45
  * It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
45
46
  */
@@ -48,7 +49,7 @@ export declare class EditingRenderController extends Disposable {
48
49
  private _editingUnit;
49
50
  private _submitEmptyCellImageEdit;
50
51
  _cursorTimeout: NodeJS.Timeout;
51
- constructor(_undoRedoService: IUndoRedoService, _contextService: IContextService, _renderManagerService: IRenderManagerService, _editorBridgeService: IEditorBridgeService, _cellEditorManagerService: ICellEditorManagerService, _lexerTreeBuilder: LexerTreeBuilder, _functionService: IFunctionService, _textSelectionManagerService: DocSelectionManagerService, _commandService: ICommandService, _localService: LocaleService, _editorService: IEditorService, _univerInstanceService: IUniverInstanceService, _sheetInterceptorService: SheetInterceptorService, _sheetCellEditorResizeService: SheetCellEditorResizeService, _selectionManagerService: SheetsSelectionsService, _configService: IConfigService);
52
+ constructor(_undoRedoService: IUndoRedoService, _contextService: IContextService, _renderManagerService: IRenderManagerService, _editorBridgeService: IEditorBridgeService, _cellEditorManagerService: ICellEditorManagerService, _lexerTreeBuilder: LexerTreeBuilder, _functionService: IFunctionService, _textSelectionManagerService: DocSelectionManagerService, _commandService: ICommandService, _localService: LocaleService, _editorService: IEditorService, _univerInstanceService: IUniverInstanceService, _sheetInterceptorService: SheetInterceptorService, _sheetCellEditorResizeService: SheetCellEditorResizeService, _selectionManagerService: SheetsSelectionsService, _configService: IConfigService, _docStateChangeManagerService: DocStateChangeManagerService);
52
53
  dispose(): void;
53
54
  private get _workbookSelections();
54
55
  private _init;
@@ -66,6 +67,7 @@ export declare class EditingRenderController extends Disposable {
66
67
  */
67
68
  private _commandExecutedListener;
68
69
  private _handleEditorVisible;
70
+ private _cacheEmptyCellTextStyle;
69
71
  private _refreshCurrentSelections;
70
72
  private _handleEditorInvisible;
71
73
  private _getEditorObject;
@@ -73,6 +75,7 @@ export declare class EditingRenderController extends Disposable {
73
75
  private _submitEdit;
74
76
  private _removeComposedCellStyleInCellData;
75
77
  private _exitInput;
78
+ private _clearEditorHistory;
76
79
  private _moveSelection;
77
80
  /**
78
81
  * The user's operations follow the sequence of opening the editor and then moving the cursor.
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { Workbook } from '@univerjs/core';
17
17
  import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
+ import type { ISheetEmbedRuntimeDomScope } from '../../services/sheet-embed-integration.service';
18
19
  import type { ISheetHostChromeOverride } from '../../services/sheet-host-chrome-override.service';
19
20
  import { Disposable, Injector } from '@univerjs/core';
20
21
  import { SheetsSelectionsService } from '@univerjs/sheets';
@@ -32,7 +33,10 @@ export declare class SheetContextMenuRenderController extends Disposable impleme
32
33
  private readonly _injector;
33
34
  constructor(_context: IRenderContext<Workbook>, _contextMenuService: IContextMenuService, _selectionManagerService: SheetsSelectionsService, _selectionRenderService: ISheetSelectionRenderService, _injector: Injector);
34
35
  private _init;
36
+ private _initEmbedRuntimeSessionListener;
35
37
  private _shouldSuppressHostContextMenu;
36
38
  private _getSheetHostChromeOverrideService;
39
+ private _getSheetEmbedRuntimeFocusCoordinator;
37
40
  }
41
+ export declare function shouldHideSheetHostContextMenuForEmbedSession(hostUnitId: string, activeScope: ISheetEmbedRuntimeDomScope | undefined): boolean;
38
42
  export declare function shouldSuppressSheetContextMenuForEmbedOverride(hostUnitId: string, override: Pick<ISheetHostChromeOverride, 'entry' | 'hostUnitId'> | null | undefined): boolean;