drf-react-by-schema 0.22.3 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/index.d.ts +25 -14
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/api.d.ts +7 -11
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +50 -28
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts +4 -21
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.js +64 -19
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.js +56 -50
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts +8 -8
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.js +234 -737
- package/dist/components/DataGridBySchemaEditable/DataGridMobile.js +1 -1
- package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts +4 -21
- package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/FileInputCell.js +62 -21
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts +5 -1
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.js +24 -4
- package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts +4 -9
- package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GridDateInput.js +125 -5
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts +4 -8
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.js +51 -5
- package/dist/components/DataGridBySchemaEditable/GridGenericInput.d.ts +8 -0
- package/dist/components/DataGridBySchemaEditable/GridGenericInput.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridGenericInput.js +30 -0
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts +4 -7
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.js +59 -5
- package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/InputInterval.js +23 -4
- package/dist/components/DataGridBySchemaEditable/MobileSearchBar.js +1 -1
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts +4 -1
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.js +72 -25
- package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.d.ts +34 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.js +170 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.d.ts +14 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.js +67 -0
- package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.d.ts +9 -0
- package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.js +68 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts +33 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.js +219 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useRowMode.d.ts +18 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useRowMode.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useRowMode.js +43 -0
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts +30 -0
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.js +180 -0
- package/dist/components/DataGridBySchemaEditable.d.ts +2 -1
- package/dist/components/DataGridBySchemaEditable.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable.js +24 -4
- package/dist/components/GenericModelList.d.ts.map +1 -1
- package/dist/components/GenericModelList.js +12 -7
- package/dist/components/GenericRelatedModelList.d.ts.map +1 -1
- package/dist/components/GenericRelatedModelList.js +13 -8
- package/dist/components/GenericRelatedModelListTable.d.ts +3 -2
- package/dist/components/GenericRelatedModelListTable.d.ts.map +1 -1
- package/dist/components/GenericRelatedModelListTable.js +2 -2
- package/dist/components/Image.d.ts.map +1 -1
- package/dist/components/Image.js +2 -2
- package/dist/components/details/DetailBySchema.js +1 -1
- package/dist/components/details/DetailFieldBySchema.d.ts.map +1 -1
- package/dist/components/details/DetailFieldBySchema.js +3 -0
- package/dist/components/forms/DialogFormBySchema.d.ts +4 -3
- package/dist/components/forms/DialogFormBySchema.d.ts.map +1 -1
- package/dist/components/forms/FieldBySchema.d.ts.map +1 -1
- package/dist/components/forms/Form.d.ts +4 -3
- package/dist/components/forms/Form.d.ts.map +1 -1
- package/dist/components/forms/Form.js +21 -2
- package/dist/components/forms/FormBySchema.d.ts +3 -2
- package/dist/components/forms/FormBySchema.d.ts.map +1 -1
- package/dist/components/forms/FormBySchema.js +2 -1
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts.map +1 -1
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.js +2 -2
- package/dist/context/APIWrapper.d.ts.map +1 -1
- package/dist/context/APIWrapper.js +35 -29
- package/dist/context/APIWrapperContext.d.ts +17 -14
- package/dist/context/APIWrapperContext.d.ts.map +1 -1
- package/dist/context/APIWrapperContext.js +12 -10
- package/dist/context/DRFReactBySchemaProvider.d.ts.map +1 -1
- package/dist/context/DRFReactBySchemaProvider.js +2 -1
- package/dist/styles/grid.d.ts +3 -0
- package/dist/styles/grid.d.ts.map +1 -0
- package/dist/styles/grid.js +42 -0
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/theme.js +33 -7
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +24 -28
- package/package.json +9 -8
|
@@ -75,7 +75,7 @@ const DataGridMobile = (0, react_1.forwardRef)(({ name, columns, schema, data, c
|
|
|
75
75
|
newItem[field] = {
|
|
76
76
|
title: column.headerName || '',
|
|
77
77
|
valueStr: column.valueFormatter
|
|
78
|
-
? column.valueFormatter(
|
|
78
|
+
? column.valueFormatter(item[field], item, column, undefined)
|
|
79
79
|
: item[field],
|
|
80
80
|
value: item[field],
|
|
81
81
|
};
|
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
|
+
import { GridRenderEditCellParams } from '@mui/x-data-grid';
|
|
2
3
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
-
|
|
4
|
-
interface FileInputCellProps {
|
|
5
|
-
field: string;
|
|
6
|
-
id: number | string;
|
|
7
|
-
value?: GenericValue;
|
|
8
|
-
column: GridEnrichedBySchemaColDef;
|
|
4
|
+
export declare function FileInputCell(props: GridRenderEditCellParams & {
|
|
9
5
|
accept: string;
|
|
10
6
|
fileType?: string;
|
|
11
7
|
required?: boolean;
|
|
12
8
|
sx?: SxProps<Theme>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @param {FileInputCellProps} {
|
|
18
|
-
* field,
|
|
19
|
-
* id,
|
|
20
|
-
* value,
|
|
21
|
-
* column,
|
|
22
|
-
* sx = {}
|
|
23
|
-
* }
|
|
24
|
-
* @returns {*} {JSX.Element}
|
|
25
|
-
*/
|
|
26
|
-
export declare function FileInputCell({ field, id, value, column, accept, fileType, required, sx, }: FileInputCellProps): JSX.Element;
|
|
27
|
-
export {};
|
|
9
|
+
helperText?: string;
|
|
10
|
+
}): JSX.Element;
|
|
28
11
|
//# sourceMappingURL=FileInputCell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInputCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/FileInputCell.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"FileInputCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/FileInputCell.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,GAAG,EAAwC,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAqB,MAAM,kBAAkB,CAAC;AAE/E,OAAO,EAAU,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AA2B9D,wBAAgB,aAAa,CAC3B,KAAK,EAAE,wBAAwB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACA,GAAG,CAAC,OAAO,CAkIb"}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,12 +41,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
41
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
42
|
});
|
|
10
43
|
};
|
|
44
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
45
|
+
var t = {};
|
|
46
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
47
|
+
t[p] = s[p];
|
|
48
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
49
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
50
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
51
|
+
t[p[i]] = s[p[i]];
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
};
|
|
11
55
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
56
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
57
|
};
|
|
14
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
59
|
exports.FileInputCell = FileInputCell;
|
|
16
|
-
const react_1 =
|
|
60
|
+
const react_1 = __importStar(require("react"));
|
|
17
61
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
18
62
|
const styles_1 = require("@mui/material/styles");
|
|
19
63
|
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
@@ -21,6 +65,7 @@ const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
|
21
65
|
const FormControl_1 = __importDefault(require("@mui/material/FormControl"));
|
|
22
66
|
const FormControlLabel_1 = __importDefault(require("@mui/material/FormControlLabel"));
|
|
23
67
|
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
68
|
+
const FormHelperText_1 = __importDefault(require("@mui/material/FormHelperText"));
|
|
24
69
|
const CloudUpload_1 = __importDefault(require("@mui/icons-material/CloudUpload"));
|
|
25
70
|
const DRFReactBySchemaContext_1 = require("../../context/DRFReactBySchemaContext");
|
|
26
71
|
const utils_1 = require("../../utils");
|
|
@@ -35,27 +80,24 @@ const VisuallyHiddenInput = (0, styles_1.styled)('input')({
|
|
|
35
80
|
whiteSpace: 'nowrap',
|
|
36
81
|
width: 1,
|
|
37
82
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* @param {FileInputCellProps} {
|
|
42
|
-
* field,
|
|
43
|
-
* id,
|
|
44
|
-
* value,
|
|
45
|
-
* column,
|
|
46
|
-
* sx = {}
|
|
47
|
-
* }
|
|
48
|
-
* @returns {*} {JSX.Element}
|
|
49
|
-
*/
|
|
50
|
-
function FileInputCell({ field, id, value, column, accept, fileType, required, sx = {}, }) {
|
|
83
|
+
function FileInputCell(props) {
|
|
84
|
+
const { field, id, value, accept, fileType, required, sx = {}, error, helperText, hasFocus } = props, other = __rest(props, ["field", "id", "value", "accept", "fileType", "required", "sx", "error", "helperText", "hasFocus"]);
|
|
85
|
+
const colDef = props.colDef;
|
|
51
86
|
const apiRef = (0, x_data_grid_1.useGridApiContext)();
|
|
87
|
+
const inputCallbackRef = (0, react_1.useCallback)((node) => {
|
|
88
|
+
if (node !== null && hasFocus) {
|
|
89
|
+
requestAnimationFrame(() => {
|
|
90
|
+
node.focus();
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, [hasFocus]);
|
|
52
94
|
const { serverEndPoint } = (0, DRFReactBySchemaContext_1.useDRFReactBySchema)();
|
|
53
95
|
const handleChange = (newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
54
96
|
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
55
|
-
apiRef.current.stopCellEditMode({ id, field });
|
|
97
|
+
// apiRef.current.stopCellEditMode({ id, field });
|
|
56
98
|
});
|
|
57
99
|
const fileTypeStr = fileType === 'image upload' ? 'imagem' : 'documento';
|
|
58
|
-
return (react_1.default.createElement(FormControl_1.default, { component: "fieldset", sx: { width: '100%' } },
|
|
100
|
+
return (react_1.default.createElement(FormControl_1.default, { component: "fieldset", sx: { width: '100%' }, error: error },
|
|
59
101
|
react_1.default.createElement(FormControlLabel_1.default, { control: react_1.default.createElement(Box_1.default, { sx: Object.assign({ display: 'flex', flexDirection: 'column', alignItems: 'center', width: '100%' }, sx) },
|
|
60
102
|
!(value === null || value === void 0 ? void 0 : value.name) ? null : ((value === null || value === void 0 ? void 0 : value.url) || (value === null || value === void 0 ? void 0 : value.src)) && fileType === 'image upload' ? (react_1.default.createElement("img", { src: value.url ? `${serverEndPoint === null || serverEndPoint === void 0 ? void 0 : serverEndPoint.url}${value.url}` : value.src, alt: value.name, title: value.name, style: {
|
|
61
103
|
width: '100%',
|
|
@@ -66,11 +108,9 @@ function FileInputCell({ field, id, value, column, accept, fileType, required, s
|
|
|
66
108
|
" (",
|
|
67
109
|
(0, utils_1.formatFileSize)(value.size),
|
|
68
110
|
")")),
|
|
69
|
-
react_1.default.createElement(Button_1.default, { component: "label", variant: "outlined", startIcon: react_1.default.createElement(CloudUpload_1.default, null), disabled:
|
|
70
|
-
// color={error ? 'error' : 'primary'}
|
|
71
|
-
color: "primary" },
|
|
111
|
+
react_1.default.createElement(Button_1.default, Object.assign({ component: "label", variant: "outlined", startIcon: react_1.default.createElement(CloudUpload_1.default, null), disabled: colDef.disabled === true, fullWidth: true, sx: { mt: 1 }, color: error ? 'error' : 'primary', autoFocus: hasFocus }, other),
|
|
72
112
|
value ? `Trocar ${fileTypeStr}` : `Enviar ${fileTypeStr}`,
|
|
73
|
-
react_1.default.createElement(VisuallyHiddenInput, { type: "file", onChange: (e) => {
|
|
113
|
+
react_1.default.createElement(VisuallyHiddenInput, { type: "file", ref: inputCallbackRef, onChange: (e) => {
|
|
74
114
|
var _a;
|
|
75
115
|
const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
76
116
|
if (file) {
|
|
@@ -110,5 +150,6 @@ function FileInputCell({ field, id, value, column, accept, fileType, required, s
|
|
|
110
150
|
width: '100%',
|
|
111
151
|
alignItems: 'flex-start',
|
|
112
152
|
marginLeft: 0,
|
|
113
|
-
} })
|
|
153
|
+
} }),
|
|
154
|
+
helperText && react_1.default.createElement(FormHelperText_1.default, null, helperText)));
|
|
114
155
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Id } from '../../@types';
|
|
2
3
|
type FooterToolbarProps = {
|
|
3
4
|
isEditable: boolean;
|
|
4
5
|
handleAddItem: () => void;
|
|
6
|
+
isRowEditing?: Id;
|
|
7
|
+
handleSaveRow: (p: Id) => void;
|
|
8
|
+
handleCancelRow: (p: Id) => void;
|
|
5
9
|
};
|
|
6
|
-
export declare const FooterToolbar: ({ isEditable, handleAddItem }: FooterToolbarProps) => React.JSX.Element;
|
|
10
|
+
export declare const FooterToolbar: ({ isEditable, handleAddItem, isRowEditing, handleSaveRow, handleCancelRow, }: FooterToolbarProps) => React.JSX.Element;
|
|
7
11
|
export {};
|
|
8
12
|
//# sourceMappingURL=FooterToolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FooterToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/FooterToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FooterToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/FooterToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAGlC,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,EAAE,CAAC;IAClB,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC;IAC/B,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,8EAM3B,kBAAkB,sBA0DpB,CAAC"}
|
|
@@ -7,10 +7,30 @@ exports.FooterToolbar = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
9
9
|
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
10
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
10
11
|
const Add_1 = __importDefault(require("@mui/icons-material/Add"));
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const Check_1 = __importDefault(require("@mui/icons-material/Check"));
|
|
13
|
+
const Cancel_1 = __importDefault(require("@mui/icons-material/Cancel"));
|
|
14
|
+
const utils_1 = require("../../utils");
|
|
15
|
+
const FooterToolbar = ({ isEditable, handleAddItem, isRowEditing, handleSaveRow, handleCancelRow, }) => {
|
|
16
|
+
const handleCancelThisRow = () => {
|
|
17
|
+
if (isRowEditing) {
|
|
18
|
+
handleCancelRow(isRowEditing);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const handleSaveThisRow = () => {
|
|
22
|
+
if (isRowEditing) {
|
|
23
|
+
handleSaveRow(isRowEditing);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (react_1.default.createElement(x_data_grid_1.GridFooterContainer, { role: "rowgroup" },
|
|
27
|
+
react_1.default.createElement(Box_1.default, { role: "row", sx: { width: '100%' } },
|
|
28
|
+
react_1.default.createElement(Box_1.default, { role: "gridcell", sx: { width: '100%' } },
|
|
29
|
+
react_1.default.createElement(Box_1.default, { role: "region", "aria-label": "Rodap\u00E9 da tabela", sx: { display: 'flex', justifyContent: 'space-between', width: '100%' } },
|
|
30
|
+
isEditable && (react_1.default.createElement(Box_1.default, { role: "region", "aria-label": "Bot\u00F5es para criar e editar linhas" },
|
|
31
|
+
react_1.default.createElement(Button_1.default, { color: "primary", disabled: !!isRowEditing && (0, utils_1.isTmpId)(isRowEditing), startIcon: react_1.default.createElement(Add_1.default, null), onClick: handleAddItem, "aria-label": "Adicionar nova linha", sx: { ml: 2 } }, "Adicionar nova linha"),
|
|
32
|
+
react_1.default.createElement(Button_1.default, { color: "secondary", variant: "text", disabled: !isRowEditing, startIcon: react_1.default.createElement(Check_1.default, null), onClick: () => handleSaveThisRow(), "aria-label": "Salvar linha", sx: { ml: 2 } }, "Salvar linha"),
|
|
33
|
+
react_1.default.createElement(Button_1.default, { color: "secondary", variant: "text", disabled: !isRowEditing, startIcon: react_1.default.createElement(Cancel_1.default, null), onClick: handleCancelThisRow, "aria-label": "Cancelar edi\u00E7\u00E3o da linha", sx: { ml: 2 } }, "Cancelar edi\u00E7\u00E3o da linha"))),
|
|
34
|
+
react_1.default.createElement(x_data_grid_1.GridFooter, { sx: isEditable ? { border: 'none' } : { width: '100%' } }))))));
|
|
15
35
|
};
|
|
16
36
|
exports.FooterToolbar = FooterToolbar;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { GridRenderEditCellParams } from '@mui/x-data-grid';
|
|
2
3
|
import { DateView } from '@mui/x-date-pickers';
|
|
3
|
-
|
|
4
|
-
type GridDateInputProps = {
|
|
5
|
-
field: string;
|
|
6
|
-
id: number | string;
|
|
7
|
-
value?: GenericValue;
|
|
8
|
-
column: object;
|
|
4
|
+
export declare const GridDateInput: (props: GridRenderEditCellParams & {
|
|
9
5
|
dateViews?: DateView[];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export {};
|
|
6
|
+
helperText?: string;
|
|
7
|
+
}) => React.JSX.Element;
|
|
13
8
|
//# sourceMappingURL=GridDateInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridDateInput.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridDateInput.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"GridDateInput.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridDateInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoE,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAqB,MAAM,kBAAkB,CAAC;AAI/E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAiB/C,eAAO,MAAM,aAAa,GACxB,OAAO,wBAAwB,GAAG;IAChC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,sBAiIF,CAAC"}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -13,13 +46,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
46
|
};
|
|
14
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
48
|
exports.GridDateInput = void 0;
|
|
16
|
-
const react_1 =
|
|
49
|
+
const react_1 = __importStar(require("react"));
|
|
17
50
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
18
51
|
const DesktopDatePicker_1 = require("@mui/x-date-pickers/DesktopDatePicker");
|
|
19
52
|
const LocalizationProvider_1 = require("@mui/x-date-pickers/LocalizationProvider");
|
|
20
53
|
const AdapterDayjs_1 = require("@mui/x-date-pickers/AdapterDayjs");
|
|
21
54
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
22
55
|
const utils_1 = require("../../utils");
|
|
56
|
+
const grid_1 = require("../../styles/grid");
|
|
23
57
|
function buildOpenTo(dateViews) {
|
|
24
58
|
if (!dateViews || dateViews.includes('day')) {
|
|
25
59
|
return 'day';
|
|
@@ -29,18 +63,104 @@ function buildOpenTo(dateViews) {
|
|
|
29
63
|
}
|
|
30
64
|
return 'year';
|
|
31
65
|
}
|
|
32
|
-
const GridDateInput = (
|
|
66
|
+
const GridDateInput = (props) => {
|
|
67
|
+
const { id, value, field, dateViews, error, helperText, hasFocus, colDef } = props;
|
|
33
68
|
const apiRef = (0, x_data_grid_1.useGridApiContext)();
|
|
69
|
+
const [openPicker, setOpenPicker] = (0, react_1.useState)(false);
|
|
70
|
+
const isShiftPressed = (0, react_1.useRef)(false);
|
|
71
|
+
// const inputRef = useRef<HTMLInputElement>(null);
|
|
72
|
+
// const buttonRef = useRef<HTMLButtonElement>(null);
|
|
73
|
+
const handleOpenPicker = () => {
|
|
74
|
+
setOpenPicker(true);
|
|
75
|
+
};
|
|
76
|
+
const handleCloseCalendar = () => {
|
|
77
|
+
setOpenPicker(false);
|
|
78
|
+
};
|
|
79
|
+
// useLayoutEffect(() => {
|
|
80
|
+
// if (hasFocus) {
|
|
81
|
+
// if (buttonRef.current) {
|
|
82
|
+
// buttonRef.current.focus();
|
|
83
|
+
// } else {
|
|
84
|
+
// inputRef.current?.focus();
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
87
|
+
// }, [hasFocus, field, apiRef]);
|
|
88
|
+
const inputCallbackRef = (0, react_1.useCallback)((node) => {
|
|
89
|
+
if (node && hasFocus) {
|
|
90
|
+
// Scenario: Forward Tab OR API setCellFocus
|
|
91
|
+
if (!isShiftPressed.current) {
|
|
92
|
+
requestAnimationFrame(() => {
|
|
93
|
+
node.focus();
|
|
94
|
+
node.select();
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}, [hasFocus]);
|
|
99
|
+
const buttonCallbackRef = (0, react_1.useCallback)((node) => {
|
|
100
|
+
if (node && hasFocus) {
|
|
101
|
+
// Scenario: Backward Tab (Shift + Tab)
|
|
102
|
+
if (isShiftPressed.current) {
|
|
103
|
+
requestAnimationFrame(() => {
|
|
104
|
+
node.focus();
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, [hasFocus]);
|
|
34
109
|
const inputFormat = (0, utils_1.buildDateFormatBySchema)(dateViews);
|
|
35
110
|
const handleChange = (newValue) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
111
|
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
37
|
-
apiRef.current.stopCellEditMode({ id, field });
|
|
112
|
+
// apiRef.current.stopCellEditMode({ id, field });
|
|
38
113
|
});
|
|
39
114
|
const openTo = buildOpenTo(dateViews);
|
|
115
|
+
(0, react_1.useEffect)(() => {
|
|
116
|
+
const handleKeyDown = (e) => {
|
|
117
|
+
if (e.key === 'Shift')
|
|
118
|
+
isShiftPressed.current = true;
|
|
119
|
+
};
|
|
120
|
+
const handleKeyUp = (e) => {
|
|
121
|
+
if (e.key === 'Shift')
|
|
122
|
+
isShiftPressed.current = false;
|
|
123
|
+
};
|
|
124
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
125
|
+
window.addEventListener('keyup', handleKeyUp);
|
|
126
|
+
return () => {
|
|
127
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
128
|
+
window.removeEventListener('keyup', handleKeyUp);
|
|
129
|
+
};
|
|
130
|
+
}, []);
|
|
40
131
|
return (react_1.default.createElement(LocalizationProvider_1.LocalizationProvider, { dateAdapter: AdapterDayjs_1.AdapterDayjs, adapterLocale: "pt-br" },
|
|
41
|
-
react_1.default.createElement(DesktopDatePicker_1.DesktopDatePicker, { key: field, value: (0, dayjs_1.default)(value), onChange: handleChange, views: dateViews, openTo: openTo, format: inputFormat, slotProps: {
|
|
132
|
+
react_1.default.createElement(DesktopDatePicker_1.DesktopDatePicker, { key: field, open: openPicker, onOpen: handleOpenPicker, onClose: handleCloseCalendar, value: (0, dayjs_1.default)(value), onChange: handleChange, views: dateViews, openTo: openTo, format: inputFormat, slotProps: {
|
|
42
133
|
textField: {
|
|
43
|
-
margin: 'normal',
|
|
134
|
+
// margin: 'normal',
|
|
135
|
+
inputRef: inputCallbackRef,
|
|
136
|
+
sx: grid_1.seamlessTextFieldStyle,
|
|
137
|
+
error,
|
|
138
|
+
helperText,
|
|
139
|
+
inputProps: {
|
|
140
|
+
'aria-label': `Editar ${colDef.headerName || field}. Pressione Entre para escolher do calendário ou digite a data.`,
|
|
141
|
+
},
|
|
142
|
+
onKeyDown: (event) => {
|
|
143
|
+
if (event.key === 'Tab' && !event.shiftKey) {
|
|
144
|
+
// Force to go to the calendar icon menu
|
|
145
|
+
event.stopPropagation();
|
|
146
|
+
}
|
|
147
|
+
if (event.key === 'Enter') {
|
|
148
|
+
handleOpenPicker();
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
// ...other,
|
|
152
|
+
},
|
|
153
|
+
openPickerButton: {
|
|
154
|
+
ref: buttonCallbackRef,
|
|
155
|
+
onKeyDown: (event) => {
|
|
156
|
+
if (event.key === 'Tab' && event.shiftKey) {
|
|
157
|
+
// Force to go back to Input
|
|
158
|
+
event.stopPropagation();
|
|
159
|
+
}
|
|
160
|
+
if (event.key === 'Enter') {
|
|
161
|
+
event.stopPropagation();
|
|
162
|
+
}
|
|
163
|
+
},
|
|
44
164
|
},
|
|
45
165
|
} })));
|
|
46
166
|
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
id: number | string;
|
|
5
|
-
value?: string;
|
|
6
|
-
column: object;
|
|
2
|
+
import { GridRenderEditCellParams } from '@mui/x-data-grid';
|
|
3
|
+
export declare const GridDecimalInput: (props: GridRenderEditCellParams & {
|
|
7
4
|
decimalPlaces?: number;
|
|
8
5
|
prefix?: string;
|
|
9
6
|
suffix?: string;
|
|
10
7
|
isCurrency?: boolean;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export {};
|
|
8
|
+
helperText?: string;
|
|
9
|
+
}) => React.JSX.Element;
|
|
14
10
|
//# sourceMappingURL=GridDecimalInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridDecimalInput.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridDecimalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"GridDecimalInput.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridDecimalInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAqB,MAAM,kBAAkB,CAAC;AAW/E,eAAO,MAAM,gBAAgB,GAC3B,OAAO,wBAAwB,GAAG;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,sBAiEF,CAAC"}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -13,21 +46,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
46
|
};
|
|
14
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
48
|
exports.GridDecimalInput = void 0;
|
|
16
|
-
const react_1 =
|
|
49
|
+
const react_1 = __importStar(require("react"));
|
|
17
50
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
18
51
|
const react_number_format_1 = require("react-number-format");
|
|
19
52
|
const TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
20
|
-
const
|
|
53
|
+
const grid_1 = require("../../styles/grid");
|
|
54
|
+
const GridDecimalInput = (props) => {
|
|
55
|
+
const { id, value, field, decimalPlaces, prefix, suffix, isCurrency, colDef, error, helperText, hasFocus, } = props;
|
|
21
56
|
const apiRef = (0, x_data_grid_1.useGridApiContext)();
|
|
57
|
+
const inputCallbackRef = (0, react_1.useCallback)((node) => {
|
|
58
|
+
if (node !== null && hasFocus) {
|
|
59
|
+
requestAnimationFrame(() => {
|
|
60
|
+
node.focus();
|
|
61
|
+
node.select();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}, [hasFocus]);
|
|
22
65
|
const prefixFinal = isCurrency ? 'R$ ' : prefix !== '' ? `${prefix} ` : '';
|
|
23
66
|
const suffixFinal = suffix !== '' ? ` ${suffix}` : '';
|
|
24
67
|
const decimalScale = decimalPlaces || 2;
|
|
25
68
|
const handleChange = (newValue) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
69
|
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
27
|
-
apiRef.current.stopCellEditMode({ id, field });
|
|
28
70
|
});
|
|
29
|
-
return (react_1.default.createElement(react_number_format_1.NumericFormat, { key: field, id: field, onValueChange: (values) => {
|
|
71
|
+
return (react_1.default.createElement(react_number_format_1.NumericFormat, { key: field, id: field, inputRef: inputCallbackRef, onValueChange: (values) => {
|
|
30
72
|
handleChange(values.value);
|
|
31
|
-
}, value: value, thousandSeparator: ".", decimalSeparator: ",", decimalScale: decimalScale, fixedDecimalScale: true, valueIsNumericString: true, prefix: prefixFinal, suffix: suffixFinal, customInput: TextField_1.default
|
|
73
|
+
}, value: value, thousandSeparator: ".", decimalSeparator: ",", decimalScale: decimalScale, fixedDecimalScale: true, valueIsNumericString: true, prefix: prefixFinal, suffix: suffixFinal, customInput: TextField_1.default, slotProps: {
|
|
74
|
+
htmlInput: {
|
|
75
|
+
'aria-label': `Editar ${colDef.headerName || field}. Pressione Enter para salvar toda a linha.`,
|
|
76
|
+
},
|
|
77
|
+
}, error: error, helperText: helperText, sx: grid_1.seamlessTextFieldStyle }));
|
|
32
78
|
};
|
|
33
79
|
exports.GridDecimalInput = GridDecimalInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
|
+
export interface GridGenericInputProps extends GridRenderCellParams {
|
|
4
|
+
error?: boolean;
|
|
5
|
+
helperText?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function GridGenericInput(props: GridGenericInputProps): React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=GridGenericInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridGenericInput.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridGenericInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAqB,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI3E,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qBAsB5D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.GridGenericInput = GridGenericInput;
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
20
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
21
|
+
const FormHelperText_1 = __importDefault(require("@mui/material/FormHelperText"));
|
|
22
|
+
function GridGenericInput(props) {
|
|
23
|
+
const { error, helperText, hasFocus } = props, other = __rest(props, ["error", "helperText", "hasFocus"]);
|
|
24
|
+
return (react_1.default.createElement(Box_1.default, { sx: { width: '100%', display: 'flex', flexDirection: 'column', justifyContent: 'center' } },
|
|
25
|
+
react_1.default.createElement(x_data_grid_1.GridEditInputCell, Object.assign({}, other, { error: error, hasFocus: hasFocus, autoFocus: hasFocus, sx: {
|
|
26
|
+
'& .MuiInputBase-root': { height: '100%' },
|
|
27
|
+
'& .MuiInputBase-input': { py: helperText ? '4px' : 'inherit' },
|
|
28
|
+
} })),
|
|
29
|
+
helperText && (react_1.default.createElement(FormHelperText_1.default, { error: error, sx: { px: 1, pb: 0.5, lineHeight: 1.2, m: 0 } }, helperText))));
|
|
30
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
id: number | string;
|
|
5
|
-
value?: string | number | null;
|
|
2
|
+
import { GridRenderEditCellParams } from '@mui/x-data-grid';
|
|
3
|
+
export declare const GridPatternInput: (props: GridRenderEditCellParams & {
|
|
6
4
|
patternFormat?: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {};
|
|
5
|
+
helperText?: string;
|
|
6
|
+
}) => React.JSX.Element;
|
|
10
7
|
//# sourceMappingURL=GridPatternInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridPatternInput.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridPatternInput.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"GridPatternInput.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridPatternInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAqB,MAAM,kBAAkB,CAAC;AAK/E,eAAO,MAAM,gBAAgB,GAC3B,OAAO,wBAAwB,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,sBA0DlF,CAAC"}
|