@gingkoo/pandora-explorer 0.0.1-alpha.13 → 0.0.1-alpha.15

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.13
2
+ * @gingkoo/pandora-explorer v0.0.1-alpha.15
3
3
  */
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import cx$1 from 'classnames';
@@ -1595,16 +1595,16 @@ const ExplorerHead = props => {
1595
1595
  });
1596
1596
  }, [store?.curInfo?.pathDisplay]);
1597
1597
  function exit() {
1598
- loadData?.(store.curInfo?.parentPath);
1599
1598
  if (store.curInfo?.key) {
1600
1599
  let arr = cloneDeep(store.log) || [];
1601
1600
  arr?.push(store.curInfo?.key);
1602
1601
  store.setLog(arr);
1603
1602
  }
1603
+ loadData?.(store.curInfo?.parentPath);
1604
1604
  }
1605
1605
  function forward() {
1606
1606
  let arr = cloneDeep(store.log) || [];
1607
- let key = arr[arr.length];
1607
+ let key = arr[arr.length - 1];
1608
1608
  loadData?.(key);
1609
1609
  if (key) {
1610
1610
  let data = arr.filter(v => v !== key);
@@ -1722,7 +1722,7 @@ const ExplorerHead = props => {
1722
1722
  }), jsx("input", {
1723
1723
  type: 'file',
1724
1724
  onChange: e => {
1725
- props?.onDownload?.(e.target.files[0], store.curInfo);
1725
+ props?.onUpload?.(e.target.files[0], store.curInfo);
1726
1726
  }
1727
1727
  })]
1728
1728
  })
@@ -4899,11 +4899,13 @@ registerMenu('folder', [{
4899
4899
  suffix: ''
4900
4900
  }, {
4901
4901
  type: 'line'
4902
- }, {
4903
- key: 'download',
4904
- icon: 'download',
4905
- title: '下载'
4906
- }, {
4902
+ },
4903
+ // {
4904
+ // key: 'download',
4905
+ // icon: 'download',
4906
+ // title: '下载',
4907
+ // },
4908
+ {
4907
4909
  key: 'share-link-file',
4908
4910
  icon: jsx(ShareSvg, {}),
4909
4911
  title: '外链接分享'
@@ -5780,13 +5782,12 @@ const ExplorerMenu = props => {
5780
5782
  onChange: onChange,
5781
5783
  onSelect: v => {
5782
5784
  store.setPathDisplay(v?.pathDisplay);
5783
- // let map: any = store.dataMap?.[v?.key] || {};
5784
- // if (Array.isArray(map?.children)) {
5785
- // store.setCurInfo(map);
5786
- // store.setCurList(map?.children || []);
5787
- // } else {
5788
- loadData(v.key);
5789
- // }
5785
+ if (Array.isArray(v?.children)) {
5786
+ store.setCurInfo(v);
5787
+ store.setCurList(v?.children || []);
5788
+ } else {
5789
+ loadData(v.key);
5790
+ }
5790
5791
  },
5791
5792
  filterData: v => {
5792
5793
  if (v.type == 'file') return false;
@@ -5854,7 +5855,6 @@ function Tile(props) {
5854
5855
  width,
5855
5856
  icons,
5856
5857
  data,
5857
- select = '',
5858
5858
  checks = [],
5859
5859
  size = 80,
5860
5860
  onSelect,
@@ -5898,6 +5898,9 @@ function Tile(props) {
5898
5898
  style: {
5899
5899
  height: '100%'
5900
5900
  },
5901
+ onMouseDown: e => {
5902
+ e.preventDefault();
5903
+ },
5901
5904
  children: jsx(VirtualScroll, {
5902
5905
  className: '',
5903
5906
  item: list,
@@ -5907,10 +5910,10 @@ function Tile(props) {
5907
5910
  children: v?.map((v, i) => {
5908
5911
  const w = itemSize - 10;
5909
5912
  let menudata = [];
5910
- if (getMenu(props.id)) {
5911
- menudata = getMenu(props.id);
5912
- } else if (props.type && getMenu(props.type)) {
5913
- menudata = getMenu(props.type);
5913
+ if (getMenu(v.key)) {
5914
+ menudata = getMenu(v.key);
5915
+ } else if (v.type && getMenu(v.type)) {
5916
+ menudata = getMenu(v.type);
5914
5917
  } else {
5915
5918
  menudata = getMenu('');
5916
5919
  }
@@ -6968,7 +6971,7 @@ const Layout$1 = props => {
6968
6971
  store.setCurInfo(info);
6969
6972
  store.setCurList(info?.children);
6970
6973
  } else {
6971
- loadData();
6974
+ loadData(key, info);
6972
6975
  }
6973
6976
  } else {
6974
6977
  onDblclick?.(key, info);
@@ -7068,6 +7071,22 @@ const Layout$1 = props => {
7068
7071
  var css_248z = ".frame-main-info {\n height: 100%;\n width: 100%;\n border-left: 1px solid #6464641a;\n}\n.frame-main-info .info-header {\n height: 65px;\n background: #f6faff;\n background-image: linear-gradient(190deg, #e5f6ff, #fdfeff);\n border-bottom: 1px solid #eee;\n position: relative;\n z-index: 2;\n}\n.frame-main-info .info-header .file-icon {\n position: absolute;\n top: 7px;\n left: 10px;\n width: 50px;\n height: 50px;\n line-height: 50px;\n text-align: center;\n overflow: hidden;\n}\n.frame-main-info .info-header .file-icon > span {\n display: inline-block;\n width: 100%;\n height: 100%;\n}\n.frame-main-info .info-header .file-name {\n font-size: 15px;\n color: #666;\n word-break: break-word;\n padding-right: 30px;\n display: table-cell;\n vertical-align: middle;\n height: 60px;\n padding-left: 65px;\n line-height: 1.2em;\n}\n.frame-main-info .info-header .file-name .title {\n max-height: 35px;\n line-height: 1.2em;\n padding-top: 7px;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.frame-main-info .info-header .file-name .desc {\n font-size: 0.9em;\n color: #aaa;\n padding-top: 1px;\n white-space: nowrap;\n}\n.frame-main-info .info-content {\n position: absolute;\n bottom: 50px;\n top: 65px;\n width: 100%;\n overflow: hidden;\n overflow-y: auto;\n}\n.frame-main-info .info-content .panel-info {\n padding: 10px 0;\n}\n.frame-main-info .info-content .panel-info .panel-col {\n padding-left: 15px;\n padding-right: 10px;\n}\n.frame-main-info .info-content .panel-info .panel-col > .title {\n float: left;\n color: #999;\n text-align: left;\n padding: 0;\n margin: 0;\n line-height: 25px;\n width: 27%;\n margin-right: 1%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.frame-main-info .info-content .panel-info .panel-col > .content {\n float: left;\n word-break: break-word;\n color: #444;\n width: 72%;\n margin: 0;\n line-height: 25px;\n user-select: text;\n font-size: 1em;\n}\n.frame-main-info .info-content .panel-info .panel-col > .content-content {\n max-height: 120px;\n text-overflow: ellipsis;\n word-break: break-word;\n overflow: hidden;\n overflow-y: auto;\n padding: 4px 2% 5px 2%;\n}\n.frame-main-info .info-content .panel-info .panel-col > .content > textarea {\n border-radius: 5px;\n outline: none;\n width: 100%;\n line-height: 1.2em;\n padding: 4px 2% 4px 2%;\n border: 1px solid transparent;\n box-shadow: 0 0 0 1px #00000014;\n}\n.frame-main-info .info-content .panel-info .panel-col > .content textarea:hover {\n box-shadow: 0 0 0 1px #1890ff;\n}\n.frame-main-info .tab-group-line {\n margin: 0;\n background: #fafafa;\n border: none;\n text-align: center;\n position: absolute;\n z-index: 2;\n bottom: 0;\n width: 100%;\n padding: 0;\n border-top: 1px solid #eee;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.02);\n font-size: 1em;\n}\n";
7069
7072
  styleInject(css_248z);
7070
7073
 
7074
+ function convertBytesToSize(bytes) {
7075
+ const thresh = 1024;
7076
+ if (Math.abs(bytes) < thresh) {
7077
+ return bytes + ' B';
7078
+ }
7079
+ const units = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
7080
+ let u = -1;
7081
+ do {
7082
+ bytes /= thresh;
7083
+ ++u;
7084
+ } while (Math.abs(bytes) >= thresh && u < units.length - 1);
7085
+ return bytes.toFixed(1) + ' ' + units[u];
7086
+ }
7087
+ function DateFormat(date) {
7088
+ return typeof date == 'number' ? new Date(date).toISOString().slice(0, 10) : date || '';
7089
+ }
7071
7090
  function ExplorerInfo(props) {
7072
7091
  const {
7073
7092
  infoshow,
@@ -7101,7 +7120,7 @@ function ExplorerInfo(props) {
7101
7120
  children: "\u5927\u5C0F:"
7102
7121
  }), jsx("div", {
7103
7122
  className: 'content',
7104
- children: curInfo?.size || '-'
7123
+ children: typeof curInfo?.size == 'number' ? convertBytesToSize(curInfo?.size) : curInfo?.size || '-'
7105
7124
  })]
7106
7125
  }), jsxs("div", {
7107
7126
  className: 'panel-col',
@@ -7110,7 +7129,7 @@ function ExplorerInfo(props) {
7110
7129
  children: "\u521B\u5EFA\u65F6\u95F4 :"
7111
7130
  }), jsx("div", {
7112
7131
  className: 'content',
7113
- children: curInfo?.createTime || '-'
7132
+ children: DateFormat(curInfo?.createTime)
7114
7133
  })]
7115
7134
  }), jsxs("div", {
7116
7135
  className: 'panel-col',
@@ -7119,7 +7138,7 @@ function ExplorerInfo(props) {
7119
7138
  children: "\u4FEE\u6539\u65F6\u95F4 :"
7120
7139
  }), jsx("div", {
7121
7140
  className: 'content',
7122
- children: curInfo?.fixTime || '-'
7141
+ children: DateFormat(curInfo?.createTime)
7123
7142
  })]
7124
7143
  }), jsxs("div", {
7125
7144
  className: 'panel-col',
@@ -7141,7 +7160,7 @@ function ExplorerInfo(props) {
7141
7160
  className: 'panel-col',
7142
7161
  children: [jsx("div", {
7143
7162
  className: 'title',
7144
- children: "\u63CF\u8FF0\u8BF4\u660E :"
7163
+ children: "\u63CF\u8FF0\u8BF4\u660E:"
7145
7164
  }), jsx("div", {
7146
7165
  className: 'content',
7147
7166
  children: isEdit ? jsx("textarea", {
@@ -7171,8 +7190,8 @@ function ExplorerInfo(props) {
7171
7190
  children: curInfo?.title
7172
7191
  }), jsxs("div", {
7173
7192
  className: 'desc',
7174
- children: [jsxs("span", {
7175
- children: [curInfo?.size || '-', ","]
7193
+ children: [jsx("span", {
7194
+ children: typeof curInfo?.size == 'number' ? convertBytesToSize(curInfo?.size) : curInfo?.size || '-'
7176
7195
  }), jsx("span", {
7177
7196
  children: curInfo?.fixTime || '-'
7178
7197
  })]
@@ -7342,6 +7361,9 @@ const Explorer = props => {
7342
7361
  let map = addLevel(curlist, {});
7343
7362
  setDataMap(map);
7344
7363
  }, [curlist]);
7364
+ useEffect(() => {
7365
+ setLog([]);
7366
+ }, [curInfo]);
7345
7367
  async function loadData(key, param) {
7346
7368
  setLoading(ApiStatusEnum.LOADING);
7347
7369
  let data = (await props.loadData?.(key, param)) || {};