@gingkoo/pandora-explorer 0.0.1-alpha.22 → 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 +30 -49
- package/lib/es/index.js.map +1 -1
- package/lib/es/store.d.ts +2 -0
- package/package.json +1 -1
package/lib/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @gingkoo/pandora-explorer v0.0.1-alpha.
|
|
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?.api && !item?.children) {
|
|
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
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
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
|
-
|
|
5593
|
-
|
|
5594
|
-
setTimeout(() => {
|
|
5595
|
-
resolve();
|
|
5596
|
-
}, 100);
|
|
5569
|
+
onChange?.(tree);
|
|
5570
|
+
setTimeout(() => {
|
|
5597
5571
|
resolve();
|
|
5598
|
-
}
|
|
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',
|
|
@@ -7031,9 +7004,9 @@ const Layout$1 = props => {
|
|
|
7031
7004
|
onMenuClick
|
|
7032
7005
|
} = props;
|
|
7033
7006
|
const store = useContext(ExampleContext);
|
|
7034
|
-
const [expandkey,
|
|
7007
|
+
const [expandkey, setExpandkey] = useState([]);
|
|
7035
7008
|
useEffect(() => {
|
|
7036
|
-
|
|
7009
|
+
setExpandkey([]);
|
|
7037
7010
|
}, [store.curInfo?.key]);
|
|
7038
7011
|
function Loading() {
|
|
7039
7012
|
return jsx("div", {
|
|
@@ -7105,6 +7078,7 @@ const Layout$1 = props => {
|
|
|
7105
7078
|
type: 'table',
|
|
7106
7079
|
checks: checks,
|
|
7107
7080
|
expandedKeys: expandkey,
|
|
7081
|
+
loadedKeys: store.loadkey,
|
|
7108
7082
|
treeData: store.curlist,
|
|
7109
7083
|
columns: store.columns,
|
|
7110
7084
|
checkType: store.checkType,
|
|
@@ -7135,8 +7109,11 @@ const Layout$1 = props => {
|
|
|
7135
7109
|
onMenuClick: onMenuClick,
|
|
7136
7110
|
onDblclick: _onDblclick,
|
|
7137
7111
|
loadData: loadNode,
|
|
7112
|
+
onLoad: v => {
|
|
7113
|
+
store.setLoadKey(v);
|
|
7114
|
+
},
|
|
7138
7115
|
onExpand: v => {
|
|
7139
|
-
|
|
7116
|
+
setExpandkey(v);
|
|
7140
7117
|
},
|
|
7141
7118
|
onChange: v => {
|
|
7142
7119
|
store.setCurList(v);
|
|
@@ -7393,6 +7370,7 @@ const Explorer = props => {
|
|
|
7393
7370
|
const [menuSize, setMenuSize] = useState(80);
|
|
7394
7371
|
const [reamekey, setReName] = useState(null);
|
|
7395
7372
|
const [log, setLog] = useState([]);
|
|
7373
|
+
const [loadkey, setLoadKey] = useState([]);
|
|
7396
7374
|
const [menutype, setMenutype] = useState('tile');
|
|
7397
7375
|
const [infoshow, setInfoShow] = useState(false);
|
|
7398
7376
|
const [loading, setLoading] = useState(ApiStatusEnum.READY);
|
|
@@ -7457,7 +7435,6 @@ const Explorer = props => {
|
|
|
7457
7435
|
};
|
|
7458
7436
|
let map = addLevel(curlist, {});
|
|
7459
7437
|
setDataMap(map);
|
|
7460
|
-
// setCurSelect('');
|
|
7461
7438
|
}, [curlist]);
|
|
7462
7439
|
//清空日志
|
|
7463
7440
|
useEffect(() => {
|
|
@@ -7475,6 +7452,8 @@ const Explorer = props => {
|
|
|
7475
7452
|
}, 300);
|
|
7476
7453
|
return null;
|
|
7477
7454
|
}
|
|
7455
|
+
//清空加载过的结点记录
|
|
7456
|
+
setLoadKey([]);
|
|
7478
7457
|
setCurList(data?.fileList || []);
|
|
7479
7458
|
setCurInfo(data?.current || {});
|
|
7480
7459
|
setTimeout(() => {
|
|
@@ -7516,6 +7495,7 @@ const Explorer = props => {
|
|
|
7516
7495
|
checkMode,
|
|
7517
7496
|
reamekey,
|
|
7518
7497
|
curSelect,
|
|
7498
|
+
loadkey,
|
|
7519
7499
|
//icon
|
|
7520
7500
|
getIcons: Icons,
|
|
7521
7501
|
//set
|
|
@@ -7528,7 +7508,8 @@ const Explorer = props => {
|
|
|
7528
7508
|
setPathDisplay,
|
|
7529
7509
|
setLoading,
|
|
7530
7510
|
setReName,
|
|
7531
|
-
setCurSelect
|
|
7511
|
+
setCurSelect,
|
|
7512
|
+
setLoadKey
|
|
7532
7513
|
},
|
|
7533
7514
|
children: jsxs("div", {
|
|
7534
7515
|
className: 'explorer-container',
|