@unicom-cloud/ui 0.8.101 → 0.8.103

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 (141) hide show
  1. package/Badge.js +7 -54
  2. package/Copy.js +6 -5
  3. package/LiquidFill.js +6 -5
  4. package/List.js +1 -1
  5. package/Marquee.js +6 -5
  6. package/QrCode.js +6 -5
  7. package/Tooltip.js +3 -4
  8. package/Tour.js +6 -5
  9. package/anchor/Anchor.js +12 -12
  10. package/anchor/util.js +10 -10
  11. package/back-top/index.js +7 -7
  12. package/badge/index.js +109 -162
  13. package/card/index.js +63 -43
  14. package/color-picker/InputHex.js +3 -4
  15. package/color-picker/InputRgb.js +7 -8
  16. package/color-picker/Palette.js +3 -4
  17. package/color-picker/Panel.js +3 -4
  18. package/color-picker/colors.js +5 -5
  19. package/color-picker/hooks/useColorPicker.js +3 -4
  20. package/color-picker/utils.js +14 -15
  21. package/components/common/space/index.js +24 -24
  22. package/components/common/utils/PqbCSSTransition.js +1 -1
  23. package/components/common/utils/constant.js +6 -3
  24. package/components/common/utils/reactDOM.js +6 -4
  25. package/components/common/utils/{scrollIntoView.js → scrollIntoViewIfNeeded.js} +1 -1
  26. package/components/common/utils/setPrimaryColor.js +18 -18
  27. package/components/common/utils/setTheme.js +8 -9
  28. package/copy/index.js +4 -3
  29. package/dist/scroll-into-view-if-needed/compute/index.js +126 -0
  30. package/dist/scroll-into-view-if-needed/smooth/index.js +70 -0
  31. package/dist/scroll-into-view-if-needed/src/index.js +19 -19
  32. package/form/FormItem.js +69 -65
  33. package/form/context.js +6 -7
  34. package/grid/Col-.js +86 -0
  35. package/grid/Col.js +156 -73
  36. package/grid/Grid.js +71 -67
  37. package/grid/Row.js +53 -44
  38. package/grid/index.js +13 -13
  39. package/index.js +639 -662
  40. package/input/Textarea.js +1 -1
  41. package/input/autoSizeTextAreaHeight.js +7 -7
  42. package/liquid-fill/index.js +6 -5
  43. package/liquid-fill/interface.js +1 -0
  44. package/list/index.js +1 -1
  45. package/marquee/index.js +141 -223
  46. package/marquee/interface.js +1 -0
  47. package/marquee-/index.js +260 -0
  48. package/marquee-/interface.js +1 -0
  49. package/menu/Item.js +9 -9
  50. package/package.json +1 -1
  51. package/qr-code/index.js +6 -5
  52. package/splitter/SplitBar.js +81 -79
  53. package/splitter/Splitter.js +70 -78
  54. package/splitter/hooks/useResizable.js +9 -18
  55. package/splitter/hooks/useResize.js +10 -10
  56. package/splitter/hooks/useSizes.js +28 -28
  57. package/statistic/index.js +10 -10
  58. package/style.css +1 -1
  59. package/table/Table.js +369 -370
  60. package/table/hook/useThResizable.js +6 -5
  61. package/table/th-resizable/index.js +13 -12
  62. package/time-picker/util.js +8 -8
  63. package/tooltip/index.js +1 -2
  64. package/tour/index.js +6 -5
  65. package/tour/interface.js +1 -0
  66. package/tree/NodeList.js +1 -1
  67. package/types/common/utils/constant.d.ts +1 -0
  68. package/types/common/utils/scrollIntoViewIfNeeded.d.ts +4 -0
  69. package/types/common/utils/tree.d.ts +1 -0
  70. package/types/common/utils/tween.d.ts +1 -0
  71. package/types/pc/anchor/util.d.ts +1 -1
  72. package/types/pc/badge/interface.d.ts +2 -0
  73. package/types/pc/card/interface.d.ts +8 -0
  74. package/types/pc/color-picker/hooks/useColorPicker.d.ts +7 -2
  75. package/types/pc/color-picker/utils.d.ts +6 -1
  76. package/types/pc/config-provider/interface.d.ts +8 -8
  77. package/types/pc/form/FormItem.d.ts +1 -1
  78. package/types/pc/grid/Col-.d.ts +4 -0
  79. package/types/pc/grid/Col.d.ts +3 -2
  80. package/types/pc/grid/Grid.d.ts +2 -2
  81. package/types/pc/grid/Item.d.ts +3 -3
  82. package/types/pc/grid/Row.d.ts +3 -2
  83. package/types/pc/grid/hook/useResponsiveState.d.ts +2 -2
  84. package/types/pc/grid/interface.d.ts +13 -7
  85. package/types/pc/index.d.ts +4 -4
  86. package/types/pc/liquid-fill/index.d.ts +2 -113
  87. package/types/pc/liquid-fill/interface.d.ts +113 -0
  88. package/types/pc/marquee/index.d.ts +3 -60
  89. package/types/pc/marquee/interface.d.ts +95 -0
  90. package/types/pc/marquee-/index.d.ts +8 -0
  91. package/types/pc/marquee-/interface.d.ts +56 -0
  92. package/types/pc/qr-code/index.d.ts +1 -31
  93. package/types/pc/qr-code/interface.d.ts +26 -33
  94. package/types/pc/splitter/SplitBar.d.ts +0 -1
  95. package/types/pc/splitter/hooks/useResizable.d.ts +0 -1
  96. package/types/pc/splitter/hooks/useResize.d.ts +1 -2
  97. package/types/pc/splitter/interface.d.ts +0 -8
  98. package/types/pc/tour/index.d.ts +2 -45
  99. package/types/pc/tour/interface.d.ts +46 -0
  100. package/types/pc/upload/interface.d.ts +1 -0
  101. package/types/pc/utils/constant.d.ts +1 -2
  102. package/types/pc/utils/dayjs.d.ts +2 -1
  103. package/types/pc/utils/index.d.ts +2 -5
  104. package/types/pc/utils/responsiveObserve.d.ts +8 -4
  105. package/types/pc/utils/scrollIntoViewIfNeeded.d.ts +3 -0
  106. package/types/pc/utils/tree.d.ts +2 -1
  107. package/types/pc/utils/tween.d.ts +1 -1
  108. package/typography/Ellipsis.js +6 -5
  109. package/typography/Operations.js +6 -5
  110. package/upload/request.js +12 -13
  111. package/upload/request_.js +2 -3
  112. package/utils/constant.js +5 -5
  113. package/utils/dayjs.js +13 -12
  114. package/utils/index.js +261 -284
  115. package/utils/responsiveObserve.js +32 -25
  116. package/utils/scrollIntoViewIfNeeded.js +12 -0
  117. package/utils/tree.js +11 -9
  118. package/utils/tween.js +5 -5
  119. package/version/index.js +1 -1
  120. package/components/common/utils/convertToDurationBasedOnTimeUnits.js +0 -6
  121. package/dist/compute-scroll-into-view/src/index.js +0 -126
  122. package/dist/tinycolor/chunk/BOzCVdr0.js +0 -182
  123. package/dist/tinycolor/customize/index.js +0 -12
  124. package/dist/tinycolor/src/conversion.js +0 -143
  125. package/dist/tinycolor/src/css-color-names.js +0 -153
  126. package/dist/tinycolor/src/format-input.js +0 -77
  127. package/dist/tinycolor/src/index.js +0 -388
  128. package/dist/tinycolor/src/util.js +0 -32
  129. package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
  130. package/types/common/utils/scrollIntoView.d.ts +0 -4
  131. package/types/common/utils/tinycolor.d.ts +0 -1
  132. package/types/pc/utils/color.d.ts +0 -1
  133. package/types/pc/utils/computeScrollIntoView.d.ts +0 -1
  134. package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
  135. package/types/pc/utils/scrollIntoView.d.ts +0 -3
  136. package/types/pc/utils/tinycolor.d.ts +0 -1
  137. package/utils/color.js +0 -4
  138. package/utils/computeScrollIntoView.js +0 -6
  139. package/utils/convertToDurationBasedOnTimeUnits.js +0 -6
  140. package/utils/scrollIntoView.js +0 -6
  141. package/utils/tinycolor.js +0 -29
package/grid/Grid.js CHANGED
@@ -1,95 +1,99 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import L from "lodash/get";
3
- import d, { forwardRef as h, useState as S, useContext as E } from "react";
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import A from "lodash/get";
3
+ import B from "lodash/isArray";
4
+ import n from "lodash/isNil";
5
+ import g, { forwardRef as Q, useState as V, useContext as k } from "react";
4
6
  import "../config-provider/ConfigProvider.js";
5
- import T from "../components/common/hooks/useMergeProps.js";
6
- import b from "@unicom-cloud/utils/class-name";
7
- import { GridDataCollectorContext as j, GridContext as B } from "./context.js";
8
- import { useResponsiveState as l } from "./hook/useResponsiveState.js";
9
- import { setItemVisible as Q } from "./util.js";
10
- import V from "../config-provider/context.js";
11
- const k = {
7
+ import q from "../components/common/hooks/useMergeProps.js";
8
+ import z from "@unicom-cloud/utils/class-name";
9
+ import { GridDataCollectorContext as F, GridContext as H } from "./context.js";
10
+ import { useResponsiveState as m } from "./hook/useResponsiveState.js";
11
+ import { setItemVisible as J } from "./util.js";
12
+ import K from "../config-provider/context.js";
13
+ const O = {
12
14
  collapsed: !1,
13
15
  collapsedRows: 1,
14
16
  cols: 24,
15
- colGap: 0,
16
- rowGap: 0
17
+ gap: 0
17
18
  };
18
- function q(f, u) {
19
- const [t, p] = S(
19
+ function U(w, _) {
20
+ const [o, c] = V(
20
21
  /* @__PURE__ */ new Map()
21
- ), { getPrefixCls: x, componentConfig: G, rtl: C } = E(V), w = T(
22
- f,
23
- k,
24
- G?.Grid
22
+ ), { getPrefixCls: I, componentConfig: N, rtl: D } = k(K), v = q(
23
+ w,
24
+ O,
25
+ N?.Grid
25
26
  ), {
26
- children: g,
27
- className: I,
28
- style: D,
29
- cols: _,
30
- colGap: v,
31
- rowGap: y,
32
- collapsed: n,
33
- collapsedRows: M
34
- } = w, r = l(_, 24), i = l(v, 0), N = {
35
- gap: `${l(y, 0)}px ${i}px`,
36
- gridTemplateColumns: `repeat(${r}, minmax(0px, 1fr))`
37
- }, m = x?.("grid"), P = {
38
- [`${m}`]: !0,
39
- [`${m}-rtl`]: C
40
- }, R = b(P, I), $ = (() => {
27
+ children: y,
28
+ className: R,
29
+ style: M,
30
+ cols: P,
31
+ gap: t,
32
+ colGap: f,
33
+ rowGap: d,
34
+ collapsed: G,
35
+ collapsedRows: $
36
+ } = v;
37
+ let r, a;
38
+ const L = n(t), h = n(d), S = n(f);
39
+ L || (B(t) ? (r = t[0], a = t[1] ?? t[0]) : r = a = t), h || (r = d), S || (a = f);
40
+ const l = m(P, 24), u = m(a, 0), E = {
41
+ gap: `${m(r, 0)}px ${u}px`,
42
+ gridTemplateColumns: `repeat(${l}, minmax(0px, 1fr))`
43
+ }, x = I?.("grid"), T = {
44
+ [`${x}`]: !0,
45
+ [`${x}-rtl`]: D
46
+ }, b = z(T, R), j = (() => {
41
47
  const e = [];
42
- for (const [o, s] of t.entries())
43
- e[o] = s;
48
+ for (const [s, p] of o.entries())
49
+ e[s] = p;
44
50
  return e;
45
- })(), c = Q({
46
- cols: r,
47
- collapsed: n,
48
- collapsedRows: M,
49
- itemDataList: $
51
+ })(), C = J({
52
+ cols: l,
53
+ collapsed: G,
54
+ collapsedRows: $,
55
+ itemDataList: j
50
56
  });
51
- return /* @__PURE__ */ a(
57
+ return /* @__PURE__ */ i(
52
58
  "div",
53
59
  {
54
- ref: u,
55
- className: R,
60
+ ref: _,
61
+ className: b,
56
62
  style: {
57
- ...N,
58
- ...D
63
+ ...E,
64
+ ...M
59
65
  },
60
- children: /* @__PURE__ */ a(
61
- j.Provider,
66
+ children: /* @__PURE__ */ i(
67
+ F.Provider,
62
68
  {
63
69
  value: {
64
- collectItemData(e, o) {
65
- t.set(e, o), p(new Map([...t]));
70
+ collectItemData(e, s) {
71
+ o.set(e, s), c(new Map([...o]));
66
72
  },
67
73
  removeItemData(e) {
68
- t.delete(e), p(new Map([...t]));
74
+ o.delete(e), c(new Map([...o]));
69
75
  }
70
76
  },
71
- children: /* @__PURE__ */ a(
72
- B.Provider,
77
+ children: /* @__PURE__ */ i(
78
+ H.Provider,
73
79
  {
74
80
  value: {
75
- cols: r,
76
- colGap: i,
77
- collapsed: n,
78
- overflow: c.overflow,
79
- displayIndexList: c.displayIndexList
81
+ cols: l,
82
+ colGap: u,
83
+ collapsed: G,
84
+ overflow: C.overflow,
85
+ displayIndexList: C.displayIndexList
80
86
  },
81
- children: d.Children.map(g, (e, o) => {
87
+ children: g.Children.map(y, (e, s) => {
82
88
  if (e) {
83
- const s = {
84
- __index__: o,
89
+ const p = {
90
+ __index__: s,
85
91
  ...e.props
86
92
  };
87
- return d.cloneElement(e, s);
93
+ return g.cloneElement(e, p);
88
94
  }
89
95
  return null;
90
- }).filter(
91
- (e) => L(e, "type.__PQB_GRID_ITEM__")
92
- )
96
+ }).filter((e) => A(e, "type.__PQB_GRID_ITEM__"))
93
97
  }
94
98
  )
95
99
  }
@@ -97,8 +101,8 @@ function q(f, u) {
97
101
  }
98
102
  );
99
103
  }
100
- const z = h(q);
101
- z.displayName = "Grid";
104
+ const W = Q(U);
105
+ W.displayName = "Grid";
102
106
  export {
103
- z as default
107
+ W as default
104
108
  };
package/grid/Row.js CHANGED
@@ -1,23 +1,34 @@
1
- import { jsx as g } from "react/jsx-runtime";
2
- import { forwardRef as S, useContext as z, useState as G, useRef as H, useEffect as V } from "react";
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
3
  import "../config-provider/ConfigProvider.js";
4
4
  import B from "../components/common/hooks/useMergeProps.js";
5
5
  import E from "@unicom-cloud/utils/class-name";
6
+ import "../components/common/utils/is.js";
6
7
  import { omit as L } from "../components/common/utils/omit.js";
7
- import { responsiveObserve as y, responsiveArray as x } from "../utils/responsiveObserve.js";
8
+ import { responsiveObserve as x, responsiveArray as y } from "../utils/responsiveObserve.js";
8
9
  import { RowContext as M } from "./context.js";
9
- import O from "../config-provider/context.js";
10
- const T = {
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 = {
11
13
  gutter: 0,
12
14
  align: "start",
13
15
  justify: "start"
14
16
  };
15
- function q(d, b) {
16
- const { getPrefixCls: A, componentConfig: j, rtl: v } = z(O), C = B(
17
- d,
18
- T,
19
- j?.["Grid.Row"]
20
- ), { className: R, style: w, children: $, div: i, align: m, justify: l, gutter: t, ...N } = C, [h, P] = G({
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({
21
32
  xs: !0,
22
33
  sm: !0,
23
34
  md: !0,
@@ -25,63 +36,61 @@ function q(d, b) {
25
36
  xl: !0,
26
37
  xxl: !0,
27
38
  xxxl: !0
28
- }), u = H();
29
- V(() => (u.current = y.subscribe((r) => {
30
- (!Array.isArray(t) && typeof t == "object" || Array.isArray(t) && (typeof t[0] == "object" || typeof t[1] == "object")) && P(r);
39
+ }), n = U();
40
+ V(() => (n.current = x.subscribe((t) => {
41
+ (f(r) || Array.isArray(r) && (f(r[0]) || f(r[1]))) && O(t);
31
42
  }), () => {
32
- y.unsubscribe(u.current);
43
+ n.current && x.unsubscribe(n.current);
33
44
  }), []);
34
- function p(r) {
45
+ function g(t) {
35
46
  let e = 0;
36
- if (typeof r == "object")
37
- for (let c = 0; c < x.length; c++) {
38
- const f = x[c];
39
- if (h[f] && r[f] !== void 0) {
40
- e = r[f];
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];
41
52
  break;
42
53
  }
43
54
  }
44
55
  else
45
- e = r;
56
+ e = t;
46
57
  return e;
47
58
  }
48
- const s = A?.("row"), k = E(
59
+ const s = R?.("row"), S = E(
49
60
  {
50
61
  [`${s}`]: !i,
51
- [`${s}-align-${m}`]: m,
52
- [`${s}-justify-${l}`]: l,
53
- [`${s}-rtl`]: v
62
+ [`${s}-align-${u}`]: u,
63
+ [`${s}-justify-${p}`]: p,
64
+ [`${s}-rtl`]: j
54
65
  },
55
- R
56
- ), o = {}, n = p(
57
- Array.isArray(t) ? t[0] : t
58
- ), a = p(Array.isArray(t) ? t[1] : 0);
59
- if ((n || a) && !i) {
60
- const r = -n / 2, e = -a / 2;
61
- r && (o.marginLeft = r, o.marginRight = r), e && (o.marginTop = e, o.marginBottom = e);
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);
62
71
  }
63
- return /* @__PURE__ */ g(
72
+ return /* @__PURE__ */ d(
64
73
  "div",
65
74
  {
66
- ref: b,
67
- ...L(N, ["gutter"]),
75
+ ref: C,
76
+ ...L(A, ["gutter"]),
68
77
  style: {
69
- ...w,
78
+ ...P,
70
79
  ...o
71
80
  },
72
- className: k,
73
- children: /* @__PURE__ */ g(
81
+ className: S,
82
+ children: /* @__PURE__ */ d(
74
83
  M.Provider,
75
84
  {
76
- value: { gutter: [n, a], div: i },
77
- children: $
85
+ value: { gutter: [a, m], div: i },
86
+ children: h
78
87
  }
79
88
  )
80
89
  }
81
90
  );
82
91
  }
83
- const D = S(q);
84
- D.displayName = "Row";
92
+ const I = z(F);
93
+ I.displayName = "Row";
85
94
  export {
86
- D as default
95
+ I as default
87
96
  };
package/grid/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import m from "./Col.js";
2
- import r from "./Grid.js";
3
- import t from "./Item.js";
4
- import i from "./Row.js";
5
- const o = r;
6
- o.Col = m;
7
- o.Row = i;
8
- o.Item = t;
1
+ import r from "./Col.js";
2
+ import m from "./Grid.js";
3
+ import i from "./Item.js";
4
+ import t from "./Row.js";
5
+ const o = m;
6
+ o.Col = r;
7
+ o.Row = t;
8
+ o.Item = i;
9
9
  export {
10
- m as Col,
11
- m as GridCol,
12
- t as GridItem,
13
- i as GridRow,
14
- i as Row,
10
+ r as Col,
11
+ r as GridCol,
12
+ i as GridItem,
13
+ t as GridRow,
14
+ t as Row,
15
15
  o as default
16
16
  };