ooxml-ui 1.25.0 → 1.26.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/README.md +82 -19
- package/custom-elements.json +321 -1
- package/dist/bindings/bind-element.d.ts +29 -0
- package/dist/bindings/contract.d.ts +115 -0
- package/dist/bindings/equality.d.ts +9 -0
- package/dist/bindings/handle.d.ts +33 -0
- package/dist/bindings/index.d.ts +6 -0
- package/dist/bindings/react.d.ts +21 -0
- package/dist/bindings/react.js +39 -0
- package/dist/bindings/solid.d.ts +14 -0
- package/dist/bindings/solid.js +27 -0
- package/dist/bindings/src-loader.d.ts +14 -0
- package/dist/bindings/tracker.d.ts +14 -0
- package/dist/bindings/vue.d.ts +35 -0
- package/dist/bindings/vue.js +65 -0
- package/dist/bindings.js +3 -0
- package/dist/chart/data-sheet-keys.d.ts +38 -0
- package/dist/chart/data-sheet-keys.d.ts.map +1 -0
- package/dist/chart/data-sheet-labels.d.ts +36 -0
- package/dist/chart/data-sheet-labels.d.ts.map +1 -0
- package/dist/chart/data-sheet.d.ts +68 -0
- package/dist/chart/data-sheet.d.ts.map +1 -0
- package/dist/chart/design-galleries.d.ts +52 -0
- package/dist/chart/design-galleries.d.ts.map +1 -0
- package/dist/chart/format-pane-3d.d.ts +7 -0
- package/dist/chart/format-pane-3d.d.ts.map +1 -0
- package/dist/chart/format-pane-api.d.ts +17 -0
- package/dist/chart/format-pane-api.d.ts.map +1 -0
- package/dist/chart/format-pane-axis.d.ts +5 -0
- package/dist/chart/format-pane-axis.d.ts.map +1 -0
- package/dist/chart/format-pane-common.d.ts +23 -0
- package/dist/chart/format-pane-common.d.ts.map +1 -0
- package/dist/{pptx/render/chart-format/chart-format-pane-effects.d.ts → chart/format-pane-effects.d.ts} +5 -11
- package/dist/chart/format-pane-effects.d.ts.map +1 -0
- package/dist/chart/format-pane-fields.d.ts +29 -0
- package/dist/chart/format-pane-fields.d.ts.map +1 -0
- package/dist/chart/format-pane-fill-kinds.d.ts +16 -0
- package/dist/chart/format-pane-fill-kinds.d.ts.map +1 -0
- package/dist/chart/format-pane-fill-line.d.ts +13 -0
- package/dist/chart/format-pane-fill-line.d.ts.map +1 -0
- package/dist/chart/format-pane-fixture.test-util.d.ts +3 -0
- package/dist/chart/format-pane-intent.d.ts +24 -0
- package/dist/chart/format-pane-intent.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/de.d.ts +3 -0
- package/dist/chart/format-pane-locales/de.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/en.d.ts +3 -0
- package/dist/chart/format-pane-locales/en.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/es.d.ts +3 -0
- package/dist/chart/format-pane-locales/es.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/fr.d.ts +3 -0
- package/dist/chart/format-pane-locales/fr.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/index.d.ts +7 -0
- package/dist/chart/format-pane-locales/index.d.ts.map +1 -0
- package/dist/chart/format-pane-locales/zh-CN.d.ts +3 -0
- package/dist/chart/format-pane-locales/zh-CN.d.ts.map +1 -0
- package/dist/chart/format-pane-model.d.ts +23 -0
- package/dist/chart/format-pane-model.d.ts.map +1 -0
- package/dist/chart/format-pane-options.d.ts +14 -0
- package/dist/chart/format-pane-options.d.ts.map +1 -0
- package/dist/chart/format-pane-space.d.ts +21 -0
- package/dist/chart/format-pane-space.d.ts.map +1 -0
- package/dist/chart/format-pane-targets.d.ts +25 -0
- package/dist/chart/format-pane-targets.d.ts.map +1 -0
- package/dist/chart/format-pane-text.d.ts +7 -0
- package/dist/chart/format-pane-text.d.ts.map +1 -0
- package/dist/chart/format-pane-translate.d.ts +10 -0
- package/dist/chart/format-pane-translate.d.ts.map +1 -0
- package/dist/chart/format-pane-types.d.ts +118 -0
- package/dist/chart/format-pane-types.d.ts.map +1 -0
- package/dist/chart/format-pane-view.d.ts +212 -0
- package/dist/chart/format-pane-view.d.ts.map +1 -0
- package/dist/chart/format-pane.d.ts +128 -0
- package/dist/chart/format-pane.d.ts.map +1 -0
- package/dist/chart/gallery-tiles.d.ts +23 -0
- package/dist/chart/gallery-tiles.d.ts.map +1 -0
- package/dist/chart-format-locales.js +1 -0
- package/dist/chunk-CDAXY5KC.js +118 -0
- package/dist/chunk-FN7IF6M6.js +25 -0
- package/dist/{chunk-X5XR45BK.js → chunk-HGLCXNCT.js} +50 -24
- package/dist/chunk-KJMAVPQB.js +53 -0
- package/dist/{chunk-S736N64L.js → chunk-KSOHDEUI.js} +1 -1
- package/dist/chunk-NDUD5JJB.js +79 -0
- package/dist/chunk-P4FRKIPE.js +953 -0
- package/dist/chunk-VM6ZTKB3.js +1134 -0
- package/dist/{chunk-SC44SOIS.js → chunk-WDOWQKKC.js} +2601 -275
- package/dist/{chunk-5ZFOSFCK.js → chunk-WH3EGA3S.js} +9 -3
- package/dist/controls.d.ts +7 -2
- package/dist/controls.d.ts.map +1 -1
- package/dist/controls.js +3 -1
- package/dist/dialog/dialog.d.ts +6 -0
- package/dist/dialog/dialog.d.ts.map +1 -1
- package/dist/docx/chart-commands.d.ts +22 -0
- package/dist/docx/chart-design-ribbon.d.ts +4 -0
- package/dist/docx/chart-dialogs.d.ts +11 -0
- package/dist/docx/chart-format-pane.d.ts +22 -0
- package/dist/docx/context-menu-items.d.ts +2 -0
- package/dist/docx/editor-core.d.ts +3 -0
- package/dist/docx/format-dialogs.d.ts +4 -2
- package/dist/docx/image-media.d.ts +9 -1
- package/dist/docx/insert-controller.d.ts +5 -0
- package/dist/docx/locales/charts.d.ts +51 -0
- package/dist/docx/locales/en.d.ts +113 -0
- package/dist/docx/locales/smartart.d.ts +77 -0
- package/dist/docx/localization-strings.d.ts +113 -0
- package/dist/docx/resize-handle.d.ts +23 -0
- package/dist/docx/ribbon-action.d.ts +15 -0
- package/dist/docx/ribbon-icons.d.ts +13 -0
- package/dist/docx/smartart-commands.d.ts +26 -0
- package/dist/docx/smartart-controller.d.ts +35 -0
- package/dist/docx/smartart-design-ribbon.d.ts +7 -0
- package/dist/docx/smartart-dialog.d.ts +12 -0
- package/dist/docx/smartart-node-view.d.ts +6 -3
- package/dist/docx.js +1664 -542
- package/dist/form/color-grid.d.ts +8 -1
- package/dist/form/color-grid.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -5
- package/dist/pptx/ai/bridge-factory.d.ts +77 -0
- package/dist/pptx/ai/bridge-factory.d.ts.map +1 -0
- package/dist/pptx/ai/index.cjs +443 -164
- package/dist/pptx/ai/index.d.ts +4 -0
- package/dist/pptx/ai/index.d.ts.map +1 -1
- package/dist/pptx/ai/index.mjs +437 -165
- package/dist/pptx/ai/panel-controller.d.ts +104 -0
- package/dist/pptx/ai/panel-controller.d.ts.map +1 -0
- package/dist/pptx/{chart-3d-view-scene-RYL7F65H.cjs → chart-3d-view-scene-N7UQOYFI.cjs} +38 -38
- package/dist/pptx/{chart-3d-view-scene-CDIMM5T3.mjs → chart-3d-view-scene-ZUGA3DKM.mjs} +2 -2
- package/dist/pptx/{chunk-PIIYTRLE.mjs → chunk-34LEUH5R.mjs} +1 -1
- package/dist/pptx/{chunk-G3UVZ5FO.cjs → chunk-6KLPQQYP.cjs} +1 -0
- package/dist/pptx/{chunk-SCURBCNQ.mjs → chunk-AMW2AR7J.mjs} +1 -1
- package/dist/pptx/chunk-CWHK7HF4.mjs +751 -0
- package/dist/pptx/{chunk-J642EKDV.cjs → chunk-FM4C4MBJ.cjs} +1 -1
- package/dist/pptx/{chunk-LCB46TH2.cjs → chunk-H5IPNKX6.cjs} +12 -12
- package/dist/pptx/{chunk-4TFSELNQ.cjs → chunk-HAO5PKWK.cjs} +7671 -4138
- package/dist/pptx/{chunk-QTLP3MX7.mjs → chunk-IWUIGVWT.mjs} +7468 -3993
- package/dist/pptx/{chunk-ZNXKAINY.mjs → chunk-LB3A3GF6.mjs} +1150 -222
- package/dist/pptx/chunk-LUDEAPHZ.cjs +776 -0
- package/dist/pptx/{chunk-A2X5BP7J.cjs → chunk-OOQMIQT3.cjs} +1151 -221
- package/dist/pptx/chunk-WM5SW737.mjs +27 -0
- package/dist/pptx/{chunk-73OUATE4.mjs → chunk-WQA3KZRB.mjs} +1 -1
- package/dist/pptx/chunk-Y6DO6SVT.cjs +29 -0
- package/dist/pptx/dom/index.cjs +503 -1123
- package/dist/pptx/dom/index.d.ts +1 -0
- package/dist/pptx/dom/index.d.ts.map +1 -1
- package/dist/pptx/dom/index.mjs +12 -704
- package/dist/pptx/dom/smartart-insert-preview.d.ts +15 -0
- package/dist/pptx/dom/smartart-insert-preview.d.ts.map +1 -0
- package/dist/pptx/export/html2canvas-clone.cjs +4 -4
- package/dist/pptx/export/html2canvas-clone.mjs +1 -1
- package/dist/pptx/i18n/index.cjs +6 -6
- package/dist/pptx/i18n/index.mjs +1 -1
- package/dist/pptx/i18n/translations-en-chart-format.d.ts.map +1 -1
- package/dist/pptx/i18n/translations-en-galleries.d.ts.map +1 -1
- package/dist/pptx/i18n/translations-en.d.ts.map +1 -1
- package/dist/pptx/index.cjs +3490 -3249
- package/dist/pptx/index.mjs +6 -5
- package/dist/pptx/render/autosave-inline-draft.d.ts +27 -0
- package/dist/pptx/render/autosave-inline-draft.d.ts.map +1 -0
- package/dist/pptx/render/autosave-policy.d.ts +6 -7
- package/dist/pptx/render/autosave-policy.d.ts.map +1 -1
- package/dist/pptx/render/autosave-tick.d.ts +6 -0
- package/dist/pptx/render/autosave-tick.d.ts.map +1 -1
- package/dist/pptx/render/chart-combo-stock.cjs +3 -3
- package/dist/pptx/render/chart-combo-stock.mjs +1 -1
- package/dist/pptx/render/chart-format/chart-format-pane-edit.d.ts +10 -2
- package/dist/pptx/render/chart-format/chart-format-pane-edit.d.ts.map +1 -1
- package/dist/pptx/render/chart-format/chart-format-pane-model.d.ts +4 -2
- package/dist/pptx/render/chart-format/chart-format-pane-model.d.ts.map +1 -1
- package/dist/pptx/render/chart-format/chart-format-pane-types.d.ts +4 -91
- package/dist/pptx/render/chart-format/chart-format-pane-types.d.ts.map +1 -1
- package/dist/pptx/render/chart-format/chart-format-source.d.ts +14 -0
- package/dist/pptx/render/chart-format/chart-format-source.d.ts.map +1 -0
- package/dist/pptx/render/chart-format/chart-format-targets.d.ts +16 -19
- package/dist/pptx/render/chart-format/chart-format-targets.d.ts.map +1 -1
- package/dist/pptx/render/chart-format/index.d.ts +2 -1
- package/dist/pptx/render/chart-format/index.d.ts.map +1 -1
- package/dist/pptx/render/chart-overlays.cjs +7 -7
- package/dist/pptx/render/chart-overlays.mjs +1 -1
- package/dist/pptx/render/chart-quick-action-styles.d.ts +4 -1
- package/dist/pptx/render/chart-quick-action-styles.d.ts.map +1 -1
- package/dist/pptx/render/chart-surface-treemap.cjs +4 -4
- package/dist/pptx/render/chart-surface-treemap.mjs +1 -1
- package/dist/pptx/render/chart-view-model.cjs +44 -44
- package/dist/pptx/render/chart-view-model.mjs +1 -1
- package/dist/pptx/render/chart-waterfall-map.cjs +6 -6
- package/dist/pptx/render/chart-waterfall-map.mjs +1 -1
- package/dist/pptx/render/collaboration-provider.d.ts +80 -0
- package/dist/pptx/render/collaboration-provider.d.ts.map +1 -0
- package/dist/pptx/render/collaboration-yjs-session.d.ts +48 -0
- package/dist/pptx/render/collaboration-yjs-session.d.ts.map +1 -0
- package/dist/pptx/render/controller/autosave-controller.d.ts +133 -0
- package/dist/pptx/render/controller/autosave-controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/autosave-recovery-controller.d.ts +68 -0
- package/dist/pptx/render/controller/autosave-recovery-controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/collaboration-session-controller.d.ts +89 -0
- package/dist/pptx/render/controller/collaboration-session-controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/controller.d.ts +44 -0
- package/dist/pptx/render/controller/controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/history-controller.d.ts +54 -0
- package/dist/pptx/render/controller/history-controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/index.d.ts +17 -0
- package/dist/pptx/render/controller/index.d.ts.map +1 -0
- package/dist/pptx/render/customization/ribbon-control-catalog-tail.d.ts +2 -0
- package/dist/pptx/render/customization/ribbon-control-catalog-tail.d.ts.map +1 -1
- package/dist/pptx/render/customization/ribbon-control-catalog.d.ts +2 -0
- package/dist/pptx/render/customization/ribbon-control-catalog.d.ts.map +1 -1
- package/dist/pptx/render/editor-gesture-frames.d.ts +59 -0
- package/dist/pptx/render/editor-gesture-frames.d.ts.map +1 -0
- package/dist/pptx/render/editor-gestures.d.ts +39 -38
- package/dist/pptx/render/editor-gestures.d.ts.map +1 -1
- package/dist/pptx/render/editor-history.d.ts +1 -1
- package/dist/pptx/render/editor-history.d.ts.map +1 -1
- package/dist/pptx/render/editor-key-dispatch.d.ts +68 -0
- package/dist/pptx/render/editor-key-dispatch.d.ts.map +1 -0
- package/dist/pptx/render/effects-helpers.d.ts +8 -1
- package/dist/pptx/render/effects-helpers.d.ts.map +1 -1
- package/dist/pptx/render/effects-shadow-helpers.d.ts +7 -0
- package/dist/pptx/render/effects-shadow-helpers.d.ts.map +1 -1
- package/dist/pptx/render/group-press-target.d.ts +37 -0
- package/dist/pptx/render/group-press-target.d.ts.map +1 -0
- package/dist/pptx/render/index.d.ts +12 -0
- package/dist/pptx/render/index.d.ts.map +1 -1
- package/dist/pptx/render/insert-chart-preview.d.ts +15 -0
- package/dist/pptx/render/insert-chart-preview.d.ts.map +1 -0
- package/dist/pptx/render/insert-chart.d.ts +21 -1
- package/dist/pptx/render/insert-chart.d.ts.map +1 -1
- package/dist/pptx/render/inspector/element-geometry-fields.d.ts +28 -0
- package/dist/pptx/render/inspector/element-geometry-fields.d.ts.map +1 -0
- package/dist/pptx/render/inspector/index.d.ts +18 -0
- package/dist/pptx/render/inspector/index.d.ts.map +1 -0
- package/dist/pptx/render/inspector/inspector-field-model.d.ts +125 -0
- package/dist/pptx/render/inspector/inspector-field-model.d.ts.map +1 -0
- package/dist/pptx/render/inspector/shape-effect-fields-more.d.ts +8 -0
- package/dist/pptx/render/inspector/shape-effect-fields-more.d.ts.map +1 -0
- package/dist/pptx/render/inspector/shape-effect-fields.d.ts +27 -0
- package/dist/pptx/render/inspector/shape-effect-fields.d.ts.map +1 -0
- package/dist/pptx/render/inspector/shape-effect-sections.d.ts +7 -0
- package/dist/pptx/render/inspector/shape-effect-sections.d.ts.map +1 -0
- package/dist/pptx/render/inspector/shape-line-fields.d.ts +20 -0
- package/dist/pptx/render/inspector/shape-line-fields.d.ts.map +1 -0
- package/dist/pptx/render/inspector/text-box-fields.d.ts +24 -0
- package/dist/pptx/render/inspector/text-box-fields.d.ts.map +1 -0
- package/dist/pptx/render/options/viewer-options-apply.d.ts.map +1 -1
- package/dist/pptx/render/options/viewer-options.d.ts.map +1 -1
- package/dist/pptx/render/presentation-show-step.d.ts +105 -0
- package/dist/pptx/render/presentation-show-step.d.ts.map +1 -0
- package/dist/pptx/render/ribbon-galleries/chart-colors-gallery.d.ts +3 -2
- package/dist/pptx/render/ribbon-galleries/chart-colors-gallery.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/chart-quick-layout-gallery.d.ts +6 -3
- package/dist/pptx/render/ribbon-galleries/chart-quick-layout-gallery.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/chart-styles-gallery.d.ts +2 -1
- package/dist/pptx/render/ribbon-galleries/chart-styles-gallery.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/gallery-placements.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/gallery-types.d.ts +1 -1
- package/dist/pptx/render/ribbon-galleries/gallery-types.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-colors-gallery.d.ts +0 -8
- package/dist/pptx/render/ribbon-galleries/smartart-colors-gallery.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-commands.d.ts +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-commands.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-gallery-patch.d.ts +4 -2
- package/dist/pptx/render/ribbon-galleries/smartart-gallery-patch.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-gallery-tiles.d.ts +3 -8
- package/dist/pptx/render/ribbon-galleries/smartart-gallery-tiles.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-layout-tiles.d.ts +7 -5
- package/dist/pptx/render/ribbon-galleries/smartart-layout-tiles.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-galleries/smartart-layouts-gallery.d.ts.map +1 -1
- package/dist/pptx/render/ribbon-insert-state.d.ts +6 -0
- package/dist/pptx/render/ribbon-insert-state.d.ts.map +1 -1
- package/dist/pptx/render/smart-art-presets.d.ts +12 -6
- package/dist/pptx/render/smart-art-presets.d.ts.map +1 -1
- package/dist/pptx/render/smartart-text-pane-model.d.ts +59 -0
- package/dist/pptx/render/smartart-text-pane-model.d.ts.map +1 -0
- package/dist/pptx/render/span-snap-move.d.ts +32 -0
- package/dist/pptx/render/span-snap-move.d.ts.map +1 -0
- package/dist/pptx/render/theme-color-grid.d.ts +17 -0
- package/dist/pptx/render/theme-color-grid.d.ts.map +1 -1
- package/dist/pptx/render/viewer-event-payloads.d.ts +4 -4
- package/dist/pptx/smartart-insert-preview-5ZTZYAZR.cjs +48 -0
- package/dist/pptx/smartart-insert-preview-HMSNUWDO.mjs +39 -0
- package/dist/pptx/web-components/chart-data-sheet.d.ts +47 -0
- package/dist/pptx/web-components/chart-data-sheet.d.ts.map +1 -0
- package/dist/pptx/web-components/chart-format-pane.d.ts +7 -5
- package/dist/pptx/web-components/chart-format-pane.d.ts.map +1 -1
- package/dist/pptx/web-components/host-styles.d.ts.map +1 -1
- package/dist/pptx/web-components/index.d.ts +6 -0
- package/dist/pptx/web-components/index.d.ts.map +1 -1
- package/dist/pptx/web-components/insert-chart-dialog.d.ts +25 -0
- package/dist/pptx/web-components/insert-chart-dialog.d.ts.map +1 -0
- package/dist/pptx/web-components/insert-dialog-frame.d.ts +25 -0
- package/dist/pptx/web-components/insert-dialog-frame.d.ts.map +1 -0
- package/dist/pptx/web-components/insert-smartart-dialog.d.ts +26 -0
- package/dist/pptx/web-components/insert-smartart-dialog.d.ts.map +1 -0
- package/dist/pptx/web-components/mobile-insert.d.ts.map +1 -1
- package/dist/pptx/web-components/office-token-bridge.d.ts +1 -1
- package/dist/pptx/web-components/office-token-bridge.d.ts.map +1 -1
- package/dist/pptx/web-components/ribbon-insert-view.d.ts.map +1 -1
- package/dist/pptx/web-components/smartart-text-pane.d.ts +38 -0
- package/dist/pptx/web-components/smartart-text-pane.d.ts.map +1 -0
- package/dist/smartart/galleries.d.ts +17 -0
- package/dist/smartart/smartart-picker.d.ts +97 -0
- package/dist/smartart/smartart-picker.d.ts.map +1 -0
- package/dist/smartart/smartart-text-pane-tools.d.ts +51 -0
- package/dist/smartart/smartart-text-pane-tools.d.ts.map +1 -0
- package/dist/smartart/smartart-text-pane.d.ts +121 -0
- package/dist/smartart/smartart-text-pane.d.ts.map +1 -0
- package/dist/smartart/text-pane-controller.d.ts +51 -0
- package/dist/smartart/tiles.d.ts +17 -0
- package/dist/smartart/tiles.d.ts.map +1 -0
- package/dist/smartart.d.ts +5 -0
- package/dist/smartart.js +2 -1
- package/dist/teams/app/bind.d.ts +30 -0
- package/dist/teams/app/index.d.ts +1 -1
- package/dist/teams.js +7 -2
- package/dist/visio/ribbon-action.d.ts +5 -2
- package/dist/visio/viewer-chart-editor.d.ts +38 -0
- package/dist/visio/viewer-insert.d.ts +7 -2
- package/dist/visio.js +197 -17
- package/dist/xlsx/chart-format-pane.d.ts +10 -0
- package/dist/xlsx/chart-format-source.d.ts +17 -0
- package/dist/xlsx/commands/chart-design.d.ts +55 -0
- package/dist/xlsx/dialogs/insert-smartart.d.ts +4 -0
- package/dist/xlsx/grid/smartart.d.ts +4 -1
- package/dist/xlsx/ribbon/tabs/contextual.d.ts +6 -0
- package/dist/xlsx/smartart-controller.d.ts +14 -0
- package/dist/xlsx.js +789 -468
- package/package.json +47 -4
- package/dist/chunk-QBXYGKPB.js +0 -224
- package/dist/pptx/render/chart-format/chart-format-pane-3d.d.ts +0 -13
- package/dist/pptx/render/chart-format/chart-format-pane-3d.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-axis.d.ts +0 -12
- package/dist/pptx/render/chart-format/chart-format-pane-axis.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-common.d.ts +0 -14
- package/dist/pptx/render/chart-format/chart-format-pane-common.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-effects.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-fill-kinds.d.ts +0 -15
- package/dist/pptx/render/chart-format/chart-format-pane-fill-kinds.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-fill-line.d.ts +0 -12
- package/dist/pptx/render/chart-format/chart-format-pane-fill-line.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-options.d.ts +0 -13
- package/dist/pptx/render/chart-format/chart-format-pane-options.d.ts.map +0 -1
- package/dist/pptx/render/chart-format/chart-format-pane-text.d.ts +0 -14
- package/dist/pptx/render/chart-format/chart-format-pane-text.d.ts.map +0 -1
- package/dist/pptx/render/ribbon-galleries/chart-color-palette-catalog.d.ts +0 -3
- package/dist/pptx/render/ribbon-galleries/chart-color-palette-catalog.d.ts.map +0 -1
- package/dist/pptx/render/ribbon-galleries/chart-gallery-tiles.d.ts +0 -24
- package/dist/pptx/render/ribbon-galleries/chart-gallery-tiles.d.ts.map +0 -1
- package/dist/pptx/render/ribbon-galleries/chart-quick-layout-catalog.d.ts +0 -22
- package/dist/pptx/render/ribbon-galleries/chart-quick-layout-catalog.d.ts.map +0 -1
- package/dist/pptx/web-components/chart-format-pane-fields.d.ts +0 -17
- package/dist/pptx/web-components/chart-format-pane-fields.d.ts.map +0 -1
- package/dist/xlsx/chart-area-pane.d.ts +0 -9
- package/dist/xlsx/chart-series-pane.d.ts +0 -8
- package/dist/xlsx/commands/chart-colors.d.ts +0 -19
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { createIconSvg, paintIcon, getIcon } from './chunk-M6GF5ED2.js';
|
|
2
|
+
import { CHART_FORMAT_STRINGS, CHART_FORMAT_LOCALES } from './chunk-VM6ZTKB3.js';
|
|
2
3
|
import { initialsOf } from './chunk-YZH2QS7J.js';
|
|
3
|
-
import {
|
|
4
|
+
import { parseSvgPreview } from './chunk-FN7IF6M6.js';
|
|
5
|
+
import { OfficeElement, controlStyles, definer, valueOn, flag, present, emit, triState, withTokens } from './chunk-QLHCGV4C.js';
|
|
4
6
|
import { tok, OFFICE_TOKENS } from './chunk-XL77FR4B.js';
|
|
5
7
|
import { html, LitElement, nothing, render, svg } from 'lit';
|
|
6
8
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
9
|
import { repeat } from 'lit/directives/repeat.js';
|
|
8
|
-
import 'ooxml-core/i18n';
|
|
10
|
+
import { normalizeLocale } from 'ooxml-core/i18n';
|
|
9
11
|
import { unsafeStatic, html as html$1 } from 'lit/static-html.js';
|
|
10
12
|
import { live } from 'lit/directives/live.js';
|
|
13
|
+
import { applyChartDataSheetEdits, chartDataSheetCellEdit, chartDataSheetPasteEdits, chartSeriesEntries, chartGroupPaintsLine, chartTargetShape, chartFormatTargetKey, resolveChartGradient } from 'ooxml-core/chart';
|
|
14
|
+
import { resolveDrawingColor } from 'ooxml-core/drawingml';
|
|
11
15
|
import { keyed } from 'lit/directives/keyed.js';
|
|
12
16
|
import { OFFICE_STANDARD_COLORS, normalizePaletteHex, buildThemePalette, hslToRgb, toHex, hexToRgbChannels, rgbToHsl } from 'ooxml-core/color';
|
|
17
|
+
import { parseLocaleNumber, formatLocaleNumber, parseTsv } from 'ooxml-core/text';
|
|
13
18
|
|
|
14
19
|
function glyph(name, className = "glyph", hidden = false) {
|
|
15
20
|
const found = getIcon(name);
|
|
@@ -358,15 +363,15 @@ function groupOf(radio, scope) {
|
|
|
358
363
|
(other) => other.name === name && other.form === radio.form
|
|
359
364
|
);
|
|
360
365
|
}
|
|
361
|
-
function labelText(
|
|
362
|
-
let
|
|
363
|
-
for (const node of
|
|
366
|
+
function labelText(label2, self) {
|
|
367
|
+
let text2 = "";
|
|
368
|
+
for (const node of label2.childNodes) {
|
|
364
369
|
if (node === self) continue;
|
|
365
|
-
if (node.nodeType === 3)
|
|
370
|
+
if (node.nodeType === 3) text2 += node.textContent ?? "";
|
|
366
371
|
else if (node instanceof Element && !node.localName.includes("-") && !/^(select|input|textarea)$/u.test(node.localName))
|
|
367
|
-
|
|
372
|
+
text2 += labelText(node, self);
|
|
368
373
|
}
|
|
369
|
-
return
|
|
374
|
+
return text2;
|
|
370
375
|
}
|
|
371
376
|
function refreshTabStops(group) {
|
|
372
377
|
const enabled = group.filter((item) => !present(item.disabled));
|
|
@@ -441,11 +446,11 @@ var OfficeUiRadio = class extends OfficeElement {
|
|
|
441
446
|
syncName() {
|
|
442
447
|
if (this.hasAttribute("aria-labelledby")) return;
|
|
443
448
|
if (this.hasAttribute("aria-label") && !this.autoNamed) return;
|
|
444
|
-
const
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
449
|
+
const label2 = this.closest("label") ?? this.internals?.labels?.[0];
|
|
450
|
+
const text2 = label2 ? labelText(label2, this).replace(/\s+/gu, " ").trim() : "";
|
|
451
|
+
if (text2) {
|
|
447
452
|
this.autoNamed = true;
|
|
448
|
-
this.setAttribute("aria-label",
|
|
453
|
+
this.setAttribute("aria-label", text2);
|
|
449
454
|
}
|
|
450
455
|
}
|
|
451
456
|
peers() {
|
|
@@ -768,8 +773,8 @@ var OfficeUiBackstage = class extends OfficeElement {
|
|
|
768
773
|
...child.querySelectorAll(
|
|
769
774
|
'a[href], button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
770
775
|
)
|
|
771
|
-
]).filter((
|
|
772
|
-
return [...chrome, ...page].filter((
|
|
776
|
+
]).filter((control2) => !control2.disabled);
|
|
777
|
+
return [...chrome, ...page].filter((control2) => control2.getClientRects().length > 0);
|
|
773
778
|
}
|
|
774
779
|
/** Keeps Tab inside the open File view: past the last control it returns to the first. */
|
|
775
780
|
trapTab(event) {
|
|
@@ -777,7 +782,7 @@ var OfficeUiBackstage = class extends OfficeElement {
|
|
|
777
782
|
if (stops.length === 0) return;
|
|
778
783
|
const root = this.getRootNode();
|
|
779
784
|
const current = this.shadowRoot?.activeElement ?? root.activeElement;
|
|
780
|
-
const index = stops.findIndex((
|
|
785
|
+
const index = stops.findIndex((control2) => control2 === current || control2.contains(current));
|
|
781
786
|
const last = stops.length - 1;
|
|
782
787
|
if (event.shiftKey ? index > 0 : index < last) return;
|
|
783
788
|
event.preventDefault();
|
|
@@ -844,11 +849,11 @@ var OfficeUiBackstage = class extends OfficeElement {
|
|
|
844
849
|
>`;
|
|
845
850
|
}
|
|
846
851
|
render() {
|
|
847
|
-
const
|
|
852
|
+
const label2 = this.label ?? "File";
|
|
848
853
|
const back = this.backLabel ?? "Back";
|
|
849
854
|
return html`
|
|
850
|
-
<div class="frame" role="dialog" aria-modal="true" aria-label=${
|
|
851
|
-
<nav part="nav" aria-label=${
|
|
855
|
+
<div class="frame" role="dialog" aria-modal="true" aria-label=${label2}>
|
|
856
|
+
<nav part="nav" aria-label=${label2} @click=${this.onNavClick}>
|
|
852
857
|
<button
|
|
853
858
|
type="button"
|
|
854
859
|
class="back"
|
|
@@ -1211,17 +1216,17 @@ var OfficeUiCommentsPane = class extends OfficeElement {
|
|
|
1211
1216
|
}
|
|
1212
1217
|
submitNew() {
|
|
1213
1218
|
const box = this.renderRoot.querySelector("textarea.new");
|
|
1214
|
-
const
|
|
1215
|
-
if (!box || !
|
|
1219
|
+
const text2 = box?.value.trim();
|
|
1220
|
+
if (!box || !text2 || this.locked || present(this.addDisabled)) return;
|
|
1216
1221
|
box.value = "";
|
|
1217
|
-
this.fire("comment-add", { text });
|
|
1222
|
+
this.fire("comment-add", { text: text2 });
|
|
1218
1223
|
}
|
|
1219
1224
|
submitReply(threadId) {
|
|
1220
1225
|
const box = this.card(threadId)?.querySelector("textarea.reply-box");
|
|
1221
|
-
const
|
|
1222
|
-
if (!box || !
|
|
1226
|
+
const text2 = box?.value.trim();
|
|
1227
|
+
if (!box || !text2 || this.locked) return;
|
|
1223
1228
|
box.value = "";
|
|
1224
|
-
this.fire("comment-reply", { threadId, text });
|
|
1229
|
+
this.fire("comment-reply", { threadId, text: text2 });
|
|
1225
1230
|
}
|
|
1226
1231
|
startEdit(commentId) {
|
|
1227
1232
|
this.editingId = commentId;
|
|
@@ -1234,10 +1239,10 @@ var OfficeUiCommentsPane = class extends OfficeElement {
|
|
|
1234
1239
|
}
|
|
1235
1240
|
saveEdit(thread, comment) {
|
|
1236
1241
|
const box = this.renderRoot.querySelector("textarea.edit-box");
|
|
1237
|
-
const
|
|
1242
|
+
const text2 = box?.value.trim();
|
|
1238
1243
|
this.stopEdit();
|
|
1239
|
-
if (!
|
|
1240
|
-
this.fire("comment-edit", { threadId: thread.id, commentId: comment.id, text });
|
|
1244
|
+
if (!text2 || text2 === comment.text || this.locked) return;
|
|
1245
|
+
this.fire("comment-edit", { threadId: thread.id, commentId: comment.id, text: text2 });
|
|
1241
1246
|
}
|
|
1242
1247
|
/** Ctrl+Enter (Cmd+Enter) posts from any box, like Office. */
|
|
1243
1248
|
onBoxKey(event, submit) {
|
|
@@ -1406,6 +1411,2060 @@ var OfficeUiCommentsPane = class extends OfficeElement {
|
|
|
1406
1411
|
};
|
|
1407
1412
|
var defineCommentsPane = definer("office-ui-comments-pane", () => OfficeUiCommentsPane);
|
|
1408
1413
|
|
|
1414
|
+
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/form/range-control.css?raw
|
|
1415
|
+
var range_control_default = ".office-range-control {\n accent-color: var(--office-accent);\n}\n.office-range-control:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: calc(var(--office-focus-offset) / 2);\n}\n.office-range-control:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n";
|
|
1416
|
+
|
|
1417
|
+
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/chart/format-pane.css?raw
|
|
1418
|
+
var format_pane_default = ":host {\n display: block;\n box-sizing: border-box;\n min-width: 0;\n min-height: 0;\n color: var(--office-foreground);\n background: var(--office-background);\n font-family: var(--office-font);\n font-size: var(--office-font-size-sm);\n line-height: var(--office-line-height);\n}\n:host([hidden]) {\n display: none;\n}\n* {\n box-sizing: border-box;\n}\n.panel {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n}\nheader {\n display: flex;\n flex: none;\n align-items: center;\n justify-content: space-between;\n gap: var(--office-space-2);\n padding: var(--office-space-2-5) var(--office-space-2-5) var(--office-space-1-5);\n}\nh3 {\n margin: 0;\n font-size: var(--office-font-size-md);\n font-weight: var(--office-font-weight-bold);\n}\n.options-row {\n display: flex;\n flex: none;\n align-items: end;\n gap: var(--office-space-1-5);\n padding: 0 var(--office-space-2-5) var(--office-space-1-5);\n}\n.picker {\n flex: 1;\n min-width: 0;\n}\n.picker > span,\n.caption {\n display: block;\n color: var(--office-muted-foreground);\n font-size: var(--office-font-size-xs);\n}\n.picker > span {\n margin-bottom: var(--office-space-1);\n}\n.tabs {\n display: flex;\n flex: none;\n gap: var(--office-space-px);\n padding: 0 var(--office-space-2-5);\n overflow-x: auto;\n border-bottom: var(--office-border-width) solid var(--office-border);\n}\n.tabs button {\n padding: var(--office-space-1-5) var(--office-space-2);\n border: 0;\n border-bottom: var(--office-border-width-thick) solid transparent;\n border-radius: 0;\n background: transparent;\n white-space: nowrap;\n}\n.tabs button[aria-selected='true'] {\n border-bottom-color: var(--office-accent);\n font-weight: var(--office-font-weight-bold);\n}\n.content {\n display: grid;\n flex: 1;\n align-content: start;\n gap: var(--office-space-1);\n min-height: 0;\n padding: var(--office-space-1-5) var(--office-space-2-5) var(--office-space-3);\n overflow-y: auto;\n}\nsection {\n padding-bottom: var(--office-space-1-5);\n border-bottom: var(--office-border-width) solid var(--office-border);\n}\n.section-toggle {\n display: flex;\n align-items: center;\n gap: var(--office-space-1-5);\n width: 100%;\n padding: var(--office-space-1-5) 0;\n border: 0;\n background: transparent;\n font-weight: var(--office-font-weight-bold);\n text-align: left;\n}\n.section-toggle::before {\n content: '';\n width: 0;\n height: 0;\n border-top: var(--office-space-1) solid transparent;\n border-bottom: var(--office-space-1) solid transparent;\n border-left: var(--office-space-1-5) solid currentColor;\n transition: transform 0.12s;\n}\n.section-toggle[aria-expanded='true']::before {\n transform: rotate(90deg);\n}\n.fields {\n display: grid;\n gap: var(--office-space-1-5);\n padding: var(--office-space-px) 0 var(--office-space-1) var(--office-space-3);\n}\n.fields[hidden] {\n display: none;\n}\n.radio-group {\n display: grid;\n gap: var(--office-space-1);\n margin: 0;\n padding: 0;\n border: 0;\n}\n.radio-group legend {\n position: absolute;\n width: var(--office-space-px);\n height: var(--office-space-px);\n overflow: hidden;\n clip: rect(0 0 0 0);\n}\n.choice,\n.field-checkbox {\n display: flex;\n align-items: center;\n gap: var(--office-space-1-5);\n}\n.choice .caption,\n.field-checkbox .caption {\n color: inherit;\n font-size: var(--office-font-size-sm);\n}\n.field {\n display: grid;\n grid-template-columns: 1fr minmax(0, calc(var(--office-space-6) * 4 + var(--office-space-4))) auto;\n align-items: center;\n gap: var(--office-space-1-5);\n}\n.field-checkbox {\n display: flex;\n}\n.unit {\n min-width: var(--office-space-3-5);\n color: var(--office-muted-foreground);\n font-size: var(--office-font-size-xs);\n}\n.slider {\n display: grid;\n padding-right: var(--office-space-5);\n}\n.slider input {\n width: 100%;\n}\nselect,\ninput[type='number'],\ninput[type='text'] {\n display: block;\n width: 100%;\n min-height: var(--office-input-height);\n padding: var(--office-space-1) var(--office-space-1-5);\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius-sm);\n background: var(--office-surface);\n color: inherit;\n font: inherit;\n}\ninput[type='color'] {\n justify-self: start;\n width: calc(var(--office-space-5) * 2 + var(--office-space-1));\n height: var(--office-input-height);\n padding: 0;\n border: var(--office-border-width) solid var(--office-border);\n background: transparent;\n}\nbutton {\n padding: var(--office-space-1) var(--office-space-2);\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius-sm);\n background: var(--office-surface);\n color: inherit;\n font: inherit;\n cursor: pointer;\n}\nbutton:hover:not(:disabled) {\n background: var(--office-selected);\n}\nbutton:disabled,\ninput:disabled,\nselect:disabled {\n opacity: 0.5;\n cursor: default;\n}\n.text-options[aria-pressed='true'] {\n border-color: var(--office-accent);\n background: var(--office-selected);\n}\n.file-button {\n justify-self: start;\n}\n.close {\n min-width: var(--office-target-size);\n min-height: var(--office-target-size);\n border: 0;\n background: transparent;\n font-size: var(--office-font-size-xl);\n line-height: 1;\n}\n.note {\n margin: var(--office-space-px) 0 0;\n color: var(--office-muted-foreground);\n font-size: var(--office-font-size-xs);\n}\nbutton:focus-visible,\ninput:focus-visible,\nselect:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: var(--office-focus-offset);\n}\n@media (pointer: coarse), (max-width: 767px) {\n select,\n input[type='number'],\n input[type='text'],\n .close,\n .tabs button {\n min-height: var(--office-target-size-touch);\n }\n .choice,\n .field-checkbox {\n min-height: var(--office-control-height-lg);\n }\n}\n@media (forced-colors: active) {\n section,\n button,\n input,\n select {\n border-color: CanvasText;\n }\n .tabs button[aria-selected='true'] {\n border-bottom-color: Highlight;\n }\n}\n";
|
|
1419
|
+
|
|
1420
|
+
// src/chart/format-pane-common.ts
|
|
1421
|
+
var t = (key, fallback) => ({
|
|
1422
|
+
key: `chartFormat.${key}`,
|
|
1423
|
+
fallback
|
|
1424
|
+
});
|
|
1425
|
+
var choice = (value, key, fallback, extra) => ({ value, label: t(key, fallback), ...extra });
|
|
1426
|
+
var pct = (value) => Math.round(value ?? 0);
|
|
1427
|
+
function hexForInput(color, fallback = "#000000") {
|
|
1428
|
+
if (color && /^#?[0-9a-f]{6}$/iu.test(color)) {
|
|
1429
|
+
return `#${color.replace(/^#/u, "").toUpperCase()}`;
|
|
1430
|
+
}
|
|
1431
|
+
return fallback;
|
|
1432
|
+
}
|
|
1433
|
+
var fill = (text2, params) => text2.replace(/\{\{(\w+)\}\}/gu, (_, name) => String(params?.[name] ?? ""));
|
|
1434
|
+
function translateChartFormatText(value, tr) {
|
|
1435
|
+
const nested = Object.entries(value.paramTexts ?? {}).map(
|
|
1436
|
+
([name, caption2]) => [name, translateChartFormatText(caption2, tr)]
|
|
1437
|
+
);
|
|
1438
|
+
const params = value.params || nested.length > 0 ? { ...value.params, ...Object.fromEntries(nested) } : void 0;
|
|
1439
|
+
const translated = tr(value.key, params, value.fallback);
|
|
1440
|
+
return fill(translated && translated !== value.key ? translated : value.fallback, params);
|
|
1441
|
+
}
|
|
1442
|
+
function rangeControl(options) {
|
|
1443
|
+
return html`<input
|
|
1444
|
+
class="office-range-control"
|
|
1445
|
+
type="range"
|
|
1446
|
+
aria-label=${options.label}
|
|
1447
|
+
aria-valuetext=${options.valueText}
|
|
1448
|
+
min=${options.min}
|
|
1449
|
+
max=${options.max}
|
|
1450
|
+
step=${options.step ?? 1}
|
|
1451
|
+
.value=${String(options.value)}
|
|
1452
|
+
?disabled=${options.disabled}
|
|
1453
|
+
@input=${(event) => {
|
|
1454
|
+
if (!options.disabled) options.onInput(event.target.valueAsNumber);
|
|
1455
|
+
}}
|
|
1456
|
+
@change=${() => {
|
|
1457
|
+
if (!options.disabled) options.onChange();
|
|
1458
|
+
}}
|
|
1459
|
+
/>`;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
// src/chart/format-pane-fields.ts
|
|
1463
|
+
var caption = (text2) => html`<span class="caption">${text2}</span>`;
|
|
1464
|
+
function readValue(field, input) {
|
|
1465
|
+
if (field.kind === "checkbox") return Boolean(input.checked);
|
|
1466
|
+
if (field.kind === "number") return input.value.trim() === "" ? "" : Number(input.value);
|
|
1467
|
+
return input.value;
|
|
1468
|
+
}
|
|
1469
|
+
function radioGroup(field, ctx) {
|
|
1470
|
+
const tag = unsafeStatic(ctx.tags.radio);
|
|
1471
|
+
return html`<fieldset class="radio-group" data-chart-format-field=${field.id}
|
|
1472
|
+
><legend>${ctx.tr(field.label)}</legend>${field.choices.map(
|
|
1473
|
+
(choice2) => html`<label class="choice" title=${choice2.hint ? ctx.tr(choice2.hint) : nothing}
|
|
1474
|
+
>${html$1`<${tag}
|
|
1475
|
+
name=${`cfp-${field.id}`}
|
|
1476
|
+
.value=${choice2.value}
|
|
1477
|
+
data-chart-format-choice=${choice2.value}
|
|
1478
|
+
.checked=${live(choice2.value === field.value)}
|
|
1479
|
+
?disabled=${ctx.locked || Boolean(choice2.disabled) || Boolean(field.disabled)}
|
|
1480
|
+
@change=${(event) => {
|
|
1481
|
+
if (event.currentTarget.checked) ctx.change(field.id, choice2.value);
|
|
1482
|
+
}}
|
|
1483
|
+
></${tag}>`}${caption(ctx.tr(choice2.label))}</label
|
|
1484
|
+
>`
|
|
1485
|
+
)}</fieldset
|
|
1486
|
+
>`;
|
|
1487
|
+
}
|
|
1488
|
+
function fileField(field, ctx) {
|
|
1489
|
+
const pick = (event) => {
|
|
1490
|
+
const input = event.currentTarget;
|
|
1491
|
+
const file = input.files?.[0];
|
|
1492
|
+
if (!file) return;
|
|
1493
|
+
const reader = new FileReader();
|
|
1494
|
+
reader.addEventListener("load", () => {
|
|
1495
|
+
if (typeof reader.result === "string") ctx.change(field.id, reader.result);
|
|
1496
|
+
});
|
|
1497
|
+
reader.readAsDataURL(file);
|
|
1498
|
+
input.value = "";
|
|
1499
|
+
};
|
|
1500
|
+
return html`<div
|
|
1501
|
+
class="field field-file"
|
|
1502
|
+
data-chart-format-field=${field.id}
|
|
1503
|
+
data-chart-format-file-set=${String(field.value)}
|
|
1504
|
+
>${caption(ctx.tr(field.label))}<button
|
|
1505
|
+
type="button"
|
|
1506
|
+
class="file-button"
|
|
1507
|
+
?disabled=${ctx.locked || Boolean(field.disabled)}
|
|
1508
|
+
@click=${(event) => event.currentTarget.nextElementSibling?.click()}
|
|
1509
|
+
>${ctx.tr(field.button)}</button
|
|
1510
|
+
><input type="file" accept=${field.accept} hidden @change=${pick}
|
|
1511
|
+
/></div>`;
|
|
1512
|
+
}
|
|
1513
|
+
function control(field, ctx, label2) {
|
|
1514
|
+
const disabled = ctx.locked || Boolean(field.disabled);
|
|
1515
|
+
const commit = (event) => ctx.change(field.id, readValue(field, event.currentTarget));
|
|
1516
|
+
if (field.kind === "select") {
|
|
1517
|
+
const tag = unsafeStatic(ctx.tags.select);
|
|
1518
|
+
return html$1`<${tag}
|
|
1519
|
+
aria-label=${label2}
|
|
1520
|
+
data-value=${field.value}
|
|
1521
|
+
?disabled=${disabled}
|
|
1522
|
+
@change=${commit}
|
|
1523
|
+
>${field.choices.map(
|
|
1524
|
+
(choice2) => html`<option
|
|
1525
|
+
value=${choice2.value}
|
|
1526
|
+
.selected=${live(choice2.value === field.value)}
|
|
1527
|
+
?disabled=${Boolean(choice2.disabled)}
|
|
1528
|
+
>${ctx.tr(choice2.label)}</option
|
|
1529
|
+
>`
|
|
1530
|
+
)}</${tag}>`;
|
|
1531
|
+
}
|
|
1532
|
+
if (field.kind === "checkbox") {
|
|
1533
|
+
const tag = unsafeStatic(ctx.tags.checkbox);
|
|
1534
|
+
return html$1`<${tag}
|
|
1535
|
+
aria-label=${label2}
|
|
1536
|
+
.checked=${live(field.value)}
|
|
1537
|
+
?disabled=${disabled}
|
|
1538
|
+
@change=${commit}
|
|
1539
|
+
></${tag}>`;
|
|
1540
|
+
}
|
|
1541
|
+
const number2 = field.kind === "number" ? field : void 0;
|
|
1542
|
+
return html`<input
|
|
1543
|
+
type=${field.kind === "color" ? "color" : number2 ? "number" : "text"}
|
|
1544
|
+
aria-label=${label2}
|
|
1545
|
+
data-value=${String(field.value)}
|
|
1546
|
+
min=${number2?.min ?? nothing}
|
|
1547
|
+
max=${number2?.max ?? nothing}
|
|
1548
|
+
step=${number2 ? number2.step ?? "any" : nothing}
|
|
1549
|
+
placeholder=${number2?.auto ? ctx.autoLabel : nothing}
|
|
1550
|
+
inputmode=${number2 ? "decimal" : nothing}
|
|
1551
|
+
?disabled=${disabled}
|
|
1552
|
+
@change=${commit}
|
|
1553
|
+
/>`;
|
|
1554
|
+
}
|
|
1555
|
+
function slider(field, ctx, label2) {
|
|
1556
|
+
const value = field.value === "" ? field.min ?? 0 : field.value;
|
|
1557
|
+
let last = value;
|
|
1558
|
+
return html`<div class="slider" data-chart-format-slider=${field.id}
|
|
1559
|
+
>${rangeControl({
|
|
1560
|
+
label: label2,
|
|
1561
|
+
value,
|
|
1562
|
+
valueText: `${value}${field.unit ?? ""}`,
|
|
1563
|
+
min: field.min ?? 0,
|
|
1564
|
+
max: field.max ?? 100,
|
|
1565
|
+
...field.step === void 0 ? {} : { step: field.step },
|
|
1566
|
+
disabled: ctx.locked || Boolean(field.disabled),
|
|
1567
|
+
onInput: (next) => {
|
|
1568
|
+
last = next;
|
|
1569
|
+
ctx.preview(field.id, next, `${next}${field.unit ?? ""}`);
|
|
1570
|
+
},
|
|
1571
|
+
onChange: () => ctx.change(field.id, last)
|
|
1572
|
+
})}</div
|
|
1573
|
+
>`;
|
|
1574
|
+
}
|
|
1575
|
+
function fieldTemplate(field, ctx) {
|
|
1576
|
+
if (field.kind === "radio") return radioGroup(field, ctx);
|
|
1577
|
+
if (field.kind === "file") return fileField(field, ctx);
|
|
1578
|
+
const label2 = ctx.tr(field.label);
|
|
1579
|
+
const title = field.hint ? ctx.tr(field.hint) : nothing;
|
|
1580
|
+
if (field.kind === "checkbox")
|
|
1581
|
+
return html`<label
|
|
1582
|
+
class="field field-checkbox"
|
|
1583
|
+
data-chart-format-field=${field.id}
|
|
1584
|
+
title=${title}
|
|
1585
|
+
>${control(field, ctx, label2)}${caption(label2)}</label
|
|
1586
|
+
>`;
|
|
1587
|
+
const unit = field.kind === "number" && field.unit ? html`<span class="unit">${field.unit}</span>` : nothing;
|
|
1588
|
+
return html`<label
|
|
1589
|
+
class="field field-${field.kind}"
|
|
1590
|
+
data-chart-format-field=${field.id}
|
|
1591
|
+
title=${title}
|
|
1592
|
+
>${caption(label2)}${control(field, ctx, label2)}${unit}</label
|
|
1593
|
+
>${field.kind === "number" && field.slider ? slider(field, ctx, label2) : nothing}`;
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
// src/chart/format-pane-intent.ts
|
|
1597
|
+
var number = (value) => {
|
|
1598
|
+
if (value === "" || typeof value === "boolean") return null;
|
|
1599
|
+
const n = typeof value === "number" ? value : Number(value);
|
|
1600
|
+
return Number.isFinite(n) ? n : null;
|
|
1601
|
+
};
|
|
1602
|
+
function drawingColorFromHex(hex, transparency3 = 0) {
|
|
1603
|
+
const value = /^#?([0-9a-f]{6})$/iu.exec(hex)?.[1];
|
|
1604
|
+
if (!value) return null;
|
|
1605
|
+
const alpha = Math.round((100 - Math.min(100, Math.max(0, transparency3))) * 1e3);
|
|
1606
|
+
return {
|
|
1607
|
+
kind: "srgb",
|
|
1608
|
+
value: value.toUpperCase(),
|
|
1609
|
+
transforms: alpha < 1e5 ? [{ name: "alpha", value: String(alpha) }] : []
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1612
|
+
function drawingGradientFrom(gradient) {
|
|
1613
|
+
const stops = gradient.stops.flatMap((stop) => {
|
|
1614
|
+
const color = drawingColorFromHex(stop.color, 100 - (stop.opacity ?? 1) * 100);
|
|
1615
|
+
return color ? [{ position: stop.position, color }] : [];
|
|
1616
|
+
});
|
|
1617
|
+
if (stops.length < 2) return null;
|
|
1618
|
+
return gradient.type === "radial" ? { kind: "gradient", stops, path: gradient.path ?? "circle" } : { kind: "gradient", stops, angle: gradient.angle ?? 0, scaled: gradient.scaled ?? false };
|
|
1619
|
+
}
|
|
1620
|
+
function defaultPaneGradient(color = "#4472C4") {
|
|
1621
|
+
return {
|
|
1622
|
+
type: "linear",
|
|
1623
|
+
angle: 90,
|
|
1624
|
+
stops: [
|
|
1625
|
+
{ color, position: 0 },
|
|
1626
|
+
{ color: "#FFFFFF", position: 100 }
|
|
1627
|
+
]
|
|
1628
|
+
};
|
|
1629
|
+
}
|
|
1630
|
+
var GRADIENT = /^(fill|line)\.gradient(Type|Start|End|Angle)$/u;
|
|
1631
|
+
function gradientEdit(current, part, value) {
|
|
1632
|
+
const stops = current.stops.map((stop) => ({ ...stop }));
|
|
1633
|
+
switch (part) {
|
|
1634
|
+
case "Type":
|
|
1635
|
+
return value === "linear" || value === "radial" ? { ...current, type: value, stops } : null;
|
|
1636
|
+
case "Start":
|
|
1637
|
+
case "End": {
|
|
1638
|
+
const stop = part === "Start" ? stops[0] : stops[stops.length - 1];
|
|
1639
|
+
if (!stop || !drawingColorFromHex(String(value))) return null;
|
|
1640
|
+
stop.color = String(value);
|
|
1641
|
+
return { ...current, stops };
|
|
1642
|
+
}
|
|
1643
|
+
default: {
|
|
1644
|
+
const n = number(value);
|
|
1645
|
+
return n === null ? null : { ...current, stops, angle: (n % 360 + 360) % 360 };
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
function paintIntent(view, target, field, value) {
|
|
1650
|
+
const n = number(value);
|
|
1651
|
+
const text2 = String(value);
|
|
1652
|
+
const gradient = GRADIENT.exec(field);
|
|
1653
|
+
if (gradient) {
|
|
1654
|
+
const paint = gradient[1] === "fill" ? view.fill : view.line;
|
|
1655
|
+
const next = gradientEdit(
|
|
1656
|
+
paint.gradient ?? defaultPaneGradient(paint.color),
|
|
1657
|
+
gradient[2],
|
|
1658
|
+
value
|
|
1659
|
+
);
|
|
1660
|
+
const fill3 = next && drawingGradientFrom(next);
|
|
1661
|
+
if (!fill3) return null;
|
|
1662
|
+
return gradient[1] === "fill" ? { op: "fill", target, fill: fill3 } : { op: "line", target, line: { fill: fill3 }, merge: true };
|
|
1663
|
+
}
|
|
1664
|
+
switch (field) {
|
|
1665
|
+
case "fill.kind": {
|
|
1666
|
+
if (text2 === "none") return { op: "fill", target, fill: { kind: "none" } };
|
|
1667
|
+
if (text2 === "automatic") return { op: "fill", target, fill: void 0 };
|
|
1668
|
+
if (text2 === "solid") {
|
|
1669
|
+
const color = drawingColorFromHex(view.fill.color ?? "#4472C4", view.fill.transparency);
|
|
1670
|
+
return color && { op: "fill", target, fill: { kind: "solid", color } };
|
|
1671
|
+
}
|
|
1672
|
+
if (text2 === "gradient") {
|
|
1673
|
+
const fill3 = drawingGradientFrom(
|
|
1674
|
+
view.fill.gradient ?? defaultPaneGradient(view.fill.color)
|
|
1675
|
+
);
|
|
1676
|
+
return fill3 && { op: "fill", target, fill: fill3 };
|
|
1677
|
+
}
|
|
1678
|
+
return null;
|
|
1679
|
+
}
|
|
1680
|
+
case "fill.color": {
|
|
1681
|
+
const color = drawingColorFromHex(text2, view.fill.transparency);
|
|
1682
|
+
return color && { op: "fill", target, fill: { kind: "solid", color } };
|
|
1683
|
+
}
|
|
1684
|
+
case "fill.transparency":
|
|
1685
|
+
case "line.transparency":
|
|
1686
|
+
return n === null || n < 0 || n > 100 ? null : {
|
|
1687
|
+
op: "transparency",
|
|
1688
|
+
target,
|
|
1689
|
+
paint: field === "fill.transparency" ? "fill" : "line",
|
|
1690
|
+
percent: n
|
|
1691
|
+
};
|
|
1692
|
+
case "line.kind": {
|
|
1693
|
+
if (text2 === "none")
|
|
1694
|
+
return { op: "line", target, line: { fill: { kind: "none" } }, merge: true };
|
|
1695
|
+
if (text2 === "automatic") return { op: "line", target, line: void 0 };
|
|
1696
|
+
if (text2 === "solid") {
|
|
1697
|
+
const color = drawingColorFromHex(view.line.color ?? "#000000", view.line.transparency);
|
|
1698
|
+
return color && { op: "line", target, line: { fill: { kind: "solid", color } }, merge: true };
|
|
1699
|
+
}
|
|
1700
|
+
if (text2 === "gradient") {
|
|
1701
|
+
const fill3 = drawingGradientFrom(
|
|
1702
|
+
view.line.gradient ?? defaultPaneGradient(view.line.color)
|
|
1703
|
+
);
|
|
1704
|
+
return fill3 && { op: "line", target, line: { fill: fill3 }, merge: true };
|
|
1705
|
+
}
|
|
1706
|
+
return null;
|
|
1707
|
+
}
|
|
1708
|
+
case "line.color": {
|
|
1709
|
+
const color = drawingColorFromHex(text2, view.line.transparency);
|
|
1710
|
+
return color && { op: "line", target, line: { fill: { kind: "solid", color } }, merge: true };
|
|
1711
|
+
}
|
|
1712
|
+
case "line.width":
|
|
1713
|
+
return n === null || n < 0 || n > 1584 ? null : { op: "line", target, line: { widthEmu: Math.round(n * 12700) }, merge: true };
|
|
1714
|
+
case "line.dash":
|
|
1715
|
+
return { op: "line", target, line: { dash: text2 }, merge: true };
|
|
1716
|
+
case "line.cap":
|
|
1717
|
+
return { op: "line", target, line: { cap: text2 }, merge: true };
|
|
1718
|
+
default:
|
|
1719
|
+
return null;
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
var DISPLAY_UNITS = /* @__PURE__ */ new Set([
|
|
1723
|
+
"hundreds",
|
|
1724
|
+
"thousands",
|
|
1725
|
+
"tenThousands",
|
|
1726
|
+
"hundredThousands",
|
|
1727
|
+
"millions",
|
|
1728
|
+
"tenMillions",
|
|
1729
|
+
"hundredMillions",
|
|
1730
|
+
"billions",
|
|
1731
|
+
"trillions"
|
|
1732
|
+
]);
|
|
1733
|
+
var one = (key, value) => {
|
|
1734
|
+
const edit = {};
|
|
1735
|
+
edit[key] = value;
|
|
1736
|
+
return edit;
|
|
1737
|
+
};
|
|
1738
|
+
function axisEdit(field, value) {
|
|
1739
|
+
const n = number(value);
|
|
1740
|
+
const text2 = String(value);
|
|
1741
|
+
switch (field) {
|
|
1742
|
+
case "axis.min":
|
|
1743
|
+
case "axis.max": {
|
|
1744
|
+
const key = field === "axis.min" ? "min" : "max";
|
|
1745
|
+
return value === "" ? one(key, null) : n === null ? null : one(key, n);
|
|
1746
|
+
}
|
|
1747
|
+
case "axis.majorUnit":
|
|
1748
|
+
case "axis.minorUnit": {
|
|
1749
|
+
const key = field === "axis.majorUnit" ? "majorUnit" : "minorUnit";
|
|
1750
|
+
if (value === "") return one(key, null);
|
|
1751
|
+
return n === null || n <= 0 ? null : one(key, n);
|
|
1752
|
+
}
|
|
1753
|
+
case "axis.crosses":
|
|
1754
|
+
return text2 === "autoZero" || text2 === "min" || text2 === "max" ? { crosses: text2 } : text2 === "value" ? { crosses: 0 } : null;
|
|
1755
|
+
case "axis.crossesAt":
|
|
1756
|
+
return n === null ? null : { crosses: n };
|
|
1757
|
+
case "axis.displayUnits":
|
|
1758
|
+
return text2 === "none" ? { displayUnits: null } : DISPLAY_UNITS.has(text2) ? { displayUnits: text2 } : null;
|
|
1759
|
+
case "axis.logScale":
|
|
1760
|
+
return { logBase: value ? 10 : null };
|
|
1761
|
+
case "axis.logBase":
|
|
1762
|
+
return n === null || n < 2 || n > 1e3 ? null : { logBase: n };
|
|
1763
|
+
case "axis.reverseOrder":
|
|
1764
|
+
return { reverse: Boolean(value) };
|
|
1765
|
+
case "axis.majorTickMark":
|
|
1766
|
+
case "axis.minorTickMark":
|
|
1767
|
+
return text2 === "none" || text2 === "in" || text2 === "out" || text2 === "cross" ? one(field === "axis.majorTickMark" ? "majorTickMark" : "minorTickMark", text2) : null;
|
|
1768
|
+
case "axis.tickLabelPosition":
|
|
1769
|
+
return text2 === "nextTo" || text2 === "high" || text2 === "low" || text2 === "none" ? { tickLabelPosition: text2 } : null;
|
|
1770
|
+
case "axis.numberFormat":
|
|
1771
|
+
return { numberFormat: text2.trim() };
|
|
1772
|
+
default:
|
|
1773
|
+
return null;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
var LABEL_SWITCHES = {
|
|
1777
|
+
"labels.showSeriesName": "showSeriesName",
|
|
1778
|
+
"labels.showCategory": "showCategoryName",
|
|
1779
|
+
"labels.showValue": "showValue",
|
|
1780
|
+
"labels.showPercent": "showPercent",
|
|
1781
|
+
"labels.showLegendKey": "showLegendKey"
|
|
1782
|
+
};
|
|
1783
|
+
var SPACING = {
|
|
1784
|
+
"series.gapWidth": ["gapWidth", 0, 500],
|
|
1785
|
+
"series.overlap": ["overlap", -100, 100],
|
|
1786
|
+
"series.firstSliceAngle": ["firstSliceAngle", 0, 360],
|
|
1787
|
+
"series.holeSize": ["holeSize", 10, 90]
|
|
1788
|
+
};
|
|
1789
|
+
function chartFormatFieldIntent(view, target, field, value) {
|
|
1790
|
+
if (field.startsWith("fill.") || field.startsWith("line."))
|
|
1791
|
+
return paintIntent(view, target, field, value);
|
|
1792
|
+
if (field.startsWith("axis.")) {
|
|
1793
|
+
if (target.kind !== "axis") return null;
|
|
1794
|
+
const edit = axisEdit(field, value);
|
|
1795
|
+
return edit && { op: "axis", axisIndex: target.axisIndex, edit };
|
|
1796
|
+
}
|
|
1797
|
+
if (field === "legend.position")
|
|
1798
|
+
return ["t", "b", "l", "r", "tr"].includes(String(value)) ? { op: "legend", edit: { position: String(value) } } : null;
|
|
1799
|
+
if (field === "legend.noOverlap") return { op: "legend", edit: { overlay: !value } };
|
|
1800
|
+
if (field.startsWith("labels.") && target.kind === "dataLabels") {
|
|
1801
|
+
const seriesIndex = target.seriesIndex;
|
|
1802
|
+
const scope = seriesIndex === void 0 ? {} : { seriesIndex };
|
|
1803
|
+
const key = LABEL_SWITCHES[field];
|
|
1804
|
+
if (key) {
|
|
1805
|
+
const edit = {};
|
|
1806
|
+
edit[key] = Boolean(value);
|
|
1807
|
+
return { op: "dataLabels", ...scope, edit };
|
|
1808
|
+
}
|
|
1809
|
+
return field === "labels.position" && value !== "" ? { op: "dataLabels", ...scope, edit: { position: String(value) } } : null;
|
|
1810
|
+
}
|
|
1811
|
+
const spacing = SPACING[field];
|
|
1812
|
+
if (spacing && target.kind === "series") {
|
|
1813
|
+
const n = number(value);
|
|
1814
|
+
const [key, min, max] = spacing;
|
|
1815
|
+
if (n === null || !Number.isInteger(n) || n < min || n > max) return null;
|
|
1816
|
+
const edit = {};
|
|
1817
|
+
edit[key] = n;
|
|
1818
|
+
return { op: "groupOptions", seriesIndex: target.seriesIndex, edit };
|
|
1819
|
+
}
|
|
1820
|
+
return null;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
// src/chart/format-pane-3d.ts
|
|
1824
|
+
var CHART_BEVEL_TYPES = [
|
|
1825
|
+
"circle",
|
|
1826
|
+
"relaxedInset",
|
|
1827
|
+
"cross",
|
|
1828
|
+
"coolSlant",
|
|
1829
|
+
"angle",
|
|
1830
|
+
"softRound",
|
|
1831
|
+
"convex",
|
|
1832
|
+
"slope",
|
|
1833
|
+
"divot",
|
|
1834
|
+
"riblet",
|
|
1835
|
+
"hardEdge",
|
|
1836
|
+
"artDeco"
|
|
1837
|
+
];
|
|
1838
|
+
var MATERIALS = [
|
|
1839
|
+
"warmMatte",
|
|
1840
|
+
"matte",
|
|
1841
|
+
"plastic",
|
|
1842
|
+
"metal",
|
|
1843
|
+
"dkEdge",
|
|
1844
|
+
"softEdge",
|
|
1845
|
+
"flat",
|
|
1846
|
+
"softmetal",
|
|
1847
|
+
"clear",
|
|
1848
|
+
"powder",
|
|
1849
|
+
"translucentPowder"
|
|
1850
|
+
];
|
|
1851
|
+
var LIGHTING = [
|
|
1852
|
+
["threePt", "Three Point"],
|
|
1853
|
+
["balanced", "Balanced"],
|
|
1854
|
+
["soft", "Soft"],
|
|
1855
|
+
["harsh", "Harsh"],
|
|
1856
|
+
["flood", "Flood"],
|
|
1857
|
+
["contrasting", "Contrasting"],
|
|
1858
|
+
["flat", "Flat"],
|
|
1859
|
+
["twoPt", "Two Point"],
|
|
1860
|
+
["brightRoom", "Bright Room"]
|
|
1861
|
+
];
|
|
1862
|
+
var label = (key, fallback) => ({ key, fallback });
|
|
1863
|
+
var bevelChoices = () => [
|
|
1864
|
+
{ value: "none", label: label("pptx.bevelTypes.none", "None") },
|
|
1865
|
+
...CHART_BEVEL_TYPES.map((type) => ({
|
|
1866
|
+
value: type,
|
|
1867
|
+
label: label(`pptx.bevelTypes.${type}`, type)
|
|
1868
|
+
}))
|
|
1869
|
+
];
|
|
1870
|
+
var size = (id, key, fallback, value) => ({
|
|
1871
|
+
id,
|
|
1872
|
+
kind: "number",
|
|
1873
|
+
label: t(key, fallback),
|
|
1874
|
+
value: Math.round(value * 100) / 100,
|
|
1875
|
+
min: 0,
|
|
1876
|
+
max: 1584,
|
|
1877
|
+
step: 0.5,
|
|
1878
|
+
unit: "pt"
|
|
1879
|
+
});
|
|
1880
|
+
function bevelFields(which, bevel) {
|
|
1881
|
+
const fields = [
|
|
1882
|
+
{
|
|
1883
|
+
id: `threeD.bevel${which}`,
|
|
1884
|
+
kind: "select",
|
|
1885
|
+
label: which === "Top" ? t("bevelTop", "Top bevel") : t("bevelBottom", "Bottom bevel"),
|
|
1886
|
+
value: bevel?.type ?? "none",
|
|
1887
|
+
choices: bevelChoices()
|
|
1888
|
+
}
|
|
1889
|
+
];
|
|
1890
|
+
if (bevel) {
|
|
1891
|
+
fields.push(
|
|
1892
|
+
size(`threeD.bevel${which}Width`, "width", "Width", bevel.width),
|
|
1893
|
+
size(`threeD.bevel${which}Height`, "height", "Height", bevel.height)
|
|
1894
|
+
);
|
|
1895
|
+
}
|
|
1896
|
+
return fields;
|
|
1897
|
+
}
|
|
1898
|
+
function threeDSection(threeD) {
|
|
1899
|
+
return {
|
|
1900
|
+
id: "threeD",
|
|
1901
|
+
title: t("section.threeD", "3-D Format"),
|
|
1902
|
+
fields: [
|
|
1903
|
+
...bevelFields("Top", threeD.bevelTop),
|
|
1904
|
+
...bevelFields("Bottom", threeD.bevelBottom),
|
|
1905
|
+
{
|
|
1906
|
+
id: "threeD.depthColor",
|
|
1907
|
+
kind: "color",
|
|
1908
|
+
label: t("depthColor", "Depth color"),
|
|
1909
|
+
value: hexForInput(threeD.depth?.color)
|
|
1910
|
+
},
|
|
1911
|
+
size("threeD.depthSize", "depthSize", "Depth size", threeD.depth?.size ?? 0),
|
|
1912
|
+
{
|
|
1913
|
+
id: "threeD.contourColor",
|
|
1914
|
+
kind: "color",
|
|
1915
|
+
label: t("contourColor", "Contour color"),
|
|
1916
|
+
value: hexForInput(threeD.contour?.color)
|
|
1917
|
+
},
|
|
1918
|
+
size("threeD.contourSize", "contourSize", "Contour size", threeD.contour?.size ?? 0),
|
|
1919
|
+
{
|
|
1920
|
+
id: "threeD.material",
|
|
1921
|
+
kind: "select",
|
|
1922
|
+
label: t("material", "Material"),
|
|
1923
|
+
value: threeD.material ?? "warmMatte",
|
|
1924
|
+
choices: MATERIALS.map((material) => ({
|
|
1925
|
+
value: material,
|
|
1926
|
+
label: label(`pptx.material.${material}`, material)
|
|
1927
|
+
}))
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
id: "threeD.lighting",
|
|
1931
|
+
kind: "select",
|
|
1932
|
+
label: t("lighting", "Lighting"),
|
|
1933
|
+
value: threeD.lighting ?? "threePt",
|
|
1934
|
+
choices: LIGHTING.map(([value, fallback]) => ({
|
|
1935
|
+
value,
|
|
1936
|
+
label: t(`lighting.${value}`, fallback)
|
|
1937
|
+
}))
|
|
1938
|
+
}
|
|
1939
|
+
],
|
|
1940
|
+
note: t(
|
|
1941
|
+
"threeDNote",
|
|
1942
|
+
"Bevels and material are drawn as shading on the slide; depth, contour and lighting are saved for PowerPoint and drawn approximately."
|
|
1943
|
+
)
|
|
1944
|
+
};
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
// src/chart/format-pane-effects.ts
|
|
1948
|
+
var num = (id, key, fallback, value, max, unit, step2 = 1) => ({
|
|
1949
|
+
id,
|
|
1950
|
+
kind: "number",
|
|
1951
|
+
label: t(key, fallback),
|
|
1952
|
+
value: Math.round(value * 100) / 100,
|
|
1953
|
+
min: 0,
|
|
1954
|
+
max,
|
|
1955
|
+
step: step2,
|
|
1956
|
+
unit
|
|
1957
|
+
});
|
|
1958
|
+
function shadowSection(prefix, shadow) {
|
|
1959
|
+
const section = {
|
|
1960
|
+
id: `${prefix}shadow`,
|
|
1961
|
+
title: t("section.shadow", "Shadow"),
|
|
1962
|
+
fields: [
|
|
1963
|
+
{
|
|
1964
|
+
id: `${prefix}shadow.enabled`,
|
|
1965
|
+
kind: "checkbox",
|
|
1966
|
+
label: t("shadow.enabled", "Outer shadow"),
|
|
1967
|
+
value: Boolean(shadow)
|
|
1968
|
+
}
|
|
1969
|
+
]
|
|
1970
|
+
};
|
|
1971
|
+
if (shadow) {
|
|
1972
|
+
section.fields.push(
|
|
1973
|
+
{
|
|
1974
|
+
id: `${prefix}shadow.color`,
|
|
1975
|
+
kind: "color",
|
|
1976
|
+
label: t("color", "Color"),
|
|
1977
|
+
value: hexForInput(shadow.color)
|
|
1978
|
+
},
|
|
1979
|
+
num(
|
|
1980
|
+
`${prefix}shadow.transparency`,
|
|
1981
|
+
"transparency",
|
|
1982
|
+
"Transparency",
|
|
1983
|
+
shadow.transparency ?? 0,
|
|
1984
|
+
100,
|
|
1985
|
+
"%"
|
|
1986
|
+
),
|
|
1987
|
+
num(`${prefix}shadow.blur`, "blur", "Blur", shadow.blur, 100, "pt", 0.5),
|
|
1988
|
+
num(`${prefix}shadow.angle`, "angle", "Angle", shadow.angle, 359, "\xB0"),
|
|
1989
|
+
num(`${prefix}shadow.distance`, "distance", "Distance", shadow.distance, 200, "pt", 0.5)
|
|
1990
|
+
);
|
|
1991
|
+
}
|
|
1992
|
+
return section;
|
|
1993
|
+
}
|
|
1994
|
+
function glowSection(prefix, glow) {
|
|
1995
|
+
const section = {
|
|
1996
|
+
id: `${prefix}glow`,
|
|
1997
|
+
title: t("section.glow", "Glow"),
|
|
1998
|
+
fields: [
|
|
1999
|
+
{
|
|
2000
|
+
id: `${prefix}glow.enabled`,
|
|
2001
|
+
kind: "checkbox",
|
|
2002
|
+
label: t("glow.enabled", "Glow"),
|
|
2003
|
+
value: Boolean(glow)
|
|
2004
|
+
}
|
|
2005
|
+
]
|
|
2006
|
+
};
|
|
2007
|
+
if (glow) {
|
|
2008
|
+
section.fields.push(
|
|
2009
|
+
{
|
|
2010
|
+
id: `${prefix}glow.color`,
|
|
2011
|
+
kind: "color",
|
|
2012
|
+
label: t("color", "Color"),
|
|
2013
|
+
value: hexForInput(glow.color)
|
|
2014
|
+
},
|
|
2015
|
+
num(`${prefix}glow.radius`, "size", "Size", glow.radius, 150, "pt", 0.5),
|
|
2016
|
+
num(
|
|
2017
|
+
`${prefix}glow.transparency`,
|
|
2018
|
+
"transparency",
|
|
2019
|
+
"Transparency",
|
|
2020
|
+
glow.transparency ?? 0,
|
|
2021
|
+
100,
|
|
2022
|
+
"%"
|
|
2023
|
+
)
|
|
2024
|
+
);
|
|
2025
|
+
}
|
|
2026
|
+
return section;
|
|
2027
|
+
}
|
|
2028
|
+
function effectsSections(view) {
|
|
2029
|
+
const effects = view.effects ?? {};
|
|
2030
|
+
return [
|
|
2031
|
+
shadowSection("", effects.shadow),
|
|
2032
|
+
glowSection("", effects.glow),
|
|
2033
|
+
{
|
|
2034
|
+
id: "softEdges",
|
|
2035
|
+
title: t("section.softEdges", "Soft Edges"),
|
|
2036
|
+
fields: [num("softEdge.size", "size", "Size", effects.softEdge ?? 0, 100, "pt", 0.5)]
|
|
2037
|
+
},
|
|
2038
|
+
...view.support.threeD && view.threeD ? [threeDSection(view.threeD)] : []
|
|
2039
|
+
];
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
// src/chart/format-pane-fill-kinds.ts
|
|
2043
|
+
function gradientFields(prefix, gradient) {
|
|
2044
|
+
const stops = gradient.stops;
|
|
2045
|
+
const fields = [
|
|
2046
|
+
{
|
|
2047
|
+
id: `${prefix}.gradientType`,
|
|
2048
|
+
kind: "select",
|
|
2049
|
+
label: t("gradientType", "Type"),
|
|
2050
|
+
value: gradient.type,
|
|
2051
|
+
choices: [
|
|
2052
|
+
choice("linear", "gradientType.linear", "Linear"),
|
|
2053
|
+
choice("radial", "gradientType.radial", "Radial")
|
|
2054
|
+
]
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
id: `${prefix}.gradientStart`,
|
|
2058
|
+
kind: "color",
|
|
2059
|
+
label: t("gradientStart", "Start color"),
|
|
2060
|
+
value: hexForInput(stops[0]?.color, "#FFFFFF")
|
|
2061
|
+
},
|
|
2062
|
+
{
|
|
2063
|
+
id: `${prefix}.gradientEnd`,
|
|
2064
|
+
kind: "color",
|
|
2065
|
+
label: t("gradientEnd", "End color"),
|
|
2066
|
+
value: hexForInput(stops[stops.length - 1]?.color)
|
|
2067
|
+
}
|
|
2068
|
+
];
|
|
2069
|
+
if (gradient.type === "linear") {
|
|
2070
|
+
fields.push({
|
|
2071
|
+
id: `${prefix}.gradientAngle`,
|
|
2072
|
+
kind: "number",
|
|
2073
|
+
label: t("angle", "Angle"),
|
|
2074
|
+
value: Math.round(gradient.angle ?? 0),
|
|
2075
|
+
min: 0,
|
|
2076
|
+
max: 359,
|
|
2077
|
+
step: 1,
|
|
2078
|
+
unit: "\xB0"
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
return fields;
|
|
2082
|
+
}
|
|
2083
|
+
function patternFields(pattern, presets) {
|
|
2084
|
+
return [
|
|
2085
|
+
{
|
|
2086
|
+
id: "fill.patternPreset",
|
|
2087
|
+
kind: "select",
|
|
2088
|
+
label: t("pattern", "Pattern"),
|
|
2089
|
+
value: pattern.preset,
|
|
2090
|
+
choices: [...presets]
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
id: "fill.patternForeground",
|
|
2094
|
+
kind: "color",
|
|
2095
|
+
label: t("foreground", "Foreground"),
|
|
2096
|
+
value: hexForInput(pattern.foreground)
|
|
2097
|
+
},
|
|
2098
|
+
{
|
|
2099
|
+
id: "fill.patternBackground",
|
|
2100
|
+
kind: "color",
|
|
2101
|
+
label: t("background", "Background"),
|
|
2102
|
+
value: hexForInput(pattern.background, "#FFFFFF")
|
|
2103
|
+
}
|
|
2104
|
+
];
|
|
2105
|
+
}
|
|
2106
|
+
function pictureFields(picture) {
|
|
2107
|
+
const fields = [
|
|
2108
|
+
{
|
|
2109
|
+
id: "fill.picture",
|
|
2110
|
+
kind: "file",
|
|
2111
|
+
label: t("pictureSource", "Picture source"),
|
|
2112
|
+
accept: "image/png,image/jpeg,image/gif,image/bmp",
|
|
2113
|
+
button: t("insertPicture", "Insert..."),
|
|
2114
|
+
value: Boolean(picture?.src || picture?.relId)
|
|
2115
|
+
}
|
|
2116
|
+
];
|
|
2117
|
+
if (picture?.src || picture?.relId) {
|
|
2118
|
+
fields.push(
|
|
2119
|
+
{
|
|
2120
|
+
id: "fill.pictureTransparency",
|
|
2121
|
+
kind: "number",
|
|
2122
|
+
label: t("transparency", "Transparency"),
|
|
2123
|
+
value: Math.round(picture.transparency ?? 0),
|
|
2124
|
+
min: 0,
|
|
2125
|
+
max: 100,
|
|
2126
|
+
step: 1,
|
|
2127
|
+
unit: "%"
|
|
2128
|
+
},
|
|
2129
|
+
{
|
|
2130
|
+
id: "fill.pictureTile",
|
|
2131
|
+
kind: "checkbox",
|
|
2132
|
+
label: t("pictureTile", "Tile picture as texture"),
|
|
2133
|
+
value: Boolean(picture.tile)
|
|
2134
|
+
}
|
|
2135
|
+
);
|
|
2136
|
+
}
|
|
2137
|
+
return fields;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
// src/chart/format-pane-fill-line.ts
|
|
2141
|
+
var DASHES = [
|
|
2142
|
+
["solid", "Solid"],
|
|
2143
|
+
["sysDot", "Round Dot"],
|
|
2144
|
+
["sysDash", "Square Dot"],
|
|
2145
|
+
["dash", "Dash"],
|
|
2146
|
+
["dashDot", "Dash Dot"],
|
|
2147
|
+
["lgDash", "Long Dash"],
|
|
2148
|
+
["lgDashDot", "Long Dash Dot"],
|
|
2149
|
+
["lgDashDotDot", "Long Dash Dot Dot"]
|
|
2150
|
+
];
|
|
2151
|
+
var COMPOUNDS = [
|
|
2152
|
+
["sng", "Single"],
|
|
2153
|
+
["dbl", "Double"],
|
|
2154
|
+
["thickThin", "Thick Thin"],
|
|
2155
|
+
["thinThick", "Thin Thick"],
|
|
2156
|
+
["tri", "Triple"]
|
|
2157
|
+
];
|
|
2158
|
+
var CAPS = [
|
|
2159
|
+
["flat", "Flat"],
|
|
2160
|
+
["sq", "Square"],
|
|
2161
|
+
["rnd", "Round"]
|
|
2162
|
+
];
|
|
2163
|
+
var JOINS = [
|
|
2164
|
+
["round", "Round"],
|
|
2165
|
+
["bevel", "Bevel"],
|
|
2166
|
+
["miter", "Miter"]
|
|
2167
|
+
];
|
|
2168
|
+
var ARROWS = [
|
|
2169
|
+
["none", "None"],
|
|
2170
|
+
["arrow", "Open Arrow"],
|
|
2171
|
+
["triangle", "Arrow"],
|
|
2172
|
+
["stealth", "Stealth Arrow"],
|
|
2173
|
+
["diamond", "Diamond Arrow"],
|
|
2174
|
+
["oval", "Oval Arrow"]
|
|
2175
|
+
];
|
|
2176
|
+
var choices = (prefix, list) => list.map(([value, label2]) => choice(value, `${prefix}.${value}`, label2));
|
|
2177
|
+
function fillSection(view, source) {
|
|
2178
|
+
if (!view.support.fill) {
|
|
2179
|
+
return void 0;
|
|
2180
|
+
}
|
|
2181
|
+
if (source.slots?.fill) {
|
|
2182
|
+
return { id: "fill", title: t("section.fill", "Fill"), fields: [], slot: source.slots.fill };
|
|
2183
|
+
}
|
|
2184
|
+
const kind = view.fill.kind;
|
|
2185
|
+
const presets = source.patternPresets ?? [];
|
|
2186
|
+
const support = view.support;
|
|
2187
|
+
const section = {
|
|
2188
|
+
id: "fill",
|
|
2189
|
+
title: t("section.fill", "Fill"),
|
|
2190
|
+
fields: [
|
|
2191
|
+
{
|
|
2192
|
+
id: "fill.kind",
|
|
2193
|
+
kind: "radio",
|
|
2194
|
+
label: t("section.fill", "Fill"),
|
|
2195
|
+
value: kind,
|
|
2196
|
+
choices: [
|
|
2197
|
+
choice("none", "fill.none", "No fill"),
|
|
2198
|
+
choice("solid", "fill.solid", "Solid fill"),
|
|
2199
|
+
...support.gradient ? [choice("gradient", "fill.gradient", "Gradient fill")] : [],
|
|
2200
|
+
...support.picture ? [choice("picture", "fill.picture", "Picture or texture fill")] : [],
|
|
2201
|
+
...support.pattern && presets.length > 0 ? [choice("pattern", "fill.pattern", "Pattern fill")] : [],
|
|
2202
|
+
choice("automatic", "fill.automatic", "Automatic")
|
|
2203
|
+
]
|
|
2204
|
+
}
|
|
2205
|
+
]
|
|
2206
|
+
};
|
|
2207
|
+
if (kind === "solid") {
|
|
2208
|
+
section.fields.push(
|
|
2209
|
+
{
|
|
2210
|
+
id: "fill.color",
|
|
2211
|
+
kind: "color",
|
|
2212
|
+
label: t("color", "Color"),
|
|
2213
|
+
value: hexForInput(view.fill.color)
|
|
2214
|
+
},
|
|
2215
|
+
{
|
|
2216
|
+
id: "fill.transparency",
|
|
2217
|
+
kind: "number",
|
|
2218
|
+
label: t("transparency", "Transparency"),
|
|
2219
|
+
value: pct(view.fill.transparency),
|
|
2220
|
+
min: 0,
|
|
2221
|
+
max: 100,
|
|
2222
|
+
step: 1,
|
|
2223
|
+
unit: "%"
|
|
2224
|
+
}
|
|
2225
|
+
);
|
|
2226
|
+
} else if (kind === "gradient" && view.fill.gradient) {
|
|
2227
|
+
section.fields.push(...gradientFields("fill", view.fill.gradient));
|
|
2228
|
+
} else if (kind === "pattern" && view.fill.pattern) {
|
|
2229
|
+
section.fields.push(...patternFields(view.fill.pattern, presets));
|
|
2230
|
+
} else if (kind === "picture") {
|
|
2231
|
+
section.fields.push(...pictureFields(view.fill.picture));
|
|
2232
|
+
}
|
|
2233
|
+
return section;
|
|
2234
|
+
}
|
|
2235
|
+
function lineSection(view, target) {
|
|
2236
|
+
const isLine = !view.support.fill;
|
|
2237
|
+
const line = view.line;
|
|
2238
|
+
const details = view.support.lineDetails !== false;
|
|
2239
|
+
const section = {
|
|
2240
|
+
id: "line",
|
|
2241
|
+
title: isLine ? t("section.line", "Line") : t("section.border", "Border"),
|
|
2242
|
+
fields: [
|
|
2243
|
+
{
|
|
2244
|
+
id: "line.kind",
|
|
2245
|
+
kind: "radio",
|
|
2246
|
+
label: isLine ? t("section.line", "Line") : t("section.border", "Border"),
|
|
2247
|
+
value: line.kind,
|
|
2248
|
+
choices: [
|
|
2249
|
+
choice("none", "line.none", "No line"),
|
|
2250
|
+
choice("solid", "line.solid", "Solid line"),
|
|
2251
|
+
...details ? [choice("gradient", "line.gradient", "Gradient line")] : [],
|
|
2252
|
+
choice("automatic", "fill.automatic", "Automatic")
|
|
2253
|
+
]
|
|
2254
|
+
}
|
|
2255
|
+
]
|
|
2256
|
+
};
|
|
2257
|
+
if (line.kind === "none") {
|
|
2258
|
+
return section;
|
|
2259
|
+
}
|
|
2260
|
+
if (line.kind === "solid") {
|
|
2261
|
+
section.fields.push(
|
|
2262
|
+
{
|
|
2263
|
+
id: "line.color",
|
|
2264
|
+
kind: "color",
|
|
2265
|
+
label: t("color", "Color"),
|
|
2266
|
+
value: hexForInput(line.color)
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
id: "line.transparency",
|
|
2270
|
+
kind: "number",
|
|
2271
|
+
label: t("transparency", "Transparency"),
|
|
2272
|
+
value: pct(line.transparency),
|
|
2273
|
+
min: 0,
|
|
2274
|
+
max: 100,
|
|
2275
|
+
step: 1,
|
|
2276
|
+
unit: "%"
|
|
2277
|
+
}
|
|
2278
|
+
);
|
|
2279
|
+
} else if (line.kind === "gradient" && line.gradient) {
|
|
2280
|
+
section.fields.push(...gradientFields("line", line.gradient));
|
|
2281
|
+
}
|
|
2282
|
+
section.fields.push({
|
|
2283
|
+
id: "line.width",
|
|
2284
|
+
kind: "number",
|
|
2285
|
+
label: t("width", "Width"),
|
|
2286
|
+
value: line.width ?? "",
|
|
2287
|
+
min: 0,
|
|
2288
|
+
max: 1584,
|
|
2289
|
+
step: 0.25,
|
|
2290
|
+
unit: "pt",
|
|
2291
|
+
auto: true
|
|
2292
|
+
});
|
|
2293
|
+
if (details) {
|
|
2294
|
+
section.fields.push({
|
|
2295
|
+
id: "line.compound",
|
|
2296
|
+
kind: "select",
|
|
2297
|
+
label: t("compound", "Compound type"),
|
|
2298
|
+
value: line.compound ?? "sng",
|
|
2299
|
+
choices: choices("compound", COMPOUNDS)
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
section.fields.push(
|
|
2303
|
+
{
|
|
2304
|
+
id: "line.dash",
|
|
2305
|
+
kind: "select",
|
|
2306
|
+
label: t("dash", "Dash type"),
|
|
2307
|
+
value: line.dash ?? "solid",
|
|
2308
|
+
choices: choices("dash", DASHES)
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
id: "line.cap",
|
|
2312
|
+
kind: "select",
|
|
2313
|
+
label: t("cap", "Cap type"),
|
|
2314
|
+
value: line.cap ?? "flat",
|
|
2315
|
+
choices: choices("cap", CAPS)
|
|
2316
|
+
}
|
|
2317
|
+
);
|
|
2318
|
+
if (!details) {
|
|
2319
|
+
return section;
|
|
2320
|
+
}
|
|
2321
|
+
section.fields.push({
|
|
2322
|
+
id: "line.join",
|
|
2323
|
+
kind: "select",
|
|
2324
|
+
label: t("join", "Join type"),
|
|
2325
|
+
value: line.join ?? "round",
|
|
2326
|
+
choices: choices("join", JOINS)
|
|
2327
|
+
});
|
|
2328
|
+
if (isLine || target.kind === "axis") {
|
|
2329
|
+
section.fields.push(
|
|
2330
|
+
{
|
|
2331
|
+
id: "line.beginArrow",
|
|
2332
|
+
kind: "select",
|
|
2333
|
+
label: t("beginArrow", "Begin Arrow type"),
|
|
2334
|
+
value: line.beginArrow ?? "none",
|
|
2335
|
+
choices: choices("arrow", ARROWS)
|
|
2336
|
+
},
|
|
2337
|
+
{
|
|
2338
|
+
id: "line.endArrow",
|
|
2339
|
+
kind: "select",
|
|
2340
|
+
label: t("endArrow", "End Arrow type"),
|
|
2341
|
+
value: line.endArrow ?? "none",
|
|
2342
|
+
choices: choices("arrow", ARROWS)
|
|
2343
|
+
}
|
|
2344
|
+
);
|
|
2345
|
+
}
|
|
2346
|
+
return section;
|
|
2347
|
+
}
|
|
2348
|
+
function fillLineSections(view, target, source = {}) {
|
|
2349
|
+
const fill3 = fillSection(view, source);
|
|
2350
|
+
const line = view.support.line === false ? [] : [lineSection(view, target)];
|
|
2351
|
+
return [...fill3 ? [fill3] : [], ...line];
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
// src/chart/format-pane-axis.ts
|
|
2355
|
+
var auto = (id, key, fallback, value, extra = {}) => ({
|
|
2356
|
+
id,
|
|
2357
|
+
kind: "number",
|
|
2358
|
+
label: t(key, fallback),
|
|
2359
|
+
value: value ?? "",
|
|
2360
|
+
auto: true,
|
|
2361
|
+
...extra
|
|
2362
|
+
});
|
|
2363
|
+
var TICKS = [
|
|
2364
|
+
["none", "None"],
|
|
2365
|
+
["in", "Inside"],
|
|
2366
|
+
["out", "Outside"],
|
|
2367
|
+
["cross", "Cross"]
|
|
2368
|
+
];
|
|
2369
|
+
var tickChoices = () => TICKS.map(([value, label2]) => choice(value, `tick.${value}`, label2));
|
|
2370
|
+
function axisOptions(axis) {
|
|
2371
|
+
const value = axis.kind === "val" || axis.kind === "date";
|
|
2372
|
+
const fields = [];
|
|
2373
|
+
if (value) {
|
|
2374
|
+
fields.push(
|
|
2375
|
+
auto("axis.min", "minimum", "Minimum", axis.min),
|
|
2376
|
+
auto("axis.max", "maximum", "Maximum", axis.max),
|
|
2377
|
+
auto("axis.majorUnit", "majorUnit", "Major unit", axis.majorUnit, { min: 0 }),
|
|
2378
|
+
auto("axis.minorUnit", "minorUnit", "Minor unit", axis.minorUnit, { min: 0 })
|
|
2379
|
+
);
|
|
2380
|
+
}
|
|
2381
|
+
const crosses = axis.crossesAt !== void 0 ? "value" : axis.crosses ?? "autoZero";
|
|
2382
|
+
fields.push({
|
|
2383
|
+
id: "axis.crosses",
|
|
2384
|
+
kind: "select",
|
|
2385
|
+
label: value ? t("crossesValue", "Horizontal axis crosses") : t("crossesCategory", "Vertical axis crosses"),
|
|
2386
|
+
value: crosses,
|
|
2387
|
+
choices: [
|
|
2388
|
+
choice("autoZero", "crosses.auto", "Automatic"),
|
|
2389
|
+
choice("min", "crosses.min", "At minimum"),
|
|
2390
|
+
choice("max", "crosses.max", "At maximum"),
|
|
2391
|
+
choice("value", "crosses.value", "At value")
|
|
2392
|
+
]
|
|
2393
|
+
});
|
|
2394
|
+
if (crosses === "value") {
|
|
2395
|
+
fields.push({
|
|
2396
|
+
id: "axis.crossesAt",
|
|
2397
|
+
kind: "number",
|
|
2398
|
+
label: t("crossesAt", "Axis value"),
|
|
2399
|
+
value: axis.crossesAt ?? 0
|
|
2400
|
+
});
|
|
2401
|
+
}
|
|
2402
|
+
if (axis.kind === "val") {
|
|
2403
|
+
fields.push(
|
|
2404
|
+
{
|
|
2405
|
+
id: "axis.displayUnits",
|
|
2406
|
+
kind: "select",
|
|
2407
|
+
label: t("displayUnits", "Display units"),
|
|
2408
|
+
value: axis.displayUnits ?? "none",
|
|
2409
|
+
choices: [
|
|
2410
|
+
choice("none", "units.none", "None"),
|
|
2411
|
+
choice("hundreds", "units.hundreds", "Hundreds"),
|
|
2412
|
+
choice("thousands", "units.thousands", "Thousands"),
|
|
2413
|
+
choice("tenThousands", "units.tenThousands", "Ten Thousands"),
|
|
2414
|
+
choice("hundredThousands", "units.hundredThousands", "Hundred Thousands"),
|
|
2415
|
+
choice("millions", "units.millions", "Millions"),
|
|
2416
|
+
choice("tenMillions", "units.tenMillions", "Ten Millions"),
|
|
2417
|
+
choice("hundredMillions", "units.hundredMillions", "Hundred Millions"),
|
|
2418
|
+
choice("billions", "units.billions", "Billions"),
|
|
2419
|
+
choice("trillions", "units.trillions", "Trillions")
|
|
2420
|
+
]
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
id: "axis.logScale",
|
|
2424
|
+
kind: "checkbox",
|
|
2425
|
+
label: t("logScale", "Logarithmic scale"),
|
|
2426
|
+
value: Boolean(axis.logScale)
|
|
2427
|
+
}
|
|
2428
|
+
);
|
|
2429
|
+
if (axis.logScale) {
|
|
2430
|
+
fields.push({
|
|
2431
|
+
id: "axis.logBase",
|
|
2432
|
+
kind: "number",
|
|
2433
|
+
label: t("logBase", "Base"),
|
|
2434
|
+
value: axis.logBase ?? 10,
|
|
2435
|
+
min: 2,
|
|
2436
|
+
max: 1e3,
|
|
2437
|
+
step: 1
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
fields.push({
|
|
2442
|
+
id: "axis.reverseOrder",
|
|
2443
|
+
kind: "checkbox",
|
|
2444
|
+
label: value ? t("reverseValues", "Values in reverse order") : t("reverseCategories", "Categories in reverse order"),
|
|
2445
|
+
value: axis.reverse
|
|
2446
|
+
});
|
|
2447
|
+
return [
|
|
2448
|
+
{ id: "axisOptions", title: t("section.axisOptions", "Axis Options"), fields },
|
|
2449
|
+
{
|
|
2450
|
+
id: "tickMarks",
|
|
2451
|
+
title: t("section.tickMarks", "Tick Marks"),
|
|
2452
|
+
fields: [
|
|
2453
|
+
{
|
|
2454
|
+
id: "axis.majorTickMark",
|
|
2455
|
+
kind: "select",
|
|
2456
|
+
label: t("majorTick", "Major type"),
|
|
2457
|
+
value: axis.majorTickMark ?? "out",
|
|
2458
|
+
choices: tickChoices()
|
|
2459
|
+
},
|
|
2460
|
+
{
|
|
2461
|
+
id: "axis.minorTickMark",
|
|
2462
|
+
kind: "select",
|
|
2463
|
+
label: t("minorTick", "Minor type"),
|
|
2464
|
+
value: axis.minorTickMark ?? "none",
|
|
2465
|
+
choices: tickChoices()
|
|
2466
|
+
}
|
|
2467
|
+
]
|
|
2468
|
+
},
|
|
2469
|
+
{
|
|
2470
|
+
id: "labels",
|
|
2471
|
+
title: t("section.labels", "Labels"),
|
|
2472
|
+
fields: [
|
|
2473
|
+
{
|
|
2474
|
+
id: "axis.tickLabelPosition",
|
|
2475
|
+
kind: "select",
|
|
2476
|
+
label: t("labelPosition", "Label Position"),
|
|
2477
|
+
value: axis.tickLabelPosition ?? "nextTo",
|
|
2478
|
+
choices: [
|
|
2479
|
+
choice("nextTo", "labelPos.nextTo", "Next to Axis"),
|
|
2480
|
+
choice("high", "labelPos.high", "High"),
|
|
2481
|
+
choice("low", "labelPos.low", "Low"),
|
|
2482
|
+
choice("none", "labelPos.none", "None")
|
|
2483
|
+
]
|
|
2484
|
+
}
|
|
2485
|
+
]
|
|
2486
|
+
},
|
|
2487
|
+
{
|
|
2488
|
+
id: "number",
|
|
2489
|
+
title: t("section.number", "Number"),
|
|
2490
|
+
fields: [
|
|
2491
|
+
{
|
|
2492
|
+
id: "axis.numberFormat",
|
|
2493
|
+
kind: "text",
|
|
2494
|
+
label: t("formatCode", "Format Code"),
|
|
2495
|
+
value: axis.numberFormat ?? ""
|
|
2496
|
+
}
|
|
2497
|
+
]
|
|
2498
|
+
}
|
|
2499
|
+
];
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
// src/chart/format-pane-options.ts
|
|
2503
|
+
var pctField = (id, key, fallback, value, min, max, unit = "%", slider2 = false) => ({
|
|
2504
|
+
id,
|
|
2505
|
+
kind: "number",
|
|
2506
|
+
label: t(key, fallback),
|
|
2507
|
+
value,
|
|
2508
|
+
min,
|
|
2509
|
+
max,
|
|
2510
|
+
step: 1,
|
|
2511
|
+
unit,
|
|
2512
|
+
...slider2 ? { slider: slider2 } : {}
|
|
2513
|
+
});
|
|
2514
|
+
function seriesOptions(series) {
|
|
2515
|
+
const type = series.chartType;
|
|
2516
|
+
const sliders = Boolean(series.sliders);
|
|
2517
|
+
const fields = [];
|
|
2518
|
+
if (series.secondaryAxis !== void 0) {
|
|
2519
|
+
fields.push({
|
|
2520
|
+
id: "series.axis",
|
|
2521
|
+
kind: "radio",
|
|
2522
|
+
label: t("plotSeriesOn", "Plot Series On"),
|
|
2523
|
+
value: series.secondaryAxis ? "secondary" : "primary",
|
|
2524
|
+
choices: [
|
|
2525
|
+
choice("primary", "axis.primary", "Primary Axis"),
|
|
2526
|
+
choice("secondary", "axis.secondary", "Secondary Axis")
|
|
2527
|
+
]
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2530
|
+
if (type === "bar" || type === "bar3D") {
|
|
2531
|
+
if (type === "bar") {
|
|
2532
|
+
fields.push(
|
|
2533
|
+
pctField(
|
|
2534
|
+
"series.overlap",
|
|
2535
|
+
"seriesOverlap",
|
|
2536
|
+
"Series Overlap",
|
|
2537
|
+
series.overlap ?? 0,
|
|
2538
|
+
-100,
|
|
2539
|
+
100,
|
|
2540
|
+
"%",
|
|
2541
|
+
sliders
|
|
2542
|
+
)
|
|
2543
|
+
);
|
|
2544
|
+
}
|
|
2545
|
+
fields.push(
|
|
2546
|
+
pctField(
|
|
2547
|
+
"series.gapWidth",
|
|
2548
|
+
"gapWidth",
|
|
2549
|
+
"Gap Width",
|
|
2550
|
+
series.gapWidth ?? 150,
|
|
2551
|
+
0,
|
|
2552
|
+
500,
|
|
2553
|
+
"%",
|
|
2554
|
+
sliders
|
|
2555
|
+
)
|
|
2556
|
+
);
|
|
2557
|
+
} else if (type === "pie" || type === "pie3D" || type === "doughnut") {
|
|
2558
|
+
fields.push(
|
|
2559
|
+
pctField(
|
|
2560
|
+
"series.firstSliceAngle",
|
|
2561
|
+
"firstSliceAngle",
|
|
2562
|
+
"Angle of first slice",
|
|
2563
|
+
series.firstSliceAngle ?? 0,
|
|
2564
|
+
0,
|
|
2565
|
+
360,
|
|
2566
|
+
"\xB0"
|
|
2567
|
+
)
|
|
2568
|
+
);
|
|
2569
|
+
if (type === "doughnut") {
|
|
2570
|
+
fields.push(
|
|
2571
|
+
pctField(
|
|
2572
|
+
"series.holeSize",
|
|
2573
|
+
"holeSize",
|
|
2574
|
+
"Doughnut Hole Size",
|
|
2575
|
+
series.holeSize ?? 50,
|
|
2576
|
+
10,
|
|
2577
|
+
90
|
|
2578
|
+
)
|
|
2579
|
+
);
|
|
2580
|
+
}
|
|
2581
|
+
} else if (type === "ofPie") {
|
|
2582
|
+
fields.push(
|
|
2583
|
+
pctField("series.gapWidth", "gapWidth", "Gap Width", series.gapWidth ?? 100, 0, 500)
|
|
2584
|
+
);
|
|
2585
|
+
}
|
|
2586
|
+
const section = {
|
|
2587
|
+
id: "seriesOptions",
|
|
2588
|
+
title: t("section.seriesOptions", "Series Options"),
|
|
2589
|
+
fields
|
|
2590
|
+
};
|
|
2591
|
+
if (fields.length === 0) {
|
|
2592
|
+
section.note = t("noSeriesOptions", "This chart type has no series spacing options");
|
|
2593
|
+
}
|
|
2594
|
+
return [section];
|
|
2595
|
+
}
|
|
2596
|
+
function legendOptions(legend) {
|
|
2597
|
+
const fields = [
|
|
2598
|
+
{
|
|
2599
|
+
id: "legend.position",
|
|
2600
|
+
kind: "radio",
|
|
2601
|
+
label: t("legendPosition", "Legend Position"),
|
|
2602
|
+
value: legend.position ?? "r",
|
|
2603
|
+
choices: [
|
|
2604
|
+
choice("t", "legendPos.top", "Top"),
|
|
2605
|
+
choice("b", "legendPos.bottom", "Bottom"),
|
|
2606
|
+
choice("l", "legendPos.left", "Left"),
|
|
2607
|
+
choice("r", "legendPos.right", "Right"),
|
|
2608
|
+
choice("tr", "legendPos.topRight", "Top Right")
|
|
2609
|
+
]
|
|
2610
|
+
}
|
|
2611
|
+
];
|
|
2612
|
+
if (legend.overlaySupported !== false) {
|
|
2613
|
+
fields.push({
|
|
2614
|
+
id: "legend.noOverlap",
|
|
2615
|
+
kind: "checkbox",
|
|
2616
|
+
label: t("legendNoOverlap", "Show the legend without overlapping the chart"),
|
|
2617
|
+
value: legend.overlay === false
|
|
2618
|
+
});
|
|
2619
|
+
}
|
|
2620
|
+
return [{ id: "legendOptions", title: t("section.legendOptions", "Legend Options"), fields }];
|
|
2621
|
+
}
|
|
2622
|
+
function labelPositions(type) {
|
|
2623
|
+
if (type === "pie" || type === "pie3D" || type === "ofPie") {
|
|
2624
|
+
return [
|
|
2625
|
+
["ctr", "center", "Center"],
|
|
2626
|
+
["inEnd", "insideEnd", "Inside End"],
|
|
2627
|
+
["outEnd", "outsideEnd", "Outside End"],
|
|
2628
|
+
["bestFit", "bestFit", "Best Fit"]
|
|
2629
|
+
];
|
|
2630
|
+
}
|
|
2631
|
+
if (type === "bar") {
|
|
2632
|
+
return [
|
|
2633
|
+
["ctr", "center", "Center"],
|
|
2634
|
+
["inEnd", "insideEnd", "Inside End"],
|
|
2635
|
+
["inBase", "insideBase", "Inside Base"],
|
|
2636
|
+
["outEnd", "outsideEnd", "Outside End"]
|
|
2637
|
+
];
|
|
2638
|
+
}
|
|
2639
|
+
if (type === "line" || type === "scatter" || type === "bubble") {
|
|
2640
|
+
return [
|
|
2641
|
+
["ctr", "center", "Center"],
|
|
2642
|
+
["l", "left", "Left"],
|
|
2643
|
+
["r", "right", "Right"],
|
|
2644
|
+
["t", "above", "Above"],
|
|
2645
|
+
["b", "below", "Below"]
|
|
2646
|
+
];
|
|
2647
|
+
}
|
|
2648
|
+
return [];
|
|
2649
|
+
}
|
|
2650
|
+
function labelOptions(labels) {
|
|
2651
|
+
const check = (id, key, fallback, value) => ({
|
|
2652
|
+
id,
|
|
2653
|
+
kind: "checkbox",
|
|
2654
|
+
label: t(key, fallback),
|
|
2655
|
+
value: Boolean(value)
|
|
2656
|
+
});
|
|
2657
|
+
const fields = [
|
|
2658
|
+
check("labels.showSeriesName", "labelSeriesName", "Series Name", labels.showSeriesName),
|
|
2659
|
+
check("labels.showCategory", "labelCategoryName", "Category Name", labels.showCategory),
|
|
2660
|
+
check("labels.showValue", "labelValue", "Value", labels.showValue)
|
|
2661
|
+
];
|
|
2662
|
+
const type = labels.chartType;
|
|
2663
|
+
if (type === "pie" || type === "pie3D" || type === "doughnut" || type === "ofPie") {
|
|
2664
|
+
fields.push(check("labels.showPercent", "labelPercentage", "Percentage", labels.showPercent));
|
|
2665
|
+
}
|
|
2666
|
+
fields.push(check("labels.showLegendKey", "labelLegendKey", "Legend key", labels.showLegendKey));
|
|
2667
|
+
const positions = labelPositions(type);
|
|
2668
|
+
if (positions.length > 0) {
|
|
2669
|
+
fields.push({
|
|
2670
|
+
id: "labels.position",
|
|
2671
|
+
kind: "radio",
|
|
2672
|
+
label: t("labelPosition", "Label Position"),
|
|
2673
|
+
value: labels.position ?? "",
|
|
2674
|
+
choices: positions.map(
|
|
2675
|
+
([value, key, fallback]) => choice(value, `dataLabelPos.${key}`, fallback)
|
|
2676
|
+
)
|
|
2677
|
+
});
|
|
2678
|
+
}
|
|
2679
|
+
const note = labels.seriesScoped ? t("labelsOneSeries", "Label options apply to this series only") : t("labelsAllSeries", "Label options apply to every series");
|
|
2680
|
+
return [{ id: "labelOptions", title: t("section.labelOptions", "Label Options"), fields, note }];
|
|
2681
|
+
}
|
|
2682
|
+
function optionsSections(source, target) {
|
|
2683
|
+
switch (target.kind) {
|
|
2684
|
+
case "series": {
|
|
2685
|
+
const view = source.seriesOptions?.(target.seriesIndex);
|
|
2686
|
+
return view && seriesOptions(view);
|
|
2687
|
+
}
|
|
2688
|
+
case "axis": {
|
|
2689
|
+
const view = source.axisOptions?.(target.axisIndex);
|
|
2690
|
+
return view && axisOptions(view);
|
|
2691
|
+
}
|
|
2692
|
+
case "legend": {
|
|
2693
|
+
const view = source.legendOptions?.();
|
|
2694
|
+
return view && legendOptions(view);
|
|
2695
|
+
}
|
|
2696
|
+
case "dataLabels": {
|
|
2697
|
+
const view = source.labelOptions?.(target.seriesIndex);
|
|
2698
|
+
return view && labelOptions(view);
|
|
2699
|
+
}
|
|
2700
|
+
default:
|
|
2701
|
+
return void 0;
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
var text = (key, fallback, params) => params ? { ...t(key, fallback), params } : t(key, fallback);
|
|
2705
|
+
function axisCaption(info) {
|
|
2706
|
+
if (!info) return text("target.axis", "Axis");
|
|
2707
|
+
if (info.kind === "ser") return text("target.depthAxis", "Depth (Series) Axis");
|
|
2708
|
+
const value = info.kind === "val";
|
|
2709
|
+
const orientation = info.vertical ? "Vertical" : "Horizontal";
|
|
2710
|
+
const id = info.secondary ? `secondary${orientation}` : orientation.toLowerCase();
|
|
2711
|
+
const english = `${info.secondary ? "Secondary " : ""}${orientation} (${value ? "Value" : "Category"}) Axis`;
|
|
2712
|
+
return text(`target.axis.${id}${value ? "Value" : "Category"}`, english);
|
|
2713
|
+
}
|
|
2714
|
+
function chartFormatTargetLabel(target, describe) {
|
|
2715
|
+
switch (target.kind) {
|
|
2716
|
+
case "plotArea":
|
|
2717
|
+
return text("target.plotArea", "Plot Area");
|
|
2718
|
+
case "title":
|
|
2719
|
+
return text("target.title", "Chart Title");
|
|
2720
|
+
case "legend":
|
|
2721
|
+
return text("target.legend", "Legend");
|
|
2722
|
+
case "axis":
|
|
2723
|
+
return axisCaption(describe.axis(target.axisIndex));
|
|
2724
|
+
case "majorGridlines":
|
|
2725
|
+
case "minorGridlines": {
|
|
2726
|
+
const major = target.kind === "majorGridlines";
|
|
2727
|
+
return {
|
|
2728
|
+
...text(
|
|
2729
|
+
major ? "target.majorGridlines" : "target.minorGridlines",
|
|
2730
|
+
major ? "{{axis}} Major Gridlines" : "{{axis}} Minor Gridlines"
|
|
2731
|
+
),
|
|
2732
|
+
paramTexts: { axis: axisCaption(describe.axis(target.axisIndex)) }
|
|
2733
|
+
};
|
|
2734
|
+
}
|
|
2735
|
+
case "series":
|
|
2736
|
+
return text("target.series", 'Series "{{name}}"', {
|
|
2737
|
+
name: describe.seriesName(target.seriesIndex)
|
|
2738
|
+
});
|
|
2739
|
+
case "dataLabels":
|
|
2740
|
+
return target.seriesIndex === void 0 ? text("target.dataLabels", "Data Labels") : text("target.seriesDataLabels", 'Series "{{name}}" Data Labels', {
|
|
2741
|
+
name: describe.seriesName(target.seriesIndex)
|
|
2742
|
+
});
|
|
2743
|
+
default:
|
|
2744
|
+
return text("target.chartArea", "Chart Area");
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
function chartFormatPaneTitle(target) {
|
|
2748
|
+
switch (target.kind) {
|
|
2749
|
+
case "plotArea":
|
|
2750
|
+
return text("title.plotArea", "Format Plot Area");
|
|
2751
|
+
case "title":
|
|
2752
|
+
return text("title.title", "Format Chart Title");
|
|
2753
|
+
case "legend":
|
|
2754
|
+
return text("title.legend", "Format Legend");
|
|
2755
|
+
case "axis":
|
|
2756
|
+
return text("title.axis", "Format Axis");
|
|
2757
|
+
case "majorGridlines":
|
|
2758
|
+
return text("title.majorGridlines", "Format Major Gridlines");
|
|
2759
|
+
case "minorGridlines":
|
|
2760
|
+
return text("title.minorGridlines", "Format Minor Gridlines");
|
|
2761
|
+
case "series":
|
|
2762
|
+
return text("title.series", "Format Data Series");
|
|
2763
|
+
case "dataLabels":
|
|
2764
|
+
return text("title.dataLabels", "Format Data Labels");
|
|
2765
|
+
default:
|
|
2766
|
+
return text("title.chartArea", "Format Chart Area");
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
function chartFormatTargetOptions(targets, describe) {
|
|
2770
|
+
return targets.map((target) => ({
|
|
2771
|
+
key: chartFormatTargetKey(target),
|
|
2772
|
+
target,
|
|
2773
|
+
label: chartFormatTargetLabel(target, describe)
|
|
2774
|
+
}));
|
|
2775
|
+
}
|
|
2776
|
+
var CHART_AREA_TARGET = {
|
|
2777
|
+
key: "chartArea",
|
|
2778
|
+
target: { kind: "chartArea" },
|
|
2779
|
+
label: text("target.chartArea", "Chart Area")
|
|
2780
|
+
};
|
|
2781
|
+
|
|
2782
|
+
// src/chart/format-pane-text.ts
|
|
2783
|
+
function chartTextTabs() {
|
|
2784
|
+
return [
|
|
2785
|
+
{ id: "textFill", label: t("tab.textFill", "Text Fill & Outline") },
|
|
2786
|
+
{ id: "textEffects", label: t("tab.textEffects", "Text Effects") },
|
|
2787
|
+
{ id: "textBox", label: t("tab.textBox", "Textbox") }
|
|
2788
|
+
];
|
|
2789
|
+
}
|
|
2790
|
+
var transparency = (id, value) => ({
|
|
2791
|
+
id,
|
|
2792
|
+
kind: "number",
|
|
2793
|
+
label: t("transparency", "Transparency"),
|
|
2794
|
+
value: pct(value),
|
|
2795
|
+
min: 0,
|
|
2796
|
+
max: 100,
|
|
2797
|
+
step: 1,
|
|
2798
|
+
unit: "%"
|
|
2799
|
+
});
|
|
2800
|
+
function textFillSections(text2) {
|
|
2801
|
+
const fill3 = text2.fill ?? { kind: "automatic" };
|
|
2802
|
+
const fillSection2 = {
|
|
2803
|
+
id: "textFill",
|
|
2804
|
+
title: t("section.textFill", "Text Fill"),
|
|
2805
|
+
fields: [
|
|
2806
|
+
{
|
|
2807
|
+
id: "text.fill.kind",
|
|
2808
|
+
kind: "radio",
|
|
2809
|
+
label: t("section.textFill", "Text Fill"),
|
|
2810
|
+
value: fill3.kind,
|
|
2811
|
+
choices: [
|
|
2812
|
+
choice("none", "fill.none", "No fill"),
|
|
2813
|
+
choice("solid", "fill.solid", "Solid fill"),
|
|
2814
|
+
choice("gradient", "fill.gradient", "Gradient fill"),
|
|
2815
|
+
choice("automatic", "fill.automatic", "Automatic")
|
|
2816
|
+
]
|
|
2817
|
+
}
|
|
2818
|
+
]
|
|
2819
|
+
};
|
|
2820
|
+
if (fill3.kind === "solid") {
|
|
2821
|
+
fillSection2.fields.push(
|
|
2822
|
+
{
|
|
2823
|
+
id: "text.fill.color",
|
|
2824
|
+
kind: "color",
|
|
2825
|
+
label: t("color", "Color"),
|
|
2826
|
+
value: hexForInput(fill3.color)
|
|
2827
|
+
},
|
|
2828
|
+
transparency("text.fill.transparency", fill3.transparency)
|
|
2829
|
+
);
|
|
2830
|
+
} else if (fill3.kind === "gradient" && fill3.gradient) {
|
|
2831
|
+
fillSection2.fields.push(...gradientFields("text.fill", fill3.gradient));
|
|
2832
|
+
}
|
|
2833
|
+
const outline = text2.outline ?? { kind: "automatic" };
|
|
2834
|
+
const outlineSection = {
|
|
2835
|
+
id: "textOutline",
|
|
2836
|
+
title: t("section.textOutline", "Text Outline"),
|
|
2837
|
+
fields: [
|
|
2838
|
+
{
|
|
2839
|
+
id: "text.outline.kind",
|
|
2840
|
+
kind: "radio",
|
|
2841
|
+
label: t("section.textOutline", "Text Outline"),
|
|
2842
|
+
value: outline.kind,
|
|
2843
|
+
choices: [
|
|
2844
|
+
choice("none", "line.none", "No line"),
|
|
2845
|
+
choice("solid", "line.solid", "Solid line"),
|
|
2846
|
+
choice("automatic", "fill.automatic", "Automatic")
|
|
2847
|
+
]
|
|
2848
|
+
}
|
|
2849
|
+
]
|
|
2850
|
+
};
|
|
2851
|
+
if (outline.kind === "solid") {
|
|
2852
|
+
outlineSection.fields.push(
|
|
2853
|
+
{
|
|
2854
|
+
id: "text.outline.color",
|
|
2855
|
+
kind: "color",
|
|
2856
|
+
label: t("color", "Color"),
|
|
2857
|
+
value: hexForInput(outline.color)
|
|
2858
|
+
},
|
|
2859
|
+
transparency("text.outline.transparency", outline.transparency),
|
|
2860
|
+
{
|
|
2861
|
+
id: "text.outline.width",
|
|
2862
|
+
kind: "number",
|
|
2863
|
+
label: t("width", "Width"),
|
|
2864
|
+
value: outline.width ?? 0.75,
|
|
2865
|
+
min: 0,
|
|
2866
|
+
max: 1584,
|
|
2867
|
+
step: 0.25,
|
|
2868
|
+
unit: "pt"
|
|
2869
|
+
}
|
|
2870
|
+
);
|
|
2871
|
+
}
|
|
2872
|
+
return [fillSection2, outlineSection];
|
|
2873
|
+
}
|
|
2874
|
+
function textBoxSection(text2) {
|
|
2875
|
+
return {
|
|
2876
|
+
id: "textBox",
|
|
2877
|
+
title: t("section.textBox", "Text Box"),
|
|
2878
|
+
fields: [
|
|
2879
|
+
{
|
|
2880
|
+
id: "text.anchor",
|
|
2881
|
+
kind: "select",
|
|
2882
|
+
label: t("verticalAlignment", "Vertical alignment"),
|
|
2883
|
+
value: text2.anchor ?? "ctr",
|
|
2884
|
+
choices: [
|
|
2885
|
+
choice("t", "anchor.top", "Top"),
|
|
2886
|
+
choice("ctr", "anchor.middle", "Middle"),
|
|
2887
|
+
choice("b", "anchor.bottom", "Bottom")
|
|
2888
|
+
]
|
|
2889
|
+
},
|
|
2890
|
+
{
|
|
2891
|
+
id: "text.direction",
|
|
2892
|
+
kind: "select",
|
|
2893
|
+
label: t("textDirection", "Text direction"),
|
|
2894
|
+
value: text2.direction ?? "horz",
|
|
2895
|
+
choices: [
|
|
2896
|
+
choice("horz", "direction.horizontal", "Horizontal"),
|
|
2897
|
+
choice("vert", "direction.rotate90", "Rotate all text 90\xB0"),
|
|
2898
|
+
choice("vert270", "direction.rotate270", "Rotate all text 270\xB0"),
|
|
2899
|
+
choice("wordArtVert", "direction.stacked", "Stacked")
|
|
2900
|
+
]
|
|
2901
|
+
},
|
|
2902
|
+
{
|
|
2903
|
+
id: "text.rotation",
|
|
2904
|
+
kind: "number",
|
|
2905
|
+
label: t("customAngle", "Custom angle"),
|
|
2906
|
+
value: text2.rotation ?? "",
|
|
2907
|
+
min: -90,
|
|
2908
|
+
max: 90,
|
|
2909
|
+
step: 1,
|
|
2910
|
+
unit: "\xB0",
|
|
2911
|
+
auto: true
|
|
2912
|
+
}
|
|
2913
|
+
]
|
|
2914
|
+
};
|
|
2915
|
+
}
|
|
2916
|
+
function textOptionsSections(text2, tab) {
|
|
2917
|
+
if (tab === "textEffects") {
|
|
2918
|
+
return [shadowSection("text.", text2.effects?.shadow), glowSection("text.", text2.effects?.glow)];
|
|
2919
|
+
}
|
|
2920
|
+
return tab === "textBox" ? [textBoxSection(text2)] : textFillSections(text2);
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
// src/chart/format-pane-model.ts
|
|
2924
|
+
function resolveChartFormatSourceTarget(source, key) {
|
|
2925
|
+
const match = key ? source?.targets.find((option) => option.key === key) : void 0;
|
|
2926
|
+
return match ?? (key ? source?.resolve?.(key) : void 0) ?? source?.targets[0] ?? CHART_AREA_TARGET;
|
|
2927
|
+
}
|
|
2928
|
+
var hasText = (view) => view.support.text && view.text !== void 0;
|
|
2929
|
+
var hasEffects = (view) => view.support.effects !== false && view.effects !== void 0;
|
|
2930
|
+
function optionsLabel(target) {
|
|
2931
|
+
switch (target.kind) {
|
|
2932
|
+
case "series":
|
|
2933
|
+
return t("tab.seriesOptions", "Series Options");
|
|
2934
|
+
case "axis":
|
|
2935
|
+
return t("tab.axisOptions", "Axis Options");
|
|
2936
|
+
case "legend":
|
|
2937
|
+
return t("tab.legendOptions", "Legend Options");
|
|
2938
|
+
default:
|
|
2939
|
+
return t("tab.labelOptions", "Label Options");
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
function chartFormatSourceTabs(source, target, mode = "chart") {
|
|
2943
|
+
const view = source.element(target);
|
|
2944
|
+
if (mode === "text" && hasText(view)) return chartTextTabs();
|
|
2945
|
+
const tabs = [{ id: "fillLine", label: t("tab.fillLine", "Fill & Line") }];
|
|
2946
|
+
if (hasEffects(view)) tabs.push({ id: "effects", label: t("tab.effects", "Effects") });
|
|
2947
|
+
if (optionsSections(source, target)) tabs.push({ id: "options", label: optionsLabel(target) });
|
|
2948
|
+
return tabs;
|
|
2949
|
+
}
|
|
2950
|
+
function tabSections(source, target, view, tab) {
|
|
2951
|
+
switch (tab) {
|
|
2952
|
+
case "textFill":
|
|
2953
|
+
case "textEffects":
|
|
2954
|
+
case "textBox":
|
|
2955
|
+
return view.text ? textOptionsSections(view.text, tab) : [];
|
|
2956
|
+
case "effects":
|
|
2957
|
+
return hasEffects(view) ? effectsSections(view) : [];
|
|
2958
|
+
case "options":
|
|
2959
|
+
return optionsSections(source, target) ?? [];
|
|
2960
|
+
default:
|
|
2961
|
+
return fillLineSections(view, target, source);
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
function buildChartFormatModel(source, targetKey, tab = "fillLine", mode = "chart") {
|
|
2965
|
+
const resolved = resolveChartFormatSourceTarget(source, targetKey);
|
|
2966
|
+
const view = source.element(resolved.target);
|
|
2967
|
+
const activeMode = mode === "text" && hasText(view) ? "text" : "chart";
|
|
2968
|
+
const tabs = chartFormatSourceTabs(source, resolved.target, activeMode);
|
|
2969
|
+
const activeTab = tabs.some((candidate) => candidate.id === tab) ? tab : tabs[0].id;
|
|
2970
|
+
const flat = Boolean(source.flat) && activeMode === "chart";
|
|
2971
|
+
const sections = flat ? tabs.flatMap((entry) => tabSections(source, resolved.target, view, entry.id)) : tabSections(source, resolved.target, view, activeTab);
|
|
2972
|
+
return {
|
|
2973
|
+
title: chartFormatPaneTitle(resolved.target),
|
|
2974
|
+
targetKey: resolved.key,
|
|
2975
|
+
target: resolved.target,
|
|
2976
|
+
targets: [...source.targets],
|
|
2977
|
+
picker: source.picker ?? t("chartOptions", "Chart Options"),
|
|
2978
|
+
tabs: flat ? [] : tabs,
|
|
2979
|
+
activeTab: flat ? "fillLine" : activeTab,
|
|
2980
|
+
sections,
|
|
2981
|
+
mode: activeMode,
|
|
2982
|
+
textOptions: hasText(view)
|
|
2983
|
+
};
|
|
2984
|
+
}
|
|
2985
|
+
var transparency2 = (alpha) => Math.round((1 - alpha) * 100);
|
|
2986
|
+
function fillView(fill3, resolve) {
|
|
2987
|
+
switch (fill3?.kind) {
|
|
2988
|
+
case "none":
|
|
2989
|
+
return { kind: "none" };
|
|
2990
|
+
case "solid": {
|
|
2991
|
+
const color = resolve(fill3.color);
|
|
2992
|
+
return color ? { kind: "solid", color: color.hex, transparency: transparency2(color.alpha) } : { kind: "solid" };
|
|
2993
|
+
}
|
|
2994
|
+
case "gradient":
|
|
2995
|
+
return { kind: "gradient", gradient: resolveChartGradient(fill3, resolve) };
|
|
2996
|
+
case "pattern":
|
|
2997
|
+
return { kind: "pattern" };
|
|
2998
|
+
case "picture":
|
|
2999
|
+
return { kind: "picture" };
|
|
3000
|
+
default:
|
|
3001
|
+
return { kind: "automatic" };
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
function lineView(line, resolve) {
|
|
3005
|
+
const paint = fillView(line?.fill, resolve);
|
|
3006
|
+
const kind = paint.kind === "pattern" || paint.kind === "picture" ? "automatic" : paint.kind;
|
|
3007
|
+
return {
|
|
3008
|
+
kind,
|
|
3009
|
+
...paint.color === void 0 ? {} : { color: paint.color },
|
|
3010
|
+
...paint.transparency === void 0 ? {} : { transparency: paint.transparency },
|
|
3011
|
+
...paint.gradient === void 0 ? {} : { gradient: paint.gradient },
|
|
3012
|
+
...line?.widthEmu === void 0 ? {} : { width: Math.round(line.widthEmu / 12700 * 100) / 100 },
|
|
3013
|
+
...line?.dash === void 0 ? {} : { dash: line.dash },
|
|
3014
|
+
...line?.cap === void 0 ? {} : { cap: line.cap }
|
|
3015
|
+
};
|
|
3016
|
+
}
|
|
3017
|
+
var chartTypeOf = (group) => group.element.replace(/Chart$/u, "");
|
|
3018
|
+
var vertical = (axis, space) => {
|
|
3019
|
+
if (axis.position) return axis.position === "l" || axis.position === "r";
|
|
3020
|
+
const horizontalBars = space.plotArea.groups.some((group) => group.barDirection === "bar");
|
|
3021
|
+
return axis.kind === "val" ? !horizontalBars : horizontalBars;
|
|
3022
|
+
};
|
|
3023
|
+
var seriesName = (series, index) => series?.tx?.text || series?.tx?.value || `Series ${index + 1}`;
|
|
3024
|
+
function axisView(axis) {
|
|
3025
|
+
const view = {
|
|
3026
|
+
kind: axis.kind,
|
|
3027
|
+
reverse: axis.scaling.orientation === "maxMin",
|
|
3028
|
+
logScale: axis.scaling.logBase !== void 0,
|
|
3029
|
+
numberFormat: axis.numberFormat && !axis.numberFormat.sourceLinked ? axis.numberFormat.formatCode : ""
|
|
3030
|
+
};
|
|
3031
|
+
const copy = (key, value) => {
|
|
3032
|
+
if (value !== void 0) view[key] = value;
|
|
3033
|
+
};
|
|
3034
|
+
copy("min", axis.scaling.min);
|
|
3035
|
+
copy("max", axis.scaling.max);
|
|
3036
|
+
copy("logBase", axis.scaling.logBase);
|
|
3037
|
+
copy("majorUnit", axis.majorUnit);
|
|
3038
|
+
copy("minorUnit", axis.minorUnit);
|
|
3039
|
+
copy("crosses", axis.crosses);
|
|
3040
|
+
copy("crossesAt", axis.crossesAt);
|
|
3041
|
+
copy("displayUnits", axis.displayUnits?.builtInUnit);
|
|
3042
|
+
copy("majorTickMark", axis.majorTickMark);
|
|
3043
|
+
copy("minorTickMark", axis.minorTickMark);
|
|
3044
|
+
copy("tickLabelPosition", axis.tickLabelPosition);
|
|
3045
|
+
return view;
|
|
3046
|
+
}
|
|
3047
|
+
function targetsOf(space) {
|
|
3048
|
+
const targets = [{ kind: "chartArea" }];
|
|
3049
|
+
if (space.title) targets.push({ kind: "title" });
|
|
3050
|
+
space.plotArea.axes.forEach((axis, axisIndex) => {
|
|
3051
|
+
if (axis.deleted) return;
|
|
3052
|
+
targets.push({ kind: "axis", axisIndex });
|
|
3053
|
+
if (axis.majorGridlines) targets.push({ kind: "majorGridlines", axisIndex });
|
|
3054
|
+
if (axis.minorGridlines) targets.push({ kind: "minorGridlines", axisIndex });
|
|
3055
|
+
});
|
|
3056
|
+
if (space.legend) targets.push({ kind: "legend" });
|
|
3057
|
+
targets.push({ kind: "plotArea" });
|
|
3058
|
+
if (space.plotArea.groups.some((group) => group.dataLabels && !group.dataLabels.deleted))
|
|
3059
|
+
targets.push({ kind: "dataLabels" });
|
|
3060
|
+
chartSeriesEntries(space).forEach((_, seriesIndex) => {
|
|
3061
|
+
targets.push({ kind: "series", seriesIndex }, { kind: "dataLabels", seriesIndex });
|
|
3062
|
+
});
|
|
3063
|
+
return targets;
|
|
3064
|
+
}
|
|
3065
|
+
function chartSpaceFormatSource(space, options = {}) {
|
|
3066
|
+
const resolve = (color) => {
|
|
3067
|
+
const resolved = resolveDrawingColor(color, options.theme);
|
|
3068
|
+
return resolved && { hex: resolved.hex, alpha: resolved.alpha };
|
|
3069
|
+
};
|
|
3070
|
+
const entries = chartSeriesEntries(space);
|
|
3071
|
+
const describe = {
|
|
3072
|
+
axis: (axisIndex) => {
|
|
3073
|
+
const axis = space.plotArea.axes[axisIndex];
|
|
3074
|
+
if (!axis) return void 0;
|
|
3075
|
+
const secondary = space.plotArea.axes.slice(0, axisIndex).some((other) => other.kind === axis.kind);
|
|
3076
|
+
return { kind: axis.kind, vertical: vertical(axis, space), secondary };
|
|
3077
|
+
},
|
|
3078
|
+
seriesName: (seriesIndex) => seriesName(entries[seriesIndex]?.series, seriesIndex)
|
|
3079
|
+
};
|
|
3080
|
+
const element = (target) => {
|
|
3081
|
+
const lineTarget = target.kind === "axis" || target.kind === "majorGridlines" || target.kind === "minorGridlines" || target.kind === "series" && entries[target.seriesIndex] !== void 0 && chartGroupPaintsLine(entries[target.seriesIndex].group);
|
|
3082
|
+
let shape;
|
|
3083
|
+
try {
|
|
3084
|
+
shape = chartTargetShape(space, target);
|
|
3085
|
+
} catch {
|
|
3086
|
+
shape = void 0;
|
|
3087
|
+
}
|
|
3088
|
+
return {
|
|
3089
|
+
support: {
|
|
3090
|
+
fill: !lineTarget,
|
|
3091
|
+
gradient: true,
|
|
3092
|
+
pattern: false,
|
|
3093
|
+
picture: false,
|
|
3094
|
+
threeD: false,
|
|
3095
|
+
text: false,
|
|
3096
|
+
lineDetails: false,
|
|
3097
|
+
effects: false
|
|
3098
|
+
},
|
|
3099
|
+
fill: fillView(shape?.fill, resolve),
|
|
3100
|
+
line: lineView(shape?.line, resolve)
|
|
3101
|
+
};
|
|
3102
|
+
};
|
|
3103
|
+
const labels = (seriesIndex) => {
|
|
3104
|
+
const entry = seriesIndex === void 0 ? void 0 : entries[seriesIndex];
|
|
3105
|
+
if (seriesIndex !== void 0 && !entry) return void 0;
|
|
3106
|
+
const group = entry?.group ?? space.plotArea.groups[0];
|
|
3107
|
+
const chart = group?.dataLabels;
|
|
3108
|
+
const own = entry?.series.dataLabels;
|
|
3109
|
+
const pick = (key) => own?.[key] ?? chart?.[key];
|
|
3110
|
+
const view = { seriesScoped: entry !== void 0 };
|
|
3111
|
+
const set = (key, value) => {
|
|
3112
|
+
if (value !== void 0) view[key] = value;
|
|
3113
|
+
};
|
|
3114
|
+
set("chartType", group && chartTypeOf(group));
|
|
3115
|
+
set("showSeriesName", pick("showSeriesName"));
|
|
3116
|
+
set("showCategory", pick("showCategoryName"));
|
|
3117
|
+
set("showValue", pick("showValue"));
|
|
3118
|
+
set("showPercent", pick("showPercent"));
|
|
3119
|
+
set("showLegendKey", pick("showLegendKey"));
|
|
3120
|
+
set("position", pick("position"));
|
|
3121
|
+
return view;
|
|
3122
|
+
};
|
|
3123
|
+
return {
|
|
3124
|
+
targets: chartFormatTargetOptions(targetsOf(space), describe),
|
|
3125
|
+
textOptions: false,
|
|
3126
|
+
element,
|
|
3127
|
+
seriesOptions: (seriesIndex) => {
|
|
3128
|
+
const group = entries[seriesIndex]?.group;
|
|
3129
|
+
if (!group) return void 0;
|
|
3130
|
+
const view = { chartType: chartTypeOf(group) };
|
|
3131
|
+
if (group.overlap !== void 0) view.overlap = group.overlap;
|
|
3132
|
+
if (group.gapWidth !== void 0) view.gapWidth = group.gapWidth;
|
|
3133
|
+
if (group.firstSliceAngle !== void 0) view.firstSliceAngle = group.firstSliceAngle;
|
|
3134
|
+
if (group.holeSize !== void 0) view.holeSize = group.holeSize;
|
|
3135
|
+
return view;
|
|
3136
|
+
},
|
|
3137
|
+
axisOptions: (axisIndex) => {
|
|
3138
|
+
const axis = space.plotArea.axes[axisIndex];
|
|
3139
|
+
return axis && axisView(axis);
|
|
3140
|
+
},
|
|
3141
|
+
legendOptions: () => space.legend && {
|
|
3142
|
+
...space.legend.position === void 0 ? {} : { position: space.legend.position },
|
|
3143
|
+
overlay: space.legend.overlay ?? false
|
|
3144
|
+
},
|
|
3145
|
+
labelOptions: labels
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
var chartFormatLocale = (value) => normalizeLocale(value, CHART_FORMAT_LOCALES, "en");
|
|
3149
|
+
function chartFormatTranslator(locale, override) {
|
|
3150
|
+
const strings = CHART_FORMAT_STRINGS[chartFormatLocale(locale)];
|
|
3151
|
+
return (key, params, fallback) => {
|
|
3152
|
+
const own = override?.(key, params, fallback);
|
|
3153
|
+
if (own && own !== key) return own;
|
|
3154
|
+
return strings[key] ?? CHART_FORMAT_STRINGS.en[key] ?? key;
|
|
3155
|
+
};
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
// src/chart/format-pane.ts
|
|
3159
|
+
var echo = (key) => key;
|
|
3160
|
+
var OfficeUiChartFormatPane = class extends OfficeElement {
|
|
3161
|
+
static editEvent = "office-chart-format-edit";
|
|
3162
|
+
static targetEvent = "office-chart-format-target";
|
|
3163
|
+
static closeEvent = "office-chart-format-close";
|
|
3164
|
+
static controlTags = {
|
|
3165
|
+
select: "select",
|
|
3166
|
+
radio: "office-ui-radio",
|
|
3167
|
+
checkbox: "office-ui-checkbox"
|
|
3168
|
+
};
|
|
3169
|
+
static styles = controlStyles(range_control_default, format_pane_default);
|
|
3170
|
+
static properties = { disabled: flag };
|
|
3171
|
+
/** Properties a host may set before the element is defined; replayed through their setters. */
|
|
3172
|
+
static replayed = [
|
|
3173
|
+
"source",
|
|
3174
|
+
"chartSpace",
|
|
3175
|
+
"theme",
|
|
3176
|
+
"target",
|
|
3177
|
+
"translateLabel",
|
|
3178
|
+
"locale"
|
|
3179
|
+
];
|
|
3180
|
+
sourceValue;
|
|
3181
|
+
spaceValue;
|
|
3182
|
+
themeValue;
|
|
3183
|
+
targetValue = "chartArea";
|
|
3184
|
+
translator = echo;
|
|
3185
|
+
localeValue = "en";
|
|
3186
|
+
/** The translator captions go through: the product's, then the pane's own dictionary. */
|
|
3187
|
+
captions = chartFormatTranslator("en");
|
|
3188
|
+
paneTab = "fillLine";
|
|
3189
|
+
paneMode = "chart";
|
|
3190
|
+
collapsed = /* @__PURE__ */ new Set();
|
|
3191
|
+
/** After an edit, write the model's values even into the focused box (a refused value). */
|
|
3192
|
+
forceSync = false;
|
|
3193
|
+
/** The pane title, the host's accessible name. */
|
|
3194
|
+
hostLabel = "";
|
|
3195
|
+
/** The value each box and select was last given, to tell typing from a stale value. */
|
|
3196
|
+
synced = /* @__PURE__ */ new WeakMap();
|
|
3197
|
+
constructor() {
|
|
3198
|
+
super();
|
|
3199
|
+
this.disabled = false;
|
|
3200
|
+
}
|
|
3201
|
+
connectedCallback() {
|
|
3202
|
+
const self = this;
|
|
3203
|
+
for (const name of this.constructor.replayed) {
|
|
3204
|
+
if (!Object.prototype.hasOwnProperty.call(this, name)) continue;
|
|
3205
|
+
const value = self[name];
|
|
3206
|
+
delete self[name];
|
|
3207
|
+
self[name] = value;
|
|
3208
|
+
}
|
|
3209
|
+
super.connectedCallback();
|
|
3210
|
+
}
|
|
3211
|
+
/** What the pane reads; replaces `chartSpace`. */
|
|
3212
|
+
get source() {
|
|
3213
|
+
return this.sourceValue;
|
|
3214
|
+
}
|
|
3215
|
+
set source(value) {
|
|
3216
|
+
this.sourceValue = value;
|
|
3217
|
+
this.spaceValue = void 0;
|
|
3218
|
+
this.requestUpdate("source");
|
|
3219
|
+
}
|
|
3220
|
+
/** A chart part model, read through `chartSpaceFormatSource` with `theme`. */
|
|
3221
|
+
get chartSpace() {
|
|
3222
|
+
return this.spaceValue;
|
|
3223
|
+
}
|
|
3224
|
+
set chartSpace(value) {
|
|
3225
|
+
this.spaceValue = value;
|
|
3226
|
+
this.sourceValue = value && chartSpaceFormatSource(value, this.themeOptions());
|
|
3227
|
+
this.requestUpdate("chartSpace");
|
|
3228
|
+
}
|
|
3229
|
+
/** Resolves scheme colours of a `chartSpace`. */
|
|
3230
|
+
get theme() {
|
|
3231
|
+
return this.themeValue;
|
|
3232
|
+
}
|
|
3233
|
+
set theme(value) {
|
|
3234
|
+
this.themeValue = value;
|
|
3235
|
+
if (this.spaceValue) this.chartSpace = this.spaceValue;
|
|
3236
|
+
}
|
|
3237
|
+
/** The element the pane formats (`chartArea`, `series:0`, `axis:1`, ...). */
|
|
3238
|
+
get target() {
|
|
3239
|
+
return this.targetValue;
|
|
3240
|
+
}
|
|
3241
|
+
set target(value) {
|
|
3242
|
+
this.targetValue = value || "chartArea";
|
|
3243
|
+
this.requestUpdate("target");
|
|
3244
|
+
}
|
|
3245
|
+
/** Translates captions: `(key, params, fallback)`, returning the key when it has none. */
|
|
3246
|
+
get translateLabel() {
|
|
3247
|
+
return this.translator;
|
|
3248
|
+
}
|
|
3249
|
+
set translateLabel(value) {
|
|
3250
|
+
this.translator = value ?? echo;
|
|
3251
|
+
this.captions = chartFormatTranslator(this.localeValue, this.translator);
|
|
3252
|
+
this.requestUpdate("translateLabel");
|
|
3253
|
+
}
|
|
3254
|
+
/**
|
|
3255
|
+
* The display locale of the pane's own captions (`en`, `fr`, `de`, `es`, `zh-CN`; any BCP 47
|
|
3256
|
+
* tag maps onto them). `translateLabel` still wins where it knows a key.
|
|
3257
|
+
*/
|
|
3258
|
+
get locale() {
|
|
3259
|
+
return this.localeValue;
|
|
3260
|
+
}
|
|
3261
|
+
set locale(value) {
|
|
3262
|
+
this.localeValue = value || "en";
|
|
3263
|
+
this.captions = chartFormatTranslator(this.localeValue, this.translator);
|
|
3264
|
+
this.requestUpdate("locale");
|
|
3265
|
+
}
|
|
3266
|
+
themeOptions() {
|
|
3267
|
+
return this.themeValue ? { theme: this.themeValue } : {};
|
|
3268
|
+
}
|
|
3269
|
+
statics() {
|
|
3270
|
+
return this.constructor;
|
|
3271
|
+
}
|
|
3272
|
+
tr = (text2) => translateChartFormatText(text2, (key, params, fallback) => this.captions(key, params, fallback));
|
|
3273
|
+
label(key, fallback) {
|
|
3274
|
+
return this.tr({ key: `chartFormat.${key}`, fallback });
|
|
3275
|
+
}
|
|
3276
|
+
/** The pane for the current source, target, tab and mode, or undefined without a source. */
|
|
3277
|
+
model() {
|
|
3278
|
+
const source = this.sourceValue;
|
|
3279
|
+
return source && buildChartFormatModel(source, this.targetValue, this.paneTab, this.paneMode);
|
|
3280
|
+
}
|
|
3281
|
+
/** A committed field: its edit (with the neutral intent) goes to {@link commit}. */
|
|
3282
|
+
edit(field, value) {
|
|
3283
|
+
const source = this.sourceValue;
|
|
3284
|
+
const model = this.model();
|
|
3285
|
+
if (this.disabled || !source || !model) {
|
|
3286
|
+
this.refreshValues();
|
|
3287
|
+
return;
|
|
3288
|
+
}
|
|
3289
|
+
const view = source.element(model.target);
|
|
3290
|
+
this.commit({
|
|
3291
|
+
target: model.targetKey,
|
|
3292
|
+
field,
|
|
3293
|
+
value,
|
|
3294
|
+
intent: chartFormatFieldIntent(view, model.target, field, value)
|
|
3295
|
+
});
|
|
3296
|
+
this.refreshValues();
|
|
3297
|
+
}
|
|
3298
|
+
/**
|
|
3299
|
+
* Fires the edit event. A product subclass that applies edits itself overrides this (PowerPoint
|
|
3300
|
+
* maps the edit onto its own chart model); either way the pane repaints afterwards.
|
|
3301
|
+
*/
|
|
3302
|
+
commit(edit) {
|
|
3303
|
+
emit(this, this.statics().editEvent, edit);
|
|
3304
|
+
}
|
|
3305
|
+
/** Repaints every value from the model, even the box being typed in (a refused value). */
|
|
3306
|
+
refreshValues() {
|
|
3307
|
+
this.forceSync = true;
|
|
3308
|
+
this.requestUpdate();
|
|
3309
|
+
}
|
|
3310
|
+
pickTarget(target) {
|
|
3311
|
+
this.targetValue = target;
|
|
3312
|
+
this.requestUpdate("target");
|
|
3313
|
+
emit(this, this.statics().targetEvent, { target });
|
|
3314
|
+
}
|
|
3315
|
+
requestClose() {
|
|
3316
|
+
emit(this, this.statics().closeEvent, void 0);
|
|
3317
|
+
}
|
|
3318
|
+
toggleText() {
|
|
3319
|
+
this.paneMode = this.paneMode === "text" ? "chart" : "text";
|
|
3320
|
+
this.paneTab = this.paneMode === "text" ? "textFill" : "fillLine";
|
|
3321
|
+
this.requestUpdate();
|
|
3322
|
+
}
|
|
3323
|
+
onKey = (event) => {
|
|
3324
|
+
event.stopPropagation();
|
|
3325
|
+
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
3326
|
+
event.preventDefault();
|
|
3327
|
+
this.requestClose();
|
|
3328
|
+
}
|
|
3329
|
+
};
|
|
3330
|
+
preview = (id, value, text2) => {
|
|
3331
|
+
const field = CSS.escape(id);
|
|
3332
|
+
const box = this.renderRoot.querySelector(
|
|
3333
|
+
`[data-chart-format-field="${field}"] input`
|
|
3334
|
+
);
|
|
3335
|
+
if (box) box.value = String(value);
|
|
3336
|
+
this.renderRoot.querySelector(`[data-chart-format-slider="${field}"] input`)?.setAttribute("aria-valuetext", text2);
|
|
3337
|
+
};
|
|
3338
|
+
section(section, ctx) {
|
|
3339
|
+
const open = !this.collapsed.has(section.id);
|
|
3340
|
+
const toggle = () => {
|
|
3341
|
+
if (open) this.collapsed.add(section.id);
|
|
3342
|
+
else this.collapsed.delete(section.id);
|
|
3343
|
+
this.requestUpdate();
|
|
3344
|
+
};
|
|
3345
|
+
const body = section.slot ? html`<slot name=${section.slot}></slot>` : html`${repeat(
|
|
3346
|
+
section.fields,
|
|
3347
|
+
(field) => field.id,
|
|
3348
|
+
(field) => fieldTemplate(field, ctx)
|
|
3349
|
+
)}${section.note ? html`<p class="note">${this.tr(section.note)}</p>` : nothing}`;
|
|
3350
|
+
return html`<section data-chart-format-section=${section.id}
|
|
3351
|
+
><button type="button" class="section-toggle" aria-expanded=${String(open)} @click=${toggle}
|
|
3352
|
+
>${this.tr(section.title)}</button
|
|
3353
|
+
><div class="fields" ?hidden=${!open}>${body}</div></section
|
|
3354
|
+
>`;
|
|
3355
|
+
}
|
|
3356
|
+
render() {
|
|
3357
|
+
const model = this.model();
|
|
3358
|
+
const closeLabel = this.label("close", "Close");
|
|
3359
|
+
const header = html`<header
|
|
3360
|
+
><h3>${model ? this.tr(model.title) : ""}</h3
|
|
3361
|
+
><button
|
|
3362
|
+
type="button"
|
|
3363
|
+
class="close"
|
|
3364
|
+
data-chart-format-close
|
|
3365
|
+
aria-label=${closeLabel}
|
|
3366
|
+
title=${closeLabel}
|
|
3367
|
+
@click=${() => this.requestClose()}
|
|
3368
|
+
>×</button
|
|
3369
|
+
></header
|
|
3370
|
+
>`;
|
|
3371
|
+
if (!model) {
|
|
3372
|
+
this.hostLabel = "";
|
|
3373
|
+
return html`<div class="panel">${header}</div>`;
|
|
3374
|
+
}
|
|
3375
|
+
this.paneTab = model.activeTab;
|
|
3376
|
+
this.paneMode = model.mode;
|
|
3377
|
+
const title = this.tr(model.title);
|
|
3378
|
+
this.hostLabel = title;
|
|
3379
|
+
const tags = this.statics().controlTags;
|
|
3380
|
+
const picker = this.tr(model.picker);
|
|
3381
|
+
const select = unsafeStatic(tags.select);
|
|
3382
|
+
const ctx = {
|
|
3383
|
+
tags,
|
|
3384
|
+
tr: this.tr,
|
|
3385
|
+
change: (id, value) => this.edit(id, value),
|
|
3386
|
+
preview: this.preview,
|
|
3387
|
+
locked: this.disabled,
|
|
3388
|
+
autoLabel: this.label("automatic", "Auto")
|
|
3389
|
+
};
|
|
3390
|
+
const textToggle = this.sourceValue?.textOptions === false ? nothing : html`<button
|
|
3391
|
+
type="button"
|
|
3392
|
+
class="text-options"
|
|
3393
|
+
data-chart-format-text-options
|
|
3394
|
+
aria-pressed=${String(model.mode === "text")}
|
|
3395
|
+
title=${model.textOptions ? this.label("textOptionsHint", "Fill, outline, effects and text box of the text") : this.label("textOptionsNone", "This element has no text")}
|
|
3396
|
+
?disabled=${this.disabled || !model.textOptions}
|
|
3397
|
+
@click=${() => this.toggleText()}
|
|
3398
|
+
>${this.label("textOptions", "Text Options")}</button
|
|
3399
|
+
>`;
|
|
3400
|
+
const tabs = model.tabs.length ? html`<div class="tabs" role="tablist" aria-label=${this.label("tabs", "Format categories")}
|
|
3401
|
+
>${model.tabs.map(
|
|
3402
|
+
(tab) => html`<button
|
|
3403
|
+
type="button"
|
|
3404
|
+
role="tab"
|
|
3405
|
+
data-chart-format-tab=${tab.id}
|
|
3406
|
+
aria-selected=${String(tab.id === model.activeTab)}
|
|
3407
|
+
tabindex=${tab.id === model.activeTab ? 0 : -1}
|
|
3408
|
+
@click=${() => {
|
|
3409
|
+
this.paneTab = tab.id;
|
|
3410
|
+
this.requestUpdate();
|
|
3411
|
+
}}
|
|
3412
|
+
>${this.tr(tab.label)}</button
|
|
3413
|
+
>`
|
|
3414
|
+
)}</div
|
|
3415
|
+
>` : nothing;
|
|
3416
|
+
return html`<div
|
|
3417
|
+
class="panel"
|
|
3418
|
+
data-chart-format-pane
|
|
3419
|
+
data-chart-format-mode=${model.mode}
|
|
3420
|
+
data-chart-format-target-key=${model.targetKey}
|
|
3421
|
+
@keydown=${this.onKey}
|
|
3422
|
+
>${header}<div class="options-row"
|
|
3423
|
+
><label class="picker"
|
|
3424
|
+
><span>${picker}</span>${html$1`<${select}
|
|
3425
|
+
data-chart-format-target
|
|
3426
|
+
aria-label=${picker}
|
|
3427
|
+
data-value=${model.targetKey}
|
|
3428
|
+
?disabled=${this.disabled}
|
|
3429
|
+
@change=${(event) => this.pickTarget(event.currentTarget.value)}
|
|
3430
|
+
>${model.targets.map(
|
|
3431
|
+
(option) => html`<option value=${option.key} .selected=${live(option.key === model.targetKey)}
|
|
3432
|
+
>${this.tr(option.label)}</option
|
|
3433
|
+
>`
|
|
3434
|
+
)}</${select}>`}</label
|
|
3435
|
+
>${textToggle}</div
|
|
3436
|
+
>${tabs}<div class="content" role="tabpanel"
|
|
3437
|
+
>${repeat(
|
|
3438
|
+
model.sections,
|
|
3439
|
+
(section) => section.id,
|
|
3440
|
+
(section) => this.section(section, ctx)
|
|
3441
|
+
)}</div
|
|
3442
|
+
></div
|
|
3443
|
+
>`;
|
|
3444
|
+
}
|
|
3445
|
+
updated(changed) {
|
|
3446
|
+
super.updated(changed);
|
|
3447
|
+
this.setAttribute("role", "complementary");
|
|
3448
|
+
if (this.hostLabel) this.setAttribute("aria-label", this.hostLabel);
|
|
3449
|
+
else this.removeAttribute("aria-label");
|
|
3450
|
+
const force = this.forceSync;
|
|
3451
|
+
this.forceSync = false;
|
|
3452
|
+
for (const node of this.renderRoot.querySelectorAll(
|
|
3453
|
+
"[data-value]"
|
|
3454
|
+
)) {
|
|
3455
|
+
const value = node.dataset.value ?? "";
|
|
3456
|
+
const typing = node.matches(":focus, :focus-within") && node.value !== (this.synced.get(node) ?? value);
|
|
3457
|
+
if (node.value !== value && (force || !typing)) node.value = value;
|
|
3458
|
+
this.synced.set(node, value);
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3461
|
+
};
|
|
3462
|
+
var defineChartFormatPane = definer(
|
|
3463
|
+
"office-ui-chart-format-pane",
|
|
3464
|
+
() => OfficeUiChartFormatPane,
|
|
3465
|
+
[defineRadio, defineCheckbox]
|
|
3466
|
+
);
|
|
3467
|
+
|
|
1409
3468
|
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/chrome/print-preview.css?raw
|
|
1410
3469
|
var print_preview_default = ":host {\n display: block;\n max-width: var(--office-print-preview-width);\n font: var(--office-font-size-sm) var(--office-font);\n color: var(--office-foreground);\n}\n.sheet {\n padding: var(--office-space-3);\n border: var(--office-border-width) solid var(--office-border);\n background: var(--office-paper);\n box-shadow: var(--office-shadow-sm);\n}\n.sheet > * {\n display: block;\n width: 100%;\n height: auto;\n}\n.empty {\n color: var(--office-muted-foreground);\n}\n.nav {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--office-space-2);\n margin-top: var(--office-space-2);\n}\n.nav[hidden] {\n display: none;\n}\nbutton {\n min-width: var(--office-target-size);\n min-height: var(--office-target-size);\n font: inherit;\n color: inherit;\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius-sm);\n background: var(--office-background);\n cursor: pointer;\n}\nbutton:disabled {\n opacity: 0.5;\n cursor: default;\n}\nbutton:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: calc(var(--office-focus-offset) / 2);\n}\n";
|
|
1411
3470
|
|
|
@@ -1466,12 +3525,12 @@ var OfficeUiPrintPreview = class extends OfficeElement {
|
|
|
1466
3525
|
}
|
|
1467
3526
|
render() {
|
|
1468
3527
|
const total = this.list.length;
|
|
1469
|
-
const
|
|
3528
|
+
const label2 = this.label ?? "Print preview";
|
|
1470
3529
|
return html`
|
|
1471
3530
|
<div
|
|
1472
3531
|
class="sheet"
|
|
1473
3532
|
role="img"
|
|
1474
|
-
aria-label=${total > 1 ? `${
|
|
3533
|
+
aria-label=${total > 1 ? `${label2}, page ${this.current + 1} of ${total}` : label2}
|
|
1475
3534
|
>${this.clone ?? html`<p class="empty">${this.emptyLabel ?? "Nothing to print."}</p>`}</div
|
|
1476
3535
|
>
|
|
1477
3536
|
<div class="nav" ?hidden=${total < 2}>
|
|
@@ -1662,8 +3721,8 @@ var OfficeUiRibbon = class extends OfficeElement {
|
|
|
1662
3721
|
const tabs = [...this.renderRoot.querySelectorAll('[role="tab"]')];
|
|
1663
3722
|
const focused = event.target.closest?.('[role="tab"]');
|
|
1664
3723
|
const at = focused ? tabs.indexOf(focused) : tabs.findIndex((tab) => tab.dataset.tab === this.selected);
|
|
1665
|
-
const
|
|
1666
|
-
const next = event.key === "Home" ? tabs[0] : event.key === "End" ? tabs.at(-1) :
|
|
3724
|
+
const step2 = { ArrowRight: 1, ArrowLeft: -1 }[event.key];
|
|
3725
|
+
const next = event.key === "Home" ? tabs[0] : event.key === "End" ? tabs.at(-1) : step2 ? tabs[(at + step2 + tabs.length) % tabs.length] : void 0;
|
|
1667
3726
|
if (!next) return;
|
|
1668
3727
|
event.preventDefault();
|
|
1669
3728
|
this.choose(next.dataset.tab);
|
|
@@ -1873,8 +3932,8 @@ var OfficeUiButton = class extends OfficeElement {
|
|
|
1873
3932
|
return this.getAttribute("icon");
|
|
1874
3933
|
}
|
|
1875
3934
|
/** The tooltip: `title`, else the label of an icon-only button; a product may always show it. */
|
|
1876
|
-
tooltip(
|
|
1877
|
-
return this.getAttribute("title") ?? (iconOnly ?
|
|
3935
|
+
tooltip(label2, iconOnly) {
|
|
3936
|
+
return this.getAttribute("title") ?? (iconOnly ? label2 : "");
|
|
1878
3937
|
}
|
|
1879
3938
|
/** Whether the trailing menu chevron shows. */
|
|
1880
3939
|
showsCaret() {
|
|
@@ -1891,24 +3950,24 @@ var OfficeUiButton = class extends OfficeElement {
|
|
|
1891
3950
|
if (!present(this.disabled) && id) this.fire(requestEvent, { [detailKey]: id });
|
|
1892
3951
|
}
|
|
1893
3952
|
render() {
|
|
1894
|
-
const
|
|
3953
|
+
const label2 = this.getAttribute("label") ?? "";
|
|
1895
3954
|
const iconOnly = this.hasAttribute("icon-only");
|
|
1896
3955
|
const badge = this.getAttribute("badge") ?? "";
|
|
1897
3956
|
const expanded = this.getAttribute("expanded");
|
|
1898
|
-
const tooltip = this.tooltip(
|
|
3957
|
+
const tooltip = this.tooltip(label2, iconOnly);
|
|
1899
3958
|
return html`<button
|
|
1900
3959
|
part="button"
|
|
1901
3960
|
type="button"
|
|
1902
3961
|
?disabled=${present(this.disabled)}
|
|
1903
3962
|
title=${tooltip || nothing}
|
|
1904
|
-
aria-label=${ifDefined(iconOnly &&
|
|
3963
|
+
aria-label=${ifDefined(iconOnly && label2 ? label2 : void 0)}
|
|
1905
3964
|
aria-keyshortcuts=${ifDefined(this.getAttribute("keyshortcuts") || void 0)}
|
|
1906
3965
|
aria-pressed=${ifDefined(asAttribute(this.pressed))}
|
|
1907
3966
|
aria-expanded=${ifDefined(expanded === null ? void 0 : String(expanded !== "false"))}
|
|
1908
3967
|
@click=${this.onClick}
|
|
1909
3968
|
@keydown=${this.onKeydown}
|
|
1910
3969
|
>${glyph(this.iconName())}<span class="label" ?hidden=${iconOnly}
|
|
1911
|
-
>${
|
|
3970
|
+
>${label2}${glyph("chevronDown", "caret", !this.showsCaret())}</span
|
|
1912
3971
|
><span class="badge" aria-hidden="true" ?hidden=${!badge}>${badge}</span></button
|
|
1913
3972
|
>`;
|
|
1914
3973
|
}
|
|
@@ -2001,25 +4060,25 @@ var OfficeUiRibbonGroup = class extends OfficeElement {
|
|
|
2001
4060
|
this.setAttribute("aria-label", this.getAttribute("label") ?? "");
|
|
2002
4061
|
}
|
|
2003
4062
|
render() {
|
|
2004
|
-
const
|
|
2005
|
-
const launcherLabel = this.getAttribute("launcher-label") ?? `${
|
|
4063
|
+
const label2 = this.getAttribute("label") ?? "";
|
|
4064
|
+
const launcherLabel = this.getAttribute("launcher-label") ?? `${label2} options`;
|
|
2006
4065
|
return html`
|
|
2007
4066
|
<div class="group">
|
|
2008
4067
|
<button
|
|
2009
4068
|
class="face"
|
|
2010
4069
|
type="button"
|
|
2011
4070
|
aria-haspopup="true"
|
|
2012
|
-
aria-label=${
|
|
4071
|
+
aria-label=${label2}
|
|
2013
4072
|
aria-expanded=${String(this.hasAttribute("data-open"))}
|
|
2014
|
-
title=${
|
|
4073
|
+
title=${label2}
|
|
2015
4074
|
@click=${this.onFace}
|
|
2016
|
-
>${glyph(this.iconName(), "face-icon")}<span>${
|
|
4075
|
+
>${glyph(this.iconName(), "face-icon")}<span>${label2}</span>${glyph("chevronDown", "chev")}</button
|
|
2017
4076
|
>
|
|
2018
4077
|
<div class="row">
|
|
2019
4078
|
<slot @slotchange=${this.observe}></slot>
|
|
2020
4079
|
</div>
|
|
2021
4080
|
<div class="foot">
|
|
2022
|
-
<span class="caption">${
|
|
4081
|
+
<span class="caption">${label2}</span>
|
|
2023
4082
|
<button
|
|
2024
4083
|
class="launcher"
|
|
2025
4084
|
type="button"
|
|
@@ -2173,30 +4232,6 @@ function attachGalleryStyles(host) {
|
|
|
2173
4232
|
injected.add(root);
|
|
2174
4233
|
}
|
|
2175
4234
|
|
|
2176
|
-
// src/ribbon/safe-svg.ts
|
|
2177
|
-
var BLOCKED_ELEMENTS = /* @__PURE__ */ new Set(["script", "foreignobject", "iframe", "object", "embed"]);
|
|
2178
|
-
function parseSvgPreview(doc, svg2) {
|
|
2179
|
-
const Parser = doc.defaultView?.DOMParser ?? globalThis.DOMParser;
|
|
2180
|
-
if (typeof Parser !== "function") return null;
|
|
2181
|
-
const parsed = new Parser().parseFromString(svg2, "image/svg+xml");
|
|
2182
|
-
const root = parsed.documentElement;
|
|
2183
|
-
if (root.localName !== "svg" || parsed.getElementsByTagName("parsererror").length > 0)
|
|
2184
|
-
return null;
|
|
2185
|
-
for (const node of Array.from(root.querySelectorAll("*"))) {
|
|
2186
|
-
if (BLOCKED_ELEMENTS.has(node.localName.toLowerCase())) {
|
|
2187
|
-
node.remove();
|
|
2188
|
-
continue;
|
|
2189
|
-
}
|
|
2190
|
-
for (const attribute of Array.from(node.attributes))
|
|
2191
|
-
if (/^on/iu.test(attribute.name) || /^\s*javascript:/iu.test(attribute.value))
|
|
2192
|
-
node.removeAttribute(attribute.name);
|
|
2193
|
-
}
|
|
2194
|
-
for (const attribute of Array.from(root.attributes))
|
|
2195
|
-
if (/^on/iu.test(attribute.name) || /^\s*javascript:/iu.test(attribute.value))
|
|
2196
|
-
root.removeAttribute(attribute.name);
|
|
2197
|
-
return doc.importNode(root, true);
|
|
2198
|
-
}
|
|
2199
|
-
|
|
2200
4235
|
// src/ribbon/gallery.ts
|
|
2201
4236
|
var HOST_CSS = ":host { display: inline-flex; position: relative; flex: none; }";
|
|
2202
4237
|
var OfficeUiGallery = class extends OfficeElement {
|
|
@@ -2383,8 +4418,8 @@ var OfficeUiGallery = class extends OfficeElement {
|
|
|
2383
4418
|
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
2384
4419
|
event.preventDefault();
|
|
2385
4420
|
event.stopPropagation();
|
|
2386
|
-
const
|
|
2387
|
-
items[(index +
|
|
4421
|
+
const step2 = event.key === "ArrowDown" ? 1 : -1;
|
|
4422
|
+
items[(index + step2 + items.length) % items.length]?.focus();
|
|
2388
4423
|
} else if (event.key === "Tab") {
|
|
2389
4424
|
this.closeMenu();
|
|
2390
4425
|
}
|
|
@@ -2816,14 +4851,14 @@ var OfficeUiRuler = class extends OfficeElement {
|
|
|
2816
4851
|
const canvas = this.renderRoot.querySelector("canvas");
|
|
2817
4852
|
if (!canvas) return;
|
|
2818
4853
|
const view = this.ownerDocument.defaultView;
|
|
2819
|
-
const
|
|
4854
|
+
const vertical2 = this.orientation === "vertical";
|
|
2820
4855
|
const reverse = this.direction === "reverse";
|
|
2821
4856
|
const box = this.getBoundingClientRect();
|
|
2822
|
-
const length = (
|
|
2823
|
-
const thickness = (
|
|
4857
|
+
const length = (vertical2 ? this.offsetHeight : this.offsetWidth) || (vertical2 ? box.height : box.width);
|
|
4858
|
+
const thickness = (vertical2 ? this.offsetWidth || box.width : this.offsetHeight || box.height) || parseFloat(OFFICE_TOKENS["--office-ruler-size"]);
|
|
2824
4859
|
const ratio = (view?.devicePixelRatio ?? 1) * this.zoomFactor;
|
|
2825
|
-
canvas.width = Math.max(1, Math.round((
|
|
2826
|
-
canvas.height = Math.max(1, Math.round((
|
|
4860
|
+
canvas.width = Math.max(1, Math.round((vertical2 ? thickness : length) * ratio));
|
|
4861
|
+
canvas.height = Math.max(1, Math.round((vertical2 ? length : thickness) * ratio));
|
|
2827
4862
|
const context = canvas.getContext?.("2d");
|
|
2828
4863
|
if (!context || !length) return;
|
|
2829
4864
|
context.scale(ratio, ratio);
|
|
@@ -2837,17 +4872,17 @@ var OfficeUiRuler = class extends OfficeElement {
|
|
|
2837
4872
|
const unit = Math.max(1, Number.isFinite(this.scale) ? this.scale : 96);
|
|
2838
4873
|
const density = this.density > 0 && this.density <= 1 ? this.density : 1;
|
|
2839
4874
|
const divisions = Math.max(1, Math.round(rulerDivisions(unit) * density));
|
|
2840
|
-
const
|
|
4875
|
+
const step2 = unit / divisions;
|
|
2841
4876
|
const sign = reverse ? -1 : 1;
|
|
2842
|
-
const a = (0 - origin) / (sign *
|
|
2843
|
-
const b = (length - origin) / (sign *
|
|
4877
|
+
const a = (0 - origin) / (sign * step2);
|
|
4878
|
+
const b = (length - origin) / (sign * step2);
|
|
2844
4879
|
const first = Math.floor(Math.min(a, b)) - 1;
|
|
2845
4880
|
const last = Math.ceil(Math.max(a, b)) + 1;
|
|
2846
4881
|
context.beginPath();
|
|
2847
4882
|
for (let index = first; index <= last; index++) {
|
|
2848
|
-
const at = Math.round(origin + sign * index *
|
|
4883
|
+
const at = Math.round(origin + sign * index * step2) + 0.5;
|
|
2849
4884
|
const tick = index % divisions === 0 ? thickness : index % (divisions / 2) === 0 ? thickness * 0.5 : thickness * 0.3;
|
|
2850
|
-
if (
|
|
4885
|
+
if (vertical2) {
|
|
2851
4886
|
context.moveTo(thickness, at);
|
|
2852
4887
|
context.lineTo(thickness - tick, at);
|
|
2853
4888
|
} else {
|
|
@@ -2857,31 +4892,31 @@ var OfficeUiRuler = class extends OfficeElement {
|
|
|
2857
4892
|
if (index % divisions !== 0) continue;
|
|
2858
4893
|
if (this.labelsWithinMargins && (index < 0 || at < this.marginStart || at > length - this.marginEnd))
|
|
2859
4894
|
continue;
|
|
2860
|
-
const
|
|
2861
|
-
if (!
|
|
4895
|
+
const label2 = String(index / divisions);
|
|
4896
|
+
if (!vertical2) context.fillText(label2, at + 2, 9);
|
|
2862
4897
|
else {
|
|
2863
4898
|
context.save();
|
|
2864
4899
|
context.translate(9, at - 2);
|
|
2865
4900
|
context.rotate(-Math.PI / 2);
|
|
2866
|
-
context.fillText(
|
|
4901
|
+
context.fillText(label2, 0, 0);
|
|
2867
4902
|
context.restore();
|
|
2868
4903
|
}
|
|
2869
4904
|
}
|
|
2870
4905
|
context.stroke();
|
|
2871
4906
|
}
|
|
2872
4907
|
render() {
|
|
2873
|
-
const
|
|
2874
|
-
const band = (side,
|
|
4908
|
+
const vertical2 = this.orientation === "vertical";
|
|
4909
|
+
const band = (side, size2) => size2 > 0 ? html`<div
|
|
2875
4910
|
class="margin"
|
|
2876
4911
|
data-margin=${side}
|
|
2877
|
-
style="${side === "start" ?
|
|
4912
|
+
style="${side === "start" ? vertical2 ? "top" : "left" : vertical2 ? "bottom" : "right"}:0;${vertical2 ? "height" : "width"}:${size2}px"
|
|
2878
4913
|
></div>` : nothing;
|
|
2879
4914
|
return html`${band("start", this.marginStart)}${band("end", this.marginEnd)}<canvas
|
|
2880
4915
|
></canvas>${this.markers.map(
|
|
2881
4916
|
(marker) => html`<div
|
|
2882
4917
|
class="marker ${marker.edge === "top" ? "top" : "bottom"}"
|
|
2883
4918
|
data-marker=${marker.name}
|
|
2884
|
-
style="${
|
|
4919
|
+
style="${vertical2 ? "top" : "left"}:${marker.position}px"
|
|
2885
4920
|
aria-label=${marker.label ?? nothing}
|
|
2886
4921
|
@pointerdown=${(event) => this.dragMarker(event, marker.name)}
|
|
2887
4922
|
></div>`
|
|
@@ -2960,12 +4995,12 @@ var OfficeUiAccount = class extends OfficeElement {
|
|
|
2960
4995
|
this.fire("office-profile-change", { profile: this.profile });
|
|
2961
4996
|
}
|
|
2962
4997
|
onSwatchKey(event) {
|
|
2963
|
-
const
|
|
2964
|
-
if (!
|
|
4998
|
+
const step2 = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }[event.key];
|
|
4999
|
+
if (!step2) return;
|
|
2965
5000
|
event.preventDefault();
|
|
2966
5001
|
const colors = OFFICE_AVATAR_SWATCHES;
|
|
2967
5002
|
const at = Math.max(0, colors.indexOf(this.current.avatarColor));
|
|
2968
|
-
const color = colors[(at +
|
|
5003
|
+
const color = colors[(at + step2 + colors.length) % colors.length];
|
|
2969
5004
|
this.change({ ...this.current, avatarColor: color });
|
|
2970
5005
|
this.renderRoot.querySelector(`[data-color="${color}"]`)?.focus();
|
|
2971
5006
|
}
|
|
@@ -3077,8 +5112,27 @@ var OfficeUiDialog = class extends OfficeElement {
|
|
|
3077
5112
|
get closeButton() {
|
|
3078
5113
|
return this.renderRoot.querySelector(".close");
|
|
3079
5114
|
}
|
|
5115
|
+
/**
|
|
5116
|
+
* The body's focusable controls in order, including those inside the shadow root of a
|
|
5117
|
+
* composite element (a picker) that is not itself focusable.
|
|
5118
|
+
*/
|
|
3080
5119
|
focusables() {
|
|
3081
|
-
|
|
5120
|
+
const found = [];
|
|
5121
|
+
const walk = (root) => {
|
|
5122
|
+
for (const child of Array.from(root.children)) {
|
|
5123
|
+
if (child.matches(FOCUSABLE)) found.push(child);
|
|
5124
|
+
else if (child.shadowRoot) walk(child.shadowRoot);
|
|
5125
|
+
else walk(child);
|
|
5126
|
+
}
|
|
5127
|
+
};
|
|
5128
|
+
walk(this);
|
|
5129
|
+
return found;
|
|
5130
|
+
}
|
|
5131
|
+
/** The focused element, followed into open shadow roots. */
|
|
5132
|
+
deepActive() {
|
|
5133
|
+
let active = this.ownerDocument.activeElement;
|
|
5134
|
+
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
5135
|
+
return active;
|
|
3082
5136
|
}
|
|
3083
5137
|
onOpen() {
|
|
3084
5138
|
const active = this.ownerDocument.activeElement;
|
|
@@ -3099,10 +5153,10 @@ var OfficeUiDialog = class extends OfficeElement {
|
|
|
3099
5153
|
} else if (event.key === "Tab") {
|
|
3100
5154
|
const closeButton = this.closeButton;
|
|
3101
5155
|
const items = [...this.focusables(), ...closeButton ? [closeButton] : []];
|
|
3102
|
-
const current = this.
|
|
5156
|
+
const current = this.deepActive();
|
|
3103
5157
|
const inside = (el) => el === current || el.contains(current);
|
|
3104
5158
|
const index = items.findIndex(inside);
|
|
3105
|
-
const shadowFocus =
|
|
5159
|
+
const shadowFocus = current !== null && current === closeButton;
|
|
3106
5160
|
const at = shadowFocus ? items.length - 1 : index;
|
|
3107
5161
|
const last = items.length - 1;
|
|
3108
5162
|
if (at < 0 || !event.shiftKey && at === last || event.shiftKey && at === 0) {
|
|
@@ -3231,11 +5285,11 @@ var OfficeUiCommandSearch = class extends OfficeElement {
|
|
|
3231
5285
|
hide() {
|
|
3232
5286
|
this.isOpen = false;
|
|
3233
5287
|
}
|
|
3234
|
-
move(
|
|
5288
|
+
move(step2) {
|
|
3235
5289
|
const enabled = this.found.map((item, index) => item.disabled ? -1 : index).filter((i) => i >= 0);
|
|
3236
5290
|
if (!enabled.length) return;
|
|
3237
5291
|
const at = enabled.indexOf(this.active);
|
|
3238
|
-
this.active = enabled[(at +
|
|
5292
|
+
this.active = enabled[(at + step2 + enabled.length) % enabled.length];
|
|
3239
5293
|
}
|
|
3240
5294
|
choose(index) {
|
|
3241
5295
|
const item = this.found[index];
|
|
@@ -3335,10 +5389,10 @@ var defineCommandSearch = definer("office-ui-command-search", () => OfficeUiComm
|
|
|
3335
5389
|
|
|
3336
5390
|
// src/menu/menu-model.ts
|
|
3337
5391
|
var EMPTY_MENU_STATE = { x: 0, y: 0, label: "", items: [] };
|
|
3338
|
-
function nextEnabledIndex(items, from,
|
|
5392
|
+
function nextEnabledIndex(items, from, step2) {
|
|
3339
5393
|
const count = items.length;
|
|
3340
5394
|
for (let offset = 1; offset <= count; offset += 1) {
|
|
3341
|
-
const index = ((from +
|
|
5395
|
+
const index = ((from + step2 * offset) % count + count) % count;
|
|
3342
5396
|
if (!items[index]?.disabled) return index;
|
|
3343
5397
|
}
|
|
3344
5398
|
return -1;
|
|
@@ -3964,10 +6018,10 @@ var OfficeUiMenuButton = class _OfficeUiMenuButton extends OfficeElement {
|
|
|
3964
6018
|
if (present(this.disabled)) this.hide(false);
|
|
3965
6019
|
}
|
|
3966
6020
|
render() {
|
|
3967
|
-
const { label, split, open } = this;
|
|
6021
|
+
const { label: label2, split, open } = this;
|
|
3968
6022
|
const iconOnly = present(this.iconOnly);
|
|
3969
6023
|
const disabled = present(this.disabled);
|
|
3970
|
-
const title = this.getAttribute("title") ??
|
|
6024
|
+
const title = this.getAttribute("title") ?? label2;
|
|
3971
6025
|
const popover = this.nativePopover;
|
|
3972
6026
|
return html`
|
|
3973
6027
|
<div class="wrap ${disabled ? "disabled" : ""}">
|
|
@@ -3976,7 +6030,7 @@ var OfficeUiMenuButton = class _OfficeUiMenuButton extends OfficeElement {
|
|
|
3976
6030
|
part="button"
|
|
3977
6031
|
type="button"
|
|
3978
6032
|
title=${title}
|
|
3979
|
-
aria-label=${ifDefined(iconOnly ?
|
|
6033
|
+
aria-label=${ifDefined(iconOnly ? label2 : void 0)}
|
|
3980
6034
|
aria-keyshortcuts=${ifDefined(this.keyshortcuts || void 0)}
|
|
3981
6035
|
aria-haspopup=${ifDefined(split ? void 0 : "menu")}
|
|
3982
6036
|
role=${ifDefined(present(this.submenu) ? "menuitem" : void 0)}
|
|
@@ -3986,15 +6040,15 @@ var OfficeUiMenuButton = class _OfficeUiMenuButton extends OfficeElement {
|
|
|
3986
6040
|
@click=${this.onMain}
|
|
3987
6041
|
@keydown=${this.onTriggerKey}
|
|
3988
6042
|
@pointerenter=${() => present(this.submenu) && this.show(-1)}
|
|
3989
|
-
>${glyph(this.icon)}<span class="text" ?hidden=${iconOnly}>${
|
|
6043
|
+
>${glyph(this.icon)}<span class="text" ?hidden=${iconOnly}>${label2}</span></button
|
|
3990
6044
|
>
|
|
3991
6045
|
<!-- Without a split command the caret is decoration on one control, not a second button. -->
|
|
3992
6046
|
<button
|
|
3993
6047
|
class="caret"
|
|
3994
6048
|
part="caret"
|
|
3995
6049
|
type="button"
|
|
3996
|
-
title=${split ? `${
|
|
3997
|
-
aria-label=${ifDefined(split ? `${
|
|
6050
|
+
title=${split ? `${label2} options` : title}
|
|
6051
|
+
aria-label=${ifDefined(split ? `${label2} options` : void 0)}
|
|
3998
6052
|
aria-hidden=${ifDefined(split ? void 0 : "true")}
|
|
3999
6053
|
aria-haspopup="menu"
|
|
4000
6054
|
aria-expanded=${String(open)}
|
|
@@ -4023,69 +6077,69 @@ function clampOptionNumber(raw, min, max) {
|
|
|
4023
6077
|
const parsed = Number(raw);
|
|
4024
6078
|
return Number.isFinite(parsed) && raw.trim() !== "" ? Math.min(max, Math.max(min, parsed)) : void 0;
|
|
4025
6079
|
}
|
|
4026
|
-
function optionRow(host,
|
|
6080
|
+
function optionRow(host, control2) {
|
|
4027
6081
|
const { draft } = host;
|
|
4028
|
-
const value = draft[
|
|
4029
|
-
const locked = Boolean(
|
|
6082
|
+
const value = draft[control2.key];
|
|
6083
|
+
const locked = Boolean(control2.disabled) || control2.enabledBy && draft[control2.enabledBy] !== true;
|
|
4030
6084
|
const disabled = Boolean(locked);
|
|
4031
|
-
const info =
|
|
4032
|
-
const
|
|
6085
|
+
const info = control2.info ? html`<span class="info" title=${control2.info} role="img" aria-label=${control2.info}>i</span>` : "";
|
|
6086
|
+
const label2 = html`<span class="label">${control2.label}${info}</span>`;
|
|
4033
6087
|
let body;
|
|
4034
|
-
if (
|
|
4035
|
-
body = html`${
|
|
6088
|
+
if (control2.kind === "toggle")
|
|
6089
|
+
body = html`${label2}<input
|
|
4036
6090
|
type="checkbox"
|
|
4037
6091
|
.checked=${value === true}
|
|
4038
6092
|
?disabled=${disabled}
|
|
4039
|
-
@change=${(event) => host.set(
|
|
6093
|
+
@change=${(event) => host.set(control2.key, event.target.checked)}
|
|
4040
6094
|
/>`;
|
|
4041
|
-
else if (
|
|
4042
|
-
const current = String(value ??
|
|
4043
|
-
body = html`${
|
|
4044
|
-
aria-label=${
|
|
6095
|
+
else if (control2.kind === "select") {
|
|
6096
|
+
const current = String(value ?? control2.choices[0]?.value ?? "");
|
|
6097
|
+
body = html`${label2}<select
|
|
6098
|
+
aria-label=${control2.label}
|
|
4045
6099
|
?disabled=${disabled}
|
|
4046
|
-
@change=${(event) => host.set(
|
|
6100
|
+
@change=${(event) => host.set(control2.key, event.target.value)}
|
|
4047
6101
|
>
|
|
4048
|
-
${
|
|
4049
|
-
(
|
|
4050
|
-
>${
|
|
6102
|
+
${control2.choices.map(
|
|
6103
|
+
(choice2) => html`<option value=${choice2.value} .selected=${choice2.value === current}
|
|
6104
|
+
>${choice2.label}</option
|
|
4051
6105
|
>`
|
|
4052
6106
|
)}
|
|
4053
6107
|
</select>`;
|
|
4054
|
-
} else if (
|
|
4055
|
-
body = html`${
|
|
6108
|
+
} else if (control2.kind === "number")
|
|
6109
|
+
body = html`${label2}<span class="number"
|
|
4056
6110
|
><input
|
|
4057
6111
|
type="number"
|
|
4058
|
-
min=${
|
|
4059
|
-
max=${
|
|
4060
|
-
step=${ifDefined(
|
|
4061
|
-
aria-label=${
|
|
6112
|
+
min=${control2.min}
|
|
6113
|
+
max=${control2.max}
|
|
6114
|
+
step=${ifDefined(control2.step ? String(control2.step) : void 0)}
|
|
6115
|
+
aria-label=${control2.label}
|
|
4062
6116
|
.value=${value === void 0 ? "" : String(value)}
|
|
4063
6117
|
?disabled=${disabled}
|
|
4064
6118
|
@change=${(event) => {
|
|
4065
6119
|
const field = event.target;
|
|
4066
|
-
const next = clampOptionNumber(field.value,
|
|
4067
|
-
if (next === void 0) field.value = String(draft[
|
|
6120
|
+
const next = clampOptionNumber(field.value, control2.min, control2.max);
|
|
6121
|
+
if (next === void 0) field.value = String(draft[control2.key] ?? "");
|
|
4068
6122
|
else {
|
|
4069
6123
|
field.value = String(next);
|
|
4070
|
-
host.set(
|
|
6124
|
+
host.set(control2.key, next);
|
|
4071
6125
|
}
|
|
4072
6126
|
}}
|
|
4073
|
-
/>${
|
|
6127
|
+
/>${control2.unit ? html`<span class="unit">${control2.unit}</span>` : ""}</span
|
|
4074
6128
|
>`;
|
|
4075
6129
|
else
|
|
4076
|
-
body = html`${
|
|
6130
|
+
body = html`${label2}<input
|
|
4077
6131
|
type="text"
|
|
4078
|
-
maxlength=${ifDefined(
|
|
4079
|
-
aria-label=${
|
|
6132
|
+
maxlength=${ifDefined(control2.maxLength ? String(control2.maxLength) : void 0)}
|
|
6133
|
+
aria-label=${control2.label}
|
|
4080
6134
|
.value=${value === void 0 ? "" : String(value)}
|
|
4081
6135
|
?disabled=${disabled}
|
|
4082
|
-
@input=${(event) => host.set(
|
|
6136
|
+
@input=${(event) => host.set(control2.key, event.target.value)}
|
|
4083
6137
|
/>`;
|
|
4084
6138
|
return html`<label
|
|
4085
|
-
class="row${
|
|
4086
|
-
data-key=${
|
|
6139
|
+
class="row${control2.indent ? " indent" : ""}"
|
|
6140
|
+
data-key=${control2.key}
|
|
4087
6141
|
?data-disabled=${disabled}
|
|
4088
|
-
title=${ifDefined(
|
|
6142
|
+
title=${ifDefined(control2.disabled)}
|
|
4089
6143
|
>${body}</label
|
|
4090
6144
|
>`;
|
|
4091
6145
|
}
|
|
@@ -4179,8 +6233,8 @@ var OfficeUiOptionsDialog = class extends OfficeElement {
|
|
|
4179
6233
|
onNavKey(event) {
|
|
4180
6234
|
const tabs = [...this.renderRoot.querySelectorAll('nav [role="tab"]')];
|
|
4181
6235
|
const at = tabs.findIndex((tab) => tab.getAttribute("aria-selected") === "true");
|
|
4182
|
-
const
|
|
4183
|
-
const target = event.key === "Home" ? tabs[0] : event.key === "End" ? tabs.at(-1) :
|
|
6236
|
+
const step2 = { ArrowDown: 1, ArrowRight: 1, ArrowUp: -1, ArrowLeft: -1 }[event.key];
|
|
6237
|
+
const target = event.key === "Home" ? tabs[0] : event.key === "End" ? tabs.at(-1) : step2 ? tabs[(at + step2 + tabs.length) % tabs.length] : void 0;
|
|
4184
6238
|
if (!target) return;
|
|
4185
6239
|
event.preventDefault();
|
|
4186
6240
|
this.category = target.dataset.category;
|
|
@@ -4227,7 +6281,7 @@ var OfficeUiOptionsDialog = class extends OfficeElement {
|
|
|
4227
6281
|
(section) => html`<section>
|
|
4228
6282
|
<h3>${section.title}</h3>
|
|
4229
6283
|
${section.description ? html`<p class="desc">${section.description}</p>` : ""}
|
|
4230
|
-
${section.controls.map((
|
|
6284
|
+
${section.controls.map((control2) => optionRow(this, control2))}
|
|
4231
6285
|
${section.slot ? html`<slot name=${section.slot}></slot>` : ""}
|
|
4232
6286
|
</section>`
|
|
4233
6287
|
)}
|
|
@@ -4236,11 +6290,11 @@ var OfficeUiOptionsDialog = class extends OfficeElement {
|
|
|
4236
6290
|
}
|
|
4237
6291
|
render() {
|
|
4238
6292
|
const category = this.categories.find((entry) => entry.id === this.active);
|
|
4239
|
-
const
|
|
6293
|
+
const text2 = { ...DEFAULT_LABELS, ...this.labels };
|
|
4240
6294
|
return html`
|
|
4241
6295
|
<office-ui-dialog
|
|
4242
6296
|
heading=${this.heading ?? "Options"}
|
|
4243
|
-
close-label=${
|
|
6297
|
+
close-label=${text2.close}
|
|
4244
6298
|
?open=${present(this.open)}
|
|
4245
6299
|
@office-dialog-close=${(event) => {
|
|
4246
6300
|
if (event.defaultPrevented) return;
|
|
@@ -4248,17 +6302,17 @@ var OfficeUiOptionsDialog = class extends OfficeElement {
|
|
|
4248
6302
|
else this.close();
|
|
4249
6303
|
}}
|
|
4250
6304
|
>
|
|
4251
|
-
${present(this.customBody) ? html`<div class="custom" @keydown=${this.onPaneKey}><slot name="body"></slot></div>` : this.layout(category,
|
|
6305
|
+
${present(this.customBody) ? html`<div class="custom" @keydown=${this.onPaneKey}><slot name="body"></slot></div>` : this.layout(category, text2)}
|
|
4252
6306
|
</office-ui-dialog>
|
|
4253
6307
|
`;
|
|
4254
6308
|
}
|
|
4255
|
-
layout(category,
|
|
6309
|
+
layout(category, text2) {
|
|
4256
6310
|
return html`
|
|
4257
6311
|
<div class="layout">
|
|
4258
6312
|
<nav
|
|
4259
6313
|
role="tablist"
|
|
4260
6314
|
aria-orientation="vertical"
|
|
4261
|
-
aria-label=${
|
|
6315
|
+
aria-label=${text2.categories}
|
|
4262
6316
|
@keydown=${this.onNavKey}
|
|
4263
6317
|
>
|
|
4264
6318
|
${this.categories.map(
|
|
@@ -4285,11 +6339,11 @@ var OfficeUiOptionsDialog = class extends OfficeElement {
|
|
|
4285
6339
|
</div>
|
|
4286
6340
|
<div slot="footer" class="actions">
|
|
4287
6341
|
${this.defaults ? html`<button type="button" class="reset" data-action="reset" @click=${this.resetAll}>
|
|
4288
|
-
${
|
|
6342
|
+
${text2.reset}
|
|
4289
6343
|
</button>` : ""}
|
|
4290
|
-
<button type="button" data-action="cancel" @click=${this.close}>${
|
|
6344
|
+
<button type="button" data-action="cancel" @click=${this.close}>${text2.cancel}</button>
|
|
4291
6345
|
<button type="button" class="primary" data-action="ok" @click=${this.commit}>
|
|
4292
|
-
${
|
|
6346
|
+
${text2.ok}
|
|
4293
6347
|
</button>
|
|
4294
6348
|
</div>
|
|
4295
6349
|
`;
|
|
@@ -4330,9 +6384,9 @@ var OfficeUiToolbar = class extends OfficeElement {
|
|
|
4330
6384
|
);
|
|
4331
6385
|
}
|
|
4332
6386
|
onKey(event) {
|
|
4333
|
-
const
|
|
4334
|
-
const next =
|
|
4335
|
-
const prev =
|
|
6387
|
+
const vertical2 = this.getAttribute("aria-orientation") === "vertical";
|
|
6388
|
+
const next = vertical2 ? "ArrowDown" : "ArrowRight";
|
|
6389
|
+
const prev = vertical2 ? "ArrowUp" : "ArrowLeft";
|
|
4336
6390
|
if (![next, prev, "Home", "End"].includes(event.key)) return;
|
|
4337
6391
|
const items = this.items();
|
|
4338
6392
|
const from = items.findIndex((el) => el === event.target || el.contains(event.target));
|
|
@@ -4401,17 +6455,17 @@ function positionSelectMenu(menu, trigger, host) {
|
|
|
4401
6455
|
menu.style.top = `${Math.max(margin, flip ? rect.top - gap - height : rect.bottom + gap)}px`;
|
|
4402
6456
|
menu.style.left = `${Math.max(margin, Math.min(rect.left, view.innerWidth - menuWidth - margin))}px`;
|
|
4403
6457
|
}
|
|
4404
|
-
function nextSelectActive(
|
|
4405
|
-
for (let i = 0; i <
|
|
4406
|
-
active = (active +
|
|
4407
|
-
if (!
|
|
6458
|
+
function nextSelectActive(choices2, active, step2) {
|
|
6459
|
+
for (let i = 0; i < choices2.length; i++) {
|
|
6460
|
+
active = (active + step2 + choices2.length) % choices2.length;
|
|
6461
|
+
if (!choices2[active].disabled && !choices2[active].hidden) return active;
|
|
4408
6462
|
}
|
|
4409
6463
|
return active;
|
|
4410
6464
|
}
|
|
4411
6465
|
var SELECT_PAGE_SIZE = 8;
|
|
4412
|
-
function pageSelectActive(
|
|
4413
|
-
const usable = (index) => !
|
|
4414
|
-
const last =
|
|
6466
|
+
function pageSelectActive(choices2, active, direction) {
|
|
6467
|
+
const usable = (index) => !choices2[index]?.disabled && !choices2[index]?.hidden;
|
|
6468
|
+
const last = choices2.length - 1;
|
|
4415
6469
|
const target = Math.max(0, Math.min(last, Math.max(active, 0) + direction * SELECT_PAGE_SIZE));
|
|
4416
6470
|
for (let index = target; index >= 0 && index <= last; index -= direction)
|
|
4417
6471
|
if (usable(index)) return index;
|
|
@@ -4480,11 +6534,11 @@ var OfficeUiSelect = class extends OfficeElement {
|
|
|
4480
6534
|
}
|
|
4481
6535
|
get value() {
|
|
4482
6536
|
const requested = this.requested;
|
|
4483
|
-
const
|
|
6537
|
+
const choices2 = this.choices.length ? this.choices : this.collect();
|
|
4484
6538
|
if (requested !== null && this.getAttribute("variant") === "ribbon-font") return requested;
|
|
4485
|
-
if (requested !== null && (!
|
|
6539
|
+
if (requested !== null && (!choices2.length || choices2.some((c) => c.value === requested)))
|
|
4486
6540
|
return requested;
|
|
4487
|
-
return [...this.querySelectorAll("option")].find((option) => option.selected)?.value ??
|
|
6541
|
+
return [...this.querySelectorAll("option")].find((option) => option.selected)?.value ?? choices2.find((choice2) => !choice2.disabled && !choice2.hidden)?.value ?? choices2[0]?.value ?? requested ?? "";
|
|
4488
6542
|
}
|
|
4489
6543
|
set value(next) {
|
|
4490
6544
|
this.requested = String(next ?? "");
|
|
@@ -4551,8 +6605,8 @@ var OfficeUiSelect = class extends OfficeElement {
|
|
|
4551
6605
|
this.choices = this.collect();
|
|
4552
6606
|
this.requestUpdate();
|
|
4553
6607
|
}
|
|
4554
|
-
isUsable(
|
|
4555
|
-
return Boolean(
|
|
6608
|
+
isUsable(choice2) {
|
|
6609
|
+
return Boolean(choice2) && !choice2.disabled && !choice2.hidden;
|
|
4556
6610
|
}
|
|
4557
6611
|
show() {
|
|
4558
6612
|
this.choices = this.collect();
|
|
@@ -4595,15 +6649,15 @@ var OfficeUiSelect = class extends OfficeElement {
|
|
|
4595
6649
|
const { menu, trigger } = this;
|
|
4596
6650
|
if (this.open && menu && trigger) positionSelectMenu(menu, trigger, this);
|
|
4597
6651
|
};
|
|
4598
|
-
move(
|
|
6652
|
+
move(step2) {
|
|
4599
6653
|
if (!this.open) this.show();
|
|
4600
|
-
if (this.open) this.active = nextSelectActive(this.choices, this.active,
|
|
6654
|
+
if (this.open) this.active = nextSelectActive(this.choices, this.active, step2);
|
|
4601
6655
|
}
|
|
4602
6656
|
commit(index) {
|
|
4603
|
-
const
|
|
4604
|
-
if (!
|
|
4605
|
-
const changed = this.value !==
|
|
4606
|
-
this.value =
|
|
6657
|
+
const choice2 = this.choices[index];
|
|
6658
|
+
if (!choice2 || !this.isUsable(choice2)) return;
|
|
6659
|
+
const changed = this.value !== choice2.value;
|
|
6660
|
+
this.value = choice2.value;
|
|
4607
6661
|
this.close();
|
|
4608
6662
|
this.trigger?.focus();
|
|
4609
6663
|
if (changed || this.hasAttribute("commit-on-reselect")) {
|
|
@@ -4651,7 +6705,7 @@ var OfficeUiSelect = class extends OfficeElement {
|
|
|
4651
6705
|
}, 700) ?? 0;
|
|
4652
6706
|
this.show();
|
|
4653
6707
|
const index = this.choices.findIndex(
|
|
4654
|
-
(
|
|
6708
|
+
(choice2) => this.isUsable(choice2) && choice2.label.toLocaleLowerCase().startsWith(this.search)
|
|
4655
6709
|
);
|
|
4656
6710
|
if (index >= 0) this.active = index;
|
|
4657
6711
|
}
|
|
@@ -4676,28 +6730,28 @@ var OfficeUiSelect = class extends OfficeElement {
|
|
|
4676
6730
|
}
|
|
4677
6731
|
optionTemplates() {
|
|
4678
6732
|
let previousGroup = "";
|
|
4679
|
-
return this.choices.map((
|
|
4680
|
-
if (
|
|
4681
|
-
const heading =
|
|
4682
|
-
previousGroup =
|
|
4683
|
-
const
|
|
4684
|
-
const note =
|
|
6733
|
+
return this.choices.map((choice2, index) => {
|
|
6734
|
+
if (choice2.hidden) return "";
|
|
6735
|
+
const heading = choice2.group && choice2.group !== previousGroup ? html`<div class="group" role="presentation">${choice2.group}</div>` : "";
|
|
6736
|
+
previousGroup = choice2.group;
|
|
6737
|
+
const text2 = choice2.displayLabel ?? choice2.label;
|
|
6738
|
+
const note = choice2.description ? html`<span class="description">${choice2.description}</span>` : "";
|
|
4685
6739
|
return html`${heading}<div
|
|
4686
6740
|
class="option"
|
|
4687
6741
|
role="option"
|
|
4688
6742
|
id="${this.menuId}-${index}"
|
|
4689
6743
|
data-index=${index}
|
|
4690
6744
|
?data-active=${this.open && index === this.active}
|
|
4691
|
-
aria-selected=${String(
|
|
4692
|
-
aria-disabled=${String(
|
|
4693
|
-
style=${ifDefined(
|
|
4694
|
-
>${
|
|
6745
|
+
aria-selected=${String(choice2.value === this.value)}
|
|
6746
|
+
aria-disabled=${String(choice2.disabled)}
|
|
6747
|
+
style=${ifDefined(choice2.fontFamily ? `font-family:${choice2.fontFamily}` : void 0)}
|
|
6748
|
+
>${text2}${note}</div
|
|
4695
6749
|
>`;
|
|
4696
6750
|
});
|
|
4697
6751
|
}
|
|
4698
6752
|
render() {
|
|
4699
6753
|
const value = this.value;
|
|
4700
|
-
const shown = this.choices.find((
|
|
6754
|
+
const shown = this.choices.find((choice2) => choice2.value === value);
|
|
4701
6755
|
const name = this.getAttribute("aria-label");
|
|
4702
6756
|
const open = present(this.open);
|
|
4703
6757
|
const native = typeof HTMLElement.prototype.showPopover === "function";
|
|
@@ -4809,13 +6863,13 @@ var OfficeUiStatusBar = class extends OfficeElement {
|
|
|
4809
6863
|
>${glyph(spec.icon, "icon")}${spec.text ? html`<span class="label">${spec.text}</span>` : ""}</button
|
|
4810
6864
|
>`;
|
|
4811
6865
|
}
|
|
4812
|
-
zoomStep(id,
|
|
6866
|
+
zoomStep(id, label2, icon) {
|
|
4813
6867
|
return html`<button
|
|
4814
6868
|
type="button"
|
|
4815
6869
|
class="zoom-step"
|
|
4816
6870
|
data-id=${id}
|
|
4817
|
-
title=${
|
|
4818
|
-
aria-label=${
|
|
6871
|
+
title=${label2}
|
|
6872
|
+
aria-label=${label2}
|
|
4819
6873
|
@click=${() => this.activate(id)}
|
|
4820
6874
|
@keydown=${this.onKeydown}
|
|
4821
6875
|
>${glyph(icon, "icon")}</button
|
|
@@ -5397,28 +7451,6 @@ var defineTitleBar = definer("office-ui-title-bar", () => OfficeUiTitleBar, [
|
|
|
5397
7451
|
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/form/zoom-slider.css?raw
|
|
5398
7452
|
var zoom_slider_default = ":host {\n display: inline-flex;\n align-items: center;\n gap: var(--office-space-0);\n font-size: var(--office-font-size-xs);\n color: var(--office-foreground);\n font-family: var(--office-font);\n}\nbutton {\n box-sizing: border-box;\n display: inline-grid;\n place-items: center;\n min-width: var(--office-target-size);\n min-height: var(--office-target-size);\n padding: 0;\n border: var(--office-border-width) solid transparent;\n border-radius: var(--office-radius);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--office-font-size-lg);\n line-height: 1;\n cursor: pointer;\n}\nbutton:hover:not(:disabled) {\n background: var(--office-background);\n}\nbutton:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: calc(var(--office-focus-offset) / 2);\n}\nbutton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\ninput {\n width: var(--office-zoom-slider-width);\n min-width: var(--office-zoom-slider-min-width);\n margin: 0 var(--office-space-0);\n}\noutput {\n min-width: var(--office-zoom-value-width);\n text-align: center;\n font-variant-numeric: tabular-nums;\n}\nsvg {\n width: var(--office-icon-size-md);\n height: var(--office-icon-size-md);\n fill: none;\n stroke: currentColor;\n stroke-width: var(--office-icon-stroke);\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n:host(:not([fit])) .fit {\n display: none;\n}\n\n@media (pointer: coarse), (max-width: 767px) {\n input {\n flex: 1;\n }\n}\n@media (forced-colors: active) {\n button {\n color: ButtonText;\n }\n button:disabled {\n color: GrayText;\n }\n}\n";
|
|
5399
7453
|
|
|
5400
|
-
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/form/range-control.css?raw
|
|
5401
|
-
var range_control_default = ".office-range-control {\n accent-color: var(--office-accent);\n}\n.office-range-control:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: calc(var(--office-focus-offset) / 2);\n}\n.office-range-control:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n";
|
|
5402
|
-
function rangeControl(options) {
|
|
5403
|
-
return html`<input
|
|
5404
|
-
class="office-range-control"
|
|
5405
|
-
type="range"
|
|
5406
|
-
aria-label=${options.label}
|
|
5407
|
-
aria-valuetext=${options.valueText}
|
|
5408
|
-
min=${options.min}
|
|
5409
|
-
max=${options.max}
|
|
5410
|
-
step=${options.step ?? 1}
|
|
5411
|
-
.value=${String(options.value)}
|
|
5412
|
-
?disabled=${options.disabled}
|
|
5413
|
-
@input=${(event) => {
|
|
5414
|
-
if (!options.disabled) options.onInput(event.target.valueAsNumber);
|
|
5415
|
-
}}
|
|
5416
|
-
@change=${() => {
|
|
5417
|
-
if (!options.disabled) options.onChange();
|
|
5418
|
-
}}
|
|
5419
|
-
/>`;
|
|
5420
|
-
}
|
|
5421
|
-
|
|
5422
7454
|
// src/form/zoom-slider.ts
|
|
5423
7455
|
var clampTo = (value, min, max) => Math.min(max, Math.max(min, Math.round(value)));
|
|
5424
7456
|
var finite = (value, fallback) => Number.isFinite(value) ? value : fallback;
|
|
@@ -5466,9 +7498,9 @@ var OfficeUiZoomSlider = class extends OfficeElement {
|
|
|
5466
7498
|
}
|
|
5467
7499
|
/** Office buttons snap to the next multiple of `step`, so 67% steps to 70%, not 77%. */
|
|
5468
7500
|
stepBy(direction) {
|
|
5469
|
-
const
|
|
7501
|
+
const step2 = Math.max(1, finite(this.step, 10));
|
|
5470
7502
|
const current = this.value;
|
|
5471
|
-
const next = direction > 0 ? Math.floor(current /
|
|
7503
|
+
const next = direction > 0 ? Math.floor(current / step2) * step2 + step2 : Math.ceil(current / step2) * step2 - step2;
|
|
5472
7504
|
this.commit(next, "change");
|
|
5473
7505
|
}
|
|
5474
7506
|
commit(next, type) {
|
|
@@ -5586,8 +7618,8 @@ var OFFICE_SYMBOLS = [
|
|
|
5586
7618
|
"\u263A",
|
|
5587
7619
|
"\xBD"
|
|
5588
7620
|
];
|
|
5589
|
-
function parseOfficeSymbolCode(
|
|
5590
|
-
const match = /^\s*(?:u\+|0x)?([0-9a-f]{1,6})\s*$/i.exec(
|
|
7621
|
+
function parseOfficeSymbolCode(text2) {
|
|
7622
|
+
const match = /^\s*(?:u\+|0x)?([0-9a-f]{1,6})\s*$/i.exec(text2);
|
|
5591
7623
|
if (!match) return void 0;
|
|
5592
7624
|
const code = parseInt(match[1], 16);
|
|
5593
7625
|
if (code < 32 || code >= 127 && code <= 159 || code >= 55296 && code <= 57343 || (code & 65534) === 65534 || code >= 64976 && code <= 65007 || code > 1114111)
|
|
@@ -5685,6 +7717,7 @@ var OfficeUiColorGrid = class extends OfficeElement {
|
|
|
5685
7717
|
extraColors: { attribute: false },
|
|
5686
7718
|
standardColors: { attribute: false },
|
|
5687
7719
|
recentColors: { attribute: false },
|
|
7720
|
+
recentLabel: { attribute: false },
|
|
5688
7721
|
value: { type: String },
|
|
5689
7722
|
label: { type: String },
|
|
5690
7723
|
noneLabel: { attribute: "none-label", type: String },
|
|
@@ -5705,6 +7738,7 @@ var OfficeUiColorGrid = class extends OfficeElement {
|
|
|
5705
7738
|
this.extraColors = [];
|
|
5706
7739
|
this.standardColors = OFFICE_STANDARD_COLORS;
|
|
5707
7740
|
this.recentColors = [];
|
|
7741
|
+
this.recentLabel = null;
|
|
5708
7742
|
this.value = null;
|
|
5709
7743
|
this.label = null;
|
|
5710
7744
|
this.noneLabel = null;
|
|
@@ -5725,9 +7759,9 @@ var OfficeUiColorGrid = class extends OfficeElement {
|
|
|
5725
7759
|
items() {
|
|
5726
7760
|
return [...this.renderRoot.querySelectorAll("button:not(:disabled)")];
|
|
5727
7761
|
}
|
|
5728
|
-
pick(color, source,
|
|
7762
|
+
pick(color, source, label2, more = {}) {
|
|
5729
7763
|
if (present(this.disabled)) return;
|
|
5730
|
-
emit(this, "office-color-pick", { color, source, label, ...more });
|
|
7764
|
+
emit(this, "office-color-pick", { color, source, label: label2, ...more });
|
|
5731
7765
|
}
|
|
5732
7766
|
more() {
|
|
5733
7767
|
if (!present(this.disabled)) emit(this, "office-color-more", {});
|
|
@@ -5743,14 +7777,14 @@ var OfficeUiColorGrid = class extends OfficeElement {
|
|
|
5743
7777
|
const from = at(items[current]);
|
|
5744
7778
|
const inRow = (row) => items.filter((item) => at(item).row === row);
|
|
5745
7779
|
const rows = [...new Set(items.map((item) => at(item).row))];
|
|
5746
|
-
const
|
|
5747
|
-
const target = rows[rows.indexOf(from.row) +
|
|
7780
|
+
const vertical2 = (step2) => {
|
|
7781
|
+
const target = rows[rows.indexOf(from.row) + step2];
|
|
5748
7782
|
if (target === void 0) return void 0;
|
|
5749
7783
|
return inRow(target).reduce(
|
|
5750
7784
|
(best, item) => Math.abs(at(item).column - from.column) < Math.abs(at(best).column - from.column) ? item : best
|
|
5751
7785
|
);
|
|
5752
7786
|
};
|
|
5753
|
-
const next = event.key === "ArrowRight" ? items[current + 1] : event.key === "ArrowLeft" ? items[current - 1] : event.key === "ArrowDown" ?
|
|
7787
|
+
const next = event.key === "ArrowRight" ? items[current + 1] : event.key === "ArrowLeft" ? items[current - 1] : event.key === "ArrowDown" ? vertical2(1) : event.key === "ArrowUp" ? vertical2(-1) : event.key === "Home" ? items[0] : event.key === "End" ? items.at(-1) : void 0;
|
|
5754
7788
|
if (!["ArrowRight", "ArrowLeft", "ArrowDown", "ArrowUp", "Home", "End"].includes(event.key))
|
|
5755
7789
|
return;
|
|
5756
7790
|
if (!next && (event.key === "ArrowDown" || event.key === "ArrowUp")) return;
|
|
@@ -5768,7 +7802,7 @@ var OfficeUiColorGrid = class extends OfficeElement {
|
|
|
5768
7802
|
const position = this.selectedTheme;
|
|
5769
7803
|
const checked = (item, source, column) => position ? source === "theme" && column === position.column && item.variant?.kind === position.variant?.kind && item.variant?.percent === position.variant?.percent : value === item.hex;
|
|
5770
7804
|
let row = 0;
|
|
5771
|
-
const command = (
|
|
7805
|
+
const command = (text2, name2, checked2, run) => html`<button
|
|
5772
7806
|
type="button"
|
|
5773
7807
|
class="command"
|
|
5774
7808
|
data-command=${name2}
|
|
@@ -5778,7 +7812,7 @@ var OfficeUiColorGrid = class extends OfficeElement {
|
|
|
5778
7812
|
aria-checked=${checked2 === void 0 ? nothing : String(checked2)}
|
|
5779
7813
|
?disabled=${disabled}
|
|
5780
7814
|
@click=${run}
|
|
5781
|
-
>${
|
|
7815
|
+
>${text2}</button
|
|
5782
7816
|
>`;
|
|
5783
7817
|
const swatch = (item, source, column) => html`<button
|
|
5784
7818
|
type="button"
|
|
@@ -5817,7 +7851,10 @@ var OfficeUiColorGrid = class extends OfficeElement {
|
|
|
5817
7851
|
const item = column.variants[index];
|
|
5818
7852
|
return item && name ? { ...item, label: name(column.name, item.variant) } : item;
|
|
5819
7853
|
});
|
|
5820
|
-
const recent = (this.recentColors ?? []).map((hex) => normalizePaletteHex(hex)).filter((hex) => !!hex).slice(0, COLUMNS).map((hex) =>
|
|
7854
|
+
const recent = (this.recentColors ?? []).map((hex) => normalizePaletteHex(hex)).filter((hex) => !!hex).slice(0, COLUMNS).map((hex) => {
|
|
7855
|
+
const upper = hex.toUpperCase();
|
|
7856
|
+
return { hex, label: this.recentLabel?.(upper) ?? upper };
|
|
7857
|
+
});
|
|
5821
7858
|
const automatic = this.automaticLabel;
|
|
5822
7859
|
const none = this.noneLabel;
|
|
5823
7860
|
const more = this.moreLabel;
|
|
@@ -5828,17 +7865,17 @@ var OfficeUiColorGrid = class extends OfficeElement {
|
|
|
5828
7865
|
value === "automatic",
|
|
5829
7866
|
() => this.pick("automatic", "automatic", automatic)
|
|
5830
7867
|
) : nothing}${none ? command(none, "none", value === "none", () => this.pick("none", "none", none)) : nothing}
|
|
5831
|
-
|
|
5832
|
-
|
|
7868
|
+
${palette.length ? html`<div class="heading">${this.themeHeading}</div>
|
|
7869
|
+
${cells(
|
|
5833
7870
|
palette.map((column) => column.base),
|
|
5834
7871
|
"theme",
|
|
5835
|
-
palette.length
|
|
7872
|
+
palette.length
|
|
5836
7873
|
)}
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
(index) => cells(variants(index), "theme", palette.length
|
|
7874
|
+
<div class="variants"
|
|
7875
|
+
>${[0, 1, 2, 3, 4].map(
|
|
7876
|
+
(index) => cells(variants(index), "theme", palette.length)
|
|
5840
7877
|
)}</div
|
|
5841
|
-
|
|
7878
|
+
>` : nothing}
|
|
5842
7879
|
${extra.length ? cells(extra, "extra") : nothing}
|
|
5843
7880
|
${standard.length ? html`<div class="heading">${this.standardHeading}</div> ${cells(standard, "standard")}` : nothing}
|
|
5844
7881
|
${recent.length ? html`<div class="heading">${this.recentHeading}</div> ${cells(recent, "recent")}` : nothing}
|
|
@@ -5932,18 +7969,18 @@ var OfficeUiColorCustom = class extends OfficeElement {
|
|
|
5932
7969
|
};
|
|
5933
7970
|
}
|
|
5934
7971
|
squareKey(event) {
|
|
5935
|
-
const
|
|
7972
|
+
const step2 = event.shiftKey ? 10 : 1;
|
|
5936
7973
|
const { h, s } = this.hsl;
|
|
5937
|
-
const next = event.key === "ArrowRight" ? { h: clamp(h +
|
|
7974
|
+
const next = event.key === "ArrowRight" ? { h: clamp(h + step2 * (360 / SCALE), 359.999) } : event.key === "ArrowLeft" ? { h: clamp(h - step2 * (360 / SCALE), 359.999) } : event.key === "ArrowUp" ? { s: clamp(s + step2 / SCALE) } : event.key === "ArrowDown" ? { s: clamp(s - step2 / SCALE) } : event.key === "Home" ? { h: 0 } : event.key === "End" ? { h: 359.999 } : void 0;
|
|
5938
7975
|
if (!next) return;
|
|
5939
7976
|
event.preventDefault();
|
|
5940
7977
|
event.stopPropagation();
|
|
5941
7978
|
this.set(next);
|
|
5942
7979
|
}
|
|
5943
7980
|
sliderKey(event) {
|
|
5944
|
-
const
|
|
7981
|
+
const step2 = (event.shiftKey ? 10 : 1) / SCALE;
|
|
5945
7982
|
const { l } = this.hsl;
|
|
5946
|
-
const next = event.key === "ArrowUp" || event.key === "ArrowRight" ? clamp(l +
|
|
7983
|
+
const next = event.key === "ArrowUp" || event.key === "ArrowRight" ? clamp(l + step2) : event.key === "ArrowDown" || event.key === "ArrowLeft" ? clamp(l - step2) : event.key === "Home" ? 0 : event.key === "End" ? 1 : void 0;
|
|
5947
7984
|
if (next === void 0) return;
|
|
5948
7985
|
event.preventDefault();
|
|
5949
7986
|
event.stopPropagation();
|
|
@@ -5978,10 +8015,10 @@ var OfficeUiColorCustom = class extends OfficeElement {
|
|
|
5978
8015
|
}
|
|
5979
8016
|
onHex(event) {
|
|
5980
8017
|
if (present(this.disabled)) return;
|
|
5981
|
-
const
|
|
5982
|
-
const color = /^#?[0-9a-f]{6}$/i.test(
|
|
8018
|
+
const text2 = event.target.value;
|
|
8019
|
+
const color = /^#?[0-9a-f]{6}$/i.test(text2.trim()) ? normalizePaletteHex(text2) : void 0;
|
|
5983
8020
|
if (!color) {
|
|
5984
|
-
this.typed =
|
|
8021
|
+
this.typed = text2;
|
|
5985
8022
|
return;
|
|
5986
8023
|
}
|
|
5987
8024
|
const rgb = hexToRgbChannels(color);
|
|
@@ -6051,8 +8088,8 @@ var OfficeUiColorCustom = class extends OfficeElement {
|
|
|
6051
8088
|
@input=${this.onHex}
|
|
6052
8089
|
/></label>
|
|
6053
8090
|
${CHANNELS.map(
|
|
6054
|
-
([name,
|
|
6055
|
-
><span>${
|
|
8091
|
+
([name, text2]) => html`<label
|
|
8092
|
+
><span>${text2}</span
|
|
6056
8093
|
><input
|
|
6057
8094
|
type="number"
|
|
6058
8095
|
min="0"
|
|
@@ -6200,17 +8237,17 @@ var OfficeUiChartPicker = class extends OfficeElement {
|
|
|
6200
8237
|
}
|
|
6201
8238
|
render() {
|
|
6202
8239
|
defineGallery(this.ownerDocument.defaultView?.customElements);
|
|
6203
|
-
const
|
|
8240
|
+
const text2 = this.text;
|
|
6204
8241
|
const hasGrouping = this.groupingList.length > 0 && this.grouped.includes(this.choice.type);
|
|
6205
8242
|
return html`<office-ui-gallery
|
|
6206
8243
|
mode="panel"
|
|
6207
8244
|
@office-gallery-pick=${(event) => this.picked(event)}
|
|
6208
8245
|
></office-ui-gallery
|
|
6209
8246
|
>${hasGrouping ? html`<label class="field"
|
|
6210
|
-
><span>${
|
|
8247
|
+
><span>${text2.grouping}</span
|
|
6211
8248
|
><select
|
|
6212
8249
|
data-key="grouping"
|
|
6213
|
-
aria-label=${
|
|
8250
|
+
aria-label=${text2.grouping}
|
|
6214
8251
|
@change=${(event) => this.edit({ grouping: event.target.value })}
|
|
6215
8252
|
>${this.groupingList.map(
|
|
6216
8253
|
(grouping) => html`<option
|
|
@@ -6221,28 +8258,315 @@ var OfficeUiChartPicker = class extends OfficeElement {
|
|
|
6221
8258
|
)}</select
|
|
6222
8259
|
></label
|
|
6223
8260
|
>` : nothing}${this.changeOnly ? nothing : html`<label class="field"
|
|
6224
|
-
><span>${
|
|
8261
|
+
><span>${text2.title}</span
|
|
6225
8262
|
><input
|
|
6226
8263
|
data-key="title"
|
|
6227
8264
|
type="text"
|
|
6228
|
-
aria-label=${
|
|
8265
|
+
aria-label=${text2.title}
|
|
6229
8266
|
.value=${this.choice.title}
|
|
6230
8267
|
@input=${(event) => this.edit({ title: event.target.value })}
|
|
6231
8268
|
/></label>`}${this.choice.data === void 0 || this.changeOnly ? nothing : html`<label class="field"
|
|
6232
|
-
><span>${
|
|
8269
|
+
><span>${text2.data}</span
|
|
6233
8270
|
><textarea
|
|
6234
8271
|
data-key="data"
|
|
6235
8272
|
rows="5"
|
|
6236
8273
|
spellcheck="false"
|
|
6237
|
-
aria-label=${
|
|
8274
|
+
aria-label=${text2.data}
|
|
6238
8275
|
.value=${this.choice.data}
|
|
6239
8276
|
@input=${(event) => this.edit({ data: event.target.value })}
|
|
6240
8277
|
></textarea
|
|
6241
|
-
><small>${
|
|
6242
|
-
>`} <div class="preview" role="img" aria-label=${
|
|
8278
|
+
><small>${text2.dataHint}</small></label
|
|
8279
|
+
>`} <div class="preview" role="img" aria-label=${text2.preview}></div>`;
|
|
6243
8280
|
}
|
|
6244
8281
|
};
|
|
6245
8282
|
var defineChartPicker = definer("office-ui-chart-picker", () => OfficeUiChartPicker);
|
|
8283
|
+
|
|
8284
|
+
// src/chart/data-sheet-keys.ts
|
|
8285
|
+
var STEPS = {
|
|
8286
|
+
ArrowUp: [-1, 0],
|
|
8287
|
+
ArrowDown: [1, 0],
|
|
8288
|
+
ArrowLeft: [0, -1],
|
|
8289
|
+
ArrowRight: [0, 1]
|
|
8290
|
+
};
|
|
8291
|
+
function exists(row, col, rows, cols) {
|
|
8292
|
+
return row >= 0 && col >= 0 && row < rows && col < cols && !(row === 0 && col === 0);
|
|
8293
|
+
}
|
|
8294
|
+
function step(row, col, [dr, dc], rows, cols) {
|
|
8295
|
+
return exists(row + dr, col + dc, rows, cols) ? { row: row + dr, col: col + dc } : { row, col };
|
|
8296
|
+
}
|
|
8297
|
+
function chartDataSheetKeyAction(key, mode, row, col, rows, cols) {
|
|
8298
|
+
if (key.ctrlKey || key.metaKey || key.altKey) return { type: "native" };
|
|
8299
|
+
const arrow = STEPS[key.key];
|
|
8300
|
+
if (arrow) {
|
|
8301
|
+
return mode === "edit" ? { type: "native" } : { type: "move", ...step(row, col, arrow, rows, cols) };
|
|
8302
|
+
}
|
|
8303
|
+
switch (key.key) {
|
|
8304
|
+
case "F2":
|
|
8305
|
+
return { type: "edit" };
|
|
8306
|
+
case "Escape":
|
|
8307
|
+
return { type: "revert" };
|
|
8308
|
+
case "Enter":
|
|
8309
|
+
return { type: "move", ...step(row, col, key.shiftKey ? [-1, 0] : [1, 0], rows, cols) };
|
|
8310
|
+
case "Tab": {
|
|
8311
|
+
const target = step(row, col, key.shiftKey ? [0, -1] : [0, 1], rows, cols);
|
|
8312
|
+
return target.col === col ? { type: "native" } : { type: "move", ...target };
|
|
8313
|
+
}
|
|
8314
|
+
case "Backspace":
|
|
8315
|
+
case "Delete":
|
|
8316
|
+
return mode === "ready" ? { type: "typing" } : { type: "native" };
|
|
8317
|
+
default:
|
|
8318
|
+
return key.key.length === 1 && mode === "ready" ? { type: "typing" } : { type: "native" };
|
|
8319
|
+
}
|
|
8320
|
+
}
|
|
8321
|
+
|
|
8322
|
+
// src/chart/data-sheet-labels.ts
|
|
8323
|
+
var CHART_DATA_SHEET_ENGLISH = {
|
|
8324
|
+
heading: "Data",
|
|
8325
|
+
addCategory: "Add category",
|
|
8326
|
+
addSeries: "Add series",
|
|
8327
|
+
addCategoryShort: "Cat",
|
|
8328
|
+
addSeriesShort: "Series",
|
|
8329
|
+
removeCategory: "Remove category",
|
|
8330
|
+
removeSeries: "Remove series",
|
|
8331
|
+
categories: "Categories",
|
|
8332
|
+
seriesName: "Series {number}",
|
|
8333
|
+
categoryLabel: "Categories {number}",
|
|
8334
|
+
valueCell: "{name} value {number}",
|
|
8335
|
+
summary: "{series} series \xB7 {categories} categories",
|
|
8336
|
+
invalidNumber: "Enter a number"
|
|
8337
|
+
};
|
|
8338
|
+
function fill2(template, values) {
|
|
8339
|
+
return template.replace(
|
|
8340
|
+
/\{\{?(\w+)\}?\}/g,
|
|
8341
|
+
(whole, key) => key in values ? String(values[key]) : whole
|
|
8342
|
+
);
|
|
8343
|
+
}
|
|
8344
|
+
|
|
8345
|
+
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/chart/data-sheet.css?raw
|
|
8346
|
+
var data_sheet_default = ":host {\n display: flex;\n flex-direction: column;\n gap: var(--office-space-1-5);\n min-width: 0;\n font-family: var(--office-font);\n font-size: var(--office-font-size-xs);\n color: var(--office-foreground);\n}\n:host([hidden]),\n[hidden] {\n display: none !important;\n}\n.head {\n display: flex;\n align-items: center;\n gap: var(--office-space-1-5);\n}\n.heading {\n font-weight: var(--office-font-weight-bold);\n}\n.actions {\n display: flex;\n gap: var(--office-space-1);\n margin-inline-start: auto;\n}\n.actions button {\n min-height: var(--office-control-height-xs);\n padding: 0 var(--office-space-1-5);\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius-sm);\n background: var(--office-surface);\n color: inherit;\n font: inherit;\n cursor: pointer;\n}\n.actions button:hover {\n background: var(--office-selected);\n}\n.summary,\n.status {\n color: var(--office-muted-foreground);\n}\n.status:empty {\n display: none;\n}\n/* Wide sheets scroll inside the element; the pane around it never scrolls sideways. */\n.scroll {\n overflow-x: auto;\n}\ntable {\n width: 100%;\n border-collapse: collapse;\n}\nth,\ntd {\n min-width: calc(var(--office-space-4) * 4);\n padding: var(--office-space-px);\n border: var(--office-border-width) solid var(--office-border);\n font-weight: normal;\n text-align: start;\n}\nthead th,\nth.category {\n background: var(--office-surface);\n}\n/* The category column stays in view while the value columns scroll. */\nth.corner,\nth.category {\n position: sticky;\n inset-inline-start: 0;\n z-index: 1;\n}\n.header {\n display: flex;\n align-items: center;\n gap: var(--office-space-0);\n}\n.cell {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n height: var(--office-control-height-xs);\n padding: 0 var(--office-space-1);\n border: var(--office-border-width) solid transparent;\n border-radius: var(--office-radius-xs);\n background: transparent;\n color: inherit;\n font: inherit;\n outline: none;\n}\ntd .cell {\n text-align: end;\n font-variant-numeric: tabular-nums;\n}\n.cell:focus {\n border-color: var(--office-accent);\n background: var(--office-background);\n}\n.cell:disabled {\n opacity: 0.6;\n}\n/* The cell of the chart part picked on the canvas. */\n.cell.highlight {\n box-shadow: inset 0 0 0 var(--office-border-width) var(--office-accent);\n}\n.remove {\n flex: none;\n width: var(--office-icon-size-md);\n padding: 0;\n border: none;\n background: transparent;\n color: var(--office-muted-foreground);\n cursor: pointer;\n}\n.remove:hover {\n color: var(--office-danger);\n}\n@media (pointer: coarse), (max-width: 767px) {\n .actions button,\n .remove {\n min-width: var(--office-touch-target);\n min-height: var(--office-touch-target);\n }\n}\n";
|
|
8347
|
+
|
|
8348
|
+
// src/chart/data-sheet.ts
|
|
8349
|
+
var EMPTY2 = { categories: [], series: [] };
|
|
8350
|
+
var OfficeUiChartDataSheet = class extends OfficeElement {
|
|
8351
|
+
static styles = controlStyles(data_sheet_default);
|
|
8352
|
+
static properties = {
|
|
8353
|
+
data: { attribute: false },
|
|
8354
|
+
highlight: { attribute: false },
|
|
8355
|
+
disabled: { type: Boolean, reflect: true },
|
|
8356
|
+
locale: { type: String }
|
|
8357
|
+
};
|
|
8358
|
+
text = CHART_DATA_SHEET_ENGLISH;
|
|
8359
|
+
mode = "ready";
|
|
8360
|
+
invalid = false;
|
|
8361
|
+
highlightKey = null;
|
|
8362
|
+
constructor() {
|
|
8363
|
+
super();
|
|
8364
|
+
this.data = EMPTY2;
|
|
8365
|
+
this.highlight = null;
|
|
8366
|
+
this.disabled = false;
|
|
8367
|
+
this.locale = "";
|
|
8368
|
+
}
|
|
8369
|
+
get labels() {
|
|
8370
|
+
return this.text;
|
|
8371
|
+
}
|
|
8372
|
+
set labels(value) {
|
|
8373
|
+
this.text = { ...CHART_DATA_SHEET_ENGLISH, ...value };
|
|
8374
|
+
this.requestUpdate("labels");
|
|
8375
|
+
}
|
|
8376
|
+
/** The number convention: `locale`, else the browser's, as Office follows the system locale. */
|
|
8377
|
+
get language() {
|
|
8378
|
+
return this.locale || globalThis.navigator?.language || void 0;
|
|
8379
|
+
}
|
|
8380
|
+
parse = (raw) => parseLocaleNumber(raw, this.language);
|
|
8381
|
+
/** The text a cell shows for the current data. */
|
|
8382
|
+
cellText(row, col) {
|
|
8383
|
+
if (row === 0) return this.data.series[col - 1]?.name ?? "";
|
|
8384
|
+
if (col === 0) return this.data.categories[row - 1] ?? "";
|
|
8385
|
+
const value = this.data.series[col - 1]?.values[row - 1];
|
|
8386
|
+
return typeof value === "number" ? formatLocaleNumber(value, this.language) : "";
|
|
8387
|
+
}
|
|
8388
|
+
/**
|
|
8389
|
+
* Applies `edits` to the shown data and emits them. Product subclasses override this to map
|
|
8390
|
+
* the edits onto their own model as well.
|
|
8391
|
+
*/
|
|
8392
|
+
emitEdits(edits) {
|
|
8393
|
+
if (edits.length === 0 || this.disabled) return;
|
|
8394
|
+
this.data = applyChartDataSheetEdits(this.data, edits);
|
|
8395
|
+
const detail = { edits, data: this.data };
|
|
8396
|
+
this.fire("office-chart-data-change", detail);
|
|
8397
|
+
}
|
|
8398
|
+
position(input) {
|
|
8399
|
+
return { row: Number(input.dataset.row), col: Number(input.dataset.col) };
|
|
8400
|
+
}
|
|
8401
|
+
commit(input) {
|
|
8402
|
+
const cell = this.position(input);
|
|
8403
|
+
if (input.value === this.cellText(cell.row, cell.col)) return;
|
|
8404
|
+
const edit = chartDataSheetCellEdit(cell, input.value, this.parse);
|
|
8405
|
+
this.invalid = edit === null;
|
|
8406
|
+
if (edit) this.emitEdits([edit]);
|
|
8407
|
+
this.requestUpdate();
|
|
8408
|
+
}
|
|
8409
|
+
focusCell(row, col) {
|
|
8410
|
+
const cell = this.renderRoot.querySelector(
|
|
8411
|
+
`input[data-row="${row}"][data-col="${col}"]`
|
|
8412
|
+
);
|
|
8413
|
+
cell?.focus();
|
|
8414
|
+
cell?.select();
|
|
8415
|
+
}
|
|
8416
|
+
onKeyDown(event) {
|
|
8417
|
+
event.stopPropagation();
|
|
8418
|
+
const input = event.target;
|
|
8419
|
+
const { row, col } = this.position(input);
|
|
8420
|
+
const rows = this.data.categories.length + 1;
|
|
8421
|
+
const cols = this.data.series.length + 1;
|
|
8422
|
+
const action = chartDataSheetKeyAction(event, this.mode, row, col, rows, cols);
|
|
8423
|
+
if (action.type === "native") return;
|
|
8424
|
+
if (action.type === "typing") {
|
|
8425
|
+
this.mode = "enter";
|
|
8426
|
+
return;
|
|
8427
|
+
}
|
|
8428
|
+
event.preventDefault();
|
|
8429
|
+
if (action.type === "edit") {
|
|
8430
|
+
this.mode = "edit";
|
|
8431
|
+
input.setSelectionRange(input.value.length, input.value.length);
|
|
8432
|
+
} else if (action.type === "revert") {
|
|
8433
|
+
input.value = this.cellText(row, col);
|
|
8434
|
+
this.mode = "ready";
|
|
8435
|
+
this.invalid = false;
|
|
8436
|
+
this.requestUpdate();
|
|
8437
|
+
input.select();
|
|
8438
|
+
} else {
|
|
8439
|
+
this.commit(input);
|
|
8440
|
+
this.focusCell(action.row, action.col);
|
|
8441
|
+
}
|
|
8442
|
+
}
|
|
8443
|
+
onFocus(event) {
|
|
8444
|
+
this.mode = "ready";
|
|
8445
|
+
event.target.select();
|
|
8446
|
+
}
|
|
8447
|
+
onPaste(event) {
|
|
8448
|
+
event.stopPropagation();
|
|
8449
|
+
const text2 = event.clipboardData?.getData("text/plain") ?? "";
|
|
8450
|
+
if (!/[\t\n\r]/.test(text2.replace(/\r?\n$/, ""))) return;
|
|
8451
|
+
event.preventDefault();
|
|
8452
|
+
const anchor = this.position(event.target);
|
|
8453
|
+
this.emitEdits(chartDataSheetPasteEdits(this.data, anchor, parseTsv(text2), this.parse));
|
|
8454
|
+
}
|
|
8455
|
+
updated() {
|
|
8456
|
+
const { highlight } = this;
|
|
8457
|
+
const key = highlight ? `${highlight.series}:${highlight.point ?? ""}` : null;
|
|
8458
|
+
if (key !== null && key !== this.highlightKey) {
|
|
8459
|
+
this.renderRoot.querySelector(".highlight")?.scrollIntoView?.({
|
|
8460
|
+
block: "nearest",
|
|
8461
|
+
inline: "nearest"
|
|
8462
|
+
});
|
|
8463
|
+
}
|
|
8464
|
+
this.highlightKey = key;
|
|
8465
|
+
}
|
|
8466
|
+
cell(row, col, label2, marked) {
|
|
8467
|
+
return html`<input
|
|
8468
|
+
type="text"
|
|
8469
|
+
class=${marked ? "cell highlight" : "cell"}
|
|
8470
|
+
inputmode=${row > 0 && col > 0 ? "decimal" : "text"}
|
|
8471
|
+
data-row=${row}
|
|
8472
|
+
data-col=${col}
|
|
8473
|
+
aria-label=${label2}
|
|
8474
|
+
?disabled=${this.disabled}
|
|
8475
|
+
.value=${live(this.cellText(row, col))}
|
|
8476
|
+
@focus=${this.onFocus}
|
|
8477
|
+
@keydown=${this.onKeyDown}
|
|
8478
|
+
@change=${(event) => this.commit(event.target)}
|
|
8479
|
+
@paste=${this.onPaste}
|
|
8480
|
+
@copy=${(event) => event.stopPropagation()}
|
|
8481
|
+
@cut=${(event) => event.stopPropagation()}
|
|
8482
|
+
/>`;
|
|
8483
|
+
}
|
|
8484
|
+
removeButton(label2, edit) {
|
|
8485
|
+
return html`<button
|
|
8486
|
+
type="button"
|
|
8487
|
+
class="remove"
|
|
8488
|
+
title=${label2}
|
|
8489
|
+
aria-label=${label2}
|
|
8490
|
+
@click=${() => this.emitEdits([edit])}
|
|
8491
|
+
>×</button
|
|
8492
|
+
>`;
|
|
8493
|
+
}
|
|
8494
|
+
render() {
|
|
8495
|
+
const { categories, series } = this.data;
|
|
8496
|
+
const t2 = this.text;
|
|
8497
|
+
const edit = !this.disabled;
|
|
8498
|
+
const mark = this.highlight;
|
|
8499
|
+
return html`<div class="head"
|
|
8500
|
+
><span class="heading">${t2.heading}</span>${edit ? html`<span class="actions"
|
|
8501
|
+
><button
|
|
8502
|
+
type="button"
|
|
8503
|
+
data-action="add-category"
|
|
8504
|
+
title=${t2.addCategory}
|
|
8505
|
+
aria-label=${t2.addCategory}
|
|
8506
|
+
@click=${() => this.emitEdits([{ kind: "add-category" }])}
|
|
8507
|
+
>+ ${t2.addCategoryShort}</button
|
|
8508
|
+
><button
|
|
8509
|
+
type="button"
|
|
8510
|
+
data-action="add-series"
|
|
8511
|
+
title=${t2.addSeries}
|
|
8512
|
+
aria-label=${t2.addSeries}
|
|
8513
|
+
@click=${() => this.emitEdits([{ kind: "add-series" }])}
|
|
8514
|
+
>+ ${t2.addSeriesShort}</button
|
|
8515
|
+
></span
|
|
8516
|
+
>` : nothing}</div
|
|
8517
|
+
><div class="summary"
|
|
8518
|
+
>${fill2(t2.summary, { series: series.length, categories: categories.length })}</div
|
|
8519
|
+
><div class="scroll"
|
|
8520
|
+
><table role="grid" aria-label=${t2.heading}
|
|
8521
|
+
><thead
|
|
8522
|
+
><tr
|
|
8523
|
+
><th class="corner" aria-label=${t2.categories}></th>${series.map(
|
|
8524
|
+
(entry, index) => html`<th
|
|
8525
|
+
><span class="header"
|
|
8526
|
+
>${this.cell(
|
|
8527
|
+
0,
|
|
8528
|
+
index + 1,
|
|
8529
|
+
fill2(t2.seriesName, { number: index + 1 }),
|
|
8530
|
+
mark?.series === index && mark.point === void 0
|
|
8531
|
+
)}${edit && series.length > 1 ? this.removeButton(t2.removeSeries, {
|
|
8532
|
+
kind: "remove-series",
|
|
8533
|
+
series: index
|
|
8534
|
+
}) : nothing}</span
|
|
8535
|
+
></th
|
|
8536
|
+
>`
|
|
8537
|
+
)}</tr
|
|
8538
|
+
></thead
|
|
8539
|
+
><tbody
|
|
8540
|
+
>${categories.map(
|
|
8541
|
+
(_, row) => html`<tr
|
|
8542
|
+
><th class="category"
|
|
8543
|
+
><span class="header"
|
|
8544
|
+
>${this.cell(row + 1, 0, fill2(t2.categoryLabel, { number: row + 1 }), false)}${edit && categories.length > 1 ? this.removeButton(t2.removeCategory, {
|
|
8545
|
+
kind: "remove-category",
|
|
8546
|
+
category: row
|
|
8547
|
+
}) : nothing}</span
|
|
8548
|
+
></th
|
|
8549
|
+
>${series.map(
|
|
8550
|
+
(entry, col) => html`<td
|
|
8551
|
+
>${this.cell(
|
|
8552
|
+
row + 1,
|
|
8553
|
+
col + 1,
|
|
8554
|
+
fill2(t2.valueCell, { name: entry.name, number: row + 1 }),
|
|
8555
|
+
mark?.series === col && mark.point === row
|
|
8556
|
+
)}</td
|
|
8557
|
+
>`
|
|
8558
|
+
)}</tr
|
|
8559
|
+
>`
|
|
8560
|
+
)}</tbody
|
|
8561
|
+
></table
|
|
8562
|
+
></div
|
|
8563
|
+
><div class="status" role="status">${this.invalid ? t2.invalidNumber : ""}</div>`;
|
|
8564
|
+
}
|
|
8565
|
+
};
|
|
8566
|
+
var defineChartDataSheet = definer(
|
|
8567
|
+
"office-ui-chart-data-sheet",
|
|
8568
|
+
() => OfficeUiChartDataSheet
|
|
8569
|
+
);
|
|
6246
8570
|
function deepActiveElement(doc) {
|
|
6247
8571
|
let active = doc.activeElement;
|
|
6248
8572
|
while (active?.shadowRoot?.activeElement) {
|
|
@@ -6519,14 +8843,14 @@ function attachKeyTips(scope) {
|
|
|
6519
8843
|
|
|
6520
8844
|
// src/ribbon/keytip-run.ts
|
|
6521
8845
|
var clash = (used, key) => used.some((other) => other.startsWith(key) || key.startsWith(other));
|
|
6522
|
-
function assignKeyTips(targets,
|
|
8846
|
+
function assignKeyTips(targets, label2) {
|
|
6523
8847
|
const used = [];
|
|
6524
8848
|
for (const target of targets) {
|
|
6525
8849
|
if (target.key && !clash(used, target.key)) used.push(target.key);
|
|
6526
8850
|
else target.key = "";
|
|
6527
8851
|
}
|
|
6528
8852
|
for (const target of targets.filter((item) => !item.key)) {
|
|
6529
|
-
const source =
|
|
8853
|
+
const source = label2(target).toUpperCase().replace(/[^A-Z0-9]/g, "") || "ZZ";
|
|
6530
8854
|
let key = "";
|
|
6531
8855
|
for (let a = 0; a < source.length && !key; a++)
|
|
6532
8856
|
for (let b = a + 1; b < source.length && !key; b++) {
|
|
@@ -6595,17 +8919,17 @@ function ensureRibbonTouchStyle(node) {
|
|
|
6595
8919
|
style.textContent = scroll_more_default;
|
|
6596
8920
|
host.append(style);
|
|
6597
8921
|
}
|
|
6598
|
-
function syncScrollMore(panel,
|
|
8922
|
+
function syncScrollMore(panel, label2 = "More") {
|
|
6599
8923
|
panel.querySelector(`:scope > .${CLASS}`)?.remove();
|
|
6600
8924
|
if (panel.hidden || panel.scrollWidth <= panel.clientWidth + 1) return;
|
|
6601
8925
|
ensureRibbonTouchStyle(panel);
|
|
6602
8926
|
const doc = panel.ownerDocument;
|
|
6603
|
-
const
|
|
8927
|
+
const text2 = typeof label2 === "function" ? label2(panel) : label2;
|
|
6604
8928
|
const button = doc.createElement("button");
|
|
6605
8929
|
button.type = "button";
|
|
6606
8930
|
button.className = CLASS;
|
|
6607
|
-
button.setAttribute("aria-label",
|
|
6608
|
-
button.title =
|
|
8931
|
+
button.setAttribute("aria-label", text2);
|
|
8932
|
+
button.title = text2;
|
|
6609
8933
|
button.textContent = "\u203A";
|
|
6610
8934
|
button.addEventListener("mousedown", (event) => event.preventDefault());
|
|
6611
8935
|
button.addEventListener("click", () => {
|
|
@@ -6721,12 +9045,12 @@ function createRibbonOverflow(options) {
|
|
|
6721
9045
|
button = overflowButton(group);
|
|
6722
9046
|
group.append(button);
|
|
6723
9047
|
}
|
|
6724
|
-
const
|
|
9048
|
+
const label2 = group.dataset.caption ?? group.dataset.label ?? "";
|
|
6725
9049
|
const span = button.querySelector("span");
|
|
6726
|
-
if (options.setCaption) options.setCaption(span,
|
|
6727
|
-
else span.textContent =
|
|
6728
|
-
button.setAttribute("aria-label",
|
|
6729
|
-
button.title =
|
|
9050
|
+
if (options.setCaption) options.setCaption(span, label2);
|
|
9051
|
+
else span.textContent = label2;
|
|
9052
|
+
button.setAttribute("aria-label", label2);
|
|
9053
|
+
button.title = label2;
|
|
6730
9054
|
group.setAttribute("data-collapsed", "");
|
|
6731
9055
|
}
|
|
6732
9056
|
syncScrollMore(panel, options.moreLabel);
|
|
@@ -6970,48 +9294,48 @@ var UNAVAILABLE = {
|
|
|
6970
9294
|
reason: "Not available. Documents stay local and active content is never run."
|
|
6971
9295
|
}
|
|
6972
9296
|
};
|
|
6973
|
-
function optionText(context,
|
|
6974
|
-
return context.t(
|
|
9297
|
+
function optionText(context, text2) {
|
|
9298
|
+
return context.t(text2).replace("{product}", context.product);
|
|
6975
9299
|
}
|
|
6976
|
-
function unavailableCategory(context, kind,
|
|
9300
|
+
function unavailableCategory(context, kind, text2 = {}) {
|
|
6977
9301
|
const entry = UNAVAILABLE[kind];
|
|
6978
9302
|
return {
|
|
6979
9303
|
id: entry.id,
|
|
6980
9304
|
label: context.t(entry.label),
|
|
6981
|
-
description: optionText(context,
|
|
9305
|
+
description: optionText(context, text2.description ?? entry.description),
|
|
6982
9306
|
sections: [],
|
|
6983
|
-
disabled: optionText(context,
|
|
9307
|
+
disabled: optionText(context, text2.reason ?? entry.reason)
|
|
6984
9308
|
};
|
|
6985
9309
|
}
|
|
6986
|
-
function unavailableControl(context,
|
|
6987
|
-
return { ...
|
|
9310
|
+
function unavailableControl(context, control2, reason) {
|
|
9311
|
+
return { ...control2, disabled: context.t(reason) };
|
|
6988
9312
|
}
|
|
6989
9313
|
function userInterfaceSection(context) {
|
|
6990
|
-
const { t } = context;
|
|
9314
|
+
const { t: t2 } = context;
|
|
6991
9315
|
return {
|
|
6992
9316
|
id: "ui",
|
|
6993
|
-
title:
|
|
9317
|
+
title: t2("User Interface options"),
|
|
6994
9318
|
controls: [
|
|
6995
9319
|
{
|
|
6996
9320
|
kind: "toggle",
|
|
6997
9321
|
key: "miniToolbar",
|
|
6998
|
-
label:
|
|
6999
|
-
disabled:
|
|
9322
|
+
label: t2("Show Mini Toolbar on selection"),
|
|
9323
|
+
disabled: t2("Not available yet. Needs rich text formatting.")
|
|
7000
9324
|
},
|
|
7001
9325
|
{
|
|
7002
9326
|
kind: "toggle",
|
|
7003
9327
|
key: "livePreview",
|
|
7004
|
-
label:
|
|
7005
|
-
disabled:
|
|
9328
|
+
label: t2("Enable Live Preview"),
|
|
9329
|
+
disabled: t2(
|
|
7006
9330
|
"Not available yet. Styles are applied on click; hover previews are not drawn yet."
|
|
7007
9331
|
)
|
|
7008
9332
|
},
|
|
7009
9333
|
{
|
|
7010
9334
|
kind: "select",
|
|
7011
9335
|
key: "screenTips",
|
|
7012
|
-
label:
|
|
7013
|
-
choices: [{ value: "descriptions", label:
|
|
7014
|
-
disabled:
|
|
9336
|
+
label: t2("ScreenTip style"),
|
|
9337
|
+
choices: [{ value: "descriptions", label: t2("Show feature descriptions in ScreenTips") }],
|
|
9338
|
+
disabled: t2("Not available yet. ScreenTips always describe the command.")
|
|
7015
9339
|
}
|
|
7016
9340
|
]
|
|
7017
9341
|
};
|
|
@@ -7025,13 +9349,13 @@ function personalizeSection(context, controls, description) {
|
|
|
7025
9349
|
};
|
|
7026
9350
|
}
|
|
7027
9351
|
function optionsLabels(context) {
|
|
7028
|
-
const { t } = context;
|
|
9352
|
+
const { t: t2 } = context;
|
|
7029
9353
|
return {
|
|
7030
|
-
ok:
|
|
7031
|
-
cancel:
|
|
7032
|
-
reset:
|
|
7033
|
-
categories:
|
|
7034
|
-
close:
|
|
9354
|
+
ok: t2("OK"),
|
|
9355
|
+
cancel: t2("Cancel"),
|
|
9356
|
+
reset: t2("Reset all options"),
|
|
9357
|
+
categories: t2("Categories"),
|
|
9358
|
+
close: t2("Close")
|
|
7035
9359
|
};
|
|
7036
9360
|
}
|
|
7037
9361
|
|
|
@@ -7075,14 +9399,16 @@ var CONTROL_DEFINERS = [
|
|
|
7075
9399
|
defineRibbonSection,
|
|
7076
9400
|
defineGallery,
|
|
7077
9401
|
defineCommentsPane,
|
|
9402
|
+
defineChartFormatPane,
|
|
7078
9403
|
defineSymbolPicker,
|
|
7079
9404
|
defineColorGrid,
|
|
7080
9405
|
defineColorCustom,
|
|
7081
9406
|
defineChartPicker,
|
|
9407
|
+
defineChartDataSheet,
|
|
7082
9408
|
defineProgressDialog
|
|
7083
9409
|
];
|
|
7084
9410
|
function registerControls(registry) {
|
|
7085
9411
|
for (const define of CONTROL_DEFINERS) define(registry);
|
|
7086
9412
|
}
|
|
7087
9413
|
|
|
7088
|
-
export { CONTROL_DEFINERS, DEFAULT_COMMENTS_LABELS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_COLOR_SWATCHES, OFFICE_COLOR_SWATCH_HEXES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_SYMBOLS, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, assignKeyTips, attachKeyTips, attachRibbonGroupOverflow, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, commentInitials, createRibbonOverflow, defineAccount, defineBackstage, defineButton, defineChartPicker, defineCheckbox, defineColorCustom, defineColorGrid, defineCommandSearch, defineCommentsPane, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineGallery, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineProgressDialog, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonActions, defineRibbonGroup, defineRibbonSection, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineSymbolPicker, defineTabStrip, defineTaskPane, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, fitRibbonGroups, formatCommentTime, glyph, nextEnabledIndex, optionText, optionsLabels, parseOfficeSymbolCode,
|
|
9414
|
+
export { CONTROL_DEFINERS, DEFAULT_COMMENTS_LABELS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_COLOR_SWATCHES, OFFICE_COLOR_SWATCH_HEXES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_SYMBOLS, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, OfficeUiChartFormatPane, assignKeyTips, attachKeyTips, attachRibbonGroupOverflow, buildChartFormatModel, chartFormatFieldIntent, chartFormatLocale, chartFormatPaneTitle, chartFormatSourceTabs, chartFormatTargetLabel, chartFormatTargetOptions, chartFormatTranslator, chartSpaceFormatSource, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, commentInitials, createRibbonOverflow, defaultPaneGradient, defineAccount, defineBackstage, defineButton, defineChartDataSheet, defineChartFormatPane, defineChartPicker, defineCheckbox, defineColorCustom, defineColorGrid, defineCommandSearch, defineCommentsPane, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineGallery, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineProgressDialog, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonActions, defineRibbonGroup, defineRibbonSection, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineSymbolPicker, defineTabStrip, defineTaskPane, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, drawingColorFromHex, drawingGradientFrom, fitRibbonGroups, formatCommentTime, glyph, hexForInput, nextEnabledIndex, optionText, optionsLabels, parseOfficeSymbolCode, personalizeSection, profileInitials, rangeControl, range_control_default, readOfficeProfile, registerControls, resolveChartFormatSourceTarget, rulerDivisions, runKeyTips, sanitizeOfficeProfile, translateChartFormatText, typeAheadIndex, unavailableCategory, unavailableControl, userInterfaceSection, writeOfficeProfile };
|