@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
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IShapeProps, UniverRenderingContext } from '@univerjs/engine-render';
|
|
17
|
+
import { Shape } from '@univerjs/engine-render';
|
|
2
18
|
export interface IHeaderMenuShapeResizeProps extends IShapeProps {
|
|
3
19
|
size?: number;
|
|
4
20
|
mode?: HEADER_RESIZE_SHAPE_TYPE;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IShapeProps, UniverRenderingContext } from '@univerjs/engine-render';
|
|
17
|
+
import { Shape } from '@univerjs/engine-render';
|
|
2
18
|
export declare enum HeaderUnhideShapeType {
|
|
3
19
|
ROW = 0,
|
|
4
20
|
COLUMN = 1
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { ICellDataForSheetInterceptor, IScale } from '@univerjs/core';
|
|
17
|
+
import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
|
|
18
|
+
import type { ICellPermission } from '@univerjs/sheets';
|
|
19
|
+
import { SheetExtension } from '@univerjs/engine-render';
|
|
4
20
|
export declare const RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY = "RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY";
|
|
5
21
|
export declare const RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY = "RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY";
|
|
6
22
|
export type IRangeProtectionRenderCellData = ICellDataForSheetInterceptor & {
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IScale } from '@univerjs/core';
|
|
17
|
+
import type { SpreadsheetSkeleton, UniverRenderingContext } from '@univerjs/engine-render';
|
|
18
|
+
import { SheetExtension } from '@univerjs/engine-render';
|
|
3
19
|
export declare const worksheetProtectionKey = "worksheet-protection";
|
|
4
20
|
export declare class WorksheetProtectionRenderExtension extends SheetExtension {
|
|
5
21
|
uKey: string;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IPermissionPanelRule } from '../../../services/permission/sheet-permission-panel.model';
|
|
2
17
|
interface ISheetPermissionPanelProps {
|
|
3
18
|
showDetail: boolean;
|
|
4
19
|
fromSheetBar: boolean;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IRange } from '@univerjs/core';
|
|
17
|
+
import type { IPermissionPanelRule } from '../../../services/permission/sheet-permission-panel.model';
|
|
3
18
|
import { EditStateEnum, ViewStateEnum } from '@univerjs/sheets';
|
|
4
19
|
interface IPermissionDetailFooterPartProps {
|
|
5
20
|
permissionId: string;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IRange } from '@univerjs/core';
|
|
2
17
|
interface IPermissionDetailMainPartProps {
|
|
3
18
|
permissionId: string;
|
|
4
19
|
ranges: IRange[];
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IPermissionPanelRule } from '../../../services/permission/sheet-permission-panel.model';
|
|
2
17
|
interface ISheetPermissionPanelDetailProps {
|
|
3
18
|
fromSheetBar: boolean;
|
|
4
19
|
rule?: IPermissionPanelRule;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
1
16
|
import { EditStateEnum, ViewStateEnum } from '@univerjs/sheets';
|
|
2
17
|
export interface IPermissionDetailUserPartProps {
|
|
3
18
|
editState: EditStateEnum;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { ReactNode } from 'react';
|
|
2
17
|
interface ISpinProps {
|
|
3
18
|
loading: boolean;
|
|
4
19
|
children: ReactNode;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Injector, IRange, Worksheet } from '@univerjs/core';
|
|
17
|
+
import type { IPermissionPanelRule } from '../../services/permission/sheet-permission-panel.model';
|
|
3
18
|
import { EditStateEnum, UnitObject, ViewStateEnum } from '@univerjs/sheets';
|
|
4
19
|
export declare const checkRangeValid: (injector: Injector, permissionRanges: IRange[], permissionId: string, unitId: string, subUnitId: string) => string | undefined;
|
|
5
20
|
export declare const checkRangesIsWholeSheet: (ranges: IRange[], sheet: Worksheet) => boolean;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
2
17
|
export interface IBaseSheetBarButtonProps {
|
|
3
18
|
children?: ReactNode;
|
|
4
19
|
/** Semantic DOM class */
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { ReactNode } from 'react';
|
|
2
17
|
export interface ISheetBarMenuItem {
|
|
3
18
|
label?: ReactNode;
|
|
4
19
|
hidden?: boolean;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { BooleanNumber } from '@univerjs/core';
|
|
17
|
+
import type { CSSProperties, KeyboardEventHandler, ReactNode } from 'react';
|
|
3
18
|
export interface IBaseSheetBarProps {
|
|
4
19
|
label?: ReactNode;
|
|
5
20
|
children?: unknown[];
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IContextMenuAnchorRect } from '@univerjs/ui';
|
|
17
|
+
import type { ReactElement } from 'react';
|
|
3
18
|
interface ISheetBarTabsContextMenuProps {
|
|
4
19
|
children: ReactElement;
|
|
5
20
|
anchorRect: IContextMenuAnchorRect | null;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
1
16
|
import { Animate } from './animate';
|
|
2
17
|
export interface IScrollState {
|
|
3
18
|
leftEnd: boolean;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IFunctionNames } from '@univerjs/engine-formula';
|
|
17
|
+
import type { FC } from 'react';
|
|
3
18
|
export interface IStatisticItem {
|
|
4
19
|
name: IFunctionNames;
|
|
5
20
|
value: number;
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(E,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/sheets"),require("@univerjs/sheets-ui"),require("@univerjs/sheets/facade"),require("@univerjs/ui"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/core/facade","@univerjs/docs","@univerjs/engine-render","@univerjs/sheets","@univerjs/sheets-ui","@univerjs/sheets/facade","@univerjs/ui","rxjs"],c):(E=typeof globalThis<"u"?globalThis:E||self,c(E.UniverSheetsUiFacade={},E.UniverCore,E.UniverCoreFacade,E.UniverDocs,E.UniverEngineRender,E.UniverSheets,E.UniverSheetsUi,E.UniverSheetsFacade,E.UniverUi,E.rxjs))})(this,(function(E,c,_,R,u,I,s,b,C,m){"use strict";class H extends _.FUniver{_initSheetUIEvent(e){const r=e.get(c.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>r.beforeCommandExecuted(t=>{if(t.id!==s.SetCellEditVisibleOperation.id)return;const i=this.getActiveSheet();if(!i)return;const{workbook:o,worksheet:d}=i,l=e.get(s.IEditorBridgeService),g=t.params,{visible:v,keycode:S,eventType:h}=g,n=l.getEditLocation();if(v){const a={row:n.row,column:n.column,eventType:h,keycode:S,workbook:o,worksheet:d,isZenEditor:!1};if(this.fireEvent(this.Event.BeforeSheetEditStart,a),a.cancel)throw new c.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>r.beforeCommandExecuted(t=>{if(t.id!==s.SetCellEditVisibleOperation.id)return;const i=this.getActiveSheet();if(!i)return;const{workbook:o,worksheet:d}=i,l=e.get(s.IEditorBridgeService),g=e.get(c.IUniverInstanceService),v=t.params,{visible:S,keycode:h,eventType:n}=v,a=l.getEditLocation();if(!S){const p={row:a.row,column:a.column,eventType:n,keycode:h,workbook:o,worksheet:d,isZenEditor:!1,value:c.RichTextValue.create(g.getUnit(c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:h!==C.KeyCode.ESC};if(this.fireEvent(this.Event.BeforeSheetEditEnd,p),p.cancel)throw new c.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>r.onCommandExecuted(t=>{if(t.id!==s.SetCellEditVisibleOperation.id)return;const i=this.getCommandSheetTarget(t);if(!i)return;const{workbook:o,worksheet:d}=i,l=e.get(s.IEditorBridgeService),g=t.params,{visible:v,keycode:S,eventType:h}=g,n=l.getEditLocation();if(v){const a={row:n.row,column:n.column,eventType:h,keycode:S,workbook:o,worksheet:d,isZenEditor:!1};this.fireEvent(this.Event.SheetEditStarted,a)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>r.onCommandExecuted(t=>{if(t.id!==s.SetCellEditVisibleOperation.id)return;const i=this.getCommandSheetTarget(t);if(!i)return;const{workbook:o,worksheet:d}=i,l=e.get(s.IEditorBridgeService),g=t.params,{visible:v,keycode:S,eventType:h}=g,n=l.getEditLocation();if(!v){const a={row:n.row,column:n.column,eventType:h,keycode:S,workbook:o,worksheet:d,isZenEditor:!1,isConfirm:S!==C.KeyCode.ESC};this.fireEvent(this.Event.SheetEditEnded,a)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>r.onCommandExecuted(t=>{if(t.id!==R.RichTextEditingMutation.id)return;const i=this.getActiveSheet();if(!i)return;const{workbook:o,worksheet:d}=i,l=e.get(s.IEditorBridgeService),g=e.get(c.IUniverInstanceService),v=t.params;if(!l.isVisible().visible)return;const{unitId:S}=v;if(S===c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY){const{row:h,column:n}=l.getEditLocation(),a={workbook:o,worksheet:d,row:h,column:n,value:c.RichTextValue.create(g.getUnit(c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!1};this.fireEvent(this.Event.SheetEditChanging,a)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetZoomChange,()=>r.beforeCommandExecuted(t=>{if(t.id!==s.SetZoomRatioCommand.id)return;const i=this.getCommandSheetTarget(t);if(!i)return;const{workbook:o,worksheet:d}=i,l={zoom:t.params.zoomRatio,workbook:o,worksheet:d};if(this.fireEvent(this.Event.BeforeSheetZoomChange,l),l.cancel)throw new c.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetZoomChanged,()=>r.onCommandExecuted(t=>{if(t.id!==s.SetZoomRatioCommand.id)return;const i=this.getCommandSheetTarget(t);if(!i)return;const{workbook:o,worksheet:d}=i;this.fireEvent(this.Event.SheetZoomChanged,{zoom:d.getZoom(),workbook:o,worksheet:d})})))}_initObserverListener(e){const r=e.get(u.IRenderManagerService),t=e.get(c.LifecycleService),i=new c.DisposableCollection;this.disposeWithMe(t.lifecycle$.subscribe(g=>{if(g!==c.LifecycleStages.Rendered)return;const v=e.get(s.HoverManagerService),S=e.get(s.DragManagerService);v&&(i.dispose(),i.add(this.registerEventHandler(this.Event.CellClicked,()=>{var h;return(h=v.currentClickedCell$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.location.unitId,n.location.subUnitId);a&&this.fireEvent(this.Event.CellClicked,{...a,...n,row:n.location.row,column:n.location.col})})})),i.add(this.registerEventHandler(this.Event.CellHover,()=>{var h;return(h=v.currentRichText$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.CellHover,{...a,...n,row:n.row,column:n.col})})})),i.add(this.registerEventHandler(this.Event.CellPointerDown,()=>{var h;return(h=v.currentPointerDownCell$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.CellPointerDown,{...a,...n,row:n.row,column:n.col})})})),i.add(this.registerEventHandler(this.Event.CellPointerUp,()=>{var h;return(h=v.currentPointerUpCell$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.CellPointerUp,{...a,...n,row:n.row,column:n.col})})})),i.add(this.registerEventHandler(this.Event.CellPointerMove,()=>{var h;return(h=v.currentCellPosWithEvent$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.CellPointerMove,{...a,...n,row:n.row,column:n.col})})})),i.add(this.registerEventHandler(this.Event.DragOver,()=>{var h;return(h=S.currentCell$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.location.unitId,n.location.subUnitId);a&&this.fireEvent(this.Event.DragOver,{...a,...n,row:n.location.row,column:n.location.col})})})),i.add(this.registerEventHandler(this.Event.Drop,()=>{var h;return(h=S.endCell$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.location.unitId,n.location.subUnitId);a&&this.fireEvent(this.Event.Drop,{...a,...n,row:n.location.row,column:n.location.col})})})),i.add(this.registerEventHandler(this.Event.RowHeaderClick,()=>{var h;return(h=v.currentRowHeaderClick$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.RowHeaderClick,{...a,row:n.index})})})),i.add(this.registerEventHandler(this.Event.RowHeaderPointerDown,()=>{var h;return(h=v.currentRowHeaderPointerDown$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.RowHeaderPointerDown,{...a,row:n.index})})})),i.add(this.registerEventHandler(this.Event.RowHeaderPointerUp,()=>{var h;return(h=v.currentRowHeaderPointerUp$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.RowHeaderPointerUp,{...a,row:n.index})})})),i.add(this.registerEventHandler(this.Event.RowHeaderHover,()=>{var h;return(h=v.currentHoveredRowHeader$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.RowHeaderHover,{...a,row:n.index})})})),i.add(this.registerEventHandler(this.Event.ColumnHeaderClick,()=>{var h;return(h=v.currentColHeaderClick$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.ColumnHeaderClick,{...a,column:n.index})})})),i.add(this.registerEventHandler(this.Event.ColumnHeaderPointerDown,()=>{var h;return(h=v.currentColHeaderPointerDown$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.ColumnHeaderPointerDown,{...a,column:n.index})})})),i.add(this.registerEventHandler(this.Event.ColumnHeaderPointerUp,()=>{var h;return(h=v.currentColHeaderPointerUp$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.ColumnHeaderPointerUp,{...a,column:n.index})})})),i.add(this.registerEventHandler(this.Event.ColumnHeaderHover,()=>{var h;return(h=v.currentHoveredColHeader$)==null?void 0:h.pipe(m.filter(n=>!!n)).subscribe(n=>{const a=this.getSheetTarget(n.unitId,n.subUnitId);a&&this.fireEvent(this.Event.ColumnHeaderHover,{...a,column:n.index})})})),this.disposeWithMe(i))}));let o;const d=m.combineLatest([r.created$,t.lifecycle$]),l=new c.DisposableCollection;this.disposeWithMe(d.subscribe(([g,v])=>{if(g.type===c.UniverInstanceType.UNIVER_SHEET&&(o=g),v<=c.LifecycleStages.Rendered||!o)return;const S=this.getWorkbook(o.unitId);if(!S)return;l.dispose();const h=o.with(s.SheetScrollManagerService),n=o.with(I.SheetsSelectionsService);l.add(this.registerEventHandler(this.Event.Scroll,()=>h.validViewportScrollInfo$.subscribe(a=>{a&&this.fireEvent(this.Event.Scroll,{workbook:S,worksheet:S.getActiveSheet(),...a})}))),l.add(this.registerEventHandler(this.Event.SelectionMoveStart,()=>n.selectionMoveStart$.subscribe(a=>{var p;this.fireEvent(this.Event.SelectionMoveStart,{workbook:S,worksheet:S.getActiveSheet(),selections:(p=a==null?void 0:a.map(f=>f.range))!=null?p:[]})}))),l.add(this.registerEventHandler(this.Event.SelectionMoving,()=>n.selectionMoving$.subscribe(a=>{var p;this.fireEvent(this.Event.SelectionMoving,{workbook:S,worksheet:S.getActiveSheet(),selections:(p=a==null?void 0:a.map(f=>f.range))!=null?p:[]})}))),l.add(this.registerEventHandler(this.Event.SelectionMoveEnd,()=>n.selectionMoveEnd$.subscribe(a=>{var p;this.fireEvent(this.Event.SelectionMoveEnd,{workbook:S,worksheet:S.getActiveSheet(),selections:(p=a==null?void 0:a.map(f=>f.range))!=null?p:[]})}))),l.add(this.registerEventHandler(this.Event.SelectionChanged,()=>n.selectionChanged$.subscribe(a=>{var p;this.fireEvent(this.Event.SelectionChanged,{workbook:S,worksheet:S.getActiveSheet(),selections:(p=a==null?void 0:a.map(f=>f.range))!=null?p:[]})}))),o=null,this.disposeWithMe(l)}))}_initialize(e){this._initSheetUIEvent(e),this._initObserverListener(e);const r=e.get(c.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeClipboardChange,()=>r.beforeCommandExecuted(t=>{switch(t.id){case C.CopyCommand.id:case C.CutCommand.id:this._beforeClipboardChange();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.ClipboardChanged,()=>r.onCommandExecuted(t=>{switch(t.id){case C.CopyCommand.id:case C.CutCommand.id:this._clipboardChanged();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeClipboardPaste,()=>r.beforeCommandExecuted(t=>{switch(t.id){case s.SheetPasteShortKeyCommand.id:this._beforeClipboardPaste(t.params);break;case C.PasteCommand.id:this._beforeClipboardPasteAsync();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.ClipboardPasted,()=>r.onCommandExecuted(t=>{switch(t.id){case s.SheetPasteShortKeyCommand.id:this._clipboardPaste(t.params);break;case C.PasteCommand.id:this._clipboardPasteAsync();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetSkeletonChanged,()=>r.onCommandExecuted(t=>{if(I.COMMAND_LISTENER_SKELETON_CHANGE.indexOf(t.id)>-1){const i=this.getActiveSheet();if(!i)return;const o=I.getSkeletonChangedEffectedRange(t,i.worksheet.getMaxColumns()).map(d=>{var l,g;return(g=(l=this.getWorkbook(d.unitId))==null?void 0:l.getSheetBySheetId(d.subUnitId))==null?void 0:g.getRange(d.range)}).filter(Boolean);if(!o.length)return;this.fireEvent(this.Event.SheetSkeletonChanged,{workbook:i.workbook,worksheet:i.worksheet,payload:t,skeleton:i.worksheet.getSkeleton(),effectedRanges:o})}})))}_generateClipboardCopyParam(){const e=this.getActiveWorkbook(),r=e==null?void 0:e.getActiveSheet(),t=e==null?void 0:e.getActiveRange();if(!e||!r||!t)return;const o=this._injector.get(s.ISheetClipboardService).generateCopyContent(e.getId(),r.getSheetId(),t.getRange());if(!o)return;const{html:d,plain:l}=o;return{workbook:e,worksheet:r,text:l,html:d,fromSheet:r,fromRange:t}}_beforeClipboardChange(){const e=this._generateClipboardCopyParam();if(e&&(this.fireEvent(this.Event.BeforeClipboardChange,e),e.cancel))throw new c.CanceledError}_clipboardChanged(){const e=this._generateClipboardCopyParam();e&&this.fireEvent(this.Event.ClipboardChanged,e)}_generateClipboardPasteParam(e){if(!e)return;const{htmlContent:r,textContent:t}=e,i=this.getActiveWorkbook(),o=i==null?void 0:i.getActiveSheet();return!i||!o?void 0:{workbook:i,worksheet:o,text:t,html:r}}async _generateClipboardPasteParamAsync(){const e=this.getActiveWorkbook(),r=e==null?void 0:e.getActiveSheet();if(!e||!r)return;const o=(await this._injector.get(C.IClipboardInterfaceService).read())[0];let d;if(o){const l=o.types,g=l.indexOf(C.PLAIN_TEXT_CLIPBOARD_MIME_TYPE)!==-1?await o.getType(C.PLAIN_TEXT_CLIPBOARD_MIME_TYPE).then(S=>S&&S.text()):"",v=l.indexOf(C.HTML_CLIPBOARD_MIME_TYPE)!==-1?await o.getType(C.HTML_CLIPBOARD_MIME_TYPE).then(S=>S&&S.text()):"";d={workbook:e,worksheet:r,text:g,html:v}}return d}_beforeClipboardPaste(e){const r=this._generateClipboardPasteParam(e);if(r&&(this.fireEvent(this.Event.BeforeClipboardPaste,r),r.cancel))throw new c.CanceledError}_clipboardPaste(e){const r=this._generateClipboardPasteParam(e);if(r&&(this.fireEvent(this.Event.ClipboardPasted,r),r.cancel))throw new c.CanceledError}async _beforeClipboardPasteAsync(){if(!C.supportClipboardAPI()){this._injector.get(c.ILogService).warn("[Facade]: The navigator object only supports the browser environment");return}const e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.BeforeClipboardPaste,e),e.cancel))throw new c.CanceledError}async _clipboardPasteAsync(){if(!C.supportClipboardAPI()){this._injector.get(c.ILogService).warn("[Facade]: The navigator object only supports the browser environment");return}const e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.ClipboardPasted,e),e.cancel))throw new c.CanceledError}customizeColumnHeader(e){var v,S;const r=this.getActiveWorkbook();if(!r){console.error("WorkBook not exist");return}const t=r==null?void 0:r.getId(),i=this._injector.get(u.IRenderManagerService),o=r.getActiveSheet(),d=o.getSheetId(),l=i.getRenderById(t);l&&((v=e.headerStyle)!=null&&v.size)&&(l.with(s.SheetSkeletonManagerService).setColumnHeaderSize(l,d,(S=e.headerStyle)==null?void 0:S.size),o==null||o.refreshCanvas()),this._getSheetRenderComponent(t,s.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e),o==null||o.refreshCanvas()}customizeRowHeader(e){const r=this.getActiveWorkbook();if(!r){console.error("WorkBook not exist");return}const t=r==null?void 0:r.getId();this._getSheetRenderComponent(t,s.SHEET_VIEW_KEY.ROW).setCustomHeader(e)}registerSheetRowHeaderExtension(e,...r){const t=this._getSheetRenderComponent(e,s.SHEET_VIEW_KEY.ROW),i=t.register(...r);return c.toDisposable(()=>{i.dispose(),t.makeDirty(!0)})}registerSheetColumnHeaderExtension(e,...r){const t=this._getSheetRenderComponent(e,s.SHEET_VIEW_KEY.COLUMN),i=t.register(...r);return c.toDisposable(()=>{i.dispose(),t.makeDirty(!0)})}registerSheetMainExtension(e,...r){const t=this._getSheetRenderComponent(e,s.SHEET_VIEW_KEY.MAIN),i=t.register(...r);return c.toDisposable(()=>{i.dispose(),t.makeDirty(!0)})}_getSheetRenderComponent(e,r){const i=this._injector.get(u.IRenderManagerService).getRenderById(e);if(!i)throw new Error(`Render Unit with unitId ${e} not found`);const{components:o}=i,d=o.get(r);if(!d)throw new Error("Render component not found");return d}getSheetHooks(){return this._injector.createInstance(b.FSheetHooks)}pasteIntoSheet(e,r,t){return this._commandService.executeCommand(s.SheetPasteShortKeyCommand.id,{htmlContent:e,textContent:r,files:t})}setProtectedRangeShadowStrategy(e){this._injector.get(s.SheetPermissionRenderManagerService).setProtectedRangeShadowStrategy(e)}getProtectedRangeShadowStrategy(){return this._injector.get(s.SheetPermissionRenderManagerService).getProtectedRangeShadowStrategy()}getProtectedRangeShadowStrategy$(){return this._injector.get(s.SheetPermissionRenderManagerService).getProtectedRangeShadowStrategy$()}setPermissionDialogVisible(e){this._injector.get(c.IPermissionService).setShowComponents(e)}}_.FUniver.extend(H);class y extends b.FWorkbook{openSiderbar(e){return this._logDeprecation("openSiderbar"),this._injector.get(C.ISidebarService).open(e)}openDialog(e){this._logDeprecation("openDialog");const t=this._injector.get(C.IDialogService).open({...e,onClose:()=>{t.dispose()}});return t}customizeColumnHeader(e){const r=this._workbook.getUnitId();this._getSheetRenderComponent(r,s.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e)}customizeRowHeader(e){const r=this._workbook.getUnitId();this._getSheetRenderComponent(r,s.SHEET_VIEW_KEY.ROW).setCustomHeader(e)}_getSheetRenderComponent(e,r){const i=this._injector.get(u.IRenderManagerService).getRenderById(e);if(!i)throw new Error(`Render Unit with unitId ${e} not found`);const{components:o}=i,d=o.get(r);if(!d)throw new Error("Render component not found");return d}_logDeprecation(e){this._injector.get(c.ILogService).warn("[FWorkbook]",`${e} is deprecated. Please use the function of the same name on "FUniver".`)}generateCellParams(e){const r=this.getActiveSheet();return{row:e.row,column:e.col,workbook:this,worksheet:r}}onCellClick(e){const r=this._injector.get(s.HoverManagerService);return c.toDisposable(r.currentClickedCell$.pipe(m.filter(t=>!!t)).subscribe(t=>{e(t)}))}onCellHover(e){const r=this._injector.get(s.HoverManagerService);return c.toDisposable(r.currentRichText$.pipe(m.filter(t=>!!t)).subscribe(e))}onCellPointerDown(e){const r=this._injector.get(s.HoverManagerService);return c.toDisposable(r.currentPointerDownCell$.subscribe(e))}onCellPointerUp(e){const r=this._injector.get(s.HoverManagerService);return c.toDisposable(r.currentPointerUpCell$.subscribe(e))}onCellPointerMove(e){const r=this._injector.get(s.HoverManagerService);return c.toDisposable(r.currentCellPosWithEvent$.pipe(m.filter(t=>!!t)).subscribe(t=>{e(t,t.event)}))}onDragOver(e){const r=this._injector.get(s.DragManagerService);return c.toDisposable(r.currentCell$.pipe(m.filter(t=>!!t)).subscribe(t=>{e(t)}))}onDrop(e){const r=this._injector.get(s.DragManagerService);return c.toDisposable(r.endCell$.pipe(m.filter(t=>!!t)).subscribe(t=>{e(t)}))}startEditing(){const e=this._injector.get(c.ICommandService);return this._injector.get(s.IEditorBridgeService).isVisible().visible?!0:e.syncExecuteCommand(s.SetCellEditVisibleOperation.id,{eventType:u.DeviceInputEventType.Dblclick,unitId:this._workbook.getUnitId(),visible:!0})}async endEditing(e){const r=this._injector.get(c.ICommandService);return this._injector.get(s.IEditorBridgeService).isVisible().visible&&r.syncExecuteCommand(s.SetCellEditVisibleOperation.id,{eventType:u.DeviceInputEventType.Keyboard,keycode:e?C.KeyCode.ENTER:C.KeyCode.ESC,visible:!1,unitId:this._workbook.getUnitId()}),await c.awaitTime(0),!0}endEditingAsync(e=!0){return this.endEditing(e)}abortEditingAsync(){return this.endEditingAsync(!1)}isCellEditing(){return this._injector.get(s.IEditorBridgeService).isVisible().visible}getScrollStateBySheetId(e){const r=this._workbook.getUnitId(),i=this._injector.get(u.IRenderManagerService).getRenderById(r);return i?i.with(s.SheetScrollManagerService).getScrollStateByParam({unitId:r,sheetId:e}):null}disableSelection(){const e=this._workbook.getUnitId(),t=this._injector.get(u.IRenderManagerService).getRenderById(e);return t&&t.with(s.ISheetSelectionRenderService).disableSelection(),this}enableSelection(){const e=this._workbook.getUnitId(),t=this._injector.get(u.IRenderManagerService).getRenderById(e);return t&&t.with(s.ISheetSelectionRenderService).enableSelection(),this}transparentSelection(){const e=this._workbook.getUnitId(),t=this._injector.get(u.IRenderManagerService).getRenderById(e);return t&&t.with(s.ISheetSelectionRenderService).transparentSelection(),this}showSelection(){const e=this._workbook.getUnitId(),t=this._injector.get(u.IRenderManagerService).getRenderById(e);return t&&t.with(s.ISheetSelectionRenderService).showSelection(),this}}b.FWorkbook.extend(y);class D extends b.FWorksheet{refreshCanvas(){const e=this._injector.get(u.IRenderManagerService),r=this._fWorkbook.id,t=e.getRenderById(r);if(!t)throw new Error(`Render Unit with unitId ${r} not found`);t.with(s.SheetSkeletonManagerService).reCalculate();const i=t.mainComponent;if(!i)throw new Error("Main component not found");return i.makeDirty(),this}highlightRanges(e,r,t){const i=this._injector.get(s.IMarkSelectionService),o=[];for(const d of e){const l=d.getRange(),g=i.addShapeWithNoFresh({range:l,style:r,primary:t});g&&o.push(g)}if(i.refreshShapes(),o.length===0)throw new Error("Failed to highlight current range");return c.toDisposable(()=>{o.forEach(d=>{i.removeShape(d)})})}zoom(e){const r=this._injector.get(c.ICommandService),t=Math.min(Math.max(e,.1),4);return r.executeCommand(s.SetZoomRatioCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),zoomRatio:t}),this}getZoom(){return this._worksheet.getZoomRatio()}getVisibleRange(){const e=this._workbook.getUnitId(),t=this._injector.get(u.IRenderManagerService).getRenderById(e);if(!t)return null;const o=t.with(s.SheetSkeletonManagerService).getCurrentSkeleton();return o?o.getVisibleRangeByViewport(u.SHEET_VIEWPORT_KEY.VIEW_MAIN):null}getVisibleRangesOfAllViewports(){const e=this._workbook.getUnitId(),t=this._injector.get(u.IRenderManagerService).getRenderById(e);if(!t)return null;const o=t.with(s.SheetSkeletonManagerService).getCurrentSkeleton();return o?o.getVisibleRanges():null}scrollToCell(e,r,t){const i=this._workbook.getUnitId(),d=this._injector.get(u.IRenderManagerService).getRenderById(i);return d&&(d==null?void 0:d.with(s.SheetsScrollRenderController)).scrollToCell(e,r,t),this}getScrollState(){const e={offsetX:0,offsetY:0,sheetViewStartColumn:0,sheetViewStartRow:0},r=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),o=this._injector.get(u.IRenderManagerService).getRenderById(r);return o&&o.with(s.SheetScrollManagerService).getScrollStateByParam({unitId:r,sheetId:t})||e}onScroll(e){var o;const r=this._workbook.getUnitId(),i=(o=this._injector.get(u.IRenderManagerService).getRenderById(r))==null?void 0:o.with(s.SheetScrollManagerService);if(i){const d=i.validViewportScrollInfo$.subscribe(l=>{e(l)});return c.toDisposable(d)}return c.toDisposable(()=>{})}getSkeleton(){var r,t;const e=(r=this._injector.get(u.IRenderManagerService).getRenderById(this._workbook.getUnitId()))==null?void 0:r.with(s.SheetSkeletonManagerService);return(t=e==null?void 0:e.getWorksheetSkeleton(this._worksheet.getSheetId()))==null?void 0:t.skeleton}autoResizeColumn(e){return this.autoResizeColumns(e,1)}autoResizeColumns(e,r){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=[{startColumn:e,endColumn:e+r-1,startRow:0,endRow:this._worksheet.getRowCount()-1}];return this._commandService.syncExecuteCommand(s.SetWorksheetColAutoWidthCommand.id,{unitId:t,subUnitId:i,ranges:o}),this}setColumnAutoWidth(e,r){return this.autoResizeColumns(e,r)}autoResizeRows(e,r){const t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=[{startRow:e,endRow:e+r-1,startColumn:0,endColumn:this._worksheet.getColumnCount()-1}];return this._commandService.syncExecuteCommand(I.SetWorksheetRowIsAutoHeightCommand.id,{unitId:t,subUnitId:i,ranges:o}),this}customizeColumnHeader(e){var l,g;const r=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),o=this._injector.get(u.IRenderManagerService).getRenderById(r);o&&((l=e.headerStyle)!=null&&l.size)&&o.with(s.SheetSkeletonManagerService).setColumnHeaderSize(o,t,(g=e.headerStyle)==null?void 0:g.size),this._getSheetRenderComponent(r,s.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e,t)}customizeRowHeader(e){var l,g;const r=this._workbook.getUnitId(),t=this._worksheet.getSheetId(),o=this._injector.get(u.IRenderManagerService).getRenderById(r);o&&((l=e.headerStyle)!=null&&l.size)&&o.with(s.SheetSkeletonManagerService).setRowHeaderSize(o,t,(g=e.headerStyle)==null?void 0:g.size),this._getSheetRenderComponent(r,s.SHEET_VIEW_KEY.ROW).setCustomHeader(e,t)}setColumnHeaderHeight(e){const r=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return this._commandService.executeCommand(s.SetColumnHeaderHeightCommand.id,{unitId:r,subUnitId:t,size:e}),this}setRowHeaderWidth(e){const r=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return this._commandService.executeCommand(s.SetRowHeaderWidthCommand.id,{unitId:r,subUnitId:t,size:e}),this}_getSheetRenderComponent(e,r){const i=this._injector.get(u.IRenderManagerService).getRenderById(e);if(!i)throw new Error(`Render Unit with unitId ${e} not found`);const{components:o}=i,d=o.get(r);if(!d)throw new Error("Render component not found");return d}}b.FWorksheet.extend(D);class T extends b.FPermission{setPermissionDialogVisible(e){this._permissionService.setShowComponents(e)}}b.FPermission.extend(T);class B extends b.FSheetHooks{onCellPointerMove(e){return c.toDisposable(this._injector.get(s.HoverManagerService).currentPosition$.subscribe(e))}onCellPointerOver(e){return c.toDisposable(this._injector.get(s.HoverManagerService).currentCell$.subscribe(e))}onCellDragOver(e){return c.toDisposable(this._injector.get(s.DragManagerService).currentCell$.subscribe(e))}onCellDrop(e){return c.toDisposable(this._injector.get(s.DragManagerService).endCell$.subscribe(e))}onCellRender(e,r=c.InterceptorEffectEnum.Style,t=I.InterceptCellContentPriority.DATA_VALIDATION){return this._injector.get(I.SheetInterceptorService).intercept(I.INTERCEPTOR_POINT.CELL_CONTENT,{effect:r,handler:(i,o,d)=>(i&&!i.customRender&&e&&(i.customRender=[...e]),d(i)),priority:t})}onBeforeCellEdit(e){return this._injector.get(c.ICommandService).beforeCommandExecuted(r=>{const t=r.params;r.id===s.SetCellEditVisibleOperation.id&&t.visible&&e(t)})}onAfterCellEdit(e){return this._injector.get(c.ICommandService).onCommandExecuted(r=>{const t=r.params;r.id===s.SetCellEditVisibleOperation.id&&!t.visible&&e(t)})}}b.FSheetHooks.extend(B);const k={CellClicked:"CellClicked",CellPointerDown:"CellPointerDown",CellPointerUp:"CellPointerUp",CellPointerMove:"CellPointerMove",CellHover:"CellHover"};class x{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 k.CellClicked}get CellHover(){return k.CellHover}get CellPointerDown(){return k.CellPointerDown}get CellPointerUp(){return k.CellPointerUp}get CellPointerMove(){return k.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"}}_.FEventName.extend(x);class P{get SHEET_VIEWPORT_KEY(){return u.SHEET_VIEWPORT_KEY}}_.FEnum.extend(P);class W extends b.FRange{getCell(){var l;const e=this._injector.get(u.IRenderManagerService),r=this._injector.get(c.ILogService),t=this._workbook.getUnitId(),i=this._worksheet.getSheetId(),o=e.getRenderById(t),d=(l=o==null?void 0:o.with(s.SheetSkeletonManagerService).getSkeletonParam(i))==null?void 0:l.skeleton;if(!d)throw r.error("[Facade]: `FRange.getCell` can only be called in current worksheet"),new Error("`FRange.getCell` can only be called in current worksheet");return d.getCellWithCoordByIndex(this._range.startRow,this._range.startColumn)}getCellRect(){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};return{...o,toJSON:()=>JSON.stringify(o)}}generateHTML(){var t;const r=this._injector.get(s.ISheetClipboardService).generateCopyContent(this._workbook.getUnitId(),this._worksheet.getSheetId(),this._range);return(t=r==null?void 0:r.html)!=null?t:""}attachPopup(e){var d,l,g;e.direction=(d=e.direction)!=null?d:"horizontal",e.extraProps=(l=e.extraProps)!=null?l:{},e.offset=(g=e.offset)!=null?g:[0,0];const{key:r,disposableCollection:t}=M(e,this._injector.get(C.ComponentManager)),o=this._injector.get(s.SheetCanvasPopManagerService).attachPopupToCell(this._range.startRow,this._range.startColumn,{...e,componentKey:r},this.getUnitId(),this._worksheet.getSheetId());return o?(t.add(o),t):(t.dispose(),null)}attachAlertPopup(e){const r=this._injector.get(s.CellAlertManagerService),t={workbook:this._workbook,worksheet:this._worksheet,row:this._range.startRow,col:this._range.startColumn,unitId:this.getUnitId(),subUnitId:this._worksheet.getSheetId()};return r.showAlert({...e,location:t}),{dispose:()=>{r.removeAlert(e.key)}}}attachRangePopup(e){var d,l,g;e.direction=(d=e.direction)!=null?d:"top-center",e.extraProps=(l=e.extraProps)!=null?l:{},e.offset=(g=e.offset)!=null?g:[0,0];const{key:r,disposableCollection:t}=M(e,this._injector.get(C.ComponentManager)),o=this._injector.get(s.SheetCanvasPopManagerService).attachRangePopup(this._range,{...e,componentKey:r},this.getUnitId(),this._worksheet.getSheetId());return o?(t.add(o),t):(t.dispose(),null)}highlight(e,r){const t=this._injector.get(s.IMarkSelectionService),i=t.addShape({range:this._range,style:e,primary:r});if(!i)throw new Error("Failed to highlight current range");return c.toDisposable(()=>{t.removeShape(i)})}showDropdown(e){return this._injector.get(s.ISheetCellDropdownManagerService).showDropdown(e)}}b.FRange.extend(W);function M(w,e){const{componentKey:r,isVue3:t}=w;let i;const o=new c.DisposableCollection;return typeof r=="string"?i=r:(i=`External_${c.generateRandomId(6)}`,o.add(e.register(i,r,{framework:t?"vue3":"react"}))),{key:i,disposableCollection:o}}E.FSheetsUIEnum=P,E.transformComponentKey=M,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/core/facade`),require(`@univerjs/docs`),require(`@univerjs/engine-render`),require(`@univerjs/sheets`),require(`@univerjs/sheets-ui`),require(`@univerjs/sheets/facade`),require(`@univerjs/ui`),require(`rxjs`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/core/facade`,`@univerjs/docs`,`@univerjs/engine-render`,`@univerjs/sheets`,`@univerjs/sheets-ui`,`@univerjs/sheets/facade`,`@univerjs/ui`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsUiFacade={},e.UniverCore,e.UniverCoreFacade,e.UniverDocs,e.UniverEngineRender,e.UniverSheets,e.UniverSheetsUi,e.UniverSheetsFacade,e.UniverUi,e.rxjs))})(this,function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var u=class extends n.FUniver{_initSheetUIEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditStart,()=>n.beforeCommandExecuted(n=>{if(n.id!==o.SetCellEditVisibleOperation.id)return;let r=this.getActiveSheet();if(!r)return;let{workbook:i,worksheet:a}=r,s=e.get(o.IEditorBridgeService),{visible:c,keycode:l,eventType:u}=n.params,d=s.getEditLocation();if(c){let e={row:d.row,column:d.column,eventType:u,keycode:l,workbook:i,worksheet:a,isZenEditor:!1};if(this.fireEvent(this.Event.BeforeSheetEditStart,e),e.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetEditEnd,()=>n.beforeCommandExecuted(n=>{if(n.id!==o.SetCellEditVisibleOperation.id)return;let r=this.getActiveSheet();if(!r)return;let{workbook:i,worksheet:a}=r,s=e.get(o.IEditorBridgeService),l=e.get(t.IUniverInstanceService),{visible:u,keycode:d,eventType:f}=n.params,p=s.getEditLocation();if(!u){let e={row:p.row,column:p.column,eventType:f,keycode:d,workbook:i,worksheet:a,isZenEditor:!1,value:t.RichTextValue.create(l.getUnit(t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),isConfirm:d!==c.KeyCode.ESC};if(this.fireEvent(this.Event.BeforeSheetEditEnd,e),e.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditStarted,()=>n.onCommandExecuted(t=>{if(t.id!==o.SetCellEditVisibleOperation.id)return;let n=this.getCommandSheetTarget(t);if(!n)return;let{workbook:r,worksheet:i}=n,a=e.get(o.IEditorBridgeService),{visible:s,keycode:c,eventType:l}=t.params,u=a.getEditLocation();if(s){let e={row:u.row,column:u.column,eventType:l,keycode:c,workbook:r,worksheet:i,isZenEditor:!1};this.fireEvent(this.Event.SheetEditStarted,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditEnded,()=>n.onCommandExecuted(t=>{if(t.id!==o.SetCellEditVisibleOperation.id)return;let n=this.getCommandSheetTarget(t);if(!n)return;let{workbook:r,worksheet:i}=n,a=e.get(o.IEditorBridgeService),{visible:s,keycode:l,eventType:u}=t.params,d=a.getEditLocation();if(!s){let e={row:d.row,column:d.column,eventType:u,keycode:l,workbook:r,worksheet:i,isZenEditor:!1,isConfirm:l!==c.KeyCode.ESC};this.fireEvent(this.Event.SheetEditEnded,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetEditChanging,()=>n.onCommandExecuted(n=>{if(n.id!==r.RichTextEditingMutation.id)return;let i=this.getActiveSheet();if(!i)return;let{workbook:a,worksheet:s}=i,c=e.get(o.IEditorBridgeService),l=e.get(t.IUniverInstanceService),u=n.params;if(!c.isVisible().visible)return;let{unitId:d}=u;if(d===t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY){let{row:e,column:n}=c.getEditLocation(),r={workbook:a,worksheet:s,row:e,column:n,value:t.RichTextValue.create(l.getUnit(t.DOCS_NORMAL_EDITOR_UNIT_ID_KEY).getSnapshot()),isZenEditor:!1};this.fireEvent(this.Event.SheetEditChanging,r)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetZoomChange,()=>n.beforeCommandExecuted(e=>{if(e.id!==o.SetZoomRatioCommand.id)return;let n=this.getCommandSheetTarget(e);if(!n)return;let{workbook:r,worksheet:i}=n,a={zoom:e.params.zoomRatio,workbook:r,worksheet:i};if(this.fireEvent(this.Event.BeforeSheetZoomChange,a),a.cancel)throw new t.CanceledError}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetZoomChanged,()=>n.onCommandExecuted(e=>{if(e.id!==o.SetZoomRatioCommand.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 n=e.get(i.IRenderManagerService),r=e.get(t.LifecycleService),s=new t.DisposableCollection;this.disposeWithMe(r.lifecycle$.subscribe(n=>{if(n!==t.LifecycleStages.Rendered)return;let r=e.get(o.HoverManagerService),i=e.get(o.DragManagerService);r&&(s.dispose(),s.add(this.registerEventHandler(this.Event.CellClicked,()=>{var e;return(e=r.currentClickedCell$)==null?void 0:e.pipe((0,l.filter)(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})})})),s.add(this.registerEventHandler(this.Event.CellHover,()=>{var e;return(e=r.currentRichText$)==null?void 0:e.pipe((0,l.filter)(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})})})),s.add(this.registerEventHandler(this.Event.CellPointerDown,()=>{var e;return(e=r.currentPointerDownCell$)==null?void 0:e.pipe((0,l.filter)(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})})})),s.add(this.registerEventHandler(this.Event.CellPointerUp,()=>{var e;return(e=r.currentPointerUpCell$)==null?void 0:e.pipe((0,l.filter)(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})})})),s.add(this.registerEventHandler(this.Event.CellPointerMove,()=>{var e;return(e=r.currentCellPosWithEvent$)==null?void 0:e.pipe((0,l.filter)(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})})})),s.add(this.registerEventHandler(this.Event.DragOver,()=>{var e;return(e=i.currentCell$)==null?void 0:e.pipe((0,l.filter)(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})})})),s.add(this.registerEventHandler(this.Event.Drop,()=>{var e;return(e=i.endCell$)==null?void 0:e.pipe((0,l.filter)(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})})})),s.add(this.registerEventHandler(this.Event.RowHeaderClick,()=>{var e;return(e=r.currentRowHeaderClick$)==null?void 0:e.pipe((0,l.filter)(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.RowHeaderClick,{...t,row:e.index})})})),s.add(this.registerEventHandler(this.Event.RowHeaderPointerDown,()=>{var e;return(e=r.currentRowHeaderPointerDown$)==null?void 0:e.pipe((0,l.filter)(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.RowHeaderPointerDown,{...t,row:e.index})})})),s.add(this.registerEventHandler(this.Event.RowHeaderPointerUp,()=>{var e;return(e=r.currentRowHeaderPointerUp$)==null?void 0:e.pipe((0,l.filter)(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.RowHeaderPointerUp,{...t,row:e.index})})})),s.add(this.registerEventHandler(this.Event.RowHeaderHover,()=>{var e;return(e=r.currentHoveredRowHeader$)==null?void 0:e.pipe((0,l.filter)(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.RowHeaderHover,{...t,row:e.index})})})),s.add(this.registerEventHandler(this.Event.ColumnHeaderClick,()=>{var e;return(e=r.currentColHeaderClick$)==null?void 0:e.pipe((0,l.filter)(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.ColumnHeaderClick,{...t,column:e.index})})})),s.add(this.registerEventHandler(this.Event.ColumnHeaderPointerDown,()=>{var e;return(e=r.currentColHeaderPointerDown$)==null?void 0:e.pipe((0,l.filter)(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.ColumnHeaderPointerDown,{...t,column:e.index})})})),s.add(this.registerEventHandler(this.Event.ColumnHeaderPointerUp,()=>{var e;return(e=r.currentColHeaderPointerUp$)==null?void 0:e.pipe((0,l.filter)(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.ColumnHeaderPointerUp,{...t,column:e.index})})})),s.add(this.registerEventHandler(this.Event.ColumnHeaderHover,()=>{var e;return(e=r.currentHoveredColHeader$)==null?void 0:e.pipe((0,l.filter)(e=>!!e)).subscribe(e=>{let t=this.getSheetTarget(e.unitId,e.subUnitId);t&&this.fireEvent(this.Event.ColumnHeaderHover,{...t,column:e.index})})})),this.disposeWithMe(s))}));let c,u=(0,l.combineLatest)([n.created$,r.lifecycle$]),d=new t.DisposableCollection;this.disposeWithMe(u.subscribe(([e,n])=>{if(e.type===t.UniverInstanceType.UNIVER_SHEET&&(c=e),n<=t.LifecycleStages.Rendered||!c)return;let r=this.getWorkbook(c.unitId);if(!r)return;d.dispose();let i=c.with(o.SheetScrollManagerService),s=c.with(a.SheetsSelectionsService);d.add(this.registerEventHandler(this.Event.Scroll,()=>i.validViewportScrollInfo$.subscribe(e=>{e&&this.fireEvent(this.Event.Scroll,{workbook:r,worksheet:r.getActiveSheet(),...e})}))),d.add(this.registerEventHandler(this.Event.SelectionMoveStart,()=>s.selectionMoveStart$.subscribe(e=>{var t;this.fireEvent(this.Event.SelectionMoveStart,{workbook:r,worksheet:r.getActiveSheet(),selections:(t=e==null?void 0:e.map(e=>e.range))==null?[]:t})}))),d.add(this.registerEventHandler(this.Event.SelectionMoving,()=>s.selectionMoving$.subscribe(e=>{var t;this.fireEvent(this.Event.SelectionMoving,{workbook:r,worksheet:r.getActiveSheet(),selections:(t=e==null?void 0:e.map(e=>e.range))==null?[]:t})}))),d.add(this.registerEventHandler(this.Event.SelectionMoveEnd,()=>s.selectionMoveEnd$.subscribe(e=>{var t;this.fireEvent(this.Event.SelectionMoveEnd,{workbook:r,worksheet:r.getActiveSheet(),selections:(t=e==null?void 0:e.map(e=>e.range))==null?[]:t})}))),d.add(this.registerEventHandler(this.Event.SelectionChanged,()=>s.selectionChanged$.subscribe(e=>{var t;this.fireEvent(this.Event.SelectionChanged,{workbook:r,worksheet:r.getActiveSheet(),selections:(t=e==null?void 0:e.map(e=>e.range))==null?[]:t})}))),c=null,this.disposeWithMe(d)}))}_initialize(e){this._initSheetUIEvent(e),this._initObserverListener(e);let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeClipboardChange,()=>n.beforeCommandExecuted(e=>{switch(e.id){case c.CopyCommand.id:case c.CutCommand.id:this._beforeClipboardChange();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.ClipboardChanged,()=>n.onCommandExecuted(e=>{switch(e.id){case c.CopyCommand.id:case c.CutCommand.id:this._clipboardChanged();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeClipboardPaste,()=>n.beforeCommandExecuted(e=>{switch(e.id){case o.SheetPasteShortKeyCommand.id:this._beforeClipboardPaste(e.params);break;case c.PasteCommand.id:this._beforeClipboardPasteAsync();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.ClipboardPasted,()=>n.onCommandExecuted(e=>{switch(e.id){case o.SheetPasteShortKeyCommand.id:this._clipboardPaste(e.params);break;case c.PasteCommand.id:this._clipboardPasteAsync();break}}))),this.disposeWithMe(this.registerEventHandler(this.Event.SheetSkeletonChanged,()=>n.onCommandExecuted(e=>{if(a.COMMAND_LISTENER_SKELETON_CHANGE.indexOf(e.id)>-1){let t=this.getActiveSheet();if(!t)return;let n=(0,a.getSkeletonChangedEffectedRange)(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(o.ISheetClipboardService).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 e=this._generateClipboardCopyParam();if(e&&(this.fireEvent(this.Event.BeforeClipboardChange,e),e.cancel))throw new t.CanceledError}_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(c.IClipboardInterfaceService).read())[0],r;if(n){let i=n.types;r={workbook:e,worksheet:t,text:i.indexOf(c.PLAIN_TEXT_CLIPBOARD_MIME_TYPE)===-1?``:await n.getType(c.PLAIN_TEXT_CLIPBOARD_MIME_TYPE).then(e=>e&&e.text()),html:i.indexOf(c.HTML_CLIPBOARD_MIME_TYPE)===-1?``:await n.getType(c.HTML_CLIPBOARD_MIME_TYPE).then(e=>e&&e.text())}}return r}_beforeClipboardPaste(e){let n=this._generateClipboardPasteParam(e);if(n&&(this.fireEvent(this.Event.BeforeClipboardPaste,n),n.cancel))throw new t.CanceledError}_clipboardPaste(e){let n=this._generateClipboardPasteParam(e);if(n&&(this.fireEvent(this.Event.ClipboardPasted,n),n.cancel))throw new t.CanceledError}async _beforeClipboardPasteAsync(){if(!(0,c.supportClipboardAPI)()){this._injector.get(t.ILogService).warn(`[Facade]: The navigator object only supports the browser environment`);return}let e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.BeforeClipboardPaste,e),e.cancel))throw new t.CanceledError}async _clipboardPasteAsync(){if(!(0,c.supportClipboardAPI)()){this._injector.get(t.ILogService).warn(`[Facade]: The navigator object only supports the browser environment`);return}let e=await this._generateClipboardPasteParamAsync();if(e&&(this.fireEvent(this.Event.ClipboardPasted,e),e.cancel))throw new t.CanceledError}customizeColumnHeader(e){var t;let n=this.getActiveWorkbook();if(!n){console.error(`WorkBook not exist`);return}let r=n==null?void 0:n.getId(),a=this._injector.get(i.IRenderManagerService),s=n.getActiveSheet(),c=s.getSheetId(),l=a.getRenderById(r);if(l&&(t=e.headerStyle)!=null&&t.size){var u;l.with(o.SheetSkeletonManagerService).setColumnHeaderSize(l,c,(u=e.headerStyle)==null?void 0:u.size),s==null||s.refreshCanvas()}this._getSheetRenderComponent(r,o.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e),s==null||s.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,o.SHEET_VIEW_KEY.ROW).setCustomHeader(e)}registerSheetRowHeaderExtension(e,...n){let r=this._getSheetRenderComponent(e,o.SHEET_VIEW_KEY.ROW),i=r.register(...n);return(0,t.toDisposable)(()=>{i.dispose(),r.makeDirty(!0)})}registerSheetColumnHeaderExtension(e,...n){let r=this._getSheetRenderComponent(e,o.SHEET_VIEW_KEY.COLUMN),i=r.register(...n);return(0,t.toDisposable)(()=>{i.dispose(),r.makeDirty(!0)})}registerSheetMainExtension(e,...n){let r=this._getSheetRenderComponent(e,o.SHEET_VIEW_KEY.MAIN),i=r.register(...n);return(0,t.toDisposable)(()=>{i.dispose(),r.makeDirty(!0)})}_getSheetRenderComponent(e,t){let n=this._injector.get(i.IRenderManagerService).getRenderById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,a=r.get(t);if(!a)throw Error(`Render component not found`);return a}getSheetHooks(){return this._injector.createInstance(s.FSheetHooks)}pasteIntoSheet(e,t,n){return this._commandService.executeCommand(o.SheetPasteShortKeyCommand.id,{htmlContent:e,textContent:t,files:n})}setProtectedRangeShadowStrategy(e){this._injector.get(o.SheetPermissionRenderManagerService).setProtectedRangeShadowStrategy(e)}getProtectedRangeShadowStrategy(){return this._injector.get(o.SheetPermissionRenderManagerService).getProtectedRangeShadowStrategy()}getProtectedRangeShadowStrategy$(){return this._injector.get(o.SheetPermissionRenderManagerService).getProtectedRangeShadowStrategy$()}setPermissionDialogVisible(e){this._injector.get(t.IPermissionService).setShowComponents(e)}};n.FUniver.extend(u);var d=class extends s.FWorkbook{openSiderbar(e){return this._logDeprecation(`openSiderbar`),this._injector.get(c.ISidebarService).open(e)}openDialog(e){this._logDeprecation(`openDialog`);let t=this._injector.get(c.IDialogService).open({...e,onClose:()=>{t.dispose()}});return t}customizeColumnHeader(e){let t=this._workbook.getUnitId();this._getSheetRenderComponent(t,o.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e)}customizeRowHeader(e){let t=this._workbook.getUnitId();this._getSheetRenderComponent(t,o.SHEET_VIEW_KEY.ROW).setCustomHeader(e)}_getSheetRenderComponent(e,t){let n=this._injector.get(i.IRenderManagerService).getRenderById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,a=r.get(t);if(!a)throw Error(`Render component not found`);return a}_logDeprecation(e){this._injector.get(t.ILogService).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(0,t.toDisposable)(this._injector.get(o.HoverManagerService).currentClickedCell$.pipe((0,l.filter)(e=>!!e)).subscribe(t=>{e(t)}))}onCellHover(e){return(0,t.toDisposable)(this._injector.get(o.HoverManagerService).currentRichText$.pipe((0,l.filter)(e=>!!e)).subscribe(e))}onCellPointerDown(e){return(0,t.toDisposable)(this._injector.get(o.HoverManagerService).currentPointerDownCell$.subscribe(e))}onCellPointerUp(e){return(0,t.toDisposable)(this._injector.get(o.HoverManagerService).currentPointerUpCell$.subscribe(e))}onCellPointerMove(e){return(0,t.toDisposable)(this._injector.get(o.HoverManagerService).currentCellPosWithEvent$.pipe((0,l.filter)(e=>!!e)).subscribe(t=>{e(t,t.event)}))}onDragOver(e){return(0,t.toDisposable)(this._injector.get(o.DragManagerService).currentCell$.pipe((0,l.filter)(e=>!!e)).subscribe(t=>{e(t)}))}onDrop(e){return(0,t.toDisposable)(this._injector.get(o.DragManagerService).endCell$.pipe((0,l.filter)(e=>!!e)).subscribe(t=>{e(t)}))}startEditing(){let e=this._injector.get(t.ICommandService);return this._injector.get(o.IEditorBridgeService).isVisible().visible?!0:e.syncExecuteCommand(o.SetCellEditVisibleOperation.id,{eventType:i.DeviceInputEventType.Dblclick,unitId:this._workbook.getUnitId(),visible:!0})}async endEditing(e){let n=this._injector.get(t.ICommandService);return this._injector.get(o.IEditorBridgeService).isVisible().visible&&n.syncExecuteCommand(o.SetCellEditVisibleOperation.id,{eventType:i.DeviceInputEventType.Keyboard,keycode:e?c.KeyCode.ENTER:c.KeyCode.ESC,visible:!1,unitId:this._workbook.getUnitId()}),await(0,t.awaitTime)(0),!0}endEditingAsync(e=!0){return this.endEditing(e)}abortEditingAsync(){return this.endEditingAsync(!1)}isCellEditing(){return this._injector.get(o.IEditorBridgeService).isVisible().visible}getScrollStateBySheetId(e){let t=this._workbook.getUnitId(),n=this._injector.get(i.IRenderManagerService).getRenderById(t);return n?n.with(o.SheetScrollManagerService).getScrollStateByParam({unitId:t,sheetId:e}):null}disableSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderById(e);return t&&t.with(o.ISheetSelectionRenderService).disableSelection(),this}enableSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderById(e);return t&&t.with(o.ISheetSelectionRenderService).enableSelection(),this}transparentSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderById(e);return t&&t.with(o.ISheetSelectionRenderService).transparentSelection(),this}showSelection(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderById(e);return t&&t.with(o.ISheetSelectionRenderService).showSelection(),this}};s.FWorkbook.extend(d);var f=class extends s.FWorksheet{refreshCanvas(){let e=this._injector.get(i.IRenderManagerService),t=this._fWorkbook.id,n=e.getRenderById(t);if(!n)throw Error(`Render Unit with unitId ${t} not found`);n.with(o.SheetSkeletonManagerService).reCalculate();let r=n.mainComponent;if(!r)throw Error(`Main component not found`);return r.makeDirty(),this}highlightRanges(e,n,r){let i=this._injector.get(o.IMarkSelectionService),a=[];for(let t of e){let e=t.getRange(),o=i.addShapeWithNoFresh({range:e,style:n,primary:r});o&&a.push(o)}if(i.refreshShapes(),a.length===0)throw Error(`Failed to highlight current range`);return(0,t.toDisposable)(()=>{a.forEach(e=>{i.removeShape(e)})})}zoom(e){let n=this._injector.get(t.ICommandService),r=Math.min(Math.max(e,.1),4);return n.executeCommand(o.SetZoomRatioCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),zoomRatio:r}),this}getZoom(){return this._worksheet.getZoomRatio()}getVisibleRange(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderById(e);if(!t)return null;let n=t.with(o.SheetSkeletonManagerService).getCurrentSkeleton();return n?n.getVisibleRangeByViewport(i.SHEET_VIEWPORT_KEY.VIEW_MAIN):null}getVisibleRangesOfAllViewports(){let e=this._workbook.getUnitId(),t=this._injector.get(i.IRenderManagerService).getRenderById(e);if(!t)return null;let n=t.with(o.SheetSkeletonManagerService).getCurrentSkeleton();return n?n.getVisibleRanges():null}scrollToCell(e,t,n){let r=this._workbook.getUnitId(),a=this._injector.get(i.IRenderManagerService).getRenderById(r);return a&&(a==null?void 0:a.with(o.SheetsScrollRenderController)).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(i.IRenderManagerService).getRenderById(t);return r&&r.with(o.SheetScrollManagerService).getScrollStateByParam({unitId:t,sheetId:n})||e}onScroll(e){var n;let r=this._workbook.getUnitId(),a=(n=this._injector.get(i.IRenderManagerService).getRenderById(r))==null?void 0:n.with(o.SheetScrollManagerService);return a?(0,t.toDisposable)(a.validViewportScrollInfo$.subscribe(t=>{e(t)})):(0,t.toDisposable)(()=>{})}getSkeleton(){var e,t;let n=(e=this._injector.get(i.IRenderManagerService).getRenderById(this._workbook.getUnitId()))==null?void 0:e.with(o.SheetSkeletonManagerService);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(o.SetWorksheetColAutoWidthCommand.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(a.SetWorksheetRowIsAutoHeightCommand.id,{unitId:n,subUnitId:r,ranges:i}),this}customizeColumnHeader(e){var t;let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),a=this._injector.get(i.IRenderManagerService).getRenderById(n);if(a&&(t=e.headerStyle)!=null&&t.size){var s;a.with(o.SheetSkeletonManagerService).setColumnHeaderSize(a,r,(s=e.headerStyle)==null?void 0:s.size)}this._getSheetRenderComponent(n,o.SHEET_VIEW_KEY.COLUMN).setCustomHeader(e,r)}customizeRowHeader(e){var t;let n=this._workbook.getUnitId(),r=this._worksheet.getSheetId(),a=this._injector.get(i.IRenderManagerService).getRenderById(n);if(a&&(t=e.headerStyle)!=null&&t.size){var s;a.with(o.SheetSkeletonManagerService).setRowHeaderSize(a,r,(s=e.headerStyle)==null?void 0:s.size)}this._getSheetRenderComponent(n,o.SHEET_VIEW_KEY.ROW).setCustomHeader(e,r)}setColumnHeaderHeight(e){let t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.executeCommand(o.SetColumnHeaderHeightCommand.id,{unitId:t,subUnitId:n,size:e}),this}setRowHeaderWidth(e){let t=this._workbook.getUnitId(),n=this._worksheet.getSheetId();return this._commandService.executeCommand(o.SetRowHeaderWidthCommand.id,{unitId:t,subUnitId:n,size:e}),this}_getSheetRenderComponent(e,t){let n=this._injector.get(i.IRenderManagerService).getRenderById(e);if(!n)throw Error(`Render Unit with unitId ${e} not found`);let{components:r}=n,a=r.get(t);if(!a)throw Error(`Render component not found`);return a}};s.FWorksheet.extend(f);var p=class extends s.FPermission{setPermissionDialogVisible(e){this._permissionService.setShowComponents(e)}};s.FPermission.extend(p);var m=class extends s.FSheetHooks{onCellPointerMove(e){return(0,t.toDisposable)(this._injector.get(o.HoverManagerService).currentPosition$.subscribe(e))}onCellPointerOver(e){return(0,t.toDisposable)(this._injector.get(o.HoverManagerService).currentCell$.subscribe(e))}onCellDragOver(e){return(0,t.toDisposable)(this._injector.get(o.DragManagerService).currentCell$.subscribe(e))}onCellDrop(e){return(0,t.toDisposable)(this._injector.get(o.DragManagerService).endCell$.subscribe(e))}onCellRender(e,n=t.InterceptorEffectEnum.Style,r=a.InterceptCellContentPriority.DATA_VALIDATION){return this._injector.get(a.SheetInterceptorService).intercept(a.INTERCEPTOR_POINT.CELL_CONTENT,{effect:n,handler:(t,n,r)=>(t&&!t.customRender&&e&&(t.customRender=[...e]),r(t)),priority:r})}onBeforeCellEdit(e){return this._injector.get(t.ICommandService).beforeCommandExecuted(t=>{let n=t.params;t.id===o.SetCellEditVisibleOperation.id&&n.visible&&e(n)})}onAfterCellEdit(e){return this._injector.get(t.ICommandService).onCommandExecuted(t=>{let n=t.params;t.id===o.SetCellEditVisibleOperation.id&&!n.visible&&e(n)})}};s.FSheetHooks.extend(m);let h={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 g=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 h.CellClicked}get CellHover(){return h.CellHover}get CellPointerDown(){return h.CellPointerDown}get CellPointerUp(){return h.CellPointerUp}get CellPointerMove(){return h.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`}};n.FEventName.extend(g);var _=class{get SHEET_VIEWPORT_KEY(){return i.SHEET_VIEWPORT_KEY}};n.FEnum.extend(_);var v=class extends s.FRange{getCell(){var e;let n=this._injector.get(i.IRenderManagerService),r=this._injector.get(t.ILogService),a=this._workbook.getUnitId(),s=this._worksheet.getSheetId(),c=n.getRenderById(a),l=c==null||(e=c.with(o.SheetSkeletonManagerService).getSkeletonParam(s))==null?void 0:e.skeleton;if(!l)throw r.error("[Facade]: `FRange.getCell` can only be called in current worksheet"),Error("`FRange.getCell` can only be called in current worksheet");return l.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(o.ISheetClipboardService).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}=y(e,this._injector.get(c.ComponentManager)),s=this._injector.get(o.SheetCanvasPopManagerService).attachPopupToCell(this._range.startRow,this._range.startColumn,{...e,componentKey:i},this.getUnitId(),this._worksheet.getSheetId());return s?(a.add(s),a):(a.dispose(),null)}attachAlertPopup(e){let t=this._injector.get(o.CellAlertManagerService),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}=y(e,this._injector.get(c.ComponentManager)),s=this._injector.get(o.SheetCanvasPopManagerService).attachRangePopup(this._range,{...e,componentKey:i},this.getUnitId(),this._worksheet.getSheetId());return s?(a.add(s),a):(a.dispose(),null)}highlight(e,n){let r=this._injector.get(o.IMarkSelectionService),i=r.addShape({range:this._range,style:e,primary:n});if(!i)throw Error(`Failed to highlight current range`);return(0,t.toDisposable)(()=>{r.removeShape(i)})}showDropdown(e){return this._injector.get(o.ISheetCellDropdownManagerService).showDropdown(e)}};s.FRange.extend(v);function y(e,n){let{componentKey:r,isVue3:i}=e,a,o=new t.DisposableCollection;return typeof r==`string`?a=r:(a=`External_${(0,t.generateRandomId)(6)}`,o.add(n.register(a,r,{framework:i?`vue3`:`react`}))),{key:a,disposableCollection:o}}e.FSheetsUIEnum=_,e.transformComponentKey=y});
|