seeder-resources-view 1.3.1 → 1.3.2

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/dist/index.esm.js CHANGED
@@ -17995,10 +17995,14 @@ const useDirectoryTree = _ref => {
17995
17995
  const addedNode = parentNode[0].children.find(ch => pathUtils.isSamePath(ch.path, expectedPath));
17996
17996
  if (addedNode) {
17997
17997
  updateTreeState({
17998
- expandedKeys: [...treeState.expandedKeys, addedNode.key, parentNode[0].key]
17998
+ selectedKeys: [addedNode.key],
17999
+ expandedKeys: [...treeState.expandedKeys, addedNode.key, parentNode[0].key],
18000
+ currentPath: addedNode.path,
18001
+ contents: []
17999
18002
  });
18000
18003
  }
18001
18004
  }
18005
+ ;
18002
18006
  } catch (error) {
18003
18007
  handleError(error, 'CREATE FOLDER');
18004
18008
  }
@@ -18167,6 +18171,9 @@ const createUrlBuilder = function () {
18167
18171
  };
18168
18172
  };
18169
18173
 
18174
+ const pathUtils = {
18175
+ replaceRoot: path => path.replace(/^root$|^root\//, '')
18176
+ };
18170
18177
  const ResourcesView = _ref => {
18171
18178
  let {
18172
18179
  apiConfig = {},
@@ -18272,7 +18279,7 @@ const ResourcesView = _ref => {
18272
18279
  setShowProgress(true);
18273
18280
  setPercent(0);
18274
18281
  try {
18275
- await uploadFiles(files, currentPath);
18282
+ await uploadFiles(files, pathUtils.replaceRoot(currentPath));
18276
18283
  // 延迟2s刷新数据
18277
18284
  await new Promise(resolve => setTimeout(resolve, 2000));
18278
18285
  await updateFileContents();
@@ -18307,6 +18314,7 @@ const ResourcesView = _ref => {
18307
18314
  const calculateTotalSize = files => Array.from(files).reduce((sum, file) => sum + file.size, 0);
18308
18315
 
18309
18316
  // 上传单个文件
18317
+ // 待改正:需要对folder replaceRoot
18310
18318
  const uploadSingleFile = (file, folder, previousLoadedMap, onProgress) => {
18311
18319
  const formData = new FormData();
18312
18320
  formData.append('file', file);