@gingkoo/pandora-explorer 0.0.1-alpha.96 → 0.0.1-alpha.97

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.96
2
+ * @gingkoo/pandora-explorer v0.0.1-alpha.97
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import cx$1 from 'classnames';
@@ -5532,6 +5532,7 @@ function TableItem(props) {
5532
5532
  ischeck,
5533
5533
  onCheck,
5534
5534
  onMenuClick,
5535
+ isdrag,
5535
5536
  rename,
5536
5537
  onRename,
5537
5538
  onSelect,
@@ -5549,6 +5550,7 @@ function TableItem(props) {
5549
5550
  }),
5550
5551
  "data-id": !disable ? id : null,
5551
5552
  "data-type": !disable ? props.type : null,
5553
+ "data-isdrag": isdrag === false ? false : true,
5552
5554
  onContextMenu: e => {
5553
5555
  e.stopPropagation();
5554
5556
  e.preventDefault();
@@ -5951,7 +5953,7 @@ var Tree = /*#__PURE__*/forwardRef((props, _ref) => {
5951
5953
  return size > w ? size : Math.ceil(w);
5952
5954
  }, [width, _widht]);
5953
5955
  useEffect(() => {
5954
- let arr = cloneDeep(treeData);
5956
+ let arr = cloneDeep(treeData) || [];
5955
5957
  arr = addLevel(arr, 0, type, filterData);
5956
5958
  setData(arr);
5957
5959
  }, [treeData, type, filterData]);
@@ -6843,7 +6845,7 @@ const SelectBox = props => {
6843
6845
  * @param isregion//是否过滤区域
6844
6846
  * @returns
6845
6847
  */
6846
- function isSelectTarget(e, checkType, status, isregion) {
6848
+ function isSelectTarget(e, checkType, status, isregion, drag = true) {
6847
6849
  let idx = [];
6848
6850
  Array.from(document.querySelectorAll(selectClass)).filter(v => {
6849
6851
  if (v.contains(e.target)) {
@@ -6852,6 +6854,10 @@ const SelectBox = props => {
6852
6854
  dataDom = v.querySelector(dataClass);
6853
6855
  }
6854
6856
  let id = dataDom?.getAttribute('data-id');
6857
+ if (drag) {
6858
+ let isdrag = dataDom?.getAttribute('data-isdrag');
6859
+ if (isdrag == 'false') return;
6860
+ }
6855
6861
  if (checkType) {
6856
6862
  let type = dataDom?.getAttribute('data-type');
6857
6863
  if (type !== checkType) return;
@@ -6943,7 +6949,7 @@ const SelectBox = props => {
6943
6949
  });
6944
6950
  onMouseup?.(e);
6945
6951
  if (cur.current?.length) {
6946
- let target = isSelectTarget(e, 'folder', '', true);
6952
+ let target = isSelectTarget(e, 'folder', '', true, false);
6947
6953
  if (target?.[0] && !checks?.includes(target?.[0])) {
6948
6954
  if (target?.[0] !== stageClickInfo.startkey) {
6949
6955
  props.onMoveFile(checks, target?.[0]);
@@ -6971,7 +6977,7 @@ const SelectBox = props => {
6971
6977
  }
6972
6978
  }
6973
6979
  /***************** 拖动 *****************/
6974
- //拖动文件
6980
+ //拖动文件 (外部文件上传)
6975
6981
  const handleDragOver = e => {
6976
6982
  e?.preventDefault();
6977
6983
  const {
@@ -7092,7 +7098,7 @@ const SelectBox = props => {
7092
7098
  }
7093
7099
  });
7094
7100
  await Promise.all(promises);
7095
- let data = isSelectTarget(e, 'folder', '', true);
7101
+ let data = isSelectTarget(e, 'folder', '', true, false);
7096
7102
  handleDragLeave();
7097
7103
  let key = null;
7098
7104
  if (typeof data?.[0] == 'string' && store?.dataMap?.[data?.[0]]) {
@@ -7142,7 +7148,7 @@ const SelectBox = props => {
7142
7148
  }
7143
7149
  setIsDragUpload(true);
7144
7150
  }
7145
- /*********** 创建绘制页面 *************/
7151
+ /*********** 创建绘制页面 (拖动是执行样式) *************/
7146
7152
  //创建文案
7147
7153
  function createText() {
7148
7154
  let _box = null;
@@ -7319,6 +7325,8 @@ const SelectBox = props => {
7319
7325
  let type = dataDom?.getAttribute('data-type');
7320
7326
  if (type !== checkType) return;
7321
7327
  }
7328
+ let isdrag = dataDom?.getAttribute('data-isdrag');
7329
+ if (isdrag == 'false') return;
7322
7330
  let id = dataDom?.getAttribute('data-id');
7323
7331
  if (id && !idx.includes(id)) {
7324
7332
  idx.push(id);
@@ -7910,7 +7918,7 @@ const SelectBox = props => {
7910
7918
  store: store,
7911
7919
  menu: menudata,
7912
7920
  loadMenu: v => {
7913
- let menu = loadMenu(v);
7921
+ let menu = loadMenu?.(v);
7914
7922
  if (menu?.key == 'rename') return undefined;
7915
7923
  if (menu?.key == 'copy') return undefined;
7916
7924
  return menu;
@@ -9071,9 +9079,9 @@ const Layout = props => {
9071
9079
  poi: isNavtab ? [200] : [0, 'max'],
9072
9080
  fix: [true, false],
9073
9081
  rang: [10, 350],
9074
- children: [jsx(ExplorerMenu, {
9082
+ children: [isNavtab ? jsx(ExplorerMenu, {
9075
9083
  ...props
9076
- }), jsxs("div", {
9084
+ }) : jsx(Fragment, {}), jsxs("div", {
9077
9085
  className: 'frame-right',
9078
9086
  children: [isHeader && jsx("div", {
9079
9087
  className: 'frame-header',
@@ -9257,6 +9265,7 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
9257
9265
  accept,
9258
9266
  selectedSuffix,
9259
9267
  multiple = true,
9268
+ filelist,
9260
9269
  expandkey: _expandkey,
9261
9270
  createFile,
9262
9271
  onCopy,
@@ -9322,6 +9331,11 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
9322
9331
  },
9323
9332
  createFolder: createFolder
9324
9333
  }));
9334
+ useEffect(() => {
9335
+ if (Array.isArray(filelist)) {
9336
+ setCurList(filelist);
9337
+ }
9338
+ }, [filelist]);
9325
9339
  /* ************ 挂载监听 **************** */
9326
9340
  useEffect(() => {
9327
9341
  window.addEventListener('click', closeMenu);
@@ -9424,7 +9438,9 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
9424
9438
  }, [curlist, curSelectFile, curInfo]);
9425
9439
  //切换当前 文件目录时 需要清空的内容
9426
9440
  useEffect(() => {
9441
+ if (!curInfo?.key) return;
9427
9442
  setExpandkey([]);
9443
+ onExpand?.([]);
9428
9444
  setCurSelect(null);
9429
9445
  props?.onCheck?.([]);
9430
9446
  }, [curInfo?.key]);
@@ -9446,6 +9462,7 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
9446
9462
  }, [dataMap]);
9447
9463
  /* ************ 加载更新数据 **************** */
9448
9464
  async function loadData(key, param, closeload = true) {
9465
+ if (!props?.loadData) return;
9449
9466
  closeload && setLoading(ApiStatusEnum.LOADING);
9450
9467
  let data = (await props.loadData?.(key, param)) || {};
9451
9468
  if (data.status == 'Err') {
@@ -9657,7 +9674,8 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
9657
9674
  type: _type,
9658
9675
  title: _type == 'folder' ? '新建文件夹' : `新建文件.${suffix}`,
9659
9676
  create_file: true,
9660
- suffix: suffix
9677
+ suffix: suffix,
9678
+ parent: params
9661
9679
  });
9662
9680
  setCurList(list);
9663
9681
  }
@@ -9824,8 +9842,8 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
9824
9842
  if (curInfo || !isNavtab) {
9825
9843
  setLoading(ApiStatusEnum.LOADING);
9826
9844
  await createFile?.(value, param, info);
9827
- await loadData(curInfo?.key || '', null, false);
9828
- reloadNode(curInfo?.key || '', param);
9845
+ await loadData?.(curInfo?.key || '', null, false);
9846
+ // data && reloadNode(curInfo?.key || '', param);
9829
9847
  setLoading(ApiStatusEnum.READY);
9830
9848
  }
9831
9849
  } else {
@@ -9843,7 +9861,7 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
9843
9861
  });
9844
9862
  }
9845
9863
  } else {
9846
- curInfo?.key && loadData(curInfo?.key || '');
9864
+ loadData(curInfo?.key || '');
9847
9865
  updata(key, {
9848
9866
  title: value
9849
9867
  });
@@ -9911,7 +9929,7 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
9911
9929
  totalNum,
9912
9930
  //icon
9913
9931
  getIcons: Icons,
9914
- loadMenu: props.loadMenu,
9932
+ loadMenu: props?.loadMenu,
9915
9933
  uploadFile,
9916
9934
  createFolder,
9917
9935
  reloadNode,