@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.
- package/components/Pager/subcomponents/CustomTablePagination/CustomTablePagination.d.ts.map +1 -1
- package/components/Pager/subcomponents/CustomTablePagination/CustomTablePagination.js +53 -61
- package/components/Pager/subcomponents/RowsPerPageSelect/RowsPerPageSelect.d.ts +7 -0
- package/components/Pager/subcomponents/RowsPerPageSelect/RowsPerPageSelect.d.ts.map +1 -0
- package/components/Pager/subcomponents/RowsPerPageSelect/RowsPerPageSelect.js +28 -0
- package/components/Pager/subcomponents/RowsPerPageSelect/types.d.ts +20 -0
- package/components/Pager/subcomponents/RowsPerPageSelect/types.d.ts.map +1 -0
- package/components/datagrids/Datagrid.styles.d.ts.map +1 -1
- package/components/datagrids/Datagrid.styles.js +329 -298
- package/components/datagrids/components/BaseDataGrid/BaseDataGrid.d.ts.map +1 -1
- package/components/datagrids/components/BaseDataGrid/BaseDataGrid.js +101 -95
- package/components/datagrids/constants.d.ts +7 -0
- package/components/datagrids/constants.d.ts.map +1 -1
- package/components/datagrids/constants.js +10 -6
- package/components/datagrids/contexts/DataGridContext/DataGridContext.d.ts.map +1 -1
- package/components/datagrids/contexts/DataGridContext/DataGridContext.js +112 -102
- package/components/datagrids/contexts/DataGridContext/types.d.ts +18 -3
- package/components/datagrids/contexts/DataGridContext/types.d.ts.map +1 -1
- package/components/datagrids/dictionary.d.ts +4 -0
- package/components/datagrids/dictionary.d.ts.map +1 -1
- package/components/datagrids/dictionary.js +12 -6
- package/components/datagrids/helpers/index.d.ts +5 -0
- package/components/datagrids/helpers/index.d.ts.map +1 -1
- package/components/datagrids/helpers/normalizeHeaderClickDeferMs.d.ts +5 -0
- package/components/datagrids/helpers/normalizeHeaderClickDeferMs.d.ts.map +1 -0
- package/components/datagrids/helpers/normalizeHeaderClickDeferMs.js +7 -0
- package/components/datagrids/helpers/shared/attachScrollElement/attachScrollElement.d.ts +9 -0
- package/components/datagrids/helpers/shared/attachScrollElement/attachScrollElement.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/attachScrollElement/attachScrollElement.js +14 -0
- package/components/datagrids/helpers/shared/attachScrollElement/index.d.ts +3 -0
- package/components/datagrids/helpers/shared/attachScrollElement/index.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/attachScrollElement/types.d.ts +14 -0
- package/components/datagrids/helpers/shared/attachScrollElement/types.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/buildCursorExportPaginationInfo.d.ts +4 -0
- package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/buildCursorExportPaginationInfo.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/buildCursorExportPaginationInfo.js +10 -0
- package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/index.d.ts +3 -0
- package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/index.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/types.d.ts +7 -0
- package/components/datagrids/helpers/shared/buildCursorExportPaginationInfo/types.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/getInfinitePageSize/getInfinitePageSize.d.ts +4 -0
- package/components/datagrids/helpers/shared/getInfinitePageSize/getInfinitePageSize.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/getInfinitePageSize/getInfinitePageSize.js +12 -0
- package/components/datagrids/helpers/shared/getInfinitePageSize/index.d.ts +3 -0
- package/components/datagrids/helpers/shared/getInfinitePageSize/index.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/getInfinitePageSize/types.d.ts +8 -0
- package/components/datagrids/helpers/shared/getInfinitePageSize/types.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/isNearBottom/index.d.ts +2 -0
- package/components/datagrids/helpers/shared/isNearBottom/index.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/isNearBottom/isNearBottom.d.ts +15 -0
- package/components/datagrids/helpers/shared/isNearBottom/isNearBottom.d.ts.map +1 -0
- package/components/datagrids/helpers/shared/isNearBottom/isNearBottom.js +6 -0
- package/components/datagrids/hooks/index.d.ts +2 -0
- package/components/datagrids/hooks/index.d.ts.map +1 -1
- package/components/datagrids/hooks/shared/useInfiniteScroll/index.d.ts +3 -0
- package/components/datagrids/hooks/shared/useInfiniteScroll/index.d.ts.map +1 -0
- package/components/datagrids/hooks/shared/useInfiniteScroll/types.d.ts +26 -0
- package/components/datagrids/hooks/shared/useInfiniteScroll/types.d.ts.map +1 -0
- package/components/datagrids/hooks/shared/useInfiniteScroll/useInfiniteScroll.d.ts +13 -0
- package/components/datagrids/hooks/shared/useInfiniteScroll/useInfiniteScroll.d.ts.map +1 -0
- package/components/datagrids/hooks/shared/useInfiniteScroll/useInfiniteScroll.js +69 -0
- package/components/datagrids/hooks/useInfiniteScrollGate/index.d.ts +3 -0
- package/components/datagrids/hooks/useInfiniteScrollGate/index.d.ts.map +1 -0
- package/components/datagrids/hooks/useInfiniteScrollGate/types.d.ts +32 -0
- package/components/datagrids/hooks/useInfiniteScrollGate/types.d.ts.map +1 -0
- package/components/datagrids/hooks/useInfiniteScrollGate/useInfiniteScrollGate.d.ts +17 -0
- package/components/datagrids/hooks/useInfiniteScrollGate/useInfiniteScrollGate.d.ts.map +1 -0
- package/components/datagrids/hooks/useInfiniteScrollGate/useInfiniteScrollGate.js +20 -0
- package/components/datagrids/hooks/useRemeasureOnReady/useRemeasureOnReady.d.ts +4 -1
- package/components/datagrids/hooks/useRemeasureOnReady/useRemeasureOnReady.d.ts.map +1 -1
- package/components/datagrids/hooks/useRemeasureOnReady/useRemeasureOnReady.js +33 -25
- package/components/datagrids/index.d.ts +5 -2
- package/components/datagrids/index.d.ts.map +1 -1
- package/components/datagrids/slots/DataGridEnum.d.ts +4 -0
- package/components/datagrids/slots/DataGridEnum.d.ts.map +1 -1
- package/components/datagrids/slots/DataGridEnum.js +5 -4
- package/components/datagrids/slots/DataGridSlot.d.ts +11 -0
- package/components/datagrids/slots/DataGridSlot.d.ts.map +1 -1
- package/components/datagrids/slots/DataGridSlot.js +121 -113
- package/components/datagrids/subcomponents/InfiniteScrollStatus/InfiniteScrollStatus.d.ts +8 -0
- package/components/datagrids/subcomponents/InfiniteScrollStatus/InfiniteScrollStatus.d.ts.map +1 -0
- package/components/datagrids/subcomponents/InfiniteScrollStatus/InfiniteScrollStatus.js +46 -0
- package/components/datagrids/subcomponents/InfiniteScrollStatus/index.d.ts +3 -0
- package/components/datagrids/subcomponents/InfiniteScrollStatus/index.d.ts.map +1 -0
- package/components/datagrids/subcomponents/InfiniteScrollStatus/types.d.ts +11 -0
- package/components/datagrids/subcomponents/InfiniteScrollStatus/types.d.ts.map +1 -0
- package/components/datagrids/subcomponents/index.d.ts +1 -0
- package/components/datagrids/subcomponents/index.d.ts.map +1 -1
- package/components/datagrids/tests/helpers/InfiniteScrollStory.d.ts +9 -0
- package/components/datagrids/tests/helpers/InfiniteScrollStory.d.ts.map +1 -0
- package/components/datagrids/tests/helpers/infiniteScrollStoryHelpers.d.ts +22 -0
- package/components/datagrids/tests/helpers/infiniteScrollStoryHelpers.d.ts.map +1 -0
- package/components/datagrids/types.d.ts +69 -4
- package/components/datagrids/types.d.ts.map +1 -1
- package/components/datagrids/views/CardsView/CardsView.d.ts.map +1 -1
- package/components/datagrids/views/CardsView/CardsView.js +90 -79
- package/components/datagrids/views/CardsView/helpers/observeContainerWidth/index.d.ts +3 -0
- package/components/datagrids/views/CardsView/helpers/observeContainerWidth/index.d.ts.map +1 -0
- package/components/datagrids/views/CardsView/helpers/observeContainerWidth/observeContainerWidth.d.ts +9 -0
- package/components/datagrids/views/CardsView/helpers/observeContainerWidth/observeContainerWidth.d.ts.map +1 -0
- package/components/datagrids/views/CardsView/helpers/observeContainerWidth/observeContainerWidth.js +13 -0
- package/components/datagrids/views/CardsView/helpers/observeContainerWidth/types.d.ts +14 -0
- package/components/datagrids/views/CardsView/helpers/observeContainerWidth/types.d.ts.map +1 -0
- package/components/datagrids/views/CardsView/hooks/useCardsPerRow/types.d.ts +15 -0
- package/components/datagrids/views/CardsView/hooks/useCardsPerRow/types.d.ts.map +1 -0
- package/components/datagrids/views/CardsView/hooks/useCardsPerRow/useCardsPerRow.d.ts.map +1 -1
- package/components/datagrids/views/CardsView/hooks/useCardsPerRow/useCardsPerRow.js +18 -14
- package/components/datagrids/views/ListView/ListView.d.ts.map +1 -1
- package/components/datagrids/views/ListView/ListView.js +65 -54
- package/components/datagrids/views/TableView/TableView.d.ts.map +1 -1
- package/components/datagrids/views/TableView/TableView.js +119 -111
- package/components/datagrids/views/TableView/helpers/getDragHeaderRenderer/getDragHeaderRenderer.d.ts +1 -0
- package/components/datagrids/views/TableView/helpers/getDragHeaderRenderer/getDragHeaderRenderer.d.ts.map +1 -1
- package/components/datagrids/views/TableView/helpers/getDragHeaderRenderer/getDragHeaderRenderer.js +9 -8
- package/components/datagrids/views/TableView/hooks/useColumnSortRules/index.d.ts +2 -0
- package/components/datagrids/views/TableView/hooks/useColumnSortRules/index.d.ts.map +1 -0
- package/components/datagrids/views/TableView/hooks/useColumnSortRules/useColumnSortRules.d.ts +25 -0
- package/components/datagrids/views/TableView/hooks/useColumnSortRules/useColumnSortRules.d.ts.map +1 -0
- package/components/datagrids/views/TableView/hooks/useColumnSortRules/useColumnSortRules.js +97 -0
- package/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.d.ts.map +1 -1
- package/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.js +117 -138
- package/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.d.ts.map +1 -1
- package/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.js +57 -54
- package/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/DraggableHeaderRenderer.d.ts.map +1 -1
- package/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/DraggableHeaderRenderer.js +108 -82
- package/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/types.d.ts +2 -0
- package/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/types.d.ts.map +1 -1
- package/components/extended/mui/IconButton/IconButton.styles.d.ts +1 -1
- package/index.js +737 -732
- 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,
|
|
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"}
|
package/components/datagrids/views/TableView/hooks/useHeaderMenuActions/useHeaderMenuActions.js
CHANGED
|
@@ -1,242 +1,221 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import { useModuleDictionary as
|
|
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
|
|
6
|
-
import { pathIcons as
|
|
7
|
-
import { Icon as
|
|
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
|
-
|
|
9
|
+
import { useColumnSortRules as X } from "../useColumnSortRules/useColumnSortRules.js";
|
|
10
|
+
function it(t, g, P, Y) {
|
|
10
11
|
const {
|
|
11
|
-
columnsConfig:
|
|
12
|
-
onChangeColumnsConfig:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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,
|
|
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
|
|
43
|
-
|
|
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
|
-
|
|
51
|
-
}, [t,
|
|
27
|
+
I("table", r);
|
|
28
|
+
}, [t, s, I]), N = F(() => {
|
|
52
29
|
if (!t)
|
|
53
30
|
return;
|
|
54
|
-
const
|
|
55
|
-
(
|
|
31
|
+
const r = s.map(
|
|
32
|
+
(e) => e.key === t ? { ...e, visible: !e.visible } : e
|
|
56
33
|
);
|
|
57
|
-
|
|
58
|
-
}, [t,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
52
|
+
c?.onChange({
|
|
72
53
|
action: "add",
|
|
73
54
|
columnKey: t
|
|
74
55
|
});
|
|
75
|
-
}, [t,
|
|
76
|
-
(
|
|
77
|
-
), [
|
|
78
|
-
if (!t || !
|
|
79
|
-
(
|
|
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
|
|
83
|
-
(
|
|
84
|
-
),
|
|
85
|
-
(
|
|
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
|
|
88
|
-
}, [t,
|
|
89
|
-
return
|
|
68
|
+
return e && !E;
|
|
69
|
+
}, [t, i, c]);
|
|
70
|
+
return u(() => {
|
|
90
71
|
if (!t)
|
|
91
72
|
return [];
|
|
92
|
-
const
|
|
73
|
+
const r = [
|
|
93
74
|
{
|
|
94
75
|
type: "menuItem",
|
|
95
|
-
startIcon: /* @__PURE__ */
|
|
96
|
-
label:
|
|
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
|
-
|
|
83
|
+
o ? k("asc") : R([
|
|
103
84
|
{
|
|
104
85
|
columnKey: t,
|
|
105
86
|
direction: "ASC"
|
|
106
87
|
}
|
|
107
88
|
]);
|
|
108
89
|
},
|
|
109
|
-
disabled: !
|
|
90
|
+
disabled: !A || (o ? !O || v : D)
|
|
110
91
|
},
|
|
111
92
|
{
|
|
112
93
|
type: "menuItem",
|
|
113
|
-
startIcon: /* @__PURE__ */
|
|
114
|
-
label:
|
|
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
|
-
|
|
101
|
+
o ? k("desc") : R([
|
|
121
102
|
{
|
|
122
103
|
columnKey: t,
|
|
123
104
|
direction: "DESC"
|
|
124
105
|
}
|
|
125
106
|
]);
|
|
126
107
|
},
|
|
127
|
-
disabled: !
|
|
108
|
+
disabled: !A || (o ? !O || z : M)
|
|
128
109
|
},
|
|
129
110
|
{
|
|
130
111
|
type: "menuItem",
|
|
131
|
-
startIcon: /* @__PURE__ */
|
|
132
|
-
label:
|
|
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 (
|
|
140
|
-
|
|
141
|
-
action: "remove",
|
|
142
|
-
columnKey: t
|
|
143
|
-
});
|
|
120
|
+
if (o && S) {
|
|
121
|
+
T();
|
|
144
122
|
return;
|
|
145
123
|
} else
|
|
146
|
-
|
|
124
|
+
G();
|
|
147
125
|
},
|
|
148
|
-
disabled:
|
|
126
|
+
disabled: o ? !U || !S : !(D || M)
|
|
149
127
|
}
|
|
150
|
-
],
|
|
128
|
+
], e = c ? [
|
|
151
129
|
{
|
|
152
130
|
type: "menuItem",
|
|
153
|
-
startIcon: /* @__PURE__ */
|
|
154
|
-
label:
|
|
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
|
-
|
|
135
|
+
V();
|
|
158
136
|
},
|
|
159
|
-
disabled:
|
|
137
|
+
disabled: H
|
|
160
138
|
}
|
|
161
|
-
] : [],
|
|
139
|
+
] : [], E = (a) => {
|
|
162
140
|
if (!t)
|
|
163
141
|
return;
|
|
164
|
-
const
|
|
165
|
-
(
|
|
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
|
-
|
|
168
|
-
},
|
|
145
|
+
I("table", q);
|
|
146
|
+
}, p = B ? [
|
|
169
147
|
{
|
|
170
148
|
type: "menuItem",
|
|
171
|
-
startIcon: /* @__PURE__ */
|
|
172
|
-
label:
|
|
149
|
+
startIcon: /* @__PURE__ */ d(C, { src: f.group }),
|
|
150
|
+
label: n(l.GROUP_BY_COLUMN),
|
|
173
151
|
dataTestId: "group-add",
|
|
174
152
|
onClick: () => {
|
|
175
|
-
|
|
153
|
+
E(!0);
|
|
176
154
|
},
|
|
177
|
-
disabled: !
|
|
155
|
+
disabled: !_ || x
|
|
178
156
|
},
|
|
179
157
|
{
|
|
180
158
|
type: "menuItem",
|
|
181
|
-
startIcon: /* @__PURE__ */
|
|
182
|
-
label:
|
|
159
|
+
startIcon: /* @__PURE__ */ d(C, { src: f.removeGroup }),
|
|
160
|
+
label: n(l.REMOVE_GROUP_COLUMN),
|
|
183
161
|
dataTestId: "group-remove",
|
|
184
162
|
onClick: () => {
|
|
185
|
-
|
|
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: !
|
|
166
|
+
disabled: !x || !_
|
|
189
167
|
}
|
|
190
|
-
] : [],
|
|
168
|
+
] : [], Z = [
|
|
191
169
|
{
|
|
192
170
|
type: "menuItem",
|
|
193
|
-
startIcon: /* @__PURE__ */
|
|
194
|
-
|
|
171
|
+
startIcon: /* @__PURE__ */ d(
|
|
172
|
+
C,
|
|
195
173
|
{
|
|
196
|
-
src:
|
|
174
|
+
src: s.find((a) => a.key === t)?.frozen ? f.unfreezeColumn : f.freezeColumn
|
|
197
175
|
}
|
|
198
176
|
),
|
|
199
|
-
label:
|
|
200
|
-
onClick:
|
|
201
|
-
disabled: !
|
|
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__ */
|
|
207
|
-
label:
|
|
208
|
-
onClick:
|
|
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 [...
|
|
190
|
+
return [...r, ...e, ...p, ...Z];
|
|
213
191
|
}, [
|
|
214
192
|
t,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
|
|
211
|
+
V,
|
|
212
|
+
G,
|
|
213
|
+
T,
|
|
214
|
+
D,
|
|
215
|
+
M,
|
|
216
|
+
S
|
|
238
217
|
]);
|
|
239
218
|
}
|
|
240
219
|
export {
|
|
241
|
-
|
|
220
|
+
it as useHeaderMenuActions
|
|
242
221
|
};
|
package/components/datagrids/views/TableView/hooks/useSortColumnsRows/useSortColumnsRows.d.ts.map
CHANGED
|
@@ -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;;;;;
|
|
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"}
|