@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,121 +1,132 @@
1
- import { jsx as a } from "@emotion/react/jsx-runtime";
2
- import { useRef as g, useCallback as v, useEffect as D } from "react";
3
- import { ListContainerStyled as O, ListVirtualContainerStyled as P, ListRowVirtualizedItemStyled as B } from "../../slots/DataGridSlot.js";
4
- import { useProcessedColumns as y } from "./hooks/useProcessedColumns/useProcessedColumns.js";
5
- import { useModalDetail as j } from "./hooks/useModalDetail/useModalDetail.js";
1
+ import { jsx as d } from "@emotion/react/jsx-runtime";
2
+ import { useRef as y, useCallback as u, useEffect as B } from "react";
3
+ import { ListContainerStyled as H, ListVirtualContainerStyled as O, ListRowVirtualizedItemStyled as j } from "../../slots/DataGridSlot.js";
4
+ import { useProcessedColumns as v } from "./hooks/useProcessedColumns/useProcessedColumns.js";
5
+ import { useModalDetail as q } from "./hooks/useModalDetail/useModalDetail.js";
6
6
  import { useListVirtualizer as A } from "./hooks/useListVirtualizer/useListVirtualizer.js";
7
- import { useArrowKeyNavigation as F } from "../../hooks/shared/useArrowKeyNavigation/useArrowKeyNavigation.js";
8
- import { ListRow as G } from "./subcomponents/ListRow/ListRow.js";
9
- function X(S) {
7
+ import { useInfiniteScroll as F } from "../../hooks/shared/useInfiniteScroll/useInfiniteScroll.js";
8
+ import { useArrowKeyNavigation as G } from "../../hooks/shared/useArrowKeyNavigation/useArrowKeyNavigation.js";
9
+ import { ListRow as M } from "./subcomponents/ListRow/ListRow.js";
10
+ function $(I) {
10
11
  const {
11
12
  rows: t,
12
- columns: m,
13
+ columns: w,
13
14
  rowKeyGetter: n,
14
- selectedRows: f,
15
+ selectedRows: h,
15
16
  onSelectedRowsChange: i,
16
- onRowsChange: w,
17
+ onRowsChange: g,
17
18
  focusOnRowKey: r,
18
- smoothScroll: h = !0,
19
- checkedRows: d,
20
- onCheckedRowsChange: p,
19
+ smoothScroll: p = !0,
20
+ checkedRows: m,
21
+ onCheckedRowsChange: R,
21
22
  listViewConfig: e
22
- } = S, R = g(null), u = g(void 0), x = y(m), C = y(m, {
23
+ } = I, l = y(null), f = y(void 0), E = u(() => l.current, []), b = u(
24
+ () => l.current?.querySelector("[data-index]")?.getBoundingClientRect().height,
25
+ []
26
+ ), x = v(w), C = v(w, {
23
27
  applyVisibilityFilter: !1
24
- }), b = j({
28
+ }), k = q({
25
29
  columns: C,
26
- onRowsChange: w,
30
+ onRowsChange: g,
27
31
  rows: t
28
- }), k = e && "customRender" in e && e.customRender ? e.customRender.minHeight : void 0, E = v(
32
+ }), K = e && "customRender" in e && e.customRender ? e.customRender.minHeight : void 0, L = u(
29
33
  (o) => n(t[o]),
30
34
  [n, t]
31
- ), { virtualizer: s, virtualItems: I, totalSize: K } = A({
35
+ ), { virtualizer: s, virtualItems: T, totalSize: S } = A({
32
36
  count: t.length,
33
- scrollElementRef: R,
34
- estimateSize: k,
35
- getItemKey: E
36
- }), L = v(
37
+ scrollElementRef: l,
38
+ estimateSize: K,
39
+ getItemKey: L
40
+ });
41
+ F({
42
+ getScrollElement: E,
43
+ contentHeight: S,
44
+ getItemHeight: b,
45
+ itemsPerRow: 1
46
+ });
47
+ const V = u(
37
48
  (o) => {
38
49
  s.scrollToIndex(o, { align: "auto", behavior: "auto" });
39
50
  },
40
51
  [s]
41
- ), { onKeyDown: T } = F({
52
+ ), { onKeyDown: z } = G({
42
53
  rows: t,
43
54
  rowKeyGetter: n,
44
- selectedRows: f,
55
+ selectedRows: h,
45
56
  onSelectedRowsChange: i,
46
57
  itemsPerRow: 1,
47
- scrollToIndex: L
58
+ scrollToIndex: V
48
59
  });
49
- return D(() => {
60
+ return B(() => {
50
61
  if (!r) {
51
- u.current = void 0;
62
+ f.current = void 0;
52
63
  return;
53
64
  }
54
- if (u.current === r)
65
+ if (f.current === r)
55
66
  return;
56
67
  const o = t.findIndex(
57
- (c) => n(c) === r
68
+ (a) => n(a) === r
58
69
  );
59
70
  if (o === -1)
60
71
  return;
61
- const l = setTimeout(() => {
62
- s.scrollToIndex(o, { align: "center", behavior: h ? "smooth" : "auto" }), i && i(/* @__PURE__ */ new Set([r])), u.current = r;
72
+ const c = setTimeout(() => {
73
+ s.scrollToIndex(o, { align: "center", behavior: p ? "smooth" : "auto" }), i && i(/* @__PURE__ */ new Set([r])), f.current = r;
63
74
  }, 300);
64
- return () => clearTimeout(l);
75
+ return () => clearTimeout(c);
65
76
  }, [
66
77
  r,
67
78
  t,
68
79
  n,
69
80
  i,
70
81
  s,
71
- h
72
- ]), x.length === 0 ? null : /* @__PURE__ */ a(
73
- O,
82
+ p
83
+ ]), x.length === 0 ? null : /* @__PURE__ */ d(
84
+ H,
74
85
  {
75
- ref: R,
86
+ ref: l,
76
87
  ownerState: {},
77
88
  "data-testid": "list-view",
78
89
  role: "group",
79
90
  "aria-label": "datagrid-view-list",
80
91
  tabIndex: 0,
81
- onKeyDown: T,
82
- children: /* @__PURE__ */ a(P, { ownerState: { totalSize: K }, children: I.map((o) => {
83
- const l = t[o.index], c = n(l), V = d?.has(c) ?? !1, z = d !== void 0 && p !== void 0;
84
- return /* @__PURE__ */ a(
85
- B,
92
+ onKeyDown: z,
93
+ children: /* @__PURE__ */ d(O, { ownerState: { totalSize: S }, children: T.map((o) => {
94
+ const c = t[o.index], a = n(c), D = m?.has(a) ?? !1, P = m !== void 0 && R !== void 0;
95
+ return /* @__PURE__ */ d(
96
+ j,
86
97
  {
87
98
  ref: s.measureElement,
88
99
  ownerState: { offsetTop: o.start },
89
100
  "data-index": o.index,
90
- children: /* @__PURE__ */ a(
91
- G,
101
+ children: /* @__PURE__ */ d(
102
+ M,
92
103
  {
93
- row: l,
104
+ row: c,
94
105
  rows: t,
95
106
  rowIndex: o.index,
96
107
  columns: x,
97
108
  originalColumns: C,
98
109
  rowKeyGetter: n,
99
- selectedRows: f,
110
+ selectedRows: h,
100
111
  onSelectedRowsChange: i,
101
- onRowsChange: w,
112
+ onRowsChange: g,
102
113
  customRender: e && "customRender" in e ? e.customRender : void 0,
103
- isChecked: V,
104
- showCheckbox: z,
105
- checkedRows: d,
106
- onCheckedRowsChange: p,
107
- onOpenDetail: b,
114
+ isChecked: D,
115
+ showCheckbox: P,
116
+ checkedRows: m,
117
+ onCheckedRowsChange: R,
118
+ onOpenDetail: k,
108
119
  showExpandButton: e && "columnsConfig" in e ? e.showExpandButton : void 0,
109
120
  onExpandClick: e && "columnsConfig" in e ? e.onExpandClick : void 0
110
121
  }
111
122
  )
112
123
  },
113
- c
124
+ a
114
125
  );
115
126
  }) })
116
127
  }
117
128
  );
118
129
  }
119
130
  export {
120
- X as ListView
131
+ $ as ListView
121
132
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TableView.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/views/TableView/TableView.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAmBrD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACvE,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,oDA2Z/C"}
1
+ {"version":3,"file":"TableView.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/views/TableView/TableView.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAoBrD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACvE,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,oDA4a/C"}
@@ -1,50 +1,51 @@
1
- import { jsx as m, jsxs as oe } from "@emotion/react/jsx-runtime";
2
- import { useMemo as C, useState as W, useRef as q, useEffect as x } from "react";
3
- import re, { TreeDataGrid as te } from "react-data-grid";
4
- import { DndProvider as ne } from "react-dnd";
5
- import { HTML5Backend as le } from "react-dnd-html5-backend";
6
- import { TableContainerStyled as ie, TableWrapperDataGridStyled as se } from "../../slots/DataGridSlot.js";
7
- import { useSortColumnsRows as ae } from "./hooks/useSortColumnsRows/useSortColumnsRows.js";
8
- import { getGroupBy as ce } from "./helpers/getGroupBy/getGroupBy.js";
9
- import { defaultRowGrouper as ue } from "./helpers/defaultRowGrouper/defaultRowGrouper.js";
10
- import { createRowCellsBackgroundMap as me, processColumnsWithRowCellsBackground as de } from "./helpers/rowCellsBackground/rowCellsBackground.js";
11
- import { useHeaderMenuActions as fe } from "./hooks/useHeaderMenuActions/useHeaderMenuActions.js";
12
- import { filterHeight as z } from "./subcomponents/SelectColumn/SelectColumn.js";
13
- import { HeaderRenderClick as pe } from "./subcomponents/HeaderRenderClick/HeaderRenderClick.js";
14
- import { getDefaultAction as he } from "../../helpers/shared/getDefaultAction/getDefaultAction.js";
15
- import { useFilters as Ce } from "../../hooks/shared/useFilters/useFilters.js";
16
- import { useDataGrid as we } from "../../hooks/shared/useDataGrid/useDataGrid.js";
17
- import { CheckboxFormatter as ge } from "./subcomponents/CheckboxFormatter/CheckboxFormatter.js";
18
- function Oe(L) {
1
+ import { jsx as m, jsxs as ne } from "@emotion/react/jsx-runtime";
2
+ import { useMemo as g, useState as W, useRef as q, useCallback as z, useEffect as x } from "react";
3
+ import le, { TreeDataGrid as ie } from "react-data-grid";
4
+ import { DndProvider as se } from "react-dnd";
5
+ import { HTML5Backend as ae } from "react-dnd-html5-backend";
6
+ import { TableContainerStyled as ce, TableWrapperDataGridStyled as ue } from "../../slots/DataGridSlot.js";
7
+ import { useSortColumnsRows as me } from "./hooks/useSortColumnsRows/useSortColumnsRows.js";
8
+ import { getGroupBy as de } from "./helpers/getGroupBy/getGroupBy.js";
9
+ import { defaultRowGrouper as fe } from "./helpers/defaultRowGrouper/defaultRowGrouper.js";
10
+ import { createRowCellsBackgroundMap as pe, processColumnsWithRowCellsBackground as he } from "./helpers/rowCellsBackground/rowCellsBackground.js";
11
+ import { useInfiniteScroll as Ce } from "../../hooks/shared/useInfiniteScroll/useInfiniteScroll.js";
12
+ import { useHeaderMenuActions as ge } from "./hooks/useHeaderMenuActions/useHeaderMenuActions.js";
13
+ import { filterHeight as L } from "./subcomponents/SelectColumn/SelectColumn.js";
14
+ import { HeaderRenderClick as we } from "./subcomponents/HeaderRenderClick/HeaderRenderClick.js";
15
+ import { getDefaultAction as Se } from "../../helpers/shared/getDefaultAction/getDefaultAction.js";
16
+ import { useFilters as ye } from "../../hooks/shared/useFilters/useFilters.js";
17
+ import { useDataGrid as xe } from "../../hooks/shared/useDataGrid/useDataGrid.js";
18
+ import { CheckboxFormatter as be } from "./subcomponents/CheckboxFormatter/CheckboxFormatter.js";
19
+ function ze($) {
19
20
  const {
20
- columns: $,
21
- rows: j,
21
+ columns: j,
22
+ rows: N,
22
23
  onRowsChange: b,
23
24
  rowKeyGetter: r,
24
25
  selectedRows: n,
25
26
  onSelectedRowsChange: t,
26
- defaultColumnOptions: N,
27
- focusOnRowKey: i,
27
+ defaultColumnOptions: V,
28
+ focusOnRowKey: s,
28
29
  smoothScroll: R = !0,
29
30
  rowCellsBackground: d,
30
- treeProps: s,
31
+ treeProps: a,
31
32
  ...v
32
- } = L, k = (e) => /* @__PURE__ */ m(
33
- ge,
33
+ } = $, k = (e) => /* @__PURE__ */ m(
34
+ be,
34
35
  {
35
36
  ...e,
36
37
  tabIndex: e.tabIndex
37
38
  }
38
- ), { finalColumns: a, finalRows: c } = ae(
39
- $,
39
+ ), { finalColumns: c, finalRows: u } = me(
40
40
  j,
41
- C(
41
+ N,
42
+ g(
42
43
  () => ({
43
44
  /**
44
45
  * Función que abre el menú de acciones para una columna
45
46
  */
46
47
  openPopover: (e, o) => {
47
- e instanceof HTMLDivElement && E({
48
+ e instanceof HTMLDivElement && D({
48
49
  anchorEl: e,
49
50
  columnKey: o
50
51
  });
@@ -52,150 +53,157 @@ function Oe(L) {
52
53
  }),
53
54
  []
54
55
  )
55
- ), { activeFilters: G } = Ce(), {
56
- onChangeColumnWidth: V,
57
- setRowsCount: _,
58
- currentRowHeight: w,
56
+ ), { activeFilters: H } = ye(), {
57
+ onChangeColumnWidth: _,
58
+ setRowsCount: J,
59
+ currentRowHeight: f,
59
60
  currentRowHeaderHeight: p,
60
- currentRowHeightVariant: g,
61
- size: J,
62
- sortColumns: f,
63
- setSortColumns: H,
61
+ currentRowHeightVariant: w,
62
+ size: Q,
63
+ sortColumns: h,
64
+ setSortColumns: G,
64
65
  columnsConfig: I,
65
66
  rowActionsGetter: B
66
- } = we(), Q = C(() => s ? ce(I) : [], [I, s]), U = s?.rowGrouper ?? ue, A = C(() => {
67
+ } = xe(), U = g(() => a ? de(I) : [], [I, a]), X = a?.rowGrouper ?? fe, E = g(() => {
67
68
  if (d)
68
- return typeof d == "function" ? d : me(d);
69
- }, [d]), D = C(
70
- () => de(
71
- a,
72
- A,
69
+ return typeof d == "function" ? d : pe(d);
70
+ }, [d]), A = g(
71
+ () => he(
72
+ c,
73
+ E,
73
74
  r,
74
- g
75
+ w
75
76
  ),
76
- [a, A, r, g]
77
- ), u = q(null), [h, E] = W({
77
+ [c, E, r, w]
78
+ ), l = q(null), Y = z(() => l.current?.element, []), Z = z(() => f, [f]);
79
+ Ce({
80
+ getScrollElement: Y,
81
+ getItemHeight: Z,
82
+ itemsPerRow: 1,
83
+ headerHeight: p
84
+ });
85
+ const [C, D] = W({
78
86
  anchorEl: null,
79
87
  columnKey: null
80
- }), S = q(void 0), [X, K] = W(!1), T = (e) => {
81
- X && (H(e), K(!1));
82
- }, Y = (e) => {
83
- K(!0), H(e);
84
- }, M = ({ row: e }) => {
88
+ }), S = q(void 0), [ee, K] = W(!1), T = (e) => {
89
+ ee && (G(e), K(!1));
90
+ }, oe = (e) => {
91
+ K(!0), G(e);
92
+ }, P = ({ row: e }) => {
85
93
  if (n && t) {
86
94
  if (n.entries().next().value && n.entries().next().value?.[1] === r(e))
87
95
  return;
88
96
  const o = /* @__PURE__ */ new Set([r(e)]);
89
97
  t(o);
90
98
  }
91
- }, O = ({ row: e }) => {
99
+ }, M = ({ row: e }) => {
92
100
  if (n && t && e) {
93
101
  const o = r(e);
94
102
  n.has(o) || t(/* @__PURE__ */ new Set([o]));
95
103
  }
96
- }, P = ({ row: e }) => {
104
+ }, O = ({ row: e }) => {
97
105
  if (!B)
98
106
  return;
99
- const o = B(e), l = he(o);
100
- l?.disabled || l?.onClick && l.onClick(e);
107
+ const o = B(e), i = Se(o);
108
+ i?.disabled || i?.onClick && i.onClick(e);
101
109
  };
102
110
  x(() => {
103
111
  let e = 0;
104
- for (const o of a) {
105
- const l = f.findIndex(
106
- (ee) => o.key === ee.columnKey
112
+ for (const o of c) {
113
+ const i = h.findIndex(
114
+ (te) => o.key === te.columnKey
107
115
  );
108
- l !== -1 ? u.current?.element?.querySelector(
116
+ i !== -1 ? l.current?.element?.querySelector(
109
117
  `[role="columnheader"][aria-colindex="${e + 1}"]`
110
- )?.setAttribute("aria-columnsort", `${f[l].direction}`) : u.current?.element?.querySelector(
118
+ )?.setAttribute("aria-columnsort", `${h[i].direction}`) : l.current?.element?.querySelector(
111
119
  `[role="columnheader"][aria-colindex="${e + 1}"]`
112
120
  )?.removeAttribute("aria-columnsort"), e++;
113
121
  }
114
- }, [f, a]), x(() => {
115
- _(c.length);
116
- }, [c]), x(() => {
117
- if (!i) {
122
+ }, [h, c]), x(() => {
123
+ J(u.length);
124
+ }, [u]), x(() => {
125
+ if (!s) {
118
126
  S.current = void 0;
119
127
  return;
120
128
  }
121
- if (S.current === i)
129
+ if (S.current === s)
122
130
  return;
123
- const e = c.findIndex(
124
- (o) => r(o) === i
131
+ const e = u.findIndex(
132
+ (o) => r(o) === s
125
133
  );
126
134
  if (e !== -1) {
127
- const o = u.current?.element;
128
- o?.style && (o.style.scrollBehavior = R ? "smooth" : "auto"), u.current?.scrollToCell({ rowIdx: e }), o?.style && requestAnimationFrame(() => {
135
+ const o = l.current?.element;
136
+ o?.style && (o.style.scrollBehavior = R ? "smooth" : "auto"), l.current?.scrollToCell({ rowIdx: e }), o?.style && requestAnimationFrame(() => {
129
137
  o.style.scrollBehavior = "";
130
- }), t && t(/* @__PURE__ */ new Set([i])), S.current = i;
138
+ }), t && t(/* @__PURE__ */ new Set([s])), S.current = s;
131
139
  }
132
- }, [i, c, r, t, R]);
140
+ }, [s, u, r, t, R]);
133
141
  const F = (e, o) => {
134
- V(a[e].key, o);
142
+ _(c[e].key, o);
135
143
  }, y = {
136
144
  resizable: !0,
137
145
  sortable: !0,
138
- ...N || {}
139
- }, Z = fe(
140
- h.columnKey,
141
- a,
146
+ ...V || {}
147
+ }, re = ge(
148
+ C.columnKey,
149
+ c,
142
150
  !!y.sortable,
143
- Y
151
+ oe
144
152
  );
145
- return /* @__PURE__ */ m(ie, { ownerState: {}, id: "WrapperTable", children: /* @__PURE__ */ oe(
146
- se,
153
+ return /* @__PURE__ */ m(ce, { ownerState: {}, id: "WrapperTable", children: /* @__PURE__ */ ne(
154
+ ue,
147
155
  {
148
- ownerState: { size: J, currentRowHeightVariant: g, currentRowHeight: w },
156
+ ownerState: { size: Q, currentRowHeightVariant: w, currentRowHeight: f },
149
157
  children: [
150
- /* @__PURE__ */ m(ne, { backend: le, context: window, children: s ? /* @__PURE__ */ m(
151
- te,
158
+ /* @__PURE__ */ m(se, { backend: ae, context: window, children: a ? /* @__PURE__ */ m(
159
+ ie,
152
160
  {
153
161
  className: "rdg-light",
154
162
  "aria-label": "datagrid-view-table",
155
- ref: u,
156
- headerRowHeight: G ? p + z : p,
157
- columns: D,
158
- sortColumns: f,
163
+ ref: l,
164
+ headerRowHeight: H ? p + L : p,
165
+ columns: A,
166
+ sortColumns: h,
159
167
  onSortColumnsChange: T,
160
168
  onColumnResize: F,
161
- rows: c,
169
+ rows: u,
162
170
  onRowsChange: b,
163
171
  selectedRows: n,
164
172
  onSelectedRowsChange: t,
165
- onCellClick: M,
166
- onCellDoubleClick: P,
167
- onSelectedCellChange: O,
168
- rowHeight: w,
173
+ onCellClick: P,
174
+ onCellDoubleClick: O,
175
+ onSelectedCellChange: M,
176
+ rowHeight: f,
169
177
  rowKeyGetter: r,
170
178
  renderers: {
171
179
  renderCheckbox: k
172
180
  },
173
181
  defaultColumnOptions: y,
174
- groupBy: Q,
175
- rowGrouper: U,
176
- expandedGroupIds: s.expandedGroupIds,
177
- onExpandedGroupIdsChange: s.onExpandedGroupIdsChange,
182
+ groupBy: U,
183
+ rowGrouper: X,
184
+ expandedGroupIds: a.expandedGroupIds,
185
+ onExpandedGroupIdsChange: a.onExpandedGroupIdsChange,
178
186
  ...v
179
187
  }
180
188
  ) : /* @__PURE__ */ m(
181
- re,
189
+ le,
182
190
  {
183
191
  className: "rdg-light",
184
192
  "aria-label": "datagrid-view-table",
185
- ref: u,
186
- headerRowHeight: G ? p + z : p,
187
- columns: D,
188
- sortColumns: f,
193
+ ref: l,
194
+ headerRowHeight: H ? p + L : p,
195
+ columns: A,
196
+ sortColumns: h,
189
197
  onSortColumnsChange: T,
190
198
  onColumnResize: F,
191
- rows: c,
199
+ rows: u,
192
200
  onRowsChange: b,
193
201
  selectedRows: n,
194
202
  onSelectedRowsChange: t,
195
- onCellClick: M,
196
- onCellDoubleClick: P,
197
- onSelectedCellChange: O,
198
- rowHeight: w,
203
+ onCellClick: P,
204
+ onCellDoubleClick: O,
205
+ onSelectedCellChange: M,
206
+ rowHeight: f,
199
207
  rowKeyGetter: r,
200
208
  renderers: {
201
209
  renderCheckbox: k
@@ -204,17 +212,17 @@ function Oe(L) {
204
212
  ...v
205
213
  }
206
214
  ) }),
207
- h.columnKey && h.anchorEl instanceof HTMLDivElement && /* @__PURE__ */ m(
208
- pe,
215
+ C.columnKey && C.anchorEl instanceof HTMLDivElement && /* @__PURE__ */ m(
216
+ we,
209
217
  {
210
- externalOpen: h.anchorEl,
218
+ externalOpen: C.anchorEl,
211
219
  onOpen: (e) => {
212
- e || E({
220
+ e || D({
213
221
  anchorEl: null,
214
222
  columnKey: null
215
223
  });
216
224
  },
217
- menuActions: Z
225
+ menuActions: re
218
226
  }
219
227
  )
220
228
  ]
@@ -222,5 +230,5 @@ function Oe(L) {
222
230
  ) });
223
231
  }
224
232
  export {
225
- Oe as TableView
233
+ ze as TableView
226
234
  };
@@ -6,5 +6,6 @@ import { RenderHeaderCellProps } from 'react-data-grid';
6
6
  */
7
7
  export declare const getDragHeaderRenderer: <TRow, TSummaryRow>(handleColumnsReorder: (sourceKey: string, targetKey: string) => void, options?: {
8
8
  openPopover?: (anchorEl: HTMLElement, columnKey: string) => void;
9
+ headerClickDeferMs?: number;
9
10
  }) => FunctionComponent<RenderHeaderCellProps<TRow, TSummaryRow>>;
10
11
  //# sourceMappingURL=getDragHeaderRenderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDragHeaderRenderer.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/helpers/getDragHeaderRenderer/getDragHeaderRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGxD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,IAAI,EAAE,WAAW,EACrD,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,EACpE,UAAU;IACR,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE,KACA,iBAAiB,CAAC,qBAAqB,CAAC,IAAI,EAAE,WAAW,CAAC,CAgB5D,CAAC"}
1
+ {"version":3,"file":"getDragHeaderRenderer.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/helpers/getDragHeaderRenderer/getDragHeaderRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGxD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,IAAI,EAAE,WAAW,EACrD,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,EACpE,UAAU;IACR,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,KACA,iBAAiB,CAAC,qBAAqB,CAAC,IAAI,EAAE,WAAW,CAAC,CAiB5D,CAAC"}
@@ -1,18 +1,19 @@
1
- import { jsx as t } from "@emotion/react/jsx-runtime";
2
- import { DraggableHeaderRenderer as d } from "../../subcomponents/DraggableHeaderRenderer/DraggableHeaderRenderer.js";
3
- const m = (e, r) => {
1
+ import { jsx as d } from "@emotion/react/jsx-runtime";
2
+ import { DraggableHeaderRenderer as a } from "../../subcomponents/DraggableHeaderRenderer/DraggableHeaderRenderer.js";
3
+ const f = (r, e) => {
4
4
  function o(n) {
5
- return /* @__PURE__ */ t(
6
- d,
5
+ return /* @__PURE__ */ d(
6
+ a,
7
7
  {
8
8
  ...n,
9
- onColumnsReorder: e,
10
- openPopover: r?.openPopover
9
+ onColumnsReorder: r,
10
+ openPopover: e?.openPopover,
11
+ headerClickDeferMs: e?.headerClickDeferMs
11
12
  }
12
13
  );
13
14
  }
14
15
  return o;
15
16
  };
16
17
  export {
17
- m as getDragHeaderRenderer
18
+ f as getDragHeaderRenderer
18
19
  };
@@ -0,0 +1,2 @@
1
+ export * from './useColumnSortRules';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/hooks/useColumnSortRules/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { Column, SortColumn } from 'react-data-grid';
2
+ import { SortDirection } from '../../../../types';
3
+ type SortDirectionState = 'none' | Lowercase<SortDirection>;
4
+ interface UseColumnSortRulesProps<TRow, TSummaryRow> {
5
+ columnKey: string | null;
6
+ column: Column<TRow, TSummaryRow> | undefined;
7
+ defaultSortable: boolean;
8
+ handleSortFromPopover?: (newSortColumns: SortColumn[]) => void;
9
+ }
10
+ interface UseColumnSortRulesResult {
11
+ canSort: boolean;
12
+ canSortExternally: boolean;
13
+ canToggleSort: boolean;
14
+ direction: SortDirectionState;
15
+ isRemovable: boolean;
16
+ toggleSort: () => void;
17
+ clearLocalSort: () => void;
18
+ removeSort: () => void;
19
+ addExternalSort: (direction: Lowercase<SortDirection>) => void;
20
+ executeSortChange: (newSortColumns: SortColumn[]) => void;
21
+ }
22
+ /** Share the column sort rules and next-direction action used by header interactions. */
23
+ export declare function useColumnSortRules<TRow, TSummaryRow>({ columnKey, column, defaultSortable, handleSortFromPopover, }: UseColumnSortRulesProps<TRow, TSummaryRow>): UseColumnSortRulesResult;
24
+ export {};
25
+ //# sourceMappingURL=useColumnSortRules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useColumnSortRules.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/TableView/hooks/useColumnSortRules/useColumnSortRules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,KAAK,kBAAkB,GAAG,MAAM,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC;AAE5D,UAAU,uBAAuB,CAAC,IAAI,EAAE,WAAW;IACjD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,SAAS,CAAC;IAC9C,eAAe,EAAE,OAAO,CAAC;IACzB,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CAChE;AAED,UAAU,wBAAwB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,eAAe,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAC/D,iBAAiB,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CAC3D;AAED,yFAAyF;AACzF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,EACpD,SAAS,EACT,MAAM,EACN,eAAe,EACf,qBAAqB,GACtB,EAAE,uBAAuB,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,wBAAwB,CAsLvE"}