ztxkui 3.2.6 → 3.2.7

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.
@@ -1,7 +1,7 @@
1
1
  import InputNumber from 'components/InputNumber';
2
2
  import Tag from 'components/Tag';
3
3
  import Input from 'components/Input';
4
- import { FormList, RangePicker, Button, Modal } from '../index';
4
+ import { FormList, RangePicker, Button, Modal, Container } from '../index';
5
5
  import { InputNumber as AntInputNumber } from 'antd';
6
6
  import GridList from 'components/business/NewList';
7
7
  import { useState } from 'react';
@@ -52,7 +52,14 @@ function BasicDemo() {
52
52
  dayjs('2022-05-11'),
53
53
  dayjs('2022-05-31'),
54
54
  ]), rangeValue = _b[0], setRangeValue = _b[1];
55
- return (React.createElement(React.Fragment, null,
55
+ var _c = useState(false), loading = _c[0], setLoading = _c[1];
56
+ return (React.createElement(Container, { loading: loading },
57
+ React.createElement(Button, { onClick: function () {
58
+ setLoading(true);
59
+ setTimeout(function () {
60
+ setLoading(false);
61
+ }, 5000);
62
+ } }, "\u52A0\u8F7D"),
56
63
  React.createElement("div", null,
57
64
  React.createElement(Button, { onClick: function () {
58
65
  Modal.confirm({
@@ -20,15 +20,32 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import React from 'react';
23
+ import React, { useEffect, useState } from 'react';
24
24
  import { Spin } from 'antd';
25
25
  import classNames from 'classnames';
26
26
  var Container = function (_a) {
27
27
  var loading = _a.loading, children = _a.children, className = _a.className, containerRef = _a.containerRef, spinProps = _a.spinProps, restProps = __rest(_a, ["loading", "children", "className", "containerRef", "spinProps"]);
28
28
  var classes = classNames('zt-container', className);
29
+ var _b = useState(1), countdown = _b[0], setCountdown = _b[1];
30
+ useEffect(function () {
31
+ if (!loading) {
32
+ setCountdown(1);
33
+ }
34
+ }, [loading]);
35
+ useEffect(function () {
36
+ if (!loading) {
37
+ return;
38
+ }
39
+ var timeout = setTimeout(function () {
40
+ setCountdown(function (pre) { return pre + 1; });
41
+ }, 1000);
42
+ return function () {
43
+ timeout && clearTimeout(timeout);
44
+ };
45
+ }, [countdown, loading]);
29
46
  return (React.createElement("div", __assign({ className: classes }, restProps, { ref: containerRef }),
30
47
  loading && (React.createElement("div", { className: "zt-container__loading" },
31
- React.createElement(Spin, __assign({ size: "large", spinning: loading }, spinProps)))),
48
+ React.createElement(Spin, __assign({ size: "large", spinning: loading, tip: "" + countdown }, spinProps)))),
32
49
  children));
33
50
  };
34
51
  export default Container;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.2.6",
3
+ "version": "3.2.7",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",