drf-react-by-schema 0.16.2 → 0.16.4
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 +12 -13
- 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/SelectEditInputCell.js +1 -1
- package/dist/components/DataGridBySchemaEditable/utils.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable.js +6 -6
- 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/DialogJSONSchemaForm.d.ts +13 -0
- package/dist/components/DialogJSONSchemaForm.js +20 -0
- package/dist/components/FormButtons.d.ts +1 -1
- package/dist/components/GenericModelList.d.ts +4 -3
- package/dist/components/GenericModelList.js +5 -1
- package/dist/components/GenericRelatedModelList.d.ts +3 -2
- package/dist/components/GenericRelatedModelList.js +15 -7
- 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 +1 -2
- 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 +2 -3
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AxiosError } from 'axios';
|
|
2
1
|
import { serverEndPointType } from './context/DRFReactBySchemaContext';
|
|
3
2
|
import { Item, SchemaType, modelOptionsType, DataSchemaColumnsType, ItemSchemaColumnsType, Id, TargetApiParams } from './utils';
|
|
4
3
|
import { GridFilterModel, GridSortModel } from '@mui/x-data-grid';
|
|
@@ -12,17 +11,17 @@ interface TargetApiParamsOptionalId {
|
|
|
12
11
|
export declare const getRawData: ({ path, serverEndPoint, }: {
|
|
13
12
|
path: string;
|
|
14
13
|
serverEndPoint: serverEndPointType | null;
|
|
15
|
-
}) => Promise<
|
|
14
|
+
}) => Promise<any>;
|
|
16
15
|
/**
|
|
17
16
|
*
|
|
18
17
|
* @param options - params
|
|
19
18
|
* @returns updatedData when succesfully updated, axiosError otherwise
|
|
20
19
|
*/
|
|
21
|
-
export declare const updateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<
|
|
22
|
-
export declare const partialUpdateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<
|
|
23
|
-
export declare const createData: ({ path, serverEndPoint, data }: Omit<TargetApiParams, 'id'>) => Promise<
|
|
24
|
-
export declare const deleteData: (path: string, serverEndPoint: serverEndPointType | null, id: Id) => Promise<
|
|
25
|
-
export declare const createOrUpdateData: ({ path, serverEndPoint, data, id, }: TargetApiParamsOptionalId) => Promise<
|
|
20
|
+
export declare const updateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<any>;
|
|
21
|
+
export declare const partialUpdateData: ({ path, serverEndPoint, data, id }: TargetApiParams) => Promise<any>;
|
|
22
|
+
export declare const createData: ({ path, serverEndPoint, data }: Omit<TargetApiParams, 'id'>) => Promise<any>;
|
|
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<any>;
|
|
26
25
|
export declare const updateDataBySchema: ({ model, modelObjectId, serverEndPoint, data, schema, path, }: {
|
|
27
26
|
model: string;
|
|
28
27
|
modelObjectId: Id;
|
|
@@ -30,24 +29,24 @@ export declare const updateDataBySchema: ({ model, modelObjectId, serverEndPoint
|
|
|
30
29
|
data: Item;
|
|
31
30
|
schema: SchemaType;
|
|
32
31
|
path?: string | null | undefined;
|
|
33
|
-
}) => Promise<
|
|
32
|
+
}) => Promise<any>;
|
|
34
33
|
export declare const addExistingRelatedModel: ({ model, serverEndPoint, id, data, }: {
|
|
35
34
|
model: string;
|
|
36
35
|
serverEndPoint: serverEndPointType | null;
|
|
37
36
|
id: Id;
|
|
38
37
|
data: Item;
|
|
39
|
-
}) => Promise<
|
|
38
|
+
}) => Promise<any>;
|
|
40
39
|
export declare const getAutoComplete: ({ model, serverEndPoint, }: {
|
|
41
40
|
model: string;
|
|
42
41
|
serverEndPoint: serverEndPointType | null;
|
|
43
42
|
}) => Promise<false | Item[]>;
|
|
44
|
-
export declare const loginByPayload: (payload: Item, serverEndPoint: serverEndPointType | null) => Promise<
|
|
43
|
+
export declare const loginByPayload: (payload: Item, serverEndPoint: serverEndPointType | null) => Promise<any>;
|
|
45
44
|
export declare const clearJWT: () => boolean;
|
|
46
45
|
export declare const hasJWT: () => boolean;
|
|
47
46
|
export declare const setAuthToken: (token: string | null) => void;
|
|
48
47
|
export declare const isLoggedIn: (serverEndPoint: serverEndPointType | null) => Promise<false | Item>;
|
|
49
|
-
export declare const getSignUpOptions: (serverEndPoint: serverEndPointType | null) => Promise<
|
|
50
|
-
export declare const signUp: (data: Item, serverEndPoint: serverEndPointType | null) => Promise<
|
|
48
|
+
export declare const getSignUpOptions: (serverEndPoint: serverEndPointType | null) => Promise<any>;
|
|
49
|
+
export declare const signUp: (data: Item, serverEndPoint: serverEndPointType | null) => Promise<any>;
|
|
51
50
|
export interface GetGenericModelListProps {
|
|
52
51
|
model: string;
|
|
53
52
|
serverEndPoint: serverEndPointType | null;
|
|
@@ -85,5 +84,5 @@ export declare const getGenericModel: ({ model, serverEndPoint, id, relatedModel
|
|
|
85
84
|
relatedModel?: string | undefined;
|
|
86
85
|
relatedModelId?: string | undefined;
|
|
87
86
|
}) => Promise<false | ItemSchemaColumnsType>;
|
|
88
|
-
export declare const getAllModels: (serverEndPoint: serverEndPointType | null) => Promise<
|
|
87
|
+
export declare const getAllModels: (serverEndPoint: serverEndPointType | null) => Promise<any>;
|
|
89
88
|
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) =>
|
|
7
|
+
export declare const ConfirmDialog: React.MemoExoticComponent<({ open, onClose, onConfirm }: FConfirmDialogProps) => JSX.Element>;
|
|
8
8
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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) =>
|
|
17
|
+
export declare const CustomToolbar: ({ preparedColumns, setPreparedColumns, onSelectActions, selectionModel, bulkUpdateData, bulkDeleteData, bulkCreateData, }: CustomToolbarProps) => JSX.Element;
|
|
18
18
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
type FooterToolbarProps = {
|
|
3
3
|
isEditable: boolean;
|
|
4
4
|
handleAddItem: () => void;
|
|
5
5
|
};
|
|
6
|
-
export declare const FooterToolbar: ({ isEditable, handleAddItem }: FooterToolbarProps) =>
|
|
6
|
+
export declare const FooterToolbar: ({ isEditable, handleAddItem }: FooterToolbarProps) => JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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) =>
|
|
10
|
+
export declare const GridDateInput: ({ id, value, field, dateViews, }: GridDateInputProps) => JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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) =>
|
|
12
|
+
export declare const GridDecimalInput: ({ id, value, field, decimalPlaces, prefix, suffix, isCurrency, }: GridDecimalInputProps) => JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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) =>
|
|
8
|
+
export declare const GridPatternInput: ({ id, value, field, patternFormat, }: GridPatternInputProps) => JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const InputNumberInterval: (props: any) =>
|
|
3
|
-
export declare const InputDateInterval: (props: any) =>
|
|
4
|
-
export declare const InputFloatInterval: (props: any) =>
|
|
1
|
+
/// <reference types="react" />
|
|
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;
|
|
@@ -94,7 +94,7 @@ function SelectEditInputCell({ field, id, value, column, type, optionsAC, isInde
|
|
|
94
94
|
return (react_1.default.createElement(Autocomplete_1.default, Object.assign({ key: field, id: field, value: value, options: optionsAC && optionsAC[field] ? optionsAC[field] : [], selectOnFocus: true, autoHighlight: true, multiple: multiple, isOptionEqualToValue: (option, value) => {
|
|
95
95
|
return option[labelKey] === value[labelKey];
|
|
96
96
|
}, getOptionLabel: (option) => {
|
|
97
|
-
return option[labelKey];
|
|
97
|
+
return option ? option[labelKey] : '';
|
|
98
98
|
}, onChange: (e, value) => {
|
|
99
99
|
// if (!column.creatable && !isIndexField) {
|
|
100
100
|
if (!column.creatable) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { GridApi
|
|
2
|
+
import { GridApi } 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[];
|
|
@@ -133,7 +133,7 @@ const DataGridBySchemaEditable = (0, react_1.forwardRef)(({ schema, data, rowCou
|
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
const initColumns = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
136
|
-
|
|
136
|
+
const actionCols = [];
|
|
137
137
|
if (isEditable) {
|
|
138
138
|
const handleSaveClick = (id) => () => {
|
|
139
139
|
if (id) {
|
|
@@ -157,7 +157,7 @@ const DataGridBySchemaEditable = (0, react_1.forwardRef)(({ schema, data, rowCou
|
|
|
157
157
|
setRowModesModel(Object.assign(Object.assign({}, rowModesModel), { [id]: { mode: x_data_grid_1.GridRowModes.Edit } }));
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
|
-
|
|
160
|
+
actionCols.push({
|
|
161
161
|
field: 'actions',
|
|
162
162
|
headerName: '',
|
|
163
163
|
type: 'actions',
|
|
@@ -209,7 +209,7 @@ const DataGridBySchemaEditable = (0, react_1.forwardRef)(({ schema, data, rowCou
|
|
|
209
209
|
},
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
cols = [...
|
|
212
|
+
const cols = [...actionCols, ...columns];
|
|
213
213
|
const colsPromises = cols.map((col) => __awaiter(void 0, void 0, void 0, function* () {
|
|
214
214
|
if (!schema[col.field]) {
|
|
215
215
|
return col;
|
|
@@ -407,8 +407,8 @@ const DataGridBySchemaEditable = (0, react_1.forwardRef)(({ schema, data, rowCou
|
|
|
407
407
|
// Finally!
|
|
408
408
|
return column;
|
|
409
409
|
}));
|
|
410
|
-
|
|
411
|
-
setPreparedColumns(
|
|
410
|
+
const finalCols = yield Promise.all(colsPromises);
|
|
411
|
+
setPreparedColumns(finalCols);
|
|
412
412
|
});
|
|
413
413
|
const handleAddItems = (numberOfRows = 1) => {
|
|
414
414
|
const newRows = [];
|
|
@@ -577,7 +577,7 @@ const DataGridBySchemaEditable = (0, react_1.forwardRef)(({ schema, data, rowCou
|
|
|
577
577
|
updateOptionsAC().then(() => {
|
|
578
578
|
initColumns();
|
|
579
579
|
});
|
|
580
|
-
}, [rowModesModel]);
|
|
580
|
+
}, [rowModesModel, columns]);
|
|
581
581
|
const processRowUpdate = (editedRow) => __awaiter(void 0, void 0, void 0, function* () {
|
|
582
582
|
if (!preparedColumns || !yupValidationSchema.current) {
|
|
583
583
|
return false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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) =>
|
|
10
|
+
declare const DataTotals: ({ data, sumRows, visibleRows }: DataTotalsProps) => JSX.Element;
|
|
11
11
|
export default DataTotals;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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) =>
|
|
7
|
+
declare const DataTotalsServer: ({ sumRows, totals }: DataTotalsServerProps) => 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):
|
|
9
|
+
export default function DialogActions({ setDialog, handleSave, btnCancel, btnConfirm, }: DialogActionsProps): JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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 {};
|
|
@@ -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
|
+
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
|
+
;
|
|
@@ -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):
|
|
20
|
+
export default function FormButtons({ model, objId, title, formDisabled, cancelBtn, cancelBtnLabel, deleteBtnLabel, saveAndCreateNewBtnLabel, saveAndContinueBtnLabel, saveBtnLabel, onSuccess, bottom, borderBottom, saveAndContinue, sx }: FormButtonsProps): JSX.Element;
|
|
21
21
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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';
|
|
@@ -14,6 +14,7 @@ interface GenericModelListProps {
|
|
|
14
14
|
indexFieldViewBasePath?: string;
|
|
15
15
|
addExistingModel?: string;
|
|
16
16
|
onProcessRow?: (p: Item) => void;
|
|
17
|
+
reloadAfterRowUpdate?: boolean;
|
|
17
18
|
customColumnOperations?: (column: GridEnrichedBySchemaColDef) => GridEnrichedBySchemaColDef | Promise<GridEnrichedBySchemaColDef>;
|
|
18
19
|
customFieldFormLayouts?: Record<string, FormFieldLayout[]>;
|
|
19
20
|
customLinkDestination?: (p: GridRenderCellParams) => string;
|
|
@@ -22,7 +23,7 @@ interface GenericModelListProps {
|
|
|
22
23
|
onSelectActions?: OnSelectActions[];
|
|
23
24
|
sumRows?: SumRowsType;
|
|
24
25
|
isAutoHeight?: boolean;
|
|
25
|
-
forceReload
|
|
26
|
+
forceReload?: boolean;
|
|
26
27
|
LinkComponent?: any | null;
|
|
27
28
|
hasHeader: boolean;
|
|
28
29
|
paginationMode: 'server' | 'client';
|
|
@@ -35,5 +36,5 @@ interface GenericModelListProps {
|
|
|
35
36
|
optionsAC?: OptionsAC;
|
|
36
37
|
disableScreenLoading?: boolean;
|
|
37
38
|
}
|
|
38
|
-
declare const GenericModelList: ({ model, columnFields, hiddenFields, creatableFields, disabledFields, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, onProcessRow, customColumnOperations, customFieldFormLayouts, customLinkDestination, isEditable, hasBulkSelect, onSelectActions, sumRows, isAutoHeight, forceReload, LinkComponent, hasHeader, paginationMode, defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, disableScreenLoading, }: GenericModelListProps) =>
|
|
39
|
+
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, disableScreenLoading, }: GenericModelListProps) => JSX.Element;
|
|
39
40
|
export default GenericModelList;
|
|
@@ -50,7 +50,7 @@ const utils_1 = require("../utils");
|
|
|
50
50
|
const api_1 = require("../api");
|
|
51
51
|
const DRFReactBySchemaContext_1 = require("../context/DRFReactBySchemaContext");
|
|
52
52
|
const APIWrapperContext_1 = require("../context/APIWrapperContext");
|
|
53
|
-
const GenericModelList = ({ model, columnFields, hiddenFields = [], creatableFields, disabledFields, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, onProcessRow, customColumnOperations, customFieldFormLayouts, customLinkDestination, isEditable, hasBulkSelect = false, onSelectActions, sumRows, isAutoHeight = true, forceReload = false, LinkComponent = null, hasHeader = false, paginationMode = 'client', defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, disableScreenLoading, }) => {
|
|
53
|
+
const GenericModelList = ({ model, columnFields, hiddenFields = [], creatableFields, disabledFields, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, onProcessRow, reloadAfterRowUpdate, customColumnOperations, customFieldFormLayouts, customLinkDestination, isEditable, hasBulkSelect = false, onSelectActions, sumRows, isAutoHeight = true, forceReload = false, LinkComponent = null, hasHeader = false, paginationMode = 'client', defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, disableScreenLoading, }) => {
|
|
54
54
|
const { serverEndPoint, isInBatches, firstBatchLength } = (0, DRFReactBySchemaContext_1.useDRFReactBySchema)();
|
|
55
55
|
const { onEditModel } = (0, APIWrapperContext_1.useAPIWrapper)();
|
|
56
56
|
const [data, setData] = (0, react_1.useState)(false);
|
|
@@ -152,6 +152,10 @@ const GenericModelList = ({ model, columnFields, hiddenFields = [], creatableFie
|
|
|
152
152
|
react_1.default.createElement(Button_1.default, { variant: "contained", size: "medium", sx: { alignSelf: 'stretch' }, startIcon: react_1.default.createElement(AddCircleOutline_1.default, null) }, "Adicionar")))))),
|
|
153
153
|
react_1.default.createElement(Box_1.default, { sx: tableAutoHeight ? {} : styles_1.Layout.dataGridWithTabs },
|
|
154
154
|
react_1.default.createElement(DataGridBySchemaEditable_1.default, { data: data.data, columns: data.columns, schema: data.schema || {}, model: model, loading: loading, indexField: indexField, indexFieldBasePath: indexFieldBasePath, indexFieldViewBasePath: indexFieldViewBasePath, addExistingModel: addExistingModel, isEditable: isEditable, hasBulkSelect: hasBulkSelect, onSelectActions: onSelectActions, onEditModel: onEditModel, isAutoHeight: isAutoHeight, tableAutoHeight: tableAutoHeight, customColumnOperations: finalCustomColumnOperations, customFieldFormLayouts: customFieldFormLayouts, setVisibleRows: setVisibleRows, hideFooterPagination: hideFooterPagination, hideFooterComponent: hideFooterComponent, hideToolbarComponent: hideToolbarComponent, customLinkDestination: customLinkDestination, actions: actions, optionsAC: optionsAC, onProcessRow: onProcessRow, onDataChange: (newData) => {
|
|
155
|
+
if (reloadAfterRowUpdate) {
|
|
156
|
+
loadObjectList();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
155
159
|
setData(Object.assign(Object.assign({}, data), { data: newData }));
|
|
156
160
|
}, LinkComponent: LinkComponent, paginationModel: paginationMode === 'server' ? paginationModel : undefined, setPaginationModel: paginationMode === 'server' ? setPaginationModel : undefined, rowCount: paginationMode === 'client'
|
|
157
161
|
? undefined
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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';
|
|
@@ -18,6 +18,7 @@ interface GenericRelatedModelListProps {
|
|
|
18
18
|
addExistingModel?: string;
|
|
19
19
|
label: string;
|
|
20
20
|
onProcessRow?: (p: Item) => void;
|
|
21
|
+
reloadAfterRowUpdate?: boolean;
|
|
21
22
|
customColumnOperations?: (column: GridEnrichedBySchemaColDef) => GridEnrichedBySchemaColDef | Promise<GridEnrichedBySchemaColDef>;
|
|
22
23
|
isEditable?: boolean;
|
|
23
24
|
hasBulkSelect?: boolean;
|
|
@@ -35,5 +36,5 @@ interface GenericRelatedModelListProps {
|
|
|
35
36
|
actions?: Partial<ActionType>[];
|
|
36
37
|
optionsAC?: OptionsAC;
|
|
37
38
|
}
|
|
38
|
-
export default function GenericRelatedModelList({ model, id, relatedModel, columnFields, hiddenFields, creatableFields, disabledFields, usuaria, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, label, onProcessRow, customColumnOperations, isEditable, hasBulkSelect, onSelectActions, sumRows, isAutoHeight, isInBatches, noCardWrapper, paginationMode, defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, }: GenericRelatedModelListProps):
|
|
39
|
+
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, }: GenericRelatedModelListProps): JSX.Element;
|
|
39
40
|
export {};
|
|
@@ -49,18 +49,16 @@ const APIWrapperContext_1 = require("../context/APIWrapperContext");
|
|
|
49
49
|
const utils_1 = require("../utils");
|
|
50
50
|
const api_1 = require("../api");
|
|
51
51
|
const styles_1 = require("../styles");
|
|
52
|
-
const ContentTable = ({ data, relatedModel, model, loading, id, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, isEditable, onEditModel, finalCustomColumnOperations, setVisibleRows, isAutoHeight, hideFooterPagination, hideFooterComponent, hideToolbarComponent, onProcessRow,
|
|
52
|
+
const ContentTable = ({ data, relatedModel, model, loading, id, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, isEditable, onEditModel, finalCustomColumnOperations, setVisibleRows, isAutoHeight, hideFooterPagination, hideFooterComponent, hideToolbarComponent, onProcessRow, onDataChange, sumRows, visibleRows, paginationMode = 'client', paginationModel, setPaginationModel, hasBulkSelect, onSelectActions, tableAutoHeight, actions, optionsAC, }) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
53
53
|
data.columns ? (react_1.default.createElement(Box_1.default, { sx: tableAutoHeight ? {} : styles_1.Layout.dataGridFixedHeight },
|
|
54
|
-
react_1.default.createElement(DataGridBySchemaEditable_1.default, { data: data.data, columns: data.columns, schema: data.schema, model: relatedModel, modelParent: model, modelParentId: id, loading: loading, indexField: indexField, indexFieldBasePath: indexFieldBasePath, indexFieldViewBasePath: indexFieldViewBasePath, addExistingModel: addExistingModel, isEditable: isEditable, hasBulkSelect: hasBulkSelect, onSelectActions: onSelectActions, onEditModel: onEditModel, isAutoHeight: isAutoHeight, tableAutoHeight: tableAutoHeight, customColumnOperations: finalCustomColumnOperations, setVisibleRows: setVisibleRows, hideFooterPagination: hideFooterPagination, hideFooterComponent: hideFooterComponent, hideToolbarComponent: hideToolbarComponent, actions: actions, optionsAC: optionsAC, onProcessRow: onProcessRow, onDataChange:
|
|
55
|
-
setData(Object.assign(Object.assign({}, data), { data: newData }));
|
|
56
|
-
}, paginationModel: paginationMode === 'server' ? paginationModel : undefined, setPaginationModel: paginationMode === 'server' ? setPaginationModel : undefined, rowCount: paginationMode === 'client'
|
|
54
|
+
react_1.default.createElement(DataGridBySchemaEditable_1.default, { data: data.data, columns: data.columns, schema: data.schema, model: relatedModel, modelParent: model, modelParentId: id, loading: loading, indexField: indexField, indexFieldBasePath: indexFieldBasePath, indexFieldViewBasePath: indexFieldViewBasePath, addExistingModel: addExistingModel, isEditable: isEditable, hasBulkSelect: hasBulkSelect, onSelectActions: onSelectActions, onEditModel: onEditModel, isAutoHeight: isAutoHeight, tableAutoHeight: tableAutoHeight, customColumnOperations: finalCustomColumnOperations, setVisibleRows: setVisibleRows, hideFooterPagination: hideFooterPagination, hideFooterComponent: hideFooterComponent, hideToolbarComponent: hideToolbarComponent, actions: actions, optionsAC: optionsAC, onProcessRow: onProcessRow, onDataChange: onDataChange, paginationModel: paginationMode === 'server' ? paginationModel : undefined, setPaginationModel: paginationMode === 'server' ? setPaginationModel : undefined, rowCount: paginationMode === 'client'
|
|
57
55
|
? undefined
|
|
58
56
|
: typeof data.rowCount !== undefined
|
|
59
57
|
? data.rowCount
|
|
60
58
|
: 0 }))) : (react_1.default.createElement(Backdrop_1.default, { invisible: true, sx: { color: '#fff', zIndex: (theme) => theme.zIndex.drawer + 1 }, open: loading || false },
|
|
61
59
|
react_1.default.createElement(CircularProgress_1.default, null))),
|
|
62
60
|
paginationMode === 'client' ? (react_1.default.createElement(DataTotals_1.default, { data: data.data, sumRows: sumRows, visibleRows: visibleRows })) : (react_1.default.createElement(DataTotalsServer_1.default, { sumRows: sumRows, totals: data.sumRowsTotals }))));
|
|
63
|
-
function GenericRelatedModelList({ model, id, relatedModel, columnFields, hiddenFields, creatableFields, disabledFields, usuaria = null, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, label, onProcessRow, customColumnOperations, isEditable = true, hasBulkSelect = false, onSelectActions, sumRows, isAutoHeight = false, isInBatches = true, noCardWrapper = false, paginationMode = 'client', defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, }) {
|
|
61
|
+
function GenericRelatedModelList({ model, id, relatedModel, columnFields, hiddenFields, creatableFields, disabledFields, usuaria = null, minWidthFields, indexField, indexFieldBasePath, indexFieldViewBasePath, addExistingModel, label, onProcessRow, reloadAfterRowUpdate, customColumnOperations, isEditable = true, hasBulkSelect = false, onSelectActions, sumRows, isAutoHeight = false, isInBatches = true, noCardWrapper = false, paginationMode = 'client', defaultFilter, queryParams, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions, optionsAC, }) {
|
|
64
62
|
const [data, setData] = (0, react_1.useState)(false);
|
|
65
63
|
const [visibleRows, setVisibleRows] = (0, react_1.useState)([]);
|
|
66
64
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
@@ -142,6 +140,16 @@ function GenericRelatedModelList({ model, id, relatedModel, columnFields, hidden
|
|
|
142
140
|
break;
|
|
143
141
|
}
|
|
144
142
|
});
|
|
143
|
+
const onDataChange = (newData) => {
|
|
144
|
+
if (!data) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (reloadAfterRowUpdate) {
|
|
148
|
+
loadObjectList();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
setData(Object.assign(Object.assign({}, data), { data: newData }));
|
|
152
|
+
};
|
|
145
153
|
(0, react_1.useEffect)(() => {
|
|
146
154
|
loadObjectList();
|
|
147
155
|
}, [model, defaultFilter, queryParams]);
|
|
@@ -150,9 +158,9 @@ function GenericRelatedModelList({ model, id, relatedModel, columnFields, hidden
|
|
|
150
158
|
loadObjectList();
|
|
151
159
|
}
|
|
152
160
|
}, [paginationModel]);
|
|
153
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, typeof data !== 'boolean' && data.columns && (react_1.default.createElement(react_1.default.Fragment, null, noCardWrapper ? (react_1.default.createElement(ContentTable, { data: data, relatedModel: relatedModel, model: model, loading: loading, id: id, indexField: indexField || '', indexFieldBasePath: indexFieldBasePath, indexFieldViewBasePath: indexFieldViewBasePath, addExistingModel: addExistingModel, isEditable: isEditable, hasBulkSelect: hasBulkSelect, onSelectActions: onSelectActions, onEditModel: onEditModel, onDeleteRelatedModel: onDeleteRelatedModel, finalCustomColumnOperations: finalCustomColumnOperations, setVisibleRows: setVisibleRows, isAutoHeight: isAutoHeight, tableAutoHeight: tableAutoHeight, hideFooterPagination: hideFooterPagination, hideFooterComponent: hideFooterComponent, hideToolbarComponent: hideToolbarComponent, onProcessRow: onProcessRow,
|
|
161
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, typeof data !== 'boolean' && data.columns && (react_1.default.createElement(react_1.default.Fragment, null, noCardWrapper ? (react_1.default.createElement(ContentTable, { data: data, relatedModel: relatedModel, model: model, loading: loading, id: id, indexField: indexField || '', indexFieldBasePath: indexFieldBasePath, indexFieldViewBasePath: indexFieldViewBasePath, addExistingModel: addExistingModel, isEditable: isEditable, hasBulkSelect: hasBulkSelect, onSelectActions: onSelectActions, onEditModel: onEditModel, onDeleteRelatedModel: onDeleteRelatedModel, finalCustomColumnOperations: finalCustomColumnOperations, setVisibleRows: setVisibleRows, isAutoHeight: isAutoHeight, tableAutoHeight: tableAutoHeight, hideFooterPagination: hideFooterPagination, hideFooterComponent: hideFooterComponent, hideToolbarComponent: hideToolbarComponent, onProcessRow: onProcessRow, onDataChange: onDataChange, sumRows: sumRows, visibleRows: visibleRows, paginationMode: paginationMode, paginationModel: paginationModel, setPaginationModel: setPaginationModel, actions: actions, optionsAC: optionsAC })) : (react_1.default.createElement(Card_1.default, { sx: styles_1.Layout.formCard },
|
|
154
162
|
react_1.default.createElement(CardHeader_1.default, { title: label }),
|
|
155
163
|
react_1.default.createElement(CardContent_1.default, null,
|
|
156
|
-
react_1.default.createElement(ContentTable, { data: data, relatedModel: relatedModel, model: model, loading: loading, id: id, indexField: indexField || '', indexFieldBasePath: indexFieldBasePath, indexFieldViewBasePath: indexFieldViewBasePath, addExistingModel: addExistingModel, isEditable: isEditable, hasBulkSelect: hasBulkSelect, onSelectActions: onSelectActions, onEditModel: onEditModel, onDeleteRelatedModel: onDeleteRelatedModel, finalCustomColumnOperations: finalCustomColumnOperations, setVisibleRows: setVisibleRows, isAutoHeight: isAutoHeight, tableAutoHeight: tableAutoHeight, hideFooterPagination: hideFooterPagination, hideFooterComponent: hideFooterComponent, hideToolbarComponent: hideToolbarComponent, onProcessRow: onProcessRow,
|
|
164
|
+
react_1.default.createElement(ContentTable, { data: data, relatedModel: relatedModel, model: model, loading: loading, id: id, indexField: indexField || '', indexFieldBasePath: indexFieldBasePath, indexFieldViewBasePath: indexFieldViewBasePath, addExistingModel: addExistingModel, isEditable: isEditable, hasBulkSelect: hasBulkSelect, onSelectActions: onSelectActions, onEditModel: onEditModel, onDeleteRelatedModel: onDeleteRelatedModel, finalCustomColumnOperations: finalCustomColumnOperations, setVisibleRows: setVisibleRows, isAutoHeight: isAutoHeight, tableAutoHeight: tableAutoHeight, hideFooterPagination: hideFooterPagination, hideFooterComponent: hideFooterComponent, hideToolbarComponent: hideToolbarComponent, onProcessRow: onProcessRow, onDataChange: onDataChange, sumRows: sumRows, visibleRows: visibleRows, paginationMode: paginationMode, paginationModel: paginationModel, setPaginationModel: setPaginationModel, actions: actions, optionsAC: optionsAC }))))))));
|
|
157
165
|
}
|
|
158
166
|
exports.default = GenericRelatedModelList;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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):
|
|
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;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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):
|
|
3
|
+
export default function DetailFieldBySchema({ name, value, schema, labelKey, optionIdKey, optionLabelKey, sxField, sxLabel, sxValue, sxValueList, sxValueListItem, sxValueListItemText, }: DetailFieldBySchemaProps): JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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):
|
|
14
|
+
export default function DialogFormBySchema({ schema, validationSchema, initialValues, onEditModelSave, setDialog, getAutoComplete, fieldsLayout, }: DialogFormBySchemaProps): JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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):
|
|
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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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):
|
|
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;
|
|
16
16
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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):
|
|
3
|
+
export default function AutocompleteFieldBySchema({ fieldKey, index, name, schema, control, errors, optionIdKey, optionLabelKey, options, isSemaphoric, sx, onValueChange, ...other }: FieldBySchemaProps): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { FieldBySchemaProps } from '../../../utils';
|
|
3
|
-
export default function BooleanFieldBySchema({ name, schema, control, fieldKey, index, sx, onValueChange, ...other }: FieldBySchemaProps):
|
|
3
|
+
export default function BooleanFieldBySchema({ name, schema, control, fieldKey, index, sx, onValueChange, ...other }: FieldBySchemaProps): JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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):
|
|
4
|
+
export default function DesktopDatePickerBySchema({ name, schema, control, errors, fieldKey, index, sx, ...other }: FieldBySchemaProps): JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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):
|
|
4
|
+
export default function DesktopDateTimePickerBySchema({ name, schema, control, errors, fieldKey, index, sx, ...other }: FieldBySchemaProps): JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Autocomplete from '@mui/material/Autocomplete';
|
|
3
2
|
import { FieldBySchemaProps } from '../../../utils';
|
|
4
|
-
declare const EditableAutocompleteFieldBySchema: React.ForwardRefExoticComponent<FieldBySchemaProps & React.RefAttributes<
|
|
3
|
+
declare const EditableAutocompleteFieldBySchema: React.ForwardRefExoticComponent<FieldBySchemaProps & React.RefAttributes<any>>;
|
|
5
4
|
export default EditableAutocompleteFieldBySchema;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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'>):
|
|
3
|
+
export default function FloatFieldBySchema({ fieldKey, index, name, control, schema, errors, onValueChange, decimalScale, label, ...other }: Omit<FieldBySchemaProps, 'type'>): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="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):
|
|
3
|
+
export default function TextFieldBySchema({ name, schema, control, errors, multiline, minRows, fieldKey, index, sx, isPassword, type, autocomplete, disabled, onValueChange, ...other }: FieldBySchemaProps): 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):
|
|
9
|
+
declare function APIWrapper({ handleLoading, setSnackBar, setDialog, children }: APIWrapperProps): 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) =>
|
|
12
|
+
declare const DRFReactBySchemaProvider: ({ serverEndPoint, theme, isInBatches, firstBatchLength, children, }: DRFReactBySchemaProviderProps) => 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):
|
|
20
|
+
export default function Form({ model, id, objTitleField, optionsACModels, cancelBtn, cancelBtnLabel, deleteBtnLabel, saveAndCreateNewBtnLabel, saveAndContinueBtnLabel, saveBtnLabel, onSuccess, borderBottom, saveAndContinue, formButtonsSx, children, }: FormProps): 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,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as Yup from 'yup';
|
|
3
2
|
import { CalendarPickerView } from '@mui/x-date-pickers/CalendarPicker';
|
|
4
3
|
import { GridActionsColDef, GridColDef, GridFilterModel, GridSortModel } from '@mui/x-data-grid';
|
|
5
4
|
import { Control, FieldValues, UseFormGetValues, UseFormSetValue } from 'react-hook-form';
|
|
@@ -158,7 +157,7 @@ export declare const buildGenericYupValidationSchema: ({ data, schema, many, ski
|
|
|
158
157
|
many?: boolean | undefined;
|
|
159
158
|
skipFields?: string[] | undefined;
|
|
160
159
|
extraValidators?: Item | undefined;
|
|
161
|
-
}) =>
|
|
160
|
+
}) => any;
|
|
162
161
|
export declare const errorProps: ({ errors, fieldKey, fieldKeyProp, index, }: {
|
|
163
162
|
errors: Item;
|
|
164
163
|
fieldKey: string;
|
|
@@ -176,7 +175,7 @@ export type AddParametersToEnd<TFunction extends (...args: any) => any, TParamet
|
|
|
176
175
|
export declare function buildDateFormatBySchema(dateViews: string[] | null | undefined): "DD/MM/yyyy" | "MM/yyyy" | "yyyy" | "MM" | "DD";
|
|
177
176
|
export declare const slugToCamelCase: (str: string) => string;
|
|
178
177
|
export declare const slugify: (text: string) => string;
|
|
179
|
-
export declare function mergeFilterItems(defaultFilter: GridFilterModel | undefined, filter: GridFilterModel | undefined):
|
|
178
|
+
export declare function mergeFilterItems(defaultFilter: GridFilterModel | undefined, filter: GridFilterModel | undefined): any;
|
|
180
179
|
export type ActionType = 'editInline' | 'remove' | 'edit' | 'view';
|
|
181
180
|
export type BulkUpdateData = (newData: Item[]) => Promise<{
|
|
182
181
|
id: Id;
|
package/package.json
CHANGED