@alifd/chat 0.3.33-beta.0 → 0.3.33-beta.10

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.
@@ -7,14 +7,38 @@
7
7
 
8
8
  &-group {
9
9
  .single-button {
10
- flex: 1 0 calc(33.33% - 6px); /* 每个按钮占据33.33%的宽度减去左右各3px的间隔(总共6px)来保证每行三个 */
10
+ flex: 1 0 calc(50% - 3px); // 修改为50%宽度,每个按钮间隔6px,所以是3px
11
11
  text-align: center;
12
- margin-right: 6px;
12
+ margin-right: 6px;
13
13
  max-width: 100%;
14
14
  overflow: hidden;
15
- &:last-child{
16
- margin-right: 0px;
15
+
16
+ &:nth-child(n+3) {
17
+ margin-top: 8px;
18
+ }
19
+
20
+ // 使用nth-child选择器处理偶数按钮的右边距
21
+ &:nth-child(2n) {
22
+ margin-right: 0;
17
23
  }
24
+
25
+ // 最后一个按钮不需要右边距
26
+ &:last-child {
27
+ margin-right: 0;
28
+ }
29
+
30
+ // 当按钮数量小于等于3个时,恢复为三等分布局
31
+ &:first-child:nth-last-child(-n+3),
32
+ &:first-child:nth-last-child(-n+3) ~ .single-button {
33
+ flex: 1 0 calc(33.33% - 6px);
34
+ margin-top: 0;
35
+
36
+ // 重置偶数按钮的右边距规则
37
+ &:nth-child(2n) {
38
+ margin-right: 6px;
39
+ }
40
+ }
41
+
18
42
  .next-btn-helper {
19
43
  max-width: 100%;
20
44
  overflow: hidden;
@@ -50,12 +74,12 @@
50
74
  }
51
75
  }
52
76
  }
53
-
77
+
54
78
  &.sub {
55
79
  .single-button {
56
80
  max-width: calc(50% - 6px);
57
81
  margin-bottom: 0;
58
- }
82
+ }
59
83
  @media (max-width: 600px) {
60
84
  display: block;
61
85
  }
@@ -11,13 +11,13 @@ import { Drawer as NextDrawer, ConfigProvider } from '@alifd/next';
11
11
  import cs from 'classnames';
12
12
  import { PREFIX_DEFAULT, assignSubComponent } from '../utils';
13
13
  const Drawer = forwardRef((_a, ref) => {
14
- var { className, headerStyle, children, footer, footerClassName } = _a, props = __rest(_a, ["className", "headerStyle", "children", "footer", "footerClassName"]);
14
+ var { className, headerStyle, children, footer, footerClassName, placement } = _a, props = __rest(_a, ["className", "headerStyle", "children", "footer", "footerClassName", "placement"]);
15
15
  // 对齐小蜜现有的底部
16
16
  const defaultHeaderStyle = {
17
17
  "border-bottom:": "1px solid var(--40gmM)"
18
18
  };
19
- return (React.createElement(NextDrawer, Object.assign({}, props, { v2: true, ref: ref, headerStyle: Object.assign(Object.assign({}, defaultHeaderStyle), headerStyle), className: cs(`${PREFIX_DEFAULT}drawer`, className) }),
20
- React.createElement("div", { className: 'draw-content' }, children),
19
+ return (React.createElement(NextDrawer, Object.assign({}, props, { v2: true, ref: ref, placement: placement, headerStyle: Object.assign(Object.assign({}, defaultHeaderStyle), headerStyle), className: cs(`${PREFIX_DEFAULT}drawer ${placement}`, className) }),
20
+ children,
21
21
  footer && footer.length && React.createElement("div", { className: cs('draw-footer', footerClassName) }, footer)));
22
22
  });
23
23
  const DrawerWithSub = assignSubComponent(Drawer, {
@@ -2,8 +2,14 @@
2
2
 
3
3
  .#{$prefix}drawer {
4
4
 
5
- border-top-left-radius: 16px;
6
- border-top-right-radius: 16px;
5
+ &.bottom {
6
+ border-top-left-radius: 16px;
7
+ border-top-right-radius: 16px;
8
+ }
9
+
10
+ &.right {
11
+ border-top-right-radius: 8px;
12
+ }
7
13
 
8
14
  .draw-footer {
9
15
  width: calc(100% - 40px);
@@ -103,7 +103,7 @@ const HTMLRenderer = memo(function HTMLRenderer({ className, children, imagePrev
103
103
  const parserOptions = {
104
104
  // @ts-ignore
105
105
  replace: domNode => {
106
- var _a, _b, _c, _d, _e, _f;
106
+ var _a, _b, _c, _d, _e, _f, _g;
107
107
  // 处理文本节点
108
108
  if ((domNode.type === 'text' || domNode.nodeType === 3) && typewriterEffect) {
109
109
  return processTextNode(domNode);
@@ -131,7 +131,7 @@ const HTMLRenderer = memo(function HTMLRenderer({ className, children, imagePrev
131
131
  return (React.createElement(Balloon, { v2: true, align: "b", className: "link-reference-balloon", closable: false, offset: [0, -8], triggerType: ['hover'], trigger: React.createElement("span", { className: "link-reference-index", onClick: handleUrlClick }, (_c = spanElement === null || spanElement === void 0 ? void 0 : spanElement.props) === null || _c === void 0 ? void 0 : _c.children) },
132
132
  React.createElement("div", { className: "link-reference-content" },
133
133
  React.createElement("img", { className: "link-reference-source-icon", src: ((_d = element.props) === null || _d === void 0 ? void 0 : _d['data-source-icon']) || '' }),
134
- React.createElement("a", { className: "link-reference-title", onClick: handleUrlClick }, ((_e = element.props) === null || _e === void 0 ? void 0 : _e['data-title']) || ''))));
134
+ React.createElement("a", { className: "link-reference-title", onClick: handleUrlClick, title: ((_e = element.props) === null || _e === void 0 ? void 0 : _e['data-title']) || '' }, ((_f = element.props) === null || _f === void 0 ? void 0 : _f['data-title']) || ''))));
135
135
  }
136
136
  if (name === 'a') {
137
137
  const element = (domToReact([domNode]));
@@ -185,7 +185,7 @@ const HTMLRenderer = memo(function HTMLRenderer({ className, children, imagePrev
185
185
  return renderImage(element.props);
186
186
  }
187
187
  // 换成统一的图片渲染
188
- return React.createElement(Img, Object.assign({}, element.props, { imageClassName: (_f = element.props) === null || _f === void 0 ? void 0 : _f.className, enablePreview: imagePreview, onImageClick: () => {
188
+ return React.createElement(Img, Object.assign({}, element.props, { imageClassName: (_g = element.props) === null || _g === void 0 ? void 0 : _g.className, enablePreview: imagePreview, onImageClick: () => {
189
189
  handleImageClick === null || handleImageClick === void 0 ? void 0 : handleImageClick(element.props.src);
190
190
  } }));
191
191
  }
@@ -10,4 +10,4 @@ import type { IconProps } from '@alifd/next/types/icon';
10
10
  export * from './types';
11
11
  declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<IconProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<IconProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/icon/icon").default>>, keyof IconProps | "key"> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/config-provider/types").ConfiguredComponent<IconProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/icon/icon").default>, {}>;
12
12
  export default _default;
13
- export declare function renderCommonIcon(icon: any, size?: number | 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' | 'inherit'): React.JSX.Element;
13
+ export declare function renderCommonIcon(icon: any, size?: number | 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' | 'inherit'): React.JSX.Element | null;
package/es/icon/index.js CHANGED
@@ -14,7 +14,7 @@ import { PREFIX_DEFAULT, assignSubComponent } from '../utils';
14
14
  const CustomIcon = NextIcon.createFromIconfontCN({
15
15
  scriptUrl: '//at.alicdn.com/t/c/font_3504203_7pbik9jgwl8.js',
16
16
  });
17
- const CustomIconList = ['icon-xiangxiaxianxing', 'icon-xiangxiaxianxing-copy', 'icon-cross', 'icon-fuzhi2'];
17
+ const CustomIconList = ['icon-check', 'icon-xiangxiaxianxing', 'icon-xiangxiaxianxing-copy', 'icon-cross', 'icon-cross1', 'icon-fuzhi2'];
18
18
  const TypeMap = {
19
19
  'arrow-up': 'icon-xiangxiaxianxing-copy',
20
20
  'arrow-down': 'icon-xiangxiaxianxing',
@@ -41,6 +41,9 @@ export default ConfigProvider.config(IconWithSub);
41
41
  export function renderCommonIcon(icon, size) {
42
42
  let dom = null;
43
43
  let iconType = '';
44
+ if (!icon) {
45
+ return null;
46
+ }
44
47
  if (React.isValidElement(icon)) {
45
48
  dom = icon;
46
49
  iconType = 'node';
package/es/index.js CHANGED
@@ -32,4 +32,4 @@ export { default as CheckboxGroup } from './checkbox-group';
32
32
  export { default as Select } from './select';
33
33
  export { default as Flip } from './flip';
34
34
  export { default as ToolStatus } from './tool-status';
35
- export const version = '0.3.33-beta.0';
35
+ export const version = '0.3.33-beta.10';
@@ -9,23 +9,28 @@ import { ConfigProvider } from '@alifd/next';
9
9
  import Icon from '../icon';
10
10
  import cs from 'classnames';
11
11
  import { PREFIX_DEFAULT } from '../utils';
12
- const SUCCESS_ICON = 'success';
13
- const ERROR_ICON = 'error';
12
+ const SUCCESS_ICON = 'icon-check'; //'success'
13
+ const ERROR_ICON = 'icon-cross1'; //'error'
14
14
  const LOADING_ICON = 'loading';
15
15
  const ToolStatus = forwardRef((props, ref) => {
16
- const { className, selected = false, status, result = '', onToolClick, extra } = props;
16
+ const { useText = '使用', name, className, selected = false, status, onToolClick, authInfo, fullWidth } = props;
17
17
  const handleClick = (event) => {
18
18
  event.stopPropagation();
19
19
  onToolClick === null || onToolClick === void 0 ? void 0 : onToolClick(props);
20
20
  };
21
- const statusClassName = selected ? 'selected' : '';
22
- return (React.createElement("div", { className: cs(`${PREFIX_DEFAULT}tool-status ${statusClassName} ${status}`, className), ref: ref, onClick: (e) => {
21
+ let csName = selected ? 'selected' : '';
22
+ csName = fullWidth ? `${csName} full-width` : `${csName}`;
23
+ return (React.createElement("div", { className: cs(`${PREFIX_DEFAULT}tool-status ${csName} ${status}`, className), ref: ref, onClick: (e) => {
23
24
  handleClick(e);
24
25
  } },
25
- React.createElement("div", { className: 'main-content' },
26
- React.createElement(Icon, { size: 'small', type: status === 'error' ? ERROR_ICON : status === 'success' ? SUCCESS_ICON : LOADING_ICON }),
27
- React.createElement("div", { className: 'content-result' }, result)),
28
- extra && React.createElement("div", { className: 'extra-content' }, extra)));
26
+ React.createElement(Icon, { size: 'xs', type: status === 'failed' ? ERROR_ICON : status === 'completed' ? SUCCESS_ICON : LOADING_ICON }),
27
+ authInfo && status === 'auth' && React.createElement("div", { className: 'next-btn-text next-btn-primary', onClick: (event) => {
28
+ var _a;
29
+ event.stopPropagation();
30
+ (_a = authInfo === null || authInfo === void 0 ? void 0 : authInfo.onAuthClick) === null || _a === void 0 ? void 0 : _a.call(authInfo, props);
31
+ } }, authInfo === null || authInfo === void 0 ? void 0 : authInfo.content),
32
+ React.createElement("div", { className: 'content-use-tips' }, useText),
33
+ React.createElement("div", { className: 'content-name' }, name)));
29
34
  });
30
35
  export * from './types';
31
36
  export default ConfigProvider.config(ToolStatus);
@@ -3,40 +3,65 @@
3
3
  .#{$prefix}tool-status {
4
4
  width: fit-content;
5
5
  transition: width 0.3s ease-in-out;
6
- background-color: $color-fill1-1;//$color-brand1-1;
7
- padding: $s-1;
8
- border-radius: $s-2;
6
+ padding: $s-1 $s-3;
7
+ border-radius: $s-4;
9
8
  box-sizing: border-box;
10
- border: solid 1px $color-fill1-1;
9
+ border: solid 1px $color-line1-2;
11
10
  align-items: center;
11
+ display: flex;
12
+ background-color: transparent;
13
+ font-size: $font-size-caption;
14
+ i {
15
+ margin-right: $s-1;
16
+ }
17
+ .next-icon.next-small:before {
18
+
19
+ }
20
+
21
+ &.full-width {
22
+ width: 100%;
23
+ }
12
24
 
13
25
  &.selected {
14
26
  background-color: $color-fill1-2;
27
+ border: solid 1px transparent;
15
28
  }
16
29
 
17
- &.success {
30
+ &.completed {
18
31
  i {
19
32
  color: $color-success-3;
20
33
  }
21
34
  }
22
35
 
23
- &.error {
36
+ &.failed {
24
37
  i {
25
38
  color: $color-error-3;
26
39
  }
27
40
  }
28
41
 
29
- &.loading {
42
+ &.running, &.auth, &.started {
30
43
  i {
31
44
  color: $color-brand1-6;
32
45
  }
33
46
  }
47
+
48
+ .next-btn-text.next-btn-primary{
49
+ line-height: $s-4;
50
+ font-size: $font-size-caption;
51
+ cursor: pointer;
52
+ margin-right: $s-1;
53
+ }
34
54
 
35
- .main-content {
36
- display: flex;
37
- .content-result {
38
- margin-left: 4px;
39
- }
55
+
56
+ .content-use-tips {
57
+ color: $color-text1-3;
58
+ margin-right: $s-1;
59
+ line-height: $s-4;
60
+ }
61
+
62
+ .content-name {
63
+ color: $color-text1-4;
64
+ line-height: $s-4;
40
65
  }
41
66
 
42
67
  }
@@ -1,5 +1,9 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  import { type CommonProps } from '@alifd/next';
3
+ export interface ToolStatusAuthProps {
4
+ content: string | ReactNode;
5
+ onAuthClick?: (data: ToolStatusProps) => void;
6
+ }
3
7
  /**
4
8
  * 参考来源属性
5
9
  */
@@ -12,7 +16,7 @@ export interface ToolStatusProps extends React.HTMLAttributes<HTMLElement>, Comm
12
16
  /**
13
17
  * 工具调用状态
14
18
  */
15
- status?: 'loading' | 'success' | 'error';
19
+ status?: 'started' | 'running' | 'completed' | 'failed' | 'auth';
16
20
  /**
17
21
  * 工具调用结果
18
22
  */
@@ -22,7 +26,19 @@ export interface ToolStatusProps extends React.HTMLAttributes<HTMLElement>, Comm
22
26
  */
23
27
  onToolClick?: (data: ToolStatusProps) => void;
24
28
  /**
25
- * 额外需要渲染的内容
29
+ * 额外的授权信息
30
+ */
31
+ authInfo?: ToolStatusAuthProps;
32
+ /**
33
+ * 工具名称
34
+ */
35
+ name?: string;
36
+ /**
37
+ * 工具详情链接
38
+ */
39
+ useText?: string;
40
+ /**
41
+ * 是否100%的宽度
26
42
  */
27
- extra?: string | ReactNode;
43
+ fullWidth?: boolean;
28
44
  }
@@ -7,14 +7,38 @@
7
7
 
8
8
  &-group {
9
9
  .single-button {
10
- flex: 1 0 calc(33.33% - 6px); /* 每个按钮占据33.33%的宽度减去左右各3px的间隔(总共6px)来保证每行三个 */
10
+ flex: 1 0 calc(50% - 3px); // 修改为50%宽度,每个按钮间隔6px,所以是3px
11
11
  text-align: center;
12
- margin-right: 6px;
12
+ margin-right: 6px;
13
13
  max-width: 100%;
14
14
  overflow: hidden;
15
- &:last-child{
16
- margin-right: 0px;
15
+
16
+ &:nth-child(n+3) {
17
+ margin-top: 8px;
18
+ }
19
+
20
+ // 使用nth-child选择器处理偶数按钮的右边距
21
+ &:nth-child(2n) {
22
+ margin-right: 0;
17
23
  }
24
+
25
+ // 最后一个按钮不需要右边距
26
+ &:last-child {
27
+ margin-right: 0;
28
+ }
29
+
30
+ // 当按钮数量小于等于3个时,恢复为三等分布局
31
+ &:first-child:nth-last-child(-n+3),
32
+ &:first-child:nth-last-child(-n+3) ~ .single-button {
33
+ flex: 1 0 calc(33.33% - 6px);
34
+ margin-top: 0;
35
+
36
+ // 重置偶数按钮的右边距规则
37
+ &:nth-child(2n) {
38
+ margin-right: 6px;
39
+ }
40
+ }
41
+
18
42
  .next-btn-helper {
19
43
  max-width: 100%;
20
44
  overflow: hidden;
@@ -50,12 +74,12 @@
50
74
  }
51
75
  }
52
76
  }
53
-
77
+
54
78
  &.sub {
55
79
  .single-button {
56
80
  max-width: calc(50% - 6px);
57
81
  margin-bottom: 0;
58
- }
82
+ }
59
83
  @media (max-width: 600px) {
60
84
  display: block;
61
85
  }
@@ -13,13 +13,13 @@ const next_1 = require("@alifd/next");
13
13
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
14
14
  const utils_1 = require("../utils");
15
15
  const Drawer = (0, react_1.forwardRef)((_a, ref) => {
16
- var { className, headerStyle, children, footer, footerClassName } = _a, props = tslib_1.__rest(_a, ["className", "headerStyle", "children", "footer", "footerClassName"]);
16
+ var { className, headerStyle, children, footer, footerClassName, placement } = _a, props = tslib_1.__rest(_a, ["className", "headerStyle", "children", "footer", "footerClassName", "placement"]);
17
17
  // 对齐小蜜现有的底部
18
18
  const defaultHeaderStyle = {
19
19
  "border-bottom:": "1px solid var(--40gmM)"
20
20
  };
21
- return (react_1.default.createElement(next_1.Drawer, Object.assign({}, props, { v2: true, ref: ref, headerStyle: Object.assign(Object.assign({}, defaultHeaderStyle), headerStyle), className: (0, classnames_1.default)(`${utils_1.PREFIX_DEFAULT}drawer`, className) }),
22
- react_1.default.createElement("div", { className: 'draw-content' }, children),
21
+ return (react_1.default.createElement(next_1.Drawer, Object.assign({}, props, { v2: true, ref: ref, placement: placement, headerStyle: Object.assign(Object.assign({}, defaultHeaderStyle), headerStyle), className: (0, classnames_1.default)(`${utils_1.PREFIX_DEFAULT}drawer ${placement}`, className) }),
22
+ children,
23
23
  footer && footer.length && react_1.default.createElement("div", { className: (0, classnames_1.default)('draw-footer', footerClassName) }, footer)));
24
24
  });
25
25
  const DrawerWithSub = (0, utils_1.assignSubComponent)(Drawer, {
@@ -2,8 +2,14 @@
2
2
 
3
3
  .#{$prefix}drawer {
4
4
 
5
- border-top-left-radius: 16px;
6
- border-top-right-radius: 16px;
5
+ &.bottom {
6
+ border-top-left-radius: 16px;
7
+ border-top-right-radius: 16px;
8
+ }
9
+
10
+ &.right {
11
+ border-top-right-radius: 8px;
12
+ }
7
13
 
8
14
  .draw-footer {
9
15
  width: calc(100% - 40px);
@@ -106,7 +106,7 @@ const HTMLRenderer = (0, react_1.memo)(function HTMLRenderer({ className, childr
106
106
  const parserOptions = {
107
107
  // @ts-ignore
108
108
  replace: domNode => {
109
- var _a, _b, _c, _d, _e, _f;
109
+ var _a, _b, _c, _d, _e, _f, _g;
110
110
  // 处理文本节点
111
111
  if ((domNode.type === 'text' || domNode.nodeType === 3) && typewriterEffect) {
112
112
  return processTextNode(domNode);
@@ -134,7 +134,7 @@ const HTMLRenderer = (0, react_1.memo)(function HTMLRenderer({ className, childr
134
134
  return (react_1.default.createElement(balloon_1.default, { v2: true, align: "b", className: "link-reference-balloon", closable: false, offset: [0, -8], triggerType: ['hover'], trigger: react_1.default.createElement("span", { className: "link-reference-index", onClick: handleUrlClick }, (_c = spanElement === null || spanElement === void 0 ? void 0 : spanElement.props) === null || _c === void 0 ? void 0 : _c.children) },
135
135
  react_1.default.createElement("div", { className: "link-reference-content" },
136
136
  react_1.default.createElement("img", { className: "link-reference-source-icon", src: ((_d = element.props) === null || _d === void 0 ? void 0 : _d['data-source-icon']) || '' }),
137
- react_1.default.createElement("a", { className: "link-reference-title", onClick: handleUrlClick }, ((_e = element.props) === null || _e === void 0 ? void 0 : _e['data-title']) || ''))));
137
+ react_1.default.createElement("a", { className: "link-reference-title", onClick: handleUrlClick, title: ((_e = element.props) === null || _e === void 0 ? void 0 : _e['data-title']) || '' }, ((_f = element.props) === null || _f === void 0 ? void 0 : _f['data-title']) || ''))));
138
138
  }
139
139
  if (name === 'a') {
140
140
  const element = ((0, html_react_parser_1.domToReact)([domNode]));
@@ -188,7 +188,7 @@ const HTMLRenderer = (0, react_1.memo)(function HTMLRenderer({ className, childr
188
188
  return renderImage(element.props);
189
189
  }
190
190
  // 换成统一的图片渲染
191
- return react_1.default.createElement(img_1.default, Object.assign({}, element.props, { imageClassName: (_f = element.props) === null || _f === void 0 ? void 0 : _f.className, enablePreview: imagePreview, onImageClick: () => {
191
+ return react_1.default.createElement(img_1.default, Object.assign({}, element.props, { imageClassName: (_g = element.props) === null || _g === void 0 ? void 0 : _g.className, enablePreview: imagePreview, onImageClick: () => {
192
192
  handleImageClick === null || handleImageClick === void 0 ? void 0 : handleImageClick(element.props.src);
193
193
  } }));
194
194
  }
@@ -10,4 +10,4 @@ import type { IconProps } from '@alifd/next/types/icon';
10
10
  export * from './types';
11
11
  declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<IconProps & React.RefAttributes<import("@alifd/next/types/config-provider/types").ConfiguredComponent<IconProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/icon/icon").default>>, keyof IconProps | "key"> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/config-provider/types").ConfiguredComponent<IconProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, import("@alifd/next/types/icon/icon").default>, {}>;
12
12
  export default _default;
13
- export declare function renderCommonIcon(icon: any, size?: number | 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' | 'inherit'): React.JSX.Element;
13
+ export declare function renderCommonIcon(icon: any, size?: number | 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' | 'inherit'): React.JSX.Element | null;
package/lib/icon/index.js CHANGED
@@ -17,7 +17,7 @@ const utils_1 = require("../utils");
17
17
  const CustomIcon = next_1.Icon.createFromIconfontCN({
18
18
  scriptUrl: '//at.alicdn.com/t/c/font_3504203_7pbik9jgwl8.js',
19
19
  });
20
- const CustomIconList = ['icon-xiangxiaxianxing', 'icon-xiangxiaxianxing-copy', 'icon-cross', 'icon-fuzhi2'];
20
+ const CustomIconList = ['icon-check', 'icon-xiangxiaxianxing', 'icon-xiangxiaxianxing-copy', 'icon-cross', 'icon-cross1', 'icon-fuzhi2'];
21
21
  const TypeMap = {
22
22
  'arrow-up': 'icon-xiangxiaxianxing-copy',
23
23
  'arrow-down': 'icon-xiangxiaxianxing',
@@ -44,6 +44,9 @@ exports.default = next_1.ConfigProvider.config(IconWithSub);
44
44
  function renderCommonIcon(icon, size) {
45
45
  let dom = null;
46
46
  let iconType = '';
47
+ if (!icon) {
48
+ return null;
49
+ }
47
50
  if (react_1.default.isValidElement(icon)) {
48
51
  dom = icon;
49
52
  iconType = 'node';
package/lib/index.js CHANGED
@@ -70,4 +70,4 @@ var flip_1 = require("./flip");
70
70
  Object.defineProperty(exports, "Flip", { enumerable: true, get: function () { return tslib_1.__importDefault(flip_1).default; } });
71
71
  var tool_status_1 = require("./tool-status");
72
72
  Object.defineProperty(exports, "ToolStatus", { enumerable: true, get: function () { return tslib_1.__importDefault(tool_status_1).default; } });
73
- exports.version = '0.3.33-beta.0';
73
+ exports.version = '0.3.33-beta.10';
@@ -12,23 +12,28 @@ const next_1 = require("@alifd/next");
12
12
  const icon_1 = tslib_1.__importDefault(require("../icon"));
13
13
  const classnames_1 = tslib_1.__importDefault(require("classnames"));
14
14
  const utils_1 = require("../utils");
15
- const SUCCESS_ICON = 'success';
16
- const ERROR_ICON = 'error';
15
+ const SUCCESS_ICON = 'icon-check'; //'success'
16
+ const ERROR_ICON = 'icon-cross1'; //'error'
17
17
  const LOADING_ICON = 'loading';
18
18
  const ToolStatus = (0, react_1.forwardRef)((props, ref) => {
19
- const { className, selected = false, status, result = '', onToolClick, extra } = props;
19
+ const { useText = '使用', name, className, selected = false, status, onToolClick, authInfo, fullWidth } = props;
20
20
  const handleClick = (event) => {
21
21
  event.stopPropagation();
22
22
  onToolClick === null || onToolClick === void 0 ? void 0 : onToolClick(props);
23
23
  };
24
- const statusClassName = selected ? 'selected' : '';
25
- return (react_1.default.createElement("div", { className: (0, classnames_1.default)(`${utils_1.PREFIX_DEFAULT}tool-status ${statusClassName} ${status}`, className), ref: ref, onClick: (e) => {
24
+ let csName = selected ? 'selected' : '';
25
+ csName = fullWidth ? `${csName} full-width` : `${csName}`;
26
+ return (react_1.default.createElement("div", { className: (0, classnames_1.default)(`${utils_1.PREFIX_DEFAULT}tool-status ${csName} ${status}`, className), ref: ref, onClick: (e) => {
26
27
  handleClick(e);
27
28
  } },
28
- react_1.default.createElement("div", { className: 'main-content' },
29
- react_1.default.createElement(icon_1.default, { size: 'small', type: status === 'error' ? ERROR_ICON : status === 'success' ? SUCCESS_ICON : LOADING_ICON }),
30
- react_1.default.createElement("div", { className: 'content-result' }, result)),
31
- extra && react_1.default.createElement("div", { className: 'extra-content' }, extra)));
29
+ react_1.default.createElement(icon_1.default, { size: 'xs', type: status === 'failed' ? ERROR_ICON : status === 'completed' ? SUCCESS_ICON : LOADING_ICON }),
30
+ authInfo && status === 'auth' && react_1.default.createElement("div", { className: 'next-btn-text next-btn-primary', onClick: (event) => {
31
+ var _a;
32
+ event.stopPropagation();
33
+ (_a = authInfo === null || authInfo === void 0 ? void 0 : authInfo.onAuthClick) === null || _a === void 0 ? void 0 : _a.call(authInfo, props);
34
+ } }, authInfo === null || authInfo === void 0 ? void 0 : authInfo.content),
35
+ react_1.default.createElement("div", { className: 'content-use-tips' }, useText),
36
+ react_1.default.createElement("div", { className: 'content-name' }, name)));
32
37
  });
33
38
  tslib_1.__exportStar(require("./types"), exports);
34
39
  exports.default = next_1.ConfigProvider.config(ToolStatus);
@@ -3,40 +3,65 @@
3
3
  .#{$prefix}tool-status {
4
4
  width: fit-content;
5
5
  transition: width 0.3s ease-in-out;
6
- background-color: $color-fill1-1;//$color-brand1-1;
7
- padding: $s-1;
8
- border-radius: $s-2;
6
+ padding: $s-1 $s-3;
7
+ border-radius: $s-4;
9
8
  box-sizing: border-box;
10
- border: solid 1px $color-fill1-1;
9
+ border: solid 1px $color-line1-2;
11
10
  align-items: center;
11
+ display: flex;
12
+ background-color: transparent;
13
+ font-size: $font-size-caption;
14
+ i {
15
+ margin-right: $s-1;
16
+ }
17
+ .next-icon.next-small:before {
18
+
19
+ }
20
+
21
+ &.full-width {
22
+ width: 100%;
23
+ }
12
24
 
13
25
  &.selected {
14
26
  background-color: $color-fill1-2;
27
+ border: solid 1px transparent;
15
28
  }
16
29
 
17
- &.success {
30
+ &.completed {
18
31
  i {
19
32
  color: $color-success-3;
20
33
  }
21
34
  }
22
35
 
23
- &.error {
36
+ &.failed {
24
37
  i {
25
38
  color: $color-error-3;
26
39
  }
27
40
  }
28
41
 
29
- &.loading {
42
+ &.running, &.auth, &.started {
30
43
  i {
31
44
  color: $color-brand1-6;
32
45
  }
33
46
  }
47
+
48
+ .next-btn-text.next-btn-primary{
49
+ line-height: $s-4;
50
+ font-size: $font-size-caption;
51
+ cursor: pointer;
52
+ margin-right: $s-1;
53
+ }
34
54
 
35
- .main-content {
36
- display: flex;
37
- .content-result {
38
- margin-left: 4px;
39
- }
55
+
56
+ .content-use-tips {
57
+ color: $color-text1-3;
58
+ margin-right: $s-1;
59
+ line-height: $s-4;
60
+ }
61
+
62
+ .content-name {
63
+ color: $color-text1-4;
64
+ line-height: $s-4;
40
65
  }
41
66
 
42
67
  }
@@ -1,5 +1,9 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  import { type CommonProps } from '@alifd/next';
3
+ export interface ToolStatusAuthProps {
4
+ content: string | ReactNode;
5
+ onAuthClick?: (data: ToolStatusProps) => void;
6
+ }
3
7
  /**
4
8
  * 参考来源属性
5
9
  */
@@ -12,7 +16,7 @@ export interface ToolStatusProps extends React.HTMLAttributes<HTMLElement>, Comm
12
16
  /**
13
17
  * 工具调用状态
14
18
  */
15
- status?: 'loading' | 'success' | 'error';
19
+ status?: 'started' | 'running' | 'completed' | 'failed' | 'auth';
16
20
  /**
17
21
  * 工具调用结果
18
22
  */
@@ -22,7 +26,19 @@ export interface ToolStatusProps extends React.HTMLAttributes<HTMLElement>, Comm
22
26
  */
23
27
  onToolClick?: (data: ToolStatusProps) => void;
24
28
  /**
25
- * 额外需要渲染的内容
29
+ * 额外的授权信息
30
+ */
31
+ authInfo?: ToolStatusAuthProps;
32
+ /**
33
+ * 工具名称
34
+ */
35
+ name?: string;
36
+ /**
37
+ * 工具详情链接
38
+ */
39
+ useText?: string;
40
+ /**
41
+ * 是否100%的宽度
26
42
  */
27
- extra?: string | ReactNode;
43
+ fullWidth?: boolean;
28
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alifd/chat",
3
- "version": "0.3.33-beta.0",
3
+ "version": "0.3.33-beta.10",
4
4
  "description": "A configurable component library for chat built on React.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",