@ant-design/agentic-ui 2.0.1 → 2.0.3

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.
@@ -25,18 +25,26 @@ var ButtonTabGroup = ({
25
25
  onChange == null ? void 0 : onChange(key);
26
26
  };
27
27
  return wrapSSR(
28
- /* @__PURE__ */ React.createElement("div", { className: `${prefixCls} ${className || ""} ${hashId}`, role: "group", "aria-label": "Tab group" }, items.map((item) => /* @__PURE__ */ React.createElement(
29
- ButtonTab,
28
+ /* @__PURE__ */ React.createElement(
29
+ "div",
30
30
  {
31
- key: item.key,
32
- selected: currentActiveKey === item.key,
33
- onClick: () => handleTabClick(item.key, item.disabled),
34
- onIconClick: item.onIconClick,
35
- icon: item.icon,
36
- className: item.disabled ? `${prefixCls}-item-disabled` : ""
31
+ className: `${prefixCls} ${className || ""} ${hashId}`,
32
+ role: "group",
33
+ "aria-label": "Tab group"
37
34
  },
38
- item.label
39
- )))
35
+ items.map((item) => /* @__PURE__ */ React.createElement(
36
+ ButtonTab,
37
+ {
38
+ key: item.key,
39
+ selected: currentActiveKey === item.key,
40
+ onClick: () => handleTabClick(item.key, item.disabled),
41
+ onIconClick: item.onIconClick,
42
+ icon: item.icon,
43
+ className: item.disabled ? `${prefixCls}-item-disabled` : ""
44
+ },
45
+ item.label
46
+ ))
47
+ )
40
48
  );
41
49
  };
42
50
  var ButtonTabGroup_default = ButtonTabGroup;
package/dist/index.d.ts CHANGED
@@ -4,8 +4,8 @@ export * from './AgentRunBar';
4
4
  export * from './Bubble';
5
5
  export * from './Bubble/List';
6
6
  export * from './Bubble/type';
7
- export * from './ChatLayout';
8
7
  export * from './ChatBoot';
8
+ export * from './ChatLayout';
9
9
  export * from './components/ActionIconBox';
10
10
  export * from './components/Button';
11
11
  export * from './components/LayoutHeader';
package/dist/index.js CHANGED
@@ -4,8 +4,8 @@ export * from "./AgentRunBar";
4
4
  export * from "./Bubble";
5
5
  export * from "./Bubble/List";
6
6
  export * from "./Bubble/type";
7
- export * from "./ChatLayout";
8
7
  export * from "./ChatBoot";
8
+ export * from "./ChatLayout";
9
9
  export * from "./components/ActionIconBox";
10
10
  export * from "./components/Button";
11
11
  export * from "./components/LayoutHeader";
@@ -57,6 +57,8 @@ export interface AreaChartProps extends ChartContainerProps {
57
57
  hiddenY?: boolean;
58
58
  /** 头部工具条额外按钮 */
59
59
  toolbarExtra?: React.ReactNode;
60
+ /** 是否将过滤器渲染到工具栏 */
61
+ renderFilterInToolbar?: boolean;
60
62
  /** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
61
63
  statistic?: StatisticConfigType;
62
64
  }
@@ -103,6 +103,7 @@ var AreaChart = ({
103
103
  hiddenX = false,
104
104
  hiddenY = false,
105
105
  toolbarExtra,
106
+ renderFilterInToolbar = false,
106
107
  statistic: statisticConfig,
107
108
  variant
108
109
  }) => {
@@ -350,11 +351,26 @@ var AreaChart = ({
350
351
  theme,
351
352
  onDownload: handleDownload,
352
353
  extra: toolbarExtra,
353
- dataTime
354
+ dataTime,
355
+ filter: renderFilterInToolbar && filterOptions && filterOptions.length > 1 ? /* @__PURE__ */ React.createElement(
356
+ ChartFilter,
357
+ __spreadProps(__spreadValues({
358
+ filterOptions,
359
+ selectedFilter,
360
+ onFilterChange: setSelectedFilter
361
+ }, filterLabels && {
362
+ customOptions: filteredDataByFilterLabel,
363
+ selectedCustomSelection: selectedFilterLabel,
364
+ onSelectionChange: setSelectedFilterLabel
365
+ }), {
366
+ theme,
367
+ variant: "compact"
368
+ })
369
+ ) : void 0
354
370
  }
355
371
  ),
356
372
  statisticComponentConfigs && /* @__PURE__ */ React.createElement("div", { className: "chart-statistic-container" }, statisticComponentConfigs.map((config, index) => /* @__PURE__ */ React.createElement(ChartStatistic, __spreadProps(__spreadValues({ key: index }, config), { theme })))),
357
- /* @__PURE__ */ React.createElement(
373
+ !renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
358
374
  ChartFilter,
359
375
  __spreadProps(__spreadValues({
360
376
  filterOptions,
@@ -66,6 +66,8 @@ export interface BarChartProps extends ChartContainerProps {
66
66
  indexAxis?: 'x' | 'y';
67
67
  /** 头部工具条额外按钮 */
68
68
  toolbarExtra?: React.ReactNode;
69
+ /** 是否将过滤器渲染到工具栏 */
70
+ renderFilterInToolbar?: boolean;
69
71
  /** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
70
72
  statistic?: StatisticConfigType;
71
73
  /** 是否显示数据标签,默认false */
@@ -87,6 +87,7 @@ var BarChart = ({
87
87
  stacked = false,
88
88
  indexAxis = "x",
89
89
  toolbarExtra,
90
+ renderFilterInToolbar = false,
90
91
  statistic: statisticConfig,
91
92
  variant,
92
93
  showDataLabels = false,
@@ -387,7 +388,9 @@ var BarChart = ({
387
388
  const dsIndex = context2.datasetIndex;
388
389
  const dIndex = context2.dataIndex;
389
390
  const currentStack = (_b = (_a = chart.data.datasets) == null ? void 0 : _a[dsIndex]) == null ? void 0 : _b.stack;
390
- const currentValue = Number((_f = (_e = (_d = (_c = chart.data.datasets) == null ? void 0 : _c[dsIndex]) == null ? void 0 : _d.data) == null ? void 0 : _e[dIndex]) != null ? _f : 0);
391
+ const currentValue = Number(
392
+ (_f = (_e = (_d = (_c = chart.data.datasets) == null ? void 0 : _c[dsIndex]) == null ? void 0 : _d.data) == null ? void 0 : _e[dIndex]) != null ? _f : 0
393
+ );
391
394
  const sameStackIndexes = chart.data.datasets.map((_, i) => i).filter((i) => {
392
395
  var _a2, _b2, _c2;
393
396
  const ds = (_a2 = chart.data.datasets) == null ? void 0 : _a2[i];
@@ -423,7 +426,9 @@ var BarChart = ({
423
426
  if (stacked) {
424
427
  const chart = context2.chart;
425
428
  const datasets = chart.data.datasets;
426
- const currentValue = Number((_d = (_c = (_b = datasets == null ? void 0 : datasets[datasetIndex]) == null ? void 0 : _b.data) == null ? void 0 : _c[dataIndex]) != null ? _d : 0);
429
+ const currentValue = Number(
430
+ (_d = (_c = (_b = datasets == null ? void 0 : datasets[datasetIndex]) == null ? void 0 : _b.data) == null ? void 0 : _c[dataIndex]) != null ? _d : 0
431
+ );
427
432
  const currentStack = (_e = datasets == null ? void 0 : datasets[datasetIndex]) == null ? void 0 : _e.stack;
428
433
  let total = 0;
429
434
  datasets.forEach((dataset, i) => {
@@ -544,11 +549,26 @@ var BarChart = ({
544
549
  theme,
545
550
  onDownload: handleDownload,
546
551
  extra: toolbarExtra,
547
- dataTime
552
+ dataTime,
553
+ filter: renderFilterInToolbar && filterOptions && filterOptions.length > 1 ? /* @__PURE__ */ React.createElement(
554
+ ChartFilter,
555
+ __spreadProps(__spreadValues({
556
+ filterOptions,
557
+ selectedFilter,
558
+ onFilterChange: setSelectedFilter
559
+ }, filterLabels && {
560
+ customOptions: filteredDataByFilterLabel,
561
+ selectedCustomSelection: selectedFilterLabel,
562
+ onSelectionChange: setSelectedFilterLabel
563
+ }), {
564
+ theme,
565
+ variant: "compact"
566
+ })
567
+ ) : void 0
548
568
  }
549
569
  ),
550
570
  statisticComponentConfigs && /* @__PURE__ */ React.createElement("div", { className: "chart-statistic-container" }, statisticComponentConfigs.map((config, index) => /* @__PURE__ */ React.createElement(ChartStatistic, __spreadProps(__spreadValues({ key: index }, config), { theme })))),
551
- /* @__PURE__ */ React.createElement(
571
+ !renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
552
572
  ChartFilter,
553
573
  __spreadProps(__spreadValues({
554
574
  filterOptions,
@@ -44,6 +44,8 @@ export interface FunnelChartProps extends ChartContainerProps {
44
44
  showPercent?: boolean;
45
45
  /** 头部工具条额外按钮 */
46
46
  toolbarExtra?: React.ReactNode;
47
+ /** 是否将过滤器渲染到工具栏 */
48
+ renderFilterInToolbar?: boolean;
47
49
  typeNames?: {
48
50
  rate?: string;
49
51
  /** 类型名称,用于图例和数据集标签 */
@@ -70,6 +70,7 @@ var FunnelChart = (_a) => {
70
70
  legendAlign = "start",
71
71
  showPercent = true,
72
72
  toolbarExtra,
73
+ renderFilterInToolbar = false,
73
74
  typeNames,
74
75
  statistic
75
76
  } = _b, props = __objRest(_b, [
@@ -86,6 +87,7 @@ var FunnelChart = (_a) => {
86
87
  "legendAlign",
87
88
  "showPercent",
88
89
  "toolbarExtra",
90
+ "renderFilterInToolbar",
89
91
  "typeNames",
90
92
  "statistic"
91
93
  ]);
@@ -552,10 +554,25 @@ var FunnelChart = (_a) => {
552
554
  theme,
553
555
  onDownload: handleDownload,
554
556
  dataTime,
555
- extra: toolbarExtra
557
+ extra: toolbarExtra,
558
+ filter: renderFilterInToolbar && filterOptions && filterOptions.length > 1 ? /* @__PURE__ */ React.createElement(
559
+ ChartFilter,
560
+ __spreadProps(__spreadValues({
561
+ filterOptions,
562
+ selectedFilter,
563
+ onFilterChange: setSelectedFilter
564
+ }, customOptions && {
565
+ customOptions,
566
+ selectedCustomSelection: selectedFilterLabel,
567
+ onSelectionChange: setSelectedFilterLabel
568
+ }), {
569
+ theme,
570
+ variant: "compact"
571
+ })
572
+ ) : void 0
556
573
  }
557
574
  ),
558
- /* @__PURE__ */ React.createElement(
575
+ !renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
559
576
  ChartFilter,
560
577
  __spreadProps(__spreadValues({
561
578
  filterOptions,
@@ -57,6 +57,8 @@ export interface LineChartProps extends ChartContainerProps {
57
57
  hiddenY?: boolean;
58
58
  /** 头部工具条额外按钮 */
59
59
  toolbarExtra?: React.ReactNode;
60
+ /** 是否将过滤器渲染到工具栏 */
61
+ renderFilterInToolbar?: boolean;
60
62
  /** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
61
63
  statistic?: StatisticConfigType;
62
64
  }
@@ -98,6 +98,7 @@ var LineChart = (_a) => {
98
98
  hiddenX = false,
99
99
  hiddenY = false,
100
100
  toolbarExtra,
101
+ renderFilterInToolbar = false,
101
102
  statistic: statisticConfig
102
103
  } = _b, props = __objRest(_b, [
103
104
  "title",
@@ -117,6 +118,7 @@ var LineChart = (_a) => {
117
118
  "hiddenX",
118
119
  "hiddenY",
119
120
  "toolbarExtra",
121
+ "renderFilterInToolbar",
120
122
  "statistic"
121
123
  ]);
122
124
  const safeData = Array.isArray(data) ? data : [];
@@ -352,11 +354,26 @@ var LineChart = (_a) => {
352
354
  theme,
353
355
  onDownload: handleDownload,
354
356
  extra: toolbarExtra,
355
- dataTime
357
+ dataTime,
358
+ filter: renderFilterInToolbar && filterOptions && filterOptions.length > 1 ? /* @__PURE__ */ React.createElement(
359
+ ChartFilter,
360
+ __spreadProps(__spreadValues({
361
+ filterOptions,
362
+ selectedFilter,
363
+ onFilterChange: setSelectedFilter
364
+ }, filterLabels && {
365
+ customOptions: filteredDataByFilterLabel,
366
+ selectedCustomSelection: selectedFilterLabel,
367
+ onSelectionChange: setSelectedFilterLabel
368
+ }), {
369
+ theme,
370
+ variant: "compact"
371
+ })
372
+ ) : void 0
356
373
  }
357
374
  ),
358
375
  statisticComponentConfigs && /* @__PURE__ */ React.createElement("div", { className: "chart-statistic-container" }, statisticComponentConfigs.map((config, index) => /* @__PURE__ */ React.createElement(ChartStatistic, __spreadProps(__spreadValues({ key: index }, config), { theme })))),
359
- /* @__PURE__ */ React.createElement(
376
+ !renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
360
377
  ChartFilter,
361
378
  __spreadProps(__spreadValues({
362
379
  filterOptions,
@@ -15,6 +15,8 @@ interface RadarChartProps extends ChartContainerProps {
15
15
  height?: number | string;
16
16
  className?: string;
17
17
  toolbarExtra?: React.ReactNode;
18
+ /** 是否将过滤器渲染到工具栏 */
19
+ renderFilterInToolbar?: boolean;
18
20
  dataTime?: string;
19
21
  borderColor?: string;
20
22
  backgroundColor?: string;
@@ -93,6 +93,7 @@ var RadarChart = (_a) => {
93
93
  height = 400,
94
94
  className,
95
95
  toolbarExtra,
96
+ renderFilterInToolbar = false,
96
97
  dataTime,
97
98
  borderColor,
98
99
  backgroundColor,
@@ -106,6 +107,7 @@ var RadarChart = (_a) => {
106
107
  "height",
107
108
  "className",
108
109
  "toolbarExtra",
110
+ "renderFilterInToolbar",
109
111
  "dataTime",
110
112
  "borderColor",
111
113
  "backgroundColor",
@@ -531,10 +533,25 @@ var RadarChart = (_a) => {
531
533
  title: title || "雷达图",
532
534
  onDownload: handleDownload,
533
535
  extra: toolbarExtra,
534
- dataTime
536
+ dataTime,
537
+ filter: renderFilterInToolbar && filterEnum.length > 0 ? /* @__PURE__ */ React.createElement(
538
+ ChartFilter,
539
+ __spreadProps(__spreadValues({
540
+ filterOptions: filterEnum,
541
+ selectedFilter,
542
+ onFilterChange: setSelectedFilter
543
+ }, filterLabels && {
544
+ customOptions: filteredDataByFilterLabel,
545
+ selectedCustomSelection: selectedFilterLabel,
546
+ onSelectionChange: setSelectedFilterLabel
547
+ }), {
548
+ theme: currentConfig.theme,
549
+ variant: "compact"
550
+ })
551
+ ) : void 0
535
552
  }
536
553
  ),
537
- filterEnum.length > 0 && /* @__PURE__ */ React.createElement(
554
+ !renderFilterInToolbar && filterEnum.length > 0 && /* @__PURE__ */ React.createElement(
538
555
  ChartFilter,
539
556
  __spreadProps(__spreadValues({
540
557
  filterOptions: filterEnum,
@@ -15,6 +15,8 @@ export interface ScatterChartProps extends ChartContainerProps {
15
15
  height?: number | string;
16
16
  className?: string;
17
17
  toolbarExtra?: React.ReactNode;
18
+ /** 是否将过滤器渲染到工具栏 */
19
+ renderFilterInToolbar?: boolean;
18
20
  dataTime?: string;
19
21
  xUnit?: string;
20
22
  yUnit?: string;
@@ -75,6 +75,7 @@ var ScatterChart = (_a) => {
75
75
  className,
76
76
  title,
77
77
  toolbarExtra,
78
+ renderFilterInToolbar = false,
78
79
  dataTime,
79
80
  xUnit = "月",
80
81
  yUnit,
@@ -93,6 +94,7 @@ var ScatterChart = (_a) => {
93
94
  "className",
94
95
  "title",
95
96
  "toolbarExtra",
97
+ "renderFilterInToolbar",
96
98
  "dataTime",
97
99
  "xUnit",
98
100
  "yUnit",
@@ -567,10 +569,25 @@ var ScatterChart = (_a) => {
567
569
  title: title || "散点图",
568
570
  onDownload: handleDownload,
569
571
  extra: toolbarExtra,
570
- dataTime
572
+ dataTime,
573
+ filter: renderFilterInToolbar && filterEnum.length > 0 ? /* @__PURE__ */ React.createElement(
574
+ ChartFilter,
575
+ __spreadProps(__spreadValues({
576
+ filterOptions: filterEnum,
577
+ selectedFilter,
578
+ onFilterChange: setSelectedFilter
579
+ }, filterLabels && {
580
+ customOptions: filteredDataByFilterLabel,
581
+ selectedCustomSelection: selectedFilterLabel,
582
+ onSelectionChange: setSelectedFilterLabel
583
+ }), {
584
+ theme: currentConfig.theme,
585
+ variant: "compact"
586
+ })
587
+ ) : void 0
571
588
  }
572
589
  ),
573
- filterEnum.length > 0 && /* @__PURE__ */ React.createElement(
590
+ !renderFilterInToolbar && filterEnum.length > 0 && /* @__PURE__ */ React.createElement(
574
591
  ChartFilter,
575
592
  __spreadProps(__spreadValues({
576
593
  filterOptions: filterEnum,
@@ -16,6 +16,7 @@ export interface ChartFilterProps {
16
16
  onSelectionChange?: (region: string) => void;
17
17
  className?: string;
18
18
  theme?: 'light' | 'dark';
19
+ variant?: 'default' | 'compact';
19
20
  }
20
21
  declare const ChartFilter: React.FC<ChartFilterProps>;
21
22
  export default ChartFilter;
@@ -13,7 +13,8 @@ var ChartFilter = ({
13
13
  selectedCustomSelection,
14
14
  onSelectionChange,
15
15
  className = "",
16
- theme = "light"
16
+ theme = "light",
17
+ variant = "default"
17
18
  }) => {
18
19
  var _a, _b;
19
20
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
@@ -40,6 +41,7 @@ var ChartFilter = ({
40
41
  className: classNames(
41
42
  prefixCls,
42
43
  `${prefixCls}-${theme}`,
44
+ `${prefixCls}-${variant}`,
43
45
  hashId,
44
46
  className
45
47
  )
@@ -144,6 +144,11 @@ var genStyle = (token) => {
144
144
  }
145
145
  }
146
146
  }
147
+ },
148
+ // Compact variant for toolbar integration
149
+ "&-compact": {
150
+ padding: "0",
151
+ flexWrap: "nowrap"
147
152
  }
148
153
  }
149
154
  };
@@ -6,6 +6,7 @@ export interface ChartToolBarProps {
6
6
  theme?: 'light' | 'dark';
7
7
  onDownload?: () => void;
8
8
  extra?: React.ReactNode;
9
+ filter?: React.ReactNode;
9
10
  }
10
11
  declare const ChartToolBar: React.FC<ChartToolBarProps>;
11
12
  export default ChartToolBar;
@@ -12,7 +12,8 @@ var ChartToolBar = ({
12
12
  className = "",
13
13
  theme = "light",
14
14
  onDownload,
15
- extra
15
+ extra,
16
+ filter
16
17
  }) => {
17
18
  var _a, _b;
18
19
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
@@ -44,7 +45,7 @@ var ChartToolBar = ({
44
45
  {
45
46
  className: classNames(`${prefixCls}-time-icon`, hashId)
46
47
  }
47
- ), /* @__PURE__ */ React.createElement("span", { className: classNames(`${prefixCls}-data-time`, hashId) }, ((_a = i18n == null ? void 0 : i18n.locale) == null ? void 0 : _a.dataTime) || "数据时间", ": ", dataTime)) : null, extra, handleDownload ? /* @__PURE__ */ React.createElement(
48
+ ), /* @__PURE__ */ React.createElement("span", { className: classNames(`${prefixCls}-data-time`, hashId) }, ((_a = i18n == null ? void 0 : i18n.locale) == null ? void 0 : _a.dataTime) || "数据时间", ": ", dataTime)) : null, filter, extra, handleDownload ? /* @__PURE__ */ React.createElement(
48
49
  Tooltip,
49
50
  {
50
51
  mouseEnterDelay: 0.3,
@@ -88,6 +88,9 @@ var MarkdownFormatter = class {
88
88
  static format(text) {
89
89
  const codeBlocks = {};
90
90
  let counter = 0;
91
+ if (!text) {
92
+ return "";
93
+ }
91
94
  const textWithoutCodeBlocks = text == null ? void 0 : text.replace(/```[\s\S]*?```/g, (match) => {
92
95
  const placeholder = `__CODEBLOCK_${counter}__`;
93
96
  codeBlocks[placeholder] = match;
@@ -101,7 +104,7 @@ var MarkdownFormatter = class {
101
104
  Object.entries(codeBlocks).forEach(([placeholder, original]) => {
102
105
  result = result == null ? void 0 : result.replace(placeholder, original);
103
106
  });
104
- return result;
107
+ return result || "";
105
108
  }
106
109
  };
107
110
  var formatter_default = MarkdownFormatter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",