@m4l/components 0.1.12 → 0.1.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 (143) hide show
  1. package/assets/Logo/index.228dcb5a.js +86 -0
  2. package/commonjs.565e6834.js +12 -0
  3. package/components/CommonActions/components/ActionCancel/index.cba1b460.js +17 -0
  4. package/components/CommonActions/components/ActionFormCancel/index.be2fe891.js +49 -0
  5. package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +31 -0
  6. package/components/CommonActions/components/ActionIntro/index.cc4b1e0e.js +18 -0
  7. package/components/CommonActions/components/Actions/index.e8148d98.js +743 -0
  8. package/components/CompanyLogo/{index.js → index.f81c179c.js} +42 -48
  9. package/components/DataGrid/index.b688877d.js +894 -0
  10. package/components/DynamicFilter/index.82ce857e.js +1158 -0
  11. package/components/ErrorLabel/index.c8615f16.js +19 -0
  12. package/components/Icon/index.cbca79b0.js +70 -0
  13. package/components/Image/index.e790b50b.js +122 -0
  14. package/components/LanguagePopover/index.3d9611cb.js +87 -0
  15. package/components/Loadable/index.f5518558.js +15 -0
  16. package/components/ModalDialog/index.3850c053.js +168 -0
  17. package/components/NoItemSelected/{index.js → index.12f0ca67.js} +43 -50
  18. package/components/ObjectLogs/index.27ef875d.js +266 -0
  19. package/components/Page/index.6d69977e.js +35 -0
  20. package/components/Page/index.d.ts +1 -1
  21. package/components/PaperForm/index.d7c74064.js +105 -0
  22. package/components/Period/index.5e68286a.js +160 -0
  23. package/components/PropertyValue/index.ab3dd7e9.js +116 -0
  24. package/components/Resizeable/{index.js → index.45995d2b.js} +21 -19
  25. package/components/ScrollBar/index.39eeb2de.js +49 -0
  26. package/components/ScrollToTop/index.e06f98f6.js +11 -0
  27. package/components/SplitLayout/{index.js → index.4032673d.js} +35 -35
  28. package/components/animate/IconButtonAnimate/index.d.ts +1 -1
  29. package/components/animate/LoadingScreen/{index.js → index.f1cec7db.js} +29 -27
  30. package/components/animate/MotionContainer/index.8d9f9d80.js +30 -0
  31. package/components/animate/MotionLazyContainer/index.572dd012.js +15 -0
  32. package/components/animate/features.0fbf41e1.js +5 -0
  33. package/components/animate/variants/{bounce.js → bounce.784aaaaa.js} +15 -16
  34. package/components/animate/variants/container.11f82b76.js +20 -0
  35. package/components/animate/variants/fade.b561c0fc.js +59 -0
  36. package/components/animate/variants/{index.js → index.7a912140.js} +0 -0
  37. package/components/animate/variants/transition.bd46b9ce.js +15 -0
  38. package/components/formatters/BooleanFormatter/index.cca53b7f.js +42 -0
  39. package/components/formatters/DateFormatter/index.ad8d9b8e.js +57 -0
  40. package/components/formatters/index.55856d65.js +106 -0
  41. package/components/hook-form/FormProvider/index.257acd9f.js +55 -0
  42. package/components/hook-form/RHFAutocomplete/index.6ed76d4c.js +122 -0
  43. package/components/hook-form/RHFAutocompleteAsync/index.8f2c97ea.js +153 -0
  44. package/components/hook-form/RHFCheckbox/index.f9ce6c39.js +59 -0
  45. package/components/hook-form/RHFDateTime/index.fc5cbafe.js +68 -0
  46. package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +34 -0
  47. package/components/hook-form/RHFPeriod/index.23c254e9.js +45 -0
  48. package/components/hook-form/RHFRadioGroup/index.b3335e13.js +43 -0
  49. package/components/hook-form/RHFSelect/index.b6ca8bb2.js +36 -0
  50. package/components/hook-form/RHFTextField/index.4c455f75.js +77 -0
  51. package/components/hook-form/RHFTextField/index.d.ts +1 -1
  52. package/components/hook-form/RHFUpload/index.ed3d739f.js +244 -0
  53. package/components/mui_extended/Accordion/index.2116e423.js +103 -0
  54. package/components/mui_extended/Avatar/index.0a2a4523.js +32 -0
  55. package/components/mui_extended/Avatar/index.d.ts +1 -1
  56. package/components/mui_extended/BoxIcon/index.e638ecc8.js +22 -0
  57. package/components/mui_extended/Breadcrumbs/index.5e37d903.js +89 -0
  58. package/components/mui_extended/Button/index.84d8898c.js +110 -0
  59. package/components/mui_extended/IconButton/index.88f3aadb.js +98 -0
  60. package/components/mui_extended/LinkWithRoute/index.d4b263de.js +28 -0
  61. package/components/mui_extended/MenuPopover/index.488fc536.js +131 -0
  62. package/components/mui_extended/Pager/index.0576814f.js +126 -0
  63. package/components/mui_extended/Tab/index.e0653a0a.js +28 -0
  64. package/components/mui_extended/Typography/index.0c4604b3.js +22 -0
  65. package/contexts/ModalContext/index.2188b69e.js +150 -0
  66. package/hooks/useFormAddEdit/index.d4845f1a.js +26 -0
  67. package/hooks/useModal/index.6571d2d9.js +6 -0
  68. package/index.js +162 -70
  69. package/lodash.e09401f0.js +32 -0
  70. package/node_modules.168cb897.js +55 -0
  71. package/package.json +1 -1
  72. package/react-data-grid.d46d625e.js +2115 -0
  73. package/react-draggable.20e95c61.js +714 -0
  74. package/react-json-view.f56a7f8e.js +2762 -0
  75. package/react-lazy-load-image-component.45b56650.js +784 -0
  76. package/react-resizable.5277deaf.js +371 -0
  77. package/react-splitter-layout.7810ac1b.js +165 -0
  78. package/utils/index.214d9542.js +435 -0
  79. package/assets/Logo/index.js +0 -91
  80. package/commonjs.js +0 -9
  81. package/components/CommonActions/components/ActionCancel/index.js +0 -15
  82. package/components/CommonActions/components/ActionFormCancel/index.js +0 -62
  83. package/components/CommonActions/components/ActionFormIntro/index.js +0 -35
  84. package/components/CommonActions/components/ActionIntro/index.js +0 -16
  85. package/components/CommonActions/components/Actions/index.js +0 -859
  86. package/components/DataGrid/index.js +0 -1067
  87. package/components/DynamicFilter/index.js +0 -1573
  88. package/components/ErrorLabel/index.js +0 -18
  89. package/components/Icon/index.js +0 -80
  90. package/components/Image/index.js +0 -128
  91. package/components/LanguagePopover/index.js +0 -93
  92. package/components/Loadable/index.js +0 -13
  93. package/components/ModalDialog/index.js +0 -180
  94. package/components/ObjectLogs/index.js +0 -284
  95. package/components/Page/index.js +0 -36
  96. package/components/PaperForm/index.js +0 -110
  97. package/components/Period/index.js +0 -230
  98. package/components/PropertyValue/index.js +0 -142
  99. package/components/ScrollBar/index.js +0 -52
  100. package/components/ScrollToTop/index.js +0 -10
  101. package/components/animate/MotionContainer/index.js +0 -31
  102. package/components/animate/MotionLazyContainer/index.js +0 -13
  103. package/components/animate/features.js +0 -2
  104. package/components/animate/variants/container.js +0 -20
  105. package/components/animate/variants/fade.js +0 -61
  106. package/components/animate/variants/transition.js +0 -16
  107. package/components/formatters/BooleanFormatter/index.js +0 -52
  108. package/components/formatters/DateFormatter/index.js +0 -66
  109. package/components/formatters/index.js +0 -112
  110. package/components/hook-form/FormProvider/index.js +0 -61
  111. package/components/hook-form/RHFAutocomplete/index.js +0 -144
  112. package/components/hook-form/RHFAutocompleteAsync/index.js +0 -191
  113. package/components/hook-form/RHFCheckbox/index.js +0 -65
  114. package/components/hook-form/RHFDateTime/index.js +0 -79
  115. package/components/hook-form/RHFMultiCheckbox/index.js +0 -32
  116. package/components/hook-form/RHFPeriod/index.js +0 -47
  117. package/components/hook-form/RHFRadioGroup/index.js +0 -41
  118. package/components/hook-form/RHFSelect/index.js +0 -34
  119. package/components/hook-form/RHFTextField/index.js +0 -87
  120. package/components/hook-form/RHFUpload/index.js +0 -255
  121. package/components/mui_extended/Accordion/index.js +0 -105
  122. package/components/mui_extended/Avatar/index.js +0 -33
  123. package/components/mui_extended/BoxIcon/index.js +0 -20
  124. package/components/mui_extended/Breadcrumbs/index.js +0 -92
  125. package/components/mui_extended/Button/index.js +0 -131
  126. package/components/mui_extended/IconButton/index.js +0 -108
  127. package/components/mui_extended/LinkWithRoute/index.js +0 -30
  128. package/components/mui_extended/MenuPopover/index.js +0 -135
  129. package/components/mui_extended/Pager/index.js +0 -137
  130. package/components/mui_extended/Tab/index.js +0 -30
  131. package/components/mui_extended/Typography/index.js +0 -21
  132. package/contexts/ModalContext/index.js +0 -165
  133. package/hooks/useFormAddEdit/index.js +0 -42
  134. package/hooks/useModal/index.js +0 -4
  135. package/lodash.js +0 -62
  136. package/node_modules.js +0 -54
  137. package/react-data-grid.js +0 -2652
  138. package/react-draggable.js +0 -960
  139. package/react-json-view.js +0 -2764
  140. package/react-lazy-load-image-component.js +0 -792
  141. package/react-resizable.js +0 -541
  142. package/react-splitter-layout.js +0 -165
  143. package/utils/index.js +0 -572
@@ -1,859 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { styled } from "@mui/material/styles";
3
- import { useEnvironment, useModuleDictionary } from "@m4l/core";
4
- import "@mui/material/Button";
5
- import "../../../mui_extended/Button/index.js";
6
- import "react-hook-form";
7
- import "react-router-dom";
8
- import { IconButton, Tooltip, MenuItem, Skeleton, Checkbox } from "@mui/material";
9
- import { useState, useMemo, forwardRef, useRef, useImperativeHandle, useEffect, useCallback } from "react";
10
- import "../../../../contexts/ModalContext/index.js";
11
- import "@mui/lab";
12
- import { I as IconButton$1 } from "../../../mui_extended/IconButton/index.js";
13
- import { u as useBase, a as useFilters, O as OriginalDataGridWrapperStyled } from "../../../DataGrid/index.js";
14
- import { P as Pager } from "../../../mui_extended/Pager/index.js";
15
- import { D as DataGrid$1 } from "../../../../react-data-grid.js";
16
- import { u as useModal } from "../../../../hooks/useModal/index.js";
17
- import { A as ActionCancel } from "../ActionCancel/index.js";
18
- import { A as ActionIntro } from "../ActionIntro/index.js";
19
- import { M as MenuPopover } from "../../../mui_extended/MenuPopover/index.js";
20
- import { I as Icon } from "../../../Icon/index.js";
21
- import { useResponsiveDesktop } from "@m4l/graphics";
22
- const WrapperStandarActions = styled("div")(({
23
- theme
24
- }) => ({
25
- paddingTop: theme.spacing(3),
26
- margin: theme.spacing(0, 1.5),
27
- display: "flex",
28
- flexDirection: "row",
29
- justifyContent: "flex-end",
30
- "& > button": {
31
- marginLeft: "10px"
32
- }
33
- }));
34
- const Actions$1 = (props) => {
35
- const {
36
- children
37
- } = props;
38
- return /* @__PURE__ */ jsx(WrapperStandarActions, {
39
- id: "WrapperStandarActions",
40
- children
41
- });
42
- };
43
- function getCommonActionsDictionary() {
44
- return ["common_actions"];
45
- }
46
- const defaultCommonActionsDictionary = {
47
- common_actions: {
48
- cancel: "Cancel",
49
- intro: "Intro",
50
- confirm_quit_title: "Confirm",
51
- confirm_quit_msg: "Are your sure exit?"
52
- }
53
- };
54
- const WrapperMenuActions = styled(IconButton)(() => ({}));
55
- const LabelMemuItem = styled("div")(({
56
- theme
57
- }) => ({
58
- height: "22px",
59
- marginLeft: theme.spacing(1.5),
60
- display: "flex",
61
- alignItems: "center"
62
- }));
63
- function MenuActions(props) {
64
- const {
65
- menuActions,
66
- objItem = {},
67
- urlIcon,
68
- toolTip = "",
69
- marginTop = -1,
70
- marginBottom,
71
- marginLeft,
72
- marginRight,
73
- width = 200,
74
- arrow = "right-top",
75
- ...other
76
- } = props;
77
- const {
78
- host_static_assets,
79
- environment_assets
80
- } = useEnvironment();
81
- const {
82
- getLabel
83
- } = useModuleDictionary();
84
- const [open, setOpen] = useState(null);
85
- const handleOpen = (event) => {
86
- setOpen(event.currentTarget);
87
- };
88
- const urlFinalIcon = useMemo(() => {
89
- if (urlIcon)
90
- return urlIcon;
91
- return `${host_static_assets}/${environment_assets}/frontend/commons/assets/icons/more_vertical.svg`;
92
- }, [urlIcon, host_static_assets, environment_assets]);
93
- const handleClose = () => {
94
- setOpen(null);
95
- };
96
- const handleClick = (menuAction) => {
97
- setOpen(null);
98
- menuAction.onClick();
99
- };
100
- const finalActions = useMemo(() => {
101
- let ret;
102
- if (typeof menuActions !== "function") {
103
- ret = menuActions;
104
- } else {
105
- ret = menuActions(objItem);
106
- }
107
- return ret;
108
- }, [menuActions, objItem]);
109
- return /* @__PURE__ */ jsxs(Fragment, {
110
- children: [/* @__PURE__ */ jsx(Tooltip, {
111
- title: toolTip,
112
- children: /* @__PURE__ */ jsx(WrapperMenuActions, {
113
- id: "WrapperMenuActions",
114
- size: "small",
115
- onClick: handleOpen,
116
- children: /* @__PURE__ */ jsx(Icon, {
117
- src: urlFinalIcon
118
- })
119
- })
120
- }), /* @__PURE__ */ jsx(MenuPopover, {
121
- id: "MenuPopover",
122
- open: Boolean(open),
123
- anchorEl: open,
124
- onClose: handleClose,
125
- arrow,
126
- sx: {
127
- marginTop,
128
- marginBottom,
129
- marginLeft,
130
- marginRight,
131
- width,
132
- "& .MuiMenuItem-root": {
133
- px: 1,
134
- typography: "body2",
135
- borderRadius: 0.75
136
- }
137
- },
138
- ...other,
139
- children: open && finalActions.map((menuAction, index) => /* @__PURE__ */ jsxs(MenuItem, {
140
- dense: true,
141
- onClick: () => handleClick(menuAction),
142
- sx: {
143
- color: menuAction.color ?? "text.main"
144
- },
145
- disabled: menuAction.disabled,
146
- children: [/* @__PURE__ */ jsx(Icon, {
147
- src: menuAction.urlIcon
148
- }), /* @__PURE__ */ jsx(LabelMemuItem, {
149
- children: getLabel(menuAction.dictionaryField)
150
- })]
151
- }, `menu_action_${index}`))
152
- })]
153
- });
154
- }
155
- const WrapperPagerActions = styled("div")(({ theme }) => ({
156
- width: "100%",
157
- justifyContent: "center",
158
- display: "flex",
159
- marginLeft: 0,
160
- [theme.breakpoints.up("sm")]: {
161
- display: "flex",
162
- alignItems: "center",
163
- marginLeft: theme.spacing(3)
164
- }
165
- }));
166
- function PagerActions(props) {
167
- const {
168
- count,
169
- page,
170
- rowsPerPage,
171
- onPageChange
172
- } = props;
173
- const {
174
- host_static_assets,
175
- environment_assets
176
- } = useEnvironment();
177
- const handleFirstPageButtonClick = (event) => {
178
- onPageChange(event, 0);
179
- };
180
- const handleBackButtonClick = (event) => {
181
- onPageChange(event, page - 1);
182
- };
183
- const handleNextButtonClick = (event) => {
184
- onPageChange(event, page + 1);
185
- };
186
- const handleLastPageButtonClick = (event) => {
187
- onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
188
- };
189
- return /* @__PURE__ */ jsxs(WrapperPagerActions, {
190
- id: "WrapperPagerActions",
191
- children: [/* @__PURE__ */ jsx(IconButton$1, {
192
- id: "test_bruce",
193
- dictionaryTooltip: "pager.first",
194
- onClick: handleFirstPageButtonClick,
195
- disabled: page === 0,
196
- "aria-label": "first page",
197
- src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/first.svg`
198
- }), /* @__PURE__ */ jsx(IconButton$1, {
199
- dictionaryTooltip: "pager.previous",
200
- onClick: handleBackButtonClick,
201
- disabled: page === 0,
202
- "aria-label": "first page",
203
- src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/previous.svg`
204
- }), /* @__PURE__ */ jsx(IconButton$1, {
205
- dictionaryTooltip: "pager.next",
206
- onClick: handleNextButtonClick,
207
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
208
- "aria-label": "next page",
209
- src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/next.svg`
210
- }), /* @__PURE__ */ jsx(IconButton$1, {
211
- dictionaryTooltip: "pager.last",
212
- onClick: handleLastPageButtonClick,
213
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
214
- "aria-label": "last page",
215
- src: `${host_static_assets}/${environment_assets}/frontend/components/pager/assets/icons/last.svg`
216
- })]
217
- });
218
- }
219
- const ACTIONS_COLUMN_KEY = "actions-row";
220
- function ActionsFormatter(props) {
221
- const {
222
- rowActionsGetter
223
- } = useBase();
224
- if (rowActionsGetter === void 0) {
225
- return /* @__PURE__ */ jsx(Fragment, {});
226
- }
227
- return /* @__PURE__ */ jsx(MenuActions, {
228
- arrow: "top-left",
229
- objItem: props.row,
230
- menuActions: rowActionsGetter,
231
- marginTop: 1,
232
- marginLeft: "-11px",
233
- anchorOrigin: {
234
- vertical: "bottom",
235
- horizontal: "left"
236
- },
237
- transformOrigin: {
238
- vertical: "top",
239
- horizontal: "left"
240
- }
241
- });
242
- }
243
- const ActionsColumn = {
244
- key: ACTIONS_COLUMN_KEY,
245
- name: "Actions",
246
- width: 60,
247
- withFilter: false,
248
- resizable: true,
249
- sortable: false,
250
- frozen: true,
251
- type: "custom",
252
- formatter: ActionsFormatter
253
- };
254
- const SKTWrapperFilter = styled("div")(({
255
- theme
256
- }) => ({
257
- display: "flex",
258
- justifyContent: "center",
259
- alignItems: "center",
260
- minWidth: theme.spacing(3.75),
261
- height: theme.spacing(3.75)
262
- }));
263
- function Filter() {
264
- const {
265
- isSkeleton
266
- } = useBase();
267
- const {
268
- activeFilters,
269
- setActiveFilters
270
- } = useFilters();
271
- const {
272
- host_static_assets,
273
- environment_assets
274
- } = useEnvironment();
275
- const toggleIcon = () => {
276
- setActiveFilters(!activeFilters);
277
- };
278
- if (isSkeleton) {
279
- return /* @__PURE__ */ jsx(SKTWrapperFilter, {
280
- children: /* @__PURE__ */ jsx(Skeleton, {
281
- variant: "circular",
282
- width: 20,
283
- height: 20
284
- })
285
- });
286
- }
287
- return /* @__PURE__ */ jsx(IconButton$1, {
288
- dictionaryTooltip: activeFilters ? "data_grid.tooltip_filter_hide" : "data_grid.tooltip_filter_show",
289
- onClick: toggleIcon,
290
- "aria-label": "filter",
291
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/filter.svg`
292
- });
293
- }
294
- const WrapperColumnsConfig = styled("div")(({ theme }) => ({
295
- color: theme.palette.text.primary,
296
- position: "relative",
297
- display: "flex",
298
- flexDirection: "column",
299
- height: "100%",
300
- width: "100%"
301
- }));
302
- styled("div")(({ theme }) => ({
303
- color: theme.palette.text.primary,
304
- fontSize: theme.typography.h4.fontSize
305
- }));
306
- const DivSelColumns = styled("div")(({ theme }) => ({
307
- ...theme.typography.subtitle2,
308
- color: theme.palette.text.primary,
309
- padding: `${theme.spacing(3)} ${theme.spacing(1)}`
310
- }));
311
- const WrapperDataGrid = styled("div")(() => ({
312
- position: "relative",
313
- display: "flex",
314
- flexDirection: "column",
315
- flexGrow: 1
316
- }));
317
- styled("div")(() => ({
318
- display: "flex",
319
- flexDirection: "row"
320
- }));
321
- const ColumnActions = styled("div")(({ theme }) => ({
322
- paddingTop: theme.spacing(3),
323
- display: "flex",
324
- flexDirection: "row"
325
- }));
326
- styled("div")(({ theme }) => ({
327
- paddingTop: theme.spacing(3),
328
- display: "flex",
329
- flexDirection: "row",
330
- justifyContent: "flex-end",
331
- "& > button": {
332
- marginLeft: "10px"
333
- }
334
- }));
335
- function FormatterColumn({
336
- row,
337
- onRowChange,
338
- column
339
- }) {
340
- const handleChange = () => {
341
- const newRow = {
342
- ...row
343
- };
344
- newRow[column.key] = !row[column.key];
345
- onRowChange(newRow);
346
- };
347
- return /* @__PURE__ */ jsx(Checkbox, {
348
- size: "small",
349
- checked: row[column.key],
350
- onChange: handleChange
351
- });
352
- }
353
- function getRowsFromColumnsConfig(columnsConfig) {
354
- return columnsConfig.filter((column) => !column.hidden).map((column) => ({
355
- key: column.key,
356
- name: column.name,
357
- visible: column.visible === void 0 ? true : column.visible,
358
- frozen: column.frozen === void 0 ? false : column.frozen,
359
- originalIndex: column.orginalIndex,
360
- originalFrozen: column.originalFrozen,
361
- originalVisible: column.originalVisible
362
- }));
363
- }
364
- const ColumnsConfig = forwardRef((props, ref) => {
365
- const refdata_grid = useRef(null);
366
- const {
367
- onCloseSettings,
368
- columnsConfig,
369
- onChangeColumnsConfig
370
- } = props;
371
- const {
372
- getLabel
373
- } = useModuleDictionary();
374
- const [isInit, setIsInit] = useState(true);
375
- const [rows, setRows] = useState(getRowsFromColumnsConfig(columnsConfig));
376
- const [selRows, setSelRows] = useState(() => /* @__PURE__ */ new Set());
377
- const divRef = useRef(null);
378
- const {
379
- host_static_assets,
380
- environment_assets
381
- } = useEnvironment();
382
- useImperativeHandle(ref, () => ({
383
- onClickIntro: handleIntro,
384
- current: divRef.current
385
- }));
386
- const columnsdata_grid = useMemo(() => [{
387
- key: "name",
388
- name: getLabel("data_grid.settings_column_name"),
389
- width: 200,
390
- resizable: true,
391
- type: "string"
392
- }, {
393
- key: "originalIndex",
394
- name: getLabel("data_grid.settings_column_position"),
395
- width: 50,
396
- type: "number",
397
- cellClass: "rdg-cell-align-center"
398
- }, {
399
- key: "visible",
400
- name: getLabel("data_grid.settings_column_visible"),
401
- width: 80,
402
- type: "boolean",
403
- formatter: FormatterColumn,
404
- cellClass: "rdg-cell-align-center"
405
- }, {
406
- key: "frozen",
407
- name: getLabel("data_grid.settings_column_frozen"),
408
- width: 80,
409
- type: "boolean",
410
- formatter: FormatterColumn,
411
- cellClass: "rdg-cell-align-center"
412
- }], [getLabel]);
413
- const checkAll = () => {
414
- setRows(rows.map((row) => ({
415
- ...row,
416
- visible: true
417
- })));
418
- };
419
- const unCheckAll = () => {
420
- setRows(rows.map((row) => ({
421
- ...row,
422
- visible: false
423
- })));
424
- };
425
- const restoreAll = () => {
426
- setRows(rows.map((row) => ({
427
- ...row,
428
- visible: row.originalVisible,
429
- frozen: row.originalFrozen,
430
- index: row.originalIndex
431
- })).sort((a, b) => a.index - b.index));
432
- };
433
- useEffect(() => {
434
- if (isInit === false) {
435
- setRows(getRowsFromColumnsConfig(columnsConfig));
436
- }
437
- setIsInit(false);
438
- }, [columnsConfig]);
439
- const rowSelectedIndex = useMemo(() => {
440
- let rowIndex = -1;
441
- if (selRows.size !== 1)
442
- return rowIndex;
443
- const iterator = selRows.entries();
444
- const entry = iterator.next().value[1];
445
- rowIndex = rows.findIndex((row) => row.key === entry);
446
- return rowIndex;
447
- }, [rows, selRows]);
448
- const handleMoveFirst = () => {
449
- if (rowSelectedIndex === -1)
450
- return -1;
451
- const newRows = [...rows];
452
- newRows.splice(rowSelectedIndex, 1);
453
- newRows.splice(0, 0, rows[rowSelectedIndex]);
454
- refdata_grid.current?.selectCell({
455
- idx: 0,
456
- rowIdx: 0
457
- });
458
- setRows(newRows);
459
- };
460
- const handleMoveLast = () => {
461
- if (rowSelectedIndex === -1)
462
- return -1;
463
- const newRows = [...rows];
464
- newRows.splice(rowSelectedIndex, 1);
465
- newRows.splice(newRows.length, 0, rows[rowSelectedIndex]);
466
- refdata_grid.current?.selectCell({
467
- idx: 0,
468
- rowIdx: newRows.length - 1
469
- });
470
- setRows(newRows);
471
- };
472
- const handleMoveUpDownd = (position) => {
473
- if (rowSelectedIndex === -1)
474
- return -1;
475
- const newRows = [...rows];
476
- const element = newRows[rowSelectedIndex];
477
- newRows.splice(rowSelectedIndex, 1);
478
- newRows.splice(rowSelectedIndex + position, 0, element);
479
- refdata_grid.current?.selectCell({
480
- idx: 0,
481
- rowIdx: rowSelectedIndex + position
482
- });
483
- setRows(newRows);
484
- };
485
- const getColumnConfigByKey = (key) => {
486
- const rowIndexFinded = rows.findIndex((row) => row.key === key);
487
- if (rowIndexFinded > -1) {
488
- return {
489
- visible: rows[rowIndexFinded].visible,
490
- frozen: rows[rowIndexFinded].frozen
491
- };
492
- }
493
- return void 0;
494
- };
495
- const getRowIndex = (column) => {
496
- const rowIndexFinded = rows.findIndex((row) => row.key === column.key);
497
- if (rowIndexFinded > -1) {
498
- return rowIndexFinded;
499
- }
500
- return columnsConfig.findIndex((columnConfig) => columnConfig.key === column.key);
501
- };
502
- const handleIntro = () => {
503
- const newColumnsConfig = columnsConfig.map((columnConfig) => {
504
- const newColumnConfig = {
505
- ...columnConfig
506
- };
507
- if (!columnConfig.hidden) {
508
- const columnConfigRow = getColumnConfigByKey(columnConfig.key);
509
- if (columnConfigRow) {
510
- newColumnConfig.visible = columnConfigRow.visible;
511
- newColumnConfig.frozen = columnConfigRow.frozen;
512
- }
513
- }
514
- return newColumnConfig;
515
- }).sort((a, b) => getRowIndex(a) - getRowIndex(b));
516
- onChangeColumnsConfig(newColumnsConfig);
517
- onCloseSettings();
518
- };
519
- const onInternalSelectedRowsChange = () => {
520
- };
521
- const onInternalRowsChange = (newRows) => {
522
- setRows(newRows);
523
- };
524
- const onRowClick = (row) => {
525
- if (selRows.has(row.key))
526
- return;
527
- const mySet = /* @__PURE__ */ new Set([row.key]);
528
- setSelRows(mySet);
529
- };
530
- return /* @__PURE__ */ jsxs(WrapperColumnsConfig, {
531
- id: "WrapperColumnsConfig",
532
- ref: divRef,
533
- children: [/* @__PURE__ */ jsx(DivSelColumns, {
534
- id: "divInfo",
535
- children: getLabel("data_grid.settings_sel_columns")
536
- }), /* @__PURE__ */ jsx(WrapperDataGrid, {
537
- id: "WrapperDataGrid",
538
- children: /* @__PURE__ */ jsx(OriginalDataGridWrapperStyled, {
539
- id: "Originaldata_gridWrapperStyled",
540
- children: /* @__PURE__ */ jsx(DataGrid$1, {
541
- className: "fill-data_grid rdg-light",
542
- ref: refdata_grid,
543
- columns: columnsdata_grid,
544
- rows,
545
- onRowsChange: onInternalRowsChange,
546
- selectedRows: selRows,
547
- onSelectedRowsChange: onInternalSelectedRowsChange,
548
- onRowClick,
549
- rowKeyGetter: (row) => row.key,
550
- cellNavigationMode: "CHANGE_ROW",
551
- defaultColumnOptions: {
552
- resizable: true,
553
- sortable: true
554
- }
555
- })
556
- })
557
- }), /* @__PURE__ */ jsxs(ColumnActions, {
558
- children: [/* @__PURE__ */ jsx(IconButton$1, {
559
- dictionaryTooltip: "data_grid.settings_move_first",
560
- onClick: handleMoveFirst,
561
- "aria-label": "move first place",
562
- disabled: rowSelectedIndex < 1,
563
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_first_place.svg`
564
- }), /* @__PURE__ */ jsx(IconButton$1, {
565
- dictionaryTooltip: "data_grid.settings_move_up",
566
- onClick: () => handleMoveUpDownd(-1),
567
- "aria-label": "move up place",
568
- disabled: rowSelectedIndex < 1,
569
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_up_place.svg`
570
- }), /* @__PURE__ */ jsx(IconButton$1, {
571
- dictionaryTooltip: "data_grid.settings_move_last",
572
- onClick: handleMoveLast,
573
- "aria-label": "move last place",
574
- disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
575
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_last_place.svg`
576
- }), /* @__PURE__ */ jsx(IconButton$1, {
577
- dictionaryTooltip: "data_grid.settings_move_down",
578
- onClick: () => handleMoveUpDownd(1),
579
- "aria-label": "move down place",
580
- disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
581
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_down_place.svg`
582
- }), /* @__PURE__ */ jsx(IconButton$1, {
583
- dictionaryTooltip: "data_grid.settings_visible_all",
584
- onClick: checkAll,
585
- "aria-label": "check visible all",
586
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/check_all.svg`
587
- }), /* @__PURE__ */ jsx(IconButton$1, {
588
- dictionaryTooltip: "data_grid.settings_no_visible_all",
589
- onClick: unCheckAll,
590
- "aria-label": "un check all",
591
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/uncheck_all.svg`
592
- }), /* @__PURE__ */ jsx(IconButton$1, {
593
- dictionaryTooltip: "data_grid.settings_restore",
594
- onClick: restoreAll,
595
- "aria-label": "Restore columns",
596
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/restore_columns.svg`
597
- })]
598
- })]
599
- });
600
- });
601
- ColumnsConfig.displayName = "ColumnsConfig";
602
- const SKTWrapperColumnsSettings = styled("div")(({ theme }) => ({
603
- display: "flex",
604
- justifyContent: "center",
605
- alignItems: "center",
606
- minWidth: theme.spacing(3.75),
607
- height: theme.spacing(3.75)
608
- }));
609
- function Settings() {
610
- const {
611
- openModal,
612
- closeModal
613
- } = useModal();
614
- const {
615
- columnsConfig,
616
- onChangeColumnsConfig,
617
- isSkeleton
618
- } = useBase();
619
- const {
620
- getLabel
621
- } = useModuleDictionary();
622
- const {
623
- host_static_assets,
624
- environment_assets
625
- } = useEnvironment();
626
- const ref = useRef(null);
627
- const onCloseSettings = useCallback(() => {
628
- closeModal();
629
- }, [closeModal]);
630
- const onClickIntro = useCallback(() => {
631
- if (ref.current?.onClickIntro) {
632
- ref.current?.onClickIntro();
633
- }
634
- }, []);
635
- const onClickSettings = useCallback(() => {
636
- openModal({
637
- onQueryClose: () => closeModal(),
638
- title: getLabel("data_grid.settings_title"),
639
- initialWidth: 500,
640
- initialHeigth: 680,
641
- contentComponent: /* @__PURE__ */ jsx(ColumnsConfig, {
642
- ref,
643
- columnsConfig,
644
- onChangeColumnsConfig,
645
- onCloseSettings
646
- }),
647
- actions: /* @__PURE__ */ jsxs(Fragment, {
648
- children: [/* @__PURE__ */ jsx(ActionCancel, {
649
- onClick: closeModal
650
- }), /* @__PURE__ */ jsx(ActionIntro, {
651
- onClick: onClickIntro
652
- })]
653
- })
654
- });
655
- }, [closeModal, columnsConfig, getLabel, onChangeColumnsConfig, onCloseSettings, openModal, onClickIntro]);
656
- if (isSkeleton) {
657
- return /* @__PURE__ */ jsx(SKTWrapperColumnsSettings, {
658
- children: /* @__PURE__ */ jsx(Skeleton, {
659
- variant: "circular",
660
- width: 20,
661
- height: 20
662
- })
663
- });
664
- }
665
- return /* @__PURE__ */ jsx(IconButton$1, {
666
- dictionaryTooltip: "data_grid.tooltip_settings",
667
- onClick: onClickSettings,
668
- "aria-label": "settings",
669
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/configuration.svg`
670
- });
671
- }
672
- const Container = styled("div")(() => ({
673
- display: "flex",
674
- alignItems: "center"
675
- }));
676
- const RowsLabel = styled("span")(() => ({}));
677
- const InsetLabel = styled("span")(({ theme }) => ({
678
- marginLeft: theme.spacing(2),
679
- paddingTop: "2px",
680
- paddingBottom: "2px",
681
- paddingLeft: "4px",
682
- paddingRight: "4px",
683
- border: `1px solid ${theme.palette.divider}`
684
- }));
685
- function RowsCount() {
686
- const {
687
- rowsCount,
688
- isSkeleton
689
- } = useBase();
690
- const {
691
- getLabel
692
- } = useModuleDictionary();
693
- if (isSkeleton) {
694
- return /* @__PURE__ */ jsxs(Container, {
695
- children: [/* @__PURE__ */ jsx(RowsLabel, {
696
- children: /* @__PURE__ */ jsx(Skeleton, {
697
- variant: "text",
698
- width: "40px",
699
- height: "16px"
700
- })
701
- }), /* @__PURE__ */ jsx(InsetLabel, {
702
- children: /* @__PURE__ */ jsx(Skeleton, {
703
- variant: "text",
704
- width: "20px",
705
- height: "16px"
706
- })
707
- })]
708
- });
709
- }
710
- return /* @__PURE__ */ jsxs(Container, {
711
- className: "rows-count",
712
- id: "RowsCount",
713
- children: [/* @__PURE__ */ jsx(RowsLabel, {
714
- children: getLabel("data_grid.rows")
715
- }), /* @__PURE__ */ jsx(InsetLabel, {
716
- children: rowsCount
717
- })]
718
- });
719
- }
720
- const WrapperDensity = styled("div")(({ theme }) => ({
721
- marginLeft: 0,
722
- [theme.breakpoints.up("sm")]: {
723
- marginLeft: theme.spacing(3)
724
- }
725
- }));
726
- const SKTWrapperDensity = styled("div")(({ theme }) => ({
727
- display: "flex",
728
- justifyContent: "center",
729
- alignItems: "center",
730
- minWidth: theme.spacing(3.75),
731
- height: theme.spacing(3.75)
732
- }));
733
- function Density() {
734
- const {
735
- host_static_assets,
736
- environment_assets
737
- } = useEnvironment();
738
- const {
739
- rowHeights,
740
- currentRowHeightVariant,
741
- setRowHeightVariant,
742
- isSkeleton
743
- } = useBase();
744
- const {
745
- getLabel
746
- } = useModuleDictionary();
747
- const menuActions = useMemo(() => {
748
- if (typeof rowHeights === "number") {
749
- return [];
750
- }
751
- return [{
752
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/compact.svg`,
753
- onClick: () => setRowHeightVariant("compact"),
754
- disabled: currentRowHeightVariant === "compact",
755
- dictionaryField: "data_grid.density_compact"
756
- }, {
757
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/standard.svg`,
758
- onClick: () => setRowHeightVariant("standard"),
759
- disabled: currentRowHeightVariant === "standard",
760
- dictionaryField: "data_grid.density_standard"
761
- }, {
762
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/confortable.svg`,
763
- onClick: () => setRowHeightVariant("confortable"),
764
- disabled: currentRowHeightVariant === "confortable",
765
- dictionaryField: "data_grid.density_confortable"
766
- }];
767
- }, [rowHeights, currentRowHeightVariant, setRowHeightVariant, host_static_assets, environment_assets]);
768
- const currenViewIcon = useMemo(() => {
769
- if (currentRowHeightVariant === "compact") {
770
- return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/compact.svg`;
771
- }
772
- if (currentRowHeightVariant === "standard") {
773
- return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/standard.svg`;
774
- }
775
- return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/confortable.svg`;
776
- }, [currentRowHeightVariant, host_static_assets, environment_assets]);
777
- if (menuActions.length === 0) {
778
- return /* @__PURE__ */ jsx(Fragment, {});
779
- }
780
- if (isSkeleton) {
781
- return /* @__PURE__ */ jsx(SKTWrapperDensity, {
782
- children: /* @__PURE__ */ jsx(Skeleton, {
783
- variant: "circular",
784
- width: "20px",
785
- height: "20px"
786
- })
787
- });
788
- }
789
- return /* @__PURE__ */ jsx(WrapperDensity, {
790
- id: "WrapperDensity",
791
- children: /* @__PURE__ */ jsx(MenuActions, {
792
- arrow: "right-top",
793
- anchorOrigin: {
794
- vertical: "top",
795
- horizontal: "left"
796
- },
797
- transformOrigin: {
798
- vertical: "top",
799
- horizontal: "right"
800
- },
801
- menuActions,
802
- urlIcon: currenViewIcon,
803
- toolTip: getLabel("data_grid.tooltip_density")
804
- })
805
- });
806
- }
807
- const WrapperActions = styled("div")(({ theme }) => ({
808
- ...theme.typography.caption,
809
- position: "absolute",
810
- left: "0px",
811
- right: "0px",
812
- top: "0px",
813
- height: theme.spacing(5.5),
814
- padding: 0,
815
- display: "flex",
816
- flexDirection: "row",
817
- alignItems: "center",
818
- justifyContent: "flex-end",
819
- [theme.breakpoints.up("sm")]: {
820
- padding: theme.spacing(0, 1.5)
821
- },
822
- "&.with-no-pager .rows-count": {
823
- flexGrow: 1
824
- },
825
- "& .MuiTablePagination-root": {
826
- flexGrow: 1,
827
- display: "flex",
828
- justifyContent: "center",
829
- overflow: "hidden"
830
- }
831
- }));
832
- function Actions(props) {
833
- const isDesktop = useResponsiveDesktop();
834
- const {
835
- rowHeights,
836
- isSkeleton
837
- } = useBase();
838
- const {
839
- withRowsCount = true,
840
- withPager = true,
841
- pagerOptions,
842
- withSettings = true,
843
- settingsProps,
844
- withLocalFilters
845
- } = props;
846
- return /* @__PURE__ */ jsxs(WrapperActions, {
847
- id: "WrapperActions",
848
- className: withPager && pagerOptions ? "with-pager" : "with-no-pager",
849
- children: [withRowsCount && isDesktop && /* @__PURE__ */ jsx(RowsCount, {}), withPager && pagerOptions && /* @__PURE__ */ jsx(Pager, {
850
- ...pagerOptions,
851
- totalRecords: pagerOptions.totalRecords,
852
- isSkeleton,
853
- isDesktop
854
- }), typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}), withLocalFilters && /* @__PURE__ */ jsx(Filter, {}), withSettings && /* @__PURE__ */ jsx(Settings, {
855
- ...settingsProps
856
- })]
857
- });
858
- }
859
- export { ActionsColumn as A, LabelMemuItem as L, MenuActions as M, PagerActions as P, Actions as a, Actions$1 as b, defaultCommonActionsDictionary as d, getCommonActionsDictionary as g };