drf-react-by-schema 0.28.8 → 0.28.9
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/dist/@types/index.d.ts +410 -0
- package/dist/@types/index.d.ts.map +1 -0
- package/dist/@types/index.js +9 -0
- package/dist/@types/string-mask.d.ts +10 -0
- package/dist/@types/string-mask.d.ts.map +1 -0
- package/dist/@types/string-mask.js +1 -0
- package/dist/api.d.ts +81 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +1118 -0
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts +8 -0
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.js +86 -0
- package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.d.ts +12 -0
- package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.js +71 -0
- package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts +9 -0
- package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/ConfirmDialog.js +21 -0
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts +26 -0
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.js +146 -0
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts +73 -0
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.js +421 -0
- package/dist/components/DataGridBySchemaEditable/DataGridMobile.d.ts +18 -0
- package/dist/components/DataGridBySchemaEditable/DataGridMobile.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/DataGridMobile.js +105 -0
- package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts +11 -0
- package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/FileInputCell.js +155 -0
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts +12 -0
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.js +36 -0
- package/dist/components/DataGridBySchemaEditable/GeoEditCell.d.ts +10 -0
- package/dist/components/DataGridBySchemaEditable/GeoEditCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GeoEditCell.js +85 -0
- package/dist/components/DataGridBySchemaEditable/GeoThumbCell.d.ts +11 -0
- package/dist/components/DataGridBySchemaEditable/GeoThumbCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GeoThumbCell.js +87 -0
- package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.d.ts +18 -0
- package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.js +24 -0
- package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts +8 -0
- package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridDateInput.js +166 -0
- package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.d.ts +6 -0
- package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.js +154 -0
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts +10 -0
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.js +78 -0
- package/dist/components/DataGridBySchemaEditable/GridGenericInput.d.ts +8 -0
- package/dist/components/DataGridBySchemaEditable/GridGenericInput.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridGenericInput.js +30 -0
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts +7 -0
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.js +74 -0
- package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts +21 -0
- package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/InputInterval.js +131 -0
- package/dist/components/DataGridBySchemaEditable/MobileSearchBar.d.ts +9 -0
- package/dist/components/DataGridBySchemaEditable/MobileSearchBar.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/MobileSearchBar.js +70 -0
- package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.d.ts +7 -0
- package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.js +41 -0
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts +24 -0
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.js +259 -0
- package/dist/components/DataGridBySchemaEditable/geoConstants.d.ts +5 -0
- package/dist/components/DataGridBySchemaEditable/geoConstants.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/geoConstants.js +6 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.d.ts +33 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.js +161 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.d.ts +14 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.js +69 -0
- package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.d.ts +9 -0
- package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.js +73 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts +30 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.js +199 -0
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts +33 -0
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.js +270 -0
- package/dist/components/DataGridBySchemaEditable/utils.d.ts +40 -0
- package/dist/components/DataGridBySchemaEditable/utils.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/utils.js +181 -0
- package/dist/components/DataGridBySchemaEditable.d.ts +64 -0
- package/dist/components/DataGridBySchemaEditable.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable.js +172 -0
- package/dist/components/DataTotals.d.ts +12 -0
- package/dist/components/DataTotals.d.ts.map +1 -0
- package/dist/components/DataTotals.js +32 -0
- package/dist/components/DataTotalsServer.d.ts +10 -0
- package/dist/components/DataTotalsServer.d.ts.map +1 -0
- package/dist/components/DataTotalsServer.js +18 -0
- package/dist/components/DialogActions.d.ts +11 -0
- package/dist/components/DialogActions.d.ts.map +1 -0
- package/dist/components/DialogActions.js +20 -0
- package/dist/components/FileTypeIcon.d.ts +18 -0
- package/dist/components/FileTypeIcon.d.ts.map +1 -0
- package/dist/components/FileTypeIcon.js +48 -0
- package/dist/components/GenericModelList.d.ts +53 -0
- package/dist/components/GenericModelList.d.ts.map +1 -0
- package/dist/components/GenericModelList.js +194 -0
- package/dist/components/GenericRelatedModelList.d.ts +55 -0
- package/dist/components/GenericRelatedModelList.d.ts.map +1 -0
- package/dist/components/GenericRelatedModelList.js +181 -0
- package/dist/components/GenericRelatedModelListTable.d.ts +56 -0
- package/dist/components/GenericRelatedModelListTable.d.ts.map +1 -0
- package/dist/components/GenericRelatedModelListTable.js +31 -0
- package/dist/components/Image.d.ts +10 -0
- package/dist/components/Image.d.ts.map +1 -0
- package/dist/components/Image.js +111 -0
- package/dist/components/details/DetailBySchema.d.ts +4 -0
- package/dist/components/details/DetailBySchema.d.ts.map +1 -0
- package/dist/components/details/DetailBySchema.js +175 -0
- package/dist/components/details/DetailFieldBySchema.d.ts +4 -0
- package/dist/components/details/DetailFieldBySchema.d.ts.map +1 -0
- package/dist/components/details/DetailFieldBySchema.js +88 -0
- package/dist/components/forms/ChangePasswordForm.d.ts +7 -0
- package/dist/components/forms/ChangePasswordForm.d.ts.map +1 -0
- package/dist/components/forms/ChangePasswordForm.js +93 -0
- package/dist/components/forms/DialogFormBySchema.d.ts +22 -0
- package/dist/components/forms/DialogFormBySchema.d.ts.map +1 -0
- package/dist/components/forms/DialogFormBySchema.js +97 -0
- package/dist/components/forms/FieldBySchema.d.ts +4 -0
- package/dist/components/forms/FieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/FieldBySchema.js +80 -0
- package/dist/components/forms/ForgotPasswordForm.d.ts +11 -0
- package/dist/components/forms/ForgotPasswordForm.d.ts.map +1 -0
- package/dist/components/forms/ForgotPasswordForm.js +114 -0
- package/dist/components/forms/Form.d.ts +61 -0
- package/dist/components/forms/Form.d.ts.map +1 -0
- package/dist/components/forms/Form.js +264 -0
- package/dist/components/forms/FormActions.d.ts +20 -0
- package/dist/components/forms/FormActions.d.ts.map +1 -0
- package/dist/components/forms/FormActions.js +55 -0
- package/dist/components/forms/FormBySchema.d.ts +21 -0
- package/dist/components/forms/FormBySchema.d.ts.map +1 -0
- package/dist/components/forms/FormBySchema.js +280 -0
- package/dist/components/forms/FormWatcher.d.ts +10 -0
- package/dist/components/forms/FormWatcher.d.ts.map +1 -0
- package/dist/components/forms/FormWatcher.js +25 -0
- package/dist/components/forms/inputs/AutocompleteFieldBySchema.d.ts +13 -0
- package/dist/components/forms/inputs/AutocompleteFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/AutocompleteFieldBySchema.js +133 -0
- package/dist/components/forms/inputs/BooleanFieldBySchema.d.ts +4 -0
- package/dist/components/forms/inputs/BooleanFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/BooleanFieldBySchema.js +39 -0
- package/dist/components/forms/inputs/DesktopDatePickerBySchema.d.ts +5 -0
- package/dist/components/forms/inputs/DesktopDatePickerBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/DesktopDatePickerBySchema.js +54 -0
- package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.d.ts +5 -0
- package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.js +47 -0
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts +14 -0
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.js +272 -0
- package/dist/components/forms/inputs/FileFieldBySchema.d.ts +4 -0
- package/dist/components/forms/inputs/FileFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/FileFieldBySchema.js +144 -0
- package/dist/components/forms/inputs/FloatFieldBySchema.d.ts +4 -0
- package/dist/components/forms/inputs/FloatFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/FloatFieldBySchema.js +64 -0
- package/dist/components/forms/inputs/GeometryFieldBySchema.d.ts +8 -0
- package/dist/components/forms/inputs/GeometryFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/GeometryFieldBySchema.js +61 -0
- package/dist/components/forms/inputs/MapGeometryPicker.d.ts +19 -0
- package/dist/components/forms/inputs/MapGeometryPicker.d.ts.map +1 -0
- package/dist/components/forms/inputs/MapGeometryPicker.js +344 -0
- package/dist/components/forms/inputs/PatternFieldBySchema.d.ts +4 -0
- package/dist/components/forms/inputs/PatternFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/PatternFieldBySchema.js +56 -0
- package/dist/components/forms/inputs/TextFieldBySchema.d.ts +4 -0
- package/dist/components/forms/inputs/TextFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/TextFieldBySchema.js +56 -0
- package/dist/components/forms/inputs/leafletMarker.d.ts +12 -0
- package/dist/components/forms/inputs/leafletMarker.d.ts.map +1 -0
- package/dist/components/forms/inputs/leafletMarker.js +52 -0
- package/dist/context/APIWrapper.d.ts +18 -0
- package/dist/context/APIWrapper.d.ts.map +1 -0
- package/dist/context/APIWrapper.js +593 -0
- package/dist/context/APIWrapperContext.d.ts +132 -0
- package/dist/context/APIWrapperContext.d.ts.map +1 -0
- package/dist/context/APIWrapperContext.js +63 -0
- package/dist/context/DRFReactBySchemaContext.d.ts +31 -0
- package/dist/context/DRFReactBySchemaContext.d.ts.map +1 -0
- package/dist/context/DRFReactBySchemaContext.js +20 -0
- package/dist/context/DRFReactBySchemaProvider.d.ts +5 -0
- package/dist/context/DRFReactBySchemaProvider.d.ts.map +1 -0
- package/dist/context/DRFReactBySchemaProvider.js +105 -0
- package/dist/context/Overlays.d.ts +5 -0
- package/dist/context/Overlays.d.ts.map +1 -0
- package/dist/context/Overlays.js +114 -0
- package/dist/context/PrivateContext.d.ts +10 -0
- package/dist/context/PrivateContext.d.ts.map +1 -0
- package/dist/context/PrivateContext.js +16 -0
- package/dist/hooks/useDeepMemo.d.ts +2 -0
- package/dist/hooks/useDeepMemo.d.ts.map +1 -0
- package/dist/hooks/useDeepMemo.js +13 -0
- package/dist/hooks/useWhyDidYouUpdate.d.ts +4 -0
- package/dist/hooks/useWhyDidYouUpdate.d.ts.map +1 -0
- package/dist/hooks/useWhyDidYouUpdate.js +26 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -0
- package/dist/styles/grid.d.ts +3 -0
- package/dist/styles/grid.d.ts.map +1 -0
- package/dist/styles/grid.js +38 -0
- package/dist/styles/index.d.ts +3 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/index.js +38 -0
- package/dist/styles/layout.d.ts +23 -0
- package/dist/styles/layout.d.ts.map +1 -0
- package/dist/styles/layout.js +71 -0
- package/dist/styles/texts.d.ts +66 -0
- package/dist/styles/texts.d.ts.map +1 -0
- package/dist/styles/texts.js +73 -0
- package/dist/styles/theme.d.ts +29 -0
- package/dist/styles/theme.d.ts.map +1 -0
- package/dist/styles/theme.js +226 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/utils.d.ts +107 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +957 -0
- package/package.json +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FieldErrors, FieldValues, SubmitHandler, UseFormGetValues, UseFormReset, UseFormSetValue } from 'react-hook-form';
|
|
3
|
+
import { AlertColor, AlertPropsColorOverrides } from '@mui/material/Alert';
|
|
4
|
+
import { OverridableStringUnion } from '@mui/types';
|
|
5
|
+
import { AxiosError } from 'axios';
|
|
6
|
+
import { ObjectSchema } from 'yup';
|
|
7
|
+
import { ItemSchemaColumnsType, Id, Item, SchemaType, DataSchemaColumnsType, OnSuccessEvent, OptionsAC, FormFieldLayout, TargetApiParamsLocal, TargetApiPostParamsLocal, GetGenericModelListPropsLocal, GridEnrichedBySchemaColDef, ExtraValidators, GetGenericModelPropsLocal, UpdateDataBySchema, AutocompleteItem, FieldKey, PartialItem, TField, PaginationModel } from '../@types';
|
|
8
|
+
export interface LoadSinglePageDataProps<T extends TField = void> {
|
|
9
|
+
model: string;
|
|
10
|
+
objId?: Id;
|
|
11
|
+
objTitleField?: FieldKey<T>;
|
|
12
|
+
optionsACModels?: string[];
|
|
13
|
+
defaults?: PartialItem<T>;
|
|
14
|
+
extraValidators?: ExtraValidators<T>;
|
|
15
|
+
fieldsLayout?: FormFieldLayout<T>[];
|
|
16
|
+
}
|
|
17
|
+
export interface PageFormType<T extends TField = void> {
|
|
18
|
+
id: Id;
|
|
19
|
+
model: string | null;
|
|
20
|
+
modelVerboseName?: string | null;
|
|
21
|
+
modelVerboseNamePlural?: string | null;
|
|
22
|
+
schema: SchemaType<T> | null;
|
|
23
|
+
columns?: GridEnrichedBySchemaColDef<T>[] | null;
|
|
24
|
+
initialValues: Item<T> | null;
|
|
25
|
+
validationSchema: ObjectSchema<Item> | null;
|
|
26
|
+
objTitleField?: FieldKey<T>;
|
|
27
|
+
}
|
|
28
|
+
export interface FormTools<T extends TField = void> {
|
|
29
|
+
errors: FieldErrors<Item<T>>;
|
|
30
|
+
reset: UseFormReset<Item<T>>;
|
|
31
|
+
getValues: UseFormGetValues<Item<T>>;
|
|
32
|
+
setValue: UseFormSetValue<Item<T>>;
|
|
33
|
+
isDirty: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface OnEditModelType<T extends TField = void> {
|
|
36
|
+
fieldKey?: FieldKey<T>;
|
|
37
|
+
index?: number;
|
|
38
|
+
model: string;
|
|
39
|
+
id: Id;
|
|
40
|
+
labelKey: string;
|
|
41
|
+
setValue?: UseFormSetValue<Item<T>>;
|
|
42
|
+
getValues?: UseFormGetValues<Item<T>>;
|
|
43
|
+
fieldsLayout?: FormFieldLayout<T>[];
|
|
44
|
+
initialValuesPartial?: PartialItem<T>;
|
|
45
|
+
}
|
|
46
|
+
export interface OnEditRelatedModelType<T extends TField = void> {
|
|
47
|
+
model: string;
|
|
48
|
+
id: Id;
|
|
49
|
+
relatedModel: string;
|
|
50
|
+
relatedModelId: Id;
|
|
51
|
+
newRow: Item<T>;
|
|
52
|
+
schema: SchemaType<T>;
|
|
53
|
+
onlyAddExisting?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface onEditModelDataGridSaveType<T extends TField = void> {
|
|
56
|
+
model: string;
|
|
57
|
+
id: Id;
|
|
58
|
+
newRow: Item<T>;
|
|
59
|
+
schema: SchemaType<T>;
|
|
60
|
+
}
|
|
61
|
+
export interface OnDeleteRelatedModelType {
|
|
62
|
+
model: string;
|
|
63
|
+
id: Id;
|
|
64
|
+
relatedModel: string;
|
|
65
|
+
relatedModelId: Id;
|
|
66
|
+
}
|
|
67
|
+
export interface SnackBarType {
|
|
68
|
+
open?: boolean;
|
|
69
|
+
msg?: string;
|
|
70
|
+
severity?: OverridableStringUnion<AlertColor, AlertPropsColorOverrides>;
|
|
71
|
+
}
|
|
72
|
+
type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
73
|
+
export interface DialogType {
|
|
74
|
+
open: boolean;
|
|
75
|
+
loading?: boolean;
|
|
76
|
+
title?: string;
|
|
77
|
+
Body?: React.ReactNode;
|
|
78
|
+
Actions?: React.ReactNode;
|
|
79
|
+
isCancelDisabled?: boolean;
|
|
80
|
+
size?: DialogSize;
|
|
81
|
+
}
|
|
82
|
+
export type DRFReactBySchemaSubmitHandler = (...args: [...[model: string, id: Id], ...Parameters<SubmitHandler<FieldValues>>]) => Promise<Id | AxiosError>;
|
|
83
|
+
export interface APIWrapperContextType<T extends TField = void> {
|
|
84
|
+
usuaria: Item | null;
|
|
85
|
+
updateUsuaria: () => void;
|
|
86
|
+
isLoggedIn: () => Promise<false | Item>;
|
|
87
|
+
onSubmit: DRFReactBySchemaSubmitHandler;
|
|
88
|
+
loadSinglePageData: (p: LoadSinglePageDataProps<T>) => Promise<Item<T> | AxiosError>;
|
|
89
|
+
handleLoading: (p: boolean) => void;
|
|
90
|
+
optionsAC: OptionsAC<T> | null;
|
|
91
|
+
setOptionsAC: (x: Partial<OptionsAC<T>>) => void;
|
|
92
|
+
onEditModel: <U extends TField = void>(p: OnEditModelType<U>) => void;
|
|
93
|
+
pageForm: PageFormType<T> | null;
|
|
94
|
+
resetPageForm: () => void;
|
|
95
|
+
formTools?: FormTools<T>;
|
|
96
|
+
onEditModelDataGridSave: <U extends TField = void>(p: onEditModelDataGridSaveType<U>) => Promise<Item<U> | AxiosError>;
|
|
97
|
+
onEditModelSave: (p: Item<T>) => Promise<boolean | AxiosError>;
|
|
98
|
+
onDeleteModel: (model: string, id: Id, onSuccess?: OnSuccessEvent) => void;
|
|
99
|
+
onEditRelatedModelSave: <U extends TField = void>(p: OnEditRelatedModelType<U>) => Promise<Item<U> | ItemSchemaColumnsType<U> | AxiosError>;
|
|
100
|
+
onDeleteRelatedModel: (p: OnDeleteRelatedModelType) => Promise<true | AxiosError>;
|
|
101
|
+
exportExcelData: ({ model, modelParent, modelParentId, paginationModel, }: {
|
|
102
|
+
model: string;
|
|
103
|
+
modelParent?: string;
|
|
104
|
+
modelParentId?: Id;
|
|
105
|
+
paginationModel: PaginationModel;
|
|
106
|
+
}) => Promise<true | AxiosError>;
|
|
107
|
+
rawUpdateDataBySchema: <U extends TField = void>(props: UpdateDataBySchema<U>) => Promise<Item<U> | AxiosError>;
|
|
108
|
+
rawDeleteData: (model: string, id: Id) => Promise<true | AxiosError>;
|
|
109
|
+
onTriggerSnackBar: (p: SnackBarType) => void;
|
|
110
|
+
setDialog: (newState: Partial<DialogType> | null) => void;
|
|
111
|
+
getRawData: <U = void>(route: string) => Promise<U | AxiosError>;
|
|
112
|
+
getAutoComplete: (model: string, queryParams?: string[]) => Promise<AutocompleteItem[] | AxiosError>;
|
|
113
|
+
getGenericModel: <U extends TField = void>(x: GetGenericModelPropsLocal) => Promise<ItemSchemaColumnsType<U> | AxiosError>;
|
|
114
|
+
getGenericModelList: <U extends TField = void>(x: GetGenericModelListPropsLocal<U>) => Promise<DataSchemaColumnsType<U> | AxiosError>;
|
|
115
|
+
getAllModels: () => Promise<Item[]>;
|
|
116
|
+
loginByPayload: (payload: Item) => Promise<boolean | AxiosError>;
|
|
117
|
+
getSignUpOptions: () => Promise<SchemaType | AxiosError>;
|
|
118
|
+
signUp: <U extends TField = void>(data: Item<U>) => Promise<Item<U> | AxiosError>;
|
|
119
|
+
signOut: () => void;
|
|
120
|
+
requestPasswordReset: (email: string) => Promise<Item | AxiosError>;
|
|
121
|
+
confirmPasswordReset: (data: Item) => Promise<Item | AxiosError>;
|
|
122
|
+
changePassword: (data: Item) => Promise<Item | AxiosError>;
|
|
123
|
+
postData: <U extends TField = void>(params: TargetApiPostParamsLocal<U>) => Promise<Item<U> | AxiosError>;
|
|
124
|
+
editModel: React.RefObject<Item<T>>;
|
|
125
|
+
updateModel: <U extends TField = void>(p: TargetApiParamsLocal<U>) => Promise<Item<U> | AxiosError>;
|
|
126
|
+
populateOptionsAC: (optionsACModels: string[]) => void;
|
|
127
|
+
isMobile: boolean;
|
|
128
|
+
}
|
|
129
|
+
export declare const APIWrapperContext: React.Context<APIWrapperContextType<void>>;
|
|
130
|
+
export declare function useAPIWrapper<T extends TField = void>(): APIWrapperContextType<T>;
|
|
131
|
+
export {};
|
|
132
|
+
//# sourceMappingURL=APIWrapperContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"APIWrapperContext.d.ts","sourceRoot":"","sources":["../../src/context/APIWrapperContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAEnC,OAAO,EACL,qBAAqB,EACrB,EAAE,EACF,IAAI,EACJ,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,6BAA6B,EAC7B,0BAA0B,EAC1B,eAAe,EACf,yBAAyB,EACzB,kBAAkB,EAClB,g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ACvD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,iBAAiB,4CAyC5B,CAAC;AAEH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,8BAKpD"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.APIWrapperContext = void 0;
|
|
16
|
+
exports.useAPIWrapper = useAPIWrapper;
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
exports.APIWrapperContext = react_1.default.createContext({
|
|
19
|
+
usuaria: null,
|
|
20
|
+
updateUsuaria: () => undefined,
|
|
21
|
+
isLoggedIn: () => __awaiter(void 0, void 0, void 0, function* () { return false; }),
|
|
22
|
+
onSubmit: () => __awaiter(void 0, void 0, void 0, function* () { return 0; }),
|
|
23
|
+
loadSinglePageData: () => __awaiter(void 0, void 0, void 0, function* () { return ({}); }),
|
|
24
|
+
handleLoading: () => undefined,
|
|
25
|
+
optionsAC: null,
|
|
26
|
+
setOptionsAC: () => undefined,
|
|
27
|
+
onEditModel: () => undefined,
|
|
28
|
+
pageForm: null,
|
|
29
|
+
resetPageForm: () => undefined,
|
|
30
|
+
formTools: undefined,
|
|
31
|
+
onEditModelDataGridSave: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
32
|
+
onEditModelSave: () => __awaiter(void 0, void 0, void 0, function* () { return false; }),
|
|
33
|
+
onDeleteModel: () => undefined,
|
|
34
|
+
onEditRelatedModelSave: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
35
|
+
exportExcelData: () => __awaiter(void 0, void 0, void 0, function* () { return true; }),
|
|
36
|
+
rawUpdateDataBySchema: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
37
|
+
rawDeleteData: () => __awaiter(void 0, void 0, void 0, function* () { return true; }),
|
|
38
|
+
onDeleteRelatedModel: () => __awaiter(void 0, void 0, void 0, function* () { return true; }),
|
|
39
|
+
onTriggerSnackBar: () => undefined,
|
|
40
|
+
setDialog: () => undefined,
|
|
41
|
+
// api utils:
|
|
42
|
+
getRawData: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
43
|
+
getAutoComplete: () => __awaiter(void 0, void 0, void 0, function* () { return []; }),
|
|
44
|
+
getGenericModel: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
45
|
+
getGenericModelList: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
46
|
+
getAllModels: () => __awaiter(void 0, void 0, void 0, function* () { return []; }),
|
|
47
|
+
loginByPayload: () => __awaiter(void 0, void 0, void 0, function* () { return false; }),
|
|
48
|
+
getSignUpOptions: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
49
|
+
signUp: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
50
|
+
signOut: () => undefined,
|
|
51
|
+
requestPasswordReset: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
52
|
+
confirmPasswordReset: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
53
|
+
changePassword: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
54
|
+
postData: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
55
|
+
editModel: { current: {} },
|
|
56
|
+
updateModel: () => __awaiter(void 0, void 0, void 0, function* () { return ({ isAxiosError: true }); }),
|
|
57
|
+
populateOptionsAC: () => undefined,
|
|
58
|
+
isMobile: false,
|
|
59
|
+
});
|
|
60
|
+
function useAPIWrapper() {
|
|
61
|
+
const context = react_1.default.useContext(exports.APIWrapperContext);
|
|
62
|
+
return context;
|
|
63
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
|
+
import { SchemasType } from '../@types';
|
|
4
|
+
export interface ServerEndPoint {
|
|
5
|
+
url: string;
|
|
6
|
+
apiTokenUrl: string;
|
|
7
|
+
api?: string;
|
|
8
|
+
signUp?: string;
|
|
9
|
+
autocomplete?: string;
|
|
10
|
+
getToken?: string;
|
|
11
|
+
refreshToken?: string;
|
|
12
|
+
verifyToken?: string;
|
|
13
|
+
media?: string;
|
|
14
|
+
requestPasswordReset?: string;
|
|
15
|
+
confirmPasswordReset?: string;
|
|
16
|
+
changePassword?: string;
|
|
17
|
+
}
|
|
18
|
+
interface DRFReactBySchemaContextType {
|
|
19
|
+
serverEndPoint: ServerEndPoint | null;
|
|
20
|
+
theme: Theme;
|
|
21
|
+
isInBatches?: boolean;
|
|
22
|
+
firstBatchLength?: number;
|
|
23
|
+
schemas?: SchemasType;
|
|
24
|
+
}
|
|
25
|
+
export interface DRFReactBySchemaProviderProps extends DRFReactBySchemaContextType {
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export declare const DRFReactBySchemaContext: React.Context<DRFReactBySchemaContextType>;
|
|
29
|
+
export declare const useDRFReactBySchema: () => DRFReactBySchemaContextType;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=DRFReactBySchemaContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DRFReactBySchemaContext.d.ts","sourceRoot":"","sources":["../../src/context/DRFReactBySchemaContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,2BAA2B;IACnC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,MAAM,WAAW,6BAA8B,SAAQ,2BAA2B;IAChF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,uBAAuB,4CAMlC,CAAC;AAEH,eAAO,MAAM,mBAAmB,mCAG/B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useDRFReactBySchema = exports.DRFReactBySchemaContext = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const theme_1 = __importDefault(require("../styles/theme"));
|
|
9
|
+
exports.DRFReactBySchemaContext = react_1.default.createContext({
|
|
10
|
+
serverEndPoint: null,
|
|
11
|
+
theme: theme_1.default,
|
|
12
|
+
isInBatches: true,
|
|
13
|
+
firstBatchLength: 100,
|
|
14
|
+
schemas: undefined,
|
|
15
|
+
});
|
|
16
|
+
const useDRFReactBySchema = () => {
|
|
17
|
+
const context = react_1.default.useContext(exports.DRFReactBySchemaContext);
|
|
18
|
+
return context;
|
|
19
|
+
};
|
|
20
|
+
exports.useDRFReactBySchema = useDRFReactBySchema;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DRFReactBySchemaProviderProps } from './DRFReactBySchemaContext';
|
|
3
|
+
declare const DRFReactBySchemaProvider: ({ serverEndPoint, theme, isInBatches, firstBatchLength, schemas, children, }: DRFReactBySchemaProviderProps) => React.JSX.Element;
|
|
4
|
+
export default DRFReactBySchemaProvider;
|
|
5
|
+
//# sourceMappingURL=DRFReactBySchemaProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DRFReactBySchemaProvider.d.ts","sourceRoot":"","sources":["../../src/context/DRFReactBySchemaProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAOvC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,2BAA2B,CAAC;AAEnC,QAAA,MAAM,wBAAwB,GAAI,8EAO/B,6BAA6B,sBAwE/B,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const styles_1 = require("@mui/material/styles");
|
|
41
|
+
const CssBaseline_1 = __importDefault(require("@mui/material/CssBaseline"));
|
|
42
|
+
const utils_1 = require("@mui/utils");
|
|
43
|
+
const theme_1 = __importDefault(require("../styles/theme"));
|
|
44
|
+
const Overlays_1 = __importDefault(require("./Overlays"));
|
|
45
|
+
const DRFReactBySchemaContext_1 = require("./DRFReactBySchemaContext");
|
|
46
|
+
const DRFReactBySchemaProvider = ({ serverEndPoint, theme, isInBatches, firstBatchLength, schemas, children, }) => {
|
|
47
|
+
const newServerEndPoint = (0, react_1.useMemo)(() => {
|
|
48
|
+
if (!serverEndPoint) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const newServerEndPoint = Object.assign({}, serverEndPoint);
|
|
52
|
+
const defaultKeys = [
|
|
53
|
+
'autocomplete',
|
|
54
|
+
'api',
|
|
55
|
+
'getToken',
|
|
56
|
+
['refreshToken', 'refresh'],
|
|
57
|
+
['verifyToken', 'verify'],
|
|
58
|
+
'media',
|
|
59
|
+
];
|
|
60
|
+
for (const key of defaultKeys) {
|
|
61
|
+
if (key === 'getToken') {
|
|
62
|
+
newServerEndPoint[key] = newServerEndPoint.apiTokenUrl;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const hybridKey = typeof key === 'string' ? key : key[0];
|
|
66
|
+
const hybridUrl = typeof key === 'string' ? key : key[1];
|
|
67
|
+
if (newServerEndPoint[hybridKey]) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
newServerEndPoint[hybridKey] = ['refreshToken', 'verifyToken'].includes(hybridKey)
|
|
71
|
+
? `${newServerEndPoint.apiTokenUrl}${hybridUrl}/`
|
|
72
|
+
: `${newServerEndPoint.url}/${hybridUrl}`;
|
|
73
|
+
}
|
|
74
|
+
// Password management endpoints (optional; derived from `api` unless provided).
|
|
75
|
+
const passwordRoutes = [
|
|
76
|
+
['requestPasswordReset', 'password_reset/request'],
|
|
77
|
+
['confirmPasswordReset', 'password_reset/confirm'],
|
|
78
|
+
['changePassword', 'my_account/change_password'],
|
|
79
|
+
];
|
|
80
|
+
for (const [key, path] of passwordRoutes) {
|
|
81
|
+
if (newServerEndPoint[key]) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
newServerEndPoint[key] = `${newServerEndPoint.api}/${path}/`;
|
|
85
|
+
}
|
|
86
|
+
return newServerEndPoint;
|
|
87
|
+
}, [serverEndPoint]);
|
|
88
|
+
const mergedTheme = (0, react_1.useMemo)(() => {
|
|
89
|
+
if (!theme)
|
|
90
|
+
return theme_1.default;
|
|
91
|
+
return (0, utils_1.deepmerge)(theme_1.default, theme);
|
|
92
|
+
}, [theme]);
|
|
93
|
+
const contextValue = (0, react_1.useMemo)(() => ({
|
|
94
|
+
serverEndPoint: newServerEndPoint,
|
|
95
|
+
theme: mergedTheme,
|
|
96
|
+
isInBatches,
|
|
97
|
+
firstBatchLength,
|
|
98
|
+
schemas,
|
|
99
|
+
}), [firstBatchLength, isInBatches, mergedTheme, newServerEndPoint, schemas]);
|
|
100
|
+
return (react_1.default.createElement(styles_1.ThemeProvider, { theme: mergedTheme },
|
|
101
|
+
react_1.default.createElement(CssBaseline_1.default, null),
|
|
102
|
+
react_1.default.createElement(DRFReactBySchemaContext_1.DRFReactBySchemaContext.Provider, { value: contextValue },
|
|
103
|
+
react_1.default.createElement(Overlays_1.default, null, children))));
|
|
104
|
+
};
|
|
105
|
+
exports.default = DRFReactBySchemaProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Overlays.d.ts","sourceRoot":"","sources":["../../src/context/Overlays.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AA0C1E,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAoF3E"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.default = Overlays;
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const Backdrop_1 = __importDefault(require("@mui/material/Backdrop"));
|
|
42
|
+
const CircularProgress_1 = __importDefault(require("@mui/material/CircularProgress"));
|
|
43
|
+
const Snackbar_1 = __importDefault(require("@mui/material/Snackbar"));
|
|
44
|
+
const Alert_1 = __importDefault(require("@mui/material/Alert"));
|
|
45
|
+
const Dialog_1 = __importDefault(require("@mui/material/Dialog"));
|
|
46
|
+
const DialogActions_1 = __importDefault(require("@mui/material/DialogActions"));
|
|
47
|
+
const DialogContent_1 = __importDefault(require("@mui/material/DialogContent"));
|
|
48
|
+
const DialogTitle_1 = __importDefault(require("@mui/material/DialogTitle"));
|
|
49
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
50
|
+
const utils_1 = require("../utils");
|
|
51
|
+
const APIWrapper_1 = __importDefault(require("./APIWrapper"));
|
|
52
|
+
const initialPageForm = {
|
|
53
|
+
id: '',
|
|
54
|
+
model: null,
|
|
55
|
+
modelVerboseName: null,
|
|
56
|
+
modelVerboseNamePlural: null,
|
|
57
|
+
schema: null,
|
|
58
|
+
columns: null,
|
|
59
|
+
initialValues: null,
|
|
60
|
+
validationSchema: null,
|
|
61
|
+
};
|
|
62
|
+
const initialSnackBar = {
|
|
63
|
+
open: false,
|
|
64
|
+
msg: '',
|
|
65
|
+
severity: 'info',
|
|
66
|
+
};
|
|
67
|
+
const initialDialog = {
|
|
68
|
+
open: false,
|
|
69
|
+
loading: true,
|
|
70
|
+
title: '',
|
|
71
|
+
Body: null,
|
|
72
|
+
Actions: null,
|
|
73
|
+
};
|
|
74
|
+
function Overlays({ children }) {
|
|
75
|
+
const [pageForm, setPageForm] = (0, react_1.useReducer)((utils_1.reducer), initialPageForm);
|
|
76
|
+
const [formTools, setFormTools] = (0, react_1.useState)();
|
|
77
|
+
const [snackBar, setSnackBar] = (0, react_1.useReducer)((utils_1.reducer), initialSnackBar);
|
|
78
|
+
const [dialog, setDialog] = (0, react_1.useReducer)((utils_1.reducer), initialDialog);
|
|
79
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
80
|
+
// give some time to stop loading when data is retrieved and must render before loading rendering:
|
|
81
|
+
const handleLoading = (0, react_1.useCallback)((loadingState) => {
|
|
82
|
+
if (loadingState) {
|
|
83
|
+
setLoading(true);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
setLoading(false);
|
|
88
|
+
}, 300);
|
|
89
|
+
}, []);
|
|
90
|
+
const handleDialogClose = (0, react_1.useCallback)(() => {
|
|
91
|
+
setDialog({
|
|
92
|
+
open: false,
|
|
93
|
+
});
|
|
94
|
+
}, []);
|
|
95
|
+
const handleSnackBarClose = (0, react_1.useCallback)(() => {
|
|
96
|
+
setSnackBar({
|
|
97
|
+
open: false,
|
|
98
|
+
});
|
|
99
|
+
}, []);
|
|
100
|
+
const resetPageForm = (0, react_1.useCallback)(() => {
|
|
101
|
+
setPageForm(initialPageForm);
|
|
102
|
+
}, []);
|
|
103
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
104
|
+
react_1.default.createElement(APIWrapper_1.default, { handleLoading: handleLoading, setSnackBar: setSnackBar, setDialog: setDialog, pageForm: pageForm, setPageForm: setPageForm, resetPageForm: resetPageForm, formTools: formTools, setFormTools: setFormTools }, children),
|
|
105
|
+
react_1.default.createElement(Backdrop_1.default, { invisible: false, sx: { color: '#fff', zIndex: (theme) => theme.zIndex.drawer + 1 }, open: loading },
|
|
106
|
+
react_1.default.createElement(CircularProgress_1.default, null)),
|
|
107
|
+
snackBar && (react_1.default.createElement(Snackbar_1.default, { open: snackBar.open, autoHideDuration: 3000, onClose: handleSnackBarClose, anchorOrigin: { vertical: 'top', horizontal: 'right' } },
|
|
108
|
+
react_1.default.createElement(Alert_1.default, { severity: snackBar.severity }, snackBar.msg))),
|
|
109
|
+
dialog && (react_1.default.createElement(Dialog_1.default, { open: dialog.open, onClose: handleDialogClose, disableEscapeKeyDown: dialog.isCancelDisabled, fullWidth: true, maxWidth: dialog.size || 'xs' },
|
|
110
|
+
react_1.default.createElement(DialogTitle_1.default, null, dialog.loading ? 'Carregando...' : dialog.title),
|
|
111
|
+
react_1.default.createElement(DialogContent_1.default, null, dialog.loading ? (react_1.default.createElement(Box_1.default, { sx: { display: 'flex' } },
|
|
112
|
+
react_1.default.createElement(CircularProgress_1.default, null))) : (react_1.default.createElement(react_1.default.Fragment, null, dialog.Body))),
|
|
113
|
+
react_1.default.createElement(DialogActions_1.default, null, !dialog.loading && react_1.default.createElement(react_1.default.Fragment, null, dialog.Actions))))));
|
|
114
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormTools, PageFormType } from './APIWrapperContext';
|
|
3
|
+
import { TField } from '../@types';
|
|
4
|
+
export interface PrivateContextType<T extends TField = void> {
|
|
5
|
+
setFormTools: (x: FormTools<T>) => void;
|
|
6
|
+
setPageForm: (x: Partial<PageFormType<T>>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const PrivateContext: React.Context<PrivateContextType<void>>;
|
|
9
|
+
export declare const usePrivateContext: <T extends TField = void>() => PrivateContextType<T>;
|
|
10
|
+
//# sourceMappingURL=PrivateContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrivateContext.d.ts","sourceRoot":"","sources":["../../src/context/PrivateContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI;IACzD,YAAY,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACxC,WAAW,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,cAAc,yCAGzB,CAAC;AAEH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,MAAM,GAAG,IAAI,4BAGxD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.usePrivateContext = exports.PrivateContext = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
exports.PrivateContext = react_1.default.createContext({
|
|
9
|
+
setFormTools: () => undefined,
|
|
10
|
+
setPageForm: () => undefined,
|
|
11
|
+
});
|
|
12
|
+
const usePrivateContext = () => {
|
|
13
|
+
const context = react_1.default.useContext(exports.PrivateContext);
|
|
14
|
+
return context;
|
|
15
|
+
};
|
|
16
|
+
exports.usePrivateContext = usePrivateContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeepMemo.d.ts","sourceRoot":"","sources":["../../src/hooks/useDeepMemo.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAS1C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDeepMemo = useDeepMemo;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
function useDeepMemo(value) {
|
|
7
|
+
const ref = (0, react_1.useRef)(value);
|
|
8
|
+
// Only update the ref if the content actually changed
|
|
9
|
+
if (!(0, utils_1.deepEqual)(ref.current, value)) {
|
|
10
|
+
ref.current = value;
|
|
11
|
+
}
|
|
12
|
+
return ref.current;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWhyDidYouUpdate.d.ts","sourceRoot":"","sources":["../../src/hooks/useWhyDidYouUpdate.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,iBAAS,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,QAwB5E;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
function useWhyDidYouUpdate(name, props) {
|
|
5
|
+
const previousProps = (0, react_1.useRef)({});
|
|
6
|
+
(0, react_1.useEffect)(() => {
|
|
7
|
+
if (previousProps.current) {
|
|
8
|
+
const allKeys = new Set([...Object.keys(previousProps.current), ...Object.keys(props)]);
|
|
9
|
+
const changes = {};
|
|
10
|
+
allKeys.forEach((key) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
if (((_a = previousProps.current) === null || _a === void 0 ? void 0 : _a[key]) !== props[key]) {
|
|
13
|
+
changes[key] = {
|
|
14
|
+
from: (_b = previousProps.current) === null || _b === void 0 ? void 0 : _b[key],
|
|
15
|
+
to: props[key],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
if (Object.keys(changes).length > 0) {
|
|
20
|
+
console.log('[why-did-you-update]', name, changes);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
previousProps.current = props;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.default = useWhyDidYouUpdate;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { setAuthToken, hasJWT, clearJWT, AUTH_EXPIRED_EVENT } from './api';
|
|
2
|
+
import { emptyByType, getChoiceByValue, populateValues, enrichChoices, buildGenericYupValidationSchema, errorProps, getFieldErrorsFromResponse, getTmpId, isTmpId, getPatternFormat, slugToCamelCase } from './utils';
|
|
3
|
+
import DRFReactBySchemaProvider from './context/DRFReactBySchemaProvider';
|
|
4
|
+
import { useAPIWrapper } from './context/APIWrapperContext';
|
|
5
|
+
import Form from './components/forms/Form';
|
|
6
|
+
import DialogFormBySchema from './components/forms/DialogFormBySchema';
|
|
7
|
+
import ChangePasswordForm from './components/forms/ChangePasswordForm';
|
|
8
|
+
import ForgotPasswordForm from './components/forms/ForgotPasswordForm';
|
|
9
|
+
import DataGridBySchemaEditable from './components/DataGridBySchemaEditable';
|
|
10
|
+
import GenericModelList from './components/GenericModelList';
|
|
11
|
+
import GenericRelatedModelList from './components/GenericRelatedModelList';
|
|
12
|
+
import DataTotals from './components/DataTotals';
|
|
13
|
+
import DialogActions from './components/DialogActions';
|
|
14
|
+
import FileTypeIcon from './components/FileTypeIcon';
|
|
15
|
+
import SelectEditInputCell from './components/DataGridBySchemaEditable/SelectEditInputCell';
|
|
16
|
+
import GridDateInput from './components/DataGridBySchemaEditable/GridDateInput';
|
|
17
|
+
import GridDecimalInput from './components/DataGridBySchemaEditable/GridDecimalInput';
|
|
18
|
+
import GridPatternInput from './components/DataGridBySchemaEditable/GridPatternInput';
|
|
19
|
+
import BooleanInputCell from './components/DataGridBySchemaEditable/BooleanInputCell';
|
|
20
|
+
import FormWatcher from './components/forms/FormWatcher';
|
|
21
|
+
import FormBySchema from './components/forms/FormBySchema';
|
|
22
|
+
import FieldBySchema from './components/forms/FieldBySchema';
|
|
23
|
+
import TextFieldBySchema from './components/forms/inputs/TextFieldBySchema';
|
|
24
|
+
import BooleanFieldBySchema from './components/forms/inputs/BooleanFieldBySchema';
|
|
25
|
+
import DesktopDatePickerBySchema from './components/forms/inputs/DesktopDatePickerBySchema';
|
|
26
|
+
import DesktopDateTimePickerBySchema from './components/forms/inputs/DesktopDateTimePickerBySchema';
|
|
27
|
+
import EditableAutocompleteFieldBySchema from './components/forms/inputs/EditableAutocompleteFieldBySchema';
|
|
28
|
+
import AutocompleteFieldBySchema from './components/forms/inputs/AutocompleteFieldBySchema';
|
|
29
|
+
import FloatFieldBySchema from './components/forms/inputs/FloatFieldBySchema';
|
|
30
|
+
export { applyDefaultLeafletIcon } from './components/forms/inputs/leafletMarker';
|
|
31
|
+
export { getThemeTexts } from './styles/texts';
|
|
32
|
+
export type { DRFReactBySchemaTexts, GeometryTexts, FormTexts, AuthTexts } from './styles/texts';
|
|
33
|
+
import DetailBySchema from './components/details/DetailBySchema';
|
|
34
|
+
import DetailFieldBySchema from './components/details/DetailFieldBySchema';
|
|
35
|
+
export { DRFReactBySchemaProvider, useAPIWrapper, Form, DialogFormBySchema, ChangePasswordForm, ForgotPasswordForm, DataGridBySchemaEditable, GenericModelList, GenericRelatedModelList, DataTotals, DialogActions, FileTypeIcon, SelectEditInputCell, GridDateInput, GridDecimalInput, GridPatternInput, BooleanInputCell, FormWatcher, FormBySchema, FieldBySchema, TextFieldBySchema, BooleanFieldBySchema, DesktopDatePickerBySchema, DesktopDateTimePickerBySchema, EditableAutocompleteFieldBySchema, AutocompleteFieldBySchema, FloatFieldBySchema, DetailBySchema, DetailFieldBySchema, setAuthToken, emptyByType, getChoiceByValue, populateValues, enrichChoices, buildGenericYupValidationSchema, errorProps, getFieldErrorsFromResponse, getTmpId, isTmpId, getPatternFormat, clearJWT, hasJWT, slugToCamelCase, AUTH_EXPIRED_EVENT, };
|
|
36
|
+
export * from './@types/index';
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|