@unicom-cloud/ui 0.8.107 → 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 (137) hide show
  1. package/ColorPicker.js +15 -14
  2. package/Constant.js +4 -0
  3. package/Copy.js +4 -3
  4. package/Countdown.js +25 -0
  5. package/Grid.js +8 -10
  6. package/LiquidFill.js +4 -3
  7. package/List.js +7 -6
  8. package/Marquee.js +4 -3
  9. package/PageHeader.js +3 -2
  10. package/QrCode.js +4 -3
  11. package/RowCol.js +8 -0
  12. package/Segmented.js +14 -4
  13. package/Statistic.js +5 -4
  14. package/Tour.js +4 -3
  15. package/Transfer.js +4 -2
  16. package/anchor/Link.js +1 -1
  17. package/avatar/Group.js +1 -1
  18. package/button/index.js +52 -51
  19. package/calendar/Lunar.js +21 -21
  20. package/cascader/base/node.js +22 -20
  21. package/cascader/base/store.js +10 -10
  22. package/cascader/util.js +29 -27
  23. package/color-picker/Mode.js +8 -7
  24. package/color-picker/hooks/useColorPicker.js +56 -55
  25. package/color-picker/index.js +54 -53
  26. package/color-picker/utils.js +58 -57
  27. package/components/common/empty/index.js +2 -2
  28. package/components/common/flex/index.js +64 -55
  29. package/components/common/flex/interface.js +6 -6
  30. package/components/common/hooks/useInterval.js +6 -6
  31. package/components/common/space/index.js +53 -53
  32. package/components/common/utils/dayjs.js +75 -62
  33. package/components/common/utils/toArray.js +7 -5
  34. package/constant/index.js +4 -0
  35. package/copy/index.js +2 -1
  36. package/countdown/index.js +113 -0
  37. package/countdown/interface.js +1 -0
  38. package/countdown/util.js +29 -0
  39. package/descriptions/index.js +26 -26
  40. package/dropdown/Button.js +1 -1
  41. package/flex/index.js +30 -29
  42. package/form/FormItem.js +126 -122
  43. package/grid/Grid.js +40 -41
  44. package/grid/Item.js +37 -37
  45. package/grid/context.js +2 -3
  46. package/grid/index.js +6 -8
  47. package/hooks/useResponsiveState.js +54 -0
  48. package/index.js +614 -610
  49. package/input/InputElement.js +25 -24
  50. package/layout/Sider.js +1 -1
  51. package/liquid-fill/index.js +4 -3
  52. package/list/Item.js +21 -21
  53. package/list/index.js +53 -52
  54. package/marquee/index.js +20 -19
  55. package/marquee-/index.js +4 -3
  56. package/mentions/util.js +9 -8
  57. package/package.json +1 -1
  58. package/page-header/index.js +57 -56
  59. package/pagination/Pagination.js +89 -92
  60. package/qr-code/index.js +4 -3
  61. package/radio/Group.js +1 -1
  62. package/row-col/Col-.js +88 -0
  63. package/row-col/Col.js +159 -0
  64. package/row-col/Row.js +73 -0
  65. package/row-col/context.js +5 -0
  66. package/row-col/index.js +11 -0
  67. package/row-col/interface.js +1 -0
  68. package/segmented/index.js +257 -206
  69. package/select/Select.js +191 -191
  70. package/select/util.js +50 -50
  71. package/space/index.js +15 -13
  72. package/statistic/index.js +56 -55
  73. package/statistic/interface.js +4 -1
  74. package/style.css +1 -1
  75. package/table/hook/useColumns.js +27 -26
  76. package/table/hook/useStickyClassNames.js +9 -8
  77. package/table/hook/useThResizable.js +4 -3
  78. package/table/th-resizable/index.js +11 -10
  79. package/table/thead/index.js +18 -16
  80. package/timeline/Item.js +1 -1
  81. package/tour/index.js +4 -3
  82. package/transfer/index.js +93 -91
  83. package/trigger/index.js +66 -66
  84. package/types/common/flex/index.d.ts +3 -9
  85. package/types/common/flex/interface.d.ts +15 -4
  86. package/types/common/space/index.d.ts +3 -5
  87. package/types/common/space/interface.d.ts +2 -0
  88. package/types/common/utils/dayjs.d.ts +3 -1
  89. package/types/pc/button/interface.d.ts +2 -2
  90. package/types/pc/config-provider/interface.d.ts +16 -11
  91. package/types/pc/constant/index.d.ts +1 -0
  92. package/types/pc/countdown/interface.d.ts +65 -0
  93. package/types/pc/countdown/util.d.ts +7 -0
  94. package/types/pc/flex/index.d.ts +8 -6
  95. package/types/pc/flex/interface.d.ts +3 -10
  96. package/types/pc/form/FormItem.d.ts +1 -1
  97. package/types/pc/form/interface.d.ts +1 -1
  98. package/types/pc/grid/Grid.d.ts +1 -2
  99. package/types/pc/grid/Item.d.ts +1 -2
  100. package/types/pc/grid/context.d.ts +0 -5
  101. package/types/pc/grid/index.d.ts +4 -6
  102. package/types/pc/grid/interface.d.ts +7 -125
  103. package/types/pc/hooks/useResponsiveState.d.ts +3 -0
  104. package/types/pc/index.d.ts +7 -3
  105. package/types/pc/list/interface.d.ts +2 -1
  106. package/types/pc/pagination/PageOption.d.ts +0 -1
  107. package/types/pc/pagination/interface.d.ts +5 -6
  108. package/types/pc/{grid → row-col}/Col-.d.ts +1 -1
  109. package/types/pc/{grid → row-col}/Col.d.ts +1 -2
  110. package/types/pc/{grid → row-col}/Row.d.ts +1 -2
  111. package/types/pc/row-col/context.d.ts +6 -0
  112. package/types/pc/row-col/index.d.ts +7 -0
  113. package/types/pc/row-col/interface.d.ts +112 -0
  114. package/types/pc/segmented/index.d.ts +3 -7
  115. package/types/pc/segmented/interface.d.ts +38 -5
  116. package/types/pc/space/index.d.ts +5 -7
  117. package/types/pc/space/interface.d.ts +3 -10
  118. package/types/pc/statistic/index.d.ts +1 -1
  119. package/types/pc/statistic/interface.d.ts +1 -49
  120. package/types/pc/utils/names.d.ts +121 -113
  121. package/types/pc/utils/responsiveObserve.d.ts +8 -8
  122. package/typography/Ellipsis.js +5 -4
  123. package/typography/Operations.js +4 -3
  124. package/utils/dayjs.js +13 -11
  125. package/utils/index.js +244 -242
  126. package/utils/names.js +15 -10
  127. package/utils/responsiveObserve.js +43 -36
  128. package/version/index.js +1 -1
  129. package/grid/Col-.js +0 -86
  130. package/grid/Col.js +0 -169
  131. package/grid/Row.js +0 -96
  132. package/grid/hook/useResponsiveState.js +0 -35
  133. package/statistic/Countdown.js +0 -56
  134. package/statistic/util.js +0 -33
  135. package/types/pc/grid/hook/useResponsiveState.d.ts +0 -2
  136. package/types/pc/statistic/util.d.ts +0 -1
  137. /package/types/pc/{statistic/Countdown.d.ts → countdown/index.d.ts} +0 -0
package/utils/names.js CHANGED
@@ -124,11 +124,6 @@ const e = {
124
124
  en: "Checkbox",
125
125
  id: "39637dcd-97e9-4257-b045-2e4bf5528908"
126
126
  },
127
- Col: {
128
- zh: "列布局",
129
- en: "Col",
130
- id: "2ba46e9e-519a-4145-9091-66b4da431a8a"
131
- },
132
127
  Collapse: {
133
128
  zh: "折叠面板",
134
129
  en: "Collapse",
@@ -274,6 +269,16 @@ const e = {
274
269
  en: "Grid.Col",
275
270
  id: "1b5f30bf-12d2-47ed-bb0f-1fcd7f891282"
276
271
  },
272
+ Row: {
273
+ zh: "行",
274
+ en: "Row",
275
+ id: "5309c915-2a6a-426b-95e3-e1d21e01a832"
276
+ },
277
+ Col: {
278
+ zh: "列",
279
+ en: "Col",
280
+ id: "2ba46e9e-519a-4145-9091-66b4da431a8a"
281
+ },
277
282
  GridItem: {
278
283
  zh: "栅格.项",
279
284
  en: "Grid.Item",
@@ -504,11 +509,6 @@ const e = {
504
509
  en: "Result",
505
510
  id: "f64a32e2-29e9-435a-babd-37d8c57d413d"
506
511
  },
507
- Row: {
508
- zh: "行布局",
509
- en: "Row",
510
- id: "b5b2b3e2-6026-4314-9093-1df24932e39f"
511
- },
512
512
  Select: {
513
513
  zh: "选择器",
514
514
  en: "Select",
@@ -549,6 +549,11 @@ const e = {
549
549
  en: "Statistic.Countdown",
550
550
  id: "fa53aadc-46f4-49d1-99a8-3e7ac97e918a"
551
551
  },
552
+ Countdown: {
553
+ zh: "倒计时",
554
+ en: "Countdown",
555
+ id: "a7a3c750-632e-447f-b889-f6509f9fbc85"
556
+ },
552
557
  Steps: {
553
558
  zh: "步骤条",
554
559
  en: "Steps",
@@ -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-24 17:57:09", t = "1753351029560", 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,35 +0,0 @@
1
- import { useRef as m, useState as p, useEffect as b, useMemo as x } from "react";
2
- import "../../components/common/utils/is.js";
3
- import { responsiveObserve as u, responsiveArray as c } from "../../utils/responsiveObserve.js";
4
- import { isString as k, isNumber as R, isPlainObject as S } from "@unicom-cloud/utils/is";
5
- function O(e) {
6
- return k(e) || R(e) ? !1 : S(e) && Object.keys(e).some((s) => c.some((r) => s === r));
7
- }
8
- const A = (e, s) => {
9
- const r = O(e), n = m(), [o, f] = p({
10
- xs: !0,
11
- sm: !0,
12
- md: !0,
13
- lg: !0,
14
- xl: !0,
15
- xxl: !0,
16
- xxxl: !0
17
- });
18
- return b(() => (r && (n.current = u.subscribe((t) => {
19
- f(t);
20
- })), () => {
21
- r && n.current && u.unsubscribe(n.current);
22
- }), [r]), x(() => {
23
- if (!e || !r) return e;
24
- let t = s;
25
- for (const i of c)
26
- if (o[i] && e[i] !== void 0) {
27
- t = e[i];
28
- break;
29
- }
30
- return t;
31
- }, [s, r, o, e]);
32
- };
33
- export {
34
- A as useResponsiveState
35
- };
@@ -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 { GridProps, ResponsiveValue } from '../interface';
2
- export declare const useResponsiveState: (value: GridProps["cols"], defaultValue: number) => number | ResponsiveValue | import("../interface").AutoGridTemplateColumns | undefined;
@@ -1 +0,0 @@
1
- export declare function getDateString(millisecond: number, format: string): string;