@univerjs/sheets-ui 1.0.0-alpha.6 → 1.0.0-alpha.8
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 +2 -22
- package/lib/cjs/index.js +736 -640
- 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 +0 -2
- package/lib/cjs/locale/zh-HK.js +0 -2
- package/lib/cjs/locale/zh-TW.js +0 -2
- package/lib/es/facade.js +3 -23
- package/lib/es/index.js +741 -645
- 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 +0 -2
- package/lib/es/locale/zh-HK.js +0 -2
- package/lib/es/locale/zh-TW.js +0 -2
- package/lib/facade.js +3 -23
- package/lib/index.css +4 -0
- package/lib/index.js +741 -645
- 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 +0 -2
- package/lib/locale/zh-HK.js +0 -2
- package/lib/locale/zh-TW.js +0 -2
- 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/auto-fill-ui.controller.d.ts +18 -6
- package/lib/types/controllers/permission/sheet-permission-check-ui.controller.d.ts +2 -4
- package/lib/types/controllers/render-controllers/editor-bridge.render-controller.d.ts +1 -0
- 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-container/SheetContainer.d.ts +1 -1
- package/lib/types/views/sheet-slider/SheetZoomInput.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 { AnchoredContextMenu, BuiltInUIPart, COLOR_PICKER_COMPONENT, ComponentContainer, ComponentManager, ContextMenuGroup, ContextMenuPosition, CopyCommand, CutCommand, DISABLE_AUTO_FOCUS_KEY, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HTML_CLIPBOARD_MIME_TYPE, ICanvasPopupService, IClipboardInterfaceService, IContextMenuService, IDialogService, ILayoutService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IShortcutService, ISidebarService, IUIPartsService, IconManager, KeyCode, MenuItemType, MetaKeys, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SheetPasteShortKeyCommandName, Slider, ToggleFullscreenOperation, ToolbarItem, UI_PLUGIN_CONFIG_KEY, UniverMobileUIPlugin, ZoomInput, connectInjector, getMenuHiddenObservable, handleStringToStyle, imageMimeTypeSet, sanitizeParsedHtml, textTrim, useComponentsOfPart, useConfigValue, useDependency, useEvent, useObservable, useSidebarClick, useVirtualList } from "@univerjs/ui";
|
|
4
|
-
import { 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";
|
|
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, numfmt, registerDependencies, sequenceExecute, set, skipParseTagNames, sortRules, splitIntoGrid, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
|
|
5
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";
|
|
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, UniverUIPlugin, 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, UniverRenderEnginePlugin, Vector2, Viewport, cancelRequestFrame, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, fixLineWidthByScale, getCurrentTypeOfRenderer, getNextWheelZoomRatio, ptToPixel, requestNewFrame, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
|
|
6
6
|
import { BehaviorSubject, EMPTY, Observable, Subject, Subscription, combineLatest, combineLatestWith, distinctUntilChanged, filter, 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";
|
|
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
|
}
|
|
@@ -607,7 +603,7 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
607
603
|
}
|
|
608
604
|
_getFreeze() {
|
|
609
605
|
var _this$_sheetSkeletonM;
|
|
610
|
-
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.
|
|
606
|
+
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.worksheet.getFreeze();
|
|
611
607
|
}
|
|
612
608
|
_getViewportByCell(row, column) {
|
|
613
609
|
if (row === void 0 || column === void 0) return null;
|
|
@@ -686,6 +682,10 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
686
682
|
const startViewport = scene.getActiveViewportByCoord(Vector2.FromArray([moveStartPosX, moveStartPosY]));
|
|
687
683
|
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt) => {
|
|
688
684
|
var _scene$getActiveViewp;
|
|
685
|
+
if (moveEvt.buttons === 0) {
|
|
686
|
+
this.endSelection();
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
689
|
const { offsetX: moveOffsetX, offsetY: moveOffsetY } = moveEvt;
|
|
690
690
|
const { x: newMoveOffsetX, y: newMoveOffsetY } = scene.getCoordRelativeToViewport(Vector2.FromArray([moveOffsetX, moveOffsetY]));
|
|
691
691
|
this._movingHandler(newMoveOffsetX, newMoveOffsetY, activeSelectionControl, rangeType);
|
|
@@ -764,12 +764,6 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
764
764
|
});
|
|
765
765
|
});
|
|
766
766
|
}
|
|
767
|
-
/**
|
|
768
|
-
* @deprecated Please use `getCellWithCoordByOffset` instead.
|
|
769
|
-
*/
|
|
770
|
-
getSelectionCellByPosition(x, y) {
|
|
771
|
-
return this.getCellWithCoordByOffset(x, y);
|
|
772
|
-
}
|
|
773
767
|
getCellWithCoordByOffset(x, y, skeletonParam) {
|
|
774
768
|
const scene = this._scene;
|
|
775
769
|
const skeleton = skeletonParam !== null && skeletonParam !== void 0 ? skeletonParam : this._skeleton;
|
|
@@ -979,7 +973,7 @@ function genSelectionByRange(skeleton, range) {
|
|
|
979
973
|
}
|
|
980
974
|
|
|
981
975
|
//#endregion
|
|
982
|
-
//#region \0@oxc-project+runtime@0.
|
|
976
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
983
977
|
function __decorateParam(paramIndex, decorator) {
|
|
984
978
|
return function(target, key) {
|
|
985
979
|
decorator(target, key, paramIndex);
|
|
@@ -987,7 +981,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
987
981
|
}
|
|
988
982
|
|
|
989
983
|
//#endregion
|
|
990
|
-
//#region \0@oxc-project+runtime@0.
|
|
984
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
991
985
|
function __decorate(decorators, target, key, desc) {
|
|
992
986
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
993
987
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1213,7 +1207,7 @@ var SelectionShapeExtension = class {
|
|
|
1213
1207
|
}
|
|
1214
1208
|
_getFreeze() {
|
|
1215
1209
|
var _withCurrentTypeOfRen;
|
|
1216
|
-
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.
|
|
1210
|
+
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();
|
|
1217
1211
|
}
|
|
1218
1212
|
_isSelectionInViewport(selection, viewport) {
|
|
1219
1213
|
const freeze = this._getFreeze() || {
|
|
@@ -2236,29 +2230,6 @@ var SelectionControl = class extends Disposable {
|
|
|
2236
2230
|
this._updateControlCoord();
|
|
2237
2231
|
}
|
|
2238
2232
|
/**
|
|
2239
|
-
* Update selection model with new range & primary cell(aka: highlight/current), also update row/col selection size & style.
|
|
2240
|
-
*
|
|
2241
|
-
* @deprecated use `updateRangeBySelectionWithCoord` and `updateStyle` to do same thing.
|
|
2242
|
-
*
|
|
2243
|
-
* @param newSelectionRange
|
|
2244
|
-
* @param rowHeaderWidth
|
|
2245
|
-
* @param columnHeaderHeight
|
|
2246
|
-
* @param style
|
|
2247
|
-
* @param primaryCell primary cell
|
|
2248
|
-
*/
|
|
2249
|
-
update(newSelectionRange, rowHeaderWidth = 0, columnHeaderHeight = 0, style, primaryCell) {
|
|
2250
|
-
this._rowHeaderWidth = rowHeaderWidth;
|
|
2251
|
-
this._columnHeaderHeight = columnHeaderHeight;
|
|
2252
|
-
this._rowHeaderOffsetX = 0;
|
|
2253
|
-
this._columnHeaderOffsetY = 0;
|
|
2254
|
-
this.updateRangeBySelectionWithCoord({
|
|
2255
|
-
rangeWithCoord: newSelectionRange,
|
|
2256
|
-
primaryWithCoord: primaryCell,
|
|
2257
|
-
style
|
|
2258
|
-
});
|
|
2259
|
-
if (style) this.updateStyle(style);
|
|
2260
|
-
}
|
|
2261
|
-
/**
|
|
2262
2233
|
* Update primary range.
|
|
2263
2234
|
* highlight cell would update if primary cell has value.
|
|
2264
2235
|
* highlight cell would be cleared if primary cell is null.
|
|
@@ -2655,7 +2626,7 @@ let MarkSelectionService = class MarkSelectionService extends Disposable {
|
|
|
2655
2626
|
const { unitId, subUnitId, selection, control: oldControl, zIndex } = shape;
|
|
2656
2627
|
oldControl === null || oldControl === void 0 || oldControl.dispose();
|
|
2657
2628
|
if (unitId !== currentUnitId || subUnitId !== currentSubUnitId) return;
|
|
2658
|
-
const renderUnit = this._renderManagerService.
|
|
2629
|
+
const renderUnit = this._renderManagerService.getRenderUnitById(unitId);
|
|
2659
2630
|
if (!renderUnit) return;
|
|
2660
2631
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, subUnitId);
|
|
2661
2632
|
if (!skeleton) return;
|
|
@@ -2940,7 +2911,6 @@ function convertToCellStyle(cell, dataStream, textRuns) {
|
|
|
2940
2911
|
s: textRuns[0].ts
|
|
2941
2912
|
};
|
|
2942
2913
|
else return cell;
|
|
2943
|
-
return cell;
|
|
2944
2914
|
}
|
|
2945
2915
|
|
|
2946
2916
|
//#endregion
|
|
@@ -3400,13 +3370,12 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3400
3370
|
let cellText = "";
|
|
3401
3371
|
let cellRichStyle;
|
|
3402
3372
|
if (/<[^>]+>/.test(cellHtml) && skeleton) {
|
|
3403
|
-
var _skeleton$getBlankCel;
|
|
3404
3373
|
const newDocBody = {
|
|
3405
3374
|
dataStream: "",
|
|
3406
3375
|
textRuns: []
|
|
3407
3376
|
};
|
|
3408
3377
|
this._parseCellHtml(null, cell.childNodes, newDocBody, void 0, styleStr);
|
|
3409
|
-
const documentModel = (
|
|
3378
|
+
const documentModel = createDocumentModelWithStyle("", {});
|
|
3410
3379
|
const p = documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot();
|
|
3411
3380
|
const singleDataStream = `${newDocBody.dataStream}\r\n`;
|
|
3412
3381
|
const documentData = {
|
|
@@ -3427,11 +3396,8 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3427
3396
|
};
|
|
3428
3397
|
}
|
|
3429
3398
|
_generateDocumentDataModelSnapshot(snapshot) {
|
|
3430
|
-
|
|
3431
|
-
const
|
|
3432
|
-
if (currentSkeleton == null) return null;
|
|
3433
|
-
const { skeleton } = currentSkeleton;
|
|
3434
|
-
const documentModel = (_skeleton$getBlankCel2 = skeleton.getBlankCellDocumentModel()) === null || _skeleton$getBlankCel2 === void 0 ? void 0 : _skeleton$getBlankCel2.documentModel;
|
|
3399
|
+
if (this._getCurrentSkeleton() == null) return null;
|
|
3400
|
+
const documentModel = createDocumentModelWithStyle("", {});
|
|
3435
3401
|
const documentData = {
|
|
3436
3402
|
...documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot(),
|
|
3437
3403
|
...snapshot
|
|
@@ -4245,7 +4211,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4245
4211
|
return this._clipboardHooks;
|
|
4246
4212
|
}
|
|
4247
4213
|
_generateCopyContent(unitId, subUnitId, range, hooks, copyHookType = PREDEFINED_HOOK_NAME_COPY.DEFAULT_COPY) {
|
|
4248
|
-
const workbook = this._univerInstanceService.
|
|
4214
|
+
const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
4249
4215
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
4250
4216
|
if (!workbook || !worksheet) return null;
|
|
4251
4217
|
const filteredRows = hooks.reduce((acc, cur) => {
|
|
@@ -4450,7 +4416,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4450
4416
|
if (!cellMatrix) return false;
|
|
4451
4417
|
const pasteTarget = this._getPastedRange(cellMatrix);
|
|
4452
4418
|
if (!pasteTarget) return false;
|
|
4453
|
-
const worksheet = (_this$_univerInstance = this._univerInstanceService.
|
|
4419
|
+
const worksheet = (_this$_univerInstance = this._univerInstanceService.getUnit(pasteTarget.unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getSheetBySheetId(pasteTarget.subUnitId);
|
|
4454
4420
|
if (!worksheet) return false;
|
|
4455
4421
|
const mergeData = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergeData();
|
|
4456
4422
|
if (mergeData.length) {
|
|
@@ -4480,7 +4446,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4480
4446
|
const { range, matrix: cachedMatrix, unitId: copyUnitId, subUnitId: copySubUnitId } = cachedData || {};
|
|
4481
4447
|
if (!cachedMatrix || !cachedData || !range || !copyUnitId || !copySubUnitId) return false;
|
|
4482
4448
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
4483
|
-
const worksheet = (_this$_univerInstance2 = this._univerInstanceService.
|
|
4449
|
+
const worksheet = (_this$_univerInstance2 = this._univerInstanceService.getUnit(copyUnitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance2 === void 0 ? void 0 : _this$_univerInstance2.getSheetBySheetId(copySubUnitId);
|
|
4484
4450
|
const cellMatrix = new ObjectMatrix();
|
|
4485
4451
|
cachedMatrix.forValue((row, col, value) => {
|
|
4486
4452
|
const { row: actualRow, col: actualColumn } = mapFunc(row, col);
|
|
@@ -4503,7 +4469,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4503
4469
|
});
|
|
4504
4470
|
const pasteTarget = this._getPastedRange(cellMatrix);
|
|
4505
4471
|
if (!pasteTarget) return false;
|
|
4506
|
-
const pasteToWorksheet = (_this$_univerInstance3 = this._univerInstanceService.
|
|
4472
|
+
const pasteToWorksheet = (_this$_univerInstance3 = this._univerInstanceService.getUnit(pasteTarget.unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance3 === void 0 ? void 0 : _this$_univerInstance3.getSheetBySheetId(pasteTarget.subUnitId);
|
|
4507
4473
|
if (!pasteToWorksheet) return false;
|
|
4508
4474
|
const mergeData = pasteToWorksheet === null || pasteToWorksheet === void 0 ? void 0 : pasteToWorksheet.getMergeData();
|
|
4509
4475
|
if (mergeData) {
|
|
@@ -4679,7 +4645,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4679
4645
|
var _this$_univerInstance4, _this$_renderManagerS;
|
|
4680
4646
|
const worksheet = (_this$_univerInstance4 = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance4 === void 0 ? void 0 : _this$_univerInstance4.getSheetBySheetId(subUnitId);
|
|
4681
4647
|
if (!worksheet) return null;
|
|
4682
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
4648
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
4683
4649
|
if (!skeleton) return null;
|
|
4684
4650
|
const rowManager = worksheet.getRowManager();
|
|
4685
4651
|
const defaultRowHeight = worksheet.getConfig().defaultRowHeight;
|
|
@@ -4719,7 +4685,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4719
4685
|
}
|
|
4720
4686
|
_getSetSelectionOperation(unitId, subUnitId, range, cellMatrix, pasteType) {
|
|
4721
4687
|
var _this$_univerInstance5;
|
|
4722
|
-
const worksheet = (_this$_univerInstance5 = this._univerInstanceService.
|
|
4688
|
+
const worksheet = (_this$_univerInstance5 = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance5 === void 0 ? void 0 : _this$_univerInstance5.getSheetBySheetId(subUnitId);
|
|
4723
4689
|
if (!worksheet) return null;
|
|
4724
4690
|
const { rows, cols } = range;
|
|
4725
4691
|
const startRow = rows[0];
|
|
@@ -4911,7 +4877,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4911
4877
|
if (rowCount <= 0 || colCount <= 0) return null;
|
|
4912
4878
|
const pasteSelectionRangeRowLen = discreteRange.rows.length;
|
|
4913
4879
|
const pasteSelectionRangeColLen = discreteRange.cols.length;
|
|
4914
|
-
const worksheet = (_this$_univerInstance6 = this._univerInstanceService.
|
|
4880
|
+
const worksheet = (_this$_univerInstance6 = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance6 === void 0 ? void 0 : _this$_univerInstance6.getSheetBySheetId(subUnitId);
|
|
4915
4881
|
if (!worksheet) return null;
|
|
4916
4882
|
const mergeData = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getMergeData();
|
|
4917
4883
|
if (pasteSelectionRangeRowLen % rowCount === 0 && pasteSelectionRangeColLen % colCount === 0) {
|
|
@@ -4938,7 +4904,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4938
4904
|
}
|
|
4939
4905
|
_expandOrShrinkRowsCols(unitId, subUnitId, range, colCount, rowCount) {
|
|
4940
4906
|
const { rows, cols } = range;
|
|
4941
|
-
const workbook = this._univerInstanceService.
|
|
4907
|
+
const workbook = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
4942
4908
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId);
|
|
4943
4909
|
let newRows;
|
|
4944
4910
|
let newCols;
|
|
@@ -5063,6 +5029,7 @@ const SheetCopyCommand = {
|
|
|
5063
5029
|
priority: SHEET_CLIPBOARD_PRIORITY,
|
|
5064
5030
|
preconditions: whenSheetFocused,
|
|
5065
5031
|
handler: async (accessor) => {
|
|
5032
|
+
checkSheetClipboardPermission(accessor, CopyCommand.id);
|
|
5066
5033
|
return accessor.get(ISheetClipboardService).copy();
|
|
5067
5034
|
}
|
|
5068
5035
|
};
|
|
@@ -5074,6 +5041,7 @@ const SheetCutCommand = {
|
|
|
5074
5041
|
priority: SHEET_CLIPBOARD_PRIORITY,
|
|
5075
5042
|
preconditions: whenSheetFocused,
|
|
5076
5043
|
handler: async (accessor) => {
|
|
5044
|
+
checkSheetClipboardPermission(accessor, CutCommand.id);
|
|
5077
5045
|
return accessor.get(ISheetClipboardService).cut();
|
|
5078
5046
|
}
|
|
5079
5047
|
};
|
|
@@ -5085,6 +5053,7 @@ const SheetPasteCommand = {
|
|
|
5085
5053
|
priority: SHEET_CLIPBOARD_PRIORITY,
|
|
5086
5054
|
preconditions: whenSheetFocused,
|
|
5087
5055
|
handler: async (accessor, params) => {
|
|
5056
|
+
checkSheetClipboardPermission(accessor, PasteCommand.id, params);
|
|
5088
5057
|
const sheetClipboardService = accessor.get(ISheetClipboardService);
|
|
5089
5058
|
const clipboardInterfaceService = accessor.get(IClipboardInterfaceService);
|
|
5090
5059
|
if (clipboardInterfaceService.supportClipboard) {
|
|
@@ -5103,12 +5072,76 @@ const SheetPasteShortKeyCommand = {
|
|
|
5103
5072
|
id: SheetPasteShortKeyCommandName,
|
|
5104
5073
|
type: CommandType.COMMAND,
|
|
5105
5074
|
handler: async (accessor, params) => {
|
|
5075
|
+
checkSheetClipboardPermission(accessor, PasteCommand.id);
|
|
5106
5076
|
const clipboardService = accessor.get(ISheetClipboardService);
|
|
5107
5077
|
const { htmlContent, textContent, files, formulaClipboardPayload } = params;
|
|
5108
5078
|
clipboardService.legacyPaste(htmlContent, textContent, files, formulaClipboardPayload);
|
|
5109
5079
|
return true;
|
|
5110
5080
|
}
|
|
5111
5081
|
};
|
|
5082
|
+
function checkSheetClipboardPermission(accessor, commandId, params) {
|
|
5083
|
+
const permissionCheckController = accessor.get(SheetPermissionCheckController);
|
|
5084
|
+
let permission = true;
|
|
5085
|
+
let errorKey = "sheets-ui.permission.dialog.commonErr";
|
|
5086
|
+
switch (commandId) {
|
|
5087
|
+
case CopyCommand.id:
|
|
5088
|
+
permission = permissionCheckController.permissionCheckWithRanges({
|
|
5089
|
+
workbookTypes: [WorkbookCopyPermission],
|
|
5090
|
+
worksheetTypes: [WorksheetCopyPermission],
|
|
5091
|
+
rangeTypes: [RangeProtectionPermissionViewPoint]
|
|
5092
|
+
});
|
|
5093
|
+
errorKey = "sheets-ui.permission.dialog.copyErr";
|
|
5094
|
+
break;
|
|
5095
|
+
case CutCommand.id:
|
|
5096
|
+
permission = permissionCheckController.permissionCheckWithRanges({
|
|
5097
|
+
workbookTypes: [WorkbookCopyPermission, WorkbookEditablePermission],
|
|
5098
|
+
worksheetTypes: [WorksheetCopyPermission, WorksheetEditPermission],
|
|
5099
|
+
rangeTypes: [RangeProtectionPermissionViewPoint, RangeProtectionPermissionEditPoint]
|
|
5100
|
+
});
|
|
5101
|
+
errorKey = "sheets-ui.permission.dialog.copyErr";
|
|
5102
|
+
break;
|
|
5103
|
+
case PasteCommand.id:
|
|
5104
|
+
permission = checkSheetPastePermission(permissionCheckController, params);
|
|
5105
|
+
errorKey = "sheets-ui.permission.dialog.pasteErr";
|
|
5106
|
+
break;
|
|
5107
|
+
}
|
|
5108
|
+
if (permission) return;
|
|
5109
|
+
const localeService = accessor.get(LocaleService);
|
|
5110
|
+
let errorMsg = localeService.t(errorKey);
|
|
5111
|
+
if (commandId === CopyCommand.id || commandId === CutCommand.id) {
|
|
5112
|
+
var _permissionService$ge;
|
|
5113
|
+
const target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
|
|
5114
|
+
const permissionService = accessor.get(IPermissionService);
|
|
5115
|
+
if (target && !((_permissionService$ge = permissionService.getPermissionPoint(new WorkbookCopyPermission(target.unitId).id)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value)) errorMsg = localeService.t("sheets-ui.permission.dialog.workbookCopyErr");
|
|
5116
|
+
}
|
|
5117
|
+
permissionCheckController.blockExecuteWithoutPermission(errorMsg);
|
|
5118
|
+
}
|
|
5119
|
+
function checkSheetPastePermission(permissionCheckController, params) {
|
|
5120
|
+
if ((params === null || params === void 0 ? void 0 : params.value) === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_VALUE || (params === null || params === void 0 ? void 0 : params.value) === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMULA || (params === null || params === void 0 ? void 0 : params.value) === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT) return permissionCheckController.permissionCheckWithRanges({
|
|
5121
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
5122
|
+
worksheetTypes: [WorksheetSetCellStylePermission, WorksheetEditPermission],
|
|
5123
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
5124
|
+
});
|
|
5125
|
+
if ((params === null || params === void 0 ? void 0 : params.value) === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_COL_WIDTH) return permissionCheckController.permissionCheckWithRanges({
|
|
5126
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
5127
|
+
worksheetTypes: [
|
|
5128
|
+
WorksheetEditPermission,
|
|
5129
|
+
WorksheetSetCellValuePermission,
|
|
5130
|
+
WorksheetSetCellStylePermission,
|
|
5131
|
+
WorksheetSetColumnStylePermission
|
|
5132
|
+
],
|
|
5133
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
5134
|
+
});
|
|
5135
|
+
return permissionCheckController.permissionCheckWithRanges({
|
|
5136
|
+
workbookTypes: [WorkbookEditablePermission],
|
|
5137
|
+
worksheetTypes: [
|
|
5138
|
+
WorksheetSetCellValuePermission,
|
|
5139
|
+
WorksheetSetCellStylePermission,
|
|
5140
|
+
WorksheetEditPermission
|
|
5141
|
+
],
|
|
5142
|
+
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
5143
|
+
});
|
|
5144
|
+
}
|
|
5112
5145
|
const SheetPasteValueCommand = {
|
|
5113
5146
|
id: "sheet.command.paste-value",
|
|
5114
5147
|
type: CommandType.COMMAND,
|
|
@@ -5169,7 +5202,7 @@ const DeleteRangeMoveLeftConfirmCommand = {
|
|
|
5169
5202
|
};
|
|
5170
5203
|
const getRowLength = (range) => range.endRow - range.startRow;
|
|
5171
5204
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5172
|
-
const interSectedRange =
|
|
5205
|
+
const interSectedRange = getIntersectRange(mergeRange, range);
|
|
5173
5206
|
return interSectedRange ? getRowLength(mergeRange) > getRowLength(interSectedRange) : false;
|
|
5174
5207
|
})) return commandService.executeCommand(DeleteRangeMoveLeftCommand.id);
|
|
5175
5208
|
if (await confirmService.confirm({
|
|
@@ -5215,7 +5248,7 @@ const DeleteRangeMoveUpConfirmCommand = {
|
|
|
5215
5248
|
}
|
|
5216
5249
|
const getColLength = (range) => range.endColumn - range.startColumn;
|
|
5217
5250
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5218
|
-
const interSectedRange =
|
|
5251
|
+
const interSectedRange = getIntersectRange(mergeRange, range);
|
|
5219
5252
|
return interSectedRange ? getColLength(mergeRange) > getColLength(interSectedRange) : false;
|
|
5220
5253
|
})) return commandService.executeCommand(DeleteRangeMoveUpCommand.id);
|
|
5221
5254
|
if (await confirmService.confirm({
|
|
@@ -5905,7 +5938,7 @@ const InsertRangeMoveDownConfirmCommand = {
|
|
|
5905
5938
|
}
|
|
5906
5939
|
const getColLength = (range) => range.endColumn - range.startColumn;
|
|
5907
5940
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5908
|
-
const interSectedRange =
|
|
5941
|
+
const interSectedRange = getIntersectRange(mergeRange, range);
|
|
5909
5942
|
return interSectedRange ? getColLength(mergeRange) > getColLength(interSectedRange) : false;
|
|
5910
5943
|
})) return commandService.executeCommand(InsertRangeMoveDownCommand.id);
|
|
5911
5944
|
if (await confirmService.confirm({
|
|
@@ -5943,7 +5976,7 @@ const InsertRangeMoveRightConfirmCommand = {
|
|
|
5943
5976
|
};
|
|
5944
5977
|
const getRowLength = (range) => range.endRow - range.startRow;
|
|
5945
5978
|
if (!worksheet.getMergeData().find((mergeRange) => {
|
|
5946
|
-
const interSectedRange =
|
|
5979
|
+
const interSectedRange = getIntersectRange(mergeRange, range);
|
|
5947
5980
|
return interSectedRange ? getRowLength(mergeRange) > getRowLength(interSectedRange) : false;
|
|
5948
5981
|
})) return commandService.executeCommand(InsertRangeMoveRightCommand.id);
|
|
5949
5982
|
if (await confirmService.confirm({
|
|
@@ -6660,7 +6693,7 @@ const SetSelectionFrozenCommand = {
|
|
|
6660
6693
|
const commandService = accessor.get(ICommandService);
|
|
6661
6694
|
const selections = accessor.get(SheetsSelectionsService).getCurrentSelections();
|
|
6662
6695
|
if (!selections) return false;
|
|
6663
|
-
const { sheetViewStartRow = 0, sheetViewStartColumn = 0 } = accessor.get(IRenderManagerService).
|
|
6696
|
+
const { sheetViewStartRow = 0, sheetViewStartColumn = 0 } = accessor.get(IRenderManagerService).getRenderUnitById(unitId).with(SheetScrollManagerService).getCurrentScrollState() || {};
|
|
6664
6697
|
let startRow;
|
|
6665
6698
|
let startColumn;
|
|
6666
6699
|
let freezedRowCount;
|
|
@@ -7011,7 +7044,7 @@ const MoveSelectionEnterAndTabCommand = {
|
|
|
7011
7044
|
reveal: true,
|
|
7012
7045
|
extra: params.extra
|
|
7013
7046
|
});
|
|
7014
|
-
const selectionService = (_renderManagerService = accessor.get(IRenderManagerService).
|
|
7047
|
+
const selectionService = (_renderManagerService = accessor.get(IRenderManagerService).getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(ISheetSelectionRenderService);
|
|
7015
7048
|
selectionService === null || selectionService === void 0 || selectionService.refreshSelectionMoveEnd();
|
|
7016
7049
|
return rs;
|
|
7017
7050
|
}
|
|
@@ -7145,7 +7178,7 @@ function getSheetObject(univerInstanceService, renderManagerService) {
|
|
|
7145
7178
|
const unitId = workbook.getUnitId();
|
|
7146
7179
|
let components, mainComponent, scene, engine;
|
|
7147
7180
|
if (isRenderManagerService(renderManagerService)) {
|
|
7148
|
-
const currentRender = renderManagerService.
|
|
7181
|
+
const currentRender = renderManagerService.getRenderUnitById(unitId);
|
|
7149
7182
|
if (currentRender == null) return null;
|
|
7150
7183
|
components = currentRender.components;
|
|
7151
7184
|
components = currentRender.components;
|
|
@@ -7482,9 +7515,7 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7482
7515
|
}
|
|
7483
7516
|
_getFreeze() {
|
|
7484
7517
|
var _this$_sheetSkeletonM4;
|
|
7485
|
-
|
|
7486
|
-
if (snapshot == null) return;
|
|
7487
|
-
return snapshot.freeze;
|
|
7518
|
+
return (_this$_sheetSkeletonM4 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM4 === void 0 ? void 0 : _this$_sheetSkeletonM4.skeleton.worksheet.getFreeze();
|
|
7488
7519
|
}
|
|
7489
7520
|
_getSheetObject() {
|
|
7490
7521
|
return getSheetObject(this._context.unit, this._context);
|
|
@@ -7621,8 +7652,8 @@ const SetScrollOperation = {
|
|
|
7621
7652
|
if (!params) return false;
|
|
7622
7653
|
const { unitId, sheetId, offsetX = 0, offsetY = 0, sheetViewStartColumn, sheetViewStartRow, duration, screenRatioX, screenRatioY } = params;
|
|
7623
7654
|
const renderManagerService = accessor.get(IRenderManagerService);
|
|
7624
|
-
const scrollManagerService = renderManagerService.
|
|
7625
|
-
const renderUnit = renderManagerService.
|
|
7655
|
+
const scrollManagerService = renderManagerService.getRenderUnitById(unitId).with(SheetScrollManagerService);
|
|
7656
|
+
const renderUnit = renderManagerService.getRenderUnitById(unitId);
|
|
7626
7657
|
if (!renderUnit) return false;
|
|
7627
7658
|
const engine = renderUnit.engine;
|
|
7628
7659
|
const canvasWidth = engine.width;
|
|
@@ -7659,7 +7690,7 @@ const SetScrollRelativeCommand = {
|
|
|
7659
7690
|
const target = getSheetCommandTarget(univerInstanceService);
|
|
7660
7691
|
if (!target) return false;
|
|
7661
7692
|
const { unitId, subUnitId } = target;
|
|
7662
|
-
const currentScroll = renderManagerSrv.
|
|
7693
|
+
const currentScroll = renderManagerSrv.getRenderUnitById(unitId).with(SheetScrollManagerService).getCurrentScrollState();
|
|
7663
7694
|
const { offsetX = 0, offsetY = 0 } = params || {};
|
|
7664
7695
|
const { sheetViewStartRow = 0, sheetViewStartColumn = 0, offsetX: currentOffsetX = 0, offsetY: currentOffsetY = 0 } = currentScroll || {};
|
|
7665
7696
|
return commandService.executeCommand(SetScrollOperation.id, {
|
|
@@ -7687,7 +7718,7 @@ const ScrollCommand = {
|
|
|
7687
7718
|
const target = params.unitId ? getScrollCommandTargetByParams(univerInstanceService, params) : getSheetCommandTarget(univerInstanceService);
|
|
7688
7719
|
if (!target) return false;
|
|
7689
7720
|
const { workbook, worksheet, unitId } = target;
|
|
7690
|
-
const renderUnit = renderManagerSrv.
|
|
7721
|
+
const renderUnit = renderManagerSrv.getRenderUnitById(unitId);
|
|
7691
7722
|
if (!renderUnit) return false;
|
|
7692
7723
|
const currentScroll = renderUnit.with(SheetScrollManagerService).getCurrentScrollState();
|
|
7693
7724
|
if (!worksheet) return false;
|
|
@@ -7725,7 +7756,7 @@ const ScrollToCellCommand = {
|
|
|
7725
7756
|
type: CommandType.COMMAND,
|
|
7726
7757
|
handler: (accessor, params) => {
|
|
7727
7758
|
const instanceService = accessor.get(IUniverInstanceService);
|
|
7728
|
-
return accessor.get(IRenderManagerService).
|
|
7759
|
+
return accessor.get(IRenderManagerService).getRenderUnitById(instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET).getUnitId()).with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
|
|
7729
7760
|
}
|
|
7730
7761
|
};
|
|
7731
7762
|
/**
|
|
@@ -7779,7 +7810,7 @@ let AutoWidthController = class AutoWidthController extends Disposable {
|
|
|
7779
7810
|
const target = getSheetCommandTarget(univerInstanceService, params);
|
|
7780
7811
|
if (!target) return defaultValue;
|
|
7781
7812
|
const { unitId, subUnitId, worksheet } = target;
|
|
7782
|
-
const sheetSkeletonService = this._renderManagerService.
|
|
7813
|
+
const sheetSkeletonService = this._renderManagerService.getRenderUnitById(unitId).with(SheetSkeletonManagerService);
|
|
7783
7814
|
if (!sheetSkeletonService.getCurrentParam()) return defaultValue;
|
|
7784
7815
|
const { skeleton } = sheetSkeletonService.getCurrentParam();
|
|
7785
7816
|
const colsAutoWidthInfo = skeleton.calculateAutoWidthInRange(params.ranges);
|
|
@@ -7843,6 +7874,162 @@ const SetWorksheetColAutoWidthCommand = {
|
|
|
7843
7874
|
}
|
|
7844
7875
|
};
|
|
7845
7876
|
|
|
7877
|
+
//#endregion
|
|
7878
|
+
//#region src/common/utils.ts
|
|
7879
|
+
function getUserListEqual(userList1, userList2) {
|
|
7880
|
+
if (userList1.length !== userList2.length) return false;
|
|
7881
|
+
const sorted1 = userList1.sort((a, b) => a.id.localeCompare(b.id));
|
|
7882
|
+
const sorted2 = userList2.sort((a, b) => a.id.localeCompare(b.id));
|
|
7883
|
+
return sorted1.every((user, index) => {
|
|
7884
|
+
var _user$subject, _sorted2$index$subjec;
|
|
7885
|
+
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;
|
|
7886
|
+
});
|
|
7887
|
+
}
|
|
7888
|
+
function checkCellContentInRanges(worksheet, ranges) {
|
|
7889
|
+
return ranges.some((range) => checkCellContentInRange(worksheet, range));
|
|
7890
|
+
}
|
|
7891
|
+
function checkCellContentInRange(worksheet, range) {
|
|
7892
|
+
const { startRow, startColumn, endColumn, endRow } = range;
|
|
7893
|
+
const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn);
|
|
7894
|
+
let someCellGoingToBeRemoved = false;
|
|
7895
|
+
cellMatrix.forValue((row, col, cellData) => {
|
|
7896
|
+
if (cellData && (row !== startRow || col !== startColumn) && worksheet.cellHasValue(cellData)) {
|
|
7897
|
+
someCellGoingToBeRemoved = true;
|
|
7898
|
+
return false;
|
|
7899
|
+
}
|
|
7900
|
+
});
|
|
7901
|
+
return someCellGoingToBeRemoved;
|
|
7902
|
+
}
|
|
7903
|
+
function getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton) {
|
|
7904
|
+
const activeViewport = scene.getActiveViewportByCoord(Vector2.FromArray([offsetX, offsetY]));
|
|
7905
|
+
if (!activeViewport) return;
|
|
7906
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7907
|
+
const scrollXY = {
|
|
7908
|
+
x: activeViewport.viewportScrollX,
|
|
7909
|
+
y: activeViewport.viewportScrollY
|
|
7910
|
+
};
|
|
7911
|
+
const cellIndex = skeleton.getCellIndexByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
7912
|
+
const mergeCell = skeleton.worksheet.getMergedCell(cellIndex.row, cellIndex.column);
|
|
7913
|
+
return {
|
|
7914
|
+
actualRow: mergeCell ? mergeCell.startRow : cellIndex.row,
|
|
7915
|
+
actualCol: mergeCell ? mergeCell.startColumn : cellIndex.column,
|
|
7916
|
+
mergeCell,
|
|
7917
|
+
row: cellIndex.row,
|
|
7918
|
+
col: cellIndex.column
|
|
7919
|
+
};
|
|
7920
|
+
}
|
|
7921
|
+
function getViewportByCell(row, column, scene, worksheet) {
|
|
7922
|
+
const freeze = worksheet.getFreeze();
|
|
7923
|
+
if (!freeze || freeze.startRow <= 0 && freeze.startColumn <= 0) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7924
|
+
if (row >= freeze.startRow && column >= freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7925
|
+
if (row < freeze.startRow && column < freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP);
|
|
7926
|
+
if (row < freeze.startRow && column >= freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP);
|
|
7927
|
+
if (row >= freeze.startRow && column < freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT);
|
|
7928
|
+
}
|
|
7929
|
+
function transformBound2OffsetBound(originBound, scene, skeleton, worksheet) {
|
|
7930
|
+
const topLeft = transformPosition2Offset(originBound.left, originBound.top, scene, skeleton, worksheet);
|
|
7931
|
+
const bottomRight = transformPosition2Offset(originBound.right, originBound.bottom, scene, skeleton, worksheet);
|
|
7932
|
+
return {
|
|
7933
|
+
left: topLeft.x,
|
|
7934
|
+
top: topLeft.y,
|
|
7935
|
+
right: bottomRight.x,
|
|
7936
|
+
bottom: bottomRight.y
|
|
7937
|
+
};
|
|
7938
|
+
}
|
|
7939
|
+
function transformPosition2Offset(x, y, scene, skeleton, worksheet) {
|
|
7940
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7941
|
+
const viewMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7942
|
+
if (!viewMain) return {
|
|
7943
|
+
x,
|
|
7944
|
+
y
|
|
7945
|
+
};
|
|
7946
|
+
const { startColumn, startRow, xSplit, ySplit } = worksheet.getFreeze();
|
|
7947
|
+
const startSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow - ySplit, startColumn - xSplit, false);
|
|
7948
|
+
const endSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn, false);
|
|
7949
|
+
const { rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
7950
|
+
const freezeWidth = endSheetView.startX - startSheetView.startX;
|
|
7951
|
+
const freezeHeight = endSheetView.startY - startSheetView.startY;
|
|
7952
|
+
const { top, left, viewportScrollX, viewportScrollY } = viewMain;
|
|
7953
|
+
let offsetX;
|
|
7954
|
+
if (x > left) offsetX = (x - viewportScrollX) * scaleX;
|
|
7955
|
+
else offsetX = (freezeWidth + rowHeaderWidth - (left - x)) * scaleX;
|
|
7956
|
+
let offsetY;
|
|
7957
|
+
if (y > top) offsetY = (y - viewportScrollY) * scaleY;
|
|
7958
|
+
else offsetY = (freezeHeight + columnHeaderHeight - (top - y)) * scaleX;
|
|
7959
|
+
return {
|
|
7960
|
+
x: offsetX,
|
|
7961
|
+
y: offsetY
|
|
7962
|
+
};
|
|
7963
|
+
}
|
|
7964
|
+
function getCellRealRange(workbook, worksheet, skeleton, row, col) {
|
|
7965
|
+
let actualRow = row;
|
|
7966
|
+
let actualCol = col;
|
|
7967
|
+
skeleton.overflowCache.forValue((r, c, range) => {
|
|
7968
|
+
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
7969
|
+
actualCol = c;
|
|
7970
|
+
actualRow = r;
|
|
7971
|
+
}
|
|
7972
|
+
});
|
|
7973
|
+
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
7974
|
+
return {
|
|
7975
|
+
unitId: workbook.getUnitId(),
|
|
7976
|
+
subUnitId: worksheet.getSheetId(),
|
|
7977
|
+
workbook,
|
|
7978
|
+
worksheet,
|
|
7979
|
+
row: actualCell.actualRow,
|
|
7980
|
+
col: actualCell.actualColumn
|
|
7981
|
+
};
|
|
7982
|
+
}
|
|
7983
|
+
function getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
7984
|
+
const { scene } = currentRender;
|
|
7985
|
+
const unitId = workbook.getUnitId();
|
|
7986
|
+
const { skeleton, sheetId } = skeletonParam;
|
|
7987
|
+
const cellIndex = getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton);
|
|
7988
|
+
if (!cellIndex) return null;
|
|
7989
|
+
let { actualCol, actualRow } = cellIndex;
|
|
7990
|
+
const originLocation = {
|
|
7991
|
+
unitId,
|
|
7992
|
+
subUnitId: sheetId,
|
|
7993
|
+
workbook,
|
|
7994
|
+
worksheet,
|
|
7995
|
+
row: actualRow,
|
|
7996
|
+
col: actualCol
|
|
7997
|
+
};
|
|
7998
|
+
skeleton.overflowCache.forValue((r, c, range) => {
|
|
7999
|
+
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
8000
|
+
actualCol = c;
|
|
8001
|
+
actualRow = r;
|
|
8002
|
+
}
|
|
8003
|
+
});
|
|
8004
|
+
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
8005
|
+
const location = getCellRealRange(workbook, worksheet, skeleton, actualRow, actualCol);
|
|
8006
|
+
let anchorCell;
|
|
8007
|
+
if (actualCell.mergeInfo) anchorCell = actualCell.mergeInfo;
|
|
8008
|
+
else anchorCell = {
|
|
8009
|
+
startRow: location.row,
|
|
8010
|
+
endRow: location.row,
|
|
8011
|
+
startColumn: location.col,
|
|
8012
|
+
endColumn: location.col
|
|
8013
|
+
};
|
|
8014
|
+
const activeViewport = scene.getActiveViewportByCoord(Vector2.FromArray([offsetX, offsetY]));
|
|
8015
|
+
if (!activeViewport) return;
|
|
8016
|
+
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8017
|
+
const scrollXY = {
|
|
8018
|
+
x: activeViewport.viewportScrollX,
|
|
8019
|
+
y: activeViewport.viewportScrollY
|
|
8020
|
+
};
|
|
8021
|
+
return {
|
|
8022
|
+
position: {
|
|
8023
|
+
startX: (skeleton.getOffsetByColumn(anchorCell.startColumn - 1) - scrollXY.x) * scaleX,
|
|
8024
|
+
endX: (skeleton.getOffsetByColumn(anchorCell.endColumn) - scrollXY.x) * scaleX,
|
|
8025
|
+
startY: (skeleton.getOffsetByRow(anchorCell.startRow - 1) - scrollXY.y) * scaleY,
|
|
8026
|
+
endY: (skeleton.getOffsetByRow(anchorCell.endRow) - scrollXY.y) * scaleY
|
|
8027
|
+
},
|
|
8028
|
+
location: originLocation,
|
|
8029
|
+
overflowLocation: location
|
|
8030
|
+
};
|
|
8031
|
+
}
|
|
8032
|
+
|
|
7846
8033
|
//#endregion
|
|
7847
8034
|
//#region src/services/editor-bridge.service.ts
|
|
7848
8035
|
let EditorBridgeService = class EditorBridgeService extends Disposable {
|
|
@@ -7916,15 +8103,16 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
|
|
|
7916
8103
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
7917
8104
|
const worksheet = workbook.getActiveSheet();
|
|
7918
8105
|
if (!worksheet || worksheet.getSheetId() !== sheetId) return;
|
|
7919
|
-
|
|
7920
|
-
if (!renderUnit) return;
|
|
8106
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
7921
8107
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
|
|
7922
8108
|
if (!skeleton) return;
|
|
7923
8109
|
const actualRangeWithCoord = convertCellToRange(attachPrimaryWithCoord(skeleton, primary));
|
|
7924
8110
|
const canvasOffset = getCanvasOffsetByEngine(engine);
|
|
7925
8111
|
let { startX, startY, endX, endY } = actualRangeWithCoord;
|
|
7926
8112
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
7927
|
-
const
|
|
8113
|
+
const viewport = getViewportByCell(primary.startRow, primary.startColumn, scene, worksheet);
|
|
8114
|
+
if (!viewport) return;
|
|
8115
|
+
const scrollXY = scene.getViewportScrollXY(viewport);
|
|
7928
8116
|
startX = convertTransformToOffsetX(startX, scaleX, scrollXY);
|
|
7929
8117
|
startY = convertTransformToOffsetY(startY, scaleY, scrollXY);
|
|
7930
8118
|
endX = convertTransformToOffsetX(endX, scaleX, scrollXY);
|
|
@@ -8015,8 +8203,7 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
|
|
|
8015
8203
|
if (!workbook || workbook.getUnitId() !== unitId) return;
|
|
8016
8204
|
const worksheet = workbook.getActiveSheet();
|
|
8017
8205
|
if (!worksheet || worksheet.getSheetId() !== sheetId) return;
|
|
8018
|
-
|
|
8019
|
-
if (!renderUnit) return;
|
|
8206
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
8020
8207
|
const skeleton = this._sheetSkeletonService.getSkeleton(unitId, sheetId);
|
|
8021
8208
|
if (!skeleton) return;
|
|
8022
8209
|
const { startRow, startColumn } = primary;
|
|
@@ -8024,7 +8211,9 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
|
|
|
8024
8211
|
const canvasOffset = getCanvasOffsetByEngine(engine);
|
|
8025
8212
|
let { startX, startY, endX, endY } = actualRangeWithCoord;
|
|
8026
8213
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8027
|
-
const
|
|
8214
|
+
const viewport = getViewportByCell(startRow, startColumn, scene, worksheet);
|
|
8215
|
+
if (!viewport) return;
|
|
8216
|
+
const scrollXY = scene.getViewportScrollXY(viewport);
|
|
8028
8217
|
startX = convertTransformToOffsetX(startX, scaleX, scrollXY);
|
|
8029
8218
|
startY = convertTransformToOffsetY(startY, scaleY, scrollXY);
|
|
8030
8219
|
endX = convertTransformToOffsetX(endX, scaleX, scrollXY);
|
|
@@ -8206,7 +8395,7 @@ const SetZoomRatioOperation = {
|
|
|
8206
8395
|
id: "sheet.operation.set-zoom-ratio",
|
|
8207
8396
|
type: CommandType.OPERATION,
|
|
8208
8397
|
handler: (accessor, params) => {
|
|
8209
|
-
const renderUnit = accessor.get(IRenderManagerService).
|
|
8398
|
+
const renderUnit = accessor.get(IRenderManagerService).getRenderUnitById(params.unitId);
|
|
8210
8399
|
if (!renderUnit) return false;
|
|
8211
8400
|
return renderUnit.with(SheetsZoomRenderController).updateZoom(params.subUnitId, params.zoomRatio);
|
|
8212
8401
|
}
|
|
@@ -8391,7 +8580,6 @@ const SHEETS_UI_PLUGIN_CONFIG_KEY = "sheets-ui.config";
|
|
|
8391
8580
|
const configSymbol = Symbol(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
8392
8581
|
const defaultPluginConfig = {
|
|
8393
8582
|
formulaBar: true,
|
|
8394
|
-
statusBarStatistic: true,
|
|
8395
8583
|
protectedRangeShadow: true,
|
|
8396
8584
|
maxAutoHeightCount: 1e3
|
|
8397
8585
|
};
|
|
@@ -8444,8 +8632,6 @@ const SetCellEditVisibleWithF2Operation = {
|
|
|
8444
8632
|
/**
|
|
8445
8633
|
* When the editor is not clicked to change the cursor,
|
|
8446
8634
|
* the arrow keys will exit editing and move the cell.
|
|
8447
|
-
*
|
|
8448
|
-
* @deprecated Should not use operation as an event.
|
|
8449
8635
|
*/
|
|
8450
8636
|
const SetCellEditVisibleArrowOperation = {
|
|
8451
8637
|
id: "sheet.operation.set-cell-edit-visible-arrow",
|
|
@@ -8477,7 +8663,7 @@ const ScrollToRangeOperation = {
|
|
|
8477
8663
|
const renderManagerService = accessor.get(IRenderManagerService);
|
|
8478
8664
|
const unitId = (_params$unitId = params.unitId) !== null && _params$unitId !== void 0 ? _params$unitId : (_instanceService$getC = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId();
|
|
8479
8665
|
if (!unitId) return false;
|
|
8480
|
-
const renderUnit = renderManagerService.
|
|
8666
|
+
const renderUnit = renderManagerService.getRenderUnitById(unitId);
|
|
8481
8667
|
if (!renderUnit) return false;
|
|
8482
8668
|
return renderUnit.with(SheetsScrollRenderController).scrollToRange(params.range, params.forceTop, params.forceLeft);
|
|
8483
8669
|
}
|
|
@@ -8493,224 +8679,63 @@ const SheetPermissionOpenDialogOperation = {
|
|
|
8493
8679
|
dialogService.close("DESKTOP_FIND_REPLACE_DIALOG");
|
|
8494
8680
|
dialogService.open({
|
|
8495
8681
|
id: UNIVER_SHEET_PERMISSION_DIALOG_ID,
|
|
8496
|
-
title: { title: "sheets-ui.permission.dialog.allowedPermissionType" },
|
|
8497
|
-
children: { label: UNIVER_SHEET_PERMISSION_DIALOG },
|
|
8498
|
-
width: 393,
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
//#
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
*
|
|
8510
|
-
*
|
|
8511
|
-
*
|
|
8512
|
-
*
|
|
8513
|
-
*
|
|
8514
|
-
*
|
|
8515
|
-
*
|
|
8516
|
-
*
|
|
8517
|
-
*
|
|
8518
|
-
*
|
|
8519
|
-
*
|
|
8520
|
-
*
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
//#
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
accessor.get(
|
|
8533
|
-
const
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
});
|
|
8550
|
-
break;
|
|
8551
|
-
default:
|
|
8552
|
-
sidebarService.close();
|
|
8553
|
-
break;
|
|
8554
|
-
}
|
|
8555
|
-
return true;
|
|
8556
|
-
}
|
|
8557
|
-
};
|
|
8558
|
-
|
|
8559
|
-
//#endregion
|
|
8560
|
-
//#region src/common/utils.ts
|
|
8561
|
-
function getUserListEqual(userList1, userList2) {
|
|
8562
|
-
if (userList1.length !== userList2.length) return false;
|
|
8563
|
-
const sorted1 = userList1.sort((a, b) => a.id.localeCompare(b.id));
|
|
8564
|
-
const sorted2 = userList2.sort((a, b) => a.id.localeCompare(b.id));
|
|
8565
|
-
return sorted1.every((user, index) => {
|
|
8566
|
-
var _user$subject, _sorted2$index$subjec;
|
|
8567
|
-
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;
|
|
8568
|
-
});
|
|
8569
|
-
}
|
|
8570
|
-
function checkCellContentInRanges(worksheet, ranges) {
|
|
8571
|
-
return ranges.some((range) => checkCellContentInRange(worksheet, range));
|
|
8572
|
-
}
|
|
8573
|
-
function checkCellContentInRange(worksheet, range) {
|
|
8574
|
-
const { startRow, startColumn, endColumn, endRow } = range;
|
|
8575
|
-
const cellMatrix = worksheet.getMatrixWithMergedCells(startRow, startColumn, endRow, endColumn);
|
|
8576
|
-
let someCellGoingToBeRemoved = false;
|
|
8577
|
-
cellMatrix.forValue((row, col, cellData) => {
|
|
8578
|
-
if (cellData && (row !== startRow || col !== startColumn) && worksheet.cellHasValue(cellData)) {
|
|
8579
|
-
someCellGoingToBeRemoved = true;
|
|
8580
|
-
return false;
|
|
8581
|
-
}
|
|
8582
|
-
});
|
|
8583
|
-
return someCellGoingToBeRemoved;
|
|
8584
|
-
}
|
|
8585
|
-
function getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton) {
|
|
8586
|
-
const activeViewport = scene.getActiveViewportByCoord(Vector2.FromArray([offsetX, offsetY]));
|
|
8587
|
-
if (!activeViewport) return;
|
|
8588
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8589
|
-
const scrollXY = {
|
|
8590
|
-
x: activeViewport.viewportScrollX,
|
|
8591
|
-
y: activeViewport.viewportScrollY
|
|
8592
|
-
};
|
|
8593
|
-
const cellIndex = skeleton.getCellIndexByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
8594
|
-
const mergeCell = skeleton.worksheet.getMergedCell(cellIndex.row, cellIndex.column);
|
|
8595
|
-
return {
|
|
8596
|
-
actualRow: mergeCell ? mergeCell.startRow : cellIndex.row,
|
|
8597
|
-
actualCol: mergeCell ? mergeCell.startColumn : cellIndex.column,
|
|
8598
|
-
mergeCell,
|
|
8599
|
-
row: cellIndex.row,
|
|
8600
|
-
col: cellIndex.column
|
|
8601
|
-
};
|
|
8602
|
-
}
|
|
8603
|
-
function getViewportByCell(row, column, scene, worksheet) {
|
|
8604
|
-
const freeze = worksheet.getFreeze();
|
|
8605
|
-
if (!freeze || freeze.startRow <= 0 && freeze.startColumn <= 0) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8606
|
-
if (row >= freeze.startRow && column >= freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8607
|
-
if (row < freeze.startRow && column < freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP);
|
|
8608
|
-
if (row < freeze.startRow && column >= freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP);
|
|
8609
|
-
if (row >= freeze.startRow && column < freeze.startColumn) return scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT);
|
|
8610
|
-
}
|
|
8611
|
-
function transformBound2OffsetBound(originBound, scene, skeleton, worksheet) {
|
|
8612
|
-
const topLeft = transformPosition2Offset(originBound.left, originBound.top, scene, skeleton, worksheet);
|
|
8613
|
-
const bottomRight = transformPosition2Offset(originBound.right, originBound.bottom, scene, skeleton, worksheet);
|
|
8614
|
-
return {
|
|
8615
|
-
left: topLeft.x,
|
|
8616
|
-
top: topLeft.y,
|
|
8617
|
-
right: bottomRight.x,
|
|
8618
|
-
bottom: bottomRight.y
|
|
8619
|
-
};
|
|
8620
|
-
}
|
|
8621
|
-
function transformPosition2Offset(x, y, scene, skeleton, worksheet) {
|
|
8622
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8623
|
-
const viewMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
8624
|
-
if (!viewMain) return {
|
|
8625
|
-
x,
|
|
8626
|
-
y
|
|
8627
|
-
};
|
|
8628
|
-
const { startColumn, startRow, xSplit, ySplit } = worksheet.getFreeze();
|
|
8629
|
-
const startSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow - ySplit, startColumn - xSplit, false);
|
|
8630
|
-
const endSheetView = skeleton.getNoMergeCellWithCoordByIndex(startRow, startColumn, false);
|
|
8631
|
-
const { rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
8632
|
-
const freezeWidth = endSheetView.startX - startSheetView.startX;
|
|
8633
|
-
const freezeHeight = endSheetView.startY - startSheetView.startY;
|
|
8634
|
-
const { top, left, viewportScrollX, viewportScrollY } = viewMain;
|
|
8635
|
-
let offsetX;
|
|
8636
|
-
if (x > left) offsetX = (x - viewportScrollX) * scaleX;
|
|
8637
|
-
else offsetX = (freezeWidth + rowHeaderWidth - (left - x)) * scaleX;
|
|
8638
|
-
let offsetY;
|
|
8639
|
-
if (y > top) offsetY = (y - viewportScrollY) * scaleY;
|
|
8640
|
-
else offsetY = (freezeHeight + columnHeaderHeight - (top - y)) * scaleX;
|
|
8641
|
-
return {
|
|
8642
|
-
x: offsetX,
|
|
8643
|
-
y: offsetY
|
|
8644
|
-
};
|
|
8645
|
-
}
|
|
8646
|
-
function getCellRealRange(workbook, worksheet, skeleton, row, col) {
|
|
8647
|
-
let actualRow = row;
|
|
8648
|
-
let actualCol = col;
|
|
8649
|
-
skeleton.overflowCache.forValue((r, c, range) => {
|
|
8650
|
-
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
8651
|
-
actualCol = c;
|
|
8652
|
-
actualRow = r;
|
|
8653
|
-
}
|
|
8654
|
-
});
|
|
8655
|
-
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualCol);
|
|
8656
|
-
return {
|
|
8657
|
-
unitId: workbook.getUnitId(),
|
|
8658
|
-
subUnitId: worksheet.getSheetId(),
|
|
8659
|
-
workbook,
|
|
8660
|
-
worksheet,
|
|
8661
|
-
row: actualCell.actualRow,
|
|
8662
|
-
col: actualCell.actualColumn
|
|
8663
|
-
};
|
|
8664
|
-
}
|
|
8665
|
-
function getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
8666
|
-
const { scene } = currentRender;
|
|
8667
|
-
const unitId = workbook.getUnitId();
|
|
8668
|
-
const { skeleton, sheetId } = skeletonParam;
|
|
8669
|
-
const cellIndex = getCellIndexByOffsetWithMerge(offsetX, offsetY, scene, skeleton);
|
|
8670
|
-
if (!cellIndex) return null;
|
|
8671
|
-
let { actualCol, actualRow } = cellIndex;
|
|
8672
|
-
const originLocation = {
|
|
8673
|
-
unitId,
|
|
8674
|
-
subUnitId: sheetId,
|
|
8675
|
-
workbook,
|
|
8676
|
-
worksheet,
|
|
8677
|
-
row: actualRow,
|
|
8678
|
-
col: actualCol
|
|
8679
|
-
};
|
|
8680
|
-
skeleton.overflowCache.forValue((r, c, range) => {
|
|
8681
|
-
if (range.startRow <= actualRow && range.endRow >= actualRow && range.startColumn <= actualCol && range.endColumn >= actualCol) {
|
|
8682
|
-
actualCol = c;
|
|
8683
|
-
actualRow = r;
|
|
8682
|
+
title: { title: "sheets-ui.permission.dialog.allowedPermissionType" },
|
|
8683
|
+
children: { label: UNIVER_SHEET_PERMISSION_DIALOG },
|
|
8684
|
+
width: 393,
|
|
8685
|
+
onClose: () => dialogService.close(UNIVER_SHEET_PERMISSION_DIALOG_ID)
|
|
8686
|
+
});
|
|
8687
|
+
return true;
|
|
8688
|
+
}
|
|
8689
|
+
};
|
|
8690
|
+
|
|
8691
|
+
//#endregion
|
|
8692
|
+
//#region src/views/defined-name/component-name.ts
|
|
8693
|
+
/**
|
|
8694
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
8695
|
+
*
|
|
8696
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8697
|
+
* you may not use this file except in compliance with the License.
|
|
8698
|
+
* You may obtain a copy of the License at
|
|
8699
|
+
*
|
|
8700
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8701
|
+
*
|
|
8702
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8703
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8704
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8705
|
+
* See the License for the specific language governing permissions and
|
|
8706
|
+
* limitations under the License.
|
|
8707
|
+
*/
|
|
8708
|
+
const DEFINED_NAME_CONTAINER = "DefinedNameContainer";
|
|
8709
|
+
|
|
8710
|
+
//#endregion
|
|
8711
|
+
//#region src/commands/operations/sidebar-defined-name.operation.ts
|
|
8712
|
+
const SidebarDefinedNameOperation = {
|
|
8713
|
+
id: "sidebar.operation.defined-name",
|
|
8714
|
+
type: CommandType.COMMAND,
|
|
8715
|
+
handler: async (accessor, params) => {
|
|
8716
|
+
const sidebarService = accessor.get(ISidebarService);
|
|
8717
|
+
accessor.get(IEditorService);
|
|
8718
|
+
const localeService = accessor.get(LocaleService);
|
|
8719
|
+
const target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
|
|
8720
|
+
if (!target) return false;
|
|
8721
|
+
const { unitId } = target;
|
|
8722
|
+
switch (params.value) {
|
|
8723
|
+
case "open":
|
|
8724
|
+
sidebarService.open({
|
|
8725
|
+
id: DEFINED_NAME_CONTAINER,
|
|
8726
|
+
header: { title: localeService.t("sheets-ui.definedName.featureTitle") },
|
|
8727
|
+
children: { label: DEFINED_NAME_CONTAINER },
|
|
8728
|
+
onClose: () => {},
|
|
8729
|
+
width: 333
|
|
8730
|
+
});
|
|
8731
|
+
break;
|
|
8732
|
+
default:
|
|
8733
|
+
sidebarService.close();
|
|
8734
|
+
break;
|
|
8684
8735
|
}
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
let anchorCell;
|
|
8689
|
-
if (actualCell.mergeInfo) anchorCell = actualCell.mergeInfo;
|
|
8690
|
-
else anchorCell = {
|
|
8691
|
-
startRow: location.row,
|
|
8692
|
-
endRow: location.row,
|
|
8693
|
-
startColumn: location.col,
|
|
8694
|
-
endColumn: location.col
|
|
8695
|
-
};
|
|
8696
|
-
const activeViewport = scene.getActiveViewportByCoord(Vector2.FromArray([offsetX, offsetY]));
|
|
8697
|
-
if (!activeViewport) return;
|
|
8698
|
-
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
8699
|
-
const scrollXY = {
|
|
8700
|
-
x: activeViewport.viewportScrollX,
|
|
8701
|
-
y: activeViewport.viewportScrollY
|
|
8702
|
-
};
|
|
8703
|
-
return {
|
|
8704
|
-
position: {
|
|
8705
|
-
startX: (skeleton.getOffsetByColumn(anchorCell.startColumn - 1) - scrollXY.x) * scaleX,
|
|
8706
|
-
endX: (skeleton.getOffsetByColumn(anchorCell.endColumn) - scrollXY.x) * scaleX,
|
|
8707
|
-
startY: (skeleton.getOffsetByRow(anchorCell.startRow - 1) - scrollXY.y) * scaleY,
|
|
8708
|
-
endY: (skeleton.getOffsetByRow(anchorCell.endRow) - scrollXY.y) * scaleY
|
|
8709
|
-
},
|
|
8710
|
-
location: originLocation,
|
|
8711
|
-
overflowLocation: location
|
|
8712
|
-
};
|
|
8713
|
-
}
|
|
8736
|
+
return true;
|
|
8737
|
+
}
|
|
8738
|
+
};
|
|
8714
8739
|
|
|
8715
8740
|
//#endregion
|
|
8716
8741
|
//#region src/consts/plugin-name.ts
|
|
@@ -8827,21 +8852,18 @@ SheetsRenderService = __decorate([
|
|
|
8827
8852
|
//#endregion
|
|
8828
8853
|
//#region src/controllers/auto-fill-ui.controller.ts
|
|
8829
8854
|
let AutoFillUIController = class AutoFillUIController extends Disposable {
|
|
8830
|
-
constructor(_univerInstanceService, _commandService, _autoFillService, _autoFillController,
|
|
8855
|
+
constructor(_univerInstanceService, _commandService, _autoFillService, _autoFillController, _sheetsRenderService) {
|
|
8831
8856
|
super();
|
|
8832
8857
|
this._univerInstanceService = _univerInstanceService;
|
|
8833
8858
|
this._commandService = _commandService;
|
|
8834
8859
|
this._autoFillService = _autoFillService;
|
|
8835
8860
|
this._autoFillController = _autoFillController;
|
|
8836
|
-
this._editorBridgeService = _editorBridgeService;
|
|
8837
|
-
this._renderManagerService = _renderManagerService;
|
|
8838
8861
|
this._sheetsRenderService = _sheetsRenderService;
|
|
8839
8862
|
_defineProperty(this, "_currentLocation", null);
|
|
8840
8863
|
this._init();
|
|
8841
8864
|
}
|
|
8842
8865
|
_init() {
|
|
8843
8866
|
this._initDefaultHook();
|
|
8844
|
-
this._initSelectionControlFillChanged();
|
|
8845
8867
|
this._initQuitListener();
|
|
8846
8868
|
this._initSkeletonChange();
|
|
8847
8869
|
}
|
|
@@ -8896,127 +8918,120 @@ let AutoFillUIController = class AutoFillUIController extends Disposable {
|
|
|
8896
8918
|
this._autoFillController.quit();
|
|
8897
8919
|
this._autoFillService.setShowMenu(false);
|
|
8898
8920
|
}
|
|
8921
|
+
};
|
|
8922
|
+
AutoFillUIController = __decorate([
|
|
8923
|
+
__decorateParam(0, IUniverInstanceService),
|
|
8924
|
+
__decorateParam(1, ICommandService),
|
|
8925
|
+
__decorateParam(2, IAutoFillService),
|
|
8926
|
+
__decorateParam(3, Inject(AutoFillController)),
|
|
8927
|
+
__decorateParam(4, Inject(SheetsRenderService))
|
|
8928
|
+
], AutoFillUIController);
|
|
8929
|
+
let AutoFillRenderController = class AutoFillRenderController extends Disposable {
|
|
8930
|
+
constructor(_context, _selectionRenderService, _selectionManagerService, _commandService, _editorBridgeService) {
|
|
8931
|
+
super();
|
|
8932
|
+
this._context = _context;
|
|
8933
|
+
this._selectionRenderService = _selectionRenderService;
|
|
8934
|
+
this._selectionManagerService = _selectionManagerService;
|
|
8935
|
+
this._commandService = _commandService;
|
|
8936
|
+
this._editorBridgeService = _editorBridgeService;
|
|
8937
|
+
_defineProperty(this, "_selectionControlDisposables", new DisposableCollection());
|
|
8938
|
+
this._initSelectionControlFillChanged();
|
|
8939
|
+
}
|
|
8940
|
+
dispose() {
|
|
8941
|
+
this._selectionControlDisposables.dispose();
|
|
8942
|
+
super.dispose();
|
|
8943
|
+
}
|
|
8899
8944
|
_initSelectionControlFillChanged() {
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
const scheduleUpdateListener = (listener) => {
|
|
8904
|
-
if (pendingRetry) return;
|
|
8905
|
-
pendingRetry = true;
|
|
8906
|
-
setTimeout(() => {
|
|
8907
|
-
pendingRetry = false;
|
|
8908
|
-
listener();
|
|
8909
|
-
}, 0);
|
|
8910
|
-
};
|
|
8911
|
-
const updateListener = () => {
|
|
8912
|
-
disposableCollection.dispose();
|
|
8913
|
-
const currentRenderer = getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
|
|
8914
|
-
if (!currentRenderer) return;
|
|
8915
|
-
const selectionRenderService = getResolvedSelectionRenderService(currentRenderer);
|
|
8916
|
-
if (!selectionRenderService) {
|
|
8917
|
-
retryCount += 1;
|
|
8918
|
-
if (retryCount <= 3) scheduleUpdateListener(updateListener);
|
|
8919
|
-
return;
|
|
8920
|
-
}
|
|
8921
|
-
retryCount = 0;
|
|
8922
|
-
selectionRenderService.getSelectionControls().forEach((controlSelection) => {
|
|
8923
|
-
disposableCollection.add(controlSelection.selectionFilled$.subscribe((filled) => {
|
|
8924
|
-
if (filled == null || filled.startColumn === -1 || filled.startRow === -1 || filled.endColumn === -1 || filled.endRow === -1) return;
|
|
8925
|
-
const source = {
|
|
8926
|
-
startColumn: controlSelection.model.startColumn,
|
|
8927
|
-
endColumn: controlSelection.model.endColumn,
|
|
8928
|
-
startRow: controlSelection.model.startRow,
|
|
8929
|
-
endRow: controlSelection.model.endRow
|
|
8930
|
-
};
|
|
8931
|
-
const selection = {
|
|
8932
|
-
startColumn: filled.startColumn,
|
|
8933
|
-
endColumn: filled.endColumn,
|
|
8934
|
-
startRow: filled.startRow,
|
|
8935
|
-
endRow: filled.endRow
|
|
8936
|
-
};
|
|
8937
|
-
this._commandService.executeCommand(AutoFillCommand.id, {
|
|
8938
|
-
sourceRange: source,
|
|
8939
|
-
targetRange: selection
|
|
8940
|
-
});
|
|
8941
|
-
}));
|
|
8942
|
-
disposableCollection.add(controlSelection.fillControl.onDblclick$.subscribeEvent(() => {
|
|
8943
|
-
const source = {
|
|
8944
|
-
startColumn: controlSelection.model.startColumn,
|
|
8945
|
-
endColumn: controlSelection.model.endColumn,
|
|
8946
|
-
startRow: controlSelection.model.startRow,
|
|
8947
|
-
endRow: controlSelection.model.endRow
|
|
8948
|
-
};
|
|
8949
|
-
this._handleDbClickFill(source);
|
|
8950
|
-
}));
|
|
8951
|
-
disposableCollection.add(controlSelection.fillControl.onPointerDown$.subscribeEvent(() => {
|
|
8952
|
-
if (this._editorBridgeService.isVisible().visible) this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
8953
|
-
visible: false,
|
|
8954
|
-
eventType: DeviceInputEventType.PointerDown,
|
|
8955
|
-
unitId: currentRenderer.unitId
|
|
8956
|
-
});
|
|
8957
|
-
}));
|
|
8958
|
-
});
|
|
8959
|
-
};
|
|
8960
|
-
scheduleUpdateListener(updateListener);
|
|
8961
|
-
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
8962
|
-
if (command.id === SetSelectionsOperation.id) scheduleUpdateListener(updateListener);
|
|
8945
|
+
this._updateSelectionControlListeners();
|
|
8946
|
+
this.disposeWithMe(this._selectionManagerService.selectionChanged$.subscribe(() => {
|
|
8947
|
+
this._updateSelectionControlListeners();
|
|
8963
8948
|
}));
|
|
8964
|
-
this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe(() => scheduleUpdateListener(updateListener)));
|
|
8965
8949
|
}
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8950
|
+
_updateSelectionControlListeners() {
|
|
8951
|
+
this._selectionControlDisposables.dispose();
|
|
8952
|
+
this._selectionRenderService.getSelectionControls().forEach((controlSelection) => {
|
|
8953
|
+
this._selectionControlDisposables.add(controlSelection.selectionFilled$.subscribe((filled) => {
|
|
8954
|
+
if (filled == null || filled.startColumn === -1 || filled.startRow === -1 || filled.endColumn === -1 || filled.endRow === -1) return;
|
|
8955
|
+
const sourceRange = {
|
|
8956
|
+
startColumn: controlSelection.model.startColumn,
|
|
8957
|
+
endColumn: controlSelection.model.endColumn,
|
|
8958
|
+
startRow: controlSelection.model.startRow,
|
|
8959
|
+
endRow: controlSelection.model.endRow
|
|
8960
|
+
};
|
|
8961
|
+
const targetRange = {
|
|
8962
|
+
startColumn: filled.startColumn,
|
|
8963
|
+
endColumn: filled.endColumn,
|
|
8964
|
+
startRow: filled.startRow,
|
|
8965
|
+
endRow: filled.endRow
|
|
8966
|
+
};
|
|
8967
|
+
this._executeAutoFill(sourceRange, targetRange);
|
|
8968
|
+
}));
|
|
8969
|
+
this._selectionControlDisposables.add(controlSelection.fillControl.onDblclick$.subscribeEvent(() => {
|
|
8970
|
+
const sourceRange = {
|
|
8971
|
+
startColumn: controlSelection.model.startColumn,
|
|
8972
|
+
endColumn: controlSelection.model.endColumn,
|
|
8973
|
+
startRow: controlSelection.model.startRow,
|
|
8974
|
+
endRow: controlSelection.model.endRow
|
|
8975
|
+
};
|
|
8976
|
+
this._handleDbClickFill(sourceRange);
|
|
8977
|
+
}));
|
|
8978
|
+
this._selectionControlDisposables.add(controlSelection.fillControl.onPointerDown$.subscribeEvent(() => {
|
|
8979
|
+
if (this._editorBridgeService.isVisible().visible) this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
8980
|
+
visible: false,
|
|
8981
|
+
eventType: DeviceInputEventType.PointerDown,
|
|
8982
|
+
unitId: this._context.unitId
|
|
8983
|
+
});
|
|
8984
|
+
}));
|
|
8985
|
+
});
|
|
8986
|
+
}
|
|
8987
|
+
_executeAutoFill(sourceRange, targetRange) {
|
|
8988
|
+
const subUnitId = this._context.unit.getActiveSheet().getSheetId();
|
|
8969
8989
|
this._commandService.executeCommand(AutoFillCommand.id, {
|
|
8970
|
-
sourceRange
|
|
8971
|
-
targetRange
|
|
8990
|
+
sourceRange,
|
|
8991
|
+
targetRange,
|
|
8992
|
+
unitId: this._context.unitId,
|
|
8993
|
+
subUnitId
|
|
8972
8994
|
});
|
|
8973
8995
|
}
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
if (!worksheet) return source;
|
|
8979
|
-
const matrix = worksheet.getCellMatrix();
|
|
8980
|
-
const maxRow = worksheet.getMaxRows();
|
|
8981
|
-
const maxColumn = worksheet.getMaxColumns();
|
|
8982
|
-
let detectEndRow = endRow + 1;
|
|
8983
|
-
if (startColumn > 0 && ((_matrix$getValue = matrix.getValue(detectEndRow, startColumn - 1)) === null || _matrix$getValue === void 0 ? void 0 : _matrix$getValue.v) != null) {
|
|
8984
|
-
var _matrix$getValue2;
|
|
8985
|
-
while (((_matrix$getValue2 = matrix.getValue(detectEndRow + 1, startColumn - 1)) === null || _matrix$getValue2 === void 0 ? void 0 : _matrix$getValue2.v) != null && detectEndRow < maxRow) detectEndRow += 1;
|
|
8986
|
-
} else if (endColumn < maxColumn - 1 && ((_matrix$getValue3 = matrix.getValue(detectEndRow, endColumn + 1)) === null || _matrix$getValue3 === void 0 ? void 0 : _matrix$getValue3.v) != null) {
|
|
8987
|
-
var _matrix$getValue4;
|
|
8988
|
-
while (((_matrix$getValue4 = matrix.getValue(detectEndRow + 1, endColumn + 1)) === null || _matrix$getValue4 === void 0 ? void 0 : _matrix$getValue4.v) != null && detectEndRow < maxRow) detectEndRow += 1;
|
|
8989
|
-
} else detectEndRow = endRow;
|
|
8990
|
-
for (let i = endRow + 1; i <= detectEndRow; i++) for (let j = startColumn; j <= endColumn; j++) {
|
|
8991
|
-
var _matrix$getValue5;
|
|
8992
|
-
if (((_matrix$getValue5 = matrix.getValue(i, j)) === null || _matrix$getValue5 === void 0 ? void 0 : _matrix$getValue5.v) != null) {
|
|
8993
|
-
detectEndRow = i - 1;
|
|
8994
|
-
break;
|
|
8995
|
-
}
|
|
8996
|
-
}
|
|
8997
|
-
return {
|
|
8998
|
-
startColumn,
|
|
8999
|
-
endColumn,
|
|
9000
|
-
startRow,
|
|
9001
|
-
endRow: detectEndRow
|
|
9002
|
-
};
|
|
8996
|
+
_handleDbClickFill(source) {
|
|
8997
|
+
const selection = detectAutoFillRange(source, this._context.unit.getActiveSheet());
|
|
8998
|
+
if (selection.endRow <= source.endRow) return;
|
|
8999
|
+
this._executeAutoFill(source, selection);
|
|
9003
9000
|
}
|
|
9004
9001
|
};
|
|
9005
|
-
|
|
9006
|
-
__decorateParam(
|
|
9007
|
-
__decorateParam(
|
|
9008
|
-
__decorateParam(
|
|
9009
|
-
__decorateParam(
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
const
|
|
9017
|
-
|
|
9018
|
-
if (
|
|
9019
|
-
|
|
9002
|
+
AutoFillRenderController = __decorate([
|
|
9003
|
+
__decorateParam(1, Inject(ISheetSelectionRenderService)),
|
|
9004
|
+
__decorateParam(2, Inject(SheetsSelectionsService)),
|
|
9005
|
+
__decorateParam(3, ICommandService),
|
|
9006
|
+
__decorateParam(4, IEditorBridgeService)
|
|
9007
|
+
], AutoFillRenderController);
|
|
9008
|
+
function detectAutoFillRange(source, worksheet) {
|
|
9009
|
+
var _matrix$getValue, _matrix$getValue3;
|
|
9010
|
+
const { startRow, endRow, startColumn, endColumn } = source;
|
|
9011
|
+
const matrix = worksheet.getCellMatrix();
|
|
9012
|
+
const maxRow = worksheet.getMaxRows();
|
|
9013
|
+
const maxColumn = worksheet.getMaxColumns();
|
|
9014
|
+
let detectEndRow = endRow + 1;
|
|
9015
|
+
if (startColumn > 0 && ((_matrix$getValue = matrix.getValue(detectEndRow, startColumn - 1)) === null || _matrix$getValue === void 0 ? void 0 : _matrix$getValue.v) != null) {
|
|
9016
|
+
var _matrix$getValue2;
|
|
9017
|
+
while (((_matrix$getValue2 = matrix.getValue(detectEndRow + 1, startColumn - 1)) === null || _matrix$getValue2 === void 0 ? void 0 : _matrix$getValue2.v) != null && detectEndRow < maxRow) detectEndRow += 1;
|
|
9018
|
+
} else if (endColumn < maxColumn - 1 && ((_matrix$getValue3 = matrix.getValue(detectEndRow, endColumn + 1)) === null || _matrix$getValue3 === void 0 ? void 0 : _matrix$getValue3.v) != null) {
|
|
9019
|
+
var _matrix$getValue4;
|
|
9020
|
+
while (((_matrix$getValue4 = matrix.getValue(detectEndRow + 1, endColumn + 1)) === null || _matrix$getValue4 === void 0 ? void 0 : _matrix$getValue4.v) != null && detectEndRow < maxRow) detectEndRow += 1;
|
|
9021
|
+
} else detectEndRow = endRow;
|
|
9022
|
+
for (let i = endRow + 1; i <= detectEndRow; i++) for (let j = startColumn; j <= endColumn; j++) {
|
|
9023
|
+
var _matrix$getValue5;
|
|
9024
|
+
if (((_matrix$getValue5 = matrix.getValue(i, j)) === null || _matrix$getValue5 === void 0 ? void 0 : _matrix$getValue5.v) != null) {
|
|
9025
|
+
detectEndRow = i - 1;
|
|
9026
|
+
break;
|
|
9027
|
+
}
|
|
9028
|
+
}
|
|
9029
|
+
return {
|
|
9030
|
+
startColumn,
|
|
9031
|
+
endColumn,
|
|
9032
|
+
startRow,
|
|
9033
|
+
endRow: detectEndRow
|
|
9034
|
+
};
|
|
9020
9035
|
}
|
|
9021
9036
|
|
|
9022
9037
|
//#endregion
|
|
@@ -9073,7 +9088,7 @@ let AutoHeightController = class AutoHeightController extends Disposable {
|
|
|
9073
9088
|
subUnitId = worksheet.getSheetId();
|
|
9074
9089
|
}
|
|
9075
9090
|
}
|
|
9076
|
-
const skeleton = this._renderManagerService.
|
|
9091
|
+
const skeleton = this._renderManagerService.getRenderUnitById(unitId).with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
9077
9092
|
if (!skeleton) return {
|
|
9078
9093
|
redos: [],
|
|
9079
9094
|
undos: []
|
|
@@ -9139,7 +9154,7 @@ let CellCustomRenderController = class CellCustomRenderController extends Dispos
|
|
|
9139
9154
|
if (!skeletonParam) return;
|
|
9140
9155
|
const unitId = this._context.unitId;
|
|
9141
9156
|
const { skeleton } = skeletonParam;
|
|
9142
|
-
const currentRender = this._renderManagerService.
|
|
9157
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
9143
9158
|
if (currentRender && currentRender.mainComponent) {
|
|
9144
9159
|
const spreadsheet = currentRender.mainComponent;
|
|
9145
9160
|
const getActiveRender = (evt) => {
|
|
@@ -9174,7 +9189,7 @@ let CellCustomRenderController = class CellCustomRenderController extends Dispos
|
|
|
9174
9189
|
const subUnitId = worksheet.getSheetId();
|
|
9175
9190
|
const info = {
|
|
9176
9191
|
data: cellData,
|
|
9177
|
-
style:
|
|
9192
|
+
style: worksheet.getComposedCellStyleByCellData(row, col, cellData),
|
|
9178
9193
|
primaryWithCoord: skeleton.getCellWithCoordByIndex(cellIndex.actualRow, cellIndex.actualCol),
|
|
9179
9194
|
unitId,
|
|
9180
9195
|
subUnitId,
|
|
@@ -9659,7 +9674,7 @@ let SheetSkeletonRenderController = class SheetSkeletonRenderController extends
|
|
|
9659
9674
|
if (param == null) return;
|
|
9660
9675
|
const { unitId } = this._context;
|
|
9661
9676
|
const { skeleton } = param;
|
|
9662
|
-
const scene = (_this$_renderManagerS = this._renderManagerService.
|
|
9677
|
+
const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
|
|
9663
9678
|
if (skeleton == null || scene == null) return;
|
|
9664
9679
|
const { rowTotalHeight, columnTotalWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
9665
9680
|
if (!this._context.unit.getActiveSheet()) return;
|
|
@@ -9717,7 +9732,9 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposab
|
|
|
9717
9732
|
if (!loadingRender) return;
|
|
9718
9733
|
let shouldRender = false;
|
|
9719
9734
|
if (!loadingRender.render) {
|
|
9720
|
-
|
|
9735
|
+
const contentElement = this._layoutService.getContentElement();
|
|
9736
|
+
if (!contentElement) return;
|
|
9737
|
+
loadingRender.render = this._createLoadingRender(loadingRender.workbook, loadingRender.sourceUnitId, contentElement);
|
|
9721
9738
|
shouldRender = true;
|
|
9722
9739
|
}
|
|
9723
9740
|
const worksheet = loadingRender.workbook.getSheetBySheetId(activeSheetId);
|
|
@@ -9756,6 +9773,10 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposab
|
|
|
9756
9773
|
async handoff(sourceUnitId, timeoutMs) {
|
|
9757
9774
|
var _this$_loadingRender2, _this$_finalCanvasGua;
|
|
9758
9775
|
if (((_this$_loadingRender2 = this._loadingRender) === null || _this$_loadingRender2 === void 0 ? void 0 : _this$_loadingRender2.sourceUnitId) !== sourceUnitId) return true;
|
|
9776
|
+
if (!this._loadingRender.render) {
|
|
9777
|
+
this.hide(sourceUnitId);
|
|
9778
|
+
return true;
|
|
9779
|
+
}
|
|
9759
9780
|
(_this$_finalCanvasGua = this._finalCanvasGuard) === null || _this$_finalCanvasGua === void 0 || _this$_finalCanvasGua.unsubscribe();
|
|
9760
9781
|
this._finalCanvasGuard = null;
|
|
9761
9782
|
try {
|
|
@@ -9791,9 +9812,8 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposab
|
|
|
9791
9812
|
if (activeSheet) workbook.setActiveSheet(activeSheet);
|
|
9792
9813
|
return workbook;
|
|
9793
9814
|
}
|
|
9794
|
-
_createLoadingRender(workbook, sourceUnitId) {
|
|
9815
|
+
_createLoadingRender(workbook, sourceUnitId, contentElement) {
|
|
9795
9816
|
const previewUnitId = workbook.getUnitId();
|
|
9796
|
-
const contentElement = this._layoutService.getContentElement();
|
|
9797
9817
|
const { width, height } = contentElement.getBoundingClientRect();
|
|
9798
9818
|
const engine = this._injector.createInstance(Engine, previewUnitId, void 0);
|
|
9799
9819
|
const scene = new Scene(`${PREVIEW_SCENE_PREFIX}${previewUnitId}`, engine, {
|
|
@@ -9828,10 +9848,10 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposab
|
|
|
9828
9848
|
_waitForFinalCanvas(render) {
|
|
9829
9849
|
return new Observable((subscriber) => {
|
|
9830
9850
|
let frameId;
|
|
9831
|
-
const contentElement = this._layoutService.getContentElement();
|
|
9832
9851
|
const canvasElement = render.engine.getCanvasElement();
|
|
9833
9852
|
const checkMounted = () => {
|
|
9834
|
-
|
|
9853
|
+
const contentElement = this._layoutService.getContentElement();
|
|
9854
|
+
if (contentElement && canvasElement.parentElement === contentElement && canvasElement.width > 0 && canvasElement.height > 0) {
|
|
9835
9855
|
subscriber.next();
|
|
9836
9856
|
subscriber.complete();
|
|
9837
9857
|
return;
|
|
@@ -9845,7 +9865,7 @@ let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposab
|
|
|
9845
9865
|
});
|
|
9846
9866
|
}
|
|
9847
9867
|
_getFinalRender$(sourceUnitId) {
|
|
9848
|
-
const existingRender = this._renderManagerService.
|
|
9868
|
+
const existingRender = this._renderManagerService.getRenderUnitById(sourceUnitId);
|
|
9849
9869
|
return existingRender ? of(existingRender) : this._renderManagerService.created$.pipe(filter((render) => render.unitId === sourceUnitId));
|
|
9850
9870
|
}
|
|
9851
9871
|
_guardFinalCanvas(sourceUnitId) {
|
|
@@ -9985,14 +10005,14 @@ const useMenuPosition = (range) => {
|
|
|
9985
10005
|
endCol: range.cols[range.cols.length - 1]
|
|
9986
10006
|
};
|
|
9987
10007
|
if (anchor.endRow < 0 || anchor.endCol < 0) return null;
|
|
9988
|
-
const ru = renderManagerService.
|
|
10008
|
+
const ru = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
9989
10009
|
const sheetSkeletonManagerService = ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService);
|
|
9990
|
-
const selectionRenderService = ru === null || ru === void 0 ? void 0 : ru.with(ISheetSelectionRenderService);
|
|
9991
10010
|
const sheetObject = getSheetObject(univerInstanceService, renderManagerService);
|
|
9992
|
-
if (!sheetObject
|
|
10011
|
+
if (!sheetObject) return null;
|
|
9993
10012
|
const { scene } = sheetObject;
|
|
9994
10013
|
const skeleton = sheetSkeletonManagerService === null || sheetSkeletonManagerService === void 0 ? void 0 : sheetSkeletonManagerService.getCurrentSkeleton();
|
|
9995
|
-
const viewport =
|
|
10014
|
+
const viewport = getViewportByCell(anchor.endRow, anchor.endCol, scene, workbook.getActiveSheet());
|
|
10015
|
+
if (!viewport) return null;
|
|
9996
10016
|
const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
|
|
9997
10017
|
const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
|
|
9998
10018
|
const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
|
|
@@ -10025,7 +10045,8 @@ const ClipboardPopupMenu = () => {
|
|
|
10025
10045
|
const commandService = useDependency(ICommandService);
|
|
10026
10046
|
const [menuHovered, setMenuHovered] = useState(false);
|
|
10027
10047
|
const [visible, setVisible] = useState(false);
|
|
10028
|
-
const
|
|
10048
|
+
const range = pasteOptionsCache === null || pasteOptionsCache === void 0 ? void 0 : pasteOptionsCache.target.pastedRange;
|
|
10049
|
+
const relativePosition = useMenuPosition(range);
|
|
10029
10050
|
if (!relativePosition || !showMenu) return null;
|
|
10030
10051
|
if (relativePosition.positionX < 50 || relativePosition.positionY < 30) return null;
|
|
10031
10052
|
const showMore = menuHovered || visible;
|
|
@@ -10215,7 +10236,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10215
10236
|
return (_this$_editorBridgeSe = (_this$_editorBridgeSe2 = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe2 === void 0 ? void 0 : _this$_editorBridgeSe2.unitId) !== null && _this$_editorBridgeSe !== void 0 ? _this$_editorBridgeSe : "";
|
|
10216
10237
|
}
|
|
10217
10238
|
get _editingRenderer() {
|
|
10218
|
-
return this._renderManagerService.
|
|
10239
|
+
return this._renderManagerService.getRenderUnitById(this._editingUnitId);
|
|
10219
10240
|
}
|
|
10220
10241
|
get _renderer() {
|
|
10221
10242
|
var _this$_editingRendere;
|
|
@@ -10310,21 +10331,28 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10310
10331
|
}
|
|
10311
10332
|
_getEditorMaxSize(position, canvasOffset, horizontalAlign) {
|
|
10312
10333
|
if (this._getEditorObject() == null) return;
|
|
10313
|
-
function pxToNum(
|
|
10314
|
-
|
|
10334
|
+
function pxToNum(size) {
|
|
10335
|
+
var _size$replace;
|
|
10336
|
+
return Number.parseFloat((_size$replace = size === null || size === void 0 ? void 0 : size.replace("px", "")) !== null && _size$replace !== void 0 ? _size$replace : "");
|
|
10315
10337
|
}
|
|
10316
10338
|
const engine = this.engine;
|
|
10317
10339
|
if (!engine) return;
|
|
10318
10340
|
const canvasElement = engine.getCanvasElement();
|
|
10319
10341
|
const canvasClientRect = canvasElement.getBoundingClientRect();
|
|
10320
10342
|
const widthOfCanvas = pxToNum(canvasElement.style.width);
|
|
10343
|
+
const heightOfCanvas = pxToNum(canvasElement.style.height);
|
|
10321
10344
|
const { width, height } = canvasClientRect;
|
|
10322
|
-
const
|
|
10345
|
+
const contentElement = this._getEditorContentElement();
|
|
10346
|
+
const contentBoundingRect = contentElement.getBoundingClientRect();
|
|
10347
|
+
const contentScaleX = resolveElementScale(contentBoundingRect.width, contentElement.offsetWidth);
|
|
10348
|
+
const contentScaleY = resolveElementScale(contentBoundingRect.height, contentElement.offsetHeight, contentScaleX);
|
|
10349
|
+
const scaleAdjustX = width / widthOfCanvas / contentScaleX;
|
|
10350
|
+
const scaleAdjustY = Number.isFinite(heightOfCanvas) && heightOfCanvas > 0 ? height / heightOfCanvas / contentScaleY : scaleAdjustX;
|
|
10323
10351
|
const { startX, startY, endX } = position;
|
|
10324
10352
|
const enginWidth = engine.width;
|
|
10325
|
-
const maxHeight = height - startY - EDITOR_BORDER_SIZE * 2;
|
|
10353
|
+
const maxHeight = height / contentScaleY - startY - EDITOR_BORDER_SIZE * 2;
|
|
10326
10354
|
const cellWidth = endX - startX;
|
|
10327
|
-
let maxWidth = width - startX;
|
|
10355
|
+
let maxWidth = width / contentScaleX - startX;
|
|
10328
10356
|
if (horizontalAlign === HorizontalAlign.CENTER) {
|
|
10329
10357
|
const rightGap = enginWidth - endX;
|
|
10330
10358
|
maxWidth = cellWidth + Math.min(startX, rightGap) * 2;
|
|
@@ -10334,7 +10362,10 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10334
10362
|
return {
|
|
10335
10363
|
height: maxHeight,
|
|
10336
10364
|
width: maxWidth,
|
|
10337
|
-
|
|
10365
|
+
contentScaleX,
|
|
10366
|
+
contentScaleY,
|
|
10367
|
+
scaleAdjustX,
|
|
10368
|
+
scaleAdjustY
|
|
10338
10369
|
};
|
|
10339
10370
|
}
|
|
10340
10371
|
/**
|
|
@@ -10351,7 +10382,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10351
10382
|
let { startX, startY } = actualRangeWithCoord;
|
|
10352
10383
|
const { document: documentComponent, scene: editorScene, engine: docEngine } = editorObject;
|
|
10353
10384
|
const viewportMain = editorScene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
|
|
10354
|
-
const { height: clientHeight, width: clientWidth,
|
|
10385
|
+
const { height: clientHeight, width: clientWidth, contentScaleX, contentScaleY, scaleAdjustX, scaleAdjustY } = this._getEditorMaxSize(actualRangeWithCoord, canvasOffset, horizontalAlign);
|
|
10355
10386
|
let physicHeight = editorHeight;
|
|
10356
10387
|
let scrollBar = viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.getScrollBar();
|
|
10357
10388
|
if (physicHeight > clientHeight) {
|
|
@@ -10372,12 +10403,12 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10372
10403
|
this._addBackground(editorScene, editorWidth / scaleX, editorHeight / scaleY, fill);
|
|
10373
10404
|
const { scaleX: precisionScaleX, scaleY: precisionScaleY } = editorScene.getPrecisionScale();
|
|
10374
10405
|
editorScene.transformByState({
|
|
10375
|
-
width: editorWidth *
|
|
10376
|
-
height: editorHeight *
|
|
10377
|
-
scaleX: scaleX *
|
|
10378
|
-
scaleY: scaleY *
|
|
10406
|
+
width: editorWidth * scaleAdjustX / scaleX,
|
|
10407
|
+
height: editorHeight * scaleAdjustY / scaleY,
|
|
10408
|
+
scaleX: scaleX * scaleAdjustX,
|
|
10409
|
+
scaleY: scaleY * scaleAdjustY
|
|
10379
10410
|
});
|
|
10380
|
-
documentComponent.resize(editorWidth *
|
|
10411
|
+
documentComponent.resize(editorWidth * scaleAdjustX / scaleX, editorHeight * scaleAdjustY / scaleY);
|
|
10381
10412
|
/**
|
|
10382
10413
|
* sometimes requestIdleCallback is invalid, so use setTimeout to ensure the successful execution of the resizeBySize method.
|
|
10383
10414
|
* resize canvas
|
|
@@ -10389,16 +10420,16 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10389
10420
|
}, 0);
|
|
10390
10421
|
const contentBoundingRect = this._getEditorContentElement().getBoundingClientRect();
|
|
10391
10422
|
const canvasBoundingRect = canvasElement.getBoundingClientRect();
|
|
10392
|
-
startX = startX *
|
|
10393
|
-
startY = startY *
|
|
10423
|
+
startX = startX * scaleAdjustX + (canvasBoundingRect.left - contentBoundingRect.left) / contentScaleX;
|
|
10424
|
+
startY = startY * scaleAdjustY + (canvasBoundingRect.top - contentBoundingRect.top) / contentScaleY;
|
|
10394
10425
|
const cellWidth = actualRangeWithCoord.endX - actualRangeWithCoord.startX;
|
|
10395
|
-
if (horizontalAlign === HorizontalAlign.RIGHT) startX += (cellWidth - editorWidth) *
|
|
10396
|
-
else if (horizontalAlign === HorizontalAlign.CENTER) startX += (cellWidth - editorWidth *
|
|
10426
|
+
if (horizontalAlign === HorizontalAlign.RIGHT) startX += (cellWidth - editorWidth) * scaleAdjustX;
|
|
10427
|
+
else if (horizontalAlign === HorizontalAlign.CENTER) startX += (cellWidth - editorWidth * scaleAdjustX) / 2;
|
|
10397
10428
|
this._cellEditorManagerService.setState({
|
|
10398
10429
|
startX,
|
|
10399
10430
|
startY,
|
|
10400
|
-
endX: editorWidth *
|
|
10401
|
-
endY: physicHeight *
|
|
10431
|
+
endX: editorWidth * scaleAdjustX + startX,
|
|
10432
|
+
endY: physicHeight * scaleAdjustY + startY,
|
|
10402
10433
|
show: true
|
|
10403
10434
|
});
|
|
10404
10435
|
}
|
|
@@ -10442,10 +10473,10 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10442
10473
|
const { horizontalAlign } = documentLayoutObject;
|
|
10443
10474
|
const maxSize = this._getEditorMaxSize(position, canvasOffset, horizontalAlign);
|
|
10444
10475
|
if (!maxSize) return;
|
|
10445
|
-
const { height: clientHeight, width: clientWidth,
|
|
10476
|
+
const { height: clientHeight, width: clientWidth, scaleAdjustX, scaleAdjustY } = maxSize;
|
|
10446
10477
|
const cell = skeleton.getCellWithCoordByIndex(row, column);
|
|
10447
|
-
const height = Math.min((cell.mergeInfo.endY - cell.mergeInfo.startY) * scaleY, clientHeight) *
|
|
10448
|
-
const width = Math.min((cell.mergeInfo.endX - cell.mergeInfo.startX) * scaleX, clientWidth) *
|
|
10478
|
+
const height = Math.min((cell.mergeInfo.endY - cell.mergeInfo.startY) * scaleY, clientHeight) * scaleAdjustY;
|
|
10479
|
+
const width = Math.min((cell.mergeInfo.endX - cell.mergeInfo.startX) * scaleX, clientWidth) * scaleAdjustX;
|
|
10449
10480
|
const currentHeight = state.endY - state.startY;
|
|
10450
10481
|
const currentWidth = state.endX - state.startX;
|
|
10451
10482
|
if (currentHeight !== height || currentWidth !== width) {
|
|
@@ -10459,7 +10490,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10459
10490
|
}
|
|
10460
10491
|
_getEditorSkeleton() {
|
|
10461
10492
|
var _this$_renderManagerS;
|
|
10462
|
-
return (_this$_renderManagerS = this._renderManagerService.
|
|
10493
|
+
return (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService).getSkeleton();
|
|
10463
10494
|
}
|
|
10464
10495
|
};
|
|
10465
10496
|
SheetCellEditorResizeService = __decorate([
|
|
@@ -10471,6 +10502,10 @@ SheetCellEditorResizeService = __decorate([
|
|
|
10471
10502
|
__decorateParam(5, IConfigService),
|
|
10472
10503
|
__decorateParam(6, Optional(ISheetEmbedFloatingGeometryService))
|
|
10473
10504
|
], SheetCellEditorResizeService);
|
|
10505
|
+
function resolveElementScale(renderedSize, layoutSize, fallback = 1) {
|
|
10506
|
+
if (!Number.isFinite(renderedSize) || !Number.isFinite(layoutSize) || renderedSize <= 0 || layoutSize <= 0) return fallback;
|
|
10507
|
+
return renderedSize / layoutSize;
|
|
10508
|
+
}
|
|
10474
10509
|
|
|
10475
10510
|
//#endregion
|
|
10476
10511
|
//#region src/controllers/render-controllers/editor-bridge.render-controller.ts
|
|
@@ -10509,12 +10544,17 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10509
10544
|
this._d = null;
|
|
10510
10545
|
}
|
|
10511
10546
|
_initSelectionChangeListener(d) {
|
|
10512
|
-
d.add(merge$1(this._selectionManagerService.
|
|
10547
|
+
d.add(merge$1(this._selectionManagerService.selectionSet$, this._selectionManagerService.selectionMoveStart$).subscribe((params) => this._updateEditorPosition(params)));
|
|
10548
|
+
d.add(this._selectionManagerService.selectionMoveEnd$.subscribe((params) => {
|
|
10549
|
+
var _params;
|
|
10550
|
+
this._updateEditorPosition(params);
|
|
10551
|
+
if (params === null || params === void 0 || (_params = params[params.length - 1]) === null || _params === void 0 ? void 0 : _params.primary) this._updateInputPosition();
|
|
10552
|
+
}));
|
|
10513
10553
|
}
|
|
10514
10554
|
_updateEditorPosition(params) {
|
|
10515
|
-
var
|
|
10555
|
+
var _params2;
|
|
10516
10556
|
if (this._editorBridgeService.isVisible().visible) return;
|
|
10517
|
-
const primary = params === null || params === void 0 || (
|
|
10557
|
+
const primary = params === null || params === void 0 || (_params2 = params[params.length - 1]) === null || _params2 === void 0 ? void 0 : _params2.primary;
|
|
10518
10558
|
if (primary) {
|
|
10519
10559
|
var _this$_context$unit$g, _this$_sheetSkeletonM;
|
|
10520
10560
|
const sheetObject = this._getSheetObject();
|
|
@@ -10544,6 +10584,15 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10544
10584
|
});
|
|
10545
10585
|
}
|
|
10546
10586
|
}
|
|
10587
|
+
_updateInputPosition() {
|
|
10588
|
+
var _this$_renderManagerS;
|
|
10589
|
+
if (this._editorBridgeService.isVisible().visible) return;
|
|
10590
|
+
const layout = this._editorBridgeService.getEditCellLayout();
|
|
10591
|
+
const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSelectionRenderService);
|
|
10592
|
+
if (!layout || !docSelectionRenderService) return;
|
|
10593
|
+
const { position, canvasOffset } = layout;
|
|
10594
|
+
docSelectionRenderService.setInputPosition(canvasOffset.left + position.startX, canvasOffset.top + position.startY);
|
|
10595
|
+
}
|
|
10547
10596
|
refreshEditorPosition() {
|
|
10548
10597
|
const workbookSelections = this._selectionManagerService.getWorkbookSelections(this._context.unitId);
|
|
10549
10598
|
if (workbookSelections) {
|
|
@@ -10601,7 +10650,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10601
10650
|
d.add(disposable);
|
|
10602
10651
|
}
|
|
10603
10652
|
};
|
|
10604
|
-
const render = this._renderManagerService.
|
|
10653
|
+
const render = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
10605
10654
|
if (render) addEvent(render);
|
|
10606
10655
|
else this.disposeWithMe(this._renderManagerService.created$.pipe(filter((render) => render.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY)).subscribe((render) => {
|
|
10607
10656
|
disposable === null || disposable === void 0 || disposable.dispose();
|
|
@@ -10615,7 +10664,7 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10615
10664
|
}));
|
|
10616
10665
|
}
|
|
10617
10666
|
_focusCellEditorInput() {
|
|
10618
|
-
const render = this._renderManagerService.
|
|
10667
|
+
const render = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
10619
10668
|
const docSelectionRenderService = render === null || render === void 0 ? void 0 : render.with(DocSelectionRenderService);
|
|
10620
10669
|
if (!(docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing)) docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
10621
10670
|
}
|
|
@@ -11413,7 +11462,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11413
11462
|
unitId: this._editingUnit
|
|
11414
11463
|
});
|
|
11415
11464
|
if (!unit) return;
|
|
11416
|
-
const editorBridgeRenderController = (_this$_renderManagerS = this._renderManagerService.
|
|
11465
|
+
const editorBridgeRenderController = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unit.getUnitId())) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(EditorBridgeRenderController);
|
|
11417
11466
|
if (editorBridgeRenderController) editorBridgeRenderController.refreshEditorPosition();
|
|
11418
11467
|
}
|
|
11419
11468
|
}));
|
|
@@ -11446,7 +11495,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11446
11495
|
const editorId = this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) ? DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : this._editorBridgeService.getCurrentEditorId();
|
|
11447
11496
|
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();
|
|
11448
11497
|
if (!docUnitId) return;
|
|
11449
|
-
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.
|
|
11498
|
+
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(docUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
|
|
11450
11499
|
if (!docSelectionRenderManager) return;
|
|
11451
11500
|
docSelectionRenderManager.sync();
|
|
11452
11501
|
}));
|
|
@@ -11510,7 +11559,6 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11510
11559
|
unitId: editorUnitId,
|
|
11511
11560
|
snapshot: documentModel.getSnapshot()
|
|
11512
11561
|
});
|
|
11513
|
-
this._contextService.setContextValue(FOCUSING_EDITOR_BUT_HIDDEN, true);
|
|
11514
11562
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11515
11563
|
startOffset: 0,
|
|
11516
11564
|
endOffset: 0
|
|
@@ -11518,8 +11566,8 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11518
11566
|
unitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
11519
11567
|
subUnitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
11520
11568
|
});
|
|
11521
|
-
const cellSelectionRenderManager = (_this$_renderManagerS3 = this._renderManagerService.
|
|
11522
|
-
const formulaSelectionRenderManager = (_this$_renderManagerS4 = this._renderManagerService.
|
|
11569
|
+
const cellSelectionRenderManager = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(DocSelectionRenderService);
|
|
11570
|
+
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);
|
|
11523
11571
|
if ((cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 ? void 0 : cellSelectionRenderManager.canFocusing) || (formulaSelectionRenderManager === null || formulaSelectionRenderManager === void 0 ? void 0 : formulaSelectionRenderManager.canFocusing)) {
|
|
11524
11572
|
this._univerInstanceService.setCurrentUnitForType(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
11525
11573
|
cellSelectionRenderManager === null || cellSelectionRenderManager === void 0 || cellSelectionRenderManager.activate(HIDDEN_EDITOR_POSITION$1, HIDDEN_EDITOR_POSITION$1, true);
|
|
@@ -11634,7 +11682,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11634
11682
|
endOffset: cursor
|
|
11635
11683
|
}]);
|
|
11636
11684
|
}
|
|
11637
|
-
(_this$_renderManagerS5 = this._renderManagerService.
|
|
11685
|
+
(_this$_renderManagerS5 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS5 === void 0 || _this$_renderManagerS5.scene.resetCursor();
|
|
11638
11686
|
}
|
|
11639
11687
|
_refreshCurrentSelections(sheetId) {
|
|
11640
11688
|
const selections = this._workbookSelections.getSelectionsOfWorksheet(sheetId);
|
|
@@ -11747,7 +11795,6 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11747
11795
|
var _editorObject$scene$g;
|
|
11748
11796
|
this._contextService.setContextValue(FOCUSING_EDITOR_INPUT_FORMULA, false);
|
|
11749
11797
|
this._contextService.setContextValue(EDITOR_ACTIVATED, false);
|
|
11750
|
-
this._contextService.setContextValue(FOCUSING_EDITOR_BUT_HIDDEN, false);
|
|
11751
11798
|
this._contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, false);
|
|
11752
11799
|
this._cellEditorManagerService.setState({ show: param.visible });
|
|
11753
11800
|
const formulaBarEditor = this._editorService.getEditor(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
@@ -11826,11 +11873,11 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11826
11873
|
}
|
|
11827
11874
|
_getEditorSkeleton(editorId) {
|
|
11828
11875
|
var _this$_renderManagerS6;
|
|
11829
|
-
return (_this$_renderManagerS6 = this._renderManagerService.
|
|
11876
|
+
return (_this$_renderManagerS6 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS6 === void 0 ? void 0 : _this$_renderManagerS6.with(DocSkeletonManagerService).getSkeleton();
|
|
11830
11877
|
}
|
|
11831
11878
|
_getEditorViewModel(editorId) {
|
|
11832
11879
|
var _this$_renderManagerS7;
|
|
11833
|
-
return (_this$_renderManagerS7 = this._renderManagerService.
|
|
11880
|
+
return (_this$_renderManagerS7 = this._renderManagerService.getRenderUnitById(editorId)) === null || _this$_renderManagerS7 === void 0 ? void 0 : _this$_renderManagerS7.with(DocSkeletonManagerService).getViewModel();
|
|
11834
11881
|
}
|
|
11835
11882
|
_getEditingUnit() {
|
|
11836
11883
|
return this._editingUnit ? this._univerInstanceService.getUnit(this._editingUnit, UniverInstanceType.UNIVER_SHEET) : null;
|
|
@@ -12401,12 +12448,12 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12401
12448
|
if (event.event.key === "Escape") this._sheetClipboardService.removeMarkSelection();
|
|
12402
12449
|
});
|
|
12403
12450
|
};
|
|
12404
|
-
let docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.
|
|
12451
|
+
let docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSelectionRenderService);
|
|
12405
12452
|
if (docSelectionRenderService) sheetPasteShortKeyFn(docSelectionRenderService);
|
|
12406
12453
|
this._renderManagerService.created$.subscribe((renderer) => {
|
|
12407
12454
|
if (renderer.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {
|
|
12408
12455
|
var _this$_renderManagerS2;
|
|
12409
|
-
docSelectionRenderService = (_this$_renderManagerS2 = this._renderManagerService.
|
|
12456
|
+
docSelectionRenderService = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
|
|
12410
12457
|
if (docSelectionRenderService) sheetPasteShortKeyFn(docSelectionRenderService);
|
|
12411
12458
|
}
|
|
12412
12459
|
});
|
|
@@ -12631,11 +12678,9 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12631
12678
|
};
|
|
12632
12679
|
}
|
|
12633
12680
|
_generateDocumentDataModelSnapshot(snapshot) {
|
|
12634
|
-
var _withCurrentTypeOfRen
|
|
12635
|
-
|
|
12636
|
-
|
|
12637
|
-
const { skeleton } = currentSkeleton;
|
|
12638
|
-
const documentModel = (_skeleton$getBlankCel = skeleton.getBlankCellDocumentModel()) === null || _skeleton$getBlankCel === void 0 ? void 0 : _skeleton$getBlankCel.documentModel;
|
|
12681
|
+
var _withCurrentTypeOfRen;
|
|
12682
|
+
if (((_withCurrentTypeOfRen = withCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, SheetSkeletonManagerService, this._instanceService, this._renderManagerService)) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.getCurrentParam()) == null) return null;
|
|
12683
|
+
const documentModel = createDocumentModelWithStyle("", {});
|
|
12639
12684
|
const documentData = {
|
|
12640
12685
|
...documentModel === null || documentModel === void 0 ? void 0 : documentModel.getSnapshot(),
|
|
12641
12686
|
...snapshot
|
|
@@ -12815,7 +12860,7 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12815
12860
|
const setValuesMutation = {
|
|
12816
12861
|
unitId,
|
|
12817
12862
|
subUnitId,
|
|
12818
|
-
cellValue: valueMatrix.
|
|
12863
|
+
cellValue: valueMatrix.clone()
|
|
12819
12864
|
};
|
|
12820
12865
|
redoMutationsInfo.push({
|
|
12821
12866
|
id: SetRangeValuesMutation.id,
|
|
@@ -12841,7 +12886,7 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12841
12886
|
}
|
|
12842
12887
|
_getWorksheet(unitId, subUnitId) {
|
|
12843
12888
|
var _this$_instanceServic;
|
|
12844
|
-
const worksheet = (_this$_instanceServic = this._instanceService.
|
|
12889
|
+
const worksheet = (_this$_instanceServic = this._instanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_instanceServic === void 0 ? void 0 : _this$_instanceServic.getSheetBySheetId(subUnitId);
|
|
12845
12890
|
if (!worksheet) throw new Error(`[SheetClipboardController]: cannot find a worksheet with unitId ${unitId} and subUnitId ${subUnitId}.`);
|
|
12846
12891
|
return worksheet;
|
|
12847
12892
|
}
|
|
@@ -12920,7 +12965,7 @@ let DragManagerService = class DragManagerService extends Disposable {
|
|
|
12920
12965
|
if (!workbook) return null;
|
|
12921
12966
|
const worksheet = workbook.getActiveSheet();
|
|
12922
12967
|
if (!worksheet) return;
|
|
12923
|
-
const currentRender = this._renderManagerService.
|
|
12968
|
+
const currentRender = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
12924
12969
|
if (!currentRender) return;
|
|
12925
12970
|
const skeletonParam = currentRender.with(SheetSkeletonManagerService).getCurrentParam();
|
|
12926
12971
|
const scrollInfo = currentRender.with(SheetScrollManagerService).getCurrentScrollState();
|
|
@@ -13093,7 +13138,7 @@ let FormulaEditorController = class FormulaEditorController extends RxDisposable
|
|
|
13093
13138
|
}
|
|
13094
13139
|
_create(unitId) {
|
|
13095
13140
|
if (unitId !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) return;
|
|
13096
|
-
const formulaEditorDocObject = this._renderManagerService.
|
|
13141
|
+
const formulaEditorDocObject = this._renderManagerService.getRenderUnitById(unitId);
|
|
13097
13142
|
if (formulaEditorDocObject == null) return;
|
|
13098
13143
|
const { mainComponent: documentComponent } = formulaEditorDocObject;
|
|
13099
13144
|
if (documentComponent == null) return;
|
|
@@ -13101,7 +13146,7 @@ let FormulaEditorController = class FormulaEditorController extends RxDisposable
|
|
|
13101
13146
|
}
|
|
13102
13147
|
_listenFxBtnClick() {
|
|
13103
13148
|
this._formulaEditorManagerService.fxBtnClick$.pipe(takeUntil(this.dispose$)).subscribe(() => {
|
|
13104
|
-
if (this._contextService.getContextValue(
|
|
13149
|
+
if (this._contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && !this._contextService.getContextValue(EDITOR_ACTIVATED)) {
|
|
13105
13150
|
var _formulaEditorDataMod;
|
|
13106
13151
|
this._univerInstanceService.setCurrentUnitForType(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
13107
13152
|
const formulaEditorDataModel = this._univerInstanceService.getUnit(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
|
|
@@ -13161,8 +13206,8 @@ let FormulaEditorController = class FormulaEditorController extends RxDisposable
|
|
|
13161
13206
|
autoScroll() {
|
|
13162
13207
|
var _this$_renderManagerS;
|
|
13163
13208
|
const position = this._formulaEditorManagerService.getPosition();
|
|
13164
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
13165
|
-
const editorObject = this._renderManagerService.
|
|
13209
|
+
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();
|
|
13210
|
+
const editorObject = this._renderManagerService.getRenderUnitById(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
13166
13211
|
const formulaEditorDataModel = this._univerInstanceService.getUnit(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
|
|
13167
13212
|
if (skeleton == null || position == null || editorObject == null || formulaEditorDataModel == null) return;
|
|
13168
13213
|
const { marginTop = 0, marginBottom = 0 } = formulaEditorDataModel.getSnapshot().documentStyle;
|
|
@@ -13383,7 +13428,7 @@ const getCustomRangePosition = (injector, unitId, subUnitId, row, col, rangeId)
|
|
|
13383
13428
|
if (!workbook) return null;
|
|
13384
13429
|
const worksheet = workbook.getSheetBySheetId(subUnitId);
|
|
13385
13430
|
if (!worksheet) return null;
|
|
13386
|
-
const currentRender = renderManagerService.
|
|
13431
|
+
const currentRender = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13387
13432
|
const skeletonParam = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).getSkeletonParam(worksheet.getSheetId());
|
|
13388
13433
|
const skeleton = skeletonParam === null || skeletonParam === void 0 ? void 0 : skeletonParam.skeleton;
|
|
13389
13434
|
if (!skeleton || !currentRender) return;
|
|
@@ -13429,8 +13474,8 @@ const getEditingCustomRangePosition = (injector, unitId, subUnitId, row, col, ra
|
|
|
13429
13474
|
const { editorUnitId, unitId: editingUnitId, sheetId, row: editRow, column: editCol } = state;
|
|
13430
13475
|
if (unitId !== editingUnitId || subUnitId !== sheetId || editRow !== row || editCol !== col) return null;
|
|
13431
13476
|
const renderManagerService = injector.get(IRenderManagerService);
|
|
13432
|
-
const renderer = renderManagerService.
|
|
13433
|
-
const sheetRenderer = renderManagerService.
|
|
13477
|
+
const renderer = renderManagerService.getRenderUnitById(editorUnitId);
|
|
13478
|
+
const sheetRenderer = renderManagerService.getRenderUnitById(unitId);
|
|
13434
13479
|
if (!renderer || !sheetRenderer) return null;
|
|
13435
13480
|
const docSkeleton = renderer.with(DocSkeletonManagerService).getSkeleton();
|
|
13436
13481
|
const sheetSkeleton = (_sheetRenderer$with$g = sheetRenderer.with(SheetSkeletonManagerService).getSkeletonParam(sheetId)) === null || _sheetRenderer$with$g === void 0 ? void 0 : _sheetRenderer$with$g.skeleton;
|
|
@@ -13582,7 +13627,7 @@ let HoverManagerService = class HoverManagerService extends Disposable {
|
|
|
13582
13627
|
if (!workbook) return null;
|
|
13583
13628
|
const worksheet = workbook.getActiveSheet();
|
|
13584
13629
|
if (!worksheet) return null;
|
|
13585
|
-
const currentRender = this._renderManagerService.
|
|
13630
|
+
const currentRender = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
13586
13631
|
if (!currentRender) return null;
|
|
13587
13632
|
const skeletonParam = currentRender.with(SheetSkeletonManagerService).getSkeletonParam(worksheet.getSheetId());
|
|
13588
13633
|
if (!skeletonParam) return null;
|
|
@@ -13912,10 +13957,9 @@ const UNIVER_SHEET_PERMISSION_ALERT_DIALOG = "UNIVER_SHEET_PERMISSION_ALERT_DIAL
|
|
|
13912
13957
|
//#endregion
|
|
13913
13958
|
//#region src/controllers/permission/sheet-permission-check-ui.controller.ts
|
|
13914
13959
|
let SheetPermissionCheckUIController = class SheetPermissionCheckUIController extends Disposable {
|
|
13915
|
-
constructor(_commandService,
|
|
13960
|
+
constructor(_commandService, _permissionService, _dialogService, _rangeProtectionRuleModel, _localeService, _contextService, _sheetPermissionCheckController) {
|
|
13916
13961
|
super();
|
|
13917
13962
|
this._commandService = _commandService;
|
|
13918
|
-
this._univerInstanceService = _univerInstanceService;
|
|
13919
13963
|
this._permissionService = _permissionService;
|
|
13920
13964
|
this._dialogService = _dialogService;
|
|
13921
13965
|
this._rangeProtectionRuleModel = _rangeProtectionRuleModel;
|
|
@@ -13940,7 +13984,6 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
13940
13984
|
errorMsg
|
|
13941
13985
|
},
|
|
13942
13986
|
width: 320,
|
|
13943
|
-
destroyOnClose: true,
|
|
13944
13987
|
showOk: true,
|
|
13945
13988
|
onClose: () => {
|
|
13946
13989
|
this._dialogService.close(UNIVER_SHEET_PERMISSION_ALERT_DIALOG_ID);
|
|
@@ -13957,7 +14000,6 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
13957
14000
|
let permission = true;
|
|
13958
14001
|
let errorMsg = "";
|
|
13959
14002
|
let params;
|
|
13960
|
-
let target;
|
|
13961
14003
|
switch (id) {
|
|
13962
14004
|
case InsertTextCommand.id:
|
|
13963
14005
|
case IMEInputCommand.id:
|
|
@@ -13981,20 +14023,6 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
13981
14023
|
});
|
|
13982
14024
|
errorMsg = this._localeService.t("sheets-ui.permission.dialog.editErr");
|
|
13983
14025
|
break;
|
|
13984
|
-
case SheetPasteColWidthCommand.id:
|
|
13985
|
-
permission = this._sheetPermissionCheckController.permissionCheckWithoutRange({
|
|
13986
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
13987
|
-
worksheetTypes: [WorksheetEditPermission, WorksheetSetColumnStylePermission],
|
|
13988
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
13989
|
-
});
|
|
13990
|
-
errorMsg = this._localeService.t("sheets-ui.permission.dialog.pasteErr");
|
|
13991
|
-
break;
|
|
13992
|
-
case SheetPasteShortKeyCommand.id:
|
|
13993
|
-
case SheetPasteCommand.id:
|
|
13994
|
-
params = commandInfo.params;
|
|
13995
|
-
permission = this._permissionCheckByPaste(params);
|
|
13996
|
-
errorMsg = this._localeService.t("sheets-ui.permission.dialog.pasteErr");
|
|
13997
|
-
break;
|
|
13998
14026
|
case ApplyFormatPainterCommand.id:
|
|
13999
14027
|
permission = this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14000
14028
|
workbookTypes: [WorkbookEditablePermission],
|
|
@@ -14007,28 +14035,6 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
14007
14035
|
});
|
|
14008
14036
|
errorMsg = this._localeService.t("sheets-ui.permission.dialog.commonErr");
|
|
14009
14037
|
break;
|
|
14010
|
-
case SheetCopyCommand.id:
|
|
14011
|
-
var _this$_permissionServ;
|
|
14012
|
-
permission = this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14013
|
-
workbookTypes: [WorkbookCopyPermission],
|
|
14014
|
-
worksheetTypes: [WorksheetCopyPermission],
|
|
14015
|
-
rangeTypes: [RangeProtectionPermissionViewPoint]
|
|
14016
|
-
});
|
|
14017
|
-
errorMsg = this._localeService.t("sheets-ui.permission.dialog.copyErr");
|
|
14018
|
-
target = getSheetCommandTarget(this._univerInstanceService);
|
|
14019
|
-
if (!permission && target && !((_this$_permissionServ = this._permissionService.getPermissionPoint(new WorkbookCopyPermission(target.unitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value)) errorMsg = this._localeService.t("sheets-ui.permission.dialog.workbookCopyErr");
|
|
14020
|
-
break;
|
|
14021
|
-
case SheetCutCommand.id:
|
|
14022
|
-
var _this$_permissionServ2;
|
|
14023
|
-
permission = this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14024
|
-
workbookTypes: [WorkbookCopyPermission, WorkbookEditablePermission],
|
|
14025
|
-
worksheetTypes: [WorksheetCopyPermission, WorksheetEditPermission],
|
|
14026
|
-
rangeTypes: [RangeProtectionPermissionViewPoint, RangeProtectionPermissionEditPoint]
|
|
14027
|
-
});
|
|
14028
|
-
errorMsg = this._localeService.t("sheets-ui.permission.dialog.copyErr");
|
|
14029
|
-
target = getSheetCommandTarget(this._univerInstanceService);
|
|
14030
|
-
if (!permission && target && !((_this$_permissionServ2 = this._permissionService.getPermissionPoint(new WorkbookCopyPermission(target.unitId).id)) === null || _this$_permissionServ2 === void 0 ? void 0 : _this$_permissionServ2.value)) errorMsg = this._localeService.t("sheets-ui.permission.dialog.workbookCopyErr");
|
|
14031
|
-
break;
|
|
14032
14038
|
default: break;
|
|
14033
14039
|
}
|
|
14034
14040
|
if (!permission) this._sheetPermissionCheckController.blockExecuteWithoutPermission(errorMsg);
|
|
@@ -14041,37 +14047,15 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
14041
14047
|
this._getPermissionCheck(commandInfo);
|
|
14042
14048
|
}));
|
|
14043
14049
|
}
|
|
14044
|
-
_permissionCheckByPaste(params) {
|
|
14045
|
-
if (params.value === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_VALUE || params.value === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMULA) return this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14046
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
14047
|
-
worksheetTypes: [WorksheetSetCellStylePermission, WorksheetEditPermission],
|
|
14048
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
14049
|
-
});
|
|
14050
|
-
else if (params.value === PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT) return this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14051
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
14052
|
-
worksheetTypes: [WorksheetSetCellStylePermission, WorksheetEditPermission],
|
|
14053
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
14054
|
-
});
|
|
14055
|
-
else return this._sheetPermissionCheckController.permissionCheckWithRanges({
|
|
14056
|
-
workbookTypes: [WorkbookEditablePermission],
|
|
14057
|
-
worksheetTypes: [
|
|
14058
|
-
WorksheetSetCellValuePermission,
|
|
14059
|
-
WorksheetSetCellStylePermission,
|
|
14060
|
-
WorksheetEditPermission
|
|
14061
|
-
],
|
|
14062
|
-
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
14063
|
-
});
|
|
14064
|
-
}
|
|
14065
14050
|
};
|
|
14066
14051
|
SheetPermissionCheckUIController = __decorate([
|
|
14067
14052
|
__decorateParam(0, ICommandService),
|
|
14068
|
-
__decorateParam(1,
|
|
14069
|
-
__decorateParam(2,
|
|
14070
|
-
__decorateParam(3,
|
|
14071
|
-
__decorateParam(4, Inject(
|
|
14072
|
-
__decorateParam(5,
|
|
14073
|
-
__decorateParam(6,
|
|
14074
|
-
__decorateParam(7, Inject(SheetPermissionCheckController))
|
|
14053
|
+
__decorateParam(1, IPermissionService),
|
|
14054
|
+
__decorateParam(2, IDialogService),
|
|
14055
|
+
__decorateParam(3, Inject(RangeProtectionRuleModel)),
|
|
14056
|
+
__decorateParam(4, Inject(LocaleService)),
|
|
14057
|
+
__decorateParam(5, IContextService),
|
|
14058
|
+
__decorateParam(6, Inject(SheetPermissionCheckController))
|
|
14075
14059
|
], SheetPermissionCheckUIController);
|
|
14076
14060
|
|
|
14077
14061
|
//#endregion
|
|
@@ -14997,9 +14981,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
|
|
|
14997
14981
|
}
|
|
14998
14982
|
_getFreeze() {
|
|
14999
14983
|
var _this$_sheetSkeletonM6;
|
|
15000
|
-
|
|
15001
|
-
if (config == null) return;
|
|
15002
|
-
return config.freeze;
|
|
14984
|
+
return (_this$_sheetSkeletonM6 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM6 === void 0 ? void 0 : _this$_sheetSkeletonM6.skeleton.worksheet.getFreeze();
|
|
15003
14985
|
}
|
|
15004
14986
|
_getSheetObject() {
|
|
15005
14987
|
return getSheetObject(this._context.unit, this._context);
|
|
@@ -19479,11 +19461,11 @@ function Text2NumberContextMenuItemFactory(accessor) {
|
|
|
19479
19461
|
//#endregion
|
|
19480
19462
|
//#region src/views/sheet-slider/SheetZoomInput.tsx
|
|
19481
19463
|
const SHEET_ZOOM_INPUT_COMPONENT = "SHEET_ZOOM_INPUT_COMPONENT";
|
|
19482
|
-
function SheetZoomInput(props) {
|
|
19464
|
+
function SheetZoomInput({ className, ...props }) {
|
|
19483
19465
|
const commandService = useDependency(ICommandService);
|
|
19484
19466
|
return /* @__PURE__ */ jsx(ZoomInput, {
|
|
19485
19467
|
...props,
|
|
19486
|
-
className: "!univer-bg-transparent dark:!univer-bg-transparent",
|
|
19468
|
+
className: clsx("!univer-bg-transparent dark:!univer-bg-transparent", className),
|
|
19487
19469
|
onChange: (value) => commandService.executeCommand(SetZoomRatioFromToolbarCommand.id, { value })
|
|
19488
19470
|
});
|
|
19489
19471
|
}
|
|
@@ -19537,48 +19519,97 @@ const menuSchema = {
|
|
|
19537
19519
|
[RibbonStartGroup.HISTORY]: {
|
|
19538
19520
|
[SetOnceFormatPainterCommand.id]: {
|
|
19539
19521
|
order: 2,
|
|
19522
|
+
gridLayout: {
|
|
19523
|
+
row: 1,
|
|
19524
|
+
column: 2,
|
|
19525
|
+
showLabel: true
|
|
19526
|
+
},
|
|
19540
19527
|
menuItemFactory: FormatPainterMenuItemFactory
|
|
19541
19528
|
},
|
|
19542
19529
|
[ClearSelectionAllCommand.id]: {
|
|
19543
19530
|
order: 3,
|
|
19531
|
+
gridLayout: {
|
|
19532
|
+
row: 2,
|
|
19533
|
+
column: 2,
|
|
19534
|
+
showLabel: true
|
|
19535
|
+
},
|
|
19544
19536
|
menuItemFactory: ClearSelectionAllToolbarMenuItemFactory
|
|
19545
19537
|
}
|
|
19546
19538
|
},
|
|
19547
19539
|
[RibbonStartGroup.FORMAT]: {
|
|
19548
19540
|
[SetRangeFontFamilyCommand.id]: {
|
|
19549
19541
|
order: 1,
|
|
19542
|
+
gridLayout: {
|
|
19543
|
+
row: 1,
|
|
19544
|
+
column: 1,
|
|
19545
|
+
columnSpan: 4,
|
|
19546
|
+
width: 240
|
|
19547
|
+
},
|
|
19550
19548
|
menuItemFactory: FontFamilySelectorMenuItemFactory
|
|
19551
19549
|
},
|
|
19552
19550
|
[SetRangeFontSizeCommand.id]: {
|
|
19553
19551
|
order: 2,
|
|
19552
|
+
gridLayout: {
|
|
19553
|
+
row: 1,
|
|
19554
|
+
column: 5,
|
|
19555
|
+
width: 72
|
|
19556
|
+
},
|
|
19554
19557
|
menuItemFactory: FontSizeSelectorMenuItemFactory
|
|
19555
19558
|
},
|
|
19556
19559
|
[SetRangeFontIncreaseCommand.id]: {
|
|
19557
19560
|
order: 2.1,
|
|
19561
|
+
gridLayout: {
|
|
19562
|
+
row: 1,
|
|
19563
|
+
column: 6
|
|
19564
|
+
},
|
|
19558
19565
|
menuItemFactory: FontSizeIncreaseMenuItemFactory
|
|
19559
19566
|
},
|
|
19560
19567
|
[SetRangeFontDecreaseCommand.id]: {
|
|
19561
19568
|
order: 2.2,
|
|
19569
|
+
gridLayout: {
|
|
19570
|
+
row: 1,
|
|
19571
|
+
column: 7
|
|
19572
|
+
},
|
|
19562
19573
|
menuItemFactory: FontSizeDecreaseMenuItemFactory
|
|
19563
19574
|
},
|
|
19564
19575
|
[SetRangeBoldCommand.id]: {
|
|
19565
19576
|
order: 5,
|
|
19577
|
+
gridLayout: {
|
|
19578
|
+
row: 2,
|
|
19579
|
+
column: 1
|
|
19580
|
+
},
|
|
19566
19581
|
menuItemFactory: BoldMenuItemFactory
|
|
19567
19582
|
},
|
|
19568
19583
|
[SetRangeItalicCommand.id]: {
|
|
19569
19584
|
order: 6,
|
|
19585
|
+
gridLayout: {
|
|
19586
|
+
row: 2,
|
|
19587
|
+
column: 2
|
|
19588
|
+
},
|
|
19570
19589
|
menuItemFactory: ItalicMenuItemFactory
|
|
19571
19590
|
},
|
|
19572
19591
|
[SetRangeUnderlineCommand.id]: {
|
|
19573
19592
|
order: 7,
|
|
19593
|
+
gridLayout: {
|
|
19594
|
+
row: 2,
|
|
19595
|
+
column: 3
|
|
19596
|
+
},
|
|
19574
19597
|
menuItemFactory: UnderlineMenuItemFactory
|
|
19575
19598
|
},
|
|
19576
19599
|
[SetRangeStrickThroughCommand.id]: {
|
|
19577
19600
|
order: 8,
|
|
19601
|
+
gridLayout: {
|
|
19602
|
+
row: 2,
|
|
19603
|
+
column: 4
|
|
19604
|
+
},
|
|
19578
19605
|
menuItemFactory: StrikeThroughMenuItemFactory
|
|
19579
19606
|
},
|
|
19580
19607
|
[SetRangeTextColorCommand.id]: {
|
|
19581
19608
|
order: 9,
|
|
19609
|
+
gridLayout: {
|
|
19610
|
+
row: 2,
|
|
19611
|
+
column: 7
|
|
19612
|
+
},
|
|
19582
19613
|
menuItemFactory: TextColorSelectorMenuItemFactory,
|
|
19583
19614
|
[ResetTextColorCommand.id]: {
|
|
19584
19615
|
order: 0,
|
|
@@ -19587,6 +19618,10 @@ const menuSchema = {
|
|
|
19587
19618
|
},
|
|
19588
19619
|
[SetBackgroundColorCommand.id]: {
|
|
19589
19620
|
order: 10,
|
|
19621
|
+
gridLayout: {
|
|
19622
|
+
row: 2,
|
|
19623
|
+
column: 6
|
|
19624
|
+
},
|
|
19590
19625
|
menuItemFactory: BackgroundColorSelectorMenuItemFactory,
|
|
19591
19626
|
[ResetBackgroundColorCommand.id]: {
|
|
19592
19627
|
order: 0,
|
|
@@ -19595,32 +19630,60 @@ const menuSchema = {
|
|
|
19595
19630
|
},
|
|
19596
19631
|
[SetBorderBasicCommand.id]: {
|
|
19597
19632
|
order: 11,
|
|
19633
|
+
gridLayout: {
|
|
19634
|
+
row: 2,
|
|
19635
|
+
column: 5
|
|
19636
|
+
},
|
|
19598
19637
|
menuItemFactory: CellBorderSelectorMenuItemFactory
|
|
19599
19638
|
}
|
|
19600
19639
|
},
|
|
19601
19640
|
[RibbonStartGroup.LAYOUT]: {
|
|
19602
19641
|
[SetHorizontalTextAlignCommand.id]: {
|
|
19603
19642
|
order: 0,
|
|
19643
|
+
gridLayout: {
|
|
19644
|
+
row: 1,
|
|
19645
|
+
column: 1
|
|
19646
|
+
},
|
|
19604
19647
|
menuItemFactory: HorizontalAlignMenuItemFactory
|
|
19605
19648
|
},
|
|
19606
19649
|
[SetVerticalTextAlignCommand.id]: {
|
|
19607
19650
|
order: 3,
|
|
19651
|
+
gridLayout: {
|
|
19652
|
+
row: 2,
|
|
19653
|
+
column: 1
|
|
19654
|
+
},
|
|
19608
19655
|
menuItemFactory: VerticalAlignMenuItemFactory
|
|
19609
19656
|
},
|
|
19610
19657
|
[SetTextWrapCommand.id]: {
|
|
19611
19658
|
order: 6,
|
|
19659
|
+
gridLayout: {
|
|
19660
|
+
row: 1,
|
|
19661
|
+
column: 2
|
|
19662
|
+
},
|
|
19612
19663
|
menuItemFactory: WrapTextMenuItemFactory
|
|
19613
19664
|
},
|
|
19614
19665
|
[SetShrinkToFitCommand.id]: {
|
|
19615
19666
|
order: 7,
|
|
19667
|
+
gridLayout: {
|
|
19668
|
+
row: 2,
|
|
19669
|
+
column: 2
|
|
19670
|
+
},
|
|
19616
19671
|
menuItemFactory: ShrinkToFitMenuItemFactory
|
|
19617
19672
|
},
|
|
19618
19673
|
[SetTextRotationCommand.id]: {
|
|
19619
19674
|
order: 8,
|
|
19675
|
+
gridLayout: {
|
|
19676
|
+
row: 1,
|
|
19677
|
+
column: 3
|
|
19678
|
+
},
|
|
19620
19679
|
menuItemFactory: TextRotateMenuItemFactory
|
|
19621
19680
|
},
|
|
19622
19681
|
[AddWorksheetMergeCommand.id]: {
|
|
19623
19682
|
order: 9,
|
|
19683
|
+
gridLayout: {
|
|
19684
|
+
row: 2,
|
|
19685
|
+
column: 3
|
|
19686
|
+
},
|
|
19624
19687
|
menuItemFactory: CellMergeMenuItemFactory,
|
|
19625
19688
|
[AddWorksheetMergeAllCommand.id]: {
|
|
19626
19689
|
order: 0,
|
|
@@ -19642,6 +19705,12 @@ const menuSchema = {
|
|
|
19642
19705
|
},
|
|
19643
19706
|
[RibbonStartGroup.OTHERS]: { [AddRangeProtectionFromToolbarCommand.id]: {
|
|
19644
19707
|
order: 0,
|
|
19708
|
+
gridLayout: {
|
|
19709
|
+
row: 1,
|
|
19710
|
+
column: 1,
|
|
19711
|
+
rowSpan: 2,
|
|
19712
|
+
showLabel: true
|
|
19713
|
+
},
|
|
19645
19714
|
menuItemFactory: sheetPermissionToolbarMenuFactory
|
|
19646
19715
|
} }
|
|
19647
19716
|
},
|
|
@@ -19649,19 +19718,41 @@ const menuSchema = {
|
|
|
19649
19718
|
[RibbonViewGroup.DISPLAY]: {
|
|
19650
19719
|
[SHEET_FROZEN_TOOLBAR_MENU_ID]: {
|
|
19651
19720
|
order: 0,
|
|
19721
|
+
gridLayout: {
|
|
19722
|
+
row: 1,
|
|
19723
|
+
column: 1,
|
|
19724
|
+
rowSpan: 2,
|
|
19725
|
+
showLabel: true
|
|
19726
|
+
},
|
|
19652
19727
|
menuItemFactory: SheetFrozenToolbarMenuItemFactory
|
|
19653
19728
|
},
|
|
19654
19729
|
[ZOOM_RATIO_MENU_ID]: {
|
|
19655
19730
|
order: 1,
|
|
19731
|
+
gridLayout: {
|
|
19732
|
+
row: 1,
|
|
19733
|
+
column: 2,
|
|
19734
|
+
width: 112
|
|
19735
|
+
},
|
|
19656
19736
|
menuItemFactory: ZoomRatioMenuItemFactory
|
|
19657
19737
|
},
|
|
19658
19738
|
[ToggleFullscreenOperation.id]: {
|
|
19659
19739
|
order: 2,
|
|
19740
|
+
gridLayout: {
|
|
19741
|
+
row: 2,
|
|
19742
|
+
column: 2,
|
|
19743
|
+
showLabel: true,
|
|
19744
|
+
width: 112
|
|
19745
|
+
},
|
|
19660
19746
|
menuItemFactory: FullscreenMenuItemFactory
|
|
19661
19747
|
}
|
|
19662
19748
|
},
|
|
19663
19749
|
[RibbonViewGroup.VISIBILITY]: { [ToggleGridlinesCommand.id]: {
|
|
19664
19750
|
order: 0,
|
|
19751
|
+
gridLayout: {
|
|
19752
|
+
row: 1,
|
|
19753
|
+
column: 1,
|
|
19754
|
+
showLabel: true
|
|
19755
|
+
},
|
|
19665
19756
|
menuItemFactory: ToggleGridlinesMenuFactory
|
|
19666
19757
|
} }
|
|
19667
19758
|
},
|
|
@@ -20190,18 +20281,12 @@ function AutoFillPopupMenu() {
|
|
|
20190
20281
|
const selected = useObservable(autoFillService.applyType$, AUTO_FILL_APPLY_TYPE.SERIES);
|
|
20191
20282
|
const [isHovered, setHovered] = useState(false);
|
|
20192
20283
|
const workbook = useActiveWorkbook();
|
|
20193
|
-
const
|
|
20284
|
+
const sheetSkeletonManagerService = useMemo(() => {
|
|
20194
20285
|
if (workbook) {
|
|
20195
|
-
const ru = renderManagerService.
|
|
20196
|
-
return
|
|
20197
|
-
sheetSkeletonManagerService: ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService),
|
|
20198
|
-
selectionRenderService: ru === null || ru === void 0 ? void 0 : ru.with(ISheetSelectionRenderService)
|
|
20199
|
-
};
|
|
20286
|
+
const ru = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
20287
|
+
return ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService);
|
|
20200
20288
|
}
|
|
20201
|
-
return
|
|
20202
|
-
sheetSkeletonManagerService: null,
|
|
20203
|
-
selectionRenderService: null
|
|
20204
|
-
};
|
|
20289
|
+
return null;
|
|
20205
20290
|
}, [workbook, renderManagerService]);
|
|
20206
20291
|
const handleMouseEnter = () => {
|
|
20207
20292
|
setHovered(true);
|
|
@@ -20232,10 +20317,11 @@ function AutoFillPopupMenu() {
|
|
|
20232
20317
|
}, [visible]);
|
|
20233
20318
|
if (anchor.col < 0 || anchor.row < 0) return null;
|
|
20234
20319
|
const sheetObject = getSheetObject(univerInstanceService, renderManagerService);
|
|
20235
|
-
if (!sheetObject || !
|
|
20320
|
+
if (!sheetObject || !workbook) return null;
|
|
20236
20321
|
const { scene } = sheetObject;
|
|
20237
20322
|
const skeleton = sheetSkeletonManagerService === null || sheetSkeletonManagerService === void 0 ? void 0 : sheetSkeletonManagerService.getCurrentSkeleton();
|
|
20238
|
-
const viewport =
|
|
20323
|
+
const viewport = getViewportByCell(anchor.row, anchor.col, scene, workbook.getActiveSheet());
|
|
20324
|
+
if (!viewport) return null;
|
|
20239
20325
|
const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
|
|
20240
20326
|
const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
|
|
20241
20327
|
const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
|
|
@@ -21024,7 +21110,8 @@ function DefinedName({ disable }) {
|
|
|
21024
21110
|
const definedNames = useObservable(() => definedNamesService.update$.pipe(map(getDefinedNameMap), startWith(getDefinedNameMap())), getDefinedNameMap(), false, [definedNamesService, unitId]);
|
|
21025
21111
|
useEffect(() => {
|
|
21026
21112
|
const subscription = definedNamesService.currentRange$.subscribe(() => {
|
|
21027
|
-
const
|
|
21113
|
+
const selections = selectionManagerService.getCurrentSelections();
|
|
21114
|
+
const absoluteRef = getAbsoluteRefStringFromSelection(workbook, selections, lexerTreeBuilder);
|
|
21028
21115
|
const definedName = definedNamesService.getDefinedNameByRefString(unitId, absoluteRef);
|
|
21029
21116
|
if (definedName) {
|
|
21030
21117
|
setRangeString(definedName.name);
|
|
@@ -21458,7 +21545,7 @@ function SheetBarMenu() {
|
|
|
21458
21545
|
if (!workbook) return;
|
|
21459
21546
|
const sheets = workbook.getSheets();
|
|
21460
21547
|
const activeSheet = workbook.getActiveSheet();
|
|
21461
|
-
|
|
21548
|
+
const worksheetMenuItems = sheets.map((sheet, index) => {
|
|
21462
21549
|
return {
|
|
21463
21550
|
label: sheet.getName(),
|
|
21464
21551
|
index: `${index}`,
|
|
@@ -21466,7 +21553,8 @@ function SheetBarMenu() {
|
|
|
21466
21553
|
hidden: sheet.isSheetHidden() === BooleanNumber.TRUE,
|
|
21467
21554
|
selected: activeSheet === sheet
|
|
21468
21555
|
};
|
|
21469
|
-
})
|
|
21556
|
+
});
|
|
21557
|
+
setMenu(worksheetMenuItems);
|
|
21470
21558
|
}, [workbook, worksheetProtectionRuleModel]);
|
|
21471
21559
|
const setupStatusUpdate = useCallback(() => commandService.onCommandExecuted((commandInfo) => {
|
|
21472
21560
|
switch (commandInfo.id) {
|
|
@@ -22621,7 +22709,7 @@ function SheetBarTabs() {
|
|
|
22621
22709
|
var _activeSheet$getSheet;
|
|
22622
22710
|
const activeSheet = workbook.getActiveSheet();
|
|
22623
22711
|
const currentSubUnitId = (_activeSheet$getSheet = activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.getSheetId()) !== null && _activeSheet$getSheet !== void 0 ? _activeSheet$getSheet : "";
|
|
22624
|
-
|
|
22712
|
+
const sheetListItems = workbook.getSheets().filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
22625
22713
|
var _sheet$getTabColor;
|
|
22626
22714
|
const worksheetRule = worksheetProtectionRuleModel.getRule(workbook.getUnitId(), sheet.getSheetId());
|
|
22627
22715
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(workbook.getUnitId(), sheet.getSheetId()).length > 0;
|
|
@@ -22639,7 +22727,8 @@ function SheetBarTabs() {
|
|
|
22639
22727
|
selected: activeSheet === sheet,
|
|
22640
22728
|
color: (_sheet$getTabColor = sheet.getTabColor()) !== null && _sheet$getTabColor !== void 0 ? _sheet$getTabColor : void 0
|
|
22641
22729
|
};
|
|
22642
|
-
})
|
|
22730
|
+
});
|
|
22731
|
+
setSheetList(sheetListItems);
|
|
22643
22732
|
setActiveSheetId(currentSubUnitId);
|
|
22644
22733
|
}, [
|
|
22645
22734
|
rangeProtectionRuleModel,
|
|
@@ -22671,7 +22760,7 @@ function SheetBarTabs() {
|
|
|
22671
22760
|
workbookRef.current = workbook;
|
|
22672
22761
|
}, [workbook]);
|
|
22673
22762
|
const syncActiveSheetRender = useCallback((subUnitId) => {
|
|
22674
|
-
const render = renderManagerService.
|
|
22763
|
+
const render = renderManagerService.getRenderUnitById(workbookRef.current.getUnitId());
|
|
22675
22764
|
try {
|
|
22676
22765
|
render === null || render === void 0 || render.with(SheetSkeletonManagerService).setCurrent({ sheetId: subUnitId });
|
|
22677
22766
|
render === null || render === void 0 || render.scene.makeDirty(true);
|
|
@@ -23042,7 +23131,10 @@ function ZoomSlider() {
|
|
|
23042
23131
|
useEffect(() => {
|
|
23043
23132
|
setZoom(getCurrentZoom());
|
|
23044
23133
|
return commandService.onCommandExecuted((commandInfo) => {
|
|
23045
|
-
if (commandInfo.id === SetZoomRatioOperation.id || commandInfo.id === SetWorksheetActiveOperation.id)
|
|
23134
|
+
if (commandInfo.id === SetZoomRatioOperation.id || commandInfo.id === SetWorksheetActiveOperation.id) {
|
|
23135
|
+
const currentZoom = getCurrentZoom();
|
|
23136
|
+
setZoom(currentZoom);
|
|
23137
|
+
}
|
|
23046
23138
|
}).dispose;
|
|
23047
23139
|
}, [commandService, getCurrentZoom]);
|
|
23048
23140
|
function handleChange(value) {
|
|
@@ -23142,8 +23234,6 @@ function formatNumber(item) {
|
|
|
23142
23234
|
const SINGLE_MODE_WIDTH = 800;
|
|
23143
23235
|
const ROW_COUNT_THRESHOLD = 3;
|
|
23144
23236
|
const StatusBar = () => {
|
|
23145
|
-
var _useConfigValue$statu, _useConfigValue;
|
|
23146
|
-
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;
|
|
23147
23237
|
const [isSingle, setIsSingle] = useState(window.innerWidth < SINGLE_MODE_WIDTH);
|
|
23148
23238
|
const statusBarService = useDependency(IStatusBarService);
|
|
23149
23239
|
const items = statusBarService.getFunctions().map((item, index) => ({
|
|
@@ -23153,7 +23243,7 @@ const StatusBar = () => {
|
|
|
23153
23243
|
disable: false,
|
|
23154
23244
|
pattern: null
|
|
23155
23245
|
}));
|
|
23156
|
-
const useStatistics = (initialItems, statusBarService, isSingle
|
|
23246
|
+
const useStatistics = (initialItems, statusBarService, isSingle) => {
|
|
23157
23247
|
const [statistics, setStatistics] = useState(initialItems);
|
|
23158
23248
|
const [show, setShow] = useState(true);
|
|
23159
23249
|
const filteredStatistics = useMemo(() => statistics.filter((item) => item.show && !item.disable), [statistics]);
|
|
@@ -23181,21 +23271,16 @@ const StatusBar = () => {
|
|
|
23181
23271
|
}));
|
|
23182
23272
|
}, []);
|
|
23183
23273
|
useEffect(() => {
|
|
23184
|
-
if (!showStatistic) return;
|
|
23185
23274
|
const subscription = statusBarService.state$.subscribe(updateStatistics);
|
|
23186
23275
|
return () => subscription.unsubscribe();
|
|
23187
|
-
}, [
|
|
23188
|
-
showStatistic,
|
|
23189
|
-
statusBarService,
|
|
23190
|
-
updateStatistics
|
|
23191
|
-
]);
|
|
23276
|
+
}, [statusBarService, updateStatistics]);
|
|
23192
23277
|
return {
|
|
23193
23278
|
statistics,
|
|
23194
23279
|
showList,
|
|
23195
23280
|
show
|
|
23196
23281
|
};
|
|
23197
23282
|
};
|
|
23198
|
-
const { showList, show } = useStatistics(items, statusBarService, isSingle
|
|
23283
|
+
const { showList, show } = useStatistics(items, statusBarService, isSingle);
|
|
23199
23284
|
const handleResize = debounce(() => {
|
|
23200
23285
|
const newSingleState = window.innerWidth < SINGLE_MODE_WIDTH;
|
|
23201
23286
|
if (isSingle !== newSingleState) setIsSingle(newSingleState);
|
|
@@ -23207,7 +23292,6 @@ const StatusBar = () => {
|
|
|
23207
23292
|
};
|
|
23208
23293
|
}, [isSingle]);
|
|
23209
23294
|
const getStatisticLayout = (showList, rowCountThreshold, CopyableStatisticItem) => {
|
|
23210
|
-
if (!showStatistic) return null;
|
|
23211
23295
|
if (showList.length > rowCountThreshold) return showList.reduce((acc, _, index) => {
|
|
23212
23296
|
if (index % 2 === 0) acc.push(showList.slice(index, index + 2));
|
|
23213
23297
|
return acc;
|
|
@@ -23308,7 +23392,7 @@ function RenderSheetHeader() {
|
|
|
23308
23392
|
return null;
|
|
23309
23393
|
}
|
|
23310
23394
|
/**
|
|
23311
|
-
*
|
|
23395
|
+
* We should not write into this component anymore.
|
|
23312
23396
|
*/
|
|
23313
23397
|
function RenderSheetContent() {
|
|
23314
23398
|
var _componentManager$get;
|
|
@@ -24020,7 +24104,7 @@ let SheetUIController = class SheetUIController extends Disposable {
|
|
|
24020
24104
|
}
|
|
24021
24105
|
_initFocusHandler() {
|
|
24022
24106
|
this.disposeWithMe(this._layoutService.registerFocusHandler(UniverInstanceType.UNIVER_SHEET, (_unitId) => {
|
|
24023
|
-
const cellEditorRender = this._injector.get(IRenderManagerService).
|
|
24107
|
+
const cellEditorRender = this._injector.get(IRenderManagerService).getRenderUnitById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
24024
24108
|
const docSelectionRenderService = cellEditorRender === null || cellEditorRender === void 0 ? void 0 : cellEditorRender.with(DocSelectionRenderService);
|
|
24025
24109
|
docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.focus();
|
|
24026
24110
|
}));
|
|
@@ -24062,7 +24146,7 @@ const useHighlightRange = (ranges = []) => {
|
|
|
24062
24146
|
//#endregion
|
|
24063
24147
|
//#region package.json
|
|
24064
24148
|
var name = "@univerjs/sheets-ui";
|
|
24065
|
-
var version = "1.0.0-alpha.
|
|
24149
|
+
var version = "1.0.0-alpha.8";
|
|
24066
24150
|
|
|
24067
24151
|
//#endregion
|
|
24068
24152
|
//#region src/views/cell-popup/config.ts
|
|
@@ -24255,8 +24339,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24255
24339
|
};
|
|
24256
24340
|
const unitId = workbook.getUnitId();
|
|
24257
24341
|
const subUnitId = worksheet.getSheetId();
|
|
24258
|
-
const skeleton = (_this$_renderManagerS = this._renderManagerService.
|
|
24259
|
-
const currentRender = this._renderManagerService.
|
|
24342
|
+
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24343
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24260
24344
|
if (!currentRender || !skeleton) return {
|
|
24261
24345
|
dispose: () => {},
|
|
24262
24346
|
canDispose: () => true
|
|
@@ -24309,8 +24393,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24309
24393
|
const subUnitId = worksheet.getSheetId();
|
|
24310
24394
|
if (unitId !== location.unitId || location.subUnitId !== subUnitId) return null;
|
|
24311
24395
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24312
|
-
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.
|
|
24313
|
-
const currentRender = this._renderManagerService.
|
|
24396
|
+
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24397
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24314
24398
|
if (!currentRender || !skeleton) return null;
|
|
24315
24399
|
const { position, position$, disposable } = this._createPositionObserver(bound, currentRender, skeleton, worksheet);
|
|
24316
24400
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24363,8 +24447,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24363
24447
|
const unitId = workbook.getUnitId();
|
|
24364
24448
|
const subUnitId = worksheet.getSheetId();
|
|
24365
24449
|
if (_unitId && unitId !== _unitId || _subUnitId && _subUnitId !== subUnitId) return null;
|
|
24366
|
-
const skeleton = (_this$_renderManagerS3 = this._renderManagerService.
|
|
24367
|
-
const currentRender = this._renderManagerService.
|
|
24450
|
+
const skeleton = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24451
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24368
24452
|
if (!currentRender || !skeleton) return null;
|
|
24369
24453
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24370
24454
|
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
@@ -24406,7 +24490,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24406
24490
|
if (!worksheet) return null;
|
|
24407
24491
|
const unitId = workbook.getUnitId();
|
|
24408
24492
|
const subUnitId = worksheet.getSheetId();
|
|
24409
|
-
const currentRender = this._renderManagerService.
|
|
24493
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24410
24494
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24411
24495
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24412
24496
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
@@ -24475,7 +24559,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24475
24559
|
const unitId = workbook.getUnitId();
|
|
24476
24560
|
const subUnitId = worksheet.getSheetId();
|
|
24477
24561
|
if (_unitId && unitId !== _unitId || _subUnitId && subUnitId !== _subUnitId) return null;
|
|
24478
|
-
const currentRender = this._renderManagerService.
|
|
24562
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
24479
24563
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(SheetSkeletonManagerService).ensureSkeleton(subUnitId);
|
|
24480
24564
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24481
24565
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
@@ -25598,7 +25682,7 @@ let CellAlertManagerService = class CellAlertManagerService extends Disposable {
|
|
|
25598
25682
|
}
|
|
25599
25683
|
const { location } = alert;
|
|
25600
25684
|
const { row, col, unitId, subUnitId } = location;
|
|
25601
|
-
if (!this._renderManagerService.
|
|
25685
|
+
if (!this._renderManagerService.getRenderUnitById(unitId)) return;
|
|
25602
25686
|
const disposable = this._cellPopupManagerService.showPopup({
|
|
25603
25687
|
unitId,
|
|
25604
25688
|
subUnitId,
|
|
@@ -25795,7 +25879,7 @@ function DefinedNameInputContent(props) {
|
|
|
25795
25879
|
const [isFocusFormulaEditor, setIsFocusFormulaEditor] = useState(false);
|
|
25796
25880
|
useSidebarClick((e) => {
|
|
25797
25881
|
var _formulaEditorRef$cur;
|
|
25798
|
-
|
|
25882
|
+
(_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
|
|
25799
25883
|
});
|
|
25800
25884
|
return /* @__PURE__ */ jsxs("div", {
|
|
25801
25885
|
className: clsx("univer-grid univer-space-y-2 univer-pb-1", borderBottomClassName, { "univer-hidden": !state }),
|
|
@@ -26030,7 +26114,7 @@ const DefinedNameContainer = () => {
|
|
|
26030
26114
|
};
|
|
26031
26115
|
return /* @__PURE__ */ jsxs("div", {
|
|
26032
26116
|
"data-u-comp": "defined-name-container",
|
|
26033
|
-
className: "univer-relative univer-box-border univer-flex univer-h-full univer-w-full univer-flex-col",
|
|
26117
|
+
className: "univer-relative univer-box-border univer-flex univer-h-full univer-w-full univer-flex-col univer-overflow-hidden",
|
|
26034
26118
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
26035
26119
|
className: "univer-mb-4",
|
|
26036
26120
|
children: [/* @__PURE__ */ jsxs(Button, {
|
|
@@ -26351,7 +26435,8 @@ function ListDropDown(props) {
|
|
|
26351
26435
|
multiple,
|
|
26352
26436
|
onChange: async (newValue) => {
|
|
26353
26437
|
var _newValue$;
|
|
26354
|
-
|
|
26438
|
+
const str = multiple ? serializeListOptions(newValue) : (_newValue$ = newValue[0]) !== null && _newValue$ !== void 0 ? _newValue$ : "";
|
|
26439
|
+
setLocalValue(str);
|
|
26355
26440
|
if (!(await (onChange === null || onChange === void 0 ? void 0 : onChange(newValue)) === false)) hideFn();
|
|
26356
26441
|
},
|
|
26357
26442
|
options,
|
|
@@ -26438,13 +26523,14 @@ const SheetPermissionDialog = () => {
|
|
|
26438
26523
|
actions: defaultWorksheetUnitActionList
|
|
26439
26524
|
}).then((result) => {
|
|
26440
26525
|
if (cancelled) return;
|
|
26441
|
-
|
|
26526
|
+
const actions = result[0].strategies.reduce((p, c) => {
|
|
26442
26527
|
if (subUnitPermissionTypeMap[c.action]) p[c.action] = {
|
|
26443
26528
|
text: localeService.t(`sheets-ui.permission.panel.${subUnitPermissionTypeMap[c.action]}`),
|
|
26444
26529
|
allowed: c.role !== UnitRole.Owner
|
|
26445
26530
|
};
|
|
26446
26531
|
return p;
|
|
26447
|
-
}, {})
|
|
26532
|
+
}, {});
|
|
26533
|
+
setPermissionMap(actions);
|
|
26448
26534
|
loadingTimer = setTimeout(() => {
|
|
26449
26535
|
setLoading(false);
|
|
26450
26536
|
}, 100);
|
|
@@ -26839,7 +26925,8 @@ const PermissionDetailMainPart = (props) => {
|
|
|
26839
26925
|
setEndForRange(range, worksheet.getRowCount(), worksheet.getColumnCount());
|
|
26840
26926
|
return range;
|
|
26841
26927
|
});
|
|
26842
|
-
|
|
26928
|
+
const rangeErrorString = checkRangeValid(injector, transformedRange, permissionId, unitId, subUnitId);
|
|
26929
|
+
onRangesChange(transformedRange, rangeErrorString);
|
|
26843
26930
|
};
|
|
26844
26931
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FormLayout, {
|
|
26845
26932
|
className: "univer-font-medium",
|
|
@@ -26912,7 +26999,6 @@ const PermissionDetailUserPart = (props) => {
|
|
|
26912
26999
|
title: { title: "" },
|
|
26913
27000
|
children: { label: UNIVER_SHEET_PERMISSION_USER_DIALOG },
|
|
26914
27001
|
width: "auto",
|
|
26915
|
-
destroyOnClose: true,
|
|
26916
27002
|
closable: false,
|
|
26917
27003
|
onClose: () => dialogService.close(UNIVER_SHEET_PERMISSION_USER_DIALOG_ID),
|
|
26918
27004
|
className: "sheet-permission-user-dialog"
|
|
@@ -27461,10 +27547,13 @@ const SheetPermissionUserDialog = () => {
|
|
|
27461
27547
|
})) === -1) {
|
|
27462
27548
|
const select = { ...item };
|
|
27463
27549
|
setSelectUserInfo([...selectUserInfo, select]);
|
|
27464
|
-
} else
|
|
27465
|
-
|
|
27466
|
-
|
|
27467
|
-
|
|
27550
|
+
} else {
|
|
27551
|
+
const newSelectUserInfo = selectUserInfo.filter((v) => {
|
|
27552
|
+
var _v$subject2, _item$subject3;
|
|
27553
|
+
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);
|
|
27554
|
+
});
|
|
27555
|
+
setSelectUserInfo(newSelectUserInfo);
|
|
27556
|
+
}
|
|
27468
27557
|
};
|
|
27469
27558
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
27470
27559
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Input, {
|
|
@@ -27829,7 +27918,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
27829
27918
|
}
|
|
27830
27919
|
_getEditorViewModel(unitId) {
|
|
27831
27920
|
var _this$_renderManagerS;
|
|
27832
|
-
return (_this$_renderManagerS = this._renderManagerService.
|
|
27921
|
+
return (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService).getViewModel();
|
|
27833
27922
|
}
|
|
27834
27923
|
_syncFormulaEditorContent() {
|
|
27835
27924
|
this.disposeWithMe(this._editorBridgeService.currentEditCellState$.subscribe((editCellState) => {
|
|
@@ -27898,7 +27987,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
27898
27987
|
}
|
|
27899
27988
|
_syncActionsAndRender(unitId, parmas) {
|
|
27900
27989
|
const INCLUDE_LIST = [DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];
|
|
27901
|
-
const currentRender = this._renderManagerService.
|
|
27990
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
27902
27991
|
if (currentRender == null) return;
|
|
27903
27992
|
const skeleton = currentRender.with(DocSkeletonManagerService).getSkeleton();
|
|
27904
27993
|
const docDataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
@@ -27925,7 +28014,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
27925
28014
|
if (body.paragraphs) body.paragraphs = this._clearParagraph(body.paragraphs);
|
|
27926
28015
|
}
|
|
27927
28016
|
const INCLUDE_LIST = [DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];
|
|
27928
|
-
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.
|
|
28017
|
+
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSkeletonManagerService).getSkeleton();
|
|
27929
28018
|
const docDataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
27930
28019
|
const docViewModel = this._getEditorViewModel(unitId);
|
|
27931
28020
|
if (docDataModel == null || docViewModel == null || skeleton == null) return;
|
|
@@ -27934,7 +28023,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
27934
28023
|
docDataModel.getSnapshot().drawingsOrder = drawingsOrder !== null && drawingsOrder !== void 0 ? drawingsOrder : [];
|
|
27935
28024
|
this._checkAndSetRenderStyleConfig(docDataModel);
|
|
27936
28025
|
docViewModel.reset(docDataModel);
|
|
27937
|
-
const currentRender = this._renderManagerService.
|
|
28026
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
27938
28027
|
if (currentRender == null) return;
|
|
27939
28028
|
skeleton.calculate();
|
|
27940
28029
|
if (INCLUDE_LIST.includes(unitId)) {
|
|
@@ -27951,7 +28040,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
27951
28040
|
}
|
|
27952
28041
|
_refreshRenderStyleConfig(unitId) {
|
|
27953
28042
|
var _currentRender$mainCo3;
|
|
27954
|
-
const currentRender = this._renderManagerService.
|
|
28043
|
+
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
27955
28044
|
const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService).getSkeleton();
|
|
27956
28045
|
const docDataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
27957
28046
|
const docViewModel = this._getEditorViewModel(unitId);
|
|
@@ -28454,7 +28543,7 @@ function MobileSheetBarImpl(props) {
|
|
|
28454
28543
|
const currentSubUnitId = workbook.getActiveSheet().getSheetId();
|
|
28455
28544
|
const sheets = workbook.getSheets();
|
|
28456
28545
|
const activeSheet = workbook.getActiveSheet();
|
|
28457
|
-
|
|
28546
|
+
const sheetListItems = sheets.filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
28458
28547
|
var _sheet$getTabColor;
|
|
28459
28548
|
return {
|
|
28460
28549
|
sheetId: sheet.getSheetId(),
|
|
@@ -28463,7 +28552,8 @@ function MobileSheetBarImpl(props) {
|
|
|
28463
28552
|
selected: activeSheet === sheet,
|
|
28464
28553
|
color: (_sheet$getTabColor = sheet.getTabColor()) !== null && _sheet$getTabColor !== void 0 ? _sheet$getTabColor : void 0
|
|
28465
28554
|
};
|
|
28466
|
-
})
|
|
28555
|
+
});
|
|
28556
|
+
setSheetList(sheetListItems);
|
|
28467
28557
|
setActiveKey(currentSubUnitId);
|
|
28468
28558
|
if (tabMapRef.current.has(currentSubUnitId)) {
|
|
28469
28559
|
const element = tabMapRef.current.get(currentSubUnitId);
|
|
@@ -29228,7 +29318,7 @@ let WorksheetProtectionRenderController = class WorksheetProtectionRenderControl
|
|
|
29228
29318
|
}
|
|
29229
29319
|
_initRender() {
|
|
29230
29320
|
const renderId = this._context.unitId;
|
|
29231
|
-
const render = renderId && this._renderManagerService.
|
|
29321
|
+
const render = renderId && this._renderManagerService.getRenderUnitById(renderId);
|
|
29232
29322
|
const spreadsheetRender = render && render.mainComponent;
|
|
29233
29323
|
if (spreadsheetRender) {
|
|
29234
29324
|
if (!spreadsheetRender.getExtensionByKey("worksheet-protection")) spreadsheetRender.register(this._worksheetProtectionRenderExtension);
|
|
@@ -29648,7 +29738,7 @@ let SheetContextMenuMobileRenderController = class SheetContextMenuMobileRenderC
|
|
|
29648
29738
|
}
|
|
29649
29739
|
_getCurrentRenderSelections() {
|
|
29650
29740
|
var _selectionRenderServi;
|
|
29651
|
-
const currentRender = this._renderManagerService.
|
|
29741
|
+
const currentRender = this._renderManagerService.getRenderUnitById(this._context.unitId);
|
|
29652
29742
|
const selectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
29653
29743
|
return (_selectionRenderServi = selectionRenderService === null || selectionRenderService === void 0 ? void 0 : selectionRenderService.getSelectionControls().map((control) => convertSelectionDataToRange(control.getValue()))) !== null && _selectionRenderServi !== void 0 ? _selectionRenderServi : [];
|
|
29654
29744
|
}
|
|
@@ -30132,9 +30222,7 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30132
30222
|
}
|
|
30133
30223
|
_getFreeze() {
|
|
30134
30224
|
var _this$_sheetSkeletonM;
|
|
30135
|
-
|
|
30136
|
-
if (snapshot == null) return;
|
|
30137
|
-
return snapshot.freeze;
|
|
30225
|
+
return (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton.worksheet.getFreeze();
|
|
30138
30226
|
}
|
|
30139
30227
|
_initScrollEventListener() {
|
|
30140
30228
|
const { scene } = this._context;
|
|
@@ -30300,7 +30388,10 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30300
30388
|
const speedFactor = Math.min(swipeSpeed / 2, 1);
|
|
30301
30389
|
multiplier = MIN_VELOCITY_MULTIPLIER + (MAX_VELOCITY_MULTIPLIER - MIN_VELOCITY_MULTIPLIER) * speedFactor;
|
|
30302
30390
|
if (swipeDuration < 150 && Math.abs(instantVelocity) > 3) multiplier *= 1.3;
|
|
30303
|
-
} else
|
|
30391
|
+
} else {
|
|
30392
|
+
const velocityFactor = Math.min(Math.abs(instantVelocity) / 5, 1);
|
|
30393
|
+
multiplier = MIN_VELOCITY_MULTIPLIER * (.5 + velocityFactor * .5);
|
|
30394
|
+
}
|
|
30304
30395
|
return Math.max(MIN_VELOCITY_MULTIPLIER * .5, Math.min(MAX_VELOCITY_MULTIPLIER * 1.5, multiplier));
|
|
30305
30396
|
};
|
|
30306
30397
|
/**
|
|
@@ -30626,7 +30717,10 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30626
30717
|
if (!_touchScrolling) return;
|
|
30627
30718
|
_touchScrolling = false;
|
|
30628
30719
|
const avgVelocity = calculateAverageVelocity();
|
|
30629
|
-
const
|
|
30720
|
+
const swipeDuration = performance.now() - swipeStartTime;
|
|
30721
|
+
const totalDistance = Math.sqrt(swipeTotalDisplacement.x * swipeTotalDisplacement.x + swipeTotalDisplacement.y * swipeTotalDisplacement.y);
|
|
30722
|
+
const instantVelocity = Math.sqrt(avgVelocity.x * avgVelocity.x + avgVelocity.y * avgVelocity.y);
|
|
30723
|
+
const dynamicMultiplier = calculateDynamicVelocityMultiplier(swipeDuration, totalDistance, instantVelocity);
|
|
30630
30724
|
const { maxVelocity, minVelocityThreshold } = getZoomAdjustedParams();
|
|
30631
30725
|
const cappedVelX = Math.max(-maxVelocity, Math.min(maxVelocity, avgVelocity.x * dynamicMultiplier));
|
|
30632
30726
|
const cappedVelY = Math.max(-maxVelocity, Math.min(maxVelocity, avgVelocity.y * dynamicMultiplier));
|
|
@@ -30719,7 +30813,7 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30719
30813
|
if (param == null) return;
|
|
30720
30814
|
const { unitId } = this._context;
|
|
30721
30815
|
const { skeleton } = param;
|
|
30722
|
-
const scene = (_this$_renderManagerS = this._renderManagerService.
|
|
30816
|
+
const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
|
|
30723
30817
|
if (skeleton == null || scene == null) return;
|
|
30724
30818
|
const { rowTotalHeight, columnTotalWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
30725
30819
|
scene === null || scene === void 0 || scene.transformByState({
|
|
@@ -30956,7 +31050,7 @@ let SheetCellDropdownManagerService = class SheetCellDropdownManagerService exte
|
|
|
30956
31050
|
const { location, onHide, closeOnOutSide = true } = param;
|
|
30957
31051
|
const { row, col, unitId, subUnitId } = location;
|
|
30958
31052
|
const component = dropdownMap[param.type];
|
|
30959
|
-
const currentRender = this._renderManagerService.
|
|
31053
|
+
const currentRender = this._renderManagerService.getRenderUnitById(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
30960
31054
|
const disposable = new DisposableCollection();
|
|
30961
31055
|
const popupDisposable = this._canvasPopupManagerService.attachPopupToCell(row, col, {
|
|
30962
31056
|
componentKey: component.componentKey,
|
|
@@ -31796,6 +31890,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends Plugin
|
|
|
31796
31890
|
[SheetContextMenuMobileRenderController],
|
|
31797
31891
|
[MobileHeaderResizeRenderController],
|
|
31798
31892
|
[MoveRangeRenderController],
|
|
31893
|
+
[AutoFillRenderController],
|
|
31799
31894
|
[EditorBridgeRenderController],
|
|
31800
31895
|
[SheetPermissionInterceptorCanvasRenderController],
|
|
31801
31896
|
[SheetPermissionInterceptorFormulaRenderController],
|
|
@@ -31823,7 +31918,7 @@ _defineProperty(UniverSheetsMobileUIPlugin, "packageName", name);
|
|
|
31823
31918
|
_defineProperty(UniverSheetsMobileUIPlugin, "version", version);
|
|
31824
31919
|
_defineProperty(UniverSheetsMobileUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
31825
31920
|
UniverSheetsMobileUIPlugin = __decorate([
|
|
31826
|
-
DependentOn(UniverSheetsPlugin, UniverMobileUIPlugin),
|
|
31921
|
+
DependentOn(UniverDocsPlugin, UniverFormulaEnginePlugin, UniverRenderEnginePlugin, UniverSheetsPlugin, UniverMobileUIPlugin, UniverDocsUIPlugin),
|
|
31827
31922
|
__decorateParam(1, Inject(Injector)),
|
|
31828
31923
|
__decorateParam(2, IRenderManagerService),
|
|
31829
31924
|
__decorateParam(3, IConfigService),
|
|
@@ -32416,6 +32511,7 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends Plugin {
|
|
|
32416
32511
|
[CellCustomRenderController],
|
|
32417
32512
|
[SheetContextMenuRenderController],
|
|
32418
32513
|
[MoveRangeRenderController],
|
|
32514
|
+
[AutoFillRenderController],
|
|
32419
32515
|
[EditorBridgeRenderController],
|
|
32420
32516
|
[SheetPermissionInterceptorCanvasRenderController],
|
|
32421
32517
|
[SheetPermissionInterceptorFormulaRenderController],
|
|
@@ -32443,7 +32539,7 @@ _defineProperty(UniverSheetsUIPlugin, "packageName", name);
|
|
|
32443
32539
|
_defineProperty(UniverSheetsUIPlugin, "version", version);
|
|
32444
32540
|
_defineProperty(UniverSheetsUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
32445
32541
|
UniverSheetsUIPlugin = __decorate([
|
|
32446
|
-
DependentOn(UniverSheetsPlugin),
|
|
32542
|
+
DependentOn(UniverDocsPlugin, UniverFormulaEnginePlugin, UniverRenderEnginePlugin, UniverSheetsPlugin, UniverUIPlugin, UniverDocsUIPlugin),
|
|
32447
32543
|
__decorateParam(1, Inject(Injector)),
|
|
32448
32544
|
__decorateParam(2, IRenderManagerService),
|
|
32449
32545
|
__decorateParam(3, IConfigService),
|