@cj-tech-master/excelts 9.4.2 → 9.5.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/dist/browser/index.browser.d.ts +8 -5
- package/dist/browser/index.browser.js +19 -1
- package/dist/browser/index.d.ts +4 -2
- package/dist/browser/index.js +9 -1
- package/dist/browser/modules/excel/chart/cache-populator.d.ts +49 -0
- package/dist/browser/modules/excel/chart/cache-populator.js +1171 -0
- package/dist/browser/modules/excel/chart/chart-api.d.ts +92 -0
- package/dist/browser/modules/excel/chart/chart-api.js +364 -0
- package/dist/browser/modules/excel/chart/chart-builder.d.ts +48 -0
- package/dist/browser/modules/excel/chart/chart-builder.js +2432 -0
- package/dist/browser/modules/excel/chart/chart-ex-builder.d.ts +36 -0
- package/dist/browser/modules/excel/chart/chart-ex-builder.js +903 -0
- package/dist/browser/modules/excel/chart/chart-ex-parser.d.ts +8 -0
- package/dist/browser/modules/excel/chart/chart-ex-parser.js +1205 -0
- package/dist/browser/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
- package/dist/browser/modules/excel/chart/chart-ex-renderer.js +5352 -0
- package/dist/browser/modules/excel/chart/chart-ex-types.d.ts +531 -0
- package/dist/browser/modules/excel/chart/chart-ex-types.js +11 -0
- package/dist/browser/modules/excel/chart/chart-images.d.ts +78 -0
- package/dist/browser/modules/excel/chart/chart-images.js +363 -0
- package/dist/browser/modules/excel/chart/chart-presets.d.ts +392 -0
- package/dist/browser/modules/excel/chart/chart-presets.js +179 -0
- package/dist/browser/modules/excel/chart/chart-renderer.d.ts +550 -0
- package/dist/browser/modules/excel/chart/chart-renderer.js +6440 -0
- package/dist/browser/modules/excel/chart/chart-sidecar.d.ts +21 -0
- package/dist/browser/modules/excel/chart/chart-sidecar.js +427 -0
- package/dist/browser/modules/excel/chart/chart-utils.d.ts +306 -0
- package/dist/browser/modules/excel/chart/chart-utils.js +821 -0
- package/dist/browser/modules/excel/chart/chart.d.ts +504 -0
- package/dist/browser/modules/excel/chart/chart.js +1320 -0
- package/dist/browser/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
- package/dist/browser/modules/excel/chart/glyph-rasterizer.js +658 -0
- package/dist/browser/modules/excel/chart/index.d.ts +54 -0
- package/dist/browser/modules/excel/chart/index.js +46 -0
- package/dist/browser/modules/excel/chart/install.d.ts +44 -0
- package/dist/browser/modules/excel/chart/install.js +91 -0
- package/dist/browser/modules/excel/chart/shape-properties.d.ts +156 -0
- package/dist/browser/modules/excel/chart/shape-properties.js +1557 -0
- package/dist/browser/modules/excel/chart/stroke-font.d.ts +36 -0
- package/dist/browser/modules/excel/chart/stroke-font.js +1556 -0
- package/dist/browser/modules/excel/chart/topojson.d.ts +98 -0
- package/dist/browser/modules/excel/chart/topojson.js +236 -0
- package/dist/browser/modules/excel/chart/types.d.ts +2559 -0
- package/dist/browser/modules/excel/chart/types.js +8 -0
- package/dist/browser/modules/excel/chart-host-registry.d.ts +157 -0
- package/dist/browser/modules/excel/chart-host-registry.js +90 -0
- package/dist/browser/modules/excel/chartsheet.d.ts +102 -0
- package/dist/browser/modules/excel/chartsheet.js +196 -0
- package/dist/browser/modules/excel/defined-names.d.ts +35 -0
- package/dist/browser/modules/excel/defined-names.js +44 -4
- package/dist/browser/modules/excel/errors.d.ts +6 -0
- package/dist/browser/modules/excel/errors.js +9 -0
- package/dist/browser/modules/excel/form-control.d.ts +6 -0
- package/dist/browser/modules/excel/form-control.js +17 -0
- package/dist/browser/modules/excel/image.js +12 -2
- package/dist/browser/modules/excel/pivot-chart.d.ts +7 -0
- package/dist/browser/modules/excel/pivot-chart.js +53 -0
- package/dist/browser/modules/excel/pivot-table.d.ts +55 -0
- package/dist/browser/modules/excel/pivot-table.js +35 -0
- package/dist/browser/modules/excel/range.js +5 -1
- package/dist/browser/modules/excel/sparkline/index.d.ts +7 -0
- package/dist/browser/modules/excel/sparkline/index.js +7 -0
- package/dist/browser/modules/excel/sparkline/sparkline.d.ts +206 -0
- package/dist/browser/modules/excel/sparkline/sparkline.js +750 -0
- package/dist/browser/modules/excel/stream/worksheet-writer.js +3 -2
- package/dist/browser/modules/excel/table.js +42 -6
- package/dist/browser/modules/excel/types.d.ts +72 -0
- package/dist/browser/modules/excel/utils/address.d.ts +18 -0
- package/dist/browser/modules/excel/utils/address.js +28 -0
- package/dist/browser/modules/excel/utils/drawing-utils.js +11 -6
- package/dist/browser/modules/excel/utils/guid.d.ts +15 -0
- package/dist/browser/modules/excel/utils/guid.js +35 -0
- package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +74 -0
- package/dist/browser/modules/excel/utils/ooxml-paths.js +206 -9
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-table.js +177 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/context.js +191 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/index.js +102 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/reporter.js +61 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/types.js +12 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
- package/dist/browser/modules/excel/workbook.browser.d.ts +248 -30
- package/dist/browser/modules/excel/workbook.browser.js +966 -31
- package/dist/browser/modules/excel/workbook.d.ts +43 -0
- package/dist/browser/modules/excel/workbook.js +48 -0
- package/dist/browser/modules/excel/worksheet.d.ts +157 -3
- package/dist/browser/modules/excel/worksheet.js +394 -35
- package/dist/browser/modules/excel/xlsx/rel-type.d.ts +40 -0
- package/dist/browser/modules/excel/xlsx/rel-type.js +41 -1
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
- package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
- package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
- package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
- package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
- package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
- package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
- package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
- package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
- package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
- package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
- package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
- package/dist/browser/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
- package/dist/browser/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
- package/dist/browser/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
- package/dist/browser/modules/excel/xlsx/xform/xsd-values.js +101 -0
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +4422 -78
- package/dist/browser/modules/pdf/builder/document-builder.d.ts +74 -0
- package/dist/browser/modules/pdf/builder/document-builder.js +507 -2
- package/dist/browser/modules/pdf/builder/pdf-editor.js +48 -3
- package/dist/browser/modules/pdf/excel-bridge.d.ts +69 -0
- package/dist/browser/modules/pdf/excel-bridge.js +683 -12
- package/dist/browser/modules/pdf/font/font-manager.d.ts +25 -0
- package/dist/browser/modules/pdf/font/font-manager.js +39 -0
- package/dist/browser/modules/pdf/index.d.ts +5 -2
- package/dist/browser/modules/pdf/index.js +3 -1
- package/dist/browser/modules/pdf/render/chart-surface.d.ts +33 -0
- package/dist/browser/modules/pdf/render/chart-surface.js +200 -0
- package/dist/browser/modules/pdf/render/layout-engine.d.ts +22 -1
- package/dist/browser/modules/pdf/render/layout-engine.js +436 -56
- package/dist/browser/modules/pdf/render/page-renderer.js +169 -28
- package/dist/browser/modules/pdf/render/pdf-exporter.js +117 -7
- package/dist/browser/modules/pdf/types.d.ts +227 -23
- package/dist/browser/modules/pdf/types.js +4 -0
- package/dist/browser/modules/pdf/word-bridge.d.ts +47 -0
- package/dist/browser/modules/pdf/word-bridge.js +304 -0
- package/dist/browser/modules/word/constants.d.ts +179 -0
- package/dist/browser/modules/word/constants.js +231 -0
- package/dist/browser/modules/word/content-types.d.ts +27 -0
- package/dist/browser/modules/word/content-types.js +53 -0
- package/dist/browser/modules/word/digital-signatures.d.ts +87 -0
- package/dist/browser/modules/word/digital-signatures.js +134 -0
- package/dist/browser/modules/word/document.d.ts +728 -0
- package/dist/browser/modules/word/document.js +1795 -0
- package/dist/browser/modules/word/docx-packager.d.ts +14 -0
- package/dist/browser/modules/word/docx-packager.js +822 -0
- package/dist/browser/modules/word/docx-reader.d.ts +11 -0
- package/dist/browser/modules/word/docx-reader.js +4929 -0
- package/dist/browser/modules/word/encryption.d.ts +102 -0
- package/dist/browser/modules/word/encryption.js +274 -0
- package/dist/browser/modules/word/errors.d.ts +49 -0
- package/dist/browser/modules/word/errors.js +68 -0
- package/dist/browser/modules/word/font-obfuscation.d.ts +31 -0
- package/dist/browser/modules/word/font-obfuscation.js +83 -0
- package/dist/browser/modules/word/html-renderer.d.ts +38 -0
- package/dist/browser/modules/word/html-renderer.js +782 -0
- package/dist/browser/modules/word/index.base.d.ts +19 -0
- package/dist/browser/modules/word/index.base.js +51 -0
- package/dist/browser/modules/word/index.browser.d.ts +4 -0
- package/dist/browser/modules/word/index.browser.js +4 -0
- package/dist/browser/modules/word/index.d.ts +4 -0
- package/dist/browser/modules/word/index.js +4 -0
- package/dist/browser/modules/word/internal-utils.d.ts +23 -0
- package/dist/browser/modules/word/internal-utils.js +54 -0
- package/dist/browser/modules/word/relationships.d.ts +31 -0
- package/dist/browser/modules/word/relationships.js +56 -0
- package/dist/browser/modules/word/types.d.ts +2325 -0
- package/dist/browser/modules/word/types.js +10 -0
- package/dist/browser/modules/word/units.d.ts +49 -0
- package/dist/browser/modules/word/units.js +111 -0
- package/dist/browser/modules/word/writers/chart-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/chart-writer.js +385 -0
- package/dist/browser/modules/word/writers/checkbox-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/checkbox-writer.js +42 -0
- package/dist/browser/modules/word/writers/comment-writer.d.ts +15 -0
- package/dist/browser/modules/word/writers/comment-writer.js +70 -0
- package/dist/browser/modules/word/writers/document-writer.d.ts +16 -0
- package/dist/browser/modules/word/writers/document-writer.js +461 -0
- package/dist/browser/modules/word/writers/footnote-writer.d.ts +11 -0
- package/dist/browser/modules/word/writers/footnote-writer.js +72 -0
- package/dist/browser/modules/word/writers/header-footer-writer.d.ts +13 -0
- package/dist/browser/modules/word/writers/header-footer-writer.js +129 -0
- package/dist/browser/modules/word/writers/image-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/image-writer.js +185 -0
- package/dist/browser/modules/word/writers/math-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/math-writer.js +428 -0
- package/dist/browser/modules/word/writers/numbering-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/numbering-writer.js +125 -0
- package/dist/browser/modules/word/writers/paragraph-writer.d.ts +13 -0
- package/dist/browser/modules/word/writers/paragraph-writer.js +516 -0
- package/dist/browser/modules/word/writers/parts-writer.d.ts +26 -0
- package/dist/browser/modules/word/writers/parts-writer.js +660 -0
- package/dist/browser/modules/word/writers/run-writer.d.ts +15 -0
- package/dist/browser/modules/word/writers/run-writer.js +649 -0
- package/dist/browser/modules/word/writers/section-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/section-writer.js +238 -0
- package/dist/browser/modules/word/writers/styles-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/styles-writer.js +242 -0
- package/dist/browser/modules/word/writers/table-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/table-writer.js +503 -0
- package/dist/browser/modules/word/writers/textbox-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/textbox-writer.js +53 -0
- package/dist/browser/modules/word/writers/toc-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/toc-writer.js +79 -0
- package/dist/browser/modules/xml/encode.d.ts +56 -7
- package/dist/browser/modules/xml/encode.js +157 -11
- package/dist/cjs/index.js +13 -2
- package/dist/cjs/modules/excel/chart/cache-populator.js +1178 -0
- package/dist/cjs/modules/excel/chart/chart-api.js +371 -0
- package/dist/cjs/modules/excel/chart/chart-builder.js +2440 -0
- package/dist/cjs/modules/excel/chart/chart-ex-builder.js +907 -0
- package/dist/cjs/modules/excel/chart/chart-ex-parser.js +1208 -0
- package/dist/cjs/modules/excel/chart/chart-ex-renderer.js +5364 -0
- package/dist/cjs/modules/excel/chart/chart-ex-types.js +12 -0
- package/dist/cjs/modules/excel/chart/chart-images.js +366 -0
- package/dist/cjs/modules/excel/chart/chart-presets.js +184 -0
- package/dist/cjs/modules/excel/chart/chart-renderer.js +6450 -0
- package/dist/cjs/modules/excel/chart/chart-sidecar.js +433 -0
- package/dist/cjs/modules/excel/chart/chart-utils.js +845 -0
- package/dist/cjs/modules/excel/chart/chart.js +1324 -0
- package/dist/cjs/modules/excel/chart/glyph-rasterizer.js +664 -0
- package/dist/cjs/modules/excel/chart/index.js +101 -0
- package/dist/cjs/modules/excel/chart/install.js +95 -0
- package/dist/cjs/modules/excel/chart/shape-properties.js +1577 -0
- package/dist/cjs/modules/excel/chart/stroke-font.js +1559 -0
- package/dist/cjs/modules/excel/chart/topojson.js +239 -0
- package/dist/cjs/modules/excel/chart/types.js +9 -0
- package/dist/cjs/modules/excel/chart-host-registry.js +96 -0
- package/dist/cjs/modules/excel/chartsheet.js +199 -0
- package/dist/cjs/modules/excel/defined-names.js +44 -4
- package/dist/cjs/modules/excel/errors.js +11 -1
- package/dist/cjs/modules/excel/form-control.js +17 -0
- package/dist/cjs/modules/excel/image.js +12 -2
- package/dist/cjs/modules/excel/pivot-chart.js +56 -0
- package/dist/cjs/modules/excel/pivot-table.js +35 -0
- package/dist/cjs/modules/excel/range.js +5 -1
- package/dist/cjs/modules/excel/sparkline/index.js +23 -0
- package/dist/cjs/modules/excel/sparkline/sparkline.js +756 -0
- package/dist/cjs/modules/excel/stream/worksheet-writer.js +3 -2
- package/dist/cjs/modules/excel/table.js +42 -6
- package/dist/cjs/modules/excel/utils/address.js +29 -0
- package/dist/cjs/modules/excel/utils/drawing-utils.js +11 -6
- package/dist/cjs/modules/excel/utils/guid.js +38 -0
- package/dist/cjs/modules/excel/utils/ooxml-paths.js +246 -9
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +103 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart.js +2128 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-chartsheet.js +29 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-content-types.js +184 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-drawing.js +270 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-pivot.js +107 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-relationships.js +188 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-structure.js +60 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-styles.js +92 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-table.js +180 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-workbook.js +166 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-worksheet.js +572 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/context.js +196 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/index.js +105 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/path-utils.js +168 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/reporter.js +66 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/types.js +13 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/xml-utils.js +110 -0
- package/dist/cjs/modules/excel/workbook.browser.js +973 -38
- package/dist/cjs/modules/excel/workbook.js +48 -0
- package/dist/cjs/modules/excel/worksheet.js +393 -34
- package/dist/cjs/modules/excel/xlsx/rel-type.js +41 -1
- package/dist/cjs/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
- package/dist/cjs/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
- package/dist/cjs/modules/excel/xlsx/xform/chart/chart-space-xform.js +6003 -0
- package/dist/cjs/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +219 -0
- package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +149 -10
- package/dist/cjs/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
- package/dist/cjs/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
- package/dist/cjs/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +228 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
- package/dist/cjs/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
- package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
- package/dist/cjs/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +444 -0
- package/dist/cjs/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
- package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +195 -19
- package/dist/cjs/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
- package/dist/cjs/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
- package/dist/cjs/modules/excel/xlsx/xform/xsd-values.js +106 -0
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +4420 -76
- package/dist/cjs/modules/pdf/builder/document-builder.js +506 -1
- package/dist/cjs/modules/pdf/builder/pdf-editor.js +48 -3
- package/dist/cjs/modules/pdf/excel-bridge.js +684 -12
- package/dist/cjs/modules/pdf/font/font-manager.js +39 -0
- package/dist/cjs/modules/pdf/index.js +5 -1
- package/dist/cjs/modules/pdf/render/chart-surface.js +203 -0
- package/dist/cjs/modules/pdf/render/layout-engine.js +437 -56
- package/dist/cjs/modules/pdf/render/page-renderer.js +169 -28
- package/dist/cjs/modules/pdf/render/pdf-exporter.js +115 -5
- package/dist/cjs/modules/pdf/types.js +5 -0
- package/dist/cjs/modules/pdf/word-bridge.js +307 -0
- package/dist/cjs/modules/word/constants.js +234 -0
- package/dist/cjs/modules/word/content-types.js +57 -0
- package/dist/cjs/modules/word/digital-signatures.js +140 -0
- package/dist/cjs/modules/word/document.js +1909 -0
- package/dist/cjs/modules/word/docx-packager.js +825 -0
- package/dist/cjs/modules/word/docx-reader.js +4932 -0
- package/dist/cjs/modules/word/encryption.js +282 -0
- package/dist/cjs/modules/word/errors.js +88 -0
- package/dist/cjs/modules/word/font-obfuscation.js +88 -0
- package/dist/cjs/modules/word/html-renderer.js +785 -0
- package/dist/cjs/modules/word/index.base.js +199 -0
- package/dist/cjs/modules/word/index.browser.js +20 -0
- package/dist/cjs/modules/word/index.js +20 -0
- package/dist/cjs/modules/word/internal-utils.js +59 -0
- package/dist/cjs/modules/word/relationships.js +60 -0
- package/dist/cjs/modules/word/types.js +11 -0
- package/dist/cjs/modules/word/units.js +135 -0
- package/dist/cjs/modules/word/writers/chart-writer.js +388 -0
- package/dist/cjs/modules/word/writers/checkbox-writer.js +45 -0
- package/dist/cjs/modules/word/writers/comment-writer.js +74 -0
- package/dist/cjs/modules/word/writers/document-writer.js +465 -0
- package/dist/cjs/modules/word/writers/footnote-writer.js +76 -0
- package/dist/cjs/modules/word/writers/header-footer-writer.js +134 -0
- package/dist/cjs/modules/word/writers/image-writer.js +188 -0
- package/dist/cjs/modules/word/writers/math-writer.js +431 -0
- package/dist/cjs/modules/word/writers/numbering-writer.js +128 -0
- package/dist/cjs/modules/word/writers/paragraph-writer.js +521 -0
- package/dist/cjs/modules/word/writers/parts-writer.js +671 -0
- package/dist/cjs/modules/word/writers/run-writer.js +655 -0
- package/dist/cjs/modules/word/writers/section-writer.js +241 -0
- package/dist/cjs/modules/word/writers/styles-writer.js +245 -0
- package/dist/cjs/modules/word/writers/table-writer.js +506 -0
- package/dist/cjs/modules/word/writers/textbox-writer.js +56 -0
- package/dist/cjs/modules/word/writers/toc-writer.js +82 -0
- package/dist/cjs/modules/xml/encode.js +158 -11
- package/dist/esm/index.browser.js +20 -2
- package/dist/esm/index.js +9 -1
- package/dist/esm/modules/excel/chart/cache-populator.js +1171 -0
- package/dist/esm/modules/excel/chart/chart-api.js +364 -0
- package/dist/esm/modules/excel/chart/chart-builder.js +2432 -0
- package/dist/esm/modules/excel/chart/chart-ex-builder.js +903 -0
- package/dist/esm/modules/excel/chart/chart-ex-parser.js +1205 -0
- package/dist/esm/modules/excel/chart/chart-ex-renderer.js +5352 -0
- package/dist/esm/modules/excel/chart/chart-ex-types.js +11 -0
- package/dist/esm/modules/excel/chart/chart-images.js +363 -0
- package/dist/esm/modules/excel/chart/chart-presets.js +179 -0
- package/dist/esm/modules/excel/chart/chart-renderer.js +6440 -0
- package/dist/esm/modules/excel/chart/chart-sidecar.js +427 -0
- package/dist/esm/modules/excel/chart/chart-utils.js +821 -0
- package/dist/esm/modules/excel/chart/chart.js +1320 -0
- package/dist/esm/modules/excel/chart/glyph-rasterizer.js +658 -0
- package/dist/esm/modules/excel/chart/index.js +46 -0
- package/dist/esm/modules/excel/chart/install.js +91 -0
- package/dist/esm/modules/excel/chart/shape-properties.js +1557 -0
- package/dist/esm/modules/excel/chart/stroke-font.js +1556 -0
- package/dist/esm/modules/excel/chart/topojson.js +236 -0
- package/dist/esm/modules/excel/chart/types.js +8 -0
- package/dist/esm/modules/excel/chart-host-registry.js +90 -0
- package/dist/esm/modules/excel/chartsheet.js +196 -0
- package/dist/esm/modules/excel/defined-names.js +44 -4
- package/dist/esm/modules/excel/errors.js +9 -0
- package/dist/esm/modules/excel/form-control.js +17 -0
- package/dist/esm/modules/excel/image.js +12 -2
- package/dist/esm/modules/excel/pivot-chart.js +53 -0
- package/dist/esm/modules/excel/pivot-table.js +35 -0
- package/dist/esm/modules/excel/range.js +5 -1
- package/dist/esm/modules/excel/sparkline/index.js +7 -0
- package/dist/esm/modules/excel/sparkline/sparkline.js +750 -0
- package/dist/esm/modules/excel/stream/worksheet-writer.js +3 -2
- package/dist/esm/modules/excel/table.js +42 -6
- package/dist/esm/modules/excel/utils/address.js +28 -0
- package/dist/esm/modules/excel/utils/drawing-utils.js +11 -6
- package/dist/esm/modules/excel/utils/guid.js +35 -0
- package/dist/esm/modules/excel/utils/ooxml-paths.js +206 -9
- package/dist/esm/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-table.js +177 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/context.js +191 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/index.js +102 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/reporter.js +61 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/types.js +12 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
- package/dist/esm/modules/excel/workbook.browser.js +969 -34
- package/dist/esm/modules/excel/workbook.js +48 -0
- package/dist/esm/modules/excel/worksheet.js +394 -35
- package/dist/esm/modules/excel/xlsx/rel-type.js +41 -1
- package/dist/esm/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
- package/dist/esm/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
- package/dist/esm/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
- package/dist/esm/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
- package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
- package/dist/esm/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
- package/dist/esm/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
- package/dist/esm/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
- package/dist/esm/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
- package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
- package/dist/esm/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
- package/dist/esm/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
- package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
- package/dist/esm/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
- package/dist/esm/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
- package/dist/esm/modules/excel/xlsx/xform/xsd-values.js +101 -0
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +4422 -78
- package/dist/esm/modules/pdf/builder/document-builder.js +507 -2
- package/dist/esm/modules/pdf/builder/pdf-editor.js +48 -3
- package/dist/esm/modules/pdf/excel-bridge.js +683 -12
- package/dist/esm/modules/pdf/font/font-manager.js +39 -0
- package/dist/esm/modules/pdf/index.js +3 -1
- package/dist/esm/modules/pdf/render/chart-surface.js +200 -0
- package/dist/esm/modules/pdf/render/layout-engine.js +436 -56
- package/dist/esm/modules/pdf/render/page-renderer.js +169 -28
- package/dist/esm/modules/pdf/render/pdf-exporter.js +117 -7
- package/dist/esm/modules/pdf/types.js +4 -0
- package/dist/esm/modules/pdf/word-bridge.js +304 -0
- package/dist/esm/modules/word/constants.js +231 -0
- package/dist/esm/modules/word/content-types.js +53 -0
- package/dist/esm/modules/word/digital-signatures.js +134 -0
- package/dist/esm/modules/word/document.js +1795 -0
- package/dist/esm/modules/word/docx-packager.js +822 -0
- package/dist/esm/modules/word/docx-reader.js +4929 -0
- package/dist/esm/modules/word/encryption.js +274 -0
- package/dist/esm/modules/word/errors.js +68 -0
- package/dist/esm/modules/word/font-obfuscation.js +83 -0
- package/dist/esm/modules/word/html-renderer.js +782 -0
- package/dist/esm/modules/word/index.base.js +51 -0
- package/dist/esm/modules/word/index.browser.js +4 -0
- package/dist/esm/modules/word/index.js +4 -0
- package/dist/esm/modules/word/internal-utils.js +54 -0
- package/dist/esm/modules/word/relationships.js +56 -0
- package/dist/esm/modules/word/types.js +10 -0
- package/dist/esm/modules/word/units.js +111 -0
- package/dist/esm/modules/word/writers/chart-writer.js +385 -0
- package/dist/esm/modules/word/writers/checkbox-writer.js +42 -0
- package/dist/esm/modules/word/writers/comment-writer.js +70 -0
- package/dist/esm/modules/word/writers/document-writer.js +461 -0
- package/dist/esm/modules/word/writers/footnote-writer.js +72 -0
- package/dist/esm/modules/word/writers/header-footer-writer.js +129 -0
- package/dist/esm/modules/word/writers/image-writer.js +185 -0
- package/dist/esm/modules/word/writers/math-writer.js +428 -0
- package/dist/esm/modules/word/writers/numbering-writer.js +125 -0
- package/dist/esm/modules/word/writers/paragraph-writer.js +516 -0
- package/dist/esm/modules/word/writers/parts-writer.js +660 -0
- package/dist/esm/modules/word/writers/run-writer.js +649 -0
- package/dist/esm/modules/word/writers/section-writer.js +238 -0
- package/dist/esm/modules/word/writers/styles-writer.js +242 -0
- package/dist/esm/modules/word/writers/table-writer.js +503 -0
- package/dist/esm/modules/word/writers/textbox-writer.js +53 -0
- package/dist/esm/modules/word/writers/toc-writer.js +79 -0
- package/dist/esm/modules/xml/encode.js +157 -11
- package/dist/iife/excelts.iife.js +11789 -687
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +52 -44
- package/dist/types/index.browser.d.ts +8 -5
- package/dist/types/index.d.ts +4 -2
- package/dist/types/modules/excel/chart/cache-populator.d.ts +49 -0
- package/dist/types/modules/excel/chart/chart-api.d.ts +92 -0
- package/dist/types/modules/excel/chart/chart-builder.d.ts +48 -0
- package/dist/types/modules/excel/chart/chart-ex-builder.d.ts +36 -0
- package/dist/types/modules/excel/chart/chart-ex-parser.d.ts +8 -0
- package/dist/types/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
- package/dist/types/modules/excel/chart/chart-ex-types.d.ts +531 -0
- package/dist/types/modules/excel/chart/chart-images.d.ts +78 -0
- package/dist/types/modules/excel/chart/chart-presets.d.ts +392 -0
- package/dist/types/modules/excel/chart/chart-renderer.d.ts +550 -0
- package/dist/types/modules/excel/chart/chart-sidecar.d.ts +21 -0
- package/dist/types/modules/excel/chart/chart-utils.d.ts +306 -0
- package/dist/types/modules/excel/chart/chart.d.ts +504 -0
- package/dist/types/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
- package/dist/types/modules/excel/chart/index.d.ts +54 -0
- package/dist/types/modules/excel/chart/install.d.ts +44 -0
- package/dist/types/modules/excel/chart/shape-properties.d.ts +156 -0
- package/dist/types/modules/excel/chart/stroke-font.d.ts +36 -0
- package/dist/types/modules/excel/chart/topojson.d.ts +98 -0
- package/dist/types/modules/excel/chart/types.d.ts +2559 -0
- package/dist/types/modules/excel/chart-host-registry.d.ts +157 -0
- package/dist/types/modules/excel/chartsheet.d.ts +102 -0
- package/dist/types/modules/excel/defined-names.d.ts +35 -0
- package/dist/types/modules/excel/errors.d.ts +6 -0
- package/dist/types/modules/excel/form-control.d.ts +6 -0
- package/dist/types/modules/excel/pivot-chart.d.ts +7 -0
- package/dist/types/modules/excel/pivot-table.d.ts +55 -0
- package/dist/types/modules/excel/sparkline/index.d.ts +7 -0
- package/dist/types/modules/excel/sparkline/sparkline.d.ts +206 -0
- package/dist/types/modules/excel/types.d.ts +72 -0
- package/dist/types/modules/excel/utils/address.d.ts +18 -0
- package/dist/types/modules/excel/utils/guid.d.ts +15 -0
- package/dist/types/modules/excel/utils/ooxml-paths.d.ts +74 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
- package/dist/types/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
- package/dist/types/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
- package/dist/types/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
- package/dist/types/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
- package/dist/types/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
- package/dist/types/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
- package/dist/types/modules/excel/workbook.browser.d.ts +248 -30
- package/dist/types/modules/excel/workbook.d.ts +43 -0
- package/dist/types/modules/excel/worksheet.d.ts +157 -3
- package/dist/types/modules/excel/xlsx/rel-type.d.ts +40 -0
- package/dist/types/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
- package/dist/types/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
- package/dist/types/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
- package/dist/types/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
- package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
- package/dist/types/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
- package/dist/types/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
- package/dist/types/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
- package/dist/types/modules/pdf/builder/document-builder.d.ts +74 -0
- package/dist/types/modules/pdf/excel-bridge.d.ts +69 -0
- package/dist/types/modules/pdf/font/font-manager.d.ts +25 -0
- package/dist/types/modules/pdf/index.d.ts +5 -2
- package/dist/types/modules/pdf/render/chart-surface.d.ts +33 -0
- package/dist/types/modules/pdf/render/layout-engine.d.ts +22 -1
- package/dist/types/modules/pdf/types.d.ts +227 -23
- package/dist/types/modules/pdf/word-bridge.d.ts +47 -0
- package/dist/types/modules/word/constants.d.ts +179 -0
- package/dist/types/modules/word/content-types.d.ts +27 -0
- package/dist/types/modules/word/digital-signatures.d.ts +87 -0
- package/dist/types/modules/word/document.d.ts +728 -0
- package/dist/types/modules/word/docx-packager.d.ts +14 -0
- package/dist/types/modules/word/docx-reader.d.ts +11 -0
- package/dist/types/modules/word/encryption.d.ts +102 -0
- package/dist/types/modules/word/errors.d.ts +49 -0
- package/dist/types/modules/word/font-obfuscation.d.ts +31 -0
- package/dist/types/modules/word/html-renderer.d.ts +38 -0
- package/dist/types/modules/word/index.base.d.ts +19 -0
- package/dist/types/modules/word/index.browser.d.ts +4 -0
- package/dist/types/modules/word/index.d.ts +4 -0
- package/dist/types/modules/word/internal-utils.d.ts +23 -0
- package/dist/types/modules/word/relationships.d.ts +31 -0
- package/dist/types/modules/word/types.d.ts +2325 -0
- package/dist/types/modules/word/units.d.ts +49 -0
- package/dist/types/modules/word/writers/chart-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/checkbox-writer.d.ts +9 -0
- package/dist/types/modules/word/writers/comment-writer.d.ts +15 -0
- package/dist/types/modules/word/writers/document-writer.d.ts +16 -0
- package/dist/types/modules/word/writers/footnote-writer.d.ts +11 -0
- package/dist/types/modules/word/writers/header-footer-writer.d.ts +13 -0
- package/dist/types/modules/word/writers/image-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/math-writer.d.ts +9 -0
- package/dist/types/modules/word/writers/numbering-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/paragraph-writer.d.ts +13 -0
- package/dist/types/modules/word/writers/parts-writer.d.ts +26 -0
- package/dist/types/modules/word/writers/run-writer.d.ts +15 -0
- package/dist/types/modules/word/writers/section-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/styles-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/table-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/textbox-writer.d.ts +9 -0
- package/dist/types/modules/word/writers/toc-writer.d.ts +9 -0
- package/dist/types/modules/xml/encode.d.ts +56 -7
- package/package.json +29 -11
- package/dist/browser/modules/excel/utils/ooxml-validator.d.ts +0 -48
- package/dist/browser/modules/excel/utils/ooxml-validator.js +0 -493
- package/dist/browser/modules/excel/utils/passthrough-manager.d.ts +0 -77
- package/dist/browser/modules/excel/utils/passthrough-manager.js +0 -129
- package/dist/cjs/modules/excel/utils/ooxml-validator.js +0 -499
- package/dist/cjs/modules/excel/utils/passthrough-manager.js +0 -133
- package/dist/esm/modules/excel/utils/ooxml-validator.js +0 -493
- package/dist/esm/modules/excel/utils/passthrough-manager.js +0 -129
- package/dist/types/modules/excel/utils/ooxml-validator.d.ts +0 -48
- package/dist/types/modules/excel/utils/passthrough-manager.d.ts +0 -77
|
@@ -0,0 +1,903 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChartEx builder — constructs a ChartExModel from simplified AddChartExOptions.
|
|
3
|
+
*
|
|
4
|
+
* Each layoutId corresponds to a distinct chart type. The builder produces a
|
|
5
|
+
* structured model that the renderer serialises to `cx:chart` XML.
|
|
6
|
+
*/
|
|
7
|
+
import { ChartOptionsError } from "../errors.js";
|
|
8
|
+
import { hexToColor, toShapeProperties } from "./chart-builder.js";
|
|
9
|
+
function parseColumnRef(formula) {
|
|
10
|
+
// Match: optional sheet (quoted or bare) + !$COL$ROW:$COL$ROW
|
|
11
|
+
const match = /^\s*(?:'([^'\r\n]+)'|([A-Za-z_][A-Za-z0-9_. ]*))!\$([A-Z]{1,3})\$(\d+):\$([A-Z]{1,3})\$(\d+)\s*$/.exec(formula);
|
|
12
|
+
if (!match) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
// Groups: 1=quoted sheet, 2=bare sheet, 3=colStart, 4=rowStart,
|
|
16
|
+
// 5=colEnd, 6=rowEnd. The row/col pair alternates — the `:`
|
|
17
|
+
// delimiter is between the start address (cols + rows, i.e.
|
|
18
|
+
// `$COL$ROW`) and the end address.
|
|
19
|
+
return {
|
|
20
|
+
sheet: match[1] ?? match[2],
|
|
21
|
+
quotedSheet: !!match[1],
|
|
22
|
+
colStart: match[3],
|
|
23
|
+
colEnd: match[5],
|
|
24
|
+
rowStart: parseInt(match[4], 10),
|
|
25
|
+
rowEnd: parseInt(match[6], 10)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function colLettersToIndex(letters) {
|
|
29
|
+
let n = 0;
|
|
30
|
+
for (let i = 0; i < letters.length; i++) {
|
|
31
|
+
n = n * 26 + (letters.charCodeAt(i) - 64);
|
|
32
|
+
}
|
|
33
|
+
return n;
|
|
34
|
+
}
|
|
35
|
+
function colIndexToLetters(index) {
|
|
36
|
+
let n = index;
|
|
37
|
+
let out = "";
|
|
38
|
+
while (n > 0) {
|
|
39
|
+
const rem = (n - 1) % 26;
|
|
40
|
+
out = String.fromCharCode(65 + rem) + out;
|
|
41
|
+
n = Math.floor((n - 1) / 26);
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Combine multiple single-column range formulas (first item is the
|
|
47
|
+
* OUTERMOST hierarchy level, last item is the leaf level / primary
|
|
48
|
+
* category) into a single multi-column range that Excel's hierarchical
|
|
49
|
+
* chartEx loader accepts.
|
|
50
|
+
*
|
|
51
|
+
* Microsoft Excel's treemap / sunburst writer emits ONE `<cx:strDim>`
|
|
52
|
+
* whose `<cx:f>` points at a contiguous multi-column range spanning
|
|
53
|
+
* every hierarchy level (e.g. `Sheet1!$A$2:$C$8` for a Region / Country
|
|
54
|
+
* / City breakdown). The chart reader derives the hierarchy from the
|
|
55
|
+
* column ORDER within that range — the first column is the root and
|
|
56
|
+
* the last is the leaf. Emitting per-level `<cx:strDim>` siblings (one
|
|
57
|
+
* per formula) is schema-legal but makes Excel draw an empty plot
|
|
58
|
+
* area: verified against `reference-hierarchy.xlsx` (Excel-authored
|
|
59
|
+
* sample) where the same hierarchy renders correctly only when the
|
|
60
|
+
* columns live under a single `<cx:f>`.
|
|
61
|
+
*
|
|
62
|
+
* Returns the combined formula when every input formula lives on the
|
|
63
|
+
* same sheet with identical row spans and contiguous ascending columns
|
|
64
|
+
* (the common case when authors lay their hierarchy out in adjacent
|
|
65
|
+
* worksheet columns). Returns `null` otherwise — the caller should
|
|
66
|
+
* fall back to per-level caching because Excel has no way to express
|
|
67
|
+
* a non-contiguous hierarchy as a single range.
|
|
68
|
+
*/
|
|
69
|
+
export function combineHierarchyFormulas(formulas) {
|
|
70
|
+
if (formulas.length === 0) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
if (formulas.length === 1) {
|
|
74
|
+
return formulas[0];
|
|
75
|
+
}
|
|
76
|
+
const parsed = [];
|
|
77
|
+
for (const f of formulas) {
|
|
78
|
+
const p = parseColumnRef(f);
|
|
79
|
+
if (!p) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
// Only single-column ranges are combinable. Multi-column inputs
|
|
83
|
+
// can't be meaningfully merged with another column without
|
|
84
|
+
// overlap / ambiguity.
|
|
85
|
+
if (p.colStart !== p.colEnd) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
parsed.push(p);
|
|
89
|
+
}
|
|
90
|
+
const first = parsed[0];
|
|
91
|
+
let prevCol = colLettersToIndex(first.colStart);
|
|
92
|
+
for (let i = 1; i < parsed.length; i++) {
|
|
93
|
+
const p = parsed[i];
|
|
94
|
+
if (p.sheet !== first.sheet) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
if (p.rowStart !== first.rowStart || p.rowEnd !== first.rowEnd) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const curCol = colLettersToIndex(p.colStart);
|
|
101
|
+
if (curCol !== prevCol + 1) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
prevCol = curCol;
|
|
105
|
+
}
|
|
106
|
+
const startCol = first.colStart;
|
|
107
|
+
const endCol = colIndexToLetters(prevCol);
|
|
108
|
+
const sheetRef = first.quotedSheet ? `'${first.sheet}'` : first.sheet;
|
|
109
|
+
return `${sheetRef}!$${startCol}$${first.rowStart}:$${endCol}$${first.rowEnd}`;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Build a structured ChartExModel from high-level options.
|
|
113
|
+
*/
|
|
114
|
+
export function buildChartExModel(opts) {
|
|
115
|
+
validateChartExOptions(opts);
|
|
116
|
+
const layoutId = mapChartTypeToLayoutId(opts.type);
|
|
117
|
+
// Build data entries — one cx:data per reference the series need.
|
|
118
|
+
const data = [];
|
|
119
|
+
const dataIdCounter = { value: 0 };
|
|
120
|
+
// Categories share a single data entry for all series (like classic charts).
|
|
121
|
+
let catDataId;
|
|
122
|
+
if (opts.categories) {
|
|
123
|
+
catDataId = dataIdCounter.value++;
|
|
124
|
+
data.push({
|
|
125
|
+
id: catDataId,
|
|
126
|
+
strDim: {
|
|
127
|
+
type: "cat",
|
|
128
|
+
formula: opts.categories,
|
|
129
|
+
levels: [{ ptCount: 0, points: [] }]
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
// No chart-level `categories` formula — check whether the series
|
|
135
|
+
// bundle carries a `literalCategories` array we can hoist up and
|
|
136
|
+
// share. Classic charts and Excel-authored ChartEx both store
|
|
137
|
+
// categories as a single axis-wide entry; the previous code
|
|
138
|
+
// allocated a fresh cat `cx:data` entry inside each series' branch
|
|
139
|
+
// below, producing `N` parallel category dimensions for `N` series
|
|
140
|
+
// and breaking the "shared category axis" invariant Excel readers
|
|
141
|
+
// expect. Find the first series that carries a non-empty
|
|
142
|
+
// `literalCategories` and use it as the shared entry. Subsequent
|
|
143
|
+
// series that redefine `literalCategories` to a different shape
|
|
144
|
+
// throw — mixing-and-matching per-series category axes is not
|
|
145
|
+
// supported by Chart2014.
|
|
146
|
+
const firstLiteral = opts.series.find(so => so.literalCategories?.length)?.literalCategories;
|
|
147
|
+
if (firstLiteral && firstLiteral.length > 0) {
|
|
148
|
+
// Validate that every other series with `literalCategories`
|
|
149
|
+
// carries the same array (by deep equality). Divergence is a
|
|
150
|
+
// caller bug — the schema has no way to express per-series
|
|
151
|
+
// category axes in a ChartEx plot area region.
|
|
152
|
+
for (const so of opts.series) {
|
|
153
|
+
if (!so.literalCategories) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (!arraysEqual(so.literalCategories, firstLiteral)) {
|
|
157
|
+
throw new ChartOptionsError("AddChartExOptions.series[*].literalCategories must be the same across all series; " +
|
|
158
|
+
"ChartEx stores categories on a shared category axis (see `opts.categories` for the " +
|
|
159
|
+
"formula-based alternative).");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catDataId = dataIdCounter.value++;
|
|
163
|
+
data.push({
|
|
164
|
+
id: catDataId,
|
|
165
|
+
strDim: {
|
|
166
|
+
type: "cat",
|
|
167
|
+
levels: [
|
|
168
|
+
{
|
|
169
|
+
ptCount: firstLiteral.length,
|
|
170
|
+
points: firstLiteral.map((value, index) => ({ index, value }))
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Build series — each gets its own cx:data entries for values (and any
|
|
178
|
+
// extras like hierarchy levels).
|
|
179
|
+
const series = [];
|
|
180
|
+
for (let i = 0; i < opts.series.length; i++) {
|
|
181
|
+
const so = opts.series[i];
|
|
182
|
+
const built = buildSeriesAndData(so, i, layoutId, catDataId, data, dataIdCounter, opts);
|
|
183
|
+
series.push(built);
|
|
184
|
+
}
|
|
185
|
+
// Build axes — needed for histogram, pareto, waterfall, funnel, boxWhisker.
|
|
186
|
+
const axes = [];
|
|
187
|
+
if (needsAxes(opts.type)) {
|
|
188
|
+
// Match Microsoft Excel's convention: chartEx axes are numbered
|
|
189
|
+
// 0 and 1 (cat / val), not `100000000+` like classic charts.
|
|
190
|
+
// Excel writes axes this way for every chartEx it authors —
|
|
191
|
+
// using small sequential ids keeps our output byte-compatible
|
|
192
|
+
// with Excel 2016+ for a fresh chartEx. Classic charts still
|
|
193
|
+
// use the `100000000` seed to avoid collisions with loaded
|
|
194
|
+
// files that happened to allocate small ids; chartEx is a
|
|
195
|
+
// separate part and cannot collide with classic chart axes.
|
|
196
|
+
const catAxisId = 0;
|
|
197
|
+
const valAxisId = 1;
|
|
198
|
+
// Match Excel's default cat-axis `gapWidth` + `<cx:tickLabels/>`
|
|
199
|
+
// and val-axis `<cx:majorGridlines/>` + `<cx:tickLabels/>` so
|
|
200
|
+
// freshly-built chartEx charts look identical to what Excel
|
|
201
|
+
// itself emits for the same chart type. Excel uses
|
|
202
|
+
// `gapWidth="0"` for histogram + pareto (bars touching —
|
|
203
|
+
// histograms traditionally render with zero gap between bins)
|
|
204
|
+
// and `gapWidth="0.5"` for waterfall / boxWhisker / funnel
|
|
205
|
+
// (narrower categorical bars). Users who set `layout.gapWidth`
|
|
206
|
+
// override the default.
|
|
207
|
+
const defaultGapWidth = opts.type === "histogram" || opts.type === "pareto" ? 0 : 0.5;
|
|
208
|
+
axes.push({
|
|
209
|
+
axisId: catAxisId,
|
|
210
|
+
type: "cat",
|
|
211
|
+
catScaling: { gapWidth: defaultGapWidth },
|
|
212
|
+
tickLabels: {}
|
|
213
|
+
});
|
|
214
|
+
axes.push({
|
|
215
|
+
axisId: valAxisId,
|
|
216
|
+
type: "val",
|
|
217
|
+
majorGridlines: {},
|
|
218
|
+
tickLabels: {}
|
|
219
|
+
});
|
|
220
|
+
// Excel does NOT emit `<cx:axisId>` children on `<cx:series>` —
|
|
221
|
+
// it expects the axis binding to come from the axes in
|
|
222
|
+
// `cx:plotArea/cx:axis` directly. Leaving `s.axisId` unset
|
|
223
|
+
// matches Excel's output exactly. (The renderer still emits
|
|
224
|
+
// any `axisId` array populated by the parser for round-tripped
|
|
225
|
+
// files, so existing files that DO carry these references
|
|
226
|
+
// survive load → save without drift.)
|
|
227
|
+
}
|
|
228
|
+
const model = {
|
|
229
|
+
chartSpace: {
|
|
230
|
+
chartData: { data },
|
|
231
|
+
// Chart-frame styling lives on `CT_ChartSpace/spPr` per
|
|
232
|
+
// ECMA-376 / Chart2014 — `CT_Chart` itself has no `spPr` child.
|
|
233
|
+
// Route `opts.spPr` here so the writer's schema-compliant path
|
|
234
|
+
// receives it. (Users can still pass either the structured
|
|
235
|
+
// `ShapeProperties` form or the ergonomic hex-colour shorthand;
|
|
236
|
+
// `toShapeProperties` normalises both.)
|
|
237
|
+
spPr: toShapeProperties(opts.spPr),
|
|
238
|
+
chart: {
|
|
239
|
+
title: buildChartExTitle(opts.title),
|
|
240
|
+
// Leave `autoTitleDeleted` undefined when the caller did not
|
|
241
|
+
// supply a title. Setting it to `true` whenever `opts.title`
|
|
242
|
+
// is absent tells Excel "the author explicitly deleted the
|
|
243
|
+
// auto-title", suppressing the automatic chart title Excel
|
|
244
|
+
// normally shows for single-series charts. Pass
|
|
245
|
+
// `title: null` (or an empty rich-text wrapper) to request
|
|
246
|
+
// explicit suppression; omitting the option preserves Excel's
|
|
247
|
+
// default auto-title behaviour.
|
|
248
|
+
autoTitleDeleted: opts.title === null ? true : undefined,
|
|
249
|
+
plotArea: {
|
|
250
|
+
plotAreaRegion: {
|
|
251
|
+
series
|
|
252
|
+
},
|
|
253
|
+
axis: axes.length > 0 ? axes : undefined
|
|
254
|
+
},
|
|
255
|
+
// Legend: Excel omits the `<cx:legend>` element entirely for
|
|
256
|
+
// histogram charts (a histogram has a single unnamed series,
|
|
257
|
+
// nothing to legend — emitting an empty legend placeholder
|
|
258
|
+
// causes Excel 2016+ to render the chart as a blank frame).
|
|
259
|
+
// Respect `opts.showLegend === false` for other types.
|
|
260
|
+
// Match Excel's legend attribute defaults otherwise:
|
|
261
|
+
// `pos="t" align="ctr" overlay="0"` — Excel's own output
|
|
262
|
+
// for a newly-inserted waterfall / funnel / boxWhisker uses
|
|
263
|
+
// top-centre placement. Users who pass `opts.legendPosition`
|
|
264
|
+
// still override `pos`.
|
|
265
|
+
legend: opts.showLegend === false || opts.type === "histogram"
|
|
266
|
+
? undefined
|
|
267
|
+
: {
|
|
268
|
+
legendPos: opts.legendPosition ?? "t",
|
|
269
|
+
align: "ctr",
|
|
270
|
+
overlay: false
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
// ChartEx ALWAYS ships with a `chartStyle` + `chartColorStyle`
|
|
275
|
+
// sidecar, linked from `chartEx1.xml.rels`. Without them Excel
|
|
276
|
+
// 2016+ discards the chartEx part on load ("Removed Part:
|
|
277
|
+
// /xl/drawings/drawingN.xml (Drawing shape)"). When the caller
|
|
278
|
+
// hasn't supplied structured style / colors, we emit the
|
|
279
|
+
// id-only minimal form — `<cs:chartStyle id="395"/>` and
|
|
280
|
+
// `<cs:colorStyle meth="cycle" id="10"/>` — which Excel's
|
|
281
|
+
// default style table resolves to a sensible built-in palette.
|
|
282
|
+
// Style id 395 + colors id 10 are the defaults Excel itself
|
|
283
|
+
// uses for a freshly-inserted waterfall (verified against a
|
|
284
|
+
// reference xlsx authored by Excel 2021).
|
|
285
|
+
//
|
|
286
|
+
// Callers who want custom styling pass `opts.chartStyle` /
|
|
287
|
+
// `opts.chartColors`; those paths short-circuit this default.
|
|
288
|
+
style: opts.chartStyle ?? { id: 395 },
|
|
289
|
+
colors: opts.chartColors ?? { id: 10, method: "cycle" }
|
|
290
|
+
};
|
|
291
|
+
return model;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Normalise a ChartEx title option into the structured `ChartTitle` shape.
|
|
295
|
+
* Accepts the same three forms as the classic chart builder: a plain string,
|
|
296
|
+
* a rich-text description, or a `{ formula: "Sheet1!$A$1" }` reference. This
|
|
297
|
+
* keeps the classic / ChartEx APIs symmetric — previously ChartEx only
|
|
298
|
+
* supported strings and silently ignored formula / rich-text input.
|
|
299
|
+
*/
|
|
300
|
+
function buildChartExTitle(input) {
|
|
301
|
+
// `null` signals "explicitly suppress auto-title" — the caller has
|
|
302
|
+
// already promoted this to `autoTitleDeleted: true` at the call site,
|
|
303
|
+
// so we emit no title element.
|
|
304
|
+
if (input === undefined || input === null) {
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
if (typeof input === "string") {
|
|
308
|
+
return {
|
|
309
|
+
text: { paragraphs: [{ runs: [{ text: input }] }] },
|
|
310
|
+
overlay: false
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
if ("formula" in input && typeof input.formula === "string") {
|
|
314
|
+
return {
|
|
315
|
+
// `ChartTitle.strRef` is the classic `StringReference` shape
|
|
316
|
+
// (`{ formula, cache: { points: [] } }`) because ChartEx titles
|
|
317
|
+
// reuse the classic `ChartTitle` type. Distinct from the ChartEx
|
|
318
|
+
// series `tx.strRef` which uses `{ formula, cached? }`.
|
|
319
|
+
strRef: { formula: input.formula, cache: { points: [] } },
|
|
320
|
+
overlay: false
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
if ("paragraphs" in input) {
|
|
324
|
+
return {
|
|
325
|
+
text: input,
|
|
326
|
+
overlay: false
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
throw new ChartOptionsError("chartEx.title must be a string, a { formula: string } reference, or a ChartRichText object.");
|
|
330
|
+
}
|
|
331
|
+
function buildSeriesAndData(so, idx, layoutId, catDataId, data, counter, opts) {
|
|
332
|
+
// `idx` is the caller-facing 0-based series index within the chart.
|
|
333
|
+
// The OOXML Chart2014 schema routes series ordering through
|
|
334
|
+
// `<cx:dataId>` / `<cx:axisId>` references rather than a dedicated
|
|
335
|
+
// series-index attribute, so there is no field to populate on the
|
|
336
|
+
// model — the parser never reads it and both the renderer and the
|
|
337
|
+
// writer key everything off `layoutId` / `dataRefs`. Keeping `idx`
|
|
338
|
+
// as a documented parameter so the caller's intent is preserved in
|
|
339
|
+
// tracing output if a future schema extension ever needs it.
|
|
340
|
+
void idx;
|
|
341
|
+
const series = {
|
|
342
|
+
layoutId,
|
|
343
|
+
dataRefs: []
|
|
344
|
+
};
|
|
345
|
+
if (so.name !== undefined) {
|
|
346
|
+
// Dispatch on the `name` shape. Plain strings become literal
|
|
347
|
+
// captions; `{ formula }` routes through `tx.strRef` so the writer
|
|
348
|
+
// emits `<cx:f>` (worksheet reference); rich-text structures pass
|
|
349
|
+
// through unchanged. Matches `AddChartSeriesOptions.name` handling
|
|
350
|
+
// on the classic side — previously the chartEx builder only
|
|
351
|
+
// accepted plain strings and silently dropped the other forms.
|
|
352
|
+
if (typeof so.name === "string") {
|
|
353
|
+
series.tx = { value: so.name };
|
|
354
|
+
}
|
|
355
|
+
else if ("formula" in so.name) {
|
|
356
|
+
// Use the canonical object form `{ formula, cached? }` rather
|
|
357
|
+
// than the legacy bare-string variant. The writer at
|
|
358
|
+
// `chart-ex-renderer.ts:renderSeries` handles both, but
|
|
359
|
+
// storing the object uniformly keeps the typed model
|
|
360
|
+
// consistent across builder-produced and parser-produced
|
|
361
|
+
// series — downstream consumers can treat `tx.strRef` as
|
|
362
|
+
// always object-shaped after this round of builder work.
|
|
363
|
+
series.tx = { strRef: { formula: so.name.formula } };
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
series.tx = { rich: so.name };
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
// ------------------------------------------------------------------
|
|
370
|
+
// Data ref order for sunburst / treemap
|
|
371
|
+
//
|
|
372
|
+
// Excel-authored sunburst and treemap charts group ALL string
|
|
373
|
+
// dimensions (categories + hierarchy levels) before the numeric
|
|
374
|
+
// value dimension. The previous builder order was
|
|
375
|
+
// [category, value, hierarchy...]
|
|
376
|
+
// which opens in Excel but doesn't match the canonical layout —
|
|
377
|
+
// some readers (Excel's own chartEx parser that wraps the charts API)
|
|
378
|
+
// expect contiguous strDim refs before numDim.
|
|
379
|
+
//
|
|
380
|
+
// For non-hierarchical types (funnel, waterfall, histogram, pareto,
|
|
381
|
+
// boxWhisker, regionMap, clusteredColumn) the order category, value
|
|
382
|
+
// is already canonical, so the hierarchy branch below is a no-op.
|
|
383
|
+
// ------------------------------------------------------------------
|
|
384
|
+
const isHierarchical = layoutId === "sunburst" || layoutId === "treemap";
|
|
385
|
+
// Categories binding. `buildChartExModel` hoists any shared
|
|
386
|
+
// `literalCategories` into a single `catDataId` before calling us, so
|
|
387
|
+
// by the time we're here the only cases are:
|
|
388
|
+
// 1. `catDataId !== undefined` → the chart has a shared cat axis
|
|
389
|
+
// (either from `opts.categories` or hoisted literals); reuse it.
|
|
390
|
+
// 2. `catDataId === undefined` → no category axis; omit the ref.
|
|
391
|
+
// The previous fallback that allocated a fresh per-series `cx:data`
|
|
392
|
+
// entry from `so.literalCategories` has been removed — it produced
|
|
393
|
+
// N duplicated cat axes for N series, breaking the shared-axis
|
|
394
|
+
// invariant. Any literal-category hoisting / validation is done in
|
|
395
|
+
// `buildChartExModel`.
|
|
396
|
+
if (catDataId !== undefined) {
|
|
397
|
+
series.dataRefs.push({ dataId: catDataId });
|
|
398
|
+
}
|
|
399
|
+
// For sunburst / treemap, Excel expects a SINGLE `<cx:strDim>`
|
|
400
|
+
// whose `<cx:f>` points to a contiguous MULTI-COLUMN range that
|
|
401
|
+
// spans every hierarchy level (outer → inner, root column first,
|
|
402
|
+
// leaf column last). See `combineHierarchyFormulas` for the
|
|
403
|
+
// rationale + the reference fixture (`reference-hierarchy.xlsx`)
|
|
404
|
+
// where the same layout rendered blank under the previous
|
|
405
|
+
// "one data entry per level" approach. When the caller's
|
|
406
|
+
// `categories` + `hierarchy` live in adjacent worksheet columns
|
|
407
|
+
// with matching row ranges we rewrite `catDataId`'s strDim with
|
|
408
|
+
// the combined range and skip per-level data entries. When the
|
|
409
|
+
// ranges can't be combined (different sheets, non-contiguous
|
|
410
|
+
// columns, …) we leave the entries as-is and accept that Excel
|
|
411
|
+
// may draw the chart blank — manual reshaping by the author is
|
|
412
|
+
// the only way to recover.
|
|
413
|
+
let hierarchyCombined = false;
|
|
414
|
+
if (isHierarchical) {
|
|
415
|
+
const hierarchyFormulas = so.hierarchy;
|
|
416
|
+
if (hierarchyFormulas && catDataId !== undefined && opts.categories) {
|
|
417
|
+
// Root → leaf: `[...hierarchy, categories]` matches Excel's
|
|
418
|
+
// left-to-right column reading order.
|
|
419
|
+
const combined = combineHierarchyFormulas([...hierarchyFormulas, opts.categories]);
|
|
420
|
+
if (combined) {
|
|
421
|
+
hierarchyCombined = true;
|
|
422
|
+
const catEntry = data.find(d => d.id === catDataId);
|
|
423
|
+
if (catEntry?.strDim) {
|
|
424
|
+
catEntry.strDim.formula = combined;
|
|
425
|
+
// Clear any seeded empty-level placeholder: Excel's writer
|
|
426
|
+
// emits no `<cx:lvl>` cache for hierarchical charts and
|
|
427
|
+
// reads fresh from the referenced cells on open.
|
|
428
|
+
catEntry.strDim.levels = undefined;
|
|
429
|
+
// Suppress cache population for this dimension. A flat
|
|
430
|
+
// `<cx:lvl>` of width × height points across the multi-column
|
|
431
|
+
// range would confuse Excel's hierarchical renderer (the
|
|
432
|
+
// chart draws empty). See `hasChartExStringPoints`.
|
|
433
|
+
catEntry.strDim._skipCache = true;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
// Ranges aren't combinable — fall back to per-level data
|
|
438
|
+
// entries in OUTER→INNER order so at least the schema is
|
|
439
|
+
// valid. (Excel renders blank in this fallback; emit with a
|
|
440
|
+
// console warning in non-production so the author can
|
|
441
|
+
// diagnose why their hierarchical chart is empty.)
|
|
442
|
+
if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
|
|
443
|
+
console.warn("[excelts] Treemap/sunburst hierarchy + categories could not be combined into a " +
|
|
444
|
+
"contiguous multi-column range. Excel will render the chart as an empty plot area. " +
|
|
445
|
+
"Lay your leaf + hierarchy columns contiguously on the same sheet with matching rows.");
|
|
446
|
+
}
|
|
447
|
+
for (let i = hierarchyFormulas.length - 1; i >= 0; i--) {
|
|
448
|
+
const h = hierarchyFormulas[i];
|
|
449
|
+
const hId = counter.value++;
|
|
450
|
+
data.push({
|
|
451
|
+
id: hId,
|
|
452
|
+
strDim: {
|
|
453
|
+
type: "cat",
|
|
454
|
+
formula: h,
|
|
455
|
+
levels: [{ ptCount: 0, points: [] }]
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
series.dataRefs.push({ dataId: hId });
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (so.literalHierarchy) {
|
|
463
|
+
// Literal hierarchy (no worksheet cells to reference) — cache
|
|
464
|
+
// every level's values inside a single strDim's `levels` array
|
|
465
|
+
// so `consolidateDataForRender` can flatten them into one
|
|
466
|
+
// `<cx:strDim>` with multiple `<cx:lvl>` children at render
|
|
467
|
+
// time. This does not match Excel's own "single multi-column
|
|
468
|
+
// <cx:f>" output verbatim but is what the schema allows when
|
|
469
|
+
// there are no real cells to point at.
|
|
470
|
+
for (let i = so.literalHierarchy.length - 1; i >= 0; i--) {
|
|
471
|
+
const level = so.literalHierarchy[i];
|
|
472
|
+
const hId = counter.value++;
|
|
473
|
+
data.push({
|
|
474
|
+
id: hId,
|
|
475
|
+
strDim: {
|
|
476
|
+
type: "cat",
|
|
477
|
+
levels: [
|
|
478
|
+
{
|
|
479
|
+
ptCount: level.length,
|
|
480
|
+
points: level.map((value, index) => ({ index, value }))
|
|
481
|
+
}
|
|
482
|
+
]
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
series.dataRefs.push({ dataId: hId });
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
// Values — always create a fresh numDim entry.
|
|
490
|
+
const valId = counter.value++;
|
|
491
|
+
// Microsoft Excel uses `type="val"` for MOST chartEx numeric
|
|
492
|
+
// dimensions (histogram + pareto binning inputs, funnel values,
|
|
493
|
+
// box-whisker samples, waterfall deltas, regionMap values), but
|
|
494
|
+
// **sunburst and treemap use `type="size"`** — the hierarchy rings
|
|
495
|
+
// / tiles are sized by the numeric column, and Excel's loader
|
|
496
|
+
// keys the hierarchical layout engine off this attribute. Reference
|
|
497
|
+
// fixture `tmp/reference-hierarchy.xlsx` (Excel-authored) writes
|
|
498
|
+
// `<cx:numDim type="size">` on both its treemap and sunburst
|
|
499
|
+
// charts; the previous `type="val"` caused Excel to open the
|
|
500
|
+
// chart with an empty plot area (schema-valid but semantically
|
|
501
|
+
// wrong for the hierarchical renderer).
|
|
502
|
+
//
|
|
503
|
+
// Other layouts still use `"val"` — the alternative `"x"` is in
|
|
504
|
+
// `ST_NumDimType` but Excel 2016+ renders the chart as a blank
|
|
505
|
+
// frame when the dimension is labelled `"x"` (verified against
|
|
506
|
+
// an Excel 2021-authored histogram reference, `tmp/aaaaa.xlsx`).
|
|
507
|
+
const numDimType = isHierarchical ? "size" : "val";
|
|
508
|
+
data.push({
|
|
509
|
+
id: valId,
|
|
510
|
+
numDim: {
|
|
511
|
+
type: numDimType,
|
|
512
|
+
formula: so.values,
|
|
513
|
+
levels: so.literalValues?.length
|
|
514
|
+
? [
|
|
515
|
+
{
|
|
516
|
+
ptCount: so.literalValues.length,
|
|
517
|
+
points: so.literalValues.map((value, index) => ({ index, value }))
|
|
518
|
+
}
|
|
519
|
+
]
|
|
520
|
+
: [{ ptCount: 0, points: [] }],
|
|
521
|
+
// Hierarchical charts that successfully combined their leaf +
|
|
522
|
+
// hierarchy formulas into a single multi-column `<cx:f>` ship
|
|
523
|
+
// the numeric dimension without a `<cx:lvl>` cache — same
|
|
524
|
+
// rationale as the `_skipCache` marker on the category strDim
|
|
525
|
+
// above. A simple sunburst with no hierarchy, or a combine
|
|
526
|
+
// that failed (non-contiguous columns), still caches normally
|
|
527
|
+
// so the chart at least has something to paint from.
|
|
528
|
+
...(hierarchyCombined ? { _skipCache: true } : {})
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
series.dataRefs.push({ dataId: valId });
|
|
532
|
+
if (hierarchyCombined) {
|
|
533
|
+
// Skipping the cache populator means the placeholder level we seed
|
|
534
|
+
// above never gets replaced with real values. Clear it so the
|
|
535
|
+
// renderer emits just the `<cx:f>` reference, matching Excel's
|
|
536
|
+
// writer output for treemap + sunburst.
|
|
537
|
+
const valEntry = data.find(d => d.id === valId);
|
|
538
|
+
if (valEntry?.numDim && !so.literalValues?.length) {
|
|
539
|
+
valEntry.numDim.levels = undefined;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
// Waterfall subtotals. `subtotalPoints` is an alternative spelling
|
|
543
|
+
// accepted by the public API; we normalise both into the
|
|
544
|
+
// `layoutPr.subtotals` array expected by the renderer. Any additional
|
|
545
|
+
// fields present on `subtotalPoints[]` (beyond `idx`) are currently not
|
|
546
|
+
// preserved because the structured model only carries the index — we
|
|
547
|
+
// surface this limitation clearly rather than letting extra metadata
|
|
548
|
+
// disappear silently.
|
|
549
|
+
//
|
|
550
|
+
// When both `subtotals` and `subtotalPoints` are provided, merge
|
|
551
|
+
// them (deduped by `idx`) rather than silently dropping one.
|
|
552
|
+
// Previously `subtotalPoints` was ignored entirely when `subtotals`
|
|
553
|
+
// was set — users mixing the two forms lost state with no
|
|
554
|
+
// diagnostic.
|
|
555
|
+
const subtotalPoints = so.subtotalPoints;
|
|
556
|
+
const mergedSubtotals = (() => {
|
|
557
|
+
if (so.subtotals && subtotalPoints) {
|
|
558
|
+
const indexSet = new Set([...so.subtotals, ...subtotalPoints.map(p => p.idx)]);
|
|
559
|
+
return Array.from(indexSet).sort((a, b) => a - b);
|
|
560
|
+
}
|
|
561
|
+
return so.subtotals ?? subtotalPoints?.map(p => p.idx);
|
|
562
|
+
})();
|
|
563
|
+
if (layoutId === "waterfall") {
|
|
564
|
+
// Excel emits `<cx:layoutPr><cx:subtotals/></cx:layoutPr>` on
|
|
565
|
+
// EVERY waterfall series, even when the user has not marked any
|
|
566
|
+
// subtotal points. The empty `subtotals` element is treated as
|
|
567
|
+
// a "no subtotals but waterfall-aware" marker; without it Excel
|
|
568
|
+
// falls back to generic series rendering and, at load time,
|
|
569
|
+
// may reject the chartEx as malformed. Seed `layoutPr.subtotals`
|
|
570
|
+
// with an empty array here so the writer always emits the
|
|
571
|
+
// element — then merge in any explicit user-provided subtotal
|
|
572
|
+
// indices on top.
|
|
573
|
+
series.layoutPr = {
|
|
574
|
+
subtotals: mergedSubtotals ? mergedSubtotals.map(i => ({ idx: i })) : []
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
if (layoutId === "treemap" || layoutId === "sunburst") {
|
|
578
|
+
// Excel 2016+ will NOT render a sunburst / treemap that lacks a
|
|
579
|
+
// `<cx:layoutPr>` child — the frame is drawn but the plot area
|
|
580
|
+
// shows a completely blank canvas (the hierarchy arcs / tiles
|
|
581
|
+
// are computed but never painted). Verified against
|
|
582
|
+
// `tmp/ttttt.xlsx` (Excel-authored sunburst reference) — every
|
|
583
|
+
// Excel-authored hierarchical chartEx carries at least an empty
|
|
584
|
+
// `<cx:layoutPr/>`, and treemap charts additionally carry a
|
|
585
|
+
// `<cx:parentLabelLayout val="overlapping"/>` (the default) so
|
|
586
|
+
// the engine has something to reach for when deciding how to
|
|
587
|
+
// stack parent labels. Seed a minimal default here so freshly
|
|
588
|
+
// authored sunburst/treemap charts render on open; the caller's
|
|
589
|
+
// `layout.parentLabelLayout` (applied below via `opts.layout`
|
|
590
|
+
// merge) overrides the default when set.
|
|
591
|
+
series.layoutPr = {
|
|
592
|
+
...(series.layoutPr ?? {}),
|
|
593
|
+
...(layoutId === "treemap" ? { parentLabelLayout: "overlapping" } : {})
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
// Apply chart-level layout options to this series when appropriate.
|
|
597
|
+
// Note: `{ ...a, ...b }` does **not** skip `undefined` values on `b`,
|
|
598
|
+
// which means a user passing `opts.layout = { subtotals: undefined }`
|
|
599
|
+
// would wipe out an earlier `series.layoutPr.subtotals` set from
|
|
600
|
+
// `so.subtotals`. Use `mergeDefined` so only keys with defined values
|
|
601
|
+
// overwrite the base.
|
|
602
|
+
if (opts.layout) {
|
|
603
|
+
series.layoutPr = mergeDefined(series.layoutPr ?? {}, opts.layout);
|
|
604
|
+
}
|
|
605
|
+
if (opts.binning) {
|
|
606
|
+
// Merge user-supplied binning on top of anything the `opts.layout`
|
|
607
|
+
// branch above carried through (e.g. `layout.binning.intervalClosed`).
|
|
608
|
+
// The previous spread-replace (`{ ...existing, binning: opts.binning }`)
|
|
609
|
+
// discarded every field the user didn't re-specify, so
|
|
610
|
+
// `{ layout: { binning: { intervalClosed: "r" } }, binning: { binType: "manual" } }`
|
|
611
|
+
// silently dropped `intervalClosed`.
|
|
612
|
+
series.layoutPr = {
|
|
613
|
+
...(series.layoutPr ?? {}),
|
|
614
|
+
binning: mergeDefined(series.layoutPr?.binning ?? {}, opts.binning)
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
if ((opts.type === "histogram" || opts.type === "pareto") && !series.layoutPr?.binning) {
|
|
618
|
+
// Excel's default `<cx:binning>` for a freshly-inserted
|
|
619
|
+
// histogram carries `intervalClosed="r"` — meaning "right-
|
|
620
|
+
// closed bin boundaries" (bins are `[a, b]`, not `[a, b)`).
|
|
621
|
+
// Emitting the element without the attribute is spec-legal
|
|
622
|
+
// (ST_IntervalClosedSide has a schema default of `"r"`) but
|
|
623
|
+
// Excel 2016+ treats the absence as "auto-compute binning"
|
|
624
|
+
// AND sometimes renders the chart as a blank frame when the
|
|
625
|
+
// binning has no explicit side. Verified against
|
|
626
|
+
// `tmp/aaaaa.xlsx` (Excel-authored histogram reference).
|
|
627
|
+
series.layoutPr = {
|
|
628
|
+
...(series.layoutPr ?? {}),
|
|
629
|
+
binning: { binType: "auto", intervalClosed: "r" }
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
if (opts.type === "pareto") {
|
|
633
|
+
// Only default `paretoLine` to `true` when the caller hasn't
|
|
634
|
+
// explicitly set it. A user passing `layout: { paretoLine: false }`
|
|
635
|
+
// (valid per the validator) was previously overridden here,
|
|
636
|
+
// re-enabling the cumulative-percent line against explicit intent.
|
|
637
|
+
if (series.layoutPr?.paretoLine === undefined) {
|
|
638
|
+
series.layoutPr = {
|
|
639
|
+
...(series.layoutPr ?? {}),
|
|
640
|
+
paretoLine: true
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
// Shape properties. `spPr` takes precedence over the `fill` / `border`
|
|
645
|
+
// hex shortcuts. Both inputs accept either a structured `ShapeProperties`
|
|
646
|
+
// or an `AddShapeFillOptions` bundle (normalised by `toShapeProperties`).
|
|
647
|
+
const normalisedSpPr = toShapeProperties(so.spPr);
|
|
648
|
+
if (normalisedSpPr) {
|
|
649
|
+
series.spPr = normalisedSpPr;
|
|
650
|
+
}
|
|
651
|
+
else if (so.fill || so.border) {
|
|
652
|
+
series.spPr = {};
|
|
653
|
+
if (so.fill) {
|
|
654
|
+
series.spPr.fill = { solid: hexToColor(so.fill) };
|
|
655
|
+
}
|
|
656
|
+
if (so.border) {
|
|
657
|
+
// Default to 9525 EMU (0.75pt) — Excel's default line width
|
|
658
|
+
// for chart series borders. Without an explicit `w`, DrawingML
|
|
659
|
+
// readers treat `<a:ln>` as hairline (effectively invisible
|
|
660
|
+
// on screen, sometimes 1px on print). Users setting `border:
|
|
661
|
+
// "#FF0000"` expect a visible red border, not a transparent
|
|
662
|
+
// colour on an invisible line.
|
|
663
|
+
series.spPr.line = {
|
|
664
|
+
color: hexToColor(so.border),
|
|
665
|
+
width: 9525
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
// Data labels
|
|
670
|
+
if (so.dataLabels) {
|
|
671
|
+
const dl = so.dataLabels;
|
|
672
|
+
series.dataLabels = {
|
|
673
|
+
visibility: {
|
|
674
|
+
value: dl.showValue,
|
|
675
|
+
categoryName: dl.showCategory,
|
|
676
|
+
seriesName: dl.showSeriesName,
|
|
677
|
+
// Map the public `showNumFmt` flag onto the internal
|
|
678
|
+
// visibility slot so readers can distinguish "render the
|
|
679
|
+
// number with its format" from "no numeric display at all".
|
|
680
|
+
// Previously the field had no way to be set from the public
|
|
681
|
+
// builder — the internal model exposed it, but the public
|
|
682
|
+
// options dropped it silently.
|
|
683
|
+
numFmt: dl.showNumFmt
|
|
684
|
+
},
|
|
685
|
+
position: dl.position,
|
|
686
|
+
separator: dl.separator,
|
|
687
|
+
numFmt: dl.numFmt,
|
|
688
|
+
// `spPr` / `txPr` route through to the rendered `<cx:spPr>` /
|
|
689
|
+
// `<cx:txPr>` children. Accept both the structured
|
|
690
|
+
// `ShapeProperties` and the ergonomic `AddShapeFillOptions`
|
|
691
|
+
// bundle via `toShapeProperties`, matching the classic
|
|
692
|
+
// `buildDataLabelsFromOpts` helper.
|
|
693
|
+
spPr: toShapeProperties(dl.spPr),
|
|
694
|
+
txPr: dl.txPr
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
// Default dataLabels for chartEx types where Excel always emits
|
|
698
|
+
// them. Match Excel's exact defaults so our output is byte-close
|
|
699
|
+
// to what a freshly-inserted chart looks like:
|
|
700
|
+
//
|
|
701
|
+
// <cx:dataLabels pos="outEnd">
|
|
702
|
+
// <cx:visibility seriesName="0" categoryName="0" value="1"/>
|
|
703
|
+
// </cx:dataLabels>
|
|
704
|
+
//
|
|
705
|
+
// Only applied when the caller did NOT supply `so.dataLabels` —
|
|
706
|
+
// user-driven customisation is preserved. The branches cover
|
|
707
|
+
// every 2014+ layout for which Excel emits a default block;
|
|
708
|
+
// sunburst / treemap typically show only the category name, so
|
|
709
|
+
// their defaults differ. (Pareto is handled on the pareto line
|
|
710
|
+
// series via a separate pass.)
|
|
711
|
+
if (!series.dataLabels) {
|
|
712
|
+
if (layoutId === "waterfall" || layoutId === "funnel") {
|
|
713
|
+
series.dataLabels = {
|
|
714
|
+
position: "outEnd",
|
|
715
|
+
visibility: { seriesName: false, categoryName: false, value: true }
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
else if (layoutId === "sunburst" || layoutId === "treemap") {
|
|
719
|
+
series.dataLabels = {
|
|
720
|
+
visibility: { seriesName: false, categoryName: true, value: false }
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return series;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Merge `patch` onto `base`, ignoring keys on `patch` whose value is
|
|
728
|
+
* `undefined`. JavaScript's native object spread (`{ ...a, ...b }`) does
|
|
729
|
+
* NOT skip `undefined` values on `b`, so `{ x: 1, ...{ x: undefined } }`
|
|
730
|
+
* produces `{ x: undefined }` — unintuitive and a frequent source of
|
|
731
|
+
* layering bugs. Use this helper whenever merging option objects where
|
|
732
|
+
* "undefined means don't change" is the expected semantics.
|
|
733
|
+
*/
|
|
734
|
+
function mergeDefined(base, patch) {
|
|
735
|
+
const result = { ...base };
|
|
736
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
737
|
+
if (value !== undefined) {
|
|
738
|
+
result[key] = value;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return result;
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Shallow element-wise string array equality. Used to verify that
|
|
745
|
+
* `literalCategories` arrays declared on multiple series in the same
|
|
746
|
+
* ChartEx bundle are identical, so the builder can safely hoist them
|
|
747
|
+
* into a single shared category `cx:data` entry.
|
|
748
|
+
*/
|
|
749
|
+
function arraysEqual(a, b) {
|
|
750
|
+
if (a === b) {
|
|
751
|
+
return true;
|
|
752
|
+
}
|
|
753
|
+
if (a.length !== b.length) {
|
|
754
|
+
return false;
|
|
755
|
+
}
|
|
756
|
+
for (let i = 0; i < a.length; i++) {
|
|
757
|
+
if (a[i] !== b[i]) {
|
|
758
|
+
return false;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
return true;
|
|
762
|
+
}
|
|
763
|
+
function validateChartExOptions(opts) {
|
|
764
|
+
if (!opts || typeof opts !== "object") {
|
|
765
|
+
throw new ChartOptionsError("chartEx options are required.");
|
|
766
|
+
}
|
|
767
|
+
if (!opts.type) {
|
|
768
|
+
throw new ChartOptionsError("chartEx.type is required.");
|
|
769
|
+
}
|
|
770
|
+
if (!Array.isArray(opts.series) || opts.series.length === 0) {
|
|
771
|
+
throw new ChartOptionsError("chartEx.series must contain at least one series.");
|
|
772
|
+
}
|
|
773
|
+
if (opts.binning && opts.type !== "histogram" && opts.type !== "pareto") {
|
|
774
|
+
throw new ChartOptionsError(`chartEx.binning is only valid for histogram and pareto charts, not ${opts.type}.`);
|
|
775
|
+
}
|
|
776
|
+
validateLayoutOptions(opts);
|
|
777
|
+
const binning = opts.binning ?? opts.layout?.binning;
|
|
778
|
+
if (binning) {
|
|
779
|
+
validateBinning(binning);
|
|
780
|
+
}
|
|
781
|
+
opts.series.forEach((series, i) => {
|
|
782
|
+
if (!series.values) {
|
|
783
|
+
throw new ChartOptionsError(`chartEx.series[${i}].values is required.`);
|
|
784
|
+
}
|
|
785
|
+
if (series.literalValues?.some(value => !Number.isFinite(value))) {
|
|
786
|
+
throw new ChartOptionsError(`chartEx.series[${i}].literalValues must contain only finite numbers.`);
|
|
787
|
+
}
|
|
788
|
+
if (series.literalCategories &&
|
|
789
|
+
series.literalValues &&
|
|
790
|
+
series.literalCategories.length !== series.literalValues.length) {
|
|
791
|
+
throw new ChartOptionsError(`chartEx.series[${i}].literalCategories length must match literalValues length.`);
|
|
792
|
+
}
|
|
793
|
+
if (series.hierarchy && opts.type !== "sunburst" && opts.type !== "treemap") {
|
|
794
|
+
throw new ChartOptionsError(`chartEx.series[${i}].hierarchy is only valid for sunburst and treemap charts.`);
|
|
795
|
+
}
|
|
796
|
+
if (series.literalHierarchy && opts.type !== "sunburst" && opts.type !== "treemap") {
|
|
797
|
+
throw new ChartOptionsError(`chartEx.series[${i}].literalHierarchy is only valid for sunburst and treemap charts.`);
|
|
798
|
+
}
|
|
799
|
+
if (series.literalHierarchy && series.literalValues) {
|
|
800
|
+
for (let level = 0; level < series.literalHierarchy.length; level++) {
|
|
801
|
+
if (series.literalHierarchy[level].length !== series.literalValues.length) {
|
|
802
|
+
throw new ChartOptionsError(`chartEx.series[${i}].literalHierarchy[${level}] length must match literalValues length.`);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
if ((series.subtotals || series.subtotalPoints) && opts.type !== "waterfall") {
|
|
807
|
+
throw new ChartOptionsError(`chartEx.series[${i}].subtotals is only valid for waterfall charts.`);
|
|
808
|
+
}
|
|
809
|
+
if (series.subtotals?.some(idx => !Number.isInteger(idx) || idx < 0)) {
|
|
810
|
+
throw new ChartOptionsError(`chartEx.series[${i}].subtotals must contain non-negative integer indices.`);
|
|
811
|
+
}
|
|
812
|
+
if (series.subtotalPoints?.some(point => !Number.isInteger(point.idx) || point.idx < 0)) {
|
|
813
|
+
throw new ChartOptionsError(`chartEx.series[${i}].subtotalPoints must contain non-negative integer indices.`);
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
function validateLayoutOptions(opts) {
|
|
818
|
+
const layout = opts.layout;
|
|
819
|
+
if (!layout) {
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
if (layout.binning && opts.type !== "histogram" && opts.type !== "pareto") {
|
|
823
|
+
throw new ChartOptionsError(`chartEx.layout.binning is only valid for histogram and pareto charts.`);
|
|
824
|
+
}
|
|
825
|
+
if (layout.subtotals && opts.type !== "waterfall") {
|
|
826
|
+
throw new ChartOptionsError(`chartEx.layout.subtotals is only valid for waterfall charts.`);
|
|
827
|
+
}
|
|
828
|
+
const waterfallFields = [
|
|
829
|
+
layout.connectorLines,
|
|
830
|
+
layout.increaseSpPr,
|
|
831
|
+
layout.decreaseSpPr,
|
|
832
|
+
layout.totalSpPr
|
|
833
|
+
];
|
|
834
|
+
if (waterfallFields.some(value => value !== undefined) && opts.type !== "waterfall") {
|
|
835
|
+
throw new ChartOptionsError(`chartEx.layout waterfall fields are only valid for waterfall charts.`);
|
|
836
|
+
}
|
|
837
|
+
const hierarchyLayout = layout.parentLabelLayout !== undefined;
|
|
838
|
+
if (hierarchyLayout && opts.type !== "sunburst" && opts.type !== "treemap") {
|
|
839
|
+
throw new ChartOptionsError(`chartEx.layout.parentLabelLayout is only valid for sunburst and treemap charts.`);
|
|
840
|
+
}
|
|
841
|
+
const boxWhiskerFields = [
|
|
842
|
+
layout.quartileMethod,
|
|
843
|
+
layout.showMeanLine,
|
|
844
|
+
layout.showMeanMarker,
|
|
845
|
+
layout.showInnerPoints,
|
|
846
|
+
layout.showOutlierPoints
|
|
847
|
+
];
|
|
848
|
+
if (boxWhiskerFields.some(value => value !== undefined) && opts.type !== "boxWhisker") {
|
|
849
|
+
throw new ChartOptionsError(`chartEx.layout box-whisker fields are only valid for boxWhisker charts.`);
|
|
850
|
+
}
|
|
851
|
+
const regionMapFields = [layout.projection, layout.regionLabels, layout.geoMappingLevel];
|
|
852
|
+
if (regionMapFields.some(value => value !== undefined) && opts.type !== "regionMap") {
|
|
853
|
+
throw new ChartOptionsError(`chartEx.layout region-map fields are only valid for regionMap charts.`);
|
|
854
|
+
}
|
|
855
|
+
if (layout.paretoLine !== undefined && opts.type !== "pareto") {
|
|
856
|
+
throw new ChartOptionsError(`chartEx.layout.paretoLine is only valid for pareto charts.`);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
function validateBinning(binning) {
|
|
860
|
+
if (binning.binSize !== undefined && binning.binSize <= 0) {
|
|
861
|
+
throw new ChartOptionsError("chartEx.binning.binSize must be greater than 0.");
|
|
862
|
+
}
|
|
863
|
+
if (binning.binCount !== undefined &&
|
|
864
|
+
(!Number.isInteger(binning.binCount) || binning.binCount <= 0)) {
|
|
865
|
+
throw new ChartOptionsError("chartEx.binning.binCount must be a positive integer.");
|
|
866
|
+
}
|
|
867
|
+
if (binning.underflow !== undefined &&
|
|
868
|
+
binning.overflow !== undefined &&
|
|
869
|
+
binning.underflow >= binning.overflow) {
|
|
870
|
+
throw new ChartOptionsError("chartEx.binning.underflow must be less than overflow.");
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
function mapChartTypeToLayoutId(type) {
|
|
874
|
+
switch (type) {
|
|
875
|
+
case "sunburst":
|
|
876
|
+
return "sunburst";
|
|
877
|
+
case "treemap":
|
|
878
|
+
return "treemap";
|
|
879
|
+
case "waterfall":
|
|
880
|
+
return "waterfall";
|
|
881
|
+
case "funnel":
|
|
882
|
+
return "funnel";
|
|
883
|
+
case "histogram":
|
|
884
|
+
case "pareto":
|
|
885
|
+
// Histogram and pareto both project onto the same `clusteredColumn`
|
|
886
|
+
// layout — pareto additionally renders a line overlay (flagged via
|
|
887
|
+
// `layoutPr.paretoLine`), histogram supplies the binning metadata.
|
|
888
|
+
return "clusteredColumn";
|
|
889
|
+
case "boxWhisker":
|
|
890
|
+
return "boxWhisker";
|
|
891
|
+
case "regionMap":
|
|
892
|
+
return "regionMap";
|
|
893
|
+
default: {
|
|
894
|
+
const _never = type;
|
|
895
|
+
throw new ChartOptionsError(`Unsupported chartEx type: ${String(_never)}.`);
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
function needsAxes(type) {
|
|
900
|
+
// Sunburst, treemap, funnel, regionMap don't use traditional axes;
|
|
901
|
+
// histogram/pareto/waterfall/boxWhisker do.
|
|
902
|
+
return type === "histogram" || type === "pareto" || type === "waterfall" || type === "boxWhisker";
|
|
903
|
+
}
|