@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.
- package/README.md +4 -2
- package/dist/css/data-grid.css +11 -11
- package/dist/css/data-grid.css.map +1 -1
- package/dist/css/data-grid.min.css +2 -2
- package/dist/css/data-grid.min.css.map +1 -1
- package/dist/css/data-grid.standalone.css +1066 -0
- package/dist/css/data-grid.standalone.css.map +1 -0
- package/dist/css/data-grid.standalone.min.css +5 -0
- package/dist/css/data-grid.standalone.min.css.map +1 -0
- package/dist/js/clipboard.cjs +2 -3
- package/dist/js/clipboard.mjs +2 -3
- package/dist/js/csv.cjs +5 -6
- package/dist/js/csv.cjs.map +1 -1
- package/dist/js/csv.mjs +5 -6
- package/dist/js/csv.mjs.map +1 -1
- package/dist/js/data-grid.esm.js +5685 -5422
- package/dist/js/data-grid.esm.js.map +1 -1
- package/dist/js/data-grid.esm.min.js +2 -2
- package/dist/js/data-grid.esm.min.js.map +1 -1
- package/dist/js/data-grid.js +5685 -5423
- package/dist/js/data-grid.js.map +1 -1
- package/dist/js/data-grid.lite.esm.js +2707 -2629
- package/dist/js/data-grid.lite.esm.js.map +1 -1
- package/dist/js/data-grid.lite.esm.min.js +2 -2
- package/dist/js/data-grid.lite.esm.min.js.map +1 -1
- package/dist/js/data-grid.lite.js +2707 -2630
- package/dist/js/data-grid.lite.js.map +1 -1
- package/dist/js/data-grid.lite.min.js +2 -2
- package/dist/js/data-grid.lite.min.js.map +1 -1
- package/dist/js/data-grid.lite.mjs +2707 -2629
- package/dist/js/data-grid.lite.mjs.map +1 -1
- package/dist/js/data-grid.min.js +2 -2
- package/dist/js/data-grid.min.js.map +1 -1
- package/dist/js/data-grid.mjs +5685 -5422
- package/dist/js/data-grid.mjs.map +1 -1
- package/dist/js/direction.cjs +25 -0
- package/dist/js/direction.cjs.map +1 -0
- package/dist/js/direction.mjs +23 -0
- package/dist/js/direction.mjs.map +1 -0
- package/dist/js/drag.cjs +20 -12
- package/dist/js/drag.cjs.map +1 -1
- package/dist/js/drag.mjs +20 -12
- package/dist/js/drag.mjs.map +1 -1
- package/dist/js/{export-table-CNAKStzj.mjs → export-table-BggGRmzQ.mjs} +3 -4
- package/dist/js/{export-table-CNAKStzj.mjs.map → export-table-BggGRmzQ.mjs.map} +1 -1
- package/dist/js/{export-table-doIwvE5U.cjs → export-table-BiB3_lVo.cjs} +3 -4
- package/dist/js/{export-table-doIwvE5U.cjs.map → export-table-BiB3_lVo.cjs.map} +1 -1
- package/dist/js/filters.cjs +2 -3
- package/dist/js/filters.mjs +2 -3
- package/dist/js/labels.cjs +2 -3
- package/dist/js/labels.mjs +2 -3
- package/dist/js/print.cjs +2 -3
- package/dist/js/print.mjs +2 -3
- package/dist/js/selector.cjs +22 -0
- package/dist/js/selector.cjs.map +1 -0
- package/dist/js/selector.mjs +21 -0
- package/dist/js/selector.mjs.map +1 -0
- package/dist/js/validate.cjs +2 -3
- package/dist/js/validate.mjs +2 -3
- package/dist/js/xlsx.cjs +5 -7
- package/dist/js/xlsx.cjs.map +1 -1
- package/dist/js/xlsx.mjs +5 -7
- package/dist/js/xlsx.mjs.map +1 -1
- package/dist/types/base-component.d.mts +29 -0
- package/dist/types/data-grid.d.mts +141 -0
- package/dist/types/dom/data.d.mts +15 -0
- package/dist/types/dom/event-handler.d.mts +22 -0
- package/dist/types/dom/manipulator.d.mts +16 -0
- package/dist/types/engine/active-cell.d.mts +33 -0
- package/dist/types/engine/active-cell.d.ts +1 -0
- package/dist/types/engine/data-source.d.mts +19 -0
- package/dist/types/engine/features-lite.d.mts +25 -0
- package/dist/types/engine/features.d.mts +35 -0
- package/dist/types/engine/scheduler.d.mts +11 -0
- package/dist/types/engine/table.d.mts +9 -0
- package/dist/types/engine/table.d.ts +1 -1
- package/dist/types/engine/validate.d.mts +20 -1
- package/dist/types/engine/virtualizer.d.mts +23 -0
- package/dist/types/filters.d.mts +13 -1
- package/dist/types/icons.d.mts +23 -0
- package/dist/types/index-lite.d.mts +19 -1
- package/dist/types/index.d.mts +21 -1
- package/dist/types/labels.d.mts +9 -1
- package/dist/types/types.d.mts +284 -0
- package/dist/types/ui/body.d.mts +37 -0
- package/dist/types/ui/column-chooser.d.mts +27 -0
- package/dist/types/ui/editor.d.mts +8 -0
- package/dist/types/ui/filter-menu.d.mts +21 -0
- package/dist/types/ui/header.d.mts +51 -0
- package/dist/types/ui/loading.d.mts +12 -0
- package/dist/types/ui/menu.d.mts +17 -0
- package/dist/types/ui/pagination.d.mts +17 -0
- package/dist/types/ui/pinning.d.mts +17 -0
- package/dist/types/ui/toolbar.d.mts +42 -0
- package/dist/types/ui/tooltip.d.mts +10 -0
- package/dist/types/util/clipboard.d.mts +29 -1
- package/dist/types/util/config.d.mts +28 -0
- package/dist/types/util/csv.d.mts +19 -1
- package/dist/types/util/debounce.d.mts +7 -0
- package/dist/types/util/direction.d.mts +17 -0
- package/dist/types/util/direction.d.ts +17 -0
- package/dist/types/util/drag.d.mts +48 -1
- package/dist/types/util/export-table.d.mts +47 -0
- package/dist/types/util/index.d.mts +66 -0
- package/dist/types/util/print.d.mts +32 -1
- package/dist/types/util/sanitizer.d.mts +15 -0
- package/dist/types/util/selector.d.mts +12 -0
- package/dist/types/util/selector.d.ts +12 -0
- package/dist/types/util/xlsx.d.mts +17 -1
- package/dist/types/util/zip.d.mts +11 -0
- package/package.json +42 -16
- package/scss/_base.scss +13 -0
- package/scss/_config.scss +14 -0
- package/scss/_functions.scss +1 -0
- package/scss/_mixins.scss +1 -0
- package/scss/base/_buttons.scss +113 -0
- package/scss/base/_forms.scss +157 -0
- package/scss/base/_helpers.scss +24 -0
- package/scss/base/_pagination.scss +100 -0
- package/scss/base/_reboot.scss +93 -0
- package/scss/base/_root.scss +85 -0
- package/scss/base/_spinner.scss +45 -0
- package/scss/base/_table.scss +78 -0
- package/scss/components/_data-grid.scss +807 -0
- package/scss/data-grid.scss +7 -743
- package/scss/data-grid.standalone.scss +16 -0
- package/scss/functions/_defaults.scss +25 -0
- package/scss/mixins/_tokens.scss +12 -0
- package/src/data-grid.ts +22 -6
- package/src/engine/active-cell.ts +6 -3
- package/src/engine/table.ts +9 -1
- package/src/index-lite.ts +1 -1
- package/src/index.ts +1 -1
- package/src/ui/column-chooser.ts +4 -4
- package/src/ui/filter-menu.ts +5 -5
- package/src/ui/menu.ts +4 -4
- package/src/ui/pagination.ts +1 -1
- package/src/ui/tooltip.ts +2 -2
- package/src/util/csv.ts +2 -2
- package/src/util/direction.ts +38 -0
- package/src/util/drag.ts +45 -9
- package/src/util/selector.ts +16 -0
- package/src/util/xlsx.ts +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* CoreUI PRO data-grid ui/pinning.ts
|
|
4
|
+
* License (https://coreui.io/pro/license/)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
export interface PinnedCellInfo {
|
|
8
|
+
side: 'start' | 'end';
|
|
9
|
+
offset: number;
|
|
10
|
+
edge: boolean;
|
|
11
|
+
afterSelect: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface GridPinning {
|
|
14
|
+
columns: Record<string, PinnedCellInfo>;
|
|
15
|
+
select: PinnedCellInfo | null;
|
|
16
|
+
}
|
|
17
|
+
export declare const applyPinnedCell: (cell: HTMLTableCellElement, info: PinnedCellInfo | null) => void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* CoreUI PRO data-grid ui/toolbar.ts
|
|
4
|
+
* License (https://coreui.io/pro/license/)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
import type { CsvDownloadOptions, CsvTable } from '../util/csv.mjs';
|
|
8
|
+
import type { DataGridLabels, DataGridOptions } from '../types.mjs';
|
|
9
|
+
export interface GridToolbarContext {
|
|
10
|
+
labels: DataGridLabels;
|
|
11
|
+
columns: boolean;
|
|
12
|
+
export: boolean;
|
|
13
|
+
history: boolean;
|
|
14
|
+
print: boolean;
|
|
15
|
+
search: boolean;
|
|
16
|
+
icons: {
|
|
17
|
+
columns: string;
|
|
18
|
+
export: string;
|
|
19
|
+
print: string;
|
|
20
|
+
redo: string;
|
|
21
|
+
undo: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface GridToolbar {
|
|
25
|
+
element: HTMLDivElement;
|
|
26
|
+
}
|
|
27
|
+
export type DataGridExporter = (table: CsvTable, options: DataGridExportOptions) => void;
|
|
28
|
+
export interface DataGridExportOptions extends CsvDownloadOptions {
|
|
29
|
+
sheetName?: string;
|
|
30
|
+
exporter?: DataGridExporter;
|
|
31
|
+
}
|
|
32
|
+
export interface ResolvedToolbar {
|
|
33
|
+
columns: boolean;
|
|
34
|
+
export: boolean;
|
|
35
|
+
exportOptions: DataGridExportOptions;
|
|
36
|
+
history: boolean;
|
|
37
|
+
print: boolean;
|
|
38
|
+
search: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare const resolveToolbar: (options: DataGridOptions) => ResolvedToolbar;
|
|
41
|
+
export declare const isGlobalFilterEnabled: (options: DataGridOptions) => boolean;
|
|
42
|
+
export declare const createToolbar: (context: GridToolbarContext) => GridToolbar;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* CoreUI PRO data-grid ui/tooltip.ts
|
|
4
|
+
* License (https://coreui.io/pro/license/)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
export interface GridTooltip {
|
|
8
|
+
dispose: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const createTooltip: (root: HTMLElement) => GridTooltip;
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
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.mjs';
|
|
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>;
|
|
@@ -0,0 +1,28 @@
|
|
|
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;
|
|
26
|
+
}
|
|
27
|
+
export default Config;
|
|
28
|
+
export type { ComponentConfig };
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* CoreUI PRO data-grid util/csv.ts
|
|
4
|
+
* License (https://coreui.io/pro/license/)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
import { type ExportScope, type ExportTable } from './export-table.mjs';
|
|
8
|
+
export interface CsvOptions {
|
|
9
|
+
scope?: ExportScope;
|
|
10
|
+
delimiter?: string;
|
|
11
|
+
bom?: boolean;
|
|
12
|
+
sanitize?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface CsvDownloadOptions extends CsvOptions {
|
|
15
|
+
filename?: string;
|
|
16
|
+
}
|
|
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,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* CoreUI PRO data-grid util/debounce.ts
|
|
4
|
+
* License (https://coreui.io/pro/license/)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
export declare const debounce: <Args extends unknown[]>(callback: (...args: Args) => void, delay: number) => ((...args: Args) => void);
|
|
@@ -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,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 {};
|
|
@@ -1 +1,48 @@
|
|
|
1
|
-
|
|
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.mjs';
|
|
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;
|
|
@@ -0,0 +1,66 @@
|
|
|
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 };
|
|
@@ -1 +1,32 @@
|
|
|
1
|
-
|
|
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.mjs';
|
|
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;
|
|
@@ -0,0 +1,15 @@
|
|
|
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,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* CoreUI PRO data-grid util/selector.ts
|
|
4
|
+
* License (https://coreui.io/pro/license/)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Escapes a column key or row index for a double-quoted CSS attribute selector value.
|
|
9
|
+
* @param value The key or index interpolated into `[data-…="…"]`.
|
|
10
|
+
* @returns The value as a string, with `"` and `\` backslash-escaped and line breaks as hex escapes.
|
|
11
|
+
*/
|
|
12
|
+
export declare const escapeAttributeValue: (value: string | number) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --------------------------------------------------------------------------
|
|
3
|
+
* CoreUI PRO data-grid util/selector.ts
|
|
4
|
+
* License (https://coreui.io/pro/license/)
|
|
5
|
+
* --------------------------------------------------------------------------
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Escapes a column key or row index for a double-quoted CSS attribute selector value.
|
|
9
|
+
* @param value The key or index interpolated into `[data-…="…"]`.
|
|
10
|
+
* @returns The value as a string, with `"` and `\` backslash-escaped and line breaks as hex escapes.
|
|
11
|
+
*/
|
|
12
|
+
export declare const escapeAttributeValue: (value: string | number) => string;
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
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.mjs';
|
|
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
|
|
4
|
-
"version": "0.
|
|
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.4.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"coreui",
|
|
7
7
|
"data-grid",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"js": "npm-run-all js-compile js-types js-minify",
|
|
27
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 && node build/types-esm
|
|
29
|
+
"js-types": "tsc --project tsconfig.types.json && node build/types-esm.mjs dist/types",
|
|
30
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
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",
|
|
32
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",
|
|
@@ -124,6 +124,26 @@
|
|
|
124
124
|
"default": "./dist/js/print.cjs"
|
|
125
125
|
}
|
|
126
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
|
+
"./selector": {
|
|
138
|
+
"import": {
|
|
139
|
+
"types": "./dist/types/util/selector.d.mts",
|
|
140
|
+
"default": "./dist/js/selector.mjs"
|
|
141
|
+
},
|
|
142
|
+
"require": {
|
|
143
|
+
"types": "./dist/types/util/selector.d.ts",
|
|
144
|
+
"default": "./dist/js/selector.cjs"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
127
147
|
"./validate": {
|
|
128
148
|
"import": {
|
|
129
149
|
"types": "./dist/types/engine/validate.d.mts",
|
|
@@ -175,6 +195,12 @@
|
|
|
175
195
|
"print": [
|
|
176
196
|
"dist/types/util/print.d.ts"
|
|
177
197
|
],
|
|
198
|
+
"direction": [
|
|
199
|
+
"dist/types/util/direction.d.ts"
|
|
200
|
+
],
|
|
201
|
+
"selector": [
|
|
202
|
+
"dist/types/util/selector.d.ts"
|
|
203
|
+
],
|
|
178
204
|
"validate": [
|
|
179
205
|
"dist/types/engine/validate.d.ts"
|
|
180
206
|
],
|
|
@@ -195,26 +221,26 @@
|
|
|
195
221
|
},
|
|
196
222
|
"license": "SEE LICENSE IN LICENSE",
|
|
197
223
|
"dependencies": {
|
|
198
|
-
"@tanstack/store": "^0.11.
|
|
199
|
-
"@tanstack/table-core": "^9.
|
|
200
|
-
"@tanstack/virtual-core": "^3.
|
|
224
|
+
"@tanstack/store": "^0.11.2",
|
|
225
|
+
"@tanstack/table-core": "^9.3.1",
|
|
226
|
+
"@tanstack/virtual-core": "^3.19.6"
|
|
201
227
|
},
|
|
202
228
|
"devDependencies": {
|
|
203
|
-
"@vitest/coverage-v8": "^
|
|
204
|
-
"autoprefixer": "^10.
|
|
205
|
-
"browserslist": "^4.
|
|
229
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
230
|
+
"autoprefixer": "^10.6.1",
|
|
231
|
+
"browserslist": "^4.29.4",
|
|
206
232
|
"clean-css-cli": "^5.6.3",
|
|
207
233
|
"jsdom": "^29.1.1",
|
|
208
234
|
"npm-run-all": "^4.1.5",
|
|
209
|
-
"postcss": "^8.5.
|
|
210
|
-
"postcss-cli": "^
|
|
235
|
+
"postcss": "^8.5.31",
|
|
236
|
+
"postcss-cli": "^12.0.0",
|
|
211
237
|
"rimraf": "^6.1.3",
|
|
212
|
-
"rolldown": "^1.2.
|
|
213
|
-
"sass-embedded": "^1.
|
|
214
|
-
"terser": "5.
|
|
238
|
+
"rolldown": "^1.2.15",
|
|
239
|
+
"sass-embedded": "^1.106.1",
|
|
240
|
+
"terser": "5.51.2",
|
|
215
241
|
"tslib": "^2.8.1",
|
|
216
|
-
"typescript": "
|
|
217
|
-
"vitest": "^
|
|
242
|
+
"typescript": "~6.0.3",
|
|
243
|
+
"vitest": "^5.0.5"
|
|
218
244
|
},
|
|
219
245
|
"files": [
|
|
220
246
|
"dist/{css,js,types}/**",
|
package/scss/_base.scss
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Optional base styles: the slice of CoreUI the grid's markup depends on
|
|
2
|
+
// (.table, .btn, form controls, .pagination, .spinner-border, .visually-hidden),
|
|
3
|
+
// scoped to `.data-grid` and emitted into the `$base-layer` cascade layer so an
|
|
4
|
+
// unlayered CoreUI stylesheet always wins over it.
|
|
5
|
+
|
|
6
|
+
@forward "base/root";
|
|
7
|
+
@forward "base/reboot";
|
|
8
|
+
@forward "base/table";
|
|
9
|
+
@forward "base/buttons";
|
|
10
|
+
@forward "base/forms";
|
|
11
|
+
@forward "base/pagination";
|
|
12
|
+
@forward "base/spinner";
|
|
13
|
+
@forward "base/helpers";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Prefix for CSS custom properties
|
|
2
|
+
//
|
|
3
|
+
// Shared by the grid partial and the optional base styles, so it lives here
|
|
4
|
+
// rather than in either of them.
|
|
5
|
+
|
|
6
|
+
// scss-docs-start data-grid-config
|
|
7
|
+
$prefix: cui- !default;
|
|
8
|
+
|
|
9
|
+
// Cascade layer holding the optional base styles. Everything the base sheet
|
|
10
|
+
// emits sits in this layer, so an unlayered CoreUI stylesheet always wins over
|
|
11
|
+
// it and the two can be loaded together. Rename it to place the fallbacks
|
|
12
|
+
// against a layered host stylesheet.
|
|
13
|
+
$base-layer: data-grid-base !default;
|
|
14
|
+
// scss-docs-end data-grid-config
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward "functions/defaults";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward "mixins/tokens";
|