@m4l/components 9.79.1 → 9.80.0

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 (130) hide show
  1. package/components/Pager/subcomponents/CustomTablePagination/CustomTablePagination.d.ts.map +1 -1
  2. package/components/Pager/subcomponents/CustomTablePagination/CustomTablePagination.js +53 -61
  3. package/components/Pager/subcomponents/RowsPerPageSelect/RowsPerPageSelect.d.ts +7 -0
  4. package/components/Pager/subcomponents/RowsPerPageSelect/RowsPerPageSelect.d.ts.map +1 -0
  5. package/components/Pager/subcomponents/RowsPerPageSelect/RowsPerPageSelect.js +28 -0
  6. package/components/Pager/subcomponents/RowsPerPageSelect/types.d.ts +20 -0
  7. package/components/Pager/subcomponents/RowsPerPageSelect/types.d.ts.map +1 -0
  8. package/components/datagrids/Datagrid.styles.d.ts.map +1 -1
  9. package/components/datagrids/Datagrid.styles.js +329 -298
  10. package/components/datagrids/components/BaseDataGrid/BaseDataGrid.d.ts.map +1 -1
  11. package/components/datagrids/components/BaseDataGrid/BaseDataGrid.js +101 -95
  12. package/components/datagrids/constants.d.ts +7 -0
  13. package/components/datagrids/constants.d.ts.map +1 -1
  14. package/components/datagrids/constants.js +10 -6
  15. package/components/datagrids/contexts/DataGridContext/DataGridContext.d.ts.map +1 -1
  16. package/components/datagrids/contexts/DataGridContext/DataGridContext.js +112 -102
  17. package/components/datagrids/contexts/DataGridContext/types.d.ts +18 -3
  18. package/components/datagrids/contexts/DataGridContext/types.d.ts.map +1 -1
  19. package/components/datagrids/dictionary.d.ts +4 -0
  20. package/components/datagrids/dictionary.d.ts.map +1 -1
  21. package/components/datagrids/dictionary.js +12 -6
  22. package/components/datagrids/helpers/index.d.ts +5 -0
  23. package/components/datagrids/helpers/index.d.ts.map +1 -1
  24. package/components/datagrids/helpers/normalizeHeaderClickDeferMs.d.ts +5 -0
  25. package/components/datagrids/helpers/normalizeHeaderClickDeferMs.d.ts.map +1 -0
  26. package/components/datagrids/helpers/normalizeHeaderClickDeferMs.js +7 -0
  27. package/components/datagrids/helpers/shared/attachScrollElement/attachScrollElement.d.ts +9 -0
  28. package/components/datagrids/helpers/shared/attachScrollElement/attachScrollElement.d.ts.map +1 -0
  29. package/components/datagrids/helpers/shared/attachScrollElement/attachScrollElement.js +14 -0
  30. package/components/datagrids/helpers/shared/attachScrollElement/index.d.ts +3 -0
  31. package/components/datagrids/helpers/shared/attachScrollElement/index.d.ts.map +1 -0
  32. package/components/datagrids/helpers/shared/attachScrollElement/types.d.ts +14 -0
  33. package/components/datagrids/helpers/shared/attachScrollElement/types.d.ts.map +1 -0
  34. package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/buildCursorExportPaginationInfo.d.ts +4 -0
  35. package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/buildCursorExportPaginationInfo.d.ts.map +1 -0
  36. package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/buildCursorExportPaginationInfo.js +10 -0
  37. package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/index.d.ts +3 -0
  38. package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/index.d.ts.map +1 -0
  39. package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/types.d.ts +7 -0
  40. package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/types.d.ts.map +1 -0
  41. package/components/datagrids/helpers/shared/getInfinitePageSize/getInfinitePageSize.d.ts +4 -0
  42. package/components/datagrids/helpers/shared/getInfinitePageSize/getInfinitePageSize.d.ts.map +1 -0
  43. package/components/datagrids/helpers/shared/getInfinitePageSize/getInfinitePageSize.js +12 -0
  44. package/components/datagrids/helpers/shared/getInfinitePageSize/index.d.ts +3 -0
  45. package/components/datagrids/helpers/shared/getInfinitePageSize/index.d.ts.map +1 -0
  46. package/components/datagrids/helpers/shared/getInfinitePageSize/types.d.ts +8 -0
  47. package/components/datagrids/helpers/shared/getInfinitePageSize/types.d.ts.map +1 -0
  48. package/components/datagrids/helpers/shared/isNearBottom/index.d.ts +2 -0
  49. package/components/datagrids/helpers/shared/isNearBottom/index.d.ts.map +1 -0
  50. package/components/datagrids/helpers/shared/isNearBottom/isNearBottom.d.ts +15 -0
  51. package/components/datagrids/helpers/shared/isNearBottom/isNearBottom.d.ts.map +1 -0
  52. package/components/datagrids/helpers/shared/isNearBottom/isNearBottom.js +6 -0
  53. package/components/datagrids/hooks/index.d.ts +2 -0
  54. package/components/datagrids/hooks/index.d.ts.map +1 -1
  55. package/components/datagrids/hooks/shared/useInfiniteScroll/index.d.ts +3 -0
  56. package/components/datagrids/hooks/shared/useInfiniteScroll/index.d.ts.map +1 -0
  57. package/components/datagrids/hooks/shared/useInfiniteScroll/types.d.ts +26 -0
  58. package/components/datagrids/hooks/shared/useInfiniteScroll/types.d.ts.map +1 -0
  59. package/components/datagrids/hooks/shared/useInfiniteScroll/useInfiniteScroll.d.ts +13 -0
  60. package/components/datagrids/hooks/shared/useInfiniteScroll/useInfiniteScroll.d.ts.map +1 -0
  61. package/components/datagrids/hooks/shared/useInfiniteScroll/useInfiniteScroll.js +69 -0
  62. package/components/datagrids/hooks/useInfiniteScrollGate/index.d.ts +3 -0
  63. package/components/datagrids/hooks/useInfiniteScrollGate/index.d.ts.map +1 -0
  64. package/components/datagrids/hooks/useInfiniteScrollGate/types.d.ts +32 -0
  65. package/components/datagrids/hooks/useInfiniteScrollGate/types.d.ts.map +1 -0
  66. package/components/datagrids/hooks/useInfiniteScrollGate/useInfiniteScrollGate.d.ts +17 -0
  67. package/components/datagrids/hooks/useInfiniteScrollGate/useInfiniteScrollGate.d.ts.map +1 -0
  68. package/components/datagrids/hooks/useInfiniteScrollGate/useInfiniteScrollGate.js +20 -0
  69. package/components/datagrids/hooks/useRemeasureOnReady/useRemeasureOnReady.d.ts +4 -1
  70. package/components/datagrids/hooks/useRemeasureOnReady/useRemeasureOnReady.d.ts.map +1 -1
  71. package/components/datagrids/hooks/useRemeasureOnReady/useRemeasureOnReady.js +33 -25
  72. package/components/datagrids/index.d.ts +5 -2
  73. package/components/datagrids/index.d.ts.map +1 -1
  74. package/components/datagrids/slots/DataGridEnum.d.ts +4 -0
  75. package/components/datagrids/slots/DataGridEnum.d.ts.map +1 -1
  76. package/components/datagrids/slots/DataGridEnum.js +5 -4
  77. package/components/datagrids/slots/DataGridSlot.d.ts +11 -0
  78. package/components/datagrids/slots/DataGridSlot.d.ts.map +1 -1
  79. package/components/datagrids/slots/DataGridSlot.js +121 -113
  80. package/components/datagrids/subcomponents/InfiniteScrollStatus/InfiniteScrollStatus.d.ts +8 -0
  81. package/components/datagrids/subcomponents/InfiniteScrollStatus/InfiniteScrollStatus.d.ts.map +1 -0
  82. package/components/datagrids/subcomponents/InfiniteScrollStatus/InfiniteScrollStatus.js +46 -0
  83. package/components/datagrids/subcomponents/InfiniteScrollStatus/index.d.ts +3 -0
  84. package/components/datagrids/subcomponents/InfiniteScrollStatus/index.d.ts.map +1 -0
  85. package/components/datagrids/subcomponents/InfiniteScrollStatus/types.d.ts +11 -0
  86. package/components/datagrids/subcomponents/InfiniteScrollStatus/types.d.ts.map +1 -0
  87. package/components/datagrids/subcomponents/index.d.ts +1 -0
  88. package/components/datagrids/subcomponents/index.d.ts.map +1 -1
  89. package/components/datagrids/tests/helpers/InfiniteScrollStory.d.ts +9 -0
  90. package/components/datagrids/tests/helpers/InfiniteScrollStory.d.ts.map +1 -0
  91. package/components/datagrids/tests/helpers/infiniteScrollStoryHelpers.d.ts +22 -0
  92. package/components/datagrids/tests/helpers/infiniteScrollStoryHelpers.d.ts.map +1 -0
  93. package/components/datagrids/types.d.ts +69 -4
  94. package/components/datagrids/types.d.ts.map +1 -1
  95. package/components/datagrids/views/CardsView/CardsView.d.ts.map +1 -1
  96. package/components/datagrids/views/CardsView/CardsView.js +90 -79
  97. package/components/datagrids/views/CardsView/helpers/observeContainerWidth/index.d.ts +3 -0
  98. package/components/datagrids/views/CardsView/helpers/observeContainerWidth/index.d.ts.map +1 -0
  99. package/components/datagrids/views/CardsView/helpers/observeContainerWidth/observeContainerWidth.d.ts +9 -0
  100. package/components/datagrids/views/CardsView/helpers/observeContainerWidth/observeContainerWidth.d.ts.map +1 -0
  101. package/components/datagrids/views/CardsView/helpers/observeContainerWidth/observeContainerWidth.js +13 -0
  102. package/components/datagrids/views/CardsView/helpers/observeContainerWidth/types.d.ts +14 -0
  103. package/components/datagrids/views/CardsView/helpers/observeContainerWidth/types.d.ts.map +1 -0
  104. package/components/datagrids/views/CardsView/hooks/useCardsPerRow/types.d.ts +15 -0
  105. package/components/datagrids/views/CardsView/hooks/useCardsPerRow/types.d.ts.map +1 -0
  106. package/components/datagrids/views/CardsView/hooks/useCardsPerRow/useCardsPerRow.d.ts.map +1 -1
  107. package/components/datagrids/views/CardsView/hooks/useCardsPerRow/useCardsPerRow.js +18 -14
  108. package/components/datagrids/views/ListView/ListView.d.ts.map +1 -1
  109. package/components/datagrids/views/ListView/ListView.js +65 -54
  110. package/components/datagrids/views/TableView/TableView.d.ts.map +1 -1
  111. package/components/datagrids/views/TableView/TableView.js +119 -111
  112. package/components/datagrids/views/TableView/helpers/getDragHeaderRenderer/getDragHeaderRenderer.d.ts +1 -0
  113. package/components/datagrids/views/TableView/helpers/getDragHeaderRenderer/getDragHeaderRenderer.d.ts.map +1 -1
  114. package/components/datagrids/views/TableView/helpers/getDragHeaderRenderer/getDragHeaderRenderer.js +9 -8
  115. package/components/datagrids/views/TableView/hooks/useColumnSortRules/index.d.ts +2 -0
  116. package/components/datagrids/views/TableView/hooks/useColumnSortRules/index.d.ts.map +1 -0
  117. package/components/datagrids/views/TableView/hooks/useColumnSortRules/useColumnSortRules.d.ts +25 -0
  118. package/components/datagrids/views/TableView/hooks/useColumnSortRules/useColumnSortRules.d.ts.map +1 -0
  119. package/components/datagrids/views/TableView/hooks/useColumnSortRules/useColumnSortRules.js +97 -0
  120. package/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.d.ts.map +1 -1
  121. package/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.js +117 -138
  122. package/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.d.ts.map +1 -1
  123. package/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.js +57 -54
  124. package/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/DraggableHeaderRenderer.d.ts.map +1 -1
  125. package/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/DraggableHeaderRenderer.js +108 -82
  126. package/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/types.d.ts +2 -0
  127. package/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/types.d.ts.map +1 -1
  128. package/components/extended/mui/IconButton/IconButton.styles.d.ts +1 -1
  129. package/index.js +737 -732
  130. package/package.json +6 -6
@@ -0,0 +1,97 @@
1
+ import { useCallback as c, useMemo as S } from "react";
2
+ import { useDataGrid as h } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
3
+ function G({
4
+ columnKey: t,
5
+ column: n,
6
+ defaultSortable: x,
7
+ handleSortFromPopover: p
8
+ }) {
9
+ const { setSortColumns: b, sortColumns: f, externalSortSettings: r } = h(), o = c(
10
+ (e) => {
11
+ p ? p(e) : b(e);
12
+ },
13
+ [p, b]
14
+ ), s = S(
15
+ () => t && n && n.type !== "custom" ? { columnKey: t, column: n } : null,
16
+ [t, n]
17
+ ), v = s !== null, d = c(
18
+ (e) => {
19
+ s && r?.onChange({
20
+ action: "add",
21
+ columnKey: s.columnKey,
22
+ direction: e,
23
+ label: s.column.name
24
+ });
25
+ },
26
+ [s, r]
27
+ ), A = S(() => t ? typeof n?.sortable == "boolean" ? n.sortable : x : !1, [t, n, x]), D = S(() => !t || !r ? !1 : r.sortsColumns.some(
28
+ (e) => typeof e == "string" ? e === t : e.name === t
29
+ ), [t, r]), i = S(() => {
30
+ if (r)
31
+ return r.sortsApplied.find(
32
+ (T) => T.columnKey === t
33
+ )?.direction ?? "none";
34
+ const u = f.find(
35
+ (E) => E.columnKey === t
36
+ )?.direction.toLowerCase();
37
+ return u === "asc" || u === "desc" ? u : "none";
38
+ }, [t, r, f]), L = r?.sortsApplied.find(
39
+ (e) => e.columnKey === t
40
+ ), a = r ? L?.removable === !0 : i !== "none", l = !!(t && A && (!r || D && v)), g = c(() => {
41
+ t && o(
42
+ f.filter((e) => e.columnKey !== t)
43
+ );
44
+ }, [t, o, f]), C = c(() => {
45
+ if (r) {
46
+ a && t && r.onChange({ action: "remove", columnKey: t });
47
+ return;
48
+ }
49
+ g();
50
+ }, [g, t, r, a]), R = c(() => {
51
+ if (!l || !t)
52
+ return;
53
+ if (i === "desc") {
54
+ if (a) {
55
+ C();
56
+ return;
57
+ }
58
+ d("asc");
59
+ return;
60
+ }
61
+ const e = i === "asc" ? "desc" : "asc";
62
+ if (r) {
63
+ d(e);
64
+ return;
65
+ }
66
+ o([
67
+ {
68
+ columnKey: t,
69
+ direction: e === "asc" ? "ASC" : "DESC"
70
+ }
71
+ ]);
72
+ }, [
73
+ d,
74
+ l,
75
+ t,
76
+ i,
77
+ o,
78
+ r,
79
+ a,
80
+ C
81
+ ]);
82
+ return {
83
+ canSort: A,
84
+ canSortExternally: D,
85
+ canToggleSort: l,
86
+ direction: i,
87
+ isRemovable: a,
88
+ toggleSort: R,
89
+ clearLocalSort: g,
90
+ removeSort: C,
91
+ addExternalSort: d,
92
+ executeSortChange: o
93
+ };
94
+ }
95
+ export {
96
+ G as useColumnSortRules
97
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"useHeaderMenuActions.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAU9E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EACpD,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,YAAY,EAAE,SAAS,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAClD,eAAe,EAAE,OAAO,EACxB,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,IAAI,GAC7D,UAAU,EAAE,CAsed"}
1
+ {"version":3,"file":"useHeaderMenuActions.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAU9E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EACpD,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,YAAY,EAAE,SAAS,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAClD,eAAe,EAAE,OAAO,EACxB,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,IAAI,GAC7D,UAAU,EAAE,CAuYd"}
@@ -1,242 +1,221 @@
1
- import { jsx as l } from "@emotion/react/jsx-runtime";
2
- import { useCallback as A, useMemo as o } from "react";
3
- import { useModuleDictionary as P } from "@m4l/core";
1
+ import { jsx as d } from "@emotion/react/jsx-runtime";
2
+ import { useMemo as u, useCallback as F } from "react";
3
+ import { useModuleDictionary as J } from "@m4l/core";
4
4
  import { ActionsFilterOutlined as Q } from "@m4l/icons";
5
- import { DICTIONARY as f } from "../../../../dictionary.js";
6
- import { pathIcons as C } from "../../../../icons.js";
7
- import { Icon as b } from "@m4l/base";
5
+ import { DICTIONARY as l } from "../../../../dictionary.js";
6
+ import { pathIcons as f } from "../../../../icons.js";
7
+ import { Icon as C } from "@m4l/base";
8
8
  import { useDataGrid as W } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
9
- function nt(t, m, N, S) {
9
+ import { useColumnSortRules as X } from "../useColumnSortRules/useColumnSortRules.js";
10
+ function it(t, g, P, Y) {
10
11
  const {
11
- columnsConfig: i,
12
- onChangeColumnsConfig: g,
13
- setSortColumns: F,
14
- sortColumns: I,
15
- externalSortSettings: s,
16
- externalFilterSettings: p
17
- } = W(), { getLabel: a } = P(), O = A(
18
- (e) => {
19
- S ? S(e) : F(e);
20
- },
21
- [S, F]
22
- ), n = o(() => m.find((e) => e.key === t), [t, m]), D = o(() => t ? typeof n?.sortable == "boolean" ? n.sortable : N : !1, [t, n, N]), M = o(() => !t || !s ? !1 : s.sortsColumns.some(
23
- (e) => typeof e == "string" ? e === t : e.name === t
24
- ), [t, s]), c = o(() => {
25
- if (!(!t || !s?.sortsApplied))
26
- return s.sortsApplied.find(
27
- (e) => e.columnKey === t
12
+ columnsConfig: s,
13
+ onChangeColumnsConfig: I,
14
+ externalSortSettings: o,
15
+ externalFilterSettings: c
16
+ } = W(), { getLabel: n } = J(), i = u(() => g.find((r) => r.key === t), [t, g]), L = u(() => {
17
+ if (!(!t || !o?.sortsApplied))
18
+ return o.sortsApplied.find(
19
+ (r) => r.columnKey === t
28
20
  );
29
- }, [t, s?.sortsApplied]), G = o(() => c?.direction === "asc", [c]), T = o(() => c?.direction === "desc", [c]), R = o(
30
- () => !!(t && I.some(
31
- (e) => e.columnKey === t && e.direction === "ASC"
32
- )),
33
- [t, I]
34
- ), _ = o(
35
- () => !!(t && I.some(
36
- (e) => e.columnKey === t && e.direction === "DESC"
37
- )),
38
- [t, I]
39
- ), v = A(() => {
21
+ }, [t, o?.sortsApplied]), U = u(() => !!L, [L]), h = F(() => {
40
22
  if (!t)
41
23
  return;
42
- const e = I.filter((r) => r.columnKey !== t);
43
- O(e);
44
- }, [t, I, O]), z = o(() => !!c, [c]), B = A(() => {
45
- if (!t)
46
- return;
47
- const e = i.map(
48
- (r) => r.key === t ? { ...r, frozen: !r.frozen } : r
24
+ const r = s.map(
25
+ (e) => e.key === t ? { ...e, frozen: !e.frozen } : e
49
26
  );
50
- g("table", e);
51
- }, [t, i, g]), V = A(() => {
27
+ I("table", r);
28
+ }, [t, s, I]), N = F(() => {
52
29
  if (!t)
53
30
  return;
54
- const e = i.map(
55
- (r) => r.key === t ? { ...r, visible: !r.visible } : r
31
+ const r = s.map(
32
+ (e) => e.key === t ? { ...e, visible: !e.visible } : e
56
33
  );
57
- g("table", e);
58
- }, [t, i, g]), x = A(
59
- (e) => {
60
- !t || !n || n?.type === "custom" || s?.onChange({
61
- action: "add",
62
- columnKey: t,
63
- direction: e,
64
- label: n.name
65
- });
66
- },
67
- [t, n, s]
68
- ), L = o(() => c?.removable, [c]), H = A(() => {
69
- if (!t || !n)
34
+ I("table", r);
35
+ }, [t, s, I]), {
36
+ canSort: A,
37
+ canSortExternally: O,
38
+ direction: m,
39
+ isRemovable: S,
40
+ clearLocalSort: G,
41
+ removeSort: T,
42
+ addExternalSort: k,
43
+ executeSortChange: R
44
+ } = X({
45
+ columnKey: t,
46
+ column: i,
47
+ defaultSortable: P,
48
+ handleSortFromPopover: Y
49
+ }), v = m === "asc", z = m === "desc", D = !o && m === "asc", M = !o && m === "desc", V = F(() => {
50
+ if (!t || !i)
70
51
  return null;
71
- p?.onChange({
52
+ c?.onChange({
72
53
  action: "add",
73
54
  columnKey: t
74
55
  });
75
- }, [t, n, p]), U = o(() => !t || !n ? !1 : n.groupable === !0, [t, n]), h = o(() => t ? i.find((r) => r.key === t)?.grouped === !0 : !1, [t, i]), Y = o(() => m.some(
76
- (e) => e.groupable === !0 || e.grouped === !0
77
- ), [m]), Z = o(() => {
78
- if (!t || !n || n.type === "custom" || !p?.filterColumns.some(
79
- (u) => u.name === t
56
+ }, [t, i, c]), _ = u(() => !t || !i ? !1 : i.groupable === !0, [t, i]), x = u(() => t ? s.find((e) => e.key === t)?.grouped === !0 : !1, [t, s]), B = u(() => g.some(
57
+ (r) => r.groupable === !0 || r.grouped === !0
58
+ ), [g]), H = u(() => {
59
+ if (!t || !i || i.type === "custom" || !c?.filterColumns.some(
60
+ (p) => p.name === t
80
61
  ))
81
62
  return !0;
82
- const r = p?.filtersApplied.some(
83
- (u) => u.columnKey === t && u.isValid
84
- ), k = p?.filterColumns.find(
85
- (u) => u.name === t
63
+ const e = c?.filtersApplied.some(
64
+ (p) => p.columnKey === t && p.isValid
65
+ ), E = c?.filterColumns.find(
66
+ (p) => p.name === t
86
67
  )?.multiple;
87
- return r && !k;
88
- }, [t, n, p]);
89
- return o(() => {
68
+ return e && !E;
69
+ }, [t, i, c]);
70
+ return u(() => {
90
71
  if (!t)
91
72
  return [];
92
- const e = [
73
+ const r = [
93
74
  {
94
75
  type: "menuItem",
95
- startIcon: /* @__PURE__ */ l(b, { src: C.sortAsc }),
96
- label: a(f.ORDER_ASC_COLUMN),
76
+ startIcon: /* @__PURE__ */ d(C, { src: f.sortAsc }),
77
+ label: n(l.ORDER_ASC_COLUMN),
97
78
  dataTestId: "sort-ascending",
98
79
  /**
99
80
  * Add an external ascending sort.
100
81
  */
101
82
  onClick: () => {
102
- s ? x("asc") : O([
83
+ o ? k("asc") : R([
103
84
  {
104
85
  columnKey: t,
105
86
  direction: "ASC"
106
87
  }
107
88
  ]);
108
89
  },
109
- disabled: !D || (s ? !M || G : R)
90
+ disabled: !A || (o ? !O || v : D)
110
91
  },
111
92
  {
112
93
  type: "menuItem",
113
- startIcon: /* @__PURE__ */ l(b, { src: C.sortDesc }),
114
- label: a(f.ORDER_DESC_COLUMN),
94
+ startIcon: /* @__PURE__ */ d(C, { src: f.sortDesc }),
95
+ label: n(l.ORDER_DESC_COLUMN),
115
96
  dataTestId: "sort-descending",
116
97
  /**
117
98
  * Add an external descending sort.
118
99
  */
119
100
  onClick: () => {
120
- s ? x("desc") : O([
101
+ o ? k("desc") : R([
121
102
  {
122
103
  columnKey: t,
123
104
  direction: "DESC"
124
105
  }
125
106
  ]);
126
107
  },
127
- disabled: !D || (s ? !M || T : _)
108
+ disabled: !A || (o ? !O || z : M)
128
109
  },
129
110
  {
130
111
  type: "menuItem",
131
- startIcon: /* @__PURE__ */ l(b, { src: C.removeSort }),
132
- label: a(f.REMOVE_ORDER_COLUMN),
112
+ startIcon: /* @__PURE__ */ d(C, { src: f.removeSort }),
113
+ label: n(l.REMOVE_ORDER_COLUMN),
133
114
  dataTestId: "sort-remove",
134
115
  /**
135
116
  * Remove the external sort.
136
117
  */
137
118
  onClick: () => {
138
119
  if (t)
139
- if (s && L) {
140
- s.onChange({
141
- action: "remove",
142
- columnKey: t
143
- });
120
+ if (o && S) {
121
+ T();
144
122
  return;
145
123
  } else
146
- v();
124
+ G();
147
125
  },
148
- disabled: s ? !z || !L : !(R || _)
126
+ disabled: o ? !U || !S : !(D || M)
149
127
  }
150
- ], r = p ? [
128
+ ], e = c ? [
151
129
  {
152
130
  type: "menuItem",
153
- startIcon: /* @__PURE__ */ l(b, { src: /* @__PURE__ */ l(Q, {}) }),
154
- label: a(f.ADD_FILTER_COLUMN),
131
+ startIcon: /* @__PURE__ */ d(C, { src: /* @__PURE__ */ d(Q, {}) }),
132
+ label: n(l.ADD_FILTER_COLUMN),
155
133
  dataTestId: "filter-add",
156
134
  onClick: () => {
157
- H();
135
+ V();
158
136
  },
159
- disabled: Z
137
+ disabled: H
160
138
  }
161
- ] : [], k = (d) => {
139
+ ] : [], E = (a) => {
162
140
  if (!t)
163
141
  return;
164
- const w = i.filter((E) => E.grouped), q = d ? w.length : 0, J = i.map(
165
- (E) => E.key === t ? { ...E, grouped: d, groupOrder: d ? q : E.groupOrder } : E
142
+ const j = s.filter((b) => b.grouped), w = a ? j.length : 0, q = s.map(
143
+ (b) => b.key === t ? { ...b, grouped: a, groupOrder: a ? w : b.groupOrder } : b
166
144
  );
167
- g("table", J);
168
- }, u = Y ? [
145
+ I("table", q);
146
+ }, p = B ? [
169
147
  {
170
148
  type: "menuItem",
171
- startIcon: /* @__PURE__ */ l(b, { src: C.group }),
172
- label: a(f.GROUP_BY_COLUMN),
149
+ startIcon: /* @__PURE__ */ d(C, { src: f.group }),
150
+ label: n(l.GROUP_BY_COLUMN),
173
151
  dataTestId: "group-add",
174
152
  onClick: () => {
175
- k(!0);
153
+ E(!0);
176
154
  },
177
- disabled: !U || h
155
+ disabled: !_ || x
178
156
  },
179
157
  {
180
158
  type: "menuItem",
181
- startIcon: /* @__PURE__ */ l(b, { src: C.removeGroup }),
182
- label: a(f.REMOVE_GROUP_COLUMN),
159
+ startIcon: /* @__PURE__ */ d(C, { src: f.removeGroup }),
160
+ label: n(l.REMOVE_GROUP_COLUMN),
183
161
  dataTestId: "group-remove",
184
162
  onClick: () => {
185
- k(!1);
163
+ E(!1);
186
164
  },
187
165
  /** Disabled only when the column is not grouped or it is a static group (`groupable=false`). */
188
- disabled: !h || !U
166
+ disabled: !x || !_
189
167
  }
190
- ] : [], j = [
168
+ ] : [], Z = [
191
169
  {
192
170
  type: "menuItem",
193
- startIcon: /* @__PURE__ */ l(
194
- b,
171
+ startIcon: /* @__PURE__ */ d(
172
+ C,
195
173
  {
196
- src: i.find((d) => d.key === t)?.frozen ? C.unfreezeColumn : C.freezeColumn
174
+ src: s.find((a) => a.key === t)?.frozen ? f.unfreezeColumn : f.freezeColumn
197
175
  }
198
176
  ),
199
- label: i.find((d) => d.key === t)?.frozen ? a(f.UNFREEZE_COLUMN) : a(f.FREEZE_COLUMN),
200
- onClick: B,
201
- disabled: !i.find((d) => d.key === t)?.visible,
177
+ label: s.find((a) => a.key === t)?.frozen ? n(l.UNFREEZE_COLUMN) : n(l.FREEZE_COLUMN),
178
+ onClick: h,
179
+ disabled: !s.find((a) => a.key === t)?.visible,
202
180
  dataTestId: "toggle-freeze"
203
181
  },
204
182
  {
205
183
  type: "menuItem",
206
- startIcon: /* @__PURE__ */ l(b, { src: C.hideColumn }),
207
- label: a(f.HIDE_COLUMN),
208
- onClick: V,
184
+ startIcon: /* @__PURE__ */ d(C, { src: f.hideColumn }),
185
+ label: n(l.HIDE_COLUMN),
186
+ onClick: N,
209
187
  dataTestId: "hide-column"
210
188
  }
211
189
  ];
212
- return [...e, ...r, ...u, ...j];
190
+ return [...r, ...e, ...p, ...Z];
213
191
  }, [
214
192
  t,
215
- D,
216
- M,
217
- G,
218
- T,
193
+ A,
194
+ O,
195
+ v,
219
196
  z,
220
- x,
221
- B,
222
- V,
223
- i,
224
- g,
225
- s,
226
- p,
227
- Y,
228
197
  U,
198
+ k,
229
199
  h,
230
- a,
231
- Z,
232
- O,
200
+ N,
201
+ s,
202
+ I,
203
+ o,
204
+ c,
205
+ B,
206
+ _,
207
+ x,
208
+ n,
233
209
  H,
234
- v,
235
210
  R,
236
- _,
237
- L
211
+ V,
212
+ G,
213
+ T,
214
+ D,
215
+ M,
216
+ S
238
217
  ]);
239
218
  }
240
219
  export {
241
- nt as useHeaderMenuActions
220
+ it as useHeaderMenuActions
242
221
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useSortColumnsRows.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA2LzC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,EAAE,WAAW,EAClD,eAAe,SAAS,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EACnD,YAAY,SAAS,IAAI,EAAE,EAC3B,kBAAkB;IAChB,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE;;;;;CAqOF,CAAC"}
1
+ {"version":3,"file":"useSortColumnsRows.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA2LzC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,EAAE,WAAW,EAClD,eAAe,SAAS,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EACnD,YAAY,SAAS,IAAI,EAAE,EAC3B,kBAAkB;IAChB,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE;;;;;CAwOF,CAAC"}