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