@gingkoo/pandora-explorer 0.0.1-alpha.75 → 0.0.1-alpha.77

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.75
2
+ * @gingkoo/pandora-explorer v0.0.1-alpha.77
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import cx$1 from 'classnames';
@@ -7000,6 +7000,21 @@ const SelectBox = props => {
7000
7000
  setSelect(ids);
7001
7001
  onChange(ids);
7002
7002
  }
7003
+ /*************** control 选中 ******************* */
7004
+ function controlSelectColumns(key) {
7005
+ if (store?.menutype != 'column') return false;
7006
+ if (!store?.dataMap) return false;
7007
+ let _start = store.dataMap?.[key]?.level || '';
7008
+ let num = _start.split('-').length;
7009
+ let is = checks.some(v => {
7010
+ let curlevel = store.dataMap?.[v]?.level || '';
7011
+ let curnum = curlevel.split('-').length;
7012
+ if (num != curnum) {
7013
+ return v;
7014
+ }
7015
+ });
7016
+ return is;
7017
+ }
7003
7018
  return jsxs("div", {
7004
7019
  ref: ref,
7005
7020
  className: cx$1(`file-select-box ${className}`),
@@ -7024,12 +7039,16 @@ const SelectBox = props => {
7024
7039
  onChange(arr);
7025
7040
  } else {
7026
7041
  let arr = [];
7027
- if (!checks.includes(type?.[0])) {
7028
- arr = [...selects, ...type];
7029
- setSelect(arr);
7030
- onChange(arr);
7042
+ let is = controlSelectColumns(type[0]);
7043
+ if (is) {
7044
+ setSelect(type);
7045
+ onChange(type);
7031
7046
  return;
7032
7047
  }
7048
+ arr = [...selects, ...type];
7049
+ setSelect(arr);
7050
+ onChange(arr);
7051
+ return;
7033
7052
  }
7034
7053
  return;
7035
7054
  }
@@ -7124,7 +7143,7 @@ const SelectBox = props => {
7124
7143
  });
7125
7144
  };
7126
7145
 
7127
- var css_248z$2 = ".explorer-columns {\n width: 100%;\n height: 100%;\n display: flex;\n position: relative;\n overflow: auto;\n}\n.explorer-columns .layer {\n position: relative;\n flex: 1 0 0;\n border-right: 1px solid #f5f5f5;\n}\n.explorer-columns .layer.select_col {\n box-shadow: 0 0 20px #e9f5ff inset;\n}\n.explorer-columns .layer.select_col::after {\n content: '';\n position: absolute;\n height: 4px;\n bottom: 0px;\n background: #50afff;\n left: 0;\n right: 0;\n}\n.explorer-columns .layer.list {\n min-width: 200px;\n}\n.explorer-columns .layer.list::before {\n position: absolute;\n content: '';\n top: 50%;\n right: 1px;\n width: 1px;\n height: 18px;\n margin-left: -1px;\n margin-top: -9px;\n border: 1px solid #ddd;\n border-top: none;\n border-bottom: none;\n backdrop-filter: none;\n border-radius: 0;\n background: transparent;\n box-sizing: content-box;\n -webkit-backdrop-filter: blur(10px);\n}\n.explorer-columns .layer.list .list-main {\n width: 100%;\n height: 100%;\n transition: 0.3s;\n padding-top: 5px;\n}\n.explorer-columns .layer.list .list-main .list-scroll::-webkit-scrollbar {\n width: 6px;\n}\n.explorer-columns .layer.list .list-main .list-scroll::-webkit-scrollbar-thumb {\n background-color: transparent;\n border-radius: 6px;\n transition: 0.3s;\n}\n.explorer-columns .layer.list .list-main:hover .list-scroll::-webkit-scrollbar-thumb {\n background-color: #00000030;\n}\n.explorer-columns .layer.list .drag {\n position: absolute;\n width: 8px;\n border-right: 1px solid #f5f5f5;\n right: -3px;\n top: 0;\n bottom: 0;\n cursor: col-resize;\n z-index: 10;\n}\n.explorer-columns .layer.list .drag:hover {\n background: #40a9ff4d;\n}\n.explorer-columns .layer.empty {\n display: flex;\n justify-content: center;\n padding-top: 100px;\n}\n.explorer-columns .layer.empty .empty-is-null {\n width: 200px;\n}\n.explorer-columns .layer.empty .empty-icon {\n height: 140px;\n}\n.explorer-columns .layer.empty .empty-desc {\n display: flex;\n justify-content: center;\n}\n.explorer-columns .layer.empty .empty-desc > span {\n display: inline-block;\n padding: 3px 10px;\n border-radius: 10px;\n line-height: 1;\n background: #a0a0a01a;\n color: #bbb;\n font-size: 0.9em;\n}\n.explorer-columns-list {\n padding-left: 10px;\n display: flex;\n height: 30px;\n margin-bottom: 2px;\n margin: 0 5px 3px 5px;\n align-items: center;\n border: 1px solid transparent;\n user-select: none;\n overflow: hidden;\n}\n.explorer-columns-list .columns-list-icon {\n display: flex;\n width: 18px;\n height: 18px;\n margin-right: 10px;\n flex-shrink: 0;\n}\n.explorer-columns-list .columns-list-title {\n width: 100%;\n display: inline-block;\n width: calc(100% - 30px);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.explorer-columns-list .columns-list-tool {\n min-width: 30px;\n}\n.explorer-columns-list .columns-list-input {\n flex: 1;\n height: 100%;\n outline: 0;\n border: 0;\n margin-right: 10px;\n background: #fff;\n}\n.explorer-columns-list.acitve {\n background: #e3f0ff;\n}\n.explorer-columns-list.last {\n margin-bottom: 100px;\n}\n.explorer-columns-list.checks {\n background: #cce8ff;\n border-color: #a8d8ff !important;\n}\n.explorer-columns-list.isedit {\n background: #cce8ff;\n border-color: #a8d8ff !important;\n}\n.explorer-columns-list:hover {\n background: #e3f0ff;\n border-color: #c9e2ff;\n}\n.explorer-columns-list:hover .edit {\n opacity: 1;\n}\n.explorer-columns-loading {\n position: absolute;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 999;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n}\n.explorer-columns-loading .loading-content {\n width: 100px;\n height: 106px;\n border-radius: 6px;\n background: rgba(255, 255, 255, 0.7);\n box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.07);\n color: #888;\n}\n.explorer-columns-loading .loading-content-icon {\n display: flex;\n justify-content: center;\n margin: 25px auto 6px auto;\n font-size: 30px;\n}\n.explorer-columns-loading .loading-content-icon > i {\n animation: rotate 1.5s linear infinite;\n}\n.explorer-columns-loading .loading-content-title {\n padding-top: 15px;\n text-align: center;\n}\n.explorer-columns.notdata .explorer-notdata {\n width: 100%;\n}\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
7146
+ var css_248z$2 = ".explorer-columns {\n width: 100%;\n height: 100%;\n display: flex;\n position: relative;\n overflow: auto;\n}\n.explorer-columns .layer {\n position: relative;\n min-width: 200px;\n flex: 1 0 0;\n border-right: 1px solid #f5f5f5;\n}\n.explorer-columns .layer.select_col {\n box-shadow: 0 0 20px #e9f5ff inset;\n}\n.explorer-columns .layer.select_col::after {\n content: '';\n position: absolute;\n height: 4px;\n bottom: 0px;\n background: #50afff;\n left: 0;\n right: 0;\n}\n.explorer-columns .layer.list {\n min-width: 200px;\n}\n.explorer-columns .layer.list::before {\n position: absolute;\n content: '';\n top: 50%;\n right: 1px;\n width: 1px;\n height: 18px;\n margin-left: -1px;\n margin-top: -9px;\n border: 1px solid #ddd;\n border-top: none;\n border-bottom: none;\n backdrop-filter: none;\n border-radius: 0;\n background: transparent;\n box-sizing: content-box;\n -webkit-backdrop-filter: blur(10px);\n}\n.explorer-columns .layer.list .list-main {\n width: 100%;\n height: 100%;\n transition: 0.3s;\n padding-top: 5px;\n}\n.explorer-columns .layer.list .list-main .list-scroll::-webkit-scrollbar {\n width: 6px;\n}\n.explorer-columns .layer.list .list-main .list-scroll::-webkit-scrollbar-thumb {\n background-color: transparent;\n border-radius: 6px;\n transition: 0.3s;\n}\n.explorer-columns .layer.list .list-main:hover .list-scroll::-webkit-scrollbar-thumb {\n background-color: #00000030;\n}\n.explorer-columns .layer.list .drag {\n position: absolute;\n width: 8px;\n border-right: 1px solid #f5f5f5;\n right: -3px;\n top: 0;\n bottom: 0;\n cursor: col-resize;\n z-index: 10;\n}\n.explorer-columns .layer.list .drag:hover {\n background: #40a9ff4d;\n}\n.explorer-columns .layer.empty {\n display: flex;\n justify-content: center;\n padding-top: 100px;\n}\n.explorer-columns .layer.empty .empty-is-null {\n width: 200px;\n}\n.explorer-columns .layer.empty .empty-icon {\n height: 140px;\n}\n.explorer-columns .layer.empty .empty-desc {\n display: flex;\n justify-content: center;\n}\n.explorer-columns .layer.empty .empty-desc > span {\n display: inline-block;\n padding: 3px 10px;\n border-radius: 10px;\n line-height: 1;\n background: #a0a0a01a;\n color: #bbb;\n font-size: 0.9em;\n}\n.explorer-columns-list {\n padding-left: 10px;\n display: flex;\n height: 30px;\n margin-bottom: 2px;\n margin: 0 5px 3px 5px;\n align-items: center;\n border: 1px solid transparent;\n user-select: none;\n overflow: hidden;\n}\n.explorer-columns-list .columns-list-icon {\n display: flex;\n width: 18px;\n height: 18px;\n margin-right: 10px;\n flex-shrink: 0;\n}\n.explorer-columns-list .columns-list-title {\n width: 100%;\n display: inline-block;\n width: calc(100% - 30px);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.explorer-columns-list .columns-list-input {\n flex: 1;\n height: 100%;\n outline: 0;\n border: 0;\n margin-right: 10px;\n background: #fff;\n}\n.explorer-columns-list.acitve {\n background: #e3f0ff;\n}\n.explorer-columns-list.last {\n margin-bottom: 100px;\n}\n.explorer-columns-list.checks {\n background: #cce8ff;\n border-color: #a8d8ff !important;\n}\n.explorer-columns-list.isedit {\n background: #cce8ff;\n border-color: #a8d8ff !important;\n}\n.explorer-columns-list.disable {\n opacity: 0.4;\n}\n.explorer-columns-list:hover {\n background: #e3f0ff;\n border-color: #c9e2ff;\n}\n.explorer-columns-list:hover .edit {\n opacity: 1;\n}\n.explorer-columns-loading {\n position: absolute;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 999;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n}\n.explorer-columns-loading .loading-content {\n width: 100px;\n height: 106px;\n border-radius: 6px;\n background: rgba(255, 255, 255, 0.7);\n box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.07);\n color: #888;\n}\n.explorer-columns-loading .loading-content-icon {\n display: flex;\n justify-content: center;\n margin: 25px auto 6px auto;\n font-size: 30px;\n}\n.explorer-columns-loading .loading-content-icon > i {\n animation: rotate 1.5s linear infinite;\n}\n.explorer-columns-loading .loading-content-title {\n padding-top: 15px;\n text-align: center;\n}\n.explorer-columns.notdata .explorer-notdata {\n width: 100%;\n}\n@keyframes rotate {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n";
7128
7147
  styleInject(css_248z$2);
7129
7148
 
7130
7149
  function Item(props) {
@@ -7135,21 +7154,27 @@ function Item(props) {
7135
7154
  isedit,
7136
7155
  checks = false,
7137
7156
  icon,
7138
- parent
7157
+ parent,
7158
+ onDblclick
7139
7159
  } = props;
7140
7160
  const [value, setValue] = useState('');
7141
7161
  useEffect(() => {
7142
7162
  setValue(props?.title);
7143
7163
  }, [props?.title]);
7164
+ let disable = false;
7165
+ if (Array.isArray(props.selectedSuffix)) {
7166
+ disable = !props.selectedSuffix.includes(props.suffix) && !props.selectedSuffix?.includes(props?.type);
7167
+ }
7144
7168
  return jsxs("div", {
7145
7169
  className: cx$1('explorer-columns-list', {
7146
7170
  last: props?.end,
7147
7171
  acitve: acitve,
7148
7172
  checks: checks,
7149
- isedit: isedit
7173
+ isedit: isedit,
7174
+ disable
7150
7175
  }),
7151
- "data-id": props.id,
7152
- "data-type": props.type,
7176
+ "data-id": !disable ? props.id : null,
7177
+ "data-type": !disable ? props.type : null,
7153
7178
  onClick: onClick,
7154
7179
  onContextMenu: e => {
7155
7180
  e.preventDefault();
@@ -7187,6 +7212,9 @@ function Item(props) {
7187
7212
  key: props.id
7188
7213
  });
7189
7214
  },
7215
+ onDoubleClick: e => {
7216
+ onDblclick?.();
7217
+ },
7190
7218
  children: [icon && icon?.(props, 'columns-list-icon'), isedit ? jsx("input", {
7191
7219
  className: 'columns-list-input',
7192
7220
  autoFocus: true,
@@ -7259,16 +7287,20 @@ function Columns(props) {
7259
7287
  checks = [],
7260
7288
  icons,
7261
7289
  onLoadData,
7262
- onChange
7290
+ onChange,
7291
+ onDblclick
7263
7292
  } = props;
7264
7293
  const ref = useRef(null);
7265
- const [layer, setLayer] = useState(new Array(6).fill([])); //文件列表数据
7266
- const [width, setWidth] = useState(new Array(6).fill(null)); //记录每行的宽度
7294
+ const scroll = useRef({
7295
+ x: 0,
7296
+ y: 0
7297
+ });
7298
+ const [layer, setLayer] = useState(new Array(5).fill([])); //文件列表数据
7299
+ const [width, setWidth] = useState(new Array(5).fill(null)); //记录每行的宽度
7267
7300
  const [select_col, setSelectCol] = useState(0); //选中栏
7268
- const [select_info, setSelectInfo] = useState(''); //当前选中 key
7269
7301
  const [isdrag, setIsdarg] = useState(false);
7270
7302
  useEffect(() => {
7271
- let arr = new Array(6).fill('');
7303
+ let arr = new Array(5).fill('');
7272
7304
  //清空
7273
7305
  store.setExpandkey(arr);
7274
7306
  }, [store.curInfo.key]);
@@ -7281,10 +7313,11 @@ function Columns(props) {
7281
7313
  }, [select_col, store?.expandkey]);
7282
7314
  let avg = useMemo(() => {
7283
7315
  if (!_w) return 0;
7284
- return Math.ceil(_w / 6);
7316
+ let num = Math.ceil(_w / 5);
7317
+ return num < 200 ? 200 : num;
7285
7318
  }, [_w]);
7286
7319
  async function initdata() {
7287
- let arr = new Array(6).fill([]);
7320
+ let arr = new Array(5).fill([]);
7288
7321
  let {
7289
7322
  layer,
7290
7323
  isApi,
@@ -7300,7 +7333,7 @@ function Columns(props) {
7300
7333
  // 1. 返回 没层用到的数据
7301
7334
  // 2. 返回 是否调用接口
7302
7335
  // 3. 如果掉调用借口 需要记录 数据给到 children 上
7303
- let arr = new Array(6).fill([]);
7336
+ let arr = new Array(5).fill([]);
7304
7337
  let api = false;
7305
7338
  let child = [];
7306
7339
  if (Array.isArray(data)) {
@@ -7364,9 +7397,15 @@ function Columns(props) {
7364
7397
  }
7365
7398
  return x + 0;
7366
7399
  }, 0);
7367
- arr[select_col] = e.nativeEvent.clientX - dom.left - data;
7400
+ arr[select_col] = scroll.current.y + e.nativeEvent.clientX - dom.left - data;
7368
7401
  setWidth(arr);
7369
7402
  }
7403
+ function handleScroll(e) {
7404
+ scroll.current = {
7405
+ x: e.target.scrollTop,
7406
+ y: e.target.scrollLeft
7407
+ };
7408
+ }
7370
7409
  function setlevel(data, level) {
7371
7410
  let arr = cloneDeep(store.expandkey);
7372
7411
  arr.fill('', level + 1);
@@ -7406,6 +7445,9 @@ function Columns(props) {
7406
7445
  }),
7407
7446
  onClick: e => {
7408
7447
  setSelectCol(level);
7448
+ if (store.expandkey[level - 1]) {
7449
+ store.setCurSelect(store.expandkey[level - 1]);
7450
+ }
7409
7451
  },
7410
7452
  children: jsxs("div", {
7411
7453
  className: 'empty-is-null',
@@ -7424,7 +7466,11 @@ function Columns(props) {
7424
7466
  }
7425
7467
  if (!Array.isArray(list) || !list.length) {
7426
7468
  return jsx("div", {
7427
- className: cx$1('layer', {})
7469
+ className: cx$1('layer', {}),
7470
+ style: {
7471
+ minWidth: avg + 'px',
7472
+ flex: `0 0 ${avg}px`
7473
+ }
7428
7474
  });
7429
7475
  }
7430
7476
  return jsxs("div", {
@@ -7433,6 +7479,11 @@ function Columns(props) {
7433
7479
  }),
7434
7480
  onClick: e => {
7435
7481
  setSelectCol(level);
7482
+ if (store.expandkey[level - 1]) {
7483
+ store.setCurSelect(store.expandkey[level - 1]);
7484
+ } else {
7485
+ store.setCurSelect(null);
7486
+ }
7436
7487
  },
7437
7488
  style: {
7438
7489
  flex: ` 0 0 ${width[level]}px`,
@@ -7449,10 +7500,11 @@ function Columns(props) {
7449
7500
  ...v,
7450
7501
  key: level + '-' + i,
7451
7502
  icon: icons,
7452
- acitve: store.expandkey[level] == v.key || select_info == v.key,
7503
+ acitve: store.expandkey[level] == v.key,
7453
7504
  id: v.key,
7454
7505
  end: end,
7455
7506
  checks: checks?.includes(v.key),
7507
+ selectedSuffix: store.selectedSuffix,
7456
7508
  isedit: store.reamekey == v.key || v.create_file,
7457
7509
  store: store,
7458
7510
  openMenu: store.openMenu,
@@ -7460,10 +7512,13 @@ function Columns(props) {
7460
7512
  await props?.onRename?.(key, value, info);
7461
7513
  },
7462
7514
  onMenuClick: props?.onMenuClick,
7463
- onClick: async () => {
7515
+ onClick: async e => {
7464
7516
  //shift 键按下 进行展开
7465
7517
  if (store.shift) return;
7466
- setSelectInfo(v.key);
7518
+ e.stopPropagation();
7519
+ store.closeMenu();
7520
+ store.setCurSelect(v.key);
7521
+ setSelectCol(level);
7467
7522
  if (v.type == 'folder') {
7468
7523
  let select = setlevel(v.key, level);
7469
7524
  let loaddata = null;
@@ -7476,6 +7531,9 @@ function Columns(props) {
7476
7531
  store.setExpandkey(select);
7477
7532
  }
7478
7533
  },
7534
+ onDblclick: () => {
7535
+ onDblclick?.(v.key, v);
7536
+ },
7479
7537
  parent: parent
7480
7538
  });
7481
7539
  }
@@ -7496,6 +7554,7 @@ function Columns(props) {
7496
7554
  [className || '']: className
7497
7555
  }),
7498
7556
  onMouseMove: handleMousemove,
7557
+ onScroll: handleScroll,
7499
7558
  onMouseUp: () => {
7500
7559
  setIsdarg(false);
7501
7560
  },
@@ -7617,8 +7676,8 @@ const Layout$1 = props => {
7617
7676
  return jsxs("div", {
7618
7677
  className: 'file-continer-main',
7619
7678
  onClick: () => {
7620
- store.setCurSelect(null);
7621
7679
  if (store?.menutype !== 'column') {
7680
+ store.setCurSelect(null);
7622
7681
  store.setCurSelectFile(null);
7623
7682
  }
7624
7683
  },
@@ -7656,7 +7715,7 @@ const Layout$1 = props => {
7656
7715
  onClick: onClick,
7657
7716
  onRename: onRename,
7658
7717
  onMenuClick: onMenuClick,
7659
- onDblclick: onDblclick,
7718
+ onDblclick: _onDblclick,
7660
7719
  height: height,
7661
7720
  width: width,
7662
7721
  onChange: v => {
@@ -8021,9 +8080,7 @@ Object.defineProperty(Array.prototype, 'myforeach', {
8021
8080
  if (index in arr) {
8022
8081
  try {
8023
8082
  await fn.call(context, arr[index], index, arr);
8024
- } catch (e) {
8025
- console.log(e);
8026
- }
8083
+ } catch (e) {}
8027
8084
  }
8028
8085
  index++;
8029
8086
  }
@@ -8093,6 +8150,7 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
8093
8150
  isUpload = true,
8094
8151
  isEdit = true,
8095
8152
  isDownload = true,
8153
+ isOpenMenu = true,
8096
8154
  isNavtab = true,
8097
8155
  checks,
8098
8156
  accept,
@@ -8369,6 +8427,7 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
8369
8427
  if (!curInfo) return;
8370
8428
  let input = document.createElement('input');
8371
8429
  input.type = 'file';
8430
+ input.accept = accept || '';
8372
8431
  input.multiple = true;
8373
8432
  input?.click();
8374
8433
  input.onchange = async e => {
@@ -8451,6 +8510,7 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
8451
8510
  setCurList(list);
8452
8511
  }
8453
8512
  function openMenu(props, param) {
8513
+ if (!isOpenMenu) return;
8454
8514
  closeMenu();
8455
8515
  let {
8456
8516
  x = 0,
@@ -8505,7 +8565,7 @@ const Explorer = /*#__PURE__*/forwardRef((props, ref) => {
8505
8565
  `;
8506
8566
  }, 100);
8507
8567
  }
8508
- /* *********** 拦截进行特殊处理 *********** */
8568
+ /* *********** 拦截进行特殊处理 *********** */
8509
8569
  async function onMenuClick(key, param, type) {
8510
8570
  if (key == 'remove') {
8511
8571
  if (type == 'menu') {