@myun/gimi-chat 0.0.7 → 0.0.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.
Files changed (89) hide show
  1. package/dist/apis/useApi.d.ts +2 -0
  2. package/dist/apis/useApi.js +50 -2
  3. package/dist/components/ai-chat-dialogue/index.js +135 -181
  4. package/dist/components/ai-correction/index.js +25 -38
  5. package/dist/components/ai-loading/index.js +8 -12
  6. package/dist/components/answer-item/index.d.ts +3 -0
  7. package/dist/components/answer-item/index.js +126 -135
  8. package/dist/components/ask-card/index.js +33 -42
  9. package/dist/components/chat-input/extension/index.d.ts +2 -0
  10. package/dist/components/chat-input/extension/index.js +2 -0
  11. package/dist/components/chat-input/extension/keydown/index.d.ts +3 -0
  12. package/dist/components/chat-input/extension/keydown/index.js +37 -0
  13. package/dist/components/chat-input/extension/title-slot/Component.d.ts +4 -0
  14. package/dist/components/chat-input/extension/title-slot/Component.js +18 -0
  15. package/dist/components/chat-input/extension/title-slot/index.d.ts +3 -0
  16. package/dist/components/chat-input/extension/title-slot/index.js +47 -0
  17. package/dist/components/chat-input/extension/title-slot/index.less +22 -0
  18. package/dist/components/chat-input/index.d.ts +4 -0
  19. package/dist/components/chat-input/index.js +144 -145
  20. package/dist/components/chat-input/index.module.css +7 -0
  21. package/dist/components/chat-voice/VoiceCommunication.js +21 -23
  22. package/dist/components/chat-voice/VoiceRecord.js +21 -24
  23. package/dist/components/conversation-delete/index.js +8 -10
  24. package/dist/components/dots-loading/index.js +7 -10
  25. package/dist/components/empty/index.js +7 -12
  26. package/dist/components/excel-components/ExcelCard.js +3 -7
  27. package/dist/components/excel-components/ExcelExcuting.js +43 -60
  28. package/dist/components/excel-components/ExcelFailCard.js +10 -15
  29. package/dist/components/excel-components/ExcelSuccessCard.d.ts +5 -1
  30. package/dist/components/excel-components/ExcelSuccessCard.js +13 -6
  31. package/dist/components/file-card/fileCardSidebar.js +17 -23
  32. package/dist/components/file-card/index.d.ts +3 -0
  33. package/dist/components/file-card/index.js +59 -69
  34. package/dist/components/file-card/index.module.css +1 -1
  35. package/dist/components/file-preview/index.js +62 -37
  36. package/dist/components/file-preview/index.module.css +33 -0
  37. package/dist/components/file-upload/index.js +7 -10
  38. package/dist/components/file-upload/uploadV1.js +27 -33
  39. package/dist/components/gimi-sidebar/index.js +13 -20
  40. package/dist/components/header/index.js +11 -18
  41. package/dist/components/iconfont-com/index.js +33 -12
  42. package/dist/components/index.d.ts +1 -1
  43. package/dist/components/index.js +1 -1
  44. package/dist/components/knowledge-trace/KnowledgeIconComponent.js +22 -28
  45. package/dist/components/knowledge-trace/classList.js +28 -37
  46. package/dist/components/knowledge-trace/documentList.js +27 -36
  47. package/dist/components/knowledge-trace/index.js +21 -28
  48. package/dist/components/knowledge-trace/videoList.js +36 -46
  49. package/dist/components/lottie-img/index.js +8 -10
  50. package/dist/components/message-actions/CopyButton.d.ts +1 -1
  51. package/dist/components/message-actions/CopyButton.js +22 -25
  52. package/dist/components/message-actions/LikeButton.js +22 -25
  53. package/dist/components/message-actions/RegenerateButton.js +18 -21
  54. package/dist/components/message-actions/UnLikeButton.js +22 -25
  55. package/dist/components/message-actions/VoicePlay.js +22 -25
  56. package/dist/components/message-list/index.js +83 -87
  57. package/dist/components/no-microphone-root/index.js +29 -39
  58. package/dist/components/preset-agent-content/index.d.ts +1 -0
  59. package/dist/components/preset-agent-content/index.js +27 -20
  60. package/dist/components/quoted-content/index.d.ts +3 -0
  61. package/dist/components/quoted-content/index.js +271 -163
  62. package/dist/components/quoted-content/index.module.css +20 -0
  63. package/dist/components/reasoning-content/index.d.ts +3 -2
  64. package/dist/components/reasoning-content/index.js +50 -61
  65. package/dist/components/reference-content/index.js +62 -71
  66. package/dist/components/reference-content/index.module.css +1 -0
  67. package/dist/components/search-result/index.d.ts +7 -0
  68. package/dist/components/search-result/index.js +182 -0
  69. package/dist/components/search-result/index.module.css +235 -0
  70. package/dist/components/templates/CommonChat.js +75 -79
  71. package/dist/components/templates/GimiChatComponent.js +6 -13
  72. package/dist/components/templates/demo/demo.js +109 -103
  73. package/dist/components/upload-list/index.js +41 -56
  74. package/dist/components/voice-bars/index.js +19 -22
  75. package/dist/components/voice-check-dialog/index.js +17 -24
  76. package/dist/components/voice-recording/index.js +42 -57
  77. package/dist/components/work-flow-content/demo.js +1 -2
  78. package/dist/components/work-flow-content/index.js +8 -11
  79. package/dist/hooks/useChatActions.d.ts +1 -1
  80. package/dist/hooks/useChatActions.js +3 -1
  81. package/dist/hooks/useCommonChatAPI.d.ts +2 -1
  82. package/dist/hooks/useCommonChatAPI.js +10 -8
  83. package/dist/hooks/useQuoted.d.ts +12 -0
  84. package/dist/hooks/useQuoted.js +202 -0
  85. package/dist/utils/aes.d.ts +21 -0
  86. package/dist/utils/aes.js +61 -0
  87. package/dist/utils/chatInputUtil.d.ts +1 -1
  88. package/dist/utils/chatInputUtil.js +4 -3
  89. package/package.json +6 -2
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
  import ExcelFailCard from "./ExcelFailCard";
3
3
  import { ExcelExcutingSteps } from "./ExcelExcuting";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- import { Fragment as _Fragment } from "react/jsx-runtime";
6
4
  var ExcelCard = function ExcelCard(_ref) {
7
5
  var item = _ref.item,
8
6
  moduleInfo = _ref.moduleInfo,
@@ -17,14 +15,14 @@ var ExcelCard = function ExcelCard(_ref) {
17
15
  return null;
18
16
  case 2:
19
17
  // 失败
20
- return /*#__PURE__*/_jsx(ExcelFailCard, {
18
+ return /*#__PURE__*/React.createElement(ExcelFailCard, {
21
19
  skillDetail: skillDetail,
22
20
  item: item,
23
21
  onRetry: onRetry
24
22
  });
25
23
  default:
26
24
  // 执行中
27
- return /*#__PURE__*/_jsx(ExcelExcutingSteps, {
25
+ return /*#__PURE__*/React.createElement(ExcelExcutingSteps, {
28
26
  item: item,
29
27
  skillDetail: skillDetail,
30
28
  onSucess: onSucess,
@@ -32,8 +30,6 @@ var ExcelCard = function ExcelCard(_ref) {
32
30
  });
33
31
  }
34
32
  }, [moduleInfo, item, onRetry, onFailure, onSucess]);
35
- return /*#__PURE__*/_jsx(_Fragment, {
36
- children: renderContent
37
- });
33
+ return /*#__PURE__*/React.createElement(React.Fragment, null, renderContent);
38
34
  };
39
35
  export default ExcelCard;
@@ -21,8 +21,6 @@ import LoadingIcon from "../../assets/image/Subtract.png";
21
21
  import classNames from "classnames";
22
22
  import { useExcelExcuteLongPoll } from "../../hooks/useLongPoll";
23
23
  import LoadingDots from "../../components/dots-loading";
24
- import { jsx as _jsx } from "react/jsx-runtime";
25
- import { jsxs as _jsxs } from "react/jsx-runtime";
26
24
  var MOCK_STEPS = [{
27
25
  id: 1,
28
26
  text: "启动核心分析模块"
@@ -219,62 +217,47 @@ export var ExcelExcutingSteps = function ExcelExcutingSteps(_ref) {
219
217
  setContentClass(styles.expanded);
220
218
  }
221
219
  }, [isExpanded]);
222
- return /*#__PURE__*/_jsx("div", {
223
- className: styles.container,
224
- children: /*#__PURE__*/_jsx("div", {
225
- className: styles.aiLoadingSteps,
226
- children: isExpanded ? /*#__PURE__*/_jsxs("div", {
227
- className: classNames(styles.contentWrapper, contentClass),
228
- children: [/*#__PURE__*/_jsxs("div", {
229
- className: styles.header,
230
- children: [!onReady && /*#__PURE__*/_jsxs("h3", {
231
- className: styles.title,
232
- children: [/*#__PURE__*/_jsx(LoadingDots, {}), '正在分析与生成模版...']
233
- }), /*#__PURE__*/_jsx("p", {
234
- className: styles.description,
235
- children: '正在启动任务处理流程, 结合上下文信息, 系统已进入深度分析阶段, 请稍候5~10分钟。'
236
- })]
237
- }), /*#__PURE__*/_jsx("div", {
238
- className: styles.stepsContainer,
239
- children: renderSteps.map(function (step) {
240
- return /*#__PURE__*/_jsxs("div", {
241
- className: classNames(step.isCompleted ? "".concat(styles.stepItem, " ").concat(styles.completed) : "".concat(styles.stepActiveItem, " ").concat(styles.active)),
242
- children: [/*#__PURE__*/_jsxs("div", {
243
- className: styles.stepIndicator,
244
- children: [step.isCompleted ? /*#__PURE__*/_jsx(IconTickCircle, {
245
- className: styles.checkIcon
246
- }) : /*#__PURE__*/_jsx("img", {
247
- src: LoadingIcon,
248
- className: styles.pendingIcon
249
- }), step.id !== 6 && /*#__PURE__*/_jsx("div", {
250
- className: styles.verticalLine
251
- })]
252
- }), /*#__PURE__*/_jsx("div", {
253
- className: styles.stepContent,
254
- children: !step.isCompleted ? /*#__PURE__*/_jsxs("span", {
255
- className: styles.stepText,
256
- children: [displayText, isTyping && /*#__PURE__*/_jsx("span", {
257
- className: styles.cursor,
258
- children: "|"
259
- })]
260
- }) : /*#__PURE__*/_jsx("span", {
261
- className: styles.stepText,
262
- children: step.text
263
- })
264
- })]
265
- }, step.id);
266
- })
267
- }), onReady && /*#__PURE__*/_jsx("span", {
268
- className: styles.finishText,
269
- children: "\u5206\u6790\u5B8C\u6210\uFF0C\u7ED3\u679C\u8F7D\u4F53\u5373\u5C06\u751F\u6210\uFF0C\u6B63\u51C6\u5907\u5448\u73B0..."
270
- })]
271
- }) : /*#__PURE__*/_jsx("div", {
272
- className: classNames(styles.contentWrapper),
273
- children: /*#__PURE__*/_jsx("h3", {
274
- className: styles.title,
275
- children: "\u5206\u6790\u5B8C\u6210\uFF0C\u7ED3\u679C\u8F7D\u4F53\u5373\u5C06\u751F\u6210\uFF0C\u6B63\u5728\u51C6\u5907\u5448\u73B0"
276
- })
277
- })
278
- })
279
- });
220
+ return /*#__PURE__*/React.createElement("div", {
221
+ className: styles.container
222
+ }, /*#__PURE__*/React.createElement("div", {
223
+ className: styles.aiLoadingSteps
224
+ }, isExpanded ? /*#__PURE__*/React.createElement("div", {
225
+ className: classNames(styles.contentWrapper, contentClass)
226
+ }, /*#__PURE__*/React.createElement("div", {
227
+ className: styles.header
228
+ }, !onReady && /*#__PURE__*/React.createElement("h3", {
229
+ className: styles.title
230
+ }, /*#__PURE__*/React.createElement(LoadingDots, null), '正在分析与生成模版...'), /*#__PURE__*/React.createElement("p", {
231
+ className: styles.description
232
+ }, '正在启动任务处理流程, 结合上下文信息, 系统已进入深度分析阶段, 请稍候5~10分钟。')), /*#__PURE__*/React.createElement("div", {
233
+ className: styles.stepsContainer
234
+ }, renderSteps.map(function (step) {
235
+ return /*#__PURE__*/React.createElement("div", {
236
+ key: step.id,
237
+ className: classNames(step.isCompleted ? "".concat(styles.stepItem, " ").concat(styles.completed) : "".concat(styles.stepActiveItem, " ").concat(styles.active))
238
+ }, /*#__PURE__*/React.createElement("div", {
239
+ className: styles.stepIndicator
240
+ }, step.isCompleted ? /*#__PURE__*/React.createElement(IconTickCircle, {
241
+ className: styles.checkIcon
242
+ }) : /*#__PURE__*/React.createElement("img", {
243
+ src: LoadingIcon,
244
+ className: styles.pendingIcon
245
+ }), step.id !== 6 && /*#__PURE__*/React.createElement("div", {
246
+ className: styles.verticalLine
247
+ })), /*#__PURE__*/React.createElement("div", {
248
+ className: styles.stepContent
249
+ }, !step.isCompleted ? /*#__PURE__*/React.createElement("span", {
250
+ className: styles.stepText
251
+ }, displayText, isTyping && /*#__PURE__*/React.createElement("span", {
252
+ className: styles.cursor
253
+ }, "|")) : /*#__PURE__*/React.createElement("span", {
254
+ className: styles.stepText
255
+ }, step.text)));
256
+ })), onReady && /*#__PURE__*/React.createElement("span", {
257
+ className: styles.finishText
258
+ }, "\u5206\u6790\u5B8C\u6210\uFF0C\u7ED3\u679C\u8F7D\u4F53\u5373\u5C06\u751F\u6210\uFF0C\u6B63\u51C6\u5907\u5448\u73B0...")) : /*#__PURE__*/React.createElement("div", {
259
+ className: classNames(styles.contentWrapper)
260
+ }, /*#__PURE__*/React.createElement("h3", {
261
+ className: styles.title
262
+ }, "\u5206\u6790\u5B8C\u6210\uFF0C\u7ED3\u679C\u8F7D\u4F53\u5373\u5C06\u751F\u6210\uFF0C\u6B63\u5728\u51C6\u5907\u5448\u73B0"))));
280
263
  };
@@ -1,25 +1,20 @@
1
1
  import React from 'react';
2
2
  import styles from "./index.module.css";
3
3
  import classNames from 'classnames';
4
- import { jsxs as _jsxs } from "react/jsx-runtime";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
4
  var ExcelFailCard = function ExcelFailCard(_ref) {
7
5
  var item = _ref.item,
8
6
  skillDetail = _ref.skillDetail,
9
7
  onRetry = _ref.onRetry;
10
8
  var message = skillDetail.message;
11
- return /*#__PURE__*/_jsxs("div", {
12
- className: styles.excelFail,
13
- children: [/*#__PURE__*/_jsxs("div", {
14
- className: styles.failText,
15
- children: [" ", message]
16
- }), /*#__PURE__*/_jsx("div", {
17
- className: classNames(styles.Retry, item !== null && item !== void 0 && item.reTryed ? styles.disablebox : ''),
18
- onClick: function onClick() {
19
- return onRetry(skillDetail, item === null || item === void 0 ? void 0 : item.id);
20
- },
21
- children: "\u91CD\u8BD5"
22
- })]
23
- });
9
+ return /*#__PURE__*/React.createElement("div", {
10
+ className: styles.excelFail
11
+ }, /*#__PURE__*/React.createElement("div", {
12
+ className: styles.failText
13
+ }, " ", message), /*#__PURE__*/React.createElement("div", {
14
+ className: classNames(styles.Retry, item !== null && item !== void 0 && item.reTryed ? styles.disablebox : ''),
15
+ onClick: function onClick() {
16
+ return onRetry(skillDetail, item === null || item === void 0 ? void 0 : item.id);
17
+ }
18
+ }, "\u91CD\u8BD5"));
24
19
  };
25
20
  export default ExcelFailCard;
@@ -1,5 +1,9 @@
1
1
  import React from "react";
2
2
  declare const ExcelSuccessCard: ({ value }: {
3
- value: any;
3
+ value: {
4
+ content: any;
5
+ onDownloadCallback?: () => void;
6
+ model: 'fullscreen' | 'sidebar';
7
+ };
4
8
  }) => React.JSX.Element | null;
5
9
  export default ExcelSuccessCard;
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import { FileCard, MultipleFileCard } from "../file-card";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
3
  var transforata = function transforata(data) {
5
4
  var fileName = data.file_name || '文件下载.xlsx';
6
5
  var size = data.size || '0.0KB';
@@ -16,9 +15,13 @@ var transforata = function transforata(data) {
16
15
  };
17
16
  var ExcelSuccessCard = function ExcelSuccessCard(_ref) {
18
17
  var value = _ref.value;
18
+ var _ref2 = value || {},
19
+ content = _ref2.content,
20
+ onDownloadCallback = _ref2.onDownloadCallback,
21
+ model = _ref2.model;
19
22
  var skillDetail = [];
20
23
  try {
21
- skillDetail = typeof value === 'string' ? JSON.parse(value) : value;
24
+ skillDetail = typeof content === 'string' ? JSON.parse(content) : content;
22
25
  } catch (error) {
23
26
  // console.error(error);
24
27
  return null;
@@ -29,8 +32,10 @@ var ExcelSuccessCard = function ExcelSuccessCard(_ref) {
29
32
  var renderData = skillDetail.map(function (item) {
30
33
  return transforata(item);
31
34
  });
32
- return /*#__PURE__*/_jsx(MultipleFileCard, {
33
- list: renderData
35
+ return /*#__PURE__*/React.createElement(MultipleFileCard, {
36
+ list: renderData,
37
+ onDownloadCallback: onDownloadCallback,
38
+ model: model
34
39
  });
35
40
  }
36
41
 
@@ -40,12 +45,14 @@ var ExcelSuccessCard = function ExcelSuccessCard(_ref) {
40
45
  downloadUrl = _transforata.downloadUrl,
41
46
  size = _transforata.size,
42
47
  fileType = _transforata.fileType;
43
- return /*#__PURE__*/_jsx(FileCard, {
48
+ return /*#__PURE__*/React.createElement(FileCard, {
44
49
  fileName: fileName,
45
50
  fileType: fileType,
46
51
  size: size,
47
52
  downloadUrl: downloadUrl,
48
- downloadText: "\u4E0B\u8F7D"
53
+ downloadText: "\u4E0B\u8F7D",
54
+ onDownloadCallback: onDownloadCallback,
55
+ model: model
49
56
  });
50
57
  };
51
58
  export default ExcelSuccessCard;
@@ -6,9 +6,6 @@ import { useCallback } from "react";
6
6
  import ReactDOM from 'react-dom';
7
7
  import styles from "./index.module.css";
8
8
  import { FileCard } from ".";
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- import { jsxs as _jsxs } from "react/jsx-runtime";
11
- import { Fragment as _Fragment } from "react/jsx-runtime";
12
9
  var FileCardSideBar = function FileCardSideBar(props) {
13
10
  var targetElement = props.targetElement,
14
11
  isOverFlow = props.isOverFlow,
@@ -28,36 +25,33 @@ var FileCardSideBar = function FileCardSideBar(props) {
28
25
  dispatch(setSidebarFileList([]));
29
26
  }, [dispatch]);
30
27
  var renderContent = function renderContent() {
31
- return /*#__PURE__*/_jsx(GimiSideBar, {
28
+ return /*#__PURE__*/React.createElement(GimiSideBar, {
32
29
  show: showSidebar,
33
30
  isOverFlow: isOverFlow,
34
31
  title: "\u5168\u90E8",
35
32
  handleClose: handleClose,
36
33
  className: className,
37
- style: style,
38
- children: /*#__PURE__*/_jsxs("div", {
39
- className: styles.list,
40
- children: [/*#__PURE__*/_jsx("span", {
41
- className: styles.total,
42
- children: "\u672C\u5BF9\u8BDD\u5171".concat((fileList === null || fileList === void 0 ? void 0 : fileList.length) || 0, "\u4E2A\u6587\u6863")
43
- }), fileList.map(function (file, index) {
44
- return /*#__PURE__*/_jsx(FileCard, {
45
- fileName: file.fileName,
46
- fileType: file.fileType,
47
- size: file.size,
48
- downloadUrl: file.downloadUrl
49
- }, index);
50
- })]
51
- })
52
- });
34
+ style: style
35
+ }, /*#__PURE__*/React.createElement("div", {
36
+ className: styles.list
37
+ }, /*#__PURE__*/React.createElement("span", {
38
+ className: styles.total
39
+ }, "\u672C\u5BF9\u8BDD\u5171".concat((fileList === null || fileList === void 0 ? void 0 : fileList.length) || 0, "\u4E2A\u6587\u6863")), fileList.map(function (file, index) {
40
+ return /*#__PURE__*/React.createElement(FileCard, {
41
+ fileName: file.fileName,
42
+ fileType: file.fileType,
43
+ size: file.size,
44
+ downloadUrl: file.downloadUrl,
45
+ key: index,
46
+ model: isOverFlow ? 'sidebar' : 'fullscreen'
47
+ });
48
+ })));
53
49
  };
54
50
  if (isOverFlow) {
55
51
  var targetElm = targetElement || document.getElementById('myun_gimi_design_chat');
56
52
  if (!targetElm) return null;
57
53
  return /*#__PURE__*/ReactDOM.createPortal(renderContent(), targetElm);
58
54
  }
59
- return /*#__PURE__*/_jsx(_Fragment, {
60
- children: renderContent()
61
- });
55
+ return /*#__PURE__*/React.createElement(React.Fragment, null, renderContent());
62
56
  };
63
57
  export default FileCardSideBar;
@@ -8,8 +8,11 @@ export interface IFileCardProps {
8
8
  }
9
9
  export declare const FileCard: React.FC<IFileCardProps & {
10
10
  downloadText?: string;
11
+ model: 'fullscreen' | 'sidebar';
11
12
  }>;
12
13
  export declare const MultipleFileCard: React.FC<{
13
14
  list: IFileCardProps[];
15
+ onDownloadCallback?: () => void;
16
+ model: 'fullscreen' | 'sidebar';
14
17
  }>;
15
18
  export default MultipleFileCard;
@@ -6,16 +6,14 @@ import { useAppDispatch } from "../../store/hooks";
6
6
  import { setFilePreviewState, setShowSidebarFileList, setSidebarFileList } from "../../store/slices/gimiMenuSlice";
7
7
  import classNames from 'classnames';
8
8
  import { IconChevronRightStroked } from '@douyinfe/semi-icons';
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- import { jsxs as _jsxs } from "react/jsx-runtime";
11
- import { Fragment as _Fragment } from "react/jsx-runtime";
12
9
  export var FileCard = function FileCard(_ref) {
13
10
  var fileName = _ref.fileName,
14
11
  downloadUrl = _ref.downloadUrl,
15
12
  size = _ref.size,
16
13
  fileType = _ref.fileType,
17
14
  downloadText = _ref.downloadText,
18
- onDownloadCallback = _ref.onDownloadCallback;
15
+ onDownloadCallback = _ref.onDownloadCallback,
16
+ model = _ref.model;
19
17
  var dispatch = useAppDispatch();
20
18
  var handleDownLoad = function handleDownLoad(_event) {
21
19
  _event.stopPropagation();
@@ -23,6 +21,10 @@ export var FileCard = function FileCard(_ref) {
23
21
  onDownloadCallback === null || onDownloadCallback === void 0 || onDownloadCallback();
24
22
  };
25
23
  var previewExcel = function previewExcel() {
24
+ if (model === 'sidebar') {
25
+ window.open("https://view.officeapps.live.com/op/embed.aspx?src=".concat(encodeURIComponent(downloadUrl)), '_blank');
26
+ return;
27
+ }
26
28
  dispatch(setFilePreviewState({
27
29
  filePreviewState: {
28
30
  show: true,
@@ -31,55 +33,44 @@ export var FileCard = function FileCard(_ref) {
31
33
  }
32
34
  }));
33
35
  };
34
- return /*#__PURE__*/_jsx(_Fragment, {
35
- children: /*#__PURE__*/_jsxs("div", {
36
- className: classNames(styles.file_main, styles.card),
37
- onClick: previewExcel,
38
- children: [/*#__PURE__*/_jsx("div", {
39
- className: styles.icon,
40
- children: /*#__PURE__*/_jsx("img", {
41
- src: "https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202512/19/b8723_20251219094824.png",
42
- alt: ""
43
- })
44
- }), /*#__PURE__*/_jsx("div", {
45
- className: styles.left,
46
- children: /*#__PURE__*/_jsx("div", {
47
- className: styles.iconName,
48
- children: /*#__PURE__*/_jsxs("div", {
49
- className: styles.nameSize,
50
- children: [/*#__PURE__*/_jsx(Tooltip, {
51
- content: decodeURIComponent(fileName),
52
- position: "topLeft",
53
- children: /*#__PURE__*/_jsx("div", {
54
- className: styles.name,
55
- children: decodeURIComponent(fileName)
56
- })
57
- }), /*#__PURE__*/_jsx("div", {
58
- className: styles.type,
59
- children: "".concat(fileType, " | ").concat(size)
60
- })]
61
- })
62
- })
63
- }), /*#__PURE__*/_jsxs("div", {
64
- className: styles.right,
65
- onClick: handleDownLoad,
66
- children: [downloadText && /*#__PURE__*/_jsx("span", {
67
- className: styles.text,
68
- children: downloadText
69
- }), /*#__PURE__*/_jsx(Tooltip, {
70
- content: '下载',
71
- children: /*#__PURE__*/_jsx("img", {
72
- src: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202509/15/c61c4_20250915193545.png",
73
- width: 20,
74
- alt: ""
75
- })
76
- })]
77
- })]
78
- })
79
- });
36
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
37
+ className: classNames(styles.file_main, styles.card),
38
+ onClick: previewExcel
39
+ }, /*#__PURE__*/React.createElement("div", {
40
+ className: styles.icon
41
+ }, /*#__PURE__*/React.createElement("img", {
42
+ src: "https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202512/19/b8723_20251219094824.png",
43
+ alt: ""
44
+ })), /*#__PURE__*/React.createElement("div", {
45
+ className: styles.left
46
+ }, /*#__PURE__*/React.createElement("div", {
47
+ className: styles.iconName
48
+ }, /*#__PURE__*/React.createElement("div", {
49
+ className: styles.nameSize
50
+ }, /*#__PURE__*/React.createElement(Tooltip, {
51
+ content: decodeURIComponent(fileName),
52
+ position: "topLeft"
53
+ }, /*#__PURE__*/React.createElement("div", {
54
+ className: styles.name
55
+ }, decodeURIComponent(fileName))), /*#__PURE__*/React.createElement("div", {
56
+ className: styles.type
57
+ }, "".concat(fileType, " | ").concat(size))))), /*#__PURE__*/React.createElement("div", {
58
+ className: styles.right,
59
+ onClick: handleDownLoad
60
+ }, downloadText && /*#__PURE__*/React.createElement("span", {
61
+ className: styles.text
62
+ }, downloadText), /*#__PURE__*/React.createElement(Tooltip, {
63
+ content: '下载'
64
+ }, /*#__PURE__*/React.createElement("img", {
65
+ src: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202509/15/c61c4_20250915193545.png",
66
+ width: 20,
67
+ alt: ""
68
+ })))));
80
69
  };
81
70
  export var MultipleFileCard = function MultipleFileCard(_ref2) {
82
- var list = _ref2.list;
71
+ var list = _ref2.list,
72
+ onDownloadCallback = _ref2.onDownloadCallback,
73
+ model = _ref2.model;
83
74
  var dispatch = useAppDispatch();
84
75
  var renderList = [];
85
76
  var hasMore = (list === null || list === void 0 ? void 0 : list.length) > 2;
@@ -94,23 +85,22 @@ export var MultipleFileCard = function MultipleFileCard(_ref2) {
94
85
  }));
95
86
  dispatch(setSidebarFileList(list));
96
87
  };
97
- return /*#__PURE__*/_jsx(_Fragment, {
98
- children: /*#__PURE__*/_jsxs("div", {
99
- className: styles.main,
100
- children: [renderList.map(function (item, index) {
101
- return /*#__PURE__*/_jsx(FileCard, {
102
- fileName: item.fileName,
103
- fileType: item.fileType,
104
- size: item.size,
105
- downloadUrl: item.downloadUrl,
106
- downloadText: "\u4E0B\u8F7D"
107
- }, index);
108
- }), hasMore && /*#__PURE__*/_jsxs("div", {
109
- className: styles.all,
110
- onClick: openSidebar,
111
- children: ["\u5168\u90E8", /*#__PURE__*/_jsx(IconChevronRightStroked, {})]
112
- })]
113
- })
114
- });
88
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
89
+ className: styles.main
90
+ }, renderList.map(function (item, index) {
91
+ return /*#__PURE__*/React.createElement(FileCard, {
92
+ fileName: item.fileName,
93
+ fileType: item.fileType,
94
+ size: item.size,
95
+ downloadUrl: item.downloadUrl,
96
+ key: index,
97
+ downloadText: "\u4E0B\u8F7D",
98
+ onDownloadCallback: onDownloadCallback,
99
+ model: model
100
+ });
101
+ }), hasMore && /*#__PURE__*/React.createElement("div", {
102
+ className: styles.all,
103
+ onClick: openSidebar
104
+ }, "\u5168\u90E8", /*#__PURE__*/React.createElement(IconChevronRightStroked, null))));
115
105
  };
116
106
  export default MultipleFileCard;
@@ -33,7 +33,7 @@
33
33
  }
34
34
 
35
35
  .file_main {
36
- max-width: 328px;
36
+ width: 328px;
37
37
  flex-shrink: 0;
38
38
  border-radius: 12px;
39
39
  border: 1px solid rgb(233, 235, 242);
@@ -10,9 +10,8 @@ import styles from "./index.module.css";
10
10
  import { Button } from '@douyinfe/semi-ui';
11
11
  import { IconClose } from '@douyinfe/semi-icons';
12
12
  import { useState, useRef, useEffect, useMemo } from 'react';
13
- import EmptyShow from "../../components/empty";
14
- import { jsx as _jsx } from "react/jsx-runtime";
15
- import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ import IconFontCom from "../iconfont-com";
14
+ var emptyTmage = 'https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202601/12/2af32_20260112133158.png';
16
15
  var OfficeFilePreviewPanel = function OfficeFilePreviewPanel() {
17
16
  var _useAppSelector = useAppSelector(function (state) {
18
17
  return state.gimiMenu.filePreviewState;
@@ -37,6 +36,10 @@ var OfficeFilePreviewPanel = function OfficeFilePreviewPanel() {
37
36
  _useState8 = _slicedToArray(_useState7, 2),
38
37
  iframeLoaded = _useState8[0],
39
38
  setIframeLoaded = _useState8[1]; // iframe 是否已加载
39
+ var _useState9 = useState(0),
40
+ _useState10 = _slicedToArray(_useState9, 2),
41
+ iframeKey = _useState10[0],
42
+ setIframeKey = _useState10[1]; // 用于强制重新加载iframe的key
40
43
  var panelRef = useRef(null);
41
44
  var resizerRef = useRef(null);
42
45
  var startXRef = useRef(0);
@@ -191,44 +194,66 @@ var OfficeFilePreviewPanel = function OfficeFilePreviewPanel() {
191
194
  }
192
195
  };
193
196
  }, [isDragging]);
194
- return /*#__PURE__*/_jsxs("div", {
197
+
198
+ // 重试加载iframe
199
+ var retryIframeLoad = function retryIframeLoad() {
200
+ setIframeKey(function (prev) {
201
+ return prev + 1;
202
+ }); // 更新key强制重新渲染iframe
203
+ setIframeError(false); // 重试加载 iframe
204
+ // 重置iframe加载状态
205
+ setIframeLoaded(false);
206
+ iframeLoadedRef.current = false;
207
+ // 清除超时定时器
208
+ if (loadTimeoutRef.current) {
209
+ clearTimeout(loadTimeoutRef.current);
210
+ loadTimeoutRef.current = null;
211
+ }
212
+ };
213
+ return /*#__PURE__*/React.createElement("div", {
195
214
  ref: panelRef,
196
215
  className: show ? styles.main : styles.mainHidden,
197
216
  style: {
198
217
  width: "".concat(width, "px")
218
+ }
219
+ }, /*#__PURE__*/React.createElement("div", {
220
+ className: styles.content
221
+ }, /*#__PURE__*/React.createElement("div", {
222
+ className: styles.header
223
+ }, /*#__PURE__*/React.createElement("span", null, filename || '文档预览'), /*#__PURE__*/React.createElement(Button, {
224
+ size: "small",
225
+ theme: "borderless",
226
+ icon: /*#__PURE__*/React.createElement(IconClose, null),
227
+ onClick: handleClose
228
+ })), /*#__PURE__*/React.createElement("div", {
229
+ className: styles.iframeContainer
230
+ }, url && !iframeError ? /*#__PURE__*/React.createElement("iframe", {
231
+ key: "".concat(url, "-").concat(iframeKey),
232
+ src: iframeSrc,
233
+ width: "100%",
234
+ height: "100%",
235
+ style: {
236
+ border: 0
199
237
  },
200
- children: [/*#__PURE__*/_jsxs("div", {
201
- className: styles.content,
202
- children: [/*#__PURE__*/_jsxs("div", {
203
- className: styles.header,
204
- children: [/*#__PURE__*/_jsx("span", {
205
- children: filename || '文档预览'
206
- }), /*#__PURE__*/_jsx(Button, {
207
- size: "small",
208
- theme: "borderless",
209
- icon: /*#__PURE__*/_jsx(IconClose, {}),
210
- onClick: handleClose
211
- })]
212
- }), /*#__PURE__*/_jsx("div", {
213
- className: styles.iframeContainer,
214
- children: url && !iframeError ? /*#__PURE__*/_jsx("iframe", {
215
- src: iframeSrc,
216
- width: "100%",
217
- height: "100%",
218
- style: {
219
- border: 0
220
- },
221
- onError: handleIframeError,
222
- onLoad: handleIframeLoad
223
- }, url) : /*#__PURE__*/_jsx(EmptyShow, {
224
- title: iframeError ? '文档加载失败' : '暂无内容'
225
- })
226
- })]
227
- }), /*#__PURE__*/_jsx("div", {
228
- ref: resizerRef,
229
- className: styles.resizer,
230
- onMouseDown: handleMouseDown
231
- })]
232
- });
238
+ onError: handleIframeError,
239
+ onLoad: handleIframeLoad
240
+ }) : /*#__PURE__*/React.createElement("div", {
241
+ className: styles.empty
242
+ }, /*#__PURE__*/React.createElement("img", {
243
+ src: emptyTmage,
244
+ alt: "",
245
+ className: styles.emptyImage
246
+ }), iframeError ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", null, "\u62B1\u6B49\uFF0C\u5F53\u524D\u670D\u52A1\u7E41\u5FD9"), /*#__PURE__*/React.createElement("p", null, "\u8BF7\u70B9\u51FB\u91CD\u8BD5\u5237\u65B0\u9884\u89C8\uFF0C\u6216\u76F4\u63A5\u4E0B\u8F7D\u67E5\u770B")) : /*#__PURE__*/React.createElement("p", null, "\u6682\u65E0\u5185\u5BB9"), /*#__PURE__*/React.createElement(Button, {
247
+ onClick: retryIframeLoad,
248
+ className: styles.retryButton
249
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(IconFontCom, {
250
+ className: styles.replayIcon,
251
+ type: "icon-shuaxin1",
252
+ size: 14
253
+ }), "\u91CD\u8BD5"))))), /*#__PURE__*/React.createElement("div", {
254
+ ref: resizerRef,
255
+ className: styles.resizer,
256
+ onMouseDown: handleMouseDown
257
+ }));
233
258
  };
234
259
  export default OfficeFilePreviewPanel;