@lobehub/ui 1.38.1 → 1.38.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.
|
@@ -24,7 +24,7 @@ export interface ActionIconGroupProps extends DivProps {
|
|
|
24
24
|
* @default []
|
|
25
25
|
*/
|
|
26
26
|
items?: ActionIconGroupItems[];
|
|
27
|
-
onActionClick
|
|
27
|
+
onActionClick?: (key: string) => void;
|
|
28
28
|
/**
|
|
29
29
|
* @description The position of the tooltip relative to the target
|
|
30
30
|
* @enum ["top","left","right","bottom","topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]
|
|
@@ -22,8 +22,7 @@ var ActionIconGroup = /*#__PURE__*/memo(function (_ref) {
|
|
|
22
22
|
direction = _ref$direction === void 0 ? 'row' : _ref$direction,
|
|
23
23
|
_ref$dropdownMenu = _ref.dropdownMenu,
|
|
24
24
|
dropdownMenu = _ref$dropdownMenu === void 0 ? [] : _ref$dropdownMenu,
|
|
25
|
-
|
|
26
|
-
onActionClick = _ref$onActionClick === void 0 ? function () {} : _ref$onActionClick,
|
|
25
|
+
onActionClick = _ref.onActionClick,
|
|
27
26
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
27
|
var _useStyles = useStyles({
|
|
29
28
|
direction: direction,
|
|
@@ -37,9 +36,9 @@ var ActionIconGroup = /*#__PURE__*/memo(function (_ref) {
|
|
|
37
36
|
children: [spotlight && /*#__PURE__*/_jsx(Spotlight, {}), items.map(function (item) {
|
|
38
37
|
return /*#__PURE__*/_jsx(ActionIcon, {
|
|
39
38
|
icon: item.icon,
|
|
40
|
-
onClick: function
|
|
41
|
-
return onActionClick(item.key);
|
|
42
|
-
},
|
|
39
|
+
onClick: onActionClick ? function () {
|
|
40
|
+
return onActionClick === null || onActionClick === void 0 ? void 0 : onActionClick(item.key);
|
|
41
|
+
} : undefined,
|
|
43
42
|
placement: tooltipsPlacement,
|
|
44
43
|
size: "small",
|
|
45
44
|
title: item.label
|
|
@@ -53,9 +52,9 @@ var ActionIconGroup = /*#__PURE__*/memo(function (_ref) {
|
|
|
53
52
|
icon: item.icon,
|
|
54
53
|
size: "small"
|
|
55
54
|
}),
|
|
56
|
-
onClick: function
|
|
55
|
+
onClick: onActionClick ? function () {
|
|
57
56
|
return onActionClick(item.key);
|
|
58
|
-
}
|
|
57
|
+
} : undefined
|
|
59
58
|
});
|
|
60
59
|
})
|
|
61
60
|
},
|
package/es/ChatList/index.js
CHANGED
|
@@ -9,8 +9,7 @@ import ActionsBar from "./ActionsBar";
|
|
|
9
9
|
import { useStyles } from "./style";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
var ChatList = /*#__PURE__*/memo(function (_ref) {
|
|
12
|
-
var
|
|
13
|
-
_onActionClick = _ref$onActionClick === void 0 ? function () {} : _ref$onActionClick,
|
|
12
|
+
var onActionClick = _ref.onActionClick,
|
|
14
13
|
className = _ref.className,
|
|
15
14
|
data = _ref.data,
|
|
16
15
|
_ref$type = _ref.type,
|
|
@@ -26,9 +25,9 @@ var ChatList = /*#__PURE__*/memo(function (_ref) {
|
|
|
26
25
|
children: data.map(function (item) {
|
|
27
26
|
return /*#__PURE__*/_jsx(ChatItem, {
|
|
28
27
|
actions: /*#__PURE__*/_jsx(ActionsBar, {
|
|
29
|
-
onActionClick: function
|
|
30
|
-
return
|
|
31
|
-
},
|
|
28
|
+
onActionClick: onActionClick ? function (actionKey) {
|
|
29
|
+
return onActionClick === null || onActionClick === void 0 ? void 0 : onActionClick(actionKey, item.id);
|
|
30
|
+
} : undefined,
|
|
32
31
|
primary: item.role === 'user'
|
|
33
32
|
}),
|
|
34
33
|
avatar: item.meta,
|
|
@@ -3,7 +3,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
3
3
|
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; }
|
|
4
4
|
import { App } from 'antd';
|
|
5
5
|
import { ThemeProvider as AntdThemeProvider, StyleProvider, setupStyled } from 'antd-style';
|
|
6
|
-
import { memo } from 'react';
|
|
6
|
+
import { memo, useCallback, useEffect } from 'react';
|
|
7
7
|
import { ThemeContext } from 'styled-components';
|
|
8
8
|
import FontLoader from "../FontLoader";
|
|
9
9
|
import { lobeCustomStylish, lobeCustomToken, lobeTheme } from "../styles";
|
|
@@ -14,21 +14,31 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
14
14
|
var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
|
|
15
15
|
var children = _ref.children,
|
|
16
16
|
themeMode = _ref.themeMode,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return {};
|
|
20
|
-
} : _ref$customStylish,
|
|
21
|
-
_ref$customToken = _ref.customToken,
|
|
22
|
-
_customToken = _ref$customToken === void 0 ? function () {
|
|
23
|
-
return {};
|
|
24
|
-
} : _ref$customToken,
|
|
17
|
+
customStylish = _ref.customStylish,
|
|
18
|
+
customToken = _ref.customToken,
|
|
25
19
|
_ref$enableWebfonts = _ref.enableWebfonts,
|
|
26
20
|
enableWebfonts = _ref$enableWebfonts === void 0 ? true : _ref$enableWebfonts,
|
|
27
21
|
_ref$webfonts = _ref.webfonts,
|
|
28
22
|
webfonts = _ref$webfonts === void 0 ? ['https://npm.elemecdn.com/@lobehub/webfont-mono/css/index.css', 'https://npm.elemecdn.com/@lobehub/webfont-harmony-sans/css/index.css', 'https://npm.elemecdn.com/@lobehub/webfont-harmony-sans-sc/css/index.css'] : _ref$webfonts;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
setupStyled({
|
|
25
|
+
ThemeContext: ThemeContext
|
|
26
|
+
});
|
|
27
|
+
}, []);
|
|
28
|
+
var stylish = useCallback(function (theme) {
|
|
29
|
+
var stylish = {};
|
|
30
|
+
if (customStylish) {
|
|
31
|
+
stylish = customStylish(theme);
|
|
32
|
+
}
|
|
33
|
+
return _objectSpread(_objectSpread({}, lobeCustomStylish(theme)), stylish);
|
|
34
|
+
}, [customStylish]);
|
|
35
|
+
var token = useCallback(function (theme) {
|
|
36
|
+
var token = {};
|
|
37
|
+
if (customToken) {
|
|
38
|
+
token = customToken(theme);
|
|
39
|
+
}
|
|
40
|
+
return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), token);
|
|
41
|
+
}, [customToken]);
|
|
32
42
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
33
43
|
children: [enableWebfonts && (webfonts === null || webfonts === void 0 ? void 0 : webfonts.length) > 0 && webfonts.map(function (webfont, index) {
|
|
34
44
|
return /*#__PURE__*/_jsx(FontLoader, {
|
|
@@ -37,12 +47,8 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
|
|
|
37
47
|
}), /*#__PURE__*/_jsx(StyleProvider, {
|
|
38
48
|
speedy: process.env.NODE_ENV === 'production',
|
|
39
49
|
children: /*#__PURE__*/_jsxs(AntdThemeProvider, {
|
|
40
|
-
customStylish:
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
customToken: function customToken(theme) {
|
|
44
|
-
return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), _customToken(theme));
|
|
45
|
-
},
|
|
50
|
+
customStylish: stylish,
|
|
51
|
+
customToken: token,
|
|
46
52
|
theme: lobeTheme,
|
|
47
53
|
themeMode: themeMode,
|
|
48
54
|
children: [/*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(App, {
|