@ah-automation.nl/component-lib 0.0.43 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/data-table.d.ts +8 -1
- package/dist/components/ui/data-table.d.ts.map +1 -1
- package/dist/index.js +3555 -3599
- package/dist/styles.css +1 -1
- package/dist/types/data-table.d.ts +56 -21
- package/dist/types/data-table.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import type { Column, ColumnDef, FilterFn, Row, SortingState, Table as TanStackTable, VisibilityState } from "@tanstack/react-table";
|
|
2
2
|
import type { MouseEvent, ReactNode } from "react";
|
|
3
3
|
export type DataTableColumnMeta = {
|
|
4
|
+
/** Label used for column visibility controls. Falls back to the header text or column id. */
|
|
4
5
|
label?: string;
|
|
6
|
+
/** Extra classes applied to the rendered header cell for this column. */
|
|
5
7
|
headerClassName?: string;
|
|
8
|
+
/** Extra classes applied to each rendered body cell for this column. */
|
|
6
9
|
cellClassName?: string;
|
|
7
10
|
};
|
|
11
|
+
/** Row keys included in the shared global search input. */
|
|
12
|
+
export type DataTableSearchableKey<TData> = Extract<keyof TData, string>;
|
|
8
13
|
export type DataTableSelectionContentProps<TData> = {
|
|
14
|
+
/** Controlled row ids that are currently selected. */
|
|
9
15
|
selectedRowIds: string[];
|
|
16
|
+
/** Selected row objects resolved from the current dataset. */
|
|
10
17
|
selectedRows: TData[];
|
|
18
|
+
/** Clears the current controlled row selection. */
|
|
11
19
|
clearSelection: () => void;
|
|
12
20
|
};
|
|
13
21
|
export type DataTableColumnFilterRenderer<TData> = (props: {
|
|
22
|
+
/** TanStack column instance for the filterable column. */
|
|
14
23
|
column: Column<TData>;
|
|
24
|
+
/** Optional placeholder configured for this column filter. */
|
|
15
25
|
placeholder?: string;
|
|
16
26
|
}) => ReactNode;
|
|
17
27
|
export type DataTableColumnFilterRenderers<TData> = Partial<Record<string, DataTableColumnFilterRenderer<TData>>>;
|
|
@@ -30,43 +40,68 @@ export type DataTableRowClassNameGetter<TData> = (row: TData) => string | undefi
|
|
|
30
40
|
export type DataTableExpandedRowRenderer<TData> = (row: TData) => ReactNode;
|
|
31
41
|
export type DataTableGlobalFilterFn<TData> = FilterFn<TData>;
|
|
32
42
|
export type DataTableProps<TData> = {
|
|
43
|
+
/** Dataset rendered by the table. */
|
|
33
44
|
data: TData[];
|
|
45
|
+
/** TanStack column definitions describing how rows are displayed. */
|
|
34
46
|
columns: Array<ColumnDef<TData>>;
|
|
47
|
+
/** Stable row id resolver. Falls back to the row index when omitted. */
|
|
35
48
|
getRowId?: (originalRow: TData, index: number) => string;
|
|
36
|
-
|
|
49
|
+
/** Row keys included in the shared search input. Pass an empty array to hide search. */
|
|
50
|
+
searchableKeys: Array<DataTableSearchableKey<TData>>;
|
|
51
|
+
/** Row click handler receiving the TanStack row instance and DOM event. */
|
|
37
52
|
onRowClick?: DataTableRowClickHandler<TData>;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
/** Placeholder shown in the shared global search input. */
|
|
54
|
+
searchPlaceholder?: string;
|
|
55
|
+
/** Controlled ids for the built-in row-selection column. */
|
|
56
|
+
selectedRowIds?: string[];
|
|
57
|
+
/** Called when the built-in row-selection ids change. */
|
|
58
|
+
onSelectedRowIdsChange?: (selectedRowIds: string[]) => void;
|
|
59
|
+
/** Called with resolved row objects when the built-in row selection changes. */
|
|
60
|
+
onSelectedRowsChange?: (selectedRows: TData[]) => void;
|
|
61
|
+
/** Custom content shown above the table when one or more rows are selected. */
|
|
62
|
+
selectionContent?: ReactNode | ((props: DataTableSelectionContentProps<TData>) => ReactNode);
|
|
63
|
+
/** Content rendered on the left side of the table toolbar. */
|
|
64
|
+
toolbarStart?: ReactNode;
|
|
65
|
+
/** Content rendered on the right side of the table toolbar. */
|
|
66
|
+
toolbarEnd?: ReactNode;
|
|
67
|
+
/** Content rendered on the left side of the footer. */
|
|
68
|
+
footerStart?: ReactNode;
|
|
69
|
+
/** Content rendered on the right side of the footer. */
|
|
70
|
+
footerEnd?: ReactNode;
|
|
71
|
+
/** Message rendered when no rows remain after filtering. */
|
|
45
72
|
emptyMessage?: string;
|
|
46
|
-
|
|
47
|
-
enableGlobalFilter?: boolean;
|
|
48
|
-
enablePagination?: boolean;
|
|
49
|
-
pageSizeOptions?: number[];
|
|
50
|
-
initialPageSize?: number;
|
|
73
|
+
/** Enables the built-in column visibility control in the footer. */
|
|
51
74
|
showColumnVisibility?: boolean;
|
|
75
|
+
/** Initial sort state passed to TanStack table state. */
|
|
76
|
+
initialSorting?: SortingState;
|
|
77
|
+
/** Initial visibility state for leaf columns. */
|
|
52
78
|
initialColumnVisibility?: VisibilityState;
|
|
79
|
+
/** Page-size options shown in the footer selector. */
|
|
80
|
+
pageSizeOptions?: number[];
|
|
81
|
+
/** Enables client-side pagination. Disable to render all filtered rows. */
|
|
82
|
+
enablePagination?: boolean;
|
|
83
|
+
/** Classes applied to the outer table wrapper. */
|
|
84
|
+
className?: string;
|
|
85
|
+
/** Enables a dedicated filter row under the headers for filterable columns. */
|
|
53
86
|
showColumnFilters?: boolean;
|
|
87
|
+
/** Optional per-column placeholder text for the filter row inputs. */
|
|
54
88
|
columnFilterPlaceholders?: DataTableColumnFilterPlaceholders;
|
|
89
|
+
/** Optional custom filter controls keyed by column id. */
|
|
55
90
|
columnFilterRenderers?: DataTableColumnFilterRenderers<TData>;
|
|
56
|
-
|
|
57
|
-
onSelectedRowIdsChange?: (selectedRowIds: string[]) => void;
|
|
58
|
-
onSelectedRowsChange?: (selectedRows: TData[]) => void;
|
|
59
|
-
selectionContent?: ReactNode | ((props: DataTableSelectionContentProps<TData>) => ReactNode);
|
|
60
|
-
getRowClassName?: DataTableRowClassNameGetter<TData>;
|
|
61
|
-
isRowExpanded?: (row: TData) => boolean;
|
|
62
|
-
renderExpandedRow?: DataTableExpandedRowRenderer<TData>;
|
|
91
|
+
/** Optional row virtualization settings. Automatically most useful when pagination is disabled. */
|
|
63
92
|
virtualization?: {
|
|
93
|
+
/** Toggles row virtualization. */
|
|
64
94
|
enabled?: boolean;
|
|
95
|
+
/** Number of extra rows rendered above and below the viewport. */
|
|
65
96
|
overscan?: number;
|
|
97
|
+
/** Estimated row height used by the virtualizer. */
|
|
66
98
|
itemHeight?: number;
|
|
67
99
|
};
|
|
68
|
-
|
|
100
|
+
/** Classes applied to the scrollable table viewport wrapper. */
|
|
69
101
|
scrollAreaClassName?: string;
|
|
102
|
+
/** Classes applied to the underlying table element. */
|
|
70
103
|
tableClassName?: string;
|
|
104
|
+
/** Row class name */
|
|
105
|
+
rowClassName?: string;
|
|
71
106
|
};
|
|
72
107
|
//# sourceMappingURL=data-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../src/types/data-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,GAAG,EACH,YAAY,EACZ,KAAK,IAAI,aAAa,EACtB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,8BAA8B,CAAC,KAAK,IAAI;IAClD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,KAAK,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,6BAA6B,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE;IACzD,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB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