@yuntijs/ui 1.0.0-beta.65 → 1.0.0-beta.67

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.
@@ -35,10 +35,16 @@ export var LogViewer = function LogViewer(_ref) {
35
35
  _useState4 = _slicedToArray(_useState3, 2),
36
36
  loading = _useState4[0],
37
37
  setLoading = _useState4[1];
38
+ var _useState5 = useState(false),
39
+ _useState6 = _slicedToArray(_useState5, 2),
40
+ followAfterLoaded = _useState6[0],
41
+ setFollowAfterLoaded = _useState6[1];
38
42
  var setLoadingTimeout = useRef();
43
+ var setFollowAfterLoadedTimeout = useRef();
39
44
  useEffect(function () {
40
45
  return function () {
41
46
  clearTimeout(setLoadingTimeout.current);
47
+ clearTimeout(setFollowAfterLoadedTimeout.current);
42
48
  };
43
49
  }, []);
44
50
  useEffect(function () {
@@ -55,6 +61,9 @@ export var LogViewer = function LogViewer(_ref) {
55
61
  };
56
62
  }, [refreshInterval, urlFromProps, websocket]);
57
63
  var url = useMemo(function () {
64
+ if (!urlFromProps) {
65
+ return urlFromProps;
66
+ }
58
67
  // workaround for onLoad exec twice
59
68
  setLoadingTimeout.current = setTimeout(function () {
60
69
  setLoading(true);
@@ -63,11 +72,22 @@ export var LogViewer = function LogViewer(_ref) {
63
72
  return "".concat(urlFromProps, "#").concat(urlHash);
64
73
  }, [urlFromProps, urlHash]);
65
74
  var handleOnLoad = useCallback(function () {
75
+ // if has log line clear setLoading timeout
76
+ if (document.querySelector('.react-lazylog .log-line')) {
77
+ clearTimeout(setLoadingTimeout.current);
78
+ }
66
79
  setLoading(false);
80
+
81
+ // scroll to bottom
82
+ setFollowAfterLoaded(true);
83
+ setFollowAfterLoadedTimeout.current = setTimeout(function () {
84
+ return setFollowAfterLoaded(false);
85
+ }, 100);
67
86
  onLoad === null || onLoad === void 0 || onLoad();
68
87
  }, [onLoad]);
69
88
  var handleOnError = useCallback(function (error) {
70
89
  setLoading(false);
90
+ clearTimeout(setLoadingTimeout.current);
71
91
  onError === null || onError === void 0 || onError(error);
72
92
  }, [onError]);
73
93
  return /*#__PURE__*/_jsxs("div", {
@@ -84,7 +104,7 @@ export var LogViewer = function LogViewer(_ref) {
84
104
  url: url,
85
105
  websocket: websocket
86
106
  }, props), {}, {
87
- follow: follow,
107
+ follow: followAfterLoaded || follow,
88
108
  height: height,
89
109
  iconFilterLines: /*#__PURE__*/_jsx(Icon, {
90
110
  className: styles.searchBarIcon,
@@ -35,7 +35,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
35
35
  var _getNumberBySize = getNumberBySize(size),
36
36
  cardWidth = _getNumberBySize.cardWidth;
37
37
  return {
38
- option: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n\n cursor: ", ";\n\n padding: ", "px;\n\n transition: all ", ";\n\n width: ", "px;\n min-height: 108px;\n\n ", "\n\n ", "\n\n div.", "-typography {\n margin-bottom: 0;\n }\n "])), token.colorBorderSecondary, token.borderRadius, disabled ? 'not-allowed' : 'pointer', token.padding, token.motionDurationFast, cardWidth, disabled && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n .", "-typography {\n color: ", ";\n &.", "-typography-secondary {\n color: ", ";\n }\n }\n "])), token.colorBgContainerDisabled, prefixCls, token.colorTextDisabled, prefixCls, token.colorTextDisabled), !disabled && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:hover {\n border-color: ", ";\n }\n "])), token.colorPrimaryBorderHover), prefixCls),
38
+ option: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n\n cursor: ", ";\n\n padding: ", "px;\n\n transition: all ", ";\n\n width: ", "px;\n min-height: 108px;\n\n ", "\n\n ", "\n\n div.", "-typography {\n margin-bottom: 0;\n }\n "])), token.colorBorder, token.borderRadius, disabled ? 'not-allowed' : 'pointer', token.padding, token.motionDurationFast, cardWidth, disabled && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n .", "-typography {\n color: ", ";\n &.", "-typography-secondary {\n color: ", ";\n }\n }\n "])), token.colorBgContainerDisabled, prefixCls, token.colorTextDisabled, prefixCls, token.colorTextDisabled), !disabled && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:hover {\n border-color: ", ";\n }\n "])), token.colorPrimaryBorderHover), prefixCls),
39
39
  optionSelected: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-color: ", ";\n &:hover {\n border-color: ", ";\n }\n "])), token.colorPrimary, token.colorPrimaryActive),
40
40
  check: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n right: ", "px;\n bottom: ", "px;\n color: ", ";\n "])), token.marginXS, token.marginXS, token.colorPrimary)
41
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuntijs/ui",
3
- "version": "1.0.0-beta.65",
3
+ "version": "1.0.0-beta.67",
4
4
  "description": "☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps",
5
5
  "keywords": [
6
6
  "yuntijs",