@lobehub/ui 1.106.1 → 1.106.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.
|
@@ -7,6 +7,11 @@ export interface ActionIconGroupItems {
|
|
|
7
7
|
key: string;
|
|
8
8
|
label: string;
|
|
9
9
|
}
|
|
10
|
+
export interface ActionEvent {
|
|
11
|
+
item: ActionIconGroupItems;
|
|
12
|
+
key: string;
|
|
13
|
+
keyPath: string[];
|
|
14
|
+
}
|
|
10
15
|
export interface ActionIconGroupProps extends DivProps {
|
|
11
16
|
/**
|
|
12
17
|
* @description The direction of the icons
|
|
@@ -24,7 +29,7 @@ export interface ActionIconGroupProps extends DivProps {
|
|
|
24
29
|
* @default []
|
|
25
30
|
*/
|
|
26
31
|
items?: ActionIconGroupItems[];
|
|
27
|
-
onActionClick?: (
|
|
32
|
+
onActionClick?: (action: ActionEvent) => void;
|
|
28
33
|
/**
|
|
29
34
|
* @description The position of the tooltip relative to the target
|
|
30
35
|
* @enum ["top","left","right","bottom","topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]
|
|
@@ -37,7 +37,11 @@ var ActionIconGroup = /*#__PURE__*/memo(function (_ref) {
|
|
|
37
37
|
return /*#__PURE__*/_jsx(ActionIcon, {
|
|
38
38
|
icon: item.icon,
|
|
39
39
|
onClick: onActionClick ? function () {
|
|
40
|
-
return onActionClick === null || onActionClick === void 0 ? void 0 : onActionClick(
|
|
40
|
+
return onActionClick === null || onActionClick === void 0 ? void 0 : onActionClick({
|
|
41
|
+
item: item,
|
|
42
|
+
key: item.key,
|
|
43
|
+
keyPath: [item.key]
|
|
44
|
+
});
|
|
41
45
|
} : undefined,
|
|
42
46
|
placement: tooltipsPlacement,
|
|
43
47
|
size: "small",
|
|
@@ -52,8 +56,12 @@ var ActionIconGroup = /*#__PURE__*/memo(function (_ref) {
|
|
|
52
56
|
icon: item.icon,
|
|
53
57
|
size: "small"
|
|
54
58
|
}),
|
|
55
|
-
onClick: onActionClick ? function () {
|
|
56
|
-
return onActionClick(
|
|
59
|
+
onClick: onActionClick ? function (info) {
|
|
60
|
+
return onActionClick({
|
|
61
|
+
item: item,
|
|
62
|
+
key: info.key,
|
|
63
|
+
keyPath: info.keyPath
|
|
64
|
+
});
|
|
57
65
|
} : undefined
|
|
58
66
|
});
|
|
59
67
|
})
|
package/es/ChatList/Item.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { ActionEvent } from "../ActionIconGroup";
|
|
2
3
|
import { type ChatItemProps } from "../ChatItem";
|
|
3
4
|
import { ChatMessage } from "../types/chatMessage";
|
|
4
5
|
import { LLMRoleType } from "../types/llm";
|
|
5
6
|
import { type ActionsBarProps } from './ActionsBar';
|
|
6
7
|
export type OnMessageChange = (id: string, content: string) => void;
|
|
7
|
-
export type OnActionClick = (
|
|
8
|
+
export type OnActionClick = (action: ActionEvent, message: ChatMessage) => void;
|
|
8
9
|
export type RenderRole = LLMRoleType | 'default' | string;
|
|
9
10
|
export type RenderItem = FC<{
|
|
10
11
|
key: string;
|
|
@@ -21,9 +22,7 @@ export interface ListItemProps {
|
|
|
21
22
|
/**
|
|
22
23
|
* @description 点击操作按钮的回调函数
|
|
23
24
|
*/
|
|
24
|
-
onActionsClick?:
|
|
25
|
-
[actionKey: string]: OnActionClick;
|
|
26
|
-
};
|
|
25
|
+
onActionsClick?: OnActionClick;
|
|
27
26
|
/**
|
|
28
27
|
* @description 消息变化的回调函数
|
|
29
28
|
*/
|
package/es/ChatList/Item.js
CHANGED
|
@@ -5,7 +5,7 @@ var _excluded = ["renderMessagesExtra", "showTitle", "onActionsClick", "onMessag
|
|
|
5
5
|
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; }
|
|
6
6
|
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; }
|
|
7
7
|
import { App } from 'antd';
|
|
8
|
-
import
|
|
8
|
+
import copy from 'copy-to-clipboard';
|
|
9
9
|
import { memo, useCallback, useMemo, useState } from 'react';
|
|
10
10
|
import ChatItem from "../ChatItem";
|
|
11
11
|
import ActionsBar from "./ActionsBar";
|
|
@@ -77,20 +77,24 @@ var Item = /*#__PURE__*/memo(function (props) {
|
|
|
77
77
|
if (renderActions !== null && renderActions !== void 0 && renderActions[item.role]) RenderFunction = renderActions[item.role];
|
|
78
78
|
if (renderActions !== null && renderActions !== void 0 && renderActions['default']) RenderFunction = renderActions['default'];
|
|
79
79
|
if (!RenderFunction) RenderFunction = ActionsBar;
|
|
80
|
-
var handleActionClick =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
var handleActionClick = function handleActionClick(action, data) {
|
|
81
|
+
switch (action.key) {
|
|
82
|
+
case 'copy':
|
|
83
|
+
{
|
|
84
|
+
copy(data.content);
|
|
85
|
+
message.success((text === null || text === void 0 ? void 0 : text.copySuccess) || 'Copy Success');
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case 'edit':
|
|
89
|
+
{
|
|
90
|
+
setEditing(true);
|
|
91
|
+
}
|
|
88
92
|
}
|
|
89
|
-
|
|
93
|
+
onActionsClick === null || onActionsClick === void 0 ? void 0 : onActionsClick(action, data);
|
|
94
|
+
};
|
|
90
95
|
return /*#__PURE__*/_jsx(RenderFunction, _objectSpread(_objectSpread({}, data), {}, {
|
|
91
96
|
onActionClick: function onActionClick(actionKey) {
|
|
92
|
-
|
|
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);
|
|
97
|
+
return handleActionClick === null || handleActionClick === void 0 ? void 0 : handleActionClick(actionKey, data);
|
|
94
98
|
},
|
|
95
99
|
text: text
|
|
96
100
|
}));
|
|
@@ -4,9 +4,8 @@ var _excluded = ["children", "customStylish", "customToken", "enableWebfonts", "
|
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
6
|
import { App } from 'antd';
|
|
7
|
-
import { ThemeProvider as AntdThemeProvider, StyleProvider
|
|
8
|
-
import { memo, useCallback
|
|
9
|
-
import { ThemeContext } from 'styled-components';
|
|
7
|
+
import { ThemeProvider as AntdThemeProvider, StyleProvider } from 'antd-style';
|
|
8
|
+
import { memo, useCallback } from 'react';
|
|
10
9
|
import { useCdnFn } from "../ConfigProvider";
|
|
11
10
|
import FontLoader from "../FontLoader";
|
|
12
11
|
import { lobeCustomStylish, lobeCustomToken } from "../styles";
|
|
@@ -43,11 +42,6 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
42
|
pkg: 'katex',
|
|
44
43
|
version: '0.16.8'
|
|
45
44
|
})];
|
|
46
|
-
useEffect(function () {
|
|
47
|
-
setupStyled({
|
|
48
|
-
ThemeContext: ThemeContext
|
|
49
|
-
});
|
|
50
|
-
}, []);
|
|
51
45
|
var stylish = useCallback(function (theme) {
|
|
52
46
|
return _objectSpread(_objectSpread({}, lobeCustomStylish(theme)), customStylish === null || customStylish === void 0 ? void 0 : customStylish(theme));
|
|
53
47
|
}, [customStylish]);
|
package/es/types/global.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import 'antd-style';
|
|
2
|
-
import { AntdToken } from 'antd-style/lib/types/theme';
|
|
3
2
|
|
|
4
3
|
import { LobeCustomStylish } from './customStylish';
|
|
5
4
|
import { LobeCustomToken } from './customToken';
|
|
@@ -10,7 +9,3 @@ declare module 'antd-style' {
|
|
|
10
9
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
11
10
|
export interface CustomStylish extends LobeCustomStylish {}
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
declare module 'styled-components' {
|
|
15
|
-
export interface DefaultTheme extends AntdToken, LobeCustomToken {}
|
|
16
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.106.
|
|
3
|
+
"version": "1.106.2",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -105,7 +105,6 @@
|
|
|
105
105
|
"remark-gfm": "^3",
|
|
106
106
|
"remark-math": "^5",
|
|
107
107
|
"shikiji": "^0",
|
|
108
|
-
"styled-components": "^6",
|
|
109
108
|
"swr": "^2",
|
|
110
109
|
"three": "^0.150",
|
|
111
110
|
"ts-md5": "^1",
|
|
@@ -143,6 +142,7 @@
|
|
|
143
142
|
"remark": "^14",
|
|
144
143
|
"remark-cli": "^11",
|
|
145
144
|
"semantic-release": "^21",
|
|
145
|
+
"styled-components": "^6",
|
|
146
146
|
"stylelint": "^15",
|
|
147
147
|
"typescript": "^5",
|
|
148
148
|
"vitest": "latest"
|