@univerjs/sheets-ui 1.0.0-alpha.7 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +14 -41
- package/lib/cjs/index.js +736 -838
- package/lib/cjs/locale/ar-SA.js +0 -2
- package/lib/cjs/locale/ca-ES.js +1 -3
- package/lib/cjs/locale/de-DE.js +0 -2
- package/lib/cjs/locale/en-US.js +0 -2
- package/lib/cjs/locale/es-ES.js +1 -3
- package/lib/cjs/locale/fa-IR.js +0 -2
- package/lib/cjs/locale/fr-FR.js +0 -2
- package/lib/cjs/locale/id-ID.js +1 -3
- package/lib/cjs/locale/it-IT.js +0 -2
- package/lib/cjs/locale/ja-JP.js +0 -2
- package/lib/cjs/locale/ko-KR.js +9 -11
- package/lib/cjs/locale/pl-PL.js +0 -2
- package/lib/cjs/locale/pt-BR.js +1 -3
- package/lib/cjs/locale/ru-RU.js +0 -2
- package/lib/cjs/locale/sk-SK.js +0 -2
- package/lib/cjs/locale/vi-VN.js +0 -2
- package/lib/cjs/locale/zh-CN.js +1 -3
- package/lib/cjs/locale/zh-HK.js +3 -5
- package/lib/cjs/locale/zh-TW.js +3 -5
- package/lib/es/facade.js +15 -42
- package/lib/es/index.js +743 -845
- package/lib/es/locale/ar-SA.js +0 -2
- package/lib/es/locale/ca-ES.js +1 -3
- package/lib/es/locale/de-DE.js +0 -2
- package/lib/es/locale/en-US.js +0 -2
- package/lib/es/locale/es-ES.js +1 -3
- package/lib/es/locale/fa-IR.js +0 -2
- package/lib/es/locale/fr-FR.js +0 -2
- package/lib/es/locale/id-ID.js +1 -3
- package/lib/es/locale/it-IT.js +0 -2
- package/lib/es/locale/ja-JP.js +0 -2
- package/lib/es/locale/ko-KR.js +9 -11
- package/lib/es/locale/pl-PL.js +0 -2
- package/lib/es/locale/pt-BR.js +1 -3
- package/lib/es/locale/ru-RU.js +0 -2
- package/lib/es/locale/sk-SK.js +0 -2
- package/lib/es/locale/vi-VN.js +0 -2
- package/lib/es/locale/zh-CN.js +1 -3
- package/lib/es/locale/zh-HK.js +3 -5
- package/lib/es/locale/zh-TW.js +3 -5
- package/lib/facade.js +15 -42
- package/lib/index.css +6 -5
- package/lib/index.js +743 -845
- package/lib/locale/ar-SA.js +0 -2
- package/lib/locale/ca-ES.js +1 -3
- package/lib/locale/de-DE.js +0 -2
- package/lib/locale/en-US.js +0 -2
- package/lib/locale/es-ES.js +1 -3
- package/lib/locale/fa-IR.js +0 -2
- package/lib/locale/fr-FR.js +0 -2
- package/lib/locale/id-ID.js +1 -3
- package/lib/locale/it-IT.js +0 -2
- package/lib/locale/ja-JP.js +0 -2
- package/lib/locale/ko-KR.js +9 -11
- package/lib/locale/pl-PL.js +0 -2
- package/lib/locale/pt-BR.js +1 -3
- package/lib/locale/ru-RU.js +0 -2
- package/lib/locale/sk-SK.js +0 -2
- package/lib/locale/vi-VN.js +0 -2
- package/lib/locale/zh-CN.js +1 -3
- package/lib/locale/zh-HK.js +3 -5
- package/lib/locale/zh-TW.js +3 -5
- package/lib/types/commands/operations/cell-edit.operation.d.ts +0 -2
- package/lib/types/config/config.d.ts +0 -4
- package/lib/types/controllers/editor/editing.render-controller.d.ts +0 -1
- package/lib/types/facade/f-workbook.d.ts +1 -63
- package/lib/types/facade/f-worksheet.d.ts +6 -35
- package/lib/types/locale/en-US.d.ts +0 -2
- package/lib/types/services/clipboard/type.d.ts +0 -1
- package/lib/types/services/editor-bridge.service.d.ts +1 -1
- package/lib/types/services/selection/base-selection-render.service.d.ts +0 -17
- package/lib/types/services/selection/selection-control.d.ts +0 -12
- package/lib/types/services/selection/selection-render-model.d.ts +1 -1
- package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/slide-tab-bar.d.ts +0 -1
- package/lib/types/views/sheet-container/SheetContainer.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +11 -11
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +15 -15
- package/lib/types/views/editor-container/EditorContainer.spec.d.ts +0 -16
package/lib/es/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { BreakLineCommand, CoverContentCommand, DOCS_COMPONENT_MAIN_LAYER_INDEX, DOCS_VIEW_KEY, DOC_VERTICAL_PADDING, DeleteLeftCommand, DeleteRightCommand, DocSelectionRenderService, IEditorService, IMEInputCommand, MoveCursorOperation, MoveSelectionOperation, NodePositionConvertToCursor, ReplaceSnapshotCommand, SetInlineFormatBoldCommand, SetInlineFormatCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand, VIEWPORT_KEY, convertBodyToHtml, getCanvasOffsetByEngine, getLineBounding } from "@univerjs/docs-ui";
|
|
2
|
-
import { AbsoluteRefType, BaselineOffset, BooleanNumber, BorderStyleTypes, CellModeEnum, CellValueType, ColorKit, CommandType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, 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,
|
|
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, rangeToDiscreteRange, serializeListOptions, setEndForRange, validateDefinedName } from "@univerjs/sheets";
|
|
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_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, 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";
|
|
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
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";
|
|
5
|
-
import { CURSOR_TYPE, DashedRect, DeviceInputEventType, Engine, FIX_ONE_PIXEL_BLUR_OFFSET, Group, IRenderManagerService, Layer, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, Rect, RegularPolygon, RenderUnit, SHEET_EXTENSION_PREFIX, SHEET_VIEWPORT_KEY, Scene, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetExtension, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetRowHeader, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Vector2, Viewport, cancelRequestFrame, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, fixLineWidthByScale, getCurrentTypeOfRenderer, getNextWheelZoomRatio, ptToPixel, requestNewFrame, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
|
|
6
|
-
import { BehaviorSubject, EMPTY, Observable, Subject, Subscription, combineLatest, combineLatestWith, distinctUntilChanged, filter, firstValueFrom, from, fromEvent, map, merge as merge$1, of, shareReplay, startWith, switchMap, take, takeUntil, throttleTime, timeout, withLatestFrom } from "rxjs";
|
|
7
|
-
import { DocSelectionManagerService, DocSkeletonManagerService, InsertTextCommand, RichTextEditingMutation, SetTextSelectionsOperation } from "@univerjs/docs";
|
|
5
|
+
import { CURSOR_TYPE, DashedRect, DeviceInputEventType, Engine, FIX_ONE_PIXEL_BLUR_OFFSET, Group, IRenderManagerService, Layer, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, Rect, RegularPolygon, RenderUnit, SHEET_EXTENSION_PREFIX, SHEET_VIEWPORT_KEY, Scene, 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
|
+
import { BehaviorSubject, EMPTY, Observable, Subject, Subscription, combineLatest, combineLatestWith, distinctUntilChanged, filter, firstValueFrom, from, fromEvent, map, merge as merge$1, of, shareReplay, skip, startWith, switchMap, take, takeUntil, throttleTime, timeout, withLatestFrom } from "rxjs";
|
|
7
|
+
import { DocSelectionManagerService, DocSkeletonManagerService, 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, BoldIcon, BrushIcon, CancelFreezeIcon, CancelMergeIcon, CheckMarkIcon, ClearFormatDoubleIcon, CloseIcon, CodeIcon, ConvertIcon, ConvertToNumberIcon, CopyDoubleIcon, CutIcon, DeleteCellShiftLeftDoubleIcon, DeleteCellShiftUpDoubleIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, 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, LoadingMultiIcon, LockIcon, MergeAllIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, NoBorderIcon, NoColorDoubleIcon, NoRotationIcon, OuterBorderDoubleIcon, OverflowIcon, PaintBucketDoubleIcon, PasteSpecialDoubleIcon, PenIcon, ProtectIcon, ReduceDoubleIcon, RightBorderDoubleIcon, RightDoubleDiagonalDoubleIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, RightRotationFortyFiveDegreesIcon, RightRotationNinetyDegreesIcon, ShrinkToFitIcon, SlashDoubleIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, TruncationIcon, UnderlineIcon, UpBorderDoubleIcon, VerticalBorderDoubleIcon, VerticalCenterIcon, VerticalIntegrationIcon, VerticalTextIcon, WarningIcon, WriteIcon } from "@univerjs/icons";
|
|
11
11
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
12
|
-
import { FUNCTION_NAMES_MATH, FUNCTION_NAMES_STATISTICAL, FUNCTION_NAMES_TEXT, FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, LexerTreeBuilder, NullValueObject, SetFormulaCalculationNotificationMutation, deserializeRangeWithSheet, isReferenceStringWithEffectiveColumn, isReferenceStrings, matchToken, operatorToken, sequenceNodeType, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
12
|
+
import { FUNCTION_NAMES_MATH, FUNCTION_NAMES_STATISTICAL, FUNCTION_NAMES_TEXT, FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, LexerTreeBuilder, NullValueObject, SetFormulaCalculationNotificationMutation, UniverFormulaEnginePlugin, deserializeRangeWithSheet, isReferenceStringWithEffectiveColumn, isReferenceStrings, matchToken, operatorToken, sequenceNodeType, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
13
13
|
import { ITelemetryService } from "@univerjs/telemetry";
|
|
14
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
import { debounceTime, filter as filter$1, map as map$1, shareReplay as shareReplay$1, startWith as startWith$1, switchMap as switchMap$1 } from "rxjs/operators";
|
|
@@ -17,7 +17,7 @@ import { debounceTime, filter as filter$1, map as map$1, shareReplay as shareRep
|
|
|
17
17
|
//#region src/basics/editor/get-editor-object.ts
|
|
18
18
|
function getEditorObject(unitId, renderManagerService) {
|
|
19
19
|
if (unitId == null) return;
|
|
20
|
-
const currentRender = renderManagerService.
|
|
20
|
+
const currentRender = renderManagerService.getRenderUnitById(unitId);
|
|
21
21
|
if (currentRender == null) return;
|
|
22
22
|
const { mainComponent, scene, engine, components } = currentRender;
|
|
23
23
|
return {
|
|
@@ -185,7 +185,7 @@ let SHEET_VIEW_KEY = /* @__PURE__ */ function(SHEET_VIEW_KEY) {
|
|
|
185
185
|
}({});
|
|
186
186
|
|
|
187
187
|
//#endregion
|
|
188
|
-
//#region \0@oxc-project+runtime@0.
|
|
188
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
189
189
|
function _typeof(o) {
|
|
190
190
|
"@babel/helpers - typeof";
|
|
191
191
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -196,7 +196,7 @@ function _typeof(o) {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
//#endregion
|
|
199
|
-
//#region \0@oxc-project+runtime@0.
|
|
199
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
200
200
|
function toPrimitive(t, r) {
|
|
201
201
|
if ("object" != _typeof(t) || !t) return t;
|
|
202
202
|
var e = t[Symbol.toPrimitive];
|
|
@@ -209,14 +209,14 @@ function toPrimitive(t, r) {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
//#endregion
|
|
212
|
-
//#region \0@oxc-project+runtime@0.
|
|
212
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
213
213
|
function toPropertyKey(t) {
|
|
214
214
|
var i = toPrimitive(t, "string");
|
|
215
215
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
//#endregion
|
|
219
|
-
//#region \0@oxc-project+runtime@0.
|
|
219
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
220
220
|
function _defineProperty(e, r, t) {
|
|
221
221
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
222
222
|
value: t,
|
|
@@ -276,7 +276,7 @@ var SelectionRenderModel = class {
|
|
|
276
276
|
return this._rangeType;
|
|
277
277
|
}
|
|
278
278
|
/**
|
|
279
|
-
*
|
|
279
|
+
* Compares row and column bounds only.
|
|
280
280
|
*/
|
|
281
281
|
isEqual(rangeWithCoord) {
|
|
282
282
|
const { startColumn, startRow, endColumn, endRow } = this;
|
|
@@ -353,9 +353,9 @@ const SetRowHeaderWidthCommand = {
|
|
|
353
353
|
const renderManagerSrv = accessor.get(IRenderManagerService);
|
|
354
354
|
if (!renderManagerSrv) return false;
|
|
355
355
|
const { unitId, subUnitId, size } = params;
|
|
356
|
-
const render = renderManagerSrv.
|
|
356
|
+
const render = renderManagerSrv.getRenderUnitById(unitId);
|
|
357
357
|
if (render) {
|
|
358
|
-
renderManagerSrv.
|
|
358
|
+
renderManagerSrv.getRenderUnitById(unitId).with(SheetSkeletonManagerService).setRowHeaderSize(render, subUnitId, size);
|
|
359
359
|
const { components } = render;
|
|
360
360
|
const renderComponent = components.get("__SpreadsheetRowHeader__");
|
|
361
361
|
if (renderComponent) renderComponent.setCustomHeader({ headerStyle: { size } }, subUnitId);
|
|
@@ -371,9 +371,9 @@ const SetColumnHeaderHeightCommand = {
|
|
|
371
371
|
const renderManagerSrv = accessor.get(IRenderManagerService);
|
|
372
372
|
if (!renderManagerSrv) return false;
|
|
373
373
|
const { unitId, subUnitId, size } = params;
|
|
374
|
-
const render = renderManagerSrv.
|
|
374
|
+
const render = renderManagerSrv.getRenderUnitById(unitId);
|
|
375
375
|
if (render) {
|
|
376
|
-
renderManagerSrv.
|
|
376
|
+
renderManagerSrv.getRenderUnitById(unitId).with(SheetSkeletonManagerService).setColumnHeaderSize(render, subUnitId, size);
|
|
377
377
|
const { components } = render;
|
|
378
378
|
const renderComponent = components.get("__SpreadsheetColumnHeader__");
|
|
379
379
|
if (renderComponent) renderComponent.setCustomHeader({ headerStyle: { size } }, subUnitId);
|
|
@@ -493,10 +493,6 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
493
493
|
/**
|
|
494
494
|
* Reset this._selectionStyle to default normal selection style
|
|
495
495
|
*/
|
|
496
|
-
/** @deprecated This should not be provided by the selection render service. */
|
|
497
|
-
getViewPort() {
|
|
498
|
-
return this._activeViewport;
|
|
499
|
-
}
|
|
500
496
|
setSingleSelectionEnabled(enabled = false) {
|
|
501
497
|
this._singleSelectionEnabled = enabled;
|
|
502
498
|
}
|
|
@@ -593,9 +589,8 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
593
589
|
* @param {ISelectionWithCoord} selectionWithStyle
|
|
594
590
|
*/
|
|
595
591
|
_addSelectionControlByModelData(selectionWithStyle) {
|
|
596
|
-
var _selectionWithStyle$s;
|
|
597
592
|
const skeleton = this._skeleton;
|
|
598
|
-
const style =
|
|
593
|
+
const style = selectionWithStyle.style ?? genNormalSelectionStyle(this._selectionTheme);
|
|
599
594
|
const scene = this._scene;
|
|
600
595
|
selectionWithStyle.style = style;
|
|
601
596
|
return this.newSelectionControl(scene, skeleton, selectionWithStyle);
|
|
@@ -607,7 +602,7 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
607
602
|
}
|
|
608
603
|
_getFreeze() {
|
|
609
604
|
var _this$_sheetSkeletonM;
|
|
610
|
-
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.
|
|
605
|
+
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.worksheet.getFreeze();
|
|
611
606
|
}
|
|
612
607
|
_getViewportByCell(row, column) {
|
|
613
608
|
if (row === void 0 || column === void 0) return null;
|
|
@@ -675,17 +670,15 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
675
670
|
* @param moveStartPosY
|
|
676
671
|
*/
|
|
677
672
|
_setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType = ScrollTimerType.ALL, moveStartPosX, moveStartPosY) {
|
|
678
|
-
var _viewportMain$left, _viewportMain$top;
|
|
679
673
|
let xCrossTime = 0;
|
|
680
674
|
let yCrossTime = 0;
|
|
681
675
|
let lastX = moveStartPosX;
|
|
682
676
|
let lastY = moveStartPosY;
|
|
683
677
|
this._scrollTimer = ScrollTimer.create(this._scene, scrollTimerType);
|
|
684
|
-
this._scrollTimer.startScroll((
|
|
678
|
+
this._scrollTimer.startScroll((viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.left) ?? 0, (viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.top) ?? 0, viewportMain);
|
|
685
679
|
const scene = this._scene;
|
|
686
680
|
const startViewport = scene.getActiveViewportByCoord(Vector2.FromArray([moveStartPosX, moveStartPosY]));
|
|
687
681
|
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt) => {
|
|
688
|
-
var _scene$getActiveViewp;
|
|
689
682
|
if (moveEvt.buttons === 0) {
|
|
690
683
|
this.endSelection();
|
|
691
684
|
return;
|
|
@@ -698,7 +691,7 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
698
691
|
const currentSelection = this.getActiveSelectionControl();
|
|
699
692
|
const freeze = this._getFreeze();
|
|
700
693
|
const selection = currentSelection === null || currentSelection === void 0 ? void 0 : currentSelection.model;
|
|
701
|
-
const endViewport =
|
|
694
|
+
const endViewport = scene.getActiveViewportByCoord(Vector2.FromArray([moveOffsetX, moveOffsetY])) ?? this._getViewportByCell(selection === null || selection === void 0 ? void 0 : selection.endRow, selection === null || selection === void 0 ? void 0 : selection.endColumn);
|
|
702
695
|
const isCrossableViewports = () => {
|
|
703
696
|
if (!startViewport || !endViewport || !viewportMain) return false;
|
|
704
697
|
const crossableViewports = [
|
|
@@ -718,15 +711,12 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
718
711
|
const startKey = startViewport.viewportKey;
|
|
719
712
|
const endKey = endViewport.viewportKey;
|
|
720
713
|
if (startKey === SHEET_VIEWPORT_KEY.VIEW_ROW_TOP) {
|
|
721
|
-
|
|
722
|
-
if (moveOffsetY < viewportMain.top && ((_selection$endRow = selection === null || selection === void 0 ? void 0 : selection.endRow) !== null && _selection$endRow !== void 0 ? _selection$endRow : 0) < ((_freeze$startRow = freeze === null || freeze === void 0 ? void 0 : freeze.startRow) !== null && _freeze$startRow !== void 0 ? _freeze$startRow : 0)) scrollOffsetY = viewportMain.top;
|
|
714
|
+
if (moveOffsetY < viewportMain.top && ((selection === null || selection === void 0 ? void 0 : selection.endRow) ?? 0) < ((freeze === null || freeze === void 0 ? void 0 : freeze.startRow) ?? 0)) scrollOffsetY = viewportMain.top;
|
|
723
715
|
else if (isCrossingY && yCrossTime % 2 === 1) viewportMain.scrollToViewportPos({ viewportScrollY: 0 });
|
|
724
716
|
} else if (startKey === SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT) {
|
|
725
|
-
|
|
726
|
-
if (moveOffsetX < viewportMain.left && ((_selection$endColumn = selection === null || selection === void 0 ? void 0 : selection.endColumn) !== null && _selection$endColumn !== void 0 ? _selection$endColumn : 0) < ((_freeze$startColumn = freeze === null || freeze === void 0 ? void 0 : freeze.startColumn) !== null && _freeze$startColumn !== void 0 ? _freeze$startColumn : 0)) scrollOffsetX = viewportMain.left;
|
|
717
|
+
if (moveOffsetX < viewportMain.left && ((selection === null || selection === void 0 ? void 0 : selection.endColumn) ?? 0) < ((freeze === null || freeze === void 0 ? void 0 : freeze.startColumn) ?? 0)) scrollOffsetX = viewportMain.left;
|
|
727
718
|
else if (isCrossingX && xCrossTime % 2 === 1) viewportMain.scrollToViewportPos({ viewportScrollX: 0 });
|
|
728
719
|
} else if (startKey === endKey) {
|
|
729
|
-
var _selection$endRow2, _freeze$startRow2, _selection$endColumn2, _freeze$startColumn2;
|
|
730
720
|
let disableX = false;
|
|
731
721
|
let disableY = false;
|
|
732
722
|
if (startKey === SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP) {
|
|
@@ -734,8 +724,8 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
734
724
|
disableY = true;
|
|
735
725
|
} else if (startKey === SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP) disableY = true;
|
|
736
726
|
else if (startKey === SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT) disableX = true;
|
|
737
|
-
if (((
|
|
738
|
-
if (((
|
|
727
|
+
if (((selection === null || selection === void 0 ? void 0 : selection.endRow) ?? 0) > ((freeze === null || freeze === void 0 ? void 0 : freeze.startRow) ?? 0)) disableY = false;
|
|
728
|
+
if (((selection === null || selection === void 0 ? void 0 : selection.endColumn) ?? 0) > ((freeze === null || freeze === void 0 ? void 0 : freeze.startColumn) ?? 0)) disableX = false;
|
|
739
729
|
if (disableX) scrollOffsetX = viewportMain.left;
|
|
740
730
|
if (disableY) scrollOffsetY = viewportMain.top;
|
|
741
731
|
} else {
|
|
@@ -768,15 +758,9 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
768
758
|
});
|
|
769
759
|
});
|
|
770
760
|
}
|
|
771
|
-
/**
|
|
772
|
-
* @deprecated Please use `getCellWithCoordByOffset` instead.
|
|
773
|
-
*/
|
|
774
|
-
getSelectionCellByPosition(x, y) {
|
|
775
|
-
return this.getCellWithCoordByOffset(x, y);
|
|
776
|
-
}
|
|
777
761
|
getCellWithCoordByOffset(x, y, skeletonParam) {
|
|
778
762
|
const scene = this._scene;
|
|
779
|
-
const skeleton = skeletonParam
|
|
763
|
+
const skeleton = skeletonParam ?? this._skeleton;
|
|
780
764
|
const scrollXY = scene.getViewportScrollXY(scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN));
|
|
781
765
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
782
766
|
return skeleton.getCellWithCoordByOffset(x - scrollXY.x, y - scrollXY.y, scaleX, scaleY, scrollXY);
|
|
@@ -785,20 +769,19 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
785
769
|
* When mousedown and mouseup need to go to the coordination and undo stack, when mousemove does not need to go to the coordination and undo stack
|
|
786
770
|
*/
|
|
787
771
|
_movingHandler(offsetX, offsetY, activeSelectionControl, rangeType) {
|
|
788
|
-
var _activeSelectionContr, _activeSelectionContr2, _activeSelectionContr3, _activeSelectionContr4, _this$_getViewportByC;
|
|
789
772
|
const skeleton = this._skeleton;
|
|
790
773
|
const scene = this._scene;
|
|
791
774
|
const [unitId, sheetId] = skeleton.getLocation();
|
|
792
775
|
const currSelectionRange = {
|
|
793
|
-
startRow: (
|
|
794
|
-
endRow: (
|
|
795
|
-
startColumn: (
|
|
796
|
-
endColumn: (
|
|
776
|
+
startRow: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.startRow) ?? -1,
|
|
777
|
+
endRow: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.endRow) ?? -1,
|
|
778
|
+
startColumn: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.startColumn) ?? -1,
|
|
779
|
+
endColumn: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.endColumn) ?? -1,
|
|
797
780
|
unitId,
|
|
798
781
|
sheetId
|
|
799
782
|
};
|
|
800
783
|
const viewportMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
801
|
-
const targetViewport =
|
|
784
|
+
const targetViewport = this._getViewportByCell(currSelectionRange.endRow, currSelectionRange.endColumn) ?? viewportMain;
|
|
802
785
|
const scrollXY = scene.getScrollXYInfoByViewport(Vector2.FromArray([this._startViewportPosX, this._startViewportPosY]), targetViewport);
|
|
803
786
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
804
787
|
if (rangeType === RANGE_TYPE.ROW) offsetX = Number.POSITIVE_INFINITY;
|
|
@@ -983,7 +966,7 @@ function genSelectionByRange(skeleton, range) {
|
|
|
983
966
|
}
|
|
984
967
|
|
|
985
968
|
//#endregion
|
|
986
|
-
//#region \0@oxc-project+runtime@0.
|
|
969
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
987
970
|
function __decorateParam(paramIndex, decorator) {
|
|
988
971
|
return function(target, key) {
|
|
989
972
|
decorator(target, key, paramIndex);
|
|
@@ -991,7 +974,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
991
974
|
}
|
|
992
975
|
|
|
993
976
|
//#endregion
|
|
994
|
-
//#region \0@oxc-project+runtime@0.
|
|
977
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
995
978
|
function __decorate(decorators, target, key, desc) {
|
|
996
979
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
997
980
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1217,7 +1200,7 @@ var SelectionShapeExtension = class {
|
|
|
1217
1200
|
}
|
|
1218
1201
|
_getFreeze() {
|
|
1219
1202
|
var _withCurrentTypeOfRen;
|
|
1220
|
-
return (_withCurrentTypeOfRen = withCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService, this._injector.get(IUniverInstanceService), this._injector.get(IRenderManagerService))) === null || _withCurrentTypeOfRen === void 0 || (_withCurrentTypeOfRen = _withCurrentTypeOfRen.getCurrentParam()) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.skeleton.
|
|
1203
|
+
return (_withCurrentTypeOfRen = withCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService, this._injector.get(IUniverInstanceService), this._injector.get(IRenderManagerService))) === null || _withCurrentTypeOfRen === void 0 || (_withCurrentTypeOfRen = _withCurrentTypeOfRen.getCurrentParam()) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.skeleton.worksheet.getFreeze();
|
|
1221
1204
|
}
|
|
1222
1205
|
_isSelectionInViewport(selection, viewport) {
|
|
1223
1206
|
const freeze = this._getFreeze() || {
|
|
@@ -1807,7 +1790,6 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = .3;
|
|
|
1807
1790
|
*/
|
|
1808
1791
|
var SelectionControl = class extends Disposable {
|
|
1809
1792
|
constructor(_scene, _zIndex, _themeService, options) {
|
|
1810
|
-
var _options$enableAutoFi, _options$highlightHea, _options$rowHeaderWid, _options$columnHeader, _options$rowHeaderOff, _options$columnHeader2;
|
|
1811
1793
|
super();
|
|
1812
1794
|
this._scene = _scene;
|
|
1813
1795
|
this._zIndex = _zIndex;
|
|
@@ -1861,12 +1843,12 @@ var SelectionControl = class extends Disposable {
|
|
|
1861
1843
|
_defineProperty(this, "selectionFilled$", this._selectionFilled$.asObservable());
|
|
1862
1844
|
_defineProperty(this, "_antLineOffset", 0);
|
|
1863
1845
|
_defineProperty(this, "_antRequestNewFrame", -1);
|
|
1864
|
-
this._enableAutoFill = (
|
|
1865
|
-
this._highlightHeader = (
|
|
1866
|
-
this._rowHeaderWidth = (
|
|
1867
|
-
this._columnHeaderHeight = (
|
|
1868
|
-
this._rowHeaderOffsetX = (
|
|
1869
|
-
this._columnHeaderOffsetY = (
|
|
1846
|
+
this._enableAutoFill = (options === null || options === void 0 ? void 0 : options.enableAutoFill) ?? true;
|
|
1847
|
+
this._highlightHeader = (options === null || options === void 0 ? void 0 : options.highlightHeader) ?? true;
|
|
1848
|
+
this._rowHeaderWidth = (options === null || options === void 0 ? void 0 : options.rowHeaderWidth) ?? 0;
|
|
1849
|
+
this._columnHeaderHeight = (options === null || options === void 0 ? void 0 : options.columnHeaderHeight) ?? 0;
|
|
1850
|
+
this._rowHeaderOffsetX = (options === null || options === void 0 ? void 0 : options.rowHeaderOffsetX) ?? 0;
|
|
1851
|
+
this._columnHeaderOffsetY = (options === null || options === void 0 ? void 0 : options.columnHeaderOffsetY) ?? 0;
|
|
1870
1852
|
this._initializeSheetBody();
|
|
1871
1853
|
this._initialHeader();
|
|
1872
1854
|
}
|
|
@@ -2240,29 +2222,6 @@ var SelectionControl = class extends Disposable {
|
|
|
2240
2222
|
this._updateControlCoord();
|
|
2241
2223
|
}
|
|
2242
2224
|
/**
|
|
2243
|
-
* Update selection model with new range & primary cell(aka: highlight/current), also update row/col selection size & style.
|
|
2244
|
-
*
|
|
2245
|
-
* @deprecated use `updateRangeBySelectionWithCoord` and `updateStyle` to do same thing.
|
|
2246
|
-
*
|
|
2247
|
-
* @param newSelectionRange
|
|
2248
|
-
* @param rowHeaderWidth
|
|
2249
|
-
* @param columnHeaderHeight
|
|
2250
|
-
* @param style
|
|
2251
|
-
* @param primaryCell primary cell
|
|
2252
|
-
*/
|
|
2253
|
-
update(newSelectionRange, rowHeaderWidth = 0, columnHeaderHeight = 0, style, primaryCell) {
|
|
2254
|
-
this._rowHeaderWidth = rowHeaderWidth;
|
|
2255
|
-
this._columnHeaderHeight = columnHeaderHeight;
|
|
2256
|
-
this._rowHeaderOffsetX = 0;
|
|
2257
|
-
this._columnHeaderOffsetY = 0;
|
|
2258
|
-
this.updateRangeBySelectionWithCoord({
|
|
2259
|
-
rangeWithCoord: newSelectionRange,
|
|
2260
|
-
primaryWithCoord: primaryCell,
|
|
2261
|
-
style
|
|
2262
|
-
});
|
|
2263
|
-
if (style) this.updateStyle(style);
|
|
2264
|
-
}
|
|
2265
|
-
/**
|
|
2266
2225
|
* Update primary range.
|
|
2267
2226
|
* highlight cell would update if primary cell has value.
|
|
2268
2227
|
* highlight cell would be cleared if primary cell is null.
|
|
@@ -2659,7 +2618,7 @@ let MarkSelectionService = class MarkSelectionService extends Disposable {
|
|
|
2659
2618
|
const { unitId, subUnitId, selection, control: oldControl, zIndex } = shape;
|
|
2660
2619
|
oldControl === null || oldControl === void 0 || oldControl.dispose();
|
|
2661
2620
|
if (unitId !== currentUnitId || subUnitId !== currentSubUnitId) return;
|
|
2662
|
-
const renderUnit = this._renderManagerService.
|
|
2621
|
+
const renderUnit = this._renderManagerService.getRenderUnitById(unitId);
|
|
2663
2622
|
if (!renderUnit) return;
|
|
2664
2623
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, subUnitId);
|
|
2665
2624
|
if (!skeleton) return;
|
|
@@ -2783,7 +2742,7 @@ const copyContentCache = new CopyContentCache();
|
|
|
2783
2742
|
//#endregion
|
|
2784
2743
|
//#region src/services/clipboard/html-to-usm/parse-node-style.ts
|
|
2785
2744
|
function extractNodeStyle(node, predefinedStyles) {
|
|
2786
|
-
const styles = predefinedStyles
|
|
2745
|
+
const styles = predefinedStyles ?? node.style;
|
|
2787
2746
|
const docStyles = {};
|
|
2788
2747
|
const tagName = node.tagName.toLowerCase();
|
|
2789
2748
|
switch (tagName) {
|
|
@@ -2927,9 +2886,8 @@ function generateParagraphs(dataStream, prevParagraph) {
|
|
|
2927
2886
|
return paragraphs;
|
|
2928
2887
|
}
|
|
2929
2888
|
function convertToCellStyle(cell, dataStream, textRuns) {
|
|
2930
|
-
var _textRuns$length;
|
|
2931
2889
|
const dataStreamLength = dataStream.length;
|
|
2932
|
-
const canConvertToCellStyle = ((
|
|
2890
|
+
const canConvertToCellStyle = ((textRuns === null || textRuns === void 0 ? void 0 : textRuns.length) ?? 0) === 1 && textRuns[0].st === 0 && textRuns[0].ed === dataStreamLength;
|
|
2933
2891
|
if (cell.p) {
|
|
2934
2892
|
var _cell$p$body;
|
|
2935
2893
|
if (canConvertToCellStyle && ((_cell$p$body = cell.p.body) === null || _cell$p$body === void 0 || (_cell$p$body = _cell$p$body.textRuns) === null || _cell$p$body === void 0 ? void 0 : _cell$p$body.length)) {
|
|
@@ -2944,7 +2902,6 @@ function convertToCellStyle(cell, dataStream, textRuns) {
|
|
|
2944
2902
|
s: textRuns[0].ts
|
|
2945
2903
|
};
|
|
2946
2904
|
else return cell;
|
|
2947
|
-
return cell;
|
|
2948
2905
|
}
|
|
2949
2906
|
|
|
2950
2907
|
//#endregion
|
|
@@ -3002,8 +2959,7 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3002
2959
|
this._dom = parseToDom(html);
|
|
3003
2960
|
const style = this._dom.querySelector("style");
|
|
3004
2961
|
if (style) {
|
|
3005
|
-
|
|
3006
|
-
this._parseMsoNumfmtFromCssText((_style$textContent = style.textContent) !== null && _style$textContent !== void 0 ? _style$textContent : "");
|
|
2962
|
+
this._parseMsoNumfmtFromCssText(style.textContent ?? "");
|
|
3007
2963
|
const shadowHost = document.createElement("div");
|
|
3008
2964
|
const shadowRoot = shadowHost.attachShadow({ mode: "open" });
|
|
3009
2965
|
document.body.appendChild(shadowHost);
|
|
@@ -3198,9 +3154,9 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3198
3154
|
return style;
|
|
3199
3155
|
}
|
|
3200
3156
|
_parseTable(html, tableElIndex) {
|
|
3201
|
-
var
|
|
3157
|
+
var _this$_getCurrentSkel;
|
|
3202
3158
|
const valueMatrix = new ObjectMatrix();
|
|
3203
|
-
const colProperties =
|
|
3159
|
+
const colProperties = parseColGroup(html) ?? [];
|
|
3204
3160
|
const { rowProperties = [] } = parseTableRows(html);
|
|
3205
3161
|
const parsedCellMatrix = this._parseTableByHtml(this._dom, tableElIndex, (_this$_getCurrentSkel = this._getCurrentSkeleton()) === null || _this$_getCurrentSkel === void 0 ? void 0 : _this$_getCurrentSkel.skeleton);
|
|
3206
3162
|
parsedCellMatrix && parsedCellMatrix.forValue((row, col, value) => {
|
|
@@ -3293,8 +3249,7 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3293
3249
|
let numfmtPattern;
|
|
3294
3250
|
const pattern = this._getMsoNumfmtForNode(cell);
|
|
3295
3251
|
if (!isDefaultFormat(pattern)) {
|
|
3296
|
-
|
|
3297
|
-
cellText = cell.childElementCount === 0 ? normalizePlainCellText((_cell$textContent = cell.textContent) !== null && _cell$textContent !== void 0 ? _cell$textContent : "") : cell.innerHTML;
|
|
3252
|
+
cellText = cell.childElementCount === 0 ? normalizePlainCellText(cell.textContent ?? "") : cell.innerHTML;
|
|
3298
3253
|
if (cellText.includes("mso-spacerun:yes")) cellText = cleanMsoSpaceRun(cellText);
|
|
3299
3254
|
const parseData = getNumfmtParseValueFilter(cellText);
|
|
3300
3255
|
if (typeof (parseData === null || parseData === void 0 ? void 0 : parseData.v) === "number" && (parseData.z === pattern || numfmt.format(pattern, parseData.v) === cellText)) {
|
|
@@ -3379,13 +3334,10 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3379
3334
|
}
|
|
3380
3335
|
}
|
|
3381
3336
|
_getCellTextAndRichText(cell, styleStr, skeleton) {
|
|
3382
|
-
if (cell.childElementCount === 0) {
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
cellRichStyle: void 0
|
|
3387
|
-
};
|
|
3388
|
-
}
|
|
3337
|
+
if (cell.childElementCount === 0) return {
|
|
3338
|
+
cellText: normalizePlainCellText(cell.textContent ?? ""),
|
|
3339
|
+
cellRichStyle: void 0
|
|
3340
|
+
};
|
|
3389
3341
|
const cellHtml = cell.innerHTML;
|
|
3390
3342
|
/**
|
|
3391
3343
|
* mso-spacerun:yes is used to force spaces in html copied from excel.
|
|
@@ -3404,13 +3356,12 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3404
3356
|
let cellText = "";
|
|
3405
3357
|
let cellRichStyle;
|
|
3406
3358
|
if (/<[^>]+>/.test(cellHtml) && skeleton) {
|
|
3407
|
-
var _skeleton$getBlankCel;
|
|
3408
3359
|
const newDocBody = {
|
|
3409
3360
|
dataStream: "",
|
|
3410
3361
|
textRuns: []
|
|
3411
3362
|
};
|
|
3412
3363
|
this._parseCellHtml(null, cell.childNodes, newDocBody, void 0, styleStr);
|
|
3413
|
-
const documentModel = (
|
|
3364
|
+
const documentModel = createDocumentModelWithStyle("", {});
|
|
3414
3365
|
const p = documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot();
|
|
3415
3366
|
const singleDataStream = `${newDocBody.dataStream}\r\n`;
|
|
3416
3367
|
const documentData = {
|
|
@@ -3431,11 +3382,8 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3431
3382
|
};
|
|
3432
3383
|
}
|
|
3433
3384
|
_generateDocumentDataModelSnapshot(snapshot) {
|
|
3434
|
-
|
|
3435
|
-
const
|
|
3436
|
-
if (currentSkeleton == null) return null;
|
|
3437
|
-
const { skeleton } = currentSkeleton;
|
|
3438
|
-
const documentModel = (_skeleton$getBlankCel2 = skeleton.getBlankCellDocumentModel()) === null || _skeleton$getBlankCel2 === void 0 ? void 0 : _skeleton$getBlankCel2.documentModel;
|
|
3385
|
+
if (this._getCurrentSkeleton() == null) return null;
|
|
3386
|
+
const documentModel = createDocumentModelWithStyle("", {});
|
|
3439
3387
|
const documentData = {
|
|
3440
3388
|
...documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot(),
|
|
3441
3389
|
...snapshot
|
|
@@ -3504,14 +3452,13 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3504
3452
|
const body = doc.body;
|
|
3505
3453
|
const element = node;
|
|
3506
3454
|
if (element.tagName.toUpperCase() === "A") {
|
|
3507
|
-
var _body$customRanges, _element$dataset$rang;
|
|
3508
3455
|
const href = element.href;
|
|
3509
3456
|
if (!isSafeUrl(href)) return;
|
|
3510
|
-
body.customRanges =
|
|
3457
|
+
body.customRanges = body.customRanges ?? [];
|
|
3511
3458
|
body.customRanges.push({
|
|
3512
3459
|
startIndex: start,
|
|
3513
3460
|
endIndex: body.dataStream.length - 1,
|
|
3514
|
-
rangeId:
|
|
3461
|
+
rangeId: element.dataset.rangeid ?? generateRandomId(),
|
|
3515
3462
|
rangeType: CustomRangeType.HYPERLINK,
|
|
3516
3463
|
properties: { url: href }
|
|
3517
3464
|
});
|
|
@@ -4200,7 +4147,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4200
4147
|
return this._pasteInternal(copyId, pasteType);
|
|
4201
4148
|
}
|
|
4202
4149
|
async legacyPaste(html, text, files, formulaClipboardPayload) {
|
|
4203
|
-
const isFromExcel = htmlIsFromExcel(html
|
|
4150
|
+
const isFromExcel = htmlIsFromExcel(html ?? "");
|
|
4204
4151
|
if (files && !isFromExcel) return this._pasteFiles(files, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
|
|
4205
4152
|
else if (html) return this._pasteHTML(html, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE, formulaClipboardPayload);
|
|
4206
4153
|
else if (text) if (/[\n\t]/.test(text)) return this._pasteHTML(convertTextToTable(text), PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
|
|
@@ -4249,7 +4196,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4249
4196
|
return this._clipboardHooks;
|
|
4250
4197
|
}
|
|
4251
4198
|
_generateCopyContent(unitId, subUnitId, range, hooks, copyHookType = PREDEFINED_HOOK_NAME_COPY.DEFAULT_COPY) {
|
|
4252
|
-
const workbook = this._univerInstanceService.
|
|
4199
|
+
const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
4253
4200
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
4254
4201
|
if (!workbook || !worksheet) return null;
|
|
4255
4202
|
const filteredRows = hooks.reduce((acc, cur) => {
|
|
@@ -4454,7 +4401,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4454
4401
|
if (!cellMatrix) return false;
|
|
4455
4402
|
const pasteTarget = this._getPastedRange(cellMatrix);
|
|
4456
4403
|
if (!pasteTarget) return false;
|
|
4457
|
-
const worksheet = (_this$_univerInstance = this._univerInstanceService.
|
|
4404
|
+
const worksheet = (_this$_univerInstance = this._univerInstanceService.getUnit(pasteTarget.unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getSheetBySheetId(pasteTarget.subUnitId);
|
|
4458
4405
|
if (!worksheet) return false;
|
|
4459
4406
|
const mergeData = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergeData();
|
|
4460
4407
|
if (mergeData.length) {
|
|
@@ -4484,7 +4431,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4484
4431
|
const { range, matrix: cachedMatrix, unitId: copyUnitId, subUnitId: copySubUnitId } = cachedData || {};
|
|
4485
4432
|
if (!cachedMatrix || !cachedData || !range || !copyUnitId || !copySubUnitId) return false;
|
|
4486
4433
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
4487
|
-
const worksheet = (_this$_univerInstance2 = this._univerInstanceService.
|
|
4434
|
+
const worksheet = (_this$_univerInstance2 = this._univerInstanceService.getUnit(copyUnitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance2 === void 0 ? void 0 : _this$_univerInstance2.getSheetBySheetId(copySubUnitId);
|
|
4488
4435
|
const cellMatrix = new ObjectMatrix();
|
|
4489
4436
|
cachedMatrix.forValue((row, col, value) => {
|
|
4490
4437
|
const { row: actualRow, col: actualColumn } = mapFunc(row, col);
|
|
@@ -4507,7 +4454,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4507
4454
|
});
|
|
4508
4455
|
const pasteTarget = this._getPastedRange(cellMatrix);
|
|
4509
4456
|
if (!pasteTarget) return false;
|
|
4510
|
-
const pasteToWorksheet = (_this$_univerInstance3 = this._univerInstanceService.
|
|
4457
|
+
const pasteToWorksheet = (_this$_univerInstance3 = this._univerInstanceService.getUnit(pasteTarget.unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance3 === void 0 ? void 0 : _this$_univerInstance3.getSheetBySheetId(pasteTarget.subUnitId);
|
|
4511
4458
|
if (!pasteToWorksheet) return false;
|
|
4512
4459
|
const mergeData = pasteToWorksheet === null || pasteToWorksheet === void 0 ? void 0 : pasteToWorksheet.getMergeData();
|
|
4513
4460
|
if (mergeData) {
|
|
@@ -4683,7 +4630,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4683
4630
|
var _this$_univerInstance4, _this$_renderManagerS;
|
|
4684
4631
|
const worksheet = (_this$_univerInstance4 = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance4 === void 0 ? void 0 : _this$_univerInstance4.getSheetBySheetId(subUnitId);
|
|
4685
4632
|
if (!worksheet) return null;
|
|
4686
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
4633
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
4687
4634
|
if (!skeleton) return null;
|
|
4688
4635
|
const rowManager = worksheet.getRowManager();
|
|
4689
4636
|
const defaultRowHeight = worksheet.getConfig().defaultRowHeight;
|
|
@@ -4723,7 +4670,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4723
4670
|
}
|
|
4724
4671
|
_getSetSelectionOperation(unitId, subUnitId, range, cellMatrix, pasteType) {
|
|
4725
4672
|
var _this$_univerInstance5;
|
|
4726
|
-
const worksheet = (_this$_univerInstance5 = this._univerInstanceService.
|
|
4673
|
+
const worksheet = (_this$_univerInstance5 = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance5 === void 0 ? void 0 : _this$_univerInstance5.getSheetBySheetId(subUnitId);
|
|
4727
4674
|
if (!worksheet) return null;
|
|
4728
4675
|
const { rows, cols } = range;
|
|
4729
4676
|
const startRow = rows[0];
|
|
@@ -4915,7 +4862,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4915
4862
|
if (rowCount <= 0 || colCount <= 0) return null;
|
|
4916
4863
|
const pasteSelectionRangeRowLen = discreteRange.rows.length;
|
|
4917
4864
|
const pasteSelectionRangeColLen = discreteRange.cols.length;
|
|
4918
|
-
const worksheet = (_this$_univerInstance6 = this._univerInstanceService.
|
|
4865
|
+
const worksheet = (_this$_univerInstance6 = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance6 === void 0 ? void 0 : _this$_univerInstance6.getSheetBySheetId(subUnitId);
|
|
4919
4866
|
if (!worksheet) return null;
|
|
4920
4867
|
const mergeData = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergeData();
|
|
4921
4868
|
if (pasteSelectionRangeRowLen % rowCount === 0 && pasteSelectionRangeColLen % colCount === 0) {
|
|
@@ -4942,7 +4889,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4942
4889
|
}
|
|
4943
4890
|
_expandOrShrinkRowsCols(unitId, subUnitId, range, colCount, rowCount) {
|
|
4944
4891
|
const { rows, cols } = range;
|
|
4945
|
-
const workbook = this._univerInstanceService.
|
|
4892
|
+
const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
4946
4893
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
4947
4894
|
let newRows;
|
|
4948
4895
|
let newCols;
|
|
@@ -5240,7 +5187,7 @@ const DeleteRangeMoveLeftConfirmCommand = {
|
|
|
5240
5187
|
};
|
|
5241
5188
|
const getRowLength = (range) => range.endRow - range.startRow;
|
|
5242
5189
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5243
|
-
const interSectedRange =
|
|
5190
|
+
const interSectedRange = getIntersectRange(mergeRange, range);
|
|
5244
5191
|
return interSectedRange ? getRowLength(mergeRange) > getRowLength(interSectedRange) : false;
|
|
5245
5192
|
})) return commandService.executeCommand(DeleteRangeMoveLeftCommand.id);
|
|
5246
5193
|
if (await confirmService.confirm({
|
|
@@ -5286,7 +5233,7 @@ const DeleteRangeMoveUpConfirmCommand = {
|
|
|
5286
5233
|
}
|
|
5287
5234
|
const getColLength = (range) => range.endColumn - range.startColumn;
|
|
5288
5235
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5289
|
-
const interSectedRange =
|
|
5236
|
+
const interSectedRange = getIntersectRange(mergeRange, range);
|
|
5290
5237
|
return interSectedRange ? getColLength(mergeRange) > getColLength(interSectedRange) : false;
|
|
5291
5238
|
})) return commandService.executeCommand(DeleteRangeMoveUpCommand.id);
|
|
5292
5239
|
if (await confirmService.confirm({
|
|
@@ -5635,15 +5582,13 @@ function checkIfShrink(selection, direction, worksheet) {
|
|
|
5635
5582
|
switch (direction) {
|
|
5636
5583
|
case Direction.UP:
|
|
5637
5584
|
case Direction.DOWN:
|
|
5638
|
-
|
|
5639
|
-
startRange.
|
|
5640
|
-
startRange.endRow = (_primary$endRow = primary === null || primary === void 0 ? void 0 : primary.endRow) !== null && _primary$endRow !== void 0 ? _primary$endRow : range.startRow;
|
|
5585
|
+
startRange.startRow = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
5586
|
+
startRange.endRow = (primary === null || primary === void 0 ? void 0 : primary.endRow) ?? range.startRow;
|
|
5641
5587
|
break;
|
|
5642
5588
|
case Direction.LEFT:
|
|
5643
5589
|
case Direction.RIGHT:
|
|
5644
|
-
|
|
5645
|
-
startRange.
|
|
5646
|
-
startRange.endColumn = (_primary$endColumn = primary === null || primary === void 0 ? void 0 : primary.endColumn) !== null && _primary$endColumn !== void 0 ? _primary$endColumn : range.startColumn;
|
|
5590
|
+
startRange.startColumn = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
5591
|
+
startRange.endColumn = (primary === null || primary === void 0 ? void 0 : primary.endColumn) ?? range.startColumn;
|
|
5647
5592
|
break;
|
|
5648
5593
|
}
|
|
5649
5594
|
const anchorRange = getEdgeOfRange(startRange, direction, worksheet);
|
|
@@ -5768,10 +5713,10 @@ const HideColConfirmCommand = {
|
|
|
5768
5713
|
//#endregion
|
|
5769
5714
|
//#region src/menu/utils.ts
|
|
5770
5715
|
function getFontStyleAtCursor(accessor) {
|
|
5771
|
-
var
|
|
5716
|
+
var _editorDataModel$getB;
|
|
5772
5717
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
5773
5718
|
const textSelectionService = accessor.get(DocSelectionManagerService);
|
|
5774
|
-
const editorUnitId =
|
|
5719
|
+
const editorUnitId = accessor.get(IEditorService).getFocusId() ?? DOCS_NORMAL_EDITOR_UNIT_ID_KEY;
|
|
5775
5720
|
const editorDataModel = univerInstanceService.getUnit(editorUnitId, UniverInstanceType.UNIVER_DOC);
|
|
5776
5721
|
const activeTextRange = textSelectionService.getActiveTextRange();
|
|
5777
5722
|
if (editorDataModel == null || activeTextRange == null) return null;
|
|
@@ -5868,15 +5813,14 @@ const SetRangeFontIncreaseCommand = {
|
|
|
5868
5813
|
if (isCellEditorFocus) {
|
|
5869
5814
|
const textRun = getFontStyleAtCursor(accessor);
|
|
5870
5815
|
if (textRun != null) {
|
|
5871
|
-
var _textRun$ts
|
|
5872
|
-
const value = (
|
|
5816
|
+
var _textRun$ts;
|
|
5817
|
+
const value = ((_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.fs) ?? defaultValue;
|
|
5873
5818
|
params.value = value >= 400 ? 400 : value + 1;
|
|
5874
5819
|
}
|
|
5875
5820
|
return commandService.executeCommand(SetInlineFormatFontSizeCommand.id, params);
|
|
5876
5821
|
}
|
|
5877
5822
|
if (primary != null) {
|
|
5878
|
-
|
|
5879
|
-
const value = (_style$fs = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs) !== null && _style$fs !== void 0 ? _style$fs : defaultValue;
|
|
5823
|
+
const value = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs ?? defaultValue;
|
|
5880
5824
|
params.value = value >= 400 ? 400 : value + 1;
|
|
5881
5825
|
return commandService.executeCommand(SetFontSizeCommand.id, params);
|
|
5882
5826
|
}
|
|
@@ -5899,15 +5843,14 @@ const SetRangeFontDecreaseCommand = {
|
|
|
5899
5843
|
if (isCellEditorFocus) {
|
|
5900
5844
|
const textRun = getFontStyleAtCursor(accessor);
|
|
5901
5845
|
if (textRun != null) {
|
|
5902
|
-
var _textRun$
|
|
5903
|
-
const value = (
|
|
5846
|
+
var _textRun$ts2;
|
|
5847
|
+
const value = ((_textRun$ts2 = textRun.ts) === null || _textRun$ts2 === void 0 ? void 0 : _textRun$ts2.fs) ?? defaultValue;
|
|
5904
5848
|
params.value = value <= 6 ? 6 : value - 1;
|
|
5905
5849
|
}
|
|
5906
5850
|
return commandService.executeCommand(SetInlineFormatFontSizeCommand.id, params);
|
|
5907
5851
|
}
|
|
5908
5852
|
if (primary != null) {
|
|
5909
|
-
|
|
5910
|
-
const value = (_style$fs2 = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs) !== null && _style$fs2 !== void 0 ? _style$fs2 : defaultValue;
|
|
5853
|
+
const value = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs ?? defaultValue;
|
|
5911
5854
|
params.value = value <= 6 ? 6 : value - 1;
|
|
5912
5855
|
return commandService.executeCommand(SetFontSizeCommand.id, params);
|
|
5913
5856
|
}
|
|
@@ -5976,7 +5919,7 @@ const InsertRangeMoveDownConfirmCommand = {
|
|
|
5976
5919
|
}
|
|
5977
5920
|
const getColLength = (range) => range.endColumn - range.startColumn;
|
|
5978
5921
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5979
|
-
const interSectedRange =
|
|
5922
|
+
const interSectedRange = getIntersectRange(mergeRange, range);
|
|
5980
5923
|
return interSectedRange ? getColLength(mergeRange) > getColLength(interSectedRange) : false;
|
|
5981
5924
|
})) return commandService.executeCommand(InsertRangeMoveDownCommand.id);
|
|
5982
5925
|
if (await confirmService.confirm({
|
|
@@ -6014,7 +5957,7 @@ const InsertRangeMoveRightConfirmCommand = {
|
|
|
6014
5957
|
};
|
|
6015
5958
|
const getRowLength = (range) => range.endRow - range.startRow;
|
|
6016
5959
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
6017
|
-
const interSectedRange =
|
|
5960
|
+
const interSectedRange = getIntersectRange(mergeRange, range);
|
|
6018
5961
|
return interSectedRange ? getRowLength(mergeRange) > getRowLength(interSectedRange) : false;
|
|
6019
5962
|
})) return commandService.executeCommand(InsertRangeMoveRightCommand.id);
|
|
6020
5963
|
if (await confirmService.confirm({
|
|
@@ -6461,8 +6404,8 @@ let FormatPainterService = class FormatPainterService extends Disposable {
|
|
|
6461
6404
|
};
|
|
6462
6405
|
}
|
|
6463
6406
|
addHook(hook) {
|
|
6464
|
-
var
|
|
6465
|
-
if (hook.isDefaultHook && (
|
|
6407
|
+
var _this$_defaultHook;
|
|
6408
|
+
if (hook.isDefaultHook && (hook.priority ?? 0) > (((_this$_defaultHook = this._defaultHook) === null || _this$_defaultHook === void 0 ? void 0 : _this$_defaultHook.priority) ?? -1)) this._defaultHook = hook;
|
|
6466
6409
|
else {
|
|
6467
6410
|
this._extendHooks.push(hook);
|
|
6468
6411
|
this._extendHooks.sort((a, b) => (a.priority || 0) - (b.priority || 0));
|
|
@@ -6609,7 +6552,7 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6609
6552
|
this._rawScrollInfo$.complete();
|
|
6610
6553
|
}
|
|
6611
6554
|
calcViewportScrollFromRowColOffset(scrollInfo) {
|
|
6612
|
-
var _skeleton$getCellWith
|
|
6555
|
+
var _skeleton$getCellWith;
|
|
6613
6556
|
if (!scrollInfo) return {
|
|
6614
6557
|
viewportScrollX: 0,
|
|
6615
6558
|
viewportScrollY: 0
|
|
@@ -6618,7 +6561,7 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6618
6561
|
sheetViewStartRow = sheetViewStartRow || 0;
|
|
6619
6562
|
offsetY = offsetY || 0;
|
|
6620
6563
|
const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
|
|
6621
|
-
const { startX: colStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.columnWidthAccumulation[sheetViewStartColumn - 1]) || 0, startY: rowStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.rowHeightAccumulation[sheetViewStartRow - 1]) || 0 } = (
|
|
6564
|
+
const { startX: colStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.columnWidthAccumulation[sheetViewStartColumn - 1]) || 0, startY: rowStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.rowHeightAccumulation[sheetViewStartRow - 1]) || 0 } = (skeleton === null || skeleton === void 0 || (_skeleton$getCellWith = skeleton.getCellWithCoordByIndex) === null || _skeleton$getCellWith === void 0 ? void 0 : _skeleton$getCellWith.call(skeleton, sheetViewStartRow, sheetViewStartColumn, false)) ?? {};
|
|
6622
6565
|
return {
|
|
6623
6566
|
viewportScrollX: colStart + offsetX,
|
|
6624
6567
|
viewportScrollY: rowStart + offsetY
|
|
@@ -6699,10 +6642,10 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6699
6642
|
return ((_this$_scrollStateMap = this._scrollStateMap.get(unitId)) === null || _this$_scrollStateMap === void 0 ? void 0 : _this$_scrollStateMap.get(sheetId)) || this._getDefaultScrollState(param);
|
|
6700
6643
|
}
|
|
6701
6644
|
_getDefaultScrollState(param) {
|
|
6702
|
-
var _this$_sheetSkeletonM, _this$_sheetSkeletonM2, _this$_sheetSkeletonM3, _this$_sheetSkeletonM4
|
|
6703
|
-
const skeleton = (_this$_sheetSkeletonM = (_this$_sheetSkeletonM2 =
|
|
6704
|
-
const colGapSize = (
|
|
6705
|
-
const rowGapSize = (
|
|
6645
|
+
var _this$_sheetSkeletonM, _this$_sheetSkeletonM2, _this$_sheetSkeletonM3, _this$_sheetSkeletonM4;
|
|
6646
|
+
const skeleton = ((_this$_sheetSkeletonM = (_this$_sheetSkeletonM2 = this._sheetSkeletonManagerService).getSkeleton) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.call(_this$_sheetSkeletonM2, param.sheetId)) ?? ((_this$_sheetSkeletonM3 = (_this$_sheetSkeletonM4 = this._sheetSkeletonManagerService).getCurrentSkeleton) === null || _this$_sheetSkeletonM3 === void 0 ? void 0 : _this$_sheetSkeletonM3.call(_this$_sheetSkeletonM4));
|
|
6647
|
+
const colGapSize = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.getColGapSize(0)) ?? 0;
|
|
6648
|
+
const rowGapSize = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.getRowGapSize(0)) ?? 0;
|
|
6706
6649
|
return {
|
|
6707
6650
|
sheetViewStartRow: 0,
|
|
6708
6651
|
sheetViewStartColumn: 0,
|
|
@@ -6731,7 +6674,7 @@ const SetSelectionFrozenCommand = {
|
|
|
6731
6674
|
const commandService = accessor.get(ICommandService);
|
|
6732
6675
|
const selections = accessor.get(SheetsSelectionsService).getCurrentSelections();
|
|
6733
6676
|
if (!selections) return false;
|
|
6734
|
-
const { sheetViewStartRow = 0, sheetViewStartColumn = 0 } = accessor.get(IRenderManagerService).
|
|
6677
|
+
const { sheetViewStartRow = 0, sheetViewStartColumn = 0 } = accessor.get(IRenderManagerService).getRenderUnitById(unitId).with(SheetScrollManagerService).getCurrentScrollState() || {};
|
|
6735
6678
|
let startRow;
|
|
6736
6679
|
let startColumn;
|
|
6737
6680
|
let freezedRowCount;
|
|
@@ -6747,11 +6690,10 @@ const SetSelectionFrozenCommand = {
|
|
|
6747
6690
|
startColumn = sheetViewStartColumn + 1;
|
|
6748
6691
|
freezedColCount = 1;
|
|
6749
6692
|
} else {
|
|
6750
|
-
var _primary$startRow, _primary$startColumn;
|
|
6751
6693
|
const { primary, range } = selections[(selections === null || selections === void 0 ? void 0 : selections.length) - 1];
|
|
6752
|
-
let selectRow = (
|
|
6694
|
+
let selectRow = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
6753
6695
|
if (selectRow === 0) selectRow = 1;
|
|
6754
|
-
let selectColumn = (
|
|
6696
|
+
let selectColumn = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
6755
6697
|
if (selectColumn === 0) selectColumn = 1;
|
|
6756
6698
|
const rangeType = range.rangeType;
|
|
6757
6699
|
if (rangeType === RANGE_TYPE.ROW || type === 1) {
|
|
@@ -7082,7 +7024,7 @@ const MoveSelectionEnterAndTabCommand = {
|
|
|
7082
7024
|
reveal: true,
|
|
7083
7025
|
extra: params.extra
|
|
7084
7026
|
});
|
|
7085
|
-
const selectionService = (_renderManagerService = accessor.get(IRenderManagerService).
|
|
7027
|
+
const selectionService = (_renderManagerService = accessor.get(IRenderManagerService).getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(ISheetSelectionRenderService);
|
|
7086
7028
|
selectionService === null || selectionService === void 0 || selectionService.refreshSelectionMoveEnd();
|
|
7087
7029
|
return rs;
|
|
7088
7030
|
}
|
|
@@ -7216,7 +7158,7 @@ function getSheetObject(univerInstanceService, renderManagerService) {
|
|
|
7216
7158
|
const unitId = workbook.getUnitId();
|
|
7217
7159
|
let components, mainComponent, scene, engine;
|
|
7218
7160
|
if (isRenderManagerService(renderManagerService)) {
|
|
7219
|
-
const currentRender = renderManagerService.
|
|
7161
|
+
const currentRender = renderManagerService.getRenderUnitById(unitId);
|
|
7220
7162
|
if (currentRender == null) return null;
|
|
7221
7163
|
components = currentRender.components;
|
|
7222
7164
|
components = currentRender.components;
|
|
@@ -7553,9 +7495,7 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7553
7495
|
}
|
|
7554
7496
|
_getFreeze() {
|
|
7555
7497
|
var _this$_sheetSkeletonM4;
|
|
7556
|
-
|
|
7557
|
-
if (snapshot == null) return;
|
|
7558
|
-
return snapshot.freeze;
|
|
7498
|
+
return (_this$_sheetSkeletonM4 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM4 === void 0 ? void 0 : _this$_sheetSkeletonM4.skeleton.worksheet.getFreeze();
|
|
7559
7499
|
}
|
|
7560
7500
|
_getSheetObject() {
|
|
7561
7501
|
return getSheetObject(this._context.unit, this._context);
|
|
@@ -7574,12 +7514,11 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7574
7514
|
this._scrollToCell(row, column);
|
|
7575
7515
|
}
|
|
7576
7516
|
_scrollToSelection(targetIsActualRowAndColumn = true) {
|
|
7577
|
-
var _selection$primary;
|
|
7578
7517
|
const selection = this._getSelectionsService().getCurrentLastSelection();
|
|
7579
7518
|
if (!selection) return;
|
|
7580
|
-
const { startRow, startColumn, actualRow, actualColumn } =
|
|
7581
|
-
const selectionStartRow = targetIsActualRowAndColumn ? actualRow
|
|
7582
|
-
const selectionStartColumn = targetIsActualRowAndColumn ? actualColumn
|
|
7519
|
+
const { startRow, startColumn, actualRow, actualColumn } = selection.primary ?? selection.range;
|
|
7520
|
+
const selectionStartRow = targetIsActualRowAndColumn ? actualRow ?? startRow : startRow;
|
|
7521
|
+
const selectionStartColumn = targetIsActualRowAndColumn ? actualColumn ?? startColumn : startColumn;
|
|
7583
7522
|
this._scrollToCell(selectionStartRow, selectionStartColumn);
|
|
7584
7523
|
}
|
|
7585
7524
|
_getSelectionsService() {
|
|
@@ -7597,14 +7536,14 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7597
7536
|
return skeleton.getRangeByViewBound(vpInfo.viewBound);
|
|
7598
7537
|
}
|
|
7599
7538
|
_scrollToCell(row, column, forceTop = false, forceLeft = false) {
|
|
7600
|
-
var _this$
|
|
7601
|
-
const { rowHeightAccumulation, columnWidthAccumulation } =
|
|
7539
|
+
var _this$_getSheetObject2, _this$_sheetSkeletonM6;
|
|
7540
|
+
const { rowHeightAccumulation, columnWidthAccumulation } = this._sheetSkeletonManagerService.getCurrentSkeleton() ?? {};
|
|
7602
7541
|
if (rowHeightAccumulation == null || columnWidthAccumulation == null) return false;
|
|
7603
7542
|
const scene = (_this$_getSheetObject2 = this._getSheetObject()) === null || _this$_getSheetObject2 === void 0 ? void 0 : _this$_getSheetObject2.scene;
|
|
7604
7543
|
if (scene == null) return false;
|
|
7605
7544
|
const viewport = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7606
7545
|
if (viewport == null) return false;
|
|
7607
|
-
const skeleton = (_this$
|
|
7546
|
+
const skeleton = (_this$_sheetSkeletonM6 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM6 === void 0 ? void 0 : _this$_sheetSkeletonM6.skeleton;
|
|
7608
7547
|
if (skeleton == null) return false;
|
|
7609
7548
|
const worksheet = this._context.unit.getActiveSheet();
|
|
7610
7549
|
if (!worksheet) return false;
|
|
@@ -7692,8 +7631,8 @@ const SetScrollOperation = {
|
|
|
7692
7631
|
if (!params) return false;
|
|
7693
7632
|
const { unitId, sheetId, offsetX = 0, offsetY = 0, sheetViewStartColumn, sheetViewStartRow, duration, screenRatioX, screenRatioY } = params;
|
|
7694
7633
|
const renderManagerService = accessor.get(IRenderManagerService);
|
|
7695
|
-
const scrollManagerService = renderManagerService.
|
|
7696
|
-
const renderUnit = renderManagerService.
|
|
7634
|
+
const scrollManagerService = renderManagerService.getRenderUnitById(unitId).with(SheetScrollManagerService);
|
|
7635
|
+
const renderUnit = renderManagerService.getRenderUnitById(unitId);
|
|
7697
7636
|
if (!renderUnit) return false;
|
|
7698
7637
|
const engine = renderUnit.engine;
|
|
7699
7638
|
const canvasWidth = engine.width;
|
|
@@ -7730,7 +7669,7 @@ const SetScrollRelativeCommand = {
|
|
|
7730
7669
|
const target = getSheetCommandTarget(univerInstanceService);
|
|
7731
7670
|
if (!target) return false;
|
|
7732
7671
|
const { unitId, subUnitId } = target;
|
|
7733
|
-
const currentScroll = renderManagerSrv.
|
|
7672
|
+
const currentScroll = renderManagerSrv.getRenderUnitById(unitId).with(SheetScrollManagerService).getCurrentScrollState();
|
|
7734
7673
|
const { offsetX = 0, offsetY = 0 } = params || {};
|
|
7735
7674
|
const { sheetViewStartRow = 0, sheetViewStartColumn = 0, offsetX: currentOffsetX = 0, offsetY: currentOffsetY = 0 } = currentScroll || {};
|
|
7736
7675
|
return commandService.executeCommand(SetScrollOperation.id, {
|
|
@@ -7758,7 +7697,7 @@ const ScrollCommand = {
|
|
|
7758
7697
|
const target = params.unitId ? getScrollCommandTargetByParams(univerInstanceService, params) : getSheetCommandTarget(univerInstanceService);
|
|
7759
7698
|
if (!target) return false;
|
|
7760
7699
|
const { workbook, worksheet, unitId } = target;
|
|
7761
|
-
const renderUnit = renderManagerSrv.
|
|
7700
|
+
const renderUnit = renderManagerSrv.getRenderUnitById(unitId);
|
|
7762
7701
|
if (!renderUnit) return false;
|
|
7763
7702
|
const currentScroll = renderUnit.with(SheetScrollManagerService).getCurrentScrollState();
|
|
7764
7703
|
if (!worksheet) return false;
|
|
@@ -7768,10 +7707,10 @@ const ScrollCommand = {
|
|
|
7768
7707
|
return accessor.get(ICommandService).syncExecuteCommand(SetScrollOperation.id, {
|
|
7769
7708
|
unitId: workbook.getUnitId(),
|
|
7770
7709
|
sheetId: worksheet.getSheetId(),
|
|
7771
|
-
sheetViewStartRow: sheetViewStartRow
|
|
7772
|
-
sheetViewStartColumn: sheetViewStartColumn
|
|
7773
|
-
offsetX: offsetX
|
|
7774
|
-
offsetY: offsetY
|
|
7710
|
+
sheetViewStartRow: sheetViewStartRow ?? currentRow ?? 0 + ySplit,
|
|
7711
|
+
sheetViewStartColumn: sheetViewStartColumn ?? currentColumn ?? 0 + xSplit,
|
|
7712
|
+
offsetX: offsetX ?? currentOffsetX,
|
|
7713
|
+
offsetY: offsetY ?? currentOffsetY,
|
|
7775
7714
|
duration
|
|
7776
7715
|
});
|
|
7777
7716
|
}
|
|
@@ -7796,7 +7735,7 @@ const ScrollToCellCommand = {
|
|
|
7796
7735
|
type: CommandType.COMMAND,
|
|
7797
7736
|
handler: (accessor, params) => {
|
|
7798
7737
|
const instanceService = accessor.get(IUniverInstanceService);
|
|
7799
|
-
return accessor.get(IRenderManagerService).
|
|
7738
|
+
return accessor.get(IRenderManagerService).getRenderUnitById(instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId()).with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
|
|
7800
7739
|
}
|
|
7801
7740
|
};
|
|
7802
7741
|
/**
|
|
@@ -7850,7 +7789,7 @@ let AutoWidthController = class AutoWidthController extends Disposable {
|
|
|
7850
7789
|
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
7851
7790
|
if (!target) return defaultValue;
|
|
7852
7791
|
const { unitId, subUnitId, worksheet } = target;
|
|
7853
|
-
const sheetSkeletonService = this._renderManagerService.
|
|
7792
|
+
const sheetSkeletonService = this._renderManagerService.getRenderUnitById(unitId).with(SheetSkeletonManagerService);
|
|
7854
7793
|
if (!sheetSkeletonService.getCurrentParam()) return defaultValue;
|
|
7855
7794
|
const { skeleton } = sheetSkeletonService.getCurrentParam();
|
|
7856
7795
|
const colsAutoWidthInfo = skeleton.calculateAutoWidthInRange(params.ranges);
|
|
@@ -7914,6 +7853,162 @@ const SetWorksheetColAutoWidthCommand = {
|
|
|
7914
7853
|
}
|
|
7915
7854
|
};
|
|
7916
7855
|
|
|
7856
|
+
//#endregion
|
|
7857
|
+
//#region src/common/utils.ts
|
|
7858
|
+
function getUserListEqual(userList1, userList2) {
|
|
7859
|
+
if (userList1.length !== userList2.length) return false;
|
|
7860
|
+
const sorted1 = userList1.sort((a, b) => a.id.localeCompare(b.id));
|
|
7861
|
+
const sorted2 = userList2.sort((a, b) => a.id.localeCompare(b.id));
|
|
7862
|
+
return sorted1.every((user, index) => {
|
|
7863
|
+
var _user$subject, _sorted2$index$subjec;
|
|
7864
|
+
return ((_user$subject = user.subject) === null || _user$subject === void 0 ? void 0 : _user$subject.userID) === ((_sorted2$index$subjec = sorted2[index].subject) === null || _sorted2$index$subjec === void 0 ? void 0 : _sorted2$index$subjec.userID) && user.role === sorted2[index].role;
|
|
7865
|
+
});
|
|
7866
|
+
}
|
|
7867
|
+
function checkCellContentInRanges(worksheet, ranges) {
|
|
7868
|
+
return ranges.some((range) => checkCellContentInRange(worksheet, range));
|
|
7869
|
+
}
|
|
7870
|
+
function checkCellContentInRange(worksheet, range) {
|
|
7871
|
+
const { startRow, startColumn, endColumn, endRow } = range;
|
|
7872
|
+
const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn);
|
|
7873
|
+
let someCellGoingToBeRemoved = false;
|
|
7874
|
+
cellMatrix.forValue((row, col, cellData) => {
|
|
7875
|
+
if (cellData && (row !== startRow || col !== startColumn) && worksheet.cellHasValue(cellData)) {
|
|
7876
|
+
someCellGoingToBeRemoved = true;
|
|
7877
|
+
return false;
|
|
7878
|
+
}
|
|
7879
|
+
});
|
|
7880
|
+
return someCellGoingToBeRemoved;
|
|
7881
|
+
}
|
|
7882
|
+
function getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton) {
|
|
7883
|
+
const activeViewport = scene.getActiveViewportByCoord(Vector2.FromArray([offsetX, offsetY]));
|
|
7884
|
+
if (!activeViewport) return;
|
|
7885
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7886
|
+
const scrollXY = {
|
|
7887
|
+
x: activeViewport.viewportScrollX,
|
|
7888
|
+
y: activeViewport.viewportScrollY
|
|
7889
|
+
};
|
|
7890
|
+
const cellIndex = skeleton.getCellIndexByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
7891
|
+
const mergeCell = skeleton.worksheet.getMergedCell(cellIndex.row, cellIndex.column);
|
|
7892
|
+
return {
|
|
7893
|
+
actualRow: mergeCell ? mergeCell.startRow : cellIndex.row,
|
|
7894
|
+
actualCol: mergeCell ? mergeCell.startColumn : cellIndex.column,
|
|
7895
|
+
mergeCell,
|
|
7896
|
+
row: cellIndex.row,
|
|
7897
|
+
col: cellIndex.column
|
|
7898
|
+
};
|
|
7899
|
+
}
|
|
7900
|
+
function getViewportByCell(row, column, scene, worksheet) {
|
|
7901
|
+
const freeze = worksheet.getFreeze();
|
|
7902
|
+
if (!freeze || freeze.startRow <= 0 && freeze.startColumn <= 0) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7903
|
+
if (row >= freeze.startRow && column >= freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7904
|
+
if (row < freeze.startRow && column < freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP);
|
|
7905
|
+
if (row < freeze.startRow && column >= freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP);
|
|
7906
|
+
if (row >= freeze.startRow && column < freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT);
|
|
7907
|
+
}
|
|
7908
|
+
function transformBound2OffsetBound(originBound, scene, skeleton, worksheet) {
|
|
7909
|
+
const topLeft = transformPosition2Offset(originBound.left, originBound.top, scene, skeleton, worksheet);
|
|
7910
|
+
const bottomRight = transformPosition2Offset(originBound.right, originBound.bottom, scene, skeleton, worksheet);
|
|
7911
|
+
return {
|
|
7912
|
+
left: topLeft.x,
|
|
7913
|
+
top: topLeft.y,
|
|
7914
|
+
right: bottomRight.x,
|
|
7915
|
+
bottom: bottomRight.y
|
|
7916
|
+
};
|
|
7917
|
+
}
|
|
7918
|
+
function transformPosition2Offset(x, y, scene, skeleton, worksheet) {
|
|
7919
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7920
|
+
const viewMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7921
|
+
if (!viewMain) return {
|
|
7922
|
+
x,
|
|
7923
|
+
y
|
|
7924
|
+
};
|
|
7925
|
+
const { startColumn, startRow, xSplit, ySplit } = worksheet.getFreeze();
|
|
7926
|
+
const startSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow - ySplit, startColumn - xSplit, false);
|
|
7927
|
+
const endSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn, false);
|
|
7928
|
+
const { rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
7929
|
+
const freezeWidth = endSheetView.startX - startSheetView.startX;
|
|
7930
|
+
const freezeHeight = endSheetView.startY - startSheetView.startY;
|
|
7931
|
+
const { top, left, viewportScrollX, viewportScrollY } = viewMain;
|
|
7932
|
+
let offsetX;
|
|
7933
|
+
if (x > left) offsetX = (x - viewportScrollX) * scaleX;
|
|
7934
|
+
else offsetX = (freezeWidth + rowHeaderWidth - (left - x)) * scaleX;
|
|
7935
|
+
let offsetY;
|
|
7936
|
+
if (y > top) offsetY = (y - viewportScrollY) * scaleY;
|
|
7937
|
+
else offsetY = (freezeHeight + columnHeaderHeight - (top - y)) * scaleX;
|
|
7938
|
+
return {
|
|
7939
|
+
x: offsetX,
|
|
7940
|
+
y: offsetY
|
|
7941
|
+
};
|
|
7942
|
+
}
|
|
7943
|
+
function getCellRealRange(workbook, worksheet, skeleton, row, col) {
|
|
7944
|
+
let actualRow = row;
|
|
7945
|
+
let actualCol = col;
|
|
7946
|
+
skeleton.overflowCache.forValue((r, c, range) => {
|
|
7947
|
+
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
7948
|
+
actualCol = c;
|
|
7949
|
+
actualRow = r;
|
|
7950
|
+
}
|
|
7951
|
+
});
|
|
7952
|
+
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
7953
|
+
return {
|
|
7954
|
+
unitId: workbook.getUnitId(),
|
|
7955
|
+
subUnitId: worksheet.getSheetId(),
|
|
7956
|
+
workbook,
|
|
7957
|
+
worksheet,
|
|
7958
|
+
row: actualCell.actualRow,
|
|
7959
|
+
col: actualCell.actualColumn
|
|
7960
|
+
};
|
|
7961
|
+
}
|
|
7962
|
+
function getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
7963
|
+
const { scene } = currentRender;
|
|
7964
|
+
const unitId = workbook.getUnitId();
|
|
7965
|
+
const { skeleton, sheetId } = skeletonParam;
|
|
7966
|
+
const cellIndex = getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton);
|
|
7967
|
+
if (!cellIndex) return null;
|
|
7968
|
+
let { actualCol, actualRow } = cellIndex;
|
|
7969
|
+
const originLocation = {
|
|
7970
|
+
unitId,
|
|
7971
|
+
subUnitId: sheetId,
|
|
7972
|
+
workbook,
|
|
7973
|
+
worksheet,
|
|
7974
|
+
row: actualRow,
|
|
7975
|
+
col: actualCol
|
|
7976
|
+
};
|
|
7977
|
+
skeleton.overflowCache.forValue((r, c, range) => {
|
|
7978
|
+
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
7979
|
+
actualCol = c;
|
|
7980
|
+
actualRow = r;
|
|
7981
|
+
}
|
|
7982
|
+
});
|
|
7983
|
+
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
7984
|
+
const location = getCellRealRange(workbook, worksheet, skeleton, actualRow, actualCol);
|
|
7985
|
+
let anchorCell;
|
|
7986
|
+
if (actualCell.mergeInfo) anchorCell = actualCell.mergeInfo;
|
|
7987
|
+
else anchorCell = {
|
|
7988
|
+
startRow: location.row,
|
|
7989
|
+
endRow: location.row,
|
|
7990
|
+
startColumn: location.col,
|
|
7991
|
+
endColumn: location.col
|
|
7992
|
+
};
|
|
7993
|
+
const activeViewport = scene.getActiveViewportByCoord(Vector2.FromArray([offsetX, offsetY]));
|
|
7994
|
+
if (!activeViewport) return;
|
|
7995
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7996
|
+
const scrollXY = {
|
|
7997
|
+
x: activeViewport.viewportScrollX,
|
|
7998
|
+
y: activeViewport.viewportScrollY
|
|
7999
|
+
};
|
|
8000
|
+
return {
|
|
8001
|
+
position: {
|
|
8002
|
+
startX: (skeleton.getOffsetByColumn(anchorCell.startColumn - 1) - scrollXY.x) * scaleX,
|
|
8003
|
+
endX: (skeleton.getOffsetByColumn(anchorCell.endColumn) - scrollXY.x) * scaleX,
|
|
8004
|
+
startY: (skeleton.getOffsetByRow(anchorCell.startRow - 1) - scrollXY.y) * scaleY,
|
|
8005
|
+
endY: (skeleton.getOffsetByRow(anchorCell.endRow) - scrollXY.y) * scaleY
|
|
8006
|
+
},
|
|
8007
|
+
location: originLocation,
|
|
8008
|
+
overflowLocation: location
|
|
8009
|
+
};
|
|
8010
|
+
}
|
|
8011
|
+
|
|
7917
8012
|
//#endregion
|
|
7918
8013
|
//#region src/services/editor-bridge.service.ts
|
|
7919
8014
|
let EditorBridgeService = class EditorBridgeService extends Disposable {
|
|
@@ -7987,15 +8082,16 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
|
|
|
7987
8082
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
7988
8083
|
const worksheet = workbook.getActiveSheet();
|
|
7989
8084
|
if (!worksheet || worksheet.getSheetId() !== sheetId) return;
|
|
7990
|
-
|
|
7991
|
-
if (!renderUnit) return;
|
|
8085
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
7992
8086
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
|
|
7993
8087
|
if (!skeleton) return;
|
|
7994
8088
|
const actualRangeWithCoord = convertCellToRange(attachPrimaryWithCoord(skeleton, primary));
|
|
7995
8089
|
const canvasOffset = getCanvasOffsetByEngine(engine);
|
|
7996
8090
|
let { startX, startY, endX, endY } = actualRangeWithCoord;
|
|
7997
8091
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7998
|
-
const
|
|
8092
|
+
const viewport = getViewportByCell(primary.startRow, primary.startColumn, scene, worksheet);
|
|
8093
|
+
if (!viewport) return;
|
|
8094
|
+
const scrollXY = scene.getViewportScrollXY(viewport);
|
|
7999
8095
|
startX = convertTransformToOffsetX(startX, scaleX, scrollXY);
|
|
8000
8096
|
startY = convertTransformToOffsetY(startY, scaleY, scrollXY);
|
|
8001
8097
|
endX = convertTransformToOffsetX(endX, scaleX, scrollXY);
|
|
@@ -8086,8 +8182,7 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
|
|
|
8086
8182
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
8087
8183
|
const worksheet = workbook.getActiveSheet();
|
|
8088
8184
|
if (!worksheet || worksheet.getSheetId() !== sheetId) return;
|
|
8089
|
-
|
|
8090
|
-
if (!renderUnit) return;
|
|
8185
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
8091
8186
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
|
|
8092
8187
|
if (!skeleton) return;
|
|
8093
8188
|
const { startRow, startColumn } = primary;
|
|
@@ -8095,7 +8190,9 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
|
|
|
8095
8190
|
const canvasOffset = getCanvasOffsetByEngine(engine);
|
|
8096
8191
|
let { startX, startY, endX, endY } = actualRangeWithCoord;
|
|
8097
8192
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8098
|
-
const
|
|
8193
|
+
const viewport = getViewportByCell(startRow, startColumn, scene, worksheet);
|
|
8194
|
+
if (!viewport) return;
|
|
8195
|
+
const scrollXY = scene.getViewportScrollXY(viewport);
|
|
8099
8196
|
startX = convertTransformToOffsetX(startX, scaleX, scrollXY);
|
|
8100
8197
|
startY = convertTransformToOffsetY(startY, scaleY, scrollXY);
|
|
8101
8198
|
endX = convertTransformToOffsetX(endX, scaleX, scrollXY);
|
|
@@ -8161,8 +8258,7 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
|
|
|
8161
8258
|
};
|
|
8162
8259
|
}
|
|
8163
8260
|
_getWorkbookForEditUnit(unitId) {
|
|
8164
|
-
|
|
8165
|
-
return (_this$_univerInstance = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) !== null && _this$_univerInstance !== void 0 ? _this$_univerInstance : this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
8261
|
+
return this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET) ?? this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
8166
8262
|
}
|
|
8167
8263
|
getCurrentEditorId() {
|
|
8168
8264
|
return this._editorUnitId;
|
|
@@ -8277,7 +8373,7 @@ const SetZoomRatioOperation = {
|
|
|
8277
8373
|
id: "sheet.operation.set-zoom-ratio",
|
|
8278
8374
|
type: CommandType.OPERATION,
|
|
8279
8375
|
handler: (accessor, params) => {
|
|
8280
|
-
const renderUnit = accessor.get(IRenderManagerService).
|
|
8376
|
+
const renderUnit = accessor.get(IRenderManagerService).getRenderUnitById(params.unitId);
|
|
8281
8377
|
if (!renderUnit) return false;
|
|
8282
8378
|
return renderUnit.with(SheetsZoomRenderController).updateZoom(params.subUnitId, params.zoomRatio);
|
|
8283
8379
|
}
|
|
@@ -8462,7 +8558,6 @@ const SHEETS_UI_PLUGIN_CONFIG_KEY = "sheets-ui.config";
|
|
|
8462
8558
|
const configSymbol = Symbol(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
8463
8559
|
const defaultPluginConfig = {
|
|
8464
8560
|
formulaBar: true,
|
|
8465
|
-
statusBarStatistic: true,
|
|
8466
8561
|
protectedRangeShadow: true,
|
|
8467
8562
|
maxAutoHeightCount: 1e3
|
|
8468
8563
|
};
|
|
@@ -8494,7 +8589,7 @@ const SetCellEditVisibleOperation = {
|
|
|
8494
8589
|
if (!workbook) return false;
|
|
8495
8590
|
accessor.get(IEditorBridgeService).changeVisible({
|
|
8496
8591
|
...params,
|
|
8497
|
-
unitId: unitId
|
|
8592
|
+
unitId: unitId ?? workbook.getUnitId()
|
|
8498
8593
|
});
|
|
8499
8594
|
return true;
|
|
8500
8595
|
}
|
|
@@ -8515,8 +8610,6 @@ const SetCellEditVisibleWithF2Operation = {
|
|
|
8515
8610
|
/**
|
|
8516
8611
|
* When the editor is not clicked to change the cursor,
|
|
8517
8612
|
* the arrow keys will exit editing and move the cell.
|
|
8518
|
-
*
|
|
8519
|
-
* @deprecated Should not use operation as an event.
|
|
8520
8613
|
*/
|
|
8521
8614
|
const SetCellEditVisibleArrowOperation = {
|
|
8522
8615
|
id: "sheet.operation.set-cell-edit-visible-arrow",
|
|
@@ -8542,13 +8635,13 @@ const ScrollToRangeOperation = {
|
|
|
8542
8635
|
id: "sheet.operation.scroll-to-range",
|
|
8543
8636
|
type: CommandType.OPERATION,
|
|
8544
8637
|
handler: (accessor, params) => {
|
|
8545
|
-
var
|
|
8638
|
+
var _instanceService$getC;
|
|
8546
8639
|
if (!params) return false;
|
|
8547
8640
|
const instanceService = accessor.get(IUniverInstanceService);
|
|
8548
8641
|
const renderManagerService = accessor.get(IRenderManagerService);
|
|
8549
|
-
const unitId =
|
|
8642
|
+
const unitId = params.unitId ?? ((_instanceService$getC = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId());
|
|
8550
8643
|
if (!unitId) return false;
|
|
8551
|
-
const renderUnit = renderManagerService.
|
|
8644
|
+
const renderUnit = renderManagerService.getRenderUnitById(unitId);
|
|
8552
8645
|
if (!renderUnit) return false;
|
|
8553
8646
|
return renderUnit.with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
|
|
8554
8647
|
}
|
|
@@ -8567,7 +8660,6 @@ const SheetPermissionOpenDialogOperation = {
|
|
|
8567
8660
|
title: { title: "sheets-ui.permission.dialog.allowedPermissionType" },
|
|
8568
8661
|
children: { label: UNIVER_SHEET_PERMISSION_DIALOG },
|
|
8569
8662
|
width: 393,
|
|
8570
|
-
destroyOnClose: true,
|
|
8571
8663
|
onClose: () => dialogService.close(UNIVER_SHEET_PERMISSION_DIALOG_ID)
|
|
8572
8664
|
});
|
|
8573
8665
|
return true;
|
|
@@ -8623,162 +8715,6 @@ const SidebarDefinedNameOperation = {
|
|
|
8623
8715
|
}
|
|
8624
8716
|
};
|
|
8625
8717
|
|
|
8626
|
-
//#endregion
|
|
8627
|
-
//#region src/common/utils.ts
|
|
8628
|
-
function getUserListEqual(userList1, userList2) {
|
|
8629
|
-
if (userList1.length !== userList2.length) return false;
|
|
8630
|
-
const sorted1 = userList1.sort((a, b) => a.id.localeCompare(b.id));
|
|
8631
|
-
const sorted2 = userList2.sort((a, b) => a.id.localeCompare(b.id));
|
|
8632
|
-
return sorted1.every((user, index) => {
|
|
8633
|
-
var _user$subject, _sorted2$index$subjec;
|
|
8634
|
-
return ((_user$subject = user.subject) === null || _user$subject === void 0 ? void 0 : _user$subject.userID) === ((_sorted2$index$subjec = sorted2[index].subject) === null || _sorted2$index$subjec === void 0 ? void 0 : _sorted2$index$subjec.userID) && user.role === sorted2[index].role;
|
|
8635
|
-
});
|
|
8636
|
-
}
|
|
8637
|
-
function checkCellContentInRanges(worksheet, ranges) {
|
|
8638
|
-
return ranges.some((range) => checkCellContentInRange(worksheet, range));
|
|
8639
|
-
}
|
|
8640
|
-
function checkCellContentInRange(worksheet, range) {
|
|
8641
|
-
const { startRow, startColumn, endColumn, endRow } = range;
|
|
8642
|
-
const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn);
|
|
8643
|
-
let someCellGoingToBeRemoved = false;
|
|
8644
|
-
cellMatrix.forValue((row, col, cellData) => {
|
|
8645
|
-
if (cellData && (row !== startRow || col !== startColumn) && worksheet.cellHasValue(cellData)) {
|
|
8646
|
-
someCellGoingToBeRemoved = true;
|
|
8647
|
-
return false;
|
|
8648
|
-
}
|
|
8649
|
-
});
|
|
8650
|
-
return someCellGoingToBeRemoved;
|
|
8651
|
-
}
|
|
8652
|
-
function getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton) {
|
|
8653
|
-
const activeViewport = scene.getActiveViewportByCoord(Vector2.FromArray([offsetX, offsetY]));
|
|
8654
|
-
if (!activeViewport) return;
|
|
8655
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8656
|
-
const scrollXY = {
|
|
8657
|
-
x: activeViewport.viewportScrollX,
|
|
8658
|
-
y: activeViewport.viewportScrollY
|
|
8659
|
-
};
|
|
8660
|
-
const cellIndex = skeleton.getCellIndexByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
8661
|
-
const mergeCell = skeleton.worksheet.getMergedCell(cellIndex.row, cellIndex.column);
|
|
8662
|
-
return {
|
|
8663
|
-
actualRow: mergeCell ? mergeCell.startRow : cellIndex.row,
|
|
8664
|
-
actualCol: mergeCell ? mergeCell.startColumn : cellIndex.column,
|
|
8665
|
-
mergeCell,
|
|
8666
|
-
row: cellIndex.row,
|
|
8667
|
-
col: cellIndex.column
|
|
8668
|
-
};
|
|
8669
|
-
}
|
|
8670
|
-
function getViewportByCell(row, column, scene, worksheet) {
|
|
8671
|
-
const freeze = worksheet.getFreeze();
|
|
8672
|
-
if (!freeze || freeze.startRow <= 0 && freeze.startColumn <= 0) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8673
|
-
if (row >= freeze.startRow && column >= freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8674
|
-
if (row < freeze.startRow && column < freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP);
|
|
8675
|
-
if (row < freeze.startRow && column >= freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP);
|
|
8676
|
-
if (row >= freeze.startRow && column < freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT);
|
|
8677
|
-
}
|
|
8678
|
-
function transformBound2OffsetBound(originBound, scene, skeleton, worksheet) {
|
|
8679
|
-
const topLeft = transformPosition2Offset(originBound.left, originBound.top, scene, skeleton, worksheet);
|
|
8680
|
-
const bottomRight = transformPosition2Offset(originBound.right, originBound.bottom, scene, skeleton, worksheet);
|
|
8681
|
-
return {
|
|
8682
|
-
left: topLeft.x,
|
|
8683
|
-
top: topLeft.y,
|
|
8684
|
-
right: bottomRight.x,
|
|
8685
|
-
bottom: bottomRight.y
|
|
8686
|
-
};
|
|
8687
|
-
}
|
|
8688
|
-
function transformPosition2Offset(x, y, scene, skeleton, worksheet) {
|
|
8689
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8690
|
-
const viewMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8691
|
-
if (!viewMain) return {
|
|
8692
|
-
x,
|
|
8693
|
-
y
|
|
8694
|
-
};
|
|
8695
|
-
const { startColumn, startRow, xSplit, ySplit } = worksheet.getFreeze();
|
|
8696
|
-
const startSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow - ySplit, startColumn - xSplit, false);
|
|
8697
|
-
const endSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn, false);
|
|
8698
|
-
const { rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
8699
|
-
const freezeWidth = endSheetView.startX - startSheetView.startX;
|
|
8700
|
-
const freezeHeight = endSheetView.startY - startSheetView.startY;
|
|
8701
|
-
const { top, left, viewportScrollX, viewportScrollY } = viewMain;
|
|
8702
|
-
let offsetX;
|
|
8703
|
-
if (x > left) offsetX = (x - viewportScrollX) * scaleX;
|
|
8704
|
-
else offsetX = (freezeWidth + rowHeaderWidth - (left - x)) * scaleX;
|
|
8705
|
-
let offsetY;
|
|
8706
|
-
if (y > top) offsetY = (y - viewportScrollY) * scaleY;
|
|
8707
|
-
else offsetY = (freezeHeight + columnHeaderHeight - (top - y)) * scaleX;
|
|
8708
|
-
return {
|
|
8709
|
-
x: offsetX,
|
|
8710
|
-
y: offsetY
|
|
8711
|
-
};
|
|
8712
|
-
}
|
|
8713
|
-
function getCellRealRange(workbook, worksheet, skeleton, row, col) {
|
|
8714
|
-
let actualRow = row;
|
|
8715
|
-
let actualCol = col;
|
|
8716
|
-
skeleton.overflowCache.forValue((r, c, range) => {
|
|
8717
|
-
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
8718
|
-
actualCol = c;
|
|
8719
|
-
actualRow = r;
|
|
8720
|
-
}
|
|
8721
|
-
});
|
|
8722
|
-
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
8723
|
-
return {
|
|
8724
|
-
unitId: workbook.getUnitId(),
|
|
8725
|
-
subUnitId: worksheet.getSheetId(),
|
|
8726
|
-
workbook,
|
|
8727
|
-
worksheet,
|
|
8728
|
-
row: actualCell.actualRow,
|
|
8729
|
-
col: actualCell.actualColumn
|
|
8730
|
-
};
|
|
8731
|
-
}
|
|
8732
|
-
function getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
8733
|
-
const { scene } = currentRender;
|
|
8734
|
-
const unitId = workbook.getUnitId();
|
|
8735
|
-
const { skeleton, sheetId } = skeletonParam;
|
|
8736
|
-
const cellIndex = getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton);
|
|
8737
|
-
if (!cellIndex) return null;
|
|
8738
|
-
let { actualCol, actualRow } = cellIndex;
|
|
8739
|
-
const originLocation = {
|
|
8740
|
-
unitId,
|
|
8741
|
-
subUnitId: sheetId,
|
|
8742
|
-
workbook,
|
|
8743
|
-
worksheet,
|
|
8744
|
-
row: actualRow,
|
|
8745
|
-
col: actualCol
|
|
8746
|
-
};
|
|
8747
|
-
skeleton.overflowCache.forValue((r, c, range) => {
|
|
8748
|
-
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
8749
|
-
actualCol = c;
|
|
8750
|
-
actualRow = r;
|
|
8751
|
-
}
|
|
8752
|
-
});
|
|
8753
|
-
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
8754
|
-
const location = getCellRealRange(workbook, worksheet, skeleton, actualRow, actualCol);
|
|
8755
|
-
let anchorCell;
|
|
8756
|
-
if (actualCell.mergeInfo) anchorCell = actualCell.mergeInfo;
|
|
8757
|
-
else anchorCell = {
|
|
8758
|
-
startRow: location.row,
|
|
8759
|
-
endRow: location.row,
|
|
8760
|
-
startColumn: location.col,
|
|
8761
|
-
endColumn: location.col
|
|
8762
|
-
};
|
|
8763
|
-
const activeViewport = scene.getActiveViewportByCoord(Vector2.FromArray([offsetX, offsetY]));
|
|
8764
|
-
if (!activeViewport) return;
|
|
8765
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8766
|
-
const scrollXY = {
|
|
8767
|
-
x: activeViewport.viewportScrollX,
|
|
8768
|
-
y: activeViewport.viewportScrollY
|
|
8769
|
-
};
|
|
8770
|
-
return {
|
|
8771
|
-
position: {
|
|
8772
|
-
startX: (skeleton.getOffsetByColumn(anchorCell.startColumn - 1) - scrollXY.x) * scaleX,
|
|
8773
|
-
endX: (skeleton.getOffsetByColumn(anchorCell.endColumn) - scrollXY.x) * scaleX,
|
|
8774
|
-
startY: (skeleton.getOffsetByRow(anchorCell.startRow - 1) - scrollXY.y) * scaleY,
|
|
8775
|
-
endY: (skeleton.getOffsetByRow(anchorCell.endRow) - scrollXY.y) * scaleY
|
|
8776
|
-
},
|
|
8777
|
-
location: originLocation,
|
|
8778
|
-
overflowLocation: location
|
|
8779
|
-
};
|
|
8780
|
-
}
|
|
8781
|
-
|
|
8782
8718
|
//#endregion
|
|
8783
8719
|
//#region src/consts/plugin-name.ts
|
|
8784
8720
|
/**
|
|
@@ -8858,10 +8794,7 @@ let SheetsRenderService = class SheetsRenderService extends RxDisposable {
|
|
|
8858
8794
|
}
|
|
8859
8795
|
_initWorkbookListener() {
|
|
8860
8796
|
this._instanceSrv.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((event) => this._createRenderer(event.unit, event.options));
|
|
8861
|
-
this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).forEach((workbook) =>
|
|
8862
|
-
var _this$_instanceSrv$ge;
|
|
8863
|
-
return this._createRenderer(workbook, (_this$_instanceSrv$ge = this._instanceSrv.getUnitCreateOptions(workbook.getUnitId())) !== null && _this$_instanceSrv$ge !== void 0 ? _this$_instanceSrv$ge : void 0);
|
|
8864
|
-
});
|
|
8797
|
+
this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).forEach((workbook) => this._createRenderer(workbook, this._instanceSrv.getUnitCreateOptions(workbook.getUnitId()) ?? void 0));
|
|
8865
8798
|
this._instanceSrv.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._disposeRenderer(workbook));
|
|
8866
8799
|
}
|
|
8867
8800
|
_createRenderer(workbook, createUnitOptions) {
|
|
@@ -9130,7 +9063,7 @@ let AutoHeightController = class AutoHeightController extends Disposable {
|
|
|
9130
9063
|
subUnitId = worksheet.getSheetId();
|
|
9131
9064
|
}
|
|
9132
9065
|
}
|
|
9133
|
-
const skeleton = this._renderManagerService.
|
|
9066
|
+
const skeleton = this._renderManagerService.getRenderUnitById(unitId).with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
9134
9067
|
if (!skeleton) return {
|
|
9135
9068
|
redos: [],
|
|
9136
9069
|
undos: []
|
|
@@ -9165,7 +9098,7 @@ let AutoHeightController = class AutoHeightController extends Disposable {
|
|
|
9165
9098
|
_initialize() {
|
|
9166
9099
|
this.disposeWithMe(this._sheetInterceptorService.interceptAutoHeight({ getMutations: (info) => {
|
|
9167
9100
|
const { unitId, subUnitId, ranges, autoHeightRanges, lazyAutoHeightRanges, cellHeights } = info;
|
|
9168
|
-
const undoRedoItem = this.getUndoRedoParamsOfAutoHeight(autoHeightRanges
|
|
9101
|
+
const undoRedoItem = this.getUndoRedoParamsOfAutoHeight(autoHeightRanges ?? ranges, subUnitId, cellHeights);
|
|
9169
9102
|
return this._processLazyAutoHeight(undoRedoItem, unitId, subUnitId, lazyAutoHeightRanges);
|
|
9170
9103
|
} }));
|
|
9171
9104
|
}
|
|
@@ -9196,7 +9129,7 @@ let CellCustomRenderController = class CellCustomRenderController extends Dispos
|
|
|
9196
9129
|
if (!skeletonParam) return;
|
|
9197
9130
|
const unitId = this._context.unitId;
|
|
9198
9131
|
const { skeleton } = skeletonParam;
|
|
9199
|
-
const currentRender = this._renderManagerService.
|
|
9132
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
9200
9133
|
if (currentRender && currentRender.mainComponent) {
|
|
9201
9134
|
const spreadsheet = currentRender.mainComponent;
|
|
9202
9135
|
const getActiveRender = (evt) => {
|
|
@@ -9231,7 +9164,7 @@ let CellCustomRenderController = class CellCustomRenderController extends Dispos
|
|
|
9231
9164
|
const subUnitId = worksheet.getSheetId();
|
|
9232
9165
|
const info = {
|
|
9233
9166
|
data: cellData,
|
|
9234
|
-
style:
|
|
9167
|
+
style: worksheet.getComposedCellStyleByCellData(row, col, cellData),
|
|
9235
9168
|
primaryWithCoord: skeleton.getCellWithCoordByIndex(cellIndex.actualRow, cellIndex.actualCol),
|
|
9236
9169
|
unitId,
|
|
9237
9170
|
subUnitId,
|
|
@@ -9692,10 +9625,9 @@ SheetRenderController = __decorate([
|
|
|
9692
9625
|
__decorateParam(5, Optional(ITelemetryService))
|
|
9693
9626
|
], SheetRenderController);
|
|
9694
9627
|
function getLeftTopPlaceholderSize(skeleton) {
|
|
9695
|
-
var _skeleton$rowHeaderWi, _skeleton$columnHeade;
|
|
9696
9628
|
return {
|
|
9697
|
-
width:
|
|
9698
|
-
height:
|
|
9629
|
+
width: skeleton.rowHeaderWidthAndMarginLeft ?? skeleton.rowHeaderWidth,
|
|
9630
|
+
height: skeleton.columnHeaderHeightAndMarginTop ?? skeleton.columnHeaderHeight
|
|
9699
9631
|
};
|
|
9700
9632
|
}
|
|
9701
9633
|
|
|
@@ -9716,7 +9648,7 @@ let SheetSkeletonRenderController = class SheetSkeletonRenderController extends
|
|
|
9716
9648
|
if (param == null) return;
|
|
9717
9649
|
const { unitId } = this._context;
|
|
9718
9650
|
const { skeleton } = param;
|
|
9719
|
-
const scene = (_this$_renderManagerS = this._renderManagerService.
|
|
9651
|
+
const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
|
|
9720
9652
|
if (skeleton == null || scene == null) return;
|
|
9721
9653
|
const { rowTotalHeight, columnTotalWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
9722
9654
|
if (!this._context.unit.getActiveSheet()) return;
|
|
@@ -9774,7 +9706,9 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposab
|
|
|
9774
9706
|
if (!loadingRender) return;
|
|
9775
9707
|
let shouldRender = false;
|
|
9776
9708
|
if (!loadingRender.render) {
|
|
9777
|
-
|
|
9709
|
+
const contentElement = this._layoutService.getContentElement();
|
|
9710
|
+
if (!contentElement) return;
|
|
9711
|
+
loadingRender.render = this._createLoadingRender(loadingRender.workbook, loadingRender.sourceUnitId, contentElement);
|
|
9778
9712
|
shouldRender = true;
|
|
9779
9713
|
}
|
|
9780
9714
|
const worksheet = loadingRender.workbook.getSheetBySheetId(activeSheetId);
|
|
@@ -9813,6 +9747,10 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposab
|
|
|
9813
9747
|
async handoff(sourceUnitId, timeoutMs) {
|
|
9814
9748
|
var _this$_loadingRender2, _this$_finalCanvasGua;
|
|
9815
9749
|
if (((_this$_loadingRender2 = this._loadingRender) === null || _this$_loadingRender2 === void 0 ? void 0 : _this$_loadingRender2.sourceUnitId) !== sourceUnitId) return true;
|
|
9750
|
+
if (!this._loadingRender.render) {
|
|
9751
|
+
this.hide(sourceUnitId);
|
|
9752
|
+
return true;
|
|
9753
|
+
}
|
|
9816
9754
|
(_this$_finalCanvasGua = this._finalCanvasGuard) === null || _this$_finalCanvasGua === void 0 || _this$_finalCanvasGua.unsubscribe();
|
|
9817
9755
|
this._finalCanvasGuard = null;
|
|
9818
9756
|
try {
|
|
@@ -9848,9 +9786,8 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposab
|
|
|
9848
9786
|
if (activeSheet) workbook.setActiveSheet(activeSheet);
|
|
9849
9787
|
return workbook;
|
|
9850
9788
|
}
|
|
9851
|
-
_createLoadingRender(workbook, sourceUnitId) {
|
|
9789
|
+
_createLoadingRender(workbook, sourceUnitId, contentElement) {
|
|
9852
9790
|
const previewUnitId = workbook.getUnitId();
|
|
9853
|
-
const contentElement = this._layoutService.getContentElement();
|
|
9854
9791
|
const { width, height } = contentElement.getBoundingClientRect();
|
|
9855
9792
|
const engine = this._injector.createInstance(Engine, previewUnitId, void 0);
|
|
9856
9793
|
const scene = new Scene(`${PREVIEW_SCENE_PREFIX}${previewUnitId}`, engine, {
|
|
@@ -9885,10 +9822,10 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposab
|
|
|
9885
9822
|
_waitForFinalCanvas(render) {
|
|
9886
9823
|
return new Observable((subscriber) => {
|
|
9887
9824
|
let frameId;
|
|
9888
|
-
const contentElement = this._layoutService.getContentElement();
|
|
9889
9825
|
const canvasElement = render.engine.getCanvasElement();
|
|
9890
9826
|
const checkMounted = () => {
|
|
9891
|
-
|
|
9827
|
+
const contentElement = this._layoutService.getContentElement();
|
|
9828
|
+
if (contentElement && canvasElement.parentElement === contentElement && canvasElement.width > 0 && canvasElement.height > 0) {
|
|
9892
9829
|
subscriber.next();
|
|
9893
9830
|
subscriber.complete();
|
|
9894
9831
|
return;
|
|
@@ -9902,7 +9839,7 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposab
|
|
|
9902
9839
|
});
|
|
9903
9840
|
}
|
|
9904
9841
|
_getFinalRender$(sourceUnitId) {
|
|
9905
|
-
const existingRender = this._renderManagerService.
|
|
9842
|
+
const existingRender = this._renderManagerService.getRenderUnitById(sourceUnitId);
|
|
9906
9843
|
return existingRender ? of(existingRender) : this._renderManagerService.created$.pipe(filter((render) => render.unitId === sourceUnitId));
|
|
9907
9844
|
}
|
|
9908
9845
|
_guardFinalCanvas(sourceUnitId) {
|
|
@@ -9969,29 +9906,22 @@ SheetLoadingRenderService = __decorate([
|
|
|
9969
9906
|
//#region src/views/hook.ts
|
|
9970
9907
|
const SheetLoadingWorkbookContext = createContext(null);
|
|
9971
9908
|
function useActiveWorkbook() {
|
|
9972
|
-
var _ref;
|
|
9973
9909
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
9974
9910
|
const loadingWorkbook = useContext(SheetLoadingWorkbookContext);
|
|
9975
9911
|
const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
|
|
9976
|
-
return
|
|
9912
|
+
return loadingWorkbook ?? workbook ?? null;
|
|
9977
9913
|
}
|
|
9978
9914
|
function useSheetLoadingWorkbook() {
|
|
9979
|
-
|
|
9980
|
-
return (_useObservable = useObservable(useDependency(ISheetLoadingRenderService).workbook$)) !== null && _useObservable !== void 0 ? _useObservable : null;
|
|
9915
|
+
return useObservable(useDependency(ISheetLoadingRenderService).workbook$) ?? null;
|
|
9981
9916
|
}
|
|
9982
9917
|
function useSheetLoading() {
|
|
9983
|
-
|
|
9984
|
-
return (_useObservable2 = useObservable(useDependency(ISheetLoadingRenderService).loading$)) !== null && _useObservable2 !== void 0 ? _useObservable2 : false;
|
|
9918
|
+
return useObservable(useDependency(ISheetLoadingRenderService).loading$) ?? false;
|
|
9985
9919
|
}
|
|
9986
9920
|
function useSheetLoadingPreviewReady() {
|
|
9987
|
-
|
|
9988
|
-
return (_useObservable3 = useObservable(useDependency(ISheetLoadingRenderService).previewReady$)) !== null && _useObservable3 !== void 0 ? _useObservable3 : false;
|
|
9921
|
+
return useObservable(useDependency(ISheetLoadingRenderService).previewReady$) ?? false;
|
|
9989
9922
|
}
|
|
9990
9923
|
function useActiveWorksheet(workbook) {
|
|
9991
|
-
return useObservable(() =>
|
|
9992
|
-
var _workbook$activeSheet;
|
|
9993
|
-
return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : of(null);
|
|
9994
|
-
}, void 0, void 0, [workbook]);
|
|
9924
|
+
return useObservable(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? of(null), void 0, void 0, [workbook]);
|
|
9995
9925
|
}
|
|
9996
9926
|
function useWorkbooks() {
|
|
9997
9927
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
@@ -10030,7 +9960,7 @@ const SheetPasteOptions = [
|
|
|
10030
9960
|
}
|
|
10031
9961
|
];
|
|
10032
9962
|
const useMenuPosition = (range) => {
|
|
10033
|
-
var _scene$getEngine
|
|
9963
|
+
var _scene$getEngine;
|
|
10034
9964
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
10035
9965
|
const renderManagerService = useDependency(IRenderManagerService);
|
|
10036
9966
|
const workbook = useActiveWorkbook();
|
|
@@ -10042,24 +9972,24 @@ const useMenuPosition = (range) => {
|
|
|
10042
9972
|
endCol: range.cols[range.cols.length - 1]
|
|
10043
9973
|
};
|
|
10044
9974
|
if (anchor.endRow < 0 || anchor.endCol < 0) return null;
|
|
10045
|
-
const ru = renderManagerService.
|
|
9975
|
+
const ru = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
10046
9976
|
const sheetSkeletonManagerService = ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService);
|
|
10047
|
-
const selectionRenderService = ru === null || ru === void 0 ? void 0 : ru.with(ISheetSelectionRenderService);
|
|
10048
9977
|
const sheetObject = getSheetObject(univerInstanceService, renderManagerService);
|
|
10049
|
-
if (!sheetObject
|
|
9978
|
+
if (!sheetObject) return null;
|
|
10050
9979
|
const { scene } = sheetObject;
|
|
10051
9980
|
const skeleton = sheetSkeletonManagerService === null || sheetSkeletonManagerService === void 0 ? void 0 : sheetSkeletonManagerService.getCurrentSkeleton();
|
|
10052
|
-
const viewport =
|
|
9981
|
+
const viewport = getViewportByCell(anchor.endRow, anchor.endCol, scene, workbook.getActiveSheet());
|
|
9982
|
+
if (!viewport) return null;
|
|
10053
9983
|
const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
|
|
10054
9984
|
const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
|
|
10055
9985
|
const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
|
|
10056
9986
|
const canvas = (_scene$getEngine = scene.getEngine()) === null || _scene$getEngine === void 0 ? void 0 : _scene$getEngine.getCanvas();
|
|
10057
9987
|
if (!scaleX || !scene || !scaleX || !scaleY || !scrollXY) return null;
|
|
10058
9988
|
const endPosition = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getNoMergeCellWithCoordByIndex(anchor.endRow, anchor.endCol);
|
|
10059
|
-
const endX = (
|
|
10060
|
-
const endY = (
|
|
10061
|
-
const positionEndX =
|
|
10062
|
-
const positionEndY =
|
|
9989
|
+
const endX = (endPosition === null || endPosition === void 0 ? void 0 : endPosition.endX) ?? 0;
|
|
9990
|
+
const endY = (endPosition === null || endPosition === void 0 ? void 0 : endPosition.endY) ?? 0;
|
|
9991
|
+
const positionEndX = convertTransformToOffsetX(endX, scaleX, scrollXY) ?? -9999;
|
|
9992
|
+
const positionEndY = convertTransformToOffsetY(endY, scaleY, scrollXY) ?? -9999;
|
|
10063
9993
|
const canvasWidth = canvas === null || canvas === void 0 ? void 0 : canvas.getWidth();
|
|
10064
9994
|
const canvasHeight = canvas === null || canvas === void 0 ? void 0 : canvas.getHeight();
|
|
10065
9995
|
if (!canvasWidth || !canvasHeight) return null;
|
|
@@ -10082,7 +10012,8 @@ const ClipboardPopupMenu = () => {
|
|
|
10082
10012
|
const commandService = useDependency(ICommandService);
|
|
10083
10013
|
const [menuHovered, setMenuHovered] = useState(false);
|
|
10084
10014
|
const [visible, setVisible] = useState(false);
|
|
10085
|
-
const
|
|
10015
|
+
const range = pasteOptionsCache === null || pasteOptionsCache === void 0 ? void 0 : pasteOptionsCache.target.pastedRange;
|
|
10016
|
+
const relativePosition = useMenuPosition(range);
|
|
10086
10017
|
if (!relativePosition || !showMenu) return null;
|
|
10087
10018
|
if (relativePosition.positionX < 50 || relativePosition.positionY < 30) return null;
|
|
10088
10019
|
const showMore = menuHovered || visible;
|
|
@@ -10214,16 +10145,16 @@ const ISheetEmbedInteractionBoundaryService = createIdentifier("sheets-ui.embed-
|
|
|
10214
10145
|
const ISheetEmbedRuntimeFocusCoordinator = createIdentifier("sheets-ui.embed-runtime-focus-coordinator");
|
|
10215
10146
|
const ISheetEmbedFloatingGeometryService = createIdentifier("sheets-ui.embed-floating-geometry.service");
|
|
10216
10147
|
function resolveSheetEmbedRuntimeDomScope(element) {
|
|
10217
|
-
var _element$closest
|
|
10148
|
+
var _element$closest;
|
|
10218
10149
|
if (!element) return;
|
|
10219
|
-
const embedId = (
|
|
10150
|
+
const embedId = ((_element$closest = element.closest(`[${"data-embed-interaction-boundary-owner"}]`)) === null || _element$closest === void 0 ? void 0 : _element$closest.getAttribute("data-embed-interaction-boundary-owner")) ?? void 0;
|
|
10220
10151
|
const container = resolveSheetEmbedFloatDomContainer(element, embedId);
|
|
10221
|
-
const resolvedEmbedId = (
|
|
10152
|
+
const resolvedEmbedId = (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-id")) ?? embedId;
|
|
10222
10153
|
if (!resolvedEmbedId) return;
|
|
10223
10154
|
return {
|
|
10224
10155
|
embedId: resolvedEmbedId,
|
|
10225
|
-
hostUnitId: (
|
|
10226
|
-
childUnitId: (
|
|
10156
|
+
hostUnitId: (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-host-unit-id")) ?? void 0,
|
|
10157
|
+
childUnitId: (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-child-unit-id")) ?? void 0,
|
|
10227
10158
|
childType: readChildType(container)
|
|
10228
10159
|
};
|
|
10229
10160
|
}
|
|
@@ -10233,12 +10164,11 @@ function resolveActiveSheetEmbedRuntimeDomScope(ownerDocument = document) {
|
|
|
10233
10164
|
return resolveSheetEmbedRuntimeDomScope(activeContainer);
|
|
10234
10165
|
}
|
|
10235
10166
|
function resolveSheetEmbedFloatDomContainer(element, embedId) {
|
|
10236
|
-
var _element$ownerDocumen, _ownerDocument$queryS;
|
|
10237
10167
|
const ownContainer = element === null || element === void 0 ? void 0 : element.closest(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"]`);
|
|
10238
10168
|
if (ownContainer && (!embedId || ownContainer.getAttribute("data-embed-id") === embedId)) return ownContainer;
|
|
10239
|
-
const ownerDocument = (
|
|
10240
|
-
if (!ownerDocument || !embedId) return ownContainer
|
|
10241
|
-
return
|
|
10169
|
+
const ownerDocument = (element === null || element === void 0 ? void 0 : element.ownerDocument) ?? (typeof document === "undefined" ? void 0 : document);
|
|
10170
|
+
if (!ownerDocument || !embedId) return ownContainer ?? void 0;
|
|
10171
|
+
return ownerDocument.querySelector(`[${"data-embed-float-dom"}="true"][${"data-embed-id"}="${escapeAttributeValue(embedId)}"]`) ?? void 0;
|
|
10242
10172
|
}
|
|
10243
10173
|
function escapeAttributeValue(value) {
|
|
10244
10174
|
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
@@ -10268,15 +10198,14 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10268
10198
|
return getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
|
|
10269
10199
|
}
|
|
10270
10200
|
get _editingUnitId() {
|
|
10271
|
-
var _this$_editorBridgeSe
|
|
10272
|
-
return (_this$_editorBridgeSe =
|
|
10201
|
+
var _this$_editorBridgeSe;
|
|
10202
|
+
return ((_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.unitId) ?? "";
|
|
10273
10203
|
}
|
|
10274
10204
|
get _editingRenderer() {
|
|
10275
|
-
return this._renderManagerService.
|
|
10205
|
+
return this._renderManagerService.getRenderUnitById(this._editingUnitId);
|
|
10276
10206
|
}
|
|
10277
10207
|
get _renderer() {
|
|
10278
|
-
|
|
10279
|
-
return (_this$_editingRendere = this._editingRenderer) !== null && _this$_editingRendere !== void 0 ? _this$_editingRendere : this._currentRenderer;
|
|
10208
|
+
return this._editingRenderer ?? this._currentRenderer;
|
|
10280
10209
|
}
|
|
10281
10210
|
get _sheetSkeletonManagerService() {
|
|
10282
10211
|
var _this$_renderer;
|
|
@@ -10287,7 +10216,6 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10287
10216
|
return (_this$_renderer2 = this._renderer) === null || _this$_renderer2 === void 0 ? void 0 : _this$_renderer2.engine;
|
|
10288
10217
|
}
|
|
10289
10218
|
fitTextSize(callback) {
|
|
10290
|
-
var _paddingData$l, _paddingData$r, _paddingData$t, _paddingData$b;
|
|
10291
10219
|
const param = this._editorBridgeService.getEditCellState();
|
|
10292
10220
|
if (!param) return;
|
|
10293
10221
|
const { position, documentLayoutObject, canvasOffset, scaleX, scaleY } = param;
|
|
@@ -10301,8 +10229,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10301
10229
|
if (!info || info.actualWidth <= 0) return;
|
|
10302
10230
|
let { actualWidth, actualHeight } = info;
|
|
10303
10231
|
const { verticalAlign, horizontalAlign, paddingData, fill } = documentLayoutObject;
|
|
10304
|
-
actualWidth = actualWidth + (
|
|
10305
|
-
actualHeight = actualHeight + (
|
|
10232
|
+
actualWidth = actualWidth + (paddingData.l ?? 0) * scaleX + (paddingData.r ?? 0) * scaleX;
|
|
10233
|
+
actualHeight = actualHeight + (paddingData.t ?? 0) * scaleY + (paddingData.b ?? 0) * scaleY;
|
|
10306
10234
|
let editorWidth = endX - startX;
|
|
10307
10235
|
let editorHeight = endY - startY;
|
|
10308
10236
|
if (editorWidth < actualWidth) editorWidth = Math.ceil(actualWidth);
|
|
@@ -10368,8 +10296,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10368
10296
|
_getEditorMaxSize(position, canvasOffset, horizontalAlign) {
|
|
10369
10297
|
if (this._getEditorObject() == null) return;
|
|
10370
10298
|
function pxToNum(size) {
|
|
10371
|
-
|
|
10372
|
-
return Number.parseFloat((_size$replace = size === null || size === void 0 ? void 0 : size.replace("px", "")) !== null && _size$replace !== void 0 ? _size$replace : "");
|
|
10299
|
+
return Number.parseFloat((size === null || size === void 0 ? void 0 : size.replace("px", "")) ?? "");
|
|
10373
10300
|
}
|
|
10374
10301
|
const engine = this.engine;
|
|
10375
10302
|
if (!engine) return;
|
|
@@ -10470,8 +10397,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10470
10397
|
});
|
|
10471
10398
|
}
|
|
10472
10399
|
_getEditorContentElement() {
|
|
10473
|
-
var _this$_embedFloatingG
|
|
10474
|
-
return (_this$_embedFloatingG =
|
|
10400
|
+
var _this$_embedFloatingG;
|
|
10401
|
+
return ((_this$_embedFloatingG = this._embedFloatingGeometryService) === null || _this$_embedFloatingG === void 0 || (_this$_embedFloatingG = _this$_embedFloatingG.getRegistrationByChildUnitId(this._editingUnitId)) === null || _this$_embedFloatingG === void 0 ? void 0 : _this$_embedFloatingG.contentRoot) ?? this._layoutService.getContentElement();
|
|
10475
10402
|
}
|
|
10476
10403
|
/**
|
|
10477
10404
|
* Since the document does not support cell background color, an additional rect needs to be added.
|
|
@@ -10526,7 +10453,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10526
10453
|
}
|
|
10527
10454
|
_getEditorSkeleton() {
|
|
10528
10455
|
var _this$_renderManagerS;
|
|
10529
|
-
return (_this$_renderManagerS = this._renderManagerService.
|
|
10456
|
+
return (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService).getSkeleton();
|
|
10530
10457
|
}
|
|
10531
10458
|
};
|
|
10532
10459
|
SheetCellEditorResizeService = __decorate([
|
|
@@ -10624,7 +10551,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10624
10551
|
var _this$_renderManagerS;
|
|
10625
10552
|
if (this._editorBridgeService.isVisible().visible) return;
|
|
10626
10553
|
const layout = this._editorBridgeService.getEditCellLayout();
|
|
10627
|
-
const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.
|
|
10554
|
+
const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSelectionRenderService);
|
|
10628
10555
|
if (!layout || !docSelectionRenderService) return;
|
|
10629
10556
|
const { position, canvasOffset } = layout;
|
|
10630
10557
|
docSelectionRenderService.setInputPosition(canvasOffset.left + position.startX, canvasOffset.top + position.startY);
|
|
@@ -10686,7 +10613,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10686
10613
|
d.add(disposable);
|
|
10687
10614
|
}
|
|
10688
10615
|
};
|
|
10689
|
-
const render = this._renderManagerService.
|
|
10616
|
+
const render = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
10690
10617
|
if (render) addEvent(render);
|
|
10691
10618
|
else this.disposeWithMe(this._renderManagerService.created$.pipe(filter((render) => render.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY)).subscribe((render) => {
|
|
10692
10619
|
disposable === null || disposable === void 0 || disposable.dispose();
|
|
@@ -10700,7 +10627,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10700
10627
|
}));
|
|
10701
10628
|
}
|
|
10702
10629
|
_focusCellEditorInput() {
|
|
10703
|
-
const render = this._renderManagerService.
|
|
10630
|
+
const render = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
10704
10631
|
const docSelectionRenderService = render === null || render === void 0 ? void 0 : render.with(DocSelectionRenderService);
|
|
10705
10632
|
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
10706
10633
|
}
|
|
@@ -10718,10 +10645,9 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10718
10645
|
}));
|
|
10719
10646
|
}
|
|
10720
10647
|
_showEditorByKeyboard(config) {
|
|
10721
|
-
var _ref, _config$content;
|
|
10722
10648
|
const event = config === null || config === void 0 ? void 0 : config.event;
|
|
10723
10649
|
if (config == null || !event.data && event.inputType !== "InsertParagraph") return;
|
|
10724
|
-
const initialValue =
|
|
10650
|
+
const initialValue = config.content ?? event.data ?? "";
|
|
10725
10651
|
this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
10726
10652
|
visible: true,
|
|
10727
10653
|
eventType: DeviceInputEventType.Keyboard,
|
|
@@ -11498,7 +11424,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11498
11424
|
unitId: this._editingUnit
|
|
11499
11425
|
});
|
|
11500
11426
|
if (!unit) return;
|
|
11501
|
-
const editorBridgeRenderController = (_this$_renderManagerS = this._renderManagerService.
|
|
11427
|
+
const editorBridgeRenderController = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unit.getUnitId())) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(EditorBridgeRenderController);
|
|
11502
11428
|
if (editorBridgeRenderController) editorBridgeRenderController.refreshEditorPosition();
|
|
11503
11429
|
}
|
|
11504
11430
|
}));
|
|
@@ -11528,10 +11454,9 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11528
11454
|
_initialCursorSync(d) {
|
|
11529
11455
|
d.add(this._cellEditorManagerService.focus$.pipe(filter((f) => !!f)).subscribe(() => {
|
|
11530
11456
|
var _this$_univerInstance, _this$_renderManagerS2;
|
|
11531
|
-
const
|
|
11532
|
-
const docUnitId = editorId !== null && editorId !== void 0 ? editorId : (_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
|
|
11457
|
+
const docUnitId = (this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) ? DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : this._editorBridgeService.getCurrentEditorId()) ?? ((_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId());
|
|
11533
11458
|
if (!docUnitId) return;
|
|
11534
|
-
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.
|
|
11459
|
+
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(docUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
|
|
11535
11460
|
if (!docSelectionRenderManager) return;
|
|
11536
11461
|
docSelectionRenderManager.sync();
|
|
11537
11462
|
}));
|
|
@@ -11595,7 +11520,6 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11595
11520
|
unitId: editorUnitId,
|
|
11596
11521
|
snapshot: documentModel.getSnapshot()
|
|
11597
11522
|
});
|
|
11598
|
-
this._contextService.setContextValue(FOCUSING_EDITOR_BUT_HIDDEN, true);
|
|
11599
11523
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11600
11524
|
startOffset: 0,
|
|
11601
11525
|
endOffset: 0
|
|
@@ -11603,8 +11527,8 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11603
11527
|
unitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
11604
11528
|
subUnitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
11605
11529
|
});
|
|
11606
|
-
const cellSelectionRenderManager = (_this$_renderManagerS3 = this._renderManagerService.
|
|
11607
|
-
const formulaSelectionRenderManager = (_this$_renderManagerS4 = this._renderManagerService.
|
|
11530
|
+
const cellSelectionRenderManager = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(DocSelectionRenderService);
|
|
11531
|
+
const formulaSelectionRenderManager = (_this$_renderManagerS4 = this._renderManagerService.getRenderUnitById(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS4 === void 0 ? void 0 : _this$_renderManagerS4.with(DocSelectionRenderService);
|
|
11608
11532
|
if ((cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 ? void 0 : cellSelectionRenderManager.canFocusing) || (formulaSelectionRenderManager === null || formulaSelectionRenderManager === void 0 ? void 0 : formulaSelectionRenderManager.canFocusing)) {
|
|
11609
11533
|
this._univerInstanceService.setCurrentUnitForType(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
11610
11534
|
cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 || cellSelectionRenderManager.activate(HIDDEN_EDITOR_POSITION$1, HIDDEN_EDITOR_POSITION$1, true);
|
|
@@ -11692,17 +11616,17 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11692
11616
|
subUnitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
11693
11617
|
});
|
|
11694
11618
|
};
|
|
11695
|
-
const
|
|
11696
|
-
this._submitEmptyCellImageEdit =
|
|
11697
|
-
if (
|
|
11619
|
+
const cellImage = isCellImage(documentDataModel.getSnapshot());
|
|
11620
|
+
this._submitEmptyCellImageEdit = cellImage && eventType === DeviceInputEventType.Keyboard && keycode === KeyCode.BACKSPACE;
|
|
11621
|
+
if (cellImage) clearAndEdit();
|
|
11698
11622
|
else if (eventType === DeviceInputEventType.Keyboard && keycode === KeyCode.F2) {
|
|
11699
|
-
var _documentDataModel$ge
|
|
11623
|
+
var _documentDataModel$ge;
|
|
11700
11624
|
document.makeDirty();
|
|
11701
11625
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11702
11626
|
startOffset: 0,
|
|
11703
11627
|
endOffset: 0
|
|
11704
11628
|
}]);
|
|
11705
|
-
const endOffset = ((_documentDataModel$ge =
|
|
11629
|
+
const endOffset = (((_documentDataModel$ge = documentDataModel.getBody()) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.dataStream.length) ?? 2) - 2;
|
|
11706
11630
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11707
11631
|
startOffset: endOffset,
|
|
11708
11632
|
endOffset
|
|
@@ -11719,7 +11643,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11719
11643
|
endOffset: cursor
|
|
11720
11644
|
}]);
|
|
11721
11645
|
}
|
|
11722
|
-
(_this$_renderManagerS5 = this._renderManagerService.
|
|
11646
|
+
(_this$_renderManagerS5 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS5 === void 0 || _this$_renderManagerS5.scene.resetCursor();
|
|
11723
11647
|
}
|
|
11724
11648
|
_refreshCurrentSelections(sheetId) {
|
|
11725
11649
|
const selections = this._workbookSelections.getSelectionsOfWorksheet(sheetId);
|
|
@@ -11733,7 +11657,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11733
11657
|
}
|
|
11734
11658
|
}
|
|
11735
11659
|
async _handleEditorInvisible(param) {
|
|
11736
|
-
var
|
|
11660
|
+
var _snapshot$body;
|
|
11737
11661
|
const editCellState = this._editorBridgeService.getEditCellState();
|
|
11738
11662
|
const documentDataModel = this._univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
11739
11663
|
const snapshot = Tools.deepClone(documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getSnapshot());
|
|
@@ -11741,7 +11665,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11741
11665
|
const shouldSubmitEmptyCellImageEdit = this._submitEmptyCellImageEdit;
|
|
11742
11666
|
this._submitEmptyCellImageEdit = false;
|
|
11743
11667
|
this._cursorChange = 0;
|
|
11744
|
-
const currentUnitId = (
|
|
11668
|
+
const currentUnitId = (editCellState === null || editCellState === void 0 ? void 0 : editCellState.unitId) ?? "";
|
|
11745
11669
|
this._exitInput(param);
|
|
11746
11670
|
if (editCellState == null) return;
|
|
11747
11671
|
const workbook = this._univerInstanceService.getUnit(currentUnitId, UniverInstanceType.UNIVER_SHEET);
|
|
@@ -11763,10 +11687,10 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11763
11687
|
return;
|
|
11764
11688
|
}
|
|
11765
11689
|
const isEmpty = (snapshot === null || snapshot === void 0 || (_snapshot$body = snapshot.body) === null || _snapshot$body === void 0 ? void 0 : _snapshot$body.dataStream.length) === 2;
|
|
11766
|
-
const
|
|
11690
|
+
const cellImage = editCellState.documentLayoutObject.documentModel ? isCellImage(editCellState.documentLayoutObject.documentModel.getSnapshot()) : false;
|
|
11767
11691
|
if (snapshot && shouldSubmitCellEdit({
|
|
11768
11692
|
isEmpty,
|
|
11769
|
-
isCellImage,
|
|
11693
|
+
isCellImage: cellImage,
|
|
11770
11694
|
shouldSubmitEmptyCellImageEdit
|
|
11771
11695
|
})) {
|
|
11772
11696
|
if (await this._submitEdit(snapshot, keycode === (MetaKeys.CTRL_COMMAND | KeyCode.ENTER) || keycode === (MetaKeys.MAC_CTRL | KeyCode.ENTER)) === false) return;
|
|
@@ -11776,10 +11700,6 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11776
11700
|
_getEditorObject() {
|
|
11777
11701
|
return getEditorObject(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
|
|
11778
11702
|
}
|
|
11779
|
-
_isCellImageData(snapshot) {
|
|
11780
|
-
var _snapshot$drawingsOrd, _snapshot$drawingsOrd2;
|
|
11781
|
-
return ((_snapshot$drawingsOrd = (_snapshot$drawingsOrd2 = snapshot.drawingsOrder) === null || _snapshot$drawingsOrd2 === void 0 ? void 0 : _snapshot$drawingsOrd2.length) !== null && _snapshot$drawingsOrd !== void 0 ? _snapshot$drawingsOrd : 0) > 0;
|
|
11782
|
-
}
|
|
11783
11703
|
submitCellData(documentDataModel) {
|
|
11784
11704
|
return this._submitEdit(documentDataModel.getSnapshot());
|
|
11785
11705
|
}
|
|
@@ -11832,7 +11752,6 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11832
11752
|
var _editorObject$scene$g;
|
|
11833
11753
|
this._contextService.setContextValue(FOCUSING_EDITOR_INPUT_FORMULA, false);
|
|
11834
11754
|
this._contextService.setContextValue(EDITOR_ACTIVATED, false);
|
|
11835
|
-
this._contextService.setContextValue(FOCUSING_EDITOR_BUT_HIDDEN, false);
|
|
11836
11755
|
this._contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, false);
|
|
11837
11756
|
this._cellEditorManagerService.setState({ show: param.visible });
|
|
11838
11757
|
const formulaBarEditor = this._editorService.getEditor(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
@@ -11911,11 +11830,11 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11911
11830
|
}
|
|
11912
11831
|
_getEditorSkeleton(editorId) {
|
|
11913
11832
|
var _this$_renderManagerS6;
|
|
11914
|
-
return (_this$_renderManagerS6 = this._renderManagerService.
|
|
11833
|
+
return (_this$_renderManagerS6 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS6 === void 0 ? void 0 : _this$_renderManagerS6.with(DocSkeletonManagerService).getSkeleton();
|
|
11915
11834
|
}
|
|
11916
11835
|
_getEditorViewModel(editorId) {
|
|
11917
11836
|
var _this$_renderManagerS7;
|
|
11918
|
-
return (_this$_renderManagerS7 = this._renderManagerService.
|
|
11837
|
+
return (_this$_renderManagerS7 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS7 === void 0 ? void 0 : _this$_renderManagerS7.with(DocSkeletonManagerService).getViewModel();
|
|
11919
11838
|
}
|
|
11920
11839
|
_getEditingUnit() {
|
|
11921
11840
|
return this._editingUnit ? this._univerInstanceService.getUnit(this._editingUnit, UniverInstanceType.UNIVER_SHEET) : null;
|
|
@@ -11957,7 +11876,7 @@ EditingRenderController = __decorate([
|
|
|
11957
11876
|
__decorateParam(15, IConfigService)
|
|
11958
11877
|
], EditingRenderController);
|
|
11959
11878
|
function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService, functionService, styles) {
|
|
11960
|
-
var
|
|
11879
|
+
var _styles$get;
|
|
11961
11880
|
if ((snapshot === null || snapshot === void 0 ? void 0 : snapshot.body) == null) return null;
|
|
11962
11881
|
const { body } = snapshot;
|
|
11963
11882
|
cellData.t = void 0;
|
|
@@ -11965,7 +11884,7 @@ function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService,
|
|
|
11965
11884
|
let newDataStream = data.substring(data.length - 2, data.length) === DEFAULT_EMPTY_DOCUMENT_VALUE ? data.substring(0, data.length - 2) : data;
|
|
11966
11885
|
const currentLocale = localeService.getCurrentLocale();
|
|
11967
11886
|
newDataStream = normalizeString(newDataStream, lexerTreeBuilder, currentLocale, functionService);
|
|
11968
|
-
if ((
|
|
11887
|
+
if (isCellImage(snapshot)) {
|
|
11969
11888
|
cellData.v = "";
|
|
11970
11889
|
cellData.f = null;
|
|
11971
11890
|
cellData.si = null;
|
|
@@ -12021,10 +11940,9 @@ function isRichText(body) {
|
|
|
12021
11940
|
const bodyNoLineBreak = body.dataStream.replace(/(\r\n)+$/, "");
|
|
12022
11941
|
const richTextStyle = ["va"];
|
|
12023
11942
|
return textRuns.filter((ts) => ts.st < bodyNoLineBreak.length).some((textRun) => {
|
|
12024
|
-
var _textRun$ts;
|
|
12025
11943
|
return Boolean(textRun.ts && Object.keys(textRun.ts).some((property) => {
|
|
12026
11944
|
return richTextStyle.includes(property);
|
|
12027
|
-
})) || Object.keys(
|
|
11945
|
+
})) || Object.keys(textRun.ts ?? {}).length && textRun.ed - textRun.st < bodyNoLineBreak.length;
|
|
12028
11946
|
}) || paragraphs.some((paragraph) => paragraph.bullet) || paragraphs.length >= 2 || Boolean(customRanges === null || customRanges === void 0 ? void 0 : customRanges.length) || customBlocks.length > 0;
|
|
12029
11947
|
}
|
|
12030
11948
|
function shouldSubmitCellEdit({ isEmpty, isCellImage, shouldSubmitEmptyCellImageEdit }) {
|
|
@@ -12153,9 +12071,9 @@ function getSetCellDataMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12153
12071
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12154
12072
|
const cellValueMatrix = new ObjectMatrix();
|
|
12155
12073
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12156
|
-
var _value$
|
|
12074
|
+
var _value$p, _newStyle$n;
|
|
12157
12075
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12158
|
-
const newStyle = { ...
|
|
12076
|
+
const newStyle = { ...value.s ?? {} };
|
|
12159
12077
|
if (newStyle.bd && Object.keys(newStyle.bd).length === 0) newStyle.bd = {
|
|
12160
12078
|
t: null,
|
|
12161
12079
|
r: null,
|
|
@@ -12216,7 +12134,7 @@ function getSetCellValueMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12216
12134
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12217
12135
|
const cellValueMatrix = new ObjectMatrix();
|
|
12218
12136
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12219
|
-
var _value$p2, _value$
|
|
12137
|
+
var _value$p2, _value$s;
|
|
12220
12138
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12221
12139
|
let cellValue = {
|
|
12222
12140
|
p: null,
|
|
@@ -12227,7 +12145,7 @@ function getSetCellValueMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12227
12145
|
p: value.p,
|
|
12228
12146
|
v: value.v
|
|
12229
12147
|
};
|
|
12230
|
-
else if (value.v && !pasteFrom && !((_value$
|
|
12148
|
+
else if (value.v && !pasteFrom && !((_value$s = value.s) === null || _value$s === void 0 || (_value$s = _value$s.n) === null || _value$s === void 0 ? void 0 : _value$s.pattern)) {
|
|
12231
12149
|
/**
|
|
12232
12150
|
* The `pasteFrom` is null, means the data is pasted from outside.
|
|
12233
12151
|
* If the value's style has no number format, handle it as follows:
|
|
@@ -12269,9 +12187,9 @@ function getSetCellStyleMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12269
12187
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12270
12188
|
const cellValueMatrix = new ObjectMatrix();
|
|
12271
12189
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12272
|
-
var
|
|
12190
|
+
var _newStyle$n2;
|
|
12273
12191
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12274
|
-
const newStyle = { ...
|
|
12192
|
+
const newStyle = { ...value.s ?? {} };
|
|
12275
12193
|
if (newStyle.bd && Object.keys(newStyle.bd).length === 0) newStyle.bd = {
|
|
12276
12194
|
t: null,
|
|
12277
12195
|
r: null,
|
|
@@ -12486,12 +12404,12 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12486
12404
|
if (event.event.key === "Escape") this._sheetClipboardService.removeMarkSelection();
|
|
12487
12405
|
});
|
|
12488
12406
|
};
|
|
12489
|
-
let docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.
|
|
12407
|
+
let docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSelectionRenderService);
|
|
12490
12408
|
if (docSelectionRenderService) sheetPasteShortKeyFn(docSelectionRenderService);
|
|
12491
12409
|
this._renderManagerService.created$.subscribe((renderer) => {
|
|
12492
12410
|
if (renderer.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
|
|
12493
12411
|
var _this$_renderManagerS2;
|
|
12494
|
-
docSelectionRenderService = (_this$_renderManagerS2 = this._renderManagerService.
|
|
12412
|
+
docSelectionRenderService = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
|
|
12495
12413
|
if (docSelectionRenderService) sheetPasteShortKeyFn(docSelectionRenderService);
|
|
12496
12414
|
}
|
|
12497
12415
|
});
|
|
@@ -12716,11 +12634,9 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12716
12634
|
};
|
|
12717
12635
|
}
|
|
12718
12636
|
_generateDocumentDataModelSnapshot(snapshot) {
|
|
12719
|
-
var _withCurrentTypeOfRen
|
|
12720
|
-
|
|
12721
|
-
|
|
12722
|
-
const { skeleton } = currentSkeleton;
|
|
12723
|
-
const documentModel = (_skeleton$getBlankCel = skeleton.getBlankCellDocumentModel()) === null || _skeleton$getBlankCel === void 0 ? void 0 : _skeleton$getBlankCel.documentModel;
|
|
12637
|
+
var _withCurrentTypeOfRen;
|
|
12638
|
+
if (((_withCurrentTypeOfRen = withCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService, this._instanceService, this._renderManagerService)) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.getCurrentParam()) == null) return null;
|
|
12639
|
+
const documentModel = createDocumentModelWithStyle("", {});
|
|
12724
12640
|
const documentData = {
|
|
12725
12641
|
...documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot(),
|
|
12726
12642
|
...snapshot
|
|
@@ -12825,7 +12741,6 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12825
12741
|
};
|
|
12826
12742
|
},
|
|
12827
12743
|
onPasteColumns(pasteTo, colProperties, payload) {
|
|
12828
|
-
var _self$_configService$;
|
|
12829
12744
|
const redos = [];
|
|
12830
12745
|
const undos = [];
|
|
12831
12746
|
if (payload.pasteType !== PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_COL_WIDTH) return {
|
|
@@ -12839,7 +12754,7 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12839
12754
|
undos
|
|
12840
12755
|
};
|
|
12841
12756
|
const worksheet = self._getWorksheet(unitId, subUnitId);
|
|
12842
|
-
const defaultColumnWidth =
|
|
12757
|
+
const defaultColumnWidth = self._configService.getConfig(DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY) ?? DEFAULT_WORKSHEET_COLUMN_WIDTH;
|
|
12843
12758
|
const pasteRangeStartRow = rows[0];
|
|
12844
12759
|
const pasteRangeEndRow = rows[rows.length - 1];
|
|
12845
12760
|
const pasteRangeStartColumn = cols[0];
|
|
@@ -12900,7 +12815,7 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12900
12815
|
const setValuesMutation = {
|
|
12901
12816
|
unitId,
|
|
12902
12817
|
subUnitId,
|
|
12903
|
-
cellValue: valueMatrix.
|
|
12818
|
+
cellValue: valueMatrix.clone()
|
|
12904
12819
|
};
|
|
12905
12820
|
redoMutationsInfo.push({
|
|
12906
12821
|
id: SetRangeValuesMutation.id,
|
|
@@ -12926,7 +12841,7 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12926
12841
|
}
|
|
12927
12842
|
_getWorksheet(unitId, subUnitId) {
|
|
12928
12843
|
var _this$_instanceServic;
|
|
12929
|
-
const worksheet = (_this$_instanceServic = this._instanceService.
|
|
12844
|
+
const worksheet = (_this$_instanceServic = this._instanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_instanceServic === void 0 ? void 0 : _this$_instanceServic.getSheetBySheetId(subUnitId);
|
|
12930
12845
|
if (!worksheet) throw new Error(`[SheetClipboardController]: cannot find a worksheet with unitId ${unitId} and subUnitId ${subUnitId}.`);
|
|
12931
12846
|
return worksheet;
|
|
12932
12847
|
}
|
|
@@ -13005,7 +12920,7 @@ let DragManagerService = class DragManagerService extends Disposable {
|
|
|
13005
12920
|
if (!workbook) return null;
|
|
13006
12921
|
const worksheet = workbook.getActiveSheet();
|
|
13007
12922
|
if (!worksheet) return;
|
|
13008
|
-
const currentRender = this._renderManagerService.
|
|
12923
|
+
const currentRender = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13009
12924
|
if (!currentRender) return;
|
|
13010
12925
|
const skeletonParam = currentRender.with(SheetSkeletonManagerService).getCurrentParam();
|
|
13011
12926
|
const scrollInfo = currentRender.with(SheetScrollManagerService).getCurrentScrollState();
|
|
@@ -13178,7 +13093,7 @@ let FormulaEditorController = class FormulaEditorController extends RxDisposable
|
|
|
13178
13093
|
}
|
|
13179
13094
|
_create(unitId) {
|
|
13180
13095
|
if (unitId !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) return;
|
|
13181
|
-
const formulaEditorDocObject = this._renderManagerService.
|
|
13096
|
+
const formulaEditorDocObject = this._renderManagerService.getRenderUnitById(unitId);
|
|
13182
13097
|
if (formulaEditorDocObject == null) return;
|
|
13183
13098
|
const { mainComponent: documentComponent } = formulaEditorDocObject;
|
|
13184
13099
|
if (documentComponent == null) return;
|
|
@@ -13186,7 +13101,7 @@ let FormulaEditorController = class FormulaEditorController extends RxDisposable
|
|
|
13186
13101
|
}
|
|
13187
13102
|
_listenFxBtnClick() {
|
|
13188
13103
|
this._formulaEditorManagerService.fxBtnClick$.pipe(takeUntil(this.dispose$)).subscribe(() => {
|
|
13189
|
-
if (this._contextService.getContextValue(
|
|
13104
|
+
if (this._contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && !this._contextService.getContextValue(EDITOR_ACTIVATED)) {
|
|
13190
13105
|
var _formulaEditorDataMod;
|
|
13191
13106
|
this._univerInstanceService.setCurrentUnitForType(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
13192
13107
|
const formulaEditorDataModel = this._univerInstanceService.getUnit(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
|
|
@@ -13246,8 +13161,8 @@ let FormulaEditorController = class FormulaEditorController extends RxDisposable
|
|
|
13246
13161
|
autoScroll() {
|
|
13247
13162
|
var _this$_renderManagerS;
|
|
13248
13163
|
const position = this._formulaEditorManagerService.getPosition();
|
|
13249
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
13250
|
-
const editorObject = this._renderManagerService.
|
|
13164
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService).getSkeleton();
|
|
13165
|
+
const editorObject = this._renderManagerService.getRenderUnitById(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
13251
13166
|
const formulaEditorDataModel = this._univerInstanceService.getUnit(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
|
|
13252
13167
|
if (skeleton == null || position == null || editorObject == null || formulaEditorDataModel == null) return;
|
|
13253
13168
|
const { marginTop = 0, marginBottom = 0 } = formulaEditorDataModel.getSnapshot().documentStyle;
|
|
@@ -13320,8 +13235,8 @@ const calcDocRangePositions = (range, skeleton) => {
|
|
|
13320
13235
|
const skeletonData = skeleton.getSkeletonData();
|
|
13321
13236
|
let end = range.endOffset;
|
|
13322
13237
|
if (range.segmentId) {
|
|
13323
|
-
var
|
|
13324
|
-
const root =
|
|
13238
|
+
var _skeletonData$skeFoot, _skeletonData$skeHead;
|
|
13239
|
+
const root = Array.from((skeletonData === null || skeletonData === void 0 || (_skeletonData$skeFoot = skeletonData.skeFooters.get(range.segmentId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.values()) ?? [])[0] ?? Array.from((skeletonData === null || skeletonData === void 0 || (_skeletonData$skeHead = skeletonData.skeHeaders.get(range.segmentId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.values()) ?? [])[0];
|
|
13325
13240
|
if (root) end = Math.min(root.ed, end);
|
|
13326
13241
|
}
|
|
13327
13242
|
const endPosition = skeleton.findNodePositionByCharIndex(end, true, range.segmentId, pageIndex);
|
|
@@ -13402,13 +13317,13 @@ const calcBulletPosition = (skeleton, paragraph, paddingLeft = 0, paddingTop = 0
|
|
|
13402
13317
|
};
|
|
13403
13318
|
};
|
|
13404
13319
|
const calculateDocSkeletonRects = (docSkeleton, paddingLeft = 0, paddingTop = 0) => {
|
|
13405
|
-
var _docModel$getBody
|
|
13320
|
+
var _docModel$getBody, _docModel$getBody2, _docSkeleton$getSkele;
|
|
13406
13321
|
const docModel = docSkeleton.getViewModel().getDataModel();
|
|
13407
|
-
const hyperLinks = (
|
|
13408
|
-
const checkLists = (
|
|
13322
|
+
const hyperLinks = ((_docModel$getBody = docModel.getBody()) === null || _docModel$getBody === void 0 || (_docModel$getBody = _docModel$getBody.customRanges) === null || _docModel$getBody === void 0 ? void 0 : _docModel$getBody.filter((range) => range.rangeType === CustomRangeType.HYPERLINK)) ?? [];
|
|
13323
|
+
const checkLists = ((_docModel$getBody2 = docModel.getBody()) === null || _docModel$getBody2 === void 0 || (_docModel$getBody2 = _docModel$getBody2.paragraphs) === null || _docModel$getBody2 === void 0 ? void 0 : _docModel$getBody2.filter((p) => {
|
|
13409
13324
|
var _p$bullet;
|
|
13410
13325
|
return ((_p$bullet = p.bullet) === null || _p$bullet === void 0 ? void 0 : _p$bullet.listType.indexOf(PresetListType.CHECK_LIST)) === 0;
|
|
13411
|
-
}))
|
|
13326
|
+
})) ?? [];
|
|
13412
13327
|
const drawings = (_docSkeleton$getSkele = docSkeleton.getSkeletonData()) === null || _docSkeleton$getSkele === void 0 ? void 0 : _docSkeleton$getSkele.pages[0].skeDrawings;
|
|
13413
13328
|
return {
|
|
13414
13329
|
links: hyperLinks.map((link) => calcLinkPosition(docSkeleton, link, paddingLeft, paddingTop)).filter(Boolean),
|
|
@@ -13426,9 +13341,9 @@ const calculateDocSkeletonRects = (docSkeleton, paddingLeft = 0, paddingTop = 0)
|
|
|
13426
13341
|
};
|
|
13427
13342
|
};
|
|
13428
13343
|
function calcPadding(cell, font, isNum) {
|
|
13429
|
-
var _font$documentSkeleto, _font$documentSkeleto2
|
|
13430
|
-
const height = (_font$documentSkeleto =
|
|
13431
|
-
const width = (
|
|
13344
|
+
var _font$documentSkeleto, _font$documentSkeleto2;
|
|
13345
|
+
const height = ((_font$documentSkeleto = font.documentSkeleton) === null || _font$documentSkeleto === void 0 || (_font$documentSkeleto = _font$documentSkeleto.getSkeletonData()) === null || _font$documentSkeleto === void 0 ? void 0 : _font$documentSkeleto.pages[0].height) ?? 0;
|
|
13346
|
+
const width = ((_font$documentSkeleto2 = font.documentSkeleton) === null || _font$documentSkeleto2 === void 0 || (_font$documentSkeleto2 = _font$documentSkeleto2.getSkeletonData()) === null || _font$documentSkeleto2 === void 0 ? void 0 : _font$documentSkeleto2.pages[0].width) ?? 0;
|
|
13432
13347
|
const vt = font.verticalAlign;
|
|
13433
13348
|
const ht = font.horizontalAlign;
|
|
13434
13349
|
let paddingTop = 0;
|
|
@@ -13461,14 +13376,14 @@ function calcPadding(cell, font, isNum) {
|
|
|
13461
13376
|
};
|
|
13462
13377
|
}
|
|
13463
13378
|
const getCustomRangePosition = (injector, unitId, subUnitId, row, col, rangeId) => {
|
|
13464
|
-
var _docSkeleton$getViewM
|
|
13379
|
+
var _docSkeleton$getViewM;
|
|
13465
13380
|
const univerInstanceService = injector.get(IUniverInstanceService);
|
|
13466
13381
|
const renderManagerService = injector.get(IRenderManagerService);
|
|
13467
13382
|
const workbook = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
13468
13383
|
if (!workbook) return null;
|
|
13469
13384
|
const worksheet = workbook.getSheetBySheetId(subUnitId);
|
|
13470
13385
|
if (!worksheet) return null;
|
|
13471
|
-
const currentRender = renderManagerService.
|
|
13386
|
+
const currentRender = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13472
13387
|
const skeletonParam = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).getSkeletonParam(worksheet.getSheetId());
|
|
13473
13388
|
const skeleton = skeletonParam === null || skeletonParam === void 0 ? void 0 : skeletonParam.skeleton;
|
|
13474
13389
|
if (!skeleton || !currentRender) return;
|
|
@@ -13487,7 +13402,7 @@ const getCustomRangePosition = (injector, unitId, subUnitId, row, col, rangeId)
|
|
|
13487
13402
|
});
|
|
13488
13403
|
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualColumn);
|
|
13489
13404
|
const cellData = worksheet.getCell(actualCell.actualRow, actualCell.actualColumn);
|
|
13490
|
-
const { topOffset = 0, leftOffset = 0 } = (
|
|
13405
|
+
const { topOffset = 0, leftOffset = 0 } = (cellData === null || cellData === void 0 ? void 0 : cellData.fontRenderExtension) ?? {};
|
|
13491
13406
|
const { paddingLeft, paddingTop } = calcPadding(actualCell, font, false);
|
|
13492
13407
|
const rects = calcDocRangePositions({
|
|
13493
13408
|
startOffset: customRange.startIndex,
|
|
@@ -13514,8 +13429,8 @@ const getEditingCustomRangePosition = (injector, unitId, subUnitId, row, col, ra
|
|
|
13514
13429
|
const { editorUnitId, unitId: editingUnitId, sheetId, row: editRow, column: editCol } = state;
|
|
13515
13430
|
if (unitId !== editingUnitId || subUnitId !== sheetId || editRow !== row || editCol !== col) return null;
|
|
13516
13431
|
const renderManagerService = injector.get(IRenderManagerService);
|
|
13517
|
-
const renderer = renderManagerService.
|
|
13518
|
-
const sheetRenderer = renderManagerService.
|
|
13432
|
+
const renderer = renderManagerService.getRenderUnitById(editorUnitId);
|
|
13433
|
+
const sheetRenderer = renderManagerService.getRenderUnitById(unitId);
|
|
13519
13434
|
if (!renderer || !sheetRenderer) return null;
|
|
13520
13435
|
const docSkeleton = renderer.with(DocSkeletonManagerService).getSkeleton();
|
|
13521
13436
|
const sheetSkeleton = (_sheetRenderer$with$g = sheetRenderer.with(SheetSkeletonManagerService).getSkeletonParam(sheetId)) === null || _sheetRenderer$with$g === void 0 ? void 0 : _sheetRenderer$with$g.skeleton;
|
|
@@ -13547,6 +13462,33 @@ function getLocationBase(location) {
|
|
|
13547
13462
|
const { workbook, worksheet, ...locBase } = location;
|
|
13548
13463
|
return locBase;
|
|
13549
13464
|
}
|
|
13465
|
+
function calculateCellDrawingRects(font, cell, drawings) {
|
|
13466
|
+
var _font$documentSkeleto;
|
|
13467
|
+
const drawingData = (_font$documentSkeleto = font.documentSkeleton) === null || _font$documentSkeleto === void 0 ? void 0 : _font$documentSkeleto.getViewModel().getDataModel().getDrawings();
|
|
13468
|
+
const cellRect = {
|
|
13469
|
+
left: 0,
|
|
13470
|
+
top: 0,
|
|
13471
|
+
right: cell.mergeInfo.endX - cell.mergeInfo.startX,
|
|
13472
|
+
bottom: cell.mergeInfo.endY - cell.mergeInfo.startY
|
|
13473
|
+
};
|
|
13474
|
+
return drawings.map((drawing) => {
|
|
13475
|
+
var _drawingOrigin$docTra, _drawingOrigin$docTra2, _font$style;
|
|
13476
|
+
const drawingOrigin = drawingData === null || drawingData === void 0 ? void 0 : drawingData[drawing.drawingId];
|
|
13477
|
+
const imageWidth = (drawingOrigin === null || drawingOrigin === void 0 || (_drawingOrigin$docTra = drawingOrigin.docTransform) === null || _drawingOrigin$docTra === void 0 ? void 0 : _drawingOrigin$docTra.size.width) ?? drawing.drawing.width;
|
|
13478
|
+
const imageHeight = (drawingOrigin === null || drawingOrigin === void 0 || (_drawingOrigin$docTra2 = drawingOrigin.docTransform) === null || _drawingOrigin$docTra2 === void 0 ? void 0 : _drawingOrigin$docTra2.size.height) ?? drawing.drawing.height;
|
|
13479
|
+
return {
|
|
13480
|
+
...drawing,
|
|
13481
|
+
rect: calculateCellImageRect({
|
|
13482
|
+
cellRect,
|
|
13483
|
+
imageWidth,
|
|
13484
|
+
imageHeight,
|
|
13485
|
+
horizontalAlign: font.horizontalAlign,
|
|
13486
|
+
verticalAlign: font.verticalAlign,
|
|
13487
|
+
padding: (_font$style = font.style) === null || _font$style === void 0 ? void 0 : _font$style.pd
|
|
13488
|
+
})
|
|
13489
|
+
};
|
|
13490
|
+
});
|
|
13491
|
+
}
|
|
13550
13492
|
let HoverManagerService = class HoverManagerService extends Disposable {
|
|
13551
13493
|
constructor(_univerInstanceService, _renderManagerService) {
|
|
13552
13494
|
super();
|
|
@@ -13667,7 +13609,7 @@ let HoverManagerService = class HoverManagerService extends Disposable {
|
|
|
13667
13609
|
if (!workbook) return null;
|
|
13668
13610
|
const worksheet = workbook.getActiveSheet();
|
|
13669
13611
|
if (!worksheet) return null;
|
|
13670
|
-
const currentRender = this._renderManagerService.
|
|
13612
|
+
const currentRender = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13671
13613
|
if (!currentRender) return null;
|
|
13672
13614
|
const skeletonParam = currentRender.with(SheetSkeletonManagerService).getSkeletonParam(worksheet.getSheetId());
|
|
13673
13615
|
if (!skeletonParam) return null;
|
|
@@ -13681,7 +13623,6 @@ let HoverManagerService = class HoverManagerService extends Disposable {
|
|
|
13681
13623
|
};
|
|
13682
13624
|
}
|
|
13683
13625
|
_calcActiveCell(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
13684
|
-
var _cellData$fontRenderE, _ref, _customRange$rects$po;
|
|
13685
13626
|
const hoverPosition = getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY);
|
|
13686
13627
|
const skeleton = skeletonParam.skeleton;
|
|
13687
13628
|
if (!hoverPosition) return null;
|
|
@@ -13692,17 +13633,18 @@ let HoverManagerService = class HoverManagerService extends Disposable {
|
|
|
13692
13633
|
let drawing = null;
|
|
13693
13634
|
const cell = skeleton.getCellWithCoordByIndex(overflowLocation.row, overflowLocation.col);
|
|
13694
13635
|
const cellData = worksheet.getCell(overflowLocation.row, overflowLocation.col);
|
|
13695
|
-
const { topOffset = 0, leftOffset = 0 } = (
|
|
13636
|
+
const { topOffset = 0, leftOffset = 0 } = (cellData === null || cellData === void 0 ? void 0 : cellData.fontRenderExtension) ?? {};
|
|
13696
13637
|
if (font === null || font === void 0 ? void 0 : font.documentSkeleton) {
|
|
13697
13638
|
const { paddingLeft, paddingTop } = calcPadding(cell, font, (cellData === null || cellData === void 0 ? void 0 : cellData.p) ? false : isRealNum(cellData === null || cellData === void 0 ? void 0 : cellData.v) && (!(cellData === null || cellData === void 0 ? void 0 : cellData.t) || cellData.t === CellValueType.NUMBER));
|
|
13698
13639
|
const rects = calculateDocSkeletonRects(font.documentSkeleton, paddingLeft, paddingTop);
|
|
13640
|
+
const drawingRects = calculateCellDrawingRects(font, cell, rects.drawings);
|
|
13699
13641
|
const innerX = offsetX - position.startX - leftOffset;
|
|
13700
13642
|
const innerY = offsetY - position.startY - topOffset;
|
|
13701
13643
|
customRange = rects.links.find((link) => link.rects.some((rect) => rect.left <= innerX && innerX <= rect.right && rect.top <= innerY && innerY <= rect.bottom));
|
|
13702
13644
|
bullet = rects.checkLists.find((list) => list.rect.left <= innerX && innerX <= list.rect.right && list.rect.top <= innerY && innerY <= list.rect.bottom);
|
|
13703
|
-
drawing =
|
|
13645
|
+
drawing = drawingRects.find((drawing) => drawing.rect.left <= innerX && innerX <= drawing.rect.right && drawing.rect.top <= innerY && innerY <= drawing.rect.bottom);
|
|
13704
13646
|
}
|
|
13705
|
-
const rect = (
|
|
13647
|
+
const rect = (customRange === null || customRange === void 0 ? void 0 : customRange.rects.pop()) ?? (bullet === null || bullet === void 0 ? void 0 : bullet.rect) ?? (drawing === null || drawing === void 0 ? void 0 : drawing.rect);
|
|
13706
13648
|
const displayRect = rect && (() => {
|
|
13707
13649
|
const absoluteTop = rect.top + cell.mergeInfo.startY + topOffset;
|
|
13708
13650
|
const absoluteBottom = rect.bottom + cell.mergeInfo.startY + topOffset;
|
|
@@ -14024,7 +13966,6 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
14024
13966
|
errorMsg
|
|
14025
13967
|
},
|
|
14026
13968
|
width: 320,
|
|
14027
|
-
destroyOnClose: true,
|
|
14028
13969
|
showOk: true,
|
|
14029
13970
|
onClose: () => {
|
|
14030
13971
|
this._dialogService.close(UNIVER_SHEET_PERMISSION_ALERT_DIALOG_ID);
|
|
@@ -14155,7 +14096,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
|
|
|
14155
14096
|
}
|
|
14156
14097
|
_createFreeze(freezeDirectionType = 0, freezeConfig) {
|
|
14157
14098
|
var _this$_sheetSkeletonM;
|
|
14158
|
-
const config = freezeConfig
|
|
14099
|
+
const config = freezeConfig ?? this._getFreeze();
|
|
14159
14100
|
if (config == null) return null;
|
|
14160
14101
|
const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
|
|
14161
14102
|
const { startRow: freezeRow, startColumn: freezeColumn } = config;
|
|
@@ -14278,7 +14219,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
|
|
|
14278
14219
|
if (s2) this._freezeDownSubs.add(s2);
|
|
14279
14220
|
}
|
|
14280
14221
|
_getCurrentLastVisible() {
|
|
14281
|
-
var _this$_sheetSkeletonM2
|
|
14222
|
+
var _this$_sheetSkeletonM2;
|
|
14282
14223
|
const sheetObject = this._getSheetObject();
|
|
14283
14224
|
if (sheetObject == null) return;
|
|
14284
14225
|
const skeleton = (_this$_sheetSkeletonM2 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM2 === void 0 ? void 0 : _this$_sheetSkeletonM2.skeleton;
|
|
@@ -14288,8 +14229,8 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
|
|
|
14288
14229
|
const currentScroll = this._scrollManagerService.getCurrentScrollState();
|
|
14289
14230
|
const skeletonViewHeight = (sheetObject.engine.height - skeleton.columnHeaderHeight) / scale;
|
|
14290
14231
|
const skeletonViewWidth = (sheetObject.engine.width - skeleton.rowHeaderWidth) / scale;
|
|
14291
|
-
const startRow = (
|
|
14292
|
-
const startHeight = startRow === 0 ? -((
|
|
14232
|
+
const startRow = (currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.sheetViewStartRow) ?? 0;
|
|
14233
|
+
const startHeight = startRow === 0 ? -((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetY) ?? 0) : skeleton.rowHeightAccumulation[startRow - 1] - ((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetY) ?? 0);
|
|
14293
14234
|
let lastRow = 0;
|
|
14294
14235
|
let hadFind = false;
|
|
14295
14236
|
for (let i = startRow, len = skeleton.rowHeightAccumulation.length; i < len; i++) if (skeleton.rowHeightAccumulation[i] - startHeight > skeletonViewHeight) {
|
|
@@ -14298,8 +14239,8 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
|
|
|
14298
14239
|
break;
|
|
14299
14240
|
}
|
|
14300
14241
|
if (!hadFind) lastRow = skeleton.rowHeightAccumulation.length - 1;
|
|
14301
|
-
const startColumn = (
|
|
14302
|
-
const startWidth = startColumn === 0 ? -((
|
|
14242
|
+
const startColumn = (currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.sheetViewStartColumn) ?? 0;
|
|
14243
|
+
const startWidth = startColumn === 0 ? -((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetX) ?? 0) : skeleton.columnWidthAccumulation[startColumn - 1] - ((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetX) ?? 0);
|
|
14303
14244
|
let lastColumn = 0;
|
|
14304
14245
|
let hadFindCol = false;
|
|
14305
14246
|
for (let i = startColumn, len = skeleton.columnWidthAccumulation.length; i < len; i++) if (skeleton.columnWidthAccumulation[i] - startWidth > skeletonViewWidth) {
|
|
@@ -15022,9 +14963,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
|
|
|
15022
14963
|
}
|
|
15023
14964
|
_getFreeze() {
|
|
15024
14965
|
var _this$_sheetSkeletonM6;
|
|
15025
|
-
|
|
15026
|
-
if (config == null) return;
|
|
15027
|
-
return config.freeze;
|
|
14966
|
+
return (_this$_sheetSkeletonM6 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM6 === void 0 ? void 0 : _this$_sheetSkeletonM6.skeleton.worksheet.getFreeze();
|
|
15028
14967
|
}
|
|
15029
14968
|
_getSheetObject() {
|
|
15030
14969
|
return getSheetObject(this._context.unit, this._context);
|
|
@@ -15072,14 +15011,8 @@ function getSheetSelectionsDisabled$(accessor) {
|
|
|
15072
15011
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
15073
15012
|
return combineLatest([
|
|
15074
15013
|
selectionManagerService.selectionMoveEnd$,
|
|
15075
|
-
workbook$.pipe(map((workbook) =>
|
|
15076
|
-
|
|
15077
|
-
return (_workbook$getUnitId = workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) !== null && _workbook$getUnitId !== void 0 ? _workbook$getUnitId : "";
|
|
15078
|
-
})),
|
|
15079
|
-
workbook$.pipe(switchMap((workbook) => {
|
|
15080
|
-
var _workbook$activeSheet;
|
|
15081
|
-
return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : of(null);
|
|
15082
|
-
}))
|
|
15014
|
+
workbook$.pipe(map((workbook) => (workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) ?? "")),
|
|
15015
|
+
workbook$.pipe(switchMap((workbook) => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? of(null)))
|
|
15083
15016
|
]).pipe(map(([selection, unitId, sheet]) => {
|
|
15084
15017
|
if (!sheet) return false;
|
|
15085
15018
|
if (!selection || selection.length === 0) return false;
|
|
@@ -16069,10 +16002,7 @@ let HeaderUnhideRenderController = class HeaderUnhideRenderController extends Rx
|
|
|
16069
16002
|
const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getSkeletonParam(worksheet.getSheetId())) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
|
|
16070
16003
|
if (!skeleton) return;
|
|
16071
16004
|
const visibleCheck = this.interceptor.fetchThroughInterceptors(HEADER_UNHIDE_RANGE_VISIBLE_CHECK);
|
|
16072
|
-
const shouldRenderRange = (payload) =>
|
|
16073
|
-
var _visibleCheck;
|
|
16074
|
-
return this._headerUnhideRangeService.shouldRenderRange((_visibleCheck = visibleCheck(true, payload)) !== null && _visibleCheck !== void 0 ? _visibleCheck : true, payload);
|
|
16075
|
-
};
|
|
16005
|
+
const shouldRenderRange = (payload) => this._headerUnhideRangeService.shouldRenderRange(visibleCheck(true, payload) ?? true, payload);
|
|
16076
16006
|
const hiddenRowRanges = worksheet.getHiddenRows().filter((range) => shouldRenderRange({
|
|
16077
16007
|
axis: "row",
|
|
16078
16008
|
range,
|
|
@@ -16158,43 +16088,43 @@ var StatusBarService = class {
|
|
|
16158
16088
|
{
|
|
16159
16089
|
func: FUNCTION_NAMES_STATISTICAL.MAX,
|
|
16160
16090
|
filter: (status) => {
|
|
16161
|
-
var _status$values$find
|
|
16162
|
-
return ((
|
|
16091
|
+
var _status$values$find, _status$values$find2;
|
|
16092
|
+
return (((_status$values$find = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find === void 0 ? void 0 : _status$values$find.value) ?? 0) > 1 && (((_status$values$find2 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find2 === void 0 ? void 0 : _status$values$find2.value) ?? 0) > 0;
|
|
16163
16093
|
}
|
|
16164
16094
|
},
|
|
16165
16095
|
{
|
|
16166
16096
|
func: FUNCTION_NAMES_STATISTICAL.MIN,
|
|
16167
16097
|
filter: (status) => {
|
|
16168
|
-
var _status$values$
|
|
16169
|
-
return ((
|
|
16098
|
+
var _status$values$find3, _status$values$find4;
|
|
16099
|
+
return (((_status$values$find3 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find3 === void 0 ? void 0 : _status$values$find3.value) ?? 0) > 1 && (((_status$values$find4 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find4 === void 0 ? void 0 : _status$values$find4.value) ?? 0) > 0;
|
|
16170
16100
|
}
|
|
16171
16101
|
},
|
|
16172
16102
|
{
|
|
16173
16103
|
func: FUNCTION_NAMES_MATH.SUM,
|
|
16174
16104
|
filter: (status) => {
|
|
16175
|
-
var _status$values$
|
|
16176
|
-
return ((
|
|
16105
|
+
var _status$values$find5, _status$values$find6;
|
|
16106
|
+
return (((_status$values$find5 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find5 === void 0 ? void 0 : _status$values$find5.value) ?? 0) > 1 && (((_status$values$find6 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find6 === void 0 ? void 0 : _status$values$find6.value) ?? 0) > 0;
|
|
16177
16107
|
}
|
|
16178
16108
|
},
|
|
16179
16109
|
{
|
|
16180
16110
|
func: FUNCTION_NAMES_STATISTICAL.COUNTA,
|
|
16181
16111
|
filter: (status) => {
|
|
16182
|
-
var _status$values$
|
|
16183
|
-
return ((
|
|
16112
|
+
var _status$values$find7;
|
|
16113
|
+
return (((_status$values$find7 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find7 === void 0 ? void 0 : _status$values$find7.value) ?? 0) > 1;
|
|
16184
16114
|
}
|
|
16185
16115
|
},
|
|
16186
16116
|
{
|
|
16187
16117
|
func: FUNCTION_NAMES_STATISTICAL.COUNT,
|
|
16188
16118
|
filter: (status) => {
|
|
16189
|
-
var _status$values$
|
|
16190
|
-
return ((
|
|
16119
|
+
var _status$values$find8, _status$values$find9;
|
|
16120
|
+
return (((_status$values$find8 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find8 === void 0 ? void 0 : _status$values$find8.value) ?? 0) > 1 && (((_status$values$find9 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find9 === void 0 ? void 0 : _status$values$find9.value) ?? 0) > 0;
|
|
16191
16121
|
}
|
|
16192
16122
|
},
|
|
16193
16123
|
{
|
|
16194
16124
|
func: FUNCTION_NAMES_STATISTICAL.AVERAGE,
|
|
16195
16125
|
filter: (status) => {
|
|
16196
|
-
var _status$values$
|
|
16197
|
-
return ((
|
|
16126
|
+
var _status$values$find10, _status$values$find11;
|
|
16127
|
+
return (((_status$values$find10 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find10 === void 0 ? void 0 : _status$values$find10.value) ?? 0) > 1 && (((_status$values$find11 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find11 === void 0 ? void 0 : _status$values$find11.value) ?? 0) > 0;
|
|
16198
16128
|
}
|
|
16199
16129
|
}
|
|
16200
16130
|
]);
|
|
@@ -16205,7 +16135,6 @@ var StatusBarService = class {
|
|
|
16205
16135
|
this._state$.complete();
|
|
16206
16136
|
}
|
|
16207
16137
|
setState(param) {
|
|
16208
|
-
var _param$pattern;
|
|
16209
16138
|
const newState = {
|
|
16210
16139
|
values: [],
|
|
16211
16140
|
pattern: null
|
|
@@ -16214,7 +16143,7 @@ var StatusBarService = class {
|
|
|
16214
16143
|
const func = this._functions.find((func) => func.func === item.func);
|
|
16215
16144
|
if (func && (func.filter === void 0 || func.filter(param))) newState.values.push(item);
|
|
16216
16145
|
});
|
|
16217
|
-
newState.pattern = (
|
|
16146
|
+
newState.pattern = (param === null || param === void 0 ? void 0 : param.pattern) ?? null;
|
|
16218
16147
|
this._state$.next(newState);
|
|
16219
16148
|
}
|
|
16220
16149
|
getState() {
|
|
@@ -16393,14 +16322,11 @@ let StatusBarController = class StatusBarController extends Disposable {
|
|
|
16393
16322
|
var _sheetArrayFormulaCel;
|
|
16394
16323
|
const rawCell = sheet.getCellRaw(row, col);
|
|
16395
16324
|
const arrayCell = sheetArrayFormulaCellData === null || sheetArrayFormulaCellData === void 0 || (_sheetArrayFormulaCel = sheetArrayFormulaCellData[row]) === null || _sheetArrayFormulaCel === void 0 ? void 0 : _sheetArrayFormulaCel[col];
|
|
16396
|
-
if (arrayCell) {
|
|
16397
|
-
|
|
16398
|
-
|
|
16399
|
-
|
|
16400
|
-
|
|
16401
|
-
s: (_arrayCell$s = arrayCell.s) !== null && _arrayCell$s !== void 0 ? _arrayCell$s : rawCell === null || rawCell === void 0 ? void 0 : rawCell.s
|
|
16402
|
-
};
|
|
16403
|
-
}
|
|
16325
|
+
if (arrayCell) return {
|
|
16326
|
+
t: arrayCell.t ?? (rawCell === null || rawCell === void 0 ? void 0 : rawCell.t),
|
|
16327
|
+
v: arrayCell.v ?? (rawCell === null || rawCell === void 0 ? void 0 : rawCell.v),
|
|
16328
|
+
s: arrayCell.s ?? (rawCell === null || rawCell === void 0 ? void 0 : rawCell.s)
|
|
16329
|
+
};
|
|
16404
16330
|
return rawCell;
|
|
16405
16331
|
}
|
|
16406
16332
|
_calculateSelection(selections, primary) {
|
|
@@ -16698,12 +16624,11 @@ function getObservableWithExclusiveRange$(accessor, observable$, disableGroupSet
|
|
|
16698
16624
|
return combineLatest([observable$, getCurrentExclusiveRangeInterest$(accessor, disableGroupSet)]).pipe(map$1(([observable, exclusiveRangeDisable]) => observable || exclusiveRangeDisable));
|
|
16699
16625
|
}
|
|
16700
16626
|
function getCurrentRangeDisable$(accessor, permissionTypes = {}, supportCellEdit = false) {
|
|
16701
|
-
var _editorBridgeService$;
|
|
16702
16627
|
const workbook$ = accessor.get(IUniverInstanceService).getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
16703
16628
|
const userManagerService = accessor.get(UserManagerService);
|
|
16704
16629
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
16705
16630
|
const contextService = accessor.get(IContextService);
|
|
16706
|
-
const editorVisible$ = ((
|
|
16631
|
+
const editorVisible$ = ((editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$) ?? of(null)).pipe(startWith$1(null), shareReplay$1({
|
|
16707
16632
|
bufferSize: 1,
|
|
16708
16633
|
refCount: true
|
|
16709
16634
|
}));
|
|
@@ -16882,7 +16807,6 @@ function getWorkbookPermissionDisable$(accessor, workbookPermissionTypes) {
|
|
|
16882
16807
|
return combineLatest([accessor.get(UserManagerService).currentUser$, workbook$]).pipe(switchMap$1(([_user, workbook]) => {
|
|
16883
16808
|
if (!workbook) return of(true);
|
|
16884
16809
|
return workbook.activeSheet$.pipe(switchMap$1((worksheet) => {
|
|
16885
|
-
var _permissionService$co;
|
|
16886
16810
|
if (!worksheet) return of(true);
|
|
16887
16811
|
const unitId = workbook.getUnitId();
|
|
16888
16812
|
const subUnitId = worksheet.getSheetId();
|
|
@@ -16890,7 +16814,7 @@ function getWorkbookPermissionDisable$(accessor, workbookPermissionTypes) {
|
|
|
16890
16814
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
16891
16815
|
const workbookPermissionIds = [];
|
|
16892
16816
|
workbookPermissionTypes.forEach((F) => workbookPermissionIds.push(new F(unitId).id));
|
|
16893
|
-
return combineLatest([
|
|
16817
|
+
return combineLatest([permissionService.composePermission$(workbookPermissionIds).pipe(map$1((list) => list.every((item) => item.value === true))) ?? of(false), merge$1(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe(startWith$1(null))]).pipe(map$1(([permission, _]) => {
|
|
16894
16818
|
var _selectionProtectionR;
|
|
16895
16819
|
if (!permission) return true;
|
|
16896
16820
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -16916,11 +16840,10 @@ function CellBorderSelectorMenuItemFactory(accessor) {
|
|
|
16916
16840
|
const defaultIcon = "AllBorderIcon";
|
|
16917
16841
|
const borderManager = accessor.get(BorderStyleManagerService);
|
|
16918
16842
|
const disposable = accessor.get(ICommandService).onCommandExecuted((c) => {
|
|
16919
|
-
var _item$icon;
|
|
16920
16843
|
if (c.id !== SetBorderBasicCommand.id) return;
|
|
16921
16844
|
const { type } = borderManager.getBorderInfo();
|
|
16922
16845
|
const item = BORDER_LINE_CHILDREN.find((item) => item.value === type);
|
|
16923
|
-
const icon = (
|
|
16846
|
+
const icon = (item === null || item === void 0 ? void 0 : item.icon) ?? defaultIcon;
|
|
16924
16847
|
subscriber.next(icon);
|
|
16925
16848
|
});
|
|
16926
16849
|
subscriber.next(defaultIcon);
|
|
@@ -17110,8 +17033,8 @@ function updateFontSizeValue(accessor, defaultValue) {
|
|
|
17110
17033
|
const updateSheetEditor = () => {
|
|
17111
17034
|
const textRun = getFontStyleAtCursor(accessor);
|
|
17112
17035
|
if (textRun != null) {
|
|
17113
|
-
var _textRun$ts
|
|
17114
|
-
const fs = (
|
|
17036
|
+
var _textRun$ts;
|
|
17037
|
+
const fs = ((_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.fs) ?? defaultValue;
|
|
17115
17038
|
subscriber.next(fs);
|
|
17116
17039
|
}
|
|
17117
17040
|
};
|
|
@@ -17191,11 +17114,10 @@ const defaultValue = {
|
|
|
17191
17114
|
col: "A"
|
|
17192
17115
|
};
|
|
17193
17116
|
function getFrozenValue(selection) {
|
|
17194
|
-
var _primary$startRow, _primary$startColumn;
|
|
17195
17117
|
if (!selection) return defaultValue;
|
|
17196
17118
|
const { primary, range } = selection;
|
|
17197
|
-
const row = (
|
|
17198
|
-
const col = (
|
|
17119
|
+
const row = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
17120
|
+
const col = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
17199
17121
|
return {
|
|
17200
17122
|
row: row === 0 ? "1" : String(row),
|
|
17201
17123
|
col: col === 0 ? "A" : Tools.chatAtABC(col - 1)
|
|
@@ -17225,11 +17147,10 @@ const getMenuHiddenByCurrentSelectionChangedObservable$$1 = (accessor, type) =>
|
|
|
17225
17147
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
17226
17148
|
return new Observable((subscriber) => {
|
|
17227
17149
|
const update = (selection) => {
|
|
17228
|
-
var _primary$startRow, _primary$startColumn;
|
|
17229
17150
|
if (!selection) return subscriber.next(true);
|
|
17230
17151
|
const { primary, range } = selection;
|
|
17231
|
-
const row = (
|
|
17232
|
-
const col = (
|
|
17152
|
+
const row = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
17153
|
+
const col = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
17233
17154
|
if (type === "row" && row <= 0) return subscriber.next(true);
|
|
17234
17155
|
if (type === "col" && col <= 0) return subscriber.next(true);
|
|
17235
17156
|
subscriber.next(false);
|
|
@@ -17469,7 +17390,7 @@ const MenuItemInput = (props) => {
|
|
|
17469
17390
|
const { prefix, suffix, value, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, disabled$, onChange } = props;
|
|
17470
17391
|
const localeService = useDependency(LocaleService);
|
|
17471
17392
|
const contextMenuService = useDependency(IContextMenuService);
|
|
17472
|
-
const disabled = useObservable(disabled$
|
|
17393
|
+
const disabled = useObservable(disabled$ ?? null, false);
|
|
17473
17394
|
const [inputValue, setInputValue] = useState();
|
|
17474
17395
|
const handleChange = (value) => {
|
|
17475
17396
|
if (!value) {
|
|
@@ -18140,8 +18061,8 @@ function FontFamilySelectorMenuItemFactory(accessor) {
|
|
|
18140
18061
|
if ((id === SetTextSelectionsOperation.id || id === SetInlineFormatCommand.id) && accessor.get(IContextService).getContextValue(EDITOR_ACTIVATED) && (accessor.get(IContextService).getContextValue(FOCUSING_SHEET) || accessor.get(IContextService).getContextValue(FOCUSING_SHAPE_TEXT_EDITOR))) {
|
|
18141
18062
|
const textRun = getFontStyleAtCursor(accessor);
|
|
18142
18063
|
if (textRun != null) {
|
|
18143
|
-
var _textRun$
|
|
18144
|
-
const ff = (
|
|
18064
|
+
var _textRun$ts5;
|
|
18065
|
+
const ff = ((_textRun$ts5 = textRun.ts) === null || _textRun$ts5 === void 0 ? void 0 : _textRun$ts5.ff) ?? defaultValue;
|
|
18145
18066
|
subscriber.next(ff);
|
|
18146
18067
|
}
|
|
18147
18068
|
}
|
|
@@ -18184,10 +18105,8 @@ function TextColorSelectorMenuItemFactory(accessor) {
|
|
|
18184
18105
|
value$: new Observable((subscriber) => {
|
|
18185
18106
|
const defaultValue = DEFAULT_STYLES.cl.rgb;
|
|
18186
18107
|
const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("cl");
|
|
18187
|
-
if (isAllValuesSame)
|
|
18188
|
-
|
|
18189
|
-
subscriber.next((_rgb = currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) !== null && _rgb !== void 0 ? _rgb : defaultValue);
|
|
18190
|
-
} else subscriber.next(defaultValue);
|
|
18108
|
+
if (isAllValuesSame) subscriber.next((currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) ?? defaultValue);
|
|
18109
|
+
else subscriber.next(defaultValue);
|
|
18191
18110
|
})
|
|
18192
18111
|
}],
|
|
18193
18112
|
value$: new Observable((subscriber) => {
|
|
@@ -18195,7 +18114,7 @@ function TextColorSelectorMenuItemFactory(accessor) {
|
|
|
18195
18114
|
const disposable = commandService.onCommandExecuted((c) => {
|
|
18196
18115
|
if (c.id === SetRangeTextColorCommand.id) {
|
|
18197
18116
|
const color = c.params.value;
|
|
18198
|
-
subscriber.next(color
|
|
18117
|
+
subscriber.next(color ?? defaultValue);
|
|
18199
18118
|
}
|
|
18200
18119
|
});
|
|
18201
18120
|
subscriber.next(defaultValue);
|
|
@@ -18240,10 +18159,8 @@ function BackgroundColorSelectorMenuItemFactory(accessor) {
|
|
|
18240
18159
|
value$: new Observable((subscriber) => {
|
|
18241
18160
|
const defaultValue = themeService.getColorFromTheme("primary.600");
|
|
18242
18161
|
const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("bg");
|
|
18243
|
-
if (isAllValuesSame)
|
|
18244
|
-
|
|
18245
|
-
subscriber.next((_rgb2 = currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) !== null && _rgb2 !== void 0 ? _rgb2 : defaultValue);
|
|
18246
|
-
} else subscriber.next(defaultValue);
|
|
18162
|
+
if (isAllValuesSame) subscriber.next((currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) ?? defaultValue);
|
|
18163
|
+
else subscriber.next(defaultValue);
|
|
18247
18164
|
})
|
|
18248
18165
|
}],
|
|
18249
18166
|
value$: new Observable((subscriber) => {
|
|
@@ -18251,7 +18168,7 @@ function BackgroundColorSelectorMenuItemFactory(accessor) {
|
|
|
18251
18168
|
const disposable = commandService.onCommandExecuted((c) => {
|
|
18252
18169
|
if (c.id === SetBackgroundColorCommand.id) {
|
|
18253
18170
|
const color = c.params.value;
|
|
18254
|
-
subscriber.next(color
|
|
18171
|
+
subscriber.next(color ?? defaultValue);
|
|
18255
18172
|
}
|
|
18256
18173
|
});
|
|
18257
18174
|
subscriber.next(defaultValue);
|
|
@@ -18283,12 +18200,12 @@ const HORIZONTAL_ALIGN_CHILDREN = [
|
|
|
18283
18200
|
}
|
|
18284
18201
|
];
|
|
18285
18202
|
function HorizontalAlignMenuItemFactory(accessor) {
|
|
18286
|
-
var
|
|
18203
|
+
var _HORIZONTAL_ALIGN_CHI;
|
|
18287
18204
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
18288
18205
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
18289
18206
|
const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
18290
18207
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18291
|
-
const defaultValue = (
|
|
18208
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.ht) ?? HorizontalAlign.LEFT;
|
|
18292
18209
|
return {
|
|
18293
18210
|
id: SetHorizontalTextAlignCommand.id,
|
|
18294
18211
|
icon: (_HORIZONTAL_ALIGN_CHI = HORIZONTAL_ALIGN_CHILDREN.find((child) => child.value === defaultValue)) === null || _HORIZONTAL_ALIGN_CHI === void 0 ? void 0 : _HORIZONTAL_ALIGN_CHI.icon,
|
|
@@ -18296,30 +18213,28 @@ function HorizontalAlignMenuItemFactory(accessor) {
|
|
|
18296
18213
|
type: MenuItemType.SELECTOR,
|
|
18297
18214
|
selections: HORIZONTAL_ALIGN_CHILDREN,
|
|
18298
18215
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new Observable((subscriber) => {
|
|
18299
|
-
var _selectionManagerServ11
|
|
18216
|
+
var _selectionManagerServ11;
|
|
18300
18217
|
const disposable = accessor.get(ICommandService).onCommandExecuted((c) => {
|
|
18301
|
-
var _selectionManagerServ10
|
|
18218
|
+
var _selectionManagerServ10;
|
|
18302
18219
|
const id = c.id;
|
|
18303
18220
|
if (id !== SetHorizontalTextAlignCommand.id && id !== SetSelectionsOperation.id && id !== SetWorksheetActiveOperation.id) return;
|
|
18304
18221
|
const primary = (_selectionManagerServ10 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ10 === void 0 ? void 0 : _selectionManagerServ10.primary;
|
|
18305
18222
|
let ht;
|
|
18306
18223
|
if (primary != null) {
|
|
18307
|
-
var _defaultCellStyle$ht;
|
|
18308
18224
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18309
18225
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18310
|
-
ht = (
|
|
18226
|
+
ht = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.ht) ?? (range === null || range === void 0 ? void 0 : range.getHorizontalAlignment());
|
|
18311
18227
|
}
|
|
18312
|
-
subscriber.next(
|
|
18228
|
+
subscriber.next(ht ?? defaultValue);
|
|
18313
18229
|
});
|
|
18314
18230
|
const primary = (_selectionManagerServ11 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ11 === void 0 ? void 0 : _selectionManagerServ11.primary;
|
|
18315
18231
|
let ht;
|
|
18316
18232
|
if (primary != null) {
|
|
18317
|
-
var _defaultCellStyle$ht2;
|
|
18318
18233
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18319
18234
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18320
|
-
ht = (
|
|
18235
|
+
ht = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.ht) ?? (range === null || range === void 0 ? void 0 : range.getHorizontalAlignment());
|
|
18321
18236
|
}
|
|
18322
|
-
subscriber.next(
|
|
18237
|
+
subscriber.next(ht ?? defaultValue);
|
|
18323
18238
|
return disposable.dispose;
|
|
18324
18239
|
})),
|
|
18325
18240
|
hidden$: combineLatest([getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET), accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false))]).pipe(map(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -18348,12 +18263,12 @@ const VERTICAL_ALIGN_CHILDREN = [
|
|
|
18348
18263
|
}
|
|
18349
18264
|
];
|
|
18350
18265
|
function VerticalAlignMenuItemFactory(accessor) {
|
|
18351
|
-
var
|
|
18266
|
+
var _VERTICAL_ALIGN_CHILD;
|
|
18352
18267
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
18353
18268
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
18354
18269
|
const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
18355
18270
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18356
|
-
const defaultValue = (
|
|
18271
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.vt) ?? VerticalAlign.BOTTOM;
|
|
18357
18272
|
return {
|
|
18358
18273
|
id: SetVerticalTextAlignCommand.id,
|
|
18359
18274
|
icon: (_VERTICAL_ALIGN_CHILD = VERTICAL_ALIGN_CHILDREN.find((child) => child.value === defaultValue)) === null || _VERTICAL_ALIGN_CHILD === void 0 ? void 0 : _VERTICAL_ALIGN_CHILD.icon,
|
|
@@ -18361,30 +18276,28 @@ function VerticalAlignMenuItemFactory(accessor) {
|
|
|
18361
18276
|
type: MenuItemType.SELECTOR,
|
|
18362
18277
|
selections: VERTICAL_ALIGN_CHILDREN,
|
|
18363
18278
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new Observable((subscriber) => {
|
|
18364
|
-
var _selectionManagerServ13
|
|
18279
|
+
var _selectionManagerServ13;
|
|
18365
18280
|
const disposable = accessor.get(ICommandService).onCommandExecuted((c) => {
|
|
18366
|
-
var _selectionManagerServ12
|
|
18281
|
+
var _selectionManagerServ12;
|
|
18367
18282
|
const id = c.id;
|
|
18368
18283
|
if (id !== SetVerticalTextAlignCommand.id && id !== SetSelectionsOperation.id && id !== SetWorksheetActiveOperation.id) return;
|
|
18369
18284
|
const primary = (_selectionManagerServ12 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ12 === void 0 ? void 0 : _selectionManagerServ12.primary;
|
|
18370
18285
|
let vt;
|
|
18371
18286
|
if (primary != null) {
|
|
18372
|
-
var _defaultCellStyle$vt;
|
|
18373
18287
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18374
18288
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18375
|
-
vt = (
|
|
18289
|
+
vt = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.vt) ?? (range === null || range === void 0 ? void 0 : range.getVerticalAlignment());
|
|
18376
18290
|
}
|
|
18377
|
-
subscriber.next(
|
|
18291
|
+
subscriber.next(vt ?? defaultValue);
|
|
18378
18292
|
});
|
|
18379
18293
|
const primary = (_selectionManagerServ13 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ13 === void 0 ? void 0 : _selectionManagerServ13.primary;
|
|
18380
18294
|
let vt;
|
|
18381
18295
|
if (primary != null) {
|
|
18382
|
-
var _defaultCellStyle$vt2;
|
|
18383
18296
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18384
18297
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18385
|
-
vt = (
|
|
18298
|
+
vt = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.vt) ?? (range === null || range === void 0 ? void 0 : range.getVerticalAlignment());
|
|
18386
18299
|
}
|
|
18387
|
-
subscriber.next(
|
|
18300
|
+
subscriber.next(vt ?? defaultValue);
|
|
18388
18301
|
return disposable.dispose;
|
|
18389
18302
|
})),
|
|
18390
18303
|
hidden$: combineLatest([getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET), accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false))]).pipe(map(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -18413,12 +18326,12 @@ const TEXT_WRAP_CHILDREN = [
|
|
|
18413
18326
|
}
|
|
18414
18327
|
];
|
|
18415
18328
|
function WrapTextMenuItemFactory(accessor) {
|
|
18416
|
-
var
|
|
18329
|
+
var _TEXT_WRAP_CHILDREN$f;
|
|
18417
18330
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
18418
18331
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
18419
18332
|
const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
18420
18333
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18421
|
-
const defaultValue = (
|
|
18334
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.tb) ?? WrapStrategy.OVERFLOW;
|
|
18422
18335
|
return {
|
|
18423
18336
|
id: SetTextWrapCommand.id,
|
|
18424
18337
|
tooltip: "sheets-ui.toolbar.textWrapMode.main",
|
|
@@ -18426,30 +18339,28 @@ function WrapTextMenuItemFactory(accessor) {
|
|
|
18426
18339
|
type: MenuItemType.SELECTOR,
|
|
18427
18340
|
selections: TEXT_WRAP_CHILDREN,
|
|
18428
18341
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new Observable((subscriber) => {
|
|
18429
|
-
var _selectionManagerServ15
|
|
18342
|
+
var _selectionManagerServ15;
|
|
18430
18343
|
const disposable = accessor.get(ICommandService).onCommandExecuted((c) => {
|
|
18431
|
-
var _selectionManagerServ14
|
|
18344
|
+
var _selectionManagerServ14;
|
|
18432
18345
|
const id = c.id;
|
|
18433
18346
|
if (id !== SetTextWrapCommand.id && id !== SetSelectionsOperation.id && id !== SetWorksheetActiveOperation.id) return;
|
|
18434
18347
|
const primary = (_selectionManagerServ14 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ14 === void 0 ? void 0 : _selectionManagerServ14.primary;
|
|
18435
18348
|
let tb;
|
|
18436
18349
|
if (primary != null) {
|
|
18437
|
-
var _defaultCellStyle$tb;
|
|
18438
18350
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18439
18351
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18440
|
-
tb = (
|
|
18352
|
+
tb = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.tb) ?? (range === null || range === void 0 ? void 0 : range.getWrapStrategy());
|
|
18441
18353
|
}
|
|
18442
|
-
subscriber.next(
|
|
18354
|
+
subscriber.next(tb ?? defaultValue);
|
|
18443
18355
|
});
|
|
18444
18356
|
const primary = (_selectionManagerServ15 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ15 === void 0 ? void 0 : _selectionManagerServ15.primary;
|
|
18445
18357
|
let tb;
|
|
18446
18358
|
if (primary != null) {
|
|
18447
|
-
var _defaultCellStyle$tb2;
|
|
18448
18359
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18449
18360
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18450
|
-
tb = (
|
|
18361
|
+
tb = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.tb) ?? (range === null || range === void 0 ? void 0 : range.getWrapStrategy());
|
|
18451
18362
|
}
|
|
18452
|
-
subscriber.next(
|
|
18363
|
+
subscriber.next(tb ?? defaultValue);
|
|
18453
18364
|
return disposable.dispose;
|
|
18454
18365
|
})),
|
|
18455
18366
|
hidden$: combineLatest([getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET), accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false))]).pipe(map(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -18549,10 +18460,7 @@ function TextRotateMenuItemFactory(accessor) {
|
|
|
18549
18460
|
tr = range === null || range === void 0 ? void 0 : range.getTextRotation();
|
|
18550
18461
|
}
|
|
18551
18462
|
if ((tr === null || tr === void 0 ? void 0 : tr.v) === BooleanNumber.TRUE) subscriber.next("v");
|
|
18552
|
-
else
|
|
18553
|
-
var _ref;
|
|
18554
|
-
subscriber.next((_ref = tr && tr.a) !== null && _ref !== void 0 ? _ref : defaultValue);
|
|
18555
|
-
}
|
|
18463
|
+
else subscriber.next((tr && tr.a) ?? defaultValue);
|
|
18556
18464
|
});
|
|
18557
18465
|
const primary = (_selectionManagerServ18 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ18 === void 0 ? void 0 : _selectionManagerServ18.primary;
|
|
18558
18466
|
let tr;
|
|
@@ -18561,10 +18469,7 @@ function TextRotateMenuItemFactory(accessor) {
|
|
|
18561
18469
|
tr = range === null || range === void 0 ? void 0 : range.getTextRotation();
|
|
18562
18470
|
}
|
|
18563
18471
|
if ((tr === null || tr === void 0 ? void 0 : tr.v) === BooleanNumber.TRUE) subscriber.next("v");
|
|
18564
|
-
else
|
|
18565
|
-
var _ref2;
|
|
18566
|
-
subscriber.next((_ref2 = tr && tr.a) !== null && _ref2 !== void 0 ? _ref2 : defaultValue);
|
|
18567
|
-
}
|
|
18472
|
+
else subscriber.next((tr && tr.a) ?? defaultValue);
|
|
18568
18473
|
return disposable.dispose;
|
|
18569
18474
|
})),
|
|
18570
18475
|
hidden$: combineLatest([getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET), accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false))]).pipe(map(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -19056,14 +18961,13 @@ function getPermissionDisableBase$(accessor) {
|
|
|
19056
18961
|
return combineLatest([univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), accessor.get(UserManagerService).currentUser$]).pipe(switchMap(([workbook, _]) => {
|
|
19057
18962
|
if (!workbook) return of(true);
|
|
19058
18963
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19059
|
-
var _permissionService$co;
|
|
19060
18964
|
if (!worksheet) return of(true);
|
|
19061
18965
|
const unitId = workbook.getUnitId();
|
|
19062
18966
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
19063
18967
|
const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);
|
|
19064
18968
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
19065
18969
|
return combineLatest([
|
|
19066
|
-
|
|
18970
|
+
permissionService.composePermission$([new WorkbookEditablePermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false),
|
|
19067
18971
|
merge$1(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe(startWith(null)),
|
|
19068
18972
|
selectionManagerService.selectionMoveEnd$
|
|
19069
18973
|
]).pipe(map(([permission, _, __]) => {
|
|
@@ -19078,7 +18982,6 @@ function getPermissionDisableBase$(accessor) {
|
|
|
19078
18982
|
}));
|
|
19079
18983
|
}
|
|
19080
18984
|
function getAddPermissionDisableBase$(accessor) {
|
|
19081
|
-
var _editorBridgeService$;
|
|
19082
18985
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
19083
18986
|
const permissionService = accessor.get(IPermissionService);
|
|
19084
18987
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
@@ -19088,10 +18991,10 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19088
18991
|
bufferSize: 1,
|
|
19089
18992
|
refCount: true
|
|
19090
18993
|
}));
|
|
19091
|
-
const editorVisible$ = (
|
|
18994
|
+
const editorVisible$ = (editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$.pipe(startWith(null), shareReplay({
|
|
19092
18995
|
bufferSize: 1,
|
|
19093
18996
|
refCount: true
|
|
19094
|
-
})))
|
|
18997
|
+
}))) ?? of(null);
|
|
19095
18998
|
return combineLatest([
|
|
19096
18999
|
workbook$,
|
|
19097
19000
|
userManagerService.currentUser$,
|
|
@@ -19100,7 +19003,6 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19100
19003
|
]).pipe(switchMap(([workbook, _, visible, formulaEditorFocus]) => {
|
|
19101
19004
|
if (!workbook || (visible === null || visible === void 0 ? void 0 : visible.visible) && visible.unitId === workbook.getUnitId() || formulaEditorFocus) return of(true);
|
|
19102
19005
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19103
|
-
var _permissionService$co2;
|
|
19104
19006
|
if (!worksheet) return of(true);
|
|
19105
19007
|
const focusingDrawing$ = accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false));
|
|
19106
19008
|
const unitId = workbook.getUnitId();
|
|
@@ -19109,7 +19011,7 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19109
19011
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
19110
19012
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
19111
19013
|
return combineLatest([
|
|
19112
|
-
|
|
19014
|
+
permissionService.composePermission$([new WorkbookCreateProtectPermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false),
|
|
19113
19015
|
merge$1(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe(startWith(null)),
|
|
19114
19016
|
selectionManagerService.selectionMoveEnd$,
|
|
19115
19017
|
focusingDrawing$
|
|
@@ -19138,13 +19040,12 @@ function getAddPermissionFromSheetBarDisable$(accessor) {
|
|
|
19138
19040
|
return combineLatest([univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), accessor.get(UserManagerService).currentUser$]).pipe(switchMap(([workbook, _]) => {
|
|
19139
19041
|
if (!workbook) return of(true);
|
|
19140
19042
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19141
|
-
var _permissionService$co3;
|
|
19142
19043
|
if (!worksheet) return of(true);
|
|
19143
19044
|
const unitId = workbook.getUnitId();
|
|
19144
19045
|
const subUnitId = worksheet.getSheetId();
|
|
19145
19046
|
const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);
|
|
19146
19047
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
19147
|
-
return combineLatest([
|
|
19048
|
+
return combineLatest([permissionService.composePermission$([new WorkbookCreateProtectPermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false), merge$1(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe(startWith(null))]).pipe(map(([permission, _]) => {
|
|
19148
19049
|
var _selectionProtectionR;
|
|
19149
19050
|
if (!permission) return true;
|
|
19150
19051
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -19160,12 +19061,12 @@ function getRemovePermissionFromSheetBarDisable$(accessor) {
|
|
|
19160
19061
|
return combineLatest([univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), accessor.get(UserManagerService).currentUser$]).pipe(switchMap(([workbook, _]) => {
|
|
19161
19062
|
if (!workbook) return of(true);
|
|
19162
19063
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19163
|
-
var _permissionService$ge2
|
|
19064
|
+
var _permissionService$ge2;
|
|
19164
19065
|
if (!worksheet) return of(true);
|
|
19165
19066
|
const unitId = workbook.getUnitId();
|
|
19166
19067
|
const subUnitId = worksheet.getSheetId();
|
|
19167
19068
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
19168
|
-
return combineLatest([(_permissionService$ge2 =
|
|
19069
|
+
return combineLatest([((_permissionService$ge2 = permissionService.getPermissionPoint$(new WorksheetDeleteProtectionPermission(unitId, subUnitId).id)) === null || _permissionService$ge2 === void 0 ? void 0 : _permissionService$ge2.pipe(map((e) => !!e.value))) ?? of(false), worksheetProtectionRuleModel.ruleChange$.pipe(startWith(null))]).pipe(map(([permission, _]) => {
|
|
19169
19070
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
19170
19071
|
if (worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) return !permission;
|
|
19171
19072
|
return true;
|
|
@@ -19179,13 +19080,12 @@ function getSetPermissionFromSheetBarDisable$(accessor) {
|
|
|
19179
19080
|
return combineLatest([univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), accessor.get(UserManagerService).currentUser$]).pipe(switchMap(([workbook, _]) => {
|
|
19180
19081
|
if (!workbook) return of(true);
|
|
19181
19082
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19182
|
-
var _permissionService$co4;
|
|
19183
19083
|
if (!worksheet) return of(true);
|
|
19184
19084
|
const unitId = workbook.getUnitId();
|
|
19185
19085
|
const subUnitId = worksheet.getSheetId();
|
|
19186
19086
|
const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);
|
|
19187
19087
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
19188
|
-
return combineLatest([
|
|
19088
|
+
return combineLatest([permissionService.composePermission$([new WorkbookCreateProtectPermission(unitId).id, new WorkbookManageCollaboratorPermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false), merge$1(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe(startWith(null))]).pipe(map(([permission, _]) => {
|
|
19189
19089
|
var _selectionProtectionR2;
|
|
19190
19090
|
if (!permission) return true;
|
|
19191
19091
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -19215,8 +19115,8 @@ function getRemovePermissionDisable$(accessor) {
|
|
|
19215
19115
|
if ((selectionRange === null || selectionRange === void 0 ? void 0 : selectionRange.rangeType) === RANGE_TYPE.ALL || (selectionRange === null || selectionRange === void 0 ? void 0 : selectionRange.rangeType) === RANGE_TYPE.COLUMN || (selectionRange === null || selectionRange === void 0 ? void 0 : selectionRange.rangeType) === RANGE_TYPE.ROW) return true;
|
|
19216
19116
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
19217
19117
|
if (worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) {
|
|
19218
|
-
var _permissionService$
|
|
19219
|
-
return ((_permissionService$
|
|
19118
|
+
var _permissionService$ge3;
|
|
19119
|
+
return ((_permissionService$ge3 = permissionService.getPermissionPoint(new WorksheetDeleteProtectionPermission(unitId, subUnitId).id)) === null || _permissionService$ge3 === void 0 ? void 0 : _permissionService$ge3.value) === false;
|
|
19220
19120
|
}
|
|
19221
19121
|
if (selectionProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).filter((rule) => {
|
|
19222
19122
|
return rule.ranges.some((range) => {
|
|
@@ -19235,14 +19135,13 @@ function getRemovePermissionDisable$(accessor) {
|
|
|
19235
19135
|
}));
|
|
19236
19136
|
}
|
|
19237
19137
|
function getViewPermissionDisable$(accessor) {
|
|
19238
|
-
var _editorBridgeService$2;
|
|
19239
19138
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
19240
19139
|
const permissionService = accessor.get(IPermissionService);
|
|
19241
19140
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
19242
19141
|
const userManagerService = accessor.get(UserManagerService);
|
|
19243
19142
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
19244
19143
|
const formulaEditorFocus$ = accessor.get(IContextService).subscribeContextValue$(FOCUSING_FX_BAR_EDITOR);
|
|
19245
|
-
const editorVisible$ = (
|
|
19144
|
+
const editorVisible$ = (editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$) ?? of(null);
|
|
19246
19145
|
return combineLatest([
|
|
19247
19146
|
workbook$,
|
|
19248
19147
|
userManagerService.currentUser$,
|
|
@@ -19251,10 +19150,10 @@ function getViewPermissionDisable$(accessor) {
|
|
|
19251
19150
|
]).pipe(switchMap(([workbook, _, visible, formulaEditorFocus]) => {
|
|
19252
19151
|
if (!workbook || (visible === null || visible === void 0 ? void 0 : visible.visible) && visible.unitId === workbook.getUnitId() || formulaEditorFocus) return of(true);
|
|
19253
19152
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19254
|
-
var _permissionService$
|
|
19153
|
+
var _permissionService$ge4;
|
|
19255
19154
|
if (!worksheet) return of(true);
|
|
19256
19155
|
const unitId = workbook.getUnitId();
|
|
19257
|
-
return ((
|
|
19156
|
+
return (((_permissionService$ge4 = permissionService.getPermissionPoint$(new WorkbookEditablePermission(unitId).id)) === null || _permissionService$ge4 === void 0 ? void 0 : _permissionService$ge4.pipe(map((e) => !!e.value))) ?? of(false)).pipe(map((permission) => !permission));
|
|
19258
19157
|
}));
|
|
19259
19158
|
}));
|
|
19260
19159
|
}
|
|
@@ -19685,7 +19584,7 @@ const menuSchema = {
|
|
|
19685
19584
|
order: 0,
|
|
19686
19585
|
gridLayout: {
|
|
19687
19586
|
row: 1,
|
|
19688
|
-
column:
|
|
19587
|
+
column: 1
|
|
19689
19588
|
},
|
|
19690
19589
|
menuItemFactory: HorizontalAlignMenuItemFactory
|
|
19691
19590
|
},
|
|
@@ -19750,7 +19649,9 @@ const menuSchema = {
|
|
|
19750
19649
|
order: 0,
|
|
19751
19650
|
gridLayout: {
|
|
19752
19651
|
row: 1,
|
|
19753
|
-
column:
|
|
19652
|
+
column: 1,
|
|
19653
|
+
rowSpan: 2,
|
|
19654
|
+
showLabel: true
|
|
19754
19655
|
},
|
|
19755
19656
|
menuItemFactory: sheetPermissionToolbarMenuFactory
|
|
19756
19657
|
} }
|
|
@@ -20322,18 +20223,12 @@ function AutoFillPopupMenu() {
|
|
|
20322
20223
|
const selected = useObservable(autoFillService.applyType$, AUTO_FILL_APPLY_TYPE.SERIES);
|
|
20323
20224
|
const [isHovered, setHovered] = useState(false);
|
|
20324
20225
|
const workbook = useActiveWorkbook();
|
|
20325
|
-
const
|
|
20226
|
+
const sheetSkeletonManagerService = useMemo(() => {
|
|
20326
20227
|
if (workbook) {
|
|
20327
|
-
const ru = renderManagerService.
|
|
20328
|
-
return
|
|
20329
|
-
sheetSkeletonManagerService: ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService),
|
|
20330
|
-
selectionRenderService: ru === null || ru === void 0 ? void 0 : ru.with(ISheetSelectionRenderService)
|
|
20331
|
-
};
|
|
20228
|
+
const ru = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
20229
|
+
return ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService);
|
|
20332
20230
|
}
|
|
20333
|
-
return
|
|
20334
|
-
sheetSkeletonManagerService: null,
|
|
20335
|
-
selectionRenderService: null
|
|
20336
|
-
};
|
|
20231
|
+
return null;
|
|
20337
20232
|
}, [workbook, renderManagerService]);
|
|
20338
20233
|
const handleMouseEnter = () => {
|
|
20339
20234
|
setHovered(true);
|
|
@@ -20364,10 +20259,11 @@ function AutoFillPopupMenu() {
|
|
|
20364
20259
|
}, [visible]);
|
|
20365
20260
|
if (anchor.col < 0 || anchor.row < 0) return null;
|
|
20366
20261
|
const sheetObject = getSheetObject(univerInstanceService, renderManagerService);
|
|
20367
|
-
if (!sheetObject || !
|
|
20262
|
+
if (!sheetObject || !workbook) return null;
|
|
20368
20263
|
const { scene } = sheetObject;
|
|
20369
20264
|
const skeleton = sheetSkeletonManagerService === null || sheetSkeletonManagerService === void 0 ? void 0 : sheetSkeletonManagerService.getCurrentSkeleton();
|
|
20370
|
-
const viewport =
|
|
20265
|
+
const viewport = getViewportByCell(anchor.row, anchor.col, scene, workbook.getActiveSheet());
|
|
20266
|
+
if (!viewport) return null;
|
|
20371
20267
|
const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
|
|
20372
20268
|
const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
|
|
20373
20269
|
const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
|
|
@@ -20433,8 +20329,7 @@ function focusSheetCellEditorElement(ownerDocument = document) {
|
|
|
20433
20329
|
return ownerDocument.activeElement === element;
|
|
20434
20330
|
}
|
|
20435
20331
|
function registerSheetCellEditorRuntimePortal(options) {
|
|
20436
|
-
|
|
20437
|
-
const ownerDocument = (_options$ownerDocumen = options.ownerDocument) !== null && _options$ownerDocumen !== void 0 ? _options$ownerDocumen : typeof document === "undefined" ? void 0 : document;
|
|
20332
|
+
const ownerDocument = options.ownerDocument ?? (typeof document === "undefined" ? void 0 : document);
|
|
20438
20333
|
if (!ownerDocument) return toDisposable(() => {});
|
|
20439
20334
|
const collection = new DisposableCollection();
|
|
20440
20335
|
const view = ownerDocument.defaultView;
|
|
@@ -20504,8 +20399,7 @@ function registerSheetCellEditorRuntimePortal(options) {
|
|
|
20504
20399
|
return collection;
|
|
20505
20400
|
}
|
|
20506
20401
|
function resolveSheetCellEditorPortalRoot(ownerDocument = document) {
|
|
20507
|
-
|
|
20508
|
-
return (_ref = ownerDocument.getElementById(SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID)) !== null && _ref !== void 0 ? _ref : ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
|
|
20402
|
+
return ownerDocument.getElementById(SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID) ?? ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
|
|
20509
20403
|
}
|
|
20510
20404
|
|
|
20511
20405
|
//#endregion
|
|
@@ -20594,27 +20488,27 @@ function isEmbedRuntimeInteractiveElement(element) {
|
|
|
20594
20488
|
return role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20595
20489
|
}
|
|
20596
20490
|
function shouldPreserveEmbedPopupFocus(embedId, ownerDocument) {
|
|
20597
|
-
var _activeElement$
|
|
20491
|
+
var _activeElement$closes;
|
|
20598
20492
|
if (!embedId) return false;
|
|
20599
20493
|
const activeElement = ownerDocument.activeElement;
|
|
20600
20494
|
if (!(activeElement instanceof HTMLElement)) return false;
|
|
20601
20495
|
if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
|
|
20602
|
-
const role =
|
|
20496
|
+
const role = activeElement.getAttribute("data-embed-runtime-focus-role") ?? ((_activeElement$closes = activeElement.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _activeElement$closes === void 0 ? void 0 : _activeElement$closes.getAttribute("data-embed-runtime-focus-role"));
|
|
20603
20497
|
return role === "child-popup" || role === "floating-menu";
|
|
20604
20498
|
}
|
|
20605
20499
|
function shouldPreserveEmbedInteractiveFocus(embedId, ownerDocument) {
|
|
20606
|
-
var _activeElement$
|
|
20500
|
+
var _activeElement$closes2;
|
|
20607
20501
|
if (!embedId) return false;
|
|
20608
20502
|
const activeElement = ownerDocument.activeElement;
|
|
20609
20503
|
if (!(activeElement instanceof HTMLElement)) return false;
|
|
20610
20504
|
if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
|
|
20611
|
-
const role =
|
|
20505
|
+
const role = activeElement.getAttribute("data-embed-runtime-focus-role") ?? ((_activeElement$closes2 = activeElement.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _activeElement$closes2 === void 0 ? void 0 : _activeElement$closes2.getAttribute("data-embed-runtime-focus-role"));
|
|
20612
20506
|
return role == null && activeElement.tagName !== "CANVAS" || role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20613
20507
|
}
|
|
20614
20508
|
function isEmbedRuntimeEditorOrPopup(target) {
|
|
20615
|
-
var _target$
|
|
20509
|
+
var _target$closest;
|
|
20616
20510
|
if (!(target instanceof HTMLElement)) return false;
|
|
20617
|
-
const role =
|
|
20511
|
+
const role = target.getAttribute("data-embed-runtime-focus-role") ?? ((_target$closest = target.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _target$closest === void 0 ? void 0 : _target$closest.getAttribute("data-embed-runtime-focus-role"));
|
|
20618
20512
|
return role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20619
20513
|
}
|
|
20620
20514
|
/**
|
|
@@ -20632,6 +20526,7 @@ function EditorContainer() {
|
|
|
20632
20526
|
const componentManager = useDependency(ComponentManager);
|
|
20633
20527
|
const editorBridgeService = useDependency(IEditorBridgeService);
|
|
20634
20528
|
const cellEditorResizeService = useDependency(SheetCellEditorResizeService);
|
|
20529
|
+
const renderManagerService = useDependency(IRenderManagerService);
|
|
20635
20530
|
const rootRef = useRef(null);
|
|
20636
20531
|
const pointerRefocusTimerRef = useRef(void 0);
|
|
20637
20532
|
const visible = useObservable(editorBridgeService.visible$);
|
|
@@ -20640,6 +20535,9 @@ function EditorContainer() {
|
|
|
20640
20535
|
const FormulaEditor = componentManager.get(EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY);
|
|
20641
20536
|
const editState = useObservable(editorBridgeService.currentEditCellState$);
|
|
20642
20537
|
const darkMode = useObservable(themeService.darkMode$, themeService.darkMode);
|
|
20538
|
+
const [showEditCellAddress, setShowEditCellAddress] = useState(false);
|
|
20539
|
+
const editCellAddress = editState ? `${numberToABC(editState.column)}${editState.row + 1}` : null;
|
|
20540
|
+
const editorBorderColor = genNormalSelectionStyle(themeService).stroke;
|
|
20643
20541
|
const focusCoordinator = injector.has(ISheetEmbedRuntimeFocusCoordinator) ? injector.get(ISheetEmbedRuntimeFocusCoordinator) : void 0;
|
|
20644
20542
|
const resolveRuntimeFocusState = () => {
|
|
20645
20543
|
var _instanceService$getF;
|
|
@@ -20656,6 +20554,24 @@ function EditorContainer() {
|
|
|
20656
20554
|
instanceService,
|
|
20657
20555
|
visible === null || visible === void 0 ? void 0 : visible.unitId
|
|
20658
20556
|
]);
|
|
20557
|
+
useEffect(() => {
|
|
20558
|
+
var _renderManagerService;
|
|
20559
|
+
setShowEditCellAddress(false);
|
|
20560
|
+
if (!(visible === null || visible === void 0 ? void 0 : visible.visible) || !(editState === null || editState === void 0 ? void 0 : editState.unitId)) return;
|
|
20561
|
+
const scrollManagerService = (_renderManagerService = renderManagerService.getRenderUnitById(editState.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(SheetScrollManagerService);
|
|
20562
|
+
if (!scrollManagerService) return;
|
|
20563
|
+
const subscription = scrollManagerService.validViewportScrollInfo$.pipe(skip(1)).subscribe((scrollInfo) => {
|
|
20564
|
+
if (scrollInfo) setShowEditCellAddress(true);
|
|
20565
|
+
});
|
|
20566
|
+
return () => subscription.unsubscribe();
|
|
20567
|
+
}, [
|
|
20568
|
+
editState === null || editState === void 0 ? void 0 : editState.column,
|
|
20569
|
+
editState === null || editState === void 0 ? void 0 : editState.row,
|
|
20570
|
+
editState === null || editState === void 0 ? void 0 : editState.sheetId,
|
|
20571
|
+
editState === null || editState === void 0 ? void 0 : editState.unitId,
|
|
20572
|
+
renderManagerService,
|
|
20573
|
+
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20574
|
+
]);
|
|
20659
20575
|
useEffect(() => {
|
|
20660
20576
|
const subscription = cellEditorManagerService.state$.subscribe((param) => {
|
|
20661
20577
|
if (param == null) return;
|
|
@@ -20692,18 +20608,17 @@ function EditorContainer() {
|
|
|
20692
20608
|
if (!disableAutoFocus) cellEditorManagerService.setFocus(true);
|
|
20693
20609
|
}, [disableAutoFocus, state]);
|
|
20694
20610
|
useEffect(() => {
|
|
20695
|
-
var _rootRef$current
|
|
20611
|
+
var _rootRef$current;
|
|
20696
20612
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
|
|
20697
20613
|
cellEditorResizeService.fitTextSize();
|
|
20698
20614
|
if (contextService.getContextValue(FOCUSING_FX_BAR_EDITOR)) return;
|
|
20699
|
-
const ownerDocument = (
|
|
20700
|
-
const ownerWindow =
|
|
20615
|
+
const ownerDocument = ((_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.ownerDocument) ?? document;
|
|
20616
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
20701
20617
|
let focusRetryFrame = 0;
|
|
20702
20618
|
let finalFocusRetryFrame = 0;
|
|
20703
20619
|
let delayedFocusTimer;
|
|
20704
20620
|
const focusCellEditorElement = () => {
|
|
20705
|
-
|
|
20706
|
-
const scope = rootRef.current ? (_resolveSheetEmbedRun = resolveSheetEmbedRuntimeDomScope(rootRef.current)) !== null && _resolveSheetEmbedRun !== void 0 ? _resolveSheetEmbedRun : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20621
|
+
const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20707
20622
|
if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
20708
20623
|
focusSheetCellEditorElement(ownerDocument);
|
|
20709
20624
|
if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
|
|
@@ -20714,9 +20629,8 @@ function EditorContainer() {
|
|
|
20714
20629
|
}, 0);
|
|
20715
20630
|
};
|
|
20716
20631
|
const focusEditor = () => {
|
|
20717
|
-
var _resolveSheetEmbedRun2;
|
|
20718
20632
|
if (contextService.getContextValue(FOCUSING_FX_BAR_EDITOR)) return;
|
|
20719
|
-
const scope = rootRef.current ?
|
|
20633
|
+
const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20720
20634
|
if (shouldPreserveEmbedPopupFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
20721
20635
|
const editor = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20722
20636
|
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(DocSelectionRenderService);
|
|
@@ -20739,7 +20653,6 @@ function EditorContainer() {
|
|
|
20739
20653
|
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20740
20654
|
]);
|
|
20741
20655
|
useEffect(() => {
|
|
20742
|
-
var _ref;
|
|
20743
20656
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible) || !rootRef.current || !focusCoordinator) return;
|
|
20744
20657
|
const rootRuntimeScope = resolveSheetEmbedRuntimeDomScope(rootRef.current);
|
|
20745
20658
|
const unitRuntimeScope = [
|
|
@@ -20749,9 +20662,9 @@ function EditorContainer() {
|
|
|
20749
20662
|
].find((resolvedScope) => resolvedScope != null);
|
|
20750
20663
|
if (rootRuntimeScope && unitRuntimeScope && rootRuntimeScope.embedId !== unitRuntimeScope.embedId) return;
|
|
20751
20664
|
const activeSessionScope = runtimeFocusState.activeSessionScope;
|
|
20752
|
-
const explicitRuntimeScope = unitRuntimeScope
|
|
20665
|
+
const explicitRuntimeScope = unitRuntimeScope ?? rootRuntimeScope;
|
|
20753
20666
|
if (activeSessionScope && rootRuntimeScope && !unitRuntimeScope && rootRuntimeScope.embedId !== activeSessionScope.embedId) return;
|
|
20754
|
-
const scope =
|
|
20667
|
+
const scope = explicitRuntimeScope ?? activeSessionScope ?? resolveActiveSheetEmbedRuntimeDomScope(rootRef.current.ownerDocument);
|
|
20755
20668
|
if (!scope) return;
|
|
20756
20669
|
const collection = new DisposableCollection();
|
|
20757
20670
|
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
@@ -20811,12 +20724,12 @@ function EditorContainer() {
|
|
|
20811
20724
|
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20812
20725
|
]);
|
|
20813
20726
|
useEffect(() => {
|
|
20814
|
-
var _rootRef$
|
|
20727
|
+
var _rootRef$current2;
|
|
20815
20728
|
if ((visible === null || visible === void 0 ? void 0 : visible.visible) || !focusCoordinator) return;
|
|
20816
20729
|
const activeSessionScope = runtimeFocusState.activeSessionScope;
|
|
20817
20730
|
const childUnitId = activeSessionScope === null || activeSessionScope === void 0 ? void 0 : activeSessionScope.childUnitId;
|
|
20818
20731
|
if (!activeSessionScope || activeSessionScope.childType !== UniverInstanceType.UNIVER_SHEET || !childUnitId || !instanceService.getUnit(childUnitId, UniverInstanceType.UNIVER_SHEET)) return;
|
|
20819
|
-
const ownerDocument = (
|
|
20732
|
+
const ownerDocument = ((_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.ownerDocument) ?? document;
|
|
20820
20733
|
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
20821
20734
|
const portalRegistration = registerSheetCellEditorRuntimePortal({
|
|
20822
20735
|
embedId: activeSessionScope.embedId,
|
|
@@ -20824,7 +20737,7 @@ function EditorContainer() {
|
|
|
20824
20737
|
interactionBoundaryService,
|
|
20825
20738
|
focusCoordinator
|
|
20826
20739
|
});
|
|
20827
|
-
const ownerWindow =
|
|
20740
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
20828
20741
|
let delayedFocusTimer;
|
|
20829
20742
|
const focusCellEditorElement = () => {
|
|
20830
20743
|
if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
|
|
@@ -20885,10 +20798,10 @@ function EditorContainer() {
|
|
|
20885
20798
|
};
|
|
20886
20799
|
}, []);
|
|
20887
20800
|
const refocusEditorAfterPointerDown = useEvent((event) => {
|
|
20888
|
-
var _rootRef$
|
|
20801
|
+
var _rootRef$current4;
|
|
20889
20802
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
|
|
20890
|
-
const ownerDocument = (
|
|
20891
|
-
const ownerWindow =
|
|
20803
|
+
const ownerDocument = ((_rootRef$current4 = rootRef.current) === null || _rootRef$current4 === void 0 ? void 0 : _rootRef$current4.ownerDocument) ?? document;
|
|
20804
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
20892
20805
|
const editor = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20893
20806
|
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(DocSelectionRenderService);
|
|
20894
20807
|
const pointerTarget = event.target;
|
|
@@ -20923,7 +20836,7 @@ function EditorContainer() {
|
|
|
20923
20836
|
unitId: editState === null || editState === void 0 ? void 0 : editState.unitId
|
|
20924
20837
|
});
|
|
20925
20838
|
});
|
|
20926
|
-
return /* @__PURE__ */
|
|
20839
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
20927
20840
|
ref: rootRef,
|
|
20928
20841
|
"data-u-comp": "editor",
|
|
20929
20842
|
className: "univer-absolute univer-z-10 univer-flex",
|
|
@@ -20938,7 +20851,16 @@ function EditorContainer() {
|
|
|
20938
20851
|
getColorFromTheme: themeService.getColorFromTheme.bind(themeService)
|
|
20939
20852
|
})
|
|
20940
20853
|
},
|
|
20941
|
-
children:
|
|
20854
|
+
children: [(visible === null || visible === void 0 ? void 0 : visible.visible) && showEditCellAddress && editCellAddress && /* @__PURE__ */ jsx("div", {
|
|
20855
|
+
"data-u-comp": "sheet-cell-editor-address",
|
|
20856
|
+
className: "univer-pointer-events-none univer-absolute univer-left-0 univer-top-0 univer-z-10 univer-whitespace-nowrap univer-rounded-t univer-px-1.5 univer-text-xs univer-leading-5",
|
|
20857
|
+
style: {
|
|
20858
|
+
backgroundColor: editorBorderColor,
|
|
20859
|
+
color: themeService.getColorFromTheme("white"),
|
|
20860
|
+
transform: "translateY(-100%)"
|
|
20861
|
+
},
|
|
20862
|
+
children: editCellAddress
|
|
20863
|
+
}), FormulaEditor && /* @__PURE__ */ jsx(FormulaEditor, {
|
|
20942
20864
|
editorId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
20943
20865
|
className: "univer-relative univer-flex univer-size-full [&_canvas]:univer-absolute",
|
|
20944
20866
|
initValue: "",
|
|
@@ -20958,7 +20880,7 @@ function EditorContainer() {
|
|
|
20958
20880
|
},
|
|
20959
20881
|
disableContextMenu: false,
|
|
20960
20882
|
canvasStyle: { backgroundColor: "transparent" }
|
|
20961
|
-
})
|
|
20883
|
+
})]
|
|
20962
20884
|
});
|
|
20963
20885
|
}
|
|
20964
20886
|
|
|
@@ -21156,7 +21078,8 @@ function DefinedName({ disable }) {
|
|
|
21156
21078
|
const definedNames = useObservable(() => definedNamesService.update$.pipe(map(getDefinedNameMap), startWith(getDefinedNameMap())), getDefinedNameMap(), false, [definedNamesService, unitId]);
|
|
21157
21079
|
useEffect(() => {
|
|
21158
21080
|
const subscription = definedNamesService.currentRange$.subscribe(() => {
|
|
21159
|
-
const
|
|
21081
|
+
const selections = selectionManagerService.getCurrentSelections();
|
|
21082
|
+
const absoluteRef = getAbsoluteRefStringFromSelection(workbook, selections, lexerTreeBuilder);
|
|
21160
21083
|
const definedName = definedNamesService.getDefinedNameByRefString(unitId, absoluteRef);
|
|
21161
21084
|
if (definedName) {
|
|
21162
21085
|
setRangeString(definedName.name);
|
|
@@ -21301,7 +21224,7 @@ function DefinedName({ disable }) {
|
|
|
21301
21224
|
//#endregion
|
|
21302
21225
|
//#region src/views/formula-bar/FormulaBar.tsx
|
|
21303
21226
|
function FormulaBar(props) {
|
|
21304
|
-
var
|
|
21227
|
+
var _editState$documentLa;
|
|
21305
21228
|
const { className, disableDefinedName } = props;
|
|
21306
21229
|
const editorBridgeService = useDependency(IEditorBridgeService);
|
|
21307
21230
|
const iconActivated = useObservable(() => editorBridgeService.visible$.pipe(map((visibleInfo) => visibleInfo.visible)), false, false, [editorBridgeService]);
|
|
@@ -21352,21 +21275,20 @@ function FormulaBar(props) {
|
|
|
21352
21275
|
}));
|
|
21353
21276
|
}), map((cellInfo) => {
|
|
21354
21277
|
if (cellInfo) {
|
|
21355
|
-
var _cellInfoWithPermissi, _cellInfoWithPermissi2;
|
|
21356
21278
|
const { unitId, subUnitId, primary } = cellInfo;
|
|
21357
21279
|
if (worksheetProtectionRuleModel.getRule(unitId, subUnitId)) {
|
|
21358
|
-
var _permissionService$ge, _permissionService$ge2
|
|
21359
|
-
const editDisable = !((_permissionService$ge =
|
|
21280
|
+
var _permissionService$ge, _permissionService$ge2;
|
|
21281
|
+
const editDisable = !(((_permissionService$ge = permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) ?? true);
|
|
21360
21282
|
return {
|
|
21361
|
-
viewDisable: !((
|
|
21283
|
+
viewDisable: !(((_permissionService$ge2 = permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)) === null || _permissionService$ge2 === void 0 ? void 0 : _permissionService$ge2.value) ?? true),
|
|
21362
21284
|
editDisable
|
|
21363
21285
|
};
|
|
21364
21286
|
}
|
|
21365
21287
|
const { actualRow, actualColumn } = primary;
|
|
21366
21288
|
const cellInfoWithPermission = rangeProtectionCache.getCellInfo(unitId, subUnitId, actualRow, actualColumn);
|
|
21367
21289
|
return {
|
|
21368
|
-
editDisable: !((
|
|
21369
|
-
viewDisable: !((
|
|
21290
|
+
editDisable: !((cellInfoWithPermission === null || cellInfoWithPermission === void 0 ? void 0 : cellInfoWithPermission[UnitAction.Edit]) ?? true),
|
|
21291
|
+
viewDisable: !((cellInfoWithPermission === null || cellInfoWithPermission === void 0 ? void 0 : cellInfoWithPermission[UnitAction.View]) ?? true)
|
|
21370
21292
|
};
|
|
21371
21293
|
}
|
|
21372
21294
|
return {
|
|
@@ -21424,7 +21346,7 @@ function FormulaBar(props) {
|
|
|
21424
21346
|
}
|
|
21425
21347
|
const { viewDisable, editDisable: permissionEditDisable } = disableInfo;
|
|
21426
21348
|
const editDisable = permissionEditDisable || !!disableEdit;
|
|
21427
|
-
const workbookEditDisable = !((
|
|
21349
|
+
const workbookEditDisable = !((workbookEditablePermission === null || workbookEditablePermission === void 0 ? void 0 : workbookEditablePermission.value) ?? true);
|
|
21428
21350
|
const editorActivationDisable = editDisable || workbookEditDisable;
|
|
21429
21351
|
const disabled = editDisable || imageDisable;
|
|
21430
21352
|
const shouldSkipFocus = useRef(false);
|
|
@@ -21457,7 +21379,7 @@ function FormulaBar(props) {
|
|
|
21457
21379
|
}, 30);
|
|
21458
21380
|
shouldSkipFocus.current = false;
|
|
21459
21381
|
};
|
|
21460
|
-
const hideEditor = (
|
|
21382
|
+
const hideEditor = isCellImage(editState === null || editState === void 0 || (_editState$documentLa = editState.documentLayoutObject.documentModel) === null || _editState$documentLa === void 0 ? void 0 : _editState$documentLa.getSnapshot()) || viewDisable;
|
|
21461
21383
|
return /* @__PURE__ */ jsxs("div", {
|
|
21462
21384
|
"data-u-comp": "formula-bar",
|
|
21463
21385
|
className: clsx("univer-box-border univer-flex univer-bg-white univer-transition-[height] univer-ease-linear dark:!univer-bg-gray-800", borderBottomClassName, className, {
|
|
@@ -21468,7 +21390,7 @@ function FormulaBar(props) {
|
|
|
21468
21390
|
children: [
|
|
21469
21391
|
/* @__PURE__ */ jsx("div", {
|
|
21470
21392
|
className: "univer-relative univer-box-border univer-h-full univer-w-[100px]",
|
|
21471
|
-
children: /* @__PURE__ */ jsx(DefinedName, { disable: disableDefinedName
|
|
21393
|
+
children: /* @__PURE__ */ jsx(DefinedName, { disable: disableDefinedName ?? editDisable })
|
|
21472
21394
|
}),
|
|
21473
21395
|
/* @__PURE__ */ jsxs("div", {
|
|
21474
21396
|
className: "univer-flex univer-size-full",
|
|
@@ -21590,7 +21512,7 @@ function SheetBarMenu() {
|
|
|
21590
21512
|
if (!workbook) return;
|
|
21591
21513
|
const sheets = workbook.getSheets();
|
|
21592
21514
|
const activeSheet = workbook.getActiveSheet();
|
|
21593
|
-
|
|
21515
|
+
const worksheetMenuItems = sheets.map((sheet, index) => {
|
|
21594
21516
|
return {
|
|
21595
21517
|
label: sheet.getName(),
|
|
21596
21518
|
index: `${index}`,
|
|
@@ -21598,7 +21520,8 @@ function SheetBarMenu() {
|
|
|
21598
21520
|
hidden: sheet.isSheetHidden() === BooleanNumber.TRUE,
|
|
21599
21521
|
selected: activeSheet === sheet
|
|
21600
21522
|
};
|
|
21601
|
-
})
|
|
21523
|
+
});
|
|
21524
|
+
setMenu(worksheetMenuItems);
|
|
21602
21525
|
}, [workbook, worksheetProtectionRuleModel]);
|
|
21603
21526
|
const setupStatusUpdate = useCallback(() => commandService.onCommandExecuted((commandInfo) => {
|
|
21604
21527
|
switch (commandInfo.id) {
|
|
@@ -21673,7 +21596,7 @@ function SheetBarItem(props) {
|
|
|
21673
21596
|
"data-id": sheetId,
|
|
21674
21597
|
role: "tab",
|
|
21675
21598
|
"aria-selected": currentSelected,
|
|
21676
|
-
tabIndex: tabIndex
|
|
21599
|
+
tabIndex: tabIndex ?? (currentSelected ? 0 : -1),
|
|
21677
21600
|
onKeyDown,
|
|
21678
21601
|
onClick,
|
|
21679
21602
|
className: clsx("univer-mx-1 univer-box-border univer-flex univer-flex-grow univer-cursor-pointer univer-select-none univer-flex-row univer-items-center univer-rounded univer-text-xs univer-transition-[colors,box-shadow] focus-visible:univer-ring-2 focus-visible:univer-ring-primary-500", {
|
|
@@ -21711,9 +21634,8 @@ function SheetBarTabsContextMenu(props) {
|
|
|
21711
21634
|
menuOffset: MENU_OFFSET,
|
|
21712
21635
|
onRequestClose: () => onVisibleChange(false),
|
|
21713
21636
|
onOptionSelect: (option) => {
|
|
21714
|
-
var _ref;
|
|
21715
21637
|
const { label, id, commandId, value } = option;
|
|
21716
|
-
onCommandSelect(
|
|
21638
|
+
onCommandSelect(commandId ?? id ?? label, value);
|
|
21717
21639
|
}
|
|
21718
21640
|
})] });
|
|
21719
21641
|
}
|
|
@@ -21877,8 +21799,7 @@ var Animate = class {
|
|
|
21877
21799
|
//#region src/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-name-editor.ts
|
|
21878
21800
|
const MAX_SHEET_NAME_LENGTH = 31;
|
|
21879
21801
|
function getEditorText(input) {
|
|
21880
|
-
|
|
21881
|
-
return (_input$textContent = input.textContent) !== null && _input$textContent !== void 0 ? _input$textContent : "";
|
|
21802
|
+
return input.textContent ?? "";
|
|
21882
21803
|
}
|
|
21883
21804
|
function keepLastTextIndex(inputHtml) {
|
|
21884
21805
|
setTimeout(() => {
|
|
@@ -22061,10 +21982,9 @@ var SlideTabItem = class SlideTabItem {
|
|
|
22061
21982
|
});
|
|
22062
21983
|
}
|
|
22063
21984
|
nameCheck() {
|
|
22064
|
-
var _input$textContent;
|
|
22065
21985
|
const input = this._slideTabItem.querySelector("span");
|
|
22066
21986
|
if (!input) return false;
|
|
22067
|
-
const text =
|
|
21987
|
+
const text = input.textContent ?? "";
|
|
22068
21988
|
return this._slideTabBar.getConfig().onNameCheckAlert(text, this.getId());
|
|
22069
21989
|
}
|
|
22070
21990
|
animate() {
|
|
@@ -22184,23 +22104,21 @@ var SlideTabItem = class SlideTabItem {
|
|
|
22184
22104
|
var SlideScrollbar = class {
|
|
22185
22105
|
constructor(slideTabBar) {
|
|
22186
22106
|
_defineProperty(this, "_slideTabBar", void 0);
|
|
22187
|
-
_defineProperty(this, "_scrollX", void 0);
|
|
22188
|
-
const primeval = slideTabBar.primeval();
|
|
22189
|
-
this._scrollX = primeval.scrollLeft;
|
|
22190
22107
|
this._slideTabBar = slideTabBar;
|
|
22191
22108
|
}
|
|
22192
22109
|
scrollX(x) {
|
|
22110
|
+
var _primeval$parentEleme;
|
|
22193
22111
|
const primeval = this._slideTabBar.primeval();
|
|
22194
|
-
primeval.
|
|
22195
|
-
|
|
22112
|
+
const viewportWidth = ((_primeval$parentEleme = primeval.parentElement) === null || _primeval$parentEleme === void 0 ? void 0 : _primeval$parentEleme.clientWidth) ?? primeval.clientWidth;
|
|
22113
|
+
const maxScrollX = Math.max(0, primeval.scrollWidth - viewportWidth);
|
|
22114
|
+
primeval.scrollLeft = Math.min(maxScrollX, Math.max(0, x));
|
|
22196
22115
|
}
|
|
22197
22116
|
scrollRight() {
|
|
22198
22117
|
const primeval = this._slideTabBar.primeval();
|
|
22199
|
-
|
|
22200
|
-
this._scrollX = primeval.scrollLeft;
|
|
22118
|
+
this.scrollX(primeval.scrollWidth);
|
|
22201
22119
|
}
|
|
22202
22120
|
getScrollX() {
|
|
22203
|
-
return this.
|
|
22121
|
+
return this._slideTabBar.primeval().scrollLeft;
|
|
22204
22122
|
}
|
|
22205
22123
|
};
|
|
22206
22124
|
var SlideTabBar = class SlideTabBar {
|
|
@@ -22339,7 +22257,14 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22339
22257
|
}
|
|
22340
22258
|
};
|
|
22341
22259
|
this._wheelAction = (wheelEvent) => {
|
|
22342
|
-
|
|
22260
|
+
var _this$_slideTabBar$pa;
|
|
22261
|
+
const viewportWidth = ((_this$_slideTabBar$pa = this._slideTabBar.parentElement) === null || _this$_slideTabBar$pa === void 0 ? void 0 : _this$_slideTabBar$pa.clientWidth) ?? this._slideTabBar.clientWidth;
|
|
22262
|
+
if (this._slideTabBar.scrollWidth <= viewportWidth) return;
|
|
22263
|
+
const dominantDelta = Math.abs(wheelEvent.deltaX) > Math.abs(wheelEvent.deltaY) ? wheelEvent.deltaX : wheelEvent.deltaY;
|
|
22264
|
+
if (dominantDelta === 0) return;
|
|
22265
|
+
const deltaModeMultiplier = wheelEvent.deltaMode === WheelEvent.DOM_DELTA_LINE ? 16 : wheelEvent.deltaMode === WheelEvent.DOM_DELTA_PAGE ? viewportWidth : 1;
|
|
22266
|
+
wheelEvent.preventDefault();
|
|
22267
|
+
this.setScroll(dominantDelta * deltaModeMultiplier);
|
|
22343
22268
|
};
|
|
22344
22269
|
this.addListener();
|
|
22345
22270
|
}
|
|
@@ -22394,15 +22319,15 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22394
22319
|
return this._activeTabItem;
|
|
22395
22320
|
}
|
|
22396
22321
|
isLeftEnd() {
|
|
22397
|
-
return this._slideTabBar.scrollLeft
|
|
22322
|
+
return this._slideTabBar.scrollLeft <= 1;
|
|
22398
22323
|
}
|
|
22399
22324
|
isRightEnd() {
|
|
22400
22325
|
const parent = this._slideTabBar.parentElement;
|
|
22401
22326
|
if (!parent) return false;
|
|
22402
|
-
return this._slideTabBar.scrollWidth - parent.clientWidth
|
|
22327
|
+
return Math.max(0, this._slideTabBar.scrollWidth - parent.clientWidth) - this._slideTabBar.scrollLeft <= 1;
|
|
22403
22328
|
}
|
|
22404
22329
|
addListener() {
|
|
22405
|
-
this._slideTabBar.addEventListener("wheel", this._wheelAction);
|
|
22330
|
+
this._slideTabBar.addEventListener("wheel", this._wheelAction, { passive: false });
|
|
22406
22331
|
this._slideTabItems.forEach((item) => {
|
|
22407
22332
|
item.addEventListener("pointerdown", this._downAction);
|
|
22408
22333
|
});
|
|
@@ -22415,13 +22340,6 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22415
22340
|
}
|
|
22416
22341
|
setScroll(x) {
|
|
22417
22342
|
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + x);
|
|
22418
|
-
if (x > 0) {
|
|
22419
|
-
const left = this.calculateLeftScrollX();
|
|
22420
|
-
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + left);
|
|
22421
|
-
} else if (x < 0) {
|
|
22422
|
-
const right = this.calculateRightScrollX();
|
|
22423
|
-
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + right);
|
|
22424
|
-
}
|
|
22425
22343
|
this._config.onScroll({
|
|
22426
22344
|
leftEnd: this.isLeftEnd(),
|
|
22427
22345
|
rightEnd: this.isRightEnd()
|
|
@@ -22441,7 +22359,7 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22441
22359
|
});
|
|
22442
22360
|
}
|
|
22443
22361
|
scrollToItem(index) {
|
|
22444
|
-
const targetIndex = index
|
|
22362
|
+
const targetIndex = index ?? this._config.currentIndex;
|
|
22445
22363
|
if (targetIndex < 0 || targetIndex >= this._slideTabItems.length) {
|
|
22446
22364
|
console.error("Index out of bounds");
|
|
22447
22365
|
return;
|
|
@@ -22630,7 +22548,6 @@ function shouldRefreshSheetTabs(commandInfo) {
|
|
|
22630
22548
|
}
|
|
22631
22549
|
}
|
|
22632
22550
|
function SheetBarTabs() {
|
|
22633
|
-
var _config$contextMenu;
|
|
22634
22551
|
const [sheetList, setSheetList] = useState([]);
|
|
22635
22552
|
const [activeSheetId, setActiveSheetId] = useState("");
|
|
22636
22553
|
const [scrollShadow, setScrollShadow] = useState("");
|
|
@@ -22652,7 +22569,7 @@ function SheetBarTabs() {
|
|
|
22652
22569
|
const workbookRef = useRef(workbook);
|
|
22653
22570
|
const resetOrder = useObservable(worksheetProtectionRuleModel.resetOrder$);
|
|
22654
22571
|
const config = useConfigValue(UI_PLUGIN_CONFIG_KEY);
|
|
22655
|
-
const showContextMenu = (
|
|
22572
|
+
const showContextMenu = (config === null || config === void 0 ? void 0 : config.contextMenu) ?? true;
|
|
22656
22573
|
const getActiveTabRect = useCallback(() => {
|
|
22657
22574
|
var _slideTabBarRef$curre;
|
|
22658
22575
|
const activeTabRect = (_slideTabBarRef$curre = slideTabBarRef.current) === null || _slideTabBarRef$curre === void 0 || (_slideTabBarRef$curre = _slideTabBarRef$curre.getActiveItem()) === null || _slideTabBarRef$curre === void 0 ? void 0 : _slideTabBarRef$curre.getSlideTabItem().getBoundingClientRect();
|
|
@@ -22731,7 +22648,7 @@ function SheetBarTabs() {
|
|
|
22731
22648
|
workbook
|
|
22732
22649
|
]);
|
|
22733
22650
|
const canRenameActiveSheet = useCallback(() => {
|
|
22734
|
-
var _permissionService$
|
|
22651
|
+
var _permissionService$ge2;
|
|
22735
22652
|
const unitId = workbook.getUnitId();
|
|
22736
22653
|
const activeSheet = workbook.getActiveSheet();
|
|
22737
22654
|
if (!activeSheet) return false;
|
|
@@ -22739,10 +22656,10 @@ function SheetBarTabs() {
|
|
|
22739
22656
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
22740
22657
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).length > 0;
|
|
22741
22658
|
if (worksheetRule || hasSelectionRule) {
|
|
22742
|
-
var _permissionService$ge
|
|
22743
|
-
return (_permissionService$ge =
|
|
22659
|
+
var _permissionService$ge;
|
|
22660
|
+
return ((_permissionService$ge = permissionService.getPermissionPoint(new WorkbookManageCollaboratorPermission(unitId).id)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) ?? false;
|
|
22744
22661
|
}
|
|
22745
|
-
return (
|
|
22662
|
+
return ((_permissionService$ge2 = permissionService.getPermissionPoint(new WorkbookRenameSheetPermission(unitId).id)) === null || _permissionService$ge2 === void 0 ? void 0 : _permissionService$ge2.value) ?? false;
|
|
22746
22663
|
}, [
|
|
22747
22664
|
permissionService,
|
|
22748
22665
|
rangeProtectionRuleModel,
|
|
@@ -22750,11 +22667,9 @@ function SheetBarTabs() {
|
|
|
22750
22667
|
worksheetProtectionRuleModel
|
|
22751
22668
|
]);
|
|
22752
22669
|
const updateSheetItems = useCallback(() => {
|
|
22753
|
-
var _activeSheet$getSheet;
|
|
22754
22670
|
const activeSheet = workbook.getActiveSheet();
|
|
22755
|
-
const currentSubUnitId = (
|
|
22756
|
-
|
|
22757
|
-
var _sheet$getTabColor;
|
|
22671
|
+
const currentSubUnitId = (activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.getSheetId()) ?? "";
|
|
22672
|
+
const sheetListItems = workbook.getSheets().filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
22758
22673
|
const worksheetRule = worksheetProtectionRuleModel.getRule(workbook.getUnitId(), sheet.getSheetId());
|
|
22759
22674
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(workbook.getUnitId(), sheet.getSheetId()).length > 0;
|
|
22760
22675
|
const hasProtection = Boolean((worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) || hasSelectionRule);
|
|
@@ -22769,9 +22684,10 @@ function SheetBarTabs() {
|
|
|
22769
22684
|
}),
|
|
22770
22685
|
index,
|
|
22771
22686
|
selected: activeSheet === sheet,
|
|
22772
|
-
color:
|
|
22687
|
+
color: sheet.getTabColor() ?? void 0
|
|
22773
22688
|
};
|
|
22774
|
-
})
|
|
22689
|
+
});
|
|
22690
|
+
setSheetList(sheetListItems);
|
|
22775
22691
|
setActiveSheetId(currentSubUnitId);
|
|
22776
22692
|
}, [
|
|
22777
22693
|
rangeProtectionRuleModel,
|
|
@@ -22803,7 +22719,7 @@ function SheetBarTabs() {
|
|
|
22803
22719
|
workbookRef.current = workbook;
|
|
22804
22720
|
}, [workbook]);
|
|
22805
22721
|
const syncActiveSheetRender = useCallback((subUnitId) => {
|
|
22806
|
-
const render = renderManagerService.
|
|
22722
|
+
const render = renderManagerService.getRenderUnitById(workbookRef.current.getUnitId());
|
|
22807
22723
|
try {
|
|
22808
22724
|
render === null || render === void 0 || render.with(SheetSkeletonManagerService).setCurrent({ sheetId: subUnitId });
|
|
22809
22725
|
render === null || render === void 0 || render.scene.makeDirty(true);
|
|
@@ -22896,7 +22812,7 @@ function SheetBarTabs() {
|
|
|
22896
22812
|
workbook
|
|
22897
22813
|
]);
|
|
22898
22814
|
const onTabListKeyDown = useCallback((event) => {
|
|
22899
|
-
var _slideTabBarContainer2
|
|
22815
|
+
var _slideTabBarContainer2;
|
|
22900
22816
|
const target = event.target;
|
|
22901
22817
|
if (target.closest("[contenteditable=true]")) return;
|
|
22902
22818
|
const currentTab = target.closest("[data-u-comp=slide-tab-item]");
|
|
@@ -22911,7 +22827,7 @@ function SheetBarTabs() {
|
|
|
22911
22827
|
return;
|
|
22912
22828
|
}
|
|
22913
22829
|
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
22914
|
-
const tabItems = Array.from((_slideTabBarContainer2 =
|
|
22830
|
+
const tabItems = Array.from(((_slideTabBarContainer2 = slideTabBarContainerRef.current) === null || _slideTabBarContainer2 === void 0 ? void 0 : _slideTabBarContainer2.querySelectorAll("[data-u-comp=slide-tab-item]")) ?? []);
|
|
22915
22831
|
const currentIndex = tabItems.findIndex((tabItem) => tabItem.dataset.id === currentSheetId);
|
|
22916
22832
|
if (currentIndex < 0) return;
|
|
22917
22833
|
event.preventDefault();
|
|
@@ -23021,13 +22937,12 @@ function SheetBarTabs() {
|
|
|
23021
22937
|
}, [activeSheetId, sheetList]);
|
|
23022
22938
|
useEffect(() => {
|
|
23023
22939
|
const handlePointerDownCapture = (event) => {
|
|
23024
|
-
var _tabElement$getAttrib;
|
|
23025
22940
|
const container = slideTabBarContainerRef.current;
|
|
23026
22941
|
const target = event.target;
|
|
23027
22942
|
if (!container || !(target instanceof Element)) return;
|
|
23028
22943
|
const tabElement = target.closest("[data-u-comp=slide-tab-item]");
|
|
23029
22944
|
if (!tabElement || !container.contains(tabElement)) return;
|
|
23030
|
-
activateSheetTab(
|
|
22945
|
+
activateSheetTab(tabElement.getAttribute("data-id") ?? void 0);
|
|
23031
22946
|
};
|
|
23032
22947
|
document.addEventListener("pointerdown", handlePointerDownCapture, true);
|
|
23033
22948
|
return () => document.removeEventListener("pointerdown", handlePointerDownCapture, true);
|
|
@@ -23174,7 +23089,10 @@ function ZoomSlider() {
|
|
|
23174
23089
|
useEffect(() => {
|
|
23175
23090
|
setZoom(getCurrentZoom());
|
|
23176
23091
|
return commandService.onCommandExecuted((commandInfo) => {
|
|
23177
|
-
if (commandInfo.id === SetZoomRatioOperation.id || commandInfo.id === SetWorksheetActiveOperation.id)
|
|
23092
|
+
if (commandInfo.id === SetZoomRatioOperation.id || commandInfo.id === SetWorksheetActiveOperation.id) {
|
|
23093
|
+
const currentZoom = getCurrentZoom();
|
|
23094
|
+
setZoom(currentZoom);
|
|
23095
|
+
}
|
|
23178
23096
|
}).dispose;
|
|
23179
23097
|
}, [commandService, getCurrentZoom]);
|
|
23180
23098
|
function handleChange(value) {
|
|
@@ -23274,8 +23192,6 @@ function formatNumber(item) {
|
|
|
23274
23192
|
const SINGLE_MODE_WIDTH = 800;
|
|
23275
23193
|
const ROW_COUNT_THRESHOLD = 3;
|
|
23276
23194
|
const StatusBar = () => {
|
|
23277
|
-
var _useConfigValue$statu, _useConfigValue;
|
|
23278
|
-
const showStatistic = (_useConfigValue$statu = (_useConfigValue = useConfigValue("sheets-ui.config")) === null || _useConfigValue === void 0 ? void 0 : _useConfigValue.statusBarStatistic) !== null && _useConfigValue$statu !== void 0 ? _useConfigValue$statu : true;
|
|
23279
23195
|
const [isSingle, setIsSingle] = useState(window.innerWidth < SINGLE_MODE_WIDTH);
|
|
23280
23196
|
const statusBarService = useDependency(IStatusBarService);
|
|
23281
23197
|
const items = statusBarService.getFunctions().map((item, index) => ({
|
|
@@ -23285,7 +23201,7 @@ const StatusBar = () => {
|
|
|
23285
23201
|
disable: false,
|
|
23286
23202
|
pattern: null
|
|
23287
23203
|
}));
|
|
23288
|
-
const useStatistics = (initialItems, statusBarService, isSingle
|
|
23204
|
+
const useStatistics = (initialItems, statusBarService, isSingle) => {
|
|
23289
23205
|
const [statistics, setStatistics] = useState(initialItems);
|
|
23290
23206
|
const [show, setShow] = useState(true);
|
|
23291
23207
|
const filteredStatistics = useMemo(() => statistics.filter((item) => item.show && !item.disable), [statistics]);
|
|
@@ -23303,31 +23219,26 @@ const StatusBar = () => {
|
|
|
23303
23219
|
}
|
|
23304
23220
|
setShow(true);
|
|
23305
23221
|
setStatistics((prevStats) => prevStats.map((stat) => {
|
|
23306
|
-
var _items$find
|
|
23222
|
+
var _items$find;
|
|
23307
23223
|
return {
|
|
23308
23224
|
...stat,
|
|
23309
|
-
value: (
|
|
23225
|
+
value: ((_items$find = items.find((i) => i.func === stat.name)) === null || _items$find === void 0 ? void 0 : _items$find.value) ?? stat.value,
|
|
23310
23226
|
disable: !items.some((i) => i.func === stat.name),
|
|
23311
|
-
pattern: (
|
|
23227
|
+
pattern: (state === null || state === void 0 ? void 0 : state.pattern) ?? null
|
|
23312
23228
|
};
|
|
23313
23229
|
}));
|
|
23314
23230
|
}, []);
|
|
23315
23231
|
useEffect(() => {
|
|
23316
|
-
if (!showStatistic) return;
|
|
23317
23232
|
const subscription = statusBarService.state$.subscribe(updateStatistics);
|
|
23318
23233
|
return () => subscription.unsubscribe();
|
|
23319
|
-
}, [
|
|
23320
|
-
showStatistic,
|
|
23321
|
-
statusBarService,
|
|
23322
|
-
updateStatistics
|
|
23323
|
-
]);
|
|
23234
|
+
}, [statusBarService, updateStatistics]);
|
|
23324
23235
|
return {
|
|
23325
23236
|
statistics,
|
|
23326
23237
|
showList,
|
|
23327
23238
|
show
|
|
23328
23239
|
};
|
|
23329
23240
|
};
|
|
23330
|
-
const { showList, show } = useStatistics(items, statusBarService, isSingle
|
|
23241
|
+
const { showList, show } = useStatistics(items, statusBarService, isSingle);
|
|
23331
23242
|
const handleResize = debounce(() => {
|
|
23332
23243
|
const newSingleState = window.innerWidth < SINGLE_MODE_WIDTH;
|
|
23333
23244
|
if (isSingle !== newSingleState) setIsSingle(newSingleState);
|
|
@@ -23339,7 +23250,6 @@ const StatusBar = () => {
|
|
|
23339
23250
|
};
|
|
23340
23251
|
}, [isSingle]);
|
|
23341
23252
|
const getStatisticLayout = (showList, rowCountThreshold, CopyableStatisticItem) => {
|
|
23342
|
-
if (!showStatistic) return null;
|
|
23343
23253
|
if (showList.length > rowCountThreshold) return showList.reduce((acc, _, index) => {
|
|
23344
23254
|
if (index % 2 === 0) acc.push(showList.slice(index, index + 2));
|
|
23345
23255
|
return acc;
|
|
@@ -23369,13 +23279,11 @@ const StatusBar = () => {
|
|
|
23369
23279
|
//#region src/views/sheet-container/SheetContainer.tsx
|
|
23370
23280
|
const SHEET_FOOTER_BAR_HEIGHT = 36;
|
|
23371
23281
|
function RenderSheetFooter() {
|
|
23372
|
-
var _config$footer;
|
|
23373
23282
|
const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23374
23283
|
const menuManagerService = useDependency(IMenuManagerService);
|
|
23375
|
-
const showFooter = (
|
|
23284
|
+
const showFooter = (config === null || config === void 0 ? void 0 : config.footer) ?? true;
|
|
23376
23285
|
const activeWorkbook = useActiveWorkbook();
|
|
23377
|
-
const
|
|
23378
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23286
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23379
23287
|
const isLoading = useSheetLoading();
|
|
23380
23288
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23381
23289
|
const focusedUnitType = useFocusedUnitType();
|
|
@@ -23414,8 +23322,7 @@ function RenderSheetFooter() {
|
|
|
23414
23322
|
function RenderSheetHeader() {
|
|
23415
23323
|
const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23416
23324
|
const activeWorkbook = useActiveWorkbook();
|
|
23417
|
-
const
|
|
23418
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23325
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23419
23326
|
const isLoading = useSheetLoading();
|
|
23420
23327
|
const hasWorkbook = !!workbook;
|
|
23421
23328
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
@@ -23440,21 +23347,19 @@ function RenderSheetHeader() {
|
|
|
23440
23347
|
return null;
|
|
23441
23348
|
}
|
|
23442
23349
|
/**
|
|
23443
|
-
*
|
|
23350
|
+
* We should not write into this component anymore.
|
|
23444
23351
|
*/
|
|
23445
23352
|
function RenderSheetContent() {
|
|
23446
|
-
var _componentManager$get;
|
|
23447
23353
|
const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23448
23354
|
const isLoading = useSheetLoading();
|
|
23449
23355
|
const isPreviewReady = useSheetLoadingPreviewReady();
|
|
23450
23356
|
const componentManager = useDependency(ComponentManager);
|
|
23451
23357
|
const activeWorkbook = useActiveWorkbook();
|
|
23452
|
-
const
|
|
23453
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23358
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23454
23359
|
const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
|
|
23455
23360
|
const injector = useDependency(Injector);
|
|
23456
23361
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23457
|
-
const ShapeTextEditorContainer =
|
|
23362
|
+
const ShapeTextEditorContainer = componentManager.get("SheetShapeTextEditorContainer") ?? componentManager.get("ShapeTextEditorContainer");
|
|
23458
23363
|
useEffect(() => {
|
|
23459
23364
|
var _tryGetSheetEmbedRunt;
|
|
23460
23365
|
if (!workbook || isLoading || activeEmbedTab || activeWorkbookEmbeddedRender) return;
|
|
@@ -23564,11 +23469,10 @@ function useFocusedUnitType() {
|
|
|
23564
23469
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
23565
23470
|
const focusedUnitId = useObservable(() => univerInstanceService.focused$, null, false, [univerInstanceService]);
|
|
23566
23471
|
return useMemo(() => {
|
|
23567
|
-
var _focusedUnit$type;
|
|
23568
23472
|
if (!focusedUnitId) return null;
|
|
23569
23473
|
if (isInternalEditorID(focusedUnitId) && univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) return UniverInstanceType.UNIVER_SHEET;
|
|
23570
23474
|
const focusedUnit = univerInstanceService.getUnit(focusedUnitId);
|
|
23571
|
-
return (
|
|
23475
|
+
return (focusedUnit === null || focusedUnit === void 0 ? void 0 : focusedUnit.type) ?? null;
|
|
23572
23476
|
}, [focusedUnitId, univerInstanceService]);
|
|
23573
23477
|
}
|
|
23574
23478
|
function useActiveSheetEmbedTabData(workbook) {
|
|
@@ -24152,7 +24056,7 @@ let SheetUIController = class SheetUIController extends Disposable {
|
|
|
24152
24056
|
}
|
|
24153
24057
|
_initFocusHandler() {
|
|
24154
24058
|
this.disposeWithMe(this._layoutService.registerFocusHandler(UniverInstanceType.UNIVER_SHEET, (_unitId) => {
|
|
24155
|
-
const cellEditorRender = this._injector.get(IRenderManagerService).
|
|
24059
|
+
const cellEditorRender = this._injector.get(IRenderManagerService).getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
24156
24060
|
const docSelectionRenderService = cellEditorRender === null || cellEditorRender === void 0 ? void 0 : cellEditorRender.with(DocSelectionRenderService);
|
|
24157
24061
|
docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
24158
24062
|
}));
|
|
@@ -24194,7 +24098,7 @@ const useHighlightRange = (ranges = []) => {
|
|
|
24194
24098
|
//#endregion
|
|
24195
24099
|
//#region package.json
|
|
24196
24100
|
var name = "@univerjs/sheets-ui";
|
|
24197
|
-
var version = "1.0.0-
|
|
24101
|
+
var version = "1.0.0-beta.0";
|
|
24198
24102
|
|
|
24199
24103
|
//#endregion
|
|
24200
24104
|
//#region src/views/cell-popup/config.ts
|
|
@@ -24287,13 +24191,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24287
24191
|
_createHiddenRectObserver(params) {
|
|
24288
24192
|
const { row, column, worksheet, skeleton, currentRender } = params;
|
|
24289
24193
|
const calc = () => {
|
|
24290
|
-
var _columnWidthAccumulat, _rowHeightAccumulatio;
|
|
24291
24194
|
const { startRow: freezeStartRow, startColumn: freezeStartColumn, xSplit, ySplit } = worksheet.getFreeze();
|
|
24292
24195
|
const startRow = freezeStartRow - ySplit;
|
|
24293
24196
|
const startColumn = freezeStartColumn - xSplit;
|
|
24294
24197
|
const { rowHeightAccumulation, columnWidthAccumulation, rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
24295
|
-
const canvasFreezeWidth = rowHeaderWidth + (startColumn === -1 ? 0 : columnWidthAccumulation[startColumn + xSplit - 1] - (
|
|
24296
|
-
const canvasFreezeHeight = columnHeaderHeight + (startRow === -1 ? 0 : rowHeightAccumulation[startRow + ySplit - 1] - (
|
|
24198
|
+
const canvasFreezeWidth = rowHeaderWidth + (startColumn === -1 ? 0 : columnWidthAccumulation[startColumn + xSplit - 1] - (columnWidthAccumulation[startColumn - 1] ?? 0));
|
|
24199
|
+
const canvasFreezeHeight = columnHeaderHeight + (startRow === -1 ? 0 : rowHeightAccumulation[startRow + ySplit - 1] - (rowHeightAccumulation[startRow] ?? 0));
|
|
24297
24200
|
const canvasElement = currentRender.engine.getCanvasElement();
|
|
24298
24201
|
const canvasClientRect = canvasElement.getBoundingClientRect();
|
|
24299
24202
|
const widthOfCanvas = pxToNum(canvasElement.style.width);
|
|
@@ -24387,8 +24290,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24387
24290
|
};
|
|
24388
24291
|
const unitId = workbook.getUnitId();
|
|
24389
24292
|
const subUnitId = worksheet.getSheetId();
|
|
24390
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
24391
|
-
const currentRender = this._renderManagerService.
|
|
24293
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24294
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24392
24295
|
if (!currentRender || !skeleton) return {
|
|
24393
24296
|
dispose: () => {},
|
|
24394
24297
|
canDispose: () => true
|
|
@@ -24441,8 +24344,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24441
24344
|
const subUnitId = worksheet.getSheetId();
|
|
24442
24345
|
if (unitId !== location.unitId || location.subUnitId !== subUnitId) return null;
|
|
24443
24346
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24444
|
-
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.
|
|
24445
|
-
const currentRender = this._renderManagerService.
|
|
24347
|
+
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24348
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24446
24349
|
if (!currentRender || !skeleton) return null;
|
|
24447
24350
|
const { position, position$, disposable } = this._createPositionObserver(bound, currentRender, skeleton, worksheet);
|
|
24448
24351
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24495,8 +24398,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24495
24398
|
const unitId = workbook.getUnitId();
|
|
24496
24399
|
const subUnitId = worksheet.getSheetId();
|
|
24497
24400
|
if (_unitId && unitId !== _unitId || _subUnitId && _subUnitId !== subUnitId) return null;
|
|
24498
|
-
const skeleton = (_this$_renderManagerS3 = this._renderManagerService.
|
|
24499
|
-
const currentRender = this._renderManagerService.
|
|
24401
|
+
const skeleton = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24402
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24500
24403
|
if (!currentRender || !skeleton) return null;
|
|
24501
24404
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24502
24405
|
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
@@ -24538,12 +24441,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24538
24441
|
if (!worksheet) return null;
|
|
24539
24442
|
const unitId = workbook.getUnitId();
|
|
24540
24443
|
const subUnitId = worksheet.getSheetId();
|
|
24541
|
-
const currentRender = this._renderManagerService.
|
|
24444
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24542
24445
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24543
24446
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24544
24447
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
24545
24448
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24546
|
-
const activeViewport = viewport
|
|
24449
|
+
const activeViewport = viewport ?? getViewportByCell(row, col, currentRender.scene, worksheet);
|
|
24547
24450
|
if (!activeViewport) return null;
|
|
24548
24451
|
const { position, position$, disposable: positionObserverDisposable, updateRowCol } = this._createCellPositionObserver(row, col, currentRender, skeleton, activeViewport);
|
|
24549
24452
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24607,12 +24510,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24607
24510
|
const unitId = workbook.getUnitId();
|
|
24608
24511
|
const subUnitId = worksheet.getSheetId();
|
|
24609
24512
|
if (_unitId && unitId !== _unitId || _subUnitId && subUnitId !== _subUnitId) return null;
|
|
24610
|
-
const currentRender = this._renderManagerService.
|
|
24513
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24611
24514
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24612
24515
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24613
24516
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
24614
24517
|
if (sheetSelectionRenderService.selectionMoving && !showOnSelectionMoving) return;
|
|
24615
|
-
const activeViewport = viewport
|
|
24518
|
+
const activeViewport = viewport ?? getViewportByCell(range.startRow, range.startColumn, currentRender.scene, worksheet);
|
|
24616
24519
|
if (!activeViewport) return null;
|
|
24617
24520
|
const { position, position$, disposable: positionObserverDisposable, updateRange, topLeftPos$, rightBottomPos$ } = this._createRangePositionObserver(range, currentRender, skeleton, activeViewport);
|
|
24618
24521
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24853,12 +24756,12 @@ let CellPopupManagerService = class CellPopupManagerService extends Disposable {
|
|
|
24853
24756
|
return subUnitMap;
|
|
24854
24757
|
}
|
|
24855
24758
|
showPopup(location, popup) {
|
|
24856
|
-
var _subUnitMap$getValue
|
|
24759
|
+
var _subUnitMap$getValue;
|
|
24857
24760
|
const { direction = "horizontal" } = popup;
|
|
24858
24761
|
const { unitId, subUnitId, row, col } = location;
|
|
24859
24762
|
const subUnitMap = this._ensureCellPopupMap(unitId, subUnitId);
|
|
24860
24763
|
const directionCache = (_subUnitMap$getValue = subUnitMap.getValue(row, col)) === null || _subUnitMap$getValue === void 0 ? void 0 : _subUnitMap$getValue[direction];
|
|
24861
|
-
popup.id =
|
|
24764
|
+
popup.id = popup.id ?? generateRandomId();
|
|
24862
24765
|
const hidePopup = () => {
|
|
24863
24766
|
const root = subUnitMap.getValue(row, col);
|
|
24864
24767
|
if (!root) return;
|
|
@@ -25612,7 +25515,6 @@ function getBorderStyle(borderData) {
|
|
|
25612
25515
|
}
|
|
25613
25516
|
}
|
|
25614
25517
|
function BorderPanel(props) {
|
|
25615
|
-
var _value$color;
|
|
25616
25518
|
const iconManager = useDependency(IconManager);
|
|
25617
25519
|
const borderStyleManagerService = useDependency(BorderStyleManagerService);
|
|
25618
25520
|
const selectionManagerService = useDependency(SheetsSelectionsService);
|
|
@@ -25662,7 +25564,7 @@ function BorderPanel(props) {
|
|
|
25662
25564
|
type: "button",
|
|
25663
25565
|
children: [/* @__PURE__ */ jsx(PaintBucketDoubleIcon, {
|
|
25664
25566
|
className: "univer-fill-primary-600 dark:!univer-text-white",
|
|
25665
|
-
extend: { colorChannel1: (
|
|
25567
|
+
extend: { colorChannel1: (value === null || value === void 0 ? void 0 : value.color) ?? "" }
|
|
25666
25568
|
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-white" })]
|
|
25667
25569
|
})
|
|
25668
25570
|
}) }), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Dropdown, {
|
|
@@ -25685,7 +25587,7 @@ function BorderPanel(props) {
|
|
|
25685
25587
|
type: "button",
|
|
25686
25588
|
children: [/* @__PURE__ */ jsx(BorderLine, {
|
|
25687
25589
|
className: "univer-fill-gray-900 dark:!univer-fill-white",
|
|
25688
|
-
type: type
|
|
25590
|
+
type: type ?? BorderStyleTypes.THIN
|
|
25689
25591
|
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-white" })]
|
|
25690
25592
|
})
|
|
25691
25593
|
}) })]
|
|
@@ -25730,7 +25632,7 @@ let CellAlertManagerService = class CellAlertManagerService extends Disposable {
|
|
|
25730
25632
|
}
|
|
25731
25633
|
const { location } = alert;
|
|
25732
25634
|
const { row, col, unitId, subUnitId } = location;
|
|
25733
|
-
if (!this._renderManagerService.
|
|
25635
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
25734
25636
|
const disposable = this._cellPopupManagerService.showPopup({
|
|
25735
25637
|
unitId,
|
|
25736
25638
|
subUnitId,
|
|
@@ -25821,9 +25723,8 @@ const CellPopup = (props) => {
|
|
|
25821
25723
|
"data-u-comp": "sheets-ui-cell-popup",
|
|
25822
25724
|
className: "univer-ml-px univer-flex univer-flex-col",
|
|
25823
25725
|
children: popups.map((popup) => {
|
|
25824
|
-
var _popup$id;
|
|
25825
25726
|
const Component = componentManager.get(popup.componentKey);
|
|
25826
|
-
return Component ? /* @__PURE__ */ jsx(Component, { popup },
|
|
25727
|
+
return Component ? /* @__PURE__ */ jsx(Component, { popup }, popup.id ?? popup.componentKey) : null;
|
|
25827
25728
|
})
|
|
25828
25729
|
});
|
|
25829
25730
|
};
|
|
@@ -25927,7 +25828,7 @@ function DefinedNameInputContent(props) {
|
|
|
25927
25828
|
const [isFocusFormulaEditor, setIsFocusFormulaEditor] = useState(false);
|
|
25928
25829
|
useSidebarClick((e) => {
|
|
25929
25830
|
var _formulaEditorRef$cur;
|
|
25930
|
-
|
|
25831
|
+
(_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
|
|
25931
25832
|
});
|
|
25932
25833
|
return /* @__PURE__ */ jsxs("div", {
|
|
25933
25834
|
className: clsx("univer-grid univer-space-y-2 univer-pb-1", borderBottomClassName, { "univer-hidden": !state }),
|
|
@@ -26065,8 +25966,7 @@ const DefinedNameContainer = () => {
|
|
|
26065
25966
|
if (!workbook || !unitId) return;
|
|
26066
25967
|
const checkWorkbookPermission = permissionState.workbook;
|
|
26067
25968
|
const checkDefinedNamePermission = (definedName) => {
|
|
26068
|
-
|
|
26069
|
-
return (_permissionState$work = permissionState.worksheets.get(definedName.id)) !== null && _permissionState$work !== void 0 ? _permissionState$work : checkWorkbookPermission;
|
|
25969
|
+
return permissionState.worksheets.get(definedName.id) ?? checkWorkbookPermission;
|
|
26070
25970
|
};
|
|
26071
25971
|
const insertConfirm = (param) => {
|
|
26072
25972
|
const { name, formulaOrRefString, comment, localSheetId, hidden } = param;
|
|
@@ -26269,7 +26169,7 @@ function CascaderDropdown(props) {
|
|
|
26269
26169
|
const { popup } = props;
|
|
26270
26170
|
const { extraProps } = popup;
|
|
26271
26171
|
const { options, defaultValue, onChange } = extraProps;
|
|
26272
|
-
const [localValue, setLocalValue] = useState(defaultValue
|
|
26172
|
+
const [localValue, setLocalValue] = useState(defaultValue ?? []);
|
|
26273
26173
|
return /* @__PURE__ */ jsx(CascaderList, {
|
|
26274
26174
|
options,
|
|
26275
26175
|
value: localValue,
|
|
@@ -26314,7 +26214,7 @@ function DateDropdown(props) {
|
|
|
26314
26214
|
}
|
|
26315
26215
|
}) : /* @__PURE__ */ jsx(Calendar, {
|
|
26316
26216
|
value: date.toDate(),
|
|
26317
|
-
showTime: showTime
|
|
26217
|
+
showTime: showTime ?? patternType === "datetime",
|
|
26318
26218
|
onValueChange: (newValue) => {
|
|
26319
26219
|
setLocalDate(dateKit(newValue));
|
|
26320
26220
|
}
|
|
@@ -26467,13 +26367,12 @@ function SelectList(props) {
|
|
|
26467
26367
|
});
|
|
26468
26368
|
}
|
|
26469
26369
|
function ListDropDown(props) {
|
|
26470
|
-
var _anchorRect$right, _anchorRect$left;
|
|
26471
26370
|
const { popup: { extraProps, anchorRect } } = props;
|
|
26472
26371
|
const { location, hideFn, onChange, onEdit, options, defaultValue, multiple, showSearch, showEdit } = extraProps;
|
|
26473
26372
|
const { worksheet } = location;
|
|
26474
26373
|
const [localValue, setLocalValue] = useState(defaultValue);
|
|
26475
26374
|
if (!worksheet) return null;
|
|
26476
|
-
const cellWidth = ((
|
|
26375
|
+
const cellWidth = ((anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.right) ?? 0) - ((anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.left) ?? 0);
|
|
26477
26376
|
return /* @__PURE__ */ jsx(SelectList, {
|
|
26478
26377
|
style: {
|
|
26479
26378
|
minWidth: cellWidth,
|
|
@@ -26482,8 +26381,8 @@ function ListDropDown(props) {
|
|
|
26482
26381
|
value: getListDropdownValue(localValue, multiple),
|
|
26483
26382
|
multiple,
|
|
26484
26383
|
onChange: async (newValue) => {
|
|
26485
|
-
|
|
26486
|
-
setLocalValue(
|
|
26384
|
+
const str = multiple ? serializeListOptions(newValue) : newValue[0] ?? "";
|
|
26385
|
+
setLocalValue(str);
|
|
26487
26386
|
if (!(await (onChange === null || onChange === void 0 ? void 0 : onChange(newValue)) === false)) hideFn();
|
|
26488
26387
|
},
|
|
26489
26388
|
options,
|
|
@@ -26570,13 +26469,14 @@ const SheetPermissionDialog = () => {
|
|
|
26570
26469
|
actions: defaultWorksheetUnitActionList
|
|
26571
26470
|
}).then((result) => {
|
|
26572
26471
|
if (cancelled) return;
|
|
26573
|
-
|
|
26472
|
+
const actions = result[0].strategies.reduce((p, c) => {
|
|
26574
26473
|
if (subUnitPermissionTypeMap[c.action]) p[c.action] = {
|
|
26575
26474
|
text: localeService.t(`sheets-ui.permission.panel.${subUnitPermissionTypeMap[c.action]}`),
|
|
26576
26475
|
allowed: c.role !== UnitRole.Owner
|
|
26577
26476
|
};
|
|
26578
26477
|
return p;
|
|
26579
|
-
}, {})
|
|
26478
|
+
}, {});
|
|
26479
|
+
setPermissionMap(actions);
|
|
26580
26480
|
loadingTimer = setTimeout(() => {
|
|
26581
26481
|
setLoading(false);
|
|
26582
26482
|
}, 100);
|
|
@@ -26738,13 +26638,13 @@ const checkRangesIsWholeSheet = (ranges, sheet) => {
|
|
|
26738
26638
|
return startRow === 0 && startColumn === 0 && endRow === rowCount - 1 && endColumn === colCount - 1;
|
|
26739
26639
|
};
|
|
26740
26640
|
const generateDefaultRule = (injector, fromSheetBar) => {
|
|
26741
|
-
var _selectionManagerServ
|
|
26641
|
+
var _selectionManagerServ;
|
|
26742
26642
|
const univerInstanceService = injector.get(IUniverInstanceService);
|
|
26743
26643
|
const selectionManagerService = injector.get(SheetsSelectionsService);
|
|
26744
26644
|
const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
26745
26645
|
const worksheet = workbook.getActiveSheet();
|
|
26746
26646
|
let unitType = UnitObject.SelectRange;
|
|
26747
|
-
let ranges = (_selectionManagerServ =
|
|
26647
|
+
let ranges = ((_selectionManagerServ = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((s) => s.range)) ?? [];
|
|
26748
26648
|
if (fromSheetBar) {
|
|
26749
26649
|
unitType = UnitObject.Worksheet;
|
|
26750
26650
|
ranges = [{
|
|
@@ -26971,7 +26871,8 @@ const PermissionDetailMainPart = (props) => {
|
|
|
26971
26871
|
setEndForRange(range, worksheet.getRowCount(), worksheet.getColumnCount());
|
|
26972
26872
|
return range;
|
|
26973
26873
|
});
|
|
26974
|
-
|
|
26874
|
+
const rangeErrorString = checkRangeValid(injector, transformedRange, permissionId, unitId, subUnitId);
|
|
26875
|
+
onRangesChange(transformedRange, rangeErrorString);
|
|
26975
26876
|
};
|
|
26976
26877
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FormLayout, {
|
|
26977
26878
|
className: "univer-font-medium",
|
|
@@ -27016,7 +26917,6 @@ const UserEmptyBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAADwC
|
|
|
27016
26917
|
//#endregion
|
|
27017
26918
|
//#region src/views/permission/panel-detail/PermissionDetailUserPart.tsx
|
|
27018
26919
|
const PermissionDetailUserPart = (props) => {
|
|
27019
|
-
var _workbook$getUnitId;
|
|
27020
26920
|
const { editState, onEditStateChange, viewState, onViewStateChange, permissionId } = props;
|
|
27021
26921
|
const localeService = useDependency(LocaleService);
|
|
27022
26922
|
const dialogService = useDependency(IDialogService);
|
|
@@ -27027,7 +26927,7 @@ const PermissionDetailUserPart = (props) => {
|
|
|
27027
26927
|
const selectUserList = useObservable(sheetPermissionUserManagerService.selectUserList$, sheetPermissionUserManagerService.selectUserList);
|
|
27028
26928
|
const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
27029
26929
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
27030
|
-
const unitId = (
|
|
26930
|
+
const unitId = (workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) ?? "";
|
|
27031
26931
|
const handleEditStateChange = useEvent(onEditStateChange);
|
|
27032
26932
|
const handleAddPerson = async () => {
|
|
27033
26933
|
const userList = await authzIoService.listCollaborators({
|
|
@@ -27044,7 +26944,6 @@ const PermissionDetailUserPart = (props) => {
|
|
|
27044
26944
|
title: { title: "" },
|
|
27045
26945
|
children: { label: UNIVER_SHEET_PERMISSION_USER_DIALOG },
|
|
27046
26946
|
width: "auto",
|
|
27047
|
-
destroyOnClose: true,
|
|
27048
26947
|
closable: false,
|
|
27049
26948
|
onClose: () => dialogService.close(UNIVER_SHEET_PERMISSION_USER_DIALOG_ID),
|
|
27050
26949
|
className: "sheet-permission-user-dialog"
|
|
@@ -27178,7 +27077,6 @@ const PermissionDetailUserPart = (props) => {
|
|
|
27178
27077
|
//#endregion
|
|
27179
27078
|
//#region src/views/permission/panel-detail/PermissionDetailPanel.tsx
|
|
27180
27079
|
const SheetPermissionPanelDetail = (props) => {
|
|
27181
|
-
var _activeRule$editState, _activeRule$viewState;
|
|
27182
27080
|
const { fromSheetBar, rule, oldRule } = props;
|
|
27183
27081
|
const injector = useDependency(Injector);
|
|
27184
27082
|
const componentManager = useDependency(ComponentManager);
|
|
@@ -27188,10 +27086,9 @@ const SheetPermissionPanelDetail = (props) => {
|
|
|
27188
27086
|
return checkRangeValid(injector, activeRule.ranges, activeRule.permissionId, activeRule.unitId, activeRule.subUnitId);
|
|
27189
27087
|
});
|
|
27190
27088
|
const [desc, setDesc] = useState(activeRule.description);
|
|
27191
|
-
const [editState, setEditState] = useState(
|
|
27192
|
-
const [viewState, setViewState] = useState(
|
|
27193
|
-
const
|
|
27194
|
-
const PermissionDetailUser = CustomPermissionDetailUserPart !== null && CustomPermissionDetailUserPart !== void 0 ? CustomPermissionDetailUserPart : PermissionDetailUserPart;
|
|
27089
|
+
const [editState, setEditState] = useState(activeRule.editState ?? EditStateEnum.OnlyMe);
|
|
27090
|
+
const [viewState, setViewState] = useState(activeRule.viewState ?? ViewStateEnum.OthersCanView);
|
|
27091
|
+
const PermissionDetailUser = componentManager.get("UNIVER_SHEET_PERMISSION_USER_PART") ?? PermissionDetailUserPart;
|
|
27195
27092
|
useEffect(() => {
|
|
27196
27093
|
const univerInstanceService = injector.get(IUniverInstanceService);
|
|
27197
27094
|
const sidebarService = injector.get(ISidebarService);
|
|
@@ -27403,7 +27300,7 @@ function SheetPermissionPanelListContent() {
|
|
|
27403
27300
|
})]
|
|
27404
27301
|
}),
|
|
27405
27302
|
(ruleList === null || ruleList === void 0 ? void 0 : ruleList.length) > 0 ? /* @__PURE__ */ jsx("div", { children: ruleList === null || ruleList === void 0 ? void 0 : ruleList.map((item) => {
|
|
27406
|
-
var _item$creator, _item$creator2, _item$
|
|
27303
|
+
var _item$creator, _item$creator2, _item$creator3, _item$creator4;
|
|
27407
27304
|
const rule = allRuleMap.get(item.objectID);
|
|
27408
27305
|
if (!rule) return null;
|
|
27409
27306
|
const editAction = item.actions.find((action) => action.action === UnitAction.Edit);
|
|
@@ -27479,7 +27376,7 @@ function SheetPermissionPanelListContent() {
|
|
|
27479
27376
|
className: "univer-flex univer-items-center",
|
|
27480
27377
|
children: [
|
|
27481
27378
|
/* @__PURE__ */ jsx(Tooltip, {
|
|
27482
|
-
title: (
|
|
27379
|
+
title: ((_item$creator3 = item.creator) === null || _item$creator3 === void 0 ? void 0 : _item$creator3.name) ?? "",
|
|
27483
27380
|
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Avatar, {
|
|
27484
27381
|
src: (_item$creator4 = item.creator) === null || _item$creator4 === void 0 ? void 0 : _item$creator4.avatar,
|
|
27485
27382
|
className: "univer-mr-1.5",
|
|
@@ -27573,19 +27470,19 @@ const SheetPermissionPanel = ({ showDetail, fromSheetBar, rule, oldRule }) => {
|
|
|
27573
27470
|
//#endregion
|
|
27574
27471
|
//#region src/views/permission/SheetPermissionUserDialog.tsx
|
|
27575
27472
|
const SheetPermissionUserDialog = () => {
|
|
27576
|
-
var
|
|
27473
|
+
var _authzIoService$getCf;
|
|
27577
27474
|
const [inputValue, setInputValue] = useState("");
|
|
27578
27475
|
const localeService = useDependency(LocaleService);
|
|
27579
27476
|
const dialogService = useDependency(IDialogService);
|
|
27580
27477
|
const sheetPermissionUserManagerService = useDependency(SheetPermissionUserManagerService);
|
|
27581
27478
|
const authzIoService = useDependency(IAuthzIoService);
|
|
27582
27479
|
const userList = useObservable(sheetPermissionUserManagerService.userList$, sheetPermissionUserManagerService.userList);
|
|
27583
|
-
const searchUserList = (
|
|
27480
|
+
const searchUserList = (userList === null || userList === void 0 ? void 0 : userList.filter((item) => {
|
|
27584
27481
|
var _item$subject;
|
|
27585
27482
|
return ((_item$subject = item.subject) === null || _item$subject === void 0 ? void 0 : _item$subject.name.toLocaleLowerCase().includes(inputValue.toLocaleLowerCase())) && (item.role === UnitRole.Owner || item.role === UnitRole.Editor);
|
|
27586
|
-
}))
|
|
27483
|
+
})) ?? [];
|
|
27587
27484
|
const [selectUserInfo, setSelectUserInfo] = useState(sheetPermissionUserManagerService.selectUserList);
|
|
27588
|
-
const cfgEnableObjInherit = (_authzIoService$getCf =
|
|
27485
|
+
const cfgEnableObjInherit = ((_authzIoService$getCf = authzIoService.getCfgEnableObjInherit) === null || _authzIoService$getCf === void 0 ? void 0 : _authzIoService$getCf.call(authzIoService)) ?? false;
|
|
27589
27486
|
const handleChangeUser = (item) => {
|
|
27590
27487
|
if ((selectUserInfo === null || selectUserInfo === void 0 ? void 0 : selectUserInfo.findIndex((v) => {
|
|
27591
27488
|
var _v$subject, _item$subject2;
|
|
@@ -27593,10 +27490,13 @@ const SheetPermissionUserDialog = () => {
|
|
|
27593
27490
|
})) === -1) {
|
|
27594
27491
|
const select = { ...item };
|
|
27595
27492
|
setSelectUserInfo([...selectUserInfo, select]);
|
|
27596
|
-
} else
|
|
27597
|
-
|
|
27598
|
-
|
|
27599
|
-
|
|
27493
|
+
} else {
|
|
27494
|
+
const newSelectUserInfo = selectUserInfo.filter((v) => {
|
|
27495
|
+
var _v$subject2, _item$subject3;
|
|
27496
|
+
return ((_v$subject2 = v.subject) === null || _v$subject2 === void 0 ? void 0 : _v$subject2.userID) !== ((_item$subject3 = item.subject) === null || _item$subject3 === void 0 ? void 0 : _item$subject3.userID);
|
|
27497
|
+
});
|
|
27498
|
+
setSelectUserInfo(newSelectUserInfo);
|
|
27499
|
+
}
|
|
27600
27500
|
};
|
|
27601
27501
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
27602
27502
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Input, {
|
|
@@ -27961,7 +27861,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
27961
27861
|
}
|
|
27962
27862
|
_getEditorViewModel(unitId) {
|
|
27963
27863
|
var _this$_renderManagerS;
|
|
27964
|
-
return (_this$_renderManagerS = this._renderManagerService.
|
|
27864
|
+
return (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService).getViewModel();
|
|
27965
27865
|
}
|
|
27966
27866
|
_syncFormulaEditorContent() {
|
|
27967
27867
|
this.disposeWithMe(this._editorBridgeService.currentEditCellState$.subscribe((editCellState) => {
|
|
@@ -28030,7 +27930,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
28030
27930
|
}
|
|
28031
27931
|
_syncActionsAndRender(unitId, parmas) {
|
|
28032
27932
|
const INCLUDE_LIST = [DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];
|
|
28033
|
-
const currentRender = this._renderManagerService.
|
|
27933
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
28034
27934
|
if (currentRender == null) return;
|
|
28035
27935
|
const skeleton = currentRender.with(DocSkeletonManagerService).getSkeleton();
|
|
28036
27936
|
const docDataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
@@ -28057,16 +27957,16 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
28057
27957
|
if (body.paragraphs) body.paragraphs = this._clearParagraph(body.paragraphs);
|
|
28058
27958
|
}
|
|
28059
27959
|
const INCLUDE_LIST = [DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];
|
|
28060
|
-
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.
|
|
27960
|
+
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSkeletonManagerService).getSkeleton();
|
|
28061
27961
|
const docDataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
28062
27962
|
const docViewModel = this._getEditorViewModel(unitId);
|
|
28063
27963
|
if (docDataModel == null || docViewModel == null || skeleton == null) return;
|
|
28064
27964
|
docDataModel.getSnapshot().body = body;
|
|
28065
|
-
docDataModel.getSnapshot().drawings = drawings
|
|
28066
|
-
docDataModel.getSnapshot().drawingsOrder = drawingsOrder
|
|
27965
|
+
docDataModel.getSnapshot().drawings = drawings ?? {};
|
|
27966
|
+
docDataModel.getSnapshot().drawingsOrder = drawingsOrder ?? [];
|
|
28067
27967
|
this._checkAndSetRenderStyleConfig(docDataModel);
|
|
28068
27968
|
docViewModel.reset(docDataModel);
|
|
28069
|
-
const currentRender = this._renderManagerService.
|
|
27969
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
28070
27970
|
if (currentRender == null) return;
|
|
28071
27971
|
skeleton.calculate();
|
|
28072
27972
|
if (INCLUDE_LIST.includes(unitId)) {
|
|
@@ -28083,7 +27983,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
28083
27983
|
}
|
|
28084
27984
|
_refreshRenderStyleConfig(unitId) {
|
|
28085
27985
|
var _currentRender$mainCo3;
|
|
28086
|
-
const currentRender = this._renderManagerService.
|
|
27986
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
28087
27987
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService).getSkeleton();
|
|
28088
27988
|
const docDataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
28089
27989
|
const docViewModel = this._getEditorViewModel(unitId);
|
|
@@ -28095,15 +27995,12 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
28095
27995
|
if (unitId === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) this._formulaEditorController.autoScroll();
|
|
28096
27996
|
}
|
|
28097
27997
|
_checkAndSetRenderStyleConfig(documentDataModel) {
|
|
28098
|
-
var _snapshot$body
|
|
27998
|
+
var _snapshot$body;
|
|
28099
27999
|
const snapshot = documentDataModel.getSnapshot();
|
|
28100
28000
|
if (snapshot.id !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY && snapshot.id !== DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
|
|
28101
28001
|
const isFormulaBar = snapshot.id === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
|
|
28102
28002
|
if (isFormulaBar) snapshot.documentStyle = formulaEditorStyle;
|
|
28103
|
-
else {
|
|
28104
|
-
var _snapshot$documentSty;
|
|
28105
|
-
(_snapshot$documentSty = snapshot.documentStyle) !== null && _snapshot$documentSty !== void 0 || (snapshot.documentStyle = {});
|
|
28106
|
-
}
|
|
28003
|
+
else snapshot.documentStyle ??= {};
|
|
28107
28004
|
let renderConfig = snapshot.documentStyle.renderConfig;
|
|
28108
28005
|
if (renderConfig == null) {
|
|
28109
28006
|
renderConfig = {};
|
|
@@ -28117,7 +28014,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
28117
28014
|
height: Infinity
|
|
28118
28015
|
};
|
|
28119
28016
|
}
|
|
28120
|
-
if (!((
|
|
28017
|
+
if (!(((_snapshot$body = snapshot.body) === null || _snapshot$body === void 0 ? void 0 : _snapshot$body.dataStream) ?? "").startsWith("=")) {
|
|
28121
28018
|
renderConfig.isRenderStyle = isFormulaBar ? BooleanNumber.FALSE : BooleanNumber.TRUE;
|
|
28122
28019
|
return;
|
|
28123
28020
|
}
|
|
@@ -28586,16 +28483,16 @@ function MobileSheetBarImpl(props) {
|
|
|
28586
28483
|
const currentSubUnitId = workbook.getActiveSheet().getSheetId();
|
|
28587
28484
|
const sheets = workbook.getSheets();
|
|
28588
28485
|
const activeSheet = workbook.getActiveSheet();
|
|
28589
|
-
|
|
28590
|
-
var _sheet$getTabColor;
|
|
28486
|
+
const sheetListItems = sheets.filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
28591
28487
|
return {
|
|
28592
28488
|
sheetId: sheet.getSheetId(),
|
|
28593
28489
|
label: sheet.getName(),
|
|
28594
28490
|
index,
|
|
28595
28491
|
selected: activeSheet === sheet,
|
|
28596
|
-
color:
|
|
28492
|
+
color: sheet.getTabColor() ?? void 0
|
|
28597
28493
|
};
|
|
28598
|
-
})
|
|
28494
|
+
});
|
|
28495
|
+
setSheetList(sheetListItems);
|
|
28599
28496
|
setActiveKey(currentSubUnitId);
|
|
28600
28497
|
if (tabMapRef.current.has(currentSubUnitId)) {
|
|
28601
28498
|
const element = tabMapRef.current.get(currentSubUnitId);
|
|
@@ -28931,11 +28828,11 @@ let SheetPermissionInterceptorCanvasRenderController = class SheetPermissionInte
|
|
|
28931
28828
|
if (!target) return false;
|
|
28932
28829
|
const { unitId, subUnitId } = target;
|
|
28933
28830
|
if (rangeParams.row) {
|
|
28934
|
-
var _this$_permissionServ
|
|
28935
|
-
if (((_this$_permissionServ =
|
|
28831
|
+
var _this$_permissionServ;
|
|
28832
|
+
if ((((_this$_permissionServ = this._permissionService.getPermissionPoint(new WorksheetSetRowStylePermission(unitId, subUnitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) ?? false) === false) return false;
|
|
28936
28833
|
} else if (rangeParams.col) {
|
|
28937
|
-
var _this$
|
|
28938
|
-
if (((
|
|
28834
|
+
var _this$_permissionServ2;
|
|
28835
|
+
if ((((_this$_permissionServ2 = this._permissionService.getPermissionPoint(new WorksheetSetColumnStylePermission(unitId, subUnitId).id)) === null || _this$_permissionServ2 === void 0 ? void 0 : _this$_permissionServ2.value) ?? false) === false) return false;
|
|
28939
28836
|
}
|
|
28940
28837
|
return true;
|
|
28941
28838
|
} }));
|
|
@@ -29003,10 +28900,10 @@ let SheetPermissionInterceptorCanvasRenderController = class SheetPermissionInte
|
|
|
29003
28900
|
}
|
|
29004
28901
|
_initFreezePermissionInterceptor() {
|
|
29005
28902
|
this.disposeWithMe(this._headerFreezeRenderController.interceptor.intercept(this._headerFreezeRenderController.interceptor.getInterceptPoints().FREEZE_PERMISSION_CHECK, { handler: (_, __) => {
|
|
29006
|
-
var _this$
|
|
28903
|
+
var _this$_permissionServ3;
|
|
29007
28904
|
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
29008
28905
|
if (!(workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet()) || !workbook) return false;
|
|
29009
|
-
return (
|
|
28906
|
+
return ((_this$_permissionServ3 = this._permissionService.getPermissionPoint(new WorkbookEditablePermission(workbook.getUnitId()).id)) === null || _this$_permissionServ3 === void 0 ? void 0 : _this$_permissionServ3.value) ?? false;
|
|
29010
28907
|
} }));
|
|
29011
28908
|
}
|
|
29012
28909
|
};
|
|
@@ -29095,7 +28992,7 @@ let SheetPermissionInterceptorFormulaRenderController = class SheetPermissionInt
|
|
|
29095
28992
|
handler: (defaultValue, originValue) => {
|
|
29096
28993
|
var _this$_permissionServ;
|
|
29097
28994
|
const target = getSheetCommandTarget(this._univerInstanceService);
|
|
29098
|
-
if (!target) return defaultValue
|
|
28995
|
+
if (!target) return defaultValue ?? [];
|
|
29099
28996
|
const { worksheet, unitId, subUnitId } = target;
|
|
29100
28997
|
if (((_this$_permissionServ = this._permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) === false) originValue.forEach((item) => {
|
|
29101
28998
|
const itemValue = item.getArrayValue();
|
|
@@ -29360,7 +29257,7 @@ let WorksheetProtectionRenderController = class WorksheetProtectionRenderControl
|
|
|
29360
29257
|
}
|
|
29361
29258
|
_initRender() {
|
|
29362
29259
|
const renderId = this._context.unitId;
|
|
29363
|
-
const render = renderId && this._renderManagerService.
|
|
29260
|
+
const render = renderId && this._renderManagerService.getRenderUnitById(renderId);
|
|
29364
29261
|
const spreadsheetRender = render && render.mainComponent;
|
|
29365
29262
|
if (spreadsheetRender) {
|
|
29366
29263
|
if (!spreadsheetRender.getExtensionByKey("worksheet-protection")) spreadsheetRender.register(this._worksheetProtectionRenderExtension);
|
|
@@ -29779,10 +29676,9 @@ let SheetContextMenuMobileRenderController = class SheetContextMenuMobileRenderC
|
|
|
29779
29676
|
return skeleton.getCellWithCoordByOffset(relativeCoords.x - scrollXY.x, relativeCoords.y - scrollXY.y, scaleX, scaleY, scrollXY);
|
|
29780
29677
|
}
|
|
29781
29678
|
_getCurrentRenderSelections() {
|
|
29782
|
-
|
|
29783
|
-
const currentRender = this._renderManagerService.getRenderById(this._context.unitId);
|
|
29679
|
+
const currentRender = this._renderManagerService.getRenderUnitById(this._context.unitId);
|
|
29784
29680
|
const selectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
29785
|
-
return (
|
|
29681
|
+
return (selectionRenderService === null || selectionRenderService === void 0 ? void 0 : selectionRenderService.getSelectionControls().map((control) => convertSelectionDataToRange(control.getValue()))) ?? [];
|
|
29786
29682
|
}
|
|
29787
29683
|
_cloneSelections(selections) {
|
|
29788
29684
|
return selections.map((selection) => ({
|
|
@@ -30264,9 +30160,7 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30264
30160
|
}
|
|
30265
30161
|
_getFreeze() {
|
|
30266
30162
|
var _this$_sheetSkeletonM;
|
|
30267
|
-
|
|
30268
|
-
if (snapshot == null) return;
|
|
30269
|
-
return snapshot.freeze;
|
|
30163
|
+
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.worksheet.getFreeze();
|
|
30270
30164
|
}
|
|
30271
30165
|
_initScrollEventListener() {
|
|
30272
30166
|
const { scene } = this._context;
|
|
@@ -30432,7 +30326,10 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30432
30326
|
const speedFactor = Math.min(swipeSpeed / 2, 1);
|
|
30433
30327
|
multiplier = MIN_VELOCITY_MULTIPLIER + (MAX_VELOCITY_MULTIPLIER - MIN_VELOCITY_MULTIPLIER) * speedFactor;
|
|
30434
30328
|
if (swipeDuration < 150 && Math.abs(instantVelocity) > 3) multiplier *= 1.3;
|
|
30435
|
-
} else
|
|
30329
|
+
} else {
|
|
30330
|
+
const velocityFactor = Math.min(Math.abs(instantVelocity) / 5, 1);
|
|
30331
|
+
multiplier = MIN_VELOCITY_MULTIPLIER * (.5 + velocityFactor * .5);
|
|
30332
|
+
}
|
|
30436
30333
|
return Math.max(MIN_VELOCITY_MULTIPLIER * .5, Math.min(MAX_VELOCITY_MULTIPLIER * 1.5, multiplier));
|
|
30437
30334
|
};
|
|
30438
30335
|
/**
|
|
@@ -30758,7 +30655,10 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30758
30655
|
if (!_touchScrolling) return;
|
|
30759
30656
|
_touchScrolling = false;
|
|
30760
30657
|
const avgVelocity = calculateAverageVelocity();
|
|
30761
|
-
const
|
|
30658
|
+
const swipeDuration = performance.now() - swipeStartTime;
|
|
30659
|
+
const totalDistance = Math.sqrt(swipeTotalDisplacement.x * swipeTotalDisplacement.x + swipeTotalDisplacement.y * swipeTotalDisplacement.y);
|
|
30660
|
+
const instantVelocity = Math.sqrt(avgVelocity.x * avgVelocity.x + avgVelocity.y * avgVelocity.y);
|
|
30661
|
+
const dynamicMultiplier = calculateDynamicVelocityMultiplier(swipeDuration, totalDistance, instantVelocity);
|
|
30762
30662
|
const { maxVelocity, minVelocityThreshold } = getZoomAdjustedParams();
|
|
30763
30663
|
const cappedVelX = Math.max(-maxVelocity, Math.min(maxVelocity, avgVelocity.x * dynamicMultiplier));
|
|
30764
30664
|
const cappedVelY = Math.max(-maxVelocity, Math.min(maxVelocity, avgVelocity.y * dynamicMultiplier));
|
|
@@ -30851,7 +30751,7 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30851
30751
|
if (param == null) return;
|
|
30852
30752
|
const { unitId } = this._context;
|
|
30853
30753
|
const { skeleton } = param;
|
|
30854
|
-
const scene = (_this$_renderManagerS = this._renderManagerService.
|
|
30754
|
+
const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
|
|
30855
30755
|
if (skeleton == null || scene == null) return;
|
|
30856
30756
|
const { rowTotalHeight, columnTotalWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
30857
30757
|
scene === null || scene === void 0 || scene.transformByState({
|
|
@@ -30881,14 +30781,14 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30881
30781
|
return skeleton.getRangeByViewport(viewport.calcViewportInfo());
|
|
30882
30782
|
}
|
|
30883
30783
|
_scrollToCell(row, column) {
|
|
30884
|
-
var _this$_sheetSkeletonM10, _this$
|
|
30885
|
-
const { rowHeightAccumulation, columnWidthAccumulation } = (_this$_sheetSkeletonM10 =
|
|
30784
|
+
var _this$_sheetSkeletonM10, _this$_getSheetObject2, _this$_sheetSkeletonM11;
|
|
30785
|
+
const { rowHeightAccumulation, columnWidthAccumulation } = ((_this$_sheetSkeletonM10 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM10 === void 0 ? void 0 : _this$_sheetSkeletonM10.skeleton) ?? {};
|
|
30886
30786
|
if (rowHeightAccumulation == null || columnWidthAccumulation == null) return false;
|
|
30887
30787
|
const scene = (_this$_getSheetObject2 = this._getSheetObject()) === null || _this$_getSheetObject2 === void 0 ? void 0 : _this$_getSheetObject2.scene;
|
|
30888
30788
|
if (scene == null) return false;
|
|
30889
30789
|
const viewport = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
30890
30790
|
if (viewport == null) return false;
|
|
30891
|
-
if (((_this$
|
|
30791
|
+
if (((_this$_sheetSkeletonM11 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM11 === void 0 ? void 0 : _this$_sheetSkeletonM11.skeleton) == null) return false;
|
|
30892
30792
|
const worksheet = this._context.unit.getActiveSheet();
|
|
30893
30793
|
if (!worksheet) return false;
|
|
30894
30794
|
const { startColumn: freezeStartColumn, startRow: freezeStartRow, ySplit: freezeYSplit, xSplit: freezeXSplit } = worksheet.getFreeze();
|
|
@@ -31088,7 +30988,7 @@ let SheetCellDropdownManagerService = class SheetCellDropdownManagerService exte
|
|
|
31088
30988
|
const { location, onHide, closeOnOutSide = true } = param;
|
|
31089
30989
|
const { row, col, unitId, subUnitId } = location;
|
|
31090
30990
|
const component = dropdownMap[param.type];
|
|
31091
|
-
const currentRender = this._renderManagerService.
|
|
30991
|
+
const currentRender = this._renderManagerService.getRenderUnitById(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
31092
30992
|
const disposable = new DisposableCollection();
|
|
31093
30993
|
const popupDisposable = this._canvasPopupManagerService.attachPopupToCell(row, col, {
|
|
31094
30994
|
componentKey: component.componentKey,
|
|
@@ -31689,9 +31589,8 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31689
31589
|
* When pinch zooming, we should not process pointer move events for selection.
|
|
31690
31590
|
*/
|
|
31691
31591
|
_setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType = ScrollTimerType.ALL, moveStartPosX, moveStartPosY) {
|
|
31692
|
-
var _viewportMain$left, _viewportMain$top;
|
|
31693
31592
|
this._scrollTimer = ScrollTimer.create(this._scene, scrollTimerType);
|
|
31694
|
-
this._scrollTimer.startScroll((
|
|
31593
|
+
this._scrollTimer.startScroll((viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.left) ?? 0, (viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.top) ?? 0, viewportMain);
|
|
31695
31594
|
const scene = this._scene;
|
|
31696
31595
|
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt) => {
|
|
31697
31596
|
if (this._contextService.getContextValue("MOBILE_PINCH_ZOOMING")) return;
|
|
@@ -31713,7 +31612,7 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31713
31612
|
* In Mobile version, new selection is determined by cursor cell and current of activeSelectionControl.model
|
|
31714
31613
|
*/
|
|
31715
31614
|
_movingHandler(offsetX, offsetY, activeSelectionControl, rangeType) {
|
|
31716
|
-
var
|
|
31615
|
+
var _anchorCell$mergeInfo, _anchorCell$mergeInfo2, _anchorCell$mergeInfo3, _anchorCell$mergeInfo4;
|
|
31717
31616
|
this._rangeType = rangeType;
|
|
31718
31617
|
const skeleton = this._skeleton;
|
|
31719
31618
|
const scene = this._scene;
|
|
@@ -31724,7 +31623,7 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31724
31623
|
endColumn: activeSelectionControl.model.endColumn
|
|
31725
31624
|
};
|
|
31726
31625
|
const viewportMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
31727
|
-
const targetViewport =
|
|
31626
|
+
const targetViewport = this._getViewportByCell(currSelectionRange.endRow, currSelectionRange.endColumn) ?? viewportMain;
|
|
31728
31627
|
const scrollXY = scene.getScrollXYInfoByViewport(Vector2.FromArray([this._startViewportPosX, this._startViewportPosY]), targetViewport);
|
|
31729
31628
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
31730
31629
|
if (rangeType === RANGE_TYPE.ROW) offsetX = Number.POSITIVE_INFINITY;
|
|
@@ -31732,11 +31631,11 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31732
31631
|
const cursorCellRangeInfo = this._getSelectionWithCoordByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
31733
31632
|
if (!cursorCellRangeInfo) return false;
|
|
31734
31633
|
const { rangeWithCoord: cursorCellRange } = cursorCellRangeInfo;
|
|
31735
|
-
const anchorCell =
|
|
31736
|
-
const startRowOfActiveCell = (
|
|
31737
|
-
const endRowOfActiveCell = (
|
|
31738
|
-
const startColumnOfActiveCell = (
|
|
31739
|
-
const endColOfActiveCell = (
|
|
31634
|
+
const anchorCell = this._anchorCellForExpanding ?? activeSelectionControl.model.currentCell;
|
|
31635
|
+
const startRowOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo === void 0 ? void 0 : _anchorCell$mergeInfo.startRow) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualRow) ?? -1;
|
|
31636
|
+
const endRowOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo2 = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo2 === void 0 ? void 0 : _anchorCell$mergeInfo2.endRow) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualRow) ?? -1;
|
|
31637
|
+
const startColumnOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo3 = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo3 === void 0 ? void 0 : _anchorCell$mergeInfo3.startColumn) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualColumn) ?? -1;
|
|
31638
|
+
const endColOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo4 = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo4 === void 0 ? void 0 : _anchorCell$mergeInfo4.endColumn) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualColumn) ?? -1;
|
|
31740
31639
|
let startRow = Math.min(cursorCellRange.startRow, startRowOfActiveCell);
|
|
31741
31640
|
if (startRowOfActiveCell === -1) startRow = cursorCellRange.startRow;
|
|
31742
31641
|
let startColumn = Math.min(cursorCellRange.startColumn, startColumnOfActiveCell);
|
|
@@ -31843,6 +31742,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends Plugin
|
|
|
31843
31742
|
[SelectAllService],
|
|
31844
31743
|
[ISheetCellDropdownManagerService, { useClass: SheetCellDropdownManagerService }],
|
|
31845
31744
|
[SheetCellEditorResizeService],
|
|
31745
|
+
[ISheetLoadingRenderService, { useClass: SheetLoadingRenderService }],
|
|
31846
31746
|
[AutoHeightController],
|
|
31847
31747
|
[AutoWidthController],
|
|
31848
31748
|
[FormulaEditorController],
|
|
@@ -31908,7 +31808,6 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends Plugin
|
|
|
31908
31808
|
});
|
|
31909
31809
|
}
|
|
31910
31810
|
_registerRenderModules() {
|
|
31911
|
-
var _config$contextMenu;
|
|
31912
31811
|
const modules = [
|
|
31913
31812
|
[HeaderMoveRenderController],
|
|
31914
31813
|
[HeaderUnhideRenderController],
|
|
@@ -31936,7 +31835,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends Plugin
|
|
|
31936
31835
|
[WorksheetProtectionRenderController]
|
|
31937
31836
|
];
|
|
31938
31837
|
const config = this._configService.getConfig(UI_PLUGIN_CONFIG_KEY);
|
|
31939
|
-
if ((
|
|
31838
|
+
if ((config === null || config === void 0 ? void 0 : config.contextMenu) ?? true) modules.push([HeaderMenuRenderController]);
|
|
31940
31839
|
modules.forEach((m) => {
|
|
31941
31840
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
|
|
31942
31841
|
});
|
|
@@ -31956,7 +31855,7 @@ _defineProperty(UniverSheetsMobileUIPlugin, "packageName", name);
|
|
|
31956
31855
|
_defineProperty(UniverSheetsMobileUIPlugin, "version", version);
|
|
31957
31856
|
_defineProperty(UniverSheetsMobileUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
31958
31857
|
UniverSheetsMobileUIPlugin = __decorate([
|
|
31959
|
-
DependentOn(UniverSheetsPlugin, UniverMobileUIPlugin),
|
|
31858
|
+
DependentOn(UniverDocsPlugin, UniverFormulaEnginePlugin, UniverRenderEnginePlugin, UniverSheetsPlugin, UniverMobileUIPlugin, UniverDocsUIPlugin),
|
|
31960
31859
|
__decorateParam(1, Inject(Injector)),
|
|
31961
31860
|
__decorateParam(2, IRenderManagerService),
|
|
31962
31861
|
__decorateParam(3, IConfigService),
|
|
@@ -32529,7 +32428,6 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends Plugin {
|
|
|
32529
32428
|
});
|
|
32530
32429
|
}
|
|
32531
32430
|
_registerRenderModules() {
|
|
32532
|
-
var _config$contextMenu;
|
|
32533
32431
|
const modules = [
|
|
32534
32432
|
[HeaderMoveRenderController],
|
|
32535
32433
|
[HeaderUnhideRenderController],
|
|
@@ -32557,7 +32455,7 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends Plugin {
|
|
|
32557
32455
|
[WorksheetProtectionRenderController]
|
|
32558
32456
|
];
|
|
32559
32457
|
const config = this._configService.getConfig(UI_PLUGIN_CONFIG_KEY);
|
|
32560
|
-
if ((
|
|
32458
|
+
if ((config === null || config === void 0 ? void 0 : config.contextMenu) ?? true) modules.push([HeaderMenuRenderController]);
|
|
32561
32459
|
modules.forEach((m) => {
|
|
32562
32460
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
|
|
32563
32461
|
});
|
|
@@ -32577,7 +32475,7 @@ _defineProperty(UniverSheetsUIPlugin, "packageName", name);
|
|
|
32577
32475
|
_defineProperty(UniverSheetsUIPlugin, "version", version);
|
|
32578
32476
|
_defineProperty(UniverSheetsUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
32579
32477
|
UniverSheetsUIPlugin = __decorate([
|
|
32580
|
-
DependentOn(UniverSheetsPlugin),
|
|
32478
|
+
DependentOn(UniverDocsPlugin, UniverFormulaEnginePlugin, UniverRenderEnginePlugin, UniverSheetsPlugin, UniverDocsUIPlugin),
|
|
32581
32479
|
__decorateParam(1, Inject(Injector)),
|
|
32582
32480
|
__decorateParam(2, IRenderManagerService),
|
|
32583
32481
|
__decorateParam(3, IConfigService),
|