react-admin-crud-manager 1.1.1 → 1.2.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 +1322 -207
- package/dist/index.cjs.js +20 -55
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +4092 -2529
- package/dist/index.es.js.map +1 -1
- package/dist/types/components/CrudPage.d.ts +2 -211
- package/dist/types/components/Details/Details.d.ts +11 -0
- package/dist/types/components/Details/components/CardGroup.d.ts +9 -1
- package/dist/types/components/Details/components/DetailRow.d.ts +9 -1
- package/dist/types/components/Details/components/GroupRow.d.ts +9 -1
- package/dist/types/components/Filter/FilterDrawer.d.ts +2 -2
- package/dist/types/components/Form/components/AudioPicker.d.ts +2 -1
- package/dist/types/components/Form/components/Checkbox.d.ts +2 -1
- package/dist/types/components/Form/components/ImagePicker.d.ts +2 -1
- package/dist/types/components/Form/components/Input.d.ts +1 -0
- package/dist/types/components/Form/components/MultiImagePicker.d.ts +21 -0
- package/dist/types/components/Form/components/PhoneInput.d.ts +2 -1
- package/dist/types/components/Form/components/Radio.d.ts +2 -1
- package/dist/types/components/Form/components/RenderFields.d.ts +3 -2
- package/dist/types/components/Form/components/Select.d.ts +5 -2
- package/dist/types/components/Form/components/Switch.d.ts +1 -0
- package/dist/types/components/Form/components/TextArea.d.ts +2 -0
- package/dist/types/components/Form/components/TinyEditor.d.ts +3 -1
- package/dist/types/components/Form/components/VideoPicker.d.ts +2 -1
- package/dist/types/components/Modal/Modal.d.ts +11 -10
- package/dist/types/index.d.ts +2 -5
- package/dist/types/lib/crudClasses.d.ts +94 -0
- package/dist/types/types/crudtypes.d.ts +268 -0
- package/package.json +10 -8
- package/dist/tailwind.css +0 -2364
|
@@ -0,0 +1,268 @@
|
|
|
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
|
+
customValidation?: (value: any) => boolean | string;
|
|
75
|
+
}
|
|
76
|
+
export interface ViewField {
|
|
77
|
+
key?: string;
|
|
78
|
+
label?: string;
|
|
79
|
+
type?: string;
|
|
80
|
+
imageKey?: string;
|
|
81
|
+
titleKey?: string;
|
|
82
|
+
subtitleKey?: string;
|
|
83
|
+
blockClass?: string;
|
|
84
|
+
icon?: ReactNode;
|
|
85
|
+
variant?: string;
|
|
86
|
+
chipOptions?: Option[];
|
|
87
|
+
defaultColor?: string;
|
|
88
|
+
className?: string;
|
|
89
|
+
format?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface ViewStyleConfig {
|
|
92
|
+
containerClass?: string;
|
|
93
|
+
rowClass?: string;
|
|
94
|
+
groupClass?: string;
|
|
95
|
+
cardGroupClass?: string;
|
|
96
|
+
labelClass?: string;
|
|
97
|
+
valueClass?: string;
|
|
98
|
+
iconClass?: string;
|
|
99
|
+
mediaGridClass?: string;
|
|
100
|
+
}
|
|
101
|
+
export interface ModalClassNames {
|
|
102
|
+
overlay?: string;
|
|
103
|
+
container?: string;
|
|
104
|
+
header?: string;
|
|
105
|
+
title?: string;
|
|
106
|
+
body?: string;
|
|
107
|
+
footer?: string;
|
|
108
|
+
closeButton?: string;
|
|
109
|
+
}
|
|
110
|
+
export interface SearchConfig {
|
|
111
|
+
enabled?: boolean;
|
|
112
|
+
useServerSideSearch?: boolean;
|
|
113
|
+
searchKeys?: string[];
|
|
114
|
+
}
|
|
115
|
+
export interface PaginationConfig {
|
|
116
|
+
enabled?: boolean;
|
|
117
|
+
useServerSidePagination?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface FilterConfig {
|
|
120
|
+
enabled?: boolean;
|
|
121
|
+
useServerSideFilters?: boolean;
|
|
122
|
+
}
|
|
123
|
+
export interface SortChangePayload {
|
|
124
|
+
value: string;
|
|
125
|
+
option: {
|
|
126
|
+
value: string;
|
|
127
|
+
label: string;
|
|
128
|
+
key: string;
|
|
129
|
+
order: string;
|
|
130
|
+
type?: string;
|
|
131
|
+
} | null;
|
|
132
|
+
key: string;
|
|
133
|
+
order: string;
|
|
134
|
+
type: string;
|
|
135
|
+
}
|
|
136
|
+
export interface SortConfig {
|
|
137
|
+
enabled?: boolean;
|
|
138
|
+
useServerSideSorting?: boolean;
|
|
139
|
+
options?: Array<{
|
|
140
|
+
value: string;
|
|
141
|
+
label: string;
|
|
142
|
+
key: string;
|
|
143
|
+
order: string;
|
|
144
|
+
type?: string;
|
|
145
|
+
}>;
|
|
146
|
+
fields?: string[];
|
|
147
|
+
defaultValue?: string;
|
|
148
|
+
autoGenerate?: boolean;
|
|
149
|
+
clearLabel?: string;
|
|
150
|
+
onChange?: (payload: SortChangePayload) => void;
|
|
151
|
+
}
|
|
152
|
+
export interface exportCSVConfig {
|
|
153
|
+
enabled?: boolean;
|
|
154
|
+
fileName?: string;
|
|
155
|
+
fields?: Array<{
|
|
156
|
+
label: string;
|
|
157
|
+
key: string;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
export interface SortConfig {
|
|
161
|
+
enabled?: boolean;
|
|
162
|
+
useServerSideSorting?: boolean;
|
|
163
|
+
options?: Array<{
|
|
164
|
+
value: string;
|
|
165
|
+
label: string;
|
|
166
|
+
key: string;
|
|
167
|
+
order: string;
|
|
168
|
+
type?: string;
|
|
169
|
+
}>;
|
|
170
|
+
fields?: string[];
|
|
171
|
+
defaultValue?: string;
|
|
172
|
+
autoGenerate?: boolean;
|
|
173
|
+
clearLabel?: string;
|
|
174
|
+
onChange?: (payload: SortChangePayload) => void;
|
|
175
|
+
}
|
|
176
|
+
export interface TableConfig {
|
|
177
|
+
table_head: TableHead[];
|
|
178
|
+
search?: SearchConfig;
|
|
179
|
+
pagination?: PaginationConfig;
|
|
180
|
+
filter?: FilterConfig;
|
|
181
|
+
sort?: SortConfig;
|
|
182
|
+
exportCSV?: exportCSVConfig;
|
|
183
|
+
}
|
|
184
|
+
export interface ModalConfig {
|
|
185
|
+
addModal?: {
|
|
186
|
+
title: string;
|
|
187
|
+
size?: string;
|
|
188
|
+
formClass?: string;
|
|
189
|
+
formFields?: FormField[];
|
|
190
|
+
handleSubmit: (formData: Record<string, any>) => Promise<{
|
|
191
|
+
newObject: any;
|
|
192
|
+
message?: string;
|
|
193
|
+
}>;
|
|
194
|
+
actionButtons?: ActionButton[];
|
|
195
|
+
icon?: ReactNode;
|
|
196
|
+
};
|
|
197
|
+
editModal?: {
|
|
198
|
+
title: string;
|
|
199
|
+
size?: string;
|
|
200
|
+
formClass?: string;
|
|
201
|
+
formFields?: FormField[];
|
|
202
|
+
handleSubmit: (formData: Record<string, any>, item: any) => Promise<{
|
|
203
|
+
newObject: any;
|
|
204
|
+
targetObject: any;
|
|
205
|
+
message?: string;
|
|
206
|
+
}>;
|
|
207
|
+
actionButtons?: ActionButton[];
|
|
208
|
+
icon?: ReactNode;
|
|
209
|
+
};
|
|
210
|
+
deleteModal?: {
|
|
211
|
+
title: string;
|
|
212
|
+
size?: string;
|
|
213
|
+
confirmText?: string;
|
|
214
|
+
referenceKey?: string;
|
|
215
|
+
actionButtons?: ActionButton[];
|
|
216
|
+
action: (item: any) => Promise<{
|
|
217
|
+
targetObject: any;
|
|
218
|
+
} | null>;
|
|
219
|
+
icon?: ReactNode;
|
|
220
|
+
};
|
|
221
|
+
viewModal?: {
|
|
222
|
+
title: string;
|
|
223
|
+
size?: string;
|
|
224
|
+
component?: React.ComponentType<{
|
|
225
|
+
data: any;
|
|
226
|
+
}>;
|
|
227
|
+
fields?: ViewField[];
|
|
228
|
+
variant?: "default" | "card" | "split";
|
|
229
|
+
styles?: ViewStyleConfig;
|
|
230
|
+
modalClassNames?: ModalClassNames;
|
|
231
|
+
footer?: {
|
|
232
|
+
cancelButton?: boolean;
|
|
233
|
+
cancelText?: string;
|
|
234
|
+
};
|
|
235
|
+
icon?: ReactNode;
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
export interface FilterConfigProps {
|
|
239
|
+
fields?: FormField[];
|
|
240
|
+
}
|
|
241
|
+
export interface Config {
|
|
242
|
+
title: string;
|
|
243
|
+
description?: string;
|
|
244
|
+
buttonText?: string;
|
|
245
|
+
fetchData: (params: {
|
|
246
|
+
search: string;
|
|
247
|
+
rows_per_page: number;
|
|
248
|
+
current_page: number;
|
|
249
|
+
sort_by: string;
|
|
250
|
+
sort_order: string;
|
|
251
|
+
[key: string]: any;
|
|
252
|
+
}) => Promise<{
|
|
253
|
+
data: any[];
|
|
254
|
+
pagination: any;
|
|
255
|
+
}>;
|
|
256
|
+
fetchRowDetails?: (item: any) => Promise<any>;
|
|
257
|
+
isStaticData?: boolean;
|
|
258
|
+
tableConfig: TableConfig;
|
|
259
|
+
modalConfig?: ModalConfig;
|
|
260
|
+
filterConfig?: FilterConfigProps;
|
|
261
|
+
}
|
|
262
|
+
export interface ServerSidePaginationData {
|
|
263
|
+
search: string;
|
|
264
|
+
rows_per_page: number;
|
|
265
|
+
current_page: number;
|
|
266
|
+
sort_by: string;
|
|
267
|
+
sort_order: string;
|
|
268
|
+
}
|
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-admin-crud-manager",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A reusable React CRUD admin template with modular components.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
7
|
+
"types": "./dist/types/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"import": "./dist/index.es.js",
|
|
11
11
|
"require": "./dist/index.cjs.js",
|
|
12
12
|
"types": "./dist/types/index.d.ts"
|
|
13
|
-
}
|
|
14
|
-
"./dist/tailwind.css": "./dist/tailwind.css"
|
|
13
|
+
}
|
|
15
14
|
},
|
|
16
15
|
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"**/*.css"
|
|
19
20
|
],
|
|
20
21
|
"keywords": [
|
|
21
22
|
"react",
|
|
@@ -36,9 +37,9 @@
|
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
39
|
"dev": "vite",
|
|
39
|
-
"build": "vite build &&
|
|
40
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
40
41
|
"build:types": "tsc --emitDeclarationOnly",
|
|
41
|
-
"build:all": "npm run build
|
|
42
|
+
"build:all": "npm run build",
|
|
42
43
|
"preview": "vite preview"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
"@types/react-dom": "^19.2.3",
|
|
60
61
|
"@vitejs/plugin-react": "^4.2.1",
|
|
61
62
|
"autoprefixer": "10.4.15",
|
|
63
|
+
"postcss-cli": "^11.0.1",
|
|
62
64
|
"tailwindcss": "3.3.3",
|
|
63
65
|
"typescript": "^5.9.3",
|
|
64
66
|
"vite": "^5.0.8"
|