@cj-tech-master/excelts 5.0.6 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.browser.d.ts +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/modules/archive/unzip/stream.base.js +19 -19
- package/dist/browser/modules/archive/unzip/stream.browser.js +3 -3
- package/dist/browser/modules/csv/csv-core.js +6 -3
- package/dist/browser/modules/csv/csv.browser.js +2 -2
- package/dist/browser/modules/csv/csv.js +1 -1
- package/dist/browser/modules/excel/anchor.js +4 -4
- package/dist/browser/modules/excel/cell.js +5 -5
- package/dist/browser/modules/excel/column.js +4 -4
- package/dist/browser/modules/excel/defined-names.js +1 -1
- package/dist/browser/modules/excel/form-control.js +1 -1
- package/dist/browser/modules/excel/pivot-table.d.ts +168 -17
- package/dist/browser/modules/excel/pivot-table.js +278 -70
- package/dist/browser/modules/excel/row.js +4 -4
- package/dist/browser/modules/excel/stream/workbook-reader.browser.js +4 -4
- package/dist/browser/modules/excel/stream/workbook-writer.browser.js +4 -4
- package/dist/browser/modules/excel/stream/worksheet-reader.js +1 -1
- package/dist/browser/modules/excel/stream/worksheet-writer.js +4 -4
- package/dist/browser/modules/excel/table.js +2 -2
- package/dist/browser/modules/excel/types.d.ts +0 -4
- package/dist/browser/modules/excel/utils/cell-format.js +3 -3
- package/dist/browser/modules/excel/utils/shared-formula.js +1 -1
- package/dist/browser/modules/excel/utils/stream-buf.js +2 -2
- package/dist/browser/modules/excel/utils/string-buf.js +1 -1
- package/dist/browser/modules/excel/workbook.d.ts +0 -2
- package/dist/browser/modules/excel/workbook.js +4 -5
- package/dist/browser/modules/excel/worksheet.js +9 -9
- package/dist/browser/modules/excel/xlsx/xform/base-xform.d.ts +5 -5
- package/dist/browser/modules/excel/xlsx/xform/base-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.js +2 -2
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-view-xform.js +4 -4
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +16 -4
- package/dist/browser/modules/excel/xlsx/xform/comment/comment-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/comment/comments-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/comment/style/vml-position-xform.d.ts +3 -4
- package/dist/browser/modules/excel/xlsx/xform/comment/style/vml-position-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/comment/style/vml-protection-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/comment/vml-client-data-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/comment/vml-notes-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/comment/vml-shape-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/comment/vml-textbox-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/comment/vml-textbox-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/composite-xform.d.ts +1 -1
- package/dist/browser/modules/excel/xlsx/xform/core/app-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +24 -11
- package/dist/browser/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/blip-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/drawing/cell-position-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/drawing/ext-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/drawing/ext-xform.js +2 -2
- package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/vml-drawing-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/list-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/list-xform.js +3 -3
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/cache-field-xform.d.ts +5 -15
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/cache-field-xform.js +134 -52
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/cache-field.d.ts +14 -15
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/cache-field.js +244 -70
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-cache-definition-xform.d.ts +13 -29
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-cache-definition-xform.js +213 -37
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-cache-records-xform.d.ts +7 -34
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-cache-records-xform.js +143 -41
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +101 -27
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +793 -408
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/raw-xml-collector.d.ts +78 -0
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/raw-xml-collector.js +149 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/cell-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/sheet/cf/cf-rule-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/sheet/cf/conditional-formattings-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/sheet/cf-ext/cf-rule-ext-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/sheet/col-xform.js +3 -3
- package/dist/browser/modules/excel/xlsx/xform/sheet/data-validations-xform.js +3 -3
- package/dist/browser/modules/excel/xlsx/xform/sheet/header-footer-xform.js +6 -6
- package/dist/browser/modules/excel/xlsx/xform/sheet/page-setup-xform.js +11 -11
- package/dist/browser/modules/excel/xlsx/xform/sheet/row-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.js +3 -3
- package/dist/browser/modules/excel/xlsx/xform/sheet/sheet-view-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/sheet/sheet-view-xform.js +10 -10
- package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +12 -12
- package/dist/browser/modules/excel/xlsx/xform/strings/phonetic-text-xform.js +2 -2
- package/dist/browser/modules/excel/xlsx/xform/style/color-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/style/style-xform.js +5 -5
- package/dist/browser/modules/excel/xlsx/xform/table/auto-filter-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/table/custom-filter-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/table/filter-column-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/table/filter-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/table/table-column-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/table/table-style-info-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xform/table/table-xform.d.ts +1 -2
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +5 -2
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +88 -54
- package/dist/browser/utils/env.d.ts +0 -5
- package/dist/browser/utils/env.js +0 -7
- package/dist/browser/utils/utils.base.d.ts +8 -13
- package/dist/browser/utils/utils.base.js +40 -47
- package/dist/browser/utils/utils.browser.d.ts +1 -1
- package/dist/browser/utils/utils.browser.js +1 -1
- package/dist/browser/utils/utils.d.ts +1 -1
- package/dist/browser/utils/utils.js +1 -1
- package/dist/cjs/modules/archive/unzip/stream.base.js +19 -19
- package/dist/cjs/modules/archive/unzip/stream.browser.js +3 -3
- package/dist/cjs/modules/csv/csv-core.js +6 -3
- package/dist/cjs/modules/csv/csv.browser.js +2 -2
- package/dist/cjs/modules/csv/csv.js +1 -1
- package/dist/cjs/modules/excel/anchor.js +4 -4
- package/dist/cjs/modules/excel/cell.js +5 -5
- package/dist/cjs/modules/excel/column.js +4 -4
- package/dist/cjs/modules/excel/defined-names.js +1 -1
- package/dist/cjs/modules/excel/form-control.js +1 -1
- package/dist/cjs/modules/excel/pivot-table.js +280 -70
- package/dist/cjs/modules/excel/row.js +4 -4
- package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +4 -4
- package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +4 -4
- package/dist/cjs/modules/excel/stream/worksheet-reader.js +1 -1
- package/dist/cjs/modules/excel/stream/worksheet-writer.js +4 -4
- package/dist/cjs/modules/excel/table.js +2 -2
- package/dist/cjs/modules/excel/utils/cell-format.js +3 -3
- package/dist/cjs/modules/excel/utils/shared-formula.js +1 -1
- package/dist/cjs/modules/excel/utils/stream-buf.js +2 -2
- package/dist/cjs/modules/excel/utils/string-buf.js +1 -1
- package/dist/cjs/modules/excel/workbook.js +4 -5
- package/dist/cjs/modules/excel/worksheet.js +9 -9
- package/dist/cjs/modules/excel/xlsx/xform/base-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/book/defined-name-xform.js +2 -2
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-view-xform.js +4 -4
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +16 -4
- package/dist/cjs/modules/excel/xlsx/xform/comment/style/vml-position-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/comment/style/vml-protection-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/comment/vml-shape-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/comment/vml-textbox-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/core/app-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +24 -11
- package/dist/cjs/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/drawing/ext-xform.js +2 -2
- package/dist/cjs/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/list-xform.js +3 -3
- package/dist/cjs/modules/excel/xlsx/xform/pivot-table/cache-field-xform.js +133 -51
- package/dist/cjs/modules/excel/xlsx/xform/pivot-table/cache-field.js +245 -71
- package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-cache-definition-xform.js +212 -36
- package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-cache-records-xform.js +142 -40
- package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +793 -408
- package/dist/cjs/modules/excel/xlsx/xform/pivot-table/raw-xml-collector.js +153 -0
- package/dist/cjs/modules/excel/xlsx/xform/sheet/cell-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/sheet/cf/cf-rule-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/sheet/cf/conditional-formattings-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/sheet/cf-ext/cf-rule-ext-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/sheet/col-xform.js +3 -3
- package/dist/cjs/modules/excel/xlsx/xform/sheet/data-validations-xform.js +3 -3
- package/dist/cjs/modules/excel/xlsx/xform/sheet/header-footer-xform.js +6 -6
- package/dist/cjs/modules/excel/xlsx/xform/sheet/page-setup-xform.js +11 -11
- package/dist/cjs/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.js +3 -3
- package/dist/cjs/modules/excel/xlsx/xform/sheet/sheet-view-xform.js +10 -10
- package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +12 -12
- package/dist/cjs/modules/excel/xlsx/xform/strings/phonetic-text-xform.js +2 -2
- package/dist/cjs/modules/excel/xlsx/xform/style/color-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/style/style-xform.js +5 -5
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +88 -54
- package/dist/cjs/utils/env.js +0 -8
- package/dist/cjs/utils/utils.base.js +41 -54
- package/dist/cjs/utils/utils.browser.js +2 -7
- package/dist/cjs/utils/utils.js +2 -7
- package/dist/esm/modules/archive/unzip/stream.base.js +19 -19
- package/dist/esm/modules/archive/unzip/stream.browser.js +3 -3
- package/dist/esm/modules/csv/csv-core.js +6 -3
- package/dist/esm/modules/csv/csv.browser.js +2 -2
- package/dist/esm/modules/csv/csv.js +1 -1
- package/dist/esm/modules/excel/anchor.js +4 -4
- package/dist/esm/modules/excel/cell.js +5 -5
- package/dist/esm/modules/excel/column.js +4 -4
- package/dist/esm/modules/excel/defined-names.js +1 -1
- package/dist/esm/modules/excel/form-control.js +1 -1
- package/dist/esm/modules/excel/pivot-table.js +278 -70
- package/dist/esm/modules/excel/row.js +4 -4
- package/dist/esm/modules/excel/stream/workbook-reader.browser.js +4 -4
- package/dist/esm/modules/excel/stream/workbook-writer.browser.js +4 -4
- package/dist/esm/modules/excel/stream/worksheet-reader.js +1 -1
- package/dist/esm/modules/excel/stream/worksheet-writer.js +4 -4
- package/dist/esm/modules/excel/table.js +2 -2
- package/dist/esm/modules/excel/utils/cell-format.js +3 -3
- package/dist/esm/modules/excel/utils/shared-formula.js +1 -1
- package/dist/esm/modules/excel/utils/stream-buf.js +2 -2
- package/dist/esm/modules/excel/utils/string-buf.js +1 -1
- package/dist/esm/modules/excel/workbook.js +4 -5
- package/dist/esm/modules/excel/worksheet.js +9 -9
- package/dist/esm/modules/excel/xlsx/xform/base-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/book/defined-name-xform.js +2 -2
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-view-xform.js +4 -4
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +16 -4
- package/dist/esm/modules/excel/xlsx/xform/comment/style/vml-position-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/comment/style/vml-protection-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/comment/vml-shape-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/comment/vml-textbox-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/core/app-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +24 -11
- package/dist/esm/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/drawing/ext-xform.js +2 -2
- package/dist/esm/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/list-xform.js +3 -3
- package/dist/esm/modules/excel/xlsx/xform/pivot-table/cache-field-xform.js +134 -52
- package/dist/esm/modules/excel/xlsx/xform/pivot-table/cache-field.js +244 -70
- package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-cache-definition-xform.js +213 -37
- package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-cache-records-xform.js +143 -41
- package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +793 -408
- package/dist/esm/modules/excel/xlsx/xform/pivot-table/raw-xml-collector.js +149 -0
- package/dist/esm/modules/excel/xlsx/xform/sheet/cell-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/sheet/cf/cf-rule-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/sheet/cf/conditional-formattings-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/sheet/cf-ext/cf-rule-ext-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/sheet/col-xform.js +3 -3
- package/dist/esm/modules/excel/xlsx/xform/sheet/data-validations-xform.js +3 -3
- package/dist/esm/modules/excel/xlsx/xform/sheet/header-footer-xform.js +6 -6
- package/dist/esm/modules/excel/xlsx/xform/sheet/page-setup-xform.js +11 -11
- package/dist/esm/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.js +3 -3
- package/dist/esm/modules/excel/xlsx/xform/sheet/sheet-view-xform.js +10 -10
- package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +12 -12
- package/dist/esm/modules/excel/xlsx/xform/strings/phonetic-text-xform.js +2 -2
- package/dist/esm/modules/excel/xlsx/xform/style/color-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/style/style-xform.js +5 -5
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +88 -54
- package/dist/esm/utils/env.js +0 -7
- package/dist/esm/utils/utils.base.js +40 -47
- package/dist/esm/utils/utils.browser.js +1 -1
- package/dist/esm/utils/utils.js +1 -1
- package/dist/iife/excelts.iife.js +1553 -718
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +36 -105
- package/dist/types/index.browser.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/modules/excel/pivot-table.d.ts +168 -17
- package/dist/types/modules/excel/types.d.ts +0 -4
- package/dist/types/modules/excel/workbook.d.ts +0 -2
- package/dist/types/modules/excel/xlsx/xform/base-xform.d.ts +5 -5
- package/dist/types/modules/excel/xlsx/xform/comment/comment-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/comment/comments-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/comment/style/vml-position-xform.d.ts +3 -4
- package/dist/types/modules/excel/xlsx/xform/comment/vml-client-data-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/comment/vml-notes-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/comment/vml-textbox-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/composite-xform.d.ts +1 -1
- package/dist/types/modules/excel/xlsx/xform/drawing/blip-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/drawing/cell-position-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/drawing/ext-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/drawing/vml-drawing-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/list-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/pivot-table/cache-field-xform.d.ts +5 -15
- package/dist/types/modules/excel/xlsx/xform/pivot-table/cache-field.d.ts +14 -15
- package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-cache-definition-xform.d.ts +13 -29
- package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-cache-records-xform.d.ts +7 -34
- package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +101 -27
- package/dist/types/modules/excel/xlsx/xform/pivot-table/raw-xml-collector.d.ts +78 -0
- package/dist/types/modules/excel/xlsx/xform/sheet/row-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/sheet/sheet-view-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/table/auto-filter-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/table/custom-filter-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/table/filter-column-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/table/filter-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/table/table-column-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/table/table-style-info-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xform/table/table-xform.d.ts +1 -2
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +5 -2
- package/dist/types/utils/env.d.ts +0 -5
- package/dist/types/utils/utils.base.d.ts +8 -13
- package/dist/types/utils/utils.browser.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +1 -1
- package/package.json +1 -1
|
@@ -327,7 +327,6 @@ class XLSX {
|
|
|
327
327
|
pivotTables: {},
|
|
328
328
|
pivotTableRels: {},
|
|
329
329
|
pivotCacheDefinitions: {},
|
|
330
|
-
pivotCacheDefinitionRels: {},
|
|
331
330
|
pivotCacheRecords: {},
|
|
332
331
|
// Passthrough storage for unknown/unsupported files (charts, etc.)
|
|
333
332
|
passthrough: {}
|
|
@@ -551,7 +550,7 @@ class XLSX {
|
|
|
551
550
|
o[rel.Id] = rel;
|
|
552
551
|
return o;
|
|
553
552
|
}, {});
|
|
554
|
-
(drawing.anchors
|
|
553
|
+
(drawing.anchors ?? []).forEach((anchor) => {
|
|
555
554
|
const hyperlinks = anchor.picture && anchor.picture.hyperlinks;
|
|
556
555
|
if (hyperlinks && drawingOptions.rels[hyperlinks.rId]) {
|
|
557
556
|
hyperlinks.hyperlink = drawingOptions.rels[hyperlinks.rId].Target;
|
|
@@ -611,13 +610,12 @@ class XLSX {
|
|
|
611
610
|
delete model.drawingRels;
|
|
612
611
|
delete model.vmlDrawings;
|
|
613
612
|
delete model.pivotTableRels;
|
|
614
|
-
delete model.pivotCacheDefinitionRels;
|
|
615
613
|
}
|
|
616
614
|
/**
|
|
617
615
|
* Reconcile pivot tables by linking them to worksheets and their cache data.
|
|
618
616
|
*/
|
|
619
617
|
_reconcilePivotTables(model) {
|
|
620
|
-
const rawPivotTables = model.pivotTables || {};
|
|
618
|
+
const rawPivotTables = (model.pivotTables || {});
|
|
621
619
|
if (typeof rawPivotTables !== "object" || Object.keys(rawPivotTables).length === 0) {
|
|
622
620
|
model.pivotTables = [];
|
|
623
621
|
model.pivotTablesIndexed = {};
|
|
@@ -638,29 +636,33 @@ class XLSX {
|
|
|
638
636
|
});
|
|
639
637
|
const loadedPivotTables = [];
|
|
640
638
|
const pivotTablesIndexed = {};
|
|
641
|
-
Object.entries(rawPivotTables).forEach(([pivotName,
|
|
642
|
-
const pt = pivotTable;
|
|
639
|
+
Object.entries(rawPivotTables).forEach(([pivotName, pt]) => {
|
|
643
640
|
const tableNumber = this._extractTableNumber(pivotName);
|
|
644
641
|
const cacheData = cacheMap.get(pt.cacheId);
|
|
642
|
+
const defaultMetric = this._determineMetric(pt.dataFields);
|
|
645
643
|
const completePivotTable = {
|
|
646
644
|
...pt,
|
|
647
645
|
tableNumber,
|
|
646
|
+
cacheId: String(pt.cacheId),
|
|
648
647
|
cacheDefinition: cacheData?.definition,
|
|
649
648
|
cacheRecords: cacheData?.records,
|
|
650
|
-
cacheFields: cacheData?.definition?.cacheFields
|
|
649
|
+
cacheFields: cacheData?.definition?.cacheFields ?? [],
|
|
651
650
|
rows: pt.rowFields.filter(f => f >= 0),
|
|
652
651
|
columns: pt.colFields.filter(f => f >= 0 && f !== -2),
|
|
653
652
|
values: pt.dataFields.map(df => df.fld),
|
|
654
|
-
|
|
655
|
-
|
|
653
|
+
pages: pt.pageFields.map(pf => pf.fld),
|
|
654
|
+
metric: defaultMetric,
|
|
655
|
+
valueMetrics: this._determineValueMetrics(pt.dataFields, defaultMetric),
|
|
656
|
+
applyWidthHeightFormats: pt.applyWidthHeightFormats === "1" ? "1" : "0"
|
|
656
657
|
};
|
|
657
658
|
loadedPivotTables.push(completePivotTable);
|
|
659
|
+
// Key format (e.g., "../pivotTables/pivotTable1.xml") matches worksheet .rels Target values,
|
|
660
|
+
// allowing worksheet reconciliation to look up pivot tables by their relationship target path.
|
|
658
661
|
pivotTablesIndexed[(0, ooxml_paths_1.pivotTableRelTargetFromWorksheetName)(pivotName)] = completePivotTable;
|
|
659
662
|
});
|
|
660
663
|
loadedPivotTables.sort((a, b) => a.tableNumber - b.tableNumber);
|
|
661
664
|
model.pivotTables = loadedPivotTables;
|
|
662
665
|
model.pivotTablesIndexed = pivotTablesIndexed;
|
|
663
|
-
model.loadedPivotTables = loadedPivotTables;
|
|
664
666
|
}
|
|
665
667
|
_extractTableNumber(name) {
|
|
666
668
|
const match = name.match(/pivotTable(\d+)/);
|
|
@@ -668,7 +670,7 @@ class XLSX {
|
|
|
668
670
|
}
|
|
669
671
|
_buildCacheIdMap(model) {
|
|
670
672
|
const rIdToCacheId = new Map();
|
|
671
|
-
const pivotCaches = model.pivotCaches
|
|
673
|
+
const pivotCaches = model.pivotCaches ?? [];
|
|
672
674
|
for (const cache of pivotCaches) {
|
|
673
675
|
if (cache.cacheId && cache.rId) {
|
|
674
676
|
rIdToCacheId.set(cache.rId, parseInt(cache.cacheId, 10));
|
|
@@ -679,7 +681,7 @@ class XLSX {
|
|
|
679
681
|
_buildDefinitionToCacheIdMap(model) {
|
|
680
682
|
const definitionToCacheId = new Map();
|
|
681
683
|
const rIdToCacheId = this._buildCacheIdMap(model);
|
|
682
|
-
const workbookRels = model.workbookRels
|
|
684
|
+
const workbookRels = model.workbookRels ?? [];
|
|
683
685
|
for (const rel of workbookRels) {
|
|
684
686
|
if (rel.Type === XLSX.RelType.PivotCacheDefinition && rel.Target) {
|
|
685
687
|
const match = rel.Target.match(/pivotCacheDefinition(\d+)\.xml/);
|
|
@@ -695,11 +697,14 @@ class XLSX {
|
|
|
695
697
|
return definitionToCacheId;
|
|
696
698
|
}
|
|
697
699
|
_determineMetric(dataFields) {
|
|
698
|
-
if (dataFields.length > 0 && dataFields[0].subtotal
|
|
699
|
-
return
|
|
700
|
+
if (dataFields.length > 0 && dataFields[0].subtotal) {
|
|
701
|
+
return dataFields[0].subtotal;
|
|
700
702
|
}
|
|
701
703
|
return "sum";
|
|
702
704
|
}
|
|
705
|
+
_determineValueMetrics(dataFields, defaultMetric) {
|
|
706
|
+
return dataFields.map(df => df.subtotal || defaultMetric);
|
|
707
|
+
}
|
|
703
708
|
// ===========================================================================
|
|
704
709
|
// Process Entry methods - shared by all platforms
|
|
705
710
|
// ===========================================================================
|
|
@@ -842,11 +847,6 @@ class XLSX {
|
|
|
842
847
|
model.pivotCacheDefinitions[name] = cacheDefinition;
|
|
843
848
|
}
|
|
844
849
|
}
|
|
845
|
-
async _processPivotCacheDefinitionRelsEntry(stream, model, name) {
|
|
846
|
-
const xform = new relationships_xform_1.RelationshipsXform();
|
|
847
|
-
const relationships = await xform.parseStream(stream);
|
|
848
|
-
model.pivotCacheDefinitionRels[name] = relationships;
|
|
849
|
-
}
|
|
850
850
|
async _processPivotCacheRecordsEntry(stream, model, name) {
|
|
851
851
|
const xform = new pivot_cache_records_xform_1.PivotCacheRecordsXform();
|
|
852
852
|
const cacheRecords = await xform.parseStream(stream);
|
|
@@ -946,9 +946,11 @@ class XLSX {
|
|
|
946
946
|
await this._processPivotCacheDefinitionEntry(stream, model, pivotCacheDefinitionName);
|
|
947
947
|
return true;
|
|
948
948
|
}
|
|
949
|
+
// R9-B8: Skip parsing pivotCacheDefinition .rels files — they are never used
|
|
950
|
+
// during reconciliation and were just deleted at cleanup. The cache definition's
|
|
951
|
+
// r:id attribute (preserved in ParsedCacheDefinition.rId) is sufficient.
|
|
949
952
|
const pivotCacheDefinitionRelsName = (0, ooxml_paths_1.getPivotCacheDefinitionNameFromRelsPath)(entryName);
|
|
950
953
|
if (pivotCacheDefinitionRelsName) {
|
|
951
|
-
await this._processPivotCacheDefinitionRelsEntry(stream, model, pivotCacheDefinitionRelsName);
|
|
952
954
|
return true;
|
|
953
955
|
}
|
|
954
956
|
const pivotCacheRecordsName = (0, ooxml_paths_1.getPivotCacheRecordsNameFromPath)(entryName);
|
|
@@ -1031,13 +1033,25 @@ class XLSX {
|
|
|
1031
1033
|
Target: ooxml_paths_1.OOXML_REL_TARGETS.workbookFeaturePropertyBag
|
|
1032
1034
|
});
|
|
1033
1035
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1036
|
+
// R9-B6: Deduplicate pivot cache relationships by cacheId. When multiple pivot
|
|
1037
|
+
// tables share the same cache, only one workbook relationship should be created.
|
|
1038
|
+
// Also assigns rId to each pivot table (R9-B7: typed on PivotTable interface).
|
|
1039
|
+
const seenCacheIds = new Map(); // cacheId → rId
|
|
1040
|
+
(model.pivotTables ?? []).forEach((pivotTable) => {
|
|
1041
|
+
const existing = seenCacheIds.get(pivotTable.cacheId);
|
|
1042
|
+
if (existing) {
|
|
1043
|
+
// Shared cache: reuse the rId from the first pivot table with this cacheId
|
|
1044
|
+
pivotTable.rId = existing;
|
|
1045
|
+
}
|
|
1046
|
+
else {
|
|
1047
|
+
pivotTable.rId = `rId${count++}`;
|
|
1048
|
+
seenCacheIds.set(pivotTable.cacheId, pivotTable.rId);
|
|
1049
|
+
relationships.push({
|
|
1050
|
+
Id: pivotTable.rId,
|
|
1051
|
+
Type: XLSX.RelType.PivotCacheDefinition,
|
|
1052
|
+
Target: (0, ooxml_paths_1.pivotCacheDefinitionRelTargetFromWorkbook)(pivotTable.tableNumber)
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1041
1055
|
});
|
|
1042
1056
|
model.worksheets.forEach((worksheet, index) => {
|
|
1043
1057
|
worksheet.rId = `rId${count++}`;
|
|
@@ -1132,7 +1146,7 @@ class XLSX {
|
|
|
1132
1146
|
else {
|
|
1133
1147
|
// Use regenerated XML for normal drawings (images, shapes)
|
|
1134
1148
|
// Filter out invalid anchors (null, undefined, or missing content)
|
|
1135
|
-
const filteredAnchors = (drawing.anchors
|
|
1149
|
+
const filteredAnchors = (drawing.anchors ?? []).filter((a) => {
|
|
1136
1150
|
if (a == null) {
|
|
1137
1151
|
return false;
|
|
1138
1152
|
}
|
|
@@ -1190,40 +1204,60 @@ class XLSX {
|
|
|
1190
1204
|
const pivotCacheDefinitionXform = new pivot_cache_definition_xform_1.PivotCacheDefinitionXform();
|
|
1191
1205
|
const pivotTableXform = new pivot_table_xform_1.PivotTableXform();
|
|
1192
1206
|
const relsXform = new relationships_xform_1.RelationshipsXform();
|
|
1207
|
+
// R9-B6: Track which cacheIds have already been written to avoid duplicating
|
|
1208
|
+
// shared caches. Maps cacheId → tableNumber used for the cache file names.
|
|
1209
|
+
const writtenCaches = new Map();
|
|
1193
1210
|
model.pivotTables.forEach((pivotTable) => {
|
|
1194
1211
|
const n = pivotTable.tableNumber;
|
|
1195
1212
|
const isLoaded = pivotTable.isLoaded;
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1213
|
+
const cacheId = pivotTable.cacheId;
|
|
1214
|
+
// R9-B6: Only write cache definition/records/rels once per unique cacheId.
|
|
1215
|
+
const cacheAlreadyWritten = writtenCaches.has(cacheId);
|
|
1216
|
+
if (!cacheAlreadyWritten) {
|
|
1217
|
+
writtenCaches.set(cacheId, n);
|
|
1218
|
+
if (isLoaded) {
|
|
1219
|
+
if (pivotTable.cacheDefinition) {
|
|
1220
|
+
const xml = pivotCacheDefinitionXform.toXml(pivotTable.cacheDefinition);
|
|
1221
|
+
zip.append(xml, { name: (0, ooxml_paths_1.pivotCacheDefinitionPath)(n) });
|
|
1222
|
+
}
|
|
1223
|
+
if (pivotTable.cacheRecords) {
|
|
1224
|
+
const xml = pivotCacheRecordsXform.toXml(pivotTable.cacheRecords);
|
|
1225
|
+
zip.append(xml, { name: (0, ooxml_paths_1.pivotCacheRecordsPath)(n) });
|
|
1226
|
+
}
|
|
1200
1227
|
}
|
|
1201
|
-
|
|
1202
|
-
|
|
1228
|
+
else {
|
|
1229
|
+
let xml = pivotCacheRecordsXform.toXml(pivotTable);
|
|
1203
1230
|
zip.append(xml, { name: (0, ooxml_paths_1.pivotCacheRecordsPath)(n) });
|
|
1231
|
+
xml = pivotCacheDefinitionXform.toXml(pivotTable);
|
|
1232
|
+
zip.append(xml, { name: (0, ooxml_paths_1.pivotCacheDefinitionPath)(n) });
|
|
1204
1233
|
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1234
|
+
// R9-B4: Only write cache definition rels when cache records exist.
|
|
1235
|
+
// For loaded pivot tables without cacheRecords (e.g. OLAP), skip the rels file entirely.
|
|
1236
|
+
// R9-B3: Use the rId from the loaded cache definition to stay consistent with the XML.
|
|
1237
|
+
const hasCacheRecords = isLoaded ? !!pivotTable.cacheRecords : true;
|
|
1238
|
+
if (hasCacheRecords) {
|
|
1239
|
+
const cacheRecordsRId = (isLoaded ? pivotTable.cacheDefinition?.rId : undefined) ?? "rId1";
|
|
1240
|
+
const xml = relsXform.toXml([
|
|
1241
|
+
{
|
|
1242
|
+
Id: cacheRecordsRId,
|
|
1243
|
+
Type: XLSX.RelType.PivotCacheRecords,
|
|
1244
|
+
Target: (0, ooxml_paths_1.pivotCacheRecordsRelTarget)(n)
|
|
1245
|
+
}
|
|
1246
|
+
]);
|
|
1247
|
+
zip.append(xml, { name: (0, ooxml_paths_1.pivotCacheDefinitionRelsPath)(n) });
|
|
1217
1248
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
xml = pivotTableXform.toXml(pivotTable);
|
|
1249
|
+
}
|
|
1250
|
+
// Pivot table XML is always written (each pivot table has its own file).
|
|
1251
|
+
let xml = pivotTableXform.toXml(pivotTable);
|
|
1221
1252
|
zip.append(xml, { name: (0, ooxml_paths_1.pivotTablePath)(n) });
|
|
1253
|
+
// Pivot table rels point to the cache definition file. For shared caches,
|
|
1254
|
+
// use the tableNumber of the first pivot table that wrote the cache.
|
|
1255
|
+
const cacheTableNumber = writtenCaches.get(cacheId);
|
|
1222
1256
|
xml = relsXform.toXml([
|
|
1223
1257
|
{
|
|
1224
1258
|
Id: "rId1",
|
|
1225
1259
|
Type: XLSX.RelType.PivotCacheDefinition,
|
|
1226
|
-
Target: (0, ooxml_paths_1.pivotCacheDefinitionRelTargetFromPivotTable)(
|
|
1260
|
+
Target: (0, ooxml_paths_1.pivotCacheDefinitionRelTargetFromPivotTable)(cacheTableNumber)
|
|
1227
1261
|
}
|
|
1228
1262
|
]);
|
|
1229
1263
|
zip.append(xml, { name: (0, ooxml_paths_1.pivotTableRelsPath)(n) });
|
|
@@ -1239,10 +1273,10 @@ class XLSX {
|
|
|
1239
1273
|
});
|
|
1240
1274
|
}
|
|
1241
1275
|
prepareModel(model, options) {
|
|
1242
|
-
model.creator = model.creator
|
|
1243
|
-
model.lastModifiedBy = model.lastModifiedBy
|
|
1244
|
-
model.created = model.created
|
|
1245
|
-
model.modified = model.modified
|
|
1276
|
+
model.creator = model.creator ?? "ExcelTS";
|
|
1277
|
+
model.lastModifiedBy = model.lastModifiedBy ?? "ExcelTS";
|
|
1278
|
+
model.created = model.created ?? new Date();
|
|
1279
|
+
model.modified = model.modified ?? new Date();
|
|
1246
1280
|
model.useSharedStrings =
|
|
1247
1281
|
options.useSharedStrings !== undefined ? options.useSharedStrings : true;
|
|
1248
1282
|
model.useStyles = options.useStyles !== undefined ? options.useStyles : true;
|
package/dist/cjs/utils/env.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.isNode = isNode;
|
|
8
|
-
exports.isBrowser = isBrowser;
|
|
9
8
|
/**
|
|
10
9
|
* Check if running in Node.js environment
|
|
11
10
|
* Returns true if process.versions.node exists
|
|
@@ -13,10 +12,3 @@ exports.isBrowser = isBrowser;
|
|
|
13
12
|
function isNode() {
|
|
14
13
|
return typeof process !== "undefined" && !!process.versions?.node;
|
|
15
14
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Check if running in browser environment
|
|
18
|
-
* Returns true if window and document are defined
|
|
19
|
-
*/
|
|
20
|
-
function isBrowser() {
|
|
21
|
-
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
22
|
-
}
|
|
@@ -5,15 +5,11 @@
|
|
|
5
5
|
* (Node.js 16+ supports atob/btoa/TextEncoder/TextDecoder globally)
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.inherits = void 0;
|
|
9
8
|
exports.base64ToUint8Array = base64ToUint8Array;
|
|
10
9
|
exports.delay = delay;
|
|
11
|
-
exports.nop = nop;
|
|
12
10
|
exports.dateToExcel = dateToExcel;
|
|
13
11
|
exports.excelToDate = excelToDate;
|
|
14
|
-
exports.
|
|
15
|
-
exports.parsePath = parsePath;
|
|
16
|
-
exports.getRelsPath = getRelsPath;
|
|
12
|
+
exports.parseOoxmlDate = parseOoxmlDate;
|
|
17
13
|
exports.xmlDecode = xmlDecode;
|
|
18
14
|
exports.xmlEncode = xmlEncode;
|
|
19
15
|
exports.validInt = validInt;
|
|
@@ -21,7 +17,6 @@ exports.isDateFmt = isDateFmt;
|
|
|
21
17
|
exports.parseBoolean = parseBoolean;
|
|
22
18
|
exports.range = range;
|
|
23
19
|
exports.toSortedArray = toSortedArray;
|
|
24
|
-
exports.objectFromProps = objectFromProps;
|
|
25
20
|
exports.bufferToString = bufferToString;
|
|
26
21
|
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
27
22
|
exports.stringToUtf16Le = stringToUtf16Le;
|
|
@@ -52,34 +47,6 @@ function base64ToUint8Array(base64) {
|
|
|
52
47
|
function delay(ms) {
|
|
53
48
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
54
49
|
}
|
|
55
|
-
function nop() { }
|
|
56
|
-
const inherits = function (cls, superCtor, statics, prototype) {
|
|
57
|
-
cls.super_ = superCtor;
|
|
58
|
-
if (!prototype) {
|
|
59
|
-
prototype = statics;
|
|
60
|
-
statics = null;
|
|
61
|
-
}
|
|
62
|
-
if (statics) {
|
|
63
|
-
Object.keys(statics).forEach(i => {
|
|
64
|
-
Object.defineProperty(cls, i, Object.getOwnPropertyDescriptor(statics, i));
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
const properties = {
|
|
68
|
-
constructor: {
|
|
69
|
-
value: cls,
|
|
70
|
-
enumerable: false,
|
|
71
|
-
writable: false,
|
|
72
|
-
configurable: true
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
if (prototype) {
|
|
76
|
-
Object.keys(prototype).forEach(i => {
|
|
77
|
-
properties[i] = Object.getOwnPropertyDescriptor(prototype, i);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
cls.prototype = Object.create(superCtor.prototype, properties);
|
|
81
|
-
};
|
|
82
|
-
exports.inherits = inherits;
|
|
83
50
|
// =============================================================================
|
|
84
51
|
// Date utilities
|
|
85
52
|
// =============================================================================
|
|
@@ -90,19 +57,13 @@ function excelToDate(v, date1904) {
|
|
|
90
57
|
const millisecondSinceEpoch = Math.round((v - 25569 + (date1904 ? 1462 : 0)) * 24 * 3600 * 1000);
|
|
91
58
|
return new Date(millisecondSinceEpoch);
|
|
92
59
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
name: filepath.substring(last + 1)
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function getRelsPath(filepath) {
|
|
104
|
-
const path = parsePath(filepath);
|
|
105
|
-
return `${path.path}/_rels/${path.name}.rels`;
|
|
60
|
+
/**
|
|
61
|
+
* Parse an OOXML date string into a Date object.
|
|
62
|
+
* OOXML dates like "2024-01-15T00:00:00" lack a timezone suffix,
|
|
63
|
+
* which some JS engines parse as local time. Appending "Z" forces UTC.
|
|
64
|
+
*/
|
|
65
|
+
function parseOoxmlDate(raw) {
|
|
66
|
+
return new Date(raw.endsWith("Z") ? raw : raw + "Z");
|
|
106
67
|
}
|
|
107
68
|
// =============================================================================
|
|
108
69
|
// XML utilities
|
|
@@ -222,17 +183,43 @@ function* range(start, stop, step = 1) {
|
|
|
222
183
|
}
|
|
223
184
|
function toSortedArray(values) {
|
|
224
185
|
const result = Array.from(values);
|
|
225
|
-
|
|
186
|
+
if (result.length <= 1) {
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
// All numbers → numeric sort
|
|
226
190
|
if (result.every(item => Number.isFinite(item))) {
|
|
227
191
|
return result.sort((a, b) => a - b);
|
|
228
192
|
}
|
|
229
|
-
|
|
193
|
+
// All Dates → chronological sort
|
|
194
|
+
if (result.every(item => item instanceof Date)) {
|
|
195
|
+
return result.sort((a, b) => a.getTime() - b.getTime());
|
|
196
|
+
}
|
|
197
|
+
// Mixed types → type-aware sort: numbers first (numerically), then dates (chronologically), then strings (lexicographic)
|
|
198
|
+
return result.sort((a, b) => {
|
|
199
|
+
const ta = sortTypeRank(a);
|
|
200
|
+
const tb = sortTypeRank(b);
|
|
201
|
+
if (ta !== tb) {
|
|
202
|
+
return ta - tb;
|
|
203
|
+
}
|
|
204
|
+
// Same type group
|
|
205
|
+
if (ta === 0) {
|
|
206
|
+
return a - b;
|
|
207
|
+
}
|
|
208
|
+
if (ta === 1) {
|
|
209
|
+
return a.getTime() - b.getTime();
|
|
210
|
+
}
|
|
211
|
+
return String(a).localeCompare(String(b));
|
|
212
|
+
});
|
|
230
213
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return
|
|
235
|
-
}
|
|
214
|
+
/** Rank for mixed-type sort: numbers=0, dates=1, everything else=2 */
|
|
215
|
+
function sortTypeRank(v) {
|
|
216
|
+
if (Number.isFinite(v)) {
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
if (v instanceof Date) {
|
|
220
|
+
return 1;
|
|
221
|
+
}
|
|
222
|
+
return 2;
|
|
236
223
|
}
|
|
237
224
|
// =============================================================================
|
|
238
225
|
// Buffer utilities (cross-platform)
|
|
@@ -4,18 +4,14 @@
|
|
|
4
4
|
* Re-exports shared utilities and adds browser-specific implementations
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.stringToUtf16Le = exports.uint8ArrayToBase64 = exports.base64ToUint8Array = exports.bufferToString = exports.
|
|
7
|
+
exports.stringToUtf16Le = exports.uint8ArrayToBase64 = exports.base64ToUint8Array = exports.bufferToString = exports.toSortedArray = exports.range = exports.parseBoolean = exports.isDateFmt = exports.validInt = exports.xmlEncode = exports.xmlDecode = exports.parseOoxmlDate = exports.excelToDate = exports.dateToExcel = exports.delay = void 0;
|
|
8
8
|
exports.fileExists = fileExists;
|
|
9
9
|
// Re-export all shared utilities
|
|
10
10
|
var utils_base_1 = require("./utils.base.js");
|
|
11
11
|
Object.defineProperty(exports, "delay", { enumerable: true, get: function () { return utils_base_1.delay; } });
|
|
12
|
-
Object.defineProperty(exports, "nop", { enumerable: true, get: function () { return utils_base_1.nop; } });
|
|
13
|
-
Object.defineProperty(exports, "inherits", { enumerable: true, get: function () { return utils_base_1.inherits; } });
|
|
14
12
|
Object.defineProperty(exports, "dateToExcel", { enumerable: true, get: function () { return utils_base_1.dateToExcel; } });
|
|
15
13
|
Object.defineProperty(exports, "excelToDate", { enumerable: true, get: function () { return utils_base_1.excelToDate; } });
|
|
16
|
-
Object.defineProperty(exports, "
|
|
17
|
-
Object.defineProperty(exports, "parsePath", { enumerable: true, get: function () { return utils_base_1.parsePath; } });
|
|
18
|
-
Object.defineProperty(exports, "getRelsPath", { enumerable: true, get: function () { return utils_base_1.getRelsPath; } });
|
|
14
|
+
Object.defineProperty(exports, "parseOoxmlDate", { enumerable: true, get: function () { return utils_base_1.parseOoxmlDate; } });
|
|
19
15
|
Object.defineProperty(exports, "xmlDecode", { enumerable: true, get: function () { return utils_base_1.xmlDecode; } });
|
|
20
16
|
Object.defineProperty(exports, "xmlEncode", { enumerable: true, get: function () { return utils_base_1.xmlEncode; } });
|
|
21
17
|
Object.defineProperty(exports, "validInt", { enumerable: true, get: function () { return utils_base_1.validInt; } });
|
|
@@ -23,7 +19,6 @@ Object.defineProperty(exports, "isDateFmt", { enumerable: true, get: function ()
|
|
|
23
19
|
Object.defineProperty(exports, "parseBoolean", { enumerable: true, get: function () { return utils_base_1.parseBoolean; } });
|
|
24
20
|
Object.defineProperty(exports, "range", { enumerable: true, get: function () { return utils_base_1.range; } });
|
|
25
21
|
Object.defineProperty(exports, "toSortedArray", { enumerable: true, get: function () { return utils_base_1.toSortedArray; } });
|
|
26
|
-
Object.defineProperty(exports, "objectFromProps", { enumerable: true, get: function () { return utils_base_1.objectFromProps; } });
|
|
27
22
|
Object.defineProperty(exports, "bufferToString", { enumerable: true, get: function () { return utils_base_1.bufferToString; } });
|
|
28
23
|
Object.defineProperty(exports, "base64ToUint8Array", { enumerable: true, get: function () { return utils_base_1.base64ToUint8Array; } });
|
|
29
24
|
Object.defineProperty(exports, "uint8ArrayToBase64", { enumerable: true, get: function () { return utils_base_1.uint8ArrayToBase64; } });
|
package/dist/cjs/utils/utils.js
CHANGED
|
@@ -7,19 +7,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.stringToUtf16Le = exports.uint8ArrayToBase64 = exports.base64ToUint8Array = exports.bufferToString = exports.
|
|
10
|
+
exports.stringToUtf16Le = exports.uint8ArrayToBase64 = exports.base64ToUint8Array = exports.bufferToString = exports.toSortedArray = exports.range = exports.parseBoolean = exports.isDateFmt = exports.validInt = exports.xmlEncode = exports.xmlDecode = exports.parseOoxmlDate = exports.excelToDate = exports.dateToExcel = exports.delay = void 0;
|
|
11
11
|
exports.fileExists = fileExists;
|
|
12
12
|
const fs_1 = __importDefault(require("fs"));
|
|
13
13
|
// Re-export all shared utilities
|
|
14
14
|
var utils_base_1 = require("./utils.base.js");
|
|
15
15
|
Object.defineProperty(exports, "delay", { enumerable: true, get: function () { return utils_base_1.delay; } });
|
|
16
|
-
Object.defineProperty(exports, "nop", { enumerable: true, get: function () { return utils_base_1.nop; } });
|
|
17
|
-
Object.defineProperty(exports, "inherits", { enumerable: true, get: function () { return utils_base_1.inherits; } });
|
|
18
16
|
Object.defineProperty(exports, "dateToExcel", { enumerable: true, get: function () { return utils_base_1.dateToExcel; } });
|
|
19
17
|
Object.defineProperty(exports, "excelToDate", { enumerable: true, get: function () { return utils_base_1.excelToDate; } });
|
|
20
|
-
Object.defineProperty(exports, "
|
|
21
|
-
Object.defineProperty(exports, "parsePath", { enumerable: true, get: function () { return utils_base_1.parsePath; } });
|
|
22
|
-
Object.defineProperty(exports, "getRelsPath", { enumerable: true, get: function () { return utils_base_1.getRelsPath; } });
|
|
18
|
+
Object.defineProperty(exports, "parseOoxmlDate", { enumerable: true, get: function () { return utils_base_1.parseOoxmlDate; } });
|
|
23
19
|
Object.defineProperty(exports, "xmlDecode", { enumerable: true, get: function () { return utils_base_1.xmlDecode; } });
|
|
24
20
|
Object.defineProperty(exports, "xmlEncode", { enumerable: true, get: function () { return utils_base_1.xmlEncode; } });
|
|
25
21
|
Object.defineProperty(exports, "validInt", { enumerable: true, get: function () { return utils_base_1.validInt; } });
|
|
@@ -27,7 +23,6 @@ Object.defineProperty(exports, "isDateFmt", { enumerable: true, get: function ()
|
|
|
27
23
|
Object.defineProperty(exports, "parseBoolean", { enumerable: true, get: function () { return utils_base_1.parseBoolean; } });
|
|
28
24
|
Object.defineProperty(exports, "range", { enumerable: true, get: function () { return utils_base_1.range; } });
|
|
29
25
|
Object.defineProperty(exports, "toSortedArray", { enumerable: true, get: function () { return utils_base_1.toSortedArray; } });
|
|
30
|
-
Object.defineProperty(exports, "objectFromProps", { enumerable: true, get: function () { return utils_base_1.objectFromProps; } });
|
|
31
26
|
Object.defineProperty(exports, "bufferToString", { enumerable: true, get: function () { return utils_base_1.bufferToString; } });
|
|
32
27
|
Object.defineProperty(exports, "base64ToUint8Array", { enumerable: true, get: function () { return utils_base_1.base64ToUint8Array; } });
|
|
33
28
|
Object.defineProperty(exports, "uint8ArrayToBase64", { enumerable: true, get: function () { return utils_base_1.uint8ArrayToBase64; } });
|
|
@@ -66,7 +66,7 @@ export function decodeZipEntryPath(pathBuffer) {
|
|
|
66
66
|
return textDecoder.decode(pathBuffer);
|
|
67
67
|
}
|
|
68
68
|
export function isZipUnicodeFlag(flags) {
|
|
69
|
-
return ((flags
|
|
69
|
+
return ((flags ?? 0) & 0x800) !== 0;
|
|
70
70
|
}
|
|
71
71
|
export function isZipDirectoryPath(path) {
|
|
72
72
|
if (path.length === 0) {
|
|
@@ -88,8 +88,8 @@ export function buildZipEntryProps(path, pathBuffer, flags) {
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
export function resolveZipEntryLastModifiedDateTime(vars, extraFields) {
|
|
91
|
-
const dosDate = vars.lastModifiedDate
|
|
92
|
-
const dosTime = vars.lastModifiedTime
|
|
91
|
+
const dosDate = vars.lastModifiedDate ?? 0;
|
|
92
|
+
const dosTime = vars.lastModifiedTime ?? 0;
|
|
93
93
|
const dosDateTime = parseDosDateTimeUTC(dosDate, dosTime);
|
|
94
94
|
const unixSecondsMtime = extraFields.mtimeUnixSeconds;
|
|
95
95
|
if (unixSecondsMtime === undefined) {
|
|
@@ -99,10 +99,10 @@ export function resolveZipEntryLastModifiedDateTime(vars, extraFields) {
|
|
|
99
99
|
}
|
|
100
100
|
export const parseExtraField = parseZipExtraFields;
|
|
101
101
|
export function hasDataDescriptorFlag(flags) {
|
|
102
|
-
return ((flags
|
|
102
|
+
return ((flags ?? 0) & 0x08) !== 0;
|
|
103
103
|
}
|
|
104
104
|
export function isFileSizeKnown(flags, compressedSize) {
|
|
105
|
-
return !hasDataDescriptorFlag(flags) || (compressedSize
|
|
105
|
+
return !hasDataDescriptorFlag(flags) || (compressedSize ?? 0) > 0;
|
|
106
106
|
}
|
|
107
107
|
export function autodrain(stream) {
|
|
108
108
|
const draining = stream.pipe(new Transform({
|
|
@@ -399,8 +399,8 @@ export class PullStream extends Duplex {
|
|
|
399
399
|
export async function readCrxHeader(pull) {
|
|
400
400
|
const data = await pull(12);
|
|
401
401
|
const header = data.length >= 12 ? parseCrxHeaderFast(data) : parseBuffer(data, CRX_HEADER_FORMAT);
|
|
402
|
-
const pubKeyLength = header.pubKeyLength
|
|
403
|
-
const signatureLength = header.signatureLength
|
|
402
|
+
const pubKeyLength = header.pubKeyLength ?? 0;
|
|
403
|
+
const signatureLength = header.signatureLength ?? 0;
|
|
404
404
|
const keyAndSig = await pull(pubKeyLength + signatureLength);
|
|
405
405
|
header.publicKey = keyAndSig.subarray(0, pubKeyLength);
|
|
406
406
|
header.signature = keyAndSig.subarray(pubKeyLength);
|
|
@@ -411,8 +411,8 @@ export async function readLocalFileHeader(pull) {
|
|
|
411
411
|
const vars = data.length >= 26
|
|
412
412
|
? parseLocalFileHeaderVarsFast(data)
|
|
413
413
|
: parseBuffer(data, LOCAL_FILE_HEADER_FORMAT);
|
|
414
|
-
const fileNameBuffer = await pull(vars.fileNameLength
|
|
415
|
-
const extraFieldData = await pull(vars.extraFieldLength
|
|
414
|
+
const fileNameBuffer = await pull(vars.fileNameLength ?? 0);
|
|
415
|
+
const extraFieldData = await pull(vars.extraFieldLength ?? 0);
|
|
416
416
|
return { vars, fileNameBuffer, extraFieldData };
|
|
417
417
|
}
|
|
418
418
|
export async function readDataDescriptor(pull) {
|
|
@@ -424,14 +424,14 @@ export async function readDataDescriptor(pull) {
|
|
|
424
424
|
export async function consumeCentralDirectoryFileHeader(pull) {
|
|
425
425
|
const data = await pull(42);
|
|
426
426
|
const vars = parseBuffer(data, CENTRAL_DIRECTORY_FILE_HEADER_FORMAT);
|
|
427
|
-
await pull(vars.fileNameLength
|
|
428
|
-
await pull(vars.extraFieldLength
|
|
429
|
-
await pull(vars.fileCommentLength
|
|
427
|
+
await pull(vars.fileNameLength ?? 0);
|
|
428
|
+
await pull(vars.extraFieldLength ?? 0);
|
|
429
|
+
await pull(vars.fileCommentLength ?? 0);
|
|
430
430
|
}
|
|
431
431
|
export async function consumeEndOfCentralDirectoryRecord(pull) {
|
|
432
432
|
const data = await pull(18);
|
|
433
433
|
const vars = parseBuffer(data, END_OF_CENTRAL_DIRECTORY_FORMAT);
|
|
434
|
-
await pull(vars.commentLength
|
|
434
|
+
await pull(vars.commentLength ?? 0);
|
|
435
435
|
}
|
|
436
436
|
// =============================================================================
|
|
437
437
|
// Validated Data Descriptor Scan (shared by Node + Browser)
|
|
@@ -943,7 +943,7 @@ async function readFileRecord(opts, io, emitter, inflateFactory, state, threshol
|
|
|
943
943
|
};
|
|
944
944
|
entry.path = fileName;
|
|
945
945
|
entry.props = buildZipEntryProps(fileName, fileNameBuffer, vars.flags);
|
|
946
|
-
entry.type = getZipEntryType(fileName, vars.uncompressedSize
|
|
946
|
+
entry.type = getZipEntryType(fileName, vars.uncompressedSize ?? 0);
|
|
947
947
|
if (opts.verbose) {
|
|
948
948
|
if (entry.type === "Directory") {
|
|
949
949
|
console.log(" creating:", fileName);
|
|
@@ -964,7 +964,7 @@ async function readFileRecord(opts, io, emitter, inflateFactory, state, threshol
|
|
|
964
964
|
entry.__autodraining = autodraining;
|
|
965
965
|
const fileSizeKnown = isFileSizeKnown(vars.flags, vars.compressedSize);
|
|
966
966
|
if (fileSizeKnown) {
|
|
967
|
-
entry.size = vars.uncompressedSize
|
|
967
|
+
entry.size = vars.uncompressedSize ?? 0;
|
|
968
968
|
}
|
|
969
969
|
if (opts.forceStream) {
|
|
970
970
|
emitter.pushEntry(entry);
|
|
@@ -991,8 +991,8 @@ async function readFileRecord(opts, io, emitter, inflateFactory, state, threshol
|
|
|
991
991
|
// This prevents materializing large highly-compressible files in memory,
|
|
992
992
|
// which can cause massive peak RSS and negate streaming backpressure.
|
|
993
993
|
const sizesTrusted = !hasDataDescriptorFlag(vars.flags);
|
|
994
|
-
const compressedSize = vars.compressedSize
|
|
995
|
-
const uncompressedSize = vars.uncompressedSize
|
|
994
|
+
const compressedSize = vars.compressedSize ?? 0;
|
|
995
|
+
const uncompressedSize = vars.uncompressedSize ?? 0;
|
|
996
996
|
const useSmallFileOptimization = sizesTrusted &&
|
|
997
997
|
fileSizeKnown &&
|
|
998
998
|
inflateRawSync &&
|
|
@@ -1013,10 +1013,10 @@ async function readFileRecord(opts, io, emitter, inflateFactory, state, threshol
|
|
|
1013
1013
|
? inflateFactory()
|
|
1014
1014
|
: new PassThrough({ highWaterMark: DEFAULT_UNZIP_STREAM_HIGH_WATER_MARK });
|
|
1015
1015
|
if (fileSizeKnown) {
|
|
1016
|
-
await pumpKnownCompressedSizeToEntry(io, inflater, entry, vars.compressedSize
|
|
1016
|
+
await pumpKnownCompressedSizeToEntry(io, inflater, entry, vars.compressedSize ?? 0);
|
|
1017
1017
|
return;
|
|
1018
1018
|
}
|
|
1019
1019
|
await pipeline(io.streamUntilDataDescriptor(), inflater, entry);
|
|
1020
1020
|
const dd = await readDataDescriptor(async (l) => io.pull(l));
|
|
1021
|
-
entry.size = dd.uncompressedSize
|
|
1021
|
+
entry.size = dd.uncompressedSize ?? 0;
|
|
1022
1022
|
}
|
|
@@ -171,9 +171,9 @@ class BrowserInflateRaw extends Duplex {
|
|
|
171
171
|
}
|
|
172
172
|
destroy(error) {
|
|
173
173
|
if (!this.writeClosed) {
|
|
174
|
-
this.writer.abort(error
|
|
174
|
+
this.writer.abort(error ?? undefined).catch(() => { });
|
|
175
175
|
}
|
|
176
|
-
this.reader.cancel(error
|
|
176
|
+
this.reader.cancel(error ?? undefined).catch(() => { });
|
|
177
177
|
return super.destroy(error);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -338,7 +338,7 @@ class WorkerInflateRaw extends Duplex {
|
|
|
338
338
|
}
|
|
339
339
|
};
|
|
340
340
|
this.worker.onerror = (e) => {
|
|
341
|
-
const err = new Error(e.message
|
|
341
|
+
const err = new Error(e.message ?? "Worker error");
|
|
342
342
|
for (const cb of this._pendingAcks.values()) {
|
|
343
343
|
cb(err);
|
|
344
344
|
}
|
|
@@ -298,7 +298,10 @@ export function parseCsv(input, options = {}) {
|
|
|
298
298
|
validatedRows.push(row);
|
|
299
299
|
}
|
|
300
300
|
else {
|
|
301
|
-
invalidRows.push({
|
|
301
|
+
invalidRows.push({
|
|
302
|
+
row: Object.values(row),
|
|
303
|
+
reason: "Validation failed"
|
|
304
|
+
});
|
|
302
305
|
}
|
|
303
306
|
}
|
|
304
307
|
else {
|
|
@@ -308,7 +311,7 @@ export function parseCsv(input, options = {}) {
|
|
|
308
311
|
else {
|
|
309
312
|
invalidRows.push({
|
|
310
313
|
row: Object.values(row),
|
|
311
|
-
reason: result.reason
|
|
314
|
+
reason: result.reason ?? "Validation failed"
|
|
312
315
|
});
|
|
313
316
|
}
|
|
314
317
|
}
|
|
@@ -352,7 +355,7 @@ export function parseCsv(input, options = {}) {
|
|
|
352
355
|
validatedRows.push(row);
|
|
353
356
|
}
|
|
354
357
|
else {
|
|
355
|
-
arrayInvalidRows.push({ row, reason: result.reason
|
|
358
|
+
arrayInvalidRows.push({ row, reason: result.reason ?? "Validation failed" });
|
|
356
359
|
}
|
|
357
360
|
}
|
|
358
361
|
}
|