@lobehub/ui 1.106.2 → 1.107.0
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/Avatar/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "avatar", "title", "animation", "size", "shape", "background"];
|
|
3
|
+
var _excluded = ["className", "avatar", "title", "animation", "size", "shape", "background", "onClick", "style"];
|
|
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 { Avatar as AntAvatar } from 'antd';
|
|
@@ -20,6 +20,8 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
20
20
|
shape = _ref$shape === void 0 ? 'circle' : _ref$shape,
|
|
21
21
|
_ref$background = _ref.background,
|
|
22
22
|
background = _ref$background === void 0 ? 'rgba(0,0,0,0)' : _ref$background,
|
|
23
|
+
onClick = _ref.onClick,
|
|
24
|
+
style = _ref.style,
|
|
23
25
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
26
|
var isImage = Boolean(avatar && ['/', 'http', 'data:'].some(function (index) {
|
|
25
27
|
return avatar.startsWith(index);
|
|
@@ -36,17 +38,18 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
36
38
|
styles = _useStyles.styles,
|
|
37
39
|
cx = _useStyles.cx;
|
|
38
40
|
var text = String(isImage ? title : avatar);
|
|
39
|
-
|
|
41
|
+
var avatarProps = {
|
|
40
42
|
className: cx(styles.avatar, className),
|
|
41
43
|
shape: shape,
|
|
42
44
|
size: size,
|
|
45
|
+
style: onClick ? style : _objectSpread({
|
|
46
|
+
cursor: 'default'
|
|
47
|
+
}, style)
|
|
48
|
+
};
|
|
49
|
+
return isImage ? /*#__PURE__*/_jsx(AntAvatar, _objectSpread(_objectSpread({
|
|
43
50
|
src: isBase64 ? avatar : undefined,
|
|
44
51
|
srcSet: isBase64 ? undefined : avatar
|
|
45
|
-
}, props)) : /*#__PURE__*/_jsx(AntAvatar, _objectSpread(_objectSpread({
|
|
46
|
-
className: cx(styles.avatar, className),
|
|
47
|
-
shape: shape,
|
|
48
|
-
size: size
|
|
49
|
-
}, props), {}, {
|
|
52
|
+
}, avatarProps), props)) : /*#__PURE__*/_jsx(AntAvatar, _objectSpread(_objectSpread(_objectSpread({}, avatarProps), props), {}, {
|
|
50
53
|
children: emoji ? /*#__PURE__*/_jsx(FluentEmoji, {
|
|
51
54
|
emoji: emoji,
|
|
52
55
|
size: size * 0.8,
|
|
@@ -25,6 +25,10 @@ export interface EditableMessageProps {
|
|
|
25
25
|
fullFeaturedCodeBlock?: boolean;
|
|
26
26
|
height?: MessageInputProps['height'];
|
|
27
27
|
inputType?: MessageInputProps['type'];
|
|
28
|
+
model?: {
|
|
29
|
+
extra?: MessageModalProps['extra'];
|
|
30
|
+
footer?: MessageModalProps['footer'];
|
|
31
|
+
};
|
|
28
32
|
/**
|
|
29
33
|
* @title Callback function when the value changes
|
|
30
34
|
* @param value - The new value
|
|
@@ -28,7 +28,8 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
28
28
|
inputType = _ref.inputType,
|
|
29
29
|
editButtonSize = _ref.editButtonSize,
|
|
30
30
|
text = _ref.text,
|
|
31
|
-
fullFeaturedCodeBlock = _ref.fullFeaturedCodeBlock
|
|
31
|
+
fullFeaturedCodeBlock = _ref.fullFeaturedCodeBlock,
|
|
32
|
+
model = _ref.model;
|
|
32
33
|
var _useControlledState = useControlledState(false, {
|
|
33
34
|
onChange: onEditingChange,
|
|
34
35
|
value: editing
|
|
@@ -78,6 +79,8 @@ var EditableMessage = /*#__PURE__*/memo(function (_ref) {
|
|
|
78
79
|
children: value || placeholder
|
|
79
80
|
}), /*#__PURE__*/_jsx(MessageModal, {
|
|
80
81
|
editing: isEdit,
|
|
82
|
+
extra: model === null || model === void 0 ? void 0 : model.extra,
|
|
83
|
+
footer: model === null || model === void 0 ? void 0 : model.footer,
|
|
81
84
|
height: height,
|
|
82
85
|
onChange: function onChange(text) {
|
|
83
86
|
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(text);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { type MessageInputProps } from "../MessageInput";
|
|
3
|
-
|
|
3
|
+
import { type ModalProps } from "../Modal";
|
|
4
|
+
export interface MessageModalProps extends Pick<ModalProps, 'open' | 'footer'> {
|
|
4
5
|
/**
|
|
5
6
|
* @description Whether the message is being edited or not
|
|
6
7
|
* @default false
|
|
7
8
|
*/
|
|
8
9
|
editing?: boolean;
|
|
10
|
+
extra?: ReactNode;
|
|
9
11
|
height?: MessageInputProps['height'];
|
|
10
12
|
/**
|
|
11
13
|
* @description Callback fired when message content is changed
|
|
@@ -23,7 +25,6 @@ export interface MessageModalProps {
|
|
|
23
25
|
* @description Whether the modal is open or not
|
|
24
26
|
* @default false
|
|
25
27
|
*/
|
|
26
|
-
open?: boolean;
|
|
27
28
|
placeholder?: string;
|
|
28
29
|
text?: {
|
|
29
30
|
cancel?: string;
|
package/es/MessageModal/index.js
CHANGED
|
@@ -9,6 +9,8 @@ import Markdown from "../Markdown";
|
|
|
9
9
|
import MessageInput from "../MessageInput";
|
|
10
10
|
import Modal from "../Modal";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
14
|
var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
13
15
|
var editing = _ref.editing,
|
|
14
16
|
open = _ref.open,
|
|
@@ -19,7 +21,9 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
19
21
|
placeholder = _ref.placeholder,
|
|
20
22
|
value = _ref.value,
|
|
21
23
|
onChange = _ref.onChange,
|
|
22
|
-
text = _ref.text
|
|
24
|
+
text = _ref.text,
|
|
25
|
+
footer = _ref.footer,
|
|
26
|
+
extra = _ref.extra;
|
|
23
27
|
var _useResponsive = useResponsive(),
|
|
24
28
|
mobile = _useResponsive.mobile;
|
|
25
29
|
var _useControlledState = useControlledState(false, {
|
|
@@ -44,7 +48,7 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
44
48
|
};
|
|
45
49
|
return /*#__PURE__*/_jsx(Modal, {
|
|
46
50
|
cancelText: (text === null || text === void 0 ? void 0 : text.cancel) || 'Cancel',
|
|
47
|
-
footer: isEdit ? null :
|
|
51
|
+
footer: isEdit ? null : footer,
|
|
48
52
|
okText: (text === null || text === void 0 ? void 0 : text.edit) || 'Edit',
|
|
49
53
|
onCancel: function onCancel() {
|
|
50
54
|
return setExpand(false);
|
|
@@ -75,11 +79,13 @@ var MessageModal = /*#__PURE__*/memo(function (_ref) {
|
|
|
75
79
|
confirm: text === null || text === void 0 ? void 0 : text.confirm
|
|
76
80
|
},
|
|
77
81
|
type: 'block'
|
|
78
|
-
}) : /*#__PURE__*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
83
|
+
children: [extra, /*#__PURE__*/_jsx(Markdown, {
|
|
84
|
+
style: value ? markdownStyle : _objectSpread(_objectSpread({}, markdownStyle), {}, {
|
|
85
|
+
opacity: 0.5
|
|
86
|
+
}),
|
|
87
|
+
children: String(value || placeholder)
|
|
88
|
+
})]
|
|
83
89
|
})
|
|
84
90
|
});
|
|
85
91
|
});
|