ztxkui 10.0.46 → 10.0.47

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.
@@ -708,12 +708,27 @@ function Table(props) {
708
708
  (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.onChange) &&
709
709
  rowSelection.onChange(selectedRowKeys, selectedRows);
710
710
  } })); }, [rowSelection]);
711
+ var virtualRef = useRef();
712
+ // 自动开启虚拟滚动
713
+ var virtual = useMemo(function () {
714
+ if (virtualTableKey)
715
+ return virtualTableKey;
716
+ if (expandableDataSource.length > 400) {
717
+ if (virtualRef.current)
718
+ return virtualRef.current;
719
+ var key = Math.random().toString(36).slice(-12);
720
+ virtualRef.current = key;
721
+ return key;
722
+ }
723
+ virtualRef.current = undefined;
724
+ return undefined;
725
+ }, [virtualTableKey, expandableDataSource]);
711
726
  // 虚拟滚动选项
712
727
  var vComponents = useMemo(function () {
713
- if (virtualTableKey) {
728
+ if (virtual) {
714
729
  // 使用VList 即可有虚拟列表的效果
715
730
  return VList({
716
- vid: virtualTableKey,
731
+ vid: virtual,
717
732
  height: myScroll.y ? myScroll.y : 200,
718
733
  resetTopWhenDataChange: false,
719
734
  });
@@ -722,7 +737,7 @@ function Table(props) {
722
737
  return null;
723
738
  }
724
739
  // eslint-disable-next-line react-hooks/exhaustive-deps
725
- }, [virtualTableKey]);
740
+ }, [virtual]);
726
741
  var tableComponents = useMemo(function () {
727
742
  var _a, _b;
728
743
  var result = onMoveRow || onEditableSave
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "10.0.46",
3
+ "version": "10.0.47",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",