@ceed/ads 0.0.169-0 → 0.0.169-1
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.
|
@@ -7,24 +7,24 @@ import Input from "../Input";
|
|
|
7
7
|
import Textarea from "../Textarea";
|
|
8
8
|
import Autocomplete from "../Autocomplete";
|
|
9
9
|
import Select from "../Select";
|
|
10
|
-
export type RenderCellHandler<T extends Record<
|
|
10
|
+
export type RenderCellHandler<T extends Record<keyof any, V>, V = unknown> = (params: {
|
|
11
11
|
row: T;
|
|
12
12
|
value?: V;
|
|
13
13
|
id: string;
|
|
14
14
|
}) => ReactNode;
|
|
15
|
-
export type CellEditStartEvent<T extends Record<
|
|
15
|
+
export type CellEditStartEvent<T extends Record<keyof any, V>, V = unknown> = (params: {
|
|
16
16
|
originalRow: T;
|
|
17
17
|
row: T;
|
|
18
18
|
value?: V;
|
|
19
19
|
id: string;
|
|
20
20
|
}) => void;
|
|
21
|
-
export type CellEditStopEvent<T extends Record<
|
|
21
|
+
export type CellEditStopEvent<T extends Record<keyof any, V>, V = unknown> = (params: {
|
|
22
22
|
originalRow: T;
|
|
23
23
|
row: T;
|
|
24
24
|
value?: V;
|
|
25
25
|
id: string;
|
|
26
26
|
}) => void;
|
|
27
|
-
export type BaseColumnDef<T extends Record<
|
|
27
|
+
export type BaseColumnDef<T extends Record<keyof any, V>, V> = {
|
|
28
28
|
field: keyof T;
|
|
29
29
|
headerName?: string;
|
|
30
30
|
width?: string;
|
|
@@ -41,7 +41,7 @@ export type BaseColumnDef<T extends Record<string, V>, V> = {
|
|
|
41
41
|
onCellEditStart?: CellEditStartEvent<T, V>;
|
|
42
42
|
onCellEditStop?: CellEditStopEvent<T, V>;
|
|
43
43
|
};
|
|
44
|
-
export type AutocompleteColumnDef<T extends Record<
|
|
44
|
+
export type AutocompleteColumnDef<T extends Record<keyof any, string>> = BaseColumnDef<T, string> & {
|
|
45
45
|
type: "autocomplete";
|
|
46
46
|
componentProps?: ComponentProps<typeof Autocomplete> | ((params: {
|
|
47
47
|
row: T;
|
|
@@ -49,7 +49,7 @@ export type AutocompleteColumnDef<T extends Record<string, string>> = BaseColumn
|
|
|
49
49
|
id: string;
|
|
50
50
|
}) => ComponentProps<typeof Autocomplete>);
|
|
51
51
|
};
|
|
52
|
-
export type CurrencyColumnDef<T extends Record<
|
|
52
|
+
export type CurrencyColumnDef<T extends Record<keyof any, number>> = BaseColumnDef<T, number> & {
|
|
53
53
|
type: "currency";
|
|
54
54
|
componentProps?: ComponentProps<typeof CurrencyInput> | ((params: {
|
|
55
55
|
row: T;
|
|
@@ -57,7 +57,7 @@ export type CurrencyColumnDef<T extends Record<string, number>> = BaseColumnDef<
|
|
|
57
57
|
id: string;
|
|
58
58
|
}) => ComponentProps<typeof CurrencyInput>);
|
|
59
59
|
};
|
|
60
|
-
export type DateColumnDef<T extends Record<
|
|
60
|
+
export type DateColumnDef<T extends Record<keyof any, string>> = BaseColumnDef<T, string> & {
|
|
61
61
|
type: "date";
|
|
62
62
|
componentProps?: ComponentProps<typeof DatePicker> | ((params: {
|
|
63
63
|
row: T;
|
|
@@ -65,7 +65,7 @@ export type DateColumnDef<T extends Record<string, string>> = BaseColumnDef<T, s
|
|
|
65
65
|
id: string;
|
|
66
66
|
}) => ComponentProps<typeof DatePicker>);
|
|
67
67
|
};
|
|
68
|
-
export type NumberColumnDef<T extends Record<
|
|
68
|
+
export type NumberColumnDef<T extends Record<keyof any, number>> = BaseColumnDef<T, number> & {
|
|
69
69
|
type: "number";
|
|
70
70
|
componentProps?: ComponentProps<typeof Input> | ((params: {
|
|
71
71
|
row: T;
|
|
@@ -73,7 +73,7 @@ export type NumberColumnDef<T extends Record<string, number>> = BaseColumnDef<T,
|
|
|
73
73
|
id: string;
|
|
74
74
|
}) => ComponentProps<typeof Input>);
|
|
75
75
|
};
|
|
76
|
-
export type TextColumnDef<T extends Record<
|
|
76
|
+
export type TextColumnDef<T extends Record<keyof any, string>> = BaseColumnDef<T, string> & {
|
|
77
77
|
type: "text";
|
|
78
78
|
componentProps?: ComponentProps<typeof Input> | ((params: {
|
|
79
79
|
row: T;
|
|
@@ -81,7 +81,7 @@ export type TextColumnDef<T extends Record<string, string>> = BaseColumnDef<T, s
|
|
|
81
81
|
id: string;
|
|
82
82
|
}) => ComponentProps<typeof Input>);
|
|
83
83
|
};
|
|
84
|
-
export type LongTextColumnDef<T extends Record<
|
|
84
|
+
export type LongTextColumnDef<T extends Record<keyof any, string>> = BaseColumnDef<T, string> & {
|
|
85
85
|
type: "longText";
|
|
86
86
|
componentProps?: ComponentProps<typeof Textarea> | ((params: {
|
|
87
87
|
row: T;
|
|
@@ -89,7 +89,7 @@ export type LongTextColumnDef<T extends Record<string, string>> = BaseColumnDef<
|
|
|
89
89
|
id: string;
|
|
90
90
|
}) => ComponentProps<typeof Textarea>);
|
|
91
91
|
};
|
|
92
|
-
export type SelectColumnDef<T extends Record<
|
|
92
|
+
export type SelectColumnDef<T extends Record<keyof any, string>> = BaseColumnDef<T, string> & {
|
|
93
93
|
type: "select";
|
|
94
94
|
componentProps?: ComponentProps<typeof Select<string, false>> | ((params: {
|
|
95
95
|
row: T;
|
|
@@ -97,7 +97,7 @@ export type SelectColumnDef<T extends Record<string, string>> = BaseColumnDef<T,
|
|
|
97
97
|
id: string;
|
|
98
98
|
}) => ComponentProps<typeof Select<string, false>>);
|
|
99
99
|
};
|
|
100
|
-
export type LinkColumnDef<T extends Record<
|
|
100
|
+
export type LinkColumnDef<T extends Record<keyof any, string>, C extends React.ElementType = typeof Link> = BaseColumnDef<T, string> & {
|
|
101
101
|
type: "link";
|
|
102
102
|
component?: C;
|
|
103
103
|
componentProps?: ComponentProps<C> | ((params: {
|
|
@@ -106,12 +106,12 @@ export type LinkColumnDef<T extends Record<string, string>, C extends React.Elem
|
|
|
106
106
|
id: string;
|
|
107
107
|
}) => ComponentProps<C>);
|
|
108
108
|
};
|
|
109
|
-
export type OtherColumnDef<T extends Record<
|
|
109
|
+
export type OtherColumnDef<T extends Record<keyof any, any>> = BaseColumnDef<T, any> & {
|
|
110
110
|
type?: "any";
|
|
111
111
|
componentProps?: {};
|
|
112
112
|
};
|
|
113
|
-
export type ColumnDef<T extends Record<
|
|
114
|
-
export type DataTableProps<T extends Record<
|
|
113
|
+
export type ColumnDef<T extends Record<keyof any, any>> = AutocompleteColumnDef<T> | CurrencyColumnDef<T> | DateColumnDef<T> | NumberColumnDef<T> | TextColumnDef<T> | LongTextColumnDef<T> | LinkColumnDef<T> | SelectColumnDef<T> | OtherColumnDef<T>;
|
|
114
|
+
export type DataTableProps<T extends Record<keyof any, unknown>> = {
|
|
115
115
|
rows: T[];
|
|
116
116
|
checkboxSelection?: boolean;
|
|
117
117
|
columns: ColumnDef<T>[];
|