@univerjs/sheets-ui 1.0.0-alpha.8 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +12 -19
- package/lib/cjs/index.js +406 -470
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-HK.js +3 -3
- package/lib/cjs/locale/zh-TW.js +3 -3
- package/lib/es/facade.js +12 -19
- package/lib/es/index.js +411 -475
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-HK.js +3 -3
- package/lib/es/locale/zh-TW.js +3 -3
- package/lib/facade.js +12 -19
- package/lib/index.css +6 -5
- package/lib/index.js +411 -475
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-HK.js +3 -3
- package/lib/locale/zh-TW.js +3 -3
- package/lib/types/controllers/editor/editing.render-controller.d.ts +0 -1
- package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/slide-tab-bar.d.ts +0 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +11 -11
- 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/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
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";
|
|
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,
|
|
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
|
-
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";
|
|
2
|
+
import { AbsoluteRefType, BaselineOffset, BooleanNumber, BorderStyleTypes, CellModeEnum, CellValueType, ColorKit, CommandType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DependentOn, Direction, Disposable, DisposableCollection, DocumentFlavor, EDITOR_ACTIVATED, ErrorService, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_UNIVER_EDITOR, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, LocaleType, LookUp, NilCommand, ObjectMatrix, Optional, Plugin, PresetListType, Quantity, RANGE_TYPE, Range, Rectangle, RxDisposable, SHEET_EDITOR_UNITS, ThemeService, Tools, UndoCommandId, UniverInstanceType, UserManagerService, VerticalAlign, Workbook, WrapStrategy, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, composeStyles, convertCellToRange, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, dateKit, debounce, extractPureTextFromCell, fromEventSubject, generateRandomId, get, getEmptyCell, getIntersectRange, getNumfmtParseValueFilter, getReverseDirection, handleStyleToString, isDefaultFormat, isFormulaString, isInternalEditorID, isNotNullOrUndefined, isRealNum, isSafeUrl, isTextFormat, isValidRange, merge, mergeOverrideWithDependencies, nameCharacterCheck, numberToABC, numfmt, registerDependencies, sequenceExecute, set, skipParseTagNames, sortRules, splitIntoGrid, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
|
|
3
|
+
import { AUTO_FILL_APPLY_TYPE, AUTO_FILL_HOOK_TYPE, AddMergeUndoMutationFactory, AddRangeProtectionCommand, AddRangeProtectionMutation, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeMutation, AddWorksheetMergeVerticalCommand, AddWorksheetProtectionCommand, AutoClearContentCommand, AutoFillCommand, AutoFillController, BEFORE_CELL_EDIT, BorderStyleManagerService, COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, CancelMarkDirtyRowAutoHeightOperation, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionCommand, DeltaColumnWidthCommand, DeltaRowHeightCommand, EditStateEnum, IAutoFillService, IExclusiveRangeService, INTERCEPTOR_POINT, INumfmtService, IRefSelectionsService, InsertColBeforeCommand, InsertColCommand, InsertColMutation, InsertDefinedNameCommand, InsertMultiColsLeftCommand, InsertMultiColsRightCommand, InsertMultiRowsAboveCommand, InsertMultiRowsAfterCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowBeforeCommand, InsertRowCommand, InsertRowMutation, InsertSheetCommand, InsertSheetMutation, MAX_CELL_PER_SHEET_KEY, MERGE_CELL_INTERCEPTOR_CHECK, MarkDirtyRowAutoHeightOperation, MergeCellController, MoveColsCommand, MoveColsMutation, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, REF_SELECTIONS_ENABLED, RangeProtectionCache, RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RefRangeService, RefSelectionsService, RefillCommand, RemoveColCommand, RemoveColMutation, RemoveDefinedNameCommand, RemoveMergeUndoMutationFactory, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, RemoveSheetMutation, RemoveWorksheetMergeCommand, RemoveWorksheetMergeMutation, ResetBackgroundColorCommand, ResetTextColorCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SELECTIONS_ENABLED, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SHEETS_PLUGIN_CONFIG_KEY, ScrollToCellOperation, SelectionMoveType, SetBackgroundColorCommand, SetBoldCommand, SetBorderBasicCommand, SetBorderCommand, SetColHiddenCommand, SetColHiddenMutation, SetColVisibleMutation, SetColWidthCommand, SetDefinedNameCommand, SetFontFamilyCommand, SetFontSizeCommand, SetFrozenCommand, SetFrozenMutation, SetFrozenMutationFactory, SetHorizontalTextAlignCommand, SetItalicCommand, SetProtectionCommand, SetRangeValuesCommand, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetRowHeightCommand, SetRowHiddenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedColsVisibleCommand, SetSelectedRowsVisibleCommand, SetSelectionsOperation, SetShrinkToFitCommand, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStrikeThroughCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SetWorksheetColWidthMutation, SetWorksheetColWidthMutationFactory, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetNameMutation, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetPermissionPointsCommand, SetWorksheetRowAutoHeightMutation, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowHeightMutation, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetCopyDownCommand, SheetCopyRightCommand, SheetInterceptorService, SheetPermissionCheckController, SheetPermissionInitController, SheetSkeletonService, SheetsSelectionsService, TextToNumberCommand, ToggleCellCheckboxCommand, ToggleGridlinesCommand, ToggleGridlinesMutation, UniverSheetsPlugin, ViewStateEnum, WorkbookCopyPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookEditablePermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookRenameSheetPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditPermission, WorksheetInsertColumnPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetViewPermission, adjustRangeOnMutation, alignToMergedCellsBorders, attachPrimaryWithCoord, attachRangeWithCoord, attachSelectionWithCoord, baseProtectionActions, convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, countCells, defaultLargeSheetOperationConfig, deserializeListOptions, discreteRangeToRange, expandToContinuousRange, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getCellAtRowCol, getClearContentMutationParamsForRanges, getMoveRangeCommandMutations, getPrimaryForRange, getSelectionsService, getSheetCommandTarget, isCellImage, rangeToDiscreteRange, serializeListOptions, setEndForRange, validateDefinedName } from "@univerjs/sheets";
|
|
4
|
+
import { AnchoredContextMenu, BuiltInUIPart, COLOR_PICKER_COMPONENT, ComponentContainer, ComponentManager, ContextMenuGroup, ContextMenuPosition, CopyCommand, CutCommand, DISABLE_AUTO_FOCUS_KEY, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, HTML_CLIPBOARD_MIME_TYPE, ICanvasPopupService, IClipboardInterfaceService, IContextMenuService, IDialogService, ILayoutService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IShortcutService, ISidebarService, IUIPartsService, IconManager, KeyCode, MenuItemType, MetaKeys, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SheetPasteShortKeyCommandName, Slider, ToggleFullscreenOperation, ToolbarItem, UI_PLUGIN_CONFIG_KEY, UniverMobileUIPlugin, ZoomInput, connectInjector, getMenuHiddenObservable, handleStringToStyle, imageMimeTypeSet, sanitizeParsedHtml, textTrim, useComponentsOfPart, useConfigValue, useDependency, useEvent, useObservable, useSidebarClick, useVirtualList } from "@univerjs/ui";
|
|
5
|
+
import { CURSOR_TYPE, DashedRect, DeviceInputEventType, Engine, FIX_ONE_PIXEL_BLUR_OFFSET, Group, IRenderManagerService, Layer, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, Rect, RegularPolygon, RenderUnit, SHEET_EXTENSION_PREFIX, SHEET_VIEWPORT_KEY, Scene, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetExtension, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetRowHeader, TRANSFORM_CHANGE_OBSERVABLE_TYPE, UniverRenderEnginePlugin, Vector2, Viewport, calculateCellImageRect, cancelRequestFrame, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, fixLineWidthByScale, getCurrentTypeOfRenderer, getNextWheelZoomRatio, ptToPixel, requestNewFrame, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
|
|
6
|
+
import { BehaviorSubject, EMPTY, Observable, Subject, Subscription, combineLatest, combineLatestWith, distinctUntilChanged, filter, firstValueFrom, from, fromEvent, map, merge as merge$1, of, shareReplay, skip, startWith, switchMap, take, takeUntil, throttleTime, timeout, withLatestFrom } from "rxjs";
|
|
7
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";
|
|
@@ -589,9 +589,8 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
589
589
|
* @param {ISelectionWithCoord} selectionWithStyle
|
|
590
590
|
*/
|
|
591
591
|
_addSelectionControlByModelData(selectionWithStyle) {
|
|
592
|
-
var _selectionWithStyle$s;
|
|
593
592
|
const skeleton = this._skeleton;
|
|
594
|
-
const style =
|
|
593
|
+
const style = selectionWithStyle.style ?? genNormalSelectionStyle(this._selectionTheme);
|
|
595
594
|
const scene = this._scene;
|
|
596
595
|
selectionWithStyle.style = style;
|
|
597
596
|
return this.newSelectionControl(scene, skeleton, selectionWithStyle);
|
|
@@ -671,17 +670,15 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
671
670
|
* @param moveStartPosY
|
|
672
671
|
*/
|
|
673
672
|
_setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType = ScrollTimerType.ALL, moveStartPosX, moveStartPosY) {
|
|
674
|
-
var _viewportMain$left, _viewportMain$top;
|
|
675
673
|
let xCrossTime = 0;
|
|
676
674
|
let yCrossTime = 0;
|
|
677
675
|
let lastX = moveStartPosX;
|
|
678
676
|
let lastY = moveStartPosY;
|
|
679
677
|
this._scrollTimer = ScrollTimer.create(this._scene, scrollTimerType);
|
|
680
|
-
this._scrollTimer.startScroll((
|
|
678
|
+
this._scrollTimer.startScroll((viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.left) ?? 0, (viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.top) ?? 0, viewportMain);
|
|
681
679
|
const scene = this._scene;
|
|
682
680
|
const startViewport = scene.getActiveViewportByCoord(Vector2.FromArray([moveStartPosX, moveStartPosY]));
|
|
683
681
|
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt) => {
|
|
684
|
-
var _scene$getActiveViewp;
|
|
685
682
|
if (moveEvt.buttons === 0) {
|
|
686
683
|
this.endSelection();
|
|
687
684
|
return;
|
|
@@ -694,7 +691,7 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
694
691
|
const currentSelection = this.getActiveSelectionControl();
|
|
695
692
|
const freeze = this._getFreeze();
|
|
696
693
|
const selection = currentSelection === null || currentSelection === void 0 ? void 0 : currentSelection.model;
|
|
697
|
-
const endViewport =
|
|
694
|
+
const endViewport = scene.getActiveViewportByCoord(Vector2.FromArray([moveOffsetX, moveOffsetY])) ?? this._getViewportByCell(selection === null || selection === void 0 ? void 0 : selection.endRow, selection === null || selection === void 0 ? void 0 : selection.endColumn);
|
|
698
695
|
const isCrossableViewports = () => {
|
|
699
696
|
if (!startViewport || !endViewport || !viewportMain) return false;
|
|
700
697
|
const crossableViewports = [
|
|
@@ -714,15 +711,12 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
714
711
|
const startKey = startViewport.viewportKey;
|
|
715
712
|
const endKey = endViewport.viewportKey;
|
|
716
713
|
if (startKey === SHEET_VIEWPORT_KEY.VIEW_ROW_TOP) {
|
|
717
|
-
|
|
718
|
-
if (moveOffsetY < viewportMain.top && ((_selection$endRow = selection === null || selection === void 0 ? void 0 : selection.endRow) !== null && _selection$endRow !== void 0 ? _selection$endRow : 0) < ((_freeze$startRow = freeze === null || freeze === void 0 ? void 0 : freeze.startRow) !== null && _freeze$startRow !== void 0 ? _freeze$startRow : 0)) scrollOffsetY = viewportMain.top;
|
|
714
|
+
if (moveOffsetY < viewportMain.top && ((selection === null || selection === void 0 ? void 0 : selection.endRow) ?? 0) < ((freeze === null || freeze === void 0 ? void 0 : freeze.startRow) ?? 0)) scrollOffsetY = viewportMain.top;
|
|
719
715
|
else if (isCrossingY && yCrossTime % 2 === 1) viewportMain.scrollToViewportPos({ viewportScrollY: 0 });
|
|
720
716
|
} else if (startKey === SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT) {
|
|
721
|
-
|
|
722
|
-
if (moveOffsetX < viewportMain.left && ((_selection$endColumn = selection === null || selection === void 0 ? void 0 : selection.endColumn) !== null && _selection$endColumn !== void 0 ? _selection$endColumn : 0) < ((_freeze$startColumn = freeze === null || freeze === void 0 ? void 0 : freeze.startColumn) !== null && _freeze$startColumn !== void 0 ? _freeze$startColumn : 0)) scrollOffsetX = viewportMain.left;
|
|
717
|
+
if (moveOffsetX < viewportMain.left && ((selection === null || selection === void 0 ? void 0 : selection.endColumn) ?? 0) < ((freeze === null || freeze === void 0 ? void 0 : freeze.startColumn) ?? 0)) scrollOffsetX = viewportMain.left;
|
|
723
718
|
else if (isCrossingX && xCrossTime % 2 === 1) viewportMain.scrollToViewportPos({ viewportScrollX: 0 });
|
|
724
719
|
} else if (startKey === endKey) {
|
|
725
|
-
var _selection$endRow2, _freeze$startRow2, _selection$endColumn2, _freeze$startColumn2;
|
|
726
720
|
let disableX = false;
|
|
727
721
|
let disableY = false;
|
|
728
722
|
if (startKey === SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP) {
|
|
@@ -730,8 +724,8 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
730
724
|
disableY = true;
|
|
731
725
|
} else if (startKey === SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP) disableY = true;
|
|
732
726
|
else if (startKey === SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT) disableX = true;
|
|
733
|
-
if (((
|
|
734
|
-
if (((
|
|
727
|
+
if (((selection === null || selection === void 0 ? void 0 : selection.endRow) ?? 0) > ((freeze === null || freeze === void 0 ? void 0 : freeze.startRow) ?? 0)) disableY = false;
|
|
728
|
+
if (((selection === null || selection === void 0 ? void 0 : selection.endColumn) ?? 0) > ((freeze === null || freeze === void 0 ? void 0 : freeze.startColumn) ?? 0)) disableX = false;
|
|
735
729
|
if (disableX) scrollOffsetX = viewportMain.left;
|
|
736
730
|
if (disableY) scrollOffsetY = viewportMain.top;
|
|
737
731
|
} else {
|
|
@@ -766,7 +760,7 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
766
760
|
}
|
|
767
761
|
getCellWithCoordByOffset(x, y, skeletonParam) {
|
|
768
762
|
const scene = this._scene;
|
|
769
|
-
const skeleton = skeletonParam
|
|
763
|
+
const skeleton = skeletonParam ?? this._skeleton;
|
|
770
764
|
const scrollXY = scene.getViewportScrollXY(scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN));
|
|
771
765
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
772
766
|
return skeleton.getCellWithCoordByOffset(x - scrollXY.x, y - scrollXY.y, scaleX, scaleY, scrollXY);
|
|
@@ -775,20 +769,19 @@ var BaseSelectionRenderService = class extends Disposable {
|
|
|
775
769
|
* When mousedown and mouseup need to go to the coordination and undo stack, when mousemove does not need to go to the coordination and undo stack
|
|
776
770
|
*/
|
|
777
771
|
_movingHandler(offsetX, offsetY, activeSelectionControl, rangeType) {
|
|
778
|
-
var _activeSelectionContr, _activeSelectionContr2, _activeSelectionContr3, _activeSelectionContr4, _this$_getViewportByC;
|
|
779
772
|
const skeleton = this._skeleton;
|
|
780
773
|
const scene = this._scene;
|
|
781
774
|
const [unitId, sheetId] = skeleton.getLocation();
|
|
782
775
|
const currSelectionRange = {
|
|
783
|
-
startRow: (
|
|
784
|
-
endRow: (
|
|
785
|
-
startColumn: (
|
|
786
|
-
endColumn: (
|
|
776
|
+
startRow: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.startRow) ?? -1,
|
|
777
|
+
endRow: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.endRow) ?? -1,
|
|
778
|
+
startColumn: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.startColumn) ?? -1,
|
|
779
|
+
endColumn: (activeSelectionControl === null || activeSelectionControl === void 0 ? void 0 : activeSelectionControl.model.endColumn) ?? -1,
|
|
787
780
|
unitId,
|
|
788
781
|
sheetId
|
|
789
782
|
};
|
|
790
783
|
const viewportMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
791
|
-
const targetViewport =
|
|
784
|
+
const targetViewport = this._getViewportByCell(currSelectionRange.endRow, currSelectionRange.endColumn) ?? viewportMain;
|
|
792
785
|
const scrollXY = scene.getScrollXYInfoByViewport(Vector2.FromArray([this._startViewportPosX, this._startViewportPosY]), targetViewport);
|
|
793
786
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
794
787
|
if (rangeType === RANGE_TYPE.ROW) offsetX = Number.POSITIVE_INFINITY;
|
|
@@ -1797,7 +1790,6 @@ const SELECTION_TITLE_HIGHLIGHT_ALPHA = .3;
|
|
|
1797
1790
|
*/
|
|
1798
1791
|
var SelectionControl = class extends Disposable {
|
|
1799
1792
|
constructor(_scene, _zIndex, _themeService, options) {
|
|
1800
|
-
var _options$enableAutoFi, _options$highlightHea, _options$rowHeaderWid, _options$columnHeader, _options$rowHeaderOff, _options$columnHeader2;
|
|
1801
1793
|
super();
|
|
1802
1794
|
this._scene = _scene;
|
|
1803
1795
|
this._zIndex = _zIndex;
|
|
@@ -1851,12 +1843,12 @@ var SelectionControl = class extends Disposable {
|
|
|
1851
1843
|
_defineProperty(this, "selectionFilled$", this._selectionFilled$.asObservable());
|
|
1852
1844
|
_defineProperty(this, "_antLineOffset", 0);
|
|
1853
1845
|
_defineProperty(this, "_antRequestNewFrame", -1);
|
|
1854
|
-
this._enableAutoFill = (
|
|
1855
|
-
this._highlightHeader = (
|
|
1856
|
-
this._rowHeaderWidth = (
|
|
1857
|
-
this._columnHeaderHeight = (
|
|
1858
|
-
this._rowHeaderOffsetX = (
|
|
1859
|
-
this._columnHeaderOffsetY = (
|
|
1846
|
+
this._enableAutoFill = (options === null || options === void 0 ? void 0 : options.enableAutoFill) ?? true;
|
|
1847
|
+
this._highlightHeader = (options === null || options === void 0 ? void 0 : options.highlightHeader) ?? true;
|
|
1848
|
+
this._rowHeaderWidth = (options === null || options === void 0 ? void 0 : options.rowHeaderWidth) ?? 0;
|
|
1849
|
+
this._columnHeaderHeight = (options === null || options === void 0 ? void 0 : options.columnHeaderHeight) ?? 0;
|
|
1850
|
+
this._rowHeaderOffsetX = (options === null || options === void 0 ? void 0 : options.rowHeaderOffsetX) ?? 0;
|
|
1851
|
+
this._columnHeaderOffsetY = (options === null || options === void 0 ? void 0 : options.columnHeaderOffsetY) ?? 0;
|
|
1860
1852
|
this._initializeSheetBody();
|
|
1861
1853
|
this._initialHeader();
|
|
1862
1854
|
}
|
|
@@ -2750,7 +2742,7 @@ const copyContentCache = new CopyContentCache();
|
|
|
2750
2742
|
//#endregion
|
|
2751
2743
|
//#region src/services/clipboard/html-to-usm/parse-node-style.ts
|
|
2752
2744
|
function extractNodeStyle(node, predefinedStyles) {
|
|
2753
|
-
const styles = predefinedStyles
|
|
2745
|
+
const styles = predefinedStyles ?? node.style;
|
|
2754
2746
|
const docStyles = {};
|
|
2755
2747
|
const tagName = node.tagName.toLowerCase();
|
|
2756
2748
|
switch (tagName) {
|
|
@@ -2894,9 +2886,8 @@ function generateParagraphs(dataStream, prevParagraph) {
|
|
|
2894
2886
|
return paragraphs;
|
|
2895
2887
|
}
|
|
2896
2888
|
function convertToCellStyle(cell, dataStream, textRuns) {
|
|
2897
|
-
var _textRuns$length;
|
|
2898
2889
|
const dataStreamLength = dataStream.length;
|
|
2899
|
-
const canConvertToCellStyle = ((
|
|
2890
|
+
const canConvertToCellStyle = ((textRuns === null || textRuns === void 0 ? void 0 : textRuns.length) ?? 0) === 1 && textRuns[0].st === 0 && textRuns[0].ed === dataStreamLength;
|
|
2900
2891
|
if (cell.p) {
|
|
2901
2892
|
var _cell$p$body;
|
|
2902
2893
|
if (canConvertToCellStyle && ((_cell$p$body = cell.p.body) === null || _cell$p$body === void 0 || (_cell$p$body = _cell$p$body.textRuns) === null || _cell$p$body === void 0 ? void 0 : _cell$p$body.length)) {
|
|
@@ -2968,8 +2959,7 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
2968
2959
|
this._dom = parseToDom(html);
|
|
2969
2960
|
const style = this._dom.querySelector("style");
|
|
2970
2961
|
if (style) {
|
|
2971
|
-
|
|
2972
|
-
this._parseMsoNumfmtFromCssText((_style$textContent = style.textContent) !== null && _style$textContent !== void 0 ? _style$textContent : "");
|
|
2962
|
+
this._parseMsoNumfmtFromCssText(style.textContent ?? "");
|
|
2973
2963
|
const shadowHost = document.createElement("div");
|
|
2974
2964
|
const shadowRoot = shadowHost.attachShadow({ mode: "open" });
|
|
2975
2965
|
document.body.appendChild(shadowHost);
|
|
@@ -3164,9 +3154,9 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3164
3154
|
return style;
|
|
3165
3155
|
}
|
|
3166
3156
|
_parseTable(html, tableElIndex) {
|
|
3167
|
-
var
|
|
3157
|
+
var _this$_getCurrentSkel;
|
|
3168
3158
|
const valueMatrix = new ObjectMatrix();
|
|
3169
|
-
const colProperties =
|
|
3159
|
+
const colProperties = parseColGroup(html) ?? [];
|
|
3170
3160
|
const { rowProperties = [] } = parseTableRows(html);
|
|
3171
3161
|
const parsedCellMatrix = this._parseTableByHtml(this._dom, tableElIndex, (_this$_getCurrentSkel = this._getCurrentSkeleton()) === null || _this$_getCurrentSkel === void 0 ? void 0 : _this$_getCurrentSkel.skeleton);
|
|
3172
3162
|
parsedCellMatrix && parsedCellMatrix.forValue((row, col, value) => {
|
|
@@ -3259,8 +3249,7 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3259
3249
|
let numfmtPattern;
|
|
3260
3250
|
const pattern = this._getMsoNumfmtForNode(cell);
|
|
3261
3251
|
if (!isDefaultFormat(pattern)) {
|
|
3262
|
-
|
|
3263
|
-
cellText = cell.childElementCount === 0 ? normalizePlainCellText((_cell$textContent = cell.textContent) !== null && _cell$textContent !== void 0 ? _cell$textContent : "") : cell.innerHTML;
|
|
3252
|
+
cellText = cell.childElementCount === 0 ? normalizePlainCellText(cell.textContent ?? "") : cell.innerHTML;
|
|
3264
3253
|
if (cellText.includes("mso-spacerun:yes")) cellText = cleanMsoSpaceRun(cellText);
|
|
3265
3254
|
const parseData = getNumfmtParseValueFilter(cellText);
|
|
3266
3255
|
if (typeof (parseData === null || parseData === void 0 ? void 0 : parseData.v) === "number" && (parseData.z === pattern || numfmt.format(pattern, parseData.v) === cellText)) {
|
|
@@ -3345,13 +3334,10 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3345
3334
|
}
|
|
3346
3335
|
}
|
|
3347
3336
|
_getCellTextAndRichText(cell, styleStr, skeleton) {
|
|
3348
|
-
if (cell.childElementCount === 0) {
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
cellRichStyle: void 0
|
|
3353
|
-
};
|
|
3354
|
-
}
|
|
3337
|
+
if (cell.childElementCount === 0) return {
|
|
3338
|
+
cellText: normalizePlainCellText(cell.textContent ?? ""),
|
|
3339
|
+
cellRichStyle: void 0
|
|
3340
|
+
};
|
|
3355
3341
|
const cellHtml = cell.innerHTML;
|
|
3356
3342
|
/**
|
|
3357
3343
|
* mso-spacerun:yes is used to force spaces in html copied from excel.
|
|
@@ -3466,14 +3452,13 @@ var HtmlToUSMService = class HtmlToUSMService {
|
|
|
3466
3452
|
const body = doc.body;
|
|
3467
3453
|
const element = node;
|
|
3468
3454
|
if (element.tagName.toUpperCase() === "A") {
|
|
3469
|
-
var _body$customRanges, _element$dataset$rang;
|
|
3470
3455
|
const href = element.href;
|
|
3471
3456
|
if (!isSafeUrl(href)) return;
|
|
3472
|
-
body.customRanges =
|
|
3457
|
+
body.customRanges = body.customRanges ?? [];
|
|
3473
3458
|
body.customRanges.push({
|
|
3474
3459
|
startIndex: start,
|
|
3475
3460
|
endIndex: body.dataStream.length - 1,
|
|
3476
|
-
rangeId:
|
|
3461
|
+
rangeId: element.dataset.rangeid ?? generateRandomId(),
|
|
3477
3462
|
rangeType: CustomRangeType.HYPERLINK,
|
|
3478
3463
|
properties: { url: href }
|
|
3479
3464
|
});
|
|
@@ -4162,7 +4147,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4162
4147
|
return this._pasteInternal(copyId, pasteType);
|
|
4163
4148
|
}
|
|
4164
4149
|
async legacyPaste(html, text, files, formulaClipboardPayload) {
|
|
4165
|
-
const isFromExcel = htmlIsFromExcel(html
|
|
4150
|
+
const isFromExcel = htmlIsFromExcel(html ?? "");
|
|
4166
4151
|
if (files && !isFromExcel) return this._pasteFiles(files, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
|
|
4167
4152
|
else if (html) return this._pasteHTML(html, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE, formulaClipboardPayload);
|
|
4168
4153
|
else if (text) if (/[\n\t]/.test(text)) return this._pasteHTML(convertTextToTable(text), PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
|
|
@@ -5597,15 +5582,13 @@ function checkIfShrink(selection, direction, worksheet) {
|
|
|
5597
5582
|
switch (direction) {
|
|
5598
5583
|
case Direction.UP:
|
|
5599
5584
|
case Direction.DOWN:
|
|
5600
|
-
|
|
5601
|
-
startRange.
|
|
5602
|
-
startRange.endRow = (_primary$endRow = primary === null || primary === void 0 ? void 0 : primary.endRow) !== null && _primary$endRow !== void 0 ? _primary$endRow : range.startRow;
|
|
5585
|
+
startRange.startRow = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
5586
|
+
startRange.endRow = (primary === null || primary === void 0 ? void 0 : primary.endRow) ?? range.startRow;
|
|
5603
5587
|
break;
|
|
5604
5588
|
case Direction.LEFT:
|
|
5605
5589
|
case Direction.RIGHT:
|
|
5606
|
-
|
|
5607
|
-
startRange.
|
|
5608
|
-
startRange.endColumn = (_primary$endColumn = primary === null || primary === void 0 ? void 0 : primary.endColumn) !== null && _primary$endColumn !== void 0 ? _primary$endColumn : range.startColumn;
|
|
5590
|
+
startRange.startColumn = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
5591
|
+
startRange.endColumn = (primary === null || primary === void 0 ? void 0 : primary.endColumn) ?? range.startColumn;
|
|
5609
5592
|
break;
|
|
5610
5593
|
}
|
|
5611
5594
|
const anchorRange = getEdgeOfRange(startRange, direction, worksheet);
|
|
@@ -5730,10 +5713,10 @@ const HideColConfirmCommand = {
|
|
|
5730
5713
|
//#endregion
|
|
5731
5714
|
//#region src/menu/utils.ts
|
|
5732
5715
|
function getFontStyleAtCursor(accessor) {
|
|
5733
|
-
var
|
|
5716
|
+
var _editorDataModel$getB;
|
|
5734
5717
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
5735
5718
|
const textSelectionService = accessor.get(DocSelectionManagerService);
|
|
5736
|
-
const editorUnitId =
|
|
5719
|
+
const editorUnitId = accessor.get(IEditorService).getFocusId() ?? DOCS_NORMAL_EDITOR_UNIT_ID_KEY;
|
|
5737
5720
|
const editorDataModel = univerInstanceService.getUnit(editorUnitId, UniverInstanceType.UNIVER_DOC);
|
|
5738
5721
|
const activeTextRange = textSelectionService.getActiveTextRange();
|
|
5739
5722
|
if (editorDataModel == null || activeTextRange == null) return null;
|
|
@@ -5830,15 +5813,14 @@ const SetRangeFontIncreaseCommand = {
|
|
|
5830
5813
|
if (isCellEditorFocus) {
|
|
5831
5814
|
const textRun = getFontStyleAtCursor(accessor);
|
|
5832
5815
|
if (textRun != null) {
|
|
5833
|
-
var _textRun$ts
|
|
5834
|
-
const value = (
|
|
5816
|
+
var _textRun$ts;
|
|
5817
|
+
const value = ((_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.fs) ?? defaultValue;
|
|
5835
5818
|
params.value = value >= 400 ? 400 : value + 1;
|
|
5836
5819
|
}
|
|
5837
5820
|
return commandService.executeCommand(SetInlineFormatFontSizeCommand.id, params);
|
|
5838
5821
|
}
|
|
5839
5822
|
if (primary != null) {
|
|
5840
|
-
|
|
5841
|
-
const value = (_style$fs = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs) !== null && _style$fs !== void 0 ? _style$fs : defaultValue;
|
|
5823
|
+
const value = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs ?? defaultValue;
|
|
5842
5824
|
params.value = value >= 400 ? 400 : value + 1;
|
|
5843
5825
|
return commandService.executeCommand(SetFontSizeCommand.id, params);
|
|
5844
5826
|
}
|
|
@@ -5861,15 +5843,14 @@ const SetRangeFontDecreaseCommand = {
|
|
|
5861
5843
|
if (isCellEditorFocus) {
|
|
5862
5844
|
const textRun = getFontStyleAtCursor(accessor);
|
|
5863
5845
|
if (textRun != null) {
|
|
5864
|
-
var _textRun$
|
|
5865
|
-
const value = (
|
|
5846
|
+
var _textRun$ts2;
|
|
5847
|
+
const value = ((_textRun$ts2 = textRun.ts) === null || _textRun$ts2 === void 0 ? void 0 : _textRun$ts2.fs) ?? defaultValue;
|
|
5866
5848
|
params.value = value <= 6 ? 6 : value - 1;
|
|
5867
5849
|
}
|
|
5868
5850
|
return commandService.executeCommand(SetInlineFormatFontSizeCommand.id, params);
|
|
5869
5851
|
}
|
|
5870
5852
|
if (primary != null) {
|
|
5871
|
-
|
|
5872
|
-
const value = (_style$fs2 = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs) !== null && _style$fs2 !== void 0 ? _style$fs2 : defaultValue;
|
|
5853
|
+
const value = worksheet.getComposedCellStyle(primary.startRow, primary.startColumn).fs ?? defaultValue;
|
|
5873
5854
|
params.value = value <= 6 ? 6 : value - 1;
|
|
5874
5855
|
return commandService.executeCommand(SetFontSizeCommand.id, params);
|
|
5875
5856
|
}
|
|
@@ -6423,8 +6404,8 @@ let FormatPainterService = class FormatPainterService extends Disposable {
|
|
|
6423
6404
|
};
|
|
6424
6405
|
}
|
|
6425
6406
|
addHook(hook) {
|
|
6426
|
-
var
|
|
6427
|
-
if (hook.isDefaultHook && (
|
|
6407
|
+
var _this$_defaultHook;
|
|
6408
|
+
if (hook.isDefaultHook && (hook.priority ?? 0) > (((_this$_defaultHook = this._defaultHook) === null || _this$_defaultHook === void 0 ? void 0 : _this$_defaultHook.priority) ?? -1)) this._defaultHook = hook;
|
|
6428
6409
|
else {
|
|
6429
6410
|
this._extendHooks.push(hook);
|
|
6430
6411
|
this._extendHooks.sort((a, b) => (a.priority || 0) - (b.priority || 0));
|
|
@@ -6571,7 +6552,7 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6571
6552
|
this._rawScrollInfo$.complete();
|
|
6572
6553
|
}
|
|
6573
6554
|
calcViewportScrollFromRowColOffset(scrollInfo) {
|
|
6574
|
-
var _skeleton$getCellWith
|
|
6555
|
+
var _skeleton$getCellWith;
|
|
6575
6556
|
if (!scrollInfo) return {
|
|
6576
6557
|
viewportScrollX: 0,
|
|
6577
6558
|
viewportScrollY: 0
|
|
@@ -6580,7 +6561,7 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6580
6561
|
sheetViewStartRow = sheetViewStartRow || 0;
|
|
6581
6562
|
offsetY = offsetY || 0;
|
|
6582
6563
|
const skeleton = this._sheetSkeletonManagerService.getCurrentSkeleton();
|
|
6583
|
-
const { startX: colStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.columnWidthAccumulation[sheetViewStartColumn - 1]) || 0, startY: rowStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.rowHeightAccumulation[sheetViewStartRow - 1]) || 0 } = (
|
|
6564
|
+
const { startX: colStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.columnWidthAccumulation[sheetViewStartColumn - 1]) || 0, startY: rowStart = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.rowHeightAccumulation[sheetViewStartRow - 1]) || 0 } = (skeleton === null || skeleton === void 0 || (_skeleton$getCellWith = skeleton.getCellWithCoordByIndex) === null || _skeleton$getCellWith === void 0 ? void 0 : _skeleton$getCellWith.call(skeleton, sheetViewStartRow, sheetViewStartColumn, false)) ?? {};
|
|
6584
6565
|
return {
|
|
6585
6566
|
viewportScrollX: colStart + offsetX,
|
|
6586
6567
|
viewportScrollY: rowStart + offsetY
|
|
@@ -6661,10 +6642,10 @@ let SheetScrollManagerService = class SheetScrollManagerService {
|
|
|
6661
6642
|
return ((_this$_scrollStateMap = this._scrollStateMap.get(unitId)) === null || _this$_scrollStateMap === void 0 ? void 0 : _this$_scrollStateMap.get(sheetId)) || this._getDefaultScrollState(param);
|
|
6662
6643
|
}
|
|
6663
6644
|
_getDefaultScrollState(param) {
|
|
6664
|
-
var _this$_sheetSkeletonM, _this$_sheetSkeletonM2, _this$_sheetSkeletonM3, _this$_sheetSkeletonM4
|
|
6665
|
-
const skeleton = (_this$_sheetSkeletonM = (_this$_sheetSkeletonM2 =
|
|
6666
|
-
const colGapSize = (
|
|
6667
|
-
const rowGapSize = (
|
|
6645
|
+
var _this$_sheetSkeletonM, _this$_sheetSkeletonM2, _this$_sheetSkeletonM3, _this$_sheetSkeletonM4;
|
|
6646
|
+
const skeleton = ((_this$_sheetSkeletonM = (_this$_sheetSkeletonM2 = this._sheetSkeletonManagerService).getSkeleton) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.call(_this$_sheetSkeletonM2, param.sheetId)) ?? ((_this$_sheetSkeletonM3 = (_this$_sheetSkeletonM4 = this._sheetSkeletonManagerService).getCurrentSkeleton) === null || _this$_sheetSkeletonM3 === void 0 ? void 0 : _this$_sheetSkeletonM3.call(_this$_sheetSkeletonM4));
|
|
6647
|
+
const colGapSize = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.getColGapSize(0)) ?? 0;
|
|
6648
|
+
const rowGapSize = (skeleton === null || skeleton === void 0 ? void 0 : skeleton.getRowGapSize(0)) ?? 0;
|
|
6668
6649
|
return {
|
|
6669
6650
|
sheetViewStartRow: 0,
|
|
6670
6651
|
sheetViewStartColumn: 0,
|
|
@@ -6709,11 +6690,10 @@ const SetSelectionFrozenCommand = {
|
|
|
6709
6690
|
startColumn = sheetViewStartColumn + 1;
|
|
6710
6691
|
freezedColCount = 1;
|
|
6711
6692
|
} else {
|
|
6712
|
-
var _primary$startRow, _primary$startColumn;
|
|
6713
6693
|
const { primary, range } = selections[(selections === null || selections === void 0 ? void 0 : selections.length) - 1];
|
|
6714
|
-
let selectRow = (
|
|
6694
|
+
let selectRow = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
6715
6695
|
if (selectRow === 0) selectRow = 1;
|
|
6716
|
-
let selectColumn = (
|
|
6696
|
+
let selectColumn = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
6717
6697
|
if (selectColumn === 0) selectColumn = 1;
|
|
6718
6698
|
const rangeType = range.rangeType;
|
|
6719
6699
|
if (rangeType === RANGE_TYPE.ROW || type === 1) {
|
|
@@ -7534,12 +7514,11 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7534
7514
|
this._scrollToCell(row, column);
|
|
7535
7515
|
}
|
|
7536
7516
|
_scrollToSelection(targetIsActualRowAndColumn = true) {
|
|
7537
|
-
var _selection$primary;
|
|
7538
7517
|
const selection = this._getSelectionsService().getCurrentLastSelection();
|
|
7539
7518
|
if (!selection) return;
|
|
7540
|
-
const { startRow, startColumn, actualRow, actualColumn } =
|
|
7541
|
-
const selectionStartRow = targetIsActualRowAndColumn ? actualRow
|
|
7542
|
-
const selectionStartColumn = targetIsActualRowAndColumn ? actualColumn
|
|
7519
|
+
const { startRow, startColumn, actualRow, actualColumn } = selection.primary ?? selection.range;
|
|
7520
|
+
const selectionStartRow = targetIsActualRowAndColumn ? actualRow ?? startRow : startRow;
|
|
7521
|
+
const selectionStartColumn = targetIsActualRowAndColumn ? actualColumn ?? startColumn : startColumn;
|
|
7543
7522
|
this._scrollToCell(selectionStartRow, selectionStartColumn);
|
|
7544
7523
|
}
|
|
7545
7524
|
_getSelectionsService() {
|
|
@@ -7557,14 +7536,14 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7557
7536
|
return skeleton.getRangeByViewBound(vpInfo.viewBound);
|
|
7558
7537
|
}
|
|
7559
7538
|
_scrollToCell(row, column, forceTop = false, forceLeft = false) {
|
|
7560
|
-
var _this$
|
|
7561
|
-
const { rowHeightAccumulation, columnWidthAccumulation } =
|
|
7539
|
+
var _this$_getSheetObject2, _this$_sheetSkeletonM6;
|
|
7540
|
+
const { rowHeightAccumulation, columnWidthAccumulation } = this._sheetSkeletonManagerService.getCurrentSkeleton() ?? {};
|
|
7562
7541
|
if (rowHeightAccumulation == null || columnWidthAccumulation == null) return false;
|
|
7563
7542
|
const scene = (_this$_getSheetObject2 = this._getSheetObject()) === null || _this$_getSheetObject2 === void 0 ? void 0 : _this$_getSheetObject2.scene;
|
|
7564
7543
|
if (scene == null) return false;
|
|
7565
7544
|
const viewport = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7566
7545
|
if (viewport == null) return false;
|
|
7567
|
-
const skeleton = (_this$
|
|
7546
|
+
const skeleton = (_this$_sheetSkeletonM6 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM6 === void 0 ? void 0 : _this$_sheetSkeletonM6.skeleton;
|
|
7568
7547
|
if (skeleton == null) return false;
|
|
7569
7548
|
const worksheet = this._context.unit.getActiveSheet();
|
|
7570
7549
|
if (!worksheet) return false;
|
|
@@ -7728,10 +7707,10 @@ const ScrollCommand = {
|
|
|
7728
7707
|
return accessor.get(ICommandService).syncExecuteCommand(SetScrollOperation.id, {
|
|
7729
7708
|
unitId: workbook.getUnitId(),
|
|
7730
7709
|
sheetId: worksheet.getSheetId(),
|
|
7731
|
-
sheetViewStartRow: sheetViewStartRow
|
|
7732
|
-
sheetViewStartColumn: sheetViewStartColumn
|
|
7733
|
-
offsetX: offsetX
|
|
7734
|
-
offsetY: offsetY
|
|
7710
|
+
sheetViewStartRow: sheetViewStartRow ?? currentRow ?? 0 + ySplit,
|
|
7711
|
+
sheetViewStartColumn: sheetViewStartColumn ?? currentColumn ?? 0 + xSplit,
|
|
7712
|
+
offsetX: offsetX ?? currentOffsetX,
|
|
7713
|
+
offsetY: offsetY ?? currentOffsetY,
|
|
7735
7714
|
duration
|
|
7736
7715
|
});
|
|
7737
7716
|
}
|
|
@@ -8279,8 +8258,7 @@ let EditorBridgeService = class EditorBridgeService extends Disposable {
|
|
|
8279
8258
|
};
|
|
8280
8259
|
}
|
|
8281
8260
|
_getWorkbookForEditUnit(unitId) {
|
|
8282
|
-
|
|
8283
|
-
return (_this$_univerInstance = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) !== null && _this$_univerInstance !== void 0 ? _this$_univerInstance : this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
8261
|
+
return this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET) ?? this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
8284
8262
|
}
|
|
8285
8263
|
getCurrentEditorId() {
|
|
8286
8264
|
return this._editorUnitId;
|
|
@@ -8611,7 +8589,7 @@ const SetCellEditVisibleOperation = {
|
|
|
8611
8589
|
if (!workbook) return false;
|
|
8612
8590
|
accessor.get(IEditorBridgeService).changeVisible({
|
|
8613
8591
|
...params,
|
|
8614
|
-
unitId: unitId
|
|
8592
|
+
unitId: unitId ?? workbook.getUnitId()
|
|
8615
8593
|
});
|
|
8616
8594
|
return true;
|
|
8617
8595
|
}
|
|
@@ -8657,11 +8635,11 @@ const ScrollToRangeOperation = {
|
|
|
8657
8635
|
id: "sheet.operation.scroll-to-range",
|
|
8658
8636
|
type: CommandType.OPERATION,
|
|
8659
8637
|
handler: (accessor, params) => {
|
|
8660
|
-
var
|
|
8638
|
+
var _instanceService$getC;
|
|
8661
8639
|
if (!params) return false;
|
|
8662
8640
|
const instanceService = accessor.get(IUniverInstanceService);
|
|
8663
8641
|
const renderManagerService = accessor.get(IRenderManagerService);
|
|
8664
|
-
const unitId =
|
|
8642
|
+
const unitId = params.unitId ?? ((_instanceService$getC = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) === null || _instanceService$getC === void 0 ? void 0 : _instanceService$getC.getUnitId());
|
|
8665
8643
|
if (!unitId) return false;
|
|
8666
8644
|
const renderUnit = renderManagerService.getRenderUnitById(unitId);
|
|
8667
8645
|
if (!renderUnit) return false;
|
|
@@ -8816,10 +8794,7 @@ let SheetsRenderService = class SheetsRenderService extends RxDisposable {
|
|
|
8816
8794
|
}
|
|
8817
8795
|
_initWorkbookListener() {
|
|
8818
8796
|
this._instanceSrv.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((event) => this._createRenderer(event.unit, event.options));
|
|
8819
|
-
this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).forEach((workbook) =>
|
|
8820
|
-
var _this$_instanceSrv$ge;
|
|
8821
|
-
return this._createRenderer(workbook, (_this$_instanceSrv$ge = this._instanceSrv.getUnitCreateOptions(workbook.getUnitId())) !== null && _this$_instanceSrv$ge !== void 0 ? _this$_instanceSrv$ge : void 0);
|
|
8822
|
-
});
|
|
8797
|
+
this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).forEach((workbook) => this._createRenderer(workbook, this._instanceSrv.getUnitCreateOptions(workbook.getUnitId()) ?? void 0));
|
|
8823
8798
|
this._instanceSrv.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_SHEET).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._disposeRenderer(workbook));
|
|
8824
8799
|
}
|
|
8825
8800
|
_createRenderer(workbook, createUnitOptions) {
|
|
@@ -9123,7 +9098,7 @@ let AutoHeightController = class AutoHeightController extends Disposable {
|
|
|
9123
9098
|
_initialize() {
|
|
9124
9099
|
this.disposeWithMe(this._sheetInterceptorService.interceptAutoHeight({ getMutations: (info) => {
|
|
9125
9100
|
const { unitId, subUnitId, ranges, autoHeightRanges, lazyAutoHeightRanges, cellHeights } = info;
|
|
9126
|
-
const undoRedoItem = this.getUndoRedoParamsOfAutoHeight(autoHeightRanges
|
|
9101
|
+
const undoRedoItem = this.getUndoRedoParamsOfAutoHeight(autoHeightRanges ?? ranges, subUnitId, cellHeights);
|
|
9127
9102
|
return this._processLazyAutoHeight(undoRedoItem, unitId, subUnitId, lazyAutoHeightRanges);
|
|
9128
9103
|
} }));
|
|
9129
9104
|
}
|
|
@@ -9650,10 +9625,9 @@ SheetRenderController = __decorate([
|
|
|
9650
9625
|
__decorateParam(5, Optional(ITelemetryService))
|
|
9651
9626
|
], SheetRenderController);
|
|
9652
9627
|
function getLeftTopPlaceholderSize(skeleton) {
|
|
9653
|
-
var _skeleton$rowHeaderWi, _skeleton$columnHeade;
|
|
9654
9628
|
return {
|
|
9655
|
-
width:
|
|
9656
|
-
height:
|
|
9629
|
+
width: skeleton.rowHeaderWidthAndMarginLeft ?? skeleton.rowHeaderWidth,
|
|
9630
|
+
height: skeleton.columnHeaderHeightAndMarginTop ?? skeleton.columnHeaderHeight
|
|
9657
9631
|
};
|
|
9658
9632
|
}
|
|
9659
9633
|
|
|
@@ -9932,29 +9906,22 @@ SheetLoadingRenderService = __decorate([
|
|
|
9932
9906
|
//#region src/views/hook.ts
|
|
9933
9907
|
const SheetLoadingWorkbookContext = createContext(null);
|
|
9934
9908
|
function useActiveWorkbook() {
|
|
9935
|
-
var _ref;
|
|
9936
9909
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
9937
9910
|
const loadingWorkbook = useContext(SheetLoadingWorkbookContext);
|
|
9938
9911
|
const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
|
|
9939
|
-
return
|
|
9912
|
+
return loadingWorkbook ?? workbook ?? null;
|
|
9940
9913
|
}
|
|
9941
9914
|
function useSheetLoadingWorkbook() {
|
|
9942
|
-
|
|
9943
|
-
return (_useObservable = useObservable(useDependency(ISheetLoadingRenderService).workbook$)) !== null && _useObservable !== void 0 ? _useObservable : null;
|
|
9915
|
+
return useObservable(useDependency(ISheetLoadingRenderService).workbook$) ?? null;
|
|
9944
9916
|
}
|
|
9945
9917
|
function useSheetLoading() {
|
|
9946
|
-
|
|
9947
|
-
return (_useObservable2 = useObservable(useDependency(ISheetLoadingRenderService).loading$)) !== null && _useObservable2 !== void 0 ? _useObservable2 : false;
|
|
9918
|
+
return useObservable(useDependency(ISheetLoadingRenderService).loading$) ?? false;
|
|
9948
9919
|
}
|
|
9949
9920
|
function useSheetLoadingPreviewReady() {
|
|
9950
|
-
|
|
9951
|
-
return (_useObservable3 = useObservable(useDependency(ISheetLoadingRenderService).previewReady$)) !== null && _useObservable3 !== void 0 ? _useObservable3 : false;
|
|
9921
|
+
return useObservable(useDependency(ISheetLoadingRenderService).previewReady$) ?? false;
|
|
9952
9922
|
}
|
|
9953
9923
|
function useActiveWorksheet(workbook) {
|
|
9954
|
-
return useObservable(() =>
|
|
9955
|
-
var _workbook$activeSheet;
|
|
9956
|
-
return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : of(null);
|
|
9957
|
-
}, void 0, void 0, [workbook]);
|
|
9924
|
+
return useObservable(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? of(null), void 0, void 0, [workbook]);
|
|
9958
9925
|
}
|
|
9959
9926
|
function useWorkbooks() {
|
|
9960
9927
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
@@ -9993,7 +9960,7 @@ const SheetPasteOptions = [
|
|
|
9993
9960
|
}
|
|
9994
9961
|
];
|
|
9995
9962
|
const useMenuPosition = (range) => {
|
|
9996
|
-
var _scene$getEngine
|
|
9963
|
+
var _scene$getEngine;
|
|
9997
9964
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
9998
9965
|
const renderManagerService = useDependency(IRenderManagerService);
|
|
9999
9966
|
const workbook = useActiveWorkbook();
|
|
@@ -10019,10 +9986,10 @@ const useMenuPosition = (range) => {
|
|
|
10019
9986
|
const canvas = (_scene$getEngine = scene.getEngine()) === null || _scene$getEngine === void 0 ? void 0 : _scene$getEngine.getCanvas();
|
|
10020
9987
|
if (!scaleX || !scene || !scaleX || !scaleY || !scrollXY) return null;
|
|
10021
9988
|
const endPosition = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getNoMergeCellWithCoordByIndex(anchor.endRow, anchor.endCol);
|
|
10022
|
-
const endX = (
|
|
10023
|
-
const endY = (
|
|
10024
|
-
const positionEndX =
|
|
10025
|
-
const positionEndY =
|
|
9989
|
+
const endX = (endPosition === null || endPosition === void 0 ? void 0 : endPosition.endX) ?? 0;
|
|
9990
|
+
const endY = (endPosition === null || endPosition === void 0 ? void 0 : endPosition.endY) ?? 0;
|
|
9991
|
+
const positionEndX = convertTransformToOffsetX(endX, scaleX, scrollXY) ?? -9999;
|
|
9992
|
+
const positionEndY = convertTransformToOffsetY(endY, scaleY, scrollXY) ?? -9999;
|
|
10026
9993
|
const canvasWidth = canvas === null || canvas === void 0 ? void 0 : canvas.getWidth();
|
|
10027
9994
|
const canvasHeight = canvas === null || canvas === void 0 ? void 0 : canvas.getHeight();
|
|
10028
9995
|
if (!canvasWidth || !canvasHeight) return null;
|
|
@@ -10178,16 +10145,16 @@ const ISheetEmbedInteractionBoundaryService = createIdentifier("sheets-ui.embed-
|
|
|
10178
10145
|
const ISheetEmbedRuntimeFocusCoordinator = createIdentifier("sheets-ui.embed-runtime-focus-coordinator");
|
|
10179
10146
|
const ISheetEmbedFloatingGeometryService = createIdentifier("sheets-ui.embed-floating-geometry.service");
|
|
10180
10147
|
function resolveSheetEmbedRuntimeDomScope(element) {
|
|
10181
|
-
var _element$closest
|
|
10148
|
+
var _element$closest;
|
|
10182
10149
|
if (!element) return;
|
|
10183
|
-
const embedId = (
|
|
10150
|
+
const embedId = ((_element$closest = element.closest(`[${"data-embed-interaction-boundary-owner"}]`)) === null || _element$closest === void 0 ? void 0 : _element$closest.getAttribute("data-embed-interaction-boundary-owner")) ?? void 0;
|
|
10184
10151
|
const container = resolveSheetEmbedFloatDomContainer(element, embedId);
|
|
10185
|
-
const resolvedEmbedId = (
|
|
10152
|
+
const resolvedEmbedId = (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-id")) ?? embedId;
|
|
10186
10153
|
if (!resolvedEmbedId) return;
|
|
10187
10154
|
return {
|
|
10188
10155
|
embedId: resolvedEmbedId,
|
|
10189
|
-
hostUnitId: (
|
|
10190
|
-
childUnitId: (
|
|
10156
|
+
hostUnitId: (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-host-unit-id")) ?? void 0,
|
|
10157
|
+
childUnitId: (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-child-unit-id")) ?? void 0,
|
|
10191
10158
|
childType: readChildType(container)
|
|
10192
10159
|
};
|
|
10193
10160
|
}
|
|
@@ -10197,12 +10164,11 @@ function resolveActiveSheetEmbedRuntimeDomScope(ownerDocument = document) {
|
|
|
10197
10164
|
return resolveSheetEmbedRuntimeDomScope(activeContainer);
|
|
10198
10165
|
}
|
|
10199
10166
|
function resolveSheetEmbedFloatDomContainer(element, embedId) {
|
|
10200
|
-
var _element$ownerDocumen, _ownerDocument$queryS;
|
|
10201
10167
|
const ownContainer = element === null || element === void 0 ? void 0 : element.closest(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"]`);
|
|
10202
10168
|
if (ownContainer && (!embedId || ownContainer.getAttribute("data-embed-id") === embedId)) return ownContainer;
|
|
10203
|
-
const ownerDocument = (
|
|
10204
|
-
if (!ownerDocument || !embedId) return ownContainer
|
|
10205
|
-
return
|
|
10169
|
+
const ownerDocument = (element === null || element === void 0 ? void 0 : element.ownerDocument) ?? (typeof document === "undefined" ? void 0 : document);
|
|
10170
|
+
if (!ownerDocument || !embedId) return ownContainer ?? void 0;
|
|
10171
|
+
return ownerDocument.querySelector(`[${"data-embed-float-dom"}="true"][${"data-embed-id"}="${escapeAttributeValue(embedId)}"]`) ?? void 0;
|
|
10206
10172
|
}
|
|
10207
10173
|
function escapeAttributeValue(value) {
|
|
10208
10174
|
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
@@ -10232,15 +10198,14 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10232
10198
|
return getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
|
|
10233
10199
|
}
|
|
10234
10200
|
get _editingUnitId() {
|
|
10235
|
-
var _this$_editorBridgeSe
|
|
10236
|
-
return (_this$_editorBridgeSe =
|
|
10201
|
+
var _this$_editorBridgeSe;
|
|
10202
|
+
return ((_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.unitId) ?? "";
|
|
10237
10203
|
}
|
|
10238
10204
|
get _editingRenderer() {
|
|
10239
10205
|
return this._renderManagerService.getRenderUnitById(this._editingUnitId);
|
|
10240
10206
|
}
|
|
10241
10207
|
get _renderer() {
|
|
10242
|
-
|
|
10243
|
-
return (_this$_editingRendere = this._editingRenderer) !== null && _this$_editingRendere !== void 0 ? _this$_editingRendere : this._currentRenderer;
|
|
10208
|
+
return this._editingRenderer ?? this._currentRenderer;
|
|
10244
10209
|
}
|
|
10245
10210
|
get _sheetSkeletonManagerService() {
|
|
10246
10211
|
var _this$_renderer;
|
|
@@ -10251,7 +10216,6 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10251
10216
|
return (_this$_renderer2 = this._renderer) === null || _this$_renderer2 === void 0 ? void 0 : _this$_renderer2.engine;
|
|
10252
10217
|
}
|
|
10253
10218
|
fitTextSize(callback) {
|
|
10254
|
-
var _paddingData$l, _paddingData$r, _paddingData$t, _paddingData$b;
|
|
10255
10219
|
const param = this._editorBridgeService.getEditCellState();
|
|
10256
10220
|
if (!param) return;
|
|
10257
10221
|
const { position, documentLayoutObject, canvasOffset, scaleX, scaleY } = param;
|
|
@@ -10265,8 +10229,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10265
10229
|
if (!info || info.actualWidth <= 0) return;
|
|
10266
10230
|
let { actualWidth, actualHeight } = info;
|
|
10267
10231
|
const { verticalAlign, horizontalAlign, paddingData, fill } = documentLayoutObject;
|
|
10268
|
-
actualWidth = actualWidth + (
|
|
10269
|
-
actualHeight = actualHeight + (
|
|
10232
|
+
actualWidth = actualWidth + (paddingData.l ?? 0) * scaleX + (paddingData.r ?? 0) * scaleX;
|
|
10233
|
+
actualHeight = actualHeight + (paddingData.t ?? 0) * scaleY + (paddingData.b ?? 0) * scaleY;
|
|
10270
10234
|
let editorWidth = endX - startX;
|
|
10271
10235
|
let editorHeight = endY - startY;
|
|
10272
10236
|
if (editorWidth < actualWidth) editorWidth = Math.ceil(actualWidth);
|
|
@@ -10332,8 +10296,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10332
10296
|
_getEditorMaxSize(position, canvasOffset, horizontalAlign) {
|
|
10333
10297
|
if (this._getEditorObject() == null) return;
|
|
10334
10298
|
function pxToNum(size) {
|
|
10335
|
-
|
|
10336
|
-
return Number.parseFloat((_size$replace = size === null || size === void 0 ? void 0 : size.replace("px", "")) !== null && _size$replace !== void 0 ? _size$replace : "");
|
|
10299
|
+
return Number.parseFloat((size === null || size === void 0 ? void 0 : size.replace("px", "")) ?? "");
|
|
10337
10300
|
}
|
|
10338
10301
|
const engine = this.engine;
|
|
10339
10302
|
if (!engine) return;
|
|
@@ -10434,8 +10397,8 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Di
|
|
|
10434
10397
|
});
|
|
10435
10398
|
}
|
|
10436
10399
|
_getEditorContentElement() {
|
|
10437
|
-
var _this$_embedFloatingG
|
|
10438
|
-
return (_this$_embedFloatingG =
|
|
10400
|
+
var _this$_embedFloatingG;
|
|
10401
|
+
return ((_this$_embedFloatingG = this._embedFloatingGeometryService) === null || _this$_embedFloatingG === void 0 || (_this$_embedFloatingG = _this$_embedFloatingG.getRegistrationByChildUnitId(this._editingUnitId)) === null || _this$_embedFloatingG === void 0 ? void 0 : _this$_embedFloatingG.contentRoot) ?? this._layoutService.getContentElement();
|
|
10439
10402
|
}
|
|
10440
10403
|
/**
|
|
10441
10404
|
* Since the document does not support cell background color, an additional rect needs to be added.
|
|
@@ -10682,10 +10645,9 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10682
10645
|
}));
|
|
10683
10646
|
}
|
|
10684
10647
|
_showEditorByKeyboard(config) {
|
|
10685
|
-
var _ref, _config$content;
|
|
10686
10648
|
const event = config === null || config === void 0 ? void 0 : config.event;
|
|
10687
10649
|
if (config == null || !event.data && event.inputType !== "InsertParagraph") return;
|
|
10688
|
-
const initialValue =
|
|
10650
|
+
const initialValue = config.content ?? event.data ?? "";
|
|
10689
10651
|
this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
10690
10652
|
visible: true,
|
|
10691
10653
|
eventType: DeviceInputEventType.Keyboard,
|
|
@@ -11492,8 +11454,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11492
11454
|
_initialCursorSync(d) {
|
|
11493
11455
|
d.add(this._cellEditorManagerService.focus$.pipe(filter((f) => !!f)).subscribe(() => {
|
|
11494
11456
|
var _this$_univerInstance, _this$_renderManagerS2;
|
|
11495
|
-
const
|
|
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();
|
|
11457
|
+
const docUnitId = (this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR) ? DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : this._editorBridgeService.getCurrentEditorId()) ?? ((_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId());
|
|
11497
11458
|
if (!docUnitId) return;
|
|
11498
11459
|
const docSelectionRenderManager = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(docUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
|
|
11499
11460
|
if (!docSelectionRenderManager) return;
|
|
@@ -11655,17 +11616,17 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11655
11616
|
subUnitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
11656
11617
|
});
|
|
11657
11618
|
};
|
|
11658
|
-
const
|
|
11659
|
-
this._submitEmptyCellImageEdit =
|
|
11660
|
-
if (
|
|
11619
|
+
const cellImage = isCellImage(documentDataModel.getSnapshot());
|
|
11620
|
+
this._submitEmptyCellImageEdit = cellImage && eventType === DeviceInputEventType.Keyboard && keycode === KeyCode.BACKSPACE;
|
|
11621
|
+
if (cellImage) clearAndEdit();
|
|
11661
11622
|
else if (eventType === DeviceInputEventType.Keyboard && keycode === KeyCode.F2) {
|
|
11662
|
-
var _documentDataModel$ge
|
|
11623
|
+
var _documentDataModel$ge;
|
|
11663
11624
|
document.makeDirty();
|
|
11664
11625
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11665
11626
|
startOffset: 0,
|
|
11666
11627
|
endOffset: 0
|
|
11667
11628
|
}]);
|
|
11668
|
-
const endOffset = ((_documentDataModel$ge =
|
|
11629
|
+
const endOffset = (((_documentDataModel$ge = documentDataModel.getBody()) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.dataStream.length) ?? 2) - 2;
|
|
11669
11630
|
this._textSelectionManagerService.replaceDocRanges([{
|
|
11670
11631
|
startOffset: endOffset,
|
|
11671
11632
|
endOffset
|
|
@@ -11696,7 +11657,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11696
11657
|
}
|
|
11697
11658
|
}
|
|
11698
11659
|
async _handleEditorInvisible(param) {
|
|
11699
|
-
var
|
|
11660
|
+
var _snapshot$body;
|
|
11700
11661
|
const editCellState = this._editorBridgeService.getEditCellState();
|
|
11701
11662
|
const documentDataModel = this._univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
11702
11663
|
const snapshot = Tools.deepClone(documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getSnapshot());
|
|
@@ -11704,7 +11665,7 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11704
11665
|
const shouldSubmitEmptyCellImageEdit = this._submitEmptyCellImageEdit;
|
|
11705
11666
|
this._submitEmptyCellImageEdit = false;
|
|
11706
11667
|
this._cursorChange = 0;
|
|
11707
|
-
const currentUnitId = (
|
|
11668
|
+
const currentUnitId = (editCellState === null || editCellState === void 0 ? void 0 : editCellState.unitId) ?? "";
|
|
11708
11669
|
this._exitInput(param);
|
|
11709
11670
|
if (editCellState == null) return;
|
|
11710
11671
|
const workbook = this._univerInstanceService.getUnit(currentUnitId, UniverInstanceType.UNIVER_SHEET);
|
|
@@ -11726,10 +11687,10 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11726
11687
|
return;
|
|
11727
11688
|
}
|
|
11728
11689
|
const isEmpty = (snapshot === null || snapshot === void 0 || (_snapshot$body = snapshot.body) === null || _snapshot$body === void 0 ? void 0 : _snapshot$body.dataStream.length) === 2;
|
|
11729
|
-
const
|
|
11690
|
+
const cellImage = editCellState.documentLayoutObject.documentModel ? isCellImage(editCellState.documentLayoutObject.documentModel.getSnapshot()) : false;
|
|
11730
11691
|
if (snapshot && shouldSubmitCellEdit({
|
|
11731
11692
|
isEmpty,
|
|
11732
|
-
isCellImage,
|
|
11693
|
+
isCellImage: cellImage,
|
|
11733
11694
|
shouldSubmitEmptyCellImageEdit
|
|
11734
11695
|
})) {
|
|
11735
11696
|
if (await this._submitEdit(snapshot, keycode === (MetaKeys.CTRL_COMMAND | KeyCode.ENTER) || keycode === (MetaKeys.MAC_CTRL | KeyCode.ENTER)) === false) return;
|
|
@@ -11739,10 +11700,6 @@ let EditingRenderController = class EditingRenderController extends Disposable {
|
|
|
11739
11700
|
_getEditorObject() {
|
|
11740
11701
|
return getEditorObject(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
|
|
11741
11702
|
}
|
|
11742
|
-
_isCellImageData(snapshot) {
|
|
11743
|
-
var _snapshot$drawingsOrd, _snapshot$drawingsOrd2;
|
|
11744
|
-
return ((_snapshot$drawingsOrd = (_snapshot$drawingsOrd2 = snapshot.drawingsOrder) === null || _snapshot$drawingsOrd2 === void 0 ? void 0 : _snapshot$drawingsOrd2.length) !== null && _snapshot$drawingsOrd !== void 0 ? _snapshot$drawingsOrd : 0) > 0;
|
|
11745
|
-
}
|
|
11746
11703
|
submitCellData(documentDataModel) {
|
|
11747
11704
|
return this._submitEdit(documentDataModel.getSnapshot());
|
|
11748
11705
|
}
|
|
@@ -11919,7 +11876,7 @@ EditingRenderController = __decorate([
|
|
|
11919
11876
|
__decorateParam(15, IConfigService)
|
|
11920
11877
|
], EditingRenderController);
|
|
11921
11878
|
function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService, functionService, styles) {
|
|
11922
|
-
var
|
|
11879
|
+
var _styles$get;
|
|
11923
11880
|
if ((snapshot === null || snapshot === void 0 ? void 0 : snapshot.body) == null) return null;
|
|
11924
11881
|
const { body } = snapshot;
|
|
11925
11882
|
cellData.t = void 0;
|
|
@@ -11927,7 +11884,7 @@ function getCellDataByInput(cellData, snapshot, lexerTreeBuilder, localeService,
|
|
|
11927
11884
|
let newDataStream = data.substring(data.length - 2, data.length) === DEFAULT_EMPTY_DOCUMENT_VALUE ? data.substring(0, data.length - 2) : data;
|
|
11928
11885
|
const currentLocale = localeService.getCurrentLocale();
|
|
11929
11886
|
newDataStream = normalizeString(newDataStream, lexerTreeBuilder, currentLocale, functionService);
|
|
11930
|
-
if ((
|
|
11887
|
+
if (isCellImage(snapshot)) {
|
|
11931
11888
|
cellData.v = "";
|
|
11932
11889
|
cellData.f = null;
|
|
11933
11890
|
cellData.si = null;
|
|
@@ -11983,10 +11940,9 @@ function isRichText(body) {
|
|
|
11983
11940
|
const bodyNoLineBreak = body.dataStream.replace(/(\r\n)+$/, "");
|
|
11984
11941
|
const richTextStyle = ["va"];
|
|
11985
11942
|
return textRuns.filter((ts) => ts.st < bodyNoLineBreak.length).some((textRun) => {
|
|
11986
|
-
var _textRun$ts;
|
|
11987
11943
|
return Boolean(textRun.ts && Object.keys(textRun.ts).some((property) => {
|
|
11988
11944
|
return richTextStyle.includes(property);
|
|
11989
|
-
})) || Object.keys(
|
|
11945
|
+
})) || Object.keys(textRun.ts ?? {}).length && textRun.ed - textRun.st < bodyNoLineBreak.length;
|
|
11990
11946
|
}) || paragraphs.some((paragraph) => paragraph.bullet) || paragraphs.length >= 2 || Boolean(customRanges === null || customRanges === void 0 ? void 0 : customRanges.length) || customBlocks.length > 0;
|
|
11991
11947
|
}
|
|
11992
11948
|
function shouldSubmitCellEdit({ isEmpty, isCellImage, shouldSubmitEmptyCellImageEdit }) {
|
|
@@ -12115,9 +12071,9 @@ function getSetCellDataMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12115
12071
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12116
12072
|
const cellValueMatrix = new ObjectMatrix();
|
|
12117
12073
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12118
|
-
var _value$
|
|
12074
|
+
var _value$p, _newStyle$n;
|
|
12119
12075
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12120
|
-
const newStyle = { ...
|
|
12076
|
+
const newStyle = { ...value.s ?? {} };
|
|
12121
12077
|
if (newStyle.bd && Object.keys(newStyle.bd).length === 0) newStyle.bd = {
|
|
12122
12078
|
t: null,
|
|
12123
12079
|
r: null,
|
|
@@ -12178,7 +12134,7 @@ function getSetCellValueMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12178
12134
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12179
12135
|
const cellValueMatrix = new ObjectMatrix();
|
|
12180
12136
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12181
|
-
var _value$p2, _value$
|
|
12137
|
+
var _value$p2, _value$s;
|
|
12182
12138
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12183
12139
|
let cellValue = {
|
|
12184
12140
|
p: null,
|
|
@@ -12189,7 +12145,7 @@ function getSetCellValueMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12189
12145
|
p: value.p,
|
|
12190
12146
|
v: value.v
|
|
12191
12147
|
};
|
|
12192
|
-
else if (value.v && !pasteFrom && !((_value$
|
|
12148
|
+
else if (value.v && !pasteFrom && !((_value$s = value.s) === null || _value$s === void 0 || (_value$s = _value$s.n) === null || _value$s === void 0 ? void 0 : _value$s.pattern)) {
|
|
12193
12149
|
/**
|
|
12194
12150
|
* The `pasteFrom` is null, means the data is pasted from outside.
|
|
12195
12151
|
* If the value's style has no number format, handle it as follows:
|
|
@@ -12231,9 +12187,9 @@ function getSetCellStyleMutations(pasteTo, pasteFrom, matrix, accessor) {
|
|
|
12231
12187
|
const { mapFunc } = virtualizeDiscreteRanges([range]);
|
|
12232
12188
|
const cellValueMatrix = new ObjectMatrix();
|
|
12233
12189
|
matrix.forValue((rowIndex, columnIndex, value) => {
|
|
12234
|
-
var
|
|
12190
|
+
var _newStyle$n2;
|
|
12235
12191
|
const { row, col } = mapFunc(rowIndex, columnIndex);
|
|
12236
|
-
const newStyle = { ...
|
|
12192
|
+
const newStyle = { ...value.s ?? {} };
|
|
12237
12193
|
if (newStyle.bd && Object.keys(newStyle.bd).length === 0) newStyle.bd = {
|
|
12238
12194
|
t: null,
|
|
12239
12195
|
r: null,
|
|
@@ -12785,7 +12741,6 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12785
12741
|
};
|
|
12786
12742
|
},
|
|
12787
12743
|
onPasteColumns(pasteTo, colProperties, payload) {
|
|
12788
|
-
var _self$_configService$;
|
|
12789
12744
|
const redos = [];
|
|
12790
12745
|
const undos = [];
|
|
12791
12746
|
if (payload.pasteType !== PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_COL_WIDTH) return {
|
|
@@ -12799,7 +12754,7 @@ let SheetClipboardController = class SheetClipboardController extends RxDisposab
|
|
|
12799
12754
|
undos
|
|
12800
12755
|
};
|
|
12801
12756
|
const worksheet = self._getWorksheet(unitId, subUnitId);
|
|
12802
|
-
const defaultColumnWidth =
|
|
12757
|
+
const defaultColumnWidth = self._configService.getConfig(DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY) ?? DEFAULT_WORKSHEET_COLUMN_WIDTH;
|
|
12803
12758
|
const pasteRangeStartRow = rows[0];
|
|
12804
12759
|
const pasteRangeEndRow = rows[rows.length - 1];
|
|
12805
12760
|
const pasteRangeStartColumn = cols[0];
|
|
@@ -13280,8 +13235,8 @@ const calcDocRangePositions = (range, skeleton) => {
|
|
|
13280
13235
|
const skeletonData = skeleton.getSkeletonData();
|
|
13281
13236
|
let end = range.endOffset;
|
|
13282
13237
|
if (range.segmentId) {
|
|
13283
|
-
var
|
|
13284
|
-
const root =
|
|
13238
|
+
var _skeletonData$skeFoot, _skeletonData$skeHead;
|
|
13239
|
+
const root = Array.from((skeletonData === null || skeletonData === void 0 || (_skeletonData$skeFoot = skeletonData.skeFooters.get(range.segmentId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.values()) ?? [])[0] ?? Array.from((skeletonData === null || skeletonData === void 0 || (_skeletonData$skeHead = skeletonData.skeHeaders.get(range.segmentId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.values()) ?? [])[0];
|
|
13285
13240
|
if (root) end = Math.min(root.ed, end);
|
|
13286
13241
|
}
|
|
13287
13242
|
const endPosition = skeleton.findNodePositionByCharIndex(end, true, range.segmentId, pageIndex);
|
|
@@ -13362,13 +13317,13 @@ const calcBulletPosition = (skeleton, paragraph, paddingLeft = 0, paddingTop = 0
|
|
|
13362
13317
|
};
|
|
13363
13318
|
};
|
|
13364
13319
|
const calculateDocSkeletonRects = (docSkeleton, paddingLeft = 0, paddingTop = 0) => {
|
|
13365
|
-
var _docModel$getBody
|
|
13320
|
+
var _docModel$getBody, _docModel$getBody2, _docSkeleton$getSkele;
|
|
13366
13321
|
const docModel = docSkeleton.getViewModel().getDataModel();
|
|
13367
|
-
const hyperLinks = (
|
|
13368
|
-
const checkLists = (
|
|
13322
|
+
const hyperLinks = ((_docModel$getBody = docModel.getBody()) === null || _docModel$getBody === void 0 || (_docModel$getBody = _docModel$getBody.customRanges) === null || _docModel$getBody === void 0 ? void 0 : _docModel$getBody.filter((range) => range.rangeType === CustomRangeType.HYPERLINK)) ?? [];
|
|
13323
|
+
const checkLists = ((_docModel$getBody2 = docModel.getBody()) === null || _docModel$getBody2 === void 0 || (_docModel$getBody2 = _docModel$getBody2.paragraphs) === null || _docModel$getBody2 === void 0 ? void 0 : _docModel$getBody2.filter((p) => {
|
|
13369
13324
|
var _p$bullet;
|
|
13370
13325
|
return ((_p$bullet = p.bullet) === null || _p$bullet === void 0 ? void 0 : _p$bullet.listType.indexOf(PresetListType.CHECK_LIST)) === 0;
|
|
13371
|
-
}))
|
|
13326
|
+
})) ?? [];
|
|
13372
13327
|
const drawings = (_docSkeleton$getSkele = docSkeleton.getSkeletonData()) === null || _docSkeleton$getSkele === void 0 ? void 0 : _docSkeleton$getSkele.pages[0].skeDrawings;
|
|
13373
13328
|
return {
|
|
13374
13329
|
links: hyperLinks.map((link) => calcLinkPosition(docSkeleton, link, paddingLeft, paddingTop)).filter(Boolean),
|
|
@@ -13386,9 +13341,9 @@ const calculateDocSkeletonRects = (docSkeleton, paddingLeft = 0, paddingTop = 0)
|
|
|
13386
13341
|
};
|
|
13387
13342
|
};
|
|
13388
13343
|
function calcPadding(cell, font, isNum) {
|
|
13389
|
-
var _font$documentSkeleto, _font$documentSkeleto2
|
|
13390
|
-
const height = (_font$documentSkeleto =
|
|
13391
|
-
const width = (
|
|
13344
|
+
var _font$documentSkeleto, _font$documentSkeleto2;
|
|
13345
|
+
const height = ((_font$documentSkeleto = font.documentSkeleton) === null || _font$documentSkeleto === void 0 || (_font$documentSkeleto = _font$documentSkeleto.getSkeletonData()) === null || _font$documentSkeleto === void 0 ? void 0 : _font$documentSkeleto.pages[0].height) ?? 0;
|
|
13346
|
+
const width = ((_font$documentSkeleto2 = font.documentSkeleton) === null || _font$documentSkeleto2 === void 0 || (_font$documentSkeleto2 = _font$documentSkeleto2.getSkeletonData()) === null || _font$documentSkeleto2 === void 0 ? void 0 : _font$documentSkeleto2.pages[0].width) ?? 0;
|
|
13392
13347
|
const vt = font.verticalAlign;
|
|
13393
13348
|
const ht = font.horizontalAlign;
|
|
13394
13349
|
let paddingTop = 0;
|
|
@@ -13421,7 +13376,7 @@ function calcPadding(cell, font, isNum) {
|
|
|
13421
13376
|
};
|
|
13422
13377
|
}
|
|
13423
13378
|
const getCustomRangePosition = (injector, unitId, subUnitId, row, col, rangeId) => {
|
|
13424
|
-
var _docSkeleton$getViewM
|
|
13379
|
+
var _docSkeleton$getViewM;
|
|
13425
13380
|
const univerInstanceService = injector.get(IUniverInstanceService);
|
|
13426
13381
|
const renderManagerService = injector.get(IRenderManagerService);
|
|
13427
13382
|
const workbook = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
|
|
@@ -13447,7 +13402,7 @@ const getCustomRangePosition = (injector, unitId, subUnitId, row, col, rangeId)
|
|
|
13447
13402
|
});
|
|
13448
13403
|
const actualCell = skeleton.getCellWithCoordByIndex(actualRow, actualColumn);
|
|
13449
13404
|
const cellData = worksheet.getCell(actualCell.actualRow, actualCell.actualColumn);
|
|
13450
|
-
const { topOffset = 0, leftOffset = 0 } = (
|
|
13405
|
+
const { topOffset = 0, leftOffset = 0 } = (cellData === null || cellData === void 0 ? void 0 : cellData.fontRenderExtension) ?? {};
|
|
13451
13406
|
const { paddingLeft, paddingTop } = calcPadding(actualCell, font, false);
|
|
13452
13407
|
const rects = calcDocRangePositions({
|
|
13453
13408
|
startOffset: customRange.startIndex,
|
|
@@ -13507,6 +13462,33 @@ function getLocationBase(location) {
|
|
|
13507
13462
|
const { workbook, worksheet, ...locBase } = location;
|
|
13508
13463
|
return locBase;
|
|
13509
13464
|
}
|
|
13465
|
+
function calculateCellDrawingRects(font, cell, drawings) {
|
|
13466
|
+
var _font$documentSkeleto;
|
|
13467
|
+
const drawingData = (_font$documentSkeleto = font.documentSkeleton) === null || _font$documentSkeleto === void 0 ? void 0 : _font$documentSkeleto.getViewModel().getDataModel().getDrawings();
|
|
13468
|
+
const cellRect = {
|
|
13469
|
+
left: 0,
|
|
13470
|
+
top: 0,
|
|
13471
|
+
right: cell.mergeInfo.endX - cell.mergeInfo.startX,
|
|
13472
|
+
bottom: cell.mergeInfo.endY - cell.mergeInfo.startY
|
|
13473
|
+
};
|
|
13474
|
+
return drawings.map((drawing) => {
|
|
13475
|
+
var _drawingOrigin$docTra, _drawingOrigin$docTra2, _font$style;
|
|
13476
|
+
const drawingOrigin = drawingData === null || drawingData === void 0 ? void 0 : drawingData[drawing.drawingId];
|
|
13477
|
+
const imageWidth = (drawingOrigin === null || drawingOrigin === void 0 || (_drawingOrigin$docTra = drawingOrigin.docTransform) === null || _drawingOrigin$docTra === void 0 ? void 0 : _drawingOrigin$docTra.size.width) ?? drawing.drawing.width;
|
|
13478
|
+
const imageHeight = (drawingOrigin === null || drawingOrigin === void 0 || (_drawingOrigin$docTra2 = drawingOrigin.docTransform) === null || _drawingOrigin$docTra2 === void 0 ? void 0 : _drawingOrigin$docTra2.size.height) ?? drawing.drawing.height;
|
|
13479
|
+
return {
|
|
13480
|
+
...drawing,
|
|
13481
|
+
rect: calculateCellImageRect({
|
|
13482
|
+
cellRect,
|
|
13483
|
+
imageWidth,
|
|
13484
|
+
imageHeight,
|
|
13485
|
+
horizontalAlign: font.horizontalAlign,
|
|
13486
|
+
verticalAlign: font.verticalAlign,
|
|
13487
|
+
padding: (_font$style = font.style) === null || _font$style === void 0 ? void 0 : _font$style.pd
|
|
13488
|
+
})
|
|
13489
|
+
};
|
|
13490
|
+
});
|
|
13491
|
+
}
|
|
13510
13492
|
let HoverManagerService = class HoverManagerService extends Disposable {
|
|
13511
13493
|
constructor(_univerInstanceService, _renderManagerService) {
|
|
13512
13494
|
super();
|
|
@@ -13641,7 +13623,6 @@ let HoverManagerService = class HoverManagerService extends Disposable {
|
|
|
13641
13623
|
};
|
|
13642
13624
|
}
|
|
13643
13625
|
_calcActiveCell(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY) {
|
|
13644
|
-
var _cellData$fontRenderE, _ref, _customRange$rects$po;
|
|
13645
13626
|
const hoverPosition = getHoverCellPosition(currentRender, workbook, worksheet, skeletonParam, offsetX, offsetY);
|
|
13646
13627
|
const skeleton = skeletonParam.skeleton;
|
|
13647
13628
|
if (!hoverPosition) return null;
|
|
@@ -13652,17 +13633,18 @@ let HoverManagerService = class HoverManagerService extends Disposable {
|
|
|
13652
13633
|
let drawing = null;
|
|
13653
13634
|
const cell = skeleton.getCellWithCoordByIndex(overflowLocation.row, overflowLocation.col);
|
|
13654
13635
|
const cellData = worksheet.getCell(overflowLocation.row, overflowLocation.col);
|
|
13655
|
-
const { topOffset = 0, leftOffset = 0 } = (
|
|
13636
|
+
const { topOffset = 0, leftOffset = 0 } = (cellData === null || cellData === void 0 ? void 0 : cellData.fontRenderExtension) ?? {};
|
|
13656
13637
|
if (font === null || font === void 0 ? void 0 : font.documentSkeleton) {
|
|
13657
13638
|
const { paddingLeft, paddingTop } = calcPadding(cell, font, (cellData === null || cellData === void 0 ? void 0 : cellData.p) ? false : isRealNum(cellData === null || cellData === void 0 ? void 0 : cellData.v) && (!(cellData === null || cellData === void 0 ? void 0 : cellData.t) || cellData.t === CellValueType.NUMBER));
|
|
13658
13639
|
const rects = calculateDocSkeletonRects(font.documentSkeleton, paddingLeft, paddingTop);
|
|
13640
|
+
const drawingRects = calculateCellDrawingRects(font, cell, rects.drawings);
|
|
13659
13641
|
const innerX = offsetX - position.startX - leftOffset;
|
|
13660
13642
|
const innerY = offsetY - position.startY - topOffset;
|
|
13661
13643
|
customRange = rects.links.find((link) => link.rects.some((rect) => rect.left <= innerX && innerX <= rect.right && rect.top <= innerY && innerY <= rect.bottom));
|
|
13662
13644
|
bullet = rects.checkLists.find((list) => list.rect.left <= innerX && innerX <= list.rect.right && list.rect.top <= innerY && innerY <= list.rect.bottom);
|
|
13663
|
-
drawing =
|
|
13645
|
+
drawing = drawingRects.find((drawing) => drawing.rect.left <= innerX && innerX <= drawing.rect.right && drawing.rect.top <= innerY && innerY <= drawing.rect.bottom);
|
|
13664
13646
|
}
|
|
13665
|
-
const rect = (
|
|
13647
|
+
const rect = (customRange === null || customRange === void 0 ? void 0 : customRange.rects.pop()) ?? (bullet === null || bullet === void 0 ? void 0 : bullet.rect) ?? (drawing === null || drawing === void 0 ? void 0 : drawing.rect);
|
|
13666
13648
|
const displayRect = rect && (() => {
|
|
13667
13649
|
const absoluteTop = rect.top + cell.mergeInfo.startY + topOffset;
|
|
13668
13650
|
const absoluteBottom = rect.bottom + cell.mergeInfo.startY + topOffset;
|
|
@@ -14114,7 +14096,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
|
|
|
14114
14096
|
}
|
|
14115
14097
|
_createFreeze(freezeDirectionType = 0, freezeConfig) {
|
|
14116
14098
|
var _this$_sheetSkeletonM;
|
|
14117
|
-
const config = freezeConfig
|
|
14099
|
+
const config = freezeConfig ?? this._getFreeze();
|
|
14118
14100
|
if (config == null) return null;
|
|
14119
14101
|
const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
|
|
14120
14102
|
const { startRow: freezeRow, startColumn: freezeColumn } = config;
|
|
@@ -14237,7 +14219,7 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
|
|
|
14237
14219
|
if (s2) this._freezeDownSubs.add(s2);
|
|
14238
14220
|
}
|
|
14239
14221
|
_getCurrentLastVisible() {
|
|
14240
|
-
var _this$_sheetSkeletonM2
|
|
14222
|
+
var _this$_sheetSkeletonM2;
|
|
14241
14223
|
const sheetObject = this._getSheetObject();
|
|
14242
14224
|
if (sheetObject == null) return;
|
|
14243
14225
|
const skeleton = (_this$_sheetSkeletonM2 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM2 === void 0 ? void 0 : _this$_sheetSkeletonM2.skeleton;
|
|
@@ -14247,8 +14229,8 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
|
|
|
14247
14229
|
const currentScroll = this._scrollManagerService.getCurrentScrollState();
|
|
14248
14230
|
const skeletonViewHeight = (sheetObject.engine.height - skeleton.columnHeaderHeight) / scale;
|
|
14249
14231
|
const skeletonViewWidth = (sheetObject.engine.width - skeleton.rowHeaderWidth) / scale;
|
|
14250
|
-
const startRow = (
|
|
14251
|
-
const startHeight = startRow === 0 ? -((
|
|
14232
|
+
const startRow = (currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.sheetViewStartRow) ?? 0;
|
|
14233
|
+
const startHeight = startRow === 0 ? -((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetY) ?? 0) : skeleton.rowHeightAccumulation[startRow - 1] - ((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetY) ?? 0);
|
|
14252
14234
|
let lastRow = 0;
|
|
14253
14235
|
let hadFind = false;
|
|
14254
14236
|
for (let i = startRow, len = skeleton.rowHeightAccumulation.length; i < len; i++) if (skeleton.rowHeightAccumulation[i] - startHeight > skeletonViewHeight) {
|
|
@@ -14257,8 +14239,8 @@ let HeaderFreezeRenderController = class HeaderFreezeRenderController extends Di
|
|
|
14257
14239
|
break;
|
|
14258
14240
|
}
|
|
14259
14241
|
if (!hadFind) lastRow = skeleton.rowHeightAccumulation.length - 1;
|
|
14260
|
-
const startColumn = (
|
|
14261
|
-
const startWidth = startColumn === 0 ? -((
|
|
14242
|
+
const startColumn = (currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.sheetViewStartColumn) ?? 0;
|
|
14243
|
+
const startWidth = startColumn === 0 ? -((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetX) ?? 0) : skeleton.columnWidthAccumulation[startColumn - 1] - ((currentScroll === null || currentScroll === void 0 ? void 0 : currentScroll.offsetX) ?? 0);
|
|
14262
14244
|
let lastColumn = 0;
|
|
14263
14245
|
let hadFindCol = false;
|
|
14264
14246
|
for (let i = startColumn, len = skeleton.columnWidthAccumulation.length; i < len; i++) if (skeleton.columnWidthAccumulation[i] - startWidth > skeletonViewWidth) {
|
|
@@ -15029,14 +15011,8 @@ function getSheetSelectionsDisabled$(accessor) {
|
|
|
15029
15011
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
15030
15012
|
return combineLatest([
|
|
15031
15013
|
selectionManagerService.selectionMoveEnd$,
|
|
15032
|
-
workbook$.pipe(map((workbook) =>
|
|
15033
|
-
|
|
15034
|
-
return (_workbook$getUnitId = workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) !== null && _workbook$getUnitId !== void 0 ? _workbook$getUnitId : "";
|
|
15035
|
-
})),
|
|
15036
|
-
workbook$.pipe(switchMap((workbook) => {
|
|
15037
|
-
var _workbook$activeSheet;
|
|
15038
|
-
return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : of(null);
|
|
15039
|
-
}))
|
|
15014
|
+
workbook$.pipe(map((workbook) => (workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) ?? "")),
|
|
15015
|
+
workbook$.pipe(switchMap((workbook) => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? of(null)))
|
|
15040
15016
|
]).pipe(map(([selection, unitId, sheet]) => {
|
|
15041
15017
|
if (!sheet) return false;
|
|
15042
15018
|
if (!selection || selection.length === 0) return false;
|
|
@@ -16026,10 +16002,7 @@ let HeaderUnhideRenderController = class HeaderUnhideRenderController extends Rx
|
|
|
16026
16002
|
const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getSkeletonParam(worksheet.getSheetId())) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
|
|
16027
16003
|
if (!skeleton) return;
|
|
16028
16004
|
const visibleCheck = this.interceptor.fetchThroughInterceptors(HEADER_UNHIDE_RANGE_VISIBLE_CHECK);
|
|
16029
|
-
const shouldRenderRange = (payload) =>
|
|
16030
|
-
var _visibleCheck;
|
|
16031
|
-
return this._headerUnhideRangeService.shouldRenderRange((_visibleCheck = visibleCheck(true, payload)) !== null && _visibleCheck !== void 0 ? _visibleCheck : true, payload);
|
|
16032
|
-
};
|
|
16005
|
+
const shouldRenderRange = (payload) => this._headerUnhideRangeService.shouldRenderRange(visibleCheck(true, payload) ?? true, payload);
|
|
16033
16006
|
const hiddenRowRanges = worksheet.getHiddenRows().filter((range) => shouldRenderRange({
|
|
16034
16007
|
axis: "row",
|
|
16035
16008
|
range,
|
|
@@ -16115,43 +16088,43 @@ var StatusBarService = class {
|
|
|
16115
16088
|
{
|
|
16116
16089
|
func: FUNCTION_NAMES_STATISTICAL.MAX,
|
|
16117
16090
|
filter: (status) => {
|
|
16118
|
-
var _status$values$find
|
|
16119
|
-
return ((
|
|
16091
|
+
var _status$values$find, _status$values$find2;
|
|
16092
|
+
return (((_status$values$find = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find === void 0 ? void 0 : _status$values$find.value) ?? 0) > 1 && (((_status$values$find2 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find2 === void 0 ? void 0 : _status$values$find2.value) ?? 0) > 0;
|
|
16120
16093
|
}
|
|
16121
16094
|
},
|
|
16122
16095
|
{
|
|
16123
16096
|
func: FUNCTION_NAMES_STATISTICAL.MIN,
|
|
16124
16097
|
filter: (status) => {
|
|
16125
|
-
var _status$values$
|
|
16126
|
-
return ((
|
|
16098
|
+
var _status$values$find3, _status$values$find4;
|
|
16099
|
+
return (((_status$values$find3 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find3 === void 0 ? void 0 : _status$values$find3.value) ?? 0) > 1 && (((_status$values$find4 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find4 === void 0 ? void 0 : _status$values$find4.value) ?? 0) > 0;
|
|
16127
16100
|
}
|
|
16128
16101
|
},
|
|
16129
16102
|
{
|
|
16130
16103
|
func: FUNCTION_NAMES_MATH.SUM,
|
|
16131
16104
|
filter: (status) => {
|
|
16132
|
-
var _status$values$
|
|
16133
|
-
return ((
|
|
16105
|
+
var _status$values$find5, _status$values$find6;
|
|
16106
|
+
return (((_status$values$find5 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find5 === void 0 ? void 0 : _status$values$find5.value) ?? 0) > 1 && (((_status$values$find6 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find6 === void 0 ? void 0 : _status$values$find6.value) ?? 0) > 0;
|
|
16134
16107
|
}
|
|
16135
16108
|
},
|
|
16136
16109
|
{
|
|
16137
16110
|
func: FUNCTION_NAMES_STATISTICAL.COUNTA,
|
|
16138
16111
|
filter: (status) => {
|
|
16139
|
-
var _status$values$
|
|
16140
|
-
return ((
|
|
16112
|
+
var _status$values$find7;
|
|
16113
|
+
return (((_status$values$find7 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find7 === void 0 ? void 0 : _status$values$find7.value) ?? 0) > 1;
|
|
16141
16114
|
}
|
|
16142
16115
|
},
|
|
16143
16116
|
{
|
|
16144
16117
|
func: FUNCTION_NAMES_STATISTICAL.COUNT,
|
|
16145
16118
|
filter: (status) => {
|
|
16146
|
-
var _status$values$
|
|
16147
|
-
return ((
|
|
16119
|
+
var _status$values$find8, _status$values$find9;
|
|
16120
|
+
return (((_status$values$find8 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find8 === void 0 ? void 0 : _status$values$find8.value) ?? 0) > 1 && (((_status$values$find9 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find9 === void 0 ? void 0 : _status$values$find9.value) ?? 0) > 0;
|
|
16148
16121
|
}
|
|
16149
16122
|
},
|
|
16150
16123
|
{
|
|
16151
16124
|
func: FUNCTION_NAMES_STATISTICAL.AVERAGE,
|
|
16152
16125
|
filter: (status) => {
|
|
16153
|
-
var _status$values$
|
|
16154
|
-
return ((
|
|
16126
|
+
var _status$values$find10, _status$values$find11;
|
|
16127
|
+
return (((_status$values$find10 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNTA)) === null || _status$values$find10 === void 0 ? void 0 : _status$values$find10.value) ?? 0) > 1 && (((_status$values$find11 = status.values.find((item) => item.func === FUNCTION_NAMES_STATISTICAL.COUNT)) === null || _status$values$find11 === void 0 ? void 0 : _status$values$find11.value) ?? 0) > 0;
|
|
16155
16128
|
}
|
|
16156
16129
|
}
|
|
16157
16130
|
]);
|
|
@@ -16162,7 +16135,6 @@ var StatusBarService = class {
|
|
|
16162
16135
|
this._state$.complete();
|
|
16163
16136
|
}
|
|
16164
16137
|
setState(param) {
|
|
16165
|
-
var _param$pattern;
|
|
16166
16138
|
const newState = {
|
|
16167
16139
|
values: [],
|
|
16168
16140
|
pattern: null
|
|
@@ -16171,7 +16143,7 @@ var StatusBarService = class {
|
|
|
16171
16143
|
const func = this._functions.find((func) => func.func === item.func);
|
|
16172
16144
|
if (func && (func.filter === void 0 || func.filter(param))) newState.values.push(item);
|
|
16173
16145
|
});
|
|
16174
|
-
newState.pattern = (
|
|
16146
|
+
newState.pattern = (param === null || param === void 0 ? void 0 : param.pattern) ?? null;
|
|
16175
16147
|
this._state$.next(newState);
|
|
16176
16148
|
}
|
|
16177
16149
|
getState() {
|
|
@@ -16350,14 +16322,11 @@ let StatusBarController = class StatusBarController extends Disposable {
|
|
|
16350
16322
|
var _sheetArrayFormulaCel;
|
|
16351
16323
|
const rawCell = sheet.getCellRaw(row, col);
|
|
16352
16324
|
const arrayCell = sheetArrayFormulaCellData === null || sheetArrayFormulaCellData === void 0 || (_sheetArrayFormulaCel = sheetArrayFormulaCellData[row]) === null || _sheetArrayFormulaCel === void 0 ? void 0 : _sheetArrayFormulaCel[col];
|
|
16353
|
-
if (arrayCell) {
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
|
|
16357
|
-
|
|
16358
|
-
s: (_arrayCell$s = arrayCell.s) !== null && _arrayCell$s !== void 0 ? _arrayCell$s : rawCell === null || rawCell === void 0 ? void 0 : rawCell.s
|
|
16359
|
-
};
|
|
16360
|
-
}
|
|
16325
|
+
if (arrayCell) return {
|
|
16326
|
+
t: arrayCell.t ?? (rawCell === null || rawCell === void 0 ? void 0 : rawCell.t),
|
|
16327
|
+
v: arrayCell.v ?? (rawCell === null || rawCell === void 0 ? void 0 : rawCell.v),
|
|
16328
|
+
s: arrayCell.s ?? (rawCell === null || rawCell === void 0 ? void 0 : rawCell.s)
|
|
16329
|
+
};
|
|
16361
16330
|
return rawCell;
|
|
16362
16331
|
}
|
|
16363
16332
|
_calculateSelection(selections, primary) {
|
|
@@ -16655,12 +16624,11 @@ function getObservableWithExclusiveRange$(accessor, observable$, disableGroupSet
|
|
|
16655
16624
|
return combineLatest([observable$, getCurrentExclusiveRangeInterest$(accessor, disableGroupSet)]).pipe(map$1(([observable, exclusiveRangeDisable]) => observable || exclusiveRangeDisable));
|
|
16656
16625
|
}
|
|
16657
16626
|
function getCurrentRangeDisable$(accessor, permissionTypes = {}, supportCellEdit = false) {
|
|
16658
|
-
var _editorBridgeService$;
|
|
16659
16627
|
const workbook$ = accessor.get(IUniverInstanceService).getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
16660
16628
|
const userManagerService = accessor.get(UserManagerService);
|
|
16661
16629
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
16662
16630
|
const contextService = accessor.get(IContextService);
|
|
16663
|
-
const editorVisible$ = ((
|
|
16631
|
+
const editorVisible$ = ((editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$) ?? of(null)).pipe(startWith$1(null), shareReplay$1({
|
|
16664
16632
|
bufferSize: 1,
|
|
16665
16633
|
refCount: true
|
|
16666
16634
|
}));
|
|
@@ -16839,7 +16807,6 @@ function getWorkbookPermissionDisable$(accessor, workbookPermissionTypes) {
|
|
|
16839
16807
|
return combineLatest([accessor.get(UserManagerService).currentUser$, workbook$]).pipe(switchMap$1(([_user, workbook]) => {
|
|
16840
16808
|
if (!workbook) return of(true);
|
|
16841
16809
|
return workbook.activeSheet$.pipe(switchMap$1((worksheet) => {
|
|
16842
|
-
var _permissionService$co;
|
|
16843
16810
|
if (!worksheet) return of(true);
|
|
16844
16811
|
const unitId = workbook.getUnitId();
|
|
16845
16812
|
const subUnitId = worksheet.getSheetId();
|
|
@@ -16847,7 +16814,7 @@ function getWorkbookPermissionDisable$(accessor, workbookPermissionTypes) {
|
|
|
16847
16814
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
16848
16815
|
const workbookPermissionIds = [];
|
|
16849
16816
|
workbookPermissionTypes.forEach((F) => workbookPermissionIds.push(new F(unitId).id));
|
|
16850
|
-
return combineLatest([
|
|
16817
|
+
return combineLatest([permissionService.composePermission$(workbookPermissionIds).pipe(map$1((list) => list.every((item) => item.value === true))) ?? of(false), merge$1(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe(startWith$1(null))]).pipe(map$1(([permission, _]) => {
|
|
16851
16818
|
var _selectionProtectionR;
|
|
16852
16819
|
if (!permission) return true;
|
|
16853
16820
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -16873,11 +16840,10 @@ function CellBorderSelectorMenuItemFactory(accessor) {
|
|
|
16873
16840
|
const defaultIcon = "AllBorderIcon";
|
|
16874
16841
|
const borderManager = accessor.get(BorderStyleManagerService);
|
|
16875
16842
|
const disposable = accessor.get(ICommandService).onCommandExecuted((c) => {
|
|
16876
|
-
var _item$icon;
|
|
16877
16843
|
if (c.id !== SetBorderBasicCommand.id) return;
|
|
16878
16844
|
const { type } = borderManager.getBorderInfo();
|
|
16879
16845
|
const item = BORDER_LINE_CHILDREN.find((item) => item.value === type);
|
|
16880
|
-
const icon = (
|
|
16846
|
+
const icon = (item === null || item === void 0 ? void 0 : item.icon) ?? defaultIcon;
|
|
16881
16847
|
subscriber.next(icon);
|
|
16882
16848
|
});
|
|
16883
16849
|
subscriber.next(defaultIcon);
|
|
@@ -17067,8 +17033,8 @@ function updateFontSizeValue(accessor, defaultValue) {
|
|
|
17067
17033
|
const updateSheetEditor = () => {
|
|
17068
17034
|
const textRun = getFontStyleAtCursor(accessor);
|
|
17069
17035
|
if (textRun != null) {
|
|
17070
|
-
var _textRun$ts
|
|
17071
|
-
const fs = (
|
|
17036
|
+
var _textRun$ts;
|
|
17037
|
+
const fs = ((_textRun$ts = textRun.ts) === null || _textRun$ts === void 0 ? void 0 : _textRun$ts.fs) ?? defaultValue;
|
|
17072
17038
|
subscriber.next(fs);
|
|
17073
17039
|
}
|
|
17074
17040
|
};
|
|
@@ -17148,11 +17114,10 @@ const defaultValue = {
|
|
|
17148
17114
|
col: "A"
|
|
17149
17115
|
};
|
|
17150
17116
|
function getFrozenValue(selection) {
|
|
17151
|
-
var _primary$startRow, _primary$startColumn;
|
|
17152
17117
|
if (!selection) return defaultValue;
|
|
17153
17118
|
const { primary, range } = selection;
|
|
17154
|
-
const row = (
|
|
17155
|
-
const col = (
|
|
17119
|
+
const row = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
17120
|
+
const col = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
17156
17121
|
return {
|
|
17157
17122
|
row: row === 0 ? "1" : String(row),
|
|
17158
17123
|
col: col === 0 ? "A" : Tools.chatAtABC(col - 1)
|
|
@@ -17182,11 +17147,10 @@ const getMenuHiddenByCurrentSelectionChangedObservable$$1 = (accessor, type) =>
|
|
|
17182
17147
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
17183
17148
|
return new Observable((subscriber) => {
|
|
17184
17149
|
const update = (selection) => {
|
|
17185
|
-
var _primary$startRow, _primary$startColumn;
|
|
17186
17150
|
if (!selection) return subscriber.next(true);
|
|
17187
17151
|
const { primary, range } = selection;
|
|
17188
|
-
const row = (
|
|
17189
|
-
const col = (
|
|
17152
|
+
const row = (primary === null || primary === void 0 ? void 0 : primary.startRow) ?? range.startRow;
|
|
17153
|
+
const col = (primary === null || primary === void 0 ? void 0 : primary.startColumn) ?? range.startColumn;
|
|
17190
17154
|
if (type === "row" && row <= 0) return subscriber.next(true);
|
|
17191
17155
|
if (type === "col" && col <= 0) return subscriber.next(true);
|
|
17192
17156
|
subscriber.next(false);
|
|
@@ -17426,7 +17390,7 @@ const MenuItemInput = (props) => {
|
|
|
17426
17390
|
const { prefix, suffix, value, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER, disabled$, onChange } = props;
|
|
17427
17391
|
const localeService = useDependency(LocaleService);
|
|
17428
17392
|
const contextMenuService = useDependency(IContextMenuService);
|
|
17429
|
-
const disabled = useObservable(disabled$
|
|
17393
|
+
const disabled = useObservable(disabled$ ?? null, false);
|
|
17430
17394
|
const [inputValue, setInputValue] = useState();
|
|
17431
17395
|
const handleChange = (value) => {
|
|
17432
17396
|
if (!value) {
|
|
@@ -18097,8 +18061,8 @@ function FontFamilySelectorMenuItemFactory(accessor) {
|
|
|
18097
18061
|
if ((id === SetTextSelectionsOperation.id || id === SetInlineFormatCommand.id) && accessor.get(IContextService).getContextValue(EDITOR_ACTIVATED) && (accessor.get(IContextService).getContextValue(FOCUSING_SHEET) || accessor.get(IContextService).getContextValue(FOCUSING_SHAPE_TEXT_EDITOR))) {
|
|
18098
18062
|
const textRun = getFontStyleAtCursor(accessor);
|
|
18099
18063
|
if (textRun != null) {
|
|
18100
|
-
var _textRun$
|
|
18101
|
-
const ff = (
|
|
18064
|
+
var _textRun$ts5;
|
|
18065
|
+
const ff = ((_textRun$ts5 = textRun.ts) === null || _textRun$ts5 === void 0 ? void 0 : _textRun$ts5.ff) ?? defaultValue;
|
|
18102
18066
|
subscriber.next(ff);
|
|
18103
18067
|
}
|
|
18104
18068
|
}
|
|
@@ -18141,10 +18105,8 @@ function TextColorSelectorMenuItemFactory(accessor) {
|
|
|
18141
18105
|
value$: new Observable((subscriber) => {
|
|
18142
18106
|
const defaultValue = DEFAULT_STYLES.cl.rgb;
|
|
18143
18107
|
const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("cl");
|
|
18144
|
-
if (isAllValuesSame)
|
|
18145
|
-
|
|
18146
|
-
subscriber.next((_rgb = currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) !== null && _rgb !== void 0 ? _rgb : defaultValue);
|
|
18147
|
-
} else subscriber.next(defaultValue);
|
|
18108
|
+
if (isAllValuesSame) subscriber.next((currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) ?? defaultValue);
|
|
18109
|
+
else subscriber.next(defaultValue);
|
|
18148
18110
|
})
|
|
18149
18111
|
}],
|
|
18150
18112
|
value$: new Observable((subscriber) => {
|
|
@@ -18152,7 +18114,7 @@ function TextColorSelectorMenuItemFactory(accessor) {
|
|
|
18152
18114
|
const disposable = commandService.onCommandExecuted((c) => {
|
|
18153
18115
|
if (c.id === SetRangeTextColorCommand.id) {
|
|
18154
18116
|
const color = c.params.value;
|
|
18155
|
-
subscriber.next(color
|
|
18117
|
+
subscriber.next(color ?? defaultValue);
|
|
18156
18118
|
}
|
|
18157
18119
|
});
|
|
18158
18120
|
subscriber.next(defaultValue);
|
|
@@ -18197,10 +18159,8 @@ function BackgroundColorSelectorMenuItemFactory(accessor) {
|
|
|
18197
18159
|
value$: new Observable((subscriber) => {
|
|
18198
18160
|
const defaultValue = themeService.getColorFromTheme("primary.600");
|
|
18199
18161
|
const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("bg");
|
|
18200
|
-
if (isAllValuesSame)
|
|
18201
|
-
|
|
18202
|
-
subscriber.next((_rgb2 = currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) !== null && _rgb2 !== void 0 ? _rgb2 : defaultValue);
|
|
18203
|
-
} else subscriber.next(defaultValue);
|
|
18162
|
+
if (isAllValuesSame) subscriber.next((currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) ?? defaultValue);
|
|
18163
|
+
else subscriber.next(defaultValue);
|
|
18204
18164
|
})
|
|
18205
18165
|
}],
|
|
18206
18166
|
value$: new Observable((subscriber) => {
|
|
@@ -18208,7 +18168,7 @@ function BackgroundColorSelectorMenuItemFactory(accessor) {
|
|
|
18208
18168
|
const disposable = commandService.onCommandExecuted((c) => {
|
|
18209
18169
|
if (c.id === SetBackgroundColorCommand.id) {
|
|
18210
18170
|
const color = c.params.value;
|
|
18211
|
-
subscriber.next(color
|
|
18171
|
+
subscriber.next(color ?? defaultValue);
|
|
18212
18172
|
}
|
|
18213
18173
|
});
|
|
18214
18174
|
subscriber.next(defaultValue);
|
|
@@ -18240,12 +18200,12 @@ const HORIZONTAL_ALIGN_CHILDREN = [
|
|
|
18240
18200
|
}
|
|
18241
18201
|
];
|
|
18242
18202
|
function HorizontalAlignMenuItemFactory(accessor) {
|
|
18243
|
-
var
|
|
18203
|
+
var _HORIZONTAL_ALIGN_CHI;
|
|
18244
18204
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
18245
18205
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
18246
18206
|
const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
18247
18207
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18248
|
-
const defaultValue = (
|
|
18208
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.ht) ?? HorizontalAlign.LEFT;
|
|
18249
18209
|
return {
|
|
18250
18210
|
id: SetHorizontalTextAlignCommand.id,
|
|
18251
18211
|
icon: (_HORIZONTAL_ALIGN_CHI = HORIZONTAL_ALIGN_CHILDREN.find((child) => child.value === defaultValue)) === null || _HORIZONTAL_ALIGN_CHI === void 0 ? void 0 : _HORIZONTAL_ALIGN_CHI.icon,
|
|
@@ -18253,30 +18213,28 @@ function HorizontalAlignMenuItemFactory(accessor) {
|
|
|
18253
18213
|
type: MenuItemType.SELECTOR,
|
|
18254
18214
|
selections: HORIZONTAL_ALIGN_CHILDREN,
|
|
18255
18215
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new Observable((subscriber) => {
|
|
18256
|
-
var _selectionManagerServ11
|
|
18216
|
+
var _selectionManagerServ11;
|
|
18257
18217
|
const disposable = accessor.get(ICommandService).onCommandExecuted((c) => {
|
|
18258
|
-
var _selectionManagerServ10
|
|
18218
|
+
var _selectionManagerServ10;
|
|
18259
18219
|
const id = c.id;
|
|
18260
18220
|
if (id !== SetHorizontalTextAlignCommand.id && id !== SetSelectionsOperation.id && id !== SetWorksheetActiveOperation.id) return;
|
|
18261
18221
|
const primary = (_selectionManagerServ10 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ10 === void 0 ? void 0 : _selectionManagerServ10.primary;
|
|
18262
18222
|
let ht;
|
|
18263
18223
|
if (primary != null) {
|
|
18264
|
-
var _defaultCellStyle$ht;
|
|
18265
18224
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18266
18225
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18267
|
-
ht = (
|
|
18226
|
+
ht = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.ht) ?? (range === null || range === void 0 ? void 0 : range.getHorizontalAlignment());
|
|
18268
18227
|
}
|
|
18269
|
-
subscriber.next(
|
|
18228
|
+
subscriber.next(ht ?? defaultValue);
|
|
18270
18229
|
});
|
|
18271
18230
|
const primary = (_selectionManagerServ11 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ11 === void 0 ? void 0 : _selectionManagerServ11.primary;
|
|
18272
18231
|
let ht;
|
|
18273
18232
|
if (primary != null) {
|
|
18274
|
-
var _defaultCellStyle$ht2;
|
|
18275
18233
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18276
18234
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18277
|
-
ht = (
|
|
18235
|
+
ht = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.ht) ?? (range === null || range === void 0 ? void 0 : range.getHorizontalAlignment());
|
|
18278
18236
|
}
|
|
18279
|
-
subscriber.next(
|
|
18237
|
+
subscriber.next(ht ?? defaultValue);
|
|
18280
18238
|
return disposable.dispose;
|
|
18281
18239
|
})),
|
|
18282
18240
|
hidden$: combineLatest([getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET), accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false))]).pipe(map(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -18305,12 +18263,12 @@ const VERTICAL_ALIGN_CHILDREN = [
|
|
|
18305
18263
|
}
|
|
18306
18264
|
];
|
|
18307
18265
|
function VerticalAlignMenuItemFactory(accessor) {
|
|
18308
|
-
var
|
|
18266
|
+
var _VERTICAL_ALIGN_CHILD;
|
|
18309
18267
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
18310
18268
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
18311
18269
|
const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
18312
18270
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18313
|
-
const defaultValue = (
|
|
18271
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.vt) ?? VerticalAlign.BOTTOM;
|
|
18314
18272
|
return {
|
|
18315
18273
|
id: SetVerticalTextAlignCommand.id,
|
|
18316
18274
|
icon: (_VERTICAL_ALIGN_CHILD = VERTICAL_ALIGN_CHILDREN.find((child) => child.value === defaultValue)) === null || _VERTICAL_ALIGN_CHILD === void 0 ? void 0 : _VERTICAL_ALIGN_CHILD.icon,
|
|
@@ -18318,30 +18276,28 @@ function VerticalAlignMenuItemFactory(accessor) {
|
|
|
18318
18276
|
type: MenuItemType.SELECTOR,
|
|
18319
18277
|
selections: VERTICAL_ALIGN_CHILDREN,
|
|
18320
18278
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new Observable((subscriber) => {
|
|
18321
|
-
var _selectionManagerServ13
|
|
18279
|
+
var _selectionManagerServ13;
|
|
18322
18280
|
const disposable = accessor.get(ICommandService).onCommandExecuted((c) => {
|
|
18323
|
-
var _selectionManagerServ12
|
|
18281
|
+
var _selectionManagerServ12;
|
|
18324
18282
|
const id = c.id;
|
|
18325
18283
|
if (id !== SetVerticalTextAlignCommand.id && id !== SetSelectionsOperation.id && id !== SetWorksheetActiveOperation.id) return;
|
|
18326
18284
|
const primary = (_selectionManagerServ12 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ12 === void 0 ? void 0 : _selectionManagerServ12.primary;
|
|
18327
18285
|
let vt;
|
|
18328
18286
|
if (primary != null) {
|
|
18329
|
-
var _defaultCellStyle$vt;
|
|
18330
18287
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18331
18288
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18332
|
-
vt = (
|
|
18289
|
+
vt = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.vt) ?? (range === null || range === void 0 ? void 0 : range.getVerticalAlignment());
|
|
18333
18290
|
}
|
|
18334
|
-
subscriber.next(
|
|
18291
|
+
subscriber.next(vt ?? defaultValue);
|
|
18335
18292
|
});
|
|
18336
18293
|
const primary = (_selectionManagerServ13 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ13 === void 0 ? void 0 : _selectionManagerServ13.primary;
|
|
18337
18294
|
let vt;
|
|
18338
18295
|
if (primary != null) {
|
|
18339
|
-
var _defaultCellStyle$vt2;
|
|
18340
18296
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18341
18297
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18342
|
-
vt = (
|
|
18298
|
+
vt = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.vt) ?? (range === null || range === void 0 ? void 0 : range.getVerticalAlignment());
|
|
18343
18299
|
}
|
|
18344
|
-
subscriber.next(
|
|
18300
|
+
subscriber.next(vt ?? defaultValue);
|
|
18345
18301
|
return disposable.dispose;
|
|
18346
18302
|
})),
|
|
18347
18303
|
hidden$: combineLatest([getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET), accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false))]).pipe(map(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -18370,12 +18326,12 @@ const TEXT_WRAP_CHILDREN = [
|
|
|
18370
18326
|
}
|
|
18371
18327
|
];
|
|
18372
18328
|
function WrapTextMenuItemFactory(accessor) {
|
|
18373
|
-
var
|
|
18329
|
+
var _TEXT_WRAP_CHILDREN$f;
|
|
18374
18330
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
18375
18331
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
18376
18332
|
const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
18377
18333
|
const defaultStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getDefaultCellStyleInternal();
|
|
18378
|
-
const defaultValue = (
|
|
18334
|
+
const defaultValue = (defaultStyle === null || defaultStyle === void 0 ? void 0 : defaultStyle.tb) ?? WrapStrategy.OVERFLOW;
|
|
18379
18335
|
return {
|
|
18380
18336
|
id: SetTextWrapCommand.id,
|
|
18381
18337
|
tooltip: "sheets-ui.toolbar.textWrapMode.main",
|
|
@@ -18383,30 +18339,28 @@ function WrapTextMenuItemFactory(accessor) {
|
|
|
18383
18339
|
type: MenuItemType.SELECTOR,
|
|
18384
18340
|
selections: TEXT_WRAP_CHILDREN,
|
|
18385
18341
|
value$: deriveStateFromActiveSheet$(univerInstanceService, defaultValue, ({ worksheet }) => new Observable((subscriber) => {
|
|
18386
|
-
var _selectionManagerServ15
|
|
18342
|
+
var _selectionManagerServ15;
|
|
18387
18343
|
const disposable = accessor.get(ICommandService).onCommandExecuted((c) => {
|
|
18388
|
-
var _selectionManagerServ14
|
|
18344
|
+
var _selectionManagerServ14;
|
|
18389
18345
|
const id = c.id;
|
|
18390
18346
|
if (id !== SetTextWrapCommand.id && id !== SetSelectionsOperation.id && id !== SetWorksheetActiveOperation.id) return;
|
|
18391
18347
|
const primary = (_selectionManagerServ14 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ14 === void 0 ? void 0 : _selectionManagerServ14.primary;
|
|
18392
18348
|
let tb;
|
|
18393
18349
|
if (primary != null) {
|
|
18394
|
-
var _defaultCellStyle$tb;
|
|
18395
18350
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18396
18351
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18397
|
-
tb = (
|
|
18352
|
+
tb = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.tb) ?? (range === null || range === void 0 ? void 0 : range.getWrapStrategy());
|
|
18398
18353
|
}
|
|
18399
|
-
subscriber.next(
|
|
18354
|
+
subscriber.next(tb ?? defaultValue);
|
|
18400
18355
|
});
|
|
18401
18356
|
const primary = (_selectionManagerServ15 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ15 === void 0 ? void 0 : _selectionManagerServ15.primary;
|
|
18402
18357
|
let tb;
|
|
18403
18358
|
if (primary != null) {
|
|
18404
|
-
var _defaultCellStyle$tb2;
|
|
18405
18359
|
const range = worksheet.getRange(primary.startRow, primary.startColumn);
|
|
18406
18360
|
const defaultCellStyle = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet().getComposedCellStyle(primary.startRow, primary.startColumn);
|
|
18407
|
-
tb = (
|
|
18361
|
+
tb = (defaultCellStyle === null || defaultCellStyle === void 0 ? void 0 : defaultCellStyle.tb) ?? (range === null || range === void 0 ? void 0 : range.getWrapStrategy());
|
|
18408
18362
|
}
|
|
18409
|
-
subscriber.next(
|
|
18363
|
+
subscriber.next(tb ?? defaultValue);
|
|
18410
18364
|
return disposable.dispose;
|
|
18411
18365
|
})),
|
|
18412
18366
|
hidden$: combineLatest([getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET), accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false))]).pipe(map(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -18506,10 +18460,7 @@ function TextRotateMenuItemFactory(accessor) {
|
|
|
18506
18460
|
tr = range === null || range === void 0 ? void 0 : range.getTextRotation();
|
|
18507
18461
|
}
|
|
18508
18462
|
if ((tr === null || tr === void 0 ? void 0 : tr.v) === BooleanNumber.TRUE) subscriber.next("v");
|
|
18509
|
-
else
|
|
18510
|
-
var _ref;
|
|
18511
|
-
subscriber.next((_ref = tr && tr.a) !== null && _ref !== void 0 ? _ref : defaultValue);
|
|
18512
|
-
}
|
|
18463
|
+
else subscriber.next((tr && tr.a) ?? defaultValue);
|
|
18513
18464
|
});
|
|
18514
18465
|
const primary = (_selectionManagerServ18 = selectionManagerService.getCurrentLastSelection()) === null || _selectionManagerServ18 === void 0 ? void 0 : _selectionManagerServ18.primary;
|
|
18515
18466
|
let tr;
|
|
@@ -18518,10 +18469,7 @@ function TextRotateMenuItemFactory(accessor) {
|
|
|
18518
18469
|
tr = range === null || range === void 0 ? void 0 : range.getTextRotation();
|
|
18519
18470
|
}
|
|
18520
18471
|
if ((tr === null || tr === void 0 ? void 0 : tr.v) === BooleanNumber.TRUE) subscriber.next("v");
|
|
18521
|
-
else
|
|
18522
|
-
var _ref2;
|
|
18523
|
-
subscriber.next((_ref2 = tr && tr.a) !== null && _ref2 !== void 0 ? _ref2 : defaultValue);
|
|
18524
|
-
}
|
|
18472
|
+
else subscriber.next((tr && tr.a) ?? defaultValue);
|
|
18525
18473
|
return disposable.dispose;
|
|
18526
18474
|
})),
|
|
18527
18475
|
hidden$: combineLatest([getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET), accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false))]).pipe(map(([hidden, focusingDrawing]) => hidden || focusingDrawing)),
|
|
@@ -19013,14 +18961,13 @@ function getPermissionDisableBase$(accessor) {
|
|
|
19013
18961
|
return combineLatest([univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), accessor.get(UserManagerService).currentUser$]).pipe(switchMap(([workbook, _]) => {
|
|
19014
18962
|
if (!workbook) return of(true);
|
|
19015
18963
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19016
|
-
var _permissionService$co;
|
|
19017
18964
|
if (!worksheet) return of(true);
|
|
19018
18965
|
const unitId = workbook.getUnitId();
|
|
19019
18966
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
19020
18967
|
const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);
|
|
19021
18968
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
19022
18969
|
return combineLatest([
|
|
19023
|
-
|
|
18970
|
+
permissionService.composePermission$([new WorkbookEditablePermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false),
|
|
19024
18971
|
merge$1(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe(startWith(null)),
|
|
19025
18972
|
selectionManagerService.selectionMoveEnd$
|
|
19026
18973
|
]).pipe(map(([permission, _, __]) => {
|
|
@@ -19035,7 +18982,6 @@ function getPermissionDisableBase$(accessor) {
|
|
|
19035
18982
|
}));
|
|
19036
18983
|
}
|
|
19037
18984
|
function getAddPermissionDisableBase$(accessor) {
|
|
19038
|
-
var _editorBridgeService$;
|
|
19039
18985
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
19040
18986
|
const permissionService = accessor.get(IPermissionService);
|
|
19041
18987
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
@@ -19045,10 +18991,10 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19045
18991
|
bufferSize: 1,
|
|
19046
18992
|
refCount: true
|
|
19047
18993
|
}));
|
|
19048
|
-
const editorVisible$ = (
|
|
18994
|
+
const editorVisible$ = (editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$.pipe(startWith(null), shareReplay({
|
|
19049
18995
|
bufferSize: 1,
|
|
19050
18996
|
refCount: true
|
|
19051
|
-
})))
|
|
18997
|
+
}))) ?? of(null);
|
|
19052
18998
|
return combineLatest([
|
|
19053
18999
|
workbook$,
|
|
19054
19000
|
userManagerService.currentUser$,
|
|
@@ -19057,7 +19003,6 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19057
19003
|
]).pipe(switchMap(([workbook, _, visible, formulaEditorFocus]) => {
|
|
19058
19004
|
if (!workbook || (visible === null || visible === void 0 ? void 0 : visible.visible) && visible.unitId === workbook.getUnitId() || formulaEditorFocus) return of(true);
|
|
19059
19005
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19060
|
-
var _permissionService$co2;
|
|
19061
19006
|
if (!worksheet) return of(true);
|
|
19062
19007
|
const focusingDrawing$ = accessor.get(IContextService).subscribeContextValue$(FOCUSING_COMMON_DRAWINGS).pipe(startWith(false));
|
|
19063
19008
|
const unitId = workbook.getUnitId();
|
|
@@ -19066,7 +19011,7 @@ function getAddPermissionDisableBase$(accessor) {
|
|
|
19066
19011
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
19067
19012
|
const selectionManagerService = accessor.get(SheetsSelectionsService);
|
|
19068
19013
|
return combineLatest([
|
|
19069
|
-
|
|
19014
|
+
permissionService.composePermission$([new WorkbookCreateProtectPermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false),
|
|
19070
19015
|
merge$1(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe(startWith(null)),
|
|
19071
19016
|
selectionManagerService.selectionMoveEnd$,
|
|
19072
19017
|
focusingDrawing$
|
|
@@ -19095,13 +19040,12 @@ function getAddPermissionFromSheetBarDisable$(accessor) {
|
|
|
19095
19040
|
return combineLatest([univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), accessor.get(UserManagerService).currentUser$]).pipe(switchMap(([workbook, _]) => {
|
|
19096
19041
|
if (!workbook) return of(true);
|
|
19097
19042
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19098
|
-
var _permissionService$co3;
|
|
19099
19043
|
if (!worksheet) return of(true);
|
|
19100
19044
|
const unitId = workbook.getUnitId();
|
|
19101
19045
|
const subUnitId = worksheet.getSheetId();
|
|
19102
19046
|
const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);
|
|
19103
19047
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
19104
|
-
return combineLatest([
|
|
19048
|
+
return combineLatest([permissionService.composePermission$([new WorkbookCreateProtectPermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false), merge$1(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe(startWith(null))]).pipe(map(([permission, _]) => {
|
|
19105
19049
|
var _selectionProtectionR;
|
|
19106
19050
|
if (!permission) return true;
|
|
19107
19051
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -19117,12 +19061,12 @@ function getRemovePermissionFromSheetBarDisable$(accessor) {
|
|
|
19117
19061
|
return combineLatest([univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), accessor.get(UserManagerService).currentUser$]).pipe(switchMap(([workbook, _]) => {
|
|
19118
19062
|
if (!workbook) return of(true);
|
|
19119
19063
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19120
|
-
var _permissionService$ge2
|
|
19064
|
+
var _permissionService$ge2;
|
|
19121
19065
|
if (!worksheet) return of(true);
|
|
19122
19066
|
const unitId = workbook.getUnitId();
|
|
19123
19067
|
const subUnitId = worksheet.getSheetId();
|
|
19124
19068
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
19125
|
-
return combineLatest([(_permissionService$ge2 =
|
|
19069
|
+
return combineLatest([((_permissionService$ge2 = permissionService.getPermissionPoint$(new WorksheetDeleteProtectionPermission(unitId, subUnitId).id)) === null || _permissionService$ge2 === void 0 ? void 0 : _permissionService$ge2.pipe(map((e) => !!e.value))) ?? of(false), worksheetProtectionRuleModel.ruleChange$.pipe(startWith(null))]).pipe(map(([permission, _]) => {
|
|
19126
19070
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
19127
19071
|
if (worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) return !permission;
|
|
19128
19072
|
return true;
|
|
@@ -19136,13 +19080,12 @@ function getSetPermissionFromSheetBarDisable$(accessor) {
|
|
|
19136
19080
|
return combineLatest([univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), accessor.get(UserManagerService).currentUser$]).pipe(switchMap(([workbook, _]) => {
|
|
19137
19081
|
if (!workbook) return of(true);
|
|
19138
19082
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19139
|
-
var _permissionService$co4;
|
|
19140
19083
|
if (!worksheet) return of(true);
|
|
19141
19084
|
const unitId = workbook.getUnitId();
|
|
19142
19085
|
const subUnitId = worksheet.getSheetId();
|
|
19143
19086
|
const selectionProtectionRuleModel = accessor.get(RangeProtectionRuleModel);
|
|
19144
19087
|
const worksheetProtectionRuleModel = accessor.get(WorksheetProtectionRuleModel);
|
|
19145
|
-
return combineLatest([
|
|
19088
|
+
return combineLatest([permissionService.composePermission$([new WorkbookCreateProtectPermission(unitId).id, new WorkbookManageCollaboratorPermission(unitId).id]).pipe(map((permissions) => permissions.every((permission) => permission.value))) ?? of(false), merge$1(selectionProtectionRuleModel.ruleChange$, worksheetProtectionRuleModel.ruleChange$).pipe(startWith(null))]).pipe(map(([permission, _]) => {
|
|
19146
19089
|
var _selectionProtectionR2;
|
|
19147
19090
|
if (!permission) return true;
|
|
19148
19091
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
@@ -19172,8 +19115,8 @@ function getRemovePermissionDisable$(accessor) {
|
|
|
19172
19115
|
if ((selectionRange === null || selectionRange === void 0 ? void 0 : selectionRange.rangeType) === RANGE_TYPE.ALL || (selectionRange === null || selectionRange === void 0 ? void 0 : selectionRange.rangeType) === RANGE_TYPE.COLUMN || (selectionRange === null || selectionRange === void 0 ? void 0 : selectionRange.rangeType) === RANGE_TYPE.ROW) return true;
|
|
19173
19116
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
19174
19117
|
if (worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) {
|
|
19175
|
-
var _permissionService$
|
|
19176
|
-
return ((_permissionService$
|
|
19118
|
+
var _permissionService$ge3;
|
|
19119
|
+
return ((_permissionService$ge3 = permissionService.getPermissionPoint(new WorksheetDeleteProtectionPermission(unitId, subUnitId).id)) === null || _permissionService$ge3 === void 0 ? void 0 : _permissionService$ge3.value) === false;
|
|
19177
19120
|
}
|
|
19178
19121
|
if (selectionProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).filter((rule) => {
|
|
19179
19122
|
return rule.ranges.some((range) => {
|
|
@@ -19192,14 +19135,13 @@ function getRemovePermissionDisable$(accessor) {
|
|
|
19192
19135
|
}));
|
|
19193
19136
|
}
|
|
19194
19137
|
function getViewPermissionDisable$(accessor) {
|
|
19195
|
-
var _editorBridgeService$2;
|
|
19196
19138
|
const univerInstanceService = accessor.get(IUniverInstanceService);
|
|
19197
19139
|
const permissionService = accessor.get(IPermissionService);
|
|
19198
19140
|
const workbook$ = univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET);
|
|
19199
19141
|
const userManagerService = accessor.get(UserManagerService);
|
|
19200
19142
|
const editorBridgeService = accessor.has(IEditorBridgeService) ? accessor.get(IEditorBridgeService) : null;
|
|
19201
19143
|
const formulaEditorFocus$ = accessor.get(IContextService).subscribeContextValue$(FOCUSING_FX_BAR_EDITOR);
|
|
19202
|
-
const editorVisible$ = (
|
|
19144
|
+
const editorVisible$ = (editorBridgeService === null || editorBridgeService === void 0 ? void 0 : editorBridgeService.visible$) ?? of(null);
|
|
19203
19145
|
return combineLatest([
|
|
19204
19146
|
workbook$,
|
|
19205
19147
|
userManagerService.currentUser$,
|
|
@@ -19208,10 +19150,10 @@ function getViewPermissionDisable$(accessor) {
|
|
|
19208
19150
|
]).pipe(switchMap(([workbook, _, visible, formulaEditorFocus]) => {
|
|
19209
19151
|
if (!workbook || (visible === null || visible === void 0 ? void 0 : visible.visible) && visible.unitId === workbook.getUnitId() || formulaEditorFocus) return of(true);
|
|
19210
19152
|
return workbook.activeSheet$.pipe(switchMap((worksheet) => {
|
|
19211
|
-
var _permissionService$
|
|
19153
|
+
var _permissionService$ge4;
|
|
19212
19154
|
if (!worksheet) return of(true);
|
|
19213
19155
|
const unitId = workbook.getUnitId();
|
|
19214
|
-
return ((
|
|
19156
|
+
return (((_permissionService$ge4 = permissionService.getPermissionPoint$(new WorkbookEditablePermission(unitId).id)) === null || _permissionService$ge4 === void 0 ? void 0 : _permissionService$ge4.pipe(map((e) => !!e.value))) ?? of(false)).pipe(map((permission) => !permission));
|
|
19215
19157
|
}));
|
|
19216
19158
|
}));
|
|
19217
19159
|
}
|
|
@@ -20387,8 +20329,7 @@ function focusSheetCellEditorElement(ownerDocument = document) {
|
|
|
20387
20329
|
return ownerDocument.activeElement === element;
|
|
20388
20330
|
}
|
|
20389
20331
|
function registerSheetCellEditorRuntimePortal(options) {
|
|
20390
|
-
|
|
20391
|
-
const ownerDocument = (_options$ownerDocumen = options.ownerDocument) !== null && _options$ownerDocumen !== void 0 ? _options$ownerDocumen : typeof document === "undefined" ? void 0 : document;
|
|
20332
|
+
const ownerDocument = options.ownerDocument ?? (typeof document === "undefined" ? void 0 : document);
|
|
20392
20333
|
if (!ownerDocument) return toDisposable(() => {});
|
|
20393
20334
|
const collection = new DisposableCollection();
|
|
20394
20335
|
const view = ownerDocument.defaultView;
|
|
@@ -20458,8 +20399,7 @@ function registerSheetCellEditorRuntimePortal(options) {
|
|
|
20458
20399
|
return collection;
|
|
20459
20400
|
}
|
|
20460
20401
|
function resolveSheetCellEditorPortalRoot(ownerDocument = document) {
|
|
20461
|
-
|
|
20462
|
-
return (_ref = ownerDocument.getElementById(SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID)) !== null && _ref !== void 0 ? _ref : ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
|
|
20402
|
+
return ownerDocument.getElementById(SHEET_CELL_EDITOR_SELECTION_CONTAINER_ID) ?? ownerDocument.getElementById(SHEET_CELL_EDITOR_ELEMENT_ID);
|
|
20463
20403
|
}
|
|
20464
20404
|
|
|
20465
20405
|
//#endregion
|
|
@@ -20548,27 +20488,27 @@ function isEmbedRuntimeInteractiveElement(element) {
|
|
|
20548
20488
|
return role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20549
20489
|
}
|
|
20550
20490
|
function shouldPreserveEmbedPopupFocus(embedId, ownerDocument) {
|
|
20551
|
-
var _activeElement$
|
|
20491
|
+
var _activeElement$closes;
|
|
20552
20492
|
if (!embedId) return false;
|
|
20553
20493
|
const activeElement = ownerDocument.activeElement;
|
|
20554
20494
|
if (!(activeElement instanceof HTMLElement)) return false;
|
|
20555
20495
|
if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
|
|
20556
|
-
const role =
|
|
20496
|
+
const role = activeElement.getAttribute("data-embed-runtime-focus-role") ?? ((_activeElement$closes = activeElement.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _activeElement$closes === void 0 ? void 0 : _activeElement$closes.getAttribute("data-embed-runtime-focus-role"));
|
|
20557
20497
|
return role === "child-popup" || role === "floating-menu";
|
|
20558
20498
|
}
|
|
20559
20499
|
function shouldPreserveEmbedInteractiveFocus(embedId, ownerDocument) {
|
|
20560
|
-
var _activeElement$
|
|
20500
|
+
var _activeElement$closes2;
|
|
20561
20501
|
if (!embedId) return false;
|
|
20562
20502
|
const activeElement = ownerDocument.activeElement;
|
|
20563
20503
|
if (!(activeElement instanceof HTMLElement)) return false;
|
|
20564
20504
|
if (!activeElement.closest(`[${"data-embed-interaction-boundary-owner"}="${embedId}"]`)) return false;
|
|
20565
|
-
const role =
|
|
20505
|
+
const role = activeElement.getAttribute("data-embed-runtime-focus-role") ?? ((_activeElement$closes2 = activeElement.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _activeElement$closes2 === void 0 ? void 0 : _activeElement$closes2.getAttribute("data-embed-runtime-focus-role"));
|
|
20566
20506
|
return role == null && activeElement.tagName !== "CANVAS" || role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20567
20507
|
}
|
|
20568
20508
|
function isEmbedRuntimeEditorOrPopup(target) {
|
|
20569
|
-
var _target$
|
|
20509
|
+
var _target$closest;
|
|
20570
20510
|
if (!(target instanceof HTMLElement)) return false;
|
|
20571
|
-
const role =
|
|
20511
|
+
const role = target.getAttribute("data-embed-runtime-focus-role") ?? ((_target$closest = target.closest(`[${"data-embed-runtime-focus-role"}]`)) === null || _target$closest === void 0 ? void 0 : _target$closest.getAttribute("data-embed-runtime-focus-role"));
|
|
20572
20512
|
return role === "child-editor" || role === "child-popup" || role === "floating-menu";
|
|
20573
20513
|
}
|
|
20574
20514
|
/**
|
|
@@ -20586,6 +20526,7 @@ function EditorContainer() {
|
|
|
20586
20526
|
const componentManager = useDependency(ComponentManager);
|
|
20587
20527
|
const editorBridgeService = useDependency(IEditorBridgeService);
|
|
20588
20528
|
const cellEditorResizeService = useDependency(SheetCellEditorResizeService);
|
|
20529
|
+
const renderManagerService = useDependency(IRenderManagerService);
|
|
20589
20530
|
const rootRef = useRef(null);
|
|
20590
20531
|
const pointerRefocusTimerRef = useRef(void 0);
|
|
20591
20532
|
const visible = useObservable(editorBridgeService.visible$);
|
|
@@ -20594,6 +20535,9 @@ function EditorContainer() {
|
|
|
20594
20535
|
const FormulaEditor = componentManager.get(EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY);
|
|
20595
20536
|
const editState = useObservable(editorBridgeService.currentEditCellState$);
|
|
20596
20537
|
const darkMode = useObservable(themeService.darkMode$, themeService.darkMode);
|
|
20538
|
+
const [showEditCellAddress, setShowEditCellAddress] = useState(false);
|
|
20539
|
+
const editCellAddress = editState ? `${numberToABC(editState.column)}${editState.row + 1}` : null;
|
|
20540
|
+
const editorBorderColor = genNormalSelectionStyle(themeService).stroke;
|
|
20597
20541
|
const focusCoordinator = injector.has(ISheetEmbedRuntimeFocusCoordinator) ? injector.get(ISheetEmbedRuntimeFocusCoordinator) : void 0;
|
|
20598
20542
|
const resolveRuntimeFocusState = () => {
|
|
20599
20543
|
var _instanceService$getF;
|
|
@@ -20610,6 +20554,24 @@ function EditorContainer() {
|
|
|
20610
20554
|
instanceService,
|
|
20611
20555
|
visible === null || visible === void 0 ? void 0 : visible.unitId
|
|
20612
20556
|
]);
|
|
20557
|
+
useEffect(() => {
|
|
20558
|
+
var _renderManagerService;
|
|
20559
|
+
setShowEditCellAddress(false);
|
|
20560
|
+
if (!(visible === null || visible === void 0 ? void 0 : visible.visible) || !(editState === null || editState === void 0 ? void 0 : editState.unitId)) return;
|
|
20561
|
+
const scrollManagerService = (_renderManagerService = renderManagerService.getRenderUnitById(editState.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(SheetScrollManagerService);
|
|
20562
|
+
if (!scrollManagerService) return;
|
|
20563
|
+
const subscription = scrollManagerService.validViewportScrollInfo$.pipe(skip(1)).subscribe((scrollInfo) => {
|
|
20564
|
+
if (scrollInfo) setShowEditCellAddress(true);
|
|
20565
|
+
});
|
|
20566
|
+
return () => subscription.unsubscribe();
|
|
20567
|
+
}, [
|
|
20568
|
+
editState === null || editState === void 0 ? void 0 : editState.column,
|
|
20569
|
+
editState === null || editState === void 0 ? void 0 : editState.row,
|
|
20570
|
+
editState === null || editState === void 0 ? void 0 : editState.sheetId,
|
|
20571
|
+
editState === null || editState === void 0 ? void 0 : editState.unitId,
|
|
20572
|
+
renderManagerService,
|
|
20573
|
+
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20574
|
+
]);
|
|
20613
20575
|
useEffect(() => {
|
|
20614
20576
|
const subscription = cellEditorManagerService.state$.subscribe((param) => {
|
|
20615
20577
|
if (param == null) return;
|
|
@@ -20646,18 +20608,17 @@ function EditorContainer() {
|
|
|
20646
20608
|
if (!disableAutoFocus) cellEditorManagerService.setFocus(true);
|
|
20647
20609
|
}, [disableAutoFocus, state]);
|
|
20648
20610
|
useEffect(() => {
|
|
20649
|
-
var _rootRef$current
|
|
20611
|
+
var _rootRef$current;
|
|
20650
20612
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
|
|
20651
20613
|
cellEditorResizeService.fitTextSize();
|
|
20652
20614
|
if (contextService.getContextValue(FOCUSING_FX_BAR_EDITOR)) return;
|
|
20653
|
-
const ownerDocument = (
|
|
20654
|
-
const ownerWindow =
|
|
20615
|
+
const ownerDocument = ((_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.ownerDocument) ?? document;
|
|
20616
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
20655
20617
|
let focusRetryFrame = 0;
|
|
20656
20618
|
let finalFocusRetryFrame = 0;
|
|
20657
20619
|
let delayedFocusTimer;
|
|
20658
20620
|
const focusCellEditorElement = () => {
|
|
20659
|
-
|
|
20660
|
-
const scope = rootRef.current ? (_resolveSheetEmbedRun = resolveSheetEmbedRuntimeDomScope(rootRef.current)) !== null && _resolveSheetEmbedRun !== void 0 ? _resolveSheetEmbedRun : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20621
|
+
const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20661
20622
|
if (shouldPreserveEmbedInteractiveFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
20662
20623
|
focusSheetCellEditorElement(ownerDocument);
|
|
20663
20624
|
if (delayedFocusTimer != null) ownerWindow.clearTimeout(delayedFocusTimer);
|
|
@@ -20668,9 +20629,8 @@ function EditorContainer() {
|
|
|
20668
20629
|
}, 0);
|
|
20669
20630
|
};
|
|
20670
20631
|
const focusEditor = () => {
|
|
20671
|
-
var _resolveSheetEmbedRun2;
|
|
20672
20632
|
if (contextService.getContextValue(FOCUSING_FX_BAR_EDITOR)) return;
|
|
20673
|
-
const scope = rootRef.current ?
|
|
20633
|
+
const scope = rootRef.current ? resolveSheetEmbedRuntimeDomScope(rootRef.current) ?? resolveActiveSheetEmbedRuntimeDomScope(ownerDocument) : resolveActiveSheetEmbedRuntimeDomScope(ownerDocument);
|
|
20674
20634
|
if (shouldPreserveEmbedPopupFocus(scope === null || scope === void 0 ? void 0 : scope.embedId, ownerDocument)) return;
|
|
20675
20635
|
const editor = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20676
20636
|
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(DocSelectionRenderService);
|
|
@@ -20693,7 +20653,6 @@ function EditorContainer() {
|
|
|
20693
20653
|
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20694
20654
|
]);
|
|
20695
20655
|
useEffect(() => {
|
|
20696
|
-
var _ref;
|
|
20697
20656
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible) || !rootRef.current || !focusCoordinator) return;
|
|
20698
20657
|
const rootRuntimeScope = resolveSheetEmbedRuntimeDomScope(rootRef.current);
|
|
20699
20658
|
const unitRuntimeScope = [
|
|
@@ -20703,9 +20662,9 @@ function EditorContainer() {
|
|
|
20703
20662
|
].find((resolvedScope) => resolvedScope != null);
|
|
20704
20663
|
if (rootRuntimeScope && unitRuntimeScope && rootRuntimeScope.embedId !== unitRuntimeScope.embedId) return;
|
|
20705
20664
|
const activeSessionScope = runtimeFocusState.activeSessionScope;
|
|
20706
|
-
const explicitRuntimeScope = unitRuntimeScope
|
|
20665
|
+
const explicitRuntimeScope = unitRuntimeScope ?? rootRuntimeScope;
|
|
20707
20666
|
if (activeSessionScope && rootRuntimeScope && !unitRuntimeScope && rootRuntimeScope.embedId !== activeSessionScope.embedId) return;
|
|
20708
|
-
const scope =
|
|
20667
|
+
const scope = explicitRuntimeScope ?? activeSessionScope ?? resolveActiveSheetEmbedRuntimeDomScope(rootRef.current.ownerDocument);
|
|
20709
20668
|
if (!scope) return;
|
|
20710
20669
|
const collection = new DisposableCollection();
|
|
20711
20670
|
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
@@ -20765,12 +20724,12 @@ function EditorContainer() {
|
|
|
20765
20724
|
visible === null || visible === void 0 ? void 0 : visible.visible
|
|
20766
20725
|
]);
|
|
20767
20726
|
useEffect(() => {
|
|
20768
|
-
var _rootRef$
|
|
20727
|
+
var _rootRef$current2;
|
|
20769
20728
|
if ((visible === null || visible === void 0 ? void 0 : visible.visible) || !focusCoordinator) return;
|
|
20770
20729
|
const activeSessionScope = runtimeFocusState.activeSessionScope;
|
|
20771
20730
|
const childUnitId = activeSessionScope === null || activeSessionScope === void 0 ? void 0 : activeSessionScope.childUnitId;
|
|
20772
20731
|
if (!activeSessionScope || activeSessionScope.childType !== UniverInstanceType.UNIVER_SHEET || !childUnitId || !instanceService.getUnit(childUnitId, UniverInstanceType.UNIVER_SHEET)) return;
|
|
20773
|
-
const ownerDocument = (
|
|
20732
|
+
const ownerDocument = ((_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.ownerDocument) ?? document;
|
|
20774
20733
|
const interactionBoundaryService = injector.has(ISheetEmbedInteractionBoundaryService) ? injector.get(ISheetEmbedInteractionBoundaryService) : void 0;
|
|
20775
20734
|
const portalRegistration = registerSheetCellEditorRuntimePortal({
|
|
20776
20735
|
embedId: activeSessionScope.embedId,
|
|
@@ -20778,7 +20737,7 @@ function EditorContainer() {
|
|
|
20778
20737
|
interactionBoundaryService,
|
|
20779
20738
|
focusCoordinator
|
|
20780
20739
|
});
|
|
20781
|
-
const ownerWindow =
|
|
20740
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
20782
20741
|
let delayedFocusTimer;
|
|
20783
20742
|
const focusCellEditorElement = () => {
|
|
20784
20743
|
if (shouldPreserveEmbedInteractiveFocus(activeSessionScope.embedId, ownerDocument)) return;
|
|
@@ -20839,10 +20798,10 @@ function EditorContainer() {
|
|
|
20839
20798
|
};
|
|
20840
20799
|
}, []);
|
|
20841
20800
|
const refocusEditorAfterPointerDown = useEvent((event) => {
|
|
20842
|
-
var _rootRef$
|
|
20801
|
+
var _rootRef$current4;
|
|
20843
20802
|
if (!(visible === null || visible === void 0 ? void 0 : visible.visible)) return;
|
|
20844
|
-
const ownerDocument = (
|
|
20845
|
-
const ownerWindow =
|
|
20803
|
+
const ownerDocument = ((_rootRef$current4 = rootRef.current) === null || _rootRef$current4 === void 0 ? void 0 : _rootRef$current4.ownerDocument) ?? document;
|
|
20804
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
20846
20805
|
const editor = editorService.getEditor(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
|
|
20847
20806
|
const docSelectionRenderService = editor === null || editor === void 0 ? void 0 : editor.render.with(DocSelectionRenderService);
|
|
20848
20807
|
const pointerTarget = event.target;
|
|
@@ -20877,7 +20836,7 @@ function EditorContainer() {
|
|
|
20877
20836
|
unitId: editState === null || editState === void 0 ? void 0 : editState.unitId
|
|
20878
20837
|
});
|
|
20879
20838
|
});
|
|
20880
|
-
return /* @__PURE__ */
|
|
20839
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
20881
20840
|
ref: rootRef,
|
|
20882
20841
|
"data-u-comp": "editor",
|
|
20883
20842
|
className: "univer-absolute univer-z-10 univer-flex",
|
|
@@ -20892,7 +20851,16 @@ function EditorContainer() {
|
|
|
20892
20851
|
getColorFromTheme: themeService.getColorFromTheme.bind(themeService)
|
|
20893
20852
|
})
|
|
20894
20853
|
},
|
|
20895
|
-
children:
|
|
20854
|
+
children: [(visible === null || visible === void 0 ? void 0 : visible.visible) && showEditCellAddress && editCellAddress && /* @__PURE__ */ jsx("div", {
|
|
20855
|
+
"data-u-comp": "sheet-cell-editor-address",
|
|
20856
|
+
className: "univer-pointer-events-none univer-absolute univer-left-0 univer-top-0 univer-z-10 univer-whitespace-nowrap univer-rounded-t univer-px-1.5 univer-text-xs univer-leading-5",
|
|
20857
|
+
style: {
|
|
20858
|
+
backgroundColor: editorBorderColor,
|
|
20859
|
+
color: themeService.getColorFromTheme("white"),
|
|
20860
|
+
transform: "translateY(-100%)"
|
|
20861
|
+
},
|
|
20862
|
+
children: editCellAddress
|
|
20863
|
+
}), FormulaEditor && /* @__PURE__ */ jsx(FormulaEditor, {
|
|
20896
20864
|
editorId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
20897
20865
|
className: "univer-relative univer-flex univer-size-full [&_canvas]:univer-absolute",
|
|
20898
20866
|
initValue: "",
|
|
@@ -20912,7 +20880,7 @@ function EditorContainer() {
|
|
|
20912
20880
|
},
|
|
20913
20881
|
disableContextMenu: false,
|
|
20914
20882
|
canvasStyle: { backgroundColor: "transparent" }
|
|
20915
|
-
})
|
|
20883
|
+
})]
|
|
20916
20884
|
});
|
|
20917
20885
|
}
|
|
20918
20886
|
|
|
@@ -21256,7 +21224,7 @@ function DefinedName({ disable }) {
|
|
|
21256
21224
|
//#endregion
|
|
21257
21225
|
//#region src/views/formula-bar/FormulaBar.tsx
|
|
21258
21226
|
function FormulaBar(props) {
|
|
21259
|
-
var
|
|
21227
|
+
var _editState$documentLa;
|
|
21260
21228
|
const { className, disableDefinedName } = props;
|
|
21261
21229
|
const editorBridgeService = useDependency(IEditorBridgeService);
|
|
21262
21230
|
const iconActivated = useObservable(() => editorBridgeService.visible$.pipe(map((visibleInfo) => visibleInfo.visible)), false, false, [editorBridgeService]);
|
|
@@ -21307,21 +21275,20 @@ function FormulaBar(props) {
|
|
|
21307
21275
|
}));
|
|
21308
21276
|
}), map((cellInfo) => {
|
|
21309
21277
|
if (cellInfo) {
|
|
21310
|
-
var _cellInfoWithPermissi, _cellInfoWithPermissi2;
|
|
21311
21278
|
const { unitId, subUnitId, primary } = cellInfo;
|
|
21312
21279
|
if (worksheetProtectionRuleModel.getRule(unitId, subUnitId)) {
|
|
21313
|
-
var _permissionService$ge, _permissionService$ge2
|
|
21314
|
-
const editDisable = !((_permissionService$ge =
|
|
21280
|
+
var _permissionService$ge, _permissionService$ge2;
|
|
21281
|
+
const editDisable = !(((_permissionService$ge = permissionService.getPermissionPoint(new WorksheetEditPermission(unitId, subUnitId).id)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) ?? true);
|
|
21315
21282
|
return {
|
|
21316
|
-
viewDisable: !((
|
|
21283
|
+
viewDisable: !(((_permissionService$ge2 = permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)) === null || _permissionService$ge2 === void 0 ? void 0 : _permissionService$ge2.value) ?? true),
|
|
21317
21284
|
editDisable
|
|
21318
21285
|
};
|
|
21319
21286
|
}
|
|
21320
21287
|
const { actualRow, actualColumn } = primary;
|
|
21321
21288
|
const cellInfoWithPermission = rangeProtectionCache.getCellInfo(unitId, subUnitId, actualRow, actualColumn);
|
|
21322
21289
|
return {
|
|
21323
|
-
editDisable: !((
|
|
21324
|
-
viewDisable: !((
|
|
21290
|
+
editDisable: !((cellInfoWithPermission === null || cellInfoWithPermission === void 0 ? void 0 : cellInfoWithPermission[UnitAction.Edit]) ?? true),
|
|
21291
|
+
viewDisable: !((cellInfoWithPermission === null || cellInfoWithPermission === void 0 ? void 0 : cellInfoWithPermission[UnitAction.View]) ?? true)
|
|
21325
21292
|
};
|
|
21326
21293
|
}
|
|
21327
21294
|
return {
|
|
@@ -21379,7 +21346,7 @@ function FormulaBar(props) {
|
|
|
21379
21346
|
}
|
|
21380
21347
|
const { viewDisable, editDisable: permissionEditDisable } = disableInfo;
|
|
21381
21348
|
const editDisable = permissionEditDisable || !!disableEdit;
|
|
21382
|
-
const workbookEditDisable = !((
|
|
21349
|
+
const workbookEditDisable = !((workbookEditablePermission === null || workbookEditablePermission === void 0 ? void 0 : workbookEditablePermission.value) ?? true);
|
|
21383
21350
|
const editorActivationDisable = editDisable || workbookEditDisable;
|
|
21384
21351
|
const disabled = editDisable || imageDisable;
|
|
21385
21352
|
const shouldSkipFocus = useRef(false);
|
|
@@ -21412,7 +21379,7 @@ function FormulaBar(props) {
|
|
|
21412
21379
|
}, 30);
|
|
21413
21380
|
shouldSkipFocus.current = false;
|
|
21414
21381
|
};
|
|
21415
|
-
const hideEditor = (
|
|
21382
|
+
const hideEditor = isCellImage(editState === null || editState === void 0 || (_editState$documentLa = editState.documentLayoutObject.documentModel) === null || _editState$documentLa === void 0 ? void 0 : _editState$documentLa.getSnapshot()) || viewDisable;
|
|
21416
21383
|
return /* @__PURE__ */ jsxs("div", {
|
|
21417
21384
|
"data-u-comp": "formula-bar",
|
|
21418
21385
|
className: clsx("univer-box-border univer-flex univer-bg-white univer-transition-[height] univer-ease-linear dark:!univer-bg-gray-800", borderBottomClassName, className, {
|
|
@@ -21423,7 +21390,7 @@ function FormulaBar(props) {
|
|
|
21423
21390
|
children: [
|
|
21424
21391
|
/* @__PURE__ */ jsx("div", {
|
|
21425
21392
|
className: "univer-relative univer-box-border univer-h-full univer-w-[100px]",
|
|
21426
|
-
children: /* @__PURE__ */ jsx(DefinedName, { disable: disableDefinedName
|
|
21393
|
+
children: /* @__PURE__ */ jsx(DefinedName, { disable: disableDefinedName ?? editDisable })
|
|
21427
21394
|
}),
|
|
21428
21395
|
/* @__PURE__ */ jsxs("div", {
|
|
21429
21396
|
className: "univer-flex univer-size-full",
|
|
@@ -21629,7 +21596,7 @@ function SheetBarItem(props) {
|
|
|
21629
21596
|
"data-id": sheetId,
|
|
21630
21597
|
role: "tab",
|
|
21631
21598
|
"aria-selected": currentSelected,
|
|
21632
|
-
tabIndex: tabIndex
|
|
21599
|
+
tabIndex: tabIndex ?? (currentSelected ? 0 : -1),
|
|
21633
21600
|
onKeyDown,
|
|
21634
21601
|
onClick,
|
|
21635
21602
|
className: clsx("univer-mx-1 univer-box-border univer-flex univer-flex-grow univer-cursor-pointer univer-select-none univer-flex-row univer-items-center univer-rounded univer-text-xs univer-transition-[colors,box-shadow] focus-visible:univer-ring-2 focus-visible:univer-ring-primary-500", {
|
|
@@ -21667,9 +21634,8 @@ function SheetBarTabsContextMenu(props) {
|
|
|
21667
21634
|
menuOffset: MENU_OFFSET,
|
|
21668
21635
|
onRequestClose: () => onVisibleChange(false),
|
|
21669
21636
|
onOptionSelect: (option) => {
|
|
21670
|
-
var _ref;
|
|
21671
21637
|
const { label, id, commandId, value } = option;
|
|
21672
|
-
onCommandSelect(
|
|
21638
|
+
onCommandSelect(commandId ?? id ?? label, value);
|
|
21673
21639
|
}
|
|
21674
21640
|
})] });
|
|
21675
21641
|
}
|
|
@@ -21833,8 +21799,7 @@ var Animate = class {
|
|
|
21833
21799
|
//#region src/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-name-editor.ts
|
|
21834
21800
|
const MAX_SHEET_NAME_LENGTH = 31;
|
|
21835
21801
|
function getEditorText(input) {
|
|
21836
|
-
|
|
21837
|
-
return (_input$textContent = input.textContent) !== null && _input$textContent !== void 0 ? _input$textContent : "";
|
|
21802
|
+
return input.textContent ?? "";
|
|
21838
21803
|
}
|
|
21839
21804
|
function keepLastTextIndex(inputHtml) {
|
|
21840
21805
|
setTimeout(() => {
|
|
@@ -22017,10 +21982,9 @@ var SlideTabItem = class SlideTabItem {
|
|
|
22017
21982
|
});
|
|
22018
21983
|
}
|
|
22019
21984
|
nameCheck() {
|
|
22020
|
-
var _input$textContent;
|
|
22021
21985
|
const input = this._slideTabItem.querySelector("span");
|
|
22022
21986
|
if (!input) return false;
|
|
22023
|
-
const text =
|
|
21987
|
+
const text = input.textContent ?? "";
|
|
22024
21988
|
return this._slideTabBar.getConfig().onNameCheckAlert(text, this.getId());
|
|
22025
21989
|
}
|
|
22026
21990
|
animate() {
|
|
@@ -22140,23 +22104,21 @@ var SlideTabItem = class SlideTabItem {
|
|
|
22140
22104
|
var SlideScrollbar = class {
|
|
22141
22105
|
constructor(slideTabBar) {
|
|
22142
22106
|
_defineProperty(this, "_slideTabBar", void 0);
|
|
22143
|
-
_defineProperty(this, "_scrollX", void 0);
|
|
22144
|
-
const primeval = slideTabBar.primeval();
|
|
22145
|
-
this._scrollX = primeval.scrollLeft;
|
|
22146
22107
|
this._slideTabBar = slideTabBar;
|
|
22147
22108
|
}
|
|
22148
22109
|
scrollX(x) {
|
|
22110
|
+
var _primeval$parentEleme;
|
|
22149
22111
|
const primeval = this._slideTabBar.primeval();
|
|
22150
|
-
primeval.
|
|
22151
|
-
|
|
22112
|
+
const viewportWidth = ((_primeval$parentEleme = primeval.parentElement) === null || _primeval$parentEleme === void 0 ? void 0 : _primeval$parentEleme.clientWidth) ?? primeval.clientWidth;
|
|
22113
|
+
const maxScrollX = Math.max(0, primeval.scrollWidth - viewportWidth);
|
|
22114
|
+
primeval.scrollLeft = Math.min(maxScrollX, Math.max(0, x));
|
|
22152
22115
|
}
|
|
22153
22116
|
scrollRight() {
|
|
22154
22117
|
const primeval = this._slideTabBar.primeval();
|
|
22155
|
-
|
|
22156
|
-
this._scrollX = primeval.scrollLeft;
|
|
22118
|
+
this.scrollX(primeval.scrollWidth);
|
|
22157
22119
|
}
|
|
22158
22120
|
getScrollX() {
|
|
22159
|
-
return this.
|
|
22121
|
+
return this._slideTabBar.primeval().scrollLeft;
|
|
22160
22122
|
}
|
|
22161
22123
|
};
|
|
22162
22124
|
var SlideTabBar = class SlideTabBar {
|
|
@@ -22295,7 +22257,14 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22295
22257
|
}
|
|
22296
22258
|
};
|
|
22297
22259
|
this._wheelAction = (wheelEvent) => {
|
|
22298
|
-
|
|
22260
|
+
var _this$_slideTabBar$pa;
|
|
22261
|
+
const viewportWidth = ((_this$_slideTabBar$pa = this._slideTabBar.parentElement) === null || _this$_slideTabBar$pa === void 0 ? void 0 : _this$_slideTabBar$pa.clientWidth) ?? this._slideTabBar.clientWidth;
|
|
22262
|
+
if (this._slideTabBar.scrollWidth <= viewportWidth) return;
|
|
22263
|
+
const dominantDelta = Math.abs(wheelEvent.deltaX) > Math.abs(wheelEvent.deltaY) ? wheelEvent.deltaX : wheelEvent.deltaY;
|
|
22264
|
+
if (dominantDelta === 0) return;
|
|
22265
|
+
const deltaModeMultiplier = wheelEvent.deltaMode === WheelEvent.DOM_DELTA_LINE ? 16 : wheelEvent.deltaMode === WheelEvent.DOM_DELTA_PAGE ? viewportWidth : 1;
|
|
22266
|
+
wheelEvent.preventDefault();
|
|
22267
|
+
this.setScroll(dominantDelta * deltaModeMultiplier);
|
|
22299
22268
|
};
|
|
22300
22269
|
this.addListener();
|
|
22301
22270
|
}
|
|
@@ -22350,15 +22319,15 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22350
22319
|
return this._activeTabItem;
|
|
22351
22320
|
}
|
|
22352
22321
|
isLeftEnd() {
|
|
22353
|
-
return this._slideTabBar.scrollLeft
|
|
22322
|
+
return this._slideTabBar.scrollLeft <= 1;
|
|
22354
22323
|
}
|
|
22355
22324
|
isRightEnd() {
|
|
22356
22325
|
const parent = this._slideTabBar.parentElement;
|
|
22357
22326
|
if (!parent) return false;
|
|
22358
|
-
return this._slideTabBar.scrollWidth - parent.clientWidth
|
|
22327
|
+
return Math.max(0, this._slideTabBar.scrollWidth - parent.clientWidth) - this._slideTabBar.scrollLeft <= 1;
|
|
22359
22328
|
}
|
|
22360
22329
|
addListener() {
|
|
22361
|
-
this._slideTabBar.addEventListener("wheel", this._wheelAction);
|
|
22330
|
+
this._slideTabBar.addEventListener("wheel", this._wheelAction, { passive: false });
|
|
22362
22331
|
this._slideTabItems.forEach((item) => {
|
|
22363
22332
|
item.addEventListener("pointerdown", this._downAction);
|
|
22364
22333
|
});
|
|
@@ -22371,13 +22340,6 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22371
22340
|
}
|
|
22372
22341
|
setScroll(x) {
|
|
22373
22342
|
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + x);
|
|
22374
|
-
if (x > 0) {
|
|
22375
|
-
const left = this.calculateLeftScrollX();
|
|
22376
|
-
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + left);
|
|
22377
|
-
} else if (x < 0) {
|
|
22378
|
-
const right = this.calculateRightScrollX();
|
|
22379
|
-
this._slideScrollbar.scrollX(this._slideScrollbar.getScrollX() + right);
|
|
22380
|
-
}
|
|
22381
22343
|
this._config.onScroll({
|
|
22382
22344
|
leftEnd: this.isLeftEnd(),
|
|
22383
22345
|
rightEnd: this.isRightEnd()
|
|
@@ -22397,7 +22359,7 @@ var SlideTabBar = class SlideTabBar {
|
|
|
22397
22359
|
});
|
|
22398
22360
|
}
|
|
22399
22361
|
scrollToItem(index) {
|
|
22400
|
-
const targetIndex = index
|
|
22362
|
+
const targetIndex = index ?? this._config.currentIndex;
|
|
22401
22363
|
if (targetIndex < 0 || targetIndex >= this._slideTabItems.length) {
|
|
22402
22364
|
console.error("Index out of bounds");
|
|
22403
22365
|
return;
|
|
@@ -22586,7 +22548,6 @@ function shouldRefreshSheetTabs(commandInfo) {
|
|
|
22586
22548
|
}
|
|
22587
22549
|
}
|
|
22588
22550
|
function SheetBarTabs() {
|
|
22589
|
-
var _config$contextMenu;
|
|
22590
22551
|
const [sheetList, setSheetList] = useState([]);
|
|
22591
22552
|
const [activeSheetId, setActiveSheetId] = useState("");
|
|
22592
22553
|
const [scrollShadow, setScrollShadow] = useState("");
|
|
@@ -22608,7 +22569,7 @@ function SheetBarTabs() {
|
|
|
22608
22569
|
const workbookRef = useRef(workbook);
|
|
22609
22570
|
const resetOrder = useObservable(worksheetProtectionRuleModel.resetOrder$);
|
|
22610
22571
|
const config = useConfigValue(UI_PLUGIN_CONFIG_KEY);
|
|
22611
|
-
const showContextMenu = (
|
|
22572
|
+
const showContextMenu = (config === null || config === void 0 ? void 0 : config.contextMenu) ?? true;
|
|
22612
22573
|
const getActiveTabRect = useCallback(() => {
|
|
22613
22574
|
var _slideTabBarRef$curre;
|
|
22614
22575
|
const activeTabRect = (_slideTabBarRef$curre = slideTabBarRef.current) === null || _slideTabBarRef$curre === void 0 || (_slideTabBarRef$curre = _slideTabBarRef$curre.getActiveItem()) === null || _slideTabBarRef$curre === void 0 ? void 0 : _slideTabBarRef$curre.getSlideTabItem().getBoundingClientRect();
|
|
@@ -22687,7 +22648,7 @@ function SheetBarTabs() {
|
|
|
22687
22648
|
workbook
|
|
22688
22649
|
]);
|
|
22689
22650
|
const canRenameActiveSheet = useCallback(() => {
|
|
22690
|
-
var _permissionService$
|
|
22651
|
+
var _permissionService$ge2;
|
|
22691
22652
|
const unitId = workbook.getUnitId();
|
|
22692
22653
|
const activeSheet = workbook.getActiveSheet();
|
|
22693
22654
|
if (!activeSheet) return false;
|
|
@@ -22695,10 +22656,10 @@ function SheetBarTabs() {
|
|
|
22695
22656
|
const worksheetRule = worksheetProtectionRuleModel.getRule(unitId, subUnitId);
|
|
22696
22657
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(unitId, subUnitId).length > 0;
|
|
22697
22658
|
if (worksheetRule || hasSelectionRule) {
|
|
22698
|
-
var _permissionService$ge
|
|
22699
|
-
return (_permissionService$ge =
|
|
22659
|
+
var _permissionService$ge;
|
|
22660
|
+
return ((_permissionService$ge = permissionService.getPermissionPoint(new WorkbookManageCollaboratorPermission(unitId).id)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value) ?? false;
|
|
22700
22661
|
}
|
|
22701
|
-
return (
|
|
22662
|
+
return ((_permissionService$ge2 = permissionService.getPermissionPoint(new WorkbookRenameSheetPermission(unitId).id)) === null || _permissionService$ge2 === void 0 ? void 0 : _permissionService$ge2.value) ?? false;
|
|
22702
22663
|
}, [
|
|
22703
22664
|
permissionService,
|
|
22704
22665
|
rangeProtectionRuleModel,
|
|
@@ -22706,11 +22667,9 @@ function SheetBarTabs() {
|
|
|
22706
22667
|
worksheetProtectionRuleModel
|
|
22707
22668
|
]);
|
|
22708
22669
|
const updateSheetItems = useCallback(() => {
|
|
22709
|
-
var _activeSheet$getSheet;
|
|
22710
22670
|
const activeSheet = workbook.getActiveSheet();
|
|
22711
|
-
const currentSubUnitId = (
|
|
22671
|
+
const currentSubUnitId = (activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.getSheetId()) ?? "";
|
|
22712
22672
|
const sheetListItems = workbook.getSheets().filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
22713
|
-
var _sheet$getTabColor;
|
|
22714
22673
|
const worksheetRule = worksheetProtectionRuleModel.getRule(workbook.getUnitId(), sheet.getSheetId());
|
|
22715
22674
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(workbook.getUnitId(), sheet.getSheetId()).length > 0;
|
|
22716
22675
|
const hasProtection = Boolean((worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) || hasSelectionRule);
|
|
@@ -22725,7 +22684,7 @@ function SheetBarTabs() {
|
|
|
22725
22684
|
}),
|
|
22726
22685
|
index,
|
|
22727
22686
|
selected: activeSheet === sheet,
|
|
22728
|
-
color:
|
|
22687
|
+
color: sheet.getTabColor() ?? void 0
|
|
22729
22688
|
};
|
|
22730
22689
|
});
|
|
22731
22690
|
setSheetList(sheetListItems);
|
|
@@ -22853,7 +22812,7 @@ function SheetBarTabs() {
|
|
|
22853
22812
|
workbook
|
|
22854
22813
|
]);
|
|
22855
22814
|
const onTabListKeyDown = useCallback((event) => {
|
|
22856
|
-
var _slideTabBarContainer2
|
|
22815
|
+
var _slideTabBarContainer2;
|
|
22857
22816
|
const target = event.target;
|
|
22858
22817
|
if (target.closest("[contenteditable=true]")) return;
|
|
22859
22818
|
const currentTab = target.closest("[data-u-comp=slide-tab-item]");
|
|
@@ -22868,7 +22827,7 @@ function SheetBarTabs() {
|
|
|
22868
22827
|
return;
|
|
22869
22828
|
}
|
|
22870
22829
|
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
|
|
22871
|
-
const tabItems = Array.from((_slideTabBarContainer2 =
|
|
22830
|
+
const tabItems = Array.from(((_slideTabBarContainer2 = slideTabBarContainerRef.current) === null || _slideTabBarContainer2 === void 0 ? void 0 : _slideTabBarContainer2.querySelectorAll("[data-u-comp=slide-tab-item]")) ?? []);
|
|
22872
22831
|
const currentIndex = tabItems.findIndex((tabItem) => tabItem.dataset.id === currentSheetId);
|
|
22873
22832
|
if (currentIndex < 0) return;
|
|
22874
22833
|
event.preventDefault();
|
|
@@ -22978,13 +22937,12 @@ function SheetBarTabs() {
|
|
|
22978
22937
|
}, [activeSheetId, sheetList]);
|
|
22979
22938
|
useEffect(() => {
|
|
22980
22939
|
const handlePointerDownCapture = (event) => {
|
|
22981
|
-
var _tabElement$getAttrib;
|
|
22982
22940
|
const container = slideTabBarContainerRef.current;
|
|
22983
22941
|
const target = event.target;
|
|
22984
22942
|
if (!container || !(target instanceof Element)) return;
|
|
22985
22943
|
const tabElement = target.closest("[data-u-comp=slide-tab-item]");
|
|
22986
22944
|
if (!tabElement || !container.contains(tabElement)) return;
|
|
22987
|
-
activateSheetTab(
|
|
22945
|
+
activateSheetTab(tabElement.getAttribute("data-id") ?? void 0);
|
|
22988
22946
|
};
|
|
22989
22947
|
document.addEventListener("pointerdown", handlePointerDownCapture, true);
|
|
22990
22948
|
return () => document.removeEventListener("pointerdown", handlePointerDownCapture, true);
|
|
@@ -23261,12 +23219,12 @@ const StatusBar = () => {
|
|
|
23261
23219
|
}
|
|
23262
23220
|
setShow(true);
|
|
23263
23221
|
setStatistics((prevStats) => prevStats.map((stat) => {
|
|
23264
|
-
var _items$find
|
|
23222
|
+
var _items$find;
|
|
23265
23223
|
return {
|
|
23266
23224
|
...stat,
|
|
23267
|
-
value: (
|
|
23225
|
+
value: ((_items$find = items.find((i) => i.func === stat.name)) === null || _items$find === void 0 ? void 0 : _items$find.value) ?? stat.value,
|
|
23268
23226
|
disable: !items.some((i) => i.func === stat.name),
|
|
23269
|
-
pattern: (
|
|
23227
|
+
pattern: (state === null || state === void 0 ? void 0 : state.pattern) ?? null
|
|
23270
23228
|
};
|
|
23271
23229
|
}));
|
|
23272
23230
|
}, []);
|
|
@@ -23321,13 +23279,11 @@ const StatusBar = () => {
|
|
|
23321
23279
|
//#region src/views/sheet-container/SheetContainer.tsx
|
|
23322
23280
|
const SHEET_FOOTER_BAR_HEIGHT = 36;
|
|
23323
23281
|
function RenderSheetFooter() {
|
|
23324
|
-
var _config$footer;
|
|
23325
23282
|
const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23326
23283
|
const menuManagerService = useDependency(IMenuManagerService);
|
|
23327
|
-
const showFooter = (
|
|
23284
|
+
const showFooter = (config === null || config === void 0 ? void 0 : config.footer) ?? true;
|
|
23328
23285
|
const activeWorkbook = useActiveWorkbook();
|
|
23329
|
-
const
|
|
23330
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23286
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23331
23287
|
const isLoading = useSheetLoading();
|
|
23332
23288
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23333
23289
|
const focusedUnitType = useFocusedUnitType();
|
|
@@ -23366,8 +23322,7 @@ function RenderSheetFooter() {
|
|
|
23366
23322
|
function RenderSheetHeader() {
|
|
23367
23323
|
const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23368
23324
|
const activeWorkbook = useActiveWorkbook();
|
|
23369
|
-
const
|
|
23370
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23325
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23371
23326
|
const isLoading = useSheetLoading();
|
|
23372
23327
|
const hasWorkbook = !!workbook;
|
|
23373
23328
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
@@ -23395,18 +23350,16 @@ function RenderSheetHeader() {
|
|
|
23395
23350
|
* We should not write into this component anymore.
|
|
23396
23351
|
*/
|
|
23397
23352
|
function RenderSheetContent() {
|
|
23398
|
-
var _componentManager$get;
|
|
23399
23353
|
const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23400
23354
|
const isLoading = useSheetLoading();
|
|
23401
23355
|
const isPreviewReady = useSheetLoadingPreviewReady();
|
|
23402
23356
|
const componentManager = useDependency(ComponentManager);
|
|
23403
23357
|
const activeWorkbook = useActiveWorkbook();
|
|
23404
|
-
const
|
|
23405
|
-
const workbook = loadingWorkbook !== null && loadingWorkbook !== void 0 ? loadingWorkbook : activeWorkbook;
|
|
23358
|
+
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23406
23359
|
const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
|
|
23407
23360
|
const injector = useDependency(Injector);
|
|
23408
23361
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23409
|
-
const ShapeTextEditorContainer =
|
|
23362
|
+
const ShapeTextEditorContainer = componentManager.get("SheetShapeTextEditorContainer") ?? componentManager.get("ShapeTextEditorContainer");
|
|
23410
23363
|
useEffect(() => {
|
|
23411
23364
|
var _tryGetSheetEmbedRunt;
|
|
23412
23365
|
if (!workbook || isLoading || activeEmbedTab || activeWorkbookEmbeddedRender) return;
|
|
@@ -23516,11 +23469,10 @@ function useFocusedUnitType() {
|
|
|
23516
23469
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
23517
23470
|
const focusedUnitId = useObservable(() => univerInstanceService.focused$, null, false, [univerInstanceService]);
|
|
23518
23471
|
return useMemo(() => {
|
|
23519
|
-
var _focusedUnit$type;
|
|
23520
23472
|
if (!focusedUnitId) return null;
|
|
23521
23473
|
if (isInternalEditorID(focusedUnitId) && univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) return UniverInstanceType.UNIVER_SHEET;
|
|
23522
23474
|
const focusedUnit = univerInstanceService.getUnit(focusedUnitId);
|
|
23523
|
-
return (
|
|
23475
|
+
return (focusedUnit === null || focusedUnit === void 0 ? void 0 : focusedUnit.type) ?? null;
|
|
23524
23476
|
}, [focusedUnitId, univerInstanceService]);
|
|
23525
23477
|
}
|
|
23526
23478
|
function useActiveSheetEmbedTabData(workbook) {
|
|
@@ -24146,7 +24098,7 @@ const useHighlightRange = (ranges = []) => {
|
|
|
24146
24098
|
//#endregion
|
|
24147
24099
|
//#region package.json
|
|
24148
24100
|
var name = "@univerjs/sheets-ui";
|
|
24149
|
-
var version = "1.0.0-
|
|
24101
|
+
var version = "1.0.0-beta.0";
|
|
24150
24102
|
|
|
24151
24103
|
//#endregion
|
|
24152
24104
|
//#region src/views/cell-popup/config.ts
|
|
@@ -24239,13 +24191,12 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24239
24191
|
_createHiddenRectObserver(params) {
|
|
24240
24192
|
const { row, column, worksheet, skeleton, currentRender } = params;
|
|
24241
24193
|
const calc = () => {
|
|
24242
|
-
var _columnWidthAccumulat, _rowHeightAccumulatio;
|
|
24243
24194
|
const { startRow: freezeStartRow, startColumn: freezeStartColumn, xSplit, ySplit } = worksheet.getFreeze();
|
|
24244
24195
|
const startRow = freezeStartRow - ySplit;
|
|
24245
24196
|
const startColumn = freezeStartColumn - xSplit;
|
|
24246
24197
|
const { rowHeightAccumulation, columnWidthAccumulation, rowHeaderWidth, columnHeaderHeight } = skeleton;
|
|
24247
|
-
const canvasFreezeWidth = rowHeaderWidth + (startColumn === -1 ? 0 : columnWidthAccumulation[startColumn + xSplit - 1] - (
|
|
24248
|
-
const canvasFreezeHeight = columnHeaderHeight + (startRow === -1 ? 0 : rowHeightAccumulation[startRow + ySplit - 1] - (
|
|
24198
|
+
const canvasFreezeWidth = rowHeaderWidth + (startColumn === -1 ? 0 : columnWidthAccumulation[startColumn + xSplit - 1] - (columnWidthAccumulation[startColumn - 1] ?? 0));
|
|
24199
|
+
const canvasFreezeHeight = columnHeaderHeight + (startRow === -1 ? 0 : rowHeightAccumulation[startRow + ySplit - 1] - (rowHeightAccumulation[startRow] ?? 0));
|
|
24249
24200
|
const canvasElement = currentRender.engine.getCanvasElement();
|
|
24250
24201
|
const canvasClientRect = canvasElement.getBoundingClientRect();
|
|
24251
24202
|
const widthOfCanvas = pxToNum(canvasElement.style.width);
|
|
@@ -24495,7 +24446,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24495
24446
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24496
24447
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
24497
24448
|
if (this._isSelectionMoving && !popup.showOnSelectionMoving) return;
|
|
24498
|
-
const activeViewport = viewport
|
|
24449
|
+
const activeViewport = viewport ?? getViewportByCell(row, col, currentRender.scene, worksheet);
|
|
24499
24450
|
if (!activeViewport) return null;
|
|
24500
24451
|
const { position, position$, disposable: positionObserverDisposable, updateRowCol } = this._createCellPositionObserver(row, col, currentRender, skeleton, activeViewport);
|
|
24501
24452
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24564,7 +24515,7 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24564
24515
|
const sheetSelectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
24565
24516
|
if (!currentRender || !skeleton || !sheetSelectionRenderService) return null;
|
|
24566
24517
|
if (sheetSelectionRenderService.selectionMoving && !showOnSelectionMoving) return;
|
|
24567
|
-
const activeViewport = viewport
|
|
24518
|
+
const activeViewport = viewport ?? getViewportByCell(range.startRow, range.startColumn, currentRender.scene, worksheet);
|
|
24568
24519
|
if (!activeViewport) return null;
|
|
24569
24520
|
const { position, position$, disposable: positionObserverDisposable, updateRange, topLeftPos$, rightBottomPos$ } = this._createRangePositionObserver(range, currentRender, skeleton, activeViewport);
|
|
24570
24521
|
const { rects$, disposable: rectsObserverDisposable } = this._createHiddenRectObserver({
|
|
@@ -24805,12 +24756,12 @@ let CellPopupManagerService = class CellPopupManagerService extends Disposable {
|
|
|
24805
24756
|
return subUnitMap;
|
|
24806
24757
|
}
|
|
24807
24758
|
showPopup(location, popup) {
|
|
24808
|
-
var _subUnitMap$getValue
|
|
24759
|
+
var _subUnitMap$getValue;
|
|
24809
24760
|
const { direction = "horizontal" } = popup;
|
|
24810
24761
|
const { unitId, subUnitId, row, col } = location;
|
|
24811
24762
|
const subUnitMap = this._ensureCellPopupMap(unitId, subUnitId);
|
|
24812
24763
|
const directionCache = (_subUnitMap$getValue = subUnitMap.getValue(row, col)) === null || _subUnitMap$getValue === void 0 ? void 0 : _subUnitMap$getValue[direction];
|
|
24813
|
-
popup.id =
|
|
24764
|
+
popup.id = popup.id ?? generateRandomId();
|
|
24814
24765
|
const hidePopup = () => {
|
|
24815
24766
|
const root = subUnitMap.getValue(row, col);
|
|
24816
24767
|
if (!root) return;
|
|
@@ -25564,7 +25515,6 @@ function getBorderStyle(borderData) {
|
|
|
25564
25515
|
}
|
|
25565
25516
|
}
|
|
25566
25517
|
function BorderPanel(props) {
|
|
25567
|
-
var _value$color;
|
|
25568
25518
|
const iconManager = useDependency(IconManager);
|
|
25569
25519
|
const borderStyleManagerService = useDependency(BorderStyleManagerService);
|
|
25570
25520
|
const selectionManagerService = useDependency(SheetsSelectionsService);
|
|
@@ -25614,7 +25564,7 @@ function BorderPanel(props) {
|
|
|
25614
25564
|
type: "button",
|
|
25615
25565
|
children: [/* @__PURE__ */ jsx(PaintBucketDoubleIcon, {
|
|
25616
25566
|
className: "univer-fill-primary-600 dark:!univer-text-white",
|
|
25617
|
-
extend: { colorChannel1: (
|
|
25567
|
+
extend: { colorChannel1: (value === null || value === void 0 ? void 0 : value.color) ?? "" }
|
|
25618
25568
|
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-white" })]
|
|
25619
25569
|
})
|
|
25620
25570
|
}) }), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Dropdown, {
|
|
@@ -25637,7 +25587,7 @@ function BorderPanel(props) {
|
|
|
25637
25587
|
type: "button",
|
|
25638
25588
|
children: [/* @__PURE__ */ jsx(BorderLine, {
|
|
25639
25589
|
className: "univer-fill-gray-900 dark:!univer-fill-white",
|
|
25640
|
-
type: type
|
|
25590
|
+
type: type ?? BorderStyleTypes.THIN
|
|
25641
25591
|
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-white" })]
|
|
25642
25592
|
})
|
|
25643
25593
|
}) })]
|
|
@@ -25773,9 +25723,8 @@ const CellPopup = (props) => {
|
|
|
25773
25723
|
"data-u-comp": "sheets-ui-cell-popup",
|
|
25774
25724
|
className: "univer-ml-px univer-flex univer-flex-col",
|
|
25775
25725
|
children: popups.map((popup) => {
|
|
25776
|
-
var _popup$id;
|
|
25777
25726
|
const Component = componentManager.get(popup.componentKey);
|
|
25778
|
-
return Component ? /* @__PURE__ */ jsx(Component, { popup },
|
|
25727
|
+
return Component ? /* @__PURE__ */ jsx(Component, { popup }, popup.id ?? popup.componentKey) : null;
|
|
25779
25728
|
})
|
|
25780
25729
|
});
|
|
25781
25730
|
};
|
|
@@ -26017,8 +25966,7 @@ const DefinedNameContainer = () => {
|
|
|
26017
25966
|
if (!workbook || !unitId) return;
|
|
26018
25967
|
const checkWorkbookPermission = permissionState.workbook;
|
|
26019
25968
|
const checkDefinedNamePermission = (definedName) => {
|
|
26020
|
-
|
|
26021
|
-
return (_permissionState$work = permissionState.worksheets.get(definedName.id)) !== null && _permissionState$work !== void 0 ? _permissionState$work : checkWorkbookPermission;
|
|
25969
|
+
return permissionState.worksheets.get(definedName.id) ?? checkWorkbookPermission;
|
|
26022
25970
|
};
|
|
26023
25971
|
const insertConfirm = (param) => {
|
|
26024
25972
|
const { name, formulaOrRefString, comment, localSheetId, hidden } = param;
|
|
@@ -26221,7 +26169,7 @@ function CascaderDropdown(props) {
|
|
|
26221
26169
|
const { popup } = props;
|
|
26222
26170
|
const { extraProps } = popup;
|
|
26223
26171
|
const { options, defaultValue, onChange } = extraProps;
|
|
26224
|
-
const [localValue, setLocalValue] = useState(defaultValue
|
|
26172
|
+
const [localValue, setLocalValue] = useState(defaultValue ?? []);
|
|
26225
26173
|
return /* @__PURE__ */ jsx(CascaderList, {
|
|
26226
26174
|
options,
|
|
26227
26175
|
value: localValue,
|
|
@@ -26266,7 +26214,7 @@ function DateDropdown(props) {
|
|
|
26266
26214
|
}
|
|
26267
26215
|
}) : /* @__PURE__ */ jsx(Calendar, {
|
|
26268
26216
|
value: date.toDate(),
|
|
26269
|
-
showTime: showTime
|
|
26217
|
+
showTime: showTime ?? patternType === "datetime",
|
|
26270
26218
|
onValueChange: (newValue) => {
|
|
26271
26219
|
setLocalDate(dateKit(newValue));
|
|
26272
26220
|
}
|
|
@@ -26419,13 +26367,12 @@ function SelectList(props) {
|
|
|
26419
26367
|
});
|
|
26420
26368
|
}
|
|
26421
26369
|
function ListDropDown(props) {
|
|
26422
|
-
var _anchorRect$right, _anchorRect$left;
|
|
26423
26370
|
const { popup: { extraProps, anchorRect } } = props;
|
|
26424
26371
|
const { location, hideFn, onChange, onEdit, options, defaultValue, multiple, showSearch, showEdit } = extraProps;
|
|
26425
26372
|
const { worksheet } = location;
|
|
26426
26373
|
const [localValue, setLocalValue] = useState(defaultValue);
|
|
26427
26374
|
if (!worksheet) return null;
|
|
26428
|
-
const cellWidth = ((
|
|
26375
|
+
const cellWidth = ((anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.right) ?? 0) - ((anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.left) ?? 0);
|
|
26429
26376
|
return /* @__PURE__ */ jsx(SelectList, {
|
|
26430
26377
|
style: {
|
|
26431
26378
|
minWidth: cellWidth,
|
|
@@ -26434,8 +26381,7 @@ function ListDropDown(props) {
|
|
|
26434
26381
|
value: getListDropdownValue(localValue, multiple),
|
|
26435
26382
|
multiple,
|
|
26436
26383
|
onChange: async (newValue) => {
|
|
26437
|
-
|
|
26438
|
-
const str = multiple ? serializeListOptions(newValue) : (_newValue$ = newValue[0]) !== null && _newValue$ !== void 0 ? _newValue$ : "";
|
|
26384
|
+
const str = multiple ? serializeListOptions(newValue) : newValue[0] ?? "";
|
|
26439
26385
|
setLocalValue(str);
|
|
26440
26386
|
if (!(await (onChange === null || onChange === void 0 ? void 0 : onChange(newValue)) === false)) hideFn();
|
|
26441
26387
|
},
|
|
@@ -26692,13 +26638,13 @@ const checkRangesIsWholeSheet = (ranges, sheet) => {
|
|
|
26692
26638
|
return startRow === 0 && startColumn === 0 && endRow === rowCount - 1 && endColumn === colCount - 1;
|
|
26693
26639
|
};
|
|
26694
26640
|
const generateDefaultRule = (injector, fromSheetBar) => {
|
|
26695
|
-
var _selectionManagerServ
|
|
26641
|
+
var _selectionManagerServ;
|
|
26696
26642
|
const univerInstanceService = injector.get(IUniverInstanceService);
|
|
26697
26643
|
const selectionManagerService = injector.get(SheetsSelectionsService);
|
|
26698
26644
|
const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
26699
26645
|
const worksheet = workbook.getActiveSheet();
|
|
26700
26646
|
let unitType = UnitObject.SelectRange;
|
|
26701
|
-
let ranges = (_selectionManagerServ =
|
|
26647
|
+
let ranges = ((_selectionManagerServ = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((s) => s.range)) ?? [];
|
|
26702
26648
|
if (fromSheetBar) {
|
|
26703
26649
|
unitType = UnitObject.Worksheet;
|
|
26704
26650
|
ranges = [{
|
|
@@ -26971,7 +26917,6 @@ const UserEmptyBase64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAADwC
|
|
|
26971
26917
|
//#endregion
|
|
26972
26918
|
//#region src/views/permission/panel-detail/PermissionDetailUserPart.tsx
|
|
26973
26919
|
const PermissionDetailUserPart = (props) => {
|
|
26974
|
-
var _workbook$getUnitId;
|
|
26975
26920
|
const { editState, onEditStateChange, viewState, onViewStateChange, permissionId } = props;
|
|
26976
26921
|
const localeService = useDependency(LocaleService);
|
|
26977
26922
|
const dialogService = useDependency(IDialogService);
|
|
@@ -26982,7 +26927,7 @@ const PermissionDetailUserPart = (props) => {
|
|
|
26982
26927
|
const selectUserList = useObservable(sheetPermissionUserManagerService.selectUserList$, sheetPermissionUserManagerService.selectUserList);
|
|
26983
26928
|
const workbook = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
26984
26929
|
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
26985
|
-
const unitId = (
|
|
26930
|
+
const unitId = (workbook === null || workbook === void 0 ? void 0 : workbook.getUnitId()) ?? "";
|
|
26986
26931
|
const handleEditStateChange = useEvent(onEditStateChange);
|
|
26987
26932
|
const handleAddPerson = async () => {
|
|
26988
26933
|
const userList = await authzIoService.listCollaborators({
|
|
@@ -27132,7 +27077,6 @@ const PermissionDetailUserPart = (props) => {
|
|
|
27132
27077
|
//#endregion
|
|
27133
27078
|
//#region src/views/permission/panel-detail/PermissionDetailPanel.tsx
|
|
27134
27079
|
const SheetPermissionPanelDetail = (props) => {
|
|
27135
|
-
var _activeRule$editState, _activeRule$viewState;
|
|
27136
27080
|
const { fromSheetBar, rule, oldRule } = props;
|
|
27137
27081
|
const injector = useDependency(Injector);
|
|
27138
27082
|
const componentManager = useDependency(ComponentManager);
|
|
@@ -27142,10 +27086,9 @@ const SheetPermissionPanelDetail = (props) => {
|
|
|
27142
27086
|
return checkRangeValid(injector, activeRule.ranges, activeRule.permissionId, activeRule.unitId, activeRule.subUnitId);
|
|
27143
27087
|
});
|
|
27144
27088
|
const [desc, setDesc] = useState(activeRule.description);
|
|
27145
|
-
const [editState, setEditState] = useState(
|
|
27146
|
-
const [viewState, setViewState] = useState(
|
|
27147
|
-
const
|
|
27148
|
-
const PermissionDetailUser = CustomPermissionDetailUserPart !== null && CustomPermissionDetailUserPart !== void 0 ? CustomPermissionDetailUserPart : PermissionDetailUserPart;
|
|
27089
|
+
const [editState, setEditState] = useState(activeRule.editState ?? EditStateEnum.OnlyMe);
|
|
27090
|
+
const [viewState, setViewState] = useState(activeRule.viewState ?? ViewStateEnum.OthersCanView);
|
|
27091
|
+
const PermissionDetailUser = componentManager.get("UNIVER_SHEET_PERMISSION_USER_PART") ?? PermissionDetailUserPart;
|
|
27149
27092
|
useEffect(() => {
|
|
27150
27093
|
const univerInstanceService = injector.get(IUniverInstanceService);
|
|
27151
27094
|
const sidebarService = injector.get(ISidebarService);
|
|
@@ -27357,7 +27300,7 @@ function SheetPermissionPanelListContent() {
|
|
|
27357
27300
|
})]
|
|
27358
27301
|
}),
|
|
27359
27302
|
(ruleList === null || ruleList === void 0 ? void 0 : ruleList.length) > 0 ? /* @__PURE__ */ jsx("div", { children: ruleList === null || ruleList === void 0 ? void 0 : ruleList.map((item) => {
|
|
27360
|
-
var _item$creator, _item$creator2, _item$
|
|
27303
|
+
var _item$creator, _item$creator2, _item$creator3, _item$creator4;
|
|
27361
27304
|
const rule = allRuleMap.get(item.objectID);
|
|
27362
27305
|
if (!rule) return null;
|
|
27363
27306
|
const editAction = item.actions.find((action) => action.action === UnitAction.Edit);
|
|
@@ -27433,7 +27376,7 @@ function SheetPermissionPanelListContent() {
|
|
|
27433
27376
|
className: "univer-flex univer-items-center",
|
|
27434
27377
|
children: [
|
|
27435
27378
|
/* @__PURE__ */ jsx(Tooltip, {
|
|
27436
|
-
title: (
|
|
27379
|
+
title: ((_item$creator3 = item.creator) === null || _item$creator3 === void 0 ? void 0 : _item$creator3.name) ?? "",
|
|
27437
27380
|
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Avatar, {
|
|
27438
27381
|
src: (_item$creator4 = item.creator) === null || _item$creator4 === void 0 ? void 0 : _item$creator4.avatar,
|
|
27439
27382
|
className: "univer-mr-1.5",
|
|
@@ -27527,19 +27470,19 @@ const SheetPermissionPanel = ({ showDetail, fromSheetBar, rule, oldRule }) => {
|
|
|
27527
27470
|
//#endregion
|
|
27528
27471
|
//#region src/views/permission/SheetPermissionUserDialog.tsx
|
|
27529
27472
|
const SheetPermissionUserDialog = () => {
|
|
27530
|
-
var
|
|
27473
|
+
var _authzIoService$getCf;
|
|
27531
27474
|
const [inputValue, setInputValue] = useState("");
|
|
27532
27475
|
const localeService = useDependency(LocaleService);
|
|
27533
27476
|
const dialogService = useDependency(IDialogService);
|
|
27534
27477
|
const sheetPermissionUserManagerService = useDependency(SheetPermissionUserManagerService);
|
|
27535
27478
|
const authzIoService = useDependency(IAuthzIoService);
|
|
27536
27479
|
const userList = useObservable(sheetPermissionUserManagerService.userList$, sheetPermissionUserManagerService.userList);
|
|
27537
|
-
const searchUserList = (
|
|
27480
|
+
const searchUserList = (userList === null || userList === void 0 ? void 0 : userList.filter((item) => {
|
|
27538
27481
|
var _item$subject;
|
|
27539
27482
|
return ((_item$subject = item.subject) === null || _item$subject === void 0 ? void 0 : _item$subject.name.toLocaleLowerCase().includes(inputValue.toLocaleLowerCase())) && (item.role === UnitRole.Owner || item.role === UnitRole.Editor);
|
|
27540
|
-
}))
|
|
27483
|
+
})) ?? [];
|
|
27541
27484
|
const [selectUserInfo, setSelectUserInfo] = useState(sheetPermissionUserManagerService.selectUserList);
|
|
27542
|
-
const cfgEnableObjInherit = (_authzIoService$getCf =
|
|
27485
|
+
const cfgEnableObjInherit = ((_authzIoService$getCf = authzIoService.getCfgEnableObjInherit) === null || _authzIoService$getCf === void 0 ? void 0 : _authzIoService$getCf.call(authzIoService)) ?? false;
|
|
27543
27486
|
const handleChangeUser = (item) => {
|
|
27544
27487
|
if ((selectUserInfo === null || selectUserInfo === void 0 ? void 0 : selectUserInfo.findIndex((v) => {
|
|
27545
27488
|
var _v$subject, _item$subject2;
|
|
@@ -28019,8 +27962,8 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
28019
27962
|
const docViewModel = this._getEditorViewModel(unitId);
|
|
28020
27963
|
if (docDataModel == null || docViewModel == null || skeleton == null) return;
|
|
28021
27964
|
docDataModel.getSnapshot().body = body;
|
|
28022
|
-
docDataModel.getSnapshot().drawings = drawings
|
|
28023
|
-
docDataModel.getSnapshot().drawingsOrder = drawingsOrder
|
|
27965
|
+
docDataModel.getSnapshot().drawings = drawings ?? {};
|
|
27966
|
+
docDataModel.getSnapshot().drawingsOrder = drawingsOrder ?? [];
|
|
28024
27967
|
this._checkAndSetRenderStyleConfig(docDataModel);
|
|
28025
27968
|
docViewModel.reset(docDataModel);
|
|
28026
27969
|
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
@@ -28052,15 +27995,12 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
28052
27995
|
if (unitId === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) this._formulaEditorController.autoScroll();
|
|
28053
27996
|
}
|
|
28054
27997
|
_checkAndSetRenderStyleConfig(documentDataModel) {
|
|
28055
|
-
var _snapshot$body
|
|
27998
|
+
var _snapshot$body;
|
|
28056
27999
|
const snapshot = documentDataModel.getSnapshot();
|
|
28057
28000
|
if (snapshot.id !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY && snapshot.id !== DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
|
|
28058
28001
|
const isFormulaBar = snapshot.id === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
|
|
28059
28002
|
if (isFormulaBar) snapshot.documentStyle = formulaEditorStyle;
|
|
28060
|
-
else {
|
|
28061
|
-
var _snapshot$documentSty;
|
|
28062
|
-
(_snapshot$documentSty = snapshot.documentStyle) !== null && _snapshot$documentSty !== void 0 || (snapshot.documentStyle = {});
|
|
28063
|
-
}
|
|
28003
|
+
else snapshot.documentStyle ??= {};
|
|
28064
28004
|
let renderConfig = snapshot.documentStyle.renderConfig;
|
|
28065
28005
|
if (renderConfig == null) {
|
|
28066
28006
|
renderConfig = {};
|
|
@@ -28074,7 +28014,7 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
28074
28014
|
height: Infinity
|
|
28075
28015
|
};
|
|
28076
28016
|
}
|
|
28077
|
-
if (!((
|
|
28017
|
+
if (!(((_snapshot$body = snapshot.body) === null || _snapshot$body === void 0 ? void 0 : _snapshot$body.dataStream) ?? "").startsWith("=")) {
|
|
28078
28018
|
renderConfig.isRenderStyle = isFormulaBar ? BooleanNumber.FALSE : BooleanNumber.TRUE;
|
|
28079
28019
|
return;
|
|
28080
28020
|
}
|
|
@@ -28544,13 +28484,12 @@ function MobileSheetBarImpl(props) {
|
|
|
28544
28484
|
const sheets = workbook.getSheets();
|
|
28545
28485
|
const activeSheet = workbook.getActiveSheet();
|
|
28546
28486
|
const sheetListItems = sheets.filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
28547
|
-
var _sheet$getTabColor;
|
|
28548
28487
|
return {
|
|
28549
28488
|
sheetId: sheet.getSheetId(),
|
|
28550
28489
|
label: sheet.getName(),
|
|
28551
28490
|
index,
|
|
28552
28491
|
selected: activeSheet === sheet,
|
|
28553
|
-
color:
|
|
28492
|
+
color: sheet.getTabColor() ?? void 0
|
|
28554
28493
|
};
|
|
28555
28494
|
});
|
|
28556
28495
|
setSheetList(sheetListItems);
|
|
@@ -28889,11 +28828,11 @@ let SheetPermissionInterceptorCanvasRenderController = class SheetPermissionInte
|
|
|
28889
28828
|
if (!target) return false;
|
|
28890
28829
|
const { unitId, subUnitId } = target;
|
|
28891
28830
|
if (rangeParams.row) {
|
|
28892
|
-
var _this$_permissionServ
|
|
28893
|
-
if (((_this$_permissionServ =
|
|
28831
|
+
var _this$_permissionServ;
|
|
28832
|
+
if ((((_this$_permissionServ = this._permissionService.getPermissionPoint(new WorksheetSetRowStylePermission(unitId, subUnitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) ?? false) === false) return false;
|
|
28894
28833
|
} else if (rangeParams.col) {
|
|
28895
|
-
var _this$
|
|
28896
|
-
if (((
|
|
28834
|
+
var _this$_permissionServ2;
|
|
28835
|
+
if ((((_this$_permissionServ2 = this._permissionService.getPermissionPoint(new WorksheetSetColumnStylePermission(unitId, subUnitId).id)) === null || _this$_permissionServ2 === void 0 ? void 0 : _this$_permissionServ2.value) ?? false) === false) return false;
|
|
28897
28836
|
}
|
|
28898
28837
|
return true;
|
|
28899
28838
|
} }));
|
|
@@ -28961,10 +28900,10 @@ let SheetPermissionInterceptorCanvasRenderController = class SheetPermissionInte
|
|
|
28961
28900
|
}
|
|
28962
28901
|
_initFreezePermissionInterceptor() {
|
|
28963
28902
|
this.disposeWithMe(this._headerFreezeRenderController.interceptor.intercept(this._headerFreezeRenderController.interceptor.getInterceptPoints().FREEZE_PERMISSION_CHECK, { handler: (_, __) => {
|
|
28964
|
-
var _this$
|
|
28903
|
+
var _this$_permissionServ3;
|
|
28965
28904
|
const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
28966
28905
|
if (!(workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet()) || !workbook) return false;
|
|
28967
|
-
return (
|
|
28906
|
+
return ((_this$_permissionServ3 = this._permissionService.getPermissionPoint(new WorkbookEditablePermission(workbook.getUnitId()).id)) === null || _this$_permissionServ3 === void 0 ? void 0 : _this$_permissionServ3.value) ?? false;
|
|
28968
28907
|
} }));
|
|
28969
28908
|
}
|
|
28970
28909
|
};
|
|
@@ -29053,7 +28992,7 @@ let SheetPermissionInterceptorFormulaRenderController = class SheetPermissionInt
|
|
|
29053
28992
|
handler: (defaultValue, originValue) => {
|
|
29054
28993
|
var _this$_permissionServ;
|
|
29055
28994
|
const target = getSheetCommandTarget(this._univerInstanceService);
|
|
29056
|
-
if (!target) return defaultValue
|
|
28995
|
+
if (!target) return defaultValue ?? [];
|
|
29057
28996
|
const { worksheet, unitId, subUnitId } = target;
|
|
29058
28997
|
if (((_this$_permissionServ = this._permissionService.getPermissionPoint(new WorksheetViewPermission(unitId, subUnitId).id)) === null || _this$_permissionServ === void 0 ? void 0 : _this$_permissionServ.value) === false) originValue.forEach((item) => {
|
|
29059
28998
|
const itemValue = item.getArrayValue();
|
|
@@ -29737,10 +29676,9 @@ let SheetContextMenuMobileRenderController = class SheetContextMenuMobileRenderC
|
|
|
29737
29676
|
return skeleton.getCellWithCoordByOffset(relativeCoords.x - scrollXY.x, relativeCoords.y - scrollXY.y, scaleX, scaleY, scrollXY);
|
|
29738
29677
|
}
|
|
29739
29678
|
_getCurrentRenderSelections() {
|
|
29740
|
-
var _selectionRenderServi;
|
|
29741
29679
|
const currentRender = this._renderManagerService.getRenderUnitById(this._context.unitId);
|
|
29742
29680
|
const selectionRenderService = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(ISheetSelectionRenderService);
|
|
29743
|
-
return (
|
|
29681
|
+
return (selectionRenderService === null || selectionRenderService === void 0 ? void 0 : selectionRenderService.getSelectionControls().map((control) => convertSelectionDataToRange(control.getValue()))) ?? [];
|
|
29744
29682
|
}
|
|
29745
29683
|
_cloneSelections(selections) {
|
|
29746
29684
|
return selections.map((selection) => ({
|
|
@@ -30843,14 +30781,14 @@ let MobileSheetsScrollRenderController = class MobileSheetsScrollRenderControlle
|
|
|
30843
30781
|
return skeleton.getRangeByViewport(viewport.calcViewportInfo());
|
|
30844
30782
|
}
|
|
30845
30783
|
_scrollToCell(row, column) {
|
|
30846
|
-
var _this$_sheetSkeletonM10, _this$
|
|
30847
|
-
const { rowHeightAccumulation, columnWidthAccumulation } = (_this$_sheetSkeletonM10 =
|
|
30784
|
+
var _this$_sheetSkeletonM10, _this$_getSheetObject2, _this$_sheetSkeletonM11;
|
|
30785
|
+
const { rowHeightAccumulation, columnWidthAccumulation } = ((_this$_sheetSkeletonM10 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM10 === void 0 ? void 0 : _this$_sheetSkeletonM10.skeleton) ?? {};
|
|
30848
30786
|
if (rowHeightAccumulation == null || columnWidthAccumulation == null) return false;
|
|
30849
30787
|
const scene = (_this$_getSheetObject2 = this._getSheetObject()) === null || _this$_getSheetObject2 === void 0 ? void 0 : _this$_getSheetObject2.scene;
|
|
30850
30788
|
if (scene == null) return false;
|
|
30851
30789
|
const viewport = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
30852
30790
|
if (viewport == null) return false;
|
|
30853
|
-
if (((_this$
|
|
30791
|
+
if (((_this$_sheetSkeletonM11 = this._sheetSkeletonManagerService.getCurrentParam()) === null || _this$_sheetSkeletonM11 === void 0 ? void 0 : _this$_sheetSkeletonM11.skeleton) == null) return false;
|
|
30854
30792
|
const worksheet = this._context.unit.getActiveSheet();
|
|
30855
30793
|
if (!worksheet) return false;
|
|
30856
30794
|
const { startColumn: freezeStartColumn, startRow: freezeStartRow, ySplit: freezeYSplit, xSplit: freezeXSplit } = worksheet.getFreeze();
|
|
@@ -31651,9 +31589,8 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31651
31589
|
* When pinch zooming, we should not process pointer move events for selection.
|
|
31652
31590
|
*/
|
|
31653
31591
|
_setupPointerMoveListener(viewportMain, activeSelectionControl, rangeType, scrollTimerType = ScrollTimerType.ALL, moveStartPosX, moveStartPosY) {
|
|
31654
|
-
var _viewportMain$left, _viewportMain$top;
|
|
31655
31592
|
this._scrollTimer = ScrollTimer.create(this._scene, scrollTimerType);
|
|
31656
|
-
this._scrollTimer.startScroll((
|
|
31593
|
+
this._scrollTimer.startScroll((viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.left) ?? 0, (viewportMain === null || viewportMain === void 0 ? void 0 : viewportMain.top) ?? 0, viewportMain);
|
|
31657
31594
|
const scene = this._scene;
|
|
31658
31595
|
this._scenePointerMoveSub = scene.onPointerMove$.subscribeEvent((moveEvt) => {
|
|
31659
31596
|
if (this._contextService.getContextValue("MOBILE_PINCH_ZOOMING")) return;
|
|
@@ -31675,7 +31612,7 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31675
31612
|
* In Mobile version, new selection is determined by cursor cell and current of activeSelectionControl.model
|
|
31676
31613
|
*/
|
|
31677
31614
|
_movingHandler(offsetX, offsetY, activeSelectionControl, rangeType) {
|
|
31678
|
-
var
|
|
31615
|
+
var _anchorCell$mergeInfo, _anchorCell$mergeInfo2, _anchorCell$mergeInfo3, _anchorCell$mergeInfo4;
|
|
31679
31616
|
this._rangeType = rangeType;
|
|
31680
31617
|
const skeleton = this._skeleton;
|
|
31681
31618
|
const scene = this._scene;
|
|
@@ -31686,7 +31623,7 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31686
31623
|
endColumn: activeSelectionControl.model.endColumn
|
|
31687
31624
|
};
|
|
31688
31625
|
const viewportMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
31689
|
-
const targetViewport =
|
|
31626
|
+
const targetViewport = this._getViewportByCell(currSelectionRange.endRow, currSelectionRange.endColumn) ?? viewportMain;
|
|
31690
31627
|
const scrollXY = scene.getScrollXYInfoByViewport(Vector2.FromArray([this._startViewportPosX, this._startViewportPosY]), targetViewport);
|
|
31691
31628
|
const { scaleX, scaleY } = scene.getAncestorScale();
|
|
31692
31629
|
if (rangeType === RANGE_TYPE.ROW) offsetX = Number.POSITIVE_INFINITY;
|
|
@@ -31694,11 +31631,11 @@ let MobileSheetsSelectionRenderService = class MobileSheetsSelectionRenderServic
|
|
|
31694
31631
|
const cursorCellRangeInfo = this._getSelectionWithCoordByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
31695
31632
|
if (!cursorCellRangeInfo) return false;
|
|
31696
31633
|
const { rangeWithCoord: cursorCellRange } = cursorCellRangeInfo;
|
|
31697
|
-
const anchorCell =
|
|
31698
|
-
const startRowOfActiveCell = (
|
|
31699
|
-
const endRowOfActiveCell = (
|
|
31700
|
-
const startColumnOfActiveCell = (
|
|
31701
|
-
const endColOfActiveCell = (
|
|
31634
|
+
const anchorCell = this._anchorCellForExpanding ?? activeSelectionControl.model.currentCell;
|
|
31635
|
+
const startRowOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo === void 0 ? void 0 : _anchorCell$mergeInfo.startRow) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualRow) ?? -1;
|
|
31636
|
+
const endRowOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo2 = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo2 === void 0 ? void 0 : _anchorCell$mergeInfo2.endRow) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualRow) ?? -1;
|
|
31637
|
+
const startColumnOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo3 = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo3 === void 0 ? void 0 : _anchorCell$mergeInfo3.startColumn) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualColumn) ?? -1;
|
|
31638
|
+
const endColOfActiveCell = (anchorCell === null || anchorCell === void 0 || (_anchorCell$mergeInfo4 = anchorCell.mergeInfo) === null || _anchorCell$mergeInfo4 === void 0 ? void 0 : _anchorCell$mergeInfo4.endColumn) ?? (anchorCell === null || anchorCell === void 0 ? void 0 : anchorCell.actualColumn) ?? -1;
|
|
31702
31639
|
let startRow = Math.min(cursorCellRange.startRow, startRowOfActiveCell);
|
|
31703
31640
|
if (startRowOfActiveCell === -1) startRow = cursorCellRange.startRow;
|
|
31704
31641
|
let startColumn = Math.min(cursorCellRange.startColumn, startColumnOfActiveCell);
|
|
@@ -31805,6 +31742,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends Plugin
|
|
|
31805
31742
|
[SelectAllService],
|
|
31806
31743
|
[ISheetCellDropdownManagerService, { useClass: SheetCellDropdownManagerService }],
|
|
31807
31744
|
[SheetCellEditorResizeService],
|
|
31745
|
+
[ISheetLoadingRenderService, { useClass: SheetLoadingRenderService }],
|
|
31808
31746
|
[AutoHeightController],
|
|
31809
31747
|
[AutoWidthController],
|
|
31810
31748
|
[FormulaEditorController],
|
|
@@ -31870,7 +31808,6 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends Plugin
|
|
|
31870
31808
|
});
|
|
31871
31809
|
}
|
|
31872
31810
|
_registerRenderModules() {
|
|
31873
|
-
var _config$contextMenu;
|
|
31874
31811
|
const modules = [
|
|
31875
31812
|
[HeaderMoveRenderController],
|
|
31876
31813
|
[HeaderUnhideRenderController],
|
|
@@ -31898,7 +31835,7 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends Plugin
|
|
|
31898
31835
|
[WorksheetProtectionRenderController]
|
|
31899
31836
|
];
|
|
31900
31837
|
const config = this._configService.getConfig(UI_PLUGIN_CONFIG_KEY);
|
|
31901
|
-
if ((
|
|
31838
|
+
if ((config === null || config === void 0 ? void 0 : config.contextMenu) ?? true) modules.push([HeaderMenuRenderController]);
|
|
31902
31839
|
modules.forEach((m) => {
|
|
31903
31840
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
|
|
31904
31841
|
});
|
|
@@ -32491,7 +32428,6 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends Plugin {
|
|
|
32491
32428
|
});
|
|
32492
32429
|
}
|
|
32493
32430
|
_registerRenderModules() {
|
|
32494
|
-
var _config$contextMenu;
|
|
32495
32431
|
const modules = [
|
|
32496
32432
|
[HeaderMoveRenderController],
|
|
32497
32433
|
[HeaderUnhideRenderController],
|
|
@@ -32519,7 +32455,7 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends Plugin {
|
|
|
32519
32455
|
[WorksheetProtectionRenderController]
|
|
32520
32456
|
];
|
|
32521
32457
|
const config = this._configService.getConfig(UI_PLUGIN_CONFIG_KEY);
|
|
32522
|
-
if ((
|
|
32458
|
+
if ((config === null || config === void 0 ? void 0 : config.contextMenu) ?? true) modules.push([HeaderMenuRenderController]);
|
|
32523
32459
|
modules.forEach((m) => {
|
|
32524
32460
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, m));
|
|
32525
32461
|
});
|
|
@@ -32539,7 +32475,7 @@ _defineProperty(UniverSheetsUIPlugin, "packageName", name);
|
|
|
32539
32475
|
_defineProperty(UniverSheetsUIPlugin, "version", version);
|
|
32540
32476
|
_defineProperty(UniverSheetsUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
32541
32477
|
UniverSheetsUIPlugin = __decorate([
|
|
32542
|
-
DependentOn(UniverDocsPlugin, UniverFormulaEnginePlugin, UniverRenderEnginePlugin, UniverSheetsPlugin,
|
|
32478
|
+
DependentOn(UniverDocsPlugin, UniverFormulaEnginePlugin, UniverRenderEnginePlugin, UniverSheetsPlugin, UniverDocsUIPlugin),
|
|
32543
32479
|
__decorateParam(1, Inject(Injector)),
|
|
32544
32480
|
__decorateParam(2, IRenderManagerService),
|
|
32545
32481
|
__decorateParam(3, IConfigService),
|