@unicom-cloud/ui 0.8.101 → 0.8.102

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 (122) hide show
  1. package/Badge.js +7 -54
  2. package/Copy.js +5 -4
  3. package/LiquidFill.js +5 -4
  4. package/List.js +1 -1
  5. package/Marquee.js +5 -4
  6. package/QrCode.js +5 -4
  7. package/Tooltip.js +3 -4
  8. package/Tour.js +5 -4
  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/utils/PqbCSSTransition.js +1 -1
  22. package/components/common/utils/constant.js +6 -3
  23. package/components/common/utils/reactDOM.js +6 -4
  24. package/components/common/utils/{scrollIntoView.js → scrollIntoViewIfNeeded.js} +1 -1
  25. package/components/common/utils/setPrimaryColor.js +18 -18
  26. package/components/common/utils/setTheme.js +8 -9
  27. package/copy/index.js +3 -2
  28. package/dist/scroll-into-view-if-needed/compute/index.js +126 -0
  29. package/dist/scroll-into-view-if-needed/smooth/index.js +70 -0
  30. package/dist/scroll-into-view-if-needed/src/index.js +19 -19
  31. package/form/FormItem.js +69 -65
  32. package/form/context.js +6 -7
  33. package/grid/Col-.js +86 -0
  34. package/grid/Col.js +156 -73
  35. package/grid/Grid.js +71 -67
  36. package/grid/Row.js +3 -3
  37. package/grid/index.js +13 -13
  38. package/index.js +639 -662
  39. package/input/Textarea.js +1 -1
  40. package/input/autoSizeTextAreaHeight.js +7 -7
  41. package/liquid-fill/index.js +5 -4
  42. package/list/index.js +1 -1
  43. package/marquee/index.js +5 -4
  44. package/menu/Item.js +9 -9
  45. package/package.json +1 -1
  46. package/qr-code/index.js +5 -4
  47. package/splitter/SplitBar.js +81 -79
  48. package/splitter/Splitter.js +70 -78
  49. package/splitter/hooks/useResizable.js +9 -18
  50. package/splitter/hooks/useResize.js +10 -10
  51. package/splitter/hooks/useSizes.js +28 -28
  52. package/statistic/index.js +10 -10
  53. package/style.css +1 -1
  54. package/table/Table.js +369 -370
  55. package/table/hook/useThResizable.js +5 -4
  56. package/table/th-resizable/index.js +12 -11
  57. package/time-picker/util.js +8 -8
  58. package/tooltip/index.js +1 -2
  59. package/tour/index.js +5 -4
  60. package/tree/NodeList.js +1 -1
  61. package/types/common/utils/constant.d.ts +1 -0
  62. package/types/common/utils/scrollIntoViewIfNeeded.d.ts +4 -0
  63. package/types/common/utils/tree.d.ts +1 -0
  64. package/types/common/utils/tween.d.ts +1 -0
  65. package/types/pc/anchor/util.d.ts +1 -1
  66. package/types/pc/badge/interface.d.ts +2 -0
  67. package/types/pc/card/interface.d.ts +8 -0
  68. package/types/pc/color-picker/hooks/useColorPicker.d.ts +7 -2
  69. package/types/pc/color-picker/utils.d.ts +6 -1
  70. package/types/pc/form/FormItem.d.ts +1 -1
  71. package/types/pc/grid/Col-.d.ts +4 -0
  72. package/types/pc/grid/Col.d.ts +3 -2
  73. package/types/pc/grid/Grid.d.ts +2 -2
  74. package/types/pc/grid/Item.d.ts +3 -3
  75. package/types/pc/grid/Row.d.ts +2 -2
  76. package/types/pc/grid/hook/useResponsiveState.d.ts +2 -2
  77. package/types/pc/grid/interface.d.ts +13 -7
  78. package/types/pc/splitter/SplitBar.d.ts +0 -1
  79. package/types/pc/splitter/hooks/useResizable.d.ts +0 -1
  80. package/types/pc/splitter/hooks/useResize.d.ts +1 -2
  81. package/types/pc/splitter/interface.d.ts +0 -8
  82. package/types/pc/tour/index.d.ts +1 -1
  83. package/types/pc/upload/interface.d.ts +1 -0
  84. package/types/pc/utils/constant.d.ts +1 -2
  85. package/types/pc/utils/dayjs.d.ts +2 -1
  86. package/types/pc/utils/index.d.ts +2 -5
  87. package/types/pc/utils/scrollIntoViewIfNeeded.d.ts +3 -0
  88. package/types/pc/utils/tree.d.ts +2 -1
  89. package/types/pc/utils/tween.d.ts +1 -1
  90. package/typography/Ellipsis.js +5 -4
  91. package/typography/Operations.js +5 -4
  92. package/upload/request.js +12 -13
  93. package/upload/request_.js +2 -3
  94. package/utils/constant.js +5 -5
  95. package/utils/dayjs.js +13 -12
  96. package/utils/index.js +261 -284
  97. package/utils/scrollIntoViewIfNeeded.js +12 -0
  98. package/utils/tree.js +11 -9
  99. package/utils/tween.js +5 -5
  100. package/version/index.js +1 -1
  101. package/components/common/utils/convertToDurationBasedOnTimeUnits.js +0 -6
  102. package/dist/compute-scroll-into-view/src/index.js +0 -126
  103. package/dist/tinycolor/chunk/BOzCVdr0.js +0 -182
  104. package/dist/tinycolor/customize/index.js +0 -12
  105. package/dist/tinycolor/src/conversion.js +0 -143
  106. package/dist/tinycolor/src/css-color-names.js +0 -153
  107. package/dist/tinycolor/src/format-input.js +0 -77
  108. package/dist/tinycolor/src/index.js +0 -388
  109. package/dist/tinycolor/src/util.js +0 -32
  110. package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
  111. package/types/common/utils/scrollIntoView.d.ts +0 -4
  112. package/types/common/utils/tinycolor.d.ts +0 -1
  113. package/types/pc/utils/color.d.ts +0 -1
  114. package/types/pc/utils/computeScrollIntoView.d.ts +0 -1
  115. package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +0 -3
  116. package/types/pc/utils/scrollIntoView.d.ts +0 -3
  117. package/types/pc/utils/tinycolor.d.ts +0 -1
  118. package/utils/color.js +0 -4
  119. package/utils/computeScrollIntoView.js +0 -6
  120. package/utils/convertToDurationBasedOnTimeUnits.js +0 -6
  121. package/utils/scrollIntoView.js +0 -6
  122. 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
@@ -17,7 +17,7 @@ function q(d, b) {
17
17
  d,
18
18
  T,
19
19
  j?.["Grid.Row"]
20
- ), { className: R, style: w, children: $, div: i, align: m, justify: l, gutter: t, ...N } = C, [h, P] = G({
20
+ ), { className: R, style: $, children: w, div: i, align: m, justify: l, gutter: t, ...N } = C, [h, P] = G({
21
21
  xs: !0,
22
22
  sm: !0,
23
23
  md: !0,
@@ -66,7 +66,7 @@ function q(d, b) {
66
66
  ref: b,
67
67
  ...L(N, ["gutter"]),
68
68
  style: {
69
- ...w,
69
+ ...$,
70
70
  ...o
71
71
  },
72
72
  className: k,
@@ -74,7 +74,7 @@ function q(d, b) {
74
74
  M.Provider,
75
75
  {
76
76
  value: { gutter: [n, a], div: i },
77
- children: $
77
+ children: w
78
78
  }
79
79
  )
80
80
  }
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
  };