@gingkoo/pandora-explorer 0.0.1-alpha.21 → 0.0.1-alpha.23

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.21
2
+ * @gingkoo/pandora-explorer v0.0.1-alpha.23
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import cx$1 from 'classnames';
@@ -5373,30 +5373,6 @@ function NotData() {
5373
5373
  });
5374
5374
  }
5375
5375
 
5376
- //添加层级
5377
- const addLevel = (data, levelIndex = 0, filedata) => {
5378
- let arr = data;
5379
- if (filedata) {
5380
- arr = arr.filter(v => filedata?.(v));
5381
- }
5382
- let i = 0;
5383
- while (i < arr.length) {
5384
- let item = arr[i];
5385
- item['level'] = levelIndex;
5386
- if (item.type == 'file') {
5387
- item['isLeaf'] = true;
5388
- }
5389
- if (Array.isArray(item.children) && item.children.length > 0) {
5390
- if (filedata) {
5391
- item.children = addLevel(item.children, levelIndex + 1, filedata);
5392
- } else {
5393
- addLevel(item.children, levelIndex + 1, filedata);
5394
- }
5395
- }
5396
- i++;
5397
- }
5398
- return arr;
5399
- };
5400
5376
  //下拉动画
5401
5377
  const motion = {
5402
5378
  motionName: 'node-motion',
@@ -5440,7 +5416,8 @@ var Tree = (props => {
5440
5416
  onRename,
5441
5417
  loadData,
5442
5418
  filterData,
5443
- onExpand
5419
+ onExpand,
5420
+ onLoad
5444
5421
  } = props;
5445
5422
  const ref = useRef(null);
5446
5423
  const tree = useRef(null);
@@ -5459,11 +5436,11 @@ var Tree = (props => {
5459
5436
  }, 0);
5460
5437
  return size > w ? size : Math.ceil(w);
5461
5438
  }, [width, _widht]);
5462
- useEffect(() => {
5463
- let arr = cloneDeep(treeData);
5464
- arr = addLevel(arr, 0, filterData);
5465
- setData(arr);
5466
- }, [treeData, type, filterData]);
5439
+ // useEffect(() => {
5440
+ // let arr = cloneDeep(treeData);
5441
+ // arr = addLevel(arr, 0, filterData);
5442
+ // setData(arr);
5443
+ // }, [treeData, type, filterData]);
5467
5444
  useEffect(() => {
5468
5445
  if (!Array.isArray(columns)) return;
5469
5446
  if (!ref.current) return;
@@ -5546,7 +5523,7 @@ var Tree = (props => {
5546
5523
  data.forEach((item, index) => {
5547
5524
  let l = levelkey + `-${index}`;
5548
5525
  if (curKey.indexOf(l) === 0) {
5549
- if (item.children) {
5526
+ if (item.children && item.children.length) {
5550
5527
  loop(item.children, l);
5551
5528
  } else {
5552
5529
  item.children = child;
@@ -5589,19 +5566,10 @@ var Tree = (props => {
5589
5566
  });
5590
5567
  }
5591
5568
  getNewTreeData(tree, treeNode.pos, child, 10);
5592
- if (onChange) {
5593
- onChange?.(tree);
5594
- setTimeout(() => {
5595
- resolve();
5596
- }, 100);
5569
+ onChange?.(tree);
5570
+ setTimeout(() => {
5597
5571
  resolve();
5598
- } else {
5599
- setData(tree);
5600
- setTimeout(() => {
5601
- animation && seTmotionShow(true);
5602
- resolve();
5603
- }, 100);
5604
- }
5572
+ }, 200);
5605
5573
  });
5606
5574
  };
5607
5575
  if (type == 'table' && !treeData.length) {
@@ -5640,6 +5608,7 @@ var Tree = (props => {
5640
5608
  ref: tree,
5641
5609
  checkStrictly: true,
5642
5610
  expandedKeys: expandedKeys,
5611
+ loadedKeys: loadedKeys,
5643
5612
  checkable: type == 'table' ? true : false,
5644
5613
  autoExpandParent: autoExpandParent,
5645
5614
  defaultExpandedKeys: defaultExpandedKeys || [],
@@ -5748,6 +5717,10 @@ var Tree = (props => {
5748
5717
  });
5749
5718
  }
5750
5719
  },
5720
+ onLoad: v => {
5721
+ if (v.length == loadedKeys?.length) return;
5722
+ onLoad?.(v);
5723
+ },
5751
5724
  loadData: isload ? onLoadData : null,
5752
5725
  treeData: type == 'table' ? [...data, {
5753
5726
  key: '_ending',
@@ -5840,6 +5813,7 @@ const ExplorerMenu = props => {
5840
5813
  onChange
5841
5814
  } = props;
5842
5815
  const store = useContext(ExampleContext);
5816
+ const [eventKey, setEventKey] = useState([]);
5843
5817
  if (!store) return;
5844
5818
  return jsx("div", {
5845
5819
  className: 'frame-left',
@@ -5847,6 +5821,7 @@ const ExplorerMenu = props => {
5847
5821
  isload: true,
5848
5822
  treeData: data,
5849
5823
  height: height,
5824
+ expandedKeys: eventKey,
5850
5825
  icon: (v, className) => {
5851
5826
  if (v.icon == false) return jsx(Fragment, {});
5852
5827
  return store.getIcons(v, className);
@@ -5866,6 +5841,9 @@ const ExplorerMenu = props => {
5866
5841
  filterData: v => {
5867
5842
  if (v.type == 'file') return false;
5868
5843
  return true;
5844
+ },
5845
+ onExpand: v => {
5846
+ setEventKey(v);
5869
5847
  }
5870
5848
  })
5871
5849
  });
@@ -7026,9 +7004,9 @@ const Layout$1 = props => {
7026
7004
  onMenuClick
7027
7005
  } = props;
7028
7006
  const store = useContext(ExampleContext);
7029
- const [expandkey, useExpandkey] = useState([]);
7007
+ const [expandkey, setExpandkey] = useState([]);
7030
7008
  useEffect(() => {
7031
- useExpandkey([]);
7009
+ setExpandkey([]);
7032
7010
  }, [store.curInfo?.key]);
7033
7011
  function Loading() {
7034
7012
  return jsx("div", {
@@ -7057,7 +7035,6 @@ const Layout$1 = props => {
7057
7035
  onDblclick?.(key, info);
7058
7036
  }
7059
7037
  }
7060
- console.log(expandkey, '啊我key');
7061
7038
  return jsxs("div", {
7062
7039
  className: 'file-continer-main',
7063
7040
  children: [store?.loading == ApiStatusEnum.LOADING && jsx(Loading, {}), jsxs(SelectBox, {
@@ -7101,6 +7078,7 @@ const Layout$1 = props => {
7101
7078
  type: 'table',
7102
7079
  checks: checks,
7103
7080
  expandedKeys: expandkey,
7081
+ loadedKeys: store.loadkey,
7104
7082
  treeData: store.curlist,
7105
7083
  columns: store.columns,
7106
7084
  checkType: store.checkType,
@@ -7131,8 +7109,11 @@ const Layout$1 = props => {
7131
7109
  onMenuClick: onMenuClick,
7132
7110
  onDblclick: _onDblclick,
7133
7111
  loadData: loadNode,
7112
+ onLoad: v => {
7113
+ store.setLoadKey(v);
7114
+ },
7134
7115
  onExpand: v => {
7135
- useExpandkey(v);
7116
+ setExpandkey(v);
7136
7117
  },
7137
7118
  onChange: v => {
7138
7119
  store.setCurList(v);
@@ -7389,6 +7370,7 @@ const Explorer = props => {
7389
7370
  const [menuSize, setMenuSize] = useState(80);
7390
7371
  const [reamekey, setReName] = useState(null);
7391
7372
  const [log, setLog] = useState([]);
7373
+ const [loadkey, setLoadKey] = useState([]);
7392
7374
  const [menutype, setMenutype] = useState('tile');
7393
7375
  const [infoshow, setInfoShow] = useState(false);
7394
7376
  const [loading, setLoading] = useState(ApiStatusEnum.READY);
@@ -7453,7 +7435,6 @@ const Explorer = props => {
7453
7435
  };
7454
7436
  let map = addLevel(curlist, {});
7455
7437
  setDataMap(map);
7456
- // setCurSelect('');
7457
7438
  }, [curlist]);
7458
7439
  //清空日志
7459
7440
  useEffect(() => {
@@ -7471,6 +7452,8 @@ const Explorer = props => {
7471
7452
  }, 300);
7472
7453
  return null;
7473
7454
  }
7455
+ //清空加载过的结点记录
7456
+ setLoadKey([]);
7474
7457
  setCurList(data?.fileList || []);
7475
7458
  setCurInfo(data?.current || {});
7476
7459
  setTimeout(() => {
@@ -7512,6 +7495,7 @@ const Explorer = props => {
7512
7495
  checkMode,
7513
7496
  reamekey,
7514
7497
  curSelect,
7498
+ loadkey,
7515
7499
  //icon
7516
7500
  getIcons: Icons,
7517
7501
  //set
@@ -7524,7 +7508,8 @@ const Explorer = props => {
7524
7508
  setPathDisplay,
7525
7509
  setLoading,
7526
7510
  setReName,
7527
- setCurSelect
7511
+ setCurSelect,
7512
+ setLoadKey
7528
7513
  },
7529
7514
  children: jsxs("div", {
7530
7515
  className: 'explorer-container',