@a3s-lab/office 0.1.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/LICENSE +21 -0
- package/README.md +470 -0
- package/THIRD_PARTY_NOTICES.md +33 -0
- package/dist/0~1403.js +245 -0
- package/dist/0~152.js +94 -0
- package/dist/0~3539.js +1856 -0
- package/dist/0~3557.js +179 -0
- package/dist/0~3635.js +302 -0
- package/dist/0~4595.js +1162 -0
- package/dist/0~5050.js +308 -0
- package/dist/0~6552.js +787 -0
- package/dist/0~7048.js +2110 -0
- package/dist/0~7614.js +1037 -0
- package/dist/0~8155.js +299 -0
- package/dist/0~9445.js +283 -0
- package/dist/0~9512.js +743 -0
- package/dist/0~document-editor.js +10967 -0
- package/dist/0~markdown-editor.js +2260 -0
- package/dist/0~pdf-viewer.js +2156 -0
- package/dist/0~presentation-editor.js +8359 -0
- package/dist/0~rslib-runtime.js +27 -0
- package/dist/0~spreadsheet-editor.js +10388 -0
- package/dist/0~use-office-draft.js +46 -0
- package/dist/0~work-document-extensions.js +2470 -0
- package/dist/0~work-document-links.js +14 -0
- package/dist/0~work-document-model-codec.js +42 -0
- package/dist/0~work-document-page-color.js +11 -0
- package/dist/0~work-document-paragraph-formatting.js +425 -0
- package/dist/0~work-docx-bibliography.js +347 -0
- package/dist/0~work-docx-export.js +1151 -0
- package/dist/0~work-docx-import.js +3116 -0
- package/dist/0~work-docx-page-color.js +42 -0
- package/dist/0~work-office-diagnostics.js +1377 -0
- package/dist/0~work-pptx-export.js +1009 -0
- package/dist/0~work-pptx-import.js +1138 -0
- package/dist/0~work-presentation-charts.js +442 -0
- package/dist/0~work-presentation-transition.js +38 -0
- package/dist/0~work-presentation-visual-scale.js +38 -0
- package/dist/0~work-spreadsheet-formula-support.js +9 -0
- package/dist/1134.js +445 -0
- package/dist/4104.js +5786 -0
- package/dist/432.js +211 -0
- package/dist/4704.js +1364 -0
- package/dist/6489.js +182 -0
- package/dist/8715.js +3959 -0
- package/dist/8728.js +723 -0
- package/dist/9356.js +10 -0
- package/dist/core.d.ts +15 -0
- package/dist/core.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/internal/design-system/primitives/button/button.d.ts +9 -0
- package/dist/internal/design-system/primitives/button/icon-button.d.ts +7 -0
- package/dist/internal/design-system/primitives/dialog/dialog.d.ts +12 -0
- package/dist/internal/design-system/primitives/feedback/collection-state.d.ts +9 -0
- package/dist/internal/design-system/primitives/feedback/inline-notice.d.ts +10 -0
- package/dist/internal/design-system/primitives/feedback/state-view.d.ts +13 -0
- package/dist/internal/design-system/primitives/form/field.d.ts +19 -0
- package/dist/internal/design-system/primitives/index.d.ts +14 -0
- package/dist/internal/design-system/primitives/layout/split-handle.d.ts +17 -0
- package/dist/internal/design-system/primitives/navigation/segmented-control.d.ts +19 -0
- package/dist/internal/design-system/primitives/navigation/tab-navigation.d.ts +13 -0
- package/dist/internal/design-system/primitives/navigation/tabs.d.ts +21 -0
- package/dist/internal/design-system/primitives/overlay/dialog-focus-scope.d.ts +17 -0
- package/dist/internal/design-system/primitives/overlay/popover.d.ts +34 -0
- package/dist/internal/design-system/primitives/overlay/portal-root.d.ts +1 -0
- package/dist/internal/design-system/primitives/status/status-badge.d.ts +6 -0
- package/dist/internal/features/work/components/work-document-pages.d.ts +4 -0
- package/dist/internal/features/work/components/work-editor-agent-menus.d.ts +12 -0
- package/dist/internal/features/work/components/work-editor-loading-state.d.ts +3 -0
- package/dist/internal/features/work/editors/document-changes-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/document-citation-source-form.d.ts +33 -0
- package/dist/internal/features/work/editors/document-citations-panel.d.ts +8 -0
- package/dist/internal/features/work/editors/document-columns-panel.d.ts +5 -0
- package/dist/internal/features/work/editors/document-comment-composer.d.ts +13 -0
- package/dist/internal/features/work/editors/document-comments-panel.d.ts +17 -0
- package/dist/internal/features/work/editors/document-editor-focus.d.ts +1 -0
- package/dist/internal/features/work/editors/document-editor-pagination.d.ts +3 -0
- package/dist/internal/features/work/editors/document-editor-support.d.ts +34 -0
- package/dist/internal/features/work/editors/document-editor.d.ts +20 -0
- package/dist/internal/features/work/editors/document-find-highlight.d.ts +8 -0
- package/dist/internal/features/work/editors/document-find-replace-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/document-formatting-options.d.ts +113 -0
- package/dist/internal/features/work/editors/document-home-ribbon.d.ts +9 -0
- package/dist/internal/features/work/editors/document-layout-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/document-list-gallery.d.ts +4 -0
- package/dist/internal/features/work/editors/document-navigation-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/document-page-chrome-editor.d.ts +39 -0
- package/dist/internal/features/work/editors/document-page-chrome-panel.d.ts +5 -0
- package/dist/internal/features/work/editors/document-page-chrome-ribbon.d.ts +10 -0
- package/dist/internal/features/work/editors/document-page-navigation.d.ts +14 -0
- package/dist/internal/features/work/editors/document-page-stack.d.ts +8 -0
- package/dist/internal/features/work/editors/document-pagination-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-paragraph-spacing-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-picture-ribbon.d.ts +4 -0
- package/dist/internal/features/work/editors/document-ruler-tab-stops.d.ts +12 -0
- package/dist/internal/features/work/editors/document-ruler.d.ts +15 -0
- package/dist/internal/features/work/editors/document-selection-context-menu.d.ts +22 -0
- package/dist/internal/features/work/editors/document-selection-toolbar.d.ts +8 -0
- package/dist/internal/features/work/editors/document-status-bar.d.ts +19 -0
- package/dist/internal/features/work/editors/document-style-gallery.d.ts +4 -0
- package/dist/internal/features/work/editors/document-table-insert-popover.d.ts +4 -0
- package/dist/internal/features/work/editors/document-table-ribbon.d.ts +7 -0
- package/dist/internal/features/work/editors/document-task-pane.d.ts +11 -0
- package/dist/internal/features/work/editors/document-toolbar.d.ts +100 -0
- package/dist/internal/features/work/editors/document-vertical-ruler.d.ts +6 -0
- package/dist/internal/features/work/editors/markdown-editor-focus.d.ts +2 -0
- package/dist/internal/features/work/editors/markdown-editor.d.ts +16 -0
- package/dist/internal/features/work/editors/markdown-insert-dialog.d.ts +19 -0
- package/dist/internal/features/work/editors/markdown-selection-context-menu.d.ts +14 -0
- package/dist/internal/features/work/editors/markdown-source-commands.d.ts +41 -0
- package/dist/internal/features/work/editors/markdown-status.d.ts +7 -0
- package/dist/internal/features/work/editors/markdown-toolbar.d.ts +22 -0
- package/dist/internal/features/work/editors/markdown-workspace.d.ts +26 -0
- package/dist/internal/features/work/editors/office-checkbox.d.ts +9 -0
- package/dist/internal/features/work/editors/office-color-picker.d.ts +11 -0
- package/dist/internal/features/work/editors/office-controls.d.ts +7 -0
- package/dist/internal/features/work/editors/office-dialog.d.ts +35 -0
- package/dist/internal/features/work/editors/office-editor-extension.d.ts +86 -0
- package/dist/internal/features/work/editors/office-file-data.d.ts +1 -0
- package/dist/internal/features/work/editors/office-font-families.d.ts +187 -0
- package/dist/internal/features/work/editors/office-menu-keyboard.d.ts +2 -0
- package/dist/internal/features/work/editors/office-number-field.d.ts +21 -0
- package/dist/internal/features/work/editors/office-number-normalization.d.ts +9 -0
- package/dist/internal/features/work/editors/office-select.d.ts +19 -0
- package/dist/internal/features/work/editors/office-shortcuts.d.ts +1 -0
- package/dist/internal/features/work/editors/office-slider.d.ts +10 -0
- package/dist/internal/features/work/editors/office-table-dimensions.d.ts +4 -0
- package/dist/internal/features/work/editors/office-table-insert-popover.d.ts +7 -0
- package/dist/internal/features/work/editors/office-task-pane.d.ts +7 -0
- package/dist/internal/features/work/editors/office-text-field.d.ts +20 -0
- package/dist/internal/features/work/editors/office-tiptap-extensions.d.ts +2 -0
- package/dist/internal/features/work/editors/pdf-annotation-controller.d.ts +23 -0
- package/dist/internal/features/work/editors/pdf-editor-extensions.d.ts +36 -0
- package/dist/internal/features/work/editors/pdf-thumbnail-rail.d.ts +26 -0
- package/dist/internal/features/work/editors/pdf-toolbar.d.ts +23 -0
- package/dist/internal/features/work/editors/pdf-viewer-controller.d.ts +48 -0
- package/dist/internal/features/work/editors/pdf-viewer.d.ts +11 -0
- package/dist/internal/features/work/editors/presentation-arrangement-controller.d.ts +19 -0
- package/dist/internal/features/work/editors/presentation-chart-analysis-canvas.d.ts +21 -0
- package/dist/internal/features/work/editors/presentation-chart-axis-canvas.d.ts +33 -0
- package/dist/internal/features/work/editors/presentation-chart-axis-editor.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-canvas.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-cartesian-canvas.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-chart-data-label-editor.d.ts +6 -0
- package/dist/internal/features/work/editors/presentation-chart-data-labels.d.ts +26 -0
- package/dist/internal/features/work/editors/presentation-chart-layout-editor.d.ts +5 -0
- package/dist/internal/features/work/editors/presentation-chart-legend-canvas.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-chart-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/presentation-chart-series-analysis-editor.d.ts +6 -0
- package/dist/internal/features/work/editors/presentation-chart-series-canvas.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-command-controller.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-command-types.d.ts +206 -0
- package/dist/internal/features/work/editors/presentation-comments-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/presentation-context-menu.d.ts +11 -0
- package/dist/internal/features/work/editors/presentation-design-panel.d.ts +13 -0
- package/dist/internal/features/work/editors/presentation-editor-focus.d.ts +12 -0
- package/dist/internal/features/work/editors/presentation-editor-operations.d.ts +10 -0
- package/dist/internal/features/work/editors/presentation-editor-types.d.ts +22 -0
- package/dist/internal/features/work/editors/presentation-editor.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-keyboard-extension.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-player.d.ts +7 -0
- package/dist/internal/features/work/editors/presentation-presenter-view.d.ts +15 -0
- package/dist/internal/features/work/editors/presentation-selection.d.ts +21 -0
- package/dist/internal/features/work/editors/presentation-slide-canvas.d.ts +26 -0
- package/dist/internal/features/work/editors/presentation-slide-thumbnail.d.ts +18 -0
- package/dist/internal/features/work/editors/presentation-status-bar.d.ts +10 -0
- package/dist/internal/features/work/editors/presentation-text-editor.d.ts +22 -0
- package/dist/internal/features/work/editors/presentation-text-formatting.d.ts +3 -0
- package/dist/internal/features/work/editors/presentation-thumbnail-rail.d.ts +20 -0
- package/dist/internal/features/work/editors/presentation-toolbar.d.ts +19 -0
- package/dist/internal/features/work/editors/presentation-transition-panel.d.ts +9 -0
- package/dist/internal/features/work/editors/presentation-workspace.d.ts +38 -0
- package/dist/internal/features/work/editors/spreadsheet-calculation-model.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-calculation-projection.d.ts +32 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-axis-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-draft.d.ts +17 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-layout-editor.d.ts +13 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-chart-series-style-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-clipboard-shortcuts.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +121 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-comparison-fields.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-format-model.d.ts +72 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-format-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-conditional-threshold-fields.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-context-menu.d.ts +36 -0
- package/dist/internal/features/work/editors/spreadsheet-data-label-editor.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-ribbon.d.ts +46 -0
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +31 -0
- package/dist/internal/features/work/editors/spreadsheet-editor.d.ts +16 -0
- package/dist/internal/features/work/editors/spreadsheet-error-bar-editor.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-find-bar.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-find.d.ts +9 -0
- package/dist/internal/features/work/editors/spreadsheet-formula-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-header-footer-fields.d.ts +5 -0
- package/dist/internal/features/work/editors/spreadsheet-keyboard-navigation.d.ts +18 -0
- package/dist/internal/features/work/editors/spreadsheet-number-format.d.ts +11 -0
- package/dist/internal/features/work/editors/spreadsheet-pivot-panel.d.ts +10 -0
- package/dist/internal/features/work/editors/spreadsheet-print-settings-panel.d.ts +6 -0
- package/dist/internal/features/work/editors/spreadsheet-protection-panel.d.ts +7 -0
- package/dist/internal/features/work/editors/spreadsheet-sheet-bar.d.ts +17 -0
- package/dist/internal/features/work/editors/spreadsheet-sheet-model.d.ts +13 -0
- package/dist/internal/features/work/editors/spreadsheet-trendline-editor.d.ts +8 -0
- package/dist/internal/features/work/editors/spreadsheet-workbook-panel.d.ts +16 -0
- package/dist/internal/features/work/editors/use-document-comments.d.ts +26 -0
- package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +19 -0
- package/dist/internal/features/work/editors/use-document-layout-fonts.d.ts +2 -0
- package/dist/internal/features/work/editors/use-document-page-chrome.d.ts +33 -0
- package/dist/internal/features/work/editors/use-document-pagination.d.ts +46 -0
- package/dist/internal/features/work/editors/use-markdown-source-history.d.ts +16 -0
- package/dist/internal/features/work/editors/use-office-draft.d.ts +10 -0
- package/dist/internal/features/work/editors/use-office-editor-keyboard-shortcuts.d.ts +9 -0
- package/dist/internal/features/work/editors/use-office-editor-runtime.d.ts +6 -0
- package/dist/internal/features/work/editors/use-office-editor-wheel-zoom.d.ts +19 -0
- package/dist/internal/features/work/editors/use-office-history.d.ts +10 -0
- package/dist/internal/features/work/editors/use-presentation-clipboard.d.ts +22 -0
- package/dist/internal/features/work/editors/use-presentation-design-commands.d.ts +33 -0
- package/dist/internal/features/work/editors/use-presentation-element-commands.d.ts +29 -0
- package/dist/internal/features/work/editors/use-presentation-geometry.d.ts +17 -0
- package/dist/internal/features/work/editors/use-presentation-history.d.ts +12 -0
- package/dist/internal/features/work/editors/use-presentation-review-commands.d.ts +22 -0
- package/dist/internal/features/work/editors/use-presentation-selection.d.ts +11 -0
- package/dist/internal/features/work/editors/use-presentation-slide-commands.d.ts +18 -0
- package/dist/internal/features/work/editors/use-presentation-thumbnail-visibility.d.ts +4 -0
- package/dist/internal/features/work/editors/use-presentation-thumbnail-window.d.ts +17 -0
- package/dist/internal/features/work/editors/use-presentation-transform.d.ts +53 -0
- package/dist/internal/features/work/editors/use-spreadsheet-calculation.d.ts +17 -0
- package/dist/internal/features/work/editors/use-spreadsheet-workbook-sync.d.ts +10 -0
- package/dist/internal/features/work/editors/work-office-chrome.d.ts +61 -0
- package/dist/internal/features/work/editors/work-office-ribbon-overflow.d.ts +18 -0
- package/dist/internal/features/work/work-agent-proposal-apply.d.ts +8 -0
- package/dist/internal/features/work/work-agent-proposal.d.ts +55 -0
- package/dist/internal/features/work/work-agent-request.d.ts +6 -0
- package/dist/internal/features/work/work-chart-series-analysis-context.d.ts +3 -0
- package/dist/internal/features/work/work-document-caption-nodes.d.ts +13 -0
- package/dist/internal/features/work/work-document-captions.d.ts +14 -0
- package/dist/internal/features/work/work-document-changes.d.ts +35 -0
- package/dist/internal/features/work/work-document-character-formatting.d.ts +13 -0
- package/dist/internal/features/work/work-document-citation-nodes.d.ts +25 -0
- package/dist/internal/features/work/work-document-citations.d.ts +21 -0
- package/dist/internal/features/work/work-document-columns.d.ts +15 -0
- package/dist/internal/features/work/work-document-comments.d.ts +48 -0
- package/dist/internal/features/work/work-document-extensions.d.ts +11 -0
- package/dist/internal/features/work/work-document-field-node.d.ts +12 -0
- package/dist/internal/features/work/work-document-fields.d.ts +15 -0
- package/dist/internal/features/work/work-document-file-io.d.ts +4 -0
- package/dist/internal/features/work/work-document-fonts.d.ts +16 -0
- package/dist/internal/features/work/work-document-image-layout.d.ts +29 -0
- package/dist/internal/features/work/work-document-incremental-layout.d.ts +17 -0
- package/dist/internal/features/work/work-document-layout.d.ts +5 -0
- package/dist/internal/features/work/work-document-line-measurement.d.ts +24 -0
- package/dist/internal/features/work/work-document-links.d.ts +2 -0
- package/dist/internal/features/work/work-document-lists.d.ts +25 -0
- package/dist/internal/features/work/work-document-model-codec.d.ts +3 -0
- package/dist/internal/features/work/work-document-model.d.ts +12 -0
- package/dist/internal/features/work/work-document-note-nodes.d.ts +11 -0
- package/dist/internal/features/work/work-document-notes.d.ts +18 -0
- package/dist/internal/features/work/work-document-outline.d.ts +14 -0
- package/dist/internal/features/work/work-document-page-break.d.ts +2 -0
- package/dist/internal/features/work/work-document-page-chrome-commands.d.ts +15 -0
- package/dist/internal/features/work/work-document-page-chrome.d.ts +19 -0
- package/dist/internal/features/work/work-document-page-color.d.ts +3 -0
- package/dist/internal/features/work/work-document-pages.d.ts +19 -0
- package/dist/internal/features/work/work-document-pagination-decorations.d.ts +3 -0
- package/dist/internal/features/work/work-document-pagination-dom.d.ts +35 -0
- package/dist/internal/features/work/work-document-pagination-measurement.d.ts +9 -0
- package/dist/internal/features/work/work-document-pagination-types.d.ts +88 -0
- package/dist/internal/features/work/work-document-pagination.d.ts +17 -0
- package/dist/internal/features/work/work-document-paragraph-formatting.d.ts +61 -0
- package/dist/internal/features/work/work-document-search.d.ts +11 -0
- package/dist/internal/features/work/work-document-section-editor.d.ts +20 -0
- package/dist/internal/features/work/work-document-section-node.d.ts +13 -0
- package/dist/internal/features/work/work-document-section.d.ts +34 -0
- package/dist/internal/features/work/work-document-selection-menu.d.ts +54 -0
- package/dist/internal/features/work/work-document-tab-node.d.ts +6 -0
- package/dist/internal/features/work/work-document-tab-stops.d.ts +29 -0
- package/dist/internal/features/work/work-document-table-cell-formatting.d.ts +46 -0
- package/dist/internal/features/work/work-document-table-commands.d.ts +17 -0
- package/dist/internal/features/work/work-document-table-pagination.d.ts +5 -0
- package/dist/internal/features/work/work-document-table-row.d.ts +37 -0
- package/dist/internal/features/work/work-document-table-sizing.d.ts +27 -0
- package/dist/internal/features/work/work-document-text-layout.d.ts +14 -0
- package/dist/internal/features/work/work-docx-bibliography.d.ts +12 -0
- package/dist/internal/features/work/work-docx-caption-diagnostics.d.ts +6 -0
- package/dist/internal/features/work/work-docx-caption-export.d.ts +4 -0
- package/dist/internal/features/work/work-docx-caption-fields.d.ts +5 -0
- package/dist/internal/features/work/work-docx-caption-import.d.ts +20 -0
- package/dist/internal/features/work/work-docx-change-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-citation-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-citation-export.d.ts +3 -0
- package/dist/internal/features/work/work-docx-citation-import.d.ts +23 -0
- package/dist/internal/features/work/work-docx-column-export.d.ts +14 -0
- package/dist/internal/features/work/work-docx-column-import.d.ts +2 -0
- package/dist/internal/features/work/work-docx-comment-import.d.ts +14 -0
- package/dist/internal/features/work/work-docx-export-formatting.d.ts +30 -0
- package/dist/internal/features/work/work-docx-export-image.d.ts +2 -0
- package/dist/internal/features/work/work-docx-export.d.ts +2 -0
- package/dist/internal/features/work/work-docx-field-export.d.ts +2 -0
- package/dist/internal/features/work/work-docx-field-import.d.ts +16 -0
- package/dist/internal/features/work/work-docx-field-instructions.d.ts +8 -0
- package/dist/internal/features/work/work-docx-image-layout-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-import.d.ts +50 -0
- package/dist/internal/features/work/work-docx-list-import.d.ts +14 -0
- package/dist/internal/features/work/work-docx-note-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-note-import.d.ts +3 -0
- package/dist/internal/features/work/work-docx-page-chrome-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-page-chrome-import.d.ts +11 -0
- package/dist/internal/features/work/work-docx-page-color.d.ts +2 -0
- package/dist/internal/features/work/work-docx-paragraph-alignment-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-direction-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-indent-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-pagination-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-spacing-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-paragraph-styles.d.ts +18 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +19 -0
- package/dist/internal/features/work/work-docx-tab-stop-import.d.ts +13 -0
- package/dist/internal/features/work/work-docx-table-cell-export.d.ts +4 -0
- package/dist/internal/features/work/work-docx-table-cell-import.d.ts +16 -0
- package/dist/internal/features/work/work-docx-table-row-import.d.ts +13 -0
- package/dist/internal/features/work/work-docx-table-sizing-export.d.ts +8 -0
- package/dist/internal/features/work/work-docx-table-sizing-import.d.ts +12 -0
- package/dist/internal/features/work/work-docx-theme.d.ts +9 -0
- package/dist/internal/features/work/work-file-data.d.ts +1 -0
- package/dist/internal/features/work/work-file-download.d.ts +3 -0
- package/dist/internal/features/work/work-file-io.d.ts +8 -0
- package/dist/internal/features/work/work-markdown-extensions.d.ts +19 -0
- package/dist/internal/features/work/work-markdown-file-io.d.ts +3 -0
- package/dist/internal/features/work/work-markdown-selection-menu.d.ts +57 -0
- package/dist/internal/features/work/work-office-diagnostics.d.ts +9 -0
- package/dist/internal/features/work/work-ooxml-package.d.ts +28 -0
- package/dist/internal/features/work/work-pdf-export.d.ts +23 -0
- package/dist/internal/features/work/work-pptx-chart-axes.d.ts +3 -0
- package/dist/internal/features/work/work-pptx-chart-axis-diagnostics.d.ts +5 -0
- package/dist/internal/features/work/work-pptx-chart-data-labels.d.ts +12 -0
- package/dist/internal/features/work/work-pptx-chart-import.d.ts +11 -0
- package/dist/internal/features/work/work-pptx-chart-layout-style.d.ts +15 -0
- package/dist/internal/features/work/work-pptx-chart-series-analysis.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-chart-xy.d.ts +3 -0
- package/dist/internal/features/work/work-pptx-comments.d.ts +17 -0
- package/dist/internal/features/work/work-pptx-export.d.ts +4 -0
- package/dist/internal/features/work/work-pptx-groups.d.ts +19 -0
- package/dist/internal/features/work/work-pptx-import.d.ts +6 -0
- package/dist/internal/features/work/work-pptx-layout-export.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-layout-import.d.ts +30 -0
- package/dist/internal/features/work/work-pptx-style.d.ts +13 -0
- package/dist/internal/features/work/work-pptx-transition.d.ts +13 -0
- package/dist/internal/features/work/work-presentation-agent-context.d.ts +6 -0
- package/dist/internal/features/work/work-presentation-chart-axes.d.ts +14 -0
- package/dist/internal/features/work/work-presentation-charts.d.ts +37 -0
- package/dist/internal/features/work/work-presentation-clipboard.d.ts +26 -0
- package/dist/internal/features/work/work-presentation-file-io.d.ts +15 -0
- package/dist/internal/features/work/work-presentation-groups.d.ts +17 -0
- package/dist/internal/features/work/work-presentation-layouts.d.ts +13 -0
- package/dist/internal/features/work/work-presentation-transition.d.ts +4 -0
- package/dist/internal/features/work/work-presentation-visual-scale.d.ts +2 -0
- package/dist/internal/features/work/work-repository.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-agent-context.d.ts +15 -0
- package/dist/internal/features/work/work-spreadsheet-chart-axis.d.ts +42 -0
- package/dist/internal/features/work/work-spreadsheet-chart-layout.d.ts +29 -0
- package/dist/internal/features/work/work-spreadsheet-chart-legend-svg.d.ts +18 -0
- package/dist/internal/features/work/work-spreadsheet-chart-series-layout.d.ts +24 -0
- package/dist/internal/features/work/work-spreadsheet-chart-series-style.d.ts +29 -0
- package/dist/internal/features/work/work-spreadsheet-chart-svg-utils.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-chart-svg.d.ts +3 -0
- package/dist/internal/features/work/work-spreadsheet-chart-types.d.ts +147 -0
- package/dist/internal/features/work/work-spreadsheet-chart-validation.d.ts +2 -0
- package/dist/internal/features/work/work-spreadsheet-charts.d.ts +17 -0
- package/dist/internal/features/work/work-spreadsheet-combination-chart-svg.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-comments.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-canvas.d.ts +5 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-colors.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-comparisons.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-data-bar.d.ts +8 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-format.d.ts +10 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-icons.d.ts +107 -0
- package/dist/internal/features/work/work-spreadsheet-conditional-values.d.ts +19 -0
- package/dist/internal/features/work/work-spreadsheet-data-label-svg.d.ts +27 -0
- package/dist/internal/features/work/work-spreadsheet-error-bar-svg.d.ts +5 -0
- package/dist/internal/features/work/work-spreadsheet-error-bars.d.ts +8 -0
- package/dist/internal/features/work/work-spreadsheet-formula-analysis.d.ts +30 -0
- package/dist/internal/features/work/work-spreadsheet-formula-support.d.ts +1 -0
- package/dist/internal/features/work/work-spreadsheet-formulas.d.ts +19 -0
- package/dist/internal/features/work/work-spreadsheet-header-footer.d.ts +14 -0
- package/dist/internal/features/work/work-spreadsheet-line-chart-svg.d.ts +10 -0
- package/dist/internal/features/work/work-spreadsheet-page-breaks.d.ts +4 -0
- package/dist/internal/features/work/work-spreadsheet-page-setup.d.ts +26 -0
- package/dist/internal/features/work/work-spreadsheet-pivot-engine.d.ts +21 -0
- package/dist/internal/features/work/work-spreadsheet-pivot-values.d.ts +7 -0
- package/dist/internal/features/work/work-spreadsheet-pivots.d.ts +27 -0
- package/dist/internal/features/work/work-spreadsheet-protection.d.ts +55 -0
- package/dist/internal/features/work/work-spreadsheet-ranges.d.ts +25 -0
- package/dist/internal/features/work/work-spreadsheet-trendline-svg.d.ts +9 -0
- package/dist/internal/features/work/work-spreadsheet-trendlines.d.ts +11 -0
- package/dist/internal/features/work/work-spreadsheet-xy-chart-axes-svg.d.ts +10 -0
- package/dist/internal/features/work/work-templates.d.ts +4 -0
- package/dist/internal/features/work/work-types.d.ts +513 -0
- package/dist/internal/features/work/work-xlsx-chart-axes.d.ts +4 -0
- package/dist/internal/features/work/work-xlsx-chart-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-chart-layout.d.ts +16 -0
- package/dist/internal/features/work/work-xlsx-chart-series-style.d.ts +6 -0
- package/dist/internal/features/work/work-xlsx-chart-values.d.ts +10 -0
- package/dist/internal/features/work/work-xlsx-charts.d.ts +32 -0
- package/dist/internal/features/work/work-xlsx-conditional-format-diagnostics.d.ts +6 -0
- package/dist/internal/features/work/work-xlsx-conditional-format-write.d.ts +11 -0
- package/dist/internal/features/work/work-xlsx-conditional-format.d.ts +29 -0
- package/dist/internal/features/work/work-xlsx-defined-names.d.ts +4 -0
- package/dist/internal/features/work/work-xlsx-drawing-geometry.d.ts +27 -0
- package/dist/internal/features/work/work-xlsx-formula-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-formulas.d.ts +40 -0
- package/dist/internal/features/work/work-xlsx-header-footer.d.ts +12 -0
- package/dist/internal/features/work/work-xlsx-images.d.ts +17 -0
- package/dist/internal/features/work/work-xlsx-interop.d.ts +39 -0
- package/dist/internal/features/work/work-xlsx-page-breaks.d.ts +7 -0
- package/dist/internal/features/work/work-xlsx-page-setup-diagnostics.d.ts +2 -0
- package/dist/internal/features/work/work-xlsx-page-setup.d.ts +5 -0
- package/dist/internal/features/work/work-xlsx-pivot-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-xlsx-pivot-xml.d.ts +9 -0
- package/dist/internal/features/work/work-xlsx-pivots.d.ts +32 -0
- package/dist/internal/features/work/work-xlsx-protection.d.ts +24 -0
- package/dist/internal/features/workspace/components/workspace-context-menu.d.ts +29 -0
- package/dist/internal/features/workspace/components/workspace-text-control-selection.d.ts +7 -0
- package/dist/internal/kernel/office-kernel-client-types.d.ts +40 -0
- package/dist/internal/kernel/office-kernel-client.d.ts +4 -0
- package/dist/internal/kernel/office-kernel-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-presentation-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-protocol.d.ts +229 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-formula.d.ts +3 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-validation.d.ts +5 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback-value.d.ts +6 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-fallback.d.ts +2 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-protocol.d.ts +112 -0
- package/dist/internal/kernel/office-kernel-spreadsheet-session-fallback.d.ts +8 -0
- package/dist/internal/kernel/office-kernel-text-fallback.d.ts +10 -0
- package/dist/internal/kernel/office-kernel-version.d.ts +1 -0
- package/dist/internal/kernel/office-kernel.worker.d.ts +1 -0
- package/dist/internal/keyboard-shortcuts.d.ts +2 -0
- package/dist/internal/state/app-state.d.ts +8 -0
- package/dist/noto-naskh-arabic-regular.ttf +0 -0
- package/dist/noto-naskh-arabic.LICENSE.txt +94 -0
- package/dist/noto-sans-hans-regular.otf +0 -0
- package/dist/noto-sans-hans.LICENSE.txt +94 -0
- package/dist/noto-sans-hebrew-regular.ttf +0 -0
- package/dist/noto-sans-hebrew.LICENSE.txt +94 -0
- package/dist/noto-sans-regular.ttf +0 -0
- package/dist/noto-sans.LICENSE.txt +94 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/office-kernel.worker.js +14605 -0
- package/dist/office-surface.d.ts +10 -0
- package/dist/pdfium.LICENSE.txt +196 -0
- package/dist/pdfium.wasm +0 -0
- package/dist/pptxgen.LICENSE.txt +21 -0
- package/dist/pptxgen.bundle.js +11244 -0
- package/dist/react.d.ts +51 -0
- package/dist/react.js +1 -0
- package/dist/styles.css +17435 -0
- package/dist/styles.js +0 -0
- package/dist/vue.d.ts +282 -0
- package/dist/vue.js +231 -0
- package/dist/web-component.d.ts +98 -0
- package/dist/web-component.js +335 -0
- package/docs/browser-editor-architecture.md +947 -0
- package/package.json +165 -0
package/dist/0~4595.js
ADDED
|
@@ -0,0 +1,1162 @@
|
|
|
1
|
+
import { Fragment as jsx_runtime_Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { Check, ChevronDown, ChevronLeft, ChevronRight, Eye, Minus, Plus, X } from "lucide-react";
|
|
5
|
+
import { moveOfficeMenuFocus, useDialogFocusScope, icon_button_IconButton, Popover, matchesAriaKeyShortcuts, officeOverlayPortalRoot } from "./0~9512.js";
|
|
6
|
+
const CONTEXT_MENU_MARGIN = 8;
|
|
7
|
+
const CONTEXT_MENU_TAB_STOP_SELECTOR = 'a[href]:not([tabindex="-1"]), button:not(:disabled):not([tabindex="-1"]), input:not(:disabled):not([type="hidden"]):not([tabindex="-1"]), select:not(:disabled):not([tabindex="-1"]), textarea:not(:disabled):not([tabindex="-1"]), [contenteditable="true"]:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])';
|
|
8
|
+
function isWorkspaceContextMenuKeyboardEvent({ key, shiftKey }) {
|
|
9
|
+
return 'ContextMenu' === key || 'F10' === key && shiftKey;
|
|
10
|
+
}
|
|
11
|
+
function workspaceContextMenuPosition(event, keyboardAnchorBounds) {
|
|
12
|
+
if ('clientX' in event && (0 !== event.clientX || 0 !== event.clientY)) return {
|
|
13
|
+
x: event.clientX,
|
|
14
|
+
y: event.clientY
|
|
15
|
+
};
|
|
16
|
+
const target = event.target instanceof HTMLElement ? event.target : event.currentTarget;
|
|
17
|
+
const bounds = usableContextMenuBounds(keyboardAnchorBounds) ?? contextMenuSelectionBounds(target.ownerDocument, target) ?? target.getBoundingClientRect();
|
|
18
|
+
return {
|
|
19
|
+
x: bounds.left + bounds.width / 2,
|
|
20
|
+
y: bounds.top + bounds.height / 2
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function usableContextMenuBounds(bounds) {
|
|
24
|
+
if (!bounds) return null;
|
|
25
|
+
const values = [
|
|
26
|
+
bounds.left,
|
|
27
|
+
bounds.top,
|
|
28
|
+
bounds.width,
|
|
29
|
+
bounds.height
|
|
30
|
+
];
|
|
31
|
+
return values.every(Number.isFinite) && bounds.width >= 0 && bounds.height > 0 ? bounds : null;
|
|
32
|
+
}
|
|
33
|
+
function WorkspaceContextMenu({ label, className = '', x, y, items, onClose, onRestoreFocus }) {
|
|
34
|
+
const menuRef = useRef(null);
|
|
35
|
+
const restoreFocusRef = useRef(null);
|
|
36
|
+
const portalRootRef = useRef(null);
|
|
37
|
+
const [position, setPosition] = useState({
|
|
38
|
+
left: x,
|
|
39
|
+
top: y
|
|
40
|
+
});
|
|
41
|
+
if (!portalRootRef.current && "u" > typeof document) portalRootRef.current = contextMenuPortalRoot(document, x, y);
|
|
42
|
+
const positionMenu = useCallback(()=>{
|
|
43
|
+
const menu = menuRef.current;
|
|
44
|
+
if (!menu) return;
|
|
45
|
+
const ownerDocument = menu.ownerDocument;
|
|
46
|
+
const view = ownerDocument.defaultView;
|
|
47
|
+
if (!view) return;
|
|
48
|
+
const bounds = menu.getBoundingClientRect();
|
|
49
|
+
const available = contextMenuAvailableBounds(ownerDocument, view, portalRootRef.current);
|
|
50
|
+
const requested = contextMenuRequestedPosition(x, y, restoreFocusRef.current);
|
|
51
|
+
setPosition({
|
|
52
|
+
left: clampCoordinate(requested.x, available.left + CONTEXT_MENU_MARGIN, available.right - bounds.width - CONTEXT_MENU_MARGIN),
|
|
53
|
+
top: clampCoordinate(requested.y, available.top + CONTEXT_MENU_MARGIN, available.bottom - bounds.height - CONTEXT_MENU_MARGIN)
|
|
54
|
+
});
|
|
55
|
+
}, [
|
|
56
|
+
x,
|
|
57
|
+
y
|
|
58
|
+
]);
|
|
59
|
+
useLayoutEffect(()=>{
|
|
60
|
+
const menu = menuRef.current;
|
|
61
|
+
if (!menu) return;
|
|
62
|
+
const ownerDocument = menu.ownerDocument;
|
|
63
|
+
const view = ownerDocument.defaultView;
|
|
64
|
+
if (!restoreFocusRef.current) restoreFocusRef.current = ownerDocument.activeElement instanceof HTMLElement ? ownerDocument.activeElement : null;
|
|
65
|
+
positionMenu();
|
|
66
|
+
menu.querySelector('button:not(:disabled)')?.focus();
|
|
67
|
+
view?.addEventListener('resize', positionMenu);
|
|
68
|
+
view?.visualViewport?.addEventListener('resize', positionMenu);
|
|
69
|
+
view?.visualViewport?.addEventListener('scroll', positionMenu);
|
|
70
|
+
return ()=>{
|
|
71
|
+
view?.removeEventListener('resize', positionMenu);
|
|
72
|
+
view?.visualViewport?.removeEventListener('resize', positionMenu);
|
|
73
|
+
view?.visualViewport?.removeEventListener('scroll', positionMenu);
|
|
74
|
+
};
|
|
75
|
+
}, [
|
|
76
|
+
positionMenu
|
|
77
|
+
]);
|
|
78
|
+
useEffect(()=>{
|
|
79
|
+
const menu = menuRef.current;
|
|
80
|
+
if (!menu) return;
|
|
81
|
+
const ownerDocument = menu.ownerDocument;
|
|
82
|
+
const view = ownerDocument.defaultView;
|
|
83
|
+
const closeFromOutside = (event)=>{
|
|
84
|
+
const currentMenu = menuRef.current;
|
|
85
|
+
if (!currentMenu || event.composedPath().includes(currentMenu)) return;
|
|
86
|
+
onClose();
|
|
87
|
+
};
|
|
88
|
+
const closeFromScroll = (event)=>{
|
|
89
|
+
if (menuRef.current?.contains(event.target)) return;
|
|
90
|
+
onClose();
|
|
91
|
+
};
|
|
92
|
+
ownerDocument.addEventListener('pointerdown', closeFromOutside, true);
|
|
93
|
+
ownerDocument.addEventListener('scroll', closeFromScroll, true);
|
|
94
|
+
view?.addEventListener('blur', onClose);
|
|
95
|
+
return ()=>{
|
|
96
|
+
ownerDocument.removeEventListener('pointerdown', closeFromOutside, true);
|
|
97
|
+
ownerDocument.removeEventListener('scroll', closeFromScroll, true);
|
|
98
|
+
view?.removeEventListener('blur', onClose);
|
|
99
|
+
};
|
|
100
|
+
}, [
|
|
101
|
+
onClose
|
|
102
|
+
]);
|
|
103
|
+
const moveFocus = (direction)=>{
|
|
104
|
+
const buttons = [
|
|
105
|
+
...menuRef.current?.querySelectorAll('button:not(:disabled)') ?? []
|
|
106
|
+
];
|
|
107
|
+
if (!buttons.length) return;
|
|
108
|
+
const activeElement = menuRef.current?.ownerDocument.activeElement;
|
|
109
|
+
const current = buttons.indexOf(activeElement);
|
|
110
|
+
const next = current < 0 ? 0 : (current + direction + buttons.length) % buttons.length;
|
|
111
|
+
buttons[next]?.focus();
|
|
112
|
+
};
|
|
113
|
+
const restoreContextFocus = ()=>{
|
|
114
|
+
if (onRestoreFocus) return void onRestoreFocus();
|
|
115
|
+
const restoreFocus = restoreFocusRef.current;
|
|
116
|
+
if (restoreFocus?.isConnected) restoreFocus.focus({
|
|
117
|
+
preventScroll: true
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
const dismissAndRestoreFocus = ()=>{
|
|
121
|
+
onClose();
|
|
122
|
+
restoreContextFocus();
|
|
123
|
+
};
|
|
124
|
+
const dismissAndMoveFocus = (direction)=>{
|
|
125
|
+
const menu = menuRef.current;
|
|
126
|
+
const restoreFocus = restoreFocusRef.current;
|
|
127
|
+
const next = adjacentContextMenuTabStop(restoreFocus, direction, menu);
|
|
128
|
+
const view = menu?.ownerDocument.defaultView;
|
|
129
|
+
onClose();
|
|
130
|
+
const focus = ()=>{
|
|
131
|
+
const target = next?.isConnected ? next : restoreFocus;
|
|
132
|
+
if (target?.isConnected) target.focus({
|
|
133
|
+
preventScroll: true
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
if (view) view.requestAnimationFrame(focus);
|
|
137
|
+
else focus();
|
|
138
|
+
};
|
|
139
|
+
const portalRoot = portalRootRef.current;
|
|
140
|
+
if (!portalRoot) return null;
|
|
141
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx("div", {
|
|
142
|
+
ref: menuRef,
|
|
143
|
+
className: `work-office-context-menu workspace-context-menu ${className}`.trim(),
|
|
144
|
+
role: "menu",
|
|
145
|
+
"aria-label": label,
|
|
146
|
+
"aria-orientation": "vertical",
|
|
147
|
+
"data-office-shortcuts": "ignore",
|
|
148
|
+
style: position,
|
|
149
|
+
onContextMenu: (event)=>{
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
event.stopPropagation();
|
|
152
|
+
},
|
|
153
|
+
onKeyDown: (event)=>{
|
|
154
|
+
const shortcutItem = event.repeat || event.nativeEvent.isComposing ? void 0 : items.find((item)=>!item.disabled && matchesAriaKeyShortcuts(event.nativeEvent, item.ariaKeyShortcut));
|
|
155
|
+
if (shortcutItem) {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
event.stopPropagation();
|
|
158
|
+
dismissAndRestoreFocus();
|
|
159
|
+
shortcutItem.onSelect();
|
|
160
|
+
} else if ('Escape' === event.key) {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
event.stopPropagation();
|
|
163
|
+
dismissAndRestoreFocus();
|
|
164
|
+
} else if ('Tab' === event.key) {
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
event.stopPropagation();
|
|
167
|
+
dismissAndMoveFocus(event.shiftKey ? -1 : 1);
|
|
168
|
+
} else if ('ArrowDown' === event.key) {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
moveFocus(1);
|
|
171
|
+
} else if ('ArrowUp' === event.key) {
|
|
172
|
+
event.preventDefault();
|
|
173
|
+
moveFocus(-1);
|
|
174
|
+
} else if ('Home' === event.key || 'End' === event.key) {
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
const buttons = [
|
|
177
|
+
...menuRef.current?.querySelectorAll('button:not(:disabled)') ?? []
|
|
178
|
+
];
|
|
179
|
+
('Home' === event.key ? buttons[0] : buttons.at(-1))?.focus();
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
children: items.map((item)=>/*#__PURE__*/ jsxs(Fragment, {
|
|
183
|
+
children: [
|
|
184
|
+
item.separatorBefore && /*#__PURE__*/ jsx("hr", {
|
|
185
|
+
className: "workspace-context-menu-separator"
|
|
186
|
+
}),
|
|
187
|
+
/*#__PURE__*/ jsxs("button", {
|
|
188
|
+
type: "button",
|
|
189
|
+
role: "menuitem",
|
|
190
|
+
tabIndex: -1,
|
|
191
|
+
className: item.danger ? 'danger' : void 0,
|
|
192
|
+
disabled: item.disabled,
|
|
193
|
+
"aria-label": item.label,
|
|
194
|
+
"aria-keyshortcuts": item.ariaKeyShortcut,
|
|
195
|
+
onClick: ()=>{
|
|
196
|
+
onClose();
|
|
197
|
+
restoreContextFocus();
|
|
198
|
+
item.onSelect();
|
|
199
|
+
},
|
|
200
|
+
children: [
|
|
201
|
+
item.icon,
|
|
202
|
+
/*#__PURE__*/ jsx("span", {
|
|
203
|
+
children: item.label
|
|
204
|
+
}),
|
|
205
|
+
item.shortcut && /*#__PURE__*/ jsx("kbd", {
|
|
206
|
+
children: item.shortcut
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
}, item.id))
|
|
212
|
+
}), portalRoot);
|
|
213
|
+
}
|
|
214
|
+
function contextMenuSelectionBounds(ownerDocument, target) {
|
|
215
|
+
const selection = ownerDocument.getSelection?.();
|
|
216
|
+
if (!selection || selection.isCollapsed || 0 === selection.rangeCount) return null;
|
|
217
|
+
const range = selection.getRangeAt(0);
|
|
218
|
+
if (!target.contains(range.commonAncestorContainer)) return null;
|
|
219
|
+
if ('function' != typeof range.getBoundingClientRect) return null;
|
|
220
|
+
const bounds = range.getBoundingClientRect();
|
|
221
|
+
return bounds.width > 0 || bounds.height > 0 ? bounds : null;
|
|
222
|
+
}
|
|
223
|
+
function contextMenuRequestedPosition(x, y, anchor) {
|
|
224
|
+
if (0 !== x || 0 !== y || !anchor) return {
|
|
225
|
+
x,
|
|
226
|
+
y
|
|
227
|
+
};
|
|
228
|
+
const bounds = contextMenuSelectionBounds(anchor.ownerDocument, anchor) ?? anchor.getBoundingClientRect();
|
|
229
|
+
return {
|
|
230
|
+
x: bounds.left + bounds.width / 2,
|
|
231
|
+
y: bounds.top + bounds.height / 2
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function adjacentContextMenuTabStop(origin, direction, menu) {
|
|
235
|
+
if (!origin) return null;
|
|
236
|
+
const ownerDocument = origin.ownerDocument;
|
|
237
|
+
const view = ownerDocument.defaultView;
|
|
238
|
+
const tabStops = [
|
|
239
|
+
...ownerDocument.querySelectorAll(CONTEXT_MENU_TAB_STOP_SELECTOR)
|
|
240
|
+
].filter((element)=>!menu?.contains(element) && !element.closest('[hidden], [inert], [aria-hidden="true"]') && 'true' !== element.getAttribute('aria-disabled') && view?.getComputedStyle(element).display !== 'none' && view?.getComputedStyle(element).visibility !== 'hidden');
|
|
241
|
+
const index = tabStops.indexOf(origin);
|
|
242
|
+
if (index >= 0) return tabStops[index + direction] ?? null;
|
|
243
|
+
const nodeApi = view?.Node;
|
|
244
|
+
if (!nodeApi) return null;
|
|
245
|
+
const relation = 1 === direction ? nodeApi.DOCUMENT_POSITION_FOLLOWING : nodeApi.DOCUMENT_POSITION_PRECEDING;
|
|
246
|
+
const ordered = 1 === direction ? tabStops : [
|
|
247
|
+
...tabStops
|
|
248
|
+
].reverse();
|
|
249
|
+
return ordered.find((element)=>Boolean(origin.compareDocumentPosition(element) & relation)) ?? null;
|
|
250
|
+
}
|
|
251
|
+
function contextMenuPortalRoot(ownerDocument, x, y) {
|
|
252
|
+
const elementAtPoint = ownerDocument.elementFromPoint?.(x, y);
|
|
253
|
+
const activeElement = ownerDocument.activeElement;
|
|
254
|
+
return officeOverlayPortalRoot(ownerDocument, elementAtPoint, activeElement instanceof Element ? activeElement : null);
|
|
255
|
+
}
|
|
256
|
+
function contextMenuAvailableBounds(ownerDocument, view, portalRoot) {
|
|
257
|
+
const viewport = view.visualViewport;
|
|
258
|
+
const viewportBounds = {
|
|
259
|
+
left: viewport?.offsetLeft ?? 0,
|
|
260
|
+
top: viewport?.offsetTop ?? 0,
|
|
261
|
+
right: (viewport?.offsetLeft ?? 0) + (viewport?.width ?? view.innerWidth),
|
|
262
|
+
bottom: (viewport?.offsetTop ?? 0) + (viewport?.height ?? view.innerHeight)
|
|
263
|
+
};
|
|
264
|
+
if (!portalRoot || portalRoot === ownerDocument.body || portalRoot === ownerDocument.documentElement) return viewportBounds;
|
|
265
|
+
const rootBounds = portalRoot.getBoundingClientRect();
|
|
266
|
+
if (rootBounds.width <= 0 || rootBounds.height <= 0) return viewportBounds;
|
|
267
|
+
return {
|
|
268
|
+
left: Math.max(viewportBounds.left, rootBounds.left),
|
|
269
|
+
top: Math.max(viewportBounds.top, rootBounds.top),
|
|
270
|
+
right: Math.min(viewportBounds.right, rootBounds.right),
|
|
271
|
+
bottom: Math.min(viewportBounds.bottom, rootBounds.bottom)
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function clampCoordinate(value, minimum, maximum) {
|
|
275
|
+
return Math.max(minimum, Math.min(value, Math.max(minimum, maximum)));
|
|
276
|
+
}
|
|
277
|
+
function Dialog({ title, description, children, footer, onClose, closeDisabled = false, className, focusKey, restoreFocusTarget }) {
|
|
278
|
+
const titleId = useId();
|
|
279
|
+
const descriptionId = useId();
|
|
280
|
+
const portalRootRef = useRef(null);
|
|
281
|
+
if (!portalRootRef.current && "u" > typeof document) portalRootRef.current = officeOverlayPortalRoot(document, restoreFocusTarget?.());
|
|
282
|
+
const focusScope = useDialogFocusScope({
|
|
283
|
+
onEscape: onClose,
|
|
284
|
+
escapeDisabled: closeDisabled,
|
|
285
|
+
restoreFocusTarget
|
|
286
|
+
});
|
|
287
|
+
useEffect(()=>{
|
|
288
|
+
if (void 0 !== focusKey) focusScope.focusInitial();
|
|
289
|
+
}, [
|
|
290
|
+
focusKey,
|
|
291
|
+
focusScope.focusInitial
|
|
292
|
+
]);
|
|
293
|
+
const dialog = /*#__PURE__*/ jsx("dialog", {
|
|
294
|
+
open: true,
|
|
295
|
+
className: "ds-dialog-backdrop",
|
|
296
|
+
role: "presentation",
|
|
297
|
+
onCancel: (event)=>{
|
|
298
|
+
event.preventDefault();
|
|
299
|
+
if (!closeDisabled) onClose();
|
|
300
|
+
},
|
|
301
|
+
children: /*#__PURE__*/ jsxs("section", {
|
|
302
|
+
ref: focusScope.scopeRef,
|
|
303
|
+
className: `ds-dialog${className ? ` ${className}` : ''}`,
|
|
304
|
+
role: "dialog",
|
|
305
|
+
"aria-modal": "true",
|
|
306
|
+
"aria-labelledby": titleId,
|
|
307
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
308
|
+
onKeyDown: focusScope.handleKeyDown,
|
|
309
|
+
children: [
|
|
310
|
+
/*#__PURE__*/ jsxs("header", {
|
|
311
|
+
children: [
|
|
312
|
+
/*#__PURE__*/ jsxs("div", {
|
|
313
|
+
children: [
|
|
314
|
+
/*#__PURE__*/ jsx("h2", {
|
|
315
|
+
id: titleId,
|
|
316
|
+
children: title
|
|
317
|
+
}),
|
|
318
|
+
description && /*#__PURE__*/ jsx("p", {
|
|
319
|
+
id: descriptionId,
|
|
320
|
+
children: description
|
|
321
|
+
})
|
|
322
|
+
]
|
|
323
|
+
}),
|
|
324
|
+
/*#__PURE__*/ jsx(icon_button_IconButton, {
|
|
325
|
+
label: "关闭",
|
|
326
|
+
disabled: closeDisabled,
|
|
327
|
+
onClick: onClose,
|
|
328
|
+
children: /*#__PURE__*/ jsx(X, {
|
|
329
|
+
size: 16
|
|
330
|
+
})
|
|
331
|
+
})
|
|
332
|
+
]
|
|
333
|
+
}),
|
|
334
|
+
/*#__PURE__*/ jsx("div", {
|
|
335
|
+
className: "ds-dialog-body",
|
|
336
|
+
children: children
|
|
337
|
+
}),
|
|
338
|
+
footer && /*#__PURE__*/ jsx("footer", {
|
|
339
|
+
children: footer
|
|
340
|
+
})
|
|
341
|
+
]
|
|
342
|
+
})
|
|
343
|
+
});
|
|
344
|
+
return "u" > typeof document && portalRootRef.current ? /*#__PURE__*/ createPortal(dialog, portalRootRef.current) : dialog;
|
|
345
|
+
}
|
|
346
|
+
function OfficeSelect({ ariaLabel, value, options, onValueChange, disabled = false, placeholder = '请选择', className = '' }) {
|
|
347
|
+
const reactId = useId().replaceAll(':', '');
|
|
348
|
+
const [open, setOpen] = useState(false);
|
|
349
|
+
const selectedIndex = useMemo(()=>options.findIndex((option)=>option.value === value), [
|
|
350
|
+
options,
|
|
351
|
+
value
|
|
352
|
+
]);
|
|
353
|
+
const [activeIndex, setActiveIndex] = useState(Math.max(0, selectedIndex));
|
|
354
|
+
const selected = options[selectedIndex];
|
|
355
|
+
const openAt = (index)=>{
|
|
356
|
+
const next = nearestEnabledOption(options, index, 1);
|
|
357
|
+
setActiveIndex(next);
|
|
358
|
+
setOpen(true);
|
|
359
|
+
requestAnimationFrame(()=>document.getElementById(`${reactId}-option-${next}`)?.focus());
|
|
360
|
+
};
|
|
361
|
+
const selectOption = (index, close)=>{
|
|
362
|
+
const option = options[index];
|
|
363
|
+
if (!option || option.disabled) return;
|
|
364
|
+
close();
|
|
365
|
+
onValueChange(option.value);
|
|
366
|
+
};
|
|
367
|
+
const moveOptionFocus = (event, direction)=>{
|
|
368
|
+
event.preventDefault();
|
|
369
|
+
const next = nearestEnabledOption(options, activeIndex + direction, direction);
|
|
370
|
+
setActiveIndex(next);
|
|
371
|
+
document.getElementById(`${reactId}-option-${next}`)?.focus();
|
|
372
|
+
};
|
|
373
|
+
return /*#__PURE__*/ jsx(Popover, {
|
|
374
|
+
label: ariaLabel,
|
|
375
|
+
panelLabel: ariaLabel,
|
|
376
|
+
panelRole: "listbox",
|
|
377
|
+
portal: true,
|
|
378
|
+
className: `work-office-select${className ? ` ${className}` : ''}`,
|
|
379
|
+
panelClassName: "work-office-select-menu",
|
|
380
|
+
open: open,
|
|
381
|
+
disabled: disabled,
|
|
382
|
+
onOpenChange: setOpen,
|
|
383
|
+
trigger: (triggerProps, { open: popoverOpen })=>/*#__PURE__*/ jsxs("button", {
|
|
384
|
+
...triggerProps,
|
|
385
|
+
role: "combobox",
|
|
386
|
+
"aria-expanded": popoverOpen,
|
|
387
|
+
onClick: (event)=>{
|
|
388
|
+
if (!popoverOpen) {
|
|
389
|
+
const next = nearestEnabledOption(options, selectedIndex >= 0 ? selectedIndex : 0, 1);
|
|
390
|
+
setActiveIndex(next);
|
|
391
|
+
requestAnimationFrame(()=>document.getElementById(`${reactId}-option-${next}`)?.focus());
|
|
392
|
+
}
|
|
393
|
+
triggerProps.onClick(event);
|
|
394
|
+
},
|
|
395
|
+
onKeyDown: (event)=>{
|
|
396
|
+
if ('ArrowDown' === event.key) {
|
|
397
|
+
event.preventDefault();
|
|
398
|
+
openAt(selectedIndex >= 0 ? selectedIndex + 1 : 0);
|
|
399
|
+
} else if ('ArrowUp' === event.key) {
|
|
400
|
+
event.preventDefault();
|
|
401
|
+
openAt(selectedIndex >= 0 ? selectedIndex - 1 : options.length - 1);
|
|
402
|
+
} else if (isOfficeSelectSearchKey(event)) {
|
|
403
|
+
const next = matchingOptionIndex(options, event.key, selectedIndex >= 0 ? selectedIndex + 1 : 0);
|
|
404
|
+
if (next >= 0) {
|
|
405
|
+
event.preventDefault();
|
|
406
|
+
openAt(next);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
children: [
|
|
411
|
+
/*#__PURE__*/ jsx("span", {
|
|
412
|
+
style: selected?.previewStyle,
|
|
413
|
+
children: selected?.label ?? placeholder
|
|
414
|
+
}),
|
|
415
|
+
/*#__PURE__*/ jsx(ChevronDown, {
|
|
416
|
+
size: 13,
|
|
417
|
+
"aria-hidden": "true"
|
|
418
|
+
})
|
|
419
|
+
]
|
|
420
|
+
}),
|
|
421
|
+
children: (close)=>/*#__PURE__*/ jsx(jsx_runtime_Fragment, {
|
|
422
|
+
children: options.map((option, index)=>/*#__PURE__*/ jsxs(Fragment, {
|
|
423
|
+
children: [
|
|
424
|
+
option.group && options[index - 1]?.group !== option.group && /*#__PURE__*/ jsx("div", {
|
|
425
|
+
className: "work-office-select-group-label",
|
|
426
|
+
role: "presentation",
|
|
427
|
+
children: option.group
|
|
428
|
+
}),
|
|
429
|
+
/*#__PURE__*/ jsxs("button", {
|
|
430
|
+
type: "button",
|
|
431
|
+
role: "option",
|
|
432
|
+
id: `${reactId}-option-${index}`,
|
|
433
|
+
"aria-label": option.label,
|
|
434
|
+
"aria-selected": option.value === value,
|
|
435
|
+
disabled: option.disabled,
|
|
436
|
+
tabIndex: index === activeIndex ? 0 : -1,
|
|
437
|
+
onClick: ()=>selectOption(index, close),
|
|
438
|
+
onFocus: ()=>setActiveIndex(index),
|
|
439
|
+
onKeyDown: (event)=>{
|
|
440
|
+
if ('ArrowDown' === event.key) moveOptionFocus(event, 1);
|
|
441
|
+
else if ('ArrowUp' === event.key) moveOptionFocus(event, -1);
|
|
442
|
+
else if ('Home' === event.key) {
|
|
443
|
+
event.preventDefault();
|
|
444
|
+
const next = nearestEnabledOption(options, 0, 1);
|
|
445
|
+
setActiveIndex(next);
|
|
446
|
+
document.getElementById(`${reactId}-option-${next}`)?.focus();
|
|
447
|
+
} else if ('End' === event.key) {
|
|
448
|
+
event.preventDefault();
|
|
449
|
+
const next = nearestEnabledOption(options, options.length - 1, -1);
|
|
450
|
+
setActiveIndex(next);
|
|
451
|
+
document.getElementById(`${reactId}-option-${next}`)?.focus();
|
|
452
|
+
} else if ('Enter' === event.key || ' ' === event.key) {
|
|
453
|
+
event.preventDefault();
|
|
454
|
+
selectOption(index, close);
|
|
455
|
+
} else if (isOfficeSelectSearchKey(event)) {
|
|
456
|
+
const next = matchingOptionIndex(options, event.key, index + 1);
|
|
457
|
+
if (next >= 0) {
|
|
458
|
+
event.preventDefault();
|
|
459
|
+
setActiveIndex(next);
|
|
460
|
+
document.getElementById(`${reactId}-option-${next}`)?.focus();
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
children: [
|
|
465
|
+
/*#__PURE__*/ jsxs("span", {
|
|
466
|
+
className: "work-office-select-option-copy",
|
|
467
|
+
style: option.previewStyle,
|
|
468
|
+
children: [
|
|
469
|
+
/*#__PURE__*/ jsx("span", {
|
|
470
|
+
className: "work-office-select-option-label",
|
|
471
|
+
children: option.label
|
|
472
|
+
}),
|
|
473
|
+
option.meta && /*#__PURE__*/ jsx("small", {
|
|
474
|
+
children: option.meta
|
|
475
|
+
})
|
|
476
|
+
]
|
|
477
|
+
}),
|
|
478
|
+
option.value === value && /*#__PURE__*/ jsx(Check, {
|
|
479
|
+
size: 12,
|
|
480
|
+
"aria-hidden": "true"
|
|
481
|
+
})
|
|
482
|
+
]
|
|
483
|
+
})
|
|
484
|
+
]
|
|
485
|
+
}, option.value))
|
|
486
|
+
})
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
function isOfficeSelectSearchKey(event) {
|
|
490
|
+
return Boolean(!event.nativeEvent.isComposing && !event.altKey && !event.ctrlKey && !event.metaKey && 1 === event.key.length && event.key.trim());
|
|
491
|
+
}
|
|
492
|
+
function matchingOptionIndex(options, query, requestedIndex) {
|
|
493
|
+
const normalizedQuery = query.trim().toLocaleLowerCase();
|
|
494
|
+
if (!normalizedQuery || !options.length) return -1;
|
|
495
|
+
for(let offset = 0; offset < options.length; offset += 1){
|
|
496
|
+
const index = (requestedIndex + offset + options.length) % options.length;
|
|
497
|
+
const option = options[index];
|
|
498
|
+
if (option && !option.disabled && [
|
|
499
|
+
option.label,
|
|
500
|
+
option.searchText ?? ''
|
|
501
|
+
].join(' ').toLocaleLowerCase().split(/\s+/).some((term)=>term.startsWith(normalizedQuery))) return index;
|
|
502
|
+
}
|
|
503
|
+
return -1;
|
|
504
|
+
}
|
|
505
|
+
function nearestEnabledOption(options, requestedIndex, direction) {
|
|
506
|
+
if (0 === options.length) return 0;
|
|
507
|
+
for(let offset = 0; offset < options.length; offset += 1){
|
|
508
|
+
const index = (requestedIndex + offset * direction + 2 * options.length) % options.length;
|
|
509
|
+
if (!options[index]?.disabled) return index;
|
|
510
|
+
}
|
|
511
|
+
return 0;
|
|
512
|
+
}
|
|
513
|
+
function useTabNavigation({ items, onChange }) {
|
|
514
|
+
const elementRefs = useRef(new Map());
|
|
515
|
+
const setTabElement = useCallback((id, element)=>{
|
|
516
|
+
if (element) elementRefs.current.set(id, element);
|
|
517
|
+
else elementRefs.current.delete(id);
|
|
518
|
+
}, []);
|
|
519
|
+
const getTabElement = useCallback((id)=>elementRefs.current.get(id), []);
|
|
520
|
+
const handleTabKeyDown = useCallback((event, currentId)=>{
|
|
521
|
+
const enabledItems = items.filter((item)=>!item.disabled);
|
|
522
|
+
if (!enabledItems.length) return;
|
|
523
|
+
const currentIndex = enabledItems.findIndex((item)=>item.id === currentId);
|
|
524
|
+
if (currentIndex < 0) return;
|
|
525
|
+
let nextIndex = null;
|
|
526
|
+
if ('ArrowRight' === event.key) nextIndex = (currentIndex + 1) % enabledItems.length;
|
|
527
|
+
if ('ArrowLeft' === event.key) nextIndex = (currentIndex - 1 + enabledItems.length) % enabledItems.length;
|
|
528
|
+
if ('Home' === event.key) nextIndex = 0;
|
|
529
|
+
if ('End' === event.key) nextIndex = enabledItems.length - 1;
|
|
530
|
+
if (null === nextIndex) return;
|
|
531
|
+
event.preventDefault();
|
|
532
|
+
const nextItem = enabledItems[nextIndex];
|
|
533
|
+
elementRefs.current.get(nextItem.id)?.focus();
|
|
534
|
+
onChange(nextItem.id);
|
|
535
|
+
}, [
|
|
536
|
+
items,
|
|
537
|
+
onChange
|
|
538
|
+
]);
|
|
539
|
+
return {
|
|
540
|
+
getTabElement,
|
|
541
|
+
handleTabKeyDown,
|
|
542
|
+
setTabElement
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
function Tabs({ ariaLabel, value, items, onChange, variant = 'segment', size = 'standard', className = '', containerRef }) {
|
|
546
|
+
const tabNavigation = useTabNavigation({
|
|
547
|
+
items,
|
|
548
|
+
onChange
|
|
549
|
+
});
|
|
550
|
+
return /*#__PURE__*/ jsx("div", {
|
|
551
|
+
ref: containerRef,
|
|
552
|
+
className: `ds-tabs ${variant} ${size}${className ? ` ${className}` : ''}`,
|
|
553
|
+
role: "tablist",
|
|
554
|
+
"aria-label": ariaLabel,
|
|
555
|
+
children: items.map((item)=>{
|
|
556
|
+
const selected = item.id === value;
|
|
557
|
+
return /*#__PURE__*/ jsxs("button", {
|
|
558
|
+
ref: (element)=>{
|
|
559
|
+
tabNavigation.setTabElement(item.id, element);
|
|
560
|
+
},
|
|
561
|
+
type: "button",
|
|
562
|
+
role: "tab",
|
|
563
|
+
id: item.tabId,
|
|
564
|
+
"data-tab-id": item.id,
|
|
565
|
+
"aria-label": item.label,
|
|
566
|
+
"aria-selected": selected,
|
|
567
|
+
"aria-controls": item.panelId,
|
|
568
|
+
tabIndex: selected ? 0 : -1,
|
|
569
|
+
disabled: item.disabled,
|
|
570
|
+
onClick: ()=>onChange(item.id),
|
|
571
|
+
onKeyDown: (event)=>tabNavigation.handleTabKeyDown(event, item.id),
|
|
572
|
+
children: [
|
|
573
|
+
item.icon && /*#__PURE__*/ jsx("span", {
|
|
574
|
+
className: "ds-tabs-icon",
|
|
575
|
+
"aria-hidden": "true",
|
|
576
|
+
children: item.icon
|
|
577
|
+
}),
|
|
578
|
+
/*#__PURE__*/ jsx("span", {
|
|
579
|
+
className: `ds-tabs-label${item.compactLabel ? ' has-compact' : ''}`,
|
|
580
|
+
children: item.label
|
|
581
|
+
}),
|
|
582
|
+
item.compactLabel && /*#__PURE__*/ jsx("span", {
|
|
583
|
+
className: "ds-tabs-label-compact",
|
|
584
|
+
"aria-hidden": "true",
|
|
585
|
+
children: item.compactLabel
|
|
586
|
+
}),
|
|
587
|
+
void 0 !== item.badge && /*#__PURE__*/ jsxs(jsx_runtime_Fragment, {
|
|
588
|
+
children: [
|
|
589
|
+
' ',
|
|
590
|
+
/*#__PURE__*/ jsx("span", {
|
|
591
|
+
className: "ds-tabs-badge",
|
|
592
|
+
children: item.badge
|
|
593
|
+
})
|
|
594
|
+
]
|
|
595
|
+
})
|
|
596
|
+
]
|
|
597
|
+
}, item.id);
|
|
598
|
+
})
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
function OfficeSlider({ ariaLabel, value, min, max, step = 1, onValueChange, disabled = false, className = '' }) {
|
|
602
|
+
const trackRef = useRef(null);
|
|
603
|
+
const percentage = max === min ? 0 : (value - min) / (max - min) * 100;
|
|
604
|
+
const commit = (next)=>onValueChange(roundSliderValue(Math.min(max, Math.max(min, next)), step));
|
|
605
|
+
const commitPointer = (event)=>{
|
|
606
|
+
if (disabled) return;
|
|
607
|
+
const bounds = trackRef.current?.getBoundingClientRect();
|
|
608
|
+
if (!bounds || 0 === bounds.width) return;
|
|
609
|
+
commit(min + (event.clientX - bounds.left) / bounds.width * (max - min));
|
|
610
|
+
};
|
|
611
|
+
const handleKey = (event)=>{
|
|
612
|
+
if (disabled) return;
|
|
613
|
+
if ('ArrowRight' === event.key || 'ArrowUp' === event.key) {
|
|
614
|
+
event.preventDefault();
|
|
615
|
+
commit(value + step);
|
|
616
|
+
} else if ('ArrowLeft' === event.key || 'ArrowDown' === event.key) {
|
|
617
|
+
event.preventDefault();
|
|
618
|
+
commit(value - step);
|
|
619
|
+
} else if ('Home' === event.key) {
|
|
620
|
+
event.preventDefault();
|
|
621
|
+
commit(min);
|
|
622
|
+
} else if ('End' === event.key) {
|
|
623
|
+
event.preventDefault();
|
|
624
|
+
commit(max);
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
628
|
+
ref: trackRef,
|
|
629
|
+
className: `work-office-slider ${disabled ? 'disabled' : ''} ${className}`.trim(),
|
|
630
|
+
role: "slider",
|
|
631
|
+
tabIndex: disabled ? -1 : 0,
|
|
632
|
+
"aria-label": ariaLabel,
|
|
633
|
+
"aria-valuemin": min,
|
|
634
|
+
"aria-valuemax": max,
|
|
635
|
+
"aria-valuenow": value,
|
|
636
|
+
"aria-disabled": disabled || void 0,
|
|
637
|
+
onKeyDown: handleKey,
|
|
638
|
+
onPointerDown: (event)=>{
|
|
639
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
640
|
+
commitPointer(event);
|
|
641
|
+
},
|
|
642
|
+
onPointerMove: (event)=>{
|
|
643
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) commitPointer(event);
|
|
644
|
+
},
|
|
645
|
+
children: [
|
|
646
|
+
/*#__PURE__*/ jsx("span", {
|
|
647
|
+
className: "work-office-slider-fill",
|
|
648
|
+
style: {
|
|
649
|
+
width: `${Math.min(100, Math.max(0, percentage))}%`
|
|
650
|
+
}
|
|
651
|
+
}),
|
|
652
|
+
/*#__PURE__*/ jsx("span", {
|
|
653
|
+
className: "work-office-slider-thumb",
|
|
654
|
+
style: {
|
|
655
|
+
left: `${Math.min(100, Math.max(0, percentage))}%`
|
|
656
|
+
}
|
|
657
|
+
})
|
|
658
|
+
]
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
function roundSliderValue(value, step) {
|
|
662
|
+
const decimalPlaces = Math.max(0, (String(step).split('.')[1] ?? '').length);
|
|
663
|
+
return Number((Math.round(value / step) * step).toFixed(decimalPlaces));
|
|
664
|
+
}
|
|
665
|
+
const WORK_OFFICE_RIBBON_SCROLL_INSET = 34;
|
|
666
|
+
function calculateRibbonOverflow({ clientWidth, items, scrollLeft }) {
|
|
667
|
+
const lastItem = items.at(-1);
|
|
668
|
+
if (!lastItem || clientWidth <= 0) return {
|
|
669
|
+
backward: false,
|
|
670
|
+
forward: false
|
|
671
|
+
};
|
|
672
|
+
if (lastItem.right <= clientWidth - 2) return {
|
|
673
|
+
backward: false,
|
|
674
|
+
forward: false
|
|
675
|
+
};
|
|
676
|
+
return {
|
|
677
|
+
backward: scrollLeft > 2,
|
|
678
|
+
forward: lastItem.right > scrollLeft + clientWidth - 2
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
function calculateRibbonScrollTarget({ clientWidth, direction, items, scrollLeft }) {
|
|
682
|
+
if (!items.length || clientWidth <= 0) return scrollLeft;
|
|
683
|
+
if ((items.at(-1)?.right ?? 0) <= clientWidth - 2) return 0;
|
|
684
|
+
const visibleLeft = scrollLeft + WORK_OFFICE_RIBBON_SCROLL_INSET;
|
|
685
|
+
const visibleRight = scrollLeft + clientWidth - WORK_OFFICE_RIBBON_SCROLL_INSET;
|
|
686
|
+
const target = 1 === direction ? items.find((item)=>item.left > visibleLeft + 2 && item.right > visibleRight + 2) : [
|
|
687
|
+
...items
|
|
688
|
+
].reverse().find((item)=>item.left < visibleLeft - 2);
|
|
689
|
+
if (!target) return scrollLeft;
|
|
690
|
+
return Math.max(0, target.left - WORK_OFFICE_RIBBON_SCROLL_INSET);
|
|
691
|
+
}
|
|
692
|
+
function WorkOfficeRibbon({ ariaLabel, tabs, defaultTab, activeTab, onTabChange, panels, fileActions, className = '', toolbarClassName = '' }) {
|
|
693
|
+
const reactId = useId().replaceAll(':', '');
|
|
694
|
+
const [internalTab, setInternalTab] = useState(defaultTab);
|
|
695
|
+
const [ribbonOverflow, setRibbonOverflow] = useState({
|
|
696
|
+
backward: false,
|
|
697
|
+
forward: false
|
|
698
|
+
});
|
|
699
|
+
const [tabOverflow, setTabOverflow] = useState({
|
|
700
|
+
backward: false,
|
|
701
|
+
forward: false
|
|
702
|
+
});
|
|
703
|
+
const tabListRef = useRef(null);
|
|
704
|
+
const toolbarRef = useRef(null);
|
|
705
|
+
const selectedTab = activeTab ?? internalTab;
|
|
706
|
+
const selectedLabel = tabs.find((tab)=>tab.id === selectedTab)?.label ?? tabs[0]?.label ?? '';
|
|
707
|
+
const selectedPanel = panels[selectedTab];
|
|
708
|
+
const hasSelectedPanel = null != selectedPanel;
|
|
709
|
+
const updateRibbonOverflow = useCallback(()=>{
|
|
710
|
+
const toolbar = toolbarRef.current;
|
|
711
|
+
if (!toolbar) return;
|
|
712
|
+
const { backward, forward } = calculateRibbonOverflow({
|
|
713
|
+
clientWidth: toolbar.clientWidth,
|
|
714
|
+
items: ribbonItemGeometry(toolbar),
|
|
715
|
+
scrollLeft: toolbar.scrollLeft
|
|
716
|
+
});
|
|
717
|
+
if (!backward && !forward && toolbar.scrollLeft > 0) toolbar.scrollLeft = 0;
|
|
718
|
+
setRibbonOverflow((current)=>current.backward === backward && current.forward === forward ? current : {
|
|
719
|
+
backward,
|
|
720
|
+
forward
|
|
721
|
+
});
|
|
722
|
+
}, []);
|
|
723
|
+
const scrollRibbon = (direction)=>{
|
|
724
|
+
const toolbar = toolbarRef.current;
|
|
725
|
+
if (!toolbar) return;
|
|
726
|
+
toolbar.scrollLeft = calculateRibbonScrollTarget({
|
|
727
|
+
clientWidth: toolbar.clientWidth,
|
|
728
|
+
direction,
|
|
729
|
+
items: ribbonItemGeometry(toolbar),
|
|
730
|
+
scrollLeft: toolbar.scrollLeft
|
|
731
|
+
});
|
|
732
|
+
updateRibbonOverflow();
|
|
733
|
+
};
|
|
734
|
+
const updateTabOverflow = useCallback(()=>{
|
|
735
|
+
const tabList = tabListRef.current;
|
|
736
|
+
if (!tabList) return;
|
|
737
|
+
const { backward, forward } = calculateRibbonOverflow({
|
|
738
|
+
clientWidth: tabList.clientWidth,
|
|
739
|
+
items: ribbonItemGeometry(tabList),
|
|
740
|
+
scrollLeft: tabList.scrollLeft
|
|
741
|
+
});
|
|
742
|
+
if (!backward && !forward && tabList.scrollLeft > 0) tabList.scrollLeft = 0;
|
|
743
|
+
setTabOverflow((current)=>current.backward === backward && current.forward === forward ? current : {
|
|
744
|
+
backward,
|
|
745
|
+
forward
|
|
746
|
+
});
|
|
747
|
+
}, []);
|
|
748
|
+
const scrollTabs = (direction)=>{
|
|
749
|
+
const tabList = tabListRef.current;
|
|
750
|
+
if (!tabList) return;
|
|
751
|
+
tabList.scrollLeft = calculateRibbonScrollTarget({
|
|
752
|
+
clientWidth: tabList.clientWidth,
|
|
753
|
+
direction,
|
|
754
|
+
items: ribbonItemGeometry(tabList),
|
|
755
|
+
scrollLeft: tabList.scrollLeft
|
|
756
|
+
});
|
|
757
|
+
updateTabOverflow();
|
|
758
|
+
};
|
|
759
|
+
const selectTab = (tab)=>{
|
|
760
|
+
if (void 0 === activeTab) setInternalTab(tab);
|
|
761
|
+
onTabChange?.(tab);
|
|
762
|
+
};
|
|
763
|
+
useLayoutEffect(()=>{
|
|
764
|
+
const toolbar = toolbarRef.current;
|
|
765
|
+
if (!toolbar) return;
|
|
766
|
+
toolbar.scrollLeft = 0;
|
|
767
|
+
updateRibbonOverflow();
|
|
768
|
+
}, [
|
|
769
|
+
selectedTab,
|
|
770
|
+
hasSelectedPanel,
|
|
771
|
+
updateRibbonOverflow
|
|
772
|
+
]);
|
|
773
|
+
useLayoutEffect(()=>{
|
|
774
|
+
const toolbar = toolbarRef.current;
|
|
775
|
+
if (!toolbar) return;
|
|
776
|
+
let frame = requestAnimationFrame(updateRibbonOverflow);
|
|
777
|
+
const scheduleOverflowUpdate = ()=>{
|
|
778
|
+
cancelAnimationFrame(frame);
|
|
779
|
+
frame = requestAnimationFrame(updateRibbonOverflow);
|
|
780
|
+
};
|
|
781
|
+
const resizeObserver = "u" < typeof ResizeObserver ? null : new ResizeObserver(scheduleOverflowUpdate);
|
|
782
|
+
const observeChild = (node)=>{
|
|
783
|
+
if (node instanceof Element) resizeObserver?.observe(node);
|
|
784
|
+
};
|
|
785
|
+
resizeObserver?.observe(toolbar);
|
|
786
|
+
for (const child of toolbar.children)observeChild(child);
|
|
787
|
+
const mutationObserver = "u" < typeof MutationObserver ? null : new MutationObserver((records)=>{
|
|
788
|
+
for (const record of records)for (const node of record.addedNodes)observeChild(node);
|
|
789
|
+
scheduleOverflowUpdate();
|
|
790
|
+
});
|
|
791
|
+
mutationObserver?.observe(toolbar, {
|
|
792
|
+
attributes: true,
|
|
793
|
+
characterData: true,
|
|
794
|
+
childList: true,
|
|
795
|
+
subtree: true
|
|
796
|
+
});
|
|
797
|
+
window.addEventListener('resize', scheduleOverflowUpdate);
|
|
798
|
+
return ()=>{
|
|
799
|
+
cancelAnimationFrame(frame);
|
|
800
|
+
resizeObserver?.disconnect();
|
|
801
|
+
mutationObserver?.disconnect();
|
|
802
|
+
window.removeEventListener('resize', scheduleOverflowUpdate);
|
|
803
|
+
};
|
|
804
|
+
}, [
|
|
805
|
+
hasSelectedPanel,
|
|
806
|
+
updateRibbonOverflow
|
|
807
|
+
]);
|
|
808
|
+
useLayoutEffect(()=>{
|
|
809
|
+
const tabList = tabListRef.current;
|
|
810
|
+
if (!tabList) return;
|
|
811
|
+
let frame = requestAnimationFrame(()=>{
|
|
812
|
+
scrollSelectedRibbonTabIntoView(tabList, selectedTab);
|
|
813
|
+
updateTabOverflow();
|
|
814
|
+
});
|
|
815
|
+
const scheduleOverflowUpdate = ()=>{
|
|
816
|
+
cancelAnimationFrame(frame);
|
|
817
|
+
frame = requestAnimationFrame(updateTabOverflow);
|
|
818
|
+
};
|
|
819
|
+
const resizeObserver = "u" < typeof ResizeObserver ? null : new ResizeObserver(scheduleOverflowUpdate);
|
|
820
|
+
const observeChild = (node)=>{
|
|
821
|
+
if (node instanceof Element) resizeObserver?.observe(node);
|
|
822
|
+
};
|
|
823
|
+
resizeObserver?.observe(tabList);
|
|
824
|
+
for (const child of tabList.children)observeChild(child);
|
|
825
|
+
const mutationObserver = "u" < typeof MutationObserver ? null : new MutationObserver((records)=>{
|
|
826
|
+
for (const record of records)for (const node of record.addedNodes)observeChild(node);
|
|
827
|
+
scheduleOverflowUpdate();
|
|
828
|
+
});
|
|
829
|
+
mutationObserver?.observe(tabList, {
|
|
830
|
+
attributes: true,
|
|
831
|
+
characterData: true,
|
|
832
|
+
childList: true,
|
|
833
|
+
subtree: true
|
|
834
|
+
});
|
|
835
|
+
tabList.addEventListener('scroll', updateTabOverflow);
|
|
836
|
+
window.addEventListener('resize', scheduleOverflowUpdate);
|
|
837
|
+
return ()=>{
|
|
838
|
+
cancelAnimationFrame(frame);
|
|
839
|
+
resizeObserver?.disconnect();
|
|
840
|
+
mutationObserver?.disconnect();
|
|
841
|
+
tabList.removeEventListener('scroll', updateTabOverflow);
|
|
842
|
+
window.removeEventListener('resize', scheduleOverflowUpdate);
|
|
843
|
+
};
|
|
844
|
+
}, [
|
|
845
|
+
selectedTab,
|
|
846
|
+
tabs,
|
|
847
|
+
updateTabOverflow
|
|
848
|
+
]);
|
|
849
|
+
return /*#__PURE__*/ jsxs("section", {
|
|
850
|
+
className: `work-office-ribbon ${className}`.trim(),
|
|
851
|
+
"aria-label": ariaLabel,
|
|
852
|
+
children: [
|
|
853
|
+
/*#__PURE__*/ jsxs("div", {
|
|
854
|
+
className: "work-office-ribbon-tabs-row",
|
|
855
|
+
children: [
|
|
856
|
+
fileActions?.length ? /*#__PURE__*/ jsx(WorkOfficeFileMenu, {
|
|
857
|
+
actions: fileActions
|
|
858
|
+
}) : null,
|
|
859
|
+
/*#__PURE__*/ jsxs("div", {
|
|
860
|
+
className: "work-office-ribbon-tab-strip",
|
|
861
|
+
children: [
|
|
862
|
+
/*#__PURE__*/ jsx(Tabs, {
|
|
863
|
+
ariaLabel: ariaLabel,
|
|
864
|
+
value: selectedTab,
|
|
865
|
+
variant: "line",
|
|
866
|
+
size: "compact",
|
|
867
|
+
className: "work-office-ribbon-tabs",
|
|
868
|
+
containerRef: tabListRef,
|
|
869
|
+
items: tabs.map((tab)=>({
|
|
870
|
+
...tab,
|
|
871
|
+
tabId: `${reactId}-tab-${tab.id}`,
|
|
872
|
+
panelId: `${reactId}-panel`
|
|
873
|
+
})),
|
|
874
|
+
onChange: selectTab
|
|
875
|
+
}),
|
|
876
|
+
(tabOverflow.backward || tabOverflow.forward) && /*#__PURE__*/ jsxs("nav", {
|
|
877
|
+
className: "work-office-ribbon-tab-navigation",
|
|
878
|
+
"aria-label": "功能区标签翻页",
|
|
879
|
+
children: [
|
|
880
|
+
/*#__PURE__*/ jsx("button", {
|
|
881
|
+
type: "button",
|
|
882
|
+
"aria-label": "向左查看更多功能区标签",
|
|
883
|
+
disabled: !tabOverflow.backward,
|
|
884
|
+
onClick: ()=>scrollTabs(-1),
|
|
885
|
+
children: /*#__PURE__*/ jsx(ChevronLeft, {
|
|
886
|
+
size: 14
|
|
887
|
+
})
|
|
888
|
+
}),
|
|
889
|
+
/*#__PURE__*/ jsx("button", {
|
|
890
|
+
type: "button",
|
|
891
|
+
"aria-label": "向右查看更多功能区标签",
|
|
892
|
+
disabled: !tabOverflow.forward,
|
|
893
|
+
onClick: ()=>scrollTabs(1),
|
|
894
|
+
children: /*#__PURE__*/ jsx(ChevronRight, {
|
|
895
|
+
size: 14
|
|
896
|
+
})
|
|
897
|
+
})
|
|
898
|
+
]
|
|
899
|
+
})
|
|
900
|
+
]
|
|
901
|
+
})
|
|
902
|
+
]
|
|
903
|
+
}),
|
|
904
|
+
/*#__PURE__*/ jsx("div", {
|
|
905
|
+
id: `${reactId}-panel`,
|
|
906
|
+
className: "work-office-ribbon-panel",
|
|
907
|
+
"data-empty": hasSelectedPanel ? void 0 : 'true',
|
|
908
|
+
role: "tabpanel",
|
|
909
|
+
"aria-labelledby": `${reactId}-tab-${selectedTab}`,
|
|
910
|
+
children: hasSelectedPanel && /*#__PURE__*/ jsxs(jsx_runtime_Fragment, {
|
|
911
|
+
children: [
|
|
912
|
+
ribbonOverflow.backward && /*#__PURE__*/ jsx("button", {
|
|
913
|
+
type: "button",
|
|
914
|
+
className: "work-office-ribbon-scroll previous",
|
|
915
|
+
"aria-label": `向左查看更多${selectedLabel}工具`,
|
|
916
|
+
onClick: ()=>scrollRibbon(-1),
|
|
917
|
+
children: /*#__PURE__*/ jsx(ChevronLeft, {
|
|
918
|
+
size: 15
|
|
919
|
+
})
|
|
920
|
+
}),
|
|
921
|
+
/*#__PURE__*/ jsx("div", {
|
|
922
|
+
ref: toolbarRef,
|
|
923
|
+
className: `work-office-toolbar ${toolbarClassName}`.trim(),
|
|
924
|
+
"data-has-overflow": ribbonOverflow.backward || ribbonOverflow.forward ? 'true' : void 0,
|
|
925
|
+
role: "toolbar",
|
|
926
|
+
"aria-label": `${selectedLabel}工具栏`,
|
|
927
|
+
onScroll: updateRibbonOverflow,
|
|
928
|
+
children: selectedPanel
|
|
929
|
+
}),
|
|
930
|
+
ribbonOverflow.forward && /*#__PURE__*/ jsx("button", {
|
|
931
|
+
type: "button",
|
|
932
|
+
className: "work-office-ribbon-scroll next",
|
|
933
|
+
"aria-label": `向右查看更多${selectedLabel}工具`,
|
|
934
|
+
onClick: ()=>scrollRibbon(1),
|
|
935
|
+
children: /*#__PURE__*/ jsx(ChevronRight, {
|
|
936
|
+
size: 15
|
|
937
|
+
})
|
|
938
|
+
})
|
|
939
|
+
]
|
|
940
|
+
})
|
|
941
|
+
})
|
|
942
|
+
]
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
function ribbonItemGeometry(toolbar) {
|
|
946
|
+
return Array.from(toolbar.children).flatMap((element)=>element instanceof HTMLElement ? [
|
|
947
|
+
{
|
|
948
|
+
left: element.offsetLeft,
|
|
949
|
+
right: element.offsetLeft + element.offsetWidth
|
|
950
|
+
}
|
|
951
|
+
] : []);
|
|
952
|
+
}
|
|
953
|
+
function scrollSelectedRibbonTabIntoView(tabList, selectedTab) {
|
|
954
|
+
const selected = Array.from(tabList.children).find((element)=>element instanceof HTMLElement && element.dataset.tabId === selectedTab);
|
|
955
|
+
if (!selected || tabList.clientWidth <= 0) return;
|
|
956
|
+
const inset = 8;
|
|
957
|
+
const visibleLeft = tabList.scrollLeft + inset;
|
|
958
|
+
const visibleRight = tabList.scrollLeft + tabList.clientWidth - inset;
|
|
959
|
+
const selectedLeft = selected.offsetLeft;
|
|
960
|
+
const selectedRight = selectedLeft + selected.offsetWidth;
|
|
961
|
+
if (selectedLeft < visibleLeft) tabList.scrollLeft = Math.max(0, selectedLeft - inset);
|
|
962
|
+
else if (selectedRight > visibleRight) tabList.scrollLeft = Math.max(0, selectedRight - tabList.clientWidth + inset);
|
|
963
|
+
}
|
|
964
|
+
function WorkOfficePreviewBar({ ariaLabel, label, detail, fileActions, className = '' }) {
|
|
965
|
+
return /*#__PURE__*/ jsxs("section", {
|
|
966
|
+
className: `work-office-preview-bar ${className}`.trim(),
|
|
967
|
+
"aria-label": ariaLabel,
|
|
968
|
+
children: [
|
|
969
|
+
fileActions?.length ? /*#__PURE__*/ jsx(WorkOfficeFileMenu, {
|
|
970
|
+
actions: fileActions
|
|
971
|
+
}) : null,
|
|
972
|
+
/*#__PURE__*/ jsxs("div", {
|
|
973
|
+
className: "work-office-preview-summary",
|
|
974
|
+
children: [
|
|
975
|
+
/*#__PURE__*/ jsx(Eye, {
|
|
976
|
+
size: 14,
|
|
977
|
+
"aria-hidden": "true"
|
|
978
|
+
}),
|
|
979
|
+
/*#__PURE__*/ jsx("strong", {
|
|
980
|
+
children: label
|
|
981
|
+
}),
|
|
982
|
+
detail && /*#__PURE__*/ jsx("span", {
|
|
983
|
+
children: detail
|
|
984
|
+
})
|
|
985
|
+
]
|
|
986
|
+
})
|
|
987
|
+
]
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
function WorkOfficeFileMenu({ actions }) {
|
|
991
|
+
const [open, setOpen] = useState(false);
|
|
992
|
+
const menuRef = useRef(null);
|
|
993
|
+
const focusEdgeRef = useRef('first');
|
|
994
|
+
const focusRequestedAction = ()=>requestAnimationFrame(()=>{
|
|
995
|
+
const buttons = [
|
|
996
|
+
...menuRef.current?.querySelectorAll('button:not(:disabled)') ?? []
|
|
997
|
+
];
|
|
998
|
+
const button = 'last' === focusEdgeRef.current ? buttons.at(-1) : buttons[0];
|
|
999
|
+
button?.focus();
|
|
1000
|
+
});
|
|
1001
|
+
return /*#__PURE__*/ jsx(Popover, {
|
|
1002
|
+
label: "文件",
|
|
1003
|
+
panelLabel: "文件菜单",
|
|
1004
|
+
panelRole: "menu",
|
|
1005
|
+
portal: true,
|
|
1006
|
+
className: "work-office-file-menu",
|
|
1007
|
+
panelClassName: "work-office-file-popover",
|
|
1008
|
+
open: open,
|
|
1009
|
+
panelRef: menuRef,
|
|
1010
|
+
onPanelKeyDown: moveOfficeMenuFocus,
|
|
1011
|
+
onOpenChange: (nextOpen)=>{
|
|
1012
|
+
setOpen(nextOpen);
|
|
1013
|
+
if (nextOpen) focusRequestedAction();
|
|
1014
|
+
},
|
|
1015
|
+
trigger: (triggerProps, { open })=>/*#__PURE__*/ jsxs("button", {
|
|
1016
|
+
...triggerProps,
|
|
1017
|
+
className: "work-office-file-trigger",
|
|
1018
|
+
onKeyDown: (event)=>{
|
|
1019
|
+
if ('ArrowDown' !== event.key && 'ArrowUp' !== event.key) return;
|
|
1020
|
+
event.preventDefault();
|
|
1021
|
+
focusEdgeRef.current = 'ArrowUp' === event.key ? 'last' : 'first';
|
|
1022
|
+
if (open) focusRequestedAction();
|
|
1023
|
+
else event.currentTarget.click();
|
|
1024
|
+
},
|
|
1025
|
+
children: [
|
|
1026
|
+
/*#__PURE__*/ jsx("span", {
|
|
1027
|
+
children: "文件"
|
|
1028
|
+
}),
|
|
1029
|
+
/*#__PURE__*/ jsx(ChevronDown, {
|
|
1030
|
+
size: 12,
|
|
1031
|
+
"aria-hidden": "true"
|
|
1032
|
+
})
|
|
1033
|
+
]
|
|
1034
|
+
}),
|
|
1035
|
+
children: (close)=>/*#__PURE__*/ jsx(jsx_runtime_Fragment, {
|
|
1036
|
+
children: actions.map((action)=>/*#__PURE__*/ jsxs(Fragment, {
|
|
1037
|
+
children: [
|
|
1038
|
+
action.separatorBefore && /*#__PURE__*/ jsx("hr", {
|
|
1039
|
+
className: "work-office-file-separator"
|
|
1040
|
+
}),
|
|
1041
|
+
/*#__PURE__*/ jsxs("button", {
|
|
1042
|
+
type: "button",
|
|
1043
|
+
role: "menuitem",
|
|
1044
|
+
tabIndex: -1,
|
|
1045
|
+
disabled: action.disabled,
|
|
1046
|
+
onClick: ()=>{
|
|
1047
|
+
close();
|
|
1048
|
+
action.onSelect();
|
|
1049
|
+
},
|
|
1050
|
+
children: [
|
|
1051
|
+
/*#__PURE__*/ jsx("span", {
|
|
1052
|
+
className: "work-office-file-action-icon",
|
|
1053
|
+
"aria-hidden": "true",
|
|
1054
|
+
children: action.icon
|
|
1055
|
+
}),
|
|
1056
|
+
/*#__PURE__*/ jsx("span", {
|
|
1057
|
+
children: action.label
|
|
1058
|
+
}),
|
|
1059
|
+
action.shortcut && /*#__PURE__*/ jsx("kbd", {
|
|
1060
|
+
children: action.shortcut
|
|
1061
|
+
})
|
|
1062
|
+
]
|
|
1063
|
+
})
|
|
1064
|
+
]
|
|
1065
|
+
}, action.id))
|
|
1066
|
+
})
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
function WorkOfficeRibbonGroup({ label, children }) {
|
|
1070
|
+
return /*#__PURE__*/ jsxs("section", {
|
|
1071
|
+
className: "work-office-ribbon-group",
|
|
1072
|
+
"aria-label": label,
|
|
1073
|
+
children: [
|
|
1074
|
+
/*#__PURE__*/ jsx("div", {
|
|
1075
|
+
children: children
|
|
1076
|
+
}),
|
|
1077
|
+
/*#__PURE__*/ jsx("span", {
|
|
1078
|
+
"aria-hidden": "true",
|
|
1079
|
+
children: label
|
|
1080
|
+
})
|
|
1081
|
+
]
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
function WorkOfficeRibbonButton({ label, visibleLabel = label, badge, active, displayLabel = true, className = '', title = label, children, ...props }) {
|
|
1085
|
+
return /*#__PURE__*/ jsxs("button", {
|
|
1086
|
+
type: "button",
|
|
1087
|
+
"aria-label": label,
|
|
1088
|
+
"aria-pressed": active,
|
|
1089
|
+
title: title,
|
|
1090
|
+
className: `${displayLabel ? 'with-label' : ''} ${active ? 'active' : ''} ${className}`.trim(),
|
|
1091
|
+
...props,
|
|
1092
|
+
children: [
|
|
1093
|
+
children,
|
|
1094
|
+
displayLabel && /*#__PURE__*/ jsx("span", {
|
|
1095
|
+
children: visibleLabel
|
|
1096
|
+
}),
|
|
1097
|
+
void 0 !== badge && /*#__PURE__*/ jsx("small", {
|
|
1098
|
+
className: "work-office-ribbon-badge",
|
|
1099
|
+
children: badge
|
|
1100
|
+
})
|
|
1101
|
+
]
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
function WorkOfficeStatusBar({ children, controls, className = '' }) {
|
|
1105
|
+
return /*#__PURE__*/ jsxs("footer", {
|
|
1106
|
+
className: `work-office-status ${className}`.trim(),
|
|
1107
|
+
children: [
|
|
1108
|
+
/*#__PURE__*/ jsx("div", {
|
|
1109
|
+
className: "work-office-status-info",
|
|
1110
|
+
children: children
|
|
1111
|
+
}),
|
|
1112
|
+
controls && /*#__PURE__*/ jsx("div", {
|
|
1113
|
+
className: "work-office-status-view",
|
|
1114
|
+
children: controls
|
|
1115
|
+
})
|
|
1116
|
+
]
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
function WorkOfficeZoomControls({ zoom, minimum = 50, maximum = 200, step = 10, decreaseLabel, increaseLabel, outputLabel, sliderLabel, onChange }) {
|
|
1120
|
+
const clamp = (value)=>Math.min(maximum, Math.max(minimum, Math.round(value)));
|
|
1121
|
+
return /*#__PURE__*/ jsxs(jsx_runtime_Fragment, {
|
|
1122
|
+
children: [
|
|
1123
|
+
/*#__PURE__*/ jsx("button", {
|
|
1124
|
+
type: "button",
|
|
1125
|
+
"aria-label": decreaseLabel,
|
|
1126
|
+
title: decreaseLabel,
|
|
1127
|
+
disabled: zoom <= minimum,
|
|
1128
|
+
onClick: ()=>onChange(clamp(zoom - step)),
|
|
1129
|
+
children: /*#__PURE__*/ jsx(Minus, {
|
|
1130
|
+
size: 13
|
|
1131
|
+
})
|
|
1132
|
+
}),
|
|
1133
|
+
/*#__PURE__*/ jsxs("output", {
|
|
1134
|
+
"aria-label": outputLabel,
|
|
1135
|
+
children: [
|
|
1136
|
+
zoom,
|
|
1137
|
+
"%"
|
|
1138
|
+
]
|
|
1139
|
+
}),
|
|
1140
|
+
/*#__PURE__*/ jsx(OfficeSlider, {
|
|
1141
|
+
className: "work-office-status-slider",
|
|
1142
|
+
ariaLabel: sliderLabel,
|
|
1143
|
+
min: minimum,
|
|
1144
|
+
max: maximum,
|
|
1145
|
+
step: step,
|
|
1146
|
+
value: zoom,
|
|
1147
|
+
onValueChange: (value)=>onChange(clamp(value))
|
|
1148
|
+
}),
|
|
1149
|
+
/*#__PURE__*/ jsx("button", {
|
|
1150
|
+
type: "button",
|
|
1151
|
+
"aria-label": increaseLabel,
|
|
1152
|
+
title: increaseLabel,
|
|
1153
|
+
disabled: zoom >= maximum,
|
|
1154
|
+
onClick: ()=>onChange(clamp(zoom + step)),
|
|
1155
|
+
children: /*#__PURE__*/ jsx(Plus, {
|
|
1156
|
+
size: 13
|
|
1157
|
+
})
|
|
1158
|
+
})
|
|
1159
|
+
]
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
export { Dialog, OfficeSelect, Tabs, WorkOfficePreviewBar, WorkOfficeRibbon, WorkOfficeRibbonButton, WorkOfficeRibbonGroup, WorkOfficeStatusBar, WorkOfficeZoomControls, WorkspaceContextMenu, isWorkspaceContextMenuKeyboardEvent, workspaceContextMenuPosition };
|