@unicom-cloud/ui 0.8.105 → 0.8.107

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 (87) hide show
  1. package/App.js +7 -0
  2. package/BackTop.js +2 -4
  3. package/Calendar.js +2 -2
  4. package/Modal.js +4 -2
  5. package/Segmented.js +4 -2
  6. package/app/App.js +26 -0
  7. package/app/context.js +9 -0
  8. package/app/index.js +9 -0
  9. package/app/interface.js +1 -0
  10. package/app/useApp.js +8 -0
  11. package/back-top/index.js +44 -56
  12. package/calendar/Lunar.js +71 -0
  13. package/calendar/index.js +11 -11
  14. package/color-picker/index.js +34 -34
  15. package/components/common/flex/index.js +4 -4
  16. package/components/common/icons/file/index.js +13 -11
  17. package/components/common/utils/dayjs.js +99 -124
  18. package/components/common/utils/is.js +98 -104
  19. package/components/common/utils/setDir.js +12 -0
  20. package/components/common/utils/setTheme.js +13 -13
  21. package/config-provider/ConfigProvider.js +32 -30
  22. package/descriptions/index.js +32 -32
  23. package/divider/index.js +28 -20
  24. package/empty/index.js +1 -1
  25. package/grid/Grid.js +55 -88
  26. package/grid/Item.js +40 -61
  27. package/grid/context.js +1 -4
  28. package/grid/hook/useResponsiveState.js +22 -25
  29. package/grid/util.js +6 -44
  30. package/index.js +462 -457
  31. package/input/Button.js +12 -12
  32. package/input/Group.js +11 -12
  33. package/input/Input.js +112 -102
  34. package/input/Search.js +24 -24
  35. package/modal/Confirm.js +17 -17
  36. package/modal/Modal.js +247 -237
  37. package/modal/index.js +4 -2
  38. package/modal/use-modal/index.js +2 -2
  39. package/package.json +1 -1
  40. package/segmented/index.js +93 -90
  41. package/select-view/Core.js +31 -28
  42. package/splitter/SplitBar.js +44 -46
  43. package/style.css +1 -1
  44. package/table/Table.js +198 -210
  45. package/table/th-resizable/index.js +9 -10
  46. package/time-picker/util.js +20 -30
  47. package/types/common/development/interface.d.ts +3 -3
  48. package/types/common/utils/is.d.ts +3 -4
  49. package/types/common/utils/setDir.d.ts +2 -0
  50. package/types/pc/app/App.d.ts +6 -0
  51. package/types/pc/app/context.d.ts +4 -0
  52. package/types/pc/app/index.d.ts +5 -0
  53. package/types/pc/app/interface.d.ts +17 -0
  54. package/types/pc/app/useApp.d.ts +3 -0
  55. package/types/pc/back-top/interface.d.ts +4 -17
  56. package/types/pc/calendar/Lunar.d.ts +17 -0
  57. package/types/pc/calendar/index.d.ts +1 -1
  58. package/types/pc/config-provider/interface.d.ts +1 -1
  59. package/types/pc/divider/interface.d.ts +1 -0
  60. package/types/pc/grid/Grid.d.ts +1 -2
  61. package/types/pc/grid/Item.d.ts +2 -5
  62. package/types/pc/grid/context.d.ts +4 -10
  63. package/types/pc/grid/hook/useResponsiveState.d.ts +2 -2
  64. package/types/pc/grid/interface.d.ts +9 -19
  65. package/types/pc/grid/util.d.ts +1 -10
  66. package/types/pc/index.d.ts +3 -1
  67. package/types/pc/input/Button.d.ts +2 -2
  68. package/types/pc/message/index.d.ts +1 -9
  69. package/types/pc/message/interface.d.ts +8 -0
  70. package/types/pc/message/useMessage.d.ts +1 -2
  71. package/types/pc/modal/Modal.d.ts +1 -0
  72. package/types/pc/modal/config.d.ts +1 -2
  73. package/types/pc/modal/index.d.ts +2 -1
  74. package/types/pc/modal/interface.d.ts +17 -5
  75. package/types/pc/notification/index.d.ts +2 -9
  76. package/types/pc/notification/interface.d.ts +7 -0
  77. package/types/pc/notification/useNotification.d.ts +1 -2
  78. package/types/pc/segmented/interface.d.ts +6 -0
  79. package/types/pc/select-view/Core.d.ts +1 -8
  80. package/types/pc/select-view/index.d.ts +1 -8
  81. package/types/pc/select-view/interface.d.ts +9 -2
  82. package/types/pc/utils/is.d.ts +1 -1
  83. package/types/pc/utils/names.d.ts +303 -0
  84. package/utils/index.js +58 -59
  85. package/utils/is.js +65 -66
  86. package/utils/names.js +298 -144
  87. package/version/index.js +1 -1
@@ -3,68 +3,66 @@ import H from "@unicom-cloud/icons/IconUiDown";
3
3
  import J from "@unicom-cloud/icons/IconUiLeft";
4
4
  import K from "@unicom-cloud/icons/IconUiRight";
5
5
  import Q from "@unicom-cloud/icons/IconUiUp";
6
- import E from "react";
6
+ import { useContext as W, useState as X, useEffect as Z } from "react";
7
7
  import "../config-provider/ConfigProvider.js";
8
8
  import f from "@unicom-cloud/utils/class-name";
9
9
  import Y from "./hooks/useEvent.js";
10
- import W from "../config-provider/context.js";
11
- function O(d) {
10
+ import _ from "../config-provider/context.js";
11
+ function b(d) {
12
12
  return typeof d == "number" && !Number.isNaN(d) ? Math.round(d) : 0;
13
13
  }
14
- const ie = (d) => {
15
- const { getPrefixCls: y } = E.useContext(W), {
14
+ const fe = (d) => {
15
+ const { getPrefixCls: y } = W(_), {
16
16
  prefixCls: I,
17
17
  vertical: s,
18
18
  index: n,
19
19
  active: z,
20
- ariaNow: $,
21
- ariaMin: M,
22
- ariaMax: N,
20
+ ariaNow: E,
21
+ ariaMin: $,
22
+ ariaMax: M,
23
23
  startCollapsible: T,
24
24
  endCollapsible: j,
25
- onOffsetStart: S,
25
+ onOffsetStart: O,
26
26
  onOffsetUpdate: v,
27
27
  onOffsetEnd: h,
28
28
  onCollapse: P,
29
29
  lazy: a,
30
30
  containerSize: m
31
- } = d, e = y?.("bar", I), [r, w] = E.useState(
32
- null
33
- ), [g, U] = E.useState(0), k = s ? 0 : g, A = s ? g : 0, D = (t) => {
34
- t.currentTarget && (w([t.pageX, t.pageY]), S(n));
35
- }, R = (t) => {
36
- if (t.touches.length === 1) {
37
- const o = t.touches[0];
38
- w([o.pageX, o.pageY]), S(n);
31
+ } = d, e = y?.("bar", I), [r, w] = X(null), [g, S] = X(0), k = s ? 0 : g, A = s ? g : 0, D = (o) => {
32
+ o.currentTarget && (w([o.pageX, o.pageY]), O(n));
33
+ }, V = (o) => {
34
+ if (o.touches.length === 1) {
35
+ const t = o.touches[0];
36
+ w([t.pageX, t.pageY]), O(n);
39
37
  }
40
- }, V = (t) => {
41
- const o = m * $ / 100, c = o + t, x = Math.max(0, m * M / 100), i = Math.min(m, m * N / 100);
42
- return Math.max(x, Math.min(i, c)) - o;
43
- }, L = Y((t, o) => {
44
- const c = V(
45
- s ? o : t
38
+ }, B = (o) => {
39
+ const t = m * E / 100, c = t + o, x = Math.max(0, m * $ / 100), i = Math.min(m, m * M / 100);
40
+ return Math.max(x, Math.min(i, c)) - t;
41
+ }, N = Y((o, t) => {
42
+ const c = B(
43
+ s ? t : o
46
44
  );
47
- U(c);
48
- }), b = Y(() => {
49
- v(n, k, A, !0), U(0), h(!0);
45
+ S(c);
46
+ }), L = Y(() => {
47
+ v(n, k, A, !0), S(0), h(!0);
50
48
  });
51
- E.useEffect(() => {
49
+ Z(() => {
52
50
  if (r) {
53
- const t = (i) => {
54
- const { pageX: u, pageY: C } = i, p = u - r[0], X = C - r[1];
55
- a ? L(p, X) : v(n, p, X);
56
- }, o = () => {
57
- a ? b() : h(), w(null);
51
+ const o = (i) => {
52
+ const { pageX: p, pageY: C } = i, u = p - r[0], U = C - r[1];
53
+ a ? N(u, U) : v(n, u, U);
54
+ }, t = () => {
55
+ a ? L() : h(), w(null);
58
56
  }, c = (i) => {
59
57
  if (i.touches.length === 1) {
60
- const u = i.touches[0], C = u.pageX - r[0], p = u.pageY - r[1];
61
- a ? L(C, p) : v(n, C, p);
58
+ const p = i.touches[0], C = p.pageX - r[0], u = p.pageY - r[1];
59
+ a ? N(C, u) : v(n, C, u);
62
60
  }
63
61
  }, x = () => {
64
- a ? b() : h(), w(null);
62
+ a ? L() : h(), w(null);
65
63
  };
66
- return window.addEventListener("touchmove", c), window.addEventListener("touchend", x), window.addEventListener("mousemove", t), window.addEventListener("mouseup", o), () => {
67
- window.removeEventListener("mousemove", t), window.removeEventListener("mouseup", o), window.removeEventListener("touchmove", c), window.removeEventListener("touchend", x);
64
+ return window.addEventListener("touchmove", c), window.addEventListener("touchend", x), window.addEventListener("mousemove", o), window.addEventListener("mouseup", t), () => {
65
+ window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", t), window.removeEventListener("touchmove", c), window.removeEventListener("touchend", x);
68
66
  };
69
67
  }
70
68
  }, [
@@ -73,15 +71,15 @@ const ie = (d) => {
73
71
  s,
74
72
  n,
75
73
  m,
74
+ E,
76
75
  $,
77
76
  M,
78
77
  N,
79
- L,
80
78
  v,
81
- b,
79
+ L,
82
80
  h
83
81
  ]);
84
- const B = {
82
+ const R = {
85
83
  [`--${e}-preview-offset`]: `${g}px`
86
84
  }, q = s ? Q : J, F = s ? H : K;
87
85
  return /* @__PURE__ */ G(
@@ -89,9 +87,9 @@ const ie = (d) => {
89
87
  {
90
88
  className: e,
91
89
  role: "separator",
92
- "aria-valuenow": O($),
93
- "aria-valuemin": O(M),
94
- "aria-valuemax": O(N),
90
+ "aria-valuenow": b(E),
91
+ "aria-valuemin": b($),
92
+ "aria-valuemax": b(M),
95
93
  children: [
96
94
  a && /* @__PURE__ */ l(
97
95
  "div",
@@ -99,7 +97,7 @@ const ie = (d) => {
99
97
  className: f(`${e}-preview`, {
100
98
  [`${e}-preview-active`]: !!g
101
99
  }),
102
- style: B
100
+ style: R
103
101
  }
104
102
  ),
105
103
  /* @__PURE__ */ l(
@@ -109,7 +107,7 @@ const ie = (d) => {
109
107
  [`${e}-dragger-active`]: z
110
108
  }),
111
109
  onMouseDown: D,
112
- onTouchStart: R
110
+ onTouchStart: V
113
111
  }
114
112
  ),
115
113
  T && /* @__PURE__ */ l(
@@ -155,5 +153,5 @@ const ie = (d) => {
155
153
  );
156
154
  };
157
155
  export {
158
- ie as default
156
+ fe as default
159
157
  };