@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,405 @@
|
|
|
1
|
+
import { get } from "lodash-es";
|
|
2
|
+
import { convertOdsFormulaToExcel } from "./formula";
|
|
3
|
+
export function extractConditionalFormats(ctx) {
|
|
4
|
+
const { sheetContexts, sheetNameMap, odsStyles, getAttributes, parseRangeList, normalizeExpression, normalizeConditionExpression, toArray, } = ctx;
|
|
5
|
+
if (!sheetContexts.length)
|
|
6
|
+
return [];
|
|
7
|
+
const rules = [];
|
|
8
|
+
let ruleCounter = 1;
|
|
9
|
+
for (const context of sheetContexts) {
|
|
10
|
+
const conditionNodes = [
|
|
11
|
+
...toArray(get(context.node, "table:table-conditional-format")),
|
|
12
|
+
...toArray(get(context.node, "table:table-conditional-formats.table:table-conditional-format")),
|
|
13
|
+
...toArray(get(context.node, "table-conditional-format")),
|
|
14
|
+
...toArray(get(context.node, "calcext:conditional-formats.calcext:conditional-format")),
|
|
15
|
+
...toArray(get(context.node, "calcext:conditional-format")),
|
|
16
|
+
];
|
|
17
|
+
for (const node of conditionNodes) {
|
|
18
|
+
const attrs = getAttributes(node);
|
|
19
|
+
if (!attrs)
|
|
20
|
+
continue;
|
|
21
|
+
const iconSetNode = get(node, "calcext:icon-set") || get(node, "icon-set");
|
|
22
|
+
const dataBarNode = get(node, "calcext:data-bar") || get(node, "data-bar");
|
|
23
|
+
const nestedConditions = toArray(get(node, "table:condition") ||
|
|
24
|
+
get(node, "condition") ||
|
|
25
|
+
get(node, "calcext:condition"));
|
|
26
|
+
const baseAddressAttr = attrs["@_calcext:base-cell-address"] ||
|
|
27
|
+
extractCalcextBaseAddress(nestedConditions, getAttributes);
|
|
28
|
+
let ranges = parseRangeList(attrs["@_calcext:target-range-address"] ||
|
|
29
|
+
attrs["@_table:target-range-address"] ||
|
|
30
|
+
attrs["@_target-range-address"], sheetNameMap, context);
|
|
31
|
+
if (!ranges.length && baseAddressAttr) {
|
|
32
|
+
ranges = parseRangeList(baseAddressAttr, sheetNameMap, context);
|
|
33
|
+
}
|
|
34
|
+
if (!ranges.length)
|
|
35
|
+
continue;
|
|
36
|
+
const nestedStyleName = extractStyleNameFromConditions(nestedConditions, getAttributes);
|
|
37
|
+
const styleName = nestedStyleName ||
|
|
38
|
+
attrs["@_calcext:apply-style-name"] ||
|
|
39
|
+
attrs["@_table:apply-style-name"] ||
|
|
40
|
+
attrs["@_table:style-name"] ||
|
|
41
|
+
attrs["@_style:apply-style-name"];
|
|
42
|
+
const stopIfTrueAttr = attrs["@_calcext:stop-if-true"] ||
|
|
43
|
+
attrs["@_table:stop-if-true"] ||
|
|
44
|
+
attrs["@_stop-if-true"];
|
|
45
|
+
const format = styleName ? odsStyles.getStyle(styleName) : undefined;
|
|
46
|
+
const calcextConditionValue = attrs["@_calcext:value"] ||
|
|
47
|
+
extractCalcextConditionValue(nestedConditions, getAttributes);
|
|
48
|
+
const rawCondition = attrs["@_table:condition"] ||
|
|
49
|
+
attrs["@_condition"] ||
|
|
50
|
+
extractConditionExpression(nestedConditions, getAttributes);
|
|
51
|
+
const parsedCalcextCondition = parseCalcextCondition(calcextConditionValue);
|
|
52
|
+
const formula = !parsedCalcextCondition
|
|
53
|
+
? calcextConditionValue
|
|
54
|
+
? normalizeExpression(calcextConditionValue)
|
|
55
|
+
: normalizeConditionExpression(rawCondition)
|
|
56
|
+
: undefined;
|
|
57
|
+
// Skip cells that have neither a boolean condition nor a rich CF
|
|
58
|
+
// extension (icon set / data bar). We still emit a rule when one of
|
|
59
|
+
// the calcext extensions is present.
|
|
60
|
+
if (!format &&
|
|
61
|
+
!formula &&
|
|
62
|
+
!parsedCalcextCondition &&
|
|
63
|
+
!iconSetNode &&
|
|
64
|
+
!dataBarNode) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const priority = ruleCounter++;
|
|
68
|
+
const rule = {
|
|
69
|
+
id: `ods-cf-${context.sheetId}-${priority}`,
|
|
70
|
+
ranges,
|
|
71
|
+
priority,
|
|
72
|
+
};
|
|
73
|
+
if (stopIfTrueAttr === "true" || stopIfTrueAttr === "1") {
|
|
74
|
+
rule.stopIfTrue = true;
|
|
75
|
+
}
|
|
76
|
+
if (iconSetNode) {
|
|
77
|
+
const parsed = parseCalcextIconSet(iconSetNode, getAttributes, toArray);
|
|
78
|
+
if (parsed) {
|
|
79
|
+
rule.iconSetRule = parsed;
|
|
80
|
+
rules.push(rule);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (dataBarNode) {
|
|
85
|
+
const parsed = parseCalcextDataBar(dataBarNode, getAttributes, toArray);
|
|
86
|
+
if (parsed) {
|
|
87
|
+
rule.dataBarRule = parsed;
|
|
88
|
+
rules.push(rule);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (format || formula || parsedCalcextCondition) {
|
|
93
|
+
const condition = parsedCalcextCondition ||
|
|
94
|
+
(formula
|
|
95
|
+
? {
|
|
96
|
+
type: "CUSTOM_FORMULA",
|
|
97
|
+
values: [{ userEnteredValue: formula }],
|
|
98
|
+
}
|
|
99
|
+
: undefined);
|
|
100
|
+
rule.booleanRule = {
|
|
101
|
+
format: format ?? {},
|
|
102
|
+
...(condition ? { condition } : {}),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
rules.push(rule);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return rules;
|
|
109
|
+
}
|
|
110
|
+
// `calcext:formatting-entry value="X" type="Y"` → engine threshold. ODS
|
|
111
|
+
// uses `value`/`percent`/`percentile`/`auto-minimum`/`auto-maximum`/`formula`;
|
|
112
|
+
// we map onto the engine's enum that XLSX also produces.
|
|
113
|
+
function mapCalcextEntryType(rawType) {
|
|
114
|
+
switch ((rawType ?? "").toLowerCase()) {
|
|
115
|
+
case "auto-minimum":
|
|
116
|
+
return "MIN";
|
|
117
|
+
case "auto-maximum":
|
|
118
|
+
return "MAX";
|
|
119
|
+
case "value":
|
|
120
|
+
case "number":
|
|
121
|
+
return "NUMBER";
|
|
122
|
+
case "percent":
|
|
123
|
+
return "PERCENT";
|
|
124
|
+
case "percentile":
|
|
125
|
+
return "PERCENTILE";
|
|
126
|
+
case "formula":
|
|
127
|
+
return "FORMULA";
|
|
128
|
+
default:
|
|
129
|
+
return "NUMBER";
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function parseCalcextFormattingEntries(parentNode, toArray, getAttributes) {
|
|
133
|
+
const entries = toArray(get(parentNode, "calcext:formatting-entry") ||
|
|
134
|
+
get(parentNode, "formatting-entry"));
|
|
135
|
+
const result = [];
|
|
136
|
+
for (const entry of entries) {
|
|
137
|
+
const a = getAttributes(entry);
|
|
138
|
+
if (!a)
|
|
139
|
+
continue;
|
|
140
|
+
const type = mapCalcextEntryType(a["@_calcext:type"] || a["@_type"]);
|
|
141
|
+
const value = a["@_calcext:value"] ?? a["@_value"];
|
|
142
|
+
result.push({
|
|
143
|
+
type,
|
|
144
|
+
...(value !== undefined ? { value: String(value) } : {}),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
// LibreOffice writes the same `calcext:icon-set-type` enum values as OOXML
|
|
150
|
+
// (3Arrows, 3TrafficLights1, ...). The unknown-fallback path defaults to the
|
|
151
|
+
// traffic-lights family which is the most universally recognized.
|
|
152
|
+
const KNOWN_ICON_SET_FAMILIES = new Set([
|
|
153
|
+
"3Arrows",
|
|
154
|
+
"3ArrowsGray",
|
|
155
|
+
"3Flags",
|
|
156
|
+
"3TrafficLights1",
|
|
157
|
+
"3TrafficLights2",
|
|
158
|
+
"3Signs",
|
|
159
|
+
"3Symbols",
|
|
160
|
+
"3Symbols2",
|
|
161
|
+
"4Arrows",
|
|
162
|
+
"4ArrowsGray",
|
|
163
|
+
"4RedToBlack",
|
|
164
|
+
"4Rating",
|
|
165
|
+
"4TrafficLights",
|
|
166
|
+
"5Arrows",
|
|
167
|
+
"5ArrowsGray",
|
|
168
|
+
"5Rating",
|
|
169
|
+
"5Quarters",
|
|
170
|
+
]);
|
|
171
|
+
function parseCalcextIconSet(node, getAttributes, toArray) {
|
|
172
|
+
const attrs = getAttributes(node);
|
|
173
|
+
const rawFamily = attrs?.["@_calcext:icon-set-type"] ?? attrs?.["@_icon-set-type"];
|
|
174
|
+
const family = (KNOWN_ICON_SET_FAMILIES.has(rawFamily) ? rawFamily : "3TrafficLights1");
|
|
175
|
+
const thresholds = parseCalcextFormattingEntries(node, toArray, getAttributes);
|
|
176
|
+
// Strip the leading "auto-minimum"/"0%" stop that ODS writes for parity
|
|
177
|
+
// with OOXML — the engine model only carries (icon-count - 1) thresholds.
|
|
178
|
+
const effective = thresholds.length > 1 ? thresholds.slice(1) : thresholds;
|
|
179
|
+
return { iconSet: family, thresholds: effective };
|
|
180
|
+
}
|
|
181
|
+
function parseCalcextDataBar(node, getAttributes, toArray) {
|
|
182
|
+
const attrs = getAttributes(node);
|
|
183
|
+
const cfvos = parseCalcextFormattingEntries(node, toArray, getAttributes);
|
|
184
|
+
if (cfvos.length < 2)
|
|
185
|
+
return null;
|
|
186
|
+
const positiveColor = attrs?.["@_calcext:positive-color"] ||
|
|
187
|
+
attrs?.["@_positive-color"] ||
|
|
188
|
+
"#638ec6";
|
|
189
|
+
const negativeColor = attrs?.["@_calcext:negative-color"] || attrs?.["@_negative-color"];
|
|
190
|
+
const rule = {
|
|
191
|
+
minpoint: cfvos[0],
|
|
192
|
+
maxpoint: cfvos[cfvos.length - 1],
|
|
193
|
+
color: positiveColor,
|
|
194
|
+
};
|
|
195
|
+
if (negativeColor)
|
|
196
|
+
rule.negativeColor = negativeColor;
|
|
197
|
+
return rule;
|
|
198
|
+
}
|
|
199
|
+
function extractStyleNameFromConditions(conditionNodes, getAttributes) {
|
|
200
|
+
for (const node of conditionNodes) {
|
|
201
|
+
const attrs = getAttributes(node);
|
|
202
|
+
if (!attrs)
|
|
203
|
+
continue;
|
|
204
|
+
const styleName = attrs["@_calcext:apply-style-name"] ||
|
|
205
|
+
attrs["@_table:apply-style-name"] ||
|
|
206
|
+
attrs["@_style:apply-style-name"] ||
|
|
207
|
+
attrs["@_table:style-name"] ||
|
|
208
|
+
attrs["@_style-name"];
|
|
209
|
+
if (styleName)
|
|
210
|
+
return styleName;
|
|
211
|
+
}
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
function extractConditionExpression(conditionNodes, getAttributes) {
|
|
215
|
+
for (const node of conditionNodes) {
|
|
216
|
+
const attrs = getAttributes(node);
|
|
217
|
+
if (!attrs)
|
|
218
|
+
continue;
|
|
219
|
+
const condition = attrs["@_calcext:value"] ||
|
|
220
|
+
attrs["@_table:condition"] ||
|
|
221
|
+
attrs["@_condition"] ||
|
|
222
|
+
extractText(node);
|
|
223
|
+
if (condition)
|
|
224
|
+
return condition;
|
|
225
|
+
}
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
function extractCalcextConditionValue(conditionNodes, getAttributes) {
|
|
229
|
+
for (const node of conditionNodes) {
|
|
230
|
+
const attrs = getAttributes(node);
|
|
231
|
+
if (!attrs)
|
|
232
|
+
continue;
|
|
233
|
+
const value = attrs["@_calcext:value"];
|
|
234
|
+
if (value)
|
|
235
|
+
return value;
|
|
236
|
+
}
|
|
237
|
+
return undefined;
|
|
238
|
+
}
|
|
239
|
+
function extractCalcextBaseAddress(conditionNodes, getAttributes) {
|
|
240
|
+
for (const node of conditionNodes) {
|
|
241
|
+
const attrs = getAttributes(node);
|
|
242
|
+
if (!attrs)
|
|
243
|
+
continue;
|
|
244
|
+
const address = attrs["@_calcext:base-cell-address"];
|
|
245
|
+
if (address)
|
|
246
|
+
return address;
|
|
247
|
+
}
|
|
248
|
+
return undefined;
|
|
249
|
+
}
|
|
250
|
+
function extractText(node) {
|
|
251
|
+
if (!node)
|
|
252
|
+
return undefined;
|
|
253
|
+
if (typeof node === "string")
|
|
254
|
+
return node;
|
|
255
|
+
if (Array.isArray(node)) {
|
|
256
|
+
for (const entry of node) {
|
|
257
|
+
const text = extractText(entry);
|
|
258
|
+
if (text)
|
|
259
|
+
return text;
|
|
260
|
+
}
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
return node["#text"] || node["@_text"] || node._;
|
|
264
|
+
}
|
|
265
|
+
function parseCalcextCondition(value) {
|
|
266
|
+
if (!value)
|
|
267
|
+
return undefined;
|
|
268
|
+
const trimmed = value.trim();
|
|
269
|
+
if (!trimmed)
|
|
270
|
+
return undefined;
|
|
271
|
+
const literalMatch = trimmed.match(/^=\s*"([\s\S]*)"\s*$/);
|
|
272
|
+
if (literalMatch) {
|
|
273
|
+
const literalValue = literalMatch[1].replace(/""/g, '"');
|
|
274
|
+
return {
|
|
275
|
+
type: "TEXT_EQ",
|
|
276
|
+
values: [{ userEnteredValue: literalValue }],
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
const fnMatch = trimmed.match(/^([a-z-]+)\((.*)\)$/i);
|
|
280
|
+
if (!fnMatch) {
|
|
281
|
+
return createCustomFormulaCondition(trimmed);
|
|
282
|
+
}
|
|
283
|
+
const fnName = fnMatch[1].toLowerCase();
|
|
284
|
+
const args = splitTopLevelCommaSeparated(fnMatch[2]).map((arg) => normalizeCalcextArgument(arg));
|
|
285
|
+
const toValues = (count) => args.slice(0, count).map((arg) => ({ userEnteredValue: arg }));
|
|
286
|
+
switch (fnName) {
|
|
287
|
+
case "between":
|
|
288
|
+
if (args.length >= 2) {
|
|
289
|
+
return { type: "NUMBER_BETWEEN", values: toValues(2) };
|
|
290
|
+
}
|
|
291
|
+
break;
|
|
292
|
+
case "not-between":
|
|
293
|
+
if (args.length >= 2) {
|
|
294
|
+
return { type: "NUMBER_NOT_BETWEEN", values: toValues(2) };
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
case "equal":
|
|
298
|
+
if (args.length >= 1) {
|
|
299
|
+
return { type: "NUMBER_EQ", values: toValues(1) };
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
case "not-equal":
|
|
303
|
+
if (args.length >= 1) {
|
|
304
|
+
return { type: "NUMBER_NOT_EQ", values: toValues(1) };
|
|
305
|
+
}
|
|
306
|
+
break;
|
|
307
|
+
case "greater-than":
|
|
308
|
+
if (args.length >= 1) {
|
|
309
|
+
return { type: "NUMBER_GREATER", values: toValues(1) };
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
case "greater-than-equal":
|
|
313
|
+
if (args.length >= 1) {
|
|
314
|
+
return { type: "NUMBER_GREATER_THAN_EQ", values: toValues(1) };
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
case "less-than":
|
|
318
|
+
if (args.length >= 1) {
|
|
319
|
+
return { type: "NUMBER_LESS", values: toValues(1) };
|
|
320
|
+
}
|
|
321
|
+
break;
|
|
322
|
+
case "less-than-equal":
|
|
323
|
+
if (args.length >= 1) {
|
|
324
|
+
return { type: "NUMBER_LESS_THAN_EQ", values: toValues(1) };
|
|
325
|
+
}
|
|
326
|
+
break;
|
|
327
|
+
case "contains-text":
|
|
328
|
+
if (args.length >= 1) {
|
|
329
|
+
return { type: "TEXT_CONTAINS", values: toValues(1) };
|
|
330
|
+
}
|
|
331
|
+
break;
|
|
332
|
+
case "not-contains-text":
|
|
333
|
+
if (args.length >= 1) {
|
|
334
|
+
return { type: "TEXT_NOT_CONTAINS", values: toValues(1) };
|
|
335
|
+
}
|
|
336
|
+
break;
|
|
337
|
+
case "begins-with":
|
|
338
|
+
if (args.length >= 1) {
|
|
339
|
+
return { type: "TEXT_STARTS_WITH", values: toValues(1) };
|
|
340
|
+
}
|
|
341
|
+
break;
|
|
342
|
+
case "ends-with":
|
|
343
|
+
if (args.length >= 1) {
|
|
344
|
+
return { type: "TEXT_ENDS_WITH", values: toValues(1) };
|
|
345
|
+
}
|
|
346
|
+
break;
|
|
347
|
+
case "formula-is":
|
|
348
|
+
return createCustomFormulaCondition(args[0] ?? "");
|
|
349
|
+
default:
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
return createCustomFormulaCondition(trimmed);
|
|
353
|
+
}
|
|
354
|
+
function createCustomFormulaCondition(expression) {
|
|
355
|
+
if (!expression)
|
|
356
|
+
return undefined;
|
|
357
|
+
let normalized = convertOdsFormulaToExcel(expression).trim();
|
|
358
|
+
if (!normalized)
|
|
359
|
+
return undefined;
|
|
360
|
+
if (!normalized.startsWith("=")) {
|
|
361
|
+
normalized = `=${normalized}`;
|
|
362
|
+
}
|
|
363
|
+
return {
|
|
364
|
+
type: "CUSTOM_FORMULA",
|
|
365
|
+
values: [{ userEnteredValue: normalized }],
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function splitTopLevelCommaSeparated(value) {
|
|
369
|
+
const result = [];
|
|
370
|
+
let depth = 0;
|
|
371
|
+
let current = "";
|
|
372
|
+
for (let i = 0; i < value.length; i++) {
|
|
373
|
+
const char = value[i];
|
|
374
|
+
if (char === "(") {
|
|
375
|
+
depth++;
|
|
376
|
+
}
|
|
377
|
+
else if (char === ")") {
|
|
378
|
+
depth = Math.max(0, depth - 1);
|
|
379
|
+
}
|
|
380
|
+
if (char === "," && depth === 0) {
|
|
381
|
+
result.push(current);
|
|
382
|
+
current = "";
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
current += char;
|
|
386
|
+
}
|
|
387
|
+
if (current) {
|
|
388
|
+
result.push(current);
|
|
389
|
+
}
|
|
390
|
+
return result;
|
|
391
|
+
}
|
|
392
|
+
function normalizeCalcextArgument(value) {
|
|
393
|
+
const trimmed = value.trim();
|
|
394
|
+
if (!trimmed)
|
|
395
|
+
return "";
|
|
396
|
+
const withoutQuotes = stripWrappingQuotes(trimmed);
|
|
397
|
+
return convertOdsFormulaToExcel(withoutQuotes).trim();
|
|
398
|
+
}
|
|
399
|
+
function stripWrappingQuotes(value) {
|
|
400
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
401
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
402
|
+
return value.substring(1, value.length - 1);
|
|
403
|
+
}
|
|
404
|
+
return value;
|
|
405
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DataValidationRuleRecord, SheetRange } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import type { SheetContext, ToArrayFn } from "./types";
|
|
3
|
+
export type DataValidationExtractionContext = {
|
|
4
|
+
sheetContexts: SheetContext[];
|
|
5
|
+
sheetNameMap: Map<string, number>;
|
|
6
|
+
spreadsheetNode: any;
|
|
7
|
+
getAttributes: (node: any) => any;
|
|
8
|
+
parseRangeList: (addresses: string | undefined, sheetNameMap: Map<string, number>, context?: SheetContext) => SheetRange[];
|
|
9
|
+
normalizeConditionExpression: (expression?: string) => string | undefined;
|
|
10
|
+
parseBooleanAttribute: (value?: string | boolean) => boolean | undefined;
|
|
11
|
+
mapAlertStyle: (value?: string) => "stop" | "warning" | "information" | undefined;
|
|
12
|
+
toArray: ToArrayFn;
|
|
13
|
+
};
|
|
14
|
+
export declare function extractDataValidations(ctx: DataValidationExtractionContext): DataValidationRuleRecord[];
|
|
15
|
+
//# sourceMappingURL=data-validations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-validations.d.ts","sourceRoot":"","sources":["../../../../../excel-parser/plugins/ods/data-validations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,wBAAwB,EACxB,UAAU,EACX,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEvD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,eAAe,EAAE,GAAG,CAAC;IACrB,aAAa,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IAClC,cAAc,EAAE,CACd,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,OAAO,CAAC,EAAE,YAAY,KACnB,UAAU,EAAE,CAAC;IAClB,4BAA4B,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC1E,qBAAqB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,KAAK,OAAO,GAAG,SAAS,CAAC;IACzE,aAAa,EAAE,CACb,KAAK,CAAC,EAAE,MAAM,KACX,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;IACpD,OAAO,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,+BAA+B,GACnC,wBAAwB,EAAE,CAuI5B"}
|