@m4l/components 9.58.0 → 9.59.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/datagrids/views/ListView/ListView.d.ts.map +1 -1
- package/components/datagrids/views/ListView/ListView.js +40 -36
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/types.d.ts +5 -0
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/types.d.ts.map +1 -1
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.d.ts +1 -1
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.d.ts.map +1 -1
- package/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.js +8 -6
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/views/ListView/ListView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAOxC;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACtE,KAAK,EAAE,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/views/ListView/ListView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAOxC;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACtE,KAAK,EAAE,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,2DAiM9C"}
|
|
@@ -1,72 +1,76 @@
|
|
|
1
1
|
import { jsx as a } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useRef as g, useCallback as
|
|
3
|
-
import { ListContainerStyled as
|
|
4
|
-
import { useProcessedColumns as
|
|
5
|
-
import { useModalDetail as
|
|
6
|
-
import { useListVirtualizer as
|
|
7
|
-
import { useArrowKeyNavigation as
|
|
8
|
-
import { ListRow as
|
|
9
|
-
function
|
|
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";
|
|
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) {
|
|
10
10
|
const {
|
|
11
11
|
rows: t,
|
|
12
12
|
columns: m,
|
|
13
|
-
rowKeyGetter:
|
|
13
|
+
rowKeyGetter: n,
|
|
14
14
|
selectedRows: f,
|
|
15
15
|
onSelectedRowsChange: i,
|
|
16
16
|
onRowsChange: w,
|
|
17
|
-
focusOnRowKey:
|
|
17
|
+
focusOnRowKey: r,
|
|
18
18
|
smoothScroll: h = !0,
|
|
19
19
|
checkedRows: d,
|
|
20
20
|
onCheckedRowsChange: p,
|
|
21
21
|
listViewConfig: e
|
|
22
|
-
} = S, R = g(null), u = g(void 0), x =
|
|
22
|
+
} = S, R = g(null), u = g(void 0), x = y(m), C = y(m, {
|
|
23
23
|
applyVisibilityFilter: !1
|
|
24
|
-
}),
|
|
24
|
+
}), b = j({
|
|
25
25
|
columns: C,
|
|
26
26
|
onRowsChange: w,
|
|
27
27
|
rows: t
|
|
28
|
-
}),
|
|
28
|
+
}), k = e && "customRender" in e && e.customRender ? e.customRender.minHeight : void 0, E = v(
|
|
29
|
+
(o) => n(t[o]),
|
|
30
|
+
[n, t]
|
|
31
|
+
), { virtualizer: s, virtualItems: I, totalSize: K } = A({
|
|
29
32
|
count: t.length,
|
|
30
33
|
scrollElementRef: R,
|
|
31
|
-
estimateSize:
|
|
32
|
-
|
|
34
|
+
estimateSize: k,
|
|
35
|
+
getItemKey: E
|
|
36
|
+
}), L = v(
|
|
33
37
|
(o) => {
|
|
34
38
|
s.scrollToIndex(o, { align: "auto", behavior: "auto" });
|
|
35
39
|
},
|
|
36
40
|
[s]
|
|
37
|
-
), { onKeyDown:
|
|
41
|
+
), { onKeyDown: T } = F({
|
|
38
42
|
rows: t,
|
|
39
|
-
rowKeyGetter:
|
|
43
|
+
rowKeyGetter: n,
|
|
40
44
|
selectedRows: f,
|
|
41
45
|
onSelectedRowsChange: i,
|
|
42
46
|
itemsPerRow: 1,
|
|
43
|
-
scrollToIndex:
|
|
47
|
+
scrollToIndex: L
|
|
44
48
|
});
|
|
45
|
-
return
|
|
46
|
-
if (!
|
|
49
|
+
return D(() => {
|
|
50
|
+
if (!r) {
|
|
47
51
|
u.current = void 0;
|
|
48
52
|
return;
|
|
49
53
|
}
|
|
50
|
-
if (u.current ===
|
|
54
|
+
if (u.current === r)
|
|
51
55
|
return;
|
|
52
56
|
const o = t.findIndex(
|
|
53
|
-
(c) =>
|
|
57
|
+
(c) => n(c) === r
|
|
54
58
|
);
|
|
55
59
|
if (o === -1)
|
|
56
60
|
return;
|
|
57
61
|
const l = setTimeout(() => {
|
|
58
|
-
s.scrollToIndex(o, { align: "center", behavior: h ? "smooth" : "auto" }), i && i(/* @__PURE__ */ new Set([
|
|
62
|
+
s.scrollToIndex(o, { align: "center", behavior: h ? "smooth" : "auto" }), i && i(/* @__PURE__ */ new Set([r])), u.current = r;
|
|
59
63
|
}, 300);
|
|
60
64
|
return () => clearTimeout(l);
|
|
61
65
|
}, [
|
|
62
|
-
n,
|
|
63
|
-
t,
|
|
64
66
|
r,
|
|
67
|
+
t,
|
|
68
|
+
n,
|
|
65
69
|
i,
|
|
66
70
|
s,
|
|
67
71
|
h
|
|
68
72
|
]), x.length === 0 ? null : /* @__PURE__ */ a(
|
|
69
|
-
|
|
73
|
+
O,
|
|
70
74
|
{
|
|
71
75
|
ref: R,
|
|
72
76
|
ownerState: {},
|
|
@@ -74,33 +78,33 @@ function W(S) {
|
|
|
74
78
|
role: "group",
|
|
75
79
|
"aria-label": "datagrid-view-list",
|
|
76
80
|
tabIndex: 0,
|
|
77
|
-
onKeyDown:
|
|
78
|
-
children: /* @__PURE__ */ a(
|
|
79
|
-
const l = t[o.index], c =
|
|
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;
|
|
80
84
|
return /* @__PURE__ */ a(
|
|
81
|
-
|
|
85
|
+
B,
|
|
82
86
|
{
|
|
83
87
|
ref: s.measureElement,
|
|
84
88
|
ownerState: { offsetTop: o.start },
|
|
85
89
|
"data-index": o.index,
|
|
86
90
|
children: /* @__PURE__ */ a(
|
|
87
|
-
|
|
91
|
+
G,
|
|
88
92
|
{
|
|
89
93
|
row: l,
|
|
90
94
|
rows: t,
|
|
91
95
|
rowIndex: o.index,
|
|
92
96
|
columns: x,
|
|
93
97
|
originalColumns: C,
|
|
94
|
-
rowKeyGetter:
|
|
98
|
+
rowKeyGetter: n,
|
|
95
99
|
selectedRows: f,
|
|
96
100
|
onSelectedRowsChange: i,
|
|
97
101
|
onRowsChange: w,
|
|
98
102
|
customRender: e && "customRender" in e ? e.customRender : void 0,
|
|
99
|
-
isChecked:
|
|
100
|
-
showCheckbox:
|
|
103
|
+
isChecked: V,
|
|
104
|
+
showCheckbox: z,
|
|
101
105
|
checkedRows: d,
|
|
102
106
|
onCheckedRowsChange: p,
|
|
103
|
-
onOpenDetail:
|
|
107
|
+
onOpenDetail: b,
|
|
104
108
|
showExpandButton: e && "columnsConfig" in e ? e.showExpandButton : void 0,
|
|
105
109
|
onExpandClick: e && "columnsConfig" in e ? e.onExpandClick : void 0
|
|
106
110
|
}
|
|
@@ -113,5 +117,5 @@ function W(S) {
|
|
|
113
117
|
);
|
|
114
118
|
}
|
|
115
119
|
export {
|
|
116
|
-
|
|
120
|
+
X as ListView
|
|
117
121
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
+
import { RowKey } from '../../../../types';
|
|
2
3
|
export interface UseListVirtualizerProps {
|
|
3
4
|
/**
|
|
4
5
|
* Total number of rows to virtualize.
|
|
@@ -23,5 +24,9 @@ export interface UseListVirtualizerProps {
|
|
|
23
24
|
* @default 120
|
|
24
25
|
*/
|
|
25
26
|
estimateSize?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the stable row identity used to cache each measured item size.
|
|
29
|
+
*/
|
|
30
|
+
getItemKey?: (index: number) => RowKey;
|
|
26
31
|
}
|
|
27
32
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useListVirtualizer/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useListVirtualizer/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,gBAAgB,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC"}
|
package/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { UseListVirtualizerProps } from './types';
|
|
|
11
11
|
* - `virtualItems` — array of items to render (each has `index`, `start` offset, and `size`)
|
|
12
12
|
* - `totalSize` — total scrollable height in pixels (set on the virtual container)
|
|
13
13
|
*/
|
|
14
|
-
export declare function useListVirtualizer({ count, scrollElementRef, overscan, estimateSize, }: UseListVirtualizerProps): {
|
|
14
|
+
export declare function useListVirtualizer({ count, scrollElementRef, overscan, estimateSize, getItemKey, }: UseListVirtualizerProps): {
|
|
15
15
|
virtualizer: import('@tanstack/virtual-core').Virtualizer<HTMLDivElement, Element>;
|
|
16
16
|
virtualItems: import('@tanstack/virtual-core').VirtualItem[];
|
|
17
17
|
totalSize: number;
|
package/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListVirtualizer.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AASlD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,gBAAgB,EAChB,QAAY,EACZ,YAAoC,
|
|
1
|
+
{"version":3,"file":"useListVirtualizer.d.ts","sourceRoot":"","sources":["../../../../../../../../../../packages/components/src/components/datagrids/views/ListView/hooks/useListVirtualizer/useListVirtualizer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AASlD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,gBAAgB,EAChB,QAAY,EACZ,YAAoC,EACpC,UAAU,GACX,EAAE,uBAAuB;;;;EAczB"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { useVirtualizer as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { useVirtualizer as o } from "@tanstack/react-virtual";
|
|
2
|
+
const a = 50;
|
|
3
|
+
function n({
|
|
4
4
|
count: e,
|
|
5
5
|
scrollElementRef: r,
|
|
6
6
|
overscan: i = 5,
|
|
7
|
-
estimateSize: l =
|
|
7
|
+
estimateSize: l = a,
|
|
8
|
+
getItemKey: u
|
|
8
9
|
}) {
|
|
9
|
-
const t =
|
|
10
|
+
const t = o({
|
|
10
11
|
count: e,
|
|
11
12
|
getScrollElement: () => r.current,
|
|
12
13
|
estimateSize: () => l,
|
|
14
|
+
getItemKey: u,
|
|
13
15
|
overscan: i
|
|
14
16
|
});
|
|
15
17
|
return {
|
|
@@ -19,5 +21,5 @@ function s({
|
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
export {
|
|
22
|
-
|
|
24
|
+
n as useListVirtualizer
|
|
23
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/components",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.59.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -53,22 +53,22 @@
|
|
|
53
53
|
"@hookform/resolvers": "2.9.11",
|
|
54
54
|
"nprogress": "0.2.0",
|
|
55
55
|
"react-transition-group": "4.4.5",
|
|
56
|
-
"react-
|
|
56
|
+
"@tanstack/react-virtual": "3.13.23",
|
|
57
57
|
"react-rnd": "10.5.2",
|
|
58
|
+
"react-color": "2.19.3",
|
|
58
59
|
"@mui/x-date-pickers": "6.20.2",
|
|
59
|
-
"@tanstack/react-virtual": "3.13.23",
|
|
60
60
|
"react-draggable": "4.5.0",
|
|
61
|
-
"react-
|
|
61
|
+
"react-dropzone": "14.4.1",
|
|
62
62
|
"react-spinners": "0.13.8",
|
|
63
63
|
"simplebar-react": "3.2.6",
|
|
64
64
|
"chart.js": "4.5.1",
|
|
65
65
|
"chartjs-chart-error-bars": "4.4.5",
|
|
66
66
|
"qrcode.react": "3.2.0",
|
|
67
|
+
"react-simple-code-editor": "0.14.1",
|
|
67
68
|
"react-resizable-panels": "2.1.9",
|
|
68
69
|
"react-data-grid": "7.0.0-beta.47",
|
|
69
70
|
"react-dnd": "16.0.1",
|
|
70
71
|
"react-dnd-html5-backend": "16.0.1",
|
|
71
|
-
"react-simple-code-editor": "0.14.1",
|
|
72
72
|
"date-fns": "2.30.0",
|
|
73
73
|
"react-window": "1.8.11",
|
|
74
74
|
"react-resizable": "3.1.3"
|