@gingkoo/pandora-explorer 0.0.1-alpha.22 → 0.0.1-alpha.24

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/lib/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @gingkoo/pandora-explorer v0.0.1-alpha.22
2
+ * @gingkoo/pandora-explorer v0.0.1-alpha.24
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import cx$1 from 'classnames';
@@ -5440,7 +5440,8 @@ var Tree = (props => {
5440
5440
  onRename,
5441
5441
  loadData,
5442
5442
  filterData,
5443
- onExpand
5443
+ onExpand,
5444
+ onLoad
5444
5445
  } = props;
5445
5446
  const ref = useRef(null);
5446
5447
  const tree = useRef(null);
@@ -5546,7 +5547,7 @@ var Tree = (props => {
5546
5547
  data.forEach((item, index) => {
5547
5548
  let l = levelkey + `-${index}`;
5548
5549
  if (curKey.indexOf(l) === 0) {
5549
- if (item.children) {
5550
+ if (item.children && item.children.length) {
5550
5551
  loop(item.children, l);
5551
5552
  } else {
5552
5553
  item.children = child;
@@ -5589,19 +5590,10 @@ var Tree = (props => {
5589
5590
  });
5590
5591
  }
5591
5592
  getNewTreeData(tree, treeNode.pos, child, 10);
5592
- if (onChange) {
5593
- onChange?.(tree);
5594
- setTimeout(() => {
5595
- resolve();
5596
- }, 100);
5593
+ onChange?.(tree);
5594
+ setTimeout(() => {
5597
5595
  resolve();
5598
- } else {
5599
- setData(tree);
5600
- setTimeout(() => {
5601
- animation && seTmotionShow(true);
5602
- resolve();
5603
- }, 100);
5604
- }
5596
+ }, 200);
5605
5597
  });
5606
5598
  };
5607
5599
  if (type == 'table' && !treeData.length) {
@@ -5640,6 +5632,7 @@ var Tree = (props => {
5640
5632
  ref: tree,
5641
5633
  checkStrictly: true,
5642
5634
  expandedKeys: expandedKeys,
5635
+ loadedKeys: loadedKeys,
5643
5636
  checkable: type == 'table' ? true : false,
5644
5637
  autoExpandParent: autoExpandParent,
5645
5638
  defaultExpandedKeys: defaultExpandedKeys || [],
@@ -5748,6 +5741,10 @@ var Tree = (props => {
5748
5741
  });
5749
5742
  }
5750
5743
  },
5744
+ onLoad: v => {
5745
+ if (v.length == loadedKeys?.length) return;
5746
+ onLoad?.(v);
5747
+ },
5751
5748
  loadData: isload ? onLoadData : null,
5752
5749
  treeData: type == 'table' ? [...data, {
5753
5750
  key: '_ending',
@@ -5858,12 +5855,12 @@ const ExplorerMenu = props => {
5858
5855
  onChange: onChange,
5859
5856
  onSelect: v => {
5860
5857
  store.setPathDisplay(v?.pathDisplay);
5861
- if (Array.isArray(v?.children)) {
5862
- store.setCurInfo(v);
5863
- store.setCurList(v?.children || []);
5864
- } else {
5865
- loadData(v.key);
5866
- }
5858
+ // if (Array.isArray(v?.children)) {
5859
+ // store.setCurInfo(v);
5860
+ // store.setCurList(v?.children || []);
5861
+ // } else {
5862
+ loadData(v.key);
5863
+ // }
5867
5864
  },
5868
5865
  filterData: v => {
5869
5866
  if (v.type == 'file') return false;
@@ -7031,9 +7028,9 @@ const Layout$1 = props => {
7031
7028
  onMenuClick
7032
7029
  } = props;
7033
7030
  const store = useContext(ExampleContext);
7034
- const [expandkey, useExpandkey] = useState([]);
7031
+ const [expandkey, setExpandkey] = useState([]);
7035
7032
  useEffect(() => {
7036
- useExpandkey([]);
7033
+ setExpandkey([]);
7037
7034
  }, [store.curInfo?.key]);
7038
7035
  function Loading() {
7039
7036
  return jsx("div", {
@@ -7105,6 +7102,7 @@ const Layout$1 = props => {
7105
7102
  type: 'table',
7106
7103
  checks: checks,
7107
7104
  expandedKeys: expandkey,
7105
+ loadedKeys: store.loadkey,
7108
7106
  treeData: store.curlist,
7109
7107
  columns: store.columns,
7110
7108
  checkType: store.checkType,
@@ -7135,8 +7133,11 @@ const Layout$1 = props => {
7135
7133
  onMenuClick: onMenuClick,
7136
7134
  onDblclick: _onDblclick,
7137
7135
  loadData: loadNode,
7136
+ onLoad: v => {
7137
+ store.setLoadKey(v);
7138
+ },
7138
7139
  onExpand: v => {
7139
- useExpandkey(v);
7140
+ setExpandkey(v);
7140
7141
  },
7141
7142
  onChange: v => {
7142
7143
  store.setCurList(v);
@@ -7393,6 +7394,7 @@ const Explorer = props => {
7393
7394
  const [menuSize, setMenuSize] = useState(80);
7394
7395
  const [reamekey, setReName] = useState(null);
7395
7396
  const [log, setLog] = useState([]);
7397
+ const [loadkey, setLoadKey] = useState([]);
7396
7398
  const [menutype, setMenutype] = useState('tile');
7397
7399
  const [infoshow, setInfoShow] = useState(false);
7398
7400
  const [loading, setLoading] = useState(ApiStatusEnum.READY);
@@ -7457,7 +7459,6 @@ const Explorer = props => {
7457
7459
  };
7458
7460
  let map = addLevel(curlist, {});
7459
7461
  setDataMap(map);
7460
- // setCurSelect('');
7461
7462
  }, [curlist]);
7462
7463
  //清空日志
7463
7464
  useEffect(() => {
@@ -7475,6 +7476,8 @@ const Explorer = props => {
7475
7476
  }, 300);
7476
7477
  return null;
7477
7478
  }
7479
+ //清空加载过的结点记录
7480
+ setLoadKey([]);
7478
7481
  setCurList(data?.fileList || []);
7479
7482
  setCurInfo(data?.current || {});
7480
7483
  setTimeout(() => {
@@ -7516,6 +7519,7 @@ const Explorer = props => {
7516
7519
  checkMode,
7517
7520
  reamekey,
7518
7521
  curSelect,
7522
+ loadkey,
7519
7523
  //icon
7520
7524
  getIcons: Icons,
7521
7525
  //set
@@ -7528,7 +7532,8 @@ const Explorer = props => {
7528
7532
  setPathDisplay,
7529
7533
  setLoading,
7530
7534
  setReName,
7531
- setCurSelect
7535
+ setCurSelect,
7536
+ setLoadKey
7532
7537
  },
7533
7538
  children: jsxs("div", {
7534
7539
  className: 'explorer-container',