@react-fabric/data 1.0.0-beta.18 → 1.0.0-beta.20
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/dist/cjs/histogram/Histogram.js +2 -0
- package/dist/cjs/hooks/usePagination.js +7 -4
- package/dist/cjs/table/BodyCell.js +2 -1
- package/dist/cjs/table/CheckboxCell.js +1 -1
- package/dist/cjs/virtual/Gallery.js +6 -6
- package/dist/cjs/virtual/List.js +6 -6
- package/dist/esm/histogram/Histogram.js +2 -0
- package/dist/esm/hooks/usePagination.js +7 -4
- package/dist/esm/table/BodyCell.js +2 -1
- package/dist/esm/table/CheckboxCell.js +1 -1
- package/dist/esm/virtual/Gallery.js +6 -6
- package/dist/esm/virtual/List.js +6 -6
- package/dist/types/virtual/Gallery.d.ts +1 -1
- package/dist/types/virtual/List.d.ts +1 -1
- package/package.json +6 -6
- package/src/histogram/Histogram.tsx +2 -0
- package/src/hooks/usePagination.tsx +13 -7
- package/src/table/BodyCell.tsx +1 -1
- package/src/table/CheckboxCell.tsx +1 -1
- package/src/virtual/Gallery.tsx +8 -8
- package/src/virtual/List.tsx +7 -7
|
@@ -71,6 +71,7 @@ var Histogram = function Histogram(_ref) {
|
|
|
71
71
|
actions: [/*#__PURE__*/jsxRuntime.jsx(core.Button, {
|
|
72
72
|
color: "danger",
|
|
73
73
|
size: "sm",
|
|
74
|
+
stopPropagation: true,
|
|
74
75
|
icon: core.CoreIcons.funnelMinus,
|
|
75
76
|
"aria-label": "Filter Negative",
|
|
76
77
|
onClick: function onClick() {
|
|
@@ -79,6 +80,7 @@ var Histogram = function Histogram(_ref) {
|
|
|
79
80
|
}, "negative"), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
|
|
80
81
|
color: "primary",
|
|
81
82
|
size: "sm",
|
|
83
|
+
stopPropagation: true,
|
|
82
84
|
icon: core.CoreIcons.funnelPlus,
|
|
83
85
|
"aria-label": "Filter",
|
|
84
86
|
onClick: function onClick() {
|
|
@@ -58,9 +58,12 @@ var usePagination = function usePagination(_ref) {
|
|
|
58
58
|
|
|
59
59
|
/** ***************** set page *******************/
|
|
60
60
|
react.useEffect(function () {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
if (totalRecords > -1) {
|
|
62
|
+
var actual = Math.min(currentPage, totalPages - 1);
|
|
63
|
+
setPage(actual);
|
|
64
|
+
actual !== currentPage && (onChange === null || onChange === void 0 ? void 0 : onChange(actual));
|
|
65
|
+
}
|
|
66
|
+
}, [currentPage, totalRecords, totalPages]);
|
|
64
67
|
var headLabel = react.useMemo(function () {
|
|
65
68
|
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
66
69
|
className: "text-muted",
|
|
@@ -72,7 +75,7 @@ var usePagination = function usePagination(_ref) {
|
|
|
72
75
|
startTransition(function () {
|
|
73
76
|
return onChange === null || onChange === void 0 ? void 0 : onChange(page);
|
|
74
77
|
});
|
|
75
|
-
}, []);
|
|
78
|
+
}, [onChange]);
|
|
76
79
|
return {
|
|
77
80
|
page: page,
|
|
78
81
|
totalPages: totalPages,
|
|
@@ -43,6 +43,7 @@ var BodyCell = function BodyCell(_ref) {
|
|
|
43
43
|
return (_widths$get = widths.get(column.id.toString())) !== null && _widths$get !== void 0 ? _widths$get : column.width;
|
|
44
44
|
}, [widths, column]);
|
|
45
45
|
var content = react.useMemo(function () {
|
|
46
|
+
var _column$dataType;
|
|
46
47
|
var value = utilities.getByPath(item, column.id.toString());
|
|
47
48
|
if (column.renderer != null) {
|
|
48
49
|
return column.renderer(item[column.id], item, index);
|
|
@@ -60,7 +61,7 @@ var BodyCell = function BodyCell(_ref) {
|
|
|
60
61
|
return column.valueMap[value];
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
if (column.dataType
|
|
64
|
+
if (["date", "time", "datetime"].includes((_column$dataType = column.dataType) !== null && _column$dataType !== void 0 ? _column$dataType : "")) {
|
|
64
65
|
return /*#__PURE__*/jsxRuntime.jsx(date.DateDisplay, {
|
|
65
66
|
date: value,
|
|
66
67
|
format: column.format
|
|
@@ -30,7 +30,7 @@ var CheckboxCell = function CheckboxCell(_ref) {
|
|
|
30
30
|
var state = _ref.state,
|
|
31
31
|
_onClick = _ref.onClick;
|
|
32
32
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33
|
-
className: "group font-medium border-e w-6 flex flex-nowrap text-start
|
|
33
|
+
className: "group font-medium border-e w-6 flex flex-nowrap text-start py-1",
|
|
34
34
|
children: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
35
35
|
icon: state === 2 ? core.CoreIcons.checkboxInt : state === 1 ? core.CoreIcons.checkboxOn : core.CoreIcons.checkboxOff,
|
|
36
36
|
className: "p-1 text-tint-700 hover:text-primary-600",
|
|
@@ -43,11 +43,11 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
|
|
|
43
43
|
var extraSize = react.useMemo(function () {
|
|
44
44
|
return onLoadMore ? 64 : 0;
|
|
45
45
|
}, [onLoadMore]);
|
|
46
|
-
var itemList = createItemList(items.map(function (item,
|
|
46
|
+
var itemList = createItemList(items.map(function (item, index) {
|
|
47
47
|
return {
|
|
48
|
-
index:
|
|
49
|
-
|
|
50
|
-
isLast:
|
|
48
|
+
index: index,
|
|
49
|
+
item: item,
|
|
50
|
+
isLast: index + 1 === items.length
|
|
51
51
|
};
|
|
52
52
|
}));
|
|
53
53
|
var scrollerRef = react.useRef(null);
|
|
@@ -187,7 +187,7 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
|
|
|
187
187
|
},
|
|
188
188
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
189
189
|
style: {
|
|
190
|
-
height: virtualizer.getTotalSize()
|
|
190
|
+
height: virtualizer.getTotalSize() + extraSize
|
|
191
191
|
},
|
|
192
192
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
193
193
|
style: {
|
|
@@ -198,7 +198,7 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
|
|
|
198
198
|
index = _ref3.index,
|
|
199
199
|
measureElement = _ref3.measureElement;
|
|
200
200
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
201
|
-
className: "flex justify-
|
|
201
|
+
className: "flex justify-start",
|
|
202
202
|
"data-index": index,
|
|
203
203
|
ref: measureElement,
|
|
204
204
|
children: columnMap.map(function (col) {
|
package/dist/cjs/virtual/List.js
CHANGED
|
@@ -44,11 +44,11 @@ var _VirtualList = function _VirtualList(_ref) {
|
|
|
44
44
|
var extraSize = react.useMemo(function () {
|
|
45
45
|
return onLoadMore ? 64 : 0;
|
|
46
46
|
}, [onLoadMore]);
|
|
47
|
-
var itemList = createItemList(items.map(function (item,
|
|
47
|
+
var itemList = createItemList(items.map(function (item, index) {
|
|
48
48
|
return {
|
|
49
|
-
index:
|
|
50
|
-
|
|
51
|
-
isLast:
|
|
49
|
+
index: index,
|
|
50
|
+
item: item,
|
|
51
|
+
isLast: index + 1 === items.length
|
|
52
52
|
};
|
|
53
53
|
}));
|
|
54
54
|
var scrollerRef = react.useRef(null);
|
|
@@ -177,9 +177,9 @@ var _VirtualList = function _VirtualList(_ref) {
|
|
|
177
177
|
},
|
|
178
178
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
179
179
|
style: orientation === "vertical" ? {
|
|
180
|
-
height: virtualizer.getTotalSize()
|
|
180
|
+
height: virtualizer.getTotalSize() + extraSize
|
|
181
181
|
} : {
|
|
182
|
-
width: virtualizer.getTotalSize()
|
|
182
|
+
width: virtualizer.getTotalSize() + extraSize
|
|
183
183
|
},
|
|
184
184
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
185
185
|
style: orientation === "vertical" ? {
|
|
@@ -71,6 +71,7 @@ var Histogram = function Histogram(_ref) {
|
|
|
71
71
|
actions: [/*#__PURE__*/jsx(Button, {
|
|
72
72
|
color: "danger",
|
|
73
73
|
size: "sm",
|
|
74
|
+
stopPropagation: true,
|
|
74
75
|
icon: CoreIcons.funnelMinus,
|
|
75
76
|
"aria-label": "Filter Negative",
|
|
76
77
|
onClick: function onClick() {
|
|
@@ -79,6 +80,7 @@ var Histogram = function Histogram(_ref) {
|
|
|
79
80
|
}, "negative"), /*#__PURE__*/jsx(Button, {
|
|
80
81
|
color: "primary",
|
|
81
82
|
size: "sm",
|
|
83
|
+
stopPropagation: true,
|
|
82
84
|
icon: CoreIcons.funnelPlus,
|
|
83
85
|
"aria-label": "Filter",
|
|
84
86
|
onClick: function onClick() {
|
|
@@ -58,9 +58,12 @@ var usePagination = function usePagination(_ref) {
|
|
|
58
58
|
|
|
59
59
|
/** ***************** set page *******************/
|
|
60
60
|
useEffect(function () {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
if (totalRecords > -1) {
|
|
62
|
+
var actual = Math.min(currentPage, totalPages - 1);
|
|
63
|
+
setPage(actual);
|
|
64
|
+
actual !== currentPage && (onChange === null || onChange === void 0 ? void 0 : onChange(actual));
|
|
65
|
+
}
|
|
66
|
+
}, [currentPage, totalRecords, totalPages]);
|
|
64
67
|
var headLabel = useMemo(function () {
|
|
65
68
|
return /*#__PURE__*/jsxs("span", {
|
|
66
69
|
className: "text-muted",
|
|
@@ -72,7 +75,7 @@ var usePagination = function usePagination(_ref) {
|
|
|
72
75
|
startTransition(function () {
|
|
73
76
|
return onChange === null || onChange === void 0 ? void 0 : onChange(page);
|
|
74
77
|
});
|
|
75
|
-
}, []);
|
|
78
|
+
}, [onChange]);
|
|
76
79
|
return {
|
|
77
80
|
page: page,
|
|
78
81
|
totalPages: totalPages,
|
|
@@ -43,6 +43,7 @@ var BodyCell = function BodyCell(_ref) {
|
|
|
43
43
|
return (_widths$get = widths.get(column.id.toString())) !== null && _widths$get !== void 0 ? _widths$get : column.width;
|
|
44
44
|
}, [widths, column]);
|
|
45
45
|
var content = useMemo(function () {
|
|
46
|
+
var _column$dataType;
|
|
46
47
|
var value = getByPath(item, column.id.toString());
|
|
47
48
|
if (column.renderer != null) {
|
|
48
49
|
return column.renderer(item[column.id], item, index);
|
|
@@ -60,7 +61,7 @@ var BodyCell = function BodyCell(_ref) {
|
|
|
60
61
|
return column.valueMap[value];
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
if (column.dataType
|
|
64
|
+
if (["date", "time", "datetime"].includes((_column$dataType = column.dataType) !== null && _column$dataType !== void 0 ? _column$dataType : "")) {
|
|
64
65
|
return /*#__PURE__*/jsx(DateDisplay, {
|
|
65
66
|
date: value,
|
|
66
67
|
format: column.format
|
|
@@ -30,7 +30,7 @@ var CheckboxCell = function CheckboxCell(_ref) {
|
|
|
30
30
|
var state = _ref.state,
|
|
31
31
|
_onClick = _ref.onClick;
|
|
32
32
|
return /*#__PURE__*/jsx("div", {
|
|
33
|
-
className: "group font-medium border-e w-6 flex flex-nowrap text-start
|
|
33
|
+
className: "group font-medium border-e w-6 flex flex-nowrap text-start py-1",
|
|
34
34
|
children: /*#__PURE__*/jsx(Icon, {
|
|
35
35
|
icon: state === 2 ? CoreIcons.checkboxInt : state === 1 ? CoreIcons.checkboxOn : CoreIcons.checkboxOff,
|
|
36
36
|
className: "p-1 text-tint-700 hover:text-primary-600",
|
|
@@ -43,11 +43,11 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
|
|
|
43
43
|
var extraSize = useMemo(function () {
|
|
44
44
|
return onLoadMore ? 64 : 0;
|
|
45
45
|
}, [onLoadMore]);
|
|
46
|
-
var itemList = createItemList(items.map(function (item,
|
|
46
|
+
var itemList = createItemList(items.map(function (item, index) {
|
|
47
47
|
return {
|
|
48
|
-
index:
|
|
49
|
-
|
|
50
|
-
isLast:
|
|
48
|
+
index: index,
|
|
49
|
+
item: item,
|
|
50
|
+
isLast: index + 1 === items.length
|
|
51
51
|
};
|
|
52
52
|
}));
|
|
53
53
|
var scrollerRef = useRef(null);
|
|
@@ -187,7 +187,7 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
|
|
|
187
187
|
},
|
|
188
188
|
children: /*#__PURE__*/jsxs("div", {
|
|
189
189
|
style: {
|
|
190
|
-
height: virtualizer.getTotalSize()
|
|
190
|
+
height: virtualizer.getTotalSize() + extraSize
|
|
191
191
|
},
|
|
192
192
|
children: [/*#__PURE__*/jsx("div", {
|
|
193
193
|
style: {
|
|
@@ -198,7 +198,7 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
|
|
|
198
198
|
index = _ref3.index,
|
|
199
199
|
measureElement = _ref3.measureElement;
|
|
200
200
|
return /*#__PURE__*/jsx("div", {
|
|
201
|
-
className: "flex justify-
|
|
201
|
+
className: "flex justify-start",
|
|
202
202
|
"data-index": index,
|
|
203
203
|
ref: measureElement,
|
|
204
204
|
children: columnMap.map(function (col) {
|
package/dist/esm/virtual/List.js
CHANGED
|
@@ -44,11 +44,11 @@ var _VirtualList = function _VirtualList(_ref) {
|
|
|
44
44
|
var extraSize = useMemo(function () {
|
|
45
45
|
return onLoadMore ? 64 : 0;
|
|
46
46
|
}, [onLoadMore]);
|
|
47
|
-
var itemList = createItemList(items.map(function (item,
|
|
47
|
+
var itemList = createItemList(items.map(function (item, index) {
|
|
48
48
|
return {
|
|
49
|
-
index:
|
|
50
|
-
|
|
51
|
-
isLast:
|
|
49
|
+
index: index,
|
|
50
|
+
item: item,
|
|
51
|
+
isLast: index + 1 === items.length
|
|
52
52
|
};
|
|
53
53
|
}));
|
|
54
54
|
var scrollerRef = useRef(null);
|
|
@@ -177,9 +177,9 @@ var _VirtualList = function _VirtualList(_ref) {
|
|
|
177
177
|
},
|
|
178
178
|
children: [/*#__PURE__*/jsxs("div", {
|
|
179
179
|
style: orientation === "vertical" ? {
|
|
180
|
-
height: virtualizer.getTotalSize()
|
|
180
|
+
height: virtualizer.getTotalSize() + extraSize
|
|
181
181
|
} : {
|
|
182
|
-
width: virtualizer.getTotalSize()
|
|
182
|
+
width: virtualizer.getTotalSize() + extraSize
|
|
183
183
|
},
|
|
184
184
|
children: [/*#__PURE__*/jsx("div", {
|
|
185
185
|
style: orientation === "vertical" ? {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/data",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.20",
|
|
4
4
|
"description": "RUF: Data package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"watch": "npm-run-all -p watch:rollup watch:dts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@react-fabric/core": "^1.0.0-beta.
|
|
37
|
-
"@react-fabric/date": "^1.0.0-beta.
|
|
38
|
-
"@react-fabric/form": "^1.0.0-beta.
|
|
39
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
36
|
+
"@react-fabric/core": "^1.0.0-beta.20",
|
|
37
|
+
"@react-fabric/date": "^1.0.0-beta.20",
|
|
38
|
+
"@react-fabric/form": "^1.0.0-beta.20",
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.20",
|
|
40
40
|
"@tanstack/react-virtual": "^3.8.6",
|
|
41
41
|
"classnames": "^2.5.1",
|
|
42
42
|
"color": "^4.2.3",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"node": ">=18.12.0",
|
|
53
53
|
"npm": ">=8.19.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b265afe1779c1654fc9cf8d9de6e7396b64515d3"
|
|
56
56
|
}
|
|
@@ -150,6 +150,7 @@ export const Histogram = ({
|
|
|
150
150
|
key="negative"
|
|
151
151
|
color="danger"
|
|
152
152
|
size="sm"
|
|
153
|
+
stopPropagation
|
|
153
154
|
icon={CoreIcons.funnelMinus}
|
|
154
155
|
aria-label="Filter Negative"
|
|
155
156
|
onClick={() => onClick?.(item.id, true)}
|
|
@@ -158,6 +159,7 @@ export const Histogram = ({
|
|
|
158
159
|
key="positive"
|
|
159
160
|
color="primary"
|
|
160
161
|
size="sm"
|
|
162
|
+
stopPropagation
|
|
161
163
|
icon={CoreIcons.funnelPlus}
|
|
162
164
|
aria-label="Filter"
|
|
163
165
|
onClick={() => onClick?.(item.id)}
|
|
@@ -111,9 +111,12 @@ export const usePagination = ({
|
|
|
111
111
|
|
|
112
112
|
/** ***************** set page *******************/
|
|
113
113
|
useEffect(() => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
if (totalRecords > -1) {
|
|
115
|
+
const actual = Math.min(currentPage, totalPages - 1);
|
|
116
|
+
setPage(actual);
|
|
117
|
+
actual !== currentPage && onChange?.(actual);
|
|
118
|
+
}
|
|
119
|
+
}, [currentPage, totalRecords, totalPages]);
|
|
117
120
|
|
|
118
121
|
const headLabel = useMemo(
|
|
119
122
|
() => (
|
|
@@ -126,10 +129,13 @@ export const usePagination = ({
|
|
|
126
129
|
[page, perPage, totalRecords],
|
|
127
130
|
);
|
|
128
131
|
|
|
129
|
-
const onPageChange = useCallback(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
const onPageChange = useCallback(
|
|
133
|
+
(page: number) => {
|
|
134
|
+
setPage(page);
|
|
135
|
+
startTransition(() => onChange?.(page));
|
|
136
|
+
},
|
|
137
|
+
[onChange],
|
|
138
|
+
);
|
|
133
139
|
|
|
134
140
|
return { page, totalPages, headLabel, ranges, onPageChange };
|
|
135
141
|
};
|
package/src/table/BodyCell.tsx
CHANGED
|
@@ -63,7 +63,7 @@ export const BodyCell = ({
|
|
|
63
63
|
return column.valueMap[value];
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
if (column.dataType
|
|
66
|
+
if (["date", "time", "datetime"].includes(column.dataType ?? "")) {
|
|
67
67
|
return <DateDisplay date={value} format={column.format} />;
|
|
68
68
|
}
|
|
69
69
|
if (column.dataType === "number") {
|
|
@@ -31,7 +31,7 @@ export const CheckboxCell = ({
|
|
|
31
31
|
onClick?: () => void;
|
|
32
32
|
}) => {
|
|
33
33
|
return (
|
|
34
|
-
<div className="group font-medium border-e w-6 flex flex-nowrap text-start
|
|
34
|
+
<div className="group font-medium border-e w-6 flex flex-nowrap text-start py-1">
|
|
35
35
|
<Icon
|
|
36
36
|
icon={
|
|
37
37
|
state === 2
|
package/src/virtual/Gallery.tsx
CHANGED
|
@@ -50,7 +50,7 @@ export interface VirtualGalleryRef {
|
|
|
50
50
|
|
|
51
51
|
export interface VirtualGalleryProps<T> extends TestProps {
|
|
52
52
|
children: (props: {
|
|
53
|
-
|
|
53
|
+
item: T;
|
|
54
54
|
index: number;
|
|
55
55
|
isLast: boolean;
|
|
56
56
|
}) => ReactElement;
|
|
@@ -124,15 +124,15 @@ const _VirtualGallery = <T extends KeyValue>({
|
|
|
124
124
|
const extraSize = useMemo(() => (onLoadMore ? 64 : 0), [onLoadMore]);
|
|
125
125
|
const itemList: Array<{
|
|
126
126
|
index: number;
|
|
127
|
-
|
|
127
|
+
item: T;
|
|
128
128
|
isLast: boolean;
|
|
129
129
|
isSticky: boolean;
|
|
130
130
|
}> = createItemList(
|
|
131
|
-
items.map((item: AnyObject,
|
|
131
|
+
items.map((item: AnyObject, index) => {
|
|
132
132
|
return {
|
|
133
|
-
index
|
|
134
|
-
|
|
135
|
-
isLast:
|
|
133
|
+
index,
|
|
134
|
+
item,
|
|
135
|
+
isLast: index + 1 === items.length,
|
|
136
136
|
};
|
|
137
137
|
}),
|
|
138
138
|
);
|
|
@@ -308,13 +308,13 @@ const _VirtualGallery = <T extends KeyValue>({
|
|
|
308
308
|
>
|
|
309
309
|
<div
|
|
310
310
|
style={{
|
|
311
|
-
height: virtualizer.getTotalSize(),
|
|
311
|
+
height: virtualizer.getTotalSize() + extraSize,
|
|
312
312
|
}}
|
|
313
313
|
>
|
|
314
314
|
<div style={{ height: virtualItems[0]?.start }} />
|
|
315
315
|
{virtualItems.map(({ key, index, measureElement }) => (
|
|
316
316
|
<div
|
|
317
|
-
className="flex justify-
|
|
317
|
+
className="flex justify-start"
|
|
318
318
|
key={key}
|
|
319
319
|
data-index={index}
|
|
320
320
|
ref={measureElement}
|
package/src/virtual/List.tsx
CHANGED
|
@@ -57,7 +57,7 @@ export interface VirtualListRef {
|
|
|
57
57
|
|
|
58
58
|
export interface VirtualListProps<T> extends TestProps {
|
|
59
59
|
children: (props: {
|
|
60
|
-
|
|
60
|
+
item: T;
|
|
61
61
|
index: number;
|
|
62
62
|
isLast: boolean;
|
|
63
63
|
}) => ReactElement;
|
|
@@ -135,11 +135,11 @@ const _VirtualList = <T extends KeyValue>({
|
|
|
135
135
|
isLast: boolean;
|
|
136
136
|
isSticky: boolean;
|
|
137
137
|
}> = createItemList(
|
|
138
|
-
items.map((item: AnyObject,
|
|
138
|
+
items.map((item: AnyObject, index) => {
|
|
139
139
|
return {
|
|
140
|
-
index
|
|
141
|
-
|
|
142
|
-
isLast:
|
|
140
|
+
index,
|
|
141
|
+
item,
|
|
142
|
+
isLast: index + 1 === items.length,
|
|
143
143
|
};
|
|
144
144
|
}),
|
|
145
145
|
);
|
|
@@ -290,8 +290,8 @@ const _VirtualList = <T extends KeyValue>({
|
|
|
290
290
|
<div
|
|
291
291
|
style={
|
|
292
292
|
orientation === "vertical"
|
|
293
|
-
? { height: virtualizer.getTotalSize() }
|
|
294
|
-
: { width: virtualizer.getTotalSize() }
|
|
293
|
+
? { height: virtualizer.getTotalSize() + extraSize }
|
|
294
|
+
: { width: virtualizer.getTotalSize() + extraSize }
|
|
295
295
|
}
|
|
296
296
|
>
|
|
297
297
|
<div
|