@yuntijs/ui 1.0.0-beta.59 → 1.0.0-beta.60

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.
@@ -70,6 +70,6 @@ export interface EditableMessageProps {
70
70
  * @title The current text value
71
71
  */
72
72
  value: string;
73
- markdownProps?: MarkdownProps;
73
+ markdownProps?: Omit<MarkdownProps, 'children'>;
74
74
  }
75
75
  export declare const EditableMessage: import("react").NamedExoticComponent<EditableMessageProps>;
@@ -2,5 +2,9 @@ import React from 'react';
2
2
  import { DivProps } from 'react-layout-kit';
3
3
  import type { LazyLogProps } from './types';
4
4
  export interface LogViewerProps extends Omit<LazyLogProps, 'iconFilterLines' | 'iconFindNext' | 'iconFindPrevious'>, Pick<DivProps, 'className' | 'id' | 'style'> {
5
+ /**
6
+ * Timed refresh, in ms, only takes effect when url is specified and not websocket
7
+ */
8
+ refreshInterval?: number;
5
9
  }
6
10
  export declare const LogViewer: React.FC<LogViewerProps>;
@@ -1,12 +1,13 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["className", "id", "style", "height", "onScroll"];
4
+ var _excluded = ["className", "id", "style", "height", "onScroll", "url", "websocket", "refreshInterval"];
4
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; }
5
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; }
6
7
  import { Icon } from '@lobehub/ui';
7
8
  import { LazyLog, ScrollFollow } from '@melloware/react-logviewer';
8
9
  import { ArrowDown, ArrowUp, TextSearch } from 'lucide-react';
9
- import React from 'react';
10
+ import React, { useEffect, useMemo, useState } from 'react';
10
11
  import { useStyles } from "./style";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  export var LogViewer = function LogViewer(_ref) {
@@ -15,10 +16,33 @@ export var LogViewer = function LogViewer(_ref) {
15
16
  style = _ref.style,
16
17
  height = _ref.height,
17
18
  _onScroll = _ref.onScroll,
19
+ urlFromProps = _ref.url,
20
+ websocket = _ref.websocket,
21
+ refreshInterval = _ref.refreshInterval,
18
22
  props = _objectWithoutProperties(_ref, _excluded);
19
23
  var _useStyles = useStyles(),
20
24
  cx = _useStyles.cx,
21
25
  styles = _useStyles.styles;
26
+ var _useState = useState(0),
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ urlHash = _useState2[0],
29
+ setUrlHash = _useState2[1];
30
+ useEffect(function () {
31
+ var intervalTimeout;
32
+ if (urlFromProps && !websocket && refreshInterval) {
33
+ intervalTimeout = setInterval(function () {
34
+ setUrlHash(function (hash) {
35
+ return hash + 1;
36
+ });
37
+ }, refreshInterval);
38
+ }
39
+ return function () {
40
+ clearInterval(intervalTimeout);
41
+ };
42
+ }, [refreshInterval, urlFromProps, websocket]);
43
+ var url = useMemo(function () {
44
+ return "".concat(urlFromProps, "#").concat(urlHash);
45
+ }, [urlFromProps, urlHash]);
22
46
  return /*#__PURE__*/_jsx("div", {
23
47
  className: cx(styles.root, className),
24
48
  id: id,
@@ -29,7 +53,10 @@ export var LogViewer = function LogViewer(_ref) {
29
53
  render: function render(_ref2) {
30
54
  var follow = _ref2.follow,
31
55
  onFollowScroll = _ref2.onScroll;
32
- return /*#__PURE__*/_jsx(LazyLog, _objectSpread(_objectSpread({}, props), {}, {
56
+ return /*#__PURE__*/_jsx(LazyLog, _objectSpread(_objectSpread({
57
+ url: url,
58
+ websocket: websocket
59
+ }, props), {}, {
33
60
  follow: follow,
34
61
  height: height,
35
62
  iconFilterLines: /*#__PURE__*/_jsx(Icon, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuntijs/ui",
3
- "version": "1.0.0-beta.59",
3
+ "version": "1.0.0-beta.60",
4
4
  "description": "☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps",
5
5
  "keywords": [
6
6
  "yuntijs",
@@ -87,7 +87,7 @@
87
87
  "@lexical/text": "^0.16.1",
88
88
  "@lexical/utils": "^0.16.1",
89
89
  "@lobehub/ui": "^1.147.0",
90
- "@melloware/react-logviewer": "^5.1.1",
90
+ "@melloware/react-logviewer": "^5.2.0",
91
91
  "@monaco-editor/loader": "^1.4.0",
92
92
  "@shikijs/transformers": "^1.10.3",
93
93
  "leva": "^0",
@@ -117,7 +117,7 @@
117
117
  "commitlint": "^18",
118
118
  "dayjs": "^1.11.10",
119
119
  "dumi": "^2.4.7",
120
- "dumi-theme-yunti": "^1.1.7",
120
+ "dumi-theme-yunti": "^1.1.8",
121
121
  "eslint": "^8.56.0",
122
122
  "father": "^4.3.8",
123
123
  "husky": "^8",