@ant-design/agentic-ui 2.0.21 → 2.0.23

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 (47) hide show
  1. package/dist/Bubble/FileView.js +27 -31
  2. package/dist/Bubble/MessagesContent/VoiceButton/style.js +6 -3
  3. package/dist/ChatBootPage/ButtonTabStyle.js +2 -0
  4. package/dist/ChatBootPage/CaseReply.d.ts +0 -3
  5. package/dist/ChatBootPage/CaseReplyStyle.js +3 -4
  6. package/dist/Components/ActionIconBox/style.js +3 -1
  7. package/dist/Components/GradientText/index.d.ts +2 -1
  8. package/dist/Components/GradientText/index.js +3 -2
  9. package/dist/Components/GradientText/style.js +3 -8
  10. package/dist/Components/TextAnimate/index.d.ts +1 -0
  11. package/dist/Components/TextAnimate/index.js +27 -16
  12. package/dist/Components/TypingAnimation/index.d.ts +1 -1
  13. package/dist/Components/TypingAnimation/index.js +9 -9
  14. package/dist/Components/lotties/LoadingLottie/loading.json +1989 -1
  15. package/dist/Components/lotties/{ShinyText → TextLoading}/index.d.ts +9 -9
  16. package/dist/Components/lotties/{ShinyText → TextLoading}/index.js +7 -7
  17. package/dist/Components/lotties/{ShinyText → TextLoading}/style.js +4 -4
  18. package/dist/Components/lotties/index.d.ts +1 -1
  19. package/dist/Components/lotties/index.js +1 -1
  20. package/dist/History/components/HistoryItem.js +14 -6
  21. package/dist/History/types/HistoryData.d.ts +2 -0
  22. package/dist/MarkdownEditor/editor/components/ContributorAvatar/index.js +1 -1
  23. package/dist/MarkdownEditor/editor/components/LazyElement/index.js +36 -4
  24. package/dist/MarkdownEditor/editor/elements/Table/TableRowIndex/index.js +3 -1
  25. package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +6 -3
  26. package/dist/MarkdownEditor/editor/elements/TagPopup/style.js +5 -1
  27. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.d.ts +4 -0
  28. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +245 -344
  29. package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +74 -56
  30. package/dist/MarkdownEditor/editor/store.d.ts +36 -0
  31. package/dist/MarkdownEditor/editor/store.js +208 -76
  32. package/dist/MarkdownInputField/AttachmentButton/style.js +1 -1
  33. package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +2 -1
  34. package/dist/MarkdownInputField/MarkdownInputField.js +1 -1
  35. package/dist/MarkdownInputField/VoiceInput/style.js +1 -1
  36. package/dist/MarkdownInputField/style.js +2 -8
  37. package/dist/Plugins/chart/DonutChart/style.js +1 -0
  38. package/dist/Plugins/chart/LineChart/index.js +66 -55
  39. package/dist/Plugins/chart/LineChart/style.js +8 -0
  40. package/dist/Schema/SchemaRenderer/index.js +81 -56
  41. package/dist/Utils/proxySandbox/ProxySandbox.d.ts +32 -0
  42. package/dist/Utils/proxySandbox/ProxySandbox.js +176 -128
  43. package/dist/WelcomeMessage/index.d.ts +2 -2
  44. package/dist/WelcomeMessage/index.js +8 -5
  45. package/dist/WelcomeMessage/style.js +0 -1
  46. package/package.json +1 -1
  47. /package/dist/Components/lotties/{ShinyText → TextLoading}/style.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export interface ShinyTextProps {
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
- * <ShinyText />
42
+ * <TextLoading />
43
43
  *
44
44
  * @example
45
45
  * // 自定义文本
46
- * <ShinyText text="加载中..." />
46
+ * <TextLoading text="加载中..." />
47
47
  *
48
48
  * @example
49
49
  * // 自定义样式
50
- * <ShinyText
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
- * <ShinyText disabled={true} />
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 ShinyText: React.FC<ShinyTextProps>;
69
- export default ShinyText;
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/ShinyText/index.tsx
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 ShinyText = ({
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-shiny-text");
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": "shiny-text",
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 ShinyText_default = ShinyText;
56
+ var TextLoading_default = TextLoading;
57
57
  export {
58
- ShinyText,
59
- ShinyText_default as default
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/ShinyText/style.ts
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("ShinyText", (token) => {
76
- const shinyTextToken = __spreadProps(__spreadValues({}, token), {
75
+ return useEditorStyleRegister("TextLoading", (token) => {
76
+ const textLoadingToken = __spreadProps(__spreadValues({}, token), {
77
77
  componentCls: `.${prefixCls}`
78
78
  });
79
- return [genStyle(shinyTextToken)];
79
+ return [genStyle(textLoadingToken)];
80
80
  });
81
81
  }
82
82
  export {
@@ -1 +1 @@
1
- export * from './ShinyText';
1
+ export * from './TextLoading';
@@ -1,2 +1,2 @@
1
1
  // src/Components/lotties/index.ts
2
- export * from "./ShinyText";
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 { textRef, isTextOverflow } = useTextOverflow(item.sessionTitle);
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 ? item.sessionTitle : null,
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
- item.sessionTitle
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 { textRef, isTextOverflow } = useTextOverflow(item.sessionTitle);
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 ? item.sessionTitle : null,
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
- item.sessionTitle
410
+ displayText
403
411
  )
404
412
  )
405
413
  ),
@@ -9,6 +9,8 @@ export type HistoryDataType = {
9
9
  tenantId?: string;
10
10
  /** 会话标题 */
11
11
  sessionTitle?: React.ReactNode;
12
+ /** 展示标题(标题自定义渲染,不参与内置的搜索功能) */
13
+ displayTitle?: React.ReactNode;
12
14
  /** 会话描述/副标题 */
13
15
  description?: React.ReactNode;
14
16
  /** 会话图标 */
@@ -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-md-editor-contributor-avatar-list");
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(
@@ -29,18 +29,28 @@ var LazyElement = ({
29
29
  const [isVisible, setIsVisible] = useState(false);
30
30
  const [hasRendered, setHasRendered] = useState(false);
31
31
  const [isIntersecting, setIsIntersecting] = useState(false);
32
+ const observerRef = useRef(null);
32
33
  useEffect(() => {
33
34
  const container = containerRef.current;
34
35
  if (!container)
35
36
  return;
37
+ if (hasRendered)
38
+ return;
39
+ if (observerRef.current) {
40
+ observerRef.current.disconnect();
41
+ observerRef.current = null;
42
+ }
36
43
  const observer = new IntersectionObserver(
37
44
  (entries) => {
38
45
  entries.forEach((entry) => {
39
46
  setIsIntersecting(entry.isIntersecting);
40
- if (entry.isIntersecting) {
47
+ if (entry.isIntersecting && !hasRendered) {
41
48
  setIsVisible(true);
42
49
  setHasRendered(true);
43
- observer.disconnect();
50
+ if (observerRef.current) {
51
+ observerRef.current.disconnect();
52
+ observerRef.current = null;
53
+ }
44
54
  }
45
55
  });
46
56
  },
@@ -49,11 +59,33 @@ var LazyElement = ({
49
59
  threshold: 0
50
60
  }
51
61
  );
62
+ observerRef.current = observer;
52
63
  observer.observe(container);
64
+ const timeoutId = setTimeout(() => {
65
+ const rect = container.getBoundingClientRect();
66
+ const windowHeight = window.innerHeight || document.documentElement.clientHeight;
67
+ const windowWidth = window.innerWidth || document.documentElement.clientWidth;
68
+ if (!hasRendered && (rect.height > 0 || rect.width > 0) && windowHeight > 0 && windowWidth > 0) {
69
+ const margin = parseInt(rootMargin) || 200;
70
+ const isInViewport = rect.top < windowHeight + margin && rect.bottom > -margin && rect.left < windowWidth + margin && rect.right > -margin;
71
+ if (isInViewport) {
72
+ setIsVisible(true);
73
+ setHasRendered(true);
74
+ if (observerRef.current) {
75
+ observerRef.current.disconnect();
76
+ observerRef.current = null;
77
+ }
78
+ }
79
+ }
80
+ }, 100);
53
81
  return () => {
54
- observer.disconnect();
82
+ clearTimeout(timeoutId);
83
+ if (observerRef.current) {
84
+ observerRef.current.disconnect();
85
+ observerRef.current = null;
86
+ }
55
87
  };
56
- }, [rootMargin]);
88
+ }, [rootMargin, hasRendered]);
57
89
  if (hasRendered || isVisible) {
58
90
  return /* @__PURE__ */ React.createElement("div", { ref: containerRef }, children);
59
91
  }
@@ -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("agentic-md-editor-table-row-index");
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(
@@ -131,7 +131,8 @@ var createDefaultDom = (domRef, baseCls, hashId, loading, selectedItems, childre
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,7 @@
1
+ /**
2
+ * 此文件包含大量相互依赖的函数,为了保持代码的可读性和逻辑分组,
3
+ * 我们允许函数在定义前使用(函数提升)
4
+ */
1
5
  import { Elements } from '../../el';
2
6
  import { MarkdownEditorPlugin } from '../../plugin';
3
7
  export declare const decodeURIComponentUrl: (url: string) => string;