@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,181 @@
|
|
|
1
|
+
/// <reference path="../xlsx.d.ts" />
|
|
2
|
+
import { CFB } from "xlsx/xlsx.mjs";
|
|
3
|
+
import { sha512 } from "@noble/hashes/sha512";
|
|
4
|
+
import { hmac } from "@noble/hashes/hmac";
|
|
5
|
+
import { cbc } from "@noble/ciphers/aes";
|
|
6
|
+
const BLOCK_SIZE = 16;
|
|
7
|
+
const KEY_SIZE = 32; // AES-256
|
|
8
|
+
const HASH_SIZE = 64; // SHA-512
|
|
9
|
+
const SEGMENT_LENGTH = 4096;
|
|
10
|
+
const SPIN_COUNT_DEFAULT = 100000;
|
|
11
|
+
const BLOCK_KEY_VERIFIER_INPUT = new Uint8Array([
|
|
12
|
+
0xfe, 0xa7, 0xd2, 0x76, 0x3b, 0x4b, 0x9e, 0x79,
|
|
13
|
+
]);
|
|
14
|
+
const BLOCK_KEY_VERIFIER_HASH = new Uint8Array([
|
|
15
|
+
0xd7, 0xaa, 0x0f, 0x6d, 0x30, 0x61, 0x34, 0x4e,
|
|
16
|
+
]);
|
|
17
|
+
const BLOCK_KEY_ENCRYPTION_KEY = new Uint8Array([
|
|
18
|
+
0x14, 0x6e, 0x0b, 0xe7, 0xab, 0xac, 0xd0, 0xd6,
|
|
19
|
+
]);
|
|
20
|
+
const BLOCK_KEY_DATA_INTEGRITY_KEY = new Uint8Array([
|
|
21
|
+
0x5f, 0xb2, 0xad, 0x01, 0x0c, 0xb9, 0xe1, 0xf6,
|
|
22
|
+
]);
|
|
23
|
+
const BLOCK_KEY_DATA_INTEGRITY_VALUE = new Uint8Array([
|
|
24
|
+
0xa0, 0x67, 0x7f, 0x02, 0xb2, 0x2c, 0x84, 0x33,
|
|
25
|
+
]);
|
|
26
|
+
export class CFBEncryptor {
|
|
27
|
+
static async encrypt(source, password, options = {}) {
|
|
28
|
+
const packageData = source instanceof Uint8Array ? source : new Uint8Array(source);
|
|
29
|
+
const spinCount = options.spinCount ?? SPIN_COUNT_DEFAULT;
|
|
30
|
+
const passwordSalt = this.randomBytes(BLOCK_SIZE);
|
|
31
|
+
const packageSalt = this.randomBytes(BLOCK_SIZE);
|
|
32
|
+
const verifierInput = this.randomBytes(BLOCK_SIZE);
|
|
33
|
+
const encryptionKey = this.randomBytes(KEY_SIZE);
|
|
34
|
+
const hmacKey = this.randomBytes(HASH_SIZE);
|
|
35
|
+
const passwordDerivedKey = this.derivePasswordKey(password, passwordSalt, spinCount);
|
|
36
|
+
const keyForVerifierInput = this.deriveAgileBlockKey(passwordDerivedKey, BLOCK_KEY_VERIFIER_INPUT);
|
|
37
|
+
const keyForVerifierHash = this.deriveAgileBlockKey(passwordDerivedKey, BLOCK_KEY_VERIFIER_HASH);
|
|
38
|
+
const keyForEncryptionKey = this.deriveAgileBlockKey(passwordDerivedKey, BLOCK_KEY_ENCRYPTION_KEY);
|
|
39
|
+
const verifierHash = this.sha512Hash(verifierInput);
|
|
40
|
+
const encryptedVerifierHashInput = this.encryptAESNoPadding(verifierInput, keyForVerifierInput, passwordSalt);
|
|
41
|
+
const encryptedVerifierHashValue = this.encryptAESNoPadding(verifierHash, keyForVerifierHash, passwordSalt);
|
|
42
|
+
const encryptedKeyValue = this.encryptAESNoPadding(encryptionKey, keyForEncryptionKey, passwordSalt);
|
|
43
|
+
const encryptedPackageData = this.encryptPackage(packageData, encryptionKey, packageSalt);
|
|
44
|
+
const encryptedPackageStream = this.buildEncryptedPackageStream(packageData.length, encryptedPackageData);
|
|
45
|
+
const encryptedHmacKey = this.encryptDataIntegrityValue(hmacKey, encryptionKey, packageSalt, BLOCK_KEY_DATA_INTEGRITY_KEY);
|
|
46
|
+
const hmacValue = this.hmacSha512(encryptedPackageStream, hmacKey);
|
|
47
|
+
const encryptedHmacValue = this.encryptDataIntegrityValue(hmacValue, encryptionKey, packageSalt, BLOCK_KEY_DATA_INTEGRITY_VALUE);
|
|
48
|
+
const encryptionXml = this.buildEncryptionXml({
|
|
49
|
+
spinCount,
|
|
50
|
+
passwordSalt,
|
|
51
|
+
packageSalt,
|
|
52
|
+
encryptedVerifierHashInput,
|
|
53
|
+
encryptedVerifierHashValue,
|
|
54
|
+
encryptedKeyValue,
|
|
55
|
+
encryptedHmacKey,
|
|
56
|
+
encryptedHmacValue,
|
|
57
|
+
});
|
|
58
|
+
const encryptionInfo = this.buildEncryptionInfoStream(encryptionXml);
|
|
59
|
+
const cfb = CFB.utils.cfb_new({ root: "Root Entry" });
|
|
60
|
+
CFB.utils.cfb_add(cfb, "EncryptionInfo", encryptionInfo);
|
|
61
|
+
CFB.utils.cfb_add(cfb, "EncryptedPackage", encryptedPackageStream);
|
|
62
|
+
const result = CFB.write(cfb, { type: "array" });
|
|
63
|
+
return result instanceof Uint8Array ? result : new Uint8Array(result);
|
|
64
|
+
}
|
|
65
|
+
static buildEncryptionInfoStream(xml) {
|
|
66
|
+
const xmlBytes = new TextEncoder().encode(xml);
|
|
67
|
+
const info = new Uint8Array(8 + xmlBytes.length);
|
|
68
|
+
const view = new DataView(info.buffer);
|
|
69
|
+
view.setUint16(0, 4, true); // vMajor
|
|
70
|
+
view.setUint16(2, 4, true); // vMinor (Agile)
|
|
71
|
+
view.setUint32(4, 0x40, true); // reserved
|
|
72
|
+
info.set(xmlBytes, 8);
|
|
73
|
+
return info;
|
|
74
|
+
}
|
|
75
|
+
static buildEncryptedPackageStream(originalSize, encryptedData) {
|
|
76
|
+
const out = new Uint8Array(8 + encryptedData.length);
|
|
77
|
+
const view = new DataView(out.buffer);
|
|
78
|
+
view.setBigUint64(0, BigInt(originalSize), true);
|
|
79
|
+
out.set(encryptedData, 8);
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
static encryptPackage(data, key, packageSalt) {
|
|
83
|
+
const chunks = [];
|
|
84
|
+
for (let index = 0; index * SEGMENT_LENGTH < data.length; index++) {
|
|
85
|
+
const start = index * SEGMENT_LENGTH;
|
|
86
|
+
const end = Math.min(start + SEGMENT_LENGTH, data.length);
|
|
87
|
+
const segment = data.slice(start, end);
|
|
88
|
+
const paddedSegment = this.padToBlockSize(segment, BLOCK_SIZE);
|
|
89
|
+
const blockNumber = new Uint8Array(4);
|
|
90
|
+
new DataView(blockNumber.buffer).setUint32(0, index, true);
|
|
91
|
+
const iv = this.sha512Hash(this.concatArrays(packageSalt, blockNumber)).slice(0, BLOCK_SIZE);
|
|
92
|
+
chunks.push(this.encryptAESNoPadding(paddedSegment, key, iv));
|
|
93
|
+
}
|
|
94
|
+
return this.concatArrays(...chunks);
|
|
95
|
+
}
|
|
96
|
+
static buildEncryptionXml({ spinCount, passwordSalt, packageSalt, encryptedVerifierHashInput, encryptedVerifierHashValue, encryptedKeyValue, encryptedHmacKey, encryptedHmacValue, }) {
|
|
97
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
98
|
+
<encryption xmlns="http://schemas.microsoft.com/office/2006/encryption" xmlns:p="http://schemas.microsoft.com/office/2006/keyEncryptor/password" xmlns:c="http://schemas.microsoft.com/office/2006/keyEncryptor/certificate">
|
|
99
|
+
<keyData saltSize="${BLOCK_SIZE}" blockSize="${BLOCK_SIZE}" keyBits="${KEY_SIZE * 8}" hashSize="${HASH_SIZE}" cipherAlgorithm="AES" cipherChaining="ChainingModeCBC" hashAlgorithm="SHA512" saltValue="${this.toBase64(packageSalt)}"/>
|
|
100
|
+
<dataIntegrity encryptedHmacKey="${this.toBase64(encryptedHmacKey)}" encryptedHmacValue="${this.toBase64(encryptedHmacValue)}"/>
|
|
101
|
+
<keyEncryptors>
|
|
102
|
+
<keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password">
|
|
103
|
+
<p:encryptedKey spinCount="${spinCount}" saltSize="${BLOCK_SIZE}" blockSize="${BLOCK_SIZE}" keyBits="${KEY_SIZE * 8}" hashSize="${HASH_SIZE}" cipherAlgorithm="AES" cipherChaining="ChainingModeCBC" hashAlgorithm="SHA512" saltValue="${this.toBase64(passwordSalt)}" encryptedVerifierHashInput="${this.toBase64(encryptedVerifierHashInput)}" encryptedVerifierHashValue="${this.toBase64(encryptedVerifierHashValue)}" encryptedKeyValue="${this.toBase64(encryptedKeyValue)}"/>
|
|
104
|
+
</keyEncryptor>
|
|
105
|
+
</keyEncryptors>
|
|
106
|
+
</encryption>`;
|
|
107
|
+
}
|
|
108
|
+
static derivePasswordKey(password, passwordSalt, spinCount) {
|
|
109
|
+
const passwordBytes = this.stringToUtf16LE(password);
|
|
110
|
+
let hash = this.sha512Hash(this.concatArrays(passwordSalt, passwordBytes));
|
|
111
|
+
for (let i = 0; i < spinCount; i++) {
|
|
112
|
+
const iterator = new Uint8Array(4);
|
|
113
|
+
new DataView(iterator.buffer).setUint32(0, i, true);
|
|
114
|
+
hash = this.sha512Hash(this.concatArrays(iterator, hash));
|
|
115
|
+
}
|
|
116
|
+
return hash;
|
|
117
|
+
}
|
|
118
|
+
static deriveAgileBlockKey(passwordDerivedKey, blockKey) {
|
|
119
|
+
return this.sha512Hash(this.concatArrays(passwordDerivedKey, blockKey)).slice(0, KEY_SIZE);
|
|
120
|
+
}
|
|
121
|
+
static encryptDataIntegrityValue(data, encryptionKey, packageSalt, blockKey) {
|
|
122
|
+
const iv = this.sha512Hash(this.concatArrays(packageSalt, blockKey)).slice(0, BLOCK_SIZE);
|
|
123
|
+
return this.encryptAESNoPadding(this.padToBlockSize(data, BLOCK_SIZE), encryptionKey, iv);
|
|
124
|
+
}
|
|
125
|
+
static encryptAESNoPadding(data, key, iv) {
|
|
126
|
+
const cipher = cbc(key, iv, { disablePadding: true });
|
|
127
|
+
return cipher.encrypt(data);
|
|
128
|
+
}
|
|
129
|
+
static sha512Hash(data) {
|
|
130
|
+
return sha512(data);
|
|
131
|
+
}
|
|
132
|
+
static hmacSha512(data, key) {
|
|
133
|
+
return hmac(sha512, key, data);
|
|
134
|
+
}
|
|
135
|
+
static toBase64(data) {
|
|
136
|
+
let binary = "";
|
|
137
|
+
for (let i = 0; i < data.length; i++) {
|
|
138
|
+
binary += String.fromCharCode(data[i]);
|
|
139
|
+
}
|
|
140
|
+
return btoa(binary);
|
|
141
|
+
}
|
|
142
|
+
static padToBlockSize(data, blockSize) {
|
|
143
|
+
const remainder = data.length % blockSize;
|
|
144
|
+
if (remainder === 0)
|
|
145
|
+
return data;
|
|
146
|
+
const out = new Uint8Array(data.length + (blockSize - remainder));
|
|
147
|
+
out.set(data);
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
static stringToUtf16LE(value) {
|
|
151
|
+
const bytes = new Uint8Array(value.length * 2);
|
|
152
|
+
for (let i = 0; i < value.length; i++) {
|
|
153
|
+
const code = value.charCodeAt(i);
|
|
154
|
+
bytes[i * 2] = code & 0xff;
|
|
155
|
+
bytes[i * 2 + 1] = (code >> 8) & 0xff;
|
|
156
|
+
}
|
|
157
|
+
return bytes;
|
|
158
|
+
}
|
|
159
|
+
static concatArrays(...arrays) {
|
|
160
|
+
const total = arrays.reduce((sum, arr) => sum + arr.length, 0);
|
|
161
|
+
const out = new Uint8Array(total);
|
|
162
|
+
let offset = 0;
|
|
163
|
+
for (const arr of arrays) {
|
|
164
|
+
out.set(arr, offset);
|
|
165
|
+
offset += arr.length;
|
|
166
|
+
}
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
static randomBytes(length) {
|
|
170
|
+
const out = new Uint8Array(length);
|
|
171
|
+
if (typeof globalThis.crypto !== "undefined" &&
|
|
172
|
+
globalThis.crypto.getRandomValues) {
|
|
173
|
+
globalThis.crypto.getRandomValues(out);
|
|
174
|
+
return out;
|
|
175
|
+
}
|
|
176
|
+
for (let i = 0; i < length; i++) {
|
|
177
|
+
out[i] = Math.floor(Math.random() * 256);
|
|
178
|
+
}
|
|
179
|
+
return out;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CellData, DataValidationRuleRecord } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
export declare class SheetDataValidationStamper {
|
|
3
|
+
private readonly rules;
|
|
4
|
+
private materializeBudget;
|
|
5
|
+
/** Rows that streamed out of the parser (only tracked when rules exist),
|
|
6
|
+
* so trailing materialization doesn't duplicate them. */
|
|
7
|
+
private readonly emittedRows;
|
|
8
|
+
constructor(allRules: DataValidationRuleRecord[], sheetId: number);
|
|
9
|
+
get hasRules(): boolean;
|
|
10
|
+
/** First rule (rule-list order, matching `updateRule`/grid semantics) whose
|
|
11
|
+
* ranges contain the cell. */
|
|
12
|
+
private ruleIdAt;
|
|
13
|
+
/**
|
|
14
|
+
* Stamp an emitted row in place: covered existing cells get
|
|
15
|
+
* `dataValidation: <ruleId>`, and covered holes inside small ranges get a
|
|
16
|
+
* phantom `{ dataValidation }` cell (budget-capped).
|
|
17
|
+
*/
|
|
18
|
+
stampRow(rowIndex: number, values: (CellData | null | undefined)[]): void;
|
|
19
|
+
/**
|
|
20
|
+
* Rows covered by small ranges that never streamed out of the file at all
|
|
21
|
+
* (fully blank template rows). Returns sparse phantom rows to append to the
|
|
22
|
+
* sheet's final chunk, in ascending row order.
|
|
23
|
+
*/
|
|
24
|
+
trailingRows(): Array<{
|
|
25
|
+
rowIndex: number;
|
|
26
|
+
values: (CellData | null | undefined)[];
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=dv-cell-stamp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dv-cell-stamp.d.ts","sourceRoot":"","sources":["../../../excel-parser/dv-cell-stamp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AA+CnC,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IACzC,OAAO,CAAC,iBAAiB,CAA8B;IACvD;6DACyD;IACzD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;gBAG/C,QAAQ,EAAE,wBAAwB,EAAE,EACpC,OAAO,EAAE,MAAM;IAsCjB,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;kCAC8B;IAC9B,OAAO,CAAC,QAAQ;IAmBhB;;;;OAIG;IACH,QAAQ,CACN,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GACtC,IAAI;IAgCP;;;;OAIG;IACH,YAAY,IAAI,KAAK,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,CAAC,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC;KACzC,CAAC;CAmCH"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-sheet stamping of `cellData.dataValidation` during `processSheetData`
|
|
3
|
+
* streaming.
|
|
4
|
+
*
|
|
5
|
+
* Spreadsheet files store validations at the worksheet level (a rule + the
|
|
6
|
+
* ranges it applies to), but `useSpreadsheetState.getDataValidation` resolves a
|
|
7
|
+
* cell's rule ONLY through the per-cell `cellData.dataValidation` reference —
|
|
8
|
+
* there is no range-membership fallback. Consumers that build documents
|
|
9
|
+
* straight from `processSheetData` (e.g. server-side xlsx→Y.Doc conversion)
|
|
10
|
+
* therefore need the streamed cells to already carry the rule id, or the grid
|
|
11
|
+
* never shows dropdown arrows / enforces the rule even though the rule list
|
|
12
|
+
* itself round-tripped.
|
|
13
|
+
*
|
|
14
|
+
* The stamped id MUST be the id of the same rule object the plugin returns
|
|
15
|
+
* from `getDataValidations()` (ids are minted per parse), so plugins must
|
|
16
|
+
* feed this class from a single cached parse shared with that API.
|
|
17
|
+
*/
|
|
18
|
+
/** A cell is only materialized (created solely to carry the stamp) for ranges
|
|
19
|
+
* up to this many cells — whole-column/row sqrefs would otherwise bloat the
|
|
20
|
+
* output with millions of phantom cells. Cells that exist anyway are stamped
|
|
21
|
+
* regardless of range size. */
|
|
22
|
+
const DV_MATERIALIZE_RANGE_CELL_CAP = 20_000;
|
|
23
|
+
/** Upper bound on phantom cells materialized per sheet across all ranges. */
|
|
24
|
+
const DV_MATERIALIZE_CELL_BUDGET = 100_000;
|
|
25
|
+
const isFiniteIndex = (value) => typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
26
|
+
export class SheetDataValidationStamper {
|
|
27
|
+
rules = [];
|
|
28
|
+
materializeBudget = DV_MATERIALIZE_CELL_BUDGET;
|
|
29
|
+
/** Rows that streamed out of the parser (only tracked when rules exist),
|
|
30
|
+
* so trailing materialization doesn't duplicate them. */
|
|
31
|
+
emittedRows = new Set();
|
|
32
|
+
constructor(allRules, sheetId) {
|
|
33
|
+
for (const rule of allRules) {
|
|
34
|
+
if (rule.id === undefined || rule.id === null)
|
|
35
|
+
continue;
|
|
36
|
+
const ranges = [];
|
|
37
|
+
const materialize = [];
|
|
38
|
+
for (const range of rule.ranges ?? []) {
|
|
39
|
+
if (range.sheetId !== sheetId)
|
|
40
|
+
continue;
|
|
41
|
+
const { startRowIndex, endRowIndex, startColumnIndex, endColumnIndex } = range;
|
|
42
|
+
if (!isFiniteIndex(startRowIndex) ||
|
|
43
|
+
!isFiniteIndex(endRowIndex) ||
|
|
44
|
+
!isFiniteIndex(startColumnIndex) ||
|
|
45
|
+
!isFiniteIndex(endColumnIndex) ||
|
|
46
|
+
endRowIndex < startRowIndex ||
|
|
47
|
+
endColumnIndex < startColumnIndex) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
ranges.push({
|
|
51
|
+
startRowIndex,
|
|
52
|
+
endRowIndex,
|
|
53
|
+
startColumnIndex,
|
|
54
|
+
endColumnIndex,
|
|
55
|
+
});
|
|
56
|
+
materialize.push((endRowIndex - startRowIndex + 1) *
|
|
57
|
+
(endColumnIndex - startColumnIndex + 1) <=
|
|
58
|
+
DV_MATERIALIZE_RANGE_CELL_CAP);
|
|
59
|
+
}
|
|
60
|
+
if (ranges.length) {
|
|
61
|
+
this.rules.push({ id: rule.id, ranges, materialize });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
get hasRules() {
|
|
66
|
+
return this.rules.length > 0;
|
|
67
|
+
}
|
|
68
|
+
/** First rule (rule-list order, matching `updateRule`/grid semantics) whose
|
|
69
|
+
* ranges contain the cell. */
|
|
70
|
+
ruleIdAt(rowIndex, columnIndex) {
|
|
71
|
+
for (const rule of this.rules) {
|
|
72
|
+
for (const range of rule.ranges) {
|
|
73
|
+
if (rowIndex >= range.startRowIndex &&
|
|
74
|
+
rowIndex <= range.endRowIndex &&
|
|
75
|
+
columnIndex >= range.startColumnIndex &&
|
|
76
|
+
columnIndex <= range.endColumnIndex) {
|
|
77
|
+
return rule.id;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Stamp an emitted row in place: covered existing cells get
|
|
85
|
+
* `dataValidation: <ruleId>`, and covered holes inside small ranges get a
|
|
86
|
+
* phantom `{ dataValidation }` cell (budget-capped).
|
|
87
|
+
*/
|
|
88
|
+
stampRow(rowIndex, values) {
|
|
89
|
+
if (!this.hasRules)
|
|
90
|
+
return;
|
|
91
|
+
this.emittedRows.add(rowIndex);
|
|
92
|
+
// Existing cells first — bounded by real data, so range size is irrelevant.
|
|
93
|
+
values.forEach((cell, columnIndex) => {
|
|
94
|
+
if (!cell || cell.dataValidation != null)
|
|
95
|
+
return;
|
|
96
|
+
const id = this.ruleIdAt(rowIndex, columnIndex);
|
|
97
|
+
if (id !== undefined) {
|
|
98
|
+
values[columnIndex] = { ...cell, dataValidation: id };
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
// Then materialize covered holes (first rule wins via the null check).
|
|
102
|
+
for (const rule of this.rules) {
|
|
103
|
+
for (let i = 0; i < rule.ranges.length; i++) {
|
|
104
|
+
if (!rule.materialize[i])
|
|
105
|
+
continue;
|
|
106
|
+
const range = rule.ranges[i];
|
|
107
|
+
if (rowIndex < range.startRowIndex || rowIndex > range.endRowIndex) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
for (let columnIndex = range.startColumnIndex; columnIndex <= range.endColumnIndex && this.materializeBudget > 0; columnIndex++) {
|
|
111
|
+
if (values[columnIndex] != null)
|
|
112
|
+
continue;
|
|
113
|
+
values[columnIndex] = { dataValidation: rule.id };
|
|
114
|
+
this.materializeBudget--;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Rows covered by small ranges that never streamed out of the file at all
|
|
121
|
+
* (fully blank template rows). Returns sparse phantom rows to append to the
|
|
122
|
+
* sheet's final chunk, in ascending row order.
|
|
123
|
+
*/
|
|
124
|
+
trailingRows() {
|
|
125
|
+
if (!this.hasRules)
|
|
126
|
+
return [];
|
|
127
|
+
const rowsByIndex = new Map();
|
|
128
|
+
for (const rule of this.rules) {
|
|
129
|
+
for (let i = 0; i < rule.ranges.length; i++) {
|
|
130
|
+
if (!rule.materialize[i])
|
|
131
|
+
continue;
|
|
132
|
+
const range = rule.ranges[i];
|
|
133
|
+
for (let rowIndex = range.startRowIndex; rowIndex <= range.endRowIndex; rowIndex++) {
|
|
134
|
+
if (this.emittedRows.has(rowIndex))
|
|
135
|
+
continue;
|
|
136
|
+
let values = rowsByIndex.get(rowIndex);
|
|
137
|
+
if (!values) {
|
|
138
|
+
values = [];
|
|
139
|
+
rowsByIndex.set(rowIndex, values);
|
|
140
|
+
}
|
|
141
|
+
for (let columnIndex = range.startColumnIndex; columnIndex <= range.endColumnIndex && this.materializeBudget > 0; columnIndex++) {
|
|
142
|
+
if (values[columnIndex] != null)
|
|
143
|
+
continue;
|
|
144
|
+
values[columnIndex] = { dataValidation: rule.id };
|
|
145
|
+
this.materializeBudget--;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return [...rowsByIndex.entries()]
|
|
151
|
+
.filter(([, values]) => values.length > 0)
|
|
152
|
+
.sort(([a], [b]) => a - b)
|
|
153
|
+
.map(([rowIndex, values]) => ({ rowIndex, values }));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { GridRange } from "@rowsncolumns/common-types";
|
|
2
|
+
import type { FilterSpec } from "@rowsncolumns/spreadsheet";
|
|
3
|
+
export declare const getRangeFromAddressRef: (ref: string) => GridRange | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Convert an xlsx column width (in units of max-digit-width of the
|
|
6
|
+
* default workbook font, Calibri 11 → MDW=7px) to pixels.
|
|
7
|
+
*
|
|
8
|
+
* Excel's effective rendered pixel count includes a 5-pixel padding
|
|
9
|
+
* baked into the column box: `pixels = floor(width × MDW + padding)`.
|
|
10
|
+
* The default width "8.43" renders as 64 px (8.43 × 7 + 5 ≈ 64.01),
|
|
11
|
+
* matching Excel exactly. The "pure" ECMA-376 §18.3.1.13 formula omits
|
|
12
|
+
* the 5px padding; we keep the +5 form so our pixel output matches
|
|
13
|
+
* Excel's rendered widths and round-trips with our exporter.
|
|
14
|
+
*/
|
|
15
|
+
export declare function excelColumnWidthToPixels(width: number): number;
|
|
16
|
+
export declare function findMax(arr: number[]): number;
|
|
17
|
+
export declare function createFilterSpecsFromAutoFilter(autoFilter: any,
|
|
18
|
+
/**
|
|
19
|
+
* Optional dxf resolver — called with (dxfId, cellColor) to return a
|
|
20
|
+
* hex color string. When omitted, `<colorFilter>` entries are skipped
|
|
21
|
+
* (caller doesn't have access to workbook dxfs).
|
|
22
|
+
*/
|
|
23
|
+
resolveDxfColor?: (dxfId: number, cellColor: boolean) => string | undefined): FilterSpec[];
|
|
24
|
+
/**
|
|
25
|
+
* Reads an Excel file and extracts sheet metadata
|
|
26
|
+
*/
|
|
27
|
+
export declare function readExcelFile(file: File | ArrayBuffer): Promise<ArrayBuffer>;
|
|
28
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../excel-parser/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAY,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAStE,eAAO,MAAM,sBAAsB,GAAI,KAAK,MAAM,KAAG,SAAS,GAAG,SAIhE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,UAIrD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,UAMpC;AAuBD,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,GAAG;AACf;;;;GAIG;AACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,gBA8F5E;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,wBAkB3D"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { customFiltersToCondition, dynamicFilterToCondition, } from "../autofilter-condition";
|
|
2
|
+
import { addressToSelection } from "@rowsncolumns/utils";
|
|
3
|
+
export const getRangeFromAddressRef = (ref) => {
|
|
4
|
+
const selection = addressToSelection(ref);
|
|
5
|
+
if (!selection)
|
|
6
|
+
return undefined;
|
|
7
|
+
return selection.range;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Convert an xlsx column width (in units of max-digit-width of the
|
|
11
|
+
* default workbook font, Calibri 11 → MDW=7px) to pixels.
|
|
12
|
+
*
|
|
13
|
+
* Excel's effective rendered pixel count includes a 5-pixel padding
|
|
14
|
+
* baked into the column box: `pixels = floor(width × MDW + padding)`.
|
|
15
|
+
* The default width "8.43" renders as 64 px (8.43 × 7 + 5 ≈ 64.01),
|
|
16
|
+
* matching Excel exactly. The "pure" ECMA-376 §18.3.1.13 formula omits
|
|
17
|
+
* the 5px padding; we keep the +5 form so our pixel output matches
|
|
18
|
+
* Excel's rendered widths and round-trips with our exporter.
|
|
19
|
+
*/
|
|
20
|
+
export function excelColumnWidthToPixels(width) {
|
|
21
|
+
const padding = 5;
|
|
22
|
+
const charWidth = 7;
|
|
23
|
+
return Math.floor(width * charWidth + padding);
|
|
24
|
+
}
|
|
25
|
+
export function findMax(arr) {
|
|
26
|
+
let max = arr[0];
|
|
27
|
+
for (let i = 1; i < arr.length; i++) {
|
|
28
|
+
if (arr[i] > max)
|
|
29
|
+
max = arr[i];
|
|
30
|
+
}
|
|
31
|
+
return max;
|
|
32
|
+
}
|
|
33
|
+
const getNodeText = (node) => {
|
|
34
|
+
if (node === undefined || node === null) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
if (typeof node === "object") {
|
|
38
|
+
if ("t$" in node && node.t$ !== undefined) {
|
|
39
|
+
return node.t$;
|
|
40
|
+
}
|
|
41
|
+
if ("_" in node && node._ !== undefined) {
|
|
42
|
+
return node._;
|
|
43
|
+
}
|
|
44
|
+
if ("#text" in node && node["#text"] !== undefined) {
|
|
45
|
+
return node["#text"];
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
return String(node);
|
|
50
|
+
};
|
|
51
|
+
export function createFilterSpecsFromAutoFilter(autoFilter,
|
|
52
|
+
/**
|
|
53
|
+
* Optional dxf resolver — called with (dxfId, cellColor) to return a
|
|
54
|
+
* hex color string. When omitted, `<colorFilter>` entries are skipped
|
|
55
|
+
* (caller doesn't have access to workbook dxfs).
|
|
56
|
+
*/
|
|
57
|
+
resolveDxfColor) {
|
|
58
|
+
const filterSpecs = [];
|
|
59
|
+
// Handle both with and without namespace prefix
|
|
60
|
+
const filterColumn = autoFilter?.filterColumn ?? autoFilter?.["x:filterColumn"];
|
|
61
|
+
if (!filterColumn) {
|
|
62
|
+
return filterSpecs;
|
|
63
|
+
}
|
|
64
|
+
const filterColumns = Array.isArray(filterColumn)
|
|
65
|
+
? filterColumn
|
|
66
|
+
: [filterColumn];
|
|
67
|
+
for (const col of filterColumns) {
|
|
68
|
+
const columnIndex = parseInt(col.a$.colId);
|
|
69
|
+
const criteria = {};
|
|
70
|
+
// <filters><filter val=…/></filters>
|
|
71
|
+
const filtersObj = col.filters ?? col["x:filters"];
|
|
72
|
+
const filter = filtersObj?.filter ?? filtersObj?.["x:filter"];
|
|
73
|
+
if (filter) {
|
|
74
|
+
const filterArray = Array.isArray(filter) ? filter : [filter];
|
|
75
|
+
criteria.visibleValues = filterArray.map((f) => f.a$.val);
|
|
76
|
+
}
|
|
77
|
+
// <colorFilter dxfId="…" cellColor="1|0"/>
|
|
78
|
+
const colorFilterNode = col.colorFilter ?? col["x:colorFilter"];
|
|
79
|
+
if (colorFilterNode && resolveDxfColor) {
|
|
80
|
+
const attrs = colorFilterNode.a$ ?? colorFilterNode;
|
|
81
|
+
const dxfIdRaw = attrs?.dxfId;
|
|
82
|
+
if (dxfIdRaw !== undefined) {
|
|
83
|
+
const dxfId = parseInt(String(dxfIdRaw), 10);
|
|
84
|
+
const cellColor = attrs?.cellColor !== "0" && attrs?.cellColor !== "false";
|
|
85
|
+
if (Number.isFinite(dxfId)) {
|
|
86
|
+
const color = resolveDxfColor(dxfId, cellColor);
|
|
87
|
+
if (color) {
|
|
88
|
+
criteria.colorFilter = {
|
|
89
|
+
color,
|
|
90
|
+
mode: cellColor ? "cellColor" : "fontColor",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// <iconFilter iconSet="…" iconId="…"/>
|
|
97
|
+
const iconFilterNode = col.iconFilter ?? col["x:iconFilter"];
|
|
98
|
+
if (iconFilterNode) {
|
|
99
|
+
const attrs = iconFilterNode.a$ ?? iconFilterNode;
|
|
100
|
+
const iconSet = attrs?.iconSet;
|
|
101
|
+
if (typeof iconSet === "string" && iconSet.length) {
|
|
102
|
+
const iconIdRaw = attrs?.iconId;
|
|
103
|
+
const iconId = typeof iconIdRaw === "string" || typeof iconIdRaw === "number"
|
|
104
|
+
? parseInt(String(iconIdRaw), 10)
|
|
105
|
+
: 0;
|
|
106
|
+
criteria.iconFilter = {
|
|
107
|
+
iconSet,
|
|
108
|
+
iconId: Number.isFinite(iconId) ? iconId : 0,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// <customFilters and="1"><customFilter operator=… val=…/></customFilters>
|
|
113
|
+
const customFiltersNode = col.customFilters ?? col["x:customFilters"];
|
|
114
|
+
if (customFiltersNode) {
|
|
115
|
+
const cfAttrs = customFiltersNode.a$ ?? customFiltersNode;
|
|
116
|
+
const and = cfAttrs?.and === "1" || cfAttrs?.and === "true";
|
|
117
|
+
const cfRaw = customFiltersNode.customFilter ?? customFiltersNode["x:customFilter"];
|
|
118
|
+
const cfArray = (Array.isArray(cfRaw) ? cfRaw : cfRaw ? [cfRaw] : []).map((f) => {
|
|
119
|
+
const a = f.a$ ?? f;
|
|
120
|
+
return { operator: a?.operator, val: a?.val };
|
|
121
|
+
});
|
|
122
|
+
const condition = customFiltersToCondition(cfArray, and);
|
|
123
|
+
if (condition)
|
|
124
|
+
criteria.condition = condition;
|
|
125
|
+
}
|
|
126
|
+
// <dynamicFilter type="thisMonth"/> etc.
|
|
127
|
+
const dynamicNode = col.dynamicFilter ?? col["x:dynamicFilter"];
|
|
128
|
+
if (dynamicNode && !criteria.condition) {
|
|
129
|
+
const dynAttrs = dynamicNode.a$ ?? dynamicNode;
|
|
130
|
+
const condition = dynamicFilterToCondition(dynAttrs?.type);
|
|
131
|
+
if (condition)
|
|
132
|
+
criteria.condition = condition;
|
|
133
|
+
}
|
|
134
|
+
if (Object.keys(criteria).length > 0) {
|
|
135
|
+
filterSpecs.push({ columnIndex, filterCriteria: criteria });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return filterSpecs.sort((a, b) => a.columnIndex - b.columnIndex);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Reads an Excel file and extracts sheet metadata
|
|
142
|
+
*/
|
|
143
|
+
export async function readExcelFile(file) {
|
|
144
|
+
try {
|
|
145
|
+
// Read file as ArrayBuffer
|
|
146
|
+
const buffer = file instanceof File
|
|
147
|
+
? await new Promise((resolve, reject) => {
|
|
148
|
+
const reader = new FileReader();
|
|
149
|
+
reader.onload = () => resolve(reader.result);
|
|
150
|
+
reader.onerror = reject;
|
|
151
|
+
reader.readAsArrayBuffer(file);
|
|
152
|
+
})
|
|
153
|
+
: file;
|
|
154
|
+
return buffer;
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
console.error(error);
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
}
|