@ant-design/agentic-ui 2.0.12 → 2.0.14

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 (31) hide show
  1. package/README.md +12 -12
  2. package/dist/Bubble/AIBubble.js +3 -1
  3. package/dist/{ChatBoot → ChatBootPage}/ButtonTab.js +1 -1
  4. package/dist/{ChatBoot → ChatBootPage}/ButtonTabGroup.js +1 -1
  5. package/dist/{ChatBoot → ChatBootPage}/ButtonTabGroupStyle.js +1 -1
  6. package/dist/{ChatBoot → ChatBootPage}/ButtonTabStyle.js +1 -1
  7. package/dist/{ChatBoot → ChatBootPage}/CaseReply.js +1 -1
  8. package/dist/{ChatBoot → ChatBootPage}/CaseReplyStyle.js +1 -1
  9. package/dist/{ChatBoot → ChatBootPage}/Title.js +1 -1
  10. package/dist/{ChatBoot → ChatBootPage}/index.js +1 -1
  11. package/dist/{ChatBoot → ChatBootPage}/style.js +1 -1
  12. package/dist/MarkdownEditor/editor/Editor.js +34 -2
  13. package/dist/MarkdownEditor/editor/components/LazyElement/index.d.ts +10 -1
  14. package/dist/MarkdownEditor/editor/components/LazyElement/index.js +4 -2
  15. package/dist/MarkdownEditor/types.d.ts +1 -1
  16. package/dist/{Welcome → WelcomeMessage}/index.d.ts +7 -4
  17. package/dist/{Welcome → WelcomeMessage}/index.js +3 -3
  18. package/dist/{Welcome → WelcomeMessage}/style.js +1 -1
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +2 -2
  21. package/package.json +1 -1
  22. /package/dist/{ChatBoot → ChatBootPage}/ButtonTab.d.ts +0 -0
  23. /package/dist/{ChatBoot → ChatBootPage}/ButtonTabGroup.d.ts +0 -0
  24. /package/dist/{ChatBoot → ChatBootPage}/ButtonTabGroupStyle.d.ts +0 -0
  25. /package/dist/{ChatBoot → ChatBootPage}/ButtonTabStyle.d.ts +0 -0
  26. /package/dist/{ChatBoot → ChatBootPage}/CaseReply.d.ts +0 -0
  27. /package/dist/{ChatBoot → ChatBootPage}/CaseReplyStyle.d.ts +0 -0
  28. /package/dist/{ChatBoot → ChatBootPage}/Title.d.ts +0 -0
  29. /package/dist/{ChatBoot → ChatBootPage}/index.d.ts +0 -0
  30. /package/dist/{ChatBoot → ChatBootPage}/style.d.ts +0 -0
  31. /package/dist/{Welcome → WelcomeMessage}/style.d.ts +0 -0
package/README.md CHANGED
@@ -153,12 +153,12 @@ import { MarkdownEditor } from '@ant-design/agentic-ui';
153
153
 
154
154
  ### 📋 布局与容器组件
155
155
 
156
- | 组件 | 描述 | 主要功能 |
157
- | ------------ | ------------ | ------------------------------------ |
158
- | `ChatLayout` | 聊天布局容器 | 标准聊天界面布局,支持左右栏、全屏等 |
159
- | `History` | 历史记录组件 | 会话历史管理,支持搜索、筛选、导出 |
160
- | `Welcome` | 欢迎页组件 | 应用启动欢迎页,展示功能介绍 |
161
- | `Quote` | 引用组件 | 引用消息或内容 |
156
+ | 组件 | 描述 | 主要功能 |
157
+ | ---------------- | ------------ | ------------------------------------ |
158
+ | `ChatLayout` | 聊天布局容器 | 标准聊天界面布局,支持左右栏、全屏等 |
159
+ | `History` | 历史记录组件 | 会话历史管理,支持搜索、筛选、导出 |
160
+ | `WelcomeMessage` | 欢迎语组件 | 应用启动欢迎语,展示功能介绍 |
161
+ | `Quote` | 引用组件 | 引用消息或内容 |
162
162
 
163
163
  ### 🎯 交互与反馈组件
164
164
 
@@ -172,12 +172,12 @@ import { MarkdownEditor } from '@ant-design/agentic-ui';
172
172
 
173
173
  ### 🧠 智能体专属组件
174
174
 
175
- | 组件 | 描述 | 主要功能 |
176
- | ---------------- | ------------- | ---------------------------- |
177
- | `ChatBoot` | 聊天引导组件 | 快速回复、案例推荐等引导功能 |
178
- | `SchemaEditor` | Schema 编辑器 | 结构化数据编辑 |
179
- | `SchemaForm` | Schema 表单 | 基于 Schema 自动生成表单 |
180
- | `SchemaRenderer` | Schema 渲染器 | 渲染结构化数据 |
175
+ | 组件 | 描述 | 主要功能 |
176
+ | ---------------- | -------------- | ---------------------------- |
177
+ | `ChatBootPage` | 对话启动页组件 | 快速回复、案例推荐等引导功能 |
178
+ | `SchemaEditor` | Schema 编辑器 | 结构化数据编辑 |
179
+ | `SchemaForm` | Schema 表单 | 基于 Schema 自动生成表单 |
180
+ | `SchemaRenderer` | Schema 渲染器 | 渲染结构化数据 |
181
181
 
182
182
  ### 🔌 插件组件
183
183
 
@@ -167,7 +167,9 @@ var AIBubble = memo((props) => {
167
167
  {
168
168
  style: __spreadValues({
169
169
  minWidth: standalone ? "min(296px,100%)" : "0px",
170
- paddingLeft: 12
170
+ paddingLeft: 12,
171
+ maxWidth: "100%",
172
+ width: "100%"
171
173
  }, styles == null ? void 0 : styles.bubbleListItemExtraStyle),
172
174
  className: cx(
173
175
  `${prefixClass}-bubble-after`,
@@ -1,4 +1,4 @@
1
- // src/ChatBoot/ButtonTab.tsx
1
+ // src/ChatBootPage/ButtonTab.tsx
2
2
  import React from "react";
3
3
  import { useStyle } from "./ButtonTabStyle";
4
4
  var ButtonTab = ({
@@ -1,4 +1,4 @@
1
- // src/ChatBoot/ButtonTabGroup.tsx
1
+ // src/ChatBootPage/ButtonTabGroup.tsx
2
2
  import React, { useState } from "react";
3
3
  import ButtonTab from "./ButtonTab";
4
4
  import { useStyle } from "./ButtonTabGroupStyle";
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
- // src/ChatBoot/ButtonTabGroupStyle.ts
21
+ // src/ChatBootPage/ButtonTabGroupStyle.ts
22
22
  import {
23
23
  useEditorStyleRegister
24
24
  } from "../Hooks/useStyle";
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
- // src/ChatBoot/ButtonTabStyle.ts
21
+ // src/ChatBootPage/ButtonTabStyle.ts
22
22
  import {
23
23
  useEditorStyleRegister
24
24
  } from "../Hooks/useStyle";
@@ -1,4 +1,4 @@
1
- // src/ChatBoot/CaseReply.tsx
1
+ // src/ChatBootPage/CaseReply.tsx
2
2
  import { ConfigProvider } from "antd";
3
3
  import classNames from "classnames";
4
4
  import React, { useContext, useState } from "react";
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
- // src/ChatBoot/CaseReplyStyle.ts
21
+ // src/ChatBootPage/CaseReplyStyle.ts
22
22
  import {
23
23
  useEditorStyleRegister
24
24
  } from "../Hooks/useStyle";
@@ -1,4 +1,4 @@
1
- // src/ChatBoot/Title.tsx
1
+ // src/ChatBootPage/Title.tsx
2
2
  import { ConfigProvider } from "antd";
3
3
  import classNames from "classnames";
4
4
  import React, { useContext } from "react";
@@ -1,4 +1,4 @@
1
- // src/ChatBoot/index.ts
1
+ // src/ChatBootPage/index.ts
2
2
  import { default as default2 } from "./Title";
3
3
  import { default as default3 } from "./CaseReply";
4
4
  import { default as default4 } from "./ButtonTab";
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
- // src/ChatBoot/style.ts
21
+ // src/ChatBootPage/style.ts
22
22
  import {
23
23
  useEditorStyleRegister
24
24
  } from "../Hooks/useStyle";
@@ -104,6 +104,23 @@ var SlateMarkdownEditor = (props) => {
104
104
  readonly,
105
105
  setDomRect
106
106
  } = useEditorStore();
107
+ const lazyElementIndexRef = useRef(0);
108
+ const hasResetIndexRef = useRef(false);
109
+ const countLazyElements = useCallback((nodes) => {
110
+ let count = 0;
111
+ const traverse = (nodeList) => {
112
+ nodeList.forEach((node) => {
113
+ if (node.type !== "table-cell" && node.type !== "table-row") {
114
+ count++;
115
+ }
116
+ if (node.children && Array.isArray(node.children)) {
117
+ traverse(node.children);
118
+ }
119
+ });
120
+ };
121
+ traverse(nodes);
122
+ return count;
123
+ }, []);
107
124
  const changedMark = useRef(false);
108
125
  const value = useRef([EditorUtils.p]);
109
126
  const nodeRef = useRef();
@@ -599,6 +616,13 @@ var SlateMarkdownEditor = (props) => {
599
616
  const elementRenderElement = useCallback(
600
617
  (eleProps) => {
601
618
  var _a2, _b2, _c2, _d2, _e;
619
+ if (!hasResetIndexRef.current) {
620
+ lazyElementIndexRef.current = 0;
621
+ hasResetIndexRef.current = true;
622
+ Promise.resolve().then(() => {
623
+ hasResetIndexRef.current = false;
624
+ });
625
+ }
602
626
  const defaultDom = /* @__PURE__ */ React.createElement(
603
627
  ErrorBoundary,
604
628
  {
@@ -634,19 +658,27 @@ var SlateMarkdownEditor = (props) => {
634
658
  if (eleProps.element.type === "table-cell" || eleProps.element.type === "table-row") {
635
659
  return renderedDom;
636
660
  }
661
+ const currentIndex = lazyElementIndexRef.current;
662
+ lazyElementIndexRef.current += 1;
663
+ const totalElements = countLazyElements(value.current);
637
664
  return /* @__PURE__ */ React.createElement(
638
665
  LazyElement,
639
666
  {
640
667
  placeholderHeight: (_c2 = props.lazy) == null ? void 0 : _c2.placeholderHeight,
641
668
  rootMargin: (_d2 = props.lazy) == null ? void 0 : _d2.rootMargin,
642
- renderPlaceholder: (_e = props.lazy) == null ? void 0 : _e.renderPlaceholder
669
+ renderPlaceholder: (_e = props.lazy) == null ? void 0 : _e.renderPlaceholder,
670
+ elementInfo: {
671
+ type: eleProps.element.type,
672
+ index: currentIndex,
673
+ total: totalElements
674
+ }
643
675
  },
644
676
  renderedDom
645
677
  );
646
678
  }
647
679
  return renderedDom;
648
680
  },
649
- [props.eleItemRender, props.lazy, plugins, readonly]
681
+ [props.eleItemRender, props.lazy, plugins, readonly, countLazyElements]
650
682
  );
651
683
  const renderMarkdownLeaf = useRefFunction((leafComponentProps) => {
652
684
  const defaultDom = /* @__PURE__ */ React.createElement(
@@ -3,6 +3,15 @@ import React from 'react';
3
3
  * LazyElement 组件属性
4
4
  */
5
5
  export interface LazyElementProps {
6
+ /** 元素在文档中的位置信息 */
7
+ elementInfo: {
8
+ /** 元素类型 */
9
+ type: string;
10
+ /** 元素在文档中的索引 */
11
+ index: number;
12
+ /** 元素总数量 */
13
+ total: number;
14
+ };
6
15
  /** 子元素 */
7
16
  children: React.ReactNode;
8
17
  /** 占位符高度,默认 100px */
@@ -20,7 +29,7 @@ export interface LazyElementProps {
20
29
  /** 元素是否即将进入视口 */
21
30
  isIntersecting: boolean;
22
31
  /** 元素在文档中的位置信息 */
23
- elementInfo?: {
32
+ elementInfo: {
24
33
  /** 元素类型 */
25
34
  type: string;
26
35
  /** 元素在文档中的索引 */
@@ -22,7 +22,8 @@ var LazyElement = ({
22
22
  placeholderHeight = 25,
23
23
  rootMargin = "200px",
24
24
  placeholderStyle,
25
- renderPlaceholder
25
+ renderPlaceholder,
26
+ elementInfo
26
27
  }) => {
27
28
  const containerRef = useRef(null);
28
29
  const [isVisible, setIsVisible] = useState(false);
@@ -63,7 +64,8 @@ var LazyElement = ({
63
64
  return /* @__PURE__ */ React.createElement("div", { ref: containerRef, "aria-hidden": "true" }, renderPlaceholder({
64
65
  height: placeholderHeight,
65
66
  style: computedPlaceholderStyle,
66
- isIntersecting
67
+ isIntersecting,
68
+ elementInfo
67
69
  }));
68
70
  }
69
71
  return /* @__PURE__ */ React.createElement(
@@ -193,7 +193,7 @@ export type MarkdownEditorProps = {
193
193
  /** 元素是否即将进入视口 */
194
194
  isIntersecting: boolean;
195
195
  /** 元素在文档中的位置信息 */
196
- elementInfo?: {
196
+ elementInfo: {
197
197
  /** 元素类型 */
198
198
  type: string;
199
199
  /** 元素在文档中的索引 */
@@ -1,14 +1,17 @@
1
1
  import React from 'react';
2
- export interface WelcomeProps {
2
+ export interface WelcomeMessageProps {
3
3
  /** 标题 */
4
- title: React.ReactNode;
4
+ title?: React.ReactNode;
5
5
  /** 描述 */
6
6
  description?: React.ReactNode;
7
7
  /** 自定义样式类名,用于各个提示项的不同部分 */
8
- classNames?: Record<'title' | 'description', string>;
8
+ classNames?: {
9
+ title?: string;
10
+ description?: string;
11
+ };
9
12
  /** 自定义样式 */
10
13
  style?: React.CSSProperties;
11
14
  /** 自定义根节点样式类名 */
12
15
  rootClassName?: string;
13
16
  }
14
- export declare const Welcome: React.FC<WelcomeProps>;
17
+ export declare const WelcomeMessage: React.FC<WelcomeMessageProps>;
@@ -1,9 +1,9 @@
1
- // src/Welcome/index.tsx
1
+ // src/WelcomeMessage/index.tsx
2
2
  import { ConfigProvider } from "antd";
3
3
  import classnames from "classnames";
4
4
  import React, { useContext } from "react";
5
5
  import { useStyle } from "./style";
6
- var Welcome = ({
6
+ var WelcomeMessage = ({
7
7
  title,
8
8
  description,
9
9
  classNames,
@@ -27,5 +27,5 @@ var Welcome = ({
27
27
  );
28
28
  };
29
29
  export {
30
- Welcome
30
+ WelcomeMessage
31
31
  };
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
- // src/Welcome/style.ts
21
+ // src/WelcomeMessage/style.ts
22
22
  import {
23
23
  useEditorStyleRegister
24
24
  } from "../Hooks/useStyle";
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export * from './AgentRunBar';
4
4
  export * from './Bubble';
5
5
  export * from './Bubble/List';
6
6
  export * from './Bubble/type';
7
- export * from './ChatBoot';
7
+ export * from './ChatBootPage';
8
8
  export * from './ChatLayout';
9
9
  export * from './Components/ActionIconBox';
10
10
  export * from './Components/Button';
@@ -47,7 +47,7 @@ export * from './Schema';
47
47
  export * from './TaskList';
48
48
  export * from './ThoughtChainList';
49
49
  export * from './ToolUseBar';
50
- export * from './Welcome';
50
+ export * from './WelcomeMessage';
51
51
  export * from './Workspace';
52
52
  export * from './Components/Robot';
53
53
  export { default as Robot } from './Components/Robot';
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ export * from "./AgentRunBar";
4
4
  export * from "./Bubble";
5
5
  export * from "./Bubble/List";
6
6
  export * from "./Bubble/type";
7
- export * from "./ChatBoot";
7
+ export * from "./ChatBootPage";
8
8
  export * from "./ChatLayout";
9
9
  export * from "./Components/ActionIconBox";
10
10
  export * from "./Components/Button";
@@ -47,7 +47,7 @@ export * from "./Schema";
47
47
  export * from "./TaskList";
48
48
  export * from "./ThoughtChainList";
49
49
  export * from "./ToolUseBar";
50
- export * from "./Welcome";
50
+ export * from "./WelcomeMessage";
51
51
  export * from "./Workspace";
52
52
  export * from "./Components/Robot";
53
53
  import { default as default3 } from "./Components/Robot";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes