@univerjs/sheets-ui 0.5.5-experimental.20250123-34738ff → 0.5.5-experimental.20250125-1aa33c0
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 +1 -1
- package/lib/cjs/index.js +6 -6
- package/lib/es/facade.js +47 -2
- package/lib/es/index.js +254 -129
- package/lib/index.css +1 -1
- package/lib/types/commands/commands/headersize-changed.command.d.ts +8 -0
- package/lib/types/controllers/editor/formula-editor.controller.d.ts +0 -1
- package/lib/types/controllers/render-controllers/freeze.render-controller.d.ts +4 -2
- package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +4 -0
- package/lib/types/facade/f-event.d.ts +3 -0
- package/lib/types/facade/f-univer.d.ts +2 -0
- package/lib/types/facade/f-worksheet.d.ts +83 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/services/sheet-skeleton-manager.service.d.ts +2 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +6 -6
- package/package.json +11 -11
package/lib/es/index.js
CHANGED
|
@@ -3,12 +3,12 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
5
|
import { DOCS_VIEW_KEY, getCanvasOffsetByEngine, IEditorService, VIEWPORT_KEY, DOCS_COMPONENT_MAIN_LAYER_INDEX, BreakLineCommand, DeleteLeftCommand, DocSelectionRenderService, ReplaceSnapshotCommand, MoveSelectionOperation, MoveCursorOperation, SetInlineFormatBoldCommand, SetInlineFormatItalicCommand, SetInlineFormatUnderlineCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatFontSizeCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatTextColorCommand, SetInlineFormatCommand, NodePositionConvertToCursor, getLineBounding, DOC_VERTICAL_PADDING, IMEInputCommand, InsertCommand, CoverContentCommand, IRangeSelectorService } from "@univerjs/docs-ui";
|
|
6
|
-
import { createInterceptorKey, ColorKit, RANGE_TYPE, convertCellToRange, UniverInstanceType, Quantity, Disposable, toDisposable, Tools, createIdentifier, InterceptorManager, ThemeService, Inject, Injector, useDependency, IUniverInstanceService, ObjectMatrix, Direction, isFormulaString, isFormulaId, CellValueType, numfmt, Rectangle, ICommandService, IUndoRedoService,
|
|
6
|
+
import { CommandType, createInterceptorKey, ColorKit, RANGE_TYPE, convertCellToRange, UniverInstanceType, Quantity, Disposable, toDisposable, Tools, createIdentifier, InterceptorManager, ThemeService, Inject, Injector, useDependency, IUniverInstanceService, ObjectMatrix, Direction, isFormulaString, isFormulaId, CellValueType, numfmt, Rectangle, ICommandService, IUndoRedoService, sequenceExecute, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, EDITOR_ACTIVATED, FOCUSING_EDITOR_STANDALONE, IContextService, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, Workbook, Optional, FOCUSING_SHEET, RxDisposable, DisposableCollection, IPermissionService, fromEventSubject, sortRules, LocaleService, getReverseDirection, VerticalAlign, HorizontalAlign, WrapStrategy, FOCUSING_UNIVER_EDITOR, FOCUSING_COMMON_DRAWINGS, FOCUSING_FX_BAR_EDITOR, FOCUSING_EDITOR_INPUT_FORMULA, LocaleType, FOCUSING_EDITOR_BUT_HIDDEN, DEFAULT_EMPTY_DOCUMENT_VALUE, LRUMap, BaselineOffset, BooleanNumber, DataStreamTreeTokenType, skipParseTagNames, generateRandomId, CustomRangeType, DEFAULT_WORKSHEET_ROW_HEIGHT, ErrorService, CellModeEnum, ILogService, isNotNullOrUndefined, extractPureTextFromCell, UserManagerService, FontWeight, FontItalic, DEFAULT_STYLES, Dimension, BorderStyleTypes, AbsoluteRefType, useObservable as useObservable$1, IConfigService, nameCharacterCheck, debounce, NilCommand, connectInjector, UndoCommandId, Range, cellToRange, convertBodyToHtml, handleStyleToString, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, PresetListType, isRealNum, InterceptorEffectEnum, splitIntoGrid, IAuthzIoService, isValidRange, DependentOn, Plugin, DocumentFlavor, merge as merge$1, registerDependencies, mergeOverrideWithDependencies, touchDependencies } from "@univerjs/core";
|
|
7
7
|
import { IRenderManagerService, SHEET_VIEWPORT_KEY, CURSOR_TYPE, Vector2, Rect, ScrollTimer, ScrollTimerType, DashedRect, Group, TRANSFORM_CHANGE_OBSERVABLE_TYPE, cancelRequestFrame, requestNewFrame, FIX_ONE_PIXEL_BLUR_OFFSET, Layer, SpreadsheetSkeleton, DeviceInputEventType, convertTextRotation, RENDER_RAW_FORMULA_KEY, Spreadsheet, RENDER_CLASS_TYPE, ScrollBar, fixLineWidthByScale, ptToPixel, Shape, SHEET_EXTENSION_PREFIX, SpreadsheetRowHeader, SpreadsheetColumnHeader, Viewport, hasCJKText, DEFAULT_PADDING_DATA, SheetExtension, RegularPolygon, precisionTo } from "@univerjs/engine-render";
|
|
8
8
|
import { useObservable, KeyCode, ILayoutService, MetaKeys, DEFAULT_BACKGROUND_COLOR_RGB, DEFAULT_BACKGROUND_COLOR_RGBA, handleStringToStyle, textTrim, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, HTML_CLIPBOARD_MIME_TYPE, imageMimeTypeSet, IClipboardInterfaceService, INotificationService, IPlatformService, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, CopyCommand, CutCommand, PasteCommand, SheetPasteShortKeyCommandName, IConfirmService, IContextMenuService, MenuItemType, getMenuHiddenObservable, FONT_FAMILY_LIST, FONT_SIZE_LIST, ISidebarService, IDialogService, ComponentManager, useSidebarClick, DISABLE_AUTO_FOCUS_KEY, useEvent, useComponentsOfPart, ComponentContainer, UI_PLUGIN_CONFIG_KEY, UIMenu, ContextMenuPosition, IMessageService, IMenuManagerService, ToolbarItem, RibbonStartGroup, ContextMenuGroup, FontFamily, FontFamilyItem, FontSize, BuiltInUIPart, IShortcutService, IUIPartsService, ICanvasPopupService, IZenZoneService, UniverMobileUIPlugin } from "@univerjs/ui";
|
|
9
9
|
import React, { useMemo, useState, useEffect, forwardRef, useRef, createElement, useCallback, useLayoutEffect } from "react";
|
|
10
10
|
import { BehaviorSubject, Subject, of, merge, map, startWith, switchMap, takeUntil, distinctUntilChanged, throttleTime, filter, combineLatest, debounceTime, Observable, combineLatestWith, Subscription, withLatestFrom, EMPTY } from "rxjs";
|
|
11
|
-
import { SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTIONS_ENABLED, REF_SELECTIONS_ENABLED, SheetsSelectionsService, SheetInterceptorService, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowAutoHeightMutation, SetRangeValuesCommand, SetWorksheetRowIsAutoHeightCommand, SetStyleCommand, MoveRangeCommand, ReorderRangeCommand, SetSelectionsOperation, SetRangeValuesMutation, getSheetCommandTarget, generateNullCellValue, SetRangeValuesUndoMutationFactory, BEFORE_CELL_EDIT, IRefSelectionsService, SetWorksheetActiveOperation, MoveRangeMutation, RemoveRowMutation, RemoveColMutation, InsertRowMutation, InsertColMutation, MoveRowsMutation, MoveColsMutation, SetWorksheetColWidthMutation, SetWorksheetRowHeightMutation, RemoveSheetMutation, RemoveMergeUndoMutationFactory, RemoveWorksheetMergeMutation, AddWorksheetMergeMutation, getAddMergeMutationRangeByType, AddMergeUndoMutationFactory, WorkbookEditablePermission, WorksheetEditPermission, UnitAction, alignToMergedCellsBorders, getSelectionsService, getCellAtRowCol, SelectionMoveType, expandToContinuousRange, ScrollToCellOperation, COMMAND_LISTENER_SKELETON_CHANGE, SetWorksheetActivateCommand, getPrimaryForRange, SetRowHiddenCommand, SetColHiddenCommand, SetBoldCommand, SetItalicCommand, SetUnderlineCommand, SetStrikeThroughCommand, SetFontSizeCommand, SetFontFamilyCommand, SetTextColorCommand, SetFrozenMutationFactory, SetFrozenMutation, IExclusiveRangeService, RangeProtectionRuleModel, WorksheetProtectionRuleModel, RangeProtectionPermissionEditPoint, WorksheetCopyPermission, WorksheetSetCellStylePermission, ResetBackgroundColorCommand, SetBackgroundColorCommand, SetHorizontalTextAlignCommand, SetVerticalTextAlignCommand, SetTextWrapCommand, SetTextRotationCommand, WorkbookCopyPermission, RangeProtectionPermissionViewPoint, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, CancelFrozenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedRowsVisibleCommand, SetColHiddenMutation, SetColVisibleMutation, SetSelectedColsVisibleCommand, SetRowHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetColWidthCommand, SetFrozenCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowCommand, InsertColCommand, MoveColsCommand, MoveRowsCommand, RemoveColCommand, RemoveRowCommand, MergeCellController, MERGE_CELL_INTERCEPTOR_CHECK, DeltaRowHeightCommand, DeltaColumnWidthCommand, COMMAND_LISTENER_VALUE_CHANGE, AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, UnitObject, ViewStateEnum, EditStateEnum, DeleteWorksheetProtectionCommand, DeleteRangeProtectionMutation, AddRangeProtectionMutation, RemoveSheetCommand, AddWorksheetProtectionCommand, BorderStyleManagerService, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, InsertDefinedNameCommand, SetDefinedNameCommand, RemoveDefinedNameCommand, SetWorksheetShowCommand, SetWorksheetOrderMutation, InsertSheetMutation, SetWorksheetNameMutation, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, WorkbookManageCollaboratorPermission, WorkbookRenameSheetPermission, SetTabColorMutation, WorkbookCreateSheetPermission, InsertSheetCommand, SetBorderBasicCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, ClearSelectionAllCommand, WorksheetDeleteColumnPermission, WorksheetDeleteRowPermission, ToggleGridlinesCommand, ToggleGridlinesMutation, WorksheetInsertColumnPermission, WorksheetInsertRowPermission, InsertRowBeforeCommand, InsertRowAfterCommand, InsertColBeforeCommand, InsertColAfterCommand, RemoveWorksheetMergeCommand, WorksheetManageCollaboratorPermission,
|
|
11
|
+
import { SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTIONS_ENABLED, REF_SELECTIONS_ENABLED, SheetsSelectionsService, SheetInterceptorService, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowAutoHeightMutation, SetRangeValuesCommand, SetWorksheetRowIsAutoHeightCommand, SetStyleCommand, MoveRangeCommand, ReorderRangeCommand, SetSelectionsOperation, SetRangeValuesMutation, getSheetCommandTarget, generateNullCellValue, SetRangeValuesUndoMutationFactory, BEFORE_CELL_EDIT, IRefSelectionsService, SetWorksheetActiveOperation, MoveRangeMutation, RemoveRowMutation, RemoveColMutation, InsertRowMutation, InsertColMutation, MoveRowsMutation, MoveColsMutation, SetWorksheetColWidthMutation, SetWorksheetRowHeightMutation, RemoveSheetMutation, RemoveMergeUndoMutationFactory, RemoveWorksheetMergeMutation, AddWorksheetMergeMutation, getAddMergeMutationRangeByType, AddMergeUndoMutationFactory, WorkbookEditablePermission, WorksheetEditPermission, UnitAction, alignToMergedCellsBorders, getSelectionsService, getCellAtRowCol, SelectionMoveType, expandToContinuousRange, ScrollToCellOperation, COMMAND_LISTENER_SKELETON_CHANGE, SetWorksheetActivateCommand, getPrimaryForRange, SetRowHiddenCommand, SetColHiddenCommand, SetBoldCommand, SetItalicCommand, SetUnderlineCommand, SetStrikeThroughCommand, SetFontSizeCommand, SetFontFamilyCommand, SetTextColorCommand, SetFrozenMutationFactory, SetFrozenMutation, IExclusiveRangeService, RangeProtectionRuleModel, WorksheetProtectionRuleModel, RangeProtectionPermissionEditPoint, WorksheetCopyPermission, WorksheetSetCellStylePermission, ResetBackgroundColorCommand, SetBackgroundColorCommand, SetHorizontalTextAlignCommand, SetVerticalTextAlignCommand, SetTextWrapCommand, SetTextRotationCommand, WorkbookCopyPermission, RangeProtectionPermissionViewPoint, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, CancelFrozenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedRowsVisibleCommand, SetColHiddenMutation, SetColVisibleMutation, SetSelectedColsVisibleCommand, SetRowHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetColWidthCommand, SetFrozenCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowCommand, InsertColCommand, MoveColsCommand, MoveRowsCommand, RemoveColCommand, RemoveRowCommand, MergeCellController, MERGE_CELL_INTERCEPTOR_CHECK, DeltaRowHeightCommand, DeltaColumnWidthCommand, COMMAND_LISTENER_VALUE_CHANGE, AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, UnitObject, ViewStateEnum, EditStateEnum, DeleteWorksheetProtectionCommand, DeleteRangeProtectionMutation, AddRangeProtectionMutation, RemoveSheetCommand, AddWorksheetProtectionCommand, BorderStyleManagerService, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, InsertDefinedNameCommand, SetDefinedNameCommand, RemoveDefinedNameCommand, SetWorksheetShowCommand, RangeProtectionCache, WorksheetViewPermission, SetWorksheetOrderMutation, InsertSheetMutation, SetWorksheetNameMutation, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, WorkbookManageCollaboratorPermission, WorkbookRenameSheetPermission, SetTabColorMutation, WorkbookCreateSheetPermission, InsertSheetCommand, SetBorderBasicCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, ClearSelectionAllCommand, WorksheetDeleteColumnPermission, WorksheetDeleteRowPermission, ToggleGridlinesCommand, ToggleGridlinesMutation, WorksheetInsertColumnPermission, WorksheetInsertRowPermission, InsertRowBeforeCommand, InsertRowAfterCommand, InsertColBeforeCommand, InsertColAfterCommand, RemoveWorksheetMergeCommand, WorksheetManageCollaboratorPermission, WorkbookCreateProtectPermission, WorksheetDeleteProtectionPermission, CopySheetCommand, SetTabColorCommand, SetWorksheetHideCommand, WorkbookDeleteSheetPermission, WorkbookHideSheetPermission, ResetTextColorCommand, AddWorksheetMergeCommand as AddWorksheetMergeCommand$1, AddWorksheetMergeAllCommand as AddWorksheetMergeAllCommand$1, AddWorksheetMergeVerticalCommand as AddWorksheetMergeVerticalCommand$1, AddWorksheetMergeHorizontalCommand as AddWorksheetMergeHorizontalCommand$1, RefRangeService, MAX_CELL_PER_SHEET_KEY, INTERCEPTOR_POINT, SheetPermissionCheckController, INumfmtService, SetProtectionCommand, AddRangeProtectionCommand, setEndForRange, baseProtectionActions, DeleteRangeProtectionCommand, WorksheetProtectionPointModel, SetWorksheetPermissionPointsCommand, getAllWorksheetPermissionPoint, convertSelectionDataToRange, UniverSheetsPlugin, RefSelectionsService, ToggleCellCheckboxCommand, SetSpecificRowsVisibleCommand, SetSpecificColsVisibleCommand } from "@univerjs/sheets";
|
|
12
12
|
import { DocSkeletonManagerService, DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from "@univerjs/docs";
|
|
13
13
|
import { sequenceNodeType, matchToken, LexerTreeBuilder, IFunctionService, SetFormulaCalculationNotificationMutation, IDefinedNamesService, operatorToken, isReferenceStrings, isReferenceStringWithEffectiveColumn, serializeRangeWithSheet, FUNCTION_NAMES_STATISTICAL, FUNCTION_NAMES_MATH, FUNCTION_NAMES_TEXT, NullValueObject, serializeRange, deserializeRangeWithSheet } from "@univerjs/engine-formula";
|
|
14
14
|
import { DEFAULT_TEXT_FORMAT } from "@univerjs/engine-numfmt";
|
|
@@ -33,7 +33,41 @@ function getEditorObject(unitId, renderManagerService) {
|
|
|
33
33
|
__name(getEditorObject, "getEditorObject");
|
|
34
34
|
const SHEET_ZOOM_RANGE = [10, 400], RANGE_SELECTOR_COMPONENT_KEY = "RANGE_SELECTOR_COMPONENT_KEY", EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY = "EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY";
|
|
35
35
|
var SHEET_VIEW_KEY = /* @__PURE__ */ ((SHEET_VIEW_KEY2) => (SHEET_VIEW_KEY2.MAIN = "__SpreadsheetRender__", SHEET_VIEW_KEY2.ROW = "__SpreadsheetRowHeader__", SHEET_VIEW_KEY2.COLUMN = "__SpreadsheetColumnHeader__", SHEET_VIEW_KEY2.LEFT_TOP = "__SpreadsheetLeftTopPlaceholder__", SHEET_VIEW_KEY2))(SHEET_VIEW_KEY || {});
|
|
36
|
-
const SHEET_COMPONENT_MAIN_LAYER_INDEX = 0, SHEET_COMPONENT_SELECTION_LAYER_INDEX = 1, SHEET_COMPONENT_HEADER_LAYER_INDEX = 10, SHEET_COMPONENT_HEADER_SELECTION_LAYER_INDEX = 11, SHEET_COMPONENT_UNHIDE_LAYER_INDEX = 12,
|
|
36
|
+
const SHEET_COMPONENT_MAIN_LAYER_INDEX = 0, SHEET_COMPONENT_SELECTION_LAYER_INDEX = 1, SHEET_COMPONENT_HEADER_LAYER_INDEX = 10, SHEET_COMPONENT_HEADER_SELECTION_LAYER_INDEX = 11, SHEET_COMPONENT_UNHIDE_LAYER_INDEX = 12, SetRowHeaderWidthCommand = {
|
|
37
|
+
id: "sheet.command.set-row-header-width",
|
|
38
|
+
type: CommandType.COMMAND,
|
|
39
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
40
|
+
if (!params)
|
|
41
|
+
return !1;
|
|
42
|
+
const renderManagerSrv = accessor.get(IRenderManagerService);
|
|
43
|
+
if (!renderManagerSrv)
|
|
44
|
+
return !1;
|
|
45
|
+
const { unitId, subUnitId, size } = params, render2 = renderManagerSrv.getRenderById(unitId);
|
|
46
|
+
if (render2) {
|
|
47
|
+
renderManagerSrv.getRenderById(unitId).with(SheetSkeletonManagerService).setRowHeaderSize(render2, subUnitId, size);
|
|
48
|
+
const { components } = render2, renderComponent = components.get(SHEET_VIEW_KEY.ROW);
|
|
49
|
+
renderComponent && renderComponent.setCustomHeader({ headerStyle: { size } });
|
|
50
|
+
}
|
|
51
|
+
return !0;
|
|
52
|
+
}, "handler")
|
|
53
|
+
}, SetColumnHeaderHeightCommand = {
|
|
54
|
+
id: "sheet.command.set-col-header-height",
|
|
55
|
+
type: CommandType.COMMAND,
|
|
56
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
57
|
+
if (!params)
|
|
58
|
+
return !1;
|
|
59
|
+
const renderManagerSrv = accessor.get(IRenderManagerService);
|
|
60
|
+
if (!renderManagerSrv)
|
|
61
|
+
return !1;
|
|
62
|
+
const { unitId, subUnitId, size } = params, render2 = renderManagerSrv.getRenderById(unitId);
|
|
63
|
+
if (render2) {
|
|
64
|
+
renderManagerSrv.getRenderById(unitId).with(SheetSkeletonManagerService).setColumnHeaderSize(render2, subUnitId, size);
|
|
65
|
+
const { components } = render2, renderComponent = components.get(SHEET_VIEW_KEY.COLUMN);
|
|
66
|
+
renderComponent && renderComponent.setCustomHeader({ headerStyle: { size } });
|
|
67
|
+
}
|
|
68
|
+
return !0;
|
|
69
|
+
}, "handler")
|
|
70
|
+
}, RANGE_MOVE_PERMISSION_CHECK = createInterceptorKey("rangeMovePermissionCheck"), RANGE_FILL_PERMISSION_CHECK = createInterceptorKey("rangeFillPermissionCheck");
|
|
37
71
|
var SELECTION_SHAPE_DEPTH = /* @__PURE__ */ ((SELECTION_SHAPE_DEPTH2) => (SELECTION_SHAPE_DEPTH2[SELECTION_SHAPE_DEPTH2.FORMULA_EDITOR_SHOW = 100] = "FORMULA_EDITOR_SHOW", SELECTION_SHAPE_DEPTH2[SELECTION_SHAPE_DEPTH2.MARK_SELECTION = 1e4] = "MARK_SELECTION", SELECTION_SHAPE_DEPTH2))(SELECTION_SHAPE_DEPTH || {});
|
|
38
72
|
function genNormalSelectionStyle(themeService) {
|
|
39
73
|
const styleSheet = themeService.getCurrentTheme(), fill = new ColorKit(styleSheet.primaryColor).setAlpha(0.07).toRgbString();
|
|
@@ -1971,24 +2005,48 @@ let SheetSkeletonManagerService = (_a = class extends Disposable {
|
|
|
1971
2005
|
}
|
|
1972
2006
|
setColumnHeaderSize(render2, sheetId, size) {
|
|
1973
2007
|
var _a61;
|
|
2008
|
+
if (!render2) return;
|
|
1974
2009
|
const skeleton = (_a61 = this.getWorksheetSkeleton(sheetId)) == null ? void 0 : _a61.skeleton;
|
|
1975
|
-
if (skeleton)
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2010
|
+
if (!skeleton) return;
|
|
2011
|
+
skeleton.columnHeaderHeight = size, render2.scene.getViewports()[0].top = size, render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT).setViewportSize({
|
|
2012
|
+
height: size
|
|
2013
|
+
}), render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT).setViewportSize({
|
|
2014
|
+
height: size
|
|
2015
|
+
}), render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM).setViewportSize({
|
|
2016
|
+
top: size
|
|
2017
|
+
}), render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_ROW_TOP).setViewportSize({
|
|
2018
|
+
top: size
|
|
2019
|
+
}), render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP).setViewportSize({
|
|
2020
|
+
height: size
|
|
2021
|
+
});
|
|
2022
|
+
const selectionService = render2 == null ? void 0 : render2.with(SheetsSelectionsService), selectionRenderService = render2 == null ? void 0 : render2.with(ISheetSelectionRenderService), currSelections = selectionService.getCurrentSelections();
|
|
2023
|
+
selectionRenderService.resetSelectionsByModelData(currSelections);
|
|
2024
|
+
const sheetSkeletonManagerParam = this.getUnitSkeleton(render2.unitId, sheetId);
|
|
2025
|
+
sheetSkeletonManagerParam && (sheetSkeletonManagerParam.commandId = SetColumnHeaderHeightCommand.id, this._currentSkeleton$.next(sheetSkeletonManagerParam));
|
|
2026
|
+
}
|
|
2027
|
+
setRowHeaderSize(render2, sheetId, size) {
|
|
2028
|
+
var _a61;
|
|
2029
|
+
const skeleton = (_a61 = this.getWorksheetSkeleton(sheetId)) == null ? void 0 : _a61.skeleton;
|
|
2030
|
+
if (!render2 || !skeleton) return;
|
|
2031
|
+
skeleton.rowHeaderWidth = size;
|
|
2032
|
+
const originWidth = render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP).width || 46, deltaX = size - originWidth, originLeftOfViewMain = render2.scene.getViewports()[0].left;
|
|
2033
|
+
render2.scene.getViewports()[0].left = originLeftOfViewMain + deltaX, render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM).setViewportSize({
|
|
2034
|
+
width: size
|
|
2035
|
+
}), render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_ROW_TOP).setViewportSize({
|
|
2036
|
+
width: size
|
|
2037
|
+
}), render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT).setViewportSize({
|
|
2038
|
+
left: size
|
|
2039
|
+
});
|
|
2040
|
+
const prevLeft = render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT).left || 0;
|
|
2041
|
+
render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT).setViewportSize({
|
|
2042
|
+
left: prevLeft + deltaX
|
|
2043
|
+
}), render2.scene.getViewport(SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP).setViewportSize({
|
|
2044
|
+
width: size
|
|
2045
|
+
});
|
|
2046
|
+
const selectionService = render2 == null ? void 0 : render2.with(SheetsSelectionsService), selectionRenderService = render2 == null ? void 0 : render2.with(ISheetSelectionRenderService), currSelections = selectionService.getCurrentSelections();
|
|
2047
|
+
selectionRenderService.resetSelectionsByModelData(currSelections);
|
|
2048
|
+
const sheetSkeletonManagerParam = this.getCurrent();
|
|
2049
|
+
sheetSkeletonManagerParam && (sheetSkeletonManagerParam.commandId = SetRowHeaderWidthCommand.id, this._currentSkeleton$.next(sheetSkeletonManagerParam));
|
|
1992
2050
|
}
|
|
1993
2051
|
}, __name(_a, "SheetSkeletonManagerService"), _a);
|
|
1994
2052
|
SheetSkeletonManagerService = __decorateClass$V([
|
|
@@ -3515,7 +3573,9 @@ var __defProp$R = Object.defineProperty, __getOwnPropDesc$R = Object.getOwnPrope
|
|
|
3515
3573
|
}, "__decorateClass$R"), __decorateParam$R = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$R"), _a5;
|
|
3516
3574
|
let SheetsZoomRenderController = (_a5 = class extends Disposable {
|
|
3517
3575
|
constructor(_context, _sheetSkeletonManagerService, _commandService, _contextService, _editorBridgeService) {
|
|
3518
|
-
super()
|
|
3576
|
+
super();
|
|
3577
|
+
__publicField(this, "_zoom");
|
|
3578
|
+
this._context = _context, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._commandService = _commandService, this._contextService = _contextService, this._editorBridgeService = _editorBridgeService, this._initSkeletonListener(), this._initZoomEventListener();
|
|
3519
3579
|
}
|
|
3520
3580
|
updateZoom(worksheetId, zoomRatio) {
|
|
3521
3581
|
const worksheet = this._context.unit.getSheetBySheetId(worksheetId);
|
|
@@ -3554,7 +3614,7 @@ let SheetsZoomRenderController = (_a5 = class extends Disposable {
|
|
|
3554
3614
|
const worksheet = this._context.unit.getActiveSheet();
|
|
3555
3615
|
if (!worksheet) return;
|
|
3556
3616
|
const zoomRatio = worksheet.getZoomRatio() || 1;
|
|
3557
|
-
this._updateViewZoom(zoomRatio);
|
|
3617
|
+
this._zoom !== zoomRatio && this._updateViewZoom(zoomRatio), this._zoom = zoomRatio;
|
|
3558
3618
|
}));
|
|
3559
3619
|
}
|
|
3560
3620
|
/**
|
|
@@ -10376,44 +10436,72 @@ let HeaderFreezeRenderController = (_a18 = class extends Disposable {
|
|
|
10376
10436
|
})
|
|
10377
10437
|
);
|
|
10378
10438
|
}
|
|
10439
|
+
/**
|
|
10440
|
+
* Update freeze line position when some cmds cause sk change.
|
|
10441
|
+
*/
|
|
10442
|
+
// TODO @lumixraku But there is a _zoomRefresh method? Duplicated?
|
|
10379
10443
|
_commandExecutedListener() {
|
|
10380
|
-
const updateCommandList = [SetFrozenMutation.id, SetZoomRatioOperation.id];
|
|
10381
10444
|
this.disposeWithMe(
|
|
10382
10445
|
// eslint-disable-next-line complexity
|
|
10383
10446
|
this._commandService.onCommandExecuted((command) => {
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10447
|
+
switch (command.id) {
|
|
10448
|
+
case SetFrozenMutation.id:
|
|
10449
|
+
case SetZoomRatioOperation.id:
|
|
10450
|
+
{
|
|
10451
|
+
const lastFreeze = this._lastFreeze, workbook = this._context.unit, worksheet = workbook.getActiveSheet(), params = command.params, { unitId, subUnitId } = params;
|
|
10452
|
+
if (!(unitId === workbook.getUnitId() && subUnitId === (worksheet == null ? void 0 : worksheet.getSheetId())))
|
|
10453
|
+
return;
|
|
10454
|
+
const freeze = worksheet.getConfig().freeze;
|
|
10455
|
+
if (this._lastFreeze = freeze, freeze == null)
|
|
10456
|
+
return;
|
|
10457
|
+
let resetScroll = 0;
|
|
10458
|
+
const { startRow = -1, startColumn = -1, ySplit = 0, xSplit = 0 } = freeze;
|
|
10459
|
+
(!lastFreeze || lastFreeze.startRow !== startRow || lastFreeze.ySplit !== ySplit) && (resetScroll |= 2), (!lastFreeze || lastFreeze.startColumn !== startColumn || lastFreeze.xSplit !== xSplit) && (resetScroll |= 1), params.resetScroll === !1 && (resetScroll = 0), this._refreshFreeze(startRow, startColumn, ySplit, xSplit, resetScroll);
|
|
10460
|
+
}
|
|
10461
|
+
break;
|
|
10462
|
+
case SetWorksheetRowHeightMutation.id:
|
|
10463
|
+
{
|
|
10464
|
+
const freeze = this._getFreeze(), isRefresh = freeze && command.params.ranges.some((i) => i.startRow < freeze.startRow);
|
|
10465
|
+
command.params && isRefresh && this._refreshCurrent();
|
|
10466
|
+
}
|
|
10467
|
+
break;
|
|
10468
|
+
case SetWorksheetColWidthMutation.id:
|
|
10469
|
+
{
|
|
10470
|
+
const freeze = this._getFreeze();
|
|
10471
|
+
command.params && freeze && command.params.ranges.some(
|
|
10472
|
+
(i) => i.startColumn < freeze.startColumn
|
|
10473
|
+
) && this._refreshCurrent();
|
|
10474
|
+
}
|
|
10475
|
+
break;
|
|
10476
|
+
case SetWorksheetRowAutoHeightMutation.id:
|
|
10477
|
+
{
|
|
10478
|
+
const params = command.params, freeze = this._getFreeze();
|
|
10479
|
+
if (freeze && freeze.startRow > -1 && params.rowsAutoHeightInfo.some((info) => info.row < freeze.startRow)) {
|
|
10480
|
+
const subscription = this._sheetSkeletonManagerService.currentSkeleton$.subscribe(() => {
|
|
10481
|
+
this._refreshCurrent(), setTimeout(() => {
|
|
10482
|
+
subscription.unsubscribe();
|
|
10483
|
+
});
|
|
10484
|
+
});
|
|
10485
|
+
}
|
|
10486
|
+
}
|
|
10487
|
+
break;
|
|
10488
|
+
case SetColHiddenMutation.id:
|
|
10489
|
+
case SetColVisibleMutation.id:
|
|
10490
|
+
{
|
|
10491
|
+
const params = command.params, freeze = this._getFreeze(), ranges = params.ranges;
|
|
10492
|
+
freeze && freeze.startColumn > -1 && ranges.some((range) => range.startColumn < freeze.startColumn) && this._refreshCurrent();
|
|
10493
|
+
}
|
|
10494
|
+
break;
|
|
10495
|
+
case SetRowHiddenMutation.id:
|
|
10496
|
+
case SetRowVisibleMutation.id:
|
|
10497
|
+
{
|
|
10498
|
+
const params = command.params, freeze = this._getFreeze(), ranges = params.ranges;
|
|
10499
|
+
freeze && freeze.startRow > -1 && ranges.some((range) => range.startRow < freeze.startRow) && this._refreshCurrent();
|
|
10500
|
+
}
|
|
10501
|
+
break;
|
|
10502
|
+
case SetRowHeaderWidthCommand.id:
|
|
10503
|
+
case SetColumnHeaderHeightCommand.id:
|
|
10504
|
+
this._refreshCurrent();
|
|
10417
10505
|
}
|
|
10418
10506
|
})
|
|
10419
10507
|
);
|
|
@@ -10464,8 +10552,7 @@ let HeaderFreezeRenderController = (_a18 = class extends Disposable {
|
|
|
10464
10552
|
return getSheetObject(this._context.unit, this._context);
|
|
10465
10553
|
}
|
|
10466
10554
|
/**
|
|
10467
|
-
*
|
|
10468
|
-
* 但是窗口 resize 并不会进入
|
|
10555
|
+
* Core function of _refreshCurrent
|
|
10469
10556
|
* @param startRow
|
|
10470
10557
|
* @param startColumn
|
|
10471
10558
|
* @param ySplit
|
|
@@ -13452,7 +13539,7 @@ function DefinedName({ disable }) {
|
|
|
13452
13539
|
] });
|
|
13453
13540
|
}
|
|
13454
13541
|
__name(DefinedName, "DefinedName");
|
|
13455
|
-
const formulaBox = "univer-formula-box", nameRanges = "univer-name-ranges", formulaBar = "univer-formula-bar", formulaIcon = "univer-formula-icon", formulaIconDisable = "univer-formula-icon-disable", formulaIconWrapper = "univer-formula-icon-wrapper", iconContainer = "univer-icon-container", iconContainerSuccess = "univer-icon-container-success", formulaActive = "univer-formula-active", iconContainerError = "univer-icon-container-error", iconContainerFx = "univer-icon-container-fx", formulaInput = "univer-formula-input", formulaContainer = "univer-formula-container", sheetEmbeddingFormulaEditorWrap = "univer-sheet-embedding-formula-editor-wrap", formulaContent = "univer-formula-content", arrowContainer = "univer-arrow-container", arrowContainerDisable = "univer-arrow-container-disable", styles$f = {
|
|
13542
|
+
const formulaBox = "univer-formula-box", nameRanges = "univer-name-ranges", formulaBar = "univer-formula-bar", formulaIcon = "univer-formula-icon", formulaIconDisable = "univer-formula-icon-disable", formulaIconWrapper = "univer-formula-icon-wrapper", iconContainer = "univer-icon-container", iconContainerSuccess = "univer-icon-container-success", formulaActive = "univer-formula-active", iconContainerError = "univer-icon-container-error", iconContainerFx = "univer-icon-container-fx", formulaInput = "univer-formula-input", formulaInputMask = "univer-formula-input-mask", formulaContainer = "univer-formula-container", sheetEmbeddingFormulaEditorWrap = "univer-sheet-embedding-formula-editor-wrap", formulaContent = "univer-formula-content", arrowContainer = "univer-arrow-container", arrowContainerDisable = "univer-arrow-container-disable", styles$f = {
|
|
13456
13543
|
formulaBox,
|
|
13457
13544
|
nameRanges,
|
|
13458
13545
|
formulaBar,
|
|
@@ -13465,6 +13552,7 @@ const formulaBox = "univer-formula-box", nameRanges = "univer-name-ranges", form
|
|
|
13465
13552
|
iconContainerError,
|
|
13466
13553
|
iconContainerFx,
|
|
13467
13554
|
formulaInput,
|
|
13555
|
+
formulaInputMask,
|
|
13468
13556
|
formulaContainer,
|
|
13469
13557
|
sheetEmbeddingFormulaEditorWrap,
|
|
13470
13558
|
formulaContent,
|
|
@@ -13472,21 +13560,17 @@ const formulaBox = "univer-formula-box", nameRanges = "univer-name-ranges", form
|
|
|
13472
13560
|
arrowContainerDisable
|
|
13473
13561
|
};
|
|
13474
13562
|
function FormulaBar() {
|
|
13475
|
-
var _a61;
|
|
13563
|
+
var _a61, _b;
|
|
13476
13564
|
const [iconStyle, setIconStyle] = useState(styles$f.formulaGrey), [arrowDirection, setArrowDirection] = useState(
|
|
13477
13565
|
0
|
|
13478
13566
|
/* Down */
|
|
13479
|
-
), formulaEditorManagerService = useDependency(IFormulaEditorManagerService), editorBridgeService = useDependency(IEditorBridgeService), worksheetProtectionRuleModel = useDependency(WorksheetProtectionRuleModel), rangeProtectionRuleModel = useDependency(RangeProtectionRuleModel), univerInstanceService = useDependency(IUniverInstanceService), selectionManager = useDependency(SheetsSelectionsService), permissionService = useDependency(IPermissionService),
|
|
13567
|
+
), formulaEditorManagerService = useDependency(IFormulaEditorManagerService), editorBridgeService = useDependency(IEditorBridgeService), worksheetProtectionRuleModel = useDependency(WorksheetProtectionRuleModel), rangeProtectionRuleModel = useDependency(RangeProtectionRuleModel), univerInstanceService = useDependency(IUniverInstanceService), selectionManager = useDependency(SheetsSelectionsService), permissionService = useDependency(IPermissionService), rangeProtectionCache = useDependency(RangeProtectionCache), [disableInfo, setDisableInfo] = useState({
|
|
13568
|
+
editDisable: !1,
|
|
13569
|
+
viewDisable: !1
|
|
13570
|
+
}), [imageDisable, setImageDisable] = useState(!1), currentWorkbook = useActiveWorkbook(), componentManager = useDependency(ComponentManager), workbook = useObservable$1(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET), void 0, void 0, []), isRefSelecting = useRef(0), editState = editorBridgeService.getEditLocation(), keyCodeConfig = useKeyEventConfig(isRefSelecting, (_a61 = editState == null ? void 0 : editState.unitId) != null ? _a61 : ""), FormulaEditor = componentManager.get(EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY), formulaAuxUIParts = useComponentsOfPart(SheetsUIPart.FORMULA_AUX), contextService = useDependency(IContextService);
|
|
13480
13571
|
useObservable$1(useMemo(() => contextService.subscribeContextValue$(FOCUSING_FX_BAR_EDITOR), [contextService]));
|
|
13481
|
-
const isFocusFxBar = contextService.getContextValue(FOCUSING_FX_BAR_EDITOR), ref = useRef(null);
|
|
13482
|
-
|
|
13483
|
-
return [
|
|
13484
|
-
new WorkbookEditablePermission(unitId).id,
|
|
13485
|
-
new WorksheetSetCellValuePermission(unitId, subUnitId).id,
|
|
13486
|
-
new WorksheetEditPermission(unitId, subUnitId).id
|
|
13487
|
-
];
|
|
13488
|
-
}
|
|
13489
|
-
__name(getPermissionIds, "getPermissionIds"), useLayoutEffect(() => {
|
|
13572
|
+
const isFocusFxBar = contextService.getContextValue(FOCUSING_FX_BAR_EDITOR), ref = useRef(null), editorService = useDependency(IEditorService);
|
|
13573
|
+
useLayoutEffect(() => {
|
|
13490
13574
|
const subscription = workbook.activeSheet$.pipe(
|
|
13491
13575
|
switchMap((worksheet) => worksheet ? merge(
|
|
13492
13576
|
worksheetProtectionRuleModel.ruleChange$,
|
|
@@ -13495,17 +13579,39 @@ function FormulaBar() {
|
|
|
13495
13579
|
selectionManager.selectionSet$
|
|
13496
13580
|
).pipe(
|
|
13497
13581
|
switchMap(() => {
|
|
13498
|
-
var _a62,
|
|
13499
|
-
const
|
|
13582
|
+
var _a62, _b2;
|
|
13583
|
+
const unitId2 = workbook.getUnitId(), subUnitId = worksheet.getSheetId();
|
|
13500
13584
|
if (!((_a62 = selectionManager.getCurrentLastSelection()) == null ? void 0 : _a62.range)) return EMPTY;
|
|
13501
|
-
const
|
|
13502
|
-
return
|
|
13503
|
-
|
|
13504
|
-
|
|
13585
|
+
const primary = (_b2 = selectionManager.getCurrentLastSelection()) == null ? void 0 : _b2.primary;
|
|
13586
|
+
return primary ? of({
|
|
13587
|
+
unitId: unitId2,
|
|
13588
|
+
subUnitId,
|
|
13589
|
+
primary
|
|
13590
|
+
}) : of(null);
|
|
13505
13591
|
})
|
|
13506
13592
|
) : EMPTY)
|
|
13507
|
-
).subscribe((
|
|
13508
|
-
|
|
13593
|
+
).subscribe((cellInfo) => {
|
|
13594
|
+
var _a62, _b2, _c, _d, _e, _f;
|
|
13595
|
+
if (cellInfo) {
|
|
13596
|
+
const { unitId: unitId2, subUnitId, primary } = cellInfo;
|
|
13597
|
+
if (worksheetProtectionRuleModel.getRule(unitId2, subUnitId)) {
|
|
13598
|
+
const editDisable2 = !((_b2 = (_a62 = permissionService.getPermissionPoint(new WorksheetEditPermission(unitId2, subUnitId).id)) == null ? void 0 : _a62.value) == null || _b2), viewDisable2 = !((_d = (_c = permissionService.getPermissionPoint(new WorksheetViewPermission(unitId2, subUnitId).id)) == null ? void 0 : _c.value) == null || _d);
|
|
13599
|
+
setDisableInfo({
|
|
13600
|
+
viewDisable: viewDisable2,
|
|
13601
|
+
editDisable: editDisable2
|
|
13602
|
+
});
|
|
13603
|
+
return;
|
|
13604
|
+
}
|
|
13605
|
+
const { actualRow, actualColumn } = primary, cellInfoWithPermission = rangeProtectionCache.getCellInfo(unitId2, subUnitId, actualRow, actualColumn);
|
|
13606
|
+
setDisableInfo({
|
|
13607
|
+
editDisable: !((_e = cellInfoWithPermission == null ? void 0 : cellInfoWithPermission[UnitAction.Edit]) == null || _e),
|
|
13608
|
+
viewDisable: !((_f = cellInfoWithPermission == null ? void 0 : cellInfoWithPermission[UnitAction.View]) == null || _f)
|
|
13609
|
+
});
|
|
13610
|
+
} else
|
|
13611
|
+
setDisableInfo({
|
|
13612
|
+
viewDisable: !1,
|
|
13613
|
+
editDisable: !1
|
|
13614
|
+
});
|
|
13509
13615
|
});
|
|
13510
13616
|
return () => {
|
|
13511
13617
|
subscription.unsubscribe();
|
|
@@ -13517,8 +13623,8 @@ function FormulaBar() {
|
|
|
13517
13623
|
return () => subscription.unsubscribe();
|
|
13518
13624
|
}, [editorBridgeService.visible$]), useEffect(() => {
|
|
13519
13625
|
const subscription = editorBridgeService.currentEditCellState$.subscribe((state) => {
|
|
13520
|
-
var _a62,
|
|
13521
|
-
(_c = (
|
|
13626
|
+
var _a62, _b2, _c;
|
|
13627
|
+
(_c = (_b2 = (_a62 = state == null ? void 0 : state.documentLayoutObject.documentModel) == null ? void 0 : _a62.getBody()) == null ? void 0 : _b2.customBlocks) != null && _c.length ? setImageDisable(!0) : setImageDisable(!1);
|
|
13522
13628
|
});
|
|
13523
13629
|
return () => subscription.unsubscribe();
|
|
13524
13630
|
}, [editorBridgeService.currentEditCellState$]), useEffect(() => {
|
|
@@ -13567,17 +13673,36 @@ function FormulaBar() {
|
|
|
13567
13673
|
formulaEditorManagerService.handleFxBtnClick(!0);
|
|
13568
13674
|
}
|
|
13569
13675
|
__name(handlerFxBtnClick, "handlerFxBtnClick");
|
|
13570
|
-
const disabled =
|
|
13676
|
+
const { viewDisable, editDisable } = disableInfo, disabled = editDisable || imageDisable, shouldSkipFocus = useRef(!1), commandService = useDependency(ICommandService);
|
|
13677
|
+
(_b = currentWorkbook == null ? void 0 : currentWorkbook.getUnitId()) != null;
|
|
13678
|
+
const handlePointerDown = /* @__PURE__ */ __name(() => {
|
|
13679
|
+
try {
|
|
13680
|
+
editorBridgeService.isVisible().visible === !1 && commandService.syncExecuteCommand(
|
|
13681
|
+
SetCellEditVisibleOperation.id,
|
|
13682
|
+
{
|
|
13683
|
+
visible: !0,
|
|
13684
|
+
eventType: DeviceInputEventType.PointerDown,
|
|
13685
|
+
unitId: DOCS_NORMAL_EDITOR_UNIT_ID_KEY
|
|
13686
|
+
}
|
|
13687
|
+
), contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, !0);
|
|
13688
|
+
} catch (e) {
|
|
13689
|
+
throw shouldSkipFocus.current = !0, e;
|
|
13690
|
+
}
|
|
13691
|
+
}, "handlePointerDown"), handlePointerUp = /* @__PURE__ */ __name((e) => {
|
|
13692
|
+
shouldSkipFocus.current && setTimeout(() => {
|
|
13693
|
+
editorService.blur(!0);
|
|
13694
|
+
}, 30), shouldSkipFocus.current = !1;
|
|
13695
|
+
}, "handlePointerUp");
|
|
13571
13696
|
return /* @__PURE__ */ jsxs(
|
|
13572
13697
|
"div",
|
|
13573
13698
|
{
|
|
13574
13699
|
className: styles$f.formulaBox,
|
|
13575
13700
|
style: {
|
|
13576
13701
|
height: arrowDirection === 0 ? "28px" : "82px",
|
|
13577
|
-
pointerEvents:
|
|
13702
|
+
pointerEvents: editDisable ? "none" : "auto"
|
|
13578
13703
|
},
|
|
13579
13704
|
children: [
|
|
13580
|
-
/* @__PURE__ */ jsx("div", { className: styles$f.nameRanges, children: /* @__PURE__ */ jsx(DefinedName, { disable }) }),
|
|
13705
|
+
/* @__PURE__ */ jsx("div", { className: styles$f.nameRanges, children: /* @__PURE__ */ jsx(DefinedName, { disable: editDisable }) }),
|
|
13581
13706
|
/* @__PURE__ */ jsxs("div", { className: styles$f.formulaBar, children: [
|
|
13582
13707
|
/* @__PURE__ */ jsx("div", { className: clsx(styles$f.formulaIcon, { [styles$f.formulaIconDisable]: disabled }), children: /* @__PURE__ */ jsxs("div", { className: styles$f.formulaIconWrapper, children: [
|
|
13583
13708
|
/* @__PURE__ */ jsx(
|
|
@@ -13599,30 +13724,39 @@ function FormulaBar() {
|
|
|
13599
13724
|
/* @__PURE__ */ jsx("span", { className: clsx(styles$f.iconContainer, styles$f.iconContainerFx), onClick: handlerFxBtnClick, children: /* @__PURE__ */ jsx(FxSingle, {}) })
|
|
13600
13725
|
] }) }),
|
|
13601
13726
|
/* @__PURE__ */ jsxs("div", { className: styles$f.formulaContainer, children: [
|
|
13602
|
-
/* @__PURE__ */ jsx(
|
|
13603
|
-
|
|
13727
|
+
/* @__PURE__ */ jsx(
|
|
13728
|
+
"div",
|
|
13604
13729
|
{
|
|
13605
|
-
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13730
|
+
className: styles$f.formulaInput,
|
|
13731
|
+
onPointerDown: handlePointerDown,
|
|
13732
|
+
onPointerUp: handlePointerUp,
|
|
13733
|
+
ref,
|
|
13734
|
+
children: FormulaEditor && /* @__PURE__ */ jsx(
|
|
13735
|
+
FormulaEditor,
|
|
13736
|
+
{
|
|
13737
|
+
disableSelectionOnClick: !0,
|
|
13738
|
+
editorId: DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,
|
|
13739
|
+
initValue: "",
|
|
13740
|
+
onChange: /* @__PURE__ */ __name(() => {
|
|
13741
|
+
}, "onChange"),
|
|
13742
|
+
isFocus: isFocusFxBar,
|
|
13743
|
+
className: styles$f.formulaContent,
|
|
13744
|
+
unitId: editState == null ? void 0 : editState.unitId,
|
|
13745
|
+
subUnitId: editState == null ? void 0 : editState.sheetId,
|
|
13746
|
+
isSupportAcrossSheet: !0,
|
|
13747
|
+
resetSelectionOnBlur: !1,
|
|
13748
|
+
isSingle: !1,
|
|
13749
|
+
keyboradEventConfig: keyCodeConfig,
|
|
13750
|
+
onFormulaSelectingChange: /* @__PURE__ */ __name((isSelecting) => {
|
|
13751
|
+
isRefSelecting.current = isSelecting, isSelecting ? editorBridgeService.enableForceKeepVisible() : editorBridgeService.disableForceKeepVisible();
|
|
13752
|
+
}, "onFormulaSelectingChange"),
|
|
13753
|
+
autoScrollbar: !1,
|
|
13754
|
+
disableContextMenu: !1
|
|
13755
|
+
}
|
|
13756
|
+
)
|
|
13623
13757
|
}
|
|
13624
|
-
)
|
|
13625
|
-
/* @__PURE__ */ jsx("div", { className: clsx(styles$f.arrowContainer, { [styles$f.arrowContainerDisable]:
|
|
13758
|
+
),
|
|
13759
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$f.arrowContainer, { [styles$f.arrowContainerDisable]: editDisable }), onClick: handleArrowClick, children: arrowDirection === 0 ? /* @__PURE__ */ jsx(DropdownSingle, {}) : /* @__PURE__ */ jsx(DropdownSingle, { style: { transform: "rotateZ(180deg)" } }) })
|
|
13626
13760
|
] })
|
|
13627
13761
|
] }),
|
|
13628
13762
|
/* @__PURE__ */ jsx(ComponentContainer, { components: formulaAuxUIParts }, "formula-aux")
|
|
@@ -16660,7 +16794,9 @@ let SheetUIController = (_a22 = class extends Disposable {
|
|
|
16660
16794
|
DeleteRangeProtectionFromContextMenuCommand,
|
|
16661
16795
|
SetRangeProtectionFromContextMenuCommand,
|
|
16662
16796
|
DeleteWorksheetProtectionFormSheetBarCommand,
|
|
16663
|
-
SetWorksheetColAutoWidthCommand
|
|
16797
|
+
SetWorksheetColAutoWidthCommand,
|
|
16798
|
+
SetRowHeaderWidthCommand,
|
|
16799
|
+
SetColumnHeaderHeightCommand
|
|
16664
16800
|
].forEach((c) => {
|
|
16665
16801
|
this.disposeWithMe(this._commandService.registerCommand(c));
|
|
16666
16802
|
});
|
|
@@ -22315,7 +22451,7 @@ let FormulaEditorController = (_a51 = class extends RxDisposable {
|
|
|
22315
22451
|
if (formulaEditorDocObject == null)
|
|
22316
22452
|
return;
|
|
22317
22453
|
const { mainComponent: documentComponent } = formulaEditorDocObject;
|
|
22318
|
-
documentComponent != null && (this._loadedMap.has(documentComponent) ||
|
|
22454
|
+
documentComponent != null && (this._loadedMap.has(documentComponent) || this._loadedMap.add(documentComponent));
|
|
22319
22455
|
}
|
|
22320
22456
|
_listenFxBtnClick() {
|
|
22321
22457
|
this._formulaEditorManagerService.fxBtnClick$.pipe(takeUntil(this.dispose$)).subscribe(() => {
|
|
@@ -22325,11 +22461,14 @@ let FormulaEditorController = (_a51 = class extends RxDisposable {
|
|
|
22325
22461
|
const currentSheet = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), formulaEditorDataModel = this._univerInstanceService.getUniverDocInstance(
|
|
22326
22462
|
DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY
|
|
22327
22463
|
);
|
|
22328
|
-
this._editorBridgeService.isVisible().visible === !1 && this.
|
|
22329
|
-
|
|
22330
|
-
|
|
22331
|
-
|
|
22332
|
-
|
|
22464
|
+
this._editorBridgeService.isVisible().visible === !1 && this._commandService.syncExecuteCommand(
|
|
22465
|
+
SetCellEditVisibleOperation.id,
|
|
22466
|
+
{
|
|
22467
|
+
visible: !0,
|
|
22468
|
+
eventType: DeviceInputEventType.PointerDown,
|
|
22469
|
+
unitId: (_a61 = currentSheet == null ? void 0 : currentSheet.getUnitId()) != null ? _a61 : ""
|
|
22470
|
+
}
|
|
22471
|
+
);
|
|
22333
22472
|
const content = (_b = formulaEditorDataModel == null ? void 0 : formulaEditorDataModel.getBody()) == null ? void 0 : _b.dataStream;
|
|
22334
22473
|
if (content == null)
|
|
22335
22474
|
return;
|
|
@@ -22351,22 +22490,6 @@ let FormulaEditorController = (_a51 = class extends RxDisposable {
|
|
|
22351
22490
|
}
|
|
22352
22491
|
});
|
|
22353
22492
|
}
|
|
22354
|
-
_initialMain(unitId) {
|
|
22355
|
-
const formulaEditorDocObject = this._renderManagerService.getRenderById(unitId);
|
|
22356
|
-
if (formulaEditorDocObject == null)
|
|
22357
|
-
return;
|
|
22358
|
-
const { mainComponent: documentComponent } = formulaEditorDocObject;
|
|
22359
|
-
documentComponent != null && this.disposeWithMe(
|
|
22360
|
-
documentComponent.onPointerDown$.subscribeEvent(() => {
|
|
22361
|
-
this._editorBridgeService.isVisible().visible === !1 && (this._editorBridgeService.changeVisible({
|
|
22362
|
-
visible: !0,
|
|
22363
|
-
eventType: DeviceInputEventType.PointerDown,
|
|
22364
|
-
unitId
|
|
22365
|
-
}), this._undoRedoService.clearUndoRedo(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)), this._contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, !0);
|
|
22366
|
-
})
|
|
22367
|
-
);
|
|
22368
|
-
}
|
|
22369
|
-
// Listen to changes in the size of the formula editor container to set the size of the editor.
|
|
22370
22493
|
_syncEditorSize() {
|
|
22371
22494
|
const addFOrmulaBar$ = this._univerInstanceService.unitAdded$.pipe(filter((unit) => unit.getUnitId() === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY));
|
|
22372
22495
|
this.disposeWithMe(combineLatest([this._formulaEditorManagerService.position$, addFOrmulaBar$]).subscribe(([position]) => {
|
|
@@ -22960,7 +23083,7 @@ let EditorBridgeRenderController = (_a56 = class extends RxDisposable {
|
|
|
22960
23083
|
}
|
|
22961
23084
|
_showEditorByKeyboard(config) {
|
|
22962
23085
|
const event = config == null ? void 0 : config.event;
|
|
22963
|
-
config == null || !event.data && event.inputType !== "InsertParagraph" || this._commandService.
|
|
23086
|
+
config == null || !event.data && event.inputType !== "InsertParagraph" || this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
|
|
22964
23087
|
visible: !0,
|
|
22965
23088
|
eventType: DeviceInputEventType.Keyboard,
|
|
22966
23089
|
keycode: event.which,
|
|
@@ -23946,6 +24069,7 @@ export {
|
|
|
23946
24069
|
SetCellEditVisibleOperation,
|
|
23947
24070
|
SetCellEditVisibleWithF2Operation,
|
|
23948
24071
|
SetColumnFrozenCommand,
|
|
24072
|
+
SetColumnHeaderHeightCommand,
|
|
23949
24073
|
SetFormatPainterOperation,
|
|
23950
24074
|
SetInfiniteFormatPainterCommand,
|
|
23951
24075
|
SetOnceFormatPainterCommand,
|
|
@@ -23960,6 +24084,7 @@ export {
|
|
|
23960
24084
|
SetRangeTextColorCommand,
|
|
23961
24085
|
SetRangeUnderlineCommand,
|
|
23962
24086
|
SetRowFrozenCommand,
|
|
24087
|
+
SetRowHeaderWidthCommand,
|
|
23963
24088
|
SetScrollOperation,
|
|
23964
24089
|
SetScrollRelativeCommand,
|
|
23965
24090
|
SetSelectionFrozenCommand,
|