@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/8728.js
ADDED
|
@@ -0,0 +1,723 @@
|
|
|
1
|
+
import { formatSpreadsheetCellRanges, parseSpreadsheetCellRanges } from "./8715.js";
|
|
2
|
+
const DEFAULT_PROTECTION_HINT = '此工作表已受保护。若要更改锁定的单元格,请先取消工作表保护。';
|
|
3
|
+
function defaultSheetProtectionAuthority(enabled = false) {
|
|
4
|
+
return {
|
|
5
|
+
sheet: enabled ? 1 : 0,
|
|
6
|
+
selectLockedCells: 1,
|
|
7
|
+
selectunLockedCells: 1,
|
|
8
|
+
formatCells: 0,
|
|
9
|
+
formatColumns: 0,
|
|
10
|
+
formatRows: 0,
|
|
11
|
+
insertColumns: 0,
|
|
12
|
+
insertRows: 0,
|
|
13
|
+
insertHyperlinks: 0,
|
|
14
|
+
deleteColumns: 0,
|
|
15
|
+
deleteRows: 0,
|
|
16
|
+
sort: 0,
|
|
17
|
+
filter: 0,
|
|
18
|
+
usePivotTablereports: 0,
|
|
19
|
+
editObjects: 0,
|
|
20
|
+
editScenarios: 0,
|
|
21
|
+
hintText: '',
|
|
22
|
+
defaultSheetHintText: DEFAULT_PROTECTION_HINT,
|
|
23
|
+
allowRangeList: []
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function sheetProtectionAuthority(sheet) {
|
|
27
|
+
return normalizeSheetProtectionAuthority(sheet.config?.authority);
|
|
28
|
+
}
|
|
29
|
+
function normalizeSheetProtectionAuthority(source) {
|
|
30
|
+
const defaults = defaultSheetProtectionAuthority();
|
|
31
|
+
if (!source || 'object' != typeof source) return defaults;
|
|
32
|
+
const authority = source;
|
|
33
|
+
return {
|
|
34
|
+
sheet: flag(authority.sheet, defaults.sheet),
|
|
35
|
+
selectLockedCells: flag(authority.selectLockedCells, defaults.selectLockedCells),
|
|
36
|
+
selectunLockedCells: flag(authority.selectunLockedCells, defaults.selectunLockedCells),
|
|
37
|
+
formatCells: flag(authority.formatCells, defaults.formatCells),
|
|
38
|
+
formatColumns: flag(authority.formatColumns, defaults.formatColumns),
|
|
39
|
+
formatRows: flag(authority.formatRows, defaults.formatRows),
|
|
40
|
+
insertColumns: flag(authority.insertColumns, defaults.insertColumns),
|
|
41
|
+
insertRows: flag(authority.insertRows, defaults.insertRows),
|
|
42
|
+
insertHyperlinks: flag(authority.insertHyperlinks, defaults.insertHyperlinks),
|
|
43
|
+
deleteColumns: flag(authority.deleteColumns, defaults.deleteColumns),
|
|
44
|
+
deleteRows: flag(authority.deleteRows, defaults.deleteRows),
|
|
45
|
+
sort: flag(authority.sort, defaults.sort),
|
|
46
|
+
filter: flag(authority.filter, defaults.filter),
|
|
47
|
+
usePivotTablereports: flag(authority.usePivotTablereports, defaults.usePivotTablereports),
|
|
48
|
+
editObjects: flag(authority.editObjects, defaults.editObjects),
|
|
49
|
+
editScenarios: flag(authority.editScenarios, defaults.editScenarios),
|
|
50
|
+
hintText: stringValue(authority.hintText),
|
|
51
|
+
defaultSheetHintText: stringValue(authority.defaultSheetHintText) || DEFAULT_PROTECTION_HINT,
|
|
52
|
+
allowRangeList: editableRangeList(authority.allowRangeList),
|
|
53
|
+
xlsxAttributes: stringRecord(authority.xlsxAttributes)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function withSheetProtection(sheet, enabled) {
|
|
57
|
+
const authority = sheetProtectionAuthority(sheet);
|
|
58
|
+
authority.sheet = enabled ? 1 : 0;
|
|
59
|
+
return withAuthority(sheet, authority);
|
|
60
|
+
}
|
|
61
|
+
function withSheetSelectionPermissions(sheet, permissions) {
|
|
62
|
+
const authority = sheetProtectionAuthority(sheet);
|
|
63
|
+
if (void 0 !== permissions.selectLockedCells) authority.selectLockedCells = permissions.selectLockedCells ? 1 : 0;
|
|
64
|
+
if (void 0 !== permissions.selectUnlockedCells) authority.selectunLockedCells = permissions.selectUnlockedCells ? 1 : 0;
|
|
65
|
+
return withAuthority(sheet, authority);
|
|
66
|
+
}
|
|
67
|
+
function withEditableRange(sheet, index, editableRange) {
|
|
68
|
+
const authority = sheetProtectionAuthority(sheet);
|
|
69
|
+
const nextRange = {
|
|
70
|
+
name: editableRange.name.trim(),
|
|
71
|
+
sqref: canonicalRangeReference(editableRange.sqref),
|
|
72
|
+
hintText: editableRange.hintText?.trim() || void 0,
|
|
73
|
+
xlsxAttributes: editableRange.xlsxAttributes
|
|
74
|
+
};
|
|
75
|
+
if (null !== index && authority.allowRangeList[index]) authority.allowRangeList[index] = nextRange;
|
|
76
|
+
else authority.allowRangeList.push(nextRange);
|
|
77
|
+
const ranges = parseSpreadsheetCellRanges(nextRange.sqref) ?? [];
|
|
78
|
+
return withAuthority(withCellProtection(sheet, ranges, false), authority);
|
|
79
|
+
}
|
|
80
|
+
function withoutEditableRange(sheet, index) {
|
|
81
|
+
const authority = sheetProtectionAuthority(sheet);
|
|
82
|
+
const removed = authority.allowRangeList[index];
|
|
83
|
+
if (!removed) return sheet;
|
|
84
|
+
authority.allowRangeList.splice(index, 1);
|
|
85
|
+
const removedRanges = parseSpreadsheetCellRanges(removed.sqref) ?? [];
|
|
86
|
+
let next = withCellProtection(sheet, removedRanges, true);
|
|
87
|
+
for (const editableRange of authority.allowRangeList)if (!editableRangeRequiresCredentials(editableRange)) next = withCellProtection(next, parseSpreadsheetCellRanges(editableRange.sqref) ?? [], false);
|
|
88
|
+
return withAuthority(next, authority);
|
|
89
|
+
}
|
|
90
|
+
function withCellProtection(sheet, ranges, locked, hidden = false) {
|
|
91
|
+
if (!ranges.length) return sheet;
|
|
92
|
+
const data = cloneMatrix(sheet.data);
|
|
93
|
+
let rowCount = Math.max(sheet.row ?? 0, data.length);
|
|
94
|
+
let columnCount = Math.max(sheet.column ?? 0, ...data.map((row)=>row.length));
|
|
95
|
+
for (const range of ranges){
|
|
96
|
+
rowCount = Math.max(rowCount, range.row[1] + 1);
|
|
97
|
+
columnCount = Math.max(columnCount, range.column[1] + 1);
|
|
98
|
+
for(let row = range.row[0]; row <= range.row[1]; row += 1){
|
|
99
|
+
data[row] ??= [];
|
|
100
|
+
for(let column = range.column[0]; column <= range.column[1]; column += 1){
|
|
101
|
+
const cell = {
|
|
102
|
+
...data[row][column] ?? {}
|
|
103
|
+
};
|
|
104
|
+
cell.lo = locked ? 1 : 0;
|
|
105
|
+
if (hidden) cell.hi = 1;
|
|
106
|
+
else if (void 0 !== cell.hi) delete cell.hi;
|
|
107
|
+
data[row][column] = cell;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
normalizeMatrix(data, rowCount, columnCount);
|
|
112
|
+
return {
|
|
113
|
+
...sheet,
|
|
114
|
+
row: rowCount,
|
|
115
|
+
column: columnCount,
|
|
116
|
+
data
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function applySpreadsheetCellProtectionRanges(data, ranges, rowCount, columnCount) {
|
|
120
|
+
for (const item of ranges){
|
|
121
|
+
const lastRow = Math.min(item.range.row[1], rowCount - 1);
|
|
122
|
+
const lastColumn = Math.min(item.range.column[1], columnCount - 1);
|
|
123
|
+
for(let row = Math.max(0, item.range.row[0]); row <= lastRow; row += 1){
|
|
124
|
+
data[row] ??= [];
|
|
125
|
+
for(let column = Math.max(0, item.range.column[0]); column <= lastColumn; column += 1){
|
|
126
|
+
const cell = {
|
|
127
|
+
...data[row][column] ?? {}
|
|
128
|
+
};
|
|
129
|
+
cell.lo = item.locked ? 1 : 0;
|
|
130
|
+
if (item.hidden) cell.hi = 1;
|
|
131
|
+
else if (void 0 !== cell.hi) delete cell.hi;
|
|
132
|
+
data[row][column] = cell;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function applyPasswordlessEditableRanges(data, ranges, rowCount, columnCount) {
|
|
138
|
+
const protectionRanges = ranges.filter((range)=>!editableRangeRequiresCredentials(range)).flatMap((range)=>parseSpreadsheetCellRanges(range.sqref) ?? []).map((range)=>({
|
|
139
|
+
range,
|
|
140
|
+
locked: false,
|
|
141
|
+
hidden: false
|
|
142
|
+
}));
|
|
143
|
+
applySpreadsheetCellProtectionRanges(data, protectionRanges, rowCount, columnCount);
|
|
144
|
+
}
|
|
145
|
+
function editableRangeRequiresCredentials(range) {
|
|
146
|
+
const attributes = range.xlsxAttributes ?? {};
|
|
147
|
+
return Boolean(attributes.password || attributes.hashValue || attributes.saltValue || attributes.securityDescriptor || attributes.securitydescriptor);
|
|
148
|
+
}
|
|
149
|
+
function sheetHasProtectionState(sheet) {
|
|
150
|
+
const authority = sheetProtectionAuthority(sheet);
|
|
151
|
+
if (1 === authority.sheet || authority.allowRangeList.length || Object.keys(authority.xlsxAttributes ?? {}).length) return true;
|
|
152
|
+
return (sheet.data ?? []).some((row)=>row.some((cell)=>cell?.lo !== void 0 || cell?.hi !== void 0));
|
|
153
|
+
}
|
|
154
|
+
function protectedSheetCount(sheets) {
|
|
155
|
+
return sheets.filter((sheet)=>1 === sheetProtectionAuthority(sheet).sheet).length;
|
|
156
|
+
}
|
|
157
|
+
function unlockedCellCount(sheet) {
|
|
158
|
+
return (sheet.data ?? []).reduce((total, row)=>total + row.reduce((rowTotal, cell)=>rowTotal + (cell?.lo === 0 ? 1 : 0), 0), 0);
|
|
159
|
+
}
|
|
160
|
+
function spreadsheetProtectionKey(sheets) {
|
|
161
|
+
return sheets.map((sheet)=>{
|
|
162
|
+
const authority = sheetProtectionAuthority(sheet);
|
|
163
|
+
const cells = [];
|
|
164
|
+
for (const [row, values] of (sheet.data ?? []).entries())for (const [column, cell] of values.entries()){
|
|
165
|
+
const hidden = cell?.hi;
|
|
166
|
+
if (cell?.lo !== void 0 || void 0 !== hidden) cells.push(`${row}_${column}:${cell?.lo ?? ''}:${hidden ?? ''}`);
|
|
167
|
+
}
|
|
168
|
+
return `${sheet.id ?? sheet.name}:${JSON.stringify(authority)}:${cells.join(',')}`;
|
|
169
|
+
}).join('|');
|
|
170
|
+
}
|
|
171
|
+
function editableRangeCellCount(ranges) {
|
|
172
|
+
return ranges.reduce((total, range)=>total + (range.row[1] - range.row[0] + 1) * (range.column[1] - range.column[0] + 1), 0);
|
|
173
|
+
}
|
|
174
|
+
function withAuthority(sheet, authority) {
|
|
175
|
+
return {
|
|
176
|
+
...sheet,
|
|
177
|
+
config: {
|
|
178
|
+
...sheet.config ?? {},
|
|
179
|
+
authority
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function editableRangeList(value) {
|
|
184
|
+
if (!Array.isArray(value)) return [];
|
|
185
|
+
return value.flatMap((item, index)=>{
|
|
186
|
+
if (!item || 'object' != typeof item) return [];
|
|
187
|
+
const range = item;
|
|
188
|
+
const sqref = stringValue(range.sqref);
|
|
189
|
+
if (!sqref || !parseSpreadsheetCellRanges(sqref)) return [];
|
|
190
|
+
return [
|
|
191
|
+
{
|
|
192
|
+
name: stringValue(range.name) || `Range ${index + 1}`,
|
|
193
|
+
sqref: canonicalRangeReference(sqref),
|
|
194
|
+
hintText: stringValue(range.hintText) || void 0,
|
|
195
|
+
xlsxAttributes: stringRecord(range.xlsxAttributes)
|
|
196
|
+
}
|
|
197
|
+
];
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
function canonicalRangeReference(value) {
|
|
201
|
+
const ranges = parseSpreadsheetCellRanges(value);
|
|
202
|
+
return ranges ? formatSpreadsheetCellRanges(ranges) : value.trim();
|
|
203
|
+
}
|
|
204
|
+
function cloneMatrix(source) {
|
|
205
|
+
return (source ?? []).map((row)=>[
|
|
206
|
+
...row
|
|
207
|
+
]);
|
|
208
|
+
}
|
|
209
|
+
function normalizeMatrix(data, rows, columns) {
|
|
210
|
+
while(data.length < rows)data.push([]);
|
|
211
|
+
for(let index = 0; index < data.length; index += 1){
|
|
212
|
+
const row = data[index] ?? [];
|
|
213
|
+
data[index] = row;
|
|
214
|
+
while(row.length < columns)row.push(null);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function flag(value, fallback) {
|
|
218
|
+
if (1 === value || true === value || '1' === value) return 1;
|
|
219
|
+
if (0 === value || false === value || '0' === value) return 0;
|
|
220
|
+
return fallback;
|
|
221
|
+
}
|
|
222
|
+
function stringValue(value) {
|
|
223
|
+
return 'string' == typeof value ? value : '';
|
|
224
|
+
}
|
|
225
|
+
function stringRecord(value) {
|
|
226
|
+
if (!value || 'object' != typeof value || Array.isArray(value)) return;
|
|
227
|
+
const entries = Object.entries(value).filter((entry)=>'string' == typeof entry[1]);
|
|
228
|
+
return entries.length ? Object.fromEntries(entries) : void 0;
|
|
229
|
+
}
|
|
230
|
+
const SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS = [
|
|
231
|
+
'greaterThan',
|
|
232
|
+
'greaterThanOrEqual',
|
|
233
|
+
'lessThan',
|
|
234
|
+
'lessThanOrEqual',
|
|
235
|
+
'equal',
|
|
236
|
+
'notEqual',
|
|
237
|
+
'between',
|
|
238
|
+
'notBetween'
|
|
239
|
+
];
|
|
240
|
+
function isSpreadsheetConditionalComparisonOperator(value) {
|
|
241
|
+
return SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS.some((operator)=>operator === value);
|
|
242
|
+
}
|
|
243
|
+
function spreadsheetConditionalComparisonNeedsUpperValue(operator) {
|
|
244
|
+
return 'between' === operator || 'notBetween' === operator;
|
|
245
|
+
}
|
|
246
|
+
const DEFAULT_DATA_BAR_MIN_LENGTH = 10;
|
|
247
|
+
const DEFAULT_DATA_BAR_MAX_LENGTH = 90;
|
|
248
|
+
function defaultSpreadsheetColorScaleThresholds(colorCount) {
|
|
249
|
+
return 3 === colorCount ? [
|
|
250
|
+
{
|
|
251
|
+
type: 'min'
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
type: 'percentile',
|
|
255
|
+
value: 50
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
type: 'max'
|
|
259
|
+
}
|
|
260
|
+
] : [
|
|
261
|
+
{
|
|
262
|
+
type: 'min'
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
type: 'max'
|
|
266
|
+
}
|
|
267
|
+
];
|
|
268
|
+
}
|
|
269
|
+
function defaultSpreadsheetDataBarOptions() {
|
|
270
|
+
return {
|
|
271
|
+
thresholds: [
|
|
272
|
+
{
|
|
273
|
+
type: 'min'
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
type: 'max'
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
showValue: true,
|
|
280
|
+
minLength: DEFAULT_DATA_BAR_MIN_LENGTH,
|
|
281
|
+
maxLength: DEFAULT_DATA_BAR_MAX_LENGTH
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function normalizeSpreadsheetConditionalThreshold(value) {
|
|
285
|
+
if (!value || 'object' != typeof value || Array.isArray(value)) return null;
|
|
286
|
+
const source = value;
|
|
287
|
+
if (![
|
|
288
|
+
'min',
|
|
289
|
+
'max',
|
|
290
|
+
'num',
|
|
291
|
+
'percent',
|
|
292
|
+
'percentile'
|
|
293
|
+
].includes(String(source.type))) return null;
|
|
294
|
+
const type = source.type;
|
|
295
|
+
if ('min' === type || 'max' === type) return {
|
|
296
|
+
type
|
|
297
|
+
};
|
|
298
|
+
if ('number' != typeof source.value || !Number.isFinite(source.value)) return null;
|
|
299
|
+
return {
|
|
300
|
+
type,
|
|
301
|
+
value: source.value
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function normalizeSpreadsheetConditionalVisualOptions(value, expectedThresholdCount, kind) {
|
|
305
|
+
if (!value || 'object' != typeof value || Array.isArray(value)) return null;
|
|
306
|
+
const source = value;
|
|
307
|
+
if (!Array.isArray(source.thresholds) || source.thresholds.length !== expectedThresholdCount) return null;
|
|
308
|
+
const thresholds = source.thresholds.map(normalizeSpreadsheetConditionalThreshold);
|
|
309
|
+
if (thresholds.some((threshold)=>!threshold)) return null;
|
|
310
|
+
if ('colorScale' === kind) return {
|
|
311
|
+
thresholds: thresholds
|
|
312
|
+
};
|
|
313
|
+
const minLength = source.minLength ?? DEFAULT_DATA_BAR_MIN_LENGTH;
|
|
314
|
+
const maxLength = source.maxLength ?? DEFAULT_DATA_BAR_MAX_LENGTH;
|
|
315
|
+
if ('number' != typeof minLength || !Number.isFinite(minLength) || minLength < 0 || minLength > 100 || 'number' != typeof maxLength || !Number.isFinite(maxLength) || maxLength < 0 || maxLength > 100 || minLength > maxLength) return null;
|
|
316
|
+
return {
|
|
317
|
+
thresholds: thresholds,
|
|
318
|
+
showValue: false !== source.showValue,
|
|
319
|
+
minLength,
|
|
320
|
+
maxLength
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function spreadsheetConditionalThresholdValue(threshold, sourceValues) {
|
|
324
|
+
const values = sourceValues.filter(Number.isFinite).sort((left, right)=>left - right);
|
|
325
|
+
if (!values.length) return null;
|
|
326
|
+
const minimum = values[0];
|
|
327
|
+
const maximum = values.at(-1);
|
|
328
|
+
if ('min' === threshold.type) return minimum;
|
|
329
|
+
if ('max' === threshold.type) return maximum;
|
|
330
|
+
if ('num' === threshold.type) return threshold.value ?? null;
|
|
331
|
+
const percentage = threshold.value;
|
|
332
|
+
if (void 0 === percentage || !Number.isFinite(percentage)) return null;
|
|
333
|
+
if ('percent' === threshold.type) return minimum + (maximum - minimum) * percentage / 100;
|
|
334
|
+
const position = Math.max(0, Math.min(100, percentage)) / 100 * (values.length - 1);
|
|
335
|
+
const lower = Math.floor(position);
|
|
336
|
+
const upper = Math.ceil(position);
|
|
337
|
+
if (lower === upper) return values[lower];
|
|
338
|
+
return values[lower] + (values[upper] - values[lower]) * (position - lower);
|
|
339
|
+
}
|
|
340
|
+
function spreadsheetConditionalThresholdsEqual(left, right) {
|
|
341
|
+
return left.length === right.length && left.every((threshold, index)=>threshold.type === right[index]?.type && threshold.value === right[index]?.value);
|
|
342
|
+
}
|
|
343
|
+
const SPREADSHEET_CONDITIONAL_ICON_SETS = [
|
|
344
|
+
{
|
|
345
|
+
name: '3Arrows',
|
|
346
|
+
label: '三向彩色箭头',
|
|
347
|
+
count: 3
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: '3ArrowsGray',
|
|
351
|
+
label: '三向灰色箭头',
|
|
352
|
+
count: 3
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: '3Flags',
|
|
356
|
+
label: '三色旗帜',
|
|
357
|
+
count: 3
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
name: '3TrafficLights1',
|
|
361
|
+
label: '三色交通灯(实心)',
|
|
362
|
+
count: 3
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
name: '3TrafficLights2',
|
|
366
|
+
label: '三色交通灯(边框)',
|
|
367
|
+
count: 3
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
name: '3Signs',
|
|
371
|
+
label: '三色标志',
|
|
372
|
+
count: 3
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
name: '3Symbols',
|
|
376
|
+
label: '三色符号(圆形)',
|
|
377
|
+
count: 3
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: '3Symbols2',
|
|
381
|
+
label: '三色符号',
|
|
382
|
+
count: 3
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: '4Arrows',
|
|
386
|
+
label: '四向彩色箭头',
|
|
387
|
+
count: 4
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
name: '4ArrowsGray',
|
|
391
|
+
label: '四向灰色箭头',
|
|
392
|
+
count: 4
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: '4RedToBlack',
|
|
396
|
+
label: '红到黑圆点',
|
|
397
|
+
count: 4
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
name: '4Rating',
|
|
401
|
+
label: '四级评分',
|
|
402
|
+
count: 4
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
name: '4TrafficLights',
|
|
406
|
+
label: '四色交通灯',
|
|
407
|
+
count: 4
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: '5Arrows',
|
|
411
|
+
label: '五向彩色箭头',
|
|
412
|
+
count: 5
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
name: '5ArrowsGray',
|
|
416
|
+
label: '五向灰色箭头',
|
|
417
|
+
count: 5
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
name: '5Rating',
|
|
421
|
+
label: '五级评分',
|
|
422
|
+
count: 5
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
name: '5Quarters',
|
|
426
|
+
label: '五级圆饼',
|
|
427
|
+
count: 5
|
|
428
|
+
}
|
|
429
|
+
];
|
|
430
|
+
const COLOR_3 = [
|
|
431
|
+
'#c62828',
|
|
432
|
+
'#f9a825',
|
|
433
|
+
'#2e7d32'
|
|
434
|
+
];
|
|
435
|
+
const COLOR_4 = [
|
|
436
|
+
'#c62828',
|
|
437
|
+
'#ef6c00',
|
|
438
|
+
'#7cb342',
|
|
439
|
+
'#2e7d32'
|
|
440
|
+
];
|
|
441
|
+
const COLOR_5 = [
|
|
442
|
+
'#c62828',
|
|
443
|
+
'#ef6c00',
|
|
444
|
+
'#f9a825',
|
|
445
|
+
'#7cb342',
|
|
446
|
+
'#2e7d32'
|
|
447
|
+
];
|
|
448
|
+
function isSpreadsheetConditionalIconSetName(value) {
|
|
449
|
+
return SPREADSHEET_CONDITIONAL_ICON_SETS.some((item)=>item.name === value);
|
|
450
|
+
}
|
|
451
|
+
function spreadsheetConditionalIconSetCount(iconSet) {
|
|
452
|
+
return SPREADSHEET_CONDITIONAL_ICON_SETS.find((item)=>item.name === iconSet).count;
|
|
453
|
+
}
|
|
454
|
+
function defaultSpreadsheetConditionalIconThresholds(iconSet) {
|
|
455
|
+
const count = spreadsheetConditionalIconSetCount(iconSet);
|
|
456
|
+
return Array.from({
|
|
457
|
+
length: count
|
|
458
|
+
}, (_, index)=>0 === index ? {
|
|
459
|
+
type: 'min',
|
|
460
|
+
gte: true
|
|
461
|
+
} : {
|
|
462
|
+
type: 'percent',
|
|
463
|
+
value: Math.round(100 * index / count),
|
|
464
|
+
gte: true
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
function normalizeSpreadsheetConditionalIconSetFormat(value) {
|
|
468
|
+
if (!value || 'object' != typeof value || Array.isArray(value)) return null;
|
|
469
|
+
const source = value;
|
|
470
|
+
if (!isSpreadsheetConditionalIconSetName(source.iconSet) || !Array.isArray(source.thresholds)) return null;
|
|
471
|
+
const count = spreadsheetConditionalIconSetCount(source.iconSet);
|
|
472
|
+
if (source.thresholds.length !== count) return null;
|
|
473
|
+
const thresholds = source.thresholds.map(normalizeThreshold);
|
|
474
|
+
if (thresholds.some((threshold)=>!threshold)) return null;
|
|
475
|
+
return {
|
|
476
|
+
iconSet: source.iconSet,
|
|
477
|
+
showValue: false !== source.showValue,
|
|
478
|
+
reverse: true === source.reverse,
|
|
479
|
+
percent: false !== source.percent,
|
|
480
|
+
thresholds: thresholds
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
function spreadsheetConditionalIconForValue(sourceFormat, value, sourceValues) {
|
|
484
|
+
const format = normalizeSpreadsheetConditionalIconSetFormat(sourceFormat);
|
|
485
|
+
const values = sourceValues.filter(Number.isFinite);
|
|
486
|
+
if (!format || !Number.isFinite(value) || !values.length) return null;
|
|
487
|
+
const count = spreadsheetConditionalIconSetCount(format.iconSet);
|
|
488
|
+
let level = 0;
|
|
489
|
+
for(let index = 1; index < count; index += 1){
|
|
490
|
+
const threshold = format.thresholds[index];
|
|
491
|
+
const cutoff = spreadsheetConditionalThresholdValue(threshold, values);
|
|
492
|
+
if (null === cutoff) return null;
|
|
493
|
+
if (threshold.gte ? value >= cutoff : value > cutoff) level = index;
|
|
494
|
+
}
|
|
495
|
+
return {
|
|
496
|
+
iconSet: format.iconSet,
|
|
497
|
+
index: format.reverse ? count - 1 - level : level,
|
|
498
|
+
count,
|
|
499
|
+
showValue: format.showValue
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
function spreadsheetConditionalIconAppearance(icon) {
|
|
503
|
+
const index = Math.max(0, Math.min(icon.count - 1, icon.index));
|
|
504
|
+
const definition = SPREADSHEET_CONDITIONAL_ICON_SETS.find((item)=>item.name === icon.iconSet);
|
|
505
|
+
const label = `${definition.label} ${index + 1}/${icon.count}`;
|
|
506
|
+
if (icon.iconSet.includes('Arrows')) {
|
|
507
|
+
const glyphs = 3 === icon.count ? [
|
|
508
|
+
'↓',
|
|
509
|
+
'→',
|
|
510
|
+
'↑'
|
|
511
|
+
] : 4 === icon.count ? [
|
|
512
|
+
'↓',
|
|
513
|
+
'↘',
|
|
514
|
+
'↗',
|
|
515
|
+
'↑'
|
|
516
|
+
] : [
|
|
517
|
+
'↓',
|
|
518
|
+
'↘',
|
|
519
|
+
'→',
|
|
520
|
+
'↗',
|
|
521
|
+
'↑'
|
|
522
|
+
];
|
|
523
|
+
return {
|
|
524
|
+
glyph: glyphs[index],
|
|
525
|
+
color: icon.iconSet.includes('Gray') ? '#606a78' : palette(icon.count)[index],
|
|
526
|
+
label
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
if ('3Flags' === icon.iconSet) return {
|
|
530
|
+
glyph: '⚑',
|
|
531
|
+
color: COLOR_3[index],
|
|
532
|
+
label
|
|
533
|
+
};
|
|
534
|
+
if (icon.iconSet.includes('TrafficLights')) return {
|
|
535
|
+
glyph: '3TrafficLights2' === icon.iconSet ? '◉' : '●',
|
|
536
|
+
color: palette(icon.count)[index],
|
|
537
|
+
label
|
|
538
|
+
};
|
|
539
|
+
if ('3Signs' === icon.iconSet) return {
|
|
540
|
+
glyph: [
|
|
541
|
+
'◆',
|
|
542
|
+
'▲',
|
|
543
|
+
'●'
|
|
544
|
+
][index],
|
|
545
|
+
color: COLOR_3[index],
|
|
546
|
+
label
|
|
547
|
+
};
|
|
548
|
+
if ('3Symbols' === icon.iconSet || '3Symbols2' === icon.iconSet) return {
|
|
549
|
+
glyph: [
|
|
550
|
+
'✕',
|
|
551
|
+
'!',
|
|
552
|
+
'✓'
|
|
553
|
+
][index],
|
|
554
|
+
color: COLOR_3[index],
|
|
555
|
+
label
|
|
556
|
+
};
|
|
557
|
+
if ('4RedToBlack' === icon.iconSet) return {
|
|
558
|
+
glyph: '●',
|
|
559
|
+
color: [
|
|
560
|
+
'#c62828',
|
|
561
|
+
'#e45b4f',
|
|
562
|
+
'#697386',
|
|
563
|
+
'#111827'
|
|
564
|
+
][index],
|
|
565
|
+
label
|
|
566
|
+
};
|
|
567
|
+
if ('4Rating' === icon.iconSet) return {
|
|
568
|
+
glyph: [
|
|
569
|
+
'▁',
|
|
570
|
+
'▃',
|
|
571
|
+
'▆',
|
|
572
|
+
'█'
|
|
573
|
+
][index],
|
|
574
|
+
color: '#54708f',
|
|
575
|
+
label
|
|
576
|
+
};
|
|
577
|
+
if ('5Rating' === icon.iconSet) return {
|
|
578
|
+
glyph: [
|
|
579
|
+
'▁',
|
|
580
|
+
'▂',
|
|
581
|
+
'▄',
|
|
582
|
+
'▆',
|
|
583
|
+
'█'
|
|
584
|
+
][index],
|
|
585
|
+
color: '#54708f',
|
|
586
|
+
label
|
|
587
|
+
};
|
|
588
|
+
return {
|
|
589
|
+
glyph: [
|
|
590
|
+
'○',
|
|
591
|
+
'◔',
|
|
592
|
+
'◑',
|
|
593
|
+
'◕',
|
|
594
|
+
'●'
|
|
595
|
+
][index],
|
|
596
|
+
color: '#54708f',
|
|
597
|
+
label
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function drawSpreadsheetConditionalIcon(context, bounds, icon, background, maskValue = !icon.showValue) {
|
|
601
|
+
const width = bounds.endX - bounds.startX;
|
|
602
|
+
const height = bounds.endY - bounds.startY;
|
|
603
|
+
if (width < 6 || height < 6) return;
|
|
604
|
+
const appearance = spreadsheetConditionalIconAppearance(icon);
|
|
605
|
+
context.save();
|
|
606
|
+
context.beginPath();
|
|
607
|
+
context.rect(bounds.startX + 1, bounds.startY + 1, Math.max(0, width - 3), Math.max(0, height - 3));
|
|
608
|
+
context.clip();
|
|
609
|
+
if (maskValue) {
|
|
610
|
+
context.fillStyle = background;
|
|
611
|
+
context.fillRect(bounds.startX + 1, bounds.startY + 1, Math.max(0, width - 3), Math.max(0, height - 3));
|
|
612
|
+
}
|
|
613
|
+
const size = Math.max(9, Math.min(16, height - 5));
|
|
614
|
+
context.fillStyle = appearance.color;
|
|
615
|
+
context.font = `700 ${size}px "Arial Unicode MS", "Segoe UI Symbol", sans-serif`;
|
|
616
|
+
context.textAlign = 'left';
|
|
617
|
+
context.textBaseline = 'middle';
|
|
618
|
+
context.fillText(appearance.glyph, bounds.startX + 4, bounds.startY + height / 2);
|
|
619
|
+
context.restore();
|
|
620
|
+
}
|
|
621
|
+
function normalizeThreshold(value) {
|
|
622
|
+
if (!value || 'object' != typeof value || Array.isArray(value)) return null;
|
|
623
|
+
const source = value;
|
|
624
|
+
const threshold = normalizeSpreadsheetConditionalThreshold(source);
|
|
625
|
+
return threshold ? {
|
|
626
|
+
...threshold,
|
|
627
|
+
gte: false !== source.gte
|
|
628
|
+
} : null;
|
|
629
|
+
}
|
|
630
|
+
function palette(count) {
|
|
631
|
+
if (3 === count) return COLOR_3;
|
|
632
|
+
if (4 === count) return COLOR_4;
|
|
633
|
+
return COLOR_5;
|
|
634
|
+
}
|
|
635
|
+
function effectiveSpreadsheetHeaderFooterSections(sections) {
|
|
636
|
+
return {
|
|
637
|
+
left: sections?.left ?? '',
|
|
638
|
+
center: sections?.center ?? '',
|
|
639
|
+
right: sections?.right ?? ''
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
const DEFAULT_MARGINS = {
|
|
643
|
+
top: 19.05,
|
|
644
|
+
right: 17.78,
|
|
645
|
+
bottom: 19.05,
|
|
646
|
+
left: 17.78,
|
|
647
|
+
header: 7.62,
|
|
648
|
+
footer: 7.62
|
|
649
|
+
};
|
|
650
|
+
const PAPER_DIMENSIONS = {
|
|
651
|
+
a3: {
|
|
652
|
+
width: 297,
|
|
653
|
+
height: 420
|
|
654
|
+
},
|
|
655
|
+
a4: {
|
|
656
|
+
width: 210,
|
|
657
|
+
height: 297
|
|
658
|
+
},
|
|
659
|
+
a5: {
|
|
660
|
+
width: 148,
|
|
661
|
+
height: 210
|
|
662
|
+
},
|
|
663
|
+
letter: {
|
|
664
|
+
width: 215.9,
|
|
665
|
+
height: 279.4
|
|
666
|
+
},
|
|
667
|
+
legal: {
|
|
668
|
+
width: 215.9,
|
|
669
|
+
height: 355.6
|
|
670
|
+
},
|
|
671
|
+
tabloid: {
|
|
672
|
+
width: 279.4,
|
|
673
|
+
height: 431.8
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
PAPER_DIMENSIONS.a4.height, DEFAULT_MARGINS.left, DEFAULT_MARGINS.right;
|
|
677
|
+
PAPER_DIMENSIONS.a4.width, DEFAULT_MARGINS.top, DEFAULT_MARGINS.bottom;
|
|
678
|
+
function effectiveSpreadsheetPageSetup(pageSetup) {
|
|
679
|
+
return {
|
|
680
|
+
paperSize: normalizeSpreadsheetPaperSize(pageSetup?.paperSize),
|
|
681
|
+
orientation: pageSetup?.orientation === 'portrait' ? 'portrait' : 'landscape',
|
|
682
|
+
scale: boundedInteger(pageSetup?.scale, 10, 400, 100),
|
|
683
|
+
fitToPage: Boolean(pageSetup?.fitToPage),
|
|
684
|
+
fitToWidth: boundedInteger(pageSetup?.fitToWidth, 0, 32767, 1),
|
|
685
|
+
fitToHeight: boundedInteger(pageSetup?.fitToHeight, 0, 32767, 0),
|
|
686
|
+
horizontalCentered: Boolean(pageSetup?.horizontalCentered),
|
|
687
|
+
verticalCentered: Boolean(pageSetup?.verticalCentered),
|
|
688
|
+
header: effectiveSpreadsheetHeaderFooterSections(pageSetup?.header),
|
|
689
|
+
footer: effectiveSpreadsheetHeaderFooterSections(pageSetup?.footer),
|
|
690
|
+
pageNumberStart: boundedInteger(pageSetup?.pageNumberStart, 1, 32767, 1),
|
|
691
|
+
pageOrder: pageSetup?.pageOrder === 'downThenOver' ? 'downThenOver' : 'overThenDown',
|
|
692
|
+
scaleWithDocument: pageSetup?.scaleWithDocument !== false,
|
|
693
|
+
alignWithMargins: pageSetup?.alignWithMargins !== false,
|
|
694
|
+
margins: {
|
|
695
|
+
top: boundedNumber(pageSetup?.margins?.top, 0, 100, DEFAULT_MARGINS.top),
|
|
696
|
+
right: boundedNumber(pageSetup?.margins?.right, 0, 100, DEFAULT_MARGINS.right),
|
|
697
|
+
bottom: boundedNumber(pageSetup?.margins?.bottom, 0, 100, DEFAULT_MARGINS.bottom),
|
|
698
|
+
left: boundedNumber(pageSetup?.margins?.left, 0, 100, DEFAULT_MARGINS.left),
|
|
699
|
+
header: boundedNumber(pageSetup?.margins?.header, 0, 100, DEFAULT_MARGINS.header),
|
|
700
|
+
footer: boundedNumber(pageSetup?.margins?.footer, 0, 100, DEFAULT_MARGINS.footer)
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
function normalizeSpreadsheetPaperSize(value) {
|
|
705
|
+
switch(value){
|
|
706
|
+
case 'a3':
|
|
707
|
+
case 'a4':
|
|
708
|
+
case 'a5':
|
|
709
|
+
case 'letter':
|
|
710
|
+
case 'legal':
|
|
711
|
+
case 'tabloid':
|
|
712
|
+
return value;
|
|
713
|
+
default:
|
|
714
|
+
return 'a4';
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
function boundedInteger(value, minimum, maximum, fallback) {
|
|
718
|
+
return Math.trunc(boundedNumber(value, minimum, maximum, fallback));
|
|
719
|
+
}
|
|
720
|
+
function boundedNumber(value, minimum, maximum, fallback) {
|
|
721
|
+
return 'number' == typeof value && Number.isFinite(value) && value >= minimum && value <= maximum ? value : fallback;
|
|
722
|
+
}
|
|
723
|
+
export { DEFAULT_PROTECTION_HINT, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, SPREADSHEET_CONDITIONAL_ICON_SETS, applyPasswordlessEditableRanges, applySpreadsheetCellProtectionRanges, defaultSpreadsheetColorScaleThresholds, defaultSpreadsheetConditionalIconThresholds, defaultSpreadsheetDataBarOptions, drawSpreadsheetConditionalIcon, editableRangeCellCount, editableRangeRequiresCredentials, effectiveSpreadsheetPageSetup, isSpreadsheetConditionalComparisonOperator, isSpreadsheetConditionalIconSetName, normalizeSheetProtectionAuthority, normalizeSpreadsheetConditionalIconSetFormat, normalizeSpreadsheetConditionalVisualOptions, normalizeSpreadsheetPaperSize, protectedSheetCount, sheetHasProtectionState, sheetProtectionAuthority, spreadsheetConditionalComparisonNeedsUpperValue, spreadsheetConditionalIconForValue, spreadsheetConditionalIconSetCount, spreadsheetConditionalThresholdValue, spreadsheetConditionalThresholdsEqual, spreadsheetProtectionKey, unlockedCellCount, withEditableRange, withSheetProtection, withSheetSelectionPermissions, withoutEditableRange };
|