@coreui/data-grid 0.3.0-rc.0 → 0.4.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.
Files changed (122) hide show
  1. package/dist/css/data-grid.css +1 -1
  2. package/dist/css/data-grid.css.map +1 -1
  3. package/dist/css/data-grid.min.css +1 -1
  4. package/dist/css/data-grid.min.css.map +1 -1
  5. package/dist/css/data-grid.standalone.css +6 -6
  6. package/dist/css/data-grid.standalone.css.map +1 -1
  7. package/dist/css/data-grid.standalone.min.css +1 -1
  8. package/dist/css/data-grid.standalone.min.css.map +1 -1
  9. package/dist/js/clipboard.cjs +2 -3
  10. package/dist/js/clipboard.mjs +2 -3
  11. package/dist/js/csv.cjs +5 -6
  12. package/dist/js/csv.cjs.map +1 -1
  13. package/dist/js/csv.mjs +5 -6
  14. package/dist/js/csv.mjs.map +1 -1
  15. package/dist/js/data-grid.esm.js +5899 -5667
  16. package/dist/js/data-grid.esm.js.map +1 -1
  17. package/dist/js/data-grid.esm.min.js +2 -2
  18. package/dist/js/data-grid.esm.min.js.map +1 -1
  19. package/dist/js/data-grid.js +5899 -5668
  20. package/dist/js/data-grid.js.map +1 -1
  21. package/dist/js/data-grid.lite.esm.js +2669 -2622
  22. package/dist/js/data-grid.lite.esm.js.map +1 -1
  23. package/dist/js/data-grid.lite.esm.min.js +2 -2
  24. package/dist/js/data-grid.lite.esm.min.js.map +1 -1
  25. package/dist/js/data-grid.lite.js +2669 -2623
  26. package/dist/js/data-grid.lite.js.map +1 -1
  27. package/dist/js/data-grid.lite.min.js +2 -2
  28. package/dist/js/data-grid.lite.min.js.map +1 -1
  29. package/dist/js/data-grid.lite.mjs +2669 -2622
  30. package/dist/js/data-grid.lite.mjs.map +1 -1
  31. package/dist/js/data-grid.min.js +2 -2
  32. package/dist/js/data-grid.min.js.map +1 -1
  33. package/dist/js/data-grid.mjs +5899 -5667
  34. package/dist/js/data-grid.mjs.map +1 -1
  35. package/dist/js/direction.cjs +3 -4
  36. package/dist/js/direction.cjs.map +1 -1
  37. package/dist/js/direction.mjs +3 -4
  38. package/dist/js/direction.mjs.map +1 -1
  39. package/dist/js/drag.cjs +6 -6
  40. package/dist/js/drag.cjs.map +1 -1
  41. package/dist/js/drag.mjs +6 -6
  42. package/dist/js/drag.mjs.map +1 -1
  43. package/dist/js/{export-table-BdabEbJG.mjs → export-table-BggGRmzQ.mjs} +3 -4
  44. package/dist/js/{export-table-BdabEbJG.mjs.map → export-table-BggGRmzQ.mjs.map} +1 -1
  45. package/dist/js/{export-table-D762wrZ1.cjs → export-table-BiB3_lVo.cjs} +3 -4
  46. package/dist/js/{export-table-D762wrZ1.cjs.map → export-table-BiB3_lVo.cjs.map} +1 -1
  47. package/dist/js/filters.cjs +2 -3
  48. package/dist/js/filters.mjs +2 -3
  49. package/dist/js/labels.cjs +2 -3
  50. package/dist/js/labels.mjs +2 -3
  51. package/dist/js/print.cjs +2 -3
  52. package/dist/js/print.mjs +2 -3
  53. package/dist/js/selector.cjs +22 -0
  54. package/dist/js/selector.cjs.map +1 -0
  55. package/dist/js/selector.mjs +21 -0
  56. package/dist/js/selector.mjs.map +1 -0
  57. package/dist/js/validate.cjs +2 -3
  58. package/dist/js/validate.mjs +2 -3
  59. package/dist/js/xlsx.cjs +5 -7
  60. package/dist/js/xlsx.cjs.map +1 -1
  61. package/dist/js/xlsx.mjs +5 -7
  62. package/dist/js/xlsx.mjs.map +1 -1
  63. package/dist/types/base-component.d.mts +29 -0
  64. package/dist/types/data-grid.d.mts +141 -0
  65. package/dist/types/dom/data.d.mts +15 -0
  66. package/dist/types/dom/event-handler.d.mts +22 -0
  67. package/dist/types/dom/manipulator.d.mts +16 -0
  68. package/dist/types/engine/active-cell.d.mts +33 -0
  69. package/dist/types/engine/data-source.d.mts +19 -0
  70. package/dist/types/engine/features-lite.d.mts +25 -0
  71. package/dist/types/engine/features.d.mts +35 -0
  72. package/dist/types/engine/scheduler.d.mts +11 -0
  73. package/dist/types/engine/table.d.mts +9 -0
  74. package/dist/types/engine/validate.d.mts +20 -1
  75. package/dist/types/engine/virtualizer.d.mts +23 -0
  76. package/dist/types/filters.d.mts +13 -1
  77. package/dist/types/icons.d.mts +23 -0
  78. package/dist/types/index-lite.d.mts +19 -1
  79. package/dist/types/index.d.mts +21 -1
  80. package/dist/types/labels.d.mts +9 -1
  81. package/dist/types/types.d.mts +284 -0
  82. package/dist/types/ui/body.d.mts +37 -0
  83. package/dist/types/ui/column-chooser.d.mts +27 -0
  84. package/dist/types/ui/editor.d.mts +8 -0
  85. package/dist/types/ui/filter-menu.d.mts +21 -0
  86. package/dist/types/ui/header.d.mts +51 -0
  87. package/dist/types/ui/loading.d.mts +12 -0
  88. package/dist/types/ui/menu.d.mts +17 -0
  89. package/dist/types/ui/pagination.d.mts +17 -0
  90. package/dist/types/ui/pinning.d.mts +17 -0
  91. package/dist/types/ui/toolbar.d.mts +42 -0
  92. package/dist/types/ui/tooltip.d.mts +10 -0
  93. package/dist/types/util/clipboard.d.mts +29 -1
  94. package/dist/types/util/config.d.mts +28 -0
  95. package/dist/types/util/csv.d.mts +19 -1
  96. package/dist/types/util/debounce.d.mts +7 -0
  97. package/dist/types/util/direction.d.mts +17 -1
  98. package/dist/types/util/drag.d.mts +48 -1
  99. package/dist/types/util/export-table.d.mts +47 -0
  100. package/dist/types/util/index.d.mts +66 -0
  101. package/dist/types/util/print.d.mts +32 -1
  102. package/dist/types/util/sanitizer.d.mts +15 -0
  103. package/dist/types/util/selector.d.mts +12 -0
  104. package/dist/types/util/selector.d.ts +12 -0
  105. package/dist/types/util/xlsx.d.mts +17 -1
  106. package/dist/types/util/zip.d.mts +11 -0
  107. package/package.json +29 -16
  108. package/scss/data-grid.scss +1 -1
  109. package/src/data-grid.ts +4 -3
  110. package/src/engine/active-cell.ts +2 -6
  111. package/src/index-lite.ts +1 -1
  112. package/src/index.ts +1 -1
  113. package/src/ui/column-chooser.ts +4 -4
  114. package/src/ui/filter-menu.ts +5 -5
  115. package/src/ui/menu.ts +4 -4
  116. package/src/ui/pagination.ts +1 -1
  117. package/src/ui/tooltip.ts +2 -2
  118. package/src/util/csv.ts +2 -2
  119. package/src/util/direction.ts +4 -3
  120. package/src/util/drag.ts +5 -3
  121. package/src/util/selector.ts +16 -0
  122. package/src/util/xlsx.ts +1 -1
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
- //#region src/util/export-table.ts
6
+ // src/util/export-table.ts
7
7
  const rowsFor = (table, scope) => {
8
8
  if (scope === "all") return table.getCoreRowModel().rows;
9
9
  if (scope === "selected") return table.getSelectedRowModel?.().rows ?? [];
@@ -20,7 +20,6 @@ const columnsFor = (table) => {
20
20
  const headerFor = (column) => String(column.columnDef.meta?.label ?? column.id);
21
21
  const formatterFor = (column) => column.columnDef.meta?.formatter;
22
22
  const widthFor = (column) => column.columnDef.meta?.width;
23
- //#endregion
24
23
  export { widthFor as a, rowsFor as i, formatterFor as n, headerFor as r, columnsFor as t };
25
24
 
26
- //# sourceMappingURL=export-table-BdabEbJG.mjs.map
25
+ //# sourceMappingURL=export-table-BggGRmzQ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"export-table-BdabEbJG.mjs","names":[],"sources":["../../src/util/export-table.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/export-table.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\nimport type { DataGridItem } from '../types'\n\n// Typed structurally, not as one edition's table: TFeatures is invariant in v9,\n// so the vanilla grid and each framework binding (whose adapter registers its\n// own reactivity feature) have mutually incompatible Table types even though\n// they expose the same row/column surface an export needs. Everything beyond\n// the core row model is optional - a reduced feature set exports whatever\n// layout/scope its features can express and falls back to core for the rest.\n\nexport interface ExportColumnMeta {\n label?: string\n formatter?: (value: unknown, item: DataGridItem) => string\n width?: number\n}\n\nexport interface ExportColumn {\n id: string\n columnDef: { meta?: unknown }\n}\n\nexport interface ExportRow {\n original: DataGridItem\n getValue: (columnId: string) => unknown\n}\n\nexport interface ExportTable {\n getAllLeafColumns: () => ExportColumn[]\n getCenterVisibleLeafColumns?: () => ExportColumn[]\n getCoreRowModel: () => { rows: ExportRow[] }\n getEndVisibleLeafColumns?: () => ExportColumn[]\n getFilteredRowModel?: () => { rows: ExportRow[] }\n getSelectedRowModel?: () => { rows: ExportRow[] }\n getSortedRowModel?: () => { rows: ExportRow[] }\n getStartVisibleLeafColumns?: () => ExportColumn[]\n getVisibleLeafColumns?: () => ExportColumn[]\n}\n\nexport type ExportScope = 'filtered' | 'all' | 'selected'\n\nexport const rowsFor = (table: ExportTable, scope: ExportScope | undefined): ExportRow[] => {\n if (scope === 'all') {\n return table.getCoreRowModel().rows\n }\n\n if (scope === 'selected') {\n return table.getSelectedRowModel?.().rows ?? []\n }\n\n return (table.getSortedRowModel ?? table.getFilteredRowModel ?? table.getCoreRowModel)().rows\n}\n\n// Exports follow the rendered layout: pinning, column order and visibility -\n// as far as the registered features track them.\nexport const columnsFor = (table: ExportTable): ExportColumn[] => {\n if (table.getCenterVisibleLeafColumns) {\n return [\n ...(table.getStartVisibleLeafColumns?.() ?? []),\n ...table.getCenterVisibleLeafColumns(),\n ...(table.getEndVisibleLeafColumns?.() ?? [])\n ]\n }\n\n return table.getVisibleLeafColumns?.() ?? table.getAllLeafColumns()\n}\n\nexport const headerFor = (column: ExportColumn): string =>\n String((column.columnDef.meta as ExportColumnMeta)?.label ?? column.id)\n\n// A column formatter is author intent and matches what the grid renders, so\n// exports honor it - which also means a formatted number leaves as text.\nexport const formatterFor = (column: ExportColumn): ExportColumnMeta['formatter'] =>\n (column.columnDef.meta as ExportColumnMeta)?.formatter\n\n// The author's declared column width in px. Deliberately NOT column.getSize():\n// that returns table-core's 150 px default whenever the grid does not track\n// sizing, which would force an arbitrary width on every exported column. A\n// consequence is that an interactive resize is not carried into the export.\nexport const widthFor = (column: ExportColumn): number | undefined =>\n (column.columnDef.meta as ExportColumnMeta)?.width\n"],"mappings":";;;;;;AA8CA,MAAa,WAAW,OAAoB,UAAgD;CAC1F,IAAI,UAAU,OACZ,OAAO,MAAM,gBAAgB,CAAC,CAAC;CAGjC,IAAI,UAAU,YACZ,OAAO,MAAM,sBAAsB,CAAC,CAAC,QAAQ,CAAC;CAGhD,QAAQ,MAAM,qBAAqB,MAAM,uBAAuB,MAAM,gBAAA,CAAiB,CAAC,CAAC;AAC3F;AAIA,MAAa,cAAc,UAAuC;CAChE,IAAI,MAAM,6BACR,OAAO;EACL,GAAI,MAAM,6BAA6B,KAAK,CAAC;EAC7C,GAAG,MAAM,4BAA4B;EACrC,GAAI,MAAM,2BAA2B,KAAK,CAAC;CAC7C;CAGF,OAAO,MAAM,wBAAwB,KAAK,MAAM,kBAAkB;AACpE;AAEA,MAAa,aAAa,WACxB,OAAQ,OAAO,UAAU,MAA2B,SAAS,OAAO,EAAE;AAIxE,MAAa,gBAAgB,WAC1B,OAAO,UAAU,MAA2B;AAM/C,MAAa,YAAY,WACtB,OAAO,UAAU,MAA2B"}
1
+ {"version":3,"file":"export-table-BggGRmzQ.mjs","names":[],"sources":["../../src/util/export-table.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/export-table.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\nimport type { DataGridItem } from '../types'\n\n// Typed structurally, not as one edition's table: TFeatures is invariant in v9,\n// so the vanilla grid and each framework binding (whose adapter registers its\n// own reactivity feature) have mutually incompatible Table types even though\n// they expose the same row/column surface an export needs. Everything beyond\n// the core row model is optional - a reduced feature set exports whatever\n// layout/scope its features can express and falls back to core for the rest.\n\nexport interface ExportColumnMeta {\n label?: string\n formatter?: (value: unknown, item: DataGridItem) => string\n width?: number\n}\n\nexport interface ExportColumn {\n id: string\n columnDef: { meta?: unknown }\n}\n\nexport interface ExportRow {\n original: DataGridItem\n getValue: (columnId: string) => unknown\n}\n\nexport interface ExportTable {\n getAllLeafColumns: () => ExportColumn[]\n getCenterVisibleLeafColumns?: () => ExportColumn[]\n getCoreRowModel: () => { rows: ExportRow[] }\n getEndVisibleLeafColumns?: () => ExportColumn[]\n getFilteredRowModel?: () => { rows: ExportRow[] }\n getSelectedRowModel?: () => { rows: ExportRow[] }\n getSortedRowModel?: () => { rows: ExportRow[] }\n getStartVisibleLeafColumns?: () => ExportColumn[]\n getVisibleLeafColumns?: () => ExportColumn[]\n}\n\nexport type ExportScope = 'filtered' | 'all' | 'selected'\n\nexport const rowsFor = (table: ExportTable, scope: ExportScope | undefined): ExportRow[] => {\n if (scope === 'all') {\n return table.getCoreRowModel().rows\n }\n\n if (scope === 'selected') {\n return table.getSelectedRowModel?.().rows ?? []\n }\n\n return (table.getSortedRowModel ?? table.getFilteredRowModel ?? table.getCoreRowModel)().rows\n}\n\n// Exports follow the rendered layout: pinning, column order and visibility -\n// as far as the registered features track them.\nexport const columnsFor = (table: ExportTable): ExportColumn[] => {\n if (table.getCenterVisibleLeafColumns) {\n return [\n ...(table.getStartVisibleLeafColumns?.() ?? []),\n ...table.getCenterVisibleLeafColumns(),\n ...(table.getEndVisibleLeafColumns?.() ?? [])\n ]\n }\n\n return table.getVisibleLeafColumns?.() ?? table.getAllLeafColumns()\n}\n\nexport const headerFor = (column: ExportColumn): string =>\n String((column.columnDef.meta as ExportColumnMeta)?.label ?? column.id)\n\n// A column formatter is author intent and matches what the grid renders, so\n// exports honor it - which also means a formatted number leaves as text.\nexport const formatterFor = (column: ExportColumn): ExportColumnMeta['formatter'] =>\n (column.columnDef.meta as ExportColumnMeta)?.formatter\n\n// The author's declared column width in px. Deliberately NOT column.getSize():\n// that returns table-core's 150 px default whenever the grid does not track\n// sizing, which would force an arbitrary width on every exported column. A\n// consequence is that an interactive resize is not carried into the export.\nexport const widthFor = (column: ExportColumn): number | undefined =>\n (column.columnDef.meta as ExportColumnMeta)?.width\n"],"mappings":";;;;;;AA8CA,MAAa,WAAW,OAAoB,UAAgD;CAC1F,IAAI,UAAU,OACZ,OAAO,MAAM,gBAAgB,CAAC,CAAC;CAGjC,IAAI,UAAU,YACZ,OAAO,MAAM,sBAAsB,CAAC,CAAC,QAAQ,CAAC;CAGhD,QAAQ,MAAM,qBAAqB,MAAM,uBAAuB,MAAM,gBAAA,CAAiB,CAAC,CAAC;AAC3F;AAIA,MAAa,cAAc,UAAuC;CAChE,IAAI,MAAM,6BACR,OAAO;EACL,GAAI,MAAM,6BAA6B,KAAK,CAAC;EAC7C,GAAG,MAAM,4BAA4B;EACrC,GAAI,MAAM,2BAA2B,KAAK,CAAC;CAC7C;CAGF,OAAO,MAAM,wBAAwB,KAAK,MAAM,kBAAkB;AACpE;AAEA,MAAa,aAAa,WACxB,OAAQ,OAAO,UAAU,MAA2B,SAAS,OAAO,EAAE;AAIxE,MAAa,gBAAgB,WAC1B,OAAO,UAAU,MAA2B;AAM/C,MAAa,YAAY,WACtB,OAAO,UAAU,MAA2B"}
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
- //#region src/util/export-table.ts
6
+ // src/util/export-table.ts
7
7
  const rowsFor = (table, scope) => {
8
8
  if (scope === "all") return table.getCoreRowModel().rows;
9
9
  if (scope === "selected") return table.getSelectedRowModel?.().rows ?? [];
@@ -20,7 +20,6 @@ const columnsFor = (table) => {
20
20
  const headerFor = (column) => String(column.columnDef.meta?.label ?? column.id);
21
21
  const formatterFor = (column) => column.columnDef.meta?.formatter;
22
22
  const widthFor = (column) => column.columnDef.meta?.width;
23
- //#endregion
24
23
  Object.defineProperty(exports, "columnsFor", {
25
24
  enumerable: true,
26
25
  get: function() {
@@ -52,4 +51,4 @@ Object.defineProperty(exports, "widthFor", {
52
51
  }
53
52
  });
54
53
 
55
- //# sourceMappingURL=export-table-D762wrZ1.cjs.map
54
+ //# sourceMappingURL=export-table-BiB3_lVo.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"export-table-D762wrZ1.cjs","names":[],"sources":["../../src/util/export-table.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/export-table.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\nimport type { DataGridItem } from '../types'\n\n// Typed structurally, not as one edition's table: TFeatures is invariant in v9,\n// so the vanilla grid and each framework binding (whose adapter registers its\n// own reactivity feature) have mutually incompatible Table types even though\n// they expose the same row/column surface an export needs. Everything beyond\n// the core row model is optional - a reduced feature set exports whatever\n// layout/scope its features can express and falls back to core for the rest.\n\nexport interface ExportColumnMeta {\n label?: string\n formatter?: (value: unknown, item: DataGridItem) => string\n width?: number\n}\n\nexport interface ExportColumn {\n id: string\n columnDef: { meta?: unknown }\n}\n\nexport interface ExportRow {\n original: DataGridItem\n getValue: (columnId: string) => unknown\n}\n\nexport interface ExportTable {\n getAllLeafColumns: () => ExportColumn[]\n getCenterVisibleLeafColumns?: () => ExportColumn[]\n getCoreRowModel: () => { rows: ExportRow[] }\n getEndVisibleLeafColumns?: () => ExportColumn[]\n getFilteredRowModel?: () => { rows: ExportRow[] }\n getSelectedRowModel?: () => { rows: ExportRow[] }\n getSortedRowModel?: () => { rows: ExportRow[] }\n getStartVisibleLeafColumns?: () => ExportColumn[]\n getVisibleLeafColumns?: () => ExportColumn[]\n}\n\nexport type ExportScope = 'filtered' | 'all' | 'selected'\n\nexport const rowsFor = (table: ExportTable, scope: ExportScope | undefined): ExportRow[] => {\n if (scope === 'all') {\n return table.getCoreRowModel().rows\n }\n\n if (scope === 'selected') {\n return table.getSelectedRowModel?.().rows ?? []\n }\n\n return (table.getSortedRowModel ?? table.getFilteredRowModel ?? table.getCoreRowModel)().rows\n}\n\n// Exports follow the rendered layout: pinning, column order and visibility -\n// as far as the registered features track them.\nexport const columnsFor = (table: ExportTable): ExportColumn[] => {\n if (table.getCenterVisibleLeafColumns) {\n return [\n ...(table.getStartVisibleLeafColumns?.() ?? []),\n ...table.getCenterVisibleLeafColumns(),\n ...(table.getEndVisibleLeafColumns?.() ?? [])\n ]\n }\n\n return table.getVisibleLeafColumns?.() ?? table.getAllLeafColumns()\n}\n\nexport const headerFor = (column: ExportColumn): string =>\n String((column.columnDef.meta as ExportColumnMeta)?.label ?? column.id)\n\n// A column formatter is author intent and matches what the grid renders, so\n// exports honor it - which also means a formatted number leaves as text.\nexport const formatterFor = (column: ExportColumn): ExportColumnMeta['formatter'] =>\n (column.columnDef.meta as ExportColumnMeta)?.formatter\n\n// The author's declared column width in px. Deliberately NOT column.getSize():\n// that returns table-core's 150 px default whenever the grid does not track\n// sizing, which would force an arbitrary width on every exported column. A\n// consequence is that an interactive resize is not carried into the export.\nexport const widthFor = (column: ExportColumn): number | undefined =>\n (column.columnDef.meta as ExportColumnMeta)?.width\n"],"mappings":";;;;;;AA8CA,MAAa,WAAW,OAAoB,UAAgD;CAC1F,IAAI,UAAU,OACZ,OAAO,MAAM,gBAAgB,CAAC,CAAC;CAGjC,IAAI,UAAU,YACZ,OAAO,MAAM,sBAAsB,CAAC,CAAC,QAAQ,CAAC;CAGhD,QAAQ,MAAM,qBAAqB,MAAM,uBAAuB,MAAM,gBAAA,CAAiB,CAAC,CAAC;AAC3F;AAIA,MAAa,cAAc,UAAuC;CAChE,IAAI,MAAM,6BACR,OAAO;EACL,GAAI,MAAM,6BAA6B,KAAK,CAAC;EAC7C,GAAG,MAAM,4BAA4B;EACrC,GAAI,MAAM,2BAA2B,KAAK,CAAC;CAC7C;CAGF,OAAO,MAAM,wBAAwB,KAAK,MAAM,kBAAkB;AACpE;AAEA,MAAa,aAAa,WACxB,OAAQ,OAAO,UAAU,MAA2B,SAAS,OAAO,EAAE;AAIxE,MAAa,gBAAgB,WAC1B,OAAO,UAAU,MAA2B;AAM/C,MAAa,YAAY,WACtB,OAAO,UAAU,MAA2B"}
1
+ {"version":3,"file":"export-table-BiB3_lVo.cjs","names":[],"sources":["../../src/util/export-table.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/export-table.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\nimport type { DataGridItem } from '../types'\n\n// Typed structurally, not as one edition's table: TFeatures is invariant in v9,\n// so the vanilla grid and each framework binding (whose adapter registers its\n// own reactivity feature) have mutually incompatible Table types even though\n// they expose the same row/column surface an export needs. Everything beyond\n// the core row model is optional - a reduced feature set exports whatever\n// layout/scope its features can express and falls back to core for the rest.\n\nexport interface ExportColumnMeta {\n label?: string\n formatter?: (value: unknown, item: DataGridItem) => string\n width?: number\n}\n\nexport interface ExportColumn {\n id: string\n columnDef: { meta?: unknown }\n}\n\nexport interface ExportRow {\n original: DataGridItem\n getValue: (columnId: string) => unknown\n}\n\nexport interface ExportTable {\n getAllLeafColumns: () => ExportColumn[]\n getCenterVisibleLeafColumns?: () => ExportColumn[]\n getCoreRowModel: () => { rows: ExportRow[] }\n getEndVisibleLeafColumns?: () => ExportColumn[]\n getFilteredRowModel?: () => { rows: ExportRow[] }\n getSelectedRowModel?: () => { rows: ExportRow[] }\n getSortedRowModel?: () => { rows: ExportRow[] }\n getStartVisibleLeafColumns?: () => ExportColumn[]\n getVisibleLeafColumns?: () => ExportColumn[]\n}\n\nexport type ExportScope = 'filtered' | 'all' | 'selected'\n\nexport const rowsFor = (table: ExportTable, scope: ExportScope | undefined): ExportRow[] => {\n if (scope === 'all') {\n return table.getCoreRowModel().rows\n }\n\n if (scope === 'selected') {\n return table.getSelectedRowModel?.().rows ?? []\n }\n\n return (table.getSortedRowModel ?? table.getFilteredRowModel ?? table.getCoreRowModel)().rows\n}\n\n// Exports follow the rendered layout: pinning, column order and visibility -\n// as far as the registered features track them.\nexport const columnsFor = (table: ExportTable): ExportColumn[] => {\n if (table.getCenterVisibleLeafColumns) {\n return [\n ...(table.getStartVisibleLeafColumns?.() ?? []),\n ...table.getCenterVisibleLeafColumns(),\n ...(table.getEndVisibleLeafColumns?.() ?? [])\n ]\n }\n\n return table.getVisibleLeafColumns?.() ?? table.getAllLeafColumns()\n}\n\nexport const headerFor = (column: ExportColumn): string =>\n String((column.columnDef.meta as ExportColumnMeta)?.label ?? column.id)\n\n// A column formatter is author intent and matches what the grid renders, so\n// exports honor it - which also means a formatted number leaves as text.\nexport const formatterFor = (column: ExportColumn): ExportColumnMeta['formatter'] =>\n (column.columnDef.meta as ExportColumnMeta)?.formatter\n\n// The author's declared column width in px. Deliberately NOT column.getSize():\n// that returns table-core's 150 px default whenever the grid does not track\n// sizing, which would force an arbitrary width on every exported column. A\n// consequence is that an interactive resize is not carried into the export.\nexport const widthFor = (column: ExportColumn): number | undefined =>\n (column.columnDef.meta as ExportColumnMeta)?.width\n"],"mappings":";;;;;;AA8CA,MAAa,WAAW,OAAoB,UAAgD;CAC1F,IAAI,UAAU,OACZ,OAAO,MAAM,gBAAgB,CAAC,CAAC;CAGjC,IAAI,UAAU,YACZ,OAAO,MAAM,sBAAsB,CAAC,CAAC,QAAQ,CAAC;CAGhD,QAAQ,MAAM,qBAAqB,MAAM,uBAAuB,MAAM,gBAAA,CAAiB,CAAC,CAAC;AAC3F;AAIA,MAAa,cAAc,UAAuC;CAChE,IAAI,MAAM,6BACR,OAAO;EACL,GAAI,MAAM,6BAA6B,KAAK,CAAC;EAC7C,GAAG,MAAM,4BAA4B;EACrC,GAAI,MAAM,2BAA2B,KAAK,CAAC;CAC7C;CAGF,OAAO,MAAM,wBAAwB,KAAK,MAAM,kBAAkB;AACpE;AAEA,MAAa,aAAa,WACxB,OAAQ,OAAO,UAAU,MAA2B,SAAS,OAAO,EAAE;AAIxE,MAAa,gBAAgB,WAC1B,OAAO,UAAU,MAA2B;AAM/C,MAAa,YAAY,WACtB,OAAO,UAAU,MAA2B"}
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- //#region src/filters.ts
7
+ // src/filters.ts
8
8
  const FILTER_OPERATORS = {
9
9
  text: [
10
10
  "contains",
@@ -92,7 +92,6 @@ const evaluateColumnFilter = (cellValue, filterValue, filterType = "text") => {
92
92
  }
93
93
  return filterValue.value.some((candidate) => String(candidate) === String(cellValue));
94
94
  };
95
- //#endregion
96
95
  exports.FILTER_OPERATORS = FILTER_OPERATORS;
97
96
  exports.VALUELESS_OPERATORS = VALUELESS_OPERATORS;
98
97
  exports.evaluateColumnFilter = evaluateColumnFilter;
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
- //#region src/filters.ts
6
+ // src/filters.ts
7
7
  const FILTER_OPERATORS = {
8
8
  text: [
9
9
  "contains",
@@ -91,7 +91,6 @@ const evaluateColumnFilter = (cellValue, filterValue, filterType = "text") => {
91
91
  }
92
92
  return filterValue.value.some((candidate) => String(candidate) === String(cellValue));
93
93
  };
94
- //#endregion
95
94
  export { FILTER_OPERATORS, VALUELESS_OPERATORS, evaluateColumnFilter };
96
95
 
97
96
  //# sourceMappingURL=filters.mjs.map
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- //#region src/labels.ts
7
+ // src/labels.ts
8
8
  const DEFAULT_LABELS = {
9
9
  addCondition: "Add condition",
10
10
  applyFilter: "Apply",
@@ -64,7 +64,6 @@ const DEFAULT_LABELS = {
64
64
  unpin: "Unpin"
65
65
  };
66
66
  const interpolate = (template, tokens) => template.replace(/\{(\w+)\}/g, (match, token) => token in tokens ? String(tokens[token]) : match);
67
- //#endregion
68
67
  exports.DEFAULT_LABELS = DEFAULT_LABELS;
69
68
  exports.interpolate = interpolate;
70
69
 
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
- //#region src/labels.ts
6
+ // src/labels.ts
7
7
  const DEFAULT_LABELS = {
8
8
  addCondition: "Add condition",
9
9
  applyFilter: "Apply",
@@ -63,7 +63,6 @@ const DEFAULT_LABELS = {
63
63
  unpin: "Unpin"
64
64
  };
65
65
  const interpolate = (template, tokens) => template.replace(/\{(\w+)\}/g, (match, token) => token in tokens ? String(tokens[token]) : match);
66
- //#endregion
67
66
  export { DEFAULT_LABELS, interpolate };
68
67
 
69
68
  //# sourceMappingURL=labels.mjs.map
package/dist/js/print.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- //#region src/util/print.ts
7
+ // src/util/print.ts
8
8
  const CLASS_NAME_PRINT_ROOT = "data-grid-print-root";
9
9
  const printRows = (table) => {
10
10
  if (typeof table.getSortedRowModel === "function") return table.getSortedRowModel().rows;
@@ -59,7 +59,6 @@ const printGrid = (table, columns, options = {}) => {
59
59
  cleanup();
60
60
  }
61
61
  };
62
- //#endregion
63
62
  exports.createPrintTable = createPrintTable;
64
63
  exports.printGrid = printGrid;
65
64
 
package/dist/js/print.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
- //#region src/util/print.ts
6
+ // src/util/print.ts
7
7
  const CLASS_NAME_PRINT_ROOT = "data-grid-print-root";
8
8
  const printRows = (table) => {
9
9
  if (typeof table.getSortedRowModel === "function") return table.getSortedRowModel().rows;
@@ -58,7 +58,6 @@ const printGrid = (table, columns, options = {}) => {
58
58
  cleanup();
59
59
  }
60
60
  };
61
- //#endregion
62
61
  export { createPrintTable, printGrid };
63
62
 
64
63
  //# sourceMappingURL=print.mjs.map
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
+ * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
+ * License (https://coreui.io/pro/license/)
5
+ */
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ // src/util/selector.ts
8
+ /**
9
+ * --------------------------------------------------------------------------
10
+ * CoreUI PRO data-grid util/selector.ts
11
+ * License (https://coreui.io/pro/license/)
12
+ * --------------------------------------------------------------------------
13
+ */
14
+ /**
15
+ * Escapes a column key or row index for a double-quoted CSS attribute selector value.
16
+ * @param value The key or index interpolated into `[data-…="…"]`.
17
+ * @returns The value as a string, with `"` and `\` backslash-escaped and line breaks as hex escapes.
18
+ */
19
+ const escapeAttributeValue = (value) => String(value).replace(/["\\]/g, "\\$&").replace(/[\n\r\f]/g, (character) => `\\${character.codePointAt(0).toString(16)} `);
20
+ exports.escapeAttributeValue = escapeAttributeValue;
21
+
22
+ //# sourceMappingURL=selector.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selector.cjs","names":[],"sources":["../../src/util/selector.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/selector.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\n/**\n * Escapes a column key or row index for a double-quoted CSS attribute selector value.\n * @param value The key or index interpolated into `[data-…=\"…\"]`.\n * @returns The value as a string, with `\"` and `\\` backslash-escaped and line breaks as hex escapes.\n */\nexport const escapeAttributeValue = (value: string | number): string =>\n String(value)\n .replace(/[\"\\\\]/g, '\\\\$&')\n .replace(/[\\n\\r\\f]/g, character => `\\\\${character.codePointAt(0)!.toString(16)} `)\n"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,MAAa,wBAAwB,UACnC,OAAO,KAAK,CAAC,CACV,QAAQ,UAAU,MAAM,CAAC,CACzB,QAAQ,cAAa,cAAa,KAAK,UAAU,YAAY,CAAC,CAAC,CAAE,SAAS,EAAE,EAAE,EAAE"}
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
+ * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
+ * License (https://coreui.io/pro/license/)
5
+ */
6
+ // src/util/selector.ts
7
+ /**
8
+ * --------------------------------------------------------------------------
9
+ * CoreUI PRO data-grid util/selector.ts
10
+ * License (https://coreui.io/pro/license/)
11
+ * --------------------------------------------------------------------------
12
+ */
13
+ /**
14
+ * Escapes a column key or row index for a double-quoted CSS attribute selector value.
15
+ * @param value The key or index interpolated into `[data-…="…"]`.
16
+ * @returns The value as a string, with `"` and `\` backslash-escaped and line breaks as hex escapes.
17
+ */
18
+ const escapeAttributeValue = (value) => String(value).replace(/["\\]/g, "\\$&").replace(/[\n\r\f]/g, (character) => `\\${character.codePointAt(0).toString(16)} `);
19
+ export { escapeAttributeValue };
20
+
21
+ //# sourceMappingURL=selector.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selector.mjs","names":[],"sources":["../../src/util/selector.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/selector.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\n/**\n * Escapes a column key or row index for a double-quoted CSS attribute selector value.\n * @param value The key or index interpolated into `[data-…=\"…\"]`.\n * @returns The value as a string, with `\"` and `\\` backslash-escaped and line breaks as hex escapes.\n */\nexport const escapeAttributeValue = (value: string | number): string =>\n String(value)\n .replace(/[\"\\\\]/g, '\\\\$&')\n .replace(/[\\n\\r\\f]/g, character => `\\\\${character.codePointAt(0)!.toString(16)} `)\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAa,wBAAwB,UACnC,OAAO,KAAK,CAAC,CACV,QAAQ,UAAU,MAAM,CAAC,CACzB,QAAQ,cAAa,cAAa,KAAK,UAAU,YAAY,CAAC,CAAC,CAAE,SAAS,EAAE,EAAE,EAAE"}
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- //#region src/engine/validate.ts
7
+ // src/engine/validate.ts
8
8
  const FLAG_FEATURES = [
9
9
  ["cellSelection", ["cellSelectionFeature"]],
10
10
  ["columnFilters", ["columnFilteringFeature", "filteredRowModel"]],
@@ -37,7 +37,6 @@ const assertFeatureCoverage = (componentName, features, flags) => {
37
37
  for (const key of requiredKeys) if (!(key in features)) throw new TypeError(`${componentName.toUpperCase()}: Option "${label}" requires feature "${key}" in "features".`);
38
38
  }
39
39
  };
40
- //#endregion
41
40
  exports.assertFeatureCoverage = assertFeatureCoverage;
42
41
 
43
42
  //# sourceMappingURL=validate.cjs.map
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
- //#region src/engine/validate.ts
6
+ // src/engine/validate.ts
7
7
  const FLAG_FEATURES = [
8
8
  ["cellSelection", ["cellSelectionFeature"]],
9
9
  ["columnFilters", ["columnFilteringFeature", "filteredRowModel"]],
@@ -36,7 +36,6 @@ const assertFeatureCoverage = (componentName, features, flags) => {
36
36
  for (const key of requiredKeys) if (!(key in features)) throw new TypeError(`${componentName.toUpperCase()}: Option "${label}" requires feature "${key}" in "features".`);
37
37
  }
38
38
  };
39
- //#endregion
40
39
  export { assertFeatureCoverage };
41
40
 
42
41
  //# sourceMappingURL=validate.mjs.map
package/dist/js/xlsx.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- const require_export_table = require("./export-table-D762wrZ1.cjs");
8
- //#region src/util/zip.ts
7
+ const require_export_table = require("./export-table-BiB3_lVo.cjs");
8
+ // src/util/zip.ts
9
9
  /**
10
10
  * --------------------------------------------------------------------------
11
11
  * CoreUI PRO data-grid util/zip.ts
@@ -120,8 +120,7 @@ const zip = (entries) => {
120
120
  writer.u16(0);
121
121
  return writer.result();
122
122
  };
123
- //#endregion
124
- //#region src/util/xlsx.ts
123
+ // src/util/xlsx.ts
125
124
  /**
126
125
  * --------------------------------------------------------------------------
127
126
  * CoreUI PRO data-grid util/xlsx.ts
@@ -134,7 +133,7 @@ const PX_PER_CHARACTER = 7;
134
133
  const CELL_PADDING_PX = 5;
135
134
  const MIN_COLUMN_WIDTH = 4;
136
135
  const MAX_COLUMN_WIDTH = 120;
137
- const CONTROL_CHARACTERS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;
136
+ const CONTROL_CHARACTERS = /[\u{0}-\u{8}\u{B}\u{C}\u{E}-\u{1F}]/gu;
138
137
  const escapeXml = (value) => value.replace(CONTROL_CHARACTERS, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
139
138
  const cellReference = (columnIndex, rowNumber) => {
140
139
  let reference = "";
@@ -233,7 +232,6 @@ const downloadXlsx = (table, options = {}) => {
233
232
  anchor.remove();
234
233
  setTimeout(() => URL.revokeObjectURL(url));
235
234
  };
236
- //#endregion
237
235
  exports.downloadXlsx = downloadXlsx;
238
236
  exports.exportXlsx = exportXlsx;
239
237
 
@@ -1 +1 @@
1
- {"version":3,"file":"xlsx.cjs","names":["widthFor","columnsFor","rowsFor","headerFor","formatterFor"],"sources":["../../src/util/zip.ts","../../src/util/xlsx.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/zip.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\n/* eslint-disable no-bitwise -- CRC32 and the ZIP header fields are defined\n in bit terms; expressing them any other way would obscure the format. */\n\n// A minimal ZIP writer for the xlsx export. Entries are STORED (uncompressed),\n// which the format allows and which keeps the writer dependency-free - an\n// export of a few thousand rows is XML text the browser hands straight to a\n// download, so the deflate round-trip would buy little. Timestamps are fixed\n// at the DOS epoch so the same data always produces the same bytes.\n\nconst DOS_EPOCH_TIME = 0\nconst DOS_EPOCH_DATE = 0x0021\n// UTF-8 filename bit; every name we write is ASCII, but the flag is correct\n// and costs nothing.\nconst FLAG_UTF8 = 0x0800\n\nlet crcTable: Uint32Array | null = null\n\nconst getCrcTable = (): Uint32Array => {\n if (crcTable) {\n return crcTable\n }\n\n const table = new Uint32Array(256)\n for (let index = 0; index < 256; index++) {\n let value = index\n for (let bit = 0; bit < 8; bit++) {\n value = value & 1 ? 0xED_B8_83_20 ^ (value >>> 1) : value >>> 1\n }\n\n table[index] = value >>> 0\n }\n\n crcTable = table\n return table\n}\n\nconst crc32 = (bytes: Uint8Array): number => {\n const table = getCrcTable()\n let crc = 0xFF_FF_FF_FF\n for (const byte of bytes) {\n crc = table[(crc ^ byte) & 0xFF]! ^ (crc >>> 8)\n }\n\n return (crc ^ 0xFF_FF_FF_FF) >>> 0\n}\n\nexport interface ZipEntry {\n name: string\n data: Uint8Array\n}\n\ninterface StagedEntry extends ZipEntry {\n crc: number\n nameBytes: Uint8Array\n offset: number\n}\n\nconst LOCAL_HEADER_SIZE = 30\nconst CENTRAL_HEADER_SIZE = 46\nconst END_RECORD_SIZE = 22\n\nclass ByteWriter {\n private readonly view: DataView\n private readonly bytes: Uint8Array\n private cursor = 0\n\n constructor(size: number) {\n this.bytes = new Uint8Array(size)\n this.view = new DataView(this.bytes.buffer)\n }\n\n u16(value: number): void {\n this.view.setUint16(this.cursor, value, true)\n this.cursor += 2\n }\n\n u32(value: number): void {\n this.view.setUint32(this.cursor, value, true)\n this.cursor += 4\n }\n\n raw(value: Uint8Array): void {\n this.bytes.set(value, this.cursor)\n this.cursor += value.length\n }\n\n result(): Uint8Array {\n return this.bytes\n }\n}\n\nexport const zip = (entries: ZipEntry[]): Uint8Array => {\n const encoder = new TextEncoder()\n const staged: StagedEntry[] = []\n let offset = 0\n\n for (const entry of entries) {\n const nameBytes = encoder.encode(entry.name)\n staged.push({\n ...entry,\n crc: crc32(entry.data),\n nameBytes,\n offset\n })\n offset += LOCAL_HEADER_SIZE + nameBytes.length + entry.data.length\n }\n\n const centralDirectoryOffset = offset\n const centralDirectorySize = staged.reduce(\n (total, entry) => total + CENTRAL_HEADER_SIZE + entry.nameBytes.length,\n 0\n )\n\n const writer = new ByteWriter(centralDirectoryOffset + centralDirectorySize + END_RECORD_SIZE)\n\n for (const entry of staged) {\n writer.u32(0x04_03_4B_50)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.raw(entry.nameBytes)\n writer.raw(entry.data)\n }\n\n for (const entry of staged) {\n writer.u32(0x02_01_4B_50)\n writer.u16(20)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u32(0)\n writer.u32(entry.offset)\n writer.raw(entry.nameBytes)\n }\n\n writer.u32(0x06_05_4B_50)\n writer.u16(0)\n writer.u16(0)\n writer.u16(staged.length)\n writer.u16(staged.length)\n writer.u32(centralDirectorySize)\n writer.u32(centralDirectoryOffset)\n writer.u16(0)\n\n return writer.result()\n}\n","/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/xlsx.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\nimport {\n columnsFor, formatterFor, headerFor, rowsFor, widthFor, type ExportColumn, type ExportScope, type ExportTable\n} from './export-table'\nimport { zip, type ZipEntry } from './zip'\n\nexport interface XlsxOptions {\n scope?: ExportScope\n sheetName?: string\n}\n\nexport interface XlsxDownloadOptions extends XlsxOptions {\n filename?: string\n}\n\nexport type XlsxTable = ExportTable\n\nconst MIME_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\nconst DEFAULT_SHEET_NAME = 'Sheet1'\n// Excel column widths count characters, not pixels: the default 8.43 width is\n// 64 px, and each further character adds 7 px on top of the 5 px padding.\nconst PX_PER_CHARACTER = 7\nconst CELL_PADDING_PX = 5\nconst MIN_COLUMN_WIDTH = 4\nconst MAX_COLUMN_WIDTH = 120\n\n// XML 1.0 forbids most control characters outright - Excel refuses to open a\n// file containing them, so they are dropped rather than escaped.\n// eslint-disable-next-line no-control-regex -- matching them is the point\nconst CONTROL_CHARACTERS = /[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F]/g\n\nconst escapeXml = (value: string): string =>\n value\n .replace(CONTROL_CHARACTERS, '')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n\n// A1, B1 … Z1, AA1 - Excel's bijective base-26 column reference.\nconst cellReference = (columnIndex: number, rowNumber: number): string => {\n let reference = ''\n let index = columnIndex\n while (index >= 0) {\n reference = String.fromCodePoint(65 + (index % 26)) + reference\n index = Math.floor(index / 26) - 1\n }\n\n return `${reference}${rowNumber}`\n}\n\n// Sheet names cannot contain : \\ / ? * [ ] and cap at 31 characters.\nconst sheetNameFor = (name: string | undefined): string => {\n const cleaned = (name ?? DEFAULT_SHEET_NAME).replace(/[:\\\\/?*[\\]]/g, ' ').trim().slice(0, 31)\n return cleaned.length > 0 ? cleaned : DEFAULT_SHEET_NAME\n}\n\nconst sheetWidthFor = (column: ExportColumn): number | null => {\n const size = widthFor(column)\n if (typeof size !== 'number' || !Number.isFinite(size) || size <= 0) {\n return null\n }\n\n const characters = (size - CELL_PADDING_PX) / PX_PER_CHARACTER\n return Math.min(MAX_COLUMN_WIDTH, Math.max(MIN_COLUMN_WIDTH, Math.round(characters * 100) / 100))\n}\n\n// Values reach a cell as one of three Excel types. Inline strings keep the\n// file self-contained (no shared-strings part) and are never parsed as\n// formulas, so a leading \"=\" is data here, unlike in CSV.\nconst cellXml = (reference: string, value: unknown, styleIndex: number): string => {\n const style = styleIndex > 0 ? ` s=\"${styleIndex}\"` : ''\n\n if (typeof value === 'number' && Number.isFinite(value)) {\n return `<c r=\"${reference}\"${style}><v>${value}</v></c>`\n }\n\n if (typeof value === 'boolean') {\n return `<c r=\"${reference}\"${style} t=\"b\"><v>${value ? 1 : 0}</v></c>`\n }\n\n const text = String(value ?? '')\n if (text === '') {\n return `<c r=\"${reference}\"${style}/>`\n }\n\n return `<c r=\"${reference}\"${style} t=\"inlineStr\"><is><t xml:space=\"preserve\">${escapeXml(text)}</t></is></c>`\n}\n\nconst CONTENT_TYPES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\"><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Default Extension=\"xml\" ContentType=\"application/xml\"/><Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/><Override PartName=\"/xl/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/></Types>`\n\nconst ROOT_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"xl/workbook.xml\"/></Relationships>`\n\nconst WORKBOOK_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/></Relationships>`\n\n// Style 0 is the default cell, style 1 the bold header. Excel expects the two\n// conventional fills (none, gray125) and the built-in \"Normal\" cell style to\n// exist even when unused - without them readers report a missing default\n// style and Excel offers to repair the file.\nconst STYLES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><fonts count=\"2\"><font><sz val=\"11\"/><name val=\"Calibri\"/></font><font><b/><sz val=\"11\"/><name val=\"Calibri\"/></font></fonts><fills count=\"2\"><fill><patternFill patternType=\"none\"/></fill><fill><patternFill patternType=\"gray125\"/></fill></fills><borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs><cellXfs count=\"2\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/><xf numFmtId=\"0\" fontId=\"1\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\"/></cellXfs><cellStyles count=\"1\"><cellStyle name=\"Normal\" xfId=\"0\" builtinId=\"0\"/></cellStyles></styleSheet>`\n\nconst workbookXml = (sheetName: string): string =>\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"><sheets><sheet name=\"${escapeXml(sheetName)}\" sheetId=\"1\" r:id=\"rId1\"/></sheets></workbook>`\n\nconst worksheetXml = (table: XlsxTable, options: XlsxOptions): string => {\n const columns = columnsFor(table)\n const rows = rowsFor(table, options.scope)\n\n const widths = columns\n .map((column, index) => {\n const width = sheetWidthFor(column)\n return width === null ?\n null :\n `<col min=\"${index + 1}\" max=\"${index + 1}\" width=\"${width}\" customWidth=\"1\"/>`\n })\n .filter((entry): entry is string => entry !== null)\n const cols = widths.length > 0 ? `<cols>${widths.join('')}</cols>` : ''\n\n const headerCells = columns\n .map((column, index) => cellXml(cellReference(index, 1), headerFor(column), 1))\n .join('')\n\n const bodyRows = rows.map((row, rowIndex) => {\n const rowNumber = rowIndex + 2\n const cells = columns\n .map((column, columnIndex) => {\n const value = row.getValue(column.id)\n const formatter = formatterFor(column)\n // A formatted value is text by definition; an unformatted one keeps\n // its native type so numbers stay numeric in Excel.\n return cellXml(\n cellReference(columnIndex, rowNumber),\n formatter ? formatter(value, row.original) ?? '' : value,\n 0\n )\n })\n .join('')\n return `<row r=\"${rowNumber}\">${cells}</row>`\n })\n\n return `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">${cols}<sheetData><row r=\"1\">${headerCells}</row>${bodyRows.join('')}</sheetData></worksheet>`\n}\n\nexport const exportXlsx = (table: XlsxTable, options: XlsxOptions = {}): Uint8Array => {\n const encoder = new TextEncoder()\n const sheetName = sheetNameFor(options.sheetName)\n const entries: ZipEntry[] = [\n { name: '[Content_Types].xml', data: encoder.encode(CONTENT_TYPES) },\n { name: '_rels/.rels', data: encoder.encode(ROOT_RELS) },\n { name: 'xl/workbook.xml', data: encoder.encode(workbookXml(sheetName)) },\n { name: 'xl/_rels/workbook.xml.rels', data: encoder.encode(WORKBOOK_RELS) },\n { name: 'xl/styles.xml', data: encoder.encode(STYLES) },\n { name: 'xl/worksheets/sheet1.xml', data: encoder.encode(worksheetXml(table, options)) }\n ]\n\n return zip(entries)\n}\n\nexport const downloadXlsx = (table: XlsxTable, options: XlsxDownloadOptions = {}): void => {\n const blob = new Blob([exportXlsx(table, options) as BlobPart], { type: MIME_TYPE })\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = options.filename ?? 'export.xlsx'\n anchor.style.display = 'none'\n // Attach before clicking (older Firefox) and defer revoke (Safari race).\n document.body.append(anchor)\n anchor.click()\n anchor.remove()\n setTimeout(() => URL.revokeObjectURL(url))\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAGvB,MAAM,YAAY;AAElB,IAAI,WAA+B;AAEnC,MAAM,oBAAiC;CACrC,IAAI,UACF,OAAO;CAGT,MAAM,wBAAQ,IAAI,YAAY,GAAG;CACjC,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,SAAS;EACxC,IAAI,QAAQ;EACZ,KAAK,IAAI,MAAM,GAAG,MAAM,GAAG,OACzB,QAAQ,QAAQ,IAAI,aAAiB,UAAU,IAAK,UAAU;EAGhE,MAAM,SAAS,UAAU;CAC3B;CAEA,WAAW;CACX,OAAO;AACT;AAEA,MAAM,SAAS,UAA8B;CAC3C,MAAM,QAAQ,YAAY;CAC1B,IAAI,MAAM;CACV,KAAK,MAAM,QAAQ,OACjB,MAAM,OAAO,MAAM,QAAQ,OAAU,QAAQ;CAG/C,QAAQ,MAAM,gBAAmB;AACnC;AAaA,MAAM,oBAAoB;AAC1B,MAAM,sBAAsB;AAC5B,MAAM,kBAAkB;AAExB,IAAM,aAAN,MAAiB;CAKf,YAAY,MAAc;EAFT,KAAA,SAAA;EAGf,KAAK,QAAQ,IAAI,WAAW,IAAI;EAChC,KAAK,OAAO,IAAI,SAAS,KAAK,MAAM,MAAM;CAC5C;CAEA,IAAI,OAAqB;EACvB,KAAK,KAAK,UAAU,KAAK,QAAQ,OAAO,IAAI;EAC5C,KAAK,UAAU;CACjB;CAEA,IAAI,OAAqB;EACvB,KAAK,KAAK,UAAU,KAAK,QAAQ,OAAO,IAAI;EAC5C,KAAK,UAAU;CACjB;CAEA,IAAI,OAAyB;EAC3B,KA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AAa,GAAG,EAAE,MAAM,UAAU,CAAC;CACnF,MAAM,MAAM,IAAI,gBAAgB,IAAI;CACpC,MAAM,SAAS,SAAS,cAAc,GAAG;CACzC,OAAO,OAAO;CACd,OAAO,WAAW,QAAQ,YAAY;CACtC,OAAO,MAAM,UAAU;CAEvB,SAAS,KAAK,OAAO,MAAM;CAC3B,OAAO,MAAM;CACb,OAAO,OAAO;CACd,iBAAiB,IAAI,gBAAgB,GAAG,CAAC;AAC3C"}
1
+ {"version":3,"file":"xlsx.cjs","names":["widthFor","columnsFor","rowsFor","headerFor","formatterFor"],"sources":["../../src/util/zip.ts","../../src/util/xlsx.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/zip.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\n/* eslint-disable no-bitwise -- CRC32 and the ZIP header fields are defined\n in bit terms; expressing them any other way would obscure the format. */\n\n// A minimal ZIP writer for the xlsx export. Entries are STORED (uncompressed),\n// which the format allows and which keeps the writer dependency-free - an\n// export of a few thousand rows is XML text the browser hands straight to a\n// download, so the deflate round-trip would buy little. Timestamps are fixed\n// at the DOS epoch so the same data always produces the same bytes.\n\nconst DOS_EPOCH_TIME = 0\nconst DOS_EPOCH_DATE = 0x0021\n// UTF-8 filename bit; every name we write is ASCII, but the flag is correct\n// and costs nothing.\nconst FLAG_UTF8 = 0x0800\n\nlet crcTable: Uint32Array | null = null\n\nconst getCrcTable = (): Uint32Array => {\n if (crcTable) {\n return crcTable\n }\n\n const table = new Uint32Array(256)\n for (let index = 0; index < 256; index++) {\n let value = index\n for (let bit = 0; bit < 8; bit++) {\n value = value & 1 ? 0xED_B8_83_20 ^ (value >>> 1) : value >>> 1\n }\n\n table[index] = value >>> 0\n }\n\n crcTable = table\n return table\n}\n\nconst crc32 = (bytes: Uint8Array): number => {\n const table = getCrcTable()\n let crc = 0xFF_FF_FF_FF\n for (const byte of bytes) {\n crc = table[(crc ^ byte) & 0xFF]! ^ (crc >>> 8)\n }\n\n return (crc ^ 0xFF_FF_FF_FF) >>> 0\n}\n\nexport interface ZipEntry {\n name: string\n data: Uint8Array\n}\n\ninterface StagedEntry extends ZipEntry {\n crc: number\n nameBytes: Uint8Array\n offset: number\n}\n\nconst LOCAL_HEADER_SIZE = 30\nconst CENTRAL_HEADER_SIZE = 46\nconst END_RECORD_SIZE = 22\n\nclass ByteWriter {\n private readonly view: DataView\n private readonly bytes: Uint8Array\n private cursor = 0\n\n constructor(size: number) {\n this.bytes = new Uint8Array(size)\n this.view = new DataView(this.bytes.buffer)\n }\n\n u16(value: number): void {\n this.view.setUint16(this.cursor, value, true)\n this.cursor += 2\n }\n\n u32(value: number): void {\n this.view.setUint32(this.cursor, value, true)\n this.cursor += 4\n }\n\n raw(value: Uint8Array): void {\n this.bytes.set(value, this.cursor)\n this.cursor += value.length\n }\n\n result(): Uint8Array {\n return this.bytes\n }\n}\n\nexport const zip = (entries: ZipEntry[]): Uint8Array => {\n const encoder = new TextEncoder()\n const staged: StagedEntry[] = []\n let offset = 0\n\n for (const entry of entries) {\n const nameBytes = encoder.encode(entry.name)\n staged.push({\n ...entry,\n crc: crc32(entry.data),\n nameBytes,\n offset\n })\n offset += LOCAL_HEADER_SIZE + nameBytes.length + entry.data.length\n }\n\n const centralDirectoryOffset = offset\n const centralDirectorySize = staged.reduce(\n (total, entry) => total + CENTRAL_HEADER_SIZE + entry.nameBytes.length,\n 0\n )\n\n const writer = new ByteWriter(centralDirectoryOffset + centralDirectorySize + END_RECORD_SIZE)\n\n for (const entry of staged) {\n writer.u32(0x04_03_4B_50)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.raw(entry.nameBytes)\n writer.raw(entry.data)\n }\n\n for (const entry of staged) {\n writer.u32(0x02_01_4B_50)\n writer.u16(20)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u32(0)\n writer.u32(entry.offset)\n writer.raw(entry.nameBytes)\n }\n\n writer.u32(0x06_05_4B_50)\n writer.u16(0)\n writer.u16(0)\n writer.u16(staged.length)\n writer.u16(staged.length)\n writer.u32(centralDirectorySize)\n writer.u32(centralDirectoryOffset)\n writer.u16(0)\n\n return writer.result()\n}\n","/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/xlsx.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\nimport {\n columnsFor, formatterFor, headerFor, rowsFor, widthFor, type ExportColumn, type ExportScope, type ExportTable\n} from './export-table'\nimport { zip, type ZipEntry } from './zip'\n\nexport interface XlsxOptions {\n scope?: ExportScope\n sheetName?: string\n}\n\nexport interface XlsxDownloadOptions extends XlsxOptions {\n filename?: string\n}\n\nexport type XlsxTable = ExportTable\n\nconst MIME_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\nconst DEFAULT_SHEET_NAME = 'Sheet1'\n// Excel column widths count characters, not pixels: the default 8.43 width is\n// 64 px, and each further character adds 7 px on top of the 5 px padding.\nconst PX_PER_CHARACTER = 7\nconst CELL_PADDING_PX = 5\nconst MIN_COLUMN_WIDTH = 4\nconst MAX_COLUMN_WIDTH = 120\n\n// XML 1.0 forbids most control characters outright - Excel refuses to open a\n// file containing them, so they are dropped rather than escaped.\n// eslint-disable-next-line no-control-regex -- matching them is the point\nconst CONTROL_CHARACTERS = /[\\u{0}-\\u{8}\\u{B}\\u{C}\\u{E}-\\u{1F}]/gu\n\nconst escapeXml = (value: string): string =>\n value\n .replace(CONTROL_CHARACTERS, '')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n\n// A1, B1 … Z1, AA1 - Excel's bijective base-26 column reference.\nconst cellReference = (columnIndex: number, rowNumber: number): string => {\n let reference = ''\n let index = columnIndex\n while (index >= 0) {\n reference = String.fromCodePoint(65 + (index % 26)) + reference\n index = Math.floor(index / 26) - 1\n }\n\n return `${reference}${rowNumber}`\n}\n\n// Sheet names cannot contain : \\ / ? * [ ] and cap at 31 characters.\nconst sheetNameFor = (name: string | undefined): string => {\n const cleaned = (name ?? DEFAULT_SHEET_NAME).replace(/[:\\\\/?*[\\]]/g, ' ').trim().slice(0, 31)\n return cleaned.length > 0 ? cleaned : DEFAULT_SHEET_NAME\n}\n\nconst sheetWidthFor = (column: ExportColumn): number | null => {\n const size = widthFor(column)\n if (typeof size !== 'number' || !Number.isFinite(size) || size <= 0) {\n return null\n }\n\n const characters = (size - CELL_PADDING_PX) / PX_PER_CHARACTER\n return Math.min(MAX_COLUMN_WIDTH, Math.max(MIN_COLUMN_WIDTH, Math.round(characters * 100) / 100))\n}\n\n// Values reach a cell as one of three Excel types. Inline strings keep the\n// file self-contained (no shared-strings part) and are never parsed as\n// formulas, so a leading \"=\" is data here, unlike in CSV.\nconst cellXml = (reference: string, value: unknown, styleIndex: number): string => {\n const style = styleIndex > 0 ? ` s=\"${styleIndex}\"` : ''\n\n if (typeof value === 'number' && Number.isFinite(value)) {\n return `<c r=\"${reference}\"${style}><v>${value}</v></c>`\n }\n\n if (typeof value === 'boolean') {\n return `<c r=\"${reference}\"${style} t=\"b\"><v>${value ? 1 : 0}</v></c>`\n }\n\n const text = String(value ?? '')\n if (text === '') {\n return `<c r=\"${reference}\"${style}/>`\n }\n\n return `<c r=\"${reference}\"${style} t=\"inlineStr\"><is><t xml:space=\"preserve\">${escapeXml(text)}</t></is></c>`\n}\n\nconst CONTENT_TYPES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\"><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Default Extension=\"xml\" ContentType=\"application/xml\"/><Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/><Override PartName=\"/xl/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/></Types>`\n\nconst ROOT_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"xl/workbook.xml\"/></Relationships>`\n\nconst WORKBOOK_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/></Relationships>`\n\n// Style 0 is the default cell, style 1 the bold header. Excel expects the two\n// conventional fills (none, gray125) and the built-in \"Normal\" cell style to\n// exist even when unused - without them readers report a missing default\n// style and Excel offers to repair the file.\nconst STYLES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><fonts count=\"2\"><font><sz val=\"11\"/><name val=\"Calibri\"/></font><font><b/><sz val=\"11\"/><name val=\"Calibri\"/></font></fonts><fills count=\"2\"><fill><patternFill patternType=\"none\"/></fill><fill><patternFill patternType=\"gray125\"/></fill></fills><borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs><cellXfs count=\"2\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/><xf numFmtId=\"0\" fontId=\"1\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\"/></cellXfs><cellStyles count=\"1\"><cellStyle name=\"Normal\" xfId=\"0\" builtinId=\"0\"/></cellStyles></styleSheet>`\n\nconst workbookXml = (sheetName: string): string =>\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"><sheets><sheet name=\"${escapeXml(sheetName)}\" sheetId=\"1\" r:id=\"rId1\"/></sheets></workbook>`\n\nconst worksheetXml = (table: XlsxTable, options: XlsxOptions): string => {\n const columns = columnsFor(table)\n const rows = rowsFor(table, options.scope)\n\n const widths = columns\n .map((column, index) => {\n const width = sheetWidthFor(column)\n return width === null ?\n null :\n `<col min=\"${index + 1}\" max=\"${index + 1}\" width=\"${width}\" customWidth=\"1\"/>`\n })\n .filter((entry): entry is string => entry !== null)\n const cols = widths.length > 0 ? `<cols>${widths.join('')}</cols>` : ''\n\n const headerCells = columns\n .map((column, index) => cellXml(cellReference(index, 1), headerFor(column), 1))\n .join('')\n\n const bodyRows = rows.map((row, rowIndex) => {\n const rowNumber = rowIndex + 2\n const cells = columns\n .map((column, columnIndex) => {\n const value = row.getValue(column.id)\n const formatter = formatterFor(column)\n // A formatted value is text by definition; an unformatted one keeps\n // its native type so numbers stay numeric in Excel.\n return cellXml(\n cellReference(columnIndex, rowNumber),\n formatter ? formatter(value, row.original) ?? '' : value,\n 0\n )\n })\n .join('')\n return `<row r=\"${rowNumber}\">${cells}</row>`\n })\n\n return `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">${cols}<sheetData><row r=\"1\">${headerCells}</row>${bodyRows.join('')}</sheetData></worksheet>`\n}\n\nexport const exportXlsx = (table: XlsxTable, options: XlsxOptions = {}): Uint8Array => {\n const encoder = new TextEncoder()\n const sheetName = sheetNameFor(options.sheetName)\n const entries: ZipEntry[] = [\n { name: '[Content_Types].xml', data: encoder.encode(CONTENT_TYPES) },\n { name: '_rels/.rels', data: encoder.encode(ROOT_RELS) },\n { name: 'xl/workbook.xml', data: encoder.encode(workbookXml(sheetName)) },\n { name: 'xl/_rels/workbook.xml.rels', data: encoder.encode(WORKBOOK_RELS) },\n { name: 'xl/styles.xml', data: encoder.encode(STYLES) },\n { name: 'xl/worksheets/sheet1.xml', data: encoder.encode(worksheetXml(table, options)) }\n ]\n\n return zip(entries)\n}\n\nexport const downloadXlsx = (table: XlsxTable, options: XlsxDownloadOptions = {}): void => {\n const blob = new Blob([exportXlsx(table, options) as BlobPart], { type: MIME_TYPE })\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = options.filename ?? 'export.xlsx'\n anchor.style.display = 'none'\n // Attach before clicking (older Firefox) and defer revoke (Safari race).\n document.body.append(anchor)\n anchor.click()\n anchor.remove()\n setTimeout(() => URL.revokeObjectURL(url))\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAGvB,MAAM,YAAY;AAElB,IAAI,WAA+B;AAEnC,MAAM,oBAAiC;CACrC,IAAI,UACF,OAAO;CAGT,MAAM,wBAAQ,IAAI,YAAY,GAAG;CACjC,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,SAAS;EACxC,IAAI,QAAQ;EACZ,KAAK,IAAI,M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ACnD,CACF;EACF,CAAC,CAAC,CACD,KAAK,EAC4B,EAAE;CACxC,CAGqI,CAAC,CAAC,KAAK,EAAE,EAAE;AAClJ;AAEA,MAAa,cAAc,OAAkB,UAAuB,CAAC,MAAkB;CACrF,MAAM,UAAU,IAAI,YAAY;CAChC,MAAM,YAAY,aAAa,QAAQ,SAAS;CAChD,MAAM,UAAsB;EAC1B;GAAE,MAAM;GAAuB,MAAM,QAAQ,OAAO,aAAa;EAAE;EACnE;GAAE,MAAM;GAAe,MAAM,QAAQ,OAAO,SAAS;EAAE;EACvD;GAAE,MAAM;GAAmB,MAAM,QAAQ,OAAO,YAAY,SAAS,CAAC;EAAE;EACxE;GAAE,MAAM;GAA8B,MAAM,QAAQ,OAAO,aAAa;EAAE;EAC1E;GAAE,MAAM;GAAiB,MAAM,QAAQ,OAAO,MAAM;EAAE;EACtD;GAAE,MAAM;GAA4B,MAAM,QAAQ,OAAO,aAAa,OAAO,OAAO,CAAC;EAAE;CACzF;CAEA,OAAO,IAAI,OAAO;AACpB;AAEA,MAAa,gBAAgB,OAAkB,UAA+B,CAAC,MAAY;CACzF,MAAM,OAAO,IAAI,KAAK,CAAC,WAAW,OAAO,OAAO,CAAa,GAAG,EAAE,MAAM,UAAU,CAAC;CACnF,MAAM,MAAM,IAAI,gBAAgB,IAAI;CACpC,MAAM,SAAS,SAAS,cAAc,GAAG;CACzC,OAAO,OAAO;CACd,OAAO,WAAW,QAAQ,YAAY;CACtC,OAAO,MAAM,UAAU;CAEvB,SAAS,KAAK,OAAO,MAAM;CAC3B,OAAO,MAAM;CACb,OAAO,OAAO;CACd,iBAAiB,IAAI,gBAAgB,GAAG,CAAC;AAC3C"}
package/dist/js/xlsx.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * CoreUI PRO data-grid v0.3.0-rc.0 (https://coreui.io)
2
+ * CoreUI PRO data-grid v0.4.0 (https://coreui.io)
3
3
  * Copyright 2026 The CoreUI Team (https://github.com/orgs/coreui/people)
4
4
  * License (https://coreui.io/pro/license/)
5
5
  */
6
- import { a as widthFor, i as rowsFor, n as formatterFor, r as headerFor, t as columnsFor } from "./export-table-BdabEbJG.mjs";
7
- //#region src/util/zip.ts
6
+ import { a as widthFor, i as rowsFor, n as formatterFor, r as headerFor, t as columnsFor } from "./export-table-BggGRmzQ.mjs";
7
+ // src/util/zip.ts
8
8
  /**
9
9
  * --------------------------------------------------------------------------
10
10
  * CoreUI PRO data-grid util/zip.ts
@@ -119,8 +119,7 @@ const zip = (entries) => {
119
119
  writer.u16(0);
120
120
  return writer.result();
121
121
  };
122
- //#endregion
123
- //#region src/util/xlsx.ts
122
+ // src/util/xlsx.ts
124
123
  /**
125
124
  * --------------------------------------------------------------------------
126
125
  * CoreUI PRO data-grid util/xlsx.ts
@@ -133,7 +132,7 @@ const PX_PER_CHARACTER = 7;
133
132
  const CELL_PADDING_PX = 5;
134
133
  const MIN_COLUMN_WIDTH = 4;
135
134
  const MAX_COLUMN_WIDTH = 120;
136
- const CONTROL_CHARACTERS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;
135
+ const CONTROL_CHARACTERS = /[\u{0}-\u{8}\u{B}\u{C}\u{E}-\u{1F}]/gu;
137
136
  const escapeXml = (value) => value.replace(CONTROL_CHARACTERS, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
138
137
  const cellReference = (columnIndex, rowNumber) => {
139
138
  let reference = "";
@@ -232,7 +231,6 @@ const downloadXlsx = (table, options = {}) => {
232
231
  anchor.remove();
233
232
  setTimeout(() => URL.revokeObjectURL(url));
234
233
  };
235
- //#endregion
236
234
  export { downloadXlsx, exportXlsx };
237
235
 
238
236
  //# sourceMappingURL=xlsx.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"xlsx.mjs","names":[],"sources":["../../src/util/zip.ts","../../src/util/xlsx.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/zip.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\n/* eslint-disable no-bitwise -- CRC32 and the ZIP header fields are defined\n in bit terms; expressing them any other way would obscure the format. */\n\n// A minimal ZIP writer for the xlsx export. Entries are STORED (uncompressed),\n// which the format allows and which keeps the writer dependency-free - an\n// export of a few thousand rows is XML text the browser hands straight to a\n// download, so the deflate round-trip would buy little. Timestamps are fixed\n// at the DOS epoch so the same data always produces the same bytes.\n\nconst DOS_EPOCH_TIME = 0\nconst DOS_EPOCH_DATE = 0x0021\n// UTF-8 filename bit; every name we write is ASCII, but the flag is correct\n// and costs nothing.\nconst FLAG_UTF8 = 0x0800\n\nlet crcTable: Uint32Array | null = null\n\nconst getCrcTable = (): Uint32Array => {\n if (crcTable) {\n return crcTable\n }\n\n const table = new Uint32Array(256)\n for (let index = 0; index < 256; index++) {\n let value = index\n for (let bit = 0; bit < 8; bit++) {\n value = value & 1 ? 0xED_B8_83_20 ^ (value >>> 1) : value >>> 1\n }\n\n table[index] = value >>> 0\n }\n\n crcTable = table\n return table\n}\n\nconst crc32 = (bytes: Uint8Array): number => {\n const table = getCrcTable()\n let crc = 0xFF_FF_FF_FF\n for (const byte of bytes) {\n crc = table[(crc ^ byte) & 0xFF]! ^ (crc >>> 8)\n }\n\n return (crc ^ 0xFF_FF_FF_FF) >>> 0\n}\n\nexport interface ZipEntry {\n name: string\n data: Uint8Array\n}\n\ninterface StagedEntry extends ZipEntry {\n crc: number\n nameBytes: Uint8Array\n offset: number\n}\n\nconst LOCAL_HEADER_SIZE = 30\nconst CENTRAL_HEADER_SIZE = 46\nconst END_RECORD_SIZE = 22\n\nclass ByteWriter {\n private readonly view: DataView\n private readonly bytes: Uint8Array\n private cursor = 0\n\n constructor(size: number) {\n this.bytes = new Uint8Array(size)\n this.view = new DataView(this.bytes.buffer)\n }\n\n u16(value: number): void {\n this.view.setUint16(this.cursor, value, true)\n this.cursor += 2\n }\n\n u32(value: number): void {\n this.view.setUint32(this.cursor, value, true)\n this.cursor += 4\n }\n\n raw(value: Uint8Array): void {\n this.bytes.set(value, this.cursor)\n this.cursor += value.length\n }\n\n result(): Uint8Array {\n return this.bytes\n }\n}\n\nexport const zip = (entries: ZipEntry[]): Uint8Array => {\n const encoder = new TextEncoder()\n const staged: StagedEntry[] = []\n let offset = 0\n\n for (const entry of entries) {\n const nameBytes = encoder.encode(entry.name)\n staged.push({\n ...entry,\n crc: crc32(entry.data),\n nameBytes,\n offset\n })\n offset += LOCAL_HEADER_SIZE + nameBytes.length + entry.data.length\n }\n\n const centralDirectoryOffset = offset\n const centralDirectorySize = staged.reduce(\n (total, entry) => total + CENTRAL_HEADER_SIZE + entry.nameBytes.length,\n 0\n )\n\n const writer = new ByteWriter(centralDirectoryOffset + centralDirectorySize + END_RECORD_SIZE)\n\n for (const entry of staged) {\n writer.u32(0x04_03_4B_50)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.raw(entry.nameBytes)\n writer.raw(entry.data)\n }\n\n for (const entry of staged) {\n writer.u32(0x02_01_4B_50)\n writer.u16(20)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u32(0)\n writer.u32(entry.offset)\n writer.raw(entry.nameBytes)\n }\n\n writer.u32(0x06_05_4B_50)\n writer.u16(0)\n writer.u16(0)\n writer.u16(staged.length)\n writer.u16(staged.length)\n writer.u32(centralDirectorySize)\n writer.u32(centralDirectoryOffset)\n writer.u16(0)\n\n return writer.result()\n}\n","/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/xlsx.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\nimport {\n columnsFor, formatterFor, headerFor, rowsFor, widthFor, type ExportColumn, type ExportScope, type ExportTable\n} from './export-table'\nimport { zip, type ZipEntry } from './zip'\n\nexport interface XlsxOptions {\n scope?: ExportScope\n sheetName?: string\n}\n\nexport interface XlsxDownloadOptions extends XlsxOptions {\n filename?: string\n}\n\nexport type XlsxTable = ExportTable\n\nconst MIME_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\nconst DEFAULT_SHEET_NAME = 'Sheet1'\n// Excel column widths count characters, not pixels: the default 8.43 width is\n// 64 px, and each further character adds 7 px on top of the 5 px padding.\nconst PX_PER_CHARACTER = 7\nconst CELL_PADDING_PX = 5\nconst MIN_COLUMN_WIDTH = 4\nconst MAX_COLUMN_WIDTH = 120\n\n// XML 1.0 forbids most control characters outright - Excel refuses to open a\n// file containing them, so they are dropped rather than escaped.\n// eslint-disable-next-line no-control-regex -- matching them is the point\nconst CONTROL_CHARACTERS = /[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F]/g\n\nconst escapeXml = (value: string): string =>\n value\n .replace(CONTROL_CHARACTERS, '')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n\n// A1, B1 … Z1, AA1 - Excel's bijective base-26 column reference.\nconst cellReference = (columnIndex: number, rowNumber: number): string => {\n let reference = ''\n let index = columnIndex\n while (index >= 0) {\n reference = String.fromCodePoint(65 + (index % 26)) + reference\n index = Math.floor(index / 26) - 1\n }\n\n return `${reference}${rowNumber}`\n}\n\n// Sheet names cannot contain : \\ / ? * [ ] and cap at 31 characters.\nconst sheetNameFor = (name: string | undefined): string => {\n const cleaned = (name ?? DEFAULT_SHEET_NAME).replace(/[:\\\\/?*[\\]]/g, ' ').trim().slice(0, 31)\n return cleaned.length > 0 ? cleaned : DEFAULT_SHEET_NAME\n}\n\nconst sheetWidthFor = (column: ExportColumn): number | null => {\n const size = widthFor(column)\n if (typeof size !== 'number' || !Number.isFinite(size) || size <= 0) {\n return null\n }\n\n const characters = (size - CELL_PADDING_PX) / PX_PER_CHARACTER\n return Math.min(MAX_COLUMN_WIDTH, Math.max(MIN_COLUMN_WIDTH, Math.round(characters * 100) / 100))\n}\n\n// Values reach a cell as one of three Excel types. Inline strings keep the\n// file self-contained (no shared-strings part) and are never parsed as\n// formulas, so a leading \"=\" is data here, unlike in CSV.\nconst cellXml = (reference: string, value: unknown, styleIndex: number): string => {\n const style = styleIndex > 0 ? ` s=\"${styleIndex}\"` : ''\n\n if (typeof value === 'number' && Number.isFinite(value)) {\n return `<c r=\"${reference}\"${style}><v>${value}</v></c>`\n }\n\n if (typeof value === 'boolean') {\n return `<c r=\"${reference}\"${style} t=\"b\"><v>${value ? 1 : 0}</v></c>`\n }\n\n const text = String(value ?? '')\n if (text === '') {\n return `<c r=\"${reference}\"${style}/>`\n }\n\n return `<c r=\"${reference}\"${style} t=\"inlineStr\"><is><t xml:space=\"preserve\">${escapeXml(text)}</t></is></c>`\n}\n\nconst CONTENT_TYPES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\"><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Default Extension=\"xml\" ContentType=\"application/xml\"/><Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/><Override PartName=\"/xl/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/></Types>`\n\nconst ROOT_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"xl/workbook.xml\"/></Relationships>`\n\nconst WORKBOOK_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/></Relationships>`\n\n// Style 0 is the default cell, style 1 the bold header. Excel expects the two\n// conventional fills (none, gray125) and the built-in \"Normal\" cell style to\n// exist even when unused - without them readers report a missing default\n// style and Excel offers to repair the file.\nconst STYLES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><fonts count=\"2\"><font><sz val=\"11\"/><name val=\"Calibri\"/></font><font><b/><sz val=\"11\"/><name val=\"Calibri\"/></font></fonts><fills count=\"2\"><fill><patternFill patternType=\"none\"/></fill><fill><patternFill patternType=\"gray125\"/></fill></fills><borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs><cellXfs count=\"2\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/><xf numFmtId=\"0\" fontId=\"1\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\"/></cellXfs><cellStyles count=\"1\"><cellStyle name=\"Normal\" xfId=\"0\" builtinId=\"0\"/></cellStyles></styleSheet>`\n\nconst workbookXml = (sheetName: string): string =>\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"><sheets><sheet name=\"${escapeXml(sheetName)}\" sheetId=\"1\" r:id=\"rId1\"/></sheets></workbook>`\n\nconst worksheetXml = (table: XlsxTable, options: XlsxOptions): string => {\n const columns = columnsFor(table)\n const rows = rowsFor(table, options.scope)\n\n const widths = columns\n .map((column, index) => {\n const width = sheetWidthFor(column)\n return width === null ?\n null :\n `<col min=\"${index + 1}\" max=\"${index + 1}\" width=\"${width}\" customWidth=\"1\"/>`\n })\n .filter((entry): entry is string => entry !== null)\n const cols = widths.length > 0 ? `<cols>${widths.join('')}</cols>` : ''\n\n const headerCells = columns\n .map((column, index) => cellXml(cellReference(index, 1), headerFor(column), 1))\n .join('')\n\n const bodyRows = rows.map((row, rowIndex) => {\n const rowNumber = rowIndex + 2\n const cells = columns\n .map((column, columnIndex) => {\n const value = row.getValue(column.id)\n const formatter = formatterFor(column)\n // A formatted value is text by definition; an unformatted one keeps\n // its native type so numbers stay numeric in Excel.\n return cellXml(\n cellReference(columnIndex, rowNumber),\n formatter ? formatter(value, row.original) ?? '' : value,\n 0\n )\n })\n .join('')\n return `<row r=\"${rowNumber}\">${cells}</row>`\n })\n\n return `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">${cols}<sheetData><row r=\"1\">${headerCells}</row>${bodyRows.join('')}</sheetData></worksheet>`\n}\n\nexport const exportXlsx = (table: XlsxTable, options: XlsxOptions = {}): Uint8Array => {\n const encoder = new TextEncoder()\n const sheetName = sheetNameFor(options.sheetName)\n const entries: ZipEntry[] = [\n { name: '[Content_Types].xml', data: encoder.encode(CONTENT_TYPES) },\n { name: '_rels/.rels', data: encoder.encode(ROOT_RELS) },\n { name: 'xl/workbook.xml', data: encoder.encode(workbookXml(sheetName)) },\n { name: 'xl/_rels/workbook.xml.rels', data: encoder.encode(WORKBOOK_RELS) },\n { name: 'xl/styles.xml', data: encoder.encode(STYLES) },\n { name: 'xl/worksheets/sheet1.xml', data: encoder.encode(worksheetXml(table, options)) }\n ]\n\n return zip(entries)\n}\n\nexport const downloadXlsx = (table: XlsxTable, options: XlsxDownloadOptions = {}): void => {\n const blob = new Blob([exportXlsx(table, options) as BlobPart], { type: MIME_TYPE })\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = options.filename ?? 'export.xlsx'\n anchor.style.display = 'none'\n // Attach before clicking (older Firefox) and defer revoke (Safari race).\n document.body.append(anchor)\n anchor.click()\n anchor.remove()\n setTimeout(() => URL.revokeObjectURL(url))\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAGvB,MAAM,YAAY;AAElB,IAAI,WAA+B;AAEnC,MAAM,oBAAiC;CACrC,IAAI,UACF,OAAO;CAGT,MAAM,wBAAQ,IAAI,YAAY,GAAG;CACjC,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,SAAS;EACxC,IAAI,QAAQ;EACZ,KAAK,IAAI,MAAM,GAAG,MAAM,GAAG,OACzB,QAAQ,QAAQ,IAAI,aAAiB,UAAU,IAAK,UAAU;EAGhE,MAAM,SAAS,UAAU;CAC3B;CAEA,WAAW;CACX,OAAO;AACT;AAEA,MAAM,SAAS,UAA8B;CAC3C,MAAM,QAAQ,YAAY;CAC1B,IAAI,MAAM;CACV,KAAK,MAAM,QAAQ,OACjB,MAAM,OAAO,MAAM,QAAQ,OAAU,QAAQ;CAG/C,QAAQ,MAAM,gBAAmB;AACnC;AAaA,MAAM,oBAAoB;AAC1B,MAAM,sBAAsB;AAC5B,MAAM,kBAAkB;AAExB,IAAM,aAAN,MAAiB;CAKf,YAAY,MAAc;EAFT,KAAA,SAAA;EAGf,KAAK,QAAQ,IAAI,WAAW,IAAI;EAChC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EAAE;EACtD;GAAE,MAAM;GAA4B,MAAM,QAAQ,OAAO,aAAa,OAAO,OAAO,CAAC;EAAE;CACzF;CAEA,OAAO,IAAI,OAAO;AACpB;AAEA,MAAa,gBAAgB,OAAkB,UAA+B,CAAC,MAAY;CACzF,MAAM,OAAO,IAAI,KAAK,CAAC,WAAW,OAAO,OAAO,CAAa,GAAG,EAAE,MAAM,UAAU,CAAC;CACnF,MAAM,MAAM,IAAI,gBAAgB,IAAI;CACpC,MAAM,SAAS,SAAS,cAAc,GAAG;CACzC,OAAO,OAAO;CACd,OAAO,WAAW,QAAQ,YAAY;CACtC,OAAO,MAAM,UAAU;CAEvB,SAAS,KAAK,OAAO,MAAM;CAC3B,OAAO,MAAM;CACb,OAAO,OAAO;CACd,iBAAiB,IAAI,gBAAgB,GAAG,CAAC;AAC3C"}
1
+ {"version":3,"file":"xlsx.mjs","names":[],"sources":["../../src/util/zip.ts","../../src/util/xlsx.ts"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/zip.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\n/* eslint-disable no-bitwise -- CRC32 and the ZIP header fields are defined\n in bit terms; expressing them any other way would obscure the format. */\n\n// A minimal ZIP writer for the xlsx export. Entries are STORED (uncompressed),\n// which the format allows and which keeps the writer dependency-free - an\n// export of a few thousand rows is XML text the browser hands straight to a\n// download, so the deflate round-trip would buy little. Timestamps are fixed\n// at the DOS epoch so the same data always produces the same bytes.\n\nconst DOS_EPOCH_TIME = 0\nconst DOS_EPOCH_DATE = 0x0021\n// UTF-8 filename bit; every name we write is ASCII, but the flag is correct\n// and costs nothing.\nconst FLAG_UTF8 = 0x0800\n\nlet crcTable: Uint32Array | null = null\n\nconst getCrcTable = (): Uint32Array => {\n if (crcTable) {\n return crcTable\n }\n\n const table = new Uint32Array(256)\n for (let index = 0; index < 256; index++) {\n let value = index\n for (let bit = 0; bit < 8; bit++) {\n value = value & 1 ? 0xED_B8_83_20 ^ (value >>> 1) : value >>> 1\n }\n\n table[index] = value >>> 0\n }\n\n crcTable = table\n return table\n}\n\nconst crc32 = (bytes: Uint8Array): number => {\n const table = getCrcTable()\n let crc = 0xFF_FF_FF_FF\n for (const byte of bytes) {\n crc = table[(crc ^ byte) & 0xFF]! ^ (crc >>> 8)\n }\n\n return (crc ^ 0xFF_FF_FF_FF) >>> 0\n}\n\nexport interface ZipEntry {\n name: string\n data: Uint8Array\n}\n\ninterface StagedEntry extends ZipEntry {\n crc: number\n nameBytes: Uint8Array\n offset: number\n}\n\nconst LOCAL_HEADER_SIZE = 30\nconst CENTRAL_HEADER_SIZE = 46\nconst END_RECORD_SIZE = 22\n\nclass ByteWriter {\n private readonly view: DataView\n private readonly bytes: Uint8Array\n private cursor = 0\n\n constructor(size: number) {\n this.bytes = new Uint8Array(size)\n this.view = new DataView(this.bytes.buffer)\n }\n\n u16(value: number): void {\n this.view.setUint16(this.cursor, value, true)\n this.cursor += 2\n }\n\n u32(value: number): void {\n this.view.setUint32(this.cursor, value, true)\n this.cursor += 4\n }\n\n raw(value: Uint8Array): void {\n this.bytes.set(value, this.cursor)\n this.cursor += value.length\n }\n\n result(): Uint8Array {\n return this.bytes\n }\n}\n\nexport const zip = (entries: ZipEntry[]): Uint8Array => {\n const encoder = new TextEncoder()\n const staged: StagedEntry[] = []\n let offset = 0\n\n for (const entry of entries) {\n const nameBytes = encoder.encode(entry.name)\n staged.push({\n ...entry,\n crc: crc32(entry.data),\n nameBytes,\n offset\n })\n offset += LOCAL_HEADER_SIZE + nameBytes.length + entry.data.length\n }\n\n const centralDirectoryOffset = offset\n const centralDirectorySize = staged.reduce(\n (total, entry) => total + CENTRAL_HEADER_SIZE + entry.nameBytes.length,\n 0\n )\n\n const writer = new ByteWriter(centralDirectoryOffset + centralDirectorySize + END_RECORD_SIZE)\n\n for (const entry of staged) {\n writer.u32(0x04_03_4B_50)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.raw(entry.nameBytes)\n writer.raw(entry.data)\n }\n\n for (const entry of staged) {\n writer.u32(0x02_01_4B_50)\n writer.u16(20)\n writer.u16(20)\n writer.u16(FLAG_UTF8)\n writer.u16(0)\n writer.u16(DOS_EPOCH_TIME)\n writer.u16(DOS_EPOCH_DATE)\n writer.u32(entry.crc)\n writer.u32(entry.data.length)\n writer.u32(entry.data.length)\n writer.u16(entry.nameBytes.length)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u16(0)\n writer.u32(0)\n writer.u32(entry.offset)\n writer.raw(entry.nameBytes)\n }\n\n writer.u32(0x06_05_4B_50)\n writer.u16(0)\n writer.u16(0)\n writer.u16(staged.length)\n writer.u16(staged.length)\n writer.u32(centralDirectorySize)\n writer.u32(centralDirectoryOffset)\n writer.u16(0)\n\n return writer.result()\n}\n","/**\n * --------------------------------------------------------------------------\n * CoreUI PRO data-grid util/xlsx.ts\n * License (https://coreui.io/pro/license/)\n * --------------------------------------------------------------------------\n */\n\nimport {\n columnsFor, formatterFor, headerFor, rowsFor, widthFor, type ExportColumn, type ExportScope, type ExportTable\n} from './export-table'\nimport { zip, type ZipEntry } from './zip'\n\nexport interface XlsxOptions {\n scope?: ExportScope\n sheetName?: string\n}\n\nexport interface XlsxDownloadOptions extends XlsxOptions {\n filename?: string\n}\n\nexport type XlsxTable = ExportTable\n\nconst MIME_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\nconst DEFAULT_SHEET_NAME = 'Sheet1'\n// Excel column widths count characters, not pixels: the default 8.43 width is\n// 64 px, and each further character adds 7 px on top of the 5 px padding.\nconst PX_PER_CHARACTER = 7\nconst CELL_PADDING_PX = 5\nconst MIN_COLUMN_WIDTH = 4\nconst MAX_COLUMN_WIDTH = 120\n\n// XML 1.0 forbids most control characters outright - Excel refuses to open a\n// file containing them, so they are dropped rather than escaped.\n// eslint-disable-next-line no-control-regex -- matching them is the point\nconst CONTROL_CHARACTERS = /[\\u{0}-\\u{8}\\u{B}\\u{C}\\u{E}-\\u{1F}]/gu\n\nconst escapeXml = (value: string): string =>\n value\n .replace(CONTROL_CHARACTERS, '')\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n\n// A1, B1 … Z1, AA1 - Excel's bijective base-26 column reference.\nconst cellReference = (columnIndex: number, rowNumber: number): string => {\n let reference = ''\n let index = columnIndex\n while (index >= 0) {\n reference = String.fromCodePoint(65 + (index % 26)) + reference\n index = Math.floor(index / 26) - 1\n }\n\n return `${reference}${rowNumber}`\n}\n\n// Sheet names cannot contain : \\ / ? * [ ] and cap at 31 characters.\nconst sheetNameFor = (name: string | undefined): string => {\n const cleaned = (name ?? DEFAULT_SHEET_NAME).replace(/[:\\\\/?*[\\]]/g, ' ').trim().slice(0, 31)\n return cleaned.length > 0 ? cleaned : DEFAULT_SHEET_NAME\n}\n\nconst sheetWidthFor = (column: ExportColumn): number | null => {\n const size = widthFor(column)\n if (typeof size !== 'number' || !Number.isFinite(size) || size <= 0) {\n return null\n }\n\n const characters = (size - CELL_PADDING_PX) / PX_PER_CHARACTER\n return Math.min(MAX_COLUMN_WIDTH, Math.max(MIN_COLUMN_WIDTH, Math.round(characters * 100) / 100))\n}\n\n// Values reach a cell as one of three Excel types. Inline strings keep the\n// file self-contained (no shared-strings part) and are never parsed as\n// formulas, so a leading \"=\" is data here, unlike in CSV.\nconst cellXml = (reference: string, value: unknown, styleIndex: number): string => {\n const style = styleIndex > 0 ? ` s=\"${styleIndex}\"` : ''\n\n if (typeof value === 'number' && Number.isFinite(value)) {\n return `<c r=\"${reference}\"${style}><v>${value}</v></c>`\n }\n\n if (typeof value === 'boolean') {\n return `<c r=\"${reference}\"${style} t=\"b\"><v>${value ? 1 : 0}</v></c>`\n }\n\n const text = String(value ?? '')\n if (text === '') {\n return `<c r=\"${reference}\"${style}/>`\n }\n\n return `<c r=\"${reference}\"${style} t=\"inlineStr\"><is><t xml:space=\"preserve\">${escapeXml(text)}</t></is></c>`\n}\n\nconst CONTENT_TYPES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\"><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Default Extension=\"xml\" ContentType=\"application/xml\"/><Override PartName=\"/xl/workbook.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\"/><Override PartName=\"/xl/worksheets/sheet1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\"/><Override PartName=\"/xl/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\"/></Types>`\n\nconst ROOT_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\" Target=\"xl/workbook.xml\"/></Relationships>`\n\nconst WORKBOOK_RELS = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\" Target=\"worksheets/sheet1.xml\"/><Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/></Relationships>`\n\n// Style 0 is the default cell, style 1 the bold header. Excel expects the two\n// conventional fills (none, gray125) and the built-in \"Normal\" cell style to\n// exist even when unused - without them readers report a missing default\n// style and Excel offers to repair the file.\nconst STYLES = `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><fonts count=\"2\"><font><sz val=\"11\"/><name val=\"Calibri\"/></font><font><b/><sz val=\"11\"/><name val=\"Calibri\"/></font></fonts><fills count=\"2\"><fill><patternFill patternType=\"none\"/></fill><fill><patternFill patternType=\"gray125\"/></fill></fills><borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs><cellXfs count=\"2\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/><xf numFmtId=\"0\" fontId=\"1\" fillId=\"0\" borderId=\"0\" xfId=\"0\" applyFont=\"1\"/></cellXfs><cellStyles count=\"1\"><cellStyle name=\"Normal\" xfId=\"0\" builtinId=\"0\"/></cellStyles></styleSheet>`\n\nconst workbookXml = (sheetName: string): string =>\n `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"><sheets><sheet name=\"${escapeXml(sheetName)}\" sheetId=\"1\" r:id=\"rId1\"/></sheets></workbook>`\n\nconst worksheetXml = (table: XlsxTable, options: XlsxOptions): string => {\n const columns = columnsFor(table)\n const rows = rowsFor(table, options.scope)\n\n const widths = columns\n .map((column, index) => {\n const width = sheetWidthFor(column)\n return width === null ?\n null :\n `<col min=\"${index + 1}\" max=\"${index + 1}\" width=\"${width}\" customWidth=\"1\"/>`\n })\n .filter((entry): entry is string => entry !== null)\n const cols = widths.length > 0 ? `<cols>${widths.join('')}</cols>` : ''\n\n const headerCells = columns\n .map((column, index) => cellXml(cellReference(index, 1), headerFor(column), 1))\n .join('')\n\n const bodyRows = rows.map((row, rowIndex) => {\n const rowNumber = rowIndex + 2\n const cells = columns\n .map((column, columnIndex) => {\n const value = row.getValue(column.id)\n const formatter = formatterFor(column)\n // A formatted value is text by definition; an unformatted one keeps\n // its native type so numbers stay numeric in Excel.\n return cellXml(\n cellReference(columnIndex, rowNumber),\n formatter ? formatter(value, row.original) ?? '' : value,\n 0\n )\n })\n .join('')\n return `<row r=\"${rowNumber}\">${cells}</row>`\n })\n\n return `<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">${cols}<sheetData><row r=\"1\">${headerCells}</row>${bodyRows.join('')}</sheetData></worksheet>`\n}\n\nexport const exportXlsx = (table: XlsxTable, options: XlsxOptions = {}): Uint8Array => {\n const encoder = new TextEncoder()\n const sheetName = sheetNameFor(options.sheetName)\n const entries: ZipEntry[] = [\n { name: '[Content_Types].xml', data: encoder.encode(CONTENT_TYPES) },\n { name: '_rels/.rels', data: encoder.encode(ROOT_RELS) },\n { name: 'xl/workbook.xml', data: encoder.encode(workbookXml(sheetName)) },\n { name: 'xl/_rels/workbook.xml.rels', data: encoder.encode(WORKBOOK_RELS) },\n { name: 'xl/styles.xml', data: encoder.encode(STYLES) },\n { name: 'xl/worksheets/sheet1.xml', data: encoder.encode(worksheetXml(table, options)) }\n ]\n\n return zip(entries)\n}\n\nexport const downloadXlsx = (table: XlsxTable, options: XlsxDownloadOptions = {}): void => {\n const blob = new Blob([exportXlsx(table, options) as BlobPart], { type: MIME_TYPE })\n const url = URL.createObjectURL(blob)\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = options.filename ?? 'export.xlsx'\n anchor.style.display = 'none'\n // Attach before clicking (older Firefox) and defer revoke (Safari race).\n document.body.append(anchor)\n anchor.click()\n anchor.remove()\n setTimeout(() => URL.revokeObjectURL(url))\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAGvB,MAAM,YAAY;AAElB,I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