@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
package/LICENSE.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Rows n' Columns Commercial License Agreement
|
|
2
|
+
|
|
3
|
+
This Rows n' Columns Commercial License Agreement (the "Agreement") governs
|
|
4
|
+
the use of the Rows n' Columns software packages published under the
|
|
5
|
+
`@rowsncolumns` npm scope, including associated JavaScript, WebAssembly
|
|
6
|
+
binaries, stylesheets, type definitions and documentation (the "Software").
|
|
7
|
+
|
|
8
|
+
The Software is **not** open source. Downloading or installing the Software
|
|
9
|
+
from a public package registry does not grant any right to use it beyond the
|
|
10
|
+
evaluation use described below.
|
|
11
|
+
|
|
12
|
+
## 1. Definitions
|
|
13
|
+
|
|
14
|
+
- **"Licensor"** means Rows n' Columns (rowsncolumns.app).
|
|
15
|
+
- **"Licensee"** means the individual or legal entity identified in an Order.
|
|
16
|
+
- **"Order"** means a purchase of a license for the Software from Licensor,
|
|
17
|
+
identified by an order ID and associated with a License Key.
|
|
18
|
+
- **"License Key"** means the signed key issued by Licensor that identifies
|
|
19
|
+
the Licensee, license tier, and Update Window.
|
|
20
|
+
- **"Update Window"** means the period stated in the Order during which
|
|
21
|
+
Software versions released by Licensor are covered by the License Key.
|
|
22
|
+
|
|
23
|
+
## 2. License Grant
|
|
24
|
+
|
|
25
|
+
Subject to payment of the applicable fees and compliance with this Agreement,
|
|
26
|
+
Licensor grants Licensee a non-exclusive, non-transferable, worldwide license
|
|
27
|
+
to use, and to distribute in compiled form as an embedded component of
|
|
28
|
+
Licensee's own applications, any version of the Software released during the
|
|
29
|
+
Update Window, in accordance with the license tier stated in the Order.
|
|
30
|
+
|
|
31
|
+
This grant is perpetual for versions released during the Update Window:
|
|
32
|
+
Licensee may continue to use those versions after the Update Window ends.
|
|
33
|
+
Versions released after the Update Window ends require a new or renewed
|
|
34
|
+
Order.
|
|
35
|
+
|
|
36
|
+
## 3. Evaluation Use
|
|
37
|
+
|
|
38
|
+
The Software may be used without a License Key solely for internal
|
|
39
|
+
evaluation and development purposes. Evaluation use in production, or
|
|
40
|
+
removal or suppression of evaluation notices, is not permitted.
|
|
41
|
+
|
|
42
|
+
## 4. Restrictions
|
|
43
|
+
|
|
44
|
+
Except as expressly permitted by this Agreement or by applicable law that
|
|
45
|
+
cannot be contractually waived, Licensee shall not:
|
|
46
|
+
|
|
47
|
+
1. redistribute, resell, sublicense, or otherwise make the Software
|
|
48
|
+
available as a standalone product, library, or development component;
|
|
49
|
+
2. use the Software to build a product that competes with the Software;
|
|
50
|
+
3. remove, alter, or circumvent License Key validation, evaluation notices,
|
|
51
|
+
watermarks, or copyright notices in the Software;
|
|
52
|
+
4. share License Keys with any third party, or use a License Key outside
|
|
53
|
+
the scope of the tier stated in the Order;
|
|
54
|
+
5. reverse engineer, decompile, or disassemble the Software except to the
|
|
55
|
+
extent permitted by applicable law.
|
|
56
|
+
|
|
57
|
+
## 5. Ownership
|
|
58
|
+
|
|
59
|
+
The Software is licensed, not sold. Licensor and its licensors retain all
|
|
60
|
+
right, title, and interest in and to the Software, including all
|
|
61
|
+
intellectual property rights.
|
|
62
|
+
|
|
63
|
+
## 6. Third-Party Components
|
|
64
|
+
|
|
65
|
+
The Software may include third-party open-source components. Those
|
|
66
|
+
components remain governed by their own license terms, which are included
|
|
67
|
+
with the applicable component and are not limited by this Agreement.
|
|
68
|
+
|
|
69
|
+
## 7. Termination
|
|
70
|
+
|
|
71
|
+
This Agreement terminates automatically upon material breach by Licensee
|
|
72
|
+
that remains uncured 30 days after written notice. Upon termination,
|
|
73
|
+
Licensee must cease use and distribution of the Software, except that
|
|
74
|
+
end-user copies of Licensee applications already distributed in compliance
|
|
75
|
+
with this Agreement are unaffected.
|
|
76
|
+
|
|
77
|
+
## 8. Warranty Disclaimer
|
|
78
|
+
|
|
79
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
80
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
81
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
82
|
+
|
|
83
|
+
## 9. Limitation of Liability
|
|
84
|
+
|
|
85
|
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL LICENSOR BE LIABLE
|
|
86
|
+
FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES,
|
|
87
|
+
OR ANY LOSS OF PROFITS, DATA, OR GOODWILL, ARISING OUT OF OR RELATED TO THIS
|
|
88
|
+
AGREEMENT, AND LICENSOR'S AGGREGATE LIABILITY SHALL NOT EXCEED THE FEES PAID
|
|
89
|
+
BY LICENSEE IN THE TWELVE MONTHS PRECEDING THE CLAIM.
|
|
90
|
+
|
|
91
|
+
## 10. General
|
|
92
|
+
|
|
93
|
+
This Agreement constitutes the entire agreement between the parties
|
|
94
|
+
concerning the Software and supersedes any prior agreements. If any
|
|
95
|
+
provision is held unenforceable, the remainder remains in effect. Failure to
|
|
96
|
+
enforce a provision is not a waiver.
|
|
97
|
+
|
|
98
|
+
For licensing inquiries, visit <https://www.rowsncolumns.app/pricing>.
|
|
99
|
+
|
|
100
|
+
Copyright © Rows n' Columns. All rights reserved.
|
package/Readme.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Excel import/export toolkit
|
|
2
|
+
|
|
3
|
+
## Reading Excel file from NodeJS
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { Workbook, getSheets, getCharts, processSheetData } from "@rowsncolumns/toolkit"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const workbook = new Workbook()
|
|
10
|
+
|
|
11
|
+
// Load the excel file to workbook
|
|
12
|
+
await workbook.load(file)
|
|
13
|
+
|
|
14
|
+
const [sheets, tables, dataValidations] = await getSheets(workbook)
|
|
15
|
+
|
|
16
|
+
// SheetData
|
|
17
|
+
|
|
18
|
+
for await (const result of processSheetData(workbook,e.data.pageSize)) {
|
|
19
|
+
// Process result
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Charts
|
|
23
|
+
const charts = await getCharts(workbook);
|
|
24
|
+
|
|
25
|
+
// Cleanup
|
|
26
|
+
workbook.dispose();
|
|
27
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ConditionType } from "@rowsncolumns/common-types";
|
|
2
|
+
/**
|
|
3
|
+
* Bidirectional mapping between the in-app AutoFilter `filterCriteria.condition`
|
|
4
|
+
* ({type, values}) and Excel's `<customFilters>` / `<dynamicFilter>` XML.
|
|
5
|
+
*
|
|
6
|
+
* Excel autoFilter supports three condition shapes (besides value-list /
|
|
7
|
+
* color / icon): customFilter comparisons (number/text/date), two-filter
|
|
8
|
+
* AND/OR ranges (between / not-between), and dynamicFilter (relative dates +
|
|
9
|
+
* above/below average). This module keeps export and import symmetric so a
|
|
10
|
+
* condition filter survives an XLSX round-trip (previously dropped both ways).
|
|
11
|
+
*
|
|
12
|
+
* Round-trip fidelity note: Excel's customFilter has no number-vs-date tag, so
|
|
13
|
+
* date comparison filters re-import as the NUMBER_* equivalent. The comparison
|
|
14
|
+
* itself (>, <, between, …) — and therefore which rows stay visible — is
|
|
15
|
+
* preserved, which is the point.
|
|
16
|
+
*/
|
|
17
|
+
type ConditionValue = {
|
|
18
|
+
userEnteredValue: string;
|
|
19
|
+
};
|
|
20
|
+
export type AutoFilterCondition = {
|
|
21
|
+
type: ConditionType;
|
|
22
|
+
values: ConditionValue[];
|
|
23
|
+
};
|
|
24
|
+
export type RawCustomFilter = {
|
|
25
|
+
operator?: string;
|
|
26
|
+
val?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Build the `<customFilters>` / `<dynamicFilter>` XML for a filter condition,
|
|
30
|
+
* or `null` when the condition type has no AutoFilter representation (BLANK /
|
|
31
|
+
* ERROR / CUSTOM_FORMULA / ONE_OF_* / DATE_LAST_7_DAYS / …) — the caller then
|
|
32
|
+
* falls back to a value-list `<filters>`.
|
|
33
|
+
*/
|
|
34
|
+
export declare const buildAutoFilterConditionXml: (condition: {
|
|
35
|
+
type?: ConditionType | null;
|
|
36
|
+
values?: ConditionValue[] | null;
|
|
37
|
+
} | null | undefined) => string | null;
|
|
38
|
+
/** Map an Excel `<dynamicFilter type=…>` back to a condition, or null. */
|
|
39
|
+
export declare const dynamicFilterToCondition: (type: string | undefined) => AutoFilterCondition | null;
|
|
40
|
+
/** Map Excel `<customFilters>` children back to a condition, or null. */
|
|
41
|
+
export declare const customFiltersToCondition: (filters: RawCustomFilter[], and: boolean) => AutoFilterCondition | null;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=autofilter-condition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autofilter-condition.d.ts","sourceRoot":"","sources":["../../autofilter-condition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;;;;;;;;GAcG;AAEH,KAAK,cAAc,GAAG;IAAE,gBAAgB,EAAE,MAAM,CAAA;CAAE,CAAC;AACnD,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAmElE;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GACtC,WAAW;IAAE,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,KAC9F,MAAM,GAAG,IA4BX,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,GACnC,MAAM,MAAM,GAAG,SAAS,KACvB,mBAAmB,GAAG,IAIxB,CAAC;AAIF,yEAAyE;AACzE,eAAO,MAAM,wBAAwB,GACnC,SAAS,eAAe,EAAE,EAC1B,KAAK,OAAO,KACX,mBAAmB,GAAG,IA6CxB,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
2
|
+
var escapeXml = function (value) {
|
|
3
|
+
return String(value)
|
|
4
|
+
.replace(/&/g, "&")
|
|
5
|
+
.replace(/</g, "<")
|
|
6
|
+
.replace(/>/g, ">")
|
|
7
|
+
.replace(/"/g, """)
|
|
8
|
+
.replace(/'/g, "'");
|
|
9
|
+
};
|
|
10
|
+
// condition type -> Excel dynamicFilter `type` attribute
|
|
11
|
+
var DYNAMIC_BY_TYPE = {
|
|
12
|
+
DATE_TODAY: "today",
|
|
13
|
+
DATE_YESTERDAY: "yesterday",
|
|
14
|
+
DATE_TOMORROW: "tomorrow",
|
|
15
|
+
DATE_THIS_WEEK: "thisWeek",
|
|
16
|
+
DATE_LAST_WEEK: "lastWeek",
|
|
17
|
+
DATE_NEXT_WEEK: "nextWeek",
|
|
18
|
+
DATE_THIS_MONTH: "thisMonth",
|
|
19
|
+
DATE_LAST_MONTH: "lastMonth",
|
|
20
|
+
DATE_NEXT_MONTH: "nextMonth",
|
|
21
|
+
NUMBER_ABOVE_AVERAGE: "aboveAverage",
|
|
22
|
+
NUMBER_BELOW_AVERAGE: "belowAverage",
|
|
23
|
+
};
|
|
24
|
+
var TYPE_BY_DYNAMIC = Object.fromEntries(Object.entries(DYNAMIC_BY_TYPE).map(function (_a) {
|
|
25
|
+
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
|
26
|
+
return [v, k];
|
|
27
|
+
}));
|
|
28
|
+
// condition type -> single customFilter operator (number + date comparisons)
|
|
29
|
+
var OPERATOR_BY_TYPE = {
|
|
30
|
+
NUMBER_GREATER: "greaterThan",
|
|
31
|
+
DATE_AFTER: "greaterThan",
|
|
32
|
+
NUMBER_GREATER_THAN_EQ: "greaterThanOrEqual",
|
|
33
|
+
DATE_ON_OR_AFTER: "greaterThanOrEqual",
|
|
34
|
+
NUMBER_LESS: "lessThan",
|
|
35
|
+
DATE_BEFORE: "lessThan",
|
|
36
|
+
NUMBER_LESS_THAN_EQ: "lessThanOrEqual",
|
|
37
|
+
DATE_ON_OR_BEFORE: "lessThanOrEqual",
|
|
38
|
+
NUMBER_EQ: "equal",
|
|
39
|
+
DATE_EQ: "equal",
|
|
40
|
+
NUMBER_NOT_EQ: "notEqual",
|
|
41
|
+
DATE_NOT_EQ: "notEqual",
|
|
42
|
+
};
|
|
43
|
+
var TYPE_BY_OPERATOR = {
|
|
44
|
+
greaterThan: "NUMBER_GREATER",
|
|
45
|
+
greaterThanOrEqual: "NUMBER_GREATER_THAN_EQ",
|
|
46
|
+
lessThan: "NUMBER_LESS",
|
|
47
|
+
lessThanOrEqual: "NUMBER_LESS_THAN_EQ",
|
|
48
|
+
equal: "NUMBER_EQ",
|
|
49
|
+
notEqual: "NUMBER_NOT_EQ",
|
|
50
|
+
};
|
|
51
|
+
// text condition type -> {operator, how to wrap the value with wildcards}
|
|
52
|
+
var TEXT_WRAP = {
|
|
53
|
+
TEXT_EQ: { op: "equal", wrap: function (v) { return v; } },
|
|
54
|
+
TEXT_NOT_EQ: { op: "notEqual", wrap: function (v) { return v; } },
|
|
55
|
+
TEXT_CONTAINS: { op: "equal", wrap: function (v) { return "*".concat(v, "*"); } },
|
|
56
|
+
TEXT_NOT_CONTAINS: { op: "notEqual", wrap: function (v) { return "*".concat(v, "*"); } },
|
|
57
|
+
TEXT_STARTS_WITH: { op: "equal", wrap: function (v) { return "".concat(v, "*"); } },
|
|
58
|
+
TEXT_ENDS_WITH: { op: "equal", wrap: function (v) { return "*".concat(v); } },
|
|
59
|
+
};
|
|
60
|
+
var customFilterXml = function (operator, val) {
|
|
61
|
+
return "<customFilter operator=\"".concat(operator, "\" val=\"").concat(escapeXml(val), "\"/>");
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Build the `<customFilters>` / `<dynamicFilter>` XML for a filter condition,
|
|
65
|
+
* or `null` when the condition type has no AutoFilter representation (BLANK /
|
|
66
|
+
* ERROR / CUSTOM_FORMULA / ONE_OF_* / DATE_LAST_7_DAYS / …) — the caller then
|
|
67
|
+
* falls back to a value-list `<filters>`.
|
|
68
|
+
*/
|
|
69
|
+
export var buildAutoFilterConditionXml = function (condition) {
|
|
70
|
+
var _a, _b, _c;
|
|
71
|
+
var type = condition === null || condition === void 0 ? void 0 : condition.type;
|
|
72
|
+
if (!type)
|
|
73
|
+
return null;
|
|
74
|
+
var values = (_a = condition === null || condition === void 0 ? void 0 : condition.values) !== null && _a !== void 0 ? _a : [];
|
|
75
|
+
var v0 = (_b = values[0]) === null || _b === void 0 ? void 0 : _b.userEnteredValue;
|
|
76
|
+
var v1 = (_c = values[1]) === null || _c === void 0 ? void 0 : _c.userEnteredValue;
|
|
77
|
+
var dynamic = DYNAMIC_BY_TYPE[type];
|
|
78
|
+
if (dynamic)
|
|
79
|
+
return "<dynamicFilter type=\"".concat(dynamic, "\"/>");
|
|
80
|
+
if (type === "NUMBER_BETWEEN" || type === "DATE_BETWEEN") {
|
|
81
|
+
if (v0 == null || v1 == null)
|
|
82
|
+
return null;
|
|
83
|
+
return "<customFilters and=\"1\">".concat(customFilterXml("greaterThanOrEqual", v0)).concat(customFilterXml("lessThanOrEqual", v1), "</customFilters>");
|
|
84
|
+
}
|
|
85
|
+
if (type === "NUMBER_NOT_BETWEEN" || type === "DATE_NOT_BETWEEN") {
|
|
86
|
+
if (v0 == null || v1 == null)
|
|
87
|
+
return null;
|
|
88
|
+
return "<customFilters>".concat(customFilterXml("lessThan", v0)).concat(customFilterXml("greaterThan", v1), "</customFilters>");
|
|
89
|
+
}
|
|
90
|
+
var op = OPERATOR_BY_TYPE[type];
|
|
91
|
+
if (op && v0 != null) {
|
|
92
|
+
return "<customFilters>".concat(customFilterXml(op, v0), "</customFilters>");
|
|
93
|
+
}
|
|
94
|
+
var text = TEXT_WRAP[type];
|
|
95
|
+
if (text && v0 != null) {
|
|
96
|
+
return "<customFilters>".concat(customFilterXml(text.op, text.wrap(v0)), "</customFilters>");
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
};
|
|
100
|
+
/** Map an Excel `<dynamicFilter type=…>` back to a condition, or null. */
|
|
101
|
+
export var dynamicFilterToCondition = function (type) {
|
|
102
|
+
if (!type)
|
|
103
|
+
return null;
|
|
104
|
+
var conditionType = TYPE_BY_DYNAMIC[type];
|
|
105
|
+
return conditionType ? { type: conditionType, values: [] } : null;
|
|
106
|
+
};
|
|
107
|
+
var isNumeric = function (v) { return v !== "" && !Number.isNaN(Number(v)); };
|
|
108
|
+
/** Map Excel `<customFilters>` children back to a condition, or null. */
|
|
109
|
+
export var customFiltersToCondition = function (filters, and) {
|
|
110
|
+
var _a, _b, _c, _d;
|
|
111
|
+
var valid = filters.filter(function (f) { return f && f.val !== undefined; });
|
|
112
|
+
if (valid.length === 0)
|
|
113
|
+
return null;
|
|
114
|
+
// Two filters => a range (between when AND, not-between when OR).
|
|
115
|
+
if (valid.length >= 2) {
|
|
116
|
+
var v0 = String((_a = valid[0].val) !== null && _a !== void 0 ? _a : "");
|
|
117
|
+
var v1 = String((_b = valid[1].val) !== null && _b !== void 0 ? _b : "");
|
|
118
|
+
return {
|
|
119
|
+
type: and ? "NUMBER_BETWEEN" : "NUMBER_NOT_BETWEEN",
|
|
120
|
+
values: [{ userEnteredValue: v0 }, { userEnteredValue: v1 }],
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
var operator = (_c = valid[0].operator) !== null && _c !== void 0 ? _c : "equal";
|
|
124
|
+
var val = String((_d = valid[0].val) !== null && _d !== void 0 ? _d : "");
|
|
125
|
+
// Text wildcards: equal/notEqual carrying * map back to contains/starts/ends.
|
|
126
|
+
if ((operator === "equal" || operator === "notEqual") && /[*?]/.test(val)) {
|
|
127
|
+
var negated = operator === "notEqual";
|
|
128
|
+
var lead = val.startsWith("*");
|
|
129
|
+
var trail = val.endsWith("*");
|
|
130
|
+
var core = val.replace(/^\*/, "").replace(/\*$/, "");
|
|
131
|
+
if (lead && trail) {
|
|
132
|
+
return {
|
|
133
|
+
type: negated ? "TEXT_NOT_CONTAINS" : "TEXT_CONTAINS",
|
|
134
|
+
values: [{ userEnteredValue: core }],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (trail) {
|
|
138
|
+
return { type: "TEXT_STARTS_WITH", values: [{ userEnteredValue: core }] };
|
|
139
|
+
}
|
|
140
|
+
if (lead) {
|
|
141
|
+
return { type: "TEXT_ENDS_WITH", values: [{ userEnteredValue: core }] };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
var conditionType = TYPE_BY_OPERATOR[operator];
|
|
145
|
+
if (!conditionType)
|
|
146
|
+
return null;
|
|
147
|
+
// A non-numeric equal/notEqual is a text equality, not a numeric one.
|
|
148
|
+
if (!isNumeric(val)) {
|
|
149
|
+
if (operator === "equal")
|
|
150
|
+
conditionType = "TEXT_EQ";
|
|
151
|
+
else if (operator === "notEqual")
|
|
152
|
+
conditionType = "TEXT_NOT_EQ";
|
|
153
|
+
}
|
|
154
|
+
return { type: conditionType, values: [{ userEnteredValue: val }] };
|
|
155
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CellData, Sheet } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import type { RowData, RowDataWithValue } from "@rowsncolumns/common-types";
|
|
3
|
+
import { type SharedStrings } from "@rowsncolumns/spreadsheet-state";
|
|
4
|
+
type ExportCSVProps<T extends CellData | null> = {
|
|
5
|
+
rowData: (RowData<T | null> | RowDataWithValue<T | null> | null)[];
|
|
6
|
+
sharedStrings?: SharedStrings;
|
|
7
|
+
config?: {
|
|
8
|
+
delimiter?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Prepend a UTF-8 byte-order mark to the exported file. Output is
|
|
11
|
+
* always UTF-8; the BOM only helps Excel detect the encoding when
|
|
12
|
+
* double-clicking a .csv (otherwise it assumes the ANSI codepage).
|
|
13
|
+
*/
|
|
14
|
+
includeBom?: boolean;
|
|
15
|
+
skipEmptyLines?: boolean;
|
|
16
|
+
header?: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Optional context for deriving formatted values on formula cells that
|
|
20
|
+
* don't carry a persisted `fv` (the new contract for formula cells).
|
|
21
|
+
* When provided, formula cells with no `fv` get their value formatted
|
|
22
|
+
* using the precedent-derived number format (same logic as the renderer
|
|
23
|
+
* uses).
|
|
24
|
+
*/
|
|
25
|
+
derivationContext?: {
|
|
26
|
+
sheetId: number;
|
|
27
|
+
sheetData: Record<string | number, any>;
|
|
28
|
+
sheets?: Sheet[];
|
|
29
|
+
locale?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Map of styleId -> CellFormat. Required when precedent cells'
|
|
32
|
+
* `uf` is a `{ sid }` style reference (xlsx-imported workbooks),
|
|
33
|
+
* otherwise the derive helper can't resolve the styleId.
|
|
34
|
+
*/
|
|
35
|
+
cellXfs?: Map<string | number, any> | null;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Create csv string from sheetData using XLSX
|
|
40
|
+
* @param rowData
|
|
41
|
+
* @param config
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
export declare const createCSVFromSheetData: <T extends CellData | null>(rowData: ExportCSVProps<T>["rowData"], sharedStrings?: ExportCSVProps<T>["sharedStrings"], config?: ExportCSVProps<T>["config"], derivationContext?: ExportCSVProps<T>["derivationContext"]) => string;
|
|
45
|
+
export declare const exportToCSV: <T extends CellData | null>({ filename, rowData, sharedStrings, config, derivationContext, }: ExportCSVProps<T> & {
|
|
46
|
+
filename: string;
|
|
47
|
+
}) => string | Blob | undefined;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=csv-export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv-export.d.ts","sourceRoot":"","sources":["../../csv-export.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAgB,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,iCAAiC,CAAC;AAoBzC,KAAK,cAAc,CAAC,CAAC,SAAS,QAAQ,GAAG,IAAI,IAAI;IAC/C,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IACnE,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB;;;;WAIG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IACF;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC;QACxC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;;WAIG;QACH,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;KAC5C,CAAC;CACH,CAAC;AAgHF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,QAAQ,GAAG,IAAI,EAC9D,SAAS,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EACrC,gBAAgB,cAAc,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,EAClD,SAAS,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EACpC,oBAAoB,cAAc,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAgD3D,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,QAAQ,GAAG,IAAI,EAAE,kEAMpD,cAAc,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,8BAU1C,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { __values } from "tslib";
|
|
2
|
+
import { tokenize as defaultTokenizer } from "@rowsncolumns/calculator";
|
|
3
|
+
import { CellXfsRegistry, deriveEffectiveNumberFormatFromFormula, createFormattedValue, detectValueType, } from "@rowsncolumns/spreadsheet-state";
|
|
4
|
+
import { getCellEffectiveValue, getCellFormattedValue, getCellUserEnteredFormat, getCellUserEnteredValue, getExtendedValueBool, getExtendedValueFormula, getExtendedValueNumber, getExtendedValueString, isNil, } from "@rowsncolumns/utils";
|
|
5
|
+
var isStyleRef = function (value) {
|
|
6
|
+
return !!value && typeof value === "object" && ("sid" in value);
|
|
7
|
+
};
|
|
8
|
+
import * as XLSX from "xlsx";
|
|
9
|
+
import { isInvalidDataValidationError } from "./exporter/invalid-data-validation";
|
|
10
|
+
import { createDownloadableFile } from "./helpers";
|
|
11
|
+
var cellHasFormula = function (cell) {
|
|
12
|
+
if (!cell)
|
|
13
|
+
return false;
|
|
14
|
+
return !!getExtendedValueFormula(getCellUserEnteredValue(cell));
|
|
15
|
+
};
|
|
16
|
+
var resolveCellNumberFormat = function (cell) {
|
|
17
|
+
var _a;
|
|
18
|
+
if (!cell)
|
|
19
|
+
return undefined;
|
|
20
|
+
var uf = getCellUserEnteredFormat(cell);
|
|
21
|
+
if (!uf || isStyleRef(uf))
|
|
22
|
+
return undefined;
|
|
23
|
+
return (_a = uf.numberFormat) !== null && _a !== void 0 ? _a : undefined;
|
|
24
|
+
};
|
|
25
|
+
var deriveFormulaCellFv = function (cell, rowIndex, columnIndex, ctx) {
|
|
26
|
+
var e_1, _a;
|
|
27
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
28
|
+
var ev = getCellEffectiveValue(cell);
|
|
29
|
+
if (!ev)
|
|
30
|
+
return undefined;
|
|
31
|
+
var errorValue = ev.ev;
|
|
32
|
+
// The data-validation Invalid marker is UI-only — never render it as an
|
|
33
|
+
// error; fall through to the cell's real value below.
|
|
34
|
+
if (errorValue && !isInvalidDataValidationError(errorValue)) {
|
|
35
|
+
return (_b = errorValue.name) !== null && _b !== void 0 ? _b : "#ERROR!";
|
|
36
|
+
}
|
|
37
|
+
// Prefer uf.numberFormat; fall back to derivation from precedents.
|
|
38
|
+
var numberFormat = resolveCellNumberFormat(cell);
|
|
39
|
+
if (!numberFormat) {
|
|
40
|
+
var formula = getExtendedValueFormula(getCellUserEnteredValue(cell));
|
|
41
|
+
if (formula && ctx.sheetData) {
|
|
42
|
+
var sheetIdByName_1 = new Map();
|
|
43
|
+
try {
|
|
44
|
+
for (var _l = __values((_c = ctx.sheets) !== null && _c !== void 0 ? _c : []), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
45
|
+
var s = _m.value;
|
|
46
|
+
if (s === null || s === void 0 ? void 0 : s.title)
|
|
47
|
+
sheetIdByName_1.set(s.title, s.sheetId);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
51
|
+
finally {
|
|
52
|
+
try {
|
|
53
|
+
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
54
|
+
}
|
|
55
|
+
finally { if (e_1) throw e_1.error; }
|
|
56
|
+
}
|
|
57
|
+
// Real CellXfsRegistry so the helper can resolve precedent cells
|
|
58
|
+
// whose `uf` is a `{ sid }` style reference.
|
|
59
|
+
var cellXfsRegistry = ctx.cellXfs
|
|
60
|
+
? new CellXfsRegistry(ctx.cellXfs)
|
|
61
|
+
: undefined;
|
|
62
|
+
numberFormat =
|
|
63
|
+
(_e = deriveEffectiveNumberFormatFromFormula(formula, ctx.sheetId, rowIndex, columnIndex, ctx.sheetData, function (input) { return defaultTokenizer(input); }, function (name) { var _a; return (_a = sheetIdByName_1.get(name)) !== null && _a !== void 0 ? _a : ctx.sheetId; }, ctx.locale, cellXfsRegistry, undefined, (_d = getExtendedValueNumber(ev)) !== null && _d !== void 0 ? _d : null)) !== null && _e !== void 0 ? _e : undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
var value = (_g = (_f = getExtendedValueNumber(ev)) !== null && _f !== void 0 ? _f : getExtendedValueString(ev)) !== null && _g !== void 0 ? _g : getExtendedValueBool(ev);
|
|
67
|
+
if (value == null)
|
|
68
|
+
return undefined;
|
|
69
|
+
var valueType = (_h = detectValueType(value, ctx.locale)) !== null && _h !== void 0 ? _h : "stringValue";
|
|
70
|
+
return ((_k = createFormattedValue(value, valueType, (_j = numberFormat === null || numberFormat === void 0 ? void 0 : numberFormat.pattern) !== null && _j !== void 0 ? _j : "General", ctx.locale)) !== null && _k !== void 0 ? _k : String(value));
|
|
71
|
+
};
|
|
72
|
+
var getCellFormattedValueInternal = function (cell, rowIndex, columnIndex, sharedStrings, derivationContext) {
|
|
73
|
+
var sharedStringIndex = cell === null || cell === void 0 ? void 0 : cell.ss;
|
|
74
|
+
var sharedStringValue = !isNil(sharedStringIndex) && sharedStrings
|
|
75
|
+
? sharedStrings.get(String(sharedStringIndex))
|
|
76
|
+
: undefined;
|
|
77
|
+
if (sharedStringValue != null) {
|
|
78
|
+
// Rich shared-string entries (`{ text, runs }`) collapse to their
|
|
79
|
+
// plain text in CSV — formatting can't survive the format anyway.
|
|
80
|
+
return typeof sharedStringValue === "string"
|
|
81
|
+
? sharedStringValue
|
|
82
|
+
: sharedStringValue.text;
|
|
83
|
+
}
|
|
84
|
+
var formattedValue = getCellFormattedValue(cell);
|
|
85
|
+
if (formattedValue != null) {
|
|
86
|
+
return formattedValue;
|
|
87
|
+
}
|
|
88
|
+
// Formula cells no longer persist `fv`. If the caller provided
|
|
89
|
+
// derivation context, compute it on the fly.
|
|
90
|
+
if (cellHasFormula(cell) && derivationContext) {
|
|
91
|
+
return deriveFormulaCellFv(cell, rowIndex, columnIndex, derivationContext);
|
|
92
|
+
}
|
|
93
|
+
return undefined;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Create csv string from sheetData using XLSX
|
|
97
|
+
* @param rowData
|
|
98
|
+
* @param config
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
export var createCSVFromSheetData = function (rowData, sharedStrings, config, derivationContext) {
|
|
102
|
+
var _a, _b, _c, _d;
|
|
103
|
+
var rowCount = (_a = rowData === null || rowData === void 0 ? void 0 : rowData.length) !== null && _a !== void 0 ? _a : 0;
|
|
104
|
+
// First pass: find max column with actual data to avoid trailing commas
|
|
105
|
+
var maxColumn = 0;
|
|
106
|
+
for (var rowIndex = 1; rowIndex <= rowCount; rowIndex++) {
|
|
107
|
+
var rowValues = (_b = rowData[rowIndex]) === null || _b === void 0 ? void 0 : _b.values;
|
|
108
|
+
if (rowValues) {
|
|
109
|
+
for (var col = rowValues.length - 1; col >= 1; col--) {
|
|
110
|
+
if (rowValues[col] != null) {
|
|
111
|
+
maxColumn = Math.max(maxColumn, col);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
var worksheetData = [];
|
|
118
|
+
for (var rowIndex = 1; rowIndex <= rowCount; rowIndex++) {
|
|
119
|
+
var rowValues = (_c = rowData[rowIndex]) === null || _c === void 0 ? void 0 : _c.values;
|
|
120
|
+
var rowCells = [];
|
|
121
|
+
for (var columnIndex = 1; columnIndex <= maxColumn; columnIndex++) {
|
|
122
|
+
var cell = rowValues === null || rowValues === void 0 ? void 0 : rowValues[columnIndex];
|
|
123
|
+
rowCells.push(((_d = getCellFormattedValueInternal(cell, rowIndex, columnIndex, sharedStrings, derivationContext)) !== null && _d !== void 0 ? _d : ""));
|
|
124
|
+
}
|
|
125
|
+
worksheetData.push(rowCells);
|
|
126
|
+
}
|
|
127
|
+
// Create worksheet from 2D array
|
|
128
|
+
var worksheet = XLSX.utils.aoa_to_sheet(worksheetData);
|
|
129
|
+
// Convert to CSV string
|
|
130
|
+
return XLSX.utils.sheet_to_csv(worksheet, {
|
|
131
|
+
FS: (config === null || config === void 0 ? void 0 : config.delimiter) || ",", // Field separator
|
|
132
|
+
RS: "\n", // Record separator
|
|
133
|
+
skipHidden: true,
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
export var exportToCSV = function (_a) {
|
|
137
|
+
var filename = _a.filename, rowData = _a.rowData, sharedStrings = _a.sharedStrings, config = _a.config, derivationContext = _a.derivationContext;
|
|
138
|
+
var csv = createCSVFromSheetData(rowData, sharedStrings, config, derivationContext);
|
|
139
|
+
var content = (config === null || config === void 0 ? void 0 : config.includeBom) ? "\uFEFF" + csv : csv;
|
|
140
|
+
var blob = new Blob([content], { type: "text/csv;charset=utf-8;" });
|
|
141
|
+
return createDownloadableFile("".concat(filename, ".csv"), blob);
|
|
142
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import type { CsvWorkerResponse } from "./csv-parser/types";
|
|
3
|
+
export declare const createCSVImportWorker: (file: File | ArrayBuffer, options: {
|
|
4
|
+
pageSize: number;
|
|
5
|
+
startRowIndex: number;
|
|
6
|
+
startColumnIndex: number;
|
|
7
|
+
preserveFormatting?: boolean;
|
|
8
|
+
locale?: string;
|
|
9
|
+
enableSharedStrings?: boolean;
|
|
10
|
+
enableCellXfsRegistry?: boolean;
|
|
11
|
+
enableBackpressure?: boolean;
|
|
12
|
+
}) => {
|
|
13
|
+
observable: Observable<CsvWorkerResponse>;
|
|
14
|
+
sendMessage: (message: any) => void;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=csv-import-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv-import-worker.d.ts","sourceRoot":"","sources":["../../csv-import-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,MAAM,CAAC;AAE3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAiB5D,eAAO,MAAM,qBAAqB,GAChC,MAAM,IAAI,GAAG,WAAW,EACxB,SAAS;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;;2BAmD6B,GAAG;CAQlC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Observable, Subject } from "rxjs";
|
|
2
|
+
import { CsvRequestType, CsvResponseType } from "./csv-parser/types";
|
|
3
|
+
var getWorkerErrorMessage = function (error) {
|
|
4
|
+
if (error instanceof ErrorEvent) {
|
|
5
|
+
var parts = [error.message || "Worker runtime error"];
|
|
6
|
+
if (error.filename) {
|
|
7
|
+
var line = error.lineno ? ":".concat(error.lineno) : "";
|
|
8
|
+
var col = error.colno ? ":".concat(error.colno) : "";
|
|
9
|
+
parts.push("(".concat(error.filename).concat(line).concat(col, ")"));
|
|
10
|
+
}
|
|
11
|
+
return parts.join(" ");
|
|
12
|
+
}
|
|
13
|
+
return "Worker failed to load or crashed. Check worker URL resolution and browser console/network logs.";
|
|
14
|
+
};
|
|
15
|
+
export var createCSVImportWorker = function (file, options) {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
// Hosts whose bundlers can't resolve the `new URL(...)` worker specifier
|
|
18
|
+
// (e.g. turbopack) can supply their own worker constructor via the global.
|
|
19
|
+
var workerFactories = globalThis.__ATHENA_TOOLKIT_WORKER_FACTORIES;
|
|
20
|
+
var worker = (_b = (_a = workerFactories === null || workerFactories === void 0 ? void 0 : workerFactories.csv) === null || _a === void 0 ? void 0 : _a.call(workerFactories)) !== null && _b !== void 0 ? _b : new Worker(new URL("@rowsncolumns/toolkit/csv-worker", import.meta.url), {
|
|
21
|
+
type: "module",
|
|
22
|
+
});
|
|
23
|
+
var subject = new Subject();
|
|
24
|
+
worker.onmessage = function (e) {
|
|
25
|
+
subject.next(e.data);
|
|
26
|
+
};
|
|
27
|
+
worker.onerror = function (error) {
|
|
28
|
+
subject.next({
|
|
29
|
+
responseType: CsvResponseType.ERROR,
|
|
30
|
+
error: getWorkerErrorMessage(error),
|
|
31
|
+
});
|
|
32
|
+
subject.complete();
|
|
33
|
+
};
|
|
34
|
+
worker.postMessage({
|
|
35
|
+
requestType: CsvRequestType.PARSE_CSV,
|
|
36
|
+
file: file,
|
|
37
|
+
pageSize: options.pageSize,
|
|
38
|
+
startRowIndex: options.startRowIndex,
|
|
39
|
+
startColumnIndex: options.startColumnIndex,
|
|
40
|
+
preserveFormatting: options.preserveFormatting,
|
|
41
|
+
locale: options.locale,
|
|
42
|
+
enableSharedStrings: options.enableSharedStrings,
|
|
43
|
+
enableCellXfsRegistry: options.enableCellXfsRegistry,
|
|
44
|
+
enableBackpressure: options.enableBackpressure,
|
|
45
|
+
});
|
|
46
|
+
var observable = new Observable(function (observer) {
|
|
47
|
+
var subscription = subject.subscribe(observer);
|
|
48
|
+
return function () {
|
|
49
|
+
subscription.unsubscribe();
|
|
50
|
+
worker.terminate();
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
var sendMessage = function (message) {
|
|
54
|
+
worker.postMessage(message);
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
observable: observable,
|
|
58
|
+
sendMessage: sendMessage,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CellData } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
import type { RowData } from "@rowsncolumns/common-types";
|
|
3
|
+
type BomEncoding = "utf-8" | "utf-16le" | "utf-16be";
|
|
4
|
+
/**
|
|
5
|
+
* Sniff a byte-order mark at the start of a CSV byte stream.
|
|
6
|
+
* Returns the encoding the BOM declares, or `undefined` when no BOM
|
|
7
|
+
* is present (in which case bytes are treated as UTF-8).
|
|
8
|
+
*/
|
|
9
|
+
export declare const detectCSVBomEncoding: (bytes: Uint8Array) => BomEncoding | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Parse csv string into a 2d array
|
|
12
|
+
* https://stackoverflow.com/a/14991797
|
|
13
|
+
* @param str
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseCSV: (input: string | File) => Promise<string[][] | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Create sheet data from csv string
|
|
19
|
+
* @param csv
|
|
20
|
+
* @param delimiter
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare const createRowDataFromCSVString: <T extends CellData>(csv: string | File, preserveFormatting: boolean | undefined, locale: string | undefined) => Promise<RowData<T>[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Parse CSV file object
|
|
26
|
+
* @param file
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export declare const createRowDataFromCSVFile: <T extends CellData>(file: File, preserveFormatting: boolean | undefined, locale: string | undefined) => Promise<RowData<T>[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Create sheet data from csv string
|
|
32
|
+
* @param csv
|
|
33
|
+
* @param delimiter
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare const createCellDataArrayFromCSVString: <T extends CellData>(csv: string, locale: string | undefined) => Promise<T[][]>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=csv-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv-import.d.ts","sourceRoot":"","sources":["../../csv-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAK1D,KAAK,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,UAAU,KAChB,WAAW,GAAG,SAchB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GACnB,OAAO,MAAM,GAAG,IAAI,KACnB,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,SAAS,CAoChC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAU,CAAC,SAAS,QAAQ,EACjE,KAAK,MAAM,GAAG,IAAI,EAClB,uCAAyB,EACzB,QAAQ,MAAM,GAAG,SAAS,0BA+B3B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAU,CAAC,SAAS,QAAQ,EAC/D,MAAM,IAAI,EACV,uCAAyB,EACzB,QAAQ,MAAM,GAAG,SAAS,0BACwC,CAAC;AAErE;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,GAAU,CAAC,SAAS,QAAQ,EACvE,KAAK,MAAM,EACX,QAAQ,MAAM,GAAG,SAAS,mBAuB3B,CAAC"}
|