drf-react-by-schema 0.28.0 → 0.28.2
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/README.md +11 -0
- package/dist/@types/index.d.ts +3 -5
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/api.d.ts +17 -15
- package/dist/api.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts +3 -3
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.js +1 -1
- package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.js +3 -3
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.js +18 -11
- package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts +3 -3
- package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/FileInputCell.js +1 -1
- package/dist/components/DataGridBySchemaEditable/GeoEditCell.d.ts +10 -0
- package/dist/components/DataGridBySchemaEditable/GeoEditCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GeoEditCell.js +81 -0
- package/dist/components/DataGridBySchemaEditable/GeoThumbCell.d.ts +11 -0
- package/dist/components/DataGridBySchemaEditable/GeoThumbCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GeoThumbCell.js +84 -0
- package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GridDateInput.js +4 -5
- package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.js +4 -5
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.js +4 -5
- package/dist/components/DataGridBySchemaEditable/GridGenericInput.d.ts +1 -1
- package/dist/components/DataGridBySchemaEditable/GridGenericInput.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GridGenericInput.js +1 -1
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts +2 -2
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.js +4 -5
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts +1 -1
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.js +1 -1
- package/dist/components/DataGridBySchemaEditable/geoConstants.d.ts +5 -0
- package/dist/components/DataGridBySchemaEditable/geoConstants.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/geoConstants.js +6 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts +1 -1
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.js +17 -20
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts +1 -1
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.js +45 -26
- package/dist/components/DataGridBySchemaEditable/utils.d.ts +3 -2
- package/dist/components/DataGridBySchemaEditable/utils.d.ts.map +1 -1
- package/dist/components/FileTypeIcon.d.ts +18 -0
- package/dist/components/FileTypeIcon.d.ts.map +1 -0
- package/dist/components/FileTypeIcon.js +48 -0
- package/dist/components/details/DetailFieldBySchema.d.ts.map +1 -1
- package/dist/components/details/DetailFieldBySchema.js +18 -3
- package/dist/components/forms/FieldBySchema.d.ts.map +1 -1
- package/dist/components/forms/FieldBySchema.js +7 -0
- package/dist/components/forms/Form.d.ts.map +1 -1
- package/dist/components/forms/Form.js +20 -3
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts +4 -5
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts.map +1 -1
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.js +2 -2
- package/dist/components/forms/inputs/GeometryFieldBySchema.d.ts +8 -0
- package/dist/components/forms/inputs/GeometryFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/GeometryFieldBySchema.js +57 -0
- package/dist/components/forms/inputs/MapGeometryPicker.d.ts +19 -0
- package/dist/components/forms/inputs/MapGeometryPicker.d.ts.map +1 -0
- package/dist/components/forms/inputs/MapGeometryPicker.js +250 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -11
- package/dist/styles/theme.d.ts +1 -1
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/utils/utils.d.ts +23 -5
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +92 -19
- package/package.json +36 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { GridRenderEditCellParams } from '@mui/x-data-grid';
|
|
3
3
|
import { DateView } from '@mui/x-date-pickers';
|
|
4
|
-
export
|
|
4
|
+
export default function GridDateInput(props: GridRenderEditCellParams & {
|
|
5
5
|
dateViews?: DateView[];
|
|
6
6
|
helperText?: string;
|
|
7
|
-
})
|
|
7
|
+
}): React.JSX.Element;
|
|
8
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,KAAoE,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAqB,MAAM,kBAAkB,CAAC;AAI/E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAiB/C,
|
|
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,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,KAAK,EAAE,wBAAwB,GAAG;IAChC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,qBAiIF"}
|
|
@@ -45,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.
|
|
48
|
+
exports.default = GridDateInput;
|
|
49
49
|
const react_1 = __importStar(require("react"));
|
|
50
50
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
51
51
|
const DesktopDatePicker_1 = require("@mui/x-date-pickers/DesktopDatePicker");
|
|
@@ -63,7 +63,7 @@ function buildOpenTo(dateViews) {
|
|
|
63
63
|
}
|
|
64
64
|
return 'year';
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
function GridDateInput(props) {
|
|
67
67
|
const { id, value, field, dateViews, error, helperText, hasFocus, colDef } = props;
|
|
68
68
|
const apiRef = (0, x_data_grid_1.useGridApiContext)();
|
|
69
69
|
const [openPicker, setOpenPicker] = (0, react_1.useState)(false);
|
|
@@ -107,7 +107,7 @@ const GridDateInput = (props) => {
|
|
|
107
107
|
}
|
|
108
108
|
}, [hasFocus]);
|
|
109
109
|
const inputFormat = (0, utils_1.buildDateFormatBySchema)(dateViews);
|
|
110
|
-
const handleChange = (newValue) => __awaiter(
|
|
110
|
+
const handleChange = (newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
111
111
|
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
112
112
|
// apiRef.current.stopCellEditMode({ id, field });
|
|
113
113
|
});
|
|
@@ -163,5 +163,4 @@ const GridDateInput = (props) => {
|
|
|
163
163
|
},
|
|
164
164
|
},
|
|
165
165
|
} })));
|
|
166
|
-
}
|
|
167
|
-
exports.GridDateInput = GridDateInput;
|
|
166
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { GridRenderEditCellParams } from '@mui/x-data-grid';
|
|
3
|
-
export
|
|
3
|
+
export default function GridDateTimeInput(props: GridRenderEditCellParams & {
|
|
4
4
|
helperText?: string;
|
|
5
|
-
})
|
|
5
|
+
}): React.JSX.Element;
|
|
6
6
|
//# sourceMappingURL=GridDateTimeInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridDateTimeInput.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridDateTimeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"GridDateTimeInput.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridDateTimeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAqB,MAAM,kBAAkB,CAAC;AAS/E,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,KAAK,EAAE,wBAAwB,GAAG;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,qBA6HF"}
|
|
@@ -45,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.
|
|
48
|
+
exports.default = GridDateTimeInput;
|
|
49
49
|
const react_1 = __importStar(require("react"));
|
|
50
50
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
51
51
|
const DesktopDateTimePicker_1 = require("@mui/x-date-pickers/DesktopDateTimePicker");
|
|
@@ -53,7 +53,7 @@ const LocalizationProvider_1 = require("@mui/x-date-pickers/LocalizationProvider
|
|
|
53
53
|
const AdapterDayjs_1 = require("@mui/x-date-pickers/AdapterDayjs");
|
|
54
54
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
55
55
|
const grid_1 = require("../../styles/grid");
|
|
56
|
-
|
|
56
|
+
function GridDateTimeInput(props) {
|
|
57
57
|
const { id, value, field, error, helperText, hasFocus, colDef } = props;
|
|
58
58
|
const apiRef = (0, x_data_grid_1.useGridApiContext)();
|
|
59
59
|
const [openPicker, setOpenPicker] = (0, react_1.useState)(false);
|
|
@@ -96,7 +96,7 @@ const GridDateTimeInput = (props) => {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
}, [hasFocus]);
|
|
99
|
-
const handleChange = (newValue) => __awaiter(
|
|
99
|
+
const handleChange = (newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
100
100
|
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
101
101
|
// apiRef.current.stopCellEditMode({ id, field });
|
|
102
102
|
});
|
|
@@ -151,5 +151,4 @@ const GridDateTimeInput = (props) => {
|
|
|
151
151
|
},
|
|
152
152
|
},
|
|
153
153
|
} })));
|
|
154
|
-
}
|
|
155
|
-
exports.GridDateTimeInput = GridDateTimeInput;
|
|
154
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { GridRenderEditCellParams } from '@mui/x-data-grid';
|
|
3
|
-
export
|
|
3
|
+
export default function GridDecimalInput(props: GridRenderEditCellParams & {
|
|
4
4
|
decimalPlaces?: number;
|
|
5
5
|
prefix?: string;
|
|
6
6
|
suffix?: string;
|
|
7
7
|
isCurrency?: boolean;
|
|
8
8
|
helperText?: string;
|
|
9
|
-
})
|
|
9
|
+
}): React.JSX.Element;
|
|
10
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,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAqB,MAAM,kBAAkB,CAAC;AAW/E,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,KAAK,EAAE,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,qBAiEF"}
|
|
@@ -45,13 +45,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.
|
|
48
|
+
exports.default = GridDecimalInput;
|
|
49
49
|
const react_1 = __importStar(require("react"));
|
|
50
50
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
51
51
|
const react_number_format_1 = require("react-number-format");
|
|
52
52
|
const TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
53
53
|
const grid_1 = require("../../styles/grid");
|
|
54
|
-
|
|
54
|
+
function GridDecimalInput(props) {
|
|
55
55
|
const { id, value, field, decimalPlaces, prefix, suffix, isCurrency, colDef, error, helperText, hasFocus, } = props;
|
|
56
56
|
const apiRef = (0, x_data_grid_1.useGridApiContext)();
|
|
57
57
|
const inputCallbackRef = (0, react_1.useCallback)((node) => {
|
|
@@ -65,7 +65,7 @@ const GridDecimalInput = (props) => {
|
|
|
65
65
|
const prefixFinal = isCurrency ? 'R$ ' : prefix !== '' ? `${prefix} ` : '';
|
|
66
66
|
const suffixFinal = suffix !== '' ? ` ${suffix}` : '';
|
|
67
67
|
const decimalScale = typeof decimalPlaces === 'undefined' ? 2 : decimalPlaces;
|
|
68
|
-
const handleChange = (newValue) => __awaiter(
|
|
68
|
+
const handleChange = (newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
69
69
|
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
70
70
|
});
|
|
71
71
|
return (react_1.default.createElement(react_number_format_1.NumericFormat, { key: field, id: field, inputRef: inputCallbackRef, onValueChange: (values) => {
|
|
@@ -75,5 +75,4 @@ const GridDecimalInput = (props) => {
|
|
|
75
75
|
'aria-label': `Editar ${colDef.headerName || field}. Pressione Enter para salvar toda a linha.`,
|
|
76
76
|
},
|
|
77
77
|
}, error: error, helperText: helperText, sx: grid_1.seamlessTextFieldStyle }));
|
|
78
|
-
}
|
|
79
|
-
exports.GridDecimalInput = GridDecimalInput;
|
|
78
|
+
}
|
|
@@ -4,5 +4,5 @@ export interface GridGenericInputProps extends GridRenderCellParams {
|
|
|
4
4
|
error?: boolean;
|
|
5
5
|
helperText?: string;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export default function GridGenericInput(props: GridGenericInputProps): React.JSX.Element;
|
|
8
8
|
//# sourceMappingURL=GridGenericInput.d.ts.map
|
|
@@ -1 +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,
|
|
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,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qBAsBpE"}
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.default = GridGenericInput;
|
|
18
18
|
const react_1 = __importDefault(require("react"));
|
|
19
19
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
20
20
|
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { GridRenderEditCellParams } from '@mui/x-data-grid';
|
|
3
|
-
export
|
|
3
|
+
export default function GridPatternInput({ id, value, field, patternFormat, error, helperText, hasFocus, colDef, }: GridRenderEditCellParams & {
|
|
4
4
|
patternFormat?: string;
|
|
5
5
|
helperText?: string;
|
|
6
|
-
})
|
|
6
|
+
}): React.JSX.Element;
|
|
7
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,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAqB,MAAM,kBAAkB,CAAC;AAK/E,
|
|
1
|
+
{"version":3,"file":"GridPatternInput.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridPatternInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAqB,MAAM,kBAAkB,CAAC;AAK/E,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,EAAE,EACF,KAAK,EACL,KAAK,EACL,aAAqB,EACrB,KAAK,EACL,UAAU,EACV,QAAQ,EACR,MAAM,GACP,EAAE,wBAAwB,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,qBAyC5E"}
|
|
@@ -45,13 +45,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.
|
|
48
|
+
exports.default = GridPatternInput;
|
|
49
49
|
const react_1 = __importStar(require("react"));
|
|
50
50
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
51
51
|
const react_number_format_1 = require("react-number-format");
|
|
52
52
|
const TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
53
53
|
const grid_1 = require("../../styles/grid");
|
|
54
|
-
|
|
54
|
+
function GridPatternInput({ id, value, field, patternFormat = 'cpf', error, helperText, hasFocus, colDef, }) {
|
|
55
55
|
const apiRef = (0, x_data_grid_1.useGridApiContext)();
|
|
56
56
|
const inputCallbackRef = (0, react_1.useCallback)((node) => {
|
|
57
57
|
if (node !== null && hasFocus) {
|
|
@@ -61,7 +61,7 @@ const GridPatternInput = ({ id, value, field, patternFormat = 'cpf', error, help
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
}, [hasFocus]);
|
|
64
|
-
const handleChange = (newValue) => __awaiter(
|
|
64
|
+
const handleChange = (newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
65
65
|
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
66
66
|
});
|
|
67
67
|
return (react_1.default.createElement(react_number_format_1.PatternFormat, { key: field, id: field, inputRef: inputCallbackRef, onValueChange: (values) => {
|
|
@@ -71,5 +71,4 @@ const GridPatternInput = ({ id, value, field, patternFormat = 'cpf', error, help
|
|
|
71
71
|
'aria-label': `Editar ${colDef.headerName || field}. Pressione Enter para salvar toda a linha.`,
|
|
72
72
|
},
|
|
73
73
|
}, error: error, helperText: helperText, sx: grid_1.seamlessTextFieldStyle }));
|
|
74
|
-
}
|
|
75
|
-
exports.GridPatternInput = GridPatternInput;
|
|
74
|
+
}
|
|
@@ -19,6 +19,6 @@ interface SelectEditInputCellProps {
|
|
|
19
19
|
helperText?: string;
|
|
20
20
|
hasFocus?: boolean;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export default function SelectEditInputCell({ field, id, value, column, type, options, isIndexField, multiple, onEditModel, fieldsLayout, sx, setDialog, error, helperText, hasFocus, }: SelectEditInputCellProps): JSX.Element;
|
|
23
23
|
export {};
|
|
24
24
|
//# sourceMappingURL=SelectEditInputCell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectEditInputCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/SelectEditInputCell.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,GAAG,EAAoC,MAAM,OAAO,CAAC;AAGrE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAMtD,OAAO,EACL,eAAe,EACf,YAAY,EACZ,IAAI,EACJ,0BAA0B,EAE1B,MAAM,EACP,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAM9E,UAAU,wBAAwB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,0BAA0B,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IAClD,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACvE,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC5C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,
|
|
1
|
+
{"version":3,"file":"SelectEditInputCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/SelectEditInputCell.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,GAAG,EAAoC,MAAM,O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ACT,EAAE,wBAAwB,GAAG,GAAG,CAAC,OAAO,CAgSxC"}
|
|
@@ -45,7 +45,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
45
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.
|
|
48
|
+
exports.default = SelectEditInputCell;
|
|
49
49
|
const react_1 = __importStar(require("react"));
|
|
50
50
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
51
51
|
const TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geoConstants.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/geoConstants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;CAA8B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GIS_THUMB_SIZE = void 0;
|
|
4
|
+
// Shared sizing for PostGIS geometry grid cells. Matches the thumbnail image
|
|
5
|
+
// height used by image/file columns (maxHeight 100px).
|
|
6
|
+
exports.GIS_THUMB_SIZE = { w: 150, h: 100 };
|
|
@@ -24,7 +24,7 @@ interface UseProcessRowUpdateProps<T extends TField = void> {
|
|
|
24
24
|
onEditModel?: (p: OnEditModelType<T>) => void;
|
|
25
25
|
}
|
|
26
26
|
export declare const useProcessRowUpdate: <T extends TField = void>({ preparedColumns, yupValidationSchema, setDataGridLoading, indexField, processingRow, setValidationErrors, modelParent, modelParentId, model, schema, addExistingModel, updateOptionsAC, apiRef, setDataGridRows, onProcessRow, handleStopEditing, }: UseProcessRowUpdateProps<T>) => {
|
|
27
|
-
processRowUpdate: (editedRow: Item<T>, originalRow: Item<T>) => Promise<
|
|
27
|
+
processRowUpdate: (editedRow: Item<T>, originalRow: Item<T>) => Promise<Item<T>>;
|
|
28
28
|
};
|
|
29
29
|
export {};
|
|
30
30
|
//# sourceMappingURL=useProcessRowUpdate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProcessRowUpdate.d.ts","sourceRoot":"","sources":["../../../../src/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAmB,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,EAAE,EACF,eAAe,EACf,eAAe,EACf,0BAA0B,EAC1B,QAAQ,EACR,MAAM,EACP,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"useProcessRowUpdate.d.ts","sourceRoot":"","sources":["../../../../src/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAmB,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,EAAE,EACF,eAAe,EACf,eAAe,EACf,0BAA0B,EAC1B,QAAQ,EACR,MAAM,EACP,MAAM,iBAAiB,CAAC;AAyBzB,UAAU,wBAAwB,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI;IACxD,eAAe,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;IACxD,mBAAmB,EAAE,SAAS,GAAG,IAAI,CAAC;IACtC,kBAAkB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,I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{
|
|
22
22
|
return err instanceof Error && err.name === 'ValidationError';
|
|
23
23
|
}
|
|
24
|
+
// Backends return choice fields as raw values; reshape them into
|
|
25
|
+
// {value, display_name} objects like populateValues does on list load, so every
|
|
26
|
+
// grid row (load + inline-save) stays consistent.
|
|
27
|
+
function enrichChoices(rawData, schema) {
|
|
28
|
+
const out = Object.assign({}, rawData);
|
|
29
|
+
for (const [key, field] of Object.entries(schema)) {
|
|
30
|
+
if (!(key in rawData) || (field === null || field === void 0 ? void 0 : field.type) !== 'choice')
|
|
31
|
+
continue;
|
|
32
|
+
const rawValue = rawData[key];
|
|
33
|
+
out[key] = rawValue
|
|
34
|
+
? { value: rawValue, display_name: (0, utils_1.getChoiceByValue)(rawValue, field.choices) }
|
|
35
|
+
: (0, utils_1.emptyByType)(field);
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
24
39
|
const useProcessRowUpdate = ({ preparedColumns, yupValidationSchema, setDataGridLoading, indexField, processingRow, setValidationErrors, modelParent, modelParentId, model, schema, addExistingModel, updateOptionsAC, apiRef, setDataGridRows, onProcessRow, handleStopEditing,
|
|
25
40
|
// extraValidators, // TODO: Check why this is missing
|
|
26
41
|
}) => {
|
|
@@ -133,25 +148,7 @@ const useProcessRowUpdate = ({ preparedColumns, yupValidationSchema, setDataGrid
|
|
|
133
148
|
return newState;
|
|
134
149
|
});
|
|
135
150
|
updateOptionsAC();
|
|
136
|
-
const
|
|
137
|
-
const untypedNewRow = Object.assign({}, newRowRaw);
|
|
138
|
-
for (const [key, field] of Object.entries(schema)) {
|
|
139
|
-
if (!(key in newRowRaw)) {
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
if ((field === null || field === void 0 ? void 0 : field.type) === 'choice') {
|
|
143
|
-
const rawValue = newRowRaw[key];
|
|
144
|
-
untypedNewRow[key] = rawValue
|
|
145
|
-
? {
|
|
146
|
-
value: rawValue,
|
|
147
|
-
display_name: (0, utils_1.getChoiceByValue)(rawValue, field.choices),
|
|
148
|
-
}
|
|
149
|
-
: (0, utils_1.emptyByType)(field);
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
untypedNewRow[key] = newRowRaw[key];
|
|
153
|
-
}
|
|
154
|
-
const newRow = untypedNewRow;
|
|
151
|
+
const newRow = enrichChoices('data' in response && 'schema' in response ? response.data : response, schema);
|
|
155
152
|
if (onProcessRow) {
|
|
156
153
|
onProcessRow(newRow);
|
|
157
154
|
}
|
|
@@ -197,7 +194,7 @@ const useProcessRowUpdate = ({ preparedColumns, yupValidationSchema, setDataGrid
|
|
|
197
194
|
return newState;
|
|
198
195
|
});
|
|
199
196
|
updateOptionsAC();
|
|
200
|
-
const newRow = 'data' in response && 'schema' in response ? response.data : response;
|
|
197
|
+
const newRow = enrichChoices('data' in response && 'schema' in response ? response.data : response, schema);
|
|
201
198
|
(0, utils_2.updateRow)({
|
|
202
199
|
newRow,
|
|
203
200
|
originalId: editedRow.id,
|
|
@@ -2,8 +2,8 @@ import { RefObject } from 'react';
|
|
|
2
2
|
import { GridRowId, GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
3
|
import { GridApiCommunity } from '@mui/x-data-grid/internals';
|
|
4
4
|
import { SchemaType, GridEnrichedBySchemaColDef, OptionsAC, OnEditModelType, CustomAction, LinkComponentType, CustomFormFieldLayouts, FieldKey, CustomColumnOperations, RowAction, TField, ConditionalVisible } from '../../../@types';
|
|
5
|
-
import { ServerEndPoint } from '../../../context/DRFReactBySchemaContext';
|
|
6
5
|
import { DialogType } from '../../../context/APIWrapperContext';
|
|
6
|
+
import { ServerEndPoint } from '../../../context/DRFReactBySchemaContext';
|
|
7
7
|
export interface BuildPreparedColumnsProps<T extends TField = void> {
|
|
8
8
|
apiRef: RefObject<GridApiCommunity>;
|
|
9
9
|
schema: SchemaType<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnFactory.d.ts","sourceRoot":"","sources":["../../../../src/components/DataGridBySchemaEditable/utils/columnFactory.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"columnFactory.d.ts","sourceRoot":"","sources":["../../../../src/components/DataGridBySchemaEditable/utils/columnFactory.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzC,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA4B,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EACL,UAAU,EACV,0BAA0B,EAC1B,SAAS,EACT,eAAe,EAEf,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,QAAQ,EACR,sBAAsB,EACtB,SAAS,EACT,MAAM,EACN,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAmB1E,MAAM,WAAW,yBAAyB,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI;IAChE,MAAM,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACpC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;IACzC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC9C,sBAAsB,CAAC,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;IACnD,SAAS,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1D,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;IACnD,qBAAqB,CAAC,EAAE,CAAC,CAAC,EAAE,oBAAoB,KAAK,MAAM,CAAC;IAC5D,cAAc,EAAE,cAAc,CAAC;CAChC;AA4BD,wBAAsB,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,EAAE,EAClE,MAAM,EACN,MAAM,EACN,OAAO,EACP,UAAU,EACV,OAAO,EACP,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,sBAAsB,EACtB,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,GACf,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC,CA2WzE"}
|
|
@@ -17,16 +17,21 @@ const react_1 = __importDefault(require("react"));
|
|
|
17
17
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
18
18
|
const string_mask_1 = __importDefault(require("string-mask"));
|
|
19
19
|
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
20
|
+
const Stack_1 = __importDefault(require("@mui/material/Stack"));
|
|
20
21
|
const utils_1 = require("../../../utils");
|
|
21
|
-
const SelectEditInputCell_1 = require("../SelectEditInputCell");
|
|
22
|
-
const GridDateInput_1 = require("../GridDateInput");
|
|
23
|
-
const GridDateTimeInput_1 = require("../GridDateTimeInput");
|
|
24
|
-
const GridDecimalInput_1 = require("../GridDecimalInput");
|
|
25
|
-
const GridPatternInput_1 = require("../GridPatternInput");
|
|
26
|
-
const BooleanInputCell_1 = require("../BooleanInputCell");
|
|
27
|
-
const FileInputCell_1 = require("../FileInputCell");
|
|
28
|
-
const GridGenericInput_1 = require("../GridGenericInput");
|
|
29
22
|
const utils_2 = require("../utils");
|
|
23
|
+
const geoConstants_1 = require("../geoConstants");
|
|
24
|
+
const SelectEditInputCell_1 = __importDefault(require("../SelectEditInputCell"));
|
|
25
|
+
const GridDateInput_1 = __importDefault(require("../GridDateInput"));
|
|
26
|
+
const GridDateTimeInput_1 = __importDefault(require("../GridDateTimeInput"));
|
|
27
|
+
const GridDecimalInput_1 = __importDefault(require("../GridDecimalInput"));
|
|
28
|
+
const BooleanInputCell_1 = __importDefault(require("../BooleanInputCell"));
|
|
29
|
+
const FileInputCell_1 = __importDefault(require("../FileInputCell"));
|
|
30
|
+
const GridGenericInput_1 = __importDefault(require("../GridGenericInput"));
|
|
31
|
+
const GridPatternInput_1 = __importDefault(require("../GridPatternInput"));
|
|
32
|
+
const GeoThumbCell_1 = __importDefault(require("../GeoThumbCell"));
|
|
33
|
+
const GeoEditCell_1 = __importDefault(require("../GeoEditCell"));
|
|
34
|
+
const FileTypeIcon_1 = __importDefault(require("../../FileTypeIcon"));
|
|
30
35
|
const ConditionalEditWrapper_1 = __importDefault(require("../ConditionalEditWrapper"));
|
|
31
36
|
/**
|
|
32
37
|
* Applies a `pattern_format` mask to a column, merging with any existing valueFormatter.
|
|
@@ -35,7 +40,7 @@ const applyPatternFormatToColumn = (column, patternFormat) => {
|
|
|
35
40
|
column.patternFormat = patternFormat;
|
|
36
41
|
const existingValueFormatter = column.valueFormatter;
|
|
37
42
|
column.valueFormatter = (value, row, colDef, apiRef) => {
|
|
38
|
-
|
|
43
|
+
const formatted = existingValueFormatter
|
|
39
44
|
? existingValueFormatter(value, row, colDef, apiRef)
|
|
40
45
|
: value;
|
|
41
46
|
if (typeof formatted !== 'string' || !formatted) {
|
|
@@ -49,15 +54,17 @@ function buildPreparedColumns(_a) {
|
|
|
49
54
|
return __awaiter(this, arguments, void 0, function* ({ apiRef, schema, columns, isEditable, actions, LinkComponent, stateToLink, validationErrors, optionsAC, onEditModel, customFieldFormLayouts, setDialog, indexField, indexFieldMinWidth, minWidth, customColumnOperations, customLinkDestination, indexFieldBasePath, conditionalVisible, serverEndPoint, }) {
|
|
50
55
|
const promises = columns.map((col) => __awaiter(this, void 0, void 0, function* () {
|
|
51
56
|
const fieldSchema = schema[col.field];
|
|
52
|
-
if (!fieldSchema)
|
|
57
|
+
if (!fieldSchema) {
|
|
53
58
|
return col;
|
|
59
|
+
}
|
|
60
|
+
const fieldType = fieldSchema.type;
|
|
54
61
|
const isIndexField = indexField !== '' && col.field === indexField;
|
|
55
62
|
let column = Object.assign({}, col);
|
|
56
63
|
column.editable =
|
|
57
64
|
isEditable &&
|
|
58
65
|
!col.disabled &&
|
|
59
|
-
(!fieldSchema.read_only || ['field', 'nested object'].includes(
|
|
60
|
-
switch (
|
|
66
|
+
(!fieldSchema.read_only || ['field', 'nested object'].includes(fieldType));
|
|
67
|
+
switch (fieldType) {
|
|
61
68
|
case 'date':
|
|
62
69
|
column.type = 'date';
|
|
63
70
|
if (!column.minWidth) {
|
|
@@ -70,7 +77,7 @@ function buildPreparedColumns(_a) {
|
|
|
70
77
|
column.renderEditCell = (p) => {
|
|
71
78
|
var _a;
|
|
72
79
|
const err = (_a = validationErrors[p.id]) === null || _a === void 0 ? void 0 : _a[p.field];
|
|
73
|
-
const inputCell = (react_1.default.createElement(GridDateInput_1.
|
|
80
|
+
const inputCell = (react_1.default.createElement(GridDateInput_1.default, Object.assign({}, p, { column: column, dateViews: fieldSchema.date_views, error: Boolean(err), helperText: err })));
|
|
74
81
|
if (conditionalVisible.filter(({ target }) => target === p.field).length > 0) {
|
|
75
82
|
return (react_1.default.createElement(ConditionalEditWrapper_1.default, Object.assign({}, p, { conditionalVisible: conditionalVisible, apiRef: apiRef }), inputCell));
|
|
76
83
|
}
|
|
@@ -88,7 +95,7 @@ function buildPreparedColumns(_a) {
|
|
|
88
95
|
column.renderEditCell = (p) => {
|
|
89
96
|
var _a;
|
|
90
97
|
const err = (_a = validationErrors[p.id]) === null || _a === void 0 ? void 0 : _a[p.field];
|
|
91
|
-
const inputCell = (react_1.default.createElement(GridDateTimeInput_1.
|
|
98
|
+
const inputCell = (react_1.default.createElement(GridDateTimeInput_1.default, Object.assign({}, p, { column: column, error: Boolean(err), helperText: err })));
|
|
92
99
|
if (conditionalVisible.filter(({ target }) => target === p.field).length > 0) {
|
|
93
100
|
return (react_1.default.createElement(ConditionalEditWrapper_1.default, Object.assign({}, p, { conditionalVisible: conditionalVisible, apiRef: apiRef }), inputCell));
|
|
94
101
|
}
|
|
@@ -110,7 +117,7 @@ function buildPreparedColumns(_a) {
|
|
|
110
117
|
column.renderEditCell = (p) => {
|
|
111
118
|
var _a;
|
|
112
119
|
const err = (_a = validationErrors[p.id]) === null || _a === void 0 ? void 0 : _a[p.field];
|
|
113
|
-
const inputCell = (react_1.default.createElement(SelectEditInputCell_1.
|
|
120
|
+
const inputCell = (react_1.default.createElement(SelectEditInputCell_1.default, Object.assign({}, p, { column: column, type: fieldType, options: optionsAC[col.field] || [], isIndexField: isIndexField, onEditModel: onEditModel, fieldsLayout: customFieldFormLayouts === null || customFieldFormLayouts === void 0 ? void 0 : customFieldFormLayouts[col.field], setDialog: setDialog, multiple: fieldType === 'list' || fieldSchema.many, error: Boolean(err), helperText: err })));
|
|
114
121
|
if (conditionalVisible.filter(({ target }) => target === p.field).length > 0) {
|
|
115
122
|
return (react_1.default.createElement(ConditionalEditWrapper_1.default, Object.assign({}, p, { conditionalVisible: conditionalVisible, apiRef: apiRef }), inputCell));
|
|
116
123
|
}
|
|
@@ -131,7 +138,7 @@ function buildPreparedColumns(_a) {
|
|
|
131
138
|
column.renderEditCell = (p) => {
|
|
132
139
|
var _a;
|
|
133
140
|
const err = (_a = validationErrors[p.id]) === null || _a === void 0 ? void 0 : _a[p.field];
|
|
134
|
-
const inputCell = (react_1.default.createElement(BooleanInputCell_1.
|
|
141
|
+
const inputCell = (react_1.default.createElement(BooleanInputCell_1.default, Object.assign({}, p, { column: column, error: Boolean(err), helperText: err })));
|
|
135
142
|
if (conditionalVisible.filter(({ target }) => target === p.field).length > 0) {
|
|
136
143
|
return (react_1.default.createElement(ConditionalEditWrapper_1.default, Object.assign({}, p, { conditionalVisible: conditionalVisible, apiRef: apiRef }), inputCell));
|
|
137
144
|
}
|
|
@@ -143,7 +150,7 @@ function buildPreparedColumns(_a) {
|
|
|
143
150
|
case 'float':
|
|
144
151
|
case 'number':
|
|
145
152
|
case 'integer':
|
|
146
|
-
const ds = fieldSchema.decimal_places || (
|
|
153
|
+
const ds = fieldSchema.decimal_places || (fieldType === 'integer' ? 0 : 2);
|
|
147
154
|
column.type = 'number';
|
|
148
155
|
column.valueFormatter = (value) => {
|
|
149
156
|
if (value === null || value === undefined)
|
|
@@ -154,13 +161,13 @@ function buildPreparedColumns(_a) {
|
|
|
154
161
|
});
|
|
155
162
|
};
|
|
156
163
|
column.filterOperators = (0, utils_2.quantityOnlyOperators)({
|
|
157
|
-
type:
|
|
164
|
+
type: fieldType === 'decimal' ? 'float' : 'number',
|
|
158
165
|
});
|
|
159
166
|
if (isEditable && !col.disabled) {
|
|
160
167
|
column.renderEditCell = (p) => {
|
|
161
168
|
var _a;
|
|
162
169
|
const err = (_a = validationErrors[p.id]) === null || _a === void 0 ? void 0 : _a[p.field];
|
|
163
|
-
const inputCell = (react_1.default.createElement(GridDecimalInput_1.
|
|
170
|
+
const inputCell = (react_1.default.createElement(GridDecimalInput_1.default, Object.assign({}, p, { decimalPlaces: ds, isCurrency: fieldSchema.is_currency, prefix: fieldSchema.prefix || '', suffix: fieldSchema.suffix || '', column: column, error: Boolean(err), helperText: err })));
|
|
164
171
|
if (conditionalVisible.filter(({ target }) => target === p.field).length > 0) {
|
|
165
172
|
return (react_1.default.createElement(ConditionalEditWrapper_1.default, Object.assign({}, p, { conditionalVisible: conditionalVisible, apiRef: apiRef }), inputCell));
|
|
166
173
|
}
|
|
@@ -176,8 +183,9 @@ function buildPreparedColumns(_a) {
|
|
|
176
183
|
column.renderCell = (p) => {
|
|
177
184
|
var _a, _b;
|
|
178
185
|
return (react_1.default.createElement(react_1.default.Fragment, null, ((_a = p.value) === null || _a === void 0 ? void 0 : _a.name) &&
|
|
179
|
-
(((_b = p.value) === null || _b === void 0 ? void 0 : _b.url) &&
|
|
180
|
-
|
|
186
|
+
(((_b = p.value) === null || _b === void 0 ? void 0 : _b.url) && (fieldType === 'image upload' || fieldType === 'image') ? (react_1.default.createElement("img", { src: `${serverEndPoint === null || serverEndPoint === void 0 ? void 0 : serverEndPoint.url}${p.value.url}`, alt: p.value.name, style: { width: '100%', maxHeight: '100px', objectFit: 'cover' } })) : (react_1.default.createElement(Stack_1.default, { direction: "row", spacing: 0.5, alignItems: "center" },
|
|
187
|
+
react_1.default.createElement(FileTypeIcon_1.default, { name: p.value.name }),
|
|
188
|
+
react_1.default.createElement(Typography_1.default, { variant: "body2" }, p.value.name.split('/').pop()))))));
|
|
181
189
|
};
|
|
182
190
|
if (isEditable && !col.disabled) {
|
|
183
191
|
column.renderEditCell = (p) => {
|
|
@@ -185,10 +193,10 @@ function buildPreparedColumns(_a) {
|
|
|
185
193
|
const err = (_a = validationErrors[p.id]) === null || _a === void 0 ? void 0 : _a[p.field];
|
|
186
194
|
const acc = fieldSchema.allowed_mime_types
|
|
187
195
|
? fieldSchema.allowed_mime_types.join(', ')
|
|
188
|
-
:
|
|
196
|
+
: fieldType.includes('image')
|
|
189
197
|
? 'image/*'
|
|
190
198
|
: '*';
|
|
191
|
-
const inputCell = (react_1.default.createElement(FileInputCell_1.
|
|
199
|
+
const inputCell = (react_1.default.createElement(FileInputCell_1.default, Object.assign({ accept: acc, fileType: fieldType, column: column, required: (0, utils_1.isFieldRequired)(fieldSchema) }, p, { error: Boolean(err), helperText: err })));
|
|
192
200
|
if (conditionalVisible.filter(({ target }) => target === p.field).length > 0) {
|
|
193
201
|
return (react_1.default.createElement(ConditionalEditWrapper_1.default, Object.assign({}, p, { conditionalVisible: conditionalVisible, apiRef: apiRef }), inputCell));
|
|
194
202
|
}
|
|
@@ -196,12 +204,23 @@ function buildPreparedColumns(_a) {
|
|
|
196
204
|
};
|
|
197
205
|
}
|
|
198
206
|
break;
|
|
207
|
+
case 'point':
|
|
208
|
+
case 'polygon':
|
|
209
|
+
case 'multipoint':
|
|
210
|
+
case 'multipolygon':
|
|
211
|
+
case 'geometrycollection':
|
|
212
|
+
column.minWidth = geoConstants_1.GIS_THUMB_SIZE.w + 24;
|
|
213
|
+
column.renderCell = (p) => (react_1.default.createElement(GeoThumbCell_1.default, { geometry: fieldType, value: p.value }));
|
|
214
|
+
if (isEditable && !col.disabled) {
|
|
215
|
+
column.renderEditCell = (p) => (react_1.default.createElement(GeoEditCell_1.default, Object.assign({}, p, { geometry: fieldType })));
|
|
216
|
+
}
|
|
217
|
+
break;
|
|
199
218
|
case 'string':
|
|
200
219
|
if (isEditable && !col.disabled && (fieldSchema.pattern_format || col.patternFormat)) {
|
|
201
220
|
column.renderEditCell = (p) => {
|
|
202
221
|
var _a;
|
|
203
222
|
const err = (_a = validationErrors[p.id]) === null || _a === void 0 ? void 0 : _a[p.field];
|
|
204
|
-
const inputCell = (react_1.default.createElement(GridPatternInput_1.
|
|
223
|
+
const inputCell = (react_1.default.createElement(GridPatternInput_1.default, Object.assign({}, p, { patternFormat: fieldSchema.pattern_format || col.patternFormat || '', error: Boolean(err), helperText: err })));
|
|
205
224
|
if (conditionalVisible.filter(({ target }) => target === p.field).length > 0) {
|
|
206
225
|
return (react_1.default.createElement(ConditionalEditWrapper_1.default, Object.assign({}, p, { conditionalVisible: conditionalVisible, apiRef: apiRef }), inputCell));
|
|
207
226
|
}
|
|
@@ -212,7 +231,7 @@ function buildPreparedColumns(_a) {
|
|
|
212
231
|
}
|
|
213
232
|
// Apply pattern_format (mask) for display:
|
|
214
233
|
const patternFormat = fieldSchema.pattern_format || col.patternFormat;
|
|
215
|
-
if (patternFormat &&
|
|
234
|
+
if (patternFormat && fieldType !== 'decimal' && fieldType !== 'float') {
|
|
216
235
|
column = applyPatternFormatToColumn(column, patternFormat);
|
|
217
236
|
}
|
|
218
237
|
if (indexFieldMinWidth && !column.minWidth)
|
|
@@ -235,7 +254,7 @@ function buildPreparedColumns(_a) {
|
|
|
235
254
|
column.renderEditCell = (p) => {
|
|
236
255
|
var _a;
|
|
237
256
|
const err = (_a = validationErrors[p.id]) === null || _a === void 0 ? void 0 : _a[p.field];
|
|
238
|
-
const inputCell = react_1.default.createElement(GridGenericInput_1.
|
|
257
|
+
const inputCell = react_1.default.createElement(GridGenericInput_1.default, Object.assign({}, p, { error: Boolean(err), helperText: err }));
|
|
239
258
|
if (conditionalVisible.filter(({ target }) => target === p.field).length > 0) {
|
|
240
259
|
return (react_1.default.createElement(ConditionalEditWrapper_1.default, Object.assign({}, p, { conditionalVisible: conditionalVisible, apiRef: apiRef }), inputCell));
|
|
241
260
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
+
import { GridFilterOperator } from '@mui/x-data-grid';
|
|
2
3
|
import { GridApiCommunity } from '@mui/x-data-grid/models/api/gridApiCommunity';
|
|
3
4
|
import { FieldKey, GridEnrichedBySchemaColDef, Id, Item, TField } from '../../@types';
|
|
4
5
|
export type ResizeType = 'condense' | 'maxContent' | 'fitScreen';
|
|
@@ -12,7 +13,7 @@ export type ResizeType = 'condense' | 'maxContent' | 'fitScreen';
|
|
|
12
13
|
export declare function resizeColumns(columns: GridEnrichedBySchemaColDef[], resizeType: ResizeType): GridEnrichedBySchemaColDef[];
|
|
13
14
|
export declare const quantityOnlyOperators: ({ type }: {
|
|
14
15
|
type: string;
|
|
15
|
-
}) => GridFilterOperator[];
|
|
16
|
+
}) => GridFilterOperator<any, any, any>[];
|
|
16
17
|
export declare const buildEditPath: (basePath: string, objId: Id) => string;
|
|
17
18
|
export declare const buildExitPath: (basePath: string, objId?: Id) => string;
|
|
18
19
|
export declare const scrollToNewRow: (apiRef: RefObject<GridApiCommunity>, tableAutoHeight?: boolean) => void;
|
|
@@ -35,5 +36,5 @@ export declare function deleteRow<T extends TField = void>({ id, apiRef, setData
|
|
|
35
36
|
setDataGridRows: (value: React.SetStateAction<Item<T>[]>) => void;
|
|
36
37
|
onProcessRow?: (p?: Item<T>) => void;
|
|
37
38
|
}): void;
|
|
38
|
-
export declare function getAllRowIds(apiRef: RefObject<GridApiCommunity>):
|
|
39
|
+
export declare function getAllRowIds(apiRef: RefObject<GridApiCommunity>): import("@mui/x-data-grid").GridRowId[];
|
|
39
40
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAGL,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,0BAA0B,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAoCtF,M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