@rowsncolumns/toolkit 24.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +100 -0
- package/Readme.md +27 -0
- package/dist/cjs/autofilter-condition.d.ts +43 -0
- package/dist/cjs/autofilter-condition.d.ts.map +1 -0
- package/dist/cjs/autofilter-condition.js +155 -0
- package/dist/cjs/csv-export.d.ts +49 -0
- package/dist/cjs/csv-export.d.ts.map +1 -0
- package/dist/cjs/csv-export.js +142 -0
- package/dist/cjs/csv-import-worker.d.ts +16 -0
- package/dist/cjs/csv-import-worker.d.ts.map +1 -0
- package/dist/cjs/csv-import-worker.js +60 -0
- package/dist/cjs/csv-import.d.ts +38 -0
- package/dist/cjs/csv-import.d.ts.map +1 -0
- package/dist/cjs/csv-import.js +166 -0
- package/dist/cjs/csv-parser/helpers.d.ts +14 -0
- package/dist/cjs/csv-parser/helpers.d.ts.map +1 -0
- package/dist/cjs/csv-parser/helpers.js +145 -0
- package/dist/cjs/csv-parser/types.d.ts +66 -0
- package/dist/cjs/csv-parser/types.d.ts.map +1 -0
- package/dist/cjs/csv-parser/types.js +14 -0
- package/dist/cjs/csv-parser/worker.d.ts +2 -0
- package/dist/cjs/csv-parser/worker.d.ts.map +1 -0
- package/dist/cjs/csv-parser/worker.js +200 -0
- package/dist/cjs/excel-export.d.ts +11 -0
- package/dist/cjs/excel-export.d.ts.map +1 -0
- package/dist/cjs/excel-export.js +22 -0
- package/dist/cjs/excel-import-session.d.ts +51 -0
- package/dist/cjs/excel-import-session.d.ts.map +1 -0
- package/dist/cjs/excel-import-session.js +307 -0
- package/dist/cjs/excel-import-worker.d.ts +7 -0
- package/dist/cjs/excel-import-worker.d.ts.map +1 -0
- package/dist/cjs/excel-import-worker.js +119 -0
- package/dist/cjs/excel-parser/builtin-numfmts.d.ts +24 -0
- package/dist/cjs/excel-parser/builtin-numfmts.d.ts.map +1 -0
- package/dist/cjs/excel-parser/builtin-numfmts.js +63 -0
- package/dist/cjs/excel-parser/cfb-decryptor.d.ts +53 -0
- package/dist/cjs/excel-parser/cfb-decryptor.d.ts.map +1 -0
- package/dist/cjs/excel-parser/cfb-decryptor.js +553 -0
- package/dist/cjs/excel-parser/cfb-encryptor.d.ts +23 -0
- package/dist/cjs/excel-parser/cfb-encryptor.d.ts.map +1 -0
- package/dist/cjs/excel-parser/cfb-encryptor.js +200 -0
- package/dist/cjs/excel-parser/dv-cell-stamp.d.ts +29 -0
- package/dist/cjs/excel-parser/dv-cell-stamp.d.ts.map +1 -0
- package/dist/cjs/excel-parser/dv-cell-stamp.js +239 -0
- package/dist/cjs/excel-parser/helpers.d.ts +28 -0
- package/dist/cjs/excel-parser/helpers.d.ts.map +1 -0
- package/dist/cjs/excel-parser/helpers.js +188 -0
- package/dist/cjs/excel-parser/interface.d.ts +179 -0
- package/dist/cjs/excel-parser/interface.d.ts.map +1 -0
- package/dist/cjs/excel-parser/interface.js +1 -0
- package/dist/cjs/excel-parser/plugins/base/index.d.ts +31 -0
- package/dist/cjs/excel-parser/plugins/base/index.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/base/index.js +101 -0
- package/dist/cjs/excel-parser/plugins/ods/conditional-formatting.d.ts +16 -0
- package/dist/cjs/excel-parser/plugins/ods/conditional-formatting.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/ods/conditional-formatting.js +488 -0
- package/dist/cjs/excel-parser/plugins/ods/data-validations.d.ts +15 -0
- package/dist/cjs/excel-parser/plugins/ods/data-validations.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/ods/data-validations.js +353 -0
- package/dist/cjs/excel-parser/plugins/ods/formula.d.ts +8 -0
- package/dist/cjs/excel-parser/plugins/ods/formula.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/ods/formula.js +82 -0
- package/dist/cjs/excel-parser/plugins/ods/index.d.ts +122 -0
- package/dist/cjs/excel-parser/plugins/ods/index.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/ods/index.js +3642 -0
- package/dist/cjs/excel-parser/plugins/ods/sparklines.d.ts +25 -0
- package/dist/cjs/excel-parser/plugins/ods/sparklines.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/ods/sparklines.js +221 -0
- package/dist/cjs/excel-parser/plugins/ods/styles.d.ts +60 -0
- package/dist/cjs/excel-parser/plugins/ods/styles.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/ods/styles.js +808 -0
- package/dist/cjs/excel-parser/plugins/ods/types.d.ts +7 -0
- package/dist/cjs/excel-parser/plugins/ods/types.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/ods/types.js +1 -0
- package/dist/cjs/excel-parser/plugins/xls/index.d.ts +5 -0
- package/dist/cjs/excel-parser/plugins/xls/index.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xls/index.js +19 -0
- package/dist/cjs/excel-parser/plugins/xlsb/biff-record-reader.d.ts +13 -0
- package/dist/cjs/excel-parser/plugins/xlsb/biff-record-reader.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsb/biff-record-reader.js +49 -0
- package/dist/cjs/excel-parser/plugins/xlsb/index.d.ts +117 -0
- package/dist/cjs/excel-parser/plugins/xlsb/index.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsb/index.js +2972 -0
- package/dist/cjs/excel-parser/plugins/xlsb/rgce-parser.d.ts +18 -0
- package/dist/cjs/excel-parser/plugins/xlsb/rgce-parser.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsb/rgce-parser.js +527 -0
- package/dist/cjs/excel-parser/plugins/xlsm/index.d.ts +5 -0
- package/dist/cjs/excel-parser/plugins/xlsm/index.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsm/index.js +10 -0
- package/dist/cjs/excel-parser/plugins/xlsx/charts.d.ts +60 -0
- package/dist/cjs/excel-parser/plugins/xlsx/charts.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/charts.js +2178 -0
- package/dist/cjs/excel-parser/plugins/xlsx/conditional-formatting.d.ts +18 -0
- package/dist/cjs/excel-parser/plugins/xlsx/conditional-formatting.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/conditional-formatting.js +620 -0
- package/dist/cjs/excel-parser/plugins/xlsx/data-validations.d.ts +4 -0
- package/dist/cjs/excel-parser/plugins/xlsx/data-validations.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/data-validations.js +515 -0
- package/dist/cjs/excel-parser/plugins/xlsx/drawing.d.ts +39 -0
- package/dist/cjs/excel-parser/plugins/xlsx/drawing.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/drawing.js +941 -0
- package/dist/cjs/excel-parser/plugins/xlsx/index.d.ts +320 -0
- package/dist/cjs/excel-parser/plugins/xlsx/index.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/index.js +6056 -0
- package/dist/cjs/excel-parser/plugins/xlsx/numfmt.d.ts +2 -0
- package/dist/cjs/excel-parser/plugins/xlsx/numfmt.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/numfmt.js +3 -0
- package/dist/cjs/excel-parser/plugins/xlsx/pivots.d.ts +40 -0
- package/dist/cjs/excel-parser/plugins/xlsx/pivots.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/pivots.js +342 -0
- package/dist/cjs/excel-parser/plugins/xlsx/relationships.d.ts +8 -0
- package/dist/cjs/excel-parser/plugins/xlsx/relationships.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/relationships.js +26 -0
- package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.d.ts +26 -0
- package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/sheet-views.js +59 -0
- package/dist/cjs/excel-parser/plugins/xlsx/styles.d.ts +44 -0
- package/dist/cjs/excel-parser/plugins/xlsx/styles.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/styles.js +1377 -0
- package/dist/cjs/excel-parser/plugins/xlsx/theme.d.ts +50 -0
- package/dist/cjs/excel-parser/plugins/xlsx/theme.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/theme.js +150 -0
- package/dist/cjs/excel-parser/plugins/xlsx/threaded-comments.d.ts +47 -0
- package/dist/cjs/excel-parser/plugins/xlsx/threaded-comments.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/threaded-comments.js +141 -0
- package/dist/cjs/excel-parser/plugins/xlsx/value-type-detection.d.ts +44 -0
- package/dist/cjs/excel-parser/plugins/xlsx/value-type-detection.d.ts.map +1 -0
- package/dist/cjs/excel-parser/plugins/xlsx/value-type-detection.js +407 -0
- package/dist/cjs/excel-parser/registry.d.ts +5 -0
- package/dist/cjs/excel-parser/registry.d.ts.map +1 -0
- package/dist/cjs/excel-parser/registry.js +21 -0
- package/dist/cjs/excel-parser/style-registry.d.ts +51 -0
- package/dist/cjs/excel-parser/style-registry.d.ts.map +1 -0
- package/dist/cjs/excel-parser/style-registry.js +175 -0
- package/dist/cjs/excel-parser/theme-default.d.ts +3 -0
- package/dist/cjs/excel-parser/theme-default.d.ts.map +1 -0
- package/dist/cjs/excel-parser/theme-default.js +19 -0
- package/dist/cjs/excel-parser/types.d.ts +365 -0
- package/dist/cjs/excel-parser/types.d.ts.map +1 -0
- package/dist/cjs/excel-parser/types.js +59 -0
- package/dist/cjs/excel-parser/utils.d.ts +6 -0
- package/dist/cjs/excel-parser/utils.d.ts.map +1 -0
- package/dist/cjs/excel-parser/utils.js +30 -0
- package/dist/cjs/excel-parser/workbook.d.ts +51 -0
- package/dist/cjs/excel-parser/workbook.d.ts.map +1 -0
- package/dist/cjs/excel-parser/workbook.js +317 -0
- package/dist/cjs/excel-parser/worker.d.ts +2 -0
- package/dist/cjs/excel-parser/worker.d.ts.map +1 -0
- package/dist/cjs/excel-parser/worker.js +1149 -0
- package/dist/cjs/excel-parser/zip-parser-streaming.d.ts +13 -0
- package/dist/cjs/excel-parser/zip-parser-streaming.d.ts.map +1 -0
- package/dist/cjs/excel-parser/zip-parser-streaming.js +200 -0
- package/dist/cjs/excel-parser/zip-parser.d.ts +11 -0
- package/dist/cjs/excel-parser/zip-parser.d.ts.map +1 -0
- package/dist/cjs/excel-parser/zip-parser.js +49 -0
- package/dist/cjs/exporter/invalid-data-validation.d.ts +19 -0
- package/dist/cjs/exporter/invalid-data-validation.d.ts.map +1 -0
- package/dist/cjs/exporter/invalid-data-validation.js +39 -0
- package/dist/cjs/exporter/ods/ods-export.d.ts +26 -0
- package/dist/cjs/exporter/ods/ods-export.d.ts.map +1 -0
- package/dist/cjs/exporter/ods/ods-export.js +3714 -0
- package/dist/cjs/exporter/ods/sparkline-builder.d.ts +33 -0
- package/dist/cjs/exporter/ods/sparkline-builder.d.ts.map +1 -0
- package/dist/cjs/exporter/ods/sparkline-builder.js +221 -0
- package/dist/cjs/exporter/xlsx/chart-builder.d.ts +3 -0
- package/dist/cjs/exporter/xlsx/chart-builder.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/chart-builder.js +1901 -0
- package/dist/cjs/exporter/xlsx/chart-templates.d.ts +1781 -0
- package/dist/cjs/exporter/xlsx/chart-templates.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/chart-templates.js +1798 -0
- package/dist/cjs/exporter/xlsx/future-functions.d.ts +10 -0
- package/dist/cjs/exporter/xlsx/future-functions.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/future-functions.js +264 -0
- package/dist/cjs/exporter/xlsx/pivot-builder.d.ts +58 -0
- package/dist/cjs/exporter/xlsx/pivot-builder.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/pivot-builder.js +277 -0
- package/dist/cjs/exporter/xlsx/power-query-builder.d.ts +26 -0
- package/dist/cjs/exporter/xlsx/power-query-builder.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/power-query-builder.js +306 -0
- package/dist/cjs/exporter/xlsx/slicer-builder.d.ts +11 -0
- package/dist/cjs/exporter/xlsx/slicer-builder.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/slicer-builder.js +87 -0
- package/dist/cjs/exporter/xlsx/sparkline-builder.d.ts +61 -0
- package/dist/cjs/exporter/xlsx/sparkline-builder.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/sparkline-builder.js +489 -0
- package/dist/cjs/exporter/xlsx/style-builder.d.ts +93 -0
- package/dist/cjs/exporter/xlsx/style-builder.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/style-builder.js +813 -0
- package/dist/cjs/exporter/xlsx/threaded-comments-builder.d.ts +58 -0
- package/dist/cjs/exporter/xlsx/threaded-comments-builder.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/threaded-comments-builder.js +189 -0
- package/dist/cjs/exporter/xlsx/xlsx-export.d.ts +121 -0
- package/dist/cjs/exporter/xlsx/xlsx-export.d.ts.map +1 -0
- package/dist/cjs/exporter/xlsx/xlsx-export.js +4596 -0
- package/dist/cjs/helpers/theme-xml-generator.d.ts +8 -0
- package/dist/cjs/helpers/theme-xml-generator.d.ts.map +1 -0
- package/dist/cjs/helpers/theme-xml-generator.js +33 -0
- package/dist/cjs/helpers.d.ts +34 -0
- package/dist/cjs/helpers.d.ts.map +1 -0
- package/dist/cjs/helpers.js +189 -0
- package/dist/cjs/index.d.ts +16 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/indexed-colors.d.ts +2 -0
- package/dist/cjs/indexed-colors.d.ts.map +1 -0
- package/dist/cjs/indexed-colors.js +75 -0
- package/dist/cjs/ods-export.d.ts +24 -0
- package/dist/cjs/ods-export.d.ts.map +1 -0
- package/dist/cjs/ods-export.js +23 -0
- package/dist/cjs/parse.d.ts +24 -0
- package/dist/cjs/parse.d.ts.map +1 -0
- package/dist/cjs/parse.js +68 -0
- package/dist/cjs/power-query.d.ts +41 -0
- package/dist/cjs/power-query.d.ts.map +1 -0
- package/dist/cjs/power-query.js +22 -0
- package/dist/cjs/server.d.ts +9 -0
- package/dist/cjs/server.d.ts.map +1 -0
- package/dist/cjs/server.js +8 -0
- package/dist/cjs/theme1.d.ts +3 -0
- package/dist/cjs/theme1.d.ts.map +1 -0
- package/dist/cjs/theme1.js +2 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/cjs/types.d.ts +14 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +14 -0
- package/dist/cjs/vitest.config.d.ts +3 -0
- package/dist/cjs/vitest.config.d.ts.map +1 -0
- package/dist/cjs/vitest.config.js +16 -0
- package/dist/esm/autofilter-condition.d.ts +43 -0
- package/dist/esm/autofilter-condition.d.ts.map +1 -0
- package/dist/esm/autofilter-condition.js +145 -0
- package/dist/esm/csv-export.d.ts +49 -0
- package/dist/esm/csv-export.d.ts.map +1 -0
- package/dist/esm/csv-export.js +126 -0
- package/dist/esm/csv-import-worker.d.ts +16 -0
- package/dist/esm/csv-import-worker.d.ts.map +1 -0
- package/dist/esm/csv-import-worker.js +60 -0
- package/dist/esm/csv-import.d.ts +38 -0
- package/dist/esm/csv-import.d.ts.map +1 -0
- package/dist/esm/csv-import.js +132 -0
- package/dist/esm/csv-parser/helpers.d.ts +14 -0
- package/dist/esm/csv-parser/helpers.d.ts.map +1 -0
- package/dist/esm/csv-parser/helpers.js +0 -0
- package/dist/esm/csv-parser/types.d.ts +66 -0
- package/dist/esm/csv-parser/types.d.ts.map +1 -0
- package/dist/esm/csv-parser/types.js +14 -0
- package/dist/esm/csv-parser/worker.d.ts +2 -0
- package/dist/esm/csv-parser/worker.d.ts.map +1 -0
- package/dist/esm/csv-parser/worker.js +154 -0
- package/dist/esm/excel-export.d.ts +11 -0
- package/dist/esm/excel-export.d.ts.map +1 -0
- package/dist/esm/excel-export.js +13 -0
- package/dist/esm/excel-import-session.d.ts +51 -0
- package/dist/esm/excel-import-session.d.ts.map +1 -0
- package/dist/esm/excel-import-session.js +255 -0
- package/dist/esm/excel-import-worker.d.ts +7 -0
- package/dist/esm/excel-import-worker.d.ts.map +1 -0
- package/dist/esm/excel-import-worker.js +116 -0
- package/dist/esm/excel-parser/builtin-numfmts.d.ts +24 -0
- package/dist/esm/excel-parser/builtin-numfmts.d.ts.map +1 -0
- package/dist/esm/excel-parser/builtin-numfmts.js +59 -0
- package/dist/esm/excel-parser/cfb-decryptor.d.ts +53 -0
- package/dist/esm/excel-parser/cfb-decryptor.d.ts.map +1 -0
- package/dist/esm/excel-parser/cfb-decryptor.js +493 -0
- package/dist/esm/excel-parser/cfb-encryptor.d.ts +23 -0
- package/dist/esm/excel-parser/cfb-encryptor.d.ts.map +1 -0
- package/dist/esm/excel-parser/cfb-encryptor.js +181 -0
- package/dist/esm/excel-parser/dv-cell-stamp.d.ts +29 -0
- package/dist/esm/excel-parser/dv-cell-stamp.d.ts.map +1 -0
- package/dist/esm/excel-parser/dv-cell-stamp.js +155 -0
- package/dist/esm/excel-parser/helpers.d.ts +28 -0
- package/dist/esm/excel-parser/helpers.d.ts.map +1 -0
- package/dist/esm/excel-parser/helpers.js +160 -0
- package/dist/esm/excel-parser/interface.d.ts +179 -0
- package/dist/esm/excel-parser/interface.d.ts.map +1 -0
- package/dist/esm/excel-parser/interface.js +1 -0
- package/dist/esm/excel-parser/plugins/base/index.d.ts +31 -0
- package/dist/esm/excel-parser/plugins/base/index.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/base/index.js +64 -0
- package/dist/esm/excel-parser/plugins/ods/conditional-formatting.d.ts +16 -0
- package/dist/esm/excel-parser/plugins/ods/conditional-formatting.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/ods/conditional-formatting.js +405 -0
- package/dist/esm/excel-parser/plugins/ods/data-validations.d.ts +15 -0
- package/dist/esm/excel-parser/plugins/ods/data-validations.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/ods/data-validations.js +331 -0
- package/dist/esm/excel-parser/plugins/ods/formula.d.ts +8 -0
- package/dist/esm/excel-parser/plugins/ods/formula.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/ods/formula.js +82 -0
- package/dist/esm/excel-parser/plugins/ods/index.d.ts +122 -0
- package/dist/esm/excel-parser/plugins/ods/index.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/ods/index.js +2896 -0
- package/dist/esm/excel-parser/plugins/ods/sparklines.d.ts +25 -0
- package/dist/esm/excel-parser/plugins/ods/sparklines.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/ods/sparklines.js +188 -0
- package/dist/esm/excel-parser/plugins/ods/styles.d.ts +60 -0
- package/dist/esm/excel-parser/plugins/ods/styles.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/ods/styles.js +732 -0
- package/dist/esm/excel-parser/plugins/ods/types.d.ts +7 -0
- package/dist/esm/excel-parser/plugins/ods/types.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/ods/types.js +1 -0
- package/dist/esm/excel-parser/plugins/xls/index.d.ts +5 -0
- package/dist/esm/excel-parser/plugins/xls/index.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xls/index.js +7 -0
- package/dist/esm/excel-parser/plugins/xlsb/biff-record-reader.d.ts +13 -0
- package/dist/esm/excel-parser/plugins/xlsb/biff-record-reader.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsb/biff-record-reader.js +48 -0
- package/dist/esm/excel-parser/plugins/xlsb/index.d.ts +117 -0
- package/dist/esm/excel-parser/plugins/xlsb/index.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsb/index.js +2339 -0
- package/dist/esm/excel-parser/plugins/xlsb/rgce-parser.d.ts +18 -0
- package/dist/esm/excel-parser/plugins/xlsb/rgce-parser.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsb/rgce-parser.js +522 -0
- package/dist/esm/excel-parser/plugins/xlsm/index.d.ts +5 -0
- package/dist/esm/excel-parser/plugins/xlsm/index.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsm/index.js +6 -0
- package/dist/esm/excel-parser/plugins/xlsx/charts.d.ts +60 -0
- package/dist/esm/excel-parser/plugins/xlsx/charts.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/charts.js +2036 -0
- package/dist/esm/excel-parser/plugins/xlsx/conditional-formatting.d.ts +18 -0
- package/dist/esm/excel-parser/plugins/xlsx/conditional-formatting.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/conditional-formatting.js +621 -0
- package/dist/esm/excel-parser/plugins/xlsx/data-validations.d.ts +4 -0
- package/dist/esm/excel-parser/plugins/xlsx/data-validations.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/data-validations.js +493 -0
- package/dist/esm/excel-parser/plugins/xlsx/drawing.d.ts +39 -0
- package/dist/esm/excel-parser/plugins/xlsx/drawing.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/drawing.js +905 -0
- package/dist/esm/excel-parser/plugins/xlsx/index.d.ts +320 -0
- package/dist/esm/excel-parser/plugins/xlsx/index.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/index.js +4654 -0
- package/dist/esm/excel-parser/plugins/xlsx/numfmt.d.ts +2 -0
- package/dist/esm/excel-parser/plugins/xlsx/numfmt.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/numfmt.js +3 -0
- package/dist/esm/excel-parser/plugins/xlsx/pivots.d.ts +40 -0
- package/dist/esm/excel-parser/plugins/xlsx/pivots.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/pivots.js +254 -0
- package/dist/esm/excel-parser/plugins/xlsx/relationships.d.ts +8 -0
- package/dist/esm/excel-parser/plugins/xlsx/relationships.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/relationships.js +13 -0
- package/dist/esm/excel-parser/plugins/xlsx/sheet-views.d.ts +26 -0
- package/dist/esm/excel-parser/plugins/xlsx/sheet-views.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/sheet-views.js +64 -0
- package/dist/esm/excel-parser/plugins/xlsx/styles.d.ts +44 -0
- package/dist/esm/excel-parser/plugins/xlsx/styles.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/styles.js +1365 -0
- package/dist/esm/excel-parser/plugins/xlsx/theme.d.ts +50 -0
- package/dist/esm/excel-parser/plugins/xlsx/theme.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/theme.js +127 -0
- package/dist/esm/excel-parser/plugins/xlsx/threaded-comments.d.ts +47 -0
- package/dist/esm/excel-parser/plugins/xlsx/threaded-comments.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/threaded-comments.js +103 -0
- package/dist/esm/excel-parser/plugins/xlsx/value-type-detection.d.ts +44 -0
- package/dist/esm/excel-parser/plugins/xlsx/value-type-detection.d.ts.map +1 -0
- package/dist/esm/excel-parser/plugins/xlsx/value-type-detection.js +399 -0
- package/dist/esm/excel-parser/registry.d.ts +5 -0
- package/dist/esm/excel-parser/registry.d.ts.map +1 -0
- package/dist/esm/excel-parser/registry.js +20 -0
- package/dist/esm/excel-parser/style-registry.d.ts +51 -0
- package/dist/esm/excel-parser/style-registry.d.ts.map +1 -0
- package/dist/esm/excel-parser/style-registry.js +163 -0
- package/dist/esm/excel-parser/theme-default.d.ts +3 -0
- package/dist/esm/excel-parser/theme-default.d.ts.map +1 -0
- package/dist/esm/excel-parser/theme-default.js +19 -0
- package/dist/esm/excel-parser/types.d.ts +365 -0
- package/dist/esm/excel-parser/types.d.ts.map +1 -0
- package/dist/esm/excel-parser/types.js +59 -0
- package/dist/esm/excel-parser/utils.d.ts +6 -0
- package/dist/esm/excel-parser/utils.d.ts.map +1 -0
- package/dist/esm/excel-parser/utils.js +25 -0
- package/dist/esm/excel-parser/workbook.d.ts +51 -0
- package/dist/esm/excel-parser/workbook.d.ts.map +1 -0
- package/dist/esm/excel-parser/workbook.js +192 -0
- package/dist/esm/excel-parser/worker.d.ts +2 -0
- package/dist/esm/excel-parser/worker.d.ts.map +1 -0
- package/dist/esm/excel-parser/worker.js +862 -0
- package/dist/esm/excel-parser/zip-parser-streaming.d.ts +13 -0
- package/dist/esm/excel-parser/zip-parser-streaming.d.ts.map +1 -0
- package/dist/esm/excel-parser/zip-parser-streaming.js +119 -0
- package/dist/esm/excel-parser/zip-parser.d.ts +11 -0
- package/dist/esm/excel-parser/zip-parser.d.ts.map +1 -0
- package/dist/esm/excel-parser/zip-parser.js +43 -0
- package/dist/esm/exporter/invalid-data-validation.d.ts +19 -0
- package/dist/esm/exporter/invalid-data-validation.d.ts.map +1 -0
- package/dist/esm/exporter/invalid-data-validation.js +37 -0
- package/dist/esm/exporter/ods/ods-export.d.ts +26 -0
- package/dist/esm/exporter/ods/ods-export.d.ts.map +1 -0
- package/dist/esm/exporter/ods/ods-export.js +3238 -0
- package/dist/esm/exporter/ods/sparkline-builder.d.ts +33 -0
- package/dist/esm/exporter/ods/sparkline-builder.d.ts.map +1 -0
- package/dist/esm/exporter/ods/sparkline-builder.js +165 -0
- package/dist/esm/exporter/xlsx/chart-builder.d.ts +3 -0
- package/dist/esm/exporter/xlsx/chart-builder.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/chart-builder.js +1805 -0
- package/dist/esm/exporter/xlsx/chart-templates.d.ts +1781 -0
- package/dist/esm/exporter/xlsx/chart-templates.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/chart-templates.js +1798 -0
- package/dist/esm/exporter/xlsx/future-functions.d.ts +10 -0
- package/dist/esm/exporter/xlsx/future-functions.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/future-functions.js +264 -0
- package/dist/esm/exporter/xlsx/pivot-builder.d.ts +58 -0
- package/dist/esm/exporter/xlsx/pivot-builder.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/pivot-builder.js +230 -0
- package/dist/esm/exporter/xlsx/power-query-builder.d.ts +26 -0
- package/dist/esm/exporter/xlsx/power-query-builder.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/power-query-builder.js +257 -0
- package/dist/esm/exporter/xlsx/slicer-builder.d.ts +11 -0
- package/dist/esm/exporter/xlsx/slicer-builder.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/slicer-builder.js +84 -0
- package/dist/esm/exporter/xlsx/sparkline-builder.d.ts +61 -0
- package/dist/esm/exporter/xlsx/sparkline-builder.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/sparkline-builder.js +437 -0
- package/dist/esm/exporter/xlsx/style-builder.d.ts +93 -0
- package/dist/esm/exporter/xlsx/style-builder.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/style-builder.js +795 -0
- package/dist/esm/exporter/xlsx/threaded-comments-builder.d.ts +58 -0
- package/dist/esm/exporter/xlsx/threaded-comments-builder.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/threaded-comments-builder.js +175 -0
- package/dist/esm/exporter/xlsx/xlsx-export.d.ts +121 -0
- package/dist/esm/exporter/xlsx/xlsx-export.d.ts.map +1 -0
- package/dist/esm/exporter/xlsx/xlsx-export.js +4062 -0
- package/dist/esm/helpers/theme-xml-generator.d.ts +8 -0
- package/dist/esm/helpers/theme-xml-generator.d.ts.map +1 -0
- package/dist/esm/helpers/theme-xml-generator.js +33 -0
- package/dist/esm/helpers.d.ts +34 -0
- package/dist/esm/helpers.d.ts.map +1 -0
- package/dist/esm/helpers.js +182 -0
- package/dist/esm/index.d.ts +16 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/indexed-colors.d.ts +2 -0
- package/dist/esm/indexed-colors.d.ts.map +1 -0
- package/dist/esm/indexed-colors.js +75 -0
- package/dist/esm/ods-export.d.ts +24 -0
- package/dist/esm/ods-export.d.ts.map +1 -0
- package/dist/esm/ods-export.js +12 -0
- package/dist/esm/parse.d.ts +24 -0
- package/dist/esm/parse.d.ts.map +1 -0
- package/dist/esm/parse.js +55 -0
- package/dist/esm/power-query.d.ts +41 -0
- package/dist/esm/power-query.d.ts.map +1 -0
- package/dist/esm/power-query.js +19 -0
- package/dist/esm/server.d.ts +9 -0
- package/dist/esm/server.d.ts.map +1 -0
- package/dist/esm/server.js +8 -0
- package/dist/esm/theme1.d.ts +3 -0
- package/dist/esm/theme1.d.ts.map +1 -0
- package/dist/esm/theme1.js +2 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/esm/types.d.ts +14 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +14 -0
- package/dist/esm/vitest.config.d.ts +3 -0
- package/dist/esm/vitest.config.d.ts.map +1 -0
- package/dist/esm/vitest.config.js +16 -0
- package/package.json +62 -0
- package/xlsx.d.ts +52 -0
|
@@ -0,0 +1,732 @@
|
|
|
1
|
+
import { get } from "lodash-es";
|
|
2
|
+
export class OdsStyles {
|
|
3
|
+
cellStyles = new Map();
|
|
4
|
+
automaticCellStyles = new Map();
|
|
5
|
+
rowStyles = new Map();
|
|
6
|
+
automaticRowStyles = new Map();
|
|
7
|
+
columnStyles = new Map();
|
|
8
|
+
automaticColumnStyles = new Map();
|
|
9
|
+
textStyles = new Map();
|
|
10
|
+
automaticTextStyles = new Map();
|
|
11
|
+
tableStyles = new Map();
|
|
12
|
+
automaticTableStyles = new Map();
|
|
13
|
+
numberFormats = new Map();
|
|
14
|
+
chartStyles = new Map();
|
|
15
|
+
constructor() { }
|
|
16
|
+
reset() {
|
|
17
|
+
this.cellStyles.clear();
|
|
18
|
+
this.automaticCellStyles.clear();
|
|
19
|
+
this.rowStyles.clear();
|
|
20
|
+
this.automaticRowStyles.clear();
|
|
21
|
+
this.columnStyles.clear();
|
|
22
|
+
this.automaticColumnStyles.clear();
|
|
23
|
+
this.textStyles.clear();
|
|
24
|
+
this.automaticTextStyles.clear();
|
|
25
|
+
this.tableStyles.clear();
|
|
26
|
+
this.automaticTableStyles.clear();
|
|
27
|
+
this.numberFormats.clear();
|
|
28
|
+
this.chartStyles.clear();
|
|
29
|
+
}
|
|
30
|
+
parseStylesXml(stylesXml) {
|
|
31
|
+
if (!stylesXml)
|
|
32
|
+
return;
|
|
33
|
+
const documentStyles = get(stylesXml, "office:document-styles") ||
|
|
34
|
+
get(stylesXml, "document-styles");
|
|
35
|
+
if (!documentStyles)
|
|
36
|
+
return;
|
|
37
|
+
const namedStyles = get(documentStyles, "office:styles.style:style") ||
|
|
38
|
+
get(documentStyles, "styles.style:style");
|
|
39
|
+
this.processStyles(namedStyles, false);
|
|
40
|
+
const automaticStyles = get(documentStyles, "office:automatic-styles.style:style") ||
|
|
41
|
+
get(documentStyles, "automatic-styles.style:style");
|
|
42
|
+
this.processStyles(automaticStyles, false);
|
|
43
|
+
this.processNumberStyles(documentStyles, get(documentStyles, "office:styles") || get(documentStyles, "styles"), get(documentStyles, "office:automatic-styles") ||
|
|
44
|
+
get(documentStyles, "automatic-styles"));
|
|
45
|
+
}
|
|
46
|
+
parseContentXml(contentXml) {
|
|
47
|
+
if (!contentXml)
|
|
48
|
+
return;
|
|
49
|
+
const autoStyles = get(contentXml, "office:document-content.office:automatic-styles.style:style") || get(contentXml, "document-content.automatic-styles.style");
|
|
50
|
+
this.processStyles(autoStyles, true);
|
|
51
|
+
const autoStylesContainer = get(contentXml, "office:document-content.office:automatic-styles") ||
|
|
52
|
+
get(contentXml, "document-content.automatic-styles");
|
|
53
|
+
this.processNumberStyles(contentXml, autoStylesContainer);
|
|
54
|
+
}
|
|
55
|
+
processStyles(styles, isAutomatic) {
|
|
56
|
+
if (!styles)
|
|
57
|
+
return;
|
|
58
|
+
const styleArray = Array.isArray(styles) ? styles : [styles];
|
|
59
|
+
for (const style of styleArray) {
|
|
60
|
+
const name = style["@_style:name"] || style["@_name"];
|
|
61
|
+
if (!name)
|
|
62
|
+
continue;
|
|
63
|
+
const family = style["@_style:family"] || style["@_family"];
|
|
64
|
+
if (family === "table-row") {
|
|
65
|
+
const props = this.convertRowStyle(style);
|
|
66
|
+
if (props) {
|
|
67
|
+
(isAutomatic ? this.automaticRowStyles : this.rowStyles).set(name, props);
|
|
68
|
+
}
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (family === "table-column") {
|
|
72
|
+
const props = this.convertColumnStyle(style);
|
|
73
|
+
if (props) {
|
|
74
|
+
(isAutomatic ? this.automaticColumnStyles : this.columnStyles).set(name, props);
|
|
75
|
+
}
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (family === "table") {
|
|
79
|
+
const format = this.normalizeCellFormat(this.convertToCellFormat(style));
|
|
80
|
+
if (format) {
|
|
81
|
+
(isAutomatic ? this.automaticTableStyles : this.tableStyles).set(name, format);
|
|
82
|
+
}
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (family === "text") {
|
|
86
|
+
const format = this.normalizeCellFormat(this.convertToCellFormat(style));
|
|
87
|
+
(isAutomatic ? this.automaticTextStyles : this.textStyles).set(name, format);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (family === "table-cell") {
|
|
91
|
+
const displayName = style["@_style:display-name"] || style["@_display-name"];
|
|
92
|
+
const key = displayName || name;
|
|
93
|
+
if (!key) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const targetMap = isAutomatic
|
|
97
|
+
? this.automaticCellStyles
|
|
98
|
+
: this.cellStyles;
|
|
99
|
+
targetMap.set(key, style);
|
|
100
|
+
if (displayName && name && name !== key && !targetMap.has(name)) {
|
|
101
|
+
targetMap.set(name, style);
|
|
102
|
+
}
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (typeof family === "string" &&
|
|
106
|
+
(family.startsWith("chart") || family === "graphic")) {
|
|
107
|
+
const color = this.convertChartStyle(style);
|
|
108
|
+
if (color) {
|
|
109
|
+
const displayName = style["@_style:display-name"] || style["@_display-name"];
|
|
110
|
+
const key = displayName || name;
|
|
111
|
+
if (key) {
|
|
112
|
+
this.chartStyles.set(key, color);
|
|
113
|
+
if (displayName && name && name !== key) {
|
|
114
|
+
this.chartStyles.set(name, color);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
processNumberStyles(...containers) {
|
|
123
|
+
const definitions = [
|
|
124
|
+
{ key: "number:number-style", kind: "number" },
|
|
125
|
+
{ key: "number:currency-style", kind: "currency" },
|
|
126
|
+
{ key: "number:percentage-style", kind: "percentage" },
|
|
127
|
+
{ key: "number:date-style", kind: "date" },
|
|
128
|
+
{ key: "number:time-style", kind: "time" },
|
|
129
|
+
{ key: "number:date-time-style", kind: "date-time" },
|
|
130
|
+
{ key: "number:scientific-number-style", kind: "scientific" },
|
|
131
|
+
];
|
|
132
|
+
for (const container of containers) {
|
|
133
|
+
if (!container)
|
|
134
|
+
continue;
|
|
135
|
+
for (const { key, kind } of definitions) {
|
|
136
|
+
const nodes = (container && container[key]) ??
|
|
137
|
+
get(container, key) ??
|
|
138
|
+
get(container, key.replace("number:", ""));
|
|
139
|
+
this.processNumberStyleNodes(nodes, kind);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
processNumberStyleNodes(nodes, kind) {
|
|
144
|
+
if (!nodes)
|
|
145
|
+
return;
|
|
146
|
+
const arr = Array.isArray(nodes) ? nodes : [nodes];
|
|
147
|
+
for (const node of arr) {
|
|
148
|
+
if (!node)
|
|
149
|
+
continue;
|
|
150
|
+
const name = node["@_style:name"] || node["@_name"];
|
|
151
|
+
if (!name)
|
|
152
|
+
continue;
|
|
153
|
+
const numberFormat = this.convertNumberStyleNode(node, kind);
|
|
154
|
+
if (numberFormat) {
|
|
155
|
+
this.numberFormats.set(name, numberFormat);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
getStyle(styleName) {
|
|
160
|
+
const style = this.automaticCellStyles.get(styleName) || this.cellStyles.get(styleName);
|
|
161
|
+
if (!style)
|
|
162
|
+
return undefined;
|
|
163
|
+
return this.convertToCellFormat(style);
|
|
164
|
+
}
|
|
165
|
+
getRowStyle(styleName) {
|
|
166
|
+
return (this.automaticRowStyles.get(styleName) || this.rowStyles.get(styleName));
|
|
167
|
+
}
|
|
168
|
+
getColumnStyle(styleName) {
|
|
169
|
+
return (this.automaticColumnStyles.get(styleName) ||
|
|
170
|
+
this.columnStyles.get(styleName));
|
|
171
|
+
}
|
|
172
|
+
getChartStyleColor(styleName) {
|
|
173
|
+
if (!styleName)
|
|
174
|
+
return undefined;
|
|
175
|
+
return this.chartStyles.get(styleName);
|
|
176
|
+
}
|
|
177
|
+
getTableCellFormat(styleName) {
|
|
178
|
+
return (this.automaticTableStyles.get(styleName) ||
|
|
179
|
+
this.tableStyles.get(styleName));
|
|
180
|
+
}
|
|
181
|
+
getTextFormat(styleName) {
|
|
182
|
+
if (!styleName)
|
|
183
|
+
return undefined;
|
|
184
|
+
const format = this.automaticTextStyles.get(styleName) || this.textStyles.get(styleName);
|
|
185
|
+
return format?.textFormat ?? undefined;
|
|
186
|
+
}
|
|
187
|
+
convertToCellFormat(style) {
|
|
188
|
+
const cellFormat = {};
|
|
189
|
+
const textPropsNode = style["style:text-properties"] || style["text-properties"];
|
|
190
|
+
const textProps = this.getAttributes(textPropsNode);
|
|
191
|
+
if (textProps) {
|
|
192
|
+
const textFormat = {};
|
|
193
|
+
const fontWeight = textProps["@_fo:font-weight"] || textProps["@_font-weight"];
|
|
194
|
+
if (fontWeight) {
|
|
195
|
+
const weight = parseInt(fontWeight, 10);
|
|
196
|
+
if (fontWeight === "bold" || (!isNaN(weight) && weight >= 700)) {
|
|
197
|
+
textFormat.bold = true;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const fontStyle = textProps["@_fo:font-style"] || textProps["@_font-style"];
|
|
201
|
+
if (fontStyle === "italic") {
|
|
202
|
+
textFormat.italic = true;
|
|
203
|
+
}
|
|
204
|
+
const underline = textProps["@_style:text-underline-style"] ||
|
|
205
|
+
textProps["@_text-underline-style"];
|
|
206
|
+
if (underline && underline !== "none") {
|
|
207
|
+
textFormat.underline = true;
|
|
208
|
+
}
|
|
209
|
+
const color = textProps["@_fo:color"] || textProps["@_color"];
|
|
210
|
+
if (color) {
|
|
211
|
+
textFormat.color = this.parseColor(color);
|
|
212
|
+
}
|
|
213
|
+
const strike = textProps["@_style:text-line-through-style"] ||
|
|
214
|
+
textProps["@_text-line-through-style"];
|
|
215
|
+
if (strike && strike !== "none") {
|
|
216
|
+
textFormat.strikethrough = true;
|
|
217
|
+
}
|
|
218
|
+
const fontSize = textProps["@_fo:font-size"] || textProps["@_font-size"];
|
|
219
|
+
if (fontSize) {
|
|
220
|
+
textFormat.fontSize = parseFloat(fontSize);
|
|
221
|
+
}
|
|
222
|
+
const fontFamily = textProps["@_style:font-name"] ||
|
|
223
|
+
textProps["@_style:font-name-asian"] ||
|
|
224
|
+
textProps["@_font-name"];
|
|
225
|
+
if (fontFamily) {
|
|
226
|
+
textFormat.fontFamily = fontFamily;
|
|
227
|
+
}
|
|
228
|
+
// ODS encodes super/subscript as `style:text-position="super 58%"` or
|
|
229
|
+
// `style:text-position="sub 58%"`. We only model the kind, not the
|
|
230
|
+
// percentage — the renderer applies a fixed 58% scale.
|
|
231
|
+
const textPosition = textProps["@_style:text-position"] || textProps["@_text-position"];
|
|
232
|
+
if (textPosition) {
|
|
233
|
+
const token = String(textPosition).trim().split(/\s+/)[0]?.toLowerCase();
|
|
234
|
+
if (token === "super") {
|
|
235
|
+
textFormat.baselineOffset = "superscript";
|
|
236
|
+
}
|
|
237
|
+
else if (token === "sub") {
|
|
238
|
+
textFormat.baselineOffset = "subscript";
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (Object.keys(textFormat).length > 0) {
|
|
242
|
+
cellFormat.textFormat = textFormat;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const cellPropsNode = style["style:table-cell-properties"] || style["table-cell-properties"];
|
|
246
|
+
const cellProps = this.getAttributes(cellPropsNode);
|
|
247
|
+
if (cellProps) {
|
|
248
|
+
const bgColor = cellProps["@_fo:background-color"] ||
|
|
249
|
+
cellProps["@_background-color"] ||
|
|
250
|
+
cellProps["@_draw:fill-color"];
|
|
251
|
+
if (bgColor && bgColor !== "transparent") {
|
|
252
|
+
cellFormat.backgroundColor = this.parseColor(bgColor);
|
|
253
|
+
}
|
|
254
|
+
const borderValue = cellProps["@_fo:border"] || cellProps["@_border"];
|
|
255
|
+
if (borderValue && borderValue !== "none") {
|
|
256
|
+
const borders = this.createBorders(borderValue);
|
|
257
|
+
if (borders) {
|
|
258
|
+
cellFormat.borders = borders;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const sideMap = [
|
|
262
|
+
{
|
|
263
|
+
key: "top",
|
|
264
|
+
value: cellProps["@_fo:border-top"] ||
|
|
265
|
+
cellProps["@_border-top"] ||
|
|
266
|
+
cellProps["@_style:border-top"],
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
key: "bottom",
|
|
270
|
+
value: cellProps["@_fo:border-bottom"] ||
|
|
271
|
+
cellProps["@_border-bottom"] ||
|
|
272
|
+
cellProps["@_style:border-bottom"],
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
key: "left",
|
|
276
|
+
value: cellProps["@_fo:border-left"] ||
|
|
277
|
+
cellProps["@_border-left"] ||
|
|
278
|
+
cellProps["@_style:border-left"],
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
key: "right",
|
|
282
|
+
value: cellProps["@_fo:border-right"] ||
|
|
283
|
+
cellProps["@_border-right"] ||
|
|
284
|
+
cellProps["@_style:border-right"],
|
|
285
|
+
},
|
|
286
|
+
];
|
|
287
|
+
for (const { key, value } of sideMap) {
|
|
288
|
+
if (!value || value === "none")
|
|
289
|
+
continue;
|
|
290
|
+
const parsedBorder = this.parseBorder(value);
|
|
291
|
+
if (!parsedBorder)
|
|
292
|
+
continue;
|
|
293
|
+
if (!cellFormat.borders) {
|
|
294
|
+
cellFormat.borders = {};
|
|
295
|
+
}
|
|
296
|
+
cellFormat.borders[key] = parsedBorder;
|
|
297
|
+
}
|
|
298
|
+
// ODS diagonals: `style:diagonal-bl-tr` = bottom-left → top-right
|
|
299
|
+
// (= our diagonalUp). `style:diagonal-tl-br` = top-left → bottom-right
|
|
300
|
+
// (= our diagonalDown).
|
|
301
|
+
const diagonalMap = [
|
|
302
|
+
{
|
|
303
|
+
key: "diagonalUp",
|
|
304
|
+
value: cellProps["@_style:diagonal-bl-tr"] ||
|
|
305
|
+
cellProps["@_diagonal-bl-tr"],
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
key: "diagonalDown",
|
|
309
|
+
value: cellProps["@_style:diagonal-tl-br"] ||
|
|
310
|
+
cellProps["@_diagonal-tl-br"],
|
|
311
|
+
},
|
|
312
|
+
];
|
|
313
|
+
for (const { key, value } of diagonalMap) {
|
|
314
|
+
if (!value || value === "none")
|
|
315
|
+
continue;
|
|
316
|
+
const parsedBorder = this.parseBorder(value);
|
|
317
|
+
if (!parsedBorder)
|
|
318
|
+
continue;
|
|
319
|
+
if (!cellFormat.borders) {
|
|
320
|
+
cellFormat.borders = {};
|
|
321
|
+
}
|
|
322
|
+
cellFormat.borders[key] = parsedBorder;
|
|
323
|
+
}
|
|
324
|
+
const verticalAlign = cellProps["@_style:vertical-align"] ||
|
|
325
|
+
cellProps["@_vertical-align"] ||
|
|
326
|
+
cellProps["@_fo:vertical-align"];
|
|
327
|
+
if (verticalAlign) {
|
|
328
|
+
cellFormat.verticalAlignment =
|
|
329
|
+
verticalAlign === "middle"
|
|
330
|
+
? "middle"
|
|
331
|
+
: verticalAlign === "bottom"
|
|
332
|
+
? "bottom"
|
|
333
|
+
: "top";
|
|
334
|
+
}
|
|
335
|
+
const cellTextAlign = cellProps["@_style:text-align"] ||
|
|
336
|
+
cellProps["@_text-align"] ||
|
|
337
|
+
cellProps["@_fo:text-align"];
|
|
338
|
+
const cellTextAlignSource = cellProps["@_style:text-align-source"] ||
|
|
339
|
+
cellProps["@_text-align-source"];
|
|
340
|
+
if (cellTextAlign) {
|
|
341
|
+
cellFormat.horizontalAlignment =
|
|
342
|
+
cellTextAlign === "center"
|
|
343
|
+
? "center"
|
|
344
|
+
: cellTextAlign === "end" || cellTextAlign === "right"
|
|
345
|
+
? "right"
|
|
346
|
+
: "left";
|
|
347
|
+
}
|
|
348
|
+
else if (!cellFormat.horizontalAlignment &&
|
|
349
|
+
cellTextAlignSource === "value-type") {
|
|
350
|
+
cellFormat.__alignValueType = true;
|
|
351
|
+
}
|
|
352
|
+
const wrapOption = cellProps["@_fo:wrap-option"] || cellProps["@_wrap-option"];
|
|
353
|
+
if (wrapOption === "wrap") {
|
|
354
|
+
cellFormat.wrapStrategy = "wrap";
|
|
355
|
+
}
|
|
356
|
+
const rotationAngle = cellProps["@_style:rotation-angle"] || cellProps["@_rotation-angle"];
|
|
357
|
+
if (rotationAngle !== undefined) {
|
|
358
|
+
const rotation = parseFloat(rotationAngle);
|
|
359
|
+
if (!isNaN(rotation)) {
|
|
360
|
+
cellFormat.textRotation = rotation;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
const paraPropsNode = style["style:paragraph-properties"] || style["paragraph-properties"];
|
|
365
|
+
const paraProps = this.getAttributes(paraPropsNode);
|
|
366
|
+
if (paraProps) {
|
|
367
|
+
const textAlign = paraProps["@_fo:text-align"] ||
|
|
368
|
+
paraProps["@_text-align"] ||
|
|
369
|
+
paraProps["@_style:text-align"];
|
|
370
|
+
const textAlignSource = paraProps["@_style:text-align-source"] ||
|
|
371
|
+
paraProps["@_text-align-source"];
|
|
372
|
+
if (textAlign) {
|
|
373
|
+
cellFormat.horizontalAlignment =
|
|
374
|
+
textAlign === "center"
|
|
375
|
+
? "center"
|
|
376
|
+
: textAlign === "end" || textAlign === "right"
|
|
377
|
+
? "right"
|
|
378
|
+
: "left";
|
|
379
|
+
}
|
|
380
|
+
else if (textAlignSource === "value-type") {
|
|
381
|
+
cellFormat.__alignValueType = true;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
const dataStyleName = style["@_style:data-style-name"] || style["@_data-style-name"];
|
|
385
|
+
if (dataStyleName) {
|
|
386
|
+
const numberFormat = this.numberFormats.get(dataStyleName);
|
|
387
|
+
if (numberFormat) {
|
|
388
|
+
cellFormat.numberFormat = { ...numberFormat };
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return cellFormat;
|
|
392
|
+
}
|
|
393
|
+
normalizeCellFormat(format) {
|
|
394
|
+
return Object.keys(format).length ? format : undefined;
|
|
395
|
+
}
|
|
396
|
+
convertRowStyle(style) {
|
|
397
|
+
const rowPropsNode = style["style:table-row-properties"] || style["table-row-properties"];
|
|
398
|
+
const rowProps = this.getAttributes(rowPropsNode);
|
|
399
|
+
const heightValue = rowProps
|
|
400
|
+
? rowProps["@_style:row-height"] ||
|
|
401
|
+
rowProps["@_style:min-row-height"] ||
|
|
402
|
+
rowProps["@_fo:min-height"] ||
|
|
403
|
+
rowProps["@_row-height"]
|
|
404
|
+
: undefined;
|
|
405
|
+
const visibility = rowProps
|
|
406
|
+
? rowProps["@_style:visibility"] ||
|
|
407
|
+
rowProps["@_visibility"] ||
|
|
408
|
+
rowProps["@_fo:visibility"]
|
|
409
|
+
: undefined;
|
|
410
|
+
const height = this.convertLengthToPixels(heightValue);
|
|
411
|
+
const hidden = visibility === "collapse" ||
|
|
412
|
+
visibility === "hidden" ||
|
|
413
|
+
visibility === "none";
|
|
414
|
+
const format = this.normalizeCellFormat(this.convertToCellFormat(style));
|
|
415
|
+
if (height === undefined && !hidden && !format) {
|
|
416
|
+
return undefined;
|
|
417
|
+
}
|
|
418
|
+
return {
|
|
419
|
+
height,
|
|
420
|
+
hidden,
|
|
421
|
+
format,
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
convertColumnStyle(style) {
|
|
425
|
+
const columnPropsNode = style["style:table-column-properties"] ||
|
|
426
|
+
style["table-column-properties"];
|
|
427
|
+
const columnProps = this.getAttributes(columnPropsNode);
|
|
428
|
+
const widthValue = columnProps
|
|
429
|
+
? columnProps["@_style:column-width"] ||
|
|
430
|
+
columnProps["@_column-width"] ||
|
|
431
|
+
columnProps["@_fo:width"]
|
|
432
|
+
: undefined;
|
|
433
|
+
const visibility = columnProps
|
|
434
|
+
? columnProps["@_style:visibility"] ||
|
|
435
|
+
columnProps["@_visibility"] ||
|
|
436
|
+
columnProps["@_fo:visibility"]
|
|
437
|
+
: undefined;
|
|
438
|
+
const width = this.convertLengthToPixels(widthValue);
|
|
439
|
+
const hidden = visibility === "collapse" ||
|
|
440
|
+
visibility === "hidden" ||
|
|
441
|
+
visibility === "none";
|
|
442
|
+
const format = this.normalizeCellFormat(this.convertToCellFormat(style));
|
|
443
|
+
if (width === undefined && !hidden && !format) {
|
|
444
|
+
return undefined;
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
width,
|
|
448
|
+
hidden,
|
|
449
|
+
format,
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
convertChartStyle(style) {
|
|
453
|
+
const graphicProps = style["style:graphic-properties"] || style["graphic-properties"];
|
|
454
|
+
const chartProps = style["style:chart-properties"] || style["chart:chart-properties"];
|
|
455
|
+
const dataPointProps = style["chart:data-point-properties"] || style["data-point-properties"];
|
|
456
|
+
return (this.extractChartColor(graphicProps) ||
|
|
457
|
+
this.extractChartColor(chartProps) ||
|
|
458
|
+
this.extractChartColor(dataPointProps));
|
|
459
|
+
}
|
|
460
|
+
extractChartColor(node) {
|
|
461
|
+
const attrs = this.getNodeAttributes(node);
|
|
462
|
+
if (!attrs)
|
|
463
|
+
return undefined;
|
|
464
|
+
const rawValue = attrs["@_draw:fill-color"] ||
|
|
465
|
+
attrs["@_svg:fill-color"] ||
|
|
466
|
+
attrs["@_chart:color"] ||
|
|
467
|
+
attrs["@_fo:background-color"] ||
|
|
468
|
+
attrs["@_style:background-color"] ||
|
|
469
|
+
attrs["@_loext:fill-color"];
|
|
470
|
+
if (!rawValue || typeof rawValue !== "string") {
|
|
471
|
+
return undefined;
|
|
472
|
+
}
|
|
473
|
+
const normalized = rawValue.trim().toLowerCase();
|
|
474
|
+
if (!normalized || normalized === "none" || normalized === "transparent") {
|
|
475
|
+
return undefined;
|
|
476
|
+
}
|
|
477
|
+
return this.parseColor(rawValue);
|
|
478
|
+
}
|
|
479
|
+
convertNumberStyleNode(node, kind) {
|
|
480
|
+
switch (kind) {
|
|
481
|
+
case "number": {
|
|
482
|
+
return {
|
|
483
|
+
type: "NUMBER",
|
|
484
|
+
pattern: this.buildNumberPattern(node),
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
case "currency": {
|
|
488
|
+
const symbolNode = this.first(this.toArray(node["number:currency-symbol"]));
|
|
489
|
+
const symbol = this.extractText(symbolNode) || "¤";
|
|
490
|
+
const position = symbolNode?.["@_number:position"] ||
|
|
491
|
+
symbolNode?.["@_style:position"] ||
|
|
492
|
+
symbolNode?.["@_position"];
|
|
493
|
+
const usePrefix = position !== "after";
|
|
494
|
+
const pattern = this.buildNumberPattern(node, {
|
|
495
|
+
prefix: usePrefix ? `${symbol} ` : undefined,
|
|
496
|
+
suffix: !usePrefix ? ` ${symbol}` : undefined,
|
|
497
|
+
defaultFractionDigits: 2,
|
|
498
|
+
});
|
|
499
|
+
return {
|
|
500
|
+
type: "CURRENCY",
|
|
501
|
+
pattern,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
case "percentage": {
|
|
505
|
+
return {
|
|
506
|
+
type: "PERCENT",
|
|
507
|
+
pattern: this.buildNumberPattern(node, { percent: true }),
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
case "scientific": {
|
|
511
|
+
return {
|
|
512
|
+
type: "SCIENTIFIC",
|
|
513
|
+
pattern: "0.00E+00",
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
case "date":
|
|
517
|
+
case "time":
|
|
518
|
+
case "date-time": {
|
|
519
|
+
const dateTime = this.buildDateTimePattern(node, kind);
|
|
520
|
+
if (!dateTime)
|
|
521
|
+
return undefined;
|
|
522
|
+
return dateTime;
|
|
523
|
+
}
|
|
524
|
+
default:
|
|
525
|
+
return undefined;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
buildNumberPattern(node, options) {
|
|
529
|
+
const numberNode = this.first(this.toArray(node["number:number"]));
|
|
530
|
+
const decimalsRaw = numberNode?.["@_number:decimal-places"] ||
|
|
531
|
+
numberNode?.["@_decimal-places"] ||
|
|
532
|
+
(options?.defaultFractionDigits !== undefined
|
|
533
|
+
? String(options.defaultFractionDigits)
|
|
534
|
+
: "0");
|
|
535
|
+
let decimals = parseInt(decimalsRaw ?? "0", 10);
|
|
536
|
+
if (isNaN(decimals)) {
|
|
537
|
+
decimals = options?.defaultFractionDigits ?? 0;
|
|
538
|
+
}
|
|
539
|
+
const groupingAttr = numberNode?.["@_number:grouping"] || numberNode?.["@_grouping"] || "true";
|
|
540
|
+
const grouping = groupingAttr !== "false";
|
|
541
|
+
const minIntegerDigits = Math.max(parseInt(numberNode?.["@_number:min-integer-digits"] ||
|
|
542
|
+
numberNode?.["@_min-integer-digits"] ||
|
|
543
|
+
"1", 10) || 1, 1);
|
|
544
|
+
let integerPattern = grouping ? "#,##0" : "0".repeat(minIntegerDigits);
|
|
545
|
+
if (!integerPattern) {
|
|
546
|
+
integerPattern = "0";
|
|
547
|
+
}
|
|
548
|
+
const decimalPattern = decimals > 0 ? `.${"0".repeat(decimals)}` : "";
|
|
549
|
+
let pattern = `${integerPattern}${decimalPattern}`;
|
|
550
|
+
if (options?.percent) {
|
|
551
|
+
pattern = `${pattern}%`;
|
|
552
|
+
}
|
|
553
|
+
if (options?.prefix) {
|
|
554
|
+
pattern = `${options.prefix}${pattern}`;
|
|
555
|
+
}
|
|
556
|
+
if (options?.suffix) {
|
|
557
|
+
pattern = `${pattern}${options.suffix}`;
|
|
558
|
+
}
|
|
559
|
+
return pattern || "0";
|
|
560
|
+
}
|
|
561
|
+
buildDateTimePattern(node, kind) {
|
|
562
|
+
const dateParts = [];
|
|
563
|
+
if (node["number:year"]) {
|
|
564
|
+
dateParts.push("yyyy");
|
|
565
|
+
}
|
|
566
|
+
if (node["number:month"]) {
|
|
567
|
+
dateParts.push("mm");
|
|
568
|
+
}
|
|
569
|
+
if (node["number:day"]) {
|
|
570
|
+
dateParts.push("dd");
|
|
571
|
+
}
|
|
572
|
+
const timeParts = [];
|
|
573
|
+
if (node["number:hours"]) {
|
|
574
|
+
timeParts.push("hh");
|
|
575
|
+
}
|
|
576
|
+
if (node["number:minutes"]) {
|
|
577
|
+
timeParts.push("mm");
|
|
578
|
+
}
|
|
579
|
+
if (node["number:seconds"]) {
|
|
580
|
+
timeParts.push("ss");
|
|
581
|
+
}
|
|
582
|
+
const hasAmPm = Boolean(node["number:am-pm"]);
|
|
583
|
+
if (timeParts.length && hasAmPm) {
|
|
584
|
+
timeParts.push("AM/PM");
|
|
585
|
+
}
|
|
586
|
+
const parts = [];
|
|
587
|
+
if (dateParts.length) {
|
|
588
|
+
parts.push(dateParts.join("-"));
|
|
589
|
+
}
|
|
590
|
+
if (timeParts.length) {
|
|
591
|
+
const timePattern = timeParts.length > 1 && timeParts[timeParts.length - 1] === "AM/PM"
|
|
592
|
+
? `${timeParts.slice(0, -1).join(":")} ${timeParts[timeParts.length - 1]}`
|
|
593
|
+
: timeParts.join(":");
|
|
594
|
+
parts.push(timePattern);
|
|
595
|
+
}
|
|
596
|
+
const hasDate = dateParts.length > 0;
|
|
597
|
+
const hasTime = timeParts.length > 0;
|
|
598
|
+
let type = kind === "time" ? "TIME" : kind === "date-time" ? "DATE_TIME" : "DATE";
|
|
599
|
+
if (hasDate && hasTime) {
|
|
600
|
+
type = "DATE_TIME";
|
|
601
|
+
}
|
|
602
|
+
else if (hasTime && !hasDate) {
|
|
603
|
+
type = "TIME";
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
type = "DATE";
|
|
607
|
+
}
|
|
608
|
+
const pattern = parts.join(" ").trim();
|
|
609
|
+
return {
|
|
610
|
+
type,
|
|
611
|
+
pattern: pattern || undefined,
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
toArray(value) {
|
|
615
|
+
if (!value)
|
|
616
|
+
return [];
|
|
617
|
+
return Array.isArray(value) ? value : [value];
|
|
618
|
+
}
|
|
619
|
+
first(value) {
|
|
620
|
+
return value && value.length ? value[0] : undefined;
|
|
621
|
+
}
|
|
622
|
+
extractText(node) {
|
|
623
|
+
if (!node)
|
|
624
|
+
return undefined;
|
|
625
|
+
if (typeof node === "string")
|
|
626
|
+
return node;
|
|
627
|
+
if (Array.isArray(node)) {
|
|
628
|
+
return this.extractText(node[0]);
|
|
629
|
+
}
|
|
630
|
+
return node["#text"] || node["@_text"] || node._ || undefined;
|
|
631
|
+
}
|
|
632
|
+
getAttributes(node) {
|
|
633
|
+
if (!node)
|
|
634
|
+
return undefined;
|
|
635
|
+
if (Array.isArray(node)) {
|
|
636
|
+
return node.length ? this.getAttributes(node[0]) : undefined;
|
|
637
|
+
}
|
|
638
|
+
return node[":@"] || node;
|
|
639
|
+
}
|
|
640
|
+
createBorders(borderValue) {
|
|
641
|
+
const border = this.parseBorder(borderValue);
|
|
642
|
+
if (!border)
|
|
643
|
+
return undefined;
|
|
644
|
+
return {
|
|
645
|
+
top: border,
|
|
646
|
+
bottom: border,
|
|
647
|
+
left: border,
|
|
648
|
+
right: border,
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
parseBorder(borderValue) {
|
|
652
|
+
const parts = borderValue.trim().split(/\s+/);
|
|
653
|
+
if (!parts.length)
|
|
654
|
+
return undefined;
|
|
655
|
+
const widthToken = parts.find((part) => /\d/.test(part));
|
|
656
|
+
const width = widthToken
|
|
657
|
+
? parseFloat(widthToken.replace("pt", ""))
|
|
658
|
+
: undefined;
|
|
659
|
+
const styleToken = parts.find((part) => ["solid", "dotted", "dashed", "double"].includes(part.toLowerCase()));
|
|
660
|
+
const colorToken = parts.find((part) => part.startsWith("#"));
|
|
661
|
+
const borderStyle = this.mapBorderStyle(styleToken, width);
|
|
662
|
+
if (!borderStyle)
|
|
663
|
+
return undefined;
|
|
664
|
+
return {
|
|
665
|
+
style: borderStyle,
|
|
666
|
+
width: this.mapBorderWidth(width),
|
|
667
|
+
color: colorToken ? this.parseColor(colorToken) : undefined,
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
getNodeAttributes(node) {
|
|
671
|
+
if (!node)
|
|
672
|
+
return undefined;
|
|
673
|
+
if (Array.isArray(node)) {
|
|
674
|
+
return node.length ? this.getNodeAttributes(node[0]) : undefined;
|
|
675
|
+
}
|
|
676
|
+
return node[":@"] || node;
|
|
677
|
+
}
|
|
678
|
+
parseColor(colorString) {
|
|
679
|
+
if (!colorString)
|
|
680
|
+
return "#000000";
|
|
681
|
+
if (colorString.startsWith("#")) {
|
|
682
|
+
return colorString.toUpperCase();
|
|
683
|
+
}
|
|
684
|
+
return colorString;
|
|
685
|
+
}
|
|
686
|
+
mapBorderStyle(odsStyle, width) {
|
|
687
|
+
if (!odsStyle)
|
|
688
|
+
return undefined;
|
|
689
|
+
const normalized = odsStyle.toLowerCase();
|
|
690
|
+
if (normalized === "dotted")
|
|
691
|
+
return "dotted";
|
|
692
|
+
if (normalized === "dashed")
|
|
693
|
+
return "dashed";
|
|
694
|
+
if (normalized === "double")
|
|
695
|
+
return "double";
|
|
696
|
+
if (normalized === "solid") {
|
|
697
|
+
if (width && width >= 2)
|
|
698
|
+
return "solid_thick";
|
|
699
|
+
if (width && width >= 1)
|
|
700
|
+
return "solid_medium";
|
|
701
|
+
return "solid";
|
|
702
|
+
}
|
|
703
|
+
return "solid";
|
|
704
|
+
}
|
|
705
|
+
mapBorderWidth(width) {
|
|
706
|
+
if (!width || isNaN(width))
|
|
707
|
+
return 1;
|
|
708
|
+
// Convert from pt to pixels approximately (1pt ≈ 1.333px)
|
|
709
|
+
return Math.max(1, Math.round(width * 1.333));
|
|
710
|
+
}
|
|
711
|
+
convertLengthToPixels(length) {
|
|
712
|
+
if (!length)
|
|
713
|
+
return undefined;
|
|
714
|
+
const trimmed = length.trim();
|
|
715
|
+
const match = trimmed.match(/^(-?\d*\.?\d+)(cm|mm|in|inch|pt|px)$/i);
|
|
716
|
+
if (!match)
|
|
717
|
+
return undefined;
|
|
718
|
+
const value = parseFloat(match[1]);
|
|
719
|
+
const unit = match[2].toLowerCase();
|
|
720
|
+
if (unit === "px")
|
|
721
|
+
return value;
|
|
722
|
+
if (unit === "pt")
|
|
723
|
+
return value * (96 / 72);
|
|
724
|
+
if (unit === "cm")
|
|
725
|
+
return value * 37.7952755906;
|
|
726
|
+
if (unit === "mm")
|
|
727
|
+
return value * 3.77952755906;
|
|
728
|
+
if (unit === "in" || unit === "inch")
|
|
729
|
+
return value * 96;
|
|
730
|
+
return undefined;
|
|
731
|
+
}
|
|
732
|
+
}
|