drf-react-by-schema 0.28.5 → 0.28.7

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.
Files changed (227) hide show
  1. package/README.md +11 -0
  2. package/package.json +8 -21
  3. package/dist/@types/index.d.ts +0 -408
  4. package/dist/@types/index.d.ts.map +0 -1
  5. package/dist/@types/index.js +0 -9
  6. package/dist/@types/string-mask.d.ts +0 -10
  7. package/dist/@types/string-mask.d.ts.map +0 -1
  8. package/dist/@types/string-mask.js +0 -1
  9. package/dist/api.d.ts +0 -78
  10. package/dist/api.d.ts.map +0 -1
  11. package/dist/api.js +0 -1058
  12. package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts +0 -8
  13. package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts.map +0 -1
  14. package/dist/components/DataGridBySchemaEditable/BooleanInputCell.js +0 -86
  15. package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.d.ts +0 -12
  16. package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.d.ts.map +0 -1
  17. package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.js +0 -71
  18. package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts +0 -9
  19. package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts.map +0 -1
  20. package/dist/components/DataGridBySchemaEditable/ConfirmDialog.js +0 -21
  21. package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts +0 -26
  22. package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts.map +0 -1
  23. package/dist/components/DataGridBySchemaEditable/CustomToolbar.js +0 -146
  24. package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts +0 -72
  25. package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts.map +0 -1
  26. package/dist/components/DataGridBySchemaEditable/DataGridDesktop.js +0 -416
  27. package/dist/components/DataGridBySchemaEditable/DataGridMobile.d.ts +0 -18
  28. package/dist/components/DataGridBySchemaEditable/DataGridMobile.d.ts.map +0 -1
  29. package/dist/components/DataGridBySchemaEditable/DataGridMobile.js +0 -105
  30. package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts +0 -11
  31. package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts.map +0 -1
  32. package/dist/components/DataGridBySchemaEditable/FileInputCell.js +0 -155
  33. package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts +0 -12
  34. package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts.map +0 -1
  35. package/dist/components/DataGridBySchemaEditable/FooterToolbar.js +0 -36
  36. package/dist/components/DataGridBySchemaEditable/GeoEditCell.d.ts +0 -10
  37. package/dist/components/DataGridBySchemaEditable/GeoEditCell.d.ts.map +0 -1
  38. package/dist/components/DataGridBySchemaEditable/GeoEditCell.js +0 -85
  39. package/dist/components/DataGridBySchemaEditable/GeoThumbCell.d.ts +0 -11
  40. package/dist/components/DataGridBySchemaEditable/GeoThumbCell.d.ts.map +0 -1
  41. package/dist/components/DataGridBySchemaEditable/GeoThumbCell.js +0 -87
  42. package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.d.ts +0 -18
  43. package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.d.ts.map +0 -1
  44. package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.js +0 -24
  45. package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts +0 -8
  46. package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts.map +0 -1
  47. package/dist/components/DataGridBySchemaEditable/GridDateInput.js +0 -166
  48. package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.d.ts +0 -6
  49. package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.d.ts.map +0 -1
  50. package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.js +0 -154
  51. package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts +0 -10
  52. package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts.map +0 -1
  53. package/dist/components/DataGridBySchemaEditable/GridDecimalInput.js +0 -78
  54. package/dist/components/DataGridBySchemaEditable/GridGenericInput.d.ts +0 -8
  55. package/dist/components/DataGridBySchemaEditable/GridGenericInput.d.ts.map +0 -1
  56. package/dist/components/DataGridBySchemaEditable/GridGenericInput.js +0 -30
  57. package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts +0 -7
  58. package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts.map +0 -1
  59. package/dist/components/DataGridBySchemaEditable/GridPatternInput.js +0 -74
  60. package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts +0 -21
  61. package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts.map +0 -1
  62. package/dist/components/DataGridBySchemaEditable/InputInterval.js +0 -131
  63. package/dist/components/DataGridBySchemaEditable/MobileSearchBar.d.ts +0 -9
  64. package/dist/components/DataGridBySchemaEditable/MobileSearchBar.d.ts.map +0 -1
  65. package/dist/components/DataGridBySchemaEditable/MobileSearchBar.js +0 -70
  66. package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.d.ts +0 -7
  67. package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.d.ts.map +0 -1
  68. package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.js +0 -41
  69. package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts +0 -24
  70. package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts.map +0 -1
  71. package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.js +0 -259
  72. package/dist/components/DataGridBySchemaEditable/geoConstants.d.ts +0 -5
  73. package/dist/components/DataGridBySchemaEditable/geoConstants.d.ts.map +0 -1
  74. package/dist/components/DataGridBySchemaEditable/geoConstants.js +0 -6
  75. package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.d.ts +0 -33
  76. package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.d.ts.map +0 -1
  77. package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.js +0 -161
  78. package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.d.ts +0 -14
  79. package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.d.ts.map +0 -1
  80. package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.js +0 -69
  81. package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.d.ts +0 -9
  82. package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.d.ts.map +0 -1
  83. package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.js +0 -73
  84. package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts +0 -30
  85. package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts.map +0 -1
  86. package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.js +0 -199
  87. package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts +0 -33
  88. package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts.map +0 -1
  89. package/dist/components/DataGridBySchemaEditable/utils/columnFactory.js +0 -270
  90. package/dist/components/DataGridBySchemaEditable/utils.d.ts +0 -40
  91. package/dist/components/DataGridBySchemaEditable/utils.d.ts.map +0 -1
  92. package/dist/components/DataGridBySchemaEditable/utils.js +0 -181
  93. package/dist/components/DataGridBySchemaEditable.d.ts +0 -63
  94. package/dist/components/DataGridBySchemaEditable.d.ts.map +0 -1
  95. package/dist/components/DataGridBySchemaEditable.js +0 -172
  96. package/dist/components/DataTotals.d.ts +0 -12
  97. package/dist/components/DataTotals.d.ts.map +0 -1
  98. package/dist/components/DataTotals.js +0 -32
  99. package/dist/components/DataTotalsServer.d.ts +0 -10
  100. package/dist/components/DataTotalsServer.d.ts.map +0 -1
  101. package/dist/components/DataTotalsServer.js +0 -18
  102. package/dist/components/DialogActions.d.ts +0 -11
  103. package/dist/components/DialogActions.d.ts.map +0 -1
  104. package/dist/components/DialogActions.js +0 -20
  105. package/dist/components/FileTypeIcon.d.ts +0 -18
  106. package/dist/components/FileTypeIcon.d.ts.map +0 -1
  107. package/dist/components/FileTypeIcon.js +0 -48
  108. package/dist/components/GenericModelList.d.ts +0 -52
  109. package/dist/components/GenericModelList.d.ts.map +0 -1
  110. package/dist/components/GenericModelList.js +0 -194
  111. package/dist/components/GenericRelatedModelList.d.ts +0 -54
  112. package/dist/components/GenericRelatedModelList.d.ts.map +0 -1
  113. package/dist/components/GenericRelatedModelList.js +0 -181
  114. package/dist/components/GenericRelatedModelListTable.d.ts +0 -55
  115. package/dist/components/GenericRelatedModelListTable.d.ts.map +0 -1
  116. package/dist/components/GenericRelatedModelListTable.js +0 -31
  117. package/dist/components/Image.d.ts +0 -10
  118. package/dist/components/Image.d.ts.map +0 -1
  119. package/dist/components/Image.js +0 -111
  120. package/dist/components/details/DetailBySchema.d.ts +0 -4
  121. package/dist/components/details/DetailBySchema.d.ts.map +0 -1
  122. package/dist/components/details/DetailBySchema.js +0 -175
  123. package/dist/components/details/DetailFieldBySchema.d.ts +0 -4
  124. package/dist/components/details/DetailFieldBySchema.d.ts.map +0 -1
  125. package/dist/components/details/DetailFieldBySchema.js +0 -88
  126. package/dist/components/forms/DialogFormBySchema.d.ts +0 -22
  127. package/dist/components/forms/DialogFormBySchema.d.ts.map +0 -1
  128. package/dist/components/forms/DialogFormBySchema.js +0 -97
  129. package/dist/components/forms/FieldBySchema.d.ts +0 -4
  130. package/dist/components/forms/FieldBySchema.d.ts.map +0 -1
  131. package/dist/components/forms/FieldBySchema.js +0 -80
  132. package/dist/components/forms/Form.d.ts +0 -61
  133. package/dist/components/forms/Form.d.ts.map +0 -1
  134. package/dist/components/forms/Form.js +0 -264
  135. package/dist/components/forms/FormActions.d.ts +0 -20
  136. package/dist/components/forms/FormActions.d.ts.map +0 -1
  137. package/dist/components/forms/FormActions.js +0 -55
  138. package/dist/components/forms/FormBySchema.d.ts +0 -21
  139. package/dist/components/forms/FormBySchema.d.ts.map +0 -1
  140. package/dist/components/forms/FormBySchema.js +0 -280
  141. package/dist/components/forms/FormWatcher.d.ts +0 -10
  142. package/dist/components/forms/FormWatcher.d.ts.map +0 -1
  143. package/dist/components/forms/FormWatcher.js +0 -25
  144. package/dist/components/forms/inputs/AutocompleteFieldBySchema.d.ts +0 -13
  145. package/dist/components/forms/inputs/AutocompleteFieldBySchema.d.ts.map +0 -1
  146. package/dist/components/forms/inputs/AutocompleteFieldBySchema.js +0 -133
  147. package/dist/components/forms/inputs/BooleanFieldBySchema.d.ts +0 -4
  148. package/dist/components/forms/inputs/BooleanFieldBySchema.d.ts.map +0 -1
  149. package/dist/components/forms/inputs/BooleanFieldBySchema.js +0 -39
  150. package/dist/components/forms/inputs/DesktopDatePickerBySchema.d.ts +0 -5
  151. package/dist/components/forms/inputs/DesktopDatePickerBySchema.d.ts.map +0 -1
  152. package/dist/components/forms/inputs/DesktopDatePickerBySchema.js +0 -54
  153. package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.d.ts +0 -5
  154. package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.d.ts.map +0 -1
  155. package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.js +0 -47
  156. package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts +0 -14
  157. package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts.map +0 -1
  158. package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.js +0 -272
  159. package/dist/components/forms/inputs/FileFieldBySchema.d.ts +0 -4
  160. package/dist/components/forms/inputs/FileFieldBySchema.d.ts.map +0 -1
  161. package/dist/components/forms/inputs/FileFieldBySchema.js +0 -144
  162. package/dist/components/forms/inputs/FloatFieldBySchema.d.ts +0 -4
  163. package/dist/components/forms/inputs/FloatFieldBySchema.d.ts.map +0 -1
  164. package/dist/components/forms/inputs/FloatFieldBySchema.js +0 -64
  165. package/dist/components/forms/inputs/GeometryFieldBySchema.d.ts +0 -8
  166. package/dist/components/forms/inputs/GeometryFieldBySchema.d.ts.map +0 -1
  167. package/dist/components/forms/inputs/GeometryFieldBySchema.js +0 -57
  168. package/dist/components/forms/inputs/MapGeometryPicker.d.ts +0 -19
  169. package/dist/components/forms/inputs/MapGeometryPicker.d.ts.map +0 -1
  170. package/dist/components/forms/inputs/MapGeometryPicker.js +0 -322
  171. package/dist/components/forms/inputs/PatternFieldBySchema.d.ts +0 -4
  172. package/dist/components/forms/inputs/PatternFieldBySchema.d.ts.map +0 -1
  173. package/dist/components/forms/inputs/PatternFieldBySchema.js +0 -56
  174. package/dist/components/forms/inputs/TextFieldBySchema.d.ts +0 -4
  175. package/dist/components/forms/inputs/TextFieldBySchema.d.ts.map +0 -1
  176. package/dist/components/forms/inputs/TextFieldBySchema.js +0 -56
  177. package/dist/components/forms/inputs/leafletMarker.d.ts +0 -12
  178. package/dist/components/forms/inputs/leafletMarker.d.ts.map +0 -1
  179. package/dist/components/forms/inputs/leafletMarker.js +0 -52
  180. package/dist/context/APIWrapper.d.ts +0 -18
  181. package/dist/context/APIWrapper.d.ts.map +0 -1
  182. package/dist/context/APIWrapper.js +0 -584
  183. package/dist/context/APIWrapperContext.d.ts +0 -129
  184. package/dist/context/APIWrapperContext.d.ts.map +0 -1
  185. package/dist/context/APIWrapperContext.js +0 -60
  186. package/dist/context/DRFReactBySchemaContext.d.ts +0 -28
  187. package/dist/context/DRFReactBySchemaContext.d.ts.map +0 -1
  188. package/dist/context/DRFReactBySchemaContext.js +0 -20
  189. package/dist/context/DRFReactBySchemaProvider.d.ts +0 -5
  190. package/dist/context/DRFReactBySchemaProvider.d.ts.map +0 -1
  191. package/dist/context/DRFReactBySchemaProvider.js +0 -93
  192. package/dist/context/Overlays.d.ts +0 -5
  193. package/dist/context/Overlays.d.ts.map +0 -1
  194. package/dist/context/Overlays.js +0 -114
  195. package/dist/context/PrivateContext.d.ts +0 -10
  196. package/dist/context/PrivateContext.d.ts.map +0 -1
  197. package/dist/context/PrivateContext.js +0 -16
  198. package/dist/hooks/useDeepMemo.d.ts +0 -2
  199. package/dist/hooks/useDeepMemo.d.ts.map +0 -1
  200. package/dist/hooks/useDeepMemo.js +0 -13
  201. package/dist/hooks/useWhyDidYouUpdate.d.ts +0 -4
  202. package/dist/hooks/useWhyDidYouUpdate.d.ts.map +0 -1
  203. package/dist/hooks/useWhyDidYouUpdate.js +0 -26
  204. package/dist/index.d.ts +0 -35
  205. package/dist/index.d.ts.map +0 -1
  206. package/dist/index.js +0 -104
  207. package/dist/styles/grid.d.ts +0 -3
  208. package/dist/styles/grid.d.ts.map +0 -1
  209. package/dist/styles/grid.js +0 -38
  210. package/dist/styles/index.d.ts +0 -3
  211. package/dist/styles/index.d.ts.map +0 -1
  212. package/dist/styles/index.js +0 -38
  213. package/dist/styles/layout.d.ts +0 -23
  214. package/dist/styles/layout.d.ts.map +0 -1
  215. package/dist/styles/layout.js +0 -71
  216. package/dist/styles/texts.d.ts +0 -48
  217. package/dist/styles/texts.d.ts.map +0 -1
  218. package/dist/styles/texts.js +0 -55
  219. package/dist/styles/theme.d.ts +0 -29
  220. package/dist/styles/theme.d.ts.map +0 -1
  221. package/dist/styles/theme.js +0 -226
  222. package/dist/utils/index.d.ts +0 -2
  223. package/dist/utils/index.d.ts.map +0 -1
  224. package/dist/utils/index.js +0 -17
  225. package/dist/utils/utils.d.ts +0 -107
  226. package/dist/utils/utils.d.ts.map +0 -1
  227. package/dist/utils/utils.js +0 -957
@@ -1,155 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,36 +0,0 @@
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;
@@ -1,10 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,85 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,87 +0,0 @@
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
- }
@@ -1,18 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,24 +0,0 @@
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;
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,166 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { GridRenderEditCellParams } from '@mui/x-data-grid';
3
- export default function GridDateTimeInput(props: GridRenderEditCellParams & {
4
- helperText?: string;
5
- }): React.JSX.Element;
6
- //# sourceMappingURL=GridDateTimeInput.d.ts.map