virtual-scroller 1.9.0 → 1.10.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/CHANGELOG.md +7 -0
- package/README.md +6 -4
- package/bundle/virtual-scroller-dom.js.map +1 -1
- package/bundle/virtual-scroller-react.js +1 -1
- package/bundle/virtual-scroller-react.js.map +1 -1
- package/bundle/virtual-scroller.js.map +1 -1
- package/commonjs/VirtualScroller.js +1 -1
- package/commonjs/VirtualScroller.js.map +1 -1
- package/commonjs/react/VirtualScroller.js +17 -4
- package/commonjs/react/VirtualScroller.js.map +1 -1
- package/commonjs/react/useHandleItemsChange.js.map +1 -1
- package/dom/index.d.ts +1 -1
- package/index.d.ts +3 -3
- package/modules/VirtualScroller.js +1 -1
- package/modules/VirtualScroller.js.map +1 -1
- package/modules/react/VirtualScroller.js +10 -3
- package/modules/react/VirtualScroller.js.map +1 -1
- package/modules/react/useHandleItemsChange.js +1 -1
- package/modules/react/useHandleItemsChange.js.map +1 -1
- package/package.json +1 -1
- package/react/index.d.ts +53 -15
- package/source/VirtualScroller.js +1 -1
- package/source/react/VirtualScroller.js +7 -1
- package/source/react/useHandleItemsChange.js +1 -1
- package/website/index-bypass.html +2 -2
- package/website/index-grid.html +2 -2
- package/website/index-scrollableContainer.html +2 -2
- package/website/index.html +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<!-- `virtual-scroller`: in `.updateItems()` handle a case when `items.length` is the same, in which case find different items and if those items are rendered then maybe update them on screen and update their height, if the items are past rendered then maybe just discard all item heights past rendered, if the items are before rendered then maybe ignore and it will jump on scroll up which is kinda acceptable. -->
|
|
2
2
|
|
|
3
|
+
1.10.0 / 22.11.2022
|
|
4
|
+
==================
|
|
5
|
+
|
|
6
|
+
* [React] Applied TypeScript [props fixes](https://gitlab.com/catamphetamine/virtual-scroller/-/merge_requests/1).
|
|
7
|
+
|
|
8
|
+
* [React] Added two new properties: `item` and [`itemIndex`](https://gitlab.com/catamphetamine/virtual-scroller/-/issues/26). The legacy `children` property is still passed but is considered deprecated.
|
|
9
|
+
|
|
3
10
|
1.9.0 / 18.05.2022
|
|
4
11
|
==================
|
|
5
12
|
|
package/README.md
CHANGED
|
@@ -451,7 +451,9 @@ The required properties are:
|
|
|
451
451
|
|
|
452
452
|
* `itemComponent` — List item React component.
|
|
453
453
|
|
|
454
|
-
* The `itemComponent` will receive
|
|
454
|
+
* The `itemComponent` will receive properties:
|
|
455
|
+
* `item` — the item object itself (an element of the `items` array).
|
|
456
|
+
* `itemIndex: number` — the index of the item object in the `items` array.
|
|
455
457
|
|
|
456
458
|
* For best performance, make sure that `itemComponent` is a `React.memo()` component or a `React.PureComponent`. Otherwise, list items will keep re-rendering themselves as the user scrolls because the containing `<VirtualScroller/>` component gets re-rendered on scroll.
|
|
457
459
|
|
|
@@ -471,7 +473,7 @@ function Messages({ messages }) {
|
|
|
471
473
|
)
|
|
472
474
|
}
|
|
473
475
|
|
|
474
|
-
function Message({
|
|
476
|
+
function Message({ item: message }) {
|
|
475
477
|
const {
|
|
476
478
|
username,
|
|
477
479
|
date,
|
|
@@ -503,7 +505,7 @@ Messages.propTypes = {
|
|
|
503
505
|
}
|
|
504
506
|
|
|
505
507
|
Message.propTypes = {
|
|
506
|
-
|
|
508
|
+
item: message.isRequired
|
|
507
509
|
}
|
|
508
510
|
```
|
|
509
511
|
|
|
@@ -541,7 +543,7 @@ function ItemComponent({
|
|
|
541
543
|
state: savedState,
|
|
542
544
|
onStateChange,
|
|
543
545
|
onHeightChange,
|
|
544
|
-
|
|
546
|
+
item
|
|
545
547
|
}) {
|
|
546
548
|
const [state, setState] = useState(savedState)
|
|
547
549
|
|