drf-react-by-schema 0.15.2 → 0.15.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 +16 -22
- package/dist/api.js +253 -144
- package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts +1 -1
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts +2 -11
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.js +3 -12
- 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 +3 -3
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.js +2 -2
- package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts +4 -4
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts +4 -19
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.js +1 -16
- package/dist/components/DataGridBySchemaEditable/utils.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable.d.ts +8 -7
- package/dist/components/DataGridBySchemaEditable.js +128 -108
- package/dist/components/DataTotals.d.ts +2 -2
- package/dist/components/DataTotals.js +9 -10
- 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 +8 -8
- package/dist/components/GenericModelList.js +3 -3
- package/dist/components/GenericRelatedModelList.d.ts +6 -6
- package/dist/components/GenericRelatedModelList.js +4 -4
- 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 +3 -3
- package/dist/components/forms/FieldBySchema.d.ts +2 -2
- package/dist/components/forms/FieldBySchema.js +1 -1
- package/dist/components/forms/FormBySchema.d.ts +4 -5
- 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/DesktopDatePickerBySchema.js +2 -3
- 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/APIWrapper.js +95 -50
- package/dist/context/APIWrapperContext.d.ts +13 -15
- package/dist/context/APIWrapperContext.js +1 -1
- package/dist/context/DRFReactBySchemaProvider.d.ts +1 -1
- package/dist/context/Form.d.ts +1 -1
- package/dist/context/FormContext.d.ts +0 -1
- package/dist/context/Overlays.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -3
- package/dist/styles/layout.d.ts +1 -1
- package/dist/styles/theme.d.ts +1 -1
- package/dist/utils.d.ts +37 -14
- package/package.json +8 -6
- package/dist/components/DialogJSONSchemaForm.d.ts +0 -13
- package/dist/components/DialogJSONSchemaForm.js +0 -20
|
@@ -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[];
|
|
@@ -12,16 +12,7 @@ type CustomToolbarProps = {
|
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
14
|
*
|
|
15
|
-
* @param {CustomToolbarProps} {
|
|
16
|
-
* preparedColumns,
|
|
17
|
-
* setPreparedColumns,
|
|
18
|
-
* onSelectActions,
|
|
19
|
-
* selectionModel,
|
|
20
|
-
* bulkUpdateData,
|
|
21
|
-
* bulkDeleteData,
|
|
22
|
-
* bulkCreateData,
|
|
23
|
-
* }
|
|
24
15
|
* @returns Custom Toolbar for the grid
|
|
25
16
|
*/
|
|
26
|
-
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;
|
|
27
18
|
export {};
|
|
@@ -38,15 +38,6 @@ const utils_1 = require("./utils");
|
|
|
38
38
|
/**
|
|
39
39
|
*
|
|
40
40
|
*
|
|
41
|
-
* @param {CustomToolbarProps} {
|
|
42
|
-
* preparedColumns,
|
|
43
|
-
* setPreparedColumns,
|
|
44
|
-
* onSelectActions,
|
|
45
|
-
* selectionModel,
|
|
46
|
-
* bulkUpdateData,
|
|
47
|
-
* bulkDeleteData,
|
|
48
|
-
* bulkCreateData,
|
|
49
|
-
* }
|
|
50
41
|
* @returns Custom Toolbar for the grid
|
|
51
42
|
*/
|
|
52
43
|
const CustomToolbar = ({ preparedColumns, setPreparedColumns, onSelectActions, selectionModel, bulkUpdateData, bulkDeleteData, bulkCreateData, }) => {
|
|
@@ -90,9 +81,9 @@ const CustomToolbar = ({ preparedColumns, setPreparedColumns, onSelectActions, s
|
|
|
90
81
|
}
|
|
91
82
|
selectAction.action(selectionModel, bulkUpdateData);
|
|
92
83
|
} }, selectAction.title)))))),
|
|
93
|
-
react_1.default.createElement(x_data_grid_1.GridToolbarColumnsButton, { sx: { ml: '10px', fontSize: '13px' } }),
|
|
94
|
-
react_1.default.createElement(x_data_grid_1.GridToolbarFilterButton, { sx: { ml: '10px', fontSize: '13px' } }),
|
|
95
|
-
react_1.default.createElement(x_data_grid_1.GridToolbarDensitySelector, { sx: { ml: '10px', fontSize: '13px' } }),
|
|
84
|
+
react_1.default.createElement(x_data_grid_1.GridToolbarColumnsButton, { sx: { ml: '10px', fontSize: '13px' }, placeholder: '' }),
|
|
85
|
+
react_1.default.createElement(x_data_grid_1.GridToolbarFilterButton, { sx: { ml: '10px', fontSize: '13px' }, placeholder: '' }),
|
|
86
|
+
react_1.default.createElement(x_data_grid_1.GridToolbarDensitySelector, { sx: { ml: '10px', fontSize: '13px' }, placeholder: '' }),
|
|
96
87
|
react_1.default.createElement(Button_1.default, { onClick: openResizeMenu, sx: { ml: '0px', fontSize: '13px' } },
|
|
97
88
|
react_1.default.createElement(Expand_1.default, { sx: { transform: 'rotate(90deg)', mr: '6px' } }),
|
|
98
89
|
"Ajustar"),
|
|
@@ -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
|
-
value?:
|
|
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 {};
|
|
@@ -17,13 +17,13 @@ const react_1 = __importDefault(require("react"));
|
|
|
17
17
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
18
18
|
const react_number_format_1 = require("react-number-format");
|
|
19
19
|
const TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
20
|
-
const GridPatternInput = ({ id, value, field, patternFormat = 'cpf' }) => {
|
|
20
|
+
const GridPatternInput = ({ id, value, field, patternFormat = 'cpf', }) => {
|
|
21
21
|
const apiRef = (0, x_data_grid_1.useGridApiContext)();
|
|
22
22
|
const handleChange = (newValue) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
24
24
|
apiRef.current.stopCellEditMode({ id, field });
|
|
25
25
|
});
|
|
26
|
-
return (react_1.default.createElement(react_number_format_1.PatternFormat, { key: field, id: field, onValueChange: (values
|
|
26
|
+
return (react_1.default.createElement(react_number_format_1.PatternFormat, { key: field, id: field, onValueChange: (values) => {
|
|
27
27
|
handleChange(values.value);
|
|
28
28
|
}, value: value, valueIsNumericString: true, format: patternFormat, mask: "_", customInput: TextField_1.default }));
|
|
29
29
|
};
|
|
@@ -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,34 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SxProps } from '@mui/material';
|
|
3
|
+
import { GenericValue, OptionsAC } from '../../utils';
|
|
3
4
|
import { GridEnrichedBySchemaColDef } from '../../utils';
|
|
4
|
-
import {
|
|
5
|
+
import { OnEditModelType } from '../../context/APIWrapperContext';
|
|
5
6
|
interface SelectEditInputCellProps {
|
|
6
7
|
field: string;
|
|
7
8
|
id: number | string;
|
|
8
|
-
value?:
|
|
9
|
+
value?: GenericValue;
|
|
9
10
|
column: GridEnrichedBySchemaColDef;
|
|
10
11
|
type: string;
|
|
11
|
-
optionsAC:
|
|
12
|
+
optionsAC: OptionsAC | null;
|
|
12
13
|
isIndexField: boolean;
|
|
13
14
|
multiple?: boolean;
|
|
14
15
|
onEditModel?: (x: OnEditModelType) => void;
|
|
15
16
|
sx?: SxProps;
|
|
16
17
|
}
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @param {SelectEditInputCellProps} {
|
|
21
|
-
* field,
|
|
22
|
-
* id,
|
|
23
|
-
* value,
|
|
24
|
-
* column,
|
|
25
|
-
* type,
|
|
26
|
-
* optionsAC,
|
|
27
|
-
* isIndexField,
|
|
28
|
-
* multiple = false,
|
|
29
|
-
* sx = {}
|
|
30
|
-
* }
|
|
31
|
-
* @returns {*} {JSX.Element}
|
|
32
|
-
*/
|
|
33
18
|
export declare function SelectEditInputCell({ field, id, value, column, type, optionsAC, isIndexField, multiple, onEditModel, sx, }: SelectEditInputCellProps): JSX.Element;
|
|
34
19
|
export {};
|
|
@@ -44,22 +44,6 @@ const Edit_1 = __importDefault(require("@mui/icons-material/Edit"));
|
|
|
44
44
|
const Autocomplete_1 = __importStar(require("@mui/material/Autocomplete"));
|
|
45
45
|
const utils_1 = require("../../utils");
|
|
46
46
|
const filter = (0, Autocomplete_1.createFilterOptions)();
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @param {SelectEditInputCellProps} {
|
|
51
|
-
* field,
|
|
52
|
-
* id,
|
|
53
|
-
* value,
|
|
54
|
-
* column,
|
|
55
|
-
* type,
|
|
56
|
-
* optionsAC,
|
|
57
|
-
* isIndexField,
|
|
58
|
-
* multiple = false,
|
|
59
|
-
* sx = {}
|
|
60
|
-
* }
|
|
61
|
-
* @returns {*} {JSX.Element}
|
|
62
|
-
*/
|
|
63
47
|
function SelectEditInputCell({ field, id, value, column, type, optionsAC, isIndexField, multiple = false, onEditModel, sx = {}, }) {
|
|
64
48
|
// TODO: allow edit option label, as in formautocomplete!
|
|
65
49
|
const apiRef = (0, x_data_grid_1.useGridApiContext)();
|
|
@@ -101,6 +85,7 @@ function SelectEditInputCell({ field, id, value, column, type, optionsAC, isInde
|
|
|
101
85
|
// Regular option
|
|
102
86
|
return option[labelKey];
|
|
103
87
|
},
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
104
89
|
renderOption: (props, option) => {
|
|
105
90
|
return (react_1.default.createElement("li", Object.assign({ key: option[valueKey] }, props), option[labelKey]));
|
|
106
91
|
},
|
|
@@ -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,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { GridRowId, GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
3
|
import { SxProps } from '@mui/material';
|
|
4
|
+
import { Item, SchemaType, Id, GridEnrichedBySchemaColDef, PaginationModel, ActionType, OnSelectActions, OptionsAC } from '../utils';
|
|
4
5
|
import { OnEditModelType } from '../context/APIWrapperContext';
|
|
5
6
|
interface DataGridBySchemaEditableProps {
|
|
6
7
|
schema: SchemaType;
|
|
@@ -22,11 +23,11 @@ interface DataGridBySchemaEditableProps {
|
|
|
22
23
|
loading?: boolean;
|
|
23
24
|
modelParentId?: Id;
|
|
24
25
|
modelParent?: string;
|
|
25
|
-
customColumnOperations?: (p:
|
|
26
|
-
customLinkDestination?: (p:
|
|
26
|
+
customColumnOperations?: (p: GridEnrichedBySchemaColDef) => GridEnrichedBySchemaColDef | Promise<GridEnrichedBySchemaColDef>;
|
|
27
|
+
customLinkDestination?: (p: GridRenderCellParams) => string;
|
|
27
28
|
LinkComponent?: any;
|
|
28
|
-
onProcessRow?: (p:
|
|
29
|
-
onDataChange?: (p:
|
|
29
|
+
onProcessRow?: (p: Item) => void;
|
|
30
|
+
onDataChange?: (p: Item[]) => void;
|
|
30
31
|
onEditModel?: (p: OnEditModelType) => void;
|
|
31
32
|
isEditable?: boolean;
|
|
32
33
|
hasBulkSelect?: boolean;
|
|
@@ -35,14 +36,14 @@ interface DataGridBySchemaEditableProps {
|
|
|
35
36
|
isAutoHeight?: boolean;
|
|
36
37
|
defaultValues?: Item;
|
|
37
38
|
hideFooterPagination?: boolean;
|
|
38
|
-
setVisibleRows?: (p:
|
|
39
|
+
setVisibleRows?: (p: GridRowId[]) => void;
|
|
39
40
|
paginationModel?: PaginationModel;
|
|
40
41
|
setPaginationModel?: (x: PaginationModel) => void;
|
|
41
42
|
hideFooterComponent?: boolean;
|
|
42
43
|
hideToolbarComponent?: boolean;
|
|
43
44
|
tableAutoHeight?: boolean;
|
|
44
45
|
actions?: Partial<ActionType>[];
|
|
45
|
-
optionsAC?:
|
|
46
|
+
optionsAC?: OptionsAC;
|
|
46
47
|
}
|
|
47
48
|
declare const DataGridBySchemaEditable: React.ForwardRefExoticComponent<DataGridBySchemaEditableProps & React.RefAttributes<unknown>>;
|
|
48
49
|
export default DataGridBySchemaEditable;
|