@unicom-cloud/ui 0.8.98 → 0.8.100

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 (180) hide show
  1. package/Anchor.js +3 -1
  2. package/Badge.js +54 -7
  3. package/Copy.js +49 -2
  4. package/Flex.js +12 -0
  5. package/Grid.js +1 -1
  6. package/LiquidFill.js +60 -2
  7. package/Marquee.js +62 -0
  8. package/QrCode.js +14 -9
  9. package/Segmented.js +11 -0
  10. package/Space.js +14 -6
  11. package/Splitter.js +6 -0
  12. package/Tag.js +3 -2
  13. package/Tour.js +14 -9
  14. package/alert/index.js +38 -39
  15. package/anchor/index.js +5 -3
  16. package/badge/index.js +174 -80
  17. package/collapse/Collapse.js +54 -48
  18. package/components/common/space/index.js +90 -106
  19. package/copy/index.js +83 -35
  20. package/flex/index.js +59 -0
  21. package/flex/interface.js +34 -0
  22. package/flex/utils.js +13 -0
  23. package/grid/{GridItem.js → Item.js} +15 -15
  24. package/grid/index.js +1 -1
  25. package/index.js +490 -477
  26. package/input/Button.js +39 -34
  27. package/input/Textarea.js +108 -104
  28. package/liquid-fill/index.js +256 -2
  29. package/marquee/index.js +283 -0
  30. package/menu/Item.js +17 -16
  31. package/package.json +1 -1
  32. package/qr-code/index.js +54 -36
  33. package/rate/index.js +8 -8
  34. package/segmented/index.js +225 -0
  35. package/space/index.js +28 -29
  36. package/spin/index.js +75 -62
  37. package/splitter/Panel.js +39 -0
  38. package/splitter/SplitBar.js +157 -0
  39. package/splitter/Splitter.js +139 -0
  40. package/splitter/hooks/useEvent.js +12 -0
  41. package/splitter/hooks/useItems.js +26 -0
  42. package/splitter/hooks/useResizable.js +26 -0
  43. package/splitter/hooks/useResize.js +68 -0
  44. package/splitter/hooks/useSizes.js +60 -0
  45. package/splitter/index.js +7 -0
  46. package/splitter/interface.js +1 -0
  47. package/style.css +1 -1
  48. package/table/Table.js +1 -1
  49. package/table/hook/useThResizable.js +72 -26
  50. package/table/tbody/Td.js +80 -77
  51. package/table/th-resizable/index.js +92 -35
  52. package/tag/index.js +42 -41
  53. package/tooltip/index.js +89 -82
  54. package/tour/index.js +110 -89
  55. package/types/common/hooks/useMergeProps.d.ts +1 -1
  56. package/types/common/space/index.d.ts +7 -5
  57. package/types/common/space/interface.d.ts +29 -16
  58. package/types/pc/affix/interface.d.ts +0 -2
  59. package/types/pc/alert/index.d.ts +2 -2
  60. package/types/pc/anchor/index.d.ts +2 -1
  61. package/types/pc/anchor/interface.d.ts +0 -2
  62. package/types/pc/auto-complete/interface.d.ts +0 -6
  63. package/types/pc/avatar/interface.d.ts +0 -4
  64. package/types/pc/badge/index.d.ts +4 -4
  65. package/types/pc/badge/interface.d.ts +26 -0
  66. package/types/pc/breadcrumb/interface.d.ts +0 -3
  67. package/types/pc/carousel/interface.d.ts +2 -6
  68. package/types/pc/cascader/interface.d.ts +6 -18
  69. package/types/pc/checkbox/interface.d.ts +0 -1
  70. package/types/pc/collapse/interface.d.ts +4 -2
  71. package/types/pc/color-picker/interface.d.ts +0 -2
  72. package/types/pc/config-provider/interface.d.ts +16 -14
  73. package/types/pc/copy/interface.d.ts +2 -1
  74. package/types/pc/date-picker/RangePicker.d.ts +1 -1
  75. package/types/pc/date-picker/interface.d.ts +0 -17
  76. package/types/pc/descriptions/interface.d.ts +0 -1
  77. package/types/pc/drawer/interface.d.ts +0 -7
  78. package/types/pc/dropdown/interface.d.ts +0 -1
  79. package/types/pc/flex/index.d.ts +9 -0
  80. package/types/pc/flex/interface.d.ts +61 -0
  81. package/types/pc/flex/utils.d.ts +9 -0
  82. package/types/pc/form/interface.d.ts +9 -22
  83. package/types/pc/form/util.d.ts +1 -1
  84. package/types/pc/grid/index.d.ts +3 -3
  85. package/types/pc/grid/interface.d.ts +1 -6
  86. package/types/pc/image/interface.d.ts +0 -13
  87. package/types/pc/index.d.ts +16 -6
  88. package/types/pc/input/Textarea.d.ts +2 -6
  89. package/types/pc/input/interface.d.ts +5 -13
  90. package/types/pc/input-number/interface.d.ts +0 -4
  91. package/types/pc/input-tag/interface.d.ts +0 -13
  92. package/types/pc/layout/interface.d.ts +0 -1
  93. package/types/pc/link/interface.d.ts +0 -1
  94. package/types/pc/liquid-fill/index.d.ts +114 -1
  95. package/types/pc/list/interface.d.ts +0 -4
  96. package/types/pc/marquee/index.d.ts +61 -0
  97. package/types/pc/menu/context.d.ts +1 -1
  98. package/types/pc/menu/interface.d.ts +0 -8
  99. package/types/pc/message/interface.d.ts +0 -2
  100. package/types/pc/modal/interface.d.ts +0 -5
  101. package/types/pc/notification/interface.d.ts +0 -1
  102. package/types/pc/pagination/interface.d.ts +0 -2
  103. package/types/pc/popconfirm/interface.d.ts +8 -10
  104. package/types/pc/popover/interface.d.ts +0 -1
  105. package/types/pc/progress/interface.d.ts +0 -3
  106. package/types/pc/qr-code/index.d.ts +1 -1
  107. package/types/pc/rate/index.d.ts +2 -2
  108. package/types/pc/resize-box/interface.d.ts +1 -7
  109. package/types/pc/segmented/index.d.ts +8 -0
  110. package/types/pc/segmented/interface.d.ts +88 -0
  111. package/types/pc/select/interface.d.ts +0 -12
  112. package/types/pc/select-view/interface.d.ts +0 -7
  113. package/types/pc/slider/interface.d.ts +0 -4
  114. package/types/pc/space/index.d.ts +4 -1
  115. package/types/pc/space/interface.d.ts +6 -10
  116. package/types/pc/spin/interface.d.ts +4 -1
  117. package/types/pc/splitter/Panel.d.ts +8 -0
  118. package/types/pc/splitter/SplitBar.d.ts +21 -0
  119. package/types/pc/splitter/Splitter.d.ts +4 -0
  120. package/types/pc/splitter/hooks/useEvent.d.ts +3 -0
  121. package/types/pc/splitter/hooks/useItems.d.ts +10 -0
  122. package/types/pc/splitter/hooks/useResizable.d.ts +8 -0
  123. package/types/pc/splitter/hooks/useResize.d.ts +4 -0
  124. package/types/pc/splitter/hooks/useSizes.d.ts +5 -0
  125. package/types/pc/splitter/index.d.ts +8 -0
  126. package/types/pc/splitter/interface.d.ts +213 -0
  127. package/types/pc/statistic/interface.d.ts +0 -4
  128. package/types/pc/steps/interface.d.ts +0 -3
  129. package/types/pc/table/hook/useThResizable.d.ts +2 -2
  130. package/types/pc/table/interface.d.ts +4 -15
  131. package/types/pc/tabs/interface.d.ts +0 -7
  132. package/types/pc/tag/index.d.ts +2 -0
  133. package/types/pc/tag/interface.d.ts +0 -1
  134. package/types/pc/time-picker/interface.d.ts +0 -7
  135. package/types/pc/tooltip/interface.d.ts +4 -1
  136. package/types/pc/tour/index.d.ts +6 -1
  137. package/types/pc/transfer/interface.d.ts +2 -9
  138. package/types/pc/tree/interface.d.ts +2 -8
  139. package/types/pc/tree-select/interface.d.ts +0 -8
  140. package/types/pc/trigger/interface.d.ts +0 -5
  141. package/types/pc/typography/EditContent.d.ts +2 -1
  142. package/types/pc/typography/interface.d.ts +45 -30
  143. package/types/pc/upload/interface.d.ts +6 -11
  144. package/types/pc/utils/index.d.ts +1 -0
  145. package/types/pc/utils/names.d.ts +24 -0
  146. package/types/pc/utils/toArray.d.ts +7 -0
  147. package/types/pc/verification-code/interface.d.ts +0 -2
  148. package/types/pc/watermark/interface.d.ts +0 -2
  149. package/typography/Base.js +73 -73
  150. package/typography/EditContent.js +43 -33
  151. package/typography/Ellipsis.js +117 -184
  152. package/typography/Operations.js +97 -49
  153. package/typography/useCssEllipsis.js +7 -6
  154. package/utils/index.js +117 -115
  155. package/utils/names.js +16 -0
  156. package/utils/toArray.js +12 -0
  157. package/version/index.js +1 -1
  158. package/_virtual/_commonjsHelpers.js +0 -6
  159. package/_virtual/index.js +0 -7
  160. package/_virtual/index2.js +0 -4
  161. package/liquid-fill/LiquidFill.js +0 -226
  162. package/liquid-fill/LiquidFill2.js +0 -3
  163. package/space-/index.js +0 -93
  164. package/types/common/utils/color.d.ts +0 -1
  165. package/types/common/utils/computeScrollIntoView.d.ts +0 -1
  166. package/types/common/utils/index.d.ts +0 -45
  167. package/types/common/utils/math.d.ts +0 -1
  168. package/types/common/utils/reactTransitionGroup.d.ts +0 -1
  169. package/types/common/utils/tree.d.ts +0 -1
  170. package/types/common/utils/tween.d.ts +0 -1
  171. package/types/common/utils/uuid.d.ts +0 -1
  172. package/types/common/utils/validate.d.ts +0 -1
  173. package/types/pc/liquid-fill/LiquidFill.d.ts +0 -115
  174. package/types/pc/liquid-fill/LiquidFill2.d.ts +0 -1
  175. package/types/pc/space-/index.d.ts +0 -6
  176. package/types/pc/space-/interface.d.ts +0 -38
  177. /package/{space- → components/common/space}/toArray.js +0 -0
  178. /package/{space- → segmented}/interface.js +0 -0
  179. /package/types/{pc/space- → common/space}/toArray.d.ts +0 -0
  180. /package/types/pc/grid/{GridItem.d.ts → Item.d.ts} +0 -0
@@ -0,0 +1,225 @@
1
+ import { jsxs as D, jsx as w, Fragment as ee } from "react/jsx-runtime";
2
+ import { forwardRef as te, useContext as ne, useMemo as re, useState as P, useRef as N, useCallback as oe, useEffect as A } from "react";
3
+ import "../config-provider/ConfigProvider.js";
4
+ import ae from "../components/common/hooks/useMergeProps.js";
5
+ import E from "@unicom-cloud/utils/class-name";
6
+ import { resizeObserver as se } from "../components/common/utils/resizeObserver.js";
7
+ import ie from "../config-provider/context.js";
8
+ const ce = {
9
+ options: [],
10
+ size: "medium",
11
+ mode: "default",
12
+ disabled: !1,
13
+ block: !1,
14
+ direction: "horizontal",
15
+ showIndicator: !0,
16
+ animationDuration: 300
17
+ }, le = te(
18
+ (M, d) => {
19
+ const { getPrefixCls: j, componentConfig: B, rtl: K } = ne(ie), L = ae(
20
+ M,
21
+ ce,
22
+ B?.Segmented
23
+ ), {
24
+ style: U,
25
+ className: F,
26
+ options: O = [],
27
+ defaultValue: y,
28
+ value: R,
29
+ size: H,
30
+ mode: v,
31
+ disabled: f,
32
+ block: _,
33
+ direction: p,
34
+ showIndicator: $,
35
+ animationDuration: q,
36
+ name: x,
37
+ onChange: C,
38
+ ...G
39
+ } = L, a = re(() => O.map((e) => typeof e == "string" ? { value: e, label: e } : e), [O]), [J, V] = P(() => y && a.some((e) => e.value === y) ? y : a[0]?.value || ""), [Q, m] = P({}), l = N(null), k = N([]), S = N(!1), r = j?.("segmented"), T = E(
40
+ r,
41
+ {
42
+ [`${r}-block`]: _,
43
+ [`${r}-disabled`]: f,
44
+ [`${r}-rtl`]: K,
45
+ [`${r}-${v}`]: v,
46
+ [`${r}-${p}`]: p
47
+ },
48
+ F
49
+ ), h = R !== void 0, i = h ? R : J, b = oe(() => {
50
+ if (!$ || !l.current) {
51
+ m((s) => ({ ...s, opacity: 0 }));
52
+ return;
53
+ }
54
+ const e = a.findIndex(
55
+ (s) => s?.value === i
56
+ );
57
+ if (e === -1) {
58
+ m((s) => ({ ...s, opacity: 0 }));
59
+ return;
60
+ }
61
+ const o = k.current[e];
62
+ if (!o) {
63
+ m((s) => ({ ...s, opacity: 0 }));
64
+ return;
65
+ }
66
+ const n = l.current.getBoundingClientRect(), t = o.getBoundingClientRect(), c = p === "vertical" ? {
67
+ width: t.width,
68
+ // 垂直模式下宽度撑满
69
+ top: t.top - n.top,
70
+ height: t.height
71
+ } : {
72
+ width: t.width,
73
+ left: t.left - n.left,
74
+ height: t.height
75
+ // 水平模式下高度撑满
76
+ };
77
+ m({
78
+ ...c,
79
+ opacity: 1
80
+ });
81
+ }, [i, a, $, p]), z = (e, o) => {
82
+ o || f || (h || V(e), C?.(e));
83
+ }, W = (e, o) => {
84
+ if (f) return;
85
+ const n = a.length;
86
+ if (n === 0) return;
87
+ let t = o;
88
+ switch (e.key) {
89
+ case "ArrowLeft":
90
+ case "ArrowUp":
91
+ e.preventDefault(), t = (o - 1 + n) % n;
92
+ break;
93
+ case "ArrowRight":
94
+ case "ArrowDown":
95
+ e.preventDefault(), t = (o + 1) % n;
96
+ break;
97
+ case "Home":
98
+ e.preventDefault(), t = 0;
99
+ break;
100
+ case "End":
101
+ e.preventDefault(), t = n - 1;
102
+ break;
103
+ default:
104
+ return;
105
+ }
106
+ for (; t !== o && a[t]?.disabled; )
107
+ t = (t + (e.key === "ArrowLeft" || e.key === "ArrowUp" ? -1 : 1) + n) % n;
108
+ const c = a[t]?.value;
109
+ c && c !== i && (z(c), k.current[t]?.focus());
110
+ };
111
+ A(() => {
112
+ if (!S.current) {
113
+ S.current = !0;
114
+ return;
115
+ }
116
+ if (!a.some((e) => e.value === i)) {
117
+ const e = a[0]?.value || "";
118
+ h || V(e), C?.(e);
119
+ }
120
+ }, [a, i, h, C]), A(() => {
121
+ b();
122
+ }, [i, a, b]), A(() => {
123
+ if (!l.current) return;
124
+ const e = se(
125
+ [l.current],
126
+ () => {
127
+ b();
128
+ }
129
+ );
130
+ return () => {
131
+ e();
132
+ };
133
+ }, [b]);
134
+ const X = (e, o) => {
135
+ if (e.render)
136
+ return e.render(e, o);
137
+ const n = !e.label && !!e.icon;
138
+ return /* @__PURE__ */ D(ee, { children: [
139
+ e.icon && /* @__PURE__ */ w("span", { className: `${r}-option-icon`, children: e.icon }),
140
+ !n && e.label && /* @__PURE__ */ w("span", { className: `${r}-option-label`, children: e.label })
141
+ ] });
142
+ };
143
+ return /* @__PURE__ */ D(
144
+ "div",
145
+ {
146
+ ref: (e) => {
147
+ typeof d == "function" ? d(e) : d && (d.current = e), l.current = e;
148
+ },
149
+ ...G,
150
+ style: U,
151
+ className: T,
152
+ role: "radiogroup",
153
+ children: [
154
+ !Array.isArray(a) || a.length === 0 ? null : a.map((e, o) => {
155
+ if (!e) return null;
156
+ const {
157
+ value: n,
158
+ label: t,
159
+ disabled: c,
160
+ icon: s,
161
+ render: de,
162
+ ...Y
163
+ } = e, u = n === i, g = c || f, Z = !t && !!s;
164
+ return /* @__PURE__ */ D(
165
+ "button",
166
+ {
167
+ ref: (I) => k.current[o] = I,
168
+ className: E(
169
+ `${r}-option`,
170
+ `${r}-option-${H}`,
171
+ `${r}-option-${v}`,
172
+ {
173
+ [`${r}-option-active`]: u,
174
+ [`${r}-option-disabled`]: g,
175
+ [`${r}-option-icon-only`]: Z
176
+ }
177
+ ),
178
+ onClick: () => z(n, g),
179
+ onKeyDown: (I) => W(I, o),
180
+ disabled: g,
181
+ role: "radio",
182
+ "aria-checked": u,
183
+ "aria-disabled": g,
184
+ tabIndex: u ? 0 : -1,
185
+ ...Y,
186
+ children: [
187
+ x && /* @__PURE__ */ w(
188
+ "input",
189
+ {
190
+ type: "radio",
191
+ name: x,
192
+ value: n,
193
+ checked: u,
194
+ onChange: () => {
195
+ },
196
+ className: `${r}-input`,
197
+ tabIndex: -1,
198
+ "aria-hidden": "true"
199
+ }
200
+ ),
201
+ X(e, u)
202
+ ]
203
+ },
204
+ n + o
205
+ );
206
+ }),
207
+ $ && /* @__PURE__ */ w(
208
+ "div",
209
+ {
210
+ className: `${r}-indicator`,
211
+ style: {
212
+ ...Q,
213
+ transitionDuration: `${q}ms`
214
+ }
215
+ }
216
+ )
217
+ ]
218
+ }
219
+ );
220
+ }
221
+ );
222
+ le.displayName = "Segmented";
223
+ export {
224
+ le as default
225
+ };
package/space/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
- import { forwardRef as g, useContext as x } from "react";
3
- import C from "../components/common/space/index.js";
4
- import { SpaceVertical as J } from "../components/common/space/index.js";
2
+ import { forwardRef as C, useContext as d } from "react";
3
+ import u, { SpaceVertical as x } from "../components/common/space/index.js";
5
4
  import "../config-provider/ConfigProvider.js";
6
5
  import "lodash/isEqualWith";
7
6
  import "../components/common/utils/is.js";
@@ -10,43 +9,43 @@ import "lodash/isNumber";
10
9
  import "lodash/merge";
11
10
  import "../components/common/utils/dom.js";
12
11
  import "../components/common/hooks/useIntersectionObserver.js";
13
- import d from "../components/common/hooks/useMergeProps.js";
12
+ import N from "../components/common/hooks/useMergeProps.js";
14
13
  import "../components/common/utils/reactDOM.js";
15
14
  import "@unicom-cloud/utils/constant";
16
15
  import "lodash/debounce";
17
- import u from "@unicom-cloud/utils/class-name";
16
+ import S from "@unicom-cloud/utils/class-name";
18
17
  import $ from "../config-provider/context.js";
19
- const N = {
20
- gap: "small",
18
+ const g = {
19
+ size: "small",
21
20
  direction: "horizontal"
22
21
  };
23
- function S(m, a) {
24
- const { getPrefixCls: s, componentConfig: n, rtl: P } = x($), c = d(
25
- m,
26
- N,
27
- n?.Space
28
- ), { className: f, direction: t, wrap: p, size: e, align: i, ...o } = c;
29
- e && (o.gap = e), i && (o.alignItems = i);
30
- const r = s?.("space");
22
+ function w(e, i) {
23
+ const { getPrefixCls: m, componentConfig: s, rtl: a } = d($), c = N(
24
+ e,
25
+ g,
26
+ s?.Space
27
+ ), { className: n, direction: o, wrap: t, ...f } = c, r = m?.("space");
31
28
  return /* @__PURE__ */ l(
32
- C,
29
+ u,
33
30
  {
34
- ref: a,
35
- className: u(
36
- `${r}`,
37
- p && `${r}-wrap`,
38
- `${r}-${t}`,
39
- f
31
+ ref: i,
32
+ className: S(
33
+ r,
34
+ t && `${r}-wrap`,
35
+ o && `${r}-${o}`,
36
+ n
40
37
  ),
41
- direction: t,
42
- wrap: p,
43
- ...o
38
+ direction: o,
39
+ wrap: t,
40
+ rtl: a,
41
+ ...f
44
42
  }
45
43
  );
46
44
  }
47
- const w = g(S);
48
- w.displayName = "Space";
45
+ const p = C(w);
46
+ p.displayName = "Space";
47
+ p.Vertical = x;
49
48
  export {
50
- J as SpaceVertical,
51
- w as default
49
+ x as SpaceVertical,
50
+ p as default
52
51
  };
package/spin/index.js CHANGED
@@ -1,80 +1,93 @@
1
- import { jsx as n, jsxs as r, Fragment as u } from "react/jsx-runtime";
2
- import E from "@unicom-cloud/icons/IconUiLoading";
3
- import I from "lodash/debounce";
4
- import h, { useContext as j, useState as w, useCallback as P, useRef as D, useImperativeHandle as F, useEffect as H } from "react";
1
+ import { jsx as n, jsxs as $, Fragment as h } from "react/jsx-runtime";
2
+ import w from "@unicom-cloud/icons/IconUiLoading";
3
+ import P from "lodash/debounce";
4
+ import y, { useContext as _, useState as D, useCallback as F, useRef as H, useImperativeHandle as M, useEffect as U } from "react";
5
5
  import "../config-provider/ConfigProvider.js";
6
- import M from "../components/common/hooks/useMergeProps.js";
7
- import N from "@unicom-cloud/utils/class-name";
8
- import { isEmptyReactNode as U } from "../components/common/utils/is.js";
9
- import _ from "./DotLoading.js";
10
- import q from "../config-provider/context.js";
11
- function A($, y) {
12
- const { getPrefixCls: S, componentConfig: C } = j(q), x = M($, {}, C?.Spin), {
13
- style: v,
14
- className: L,
15
- children: l,
6
+ import q from "../components/common/hooks/useMergeProps.js";
7
+ import a from "@unicom-cloud/utils/class-name";
8
+ import { isEmptyReactNode as A } from "../components/common/utils/is.js";
9
+ import B from "./DotLoading.js";
10
+ import G from "../config-provider/context.js";
11
+ function J(S, C) {
12
+ const { getPrefixCls: x, componentConfig: v } = _(G), L = q(S, {}, v?.Spin), {
13
+ style: b,
14
+ className: z,
15
+ children: r,
16
16
  loading: s,
17
- size: t,
18
- icon: c,
19
- element: b,
20
- tip: o,
21
- dot: R,
17
+ size: o,
18
+ icon: f,
19
+ element: R,
20
+ tip: c,
21
+ dot: k,
22
22
  delay: i,
23
- block: z = !1,
24
- ...k
25
- } = x, [d, m] = w(i ? !1 : s), a = P(I(m, i), [i]), p = i ? d : s, e = S?.("spin"), f = D(null);
26
- F(y, () => ({
23
+ block: E = !1,
24
+ fullscreen: p,
25
+ ...I
26
+ } = L, [u, g] = D(i ? !1 : s), l = F(P(g, i), [i]), d = i ? u : s, e = x?.("spin"), N = H(null);
27
+ M(C, () => ({
27
28
  // 潘启宝添加于 2023年10月23日 星期一 10时52分55秒 CST
28
- dom: f.current,
29
- loading: d,
30
- setLoading: m,
31
- debouncedSetLoading: a
32
- })), H(() => (i && a(s), () => {
33
- a && a.cancel();
29
+ dom: N.current,
30
+ loading: u,
31
+ setLoading: g,
32
+ debouncedSetLoading: l
33
+ })), U(() => (i && l(s), () => {
34
+ l && l.cancel();
34
35
  }), [s]);
35
- const g = /* @__PURE__ */ n("span", { className: `${e}-icon`, children: c ? h.cloneElement(c, {
36
- className: N(`${e.replace("-spin", "-icon")}-loading`),
36
+ const j = /* @__PURE__ */ n("span", { className: `${e}-icon`, children: f ? y.cloneElement(f, {
37
+ className: a(`${e.replace("-spin", "-icon")}-loading`),
37
38
  style: {
38
- fontSize: t
39
+ fontSize: o
39
40
  }
40
- }) : b || (R ? /* @__PURE__ */ n(_, { size: t }) : /* @__PURE__ */ n(E, { style: { fontSize: t } })) });
41
- return /* @__PURE__ */ n(
41
+ }) : R || (k ? /* @__PURE__ */ n(B, { size: o }) : /* @__PURE__ */ n(w, { style: { fontSize: o } })) }), m = /* @__PURE__ */ $(h, { children: [
42
+ j,
43
+ c ? /* @__PURE__ */ n("div", { className: `${e}-tip`, children: c }) : null
44
+ ] });
45
+ let t;
46
+ return A(r) ? p ? d && (t = /* @__PURE__ */ n(
42
47
  "div",
43
48
  {
44
- ref: f,
45
- className: N(
49
+ className: a(
50
+ `${e}-loading-layer`,
51
+ `${e}-fullscreen`
52
+ ),
53
+ style: { fontSize: o },
54
+ children: m
55
+ }
56
+ )) : t = m : t = /* @__PURE__ */ $(h, { children: [
57
+ /* @__PURE__ */ n("div", { className: `${e}-children`, children: r }),
58
+ d && /* @__PURE__ */ n(
59
+ "div",
60
+ {
61
+ className: a(
62
+ `${e}-loading-layer`,
63
+ p && `${e}-fullscreen`
64
+ // 潘启宝添加
65
+ ),
66
+ style: { fontSize: o },
67
+ children: /* @__PURE__ */ n("span", { className: `${e}-loading-layer-inner`, children: m })
68
+ }
69
+ )
70
+ ] }), /* @__PURE__ */ n(
71
+ "div",
72
+ {
73
+ ref: N,
74
+ className: a(
46
75
  e,
47
76
  {
48
- [`${e}-block`]: z,
49
- [`${e}-loading`]: p,
50
- [`${e}-with-tip`]: o && !l
77
+ [`${e}-block`]: E,
78
+ [`${e}-loading`]: d,
79
+ [`${e}-with-tip`]: c && !r
51
80
  },
52
- L
81
+ z
53
82
  ),
54
- style: v,
55
- ...k,
56
- children: U(l) ? /* @__PURE__ */ r(u, { children: [
57
- g,
58
- o ? /* @__PURE__ */ n("div", { className: `${e}-tip`, children: o }) : null
59
- ] }) : /* @__PURE__ */ r(u, { children: [
60
- /* @__PURE__ */ n("div", { className: `${e}-children`, children: l }),
61
- p && /* @__PURE__ */ n(
62
- "div",
63
- {
64
- className: `${e}-loading-layer`,
65
- style: { fontSize: t },
66
- children: /* @__PURE__ */ r("span", { className: `${e}-loading-layer-inner`, children: [
67
- g,
68
- o ? /* @__PURE__ */ n("div", { className: `${e}-tip`, children: o }) : null
69
- ] })
70
- }
71
- )
72
- ] })
83
+ style: b,
84
+ ...I,
85
+ children: t
73
86
  }
74
87
  );
75
88
  }
76
- const B = h.forwardRef(A);
77
- B.displayName = "Spin";
89
+ const K = y.forwardRef(J);
90
+ K.displayName = "Spin";
78
91
  export {
79
- B as default
92
+ K as default
80
93
  };
@@ -0,0 +1,39 @@
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import p, { forwardRef as x } from "react";
3
+ import "../config-provider/ConfigProvider.js";
4
+ import d from "@unicom-cloud/utils/class-name";
5
+ import C from "../config-provider/context.js";
6
+ const N = x((t, a) => {
7
+ const { getPrefixCls: l } = p.useContext(C), {
8
+ prefixCls: n,
9
+ className: r,
10
+ children: i,
11
+ size: e,
12
+ style: c = {}
13
+ } = t, s = l?.("panel", n), m = d(
14
+ s,
15
+ {
16
+ [`${s}-hidden`]: e === 0
17
+ },
18
+ r
19
+ ), o = e !== void 0;
20
+ return /* @__PURE__ */ f(
21
+ "div",
22
+ {
23
+ ref: a,
24
+ className: m,
25
+ style: {
26
+ ...c,
27
+ flexBasis: o ? e : "auto",
28
+ flexGrow: o ? 0 : 1
29
+ },
30
+ children: i
31
+ }
32
+ );
33
+ });
34
+ process.env.NODE_ENV !== "production" && (N.displayName = "Panel");
35
+ const z = () => null;
36
+ export {
37
+ N as InternalPanel,
38
+ z as default
39
+ };
@@ -0,0 +1,157 @@
1
+ import { jsxs as H, jsx as l } from "react/jsx-runtime";
2
+ import J from "@unicom-cloud/icons/IconUiDown";
3
+ import K from "@unicom-cloud/icons/IconUiLeft";
4
+ import Q from "@unicom-cloud/icons/IconUiRight";
5
+ import W from "@unicom-cloud/icons/IconUiUp";
6
+ import x from "react";
7
+ import "../config-provider/ConfigProvider.js";
8
+ import d from "@unicom-cloud/utils/class-name";
9
+ import y from "./hooks/useEvent.js";
10
+ import Z from "../config-provider/context.js";
11
+ function L(f) {
12
+ return typeof f == "number" && !Number.isNaN(f) ? Math.round(f) : 0;
13
+ }
14
+ const le = (f) => {
15
+ const { getPrefixCls: z } = x.useContext(Z), {
16
+ prefixCls: I,
17
+ vertical: n,
18
+ index: s,
19
+ active: T,
20
+ ariaNow: $,
21
+ ariaMin: C,
22
+ ariaMax: E,
23
+ resizable: M,
24
+ startCollapsible: j,
25
+ endCollapsible: k,
26
+ onOffsetStart: O,
27
+ onOffsetUpdate: N,
28
+ onOffsetEnd: b,
29
+ onCollapse: S,
30
+ lazy: a,
31
+ containerSize: m
32
+ } = f, e = z?.("bar", I), [r, v] = x.useState(
33
+ null
34
+ ), [h, P] = x.useState(0), A = n ? 0 : h, D = n ? h : 0, R = (t) => {
35
+ M && t.currentTarget && (v([t.pageX, t.pageY]), O(s));
36
+ }, V = (t) => {
37
+ if (M && t.touches.length === 1) {
38
+ const o = t.touches[0];
39
+ v([o.pageX, o.pageY]), O(s);
40
+ }
41
+ }, B = (t) => {
42
+ const o = m * $ / 100, c = o + t, w = Math.max(0, m * C / 100), i = Math.min(m, m * E / 100);
43
+ return Math.max(w, Math.min(i, c)) - o;
44
+ }, U = y((t, o) => {
45
+ const c = B(
46
+ n ? o : t
47
+ );
48
+ P(c);
49
+ }), X = y(() => {
50
+ N(s, A, D, !0), P(0), b(!0);
51
+ });
52
+ x.useEffect(() => {
53
+ if (r) {
54
+ const t = (i) => {
55
+ const { pageX: u, pageY: g } = i, p = u - r[0], Y = g - r[1];
56
+ a ? U(p, Y) : N(s, p, Y);
57
+ }, o = () => {
58
+ a ? X() : b(), v(null);
59
+ }, c = (i) => {
60
+ if (i.touches.length === 1) {
61
+ const u = i.touches[0], g = u.pageX - r[0], p = u.pageY - r[1];
62
+ a ? U(g, p) : N(s, g, p);
63
+ }
64
+ }, w = () => {
65
+ a ? X() : b(), v(null);
66
+ };
67
+ return window.addEventListener("touchmove", c), window.addEventListener("touchend", w), window.addEventListener("mousemove", t), window.addEventListener("mouseup", o), () => {
68
+ window.removeEventListener("mousemove", t), window.removeEventListener("mouseup", o), window.removeEventListener("touchmove", c), window.removeEventListener("touchend", w);
69
+ };
70
+ }
71
+ }, [
72
+ r,
73
+ a,
74
+ n,
75
+ s,
76
+ m,
77
+ $,
78
+ C,
79
+ E
80
+ ]);
81
+ const q = {
82
+ [`--${e}-preview-offset`]: `${h}px`
83
+ }, F = n ? W : K, G = n ? J : Q;
84
+ return /* @__PURE__ */ H(
85
+ "div",
86
+ {
87
+ className: e,
88
+ role: "separator",
89
+ "aria-valuenow": L($),
90
+ "aria-valuemin": L(C),
91
+ "aria-valuemax": L(E),
92
+ children: [
93
+ a && /* @__PURE__ */ l(
94
+ "div",
95
+ {
96
+ className: d(`${e}-preview`, {
97
+ [`${e}-preview-active`]: !!h
98
+ }),
99
+ style: q
100
+ }
101
+ ),
102
+ /* @__PURE__ */ l(
103
+ "div",
104
+ {
105
+ className: d(`${e}-dragger`, {
106
+ [`${e}-dragger-disabled`]: !M,
107
+ [`${e}-dragger-active`]: T
108
+ }),
109
+ onMouseDown: R,
110
+ onTouchStart: V
111
+ }
112
+ ),
113
+ j && /* @__PURE__ */ l(
114
+ "div",
115
+ {
116
+ className: d(
117
+ `${e}-collapse-bar`,
118
+ `${e}-collapse-bar-start`
119
+ ),
120
+ onClick: () => S(s, "start"),
121
+ children: /* @__PURE__ */ l(
122
+ F,
123
+ {
124
+ className: d(
125
+ `${e}-collapse-icon`,
126
+ `${e}-collapse-start`
127
+ )
128
+ }
129
+ )
130
+ }
131
+ ),
132
+ k && /* @__PURE__ */ l(
133
+ "div",
134
+ {
135
+ className: d(
136
+ `${e}-collapse-bar`,
137
+ `${e}-collapse-bar-end`
138
+ ),
139
+ onClick: () => S(s, "end"),
140
+ children: /* @__PURE__ */ l(
141
+ G,
142
+ {
143
+ className: d(
144
+ `${e}-collapse-icon`,
145
+ `${e}-collapse-end`
146
+ )
147
+ }
148
+ )
149
+ }
150
+ )
151
+ ]
152
+ }
153
+ );
154
+ };
155
+ export {
156
+ le as default
157
+ };