@unicom-cloud/ui 0.8.103 → 0.8.104

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/spin/index.js CHANGED
@@ -1,93 +1,106 @@
1
- import { jsx as n, jsxs as $, Fragment as h } from "react/jsx-runtime";
2
- import w from "@unicom-cloud/icons/IconUiLoading";
3
- import P from "lodash/debounce";
4
- import y, { useContext as _, useState as D, useCallback as F, useRef as H, useImperativeHandle as M, useEffect as U } from "react";
1
+ import { jsx as n, jsxs as N, Fragment as $ } from "react/jsx-runtime";
2
+ import P from "@unicom-cloud/icons/IconUiLoading";
3
+ import _ from "@unicom-cloud/icons/IconUiLoadingDots";
4
+ import D from "@unicom-cloud/icons/IconUiLoadingInfinity";
5
+ import F from "@unicom-cloud/icons/IconUiLoadingRing";
6
+ import H from "@unicom-cloud/icons/IconUiLoadingSpinner";
7
+ import M from "lodash/debounce";
8
+ import h, { useContext as q, useState as A, useCallback as B, useRef as G, useImperativeHandle as J, useEffect as K } from "react";
5
9
  import "../config-provider/ConfigProvider.js";
6
- import q from "../components/common/hooks/useMergeProps.js";
7
- import a from "@unicom-cloud/utils/class-name";
8
- import { isEmptyReactNode as A } from "../components/common/utils/is.js";
9
- import B from "./DotLoading.js";
10
- import G from "../config-provider/context.js";
11
- function J(S, C) {
12
- const { getPrefixCls: x, componentConfig: v } = _(G), L = q(S, {}, v?.Spin), {
13
- style: b,
14
- className: z,
10
+ import O from "../components/common/hooks/useMergeProps.js";
11
+ import m from "@unicom-cloud/utils/class-name";
12
+ import { isEmptyReactNode as Q } from "../components/common/utils/is.js";
13
+ import T from "../config-provider/context.js";
14
+ function V(C, S) {
15
+ const {
16
+ prefixCls: x,
17
+ getPrefixCls: I,
18
+ componentConfig: L
19
+ } = q(T), v = O(C, {}, L?.Spin), {
20
+ style: R,
21
+ className: b,
15
22
  children: r,
16
- loading: s,
17
- size: o,
23
+ loading: t,
24
+ size: s,
18
25
  icon: f,
19
- element: R,
20
- tip: c,
21
- dot: k,
26
+ element: z,
27
+ tip: a,
28
+ type: U,
22
29
  delay: i,
23
- block: E = !1,
30
+ block: k = !1,
24
31
  fullscreen: p,
25
- ...I
26
- } = L, [u, g] = D(i ? !1 : s), l = F(P(g, i), [i]), d = i ? u : s, e = x?.("spin"), N = H(null);
27
- M(C, () => ({
32
+ ...E
33
+ } = v, [g, u] = A(i ? !1 : t), o = B(M(u, i), [i]), c = i ? g : t, e = I?.("spin"), y = G(null);
34
+ J(S, () => ({
28
35
  // 潘启宝添加于 2023年10月23日 星期一 10时52分55秒 CST
29
- dom: N.current,
30
- loading: u,
31
- setLoading: g,
32
- debouncedSetLoading: l
33
- })), U(() => (i && l(s), () => {
34
- l && l.cancel();
35
- }), [s]);
36
- const j = /* @__PURE__ */ n("span", { className: `${e}-icon`, children: f ? y.cloneElement(f, {
37
- className: a(`${e.replace("-spin", "-icon")}-loading`),
36
+ dom: y.current,
37
+ loading: g,
38
+ setLoading: u,
39
+ debouncedSetLoading: o
40
+ })), K(() => (i && o(t), () => {
41
+ o && o.cancel();
42
+ }), [o, i, t]);
43
+ const j = {
44
+ dot: _,
45
+ infinity: D,
46
+ ring: F,
47
+ circle: H,
48
+ default: P
49
+ }[U || "default"], w = /* @__PURE__ */ n("span", { className: `${e}-icon`, children: f ? h.cloneElement(f, {
50
+ className: `${x}-icon-ui-loading`,
38
51
  style: {
39
- fontSize: o
52
+ fontSize: s
40
53
  }
41
- }) : R || (k ? /* @__PURE__ */ n(B, { size: o }) : /* @__PURE__ */ n(w, { style: { fontSize: o } })) }), m = /* @__PURE__ */ $(h, { children: [
42
- j,
43
- c ? /* @__PURE__ */ n("div", { className: `${e}-tip`, children: c }) : null
54
+ }) : z || /* @__PURE__ */ n(j, { style: { fontSize: s } }) }), d = /* @__PURE__ */ N($, { children: [
55
+ w,
56
+ a ? /* @__PURE__ */ n("div", { className: `${e}-tip`, children: a }) : null
44
57
  ] });
45
- let t;
46
- return A(r) ? p ? d && (t = /* @__PURE__ */ n(
58
+ let l;
59
+ return Q(r) ? p ? c && (l = /* @__PURE__ */ n(
47
60
  "div",
48
61
  {
49
- className: a(
62
+ className: m(
50
63
  `${e}-loading-layer`,
51
64
  `${e}-fullscreen`
52
65
  ),
53
- style: { fontSize: o },
54
- children: m
66
+ style: { fontSize: s },
67
+ children: d
55
68
  }
56
- )) : t = m : t = /* @__PURE__ */ $(h, { children: [
69
+ )) : l = d : l = /* @__PURE__ */ N($, { children: [
57
70
  /* @__PURE__ */ n("div", { className: `${e}-children`, children: r }),
58
- d && /* @__PURE__ */ n(
71
+ c && /* @__PURE__ */ n(
59
72
  "div",
60
73
  {
61
- className: a(
74
+ className: m(
62
75
  `${e}-loading-layer`,
63
76
  p && `${e}-fullscreen`
64
77
  // 潘启宝添加
65
78
  ),
66
- style: { fontSize: o },
67
- children: /* @__PURE__ */ n("span", { className: `${e}-loading-layer-inner`, children: m })
79
+ style: { fontSize: s },
80
+ children: /* @__PURE__ */ n("span", { className: `${e}-loading-layer-inner`, children: d })
68
81
  }
69
82
  )
70
83
  ] }), /* @__PURE__ */ n(
71
84
  "div",
72
85
  {
73
- ref: N,
74
- className: a(
86
+ ref: y,
87
+ className: m(
75
88
  e,
76
89
  {
77
- [`${e}-block`]: E,
78
- [`${e}-loading`]: d,
79
- [`${e}-with-tip`]: c && !r
90
+ [`${e}-block`]: k,
91
+ [`${e}-loading`]: c,
92
+ [`${e}-with-tip`]: a && !r
80
93
  },
81
- z
94
+ b
82
95
  ),
83
- style: b,
84
- ...I,
85
- children: t
96
+ style: R,
97
+ ...E,
98
+ children: l
86
99
  }
87
100
  );
88
101
  }
89
- const K = y.forwardRef(J);
90
- K.displayName = "Spin";
102
+ const W = h.forwardRef(V);
103
+ W.displayName = "Spin";
91
104
  export {
92
- K as default
105
+ W as default
93
106
  };