mui-universal-table 1.0.1 → 1.0.4
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/LICENSE +21 -21
- package/README.md +159 -159
- package/dist/index.esm.js +16 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/package.json +100 -99
- package/src/index.d.ts +75 -75
package/src/index.d.ts
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { ReactElement } from "react";
|
|
2
|
-
|
|
3
|
-
export interface TableRowData {
|
|
4
|
-
[key: string]: unknown;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface TableHeader {
|
|
8
|
-
id: string;
|
|
9
|
-
label: string;
|
|
10
|
-
searchable?: boolean;
|
|
11
|
-
numeric?: boolean;
|
|
12
|
-
date?: boolean;
|
|
13
|
-
// eslint-disable-next-line no-unused-vars
|
|
14
|
-
component?: (rowData: TableRowData) => ReactElement;
|
|
15
|
-
cellProps?: Record<string, unknown>;
|
|
16
|
-
subRow?: boolean;
|
|
17
|
-
iconColor?: string;
|
|
18
|
-
openIcon?: ReactElement;
|
|
19
|
-
closeIcon?: ReactElement;
|
|
20
|
-
headers?: TableHeader[];
|
|
21
|
-
loading?: boolean;
|
|
22
|
-
// eslint-disable-next-line no-unused-vars
|
|
23
|
-
setLoading?: (loading: boolean) => void;
|
|
24
|
-
/** Preferred callback — fires when the user clicks reload on a sub-table. */
|
|
25
|
-
// eslint-disable-next-line no-unused-vars
|
|
26
|
-
onReload?: () => void;
|
|
27
|
-
subTitle?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface UniversalTableProps {
|
|
31
|
-
/** Array of data objects to display */
|
|
32
|
-
data: TableRowData[];
|
|
33
|
-
/** Array of header configuration objects */
|
|
34
|
-
headers: TableHeader[];
|
|
35
|
-
/** Table title */
|
|
36
|
-
name?: string;
|
|
37
|
-
/** Shows loading state */
|
|
38
|
-
loading?: boolean;
|
|
39
|
-
/** Function to control loading state (legacy — prefer onReload) */
|
|
40
|
-
// eslint-disable-next-line no-unused-vars
|
|
41
|
-
setLoading?: (loading: boolean) => void;
|
|
42
|
-
/** Fires when the user clicks the reload button */
|
|
43
|
-
// eslint-disable-next-line no-unused-vars
|
|
44
|
-
onReload?: () => void;
|
|
45
|
-
/** Enable lazy loading indicator */
|
|
46
|
-
lazyloading?: boolean;
|
|
47
|
-
/** Current page for lazy loading */
|
|
48
|
-
currentPage?: number;
|
|
49
|
-
/** Total pages for lazy loading */
|
|
50
|
-
totalPages?: number;
|
|
51
|
-
/** Loading state for reload button */
|
|
52
|
-
reloadBtnLoading?: boolean;
|
|
53
|
-
/** Whether this is a nested sub-table */
|
|
54
|
-
subTable?: boolean;
|
|
55
|
-
/** Hide badges on expandable rows */
|
|
56
|
-
hideBadge?: boolean;
|
|
57
|
-
/** Enable row selection */
|
|
58
|
-
selectRows?: boolean;
|
|
59
|
-
/** Property to use as unique identifier for selection */
|
|
60
|
-
selectID?: string;
|
|
61
|
-
/** Custom icon for selection action */
|
|
62
|
-
selectIcon?: ReactElement;
|
|
63
|
-
/** Callback when rows are selected */
|
|
64
|
-
// eslint-disable-next-line no-unused-vars
|
|
65
|
-
onSelection?: (selectedIds: unknown[]) => void;
|
|
66
|
-
/** Override default page size options (e.g. [10, 25, 50]) */
|
|
67
|
-
pageSizeOptions?: number[];
|
|
68
|
-
/** Persist search term to sessionStorage (requires name prop) */
|
|
69
|
-
persistSearch?: boolean;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
declare const UniversalTable: React.FC<UniversalTableProps>;
|
|
73
|
-
|
|
74
|
-
export { UniversalTable };
|
|
75
|
-
export default UniversalTable;
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
|
|
3
|
+
export interface TableRowData {
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface TableHeader {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
searchable?: boolean;
|
|
11
|
+
numeric?: boolean;
|
|
12
|
+
date?: boolean;
|
|
13
|
+
// eslint-disable-next-line no-unused-vars
|
|
14
|
+
component?: (rowData: TableRowData) => ReactElement;
|
|
15
|
+
cellProps?: Record<string, unknown>;
|
|
16
|
+
subRow?: boolean;
|
|
17
|
+
iconColor?: string;
|
|
18
|
+
openIcon?: ReactElement;
|
|
19
|
+
closeIcon?: ReactElement;
|
|
20
|
+
headers?: TableHeader[];
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
// eslint-disable-next-line no-unused-vars
|
|
23
|
+
setLoading?: (loading: boolean) => void;
|
|
24
|
+
/** Preferred callback — fires when the user clicks reload on a sub-table. */
|
|
25
|
+
// eslint-disable-next-line no-unused-vars
|
|
26
|
+
onReload?: () => void;
|
|
27
|
+
subTitle?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface UniversalTableProps {
|
|
31
|
+
/** Array of data objects to display */
|
|
32
|
+
data: TableRowData[];
|
|
33
|
+
/** Array of header configuration objects */
|
|
34
|
+
headers: TableHeader[];
|
|
35
|
+
/** Table title */
|
|
36
|
+
name?: string;
|
|
37
|
+
/** Shows loading state */
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
/** Function to control loading state (legacy — prefer onReload) */
|
|
40
|
+
// eslint-disable-next-line no-unused-vars
|
|
41
|
+
setLoading?: (loading: boolean) => void;
|
|
42
|
+
/** Fires when the user clicks the reload button */
|
|
43
|
+
// eslint-disable-next-line no-unused-vars
|
|
44
|
+
onReload?: () => void;
|
|
45
|
+
/** Enable lazy loading indicator */
|
|
46
|
+
lazyloading?: boolean;
|
|
47
|
+
/** Current page for lazy loading */
|
|
48
|
+
currentPage?: number;
|
|
49
|
+
/** Total pages for lazy loading */
|
|
50
|
+
totalPages?: number;
|
|
51
|
+
/** Loading state for reload button */
|
|
52
|
+
reloadBtnLoading?: boolean;
|
|
53
|
+
/** Whether this is a nested sub-table */
|
|
54
|
+
subTable?: boolean;
|
|
55
|
+
/** Hide badges on expandable rows */
|
|
56
|
+
hideBadge?: boolean;
|
|
57
|
+
/** Enable row selection */
|
|
58
|
+
selectRows?: boolean;
|
|
59
|
+
/** Property to use as unique identifier for selection */
|
|
60
|
+
selectID?: string;
|
|
61
|
+
/** Custom icon for selection action */
|
|
62
|
+
selectIcon?: ReactElement;
|
|
63
|
+
/** Callback when rows are selected */
|
|
64
|
+
// eslint-disable-next-line no-unused-vars
|
|
65
|
+
onSelection?: (selectedIds: unknown[]) => void;
|
|
66
|
+
/** Override default page size options (e.g. [10, 25, 50]) */
|
|
67
|
+
pageSizeOptions?: number[];
|
|
68
|
+
/** Persist search term to sessionStorage (requires name prop) */
|
|
69
|
+
persistSearch?: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
declare const UniversalTable: React.FC<UniversalTableProps>;
|
|
73
|
+
|
|
74
|
+
export { UniversalTable };
|
|
75
|
+
export default UniversalTable;
|