@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
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as N, useEffect as O, useMemo as
|
|
3
|
-
import { useModuleSkeleton as K, getPropertyByString as
|
|
4
|
-
import { SELECT_COLUMN_KEY as
|
|
5
|
-
import { getDragHeaderRenderer as
|
|
1
|
+
import { jsx as M } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useState as N, useEffect as O, useMemo as D } from "react";
|
|
3
|
+
import { useModuleSkeleton as K, getPropertyByString as _ } from "@m4l/core";
|
|
4
|
+
import { SELECT_COLUMN_KEY as $ } from "react-data-grid";
|
|
5
|
+
import { getDragHeaderRenderer as B } from "../../helpers/getDragHeaderRenderer/getDragHeaderRenderer.js";
|
|
6
6
|
import { SkeletonFormatter as G } from "../../subcomponents/SkeletonFormatter/SkeletonFormatter.js";
|
|
7
|
-
import { filterColumnClassName as
|
|
8
|
-
import { RenderGroupCell as
|
|
9
|
-
import { ActionsColumn as
|
|
10
|
-
import { RadioSelectColumn as
|
|
11
|
-
import { useDataGrid as
|
|
12
|
-
import { useFilters as
|
|
13
|
-
function
|
|
14
|
-
const s = n.find((
|
|
7
|
+
import { filterColumnClassName as P, SelectColumn as J } from "../../subcomponents/SelectColumn/SelectColumn.js";
|
|
8
|
+
import { RenderGroupCell as L } from "../../subcomponents/RenderGroupCell/RenderGroupCell.js";
|
|
9
|
+
import { ActionsColumn as T } from "../../subcomponents/ActionsColumn/ActionsColumn.js";
|
|
10
|
+
import { RadioSelectColumn as j } from "../../subcomponents/RadioSelectColumn/RadioSelectColumn.js";
|
|
11
|
+
import { useDataGrid as U } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
12
|
+
import { useFilters as V } from "../../../../hooks/shared/useFilters/useFilters.js";
|
|
13
|
+
function Y(n, l) {
|
|
14
|
+
const s = n.find((u) => u.key === l);
|
|
15
15
|
let r = "string";
|
|
16
|
-
return s && (r = s.type || "string"), s?.customSort ? s.customSort : r === "number" ? (
|
|
16
|
+
return s && (r = s.type || "string"), s?.customSort ? s.customSort : r === "number" ? (u, m) => {
|
|
17
17
|
try {
|
|
18
|
-
return Number(
|
|
18
|
+
return Number(u[l]) - Number(m[l]);
|
|
19
19
|
} catch {
|
|
20
20
|
return -1;
|
|
21
21
|
}
|
|
22
|
-
} : (
|
|
22
|
+
} : (u, m) => {
|
|
23
23
|
try {
|
|
24
|
-
return
|
|
24
|
+
return u[l].toString().localeCompare(m[l].toString());
|
|
25
25
|
} catch {
|
|
26
26
|
return -1;
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
const b = (n, l) => l.findIndex((s) => s.key === n),
|
|
30
|
+
const b = (n, l) => l.findIndex((s) => s.key === n), q = (n, l) => l.findIndex(
|
|
31
31
|
(r) => n === r.key && r.hidden !== !0
|
|
32
|
-
) !== -1,
|
|
32
|
+
) !== -1, Q = (n, l, s, r, u, m) => {
|
|
33
33
|
let a = n.filter((t) => {
|
|
34
34
|
const i = b(t.key, r), f = i > -1 ? r[i].visible : !0;
|
|
35
35
|
return !t.hidden && f;
|
|
36
36
|
}).sort((t, i) => {
|
|
37
37
|
let f = b(t.key, r);
|
|
38
38
|
f = f === -1 ? r.length : f;
|
|
39
|
-
let
|
|
40
|
-
return
|
|
39
|
+
let d = b(i.key, r);
|
|
40
|
+
return d = d === -1 ? r.length : d, f - d;
|
|
41
41
|
}).map((t) => {
|
|
42
42
|
const i = b(t.key, r);
|
|
43
43
|
return {
|
|
44
44
|
...t,
|
|
45
45
|
frozen: i > -1 ? r[i].frozen : !1,
|
|
46
|
-
width: typeof
|
|
46
|
+
width: typeof u.get(t.key) == "number" ? u.get(t.key) : t.width
|
|
47
47
|
};
|
|
48
48
|
}).sort((t, i) => (t.frozen === void 0 || t.frozen === !1) == (i.frozen === void 0 || i.frozen === !1) ? 0 : t.frozen ? -1 : 1);
|
|
49
|
-
return m && (a = [
|
|
50
|
-
},
|
|
49
|
+
return m && (a = [T, ...a]), l && (a = [s === !1 ? j : J, ...a]), a;
|
|
50
|
+
}, W = (n) => {
|
|
51
51
|
switch (n) {
|
|
52
52
|
case "string":
|
|
53
53
|
return "left";
|
|
@@ -59,36 +59,37 @@ const b = (n, l) => l.findIndex((s) => s.key === n), Y = (n, l) => l.findIndex(
|
|
|
59
59
|
return "right";
|
|
60
60
|
}
|
|
61
61
|
return "left";
|
|
62
|
-
},
|
|
62
|
+
}, fe = (n, l, s) => {
|
|
63
63
|
const {
|
|
64
64
|
columnsConfig: r,
|
|
65
|
-
columnsWidths:
|
|
65
|
+
columnsWidths: u,
|
|
66
66
|
onChangeColumnsOrder: m,
|
|
67
67
|
rowActionsGetter: a,
|
|
68
68
|
checkedRows: t,
|
|
69
69
|
onCheckedRowsChange: i,
|
|
70
70
|
checkedRowsMultiple: f,
|
|
71
|
-
sortColumns:
|
|
72
|
-
setSortColumns: R
|
|
73
|
-
|
|
71
|
+
sortColumns: d,
|
|
72
|
+
setSortColumns: R,
|
|
73
|
+
headerClickDeferMs: z
|
|
74
|
+
} = U(), [S, E] = N(
|
|
74
75
|
() => []
|
|
75
|
-
),
|
|
76
|
+
), F = K(), { activeFilters: I, filters: k } = V();
|
|
76
77
|
O(() => {
|
|
77
78
|
E(
|
|
78
|
-
|
|
79
|
+
Q(
|
|
79
80
|
n,
|
|
80
81
|
!!t && !!i,
|
|
81
82
|
//Si están seteados se habilita el múltipe
|
|
82
83
|
f,
|
|
83
84
|
r,
|
|
84
|
-
|
|
85
|
+
u,
|
|
85
86
|
a
|
|
86
87
|
)
|
|
87
88
|
);
|
|
88
|
-
const C =
|
|
89
|
-
(o) =>
|
|
89
|
+
const C = d.filter(
|
|
90
|
+
(o) => q(o.columnKey, n)
|
|
90
91
|
);
|
|
91
|
-
JSON.stringify(C) !== JSON.stringify(
|
|
92
|
+
JSON.stringify(C) !== JSON.stringify(d) && R(C);
|
|
92
93
|
}, [
|
|
93
94
|
n,
|
|
94
95
|
r,
|
|
@@ -96,31 +97,32 @@ const b = (n, l) => l.findIndex((s) => s.key === n), Y = (n, l) => l.findIndex(
|
|
|
96
97
|
t,
|
|
97
98
|
i,
|
|
98
99
|
f,
|
|
99
|
-
d,
|
|
100
100
|
u,
|
|
101
|
+
d,
|
|
101
102
|
R
|
|
102
103
|
]);
|
|
103
|
-
const A =
|
|
104
|
-
const C =
|
|
104
|
+
const A = D(() => {
|
|
105
|
+
const C = B(
|
|
105
106
|
(o, p) => m("table", o, p),
|
|
106
107
|
{
|
|
107
|
-
openPopover: s?.openPopover
|
|
108
|
+
openPopover: s?.openPopover,
|
|
109
|
+
headerClickDeferMs: z
|
|
108
110
|
}
|
|
109
111
|
);
|
|
110
112
|
return S.map((o) => {
|
|
111
|
-
const p = o.align !== void 0 ? `rdg-cell-align-${o.align}` : `rdg-cell-align-${
|
|
113
|
+
const p = o.align !== void 0 ? `rdg-cell-align-${o.align}` : `rdg-cell-align-${W(o.type)}`, e = {
|
|
112
114
|
...o,
|
|
113
115
|
cellClass: p,
|
|
114
116
|
headerCellClass: p
|
|
115
117
|
};
|
|
116
|
-
if (e.key ===
|
|
118
|
+
if (e.key === $ || e.isDraggable !== void 0 && e.isDraggable === !1)
|
|
117
119
|
return e;
|
|
118
|
-
|
|
120
|
+
F ? (e.renderHeaderCell = G, e.renderCell = G, e.renderEditCell = G) : (e.formatter && !e.renderCell && (e.renderCell = e.formatter), e.editor && !e.renderEditCell && (e.renderEditCell = e.editor)), e.renderHeaderCell && (e.withinHeaderRenderer = e.renderHeaderCell), (e?.withFilter === void 0 || e.withFilter === !0) && I && (e.headerCellClass = `${e.headerCellClass} ${P}`.trim()), e.renderHeaderCell = C;
|
|
119
121
|
const g = r.find((y) => y.key === o.key)?.grouped === !0, x = n.find((y) => y.key === o.key), h = x?.renderGroupCell !== void 0;
|
|
120
122
|
if (g) {
|
|
121
123
|
const y = h ? x?.renderGroupCell : void 0;
|
|
122
|
-
e.renderGroupCell = (c) => /* @__PURE__ */
|
|
123
|
-
|
|
124
|
+
e.renderGroupCell = (c) => /* @__PURE__ */ M(
|
|
125
|
+
L,
|
|
124
126
|
{
|
|
125
127
|
...c,
|
|
126
128
|
customRenderGroupCell: y
|
|
@@ -130,14 +132,15 @@ const b = (n, l) => l.findIndex((s) => s.key === n), Y = (n, l) => l.findIndex(
|
|
|
130
132
|
return e;
|
|
131
133
|
});
|
|
132
134
|
}, [
|
|
133
|
-
z,
|
|
134
|
-
S,
|
|
135
135
|
F,
|
|
136
|
+
S,
|
|
137
|
+
I,
|
|
136
138
|
m,
|
|
137
139
|
s,
|
|
140
|
+
z,
|
|
138
141
|
r,
|
|
139
142
|
n
|
|
140
|
-
]),
|
|
143
|
+
]), H = D(() => {
|
|
141
144
|
const C = l.filter((o) => {
|
|
142
145
|
if (!k || k.size === 0)
|
|
143
146
|
return !0;
|
|
@@ -149,7 +152,7 @@ const b = (n, l) => l.findIndex((s) => s.key === n), Y = (n, l) => l.findIndex(
|
|
|
149
152
|
customFilter: void 0
|
|
150
153
|
};
|
|
151
154
|
let y;
|
|
152
|
-
const c =
|
|
155
|
+
const c = _(o, x);
|
|
153
156
|
let v;
|
|
154
157
|
typeof c == "string" ? v = c : typeof c == "number" ? v = c.toString() : c != null ? v = String(c) : v = "";
|
|
155
158
|
try {
|
|
@@ -162,17 +165,17 @@ const b = (n, l) => l.findIndex((s) => s.key === n), Y = (n, l) => l.findIndex(
|
|
|
162
165
|
}
|
|
163
166
|
return e;
|
|
164
167
|
});
|
|
165
|
-
return
|
|
166
|
-
for (const e of
|
|
167
|
-
const g =
|
|
168
|
+
return d.length === 0 || C.sort((o, p) => {
|
|
169
|
+
for (const e of d) {
|
|
170
|
+
const g = Y(S, e.columnKey)(o, p);
|
|
168
171
|
if (g !== 0)
|
|
169
172
|
return e.direction === "ASC" ? g : -g;
|
|
170
173
|
}
|
|
171
174
|
return 0;
|
|
172
175
|
}), C;
|
|
173
|
-
}, [l,
|
|
174
|
-
return { finalColumns: A, sortColumns:
|
|
176
|
+
}, [l, d, k, S]);
|
|
177
|
+
return { finalColumns: A, sortColumns: d, setSortColumns: R, finalRows: H };
|
|
175
178
|
};
|
|
176
179
|
export {
|
|
177
|
-
|
|
180
|
+
fe as useSortColumnsRows
|
|
178
181
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DraggableHeaderRenderer.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/DraggableHeaderRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DraggableHeaderRenderer.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/DraggableHeaderRenderer.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAC1C,KAAK,EAAE,4BAA4B,CAAC,IAAI,CAAC,GACxC,GAAG,CAqSL"}
|
|
@@ -1,46 +1,74 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useModuleDictionary as
|
|
4
|
-
import { useDrag as
|
|
5
|
-
import { renderHeaderCell as
|
|
6
|
-
import { NameColumnIconStyled as
|
|
7
|
-
import { pathIcons as
|
|
8
|
-
import { Icon as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
1
|
+
import { jsxs as u, jsx as o } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useState as V, useRef as J, useCallback as C, useEffect as k } from "react";
|
|
3
|
+
import { useModuleDictionary as W } from "@m4l/core";
|
|
4
|
+
import { useDrag as q, useDrop as Q } from "react-dnd";
|
|
5
|
+
import { renderHeaderCell as X } from "react-data-grid";
|
|
6
|
+
import { NameColumnIconStyled as Y, NameColumnStyled as Z, IconColumnStyled as ee, DraggableHeaderRootStyled as te, ButtonHeaderActionsStyled as re, DraggableWrapperInputBaseStyled as ne, IconSearchStyled as oe, HeaderInputBaseStyled as le } from "../../../../slots/DataGridSlot.js";
|
|
7
|
+
import { pathIcons as c } from "../../../../icons.js";
|
|
8
|
+
import { Icon as D } from "@m4l/base";
|
|
9
|
+
import { normalizeHeaderClickDeferMs as ae } from "../../../../helpers/normalizeHeaderClickDeferMs.js";
|
|
10
|
+
import { useFocusRef as ie } from "../../hooks/useFocusRef/useFocusRef.js";
|
|
11
|
+
import { useColumnSortRules as ce } from "../../hooks/useColumnSortRules/useColumnSortRules.js";
|
|
12
|
+
import { useDataGrid as se } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
|
|
13
|
+
import { useFilters as ue } from "../../../../hooks/shared/useFilters/useFilters.js";
|
|
14
|
+
function Ie(d) {
|
|
13
15
|
const {
|
|
14
|
-
onColumnsReorder:
|
|
16
|
+
onColumnsReorder: x,
|
|
15
17
|
column: t,
|
|
16
|
-
tabIndex:
|
|
17
|
-
openPopover:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
tabIndex: s,
|
|
19
|
+
openPopover: m,
|
|
20
|
+
headerClickDeferMs: b,
|
|
21
|
+
...I
|
|
22
|
+
} = d, { ref: w, tabIndex: H } = ie(
|
|
23
|
+
s !== void 0 && s >= 0
|
|
24
|
+
), { getLabel: R } = W(), {
|
|
25
|
+
size: f,
|
|
26
|
+
classes: F,
|
|
27
|
+
reorderable: g,
|
|
28
|
+
externalSortSettings: v,
|
|
29
|
+
externalFilterSettings: A,
|
|
30
|
+
currentRowHeightVariant: M
|
|
31
|
+
} = se(), { activeFilters: i, filters: P, onChangeFilter: p } = ue(), [T, y] = V(P?.get(t.key) || ""), h = ae(b), { canToggleSort: z, toggleSort: N } = ce({
|
|
32
|
+
columnKey: t.key,
|
|
33
|
+
column: t,
|
|
34
|
+
defaultSortable: !0
|
|
35
|
+
}), a = J(null), r = C(() => {
|
|
36
|
+
a.current !== null && (clearTimeout(a.current), a.current = null);
|
|
37
|
+
}, []);
|
|
38
|
+
k(() => r, [r]);
|
|
39
|
+
const O = (e) => {
|
|
40
|
+
const n = e.currentTarget;
|
|
41
|
+
if (e.detail > 2) {
|
|
42
|
+
r();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (h === 0 || !z || t.type === "custom" || e.detail === 0) {
|
|
46
|
+
r(), m?.(n, t.key);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (e.detail === 2) {
|
|
50
|
+
r(), N();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
r(), a.current = setTimeout(() => {
|
|
54
|
+
a.current = null, m?.(n, t.key);
|
|
55
|
+
}, h);
|
|
56
|
+
}, B = C(() => (r(), { key: t.key }), [r, t.key]), S = v?.sortsApplied?.find(
|
|
29
57
|
(e) => e.columnKey === t.key
|
|
30
|
-
),
|
|
58
|
+
), E = A?.filtersApplied?.find(
|
|
31
59
|
(e) => e.columnKey === t.key
|
|
32
|
-
), [{ isDragging:
|
|
60
|
+
), [{ isDragging: _ }, j] = q({
|
|
33
61
|
type: "COLUMN_DRAG",
|
|
34
|
-
item:
|
|
35
|
-
canDrag: () =>
|
|
62
|
+
item: B,
|
|
63
|
+
canDrag: () => g,
|
|
36
64
|
collect: (e) => ({
|
|
37
65
|
isDragging: e.isDragging()
|
|
38
66
|
})
|
|
39
|
-
}), [{ isOver:
|
|
67
|
+
}), [{ isOver: G }, K] = Q({
|
|
40
68
|
accept: "COLUMN_DRAG",
|
|
41
|
-
canDrop: () =>
|
|
69
|
+
canDrop: () => g,
|
|
42
70
|
drop({ key: e }) {
|
|
43
|
-
|
|
71
|
+
x(e, t.key);
|
|
44
72
|
},
|
|
45
73
|
/**
|
|
46
74
|
* Recolecta el estado del monitor de drop para detectar si hay un elemento sobre esta columna
|
|
@@ -49,15 +77,15 @@ function de(s) {
|
|
|
49
77
|
isOver: e.isOver(),
|
|
50
78
|
canDrop: e.canDrop()
|
|
51
79
|
})
|
|
52
|
-
}),
|
|
53
|
-
|
|
54
|
-
},
|
|
80
|
+
}), L = (e) => {
|
|
81
|
+
i && p && p(t, e.target.value), y(e.target.value);
|
|
82
|
+
}, $ = (e) => e === "asc" ? c.sortAsc : c.sortDesc, U = () => {
|
|
55
83
|
const e = [];
|
|
56
|
-
if (
|
|
57
|
-
const n =
|
|
84
|
+
if (S) {
|
|
85
|
+
const n = $(S.direction);
|
|
58
86
|
e.push(
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
|
|
87
|
+
/* @__PURE__ */ o(
|
|
88
|
+
D,
|
|
61
89
|
{
|
|
62
90
|
src: n,
|
|
63
91
|
size: "small",
|
|
@@ -67,11 +95,11 @@ function de(s) {
|
|
|
67
95
|
)
|
|
68
96
|
);
|
|
69
97
|
}
|
|
70
|
-
if (
|
|
71
|
-
const n =
|
|
98
|
+
if (E?.isValid) {
|
|
99
|
+
const n = c.filter2;
|
|
72
100
|
e.push(
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
101
|
+
/* @__PURE__ */ o(
|
|
102
|
+
D,
|
|
75
103
|
{
|
|
76
104
|
src: n,
|
|
77
105
|
size: "small",
|
|
@@ -83,12 +111,12 @@ function de(s) {
|
|
|
83
111
|
}
|
|
84
112
|
return e.length > 0 ? e : null;
|
|
85
113
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}, [
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const e =
|
|
114
|
+
k(() => {
|
|
115
|
+
i || y("");
|
|
116
|
+
}, [i]);
|
|
117
|
+
const l = { ...t };
|
|
118
|
+
if (l.withinHeaderRenderer && (l.name = l.withinHeaderRenderer(d)), !l.withinHeaderRenderer) {
|
|
119
|
+
const e = U();
|
|
92
120
|
if (e) {
|
|
93
121
|
const n = () => {
|
|
94
122
|
switch (t.align) {
|
|
@@ -102,67 +130,65 @@ function de(s) {
|
|
|
102
130
|
return "flex-start";
|
|
103
131
|
}
|
|
104
132
|
};
|
|
105
|
-
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
/* @__PURE__ */
|
|
133
|
+
l.name = /* @__PURE__ */ u(Y, { ownerState: {}, style: { justifyContent: n() }, children: [
|
|
134
|
+
/* @__PURE__ */ o(Z, { ownerState: { size: f, currentRowHeightVariant: M }, children: l.name }),
|
|
135
|
+
/* @__PURE__ */ o(ee, { ownerState: {}, children: e })
|
|
108
136
|
] });
|
|
109
137
|
}
|
|
110
138
|
}
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
-
|
|
139
|
+
return /* @__PURE__ */ u(
|
|
140
|
+
te,
|
|
113
141
|
{
|
|
114
142
|
ownerState: {},
|
|
115
|
-
className:
|
|
143
|
+
className: F?.draggableHeaderRoot,
|
|
116
144
|
ref: (e) => {
|
|
117
|
-
|
|
145
|
+
j(e), K(e);
|
|
118
146
|
},
|
|
119
147
|
style: {
|
|
120
|
-
opacity:
|
|
121
|
-
backgroundColor:
|
|
148
|
+
opacity: _ ? 0.5 : 1,
|
|
149
|
+
backgroundColor: G ? "#ececec" : void 0
|
|
122
150
|
},
|
|
123
151
|
onClick: (e) => {
|
|
124
152
|
e.stopPropagation();
|
|
125
153
|
},
|
|
126
154
|
children: [
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
|
|
155
|
+
/* @__PURE__ */ o(
|
|
156
|
+
re,
|
|
129
157
|
{
|
|
130
158
|
ownerState: {},
|
|
131
159
|
role: "button",
|
|
132
160
|
"aria-label": `header-column-button-${t.key}`,
|
|
133
|
-
onClick:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
children: /* @__PURE__ */ r(
|
|
137
|
-
M,
|
|
161
|
+
onClick: O,
|
|
162
|
+
children: /* @__PURE__ */ o(
|
|
163
|
+
X,
|
|
138
164
|
{
|
|
139
|
-
column:
|
|
140
|
-
tabIndex:
|
|
141
|
-
...
|
|
165
|
+
column: l,
|
|
166
|
+
tabIndex: s,
|
|
167
|
+
...I
|
|
142
168
|
}
|
|
143
169
|
)
|
|
144
170
|
}
|
|
145
171
|
),
|
|
146
|
-
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
|
|
172
|
+
i && (t?.withFilter === void 0 || t.withFilter === !0) && /* @__PURE__ */ u(ne, { ownerState: {}, children: [
|
|
173
|
+
/* @__PURE__ */ o(
|
|
174
|
+
oe,
|
|
149
175
|
{
|
|
150
176
|
ownerState: {},
|
|
151
|
-
src:
|
|
177
|
+
src: c.search,
|
|
152
178
|
color: "text.secondary",
|
|
153
|
-
size:
|
|
179
|
+
size: f
|
|
154
180
|
}
|
|
155
181
|
),
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
|
|
182
|
+
/* @__PURE__ */ o(
|
|
183
|
+
le,
|
|
158
184
|
{
|
|
159
185
|
ownerState: {},
|
|
160
|
-
inputRef:
|
|
161
|
-
placeholder:
|
|
162
|
-
tabIndex:
|
|
186
|
+
inputRef: w,
|
|
187
|
+
placeholder: R("data_grid.filter_holder"),
|
|
188
|
+
tabIndex: H,
|
|
163
189
|
type: "text",
|
|
164
|
-
onChange:
|
|
165
|
-
value:
|
|
190
|
+
onChange: L,
|
|
191
|
+
value: T,
|
|
166
192
|
inputProps: {
|
|
167
193
|
"data-testid": `column-filter-input-${t.key}`,
|
|
168
194
|
"aria-label": `column-filter-input-${t.key}`
|
|
@@ -175,5 +201,5 @@ function de(s) {
|
|
|
175
201
|
);
|
|
176
202
|
}
|
|
177
203
|
export {
|
|
178
|
-
|
|
204
|
+
Ie as DraggableHeaderRenderer
|
|
179
205
|
};
|
package/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/types.d.ts
CHANGED
|
@@ -11,5 +11,7 @@ export interface DraggableHeaderRendererProps<TRow> extends RenderHeaderCellProp
|
|
|
11
11
|
onColumnsReorder: (sourceKey: string, targetKey: string) => void;
|
|
12
12
|
/** Callback opcional para abrir el popover de acciones del header */
|
|
13
13
|
openPopover?: (anchorEl: HTMLElement, columnKey: string) => void;
|
|
14
|
+
/** Normalized delay before opening the header menu after a click. */
|
|
15
|
+
headerClickDeferMs?: number;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=types.d.ts.map
|
package/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B,CAAC,IAAI,CAChD,SAAQ,qBAAqB,CAAC,IAAI,CAAC;IACnC,4DAA4D;IAC5D,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,qEAAqE;IACrE,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/subcomponents/DraggableHeaderRenderer/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B,CAAC,IAAI,CAChD,SAAQ,qBAAqB,CAAC,IAAI,CAAC;IACnC,4DAA4D;IAC5D,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,qEAAqE;IACrE,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B"}
|
|
@@ -11,7 +11,7 @@ type IconButtonShellStyleOptions = {
|
|
|
11
11
|
* Build IconButton shell styles, optionally excluding nested Icon color rules.
|
|
12
12
|
*/
|
|
13
13
|
export declare function getIconButtonShellStyles({ ownerState, theme }: IconButtonStyleArgs, { includeIconColorStyles }?: IconButtonShellStyleOptions): {
|
|
14
|
-
"&&&:not(.Mui-disabled) .M4LIcon-root .MuiSvgIcon-root [fill]"?: {
|
|
14
|
+
"&&&:not(.Mui-disabled) .M4LIcon-root .MuiSvgIcon-root :is([fill], [stroke], g)"?: {
|
|
15
15
|
fill: string;
|
|
16
16
|
} | undefined;
|
|
17
17
|
'&&&': any;
|