drf-react-by-schema 0.16.7 → 0.16.8
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/api.d.ts +13 -12
- package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts +1 -1
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts +4 -4
- package/dist/components/DataGridBySchemaEditable/utils.d.ts +2 -2
- package/dist/components/DataTotals.d.ts +2 -2
- package/dist/components/DataTotalsServer.d.ts +2 -2
- package/dist/components/DialogActions.d.ts +1 -1
- package/dist/components/FormButtons.d.ts +1 -1
- package/dist/components/GenericModelList.d.ts +2 -2
- package/dist/components/GenericRelatedModelList.d.ts +2 -2
- package/dist/components/details/DetailBySchema.d.ts +2 -2
- package/dist/components/details/DetailFieldBySchema.d.ts +2 -2
- package/dist/components/forms/DialogFormBySchema.d.ts +2 -2
- package/dist/components/forms/FieldBySchema.d.ts +2 -2
- package/dist/components/forms/FormBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/AutocompleteFieldBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/BooleanFieldBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/DesktopDatePickerBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts +2 -1
- package/dist/components/forms/inputs/FloatFieldBySchema.d.ts +2 -2
- package/dist/components/forms/inputs/TextFieldBySchema.d.ts +2 -2
- package/dist/context/APIWrapper.d.ts +1 -1
- package/dist/context/DRFReactBySchemaProvider.d.ts +1 -1
- package/dist/context/Form.d.ts +1 -1
- package/dist/context/Overlays.d.ts +1 -1
- package/dist/styles/layout.d.ts +1 -1
- package/dist/styles/theme.d.ts +1 -1
- package/dist/utils.d.ts +5 -4
- package/dist/utils.js +16 -12
- package/package.json +1 -1
- package/dist/components/DialogJSONSchemaForm.d.ts +0 -13
- package/dist/components/DialogJSONSchemaForm.js +0 -20
package/dist/api.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
1
2
|
import { serverEndPointType } from './context/DRFReactBySchemaContext';
|
|
2
3
|
import { Item, SchemaType, modelOptionsType, DataSchemaColumnsType, ItemSchemaColumnsType, Id, TargetApiParams } from './utils';
|
|
3
4
|
import { GridFilterModel, GridSortModel } from '@mui/x-data-grid';
|
|
@@ -11,17 +12,17 @@ interface TargetApiParamsOptionalId {
|
|
|
11
12
|
export declare const getRawData: ({ path, serverEndPoint, }: {
|
|
12
13
|
path: string;
|
|
13
14
|
serverEndPoint: serverEndPointType | null;
|
|
14
|
-
}) => Promise<any
|
|
15
|
+
}) => Promise<Item[] | AxiosError<unknown, any>>;
|
|
15
16
|
/**
|
|
16
17
|
*
|
|
17
18
|
* @param options - params
|
|
18
19
|
* @returns updatedData when succesfully updated, axiosError otherwise
|
|
19
20
|
*/
|
|
20
|
-
export declare const updateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<
|
|
21
|
-
export declare const partialUpdateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<
|
|
22
|
-
export declare const createData: ({ path, serverEndPoint, data }: Omit<TargetApiParams, 'id'>) => Promise<
|
|
23
|
-
export declare const deleteData: (path: string, serverEndPoint: serverEndPointType | null, id: Id) => Promise<any
|
|
24
|
-
export declare const createOrUpdateData: ({ path, serverEndPoint, data, id, }: TargetApiParamsOptionalId) => Promise<
|
|
21
|
+
export declare const updateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<Item>;
|
|
22
|
+
export declare const partialUpdateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<Item>;
|
|
23
|
+
export declare const createData: ({ path, serverEndPoint, data }: Omit<TargetApiParams, 'id'>) => Promise<Item>;
|
|
24
|
+
export declare const deleteData: (path: string, serverEndPoint: serverEndPointType | null, id: Id) => Promise<true | AxiosError<unknown, any>>;
|
|
25
|
+
export declare const createOrUpdateData: ({ path, serverEndPoint, data, id, }: TargetApiParamsOptionalId) => Promise<Item>;
|
|
25
26
|
export declare const updateDataBySchema: ({ model, modelObjectId, serverEndPoint, data, schema, path, }: {
|
|
26
27
|
model: string;
|
|
27
28
|
modelObjectId: Id;
|
|
@@ -29,24 +30,24 @@ export declare const updateDataBySchema: ({ model, modelObjectId, serverEndPoint
|
|
|
29
30
|
data: Item;
|
|
30
31
|
schema: SchemaType;
|
|
31
32
|
path?: string | null | undefined;
|
|
32
|
-
}) => Promise<
|
|
33
|
+
}) => Promise<Item>;
|
|
33
34
|
export declare const addExistingRelatedModel: ({ model, serverEndPoint, id, data, }: {
|
|
34
35
|
model: string;
|
|
35
36
|
serverEndPoint: serverEndPointType | null;
|
|
36
37
|
id: Id;
|
|
37
38
|
data: Item;
|
|
38
|
-
}) => Promise<
|
|
39
|
+
}) => Promise<Item>;
|
|
39
40
|
export declare const getAutoComplete: ({ model, serverEndPoint, }: {
|
|
40
41
|
model: string;
|
|
41
42
|
serverEndPoint: serverEndPointType | null;
|
|
42
43
|
}) => Promise<false | Item[]>;
|
|
43
|
-
export declare const loginByPayload: (payload: Item, serverEndPoint: serverEndPointType | null) => Promise<any
|
|
44
|
+
export declare const loginByPayload: (payload: Item, serverEndPoint: serverEndPointType | null) => Promise<boolean | AxiosError<unknown, any>>;
|
|
44
45
|
export declare const clearJWT: () => boolean;
|
|
45
46
|
export declare const hasJWT: () => boolean;
|
|
46
47
|
export declare const setAuthToken: (token: string | null) => void;
|
|
47
48
|
export declare const isLoggedIn: (serverEndPoint: serverEndPointType | null) => Promise<false | Item>;
|
|
48
|
-
export declare const getSignUpOptions: (serverEndPoint: serverEndPointType | null) => Promise<any
|
|
49
|
-
export declare const signUp: (data: Item, serverEndPoint: serverEndPointType | null) => Promise<
|
|
49
|
+
export declare const getSignUpOptions: (serverEndPoint: serverEndPointType | null) => Promise<SchemaType | AxiosError<unknown, any>>;
|
|
50
|
+
export declare const signUp: (data: Item, serverEndPoint: serverEndPointType | null) => Promise<Item>;
|
|
50
51
|
export interface GetGenericModelListProps {
|
|
51
52
|
model: string;
|
|
52
53
|
serverEndPoint: serverEndPointType | null;
|
|
@@ -84,5 +85,5 @@ export declare const getGenericModel: ({ model, serverEndPoint, id, relatedModel
|
|
|
84
85
|
relatedModel?: string | undefined;
|
|
85
86
|
relatedModelId?: string | undefined;
|
|
86
87
|
}) => Promise<false | ItemSchemaColumnsType>;
|
|
87
|
-
export declare const getAllModels: (serverEndPoint: serverEndPointType | null) => Promise<any
|
|
88
|
+
export declare const getAllModels: (serverEndPoint: serverEndPointType | null) => Promise<Item[] | AxiosError<unknown, any>>;
|
|
88
89
|
export {};
|
|
@@ -4,5 +4,5 @@ type FConfirmDialogProps = {
|
|
|
4
4
|
onClose: (p: any) => void;
|
|
5
5
|
onConfirm: (p: any) => void;
|
|
6
6
|
};
|
|
7
|
-
export declare const ConfirmDialog: React.MemoExoticComponent<({ open, onClose, onConfirm }: FConfirmDialogProps) => JSX.Element>;
|
|
7
|
+
export declare const ConfirmDialog: React.MemoExoticComponent<({ open, onClose, onConfirm }: FConfirmDialogProps) => React.JSX.Element>;
|
|
8
8
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { BulkDeleteData, BulkUpdateData, GridEnrichedBySchemaColDef, Id, Item, OnSelectActions } from '../../utils';
|
|
3
3
|
type CustomToolbarProps = {
|
|
4
4
|
preparedColumns: GridEnrichedBySchemaColDef[];
|
|
@@ -14,5 +14,5 @@ type CustomToolbarProps = {
|
|
|
14
14
|
*
|
|
15
15
|
* @returns Custom Toolbar for the grid
|
|
16
16
|
*/
|
|
17
|
-
export declare const CustomToolbar: ({ preparedColumns, setPreparedColumns, onSelectActions, selectionModel, bulkUpdateData, bulkDeleteData, bulkCreateData, }: CustomToolbarProps) => JSX.Element;
|
|
17
|
+
export declare const CustomToolbar: ({ preparedColumns, setPreparedColumns, onSelectActions, selectionModel, bulkUpdateData, bulkDeleteData, bulkCreateData, }: CustomToolbarProps) => React.JSX.Element;
|
|
18
18
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type FooterToolbarProps = {
|
|
3
3
|
isEditable: boolean;
|
|
4
4
|
handleAddItem: () => void;
|
|
5
5
|
};
|
|
6
|
-
export declare const FooterToolbar: ({ isEditable, handleAddItem }: FooterToolbarProps) => JSX.Element;
|
|
6
|
+
export declare const FooterToolbar: ({ isEditable, handleAddItem }: FooterToolbarProps) => React.JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { CalendarPickerView } from '@mui/x-date-pickers/CalendarPicker';
|
|
3
3
|
type GridDateInputProps = {
|
|
4
4
|
field: string;
|
|
@@ -7,5 +7,5 @@ type GridDateInputProps = {
|
|
|
7
7
|
column: object;
|
|
8
8
|
dateViews?: CalendarPickerView[] | undefined;
|
|
9
9
|
};
|
|
10
|
-
export declare const GridDateInput: ({ id, value, field, dateViews, }: GridDateInputProps) => JSX.Element;
|
|
10
|
+
export declare const GridDateInput: ({ id, value, field, dateViews, }: GridDateInputProps) => React.JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type GridDecimalInputProps = {
|
|
3
3
|
field: string;
|
|
4
4
|
id: number | string;
|
|
@@ -9,5 +9,5 @@ type GridDecimalInputProps = {
|
|
|
9
9
|
suffix?: string;
|
|
10
10
|
isCurrency?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare const GridDecimalInput: ({ id, value, field, decimalPlaces, prefix, suffix, isCurrency, }: GridDecimalInputProps) => JSX.Element;
|
|
12
|
+
export declare const GridDecimalInput: ({ id, value, field, decimalPlaces, prefix, suffix, isCurrency, }: GridDecimalInputProps) => React.JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
type GridPatternInputProps = {
|
|
3
3
|
field: string;
|
|
4
4
|
id: number | string;
|
|
5
5
|
value?: string | number | null;
|
|
6
6
|
patternFormat?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const GridPatternInput: ({ id, value, field, patternFormat, }: GridPatternInputProps) => JSX.Element;
|
|
8
|
+
export declare const GridPatternInput: ({ id, value, field, patternFormat, }: GridPatternInputProps) => React.JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const InputNumberInterval: (props: any) => JSX.Element;
|
|
3
|
-
export declare const InputDateInterval: (props: any) => JSX.Element;
|
|
4
|
-
export declare const InputFloatInterval: (props: any) => JSX.Element;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const InputNumberInterval: (props: any) => React.JSX.Element;
|
|
3
|
+
export declare const InputDateInterval: (props: any) => React.JSX.Element;
|
|
4
|
+
export declare const InputFloatInterval: (props: any) => React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { GridApi } from '@mui/x-data-grid';
|
|
2
|
+
import { GridApi, GridFilterOperator } from '@mui/x-data-grid';
|
|
3
3
|
import { GridEnrichedBySchemaColDef } from '../../utils';
|
|
4
4
|
export type ResizeType = 'condense' | 'maxContent' | 'fitScreen';
|
|
5
5
|
/**
|
|
@@ -12,4 +12,4 @@ export type ResizeType = 'condense' | 'maxContent' | 'fitScreen';
|
|
|
12
12
|
export declare function resizeColumns(columns: GridEnrichedBySchemaColDef[], resizeType: ResizeType, apiRef: React.MutableRefObject<GridApi>): GridEnrichedBySchemaColDef[];
|
|
13
13
|
export declare const quantityOnlyOperators: ({ type }: {
|
|
14
14
|
type: string;
|
|
15
|
-
}) => GridFilterOperator[];
|
|
15
|
+
}) => GridFilterOperator<any, any, any>[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { GridRowId } from '@mui/x-data-grid';
|
|
3
3
|
import { Item } from '../utils';
|
|
4
4
|
import { SumRowsType } from '../api';
|
|
@@ -7,5 +7,5 @@ interface DataTotalsProps {
|
|
|
7
7
|
sumRows?: SumRowsType;
|
|
8
8
|
visibleRows: GridRowId[];
|
|
9
9
|
}
|
|
10
|
-
declare const DataTotals: ({ data, sumRows, visibleRows }: DataTotalsProps) => JSX.Element;
|
|
10
|
+
declare const DataTotals: ({ data, sumRows, visibleRows }: DataTotalsProps) => React.JSX.Element;
|
|
11
11
|
export default DataTotals;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { SumRowsType } from '../api';
|
|
3
3
|
interface DataTotalsServerProps {
|
|
4
4
|
sumRows?: SumRowsType;
|
|
5
5
|
totals?: null | Record<string, number>;
|
|
6
6
|
}
|
|
7
|
-
declare const DataTotalsServer: ({ sumRows, totals }: DataTotalsServerProps) => JSX.Element;
|
|
7
|
+
declare const DataTotalsServer: ({ sumRows, totals }: DataTotalsServerProps) => React.JSX.Element;
|
|
8
8
|
export default DataTotalsServer;
|
|
@@ -6,5 +6,5 @@ interface DialogActionsProps {
|
|
|
6
6
|
btnCancel?: string;
|
|
7
7
|
btnConfirm?: string;
|
|
8
8
|
}
|
|
9
|
-
export default function DialogActions({ setDialog, handleSave, btnCancel, btnConfirm, }: DialogActionsProps): JSX.Element;
|
|
9
|
+
export default function DialogActions({ setDialog, handleSave, btnCancel, btnConfirm, }: DialogActionsProps): React.JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -17,5 +17,5 @@ interface FormButtonsProps {
|
|
|
17
17
|
saveAndContinue?: boolean;
|
|
18
18
|
sx?: any;
|
|
19
19
|
}
|
|
20
|
-
export default function FormButtons({ model, objId, title, formDisabled, cancelBtn, cancelBtnLabel, deleteBtnLabel, saveAndCreateNewBtnLabel, saveAndContinueBtnLabel, saveBtnLabel, onSuccess, bottom, borderBottom, saveAndContinue, sx }: FormButtonsProps): JSX.Element;
|
|
20
|
+
export default function FormButtons({ model, objId, title, formDisabled, cancelBtn, cancelBtnLabel, deleteBtnLabel, saveAndCreateNewBtnLabel, saveAndContinueBtnLabel, saveBtnLabel, onSuccess, bottom, borderBottom, saveAndContinue, sx }: FormButtonsProps): React.JSX.Element;
|
|
21
21
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { GridFilterModel, GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
3
|
import { GridEnrichedBySchemaColDef, ActionType, Item, OnSelectActions, OptionsAC, FormFieldLayout } from '../utils';
|
|
4
4
|
import { SumRowsType } from '../api';
|
|
@@ -37,5 +37,5 @@ interface GenericModelListProps {
|
|
|
37
37
|
defaultValues?: Item;
|
|
38
38
|
disableScreenLoading?: boolean;
|
|
39
39
|
}
|
|
40
|
-
declare const GenericModelList: ({ model, columnFields, hiddenFields, creatableFields, disabledFields, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, onProcessRow, reloadAfterRowUpdate, customColumnOperations, customFieldFormLayouts, customLinkDestination, isEditable, hasBulkSelect, onSelectActions, sumRows, isAutoHeight, forceReload, LinkComponent, hasHeader, paginationMode, defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, defaultValues, disableScreenLoading, }: GenericModelListProps) => JSX.Element;
|
|
40
|
+
declare const GenericModelList: ({ model, columnFields, hiddenFields, creatableFields, disabledFields, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, onProcessRow, reloadAfterRowUpdate, customColumnOperations, customFieldFormLayouts, customLinkDestination, isEditable, hasBulkSelect, onSelectActions, sumRows, isAutoHeight, forceReload, LinkComponent, hasHeader, paginationMode, defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, defaultValues, disableScreenLoading, }: GenericModelListProps) => React.JSX.Element;
|
|
41
41
|
export default GenericModelList;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { GridFilterModel } from '@mui/x-data-grid';
|
|
3
3
|
import { ActionType, GridEnrichedBySchemaColDef, Id, Item, OnSelectActions, OptionsAC } from '../utils';
|
|
4
4
|
import { SumRowsType } from '../api';
|
|
@@ -38,5 +38,5 @@ interface GenericRelatedModelListProps {
|
|
|
38
38
|
defaultValues?: Item;
|
|
39
39
|
LinkComponent?: any | null;
|
|
40
40
|
}
|
|
41
|
-
export default function GenericRelatedModelList({ model, id, relatedModel, columnFields, hiddenFields, creatableFields, disabledFields, usuaria, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, label, onProcessRow, reloadAfterRowUpdate, customColumnOperations, isEditable, hasBulkSelect, onSelectActions, sumRows, isAutoHeight, isInBatches, noCardWrapper, paginationMode, defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, defaultValues, LinkComponent, }: GenericRelatedModelListProps): JSX.Element;
|
|
41
|
+
export default function GenericRelatedModelList({ model, id, relatedModel, columnFields, hiddenFields, creatableFields, disabledFields, usuaria, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, label, onProcessRow, reloadAfterRowUpdate, customColumnOperations, isEditable, hasBulkSelect, onSelectActions, sumRows, isAutoHeight, isInBatches, noCardWrapper, paginationMode, defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, defaultValues, LinkComponent, }: GenericRelatedModelListProps): React.JSX.Element;
|
|
42
42
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { DetailBySchemaProps } from '../../utils';
|
|
3
|
-
export default function DetailBySchema({ values, schema, editLink, editLabel, labelKey, decimalScale, fieldsLayout: fieldsLayoutInitial, fieldsProps, sxRow, sxRowMultiple, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }: DetailBySchemaProps): JSX.Element;
|
|
3
|
+
export default function DetailBySchema({ values, schema, editLink, editLabel, labelKey, decimalScale, fieldsLayout: fieldsLayoutInitial, fieldsProps, sxRow, sxRowMultiple, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }: DetailBySchemaProps): React.JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { DetailFieldBySchemaProps } from '../../utils';
|
|
3
|
-
export default function DetailFieldBySchema({ name, value, schema, labelKey, optionIdKey, optionLabelKey, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }: DetailFieldBySchemaProps): JSX.Element;
|
|
3
|
+
export default function DetailFieldBySchema({ name, value, schema, labelKey, optionIdKey, optionLabelKey, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }: DetailFieldBySchemaProps): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { AnyObjectSchema } from 'yup';
|
|
3
3
|
import { FormFieldLayout, Item, SchemaType } from '../../utils';
|
|
4
4
|
import { DialogType } from '../../context/APIWrapperContext';
|
|
@@ -11,5 +11,5 @@ interface DialogFormBySchemaProps {
|
|
|
11
11
|
getAutoComplete: (model: string) => Promise<false | Item[]>;
|
|
12
12
|
fieldsLayout?: FormFieldLayout[];
|
|
13
13
|
}
|
|
14
|
-
export default function DialogFormBySchema({ schema, validationSchema, initialValues, onEditModelSave, setDialog, getAutoComplete, fieldsLayout, }: DialogFormBySchemaProps): JSX.Element;
|
|
14
|
+
export default function DialogFormBySchema({ schema, validationSchema, initialValues, onEditModelSave, setDialog, getAutoComplete, fieldsLayout, }: DialogFormBySchemaProps): React.JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FieldBySchemaProps } from '../../utils';
|
|
3
|
-
export default function FieldBySchema({ name, schema, control, errors, multiline, setValue, getValues, fieldKey, labelKey, index, optionsAC, optionsModel, getOptionLabel, renderOption, onEditModel, fieldsLayout, sx, options, isSemaphoric, label, onValueChange, decimalScale, ...other }: FieldBySchemaProps): JSX.Element;
|
|
3
|
+
export default function FieldBySchema({ name, schema, control, errors, multiline, setValue, getValues, fieldKey, labelKey, index, optionsAC, optionsModel, getOptionLabel, renderOption, onEditModel, fieldsLayout, sx, options, isSemaphoric, label, onValueChange, decimalScale, ...other }: FieldBySchemaProps): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { UseFormRegister } from 'react-hook-form';
|
|
3
3
|
import { CommonFieldProps, FieldBySchemaProps, FormFieldLayout, Item, OptionsAC } from '../../utils';
|
|
4
4
|
interface FormBySchemaProps extends Omit<FieldBySchemaProps, 'name'> {
|
|
@@ -12,5 +12,5 @@ interface FormBySchemaProps extends Omit<FieldBySchemaProps, 'name'> {
|
|
|
12
12
|
fieldsProps?: Record<string, CommonFieldProps>;
|
|
13
13
|
relatedEditable?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export default function FormBySchema({ schema, control, errors, register, multiline, setValue, getValues, fieldKey, labelKey, index, optionsAC, setOptionsAC, forceReload, optionsModel, getOptionLabel, renderOption, onEditModel, options, isSemaphoric, label, decimalScale, fieldsLayout: fieldsLayoutInitial, customFieldFormLayouts, fieldsProps, hiddenFields, isolatedGetAutoComplete, relatedEditable, }: FormBySchemaProps): JSX.Element;
|
|
15
|
+
export default function FormBySchema({ schema, control, errors, register, multiline, setValue, getValues, fieldKey, labelKey, index, optionsAC, setOptionsAC, forceReload, optionsModel, getOptionLabel, renderOption, onEditModel, options, isSemaphoric, label, decimalScale, fieldsLayout: fieldsLayoutInitial, customFieldFormLayouts, fieldsProps, hiddenFields, isolatedGetAutoComplete, relatedEditable, }: FormBySchemaProps): React.JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FieldBySchemaProps } from '../../../utils';
|
|
3
|
-
export default function AutocompleteFieldBySchema({ fieldKey, index, name, schema, control, errors, optionIdKey, optionLabelKey, options, isSemaphoric, sx, onValueChange, ...other }: FieldBySchemaProps): JSX.Element;
|
|
3
|
+
export default function AutocompleteFieldBySchema({ fieldKey, index, name, schema, control, errors, optionIdKey, optionLabelKey, options, isSemaphoric, sx, onValueChange, ...other }: FieldBySchemaProps): React.JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FieldBySchemaProps } from '../../../utils';
|
|
3
|
-
export default function BooleanFieldBySchema({ name, schema, control, fieldKey, index, sx, onValueChange, ...other }: FieldBySchemaProps): JSX.Element;
|
|
3
|
+
export default function BooleanFieldBySchema({ name, schema, control, fieldKey, index, sx, onValueChange, ...other }: FieldBySchemaProps): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import 'dayjs/locale/pt-br';
|
|
3
3
|
import { FieldBySchemaProps } from '../../../utils';
|
|
4
|
-
export default function DesktopDatePickerBySchema({ name, schema, control, errors, fieldKey, index, sx, ...other }: FieldBySchemaProps): JSX.Element;
|
|
4
|
+
export default function DesktopDatePickerBySchema({ name, schema, control, errors, fieldKey, index, sx, ...other }: FieldBySchemaProps): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import 'dayjs/locale/pt-br';
|
|
3
3
|
import { FieldBySchemaProps } from '../../../utils';
|
|
4
|
-
export default function DesktopDateTimePickerBySchema({ name, schema, control, errors, fieldKey, index, sx, ...other }: FieldBySchemaProps): JSX.Element;
|
|
4
|
+
export default function DesktopDateTimePickerBySchema({ name, schema, control, errors, fieldKey, index, sx, ...other }: FieldBySchemaProps): React.JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import Autocomplete from '@mui/material/Autocomplete';
|
|
2
3
|
import { FieldBySchemaProps } from '../../../utils';
|
|
3
|
-
declare const EditableAutocompleteFieldBySchema: React.ForwardRefExoticComponent<FieldBySchemaProps & React.RefAttributes<
|
|
4
|
+
declare const EditableAutocompleteFieldBySchema: React.ForwardRefExoticComponent<FieldBySchemaProps & React.RefAttributes<typeof Autocomplete>>;
|
|
4
5
|
export default EditableAutocompleteFieldBySchema;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FieldBySchemaProps } from '../../../utils';
|
|
3
|
-
export default function FloatFieldBySchema({ fieldKey, index, name, control, schema, errors, onValueChange, decimalScale, label, ...other }: Omit<FieldBySchemaProps, 'type'>): JSX.Element;
|
|
3
|
+
export default function FloatFieldBySchema({ fieldKey, index, name, control, schema, errors, onValueChange, decimalScale, label, ...other }: Omit<FieldBySchemaProps, 'type'>): React.JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FieldBySchemaProps } from '../../../utils';
|
|
3
|
-
export default function TextFieldBySchema({ name, schema, control, errors, multiline, minRows, fieldKey, index, sx, isPassword, type, autocomplete, disabled, onValueChange, ...other }: FieldBySchemaProps): JSX.Element;
|
|
3
|
+
export default function TextFieldBySchema({ name, schema, control, errors, multiline, minRows, fieldKey, index, sx, isPassword, type, autocomplete, disabled, onValueChange, ...other }: FieldBySchemaProps): React.JSX.Element;
|
|
@@ -6,6 +6,6 @@ interface APIWrapperProps {
|
|
|
6
6
|
setDialog: (x: Partial<DialogType>) => void;
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}
|
|
9
|
-
declare function APIWrapper({ handleLoading, setSnackBar, setDialog, children }: APIWrapperProps): JSX.Element;
|
|
9
|
+
declare function APIWrapper({ handleLoading, setSnackBar, setDialog, children }: APIWrapperProps): React.JSX.Element;
|
|
10
10
|
declare const _default: React.MemoExoticComponent<typeof APIWrapper>;
|
|
11
11
|
export default _default;
|
|
@@ -9,5 +9,5 @@ interface DRFReactBySchemaProviderProps extends DRFReactBySchemaContextType {
|
|
|
9
9
|
* @param {*} props
|
|
10
10
|
* @returns {*}
|
|
11
11
|
*/
|
|
12
|
-
declare const DRFReactBySchemaProvider: ({ serverEndPoint, theme, isInBatches, firstBatchLength, children, }: DRFReactBySchemaProviderProps) => JSX.Element;
|
|
12
|
+
declare const DRFReactBySchemaProvider: ({ serverEndPoint, theme, isInBatches, firstBatchLength, children, }: DRFReactBySchemaProviderProps) => React.JSX.Element;
|
|
13
13
|
export default DRFReactBySchemaProvider;
|
package/dist/context/Form.d.ts
CHANGED
|
@@ -17,5 +17,5 @@ interface FormProps {
|
|
|
17
17
|
formButtonsSx?: any;
|
|
18
18
|
children: React.ReactNode;
|
|
19
19
|
}
|
|
20
|
-
export default function Form({ model, id, objTitleField, optionsACModels, cancelBtn, cancelBtnLabel, deleteBtnLabel, saveAndCreateNewBtnLabel, saveAndContinueBtnLabel, saveBtnLabel, onSuccess, borderBottom, saveAndContinue, formButtonsSx, children, }: FormProps): JSX.Element;
|
|
20
|
+
export default function Form({ model, id, objTitleField, optionsACModels, cancelBtn, cancelBtnLabel, deleteBtnLabel, saveAndCreateNewBtnLabel, saveAndContinueBtnLabel, saveBtnLabel, onSuccess, borderBottom, saveAndContinue, formButtonsSx, children, }: FormProps): React.JSX.Element;
|
|
21
21
|
export {};
|
package/dist/styles/layout.d.ts
CHANGED
package/dist/styles/theme.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import * as Yup from 'yup';
|
|
2
3
|
import { CalendarPickerView } from '@mui/x-date-pickers/CalendarPicker';
|
|
3
4
|
import { GridActionsColDef, GridColDef, GridFilterModel, GridSortModel } from '@mui/x-data-grid';
|
|
4
5
|
import { Control, FieldValues, UseFormGetValues, UseFormSetValue } from 'react-hook-form';
|
|
@@ -157,7 +158,7 @@ export declare const buildGenericYupValidationSchema: ({ data, schema, many, ski
|
|
|
157
158
|
many?: boolean | undefined;
|
|
158
159
|
skipFields?: string[] | undefined;
|
|
159
160
|
extraValidators?: Item | undefined;
|
|
160
|
-
}) =>
|
|
161
|
+
}) => Yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, Item>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, Item>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, Item>>> | Yup.ArraySchema<Yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, Item>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, Item>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, Item>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, Item>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, Item>>[] | undefined>;
|
|
161
162
|
export declare const errorProps: ({ errors, fieldKey, fieldKeyProp, index, }: {
|
|
162
163
|
errors: Item;
|
|
163
164
|
fieldKey: string;
|
|
@@ -172,10 +173,10 @@ export declare const isTmpId: (id: string | number | undefined | null) => boolea
|
|
|
172
173
|
export declare function reducer<T>(state: T | null, newState: Partial<T> | null): T | null;
|
|
173
174
|
export declare const getPatternFormat: (type: string) => string;
|
|
174
175
|
export type AddParametersToEnd<TFunction extends (...args: any) => any, TParameters extends [...args: any]> = (...args: [...Parameters<TFunction>, ...TParameters]) => ReturnType<TFunction>;
|
|
175
|
-
export declare function buildDateFormatBySchema(dateViews: string[] | null | undefined): "DD/MM/
|
|
176
|
+
export declare function buildDateFormatBySchema(dateViews: string[] | null | undefined): "DD/MM/YYYY" | "MM/YYYY" | "YYYY" | "MM" | "DD";
|
|
176
177
|
export declare const slugToCamelCase: (str: string) => string;
|
|
177
|
-
export declare const slugify: (text: string) =>
|
|
178
|
-
export declare function mergeFilterItems(defaultFilter: GridFilterModel | undefined, filter: GridFilterModel | undefined):
|
|
178
|
+
export declare const slugify: (text: string | null) => "" | undefined;
|
|
179
|
+
export declare function mergeFilterItems(defaultFilter: GridFilterModel | undefined, filter: GridFilterModel | undefined): GridFilterModel | undefined;
|
|
179
180
|
export type ActionType = 'editInline' | 'remove' | 'edit' | 'view';
|
|
180
181
|
export type BulkUpdateData = (newData: Item[]) => Promise<{
|
|
181
182
|
id: Id;
|
package/dist/utils.js
CHANGED
|
@@ -286,7 +286,7 @@ const getPatternFormat = (type) => {
|
|
|
286
286
|
};
|
|
287
287
|
exports.getPatternFormat = getPatternFormat;
|
|
288
288
|
function buildDateFormatBySchema(dateViews) {
|
|
289
|
-
const defaultFormat = 'DD/MM/
|
|
289
|
+
const defaultFormat = 'DD/MM/YYYY';
|
|
290
290
|
if (!dateViews) {
|
|
291
291
|
return defaultFormat;
|
|
292
292
|
}
|
|
@@ -297,10 +297,10 @@ function buildDateFormatBySchema(dateViews) {
|
|
|
297
297
|
return defaultFormat;
|
|
298
298
|
}
|
|
299
299
|
if (!hasDay && hasMonth && hasYear) {
|
|
300
|
-
return 'MM/
|
|
300
|
+
return 'MM/YYYY';
|
|
301
301
|
}
|
|
302
302
|
if (!hasDay && !hasMonth && hasYear) {
|
|
303
|
-
return '
|
|
303
|
+
return 'YYYY';
|
|
304
304
|
}
|
|
305
305
|
if (!hasDay && hasMonth && !hasYear) {
|
|
306
306
|
return 'MM';
|
|
@@ -318,15 +318,19 @@ const slugToCamelCase = (str) => {
|
|
|
318
318
|
return ret;
|
|
319
319
|
};
|
|
320
320
|
exports.slugToCamelCase = slugToCamelCase;
|
|
321
|
-
const slugify = (text) =>
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
321
|
+
const slugify = (text) => {
|
|
322
|
+
if (!text) {
|
|
323
|
+
return '';
|
|
324
|
+
}
|
|
325
|
+
text.toString()
|
|
326
|
+
.normalize('NFD')
|
|
327
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
328
|
+
.toLowerCase()
|
|
329
|
+
.trim()
|
|
330
|
+
.replace(/\s+/g, '-')
|
|
331
|
+
.replace(/[^\w-]+/g, '')
|
|
332
|
+
.replace(/--+/g, '-');
|
|
333
|
+
};
|
|
330
334
|
exports.slugify = slugify;
|
|
331
335
|
function mergeFilterItems(defaultFilter, filter) {
|
|
332
336
|
if (!filter && defaultFilter) {
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Item, SchemaType } from '../utils';
|
|
3
|
-
interface DialogJSONSchemaFormProps {
|
|
4
|
-
jsonSchemaFormRef: any;
|
|
5
|
-
schema: SchemaType;
|
|
6
|
-
uiSchema: SchemaType;
|
|
7
|
-
formData: Item;
|
|
8
|
-
onSubmit: ({ formData }: {
|
|
9
|
-
formData: Item;
|
|
10
|
-
}) => void;
|
|
11
|
-
}
|
|
12
|
-
export default function DialogJSONSchemaForm({ jsonSchemaFormRef, schema, uiSchema, formData, onSubmit }: DialogJSONSchemaFormProps): JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
8
|
-
const validator_ajv8_1 = __importDefault(require("@rjsf/validator-ajv8"));
|
|
9
|
-
const mui_1 = __importDefault(require("@rjsf/mui"));
|
|
10
|
-
;
|
|
11
|
-
function DialogJSONSchemaForm({ jsonSchemaFormRef, schema, uiSchema, formData, onSubmit }) {
|
|
12
|
-
return (react_1.default.createElement(mui_1.default
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
, {
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
ref: jsonSchemaFormRef, schema: schema, uiSchema: uiSchema, validator: validator_ajv8_1.default, formData: formData, onSubmit: onSubmit },
|
|
17
|
-
react_1.default.createElement(Button_1.default, { type: "submit", sx: { display: 'none' } }, "Salvar")));
|
|
18
|
-
}
|
|
19
|
-
exports.default = DialogJSONSchemaForm;
|
|
20
|
-
;
|