@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,750 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sparkline (mini chart) data model and utilities.
|
|
3
|
+
*
|
|
4
|
+
* Sparklines are cell-sized charts stored in the worksheet extLst under
|
|
5
|
+
* `x14:sparklineGroups`. Each group contains:
|
|
6
|
+
* - display options (type, line weight, markers, axis settings, colors)
|
|
7
|
+
* - one or more sparklines, each pairing a data reference with an anchor cell.
|
|
8
|
+
*
|
|
9
|
+
* Reference: ECMA-376 §18.18.92 + Office Open XML extension `x14` namespace.
|
|
10
|
+
*/
|
|
11
|
+
import { xmlEncode, xmlEncodeAttr } from "../../xml/encode.js";
|
|
12
|
+
/**
|
|
13
|
+
* Build a SparklineGroup from simplified options.
|
|
14
|
+
*/
|
|
15
|
+
export function buildSparklineGroup(opts) {
|
|
16
|
+
const group = {
|
|
17
|
+
type: opts.type,
|
|
18
|
+
sparklines: opts.sparklines
|
|
19
|
+
};
|
|
20
|
+
if (opts.lineWeight !== undefined) {
|
|
21
|
+
group.lineWeight = opts.lineWeight;
|
|
22
|
+
}
|
|
23
|
+
if (opts.markers !== undefined) {
|
|
24
|
+
group.markers = opts.markers;
|
|
25
|
+
}
|
|
26
|
+
if (opts.high !== undefined) {
|
|
27
|
+
group.high = opts.high;
|
|
28
|
+
}
|
|
29
|
+
if (opts.low !== undefined) {
|
|
30
|
+
group.low = opts.low;
|
|
31
|
+
}
|
|
32
|
+
if (opts.first !== undefined) {
|
|
33
|
+
group.first = opts.first;
|
|
34
|
+
}
|
|
35
|
+
if (opts.last !== undefined) {
|
|
36
|
+
group.last = opts.last;
|
|
37
|
+
}
|
|
38
|
+
if (opts.negative !== undefined) {
|
|
39
|
+
group.negative = opts.negative;
|
|
40
|
+
}
|
|
41
|
+
if (opts.lineColor) {
|
|
42
|
+
group.colorSeries = hexToSparklineColor(opts.lineColor);
|
|
43
|
+
}
|
|
44
|
+
if (opts.negativeColor) {
|
|
45
|
+
group.colorNegative = hexToSparklineColor(opts.negativeColor);
|
|
46
|
+
}
|
|
47
|
+
if (opts.axisColor) {
|
|
48
|
+
group.colorAxis = hexToSparklineColor(opts.axisColor);
|
|
49
|
+
}
|
|
50
|
+
if (opts.markerColor) {
|
|
51
|
+
group.colorMarkers = hexToSparklineColor(opts.markerColor);
|
|
52
|
+
}
|
|
53
|
+
if (opts.highColor) {
|
|
54
|
+
group.colorHigh = hexToSparklineColor(opts.highColor);
|
|
55
|
+
}
|
|
56
|
+
if (opts.lowColor) {
|
|
57
|
+
group.colorLow = hexToSparklineColor(opts.lowColor);
|
|
58
|
+
}
|
|
59
|
+
if (opts.firstColor) {
|
|
60
|
+
group.colorFirst = hexToSparklineColor(opts.firstColor);
|
|
61
|
+
}
|
|
62
|
+
if (opts.lastColor) {
|
|
63
|
+
group.colorLast = hexToSparklineColor(opts.lastColor);
|
|
64
|
+
}
|
|
65
|
+
if (opts.minAxisType) {
|
|
66
|
+
group.minAxisType = opts.minAxisType;
|
|
67
|
+
}
|
|
68
|
+
if (opts.maxAxisType) {
|
|
69
|
+
group.maxAxisType = opts.maxAxisType;
|
|
70
|
+
}
|
|
71
|
+
if (opts.manualMin !== undefined) {
|
|
72
|
+
group.manualMin = opts.manualMin;
|
|
73
|
+
}
|
|
74
|
+
if (opts.manualMax !== undefined) {
|
|
75
|
+
group.manualMax = opts.manualMax;
|
|
76
|
+
}
|
|
77
|
+
if (opts.displayXAxis !== undefined) {
|
|
78
|
+
group.displayXAxis = opts.displayXAxis;
|
|
79
|
+
}
|
|
80
|
+
if (opts.rightToLeft !== undefined) {
|
|
81
|
+
group.rightToLeft = opts.rightToLeft;
|
|
82
|
+
}
|
|
83
|
+
if (opts.displayEmptyCellsAs) {
|
|
84
|
+
group.displayEmptyCellsAs = opts.displayEmptyCellsAs;
|
|
85
|
+
}
|
|
86
|
+
if (opts.dateAxis) {
|
|
87
|
+
group.dateAxis = opts.dateAxis;
|
|
88
|
+
}
|
|
89
|
+
return group;
|
|
90
|
+
}
|
|
91
|
+
function hexToSparklineColor(hex) {
|
|
92
|
+
return { rgb: hex.replace(/^#/, "").toUpperCase() };
|
|
93
|
+
}
|
|
94
|
+
// ============================================================================
|
|
95
|
+
// XML rendering
|
|
96
|
+
// ============================================================================
|
|
97
|
+
/**
|
|
98
|
+
* Render all sparkline groups on a worksheet to an x14:sparklineGroups
|
|
99
|
+
* XML fragment. Returns a string (empty if no groups).
|
|
100
|
+
*/
|
|
101
|
+
export function renderSparklineGroups(groups) {
|
|
102
|
+
if (!groups || groups.length === 0) {
|
|
103
|
+
return "";
|
|
104
|
+
}
|
|
105
|
+
const parts = [];
|
|
106
|
+
parts.push('<x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">');
|
|
107
|
+
for (const g of groups) {
|
|
108
|
+
parts.push(renderSparklineGroup(g));
|
|
109
|
+
}
|
|
110
|
+
parts.push("</x14:sparklineGroups>");
|
|
111
|
+
return parts.join("");
|
|
112
|
+
}
|
|
113
|
+
function renderSparklineGroup(g) {
|
|
114
|
+
const attrs = [];
|
|
115
|
+
if (g.type !== undefined && g.type !== "line") {
|
|
116
|
+
attrs.push(`type="${g.type}"`);
|
|
117
|
+
}
|
|
118
|
+
if (g.lineWeight !== undefined) {
|
|
119
|
+
attrs.push(`lineWeight="${g.lineWeight}"`);
|
|
120
|
+
}
|
|
121
|
+
if (g.displayEmptyCellsAs) {
|
|
122
|
+
attrs.push(`displayEmptyCellsAs="${g.displayEmptyCellsAs}"`);
|
|
123
|
+
}
|
|
124
|
+
if (g.markers) {
|
|
125
|
+
attrs.push('markers="1"');
|
|
126
|
+
}
|
|
127
|
+
if (g.high) {
|
|
128
|
+
attrs.push('high="1"');
|
|
129
|
+
}
|
|
130
|
+
if (g.low) {
|
|
131
|
+
attrs.push('low="1"');
|
|
132
|
+
}
|
|
133
|
+
if (g.first) {
|
|
134
|
+
attrs.push('first="1"');
|
|
135
|
+
}
|
|
136
|
+
if (g.last) {
|
|
137
|
+
attrs.push('last="1"');
|
|
138
|
+
}
|
|
139
|
+
if (g.negative) {
|
|
140
|
+
attrs.push('negative="1"');
|
|
141
|
+
}
|
|
142
|
+
if (g.displayXAxis) {
|
|
143
|
+
attrs.push('displayXAxis="1"');
|
|
144
|
+
}
|
|
145
|
+
if (g.displayHidden) {
|
|
146
|
+
attrs.push('displayHidden="1"');
|
|
147
|
+
}
|
|
148
|
+
if (g.minAxisType && g.minAxisType !== "individual") {
|
|
149
|
+
attrs.push(`minAxisType="${g.minAxisType}"`);
|
|
150
|
+
}
|
|
151
|
+
if (g.maxAxisType && g.maxAxisType !== "individual") {
|
|
152
|
+
attrs.push(`maxAxisType="${g.maxAxisType}"`);
|
|
153
|
+
}
|
|
154
|
+
if (g.manualMin !== undefined) {
|
|
155
|
+
attrs.push(`manualMin="${g.manualMin}"`);
|
|
156
|
+
}
|
|
157
|
+
if (g.manualMax !== undefined) {
|
|
158
|
+
attrs.push(`manualMax="${g.manualMax}"`);
|
|
159
|
+
}
|
|
160
|
+
if (g.rightToLeft) {
|
|
161
|
+
attrs.push('rightToLeft="1"');
|
|
162
|
+
}
|
|
163
|
+
const parts = [];
|
|
164
|
+
parts.push(`<x14:sparklineGroup${attrs.length > 0 ? ` ${attrs.join(" ")}` : ""}>`);
|
|
165
|
+
// Colors (emit only those set, in OOXML order)
|
|
166
|
+
if (g.colorSeries) {
|
|
167
|
+
parts.push(`<x14:colorSeries ${sparklineColorAttrs(g.colorSeries)}/>`);
|
|
168
|
+
}
|
|
169
|
+
if (g.colorNegative) {
|
|
170
|
+
parts.push(`<x14:colorNegative ${sparklineColorAttrs(g.colorNegative)}/>`);
|
|
171
|
+
}
|
|
172
|
+
if (g.colorAxis) {
|
|
173
|
+
parts.push(`<x14:colorAxis ${sparklineColorAttrs(g.colorAxis)}/>`);
|
|
174
|
+
}
|
|
175
|
+
if (g.colorMarkers) {
|
|
176
|
+
parts.push(`<x14:colorMarkers ${sparklineColorAttrs(g.colorMarkers)}/>`);
|
|
177
|
+
}
|
|
178
|
+
if (g.colorFirst) {
|
|
179
|
+
parts.push(`<x14:colorFirst ${sparklineColorAttrs(g.colorFirst)}/>`);
|
|
180
|
+
}
|
|
181
|
+
if (g.colorLast) {
|
|
182
|
+
parts.push(`<x14:colorLast ${sparklineColorAttrs(g.colorLast)}/>`);
|
|
183
|
+
}
|
|
184
|
+
if (g.colorHigh) {
|
|
185
|
+
parts.push(`<x14:colorHigh ${sparklineColorAttrs(g.colorHigh)}/>`);
|
|
186
|
+
}
|
|
187
|
+
if (g.colorLow) {
|
|
188
|
+
parts.push(`<x14:colorLow ${sparklineColorAttrs(g.colorLow)}/>`);
|
|
189
|
+
}
|
|
190
|
+
if (g.dateAxis) {
|
|
191
|
+
parts.push(`<xm:f>${escapeXml(g.dateAxis)}</xm:f>`);
|
|
192
|
+
}
|
|
193
|
+
// Sparklines
|
|
194
|
+
parts.push("<x14:sparklines>");
|
|
195
|
+
for (const s of g.sparklines) {
|
|
196
|
+
parts.push("<x14:sparkline>");
|
|
197
|
+
parts.push(`<xm:f>${escapeXml(s.dataRef)}</xm:f>`);
|
|
198
|
+
parts.push(`<xm:sqref>${escapeXml(s.cellRef)}</xm:sqref>`);
|
|
199
|
+
parts.push("</x14:sparkline>");
|
|
200
|
+
}
|
|
201
|
+
parts.push("</x14:sparklines>");
|
|
202
|
+
parts.push("</x14:sparklineGroup>");
|
|
203
|
+
return parts.join("");
|
|
204
|
+
}
|
|
205
|
+
function sparklineColorAttrs(c) {
|
|
206
|
+
const parts = [];
|
|
207
|
+
if (c.rgb) {
|
|
208
|
+
parts.push(`rgb="${c.rgb}"`);
|
|
209
|
+
}
|
|
210
|
+
if (c.theme !== undefined) {
|
|
211
|
+
parts.push(`theme="${c.theme}"`);
|
|
212
|
+
}
|
|
213
|
+
if (c.tint !== undefined) {
|
|
214
|
+
parts.push(`tint="${c.tint}"`);
|
|
215
|
+
}
|
|
216
|
+
if (c.auto) {
|
|
217
|
+
parts.push('auto="1"');
|
|
218
|
+
}
|
|
219
|
+
return parts.join(" ");
|
|
220
|
+
}
|
|
221
|
+
function escapeXml(s) {
|
|
222
|
+
// Use the canonical encoder: strips XML 1.0 control characters /
|
|
223
|
+
// lone surrogates and escapes the five reserved entities. The
|
|
224
|
+
// previous manual chain missed `"` / `'` (ok for text, but we
|
|
225
|
+
// share the helper with attribute-less contexts where lone
|
|
226
|
+
// surrogates or bg-copied control codes would corrupt the part).
|
|
227
|
+
return xmlEncode(s);
|
|
228
|
+
}
|
|
229
|
+
// ============================================================================
|
|
230
|
+
// XML parsing (best-effort from raw XML fragment)
|
|
231
|
+
// ============================================================================
|
|
232
|
+
/**
|
|
233
|
+
* Parse an x14:sparklineGroups XML fragment into structured groups.
|
|
234
|
+
* Best-effort regex-based parser — sufficient for round-trip via rebuild.
|
|
235
|
+
*/
|
|
236
|
+
export function parseSparklineGroups(xml) {
|
|
237
|
+
const groups = [];
|
|
238
|
+
// Match both the open/close and self-closing forms of
|
|
239
|
+
// `<x14:sparklineGroup ...>`. Excel legitimately emits the
|
|
240
|
+
// self-closing variant (`<x14:sparklineGroup .../>`) when the
|
|
241
|
+
// group has no child elements — e.g. a group whose sole sparkline
|
|
242
|
+
// was deleted but the parent was preserved for styling, or an
|
|
243
|
+
// empty group created programmatically. Requiring an explicit
|
|
244
|
+
// closing tag silently dropped those groups on load, losing the
|
|
245
|
+
// entry on the next write.
|
|
246
|
+
const groupRe = /<x14:sparklineGroup\b([^>]*?)(?:\/>|>([\s\S]*?)<\/x14:sparklineGroup>)/g;
|
|
247
|
+
let m;
|
|
248
|
+
while ((m = groupRe.exec(xml)) !== null) {
|
|
249
|
+
const g = parseGroupBlock(m[1] ?? "", m[2] ?? "");
|
|
250
|
+
groups.push(g);
|
|
251
|
+
}
|
|
252
|
+
return groups;
|
|
253
|
+
}
|
|
254
|
+
// Pre-compiled regexes for sparkline color tag parsing
|
|
255
|
+
const COLOR_TAG_RES = new Map([
|
|
256
|
+
["colorSeries", /<x14:colorSeries\b([^/]*)\/>/],
|
|
257
|
+
["colorNegative", /<x14:colorNegative\b([^/]*)\/>/],
|
|
258
|
+
["colorAxis", /<x14:colorAxis\b([^/]*)\/>/],
|
|
259
|
+
["colorMarkers", /<x14:colorMarkers\b([^/]*)\/>/],
|
|
260
|
+
["colorFirst", /<x14:colorFirst\b([^/]*)\/>/],
|
|
261
|
+
["colorLast", /<x14:colorLast\b([^/]*)\/>/],
|
|
262
|
+
["colorHigh", /<x14:colorHigh\b([^/]*)\/>/],
|
|
263
|
+
["colorLow", /<x14:colorLow\b([^/]*)\/>/]
|
|
264
|
+
]);
|
|
265
|
+
function parseGroupBlock(attrXml, inner) {
|
|
266
|
+
const g = { sparklines: [] };
|
|
267
|
+
const attrRe = /(\w+)="([^"]*)"/g;
|
|
268
|
+
let m;
|
|
269
|
+
while ((m = attrRe.exec(attrXml)) !== null) {
|
|
270
|
+
const [, name, val] = m;
|
|
271
|
+
switch (name) {
|
|
272
|
+
case "type":
|
|
273
|
+
g.type = val;
|
|
274
|
+
break;
|
|
275
|
+
case "lineWeight":
|
|
276
|
+
g.lineWeight = parseFloat(val);
|
|
277
|
+
break;
|
|
278
|
+
case "displayEmptyCellsAs":
|
|
279
|
+
g.displayEmptyCellsAs = val;
|
|
280
|
+
break;
|
|
281
|
+
case "markers":
|
|
282
|
+
g.markers = val === "1";
|
|
283
|
+
break;
|
|
284
|
+
case "high":
|
|
285
|
+
g.high = val === "1";
|
|
286
|
+
break;
|
|
287
|
+
case "low":
|
|
288
|
+
g.low = val === "1";
|
|
289
|
+
break;
|
|
290
|
+
case "first":
|
|
291
|
+
g.first = val === "1";
|
|
292
|
+
break;
|
|
293
|
+
case "last":
|
|
294
|
+
g.last = val === "1";
|
|
295
|
+
break;
|
|
296
|
+
case "negative":
|
|
297
|
+
g.negative = val === "1";
|
|
298
|
+
break;
|
|
299
|
+
case "displayXAxis":
|
|
300
|
+
g.displayXAxis = val === "1";
|
|
301
|
+
break;
|
|
302
|
+
case "displayHidden":
|
|
303
|
+
g.displayHidden = val === "1";
|
|
304
|
+
break;
|
|
305
|
+
case "minAxisType":
|
|
306
|
+
g.minAxisType = val;
|
|
307
|
+
break;
|
|
308
|
+
case "maxAxisType":
|
|
309
|
+
g.maxAxisType = val;
|
|
310
|
+
break;
|
|
311
|
+
case "manualMin":
|
|
312
|
+
g.manualMin = parseFloat(val);
|
|
313
|
+
break;
|
|
314
|
+
case "manualMax":
|
|
315
|
+
g.manualMax = parseFloat(val);
|
|
316
|
+
break;
|
|
317
|
+
case "rightToLeft":
|
|
318
|
+
g.rightToLeft = val === "1";
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
// Parse colors
|
|
323
|
+
const colorTags = [
|
|
324
|
+
"colorSeries",
|
|
325
|
+
"colorNegative",
|
|
326
|
+
"colorAxis",
|
|
327
|
+
"colorMarkers",
|
|
328
|
+
"colorFirst",
|
|
329
|
+
"colorLast",
|
|
330
|
+
"colorHigh",
|
|
331
|
+
"colorLow"
|
|
332
|
+
];
|
|
333
|
+
for (const tag of colorTags) {
|
|
334
|
+
const re = COLOR_TAG_RES.get(tag);
|
|
335
|
+
const cm = re.exec(inner);
|
|
336
|
+
if (cm) {
|
|
337
|
+
g[tag] = parseColorAttrs(cm[1]);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
// Parse sparklines
|
|
341
|
+
const sparkRe = /<x14:sparkline>\s*<xm:f>([\s\S]*?)<\/xm:f>\s*<xm:sqref>([\s\S]*?)<\/xm:sqref>\s*<\/x14:sparkline>/g;
|
|
342
|
+
let sm;
|
|
343
|
+
while ((sm = sparkRe.exec(inner)) !== null) {
|
|
344
|
+
g.sparklines.push({
|
|
345
|
+
dataRef: decodeXml(sm[1]),
|
|
346
|
+
cellRef: decodeXml(sm[2])
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
return g;
|
|
350
|
+
}
|
|
351
|
+
function parseColorAttrs(attrXml) {
|
|
352
|
+
const c = {};
|
|
353
|
+
const attrRe = /(\w+)="([^"]*)"/g;
|
|
354
|
+
let m;
|
|
355
|
+
while ((m = attrRe.exec(attrXml)) !== null) {
|
|
356
|
+
const [, name, val] = m;
|
|
357
|
+
switch (name) {
|
|
358
|
+
case "rgb":
|
|
359
|
+
c.rgb = val;
|
|
360
|
+
break;
|
|
361
|
+
case "theme":
|
|
362
|
+
c.theme = parseInt(val, 10);
|
|
363
|
+
break;
|
|
364
|
+
case "tint":
|
|
365
|
+
c.tint = parseFloat(val);
|
|
366
|
+
break;
|
|
367
|
+
case "auto":
|
|
368
|
+
c.auto = val === "1";
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return c;
|
|
373
|
+
}
|
|
374
|
+
function decodeXml(s) {
|
|
375
|
+
return s.replace(/&(?:amp|lt|gt|quot|apos);/g, m => {
|
|
376
|
+
switch (m) {
|
|
377
|
+
case "&":
|
|
378
|
+
return "&";
|
|
379
|
+
case "<":
|
|
380
|
+
return "<";
|
|
381
|
+
case ">":
|
|
382
|
+
return ">";
|
|
383
|
+
case """:
|
|
384
|
+
return '"';
|
|
385
|
+
case "'":
|
|
386
|
+
return "'";
|
|
387
|
+
default:
|
|
388
|
+
return m;
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Render a sparkline group to a single SVG string given explicit data
|
|
394
|
+
* values for each sparkline in the group. This is a preview-grade
|
|
395
|
+
* renderer suitable for PDF/PNG embedding — Excel ultimately renders
|
|
396
|
+
* sparklines natively from the formula references.
|
|
397
|
+
*
|
|
398
|
+
* Why take `values: number[][]` rather than walk the workbook: the
|
|
399
|
+
* caller already has a worksheet in scope when it wants a preview,
|
|
400
|
+
* and decoupling the renderer from the worksheet keeps this module
|
|
401
|
+
* free of upstream dependencies. When no per-sparkline data is
|
|
402
|
+
* supplied the SVG is rendered empty (just the background) so the
|
|
403
|
+
* function never throws.
|
|
404
|
+
*
|
|
405
|
+
* Respects the group's `type` (`line` / `column` / `stacked`),
|
|
406
|
+
* `displayXAxis`, `minAxisType` / `maxAxisType` / `manualMin` /
|
|
407
|
+
* `manualMax`, markers (`markers`, `first`, `last`, `high`, `low`,
|
|
408
|
+
* `negative`), `rightToLeft`, and all structural colours
|
|
409
|
+
* (`colorSeries`, `colorNegative`, `colorAxis`, `colorMarkers`,
|
|
410
|
+
* `colorHigh`, `colorLow`, `colorFirst`, `colorLast`).
|
|
411
|
+
*
|
|
412
|
+
* The individual sparkline's `cellRef` is not consulted — the caller
|
|
413
|
+
* controls layout at a higher level and this function returns a
|
|
414
|
+
* standalone SVG per sparkline when passed a group with a single
|
|
415
|
+
* member, or a grid-stacked SVG when given multiple members.
|
|
416
|
+
*/
|
|
417
|
+
export function renderSparklineSvg(group, values, options = {}) {
|
|
418
|
+
const width = Math.max(1, options.width ?? 120);
|
|
419
|
+
const height = Math.max(1, options.height ?? 30);
|
|
420
|
+
const padding = Math.max(0, options.padding ?? 2);
|
|
421
|
+
const rowCount = Math.max(group.sparklines.length, values.length, 1);
|
|
422
|
+
const rowHeight = height / rowCount;
|
|
423
|
+
const lineColor = resolveSparklineColor(group.colorSeries) ?? "#376091";
|
|
424
|
+
const negativeColor = resolveSparklineColor(group.colorNegative) ?? "#D00000";
|
|
425
|
+
const axisColor = resolveSparklineColor(group.colorAxis) ?? "#000000";
|
|
426
|
+
const markerColor = resolveSparklineColor(group.colorMarkers) ?? lineColor;
|
|
427
|
+
const highColor = resolveSparklineColor(group.colorHigh) ?? markerColor;
|
|
428
|
+
const lowColor = resolveSparklineColor(group.colorLow) ?? markerColor;
|
|
429
|
+
const firstColor = resolveSparklineColor(group.colorFirst) ?? markerColor;
|
|
430
|
+
const lastColor = resolveSparklineColor(group.colorLast) ?? markerColor;
|
|
431
|
+
const parts = [];
|
|
432
|
+
parts.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">`);
|
|
433
|
+
if (options.background) {
|
|
434
|
+
parts.push(`<rect x="0" y="0" width="${width}" height="${height}" fill="${escapeAttr(options.background)}"/>`);
|
|
435
|
+
}
|
|
436
|
+
// Per-group axis range: group means all sparklines share min/max;
|
|
437
|
+
// individual means each uses its own; custom uses manualMin/Max.
|
|
438
|
+
const groupMin = minOrNaN(values);
|
|
439
|
+
const groupMax = maxOrNaN(values);
|
|
440
|
+
for (let row = 0; row < rowCount; row++) {
|
|
441
|
+
const data = values[row] ?? [];
|
|
442
|
+
if (data.length === 0) {
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
const { min, max } = axisRangeFor(group, data, groupMin, groupMax);
|
|
446
|
+
const rowTop = rowHeight * row;
|
|
447
|
+
const innerX = padding;
|
|
448
|
+
const innerY = rowTop + padding;
|
|
449
|
+
const innerW = width - padding * 2;
|
|
450
|
+
const innerH = rowHeight - padding * 2;
|
|
451
|
+
if (innerW <= 0 || innerH <= 0) {
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
const span = max === min ? 1 : max - min;
|
|
455
|
+
const rtl = group.rightToLeft === true;
|
|
456
|
+
const xAt = (i, n) => {
|
|
457
|
+
const t = n <= 1 ? 0 : i / (n - 1);
|
|
458
|
+
const shifted = rtl ? 1 - t : t;
|
|
459
|
+
return innerX + shifted * innerW;
|
|
460
|
+
};
|
|
461
|
+
const yAt = (v) => {
|
|
462
|
+
if (!Number.isFinite(v)) {
|
|
463
|
+
return innerY + innerH;
|
|
464
|
+
}
|
|
465
|
+
const t = (v - min) / span;
|
|
466
|
+
return innerY + innerH - t * innerH;
|
|
467
|
+
};
|
|
468
|
+
if (group.type === "column" || group.type === "stacked") {
|
|
469
|
+
// Bar / win-loss sparkline. Stacked (a.k.a. win/loss) collapses
|
|
470
|
+
// magnitude so positives are full-height up, negatives full-height
|
|
471
|
+
// down, zeros disappear.
|
|
472
|
+
const n = data.length;
|
|
473
|
+
const barW = Math.max(1, (innerW / Math.max(n, 1)) * 0.8);
|
|
474
|
+
// Identify the value indices of the first / last / high / low
|
|
475
|
+
// bars up front so the loop below can swap colours in O(1).
|
|
476
|
+
// Excel honours `colorFirst / colorLast / colorHigh / colorLow`
|
|
477
|
+
// on column sparklines by RECOLORING the corresponding bar(s),
|
|
478
|
+
// not by overlaying a circle as line sparklines do. Previously
|
|
479
|
+
// the column / stacked branch ignored these flags entirely —
|
|
480
|
+
// any authored styling silently reverted to the plain palette.
|
|
481
|
+
let firstIdx = -1;
|
|
482
|
+
let lastIdx = -1;
|
|
483
|
+
let highIdx = -1;
|
|
484
|
+
let lowIdx = -1;
|
|
485
|
+
let highVal = -Infinity;
|
|
486
|
+
let lowVal = Infinity;
|
|
487
|
+
for (let i = 0; i < n; i++) {
|
|
488
|
+
const v = data[i];
|
|
489
|
+
if (!Number.isFinite(v)) {
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
if (firstIdx === -1) {
|
|
493
|
+
firstIdx = i;
|
|
494
|
+
}
|
|
495
|
+
lastIdx = i;
|
|
496
|
+
if (v > highVal) {
|
|
497
|
+
highVal = v;
|
|
498
|
+
highIdx = i;
|
|
499
|
+
}
|
|
500
|
+
if (v < lowVal) {
|
|
501
|
+
lowVal = v;
|
|
502
|
+
lowIdx = i;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
for (let i = 0; i < n; i++) {
|
|
506
|
+
const v = data[i];
|
|
507
|
+
if (!Number.isFinite(v) || v === 0) {
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
const centre = xAt(i, n);
|
|
511
|
+
const x = centre - barW / 2;
|
|
512
|
+
// Negative bars pick up `colorNegative` only when the author
|
|
513
|
+
// opted in (`group.negative === true`). The previous
|
|
514
|
+
// `!== false` predicate inverted the default — `undefined`
|
|
515
|
+
// satisfies `!== false`, so every negative bar on a default-
|
|
516
|
+
// styled sparkline was painted red, diverging from Excel's
|
|
517
|
+
// own rendering on the same file.
|
|
518
|
+
let color = v < 0 && group.negative === true ? negativeColor : lineColor;
|
|
519
|
+
// Special-marker colour overrides run in Excel's precedence
|
|
520
|
+
// order: negative first, then high/low, then first/last
|
|
521
|
+
// (later wins when the same bar qualifies multiple times —
|
|
522
|
+
// matches Excel's observable behaviour on the same data).
|
|
523
|
+
if (group.high && i === highIdx) {
|
|
524
|
+
color = highColor;
|
|
525
|
+
}
|
|
526
|
+
if (group.low && i === lowIdx) {
|
|
527
|
+
color = lowColor;
|
|
528
|
+
}
|
|
529
|
+
if (group.first && i === firstIdx) {
|
|
530
|
+
color = firstColor;
|
|
531
|
+
}
|
|
532
|
+
if (group.last && i === lastIdx) {
|
|
533
|
+
color = lastColor;
|
|
534
|
+
}
|
|
535
|
+
let y;
|
|
536
|
+
let h;
|
|
537
|
+
if (group.type === "stacked") {
|
|
538
|
+
const half = innerH / 2;
|
|
539
|
+
if (v >= 0) {
|
|
540
|
+
y = innerY + half - half;
|
|
541
|
+
h = half;
|
|
542
|
+
}
|
|
543
|
+
else {
|
|
544
|
+
y = innerY + half;
|
|
545
|
+
h = half;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
const base = min <= 0 && max >= 0 ? yAt(0) : innerY + innerH;
|
|
550
|
+
const top = yAt(v);
|
|
551
|
+
y = Math.min(base, top);
|
|
552
|
+
h = Math.abs(base - top);
|
|
553
|
+
}
|
|
554
|
+
parts.push(`<rect x="${x}" y="${y}" width="${barW}" height="${Math.max(h, 1)}" fill="${color}"/>`);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
// Line sparkline.
|
|
559
|
+
const pointsFinite = [];
|
|
560
|
+
for (let i = 0; i < data.length; i++) {
|
|
561
|
+
const v = data[i];
|
|
562
|
+
if (Number.isFinite(v)) {
|
|
563
|
+
pointsFinite.push({ x: xAt(i, data.length), y: yAt(v), v });
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
if (pointsFinite.length >= 2) {
|
|
567
|
+
const d = pointsFinite.map((p, i) => `${i === 0 ? "M" : "L"}${p.x} ${p.y}`).join(" ");
|
|
568
|
+
parts.push(`<path d="${d}" fill="none" stroke="${lineColor}" stroke-width="${group.lineWeight ? group.lineWeight * 0.75 : 1}"/>`);
|
|
569
|
+
}
|
|
570
|
+
if (group.markers) {
|
|
571
|
+
for (const p of pointsFinite) {
|
|
572
|
+
parts.push(`<circle cx="${p.x}" cy="${p.y}" r="1.5" fill="${markerColor}"/>`);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
// Special markers override the regular marker above.
|
|
576
|
+
if (pointsFinite.length > 0) {
|
|
577
|
+
if (group.first) {
|
|
578
|
+
const p = pointsFinite[0];
|
|
579
|
+
parts.push(`<circle cx="${p.x}" cy="${p.y}" r="1.8" fill="${firstColor}"/>`);
|
|
580
|
+
}
|
|
581
|
+
if (group.last) {
|
|
582
|
+
const p = pointsFinite[pointsFinite.length - 1];
|
|
583
|
+
parts.push(`<circle cx="${p.x}" cy="${p.y}" r="1.8" fill="${lastColor}"/>`);
|
|
584
|
+
}
|
|
585
|
+
if (group.high) {
|
|
586
|
+
const hi = pointsFinite.reduce((acc, p) => (p.v > acc.v ? p : acc), pointsFinite[0]);
|
|
587
|
+
parts.push(`<circle cx="${hi.x}" cy="${hi.y}" r="1.8" fill="${highColor}"/>`);
|
|
588
|
+
}
|
|
589
|
+
if (group.low) {
|
|
590
|
+
const lo = pointsFinite.reduce((acc, p) => (p.v < acc.v ? p : acc), pointsFinite[0]);
|
|
591
|
+
parts.push(`<circle cx="${lo.x}" cy="${lo.y}" r="1.8" fill="${lowColor}"/>`);
|
|
592
|
+
}
|
|
593
|
+
if (group.negative) {
|
|
594
|
+
for (const p of pointsFinite) {
|
|
595
|
+
if (p.v < 0) {
|
|
596
|
+
parts.push(`<circle cx="${p.x}" cy="${p.y}" r="1.8" fill="${negativeColor}"/>`);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
if (group.displayXAxis) {
|
|
603
|
+
// Win/loss (`stacked`) sparklines always paint positives from
|
|
604
|
+
// the midpoint up and negatives from the midpoint down,
|
|
605
|
+
// regardless of magnitude — so the zero rule must sit at the
|
|
606
|
+
// geometric midpoint, not wherever `yAt(0)` lands on the
|
|
607
|
+
// min/max-scaled axis. The old `yAt(0)` was only correct when
|
|
608
|
+
// the data happened to be symmetric around zero; any asymmetry
|
|
609
|
+
// left the axis line visibly detached from where the bars met.
|
|
610
|
+
// Line / column sparklines render from actual min/max so their
|
|
611
|
+
// rule stays at `yAt(0)`, but only when zero is in range.
|
|
612
|
+
let axisY;
|
|
613
|
+
if (group.type === "stacked") {
|
|
614
|
+
axisY = innerY + innerH / 2;
|
|
615
|
+
}
|
|
616
|
+
else if (min <= 0 && max >= 0) {
|
|
617
|
+
axisY = yAt(0);
|
|
618
|
+
}
|
|
619
|
+
if (axisY !== undefined) {
|
|
620
|
+
parts.push(`<line x1="${innerX}" y1="${axisY}" x2="${innerX + innerW}" y2="${axisY}" stroke="${axisColor}" stroke-width="0.5"/>`);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
parts.push(`</svg>`);
|
|
625
|
+
return parts.join("");
|
|
626
|
+
}
|
|
627
|
+
function axisRangeFor(group, row, groupMin, groupMax) {
|
|
628
|
+
let min;
|
|
629
|
+
let max;
|
|
630
|
+
// Track whether each bound came from the caller's explicit `custom`
|
|
631
|
+
// setting. A manual bound must never be padded away by the
|
|
632
|
+
// zero-span fallback below — a user who deliberately set
|
|
633
|
+
// `manualMin === manualMax` (e.g. to highlight deviation from a
|
|
634
|
+
// fixed reference value) would otherwise see their bound silently
|
|
635
|
+
// widened by ±1.
|
|
636
|
+
let minIsManual = false;
|
|
637
|
+
let maxIsManual = false;
|
|
638
|
+
if (group.minAxisType === "group") {
|
|
639
|
+
min = groupMin;
|
|
640
|
+
}
|
|
641
|
+
else if (group.minAxisType === "custom" && group.manualMin !== undefined) {
|
|
642
|
+
min = group.manualMin;
|
|
643
|
+
minIsManual = true;
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
min = finiteMin(row);
|
|
647
|
+
}
|
|
648
|
+
if (group.maxAxisType === "group") {
|
|
649
|
+
max = groupMax;
|
|
650
|
+
}
|
|
651
|
+
else if (group.maxAxisType === "custom" && group.manualMax !== undefined) {
|
|
652
|
+
max = group.manualMax;
|
|
653
|
+
maxIsManual = true;
|
|
654
|
+
}
|
|
655
|
+
else {
|
|
656
|
+
max = finiteMax(row);
|
|
657
|
+
}
|
|
658
|
+
if (!Number.isFinite(min) || !Number.isFinite(max)) {
|
|
659
|
+
return { min: 0, max: 1 };
|
|
660
|
+
}
|
|
661
|
+
if (min === max) {
|
|
662
|
+
// Flat line — pad so the point renders in the middle. Only apply
|
|
663
|
+
// the pad when neither bound was manually authored; otherwise the
|
|
664
|
+
// user's explicit choice wins and the sparkline renders as a
|
|
665
|
+
// single point at mid-height (which is what the bound requested).
|
|
666
|
+
if (minIsManual || maxIsManual) {
|
|
667
|
+
return { min, max };
|
|
668
|
+
}
|
|
669
|
+
return { min: min - 1, max: max + 1 };
|
|
670
|
+
}
|
|
671
|
+
return { min, max };
|
|
672
|
+
}
|
|
673
|
+
function finiteMin(row) {
|
|
674
|
+
let r = Infinity;
|
|
675
|
+
for (const v of row) {
|
|
676
|
+
if (Number.isFinite(v) && v < r) {
|
|
677
|
+
r = v;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
return r;
|
|
681
|
+
}
|
|
682
|
+
function finiteMax(row) {
|
|
683
|
+
let r = -Infinity;
|
|
684
|
+
for (const v of row) {
|
|
685
|
+
if (Number.isFinite(v) && v > r) {
|
|
686
|
+
r = v;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return r;
|
|
690
|
+
}
|
|
691
|
+
function minOrNaN(rows) {
|
|
692
|
+
let r = Infinity;
|
|
693
|
+
for (const row of rows) {
|
|
694
|
+
const m = finiteMin(row);
|
|
695
|
+
if (m < r) {
|
|
696
|
+
r = m;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return Number.isFinite(r) ? r : NaN;
|
|
700
|
+
}
|
|
701
|
+
function maxOrNaN(rows) {
|
|
702
|
+
let r = -Infinity;
|
|
703
|
+
for (const row of rows) {
|
|
704
|
+
const m = finiteMax(row);
|
|
705
|
+
if (m > r) {
|
|
706
|
+
r = m;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
return Number.isFinite(r) ? r : NaN;
|
|
710
|
+
}
|
|
711
|
+
function resolveSparklineColor(color) {
|
|
712
|
+
if (!color) {
|
|
713
|
+
return undefined;
|
|
714
|
+
}
|
|
715
|
+
if (color.rgb) {
|
|
716
|
+
// Excel sparkline RGB hex is ARGB (8 chars) or RGB (6 chars); we
|
|
717
|
+
// normalise to a 6-char hex for SVG consumption, discarding alpha.
|
|
718
|
+
const hex = color.rgb.length === 8 ? color.rgb.slice(2) : color.rgb;
|
|
719
|
+
return `#${hex}`;
|
|
720
|
+
}
|
|
721
|
+
// Theme colours require the workbook theme to resolve precisely; for
|
|
722
|
+
// preview purposes fall back to a stable palette that roughly tracks
|
|
723
|
+
// Office defaults. Callers who need pixel-perfect theme resolution
|
|
724
|
+
// can supply a structured `rgb` instead.
|
|
725
|
+
if (color.theme !== undefined) {
|
|
726
|
+
const palette = [
|
|
727
|
+
"#000000",
|
|
728
|
+
"#FFFFFF",
|
|
729
|
+
"#1F497D",
|
|
730
|
+
"#EEECE1",
|
|
731
|
+
"#4F81BD",
|
|
732
|
+
"#C0504D",
|
|
733
|
+
"#9BBB59",
|
|
734
|
+
"#8064A2",
|
|
735
|
+
"#4BACC6",
|
|
736
|
+
"#F79646",
|
|
737
|
+
"#0000FF",
|
|
738
|
+
"#800080"
|
|
739
|
+
];
|
|
740
|
+
return palette[color.theme] ?? "#000000";
|
|
741
|
+
}
|
|
742
|
+
return undefined;
|
|
743
|
+
}
|
|
744
|
+
function escapeAttr(s) {
|
|
745
|
+
// Attribute values additionally require `\t \n \r` → numeric refs
|
|
746
|
+
// so XML attribute-value normalisation doesn't collapse them to
|
|
747
|
+
// literal spaces (losing e.g. a manual cell-reference break in a
|
|
748
|
+
// sparkline group's `manualMin` / `manualMax` display label).
|
|
749
|
+
return xmlEncodeAttr(s);
|
|
750
|
+
}
|