react-admin-crud-manager 1.0.28 → 1.1.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.
Files changed (41) hide show
  1. package/README.md +36 -5
  2. package/dist/index.cjs.js +126 -33
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.es.js +2965 -1626
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/tailwind.css +701 -396
  7. package/dist/types/OptionalSnackbarProvider.d.ts +6 -0
  8. package/dist/types/components/Button/Button.d.ts +11 -0
  9. package/dist/types/components/Chip/Chip.d.ts +8 -0
  10. package/dist/types/components/CrudPage.d.ts +213 -0
  11. package/dist/types/components/Details/Details.d.ts +12 -0
  12. package/dist/types/components/Details/components/CardGroup.d.ts +6 -0
  13. package/dist/types/components/Details/components/DetailRow.d.ts +6 -0
  14. package/dist/types/components/Details/components/GroupRow.d.ts +6 -0
  15. package/dist/types/components/Filter/FilterDrawer.d.ts +17 -0
  16. package/dist/types/components/Form/Form.d.ts +21 -0
  17. package/dist/types/components/Form/components/AudioPicker.d.ts +18 -0
  18. package/dist/types/components/Form/components/Checkbox.d.ts +19 -0
  19. package/dist/types/components/Form/components/ImageCropperModal.d.ts +12 -0
  20. package/dist/types/components/Form/components/ImagePicker.d.ts +19 -0
  21. package/dist/types/components/Form/components/Input.d.ts +18 -0
  22. package/dist/types/components/Form/components/InputLabel.d.ts +8 -0
  23. package/dist/types/components/Form/components/PhoneInput.d.ts +15 -0
  24. package/dist/types/components/Form/components/Radio.d.ts +17 -0
  25. package/dist/types/components/Form/components/RenderFields.d.ts +42 -0
  26. package/dist/types/components/Form/components/Select.d.ts +25 -0
  27. package/dist/types/components/Form/components/Switch.d.ts +13 -0
  28. package/dist/types/components/Form/components/TextArea.d.ts +9 -0
  29. package/dist/types/components/Form/components/TinyEditor.d.ts +20 -0
  30. package/dist/types/components/Form/components/VideoPicker.d.ts +18 -0
  31. package/dist/types/components/Loader/Spinner.d.ts +7 -0
  32. package/dist/types/components/Modal/Modal.d.ts +28 -0
  33. package/dist/types/components/Table/Table.d.ts +10 -0
  34. package/dist/types/components/Table/components/ImagePreview.d.ts +8 -0
  35. package/dist/types/components/Table/components/SortDropdown.d.ts +13 -0
  36. package/dist/types/components/Table/components/TableSkeleton.d.ts +6 -0
  37. package/dist/types/components/Table/utils/sortUtils.d.ts +58 -0
  38. package/dist/types/data/countries.d.ts +6 -0
  39. package/dist/types/index.d.ts +5 -0
  40. package/dist/types/lib/utils.d.ts +2 -0
  41. package/package.json +9 -3
package/README.md CHANGED
@@ -5,8 +5,11 @@ A reusable React CRUD admin template with modular components for rapid admin das
5
5
  ## Features
6
6
  - Plug-and-play CRUD page component
7
7
  - Modular, customizable UI components (Table, Modal, Form, etc.)
8
- - Built with React 18+
8
+ - Built with React 18+ and TypeScript
9
9
  - Tailwind CSS for styling
10
+ - Server-side and client-side data handling
11
+ - Sorting, filtering, searching, and pagination support
12
+ - Rich form fields including text, select, image upload, rich text editor, and more
10
13
 
11
14
 
12
15
  ## Installation
@@ -60,7 +63,8 @@ Below is a complete reference of the public props accepted by this package (type
60
63
  | `title` | string | Yes | Title of the CRUD page |
61
64
  | `description` | string | No | Optional description text |
62
65
  | `buttonText` | string | No | Custom text for action buttons |
63
- | `fetchData` | function | Yes | Async function to fetch data. Signature: `async ({ search, rows_per_page, current_page, ...filters }) => Promise<{ data: Array, pagination?: { current_page: number, rows_per_page: number, total_pages: number, total_records: number } }>`. Component expects `resp.data` (array) and optional `resp.pagination` for server-side pagination. |
66
+ | `fetchData` | function | Yes | Async function to fetch data. Signature: `async ({ search, rows_per_page, current_page, sort_by, sort_order, ...filters }) => Promise<{ data: Array, pagination?: { current_page: number, rows_per_page: number, total_pages: number, total_records: number } }>`. Component expects `resp.data` (array) and optional `resp.pagination` for server-side pagination. |
67
+ | `fetchRowDetails` | function | No | Async function to fetch additional details for a row. Signature: `async (item) => Promise<any>`. Used for view modal or details. |
64
68
  | `isStaticData` | boolean | No | Default: `false`. If true, add/edit/delete apply client-side instead of re-fetching |
65
69
  | `tableConfig` | object | Yes | Table configuration — [see tableConfig](#tableconfig-configuration) |
66
70
  | `modalConfig` | object | No | Modal definitions — [see modalConfig](#modalconfig-definitions) |
@@ -80,6 +84,7 @@ Below is a complete reference of the public props accepted by this package (type
80
84
  | `search` | object | No | `{ enabled?: boolean, placeholder?: string, useServerSideSearch?: boolean, searchKeys?: string[] }` |
81
85
  | `filter` | object | No | `{ enabled?: boolean, useServerSideFilters?: boolean }` |
82
86
  | `pagination` | object | No | `{ enabled?: boolean, rows_per_page?: number, useServerSidePagination?: boolean, current_page?: number, total_pages?: number, total_records?: number }` |
87
+ | `sort` | object | No | `{ enabled?: boolean, useServerSideSorting?: boolean, options?: Array<{ value: string, label: string, key: string, order: string, type?: string }>, fields?: string[], defaultValue?: string, autoGenerate?: boolean, clearLabel?: string, onChange?: (payload) => void }` |
83
88
  | `emptyMessage` | string | No | Message shown when table has no rows |
84
89
  | `onMenuAction` | function | No | Callback: `(actionType: string, item: object)` |
85
90
  | `setServerSidePaginationData` | function | No | Used to update server-side pagination/search state |
@@ -153,7 +158,7 @@ Used by `modalConfig.*.formFields` and `filterConfig.fields`. Form fields follow
153
158
  |-----|------|----------|-------------|
154
159
  | `key` | string | Yes | Property name for form data |
155
160
  | `label` | string | No | Human-readable label |
156
- | `type` | string | Yes | Field type: `text`, `number`, `email`, `password`, `select`, `checkbox`, `switch`, `phone`, `textarea`, `image`, `tinyEditor`, `audio` |
161
+ | `type` | string | Yes | Field type: `text`, `number`, `email`, `password`, `select`, `checkbox`, `radio`, `switch`, `phone`, `textarea`, `image`, `video`, `audio`, `tinyEditor`, `group`, `cardGroup` |
157
162
  | `required` | boolean | No | Field is required for form submission |
158
163
  | `minLength` | number | No | Minimum character length |
159
164
  | `parentClass` | string | No | Tailwind grid class (e.g., `col-span-6`) |
@@ -216,6 +221,32 @@ Used by `modalConfig.*.formFields` and `filterConfig.fields`. Form fields follow
216
221
  | `height` | number | Editor height in pixels |
217
222
  | `imageUploadHandler` | function | `(blobInfo) => Promise<string>`. Returns image URL |
218
223
 
224
+ ##### Radio Field
225
+
226
+ | Key | Type | Description |
227
+ |-----|------|-------------|
228
+ | `options` | array | `{ value, label }[]` |
229
+
230
+ ##### Video Field
231
+
232
+ | Key | Type | Description |
233
+ |-----|------|-------------|
234
+ | `accept` | string | MIME type filter (default: `video/*`) |
235
+ | `dragDrop` | boolean | Enable drag-and-drop upload |
236
+ | `maxSize` | number | Maximum file size in bytes |
237
+
238
+ ##### Group Field
239
+
240
+ | Key | Type | Description |
241
+ |-----|------|-------------|
242
+ | `renderType` | string | Rendering type for group fields |
243
+
244
+ ##### CardGroup Field
245
+
246
+ | Key | Type | Description |
247
+ |-----|------|-------------|
248
+ | `renderType` | string | Rendering type for card group fields |
249
+
219
250
  #### Return Values / onSubmit Handler
220
251
 
221
252
  `onSubmit(formData)` receives an object keyed by `field.key` values.
@@ -296,8 +327,8 @@ const config = {
296
327
  Server-side listing (fetchData must return { data, pagination }):
297
328
 
298
329
  ```js
299
- const fetchData = async ({ search, rows_per_page, current_page }) => {
300
- const resp = await api.get('/users', { params: { q: search, limit: rows_per_page, page: current_page } });
330
+ const fetchData = async ({ search, rows_per_page, current_page, sort_by, sort_order }) => {
331
+ const resp = await api.get('/users', { params: { q: search, limit: rows_per_page, page: current_page, sort_by, sort_order } });
301
332
  return { data: resp.items, pagination: { current_page: resp.page, rows_per_page: resp.limit, total_pages: resp.totalPages, total_records: resp.total } };
302
333
  };
303
334
  ```