@gingkoo/pandora-explorer 0.0.1-alpha.52 → 0.0.1-alpha.53

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.52
2
+ * @gingkoo/pandora-explorer v0.0.1-alpha.53
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import cx$1 from 'classnames';
@@ -1538,7 +1538,6 @@ function Dropdown(props) {
1538
1538
  },
1539
1539
  onClick: e => {
1540
1540
  if (trigger == 'click') {
1541
- e.stopPropagation();
1542
1541
  let x = 0;
1543
1542
  let y = 0;
1544
1543
  x = e.nativeEvent.clientX + 5;
@@ -5305,12 +5304,12 @@ function TableItem(props) {
5305
5304
  onRename?.(e.target?.value);
5306
5305
  return;
5307
5306
  }
5308
- if (e.target?.value === param[v?.key]) {
5309
- onRename?.(false);
5310
- return;
5311
- }
5312
5307
  onRename?.(e.target?.value);
5313
5308
  }
5309
+ if (e.key === 'Escape') {
5310
+ onRename?.(false);
5311
+ return;
5312
+ }
5314
5313
  },
5315
5314
  onFocus: e => {
5316
5315
  let i = param[v?.key]?.lastIndexOf('.');
@@ -5385,6 +5384,9 @@ var TreeItem = (props => {
5385
5384
  menudata = getMenu('');
5386
5385
  }
5387
5386
  return jsx("div", {
5387
+ style: {
5388
+ height: '100%'
5389
+ },
5388
5390
  onContextMenu: e => {
5389
5391
  e.preventDefault();
5390
5392
  let x = 0;
@@ -5417,6 +5419,9 @@ var TreeItem = (props => {
5417
5419
  if (e.key === 'Enter' || e.keyCode === 13) {
5418
5420
  onRename?.(title);
5419
5421
  }
5422
+ if (e.key === 'Escape') {
5423
+ onRename?.(false);
5424
+ }
5420
5425
  },
5421
5426
  onFocus: e => {
5422
5427
  let i = title.lastIndexOf('.');
@@ -5435,30 +5440,35 @@ var TreeItem = (props => {
5435
5440
  })
5436
5441
  }) : jsxs("div", {
5437
5442
  className: 'explorer-tree-node',
5438
- onClick: () => {},
5439
5443
  children: [jsx("div", {
5440
5444
  className: 'node-title',
5441
5445
  children: title || ''
5442
5446
  }), jsx("div", {
5443
5447
  className: 'node-menu',
5444
- children: props?.menu !== false && jsx(Dropdown, {
5445
- trigger: 'click',
5446
- placement: 'right',
5447
- dropdownRender: ({
5448
- onClone
5449
- }) => {
5450
- return jsx(Menu, {
5451
- menu: menudata,
5452
- onChange: v => {
5453
- onClone && onClone();
5454
- onMenuClick && onMenuClick(v);
5455
- }
5448
+ children: props?.menu !== false && jsx("div", {
5449
+ className: 'node-menu-icon',
5450
+ onClick: e => {
5451
+ e.stopPropagation();
5452
+ let x = 0;
5453
+ let y = 0;
5454
+ x = e.nativeEvent.clientX + 5;
5455
+ y = e.nativeEvent.clientY + 5;
5456
+ props?.openMenu({
5457
+ x,
5458
+ y,
5459
+ content: jsx(Menu, {
5460
+ menu: menudata,
5461
+ loadMenu: loadMenu,
5462
+ onChange: async v => {
5463
+ onMenuClick && onMenuClick(v);
5464
+ props?.closeMenu?.();
5465
+ }
5466
+ })
5467
+ }, {
5468
+ key: props.id
5456
5469
  });
5457
5470
  },
5458
- children: jsx("div", {
5459
- className: 'node-menu-icon',
5460
- children: jsx(CaretRight, {})
5461
- })
5471
+ children: jsx(CaretRight, {})
5462
5472
  })
5463
5473
  })]
5464
5474
  })
@@ -7684,9 +7694,9 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
7684
7694
  };
7685
7695
  }, []);
7686
7696
  useLayoutEffect(() => {
7687
- document.addEventListener('keydown', handleKeyDown);
7697
+ window.addEventListener('keydown', handleKeyDown);
7688
7698
  return () => {
7689
- document.removeEventListener('keydown', handleKeyDown);
7699
+ window.removeEventListener('keydown', handleKeyDown);
7690
7700
  };
7691
7701
  }, [curSelect, dataMap]);
7692
7702
  const handleKeyDown = e => {
@@ -7699,17 +7709,17 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
7699
7709
  if (e.altKey && e.key === '1') {
7700
7710
  setMenutype('tile');
7701
7711
  }
7702
- if (e.altKey && e.key === 'c') {
7712
+ if (e.ctrlKey && e.key === 'c') {
7703
7713
  if (curSelect && dataMap?.[curSelect]) {
7704
7714
  onCopy?.(dataMap?.[curSelect]);
7705
7715
  }
7706
7716
  }
7707
- if (e.altKey && e.key === 'x') {
7717
+ if (e.ctrlKey && e.key === 'x') {
7708
7718
  if (curSelect && dataMap?.[curSelect]) {
7709
7719
  onCopy?.(dataMap?.[curSelect]);
7710
7720
  }
7711
7721
  }
7712
- if (e.altKey && e.key === 'v') {
7722
+ if (e.ctrlKey && e.key === 'v') {
7713
7723
  if (curSelect && dataMap?.[curSelect]) {
7714
7724
  onCopy?.(dataMap?.[curSelect]);
7715
7725
  }
@@ -7855,6 +7865,28 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
7855
7865
  //创建和重名
7856
7866
  async function onRename(key, value, info, type) {
7857
7867
  if (info.create_file) {
7868
+ const delata = data => {
7869
+ let arr = data;
7870
+ let filter = [];
7871
+ let i = 0;
7872
+ while (i < arr.length) {
7873
+ let item = arr[i];
7874
+ if (!item?.create_file) {
7875
+ filter.push(item);
7876
+ }
7877
+ if (Array.isArray(item.children)) {
7878
+ item.children = delata(item.children);
7879
+ }
7880
+ i++;
7881
+ }
7882
+ return filter || [];
7883
+ };
7884
+ if (value === false) {
7885
+ let arr = delata(curlist);
7886
+ console.log(arr, 123);
7887
+ setCurList(arr);
7888
+ return;
7889
+ }
7858
7890
  if (curInfo) {
7859
7891
  await createFile?.(value, curInfo);
7860
7892
  curInfo?.key && loadData(curInfo?.key);