react-admin-crud-manager 1.1.1 → 1.1.2
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.
|
@@ -1,213 +1,4 @@
|
|
|
1
|
-
import React
|
|
2
|
-
|
|
3
|
-
config: Config;
|
|
4
|
-
}
|
|
5
|
-
interface Option {
|
|
6
|
-
value: string | number | boolean;
|
|
7
|
-
label: string;
|
|
8
|
-
color?: string;
|
|
9
|
-
}
|
|
10
|
-
interface ActionButton {
|
|
11
|
-
type: string;
|
|
12
|
-
label: string;
|
|
13
|
-
color?: string;
|
|
14
|
-
variant?: string;
|
|
15
|
-
onClick?: (event?: React.MouseEvent, item?: any) => void | Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
interface MenuAction {
|
|
18
|
-
title: string;
|
|
19
|
-
type: string;
|
|
20
|
-
variant?: string;
|
|
21
|
-
icon?: ReactNode;
|
|
22
|
-
}
|
|
23
|
-
interface TableHead {
|
|
24
|
-
key: string;
|
|
25
|
-
title?: string;
|
|
26
|
-
type?: string;
|
|
27
|
-
imageKey?: string;
|
|
28
|
-
titleKey?: string;
|
|
29
|
-
subtitleKey?: string;
|
|
30
|
-
onClickDetails?: boolean;
|
|
31
|
-
variant?: string;
|
|
32
|
-
chipOptions?: Option[];
|
|
33
|
-
defaultColor?: string;
|
|
34
|
-
className?: string;
|
|
35
|
-
format?: string;
|
|
36
|
-
menuList?: MenuAction[];
|
|
37
|
-
}
|
|
38
|
-
interface FormField {
|
|
39
|
-
key: string;
|
|
40
|
-
label?: string;
|
|
41
|
-
type?: string;
|
|
42
|
-
options?: any[];
|
|
43
|
-
placeholder?: string;
|
|
44
|
-
rows?: number;
|
|
45
|
-
inputClass?: string;
|
|
46
|
-
search?: boolean;
|
|
47
|
-
accept?: string;
|
|
48
|
-
text?: string;
|
|
49
|
-
required?: boolean;
|
|
50
|
-
minLength?: number;
|
|
51
|
-
dragDrop?: boolean;
|
|
52
|
-
parentClass?: string;
|
|
53
|
-
countriesList?: boolean;
|
|
54
|
-
defaultCountry?: string;
|
|
55
|
-
multiple?: boolean;
|
|
56
|
-
dropdownMaxHeight?: number;
|
|
57
|
-
editorKey?: string;
|
|
58
|
-
fontFamily?: string;
|
|
59
|
-
disabled?: boolean;
|
|
60
|
-
negativeNumberAllow?: boolean;
|
|
61
|
-
defaultValue?: any;
|
|
62
|
-
renderCondition?: (formData: Record<string, any>) => boolean;
|
|
63
|
-
pattern?: string;
|
|
64
|
-
renderType?: string;
|
|
65
|
-
cropImage?: boolean;
|
|
66
|
-
aspectRatio?: number;
|
|
67
|
-
dependencyKey?: string;
|
|
68
|
-
mask?: string;
|
|
69
|
-
maskApplyOnValue?: boolean;
|
|
70
|
-
maxSize?: number;
|
|
71
|
-
[key: string]: any;
|
|
72
|
-
}
|
|
73
|
-
interface ViewField {
|
|
74
|
-
key?: string;
|
|
75
|
-
label?: string;
|
|
76
|
-
type?: string;
|
|
77
|
-
imageKey?: string;
|
|
78
|
-
titleKey?: string;
|
|
79
|
-
subtitleKey?: string;
|
|
80
|
-
blockClass?: string;
|
|
81
|
-
icon?: ReactNode;
|
|
82
|
-
variant?: string;
|
|
83
|
-
chipOptions?: Option[];
|
|
84
|
-
defaultColor?: string;
|
|
85
|
-
className?: string;
|
|
86
|
-
format?: string;
|
|
87
|
-
}
|
|
88
|
-
interface SearchConfig {
|
|
89
|
-
enabled?: boolean;
|
|
90
|
-
useServerSideSearch?: boolean;
|
|
91
|
-
searchKeys?: string[];
|
|
92
|
-
}
|
|
93
|
-
interface PaginationConfig {
|
|
94
|
-
enabled?: boolean;
|
|
95
|
-
useServerSidePagination?: boolean;
|
|
96
|
-
}
|
|
97
|
-
interface FilterConfig {
|
|
98
|
-
enabled?: boolean;
|
|
99
|
-
useServerSideFilters?: boolean;
|
|
100
|
-
}
|
|
101
|
-
interface SortChangePayload {
|
|
102
|
-
value: string;
|
|
103
|
-
option: {
|
|
104
|
-
value: string;
|
|
105
|
-
label: string;
|
|
106
|
-
key: string;
|
|
107
|
-
order: string;
|
|
108
|
-
type?: string;
|
|
109
|
-
} | null;
|
|
110
|
-
key: string;
|
|
111
|
-
order: string;
|
|
112
|
-
type: string;
|
|
113
|
-
}
|
|
114
|
-
interface SortConfig {
|
|
115
|
-
enabled?: boolean;
|
|
116
|
-
useServerSideSorting?: boolean;
|
|
117
|
-
options?: Array<{
|
|
118
|
-
value: string;
|
|
119
|
-
label: string;
|
|
120
|
-
key: string;
|
|
121
|
-
order: string;
|
|
122
|
-
type?: string;
|
|
123
|
-
}>;
|
|
124
|
-
fields?: string[];
|
|
125
|
-
defaultValue?: string;
|
|
126
|
-
autoGenerate?: boolean;
|
|
127
|
-
clearLabel?: string;
|
|
128
|
-
onChange?: (payload: SortChangePayload) => void;
|
|
129
|
-
}
|
|
130
|
-
interface TableConfig {
|
|
131
|
-
table_head: TableHead[];
|
|
132
|
-
search?: SearchConfig;
|
|
133
|
-
pagination?: PaginationConfig;
|
|
134
|
-
filter?: FilterConfig;
|
|
135
|
-
sort?: SortConfig;
|
|
136
|
-
}
|
|
137
|
-
interface ModalConfig {
|
|
138
|
-
addModal?: {
|
|
139
|
-
title: string;
|
|
140
|
-
size?: string;
|
|
141
|
-
formClass?: string;
|
|
142
|
-
formFields?: FormField[];
|
|
143
|
-
handleSubmit: (formData: Record<string, any>) => Promise<{
|
|
144
|
-
newObject: any;
|
|
145
|
-
message?: string;
|
|
146
|
-
}>;
|
|
147
|
-
actionButtons?: ActionButton[];
|
|
148
|
-
icon?: ReactNode;
|
|
149
|
-
};
|
|
150
|
-
editModal?: {
|
|
151
|
-
title: string;
|
|
152
|
-
size?: string;
|
|
153
|
-
formClass?: string;
|
|
154
|
-
formFields?: FormField[];
|
|
155
|
-
handleSubmit: (formData: Record<string, any>, item: any) => Promise<{
|
|
156
|
-
newObject: any;
|
|
157
|
-
targetObject: any;
|
|
158
|
-
message?: string;
|
|
159
|
-
}>;
|
|
160
|
-
actionButtons?: ActionButton[];
|
|
161
|
-
icon?: ReactNode;
|
|
162
|
-
};
|
|
163
|
-
deleteModal?: {
|
|
164
|
-
title: string;
|
|
165
|
-
size?: string;
|
|
166
|
-
confirmText?: string;
|
|
167
|
-
referenceKey?: string;
|
|
168
|
-
actionButtons?: ActionButton[];
|
|
169
|
-
action: (item: any) => Promise<{
|
|
170
|
-
targetObject: any;
|
|
171
|
-
} | null>;
|
|
172
|
-
icon?: ReactNode;
|
|
173
|
-
};
|
|
174
|
-
viewModal?: {
|
|
175
|
-
title: string;
|
|
176
|
-
size?: string;
|
|
177
|
-
component?: React.ComponentType<{
|
|
178
|
-
data: any;
|
|
179
|
-
}>;
|
|
180
|
-
fields?: ViewField[];
|
|
181
|
-
footer?: {
|
|
182
|
-
cancelButton?: boolean;
|
|
183
|
-
cancelText?: string;
|
|
184
|
-
};
|
|
185
|
-
icon?: ReactNode;
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
interface FilterConfigProps {
|
|
189
|
-
fields?: FormField[];
|
|
190
|
-
}
|
|
191
|
-
interface Config {
|
|
192
|
-
title: string;
|
|
193
|
-
description?: string;
|
|
194
|
-
buttonText?: string;
|
|
195
|
-
fetchData: (params: {
|
|
196
|
-
search: string;
|
|
197
|
-
rows_per_page: number;
|
|
198
|
-
current_page: number;
|
|
199
|
-
sort_by: string;
|
|
200
|
-
sort_order: string;
|
|
201
|
-
[key: string]: any;
|
|
202
|
-
}) => Promise<{
|
|
203
|
-
data: any[];
|
|
204
|
-
pagination: any;
|
|
205
|
-
}>;
|
|
206
|
-
fetchRowDetails?: (item: any) => Promise<any>;
|
|
207
|
-
isStaticData?: boolean;
|
|
208
|
-
tableConfig: TableConfig;
|
|
209
|
-
modalConfig?: ModalConfig;
|
|
210
|
-
filterConfig?: FilterConfigProps;
|
|
211
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { CrudPageProps } from "../types/crudtypes";
|
|
212
3
|
declare const CrudPage: React.FC<CrudPageProps>;
|
|
213
4
|
export default CrudPage;
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
type?: string;
|
|
4
|
-
variant?: string;
|
|
5
|
-
color?: string;
|
|
6
|
-
className?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
label?: string;
|
|
9
|
-
onClick?: (e?: React.MouseEvent, selectedItem?: any) => Promise<any> | any;
|
|
10
|
-
}
|
|
2
|
+
import { ActionButton } from "../../types/crudtypes";
|
|
11
3
|
interface ModalProps {
|
|
12
4
|
isOpen: boolean;
|
|
13
5
|
onClose: (resp?: any) => void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
export default function Crud({ config }: CrudProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export {};
|
|
1
|
+
import { type CrudPageProps } from "./types/crudtypes";
|
|
2
|
+
export default function Crud({ config }: CrudPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface CrudPageProps {
|
|
3
|
+
config: Config;
|
|
4
|
+
}
|
|
5
|
+
export interface Option {
|
|
6
|
+
value: string | number | boolean;
|
|
7
|
+
label: string;
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ActionButton {
|
|
11
|
+
type: string;
|
|
12
|
+
label: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
variant?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
onClick?: (event: React.MouseEvent, item: any) => void | Promise<any>;
|
|
18
|
+
}
|
|
19
|
+
export interface MenuAction {
|
|
20
|
+
title: string;
|
|
21
|
+
type: string;
|
|
22
|
+
variant?: string;
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export interface TableHead {
|
|
26
|
+
key: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
type?: string;
|
|
29
|
+
imageKey?: string;
|
|
30
|
+
titleKey?: string;
|
|
31
|
+
subtitleKey?: string;
|
|
32
|
+
onClickDetails?: boolean;
|
|
33
|
+
variant?: string;
|
|
34
|
+
chipOptions?: Option[];
|
|
35
|
+
defaultColor?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
format?: string;
|
|
38
|
+
menuList?: MenuAction[];
|
|
39
|
+
}
|
|
40
|
+
export interface FormField {
|
|
41
|
+
key: string;
|
|
42
|
+
label?: string;
|
|
43
|
+
type?: string;
|
|
44
|
+
options?: any[];
|
|
45
|
+
placeholder?: string;
|
|
46
|
+
rows?: number;
|
|
47
|
+
inputClass?: string;
|
|
48
|
+
search?: boolean;
|
|
49
|
+
accept?: string;
|
|
50
|
+
text?: string;
|
|
51
|
+
required?: boolean;
|
|
52
|
+
minLength?: number;
|
|
53
|
+
dragDrop?: boolean;
|
|
54
|
+
parentClass?: string;
|
|
55
|
+
countriesList?: boolean;
|
|
56
|
+
defaultCountry?: string;
|
|
57
|
+
multiple?: boolean;
|
|
58
|
+
dropdownMaxHeight?: number;
|
|
59
|
+
editorKey?: string;
|
|
60
|
+
fontFamily?: string;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
negativeNumberAllow?: boolean;
|
|
63
|
+
defaultValue?: any;
|
|
64
|
+
renderCondition?: (formData: Record<string, any>) => boolean;
|
|
65
|
+
pattern?: string;
|
|
66
|
+
renderType?: string;
|
|
67
|
+
cropImage?: boolean;
|
|
68
|
+
aspectRatio?: number;
|
|
69
|
+
dependencyKey?: string;
|
|
70
|
+
mask?: string;
|
|
71
|
+
maskApplyOnValue?: boolean;
|
|
72
|
+
maxSize?: number;
|
|
73
|
+
[key: string]: any;
|
|
74
|
+
}
|
|
75
|
+
export interface ViewField {
|
|
76
|
+
key?: string;
|
|
77
|
+
label?: string;
|
|
78
|
+
type?: string;
|
|
79
|
+
imageKey?: string;
|
|
80
|
+
titleKey?: string;
|
|
81
|
+
subtitleKey?: string;
|
|
82
|
+
blockClass?: string;
|
|
83
|
+
icon?: ReactNode;
|
|
84
|
+
variant?: string;
|
|
85
|
+
chipOptions?: Option[];
|
|
86
|
+
defaultColor?: string;
|
|
87
|
+
className?: string;
|
|
88
|
+
format?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface SearchConfig {
|
|
91
|
+
enabled?: boolean;
|
|
92
|
+
useServerSideSearch?: boolean;
|
|
93
|
+
searchKeys?: string[];
|
|
94
|
+
}
|
|
95
|
+
export interface PaginationConfig {
|
|
96
|
+
enabled?: boolean;
|
|
97
|
+
useServerSidePagination?: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface FilterConfig {
|
|
100
|
+
enabled?: boolean;
|
|
101
|
+
useServerSideFilters?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export interface SortChangePayload {
|
|
104
|
+
value: string;
|
|
105
|
+
option: {
|
|
106
|
+
value: string;
|
|
107
|
+
label: string;
|
|
108
|
+
key: string;
|
|
109
|
+
order: string;
|
|
110
|
+
type?: string;
|
|
111
|
+
} | null;
|
|
112
|
+
key: string;
|
|
113
|
+
order: string;
|
|
114
|
+
type: string;
|
|
115
|
+
}
|
|
116
|
+
export interface SortConfig {
|
|
117
|
+
enabled?: boolean;
|
|
118
|
+
useServerSideSorting?: boolean;
|
|
119
|
+
options?: Array<{
|
|
120
|
+
value: string;
|
|
121
|
+
label: string;
|
|
122
|
+
key: string;
|
|
123
|
+
order: string;
|
|
124
|
+
type?: string;
|
|
125
|
+
}>;
|
|
126
|
+
fields?: string[];
|
|
127
|
+
defaultValue?: string;
|
|
128
|
+
autoGenerate?: boolean;
|
|
129
|
+
clearLabel?: string;
|
|
130
|
+
onChange?: (payload: SortChangePayload) => void;
|
|
131
|
+
}
|
|
132
|
+
export interface TableConfig {
|
|
133
|
+
table_head: TableHead[];
|
|
134
|
+
search?: SearchConfig;
|
|
135
|
+
pagination?: PaginationConfig;
|
|
136
|
+
filter?: FilterConfig;
|
|
137
|
+
sort?: SortConfig;
|
|
138
|
+
}
|
|
139
|
+
export interface ModalConfig {
|
|
140
|
+
addModal?: {
|
|
141
|
+
title: string;
|
|
142
|
+
size?: string;
|
|
143
|
+
formClass?: string;
|
|
144
|
+
formFields?: FormField[];
|
|
145
|
+
handleSubmit: (formData: Record<string, any>) => Promise<{
|
|
146
|
+
newObject: any;
|
|
147
|
+
message?: string;
|
|
148
|
+
}>;
|
|
149
|
+
actionButtons?: ActionButton[];
|
|
150
|
+
icon?: ReactNode;
|
|
151
|
+
};
|
|
152
|
+
editModal?: {
|
|
153
|
+
title: string;
|
|
154
|
+
size?: string;
|
|
155
|
+
formClass?: string;
|
|
156
|
+
formFields?: FormField[];
|
|
157
|
+
handleSubmit: (formData: Record<string, any>, item: any) => Promise<{
|
|
158
|
+
newObject: any;
|
|
159
|
+
targetObject: any;
|
|
160
|
+
message?: string;
|
|
161
|
+
}>;
|
|
162
|
+
actionButtons?: ActionButton[];
|
|
163
|
+
icon?: ReactNode;
|
|
164
|
+
};
|
|
165
|
+
deleteModal?: {
|
|
166
|
+
title: string;
|
|
167
|
+
size?: string;
|
|
168
|
+
confirmText?: string;
|
|
169
|
+
referenceKey?: string;
|
|
170
|
+
actionButtons?: ActionButton[];
|
|
171
|
+
icon?: ReactNode;
|
|
172
|
+
};
|
|
173
|
+
viewModal?: {
|
|
174
|
+
title: string;
|
|
175
|
+
size?: string;
|
|
176
|
+
component?: React.ComponentType<{
|
|
177
|
+
data: any;
|
|
178
|
+
}>;
|
|
179
|
+
fields?: ViewField[];
|
|
180
|
+
footer?: {
|
|
181
|
+
cancelButton?: boolean;
|
|
182
|
+
cancelText?: string;
|
|
183
|
+
};
|
|
184
|
+
icon?: ReactNode;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export interface FilterConfigProps {
|
|
188
|
+
fields?: FormField[];
|
|
189
|
+
}
|
|
190
|
+
export interface Config {
|
|
191
|
+
title: string;
|
|
192
|
+
description?: string;
|
|
193
|
+
buttonText?: string;
|
|
194
|
+
fetchData: (params: {
|
|
195
|
+
search: string;
|
|
196
|
+
rows_per_page: number;
|
|
197
|
+
current_page: number;
|
|
198
|
+
sort_by: string;
|
|
199
|
+
sort_order: string;
|
|
200
|
+
[key: string]: any;
|
|
201
|
+
}) => Promise<{
|
|
202
|
+
data: any[];
|
|
203
|
+
pagination: any;
|
|
204
|
+
}>;
|
|
205
|
+
fetchRowDetails?: (item: any) => Promise<any>;
|
|
206
|
+
isStaticData?: boolean;
|
|
207
|
+
tableConfig: TableConfig;
|
|
208
|
+
modalConfig?: ModalConfig;
|
|
209
|
+
filterConfig?: FilterConfigProps;
|
|
210
|
+
}
|
|
211
|
+
export interface ServerSidePaginationData {
|
|
212
|
+
search: string;
|
|
213
|
+
rows_per_page: number;
|
|
214
|
+
current_page: number;
|
|
215
|
+
sort_by: string;
|
|
216
|
+
sort_order: string;
|
|
217
|
+
}
|