@coreui/data-grid 0.2.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 (143) hide show
  1. package/README.md +4 -2
  2. package/dist/css/data-grid.css +11 -11
  3. package/dist/css/data-grid.css.map +1 -1
  4. package/dist/css/data-grid.min.css +2 -2
  5. package/dist/css/data-grid.min.css.map +1 -1
  6. package/dist/css/data-grid.standalone.css +1066 -0
  7. package/dist/css/data-grid.standalone.css.map +1 -0
  8. package/dist/css/data-grid.standalone.min.css +5 -0
  9. package/dist/css/data-grid.standalone.min.css.map +1 -0
  10. package/dist/js/clipboard.cjs +2 -3
  11. package/dist/js/clipboard.mjs +2 -3
  12. package/dist/js/csv.cjs +5 -6
  13. package/dist/js/csv.cjs.map +1 -1
  14. package/dist/js/csv.mjs +5 -6
  15. package/dist/js/csv.mjs.map +1 -1
  16. package/dist/js/data-grid.esm.js +5685 -5422
  17. package/dist/js/data-grid.esm.js.map +1 -1
  18. package/dist/js/data-grid.esm.min.js +2 -2
  19. package/dist/js/data-grid.esm.min.js.map +1 -1
  20. package/dist/js/data-grid.js +5685 -5423
  21. package/dist/js/data-grid.js.map +1 -1
  22. package/dist/js/data-grid.lite.esm.js +2707 -2629
  23. package/dist/js/data-grid.lite.esm.js.map +1 -1
  24. package/dist/js/data-grid.lite.esm.min.js +2 -2
  25. package/dist/js/data-grid.lite.esm.min.js.map +1 -1
  26. package/dist/js/data-grid.lite.js +2707 -2630
  27. package/dist/js/data-grid.lite.js.map +1 -1
  28. package/dist/js/data-grid.lite.min.js +2 -2
  29. package/dist/js/data-grid.lite.min.js.map +1 -1
  30. package/dist/js/data-grid.lite.mjs +2707 -2629
  31. package/dist/js/data-grid.lite.mjs.map +1 -1
  32. package/dist/js/data-grid.min.js +2 -2
  33. package/dist/js/data-grid.min.js.map +1 -1
  34. package/dist/js/data-grid.mjs +5685 -5422
  35. package/dist/js/data-grid.mjs.map +1 -1
  36. package/dist/js/direction.cjs +25 -0
  37. package/dist/js/direction.cjs.map +1 -0
  38. package/dist/js/direction.mjs +23 -0
  39. package/dist/js/direction.mjs.map +1 -0
  40. package/dist/js/drag.cjs +20 -12
  41. package/dist/js/drag.cjs.map +1 -1
  42. package/dist/js/drag.mjs +20 -12
  43. package/dist/js/drag.mjs.map +1 -1
  44. package/dist/js/{export-table-CNAKStzj.mjs → export-table-BggGRmzQ.mjs} +3 -4
  45. package/dist/js/{export-table-CNAKStzj.mjs.map → export-table-BggGRmzQ.mjs.map} +1 -1
  46. package/dist/js/{export-table-doIwvE5U.cjs → export-table-BiB3_lVo.cjs} +3 -4
  47. package/dist/js/{export-table-doIwvE5U.cjs.map → export-table-BiB3_lVo.cjs.map} +1 -1
  48. package/dist/js/filters.cjs +2 -3
  49. package/dist/js/filters.mjs +2 -3
  50. package/dist/js/labels.cjs +2 -3
  51. package/dist/js/labels.mjs +2 -3
  52. package/dist/js/print.cjs +2 -3
  53. package/dist/js/print.mjs +2 -3
  54. package/dist/js/selector.cjs +22 -0
  55. package/dist/js/selector.cjs.map +1 -0
  56. package/dist/js/selector.mjs +21 -0
  57. package/dist/js/selector.mjs.map +1 -0
  58. package/dist/js/validate.cjs +2 -3
  59. package/dist/js/validate.mjs +2 -3
  60. package/dist/js/xlsx.cjs +5 -7
  61. package/dist/js/xlsx.cjs.map +1 -1
  62. package/dist/js/xlsx.mjs +5 -7
  63. package/dist/js/xlsx.mjs.map +1 -1
  64. package/dist/types/base-component.d.mts +29 -0
  65. package/dist/types/data-grid.d.mts +141 -0
  66. package/dist/types/dom/data.d.mts +15 -0
  67. package/dist/types/dom/event-handler.d.mts +22 -0
  68. package/dist/types/dom/manipulator.d.mts +16 -0
  69. package/dist/types/engine/active-cell.d.mts +33 -0
  70. package/dist/types/engine/active-cell.d.ts +1 -0
  71. package/dist/types/engine/data-source.d.mts +19 -0
  72. package/dist/types/engine/features-lite.d.mts +25 -0
  73. package/dist/types/engine/features.d.mts +35 -0
  74. package/dist/types/engine/scheduler.d.mts +11 -0
  75. package/dist/types/engine/table.d.mts +9 -0
  76. package/dist/types/engine/table.d.ts +1 -1
  77. package/dist/types/engine/validate.d.mts +20 -1
  78. package/dist/types/engine/virtualizer.d.mts +23 -0
  79. package/dist/types/filters.d.mts +13 -1
  80. package/dist/types/icons.d.mts +23 -0
  81. package/dist/types/index-lite.d.mts +19 -1
  82. package/dist/types/index.d.mts +21 -1
  83. package/dist/types/labels.d.mts +9 -1
  84. package/dist/types/types.d.mts +284 -0
  85. package/dist/types/ui/body.d.mts +37 -0
  86. package/dist/types/ui/column-chooser.d.mts +27 -0
  87. package/dist/types/ui/editor.d.mts +8 -0
  88. package/dist/types/ui/filter-menu.d.mts +21 -0
  89. package/dist/types/ui/header.d.mts +51 -0
  90. package/dist/types/ui/loading.d.mts +12 -0
  91. package/dist/types/ui/menu.d.mts +17 -0
  92. package/dist/types/ui/pagination.d.mts +17 -0
  93. package/dist/types/ui/pinning.d.mts +17 -0
  94. package/dist/types/ui/toolbar.d.mts +42 -0
  95. package/dist/types/ui/tooltip.d.mts +10 -0
  96. package/dist/types/util/clipboard.d.mts +29 -1
  97. package/dist/types/util/config.d.mts +28 -0
  98. package/dist/types/util/csv.d.mts +19 -1
  99. package/dist/types/util/debounce.d.mts +7 -0
  100. package/dist/types/util/direction.d.mts +17 -0
  101. package/dist/types/util/direction.d.ts +17 -0
  102. package/dist/types/util/drag.d.mts +48 -1
  103. package/dist/types/util/export-table.d.mts +47 -0
  104. package/dist/types/util/index.d.mts +66 -0
  105. package/dist/types/util/print.d.mts +32 -1
  106. package/dist/types/util/sanitizer.d.mts +15 -0
  107. package/dist/types/util/selector.d.mts +12 -0
  108. package/dist/types/util/selector.d.ts +12 -0
  109. package/dist/types/util/xlsx.d.mts +17 -1
  110. package/dist/types/util/zip.d.mts +11 -0
  111. package/package.json +42 -16
  112. package/scss/_base.scss +13 -0
  113. package/scss/_config.scss +14 -0
  114. package/scss/_functions.scss +1 -0
  115. package/scss/_mixins.scss +1 -0
  116. package/scss/base/_buttons.scss +113 -0
  117. package/scss/base/_forms.scss +157 -0
  118. package/scss/base/_helpers.scss +24 -0
  119. package/scss/base/_pagination.scss +100 -0
  120. package/scss/base/_reboot.scss +93 -0
  121. package/scss/base/_root.scss +85 -0
  122. package/scss/base/_spinner.scss +45 -0
  123. package/scss/base/_table.scss +78 -0
  124. package/scss/components/_data-grid.scss +807 -0
  125. package/scss/data-grid.scss +7 -743
  126. package/scss/data-grid.standalone.scss +16 -0
  127. package/scss/functions/_defaults.scss +25 -0
  128. package/scss/mixins/_tokens.scss +12 -0
  129. package/src/data-grid.ts +22 -6
  130. package/src/engine/active-cell.ts +6 -3
  131. package/src/engine/table.ts +9 -1
  132. package/src/index-lite.ts +1 -1
  133. package/src/index.ts +1 -1
  134. package/src/ui/column-chooser.ts +4 -4
  135. package/src/ui/filter-menu.ts +5 -5
  136. package/src/ui/menu.ts +4 -4
  137. package/src/ui/pagination.ts +1 -1
  138. package/src/ui/tooltip.ts +2 -2
  139. package/src/util/csv.ts +2 -2
  140. package/src/util/direction.ts +38 -0
  141. package/src/util/drag.ts +45 -9
  142. package/src/util/selector.ts +16 -0
  143. package/src/util/xlsx.ts +1 -1
@@ -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,KAAK,MAAM,IAAI,OAAO,KAAK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U,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,MAAM,GAAG,MAAM,GAAG,OACz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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.2.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-CNAKStzj.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,KAAK,OAAO,IAAI,SAAS,K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A4B,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,IAAI,WAA+B;AAEnC,MAAM,o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under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
+ *
6
+ * This component is a modified version of the Bootstrap's base-component.ts
7
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
+ * --------------------------------------------------------------------------
9
+ */
10
+ import Config, { type ComponentConfig } from './util/config.mjs';
11
+ /**
12
+ * Class definition
13
+ */
14
+ declare class BaseComponent extends Config {
15
+ ['constructor']: typeof BaseComponent;
16
+ protected _element: HTMLElement;
17
+ protected _config: ComponentConfig;
18
+ constructor(element?: string | Element | null, config?: ComponentConfig | null);
19
+ dispose(): void;
20
+ _queueCallback(callback: () => void, element: Element, isAnimated?: boolean): void;
21
+ _getConfig(config?: ComponentConfig | null): ComponentConfig;
22
+ static getInstance<T extends typeof BaseComponent>(this: T, element?: string | Element | null): InstanceType<T> | null;
23
+ static getOrCreateInstance<T extends typeof BaseComponent>(this: T, element?: string | Element | null, config?: ComponentConfig | null): InstanceType<T>;
24
+ static get VERSION(): string;
25
+ static get DATA_KEY(): string;
26
+ static get EVENT_KEY(): string;
27
+ static eventName(name: string): string;
28
+ }
29
+ export default BaseComponent;
@@ -0,0 +1,141 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ import BaseComponent from './base-component.mjs';
8
+ import type { ComponentConfig } from './util/config.mjs';
9
+ import type { DataGridFeatures, DataGridItem, DataGridOptions, DataGridState, DataGridTable, TableFeatures } from './types.mjs';
10
+ import { type CsvDownloadOptions, type CsvOptions } from './util/csv.mjs';
11
+ /**
12
+ * Class definition
13
+ */
14
+ declare class DataGrid<TFeatures extends TableFeatures = DataGridFeatures> extends BaseComponent {
15
+ _config: DataGridOptions;
16
+ private _table;
17
+ private _unsubscribeState;
18
+ private _scheduler;
19
+ private _virtualizer;
20
+ private _header;
21
+ private _body;
22
+ private _toolbar;
23
+ private _paginations;
24
+ private _emptySlot;
25
+ private _dataSource;
26
+ private _loading;
27
+ private _loadingMore;
28
+ private _loadFailed;
29
+ private _loadedItems;
30
+ private _loadMorePending;
31
+ private _pageResetPending;
32
+ private _dataVersion;
33
+ private _viewportElement;
34
+ private _tableElement;
35
+ private _liveRegion;
36
+ private _labels;
37
+ private _selectionAnchorIndex;
38
+ private _activeCell;
39
+ private _containsFocus;
40
+ private _editingCell;
41
+ private _undoStack;
42
+ private _redoStack;
43
+ private _persistState;
44
+ private _editor;
45
+ private _editorPointerdownHandler;
46
+ private _editorPopup;
47
+ private _editorErrorElement;
48
+ private _editorFocusPending;
49
+ private _columnsByKey;
50
+ private _columnDrag;
51
+ private _rowDrag;
52
+ private _menu;
53
+ private _tooltip;
54
+ private _filterMenu;
55
+ private _columnChooser;
56
+ private _toolbarConfig;
57
+ constructor(element: Element | string, config?: Partial<DataGridOptions<TFeatures>>);
58
+ get table(): DataGridTable<TFeatures>;
59
+ static get Default(): DataGridOptions;
60
+ static get DefaultType(): Record<string, string>;
61
+ static get NAME(): string;
62
+ getSelectedItems(): DataGridItem[];
63
+ print(): void;
64
+ getCsv(options?: CsvOptions): string;
65
+ downloadCsv(options?: CsvDownloadOptions): void;
66
+ getState(): DataGridState;
67
+ restoreState(state: Partial<DataGridState>): void;
68
+ undo(): void;
69
+ redo(): void;
70
+ private _applyHistoryEntry;
71
+ setItems(items: DataGridItem[]): void;
72
+ update(config: Partial<DataGridOptions<TFeatures>>): void;
73
+ dispose(): void;
74
+ _configAfterMerge(config: ComponentConfig): ComponentConfig;
75
+ private _createTable;
76
+ private _teardownUi;
77
+ private _slotContext;
78
+ private _isColumnSortable;
79
+ private _isColumnFilterable;
80
+ private _isColumnResizable;
81
+ private _sanitizeIcon;
82
+ private _hasColumnMenu;
83
+ private _renderToolbar;
84
+ private _render;
85
+ private _addEventListeners;
86
+ private _toggleColumnSorting;
87
+ private _navigableCellFromTarget;
88
+ private _onCellFocusIn;
89
+ private _onCellNavigationKeydown;
90
+ private _tableCellFromTarget;
91
+ private _descendIntoCell;
92
+ private _isColumnEditable;
93
+ private _startEditing;
94
+ private _editScopeContains;
95
+ private _mountEditorPopup;
96
+ private _commitEdit;
97
+ private _cancelEdit;
98
+ private _stopEditing;
99
+ private _showEditorInvalid;
100
+ private _moveEditing;
101
+ private _teardownEditor;
102
+ private _setActiveCell;
103
+ private _printColumns;
104
+ private _clipboardColumns;
105
+ private _copyCellSelection;
106
+ private _activeCellContext;
107
+ private _cellElementFor;
108
+ private _applyCellNavigation;
109
+ private _getMenuActions;
110
+ private _orderedLeafIds;
111
+ private _moveColumn;
112
+ private _initColumnDrag;
113
+ private _rowIndexOffset;
114
+ private _initRowDrag;
115
+ private _moveRowTo;
116
+ private _moveColumnTo;
117
+ private _startColumnResize;
118
+ private _toggleRowSelection;
119
+ private _initDataSource;
120
+ private _maybeLoadMore;
121
+ private _visibleLeafColumns;
122
+ private _pinnedRegion;
123
+ private _chooserColumns;
124
+ private _visibleColumns;
125
+ private _getColumnSizes;
126
+ private _getFilteredColumns;
127
+ private _getPinning;
128
+ private _storageKey;
129
+ private _restorePersistedState;
130
+ private _updateHistoryButtons;
131
+ private _announceResults;
132
+ private _announce;
133
+ private _getTotalRows;
134
+ private _notifyStateChange;
135
+ private _update;
136
+ private _paginationState;
137
+ static jQueryInterface(this: {
138
+ each: (callback: (this: HTMLElement) => void) => unknown;
139
+ }, config?: string | Partial<DataGridOptions>): unknown;
140
+ }
141
+ export default DataGrid;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI dom/data.ts
4
+ * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
+ *
6
+ * This is a modified version of the Bootstrap's dom/data.js
7
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
+ * --------------------------------------------------------------------------
9
+ */
10
+ declare const _default: {
11
+ set(element: Element, key: string, instance: unknown): void;
12
+ get(element: Element | null, key: string): any;
13
+ remove(element: Element, key: string): void;
14
+ };
15
+ export default _default;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI dom/event-handler.ts
4
+ * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
+ *
6
+ * This is a modified version of the Bootstrap's dom/event-handler.ts
7
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
+ * --------------------------------------------------------------------------
9
+ */
10
+ /**
11
+ * Types
12
+ */
13
+ type CoreUIEvent = Event & Record<string, any>;
14
+ type EventCallable = (this: any, event: CoreUIEvent) => any;
15
+ declare const EventHandler: {
16
+ on(element: EventTarget | null, event: string, handler?: string | EventCallable, delegationFunction?: EventCallable): void;
17
+ one(element: EventTarget | null, event: string, handler?: string | EventCallable, delegationFunction?: EventCallable): void;
18
+ off(element: EventTarget | null, originalTypeEvent: string, handler?: string | EventCallable, delegationFunction?: EventCallable): void;
19
+ trigger(element: EventTarget | null, event: string, args?: Record<string, unknown>): CoreUIEvent | null;
20
+ };
21
+ export default EventHandler;
22
+ export type { CoreUIEvent, EventCallable };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI dom/manipulator.ts
4
+ * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
+ *
6
+ * This is a modified version of the Bootstrap's dom/manipulator.ts
7
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
+ * --------------------------------------------------------------------------
9
+ */
10
+ declare const Manipulator: {
11
+ setDataAttribute(element: Element, key: string, value: unknown): void;
12
+ removeDataAttribute(element: Element, key: string): void;
13
+ getDataAttributes(element: HTMLElement | null): Record<string, unknown>;
14
+ getDataAttribute(element: Element, key: string): unknown;
15
+ };
16
+ export default Manipulator;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid engine/active-cell.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ export interface ActiveCell {
8
+ rowIndex: number;
9
+ columnId: string;
10
+ }
11
+ export interface ActiveCellContext {
12
+ columnIds: string[];
13
+ rowCount: number;
14
+ pageStep: number;
15
+ paginated: boolean;
16
+ rtl?: boolean;
17
+ }
18
+ export interface NavigationResult {
19
+ cell: ActiveCell;
20
+ pageDelta?: -1 | 1;
21
+ }
22
+ export declare const clampActiveCell: (cell: ActiveCell | null, context: ActiveCellContext) => ActiveCell | null;
23
+ export declare const resolveNavigation: (key: string, ctrlKey: boolean, current: ActiveCell, context: ActiveCellContext) => NavigationResult | null;
24
+ export interface ActiveCellManager {
25
+ get: () => ActiveCell | null;
26
+ set: (cell: ActiveCell, options?: {
27
+ focus?: boolean;
28
+ }) => void;
29
+ clamp: (context: ActiveCellContext) => void;
30
+ reset: () => void;
31
+ consumeFocusRequest: () => boolean;
32
+ }
33
+ export declare const createActiveCellManager: (onChange: () => void) => ActiveCellManager;
@@ -13,6 +13,7 @@ export interface ActiveCellContext {
13
13
  rowCount: number;
14
14
  pageStep: number;
15
15
  paginated: boolean;
16
+ rtl?: boolean;
16
17
  }
17
18
  export interface NavigationResult {
18
19
  cell: ActiveCell;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid engine/data-source.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ import type { DataGridDataRequest, DataGridDataResponse } from '../types.mjs';
8
+ export interface GridDataSourceContext {
9
+ getRequest: () => DataGridDataRequest;
10
+ onError: (error: unknown) => void;
11
+ onLoad: (response: DataGridDataResponse, request: DataGridDataRequest) => void;
12
+ onLoadingChange: (loading: boolean) => void;
13
+ provider: (request: DataGridDataRequest) => Promise<DataGridDataResponse>;
14
+ }
15
+ export interface GridDataSource {
16
+ load: () => void;
17
+ dispose: () => void;
18
+ }
19
+ export declare const createDataSource: (context: GridDataSourceContext) => GridDataSource;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid engine/features-lite.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ export declare const dataGridLiteFeatures: {
8
+ coreReactivityFeature: import("@tanstack/table-core/reactivity").TableReactivityBindings;
9
+ columnFilteringFeature: import("@tanstack/table-core").TableFeature;
10
+ globalFilteringFeature: import("@tanstack/table-core").TableFeature;
11
+ rowPaginationFeature: import("@tanstack/table-core").TableFeature;
12
+ rowSortingFeature: import("@tanstack/table-core").TableFeature;
13
+ filteredRowModel: (table: import("@tanstack/table-core").Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
14
+ paginatedRowModel: (table: import("@tanstack/table-core").Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
15
+ sortedRowModel: (table: import("@tanstack/table-core").Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
16
+ filterFns: {
17
+ includesString: import("@tanstack/table-core").CreatedFilterFn<any, any>;
18
+ };
19
+ sortFns: {
20
+ alphanumeric: import("@tanstack/table-core").CreatedSortFn<any, any>;
21
+ datetime: import("@tanstack/table-core").CreatedSortFn<any, any>;
22
+ text: import("@tanstack/table-core").CreatedSortFn<any, any>;
23
+ };
24
+ };
25
+ export type DataGridLiteFeatures = typeof dataGridLiteFeatures;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid engine/features.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ export declare const dataGridFeatures: {
8
+ coreReactivityFeature: import("@tanstack/table-core/reactivity").TableReactivityBindings;
9
+ cellSelectionFeature: import("@tanstack/table-core").TableFeature;
10
+ columnFilteringFeature: import("@tanstack/table-core").TableFeature;
11
+ globalFilteringFeature: import("@tanstack/table-core").TableFeature;
12
+ columnFacetingFeature: import("@tanstack/table-core").TableFeature;
13
+ columnOrderingFeature: import("@tanstack/table-core").TableFeature;
14
+ columnPinningFeature: import("@tanstack/table-core").TableFeature;
15
+ columnSizingFeature: import("@tanstack/table-core").TableFeature;
16
+ columnResizingFeature: import("@tanstack/table-core").TableFeature;
17
+ columnVisibilityFeature: import("@tanstack/table-core").TableFeature;
18
+ rowPaginationFeature: import("@tanstack/table-core").TableFeature;
19
+ rowSelectionFeature: import("@tanstack/table-core").TableFeature;
20
+ rowSortingFeature: import("@tanstack/table-core").TableFeature;
21
+ facetedRowModel: (table: import("@tanstack/table-core").Table<any, any>, columnId: string) => () => import("@tanstack/table-core").RowModel<any, any>;
22
+ facetedUniqueValues: (table: import("@tanstack/table-core").Table<import("@tanstack/table-core").TableFeatures, any>, columnId: string) => () => Map<any, number>;
23
+ filteredRowModel: (table: import("@tanstack/table-core").Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
24
+ paginatedRowModel: (table: import("@tanstack/table-core").Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
25
+ sortedRowModel: (table: import("@tanstack/table-core").Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
26
+ filterFns: {
27
+ includesString: import("@tanstack/table-core").CreatedFilterFn<any, any>;
28
+ };
29
+ sortFns: {
30
+ alphanumeric: import("@tanstack/table-core").CreatedSortFn<any, any>;
31
+ datetime: import("@tanstack/table-core").CreatedSortFn<any, any>;
32
+ text: import("@tanstack/table-core").CreatedSortFn<any, any>;
33
+ };
34
+ };
35
+ export type DataGridFeatures = typeof dataGridFeatures;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid engine/scheduler.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ export interface Scheduler {
8
+ schedule: () => void;
9
+ dispose: () => void;
10
+ }
11
+ export declare const createScheduler: (flush: () => void) => Scheduler;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid engine/table.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ import type { DataGridOptions, DataGridTable, DataGridTableState } from '../types.mjs';
8
+ export declare const createGridTable: (options: DataGridOptions, getElement?: () => Element | null) => DataGridTable;
9
+ export declare const subscribeToTableState: (table: DataGridTable, listener: (previous: DataGridTableState, next: DataGridTableState) => void) => (() => void);