seeder-resources-view 1.3.7 → 1.3.9

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
@@ -17709,7 +17709,7 @@ const TreeTitleNode = _ref2 => {
17709
17709
  add: newTitle => handleAdd(nodeData, newTitle),
17710
17710
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
17711
17711
  className: "px-1",
17712
- title: "create",
17712
+ title: "Create Folder",
17713
17713
  children: /*#__PURE__*/jsxRuntime.jsx("i", {
17714
17714
  className: "iconfont icon-jia"
17715
17715
  })
@@ -17718,7 +17718,7 @@ const TreeTitleNode = _ref2 => {
17718
17718
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
17719
17719
  className: "px-1",
17720
17720
  onClick: toggleEdit,
17721
- title: "edit",
17721
+ title: "Edit",
17722
17722
  children: /*#__PURE__*/jsxRuntime.jsx("i", {
17723
17723
  className: "iconfont icon-bianji"
17724
17724
  })
@@ -17729,7 +17729,7 @@ const TreeTitleNode = _ref2 => {
17729
17729
  cancelText: "No",
17730
17730
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
17731
17731
  className: "px-1",
17732
- title: "delete",
17732
+ title: "Delete",
17733
17733
  children: /*#__PURE__*/jsxRuntime.jsx("i", {
17734
17734
  className: "iconfont icon-jian"
17735
17735
  })
@@ -18171,6 +18171,36 @@ const useDirectoryTree = _ref => {
18171
18171
  });
18172
18172
  }, []);
18173
18173
 
18174
+ // 刷新树数据
18175
+ const refreshTreeData = react.useCallback(async () => {
18176
+ try {
18177
+ const treeNodes = await fetchFolderData();
18178
+
18179
+ // 查找当前选中节点是否还在新数据中
18180
+ const currentKey = treeState.selectedKeys[0];
18181
+ let shouldUpdateContents = false;
18182
+ if (currentKey && treeNodes) {
18183
+ const foundNode = nodeUtils.findNode(treeNodes, currentKey);
18184
+ if (foundNode !== null && foundNode !== void 0 && foundNode[0]) {
18185
+ shouldUpdateContents = true;
18186
+ updateTreeState({
18187
+ contents: foundNode[0].contents || []
18188
+ });
18189
+ } else {
18190
+ // 如果当前选中节点不存在了,清除选中状态
18191
+ updateTreeState({
18192
+ selectedKeys: [],
18193
+ currentPath: '',
18194
+ contents: []
18195
+ });
18196
+ }
18197
+ }
18198
+ } catch (error) {
18199
+ handleError(error, 'REFRESH TREE DATA');
18200
+ return null;
18201
+ }
18202
+ }, [fetchFolderData, treeState.selectedKeys]);
18203
+
18174
18204
  // 上传右侧文件或删除右侧文件 成功后的回调函数
18175
18205
  const updateFileContents = react.useCallback(async () => {
18176
18206
  // 找到当前选中的节点,更新当前节点的 contents
@@ -18235,7 +18265,10 @@ const useDirectoryTree = _ref => {
18235
18265
  loading: treeState.loading,
18236
18266
  originTreeData,
18237
18267
  updateFileContents,
18238
- removeFile
18268
+ removeFile,
18269
+ refreshTreeData,
18270
+ // 暴露刷新方法
18271
+ fetchFolderData: refreshTreeData // 也可以保留别名
18239
18272
  };
18240
18273
  };
18241
18274
 
@@ -18283,7 +18316,8 @@ const ResourcesView = _ref => {
18283
18316
  withRootNode = true,
18284
18317
  acceptFileTypes = "video/*,.mxf,application/mxf,video/mxf",
18285
18318
  uploadTimeout = 60 * 60 * 1000,
18286
- searchPlaceholder = "Search ..."
18319
+ searchPlaceholder = "Search ...",
18320
+ refreshSignal = 0 // 外部刷新信号,数值变化时触发刷新
18287
18321
  } = _ref;
18288
18322
  const {
18289
18323
  message,
@@ -18310,7 +18344,8 @@ const ResourcesView = _ref => {
18310
18344
  loading,
18311
18345
  originTreeData,
18312
18346
  updateFileContents,
18313
- removeFile
18347
+ removeFile,
18348
+ refreshTreeData
18314
18349
  } = useDirectoryTree({
18315
18350
  getFolderData: mergedApiConfig.getFolderData,
18316
18351
  createFolder: mergedApiConfig.createFolder,
@@ -18319,6 +18354,13 @@ const ResourcesView = _ref => {
18319
18354
  batchOperations: mergedFeatures.batchOperations,
18320
18355
  withRootNode
18321
18356
  });
18357
+
18358
+ // 监听外部刷新信号变化
18359
+ react.useEffect(() => {
18360
+ if (refreshTreeData && refreshSignal > 0) {
18361
+ refreshTreeData();
18362
+ }
18363
+ }, [refreshSignal, refreshTreeData]);
18322
18364
  const [showProgress, setShowProgress] = react.useState(false);
18323
18365
  const [percent, setPercent] = react.useState(0);
18324
18366
  const inputRef = react.useRef(null);
@@ -18611,12 +18653,12 @@ const ResourcesView = _ref => {
18611
18653
  type: "primary",
18612
18654
  disabled: !selectedItems.length,
18613
18655
  onClick: () => setModalVisible(true),
18614
- children: "Batch Copy"
18656
+ children: "Copy"
18615
18657
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
18616
18658
  className: "btn-gray",
18617
18659
  disabled: !selectedItems.length,
18618
18660
  onClick: handleBatchRemove,
18619
- children: "Batch Delete"
18661
+ children: "Delete"
18620
18662
  })]
18621
18663
  })
18622
18664
  }), /*#__PURE__*/jsxRuntime.jsx(MediaGrid$1, {