@ant-design/agentic-ui 2.0.20 → 2.0.22
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/Bubble/FileView.js +27 -30
- package/dist/Bubble/MessagesContent/VoiceButton/style.js +6 -3
- package/dist/ChatBootPage/ButtonTabStyle.js +2 -0
- package/dist/ChatBootPage/CaseReply.d.ts +0 -3
- package/dist/ChatBootPage/CaseReplyStyle.js +3 -4
- package/dist/Components/ActionIconBox/style.js +3 -1
- package/dist/Components/lotties/LoadingLottie/loading.json +1989 -1
- package/dist/Components/lotties/{ShinyText → TextLoading}/index.d.ts +9 -9
- package/dist/Components/lotties/{ShinyText → TextLoading}/index.js +7 -7
- package/dist/Components/lotties/{ShinyText → TextLoading}/style.js +4 -4
- package/dist/Components/lotties/index.d.ts +1 -1
- package/dist/Components/lotties/index.js +1 -1
- package/dist/History/components/HistoryItem.js +14 -6
- package/dist/History/types/HistoryData.d.ts +2 -0
- package/dist/MarkdownEditor/editor/components/ContributorAvatar/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/TableRowIndex/index.js +3 -1
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +7 -4
- package/dist/MarkdownEditor/editor/elements/TagPopup/style.js +5 -1
- package/dist/MarkdownEditor/editor/plugins/withMarkdown.js +42 -0
- package/dist/MarkdownInputField/AttachmentButton/style.js +1 -1
- package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +3 -2
- package/dist/MarkdownInputField/FileMapView/index.d.ts +2 -2
- package/dist/MarkdownInputField/FileMapView/index.js +39 -12
- package/dist/MarkdownInputField/FileMapView/style.js +9 -6
- package/dist/MarkdownInputField/MarkdownInputField.js +158 -181
- package/dist/MarkdownInputField/VoiceInput/style.js +1 -1
- package/dist/MarkdownInputField/style.js +3 -54
- package/dist/Plugins/chart/DonutChart/style.js +1 -0
- package/dist/Plugins/chart/LineChart/index.js +66 -55
- package/dist/Plugins/chart/LineChart/style.js +8 -0
- package/dist/Schema/SchemaRenderer/index.js +1 -1
- package/package.json +1 -1
- /package/dist/Components/lotties/{ShinyText → TextLoading}/style.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface TextLoadingProps {
|
|
3
3
|
/**
|
|
4
4
|
* 要显示的文本内容
|
|
5
5
|
* @default "Loading..."
|
|
@@ -32,22 +32,22 @@ export interface ShinyTextProps {
|
|
|
32
32
|
fontSize?: number | string;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* 文字加载组件
|
|
36
36
|
*
|
|
37
37
|
* 使用CSS动画展示闪光文字效果的加载状态组件,支持自定义文本、样式和动画开关。
|
|
38
38
|
*
|
|
39
39
|
* @component
|
|
40
40
|
* @example
|
|
41
41
|
* // 基础用法
|
|
42
|
-
* <
|
|
42
|
+
* <TextLoading />
|
|
43
43
|
*
|
|
44
44
|
* @example
|
|
45
45
|
* // 自定义文本
|
|
46
|
-
* <
|
|
46
|
+
* <TextLoading text="加载中..." />
|
|
47
47
|
*
|
|
48
48
|
* @example
|
|
49
49
|
* // 自定义样式
|
|
50
|
-
* <
|
|
50
|
+
* <TextLoading
|
|
51
51
|
* text="正在处理"
|
|
52
52
|
* fontSize="20px"
|
|
53
53
|
* style={{ margin: '20px' }}
|
|
@@ -55,7 +55,7 @@ export interface ShinyTextProps {
|
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
57
|
* // 禁用动画
|
|
58
|
-
* <
|
|
58
|
+
* <TextLoading disabled={true} />
|
|
59
59
|
*
|
|
60
60
|
* @param props - 组件属性
|
|
61
61
|
* @param props.text - 要显示的文本内容,默认为 "Loading..."
|
|
@@ -63,7 +63,7 @@ export interface ShinyTextProps {
|
|
|
63
63
|
* @param props.className - 容器类名
|
|
64
64
|
* @param props.style - 容器自定义样式
|
|
65
65
|
* @param props.fontSize - 字体大小
|
|
66
|
-
* @returns
|
|
66
|
+
* @returns 渲染的文字加载组件
|
|
67
67
|
*/
|
|
68
|
-
export declare const
|
|
69
|
-
export default
|
|
68
|
+
export declare const TextLoading: React.FC<TextLoadingProps>;
|
|
69
|
+
export default TextLoading;
|
|
@@ -15,12 +15,12 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
// src/Components/lotties/
|
|
18
|
+
// src/Components/lotties/TextLoading/index.tsx
|
|
19
19
|
import { ConfigProvider } from "antd";
|
|
20
20
|
import cx from "classnames";
|
|
21
21
|
import React, { useContext } from "react";
|
|
22
22
|
import { useStyle } from "./style";
|
|
23
|
-
var
|
|
23
|
+
var TextLoading = ({
|
|
24
24
|
text = "Loading...",
|
|
25
25
|
disabled = false,
|
|
26
26
|
theme = "light",
|
|
@@ -29,7 +29,7 @@ var ShinyText = ({
|
|
|
29
29
|
fontSize
|
|
30
30
|
}) => {
|
|
31
31
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
32
|
-
const prefixCls = getPrefixCls("agentic-
|
|
32
|
+
const prefixCls = getPrefixCls("agentic-text-loading");
|
|
33
33
|
const { wrapSSR, hashId } = useStyle(prefixCls);
|
|
34
34
|
const containerStyle = __spreadValues({
|
|
35
35
|
fontSize
|
|
@@ -44,7 +44,7 @@ var ShinyText = ({
|
|
|
44
44
|
[`${prefixCls}-light`]: theme === "light"
|
|
45
45
|
}),
|
|
46
46
|
style: containerStyle,
|
|
47
|
-
"data-testid": "
|
|
47
|
+
"data-testid": "text-loading",
|
|
48
48
|
"aria-label": text,
|
|
49
49
|
role: "status",
|
|
50
50
|
"aria-live": "polite"
|
|
@@ -53,8 +53,8 @@ var ShinyText = ({
|
|
|
53
53
|
)
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
|
-
var
|
|
56
|
+
var TextLoading_default = TextLoading;
|
|
57
57
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
TextLoading,
|
|
59
|
+
TextLoading_default as default
|
|
60
60
|
};
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
|
|
21
|
-
// src/Components/lotties/
|
|
21
|
+
// src/Components/lotties/TextLoading/style.ts
|
|
22
22
|
import { Keyframes } from "@ant-design/cssinjs";
|
|
23
23
|
import {
|
|
24
24
|
useEditorStyleRegister
|
|
@@ -72,11 +72,11 @@ var genStyle = (token) => {
|
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
74
|
function useStyle(prefixCls) {
|
|
75
|
-
return useEditorStyleRegister("
|
|
76
|
-
const
|
|
75
|
+
return useEditorStyleRegister("TextLoading", (token) => {
|
|
76
|
+
const textLoadingToken = __spreadProps(__spreadValues({}, token), {
|
|
77
77
|
componentCls: `.${prefixCls}`
|
|
78
78
|
});
|
|
79
|
-
return [genStyle(
|
|
79
|
+
return [genStyle(textLoadingToken)];
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './TextLoading';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// src/Components/lotties/index.ts
|
|
2
|
-
export * from "./
|
|
2
|
+
export * from "./TextLoading";
|
|
@@ -109,7 +109,11 @@ var HistoryItemSingle = React.memo(
|
|
|
109
109
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
110
110
|
const prefixCls = getPrefixCls("agentic-chat-history-menu");
|
|
111
111
|
const { hashId } = useStyle(prefixCls);
|
|
112
|
-
const
|
|
112
|
+
const displayText = React.useMemo(
|
|
113
|
+
() => item.displayTitle || item.sessionTitle,
|
|
114
|
+
[item.displayTitle, item.sessionTitle]
|
|
115
|
+
);
|
|
116
|
+
const { textRef, isTextOverflow } = useTextOverflow(displayText);
|
|
113
117
|
const isRunning = React.useMemo(
|
|
114
118
|
() => runningId == null ? void 0 : runningId.includes(String(item.id || "")),
|
|
115
119
|
[runningId, item.id]
|
|
@@ -205,7 +209,7 @@ var HistoryItemSingle = React.memo(
|
|
|
205
209
|
/* @__PURE__ */ React.createElement(
|
|
206
210
|
Tooltip,
|
|
207
211
|
{
|
|
208
|
-
title: isTextOverflow ?
|
|
212
|
+
title: isTextOverflow ? displayText : null,
|
|
209
213
|
mouseEnterDelay: 0.3,
|
|
210
214
|
open: isTextOverflow ? void 0 : false
|
|
211
215
|
},
|
|
@@ -219,7 +223,7 @@ var HistoryItemSingle = React.memo(
|
|
|
219
223
|
color: "var(--color-gray-text-default)"
|
|
220
224
|
}
|
|
221
225
|
},
|
|
222
|
-
|
|
226
|
+
displayText
|
|
223
227
|
)
|
|
224
228
|
)
|
|
225
229
|
)
|
|
@@ -270,7 +274,11 @@ var HistoryItemMulti = React.memo(
|
|
|
270
274
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
271
275
|
const prefixCls = getPrefixCls("agentic-chat-history-menu");
|
|
272
276
|
const { hashId } = useStyle(prefixCls);
|
|
273
|
-
const
|
|
277
|
+
const displayText = React.useMemo(
|
|
278
|
+
() => item.displayTitle || item.sessionTitle,
|
|
279
|
+
[item.displayTitle, item.sessionTitle]
|
|
280
|
+
);
|
|
281
|
+
const { textRef, isTextOverflow } = useTextOverflow(displayText);
|
|
274
282
|
const isTask = React.useMemo(() => type === "task", [type]);
|
|
275
283
|
const { locale } = React.useContext(I18nContext);
|
|
276
284
|
const shouldShowIcon = React.useMemo(
|
|
@@ -386,7 +394,7 @@ var HistoryItemMulti = React.memo(
|
|
|
386
394
|
/* @__PURE__ */ React.createElement(
|
|
387
395
|
Tooltip,
|
|
388
396
|
{
|
|
389
|
-
title: isTextOverflow ?
|
|
397
|
+
title: isTextOverflow ? displayText : null,
|
|
390
398
|
mouseEnterDelay: 0.3,
|
|
391
399
|
open: isTextOverflow ? void 0 : false
|
|
392
400
|
},
|
|
@@ -399,7 +407,7 @@ var HistoryItemMulti = React.memo(
|
|
|
399
407
|
color: "var(--color-gray-text-default)"
|
|
400
408
|
}
|
|
401
409
|
},
|
|
402
|
-
|
|
410
|
+
displayText
|
|
403
411
|
)
|
|
404
412
|
)
|
|
405
413
|
),
|
|
@@ -45,7 +45,7 @@ var ContributorAvatar = (props) => {
|
|
|
45
45
|
};
|
|
46
46
|
var AvatarList = ({ displayList, style }) => {
|
|
47
47
|
const context = React.useContext(ConfigProvider.ConfigContext);
|
|
48
|
-
const baseCls = context == null ? void 0 : context.getPrefixCls("agentic-
|
|
48
|
+
const baseCls = context == null ? void 0 : context.getPrefixCls("agentic-contributor-avatar-list");
|
|
49
49
|
const { wrapSSR, hashId } = useStyle(baseCls);
|
|
50
50
|
return wrapSSR(
|
|
51
51
|
/* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
@@ -11,7 +11,9 @@ var TableRowIndex = ({
|
|
|
11
11
|
tablePath
|
|
12
12
|
}) => {
|
|
13
13
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
14
|
-
const baseClassName = context == null ? void 0 : context.getPrefixCls(
|
|
14
|
+
const baseClassName = context == null ? void 0 : context.getPrefixCls(
|
|
15
|
+
"agentic-md-editor-table-row-index"
|
|
16
|
+
);
|
|
15
17
|
const { wrapSSR, hashId } = useStyle(baseClassName);
|
|
16
18
|
return wrapSSR(
|
|
17
19
|
/* @__PURE__ */ React.createElement(
|
|
@@ -109,7 +109,7 @@ var handleMouseLeave = (domRef) => {
|
|
|
109
109
|
return;
|
|
110
110
|
target.classList.add("no-focus");
|
|
111
111
|
};
|
|
112
|
-
var createDefaultDom = (domRef, baseCls, hashId, loading, selectedItems, children, text, placeholder) => {
|
|
112
|
+
var createDefaultDom = (domRef, baseCls, hashId, loading, selectedItems, children, text, placeholder, isOpen) => {
|
|
113
113
|
const isEmpty = !(text == null ? void 0 : text.trim());
|
|
114
114
|
const hasItems = (selectedItems == null ? void 0 : selectedItems.length) > 0;
|
|
115
115
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -124,14 +124,15 @@ var createDefaultDom = (domRef, baseCls, hashId, loading, selectedItems, childre
|
|
|
124
124
|
onMouseEnter: () => handleMouseEnter(domRef),
|
|
125
125
|
onMouseLeave: () => handleMouseLeave(domRef),
|
|
126
126
|
title: placeholder,
|
|
127
|
-
contentEditable: !hasItems
|
|
127
|
+
contentEditable: !hasItems ? void 0 : false
|
|
128
128
|
},
|
|
129
129
|
children,
|
|
130
130
|
hasItems && /* @__PURE__ */ React.createElement(
|
|
131
131
|
ChevronDown,
|
|
132
132
|
{
|
|
133
133
|
className: classNames(`${baseCls}-tag-popup-input-arrow `, hashId, {
|
|
134
|
-
empty: isEmpty
|
|
134
|
+
empty: isEmpty,
|
|
135
|
+
open: isOpen
|
|
135
136
|
})
|
|
136
137
|
}
|
|
137
138
|
)
|
|
@@ -231,6 +232,7 @@ var TagPopup = (props) => {
|
|
|
231
232
|
initializeAutoOpen(props.autoOpen, type, setOpen, suggestionConnext);
|
|
232
233
|
}, []);
|
|
233
234
|
const placeholder = props.placeholder;
|
|
235
|
+
const isOpen = type === "dropdown" ? open : (suggestionConnext == null ? void 0 : suggestionConnext.open) || false;
|
|
234
236
|
const defaultDom = createDefaultDom(
|
|
235
237
|
domRef,
|
|
236
238
|
baseCls,
|
|
@@ -239,7 +241,8 @@ var TagPopup = (props) => {
|
|
|
239
241
|
selectedItems,
|
|
240
242
|
children,
|
|
241
243
|
props.text,
|
|
242
|
-
placeholder
|
|
244
|
+
placeholder,
|
|
245
|
+
isOpen
|
|
243
246
|
);
|
|
244
247
|
const renderDom = getRenderDom(
|
|
245
248
|
props.tagRender,
|
|
@@ -57,7 +57,11 @@ var genStyle = (token) => {
|
|
|
57
57
|
right: "4px",
|
|
58
58
|
top: "50%",
|
|
59
59
|
transform: "translateY(-50%)",
|
|
60
|
-
color: "var(--color-primary-text-disabled)"
|
|
60
|
+
color: "var(--color-primary-text-disabled)",
|
|
61
|
+
transition: "transform 0.2s ease",
|
|
62
|
+
"&.open": {
|
|
63
|
+
transform: "translateY(-50%) rotate(180deg)"
|
|
64
|
+
}
|
|
61
65
|
}
|
|
62
66
|
},
|
|
63
67
|
"&-tag-popup-input-has-arrow": {
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
1
21
|
// src/MarkdownEditor/editor/plugins/withMarkdown.ts
|
|
2
22
|
import { Editor, Node, Path, Range, Transforms } from "slate";
|
|
3
23
|
import { ReactEditor } from "slate-react";
|
|
@@ -206,6 +226,17 @@ var handleCodeTagOperation = (editor, operation, apply) => {
|
|
|
206
226
|
});
|
|
207
227
|
return true;
|
|
208
228
|
}
|
|
229
|
+
if (currentNode.text === operation.text) {
|
|
230
|
+
Editor.withoutNormalizing(editor, () => {
|
|
231
|
+
Transforms.removeNodes(editor, { at: operation.path });
|
|
232
|
+
Transforms.insertNodes(
|
|
233
|
+
editor,
|
|
234
|
+
__spreadProps(__spreadValues({}, currentNode), { tag: true, code: true, text: " " }),
|
|
235
|
+
{ at: operation.path, select: true }
|
|
236
|
+
);
|
|
237
|
+
});
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
209
240
|
apply(operation);
|
|
210
241
|
return true;
|
|
211
242
|
}
|
|
@@ -219,6 +250,17 @@ var handleCodeTagOperation = (editor, operation, apply) => {
|
|
|
219
250
|
return true;
|
|
220
251
|
}
|
|
221
252
|
}
|
|
253
|
+
if ((currentNode == null ? void 0 : currentNode.tag) && operation.text.trim().length > 0 && currentNode.text.trim().length === 0) {
|
|
254
|
+
Editor.withoutNormalizing(editor, () => {
|
|
255
|
+
Transforms.removeNodes(editor, { at: operation.path });
|
|
256
|
+
Transforms.insertNodes(
|
|
257
|
+
editor,
|
|
258
|
+
__spreadProps(__spreadValues({}, currentNode), { tag: true, code: true, text: operation.text }),
|
|
259
|
+
{ at: operation.path, select: true }
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
222
264
|
}
|
|
223
265
|
if (operation.type === "split_node") {
|
|
224
266
|
const node = Node.get(editor, operation.path);
|
|
@@ -39,7 +39,7 @@ var genStyle = (token) => {
|
|
|
39
39
|
color: "var(--color-gray-text-secondary)",
|
|
40
40
|
gap: 4,
|
|
41
41
|
"&:hover": {
|
|
42
|
-
backgroundColor: "
|
|
42
|
+
backgroundColor: "var(--color-gray-control-fill-hover)"
|
|
43
43
|
},
|
|
44
44
|
[`${token.componentCls}-file-list`]: {
|
|
45
45
|
"&-item": {
|
|
@@ -33,7 +33,8 @@ var SCROLL_STYLE = {
|
|
|
33
33
|
overflowY: "hidden",
|
|
34
34
|
WebkitOverflowScrolling: "touch",
|
|
35
35
|
overscrollBehavior: "contain",
|
|
36
|
-
touchAction: "pan-x"
|
|
36
|
+
touchAction: "pan-x",
|
|
37
|
+
paddingRight: 54
|
|
37
38
|
};
|
|
38
39
|
var POPOVER_OVERLAY_STYLE = { padding: 0 };
|
|
39
40
|
var DraggablePopupItem = React.memo((props) => {
|
|
@@ -372,7 +373,7 @@ var ActionItemContainer = (props) => {
|
|
|
372
373
|
trigger: "click",
|
|
373
374
|
placement: "topRight",
|
|
374
375
|
arrow: false,
|
|
375
|
-
|
|
376
|
+
styles: { body: POPOVER_OVERLAY_STYLE },
|
|
376
377
|
overlayClassName: classNames(
|
|
377
378
|
`${basePrefixCls}-overflow-popover`,
|
|
378
379
|
hashId
|
|
@@ -9,8 +9,8 @@ export type FileMapViewProps = {
|
|
|
9
9
|
onPreview?: (file: AttachmentFile) => void;
|
|
10
10
|
/** 下载文件回调 */
|
|
11
11
|
onDownload?: (file: AttachmentFile) => void;
|
|
12
|
-
/** 点击"查看所有文件"
|
|
13
|
-
onViewAll?: (files: AttachmentFile[]) =>
|
|
12
|
+
/** 点击"查看所有文件"回调,携带当前所有文件列表。返回 true 时组件内部展开所有文件,返回 false 时由外部处理 */
|
|
13
|
+
onViewAll?: (files: AttachmentFile[]) => boolean | Promise<boolean>;
|
|
14
14
|
/** 自定义更多操作 DOM(优先于 onMore,传入则展示该 DOM,不传则不展示更多按钮) */
|
|
15
15
|
renderMoreAction?: (file: AttachmentFile) => React.ReactNode;
|
|
16
16
|
/** 自定义悬浮动作区 slot(传入则覆盖默认『预览/下载/更多』动作区) */
|
|
@@ -1,18 +1,40 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
1
22
|
// src/MarkdownInputField/FileMapView/index.tsx
|
|
2
23
|
import { FileSearch } from "@sofa-design/icons";
|
|
3
24
|
import { ConfigProvider, Image } from "antd";
|
|
4
25
|
import classNames from "classnames";
|
|
5
26
|
import { motion } from "framer-motion";
|
|
6
|
-
import React, { useContext, useMemo } from "react";
|
|
27
|
+
import React, { useContext, useMemo, useState } from "react";
|
|
7
28
|
import { isImageFile } from "../AttachmentButton/utils";
|
|
8
29
|
import { FileMapViewItem } from "./FileMapViewItem";
|
|
9
30
|
import { useStyle } from "./style";
|
|
10
31
|
var FileMapView = (props) => {
|
|
11
32
|
var _a;
|
|
12
|
-
const { placement = "left"
|
|
33
|
+
const { placement = "left" } = props;
|
|
13
34
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
14
35
|
const prefix = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-file-view-list");
|
|
15
36
|
const { wrapSSR, hashId } = useStyle(prefix);
|
|
37
|
+
const [showAllFiles, setShowAllFiles] = useState(false);
|
|
16
38
|
const fileList = useMemo(() => {
|
|
17
39
|
var _a2;
|
|
18
40
|
if (!props.fileMap) {
|
|
@@ -27,11 +49,21 @@ var FileMapView = (props) => {
|
|
|
27
49
|
return fileList.filter((file) => !isImageFile(file));
|
|
28
50
|
}, [fileList]);
|
|
29
51
|
const noImageFileList = useMemo(() => {
|
|
30
|
-
if (props.maxDisplayCount === void 0) {
|
|
52
|
+
if (showAllFiles || props.maxDisplayCount === void 0) {
|
|
31
53
|
return allNoImageFiles;
|
|
32
54
|
}
|
|
33
55
|
return allNoImageFiles.slice(0, Math.max(0, props.maxDisplayCount));
|
|
34
|
-
}, [allNoImageFiles, props.maxDisplayCount]);
|
|
56
|
+
}, [allNoImageFiles, props.maxDisplayCount, showAllFiles]);
|
|
57
|
+
const handleViewAllClick = () => __async(void 0, null, function* () {
|
|
58
|
+
if (props.onViewAll) {
|
|
59
|
+
const shouldExpand = yield props.onViewAll(fileList);
|
|
60
|
+
if (shouldExpand) {
|
|
61
|
+
setShowAllFiles(true);
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
setShowAllFiles(true);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
35
67
|
return wrapSSR(
|
|
36
68
|
/* @__PURE__ */ React.createElement(
|
|
37
69
|
"div",
|
|
@@ -118,9 +150,7 @@ var FileMapView = (props) => {
|
|
|
118
150
|
hashId,
|
|
119
151
|
props.className,
|
|
120
152
|
`${prefix}-${placement}`,
|
|
121
|
-
{
|
|
122
|
-
[`${prefix}-vertical`]: placement === "left"
|
|
123
|
-
}
|
|
153
|
+
`${prefix}-vertical`
|
|
124
154
|
),
|
|
125
155
|
style: props.style
|
|
126
156
|
},
|
|
@@ -148,15 +178,12 @@ var FileMapView = (props) => {
|
|
|
148
178
|
}
|
|
149
179
|
);
|
|
150
180
|
}),
|
|
151
|
-
|
|
181
|
+
props.maxDisplayCount !== void 0 && allNoImageFiles.length > props.maxDisplayCount && !showAllFiles ? /* @__PURE__ */ React.createElement(
|
|
152
182
|
"div",
|
|
153
183
|
{
|
|
154
184
|
style: { width: (_a = props.style) == null ? void 0 : _a.width },
|
|
155
185
|
className: classNames(hashId, `${prefix}-more-file-container`),
|
|
156
|
-
onClick:
|
|
157
|
-
var _a2;
|
|
158
|
-
return (_a2 = props.onViewAll) == null ? void 0 : _a2.call(props, fileList);
|
|
159
|
-
}
|
|
186
|
+
onClick: handleViewAllClick
|
|
160
187
|
},
|
|
161
188
|
/* @__PURE__ */ React.createElement(FileSearch, { color: "var(--color-gray-text-secondary)" }),
|
|
162
189
|
/* @__PURE__ */ React.createElement("div", { className: classNames(hashId, `${prefix}-more-file-name`) }, /* @__PURE__ */ React.createElement("span", { style: { whiteSpace: "nowrap" } }, "查看此任务中的所有文件"))
|
|
@@ -45,9 +45,12 @@ var genStyle = (token) => {
|
|
|
45
45
|
},
|
|
46
46
|
"&-vertical": {
|
|
47
47
|
display: "flex",
|
|
48
|
-
flexDirection: "
|
|
48
|
+
flexDirection: "row",
|
|
49
|
+
flexWrap: "wrap",
|
|
49
50
|
alignItems: "flex-start",
|
|
50
|
-
gap: 4
|
|
51
|
+
gap: 4,
|
|
52
|
+
maxWidth: "calc(285px * 3 + 4px * 2)"
|
|
53
|
+
// 3列:每列285px,间距4px
|
|
51
54
|
},
|
|
52
55
|
"&::-webkit-scrollbar": {
|
|
53
56
|
width: 6
|
|
@@ -116,7 +119,7 @@ var genStyle = (token) => {
|
|
|
116
119
|
borderRadius: "var(--radius-card-base)"
|
|
117
120
|
},
|
|
118
121
|
"&-more-file-container": {
|
|
119
|
-
width: "
|
|
122
|
+
width: "285px",
|
|
120
123
|
height: "56px",
|
|
121
124
|
borderRadius: "var(--radius-card-base)",
|
|
122
125
|
background: "var(--color-gray-bg-card-white)",
|
|
@@ -140,7 +143,7 @@ var genStyle = (token) => {
|
|
|
140
143
|
color: "var(--color-gray-text-secondary)"
|
|
141
144
|
},
|
|
142
145
|
"&-item": {
|
|
143
|
-
width: "
|
|
146
|
+
width: "285px",
|
|
144
147
|
height: "56px",
|
|
145
148
|
borderRadius: "var(--radius-card-base)",
|
|
146
149
|
opacity: 1,
|
|
@@ -230,7 +233,7 @@ var genStyle = (token) => {
|
|
|
230
233
|
"&-file-name": {
|
|
231
234
|
color: "var(--color-gray-text-default)",
|
|
232
235
|
fontSize: "var(--font-text-h6-base)",
|
|
233
|
-
width: "
|
|
236
|
+
width: "150px",
|
|
234
237
|
alignItems: "center",
|
|
235
238
|
lineHeight: "18px",
|
|
236
239
|
fontFamily: token.fontFamily,
|
|
@@ -238,7 +241,7 @@ var genStyle = (token) => {
|
|
|
238
241
|
display: "flex",
|
|
239
242
|
overflow: "hidden",
|
|
240
243
|
"&-text": {
|
|
241
|
-
maxWidth: "
|
|
244
|
+
maxWidth: "150px",
|
|
242
245
|
whiteSpace: "nowrap !important",
|
|
243
246
|
wordWrap: "normal",
|
|
244
247
|
wordBreak: "keep-all",
|