@lobehub/ui 1.104.0 → 1.104.2
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.
- package/es/ActionIconGroup/index.js +2 -2
- package/es/Burger/index.js +8 -6
- package/es/ChatItem/components/Actions.js +1 -1
- package/es/ChatItem/style.js +1 -1
- package/es/ChatList/Item.d.ts +1 -1
- package/es/ChatList/Item.js +13 -18
- package/es/MessageModal/index.js +5 -3
- package/es/Modal/index.js +9 -9
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/types/chatMessage.d.ts +1 -7
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@ var ActionIconGroup = /*#__PURE__*/memo(function (_ref) {
|
|
|
33
33
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
34
34
|
className: styles.container
|
|
35
35
|
}, props), {}, {
|
|
36
|
-
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), items.map(function (item) {
|
|
36
|
+
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), (items === null || items === void 0 ? void 0 : items.length) > 0 && items.map(function (item) {
|
|
37
37
|
return /*#__PURE__*/_jsx(ActionIcon, {
|
|
38
38
|
icon: item.icon,
|
|
39
39
|
onClick: onActionClick ? function () {
|
|
@@ -43,7 +43,7 @@ var ActionIconGroup = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
43
|
size: "small",
|
|
44
44
|
title: item.label
|
|
45
45
|
}, item.key);
|
|
46
|
-
}), dropdownMenu && /*#__PURE__*/_jsx(Dropdown, {
|
|
46
|
+
}), (dropdownMenu === null || dropdownMenu === void 0 ? void 0 : dropdownMenu.length) > 0 && /*#__PURE__*/_jsx(Dropdown, {
|
|
47
47
|
menu: {
|
|
48
48
|
items: dropdownMenu.map(function (item) {
|
|
49
49
|
if (item.type) return item;
|
package/es/Burger/index.js
CHANGED
|
@@ -34,17 +34,19 @@ var Burger = /*#__PURE__*/memo(function (_ref) {
|
|
|
34
34
|
icon: opened ? X : MenuIcon,
|
|
35
35
|
size: "site"
|
|
36
36
|
}), /*#__PURE__*/_jsxs(Drawer, {
|
|
37
|
-
bodyStyle: {
|
|
38
|
-
padding: 0
|
|
39
|
-
},
|
|
40
37
|
className: styles.drawer,
|
|
41
38
|
closeIcon: undefined,
|
|
42
|
-
headerStyle: {
|
|
43
|
-
display: 'none'
|
|
44
|
-
},
|
|
45
39
|
open: opened,
|
|
46
40
|
placement: 'left',
|
|
47
41
|
rootClassName: styles.drawerRoot,
|
|
42
|
+
styles: {
|
|
43
|
+
body: {
|
|
44
|
+
padding: 0
|
|
45
|
+
},
|
|
46
|
+
header: {
|
|
47
|
+
display: 'none'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
48
50
|
width: '100vw',
|
|
49
51
|
children: [/*#__PURE__*/_jsx(Menu, {
|
|
50
52
|
className: styles.menu,
|
package/es/ChatItem/style.js
CHANGED
|
@@ -24,7 +24,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
24
24
|
alert: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral([""]))),
|
|
25
25
|
avatarContainer: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: relative;\n flex: none;\n width: ", "px;\n height: ", "px;\n "])), avatarSize, avatarSize),
|
|
26
26
|
avatarGroupContainer: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), avatarSize),
|
|
27
|
-
container: cx(type === 'pure' && pureContainerStylish, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n max-width: 100vw;\n padding: 12px 16px;\n\n time {\n display: inline-block;\n white-space: nowrap;\n }\n\n div[role='
|
|
27
|
+
container: cx(type === 'pure' && pureContainerStylish, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n max-width: 100vw;\n padding: 12px 16px;\n\n time {\n display: inline-block;\n white-space: nowrap;\n }\n\n div[role='menubar'] {\n display: flex;\n }\n\n time,\n div[role='menubar'] {\n pointer-events: none;\n opacity: 0;\n transition: opacity 200ms ", ";\n }\n\n &:hover {\n time,\n div[role='menubar'] {\n pointer-events: unset;\n opacity: 1;\n }\n }\n\n ", " {\n padding: 4px 16px;\n }\n "])), token.motionEaseOut, responsive.mobile)),
|
|
28
28
|
editingContainer: cx(editingStylish, css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n padding: 8px 12px 12px;\n border: 1px solid ", ";\n\n &:active,\n &:hover {\n border-color: ", ";\n }\n "])), token.colorBorderSecondary, token.colorBorder), type === 'pure' && css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n background: ", ";\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.borderRadius)),
|
|
29
29
|
editingInput: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n width: 100%;\n "]))),
|
|
30
30
|
loading: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n position: absolute;\n right: ", ";\n bottom: 0;\n left: ", ";\n\n width: 16px;\n height: 16px;\n\n color: ", ";\n\n background: ", ";\n border-radius: 50%;\n "])), placement === 'left' ? '-4px' : 'unset', placement === 'right' ? '-4px' : 'unset', token.colorBgLayout, token.colorPrimary),
|
package/es/ChatList/Item.d.ts
CHANGED
package/es/ChatList/Item.js
CHANGED
|
@@ -70,22 +70,6 @@ var Item = /*#__PURE__*/memo(function (props) {
|
|
|
70
70
|
if (!RenderFunction) return;
|
|
71
71
|
return /*#__PURE__*/_jsx(RenderFunction, _objectSpread({}, data));
|
|
72
72
|
}, [renderErrorMessages === null || renderErrorMessages === void 0 ? void 0 : renderErrorMessages[item === null || item === void 0 ? void 0 : (_item$error2 = item.error) === null || _item$error2 === void 0 ? void 0 : _item$error2.type]]);
|
|
73
|
-
var _onActionClick = useCallback(function (actionKey, data) {
|
|
74
|
-
if (!actionKey) return;
|
|
75
|
-
var handleActionClick = _objectSpread({
|
|
76
|
-
copy: function copy(data) {
|
|
77
|
-
_copy(data.content);
|
|
78
|
-
message.success((text === null || text === void 0 ? void 0 : text.copySuccess) || 'Copy Success');
|
|
79
|
-
},
|
|
80
|
-
edit: function edit() {
|
|
81
|
-
return setEditing(true);
|
|
82
|
-
}
|
|
83
|
-
}, onActionsClick);
|
|
84
|
-
return function () {
|
|
85
|
-
var _handleActionClick$ac;
|
|
86
|
-
return handleActionClick === null || handleActionClick === void 0 ? void 0 : (_handleActionClick$ac = handleActionClick[actionKey]) === null || _handleActionClick$ac === void 0 ? void 0 : _handleActionClick$ac.call(handleActionClick, data);
|
|
87
|
-
};
|
|
88
|
-
}, [onActionsClick === null || onActionsClick === void 0 ? void 0 : onActionsClick[item.role], text]);
|
|
89
73
|
var Actions = useCallback(function (_ref4) {
|
|
90
74
|
var data = _ref4.data;
|
|
91
75
|
if (!renderActions || !(item !== null && item !== void 0 && item.role)) return;
|
|
@@ -93,13 +77,24 @@ var Item = /*#__PURE__*/memo(function (props) {
|
|
|
93
77
|
if (renderActions !== null && renderActions !== void 0 && renderActions[item.role]) RenderFunction = renderActions[item.role];
|
|
94
78
|
if (renderActions !== null && renderActions !== void 0 && renderActions['default']) RenderFunction = renderActions['default'];
|
|
95
79
|
if (!RenderFunction) RenderFunction = ActionsBar;
|
|
80
|
+
var handleActionClick = _objectSpread({
|
|
81
|
+
copy: function copy(_ref5) {
|
|
82
|
+
var content = _ref5.content;
|
|
83
|
+
_copy(content);
|
|
84
|
+
message.success((text === null || text === void 0 ? void 0 : text.copySuccess) || 'Copy Success');
|
|
85
|
+
},
|
|
86
|
+
edit: function edit() {
|
|
87
|
+
return setEditing(true);
|
|
88
|
+
}
|
|
89
|
+
}, onActionsClick);
|
|
96
90
|
return /*#__PURE__*/_jsx(RenderFunction, _objectSpread(_objectSpread({}, data), {}, {
|
|
97
91
|
onActionClick: function onActionClick(actionKey) {
|
|
98
|
-
|
|
92
|
+
var _handleActionClick$ac;
|
|
93
|
+
return handleActionClick === null || handleActionClick === void 0 ? void 0 : (_handleActionClick$ac = handleActionClick[actionKey]) === null || _handleActionClick$ac === void 0 ? void 0 : _handleActionClick$ac.call(handleActionClick, data);
|
|
99
94
|
},
|
|
100
95
|
text: text
|
|
101
96
|
}));
|
|
102
|
-
}, [renderActions === null || renderActions === void 0 ? void 0 : renderActions[item.role], text,
|
|
97
|
+
}, [renderActions === null || renderActions === void 0 ? void 0 : renderActions[item.role], text, onActionsClick]);
|
|
103
98
|
var error = useMemo(function () {
|
|
104
99
|
var _item$error3;
|
|
105
100
|
if (!item.error) return;
|
package/es/MessageModal/index.js
CHANGED
|
@@ -43,9 +43,6 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
43
|
overflowY: 'auto'
|
|
44
44
|
};
|
|
45
45
|
return /*#__PURE__*/_jsx(Modal, {
|
|
46
|
-
bodyStyle: mobile ? {
|
|
47
|
-
padding: 16
|
|
48
|
-
} : {},
|
|
49
46
|
cancelText: (text === null || text === void 0 ? void 0 : text.cancel) || 'Cancel',
|
|
50
47
|
footer: isEdit ? null : undefined,
|
|
51
48
|
okText: (text === null || text === void 0 ? void 0 : text.edit) || 'Edit',
|
|
@@ -56,6 +53,11 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
56
53
|
return setTyping(true);
|
|
57
54
|
},
|
|
58
55
|
open: expand,
|
|
56
|
+
styles: mobile ? {
|
|
57
|
+
body: {
|
|
58
|
+
padding: 16
|
|
59
|
+
}
|
|
60
|
+
} : {},
|
|
59
61
|
title: (text === null || text === void 0 ? void 0 : text.title) || 'Prompt',
|
|
60
62
|
children: isEdit ? /*#__PURE__*/_jsx(MessageInput, {
|
|
61
63
|
defaultValue: value,
|
package/es/Modal/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
4
|
-
var _excluded = ["children", "title", "className", "wrapClassName", "width", "onCancel", "open", "destroyOnClose"
|
|
4
|
+
var _excluded = ["children", "title", "className", "wrapClassName", "width", "onCancel", "open", "destroyOnClose"];
|
|
5
5
|
var _templateObject, _templateObject2;
|
|
6
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -32,7 +32,6 @@ var Modal = /*#__PURE__*/memo(function (_ref2) {
|
|
|
32
32
|
onCancel = _ref2.onCancel,
|
|
33
33
|
open = _ref2.open,
|
|
34
34
|
destroyOnClose = _ref2.destroyOnClose,
|
|
35
|
-
bodyStyle = _ref2.bodyStyle,
|
|
36
35
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
37
36
|
var _useResponsive = useResponsive(),
|
|
38
37
|
mobile = _useResponsive.mobile;
|
|
@@ -41,9 +40,6 @@ var Modal = /*#__PURE__*/memo(function (_ref2) {
|
|
|
41
40
|
cx = _useStyles.cx,
|
|
42
41
|
theme = _useStyles.theme;
|
|
43
42
|
if (mobile) return /*#__PURE__*/_jsx(Drawer, {
|
|
44
|
-
bodyStyle: bodyStyle || {
|
|
45
|
-
padding: 0
|
|
46
|
-
},
|
|
47
43
|
closeIcon: /*#__PURE__*/_jsx(ActionIcon, {
|
|
48
44
|
icon: X,
|
|
49
45
|
size: {
|
|
@@ -55,14 +51,19 @@ var Modal = /*#__PURE__*/memo(function (_ref2) {
|
|
|
55
51
|
drawerStyle: {
|
|
56
52
|
background: "linear-gradient(to bottom, ".concat(theme.colorBgContainer, ", ").concat(theme.colorBgLayout, ")")
|
|
57
53
|
},
|
|
58
|
-
headerStyle: {
|
|
59
|
-
padding: '8px 4px'
|
|
60
|
-
},
|
|
61
54
|
height: '75vh',
|
|
62
55
|
maskClassName: cx(styles.wrap, wrapClassName),
|
|
63
56
|
onClose: onCancel,
|
|
64
57
|
open: open,
|
|
65
58
|
placement: 'bottom',
|
|
59
|
+
styles: _objectSpread({
|
|
60
|
+
body: {
|
|
61
|
+
padding: 0
|
|
62
|
+
},
|
|
63
|
+
header: {
|
|
64
|
+
padding: '8px 4px'
|
|
65
|
+
}
|
|
66
|
+
}, props.styles),
|
|
66
67
|
title: title,
|
|
67
68
|
children: children
|
|
68
69
|
});
|
|
@@ -73,7 +74,6 @@ var Modal = /*#__PURE__*/memo(function (_ref2) {
|
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
children: /*#__PURE__*/_jsx(AntModal, _objectSpread(_objectSpread({
|
|
76
|
-
bodyStyle: bodyStyle,
|
|
77
77
|
className: cx(styles.content, className),
|
|
78
78
|
closable: true,
|
|
79
79
|
closeIcon: /*#__PURE__*/_jsx(Icon, {
|
package/es/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { default as ChatInputArea, type ChatInputAreaProps } from './ChatInputAr
|
|
|
9
9
|
export { default as ChatItem, type ChatItemProps } from './ChatItem';
|
|
10
10
|
export type { ChatListProps, OnActionClick, OnMessageChange, RenderAction, RenderErrorMessage, RenderItem, RenderMessage, RenderMessageExtra, } from './ChatList';
|
|
11
11
|
export { default as ChatList } from './ChatList';
|
|
12
|
+
export { default as ActionsBar, type ActionsBarProps } from './ChatList/ActionsBar';
|
|
12
13
|
export { default as CodeEditor, type CodeEditorProps } from './CodeEditor';
|
|
13
14
|
export { default as ColorScales, type ColorScalesProps } from './ColorScales';
|
|
14
15
|
export { type Config, default as ConfigProvider, useCdnFn } from './ConfigProvider';
|
package/es/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { default as ChatHeaderTitle } from "./ChatHeader/ChatHeaderTitle";
|
|
|
8
8
|
export { default as ChatInputArea } from "./ChatInputArea";
|
|
9
9
|
export { default as ChatItem } from "./ChatItem";
|
|
10
10
|
export { default as ChatList } from "./ChatList";
|
|
11
|
+
export { default as ActionsBar } from "./ChatList/ActionsBar";
|
|
11
12
|
export { default as CodeEditor } from "./CodeEditor";
|
|
12
13
|
export { default as ColorScales } from "./ColorScales";
|
|
13
14
|
export { default as ConfigProvider, useCdnFn } from "./ConfigProvider";
|
|
@@ -21,13 +21,7 @@ export interface ChatMessage extends BaseDataModel {
|
|
|
21
21
|
*/
|
|
22
22
|
content: string;
|
|
23
23
|
error?: any;
|
|
24
|
-
extra?:
|
|
25
|
-
fromModel?: string;
|
|
26
|
-
translate?: {
|
|
27
|
-
target: string;
|
|
28
|
-
to: string;
|
|
29
|
-
};
|
|
30
|
-
} & Record<string, any>;
|
|
24
|
+
extra?: any;
|
|
31
25
|
/**
|
|
32
26
|
* replace with plugin
|
|
33
27
|
* @deprecated
|