@yuntijs/ui 1.0.0-beta.60 → 1.0.0-beta.62
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/ChatItem/components/MessageContent.d.ts +2 -2
- package/es/ChatItem/type.d.ts +3 -2
- package/es/LogViewer/index.d.ts +1 -1
- package/es/LogViewer/index.js +38 -6
- package/es/LogViewer/style.d.ts +1 -0
- package/es/LogViewer/style.js +4 -3
- package/package.json +1 -1
- package/umd/index.min.js +1 -1
- package/umd/index.min.js.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MarkdownProps } from '@lobehub/ui';
|
|
2
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import { EditableMessageProps } from "../../EditableMessage";
|
|
3
3
|
import { ChatItemProps } from '../type';
|
|
4
4
|
export interface MessageContentProps {
|
|
5
5
|
editing?: ChatItemProps['editing'];
|
|
@@ -14,7 +14,7 @@ export interface MessageContentProps {
|
|
|
14
14
|
renderMessage?: ChatItemProps['renderMessage'];
|
|
15
15
|
text?: ChatItemProps['text'];
|
|
16
16
|
type?: ChatItemProps['type'];
|
|
17
|
-
markdownProps?:
|
|
17
|
+
markdownProps?: EditableMessageProps['markdownProps'];
|
|
18
18
|
markdownClassname?: string;
|
|
19
19
|
}
|
|
20
20
|
declare const MessageContent: import("react").NamedExoticComponent<MessageContentProps>;
|
package/es/ChatItem/type.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AlertProps, AvatarProps, DivProps,
|
|
1
|
+
import { AlertProps, AvatarProps, DivProps, MetaData } from '@lobehub/ui';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
import type { EditableMessageProps } from "../EditableMessage";
|
|
3
4
|
export interface ChatItemProps {
|
|
4
5
|
/**
|
|
5
6
|
* @description Actions to be displayed in the chat item
|
|
@@ -73,7 +74,7 @@ export interface ChatItemProps {
|
|
|
73
74
|
/**
|
|
74
75
|
* @description The markdownProps of the chat item
|
|
75
76
|
*/
|
|
76
|
-
markdownProps?:
|
|
77
|
+
markdownProps?: EditableMessageProps['markdownProps'];
|
|
77
78
|
/**
|
|
78
79
|
* @description The markdownClassname of the chat item
|
|
79
80
|
*/
|
package/es/LogViewer/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DivProps } from 'react-layout-kit';
|
|
3
3
|
import type { LazyLogProps } from './types';
|
|
4
|
-
export interface LogViewerProps extends Omit<LazyLogProps, 'iconFilterLines' | 'iconFindNext' | 'iconFindPrevious'>, Pick<DivProps, 'className' | 'id' | 'style'> {
|
|
4
|
+
export interface LogViewerProps extends Omit<LazyLogProps, 'iconFilterLines' | 'iconFindNext' | 'iconFindPrevious' | 'loadingComponent'>, Pick<DivProps, 'className' | 'id' | 'style'> {
|
|
5
5
|
/**
|
|
6
6
|
* Timed refresh, in ms, only takes effect when url is specified and not websocket
|
|
7
7
|
*/
|
package/es/LogViewer/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["className", "id", "style", "height", "onScroll", "url", "websocket", "refreshInterval"];
|
|
4
|
+
var _excluded = ["className", "id", "style", "height", "onScroll", "url", "websocket", "refreshInterval", "onLoad", "onError"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import { Icon } from '@lobehub/ui';
|
|
8
8
|
import { LazyLog, ScrollFollow } from '@melloware/react-logviewer';
|
|
9
|
-
import { ArrowDown, ArrowUp, TextSearch } from 'lucide-react';
|
|
10
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
9
|
+
import { ArrowDown, ArrowUp, LoaderCircle, TextSearch } from 'lucide-react';
|
|
10
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
11
11
|
import { useStyles } from "./style";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
export var LogViewer = function LogViewer(_ref) {
|
|
14
15
|
var className = _ref.className,
|
|
15
16
|
id = _ref.id,
|
|
@@ -19,6 +20,8 @@ export var LogViewer = function LogViewer(_ref) {
|
|
|
19
20
|
urlFromProps = _ref.url,
|
|
20
21
|
websocket = _ref.websocket,
|
|
21
22
|
refreshInterval = _ref.refreshInterval,
|
|
23
|
+
onLoad = _ref.onLoad,
|
|
24
|
+
onError = _ref.onError,
|
|
22
25
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
26
|
var _useStyles = useStyles(),
|
|
24
27
|
cx = _useStyles.cx,
|
|
@@ -27,6 +30,16 @@ export var LogViewer = function LogViewer(_ref) {
|
|
|
27
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
31
|
urlHash = _useState2[0],
|
|
29
32
|
setUrlHash = _useState2[1];
|
|
33
|
+
var _useState3 = useState(false),
|
|
34
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
|
+
loading = _useState4[0],
|
|
36
|
+
setLoading = _useState4[1];
|
|
37
|
+
var setLoadingTimeout = useRef();
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
return function () {
|
|
40
|
+
clearTimeout(setLoadingTimeout.current);
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
30
43
|
useEffect(function () {
|
|
31
44
|
var intervalTimeout;
|
|
32
45
|
if (urlFromProps && !websocket && refreshInterval) {
|
|
@@ -41,15 +54,28 @@ export var LogViewer = function LogViewer(_ref) {
|
|
|
41
54
|
};
|
|
42
55
|
}, [refreshInterval, urlFromProps, websocket]);
|
|
43
56
|
var url = useMemo(function () {
|
|
57
|
+
// workaround for onLoad exec twice
|
|
58
|
+
setLoadingTimeout.current = setTimeout(function () {
|
|
59
|
+
setLoading(true);
|
|
60
|
+
setLoadingTimeout.current = undefined;
|
|
61
|
+
}, 50);
|
|
44
62
|
return "".concat(urlFromProps, "#").concat(urlHash);
|
|
45
63
|
}, [urlFromProps, urlHash]);
|
|
46
|
-
|
|
64
|
+
var handleOnLoad = useCallback(function () {
|
|
65
|
+
setLoading(false);
|
|
66
|
+
onLoad === null || onLoad === void 0 || onLoad();
|
|
67
|
+
}, [onLoad]);
|
|
68
|
+
var handleOnError = useCallback(function (error) {
|
|
69
|
+
setLoading(false);
|
|
70
|
+
onError === null || onError === void 0 || onError(error);
|
|
71
|
+
}, [onError]);
|
|
72
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
47
73
|
className: cx(styles.root, className),
|
|
48
74
|
id: id,
|
|
49
75
|
style: _objectSpread({
|
|
50
76
|
height: height
|
|
51
77
|
}, style),
|
|
52
|
-
children: /*#__PURE__*/_jsx(ScrollFollow, {
|
|
78
|
+
children: [/*#__PURE__*/_jsx(ScrollFollow, {
|
|
53
79
|
render: function render(_ref2) {
|
|
54
80
|
var follow = _ref2.follow,
|
|
55
81
|
onFollowScroll = _ref2.onScroll;
|
|
@@ -71,6 +97,8 @@ export var LogViewer = function LogViewer(_ref) {
|
|
|
71
97
|
className: styles.searchBarIcon,
|
|
72
98
|
icon: ArrowUp
|
|
73
99
|
}),
|
|
100
|
+
onError: handleOnError,
|
|
101
|
+
onLoad: handleOnLoad,
|
|
74
102
|
onScroll: function onScroll(args) {
|
|
75
103
|
onFollowScroll(args);
|
|
76
104
|
_onScroll === null || _onScroll === void 0 || _onScroll(args);
|
|
@@ -78,6 +106,10 @@ export var LogViewer = function LogViewer(_ref) {
|
|
|
78
106
|
}));
|
|
79
107
|
},
|
|
80
108
|
startFollowing: true
|
|
81
|
-
})
|
|
109
|
+
}), loading && /*#__PURE__*/_jsx(Icon, {
|
|
110
|
+
className: styles.loader,
|
|
111
|
+
icon: LoaderCircle,
|
|
112
|
+
spin: true
|
|
113
|
+
})]
|
|
82
114
|
});
|
|
83
115
|
};
|
package/es/LogViewer/style.d.ts
CHANGED
package/es/LogViewer/style.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token;
|
|
7
7
|
var bgColor = '#222222';
|
|
8
8
|
return {
|
|
9
|
-
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: ", "px;\n .react-lazylog-searchbar {\n margin-bottom: ", "px;\n padding: ", "px;\n\n background-color: ", ";\n border-bottom: 1px solid #2d2d2d;\n border-top-left-radius: ", "px;\n border-top-right-radius: ", "px;\n & > input {\n border-radius: ", "px;\n }\n & > button {\n cursor: pointer;\n padding: 2px 6px;\n border-radius: ", "px;\n }\n &-up-arrow {\n margin-right: 0;\n }\n }\n .react-lazylog {\n background-color: ", ";\n border-radius: ", "px;\n .log-number {\n margin-right: 0;\n }\n .log-content {\n margin-left: 15px;\n }\n }\n "])), bgColor, token.borderRadiusLG, token.marginXXS, token.paddingXS, bgColor, token.borderRadiusLG, token.borderRadiusLG, token.borderRadius, token.borderRadius, bgColor, token.borderRadiusLG),
|
|
10
|
-
searchBarIcon: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 16px;\n "])))
|
|
9
|
+
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n background-color: ", ";\n border-radius: ", "px;\n\n .react-lazylog-searchbar {\n margin-bottom: ", "px;\n padding: ", "px;\n\n background-color: ", ";\n border-bottom: 1px solid #2d2d2d;\n border-top-left-radius: ", "px;\n border-top-right-radius: ", "px;\n & > input {\n border-radius: ", "px;\n }\n & > button {\n cursor: pointer;\n padding: 2px 6px;\n border-radius: ", "px;\n }\n &-up-arrow {\n margin-right: 0;\n }\n }\n .react-lazylog {\n scrollbar-color: rgba(255, 255, 255, 0.2) transparent;\n scrollbar-width: auto;\n background-color: ", ";\n border-radius: ", "px;\n\n .log-number {\n margin-right: 0;\n }\n .log-content {\n margin-left: 15px;\n }\n }\n "])), bgColor, token.borderRadiusLG, token.marginXXS, token.paddingXS, bgColor, token.borderRadiusLG, token.borderRadiusLG, token.borderRadius, token.borderRadius, bgColor, token.borderRadiusLG),
|
|
10
|
+
searchBarIcon: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 16px;\n "]))),
|
|
11
|
+
loader: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n right: ", "px;\n bottom: ", "px;\n\n font-size: 18px;\n color: #999;\n "])), token.marginSM, token.marginSM)
|
|
11
12
|
};
|
|
12
13
|
}, {
|
|
13
14
|
hashPriority: 'low'
|