react-admin-crud-manager 1.1.0 → 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.
Files changed (40) hide show
  1. package/dist/index.cjs.js +5 -5
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +31 -31
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/types/OptionalSnackbarProvider.d.ts +6 -0
  6. package/dist/types/components/Button/Button.d.ts +11 -0
  7. package/dist/types/components/Chip/Chip.d.ts +8 -0
  8. package/dist/types/components/CrudPage.d.ts +4 -0
  9. package/dist/types/components/Details/Details.d.ts +12 -0
  10. package/dist/types/components/Details/components/CardGroup.d.ts +6 -0
  11. package/dist/types/components/Details/components/DetailRow.d.ts +6 -0
  12. package/dist/types/components/Details/components/GroupRow.d.ts +6 -0
  13. package/dist/types/components/Filter/FilterDrawer.d.ts +17 -0
  14. package/dist/types/components/Form/Form.d.ts +21 -0
  15. package/dist/types/components/Form/components/AudioPicker.d.ts +18 -0
  16. package/dist/types/components/Form/components/Checkbox.d.ts +19 -0
  17. package/dist/types/components/Form/components/ImageCropperModal.d.ts +12 -0
  18. package/dist/types/components/Form/components/ImagePicker.d.ts +19 -0
  19. package/dist/types/components/Form/components/Input.d.ts +18 -0
  20. package/dist/types/components/Form/components/InputLabel.d.ts +8 -0
  21. package/dist/types/components/Form/components/PhoneInput.d.ts +15 -0
  22. package/dist/types/components/Form/components/Radio.d.ts +17 -0
  23. package/dist/types/components/Form/components/RenderFields.d.ts +42 -0
  24. package/dist/types/components/Form/components/Select.d.ts +25 -0
  25. package/dist/types/components/Form/components/Switch.d.ts +13 -0
  26. package/dist/types/components/Form/components/TextArea.d.ts +9 -0
  27. package/dist/types/components/Form/components/TinyEditor.d.ts +20 -0
  28. package/dist/types/components/Form/components/VideoPicker.d.ts +18 -0
  29. package/dist/types/components/Loader/Spinner.d.ts +7 -0
  30. package/dist/types/components/Modal/Modal.d.ts +20 -0
  31. package/dist/types/components/Table/Table.d.ts +10 -0
  32. package/dist/types/components/Table/components/ImagePreview.d.ts +8 -0
  33. package/dist/types/components/Table/components/SortDropdown.d.ts +13 -0
  34. package/dist/types/components/Table/components/TableSkeleton.d.ts +6 -0
  35. package/dist/types/components/Table/utils/sortUtils.d.ts +58 -0
  36. package/dist/types/data/countries.d.ts +6 -0
  37. package/dist/types/index.d.ts +2 -0
  38. package/dist/types/lib/utils.d.ts +2 -0
  39. package/dist/types/types/crudtypes.d.ts +217 -0
  40. package/package.json +6 -2
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface OptionalSnackbarProviderProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export default function OptionalSnackbarProvider({ children }: OptionalSnackbarProviderProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
3
+ className?: string;
4
+ variant?: string;
5
+ color?: string;
6
+ size?: string;
7
+ fullWidth?: boolean;
8
+ children: React.ReactNode;
9
+ }
10
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ export default Button;
@@ -0,0 +1,8 @@
1
+ interface ChipProps {
2
+ label: string;
3
+ variant?: string;
4
+ color?: string;
5
+ className?: string;
6
+ }
7
+ declare const Chip: ({ label, variant, color, className, }: ChipProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default Chip;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { CrudPageProps } from "../types/crudtypes";
3
+ declare const CrudPage: React.FC<CrudPageProps>;
4
+ export default CrudPage;
@@ -0,0 +1,12 @@
1
+ interface DetailsProps {
2
+ data: Record<string, any> | null;
3
+ config: {
4
+ fields?: Array<Record<string, any>>;
5
+ containerClass?: string;
6
+ };
7
+ fetchRowDetails?: (payload: Record<string, any>) => Promise<{
8
+ data: Record<string, any>;
9
+ }>;
10
+ }
11
+ export default function Details({ data, config, fetchRowDetails, }: DetailsProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,6 @@
1
+ interface CardGroupProps {
2
+ col: Record<string, any>;
3
+ data: Record<string, any>;
4
+ }
5
+ declare const CardGroup: ({ col, data }: CardGroupProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default CardGroup;
@@ -0,0 +1,6 @@
1
+ interface DetailRowProps {
2
+ col: Record<string, any>;
3
+ data: Record<string, any>;
4
+ }
5
+ declare const DetailRow: ({ col, data }: DetailRowProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default DetailRow;
@@ -0,0 +1,6 @@
1
+ interface GroupRowProps {
2
+ col: Record<string, any>;
3
+ data: Record<string, any>;
4
+ }
5
+ declare const GroupRow: ({ col, data }: GroupRowProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default GroupRow;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { type FieldConfig } from "../Form/components/RenderFields";
3
+ interface FilterConfig {
4
+ component: React.ComponentType<{
5
+ filters: Record<string, any>;
6
+ onFilterChange: (key: string, value: any) => void;
7
+ }>;
8
+ fields: FieldConfig[];
9
+ }
10
+ interface FilterDrawerProps {
11
+ isOpen: boolean;
12
+ onClose: () => void;
13
+ config: FilterConfig;
14
+ onApply: (filters: Record<string, any>) => void;
15
+ }
16
+ declare const FilterDrawer: ({ isOpen, onClose, config, onApply, }: FilterDrawerProps) => import("react/jsx-runtime").JSX.Element;
17
+ export default FilterDrawer;
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ interface FormField {
3
+ key: string;
4
+ [key: string]: any;
5
+ }
6
+ interface FormConfig {
7
+ formClass?: string;
8
+ formFields?: FormField[];
9
+ }
10
+ interface FormProps {
11
+ config: FormConfig;
12
+ onSubmit: (data: Record<string, any>) => void;
13
+ initialData: Record<string, any> | null;
14
+ fetchRowDetails?: (item: Record<string, any>) => Promise<{
15
+ data: Record<string, any>;
16
+ }>;
17
+ type: "add" | "edit" | string;
18
+ loading?: boolean;
19
+ }
20
+ declare const Form: React.FC<FormProps>;
21
+ export default Form;
@@ -0,0 +1,18 @@
1
+ type MediaValue = File | {
2
+ file?: File;
3
+ preview?: string;
4
+ } | string | null;
5
+ interface AudioPickerProps {
6
+ label?: string;
7
+ value: MediaValue;
8
+ onChange: (file: File | null) => void;
9
+ required?: boolean;
10
+ accept?: string;
11
+ id: string;
12
+ dragDrop?: boolean;
13
+ name: string;
14
+ parentClass?: string;
15
+ maxSize?: number;
16
+ }
17
+ declare const AudioPicker: ({ label, value, onChange, required, accept, id, dragDrop, name, parentClass, maxSize, }: AudioPickerProps) => import("react/jsx-runtime").JSX.Element;
18
+ export default AudioPicker;
@@ -0,0 +1,19 @@
1
+ interface CheckboxOption {
2
+ label: string;
3
+ value: any;
4
+ disabled?: boolean;
5
+ }
6
+ interface CheckboxProps {
7
+ name: string;
8
+ label?: string;
9
+ options: CheckboxOption[];
10
+ value: any;
11
+ onChange: (value: any, name?: string) => void;
12
+ disabled?: boolean;
13
+ required?: boolean;
14
+ parentClass?: string;
15
+ className?: string;
16
+ multiSelect?: boolean;
17
+ }
18
+ declare const Checkbox: ({ name, label, options, value, onChange, disabled, required, parentClass, className, multiSelect, }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
19
+ export default Checkbox;
@@ -0,0 +1,12 @@
1
+ interface ImageCropperModalProps {
2
+ isOpen: boolean;
3
+ imageSrc: string;
4
+ fileType?: string;
5
+ fileName?: string;
6
+ aspect?: number;
7
+ title?: string;
8
+ onClose: () => void;
9
+ onApply: (file: File) => void;
10
+ }
11
+ declare const ImageCropperModal: ({ isOpen, imageSrc, fileType, fileName, aspect, title, onClose, onApply, }: ImageCropperModalProps) => import("react/jsx-runtime").JSX.Element | null;
12
+ export default ImageCropperModal;
@@ -0,0 +1,19 @@
1
+ type ImageValue = File | {
2
+ file?: File;
3
+ preview?: string;
4
+ } | string | null;
5
+ interface ImagePickerProps {
6
+ label?: string;
7
+ value: ImageValue;
8
+ onChange: (file: File | null) => void;
9
+ required?: boolean;
10
+ accept?: string;
11
+ aspect?: number | string;
12
+ id: string;
13
+ dragDrop?: boolean;
14
+ cropImage?: boolean;
15
+ name: string;
16
+ parentClass?: string;
17
+ }
18
+ declare const ImagePicker: ({ label, value, onChange, required, accept, aspect, id, dragDrop, cropImage, name, parentClass, }: ImagePickerProps) => import("react/jsx-runtime").JSX.Element;
19
+ export default ImagePicker;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
+ label?: string;
4
+ value: any;
5
+ required: boolean;
6
+ parentClass?: string;
7
+ className?: string;
8
+ type: string;
9
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
10
+ negativeNumberAllow?: boolean;
11
+ defaultValue?: any;
12
+ field: Record<string, any>;
13
+ onChange: (value: any) => void;
14
+ mask?: string;
15
+ maskApplyOnValue?: boolean;
16
+ }
17
+ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
18
+ export { Input };
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ interface InputLabelProps {
3
+ label: React.ReactNode;
4
+ required?: boolean;
5
+ infoText?: string;
6
+ }
7
+ export default function InputLabel({ label, required, infoText, }: InputLabelProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,15 @@
1
+ interface PhoneInputProps {
2
+ label?: string;
3
+ value: string;
4
+ name: string;
5
+ parentClass?: string;
6
+ onChange: (value: string) => void;
7
+ disabled?: boolean;
8
+ required?: boolean;
9
+ placeholder?: string;
10
+ search?: boolean;
11
+ countriesList?: boolean;
12
+ defaultCountry?: string;
13
+ }
14
+ export default function PhoneInput({ label, value, name, parentClass, onChange, disabled, required, placeholder, search, countriesList, defaultCountry, }: PhoneInputProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,17 @@
1
+ interface RadioOption {
2
+ label: string;
3
+ value: any;
4
+ }
5
+ interface RadioProps {
6
+ value: any;
7
+ onChange: (value: any) => void;
8
+ text?: string;
9
+ options: RadioOption[];
10
+ label?: string;
11
+ required?: boolean;
12
+ name: string;
13
+ disabled?: boolean;
14
+ parentClass?: string;
15
+ }
16
+ declare const Radio: ({ value, onChange, text, options, label, required, name, disabled, parentClass, }: RadioProps) => import("react/jsx-runtime").JSX.Element;
17
+ export default Radio;
@@ -0,0 +1,42 @@
1
+ export interface FieldConfig {
2
+ key: string;
3
+ label?: string;
4
+ type?: string;
5
+ options?: any[];
6
+ placeholder?: string;
7
+ rows?: number;
8
+ inputClass?: string;
9
+ search?: boolean;
10
+ accept?: string;
11
+ text?: string;
12
+ required?: boolean;
13
+ minLength?: number;
14
+ dragDrop?: boolean;
15
+ parentClass?: string;
16
+ countriesList?: boolean;
17
+ defaultCountry?: string;
18
+ multiple?: boolean;
19
+ dropdownMaxHeight?: number;
20
+ editorKey?: string;
21
+ fontFamily?: string;
22
+ disabled?: boolean;
23
+ negativeNumberAllow?: boolean;
24
+ defaultValue?: any;
25
+ renderCondition?: (formData: Record<string, any>) => boolean;
26
+ pattern?: string;
27
+ renderType?: string;
28
+ cropImage?: boolean;
29
+ aspectRatio?: number;
30
+ dependencyKey?: string;
31
+ mask?: string;
32
+ maskApplyOnValue?: boolean;
33
+ maxSize?: number;
34
+ [key: string]: any;
35
+ }
36
+ interface RenderFieldsProps {
37
+ field: FieldConfig;
38
+ formData: Record<string, any>;
39
+ handleChange: (key: string, value: any) => void;
40
+ }
41
+ declare const RenderFields: ({ field, formData, handleChange }: RenderFieldsProps) => import("react/jsx-runtime").JSX.Element | null;
42
+ export default RenderFields;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ interface SelectOption {
3
+ label: string;
4
+ value: any;
5
+ }
6
+ interface SelectProps {
7
+ options: SelectOption[] | ((formData: Record<string, any>) => Promise<SelectOption[]> | SelectOption[]);
8
+ value: any;
9
+ defaultValue?: any;
10
+ onChange: (value: any) => void;
11
+ placeholder?: string;
12
+ className?: string;
13
+ disabled?: boolean;
14
+ search?: boolean;
15
+ label?: React.ReactNode;
16
+ required?: boolean;
17
+ name: string;
18
+ parentClass?: string;
19
+ multiple?: boolean;
20
+ dropdownMaxHeight?: string | number;
21
+ formData: Record<string, any>;
22
+ dependencyKey?: string;
23
+ }
24
+ declare const Select: ({ options, value, defaultValue, onChange, placeholder, className, disabled, search, label, required, name, parentClass, multiple, dropdownMaxHeight, formData, dependencyKey, }: SelectProps) => import("react/jsx-runtime").JSX.Element;
25
+ export default Select;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ interface SwitchProps {
3
+ label?: React.ReactNode;
4
+ required?: boolean;
5
+ parentClass?: string;
6
+ className?: string;
7
+ value: boolean;
8
+ onChange: (checked: boolean) => void;
9
+ disabled?: boolean;
10
+ name: string;
11
+ }
12
+ declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
13
+ export { Switch };
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
3
+ label?: React.ReactNode;
4
+ required?: boolean;
5
+ parentClass?: string;
6
+ className?: string;
7
+ }
8
+ declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
9
+ export { TextArea };
@@ -0,0 +1,20 @@
1
+ interface TinyEditorProps {
2
+ editorKey: string;
3
+ value: string;
4
+ onChange: (content: string) => void;
5
+ label?: string;
6
+ required?: boolean;
7
+ placeholder?: string;
8
+ parentClass?: string;
9
+ height?: number;
10
+ inline?: boolean;
11
+ disabled?: boolean;
12
+ plugins?: string[];
13
+ toolbar?: string;
14
+ menubar?: boolean;
15
+ fontFamily?: string;
16
+ initConfig?: Record<string, any>;
17
+ imageUploadHandler?: (blobInfo: any) => Promise<string>;
18
+ }
19
+ declare const TinyEditor: ({ editorKey, value, onChange, label, required, placeholder, parentClass, height, inline, disabled, plugins, toolbar, menubar, fontFamily, initConfig, imageUploadHandler, }: TinyEditorProps) => import("react/jsx-runtime").JSX.Element;
20
+ export default TinyEditor;
@@ -0,0 +1,18 @@
1
+ type MediaValue = File | {
2
+ file?: File;
3
+ preview?: string;
4
+ } | string | null;
5
+ interface VideoPickerProps {
6
+ label: string;
7
+ value: MediaValue;
8
+ onChange: (file: File | null) => void;
9
+ required?: boolean;
10
+ accept?: string;
11
+ id: string;
12
+ dragDrop?: boolean;
13
+ name: string;
14
+ parentClass?: string;
15
+ maxSize?: number;
16
+ }
17
+ declare const VideoPicker: ({ label, value, onChange, required, accept, id, dragDrop, name, parentClass, maxSize, }: VideoPickerProps) => import("react/jsx-runtime").JSX.Element;
18
+ export default VideoPicker;
@@ -0,0 +1,7 @@
1
+ interface SpinnerProps {
2
+ size?: string;
3
+ className?: string;
4
+ color?: string;
5
+ }
6
+ declare const Spinner: ({ size, className, color, }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default Spinner;
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { ActionButton } from "../../types/crudtypes";
3
+ interface ModalProps {
4
+ isOpen: boolean;
5
+ onClose: (resp?: any) => void;
6
+ icon?: React.ReactNode;
7
+ title: React.ReactNode;
8
+ children: React.ReactNode;
9
+ size?: string;
10
+ actionButtons?: ActionButton[];
11
+ footerConfig?: any;
12
+ onFormSubmit?: (e?: any) => void;
13
+ onCancel?: () => void;
14
+ loadingBtn?: boolean;
15
+ loading?: boolean;
16
+ executeFunction?: (...args: any[]) => void;
17
+ selectedItem?: any;
18
+ }
19
+ declare const Modal: ({ isOpen, onClose, icon, title, children, size, actionButtons, onFormSubmit, loadingBtn, executeFunction, selectedItem, }: ModalProps) => import("react/jsx-runtime").JSX.Element | null;
20
+ export default Modal;
@@ -0,0 +1,10 @@
1
+ interface TableProps {
2
+ config: Record<string, any>;
3
+ setShowAdd: (value: boolean) => void;
4
+ title: string;
5
+ buttonText?: string;
6
+ description?: string;
7
+ showAddButton?: boolean;
8
+ }
9
+ declare const Table: ({ config, setShowAdd, title, buttonText, description, showAddButton, }: TableProps) => import("react/jsx-runtime").JSX.Element;
10
+ export default Table;
@@ -0,0 +1,8 @@
1
+ interface ImagePreviewProps {
2
+ src: string;
3
+ alt?: string;
4
+ isOpen: boolean;
5
+ setIsOpen: (value: boolean) => void;
6
+ }
7
+ declare const ImagePreview: ({ src, alt, isOpen, setIsOpen, }: ImagePreviewProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default ImagePreview;
@@ -0,0 +1,13 @@
1
+ interface SortOption {
2
+ value: string;
3
+ label: string;
4
+ [key: string]: any;
5
+ }
6
+ interface SortDropdownProps {
7
+ options: SortOption[];
8
+ value: string;
9
+ onChange: (value: string, option: SortOption | null) => void;
10
+ clearLabel?: string;
11
+ }
12
+ declare const SortDropdown: ({ options, value, onChange, clearLabel, }: SortDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
13
+ export default SortDropdown;
@@ -0,0 +1,6 @@
1
+ interface TableSkeletonProps {
2
+ rows: number;
3
+ columns: number;
4
+ }
5
+ declare const TableSkeleton: ({ rows, columns }: TableSkeletonProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default TableSkeleton;
@@ -0,0 +1,58 @@
1
+ interface SortOption {
2
+ value: string;
3
+ label: string;
4
+ key: string;
5
+ order: "asc" | "desc";
6
+ type?: string;
7
+ }
8
+ interface FieldRule {
9
+ key?: string;
10
+ type?: string;
11
+ label?: string;
12
+ }
13
+ interface SortChangePayload {
14
+ value: string;
15
+ option: SortOption | null;
16
+ key: string;
17
+ order: string;
18
+ type: string;
19
+ }
20
+ interface SortConfig {
21
+ enabled?: boolean;
22
+ useServerSideSorting?: boolean;
23
+ options?: SortOption[];
24
+ fields?: (string | FieldRule)[];
25
+ defaultValue?: string;
26
+ autoGenerate?: boolean;
27
+ clearLabel?: string;
28
+ onChange?: ((payload: SortChangePayload) => void) | null;
29
+ }
30
+ interface NormalizedSortConfig {
31
+ enabled: boolean;
32
+ useServerSideSorting: boolean;
33
+ options: SortOption[];
34
+ fields: (string | FieldRule)[];
35
+ defaultValue: string;
36
+ autoGenerate: boolean;
37
+ clearLabel: string;
38
+ onChange: ((payload: SortChangePayload) => void) | null;
39
+ }
40
+ interface TableColumn {
41
+ key: string;
42
+ type?: string;
43
+ title?: string;
44
+ sortKey?: string;
45
+ sortType?: string;
46
+ sortLabel?: string;
47
+ titleKey?: string;
48
+ chipOptions?: Array<{
49
+ value: any;
50
+ label: string;
51
+ }>;
52
+ }
53
+ export declare const normalizeSortConfig: (sortConfig: boolean | SortConfig | null | undefined) => NormalizedSortConfig;
54
+ export declare const getSortableColumns: (tableHead?: TableColumn[]) => TableColumn[];
55
+ export declare const buildDefaultSortOptions: (columns?: TableColumn[]) => SortOption[];
56
+ export declare const getNormalizedSortOptions: (normalizedSortConfig: NormalizedSortConfig, sortableColumns?: TableColumn[]) => SortOption[];
57
+ export declare const sortTableData: (filteredData: any[] | undefined, sortBy: string | undefined, normalizedSortConfig: NormalizedSortConfig | null, normalizedSortOptions?: SortOption[]) => any[];
58
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface Country {
2
+ label: string;
3
+ code: string;
4
+ phone: string;
5
+ }
6
+ export declare const countries: Country[];
@@ -0,0 +1,2 @@
1
+ import { type CrudPageProps } from "./types/crudtypes";
2
+ export default function Crud({ config }: CrudPageProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export declare const formatDate: (dateString: string | Date | null | undefined, format?: string) => string;
2
+ export declare const searchLocalData: <T extends Record<string, any>>(data: T[], searchTerm: string | undefined | null, searchKeys?: string[]) => T[];