@univerjs/sheets-ui 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +288 -20
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +1 -1276
- package/lib/es/index.js +288 -25637
- package/lib/es/locale/ca-ES.js +1 -463
- package/lib/es/locale/en-US.js +1 -465
- package/lib/es/locale/es-ES.js +1 -463
- package/lib/es/locale/fa-IR.js +1 -465
- package/lib/es/locale/fr-FR.js +1 -465
- package/lib/es/locale/ja-JP.js +1 -463
- package/lib/es/locale/ko-KR.js +1 -463
- package/lib/es/locale/ru-RU.js +1 -463
- package/lib/es/locale/sk-SK.js +1 -463
- package/lib/es/locale/vi-VN.js +1 -463
- package/lib/es/locale/zh-CN.js +1 -464
- package/lib/es/locale/zh-TW.js +1 -464
- package/lib/facade.js +1 -1276
- package/lib/index.css +1215 -1
- package/lib/index.js +288 -25637
- package/lib/locale/ca-ES.js +1 -463
- package/lib/locale/en-US.js +1 -465
- package/lib/locale/es-ES.js +1 -463
- package/lib/locale/fa-IR.js +1 -465
- package/lib/locale/fr-FR.js +1 -465
- package/lib/locale/ja-JP.js +1 -463
- package/lib/locale/ko-KR.js +1 -463
- package/lib/locale/ru-RU.js +1 -463
- package/lib/locale/sk-SK.js +1 -463
- package/lib/locale/vi-VN.js +1 -463
- package/lib/locale/zh-CN.js +1 -464
- package/lib/locale/zh-TW.js +1 -464
- package/lib/types/basics/editor/get-editor-object.d.ts +17 -2
- package/lib/types/basics/editor/range.d.ts +17 -2
- package/lib/types/commands/commands/clipboard.command.d.ts +16 -1
- package/lib/types/commands/commands/delete-range-move-left-confirm.command.d.ts +16 -1
- package/lib/types/commands/commands/delete-range-move-up-confirm.command.d.ts +16 -1
- package/lib/types/commands/commands/headersize-changed.command.d.ts +16 -1
- package/lib/types/commands/commands/hide-row-col-confirm.command.d.ts +16 -1
- package/lib/types/commands/commands/inline-format.command.d.ts +16 -1
- package/lib/types/commands/commands/insert-range-move-down-confirm.command.d.ts +16 -1
- package/lib/types/commands/commands/insert-range-move-right-confirm.command.d.ts +16 -1
- package/lib/types/commands/commands/range-protection.command.d.ts +17 -2
- package/lib/types/commands/commands/remove-row-col-confirm.command.d.ts +16 -1
- package/lib/types/commands/commands/remove-sheet-confirm.command.d.ts +16 -1
- package/lib/types/commands/commands/set-format-painter.command.d.ts +16 -1
- package/lib/types/commands/commands/set-frozen.command.d.ts +16 -1
- package/lib/types/commands/commands/set-scroll.command.d.ts +16 -1
- package/lib/types/commands/commands/set-selection.command.d.ts +17 -1
- package/lib/types/commands/commands/set-worksheet-auto-col-width.command.d.ts +16 -1
- package/lib/types/commands/commands/set-zoom-ratio.command.d.ts +16 -1
- package/lib/types/commands/commands/unhide.command.d.ts +16 -1
- package/lib/types/commands/commands/utils/selection-utils.d.ts +17 -1
- package/lib/types/commands/commands/worksheet-protection.command.d.ts +16 -1
- package/lib/types/commands/operations/activate-cell-edit.operation.d.ts +17 -2
- package/lib/types/commands/operations/cell-edit.operation.d.ts +17 -2
- package/lib/types/commands/operations/rename-sheet.operation.d.ts +16 -1
- package/lib/types/commands/operations/scroll-to-range.operation.d.ts +17 -2
- package/lib/types/commands/operations/scroll.operation.d.ts +17 -2
- package/lib/types/commands/operations/set-format-painter.operation.d.ts +17 -2
- package/lib/types/commands/operations/set-zoom-ratio.operation.d.ts +16 -1
- package/lib/types/commands/operations/sheet-permission-open-dialog.operation.d.ts +16 -1
- package/lib/types/commands/operations/sheet-permission-open-panel.operation.d.ts +17 -2
- package/lib/types/commands/operations/sidebar-defined-name.operation.d.ts +16 -1
- package/lib/types/common/utils.d.ts +22 -7
- package/lib/types/components/border-panel/BorderPanel.d.ts +16 -1
- package/lib/types/components/border-panel/border-line/BorderLine.d.ts +15 -0
- package/lib/types/components/border-panel/interface.d.ts +17 -2
- package/lib/types/components/hook.d.ts +17 -2
- package/lib/types/components/menu-item-frozen/MenuItemFrozen.d.ts +16 -1
- package/lib/types/components/menu-item-frozen/interface.d.ts +16 -1
- package/lib/types/components/menu-item-input/MenuItemInput.d.ts +16 -1
- package/lib/types/components/menu-item-input/interface.d.ts +17 -2
- package/lib/types/config/config.d.ts +19 -4
- package/lib/types/consts/mobile-context.d.ts +5 -0
- package/lib/types/consts/permission.d.ts +15 -0
- package/lib/types/controllers/auto-fill-ui.controller.d.ts +15 -0
- package/lib/types/controllers/auto-height.controller.d.ts +18 -2
- package/lib/types/controllers/auto-width.controller.d.ts +20 -4
- package/lib/types/controllers/cell-alert.controller.d.ts +18 -2
- package/lib/types/controllers/cell-custom-render.controller.d.ts +18 -2
- package/lib/types/controllers/cell-popup-editor.controller.d.ts +18 -2
- package/lib/types/controllers/checkbox.controller.d.ts +15 -0
- package/lib/types/controllers/clipboard/clipboard.controller.d.ts +16 -1
- package/lib/types/controllers/clipboard/utils.d.ts +19 -3
- package/lib/types/controllers/defined-name/defined-name.controller.d.ts +15 -0
- package/lib/types/controllers/drag-render.controller.d.ts +19 -2
- package/lib/types/controllers/editor/data-sync.controller.d.ts +15 -0
- package/lib/types/controllers/editor/editing.render-controller.d.ts +17 -1
- package/lib/types/controllers/editor/formula-editor.controller.d.ts +15 -0
- package/lib/types/controllers/force-string-alert-render.controller.d.ts +18 -2
- package/lib/types/controllers/force-string-render.controller.d.ts +18 -2
- package/lib/types/controllers/format-painter/format-painter.controller.d.ts +15 -0
- package/lib/types/controllers/hover-render.controller.d.ts +18 -2
- package/lib/types/controllers/mark-selection.controller.d.ts +18 -2
- package/lib/types/controllers/mobile/mobile-sheet-ui.controller.d.ts +15 -0
- package/lib/types/controllers/move-range.controller.d.ts +18 -2
- package/lib/types/controllers/permission/sheet-permission-check-ui.controller.d.ts +15 -0
- package/lib/types/controllers/permission/sheet-permission-init-ui.controller.d.ts +15 -0
- package/lib/types/controllers/permission/sheet-permission-interceptor-canvas-render.controller.d.ts +18 -2
- package/lib/types/controllers/permission/sheet-permission-interceptor-clipboard.controller.d.ts +15 -0
- package/lib/types/controllers/permission/sheet-permission-interceptor-formula-render.controller.d.ts +18 -2
- package/lib/types/controllers/permission/sheet-permission-render.controller.d.ts +19 -2
- package/lib/types/controllers/render-controllers/clipboard.render-controller.d.ts +18 -2
- package/lib/types/controllers/render-controllers/contextmenu.render-controller.d.ts +18 -2
- package/lib/types/controllers/render-controllers/editor-bridge.render-controller.d.ts +19 -2
- package/lib/types/controllers/render-controllers/format-painter.render-controller.d.ts +18 -2
- package/lib/types/controllers/render-controllers/freeze.render-controller.d.ts +20 -4
- package/lib/types/controllers/render-controllers/header-menu.render-controller.d.ts +18 -2
- package/lib/types/controllers/render-controllers/header-move.render-controller.d.ts +20 -4
- package/lib/types/controllers/render-controllers/header-resize.render-controller.d.ts +20 -4
- package/lib/types/controllers/render-controllers/header-unhide.render-controller.d.ts +18 -2
- package/lib/types/controllers/render-controllers/mobile/mobile-contextmenu.render-controller.d.ts +43 -6
- package/lib/types/controllers/render-controllers/mobile/mobile-header-resize.render-controller.d.ts +18 -2
- package/lib/types/controllers/render-controllers/mobile/mobile-scroll.render-controller.d.ts +19 -2
- package/lib/types/controllers/render-controllers/scroll.render-controller.d.ts +19 -2
- package/lib/types/controllers/render-controllers/sheet.render-controller.d.ts +19 -3
- package/lib/types/controllers/render-controllers/skeleton.render-controller.d.ts +19 -2
- package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +18 -2
- package/lib/types/controllers/sheet-ui.controller.d.ts +15 -0
- package/lib/types/controllers/shortcuts/copy-fill.shortcut.d.ts +18 -0
- package/lib/types/controllers/shortcuts/editor.shortcut.d.ts +17 -1
- package/lib/types/controllers/shortcuts/operation.shortcut.d.ts +16 -1
- package/lib/types/controllers/shortcuts/selection.shortcut.d.ts +17 -2
- package/lib/types/controllers/shortcuts/style.shortcut.d.ts +16 -1
- package/lib/types/controllers/shortcuts/utils.d.ts +16 -1
- package/lib/types/controllers/shortcuts/value.shortcut.d.ts +16 -1
- package/lib/types/controllers/shortcuts/view.shortcut.d.ts +16 -1
- package/lib/types/controllers/status-bar.controller.d.ts +21 -4
- package/lib/types/controllers/utils/char-tools.d.ts +16 -1
- package/lib/types/controllers/utils/component-tools.d.ts +18 -2
- package/lib/types/controllers/utils/range-tools.d.ts +17 -2
- package/lib/types/controllers/utils/selections-tools.d.ts +19 -3
- package/lib/types/facade/f-enum.d.ts +15 -0
- package/lib/types/facade/f-event.d.ts +22 -7
- package/lib/types/facade/f-permission.d.ts +15 -0
- package/lib/types/facade/f-range.d.ts +21 -4
- package/lib/types/facade/f-sheet-hooks.d.ts +18 -2
- package/lib/types/facade/f-univer.d.ts +18 -3
- package/lib/types/facade/f-workbook.d.ts +20 -5
- package/lib/types/facade/f-worksheet.d.ts +22 -5
- package/lib/types/hooks/use-highlight-range.d.ts +16 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/locale/ca-ES.d.ts +16 -1
- package/lib/types/locale/es-ES.d.ts +16 -1
- package/lib/types/locale/fa-IR.d.ts +16 -1
- package/lib/types/locale/fr-FR.d.ts +16 -1
- package/lib/types/locale/ja-JP.d.ts +16 -1
- package/lib/types/locale/ko-KR.d.ts +16 -1
- package/lib/types/locale/ru-RU.d.ts +16 -1
- package/lib/types/locale/sk-SK.d.ts +16 -1
- package/lib/types/locale/vi-VN.d.ts +16 -1
- package/lib/types/locale/zh-CN.d.ts +16 -1
- package/lib/types/locale/zh-TW.d.ts +16 -1
- package/lib/types/menu/border.menu.d.ts +18 -3
- package/lib/types/menu/clear.menu.d.ts +17 -2
- package/lib/types/menu/delete.menu.d.ts +17 -2
- package/lib/types/menu/font.menu.d.ts +18 -2
- package/lib/types/menu/frozen.menu.d.ts +17 -2
- package/lib/types/menu/gridlines.menu.d.ts +17 -2
- package/lib/types/menu/header-menu-shape.d.ts +17 -1
- package/lib/types/menu/insert.menu.d.ts +17 -2
- package/lib/types/menu/menu-util.d.ts +18 -2
- package/lib/types/menu/menu.d.ts +18 -2
- package/lib/types/menu/merge.menu.d.ts +17 -2
- package/lib/types/menu/mobile-menu.d.ts +16 -2
- package/lib/types/menu/permission-menu-util.d.ts +25 -10
- package/lib/types/menu/permission.menu.d.ts +17 -2
- package/lib/types/menu/schema.d.ts +16 -1
- package/lib/types/menu/sheet.menu.d.ts +17 -2
- package/lib/types/menu/text-to-number.menu.d.ts +17 -2
- package/lib/types/menu/utils.d.ts +17 -2
- package/lib/types/mobile-plugin.d.ts +16 -1
- package/lib/types/plugin.d.ts +16 -1
- package/lib/types/services/auto-height.service.d.ts +19 -3
- package/lib/types/services/canvas-pop-manager.service.d.ts +23 -4
- package/lib/types/services/cell-alert-manager.service.d.ts +19 -3
- package/lib/types/services/cell-dropdown-manager.service.d.ts +20 -4
- package/lib/types/services/cell-popup-manager.service.d.ts +21 -4
- package/lib/types/services/clipboard/clipboard.service.d.ts +22 -5
- package/lib/types/services/clipboard/clone.d.ts +17 -2
- package/lib/types/services/clipboard/copy-content-cache.d.ts +19 -4
- package/lib/types/services/clipboard/html-to-usm/converter.d.ts +19 -4
- package/lib/types/services/clipboard/html-to-usm/parse-node-style.d.ts +16 -1
- package/lib/types/services/clipboard/html-to-usm/paste-plugins/plugin-lark.d.ts +16 -1
- package/lib/types/services/clipboard/html-to-usm/paste-plugins/plugin-univer.d.ts +16 -1
- package/lib/types/services/clipboard/html-to-usm/paste-plugins/plugin-word.d.ts +16 -1
- package/lib/types/services/clipboard/html-to-usm/paste-plugins/type.d.ts +16 -1
- package/lib/types/services/clipboard/html-to-usm/utils.d.ts +22 -7
- package/lib/types/services/clipboard/type.d.ts +25 -3
- package/lib/types/services/clipboard/usm-to-html/convertor.d.ts +18 -3
- package/lib/types/services/clipboard/utils.d.ts +17 -2
- package/lib/types/services/drag-manager.service.d.ts +22 -5
- package/lib/types/services/editor/cell-editor-manager.service.d.ts +18 -3
- package/lib/types/services/editor/cell-editor-resize.service.d.ts +15 -0
- package/lib/types/services/editor/formula-editor-manager.service.d.ts +18 -3
- package/lib/types/services/editor-bridge.service.d.ts +23 -5
- package/lib/types/services/format-painter/format-painter.service.d.ts +19 -3
- package/lib/types/services/hover-manager.service.d.ts +39 -22
- package/lib/types/services/mark-selection/mark-selection.service.d.ts +17 -2
- package/lib/types/services/permission/sheet-permission-panel.model.d.ts +17 -2
- package/lib/types/services/permission/sheet-permission-render-manager.service.d.ts +16 -1
- package/lib/types/services/permission/sheet-permission-user-list.service.d.ts +18 -3
- package/lib/types/services/print-interceptor.service.d.ts +21 -5
- package/lib/types/services/scroll-manager.service.d.ts +18 -3
- package/lib/types/services/select-all/select-all.service.d.ts +17 -1
- package/lib/types/services/selection/base-selection-render.service.d.ts +26 -8
- package/lib/types/services/selection/const.d.ts +20 -5
- package/lib/types/services/selection/mobile-selection-render.service.d.ts +22 -3
- package/lib/types/services/selection/mobile-selection-shape.d.ts +20 -3
- package/lib/types/services/selection/selection-control.d.ts +24 -6
- package/lib/types/services/selection/selection-layer.d.ts +17 -1
- package/lib/types/services/selection/selection-render-model.d.ts +18 -2
- package/lib/types/services/selection/selection-render.service.d.ts +19 -2
- package/lib/types/services/selection/selection-shape-extension.d.ts +18 -3
- package/lib/types/services/selection/util.d.ts +18 -3
- package/lib/types/services/sheet-bar/sheet-bar.service.d.ts +20 -4
- package/lib/types/services/sheet-skeleton-manager.service.d.ts +21 -4
- package/lib/types/services/sheets-render.service.d.ts +17 -1
- package/lib/types/services/shortcut-experience.service.d.ts +18 -2
- package/lib/types/services/status-bar.service.d.ts +19 -4
- package/lib/types/services/utils/doc-skeleton-util.d.ts +18 -3
- package/lib/types/services/utils/drawing-position-util.d.ts +18 -3
- package/lib/types/services/utils/selection-util.d.ts +17 -2
- package/lib/types/views/auto-fill-popup-menu/AutoFillPopupMenu.d.ts +15 -0
- package/lib/types/views/cell-alert/CellAlertPopup.d.ts +16 -1
- package/lib/types/views/cell-popup/index.d.ts +17 -2
- package/lib/types/views/defined-name/DefinedNameInput.d.ts +16 -1
- package/lib/types/views/dropdown/cascader-dropdown/index.d.ts +18 -3
- package/lib/types/views/dropdown/color-dropdown/index.d.ts +17 -2
- package/lib/types/views/dropdown/date-dropdown/index.d.ts +17 -2
- package/lib/types/views/dropdown/index.d.ts +23 -4
- package/lib/types/views/dropdown/list-dropdown/index.d.ts +17 -2
- package/lib/types/views/dropdown/type.d.ts +16 -1
- package/lib/types/views/editor-container/hooks.d.ts +16 -1
- package/lib/types/views/header-resize-shape.d.ts +17 -1
- package/lib/types/views/header-unhide-shape.d.ts +17 -1
- package/lib/types/views/permission/extensions/range-protection.render.d.ts +19 -3
- package/lib/types/views/permission/extensions/worksheet-permission.render.d.ts +18 -2
- package/lib/types/views/permission/panel/index.d.ts +16 -1
- package/lib/types/views/permission/panel-detail/PermissionDetailFooterPart.d.ts +17 -2
- package/lib/types/views/permission/panel-detail/PermissionDetailMainPart.d.ts +16 -1
- package/lib/types/views/permission/panel-detail/PermissionDetailPanel.d.ts +16 -1
- package/lib/types/views/permission/panel-detail/PermissionDetailUserPart.d.ts +15 -0
- package/lib/types/views/permission/spin/index.d.ts +16 -1
- package/lib/types/views/permission/util.d.ts +17 -2
- package/lib/types/views/sheet-bar/sheet-bar-button/SheetBarButton.d.ts +16 -1
- package/lib/types/views/sheet-bar/sheet-bar-menu/SheetBarMenu.d.ts +16 -1
- package/lib/types/views/sheet-bar/sheet-bar-tabs/SheetBarItem.d.ts +17 -2
- package/lib/types/views/sheet-bar/sheet-bar-tabs/SheetBarTabsContextMenu.d.ts +17 -2
- package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/slide-tab-bar.d.ts +15 -0
- package/lib/types/views/status-bar/CopyableStatisticItem.d.ts +17 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +288 -20
- package/lib/umd/locale/ca-ES.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/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.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-TW.js +1 -1
- package/package.json +16 -15
package/lib/es/facade.js
CHANGED
|
@@ -1,1276 +1 @@
|
|
|
1
|
-
import { ICommandService as I, CanceledError as E, IUniverInstanceService as W, RichTextValue as $, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as x, LifecycleService as oe, DisposableCollection as T, LifecycleStages as O, UniverInstanceType as se, ILogService as H, toDisposable as S, IPermissionService as ae, awaitTime as ce, InterceptorEffectEnum as de, generateRandomId as he } from "@univerjs/core";
|
|
2
|
-
import { FUniver as G, FEventName as ge, FEnum as le } from "@univerjs/core/facade";
|
|
3
|
-
import { RichTextEditingMutation as ue } from "@univerjs/docs";
|
|
4
|
-
import { IRenderManagerService as v, DeviceInputEventType as z, SHEET_VIEWPORT_KEY as q } from "@univerjs/engine-render";
|
|
5
|
-
import { SheetsSelectionsService as ve, COMMAND_LISTENER_SKELETON_CHANGE as Se, getSkeletonChangedEffectedRange as me, SetWorksheetRowIsAutoHeightCommand as Ce, InterceptCellContentPriority as pe, SheetInterceptorService as Ee, INTERCEPTOR_POINT as be } from "@univerjs/sheets";
|
|
6
|
-
import { SetCellEditVisibleOperation as k, IEditorBridgeService as w, SetZoomRatioCommand as A, HoverManagerService as f, DragManagerService as R, SheetScrollManagerService as y, SheetPasteShortKeyCommand as B, ISheetClipboardService as Q, SheetSkeletonManagerService as b, SHEET_VIEW_KEY as p, SheetPermissionRenderManagerService as D, ISheetSelectionRenderService as M, IMarkSelectionService as ee, SheetsScrollRenderController as we, SetWorksheetColAutoWidthCommand as fe, SetColumnHeaderHeightCommand as ke, SetRowHeaderWidthCommand as _e, SheetCanvasPopManagerService as F, CellAlertManagerService as Ie, ISheetCellDropdownManagerService as Pe } from "@univerjs/sheets-ui";
|
|
7
|
-
import { FSheetHooks as j, FWorkbook as te, FWorksheet as re, FPermission as ne, FRange as ie } from "@univerjs/sheets/facade";
|
|
8
|
-
import { KeyCode as U, CutCommand as L, CopyCommand as N, PasteCommand as V, IClipboardInterfaceService as Re, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as Z, HTML_CLIPBOARD_MIME_TYPE as K, supportClipboardAPI as Y, ISidebarService as Me, IDialogService as He, ComponentManager as X } from "@univerjs/ui";
|
|
9
|
-
import { filter as u, combineLatest as ye } from "rxjs";
|
|
10
|
-
class Ue extends G {
|
|
11
|
-
// eslint-disable-next-line max-lines-per-function
|
|
12
|
-
_initSheetUIEvent(e) {
|
|
13
|
-
const r = e.get(I);
|
|
14
|
-
this.disposeWithMe(
|
|
15
|
-
this.registerEventHandler(
|
|
16
|
-
this.Event.BeforeSheetEditStart,
|
|
17
|
-
() => r.beforeCommandExecuted((t) => {
|
|
18
|
-
if (t.id !== k.id) return;
|
|
19
|
-
const i = this.getActiveSheet();
|
|
20
|
-
if (!i) return;
|
|
21
|
-
const { workbook: o, worksheet: a } = i, d = e.get(w), h = t.params, { visible: l, keycode: g, eventType: c } = h, n = d.getEditLocation();
|
|
22
|
-
if (l) {
|
|
23
|
-
const s = {
|
|
24
|
-
row: n.row,
|
|
25
|
-
column: n.column,
|
|
26
|
-
eventType: c,
|
|
27
|
-
keycode: g,
|
|
28
|
-
workbook: o,
|
|
29
|
-
worksheet: a,
|
|
30
|
-
isZenEditor: !1
|
|
31
|
-
};
|
|
32
|
-
if (this.fireEvent(this.Event.BeforeSheetEditStart, s), s.cancel)
|
|
33
|
-
throw new E();
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
)
|
|
37
|
-
), this.disposeWithMe(
|
|
38
|
-
this.registerEventHandler(
|
|
39
|
-
this.Event.BeforeSheetEditEnd,
|
|
40
|
-
() => r.beforeCommandExecuted((t) => {
|
|
41
|
-
if (t.id !== k.id) return;
|
|
42
|
-
const i = this.getActiveSheet();
|
|
43
|
-
if (!i) return;
|
|
44
|
-
const { workbook: o, worksheet: a } = i, d = e.get(w), h = e.get(W), l = t.params, { visible: g, keycode: c, eventType: n } = l, s = d.getEditLocation();
|
|
45
|
-
if (!g) {
|
|
46
|
-
const m = {
|
|
47
|
-
row: s.row,
|
|
48
|
-
column: s.column,
|
|
49
|
-
eventType: n,
|
|
50
|
-
keycode: c,
|
|
51
|
-
workbook: o,
|
|
52
|
-
worksheet: a,
|
|
53
|
-
isZenEditor: !1,
|
|
54
|
-
value: $.create(h.getUnit(x).getSnapshot()),
|
|
55
|
-
isConfirm: c !== U.ESC
|
|
56
|
-
};
|
|
57
|
-
if (this.fireEvent(this.Event.BeforeSheetEditEnd, m), m.cancel)
|
|
58
|
-
throw new E();
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
)
|
|
62
|
-
), this.disposeWithMe(
|
|
63
|
-
this.registerEventHandler(
|
|
64
|
-
this.Event.SheetEditStarted,
|
|
65
|
-
() => r.onCommandExecuted((t) => {
|
|
66
|
-
if (t.id !== k.id) return;
|
|
67
|
-
const i = this.getCommandSheetTarget(t);
|
|
68
|
-
if (!i) return;
|
|
69
|
-
const { workbook: o, worksheet: a } = i, d = e.get(w), h = t.params, { visible: l, keycode: g, eventType: c } = h, n = d.getEditLocation();
|
|
70
|
-
if (l) {
|
|
71
|
-
const s = {
|
|
72
|
-
row: n.row,
|
|
73
|
-
column: n.column,
|
|
74
|
-
eventType: c,
|
|
75
|
-
keycode: g,
|
|
76
|
-
workbook: o,
|
|
77
|
-
worksheet: a,
|
|
78
|
-
isZenEditor: !1
|
|
79
|
-
};
|
|
80
|
-
this.fireEvent(this.Event.SheetEditStarted, s);
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
)
|
|
84
|
-
), this.disposeWithMe(
|
|
85
|
-
this.registerEventHandler(
|
|
86
|
-
this.Event.SheetEditEnded,
|
|
87
|
-
() => r.onCommandExecuted((t) => {
|
|
88
|
-
if (t.id !== k.id) return;
|
|
89
|
-
const i = this.getCommandSheetTarget(t);
|
|
90
|
-
if (!i) return;
|
|
91
|
-
const { workbook: o, worksheet: a } = i, d = e.get(w), h = t.params, { visible: l, keycode: g, eventType: c } = h, n = d.getEditLocation();
|
|
92
|
-
if (!l) {
|
|
93
|
-
const s = {
|
|
94
|
-
row: n.row,
|
|
95
|
-
column: n.column,
|
|
96
|
-
eventType: c,
|
|
97
|
-
keycode: g,
|
|
98
|
-
workbook: o,
|
|
99
|
-
worksheet: a,
|
|
100
|
-
isZenEditor: !1,
|
|
101
|
-
isConfirm: g !== U.ESC
|
|
102
|
-
};
|
|
103
|
-
this.fireEvent(this.Event.SheetEditEnded, s);
|
|
104
|
-
}
|
|
105
|
-
})
|
|
106
|
-
)
|
|
107
|
-
), this.disposeWithMe(
|
|
108
|
-
this.registerEventHandler(
|
|
109
|
-
this.Event.SheetEditChanging,
|
|
110
|
-
() => r.onCommandExecuted((t) => {
|
|
111
|
-
if (t.id !== ue.id) return;
|
|
112
|
-
const i = this.getActiveSheet();
|
|
113
|
-
if (!i) return;
|
|
114
|
-
const { workbook: o, worksheet: a } = i, d = e.get(w), h = e.get(W), l = t.params;
|
|
115
|
-
if (!d.isVisible().visible) return;
|
|
116
|
-
const { unitId: g } = l;
|
|
117
|
-
if (g === x) {
|
|
118
|
-
const { row: c, column: n } = d.getEditLocation(), s = {
|
|
119
|
-
workbook: o,
|
|
120
|
-
worksheet: a,
|
|
121
|
-
row: c,
|
|
122
|
-
column: n,
|
|
123
|
-
value: $.create(h.getUnit(x).getSnapshot()),
|
|
124
|
-
isZenEditor: !1
|
|
125
|
-
};
|
|
126
|
-
this.fireEvent(this.Event.SheetEditChanging, s);
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
)
|
|
130
|
-
), this.disposeWithMe(
|
|
131
|
-
this.registerEventHandler(
|
|
132
|
-
this.Event.BeforeSheetZoomChange,
|
|
133
|
-
() => r.beforeCommandExecuted((t) => {
|
|
134
|
-
if (t.id !== A.id) return;
|
|
135
|
-
const i = this.getCommandSheetTarget(t);
|
|
136
|
-
if (!i) return;
|
|
137
|
-
const { workbook: o, worksheet: a } = i, d = {
|
|
138
|
-
zoom: t.params.zoomRatio,
|
|
139
|
-
workbook: o,
|
|
140
|
-
worksheet: a
|
|
141
|
-
};
|
|
142
|
-
if (this.fireEvent(this.Event.BeforeSheetZoomChange, d), d.cancel)
|
|
143
|
-
throw new E();
|
|
144
|
-
})
|
|
145
|
-
)
|
|
146
|
-
), this.disposeWithMe(
|
|
147
|
-
this.registerEventHandler(
|
|
148
|
-
this.Event.SheetZoomChanged,
|
|
149
|
-
() => r.onCommandExecuted((t) => {
|
|
150
|
-
if (t.id !== A.id) return;
|
|
151
|
-
const i = this.getCommandSheetTarget(t);
|
|
152
|
-
if (!i) return;
|
|
153
|
-
const { workbook: o, worksheet: a } = i;
|
|
154
|
-
this.fireEvent(this.Event.SheetZoomChanged, {
|
|
155
|
-
zoom: a.getZoom(),
|
|
156
|
-
workbook: o,
|
|
157
|
-
worksheet: a
|
|
158
|
-
});
|
|
159
|
-
})
|
|
160
|
-
)
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
// eslint-disable-next-line max-lines-per-function
|
|
164
|
-
_initObserverListener(e) {
|
|
165
|
-
const r = e.get(v), t = e.get(oe), i = new T();
|
|
166
|
-
this.disposeWithMe(t.lifecycle$.subscribe((h) => {
|
|
167
|
-
if (h !== O.Rendered) return;
|
|
168
|
-
const l = e.get(f), g = e.get(R);
|
|
169
|
-
l && (i.dispose(), i.add(
|
|
170
|
-
this.registerEventHandler(
|
|
171
|
-
this.Event.CellClicked,
|
|
172
|
-
() => {
|
|
173
|
-
var c;
|
|
174
|
-
return (c = l.currentClickedCell$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
175
|
-
const s = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
|
|
176
|
-
s && this.fireEvent(this.Event.CellClicked, {
|
|
177
|
-
...s,
|
|
178
|
-
...n,
|
|
179
|
-
row: n.location.row,
|
|
180
|
-
column: n.location.col
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
)
|
|
185
|
-
), i.add(
|
|
186
|
-
this.registerEventHandler(
|
|
187
|
-
this.Event.CellHover,
|
|
188
|
-
() => {
|
|
189
|
-
var c;
|
|
190
|
-
return (c = l.currentRichText$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
191
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
192
|
-
s && this.fireEvent(this.Event.CellHover, {
|
|
193
|
-
...s,
|
|
194
|
-
...n,
|
|
195
|
-
row: n.row,
|
|
196
|
-
column: n.col
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
)
|
|
201
|
-
), i.add(
|
|
202
|
-
this.registerEventHandler(
|
|
203
|
-
this.Event.CellPointerDown,
|
|
204
|
-
() => {
|
|
205
|
-
var c;
|
|
206
|
-
return (c = l.currentPointerDownCell$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
207
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
208
|
-
s && this.fireEvent(this.Event.CellPointerDown, {
|
|
209
|
-
...s,
|
|
210
|
-
...n,
|
|
211
|
-
row: n.row,
|
|
212
|
-
column: n.col
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
)
|
|
217
|
-
), i.add(
|
|
218
|
-
this.registerEventHandler(
|
|
219
|
-
this.Event.CellPointerUp,
|
|
220
|
-
() => {
|
|
221
|
-
var c;
|
|
222
|
-
return (c = l.currentPointerUpCell$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
223
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
224
|
-
s && this.fireEvent(this.Event.CellPointerUp, {
|
|
225
|
-
...s,
|
|
226
|
-
...n,
|
|
227
|
-
row: n.row,
|
|
228
|
-
column: n.col
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
)
|
|
233
|
-
), i.add(
|
|
234
|
-
this.registerEventHandler(
|
|
235
|
-
this.Event.CellPointerMove,
|
|
236
|
-
() => {
|
|
237
|
-
var c;
|
|
238
|
-
return (c = l.currentCellPosWithEvent$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
239
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
240
|
-
s && this.fireEvent(this.Event.CellPointerMove, {
|
|
241
|
-
...s,
|
|
242
|
-
...n,
|
|
243
|
-
row: n.row,
|
|
244
|
-
column: n.col
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
)
|
|
249
|
-
), i.add(
|
|
250
|
-
this.registerEventHandler(
|
|
251
|
-
this.Event.DragOver,
|
|
252
|
-
() => {
|
|
253
|
-
var c;
|
|
254
|
-
return (c = g.currentCell$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
255
|
-
const s = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
|
|
256
|
-
s && this.fireEvent(this.Event.DragOver, {
|
|
257
|
-
...s,
|
|
258
|
-
...n,
|
|
259
|
-
row: n.location.row,
|
|
260
|
-
column: n.location.col
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
)
|
|
265
|
-
), i.add(
|
|
266
|
-
this.registerEventHandler(
|
|
267
|
-
this.Event.Drop,
|
|
268
|
-
() => {
|
|
269
|
-
var c;
|
|
270
|
-
return (c = g.endCell$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
271
|
-
const s = this.getSheetTarget(n.location.unitId, n.location.subUnitId);
|
|
272
|
-
s && this.fireEvent(this.Event.Drop, {
|
|
273
|
-
...s,
|
|
274
|
-
...n,
|
|
275
|
-
row: n.location.row,
|
|
276
|
-
column: n.location.col
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
)
|
|
281
|
-
), i.add(
|
|
282
|
-
this.registerEventHandler(
|
|
283
|
-
this.Event.RowHeaderClick,
|
|
284
|
-
() => {
|
|
285
|
-
var c;
|
|
286
|
-
return (c = l.currentRowHeaderClick$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
287
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
288
|
-
s && this.fireEvent(this.Event.RowHeaderClick, {
|
|
289
|
-
...s,
|
|
290
|
-
row: n.index
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
)
|
|
295
|
-
), i.add(
|
|
296
|
-
this.registerEventHandler(
|
|
297
|
-
this.Event.RowHeaderPointerDown,
|
|
298
|
-
() => {
|
|
299
|
-
var c;
|
|
300
|
-
return (c = l.currentRowHeaderPointerDown$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
301
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
302
|
-
s && this.fireEvent(this.Event.RowHeaderPointerDown, {
|
|
303
|
-
...s,
|
|
304
|
-
row: n.index
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
)
|
|
309
|
-
), i.add(
|
|
310
|
-
this.registerEventHandler(
|
|
311
|
-
this.Event.RowHeaderPointerUp,
|
|
312
|
-
() => {
|
|
313
|
-
var c;
|
|
314
|
-
return (c = l.currentRowHeaderPointerUp$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
315
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
316
|
-
s && this.fireEvent(this.Event.RowHeaderPointerUp, {
|
|
317
|
-
...s,
|
|
318
|
-
row: n.index
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
)
|
|
323
|
-
), i.add(
|
|
324
|
-
this.registerEventHandler(
|
|
325
|
-
this.Event.RowHeaderHover,
|
|
326
|
-
() => {
|
|
327
|
-
var c;
|
|
328
|
-
return (c = l.currentHoveredRowHeader$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
329
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
330
|
-
s && this.fireEvent(this.Event.RowHeaderHover, {
|
|
331
|
-
...s,
|
|
332
|
-
row: n.index
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
)
|
|
337
|
-
), i.add(
|
|
338
|
-
this.registerEventHandler(
|
|
339
|
-
this.Event.ColumnHeaderClick,
|
|
340
|
-
() => {
|
|
341
|
-
var c;
|
|
342
|
-
return (c = l.currentColHeaderClick$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
343
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
344
|
-
s && this.fireEvent(this.Event.ColumnHeaderClick, {
|
|
345
|
-
...s,
|
|
346
|
-
column: n.index
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
)
|
|
351
|
-
), i.add(
|
|
352
|
-
this.registerEventHandler(
|
|
353
|
-
this.Event.ColumnHeaderPointerDown,
|
|
354
|
-
() => {
|
|
355
|
-
var c;
|
|
356
|
-
return (c = l.currentColHeaderPointerDown$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
357
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
358
|
-
s && this.fireEvent(this.Event.ColumnHeaderPointerDown, {
|
|
359
|
-
...s,
|
|
360
|
-
column: n.index
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
)
|
|
365
|
-
), i.add(
|
|
366
|
-
this.registerEventHandler(
|
|
367
|
-
this.Event.ColumnHeaderPointerUp,
|
|
368
|
-
() => {
|
|
369
|
-
var c;
|
|
370
|
-
return (c = l.currentColHeaderPointerUp$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
371
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
372
|
-
s && this.fireEvent(this.Event.ColumnHeaderPointerUp, {
|
|
373
|
-
...s,
|
|
374
|
-
column: n.index
|
|
375
|
-
});
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
)
|
|
379
|
-
), i.add(
|
|
380
|
-
this.registerEventHandler(
|
|
381
|
-
this.Event.ColumnHeaderHover,
|
|
382
|
-
() => {
|
|
383
|
-
var c;
|
|
384
|
-
return (c = l.currentHoveredColHeader$) == null ? void 0 : c.pipe(u((n) => !!n)).subscribe((n) => {
|
|
385
|
-
const s = this.getSheetTarget(n.unitId, n.subUnitId);
|
|
386
|
-
s && this.fireEvent(this.Event.ColumnHeaderHover, {
|
|
387
|
-
...s,
|
|
388
|
-
column: n.index
|
|
389
|
-
});
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
)
|
|
393
|
-
), this.disposeWithMe(i));
|
|
394
|
-
}));
|
|
395
|
-
let o;
|
|
396
|
-
const a = ye([
|
|
397
|
-
r.created$,
|
|
398
|
-
t.lifecycle$
|
|
399
|
-
]), d = new T();
|
|
400
|
-
this.disposeWithMe(a.subscribe(([h, l]) => {
|
|
401
|
-
if (h.type === se.UNIVER_SHEET && (o = h), l <= O.Rendered || !o) return;
|
|
402
|
-
const g = this.getWorkbook(o.unitId);
|
|
403
|
-
if (!g) return;
|
|
404
|
-
d.dispose();
|
|
405
|
-
const c = o.with(y), n = o.with(ve);
|
|
406
|
-
d.add(
|
|
407
|
-
this.registerEventHandler(
|
|
408
|
-
this.Event.Scroll,
|
|
409
|
-
() => c.validViewportScrollInfo$.subscribe((s) => {
|
|
410
|
-
s && this.fireEvent(this.Event.Scroll, {
|
|
411
|
-
workbook: g,
|
|
412
|
-
worksheet: g.getActiveSheet(),
|
|
413
|
-
...s
|
|
414
|
-
});
|
|
415
|
-
})
|
|
416
|
-
)
|
|
417
|
-
), d.add(
|
|
418
|
-
this.registerEventHandler(
|
|
419
|
-
this.Event.SelectionMoveStart,
|
|
420
|
-
() => n.selectionMoveStart$.subscribe((s) => {
|
|
421
|
-
var m;
|
|
422
|
-
this.fireEvent(this.Event.SelectionMoveStart, {
|
|
423
|
-
workbook: g,
|
|
424
|
-
worksheet: g.getActiveSheet(),
|
|
425
|
-
selections: (m = s == null ? void 0 : s.map((_) => _.range)) != null ? m : []
|
|
426
|
-
});
|
|
427
|
-
})
|
|
428
|
-
)
|
|
429
|
-
), d.add(
|
|
430
|
-
this.registerEventHandler(
|
|
431
|
-
this.Event.SelectionMoving,
|
|
432
|
-
() => n.selectionMoving$.subscribe((s) => {
|
|
433
|
-
var m;
|
|
434
|
-
this.fireEvent(this.Event.SelectionMoving, {
|
|
435
|
-
workbook: g,
|
|
436
|
-
worksheet: g.getActiveSheet(),
|
|
437
|
-
selections: (m = s == null ? void 0 : s.map((_) => _.range)) != null ? m : []
|
|
438
|
-
});
|
|
439
|
-
})
|
|
440
|
-
)
|
|
441
|
-
), d.add(
|
|
442
|
-
this.registerEventHandler(
|
|
443
|
-
this.Event.SelectionMoveEnd,
|
|
444
|
-
() => n.selectionMoveEnd$.subscribe((s) => {
|
|
445
|
-
var m;
|
|
446
|
-
this.fireEvent(this.Event.SelectionMoveEnd, {
|
|
447
|
-
workbook: g,
|
|
448
|
-
worksheet: g.getActiveSheet(),
|
|
449
|
-
selections: (m = s == null ? void 0 : s.map((_) => _.range)) != null ? m : []
|
|
450
|
-
});
|
|
451
|
-
})
|
|
452
|
-
)
|
|
453
|
-
), d.add(
|
|
454
|
-
this.registerEventHandler(
|
|
455
|
-
this.Event.SelectionChanged,
|
|
456
|
-
() => n.selectionChanged$.subscribe((s) => {
|
|
457
|
-
var m;
|
|
458
|
-
this.fireEvent(this.Event.SelectionChanged, {
|
|
459
|
-
workbook: g,
|
|
460
|
-
worksheet: g.getActiveSheet(),
|
|
461
|
-
selections: (m = s == null ? void 0 : s.map((_) => _.range)) != null ? m : []
|
|
462
|
-
});
|
|
463
|
-
})
|
|
464
|
-
)
|
|
465
|
-
), o = null, this.disposeWithMe(d);
|
|
466
|
-
}));
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* @ignore
|
|
470
|
-
*/
|
|
471
|
-
// eslint-disable-next-line max-lines-per-function
|
|
472
|
-
_initialize(e) {
|
|
473
|
-
this._initSheetUIEvent(e), this._initObserverListener(e);
|
|
474
|
-
const r = e.get(I);
|
|
475
|
-
this.disposeWithMe(
|
|
476
|
-
this.registerEventHandler(
|
|
477
|
-
this.Event.BeforeClipboardChange,
|
|
478
|
-
() => r.beforeCommandExecuted((t) => {
|
|
479
|
-
switch (t.id) {
|
|
480
|
-
case N.id:
|
|
481
|
-
case L.id:
|
|
482
|
-
this._beforeClipboardChange();
|
|
483
|
-
break;
|
|
484
|
-
}
|
|
485
|
-
})
|
|
486
|
-
)
|
|
487
|
-
), this.disposeWithMe(
|
|
488
|
-
this.registerEventHandler(
|
|
489
|
-
this.Event.ClipboardChanged,
|
|
490
|
-
() => r.onCommandExecuted((t) => {
|
|
491
|
-
switch (t.id) {
|
|
492
|
-
case N.id:
|
|
493
|
-
case L.id:
|
|
494
|
-
this._clipboardChanged();
|
|
495
|
-
break;
|
|
496
|
-
}
|
|
497
|
-
})
|
|
498
|
-
)
|
|
499
|
-
), this.disposeWithMe(
|
|
500
|
-
this.registerEventHandler(
|
|
501
|
-
this.Event.BeforeClipboardPaste,
|
|
502
|
-
() => r.beforeCommandExecuted((t) => {
|
|
503
|
-
switch (t.id) {
|
|
504
|
-
case B.id:
|
|
505
|
-
this._beforeClipboardPaste(t.params);
|
|
506
|
-
break;
|
|
507
|
-
case V.id:
|
|
508
|
-
this._beforeClipboardPasteAsync();
|
|
509
|
-
break;
|
|
510
|
-
}
|
|
511
|
-
})
|
|
512
|
-
)
|
|
513
|
-
), this.disposeWithMe(
|
|
514
|
-
this.registerEventHandler(
|
|
515
|
-
this.Event.ClipboardPasted,
|
|
516
|
-
() => r.onCommandExecuted((t) => {
|
|
517
|
-
switch (t.id) {
|
|
518
|
-
case B.id:
|
|
519
|
-
this._clipboardPaste(t.params);
|
|
520
|
-
break;
|
|
521
|
-
case V.id:
|
|
522
|
-
this._clipboardPasteAsync();
|
|
523
|
-
break;
|
|
524
|
-
}
|
|
525
|
-
})
|
|
526
|
-
)
|
|
527
|
-
), this.disposeWithMe(
|
|
528
|
-
this.registerEventHandler(
|
|
529
|
-
this.Event.SheetSkeletonChanged,
|
|
530
|
-
() => r.onCommandExecuted((t) => {
|
|
531
|
-
if (Se.indexOf(t.id) > -1) {
|
|
532
|
-
const i = this.getActiveSheet();
|
|
533
|
-
if (!i) return;
|
|
534
|
-
const o = me(t, i.worksheet.getMaxColumns()).map((a) => {
|
|
535
|
-
var d, h;
|
|
536
|
-
return (h = (d = this.getWorkbook(a.unitId)) == null ? void 0 : d.getSheetBySheetId(a.subUnitId)) == null ? void 0 : h.getRange(a.range);
|
|
537
|
-
}).filter(Boolean);
|
|
538
|
-
if (!o.length) return;
|
|
539
|
-
this.fireEvent(this.Event.SheetSkeletonChanged, {
|
|
540
|
-
workbook: i.workbook,
|
|
541
|
-
worksheet: i.worksheet,
|
|
542
|
-
payload: t,
|
|
543
|
-
skeleton: i.worksheet.getSkeleton(),
|
|
544
|
-
effectedRanges: o
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
})
|
|
548
|
-
)
|
|
549
|
-
);
|
|
550
|
-
}
|
|
551
|
-
_generateClipboardCopyParam() {
|
|
552
|
-
const e = this.getActiveWorkbook(), r = e == null ? void 0 : e.getActiveSheet(), t = e == null ? void 0 : e.getActiveRange();
|
|
553
|
-
if (!e || !r || !t)
|
|
554
|
-
return;
|
|
555
|
-
const o = this._injector.get(Q).generateCopyContent(e.getId(), r.getSheetId(), t.getRange());
|
|
556
|
-
if (!o)
|
|
557
|
-
return;
|
|
558
|
-
const { html: a, plain: d } = o;
|
|
559
|
-
return {
|
|
560
|
-
workbook: e,
|
|
561
|
-
worksheet: r,
|
|
562
|
-
text: d,
|
|
563
|
-
html: a,
|
|
564
|
-
fromSheet: r,
|
|
565
|
-
fromRange: t
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
_beforeClipboardChange() {
|
|
569
|
-
const e = this._generateClipboardCopyParam();
|
|
570
|
-
if (e && (this.fireEvent(this.Event.BeforeClipboardChange, e), e.cancel))
|
|
571
|
-
throw new E();
|
|
572
|
-
}
|
|
573
|
-
_clipboardChanged() {
|
|
574
|
-
const e = this._generateClipboardCopyParam();
|
|
575
|
-
e && this.fireEvent(this.Event.ClipboardChanged, e);
|
|
576
|
-
}
|
|
577
|
-
_generateClipboardPasteParam(e) {
|
|
578
|
-
if (!e)
|
|
579
|
-
return;
|
|
580
|
-
const { htmlContent: r, textContent: t } = e, i = this.getActiveWorkbook(), o = i == null ? void 0 : i.getActiveSheet();
|
|
581
|
-
return !i || !o ? void 0 : {
|
|
582
|
-
workbook: i,
|
|
583
|
-
worksheet: o,
|
|
584
|
-
text: t,
|
|
585
|
-
html: r
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
async _generateClipboardPasteParamAsync() {
|
|
589
|
-
const e = this.getActiveWorkbook(), r = e == null ? void 0 : e.getActiveSheet();
|
|
590
|
-
if (!e || !r)
|
|
591
|
-
return;
|
|
592
|
-
const o = (await this._injector.get(Re).read())[0];
|
|
593
|
-
let a;
|
|
594
|
-
if (o) {
|
|
595
|
-
const d = o.types, h = d.indexOf(Z) !== -1 ? await o.getType(Z).then((g) => g && g.text()) : "", l = d.indexOf(K) !== -1 ? await o.getType(K).then((g) => g && g.text()) : "";
|
|
596
|
-
a = {
|
|
597
|
-
workbook: e,
|
|
598
|
-
worksheet: r,
|
|
599
|
-
text: h,
|
|
600
|
-
html: l
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
return a;
|
|
604
|
-
}
|
|
605
|
-
_beforeClipboardPaste(e) {
|
|
606
|
-
const r = this._generateClipboardPasteParam(e);
|
|
607
|
-
if (r && (this.fireEvent(this.Event.BeforeClipboardPaste, r), r.cancel))
|
|
608
|
-
throw new E();
|
|
609
|
-
}
|
|
610
|
-
_clipboardPaste(e) {
|
|
611
|
-
const r = this._generateClipboardPasteParam(e);
|
|
612
|
-
if (r && (this.fireEvent(this.Event.ClipboardPasted, r), r.cancel))
|
|
613
|
-
throw new E();
|
|
614
|
-
}
|
|
615
|
-
async _beforeClipboardPasteAsync() {
|
|
616
|
-
if (!Y()) {
|
|
617
|
-
this._injector.get(H).warn("[Facade]: The navigator object only supports the browser environment");
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
const e = await this._generateClipboardPasteParamAsync();
|
|
621
|
-
if (e && (this.fireEvent(this.Event.BeforeClipboardPaste, e), e.cancel))
|
|
622
|
-
throw new E();
|
|
623
|
-
}
|
|
624
|
-
async _clipboardPasteAsync() {
|
|
625
|
-
if (!Y()) {
|
|
626
|
-
this._injector.get(H).warn("[Facade]: The navigator object only supports the browser environment");
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
const e = await this._generateClipboardPasteParamAsync();
|
|
630
|
-
if (e && (this.fireEvent(this.Event.ClipboardPasted, e), e.cancel))
|
|
631
|
-
throw new E();
|
|
632
|
-
}
|
|
633
|
-
customizeColumnHeader(e) {
|
|
634
|
-
var l, g;
|
|
635
|
-
const r = this.getActiveWorkbook();
|
|
636
|
-
if (!r) {
|
|
637
|
-
console.error("WorkBook not exist");
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
const t = r == null ? void 0 : r.getId(), i = this._injector.get(v), o = r.getActiveSheet(), a = o.getSheetId(), d = i.getRenderById(t);
|
|
641
|
-
d && ((l = e.headerStyle) != null && l.size) && (d.with(b).setColumnHeaderSize(d, a, (g = e.headerStyle) == null ? void 0 : g.size), o == null || o.refreshCanvas()), this._getSheetRenderComponent(t, p.COLUMN).setCustomHeader(e), o == null || o.refreshCanvas();
|
|
642
|
-
}
|
|
643
|
-
customizeRowHeader(e) {
|
|
644
|
-
const r = this.getActiveWorkbook();
|
|
645
|
-
if (!r) {
|
|
646
|
-
console.error("WorkBook not exist");
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
const t = r == null ? void 0 : r.getId();
|
|
650
|
-
this._getSheetRenderComponent(t, p.ROW).setCustomHeader(e);
|
|
651
|
-
}
|
|
652
|
-
registerSheetRowHeaderExtension(e, ...r) {
|
|
653
|
-
const t = this._getSheetRenderComponent(e, p.ROW), i = t.register(...r);
|
|
654
|
-
return S(() => {
|
|
655
|
-
i.dispose(), t.makeDirty(!0);
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
registerSheetColumnHeaderExtension(e, ...r) {
|
|
659
|
-
const t = this._getSheetRenderComponent(e, p.COLUMN), i = t.register(...r);
|
|
660
|
-
return S(() => {
|
|
661
|
-
i.dispose(), t.makeDirty(!0);
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
registerSheetMainExtension(e, ...r) {
|
|
665
|
-
const t = this._getSheetRenderComponent(e, p.MAIN), i = t.register(...r);
|
|
666
|
-
return S(() => {
|
|
667
|
-
i.dispose(), t.makeDirty(!0);
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
/**
|
|
671
|
-
* Get sheet render component from render by unitId and view key.
|
|
672
|
-
* @private
|
|
673
|
-
* @param {string} unitId The unit id of the spreadsheet.
|
|
674
|
-
* @param {SHEET_VIEW_KEY} viewKey The view key of the spreadsheet.
|
|
675
|
-
* @returns {Nullable<RenderComponentType>} The render component.
|
|
676
|
-
*/
|
|
677
|
-
_getSheetRenderComponent(e, r) {
|
|
678
|
-
const i = this._injector.get(v).getRenderById(e);
|
|
679
|
-
if (!i)
|
|
680
|
-
throw new Error(`Render Unit with unitId ${e} not found`);
|
|
681
|
-
const { components: o } = i, a = o.get(r);
|
|
682
|
-
if (!a)
|
|
683
|
-
throw new Error("Render component not found");
|
|
684
|
-
return a;
|
|
685
|
-
}
|
|
686
|
-
/**
|
|
687
|
-
* Get sheet hooks.
|
|
688
|
-
* @returns {FSheetHooks} FSheetHooks instance
|
|
689
|
-
*/
|
|
690
|
-
getSheetHooks() {
|
|
691
|
-
return this._injector.createInstance(j);
|
|
692
|
-
}
|
|
693
|
-
pasteIntoSheet(e, r, t) {
|
|
694
|
-
return this._commandService.executeCommand(B.id, { htmlContent: e, textContent: r, files: t });
|
|
695
|
-
}
|
|
696
|
-
setProtectedRangeShadowStrategy(e) {
|
|
697
|
-
this._injector.get(D).setProtectedRangeShadowStrategy(e);
|
|
698
|
-
}
|
|
699
|
-
getProtectedRangeShadowStrategy() {
|
|
700
|
-
return this._injector.get(D).getProtectedRangeShadowStrategy();
|
|
701
|
-
}
|
|
702
|
-
getProtectedRangeShadowStrategy$() {
|
|
703
|
-
return this._injector.get(D).getProtectedRangeShadowStrategy$();
|
|
704
|
-
}
|
|
705
|
-
setPermissionDialogVisible(e) {
|
|
706
|
-
this._injector.get(ae).setShowComponents(e);
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
G.extend(Ue);
|
|
710
|
-
class xe extends te {
|
|
711
|
-
openSiderbar(e) {
|
|
712
|
-
return this._logDeprecation("openSiderbar"), this._injector.get(Me).open(e);
|
|
713
|
-
}
|
|
714
|
-
openDialog(e) {
|
|
715
|
-
this._logDeprecation("openDialog");
|
|
716
|
-
const t = this._injector.get(He).open({
|
|
717
|
-
...e,
|
|
718
|
-
onClose: () => {
|
|
719
|
-
t.dispose();
|
|
720
|
-
}
|
|
721
|
-
});
|
|
722
|
-
return t;
|
|
723
|
-
}
|
|
724
|
-
customizeColumnHeader(e) {
|
|
725
|
-
const r = this._workbook.getUnitId();
|
|
726
|
-
this._getSheetRenderComponent(r, p.COLUMN).setCustomHeader(e);
|
|
727
|
-
}
|
|
728
|
-
customizeRowHeader(e) {
|
|
729
|
-
const r = this._workbook.getUnitId();
|
|
730
|
-
this._getSheetRenderComponent(r, p.ROW).setCustomHeader(e);
|
|
731
|
-
}
|
|
732
|
-
/**
|
|
733
|
-
* Get sheet render component from render by unitId and view key.
|
|
734
|
-
* @private
|
|
735
|
-
* @param {string} unitId The unit id of the spreadsheet.
|
|
736
|
-
* @param {SHEET_VIEW_KEY} viewKey The view key of the spreadsheet.
|
|
737
|
-
* @returns {Nullable<RenderComponentType>} The render component.
|
|
738
|
-
*/
|
|
739
|
-
_getSheetRenderComponent(e, r) {
|
|
740
|
-
const i = this._injector.get(v).getRenderById(e);
|
|
741
|
-
if (!i)
|
|
742
|
-
throw new Error(`Render Unit with unitId ${e} not found`);
|
|
743
|
-
const { components: o } = i, a = o.get(r);
|
|
744
|
-
if (!a)
|
|
745
|
-
throw new Error("Render component not found");
|
|
746
|
-
return a;
|
|
747
|
-
}
|
|
748
|
-
_logDeprecation(e) {
|
|
749
|
-
this._injector.get(H).warn("[FWorkbook]", `${e} is deprecated. Please use the function of the same name on "FUniver".`);
|
|
750
|
-
}
|
|
751
|
-
generateCellParams(e) {
|
|
752
|
-
const r = this.getActiveSheet();
|
|
753
|
-
return {
|
|
754
|
-
row: e.row,
|
|
755
|
-
column: e.col,
|
|
756
|
-
workbook: this,
|
|
757
|
-
worksheet: r
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
onCellClick(e) {
|
|
761
|
-
const r = this._injector.get(f);
|
|
762
|
-
return S(
|
|
763
|
-
r.currentClickedCell$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
764
|
-
e(t);
|
|
765
|
-
})
|
|
766
|
-
);
|
|
767
|
-
}
|
|
768
|
-
onCellHover(e) {
|
|
769
|
-
const r = this._injector.get(f);
|
|
770
|
-
return S(
|
|
771
|
-
r.currentRichText$.pipe(u((t) => !!t)).subscribe(e)
|
|
772
|
-
);
|
|
773
|
-
}
|
|
774
|
-
onCellPointerDown(e) {
|
|
775
|
-
const r = this._injector.get(f);
|
|
776
|
-
return S(
|
|
777
|
-
r.currentPointerDownCell$.subscribe(e)
|
|
778
|
-
);
|
|
779
|
-
}
|
|
780
|
-
onCellPointerUp(e) {
|
|
781
|
-
const r = this._injector.get(f);
|
|
782
|
-
return S(
|
|
783
|
-
r.currentPointerUpCell$.subscribe(e)
|
|
784
|
-
);
|
|
785
|
-
}
|
|
786
|
-
onCellPointerMove(e) {
|
|
787
|
-
const r = this._injector.get(f);
|
|
788
|
-
return S(
|
|
789
|
-
r.currentCellPosWithEvent$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
790
|
-
e(t, t.event);
|
|
791
|
-
})
|
|
792
|
-
);
|
|
793
|
-
}
|
|
794
|
-
onDragOver(e) {
|
|
795
|
-
const r = this._injector.get(R);
|
|
796
|
-
return S(
|
|
797
|
-
r.currentCell$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
798
|
-
e(t);
|
|
799
|
-
})
|
|
800
|
-
);
|
|
801
|
-
}
|
|
802
|
-
onDrop(e) {
|
|
803
|
-
const r = this._injector.get(R);
|
|
804
|
-
return S(
|
|
805
|
-
r.endCell$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
806
|
-
e(t);
|
|
807
|
-
})
|
|
808
|
-
);
|
|
809
|
-
}
|
|
810
|
-
startEditing() {
|
|
811
|
-
const e = this._injector.get(I);
|
|
812
|
-
return this._injector.get(w).isVisible().visible ? !0 : e.syncExecuteCommand(k.id, {
|
|
813
|
-
eventType: z.Dblclick,
|
|
814
|
-
unitId: this._workbook.getUnitId(),
|
|
815
|
-
visible: !0
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
async endEditing(e) {
|
|
819
|
-
const r = this._injector.get(I);
|
|
820
|
-
return this._injector.get(w).isVisible().visible && r.syncExecuteCommand(k.id, {
|
|
821
|
-
eventType: z.Keyboard,
|
|
822
|
-
keycode: e ? U.ENTER : U.ESC,
|
|
823
|
-
visible: !1,
|
|
824
|
-
unitId: this._workbook.getUnitId()
|
|
825
|
-
}), await ce(0), !0;
|
|
826
|
-
}
|
|
827
|
-
endEditingAsync(e = !0) {
|
|
828
|
-
return this.endEditing(e);
|
|
829
|
-
}
|
|
830
|
-
abortEditingAsync() {
|
|
831
|
-
return this.endEditingAsync(!1);
|
|
832
|
-
}
|
|
833
|
-
isCellEditing() {
|
|
834
|
-
return this._injector.get(w).isVisible().visible;
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* Get scroll state of specified sheet.
|
|
838
|
-
* @param {string} sheetId - sheet id
|
|
839
|
-
* @returns {IScrollState} scroll state
|
|
840
|
-
* @example
|
|
841
|
-
* ``` ts
|
|
842
|
-
* univerAPI.getActiveWorkbook().getScrollStateBySheetId($sheetId)
|
|
843
|
-
* ```
|
|
844
|
-
*/
|
|
845
|
-
getScrollStateBySheetId(e) {
|
|
846
|
-
const r = this._workbook.getUnitId(), i = this._injector.get(v).getRenderById(r);
|
|
847
|
-
return i ? i.with(y).getScrollStateByParam({ unitId: r, sheetId: e }) : null;
|
|
848
|
-
}
|
|
849
|
-
disableSelection() {
|
|
850
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
851
|
-
return t && t.with(M).disableSelection(), this;
|
|
852
|
-
}
|
|
853
|
-
enableSelection() {
|
|
854
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
855
|
-
return t && t.with(M).enableSelection(), this;
|
|
856
|
-
}
|
|
857
|
-
transparentSelection() {
|
|
858
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
859
|
-
return t && t.with(M).transparentSelection(), this;
|
|
860
|
-
}
|
|
861
|
-
showSelection() {
|
|
862
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
863
|
-
return t && t.with(M).showSelection(), this;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
te.extend(xe);
|
|
867
|
-
class Be extends re {
|
|
868
|
-
refreshCanvas() {
|
|
869
|
-
const e = this._injector.get(v), r = this._fWorkbook.id, t = e.getRenderById(r);
|
|
870
|
-
if (!t)
|
|
871
|
-
throw new Error(`Render Unit with unitId ${r} not found`);
|
|
872
|
-
t.with(b).reCalculate();
|
|
873
|
-
const i = t.mainComponent;
|
|
874
|
-
if (!i)
|
|
875
|
-
throw new Error("Main component not found");
|
|
876
|
-
return i.makeDirty(), this;
|
|
877
|
-
}
|
|
878
|
-
highlightRanges(e, r, t) {
|
|
879
|
-
const i = this._injector.get(ee), o = [];
|
|
880
|
-
for (const a of e) {
|
|
881
|
-
const d = a.getRange(), h = i.addShapeWithNoFresh({ range: d, style: r, primary: t });
|
|
882
|
-
h && o.push(h);
|
|
883
|
-
}
|
|
884
|
-
if (i.refreshShapes(), o.length === 0)
|
|
885
|
-
throw new Error("Failed to highlight current range");
|
|
886
|
-
return S(() => {
|
|
887
|
-
o.forEach((a) => {
|
|
888
|
-
i.removeShape(a);
|
|
889
|
-
});
|
|
890
|
-
});
|
|
891
|
-
}
|
|
892
|
-
zoom(e) {
|
|
893
|
-
const r = this._injector.get(I), t = Math.min(Math.max(e, 0.1), 4);
|
|
894
|
-
return r.executeCommand(A.id, {
|
|
895
|
-
unitId: this._workbook.getUnitId(),
|
|
896
|
-
subUnitId: this._worksheet.getSheetId(),
|
|
897
|
-
zoomRatio: t
|
|
898
|
-
}), this;
|
|
899
|
-
}
|
|
900
|
-
getZoom() {
|
|
901
|
-
return this._worksheet.getZoomRatio();
|
|
902
|
-
}
|
|
903
|
-
getVisibleRange() {
|
|
904
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
905
|
-
if (!t) return null;
|
|
906
|
-
const o = t.with(b).getCurrentSkeleton();
|
|
907
|
-
return o ? o.getVisibleRangeByViewport(q.VIEW_MAIN) : null;
|
|
908
|
-
}
|
|
909
|
-
getVisibleRangesOfAllViewports() {
|
|
910
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
911
|
-
if (!t) return null;
|
|
912
|
-
const o = t.with(b).getCurrentSkeleton();
|
|
913
|
-
return o ? o.getVisibleRanges() : null;
|
|
914
|
-
}
|
|
915
|
-
scrollToCell(e, r, t) {
|
|
916
|
-
const i = this._workbook.getUnitId(), a = this._injector.get(v).getRenderById(i);
|
|
917
|
-
return a && (a == null ? void 0 : a.with(we)).scrollToCell(e, r, t), this;
|
|
918
|
-
}
|
|
919
|
-
getScrollState() {
|
|
920
|
-
const e = {
|
|
921
|
-
offsetX: 0,
|
|
922
|
-
offsetY: 0,
|
|
923
|
-
sheetViewStartColumn: 0,
|
|
924
|
-
sheetViewStartRow: 0
|
|
925
|
-
}, r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(v).getRenderById(r);
|
|
926
|
-
return o && o.with(y).getScrollStateByParam({ unitId: r, sheetId: t }) || e;
|
|
927
|
-
}
|
|
928
|
-
onScroll(e) {
|
|
929
|
-
var o;
|
|
930
|
-
const r = this._workbook.getUnitId(), i = (o = this._injector.get(v).getRenderById(r)) == null ? void 0 : o.with(y);
|
|
931
|
-
if (i) {
|
|
932
|
-
const a = i.validViewportScrollInfo$.subscribe((d) => {
|
|
933
|
-
e(d);
|
|
934
|
-
});
|
|
935
|
-
return S(a);
|
|
936
|
-
}
|
|
937
|
-
return S(() => {
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
getSkeleton() {
|
|
941
|
-
var r, t;
|
|
942
|
-
const e = (r = this._injector.get(v).getRenderById(this._workbook.getUnitId())) == null ? void 0 : r.with(b);
|
|
943
|
-
return (t = e == null ? void 0 : e.getWorksheetSkeleton(this._worksheet.getSheetId())) == null ? void 0 : t.skeleton;
|
|
944
|
-
}
|
|
945
|
-
autoResizeColumn(e) {
|
|
946
|
-
return this.autoResizeColumns(e, 1);
|
|
947
|
-
}
|
|
948
|
-
autoResizeColumns(e, r) {
|
|
949
|
-
const t = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = [
|
|
950
|
-
{
|
|
951
|
-
startColumn: e,
|
|
952
|
-
endColumn: e + r - 1,
|
|
953
|
-
startRow: 0,
|
|
954
|
-
endRow: this._worksheet.getRowCount() - 1
|
|
955
|
-
}
|
|
956
|
-
];
|
|
957
|
-
return this._commandService.syncExecuteCommand(fe.id, {
|
|
958
|
-
unitId: t,
|
|
959
|
-
subUnitId: i,
|
|
960
|
-
ranges: o
|
|
961
|
-
}), this;
|
|
962
|
-
}
|
|
963
|
-
setColumnAutoWidth(e, r) {
|
|
964
|
-
return this.autoResizeColumns(e, r);
|
|
965
|
-
}
|
|
966
|
-
autoResizeRows(e, r) {
|
|
967
|
-
const t = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = [
|
|
968
|
-
{
|
|
969
|
-
startRow: e,
|
|
970
|
-
endRow: e + r - 1,
|
|
971
|
-
startColumn: 0,
|
|
972
|
-
endColumn: this._worksheet.getColumnCount() - 1
|
|
973
|
-
}
|
|
974
|
-
];
|
|
975
|
-
return this._commandService.syncExecuteCommand(Ce.id, {
|
|
976
|
-
unitId: t,
|
|
977
|
-
subUnitId: i,
|
|
978
|
-
ranges: o
|
|
979
|
-
}), this;
|
|
980
|
-
}
|
|
981
|
-
customizeColumnHeader(e) {
|
|
982
|
-
var d, h;
|
|
983
|
-
const r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(v).getRenderById(r);
|
|
984
|
-
o && ((d = e.headerStyle) != null && d.size) && o.with(b).setColumnHeaderSize(o, t, (h = e.headerStyle) == null ? void 0 : h.size), this._getSheetRenderComponent(r, p.COLUMN).setCustomHeader(e, t);
|
|
985
|
-
}
|
|
986
|
-
customizeRowHeader(e) {
|
|
987
|
-
var d, h;
|
|
988
|
-
const r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(v).getRenderById(r);
|
|
989
|
-
o && ((d = e.headerStyle) != null && d.size) && o.with(b).setRowHeaderSize(o, t, (h = e.headerStyle) == null ? void 0 : h.size), this._getSheetRenderComponent(r, p.ROW).setCustomHeader(e, t);
|
|
990
|
-
}
|
|
991
|
-
setColumnHeaderHeight(e) {
|
|
992
|
-
const r = this._workbook.getUnitId(), t = this._worksheet.getSheetId();
|
|
993
|
-
return this._commandService.executeCommand(ke.id, {
|
|
994
|
-
unitId: r,
|
|
995
|
-
subUnitId: t,
|
|
996
|
-
size: e
|
|
997
|
-
}), this;
|
|
998
|
-
}
|
|
999
|
-
setRowHeaderWidth(e) {
|
|
1000
|
-
const r = this._workbook.getUnitId(), t = this._worksheet.getSheetId();
|
|
1001
|
-
return this._commandService.executeCommand(_e.id, {
|
|
1002
|
-
unitId: r,
|
|
1003
|
-
subUnitId: t,
|
|
1004
|
-
size: e
|
|
1005
|
-
}), this;
|
|
1006
|
-
}
|
|
1007
|
-
/**
|
|
1008
|
-
* Get sheet render component from render by unitId and view key.
|
|
1009
|
-
* @private
|
|
1010
|
-
* @param {string} unitId The unit id of the spreadsheet.
|
|
1011
|
-
* @param {SHEET_VIEW_KEY} viewKey The view key of the spreadsheet.
|
|
1012
|
-
* @returns {Nullable<RenderComponentType>} The render component.
|
|
1013
|
-
*/
|
|
1014
|
-
_getSheetRenderComponent(e, r) {
|
|
1015
|
-
const i = this._injector.get(v).getRenderById(e);
|
|
1016
|
-
if (!i)
|
|
1017
|
-
throw new Error(`Render Unit with unitId ${e} not found`);
|
|
1018
|
-
const { components: o } = i, a = o.get(r);
|
|
1019
|
-
if (!a)
|
|
1020
|
-
throw new Error("Render component not found");
|
|
1021
|
-
return a;
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
re.extend(Be);
|
|
1025
|
-
class De extends ne {
|
|
1026
|
-
setPermissionDialogVisible(e) {
|
|
1027
|
-
this._permissionService.setShowComponents(e);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
ne.extend(De);
|
|
1031
|
-
class Te extends j {
|
|
1032
|
-
onCellPointerMove(e) {
|
|
1033
|
-
return S(this._injector.get(f).currentPosition$.subscribe(e));
|
|
1034
|
-
}
|
|
1035
|
-
onCellPointerOver(e) {
|
|
1036
|
-
return S(this._injector.get(f).currentCell$.subscribe(e));
|
|
1037
|
-
}
|
|
1038
|
-
onCellDragOver(e) {
|
|
1039
|
-
return S(this._injector.get(R).currentCell$.subscribe(e));
|
|
1040
|
-
}
|
|
1041
|
-
onCellDrop(e) {
|
|
1042
|
-
return S(this._injector.get(R).endCell$.subscribe(e));
|
|
1043
|
-
}
|
|
1044
|
-
onCellRender(e, r = de.Style, t = pe.DATA_VALIDATION) {
|
|
1045
|
-
return this._injector.get(Ee).intercept(be.CELL_CONTENT, {
|
|
1046
|
-
effect: r,
|
|
1047
|
-
handler: (i, o, a) => (i && !i.customRender && e && (i.customRender = [...e]), a(i)),
|
|
1048
|
-
priority: t
|
|
1049
|
-
});
|
|
1050
|
-
}
|
|
1051
|
-
onBeforeCellEdit(e) {
|
|
1052
|
-
return this._injector.get(I).beforeCommandExecuted((r) => {
|
|
1053
|
-
const t = r.params;
|
|
1054
|
-
r.id === k.id && t.visible && e(t);
|
|
1055
|
-
});
|
|
1056
|
-
}
|
|
1057
|
-
onAfterCellEdit(e) {
|
|
1058
|
-
return this._injector.get(I).onCommandExecuted((r) => {
|
|
1059
|
-
const t = r.params;
|
|
1060
|
-
r.id === k.id && !t.visible && e(t);
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
j.extend(Te);
|
|
1065
|
-
const P = {
|
|
1066
|
-
CellClicked: "CellClicked",
|
|
1067
|
-
CellPointerDown: "CellPointerDown",
|
|
1068
|
-
CellPointerUp: "CellPointerUp",
|
|
1069
|
-
CellPointerMove: "CellPointerMove",
|
|
1070
|
-
CellHover: "CellHover"
|
|
1071
|
-
};
|
|
1072
|
-
class Ae {
|
|
1073
|
-
get BeforeClipboardChange() {
|
|
1074
|
-
return "BeforeClipboardChange";
|
|
1075
|
-
}
|
|
1076
|
-
get ClipboardChanged() {
|
|
1077
|
-
return "ClipboardChanged";
|
|
1078
|
-
}
|
|
1079
|
-
get BeforeClipboardPaste() {
|
|
1080
|
-
return "BeforeClipboardPaste";
|
|
1081
|
-
}
|
|
1082
|
-
get ClipboardPasted() {
|
|
1083
|
-
return "ClipboardPasted";
|
|
1084
|
-
}
|
|
1085
|
-
get BeforeSheetEditStart() {
|
|
1086
|
-
return "BeforeSheetEditStart";
|
|
1087
|
-
}
|
|
1088
|
-
get SheetEditStarted() {
|
|
1089
|
-
return "SheetEditStarted";
|
|
1090
|
-
}
|
|
1091
|
-
get SheetEditChanging() {
|
|
1092
|
-
return "SheetEditChanging";
|
|
1093
|
-
}
|
|
1094
|
-
get BeforeSheetEditEnd() {
|
|
1095
|
-
return "BeforeSheetEditEnd";
|
|
1096
|
-
}
|
|
1097
|
-
get SheetEditEnded() {
|
|
1098
|
-
return "SheetEditEnded";
|
|
1099
|
-
}
|
|
1100
|
-
get CellClicked() {
|
|
1101
|
-
return P.CellClicked;
|
|
1102
|
-
}
|
|
1103
|
-
get CellHover() {
|
|
1104
|
-
return P.CellHover;
|
|
1105
|
-
}
|
|
1106
|
-
get CellPointerDown() {
|
|
1107
|
-
return P.CellPointerDown;
|
|
1108
|
-
}
|
|
1109
|
-
get CellPointerUp() {
|
|
1110
|
-
return P.CellPointerUp;
|
|
1111
|
-
}
|
|
1112
|
-
get CellPointerMove() {
|
|
1113
|
-
return P.CellPointerMove;
|
|
1114
|
-
}
|
|
1115
|
-
get DragOver() {
|
|
1116
|
-
return "DragOver";
|
|
1117
|
-
}
|
|
1118
|
-
get Drop() {
|
|
1119
|
-
return "Drop";
|
|
1120
|
-
}
|
|
1121
|
-
get Scroll() {
|
|
1122
|
-
return "Scroll";
|
|
1123
|
-
}
|
|
1124
|
-
get SelectionMoveStart() {
|
|
1125
|
-
return "SelectionMoveStart";
|
|
1126
|
-
}
|
|
1127
|
-
get SelectionChanged() {
|
|
1128
|
-
return "SelectionChanged";
|
|
1129
|
-
}
|
|
1130
|
-
get SelectionMoving() {
|
|
1131
|
-
return "SelectionMoving";
|
|
1132
|
-
}
|
|
1133
|
-
get SelectionMoveEnd() {
|
|
1134
|
-
return "SelectionMoveEnd";
|
|
1135
|
-
}
|
|
1136
|
-
get RowHeaderClick() {
|
|
1137
|
-
return "RowHeaderClick";
|
|
1138
|
-
}
|
|
1139
|
-
get RowHeaderPointerDown() {
|
|
1140
|
-
return "RowHeaderPointerDown";
|
|
1141
|
-
}
|
|
1142
|
-
get RowHeaderPointerUp() {
|
|
1143
|
-
return "RowHeaderPointerUp";
|
|
1144
|
-
}
|
|
1145
|
-
get RowHeaderHover() {
|
|
1146
|
-
return "RowHeaderHover";
|
|
1147
|
-
}
|
|
1148
|
-
get ColumnHeaderClick() {
|
|
1149
|
-
return "ColumnHeaderClick";
|
|
1150
|
-
}
|
|
1151
|
-
get ColumnHeaderPointerDown() {
|
|
1152
|
-
return "ColumnHeaderPointerDown";
|
|
1153
|
-
}
|
|
1154
|
-
get ColumnHeaderPointerUp() {
|
|
1155
|
-
return "ColumnHeaderPointerUp";
|
|
1156
|
-
}
|
|
1157
|
-
get ColumnHeaderHover() {
|
|
1158
|
-
return "ColumnHeaderHover";
|
|
1159
|
-
}
|
|
1160
|
-
get SheetSkeletonChanged() {
|
|
1161
|
-
return "SheetSkeletonChanged";
|
|
1162
|
-
}
|
|
1163
|
-
get BeforeSheetZoomChange() {
|
|
1164
|
-
return "BeforeSheetZoomChange";
|
|
1165
|
-
}
|
|
1166
|
-
get SheetZoomChanged() {
|
|
1167
|
-
return "SheetZoomChanged";
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
ge.extend(Ae);
|
|
1171
|
-
class je {
|
|
1172
|
-
get SHEET_VIEWPORT_KEY() {
|
|
1173
|
-
return q;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
le.extend(je);
|
|
1177
|
-
class We extends ie {
|
|
1178
|
-
getCell() {
|
|
1179
|
-
var d;
|
|
1180
|
-
const e = this._injector.get(v), r = this._injector.get(H), t = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = e.getRenderById(t), a = (d = o == null ? void 0 : o.with(b).getSkeletonParam(i)) == null ? void 0 : d.skeleton;
|
|
1181
|
-
if (!a)
|
|
1182
|
-
throw r.error("[Facade]: `FRange.getCell` can only be called in current worksheet"), new Error("`FRange.getCell` can only be called in current worksheet");
|
|
1183
|
-
return a.getCellWithCoordByIndex(this._range.startRow, this._range.startColumn);
|
|
1184
|
-
}
|
|
1185
|
-
getCellRect() {
|
|
1186
|
-
const { startX: e, startY: r, endX: t, endY: i } = this.getCell(), o = { x: e, y: r, width: t - e, height: i - r, top: r, left: e, bottom: i, right: t };
|
|
1187
|
-
return { ...o, toJSON: () => JSON.stringify(o) };
|
|
1188
|
-
}
|
|
1189
|
-
generateHTML() {
|
|
1190
|
-
var t;
|
|
1191
|
-
const r = this._injector.get(Q).generateCopyContent(
|
|
1192
|
-
this._workbook.getUnitId(),
|
|
1193
|
-
this._worksheet.getSheetId(),
|
|
1194
|
-
this._range
|
|
1195
|
-
);
|
|
1196
|
-
return (t = r == null ? void 0 : r.html) != null ? t : "";
|
|
1197
|
-
}
|
|
1198
|
-
attachPopup(e) {
|
|
1199
|
-
var a, d, h;
|
|
1200
|
-
e.direction = (a = e.direction) != null ? a : "horizontal", e.extraProps = (d = e.extraProps) != null ? d : {}, e.offset = (h = e.offset) != null ? h : [0, 0];
|
|
1201
|
-
const { key: r, disposableCollection: t } = J(e, this._injector.get(X)), o = this._injector.get(F).attachPopupToCell(
|
|
1202
|
-
this._range.startRow,
|
|
1203
|
-
this._range.startColumn,
|
|
1204
|
-
{ ...e, componentKey: r },
|
|
1205
|
-
this.getUnitId(),
|
|
1206
|
-
this._worksheet.getSheetId()
|
|
1207
|
-
);
|
|
1208
|
-
return o ? (t.add(o), t) : (t.dispose(), null);
|
|
1209
|
-
}
|
|
1210
|
-
attachAlertPopup(e) {
|
|
1211
|
-
const r = this._injector.get(Ie), t = {
|
|
1212
|
-
workbook: this._workbook,
|
|
1213
|
-
worksheet: this._worksheet,
|
|
1214
|
-
row: this._range.startRow,
|
|
1215
|
-
col: this._range.startColumn,
|
|
1216
|
-
unitId: this.getUnitId(),
|
|
1217
|
-
subUnitId: this._worksheet.getSheetId()
|
|
1218
|
-
};
|
|
1219
|
-
return r.showAlert({
|
|
1220
|
-
...e,
|
|
1221
|
-
location: t
|
|
1222
|
-
}), {
|
|
1223
|
-
dispose: () => {
|
|
1224
|
-
r.removeAlert(e.key);
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
|
-
}
|
|
1228
|
-
/**
|
|
1229
|
-
* attachDOMPopup
|
|
1230
|
-
* @param popup
|
|
1231
|
-
* @returns {IDisposable} disposable
|
|
1232
|
-
let sheet = univerAPI.getActiveWorkbook().getActiveSheet();
|
|
1233
|
-
let range = sheet.getRange(2, 2, 3, 3);
|
|
1234
|
-
univerAPI.getActiveWorkbook().setActiveRange(range);
|
|
1235
|
-
let disposable = range.attachDOMPopup({
|
|
1236
|
-
componentKey: 'univer.sheet.single-dom-popup',
|
|
1237
|
-
extraProps: { alert: { type: 0, title: 'This is an Info', message: 'This is an info message' } },
|
|
1238
|
-
});
|
|
1239
|
-
*/
|
|
1240
|
-
attachRangePopup(e) {
|
|
1241
|
-
var a, d, h;
|
|
1242
|
-
e.direction = (a = e.direction) != null ? a : "top-center", e.extraProps = (d = e.extraProps) != null ? d : {}, e.offset = (h = e.offset) != null ? h : [0, 0];
|
|
1243
|
-
const { key: r, disposableCollection: t } = J(e, this._injector.get(X)), o = this._injector.get(F).attachRangePopup(
|
|
1244
|
-
this._range,
|
|
1245
|
-
{ ...e, componentKey: r },
|
|
1246
|
-
this.getUnitId(),
|
|
1247
|
-
this._worksheet.getSheetId()
|
|
1248
|
-
);
|
|
1249
|
-
return o ? (t.add(o), t) : (t.dispose(), null);
|
|
1250
|
-
}
|
|
1251
|
-
highlight(e, r) {
|
|
1252
|
-
const t = this._injector.get(ee), i = t.addShape({ range: this._range, style: e, primary: r });
|
|
1253
|
-
if (!i)
|
|
1254
|
-
throw new Error("Failed to highlight current range");
|
|
1255
|
-
return S(() => {
|
|
1256
|
-
t.removeShape(i);
|
|
1257
|
-
});
|
|
1258
|
-
}
|
|
1259
|
-
showDropdown(e) {
|
|
1260
|
-
return this._injector.get(Pe).showDropdown(e);
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
ie.extend(We);
|
|
1264
|
-
function J(C, e) {
|
|
1265
|
-
const { componentKey: r, isVue3: t } = C;
|
|
1266
|
-
let i;
|
|
1267
|
-
const o = new T();
|
|
1268
|
-
return typeof r == "string" ? i = r : (i = `External_${he(6)}`, o.add(e.register(i, r, { framework: t ? "vue3" : "react" }))), {
|
|
1269
|
-
key: i,
|
|
1270
|
-
disposableCollection: o
|
|
1271
|
-
};
|
|
1272
|
-
}
|
|
1273
|
-
export {
|
|
1274
|
-
je as FSheetsUIEnum,
|
|
1275
|
-
J as transformComponentKey
|
|
1276
|
-
};
|
|
1
|
+
import{CanceledError as e,DOCS_NORMAL_EDITOR_UNIT_ID_KEY as t,DisposableCollection as n,ICommandService as r,ILogService as i,IPermissionService as a,IUniverInstanceService as o,InterceptorEffectEnum as s,LifecycleService as c,LifecycleStages as l,RichTextValue as u,UniverInstanceType as d,awaitTime as f,generateRandomId as p,toDisposable as m}from"@univerjs/core";import{FEnum as ee,FEventName as te,FUniver as h}from"@univerjs/core/facade";import{RichTextEditingMutation as ne}from"@univerjs/docs";import{DeviceInputEventType as g,IRenderManagerService as _,SHEET_VIEWPORT_KEY as v}from"@univerjs/engine-render";import{COMMAND_LISTENER_SKELETON_CHANGE as re,INTERCEPTOR_POINT as ie,InterceptCellContentPriority as ae,SetWorksheetRowIsAutoHeightCommand as oe,SheetInterceptorService as se,SheetsSelectionsService as y,getSkeletonChangedEffectedRange as ce}from"@univerjs/sheets";import{CellAlertManagerService as le,DragManagerService as b,HoverManagerService as x,IEditorBridgeService as S,IMarkSelectionService as C,ISheetCellDropdownManagerService as ue,ISheetClipboardService as w,ISheetSelectionRenderService as T,SHEET_VIEW_KEY as E,SetCellEditVisibleOperation as D,SetColumnHeaderHeightCommand as O,SetRowHeaderWidthCommand as k,SetWorksheetColAutoWidthCommand as A,SetZoomRatioCommand as j,SheetCanvasPopManagerService as M,SheetPasteShortKeyCommand as N,SheetPermissionRenderManagerService as P,SheetScrollManagerService as F,SheetSkeletonManagerService as I,SheetsScrollRenderController as de}from"@univerjs/sheets-ui";import{FPermission as L,FRange as R,FSheetHooks as z,FWorkbook as B,FWorksheet as V}from"@univerjs/sheets/facade";import{ComponentManager as H,CopyCommand as U,CutCommand as W,HTML_CLIPBOARD_MIME_TYPE as G,IClipboardInterfaceService as fe,IDialogService as pe,ISidebarService as me,KeyCode as K,PLAIN_TEXT_CLIPBOARD_MIME_TYPE as q,PasteCommand as J,supportClipboardAPI as Y}from"@univerjs/ui";import{combineLatest as he,filter as X}from"rxjs";var ge=class extends h{_initSheetUIEvent(n){let i=n.get(r);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>i.beforeCommandExecuted(t=>{if(t.id!==D.id)return;let r=this.getActiveSheet();if(!r)return;let{workbook:i,worksheet:a}=r,o=n.get(S),{visible:s,keycode:c,eventType:l}=t.params,u=o.getEditLocation();if(s){let t={row:u.row,column:u.column,eventType:l,keycode:c,workbook:i,worksheet:a,isZenEditor:!1};if(this.fireEvent(this.Event.BeforeSheetEditStart,t),t.cancel)throw new e}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>i.beforeCommandExecuted(r=>{if(r.id!==D.id)return;let i=this.getActiveSheet();if(!i)return;let{workbook:a,worksheet:s}=i,c=n.get(S),l=n.get(o),{visible:d,keycode:f,eventType:p}=r.params,m=c.getEditLocation();if(!d){let n={row:m.row,column:m.column,eventType:p,keycode:f,workbook:a,worksheet:s,isZenEditor:!1,value:u.create(l.getUnit(t).getSnapshot()),isConfirm:f!==K.ESC};if(this.fireEvent(this.Event.BeforeSheetEditEnd,n),n.cancel)throw new e}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>i.onCommandExecuted(e=>{if(e.id!==D.id)return;let t=this.getCommandSheetTarget(e);if(!t)return;let{workbook:r,worksheet:i}=t,a=n.get(S),{visible:o,keycode:s,eventType:c}=e.params,l=a.getEditLocation();if(o){let e={row:l.row,column:l.column,eventType:c,keycode:s,workbook:r,worksheet:i,isZenEditor:!1};this.fireEvent(this.Event.SheetEditStarted,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>i.onCommandExecuted(e=>{if(e.id!==D.id)return;let t=this.getCommandSheetTarget(e);if(!t)return;let{workbook:r,worksheet:i}=t,a=n.get(S),{visible:o,keycode:s,eventType:c}=e.params,l=a.getEditLocation();if(!o){let e={row:l.row,column:l.column,eventType:c,keycode:s,workbook:r,worksheet:i,isZenEditor:!1,isConfirm:s!==K.ESC};this.fireEvent(this.Event.SheetEditEnded,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>i.onCommandExecuted(e=>{if(e.id!==ne.id)return;let r=this.getActiveSheet();if(!r)return;let{workbook:i,worksheet:a}=r,s=n.get(S),c=n.get(o),l=e.params;if(!s.isVisible().visible)return;let{unitId:d}=l;if(d===t){let{row:e,column:n}=s.getEditLocation(),r={workbook:i,worksheet:a,row:e,column:n,value:u.create(c.getUnit(t).getSnapshot()),isZenEditor:!1};this.fireEvent(this.Event.SheetEditChanging,r)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetZoomChange,()=>i.beforeCommandExecuted(t=>{if(t.id!==j.id)return;let n=this.getCommandSheetTarget(t);if(!n)return;let{workbook:r,worksheet:i}=n,a={zoom:t.params.zoomRatio,workbook:r,worksheet:i};if(this.fireEvent(this.Event.BeforeSheetZoomChange,a),a.cancel)throw new e}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetZoomChanged,()=>i.onCommandExecuted(e=>{if(e.id!==j.id)return;let t=this.getCommandSheetTarget(e);if(!t)return;let{workbook:n,worksheet:r}=t;this.fireEvent(this.Event.SheetZoomChanged,{zoom:r.getZoom(),workbook:n,worksheet:r})})))}_initObserverListener(e){let t=e.get(_),r=e.get(c),i=new n;this.disposeWithMe(r.lifecycle$.subscribe(t=>{if(t!==l.Rendered)return;let n=e.get(x),r=e.get(b);n&&(i.dispose(),i.add(this.registerEventHandler(this.Event.CellClicked,()=>{var e;return(e=n.currentClickedCell$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.location.unitId,e.location.subUnitId);t&&this.fireEvent(this.Event.CellClicked,{...t,...e,row:e.location.row,column:e.location.col})})})),i.add(this.registerEventHandler(this.Event.CellHover,()=>{var e;return(e=n.currentRichText$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.CellHover,{...t,...e,row:e.row,column:e.col})})})),i.add(this.registerEventHandler(this.Event.CellPointerDown,()=>{var e;return(e=n.currentPointerDownCell$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.CellPointerDown,{...t,...e,row:e.row,column:e.col})})})),i.add(this.registerEventHandler(this.Event.CellPointerUp,()=>{var e;return(e=n.currentPointerUpCell$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.CellPointerUp,{...t,...e,row:e.row,column:e.col})})})),i.add(this.registerEventHandler(this.Event.CellPointerMove,()=>{var e;return(e=n.currentCellPosWithEvent$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.CellPointerMove,{...t,...e,row:e.row,column:e.col})})})),i.add(this.registerEventHandler(this.Event.DragOver,()=>{var e;return(e=r.currentCell$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.location.unitId,e.location.subUnitId);t&&this.fireEvent(this.Event.DragOver,{...t,...e,row:e.location.row,column:e.location.col})})})),i.add(this.registerEventHandler(this.Event.Drop,()=>{var e;return(e=r.endCell$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.location.unitId,e.location.subUnitId);t&&this.fireEvent(this.Event.Drop,{...t,...e,row:e.location.row,column:e.location.col})})})),i.add(this.registerEventHandler(this.Event.RowHeaderClick,()=>{var e;return(e=n.currentRowHeaderClick$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.RowHeaderClick,{...t,row:e.index})})})),i.add(this.registerEventHandler(this.Event.RowHeaderPointerDown,()=>{var e;return(e=n.currentRowHeaderPointerDown$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.RowHeaderPointerDown,{...t,row:e.index})})})),i.add(this.registerEventHandler(this.Event.RowHeaderPointerUp,()=>{var e;return(e=n.currentRowHeaderPointerUp$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.RowHeaderPointerUp,{...t,row:e.index})})})),i.add(this.registerEventHandler(this.Event.RowHeaderHover,()=>{var e;return(e=n.currentHoveredRowHeader$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.RowHeaderHover,{...t,row:e.index})})})),i.add(this.registerEventHandler(this.Event.ColumnHeaderClick,()=>{var e;return(e=n.currentColHeaderClick$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.ColumnHeaderClick,{...t,column:e.index})})})),i.add(this.registerEventHandler(this.Event.ColumnHeaderPointerDown,()=>{var e;return(e=n.currentColHeaderPointerDown$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.ColumnHeaderPointerDown,{...t,column:e.index})})})),i.add(this.registerEventHandler(this.Event.ColumnHeaderPointerUp,()=>{var e;return(e=n.currentColHeaderPointerUp$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.ColumnHeaderPointerUp,{...t,column:e.index})})})),i.add(this.registerEventHandler(this.Event.ColumnHeaderHover,()=>{var e;return(e=n.currentHoveredColHeader$)==null?void 0:e.pipe(X(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.ColumnHeaderHover,{...t,column:e.index})})})),this.disposeWithMe(i))}));let a,o=he([t.created$,r.lifecycle$]),s=new n;this.disposeWithMe(o.subscribe(([e,t])=>{if(e.type===d.UNIVER_SHEET&&(a=e),t<=l.Rendered||!a)return;let n=this.getWorkbook(a.unitId);if(!n)return;s.dispose();let r=a.with(F),i=a.with(y);s.add(this.registerEventHandler(this.Event.Scroll,()=>r.validViewportScrollInfo$.subscribe(e=>{e&&this.fireEvent(this.Event.Scroll,{workbook:n,worksheet:n.getActiveSheet(),...e})}))),s.add(this.registerEventHandler(this.Event.SelectionMoveStart,()=>i.selectionMoveStart$.subscribe(e=>{var t;this.fireEvent(this.Event.SelectionMoveStart,{workbook:n,worksheet:n.getActiveSheet(),selections:(t=e==null?void 0:e.map(e=>e.range))==null?[]:t})}))),s.add(this.registerEventHandler(this.Event.SelectionMoving,()=>i.selectionMoving$.subscribe(e=>{var t;this.fireEvent(this.Event.SelectionMoving,{workbook:n,worksheet:n.getActiveSheet(),selections:(t=e==null?void 0:e.map(e=>e.range))==null?[]:t})}))),s.add(this.registerEventHandler(this.Event.SelectionMoveEnd,()=>i.selectionMoveEnd$.subscribe(e=>{var t;this.fireEvent(this.Event.SelectionMoveEnd,{workbook:n,worksheet:n.getActiveSheet(),selections:(t=e==null?void 0:e.map(e=>e.range))==null?[]:t})}))),s.add(this.registerEventHandler(this.Event.SelectionChanged,()=>i.selectionChanged$.subscribe(e=>{var t;this.fireEvent(this.Event.SelectionChanged,{workbook:n,worksheet:n.getActiveSheet(),selections:(t=e==null?void 0:e.map(e=>e.range))==null?[]:t})}))),a=null,this.disposeWithMe(s)}))}_initialize(e){this._initSheetUIEvent(e),this._initObserverListener(e);let t=e.get(r);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeClipboardChange,()=>t.beforeCommandExecuted(e=>{switch(e.id){case U.id:case W.id:this._beforeClipboardChange();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.ClipboardChanged,()=>t.onCommandExecuted(e=>{switch(e.id){case U.id:case W.id:this._clipboardChanged();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeClipboardPaste,()=>t.beforeCommandExecuted(e=>{switch(e.id){case N.id:this._beforeClipboardPaste(e.params);break;case J.id:this._beforeClipboardPasteAsync();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.ClipboardPasted,()=>t.onCommandExecuted(e=>{switch(e.id){case N.id:this._clipboardPaste(e.params);break;case J.id:this._clipboardPasteAsync();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetSkeletonChanged,()=>t.onCommandExecuted(e=>{if(re.indexOf(e.id)>-1){let t=this.getActiveSheet();if(!t)return;let n=ce(e,t.worksheet.getMaxColumns()).map(e=>{var t;return(t=this.getWorkbook(e.unitId))==null||(t=t.getSheetBySheetId(e.subUnitId))==null?void 0:t.getRange(e.range)}).filter(Boolean);if(!n.length)return;this.fireEvent(this.Event.SheetSkeletonChanged,{workbook:t.workbook,worksheet:t.worksheet,payload:e,skeleton:t.worksheet.getSkeleton(),effectedRanges:n})}})))}_generateClipboardCopyParam(){let e=this.getActiveWorkbook(),t=e==null?void 0:e.getActiveSheet(),n=e==null?void 0:e.getActiveRange();if(!e||!t||!n)return;let r=this._injector.get(w).generateCopyContent(e.getId(),t.getSheetId(),n.getRange());if(!r)return;let{html:i,plain:a}=r;return{workbook:e,worksheet:t,text:a,html:i,fromSheet:t,fromRange:n}}_beforeClipboardChange(){let t=this._generateClipboardCopyParam();if(t&&(this.fireEvent(this.Event.BeforeClipboardChange,t),t.cancel))throw new e}_clipboardChanged(){let e=this._generateClipboardCopyParam();e&&this.fireEvent(this.Event.ClipboardChanged,e)}_generateClipboardPasteParam(e){if(!e)return;let{htmlContent:t,textContent:n}=e,r=this.getActiveWorkbook(),i=r==null?void 0:r.getActiveSheet();if(!(!r||!i))return{workbook:r,worksheet:i,text:n,html:t}}async _generateClipboardPasteParamAsync(){let e=this.getActiveWorkbook(),t=e==null?void 0:e.getActiveSheet();if(!e||!t)return;let n=(await this._injector.get(fe).read())[0],r;if(n){let i=n.types;r={workbook:e,worksheet:t,text:i.indexOf(q)===-1?``:await n.getType(q).then(e=>e&&e.text()),html:i.indexOf(G)===-1?``:await n.getType(G).then(e=>e&&e.text())}}return r}_beforeClipboardPaste(t){let n=this._generateClipboardPasteParam(t);if(n&&(this.fireEvent(this.Event.BeforeClipboardPaste,n),n.cancel))throw new e}_clipboardPaste(t){let n=this._generateClipboardPasteParam(t);if(n&&(this.fireEvent(this.Event.ClipboardPasted,n),n.cancel))throw new e}async _beforeClipboardPasteAsync(){if(!Y()){this._injector.get(i).warn(`[Facade]: The navigator object only supports the browser environment`);return}let t=await this._generateClipboardPasteParamAsync();if(t&&(this.fireEvent(this.Event.BeforeClipboardPaste,t),t.cancel))throw new e}async _clipboardPasteAsync(){if(!Y()){this._injector.get(i).warn(`[Facade]: The navigator object only supports the browser environment`);return}let t=await this._generateClipboardPasteParamAsync();if(t&&(this.fireEvent(this.Event.ClipboardPasted,t),t.cancel))throw new e}customizeColumnHeader(e){var t;let n=this.getActiveWorkbook();if(!n){console.error(`WorkBook not exist`);return}let r=n==null?void 0:n.getId(),i=this._injector.get(_),a=n.getActiveSheet(),o=a.getSheetId(),s=i.getRenderById(r);if(s&&(t=e.headerStyle)!=null&&t.size){var c;s.with(I).setColumnHeaderSize(s,o,(c=e.headerStyle)==null?void 0:c.size),a==null||a.refreshCanvas()}this._getSheetRenderComponent(r,E.COLUMN).setCustomHeader(e),a==null||a.refreshCanvas()}customizeRowHeader(e){let t=this.getActiveWorkbook();if(!t){console.error(`WorkBook not exist`);return}let n=t==null?void 0:t.getId();this._getSheetRenderComponent(n,E.ROW).setCustomHeader(e)}registerSheetRowHeaderExtension(e,...t){let n=this._getSheetRenderComponent(e,E.ROW),r=n.register(...t);return m(()=>{r.dispose(),n.makeDirty(!0)})}registerSheetColumnHeaderExtension(e,...t){let n=this._getSheetRenderComponent(e,E.COLUMN),r=n.register(...t);return m(()=>{r.dispose(),n.makeDirty(!0)})}registerSheetMainExtension(e,...t){let n=this._getSheetRenderComponent(e,E.MAIN),r=n.register(...t);return m(()=>{r.dispose(),n.makeDirty(!0)})}_getSheetRenderComponent(e,t){let n=this._injector.get(_).getRenderById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,i=r.get(t);if(!i)throw Error(`Render component not found`);return i}getSheetHooks(){return this._injector.createInstance(z)}pasteIntoSheet(e,t,n){return this._commandService.executeCommand(N.id,{htmlContent:e,textContent:t,files:n})}setProtectedRangeShadowStrategy(e){this._injector.get(P).setProtectedRangeShadowStrategy(e)}getProtectedRangeShadowStrategy(){return this._injector.get(P).getProtectedRangeShadowStrategy()}getProtectedRangeShadowStrategy$(){return this._injector.get(P).getProtectedRangeShadowStrategy$()}setPermissionDialogVisible(e){this._injector.get(a).setShowComponents(e)}};h.extend(ge);var _e=class extends B{openSiderbar(e){return this._logDeprecation(`openSiderbar`),this._injector.get(me).open(e)}openDialog(e){this._logDeprecation(`openDialog`);let t=this._injector.get(pe).open({...e,onClose:()=>{t.dispose()}});return t}customizeColumnHeader(e){let t=this._workbook.getUnitId();this._getSheetRenderComponent(t,E.COLUMN).setCustomHeader(e)}customizeRowHeader(e){let t=this._workbook.getUnitId();this._getSheetRenderComponent(t,E.ROW).setCustomHeader(e)}_getSheetRenderComponent(e,t){let n=this._injector.get(_).getRenderById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,i=r.get(t);if(!i)throw Error(`Render component not found`);return i}_logDeprecation(e){this._injector.get(i).warn(`[FWorkbook]`,`${e} is deprecated. Please use the function of the same name on "FUniver".`)}generateCellParams(e){let t=this.getActiveSheet();return{row:e.row,column:e.col,workbook:this,worksheet:t}}onCellClick(e){return m(this._injector.get(x).currentClickedCell$.pipe(X(e=>!!e)).subscribe(t=>{e(t)}))}onCellHover(e){return m(this._injector.get(x).currentRichText$.pipe(X(e=>!!e)).subscribe(e))}onCellPointerDown(e){return m(this._injector.get(x).currentPointerDownCell$.subscribe(e))}onCellPointerUp(e){return m(this._injector.get(x).currentPointerUpCell$.subscribe(e))}onCellPointerMove(e){return m(this._injector.get(x).currentCellPosWithEvent$.pipe(X(e=>!!e)).subscribe(t=>{e(t,t.event)}))}onDragOver(e){return m(this._injector.get(b).currentCell$.pipe(X(e=>!!e)).subscribe(t=>{e(t)}))}onDrop(e){return m(this._injector.get(b).endCell$.pipe(X(e=>!!e)).subscribe(t=>{e(t)}))}startEditing(){let e=this._injector.get(r);return this._injector.get(S).isVisible().visible?!0:e.syncExecuteCommand(D.id,{eventType:g.Dblclick,unitId:this._workbook.getUnitId(),visible:!0})}async endEditing(e){let t=this._injector.get(r);return this._injector.get(S).isVisible().visible&&t.syncExecuteCommand(D.id,{eventType:g.Keyboard,keycode:e?K.ENTER:K.ESC,visible:!1,unitId:this._workbook.getUnitId()}),await f(0),!0}endEditingAsync(e=!0){return this.endEditing(e)}abortEditingAsync(){return this.endEditingAsync(!1)}isCellEditing(){return this._injector.get(S).isVisible().visible}getScrollStateBySheetId(e){let t=this._workbook.getUnitId(),n=this._injector.get(_).getRenderById(t);return n?n.with(F).getScrollStateByParam({unitId:t,sheetId:e}):null}disableSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(_).getRenderById(e);return t&&t.with(T).disableSelection(),this}enableSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(_).getRenderById(e);return t&&t.with(T).enableSelection(),this}transparentSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(_).getRenderById(e);return t&&t.with(T).transparentSelection(),this}showSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(_).getRenderById(e);return t&&t.with(T).showSelection(),this}};B.extend(_e);var ve=class extends V{refreshCanvas(){let e=this._injector.get(_),t=this._fWorkbook.id,n=e.getRenderById(t);if(!n)throw Error(`Render Unit with unitId ${t} not found`);n.with(I).reCalculate();let r=n.mainComponent;if(!r)throw Error(`Main component not found`);return r.makeDirty(),this}highlightRanges(e,t,n){let r=this._injector.get(C),i=[];for(let a of e){let e=a.getRange(),o=r.addShapeWithNoFresh({range:e,style:t,primary:n});o&&i.push(o)}if(r.refreshShapes(),i.length===0)throw Error(`Failed to highlight current range`);return m(()=>{i.forEach(e=>{r.removeShape(e)})})}zoom(e){let t=this._injector.get(r),n=Math.min(Math.max(e,.1),4);return t.executeCommand(j.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),zoomRatio:n}),this}getZoom(){return this._worksheet.getZoomRatio()}getVisibleRange(){let e=this._workbook.getUnitId(),t=this._injector.get(_).getRenderById(e);if(!t)return null;let n=t.with(I).getCurrentSkeleton();return n?n.getVisibleRangeByViewport(v.VIEW_MAIN):null}getVisibleRangesOfAllViewports(){let e=this._workbook.getUnitId(),t=this._injector.get(_).getRenderById(e);if(!t)return null;let n=t.with(I).getCurrentSkeleton();return n?n.getVisibleRanges():null}scrollToCell(e,t,n){let r=this._workbook.getUnitId(),i=this._injector.get(_).getRenderById(r);return i&&(i==null?void 0:i.with(de)).scrollToCell(e,t,n),this}getScrollState(){let e={offsetX:0,offsetY:0,sheetViewStartColumn:0,sheetViewStartRow:0},t=this._workbook.getUnitId(),n=this._worksheet.getSheetId(),r=this._injector.get(_).getRenderById(t);return r&&r.with(F).getScrollStateByParam({unitId:t,sheetId:n})||e}onScroll(e){var t;let n=this._workbook.getUnitId(),r=(t=this._injector.get(_).getRenderById(n))==null?void 0:t.with(F);return m(r?r.validViewportScrollInfo$.subscribe(t=>{e(t)}):()=>{})}getSkeleton(){var e,t;let n=(e=this._injector.get(_).getRenderById(this._workbook.getUnitId()))==null?void 0:e.with(I);return n==null||(t=n.getWorksheetSkeleton(this._worksheet.getSheetId()))==null?void 0:t.skeleton}autoResizeColumn(e){return this.autoResizeColumns(e,1)}autoResizeColumns(e,t){let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=[{startColumn:e,endColumn:e+t-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(A.id,{unitId:n,subUnitId:r,ranges:i}),this}setColumnAutoWidth(e,t){return this.autoResizeColumns(e,t)}autoResizeRows(e,t){let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=[{startRow:e,endRow:e+t-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(oe.id,{unitId:n,subUnitId:r,ranges:i}),this}customizeColumnHeader(e){var t;let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=this._injector.get(_).getRenderById(n);if(i&&(t=e.headerStyle)!=null&&t.size){var a;i.with(I).setColumnHeaderSize(i,r,(a=e.headerStyle)==null?void 0:a.size)}this._getSheetRenderComponent(n,E.COLUMN).setCustomHeader(e,r)}customizeRowHeader(e){var t;let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),i=this._injector.get(_).getRenderById(n);if(i&&(t=e.headerStyle)!=null&&t.size){var a;i.with(I).setRowHeaderSize(i,r,(a=e.headerStyle)==null?void 0:a.size)}this._getSheetRenderComponent(n,E.ROW).setCustomHeader(e,r)}setColumnHeaderHeight(e){let t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.executeCommand(O.id,{unitId:t,subUnitId:n,size:e}),this}setRowHeaderWidth(e){let t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.executeCommand(k.id,{unitId:t,subUnitId:n,size:e}),this}_getSheetRenderComponent(e,t){let n=this._injector.get(_).getRenderById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,i=r.get(t);if(!i)throw Error(`Render component not found`);return i}};V.extend(ve);var ye=class extends L{setPermissionDialogVisible(e){this._permissionService.setShowComponents(e)}};L.extend(ye);var be=class extends z{onCellPointerMove(e){return m(this._injector.get(x).currentPosition$.subscribe(e))}onCellPointerOver(e){return m(this._injector.get(x).currentCell$.subscribe(e))}onCellDragOver(e){return m(this._injector.get(b).currentCell$.subscribe(e))}onCellDrop(e){return m(this._injector.get(b).endCell$.subscribe(e))}onCellRender(e,t=s.Style,n=ae.DATA_VALIDATION){return this._injector.get(se).intercept(ie.CELL_CONTENT,{effect:t,handler:(t,n,r)=>(t&&!t.customRender&&e&&(t.customRender=[...e]),r(t)),priority:n})}onBeforeCellEdit(e){return this._injector.get(r).beforeCommandExecuted(t=>{let n=t.params;t.id===D.id&&n.visible&&e(n)})}onAfterCellEdit(e){return this._injector.get(r).onCommandExecuted(t=>{let n=t.params;t.id===D.id&&!n.visible&&e(n)})}};z.extend(be);const Z={CellClicked:`CellClicked`,CellPointerDown:`CellPointerDown`,CellPointerUp:`CellPointerUp`,CellPointerMove:`CellPointerMove`,CellHover:`CellHover`,DragOver:`DragOver`,Drop:`Drop`,Scroll:`Scroll`,SelectionMoveStart:`SelectionMoveStart`,SelectionMoving:`SelectionMoving`,SelectionMoveEnd:`SelectionMoveEnd`,SelectionChanged:`SelectionChanged`};var xe=class{get BeforeClipboardChange(){return`BeforeClipboardChange`}get ClipboardChanged(){return`ClipboardChanged`}get BeforeClipboardPaste(){return`BeforeClipboardPaste`}get ClipboardPasted(){return`ClipboardPasted`}get BeforeSheetEditStart(){return`BeforeSheetEditStart`}get SheetEditStarted(){return`SheetEditStarted`}get SheetEditChanging(){return`SheetEditChanging`}get BeforeSheetEditEnd(){return`BeforeSheetEditEnd`}get SheetEditEnded(){return`SheetEditEnded`}get CellClicked(){return Z.CellClicked}get CellHover(){return Z.CellHover}get CellPointerDown(){return Z.CellPointerDown}get CellPointerUp(){return Z.CellPointerUp}get CellPointerMove(){return Z.CellPointerMove}get DragOver(){return`DragOver`}get Drop(){return`Drop`}get Scroll(){return`Scroll`}get SelectionMoveStart(){return`SelectionMoveStart`}get SelectionChanged(){return`SelectionChanged`}get SelectionMoving(){return`SelectionMoving`}get SelectionMoveEnd(){return`SelectionMoveEnd`}get RowHeaderClick(){return`RowHeaderClick`}get RowHeaderPointerDown(){return`RowHeaderPointerDown`}get RowHeaderPointerUp(){return`RowHeaderPointerUp`}get RowHeaderHover(){return`RowHeaderHover`}get ColumnHeaderClick(){return`ColumnHeaderClick`}get ColumnHeaderPointerDown(){return`ColumnHeaderPointerDown`}get ColumnHeaderPointerUp(){return`ColumnHeaderPointerUp`}get ColumnHeaderHover(){return`ColumnHeaderHover`}get SheetSkeletonChanged(){return`SheetSkeletonChanged`}get BeforeSheetZoomChange(){return`BeforeSheetZoomChange`}get SheetZoomChanged(){return`SheetZoomChanged`}};te.extend(xe);var Q=class{get SHEET_VIEWPORT_KEY(){return v}};ee.extend(Q);var Se=class extends R{getCell(){var e;let t=this._injector.get(_),n=this._injector.get(i),r=this._workbook.getUnitId(),a=this._worksheet.getSheetId(),o=t.getRenderById(r),s=o==null||(e=o.with(I).getSkeletonParam(a))==null?void 0:e.skeleton;if(!s)throw n.error("[Facade]: `FRange.getCell` can only be called in current worksheet"),Error("`FRange.getCell` can only be called in current worksheet");return s.getCellWithCoordByIndex(this._range.startRow,this._range.startColumn)}getCellRect(){let{startX:e,startY:t,endX:n,endY:r}=this.getCell(),i={x:e,y:t,width:n-e,height:r-t,top:t,left:e,bottom:r,right:n};return{...i,toJSON:()=>JSON.stringify(i)}}generateHTML(){var e;let t=this._injector.get(w).generateCopyContent(this._workbook.getUnitId(),this._worksheet.getSheetId(),this._range);return(e=t==null?void 0:t.html)==null?``:e}attachPopup(e){var t,n,r;e.direction=(t=e.direction)==null?`horizontal`:t,e.extraProps=(n=e.extraProps)==null?{}:n,e.offset=(r=e.offset)==null?[0,0]:r;let{key:i,disposableCollection:a}=$(e,this._injector.get(H)),o=this._injector.get(M).attachPopupToCell(this._range.startRow,this._range.startColumn,{...e,componentKey:i},this.getUnitId(),this._worksheet.getSheetId());return o?(a.add(o),a):(a.dispose(),null)}attachAlertPopup(e){let t=this._injector.get(le),n={workbook:this._workbook,worksheet:this._worksheet,row:this._range.startRow,col:this._range.startColumn,unitId:this.getUnitId(),subUnitId:this._worksheet.getSheetId()};return t.showAlert({...e,location:n}),{dispose:()=>{t.removeAlert(e.key)}}}attachRangePopup(e){var t,n,r;e.direction=(t=e.direction)==null?`top-center`:t,e.extraProps=(n=e.extraProps)==null?{}:n,e.offset=(r=e.offset)==null?[0,0]:r;let{key:i,disposableCollection:a}=$(e,this._injector.get(H)),o=this._injector.get(M).attachRangePopup(this._range,{...e,componentKey:i},this.getUnitId(),this._worksheet.getSheetId());return o?(a.add(o),a):(a.dispose(),null)}highlight(e,t){let n=this._injector.get(C),r=n.addShape({range:this._range,style:e,primary:t});if(!r)throw Error(`Failed to highlight current range`);return m(()=>{n.removeShape(r)})}showDropdown(e){return this._injector.get(ue).showDropdown(e)}};R.extend(Se);function $(e,t){let{componentKey:r,isVue3:i}=e,a,o=new n;return typeof r==`string`?a=r:(a=`External_${p(6)}`,o.add(t.register(a,r,{framework:i?`vue3`:`react`}))),{key:a,disposableCollection:o}}export{Q as FSheetsUIEnum,$ as transformComponentKey};
|