@m4l/components 1.0.11 → 1.0.13

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 (144) hide show
  1. package/components/AccountPopover/{index.62b1290b.js → index.f22ad364.js} +4 -4
  2. package/components/AppBar/{index.b48343d8.js → index.8d90ce87.js} +4 -4
  3. package/components/CommonActions/components/ActionCancel/index.609a78ca.js +12 -0
  4. package/components/CommonActions/components/ActionFormCancel/index.a1318eac.js +56 -0
  5. package/components/CommonActions/components/ActionFormIntro/index.34d569d1.js +33 -0
  6. package/components/CommonActions/components/ActionIntro/index.ebac0bc1.js +25 -0
  7. package/components/CommonActions/components/Actions/index.258bf919.js +71 -0
  8. package/components/DataGrid/constants.e334cd50.js +10 -0
  9. package/components/DataGrid/formatters/ColumnBooleanFormatter/index.7fb1ebaa.js +26 -0
  10. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.0ee10612.js +22 -0
  11. package/components/DataGrid/formatters/ColumnDateFormatter/index.e00d0cf2.js +19 -0
  12. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.dce9ada8.js +23 -0
  13. package/components/DataGrid/formatters/ColumnNestedValueFormatter/index.880e743b.js +14 -0
  14. package/components/DataGrid/formatters/ColumnPointsFormatter/index.226cc583.js +10 -0
  15. package/components/DataGrid/formatters/ColumnPriceFormatter/index.bf9d9e60.js +10 -0
  16. package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.4045b2f2.js +36 -0
  17. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index.a87302d1.js +10 -0
  18. package/components/DataGrid/formatters/index.2c2f0ae4.js +1 -0
  19. package/components/DataGrid/index.68e19254.js +915 -0
  20. package/components/DataGrid/subcomponents/Actions/index.6b044e84.js +596 -0
  21. package/components/DataGrid/subcomponents/editors/TextEditor/index.3f0d9e28.js +76 -0
  22. package/components/DragResizeWindow/{index.8b3e79f7.js → index.a358789f.js} +6 -3
  23. package/components/DynamicFilter/constants.1dddd09c.js +31 -0
  24. package/components/DynamicFilter/dictionary.d28d39ef.js +51 -0
  25. package/components/DynamicFilter/helpers/{index.609b3915.js → index.11ed2896.js} +4 -4
  26. package/components/DynamicFilter/{index.0f04f223.js → index.056a99c7.js} +3 -3
  27. package/components/DynamicFilter/slots/{index.00b68384.js → index.82d7eaf2.js} +31 -31
  28. package/components/DynamicFilter/store/{index.85a2812f.js → index.9b5121d6.js} +2 -2
  29. package/components/DynamicFilter/subcomponents/{index.86c6fda2.js → index.778c93cc.js} +217 -15
  30. package/components/FieldLabel/{index.1577ac9c.js → index.6b6f708e.js} +4 -4
  31. package/components/GridLayout/{index.656840a5.js → index.68d907d4.js} +34 -11
  32. package/components/GridLayout/subcomponents/Griditem/{index.b23625d7.js → index.8955a794.js} +3 -4
  33. package/components/GridLayout/subcomponents/Responsive/{index.97505a31.js → index.45cecca2.js} +1 -2
  34. package/components/GridLayout/subcomponents/SizeProvider/{index.36cb4139.js → index.7050ac4f.js} +1 -1
  35. package/components/HelperText/{index.ebb53dac.js → index.09e80920.js} +1 -1
  36. package/components/Icon/{index.8ecfb193.js → index.83867398.js} +10 -26
  37. package/components/Image/{index.4a822ede.js → index.19aa7ff5.js} +3 -2
  38. package/components/LanguagePopover/index.921efd11.js +188 -0
  39. package/components/{mui_extended/LinearProgress/index.e9455b2e.js → LinearProgressIndeterminate/index.ea9c8518.js} +4 -9
  40. package/components/LoadingError/{index.9e829e8d.js → index.aee18b24.js} +11 -7
  41. package/components/MFLoader/{index.29f445e2.js → index.c975666e.js} +8 -4
  42. package/components/ModalDialog/{index.96c4aba3.js → index.0dd5af28.js} +14 -5
  43. package/components/NavLink/{index.9f5d5670.js → index.ad039baf.js} +3 -2
  44. package/components/NoItemSelected/{index.0ae9f28f.js → index.d10603d7.js} +13 -3
  45. package/components/ObjectLogs/{index.40c5047f.js → index.a3e42b21.js} +26 -8
  46. package/components/PDFViewer/{index.651cc4b6.js → index.35f68e67.js} +2 -2
  47. package/components/Page/{index.1d08818c.js → index.f4755eba.js} +18 -2
  48. package/components/PaperForm/{index.1a8b10d4.js → index.007ef4cf.js} +2 -2
  49. package/components/Period/{index.236971ae.js → index.9647181b.js} +15 -54
  50. package/components/PrintingSystem/{index.9fdae551.js → index.a69a9d85.js} +14 -15
  51. package/components/PrintingSystem/subcomponents/BodyNode/{index.794dbc69.js → index.528fcfbf.js} +1 -1
  52. package/components/PrintingSystem/subcomponents/ChartNode/{index.6bbf7d75.js → index.fbe87257.js} +1 -1
  53. package/components/PrintingSystem/subcomponents/DividerNode/{index.015a2212.js → index.f5adab1d.js} +1 -1
  54. package/components/PrintingSystem/subcomponents/FooterNode/{index.08eeb1d2.js → index.f42ca7dc.js} +1 -1
  55. package/components/PrintingSystem/subcomponents/GridNode/{index.23995699.js → index.041b9cff.js} +1 -1
  56. package/components/PrintingSystem/subcomponents/HeaderNode/{index.3fa36620.js → index.a8140332.js} +1 -1
  57. package/components/PrintingSystem/subcomponents/PaperNode/{index.8b7d43f4.js → index.aabde2bb.js} +1 -1
  58. package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.9856c572.js → index.7f75ca46.js} +1 -1
  59. package/components/PrintingSystem/subcomponents/SectionNode/{index.89b3a4e0.js → index.61babb47.js} +1 -1
  60. package/components/PrintingSystem/subcomponents/TextBoxNode/{index.dc6e9dc2.js → index.4d0e67a3.js} +1 -1
  61. package/components/PropertyValue/{index.646a7e8b.js → index.51faabb5.js} +7 -4
  62. package/components/Resizeable/{index.414ff687.js → index.4f75c0b5.js} +1 -1
  63. package/components/ScrollBar/{index.1e89bb44.js → index.21bc5025.js} +1 -1
  64. package/components/SideBar/{index.d221254d.js → index.4075c562.js} +36 -7
  65. package/components/SplitLayout/{index.7d9edf4e.js → index.15756f0f.js} +3 -1
  66. package/components/ToastContainer/{index.7f246bbd.js → index.2a7d304e.js} +3 -3
  67. package/components/animate/variants/index.7a912140.js +1 -0
  68. package/components/areas/components/AreasAdmin/index.325bac22.js +733 -0
  69. package/components/areas/components/AreasViewer/index.6e30ec72.js +1072 -0
  70. package/components/areas/components/index.558684b3.js +1 -0
  71. package/components/areas/constants.66529246.js +6 -0
  72. package/components/areas/contexts/AreasContext/{index.0815f278.js → index.3311cbf9.js} +6 -5
  73. package/components/areas/contexts/DynamicMFParmsContext/{index.37d1d444.js → index.3d9ad0ad.js} +2 -2
  74. package/components/areas/contexts/WindowToolsMFContext/{index.69d95c15.js → index.992ae7a3.js} +2 -2
  75. package/components/areas/contexts/index.24025b97.js +1 -0
  76. package/components/areas/dictionary.08cfc4c9.js +36 -0
  77. package/components/areas/hooks/index.d9dc1e21.js +1 -0
  78. package/components/areas/hooks/useAreas/{index.4039e30d.js → index.f81493ef.js} +1 -1
  79. package/components/areas/hooks/useDynamicMFParameters/{index.03ce6078.js → index.9e09e1e3.js} +1 -1
  80. package/components/areas/hooks/useWindowToolsMF/{index.09801b66.js → index.2fbae9dc.js} +1 -1
  81. package/components/areas/icons.8266ccc8.js +26 -0
  82. package/components/areas/index.4cc6a221.js +22 -0
  83. package/components/commercial/AppBarCommercial/index.cbd55cf8.js +28 -0
  84. package/components/commercial/SectionCommercial/index.d22ebbd5.js +57 -0
  85. package/components/commercial/TopBar/index.410fffa8.js +234 -0
  86. package/components/{HamburgerMenu/index.6c82741d.js → commercial/index.07638f52.js} +5 -3
  87. package/components/formatters/BooleanFormatter/index.cbf9cd6e.js +44 -0
  88. package/components/formatters/DateFormatter/index.2ef6f261.js +43 -0
  89. package/components/formatters/PointsFormatter/index.d8a4ee54.js +25 -0
  90. package/components/formatters/PriceFormatter/index.97f75b4b.js +35 -0
  91. package/components/formatters/UncertaintyFormatter/index.c3ffdebc.js +29 -0
  92. package/components/formatters/index.63a3e08e.js +117 -0
  93. package/components/hook-form/HelperError/{index.2ed03a3c.js → index.c0109d5b.js} +1 -1
  94. package/components/hook-form/RHFAutocomplete/index.2991d444.js +404 -0
  95. package/components/hook-form/RHFAutocompleteAsync/{index.69f5661d.js → index.d97c727b.js} +2 -3
  96. package/components/hook-form/RHFCheckbox/{index.13de27db.js → index.b57e3131.js} +4 -4
  97. package/components/hook-form/RHFColorPicker/{index.66004599.js → index.310f6ff0.js} +6 -6
  98. package/components/hook-form/RHFDateTime/{index.dfe07e18.js → index.5689a29f.js} +5 -5
  99. package/components/hook-form/RHFPeriod/{index.d852649b.js → index.019e61ae.js} +4 -4
  100. package/components/hook-form/RHFTextField/{index.d207efc1.js → index.10e57945.js} +6 -6
  101. package/components/hook-form/RHFUpload/{index.955a4ba5.js → index.7fd23b2a.js} +5 -5
  102. package/components/{mui_extended/Tab/index.37d588d6.js → maps/components/GpsTools/index.20f83559.js} +331 -645
  103. package/components/maps/{index.a1bf63f2.js → components/Map/index.c37f3304.js} +737 -28
  104. package/components/maps/index.13bb982c.js +7 -0
  105. package/components/modal/{WindowBase.390b0910.js → WindowBase.cfbb0c9e.js} +4 -4
  106. package/components/modal/{WindowConfirm.243e1bef.js → WindowConfirm.300bd34b.js} +10 -6
  107. package/components/modal/{index.5bce430d.js → index.81eb6def.js} +5 -1
  108. package/components/mui_extended/Accordion/{index.f7a17c83.js → index.0843a609.js} +5 -5
  109. package/components/mui_extended/Avatar/{index.12b96914.js → index.fb9ad158.js} +1 -1
  110. package/components/mui_extended/Badge/{index.4737c113.js → index.8beaeefc.js} +1 -1
  111. package/components/mui_extended/Button/{index.52852c42.js → index.d742e9ee.js} +6 -81
  112. package/components/mui_extended/{CheckBox/index.01218423.js → CheckBox.21c25705.js} +1 -1
  113. package/components/mui_extended/IconButton/{index.d5b273e6.js → index.b4532b85.js} +1 -1
  114. package/components/mui_extended/LinearProgress/index.4092bb69.js +9 -0
  115. package/components/mui_extended/MenuActions/index.eae97857.js +176 -0
  116. package/components/mui_extended/Pager/{index.8960227c.js → index.3926c835.js} +22 -40
  117. package/components/mui_extended/Popover/index.2348fc4f.js +143 -0
  118. package/components/mui_extended/Tab/index.e911930f.js +135 -0
  119. package/components/mui_extended/ToggleButton/{index.c441b949.js → index.b834f5f0.js} +1 -1
  120. package/components/mui_extended/ToggleIconButton/{index.8a84f25e.js → index.fcd5205c.js} +1 -1
  121. package/components/mui_extended/Typography/{index.463f613f.js → index.642798f1.js} +1 -1
  122. package/components/mui_extended/index.b606cd9d.js +1 -0
  123. package/components/popups/PopupsProvider/{index.d4caacc3.js → index.d7c9efce.js} +1 -1
  124. package/components/popups/PopupsViewer/{index.42312806.js → index.f3677ab1.js} +10 -6
  125. package/contexts/ModalContext/{index.5f77a463.js → index.ad1fb73b.js} +1 -1
  126. package/contexts/RHFormContext/{index.95ebabc9.js → index.bf3a2812.js} +6 -2
  127. package/hooks/useFormAddEdit/{index.ecb77e67.js → index.6d983cd8.js} +6 -2
  128. package/hooks/useModal/index.2003c854.js +11 -0
  129. package/hooks/useTab/index.8d1a6e63.js +12 -0
  130. package/index.js +328 -273
  131. package/package.json +1 -1
  132. package/{react-draggable.0cc9b257.js → react-draggable.1c1ba224.js} +1 -1
  133. package/{react-resizable.837c446d.js → react-resizable.a59c14f4.js} +2 -2
  134. package/test/constants_no_mock.86c553a9.js +4 -0
  135. package/test/{getNameDataTestId.aee44365.js → getNameDataTestId.0faeade8.js} +2 -2
  136. package/utils/{index.c64c2dd1.js → index.14912462.js} +1 -54
  137. package/components/CommonActions/index.19f39dca.js +0 -170
  138. package/components/areas/constants.0d3ba950.js +0 -289
  139. package/components/areas/dictionary.6168209a.js +0 -266
  140. package/components/areas/icons.504ec098.js +0 -83
  141. package/components/maps/components/GpsTools/index.01acaf3e.js +0 -251
  142. package/components/mui_extended/Popover/index.146ded9e.js +0 -1044
  143. package/hooks/useModal/index.d14c7e46.js +0 -67
  144. package/vendor.5b266106.js +0 -3952
@@ -0,0 +1,915 @@
1
+ import { g as getModalDialogComponentsDictionary } from "../ModalDialog/index.0dd5af28.js";
2
+ import { g as getPagerComponentsDictionary } from "../mui_extended/Pager/index.3926c835.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { styled } from "@mui/material/styles";
5
+ import { forwardRef, createContext, useState, useMemo, useEffect, useCallback, useContext, useRef, useLayoutEffect } from "react";
6
+ import { u as useRowSelection, S as SelectCellFormatter, H as HeaderRenderer, D as DataGrid$1 } from "../../react-data-grid.c5377916.js";
7
+ import { useDrag, useDrop, DndProvider } from "react-dnd";
8
+ import { HTML5Backend } from "react-dnd-html5-backend";
9
+ import { SvgIcon, Checkbox, InputBase, styled as styled$1, Skeleton, generateUtilityClasses, generateUtilityClass } from "@mui/material";
10
+ import { D as DATAGRID_SELECT_COLUMN_KEY, c as componentName, a as DATAGRID_PREFIX_NAME } from "./constants.e334cd50.js";
11
+ import { voidFunction, useModuleDictionary, useModuleSkeleton, getPropertyByString } from "@m4l/core";
12
+ import { A as ActionsColumn, a as Actions } from "./subcomponents/Actions/index.6b044e84.js";
13
+ import { unstable_composeClasses } from "@mui/base";
14
+ import { T as TEST_PROP_ID } from "../../test/constants_no_mock.86c553a9.js";
15
+ import { g as getNameDataTestId } from "../../test/getNameDataTestId.0faeade8.js";
16
+ const DataGridRoot = styled("div")(({ theme }) => ({
17
+ display: "flex",
18
+ flexDirection: "column",
19
+ position: "absolute",
20
+ padding: "0px",
21
+ inset: "0px",
22
+ overflow: "hidden",
23
+ ...theme.components?.M4LDataGrid?.styleOverrides
24
+ }));
25
+ function CheckboxIcon(props) {
26
+ return /* @__PURE__ */ jsx(SvgIcon, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M17 3a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4h10zm0 2H7a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2z" }) });
27
+ }
28
+ function CheckboxCheckedIcon(props) {
29
+ return /* @__PURE__ */ jsx(SvgIcon, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M17 3a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4h10zm-1.372 4.972a1.006 1.006 0 00-.928.388l-3.78 5-1.63-2.08a1.001 1.001 0 00-1.58 1.23l2.44 3.11a1 1 0 001.58-.01l4.57-6v-.03a1.006 1.006 0 00-.672-1.608z" }) });
30
+ }
31
+ function CheckboxIndeterminateIcon(props) {
32
+ return /* @__PURE__ */ jsx(SvgIcon, { ...props, children: /* @__PURE__ */ jsx("path", { d: "M17 3a4 4 0 014 4v10a4 4 0 01-4 4H7a4 4 0 01-4-4V7a4 4 0 014-4h10zm-1.75 8h-6.5a.75.75 0 00-.75.75v.5c0 .414.336.75.75.75h6.5a.75.75 0 00.75-.75v-.5a.75.75 0 00-.75-.75z" }) });
33
+ }
34
+ const CheckboxFormatter = forwardRef(
35
+ function CheckboxFormatter2({ onChange, checked, ...props }, _ref) {
36
+ function handleChange(e) {
37
+ onChange(e.target.checked, e.nativeEvent.shiftKey);
38
+ }
39
+ return /* @__PURE__ */ jsx(
40
+ Checkbox,
41
+ {
42
+ checked,
43
+ size: "small",
44
+ icon: /* @__PURE__ */ jsx(CheckboxIcon, {}),
45
+ checkedIcon: /* @__PURE__ */ jsx(CheckboxCheckedIcon, {}),
46
+ indeterminateIcon: /* @__PURE__ */ jsx(CheckboxIndeterminateIcon, {}),
47
+ onChange: handleChange,
48
+ ...props
49
+ }
50
+ );
51
+ }
52
+ );
53
+ const DataGridContext = createContext(null);
54
+ const getColumnConfigByKey = (key, storeColumnsConfig) => {
55
+ let indexFind = -1;
56
+ return [
57
+ storeColumnsConfig.find((column, index) => {
58
+ if (column.key === key) {
59
+ indexFind = index;
60
+ }
61
+ return column.key === key;
62
+ }),
63
+ indexFind
64
+ ];
65
+ };
66
+ function getColumnsConfig(id, columns, remoteConfig = void 0) {
67
+ let columnsConfig;
68
+ if (remoteConfig) {
69
+ columnsConfig = remoteConfig.columnsConfig;
70
+ } else {
71
+ try {
72
+ const item = window.localStorage.getItem(`${id}_columns_config`);
73
+ columnsConfig = item !== null ? JSON.parse(item) : [];
74
+ } catch (e) {
75
+ columnsConfig = [];
76
+ }
77
+ }
78
+ return columns.map((column, index) => {
79
+ const [columnConfig = { ...column }, columnConfigIndex] = getColumnConfigByKey(
80
+ column.key,
81
+ columnsConfig
82
+ );
83
+ return {
84
+ key: column.key,
85
+ name: column.name,
86
+ hidden: column.hidden === void 0 ? false : column.hidden,
87
+ index: columnConfigIndex > -1 ? columnConfigIndex : index,
88
+ visible: columnConfig.visible === void 0 ? true : columnConfig.visible,
89
+ frozen: columnConfig.frozen === void 0 ? false : columnConfig.frozen,
90
+ orginalIndex: index,
91
+ originalVisible: column.visible === void 0 ? true : column.visible,
92
+ originalFrozen: column.frozen === void 0 ? false : column.frozen
93
+ };
94
+ }).sort((a, b) => a.index - b.index);
95
+ }
96
+ function getColumnsWidth(id, columns, remoteConfig) {
97
+ const newMap = /* @__PURE__ */ new Map();
98
+ let storeColumnsWidth;
99
+ try {
100
+ const item = window.localStorage.getItem(`${id}_columns_width`);
101
+ storeColumnsWidth = item !== null ? new Map(JSON.parse(item)) : /* @__PURE__ */ new Map();
102
+ } catch (e) {
103
+ storeColumnsWidth = /* @__PURE__ */ new Map();
104
+ }
105
+ for (let i = 0; i < columns.length; i++) {
106
+ let width;
107
+ if (remoteConfig) {
108
+ try {
109
+ width = remoteConfig.columnsWidths.get(columns[i].key);
110
+ } catch (error) {
111
+ }
112
+ }
113
+ if (width === void 0) {
114
+ const storeWidth = storeColumnsWidth.get(columns[i].key);
115
+ if (typeof storeWidth === "number") {
116
+ width = storeWidth;
117
+ }
118
+ }
119
+ if (width !== void 0) {
120
+ newMap.set(columns[i].key, width);
121
+ }
122
+ }
123
+ return newMap;
124
+ }
125
+ function saveColumnsWidth(id, storeColumnsWidth) {
126
+ localStorage.setItem(`${id}_columns_width`, JSON.stringify([...storeColumnsWidth]));
127
+ }
128
+ function saveColumnsConfig(id, columnsConfig) {
129
+ localStorage.setItem(`${id}_columns_config`, JSON.stringify(columnsConfig));
130
+ }
131
+ function getIndexRowHeightVariant(variant) {
132
+ if (variant === "compact") {
133
+ return 0;
134
+ }
135
+ if (variant === "standard") {
136
+ return 1;
137
+ }
138
+ return 2;
139
+ }
140
+ function DataGridProvider(props) {
141
+ const {
142
+ id,
143
+ children,
144
+ columns,
145
+ remoteConfig,
146
+ rows,
147
+ rowsCount,
148
+ rowActionsGetter,
149
+ rowHeights = [28, 32, 36],
150
+ rowHeaderHeights = [28, 32, 36],
151
+ initialRowHeightVariant = "compact",
152
+ checkedRows,
153
+ onCheckedRowsChange,
154
+ rowKeyGetter,
155
+ classes
156
+ } = props;
157
+ const [columnsWidths, setColumnsWidths] = useState(
158
+ /* @__PURE__ */ new Map()
159
+ );
160
+ const [columnsConfig, setColumnsConfigOptions] = useState(
161
+ () => []
162
+ );
163
+ const [rowsFilterCount, setRowFilterCount] = useState(rowsCount);
164
+ const [currentRowHeightVariant, setCurrentRowHeightVariant] = useState(() => {
165
+ if (typeof rowHeights !== typeof rowHeaderHeights) {
166
+ throw new Error("Must be same type rowheights and rowHeaderTypes");
167
+ }
168
+ if (typeof rowHeights === "number" && typeof rowHeaderHeights === "number") {
169
+ return {
170
+ rowHVariant: "compact",
171
+ rowHeight: rowHeights,
172
+ rowHeaderHeight: rowHeaderHeights
173
+ };
174
+ }
175
+ if (typeof rowHeights !== "number" && rowHeights.length !== 3) {
176
+ throw new Error("Must be 3 heights");
177
+ }
178
+ if (typeof rowHeaderHeights !== "number" && rowHeaderHeights.length !== 3) {
179
+ throw new Error("Must be 3 HeaderHeights");
180
+ }
181
+ return {
182
+ rowHVariant: initialRowHeightVariant,
183
+ rowHeight: typeof rowHeights !== "number" ? rowHeights[getIndexRowHeightVariant(initialRowHeightVariant)] : rowHeights,
184
+ rowHeaderHeight: typeof rowHeaderHeights !== "number" ? rowHeaderHeights[getIndexRowHeightVariant(initialRowHeightVariant)] : rowHeaderHeights
185
+ };
186
+ });
187
+ const finalRowHeights = useMemo(() => rowHeights, [rowHeights]);
188
+ let timerSaveColumns;
189
+ useEffect(() => {
190
+ }, [columnsConfig]);
191
+ useEffect(() => {
192
+ setColumnsWidths(getColumnsWidth(id, columns, remoteConfig));
193
+ setColumnsConfigOptions(getColumnsConfig(id, columns, remoteConfig));
194
+ }, [columns, id, remoteConfig]);
195
+ const onChangeColumnsConfig = useCallback(
196
+ (newColumnsConfig) => {
197
+ saveColumnsConfig(id, newColumnsConfig);
198
+ setColumnsConfigOptions(newColumnsConfig);
199
+ },
200
+ [setColumnsConfigOptions, id]
201
+ );
202
+ const onChangeColumnsOrder = useCallback(
203
+ (sourceKey, targetKey) => {
204
+ if (sourceKey === targetKey)
205
+ return;
206
+ const sourceColumnIndex = columnsConfig.findIndex((c) => c.key === sourceKey);
207
+ const targetColumnIndex = columnsConfig.findIndex((c) => c.key === targetKey);
208
+ const reorderedColumnsConfig = [...columnsConfig];
209
+ reorderedColumnsConfig.splice(
210
+ targetColumnIndex,
211
+ 0,
212
+ reorderedColumnsConfig.splice(sourceColumnIndex, 1)[0]
213
+ );
214
+ onChangeColumnsConfig(reorderedColumnsConfig);
215
+ },
216
+ [columnsConfig, onChangeColumnsConfig]
217
+ );
218
+ const onChangeColumnWidth = (columnKey, width) => {
219
+ columnsWidths.set(columnKey, Math.round(width));
220
+ if (timerSaveColumns) {
221
+ clearTimeout(timerSaveColumns);
222
+ }
223
+ timerSaveColumns = setTimeout(() => {
224
+ saveColumnsWidth(id, columnsWidths);
225
+ }, 500);
226
+ };
227
+ useEffect(() => {
228
+ setColumnsConfigOptions(getColumnsConfig(id, columns));
229
+ }, [columns]);
230
+ const setRowFilterCountInternal = (newRowsCount) => {
231
+ setRowFilterCount(newRowsCount);
232
+ };
233
+ const setCurrentRowHeightInternal = useCallback(
234
+ (newVariant) => {
235
+ if (typeof rowHeights === "number" || typeof rowHeaderHeights === "number") {
236
+ throw new Error("Only use setCurrentRowHeight with vector rowHeights");
237
+ }
238
+ setCurrentRowHeightVariant({
239
+ rowHVariant: newVariant,
240
+ rowHeight: rowHeights[getIndexRowHeightVariant(newVariant)],
241
+ rowHeaderHeight: rowHeaderHeights[getIndexRowHeightVariant(newVariant)]
242
+ });
243
+ },
244
+ [setCurrentRowHeightVariant, rowHeights, rowHeaderHeights]
245
+ );
246
+ return /* @__PURE__ */ jsx(
247
+ DataGridContext.Provider,
248
+ {
249
+ value: {
250
+ columnsConfig,
251
+ columnsWidths,
252
+ rowsCount: rowsFilterCount,
253
+ currentRowHeightVariant: currentRowHeightVariant.rowHVariant,
254
+ currentRowHeight: currentRowHeightVariant.rowHeight,
255
+ currentRowHeaderHeight: currentRowHeightVariant.rowHeaderHeight,
256
+ rows,
257
+ rowHeights: finalRowHeights,
258
+ checkedRows,
259
+ onChangeColumnsConfig,
260
+ onChangeColumnsOrder,
261
+ onChangeColumnWidth,
262
+ setRowsCount: setRowFilterCountInternal,
263
+ rowActionsGetter,
264
+ classes,
265
+ setRowHeightVariant: setCurrentRowHeightInternal,
266
+ onCheckedRowsChange,
267
+ rowKeyGetter
268
+ },
269
+ children
270
+ }
271
+ );
272
+ }
273
+ function useDataGrid() {
274
+ const context = useContext(DataGridContext);
275
+ if (!context)
276
+ throw new Error("useDataGrid context must be use inside DataGridContext");
277
+ return context;
278
+ }
279
+ const filterColumnClassName = "filter-cell";
280
+ const filterHeight = 35;
281
+ function SelectGroupFormatter(props) {
282
+ const [isRowSelected, onRowSelectionChange] = useRowSelection();
283
+ const onChange = (checked) => {
284
+ onRowSelectionChange({ row: props.row, checked, isShiftClick: false });
285
+ };
286
+ const cellFormater = SelectCellFormatter({
287
+ value: isRowSelected,
288
+ isCellSelected: props.isCellSelected,
289
+ onChange,
290
+ "aria-label": "Select Group"
291
+ });
292
+ return cellFormater;
293
+ }
294
+ function SelectFormatter(props) {
295
+ const { checkedRows, onCheckedRowsChange, rowKeyGetter } = useDataGrid();
296
+ const onChange = (checked, _isShiftClick) => {
297
+ const newCheckedRows = new Set(checkedRows);
298
+ if (checked) {
299
+ newCheckedRows.add(rowKeyGetter(props.row));
300
+ } else {
301
+ newCheckedRows.delete(rowKeyGetter(props.row));
302
+ }
303
+ onCheckedRowsChange && onCheckedRowsChange(newCheckedRows);
304
+ };
305
+ return /* @__PURE__ */ jsx(
306
+ SelectCellFormatter,
307
+ {
308
+ value: checkedRows?.has(rowKeyGetter(props.row)) || false,
309
+ isCellSelected: props.isCellSelected,
310
+ onChange,
311
+ "aria-label": "Select"
312
+ }
313
+ );
314
+ }
315
+ const SelectColumnHeaderRenderer = (props) => {
316
+ const { rows, rowKeyGetter, onCheckedRowsChange, checkedRows } = useDataGrid();
317
+ const onAllRowsCheckedChange = (checked) => {
318
+ if (!onCheckedRowsChange)
319
+ return;
320
+ if (checked) {
321
+ onCheckedRowsChange(new Set(rows.map((r) => rowKeyGetter(r))));
322
+ } else {
323
+ onCheckedRowsChange(/* @__PURE__ */ new Set());
324
+ }
325
+ };
326
+ const allRowsChecked = rows.length === checkedRows?.size;
327
+ return SelectCellFormatter({
328
+ "aria-label": "Select All",
329
+ isCellSelected: props.isCellSelected,
330
+ value: allRowsChecked,
331
+ onChange: onAllRowsCheckedChange
332
+ });
333
+ };
334
+ const SelectColumn = {
335
+ key: DATAGRID_SELECT_COLUMN_KEY,
336
+ name: "",
337
+ width: 32,
338
+ minWidth: 32,
339
+ isDraggable: false,
340
+ resizable: false,
341
+ sortable: false,
342
+ frozen: true,
343
+ type: "boolean",
344
+ headerRenderer: SelectColumnHeaderRenderer,
345
+ formatter: SelectFormatter,
346
+ groupFormatter: SelectGroupFormatter
347
+ };
348
+ function useFocusRef(isSelected) {
349
+ const ref = useRef(null);
350
+ useLayoutEffect(() => {
351
+ if (!isSelected)
352
+ return;
353
+ ref.current?.focus({ preventScroll: true });
354
+ }, [isSelected]);
355
+ return {
356
+ ref,
357
+ tabIndex: isSelected ? 0 : -1
358
+ };
359
+ }
360
+ const initialState = {
361
+ activeFilters: false,
362
+ setActiveFilters: voidFunction
363
+ };
364
+ const FilterContext = createContext(initialState);
365
+ function FilterProvider({ children, initialActiveFilters }) {
366
+ const [filterOptions, setFilterOptions] = useState({
367
+ activeFilters: initialActiveFilters
368
+ });
369
+ const onChangeFilter = (column, value) => {
370
+ const newMap = filterOptions.filters ? new Map(filterOptions.filters) : /* @__PURE__ */ new Map();
371
+ if (value !== "") {
372
+ newMap.set(column.key, { value, customFilter: column.customFilter });
373
+ } else {
374
+ newMap.delete(column.key);
375
+ }
376
+ setFilterOptions({
377
+ ...filterOptions,
378
+ filters: newMap
379
+ });
380
+ };
381
+ const setActiveFilters = (active) => {
382
+ if (active) {
383
+ setFilterOptions({ activeFilters: true, filters: /* @__PURE__ */ new Map() });
384
+ } else {
385
+ setFilterOptions({ activeFilters: false });
386
+ }
387
+ };
388
+ return /* @__PURE__ */ jsx(
389
+ FilterContext.Provider,
390
+ {
391
+ value: {
392
+ ...filterOptions,
393
+ onChangeFilter,
394
+ setActiveFilters
395
+ },
396
+ children
397
+ }
398
+ );
399
+ }
400
+ const useFilters = () => useContext(FilterContext);
401
+ function DraggableHeaderRenderer(props) {
402
+ const { onColumnsReorder, column, isCellSelected, ...others } = props;
403
+ const { ref, tabIndex } = useFocusRef(isCellSelected);
404
+ const { getLabel } = useModuleDictionary();
405
+ const { activeFilters, filters, onChangeFilter } = useFilters();
406
+ const [filter, setFilter] = useState(filters?.get(column.key) || "");
407
+ const [{ isDragging }, drag] = useDrag({
408
+ type: "COLUMN_DRAG",
409
+ item: { key: column.key },
410
+ collect: (monitor) => ({
411
+ isDragging: monitor.isDragging()
412
+ })
413
+ });
414
+ const [{ isOver }, drop] = useDrop({
415
+ accept: "COLUMN_DRAG",
416
+ drop({ key }) {
417
+ onColumnsReorder(key, column.key);
418
+ },
419
+ collect: (monitor) => ({
420
+ isOver: monitor.isOver(),
421
+ canDrop: monitor.canDrop()
422
+ })
423
+ });
424
+ const handleChange = (e) => {
425
+ if (activeFilters) {
426
+ if (onChangeFilter)
427
+ onChangeFilter(column, e.target.value);
428
+ }
429
+ setFilter(e.target.value);
430
+ };
431
+ useEffect(() => {
432
+ if (!activeFilters)
433
+ setFilter("");
434
+ }, [activeFilters]);
435
+ const newColumn = { ...column };
436
+ if (newColumn.withinHeaderRenderer) {
437
+ newColumn.name = newColumn.withinHeaderRenderer(props);
438
+ }
439
+ return /* @__PURE__ */ jsxs(
440
+ "div",
441
+ {
442
+ ref: (newRef) => {
443
+ drag(newRef);
444
+ drop(newRef);
445
+ },
446
+ style: {
447
+ opacity: isDragging ? 0.5 : 1,
448
+ backgroundColor: isOver ? "#ececec" : void 0,
449
+ cursor: "move",
450
+ display: "flex",
451
+ flexDirection: "column",
452
+ lineHeight: "1",
453
+ height: "100%",
454
+ justifyContent: "center",
455
+ textAlign: "center"
456
+ },
457
+ children: [
458
+ /* @__PURE__ */ jsx(HeaderRenderer, { column: newColumn, isCellSelected, ...others }),
459
+ activeFilters && (column?.withFilter === void 0 || column.withFilter === true) && /* @__PURE__ */ jsx(
460
+ "div",
461
+ {
462
+ className: "filter_cell_div",
463
+ style: {
464
+ borderTop: "1px solid var(--rdg-border-color)",
465
+ width: "100%",
466
+ display: "flex",
467
+ alignItems: "center",
468
+ height: `${filterHeight}px`
469
+ },
470
+ children: /* @__PURE__ */ jsx(
471
+ InputBase,
472
+ {
473
+ inputRef: ref,
474
+ placeholder: getLabel("data_grid.filter_holder"),
475
+ style: {
476
+ width: "100%",
477
+ paddingBottom: "2px",
478
+ border: "1px solid var(--rdg-border-color)"
479
+ },
480
+ tabIndex,
481
+ type: "text",
482
+ onChange: handleChange,
483
+ value: filter
484
+ }
485
+ )
486
+ }
487
+ )
488
+ ]
489
+ }
490
+ );
491
+ }
492
+ const getDragHeaderRenderer = (handleColumnsReorder) => {
493
+ function HeaderRenderer2(props) {
494
+ return /* @__PURE__ */ jsx(DraggableHeaderRenderer, { ...props, onColumnsReorder: handleColumnsReorder });
495
+ }
496
+ return HeaderRenderer2;
497
+ };
498
+ const WrapperSkeleton = styled$1("div")(() => ({
499
+ display: "flex",
500
+ width: "100%",
501
+ height: "100%",
502
+ alignItems: "center"
503
+ }));
504
+ function SkeletonFormatter() {
505
+ const { classes } = useDataGrid();
506
+ return /* @__PURE__ */ jsx(WrapperSkeleton, { className: classes.skeletonFormatter, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "100%", height: "12px" }) });
507
+ }
508
+ function getComparator(columns, sortColumn) {
509
+ const column = columns.find((d) => d.key === sortColumn);
510
+ let typeOrder = "string";
511
+ if (column) {
512
+ typeOrder = column.type || "string";
513
+ }
514
+ switch (typeOrder) {
515
+ case "number":
516
+ return (a, b) => {
517
+ try {
518
+ return Number(a[sortColumn]) - Number(b[sortColumn]);
519
+ } catch (error) {
520
+ return -1;
521
+ }
522
+ };
523
+ default:
524
+ return (a, b) => {
525
+ try {
526
+ return a[sortColumn].toString().localeCompare(b[sortColumn].toString());
527
+ } catch (error) {
528
+ return -1;
529
+ }
530
+ };
531
+ }
532
+ }
533
+ const getColumIndex = (key, columnsConfig) => columnsConfig.findIndex((columnConfig) => columnConfig.key === key);
534
+ const getInOrderColumns = (columns, hasCheckedRows, columnsConfig, columnsWidths, rowActionsGetter) => {
535
+ let filteredSortedColumns = columns.filter((column) => {
536
+ const columnConfigIndex = getColumIndex(column.key, columnsConfig);
537
+ const visible = columnConfigIndex > -1 ? columnsConfig[columnConfigIndex].visible : true;
538
+ return !column.hidden && visible;
539
+ }).sort(
540
+ (a, b) => getColumIndex(a.key, columnsConfig) - getColumIndex(b.key, columnsConfig)
541
+ ).map((columnSorted) => {
542
+ const columnConfigIndex = getColumIndex(columnSorted.key, columnsConfig);
543
+ return {
544
+ ...columnSorted,
545
+ frozen: columnConfigIndex > -1 ? columnsConfig[columnConfigIndex].frozen : true,
546
+ width: typeof columnsWidths.get(columnSorted.key) === "number" ? columnsWidths.get(columnSorted.key) : columnSorted.width
547
+ };
548
+ }).sort((a, b) => {
549
+ const order = (a.frozen === void 0 || a.frozen === false) === (b.frozen === void 0 || b.frozen === false) ? 0 : a.frozen ? -1 : 1;
550
+ return order;
551
+ });
552
+ if (rowActionsGetter) {
553
+ filteredSortedColumns = [ActionsColumn, ...filteredSortedColumns];
554
+ }
555
+ if (hasCheckedRows) {
556
+ filteredSortedColumns = [SelectColumn, ...filteredSortedColumns];
557
+ }
558
+ return filteredSortedColumns;
559
+ };
560
+ const getAligByType = (columnType) => {
561
+ switch (columnType) {
562
+ case "string":
563
+ return "left";
564
+ case "date":
565
+ case "boolean":
566
+ case "custom":
567
+ return "center";
568
+ case "number":
569
+ return "right";
570
+ }
571
+ return "left";
572
+ };
573
+ const useSortColumnsRows = (sourceColumns, sourceRows) => {
574
+ const {
575
+ columnsConfig,
576
+ columnsWidths,
577
+ onChangeColumnsOrder,
578
+ rowActionsGetter,
579
+ checkedRows,
580
+ onCheckedRowsChange
581
+ } = useDataGrid();
582
+ const [columns, setColumns] = useState(() => []);
583
+ const [sortColumns, setSortColumns] = useState([]);
584
+ const isSkeleton = useModuleSkeleton();
585
+ const { activeFilters, filters } = useFilters();
586
+ const findKeyInColumns = (key, cols) => {
587
+ const index = cols.findIndex((column) => key === column.key && column.hidden === false);
588
+ return index !== -1;
589
+ };
590
+ useEffect(() => {
591
+ setColumns(
592
+ getInOrderColumns(
593
+ sourceColumns,
594
+ !!checkedRows && !!onCheckedRowsChange,
595
+ columnsConfig,
596
+ columnsWidths,
597
+ rowActionsGetter
598
+ )
599
+ );
600
+ const finalSortedColumns = sortColumns.filter(
601
+ (sortColumn) => findKeyInColumns(sortColumn.columnKey, sourceColumns)
602
+ );
603
+ if (JSON.stringify(finalSortedColumns) !== JSON.stringify(sortColumns)) {
604
+ setSortColumns(finalSortedColumns);
605
+ }
606
+ }, [sourceColumns, columnsConfig, rowActionsGetter]);
607
+ const finalColumns = useMemo(() => {
608
+ const DragAndDropHeaderRenderer = getDragHeaderRenderer(onChangeColumnsOrder);
609
+ return columns.map((c) => {
610
+ const newColumn = {
611
+ ...c,
612
+ cellClass: c.align !== void 0 ? `rdg-cell-align-${c.align}` : `rdg-cell-align-${getAligByType(c.type)}`
613
+ };
614
+ if (newColumn.key === DATAGRID_SELECT_COLUMN_KEY || newColumn.isDraggable !== void 0 && newColumn.isDraggable === false) {
615
+ return newColumn;
616
+ }
617
+ if (isSkeleton) {
618
+ newColumn.headerRenderer = SkeletonFormatter;
619
+ newColumn.formatter = SkeletonFormatter;
620
+ }
621
+ if (newColumn.headerRenderer) {
622
+ newColumn.withinHeaderRenderer = newColumn.headerRenderer;
623
+ }
624
+ if ((newColumn?.withFilter === void 0 || newColumn.withFilter === true) && activeFilters) {
625
+ newColumn.headerCellClass = filterColumnClassName;
626
+ }
627
+ newColumn.headerRenderer = DragAndDropHeaderRenderer;
628
+ return newColumn;
629
+ });
630
+ }, [isSkeleton, columns, activeFilters, onChangeColumnsOrder]);
631
+ const finalRows = useMemo(() => {
632
+ const nextRows = sourceRows.filter((r) => {
633
+ if (!filters || filters.size === 0)
634
+ return true;
635
+ const iterator = filters.entries();
636
+ let valReturn = true;
637
+ for (let i = 0; i < filters.size; i++) {
638
+ const entry = iterator.next().value;
639
+ const columnKey = entry[0];
640
+ const columnFilter = entry[1];
641
+ let valCell;
642
+ const valueMaybeString = getPropertyByString(r, columnKey);
643
+ let fixedValue;
644
+ if (typeof valueMaybeString === "string") {
645
+ fixedValue = valueMaybeString;
646
+ } else {
647
+ fixedValue = "";
648
+ }
649
+ try {
650
+ if (columnFilter.customFilter) {
651
+ valReturn = valReturn && columnFilter.customFilter(r, columnFilter.value);
652
+ } else {
653
+ valCell = fixedValue;
654
+ valReturn = valReturn && valCell.includes(columnFilter.value);
655
+ }
656
+ } catch (error) {
657
+ continue;
658
+ }
659
+ if (!valReturn)
660
+ break;
661
+ }
662
+ return valReturn;
663
+ });
664
+ if (sortColumns.length === 0) {
665
+ return nextRows;
666
+ }
667
+ nextRows.sort((a, b) => {
668
+ for (const sort of sortColumns) {
669
+ const comparator = getComparator(columns, sort.columnKey);
670
+ const compResult = comparator(a, b);
671
+ if (compResult !== 0) {
672
+ return sort.direction === "ASC" ? compResult : -compResult;
673
+ }
674
+ }
675
+ return 0;
676
+ });
677
+ return nextRows;
678
+ }, [sourceRows, sortColumns, filters]);
679
+ return { finalColumns, sortColumns, setSortColumns, finalRows };
680
+ };
681
+ function Table(props) {
682
+ const { columns, rows, onRowsChange, rowKeyGetter, selectedRows, onSelectedRowsChange } = props;
683
+ const { finalColumns, sortColumns, setSortColumns, finalRows } = useSortColumnsRows(
684
+ columns,
685
+ rows
686
+ );
687
+ const { activeFilters } = useFilters();
688
+ const { onChangeColumnWidth, setRowsCount, currentRowHeight, currentRowHeaderHeight, classes } = useDataGrid();
689
+ const ref_data_grid = useRef(null);
690
+ const onRowClick = (row) => {
691
+ if (selectedRows && onSelectedRowsChange) {
692
+ if (selectedRows.entries().next().value) {
693
+ if (selectedRows.entries().next().value[1] === rowKeyGetter(row)) {
694
+ return;
695
+ }
696
+ }
697
+ const mySet = /* @__PURE__ */ new Set([rowKeyGetter(row)]);
698
+ onSelectedRowsChange(mySet);
699
+ }
700
+ };
701
+ useEffect(() => {
702
+ let columnIndice = 0;
703
+ for (const column of finalColumns) {
704
+ const index = sortColumns.findIndex((sortColumn) => column.key === sortColumn.columnKey);
705
+ if (index !== -1) {
706
+ ref_data_grid.current?.element?.querySelector(`[role="columnheader"][aria-colindex="${columnIndice + 1}"]`)?.setAttribute("aria-columnsort", `${sortColumns[index].direction}`);
707
+ } else {
708
+ ref_data_grid.current?.element?.querySelector(`[role="columnheader"][aria-colindex="${columnIndice + 1}"]`)?.removeAttribute("aria-columnsort");
709
+ }
710
+ columnIndice++;
711
+ }
712
+ }, [sortColumns, finalColumns]);
713
+ useEffect(() => {
714
+ setRowsCount(finalRows.length);
715
+ }, [finalRows]);
716
+ const onColumnResize = (idx, width) => {
717
+ onChangeColumnWidth(finalColumns[idx].key, width);
718
+ };
719
+ const onChangeSort = (newSortColumns) => {
720
+ setSortColumns(newSortColumns);
721
+ };
722
+ return /* @__PURE__ */ jsx("div", { className: classes.tableContaniner, id: "WrapperTable", children: /* @__PURE__ */ jsx("div", { className: classes.wrapperDataGridCss, children: /* @__PURE__ */ jsx(DndProvider, { backend: HTML5Backend, context: window, children: /* @__PURE__ */ jsx(
723
+ DataGrid$1,
724
+ {
725
+ className: "fill-grid rdg-light",
726
+ ref: ref_data_grid,
727
+ headerRowHeight: activeFilters ? currentRowHeaderHeight + filterHeight : currentRowHeaderHeight,
728
+ columns: finalColumns,
729
+ sortColumns,
730
+ onSortColumnsChange: onChangeSort,
731
+ onColumnResize,
732
+ rows: finalRows,
733
+ onRowsChange,
734
+ selectedRows,
735
+ onSelectedRowsChange,
736
+ onRowClick,
737
+ rowHeight: currentRowHeight,
738
+ rowKeyGetter,
739
+ cellNavigationMode: "LOOP_OVER_ROW",
740
+ components: { checkboxFormatter: CheckboxFormatter },
741
+ defaultColumnOptions: { resizable: true, sortable: true }
742
+ }
743
+ ) }) }) });
744
+ }
745
+ const dataGridClasses = generateUtilityClasses(componentName, [
746
+ "root",
747
+ "actions",
748
+ "withPager",
749
+ "withNoPager",
750
+ "rowsCount",
751
+ "rowsCountLabel",
752
+ "rowsCountValue",
753
+ "densitySkeleton",
754
+ "actionDensityPopover",
755
+ "actionFilter",
756
+ "actionSettings",
757
+ "tableContaniner",
758
+ "wrapperDataGridCss",
759
+ "columnsConfigContainer",
760
+ "columnsLabelSetColumns",
761
+ "columnsConfigContent",
762
+ "columnsConfigGrid",
763
+ "columnsConfigActions",
764
+ "formatterColumn",
765
+ "skeletonFormatter",
766
+ "actionsFormatter",
767
+ "actionsConfigContainer",
768
+ "booleanFormatter",
769
+ "withActions"
770
+ ]);
771
+ function getDataGridUtilityClass(slot) {
772
+ return generateUtilityClass(componentName, slot);
773
+ }
774
+ const dataGridUtilityClasses = (ownerState) => {
775
+ const slots = {
776
+ root: ["root"],
777
+ actions: ["actions", ownerState.actionsProps.withPager ? "withPager" : "withNoPager"],
778
+ rowsCount: ["rowsCount"],
779
+ rowsCountLabel: ["rowsCountLabel"],
780
+ rowsCountValue: ["rowsCountValue"],
781
+ densitySkeleton: ["densitySkeleton"],
782
+ densityRoot: ["densityRoot"],
783
+ densityPopover: ["densityPopover"],
784
+ actionFilter: ["actionFilter"],
785
+ actionSettings: ["actionSettingsRoot"],
786
+ actionDensityPopover: ["actionDensityPopover"],
787
+ tableContaniner: ["tableContaniner", ownerState.withActions && "withActions"],
788
+ wrapperDataGridCss: ["wrapperDataGridCss"],
789
+ columnsConfigContainer: ["columnsConfigContainer"],
790
+ columnsLabelSetColumns: ["columnsLabelSetColumns"],
791
+ columnsConfigContent: ["columnsConfigContent"],
792
+ columnsConfigGrid: ["columnsConfigGrid"],
793
+ columnsConfigActions: ["columnsConfigActions"],
794
+ formatterColumn: ["formatterColumn"],
795
+ skeletonFormatter: ["skeletonFormatter"],
796
+ actionsFormatter: ["actionsFormatter"],
797
+ actionsConfigContainer: ["actionsConfigContainer"],
798
+ booleanFormatter: ["booleanFormatter"]
799
+ };
800
+ const composedClasses = unstable_composeClasses(slots, getDataGridUtilityClass, {});
801
+ return {
802
+ ...composedClasses
803
+ };
804
+ };
805
+ function getDataGridComponentsDictionary() {
806
+ return ["data_grid"].concat(getPagerComponentsDictionary()).concat(getModalDialogComponentsDictionary());
807
+ }
808
+ const dictionary = {
809
+ LABEL_ACTIONS: "actions",
810
+ LABEL_ROWS_PER_PAGE: "pager.rows_per_page",
811
+ LABEL_OF: "pager.of"
812
+ };
813
+ const DATAGRID_TEST_ID = "m4ldatagrid";
814
+ const PREFIX_TEST_ATTRIBUTE = "data-testid";
815
+ const TEST_PROP_COLUMNS = `${PREFIX_TEST_ATTRIBUTE}-${DATAGRID_TEST_ID}-columns`;
816
+ function DataGrid(props) {
817
+ const {
818
+ id,
819
+ withActions = true,
820
+ rows,
821
+ columns,
822
+ actionsProps,
823
+ selectedRows,
824
+ onSelectedRowsChange,
825
+ rowKeyGetter,
826
+ rowActionsGetter,
827
+ onRowsChange,
828
+ rowHeaderHeights,
829
+ rowHeights,
830
+ initialRowHeightVariant,
831
+ checkedRows,
832
+ onCheckedRowsChange,
833
+ dataTestId = ""
834
+ } = props;
835
+ const ownerState = {
836
+ actionsProps,
837
+ withActions
838
+ };
839
+ const classes = dataGridUtilityClasses(ownerState);
840
+ return /* @__PURE__ */ jsx(
841
+ DataGridRoot,
842
+ {
843
+ className: classes.root,
844
+ ...process.env.NODE_ENV !== "production" ? {
845
+ [TEST_PROP_COLUMNS]: JSON.stringify(columns),
846
+ [TEST_PROP_ID]: getNameDataTestId(DATAGRID_PREFIX_NAME, "root", dataTestId)
847
+ } : {},
848
+ children: /* @__PURE__ */ jsx(
849
+ DataGridProvider,
850
+ {
851
+ id: props.id,
852
+ columns: props.columns,
853
+ rowHeights,
854
+ rowHeaderHeights,
855
+ initialRowHeightVariant,
856
+ rowsCount: rows.length,
857
+ checkedRows,
858
+ rowActionsGetter,
859
+ onCheckedRowsChange,
860
+ rowKeyGetter,
861
+ rows,
862
+ classes,
863
+ children: /* @__PURE__ */ jsxs(FilterProvider, { initialActiveFilters: false, children: [
864
+ withActions && actionsProps && /* @__PURE__ */ jsx(
865
+ Actions,
866
+ {
867
+ ...actionsProps
868
+ }
869
+ ),
870
+ /* @__PURE__ */ jsx(
871
+ Table,
872
+ {
873
+ id,
874
+ withActions,
875
+ columns,
876
+ rows,
877
+ selectedRows,
878
+ onSelectedRowsChange,
879
+ rowKeyGetter,
880
+ onRowsChange
881
+ }
882
+ )
883
+ ] })
884
+ }
885
+ )
886
+ }
887
+ );
888
+ }
889
+ const getDataGridRowsFromSet = (set, rows, rowKeyGetter) => {
890
+ const rowsFinded = [];
891
+ if (set) {
892
+ if (set.size > 0) {
893
+ const iterator = set.entries();
894
+ for (let i = 0; i < set.size; i++) {
895
+ const entry = iterator.next().value;
896
+ const key = entry[1];
897
+ const row = rows.find((frow) => rowKeyGetter(frow) === key);
898
+ if (row) {
899
+ rowsFinded.push(row);
900
+ }
901
+ }
902
+ }
903
+ }
904
+ return rowsFinded;
905
+ };
906
+ export {
907
+ DataGridRoot as D,
908
+ useFilters as a,
909
+ dictionary as b,
910
+ DataGrid as c,
911
+ dataGridClasses as d,
912
+ getDataGridRowsFromSet as e,
913
+ getDataGridComponentsDictionary as g,
914
+ useDataGrid as u
915
+ };