@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
@@ -1,53 +1,53 @@
1
- import { jsx as H } from "@emotion/react/jsx-runtime";
2
- import { useState as N, useEffect as O, useMemo as I } from "react";
3
- import { useModuleSkeleton as K, getPropertyByString as M } from "@m4l/core";
4
- import { SELECT_COLUMN_KEY as _ } from "react-data-grid";
5
- import { getDragHeaderRenderer as $ } from "../../helpers/getDragHeaderRenderer/getDragHeaderRenderer.js";
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 B, SelectColumn as P } from "../../subcomponents/SelectColumn/SelectColumn.js";
8
- import { RenderGroupCell as J } from "../../subcomponents/RenderGroupCell/RenderGroupCell.js";
9
- import { ActionsColumn as L } from "../../subcomponents/ActionsColumn/ActionsColumn.js";
10
- import { RadioSelectColumn as T } from "../../subcomponents/RadioSelectColumn/RadioSelectColumn.js";
11
- import { useDataGrid as j } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
12
- import { useFilters as U } from "../../../../hooks/shared/useFilters/useFilters.js";
13
- function V(n, l) {
14
- const s = n.find((d) => d.key === l);
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" ? (d, m) => {
16
+ return s && (r = s.type || "string"), s?.customSort ? s.customSort : r === "number" ? (u, m) => {
17
17
  try {
18
- return Number(d[l]) - Number(m[l]);
18
+ return Number(u[l]) - Number(m[l]);
19
19
  } catch {
20
20
  return -1;
21
21
  }
22
- } : (d, m) => {
22
+ } : (u, m) => {
23
23
  try {
24
- return d[l].toString().localeCompare(m[l].toString());
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), Y = (n, l) => l.findIndex(
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, q = (n, l, s, r, d, m) => {
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 u = b(i.key, r);
40
- return u = u === -1 ? r.length : u, f - u;
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 d.get(t.key) == "number" ? d.get(t.key) : t.width
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 = [L, ...a]), l && (a = [s === !1 ? T : P, ...a]), a;
50
- }, Q = (n) => {
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
- }, ae = (n, l, s) => {
62
+ }, fe = (n, l, s) => {
63
63
  const {
64
64
  columnsConfig: r,
65
- columnsWidths: d,
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: u,
72
- setSortColumns: R
73
- } = j(), [S, E] = N(
71
+ sortColumns: d,
72
+ setSortColumns: R,
73
+ headerClickDeferMs: z
74
+ } = U(), [S, E] = N(
74
75
  () => []
75
- ), z = K(), { activeFilters: F, filters: k } = U();
76
+ ), F = K(), { activeFilters: I, filters: k } = V();
76
77
  O(() => {
77
78
  E(
78
- q(
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
- d,
85
+ u,
85
86
  a
86
87
  )
87
88
  );
88
- const C = u.filter(
89
- (o) => Y(o.columnKey, n)
89
+ const C = d.filter(
90
+ (o) => q(o.columnKey, n)
90
91
  );
91
- JSON.stringify(C) !== JSON.stringify(u) && R(C);
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 = I(() => {
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-${Q(o.type)}`, e = {
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 === _ || e.isDraggable !== void 0 && e.isDraggable === !1)
118
+ if (e.key === $ || e.isDraggable !== void 0 && e.isDraggable === !1)
117
119
  return e;
118
- z ? (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) && F && (e.headerCellClass = `${e.headerCellClass} ${B}`.trim()), e.renderHeaderCell = C;
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__ */ H(
123
- J,
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
- ]), D = I(() => {
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 = M(o, x);
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 u.length === 0 || C.sort((o, p) => {
166
- for (const e of u) {
167
- const g = V(S, e.columnKey)(o, p);
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, u, k, S]);
174
- return { finalColumns: A, sortColumns: u, setSortColumns: R, finalRows: D };
176
+ }, [l, d, k, S]);
177
+ return { finalColumns: A, sortColumns: d, setSortColumns: R, finalRows: H };
175
178
  };
176
179
  export {
177
- ae as useSortColumnsRows
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":"AAmBA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAC1C,KAAK,EAAE,4BAA4B,CAAC,IAAI,CAAC,GACxC,GAAG,CAwOL"}
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 c, jsx as r } from "@emotion/react/jsx-runtime";
2
- import { useState as z, useEffect as B } from "react";
3
- import { useModuleDictionary as E } from "@m4l/core";
4
- import { useDrag as G, useDrop as L } from "react-dnd";
5
- import { renderHeaderCell as M } from "react-data-grid";
6
- import { NameColumnIconStyled as $, NameColumnStyled as K, IconColumnStyled as T, DraggableHeaderRootStyled as U, ButtonHeaderActionsStyled as V, DraggableWrapperInputBaseStyled as J, IconSearchStyled as W, HeaderInputBaseStyled as q } from "../../../../slots/DataGridSlot.js";
7
- import { pathIcons as i } from "../../../../icons.js";
8
- import { Icon as g } from "@m4l/base";
9
- import { useFocusRef as Q } from "../../hooks/useFocusRef/useFocusRef.js";
10
- import { useDataGrid as X } from "../../../../hooks/shared/useDataGrid/useDataGrid.js";
11
- import { useFilters as Y } from "../../../../hooks/shared/useFilters/useFilters.js";
12
- function de(s) {
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: h,
16
+ onColumnsReorder: x,
15
17
  column: t,
16
- tabIndex: l,
17
- openPopover: y,
18
- ...S
19
- } = s, { ref: x, tabIndex: C } = Q(
20
- l !== void 0 && l >= 0
21
- ), { getLabel: D } = E(), {
22
- size: d,
23
- classes: I,
24
- reorderable: u,
25
- externalSortSettings: b,
26
- externalFilterSettings: w,
27
- currentRowHeightVariant: k
28
- } = X(), { activeFilters: a, filters: v, onChangeFilter: m } = Y(), [R, f] = z(v?.get(t.key) || ""), p = b?.sortsApplied?.find(
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
- ), H = w?.filtersApplied?.find(
58
+ ), E = A?.filtersApplied?.find(
31
59
  (e) => e.columnKey === t.key
32
- ), [{ isDragging: F }, A] = G({
60
+ ), [{ isDragging: _ }, j] = q({
33
61
  type: "COLUMN_DRAG",
34
- item: { key: t.key },
35
- canDrag: () => u,
62
+ item: B,
63
+ canDrag: () => g,
36
64
  collect: (e) => ({
37
65
  isDragging: e.isDragging()
38
66
  })
39
- }), [{ isOver: N }, O] = L({
67
+ }), [{ isOver: G }, K] = Q({
40
68
  accept: "COLUMN_DRAG",
41
- canDrop: () => u,
69
+ canDrop: () => g,
42
70
  drop({ key: e }) {
43
- h(e, t.key);
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
- }), P = (e) => {
53
- a && m && m(t, e.target.value), f(e.target.value);
54
- }, _ = (e) => e === "asc" ? i.sortAsc : i.sortDesc, j = () => {
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 (p) {
57
- const n = _(p.direction);
84
+ if (S) {
85
+ const n = $(S.direction);
58
86
  e.push(
59
- /* @__PURE__ */ r(
60
- g,
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 (H?.isValid) {
71
- const n = i.filter2;
98
+ if (E?.isValid) {
99
+ const n = c.filter2;
72
100
  e.push(
73
- /* @__PURE__ */ r(
74
- g,
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
- B(() => {
87
- a || f("");
88
- }, [a]);
89
- const o = { ...t };
90
- if (o.withinHeaderRenderer && (o.name = o.withinHeaderRenderer(s)), !o.withinHeaderRenderer) {
91
- const e = j();
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
- o.name = /* @__PURE__ */ c($, { ownerState: {}, style: { justifyContent: n() }, children: [
106
- /* @__PURE__ */ r(K, { ownerState: { size: d, currentRowHeightVariant: k }, children: o.name }),
107
- /* @__PURE__ */ r(T, { ownerState: {}, children: e })
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__ */ c(
112
- U,
139
+ return /* @__PURE__ */ u(
140
+ te,
113
141
  {
114
142
  ownerState: {},
115
- className: I?.draggableHeaderRoot,
143
+ className: F?.draggableHeaderRoot,
116
144
  ref: (e) => {
117
- A(e), O(e);
145
+ j(e), K(e);
118
146
  },
119
147
  style: {
120
- opacity: F ? 0.5 : 1,
121
- backgroundColor: N ? "#ececec" : void 0
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__ */ r(
128
- V,
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: (e) => {
134
- y?.(e.currentTarget, t.key);
135
- },
136
- children: /* @__PURE__ */ r(
137
- M,
161
+ onClick: O,
162
+ children: /* @__PURE__ */ o(
163
+ X,
138
164
  {
139
- column: o,
140
- tabIndex: l,
141
- ...S
165
+ column: l,
166
+ tabIndex: s,
167
+ ...I
142
168
  }
143
169
  )
144
170
  }
145
171
  ),
146
- a && (t?.withFilter === void 0 || t.withFilter === !0) && /* @__PURE__ */ c(J, { ownerState: {}, children: [
147
- /* @__PURE__ */ r(
148
- W,
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: i.search,
177
+ src: c.search,
152
178
  color: "text.secondary",
153
- size: d
179
+ size: f
154
180
  }
155
181
  ),
156
- /* @__PURE__ */ r(
157
- q,
182
+ /* @__PURE__ */ o(
183
+ le,
158
184
  {
159
185
  ownerState: {},
160
- inputRef: x,
161
- placeholder: D("data_grid.filter_holder"),
162
- tabIndex: C,
186
+ inputRef: w,
187
+ placeholder: R("data_grid.filter_holder"),
188
+ tabIndex: H,
163
189
  type: "text",
164
- onChange: P,
165
- value: R,
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
- de as DraggableHeaderRenderer
204
+ Ie as DraggableHeaderRenderer
179
205
  };
@@ -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
@@ -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;CAClE"}
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;