@elliemae/ds-virtual-list 2.3.0-next.6 → 2.3.0-next.7
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/cjs/parts/List.js +8 -2
- package/esm/parts/List.js +8 -2
- package/package.json +4 -3
package/cjs/parts/List.js
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
7
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
8
|
require('core-js/modules/esnext.iterator.map.js');
|
|
8
9
|
var React = require('react');
|
|
10
|
+
var uid = require('uid');
|
|
9
11
|
var styled = require('../styled.js');
|
|
10
12
|
var VirtualListDataTestID = require('../VirtualListDataTestID.js');
|
|
11
13
|
var useVirtualList = require('../hooks/useVirtualList.js');
|
|
@@ -23,6 +25,7 @@ const List = props => {
|
|
|
23
25
|
filteredChildren,
|
|
24
26
|
totalSize
|
|
25
27
|
} = useVirtualList.useVirtualList(props);
|
|
28
|
+
const [dynamicRerenderWorkaround, setDynamicRerenderWorkaround] = React__default["default"].useState(uid.uid(6));
|
|
26
29
|
const virtualChildren = React__default["default"].useMemo(() => virtualItems.map(virtualItem => {
|
|
27
30
|
const {
|
|
28
31
|
index,
|
|
@@ -37,8 +40,11 @@ const List = props => {
|
|
|
37
40
|
style: style,
|
|
38
41
|
role: "listitem",
|
|
39
42
|
children: filteredChildren[index]
|
|
40
|
-
});
|
|
43
|
+
}, "ds-virtual-list-item-".concat(uid.uid(6)));
|
|
41
44
|
}), [filteredChildren, virtualItems]);
|
|
45
|
+
React__default["default"].useEffect(() => {
|
|
46
|
+
setDynamicRerenderWorkaround(uid.uid(6));
|
|
47
|
+
}, [filteredChildren]);
|
|
42
48
|
return /*#__PURE__*/jsxRuntime.jsx(styled.StyledContainerContentList, {
|
|
43
49
|
ref: parentRef,
|
|
44
50
|
"data-testid": VirtualListDataTestID.LIST_DATA_TESTID.CONTAINER,
|
|
@@ -46,7 +52,7 @@ const List = props => {
|
|
|
46
52
|
children: /*#__PURE__*/_jsx2__default["default"](styled.StyledVirtualList, {
|
|
47
53
|
height: "".concat(totalSize, "px")
|
|
48
54
|
}, void 0, virtualChildren)
|
|
49
|
-
});
|
|
55
|
+
}, "ds-virtual-list-".concat(dynamicRerenderWorkaround));
|
|
50
56
|
};
|
|
51
57
|
|
|
52
58
|
exports.List = List;
|
package/esm/parts/List.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import _jsx2 from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
3
|
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
4
|
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
5
|
import React from 'react';
|
|
6
|
+
import { uid } from 'uid';
|
|
5
7
|
import { VirtualItemStyled, StyledContainerContentList, StyledVirtualList } from '../styled.js';
|
|
6
8
|
import { LIST_DATA_TESTID } from '../VirtualListDataTestID.js';
|
|
7
9
|
import { useVirtualList } from '../hooks/useVirtualList.js';
|
|
@@ -14,6 +16,7 @@ const List = props => {
|
|
|
14
16
|
filteredChildren,
|
|
15
17
|
totalSize
|
|
16
18
|
} = useVirtualList(props);
|
|
19
|
+
const [dynamicRerenderWorkaround, setDynamicRerenderWorkaround] = React.useState(uid(6));
|
|
17
20
|
const virtualChildren = React.useMemo(() => virtualItems.map(virtualItem => {
|
|
18
21
|
const {
|
|
19
22
|
index,
|
|
@@ -28,8 +31,11 @@ const List = props => {
|
|
|
28
31
|
style: style,
|
|
29
32
|
role: "listitem",
|
|
30
33
|
children: filteredChildren[index]
|
|
31
|
-
});
|
|
34
|
+
}, "ds-virtual-list-item-".concat(uid(6)));
|
|
32
35
|
}), [filteredChildren, virtualItems]);
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
setDynamicRerenderWorkaround(uid(6));
|
|
38
|
+
}, [filteredChildren]);
|
|
33
39
|
return /*#__PURE__*/jsx(StyledContainerContentList, {
|
|
34
40
|
ref: parentRef,
|
|
35
41
|
"data-testid": LIST_DATA_TESTID.CONTAINER,
|
|
@@ -37,7 +43,7 @@ const List = props => {
|
|
|
37
43
|
children: /*#__PURE__*/_jsx2(StyledVirtualList, {
|
|
38
44
|
height: "".concat(totalSize, "px")
|
|
39
45
|
}, void 0, virtualChildren)
|
|
40
|
-
});
|
|
46
|
+
}, "ds-virtual-list-".concat(dynamicRerenderWorkaround));
|
|
41
47
|
};
|
|
42
48
|
|
|
43
49
|
export { List };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-virtual-list",
|
|
3
|
-
"version": "2.3.0-next.
|
|
3
|
+
"version": "2.3.0-next.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Virtual List",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -56,10 +56,11 @@
|
|
|
56
56
|
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@elliemae/ds-props-helpers": "2.3.0-next.
|
|
59
|
+
"@elliemae/ds-props-helpers": "2.3.0-next.7",
|
|
60
60
|
"prop-types": "~15.7.2",
|
|
61
61
|
"react-desc": "~4.1.3",
|
|
62
|
-
"react-virtual": "~2.3.2"
|
|
62
|
+
"react-virtual": "~2.3.2",
|
|
63
|
+
"uid": "2.0.0"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
65
66
|
"styled-components": "~5.3.3"
|