@myun/gimi-chat 0.0.8 → 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.
- package/dist/apis/useApi.d.ts +2 -0
- package/dist/apis/useApi.js +50 -2
- package/dist/components/ai-chat-dialogue/index.js +135 -181
- package/dist/components/ai-correction/index.js +25 -38
- package/dist/components/ai-loading/index.js +8 -12
- package/dist/components/answer-item/index.d.ts +3 -0
- package/dist/components/answer-item/index.js +126 -135
- package/dist/components/ask-card/index.js +33 -42
- package/dist/components/chat-input/extension/index.d.ts +2 -0
- package/dist/components/chat-input/extension/index.js +2 -0
- package/dist/components/chat-input/extension/keydown/index.d.ts +3 -0
- package/dist/components/chat-input/extension/keydown/index.js +37 -0
- package/dist/components/chat-input/extension/title-slot/Component.d.ts +4 -0
- package/dist/components/chat-input/extension/title-slot/Component.js +18 -0
- package/dist/components/chat-input/extension/title-slot/index.d.ts +3 -0
- package/dist/components/chat-input/extension/title-slot/index.js +47 -0
- package/dist/components/chat-input/extension/title-slot/index.less +22 -0
- package/dist/components/chat-input/index.d.ts +4 -0
- package/dist/components/chat-input/index.js +144 -145
- package/dist/components/chat-input/index.module.css +7 -0
- package/dist/components/chat-voice/VoiceCommunication.js +21 -23
- package/dist/components/chat-voice/VoiceRecord.js +21 -24
- package/dist/components/conversation-delete/index.js +8 -10
- package/dist/components/dots-loading/index.js +7 -10
- package/dist/components/empty/index.js +7 -12
- package/dist/components/excel-components/ExcelCard.js +3 -7
- package/dist/components/excel-components/ExcelExcuting.js +43 -60
- package/dist/components/excel-components/ExcelFailCard.js +10 -15
- package/dist/components/excel-components/ExcelSuccessCard.d.ts +5 -1
- package/dist/components/excel-components/ExcelSuccessCard.js +13 -6
- package/dist/components/file-card/fileCardSidebar.js +17 -23
- package/dist/components/file-card/index.d.ts +3 -0
- package/dist/components/file-card/index.js +59 -69
- package/dist/components/file-card/index.module.css +1 -1
- package/dist/components/file-preview/index.js +62 -37
- package/dist/components/file-preview/index.module.css +33 -0
- package/dist/components/file-upload/index.js +7 -10
- package/dist/components/file-upload/uploadV1.js +27 -33
- package/dist/components/gimi-sidebar/index.js +13 -20
- package/dist/components/header/index.js +11 -18
- package/dist/components/iconfont-com/index.js +33 -12
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/knowledge-trace/KnowledgeIconComponent.js +22 -28
- package/dist/components/knowledge-trace/classList.js +28 -37
- package/dist/components/knowledge-trace/documentList.js +27 -36
- package/dist/components/knowledge-trace/index.js +21 -28
- package/dist/components/knowledge-trace/videoList.js +36 -46
- package/dist/components/lottie-img/index.js +8 -10
- package/dist/components/message-actions/CopyButton.d.ts +1 -1
- package/dist/components/message-actions/CopyButton.js +22 -25
- package/dist/components/message-actions/LikeButton.js +22 -25
- package/dist/components/message-actions/RegenerateButton.js +18 -21
- package/dist/components/message-actions/UnLikeButton.js +22 -25
- package/dist/components/message-actions/VoicePlay.js +22 -25
- package/dist/components/message-list/index.js +83 -87
- package/dist/components/no-microphone-root/index.js +29 -39
- package/dist/components/preset-agent-content/index.d.ts +1 -0
- package/dist/components/preset-agent-content/index.js +27 -20
- package/dist/components/quoted-content/index.d.ts +3 -0
- package/dist/components/quoted-content/index.js +271 -163
- package/dist/components/quoted-content/index.module.css +20 -0
- package/dist/components/reasoning-content/index.d.ts +3 -2
- package/dist/components/reasoning-content/index.js +50 -61
- package/dist/components/reference-content/index.js +62 -71
- package/dist/components/reference-content/index.module.css +1 -0
- package/dist/components/search-result/index.d.ts +7 -0
- package/dist/components/search-result/index.js +182 -0
- package/dist/components/search-result/index.module.css +235 -0
- package/dist/components/templates/CommonChat.js +75 -79
- package/dist/components/templates/GimiChatComponent.js +6 -13
- package/dist/components/templates/demo/demo.js +109 -103
- package/dist/components/upload-list/index.js +41 -56
- package/dist/components/voice-bars/index.js +19 -22
- package/dist/components/voice-check-dialog/index.js +17 -24
- package/dist/components/voice-recording/index.js +42 -57
- package/dist/components/work-flow-content/demo.js +1 -2
- package/dist/components/work-flow-content/index.js +8 -11
- package/dist/hooks/useChatActions.d.ts +1 -1
- package/dist/hooks/useChatActions.js +3 -1
- package/dist/hooks/useCommonChatAPI.d.ts +2 -1
- package/dist/hooks/useCommonChatAPI.js +10 -8
- package/dist/hooks/useQuoted.d.ts +12 -0
- package/dist/hooks/useQuoted.js +202 -0
- package/dist/utils/aes.d.ts +21 -0
- package/dist/utils/aes.js +61 -0
- package/dist/utils/chatInputUtil.d.ts +1 -1
- package/dist/utils/chatInputUtil.js +4 -3
- package/package.json +1 -1
|
@@ -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__*/
|
|
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__*/
|
|
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__*/
|
|
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__*/
|
|
223
|
-
className: styles.container
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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__*/
|
|
12
|
-
className: styles.excelFail
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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,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
|
|
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__*/
|
|
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__*/
|
|
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__*/
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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__*/
|
|
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__*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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__*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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;
|
|
@@ -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
|
|
14
|
-
|
|
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
|
-
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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;
|