@unicom-cloud/ui 0.8.106 → 0.8.108

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.
Files changed (197) hide show
  1. package/App.js +7 -0
  2. package/BackTop.js +2 -4
  3. package/Calendar.js +2 -2
  4. package/ColorPicker.js +15 -14
  5. package/Constant.js +4 -0
  6. package/Copy.js +4 -3
  7. package/Countdown.js +25 -0
  8. package/Grid.js +8 -10
  9. package/LiquidFill.js +4 -3
  10. package/List.js +7 -6
  11. package/Marquee.js +4 -3
  12. package/Modal.js +4 -2
  13. package/PageHeader.js +3 -2
  14. package/QrCode.js +4 -3
  15. package/RowCol.js +8 -0
  16. package/Segmented.js +14 -4
  17. package/Statistic.js +5 -4
  18. package/Tour.js +4 -3
  19. package/Transfer.js +4 -2
  20. package/anchor/Link.js +1 -1
  21. package/app/App.js +26 -0
  22. package/app/context.js +9 -0
  23. package/app/index.js +9 -0
  24. package/app/interface.js +1 -0
  25. package/app/useApp.js +8 -0
  26. package/avatar/Group.js +1 -1
  27. package/back-top/index.js +44 -56
  28. package/button/index.js +52 -51
  29. package/calendar/Lunar.js +71 -0
  30. package/calendar/index.js +11 -11
  31. package/cascader/base/node.js +22 -20
  32. package/cascader/base/store.js +10 -10
  33. package/cascader/util.js +29 -27
  34. package/color-picker/Mode.js +8 -7
  35. package/color-picker/hooks/useColorPicker.js +56 -55
  36. package/color-picker/index.js +49 -48
  37. package/color-picker/utils.js +58 -57
  38. package/components/common/empty/index.js +2 -2
  39. package/components/common/flex/index.js +64 -55
  40. package/components/common/flex/interface.js +6 -6
  41. package/components/common/hooks/useInterval.js +6 -6
  42. package/components/common/icons/file/index.js +13 -11
  43. package/components/common/space/index.js +53 -53
  44. package/components/common/utils/dayjs.js +114 -126
  45. package/components/common/utils/is.js +98 -104
  46. package/components/common/utils/setDir.js +12 -0
  47. package/components/common/utils/setTheme.js +13 -13
  48. package/components/common/utils/toArray.js +7 -5
  49. package/config-provider/ConfigProvider.js +32 -30
  50. package/constant/index.js +4 -0
  51. package/copy/index.js +2 -1
  52. package/countdown/index.js +113 -0
  53. package/countdown/interface.js +1 -0
  54. package/countdown/util.js +29 -0
  55. package/descriptions/index.js +45 -45
  56. package/divider/index.js +28 -20
  57. package/dropdown/Button.js +1 -1
  58. package/empty/index.js +1 -1
  59. package/flex/index.js +30 -29
  60. package/form/FormItem.js +126 -122
  61. package/grid/Grid.js +56 -90
  62. package/grid/Item.js +44 -65
  63. package/grid/context.js +2 -6
  64. package/grid/index.js +6 -8
  65. package/grid/util.js +6 -44
  66. package/hooks/useResponsiveState.js +54 -0
  67. package/index.js +614 -605
  68. package/input/Button.js +12 -12
  69. package/input/Group.js +11 -12
  70. package/input/Input.js +112 -102
  71. package/input/InputElement.js +25 -24
  72. package/input/Search.js +24 -24
  73. package/layout/Sider.js +1 -1
  74. package/liquid-fill/index.js +4 -3
  75. package/list/Item.js +21 -21
  76. package/list/index.js +53 -52
  77. package/marquee/index.js +20 -19
  78. package/marquee-/index.js +4 -3
  79. package/mentions/util.js +9 -8
  80. package/modal/Confirm.js +17 -17
  81. package/modal/Modal.js +247 -237
  82. package/modal/index.js +4 -2
  83. package/modal/use-modal/index.js +2 -2
  84. package/package.json +1 -1
  85. package/page-header/index.js +57 -56
  86. package/pagination/Pagination.js +89 -92
  87. package/qr-code/index.js +4 -3
  88. package/radio/Group.js +1 -1
  89. package/row-col/Col-.js +88 -0
  90. package/row-col/Col.js +159 -0
  91. package/row-col/Row.js +73 -0
  92. package/row-col/context.js +5 -0
  93. package/row-col/index.js +11 -0
  94. package/row-col/interface.js +1 -0
  95. package/segmented/index.js +257 -206
  96. package/select/Select.js +191 -191
  97. package/select/util.js +50 -50
  98. package/select-view/Core.js +31 -28
  99. package/space/index.js +15 -13
  100. package/splitter/SplitBar.js +44 -46
  101. package/statistic/index.js +56 -55
  102. package/statistic/interface.js +4 -1
  103. package/style.css +1 -1
  104. package/table/Table.js +198 -210
  105. package/table/hook/useColumns.js +27 -26
  106. package/table/hook/useStickyClassNames.js +9 -8
  107. package/table/hook/useThResizable.js +4 -3
  108. package/table/th-resizable/index.js +2 -2
  109. package/table/thead/index.js +18 -16
  110. package/time-picker/util.js +20 -30
  111. package/timeline/Item.js +1 -1
  112. package/tour/index.js +4 -3
  113. package/transfer/index.js +93 -91
  114. package/trigger/index.js +66 -66
  115. package/types/common/development/interface.d.ts +3 -3
  116. package/types/common/flex/index.d.ts +3 -9
  117. package/types/common/flex/interface.d.ts +15 -4
  118. package/types/common/space/index.d.ts +3 -5
  119. package/types/common/space/interface.d.ts +2 -0
  120. package/types/common/utils/dayjs.d.ts +3 -1
  121. package/types/common/utils/is.d.ts +3 -4
  122. package/types/common/utils/setDir.d.ts +2 -0
  123. package/types/pc/app/App.d.ts +6 -0
  124. package/types/pc/app/context.d.ts +4 -0
  125. package/types/pc/app/index.d.ts +5 -0
  126. package/types/pc/app/interface.d.ts +17 -0
  127. package/types/pc/app/useApp.d.ts +3 -0
  128. package/types/pc/back-top/interface.d.ts +4 -17
  129. package/types/pc/button/interface.d.ts +2 -2
  130. package/types/pc/calendar/Lunar.d.ts +17 -0
  131. package/types/pc/calendar/index.d.ts +1 -1
  132. package/types/pc/config-provider/interface.d.ts +17 -12
  133. package/types/pc/constant/index.d.ts +1 -0
  134. package/types/pc/countdown/interface.d.ts +65 -0
  135. package/types/pc/countdown/util.d.ts +7 -0
  136. package/types/pc/divider/interface.d.ts +1 -0
  137. package/types/pc/flex/index.d.ts +8 -6
  138. package/types/pc/flex/interface.d.ts +3 -10
  139. package/types/pc/form/FormItem.d.ts +1 -1
  140. package/types/pc/form/interface.d.ts +1 -1
  141. package/types/pc/grid/Grid.d.ts +2 -4
  142. package/types/pc/grid/Item.d.ts +1 -5
  143. package/types/pc/grid/context.d.ts +4 -15
  144. package/types/pc/grid/index.d.ts +4 -6
  145. package/types/pc/grid/interface.d.ts +14 -142
  146. package/types/pc/grid/util.d.ts +1 -10
  147. package/types/pc/hooks/useResponsiveState.d.ts +3 -0
  148. package/types/pc/index.d.ts +10 -4
  149. package/types/pc/input/Button.d.ts +2 -2
  150. package/types/pc/list/interface.d.ts +2 -1
  151. package/types/pc/message/index.d.ts +1 -9
  152. package/types/pc/message/interface.d.ts +8 -0
  153. package/types/pc/message/useMessage.d.ts +1 -2
  154. package/types/pc/modal/Modal.d.ts +1 -0
  155. package/types/pc/modal/config.d.ts +1 -2
  156. package/types/pc/modal/index.d.ts +2 -1
  157. package/types/pc/modal/interface.d.ts +17 -5
  158. package/types/pc/notification/index.d.ts +2 -9
  159. package/types/pc/notification/interface.d.ts +7 -0
  160. package/types/pc/notification/useNotification.d.ts +1 -2
  161. package/types/pc/pagination/PageOption.d.ts +0 -1
  162. package/types/pc/pagination/interface.d.ts +5 -6
  163. package/types/pc/{grid → row-col}/Col-.d.ts +1 -1
  164. package/types/pc/{grid → row-col}/Col.d.ts +1 -2
  165. package/types/pc/{grid → row-col}/Row.d.ts +1 -2
  166. package/types/pc/row-col/context.d.ts +6 -0
  167. package/types/pc/row-col/index.d.ts +7 -0
  168. package/types/pc/row-col/interface.d.ts +112 -0
  169. package/types/pc/segmented/index.d.ts +3 -7
  170. package/types/pc/segmented/interface.d.ts +38 -5
  171. package/types/pc/select-view/Core.d.ts +1 -8
  172. package/types/pc/select-view/index.d.ts +1 -8
  173. package/types/pc/select-view/interface.d.ts +9 -2
  174. package/types/pc/space/index.d.ts +5 -7
  175. package/types/pc/space/interface.d.ts +3 -10
  176. package/types/pc/statistic/index.d.ts +1 -1
  177. package/types/pc/statistic/interface.d.ts +1 -49
  178. package/types/pc/utils/is.d.ts +1 -1
  179. package/types/pc/utils/names.d.ts +422 -111
  180. package/types/pc/utils/responsiveObserve.d.ts +8 -8
  181. package/typography/Ellipsis.js +5 -4
  182. package/typography/Operations.js +4 -3
  183. package/utils/dayjs.js +13 -11
  184. package/utils/index.js +245 -244
  185. package/utils/is.js +65 -66
  186. package/utils/names.js +309 -150
  187. package/utils/responsiveObserve.js +43 -36
  188. package/version/index.js +1 -1
  189. package/grid/Col-.js +0 -86
  190. package/grid/Col.js +0 -169
  191. package/grid/Row.js +0 -96
  192. package/grid/hook/useResponsiveState.js +0 -38
  193. package/statistic/Countdown.js +0 -56
  194. package/statistic/util.js +0 -33
  195. package/types/pc/grid/hook/useResponsiveState.d.ts +0 -2
  196. package/types/pc/statistic/util.d.ts +0 -1
  197. /package/types/pc/{statistic/Countdown.d.ts → countdown/index.d.ts} +0 -0
@@ -1,5 +1,8 @@
1
- import { v4 as a } from "uuid";
2
- const m = [
1
+ import "../components/common/utils/is.js";
2
+ import { v4 as m } from "uuid";
3
+ import { isFunction as o } from "@unicom-cloud/utils/is";
4
+ const x = [
5
+ // 顺序不能变
3
6
  "xxxl",
4
7
  "xxl",
5
8
  "xl",
@@ -7,7 +10,7 @@ const m = [
7
10
  "md",
8
11
  "sm",
9
12
  "xs"
10
- ], h = {
13
+ ], c = {
11
14
  xs: "(max-width: 575px)",
12
15
  sm: "(min-width: 576px)",
13
16
  md: "(min-width: 768px)",
@@ -16,40 +19,21 @@ const m = [
16
19
  xxl: "(min-width: 1600px)",
17
20
  xxxl: "(min-width: 2000px)"
18
21
  };
19
- let i = [], n = {};
20
- const x = {
22
+ let i = [], a = Object.fromEntries(
23
+ x.map((e, t, n) => [e, !0])
24
+ );
25
+ const f = {
21
26
  matchHandlers: {},
22
- dispatch(e, t) {
23
- return n = e, i.length < 1 ? !1 : (i.forEach((s) => {
24
- s.func(n, t);
25
- }), !0);
26
- },
27
- subscribe(e) {
28
- i.length === 0 && this.register();
29
- const t = a();
30
- return i.push({
31
- token: t,
32
- func: e
33
- }), e(n, null), t;
34
- },
35
- unsubscribe(e) {
36
- i = i.filter((t) => t.token !== e), i.length === 0 && this.unregister();
37
- },
38
- unregister() {
39
- Object.entries(h).forEach(([e, t]) => {
40
- const s = this.matchHandlers[t];
41
- s && s.mql && s.listener && s.mql.removeEventListener("change", s.listener);
42
- }), this.matchHandlers = {};
43
- },
44
27
  register() {
45
- Object.entries(h).forEach(([e, t]) => {
28
+ Object.entries(c).forEach(([e, t], n, h) => {
46
29
  const s = window.matchMedia(t), r = (l) => {
47
30
  this.dispatch(
48
31
  {
49
- ...n,
32
+ ...a,
50
33
  [e]: l.matches
51
34
  },
52
- e
35
+ e,
36
+ l.media ?? t
53
37
  );
54
38
  };
55
39
  s.addEventListener("change", r), this.matchHandlers[t] = {
@@ -57,17 +41,40 @@ const x = {
57
41
  listener: r
58
42
  }, this.dispatch(
59
43
  {
60
- ...n,
44
+ ...a,
61
45
  [e]: s.matches
62
46
  },
63
- e
47
+ e,
48
+ t
64
49
  );
65
50
  });
51
+ },
52
+ unregister() {
53
+ Object.entries(c).forEach(([e, t], n, h) => {
54
+ const { mql: s, listener: r } = this.matchHandlers[t] ?? {};
55
+ s && o(r) && s.removeEventListener("change", r);
56
+ }), this.matchHandlers = {};
57
+ },
58
+ subscribe(e) {
59
+ i.length || this.register();
60
+ const t = m();
61
+ return i.push({
62
+ token: t,
63
+ func: e
64
+ }), e(a, null, null), t;
65
+ },
66
+ unsubscribe(e) {
67
+ i = i.filter((t, n, h) => t.token !== e), i.length || this.unregister();
68
+ },
69
+ dispatch(e, t, n) {
70
+ return a = e, i.length ? (i.forEach((h, s, r) => {
71
+ h.func(a, t, n);
72
+ }), !0) : !1;
66
73
  }
67
74
  };
68
75
  export {
69
- x as default,
70
- m as responsiveArray,
71
- h as responsiveMap,
72
- x as responsiveObserve
76
+ f as default,
77
+ x as responsiveArray,
78
+ c as responsiveMap,
79
+ f as responsiveObserve
73
80
  };
package/version/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const I = "2025-07-16 17:37:00", t = "1752658620292", E = "2.66.0";
1
+ const I = "2025-07-31 20:21:30", t = "1753964490482", E = "2.66.0";
2
2
  export {
3
3
  E as VERSION,
4
4
  I as VERSION_BUILD_DATE,
package/grid/Col-.js DELETED
@@ -1,86 +0,0 @@
1
- import { jsx as E } from "react/jsx-runtime";
2
- import F from "lodash/isNumber";
3
- import H from "lodash/isPlainObject";
4
- import { forwardRef as T, useContext as R, useMemo as q } from "react";
5
- import "../config-provider/ConfigProvider.js";
6
- import D from "../components/common/hooks/useMergeProps.js";
7
- import I from "@unicom-cloud/utils/class-name";
8
- import { RowContext as J } from "./context.js";
9
- import K from "../config-provider/context.js";
10
- const Q = {
11
- span: 24
12
- };
13
- function S(i) {
14
- return typeof i == "string" && /\d+[px|%|em|rem|]{1}/.test(i) ? `0 0 ${i}` : i;
15
- }
16
- function U(i, v) {
17
- const { getPrefixCls: w, componentConfig: A, rtl: G } = R(K), L = D(
18
- i,
19
- Q,
20
- A?.["Grid.Col"]
21
- ), { gutter: p, div: l } = R(J), {
22
- className: M,
23
- style: N,
24
- children: O,
25
- span: V,
26
- offset: d,
27
- order: a,
28
- pull: u,
29
- push: c,
30
- xs: m,
31
- sm: g,
32
- md: x,
33
- lg: y,
34
- xl: h,
35
- xxl: P,
36
- xxxl: b,
37
- flex: f,
38
- ...k
39
- } = L;
40
- function z(r, o) {
41
- const j = { xs: m, sm: g, md: x, lg: y, xl: h, xxl: P, xxxl: b };
42
- return Object.keys(j).forEach((s) => {
43
- const t = j[s];
44
- F(t) ? t >= 0 && (o[`${r}-${s}-${t}`] = !0) : H(t) && (o[`${r}-${s}-${t.span}`] = t.span, o[`${r}-${s}-offset-${t.offset}`] = t.offset, o[`${r}-${s}-order-${t.order}`] = t.order, o[`${r}-${s}-pull-${t.pull}`] = t.pull, o[`${r}-${s}-push-${t.push}`] = t.push);
45
- }), o;
46
- }
47
- const n = w?.("col");
48
- let $ = {
49
- [`${n}`]: !l,
50
- [`${n}-order-${a}`]: a,
51
- [`${n}-${V}`]: !l && !m && !g && !x && !y && !h && !P && !b,
52
- [`${n}-offset-${d}`]: d,
53
- [`${n}-pull-${u}`]: u,
54
- [`${n}-push-${c}`]: c,
55
- [`${n}-rtl`]: G
56
- };
57
- $ = z(n, $);
58
- const B = I(f ? n : $, M), e = {};
59
- if (Array.isArray(p) && !l) {
60
- const r = p[0] && p[0] / 2 || 0, o = p[1] && p[1] / 2 || 0;
61
- r && (e.paddingLeft = r, e.paddingRight = r), o && (e.paddingTop = o, e.paddingBottom = o);
62
- }
63
- const C = q(
64
- () => S(f) ? { flex: S(f) } : {},
65
- [f]
66
- );
67
- return /* @__PURE__ */ E(
68
- "div",
69
- {
70
- ref: v,
71
- ...k,
72
- style: {
73
- ...N,
74
- ...e,
75
- ...C
76
- },
77
- className: B,
78
- children: O
79
- }
80
- );
81
- }
82
- const W = T(U);
83
- W.displayName = "Col";
84
- export {
85
- W as default
86
- };
package/grid/Col.js DELETED
@@ -1,169 +0,0 @@
1
- import { jsx as W } from "react/jsx-runtime";
2
- import X from "lodash/isNil";
3
- import M from "lodash/isNumber";
4
- import B from "lodash/isPlainObject";
5
- import { forwardRef as Y, useContext as F, useState as Z, useMemo as b, useEffect as _ } from "react";
6
- import "../config-provider/ConfigProvider.js";
7
- import ee from "../components/common/hooks/useMergeProps.js";
8
- import te from "@unicom-cloud/utils/class-name";
9
- import { responsiveArray as y, responsiveObserve as z } from "../utils/responsiveObserve.js";
10
- import { RowContext as re } from "./context.js";
11
- import se from "../config-provider/context.js";
12
- const oe = {
13
- span: 24
14
- // 默认占据24列
15
- };
16
- function ne(i) {
17
- return typeof i == "string" && /\d+[px|%|em|rem|]{1}/.test(i) ? { flex: `0 0 ${i}` } : { flex: i };
18
- }
19
- const ie = (i, E) => {
20
- const { getPrefixCls: G, componentConfig: I, rtl: d } = F(se), T = ee(
21
- i,
22
- oe,
23
- I?.["Grid.Col"]
24
- ), { gutter: C, div: o } = F(re), {
25
- className: V,
26
- style: q,
27
- children: D,
28
- span: g = 24,
29
- offset: c,
30
- order: u,
31
- pull: m,
32
- push: $,
33
- xs: v,
34
- sm: P,
35
- md: k,
36
- lg: R,
37
- xl: S,
38
- xxl: w,
39
- xxxl: O,
40
- flex: j,
41
- ...H
42
- } = T, f = !X(j), s = G?.("col"), [A, J] = Z({
43
- xs: !1,
44
- sm: !1,
45
- md: !1,
46
- lg: !1,
47
- xl: !1,
48
- xxl: !1,
49
- xxxl: !1
50
- }), l = b(() => ({ xs: v, sm: P, md: k, lg: R, xl: S, xxl: w, xxxl: O }), [R, k, P, S, v, w, O]), K = b(() => {
51
- if (f)
52
- return;
53
- const e = {
54
- [`${s}`]: !o,
55
- [`${s}-order-${u}`]: u,
56
- [`${s}-${g}`]: !o && Object.values(l).every((r) => !r),
57
- [`${s}-offset-${c}`]: c,
58
- [`${s}-pull-${m}`]: m,
59
- [`${s}-push-${$}`]: $,
60
- [`${s}-rtl`]: d
61
- };
62
- for (const r in l) {
63
- const t = l[r];
64
- M(t) ? t >= 0 && (e[`${s}-${r}-${t}`] = !0) : B(t) && (e[`${s}-${r}-${t.span}`] = t.span, e[`${s}-${r}-offset-${t.offset}`] = t.offset, e[`${s}-${r}-order-${t.order}`] = t.order, e[`${s}-${r}-pull-${t.pull}`] = t.pull, e[`${s}-${r}-push-${t.push}`] = t.push);
65
- }
66
- return e;
67
- }, [
68
- f,
69
- s,
70
- o,
71
- u,
72
- g,
73
- l,
74
- c,
75
- m,
76
- $,
77
- d
78
- ]), x = (e) => `${100 / 24 * e}%`, Q = b(() => {
79
- if (o || f)
80
- return;
81
- const e = {
82
- span: g,
83
- offset: c,
84
- order: u,
85
- pull: m,
86
- push: $
87
- }, r = y.find((a) => A[a]);
88
- if (r) {
89
- const a = y.indexOf(r);
90
- for (let p = a; p < y.length; p++) {
91
- const h = y[p], n = l[h];
92
- if (n !== void 0) {
93
- if (B(n)) {
94
- Object.assign(e, n);
95
- break;
96
- }
97
- if (M(n)) {
98
- Object.assign(e, { span: n });
99
- break;
100
- }
101
- }
102
- }
103
- }
104
- const t = {}, L = x(e.span);
105
- t.width = L, t.flex = `0 0 ${L}`;
106
- const N = (a, p, h) => {
107
- if (d) {
108
- const n = {
109
- left: "right",
110
- right: "left",
111
- marginLeft: "marginRight",
112
- marginRight: "marginLeft"
113
- };
114
- a[n[p]] = h;
115
- } else
116
- a[p] = h;
117
- };
118
- return e.offset && N(
119
- t,
120
- "marginLeft",
121
- x(e.offset)
122
- ), e.order && (t.order = e.order), e.pull && N(t, "right", x(e.pull)), e.push && N(t, "left", x(e.push)), t;
123
- }, [
124
- o,
125
- f,
126
- g,
127
- c,
128
- u,
129
- m,
130
- $,
131
- A,
132
- l,
133
- d
134
- ]), U = b(() => {
135
- if (o)
136
- return;
137
- const e = {};
138
- if (Array.isArray(C)) {
139
- const [r, t] = C;
140
- r && (e.paddingLeft = r / 2, e.paddingRight = r / 2), t && (e.paddingTop = t / 2, e.paddingBottom = t / 2);
141
- }
142
- return e;
143
- }, [C, o]);
144
- return _(() => {
145
- const e = z.subscribe((r) => {
146
- J(r);
147
- });
148
- return () => {
149
- z.unsubscribe(e);
150
- };
151
- }, []), /* @__PURE__ */ W(
152
- "div",
153
- {
154
- ref: E,
155
- ...H,
156
- style: {
157
- ...f ? ne(j) : Q,
158
- ...U,
159
- ...q
160
- },
161
- className: te(f ? s : K, V),
162
- children: D
163
- }
164
- );
165
- }, fe = Y(ie);
166
- fe.displayName = "Col";
167
- export {
168
- fe as default
169
- };
package/grid/Row.js DELETED
@@ -1,96 +0,0 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { forwardRef as z, useContext as G, useState as H, useRef as U, useEffect as V } from "react";
3
- import "../config-provider/ConfigProvider.js";
4
- import B from "../components/common/hooks/useMergeProps.js";
5
- import E from "@unicom-cloud/utils/class-name";
6
- import "../components/common/utils/is.js";
7
- import { omit as L } from "../components/common/utils/omit.js";
8
- import { responsiveObserve as x, responsiveArray as y } from "../utils/responsiveObserve.js";
9
- import { RowContext as M } from "./context.js";
10
- import T from "../config-provider/context.js";
11
- import { isPlainObject as f, isArray as b, isObject as q } from "@unicom-cloud/utils/is";
12
- const D = {
13
- gutter: 0,
14
- align: "start",
15
- justify: "start"
16
- };
17
- function F(v, C) {
18
- const { getPrefixCls: R, componentConfig: $, rtl: j } = G(T), w = B(
19
- v,
20
- D,
21
- $?.["Grid.Row"]
22
- ), {
23
- className: N,
24
- style: P,
25
- children: h,
26
- div: i,
27
- align: u,
28
- justify: p,
29
- gutter: r = 0,
30
- ...A
31
- } = w, [k, O] = H({
32
- xs: !0,
33
- sm: !0,
34
- md: !0,
35
- lg: !0,
36
- xl: !0,
37
- xxl: !0,
38
- xxxl: !0
39
- }), n = U();
40
- V(() => (n.current = x.subscribe((t) => {
41
- (f(r) || Array.isArray(r) && (f(r[0]) || f(r[1]))) && O(t);
42
- }), () => {
43
- n.current && x.unsubscribe(n.current);
44
- }), []);
45
- function g(t) {
46
- let e = 0;
47
- if (q(t))
48
- for (let c = 0; c < y.length; c++) {
49
- const l = y[c];
50
- if (k[l] && t[l] !== void 0) {
51
- e = t[l];
52
- break;
53
- }
54
- }
55
- else
56
- e = t;
57
- return e;
58
- }
59
- const s = R?.("row"), S = E(
60
- {
61
- [`${s}`]: !i,
62
- [`${s}-align-${u}`]: u,
63
- [`${s}-justify-${p}`]: p,
64
- [`${s}-rtl`]: j
65
- },
66
- N
67
- ), o = {}, a = g(b(r) ? r[0] : r), m = g(b(r) ? r[1] : 0);
68
- if ((a || m) && !i) {
69
- const t = -a / 2, e = -m / 2;
70
- t && (o.marginLeft = t, o.marginRight = t), e && (o.marginTop = e, o.marginBottom = e);
71
- }
72
- return /* @__PURE__ */ d(
73
- "div",
74
- {
75
- ref: C,
76
- ...L(A, ["gutter"]),
77
- style: {
78
- ...P,
79
- ...o
80
- },
81
- className: S,
82
- children: /* @__PURE__ */ d(
83
- M.Provider,
84
- {
85
- value: { gutter: [a, m], div: i },
86
- children: h
87
- }
88
- )
89
- }
90
- );
91
- }
92
- const I = z(F);
93
- I.displayName = "Row";
94
- export {
95
- I as default
96
- };
@@ -1,38 +0,0 @@
1
- import x from "lodash/isPlainObject";
2
- import { useRef as b, useState as l, useEffect as R, useMemo as S } from "react";
3
- import { responsiveObserve as c, responsiveArray as f } from "../../utils/responsiveObserve.js";
4
- function m(e) {
5
- return x(e);
6
- }
7
- const h = (e, n, u = !1) => {
8
- const o = b(), [i, p] = l({
9
- xs: !0,
10
- sm: !0,
11
- md: !0,
12
- lg: !0,
13
- xl: !0,
14
- xxl: !0,
15
- xxxl: !0
16
- });
17
- return R(() => (o.current = c.subscribe((r) => {
18
- m(e) && p(r);
19
- }), () => {
20
- c.unsubscribe(o.current);
21
- }), []), S(() => {
22
- let r = n;
23
- if (m(e))
24
- for (let t = 0; t < f.length; t++) {
25
- const s = f[t];
26
- if ((i[s] || s === "xs" && u) && e[s] !== void 0) {
27
- r = e[s];
28
- break;
29
- }
30
- }
31
- else
32
- r = e;
33
- return r;
34
- }, [i, e, n, u]);
35
- };
36
- export {
37
- h as useResponsiveState
38
- };
@@ -1,56 +0,0 @@
1
- import { jsxs as I, jsx as a } from "react/jsx-runtime";
2
- import M from "dayjs";
3
- import T from "lodash/isFunction";
4
- import { forwardRef as _, useContext as E, useState as u, useRef as O, useEffect as P } from "react";
5
- import "../config-provider/ConfigProvider.js";
6
- import b from "@unicom-cloud/utils/class-name";
7
- import { getDayjsValue as d, getNow as v } from "../components/common/utils/dayjs.js";
8
- import { getDateString as w } from "./util.js";
9
- import k from "../config-provider/context.js";
10
- function q(n, h) {
11
- const { getPrefixCls: p } = E(k), {
12
- className: N,
13
- style: x,
14
- title: r,
15
- styleValue: C,
16
- value: g,
17
- onFinish: y,
18
- renderFormat: i,
19
- format: e = "HH:mm:ss",
20
- start: D = !0
21
- } = n, o = d(g, e) || M(), S = d(n.now, e), t = p?.("statistic"), [l, $] = u(
22
- o.diff(S, "millisecond")
23
- ), [c, j] = u(
24
- w(Math.max(l, 0), e)
25
- ), s = O(null), m = () => {
26
- clearInterval(s.current), s.current = null;
27
- }, V = () => {
28
- s.current = setInterval(() => {
29
- const R = o.diff(v()), f = o.diff(v(), "millisecond");
30
- f <= 0 && (m(), y?.());
31
- const H = w(Math.max(f, 0), e);
32
- j(H), $(R);
33
- }, 1e3 / 30);
34
- };
35
- P(() => (!s.current && D && o.valueOf() >= Date.now() && V(), () => {
36
- m();
37
- }), [n.start]);
38
- const F = T(i) ? i(l, c) : c;
39
- return /* @__PURE__ */ I(
40
- "div",
41
- {
42
- ref: h,
43
- className: b(`${t}`, `${t}-countdown`, N),
44
- style: x,
45
- children: [
46
- r && /* @__PURE__ */ a("div", { className: `${t}-title`, children: r }),
47
- /* @__PURE__ */ a("div", { className: `${t}-content`, children: /* @__PURE__ */ a("div", { className: `${t}-value`, style: C, children: F }) })
48
- ]
49
- }
50
- );
51
- }
52
- const z = _(q);
53
- z.displayName = "StatisticCountdown";
54
- export {
55
- z as default
56
- };
package/statistic/util.js DELETED
@@ -1,33 +0,0 @@
1
- import { padStart as s } from "../components/common/utils/pad.js";
2
- const a = [
3
- ["Y", 1e3 * 60 * 60 * 24 * 365],
4
- // years
5
- ["M", 1e3 * 60 * 60 * 24 * 30],
6
- // months
7
- ["D", 1e3 * 60 * 60 * 24],
8
- // days
9
- ["H", 1e3 * 60 * 60],
10
- // hours
11
- ["m", 1e3 * 60],
12
- // minutes
13
- ["s", 1e3],
14
- // seconds
15
- ["S", 1]
16
- // million seconds
17
- ];
18
- function p(l, i) {
19
- let t = l;
20
- return a.reduce((e, [n, r]) => {
21
- if (e.indexOf(n) !== -1) {
22
- const o = Math.floor(t / r);
23
- return t -= o * r, e.replace(new RegExp(`${n}+`, "g"), (f) => {
24
- const g = f.length;
25
- return s(o.toString(), g, "0");
26
- });
27
- }
28
- return e;
29
- }, i);
30
- }
31
- export {
32
- p as getDateString
33
- };
@@ -1,2 +0,0 @@
1
- import { type GridUnitProps } from '../interface';
2
- export declare const useResponsiveState: (val: GridUnitProps, defaultValue: number, fallbackToXs?: boolean) => number;
@@ -1 +0,0 @@
1
- export declare function getDateString(millisecond: number, format: string): string;