drf-react-by-schema 0.28.8 → 0.28.9
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 +410 -0
- package/dist/@types/index.d.ts.map +1 -0
- package/dist/@types/index.js +9 -0
- package/dist/@types/string-mask.d.ts +10 -0
- package/dist/@types/string-mask.d.ts.map +1 -0
- package/dist/@types/string-mask.js +1 -0
- package/dist/api.d.ts +81 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +1118 -0
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts +8 -0
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/BooleanInputCell.js +86 -0
- package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.d.ts +12 -0
- package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.js +71 -0
- package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts +9 -0
- package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/ConfirmDialog.js +21 -0
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts +26 -0
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/CustomToolbar.js +146 -0
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts +73 -0
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/DataGridDesktop.js +421 -0
- package/dist/components/DataGridBySchemaEditable/DataGridMobile.d.ts +18 -0
- package/dist/components/DataGridBySchemaEditable/DataGridMobile.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/DataGridMobile.js +105 -0
- package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts +11 -0
- package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/FileInputCell.js +155 -0
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts +12 -0
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/FooterToolbar.js +36 -0
- 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 +85 -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 +87 -0
- package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.d.ts +18 -0
- package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.js +24 -0
- package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts +8 -0
- package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridDateInput.js +166 -0
- package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.d.ts +6 -0
- package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.js +154 -0
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts +10 -0
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridDecimalInput.js +78 -0
- 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 +7 -0
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/GridPatternInput.js +74 -0
- package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts +21 -0
- package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/InputInterval.js +131 -0
- package/dist/components/DataGridBySchemaEditable/MobileSearchBar.d.ts +9 -0
- package/dist/components/DataGridBySchemaEditable/MobileSearchBar.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/MobileSearchBar.js +70 -0
- package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.d.ts +7 -0
- package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.js +41 -0
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts +24 -0
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.js +259 -0
- 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/useDataGridActions.d.ts +33 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.js +161 -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 +69 -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 +73 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts +30 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.js +199 -0
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts +33 -0
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/utils/columnFactory.js +270 -0
- package/dist/components/DataGridBySchemaEditable/utils.d.ts +40 -0
- package/dist/components/DataGridBySchemaEditable/utils.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable/utils.js +181 -0
- package/dist/components/DataGridBySchemaEditable.d.ts +64 -0
- package/dist/components/DataGridBySchemaEditable.d.ts.map +1 -0
- package/dist/components/DataGridBySchemaEditable.js +172 -0
- package/dist/components/DataTotals.d.ts +12 -0
- package/dist/components/DataTotals.d.ts.map +1 -0
- package/dist/components/DataTotals.js +32 -0
- package/dist/components/DataTotalsServer.d.ts +10 -0
- package/dist/components/DataTotalsServer.d.ts.map +1 -0
- package/dist/components/DataTotalsServer.js +18 -0
- package/dist/components/DialogActions.d.ts +11 -0
- package/dist/components/DialogActions.d.ts.map +1 -0
- package/dist/components/DialogActions.js +20 -0
- 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/GenericModelList.d.ts +53 -0
- package/dist/components/GenericModelList.d.ts.map +1 -0
- package/dist/components/GenericModelList.js +194 -0
- package/dist/components/GenericRelatedModelList.d.ts +55 -0
- package/dist/components/GenericRelatedModelList.d.ts.map +1 -0
- package/dist/components/GenericRelatedModelList.js +181 -0
- package/dist/components/GenericRelatedModelListTable.d.ts +56 -0
- package/dist/components/GenericRelatedModelListTable.d.ts.map +1 -0
- package/dist/components/GenericRelatedModelListTable.js +31 -0
- package/dist/components/Image.d.ts +10 -0
- package/dist/components/Image.d.ts.map +1 -0
- package/dist/components/Image.js +111 -0
- package/dist/components/details/DetailBySchema.d.ts +4 -0
- package/dist/components/details/DetailBySchema.d.ts.map +1 -0
- package/dist/components/details/DetailBySchema.js +175 -0
- package/dist/components/details/DetailFieldBySchema.d.ts +4 -0
- package/dist/components/details/DetailFieldBySchema.d.ts.map +1 -0
- package/dist/components/details/DetailFieldBySchema.js +88 -0
- package/dist/components/forms/ChangePasswordForm.d.ts +7 -0
- package/dist/components/forms/ChangePasswordForm.d.ts.map +1 -0
- package/dist/components/forms/ChangePasswordForm.js +93 -0
- package/dist/components/forms/DialogFormBySchema.d.ts +22 -0
- package/dist/components/forms/DialogFormBySchema.d.ts.map +1 -0
- package/dist/components/forms/DialogFormBySchema.js +97 -0
- package/dist/components/forms/FieldBySchema.d.ts +4 -0
- package/dist/components/forms/FieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/FieldBySchema.js +80 -0
- package/dist/components/forms/ForgotPasswordForm.d.ts +11 -0
- package/dist/components/forms/ForgotPasswordForm.d.ts.map +1 -0
- package/dist/components/forms/ForgotPasswordForm.js +114 -0
- package/dist/components/forms/Form.d.ts +61 -0
- package/dist/components/forms/Form.d.ts.map +1 -0
- package/dist/components/forms/Form.js +264 -0
- package/dist/components/forms/FormActions.d.ts +20 -0
- package/dist/components/forms/FormActions.d.ts.map +1 -0
- package/dist/components/forms/FormActions.js +55 -0
- package/dist/components/forms/FormBySchema.d.ts +21 -0
- package/dist/components/forms/FormBySchema.d.ts.map +1 -0
- package/dist/components/forms/FormBySchema.js +280 -0
- package/dist/components/forms/FormWatcher.d.ts +10 -0
- package/dist/components/forms/FormWatcher.d.ts.map +1 -0
- package/dist/components/forms/FormWatcher.js +25 -0
- package/dist/components/forms/inputs/AutocompleteFieldBySchema.d.ts +13 -0
- package/dist/components/forms/inputs/AutocompleteFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/AutocompleteFieldBySchema.js +133 -0
- package/dist/components/forms/inputs/BooleanFieldBySchema.d.ts +4 -0
- package/dist/components/forms/inputs/BooleanFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/BooleanFieldBySchema.js +39 -0
- package/dist/components/forms/inputs/DesktopDatePickerBySchema.d.ts +5 -0
- package/dist/components/forms/inputs/DesktopDatePickerBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/DesktopDatePickerBySchema.js +54 -0
- package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.d.ts +5 -0
- package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.js +47 -0
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts +14 -0
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.js +272 -0
- package/dist/components/forms/inputs/FileFieldBySchema.d.ts +4 -0
- package/dist/components/forms/inputs/FileFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/FileFieldBySchema.js +144 -0
- package/dist/components/forms/inputs/FloatFieldBySchema.d.ts +4 -0
- package/dist/components/forms/inputs/FloatFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/FloatFieldBySchema.js +64 -0
- 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 +61 -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 +344 -0
- package/dist/components/forms/inputs/PatternFieldBySchema.d.ts +4 -0
- package/dist/components/forms/inputs/PatternFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/PatternFieldBySchema.js +56 -0
- package/dist/components/forms/inputs/TextFieldBySchema.d.ts +4 -0
- package/dist/components/forms/inputs/TextFieldBySchema.d.ts.map +1 -0
- package/dist/components/forms/inputs/TextFieldBySchema.js +56 -0
- package/dist/components/forms/inputs/leafletMarker.d.ts +12 -0
- package/dist/components/forms/inputs/leafletMarker.d.ts.map +1 -0
- package/dist/components/forms/inputs/leafletMarker.js +52 -0
- package/dist/context/APIWrapper.d.ts +18 -0
- package/dist/context/APIWrapper.d.ts.map +1 -0
- package/dist/context/APIWrapper.js +593 -0
- package/dist/context/APIWrapperContext.d.ts +132 -0
- package/dist/context/APIWrapperContext.d.ts.map +1 -0
- package/dist/context/APIWrapperContext.js +63 -0
- package/dist/context/DRFReactBySchemaContext.d.ts +31 -0
- package/dist/context/DRFReactBySchemaContext.d.ts.map +1 -0
- package/dist/context/DRFReactBySchemaContext.js +20 -0
- package/dist/context/DRFReactBySchemaProvider.d.ts +5 -0
- package/dist/context/DRFReactBySchemaProvider.d.ts.map +1 -0
- package/dist/context/DRFReactBySchemaProvider.js +105 -0
- package/dist/context/Overlays.d.ts +5 -0
- package/dist/context/Overlays.d.ts.map +1 -0
- package/dist/context/Overlays.js +114 -0
- package/dist/context/PrivateContext.d.ts +10 -0
- package/dist/context/PrivateContext.d.ts.map +1 -0
- package/dist/context/PrivateContext.js +16 -0
- package/dist/hooks/useDeepMemo.d.ts +2 -0
- package/dist/hooks/useDeepMemo.d.ts.map +1 -0
- package/dist/hooks/useDeepMemo.js +13 -0
- package/dist/hooks/useWhyDidYouUpdate.d.ts +4 -0
- package/dist/hooks/useWhyDidYouUpdate.d.ts.map +1 -0
- package/dist/hooks/useWhyDidYouUpdate.js +26 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -0
- package/dist/styles/grid.d.ts +3 -0
- package/dist/styles/grid.d.ts.map +1 -0
- package/dist/styles/grid.js +38 -0
- package/dist/styles/index.d.ts +3 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/index.js +38 -0
- package/dist/styles/layout.d.ts +23 -0
- package/dist/styles/layout.d.ts.map +1 -0
- package/dist/styles/layout.js +71 -0
- package/dist/styles/texts.d.ts +66 -0
- package/dist/styles/texts.d.ts.map +1 -0
- package/dist/styles/texts.js +73 -0
- package/dist/styles/theme.d.ts +29 -0
- package/dist/styles/theme.d.ts.map +1 -0
- package/dist/styles/theme.js +226 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/utils.d.ts +107 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +957 -0
- package/package.json +1 -1
|
@@ -0,0 +1,155 @@
|
|
|
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
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
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
|
+
};
|
|
55
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
56
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.default = FileInputCell;
|
|
60
|
+
const react_1 = __importStar(require("react"));
|
|
61
|
+
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
62
|
+
const styles_1 = require("@mui/material/styles");
|
|
63
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
64
|
+
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
65
|
+
const FormControl_1 = __importDefault(require("@mui/material/FormControl"));
|
|
66
|
+
const FormControlLabel_1 = __importDefault(require("@mui/material/FormControlLabel"));
|
|
67
|
+
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
68
|
+
const FormHelperText_1 = __importDefault(require("@mui/material/FormHelperText"));
|
|
69
|
+
const CloudUpload_1 = __importDefault(require("@mui/icons-material/CloudUpload"));
|
|
70
|
+
const DRFReactBySchemaContext_1 = require("../../context/DRFReactBySchemaContext");
|
|
71
|
+
const utils_1 = require("../../utils");
|
|
72
|
+
const VisuallyHiddenInput = (0, styles_1.styled)('input')({
|
|
73
|
+
clip: 'rect(0 0 0 0)',
|
|
74
|
+
clipPath: 'inset(50%)',
|
|
75
|
+
height: 1,
|
|
76
|
+
overflow: 'hidden',
|
|
77
|
+
position: 'absolute',
|
|
78
|
+
bottom: 0,
|
|
79
|
+
left: 0,
|
|
80
|
+
whiteSpace: 'nowrap',
|
|
81
|
+
width: 1,
|
|
82
|
+
});
|
|
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;
|
|
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]);
|
|
94
|
+
const { serverEndPoint } = (0, DRFReactBySchemaContext_1.useDRFReactBySchema)();
|
|
95
|
+
const handleChange = (newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
97
|
+
// apiRef.current.stopCellEditMode({ id, field });
|
|
98
|
+
});
|
|
99
|
+
const fileTypeStr = fileType === 'image upload' ? 'imagem' : 'documento';
|
|
100
|
+
return (react_1.default.createElement(FormControl_1.default, { component: "fieldset", sx: { width: '100%' }, error: error },
|
|
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) },
|
|
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: {
|
|
103
|
+
width: '100%',
|
|
104
|
+
maxHeight: '100px',
|
|
105
|
+
objectFit: 'cover',
|
|
106
|
+
} })) : (react_1.default.createElement(Typography_1.default, { variant: "body2", sx: { mb: 1 } },
|
|
107
|
+
value.name.split('/').pop(),
|
|
108
|
+
" (",
|
|
109
|
+
(0, utils_1.formatFileSize)(value.size),
|
|
110
|
+
")")),
|
|
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),
|
|
112
|
+
value ? `Trocar ${fileTypeStr}` : `Enviar ${fileTypeStr}`,
|
|
113
|
+
react_1.default.createElement(VisuallyHiddenInput, { type: "file", ref: inputCallbackRef, onChange: (e) => {
|
|
114
|
+
var _a;
|
|
115
|
+
const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
116
|
+
if (file) {
|
|
117
|
+
if (file.type.startsWith('image/')) {
|
|
118
|
+
const reader = new FileReader();
|
|
119
|
+
reader.onload = (event) => {
|
|
120
|
+
const src = event.target ? event.target.result : undefined;
|
|
121
|
+
const newValue = {
|
|
122
|
+
name: file.name,
|
|
123
|
+
size: file.size,
|
|
124
|
+
type: file.type,
|
|
125
|
+
src,
|
|
126
|
+
file,
|
|
127
|
+
};
|
|
128
|
+
handleChange(newValue);
|
|
129
|
+
// if (onValueChange) {
|
|
130
|
+
// onValueChange(newValue);
|
|
131
|
+
// }
|
|
132
|
+
};
|
|
133
|
+
reader.readAsDataURL(file);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const newValue = {
|
|
137
|
+
name: file.name,
|
|
138
|
+
size: file.size,
|
|
139
|
+
type: file.type,
|
|
140
|
+
file,
|
|
141
|
+
};
|
|
142
|
+
handleChange(newValue);
|
|
143
|
+
// if (onValueChange) {
|
|
144
|
+
// onValueChange(newValue);
|
|
145
|
+
// }
|
|
146
|
+
}
|
|
147
|
+
}, accept: accept }))), label: '',
|
|
148
|
+
// labelPlacement="top"
|
|
149
|
+
required: required, sx: {
|
|
150
|
+
width: '100%',
|
|
151
|
+
alignItems: 'flex-start',
|
|
152
|
+
marginLeft: 0,
|
|
153
|
+
} }),
|
|
154
|
+
helperText && react_1.default.createElement(FormHelperText_1.default, null, helperText)));
|
|
155
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Id } from '../../@types';
|
|
3
|
+
type FooterToolbarProps = {
|
|
4
|
+
isEditable: boolean;
|
|
5
|
+
handleAddItem: () => void;
|
|
6
|
+
isRowEditing?: Id;
|
|
7
|
+
handleSaveRow: (p: Id) => void;
|
|
8
|
+
handleCancelRow: (p: Id) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const FooterToolbar: ({ isEditable, handleAddItem, isRowEditing, handleSaveRow, handleCancelRow, }: FooterToolbarProps) => React.JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=FooterToolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FooterToolbar = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
9
|
+
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
10
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
11
|
+
const Add_1 = __importDefault(require("@mui/icons-material/Add"));
|
|
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%' } }))))));
|
|
35
|
+
};
|
|
36
|
+
exports.FooterToolbar = FooterToolbar;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GridRenderEditCellParams } from '@mui/x-data-grid';
|
|
3
|
+
import { GeometryFieldType } from '../../@types';
|
|
4
|
+
interface GeoEditCellProps extends GridRenderEditCellParams {
|
|
5
|
+
geometry: GeometryFieldType;
|
|
6
|
+
height?: number;
|
|
7
|
+
}
|
|
8
|
+
export default function GeoEditCell({ id, field, api, value, geometry, height, }: GeoEditCellProps): React.JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=GeoEditCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeoEditCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GeoEditCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAQxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAKjD,UAAU,gBAAiB,SAAQ,wBAAwB;IACzD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,EAAE,EACF,KAAK,EACL,GAAG,EACH,KAAK,EACL,QAAQ,EACR,MAAY,GACb,EAAE,gBAAgB,qBA4DlB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.default = GeoEditCell;
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
42
|
+
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
43
|
+
const Button_1 = __importDefault(require("@mui/material/Button"));
|
|
44
|
+
const IconButton_1 = __importDefault(require("@mui/material/IconButton"));
|
|
45
|
+
const Modal_1 = __importDefault(require("@mui/material/Modal"));
|
|
46
|
+
const Close_1 = __importDefault(require("@mui/icons-material/Close"));
|
|
47
|
+
const styles_1 = require("@mui/material/styles");
|
|
48
|
+
const utils_1 = require("../../utils");
|
|
49
|
+
const MapGeometryPicker_1 = __importDefault(require("../forms/inputs/MapGeometryPicker"));
|
|
50
|
+
const texts_1 = require("../../styles/texts");
|
|
51
|
+
function GeoEditCell({ id, field, api, value, geometry, height = 360, }) {
|
|
52
|
+
const texts = (0, texts_1.getThemeTexts)((0, styles_1.useTheme)());
|
|
53
|
+
const geometryTexts = texts.geometry;
|
|
54
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
55
|
+
const [draft, setDraft] = (0, react_1.useState)((0, utils_1.geometryValueToString)(value));
|
|
56
|
+
const handleOpen = () => {
|
|
57
|
+
setDraft((0, utils_1.geometryValueToString)(value));
|
|
58
|
+
setOpen(true);
|
|
59
|
+
};
|
|
60
|
+
const handleChange = (geoJSON) => {
|
|
61
|
+
const next = geoJSON || '';
|
|
62
|
+
setDraft(next);
|
|
63
|
+
// Grid stores GeoJSON as an object (as the server + yup object schema send it).
|
|
64
|
+
api.setEditCellValue({ id, field, value: (0, utils_1.parseGeoJSON)(geometry, geoJSON) });
|
|
65
|
+
};
|
|
66
|
+
return (react_1.default.createElement(Box_1.default, { sx: { display: 'flex', alignItems: 'center' } },
|
|
67
|
+
react_1.default.createElement(Button_1.default, { size: "small", variant: "outlined", onClick: handleOpen }, value ? geometryTexts.edit : geometryTexts.define),
|
|
68
|
+
react_1.default.createElement(Modal_1.default, { open: open, onClose: () => setOpen(false), sx: { display: 'flex', alignItems: 'center', justifyContent: 'center', p: 2 } },
|
|
69
|
+
react_1.default.createElement(Box_1.default, { sx: {
|
|
70
|
+
width: '100%',
|
|
71
|
+
maxWidth: 760,
|
|
72
|
+
maxHeight: '90vh',
|
|
73
|
+
overflow: 'auto',
|
|
74
|
+
bgcolor: 'background.paper',
|
|
75
|
+
boxShadow: 24,
|
|
76
|
+
borderRadius: 1,
|
|
77
|
+
p: 2,
|
|
78
|
+
outline: 'none',
|
|
79
|
+
} },
|
|
80
|
+
react_1.default.createElement(Box_1.default, { sx: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 1 } },
|
|
81
|
+
react_1.default.createElement(Typography_1.default, { variant: "h6" }, geometryTexts.drawSelectTitle),
|
|
82
|
+
react_1.default.createElement(IconButton_1.default, { onClick: () => setOpen(false), "aria-label": geometryTexts.close, size: "small" },
|
|
83
|
+
react_1.default.createElement(Close_1.default, null))),
|
|
84
|
+
react_1.default.createElement(MapGeometryPicker_1.default, { geometry: geometry, value: draft, onChange: handleChange, height: height })))));
|
|
85
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GeometryFieldType, GenericValue } from '../../@types';
|
|
3
|
+
interface GeoThumbCellProps {
|
|
4
|
+
geometry: GeometryFieldType;
|
|
5
|
+
value: GenericValue;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
}
|
|
9
|
+
export default function GeoThumbCell({ geometry, value, width, height, }: GeoThumbCellProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=GeoThumbCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeoThumbCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GeoThumbCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA8B/D,UAAU,iBAAiB;IACzB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,QAAQ,EACR,KAAK,EACL,KAAwB,EACxB,MAAyB,GAC1B,EAAE,iBAAiB,qBAqCnB"}
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.default = GeoThumbCell;
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const Box_1 = __importDefault(require("@mui/material/Box"));
|
|
42
|
+
const react_leaflet_1 = require("react-leaflet");
|
|
43
|
+
const leaflet_1 = __importDefault(require("leaflet"));
|
|
44
|
+
const leafletMarker_1 = require("../forms/inputs/leafletMarker");
|
|
45
|
+
const utils_1 = require("../../utils");
|
|
46
|
+
const geoConstants_1 = require("./geoConstants");
|
|
47
|
+
// L.geoJSON point markers use L.Icon.Default; ensure it points at a servable icon.
|
|
48
|
+
(0, leafletMarker_1.applyDefaultLeafletIcon)();
|
|
49
|
+
// Fits the rendered geometry and keeps the thumb static (no pan/zoom).
|
|
50
|
+
function FitGeometry({ data }) {
|
|
51
|
+
const map = (0, react_leaflet_1.useMap)();
|
|
52
|
+
(0, react_1.useEffect)(() => {
|
|
53
|
+
if (!data) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const layer = leaflet_1.default.geoJSON(data).addTo(map);
|
|
57
|
+
const bounds = layer.getBounds();
|
|
58
|
+
if (bounds.isValid()) {
|
|
59
|
+
// Pad + cap the zoom so a point/geometry shows surrounding context.
|
|
60
|
+
map.fitBounds(bounds, { padding: [60, 60], maxZoom: 14 });
|
|
61
|
+
}
|
|
62
|
+
// MapContainer may have mounted before the cell got its final size.
|
|
63
|
+
const t = window.setTimeout(() => map.invalidateSize(), 0);
|
|
64
|
+
return () => {
|
|
65
|
+
window.clearTimeout(t);
|
|
66
|
+
layer.remove();
|
|
67
|
+
};
|
|
68
|
+
}, [data, map]);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
function GeoThumbCell({ geometry, value, width = geoConstants_1.GIS_THUMB_SIZE.w, height = geoConstants_1.GIS_THUMB_SIZE.h, }) {
|
|
72
|
+
const data = (0, utils_1.parseGeoJSON)(geometry, value);
|
|
73
|
+
if (!data) {
|
|
74
|
+
return react_1.default.createElement(Box_1.default, { sx: { width, height }, "data-testid": `geo-thumb-empty-${geometry}` });
|
|
75
|
+
}
|
|
76
|
+
return (react_1.default.createElement(Box_1.default, { sx: {
|
|
77
|
+
width,
|
|
78
|
+
height,
|
|
79
|
+
overflow: 'hidden',
|
|
80
|
+
borderRadius: 1,
|
|
81
|
+
border: 1,
|
|
82
|
+
borderColor: 'divider',
|
|
83
|
+
} },
|
|
84
|
+
react_1.default.createElement(react_leaflet_1.MapContainer, { center: [-14.2, -51.9], zoom: 4, style: { width: '100%', height: '100%' }, zoomControl: false, attributionControl: false, dragging: false, scrollWheelZoom: false, doubleClickZoom: false, boxZoom: false, keyboard: false, touchZoom: false },
|
|
85
|
+
react_1.default.createElement(react_leaflet_1.TileLayer, { attribution: "\u00A9 OpenStreetMap contributors", url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" }),
|
|
86
|
+
react_1.default.createElement(FitGeometry, { data: data }))));
|
|
87
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GridActionsCellItemProps } from '@mui/x-data-grid';
|
|
3
|
+
import { LinkComponentType } from '../../@types';
|
|
4
|
+
/**
|
|
5
|
+
* A type-safe wrapper for GridActionsCellItem that properly handles custom props
|
|
6
|
+
* for link components (like React Router's Link).
|
|
7
|
+
*
|
|
8
|
+
* This component solves the TypeScript issue where GridActionsCellItem doesn't
|
|
9
|
+
* natively accept custom props like 'to' and 'state' that are needed for routing.
|
|
10
|
+
*/
|
|
11
|
+
interface GridActionsCellItemLinkProps extends Omit<GridActionsCellItemProps, 'component'> {
|
|
12
|
+
component: LinkComponentType;
|
|
13
|
+
to: string | object;
|
|
14
|
+
state?: object;
|
|
15
|
+
}
|
|
16
|
+
export declare const GridActionsCellItemLink: React.FC<GridActionsCellItemLinkProps>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=GridActionsCellItemLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridActionsCellItemLink.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GridActionsCellItemLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAuB,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;GAMG;AAEH,UAAU,4BAA6B,SAAQ,IAAI,CAAC,wBAAwB,EAAE,WAAW,CAAC;IACtF,SAAS,EAAE,iBAAiB,CAAC;IAC7B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CAa1E,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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.GridActionsCellItemLink = void 0;
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
20
|
+
const GridActionsCellItemLink = (_a) => {
|
|
21
|
+
var { component, to, state } = _a, rest = __rest(_a, ["component", "to", "state"]);
|
|
22
|
+
return (react_1.default.createElement(x_data_grid_1.GridActionsCellItem, Object.assign({}, rest, { component: component }, { to, state })));
|
|
23
|
+
};
|
|
24
|
+
exports.GridActionsCellItemLink = GridActionsCellItemLink;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GridRenderEditCellParams } from '@mui/x-data-grid';
|
|
3
|
+
import { DateView } from '@mui/x-date-pickers';
|
|
4
|
+
export default function GridDateInput(props: GridRenderEditCellParams & {
|
|
5
|
+
dateViews?: DateView[];
|
|
6
|
+
helperText?: string;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=GridDateInput.d.ts.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,166 @@
|
|
|
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
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.default = GridDateInput;
|
|
49
|
+
const react_1 = __importStar(require("react"));
|
|
50
|
+
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
51
|
+
const DesktopDatePicker_1 = require("@mui/x-date-pickers/DesktopDatePicker");
|
|
52
|
+
const LocalizationProvider_1 = require("@mui/x-date-pickers/LocalizationProvider");
|
|
53
|
+
const AdapterDayjs_1 = require("@mui/x-date-pickers/AdapterDayjs");
|
|
54
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
55
|
+
const utils_1 = require("../../utils");
|
|
56
|
+
const grid_1 = require("../../styles/grid");
|
|
57
|
+
function buildOpenTo(dateViews) {
|
|
58
|
+
if (!dateViews || dateViews.includes('day')) {
|
|
59
|
+
return 'day';
|
|
60
|
+
}
|
|
61
|
+
if (dateViews.includes('month')) {
|
|
62
|
+
return 'month';
|
|
63
|
+
}
|
|
64
|
+
return 'year';
|
|
65
|
+
}
|
|
66
|
+
function GridDateInput(props) {
|
|
67
|
+
const { id, value, field, dateViews, error, helperText, hasFocus, colDef } = props;
|
|
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]);
|
|
109
|
+
const inputFormat = (0, utils_1.buildDateFormatBySchema)(dateViews);
|
|
110
|
+
const handleChange = (newValue) => __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
yield apiRef.current.setEditCellValue({ id, field, value: newValue });
|
|
112
|
+
// apiRef.current.stopCellEditMode({ id, field });
|
|
113
|
+
});
|
|
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
|
+
}, []);
|
|
131
|
+
return (react_1.default.createElement(LocalizationProvider_1.LocalizationProvider, { dateAdapter: AdapterDayjs_1.AdapterDayjs, adapterLocale: "pt-br" },
|
|
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: {
|
|
133
|
+
textField: {
|
|
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
|
+
},
|
|
164
|
+
},
|
|
165
|
+
} })));
|
|
166
|
+
}
|