@ant-design/agentic-ui 2.29.13 → 2.29.15

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.
@@ -3,9 +3,6 @@
3
3
  * ButtonTab 组件样式
4
4
  */
5
5
  export declare const useStyle: (prefixCls?: string) => {
6
- /**
7
- * ButtonTab 组件样式
8
- */
9
6
  hashId: string;
10
7
  wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
11
8
  } | {
@@ -66,7 +66,7 @@ import { dragStart } from "../index";
66
66
  // 使用 useMemo 优化 className 计算
67
67
  var fncClassName = useMemo(function() {
68
68
  var _obj;
69
- return classNames(prefixClassName === null || prefixClassName === void 0 ? void 0 : prefixClassName.trim(), (_obj = {}, _define_property(_obj, "".concat(mdEditorBaseClass, "-fnc"), leaf.fnc), _define_property(_obj, "".concat(mdEditorBaseClass, "-fnd"), leaf.fnd), _obj));
69
+ return classNames((_obj = {}, _define_property(_obj, "".concat(mdEditorBaseClass, "-fnc"), leaf.fnc), _define_property(_obj, "".concat(mdEditorBaseClass, "-fnd"), leaf.fnd), _obj));
70
70
  }, [
71
71
  prefixClassName,
72
72
  mdEditorBaseClass,
@@ -85,15 +85,17 @@ import { Node } from "slate";
85
85
  * - 使用 React.memo 优化性能
86
86
  * - 保持预览模式的视觉效果
87
87
  */ export var ReadonlyParagraph = /*#__PURE__*/ React.memo(function(props) {
88
- var _props_children;
88
+ var _props_element_align;
89
+ var _props_element_otherProps, _props_children;
89
90
  var str = Node.string(props.element).trim();
91
+ var align = (_props_element_align = props.element.align) !== null && _props_element_align !== void 0 ? _props_element_align : (_props_element_otherProps = props.element.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.align;
90
92
  return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
91
93
  "data-be": 'paragraph',
92
94
  className: classNames({}),
93
- "data-align": props.element.align,
95
+ "data-align": align,
94
96
  style: {
95
97
  display: !!str || !!((_props_children = props.children) === null || _props_children === void 0 ? void 0 : _props_children.at(0).type) ? undefined : 'none',
96
- textAlign: props.element.align
98
+ textAlign: align
97
99
  }
98
100
  }), props.children);
99
101
  });
@@ -105,9 +105,11 @@ import { useSelStatus } from "../../../hooks/editor";
105
105
  import { useEditorStore } from "../../store";
106
106
  import { DragHandle } from "../../tools/DragHandle";
107
107
  export var Paragraph = function(props) {
108
- var _markdownEditorRef_current;
108
+ var _props_element_align;
109
+ var _props_element_otherProps, _markdownEditorRef_current;
110
+ var align = (_props_element_align = props.element.align) !== null && _props_element_align !== void 0 ? _props_element_align : (_props_element_otherProps = props.element.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.align;
109
111
  debugInfo('Paragraph - 渲染段落', {
110
- align: props.element.align,
112
+ align: align,
111
113
  children: props.element.children
112
114
  });
113
115
  var _useEditorStore = useEditorStore(), store = _useEditorStore.store, markdownEditorRef = _useEditorStore.markdownEditorRef, markdownContainerRef = _useEditorStore.markdownContainerRef, readonly = _useEditorStore.readonly, editorProps = _useEditorStore.editorProps;
@@ -120,7 +122,7 @@ export var Paragraph = function(props) {
120
122
  strLength: str.length,
121
123
  selected: selected,
122
124
  readonly: readonly,
123
- align: props.element.align
125
+ align: align
124
126
  });
125
127
  // 检查是否为空:trim 后的字符串为空(包括只包含空格的情况),且所有子节点都是纯文本节点(没有 type、code、tag)
126
128
  // 当只输入空格时,trim() 后为空字符串,应该显示 placeholder
@@ -137,7 +139,7 @@ export var Paragraph = function(props) {
137
139
  className: classNames({
138
140
  empty: isEmpty
139
141
  }),
140
- "data-align": props.element.align,
142
+ "data-align": align,
141
143
  "data-slate-placeholder": isEmpty ? editorProps.titlePlaceholderContent || (locale === null || locale === void 0 ? void 0 : locale.inputPlaceholder) || '请输入内容...' : undefined,
142
144
  onDragStart: function(e) {
143
145
  store.dragStart(e, markdownContainerRef.current);
@@ -145,12 +147,12 @@ export var Paragraph = function(props) {
145
147
  "data-empty": isEmpty,
146
148
  style: {
147
149
  display: !!str || !!((_props_children = props.children) === null || _props_children === void 0 ? void 0 : _props_children.at(0).type) ? undefined : 'none',
148
- textAlign: props.element.align
150
+ textAlign: align
149
151
  }
150
152
  }), /*#__PURE__*/ React.createElement(DragHandle, null), props.children);
151
153
  }, [
152
154
  props.element.children,
153
- props.element.align,
155
+ align,
154
156
  readonly,
155
157
  selected,
156
158
  (_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : _markdownEditorRef_current.children.length,
@@ -306,7 +306,7 @@ var MLeafComponent = function(props) {
306
306
  text: (_leaf_text = leaf.text) === null || _leaf_text === void 0 ? void 0 : _leaf_text.substring(0, 50)
307
307
  });
308
308
  var style = {};
309
- var prefixClassName = classNames(mdEditorBaseClass);
309
+ var prefixClassName = '';
310
310
  var children = /*#__PURE__*/ React.createElement(React.Fragment, null, props.children);
311
311
  if (leaf.code || leaf.tag) {
312
312
  var _ref = (props === null || props === void 0 ? void 0 : props.leaf) || {}, text = _ref.text, tag = _ref.tag, placeholder = _ref.placeholder, autoOpen = _ref.autoOpen, triggerText = _ref.triggerText;
@@ -383,7 +383,7 @@ var MLeafComponent = function(props) {
383
383
  placeholder: placeholder || (locale === null || locale === void 0 ? void 0 : locale['input.placeholder']) || '请输入'
384
384
  }), children));
385
385
  } else {
386
- prefixClassName = classNames(prefixClassName, mdEditorBaseClass + '-inline-code');
386
+ prefixClassName = classNames(mdEditorBaseClass + '-inline-code');
387
387
  children = /*#__PURE__*/ React.createElement("code", {
388
388
  className: prefixClassName
389
389
  }, children);
@@ -408,7 +408,7 @@ var MLeafComponent = function(props) {
408
408
  style.fontStyle = 'italic';
409
409
  }
410
410
  if (leaf.html) {
411
- prefixClassName = classNames(prefixClassName, mdEditorBaseClass + '-m-html');
411
+ prefixClassName = classNames(mdEditorBaseClass + '-m-html');
412
412
  }
413
413
  if (leaf.current) {
414
414
  style.background = '#f59e0b';
@@ -430,12 +430,11 @@ var MLeafComponent = function(props) {
430
430
  var hasFnc = leaf.fnc || leaf.identifier || leaf.fnd;
431
431
  var hasComment = !!leaf.comment;
432
432
  if (hasFnc) {
433
- var baseClassName = classNames(prefixClassName === null || prefixClassName === void 0 ? void 0 : prefixClassName.trim());
434
433
  var fncDom = /*#__PURE__*/ React.createElement(FncLeaf, _object_spread_props(_object_spread({}, props), {
435
434
  fncProps: props.fncProps,
436
435
  linkConfig: props.linkConfig,
437
436
  style: style,
438
- prefixClassName: baseClassName
437
+ prefixClassName: prefixClassName
439
438
  }));
440
439
  // 如果有评论,使用 CommentLeaf 包裹 fnc DOM
441
440
  if (hasComment) {
@@ -446,7 +445,6 @@ var MLeafComponent = function(props) {
446
445
  }
447
446
  return fncDom;
448
447
  }
449
- var baseClassName1 = classNames(prefixClassName === null || prefixClassName === void 0 ? void 0 : prefixClassName.trim());
450
448
  var dom = /*#__PURE__*/ React.createElement("span", _object_spread_props(_object_spread({}, props.attributes), {
451
449
  "data-be": "text",
452
450
  draggable: false,
@@ -472,8 +470,8 @@ var MLeafComponent = function(props) {
472
470
  },
473
471
  "data-comment": leaf.comment ? 'comment' : undefined,
474
472
  "data-url": leaf.url ? 'url' : undefined,
475
- className: baseClassName1 ? baseClassName1 : undefined,
476
- style: style
473
+ style: style,
474
+ className: (prefixClassName === null || prefixClassName === void 0 ? void 0 : prefixClassName.trim()) ? prefixClassName === null || prefixClassName === void 0 ? void 0 : prefixClassName.trim() : undefined
477
475
  }), children);
478
476
  // 如果有评论,使用 CommentLeaf 包裹普通 DOM
479
477
  if (hasComment) {
@@ -35,6 +35,11 @@ function _object_spread(target) {
35
35
  */ export var applyContextPropsAndConfig = function(el, contextProps, config) {
36
36
  var hasContextProps = Object.keys(contextProps || {}).length > 0;
37
37
  var hasConfig = Object.keys(config || {}).length > 0;
38
+ var resolveAlign = function(item, res) {
39
+ var _ref, _ref1, _ref2;
40
+ var _res_otherProps, _item_otherProps;
41
+ return (_ref = (_ref1 = (_ref2 = config === null || config === void 0 ? void 0 : config.align) !== null && _ref2 !== void 0 ? _ref2 : (_res_otherProps = res.otherProps) === null || _res_otherProps === void 0 ? void 0 : _res_otherProps.align) !== null && _ref1 !== void 0 ? _ref1 : (_item_otherProps = item.otherProps) === null || _item_otherProps === void 0 ? void 0 : _item_otherProps.align) !== null && _ref !== void 0 ? _ref : item.align;
42
+ };
38
43
  if (Array.isArray(el)) {
39
44
  return el.map(function(item) {
40
45
  var result = _object_spread({}, item);
@@ -44,6 +49,10 @@ function _object_spread(target) {
44
49
  if (hasConfig && !item.otherProps) {
45
50
  result.otherProps = config;
46
51
  }
52
+ var alignVal = resolveAlign(item, result);
53
+ if (alignVal && (result.type === 'paragraph' || result.type === 'head')) {
54
+ result.align = alignVal;
55
+ }
47
56
  return result;
48
57
  });
49
58
  }
@@ -54,5 +63,9 @@ function _object_spread(target) {
54
63
  if (hasConfig && !el.otherProps) {
55
64
  result.otherProps = config;
56
65
  }
66
+ var alignVal = resolveAlign(el, result);
67
+ if (alignVal && (result.type === 'paragraph' || result.type === 'head')) {
68
+ result.align = alignVal;
69
+ }
57
70
  return result;
58
71
  };
@@ -23,6 +23,12 @@ export declare const STANDARD_HTML_ELEMENTS: Set<string>;
23
23
  * @returns 是否为标准 HTML 元素
24
24
  */
25
25
  export declare function isStandardHtmlElement(htmlString: string): boolean;
26
+ /**
27
+ * 解析 Markdown 得到 schema 的回调,用于 <p align> 内部解析
28
+ */
29
+ type ParseMarkdownFn = (md: string) => {
30
+ schema: any[];
31
+ };
26
32
  /**
27
33
  * 查找附件链接
28
34
  */
@@ -35,9 +41,10 @@ export declare const findAttachment: (str: string) => {
35
41
  * @param currentElement - 当前处理的HTML元素
36
42
  * @param parent - 父级元素,用于判断上下文
37
43
  * @param htmlTag - HTML标签栈,用于跟踪嵌套的HTML标签
44
+ * @param parseMarkdownFn - 可选,解析 Markdown 得到 schema,用于 <p align> 内部按 Markdown 解析(如 ** 加粗)
38
45
  * @returns 返回包含解析后元素和上下文属性的对象
39
46
  */
40
- export declare const handleHtml: (currentElement: any, parent: any, htmlTag: any[]) => {
47
+ export declare const handleHtml: (currentElement: any, parent: any, htmlTag: any[], parseMarkdownFn?: ParseMarkdownFn) => {
41
48
  el: any;
42
49
  contextProps: any;
43
50
  htmlTag: any[];
@@ -61,3 +68,4 @@ export declare function preprocessThinkTags(markdown: string): string;
61
68
  * @returns 处理后的 Markdown 字符串
62
69
  */
63
70
  export declare function preprocessNonStandardHtmlTags(markdown: string): string;
71
+ export {};
@@ -429,7 +429,7 @@ import partialJsonParse from "../json-parse";
429
429
  };
430
430
  /**
431
431
  * 处理块级 HTML 元素
432
- */ var handleBlockHtml = function(currentElement, processedValue, isUnclosedComment) {
432
+ */ var handleBlockHtml = function(currentElement, processedValue, isUnclosedComment, parseMarkdownFn) {
433
433
  var thinkElement = findThinkElement(currentElement.value);
434
434
  if (thinkElement) {
435
435
  return {
@@ -501,6 +501,41 @@ import partialJsonParse from "../json-parse";
501
501
  }
502
502
  }
503
503
  if (isComment || isStandardHtmlElement(commentValue)) {
504
+ // 优先处理 <p align="...">:将内部按 Markdown 解析以支持 ** 加粗等,保留 <p> 输出(不用注释)
505
+ var pAlignMatch = commentValue.match(/<p\s+align="(left|right|center|justify)"[^>]*>([\s\S]*?)<\/p\s*>/i);
506
+ if (pAlignMatch && parseMarkdownFn) {
507
+ var align = pAlignMatch[1].toLowerCase();
508
+ var schema = parseMarkdownFn(pAlignMatch[2]).schema;
509
+ var first = schema === null || schema === void 0 ? void 0 : schema[0];
510
+ if ((first === null || first === void 0 ? void 0 : first.type) === 'paragraph' && first.children) {
511
+ return _object_spread_props(_object_spread({}, first), {
512
+ align: align,
513
+ otherProps: {
514
+ align: align
515
+ }
516
+ });
517
+ }
518
+ if (first === null || first === void 0 ? void 0 : first.children) {
519
+ return _object_spread_props(_object_spread({}, first), {
520
+ align: align,
521
+ otherProps: {
522
+ align: align
523
+ }
524
+ });
525
+ }
526
+ return {
527
+ type: 'paragraph',
528
+ align: align,
529
+ children: [
530
+ {
531
+ text: pAlignMatch[2].trim() || ''
532
+ }
533
+ ],
534
+ otherProps: {
535
+ align: align
536
+ }
537
+ };
538
+ }
504
539
  if (commentValue.match(/<\/?(table|div|ul|li|ol|p|strong|h1|h2|h3|h4|h5|h6)[^\n>]*?>/)) {
505
540
  return htmlToFragmentList(commentValue, '');
506
541
  }
@@ -715,8 +750,9 @@ import partialJsonParse from "../json-parse";
715
750
  * @param currentElement - 当前处理的HTML元素
716
751
  * @param parent - 父级元素,用于判断上下文
717
752
  * @param htmlTag - HTML标签栈,用于跟踪嵌套的HTML标签
753
+ * @param parseMarkdownFn - 可选,解析 Markdown 得到 schema,用于 <p align> 内部按 Markdown 解析(如 ** 加粗)
718
754
  * @returns 返回包含解析后元素和上下文属性的对象
719
- */ export var handleHtml = function(currentElement, parent, htmlTag) {
755
+ */ export var handleHtml = function(currentElement, parent, htmlTag, parseMarkdownFn) {
720
756
  var _currentElement_value;
721
757
  var trimmedValue = (currentElement === null || currentElement === void 0 ? void 0 : (_currentElement_value = currentElement.value) === null || _currentElement_value === void 0 ? void 0 : _currentElement_value.trim()) || '';
722
758
  var isUnclosedComment = trimmedValue.startsWith('<!--') && !trimmedValue.endsWith('-->');
@@ -750,7 +786,7 @@ import partialJsonParse from "../json-parse";
750
786
  var el;
751
787
  var updatedHtmlTag = htmlTag;
752
788
  if (isBlockLevel) {
753
- el = handleBlockHtml(currentElement, processedValue, isUnclosedComment);
789
+ el = handleBlockHtml(currentElement, processedValue, isUnclosedComment, parseMarkdownFn);
754
790
  } else {
755
791
  var inlineResult = processInlineHtml(currentElement, htmlTag);
756
792
  el = inlineResult.el;
@@ -225,7 +225,7 @@ var removeAnswerTags = function(text) {
225
225
  * @returns 一个包含解析后的元素数组和链接信息的对象
226
226
  */ key: "parse",
227
227
  value: function parse(md) {
228
- // 先预处理 <think> 标签,然后预处理其他非标准 HTML 标签,最后处理表格换行
228
+ // 先预处理 <think> 标签,然后预处理其他非标准 HTML 标签、<p align>,最后处理表格换行
229
229
  var thinkProcessed = removeAnswerTags(preprocessThinkTags(md || ''));
230
230
  var nonStandardProcessed = removeAnswerTags(preprocessNonStandardHtmlTags(thinkProcessed));
231
231
  // parse() 只执行 parser,需要 runSync() 来执行 transformer 插件
@@ -511,7 +511,11 @@ var removeAnswerTags = function(text) {
511
511
  var elementHandlers = this.getElementHandlers();
512
512
  var handlerInfo = elementHandlers[elementType];
513
513
  if (handlerInfo === null || handlerInfo === void 0 ? void 0 : handlerInfo.needsHtmlResult) {
514
- var htmlResult = handleHtml(currentElement, parent, htmlTag);
514
+ var htmlResult = handleHtml(currentElement, parent, htmlTag, function(md) {
515
+ return {
516
+ schema: _this.parse(md).schema
517
+ };
518
+ });
515
519
  var result = {
516
520
  el: htmlResult.el
517
521
  };
@@ -366,6 +366,10 @@ var inlineNode = new Set([
366
366
  delete configProps['columns'];
367
367
  delete configProps['dataSource'];
368
368
  delete configProps['finished'];
369
+ // paragraph/head 的 align 已输出到 <p align> / <h align>,不再写入注释
370
+ if (node.type === 'paragraph' || node.type === 'head') {
371
+ delete configProps['align'];
372
+ }
369
373
  if (node.type === 'link-card') {
370
374
  configProps.type = 'card';
371
375
  configProps.url = encodeURI(node === null || node === void 0 ? void 0 : node.url);
@@ -1087,15 +1091,17 @@ export var isMix = function(t) {
1087
1091
  * @param plugins - 可选的插件数组
1088
1092
  * @returns 处理后的 Markdown 字符串
1089
1093
  */ var handleParagraph = function(node, preString, parent, plugins) {
1094
+ var _node_align;
1095
+ var _node_otherProps;
1090
1096
  var str = '';
1091
- // 如果有对齐属性,使用 HTML 标签包裹以支持对齐
1092
- if (node.align) {
1097
+ // 如果有对齐属性,使用 HTML 标签包裹以支持对齐(兼容 align 在 otherProps 的情况)
1098
+ var align = (_node_align = node.align) !== null && _node_align !== void 0 ? _node_align : (_node_otherProps = node.otherProps) === null || _node_otherProps === void 0 ? void 0 : _node_otherProps.align;
1099
+ if (align) {
1093
1100
  // 递归处理子节点
1094
1101
  var content = parserSlateNodeToMarkdown(node === null || node === void 0 ? void 0 : node.children, '', _to_consumable_array(parent).concat([
1095
1102
  node
1096
1103
  ]), plugins);
1097
- // 使用 p 标签并添加 align 属性
1098
- return '<p align="'.concat(node.align, '">').concat(content, "</p>");
1104
+ return '<p align="'.concat(align, '">').concat(content, "</p>");
1099
1105
  }
1100
1106
  str += parserSlateNodeToMarkdown(node === null || node === void 0 ? void 0 : node.children, preString, _to_consumable_array(parent).concat([
1101
1107
  node
@@ -1110,15 +1116,17 @@ export var isMix = function(t) {
1110
1116
  * @param plugins - 可选的插件数组
1111
1117
  * @returns 处理后的 Markdown 标题字符串
1112
1118
  */ var handleHead = function(node, preString, parent, plugins) {
1119
+ var _node_align;
1120
+ var _node_otherProps;
1113
1121
  var str = '';
1114
- // 如果有对齐属性,使用 HTML 标签包裹以支持对齐
1115
- if (node.align) {
1122
+ // 如果有对齐属性,使用 HTML 标签包裹以支持对齐(兼容 align 在 otherProps 的情况)
1123
+ var align = (_node_align = node.align) !== null && _node_align !== void 0 ? _node_align : (_node_otherProps = node.otherProps) === null || _node_otherProps === void 0 ? void 0 : _node_otherProps.align;
1124
+ if (align) {
1116
1125
  // 递归处理子节点
1117
1126
  var content = parserSlateNodeToMarkdown(node === null || node === void 0 ? void 0 : node.children, '', _to_consumable_array(parent).concat([
1118
1127
  node
1119
1128
  ]), plugins);
1120
- // 使用 h 标签并添加 align 属性
1121
- return "<h".concat(node.level, ' align="').concat(node.align, '">').concat(content, "</h").concat(node.level, ">");
1129
+ return "<h".concat(node.level, ' align="').concat(align, '">').concat(content, "</h").concat(node.level, ">");
1122
1130
  }
1123
1131
  str += '#'.repeat(node.level) + ' ' + parserSlateNodeToMarkdown(node === null || node === void 0 ? void 0 : node.children, preString, _to_consumable_array(parent).concat([
1124
1132
  node
@@ -639,14 +639,35 @@ var blobToFile = function(blobUrl, fileName) {
639
639
  });
640
640
  })();
641
641
  };
642
+ /**
643
+ * 从片段列表中递归移除所有媒体类型的片段(图片、视频、音频等)
644
+ */ var removeMediaFragments = function(fragments) {
645
+ for(var i = fragments.length - 1; i >= 0; i--){
646
+ var fragment = fragments[i];
647
+ if (fragment.type === 'media') {
648
+ fragments.splice(i, 1);
649
+ continue;
650
+ }
651
+ if (fragment === null || fragment === void 0 ? void 0 : fragment.children) {
652
+ removeMediaFragments(fragment.children);
653
+ }
654
+ }
655
+ };
642
656
  /**
643
657
  * 分段处理文件上传,避免阻塞主线程
644
658
  */ var upLoadFileBatch = function(fragmentList, editorProps) {
645
659
  return _async_to_generator(function() {
646
- var mediaFragments, collectMediaFragments, hideLoading, i, batch, progress, error;
660
+ var _editorProps_image, mediaFragments, collectMediaFragments, hideLoading, i, batch, progress, error;
647
661
  return _ts_generator(this, function(_state) {
648
662
  switch(_state.label){
649
663
  case 0:
664
+ // 如果没有配置 upload,过滤掉所有媒体类型的片段
665
+ if (!((_editorProps_image = editorProps.image) === null || _editorProps_image === void 0 ? void 0 : _editorProps_image.upload)) {
666
+ removeMediaFragments(fragmentList);
667
+ return [
668
+ 2
669
+ ];
670
+ }
650
671
  mediaFragments = [];
651
672
  // 收集所有需要上传的媒体文件
652
673
  collectMediaFragments = function(fragments) {
@@ -53,9 +53,8 @@ function _unsupported_iterable_to_array(o, minLen) {
53
53
  }
54
54
  import { ChevronDown } from "@sofa-design/icons";
55
55
  import { Button, ConfigProvider, Dropdown, Segmented } from "antd";
56
- import React, { useContext, useMemo, useRef } from "react";
56
+ import React, { useContext } from "react";
57
57
  import { I18nContext } from "../../../../I18n";
58
- import { debounce } from "../../utils";
59
58
  import { useStyle } from "./style";
60
59
  var ChartFilterComponent = function(param) {
61
60
  var filterOptions = param.filterOptions, selectedFilter = param.selectedFilter, onFilterChange = param.onFilterChange, customOptions = param.customOptions, selectedCustomSelection = param.selectedCustomSelection, onSelectionChange = param.onSelectionChange, _param_className = param.className, className = _param_className === void 0 ? '' : _param_className, classNamesProp = param.classNames, style = param.style, styles = param.styles, _param_theme = param.theme, theme = _param_theme === void 0 ? 'light' : _param_theme, _param_variant = param.variant, variant = _param_variant === void 0 ? 'default' : _param_variant;
@@ -65,48 +64,15 @@ var ChartFilterComponent = function(param) {
65
64
  var i18n = useContext(I18nContext);
66
65
  var prefixCls = getPrefixCls('chart-filter');
67
66
  var _useStyle = useStyle(prefixCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
68
- // 使用 useRef 保存最新的回调函数,避免防抖函数闭包问题
69
- var onFilterChangeRef = useRef(onFilterChange);
70
- var onSelectionChangeRef = useRef(onSelectionChange);
71
- // 更新 ref,确保总是使用最新的回调
72
- React.useEffect(function() {
73
- onFilterChangeRef.current = onFilterChange;
74
- onSelectionChangeRef.current = onSelectionChange;
75
- }, [
76
- onFilterChange,
77
- onSelectionChange
78
- ]);
79
- // 创建防抖的回调函数,1秒更新一次
80
- var debouncedFilterChange = useMemo(function() {
81
- return debounce(function(value) {
82
- if (onFilterChangeRef.current) {
83
- onFilterChangeRef.current(value);
84
- }
85
- }, 1000);
86
- }, []);
87
- var debouncedSelectionChange = useMemo(function() {
88
- return debounce(function(region) {
89
- if (onSelectionChangeRef.current) {
90
- onSelectionChangeRef.current(region);
91
- }
92
- }, 1000);
93
- }, []);
94
- // 组件卸载时清理防抖函数
95
- React.useEffect(function() {
96
- return function() {
97
- var _debouncedFilterChange_cancel, _debouncedSelectionChange_cancel;
98
- debouncedFilterChange === null || debouncedFilterChange === void 0 ? void 0 : (_debouncedFilterChange_cancel = debouncedFilterChange.cancel) === null || _debouncedFilterChange_cancel === void 0 ? void 0 : _debouncedFilterChange_cancel.call(debouncedFilterChange);
99
- debouncedSelectionChange === null || debouncedSelectionChange === void 0 ? void 0 : (_debouncedSelectionChange_cancel = debouncedSelectionChange.cancel) === null || _debouncedSelectionChange_cancel === void 0 ? void 0 : _debouncedSelectionChange_cancel.call(debouncedSelectionChange);
100
- };
101
- }, [
102
- debouncedFilterChange,
103
- debouncedSelectionChange
104
- ]);
105
67
  var handleRegionChange = function(region) {
106
- debouncedSelectionChange(region);
68
+ if (onSelectionChange) {
69
+ onSelectionChange(region);
70
+ }
107
71
  };
108
72
  var handleFilterChange = function(value) {
109
- debouncedFilterChange(value);
73
+ if (onFilterChange) {
74
+ onFilterChange(value);
75
+ }
110
76
  };
111
77
  var hasMain = Array.isArray(filterOptions) && filterOptions.length > 1;
112
78
  var hasSecondary = Array.isArray(customOptions) && customOptions.length > 1;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  type TaskStatus = 'success' | 'pending' | 'loading' | 'error';
3
3
  type TaskItem = {
4
4
  key: string;
5
- title?: string;
5
+ title?: React.ReactNode;
6
6
  content: React.ReactNode | React.ReactNode[];
7
7
  status: TaskStatus;
8
8
  };
@@ -2,7 +2,7 @@ import React, { type FC } from 'react';
2
2
  type TaskStatus = 'success' | 'pending' | 'loading' | 'error';
3
3
  export interface TaskItem {
4
4
  key: string;
5
- title?: string;
5
+ title?: React.ReactNode;
6
6
  content?: React.ReactNode | React.ReactNode[];
7
7
  status: TaskStatus;
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.29.13",
3
+ "version": "2.29.15",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",
@@ -22,6 +22,7 @@
22
22
  "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
23
23
  "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
24
24
  "prepare": "husky install && dumi setup",
25
+ "prepublishOnly": "father doctor && pnpm run test && pnpm run build",
25
26
  "prettier": "prettier --write \"{src,docs,test}/**/*.{js,jsx,ts,tsx,css,less,json,md}\"",
26
27
  "preview": "pnpm dumi preview",
27
28
  "report:demo": "node scripts/generateDemoReport.js",