@m4l/components 0.0.46 → 0.0.49

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