drf-react-by-schema 0.28.7 → 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.
Files changed (232) hide show
  1. package/dist/@types/index.d.ts +410 -0
  2. package/dist/@types/index.d.ts.map +1 -0
  3. package/dist/@types/index.js +9 -0
  4. package/dist/@types/string-mask.d.ts +10 -0
  5. package/dist/@types/string-mask.d.ts.map +1 -0
  6. package/dist/@types/string-mask.js +1 -0
  7. package/dist/api.d.ts +81 -0
  8. package/dist/api.d.ts.map +1 -0
  9. package/dist/api.js +1118 -0
  10. package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts +8 -0
  11. package/dist/components/DataGridBySchemaEditable/BooleanInputCell.d.ts.map +1 -0
  12. package/dist/components/DataGridBySchemaEditable/BooleanInputCell.js +86 -0
  13. package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.d.ts +12 -0
  14. package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.d.ts.map +1 -0
  15. package/dist/components/DataGridBySchemaEditable/ConditionalEditWrapper.js +71 -0
  16. package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts +9 -0
  17. package/dist/components/DataGridBySchemaEditable/ConfirmDialog.d.ts.map +1 -0
  18. package/dist/components/DataGridBySchemaEditable/ConfirmDialog.js +21 -0
  19. package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts +26 -0
  20. package/dist/components/DataGridBySchemaEditable/CustomToolbar.d.ts.map +1 -0
  21. package/dist/components/DataGridBySchemaEditable/CustomToolbar.js +146 -0
  22. package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts +73 -0
  23. package/dist/components/DataGridBySchemaEditable/DataGridDesktop.d.ts.map +1 -0
  24. package/dist/components/DataGridBySchemaEditable/DataGridDesktop.js +421 -0
  25. package/dist/components/DataGridBySchemaEditable/DataGridMobile.d.ts +18 -0
  26. package/dist/components/DataGridBySchemaEditable/DataGridMobile.d.ts.map +1 -0
  27. package/dist/components/DataGridBySchemaEditable/DataGridMobile.js +105 -0
  28. package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts +11 -0
  29. package/dist/components/DataGridBySchemaEditable/FileInputCell.d.ts.map +1 -0
  30. package/dist/components/DataGridBySchemaEditable/FileInputCell.js +155 -0
  31. package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts +12 -0
  32. package/dist/components/DataGridBySchemaEditable/FooterToolbar.d.ts.map +1 -0
  33. package/dist/components/DataGridBySchemaEditable/FooterToolbar.js +36 -0
  34. package/dist/components/DataGridBySchemaEditable/GeoEditCell.d.ts +10 -0
  35. package/dist/components/DataGridBySchemaEditable/GeoEditCell.d.ts.map +1 -0
  36. package/dist/components/DataGridBySchemaEditable/GeoEditCell.js +85 -0
  37. package/dist/components/DataGridBySchemaEditable/GeoThumbCell.d.ts +11 -0
  38. package/dist/components/DataGridBySchemaEditable/GeoThumbCell.d.ts.map +1 -0
  39. package/dist/components/DataGridBySchemaEditable/GeoThumbCell.js +87 -0
  40. package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.d.ts +18 -0
  41. package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.d.ts.map +1 -0
  42. package/dist/components/DataGridBySchemaEditable/GridActionsCellItemLink.js +24 -0
  43. package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts +8 -0
  44. package/dist/components/DataGridBySchemaEditable/GridDateInput.d.ts.map +1 -0
  45. package/dist/components/DataGridBySchemaEditable/GridDateInput.js +166 -0
  46. package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.d.ts +6 -0
  47. package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.d.ts.map +1 -0
  48. package/dist/components/DataGridBySchemaEditable/GridDateTimeInput.js +154 -0
  49. package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts +10 -0
  50. package/dist/components/DataGridBySchemaEditable/GridDecimalInput.d.ts.map +1 -0
  51. package/dist/components/DataGridBySchemaEditable/GridDecimalInput.js +78 -0
  52. package/dist/components/DataGridBySchemaEditable/GridGenericInput.d.ts +8 -0
  53. package/dist/components/DataGridBySchemaEditable/GridGenericInput.d.ts.map +1 -0
  54. package/dist/components/DataGridBySchemaEditable/GridGenericInput.js +30 -0
  55. package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts +7 -0
  56. package/dist/components/DataGridBySchemaEditable/GridPatternInput.d.ts.map +1 -0
  57. package/dist/components/DataGridBySchemaEditable/GridPatternInput.js +74 -0
  58. package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts +21 -0
  59. package/dist/components/DataGridBySchemaEditable/InputInterval.d.ts.map +1 -0
  60. package/dist/components/DataGridBySchemaEditable/InputInterval.js +131 -0
  61. package/dist/components/DataGridBySchemaEditable/MobileSearchBar.d.ts +9 -0
  62. package/dist/components/DataGridBySchemaEditable/MobileSearchBar.d.ts.map +1 -0
  63. package/dist/components/DataGridBySchemaEditable/MobileSearchBar.js +70 -0
  64. package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.d.ts +7 -0
  65. package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.d.ts.map +1 -0
  66. package/dist/components/DataGridBySchemaEditable/RowEditingWatcher.js +41 -0
  67. package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts +24 -0
  68. package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.d.ts.map +1 -0
  69. package/dist/components/DataGridBySchemaEditable/SelectEditInputCell.js +259 -0
  70. package/dist/components/DataGridBySchemaEditable/geoConstants.d.ts +5 -0
  71. package/dist/components/DataGridBySchemaEditable/geoConstants.d.ts.map +1 -0
  72. package/dist/components/DataGridBySchemaEditable/geoConstants.js +6 -0
  73. package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.d.ts +33 -0
  74. package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.d.ts.map +1 -0
  75. package/dist/components/DataGridBySchemaEditable/hooks/useDataGridActions.js +161 -0
  76. package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.d.ts +14 -0
  77. package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.d.ts.map +1 -0
  78. package/dist/components/DataGridBySchemaEditable/hooks/useOptionsAC.js +69 -0
  79. package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.d.ts +9 -0
  80. package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.d.ts.map +1 -0
  81. package/dist/components/DataGridBySchemaEditable/hooks/usePreparedColumns.js +73 -0
  82. package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts +30 -0
  83. package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.d.ts.map +1 -0
  84. package/dist/components/DataGridBySchemaEditable/hooks/useProcessRowUpdate.js +199 -0
  85. package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts +33 -0
  86. package/dist/components/DataGridBySchemaEditable/utils/columnFactory.d.ts.map +1 -0
  87. package/dist/components/DataGridBySchemaEditable/utils/columnFactory.js +270 -0
  88. package/dist/components/DataGridBySchemaEditable/utils.d.ts +40 -0
  89. package/dist/components/DataGridBySchemaEditable/utils.d.ts.map +1 -0
  90. package/dist/components/DataGridBySchemaEditable/utils.js +181 -0
  91. package/dist/components/DataGridBySchemaEditable.d.ts +64 -0
  92. package/dist/components/DataGridBySchemaEditable.d.ts.map +1 -0
  93. package/dist/components/DataGridBySchemaEditable.js +172 -0
  94. package/dist/components/DataTotals.d.ts +12 -0
  95. package/dist/components/DataTotals.d.ts.map +1 -0
  96. package/dist/components/DataTotals.js +32 -0
  97. package/dist/components/DataTotalsServer.d.ts +10 -0
  98. package/dist/components/DataTotalsServer.d.ts.map +1 -0
  99. package/dist/components/DataTotalsServer.js +18 -0
  100. package/dist/components/DialogActions.d.ts +11 -0
  101. package/dist/components/DialogActions.d.ts.map +1 -0
  102. package/dist/components/DialogActions.js +20 -0
  103. package/dist/components/FileTypeIcon.d.ts +18 -0
  104. package/dist/components/FileTypeIcon.d.ts.map +1 -0
  105. package/dist/components/FileTypeIcon.js +48 -0
  106. package/dist/components/GenericModelList.d.ts +53 -0
  107. package/dist/components/GenericModelList.d.ts.map +1 -0
  108. package/dist/components/GenericModelList.js +194 -0
  109. package/dist/components/GenericRelatedModelList.d.ts +55 -0
  110. package/dist/components/GenericRelatedModelList.d.ts.map +1 -0
  111. package/dist/components/GenericRelatedModelList.js +181 -0
  112. package/dist/components/GenericRelatedModelListTable.d.ts +56 -0
  113. package/dist/components/GenericRelatedModelListTable.d.ts.map +1 -0
  114. package/dist/components/GenericRelatedModelListTable.js +31 -0
  115. package/dist/components/Image.d.ts +10 -0
  116. package/dist/components/Image.d.ts.map +1 -0
  117. package/dist/components/Image.js +111 -0
  118. package/dist/components/details/DetailBySchema.d.ts +4 -0
  119. package/dist/components/details/DetailBySchema.d.ts.map +1 -0
  120. package/dist/components/details/DetailBySchema.js +175 -0
  121. package/dist/components/details/DetailFieldBySchema.d.ts +4 -0
  122. package/dist/components/details/DetailFieldBySchema.d.ts.map +1 -0
  123. package/dist/components/details/DetailFieldBySchema.js +88 -0
  124. package/dist/components/forms/ChangePasswordForm.d.ts +7 -0
  125. package/dist/components/forms/ChangePasswordForm.d.ts.map +1 -0
  126. package/dist/components/forms/ChangePasswordForm.js +93 -0
  127. package/dist/components/forms/DialogFormBySchema.d.ts +22 -0
  128. package/dist/components/forms/DialogFormBySchema.d.ts.map +1 -0
  129. package/dist/components/forms/DialogFormBySchema.js +97 -0
  130. package/dist/components/forms/FieldBySchema.d.ts +4 -0
  131. package/dist/components/forms/FieldBySchema.d.ts.map +1 -0
  132. package/dist/components/forms/FieldBySchema.js +80 -0
  133. package/dist/components/forms/ForgotPasswordForm.d.ts +11 -0
  134. package/dist/components/forms/ForgotPasswordForm.d.ts.map +1 -0
  135. package/dist/components/forms/ForgotPasswordForm.js +114 -0
  136. package/dist/components/forms/Form.d.ts +61 -0
  137. package/dist/components/forms/Form.d.ts.map +1 -0
  138. package/dist/components/forms/Form.js +264 -0
  139. package/dist/components/forms/FormActions.d.ts +20 -0
  140. package/dist/components/forms/FormActions.d.ts.map +1 -0
  141. package/dist/components/forms/FormActions.js +55 -0
  142. package/dist/components/forms/FormBySchema.d.ts +21 -0
  143. package/dist/components/forms/FormBySchema.d.ts.map +1 -0
  144. package/dist/components/forms/FormBySchema.js +280 -0
  145. package/dist/components/forms/FormWatcher.d.ts +10 -0
  146. package/dist/components/forms/FormWatcher.d.ts.map +1 -0
  147. package/dist/components/forms/FormWatcher.js +25 -0
  148. package/dist/components/forms/inputs/AutocompleteFieldBySchema.d.ts +13 -0
  149. package/dist/components/forms/inputs/AutocompleteFieldBySchema.d.ts.map +1 -0
  150. package/dist/components/forms/inputs/AutocompleteFieldBySchema.js +133 -0
  151. package/dist/components/forms/inputs/BooleanFieldBySchema.d.ts +4 -0
  152. package/dist/components/forms/inputs/BooleanFieldBySchema.d.ts.map +1 -0
  153. package/dist/components/forms/inputs/BooleanFieldBySchema.js +39 -0
  154. package/dist/components/forms/inputs/DesktopDatePickerBySchema.d.ts +5 -0
  155. package/dist/components/forms/inputs/DesktopDatePickerBySchema.d.ts.map +1 -0
  156. package/dist/components/forms/inputs/DesktopDatePickerBySchema.js +54 -0
  157. package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.d.ts +5 -0
  158. package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.d.ts.map +1 -0
  159. package/dist/components/forms/inputs/DesktopDateTimePickerBySchema.js +47 -0
  160. package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts +14 -0
  161. package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.d.ts.map +1 -0
  162. package/dist/components/forms/inputs/EditableAutocompleteFieldBySchema.js +272 -0
  163. package/dist/components/forms/inputs/FileFieldBySchema.d.ts +4 -0
  164. package/dist/components/forms/inputs/FileFieldBySchema.d.ts.map +1 -0
  165. package/dist/components/forms/inputs/FileFieldBySchema.js +144 -0
  166. package/dist/components/forms/inputs/FloatFieldBySchema.d.ts +4 -0
  167. package/dist/components/forms/inputs/FloatFieldBySchema.d.ts.map +1 -0
  168. package/dist/components/forms/inputs/FloatFieldBySchema.js +64 -0
  169. package/dist/components/forms/inputs/GeometryFieldBySchema.d.ts +8 -0
  170. package/dist/components/forms/inputs/GeometryFieldBySchema.d.ts.map +1 -0
  171. package/dist/components/forms/inputs/GeometryFieldBySchema.js +61 -0
  172. package/dist/components/forms/inputs/MapGeometryPicker.d.ts +19 -0
  173. package/dist/components/forms/inputs/MapGeometryPicker.d.ts.map +1 -0
  174. package/dist/components/forms/inputs/MapGeometryPicker.js +344 -0
  175. package/dist/components/forms/inputs/PatternFieldBySchema.d.ts +4 -0
  176. package/dist/components/forms/inputs/PatternFieldBySchema.d.ts.map +1 -0
  177. package/dist/components/forms/inputs/PatternFieldBySchema.js +56 -0
  178. package/dist/components/forms/inputs/TextFieldBySchema.d.ts +4 -0
  179. package/dist/components/forms/inputs/TextFieldBySchema.d.ts.map +1 -0
  180. package/dist/components/forms/inputs/TextFieldBySchema.js +56 -0
  181. package/dist/components/forms/inputs/leafletMarker.d.ts +12 -0
  182. package/dist/components/forms/inputs/leafletMarker.d.ts.map +1 -0
  183. package/dist/components/forms/inputs/leafletMarker.js +52 -0
  184. package/dist/context/APIWrapper.d.ts +18 -0
  185. package/dist/context/APIWrapper.d.ts.map +1 -0
  186. package/dist/context/APIWrapper.js +593 -0
  187. package/dist/context/APIWrapperContext.d.ts +132 -0
  188. package/dist/context/APIWrapperContext.d.ts.map +1 -0
  189. package/dist/context/APIWrapperContext.js +63 -0
  190. package/dist/context/DRFReactBySchemaContext.d.ts +31 -0
  191. package/dist/context/DRFReactBySchemaContext.d.ts.map +1 -0
  192. package/dist/context/DRFReactBySchemaContext.js +20 -0
  193. package/dist/context/DRFReactBySchemaProvider.d.ts +5 -0
  194. package/dist/context/DRFReactBySchemaProvider.d.ts.map +1 -0
  195. package/dist/context/DRFReactBySchemaProvider.js +105 -0
  196. package/dist/context/Overlays.d.ts +5 -0
  197. package/dist/context/Overlays.d.ts.map +1 -0
  198. package/dist/context/Overlays.js +114 -0
  199. package/dist/context/PrivateContext.d.ts +10 -0
  200. package/dist/context/PrivateContext.d.ts.map +1 -0
  201. package/dist/context/PrivateContext.js +16 -0
  202. package/dist/hooks/useDeepMemo.d.ts +2 -0
  203. package/dist/hooks/useDeepMemo.d.ts.map +1 -0
  204. package/dist/hooks/useDeepMemo.js +13 -0
  205. package/dist/hooks/useWhyDidYouUpdate.d.ts +4 -0
  206. package/dist/hooks/useWhyDidYouUpdate.d.ts.map +1 -0
  207. package/dist/hooks/useWhyDidYouUpdate.js +26 -0
  208. package/dist/index.d.ts +37 -0
  209. package/dist/index.d.ts.map +1 -0
  210. package/dist/index.js +108 -0
  211. package/dist/styles/grid.d.ts +3 -0
  212. package/dist/styles/grid.d.ts.map +1 -0
  213. package/dist/styles/grid.js +38 -0
  214. package/dist/styles/index.d.ts +3 -0
  215. package/dist/styles/index.d.ts.map +1 -0
  216. package/dist/styles/index.js +38 -0
  217. package/dist/styles/layout.d.ts +23 -0
  218. package/dist/styles/layout.d.ts.map +1 -0
  219. package/dist/styles/layout.js +71 -0
  220. package/dist/styles/texts.d.ts +66 -0
  221. package/dist/styles/texts.d.ts.map +1 -0
  222. package/dist/styles/texts.js +73 -0
  223. package/dist/styles/theme.d.ts +29 -0
  224. package/dist/styles/theme.d.ts.map +1 -0
  225. package/dist/styles/theme.js +226 -0
  226. package/dist/utils/index.d.ts +2 -0
  227. package/dist/utils/index.d.ts.map +1 -0
  228. package/dist/utils/index.js +17 -0
  229. package/dist/utils/utils.d.ts +107 -0
  230. package/dist/utils/utils.d.ts.map +1 -0
  231. package/dist/utils/utils.js +957 -0
  232. package/package.json +12 -4
@@ -0,0 +1,421 @@
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
+ const react_1 = __importStar(require("react"));
40
+ const x_data_grid_1 = require("@mui/x-data-grid");
41
+ const Check_1 = __importDefault(require("@mui/icons-material/Check"));
42
+ const Bolt_1 = __importDefault(require("@mui/icons-material/Bolt"));
43
+ const Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
44
+ const Close_1 = __importDefault(require("@mui/icons-material/Close"));
45
+ const Edit_1 = __importDefault(require("@mui/icons-material/Edit"));
46
+ const Delete_1 = __importDefault(require("@mui/icons-material/Delete"));
47
+ const GridActionsCellItemLink_1 = require("./GridActionsCellItemLink");
48
+ const Box_1 = __importDefault(require("@mui/material/Box"));
49
+ const CircularProgress_1 = __importDefault(require("@mui/material/CircularProgress"));
50
+ const styles_1 = require("../../styles");
51
+ const APIWrapperContext_1 = require("../../context/APIWrapperContext");
52
+ const utils_1 = require("../../utils");
53
+ const utils_2 = require("./utils");
54
+ const CustomToolbar_1 = require("./CustomToolbar");
55
+ const FooterToolbar_1 = require("./FooterToolbar");
56
+ const useOptionsAC_1 = require("./hooks/useOptionsAC");
57
+ const usePreparedColumns_1 = require("./hooks/usePreparedColumns");
58
+ const useDataGridActions_1 = require("./hooks/useDataGridActions");
59
+ const useProcessRowUpdate_1 = require("./hooks/useProcessRowUpdate");
60
+ const RowEditingWatcher_1 = __importDefault(require("./RowEditingWatcher"));
61
+ function DataGridDesktop({ schema, apiRef, dataGridRows, setDataGridRows, rowCount = 0, columns, columnVisibilityModel, model, name = Math.floor(Math.random() * 1000000).toString(), indexField = 'nome', addExistingModel, indexFieldMinWidth = 350, indexFieldBasePath = '', indexFieldViewBasePath, stateToLink = {}, minWidth = 80, loading, modelParent, modelParentId, customColumnOperations, customFieldFormLayouts, customLinkDestination, LinkComponent, onProcessRow, watchEditingRowValues, onEditModel, isEditable = false, nonEditableActions, hasBulkSelect, onSelectActions, sx: sxProp, isAutoHeight, defaultValues, hideFooterPagination, setVisibleRows, paginationModel, setPaginationModel, hideFooterComponent, hideToolbarComponent, tableAutoHeight, actions = ['editInline', 'remove'], customActions, hideColumnsButton, hideFilterButton, hideDensityButton, hideExportButton, hideQuickFilterBar, optionsAC: optionsACExternal, extraValidators, emptyItem, handleDeleteClick, setSnackBar, yupValidationSchema, }) {
62
+ const [dataGridLoading, setDataGridLoading] = (0, react_1.useState)(false);
63
+ const [isRowEditing, setIsRowEditing] = (0, react_1.useState)();
64
+ const [validationErrors, setValidationErrors] = (0, react_1.useState)({});
65
+ const [selectionModel, setSelectionModel] = (0, react_1.useState)([]);
66
+ const [selectionModelIds, setSelectionModelIds] = (0, react_1.useState)([]);
67
+ const processingRow = (0, react_1.useRef)(null);
68
+ const handleStopEditing = () => {
69
+ setIsRowEditing(undefined);
70
+ };
71
+ const handleStartEditing = (id) => {
72
+ setIsRowEditing(id);
73
+ };
74
+ const { setDialog, onEditModel: APIOnEditModel } = (0, APIWrapperContext_1.useAPIWrapper)();
75
+ if (!onEditModel) {
76
+ onEditModel = APIOnEditModel;
77
+ }
78
+ const handleSaveRow = (0, react_1.useCallback)((id) => {
79
+ if (id) {
80
+ apiRef.current.stopRowEditMode({ id });
81
+ }
82
+ }, [apiRef]);
83
+ const handleCancelRow = (0, react_1.useCallback)((id) => {
84
+ if (id) {
85
+ apiRef.current.stopRowEditMode({ id, ignoreModifications: true });
86
+ handleStopEditing();
87
+ if ((0, utils_1.isTmpId)(id)) {
88
+ (0, utils_2.deleteRow)({ id, apiRef, setDataGridRows });
89
+ }
90
+ }
91
+ }, [apiRef, setDataGridRows]);
92
+ const { optionsAC, updateOptionsAC } = (0, useOptionsAC_1.useOptionsAC)({
93
+ columns,
94
+ schema,
95
+ optionsACExternal,
96
+ });
97
+ const { handleAddItem, bulkUpdateData, bulkDeleteData, bulkCreateData, handleExportExcel } = (0, useDataGridActions_1.useDataGridActions)({
98
+ apiRef,
99
+ dataGridRows,
100
+ setDataGridRows,
101
+ setSnackBar,
102
+ emptyItem,
103
+ defaultValues,
104
+ model,
105
+ modelParent,
106
+ modelParentId,
107
+ schema,
108
+ setSelectionModel,
109
+ setSelectionModelIds,
110
+ setDataGridLoading,
111
+ indexField,
112
+ handleStartEditing,
113
+ isRowEditing,
114
+ onProcessRow,
115
+ });
116
+ const { preparedColumns, setPreparedColumns } = (0, usePreparedColumns_1.usePreparedColumns)({
117
+ apiRef,
118
+ schema,
119
+ columns,
120
+ isEditable,
121
+ actions,
122
+ customActions,
123
+ LinkComponent,
124
+ indexFieldBasePath,
125
+ indexFieldViewBasePath,
126
+ stateToLink,
127
+ validationErrors,
128
+ optionsAC,
129
+ onEditModel,
130
+ customFieldFormLayouts,
131
+ setDialog,
132
+ indexField,
133
+ addExistingModel,
134
+ indexFieldMinWidth,
135
+ minWidth,
136
+ customColumnOperations,
137
+ customLinkDestination,
138
+ });
139
+ const { processRowUpdate } = (0, useProcessRowUpdate_1.useProcessRowUpdate)({
140
+ preparedColumns,
141
+ indexField,
142
+ schema,
143
+ model,
144
+ yupValidationSchema,
145
+ extraValidators,
146
+ onEditModel,
147
+ onProcessRow,
148
+ updateOptionsAC,
149
+ apiRef,
150
+ setDataGridRows,
151
+ setDataGridLoading,
152
+ setValidationErrors,
153
+ processingRow,
154
+ modelParent,
155
+ modelParentId,
156
+ addExistingModel,
157
+ handleStopEditing,
158
+ });
159
+ // Column width grows with icon count; floor at 100 so the default two actions stay unchanged.
160
+ const actionCount = (isEditable ? actions.length : (nonEditableActions === null || nonEditableActions === void 0 ? void 0 : nonEditableActions.length) || 0) + ((customActions === null || customActions === void 0 ? void 0 : customActions.length) || 0);
161
+ const actionsColumnWidth = Math.max(100, actionCount * 40);
162
+ const actionColumn = (0, react_1.useMemo)(() => ({
163
+ field: 'actions',
164
+ type: 'actions',
165
+ headerName: '',
166
+ width: actionsColumnWidth,
167
+ getActions: (params) => {
168
+ const { id } = params;
169
+ if (isRowEditing === id) {
170
+ return [
171
+ react_1.default.createElement(x_data_grid_1.GridActionsCellItem, { key: "save", icon: react_1.default.createElement(Check_1.default, null), label: "Salvar", onClick: () => handleSaveRow(id), color: "success" }),
172
+ react_1.default.createElement(x_data_grid_1.GridActionsCellItem, { key: "cancel", icon: react_1.default.createElement(Close_1.default, null), label: "Cancelar", onClick: () => {
173
+ handleCancelRow(id);
174
+ }, color: "inherit" }),
175
+ ];
176
+ }
177
+ const actionItems = [];
178
+ const effActions = isEditable ? actions : nonEditableActions !== null && nonEditableActions !== void 0 ? nonEditableActions : [];
179
+ effActions.forEach((action) => {
180
+ var _a, _b;
181
+ switch (action) {
182
+ case 'editInline':
183
+ actionItems.push(react_1.default.createElement(x_data_grid_1.GridActionsCellItem, { key: `editInline_${id}`, icon: effActions.includes('edit') ? react_1.default.createElement(Bolt_1.default, null) : react_1.default.createElement(Edit_1.default, null), label: "Editar essa linha na tabela", onClick: () => {
184
+ const visibleColumns = apiRef.current.getAllColumns();
185
+ const firstEditableCol = visibleColumns.find((col) => col.editable && col.field !== 'actions');
186
+ const fieldToFocus = firstEditableCol === null || firstEditableCol === void 0 ? void 0 : firstEditableCol.field;
187
+ if (isRowEditing) {
188
+ handleCancelRow(isRowEditing);
189
+ }
190
+ apiRef.current.startRowEditMode({ id, fieldToFocus });
191
+ handleStartEditing(id);
192
+ }, color: "inherit" }));
193
+ break;
194
+ case 'remove':
195
+ actionItems.push(react_1.default.createElement(x_data_grid_1.GridActionsCellItem, { key: `remove_${id}`, icon: react_1.default.createElement(Delete_1.default, null), label: "Apagar essa linha", onClick: () => {
196
+ if ((0, utils_1.isTmpId)(id)) {
197
+ (0, utils_2.deleteRow)({ id, apiRef, setDataGridRows });
198
+ return;
199
+ }
200
+ handleDeleteClick(id);
201
+ }, color: "error" }));
202
+ break;
203
+ case 'edit':
204
+ if (!LinkComponent) {
205
+ console.log('you must pass LinkComponent prop to navigate externally');
206
+ break;
207
+ }
208
+ actionItems.push(react_1.default.createElement(GridActionsCellItemLink_1.GridActionsCellItemLink, { key: `edit_${id}`, icon: react_1.default.createElement(Edit_1.default, null), label: "Editar esse item em janela separada", color: "inherit", component: LinkComponent, to: (0, utils_2.buildEditPath)(indexFieldBasePath, id), state: stateToLink }));
209
+ break;
210
+ case 'view':
211
+ if (!LinkComponent) {
212
+ console.log('you must pass LinkComponent prop to navigate externally');
213
+ break;
214
+ }
215
+ if (!indexFieldViewBasePath) {
216
+ console.log('For view action to work, you must supply indexFieldViewBasePath prop!');
217
+ break;
218
+ }
219
+ actionItems.push(react_1.default.createElement(GridActionsCellItemLink_1.GridActionsCellItemLink, { key: `view_${id}`, icon: react_1.default.createElement(Visibility_1.default, null), label: "Visualizar esse item em janela separada", color: "inherit", component: LinkComponent, to: (0, utils_2.buildEditPath)(indexFieldViewBasePath, id), state: stateToLink }));
220
+ break;
221
+ default: {
222
+ // Custom row action supplied as an object (CustomRowAction) inside
223
+ // the `actions` prop. It renders a single icon button whose click
224
+ // calls `handleClick` with the row's item. Works for any grid,
225
+ // including related lists without checkbox/row selection.
226
+ const rowAction = action;
227
+ if (typeof rowAction !== 'string' && rowAction.icon) {
228
+ actionItems.push(react_1.default.createElement(x_data_grid_1.GridActionsCellItem, { key: `${(_a = rowAction.label) !== null && _a !== void 0 ? _a : 'custom'}_${id}`, icon: rowAction.icon, label: (_b = rowAction.label) !== null && _b !== void 0 ? _b : 'Ação personalizada', onClick: () => rowAction.handleClick(dataGridRows.find((row) => row.id === id)) }));
229
+ }
230
+ break;
231
+ }
232
+ }
233
+ });
234
+ if (customActions) {
235
+ customActions.forEach((customAction) => {
236
+ actionItems.push(react_1.default.createElement(x_data_grid_1.GridActionsCellItem, { key: `${customAction.key}_${id}`, icon: customAction.icon, label: customAction.label, onClick: () => customAction.handleClick(dataGridRows.find((row) => row.id === id)) }));
237
+ });
238
+ }
239
+ return actionItems;
240
+ },
241
+ }), [
242
+ apiRef,
243
+ handleDeleteClick,
244
+ isRowEditing,
245
+ dataGridRows,
246
+ LinkComponent,
247
+ actions,
248
+ nonEditableActions,
249
+ isEditable,
250
+ customActions,
251
+ actionsColumnWidth,
252
+ indexFieldBasePath,
253
+ indexFieldViewBasePath,
254
+ stateToLink,
255
+ ]);
256
+ const InternalFooter = (0, react_1.useCallback)(() => (react_1.default.createElement(FooterToolbar_1.FooterToolbar, { isEditable: isEditable, handleAddItem: handleAddItem, isRowEditing: isRowEditing, handleSaveRow: handleSaveRow, handleCancelRow: handleCancelRow })), [isEditable, handleAddItem, isRowEditing, handleSaveRow, handleCancelRow]);
257
+ const checkboxSelection = hasBulkSelect ? true : undefined;
258
+ const disableRowSelectionOnClick = hasBulkSelect ? true : undefined;
259
+ const sx = Object.assign(Object.assign({}, sxProp), (isAutoHeight || tableAutoHeight
260
+ ? {
261
+ '&.MuiDataGrid-root--densityCompact .MuiDataGrid-cell': { py: '8px' },
262
+ '&.MuiDataGrid-root--densityStandard .MuiDataGrid-cell': { py: '15px' },
263
+ '&.MuiDataGrid-root--densityComfortable .MuiDataGrid-cell': { py: '22px' },
264
+ }
265
+ : {}));
266
+ return (react_1.default.createElement(Box_1.default, { className: `dataGrid_${name}${isAutoHeight || tableAutoHeight ? ' dataGrid-autoHeight' : ''}`, sx: Object.assign({ height: '100%', width: '100%', maxWidth: '100%', display: 'grid' }, sxProp) }, preparedColumns === null ? (react_1.default.createElement(Box_1.default, { sx: styles_1.Layout.loadingBox },
267
+ react_1.default.createElement(CircularProgress_1.default, null))) : (react_1.default.createElement(x_data_grid_1.DataGrid, { apiRef: apiRef,
268
+ // TODO: check if commenting this onKeyDown resurfaces a problem of enter propagation submiting a form
269
+ // onKeyDown={(event) => {
270
+ // if (event.key !== 'Enter') {
271
+ // return;
272
+ // }
273
+ // const target = event.target as HTMLElement;
274
+ // // Enter in an editing cell must not submit an enclosing form.
275
+ // if (target.closest('.MuiDataGrid-cell--editing')) {
276
+ // event.preventDefault();
277
+ // }
278
+ // }}
279
+ rows: dataGridRows, columns: isEditable || nonEditableActions
280
+ ? [actionColumn, ...(preparedColumns || [])]
281
+ : preparedColumns || [], getCellClassName: ({ id, cellMode, field }) => {
282
+ if (cellMode !== 'edit') {
283
+ return '';
284
+ }
285
+ const rowError = validationErrors[id];
286
+ return rowError && rowError[field] ? 'cell--error' : '';
287
+ }, editMode: "row", loading: dataGridLoading || loading, hideFooterPagination: hideFooterPagination, getRowHeight: ({ id }) => {
288
+ if (isRowEditing === id || isAutoHeight || tableAutoHeight) {
289
+ return 'auto';
290
+ }
291
+ return null;
292
+ }, isCellEditable: ({ row, field }) => {
293
+ // const isRowEditing = apiRef.current.getRowMode(row.id) === 'edit';
294
+ const isPermanentRow = !(0, utils_1.isTmpId)(row.id);
295
+ const isIndexField = field === indexField;
296
+ const indexColumn = preparedColumns === null || preparedColumns === void 0 ? void 0 : preparedColumns.find((col) => col.field === indexField);
297
+ const hasValueFormatter = (indexColumn === null || indexColumn === void 0 ? void 0 : indexColumn.valueFormatter) !== undefined;
298
+ const isIndexFieldEditable = !(indexField in optionsAC) || hasValueFormatter;
299
+ return (
300
+ // isRowEditing &&
301
+ isPermanentRow || ((0, utils_1.isTmpId)(row.id) && (isIndexField || isIndexFieldEditable)));
302
+ }, checkboxSelection: checkboxSelection, onRowSelectionModelChange: (newSelectionModel) => {
303
+ const selectedData = dataGridRows.filter((item) => newSelectionModel.includes(item.id));
304
+ setSelectionModel(selectedData);
305
+ setSelectionModelIds([...newSelectionModel]);
306
+ }, rowSelectionModel: selectionModelIds, disableRowSelectionOnClick: disableRowSelectionOnClick, onRowEditStart: (params) => {
307
+ console.log({ onRowEditStart: params.reason, id: params.id, isRowEditing });
308
+ if (isRowEditing) {
309
+ handleSaveRow(isRowEditing);
310
+ }
311
+ handleStartEditing(params.id);
312
+ }, onRowEditStop: (params, event) => {
313
+ console.log({ onRowEditStop: params.reason });
314
+ if (params.reason === 'rowFocusOut') {
315
+ const isInsideGrid = !('target' in event);
316
+ if (!isInsideGrid) {
317
+ event.defaultMuiPrevented = true;
318
+ }
319
+ return;
320
+ }
321
+ const fieldSchema = params.field ? schema[params.field] : undefined;
322
+ if (params.reason === 'enterKeyDown' &&
323
+ ['date', 'datetime', 'nested object', 'field', 'choice', 'list'].includes((fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.type) || '')) {
324
+ event.defaultMuiPrevented = true;
325
+ return;
326
+ }
327
+ // Escape key prevents saving:
328
+ if (params.reason === 'escapeKeyDown') {
329
+ handleCancelRow(params.id);
330
+ }
331
+ }, processRowUpdate: processRowUpdate, onProcessRowUpdateError: (e) => {
332
+ setDataGridLoading(false);
333
+ if (e.message === 'CANCEL_TMP_ROW') {
334
+ return;
335
+ }
336
+ // if (processingRow.current) {
337
+ // apiRef.current.startRowEditMode({ id: processingRow.current });
338
+ // }
339
+ let msg = 'Ocorreu um erro desconhecido ao salvar.';
340
+ if (e.message === 'Validation Error') {
341
+ msg = 'Não foi possível salvar os dados. Confira os erros nos campos.';
342
+ }
343
+ else if (e.message) {
344
+ msg = e.message;
345
+ }
346
+ setSnackBar({
347
+ open: true,
348
+ severity: 'error',
349
+ msg,
350
+ });
351
+ console.log(e);
352
+ }, slots: {
353
+ // toolbar: hideToolbarComponent ? () => <React.Fragment /> : CustomToolbar,
354
+ toolbar: (props) => (react_1.default.createElement(react_1.default.Fragment, null,
355
+ isEditable && watchEditingRowValues && (react_1.default.createElement(RowEditingWatcher_1.default, { watchEditingRowValues: watchEditingRowValues })),
356
+ !hideToolbarComponent && react_1.default.createElement(CustomToolbar_1.CustomToolbar, Object.assign({}, props)))),
357
+ footer: hideFooterComponent ? () => react_1.default.createElement(react_1.default.Fragment, null) : InternalFooter,
358
+ }, slotProps: {
359
+ toolbar: {
360
+ preparedColumns: preparedColumns || [],
361
+ setPreparedColumns: setPreparedColumns,
362
+ selectionModel: selectionModel,
363
+ onSelectActions: onSelectActions,
364
+ bulkUpdateData: bulkUpdateData,
365
+ bulkDeleteData,
366
+ bulkCreateData,
367
+ hideColumnsButton,
368
+ hideFilterButton,
369
+ hideDensityButton,
370
+ hideExportButton,
371
+ hideQuickFilterBar,
372
+ showQuickFilter: true,
373
+ quickFilterProps: { debounceMs: 500 },
374
+ handleExportExcel: paginationModel
375
+ ? () => handleExportExcel(paginationModel)
376
+ : undefined,
377
+ paginationMode: paginationModel ? 'server' : 'client',
378
+ },
379
+ filterPanel: {
380
+ sx: {
381
+ '& .MuiDataGrid-filterFormValueInput': {
382
+ width: 300,
383
+ },
384
+ },
385
+ },
386
+ },
387
+ // sx={sx}
388
+ sx: Object.assign(Object.assign({}, sx), { width: '100%', minWidth: 0 }), paginationMode: paginationModel ? 'server' : 'client', paginationModel: paginationModel
389
+ ? { page: paginationModel.page, pageSize: paginationModel.pageSize }
390
+ : undefined, onPaginationModelChange: (newModel) => {
391
+ if (setPaginationModel && paginationModel) {
392
+ setPaginationModel(Object.assign(Object.assign({}, paginationModel), { page: newModel.page, pageSize: newModel.pageSize }));
393
+ }
394
+ }, initialState: {
395
+ columns: { columnVisibilityModel },
396
+ pagination: !paginationModel ? { paginationModel: { pageSize: 100 } } : undefined,
397
+ }, rowCount: paginationModel && typeof rowCount !== 'undefined' ? rowCount : undefined, pageSizeOptions: paginationModel ? [paginationModel.pageSize] : [5, 10, 25, 50, 100], filterMode: paginationModel ? 'server' : 'client', onFilterModelChange: (newFilter) => {
398
+ if (setPaginationModel && paginationModel) {
399
+ setPaginationModel(Object.assign(Object.assign({}, paginationModel), { filter: newFilter }));
400
+ }
401
+ }, sortingMode: paginationModel ? 'server' : 'client', onSortModelChange: (newSorting) => {
402
+ if (setPaginationModel && paginationModel) {
403
+ setPaginationModel(Object.assign(Object.assign({}, paginationModel), { sort: newSorting }));
404
+ }
405
+ }, onStateChange: (state) => {
406
+ if (setVisibleRows) {
407
+ const visibleRows = (0, x_data_grid_1.gridFilteredSortedRowIdsSelector)(state, apiRef.current.instanceId);
408
+ setVisibleRows(visibleRows);
409
+ }
410
+ } }))));
411
+ }
412
+ // const shouldMemoUpdate = (prevProps: DataGridDesktopProps, nextProps: DataGridDesktopProps) => {
413
+ // return (
414
+ // prevProps.dataGridRows === nextProps.dataGridRows &&
415
+ // prevProps.loading === nextProps.loading &&
416
+ // prevProps.schema === nextProps.schema &&
417
+ // prevProps.columns === nextProps.columns
418
+ // );
419
+ // };
420
+ // export default React.memo(DataGridDesktop, shouldMemoUpdate);
421
+ exports.default = DataGridDesktop;
@@ -0,0 +1,18 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { CustomColumnOperations, GridEnrichedBySchemaColDef, Item, MobileListRenderItemType, PaginationModel, SchemaType } from '../../@types';
3
+ interface DataGridMobileProps {
4
+ name: string;
5
+ data: Item[];
6
+ columns: GridEnrichedBySchemaColDef[];
7
+ schema: SchemaType;
8
+ customColumnOperations?: CustomColumnOperations;
9
+ MobileListRenderItem: MobileListRenderItemType;
10
+ MobileRenderNoResults?: () => ReactElement | null;
11
+ hideQuickFilterBar?: boolean;
12
+ paginationModel?: PaginationModel;
13
+ setPaginationModel?: (x: PaginationModel) => void;
14
+ rowCount: number;
15
+ }
16
+ declare const DataGridMobile: React.ForwardRefExoticComponent<DataGridMobileProps & React.RefAttributes<unknown>>;
17
+ export default DataGridMobile;
18
+ //# sourceMappingURL=DataGridMobile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataGridMobile.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/DataGridMobile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,YAAY,EAAuB,MAAM,OAAO,CAAC;AAI7E,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,EAC1B,IAAI,EACJ,wBAAwB,EACxB,eAAe,EACf,UAAU,EAEX,MAAM,cAAc,CAAC;AAItB,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,MAAM,EAAE,UAAU,CAAC;IACnB,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,oBAAoB,EAAE,wBAAwB,CAAC;IAC/C,qBAAqB,CAAC,EAAE,MAAM,YAAY,GAAG,IAAI,CAAC;IAClD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,kBAAkB,CAAC,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;IAClD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,cAAc,qFA0GnB,CAAC;AAGF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,105 @@
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
+ const react_1 = __importStar(require("react"));
49
+ const Box_1 = __importDefault(require("@mui/material/Box"));
50
+ const Typography_1 = __importDefault(require("@mui/material/Typography"));
51
+ const utils_1 = require("../../utils");
52
+ const MobileSearchBar_1 = __importDefault(require("./MobileSearchBar"));
53
+ const DataGridMobile = (0, react_1.forwardRef)(({ name, columns, schema, data, customColumnOperations, MobileListRenderItem, MobileRenderNoResults, hideQuickFilterBar, paginationModel, setPaginationModel,
54
+ // rowCount,
55
+ }, _) => {
56
+ const [preparedColumns, setPreparedColumns] = (0, react_1.useState)([]);
57
+ const [formattedData, setFormattedData] = (0, react_1.useState)([]);
58
+ (0, react_1.useEffect)(() => {
59
+ const initColumns = () => __awaiter(void 0, void 0, void 0, function* () {
60
+ const preparedColumns = yield (0, utils_1.initViewColumns)({ columns, schema, customColumnOperations });
61
+ setPreparedColumns(preparedColumns);
62
+ });
63
+ initColumns();
64
+ }, [columns, schema, customColumnOperations]);
65
+ (0, react_1.useEffect)(() => {
66
+ if (preparedColumns.length === 0) {
67
+ return;
68
+ }
69
+ const newData = [];
70
+ for (const item of data) {
71
+ const newItem = {};
72
+ for (const column of preparedColumns) {
73
+ const field = column.field;
74
+ if (field in item) {
75
+ newItem[field] = {
76
+ title: column.headerName || '',
77
+ valueStr: column.valueFormatter
78
+ ? column.valueFormatter(item[field], item, column, undefined)
79
+ : item[field],
80
+ value: item[field],
81
+ };
82
+ }
83
+ }
84
+ newData.push({ item: newItem, id: item.id });
85
+ }
86
+ setFormattedData(newData);
87
+ }, [data, preparedColumns]);
88
+ return (react_1.default.createElement(Box_1.default, null,
89
+ !hideQuickFilterBar && paginationModel && setPaginationModel && (react_1.default.createElement("div", { className: "quickFilterBarWrapper" },
90
+ react_1.default.createElement(MobileSearchBar_1.default, { paginationModel: paginationModel, setPaginationModel: setPaginationModel }))),
91
+ formattedData.length === 0 && (react_1.default.createElement(react_1.default.Fragment, null, MobileRenderNoResults ? (react_1.default.createElement(MobileRenderNoResults, null)) : (react_1.default.createElement(Typography_1.default, null, "N\u00E3o h\u00E1 resultados")))),
92
+ formattedData.length > 0 && (react_1.default.createElement(Box_1.default, { sx: {
93
+ display: 'grid',
94
+ gap: { xs: 1.5, sm: 2 },
95
+ gridTemplateColumns: {
96
+ xs: '1fr',
97
+ sm: 'repeat(2, 1fr)',
98
+ md: 'repeat(3, 1fr)',
99
+ lg: 'repeat(4, 1fr)',
100
+ },
101
+ alignItems: 'stretch',
102
+ } }, formattedData.map((row, index) => (react_1.default.createElement(MobileListRenderItem, { key: `${name}_${index}`, item: row.item, id: row.id, index: index })))))));
103
+ });
104
+ DataGridMobile.displayName = 'DataGridMobile';
105
+ exports.default = DataGridMobile;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { GridRenderEditCellParams } from '@mui/x-data-grid';
3
+ import { SxProps, Theme } from '@mui/material/styles';
4
+ export default function FileInputCell(props: GridRenderEditCellParams & {
5
+ accept: string;
6
+ fileType?: string;
7
+ required?: boolean;
8
+ sx?: SxProps<Theme>;
9
+ helperText?: string;
10
+ }): React.JSX.Element;
11
+ //# sourceMappingURL=FileInputCell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileInputCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/FileInputCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAqB,MAAM,kBAAkB,CAAC;AAE/E,OAAO,EAAU,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AA2B9D,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,KAAK,EAAE,wBAAwB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,qBAmIF"}