@m4l/components 0.1.13 → 0.1.15

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 (139) hide show
  1. package/assets/Logo/index.js +91 -0
  2. package/commonjs.js +9 -0
  3. package/components/CommonActions/components/ActionCancel/index.js +15 -0
  4. package/components/CommonActions/components/ActionFormCancel/index.js +62 -0
  5. package/components/CommonActions/components/ActionFormIntro/index.js +35 -0
  6. package/components/CommonActions/components/ActionIntro/index.js +16 -0
  7. package/components/CommonActions/components/Actions/index.js +859 -0
  8. package/components/CompanyLogo/{index.f81c179c.js → index.js} +48 -42
  9. package/components/DataGrid/index.js +1067 -0
  10. package/components/DynamicFilter/index.js +1573 -0
  11. package/components/ErrorLabel/index.js +18 -0
  12. package/components/Icon/index.js +80 -0
  13. package/components/Image/index.js +128 -0
  14. package/components/LanguagePopover/index.js +93 -0
  15. package/components/Loadable/index.js +13 -0
  16. package/components/ModalDialog/index.js +180 -0
  17. package/components/NoItemSelected/{index.12f0ca67.js → index.js} +50 -43
  18. package/components/ObjectLogs/index.js +284 -0
  19. package/components/Page/index.js +36 -0
  20. package/components/PaperForm/index.js +110 -0
  21. package/components/Period/index.js +230 -0
  22. package/components/PropertyValue/index.js +142 -0
  23. package/components/Resizeable/{index.45995d2b.js → index.js} +19 -21
  24. package/components/ScrollBar/index.js +52 -0
  25. package/components/ScrollToTop/index.js +10 -0
  26. package/components/SplitLayout/{index.4032673d.js → index.js} +35 -35
  27. package/components/animate/LoadingScreen/{index.f1cec7db.js → index.js} +27 -29
  28. package/components/animate/MotionContainer/index.js +31 -0
  29. package/components/animate/MotionLazyContainer/index.js +13 -0
  30. package/components/animate/features.js +2 -0
  31. package/components/animate/variants/{bounce.784aaaaa.js → bounce.js} +16 -15
  32. package/components/animate/variants/container.js +20 -0
  33. package/components/animate/variants/fade.js +61 -0
  34. package/components/animate/variants/{index.7a912140.js → index.js} +0 -0
  35. package/components/animate/variants/transition.js +16 -0
  36. package/components/formatters/BooleanFormatter/index.js +52 -0
  37. package/components/formatters/DateFormatter/index.js +66 -0
  38. package/components/formatters/index.js +112 -0
  39. package/components/hook-form/FormProvider/index.js +61 -0
  40. package/components/hook-form/RHFAutocomplete/index.js +144 -0
  41. package/components/hook-form/RHFAutocompleteAsync/index.js +191 -0
  42. package/components/hook-form/RHFCheckbox/index.js +65 -0
  43. package/components/hook-form/RHFDateTime/index.js +79 -0
  44. package/components/hook-form/RHFMultiCheckbox/index.js +32 -0
  45. package/components/hook-form/RHFPeriod/index.js +47 -0
  46. package/components/hook-form/RHFRadioGroup/index.js +41 -0
  47. package/components/hook-form/RHFSelect/index.js +34 -0
  48. package/components/hook-form/RHFTextField/index.js +87 -0
  49. package/components/hook-form/RHFUpload/index.js +255 -0
  50. package/components/mui_extended/Accordion/index.js +105 -0
  51. package/components/mui_extended/Avatar/index.js +33 -0
  52. package/components/mui_extended/BoxIcon/index.js +20 -0
  53. package/components/mui_extended/Breadcrumbs/index.js +92 -0
  54. package/components/mui_extended/Button/index.js +131 -0
  55. package/components/mui_extended/IconButton/index.js +108 -0
  56. package/components/mui_extended/LinkWithRoute/index.js +30 -0
  57. package/components/mui_extended/MenuPopover/index.js +135 -0
  58. package/components/mui_extended/Pager/index.js +137 -0
  59. package/components/mui_extended/Tab/index.js +30 -0
  60. package/components/mui_extended/Typography/index.js +21 -0
  61. package/contexts/ModalContext/index.js +165 -0
  62. package/hooks/useFormAddEdit/index.js +42 -0
  63. package/hooks/useModal/index.js +4 -0
  64. package/index.js +70 -162
  65. package/lodash.js +62 -0
  66. package/node_modules.js +54 -0
  67. package/package.json +2 -1
  68. package/react-data-grid.js +2652 -0
  69. package/react-draggable.js +960 -0
  70. package/react-json-view.js +2764 -0
  71. package/react-lazy-load-image-component.js +792 -0
  72. package/react-resizable.js +541 -0
  73. package/react-splitter-layout.js +165 -0
  74. package/utils/index.js +572 -0
  75. package/assets/Logo/index.228dcb5a.js +0 -86
  76. package/commonjs.565e6834.js +0 -12
  77. package/components/CommonActions/components/ActionCancel/index.cba1b460.js +0 -17
  78. package/components/CommonActions/components/ActionFormCancel/index.be2fe891.js +0 -49
  79. package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +0 -31
  80. package/components/CommonActions/components/ActionIntro/index.cc4b1e0e.js +0 -18
  81. package/components/CommonActions/components/Actions/index.e8148d98.js +0 -743
  82. package/components/DataGrid/index.b688877d.js +0 -894
  83. package/components/DynamicFilter/index.82ce857e.js +0 -1158
  84. package/components/ErrorLabel/index.c8615f16.js +0 -19
  85. package/components/Icon/index.cbca79b0.js +0 -70
  86. package/components/Image/index.e790b50b.js +0 -122
  87. package/components/LanguagePopover/index.3d9611cb.js +0 -87
  88. package/components/Loadable/index.f5518558.js +0 -15
  89. package/components/ModalDialog/index.3850c053.js +0 -168
  90. package/components/ObjectLogs/index.27ef875d.js +0 -266
  91. package/components/Page/index.6d69977e.js +0 -35
  92. package/components/PaperForm/index.d7c74064.js +0 -105
  93. package/components/Period/index.5e68286a.js +0 -160
  94. package/components/PropertyValue/index.ab3dd7e9.js +0 -116
  95. package/components/ScrollBar/index.39eeb2de.js +0 -49
  96. package/components/ScrollToTop/index.e06f98f6.js +0 -11
  97. package/components/animate/MotionContainer/index.8d9f9d80.js +0 -30
  98. package/components/animate/MotionLazyContainer/index.572dd012.js +0 -15
  99. package/components/animate/features.0fbf41e1.js +0 -5
  100. package/components/animate/variants/container.11f82b76.js +0 -20
  101. package/components/animate/variants/fade.b561c0fc.js +0 -59
  102. package/components/animate/variants/transition.bd46b9ce.js +0 -15
  103. package/components/formatters/BooleanFormatter/index.cca53b7f.js +0 -42
  104. package/components/formatters/DateFormatter/index.ad8d9b8e.js +0 -57
  105. package/components/formatters/index.55856d65.js +0 -106
  106. package/components/hook-form/FormProvider/index.257acd9f.js +0 -55
  107. package/components/hook-form/RHFAutocomplete/index.6ed76d4c.js +0 -122
  108. package/components/hook-form/RHFAutocompleteAsync/index.8f2c97ea.js +0 -153
  109. package/components/hook-form/RHFCheckbox/index.f9ce6c39.js +0 -59
  110. package/components/hook-form/RHFDateTime/index.fc5cbafe.js +0 -68
  111. package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +0 -34
  112. package/components/hook-form/RHFPeriod/index.23c254e9.js +0 -45
  113. package/components/hook-form/RHFRadioGroup/index.b3335e13.js +0 -43
  114. package/components/hook-form/RHFSelect/index.b6ca8bb2.js +0 -36
  115. package/components/hook-form/RHFTextField/index.4c455f75.js +0 -77
  116. package/components/hook-form/RHFUpload/index.ed3d739f.js +0 -244
  117. package/components/mui_extended/Accordion/index.2116e423.js +0 -103
  118. package/components/mui_extended/Avatar/index.0a2a4523.js +0 -32
  119. package/components/mui_extended/BoxIcon/index.e638ecc8.js +0 -22
  120. package/components/mui_extended/Breadcrumbs/index.5e37d903.js +0 -89
  121. package/components/mui_extended/Button/index.84d8898c.js +0 -110
  122. package/components/mui_extended/IconButton/index.88f3aadb.js +0 -98
  123. package/components/mui_extended/LinkWithRoute/index.d4b263de.js +0 -28
  124. package/components/mui_extended/MenuPopover/index.488fc536.js +0 -131
  125. package/components/mui_extended/Pager/index.0576814f.js +0 -126
  126. package/components/mui_extended/Tab/index.e0653a0a.js +0 -28
  127. package/components/mui_extended/Typography/index.0c4604b3.js +0 -22
  128. package/contexts/ModalContext/index.2188b69e.js +0 -150
  129. package/hooks/useFormAddEdit/index.d4845f1a.js +0 -26
  130. package/hooks/useModal/index.6571d2d9.js +0 -6
  131. package/lodash.e09401f0.js +0 -32
  132. package/node_modules.168cb897.js +0 -55
  133. package/react-data-grid.d46d625e.js +0 -2115
  134. package/react-draggable.20e95c61.js +0 -714
  135. package/react-json-view.f56a7f8e.js +0 -2762
  136. package/react-lazy-load-image-component.45b56650.js +0 -784
  137. package/react-resizable.5277deaf.js +0 -371
  138. package/react-splitter-layout.7810ac1b.js +0 -165
  139. package/utils/index.214d9542.js +0 -435
@@ -1,894 +0,0 @@
1
- import { styled as A, alpha as ne } from "@mui/material/styles";
2
- import { forwardRef as ie, useRef as J, useLayoutEffect as le, createContext as j, useState as F, useContext as U, useEffect as z, useMemo as E, useCallback as $ } from "react";
3
- import { S as q, a as T, u as Y, H as ae, D as se } from "../../react-data-grid.d46d625e.js";
4
- import { useDrag as ce, useDrop as de, DndProvider as ue } from "react-dnd";
5
- import { HTML5Backend as ge } from "react-dnd-html5-backend";
6
- import { SvgIcon as B, Checkbox as fe, InputBase as he, Skeleton as pe } from "@mui/material";
7
- import { jsx as d, jsxs as Q } from "react/jsx-runtime";
8
- import { voidFunction as I, useModuleDictionary as we, useModuleSkeleton as me } from "@m4l/core";
9
- import { A as ye, a as Ce } from "../CommonActions/components/Actions/index.e8148d98.js";
10
- import { g as be, d as ve } from "../ModalDialog/index.3850c053.js";
11
- import { g as xe, d as Re } from "../mui_extended/Pager/index.0576814f.js";
12
- const Se = A("div")(() => ({
13
- display: "flex",
14
- flexDirection: "column",
15
- position: "absolute",
16
- padding: "0px",
17
- inset: "0px",
18
- overflow: "hidden"
19
- })), ke = A("div")(({
20
- theme: e
21
- }) => ({
22
- position: "absolute",
23
- bottom: "0px",
24
- top: "0px",
25
- left: "0px",
26
- right: "0px",
27
- "& .rdg ": {
28
- userSelect: "initial",
29
- height: "100%",
30
- contentVisibility: "unset",
31
- overflow: "scroll",
32
- borderRadius: "5px",
33
- "--rdg-grid-inline-size": "0px",
34
- "--rdg-header-background-color": e.palette.grid?.sectionHeader,
35
- "--rdg-row-selected-background-color": e.palette.mode === "light" ? e.palette.primary.LightSelected : e.palette.primary.DarkSelected,
36
- "--rdg-row-hover-background-color": e.palette.grid?.rowHover,
37
- "--rdg-background-color": e.palette.background.default,
38
- "--rdg-selection-color": e.palette.primary.main,
39
- "--row-selected-hover-background-color": e.palette.mode === "light" ? e.palette.primary.LightSelectedHover : e.palette.primary.DarkSelectedHover,
40
- "--rdg-checkbox-color": e.palette.primary.main,
41
- "--rdg-checkbox-focus-color": ne(e.palette.primary.main, e.palette.action.selectedOpacity),
42
- "--rdg-border-color": e.palette.divider
43
- },
44
- "& .rdg::-webkit-scrollbar": {
45
- width: "6px",
46
- height: "6px",
47
- borderRadius: "3px",
48
- backgroundColor: "transparent"
49
- },
50
- "& .rdg::-webkit-scrollbar-track": {
51
- backgroundColor: "transparent",
52
- border: "0px solid transparent"
53
- },
54
- "& .rdg::-webkit-scrollbar-corner": {
55
- backgroundColor: "transparent"
56
- },
57
- "& ::-webkit-scrollbar-thumb": {
58
- borderRadius: "10px",
59
- backgroundColor: e.palette.divider,
60
- border: "0px solid transparent"
61
- },
62
- '& [role="columnheader"]': {
63
- justifyContent: "center",
64
- alignItems: "center"
65
- },
66
- "& .rdg-cell": {
67
- fontFamily: e.typography.body2.fontFamily,
68
- fontWeight: e.typography.body2.fontWeight,
69
- fontSize: e.typography.body2.fontSize,
70
- color: e.palette.text.secondary,
71
- borderBottom: `1px solid ${e.palette.divider}`,
72
- borderRight: "0px solid transparent",
73
- position: "relative",
74
- "&.rdg-cell-frozen": {
75
- position: "sticky"
76
- },
77
- "&:after": {
78
- content: '""',
79
- borderRight: `1px solid ${e.palette.divider}`,
80
- position: "absolute",
81
- right: "0px",
82
- top: "25%",
83
- bottom: "25%"
84
- },
85
- "& .m4l_icon": {
86
- height: "100%"
87
- }
88
- },
89
- "& .rdg-cell.rdg-cell-align-left": {
90
- textAlign: "left"
91
- },
92
- "& .rdg-cell.rdg-cell-align-center": {
93
- textAlign: "center"
94
- },
95
- "& .rdg-cell.rdg-cell-align-right": {
96
- textAlign: "right"
97
- },
98
- "& .rdg-row .rdg-cell-frozen-last:after": {
99
- borderRight: "0px solid transparent",
100
- boxShadow: "none"
101
- },
102
- "& .rdg-row :last-child:after": {
103
- borderRight: "0px solid transparent"
104
- },
105
- "& .rdg-header-row .rdg-cell": {
106
- fontFamily: e.typography.subtitle2.fontFamily,
107
- fontWeight: e.typography.subtitle2.fontWeight,
108
- fontSize: e.typography.subtitle2.fontSize,
109
- color: e.palette.text.primary,
110
- borderRight: "0px solid transparent",
111
- boxShadow: "none",
112
- "&.rdg-cell-frozen-last": {
113
- "&:after": {
114
- borderRight: "0px solid transparent"
115
- },
116
- boxShadow: "var(--rdg-frozen-cell-box-shadow)"
117
- },
118
- "& .rdg-sort-arrow": {
119
- width: e.spacing(1),
120
- margin: `0 ${e.spacing(0.5)}`
121
- }
122
- },
123
- "& .rdg-header-row :last-child.rdg-cell": {
124
- borderTopRightRadius: "5px",
125
- "&:after": {
126
- borderRight: "0px solid transparent"
127
- }
128
- },
129
- "& .filter_cell_div": {
130
- paddingLeft: e.spacing(0.5),
131
- paddingRight: e.spacing(0.5)
132
- },
133
- "& .rdg-header-sort-cell": {
134
- width: "100%",
135
- flexGrow: "1",
136
- alignItems: "center"
137
- },
138
- '& [aria-columnsort="ASC"]': {
139
- borderTop: `2px solid ${e.palette.primary.main}`
140
- },
141
- '& [aria-columnsort="DESC"]': {
142
- borderBottom: `2px solid ${e.palette.primary.main}`
143
- }
144
- })), He = A("div", {
145
- shouldForwardProp: (e) => e !== "withActions"
146
- })(({
147
- withActions: e,
148
- theme: t
149
- }) => ({
150
- display: "flex",
151
- flexDirection: "column",
152
- position: "absolute",
153
- top: e ? t.spacing(5.5) : "0px",
154
- bottom: "0px",
155
- left: "0px",
156
- right: "0px",
157
- overflow: "hidden"
158
- }));
159
- function _e(e) {
160
- return /* @__PURE__ */ d(B, {
161
- ...e,
162
- children: /* @__PURE__ */ d("path", {
163
- 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"
164
- })
165
- });
166
- }
167
- function Fe(e) {
168
- return /* @__PURE__ */ d(B, {
169
- ...e,
170
- children: /* @__PURE__ */ d("path", {
171
- 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"
172
- })
173
- });
174
- }
175
- function ze(e) {
176
- return /* @__PURE__ */ d(B, {
177
- ...e,
178
- children: /* @__PURE__ */ d("path", {
179
- 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"
180
- })
181
- });
182
- }
183
- const Ie = ie(
184
- function({
185
- onChange: t,
186
- checked: o,
187
- ...l
188
- }, r) {
189
- function i(n) {
190
- t(n.target.checked, n.nativeEvent.shiftKey);
191
- }
192
- return /* @__PURE__ */ d(fe, {
193
- checked: o,
194
- size: "small",
195
- icon: /* @__PURE__ */ d(_e, {}),
196
- checkedIcon: /* @__PURE__ */ d(Fe, {}),
197
- indeterminateIcon: /* @__PURE__ */ d(ze, {}),
198
- onChange: i,
199
- ...l
200
- });
201
- }
202
- ), De = "filter-cell", X = 35;
203
- function Me(e) {
204
- const [t, o] = Y(), l = (i, n) => {
205
- o({
206
- row: e.row,
207
- checked: i,
208
- isShiftClick: n
209
- });
210
- };
211
- return T({
212
- value: t,
213
- isCellSelected: e.isCellSelected,
214
- onChange: l,
215
- "aria-label": "Select"
216
- });
217
- }
218
- function Ae(e) {
219
- const [t, o] = Y(), l = (i) => {
220
- o({
221
- row: e.row,
222
- checked: i,
223
- isShiftClick: !1
224
- });
225
- };
226
- return T({
227
- value: t,
228
- isCellSelected: e.isCellSelected,
229
- onChange: l,
230
- "aria-label": "Select Group"
231
- });
232
- }
233
- const Oe = {
234
- key: q,
235
- name: "",
236
- width: 60,
237
- maxWidth: 60,
238
- resizable: !1,
239
- sortable: !1,
240
- frozen: !0,
241
- type: "number",
242
- headerRenderer: (e) => T({
243
- "aria-label": "Select All",
244
- isCellSelected: e.isCellSelected,
245
- value: e.allRowsSelected,
246
- onChange: e.onAllRowsSelectionChange
247
- }),
248
- formatter: Me,
249
- groupFormatter: Ae
250
- };
251
- function We(e) {
252
- const t = J(null);
253
- return le(() => {
254
- !e || t.current?.focus({ preventScroll: !0 });
255
- }, [e]), {
256
- ref: t,
257
- tabIndex: e ? 0 : -1
258
- };
259
- }
260
- const Ge = {
261
- activeFilters: !1,
262
- setActiveFilters: I
263
- }, Z = j(Ge);
264
- function Ne({
265
- children: e,
266
- initialActiveFilters: t
267
- }) {
268
- const [o, l] = F({
269
- activeFilters: t
270
- }), r = (n, s) => {
271
- const c = o.filters ? new Map(o.filters) : /* @__PURE__ */ new Map();
272
- s !== "" ? c.set(n, s) : c.delete(n), l({
273
- ...o,
274
- filters: c
275
- });
276
- }, i = (n) => {
277
- l(n ? {
278
- activeFilters: !0,
279
- filters: /* @__PURE__ */ new Map()
280
- } : {
281
- activeFilters: !1
282
- });
283
- };
284
- return /* @__PURE__ */ d(Z.Provider, {
285
- value: {
286
- ...o,
287
- onChangeFilter: r,
288
- setActiveFilters: i
289
- },
290
- children: e
291
- });
292
- }
293
- const K = () => U(Z);
294
- function Ve(e) {
295
- const {
296
- onColumnsReorder: t,
297
- column: o,
298
- isCellSelected: l,
299
- ...r
300
- } = e, {
301
- ref: i,
302
- tabIndex: n
303
- } = We(l), {
304
- getLabel: s
305
- } = we(), {
306
- activeFilters: c,
307
- filters: g,
308
- onChangeFilter: w
309
- } = K(), [v, R] = F(g?.get(o.key) || ""), [{
310
- isDragging: m
311
- }, b] = ce({
312
- type: "COLUMN_DRAG",
313
- item: {
314
- key: o.key
315
- },
316
- collect: (a) => ({
317
- isDragging: a.isDragging()
318
- })
319
- }), [{
320
- isOver: S
321
- }, k] = de({
322
- accept: "COLUMN_DRAG",
323
- drop({
324
- key: a
325
- }) {
326
- t(a, o.key);
327
- },
328
- collect: (a) => ({
329
- isOver: a.isOver(),
330
- canDrop: a.canDrop()
331
- })
332
- }), h = (a) => {
333
- c && w && w(o.key, a.target.value), R(a.target.value);
334
- };
335
- z(() => {
336
- c || R("");
337
- }, [c]);
338
- const u = {
339
- ...o
340
- };
341
- return u.withinHeaderRenderer && (u.name = u.withinHeaderRenderer(e)), /* @__PURE__ */ Q("div", {
342
- ref: (a) => {
343
- b(a), k(a);
344
- },
345
- style: {
346
- opacity: m ? 0.5 : 1,
347
- backgroundColor: S ? "#ececec" : void 0,
348
- cursor: "move",
349
- display: "flex",
350
- flexDirection: "column",
351
- lineHeight: "1",
352
- height: "100%",
353
- justifyContent: "center",
354
- textAlign: "center"
355
- },
356
- children: [/* @__PURE__ */ d(ae, {
357
- column: u,
358
- isCellSelected: l,
359
- ...r
360
- }), c && (o?.withFilter === void 0 || o.withFilter === !0) && /* @__PURE__ */ d("div", {
361
- className: "filter_cell_div",
362
- style: {
363
- borderTop: "1px solid var(--rdg-border-color)",
364
- width: "100%",
365
- display: "flex",
366
- alignItems: "center",
367
- height: `${X}px`
368
- },
369
- children: /* @__PURE__ */ d(he, {
370
- inputRef: i,
371
- placeholder: s("data_grid.filter_holder"),
372
- style: {
373
- width: "100%",
374
- paddingBottom: "2px",
375
- border: "1px solid var(--rdg-border-color)"
376
- },
377
- tabIndex: n,
378
- type: "text",
379
- onChange: h,
380
- value: v
381
- })
382
- })]
383
- });
384
- }
385
- const $e = (e) => {
386
- function t(o) {
387
- return /* @__PURE__ */ d(Ve, {
388
- ...o,
389
- onColumnsReorder: e
390
- });
391
- }
392
- return t;
393
- }, Ee = {
394
- columnsWidths: /* @__PURE__ */ new Map(),
395
- onChangeColumnsConfig: I,
396
- onChangeColumnsOrder: I,
397
- onChangeColumnWidth: I,
398
- columnsConfig: [{
399
- key: "string",
400
- visible: !0,
401
- hidden: !1,
402
- index: 0,
403
- frozen: !0,
404
- name: "string;",
405
- orginalIndex: 0,
406
- originalVisible: !0,
407
- originalFrozen: !1
408
- }],
409
- isSkeleton: !1,
410
- rowsCount: 0,
411
- setRowsCount: I,
412
- rowHeights: 36,
413
- currentRowHeight: 36,
414
- currentRowHeaderHeight: 40,
415
- currentRowHeightVariant: "compact",
416
- setRowHeightVariant: I
417
- }, ee = j(Ee), Te = (e, t) => {
418
- let o = -1;
419
- return [t.find((l, r) => (l.key === e && (o = r), l.key === e)), o];
420
- };
421
- function L(e, t, o = void 0) {
422
- let l;
423
- if (o)
424
- l = o.columnsConfig;
425
- else
426
- try {
427
- const r = window.localStorage.getItem(`${e}_columns_config`);
428
- l = r !== null ? JSON.parse(r) : [];
429
- } catch {
430
- l = [];
431
- }
432
- return t.map((r, i) => {
433
- const [n = {
434
- ...r
435
- }, s] = Te(r.key, l);
436
- return {
437
- key: r.key,
438
- name: r.name,
439
- hidden: r.hidden === void 0 ? !1 : r.hidden,
440
- index: s > -1 ? s : i,
441
- visible: n.visible === void 0 ? !0 : n.visible,
442
- frozen: n.frozen === void 0 ? !1 : n.frozen,
443
- orginalIndex: i,
444
- originalVisible: r.visible === void 0 ? !0 : r.visible,
445
- originalFrozen: r.frozen === void 0 ? !1 : r.frozen
446
- };
447
- }).sort((r, i) => r.index - i.index);
448
- }
449
- function Be(e, t, o) {
450
- const l = /* @__PURE__ */ new Map();
451
- let r;
452
- try {
453
- const i = window.localStorage.getItem(`${e}_columns_width`);
454
- r = i !== null ? new Map(JSON.parse(i)) : /* @__PURE__ */ new Map();
455
- } catch {
456
- r = /* @__PURE__ */ new Map();
457
- }
458
- for (let i = 0; i < t.length; i++) {
459
- let n;
460
- if (o)
461
- try {
462
- n = o.columnsWidths.get(t[i].key);
463
- } catch {
464
- }
465
- if (n === void 0) {
466
- const s = r.get(t[i].key);
467
- typeof s == "number" && (n = s);
468
- }
469
- n !== void 0 && l.set(t[i].key, n);
470
- }
471
- return l;
472
- }
473
- function Ke(e, t) {
474
- localStorage.setItem(`${e}_columns_width`, JSON.stringify([...t]));
475
- }
476
- function Le(e, t) {
477
- localStorage.setItem(`${e}_columns_config`, JSON.stringify(t));
478
- }
479
- function W(e) {
480
- return e === "compact" ? 0 : e === "standard" ? 1 : 2;
481
- }
482
- function Pe(e) {
483
- const {
484
- id: t,
485
- children: o,
486
- isSkeleton: l,
487
- columns: r,
488
- remoteConfig: i,
489
- rowsCount: n,
490
- rowActionsGetter: s,
491
- rowHeights: c,
492
- rowHeaderHeights: g,
493
- initialRowHeightVariant: w
494
- } = e, [v, R] = F(/* @__PURE__ */ new Map()), [m, b] = F(() => []), [S, k] = F(n), [h, u] = F(() => {
495
- if (typeof c != typeof g)
496
- throw new Error("Must be same type rowheights and rowHeaderTypes");
497
- if (typeof c == "number" && typeof g == "number")
498
- return {
499
- rowHVariant: "compact",
500
- rowHeight: c,
501
- rowHeaderHeight: g
502
- };
503
- if (typeof c != "number" && c.length !== 3)
504
- throw new Error("Must be 3 heights");
505
- if (typeof g != "number" && g.length !== 3)
506
- throw new Error("Must be 3 HeaderHeights");
507
- return {
508
- rowHVariant: w,
509
- rowHeight: typeof c != "number" ? c[W(w)] : c,
510
- rowHeaderHeight: typeof g != "number" ? g[W(w)] : g
511
- };
512
- }), a = E(() => c, [c]);
513
- let y;
514
- z(() => {
515
- }, [m]), z(() => {
516
- R(Be(t, r, i)), b(L(t, r, i));
517
- }, [r, t, i]);
518
- const H = $((p) => {
519
- Le(t, p), b(p);
520
- }, [b, t]), x = $((p, D) => {
521
- if (p === D)
522
- return;
523
- const N = m.findIndex((V) => V.key === p), O = m.findIndex((V) => V.key === D), M = [...m];
524
- M.splice(O, 0, M.splice(N, 1)[0]), H(M);
525
- }, [m, H]), f = (p, D) => {
526
- v.set(p, Math.round(D)), y && clearTimeout(y), y = setTimeout(() => {
527
- Ke(t, v);
528
- }, 500);
529
- };
530
- z(() => {
531
- b(L(t, r));
532
- }, [r]);
533
- const C = (p) => {
534
- k(p);
535
- }, _ = $((p) => {
536
- if (typeof c == "number" || typeof g == "number")
537
- throw new Error("Only use setCurrentRowHeight with vector rowHeights");
538
- u({
539
- rowHVariant: p,
540
- rowHeight: c[W(p)],
541
- rowHeaderHeight: g[W(p)]
542
- });
543
- }, [u, c, g]);
544
- return /* @__PURE__ */ d(ee.Provider, {
545
- value: {
546
- isSkeleton: l,
547
- columnsConfig: m,
548
- columnsWidths: v,
549
- onChangeColumnsConfig: H,
550
- onChangeColumnsOrder: x,
551
- onChangeColumnWidth: f,
552
- rowsCount: S,
553
- setRowsCount: C,
554
- rowActionsGetter: s,
555
- currentRowHeightVariant: h.rowHVariant,
556
- currentRowHeight: h.rowHeight,
557
- currentRowHeaderHeight: h.rowHeaderHeight,
558
- rowHeights: a,
559
- setRowHeightVariant: _
560
- },
561
- children: o
562
- });
563
- }
564
- const te = () => U(ee), Je = A("div")(() => ({
565
- display: "flex",
566
- width: "100%",
567
- height: "100%",
568
- alignItems: "center"
569
- }));
570
- function P() {
571
- return /* @__PURE__ */ d(Je, {
572
- children: /* @__PURE__ */ d(pe, {
573
- variant: "text",
574
- width: "100%",
575
- height: "12px"
576
- })
577
- });
578
- }
579
- function je(e, t) {
580
- const o = e.find((r) => r.key === t);
581
- let l = "string";
582
- switch (o && (l = o.type || "string"), l) {
583
- case "number":
584
- return (r, i) => {
585
- try {
586
- return Number(r[t]) - Number(i[t]);
587
- } catch {
588
- return -1;
589
- }
590
- };
591
- default:
592
- return (r, i) => {
593
- try {
594
- return r[t].toString().localeCompare(i[t].toString());
595
- } catch {
596
- return -1;
597
- }
598
- };
599
- }
600
- }
601
- const G = (e, t) => t.findIndex((o) => o.key === e), Ue = (e, t, o, l, r) => {
602
- let i = e.filter((n) => {
603
- const s = G(n.key, o), c = s > -1 ? o[s].visible : !0;
604
- return !n.hidden && c;
605
- }).sort(
606
- (n, s) => G(n.key, o) - G(s.key, o)
607
- ).map((n) => {
608
- const s = G(n.key, o);
609
- return {
610
- ...n,
611
- frozen: s > -1 ? o[s].frozen : !0,
612
- width: typeof l.get(n.key) == "number" ? l.get(n.key) : n.width
613
- };
614
- }).sort((n, s) => (n.frozen === void 0 || n.frozen === !1) == (s.frozen === void 0 || s.frozen === !1) ? 0 : n.frozen ? -1 : 1);
615
- return r && (i = [ye, ...i]), t && (i = [Oe, ...i]), i;
616
- }, qe = (e) => {
617
- switch (e) {
618
- case "string":
619
- return "left";
620
- case "date":
621
- case "boolean":
622
- case "custom":
623
- return "center";
624
- case "number":
625
- return "right";
626
- }
627
- return "left";
628
- }, Ye = (e, t, o) => {
629
- const { columnsConfig: l, columnsWidths: r, onChangeColumnsOrder: i, rowActionsGetter: n, isSkeleton: s } = te(), [c, g] = F(
630
- () => []
631
- ), [w, v] = F([]), { activeFilters: R, filters: m } = K(), b = (h, u) => u.findIndex((y) => h === y.key && y.hidden === !1) !== -1;
632
- z(() => {
633
- g(
634
- Ue(
635
- e,
636
- o,
637
- l,
638
- r,
639
- n
640
- )
641
- );
642
- const h = w.filter(
643
- (u) => b(u.columnKey, e)
644
- );
645
- JSON.stringify(h) !== JSON.stringify(w) && v(h);
646
- }, [e, l, n]);
647
- const S = E(() => {
648
- const h = $e(i);
649
- return c.map((u) => {
650
- const a = {
651
- ...u,
652
- cellClass: u.align !== void 0 ? `rdg-cell-align-${u.align}` : `rdg-cell-align-${qe(u.type)}`
653
- };
654
- return a.key === q || a.isDraggable !== void 0 && a.isDraggable === !1 || (s && (a.headerRenderer = P, a.formatter = P), a.headerRenderer && (a.withinHeaderRenderer = a.headerRenderer), (a?.withFilter === void 0 || a.withFilter === !0) && R && (a.headerCellClass = De), a.headerRenderer = h), a;
655
- });
656
- }, [s, c, R, i]), k = E(() => {
657
- const h = t.filter((u) => {
658
- if (!m || m.size === 0)
659
- return !0;
660
- const a = m.entries();
661
- let y = !0;
662
- for (let H = 0; H < m.size; H++) {
663
- const x = a.next().value, f = x[0], C = `${x[1]}`;
664
- let _;
665
- try {
666
- _ = `${u[f]}`;
667
- } catch {
668
- continue;
669
- }
670
- if (y = y && _.includes(C), !y)
671
- break;
672
- }
673
- return y;
674
- });
675
- return w.length === 0 || h.sort((u, a) => {
676
- for (const y of w) {
677
- const x = je(c, y.columnKey)(u, a);
678
- if (x !== 0)
679
- return y.direction === "ASC" ? x : -x;
680
- }
681
- return 0;
682
- }), h;
683
- }, [t, w, m]);
684
- return { finalColumns: S, sortColumns: w, setSortColumns: v, finalRows: k };
685
- };
686
- function Qe(e) {
687
- const {
688
- isMultipleSelect: t = !1,
689
- columns: o,
690
- rows: l,
691
- withActions: r,
692
- onRowsChange: i
693
- } = e, {
694
- finalColumns: n,
695
- sortColumns: s,
696
- setSortColumns: c,
697
- finalRows: g
698
- } = Ye(o, l, t), {
699
- activeFilters: w
700
- } = K(), {
701
- onChangeColumnWidth: v,
702
- setRowsCount: R,
703
- currentRowHeight: m,
704
- currentRowHeaderHeight: b
705
- } = te(), [S, k] = F(() => new Set(e.selectedRows));
706
- z(() => {
707
- k(new Set(e.selectedRows));
708
- }, [e.selectedRows]);
709
- const h = J(null), u = (f) => {
710
- if (e.onRowsSelectedChange) {
711
- const C = [];
712
- if (f.size > 0) {
713
- const _ = f.entries();
714
- for (let p = 0; p < f.size; p++) {
715
- const N = _.next().value[1], O = g.find((M) => e.rowKeyGetter(M) === N);
716
- O && C.push(O);
717
- }
718
- }
719
- e.onRowsSelectedChange(f, C);
720
- }
721
- }, a = (f) => {
722
- k(f), u(f);
723
- }, y = (f) => {
724
- if (!t) {
725
- if (S.entries().next().value && S.entries().next().value[1] === e.rowKeyGetter(f))
726
- return;
727
- const C = /* @__PURE__ */ new Set([e.rowKeyGetter(f)]);
728
- k(C), u(C);
729
- }
730
- };
731
- z(() => {
732
- let f = 0;
733
- for (const C of n) {
734
- const _ = s.findIndex((p) => C.key === p.columnKey);
735
- _ !== -1 ? h.current?.element?.querySelector(`[role="columnheader"][aria-colindex="${f + 1}"]`)?.setAttribute("aria-columnsort", `${s[_].direction}`) : h.current?.element?.querySelector(`[role="columnheader"][aria-colindex="${f + 1}"]`)?.removeAttribute("aria-columnsort"), f++;
736
- }
737
- }, [s, n]), z(() => {
738
- R(g.length);
739
- }, [g]);
740
- const H = (f, C) => {
741
- v(n[f].key, C);
742
- }, x = (f) => {
743
- c(f);
744
- };
745
- return /* @__PURE__ */ d(He, {
746
- id: "WrapperTable",
747
- withActions: r,
748
- children: /* @__PURE__ */ d(ke, {
749
- id: "OriginalGridWrapperStyled",
750
- children: /* @__PURE__ */ d(ue, {
751
- backend: ge,
752
- children: /* @__PURE__ */ d(se, {
753
- className: "fill-grid rdg-light",
754
- ref: h,
755
- headerRowHeight: w ? b + X : b,
756
- columns: n,
757
- sortColumns: s,
758
- onSortColumnsChange: x,
759
- onColumnResize: H,
760
- rows: g,
761
- onRowsChange: i,
762
- selectedRows: S,
763
- onSelectedRowsChange: a,
764
- onRowClick: y,
765
- rowHeight: m,
766
- rowKeyGetter: e.rowKeyGetter,
767
- cellNavigationMode: "LOOP_OVER_ROW",
768
- components: {
769
- checkboxFormatter: Ie
770
- },
771
- defaultColumnOptions: {
772
- resizable: !0,
773
- sortable: !0
774
- }
775
- })
776
- })
777
- })
778
- });
779
- }
780
- function ct(e) {
781
- const {
782
- withActions: t = !0,
783
- rows: o,
784
- columns: l,
785
- actionsProps: r,
786
- rowActionsGetter: i,
787
- onRowsChange: n,
788
- rowHeaderHeights: s = [44, 63, 75],
789
- rowHeights: c = [36, 52, 67],
790
- initialRowHeightVariant: g = "compact"
791
- } = e, w = me();
792
- return /* @__PURE__ */ d(Se, {
793
- id: `WrapperGrid_${e.id}`,
794
- children: /* @__PURE__ */ d(Pe, {
795
- id: e.id,
796
- isSkeleton: w,
797
- columns: e.columns,
798
- rowHeights: c,
799
- rowHeaderHeights: s,
800
- initialRowHeightVariant: g,
801
- rowsCount: o.length,
802
- rowActionsGetter: i,
803
- children: /* @__PURE__ */ Q(Ne, {
804
- initialActiveFilters: !1,
805
- children: [t && r && /* @__PURE__ */ d(Ce, {
806
- ...r
807
- }), /* @__PURE__ */ d(Qe, {
808
- id: e.id,
809
- withActions: t,
810
- columns: l,
811
- rows: o,
812
- isMultipleSelect: e.isMultipleSelect,
813
- selectedRows: e.selectedRows,
814
- rowKeyGetter: e.rowKeyGetter,
815
- onRowsChange: n,
816
- onRowsSelectedChange: e.onRowsSelectedChange
817
- })]
818
- })
819
- })
820
- });
821
- }
822
- function dt() {
823
- return ["data_grid"].concat(xe()).concat(be());
824
- }
825
- ({
826
- ...Re,
827
- ...ve
828
- });
829
- const re = A("input")(() => ({
830
- appearance: "none",
831
- boxSizing: "border-box",
832
- inlineSize: "100%",
833
- blockSize: "100%",
834
- paddingBlock: "0",
835
- verticalAlign: "top",
836
- textAlign: "right",
837
- color: "var(--rdg-color)",
838
- backgroundColor: "var(--rdg-background-color)",
839
- fontFamily: "inherit",
840
- "&:focus": {
841
- outline: "none"
842
- },
843
- "&::placeholder": {
844
- color: "#999",
845
- opacity: "1"
846
- }
847
- }));
848
- function oe(e) {
849
- e?.focus(), e?.select();
850
- }
851
- function ut({
852
- row: e,
853
- column: t,
854
- onRowChange: o,
855
- onClose: l
856
- }) {
857
- return /* @__PURE__ */ d(re, {
858
- className: "rdg-text-editor",
859
- ref: oe,
860
- value: e[t.key],
861
- onChange: (r) => o({
862
- ...e,
863
- [t.key]: r.target.value
864
- }),
865
- onBlur: () => l(!0)
866
- });
867
- }
868
- function gt({
869
- row: e,
870
- column: t,
871
- onRowChange: o,
872
- onClose: l
873
- }) {
874
- return /* @__PURE__ */ d(re, {
875
- className: "rdg-text-editor",
876
- ref: oe,
877
- type: "number",
878
- value: e[t.key],
879
- onChange: (r) => o({
880
- ...e,
881
- [t.key]: r.target.value !== "" ? Number(r.target.value) : ""
882
- }),
883
- onBlur: () => l(!0)
884
- });
885
- }
886
- export {
887
- ct as D,
888
- gt as N,
889
- ke as O,
890
- ut as T,
891
- K as a,
892
- dt as g,
893
- te as u
894
- };