@univerjs/sheets-ui 1.0.0-beta.0 → 1.0.0-beta.1
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 +5 -5
- package/lib/cjs/index.js +1441 -1525
- package/lib/cjs/locale/ar-SA.js +14 -133
- package/lib/cjs/locale/ca-ES.js +14 -133
- package/lib/cjs/locale/de-DE.js +14 -133
- package/lib/cjs/locale/en-US.js +14 -133
- package/lib/cjs/locale/es-ES.js +14 -133
- package/lib/cjs/locale/fa-IR.js +14 -133
- package/lib/cjs/locale/fr-FR.js +14 -133
- package/lib/cjs/locale/id-ID.js +14 -133
- package/lib/cjs/locale/it-IT.js +14 -133
- package/lib/cjs/locale/ja-JP.js +14 -133
- package/lib/cjs/locale/ko-KR.js +14 -133
- package/lib/cjs/locale/pl-PL.js +14 -133
- package/lib/cjs/locale/pt-BR.js +14 -133
- package/lib/cjs/locale/ru-RU.js +14 -133
- package/lib/cjs/locale/sk-SK.js +14 -133
- package/lib/cjs/locale/vi-VN.js +14 -133
- package/lib/cjs/locale/zh-CN.js +14 -133
- package/lib/cjs/locale/zh-HK.js +14 -133
- package/lib/cjs/locale/zh-TW.js +14 -133
- package/lib/es/facade.js +6 -6
- package/lib/es/index.js +1446 -1531
- package/lib/es/locale/ar-SA.js +14 -133
- package/lib/es/locale/ca-ES.js +14 -133
- package/lib/es/locale/de-DE.js +14 -133
- package/lib/es/locale/en-US.js +14 -133
- package/lib/es/locale/es-ES.js +14 -133
- package/lib/es/locale/fa-IR.js +14 -133
- package/lib/es/locale/fr-FR.js +14 -133
- package/lib/es/locale/id-ID.js +14 -133
- package/lib/es/locale/it-IT.js +14 -133
- package/lib/es/locale/ja-JP.js +14 -133
- package/lib/es/locale/ko-KR.js +14 -133
- package/lib/es/locale/pl-PL.js +14 -133
- package/lib/es/locale/pt-BR.js +14 -133
- package/lib/es/locale/ru-RU.js +14 -133
- package/lib/es/locale/sk-SK.js +14 -133
- package/lib/es/locale/vi-VN.js +14 -133
- package/lib/es/locale/zh-CN.js +14 -133
- package/lib/es/locale/zh-HK.js +14 -133
- package/lib/es/locale/zh-TW.js +14 -133
- package/lib/facade.js +6 -6
- package/lib/index.css +54 -87
- package/lib/index.js +1446 -1531
- package/lib/locale/ar-SA.js +14 -133
- package/lib/locale/ca-ES.js +14 -133
- package/lib/locale/de-DE.js +14 -133
- package/lib/locale/en-US.js +14 -133
- package/lib/locale/es-ES.js +14 -133
- package/lib/locale/fa-IR.js +14 -133
- package/lib/locale/fr-FR.js +14 -133
- package/lib/locale/id-ID.js +14 -133
- package/lib/locale/it-IT.js +14 -133
- package/lib/locale/ja-JP.js +14 -133
- package/lib/locale/ko-KR.js +14 -133
- package/lib/locale/pl-PL.js +14 -133
- package/lib/locale/pt-BR.js +14 -133
- package/lib/locale/ru-RU.js +14 -133
- package/lib/locale/sk-SK.js +14 -133
- package/lib/locale/vi-VN.js +14 -133
- package/lib/locale/zh-CN.js +14 -133
- package/lib/locale/zh-HK.js +14 -133
- package/lib/locale/zh-TW.js +14 -133
- package/lib/types/controllers/editor/data-sync.controller.d.ts +4 -2
- package/lib/types/controllers/force-string-alert-render.controller.d.ts +9 -4
- package/lib/types/controllers/render-controllers/scroll.render-controller.d.ts +6 -0
- package/lib/types/controllers/utils/range-tools.d.ts +2 -0
- package/lib/types/embed-tab-anchor.d.ts +2 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/locale/en-US.d.ts +1 -106
- package/lib/types/menu/header-menu-shape.d.ts +3 -3
- package/lib/types/services/cell-alert-manager.service.d.ts +6 -0
- package/lib/types/services/cell-popup-manager.service.d.ts +6 -7
- package/lib/types/services/sheet-embed-runtime.service.d.ts +2 -1
- package/lib/types/views/CellPopup.d.ts +2 -1
- package/lib/types/views/hook.d.ts +0 -4
- package/lib/types/views/status-bar/CopyableStatisticItem.d.ts +0 -2
- package/lib/types/views/status-bar/StatusBar.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +14 -11
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +13 -13
- package/lib/types/services/sheet-loading-render.service.d.ts +0 -65
package/lib/es/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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,
|
|
2
|
+
import { AbsoluteRefType, BaselineOffset, BooleanNumber, BorderStyleTypes, CellModeEnum, CellValueType, ColorKit, CommandType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_HEIGHT, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DependentOn, Direction, Disposable, DisposableCollection, DocumentFlavor, EDITOR_ACTIVATED, ErrorService, FOCUSING_COMMENT_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_EDITOR_INPUT_FORMULA, FOCUSING_EDITOR_STANDALONE, FOCUSING_FX_BAR_EDITOR, FOCUSING_SHAPE_TEXT_EDITOR, FOCUSING_SHEET, FOCUSING_UNIVER_EDITOR, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, LocaleType, LookUp, NilCommand, ObjectMatrix, Optional, Plugin, PresetListType, Quantity, RANGE_TYPE, Range, Rectangle, RxDisposable, SHEET_EDITOR_UNITS, ThemeService, Tools, UndoCommandId, UniverInstanceType, UserManagerService, VerticalAlign, Workbook, WrapStrategy, cloneCellDataMatrix, cloneCellDataWithSpanAndDisplay, cloneValue, composeStyles, convertCellToRange, createDocumentModelWithStyle, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, dateKit, debounce, extractPureTextFromCell, fromEventSubject, generateRandomId, get, getEmptyCell, getIntersectRange, getNumfmtParseValueFilter, getReverseDirection, handleStyleToString, isDefaultFormat, isFormulaString, isInternalEditorID, isNotNullOrUndefined, isRealNum, isSafeUrl, isTextFormat, isValidRange, merge, mergeOverrideWithDependencies, nameCharacterCheck, numberToABC, numfmt, registerDependencies, sequenceExecute, set, skipParseTagNames, sortRules, splitIntoGrid, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
|
|
3
3
|
import { AUTO_FILL_APPLY_TYPE, AUTO_FILL_HOOK_TYPE, AddMergeUndoMutationFactory, AddRangeProtectionCommand, AddRangeProtectionMutation, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeMutation, AddWorksheetMergeVerticalCommand, AddWorksheetProtectionCommand, AutoClearContentCommand, AutoFillCommand, AutoFillController, BEFORE_CELL_EDIT, BorderStyleManagerService, COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, CancelMarkDirtyRowAutoHeightOperation, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionCommand, DeltaColumnWidthCommand, DeltaRowHeightCommand, EditStateEnum, IAutoFillService, IExclusiveRangeService, INTERCEPTOR_POINT, INumfmtService, IRefSelectionsService, InsertColBeforeCommand, InsertColCommand, InsertColMutation, InsertDefinedNameCommand, InsertMultiColsLeftCommand, InsertMultiColsRightCommand, InsertMultiRowsAboveCommand, InsertMultiRowsAfterCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowBeforeCommand, InsertRowCommand, InsertRowMutation, InsertSheetCommand, InsertSheetMutation, MAX_CELL_PER_SHEET_KEY, MERGE_CELL_INTERCEPTOR_CHECK, MarkDirtyRowAutoHeightOperation, MergeCellController, MoveColsCommand, MoveColsMutation, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, REF_SELECTIONS_ENABLED, RangeProtectionCache, RangeProtectionPermissionEditPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RefRangeService, RefSelectionsService, RefillCommand, RemoveColCommand, RemoveColMutation, RemoveDefinedNameCommand, RemoveMergeUndoMutationFactory, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, RemoveSheetMutation, RemoveWorksheetMergeCommand, RemoveWorksheetMergeMutation, ResetBackgroundColorCommand, ResetTextColorCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SELECTIONS_ENABLED, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SHEETS_PLUGIN_CONFIG_KEY, ScrollToCellOperation, SelectionMoveType, SetBackgroundColorCommand, SetBoldCommand, SetBorderBasicCommand, SetBorderCommand, SetColHiddenCommand, SetColHiddenMutation, SetColVisibleMutation, SetColWidthCommand, SetDefinedNameCommand, SetFontFamilyCommand, SetFontSizeCommand, SetFrozenCommand, SetFrozenMutation, SetFrozenMutationFactory, SetHorizontalTextAlignCommand, SetItalicCommand, SetProtectionCommand, SetRangeValuesCommand, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetRowHeightCommand, SetRowHiddenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedColsVisibleCommand, SetSelectedRowsVisibleCommand, SetSelectionsOperation, SetShrinkToFitCommand, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStrikeThroughCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SetWorksheetColWidthMutation, SetWorksheetColWidthMutationFactory, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetNameMutation, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetPermissionPointsCommand, SetWorksheetRowAutoHeightMutation, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowHeightMutation, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetCopyDownCommand, SheetCopyRightCommand, SheetInterceptorService, SheetPermissionCheckController, SheetPermissionInitController, SheetSkeletonService, SheetsSelectionsService, TextToNumberCommand, ToggleCellCheckboxCommand, ToggleGridlinesCommand, ToggleGridlinesMutation, UniverSheetsPlugin, ViewStateEnum, WorkbookCopyPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookEditablePermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookRenameSheetPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditPermission, WorksheetInsertColumnPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetViewPermission, adjustRangeOnMutation, alignToMergedCellsBorders, attachPrimaryWithCoord, attachRangeWithCoord, attachSelectionWithCoord, baseProtectionActions, convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, countCells, defaultLargeSheetOperationConfig, deserializeListOptions, discreteRangeToRange, expandToContinuousRange, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getCellAtRowCol, getClearContentMutationParamsForRanges, getMoveRangeCommandMutations, getPrimaryForRange, getSelectionsService, getSheetCommandTarget, isCellImage, rangeToDiscreteRange, serializeListOptions, setEndForRange, validateDefinedName } from "@univerjs/sheets";
|
|
4
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,
|
|
6
|
-
import { BehaviorSubject, EMPTY, Observable, Subject, Subscription, combineLatest, combineLatestWith, distinctUntilChanged, filter,
|
|
5
|
+
import { CURSOR_TYPE, DashedRect, DeviceInputEventType, FIX_ONE_PIXEL_BLUR_OFFSET, Group, IRenderManagerService, Layer, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, Rect, RegularPolygon, SHEET_EXTENSION_PREFIX, SHEET_VIEWPORT_KEY, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetExtension, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetRowHeader, TRANSFORM_CHANGE_OBSERVABLE_TYPE, UniverRenderEnginePlugin, Vector2, Viewport, calculateCellImageRect, cancelRequestFrame, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, fixLineWidthByScale, getCurrentTypeOfRenderer, getNextWheelZoomRatio, ptToPixel, requestNewFrame, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
|
|
6
|
+
import { BehaviorSubject, EMPTY, Observable, Subject, Subscription, combineLatest, combineLatestWith, distinctUntilChanged, filter, from, fromEvent, map, merge as merge$1, of, shareReplay, skip, startWith, switchMap, takeUntil, throttleTime, withLatestFrom } from "rxjs";
|
|
7
7
|
import { DocSelectionManagerService, DocSkeletonManagerService, InsertTextCommand, RichTextEditingMutation, SetTextSelectionsOperation, UniverDocsPlugin } from "@univerjs/docs";
|
|
8
8
|
import { ObjectScope, UnitAction, UnitObject, UnitRole } from "@univerjs/protocol";
|
|
9
9
|
import { Avatar, Button, Calendar, CascaderList, ColorPicker, ConfigContext, Confirm, Dropdown, DropdownMenu, FormLayout, Input, InputNumber, MessageType, Radio, RadioGroup, Select, Separator, Switch, TimeInput, Tooltip, borderBottomClassName, borderClassName, borderRightClassName, borderTopClassName, clsx, scrollbarClassName } from "@univerjs/design";
|
|
10
|
-
import { AddImageIcon, AdjustHeightDoubleIcon, AdjustWidthDoubleIcon, AlignBottomIcon, AlignTopIcon, AllBorderIcon, AutoHeightDoubleIcon, AutoWidthDoubleIcon, AutofillDoubleIcon, AutowrapIcon, BackSlashDoubleIcon, BoldIcon, BrushIcon, CancelFreezeIcon, CancelMergeIcon, CheckMarkIcon, ClearFormatDoubleIcon, CloseIcon, CodeIcon, ConvertIcon, ConvertToNumberIcon, CopyDoubleIcon, CutIcon, DeleteCellShiftLeftDoubleIcon, DeleteCellShiftUpDoubleIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DownBorderDoubleIcon, DownIcon, DownloadImageIcon, ErrorIcon, EyeIcon, EyelashIcon, FontColorDoubleIcon, FontSizeIncreaseIcon, FontSizeReduceIcon, FreezeColumnIcon, FreezeRowIcon, FreezeToSelectedIcon, FxIcon, HideDoubleIcon, HideGridlinesIcon, HorizontalBorderDoubleIcon, HorizontalMergeIcon, HorizontallyIcon, IncreaseIcon, InfoIcon, InnerBorderDoubleIcon, InsertCellDownDoubleIcon, InsertCellShiftRightDoubleIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, LeftBorderDoubleIcon, LeftDoubleDiagonalDoubleIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LeftRotationFortyFiveDegreesIcon, LeftRotationNinetyDegreesIcon, LeftTridiagonalDoubleIcon,
|
|
11
|
-
import {
|
|
12
|
-
import { FUNCTION_NAMES_MATH, FUNCTION_NAMES_STATISTICAL, FUNCTION_NAMES_TEXT, FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, LexerTreeBuilder, NullValueObject, SetFormulaCalculationNotificationMutation, UniverFormulaEnginePlugin, deserializeRangeWithSheet, isReferenceStringWithEffectiveColumn, isReferenceStrings, matchToken, operatorToken, sequenceNodeType, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
13
|
-
import { ITelemetryService } from "@univerjs/telemetry";
|
|
10
|
+
import { AddImageIcon, AdjustHeightDoubleIcon, AdjustWidthDoubleIcon, AlignBottomIcon, AlignTopIcon, AllBorderIcon, AutoHeightDoubleIcon, AutoWidthDoubleIcon, AutofillDoubleIcon, AutowrapIcon, BackSlashDoubleIcon, BasesMultiIcon, BoardsMultiIcon, BoldIcon, BrushIcon, CancelFreezeIcon, CancelMergeIcon, CheckMarkIcon, ClearFormatDoubleIcon, CloseIcon, CodeIcon, ConvertIcon, ConvertToNumberIcon, CopyDoubleIcon, CutIcon, DeleteCellShiftLeftDoubleIcon, DeleteCellShiftUpDoubleIcon, DeleteColumnDoubleIcon, DeleteIcon, DeleteRowDoubleIcon, DocsMultiIcon, DownBorderDoubleIcon, DownIcon, DownloadImageIcon, ErrorIcon, EyeIcon, EyelashIcon, FontColorDoubleIcon, FontSizeIncreaseIcon, FontSizeReduceIcon, FreezeColumnIcon, FreezeRowIcon, FreezeToSelectedIcon, FxIcon, HideDoubleIcon, HideGridlinesIcon, HorizontalBorderDoubleIcon, HorizontalMergeIcon, HorizontallyIcon, IncreaseIcon, InfoIcon, InnerBorderDoubleIcon, InsertCellDownDoubleIcon, InsertCellShiftRightDoubleIcon, InsertDoubleIcon, InsertRowAboveDoubleIcon, InsertRowBelowDoubleIcon, ItalicIcon, LeftBorderDoubleIcon, LeftDoubleDiagonalDoubleIcon, LeftInsertColumnDoubleIcon, LeftJustifyingIcon, LeftRotationFortyFiveDegreesIcon, LeftRotationNinetyDegreesIcon, LeftTridiagonalDoubleIcon, LockIcon, MergeAllIcon, MoreDownIcon, MoreLeftIcon, MoreRightIcon, NoBorderIcon, NoColorDoubleIcon, NoRotationIcon, OuterBorderDoubleIcon, OverflowIcon, PaintBucketDoubleIcon, PasteSpecialDoubleIcon, PenIcon, ProtectIcon, ReduceDoubleIcon, RightBorderDoubleIcon, RightDoubleDiagonalDoubleIcon, RightInsertColumnDoubleIcon, RightJustifyingIcon, RightRotationFortyFiveDegreesIcon, RightRotationNinetyDegreesIcon, SheetsMultiIcon, ShrinkToFitIcon, SlashDoubleIcon, SlidesMultiIcon, StrikethroughIcon, SubscriptIcon, SuperscriptIcon, TruncationIcon, UnderlineIcon, UpBorderDoubleIcon, VerticalBorderDoubleIcon, VerticalCenterIcon, VerticalIntegrationIcon, VerticalTextIcon, WarningIcon, WriteIcon } from "@univerjs/icons";
|
|
11
|
+
import { useCallback, useContext, useEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
14
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { FUNCTION_NAMES_MATH, FUNCTION_NAMES_STATISTICAL, FUNCTION_NAMES_TEXT, FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, LexerTreeBuilder, NullValueObject, SetFormulaCalculationNotificationMutation, UniverFormulaEnginePlugin, deserializeRangeWithSheet, isReferenceStringWithEffectiveColumn, isReferenceStrings, matchToken, operatorToken, quoteSheetName, sequenceNodeType, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
14
|
+
import { ITelemetryService } from "@univerjs/telemetry";
|
|
15
15
|
import { debounceTime, filter as filter$1, map as map$1, shareReplay as shareReplay$1, startWith as startWith$1, switchMap as switchMap$1 } from "rxjs/operators";
|
|
16
16
|
|
|
17
17
|
//#region src/basics/editor/get-editor-object.ts
|
|
@@ -92,6 +92,40 @@ function whenEditorDidNotInputFormulaActivated(contextService) {
|
|
|
92
92
|
|
|
93
93
|
//#endregion
|
|
94
94
|
//#region src/controllers/utils/range-tools.ts
|
|
95
|
+
function groupConsecutive(values, start, end) {
|
|
96
|
+
const groups = [];
|
|
97
|
+
for (let index = start; index <= end; index++) {
|
|
98
|
+
const value = values[index];
|
|
99
|
+
const previous = groups[groups.length - 1];
|
|
100
|
+
if (previous && value === previous.end + 1) previous.end = value;
|
|
101
|
+
else groups.push({
|
|
102
|
+
start: value,
|
|
103
|
+
end: value
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return groups;
|
|
107
|
+
}
|
|
108
|
+
function projectLine(values, start, end) {
|
|
109
|
+
let low = 0;
|
|
110
|
+
let high = values.length;
|
|
111
|
+
while (low < high) {
|
|
112
|
+
const middle = Math.floor((low + high) / 2);
|
|
113
|
+
if (values[middle] < start) low = middle + 1;
|
|
114
|
+
else high = middle;
|
|
115
|
+
}
|
|
116
|
+
const first = low;
|
|
117
|
+
if (first === values.length || values[first] > end) return null;
|
|
118
|
+
high = values.length;
|
|
119
|
+
while (low < high) {
|
|
120
|
+
const middle = Math.floor((low + high) / 2);
|
|
121
|
+
if (values[middle] <= end) low = middle + 1;
|
|
122
|
+
else high = middle;
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
start: first,
|
|
126
|
+
end: low - 1
|
|
127
|
+
};
|
|
128
|
+
}
|
|
95
129
|
function virtualizeDiscreteRanges(ranges) {
|
|
96
130
|
let totalRows = [];
|
|
97
131
|
let totalCols = [];
|
|
@@ -115,7 +149,27 @@ function virtualizeDiscreteRanges(ranges) {
|
|
|
115
149
|
mapFunc: (row, col) => ({
|
|
116
150
|
row: totalRows[row],
|
|
117
151
|
col: totalCols[col]
|
|
118
|
-
})
|
|
152
|
+
}),
|
|
153
|
+
mapRange: (range) => {
|
|
154
|
+
const rowGroups = groupConsecutive(totalRows, range.startRow, range.endRow);
|
|
155
|
+
const columnGroups = groupConsecutive(totalCols, range.startColumn, range.endColumn);
|
|
156
|
+
return rowGroups.flatMap((row) => columnGroups.map((column) => ({
|
|
157
|
+
startRow: row.start,
|
|
158
|
+
endRow: row.end,
|
|
159
|
+
startColumn: column.start,
|
|
160
|
+
endColumn: column.end
|
|
161
|
+
})));
|
|
162
|
+
},
|
|
163
|
+
projectRange: (range) => {
|
|
164
|
+
const row = projectLine(totalRows, range.startRow, range.endRow);
|
|
165
|
+
const column = projectLine(totalCols, range.startColumn, range.endColumn);
|
|
166
|
+
return row && column ? {
|
|
167
|
+
startRow: row.start,
|
|
168
|
+
endRow: row.end,
|
|
169
|
+
startColumn: column.start,
|
|
170
|
+
endColumn: column.end
|
|
171
|
+
} : null;
|
|
172
|
+
}
|
|
119
173
|
};
|
|
120
174
|
}
|
|
121
175
|
|
|
@@ -130,7 +184,7 @@ let SELECTION_SHAPE_DEPTH = /* @__PURE__ */ function(SELECTION_SHAPE_DEPTH) {
|
|
|
130
184
|
}({});
|
|
131
185
|
function genNormalSelectionStyle(themeService) {
|
|
132
186
|
const primaryColor = themeService.getColorFromTheme("primary.600");
|
|
133
|
-
const
|
|
187
|
+
const gray0Color = themeService.getColorFromTheme("gray.0");
|
|
134
188
|
const fill = new ColorKit(primaryColor).setAlpha(.07).toRgbString();
|
|
135
189
|
return {
|
|
136
190
|
strokeWidth: 1,
|
|
@@ -139,10 +193,10 @@ function genNormalSelectionStyle(themeService) {
|
|
|
139
193
|
widgets: {},
|
|
140
194
|
widgetSize: 6,
|
|
141
195
|
widgetStrokeWidth: 1,
|
|
142
|
-
widgetStroke:
|
|
196
|
+
widgetStroke: gray0Color,
|
|
143
197
|
autofillSize: 6,
|
|
144
198
|
autofillStrokeWidth: 1,
|
|
145
|
-
autofillStroke:
|
|
199
|
+
autofillStroke: gray0Color,
|
|
146
200
|
rowHeaderFill: fill,
|
|
147
201
|
rowHeaderStroke: primaryColor,
|
|
148
202
|
rowHeaderStrokeWidth: 1,
|
|
@@ -4009,6 +4063,10 @@ const IMAGE_MIME_TO_EXTENSION = {
|
|
|
4009
4063
|
[FILE__BMP_CLIPBOARD_MIME_TYPE]: "bmp"
|
|
4010
4064
|
};
|
|
4011
4065
|
const FORMULA_CLIPBOARD_MIME_TYPE = "web application/x-univer-sheets-formula";
|
|
4066
|
+
function wrapHtmlForExcel(html) {
|
|
4067
|
+
var _html$match;
|
|
4068
|
+
return `<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Excel.Sheet"><meta name="Generator" content="Univer"></head><body><!--StartFragment-->${((_html$match = html.match(/<table[\s\S]*<\/table>/)) === null || _html$match === void 0 ? void 0 : _html$match[0]) ?? html}<!--EndFragment--></body></html>`;
|
|
4069
|
+
}
|
|
4012
4070
|
/**
|
|
4013
4071
|
* This service provide hooks for sheet features to supplement content or modify behavior of clipboard.
|
|
4014
4072
|
*/
|
|
@@ -4103,7 +4161,7 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4103
4161
|
matrix: matrixFragment,
|
|
4104
4162
|
copyType
|
|
4105
4163
|
});
|
|
4106
|
-
await this._clipboardInterfaceService.write(plain, html, formulaClipboardPayload ? { [FORMULA_CLIPBOARD_MIME_TYPE]: formulaClipboardPayload } : void 0);
|
|
4164
|
+
await this._clipboardInterfaceService.write(plain, wrapHtmlForExcel(html), formulaClipboardPayload ? { [FORMULA_CLIPBOARD_MIME_TYPE]: formulaClipboardPayload } : void 0);
|
|
4107
4165
|
this._markSelectionService.removeAllShapes();
|
|
4108
4166
|
const style = createCopyPasteSelectionStyle(this._themeService);
|
|
4109
4167
|
this._copyMarkId = this._markSelectionService.addShape({
|
|
@@ -4123,7 +4181,9 @@ let SheetClipboardService = class SheetClipboardService extends Disposable {
|
|
|
4123
4181
|
const imageIndex = types.findIndex((type) => imageMimeTypeSet.has(type));
|
|
4124
4182
|
const shouldUseHTMLPaste = imageIndex === -1 || !htmlContainsImage(html);
|
|
4125
4183
|
if (html && shouldUseHTMLPaste) {
|
|
4126
|
-
|
|
4184
|
+
const copyId = extractId(html);
|
|
4185
|
+
const isInternalCopy = Boolean(copyId && this._copyContentCache.get(copyId));
|
|
4186
|
+
if (this._platformService.isWindows && htmlIsFromExcel(html) && !isInternalCopy) this._notificationService.show({
|
|
4127
4187
|
type: "warning",
|
|
4128
4188
|
title: this._localeService.t("sheets-ui.clipboard.shortCutNotify.title"),
|
|
4129
4189
|
content: this._localeService.t("sheets-ui.clipboard.shortCutNotify.useShortCutInstead")
|
|
@@ -7232,6 +7292,9 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7232
7292
|
this._commandService = _commandService;
|
|
7233
7293
|
this._renderManagerService = _renderManagerService;
|
|
7234
7294
|
this._scrollManagerService = _scrollManagerService;
|
|
7295
|
+
_defineProperty(this, "_pendingWheelOffsetX", 0);
|
|
7296
|
+
_defineProperty(this, "_pendingWheelOffsetY", 0);
|
|
7297
|
+
_defineProperty(this, "_pendingWheelFrameId", null);
|
|
7235
7298
|
this._initCommandListener();
|
|
7236
7299
|
this._wheelEventListener();
|
|
7237
7300
|
this._scrollBarEventListener();
|
|
@@ -7242,6 +7305,12 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7242
7305
|
if (!scene) return;
|
|
7243
7306
|
const viewMain = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7244
7307
|
if (!viewMain) return;
|
|
7308
|
+
this.disposeWithMe(toDisposable(() => {
|
|
7309
|
+
if (this._pendingWheelFrameId != null) {
|
|
7310
|
+
cancelAnimationFrame(this._pendingWheelFrameId);
|
|
7311
|
+
this._pendingWheelFrameId = null;
|
|
7312
|
+
}
|
|
7313
|
+
}));
|
|
7245
7314
|
this.disposeWithMe(scene.onMouseWheel$.subscribeEvent((evt, state) => {
|
|
7246
7315
|
if (evt.ctrlKey || !this._contextService.getContextValue(FOCUSING_SHEET)) return;
|
|
7247
7316
|
let offsetX = 0;
|
|
@@ -7257,14 +7326,15 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7257
7326
|
if (absOffsetY >= absOffsetX * WHEEL_CROSS_AXIS_LOCK_RATIO) offsetX = 0;
|
|
7258
7327
|
else if (absOffsetX >= absOffsetY * WHEEL_CROSS_AXIS_LOCK_RATIO) offsetY = 0;
|
|
7259
7328
|
}
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
offsetY
|
|
7329
|
+
this._pendingWheelOffsetX += offsetX;
|
|
7330
|
+
this._pendingWheelOffsetY += offsetY;
|
|
7331
|
+
if (this._pendingWheelFrameId == null) this._pendingWheelFrameId = requestAnimationFrame(() => {
|
|
7332
|
+
this._pendingWheelFrameId = null;
|
|
7333
|
+
this._flushPendingWheelScroll();
|
|
7266
7334
|
});
|
|
7267
|
-
this.
|
|
7335
|
+
const targetViewportScrollX = viewMain.viewportScrollX + this._pendingWheelOffsetX;
|
|
7336
|
+
const targetViewportScrollY = viewMain.viewportScrollY + this._pendingWheelOffsetY;
|
|
7337
|
+
const { x: targetScrollX, y: targetScrollY } = viewMain.transViewportScroll2ScrollValue(targetViewportScrollX, targetViewportScrollY);
|
|
7268
7338
|
const isLimitedStore = viewMain.limitedScroll(targetScrollX, targetScrollY);
|
|
7269
7339
|
if (isLimitedStore && !isLimitedStore.isLimitedX && !isLimitedStore.isLimitedY) {
|
|
7270
7340
|
evt.preventDefault();
|
|
@@ -7273,6 +7343,30 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7273
7343
|
if (viewMain.isWheelPreventDefaultX && viewMain.isWheelPreventDefaultY) evt.preventDefault();
|
|
7274
7344
|
}));
|
|
7275
7345
|
}
|
|
7346
|
+
_flushPendingWheelScroll() {
|
|
7347
|
+
const offsetX = this._pendingWheelOffsetX;
|
|
7348
|
+
const offsetY = this._pendingWheelOffsetY;
|
|
7349
|
+
if (offsetX === 0 && offsetY === 0) return;
|
|
7350
|
+
this._pendingWheelOffsetX = 0;
|
|
7351
|
+
this._pendingWheelOffsetY = 0;
|
|
7352
|
+
const canUseScrollFastPath = this._canUseScrollFastPath();
|
|
7353
|
+
this._commandService.executeCommand(SetScrollRelativeCommand.id, {
|
|
7354
|
+
offsetX,
|
|
7355
|
+
offsetY
|
|
7356
|
+
});
|
|
7357
|
+
this._markSceneDirtyForScrolling(canUseScrollFastPath);
|
|
7358
|
+
}
|
|
7359
|
+
_canUseScrollFastPath() {
|
|
7360
|
+
var _this$_getSheetObject, _spreadsheet$getSkele;
|
|
7361
|
+
const { scene } = this._context;
|
|
7362
|
+
const spreadsheet = (_this$_getSheetObject = this._getSheetObject()) === null || _this$_getSheetObject === void 0 ? void 0 : _this$_getSheetObject.spreadsheet;
|
|
7363
|
+
return scene.getParent().classType === RENDER_CLASS_TYPE.ENGINE && !scene.isDirty() && spreadsheet != null && !spreadsheet.isDirty() && !spreadsheet.isForceDirty() && ((_spreadsheet$getSkele = spreadsheet.getSkeleton()) === null || _spreadsheet$getSkele === void 0 ? void 0 : _spreadsheet$getSkele.worksheet.getMergeData().length) === 0 && scene.getViewports().every((viewport) => !viewport.shouldIntoRender() || !viewport.isDirty && !viewport.isForceDirty) && scene.getLayers().every((layer) => layer.getObjectsByOrder().every((object) => !object.isDirty()));
|
|
7364
|
+
}
|
|
7365
|
+
_markSceneDirtyForScrolling(canUseScrollFastPath) {
|
|
7366
|
+
const { scene } = this._context;
|
|
7367
|
+
if (canUseScrollFastPath) scene.makeDirtyForScrolling();
|
|
7368
|
+
else scene.makeDirty(true);
|
|
7369
|
+
}
|
|
7276
7370
|
_scrollBarEventListener() {
|
|
7277
7371
|
const { scene } = this._context;
|
|
7278
7372
|
if (scene == null) return;
|
|
@@ -7525,8 +7619,8 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7525
7619
|
return getSelectionsService(this._injector);
|
|
7526
7620
|
}
|
|
7527
7621
|
_getViewportBounding() {
|
|
7528
|
-
var _this$
|
|
7529
|
-
const scene = (_this$
|
|
7622
|
+
var _this$_getSheetObject2, _this$_sheetSkeletonM5;
|
|
7623
|
+
const scene = (_this$_getSheetObject2 = this._getSheetObject()) === null || _this$_getSheetObject2 === void 0 ? void 0 : _this$_getSheetObject2.scene;
|
|
7530
7624
|
if (scene == null) return;
|
|
7531
7625
|
const viewport = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7532
7626
|
if (viewport == null) return;
|
|
@@ -7536,10 +7630,10 @@ let SheetsScrollRenderController = class SheetsScrollRenderController extends Di
|
|
|
7536
7630
|
return skeleton.getRangeByViewBound(vpInfo.viewBound);
|
|
7537
7631
|
}
|
|
7538
7632
|
_scrollToCell(row, column, forceTop = false, forceLeft = false) {
|
|
7539
|
-
var _this$
|
|
7633
|
+
var _this$_getSheetObject3, _this$_sheetSkeletonM6;
|
|
7540
7634
|
const { rowHeightAccumulation, columnWidthAccumulation } = this._sheetSkeletonManagerService.getCurrentSkeleton() ?? {};
|
|
7541
7635
|
if (rowHeightAccumulation == null || columnWidthAccumulation == null) return false;
|
|
7542
|
-
const scene = (_this$
|
|
7636
|
+
const scene = (_this$_getSheetObject3 = this._getSheetObject()) === null || _this$_getSheetObject3 === void 0 ? void 0 : _this$_getSheetObject3.scene;
|
|
7543
7637
|
if (scene == null) return false;
|
|
7544
7638
|
const viewport = scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
7545
7639
|
if (viewport == null) return false;
|
|
@@ -9240,1057 +9334,382 @@ CellCustomRenderController = __decorate([
|
|
|
9240
9334
|
], CellCustomRenderController);
|
|
9241
9335
|
|
|
9242
9336
|
//#endregion
|
|
9243
|
-
//#region src/
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9337
|
+
//#region src/views/hook.ts
|
|
9338
|
+
function useActiveWorkbook() {
|
|
9339
|
+
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
9340
|
+
return useObservable(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), void 0, void 0, []) ?? null;
|
|
9341
|
+
}
|
|
9342
|
+
function useActiveWorksheet(workbook) {
|
|
9343
|
+
return useObservable(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? of(null), void 0, void 0, [workbook]);
|
|
9344
|
+
}
|
|
9345
|
+
function useWorkbooks() {
|
|
9346
|
+
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
9347
|
+
return useObservable(() => {
|
|
9348
|
+
return merge$1([univerInstanceService.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_SHEET), univerInstanceService.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_SHEET)]).pipe(map(() => univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET)), startWith(univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET)));
|
|
9349
|
+
}, [], void 0, [univerInstanceService]);
|
|
9350
|
+
}
|
|
9351
|
+
|
|
9352
|
+
//#endregion
|
|
9353
|
+
//#region src/views/clipboard/ClipboardPopupMenu.tsx
|
|
9354
|
+
const DEFAULT_PADDING = 2;
|
|
9355
|
+
const SheetPasteOptions = [
|
|
9356
|
+
{
|
|
9357
|
+
value: "DEFAULT_PASTE",
|
|
9358
|
+
label: "sheets-ui.rightClick.paste"
|
|
9359
|
+
},
|
|
9360
|
+
{
|
|
9361
|
+
value: "SPECIAL_PASTE_VALUE",
|
|
9362
|
+
label: "sheets-ui.rightClick.pasteValue"
|
|
9363
|
+
},
|
|
9364
|
+
{
|
|
9365
|
+
value: "SPECIAL_PASTE_FORMAT",
|
|
9366
|
+
label: "sheets-ui.rightClick.pasteFormat"
|
|
9367
|
+
},
|
|
9368
|
+
{
|
|
9369
|
+
value: "SPECIAL_PASTE_COL_WIDTH",
|
|
9370
|
+
label: "sheets-ui.rightClick.pasteColWidth"
|
|
9371
|
+
},
|
|
9372
|
+
{
|
|
9373
|
+
value: "SPECIAL_PASTE_BESIDES_BORDER",
|
|
9374
|
+
label: "sheets-ui.rightClick.pasteBesidesBorder"
|
|
9375
|
+
},
|
|
9376
|
+
{
|
|
9377
|
+
value: "SPECIAL_PASTE_FORMULA",
|
|
9378
|
+
label: "sheets-ui.rightClick.pasteFormula"
|
|
9261
9379
|
}
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9380
|
+
];
|
|
9381
|
+
const useMenuPosition = (range) => {
|
|
9382
|
+
var _scene$getEngine;
|
|
9383
|
+
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
9384
|
+
const renderManagerService = useDependency(IRenderManagerService);
|
|
9385
|
+
const workbook = useActiveWorkbook();
|
|
9386
|
+
if (!range || !workbook) return null;
|
|
9387
|
+
const anchor = {
|
|
9388
|
+
startRow: range.rows[0],
|
|
9389
|
+
startCol: range.cols[0],
|
|
9390
|
+
endRow: range.rows[range.rows.length - 1],
|
|
9391
|
+
endCol: range.cols[range.cols.length - 1]
|
|
9392
|
+
};
|
|
9393
|
+
if (anchor.endRow < 0 || anchor.endCol < 0) return null;
|
|
9394
|
+
const ru = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
9395
|
+
const sheetSkeletonManagerService = ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService);
|
|
9396
|
+
const sheetObject = getSheetObject(univerInstanceService, renderManagerService);
|
|
9397
|
+
if (!sheetObject) return null;
|
|
9398
|
+
const { scene } = sheetObject;
|
|
9399
|
+
const skeleton = sheetSkeletonManagerService === null || sheetSkeletonManagerService === void 0 ? void 0 : sheetSkeletonManagerService.getCurrentSkeleton();
|
|
9400
|
+
const viewport = getViewportByCell(anchor.endRow, anchor.endCol, scene, workbook.getActiveSheet());
|
|
9401
|
+
if (!viewport) return null;
|
|
9402
|
+
const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
|
|
9403
|
+
const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
|
|
9404
|
+
const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
|
|
9405
|
+
const canvas = (_scene$getEngine = scene.getEngine()) === null || _scene$getEngine === void 0 ? void 0 : _scene$getEngine.getCanvas();
|
|
9406
|
+
if (!scaleX || !scene || !scaleX || !scaleY || !scrollXY) return null;
|
|
9407
|
+
const endPosition = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getNoMergeCellWithCoordByIndex(anchor.endRow, anchor.endCol);
|
|
9408
|
+
const endX = (endPosition === null || endPosition === void 0 ? void 0 : endPosition.endX) ?? 0;
|
|
9409
|
+
const endY = (endPosition === null || endPosition === void 0 ? void 0 : endPosition.endY) ?? 0;
|
|
9410
|
+
const positionEndX = convertTransformToOffsetX(endX, scaleX, scrollXY) ?? -9999;
|
|
9411
|
+
const positionEndY = convertTransformToOffsetY(endY, scaleY, scrollXY) ?? -9999;
|
|
9412
|
+
const canvasWidth = canvas === null || canvas === void 0 ? void 0 : canvas.getWidth();
|
|
9413
|
+
const canvasHeight = canvas === null || canvas === void 0 ? void 0 : canvas.getHeight();
|
|
9414
|
+
if (!canvasWidth || !canvasHeight) return null;
|
|
9415
|
+
const XInSideView = positionEndX + 50 <= canvasWidth;
|
|
9416
|
+
const YInSideView = positionEndY + 50 <= canvasHeight;
|
|
9417
|
+
let positionX = positionEndX;
|
|
9418
|
+
let positionY = positionEndY;
|
|
9419
|
+
if (!XInSideView) positionX = canvasWidth - 100;
|
|
9420
|
+
if (!YInSideView) positionY = canvasHeight - 100;
|
|
9421
|
+
return {
|
|
9422
|
+
positionX,
|
|
9423
|
+
positionY
|
|
9424
|
+
};
|
|
9425
|
+
};
|
|
9426
|
+
const ClipboardPopupMenu = () => {
|
|
9427
|
+
const clipboardService = useDependency(ISheetClipboardService);
|
|
9428
|
+
const showMenu = useObservable(clipboardService.showMenu$, false);
|
|
9429
|
+
const pasteOptionsCache = useObservable(clipboardService.pasteOptionsCache$, null);
|
|
9430
|
+
const localeService = useDependency(LocaleService);
|
|
9431
|
+
const commandService = useDependency(ICommandService);
|
|
9432
|
+
const [menuHovered, setMenuHovered] = useState(false);
|
|
9433
|
+
const [visible, setVisible] = useState(false);
|
|
9434
|
+
const range = pasteOptionsCache === null || pasteOptionsCache === void 0 ? void 0 : pasteOptionsCache.target.pastedRange;
|
|
9435
|
+
const relativePosition = useMenuPosition(range);
|
|
9436
|
+
if (!relativePosition || !showMenu) return null;
|
|
9437
|
+
if (relativePosition.positionX < 50 || relativePosition.positionY < 30) return null;
|
|
9438
|
+
const showMore = menuHovered || visible;
|
|
9439
|
+
const handleClick = (type) => {
|
|
9440
|
+
setVisible(false);
|
|
9441
|
+
commandService.executeCommand(SheetOptionalPasteCommand.id, { type });
|
|
9442
|
+
};
|
|
9443
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9444
|
+
className: "univer-absolute univer-inset-0 univer-z-10 univer-size-0",
|
|
9445
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
9446
|
+
className: "univer-absolute",
|
|
9447
|
+
style: {
|
|
9448
|
+
left: relativePosition.positionX + DEFAULT_PADDING,
|
|
9449
|
+
top: relativePosition.positionY + DEFAULT_PADDING
|
|
9450
|
+
},
|
|
9451
|
+
onMouseEnter: () => setMenuHovered(true),
|
|
9452
|
+
onMouseLeave: () => setMenuHovered(false),
|
|
9453
|
+
children: /* @__PURE__ */ jsx(DropdownMenu, {
|
|
9454
|
+
align: "start",
|
|
9455
|
+
items: SheetPasteOptions.map((item) => ({
|
|
9456
|
+
type: "checkbox",
|
|
9457
|
+
value: item.value,
|
|
9458
|
+
label: localeService.t(item.label),
|
|
9459
|
+
checked: (pasteOptionsCache === null || pasteOptionsCache === void 0 ? void 0 : pasteOptionsCache.pasteType) === PREDEFINED_HOOK_NAME_PASTE[item.value],
|
|
9460
|
+
onSelect: () => handleClick(item.value)
|
|
9461
|
+
})),
|
|
9462
|
+
open: visible,
|
|
9463
|
+
onOpenChange: setVisible,
|
|
9464
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
9465
|
+
className: clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", borderClassName, {
|
|
9466
|
+
"univer-bg-gray-100 dark:!univer-bg-gray-800": visible,
|
|
9467
|
+
"univer-bg-gray-0 dark:!univer-bg-gray-900": !visible
|
|
9468
|
+
}),
|
|
9469
|
+
children: [/* @__PURE__ */ jsx(PasteSpecialDoubleIcon, { className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-gray-0" }), showMore && /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-gray-0" })]
|
|
9470
|
+
})
|
|
9471
|
+
})
|
|
9472
|
+
})
|
|
9473
|
+
});
|
|
9474
|
+
};
|
|
9475
|
+
|
|
9476
|
+
//#endregion
|
|
9477
|
+
//#region src/controllers/clipboard/const.ts
|
|
9478
|
+
/**
|
|
9479
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
9480
|
+
*
|
|
9481
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9482
|
+
* you may not use this file except in compliance with the License.
|
|
9483
|
+
* You may obtain a copy of the License at
|
|
9484
|
+
*
|
|
9485
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9486
|
+
*
|
|
9487
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9488
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9489
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9490
|
+
* See the License for the specific language governing permissions and
|
|
9491
|
+
* limitations under the License.
|
|
9492
|
+
*/
|
|
9493
|
+
const RemovePasteMenuCommands = [
|
|
9494
|
+
SetCellEditVisibleOperation.id,
|
|
9495
|
+
SetRangeValuesCommand.id,
|
|
9496
|
+
SetZoomRatioOperation.id,
|
|
9497
|
+
MoveRangeMutation.id,
|
|
9498
|
+
RemoveRowMutation.id,
|
|
9499
|
+
RemoveColMutation.id,
|
|
9500
|
+
InsertRowMutation.id,
|
|
9501
|
+
InsertColMutation.id,
|
|
9502
|
+
MoveRowsMutation.id,
|
|
9503
|
+
MoveColsMutation.id,
|
|
9504
|
+
SetWorksheetColWidthMutation.id,
|
|
9505
|
+
SetWorksheetRowHeightMutation.id,
|
|
9506
|
+
SetSelectionsOperation.id,
|
|
9507
|
+
UndoCommandId
|
|
9508
|
+
];
|
|
9509
|
+
|
|
9510
|
+
//#endregion
|
|
9511
|
+
//#region src/services/editor/cell-editor-manager.service.ts
|
|
9512
|
+
var CellEditorManagerService = class {
|
|
9513
|
+
constructor() {
|
|
9514
|
+
_defineProperty(this, "_state", null);
|
|
9515
|
+
_defineProperty(this, "_rect", null);
|
|
9516
|
+
_defineProperty(this, "_state$", new BehaviorSubject(null));
|
|
9517
|
+
_defineProperty(this, "state$", this._state$.asObservable());
|
|
9518
|
+
_defineProperty(this, "_rect$", new BehaviorSubject(null));
|
|
9519
|
+
_defineProperty(this, "rect$", this._rect$.asObservable());
|
|
9520
|
+
_defineProperty(this, "_focus", false);
|
|
9521
|
+
_defineProperty(this, "_focus$", new BehaviorSubject(this._focus));
|
|
9522
|
+
_defineProperty(this, "focus$", this._focus$.asObservable());
|
|
9276
9523
|
}
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
this.
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
this.
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9524
|
+
dispose() {
|
|
9525
|
+
this._state$.complete();
|
|
9526
|
+
this._state = null;
|
|
9527
|
+
this._rect$.complete();
|
|
9528
|
+
this._rect = null;
|
|
9529
|
+
}
|
|
9530
|
+
setState(param) {
|
|
9531
|
+
this._state = param;
|
|
9532
|
+
this._refresh(param);
|
|
9533
|
+
}
|
|
9534
|
+
getRect() {
|
|
9535
|
+
return this._rect;
|
|
9536
|
+
}
|
|
9537
|
+
setRect(param) {
|
|
9538
|
+
this._rect = param;
|
|
9539
|
+
this._rect$.next(param);
|
|
9540
|
+
}
|
|
9541
|
+
getState() {
|
|
9542
|
+
return this._state;
|
|
9543
|
+
}
|
|
9544
|
+
setFocus(param = false) {
|
|
9545
|
+
this._focus = param;
|
|
9546
|
+
this._focus$.next(param);
|
|
9547
|
+
}
|
|
9548
|
+
_refresh(param) {
|
|
9549
|
+
this._state$.next(param);
|
|
9550
|
+
}
|
|
9551
|
+
};
|
|
9552
|
+
const ICellEditorManagerService = createIdentifier("univer.sheet-cell-editor-manager.service");
|
|
9553
|
+
|
|
9554
|
+
//#endregion
|
|
9555
|
+
//#region src/services/sheet-embed-integration.service.ts
|
|
9556
|
+
const SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = "data-embed-interaction-boundary-owner";
|
|
9557
|
+
const SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE = "data-embed-runtime-focus-role";
|
|
9558
|
+
const SHEET_EMBED_FLOAT_DOM_ATTRIBUTE = "data-embed-float-dom";
|
|
9559
|
+
const SHEET_EMBED_ID_ATTRIBUTE = "data-embed-id";
|
|
9560
|
+
const SHEET_EMBED_HOST_UNIT_ID_ATTRIBUTE = "data-embed-host-unit-id";
|
|
9561
|
+
const SHEET_EMBED_CHILD_UNIT_ID_ATTRIBUTE = "data-embed-child-unit-id";
|
|
9562
|
+
const SHEET_EMBED_CHILD_TYPE_ATTRIBUTE = "data-embed-child-type";
|
|
9563
|
+
const ISheetEmbedInteractionBoundaryService = createIdentifier("sheets-ui.embed-interaction-boundary.service");
|
|
9564
|
+
const ISheetEmbedRuntimeFocusCoordinator = createIdentifier("sheets-ui.embed-runtime-focus-coordinator");
|
|
9565
|
+
const ISheetEmbedFloatingGeometryService = createIdentifier("sheets-ui.embed-floating-geometry.service");
|
|
9566
|
+
function resolveSheetEmbedRuntimeDomScope(element) {
|
|
9567
|
+
var _element$closest;
|
|
9568
|
+
if (!element) return;
|
|
9569
|
+
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;
|
|
9570
|
+
const container = resolveSheetEmbedFloatDomContainer(element, embedId);
|
|
9571
|
+
const resolvedEmbedId = (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-id")) ?? embedId;
|
|
9572
|
+
if (!resolvedEmbedId) return;
|
|
9573
|
+
return {
|
|
9574
|
+
embedId: resolvedEmbedId,
|
|
9575
|
+
hostUnitId: (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-host-unit-id")) ?? void 0,
|
|
9576
|
+
childUnitId: (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-child-unit-id")) ?? void 0,
|
|
9577
|
+
childType: readChildType(container)
|
|
9578
|
+
};
|
|
9579
|
+
}
|
|
9580
|
+
function resolveActiveSheetEmbedRuntimeDomScope(ownerDocument = document) {
|
|
9581
|
+
const activeContainer = ownerDocument.querySelector(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"][data-embed-float-stage="stage2"]`);
|
|
9582
|
+
if (!activeContainer) return;
|
|
9583
|
+
return resolveSheetEmbedRuntimeDomScope(activeContainer);
|
|
9584
|
+
}
|
|
9585
|
+
function resolveSheetEmbedFloatDomContainer(element, embedId) {
|
|
9586
|
+
const ownContainer = element === null || element === void 0 ? void 0 : element.closest(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"]`);
|
|
9587
|
+
if (ownContainer && (!embedId || ownContainer.getAttribute("data-embed-id") === embedId)) return ownContainer;
|
|
9588
|
+
const ownerDocument = (element === null || element === void 0 ? void 0 : element.ownerDocument) ?? (typeof document === "undefined" ? void 0 : document);
|
|
9589
|
+
if (!ownerDocument || !embedId) return ownContainer ?? void 0;
|
|
9590
|
+
return ownerDocument.querySelector(`[${"data-embed-float-dom"}="true"][${"data-embed-id"}="${escapeAttributeValue(embedId)}"]`) ?? void 0;
|
|
9591
|
+
}
|
|
9592
|
+
function escapeAttributeValue(value) {
|
|
9593
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
9594
|
+
}
|
|
9595
|
+
function readChildType(container) {
|
|
9596
|
+
const value = container === null || container === void 0 ? void 0 : container.getAttribute(SHEET_EMBED_CHILD_TYPE_ATTRIBUTE);
|
|
9597
|
+
if (value == null || value === "") return;
|
|
9598
|
+
return Number(value);
|
|
9599
|
+
}
|
|
9600
|
+
|
|
9601
|
+
//#endregion
|
|
9602
|
+
//#region src/services/editor/cell-editor-resize.service.ts
|
|
9603
|
+
const EDITOR_INPUT_SELF_EXTEND_GAP = 5;
|
|
9604
|
+
const EDITOR_BORDER_SIZE = 2;
|
|
9605
|
+
let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Disposable {
|
|
9606
|
+
constructor(_layoutService, _cellEditorManagerService, _editorBridgeService, _renderManagerService, _univerInstanceService, _configService, _embedFloatingGeometryService) {
|
|
9607
|
+
super();
|
|
9608
|
+
this._layoutService = _layoutService;
|
|
9609
|
+
this._cellEditorManagerService = _cellEditorManagerService;
|
|
9610
|
+
this._editorBridgeService = _editorBridgeService;
|
|
9611
|
+
this._renderManagerService = _renderManagerService;
|
|
9612
|
+
this._univerInstanceService = _univerInstanceService;
|
|
9613
|
+
this._configService = _configService;
|
|
9614
|
+
this._embedFloatingGeometryService = _embedFloatingGeometryService;
|
|
9615
|
+
}
|
|
9616
|
+
get _currentRenderer() {
|
|
9617
|
+
return getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
|
|
9618
|
+
}
|
|
9619
|
+
get _editingUnitId() {
|
|
9620
|
+
var _this$_editorBridgeSe;
|
|
9621
|
+
return ((_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.unitId) ?? "";
|
|
9622
|
+
}
|
|
9623
|
+
get _editingRenderer() {
|
|
9624
|
+
return this._renderManagerService.getRenderUnitById(this._editingUnitId);
|
|
9625
|
+
}
|
|
9626
|
+
get _renderer() {
|
|
9627
|
+
return this._editingRenderer ?? this._currentRenderer;
|
|
9628
|
+
}
|
|
9629
|
+
get _sheetSkeletonManagerService() {
|
|
9630
|
+
var _this$_renderer;
|
|
9631
|
+
return (_this$_renderer = this._renderer) === null || _this$_renderer === void 0 ? void 0 : _this$_renderer.with(SheetSkeletonManagerService);
|
|
9632
|
+
}
|
|
9633
|
+
get engine() {
|
|
9634
|
+
var _this$_renderer2;
|
|
9635
|
+
return (_this$_renderer2 = this._renderer) === null || _this$_renderer2 === void 0 ? void 0 : _this$_renderer2.engine;
|
|
9636
|
+
}
|
|
9637
|
+
fitTextSize(callback) {
|
|
9638
|
+
const param = this._editorBridgeService.getEditCellState();
|
|
9639
|
+
if (!param) return;
|
|
9640
|
+
const { position, documentLayoutObject, canvasOffset, scaleX, scaleY } = param;
|
|
9641
|
+
const { startX, startY, endX, endY } = position;
|
|
9642
|
+
const documentDataModel = this._univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
|
|
9643
|
+
if (documentDataModel == null) return;
|
|
9644
|
+
const documentSkeleton = this._getEditorSkeleton();
|
|
9645
|
+
if (!documentSkeleton) return;
|
|
9646
|
+
documentSkeleton.resetInitialWidth();
|
|
9647
|
+
const info = this._predictingSize(position, canvasOffset, documentSkeleton, documentLayoutObject, scaleX, scaleY);
|
|
9648
|
+
if (!info || info.actualWidth <= 0) return;
|
|
9649
|
+
let { actualWidth, actualHeight } = info;
|
|
9650
|
+
const { verticalAlign, horizontalAlign, paddingData, fill } = documentLayoutObject;
|
|
9651
|
+
actualWidth = actualWidth + (paddingData.l ?? 0) * scaleX + (paddingData.r ?? 0) * scaleX;
|
|
9652
|
+
actualHeight = actualHeight + (paddingData.t ?? 0) * scaleY + (paddingData.b ?? 0) * scaleY;
|
|
9653
|
+
let editorWidth = endX - startX;
|
|
9654
|
+
let editorHeight = endY - startY;
|
|
9655
|
+
if (editorWidth < actualWidth) editorWidth = Math.ceil(actualWidth);
|
|
9656
|
+
if (editorHeight < actualHeight) editorHeight = Math.ceil(actualHeight);
|
|
9657
|
+
let offsetTop = 0;
|
|
9658
|
+
if (verticalAlign === VerticalAlign.MIDDLE) offsetTop = (editorHeight - actualHeight) / 2 / scaleY;
|
|
9659
|
+
else if (verticalAlign === VerticalAlign.TOP) offsetTop = paddingData.t || 0;
|
|
9660
|
+
else offsetTop = (editorHeight - actualHeight) / scaleY;
|
|
9661
|
+
let offsetLeft = 0;
|
|
9662
|
+
if (horizontalAlign === HorizontalAlign.CENTER) {} else if (horizontalAlign === HorizontalAlign.RIGHT) offsetLeft = (editorWidth - actualWidth) / scaleX;
|
|
9663
|
+
else offsetLeft = paddingData.l || 0;
|
|
9664
|
+
offsetTop = Math.max(offsetTop, paddingData.t || 0);
|
|
9665
|
+
offsetLeft = Math.max(offsetLeft, paddingData.l || 0);
|
|
9666
|
+
documentDataModel.updateDocumentDataMargin({
|
|
9667
|
+
t: offsetTop,
|
|
9668
|
+
l: offsetLeft
|
|
9669
|
+
});
|
|
9670
|
+
documentSkeleton.calculate();
|
|
9671
|
+
this._editAreaProcessing(editorWidth, editorHeight, position, canvasOffset, fill, scaleX, scaleY, horizontalAlign, callback);
|
|
9311
9672
|
}
|
|
9312
9673
|
/**
|
|
9313
|
-
*
|
|
9314
|
-
*
|
|
9674
|
+
* Mainly used to pre-calculate the width of the editor,
|
|
9675
|
+
* to determine whether it needs to be automatically widened.
|
|
9315
9676
|
*/
|
|
9316
|
-
|
|
9317
|
-
|
|
9318
|
-
const
|
|
9319
|
-
|
|
9320
|
-
const
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
Object.keys(data).filter((key) => key.startsWith(SHEET_EXTENSION_PREFIX)).forEach((key) => {
|
|
9327
|
-
totalSum += sums[key];
|
|
9677
|
+
_predictingSize(actualRangeWithCoord, canvasOffset, documentSkeleton, documentLayoutObject, scaleX = 1, scaleY = 1) {
|
|
9678
|
+
const { startX, endX } = actualRangeWithCoord;
|
|
9679
|
+
const { textRotation, wrapStrategy, paddingData } = documentLayoutObject;
|
|
9680
|
+
const documentDataModel = this._univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
|
|
9681
|
+
const { vertexAngle: angle } = convertTextRotation(textRotation);
|
|
9682
|
+
if (wrapStrategy === WrapStrategy.WRAP && angle === 0) {
|
|
9683
|
+
documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataPageSize((endX - startX) / scaleX);
|
|
9684
|
+
documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataMargin({
|
|
9685
|
+
l: paddingData.l,
|
|
9686
|
+
t: paddingData.t
|
|
9328
9687
|
});
|
|
9688
|
+
documentSkeleton.calculate();
|
|
9689
|
+
const { actualWidth, actualHeight } = documentSkeleton.getActualSize();
|
|
9329
9690
|
return {
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
};
|
|
9333
|
-
};
|
|
9334
|
-
const frameTimeListAfterSum = frameInfoList.map((info) => {
|
|
9335
|
-
return {
|
|
9336
|
-
...info,
|
|
9337
|
-
...sumValueForNumListFields(info)
|
|
9691
|
+
actualWidth: actualWidth * scaleX,
|
|
9692
|
+
actualHeight: actualHeight * scaleY
|
|
9338
9693
|
};
|
|
9694
|
+
}
|
|
9695
|
+
const maxSize = this._getEditorMaxSize(actualRangeWithCoord, canvasOffset, documentLayoutObject.horizontalAlign);
|
|
9696
|
+
if (!maxSize) return;
|
|
9697
|
+
documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataPageSize(maxSize.width / scaleX);
|
|
9698
|
+
documentSkeleton.calculate();
|
|
9699
|
+
const size = documentSkeleton.getActualSize();
|
|
9700
|
+
let editorWidth = endX - startX;
|
|
9701
|
+
if (editorWidth < size.actualWidth * scaleX + EDITOR_INPUT_SELF_EXTEND_GAP * scaleX) editorWidth = size.actualWidth * scaleX + EDITOR_INPUT_SELF_EXTEND_GAP * scaleX;
|
|
9702
|
+
documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataPageSize(editorWidth / scaleX);
|
|
9703
|
+
/**
|
|
9704
|
+
* Do not rely on cell layout logic, depend on the document's internal alignment logic.
|
|
9705
|
+
*/
|
|
9706
|
+
documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentRenderConfig({
|
|
9707
|
+
horizontalAlign: HorizontalAlign.UNSPECIFIED,
|
|
9708
|
+
cellValueType: void 0
|
|
9339
9709
|
});
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
const max = Math.max(...values);
|
|
9344
|
-
const min = Math.min(...values);
|
|
9345
|
-
const avg = values.reduce((sum, val) => sum + val, 0) / values.length;
|
|
9346
|
-
acc[key] = {
|
|
9347
|
-
max: Math.round(max * 100) / 100,
|
|
9348
|
-
min: Math.round(min * 100) / 100,
|
|
9349
|
-
avg: Math.round(avg * 100) / 100
|
|
9350
|
-
};
|
|
9351
|
-
return acc;
|
|
9352
|
-
}, {});
|
|
9353
|
-
};
|
|
9354
|
-
const summaryFrameStats = getSummaryStats(frameTimeListAfterSum);
|
|
9355
|
-
const elapsedTimeToStart = filteredFrameInfo[filteredFrameInfo.length - 1].elapsedTime;
|
|
9356
|
-
const telemetryData = {
|
|
9357
|
-
sheetId: this._context.unit.getActiveSheet().getSheetId(),
|
|
9358
|
-
unitId: this._context.unit.getUnitId(),
|
|
9359
|
-
elapsedTimeToStart,
|
|
9360
|
-
...summaryFrameStats
|
|
9361
|
-
};
|
|
9362
|
-
this._renderMetric$.next(telemetryData);
|
|
9363
|
-
(_this$_telemetryServi = this._telemetryService) === null || _this$_telemetryServi === void 0 || _this$_telemetryServi.capture("sheet_render_cost", telemetryData);
|
|
9364
|
-
}
|
|
9365
|
-
_addComponent(workbook) {
|
|
9366
|
-
const { scene, components } = this._context;
|
|
9367
|
-
const worksheet = workbook.getActiveSheet();
|
|
9368
|
-
const spreadsheet = new Spreadsheet("__SpreadsheetRender__");
|
|
9369
|
-
this._addViewport(worksheet);
|
|
9370
|
-
const spreadsheetRowHeader = new SpreadsheetRowHeader("__SpreadsheetRowHeader__");
|
|
9371
|
-
const spreadsheetColumnHeader = new SpreadsheetColumnHeader("__SpreadsheetColumnHeader__");
|
|
9372
|
-
const SpreadsheetLeftTopPlaceholder = new Rect("__SpreadsheetLeftTopPlaceholder__", {
|
|
9373
|
-
zIndex: 2,
|
|
9374
|
-
left: -1,
|
|
9375
|
-
top: -1,
|
|
9376
|
-
fill: "rgb(248, 249, 250)",
|
|
9377
|
-
stroke: "rgb(217, 217, 217)",
|
|
9378
|
-
strokeWidth: 1
|
|
9379
|
-
});
|
|
9380
|
-
this._context.mainComponent = spreadsheet;
|
|
9381
|
-
components.set("__SpreadsheetRender__", spreadsheet);
|
|
9382
|
-
components.set("__SpreadsheetRowHeader__", spreadsheetRowHeader);
|
|
9383
|
-
components.set("__SpreadsheetColumnHeader__", spreadsheetColumnHeader);
|
|
9384
|
-
components.set("__SpreadsheetLeftTopPlaceholder__", SpreadsheetLeftTopPlaceholder);
|
|
9385
|
-
scene.addObjects([spreadsheet], 0);
|
|
9386
|
-
scene.addObjects([
|
|
9387
|
-
spreadsheetRowHeader,
|
|
9388
|
-
spreadsheetColumnHeader,
|
|
9389
|
-
SpreadsheetLeftTopPlaceholder
|
|
9390
|
-
], 10);
|
|
9391
|
-
scene.enableLayerCache(0, 10);
|
|
9392
|
-
}
|
|
9393
|
-
_initViewports(scene, rowHeader, columnHeader) {
|
|
9394
|
-
const rowHeaderWidth = rowHeader.hidden ? 0 : rowHeader.width;
|
|
9395
|
-
const columnHeaderHeight = columnHeader.hidden ? 0 : columnHeader.height;
|
|
9396
|
-
const bufferEdgeX = 100;
|
|
9397
|
-
const bufferEdgeY = 100;
|
|
9398
|
-
const viewMain = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN, scene, {
|
|
9399
|
-
left: rowHeaderWidth,
|
|
9400
|
-
top: columnHeaderHeight,
|
|
9401
|
-
bottom: 0,
|
|
9402
|
-
right: 0,
|
|
9403
|
-
isWheelPreventDefaultX: true,
|
|
9404
|
-
allowCache: true,
|
|
9405
|
-
bufferEdgeX,
|
|
9406
|
-
bufferEdgeY
|
|
9407
|
-
});
|
|
9408
|
-
const viewMainLeftTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP, scene, {
|
|
9409
|
-
isWheelPreventDefaultX: true,
|
|
9410
|
-
active: false,
|
|
9411
|
-
allowCache: true,
|
|
9412
|
-
bufferEdgeX: 0,
|
|
9413
|
-
bufferEdgeY: 0
|
|
9414
|
-
});
|
|
9415
|
-
const viewMainLeft = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT, scene, {
|
|
9416
|
-
isWheelPreventDefaultX: true,
|
|
9417
|
-
active: false,
|
|
9418
|
-
allowCache: true,
|
|
9419
|
-
bufferEdgeX: 0,
|
|
9420
|
-
bufferEdgeY
|
|
9421
|
-
});
|
|
9422
|
-
const viewMainTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP, scene, {
|
|
9423
|
-
isWheelPreventDefaultX: true,
|
|
9424
|
-
active: false,
|
|
9425
|
-
allowCache: true,
|
|
9426
|
-
bufferEdgeX,
|
|
9427
|
-
bufferEdgeY: 0
|
|
9428
|
-
});
|
|
9429
|
-
const viewRowTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_ROW_TOP, scene, {
|
|
9430
|
-
active: false,
|
|
9431
|
-
isWheelPreventDefaultX: true
|
|
9432
|
-
});
|
|
9433
|
-
const viewRowBottom = new Viewport(SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM, scene, {
|
|
9434
|
-
left: 0,
|
|
9435
|
-
top: columnHeaderHeight,
|
|
9436
|
-
bottom: 0,
|
|
9437
|
-
width: rowHeaderWidth + 1,
|
|
9438
|
-
isWheelPreventDefaultX: true
|
|
9439
|
-
});
|
|
9440
|
-
const viewColumnLeft = new Viewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT, scene, {
|
|
9441
|
-
active: false,
|
|
9442
|
-
isWheelPreventDefaultX: true
|
|
9443
|
-
});
|
|
9444
|
-
const viewColumnRight = new Viewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT, scene, {
|
|
9445
|
-
left: rowHeaderWidth,
|
|
9446
|
-
top: 0,
|
|
9447
|
-
height: columnHeaderHeight + 1,
|
|
9448
|
-
right: 0,
|
|
9449
|
-
isWheelPreventDefaultX: true
|
|
9450
|
-
});
|
|
9451
|
-
return {
|
|
9452
|
-
viewMain,
|
|
9453
|
-
viewLeftTop: new Viewport(SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP, scene, {
|
|
9454
|
-
left: 0,
|
|
9455
|
-
top: 0,
|
|
9456
|
-
width: rowHeaderWidth,
|
|
9457
|
-
height: columnHeaderHeight,
|
|
9458
|
-
isWheelPreventDefaultX: true
|
|
9459
|
-
}),
|
|
9460
|
-
viewMainLeftTop,
|
|
9461
|
-
viewMainLeft,
|
|
9462
|
-
viewMainTop,
|
|
9463
|
-
viewColumnLeft,
|
|
9464
|
-
viewRowTop,
|
|
9465
|
-
viewRowBottom,
|
|
9466
|
-
viewColumnRight
|
|
9467
|
-
};
|
|
9468
|
-
}
|
|
9469
|
-
/**
|
|
9470
|
-
*
|
|
9471
|
-
* initViewport & wheel event
|
|
9472
|
-
* +-----------------+--------------------+-------------------+
|
|
9473
|
-
* | VIEW_LEFT_TOP | VIEW_COLUMN_LEFT | VIEW_COLUMN_RIGHT |
|
|
9474
|
-
* +-----------------+--------------------+-------------------+
|
|
9475
|
-
* | VIEW_ROW_TOP | VIEW_MAIN_LEFT_TOP | VIEW_MAIN_TOP |
|
|
9476
|
-
* +-----------------+--------------------+-------------------+
|
|
9477
|
-
* | VIEW_ROW_BOTTOM | VIEW_MAIN_LEFT | VIEW_MAIN |
|
|
9478
|
-
* +-----------------+--------------------+-------------------+
|
|
9479
|
-
*/
|
|
9480
|
-
_addViewport(worksheet) {
|
|
9481
|
-
const scene = this._context.scene;
|
|
9482
|
-
const { rowHeader, columnHeader } = worksheet.getConfig();
|
|
9483
|
-
const { viewMain } = this._initViewports(scene, rowHeader, columnHeader);
|
|
9484
|
-
const sheetsUIConfig = this._configService.getConfig(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
9485
|
-
new ScrollBar(viewMain, sheetsUIConfig === null || sheetsUIConfig === void 0 ? void 0 : sheetsUIConfig.scrollConfig);
|
|
9486
|
-
scene.attachControl();
|
|
9487
|
-
return viewMain;
|
|
9488
|
-
}
|
|
9489
|
-
_initRerenderScheduler() {
|
|
9490
|
-
this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((param) => {
|
|
9491
|
-
if (!param) return null;
|
|
9492
|
-
const { skeleton: spreadsheetSkeleton, sheetId } = param;
|
|
9493
|
-
const workbook = this._context.unit;
|
|
9494
|
-
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(sheetId);
|
|
9495
|
-
if (workbook == null || worksheet == null) return;
|
|
9496
|
-
const { mainComponent, components } = this._context;
|
|
9497
|
-
const spreadsheet = mainComponent;
|
|
9498
|
-
const spreadsheetRowHeader = components.get("__SpreadsheetRowHeader__");
|
|
9499
|
-
const spreadsheetColumnHeader = components.get("__SpreadsheetColumnHeader__");
|
|
9500
|
-
const spreadsheetLeftTopPlaceholder = components.get("__SpreadsheetLeftTopPlaceholder__");
|
|
9501
|
-
const leftTopPlaceholderSize = getLeftTopPlaceholderSize(spreadsheetSkeleton);
|
|
9502
|
-
spreadsheet === null || spreadsheet === void 0 || spreadsheet.updateSkeleton(spreadsheetSkeleton);
|
|
9503
|
-
spreadsheetRowHeader === null || spreadsheetRowHeader === void 0 || spreadsheetRowHeader.updateSkeleton(spreadsheetSkeleton);
|
|
9504
|
-
spreadsheetColumnHeader === null || spreadsheetColumnHeader === void 0 || spreadsheetColumnHeader.updateSkeleton(spreadsheetSkeleton);
|
|
9505
|
-
spreadsheetLeftTopPlaceholder === null || spreadsheetLeftTopPlaceholder === void 0 || spreadsheetLeftTopPlaceholder.transformByState({
|
|
9506
|
-
width: leftTopPlaceholderSize.width,
|
|
9507
|
-
height: leftTopPlaceholderSize.height
|
|
9508
|
-
});
|
|
9509
|
-
}));
|
|
9510
|
-
}
|
|
9511
|
-
_initCommandListener() {
|
|
9512
|
-
this.disposeWithMe(this._commandService.onCommandExecuted((command, options) => {
|
|
9513
|
-
const { unit: workbook } = this._context;
|
|
9514
|
-
const { id: commandId } = command;
|
|
9515
|
-
if (COMMAND_LISTENER_SKELETON_CHANGE.includes(commandId) || this._sheetRenderService.checkMutationShouldTriggerRerender(commandId)) {
|
|
9516
|
-
const { unitId, subUnitId } = command.params;
|
|
9517
|
-
const worksheet = workbook.getActiveSheet();
|
|
9518
|
-
if (!worksheet) return;
|
|
9519
|
-
const workbookId = this._context.unitId;
|
|
9520
|
-
const worksheetId = worksheet.getSheetId();
|
|
9521
|
-
if (unitId !== workbookId || subUnitId !== worksheetId) return;
|
|
9522
|
-
this._sheetSkeletonManagerService.makeDirty({
|
|
9523
|
-
sheetId: worksheetId,
|
|
9524
|
-
commandId
|
|
9525
|
-
}, true);
|
|
9526
|
-
this._sheetSkeletonManagerService.setCurrent({
|
|
9527
|
-
sheetId: worksheetId,
|
|
9528
|
-
commandId
|
|
9529
|
-
});
|
|
9530
|
-
} else if (COMMAND_LISTENER_VALUE_CHANGE.includes(commandId)) this._sheetSkeletonManagerService.reCalculate();
|
|
9531
|
-
if (command.type === CommandType.MUTATION) this._markUnitDirty(command, options);
|
|
9532
|
-
}));
|
|
9533
|
-
}
|
|
9534
|
-
_markUnitDirty(command, options) {
|
|
9535
|
-
if (command.id.substring(0, 3) === "doc") return;
|
|
9536
|
-
const { mainComponent: spreadsheet, scene } = this._context;
|
|
9537
|
-
if (command.id === SetFormulaCalculationNotificationMutation.id) {
|
|
9538
|
-
if (command.params.stageInfo != null) return;
|
|
9539
|
-
}
|
|
9540
|
-
if (spreadsheet) spreadsheet.makeDirty();
|
|
9541
|
-
scene.makeDirty();
|
|
9542
|
-
if (!command.params) return;
|
|
9543
|
-
const cmdParams = command.params;
|
|
9544
|
-
const viewports = this._spreadsheetViewports(scene);
|
|
9545
|
-
if (command.id === SetRangeValuesMutation.id && cmdParams.cellValue && !(options === null || options === void 0 ? void 0 : options.fromChangeset)) {
|
|
9546
|
-
const dirtyRange = this._cellValueToRange(cmdParams.cellValue);
|
|
9547
|
-
const dirtyBounds = this._rangeToBounds([dirtyRange]);
|
|
9548
|
-
this._markViewportDirty(viewports, dirtyBounds);
|
|
9549
|
-
spreadsheet.setDirtyArea(dirtyBounds);
|
|
9550
|
-
}
|
|
9551
|
-
if (command.id === MoveRangeMutation.id && cmdParams.from && cmdParams.to && !(options === null || options === void 0 ? void 0 : options.fromChangeset)) {
|
|
9552
|
-
const fromRange = cmdParams.fromRange || this._cellValueToRange(cmdParams.from.value);
|
|
9553
|
-
const toRange = cmdParams.toRange || this._cellValueToRange(cmdParams.to.value);
|
|
9554
|
-
const dirtyBounds = this._rangeToBounds([fromRange, toRange]);
|
|
9555
|
-
this._markViewportDirty(viewports, dirtyBounds);
|
|
9556
|
-
spreadsheet.setDirtyArea(dirtyBounds);
|
|
9557
|
-
}
|
|
9558
|
-
}
|
|
9559
|
-
/**
|
|
9560
|
-
* cellValue data structure:
|
|
9561
|
-
* {[row]: { [col]: value}}
|
|
9562
|
-
* @param cellValue
|
|
9563
|
-
* @returns IRange
|
|
9564
|
-
*/
|
|
9565
|
-
_cellValueToRange(cellValue) {
|
|
9566
|
-
const columns = [];
|
|
9567
|
-
let minCol = 0;
|
|
9568
|
-
let maxCol = 0;
|
|
9569
|
-
let minRow = 0;
|
|
9570
|
-
let maxRow = 0;
|
|
9571
|
-
for (const [_row, columnObj] of Object.entries(cellValue)) {
|
|
9572
|
-
for (const column in columnObj) {
|
|
9573
|
-
columns.push(Number(column));
|
|
9574
|
-
if (minCol > Number(column)) minCol = Number(column);
|
|
9575
|
-
if (maxCol < Number(column)) maxCol = Number(column);
|
|
9576
|
-
}
|
|
9577
|
-
if (minRow > Number(_row)) minRow = Number(_row);
|
|
9578
|
-
if (maxRow < Number(_row)) maxRow = Number(_row);
|
|
9579
|
-
}
|
|
9580
|
-
return {
|
|
9581
|
-
startRow: minRow,
|
|
9582
|
-
endRow: maxRow,
|
|
9583
|
-
startColumn: minCol,
|
|
9584
|
-
endColumn: maxCol
|
|
9585
|
-
};
|
|
9586
|
-
}
|
|
9587
|
-
_rangeToBounds(ranges) {
|
|
9588
|
-
const { rowHeightAccumulation, columnWidthAccumulation, rowHeaderWidth, columnHeaderHeight } = this._sheetSkeletonManagerService.getCurrentParam().skeleton;
|
|
9589
|
-
const dirtyBounds = [];
|
|
9590
|
-
for (const r of ranges) {
|
|
9591
|
-
const { startRow, endRow, startColumn, endColumn } = r;
|
|
9592
|
-
const top = startRow === 0 ? 0 : rowHeightAccumulation[startRow - 1] + columnHeaderHeight;
|
|
9593
|
-
const bottom = rowHeightAccumulation[endRow] + columnHeaderHeight;
|
|
9594
|
-
const left = startColumn === 0 ? 0 : columnWidthAccumulation[startColumn - 1] + rowHeaderWidth;
|
|
9595
|
-
const right = columnWidthAccumulation[endColumn] + rowHeaderWidth;
|
|
9596
|
-
dirtyBounds.push({
|
|
9597
|
-
top,
|
|
9598
|
-
left,
|
|
9599
|
-
bottom,
|
|
9600
|
-
right,
|
|
9601
|
-
width: right - left,
|
|
9602
|
-
height: bottom - top
|
|
9603
|
-
});
|
|
9604
|
-
}
|
|
9605
|
-
return dirtyBounds;
|
|
9606
|
-
}
|
|
9607
|
-
_markViewportDirty(viewports, dirtyBounds) {
|
|
9608
|
-
const activeViewports = viewports.filter((vp) => vp.isActive && vp.cacheBound);
|
|
9609
|
-
for (const vp of activeViewports) for (const b of dirtyBounds) if (Rectangle.hasIntersectionBetweenTwoRect(vp.cacheBound, b)) vp.markDirty(true);
|
|
9610
|
-
}
|
|
9611
|
-
_spreadsheetViewports(scene) {
|
|
9612
|
-
return scene.getViewports().filter((v) => [
|
|
9613
|
-
"viewMain",
|
|
9614
|
-
"viewMainLeftTop",
|
|
9615
|
-
"viewMainTop",
|
|
9616
|
-
"viewMainLeft"
|
|
9617
|
-
].includes(v.viewportKey));
|
|
9618
|
-
}
|
|
9619
|
-
};
|
|
9620
|
-
SheetRenderController = __decorate([
|
|
9621
|
-
__decorateParam(1, Inject(IConfigService)),
|
|
9622
|
-
__decorateParam(2, Inject(SheetSkeletonManagerService)),
|
|
9623
|
-
__decorateParam(3, Inject(SheetsRenderService)),
|
|
9624
|
-
__decorateParam(4, ICommandService),
|
|
9625
|
-
__decorateParam(5, Optional(ITelemetryService))
|
|
9626
|
-
], SheetRenderController);
|
|
9627
|
-
function getLeftTopPlaceholderSize(skeleton) {
|
|
9628
|
-
return {
|
|
9629
|
-
width: skeleton.rowHeaderWidthAndMarginLeft ?? skeleton.rowHeaderWidth,
|
|
9630
|
-
height: skeleton.columnHeaderHeightAndMarginTop ?? skeleton.columnHeaderHeight
|
|
9631
|
-
};
|
|
9632
|
-
}
|
|
9633
|
-
|
|
9634
|
-
//#endregion
|
|
9635
|
-
//#region src/controllers/render-controllers/skeleton.render-controller.ts
|
|
9636
|
-
let SheetSkeletonRenderController = class SheetSkeletonRenderController extends Disposable {
|
|
9637
|
-
constructor(_context, _sheetSkeletonManagerService, _renderManagerService) {
|
|
9638
|
-
super();
|
|
9639
|
-
this._context = _context;
|
|
9640
|
-
this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
|
|
9641
|
-
this._renderManagerService = _renderManagerService;
|
|
9642
|
-
this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((param) => {
|
|
9643
|
-
this._updateSceneSize(param);
|
|
9644
|
-
}));
|
|
9645
|
-
}
|
|
9646
|
-
_updateSceneSize(param) {
|
|
9647
|
-
var _this$_renderManagerS;
|
|
9648
|
-
if (param == null) return;
|
|
9649
|
-
const { unitId } = this._context;
|
|
9650
|
-
const { skeleton } = param;
|
|
9651
|
-
const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
|
|
9652
|
-
if (skeleton == null || scene == null) return;
|
|
9653
|
-
const { rowTotalHeight, columnTotalWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
9654
|
-
if (!this._context.unit.getActiveSheet()) return;
|
|
9655
|
-
scene === null || scene === void 0 || scene.transformByState({
|
|
9656
|
-
width: rowHeaderWidthAndMarginLeft + columnTotalWidth,
|
|
9657
|
-
height: columnHeaderHeightAndMarginTop + rowTotalHeight
|
|
9658
|
-
});
|
|
9659
|
-
scene.getMainViewport().setMargin(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
9660
|
-
}
|
|
9661
|
-
};
|
|
9662
|
-
SheetSkeletonRenderController = __decorate([__decorateParam(1, Inject(SheetSkeletonManagerService)), __decorateParam(2, IRenderManagerService)], SheetSkeletonRenderController);
|
|
9663
|
-
|
|
9664
|
-
//#endregion
|
|
9665
|
-
//#region src/services/sheet-loading-render.service.ts
|
|
9666
|
-
const PREVIEW_UNIT_SUFFIX = "__snapshot_loading_preview__";
|
|
9667
|
-
const PREVIEW_SCENE_PREFIX = "_UNIVER_SCENE_";
|
|
9668
|
-
const PREVIEW_CANVAS_Z_INDEX = "9";
|
|
9669
|
-
const ISheetLoadingRenderService = createIdentifier("sheets-ui.sheet-loading-render.service");
|
|
9670
|
-
let SheetLoadingRenderService = class SheetLoadingRenderService extends Disposable {
|
|
9671
|
-
constructor(_injector, _layoutService, _sheetInterceptorService, _renderManagerService) {
|
|
9672
|
-
super();
|
|
9673
|
-
this._injector = _injector;
|
|
9674
|
-
this._layoutService = _layoutService;
|
|
9675
|
-
this._sheetInterceptorService = _sheetInterceptorService;
|
|
9676
|
-
this._renderManagerService = _renderManagerService;
|
|
9677
|
-
_defineProperty(this, "workbook$", new BehaviorSubject(null));
|
|
9678
|
-
_defineProperty(this, "loading$", new BehaviorSubject(false));
|
|
9679
|
-
_defineProperty(this, "previewReady$", new BehaviorSubject(false));
|
|
9680
|
-
_defineProperty(this, "_loadingRender", null);
|
|
9681
|
-
_defineProperty(this, "_finalCanvasGuard", null);
|
|
9682
|
-
_defineProperty(this, "_hiddenFinalCanvas", null);
|
|
9683
|
-
_defineProperty(this, "_finalCanvasVisibility", "");
|
|
9684
|
-
}
|
|
9685
|
-
showSkeleton(workbookData, activeSheetId) {
|
|
9686
|
-
var _this$_loadingRender;
|
|
9687
|
-
const sourceUnitId = workbookData.id;
|
|
9688
|
-
if (((_this$_loadingRender = this._loadingRender) === null || _this$_loadingRender === void 0 ? void 0 : _this$_loadingRender.sourceUnitId) !== sourceUnitId) {
|
|
9689
|
-
this._disposeLoadingRender();
|
|
9690
|
-
this.previewReady$.next(false);
|
|
9691
|
-
this._loadingRender = {
|
|
9692
|
-
sourceUnitId,
|
|
9693
|
-
workbook: this._createLoadingWorkbook(workbookData, activeSheetId),
|
|
9694
|
-
render: null
|
|
9695
|
-
};
|
|
9696
|
-
this.workbook$.next(this._loadingRender.workbook);
|
|
9697
|
-
this.loading$.next(true);
|
|
9698
|
-
this._guardFinalCanvas(sourceUnitId);
|
|
9699
|
-
}
|
|
9700
|
-
const worksheet = this._loadingRender.workbook.getSheetBySheetId(activeSheetId);
|
|
9701
|
-
if (worksheet && this._loadingRender.workbook.getActiveSheet().getSheetId() !== activeSheetId) this._loadingRender.workbook.setActiveSheet(worksheet);
|
|
9702
|
-
}
|
|
9703
|
-
show(workbookData, activeSheetId, cellData) {
|
|
9704
|
-
this.showSkeleton(workbookData, activeSheetId);
|
|
9705
|
-
const loadingRender = this._loadingRender;
|
|
9706
|
-
if (!loadingRender) return;
|
|
9707
|
-
let shouldRender = false;
|
|
9708
|
-
if (!loadingRender.render) {
|
|
9709
|
-
const contentElement = this._layoutService.getContentElement();
|
|
9710
|
-
if (!contentElement) return;
|
|
9711
|
-
loadingRender.render = this._createLoadingRender(loadingRender.workbook, loadingRender.sourceUnitId, contentElement);
|
|
9712
|
-
shouldRender = true;
|
|
9713
|
-
}
|
|
9714
|
-
const worksheet = loadingRender.workbook.getSheetBySheetId(activeSheetId);
|
|
9715
|
-
if (!worksheet) return;
|
|
9716
|
-
if (loadingRender.workbook.getActiveSheet().getSheetId() !== activeSheetId) {
|
|
9717
|
-
loadingRender.workbook.setActiveSheet(worksheet);
|
|
9718
|
-
loadingRender.render.with(SheetSkeletonManagerService).setCurrent({ sheetId: activeSheetId });
|
|
9719
|
-
shouldRender = true;
|
|
9720
|
-
}
|
|
9721
|
-
if (cellData && cellData !== loadingRender.lastCellData) {
|
|
9722
|
-
loadingRender.lastCellData = cellData;
|
|
9723
|
-
const target = worksheet.getCellMatrix();
|
|
9724
|
-
const getDisplayCell = this._sheetInterceptorService.fetchThroughInterceptors(INTERCEPTOR_POINT.CELL_CONTENT, InterceptorEffectEnum.Value | InterceptorEffectEnum.Style);
|
|
9725
|
-
new ObjectMatrix(cellData).forValue((row, column, rawData) => {
|
|
9726
|
-
const displayCell = getDisplayCell(rawData, {
|
|
9727
|
-
unitId: loadingRender.sourceUnitId,
|
|
9728
|
-
subUnitId: activeSheetId,
|
|
9729
|
-
row,
|
|
9730
|
-
col: column,
|
|
9731
|
-
workbook: loadingRender.workbook,
|
|
9732
|
-
worksheet,
|
|
9733
|
-
rawData
|
|
9734
|
-
});
|
|
9735
|
-
target.setValue(row, column, displayCell);
|
|
9736
|
-
});
|
|
9737
|
-
const skeletonManager = loadingRender.render.with(SheetSkeletonManagerService);
|
|
9738
|
-
skeletonManager.makeDirty({ sheetId: activeSheetId });
|
|
9739
|
-
skeletonManager.reCalculate();
|
|
9740
|
-
if (loadingRender.render.mainComponent instanceof Spreadsheet) loadingRender.render.mainComponent.makeForceDirty(true);
|
|
9741
|
-
loadingRender.render.scene.makeDirty(true);
|
|
9742
|
-
shouldRender = true;
|
|
9743
|
-
}
|
|
9744
|
-
if (shouldRender) loadingRender.render.scene.render();
|
|
9745
|
-
if (!this.previewReady$.value) this.previewReady$.next(true);
|
|
9746
|
-
}
|
|
9747
|
-
async handoff(sourceUnitId, timeoutMs) {
|
|
9748
|
-
var _this$_loadingRender2, _this$_finalCanvasGua;
|
|
9749
|
-
if (((_this$_loadingRender2 = this._loadingRender) === null || _this$_loadingRender2 === void 0 ? void 0 : _this$_loadingRender2.sourceUnitId) !== sourceUnitId) return true;
|
|
9750
|
-
if (!this._loadingRender.render) {
|
|
9751
|
-
this.hide(sourceUnitId);
|
|
9752
|
-
return true;
|
|
9753
|
-
}
|
|
9754
|
-
(_this$_finalCanvasGua = this._finalCanvasGuard) === null || _this$_finalCanvasGua === void 0 || _this$_finalCanvasGua.unsubscribe();
|
|
9755
|
-
this._finalCanvasGuard = null;
|
|
9756
|
-
try {
|
|
9757
|
-
await firstValueFrom(this._getFinalRender$(sourceUnitId).pipe(take(1), switchMap((render) => this._waitForFinalCanvas(render).pipe(switchMap(() => {
|
|
9758
|
-
this._hideFinalCanvas(render);
|
|
9759
|
-
return this._requestFinalRender(render);
|
|
9760
|
-
}))), timeout(timeoutMs)));
|
|
9761
|
-
this.hide(sourceUnitId);
|
|
9762
|
-
return true;
|
|
9763
|
-
} catch {
|
|
9764
|
-
return false;
|
|
9765
|
-
}
|
|
9766
|
-
}
|
|
9767
|
-
hide(sourceUnitId) {
|
|
9768
|
-
var _this$_loadingRender3;
|
|
9769
|
-
if (((_this$_loadingRender3 = this._loadingRender) === null || _this$_loadingRender3 === void 0 ? void 0 : _this$_loadingRender3.sourceUnitId) !== sourceUnitId) return;
|
|
9770
|
-
this._disposeLoadingRender();
|
|
9771
|
-
}
|
|
9772
|
-
dispose() {
|
|
9773
|
-
this._disposeLoadingRender();
|
|
9774
|
-
this.workbook$.complete();
|
|
9775
|
-
this.loading$.complete();
|
|
9776
|
-
this.previewReady$.complete();
|
|
9777
|
-
super.dispose();
|
|
9778
|
-
}
|
|
9779
|
-
_createLoadingWorkbook(workbookData, activeSheetId) {
|
|
9780
|
-
const previewUnitId = `${workbookData.id}${PREVIEW_UNIT_SUFFIX}`;
|
|
9781
|
-
const workbook = this._injector.createInstance(Workbook, {
|
|
9782
|
-
...workbookData,
|
|
9783
|
-
id: previewUnitId
|
|
9784
|
-
});
|
|
9785
|
-
const activeSheet = workbook.getSheetBySheetId(activeSheetId);
|
|
9786
|
-
if (activeSheet) workbook.setActiveSheet(activeSheet);
|
|
9787
|
-
return workbook;
|
|
9788
|
-
}
|
|
9789
|
-
_createLoadingRender(workbook, sourceUnitId, contentElement) {
|
|
9790
|
-
const previewUnitId = workbook.getUnitId();
|
|
9791
|
-
const { width, height } = contentElement.getBoundingClientRect();
|
|
9792
|
-
const engine = this._injector.createInstance(Engine, previewUnitId, void 0);
|
|
9793
|
-
const scene = new Scene(`${PREVIEW_SCENE_PREFIX}${previewUnitId}`, engine, {
|
|
9794
|
-
width,
|
|
9795
|
-
height
|
|
9796
|
-
});
|
|
9797
|
-
scene.disableObjectsEvent();
|
|
9798
|
-
const render = this._injector.createInstance(RenderUnit, {
|
|
9799
|
-
unit: workbook,
|
|
9800
|
-
engine,
|
|
9801
|
-
scene,
|
|
9802
|
-
isMainScene: true
|
|
9803
|
-
});
|
|
9804
|
-
try {
|
|
9805
|
-
render.addRenderDependencies([
|
|
9806
|
-
[SheetSkeletonManagerService],
|
|
9807
|
-
[SheetSkeletonRenderController],
|
|
9808
|
-
[SheetRenderController]
|
|
9809
|
-
]);
|
|
9810
|
-
const canvas = engine.getCanvas();
|
|
9811
|
-
canvas.setId(`univer-sheet-loading-canvas_${sourceUnitId}`);
|
|
9812
|
-
canvas.getCanvasEle().dataset.uUnitId = sourceUnitId;
|
|
9813
|
-
canvas.getCanvasEle().style.pointerEvents = "none";
|
|
9814
|
-
canvas.getCanvasEle().style.zIndex = PREVIEW_CANVAS_Z_INDEX;
|
|
9815
|
-
engine.mount(contentElement);
|
|
9816
|
-
return render;
|
|
9817
|
-
} catch (error) {
|
|
9818
|
-
this._disposeRender(render);
|
|
9819
|
-
throw error;
|
|
9820
|
-
}
|
|
9821
|
-
}
|
|
9822
|
-
_waitForFinalCanvas(render) {
|
|
9823
|
-
return new Observable((subscriber) => {
|
|
9824
|
-
let frameId;
|
|
9825
|
-
const canvasElement = render.engine.getCanvasElement();
|
|
9826
|
-
const checkMounted = () => {
|
|
9827
|
-
const contentElement = this._layoutService.getContentElement();
|
|
9828
|
-
if (contentElement && canvasElement.parentElement === contentElement && canvasElement.width > 0 && canvasElement.height > 0) {
|
|
9829
|
-
subscriber.next();
|
|
9830
|
-
subscriber.complete();
|
|
9831
|
-
return;
|
|
9832
|
-
}
|
|
9833
|
-
frameId = window.requestAnimationFrame(checkMounted);
|
|
9834
|
-
};
|
|
9835
|
-
checkMounted();
|
|
9836
|
-
return () => {
|
|
9837
|
-
if (frameId !== void 0) window.cancelAnimationFrame(frameId);
|
|
9838
|
-
};
|
|
9839
|
-
});
|
|
9840
|
-
}
|
|
9841
|
-
_getFinalRender$(sourceUnitId) {
|
|
9842
|
-
const existingRender = this._renderManagerService.getRenderUnitById(sourceUnitId);
|
|
9843
|
-
return existingRender ? of(existingRender) : this._renderManagerService.created$.pipe(filter((render) => render.unitId === sourceUnitId));
|
|
9844
|
-
}
|
|
9845
|
-
_guardFinalCanvas(sourceUnitId) {
|
|
9846
|
-
var _this$_finalCanvasGua2;
|
|
9847
|
-
(_this$_finalCanvasGua2 = this._finalCanvasGuard) === null || _this$_finalCanvasGua2 === void 0 || _this$_finalCanvasGua2.unsubscribe();
|
|
9848
|
-
this._finalCanvasGuard = this._getFinalRender$(sourceUnitId).pipe(take(1), switchMap((render) => this._waitForFinalCanvas(render).pipe(map(() => render)))).subscribe((render) => this._hideFinalCanvas(render));
|
|
9849
|
-
}
|
|
9850
|
-
_requestFinalRender(render) {
|
|
9851
|
-
render.scene.makeDirty(true);
|
|
9852
|
-
return from(render.scene.requestRender()).pipe(switchMap(() => this._waitForNextAnimationFrame()));
|
|
9853
|
-
}
|
|
9854
|
-
_hideFinalCanvas(render) {
|
|
9855
|
-
const canvasElement = render.engine.getCanvasElement();
|
|
9856
|
-
if (this._hiddenFinalCanvas === canvasElement) return;
|
|
9857
|
-
this._restoreFinalCanvas();
|
|
9858
|
-
this._hiddenFinalCanvas = canvasElement;
|
|
9859
|
-
this._finalCanvasVisibility = canvasElement.style.visibility;
|
|
9860
|
-
canvasElement.style.visibility = "hidden";
|
|
9861
|
-
}
|
|
9862
|
-
_restoreFinalCanvas() {
|
|
9863
|
-
if (!this._hiddenFinalCanvas) return;
|
|
9864
|
-
this._hiddenFinalCanvas.style.visibility = this._finalCanvasVisibility;
|
|
9865
|
-
this._hiddenFinalCanvas = null;
|
|
9866
|
-
this._finalCanvasVisibility = "";
|
|
9867
|
-
}
|
|
9868
|
-
_waitForNextAnimationFrame() {
|
|
9869
|
-
return new Observable((subscriber) => {
|
|
9870
|
-
const frameId = window.requestAnimationFrame(() => {
|
|
9871
|
-
subscriber.next();
|
|
9872
|
-
subscriber.complete();
|
|
9873
|
-
});
|
|
9874
|
-
return () => window.cancelAnimationFrame(frameId);
|
|
9875
|
-
});
|
|
9876
|
-
}
|
|
9877
|
-
_disposeLoadingRender() {
|
|
9878
|
-
var _this$_finalCanvasGua3;
|
|
9879
|
-
(_this$_finalCanvasGua3 = this._finalCanvasGuard) === null || _this$_finalCanvasGua3 === void 0 || _this$_finalCanvasGua3.unsubscribe();
|
|
9880
|
-
this._finalCanvasGuard = null;
|
|
9881
|
-
this._restoreFinalCanvas();
|
|
9882
|
-
const loadingRender = this._loadingRender;
|
|
9883
|
-
this._loadingRender = null;
|
|
9884
|
-
this.workbook$.next(null);
|
|
9885
|
-
this.loading$.next(false);
|
|
9886
|
-
this.previewReady$.next(false);
|
|
9887
|
-
if (!loadingRender) return;
|
|
9888
|
-
if (loadingRender.render) this._disposeRender(loadingRender.render);
|
|
9889
|
-
loadingRender.workbook.dispose();
|
|
9890
|
-
}
|
|
9891
|
-
_disposeRender(render) {
|
|
9892
|
-
render.components.forEach((component) => component.dispose());
|
|
9893
|
-
render.scene.dispose();
|
|
9894
|
-
render.dispose();
|
|
9895
|
-
render.engine.dispose();
|
|
9896
|
-
}
|
|
9897
|
-
};
|
|
9898
|
-
SheetLoadingRenderService = __decorate([
|
|
9899
|
-
__decorateParam(0, Inject(Injector)),
|
|
9900
|
-
__decorateParam(1, ILayoutService),
|
|
9901
|
-
__decorateParam(2, Inject(SheetInterceptorService)),
|
|
9902
|
-
__decorateParam(3, IRenderManagerService)
|
|
9903
|
-
], SheetLoadingRenderService);
|
|
9904
|
-
|
|
9905
|
-
//#endregion
|
|
9906
|
-
//#region src/views/hook.ts
|
|
9907
|
-
const SheetLoadingWorkbookContext = createContext(null);
|
|
9908
|
-
function useActiveWorkbook() {
|
|
9909
|
-
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
9910
|
-
const loadingWorkbook = useContext(SheetLoadingWorkbookContext);
|
|
9911
|
-
const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
|
|
9912
|
-
return loadingWorkbook ?? workbook ?? null;
|
|
9913
|
-
}
|
|
9914
|
-
function useSheetLoadingWorkbook() {
|
|
9915
|
-
return useObservable(useDependency(ISheetLoadingRenderService).workbook$) ?? null;
|
|
9916
|
-
}
|
|
9917
|
-
function useSheetLoading() {
|
|
9918
|
-
return useObservable(useDependency(ISheetLoadingRenderService).loading$) ?? false;
|
|
9919
|
-
}
|
|
9920
|
-
function useSheetLoadingPreviewReady() {
|
|
9921
|
-
return useObservable(useDependency(ISheetLoadingRenderService).previewReady$) ?? false;
|
|
9922
|
-
}
|
|
9923
|
-
function useActiveWorksheet(workbook) {
|
|
9924
|
-
return useObservable(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? of(null), void 0, void 0, [workbook]);
|
|
9925
|
-
}
|
|
9926
|
-
function useWorkbooks() {
|
|
9927
|
-
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
9928
|
-
return useObservable(() => {
|
|
9929
|
-
return merge$1([univerInstanceService.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_SHEET), univerInstanceService.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_SHEET)]).pipe(map(() => univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET)), startWith(univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET)));
|
|
9930
|
-
}, [], void 0, [univerInstanceService]);
|
|
9931
|
-
}
|
|
9932
|
-
|
|
9933
|
-
//#endregion
|
|
9934
|
-
//#region src/views/clipboard/ClipboardPopupMenu.tsx
|
|
9935
|
-
const DEFAULT_PADDING = 2;
|
|
9936
|
-
const SheetPasteOptions = [
|
|
9937
|
-
{
|
|
9938
|
-
value: "DEFAULT_PASTE",
|
|
9939
|
-
label: "sheets-ui.rightClick.paste"
|
|
9940
|
-
},
|
|
9941
|
-
{
|
|
9942
|
-
value: "SPECIAL_PASTE_VALUE",
|
|
9943
|
-
label: "sheets-ui.rightClick.pasteValue"
|
|
9944
|
-
},
|
|
9945
|
-
{
|
|
9946
|
-
value: "SPECIAL_PASTE_FORMAT",
|
|
9947
|
-
label: "sheets-ui.rightClick.pasteFormat"
|
|
9948
|
-
},
|
|
9949
|
-
{
|
|
9950
|
-
value: "SPECIAL_PASTE_COL_WIDTH",
|
|
9951
|
-
label: "sheets-ui.rightClick.pasteColWidth"
|
|
9952
|
-
},
|
|
9953
|
-
{
|
|
9954
|
-
value: "SPECIAL_PASTE_BESIDES_BORDER",
|
|
9955
|
-
label: "sheets-ui.rightClick.pasteBesidesBorder"
|
|
9956
|
-
},
|
|
9957
|
-
{
|
|
9958
|
-
value: "SPECIAL_PASTE_FORMULA",
|
|
9959
|
-
label: "sheets-ui.rightClick.pasteFormula"
|
|
9960
|
-
}
|
|
9961
|
-
];
|
|
9962
|
-
const useMenuPosition = (range) => {
|
|
9963
|
-
var _scene$getEngine;
|
|
9964
|
-
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
9965
|
-
const renderManagerService = useDependency(IRenderManagerService);
|
|
9966
|
-
const workbook = useActiveWorkbook();
|
|
9967
|
-
if (!range || !workbook) return null;
|
|
9968
|
-
const anchor = {
|
|
9969
|
-
startRow: range.rows[0],
|
|
9970
|
-
startCol: range.cols[0],
|
|
9971
|
-
endRow: range.rows[range.rows.length - 1],
|
|
9972
|
-
endCol: range.cols[range.cols.length - 1]
|
|
9973
|
-
};
|
|
9974
|
-
if (anchor.endRow < 0 || anchor.endCol < 0) return null;
|
|
9975
|
-
const ru = renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
9976
|
-
const sheetSkeletonManagerService = ru === null || ru === void 0 ? void 0 : ru.with(SheetSkeletonManagerService);
|
|
9977
|
-
const sheetObject = getSheetObject(univerInstanceService, renderManagerService);
|
|
9978
|
-
if (!sheetObject) return null;
|
|
9979
|
-
const { scene } = sheetObject;
|
|
9980
|
-
const skeleton = sheetSkeletonManagerService === null || sheetSkeletonManagerService === void 0 ? void 0 : sheetSkeletonManagerService.getCurrentSkeleton();
|
|
9981
|
-
const viewport = getViewportByCell(anchor.endRow, anchor.endCol, scene, workbook.getActiveSheet());
|
|
9982
|
-
if (!viewport) return null;
|
|
9983
|
-
const scaleX = scene === null || scene === void 0 ? void 0 : scene.scaleX;
|
|
9984
|
-
const scaleY = scene === null || scene === void 0 ? void 0 : scene.scaleY;
|
|
9985
|
-
const scrollXY = scene === null || scene === void 0 ? void 0 : scene.getViewportScrollXY(viewport);
|
|
9986
|
-
const canvas = (_scene$getEngine = scene.getEngine()) === null || _scene$getEngine === void 0 ? void 0 : _scene$getEngine.getCanvas();
|
|
9987
|
-
if (!scaleX || !scene || !scaleX || !scaleY || !scrollXY) return null;
|
|
9988
|
-
const endPosition = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getNoMergeCellWithCoordByIndex(anchor.endRow, anchor.endCol);
|
|
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;
|
|
9993
|
-
const canvasWidth = canvas === null || canvas === void 0 ? void 0 : canvas.getWidth();
|
|
9994
|
-
const canvasHeight = canvas === null || canvas === void 0 ? void 0 : canvas.getHeight();
|
|
9995
|
-
if (!canvasWidth || !canvasHeight) return null;
|
|
9996
|
-
const XInSideView = positionEndX + 50 <= canvasWidth;
|
|
9997
|
-
const YInSideView = positionEndY + 50 <= canvasHeight;
|
|
9998
|
-
let positionX = positionEndX;
|
|
9999
|
-
let positionY = positionEndY;
|
|
10000
|
-
if (!XInSideView) positionX = canvasWidth - 100;
|
|
10001
|
-
if (!YInSideView) positionY = canvasHeight - 100;
|
|
10002
|
-
return {
|
|
10003
|
-
positionX,
|
|
10004
|
-
positionY
|
|
10005
|
-
};
|
|
10006
|
-
};
|
|
10007
|
-
const ClipboardPopupMenu = () => {
|
|
10008
|
-
const clipboardService = useDependency(ISheetClipboardService);
|
|
10009
|
-
const showMenu = useObservable(clipboardService.showMenu$, false);
|
|
10010
|
-
const pasteOptionsCache = useObservable(clipboardService.pasteOptionsCache$, null);
|
|
10011
|
-
const localeService = useDependency(LocaleService);
|
|
10012
|
-
const commandService = useDependency(ICommandService);
|
|
10013
|
-
const [menuHovered, setMenuHovered] = useState(false);
|
|
10014
|
-
const [visible, setVisible] = useState(false);
|
|
10015
|
-
const range = pasteOptionsCache === null || pasteOptionsCache === void 0 ? void 0 : pasteOptionsCache.target.pastedRange;
|
|
10016
|
-
const relativePosition = useMenuPosition(range);
|
|
10017
|
-
if (!relativePosition || !showMenu) return null;
|
|
10018
|
-
if (relativePosition.positionX < 50 || relativePosition.positionY < 30) return null;
|
|
10019
|
-
const showMore = menuHovered || visible;
|
|
10020
|
-
const handleClick = (type) => {
|
|
10021
|
-
setVisible(false);
|
|
10022
|
-
commandService.executeCommand(SheetOptionalPasteCommand.id, { type });
|
|
10023
|
-
};
|
|
10024
|
-
return /* @__PURE__ */ jsx("div", {
|
|
10025
|
-
className: "univer-absolute univer-inset-0 univer-z-10 univer-size-0",
|
|
10026
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
10027
|
-
className: "univer-absolute",
|
|
10028
|
-
style: {
|
|
10029
|
-
left: relativePosition.positionX + DEFAULT_PADDING,
|
|
10030
|
-
top: relativePosition.positionY + DEFAULT_PADDING
|
|
10031
|
-
},
|
|
10032
|
-
onMouseEnter: () => setMenuHovered(true),
|
|
10033
|
-
onMouseLeave: () => setMenuHovered(false),
|
|
10034
|
-
children: /* @__PURE__ */ jsx(DropdownMenu, {
|
|
10035
|
-
align: "start",
|
|
10036
|
-
items: SheetPasteOptions.map((item) => ({
|
|
10037
|
-
type: "checkbox",
|
|
10038
|
-
value: item.value,
|
|
10039
|
-
label: localeService.t(item.label),
|
|
10040
|
-
checked: (pasteOptionsCache === null || pasteOptionsCache === void 0 ? void 0 : pasteOptionsCache.pasteType) === PREDEFINED_HOOK_NAME_PASTE[item.value],
|
|
10041
|
-
onSelect: () => handleClick(item.value)
|
|
10042
|
-
})),
|
|
10043
|
-
open: visible,
|
|
10044
|
-
onOpenChange: setVisible,
|
|
10045
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
10046
|
-
className: clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", borderClassName, {
|
|
10047
|
-
"univer-bg-gray-100 dark:!univer-bg-gray-800": visible,
|
|
10048
|
-
"univer-bg-white dark:!univer-bg-gray-900": !visible
|
|
10049
|
-
}),
|
|
10050
|
-
children: [/* @__PURE__ */ jsx(PasteSpecialDoubleIcon, { className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white" }), showMore && /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-white" })]
|
|
10051
|
-
})
|
|
10052
|
-
})
|
|
10053
|
-
})
|
|
10054
|
-
});
|
|
10055
|
-
};
|
|
10056
|
-
|
|
10057
|
-
//#endregion
|
|
10058
|
-
//#region src/controllers/clipboard/const.ts
|
|
10059
|
-
/**
|
|
10060
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
10061
|
-
*
|
|
10062
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10063
|
-
* you may not use this file except in compliance with the License.
|
|
10064
|
-
* You may obtain a copy of the License at
|
|
10065
|
-
*
|
|
10066
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10067
|
-
*
|
|
10068
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10069
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10070
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10071
|
-
* See the License for the specific language governing permissions and
|
|
10072
|
-
* limitations under the License.
|
|
10073
|
-
*/
|
|
10074
|
-
const RemovePasteMenuCommands = [
|
|
10075
|
-
SetCellEditVisibleOperation.id,
|
|
10076
|
-
SetRangeValuesCommand.id,
|
|
10077
|
-
SetZoomRatioOperation.id,
|
|
10078
|
-
MoveRangeMutation.id,
|
|
10079
|
-
RemoveRowMutation.id,
|
|
10080
|
-
RemoveColMutation.id,
|
|
10081
|
-
InsertRowMutation.id,
|
|
10082
|
-
InsertColMutation.id,
|
|
10083
|
-
MoveRowsMutation.id,
|
|
10084
|
-
MoveColsMutation.id,
|
|
10085
|
-
SetWorksheetColWidthMutation.id,
|
|
10086
|
-
SetWorksheetRowHeightMutation.id,
|
|
10087
|
-
SetSelectionsOperation.id,
|
|
10088
|
-
UndoCommandId
|
|
10089
|
-
];
|
|
10090
|
-
|
|
10091
|
-
//#endregion
|
|
10092
|
-
//#region src/services/editor/cell-editor-manager.service.ts
|
|
10093
|
-
var CellEditorManagerService = class {
|
|
10094
|
-
constructor() {
|
|
10095
|
-
_defineProperty(this, "_state", null);
|
|
10096
|
-
_defineProperty(this, "_rect", null);
|
|
10097
|
-
_defineProperty(this, "_state$", new BehaviorSubject(null));
|
|
10098
|
-
_defineProperty(this, "state$", this._state$.asObservable());
|
|
10099
|
-
_defineProperty(this, "_rect$", new BehaviorSubject(null));
|
|
10100
|
-
_defineProperty(this, "rect$", this._rect$.asObservable());
|
|
10101
|
-
_defineProperty(this, "_focus", false);
|
|
10102
|
-
_defineProperty(this, "_focus$", new BehaviorSubject(this._focus));
|
|
10103
|
-
_defineProperty(this, "focus$", this._focus$.asObservable());
|
|
10104
|
-
}
|
|
10105
|
-
dispose() {
|
|
10106
|
-
this._state$.complete();
|
|
10107
|
-
this._state = null;
|
|
10108
|
-
this._rect$.complete();
|
|
10109
|
-
this._rect = null;
|
|
10110
|
-
}
|
|
10111
|
-
setState(param) {
|
|
10112
|
-
this._state = param;
|
|
10113
|
-
this._refresh(param);
|
|
10114
|
-
}
|
|
10115
|
-
getRect() {
|
|
10116
|
-
return this._rect;
|
|
10117
|
-
}
|
|
10118
|
-
setRect(param) {
|
|
10119
|
-
this._rect = param;
|
|
10120
|
-
this._rect$.next(param);
|
|
10121
|
-
}
|
|
10122
|
-
getState() {
|
|
10123
|
-
return this._state;
|
|
10124
|
-
}
|
|
10125
|
-
setFocus(param = false) {
|
|
10126
|
-
this._focus = param;
|
|
10127
|
-
this._focus$.next(param);
|
|
10128
|
-
}
|
|
10129
|
-
_refresh(param) {
|
|
10130
|
-
this._state$.next(param);
|
|
10131
|
-
}
|
|
10132
|
-
};
|
|
10133
|
-
const ICellEditorManagerService = createIdentifier("univer.sheet-cell-editor-manager.service");
|
|
10134
|
-
|
|
10135
|
-
//#endregion
|
|
10136
|
-
//#region src/services/sheet-embed-integration.service.ts
|
|
10137
|
-
const SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE = "data-embed-interaction-boundary-owner";
|
|
10138
|
-
const SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE = "data-embed-runtime-focus-role";
|
|
10139
|
-
const SHEET_EMBED_FLOAT_DOM_ATTRIBUTE = "data-embed-float-dom";
|
|
10140
|
-
const SHEET_EMBED_ID_ATTRIBUTE = "data-embed-id";
|
|
10141
|
-
const SHEET_EMBED_HOST_UNIT_ID_ATTRIBUTE = "data-embed-host-unit-id";
|
|
10142
|
-
const SHEET_EMBED_CHILD_UNIT_ID_ATTRIBUTE = "data-embed-child-unit-id";
|
|
10143
|
-
const SHEET_EMBED_CHILD_TYPE_ATTRIBUTE = "data-embed-child-type";
|
|
10144
|
-
const ISheetEmbedInteractionBoundaryService = createIdentifier("sheets-ui.embed-interaction-boundary.service");
|
|
10145
|
-
const ISheetEmbedRuntimeFocusCoordinator = createIdentifier("sheets-ui.embed-runtime-focus-coordinator");
|
|
10146
|
-
const ISheetEmbedFloatingGeometryService = createIdentifier("sheets-ui.embed-floating-geometry.service");
|
|
10147
|
-
function resolveSheetEmbedRuntimeDomScope(element) {
|
|
10148
|
-
var _element$closest;
|
|
10149
|
-
if (!element) return;
|
|
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;
|
|
10151
|
-
const container = resolveSheetEmbedFloatDomContainer(element, embedId);
|
|
10152
|
-
const resolvedEmbedId = (container === null || container === void 0 ? void 0 : container.getAttribute("data-embed-id")) ?? embedId;
|
|
10153
|
-
if (!resolvedEmbedId) return;
|
|
10154
|
-
return {
|
|
10155
|
-
embedId: resolvedEmbedId,
|
|
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,
|
|
10158
|
-
childType: readChildType(container)
|
|
10159
|
-
};
|
|
10160
|
-
}
|
|
10161
|
-
function resolveActiveSheetEmbedRuntimeDomScope(ownerDocument = document) {
|
|
10162
|
-
const activeContainer = ownerDocument.querySelector(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"][data-embed-float-stage="stage2"]`);
|
|
10163
|
-
if (!activeContainer) return;
|
|
10164
|
-
return resolveSheetEmbedRuntimeDomScope(activeContainer);
|
|
10165
|
-
}
|
|
10166
|
-
function resolveSheetEmbedFloatDomContainer(element, embedId) {
|
|
10167
|
-
const ownContainer = element === null || element === void 0 ? void 0 : element.closest(`[${SHEET_EMBED_FLOAT_DOM_ATTRIBUTE}="true"]`);
|
|
10168
|
-
if (ownContainer && (!embedId || ownContainer.getAttribute("data-embed-id") === embedId)) return ownContainer;
|
|
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;
|
|
10172
|
-
}
|
|
10173
|
-
function escapeAttributeValue(value) {
|
|
10174
|
-
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
10175
|
-
}
|
|
10176
|
-
function readChildType(container) {
|
|
10177
|
-
const value = container === null || container === void 0 ? void 0 : container.getAttribute(SHEET_EMBED_CHILD_TYPE_ATTRIBUTE);
|
|
10178
|
-
if (value == null || value === "") return;
|
|
10179
|
-
return Number(value);
|
|
10180
|
-
}
|
|
10181
|
-
|
|
10182
|
-
//#endregion
|
|
10183
|
-
//#region src/services/editor/cell-editor-resize.service.ts
|
|
10184
|
-
const EDITOR_INPUT_SELF_EXTEND_GAP = 5;
|
|
10185
|
-
const EDITOR_BORDER_SIZE = 2;
|
|
10186
|
-
let SheetCellEditorResizeService = class SheetCellEditorResizeService extends Disposable {
|
|
10187
|
-
constructor(_layoutService, _cellEditorManagerService, _editorBridgeService, _renderManagerService, _univerInstanceService, _configService, _embedFloatingGeometryService) {
|
|
10188
|
-
super();
|
|
10189
|
-
this._layoutService = _layoutService;
|
|
10190
|
-
this._cellEditorManagerService = _cellEditorManagerService;
|
|
10191
|
-
this._editorBridgeService = _editorBridgeService;
|
|
10192
|
-
this._renderManagerService = _renderManagerService;
|
|
10193
|
-
this._univerInstanceService = _univerInstanceService;
|
|
10194
|
-
this._configService = _configService;
|
|
10195
|
-
this._embedFloatingGeometryService = _embedFloatingGeometryService;
|
|
10196
|
-
}
|
|
10197
|
-
get _currentRenderer() {
|
|
10198
|
-
return getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SHEET, this._univerInstanceService, this._renderManagerService);
|
|
10199
|
-
}
|
|
10200
|
-
get _editingUnitId() {
|
|
10201
|
-
var _this$_editorBridgeSe;
|
|
10202
|
-
return ((_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.unitId) ?? "";
|
|
10203
|
-
}
|
|
10204
|
-
get _editingRenderer() {
|
|
10205
|
-
return this._renderManagerService.getRenderUnitById(this._editingUnitId);
|
|
10206
|
-
}
|
|
10207
|
-
get _renderer() {
|
|
10208
|
-
return this._editingRenderer ?? this._currentRenderer;
|
|
10209
|
-
}
|
|
10210
|
-
get _sheetSkeletonManagerService() {
|
|
10211
|
-
var _this$_renderer;
|
|
10212
|
-
return (_this$_renderer = this._renderer) === null || _this$_renderer === void 0 ? void 0 : _this$_renderer.with(SheetSkeletonManagerService);
|
|
10213
|
-
}
|
|
10214
|
-
get engine() {
|
|
10215
|
-
var _this$_renderer2;
|
|
10216
|
-
return (_this$_renderer2 = this._renderer) === null || _this$_renderer2 === void 0 ? void 0 : _this$_renderer2.engine;
|
|
10217
|
-
}
|
|
10218
|
-
fitTextSize(callback) {
|
|
10219
|
-
const param = this._editorBridgeService.getEditCellState();
|
|
10220
|
-
if (!param) return;
|
|
10221
|
-
const { position, documentLayoutObject, canvasOffset, scaleX, scaleY } = param;
|
|
10222
|
-
const { startX, startY, endX, endY } = position;
|
|
10223
|
-
const documentDataModel = this._univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
|
|
10224
|
-
if (documentDataModel == null) return;
|
|
10225
|
-
const documentSkeleton = this._getEditorSkeleton();
|
|
10226
|
-
if (!documentSkeleton) return;
|
|
10227
|
-
documentSkeleton.resetInitialWidth();
|
|
10228
|
-
const info = this._predictingSize(position, canvasOffset, documentSkeleton, documentLayoutObject, scaleX, scaleY);
|
|
10229
|
-
if (!info || info.actualWidth <= 0) return;
|
|
10230
|
-
let { actualWidth, actualHeight } = info;
|
|
10231
|
-
const { verticalAlign, horizontalAlign, paddingData, fill } = documentLayoutObject;
|
|
10232
|
-
actualWidth = actualWidth + (paddingData.l ?? 0) * scaleX + (paddingData.r ?? 0) * scaleX;
|
|
10233
|
-
actualHeight = actualHeight + (paddingData.t ?? 0) * scaleY + (paddingData.b ?? 0) * scaleY;
|
|
10234
|
-
let editorWidth = endX - startX;
|
|
10235
|
-
let editorHeight = endY - startY;
|
|
10236
|
-
if (editorWidth < actualWidth) editorWidth = Math.ceil(actualWidth);
|
|
10237
|
-
if (editorHeight < actualHeight) editorHeight = Math.ceil(actualHeight);
|
|
10238
|
-
let offsetTop = 0;
|
|
10239
|
-
if (verticalAlign === VerticalAlign.MIDDLE) offsetTop = (editorHeight - actualHeight) / 2 / scaleY;
|
|
10240
|
-
else if (verticalAlign === VerticalAlign.TOP) offsetTop = paddingData.t || 0;
|
|
10241
|
-
else offsetTop = (editorHeight - actualHeight) / scaleY;
|
|
10242
|
-
let offsetLeft = 0;
|
|
10243
|
-
if (horizontalAlign === HorizontalAlign.CENTER) {} else if (horizontalAlign === HorizontalAlign.RIGHT) offsetLeft = (editorWidth - actualWidth) / scaleX;
|
|
10244
|
-
else offsetLeft = paddingData.l || 0;
|
|
10245
|
-
offsetTop = Math.max(offsetTop, paddingData.t || 0);
|
|
10246
|
-
offsetLeft = Math.max(offsetLeft, paddingData.l || 0);
|
|
10247
|
-
documentDataModel.updateDocumentDataMargin({
|
|
10248
|
-
t: offsetTop,
|
|
10249
|
-
l: offsetLeft
|
|
10250
|
-
});
|
|
10251
|
-
documentSkeleton.calculate();
|
|
10252
|
-
this._editAreaProcessing(editorWidth, editorHeight, position, canvasOffset, fill, scaleX, scaleY, horizontalAlign, callback);
|
|
10253
|
-
}
|
|
10254
|
-
/**
|
|
10255
|
-
* Mainly used to pre-calculate the width of the editor,
|
|
10256
|
-
* to determine whether it needs to be automatically widened.
|
|
10257
|
-
*/
|
|
10258
|
-
_predictingSize(actualRangeWithCoord, canvasOffset, documentSkeleton, documentLayoutObject, scaleX = 1, scaleY = 1) {
|
|
10259
|
-
const { startX, endX } = actualRangeWithCoord;
|
|
10260
|
-
const { textRotation, wrapStrategy, paddingData } = documentLayoutObject;
|
|
10261
|
-
const documentDataModel = this._univerInstanceService.getUnit(DOCS_NORMAL_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);
|
|
10262
|
-
const { vertexAngle: angle } = convertTextRotation(textRotation);
|
|
10263
|
-
if (wrapStrategy === WrapStrategy.WRAP && angle === 0) {
|
|
10264
|
-
documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataPageSize((endX - startX) / scaleX);
|
|
10265
|
-
documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataMargin({
|
|
10266
|
-
l: paddingData.l,
|
|
10267
|
-
t: paddingData.t
|
|
10268
|
-
});
|
|
10269
|
-
documentSkeleton.calculate();
|
|
10270
|
-
const { actualWidth, actualHeight } = documentSkeleton.getActualSize();
|
|
10271
|
-
return {
|
|
10272
|
-
actualWidth: actualWidth * scaleX,
|
|
10273
|
-
actualHeight: actualHeight * scaleY
|
|
10274
|
-
};
|
|
10275
|
-
}
|
|
10276
|
-
const maxSize = this._getEditorMaxSize(actualRangeWithCoord, canvasOffset, documentLayoutObject.horizontalAlign);
|
|
10277
|
-
if (!maxSize) return;
|
|
10278
|
-
documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataPageSize(maxSize.width / scaleX);
|
|
10279
|
-
documentSkeleton.calculate();
|
|
10280
|
-
const size = documentSkeleton.getActualSize();
|
|
10281
|
-
let editorWidth = endX - startX;
|
|
10282
|
-
if (editorWidth < size.actualWidth * scaleX + EDITOR_INPUT_SELF_EXTEND_GAP * scaleX) editorWidth = size.actualWidth * scaleX + EDITOR_INPUT_SELF_EXTEND_GAP * scaleX;
|
|
10283
|
-
documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentDataPageSize(editorWidth / scaleX);
|
|
10284
|
-
/**
|
|
10285
|
-
* Do not rely on cell layout logic, depend on the document's internal alignment logic.
|
|
10286
|
-
*/
|
|
10287
|
-
documentDataModel === null || documentDataModel === void 0 || documentDataModel.updateDocumentRenderConfig({
|
|
10288
|
-
horizontalAlign: HorizontalAlign.UNSPECIFIED,
|
|
10289
|
-
cellValueType: void 0
|
|
10290
|
-
});
|
|
10291
|
-
return {
|
|
10292
|
-
actualWidth: size.actualWidth * scaleX,
|
|
10293
|
-
actualHeight: size.actualHeight * scaleY
|
|
9710
|
+
return {
|
|
9711
|
+
actualWidth: size.actualWidth * scaleX,
|
|
9712
|
+
actualHeight: size.actualHeight * scaleY
|
|
10294
9713
|
};
|
|
10295
9714
|
}
|
|
10296
9715
|
_getEditorMaxSize(position, canvasOffset, horizontalAlign) {
|
|
@@ -10568,7 +9987,9 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10568
9987
|
if (!sheetObject) return;
|
|
10569
9988
|
const { spreadsheet, spreadsheetColumnHeader, spreadsheetLeftTopPlaceholder, spreadsheetRowHeader } = sheetObject;
|
|
10570
9989
|
d.add(spreadsheet.onDblclick$.subscribeEvent((evt) => {
|
|
9990
|
+
var _this$_editorBridgeSe;
|
|
10571
9991
|
if (evt.button === 2) return;
|
|
9992
|
+
if (isCellImage((_this$_editorBridgeSe = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe === void 0 || (_this$_editorBridgeSe = _this$_editorBridgeSe.documentLayoutObject.documentModel) === null || _this$_editorBridgeSe === void 0 ? void 0 : _this$_editorBridgeSe.getSnapshot())) return;
|
|
10572
9993
|
this._commandService.executeCommand(SetCellEditVisibleOperation.id, {
|
|
10573
9994
|
visible: true,
|
|
10574
9995
|
eventType: DeviceInputEventType.Dblclick,
|
|
@@ -10664,9 +10085,9 @@ let EditorBridgeRenderController = class EditorBridgeRenderController extends Rx
|
|
|
10664
10085
|
this._hideEditor();
|
|
10665
10086
|
}
|
|
10666
10087
|
_isEmbeddedFormulaEditorActive() {
|
|
10667
|
-
var _this$_embedRuntimeFo2, _this$
|
|
10088
|
+
var _this$_embedRuntimeFo2, _this$_editorBridgeSe2;
|
|
10668
10089
|
if (((_this$_embedRuntimeFo2 = this._embedRuntimeFocusCoordinator) === null || _this$_embedRuntimeFo2 === void 0 ? void 0 : _this$_embedRuntimeFo2.isChildUnitInActiveSession(this._context.unitId)) !== true) return false;
|
|
10669
|
-
const dataStream = (_this$
|
|
10090
|
+
const dataStream = (_this$_editorBridgeSe2 = this._editorBridgeService.getEditCellState()) === null || _this$_editorBridgeSe2 === void 0 || (_this$_editorBridgeSe2 = _this$_editorBridgeSe2.documentLayoutObject.documentModel) === null || _this$_editorBridgeSe2 === void 0 || (_this$_editorBridgeSe2 = _this$_editorBridgeSe2.getSnapshot().body) === null || _this$_editorBridgeSe2 === void 0 ? void 0 : _this$_editorBridgeSe2.dataStream;
|
|
10670
10091
|
return typeof dataStream === "string" && dataStream.startsWith("=");
|
|
10671
10092
|
}
|
|
10672
10093
|
_isCurrentEmbedRuntimeEvent(evt) {
|
|
@@ -14002,7 +13423,7 @@ let SheetPermissionCheckUIController = class SheetPermissionCheckUIController ex
|
|
|
14002
13423
|
workbookTypes: [WorkbookEditablePermission],
|
|
14003
13424
|
worksheetTypes: [WorksheetSetCellValuePermission, WorksheetEditPermission],
|
|
14004
13425
|
rangeTypes: [RangeProtectionPermissionEditPoint]
|
|
14005
|
-
});
|
|
13426
|
+
}, params.unitId);
|
|
14006
13427
|
errorMsg = this._localeService.t("sheets-ui.permission.dialog.editErr");
|
|
14007
13428
|
break;
|
|
14008
13429
|
case ApplyFormatPainterCommand.id:
|
|
@@ -15753,9 +15174,9 @@ var HeaderUnhideRangeService = class {
|
|
|
15753
15174
|
|
|
15754
15175
|
//#endregion
|
|
15755
15176
|
//#region src/menu/header-menu-shape.ts
|
|
15756
|
-
const HEADER_MENU_SHAPE_CIRCLE_FILL = "
|
|
15757
|
-
const HEADER_MENU_SHAPE_TRIANGLE_FILL = "
|
|
15758
|
-
const HEADER_MENU_BACKGROUND_COLOR = "
|
|
15177
|
+
const HEADER_MENU_SHAPE_CIRCLE_FILL = "gray.200";
|
|
15178
|
+
const HEADER_MENU_SHAPE_TRIANGLE_FILL = "gray.900";
|
|
15179
|
+
const HEADER_MENU_BACKGROUND_COLOR = "gray.50";
|
|
15759
15180
|
var HeaderMenuShape = class extends Shape {
|
|
15760
15181
|
constructor(key, props) {
|
|
15761
15182
|
super(key, props);
|
|
@@ -15928,157 +15349,549 @@ var HeaderUnhideShape = class extends Shape {
|
|
|
15928
15349
|
]],
|
|
15929
15350
|
fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
|
|
15930
15351
|
});
|
|
15931
|
-
if (this._hasNext) {
|
|
15932
|
-
const offset = this._hasPrevious ? 3 : 1;
|
|
15933
|
-
RegularPolygon.drawWith(ctx, {
|
|
15934
|
-
pointsGroup: [[
|
|
15935
|
-
{
|
|
15936
|
-
x: top + this._size * offset / 2,
|
|
15937
|
-
y: this._size / 2
|
|
15938
|
-
},
|
|
15939
|
-
{
|
|
15940
|
-
x: -left + this._size * offset / 2,
|
|
15941
|
-
y: this._size / 2 - left
|
|
15942
|
-
},
|
|
15943
|
-
{
|
|
15944
|
-
x: -left + this._size * offset / 2,
|
|
15945
|
-
y: this._size / 2 + left
|
|
15946
|
-
}
|
|
15947
|
-
]],
|
|
15948
|
-
fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
|
|
15949
|
-
});
|
|
15950
|
-
}
|
|
15352
|
+
if (this._hasNext) {
|
|
15353
|
+
const offset = this._hasPrevious ? 3 : 1;
|
|
15354
|
+
RegularPolygon.drawWith(ctx, {
|
|
15355
|
+
pointsGroup: [[
|
|
15356
|
+
{
|
|
15357
|
+
x: top + this._size * offset / 2,
|
|
15358
|
+
y: this._size / 2
|
|
15359
|
+
},
|
|
15360
|
+
{
|
|
15361
|
+
x: -left + this._size * offset / 2,
|
|
15362
|
+
y: this._size / 2 - left
|
|
15363
|
+
},
|
|
15364
|
+
{
|
|
15365
|
+
x: -left + this._size * offset / 2,
|
|
15366
|
+
y: this._size / 2 + left
|
|
15367
|
+
}
|
|
15368
|
+
]],
|
|
15369
|
+
fill: HEADER_MENU_SHAPE_TRIANGLE_FILL
|
|
15370
|
+
});
|
|
15371
|
+
}
|
|
15372
|
+
}
|
|
15373
|
+
};
|
|
15374
|
+
|
|
15375
|
+
//#endregion
|
|
15376
|
+
//#region src/controllers/render-controllers/header-unhide.render-controller.ts
|
|
15377
|
+
const HEADER_UNHIDE_CONTROLLER_SHAPE = "__SpreadsheetHeaderUnhideSHAPEControllerShape__";
|
|
15378
|
+
const HEADER_UNHIDE_RANGE_VISIBLE_CHECK = createInterceptorKey("headerUnhideRangeVisibleCheck");
|
|
15379
|
+
let HeaderUnhideRenderController = class HeaderUnhideRenderController extends RxDisposable {
|
|
15380
|
+
get _workbook() {
|
|
15381
|
+
return this._context.unit;
|
|
15382
|
+
}
|
|
15383
|
+
constructor(_context, _sheetSkeletonManagerService, _headerUnhideRangeService, _commandService) {
|
|
15384
|
+
super();
|
|
15385
|
+
this._context = _context;
|
|
15386
|
+
this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
|
|
15387
|
+
this._headerUnhideRangeService = _headerUnhideRangeService;
|
|
15388
|
+
this._commandService = _commandService;
|
|
15389
|
+
_defineProperty(this, "_shapes", {
|
|
15390
|
+
cols: [],
|
|
15391
|
+
rows: []
|
|
15392
|
+
});
|
|
15393
|
+
_defineProperty(this, "interceptor", new InterceptorManager({ HEADER_UNHIDE_RANGE_VISIBLE_CHECK }));
|
|
15394
|
+
this._init();
|
|
15395
|
+
}
|
|
15396
|
+
dispose() {
|
|
15397
|
+
super.dispose();
|
|
15398
|
+
this._clearShapes();
|
|
15399
|
+
}
|
|
15400
|
+
_init() {
|
|
15401
|
+
let activeSheetId = "";
|
|
15402
|
+
this._context.unit.activeSheet$.pipe(takeUntil(this.dispose$)).subscribe((worksheet) => {
|
|
15403
|
+
this._clearShapes();
|
|
15404
|
+
if (!worksheet) {
|
|
15405
|
+
activeSheetId = "";
|
|
15406
|
+
return;
|
|
15407
|
+
}
|
|
15408
|
+
activeSheetId = worksheet.getSheetId();
|
|
15409
|
+
this._update(this._workbook, worksheet);
|
|
15410
|
+
});
|
|
15411
|
+
this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((param) => {
|
|
15412
|
+
if (param) {
|
|
15413
|
+
const { unitId, sheetId } = param;
|
|
15414
|
+
if (unitId === this._workbook.getUnitId() && sheetId === activeSheetId) {
|
|
15415
|
+
const worksheet = this._workbook.getSheetBySheetId(sheetId);
|
|
15416
|
+
if (worksheet) this._update(this._workbook, worksheet);
|
|
15417
|
+
}
|
|
15418
|
+
}
|
|
15419
|
+
}));
|
|
15420
|
+
}
|
|
15421
|
+
_update(workbook, worksheet) {
|
|
15422
|
+
var _this$_sheetSkeletonM;
|
|
15423
|
+
const skeleton = (_this$_sheetSkeletonM = this._sheetSkeletonManagerService.getSkeletonParam(worksheet.getSheetId())) === null || _this$_sheetSkeletonM === void 0 ? void 0 : _this$_sheetSkeletonM.skeleton;
|
|
15424
|
+
if (!skeleton) return;
|
|
15425
|
+
const visibleCheck = this.interceptor.fetchThroughInterceptors(HEADER_UNHIDE_RANGE_VISIBLE_CHECK);
|
|
15426
|
+
const shouldRenderRange = (payload) => this._headerUnhideRangeService.shouldRenderRange(visibleCheck(true, payload) ?? true, payload);
|
|
15427
|
+
const hiddenRowRanges = worksheet.getHiddenRows().filter((range) => shouldRenderRange({
|
|
15428
|
+
axis: "row",
|
|
15429
|
+
range,
|
|
15430
|
+
workbook,
|
|
15431
|
+
worksheet
|
|
15432
|
+
}));
|
|
15433
|
+
const hiddenColRanges = worksheet.getHiddenCols().filter((range) => shouldRenderRange({
|
|
15434
|
+
axis: "column",
|
|
15435
|
+
range,
|
|
15436
|
+
workbook,
|
|
15437
|
+
worksheet
|
|
15438
|
+
}));
|
|
15439
|
+
const { scene } = this._getSheetObject();
|
|
15440
|
+
const rowCount = worksheet.getRowCount();
|
|
15441
|
+
const rowShapes = hiddenRowRanges.map((range) => {
|
|
15442
|
+
const { startRow, endRow } = range;
|
|
15443
|
+
const position = getCoordByCell(startRow, 0, scene, skeleton);
|
|
15444
|
+
const hasPrevious = startRow !== 0;
|
|
15445
|
+
const hasNext = endRow !== rowCount - 1;
|
|
15446
|
+
return new HeaderUnhideShape(HEADER_UNHIDE_CONTROLLER_SHAPE, {
|
|
15447
|
+
type: 0,
|
|
15448
|
+
hovered: false,
|
|
15449
|
+
hasPrevious,
|
|
15450
|
+
hasNext,
|
|
15451
|
+
top: position.startY - (hasPrevious ? 12 : 0),
|
|
15452
|
+
left: position.startX - 12
|
|
15453
|
+
}, () => this._commandService.executeCommand(SetSpecificRowsVisibleCommand.id, {
|
|
15454
|
+
unitId: workbook.getUnitId(),
|
|
15455
|
+
subUnitId: worksheet.getSheetId(),
|
|
15456
|
+
ranges: [range]
|
|
15457
|
+
}));
|
|
15458
|
+
});
|
|
15459
|
+
const colCount = worksheet.getColumnCount();
|
|
15460
|
+
const colShapes = hiddenColRanges.map((range) => {
|
|
15461
|
+
const { startColumn, endColumn } = range;
|
|
15462
|
+
const position = getCoordByCell(0, startColumn, scene, skeleton);
|
|
15463
|
+
const hasPrevious = startColumn !== 0;
|
|
15464
|
+
const hasNext = endColumn !== colCount - 1;
|
|
15465
|
+
return new HeaderUnhideShape(HEADER_UNHIDE_CONTROLLER_SHAPE, {
|
|
15466
|
+
type: 1,
|
|
15467
|
+
hovered: false,
|
|
15468
|
+
hasPrevious,
|
|
15469
|
+
hasNext,
|
|
15470
|
+
top: Math.max(skeleton.columnHeaderHeight, skeleton.columnHeaderHeightAndMarginTop) - 12,
|
|
15471
|
+
left: position.startX - (hasPrevious ? 12 : 0)
|
|
15472
|
+
}, () => this._commandService.executeCommand(SetSpecificColsVisibleCommand.id, {
|
|
15473
|
+
unitId: workbook.getUnitId(),
|
|
15474
|
+
subUnitId: worksheet.getSheetId(),
|
|
15475
|
+
ranges: [range]
|
|
15476
|
+
}));
|
|
15477
|
+
});
|
|
15478
|
+
scene.addObjects(colShapes, 12);
|
|
15479
|
+
scene.addObjects(rowShapes, 12);
|
|
15480
|
+
this._clearShapes();
|
|
15481
|
+
this._shapes = {
|
|
15482
|
+
cols: colShapes,
|
|
15483
|
+
rows: rowShapes
|
|
15484
|
+
};
|
|
15485
|
+
}
|
|
15486
|
+
_clearShapes() {
|
|
15487
|
+
this._shapes.cols.forEach((shape) => shape.dispose());
|
|
15488
|
+
this._shapes.rows.forEach((shape) => shape.dispose());
|
|
15489
|
+
this._shapes = {
|
|
15490
|
+
cols: [],
|
|
15491
|
+
rows: []
|
|
15492
|
+
};
|
|
15493
|
+
}
|
|
15494
|
+
_getSheetObject() {
|
|
15495
|
+
return getSheetObject(this._workbook, this._context);
|
|
15951
15496
|
}
|
|
15952
15497
|
};
|
|
15498
|
+
HeaderUnhideRenderController = __decorate([
|
|
15499
|
+
__decorateParam(1, Inject(SheetSkeletonManagerService)),
|
|
15500
|
+
__decorateParam(2, Inject(HeaderUnhideRangeService)),
|
|
15501
|
+
__decorateParam(3, ICommandService)
|
|
15502
|
+
], HeaderUnhideRenderController);
|
|
15953
15503
|
|
|
15954
15504
|
//#endregion
|
|
15955
|
-
//#region src/controllers/render-controllers/
|
|
15956
|
-
const
|
|
15957
|
-
|
|
15958
|
-
|
|
15959
|
-
get _workbook() {
|
|
15960
|
-
return this._context.unit;
|
|
15961
|
-
}
|
|
15962
|
-
constructor(_context, _sheetSkeletonManagerService, _headerUnhideRangeService, _commandService) {
|
|
15505
|
+
//#region src/controllers/render-controllers/sheet.render-controller.ts
|
|
15506
|
+
const FRAME_STACK_THRESHOLD = 60;
|
|
15507
|
+
let SheetRenderController = class SheetRenderController extends RxDisposable {
|
|
15508
|
+
constructor(_context, _configService, _sheetSkeletonManagerService, _sheetRenderService, _commandService, _telemetryService) {
|
|
15963
15509
|
super();
|
|
15964
15510
|
this._context = _context;
|
|
15511
|
+
this._configService = _configService;
|
|
15965
15512
|
this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
|
|
15966
|
-
this.
|
|
15513
|
+
this._sheetRenderService = _sheetRenderService;
|
|
15967
15514
|
this._commandService = _commandService;
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15515
|
+
this._telemetryService = _telemetryService;
|
|
15516
|
+
_defineProperty(this, "_renderMetric$", new Subject());
|
|
15517
|
+
_defineProperty(this, "renderMetric$", this._renderMetric$.asObservable());
|
|
15518
|
+
_defineProperty(this, "_renderFrameTimeMetric", null);
|
|
15519
|
+
_defineProperty(this, "_renderFrameTags", {});
|
|
15520
|
+
_defineProperty(this, "_afterRenderMetric$", new Subject());
|
|
15521
|
+
this._addNewRender();
|
|
15522
|
+
this._initRenderMetricSubscriber();
|
|
15523
|
+
}
|
|
15524
|
+
_addNewRender() {
|
|
15525
|
+
const { scene, engine, unit: workbook } = this._context;
|
|
15526
|
+
this._addComponent(workbook);
|
|
15527
|
+
this._initRerenderScheduler();
|
|
15528
|
+
this._initCommandListener();
|
|
15529
|
+
const worksheet = this._context.unit.getActiveSheet();
|
|
15530
|
+
if (!worksheet) throw new Error("No active sheet found");
|
|
15531
|
+
const sheetId = worksheet.getSheetId();
|
|
15532
|
+
this._sheetSkeletonManagerService.setCurrent({ sheetId });
|
|
15533
|
+
const frameFn = () => scene.render();
|
|
15534
|
+
this.disposeWithMe(this._context.activated$.subscribe((activated) => {
|
|
15535
|
+
if (activated) engine.runRenderLoop(frameFn);
|
|
15536
|
+
else engine.stopRenderLoop(frameFn);
|
|
15537
|
+
}));
|
|
15538
|
+
}
|
|
15539
|
+
_initRenderMetricSubscriber() {
|
|
15540
|
+
const { engine } = this._context;
|
|
15541
|
+
this.disposeWithMe(engine.beginFrame$.subscribe(() => {
|
|
15542
|
+
this._renderFrameTimeMetric = null;
|
|
15543
|
+
this._renderFrameTags = {};
|
|
15544
|
+
}));
|
|
15545
|
+
this.disposeWithMe(engine.endFrame$.subscribe(() => {
|
|
15546
|
+
if (this._renderFrameTimeMetric && Object.keys(this._renderFrameTimeMetric).some((key) => key.startsWith(SHEET_EXTENSION_PREFIX))) this._afterRenderMetric$.next({
|
|
15547
|
+
frameTimeMetric: this._renderFrameTimeMetric,
|
|
15548
|
+
tags: this._renderFrameTags
|
|
15549
|
+
});
|
|
15550
|
+
}));
|
|
15551
|
+
this.disposeWithMe(engine.renderFrameTimeMetric$.subscribe(([key, value]) => {
|
|
15552
|
+
if (!this._renderFrameTimeMetric) this._renderFrameTimeMetric = {};
|
|
15553
|
+
if (!this._renderFrameTimeMetric[key]) this._renderFrameTimeMetric[key] = [];
|
|
15554
|
+
this._renderFrameTimeMetric[key].push(Math.round(value * 100) / 100);
|
|
15555
|
+
}));
|
|
15556
|
+
this.disposeWithMe(engine.renderFrameTags$.subscribe(([key, value]) => {
|
|
15557
|
+
this._renderFrameTags[key] = value;
|
|
15558
|
+
}));
|
|
15559
|
+
const frameInfoList = [];
|
|
15560
|
+
this.disposeWithMe(this._afterRenderMetric$.pipe(withLatestFrom(engine.endFrame$)).subscribe(([sceneRenderDetail, basicFrameTimeInfo]) => {
|
|
15561
|
+
frameInfoList.push({
|
|
15562
|
+
FPS: basicFrameTimeInfo.FPS,
|
|
15563
|
+
elapsedTime: basicFrameTimeInfo.elapsedTime,
|
|
15564
|
+
frameTime: Math.round(basicFrameTimeInfo.frameTime * 100) / 100,
|
|
15565
|
+
...sceneRenderDetail.frameTimeMetric,
|
|
15566
|
+
...sceneRenderDetail.tags
|
|
15567
|
+
});
|
|
15568
|
+
if (frameInfoList.length > FRAME_STACK_THRESHOLD) {
|
|
15569
|
+
this._captureRenderMetric(frameInfoList);
|
|
15570
|
+
frameInfoList.length = 0;
|
|
15571
|
+
}
|
|
15572
|
+
}));
|
|
15573
|
+
}
|
|
15574
|
+
/**
|
|
15575
|
+
* Send render metric to telemetry service
|
|
15576
|
+
* @param frameInfoList
|
|
15577
|
+
*/
|
|
15578
|
+
_captureRenderMetric(frameInfoList) {
|
|
15579
|
+
var _this$_telemetryServi;
|
|
15580
|
+
const filteredFrameInfo = frameInfoList;
|
|
15581
|
+
if (filteredFrameInfo.length === 0) return;
|
|
15582
|
+
const sumValueForNumListFields = (data) => {
|
|
15583
|
+
let totalSum = 0;
|
|
15584
|
+
const sums = Object.entries(data).filter(([_, value]) => Array.isArray(value)).map(([key]) => key).reduce((acc, key) => {
|
|
15585
|
+
acc[key] = data[key].reduce((sum, num) => sum + num, 0);
|
|
15586
|
+
return acc;
|
|
15587
|
+
}, {});
|
|
15588
|
+
Object.keys(data).filter((key) => key.startsWith(SHEET_EXTENSION_PREFIX)).forEach((key) => {
|
|
15589
|
+
totalSum += sums[key];
|
|
15590
|
+
});
|
|
15591
|
+
return {
|
|
15592
|
+
...sums,
|
|
15593
|
+
extensionTotal: totalSum
|
|
15594
|
+
};
|
|
15595
|
+
};
|
|
15596
|
+
const frameTimeListAfterSum = frameInfoList.map((info) => {
|
|
15597
|
+
return {
|
|
15598
|
+
...info,
|
|
15599
|
+
...sumValueForNumListFields(info)
|
|
15600
|
+
};
|
|
15601
|
+
});
|
|
15602
|
+
const getSummaryStats = (list) => {
|
|
15603
|
+
return Object.entries(list[0]).filter(([key, _]) => !["elapsedTime"].includes(key)).filter(([_, value]) => typeof value === "number").map(([key]) => key).reduce((acc, key) => {
|
|
15604
|
+
const values = list.map((obj) => obj[key]);
|
|
15605
|
+
const max = Math.max(...values);
|
|
15606
|
+
const min = Math.min(...values);
|
|
15607
|
+
const avg = values.reduce((sum, val) => sum + val, 0) / values.length;
|
|
15608
|
+
acc[key] = {
|
|
15609
|
+
max: Math.round(max * 100) / 100,
|
|
15610
|
+
min: Math.round(min * 100) / 100,
|
|
15611
|
+
avg: Math.round(avg * 100) / 100
|
|
15612
|
+
};
|
|
15613
|
+
return acc;
|
|
15614
|
+
}, {});
|
|
15615
|
+
};
|
|
15616
|
+
const summaryFrameStats = getSummaryStats(frameTimeListAfterSum);
|
|
15617
|
+
const elapsedTimeToStart = filteredFrameInfo[filteredFrameInfo.length - 1].elapsedTime;
|
|
15618
|
+
const telemetryData = {
|
|
15619
|
+
sheetId: this._context.unit.getActiveSheet().getSheetId(),
|
|
15620
|
+
unitId: this._context.unit.getUnitId(),
|
|
15621
|
+
elapsedTimeToStart,
|
|
15622
|
+
...summaryFrameStats
|
|
15623
|
+
};
|
|
15624
|
+
this._renderMetric$.next(telemetryData);
|
|
15625
|
+
(_this$_telemetryServi = this._telemetryService) === null || _this$_telemetryServi === void 0 || _this$_telemetryServi.capture("sheet_render_cost", telemetryData);
|
|
15626
|
+
}
|
|
15627
|
+
_addComponent(workbook) {
|
|
15628
|
+
const { scene, components } = this._context;
|
|
15629
|
+
const worksheet = workbook.getActiveSheet();
|
|
15630
|
+
const spreadsheet = new Spreadsheet("__SpreadsheetRender__");
|
|
15631
|
+
this._addViewport(worksheet);
|
|
15632
|
+
const spreadsheetRowHeader = new SpreadsheetRowHeader("__SpreadsheetRowHeader__");
|
|
15633
|
+
const spreadsheetColumnHeader = new SpreadsheetColumnHeader("__SpreadsheetColumnHeader__");
|
|
15634
|
+
const SpreadsheetLeftTopPlaceholder = new Rect("__SpreadsheetLeftTopPlaceholder__", {
|
|
15635
|
+
zIndex: 2,
|
|
15636
|
+
left: -1,
|
|
15637
|
+
top: -1,
|
|
15638
|
+
fill: "gray.50",
|
|
15639
|
+
stroke: "gray.200",
|
|
15640
|
+
strokeWidth: 1
|
|
15641
|
+
});
|
|
15642
|
+
this._context.mainComponent = spreadsheet;
|
|
15643
|
+
components.set("__SpreadsheetRender__", spreadsheet);
|
|
15644
|
+
components.set("__SpreadsheetRowHeader__", spreadsheetRowHeader);
|
|
15645
|
+
components.set("__SpreadsheetColumnHeader__", spreadsheetColumnHeader);
|
|
15646
|
+
components.set("__SpreadsheetLeftTopPlaceholder__", SpreadsheetLeftTopPlaceholder);
|
|
15647
|
+
scene.addObjects([spreadsheet], 0);
|
|
15648
|
+
scene.addObjects([
|
|
15649
|
+
spreadsheetRowHeader,
|
|
15650
|
+
spreadsheetColumnHeader,
|
|
15651
|
+
SpreadsheetLeftTopPlaceholder
|
|
15652
|
+
], 10);
|
|
15653
|
+
scene.enableLayerCache(0, 10);
|
|
15654
|
+
}
|
|
15655
|
+
_initViewports(scene, rowHeader, columnHeader) {
|
|
15656
|
+
const rowHeaderWidth = rowHeader.hidden ? 0 : rowHeader.width;
|
|
15657
|
+
const columnHeaderHeight = columnHeader.hidden ? 0 : columnHeader.height;
|
|
15658
|
+
const bufferEdgeX = 100;
|
|
15659
|
+
const bufferEdgeY = 100;
|
|
15660
|
+
const viewMain = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN, scene, {
|
|
15661
|
+
left: rowHeaderWidth,
|
|
15662
|
+
top: columnHeaderHeight,
|
|
15663
|
+
bottom: 0,
|
|
15664
|
+
right: 0,
|
|
15665
|
+
isWheelPreventDefaultX: true,
|
|
15666
|
+
allowCache: true,
|
|
15667
|
+
bufferEdgeX,
|
|
15668
|
+
bufferEdgeY
|
|
15669
|
+
});
|
|
15670
|
+
const viewMainLeftTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP, scene, {
|
|
15671
|
+
isWheelPreventDefaultX: true,
|
|
15672
|
+
active: false,
|
|
15673
|
+
allowCache: true,
|
|
15674
|
+
bufferEdgeX: 0,
|
|
15675
|
+
bufferEdgeY: 0
|
|
15676
|
+
});
|
|
15677
|
+
const viewMainLeft = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT, scene, {
|
|
15678
|
+
isWheelPreventDefaultX: true,
|
|
15679
|
+
active: false,
|
|
15680
|
+
allowCache: true,
|
|
15681
|
+
bufferEdgeX: 0,
|
|
15682
|
+
bufferEdgeY
|
|
15971
15683
|
});
|
|
15972
|
-
|
|
15973
|
-
|
|
15684
|
+
const viewMainTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP, scene, {
|
|
15685
|
+
isWheelPreventDefaultX: true,
|
|
15686
|
+
active: false,
|
|
15687
|
+
allowCache: true,
|
|
15688
|
+
bufferEdgeX,
|
|
15689
|
+
bufferEdgeY: 0
|
|
15690
|
+
});
|
|
15691
|
+
const viewRowTop = new Viewport(SHEET_VIEWPORT_KEY.VIEW_ROW_TOP, scene, {
|
|
15692
|
+
active: false,
|
|
15693
|
+
isWheelPreventDefaultX: true
|
|
15694
|
+
});
|
|
15695
|
+
const viewRowBottom = new Viewport(SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM, scene, {
|
|
15696
|
+
left: 0,
|
|
15697
|
+
top: columnHeaderHeight,
|
|
15698
|
+
bottom: 0,
|
|
15699
|
+
width: rowHeaderWidth + 1,
|
|
15700
|
+
isWheelPreventDefaultX: true
|
|
15701
|
+
});
|
|
15702
|
+
const viewColumnLeft = new Viewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT, scene, {
|
|
15703
|
+
active: false,
|
|
15704
|
+
isWheelPreventDefaultX: true
|
|
15705
|
+
});
|
|
15706
|
+
const viewColumnRight = new Viewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT, scene, {
|
|
15707
|
+
left: rowHeaderWidth,
|
|
15708
|
+
top: 0,
|
|
15709
|
+
height: columnHeaderHeight + 1,
|
|
15710
|
+
right: 0,
|
|
15711
|
+
isWheelPreventDefaultX: true
|
|
15712
|
+
});
|
|
15713
|
+
return {
|
|
15714
|
+
viewMain,
|
|
15715
|
+
viewLeftTop: new Viewport(SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP, scene, {
|
|
15716
|
+
left: 0,
|
|
15717
|
+
top: 0,
|
|
15718
|
+
width: rowHeaderWidth,
|
|
15719
|
+
height: columnHeaderHeight,
|
|
15720
|
+
isWheelPreventDefaultX: true
|
|
15721
|
+
}),
|
|
15722
|
+
viewMainLeftTop,
|
|
15723
|
+
viewMainLeft,
|
|
15724
|
+
viewMainTop,
|
|
15725
|
+
viewColumnLeft,
|
|
15726
|
+
viewRowTop,
|
|
15727
|
+
viewRowBottom,
|
|
15728
|
+
viewColumnRight
|
|
15729
|
+
};
|
|
15974
15730
|
}
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
15731
|
+
/**
|
|
15732
|
+
*
|
|
15733
|
+
* initViewport & wheel event
|
|
15734
|
+
* +-----------------+--------------------+-------------------+
|
|
15735
|
+
* | VIEW_LEFT_TOP | VIEW_COLUMN_LEFT | VIEW_COLUMN_RIGHT |
|
|
15736
|
+
* +-----------------+--------------------+-------------------+
|
|
15737
|
+
* | VIEW_ROW_TOP | VIEW_MAIN_LEFT_TOP | VIEW_MAIN_TOP |
|
|
15738
|
+
* +-----------------+--------------------+-------------------+
|
|
15739
|
+
* | VIEW_ROW_BOTTOM | VIEW_MAIN_LEFT | VIEW_MAIN |
|
|
15740
|
+
* +-----------------+--------------------+-------------------+
|
|
15741
|
+
*/
|
|
15742
|
+
_addViewport(worksheet) {
|
|
15743
|
+
const scene = this._context.scene;
|
|
15744
|
+
const { rowHeader, columnHeader } = worksheet.getConfig();
|
|
15745
|
+
const { viewMain } = this._initViewports(scene, rowHeader, columnHeader);
|
|
15746
|
+
const sheetsUIConfig = this._configService.getConfig(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
15747
|
+
new ScrollBar(viewMain, sheetsUIConfig === null || sheetsUIConfig === void 0 ? void 0 : sheetsUIConfig.scrollConfig);
|
|
15748
|
+
scene.attachControl();
|
|
15749
|
+
return viewMain;
|
|
15978
15750
|
}
|
|
15979
|
-
|
|
15980
|
-
let activeSheetId = "";
|
|
15981
|
-
this._context.unit.activeSheet$.pipe(takeUntil(this.dispose$)).subscribe((worksheet) => {
|
|
15982
|
-
this._clearShapes();
|
|
15983
|
-
if (!worksheet) {
|
|
15984
|
-
activeSheetId = "";
|
|
15985
|
-
return;
|
|
15986
|
-
}
|
|
15987
|
-
activeSheetId = worksheet.getSheetId();
|
|
15988
|
-
this._update(this._workbook, worksheet);
|
|
15989
|
-
});
|
|
15751
|
+
_initRerenderScheduler() {
|
|
15990
15752
|
this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((param) => {
|
|
15991
|
-
if (param)
|
|
15992
|
-
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
|
|
15997
|
-
|
|
15753
|
+
if (!param) return null;
|
|
15754
|
+
const { skeleton: spreadsheetSkeleton, sheetId } = param;
|
|
15755
|
+
const workbook = this._context.unit;
|
|
15756
|
+
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(sheetId);
|
|
15757
|
+
if (workbook == null || worksheet == null) return;
|
|
15758
|
+
const { mainComponent, components } = this._context;
|
|
15759
|
+
const spreadsheet = mainComponent;
|
|
15760
|
+
const spreadsheetRowHeader = components.get("__SpreadsheetRowHeader__");
|
|
15761
|
+
const spreadsheetColumnHeader = components.get("__SpreadsheetColumnHeader__");
|
|
15762
|
+
const spreadsheetLeftTopPlaceholder = components.get("__SpreadsheetLeftTopPlaceholder__");
|
|
15763
|
+
const leftTopPlaceholderSize = getLeftTopPlaceholderSize(spreadsheetSkeleton);
|
|
15764
|
+
spreadsheet === null || spreadsheet === void 0 || spreadsheet.updateSkeleton(spreadsheetSkeleton);
|
|
15765
|
+
spreadsheetRowHeader === null || spreadsheetRowHeader === void 0 || spreadsheetRowHeader.updateSkeleton(spreadsheetSkeleton);
|
|
15766
|
+
spreadsheetColumnHeader === null || spreadsheetColumnHeader === void 0 || spreadsheetColumnHeader.updateSkeleton(spreadsheetSkeleton);
|
|
15767
|
+
spreadsheetLeftTopPlaceholder === null || spreadsheetLeftTopPlaceholder === void 0 || spreadsheetLeftTopPlaceholder.transformByState({
|
|
15768
|
+
width: leftTopPlaceholderSize.width,
|
|
15769
|
+
height: leftTopPlaceholderSize.height
|
|
15770
|
+
});
|
|
15998
15771
|
}));
|
|
15999
15772
|
}
|
|
16000
|
-
|
|
16001
|
-
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
|
|
16007
|
-
|
|
16008
|
-
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
|
|
15773
|
+
_initCommandListener() {
|
|
15774
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((command, options) => {
|
|
15775
|
+
const { unit: workbook } = this._context;
|
|
15776
|
+
const { id: commandId } = command;
|
|
15777
|
+
if (COMMAND_LISTENER_SKELETON_CHANGE.includes(commandId) || this._sheetRenderService.checkMutationShouldTriggerRerender(commandId)) {
|
|
15778
|
+
const { unitId, subUnitId } = command.params;
|
|
15779
|
+
const worksheet = workbook.getActiveSheet();
|
|
15780
|
+
if (!worksheet) return;
|
|
15781
|
+
const workbookId = this._context.unitId;
|
|
15782
|
+
const worksheetId = worksheet.getSheetId();
|
|
15783
|
+
if (unitId !== workbookId || subUnitId !== worksheetId) return;
|
|
15784
|
+
this._sheetSkeletonManagerService.makeDirty({
|
|
15785
|
+
sheetId: worksheetId,
|
|
15786
|
+
commandId
|
|
15787
|
+
}, true);
|
|
15788
|
+
this._sheetSkeletonManagerService.setCurrent({
|
|
15789
|
+
sheetId: worksheetId,
|
|
15790
|
+
commandId
|
|
15791
|
+
});
|
|
15792
|
+
} else if (COMMAND_LISTENER_VALUE_CHANGE.includes(commandId)) this._sheetSkeletonManagerService.reCalculate();
|
|
15793
|
+
if (command.type === CommandType.MUTATION) this._markUnitDirty(command, options);
|
|
16017
15794
|
}));
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16036
|
-
|
|
16037
|
-
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16042
|
-
|
|
16043
|
-
|
|
16044
|
-
|
|
16045
|
-
|
|
16046
|
-
|
|
16047
|
-
|
|
16048
|
-
|
|
16049
|
-
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
15795
|
+
}
|
|
15796
|
+
_markUnitDirty(command, options) {
|
|
15797
|
+
if (command.id.substring(0, 3) === "doc") return;
|
|
15798
|
+
const { mainComponent: spreadsheet, scene } = this._context;
|
|
15799
|
+
if (command.id === SetFormulaCalculationNotificationMutation.id) {
|
|
15800
|
+
if (command.params.stageInfo != null) return;
|
|
15801
|
+
}
|
|
15802
|
+
if (spreadsheet) spreadsheet.makeDirty();
|
|
15803
|
+
scene.makeDirty();
|
|
15804
|
+
if (!command.params) return;
|
|
15805
|
+
const cmdParams = command.params;
|
|
15806
|
+
const viewports = this._spreadsheetViewports(scene);
|
|
15807
|
+
if (command.id === SetRangeValuesMutation.id && cmdParams.cellValue && !(options === null || options === void 0 ? void 0 : options.fromChangeset)) {
|
|
15808
|
+
const dirtyRange = this._cellValueToRange(cmdParams.cellValue);
|
|
15809
|
+
const dirtyBounds = this._rangeToBounds([dirtyRange]);
|
|
15810
|
+
this._markViewportDirty(viewports, dirtyBounds);
|
|
15811
|
+
spreadsheet.setDirtyArea(dirtyBounds);
|
|
15812
|
+
}
|
|
15813
|
+
if (command.id === MoveRangeMutation.id && cmdParams.from && cmdParams.to && !(options === null || options === void 0 ? void 0 : options.fromChangeset)) {
|
|
15814
|
+
const fromRange = cmdParams.fromRange || this._cellValueToRange(cmdParams.from.value);
|
|
15815
|
+
const toRange = cmdParams.toRange || this._cellValueToRange(cmdParams.to.value);
|
|
15816
|
+
const dirtyBounds = this._rangeToBounds([fromRange, toRange]);
|
|
15817
|
+
this._markViewportDirty(viewports, dirtyBounds);
|
|
15818
|
+
spreadsheet.setDirtyArea(dirtyBounds);
|
|
15819
|
+
}
|
|
15820
|
+
}
|
|
15821
|
+
/**
|
|
15822
|
+
* cellValue data structure:
|
|
15823
|
+
* {[row]: { [col]: value}}
|
|
15824
|
+
* @param cellValue
|
|
15825
|
+
* @returns IRange
|
|
15826
|
+
*/
|
|
15827
|
+
_cellValueToRange(cellValue) {
|
|
15828
|
+
const columns = [];
|
|
15829
|
+
let minCol = 0;
|
|
15830
|
+
let maxCol = 0;
|
|
15831
|
+
let minRow = 0;
|
|
15832
|
+
let maxRow = 0;
|
|
15833
|
+
for (const [_row, columnObj] of Object.entries(cellValue)) {
|
|
15834
|
+
for (const column in columnObj) {
|
|
15835
|
+
columns.push(Number(column));
|
|
15836
|
+
if (minCol > Number(column)) minCol = Number(column);
|
|
15837
|
+
if (maxCol < Number(column)) maxCol = Number(column);
|
|
15838
|
+
}
|
|
15839
|
+
if (minRow > Number(_row)) minRow = Number(_row);
|
|
15840
|
+
if (maxRow < Number(_row)) maxRow = Number(_row);
|
|
15841
|
+
}
|
|
15842
|
+
return {
|
|
15843
|
+
startRow: minRow,
|
|
15844
|
+
endRow: maxRow,
|
|
15845
|
+
startColumn: minCol,
|
|
15846
|
+
endColumn: maxCol
|
|
16063
15847
|
};
|
|
16064
15848
|
}
|
|
16065
|
-
|
|
16066
|
-
this.
|
|
16067
|
-
|
|
16068
|
-
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
15849
|
+
_rangeToBounds(ranges) {
|
|
15850
|
+
const { rowHeightAccumulation, columnWidthAccumulation, rowHeaderWidth, columnHeaderHeight } = this._sheetSkeletonManagerService.getCurrentParam().skeleton;
|
|
15851
|
+
const dirtyBounds = [];
|
|
15852
|
+
for (const r of ranges) {
|
|
15853
|
+
const { startRow, endRow, startColumn, endColumn } = r;
|
|
15854
|
+
const top = startRow === 0 ? 0 : rowHeightAccumulation[startRow - 1] + columnHeaderHeight;
|
|
15855
|
+
const bottom = rowHeightAccumulation[endRow] + columnHeaderHeight;
|
|
15856
|
+
const left = startColumn === 0 ? 0 : columnWidthAccumulation[startColumn - 1] + rowHeaderWidth;
|
|
15857
|
+
const right = columnWidthAccumulation[endColumn] + rowHeaderWidth;
|
|
15858
|
+
dirtyBounds.push({
|
|
15859
|
+
top,
|
|
15860
|
+
left,
|
|
15861
|
+
bottom,
|
|
15862
|
+
right,
|
|
15863
|
+
width: right - left,
|
|
15864
|
+
height: bottom - top
|
|
15865
|
+
});
|
|
15866
|
+
}
|
|
15867
|
+
return dirtyBounds;
|
|
15868
|
+
}
|
|
15869
|
+
_markViewportDirty(viewports, dirtyBounds) {
|
|
15870
|
+
const activeViewports = viewports.filter((vp) => vp.isActive && vp.cacheBound);
|
|
15871
|
+
for (const vp of activeViewports) for (const b of dirtyBounds) if (Rectangle.hasIntersectionBetweenTwoRect(vp.cacheBound, b)) vp.markDirty(true);
|
|
16072
15872
|
}
|
|
16073
|
-
|
|
16074
|
-
return
|
|
15873
|
+
_spreadsheetViewports(scene) {
|
|
15874
|
+
return scene.getViewports().filter((v) => [
|
|
15875
|
+
"viewMain",
|
|
15876
|
+
"viewMainLeftTop",
|
|
15877
|
+
"viewMainTop",
|
|
15878
|
+
"viewMainLeft"
|
|
15879
|
+
].includes(v.viewportKey));
|
|
16075
15880
|
}
|
|
16076
15881
|
};
|
|
16077
|
-
|
|
16078
|
-
__decorateParam(1, Inject(
|
|
16079
|
-
__decorateParam(2, Inject(
|
|
16080
|
-
__decorateParam(3,
|
|
16081
|
-
|
|
15882
|
+
SheetRenderController = __decorate([
|
|
15883
|
+
__decorateParam(1, Inject(IConfigService)),
|
|
15884
|
+
__decorateParam(2, Inject(SheetSkeletonManagerService)),
|
|
15885
|
+
__decorateParam(3, Inject(SheetsRenderService)),
|
|
15886
|
+
__decorateParam(4, ICommandService),
|
|
15887
|
+
__decorateParam(5, Optional(ITelemetryService))
|
|
15888
|
+
], SheetRenderController);
|
|
15889
|
+
function getLeftTopPlaceholderSize(skeleton) {
|
|
15890
|
+
return {
|
|
15891
|
+
width: skeleton.rowHeaderWidthAndMarginLeft ?? skeleton.rowHeaderWidth,
|
|
15892
|
+
height: skeleton.columnHeaderHeightAndMarginTop ?? skeleton.columnHeaderHeight
|
|
15893
|
+
};
|
|
15894
|
+
}
|
|
16082
15895
|
|
|
16083
15896
|
//#endregion
|
|
16084
15897
|
//#region src/services/status-bar.service.ts
|
|
@@ -17357,6 +17170,7 @@ function ToggleGridlinesMenuFactory(accessor) {
|
|
|
17357
17170
|
type: MenuItemType.BUTTON,
|
|
17358
17171
|
tooltip: "sheets-ui.toolbar.toggleGridlines",
|
|
17359
17172
|
icon: "HideGridlinesIcon",
|
|
17173
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
|
|
17360
17174
|
activated$: new Observable((observer) => {
|
|
17361
17175
|
const getValue = () => {
|
|
17362
17176
|
const workbook = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
|
|
@@ -18103,7 +17917,7 @@ function TextColorSelectorMenuItemFactory(accessor) {
|
|
|
18103
17917
|
selectable: false
|
|
18104
17918
|
},
|
|
18105
17919
|
value$: new Observable((subscriber) => {
|
|
18106
|
-
const defaultValue =
|
|
17920
|
+
const defaultValue = themeService.getColorFromTheme("gray.900");
|
|
18107
17921
|
const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("cl");
|
|
18108
17922
|
if (isAllValuesSame) subscriber.next((currentValue === null || currentValue === void 0 ? void 0 : currentValue.rgb) ?? defaultValue);
|
|
18109
17923
|
else subscriber.next(defaultValue);
|
|
@@ -20179,7 +19993,7 @@ function getEmbedSheetsTabCustomData(snapshot) {
|
|
|
20179
19993
|
function isEmbedSheetsTabCustomData(value) {
|
|
20180
19994
|
if (!value || typeof value !== "object") return false;
|
|
20181
19995
|
const candidate = value;
|
|
20182
|
-
return candidate.version === 1 && typeof candidate.embedId === "string" && typeof candidate.hostAnchorId === "string";
|
|
19996
|
+
return candidate.version === 1 && typeof candidate.embedId === "string" && typeof candidate.hostAnchorId === "string" && (candidate.childType === void 0 || typeof candidate.childType === "number");
|
|
20183
19997
|
}
|
|
20184
19998
|
|
|
20185
19999
|
//#endregion
|
|
@@ -20188,10 +20002,6 @@ const ISheetEmbedRuntimeService = createIdentifier("sheet-ui.embed-runtime.servi
|
|
|
20188
20002
|
|
|
20189
20003
|
//#endregion
|
|
20190
20004
|
//#region src/views/auto-fill-popup-menu/AutoFillPopupMenu.tsx
|
|
20191
|
-
const useUpdate = () => {
|
|
20192
|
-
const [, setState] = useState({});
|
|
20193
|
-
return useCallback(() => setState((prevState) => !prevState), []);
|
|
20194
|
-
};
|
|
20195
20005
|
function AutoFillPopupMenu() {
|
|
20196
20006
|
const commandService = useDependency(ICommandService);
|
|
20197
20007
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
@@ -20221,7 +20031,8 @@ function AutoFillPopupMenu() {
|
|
|
20221
20031
|
col: -1
|
|
20222
20032
|
}, false, [autoFillService]);
|
|
20223
20033
|
const selected = useObservable(autoFillService.applyType$, AUTO_FILL_APPLY_TYPE.SERIES);
|
|
20224
|
-
const [isHovered,
|
|
20034
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
20035
|
+
const [, forceUpdate] = useReducer((version) => version + 1, 0);
|
|
20225
20036
|
const workbook = useActiveWorkbook();
|
|
20226
20037
|
const sheetSkeletonManagerService = useMemo(() => {
|
|
20227
20038
|
if (workbook) {
|
|
@@ -20231,14 +20042,13 @@ function AutoFillPopupMenu() {
|
|
|
20231
20042
|
return null;
|
|
20232
20043
|
}, [workbook, renderManagerService]);
|
|
20233
20044
|
const handleMouseEnter = () => {
|
|
20234
|
-
|
|
20045
|
+
setIsHovered(true);
|
|
20235
20046
|
};
|
|
20236
20047
|
const handleMouseLeave = () => {
|
|
20237
|
-
|
|
20048
|
+
setIsHovered(false);
|
|
20238
20049
|
};
|
|
20239
|
-
const forceUpdate = useUpdate();
|
|
20240
20050
|
useEffect(() => {
|
|
20241
|
-
return commandService.onCommandExecuted((command
|
|
20051
|
+
return commandService.onCommandExecuted((command) => {
|
|
20242
20052
|
if (command.id === SetScrollOperation.id) forceUpdate();
|
|
20243
20053
|
}).dispose;
|
|
20244
20054
|
}, [forceUpdate, commandService]);
|
|
@@ -20283,7 +20093,11 @@ function AutoFillPopupMenu() {
|
|
|
20283
20093
|
const showMore = visible || isHovered;
|
|
20284
20094
|
const availableMenu = menu.filter((item) => !item.disable);
|
|
20285
20095
|
return /* @__PURE__ */ jsx("div", {
|
|
20286
|
-
className: "univer-absolute univer-
|
|
20096
|
+
className: "univer-absolute univer-z-10 univer-size-0",
|
|
20097
|
+
style: {
|
|
20098
|
+
left: 0,
|
|
20099
|
+
top: 0
|
|
20100
|
+
},
|
|
20287
20101
|
children: /* @__PURE__ */ jsx("div", {
|
|
20288
20102
|
className: "univer-absolute",
|
|
20289
20103
|
style: {
|
|
@@ -20308,9 +20122,9 @@ function AutoFillPopupMenu() {
|
|
|
20308
20122
|
children: /* @__PURE__ */ jsxs("div", {
|
|
20309
20123
|
className: clsx("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", borderClassName, {
|
|
20310
20124
|
"univer-bg-gray-100 dark:!univer-bg-gray-800": visible,
|
|
20311
|
-
"univer-bg-
|
|
20125
|
+
"univer-bg-gray-0 dark:!univer-bg-gray-900": !visible
|
|
20312
20126
|
}),
|
|
20313
|
-
children: [/* @__PURE__ */ jsx(AutofillDoubleIcon, { className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-
|
|
20127
|
+
children: [/* @__PURE__ */ jsx(AutofillDoubleIcon, { className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-gray-0" }), showMore && /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-gray-0" })]
|
|
20314
20128
|
})
|
|
20315
20129
|
})
|
|
20316
20130
|
})
|
|
@@ -20457,7 +20271,7 @@ const EDITOR_DEFAULT_POSITION = {
|
|
|
20457
20271
|
left: HIDDEN_EDITOR_POSITION
|
|
20458
20272
|
};
|
|
20459
20273
|
const CELL_EDITOR_DARK_SURFACE_THEME_COLOR = "gray.800";
|
|
20460
|
-
const CELL_EDITOR_LIGHT_SURFACE_THEME_COLOR = "
|
|
20274
|
+
const CELL_EDITOR_LIGHT_SURFACE_THEME_COLOR = "gray.0";
|
|
20461
20275
|
/**
|
|
20462
20276
|
* @returns the host background color for the cell editor.
|
|
20463
20277
|
*/
|
|
@@ -20516,6 +20330,7 @@ function isEmbedRuntimeEditorOrPopup(target) {
|
|
|
20516
20330
|
* @returns the rendered cell editor container.
|
|
20517
20331
|
*/
|
|
20518
20332
|
function EditorContainer() {
|
|
20333
|
+
var _workbook$getSheetByS;
|
|
20519
20334
|
const [state, setState] = useState({ ...EDITOR_DEFAULT_POSITION });
|
|
20520
20335
|
const cellEditorManagerService = useDependency(ICellEditorManagerService);
|
|
20521
20336
|
const injector = useDependency(Injector);
|
|
@@ -20534,9 +20349,12 @@ function EditorContainer() {
|
|
|
20534
20349
|
const disableAutoFocus = useObservable(() => contextService.subscribeContextValue$(DISABLE_AUTO_FOCUS_KEY), false, void 0, [contextService, DISABLE_AUTO_FOCUS_KEY]);
|
|
20535
20350
|
const FormulaEditor = componentManager.get(EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY);
|
|
20536
20351
|
const editState = useObservable(editorBridgeService.currentEditCellState$);
|
|
20352
|
+
const workbook = editState ? instanceService.getUnit(editState.unitId, UniverInstanceType.UNIVER_SHEET) ?? null : null;
|
|
20353
|
+
const activeSheet = useActiveWorksheet(workbook);
|
|
20537
20354
|
const darkMode = useObservable(themeService.darkMode$, themeService.darkMode);
|
|
20538
20355
|
const [showEditCellAddress, setShowEditCellAddress] = useState(false);
|
|
20539
|
-
const
|
|
20356
|
+
const editSheetName = editState ? workbook === null || workbook === void 0 || (_workbook$getSheetByS = workbook.getSheetBySheetId(editState.sheetId)) === null || _workbook$getSheetByS === void 0 ? void 0 : _workbook$getSheetByS.getName() : null;
|
|
20357
|
+
const editCellAddress = editState ? `${activeSheet && editSheetName && activeSheet.getSheetId() !== editState.sheetId ? `'${quoteSheetName(editSheetName)}'!` : ""}${numberToABC(editState.column)}${editState.row + 1}` : null;
|
|
20540
20358
|
const editorBorderColor = genNormalSelectionStyle(themeService).stroke;
|
|
20541
20359
|
const focusCoordinator = injector.has(ISheetEmbedRuntimeFocusCoordinator) ? injector.get(ISheetEmbedRuntimeFocusCoordinator) : void 0;
|
|
20542
20360
|
const resolveRuntimeFocusState = () => {
|
|
@@ -20856,7 +20674,7 @@ function EditorContainer() {
|
|
|
20856
20674
|
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
20675
|
style: {
|
|
20858
20676
|
backgroundColor: editorBorderColor,
|
|
20859
|
-
color: themeService.getColorFromTheme("
|
|
20677
|
+
color: themeService.getColorFromTheme("gray.0"),
|
|
20860
20678
|
transform: "translateY(-100%)"
|
|
20861
20679
|
},
|
|
20862
20680
|
children: editCellAddress
|
|
@@ -21093,7 +20911,13 @@ function DefinedName({ disable }) {
|
|
|
21093
20911
|
return () => {
|
|
21094
20912
|
subscription.unsubscribe();
|
|
21095
20913
|
};
|
|
21096
|
-
}, [
|
|
20914
|
+
}, [
|
|
20915
|
+
definedNamesService,
|
|
20916
|
+
lexerTreeBuilder,
|
|
20917
|
+
selectionManagerService,
|
|
20918
|
+
unitId,
|
|
20919
|
+
workbook
|
|
20920
|
+
]);
|
|
21097
20921
|
const handleDefinedNamesList = debounce((value) => {
|
|
21098
20922
|
const hasMatch = definedNames.find((i) => i.name.toLowerCase().includes(value.toLowerCase()));
|
|
21099
20923
|
if (hasMatch && !open) setOpen(true);
|
|
@@ -21195,7 +21019,7 @@ function DefinedName({ disable }) {
|
|
|
21195
21019
|
className: "univer-relative univer-box-border univer-flex univer-h-full univer-w-24 univer-border-r-gray-200 univer-py-1.5 univer-transition-all",
|
|
21196
21020
|
children: [/* @__PURE__ */ jsx("input", {
|
|
21197
21021
|
ref: inputRef,
|
|
21198
|
-
className: clsx("univer-box-border univer-size-full univer-appearance-none univer-pl-1.5 univer-pr-5 univer-text-gray-900 focus:univer-outline-none
|
|
21022
|
+
className: clsx("univer-box-border univer-size-full univer-appearance-none univer-bg-transparent univer-pl-1.5 univer-pr-5 univer-text-gray-900 focus:univer-outline-none dark:!univer-border-r-gray-700 dark:!univer-text-gray-0", borderRightClassName, { "univer-cursor-not-allowed": disable }),
|
|
21199
21023
|
type: "text",
|
|
21200
21024
|
value: inputValue,
|
|
21201
21025
|
onChange: handleChangeSelection,
|
|
@@ -21214,7 +21038,7 @@ function DefinedName({ disable }) {
|
|
|
21214
21038
|
onOpenChange: setOpen,
|
|
21215
21039
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
21216
21040
|
children: /* @__PURE__ */ jsx("a", {
|
|
21217
|
-
className: clsx("univer-absolute univer-right-0 univer-top-0 univer-flex univer-h-full univer-cursor-pointer univer-items-center univer-justify-center univer-px-1 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100
|
|
21041
|
+
className: clsx("univer-absolute univer-right-0 univer-top-0 univer-flex univer-h-full univer-cursor-pointer univer-items-center univer-justify-center univer-px-1 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-800", { "univer-cursor-not-allowed univer-text-gray-300 hover:univer-bg-transparent dark:!univer-text-gray-700": disable }),
|
|
21218
21042
|
children: /* @__PURE__ */ jsx(MoreDownIcon, {})
|
|
21219
21043
|
})
|
|
21220
21044
|
})]
|
|
@@ -21349,7 +21173,7 @@ function FormulaBar(props) {
|
|
|
21349
21173
|
const workbookEditDisable = !((workbookEditablePermission === null || workbookEditablePermission === void 0 ? void 0 : workbookEditablePermission.value) ?? true);
|
|
21350
21174
|
const editorActivationDisable = editDisable || workbookEditDisable;
|
|
21351
21175
|
const disabled = editDisable || imageDisable;
|
|
21352
|
-
const
|
|
21176
|
+
const shouldSkipFocusRef = useRef(false);
|
|
21353
21177
|
const handlePointerDown = () => {
|
|
21354
21178
|
try {
|
|
21355
21179
|
contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, true);
|
|
@@ -21364,25 +21188,26 @@ function FormulaBar(props) {
|
|
|
21364
21188
|
unitId: editState.unitId
|
|
21365
21189
|
})) {
|
|
21366
21190
|
contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, false);
|
|
21367
|
-
|
|
21191
|
+
shouldSkipFocusRef.current = true;
|
|
21368
21192
|
}
|
|
21369
21193
|
}
|
|
21370
21194
|
} catch (e) {
|
|
21371
21195
|
contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, false);
|
|
21372
|
-
|
|
21196
|
+
shouldSkipFocusRef.current = true;
|
|
21373
21197
|
throw e;
|
|
21374
21198
|
}
|
|
21375
21199
|
};
|
|
21376
21200
|
const handlePointerUp = () => {
|
|
21377
|
-
if (
|
|
21201
|
+
if (shouldSkipFocusRef.current) setTimeout(() => {
|
|
21378
21202
|
editorService.blur(true);
|
|
21379
21203
|
}, 30);
|
|
21380
|
-
|
|
21204
|
+
shouldSkipFocusRef.current = false;
|
|
21381
21205
|
};
|
|
21382
21206
|
const hideEditor = isCellImage(editState === null || editState === void 0 || (_editState$documentLa = editState.documentLayoutObject.documentModel) === null || _editState$documentLa === void 0 ? void 0 : _editState$documentLa.getSnapshot()) || viewDisable;
|
|
21383
21207
|
return /* @__PURE__ */ jsxs("div", {
|
|
21208
|
+
dir: "ltr",
|
|
21384
21209
|
"data-u-comp": "formula-bar",
|
|
21385
|
-
className: clsx("univer-box-border univer-flex univer-bg-
|
|
21210
|
+
className: clsx("univer-box-border univer-flex univer-bg-gray-0 univer-text-gray-900 univer-transition-[height] univer-ease-linear dark:!univer-bg-gray-800", borderBottomClassName, className, {
|
|
21386
21211
|
"univer-h-7": arrowDirection === 0,
|
|
21387
21212
|
"univer-h-20": arrowDirection === 1,
|
|
21388
21213
|
"univer-pointer-events-none": editDisable
|
|
@@ -21400,17 +21225,17 @@ function FormulaBar(props) {
|
|
|
21400
21225
|
className: clsx("univer-relative univer-box-border univer-flex univer-h-full univer-w-20 univer-items-center univer-justify-center univer-text-xs", borderRightClassName),
|
|
21401
21226
|
children: [
|
|
21402
21227
|
/* @__PURE__ */ jsx("span", {
|
|
21403
|
-
className: clsx("univer-flex univer-items-center univer-justify-center univer-rounded univer-p-1 univer-text-base dark:!univer-text-
|
|
21228
|
+
className: clsx("univer-flex univer-items-center univer-justify-center univer-rounded univer-p-1 univer-text-base dark:!univer-text-gray-0", { "univer-cursor-pointer univer-text-red-600 hover:univer-bg-gray-100 dark:!univer-text-green-400 dark:hover:!univer-bg-gray-700": iconActivated }),
|
|
21404
21229
|
onClick: handleCloseBtnClick,
|
|
21405
21230
|
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
21406
21231
|
}),
|
|
21407
21232
|
/* @__PURE__ */ jsx("span", {
|
|
21408
|
-
className: clsx("univer-flex univer-items-center univer-justify-center univer-rounded univer-p-1 univer-text-base dark:!univer-text-
|
|
21233
|
+
className: clsx("univer-flex univer-items-center univer-justify-center univer-rounded univer-p-1 univer-text-base dark:!univer-text-gray-0", { "univer-cursor-pointer univer-text-green-600 hover:univer-bg-gray-100 dark:!univer-text-red-400 dark:hover:!univer-bg-gray-700": iconActivated }),
|
|
21409
21234
|
onClick: handleConfirmBtnClick,
|
|
21410
21235
|
children: /* @__PURE__ */ jsx(CheckMarkIcon, {})
|
|
21411
21236
|
}),
|
|
21412
21237
|
/* @__PURE__ */ jsx("span", {
|
|
21413
|
-
className: "univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-p-1 univer-text-base hover:univer-bg-gray-100 dark:!univer-text-
|
|
21238
|
+
className: "univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-p-1 univer-text-base hover:univer-bg-gray-100 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700",
|
|
21414
21239
|
onClick: handlerFxBtnClick,
|
|
21415
21240
|
children: /* @__PURE__ */ jsx(FxIcon, {})
|
|
21416
21241
|
})
|
|
@@ -21420,7 +21245,7 @@ function FormulaBar(props) {
|
|
|
21420
21245
|
className: "univer-flex univer-w-full univer-flex-1 univer-overflow-hidden univer-pl-3",
|
|
21421
21246
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
21422
21247
|
ref,
|
|
21423
|
-
className: "univer-relative univer-flex-1 univer-bg-
|
|
21248
|
+
className: "univer-relative univer-flex-1 univer-bg-gray-0 dark:!univer-bg-gray-800",
|
|
21424
21249
|
onPointerDown: handlePointerDown,
|
|
21425
21250
|
onPointerUp: handlePointerUp,
|
|
21426
21251
|
style: { pointerEvents: hideEditor ? "none" : "auto" },
|
|
@@ -21445,7 +21270,7 @@ function FormulaBar(props) {
|
|
|
21445
21270
|
},
|
|
21446
21271
|
autoScrollbar: false,
|
|
21447
21272
|
disableContextMenu: false
|
|
21448
|
-
}), hideEditor && /* @__PURE__ */ jsx("div", { className: "univer-pointer-events-none univer-relative univer-left-0 univer-top-0 univer-z-[100] univer-size-full univer-cursor-not-allowed univer-bg-
|
|
21273
|
+
}), hideEditor && /* @__PURE__ */ jsx("div", { className: "univer-pointer-events-none univer-relative univer-left-0 univer-top-0 univer-z-[100] univer-size-full univer-cursor-not-allowed univer-bg-gray-0 dark:!univer-bg-gray-800" })]
|
|
21449
21274
|
}), /* @__PURE__ */ jsx("div", {
|
|
21450
21275
|
className: clsx("univer-flex univer-h-full univer-w-5 univer-cursor-pointer univer-items-center univer-justify-center univer-text-xs univer-text-gray-700 dark:!univer-text-gray-200", { "univer-cursor-not-allowed univer-text-gray-200 dark:!univer-text-gray-700": editDisable }),
|
|
21451
21276
|
onClick: handleArrowClick,
|
|
@@ -21586,7 +21411,7 @@ function SheetBarItem(props) {
|
|
|
21586
21411
|
const themeService = useDependency(ThemeService);
|
|
21587
21412
|
const getTextColor = (color) => {
|
|
21588
21413
|
const darkTextColor = themeService.getColorFromTheme("gray.900");
|
|
21589
|
-
const lightTextColor = themeService.getColorFromTheme("
|
|
21414
|
+
const lightTextColor = themeService.getColorFromTheme("gray.0");
|
|
21590
21415
|
return new ColorKit(color).isDark() ? lightTextColor : darkTextColor;
|
|
21591
21416
|
};
|
|
21592
21417
|
const currentSelected = Boolean(selected);
|
|
@@ -21600,8 +21425,8 @@ function SheetBarItem(props) {
|
|
|
21600
21425
|
onKeyDown,
|
|
21601
21426
|
onClick,
|
|
21602
21427
|
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", {
|
|
21603
|
-
"dark:!univer-text-
|
|
21604
|
-
"univer-justify-center univer-bg-
|
|
21428
|
+
"dark:!univer-text-gray-0": !color || color && !textColor,
|
|
21429
|
+
"univer-justify-center univer-bg-gray-0 univer-font-bold univer-text-primary-700 univer-shadow": currentSelected,
|
|
21605
21430
|
"dark:!univer-bg-gray-700": currentSelected && !color,
|
|
21606
21431
|
"univer-font-medium univer-text-gray-900 hover:univer-bg-gray-100": !currentSelected,
|
|
21607
21432
|
"dark:hover:!univer-bg-gray-700": !currentSelected && !color
|
|
@@ -22528,6 +22353,32 @@ const SCROLL_SHADOW_NONE = "";
|
|
|
22528
22353
|
const SCROLL_SHADOW_LEFT = "inset 10px 0px 10px -10px rgba(0, 0, 0, 0.2)";
|
|
22529
22354
|
const SCROLL_SHADOW_RIGHT = "inset -10px 0px 10px -10px rgba(0, 0, 0, 0.2)";
|
|
22530
22355
|
const SCROLL_SHADOW_BOTH = "inset 10px 0px 10px -10px rgba(0, 0, 0, 0.2), inset -10px 0px 10px -10px rgba(0, 0, 0, 0.2)";
|
|
22356
|
+
function EmbedSheetTabProductIcon({ childType }) {
|
|
22357
|
+
const className = "univer-size-4 univer-shrink-0";
|
|
22358
|
+
switch (childType) {
|
|
22359
|
+
case UniverInstanceType.UNIVER_SHEET: return /* @__PURE__ */ jsx(SheetsMultiIcon, {
|
|
22360
|
+
"aria-hidden": true,
|
|
22361
|
+
className
|
|
22362
|
+
});
|
|
22363
|
+
case UniverInstanceType.UNIVER_DOC: return /* @__PURE__ */ jsx(DocsMultiIcon, {
|
|
22364
|
+
"aria-hidden": true,
|
|
22365
|
+
className
|
|
22366
|
+
});
|
|
22367
|
+
case UniverInstanceType.UNIVER_SLIDE: return /* @__PURE__ */ jsx(SlidesMultiIcon, {
|
|
22368
|
+
"aria-hidden": true,
|
|
22369
|
+
className
|
|
22370
|
+
});
|
|
22371
|
+
case UniverInstanceType.UNIVER_BASE: return /* @__PURE__ */ jsx(BasesMultiIcon, {
|
|
22372
|
+
"aria-hidden": true,
|
|
22373
|
+
className
|
|
22374
|
+
});
|
|
22375
|
+
case UniverInstanceType.UNIVER_BOARD: return /* @__PURE__ */ jsx(BoardsMultiIcon, {
|
|
22376
|
+
"aria-hidden": true,
|
|
22377
|
+
className
|
|
22378
|
+
});
|
|
22379
|
+
default: return null;
|
|
22380
|
+
}
|
|
22381
|
+
}
|
|
22531
22382
|
function getScrollShadow(state) {
|
|
22532
22383
|
const { leftEnd, rightEnd } = state;
|
|
22533
22384
|
if (leftEnd && rightEnd) return SCROLL_SHADOW_NONE;
|
|
@@ -22548,6 +22399,7 @@ function shouldRefreshSheetTabs(commandInfo) {
|
|
|
22548
22399
|
}
|
|
22549
22400
|
}
|
|
22550
22401
|
function SheetBarTabs() {
|
|
22402
|
+
const injector = useDependency(Injector);
|
|
22551
22403
|
const [sheetList, setSheetList] = useState([]);
|
|
22552
22404
|
const [activeSheetId, setActiveSheetId] = useState("");
|
|
22553
22405
|
const [scrollShadow, setScrollShadow] = useState("");
|
|
@@ -22669,19 +22521,28 @@ function SheetBarTabs() {
|
|
|
22669
22521
|
const updateSheetItems = useCallback(() => {
|
|
22670
22522
|
const activeSheet = workbook.getActiveSheet();
|
|
22671
22523
|
const currentSubUnitId = (activeSheet === null || activeSheet === void 0 ? void 0 : activeSheet.getSheetId()) ?? "";
|
|
22524
|
+
const embedRuntimeService = injector.has(ISheetEmbedRuntimeService) ? injector.get(ISheetEmbedRuntimeService) : void 0;
|
|
22672
22525
|
const sheetListItems = workbook.getSheets().filter((sheet) => !sheet.isSheetHidden()).map((sheet, index) => {
|
|
22526
|
+
var _embedRuntimeService$;
|
|
22673
22527
|
const worksheetRule = worksheetProtectionRuleModel.getRule(workbook.getUnitId(), sheet.getSheetId());
|
|
22674
22528
|
const hasSelectionRule = rangeProtectionRuleModel.getSubunitRuleList(workbook.getUnitId(), sheet.getSheetId()).length > 0;
|
|
22675
22529
|
const hasProtection = Boolean((worksheetRule === null || worksheetRule === void 0 ? void 0 : worksheetRule.permissionId) || hasSelectionRule);
|
|
22530
|
+
const embedData = getEmbedSheetsTabCustomData(sheet.getConfig());
|
|
22531
|
+
const embedChildType = (embedData === null || embedData === void 0 ? void 0 : embedData.childType) ?? (embedData ? embedRuntimeService === null || embedRuntimeService === void 0 || (_embedRuntimeService$ = embedRuntimeService.getSheetTabChildType) === null || _embedRuntimeService$ === void 0 ? void 0 : _embedRuntimeService$.call(embedRuntimeService, {
|
|
22532
|
+
hostUnitId: workbook.getUnitId(),
|
|
22533
|
+
hostAnchorId: embedData.hostAnchorId,
|
|
22534
|
+
embedId: embedData.embedId
|
|
22535
|
+
}) : void 0);
|
|
22676
22536
|
return {
|
|
22677
22537
|
sheetId: sheet.getSheetId(),
|
|
22678
|
-
label:
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22538
|
+
label: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22539
|
+
embedChildType != null && /* @__PURE__ */ jsx(EmbedSheetTabProductIcon, { childType: embedChildType }),
|
|
22540
|
+
hasProtection && /* @__PURE__ */ jsx(LockIcon, { className: "univer-shrink-0" }),
|
|
22541
|
+
/* @__PURE__ */ jsx("span", {
|
|
22542
|
+
className: "univer-truncate univer-outline-none",
|
|
22543
|
+
children: sheet.getName()
|
|
22544
|
+
})
|
|
22545
|
+
] }),
|
|
22685
22546
|
index,
|
|
22686
22547
|
selected: activeSheet === sheet,
|
|
22687
22548
|
color: sheet.getTabColor() ?? void 0
|
|
@@ -22690,6 +22551,7 @@ function SheetBarTabs() {
|
|
|
22690
22551
|
setSheetList(sheetListItems);
|
|
22691
22552
|
setActiveSheetId(currentSubUnitId);
|
|
22692
22553
|
}, [
|
|
22554
|
+
injector,
|
|
22693
22555
|
rangeProtectionRuleModel,
|
|
22694
22556
|
workbook,
|
|
22695
22557
|
worksheetProtectionRuleModel
|
|
@@ -23157,120 +23019,98 @@ const functionDisplayNames = {
|
|
|
23157
23019
|
[FUNCTION_NAMES_STATISTICAL.COUNTA]: "sheets-ui.statusbar.countA",
|
|
23158
23020
|
[FUNCTION_NAMES_TEXT.CONCATENATE]: "concatenate"
|
|
23159
23021
|
};
|
|
23160
|
-
const CopyableStatisticItem = (item) => {
|
|
23161
|
-
const localeService = useDependency(LocaleService);
|
|
23162
|
-
const messageService = useDependency(IMessageService);
|
|
23163
|
-
const clipboardService = useDependency(IClipboardInterfaceService);
|
|
23164
|
-
const formateValue = formatNumber(item);
|
|
23165
|
-
const copyToClipboard = async () => {
|
|
23166
|
-
await clipboardService.writeText(item.value.toString());
|
|
23167
|
-
messageService.show({
|
|
23168
|
-
type: MessageType.Success,
|
|
23169
|
-
content: localeService.t("sheets-ui.statusbar.copied")
|
|
23170
|
-
});
|
|
23171
|
-
};
|
|
23172
|
-
return /* @__PURE__ */ jsx(Tooltip, {
|
|
23173
|
-
title: localeService.t("sheets-ui.statusbar.clickToCopy"),
|
|
23174
|
-
placement: "top",
|
|
23175
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
23176
|
-
className: "univer-flex univer-cursor-pointer univer-truncate univer-text-center univer-text-xs univer-text-gray-400",
|
|
23177
|
-
onClick: copyToClipboard,
|
|
23178
|
-
children: /* @__PURE__ */ jsx("span", { children: `${localeService.t((functionDisplayNames === null || functionDisplayNames === void 0 ? void 0 : functionDisplayNames[item.name]) || item.name)}: ${formateValue}` })
|
|
23179
|
-
}, item.name)
|
|
23180
|
-
});
|
|
23181
|
-
};
|
|
23182
23022
|
function formatNumber(item) {
|
|
23183
23023
|
const { pattern, value: num } = item;
|
|
23184
23024
|
if (typeof num !== "number") return 0;
|
|
23185
|
-
if (num >= 1e8) return num.toExponential(2);
|
|
23186
23025
|
if (pattern && allowPatternFunctions.includes(item.name)) return numfmt.format(pattern, num, { throws: false });
|
|
23187
23026
|
return num.toLocaleString();
|
|
23188
23027
|
}
|
|
23189
23028
|
|
|
23190
23029
|
//#endregion
|
|
23191
23030
|
//#region src/views/status-bar/StatusBar.tsx
|
|
23192
|
-
const SINGLE_MODE_WIDTH = 800;
|
|
23193
|
-
const ROW_COUNT_THRESHOLD = 3;
|
|
23194
23031
|
const StatusBar = () => {
|
|
23195
|
-
const
|
|
23032
|
+
const localeService = useDependency(LocaleService);
|
|
23196
23033
|
const statusBarService = useDependency(IStatusBarService);
|
|
23197
|
-
const
|
|
23034
|
+
const [selectedFunction, setSelectedFunction] = useState(FUNCTION_NAMES_MATH.SUM);
|
|
23035
|
+
const [open, setOpen] = useState(false);
|
|
23036
|
+
const [statistics, setStatistics] = useState(() => statusBarService.getFunctions().map((item) => ({
|
|
23198
23037
|
name: item.func,
|
|
23199
23038
|
value: 0,
|
|
23200
23039
|
show: true,
|
|
23201
|
-
disable:
|
|
23040
|
+
disable: true,
|
|
23202
23041
|
pattern: null
|
|
23203
|
-
}));
|
|
23204
|
-
|
|
23205
|
-
const
|
|
23206
|
-
|
|
23207
|
-
|
|
23208
|
-
|
|
23209
|
-
const showList = useMemo(() => isSingle && firstItem ? [firstItem] : filteredStatistics, [
|
|
23210
|
-
isSingle,
|
|
23211
|
-
firstItem,
|
|
23212
|
-
filteredStatistics
|
|
23213
|
-
]);
|
|
23214
|
-
const updateStatistics = useCallback((state) => {
|
|
23215
|
-
const items = state === null || state === void 0 ? void 0 : state.values;
|
|
23216
|
-
if (!(items === null || items === void 0 ? void 0 : items.length)) {
|
|
23217
|
-
setShow(false);
|
|
23218
|
-
return;
|
|
23219
|
-
}
|
|
23220
|
-
setShow(true);
|
|
23221
|
-
setStatistics((prevStats) => prevStats.map((stat) => {
|
|
23222
|
-
var _items$find;
|
|
23042
|
+
})));
|
|
23043
|
+
useEffect(() => {
|
|
23044
|
+
const subscription = statusBarService.state$.subscribe((state) => {
|
|
23045
|
+
const values = (state === null || state === void 0 ? void 0 : state.values) ?? [];
|
|
23046
|
+
setStatistics((previousStatistics) => previousStatistics.map((statistic) => {
|
|
23047
|
+
const value = values.find((item) => item.func === statistic.name);
|
|
23223
23048
|
return {
|
|
23224
|
-
...
|
|
23225
|
-
value: (
|
|
23226
|
-
disable: !
|
|
23049
|
+
...statistic,
|
|
23050
|
+
value: (value === null || value === void 0 ? void 0 : value.value) ?? statistic.value,
|
|
23051
|
+
disable: !value,
|
|
23227
23052
|
pattern: (state === null || state === void 0 ? void 0 : state.pattern) ?? null
|
|
23228
23053
|
};
|
|
23229
23054
|
}));
|
|
23230
|
-
}
|
|
23231
|
-
|
|
23232
|
-
|
|
23233
|
-
|
|
23234
|
-
|
|
23235
|
-
|
|
23236
|
-
|
|
23237
|
-
|
|
23238
|
-
|
|
23239
|
-
};
|
|
23055
|
+
});
|
|
23056
|
+
return () => subscription.unsubscribe();
|
|
23057
|
+
}, [statusBarService]);
|
|
23058
|
+
const availableStatistics = statistics.filter((item) => item.show && !item.disable);
|
|
23059
|
+
const selectedStatistic = availableStatistics.find((item) => item.name === selectedFunction) ?? availableStatistics.find((item) => item.name === FUNCTION_NAMES_MATH.SUM) ?? availableStatistics[0];
|
|
23060
|
+
if (!selectedStatistic) return null;
|
|
23061
|
+
const formatStatistic = (item) => {
|
|
23062
|
+
const localeKey = functionDisplayNames[item.name] || item.name;
|
|
23063
|
+
return `${localeService.t(localeKey)}: ${formatNumber(item)}`;
|
|
23240
23064
|
};
|
|
23241
|
-
const
|
|
23242
|
-
|
|
23243
|
-
|
|
23244
|
-
if (isSingle !== newSingleState) setIsSingle(newSingleState);
|
|
23245
|
-
}, 100);
|
|
23246
|
-
useEffect(() => {
|
|
23247
|
-
window.addEventListener("resize", handleResize);
|
|
23248
|
-
return () => {
|
|
23249
|
-
window.removeEventListener("resize", handleResize);
|
|
23250
|
-
};
|
|
23251
|
-
}, [isSingle]);
|
|
23252
|
-
const getStatisticLayout = (showList, rowCountThreshold, CopyableStatisticItem) => {
|
|
23253
|
-
if (showList.length > rowCountThreshold) return showList.reduce((acc, _, index) => {
|
|
23254
|
-
if (index % 2 === 0) acc.push(showList.slice(index, index + 2));
|
|
23255
|
-
return acc;
|
|
23256
|
-
}, []).map((item, index) => /* @__PURE__ */ jsxs("div", {
|
|
23257
|
-
className: "univer-grid univer-h-full univer-items-center",
|
|
23258
|
-
children: [item[0] && /* @__PURE__ */ jsx(CopyableStatisticItem, { ...item[0] }, item[0].name), item[1] && /* @__PURE__ */ jsx(CopyableStatisticItem, { ...item[1] }, item[1].name)]
|
|
23259
|
-
}, `stat-col-${index}`));
|
|
23260
|
-
return showList.map((item) => /* @__PURE__ */ jsx("div", {
|
|
23261
|
-
className: "univer-grid univer-h-full univer-items-center",
|
|
23262
|
-
children: /* @__PURE__ */ jsx(CopyableStatisticItem, { ...item })
|
|
23263
|
-
}, item.name));
|
|
23065
|
+
const handleSelect = (name) => {
|
|
23066
|
+
setSelectedFunction(name);
|
|
23067
|
+
setOpen(false);
|
|
23264
23068
|
};
|
|
23265
|
-
|
|
23266
|
-
|
|
23267
|
-
|
|
23268
|
-
"
|
|
23269
|
-
"
|
|
23270
|
-
|
|
23271
|
-
|
|
23272
|
-
|
|
23273
|
-
|
|
23069
|
+
return /* @__PURE__ */ jsx("div", {
|
|
23070
|
+
className: "univer-relative univer-box-border univer-flex univer-h-full univer-min-w-0 univer-max-w-64 univer-items-center univer-overflow-hidden univer-px-2 after:univer-absolute after:univer-right-0 after:univer-top-1/2 after:univer-block after:univer-h-4 after:univer-w-px after:-univer-translate-y-1/2 after:univer-bg-gray-200 after:univer-content-[\"\"]",
|
|
23071
|
+
children: /* @__PURE__ */ jsx(Dropdown, {
|
|
23072
|
+
align: "end",
|
|
23073
|
+
side: "top",
|
|
23074
|
+
open,
|
|
23075
|
+
onOpenChange: setOpen,
|
|
23076
|
+
overlay: /* @__PURE__ */ jsx("div", {
|
|
23077
|
+
"data-u-comp": "status-bar-statistic-menu",
|
|
23078
|
+
className: "univer-grid univer-w-max univer-max-w-[calc(100vw-16px)] univer-gap-0.5 univer-p-1.5",
|
|
23079
|
+
children: availableStatistics.map((item) => {
|
|
23080
|
+
const text = formatStatistic(item);
|
|
23081
|
+
const selected = item.name === selectedStatistic.name;
|
|
23082
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
23083
|
+
type: "button",
|
|
23084
|
+
className: clsx("univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded univer-border-none univer-bg-transparent univer-px-2 univer-py-1.5 univer-text-left univer-text-xs univer-text-gray-900 hover:univer-bg-gray-100 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-800", { "univer-bg-gray-100 dark:!univer-bg-gray-800": selected }),
|
|
23085
|
+
"aria-pressed": selected,
|
|
23086
|
+
onClick: () => handleSelect(item.name),
|
|
23087
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
23088
|
+
className: "univer-w-3 univer-shrink-0",
|
|
23089
|
+
children: selected && /* @__PURE__ */ jsx(CheckMarkIcon, {})
|
|
23090
|
+
}), /* @__PURE__ */ jsx(Tooltip, {
|
|
23091
|
+
title: text,
|
|
23092
|
+
placement: "top",
|
|
23093
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
23094
|
+
className: "univer-min-w-0 univer-flex-1 univer-truncate",
|
|
23095
|
+
children: text
|
|
23096
|
+
})
|
|
23097
|
+
})]
|
|
23098
|
+
}, item.name);
|
|
23099
|
+
})
|
|
23100
|
+
}),
|
|
23101
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
23102
|
+
type: "button",
|
|
23103
|
+
"data-u-comp": "status-bar-statistic-picker",
|
|
23104
|
+
className: "univer-flex univer-min-w-0 univer-max-w-full univer-cursor-pointer univer-items-center univer-gap-1 univer-border-none univer-bg-transparent univer-p-0 univer-text-xs univer-text-gray-400",
|
|
23105
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
23106
|
+
title: formatStatistic(selectedStatistic),
|
|
23107
|
+
placement: "top",
|
|
23108
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
23109
|
+
className: "univer-min-w-0 univer-flex-1 univer-truncate",
|
|
23110
|
+
children: formatStatistic(selectedStatistic)
|
|
23111
|
+
})
|
|
23112
|
+
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-shrink-0" })]
|
|
23113
|
+
})
|
|
23274
23114
|
})
|
|
23275
23115
|
});
|
|
23276
23116
|
};
|
|
@@ -23282,9 +23122,7 @@ function RenderSheetFooter() {
|
|
|
23282
23122
|
const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23283
23123
|
const menuManagerService = useDependency(IMenuManagerService);
|
|
23284
23124
|
const showFooter = (config === null || config === void 0 ? void 0 : config.footer) ?? true;
|
|
23285
|
-
const
|
|
23286
|
-
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23287
|
-
const isLoading = useSheetLoading();
|
|
23125
|
+
const workbook = useRootWorkbenchWorkbook();
|
|
23288
23126
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23289
23127
|
const focusedUnitType = useFocusedUnitType();
|
|
23290
23128
|
const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
|
|
@@ -23297,33 +23135,27 @@ function RenderSheetFooter() {
|
|
|
23297
23135
|
const showMenus = activeEmbedTab ? false : menus;
|
|
23298
23136
|
const showZoomSlider = activeEmbedTab ? false : zoomSlider;
|
|
23299
23137
|
if (!sheetBar && !showStatisticBar && !showMenus && !showZoomSlider) return null;
|
|
23300
|
-
return /* @__PURE__ */
|
|
23301
|
-
|
|
23302
|
-
|
|
23303
|
-
|
|
23304
|
-
|
|
23305
|
-
|
|
23306
|
-
|
|
23307
|
-
|
|
23308
|
-
|
|
23309
|
-
|
|
23310
|
-
|
|
23311
|
-
|
|
23312
|
-
|
|
23313
|
-
|
|
23314
|
-
|
|
23315
|
-
|
|
23316
|
-
}),
|
|
23317
|
-
showZoomSlider && /* @__PURE__ */ jsx(SheetZoomSlider, {})
|
|
23318
|
-
]
|
|
23319
|
-
})
|
|
23138
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
23139
|
+
className: "univer-box-border univer-grid univer-w-full univer-grid-flow-col univer-grid-cols-[1fr,auto,auto,auto] univer-items-center univer-justify-between univer-bg-gray-0 univer-px-5 univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-gray-200",
|
|
23140
|
+
"data-range-selector": true,
|
|
23141
|
+
style: { height: 36 },
|
|
23142
|
+
children: [
|
|
23143
|
+
sheetBar && /* @__PURE__ */ jsx(SheetBar, {}),
|
|
23144
|
+
showStatisticBar && /* @__PURE__ */ jsx(StatusBar, {}),
|
|
23145
|
+
showMenus && footerMenus.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
23146
|
+
className: "univer-box-border univer-flex univer-gap-2 univer-px-2",
|
|
23147
|
+
children: footerMenus.map((item) => {
|
|
23148
|
+
var _item$children;
|
|
23149
|
+
return (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.map((child) => (child === null || child === void 0 ? void 0 : child.item) && /* @__PURE__ */ jsx(ToolbarItem, { ...child.item }, child.key));
|
|
23150
|
+
})
|
|
23151
|
+
}),
|
|
23152
|
+
showZoomSlider && /* @__PURE__ */ jsx(SheetZoomSlider, {})
|
|
23153
|
+
]
|
|
23320
23154
|
});
|
|
23321
23155
|
}
|
|
23322
23156
|
function RenderSheetHeader() {
|
|
23323
23157
|
const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23324
|
-
const
|
|
23325
|
-
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23326
|
-
const isLoading = useSheetLoading();
|
|
23158
|
+
const workbook = useRootWorkbenchWorkbook();
|
|
23327
23159
|
const hasWorkbook = !!workbook;
|
|
23328
23160
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23329
23161
|
const focusedUnitType = useFocusedUnitType();
|
|
@@ -23333,17 +23165,10 @@ function RenderSheetHeader() {
|
|
|
23333
23165
|
if (activeEmbedTab) return null;
|
|
23334
23166
|
if (focusedUnitType != null && focusedUnitType !== UniverInstanceType.UNIVER_SHEET) return /* @__PURE__ */ jsx("div", {
|
|
23335
23167
|
"aria-hidden": true,
|
|
23336
|
-
className: "univer-h-7 univer-border-b univer-border-gray-200 univer-bg-
|
|
23168
|
+
className: "univer-h-7 univer-border-b univer-border-gray-200 univer-bg-gray-0 dark:!univer-border-gray-700 dark:!univer-bg-gray-900",
|
|
23337
23169
|
"data-u-comp": "formula-bar-placeholder"
|
|
23338
23170
|
});
|
|
23339
|
-
if ((config === null || config === void 0 ? void 0 : config.formulaBar) !== false) return /* @__PURE__ */ jsx(
|
|
23340
|
-
value: workbook,
|
|
23341
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
23342
|
-
"aria-disabled": isLoading,
|
|
23343
|
-
className: clsx({ "univer-pointer-events-none": isLoading }),
|
|
23344
|
-
children: /* @__PURE__ */ jsx(FormulaBar, {})
|
|
23345
|
-
})
|
|
23346
|
-
});
|
|
23171
|
+
if ((config === null || config === void 0 ? void 0 : config.formulaBar) !== false) return /* @__PURE__ */ jsx(FormulaBar, {});
|
|
23347
23172
|
return null;
|
|
23348
23173
|
}
|
|
23349
23174
|
/**
|
|
@@ -23351,18 +23176,17 @@ function RenderSheetHeader() {
|
|
|
23351
23176
|
*/
|
|
23352
23177
|
function RenderSheetContent() {
|
|
23353
23178
|
const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
|
|
23354
|
-
const isLoading = useSheetLoading();
|
|
23355
|
-
const isPreviewReady = useSheetLoadingPreviewReady();
|
|
23356
23179
|
const componentManager = useDependency(ComponentManager);
|
|
23357
|
-
const
|
|
23358
|
-
const workbook = useSheetLoadingWorkbook() ?? activeWorkbook;
|
|
23180
|
+
const workbook = useRootWorkbenchWorkbook();
|
|
23359
23181
|
const activeEmbedTab = useActiveSheetEmbedTabData(workbook);
|
|
23360
23182
|
const injector = useDependency(Injector);
|
|
23361
23183
|
const activeWorkbookEmbeddedRender = useActiveWorkbookIsEmbeddedRender(workbook);
|
|
23184
|
+
const focusedUnitType = useFocusedUnitType();
|
|
23185
|
+
const rootWorkbenchOwnsSheet = activeEmbedTab != null || focusedUnitType == null || focusedUnitType === UniverInstanceType.UNIVER_SHEET;
|
|
23362
23186
|
const ShapeTextEditorContainer = componentManager.get("SheetShapeTextEditorContainer") ?? componentManager.get("ShapeTextEditorContainer");
|
|
23363
23187
|
useEffect(() => {
|
|
23364
23188
|
var _tryGetSheetEmbedRunt;
|
|
23365
|
-
if (!workbook ||
|
|
23189
|
+
if (!workbook || activeEmbedTab || activeWorkbookEmbeddedRender || !rootWorkbenchOwnsSheet) return;
|
|
23366
23190
|
const instanceService = injector.get(IUniverInstanceService);
|
|
23367
23191
|
instanceService.setCurrentUnitForType(workbook.getUnitId());
|
|
23368
23192
|
instanceService.focusUnit(workbook.getUnitId());
|
|
@@ -23371,11 +23195,11 @@ function RenderSheetContent() {
|
|
|
23371
23195
|
activeEmbedTab,
|
|
23372
23196
|
activeWorkbookEmbeddedRender,
|
|
23373
23197
|
injector,
|
|
23374
|
-
|
|
23198
|
+
rootWorkbenchOwnsSheet,
|
|
23375
23199
|
workbook
|
|
23376
23200
|
]);
|
|
23377
23201
|
if (!workbook) return null;
|
|
23378
|
-
if (
|
|
23202
|
+
if (!rootWorkbenchOwnsSheet) return null;
|
|
23379
23203
|
if (activeWorkbookEmbeddedRender) return null;
|
|
23380
23204
|
if (activeEmbedTab && workbook) return /* @__PURE__ */ jsx(RenderSheetEmbedTabHost, {
|
|
23381
23205
|
workbook,
|
|
@@ -23387,42 +23211,6 @@ function RenderSheetContent() {
|
|
|
23387
23211
|
/* @__PURE__ */ jsx(AutoFillPopupMenu, {})
|
|
23388
23212
|
] });
|
|
23389
23213
|
}
|
|
23390
|
-
function SheetLoadingSkeleton() {
|
|
23391
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
23392
|
-
"data-u-comp": "sheet-loading-skeleton",
|
|
23393
|
-
"aria-busy": true,
|
|
23394
|
-
className: "univer-absolute univer-inset-0 univer-z-10 univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-900",
|
|
23395
|
-
children: [
|
|
23396
|
-
/* @__PURE__ */ jsx("div", {
|
|
23397
|
-
className: "univer-absolute univer-right-0 univer-top-0 univer-border-b univer-border-gray-200 univer-bg-gray-50 dark:!univer-border-gray-700 dark:!univer-bg-gray-800",
|
|
23398
|
-
style: {
|
|
23399
|
-
left: DEFAULT_WORKSHEET_ROW_TITLE_WIDTH,
|
|
23400
|
-
height: DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT
|
|
23401
|
-
}
|
|
23402
|
-
}),
|
|
23403
|
-
/* @__PURE__ */ jsx("div", {
|
|
23404
|
-
className: "univer-absolute univer-bottom-0 univer-left-0 univer-border-r univer-border-gray-200 univer-bg-gray-50 dark:!univer-border-gray-700 dark:!univer-bg-gray-800",
|
|
23405
|
-
style: {
|
|
23406
|
-
top: DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT,
|
|
23407
|
-
width: DEFAULT_WORKSHEET_ROW_TITLE_WIDTH
|
|
23408
|
-
}
|
|
23409
|
-
}),
|
|
23410
|
-
/* @__PURE__ */ jsx("div", {
|
|
23411
|
-
className: "univer-absolute univer-bottom-0 univer-right-0 univer-animate-pulse univer-text-gray-200 dark:!univer-text-gray-700",
|
|
23412
|
-
style: {
|
|
23413
|
-
top: DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT,
|
|
23414
|
-
left: DEFAULT_WORKSHEET_ROW_TITLE_WIDTH,
|
|
23415
|
-
backgroundImage: "linear-gradient(to right, currentColor 1px, transparent 1px), linear-gradient(to bottom, currentColor 1px, transparent 1px)",
|
|
23416
|
-
backgroundSize: `${DEFAULT_WORKSHEET_COLUMN_WIDTH}px ${DEFAULT_WORKSHEET_ROW_HEIGHT}px`
|
|
23417
|
-
}
|
|
23418
|
-
}),
|
|
23419
|
-
/* @__PURE__ */ jsx(LoadingMultiIcon, {
|
|
23420
|
-
"aria-hidden": true,
|
|
23421
|
-
className: "univer-absolute univer-left-1/2 univer-top-1/2 univer-size-6 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-animate-spin univer-text-violet-500"
|
|
23422
|
-
})
|
|
23423
|
-
]
|
|
23424
|
-
});
|
|
23425
|
-
}
|
|
23426
23214
|
function RenderSheetEmbedTabHost(props) {
|
|
23427
23215
|
const { workbook, worksheet } = props;
|
|
23428
23216
|
const injector = useDependency(Injector);
|
|
@@ -23454,16 +23242,42 @@ function RenderSheetEmbedTabHost(props) {
|
|
|
23454
23242
|
]);
|
|
23455
23243
|
return /* @__PURE__ */ jsx("div", {
|
|
23456
23244
|
"data-embed-sheets-sheet-tab-host": hostAnchorId,
|
|
23457
|
-
className: "univer-absolute univer-inset-0 univer-z-40 univer-bg-
|
|
23245
|
+
className: "univer-absolute univer-inset-0 univer-z-40 univer-bg-gray-0 dark:!univer-bg-gray-900"
|
|
23458
23246
|
});
|
|
23459
23247
|
}
|
|
23460
23248
|
function useActiveWorkbookIsEmbeddedRender(workbook) {
|
|
23461
23249
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
23250
|
+
const renderManagerService = useDependency(IRenderManagerService);
|
|
23251
|
+
const injector = useDependency(Injector);
|
|
23252
|
+
const runtimeFocusCoordinator = injector.has(ISheetEmbedRuntimeFocusCoordinator) ? injector.get(ISheetEmbedRuntimeFocusCoordinator) : void 0;
|
|
23462
23253
|
return useMemo(() => {
|
|
23463
|
-
var _univerInstanceServic;
|
|
23254
|
+
var _renderManagerService, _univerInstanceServic;
|
|
23464
23255
|
if (!workbook) return false;
|
|
23465
|
-
return ((_univerInstanceServic = univerInstanceService.getUnitCreateOptions(workbook.getUnitId())) === null || _univerInstanceServic === void 0 ? void 0 : _univerInstanceServic.embeddedRender) === true;
|
|
23466
|
-
}, [
|
|
23256
|
+
return (runtimeFocusCoordinator === null || runtimeFocusCoordinator === void 0 ? void 0 : runtimeFocusCoordinator.resolveRuntimeScopeByChildUnitId(workbook.getUnitId())) != null || ((_renderManagerService = renderManagerService.getRenderUnitById(workbook.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.isMainScene) === false || ((_univerInstanceServic = univerInstanceService.getUnitCreateOptions(workbook.getUnitId())) === null || _univerInstanceServic === void 0 ? void 0 : _univerInstanceServic.embeddedRender) === true;
|
|
23257
|
+
}, [
|
|
23258
|
+
useObservable(() => merge$1(renderManagerService.created$, renderManagerService.disposed$, (runtimeFocusCoordinator === null || runtimeFocusCoordinator === void 0 ? void 0 : runtimeFocusCoordinator.runtimeSessionChanged$) ?? EMPTY), null, false, [renderManagerService, runtimeFocusCoordinator]),
|
|
23259
|
+
renderManagerService,
|
|
23260
|
+
runtimeFocusCoordinator,
|
|
23261
|
+
univerInstanceService,
|
|
23262
|
+
workbook
|
|
23263
|
+
]);
|
|
23264
|
+
}
|
|
23265
|
+
function useRootWorkbenchWorkbook() {
|
|
23266
|
+
const activeWorkbook = useActiveWorkbook();
|
|
23267
|
+
const injector = useDependency(Injector);
|
|
23268
|
+
const instanceService = useDependency(IUniverInstanceService);
|
|
23269
|
+
const runtimeFocusCoordinator = injector.has(ISheetEmbedRuntimeFocusCoordinator) ? injector.get(ISheetEmbedRuntimeFocusCoordinator) : void 0;
|
|
23270
|
+
return useMemo(() => {
|
|
23271
|
+
if (!activeWorkbook || !runtimeFocusCoordinator) return activeWorkbook;
|
|
23272
|
+
const runtimeScope = runtimeFocusCoordinator.resolveRuntimeScopeByChildUnitId(activeWorkbook.getUnitId());
|
|
23273
|
+
if (!(runtimeScope === null || runtimeScope === void 0 ? void 0 : runtimeScope.hostUnitId)) return activeWorkbook;
|
|
23274
|
+
return instanceService.getUnit(runtimeScope.hostUnitId, UniverInstanceType.UNIVER_SHEET) ?? activeWorkbook;
|
|
23275
|
+
}, [
|
|
23276
|
+
activeWorkbook,
|
|
23277
|
+
instanceService,
|
|
23278
|
+
runtimeFocusCoordinator,
|
|
23279
|
+
useObservable(() => (runtimeFocusCoordinator === null || runtimeFocusCoordinator === void 0 ? void 0 : runtimeFocusCoordinator.runtimeSessionChanged$) ?? EMPTY, null, false, [runtimeFocusCoordinator])
|
|
23280
|
+
]);
|
|
23467
23281
|
}
|
|
23468
23282
|
function useFocusedUnitType() {
|
|
23469
23283
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
@@ -24098,7 +23912,7 @@ const useHighlightRange = (ranges = []) => {
|
|
|
24098
23912
|
//#endregion
|
|
24099
23913
|
//#region package.json
|
|
24100
23914
|
var name = "@univerjs/sheets-ui";
|
|
24101
|
-
var version = "1.0.0-beta.
|
|
23915
|
+
var version = "1.0.0-beta.1";
|
|
24102
23916
|
|
|
24103
23917
|
//#endregion
|
|
24104
23918
|
//#region src/views/cell-popup/config.ts
|
|
@@ -24268,6 +24082,8 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24268
24082
|
disposable.add(this._commandService.onCommandExecuted((commandInfo) => {
|
|
24269
24083
|
if (shouldUpdatePosition(commandInfo.id)) position$.next(calc());
|
|
24270
24084
|
}));
|
|
24085
|
+
const viewMain = currentRender.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
24086
|
+
if (viewMain) disposable.add(viewMain.onScrollAfter$.subscribeEvent(() => position$.next(calc())));
|
|
24271
24087
|
return {
|
|
24272
24088
|
position,
|
|
24273
24089
|
position$,
|
|
@@ -24314,6 +24130,9 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24314
24130
|
};
|
|
24315
24131
|
const { position, position$, disposable } = this._createPositionObserver(bound, currentRender, skeleton, worksheet);
|
|
24316
24132
|
const popupInjector = this._resolveEmbeddedPopupInjector(unitId, currentRender);
|
|
24133
|
+
const canvasElement = currentRender.engine.getCanvasElement();
|
|
24134
|
+
const scaleAdjust = canvasElement.getBoundingClientRect().width / pxToNum(canvasElement.style.width);
|
|
24135
|
+
const { scaleX, scaleY } = currentRender.scene.getAncestorScale();
|
|
24317
24136
|
const id = this._globalPopupManagerService.addPopup({
|
|
24318
24137
|
...popup,
|
|
24319
24138
|
unitId,
|
|
@@ -24321,7 +24140,11 @@ let SheetCanvasPopManagerService = class SheetCanvasPopManagerService extends Di
|
|
|
24321
24140
|
connectorInjector: popupInjector,
|
|
24322
24141
|
anchorRect: position,
|
|
24323
24142
|
anchorRect$: position$,
|
|
24324
|
-
canvasElement
|
|
24143
|
+
canvasElement,
|
|
24144
|
+
boundaryInsets: popup.constrainToCanvas ? {
|
|
24145
|
+
left: skeleton.rowHeaderWidth * scaleAdjust * scaleX,
|
|
24146
|
+
top: skeleton.columnHeaderHeight * scaleAdjust * scaleY
|
|
24147
|
+
} : popup.boundaryInsets
|
|
24325
24148
|
});
|
|
24326
24149
|
const disposableCollection = new DisposableCollection();
|
|
24327
24150
|
disposableCollection.add(disposable);
|
|
@@ -24734,6 +24557,11 @@ function shouldUpdatePosition(commandId) {
|
|
|
24734
24557
|
|
|
24735
24558
|
//#endregion
|
|
24736
24559
|
//#region src/services/cell-popup-manager.service.ts
|
|
24560
|
+
const CELL_POPUP_DIRECTIONS = [
|
|
24561
|
+
"horizontal",
|
|
24562
|
+
"vertical",
|
|
24563
|
+
"left-center"
|
|
24564
|
+
];
|
|
24737
24565
|
let CellPopupManagerService = class CellPopupManagerService extends Disposable {
|
|
24738
24566
|
constructor(_sheetCanvasPopManagerService) {
|
|
24739
24567
|
super();
|
|
@@ -24789,7 +24617,7 @@ let CellPopupManagerService = class CellPopupManagerService extends Disposable {
|
|
|
24789
24617
|
direction
|
|
24790
24618
|
},
|
|
24791
24619
|
noPushMinimumGap: true,
|
|
24792
|
-
autoRelayout: false,
|
|
24620
|
+
autoRelayout: popup.autoRelayout ?? false,
|
|
24793
24621
|
zIndex: 90
|
|
24794
24622
|
}, unitId, subUnitId);
|
|
24795
24623
|
subUnitMap.setValue(row, col, {
|
|
@@ -24817,31 +24645,21 @@ let CellPopupManagerService = class CellPopupManagerService extends Disposable {
|
|
|
24817
24645
|
const subUnitMap = this._ensureCellPopupMap(unitId, subUnitId);
|
|
24818
24646
|
const cache = subUnitMap.getValue(row, col);
|
|
24819
24647
|
if (!cache) return;
|
|
24820
|
-
|
|
24821
|
-
var
|
|
24822
|
-
|
|
24823
|
-
|
|
24824
|
-
|
|
24825
|
-
|
|
24826
|
-
subUnitId,
|
|
24827
|
-
row,
|
|
24828
|
-
col,
|
|
24829
|
-
direction: "horizontal"
|
|
24830
|
-
});
|
|
24831
|
-
}
|
|
24832
|
-
if (cache.vertical) {
|
|
24833
|
-
var _cache$vertical$dispo;
|
|
24834
|
-
(_cache$vertical$dispo = cache.vertical.disposable) === null || _cache$vertical$dispo === void 0 || _cache$vertical$dispo.dispose();
|
|
24835
|
-
cache.vertical = void 0;
|
|
24648
|
+
CELL_POPUP_DIRECTIONS.forEach((direction) => {
|
|
24649
|
+
var _directionCache$dispo2;
|
|
24650
|
+
const directionCache = cache[direction];
|
|
24651
|
+
if (!directionCache) return;
|
|
24652
|
+
(_directionCache$dispo2 = directionCache.disposable) === null || _directionCache$dispo2 === void 0 || _directionCache$dispo2.dispose();
|
|
24653
|
+
cache[direction] = void 0;
|
|
24836
24654
|
this._change$.next({
|
|
24837
24655
|
unitId,
|
|
24838
24656
|
subUnitId,
|
|
24839
24657
|
row,
|
|
24840
24658
|
col,
|
|
24841
|
-
direction
|
|
24659
|
+
direction
|
|
24842
24660
|
});
|
|
24843
|
-
}
|
|
24844
|
-
if (
|
|
24661
|
+
});
|
|
24662
|
+
if (CELL_POPUP_DIRECTIONS.every((direction) => !cache[direction])) subUnitMap.realDeleteValue(row, col);
|
|
24845
24663
|
}
|
|
24846
24664
|
hidePopupsForUnit(unitId, subUnitId) {
|
|
24847
24665
|
const unitMap = this._cellPopupMap.get(unitId);
|
|
@@ -25560,12 +25378,12 @@ function BorderPanel(props) {
|
|
|
25560
25378
|
})
|
|
25561
25379
|
}),
|
|
25562
25380
|
children: /* @__PURE__ */ jsxs("button", {
|
|
25563
|
-
className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded univer-border-none univer-bg-transparent univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
25381
|
+
className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded univer-border-none univer-bg-transparent univer-p-1 univer-text-gray-900 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
25564
25382
|
type: "button",
|
|
25565
25383
|
children: [/* @__PURE__ */ jsx(PaintBucketDoubleIcon, {
|
|
25566
|
-
className: "univer-fill-primary-600 dark:!univer-text-
|
|
25384
|
+
className: "univer-fill-primary-600 dark:!univer-text-gray-0",
|
|
25567
25385
|
extend: { colorChannel1: (value === null || value === void 0 ? void 0 : value.color) ?? "" }
|
|
25568
|
-
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-
|
|
25386
|
+
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-gray-0" })]
|
|
25569
25387
|
})
|
|
25570
25388
|
}) }), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Dropdown, {
|
|
25571
25389
|
overlay: /* @__PURE__ */ jsx("section", {
|
|
@@ -25576,19 +25394,19 @@ function BorderPanel(props) {
|
|
|
25576
25394
|
className: "univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-px-1 univer-py-3 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
25577
25395
|
onClick: () => handleClick(item.value, "style"),
|
|
25578
25396
|
children: [item.value === type && /* @__PURE__ */ jsx(CheckMarkIcon, { className: "univer-absolute univer-left-3 univer-text-primary-600" }), /* @__PURE__ */ jsx(BorderLine, {
|
|
25579
|
-
className: "univer-ml-6 univer-fill-gray-900 dark:!univer-fill-
|
|
25397
|
+
className: "univer-ml-6 univer-fill-gray-900 dark:!univer-fill-gray-0",
|
|
25580
25398
|
type: item.value
|
|
25581
25399
|
})]
|
|
25582
25400
|
}, item.value))
|
|
25583
25401
|
})
|
|
25584
25402
|
}),
|
|
25585
25403
|
children: /* @__PURE__ */ jsxs("button", {
|
|
25586
|
-
className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded univer-border-none univer-bg-transparent univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
25404
|
+
className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-2 univer-rounded univer-border-none univer-bg-transparent univer-p-1 univer-text-gray-900 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",
|
|
25587
25405
|
type: "button",
|
|
25588
25406
|
children: [/* @__PURE__ */ jsx(BorderLine, {
|
|
25589
|
-
className: "univer-fill-gray-900 dark:!univer-fill-
|
|
25407
|
+
className: "univer-fill-gray-900 dark:!univer-fill-gray-0",
|
|
25590
25408
|
type: type ?? BorderStyleTypes.THIN
|
|
25591
|
-
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-
|
|
25409
|
+
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "dark:!univer-text-gray-0" })]
|
|
25592
25410
|
})
|
|
25593
25411
|
}) })]
|
|
25594
25412
|
})
|
|
@@ -25620,6 +25438,7 @@ let CellAlertManagerService = class CellAlertManagerService extends Disposable {
|
|
|
25620
25438
|
});
|
|
25621
25439
|
}
|
|
25622
25440
|
showAlert(alert) {
|
|
25441
|
+
var _alert$menu, _alert$menu2, _alert$menu3;
|
|
25623
25442
|
let lastPopup = this._currentAlert.get(alert.key);
|
|
25624
25443
|
if (lastPopup) lastPopup.dispose.dispose();
|
|
25625
25444
|
if (lastPopup) lastPopup.dispose.dispose();
|
|
@@ -25640,7 +25459,9 @@ let CellAlertManagerService = class CellAlertManagerService extends Disposable {
|
|
|
25640
25459
|
col
|
|
25641
25460
|
}, {
|
|
25642
25461
|
componentKey: CELL_ALERT_KEY,
|
|
25643
|
-
direction: "horizontal",
|
|
25462
|
+
direction: ((_alert$menu = alert.menu) === null || _alert$menu === void 0 ? void 0 : _alert$menu.length) ? "left-center" : "horizontal",
|
|
25463
|
+
autoRelayout: Boolean((_alert$menu2 = alert.menu) === null || _alert$menu2 === void 0 ? void 0 : _alert$menu2.length),
|
|
25464
|
+
showOnSelectionMoving: Boolean((_alert$menu3 = alert.menu) === null || _alert$menu3 === void 0 ? void 0 : _alert$menu3.length),
|
|
25644
25465
|
extraProps: { alert },
|
|
25645
25466
|
priority: 1
|
|
25646
25467
|
});
|
|
@@ -25680,18 +25501,53 @@ CellAlertManagerService = __decorate([__decorateParam(0, IRenderManagerService),
|
|
|
25680
25501
|
*/
|
|
25681
25502
|
function CellAlert({ popup }) {
|
|
25682
25503
|
var _popup$extraProps;
|
|
25504
|
+
const [visible, setVisible] = useState(false);
|
|
25505
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
25683
25506
|
const alert = (_popup$extraProps = popup.extraProps) === null || _popup$extraProps === void 0 ? void 0 : _popup$extraProps.alert;
|
|
25684
25507
|
if (!alert) return null;
|
|
25685
|
-
const { type, title, message } = alert;
|
|
25508
|
+
const { type, title, message, menu } = alert;
|
|
25509
|
+
if (menu === null || menu === void 0 ? void 0 : menu.length) {
|
|
25510
|
+
const accessibleLabel = [title, message].filter((value) => typeof value === "string").join(": ");
|
|
25511
|
+
const showMore = visible || isHovered;
|
|
25512
|
+
return /* @__PURE__ */ jsx("div", {
|
|
25513
|
+
onMouseEnter: () => setIsHovered(true),
|
|
25514
|
+
onMouseLeave: () => setIsHovered(false),
|
|
25515
|
+
children: /* @__PURE__ */ jsx(DropdownMenu, {
|
|
25516
|
+
align: "start",
|
|
25517
|
+
open: visible,
|
|
25518
|
+
onOpenChange: setVisible,
|
|
25519
|
+
items: [
|
|
25520
|
+
{
|
|
25521
|
+
type: "custom",
|
|
25522
|
+
className: "univer-px-2 univer-py-1.5 univer-font-medium univer-text-gray-900 dark:!univer-text-gray-0",
|
|
25523
|
+
children: message
|
|
25524
|
+
},
|
|
25525
|
+
{ type: "separator" },
|
|
25526
|
+
...menu.map((item) => ({
|
|
25527
|
+
type: "item",
|
|
25528
|
+
children: item.label,
|
|
25529
|
+
disabled: item.disabled,
|
|
25530
|
+
onSelect: item.onSelect
|
|
25531
|
+
}))
|
|
25532
|
+
],
|
|
25533
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
25534
|
+
type: "button",
|
|
25535
|
+
"aria-label": accessibleLabel || void 0,
|
|
25536
|
+
className: "univer-flex univer-items-center univer-gap-1 univer-rounded univer-border univer-border-solid univer-border-gray-200 univer-bg-gray-0 univer-p-1 univer-shadow hover:univer-bg-gray-100 dark:!univer-border-gray-600 dark:!univer-bg-gray-900 dark:hover:!univer-bg-gray-800",
|
|
25537
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, { className: "univer-text-yellow-500" }), showMore && /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-text-gray-600 dark:!univer-text-gray-300" })]
|
|
25538
|
+
})
|
|
25539
|
+
})
|
|
25540
|
+
});
|
|
25541
|
+
}
|
|
25686
25542
|
const iconMap = {
|
|
25687
|
-
[2]: /* @__PURE__ */ jsx(ErrorIcon, { className: "univer-
|
|
25688
|
-
[0]: /* @__PURE__ */ jsx(InfoIcon, { className: "univer-
|
|
25689
|
-
[1]: /* @__PURE__ */ jsx(WarningIcon, { className: "univer-
|
|
25543
|
+
[2]: /* @__PURE__ */ jsx(ErrorIcon, { className: "univer-text-red-500" }),
|
|
25544
|
+
[0]: /* @__PURE__ */ jsx(InfoIcon, { className: "univer-text-blue-500" }),
|
|
25545
|
+
[1]: /* @__PURE__ */ jsx(WarningIcon, { className: "univer-text-yellow-500" })
|
|
25690
25546
|
};
|
|
25691
25547
|
return /* @__PURE__ */ jsxs("div", {
|
|
25692
|
-
className: "univer-z-[100] univer-box-border univer-w-[156px] univer-rounded-lg univer-bg-
|
|
25548
|
+
className: "univer-z-[100] univer-box-border univer-w-[156px] univer-rounded-lg univer-bg-gray-0 univer-px-2 univer-py-1 univer-text-gray-900 univer-shadow dark:!univer-bg-gray-1000 dark:!univer-text-gray-0",
|
|
25693
25549
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
25694
|
-
className: "univer-mb-1.5 univer-flex univer-h-5 univer-flex-row univer-items-center univer-text-sm univer-font-medium",
|
|
25550
|
+
className: "univer-mb-1.5 univer-flex univer-h-5 univer-flex-row univer-items-center univer-gap-x-1.5 univer-text-sm univer-font-medium",
|
|
25695
25551
|
children: [type ? iconMap[type] : null, title]
|
|
25696
25552
|
}), /* @__PURE__ */ jsx("div", {
|
|
25697
25553
|
className: "univer-text-sm",
|
|
@@ -25721,7 +25577,10 @@ const CellPopup = (props) => {
|
|
|
25721
25577
|
const componentManager = useDependency(ComponentManager);
|
|
25722
25578
|
return /* @__PURE__ */ jsx("div", {
|
|
25723
25579
|
"data-u-comp": "sheets-ui-cell-popup",
|
|
25724
|
-
className:
|
|
25580
|
+
className: `
|
|
25581
|
+
${direction === "left-center" ? "univer-mr-px" : "univer-ml-px"}
|
|
25582
|
+
univer-flex univer-flex-col
|
|
25583
|
+
`,
|
|
25725
25584
|
children: popups.map((popup) => {
|
|
25726
25585
|
const Component = componentManager.get(popup.componentKey);
|
|
25727
25586
|
return Component ? /* @__PURE__ */ jsx(Component, { popup }, popup.id ?? popup.componentKey) : null;
|
|
@@ -25863,7 +25722,7 @@ function DefinedNameInputContent(props) {
|
|
|
25863
25722
|
className: "univer-relative univer-h-8 univer-select-none",
|
|
25864
25723
|
children: /* @__PURE__ */ jsx(FormulaEditor, {
|
|
25865
25724
|
ref: formulaEditorRef,
|
|
25866
|
-
className: clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-
|
|
25725
|
+
className: clsx("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-gray-0 univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0 [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", borderClassName),
|
|
25867
25726
|
initValue: formulaOrRefStringValue,
|
|
25868
25727
|
unitId,
|
|
25869
25728
|
subUnitId,
|
|
@@ -26099,7 +25958,7 @@ const DefinedNameContainer = () => {
|
|
|
26099
25958
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
26100
25959
|
title: definedName.comment,
|
|
26101
25960
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
26102
|
-
className: "univer-my-1 univer-max-h-[100px] univer-max-w-[190px] univer-truncate univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-
|
|
25961
|
+
className: "univer-my-1 univer-max-h-[100px] univer-max-w-[190px] univer-truncate univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-gray-0",
|
|
26103
25962
|
children: [definedName.name, /* @__PURE__ */ jsx("span", {
|
|
26104
25963
|
className: "univer-text-xxs univer-ml-1 univer-text-gray-400",
|
|
26105
25964
|
children: definedName.localSheetId === SCOPE_WORKBOOK_VALUE_DEFINED_NAME || definedName.localSheetId == null ? "" : getSheetNameBySheetId(definedName.localSheetId)
|
|
@@ -26206,7 +26065,7 @@ function DateDropdown(props) {
|
|
|
26206
26065
|
if (await (onChange === null || onChange === void 0 ? void 0 : onChange(date))) hideFn();
|
|
26207
26066
|
};
|
|
26208
26067
|
return /* @__PURE__ */ jsxs("div", {
|
|
26209
|
-
className: "univer-rounded univer-bg-
|
|
26068
|
+
className: "univer-rounded univer-bg-gray-0 univer-p-2 univer-shadow-lg dark:!univer-bg-gray-1000",
|
|
26210
26069
|
children: [patternType === "time" ? /* @__PURE__ */ jsx(TimeInput, {
|
|
26211
26070
|
value: date.toDate(),
|
|
26212
26071
|
onValueChange: (newValue) => {
|
|
@@ -26259,6 +26118,8 @@ function getListDropdownValue(value, multiple) {
|
|
|
26259
26118
|
function SelectList(props) {
|
|
26260
26119
|
const { value, onChange, multiple, options, onEdit, style, location, showEdit: showEditOnDropdown, showSearch: showSearchOnDropdown } = props;
|
|
26261
26120
|
const localeService = useDependency(LocaleService);
|
|
26121
|
+
const themeService = useDependency(ThemeService);
|
|
26122
|
+
useObservable(themeService.currentTheme$);
|
|
26262
26123
|
const { row, col, unitId, subUnitId } = location;
|
|
26263
26124
|
const searchRef = useRef(null);
|
|
26264
26125
|
useEffect(() => {
|
|
@@ -26297,14 +26158,14 @@ function SelectList(props) {
|
|
|
26297
26158
|
]);
|
|
26298
26159
|
return /* @__PURE__ */ jsxs("div", {
|
|
26299
26160
|
"data-u-comp": "sheets-dropdown-list",
|
|
26300
|
-
className: clsx("univer-box-border univer-rounded-lg univer-bg-
|
|
26161
|
+
className: clsx("univer-box-border univer-rounded-lg univer-bg-gray-0 univer-py-1 univer-text-gray-900 univer-shadow dark:!univer-bg-gray-1000 dark:!univer-text-gray-0", borderClassName),
|
|
26301
26162
|
style,
|
|
26302
26163
|
children: [
|
|
26303
26164
|
showSearchOnDropdown && /* @__PURE__ */ jsx("div", {
|
|
26304
26165
|
className: "univer-box-border univer-flex univer-w-full univer-px-2",
|
|
26305
26166
|
children: /* @__PURE__ */ jsx("input", {
|
|
26306
26167
|
ref: searchRef,
|
|
26307
|
-
className: clsx("univer-w-full univer-rounded-md univer-px-2 univer-py-1 univer-text-sm focus:univer-border-primary-500 focus:univer-outline-none dark:!univer-bg-
|
|
26168
|
+
className: clsx("univer-w-full univer-rounded-md univer-bg-gray-0 univer-px-2 univer-py-1 univer-text-sm univer-text-gray-900 focus:univer-border-primary-500 focus:univer-outline-none dark:!univer-bg-gray-1000 dark:!univer-text-gray-0", borderClassName),
|
|
26308
26169
|
type: "text",
|
|
26309
26170
|
value: lowerFilter,
|
|
26310
26171
|
autoFocus: true,
|
|
@@ -26318,6 +26179,7 @@ function SelectList(props) {
|
|
|
26318
26179
|
/* @__PURE__ */ jsx("div", {
|
|
26319
26180
|
className: clsx("univer-flex univer-max-h-52 univer-flex-col univer-gap-1 univer-overflow-y-auto univer-px-2 univer-py-1", scrollbarClassName),
|
|
26320
26181
|
children: filteredOptions.map((item, i) => {
|
|
26182
|
+
var _item$color;
|
|
26321
26183
|
const selected = value.indexOf(item.value) > -1;
|
|
26322
26184
|
const handleClick = () => {
|
|
26323
26185
|
let set;
|
|
@@ -26330,16 +26192,18 @@ function SelectList(props) {
|
|
|
26330
26192
|
onChange(newValue);
|
|
26331
26193
|
};
|
|
26332
26194
|
const index = item.label.toLocaleLowerCase().indexOf(lowerFilter);
|
|
26333
|
-
const
|
|
26195
|
+
const isThemeColor = Boolean(((_item$color = item.color) === null || _item$color === void 0 ? void 0 : _item$color.includes(".")) && themeService.isValidThemeColor(item.color));
|
|
26196
|
+
const backgroundColor = isThemeColor ? themeService.getColorFromTheme(item.color) : item.color;
|
|
26197
|
+
const isDark = new ColorKit(backgroundColor).isDark();
|
|
26334
26198
|
return /* @__PURE__ */ jsxs("div", {
|
|
26335
26199
|
className: "univer-flex univer-cursor-pointer univer-flex-row univer-items-center univer-justify-between univer-rounded-md univer-px-1.5 univer-py-1 hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-700",
|
|
26336
26200
|
onClick: handleClick,
|
|
26337
26201
|
children: [/* @__PURE__ */ jsx("div", {
|
|
26338
26202
|
className: clsx("univer-inline-flex univer-h-4 univer-w-fit univer-items-center univer-truncate univer-rounded-full univer-px-1.5 univer-text-xs", {
|
|
26339
|
-
"univer-text-gray-900": !isDark,
|
|
26340
|
-
"univer-text-
|
|
26203
|
+
"univer-text-gray-900": isThemeColor || !isDark,
|
|
26204
|
+
"univer-text-gray-0": !isThemeColor && isDark
|
|
26341
26205
|
}),
|
|
26342
|
-
style: { background:
|
|
26206
|
+
style: { background: backgroundColor },
|
|
26343
26207
|
children: lowerFilter && item.label.toLowerCase().includes(lowerFilter) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26344
26208
|
/* @__PURE__ */ jsx("span", { children: item.label.substring(0, index) }),
|
|
26345
26209
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -26409,7 +26273,7 @@ const Spin = ({ loading, children }) => {
|
|
|
26409
26273
|
return /* @__PURE__ */ jsxs("div", {
|
|
26410
26274
|
className: "univer-relative univer-size-full",
|
|
26411
26275
|
children: [loading && /* @__PURE__ */ jsx("div", {
|
|
26412
|
-
className: "univer-absolute -univer-bottom-0.5 -univer-left-0.5 -univer-right-0.5 -univer-top-0.5 univer-z-10 univer-flex univer-items-center univer-justify-center univer-bg-
|
|
26276
|
+
className: "univer-absolute -univer-bottom-0.5 -univer-left-0.5 -univer-right-0.5 -univer-top-0.5 univer-z-10 univer-flex univer-items-center univer-justify-center univer-bg-gray-0 univer-backdrop-blur dark:!univer-bg-gray-1000",
|
|
26413
26277
|
children: /* @__PURE__ */ jsx("div", { className: "univer-size-10 univer-animate-spin univer-rounded-full univer-border-4 univer-border-solid univer-border-gray-100 univer-border-t-primary-500" })
|
|
26414
26278
|
}), /* @__PURE__ */ jsx("div", {
|
|
26415
26279
|
className: loading ? "univer-pointer-events-none univer-blur-sm" : "",
|
|
@@ -27017,7 +26881,7 @@ const PermissionDetailUserPart = (props) => {
|
|
|
27017
26881
|
src: (_item$subject2 = item.subject) === null || _item$subject2 === void 0 ? void 0 : _item$subject2.avatar
|
|
27018
26882
|
}),
|
|
27019
26883
|
/* @__PURE__ */ jsx("span", {
|
|
27020
|
-
className: "univer-ml-1.5 univer-w-[130px] univer-truncate univer-text-gray-900 dark:!univer-text-
|
|
26884
|
+
className: "univer-ml-1.5 univer-w-[130px] univer-truncate univer-text-gray-900 dark:!univer-text-gray-0",
|
|
27021
26885
|
children: (_item$subject3 = item.subject) === null || _item$subject3 === void 0 ? void 0 : _item$subject3.name
|
|
27022
26886
|
}),
|
|
27023
26887
|
/* @__PURE__ */ jsx(Select, {
|
|
@@ -27384,11 +27248,11 @@ function SheetPermissionPanelListContent() {
|
|
|
27384
27248
|
}) })
|
|
27385
27249
|
}),
|
|
27386
27250
|
/* @__PURE__ */ jsx("span", {
|
|
27387
|
-
className: "univer-h-4 univer-flex-grow univer-text-xs univer-text-gray-900 dark:!univer-text-
|
|
27251
|
+
className: "univer-h-4 univer-flex-grow univer-text-xs univer-text-gray-900 dark:!univer-text-gray-0",
|
|
27388
27252
|
children: localeService.t("sheets-ui.permission.panel.created")
|
|
27389
27253
|
}),
|
|
27390
27254
|
/* @__PURE__ */ jsx("span", {
|
|
27391
|
-
className: "univer-h-4 univer-text-xs univer-text-gray-900 dark:!univer-text-
|
|
27255
|
+
className: "univer-h-4 univer-text-xs univer-text-gray-900 dark:!univer-text-gray-0",
|
|
27392
27256
|
children: editPermission ? `${localeService.t("sheets-ui.permission.panel.iCanEdit")}` : `${localeService.t("sheets-ui.permission.panel.iCanNotEdit")}`
|
|
27393
27257
|
})
|
|
27394
27258
|
]
|
|
@@ -27396,10 +27260,10 @@ function SheetPermissionPanelListContent() {
|
|
|
27396
27260
|
/* @__PURE__ */ jsxs("div", {
|
|
27397
27261
|
className: "univer-mt-2 univer-flex univer-items-center",
|
|
27398
27262
|
children: [/* @__PURE__ */ jsx("span", {
|
|
27399
|
-
className: "univer-h-4 univer-flex-grow univer-text-xs univer-text-gray-900 dark:!univer-text-
|
|
27263
|
+
className: "univer-h-4 univer-flex-grow univer-text-xs univer-text-gray-900 dark:!univer-text-gray-0",
|
|
27400
27264
|
children: localeService.t("sheets-ui.permission.panel.viewPermission")
|
|
27401
27265
|
}), /* @__PURE__ */ jsx("span", {
|
|
27402
|
-
className: "univer-h-4 univer-text-xs univer-text-gray-900 dark:!univer-text-
|
|
27266
|
+
className: "univer-h-4 univer-text-xs univer-text-gray-900 dark:!univer-text-gray-0",
|
|
27403
27267
|
children: viewPermission ? `${localeService.t("sheets-ui.permission.panel.iCanView")}` : `${localeService.t("sheets-ui.permission.panel.iCanNotView")}`
|
|
27404
27268
|
})]
|
|
27405
27269
|
}),
|
|
@@ -27841,7 +27705,7 @@ const formulaEditorStyle = {
|
|
|
27841
27705
|
}
|
|
27842
27706
|
};
|
|
27843
27707
|
let EditorDataSyncController = class EditorDataSyncController extends Disposable {
|
|
27844
|
-
constructor(_univerInstanceService, _renderManagerService, _editorBridgeService, _commandService, _rangeProtectionRuleModel, _worksheetProtectionRuleModel, _formulaEditorController, _formulaEditorManagerService, _contextService) {
|
|
27708
|
+
constructor(_univerInstanceService, _renderManagerService, _editorBridgeService, _commandService, _rangeProtectionRuleModel, _worksheetProtectionRuleModel, _formulaEditorController, _formulaEditorManagerService, _contextService, _themeService) {
|
|
27845
27709
|
super();
|
|
27846
27710
|
this._univerInstanceService = _univerInstanceService;
|
|
27847
27711
|
this._renderManagerService = _renderManagerService;
|
|
@@ -27852,12 +27716,14 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
27852
27716
|
this._formulaEditorController = _formulaEditorController;
|
|
27853
27717
|
this._formulaEditorManagerService = _formulaEditorManagerService;
|
|
27854
27718
|
this._contextService = _contextService;
|
|
27719
|
+
this._themeService = _themeService;
|
|
27855
27720
|
this._initialize();
|
|
27856
27721
|
}
|
|
27857
27722
|
_initialize() {
|
|
27858
27723
|
this._syncFormulaEditorContent();
|
|
27859
27724
|
this._commandExecutedListener();
|
|
27860
27725
|
this._syncFormulaRefRenderStyleOnFocusChange();
|
|
27726
|
+
this._syncFormulaBarTextColorOnThemeChange();
|
|
27861
27727
|
}
|
|
27862
27728
|
_getEditorViewModel(unitId) {
|
|
27863
27729
|
var _this$_renderManagerS;
|
|
@@ -27981,6 +27847,11 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
27981
27847
|
this._refreshRenderStyleConfig(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
27982
27848
|
}));
|
|
27983
27849
|
}
|
|
27850
|
+
_syncFormulaBarTextColorOnThemeChange() {
|
|
27851
|
+
this.disposeWithMe(this._themeService.currentTheme$.pipe(skip(1)).subscribe(() => {
|
|
27852
|
+
this._refreshRenderStyleConfig(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
|
|
27853
|
+
}));
|
|
27854
|
+
}
|
|
27984
27855
|
_refreshRenderStyleConfig(unitId) {
|
|
27985
27856
|
var _currentRender$mainCo3;
|
|
27986
27857
|
const currentRender = this._renderManagerService.getRenderUnitById(unitId);
|
|
@@ -27999,7 +27870,10 @@ let EditorDataSyncController = class EditorDataSyncController extends Disposable
|
|
|
27999
27870
|
const snapshot = documentDataModel.getSnapshot();
|
|
28000
27871
|
if (snapshot.id !== DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY && snapshot.id !== DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
|
|
28001
27872
|
const isFormulaBar = snapshot.id === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
|
|
28002
|
-
if (isFormulaBar) snapshot.documentStyle =
|
|
27873
|
+
if (isFormulaBar) snapshot.documentStyle = {
|
|
27874
|
+
...formulaEditorStyle,
|
|
27875
|
+
textStyle: { cl: { rgb: this._themeService.getColorFromTheme("gray.900") } }
|
|
27876
|
+
};
|
|
28003
27877
|
else snapshot.documentStyle ??= {};
|
|
28004
27878
|
let renderConfig = snapshot.documentStyle.renderConfig;
|
|
28005
27879
|
if (renderConfig == null) {
|
|
@@ -28036,84 +27910,97 @@ EditorDataSyncController = __decorate([
|
|
|
28036
27910
|
__decorateParam(5, Inject(WorksheetProtectionRuleModel)),
|
|
28037
27911
|
__decorateParam(6, Inject(FormulaEditorController)),
|
|
28038
27912
|
__decorateParam(7, IFormulaEditorManagerService),
|
|
28039
|
-
__decorateParam(8, IContextService)
|
|
27913
|
+
__decorateParam(8, IContextService),
|
|
27914
|
+
__decorateParam(9, Inject(ThemeService))
|
|
28040
27915
|
], EditorDataSyncController);
|
|
28041
27916
|
|
|
28042
27917
|
//#endregion
|
|
28043
27918
|
//#region src/controllers/force-string-alert-render.controller.ts
|
|
28044
27919
|
const ALERT_KEY = "SHEET_FORCE_STRING_ALERT";
|
|
28045
27920
|
let ForceStringAlertRenderController = class ForceStringAlertRenderController extends Disposable {
|
|
28046
|
-
constructor(_context,
|
|
27921
|
+
constructor(_context, _selectionManagerService, _cellAlertManagerService, _localeService, _configService, _commandService, _univerInstanceService) {
|
|
28047
27922
|
super();
|
|
28048
27923
|
this._context = _context;
|
|
28049
|
-
this.
|
|
27924
|
+
this._selectionManagerService = _selectionManagerService;
|
|
28050
27925
|
this._cellAlertManagerService = _cellAlertManagerService;
|
|
28051
27926
|
this._localeService = _localeService;
|
|
28052
27927
|
this._configService = _configService;
|
|
27928
|
+
this._commandService = _commandService;
|
|
27929
|
+
this._univerInstanceService = _univerInstanceService;
|
|
28053
27930
|
this._init();
|
|
28054
27931
|
}
|
|
28055
27932
|
_init() {
|
|
28056
27933
|
this._initCellAlertPopup();
|
|
28057
27934
|
}
|
|
28058
27935
|
_initCellAlertPopup() {
|
|
28059
|
-
this.disposeWithMe(this.
|
|
28060
|
-
|
|
28061
|
-
|
|
28062
|
-
|
|
28063
|
-
|
|
28064
|
-
|
|
28065
|
-
|
|
28066
|
-
|
|
28067
|
-
|
|
28068
|
-
|
|
28069
|
-
|
|
28070
|
-
|
|
28071
|
-
|
|
28072
|
-
|
|
28073
|
-
|
|
28074
|
-
|
|
28075
|
-
|
|
28076
|
-
|
|
28077
|
-
|
|
28078
|
-
|
|
28079
|
-
|
|
28080
|
-
|
|
28081
|
-
|
|
28082
|
-
|
|
28083
|
-
|
|
28084
|
-
|
|
28085
|
-
|
|
28086
|
-
|
|
28087
|
-
|
|
28088
|
-
|
|
28089
|
-
|
|
28090
|
-
|
|
28091
|
-
|
|
28092
|
-
|
|
28093
|
-
|
|
28094
|
-
|
|
28095
|
-
|
|
28096
|
-
|
|
28097
|
-
|
|
28098
|
-
|
|
28099
|
-
|
|
28100
|
-
|
|
28101
|
-
|
|
28102
|
-
|
|
27936
|
+
this.disposeWithMe(this._selectionManagerService.selectionChanged$.subscribe((selections) => this._updateAlert(selections)));
|
|
27937
|
+
this.disposeWithMe(this._context.unit.activeSheet$.subscribe(() => this._updateAlert(this._selectionManagerService.getCurrentSelections())));
|
|
27938
|
+
this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).subscribe(() => this._updateAlert(this._selectionManagerService.getCurrentSelections())));
|
|
27939
|
+
}
|
|
27940
|
+
_isCurrentSheet(worksheet) {
|
|
27941
|
+
const selectionParam = this._selectionManagerService.currentSelectionParam;
|
|
27942
|
+
return Boolean(worksheet && (selectionParam === null || selectionParam === void 0 ? void 0 : selectionParam.unitId) === this._context.unit.getUnitId() && selectionParam.sheetId === worksheet.getSheetId());
|
|
27943
|
+
}
|
|
27944
|
+
_updateAlert(selections) {
|
|
27945
|
+
var _this$_configService$, _cellStyle$n;
|
|
27946
|
+
this._hideAlert();
|
|
27947
|
+
const workbook = this._context.unit;
|
|
27948
|
+
const worksheet = workbook.getActiveSheet();
|
|
27949
|
+
if (!this._isCurrentSheet(worksheet)) return;
|
|
27950
|
+
if ((selections === null || selections === void 0 ? void 0 : selections.length) !== 1) return;
|
|
27951
|
+
if ((_this$_configService$ = this._configService.getConfig("sheets-ui.config")) === null || _this$_configService$ === void 0 ? void 0 : _this$_configService$.disableForceStringAlert) return;
|
|
27952
|
+
const selection = selections[0];
|
|
27953
|
+
const primary = selection.primary;
|
|
27954
|
+
if (!primary) return;
|
|
27955
|
+
const row = primary.actualRow;
|
|
27956
|
+
const col = primary.actualColumn;
|
|
27957
|
+
const cellData = worksheet.getCell(row, col);
|
|
27958
|
+
if (!cellData || cellData.v === null || cellData.v === void 0) return;
|
|
27959
|
+
const cellStyle = workbook.getStyles().get(cellData.s);
|
|
27960
|
+
if (isTextFormat(cellStyle === null || cellStyle === void 0 || (_cellStyle$n = cellStyle.n) === null || _cellStyle$n === void 0 ? void 0 : _cellStyle$n.pattern)) return;
|
|
27961
|
+
if (cellData.t !== CellValueType.FORCE_STRING && cellData.t !== CellValueType.STRING || !isRealNum(cellData.v) && !(typeof cellData.v === "string" && getNumfmtParseValueFilter(cellData.v))) return;
|
|
27962
|
+
const unitId = workbook.getUnitId();
|
|
27963
|
+
const subUnitId = worksheet.getSheetId();
|
|
27964
|
+
const range = { ...selection.range };
|
|
27965
|
+
this._cellAlertManagerService.showAlert({
|
|
27966
|
+
type: 1,
|
|
27967
|
+
title: this._localeService.t("sheets-ui.info.error"),
|
|
27968
|
+
message: this._localeService.t("sheets-ui.info.forceStringInfo"),
|
|
27969
|
+
location: {
|
|
27970
|
+
unitId,
|
|
27971
|
+
subUnitId,
|
|
27972
|
+
row,
|
|
27973
|
+
col
|
|
27974
|
+
},
|
|
27975
|
+
width: 200,
|
|
27976
|
+
height: 74,
|
|
27977
|
+
key: this._alertKey,
|
|
27978
|
+
menu: [{
|
|
27979
|
+
label: this._localeService.t("sheets-ui.info.convertToNumber"),
|
|
27980
|
+
onSelect: () => {
|
|
27981
|
+
if (this._commandService.syncExecuteCommand(TextToNumberCommand.id, {
|
|
27982
|
+
unitId,
|
|
27983
|
+
subUnitId,
|
|
27984
|
+
ranges: [range]
|
|
27985
|
+
})) this._hideAlert();
|
|
28103
27986
|
}
|
|
28104
|
-
}
|
|
28105
|
-
|
|
28106
|
-
|
|
27987
|
+
}]
|
|
27988
|
+
});
|
|
27989
|
+
}
|
|
27990
|
+
get _alertKey() {
|
|
27991
|
+
return `${ALERT_KEY}:${this._context.unit.getUnitId()}`;
|
|
28107
27992
|
}
|
|
28108
27993
|
_hideAlert() {
|
|
28109
|
-
this._cellAlertManagerService.removeAlert(
|
|
27994
|
+
this._cellAlertManagerService.removeAlert(this._alertKey);
|
|
28110
27995
|
}
|
|
28111
27996
|
};
|
|
28112
27997
|
ForceStringAlertRenderController = __decorate([
|
|
28113
|
-
__decorateParam(1, Inject(
|
|
27998
|
+
__decorateParam(1, Inject(SheetsSelectionsService)),
|
|
28114
27999
|
__decorateParam(2, Inject(CellAlertManagerService)),
|
|
28115
28000
|
__decorateParam(3, Inject(LocaleService)),
|
|
28116
|
-
__decorateParam(4, IConfigService)
|
|
28001
|
+
__decorateParam(4, IConfigService),
|
|
28002
|
+
__decorateParam(5, ICommandService),
|
|
28003
|
+
__decorateParam(6, IUniverInstanceService)
|
|
28117
28004
|
], ForceStringAlertRenderController);
|
|
28118
28005
|
|
|
28119
28006
|
//#endregion
|
|
@@ -28543,7 +28430,7 @@ function MobileSheetBarImpl(props) {
|
|
|
28543
28430
|
tabMapRef.current.set(sheet.sheetId, element);
|
|
28544
28431
|
},
|
|
28545
28432
|
className: clsx("univer-relative univer-box-border univer-flex univer-h-full univer-max-w-36 univer-shrink-0 univer-cursor-pointer univer-select-none univer-items-center univer-justify-center univer-truncate univer-px-1 univer-py-0.5 univer-text-sm univer-font-medium univer-leading-6 univer-transition-all", borderRightClassName, {
|
|
28546
|
-
"univer-bg-
|
|
28433
|
+
"univer-bg-gray-0 univer-text-blue-600 dark:!univer-bg-gray-700 dark:!univer-text-blue-400": sheet.sheetId === activeKey,
|
|
28547
28434
|
"univer-text-gray-600 hover:univer-bg-gray-50 active:univer-bg-gray-100 dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-700": sheet.sheetId !== activeKey
|
|
28548
28435
|
}),
|
|
28549
28436
|
role: "tab",
|
|
@@ -29359,7 +29246,7 @@ FormatPainterRenderController = __decorate([
|
|
|
29359
29246
|
//#region src/controllers/render-controllers/header-menu.render-controller.ts
|
|
29360
29247
|
const HEADER_MENU_CONTROLLER_SHAPE = "__SpreadsheetHeaderMenuSHAPEControllerShape__";
|
|
29361
29248
|
const HEADER_MENU_CONTROLLER_MENU = "__SpreadsheetHeaderMenuMAINControllerShape__";
|
|
29362
|
-
const HEADER_MENU_CONTROLLER_SHAPE_COLOR = "
|
|
29249
|
+
const HEADER_MENU_CONTROLLER_SHAPE_COLOR = "gray.100";
|
|
29363
29250
|
let HeaderMenuRenderController = class HeaderMenuRenderController extends Disposable {
|
|
29364
29251
|
constructor(_context, _sheetSkeletonManagerService, _contextMenuService, _commandService, _selectionManagerService) {
|
|
29365
29252
|
super();
|
|
@@ -30837,6 +30724,36 @@ MobileSheetsScrollRenderController = __decorate([
|
|
|
30837
30724
|
__decorateParam(7, IContextService)
|
|
30838
30725
|
], MobileSheetsScrollRenderController);
|
|
30839
30726
|
|
|
30727
|
+
//#endregion
|
|
30728
|
+
//#region src/controllers/render-controllers/skeleton.render-controller.ts
|
|
30729
|
+
let SheetSkeletonRenderController = class SheetSkeletonRenderController extends Disposable {
|
|
30730
|
+
constructor(_context, _sheetSkeletonManagerService, _renderManagerService) {
|
|
30731
|
+
super();
|
|
30732
|
+
this._context = _context;
|
|
30733
|
+
this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
|
|
30734
|
+
this._renderManagerService = _renderManagerService;
|
|
30735
|
+
this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((param) => {
|
|
30736
|
+
this._updateSceneSize(param);
|
|
30737
|
+
}));
|
|
30738
|
+
}
|
|
30739
|
+
_updateSceneSize(param) {
|
|
30740
|
+
var _this$_renderManagerS;
|
|
30741
|
+
if (param == null) return;
|
|
30742
|
+
const { unitId } = this._context;
|
|
30743
|
+
const { skeleton } = param;
|
|
30744
|
+
const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
|
|
30745
|
+
if (skeleton == null || scene == null) return;
|
|
30746
|
+
const { rowTotalHeight, columnTotalWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
30747
|
+
if (!this._context.unit.getActiveSheet()) return;
|
|
30748
|
+
scene === null || scene === void 0 || scene.transformByState({
|
|
30749
|
+
width: rowHeaderWidthAndMarginLeft + columnTotalWidth,
|
|
30750
|
+
height: columnHeaderHeightAndMarginTop + rowTotalHeight
|
|
30751
|
+
});
|
|
30752
|
+
scene.getMainViewport().setMargin(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
30753
|
+
}
|
|
30754
|
+
};
|
|
30755
|
+
SheetSkeletonRenderController = __decorate([__decorateParam(1, Inject(SheetSkeletonManagerService)), __decorateParam(2, IRenderManagerService)], SheetSkeletonRenderController);
|
|
30756
|
+
|
|
30840
30757
|
//#endregion
|
|
30841
30758
|
//#region src/services/auto-height.service.ts
|
|
30842
30759
|
const IAutoHeightService = createIdentifier("sheets-ui.services.auto-height");
|
|
@@ -31742,7 +31659,6 @@ let UniverSheetsMobileUIPlugin = class UniverSheetsMobileUIPlugin extends Plugin
|
|
|
31742
31659
|
[SelectAllService],
|
|
31743
31660
|
[ISheetCellDropdownManagerService, { useClass: SheetCellDropdownManagerService }],
|
|
31744
31661
|
[SheetCellEditorResizeService],
|
|
31745
|
-
[ISheetLoadingRenderService, { useClass: SheetLoadingRenderService }],
|
|
31746
31662
|
[AutoHeightController],
|
|
31747
31663
|
[AutoWidthController],
|
|
31748
31664
|
[FormulaEditorController],
|
|
@@ -32360,7 +32276,6 @@ let UniverSheetsUIPlugin = class UniverSheetsUIPlugin extends Plugin {
|
|
|
32360
32276
|
[SelectAllService],
|
|
32361
32277
|
[ISheetCellDropdownManagerService, { useClass: SheetCellDropdownManagerService }],
|
|
32362
32278
|
[SheetCellEditorResizeService],
|
|
32363
|
-
[ISheetLoadingRenderService, { useClass: SheetLoadingRenderService }],
|
|
32364
32279
|
[AutoHeightController],
|
|
32365
32280
|
[AutoWidthController],
|
|
32366
32281
|
[FormulaEditorController],
|
|
@@ -32483,4 +32398,4 @@ UniverSheetsUIPlugin = __decorate([
|
|
|
32483
32398
|
], UniverSheetsUIPlugin);
|
|
32484
32399
|
|
|
32485
32400
|
//#endregion
|
|
32486
|
-
export { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, ApplyFormatPainterCommand, AutoFillPopupMenu, AutoFillUIController, AutoHeightController, AutoWidthController, BORDER_LINE_CHILDREN, BORDER_SIZE_CHILDREN, BaseSelectionRenderService, BorderLine, COPY_SPECIAL_MENU_ID, COPY_TYPE, CellAlertManagerService, CellAlertType, CellCustomRenderController, CellEditorManagerService, CellPopupManagerService, ChangeSheetProtectionFromSheetBarCommand, ChangeZoomRatioCommand, DeleteRangeMoveLeftConfirmCommand, DeleteRangeMoveUpConfirmCommand, DeleteRangeProtectionFromContextMenuCommand, DeleteWorksheetProtectionFormSheetBarCommand, DragManagerService, DragRenderController, EMBEDDING_FORMULA_EDITOR, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, EditingRenderController, EditorBridgeService, EditorContainer, ExpandSelectionCommand, FORMULA_CLIPBOARD_MIME_TYPE, FormatPainterStatus, FormulaBar, FormulaEditorController, HEADER_UNHIDE_RANGE_VISIBLE_CHECK, HeaderFreezeRenderController, HeaderMoveRenderController, HeaderResizeRenderController, HeaderUnhideRangeAxis, HeaderUnhideRangeService, HeaderUnhideRenderController, HideColConfirmCommand, HideRowConfirmCommand, HoverManagerService, HoverRenderController, ICellEditorManagerService, IEditorBridgeService, IFormatPainterService, IFormulaEditorManagerService, IMarkSelectionService, IRepeatLastActionService, ISheetCellDropdownManagerService, ISheetClipboardService, ISheetEmbedFloatingGeometryService, ISheetEmbedInteractionBoundaryService, ISheetEmbedRuntimeFocusCoordinator, ISheetEmbedRuntimeService, ISheetHostChromeOverrideService,
|
|
32401
|
+
export { AddRangeProtectionFromContextMenuCommand, AddRangeProtectionFromSheetBarCommand, AddRangeProtectionFromToolbarCommand, ApplyFormatPainterCommand, AutoFillPopupMenu, AutoFillUIController, AutoHeightController, AutoWidthController, BORDER_LINE_CHILDREN, BORDER_SIZE_CHILDREN, BaseSelectionRenderService, BorderLine, COPY_SPECIAL_MENU_ID, COPY_TYPE, CellAlertManagerService, CellAlertType, CellCustomRenderController, CellEditorManagerService, CellPopupManagerService, ChangeSheetProtectionFromSheetBarCommand, ChangeZoomRatioCommand, DeleteRangeMoveLeftConfirmCommand, DeleteRangeMoveUpConfirmCommand, DeleteRangeProtectionFromContextMenuCommand, DeleteWorksheetProtectionFormSheetBarCommand, DragManagerService, DragRenderController, EMBEDDING_FORMULA_EDITOR, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, EditingRenderController, EditorBridgeService, EditorContainer, ExpandSelectionCommand, FORMULA_CLIPBOARD_MIME_TYPE, FormatPainterStatus, FormulaBar, FormulaEditorController, HEADER_UNHIDE_RANGE_VISIBLE_CHECK, HeaderFreezeRenderController, HeaderMoveRenderController, HeaderResizeRenderController, HeaderUnhideRangeAxis, HeaderUnhideRangeService, HeaderUnhideRenderController, HideColConfirmCommand, HideRowConfirmCommand, HoverManagerService, HoverRenderController, ICellEditorManagerService, IEditorBridgeService, IFormatPainterService, IFormulaEditorManagerService, IMarkSelectionService, IRepeatLastActionService, ISheetBarService, ISheetCellDropdownManagerService, ISheetClipboardService, ISheetEmbedFloatingGeometryService, ISheetEmbedInteractionBoundaryService, ISheetEmbedRuntimeFocusCoordinator, ISheetEmbedRuntimeService, ISheetHostChromeOverrideService, ISheetSelectionRenderService, IStatusBarService, InsertRangeMoveDownConfirmCommand, InsertRangeMoveRightConfirmCommand, JumpOver, MarkSelectionService, MoveSelectionCommand, MoveSelectionEnterAndTabCommand, PASTE_SPECIAL_MENU_ID, PREDEFINED_HOOK_NAME, PREDEFINED_HOOK_NAME_COPY, PREDEFINED_HOOK_NAME_PASTE, RANGE_SELECTOR_COMPONENT_KEY, RANGE_SELECTOR_SYMBOLS, RemoveColConfirmCommand, RemoveRowConfirmCommand, RemoveSheetConfirmCommand, RenameSheetOperation, RepeatLastActionPermission, ResetRangeTextColorCommand, ResetScrollCommand, SELECTION_SHAPE_DEPTH, SHEETS_UI_PLUGIN_CONFIG_KEY, SHEET_EMBED_CHILD_TYPE_ATTRIBUTE, SHEET_EMBED_CHILD_UNIT_ID_ATTRIBUTE, SHEET_EMBED_FLOAT_DOM_ATTRIBUTE, SHEET_EMBED_HOST_UNIT_ID_ATTRIBUTE, SHEET_EMBED_ID_ATTRIBUTE, SHEET_EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, SHEET_EMBED_RUNTIME_FOCUS_ROLE_ATTRIBUTE, SHEET_FOOTER_BAR_HEIGHT, SHEET_UI_PLUGIN_NAME, SHEET_VIEW_KEY, ScrollCommand, ScrollToCellCommand, ScrollToRangeOperation, SelectAllCommand, SelectionControl, SelectionControl as SelectionShape, SelectionShapeExtension, SetActivateCellEditOperation, SetCellEditVisibleArrowOperation, SetCellEditVisibleOperation, SetCellEditVisibleWithF2Operation, SetColumnFrozenCommand, SetColumnHeaderHeightCommand, SetFirstColumnFrozenCommand, SetFirstRowFrozenCommand, SetFormatPainterOperation, SetInfiniteFormatPainterCommand, SetOnceFormatPainterCommand, SetRangeBoldCommand, SetRangeFontDecreaseCommand, SetRangeFontFamilyCommand, SetRangeFontIncreaseCommand, SetRangeFontSizeCommand, SetRangeItalicCommand, SetRangeProtectionFromContextMenuCommand, SetRangeStrickThroughCommand, SetRangeSubscriptCommand, SetRangeSuperscriptCommand, SetRangeTextColorCommand, SetRangeUnderlineCommand, SetRowFrozenCommand, SetRowHeaderWidthCommand, SetScrollOperation, SetScrollRelativeCommand, SetSelectionFrozenCommand, SetWorksheetColAutoWidthCommand, SetZoomRatioCommand, SetZoomRatioOperation, SheetBar, SheetBarService, SheetCanvasPopManagerService, SheetCellDropdownManagerService, SheetCellEditorResizeService, SheetClipboardController, SheetClipboardService, SheetCopyCommand, SheetCutCommand, SheetMenuPosition, SheetPasteBesidesBorderCommand, SheetPasteColWidthCommand, SheetPasteCommand, SheetPasteFormatCommand, SheetPasteShortKeyCommand, SheetPasteValueCommand, SheetPermissionCheckUIController, SheetPermissionOpenDialogOperation, SheetPermissionOpenPanelOperation, SheetPermissionRenderManagerService, SheetPermissionUserManagerService, SheetPrintInterceptorService, SheetPrintingResourceCollector, SheetRenderController, SheetScrollManagerService, SheetSelectionRenderService, SheetSkeletonManagerService, SheetUIController, SheetsRenderService, SheetsScrollRenderController, menuSchema as SheetsUIMenuSchema, SheetsUIPart, ShowMenuListCommand, SidebarDefinedNameOperation, StatusBarController, StatusBarService, UNIVER_SHEET_PERMISSION_USER_PART, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, ViewSheetPermissionFromContextMenuCommand, ViewSheetPermissionFromSheetBarCommand, calculateDocSkeletonRects, matchedSelectionByRowColIndex as checkInHeaderRanges, deriveStateFromActiveSheet$, functionDisplayNames, genNormalSelectionStyle, genSelectionByRange, selectionDataForSelectAll as getAllSelection, getCellRealRange, getCoordByCell, getCoordByOffset, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$, getCustomRangePosition, getEditingCustomRangePosition, getEditorObject, getMatrixPlainText, getObservableWithExclusiveRange$, getRepeatRange, getSheetObject, getTopLeftSelectionOfCurrSheet, getTransformCoord, getViewportByCell, isEmbeddingFormulaEditor, isRangeSelector, menuClipboardDisabledObservable, mergeSetRangeValues, resolveActiveSheetEmbedRuntimeDomScope, resolveSheetEmbedRuntimeDomScope, useActiveWorkbook, useActiveWorksheet, useHighlightRange, useKeyEventConfig, useWorkbooks, virtualizeDiscreteRanges, whenFormulaEditorActivated, whenSheetEditorActivated, whenSheetEditorFocused };
|