@coreui/data-grid 0.1.0-rc.0 → 0.3.0-rc.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 (166) hide show
  1. package/README.md +9 -6
  2. package/dist/css/data-grid.css +156 -38
  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 +56 -0
  11. package/dist/js/clipboard.cjs.map +1 -0
  12. package/dist/js/clipboard.mjs +54 -0
  13. package/dist/js/clipboard.mjs.map +1 -0
  14. package/dist/js/csv.cjs +36 -59
  15. package/dist/js/csv.cjs.map +1 -1
  16. package/dist/js/csv.mjs +35 -55
  17. package/dist/js/csv.mjs.map +1 -1
  18. package/dist/js/data-grid.esm.js +14108 -9331
  19. package/dist/js/data-grid.esm.js.map +1 -1
  20. package/dist/js/data-grid.esm.min.js +6 -6
  21. package/dist/js/data-grid.esm.min.js.map +1 -1
  22. package/dist/js/data-grid.js +14408 -9634
  23. package/dist/js/data-grid.js.map +1 -1
  24. package/dist/js/data-grid.lite.esm.js +10507 -0
  25. package/dist/js/data-grid.lite.esm.js.map +1 -0
  26. package/dist/js/data-grid.lite.esm.min.js +8 -0
  27. package/dist/js/data-grid.lite.esm.min.js.map +1 -0
  28. package/dist/js/data-grid.lite.js +10520 -0
  29. package/dist/js/data-grid.lite.js.map +1 -0
  30. package/dist/js/data-grid.lite.min.js +8 -0
  31. package/dist/js/data-grid.lite.min.js.map +1 -0
  32. package/dist/js/data-grid.lite.mjs +10507 -0
  33. package/dist/js/data-grid.lite.mjs.map +1 -0
  34. package/dist/js/data-grid.min.js +6 -6
  35. package/dist/js/data-grid.min.js.map +1 -1
  36. package/dist/js/data-grid.mjs +14108 -9331
  37. package/dist/js/data-grid.mjs.map +1 -1
  38. package/dist/js/direction.cjs +26 -0
  39. package/dist/js/direction.cjs.map +1 -0
  40. package/dist/js/direction.mjs +24 -0
  41. package/dist/js/direction.mjs.map +1 -0
  42. package/dist/js/drag.cjs +467 -0
  43. package/dist/js/drag.cjs.map +1 -0
  44. package/dist/js/drag.mjs +464 -0
  45. package/dist/js/drag.mjs.map +1 -0
  46. package/dist/js/export-table-BdabEbJG.mjs +26 -0
  47. package/dist/js/export-table-BdabEbJG.mjs.map +1 -0
  48. package/dist/js/export-table-D762wrZ1.cjs +55 -0
  49. package/dist/js/export-table-D762wrZ1.cjs.map +1 -0
  50. package/dist/js/filters.cjs +89 -132
  51. package/dist/js/filters.cjs.map +1 -1
  52. package/dist/js/filters.mjs +88 -128
  53. package/dist/js/filters.mjs.map +1 -1
  54. package/dist/js/labels.cjs +65 -70
  55. package/dist/js/labels.cjs.map +1 -1
  56. package/dist/js/labels.mjs +64 -66
  57. package/dist/js/labels.mjs.map +1 -1
  58. package/dist/js/print.cjs +66 -0
  59. package/dist/js/print.cjs.map +1 -0
  60. package/dist/js/print.mjs +64 -0
  61. package/dist/js/print.mjs.map +1 -0
  62. package/dist/js/validate.cjs +43 -0
  63. package/dist/js/validate.cjs.map +1 -0
  64. package/dist/js/validate.mjs +42 -0
  65. package/dist/js/validate.mjs.map +1 -0
  66. package/dist/js/xlsx.cjs +240 -0
  67. package/dist/js/xlsx.cjs.map +1 -0
  68. package/dist/js/xlsx.mjs +238 -0
  69. package/dist/js/xlsx.mjs.map +1 -0
  70. package/dist/types/base-component.d.ts +28 -18
  71. package/dist/types/data-grid.d.ts +26 -13
  72. package/dist/types/dom/data.d.ts +15 -0
  73. package/dist/types/dom/event-handler.d.ts +21 -10
  74. package/dist/types/dom/manipulator.d.ts +15 -8
  75. package/dist/types/engine/active-cell.d.ts +1 -0
  76. package/dist/types/engine/data-source.d.ts +1 -1
  77. package/dist/types/engine/features-lite.d.ts +25 -0
  78. package/dist/types/engine/features.d.ts +35 -0
  79. package/dist/types/engine/table.d.ts +3 -3
  80. package/dist/types/engine/validate.d.mts +1 -0
  81. package/dist/types/engine/validate.d.ts +20 -0
  82. package/dist/types/engine/virtualizer.d.ts +2 -0
  83. package/dist/types/icons.d.ts +6 -4
  84. package/dist/types/index-lite.d.mts +1 -0
  85. package/dist/types/index-lite.d.ts +19 -0
  86. package/dist/types/index.d.ts +11 -2
  87. package/dist/types/types.d.ts +53 -31
  88. package/dist/types/ui/body.d.ts +6 -3
  89. package/dist/types/ui/header.d.ts +3 -2
  90. package/dist/types/ui/loading.d.ts +1 -1
  91. package/dist/types/ui/pinning.d.ts +1 -1
  92. package/dist/types/ui/toolbar.d.ts +10 -2
  93. package/dist/types/util/clipboard.d.mts +1 -0
  94. package/dist/types/util/clipboard.d.ts +29 -0
  95. package/dist/types/util/config.d.ts +27 -10
  96. package/dist/types/util/csv.d.ts +5 -5
  97. package/dist/types/util/direction.d.mts +1 -0
  98. package/dist/types/util/direction.d.ts +17 -0
  99. package/dist/types/util/drag.d.mts +1 -0
  100. package/dist/types/util/drag.d.ts +48 -0
  101. package/dist/types/util/export-table.d.ts +47 -0
  102. package/dist/types/util/index.d.ts +66 -10
  103. package/dist/types/util/print.d.mts +1 -0
  104. package/dist/types/util/print.d.ts +32 -0
  105. package/dist/types/util/sanitizer.d.ts +15 -11
  106. package/dist/types/util/xlsx.d.mts +1 -0
  107. package/dist/types/util/xlsx.d.ts +17 -0
  108. package/dist/types/util/zip.d.ts +11 -0
  109. package/package.json +101 -10
  110. package/scss/_base.scss +13 -0
  111. package/scss/_config.scss +14 -0
  112. package/scss/_functions.scss +1 -0
  113. package/scss/_mixins.scss +1 -0
  114. package/scss/base/_buttons.scss +113 -0
  115. package/scss/base/_forms.scss +157 -0
  116. package/scss/base/_helpers.scss +24 -0
  117. package/scss/base/_pagination.scss +100 -0
  118. package/scss/base/_reboot.scss +93 -0
  119. package/scss/base/_root.scss +85 -0
  120. package/scss/base/_spinner.scss +45 -0
  121. package/scss/base/_table.scss +78 -0
  122. package/scss/components/_data-grid.scss +807 -0
  123. package/scss/data-grid.scss +7 -555
  124. package/scss/data-grid.standalone.scss +16 -0
  125. package/scss/functions/_defaults.scss +25 -0
  126. package/scss/mixins/_tokens.scss +12 -0
  127. package/src/{base-component.js → base-component.ts} +21 -17
  128. package/src/data-grid.ts +523 -201
  129. package/src/dom/{data.js → data.ts} +13 -10
  130. package/src/dom/event-handler.ts +380 -0
  131. package/src/dom/{manipulator.js → manipulator.ts} +11 -11
  132. package/src/engine/active-cell.ts +10 -3
  133. package/src/engine/data-source.ts +7 -3
  134. package/src/engine/features-lite.ts +47 -0
  135. package/src/engine/features.ts +68 -0
  136. package/src/engine/table.ts +86 -45
  137. package/src/engine/validate.ts +64 -0
  138. package/src/engine/virtualizer.ts +17 -1
  139. package/src/icons.ts +11 -5
  140. package/src/index-lite.ts +85 -0
  141. package/src/index.ts +30 -2
  142. package/src/labels.ts +6 -4
  143. package/src/types.ts +87 -32
  144. package/src/ui/body.ts +73 -17
  145. package/src/ui/header.ts +51 -26
  146. package/src/ui/loading.ts +2 -2
  147. package/src/ui/pinning.ts +16 -16
  148. package/src/ui/toolbar.ts +27 -3
  149. package/src/util/clipboard.ts +112 -0
  150. package/src/util/{config.js → config.ts} +25 -11
  151. package/src/util/csv.ts +11 -30
  152. package/src/util/direction.ts +37 -0
  153. package/src/util/drag.ts +832 -0
  154. package/src/util/export-table.ts +86 -0
  155. package/src/util/{index.js → index.ts} +55 -35
  156. package/src/util/print.ts +125 -0
  157. package/src/util/{sanitizer.js → sanitizer.ts} +17 -13
  158. package/src/util/xlsx.ts +183 -0
  159. package/src/util/zip.ts +170 -0
  160. package/src/base-component.d.ts +0 -19
  161. package/src/dom/event-handler.d.ts +0 -11
  162. package/src/dom/event-handler.js +0 -331
  163. package/src/dom/manipulator.d.ts +0 -9
  164. package/src/util/config.d.ts +0 -11
  165. package/src/util/index.d.ts +0 -10
  166. package/src/util/sanitizer.d.ts +0 -11
@@ -4,7 +4,7 @@
4
4
  * License (https://coreui.io/pro/license/)
5
5
  * --------------------------------------------------------------------------
6
6
  */
7
- import type { DataGridColumn, DataGridItem, DataGridLabels, SortingState, Table } from '../types';
7
+ import type { DataGridColumn, DataGridLabels, DataGridTable, SortingState } from '../types';
8
8
  import { type GridPinning } from './pinning';
9
9
  export interface GridHeaderContext {
10
10
  cellNavigation: boolean;
@@ -25,9 +25,10 @@ export interface GridHeaderContext {
25
25
  isSortable: (column: DataGridColumn) => boolean;
26
26
  labels: DataGridLabels;
27
27
  resizable: boolean;
28
+ rowOrder: boolean;
28
29
  selection: boolean;
29
30
  selectAll: boolean;
30
- table: Table<DataGridItem>;
31
+ table: DataGridTable;
31
32
  }
32
33
  export interface GridHeaderState {
33
34
  filteredColumns: string[] | null;
@@ -9,4 +9,4 @@ export interface GridLoading {
9
9
  element: HTMLDivElement;
10
10
  setVisible: (visible: boolean) => void;
11
11
  }
12
- export declare const createLoading: (labels: DataGridLabels) => GridLoading;
12
+ export declare const createLoading: (labels: DataGridLabels, className?: string) => GridLoading;
@@ -5,7 +5,7 @@
5
5
  * --------------------------------------------------------------------------
6
6
  */
7
7
  export interface PinnedCellInfo {
8
- side: 'left' | 'right';
8
+ side: 'start' | 'end';
9
9
  offset: number;
10
10
  edge: boolean;
11
11
  afterSelect: boolean;
@@ -4,17 +4,19 @@
4
4
  * License (https://coreui.io/pro/license/)
5
5
  * --------------------------------------------------------------------------
6
6
  */
7
- import type { CsvDownloadOptions } from '../util/csv';
7
+ import type { CsvDownloadOptions, CsvTable } from '../util/csv';
8
8
  import type { DataGridLabels, DataGridOptions } from '../types';
9
9
  export interface GridToolbarContext {
10
10
  labels: DataGridLabels;
11
11
  columns: boolean;
12
12
  export: boolean;
13
13
  history: boolean;
14
+ print: boolean;
14
15
  search: boolean;
15
16
  icons: {
16
17
  columns: string;
17
18
  export: string;
19
+ print: string;
18
20
  redo: string;
19
21
  undo: string;
20
22
  };
@@ -22,11 +24,17 @@ export interface GridToolbarContext {
22
24
  export interface GridToolbar {
23
25
  element: HTMLDivElement;
24
26
  }
27
+ export type DataGridExporter = (table: CsvTable, options: DataGridExportOptions) => void;
28
+ export interface DataGridExportOptions extends CsvDownloadOptions {
29
+ sheetName?: string;
30
+ exporter?: DataGridExporter;
31
+ }
25
32
  export interface ResolvedToolbar {
26
33
  columns: boolean;
27
34
  export: boolean;
28
- exportOptions: CsvDownloadOptions;
35
+ exportOptions: DataGridExportOptions;
29
36
  history: boolean;
37
+ print: boolean;
30
38
  search: boolean;
31
39
  }
32
40
  export declare const resolveToolbar: (options: DataGridOptions) => ResolvedToolbar;
@@ -0,0 +1 @@
1
+ export * from './clipboard.js'
@@ -0,0 +1,29 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid util/clipboard.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ import type { DataGridItem } from '../types';
8
+ export interface ClipboardBounds {
9
+ maxColumnIndex: number;
10
+ maxRowIndex: number;
11
+ minColumnIndex: number;
12
+ minRowIndex: number;
13
+ }
14
+ export interface ClipboardRow {
15
+ getValue: (columnId: string) => unknown;
16
+ original: DataGridItem;
17
+ }
18
+ export interface ClipboardTable {
19
+ getCellSelectionBounds: () => ClipboardBounds[];
20
+ getRowModel: () => {
21
+ rows: ClipboardRow[];
22
+ };
23
+ }
24
+ export interface ClipboardColumn {
25
+ id: string;
26
+ formatter?: (value: unknown, item: DataGridItem) => string;
27
+ }
28
+ export declare const serializeCellSelection: (table: ClipboardTable, columns: ClipboardColumn[]) => string;
29
+ export declare const copyCellSelection: (table: ClipboardTable, columns: ClipboardColumn[]) => Promise<string>;
@@ -1,11 +1,28 @@
1
- // Hand-written types for the vendored config.js (see the provenance header there)
2
- export default class Config {
3
- static get Default(): unknown
4
- static get DefaultType(): unknown
5
- static get NAME(): string
6
-
7
- _getConfig(config?: unknown): any
8
- _configAfterMerge(config: any): any
9
- _mergeConfigObj(config?: unknown, element?: Element): any
10
- _typeCheckConfig(config: Record<string, unknown>, configTypes?: Record<string, string>): void
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI util/config.ts
4
+ * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
+ *
6
+ * This is a modified version of the Bootstrap's util/config.ts
7
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
+ * --------------------------------------------------------------------------
9
+ */
10
+ /**
11
+ * Types
12
+ */
13
+ type ComponentConfig = Record<string, any>;
14
+ /**
15
+ * Class definition
16
+ */
17
+ declare class Config {
18
+ ['constructor']: typeof Config;
19
+ static get Default(): ComponentConfig;
20
+ static get DefaultType(): ComponentConfig;
21
+ static get NAME(): string;
22
+ _getConfig(config?: ComponentConfig | null): ComponentConfig;
23
+ _configAfterMerge(config: ComponentConfig): ComponentConfig;
24
+ _mergeConfigObj(config?: ComponentConfig | null, element?: Element): ComponentConfig;
25
+ _typeCheckConfig(config: ComponentConfig, configTypes?: ComponentConfig): void;
11
26
  }
27
+ export default Config;
28
+ export type { ComponentConfig };
@@ -4,10 +4,9 @@
4
4
  * License (https://coreui.io/pro/license/)
5
5
  * --------------------------------------------------------------------------
6
6
  */
7
- import type { Table } from '@tanstack/table-core';
8
- import type { DataGridItem } from '../types';
7
+ import { type ExportScope, type ExportTable } from './export-table';
9
8
  export interface CsvOptions {
10
- scope?: 'filtered' | 'all' | 'selected';
9
+ scope?: ExportScope;
11
10
  delimiter?: string;
12
11
  bom?: boolean;
13
12
  sanitize?: boolean;
@@ -15,5 +14,6 @@ export interface CsvOptions {
15
14
  export interface CsvDownloadOptions extends CsvOptions {
16
15
  filename?: string;
17
16
  }
18
- export declare const exportCsv: (table: Table<DataGridItem>, options?: CsvOptions) => string;
19
- export declare const downloadCsv: (table: Table<DataGridItem>, options?: CsvDownloadOptions) => void;
17
+ export type CsvTable = ExportTable;
18
+ export declare const exportCsv: (table: CsvTable, options?: CsvOptions) => string;
19
+ export declare const downloadCsv: (table: CsvTable, options?: CsvDownloadOptions) => void;
@@ -0,0 +1 @@
1
+ export * from './direction.js'
@@ -0,0 +1,17 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid util/direction.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ export declare const isElementRTL: (element: Element | null | undefined) => boolean;
8
+ interface ResizeDirectionTable {
9
+ options: {
10
+ columnResizeDirection?: 'ltr' | 'rtl';
11
+ };
12
+ setOptions: (updater: (previous: {
13
+ columnResizeDirection?: 'ltr' | 'rtl';
14
+ }) => never) => void;
15
+ }
16
+ export declare const syncResizeDirection: (table: ResizeDirectionTable, element: Element | null | undefined) => void;
17
+ export {};
@@ -0,0 +1 @@
1
+ export * from './drag.js'
@@ -0,0 +1,48 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid util/drag.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ export type DragAxis = 'x' | 'y';
8
+ export interface DragHit {
9
+ id: string;
10
+ element: HTMLElement;
11
+ }
12
+ export interface DragDrop {
13
+ id: string;
14
+ after: boolean;
15
+ }
16
+ export interface DragControllerOptions {
17
+ axis: DragAxis;
18
+ root: HTMLElement;
19
+ handle: string;
20
+ resolveSource: (handle: HTMLElement, target: HTMLElement) => DragHit | null;
21
+ items: DragItems;
22
+ canDrop: (sourceId: string, targetId: string) => boolean;
23
+ getScrollElement: () => HTMLElement | null;
24
+ ghostLabel?: (source: DragHit) => string;
25
+ preview?: boolean;
26
+ onDrop: (sourceId: string, drop: DragDrop) => void;
27
+ }
28
+ export interface DragItems {
29
+ getOrderedIds: () => string[];
30
+ getElements: (id: string) => HTMLElement[];
31
+ }
32
+ export interface DragController {
33
+ dispose: () => void;
34
+ }
35
+ export declare const createDragController: (options: DragControllerOptions) => DragController;
36
+ export interface ColumnDragOptions {
37
+ root: HTMLElement;
38
+ getScrollElement: () => HTMLElement | null;
39
+ canDrop: (sourceKey: string, targetKey: string) => boolean;
40
+ onReorder: (sourceKey: string, targetKey: string, after: boolean) => void;
41
+ }
42
+ export declare const createColumnDragController: (options: ColumnDragOptions) => DragController;
43
+ export interface RowDragOptions {
44
+ root: HTMLElement;
45
+ getScrollElement: () => HTMLElement | null;
46
+ onReorder: (sourceIndex: number, targetIndex: number, after: boolean) => void;
47
+ }
48
+ export declare const createRowDragController: (options: RowDragOptions) => DragController;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid util/export-table.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ import type { DataGridItem } from '../types';
8
+ export interface ExportColumnMeta {
9
+ label?: string;
10
+ formatter?: (value: unknown, item: DataGridItem) => string;
11
+ width?: number;
12
+ }
13
+ export interface ExportColumn {
14
+ id: string;
15
+ columnDef: {
16
+ meta?: unknown;
17
+ };
18
+ }
19
+ export interface ExportRow {
20
+ original: DataGridItem;
21
+ getValue: (columnId: string) => unknown;
22
+ }
23
+ export interface ExportTable {
24
+ getAllLeafColumns: () => ExportColumn[];
25
+ getCenterVisibleLeafColumns?: () => ExportColumn[];
26
+ getCoreRowModel: () => {
27
+ rows: ExportRow[];
28
+ };
29
+ getEndVisibleLeafColumns?: () => ExportColumn[];
30
+ getFilteredRowModel?: () => {
31
+ rows: ExportRow[];
32
+ };
33
+ getSelectedRowModel?: () => {
34
+ rows: ExportRow[];
35
+ };
36
+ getSortedRowModel?: () => {
37
+ rows: ExportRow[];
38
+ };
39
+ getStartVisibleLeafColumns?: () => ExportColumn[];
40
+ getVisibleLeafColumns?: () => ExportColumn[];
41
+ }
42
+ export type ExportScope = 'filtered' | 'all' | 'selected';
43
+ export declare const rowsFor: (table: ExportTable, scope: ExportScope | undefined) => ExportRow[];
44
+ export declare const columnsFor: (table: ExportTable) => ExportColumn[];
45
+ export declare const headerFor: (column: ExportColumn) => string;
46
+ export declare const formatterFor: (column: ExportColumn) => ExportColumnMeta["formatter"];
47
+ export declare const widthFor: (column: ExportColumn) => number | undefined;
@@ -1,10 +1,66 @@
1
- // Hand-written types for the vendored util/index.js (see the provenance header there)
2
- export function defineJQueryPlugin(plugin: { NAME: string; jQueryInterface: (this: any, ...args: any[]) => unknown }): void
3
- export function executeAfterTransition(callback: () => void, transitionElement: Element, waitForTransition?: boolean): void
4
- export function getElement(object: unknown): HTMLElement | null
5
- export function getjQuery(): unknown
6
- export function getUID(prefix: string): string
7
- export function isElement(object: unknown): boolean
8
- export function isRTL(): boolean
9
- export function isVisible(element: Element): boolean
10
- export function toType(object: unknown): string
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI util/index.ts
4
+ * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
+ *
6
+ * This is a modified version of the Bootstrap's util/index.ts
7
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
+ * --------------------------------------------------------------------------
9
+ */
10
+ type JQueryStatic = ((selector: unknown) => any) & Record<string, any> & {
11
+ fn: Record<string, any>;
12
+ };
13
+ type JQueryPlugin = {
14
+ NAME: string;
15
+ jQueryInterface: (...args: any[]) => unknown;
16
+ };
17
+ declare global {
18
+ interface Window {
19
+ jQuery?: JQueryStatic;
20
+ }
21
+ }
22
+ /**
23
+ * Properly escape IDs selectors to handle weird IDs
24
+ * @param {string} selector
25
+ * @returns {string}
26
+ */
27
+ declare const parseSelector: (selector: string) => string;
28
+ declare const toType: (object: unknown) => string;
29
+ /**
30
+ * Public Util API
31
+ */
32
+ declare const getUID: (prefix: string) => string;
33
+ declare const getTransitionDurationFromElement: (element: Element | null) => number;
34
+ declare const triggerTransitionEnd: (element: Element) => void;
35
+ declare const isElement: (object: unknown) => object is Element;
36
+ declare const getElement: (object: unknown) => HTMLElement | null;
37
+ declare const isVisible: (element: unknown) => boolean;
38
+ declare const isDisabled: (element: Element | null | undefined) => boolean;
39
+ declare const findShadowRoot: (element: Node) => ShadowRoot | null;
40
+ declare const noop: () => void;
41
+ /**
42
+ * Trick to restart an element's animation
43
+ *
44
+ * @param {HTMLElement} element
45
+ * @return void
46
+ *
47
+ * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
48
+ */
49
+ declare const reflow: (element: HTMLElement) => void;
50
+ declare const getjQuery: () => JQueryStatic | null;
51
+ declare const onDOMContentLoaded: (callback: () => void) => void;
52
+ declare const isRTL: () => boolean;
53
+ declare const defineJQueryPlugin: (plugin: JQueryPlugin) => void;
54
+ declare const execute: <T = any>(possibleCallback: T | ((...functionArgs: any[]) => T), args?: any[], defaultValue?: T | ((...functionArgs: any[]) => T)) => T;
55
+ declare const executeAfterTransition: (callback: () => void, transitionElement: Element, waitForTransition?: boolean) => void;
56
+ /**
57
+ * Return the previous/next element of a list.
58
+ *
59
+ * @param {array} list The list of elements
60
+ * @param activeElement The active element
61
+ * @param shouldGetNext Choose to get next or previous element
62
+ * @param isCycleAllowed
63
+ * @return {Element|elem} The proper element
64
+ */
65
+ declare const getNextActiveElement: <T>(list: T[], activeElement: T, shouldGetNext: boolean, isCycleAllowed?: boolean) => T;
66
+ export { defineJQueryPlugin, execute, executeAfterTransition, findShadowRoot, getElement, getjQuery, getNextActiveElement, getTransitionDurationFromElement, getUID, isDisabled, isElement, isRTL, isVisible, noop, onDOMContentLoaded, parseSelector, reflow, triggerTransitionEnd, toType };
@@ -0,0 +1 @@
1
+ export * from './print.js'
@@ -0,0 +1,32 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid util/print.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ import type { DataGridItem } from '../types';
8
+ export interface PrintColumn {
9
+ id: string;
10
+ label: string;
11
+ formatter?: (value: unknown, item: DataGridItem) => string;
12
+ }
13
+ export interface PrintRow {
14
+ getValue: (columnId: string) => unknown;
15
+ original: DataGridItem;
16
+ }
17
+ export interface PrintTable {
18
+ getSortedRowModel?: () => {
19
+ rows: PrintRow[];
20
+ };
21
+ getFilteredRowModel?: () => {
22
+ rows: PrintRow[];
23
+ };
24
+ getCoreRowModel: () => {
25
+ rows: PrintRow[];
26
+ };
27
+ }
28
+ export interface PrintOptions {
29
+ title?: string;
30
+ }
31
+ export declare const createPrintTable: (table: PrintTable, columns: PrintColumn[], options?: PrintOptions) => HTMLElement;
32
+ export declare const printGrid: (table: PrintTable, columns: PrintColumn[], options?: PrintOptions) => void;
@@ -1,11 +1,15 @@
1
- // Hand-written types for the vendored sanitizer.js (see the provenance header there)
2
- export type Allowlist = Record<string, Array<string | RegExp>>
3
-
4
- export declare const DefaultAllowlist: Allowlist
5
- export declare const SVGAllowlist: Allowlist
6
- export declare function escapeHtml(unsafeText: string): string
7
- export declare function sanitizeHtml(
8
- unsafeHtml: string,
9
- allowList: Allowlist,
10
- sanitizeFunction?: ((html: string) => string) | null
11
- ): string
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI util/sanitizer.ts
4
+ * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
5
+ *
6
+ * This is a modified version of the Bootstrap's util/sanitizer.ts
7
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
8
+ * --------------------------------------------------------------------------
9
+ */
10
+ type SanitizerAllowList = Record<string, Array<string | RegExp>>;
11
+ export declare const DefaultAllowlist: SanitizerAllowList;
12
+ export declare const SVGAllowlist: SanitizerAllowList;
13
+ export declare function escapeHtml(unsafeText: string): string;
14
+ export declare function sanitizeHtml(unsafeHtml: string, allowList: SanitizerAllowList, sanitizeFunction?: ((unsafeHtml: string) => string) | null): string;
15
+ export type { SanitizerAllowList };
@@ -0,0 +1 @@
1
+ export * from './xlsx.js'
@@ -0,0 +1,17 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid util/xlsx.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ import { type ExportScope, type ExportTable } from './export-table';
8
+ export interface XlsxOptions {
9
+ scope?: ExportScope;
10
+ sheetName?: string;
11
+ }
12
+ export interface XlsxDownloadOptions extends XlsxOptions {
13
+ filename?: string;
14
+ }
15
+ export type XlsxTable = ExportTable;
16
+ export declare const exportXlsx: (table: XlsxTable, options?: XlsxOptions) => Uint8Array;
17
+ export declare const downloadXlsx: (table: XlsxTable, options?: XlsxDownloadOptions) => void;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * CoreUI PRO data-grid util/zip.ts
4
+ * License (https://coreui.io/pro/license/)
5
+ * --------------------------------------------------------------------------
6
+ */
7
+ export interface ZipEntry {
8
+ name: string;
9
+ data: Uint8Array;
10
+ }
11
+ export declare const zip: (entries: ZipEntry[]) => Uint8Array;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coreui/data-grid",
3
- "description": "High-performance vanilla JavaScript data grid for CoreUI — 100,000 rows with sorting, filtering, selection, pagination, and server-side data",
4
- "version": "0.1.0-rc.0",
3
+ "description": "High-performance vanilla JavaScript data grid for CoreUI \u2014 100,000 rows with sorting, filtering, selection, pagination, and server-side data",
4
+ "version": "0.3.0-rc.0",
5
5
  "keywords": [
6
6
  "coreui",
7
7
  "data-grid",
@@ -24,9 +24,11 @@
24
24
  "css-prefix": "postcss --config build/postcss.config.mjs --replace \"dist/css/*.css\" \"!dist/css/*.min.css\"",
25
25
  "css-watch": "sass --watch --style expanded --source-map --embed-sources --no-error-css scss/:dist/css/",
26
26
  "js": "npm-run-all js-compile js-types js-minify",
27
- "js-compile": "rollup --config build/rollup.config.mjs --sourcemap",
27
+ "js-compile": "rolldown --config build/rolldown.config.mjs --sourcemap",
28
28
  "js-minify": "npm-run-all --aggregate-output --parallel js-minify-*",
29
- "js-types": "tsc --project tsconfig.types.json && mkdir -p dist/types/dom dist/types/util && cp src/*.d.ts dist/types/ && cp src/dom/*.d.ts dist/types/dom/ && cp src/util/*.d.ts dist/types/util/ && node build/types-esm-shims.mjs",
29
+ "js-types": "tsc --project tsconfig.types.json && node build/types-esm-shims.mjs",
30
+ "js-minify-lite": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/data-grid.lite.js.map,includeSources,url=data-grid.lite.min.js.map\" --output dist/js/data-grid.lite.min.js dist/js/data-grid.lite.js",
31
+ "js-minify-lite-esm": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/data-grid.lite.esm.js.map,includeSources,url=data-grid.lite.esm.min.js.map\" --output dist/js/data-grid.lite.esm.min.js dist/js/data-grid.lite.esm.js",
30
32
  "js-minify-standalone": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/data-grid.js.map,includeSources,url=data-grid.min.js.map\" --output dist/js/data-grid.min.js dist/js/data-grid.js",
31
33
  "js-minify-standalone-esm": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/data-grid.esm.js.map,includeSources,url=data-grid.esm.min.js.map\" --output dist/js/data-grid.esm.min.js dist/js/data-grid.esm.js",
32
34
  "test": "npm-run-all typecheck test-unit",
@@ -52,6 +54,16 @@
52
54
  "default": "./dist/js/data-grid.js"
53
55
  }
54
56
  },
57
+ "./lite": {
58
+ "import": {
59
+ "types": "./dist/types/index-lite.d.mts",
60
+ "default": "./dist/js/data-grid.lite.mjs"
61
+ },
62
+ "require": {
63
+ "types": "./dist/types/index-lite.d.ts",
64
+ "default": "./dist/js/data-grid.lite.js"
65
+ }
66
+ },
55
67
  "./labels": {
56
68
  "import": {
57
69
  "types": "./dist/types/labels.d.mts",
@@ -72,6 +84,16 @@
72
84
  "default": "./dist/js/filters.cjs"
73
85
  }
74
86
  },
87
+ "./clipboard": {
88
+ "import": {
89
+ "types": "./dist/types/util/clipboard.d.mts",
90
+ "default": "./dist/js/clipboard.mjs"
91
+ },
92
+ "require": {
93
+ "types": "./dist/types/util/clipboard.d.ts",
94
+ "default": "./dist/js/clipboard.cjs"
95
+ }
96
+ },
75
97
  "./csv": {
76
98
  "import": {
77
99
  "types": "./dist/types/util/csv.d.mts",
@@ -82,6 +104,56 @@
82
104
  "default": "./dist/js/csv.cjs"
83
105
  }
84
106
  },
107
+ "./xlsx": {
108
+ "import": {
109
+ "types": "./dist/types/util/xlsx.d.mts",
110
+ "default": "./dist/js/xlsx.mjs"
111
+ },
112
+ "require": {
113
+ "types": "./dist/types/util/xlsx.d.ts",
114
+ "default": "./dist/js/xlsx.cjs"
115
+ }
116
+ },
117
+ "./print": {
118
+ "import": {
119
+ "types": "./dist/types/util/print.d.mts",
120
+ "default": "./dist/js/print.mjs"
121
+ },
122
+ "require": {
123
+ "types": "./dist/types/util/print.d.ts",
124
+ "default": "./dist/js/print.cjs"
125
+ }
126
+ },
127
+ "./direction": {
128
+ "import": {
129
+ "types": "./dist/types/util/direction.d.mts",
130
+ "default": "./dist/js/direction.mjs"
131
+ },
132
+ "require": {
133
+ "types": "./dist/types/util/direction.d.ts",
134
+ "default": "./dist/js/direction.cjs"
135
+ }
136
+ },
137
+ "./validate": {
138
+ "import": {
139
+ "types": "./dist/types/engine/validate.d.mts",
140
+ "default": "./dist/js/validate.mjs"
141
+ },
142
+ "require": {
143
+ "types": "./dist/types/engine/validate.d.ts",
144
+ "default": "./dist/js/validate.cjs"
145
+ }
146
+ },
147
+ "./drag": {
148
+ "import": {
149
+ "types": "./dist/types/util/drag.d.mts",
150
+ "default": "./dist/js/drag.mjs"
151
+ },
152
+ "require": {
153
+ "types": "./dist/types/util/drag.d.ts",
154
+ "default": "./dist/js/drag.cjs"
155
+ }
156
+ },
85
157
  "./scss/*": "./scss/*",
86
158
  "./dist/*": "./dist/*",
87
159
  "./package.json": "./package.json"
@@ -95,11 +167,32 @@
95
167
  "labels": [
96
168
  "dist/types/labels.d.ts"
97
169
  ],
170
+ "clipboard": [
171
+ "dist/types/util/clipboard.d.ts"
172
+ ],
98
173
  "csv": [
99
174
  "dist/types/util/csv.d.ts"
100
175
  ],
176
+ "drag": [
177
+ "dist/types/util/drag.d.ts"
178
+ ],
101
179
  "filters": [
102
180
  "dist/types/filters.d.ts"
181
+ ],
182
+ "lite": [
183
+ "dist/types/index-lite.d.ts"
184
+ ],
185
+ "print": [
186
+ "dist/types/util/print.d.ts"
187
+ ],
188
+ "direction": [
189
+ "dist/types/util/direction.d.ts"
190
+ ],
191
+ "validate": [
192
+ "dist/types/engine/validate.d.ts"
193
+ ],
194
+ "xlsx": [
195
+ "dist/types/util/xlsx.d.ts"
103
196
  ]
104
197
  }
105
198
  },
@@ -115,23 +208,21 @@
115
208
  },
116
209
  "license": "SEE LICENSE IN LICENSE",
117
210
  "dependencies": {
118
- "@tanstack/table-core": "^8.21.3",
211
+ "@tanstack/store": "^0.11.0",
212
+ "@tanstack/table-core": "^9.0.0",
119
213
  "@tanstack/virtual-core": "^3.17.3"
120
214
  },
121
215
  "devDependencies": {
122
- "@rollup/plugin-commonjs": "^29.0.3",
123
- "@rollup/plugin-node-resolve": "^16.0.3",
124
- "@rollup/plugin-replace": "^6.0.3",
125
- "@rollup/plugin-typescript": "^12.3.0",
126
216
  "@vitest/coverage-v8": "^4.1.10",
127
217
  "autoprefixer": "^10.5.2",
218
+ "browserslist": "^4.28.7",
128
219
  "clean-css-cli": "^5.6.3",
129
220
  "jsdom": "^29.1.1",
130
221
  "npm-run-all": "^4.1.5",
131
222
  "postcss": "^8.5.15",
132
223
  "postcss-cli": "^11.0.1",
133
224
  "rimraf": "^6.1.3",
134
- "rollup": "^4.62.2",
225
+ "rolldown": "^1.2.3",
135
226
  "sass-embedded": "^1.100.0",
136
227
  "terser": "5.48.0",
137
228
  "tslib": "^2.8.1",