@unicom-cloud/ui 0.8.96 → 0.8.98

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 (302) hide show
  1. package/Affix.js +1 -1
  2. package/Carousel.js +1 -1
  3. package/LiquidFill.js +4 -0
  4. package/OverflowEllipsis.js +1 -1
  5. package/PageHeader.js +1 -1
  6. package/QrCode.js +57 -0
  7. package/Tour.js +63 -0
  8. package/Trigger.js +1 -1
  9. package/_virtual/_commonjsHelpers.js +6 -0
  10. package/_virtual/index.js +7 -0
  11. package/_virtual/index2.js +4 -0
  12. package/affix/index.js +70 -72
  13. package/alert/index.js +56 -56
  14. package/anchor/Anchor.js +55 -55
  15. package/anchor/Link.js +34 -34
  16. package/anchor/util.js +5 -5
  17. package/auto-complete/index.js +116 -122
  18. package/avatar/Avatar.js +33 -33
  19. package/avatar/Group.js +26 -26
  20. package/back-top/index.js +58 -61
  21. package/badge/index.js +46 -46
  22. package/breadcrumb/Item.js +42 -43
  23. package/breadcrumb/index.js +47 -47
  24. package/button/Group.js +6 -6
  25. package/button/index.js +91 -91
  26. package/calendar/Month.js +75 -75
  27. package/calendar/Year.js +35 -35
  28. package/calendar/header/index.js +25 -25
  29. package/calendar/index.js +103 -103
  30. package/card/Grid.js +8 -8
  31. package/card/Meta.js +16 -16
  32. package/card/index.js +49 -49
  33. package/carousel/Arrow.js +19 -19
  34. package/carousel/Indicator.js +26 -26
  35. package/carousel/index.js +108 -108
  36. package/cascader/Cascader.js +178 -191
  37. package/cascader/base/node.js +133 -136
  38. package/cascader/base/store.js +82 -85
  39. package/cascader/panel/List.js +125 -129
  40. package/cascader/panel/Search.js +79 -81
  41. package/cascader/util.js +13 -13
  42. package/checkbox/Checkbox.js +94 -96
  43. package/checkbox/Group.js +54 -56
  44. package/checkbox/GroupBlock.js +28 -29
  45. package/collapse/Collapse.js +45 -45
  46. package/collapse/Item.js +53 -55
  47. package/color-picker/ControlBar.js +43 -43
  48. package/color-picker/InputAlpha.js +12 -12
  49. package/color-picker/InputHex.js +30 -31
  50. package/color-picker/InputRgb.js +24 -24
  51. package/color-picker/Palette.js +18 -18
  52. package/color-picker/Panel.js +122 -125
  53. package/color-picker/hooks/useColorPicker.js +85 -88
  54. package/color-picker/hooks/useControlBlock.js +38 -40
  55. package/color-picker/index.js +47 -47
  56. package/comment/index.js +29 -29
  57. package/components/common/higher-order/with-speech-synthesis/index.js +37 -40
  58. package/components/common/hooks/useId.js +8 -8
  59. package/components/common/hooks/useInView.js +16 -16
  60. package/components/common/hooks/useIntersectionObserver.js +1 -1
  61. package/components/common/hooks/useKeyboardEvent.js +9 -10
  62. package/components/common/hooks/useOverflowHidden.js +1 -4
  63. package/components/common/hooks/usePersistCallback.js +7 -7
  64. package/components/common/hooks/useStateCallback.js +9 -10
  65. package/components/common/hooks/useWindowSize.js +8 -8
  66. package/components/common/space/index.js +9 -7
  67. package/components/common/utils/convertToDurationBasedOnTimeUnits.js +6 -0
  68. package/components/common/utils/dom.js +27 -29
  69. package/components/common/utils/findScrollParent.js +17 -0
  70. package/components/common/utils/intersectionObserver.js +21 -0
  71. package/components/common/utils/is.js +99 -109
  72. package/components/common/utils/mutationObserver.js +19 -0
  73. package/components/common/utils/reactDOM.js +34 -34
  74. package/components/common/utils/resizeObserver.js +21 -0
  75. package/copy/index.js +38 -40
  76. package/date-picker/Picker.js +290 -295
  77. package/date-picker/RangePicker.js +367 -372
  78. package/date-picker/index.js +33 -35
  79. package/date-picker/panel/Body.js +46 -47
  80. package/date-picker/panel/Header.js +33 -33
  81. package/date-picker/panel/Shortcut.js +31 -31
  82. package/date-picker/panel/date/index.js +85 -85
  83. package/date-picker/panel/month/index.js +59 -59
  84. package/date-picker/panel/quarter/index.js +67 -70
  85. package/date-picker/panel/range/index.js +101 -101
  86. package/date-picker/panel/year/index.js +39 -39
  87. package/date-picker/util.js +17 -18
  88. package/descriptions/index.js +62 -62
  89. package/details/index.js +53 -55
  90. package/development/index.js +9 -9
  91. package/dist/tinycolor/chunk/BOzCVdr0.js +1 -1
  92. package/dist/validate/src/index.js +5 -5
  93. package/dist/validate/src/util.js +1 -1
  94. package/divider/index.js +21 -21
  95. package/draggable/Item.js +35 -35
  96. package/draggable/index.js +22 -22
  97. package/drawer/Drawer.js +142 -147
  98. package/dropdown/Button.js +48 -48
  99. package/dropdown/index.js +88 -92
  100. package/empty/index.js +16 -16
  101. package/form/Control.js +211 -225
  102. package/form/Form.js +109 -113
  103. package/form/FormItem.js +118 -120
  104. package/form/FormList.js +60 -66
  105. package/form/FormProvider.js +31 -34
  106. package/form/hook/useContext.js +17 -19
  107. package/form/hook/useState.js +22 -23
  108. package/form/hook/useWatch.js +26 -27
  109. package/form/promisify.js +14 -18
  110. package/form/store.js +304 -316
  111. package/form/util.js +14 -15
  112. package/grid/Col.js +64 -64
  113. package/grid/Grid.js +51 -51
  114. package/grid/GridItem.js +48 -48
  115. package/grid/Row.js +39 -39
  116. package/hooks/useVerificationCode.js +41 -43
  117. package/hooks/useWatermark.js +89 -92
  118. package/icon/index.js +23 -24
  119. package/icon-hover/index.js +16 -16
  120. package/icons/file.js +11 -11
  121. package/image/Image.js +140 -141
  122. package/image/ImagePreview.js +252 -255
  123. package/image/ImagePreviewArrow.js +25 -25
  124. package/image/ImagePreviewGroup.js +62 -62
  125. package/image/util/getScale.js +25 -28
  126. package/index.js +684 -675
  127. package/input/Button.js +48 -50
  128. package/input/Group.js +9 -9
  129. package/input/Input.js +145 -154
  130. package/input/InputElement.js +108 -115
  131. package/input/Password.js +38 -38
  132. package/input/Search.js +51 -55
  133. package/input/Textarea.js +80 -81
  134. package/input/useComposition.js +23 -23
  135. package/input-number/decimal.js +59 -62
  136. package/input-number/index.js +139 -141
  137. package/input-tag/InputTag.js +222 -230
  138. package/layout/Content.js +6 -6
  139. package/layout/Footer.js +8 -8
  140. package/layout/Header.js +7 -7
  141. package/layout/Sider.js +88 -90
  142. package/layout/index.js +30 -30
  143. package/link/index.js +45 -46
  144. package/liquid-fill/LiquidFill.js +226 -0
  145. package/liquid-fill/LiquidFill2.js +3 -0
  146. package/liquid-fill/index.js +4 -0
  147. package/list/Item.js +28 -28
  148. package/list/Meta.js +12 -12
  149. package/list/index.js +146 -148
  150. package/mentions/index.js +75 -76
  151. package/menu/Item.js +58 -58
  152. package/menu/Menu.js +125 -127
  153. package/menu/OverflowWrap.js +39 -40
  154. package/menu/sub-menu/Inline.js +45 -45
  155. package/menu/util.js +26 -28
  156. package/message/index.js +96 -99
  157. package/message/useMessage.js +26 -27
  158. package/modal/Confirm.js +47 -49
  159. package/modal/Modal.js +250 -257
  160. package/modal/use-modal/Hook.js +26 -28
  161. package/modal/use-modal/index.js +46 -49
  162. package/notice/index.js +89 -90
  163. package/notification/index.js +60 -65
  164. package/notification/withNotification.js +35 -35
  165. package/overflow-ellipsis/OverflowItem.js +19 -20
  166. package/overflow-ellipsis/index.js +45 -46
  167. package/package.json +1 -1
  168. package/page-header/index.js +45 -45
  169. package/pagination/PageItem.js +87 -91
  170. package/pagination/PageJumper.js +40 -41
  171. package/pagination/PageOption.js +31 -35
  172. package/pagination/Pagination.js +162 -163
  173. package/picker/Input.js +90 -96
  174. package/picker/InputRange.js +115 -122
  175. package/popconfirm/index.js +98 -100
  176. package/popover/index.js +28 -28
  177. package/portal/Portal.js +10 -11
  178. package/progress/index.js +36 -36
  179. package/qr-code/index.js +99 -0
  180. package/qr-code/interface.js +1 -0
  181. package/radio/Group.js +48 -48
  182. package/radio/GroupBlock.js +32 -33
  183. package/radio/Radio.js +62 -64
  184. package/rate/index.js +88 -88
  185. package/resize-box/ResizeTrigger.js +39 -39
  186. package/resize-box/Split.js +92 -96
  187. package/resize-box/SplitGroup.js +116 -122
  188. package/resize-box/index.js +112 -115
  189. package/result/index.js +44 -44
  190. package/select/Option.js +53 -56
  191. package/select/Select.js +365 -381
  192. package/select/util.js +95 -99
  193. package/select-view/Core.js +159 -160
  194. package/skeleton/index.js +23 -23
  195. package/slider/Button.js +84 -92
  196. package/slider/Input.js +47 -49
  197. package/slider/Tick.js +28 -31
  198. package/slider/index.js +107 -107
  199. package/space/index.js +26 -26
  200. package/space-/index.js +51 -51
  201. package/spin/DotLoading.js +8 -8
  202. package/spin/index.js +47 -47
  203. package/statistic/Countdown.js +37 -37
  204. package/statistic/index.js +58 -58
  205. package/steps/Step.js +42 -42
  206. package/steps/index.js +54 -54
  207. package/style.css +1 -1
  208. package/switch/index.js +77 -78
  209. package/table/ColGroup.js +36 -37
  210. package/table/Table.js +447 -450
  211. package/table/hook/useExpand.js +24 -24
  212. package/table/hook/useRowSelection.js +62 -62
  213. package/table/summary/Row.js +16 -17
  214. package/table/tbody/Td.js +119 -118
  215. package/table/tbody/Tr.js +119 -121
  216. package/table/tbody/index.js +62 -63
  217. package/table/th-resizable/index.js +30 -30
  218. package/table/thead/Column.js +148 -148
  219. package/table/thead/index.js +87 -88
  220. package/tabs/Tab.js +55 -55
  221. package/tabs/TabContent.js +8 -8
  222. package/tabs/TabPane.js +15 -15
  223. package/tabs/hook/useHeaderScroll.js +36 -36
  224. package/tabs/tab-header/TabInk.js +31 -33
  225. package/tabs/tab-header/TabNavIcon.js +34 -35
  226. package/tabs/tab-header/index.js +192 -195
  227. package/tag/index.js +94 -97
  228. package/time-picker/Picker.js +167 -172
  229. package/time-picker/RangePicker.js +28 -28
  230. package/time-picker/TimePicker.js +146 -146
  231. package/timeline/Item.js +46 -46
  232. package/timeline/Timeline.js +52 -52
  233. package/tooltip/index.js +89 -95
  234. package/tour/index.js +289 -0
  235. package/transfer/Item.js +54 -54
  236. package/transfer/List.js +134 -136
  237. package/transfer/index.js +91 -91
  238. package/tree/Animation.js +49 -52
  239. package/tree/Node.js +114 -122
  240. package/tree/NodeList.js +51 -51
  241. package/tree/Tree.js +386 -393
  242. package/tree-select/List.js +71 -72
  243. package/tree-select/Select.js +135 -143
  244. package/tree-select/hook/useKeyCache.js +39 -39
  245. package/tree-select/hook/useStateValue.js +12 -12
  246. package/trigger/getPopupStyle.js +60 -61
  247. package/trigger/index.js +337 -346
  248. package/types/common/space/interface.d.ts +1 -1
  249. package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
  250. package/types/common/utils/findScrollParent.d.ts +2 -0
  251. package/types/common/utils/index.d.ts +5 -0
  252. package/types/common/utils/intersectionObserver.d.ts +2 -0
  253. package/types/common/utils/mutationObserver.d.ts +2 -0
  254. package/types/common/utils/resizeObserver.d.ts +2 -0
  255. package/types/pc/config-provider/interface.d.ts +6 -0
  256. package/types/pc/index.d.ts +3 -0
  257. package/types/pc/liquid-fill/LiquidFill.d.ts +115 -0
  258. package/types/pc/liquid-fill/LiquidFill2.d.ts +1 -0
  259. package/types/pc/liquid-fill/index.d.ts +2 -0
  260. package/types/pc/qr-code/index.d.ts +34 -0
  261. package/types/pc/qr-code/interface.d.ts +39 -0
  262. package/types/pc/table/interface.d.ts +2 -2
  263. package/types/pc/tour/index.d.ts +42 -0
  264. package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
  265. package/types/pc/utils/findScrollParent.d.ts +2 -0
  266. package/types/pc/utils/index.d.ts +5 -0
  267. package/types/pc/utils/intersectionObserver.d.ts +2 -0
  268. package/types/pc/utils/mutationObserver.d.ts +2 -0
  269. package/types/pc/utils/names.d.ts +18 -0
  270. package/types/pc/utils/resizeObserver.d.ts +2 -0
  271. package/typography/Base.js +79 -81
  272. package/typography/EditContent.js +30 -33
  273. package/typography/Ellipsis.js +77 -73
  274. package/typography/Operations.js +50 -52
  275. package/typography/Paragraph.js +7 -7
  276. package/typography/Typography.js +7 -7
  277. package/typography/useEllipsis.js +105 -106
  278. package/upload/TriggerNode.js +69 -76
  279. package/upload/Upload.js +84 -87
  280. package/upload/Uploader.js +115 -118
  281. package/upload/list/PictureItem.js +61 -71
  282. package/upload/list/TextItem.js +61 -67
  283. package/upload/list/UploadProgress.js +42 -49
  284. package/upload/list/index.js +48 -49
  285. package/upload/request_.js +37 -38
  286. package/upload/util.js +39 -39
  287. package/utils/convertToDurationBasedOnTimeUnits.js +6 -0
  288. package/utils/findScrollParent.js +4 -0
  289. package/utils/index.js +281 -278
  290. package/utils/intersectionObserver.js +4 -0
  291. package/utils/mutationObserver.js +4 -0
  292. package/utils/names.js +12 -0
  293. package/utils/resizeObserver.js +4 -0
  294. package/verification-code/VerificationCode.js +50 -51
  295. package/version/index.js +1 -1
  296. package/virtual-list/VirtualList.js +243 -244
  297. package/virtual-list/util/item.js +3 -4
  298. package/watermark/Watermark.js +27 -31
  299. package/components/common/utils/resizeObserverEffect.js +0 -23
  300. package/types/common/utils/resizeObserverEffect.d.ts +0 -2
  301. package/types/pc/utils/resizeObserverEffect.d.ts +0 -2
  302. package/utils/resizeObserverEffect.js +0 -4
package/anchor/Anchor.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsxs as mt, jsx as w } from "react/jsx-runtime";
2
2
  import { compute as pt } from "../dist/compute-scroll-into-view/src/index.js";
3
3
  import dt from "../dist/scroll-into-view-if-needed/src/index.js";
4
- import _ from "lodash/isFunction";
5
- import E from "lodash/isNumber";
4
+ import j from "lodash/isFunction";
5
+ import b from "lodash/isNumber";
6
6
  import gt from "lodash/throttle";
7
7
  import { forwardRef as ht, useContext as Ct, useRef as k, useState as kt, useEffect as A, useCallback as N, useImperativeHandle as xt } from "react";
8
8
  import Lt from "../affix/index.js";
@@ -15,7 +15,7 @@ import { on as Nt, off as St } from "../components/common/utils/dom.js";
15
15
  import { isWindow as $t } from "../components/common/utils/is.js";
16
16
  import Tt from "./context.js";
17
17
  import vt from "./Link.js";
18
- import { findNode as P, getContainerElement as bt, getContainer as Mt, getScrollParent as Et, slide as Pt } from "./util.js";
18
+ import { findNode as P, getContainerElement as bt, getContainer as Pt, getScrollParent as Mt, slide as Et } from "./util.js";
19
19
  import Ft from "../config-provider/context.js";
20
20
  const It = {
21
21
  animation: !0,
@@ -23,11 +23,11 @@ const It = {
23
23
  hash: !0,
24
24
  boundary: "start"
25
25
  };
26
- function Ht(G, J) {
27
- const { getPrefixCls: S, componentConfig: $, rtl: F } = Ct(Ft), K = Rt(
28
- G,
26
+ function Ht(_, q) {
27
+ const { getPrefixCls: G, componentConfig: J, rtl: M } = Ct(Ft), K = Rt(
28
+ _,
29
29
  It,
30
- $ == null ? void 0 : $.Anchor
30
+ J?.Anchor
31
31
  ), {
32
32
  className: Q,
33
33
  style: X,
@@ -38,41 +38,41 @@ function Ht(G, J) {
38
38
  affixStyle: tt,
39
39
  offsetBottom: et,
40
40
  offsetTop: nt,
41
- hash: I = !0,
41
+ hash: E = !0,
42
42
  boundary: i = "start",
43
- targetOffset: T,
43
+ targetOffset: S,
44
44
  children: rt,
45
45
  direction: L = "vertical",
46
- onSelect: H,
47
- onChange: v,
46
+ onSelect: F,
47
+ onChange: $,
48
48
  ...ot
49
- } = K, f = S == null ? void 0 : S("anchor"), it = At(f, Q, {
49
+ } = K, f = G?.("anchor"), it = At(f, Q, {
50
50
  [`${f}-lineless`]: x,
51
- [`${f}-rtl`]: F,
51
+ [`${f}-rtl`]: M,
52
52
  [`${f}-horizontal`]: L === "horizontal"
53
- }), s = k(null), p = k(null), a = k(/* @__PURE__ */ new Map()), b = k(!1), d = k(null), [st, O] = kt(0), [o, ct] = wt(""), lt = yt();
54
- function z() {
55
- let t = Mt(m);
56
- return m || (t = Et(s.current)), t;
53
+ }), s = k(null), p = k(null), a = k(/* @__PURE__ */ new Map()), T = k(!1), d = k(null), [st, I] = kt(0), [o, ct] = wt(""), lt = yt();
54
+ function H() {
55
+ let t = Pt(m);
56
+ return m || (t = Mt(s.current)), t;
57
57
  }
58
58
  A(() => {
59
- const t = z();
59
+ const t = H();
60
60
  d.current = t;
61
61
  }, [m]);
62
- const ft = N(() => z(), [m]);
62
+ const ft = N(() => H(), [m]);
63
63
  xt(
64
- J,
64
+ q,
65
65
  () => ({
66
66
  dom: s.current,
67
67
  getRootDOMNode: () => s.current
68
68
  }),
69
69
  []
70
70
  );
71
- function B(t, e) {
72
- t && (a.current.set(t, e), O(Math.random()));
71
+ function O(t, e) {
72
+ t && (a.current.set(t, e), I(Math.random()));
73
73
  }
74
74
  function at(t) {
75
- a.current.delete(t), O(Math.random());
75
+ a.current.delete(t), I(Math.random());
76
76
  }
77
77
  const y = N(
78
78
  (t) => {
@@ -80,7 +80,7 @@ function Ht(G, J) {
80
80
  return;
81
81
  if (!a.current.has(t)) {
82
82
  const n = P(s.current, `a[data-href='${t}']`);
83
- n && B(t, n);
83
+ n && O(t, n);
84
84
  }
85
85
  const e = a.current.get(t);
86
86
  e && t !== o && (dt(e, {
@@ -89,35 +89,35 @@ function Ht(G, J) {
89
89
  scrollMode: "if-needed",
90
90
  boundary: s.current
91
91
  }), ct(t).then(() => {
92
- _(v) && v(t, o);
92
+ j($) && $(t, o);
93
93
  }));
94
94
  },
95
- [o, v]
96
- ), U = N(() => {
95
+ [o, $]
96
+ ), z = N(() => {
97
97
  let t;
98
- const e = E(i) ? i : 0, n = d.current, h = bt(n).getBoundingClientRect(), R = document.documentElement.clientHeight;
99
- return [...a.current.keys()].some((M) => {
100
- const c = P(document, M);
98
+ const e = b(i) ? i : 0, n = d.current, h = bt(n).getBoundingClientRect(), R = document.documentElement.clientHeight;
99
+ return [...a.current.keys()].some((v) => {
100
+ const c = P(document, v);
101
101
  let u = !1;
102
102
  if (c) {
103
103
  const { top: r, height: C } = c.getBoundingClientRect();
104
104
  if ($t(n)) {
105
- const l = T ?? R / 2;
105
+ const l = S ?? R / 2;
106
106
  u = r >= e && r <= l || r <= e && r + C >= l;
107
107
  } else {
108
- const l = r - h.top - e, D = T ?? h.height / 2;
109
- u = l >= 0 && l <= D || l <= 0 && l + C >= D;
108
+ const l = r - h.top - e, W = S ?? h.height / 2;
109
+ u = l >= 0 && l <= W || l <= 0 && l + C >= W;
110
110
  }
111
111
  u && (t = c);
112
112
  }
113
113
  return u;
114
114
  }), t;
115
- }, [i, T]), g = N(
115
+ }, [i, S]), g = N(
116
116
  gt(
117
117
  (t) => {
118
- if (b.current)
118
+ if (T.current)
119
119
  return;
120
- const e = U();
120
+ const e = z();
121
121
  if (e && e.id) {
122
122
  const n = `#${e.id}`;
123
123
  y(n);
@@ -126,29 +126,29 @@ function Ht(G, J) {
126
126
  30,
127
127
  { trailing: !0 }
128
128
  ),
129
- [U, y]
129
+ [z, y]
130
130
  );
131
- function V(t) {
131
+ function B(t) {
132
132
  if (t)
133
133
  try {
134
134
  const e = P(document, t);
135
135
  if (!e)
136
136
  return;
137
- const n = E(i) ? "start" : i, j = E(i) ? i : 0, h = pt(e, { block: n });
137
+ const n = b(i) ? "start" : i, V = b(i) ? i : 0, h = pt(e, { block: n });
138
138
  if (!h.length)
139
139
  return;
140
140
  let R = !1;
141
- const M = h.map(({ el: c, top: u }) => new Promise((r) => {
141
+ const v = h.map(({ el: c, top: u }) => new Promise((r) => {
142
142
  if (!R) {
143
143
  c === d.current && (R = !0);
144
- const C = u - j;
145
- return Y ? Pt(c, C, r) : (I || (c.scrollTop = C), r(null));
144
+ const C = u - V;
145
+ return Y ? Et(c, C, r) : (E || (c.scrollTop = C), r(null));
146
146
  }
147
147
  r(null);
148
148
  }));
149
- b.current = !0, Promise.all(M).then(() => {
149
+ T.current = !0, Promise.all(v).then(() => {
150
150
  setTimeout(() => {
151
- b.current = !1;
151
+ T.current = !1;
152
152
  }, 27);
153
153
  });
154
154
  } catch (e) {
@@ -156,18 +156,18 @@ function Ht(G, J) {
156
156
  }
157
157
  }
158
158
  function ut(t, e) {
159
- I || t.preventDefault(), y(e), V(e), _(H) && H(e, o);
159
+ E || t.preventDefault(), y(e), B(e), j(F) && F(e, o);
160
160
  }
161
161
  A(() => {
162
162
  const t = decodeURIComponent(location.hash);
163
- t ? (y(t), V(t)) : g(null);
163
+ t ? (y(t), B(t)) : g(null);
164
164
  }, []), A(() => (lt || g(null), Nt(d.current, "scroll", g), () => {
165
165
  St(d.current, "scroll", g);
166
166
  }), [m, g]), A(() => {
167
167
  const t = a.current.get(o);
168
168
  t && !x && p.current && (L === "horizontal" ? (p.current.style.left = `${t.offsetLeft}px`, p.current.style.width = `${t.clientWidth}px`) : p.current.style.top = `${t.offsetTop}px`);
169
- }, [o, x, L, F, st]);
170
- const W = /* @__PURE__ */ mt("div", { className: it, style: X, ref: s, ...ot, children: [
169
+ }, [o, x, L, M, st]);
170
+ const U = /* @__PURE__ */ mt("div", { className: it, style: X, ref: s, ...ot, children: [
171
171
  !x && o && /* @__PURE__ */ w("div", { className: `${f}-line-slider`, ref: p }),
172
172
  /* @__PURE__ */ w(
173
173
  Tt.Provider,
@@ -175,7 +175,7 @@ function Ht(G, J) {
175
175
  value: {
176
176
  direction: L,
177
177
  currentLink: o,
178
- addLink: B,
178
+ addLink: O,
179
179
  removeLink: at,
180
180
  onLinkClick: ut
181
181
  },
@@ -190,14 +190,14 @@ function Ht(G, J) {
190
190
  offsetBottom: et,
191
191
  style: tt,
192
192
  target: ft,
193
- children: W
193
+ children: U
194
194
  }
195
- ) : W;
195
+ ) : U;
196
196
  }
197
- const Ot = ht(Ht), q = Ot;
198
- q.displayName = "Anchor";
199
- q.Link = vt;
197
+ const Ot = ht(Ht), D = Ot;
198
+ D.displayName = "Anchor";
199
+ D.Link = vt;
200
200
  export {
201
201
  vt as AnchorLink,
202
- q as default
202
+ D as default
203
203
  };
package/anchor/Link.js CHANGED
@@ -1,53 +1,53 @@
1
- import { jsxs as k, jsx as P } from "react/jsx-runtime";
2
- import R from "lodash/isNull";
3
- import E from "lodash/isPlainObject";
4
- import L from "lodash/isString";
5
- import O from "lodash/isUndefined";
6
- import $, { forwardRef as b, useContext as p, useRef as v, useImperativeHandle as w, useEffect as I, isValidElement as M } from "react";
1
+ import { jsxs as A, jsx as P } from "react/jsx-runtime";
2
+ import g from "lodash/isNull";
3
+ import j from "lodash/isPlainObject";
4
+ import v from "lodash/isString";
5
+ import R from "lodash/isUndefined";
6
+ import E, { forwardRef as O, useContext as c, useRef as $, useImperativeHandle as b, useEffect as w, isValidElement as I } from "react";
7
7
  import "../config-provider/ConfigProvider.js";
8
- import S from "../components/common/hooks/useMergeProps.js";
9
- import g from "@unicom-cloud/utils/class-name";
8
+ import M from "../components/common/hooks/useMergeProps.js";
9
+ import S from "@unicom-cloud/utils/class-name";
10
10
  import z from "./context.js";
11
11
  import D from "../config-provider/context.js";
12
- const u = "AnchorLink", H = {
12
+ const a = "AnchorLink", H = {
13
13
  href: "#"
14
14
  };
15
- function U(o) {
16
- return E(o) && Object.prototype.hasOwnProperty.call(o, "displayName");
15
+ function U(t) {
16
+ return j(t) && Object.prototype.hasOwnProperty.call(t, "displayName");
17
17
  }
18
- function V(o, d) {
19
- const { getPrefixCls: n, componentConfig: s } = p(D), { className: h, style: N, href: r, title: e, children: f, ...x } = S(
20
- o,
18
+ function V(t, l) {
19
+ const { getPrefixCls: m, componentConfig: f } = c(D), { className: p, style: d, href: e, title: n, children: s, ...u } = M(
20
+ t,
21
21
  H,
22
- s == null ? void 0 : s["Anchor.Link"]
23
- ), y = p(z), { currentLink: C, addLink: i, removeLink: a, onLinkClick: c, direction: A } = y, l = n == null ? void 0 : n("anchor-link"), j = g(
24
- l,
22
+ f?.["Anchor.Link"]
23
+ ), h = c(z), { currentLink: C, addLink: k, removeLink: N, onLinkClick: x, direction: L } = h, o = m?.("anchor-link"), y = S(
24
+ o,
25
25
  {
26
- [`${l}-active`]: C === r
26
+ [`${o}-active`]: C === e
27
27
  },
28
- h
29
- ), m = v(null);
30
- return w(d, () => m.current, []), I(() => (i == null || i(r, m.current), () => {
31
- a == null || a(r);
32
- }), [r]), /* @__PURE__ */ k("div", { className: j, style: N, ref: m, ...x, children: [
33
- !O(e) && !R(e) && /* @__PURE__ */ P(
28
+ p
29
+ ), i = $(null);
30
+ return b(l, () => i.current, []), w(() => (k?.(e, i.current), () => {
31
+ N?.(e);
32
+ }), [e]), /* @__PURE__ */ A("div", { className: y, style: d, ref: i, ...u, children: [
33
+ !R(n) && !g(n) && /* @__PURE__ */ P(
34
34
  "a",
35
35
  {
36
- className: `${l}-title`,
37
- title: L(e) ? e : "",
38
- href: r,
39
- "data-href": r,
40
- onClick: (t) => {
41
- c == null || c(t, r);
36
+ className: `${o}-title`,
37
+ title: v(n) ? n : "",
38
+ href: e,
39
+ "data-href": e,
40
+ onClick: (r) => {
41
+ x?.(r, e);
42
42
  },
43
- children: e
43
+ children: n
44
44
  }
45
45
  ),
46
- f && A !== "horizontal" && $.Children.map(f, (t) => M(t) && U(t.type) && t.type.displayName === u && t)
46
+ s && L !== "horizontal" && E.Children.map(s, (r) => I(r) && U(r.type) && r.type.displayName === a && r)
47
47
  ] });
48
48
  }
49
- const Y = b(V);
50
- Y.displayName = u;
49
+ const Y = O(V);
50
+ Y.displayName = a;
51
51
  export {
52
52
  Y as default
53
53
  };
package/anchor/util.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Tween as u } from "../dist/tween/src/tween.js";
2
- import { quartOut as l } from "../dist/tween/src/easing.js";
2
+ import { quartOut as c } from "../dist/tween/src/easing.js";
3
3
  import i from "lodash/isString";
4
- import { isWindow as c } from "../components/common/utils/is.js";
4
+ import { isWindow as l } from "../components/common/utils/is.js";
5
5
  function s(o, n) {
6
6
  const r = i(n) && n[0] === "#" ? `[id='${n.replace("#", "")}']` : n;
7
7
  try {
@@ -18,13 +18,13 @@ function w(o, n, r) {
18
18
  to: {
19
19
  scrollTop: n
20
20
  },
21
- easing: l,
21
+ easing: c,
22
22
  duration: 300,
23
23
  onUpdate: (e) => {
24
24
  o.scrollTop = e.scrollTop;
25
25
  },
26
26
  onFinish: () => {
27
- r == null || r();
27
+ r?.();
28
28
  }
29
29
  }).start();
30
30
  }
@@ -32,7 +32,7 @@ function g(o) {
32
32
  return i(o) ? s(document, o) : o || window;
33
33
  }
34
34
  function S(o) {
35
- return c(o) ? document.documentElement || document.body : o;
35
+ return l(o) ? document.documentElement || document.body : o;
36
36
  }
37
37
  function d(o) {
38
38
  if (o == null)
@@ -1,156 +1,150 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import le from "@unicom-cloud/icons/IconUiLoading";
3
- import p, { useContext as ne, useState as se, useRef as $, isValidElement as ce, useImperativeHandle as ae } from "react";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import Y from "@unicom-cloud/icons/IconUiLoading";
3
+ import u, { useContext as Z, useState as ee, useRef as x, isValidElement as te, useImperativeHandle as oe } from "react";
4
4
  import "../config-provider/ConfigProvider.js";
5
- import ie from "../components/common/hooks/useMergeProps.js";
6
- import ue from "../components/common/hooks/useMergeValue.js";
7
- import fe from "../input/Input.js";
8
- import d from "../select/Select.js";
9
- import { isSelectOption as me, isSelectOptGroup as pe } from "../select/util.js";
10
- import de from "@unicom-cloud/utils/class-name";
11
- import { Enter as ge, Esc as Oe } from "@unicom-cloud/utils/constant/keyboardCode";
12
- import { omit as Ce } from "../components/common/utils/omit.js";
13
- import { pickDataAttributes as ye } from "../components/common/utils/pick.js";
14
- import he from "../config-provider/context.js";
15
- const Ae = `Autocomplete_${Math.random()}`, { Option: B } = d, Ee = {
5
+ import re from "../components/common/hooks/useMergeProps.js";
6
+ import ne from "../components/common/hooks/useMergeValue.js";
7
+ import se from "../input/Input.js";
8
+ import c from "../select/Select.js";
9
+ import { isSelectOption as le, isSelectOptGroup as ie } from "../select/util.js";
10
+ import pe from "@unicom-cloud/utils/class-name";
11
+ import { Enter as ue, Esc as ce } from "@unicom-cloud/utils/constant/keyboardCode";
12
+ import { omit as ae } from "../components/common/utils/omit.js";
13
+ import { pickDataAttributes as fe } from "../components/common/utils/pick.js";
14
+ import me from "../config-provider/context.js";
15
+ const de = `Autocomplete_${Math.random()}`, { Option: N } = c, ge = {
16
16
  defaultActiveFirstOption: !0,
17
- triggerElement: /* @__PURE__ */ a(fe, {})
17
+ triggerElement: /* @__PURE__ */ n(se, {})
18
18
  };
19
- function Ne(D, j) {
20
- var L, R;
21
- const { getPrefixCls: g, componentConfig: O } = ne(he), l = ie(
22
- D,
23
- Ee,
24
- O == null ? void 0 : O.AutoComplete
19
+ function Ce(S, F) {
20
+ const { getPrefixCls: V, componentConfig: w } = Z(me), r = re(
21
+ S,
22
+ ge,
23
+ w?.AutoComplete
25
24
  ), {
26
- style: H,
27
- className: K,
28
- children: C,
29
- data: s,
30
- defaultValue: U,
31
- value: _,
32
- placeholder: q,
33
- error: z,
34
- disabled: J,
35
- strict: Q,
36
- allowClear: T,
37
- loading: W,
38
- defaultActiveFirstOption: X,
39
- triggerElement: y,
40
- getPopupContainer: Y,
41
- dropdownRender: Z,
42
- virtualListProps: P,
43
- onFocus: h,
44
- onBlur: A,
45
- onChange: c,
46
- onSearch: E,
47
- onSelect: N,
48
- onPressEnter: v,
49
- inputProps: t
50
- } = l, [V, F] = ue("", {
51
- defaultValue: U,
52
- value: _
53
- }), [ee, b] = se(!1), f = $(null), i = $(null), k = g == null ? void 0 : g("autocomplete"), te = "filterOption" in l ? l.filterOption : (e, o) => Q ? o.props.value.indexOf(e) > -1 : o.props.value.toLowerCase().indexOf(e.toLowerCase()) > -1, w = p.Children.toArray(C);
54
- let x = null;
55
- w.length && (me(w[0]) || pe(w[0])) ? x = C : s && s.length && (x = s.map((e, o) => {
56
- if (ce(e))
25
+ style: I,
26
+ className: v,
27
+ children: a,
28
+ data: l,
29
+ defaultValue: b,
30
+ value: k,
31
+ placeholder: L,
32
+ error: R,
33
+ disabled: B,
34
+ strict: G,
35
+ allowClear: M,
36
+ loading: $,
37
+ defaultActiveFirstOption: D,
38
+ triggerElement: f,
39
+ getPopupContainer: j,
40
+ dropdownRender: H,
41
+ virtualListProps: K,
42
+ onFocus: T,
43
+ onBlur: U,
44
+ onChange: O,
45
+ onSearch: _,
46
+ onSelect: q,
47
+ onPressEnter: y,
48
+ inputProps: o
49
+ } = r, [m, A] = ne("", {
50
+ defaultValue: b,
51
+ value: k
52
+ }), [z, P] = ee(!1), i = x(null), s = x(null), E = V?.("autocomplete"), J = "filterOption" in r ? r.filterOption : (e, t) => G ? t.props.value.indexOf(e) > -1 : t.props.value.toLowerCase().indexOf(e.toLowerCase()) > -1, d = u.Children.toArray(a);
53
+ let g = null;
54
+ d.length && (le(d[0]) || ie(d[0])) ? g = a : l && l.length && (g = l.map((e, t) => {
55
+ if (te(e))
57
56
  return e;
58
57
  if (typeof e == "string")
59
- return /* @__PURE__ */ a(B, { value: e, children: e }, o);
58
+ return /* @__PURE__ */ n(N, { value: e, children: e }, t);
60
59
  if (typeof e == "object") {
61
- const { value: r, name: n } = e;
62
- return /* @__PURE__ */ a(
63
- B,
60
+ const { value: p, name: X } = e;
61
+ return /* @__PURE__ */ n(
62
+ N,
64
63
  {
65
- value: r,
66
- extra: Ce(e, ["value", "name"]),
67
- children: n
64
+ value: p,
65
+ extra: ae(e, ["value", "name"]),
66
+ children: X
68
67
  },
69
- o
68
+ t
70
69
  );
71
70
  }
72
71
  return null;
73
- })), ae(j, () => f.current);
74
- const u = typeof y == "function" ? y({ value: V }) : y, oe = p.cloneElement(u, {
72
+ })), oe(F, () => i.current);
73
+ const C = typeof f == "function" ? f({ value: m }) : f, Q = u.cloneElement(C, {
75
74
  ref: (e) => {
76
- f.current = e;
77
- const { ref: o } = u;
78
- typeof o == "function" && o(e);
75
+ i.current = e;
76
+ const { ref: t } = C;
77
+ typeof t == "function" && t(e);
79
78
  },
80
- className: de(
81
- `${k}`,
82
- t && t.className,
83
- K
79
+ className: pe(
80
+ `${E}`,
81
+ o && o.className,
82
+ v
84
83
  ),
85
- style: H,
86
- value: V,
87
- placeholder: q,
88
- error: z,
89
- status: l.status,
90
- disabled: J,
91
- allowClear: T,
92
- ...t,
93
- ...ye(l),
84
+ style: I,
85
+ value: m,
86
+ placeholder: L,
87
+ error: R,
88
+ status: r.status,
89
+ disabled: B,
90
+ allowClear: M,
91
+ ...o,
92
+ ...fe(r),
94
93
  // Empty tag to ensure the consistency of the dom structure of input, such that input won't accidentally lose focus due to structure change on input.
95
- suffix: W ? /* @__PURE__ */ a(le, {}) : ((L = u == null ? void 0 : u.type) == null ? void 0 : L.displayName) === "Search" ? void 0 : (t == null ? void 0 : t.suffix) || /* @__PURE__ */ a("i", {}),
94
+ suffix: $ ? /* @__PURE__ */ n(Y, {}) : C?.type?.displayName === "Search" ? void 0 : o?.suffix || /* @__PURE__ */ n("i", {}),
96
95
  onFocus: (e) => {
97
- var o;
98
- b(!0), h == null || h(e), (o = t == null ? void 0 : t.onFocus) == null || o.call(t, e);
96
+ P(!0), T?.(e), o?.onFocus?.(e);
99
97
  },
100
98
  onBlur: (e) => {
101
- var o;
102
- b(!1), A == null || A(e), (o = t == null ? void 0 : t.onBlur) == null || o.call(t, e);
99
+ P(!1), U?.(e), o?.onBlur?.(e);
103
100
  },
104
101
  onKeyDown: (e) => {
105
- var r, n, m, S, G;
106
- const o = e.key;
107
- if ((n = (r = i.current) == null ? void 0 : r.hotkeyHandler) == null || n.call(r, e), o === ge.key && v) {
108
- let M;
109
- i.current && (M = i.current.getOptionInfoByValue(
110
- i.current.activeOptionValue
111
- )), v(e, M);
102
+ const t = e.key;
103
+ if (s.current?.hotkeyHandler?.(e), t === ue.key && y) {
104
+ let p;
105
+ s.current && (p = s.current.getOptionInfoByValue(
106
+ s.current.activeOptionValue
107
+ )), y(e, p);
112
108
  }
113
- o === Oe.key && ((S = (m = f.current) == null ? void 0 : m.blur) == null || S.call(m)), (G = t == null ? void 0 : t.onKeyDown) == null || G.call(t, e);
109
+ t === ce.key && i.current?.blur?.(), o?.onKeyDown?.(e);
114
110
  },
115
- onChange: (e, o) => {
116
- var r;
117
- F(e), E == null || E(e), c == null || c(e), (r = t == null ? void 0 : t.onChange) == null || r.call(t, e, o);
111
+ onChange: (e, t) => {
112
+ A(e), _?.(e), O?.(e), o?.onChange?.(e, t);
118
113
  }
119
- }), re = {
120
- popupVisible: !!(ee && (s != null && s.length || p.Children.count(C))),
121
- ...l.triggerProps,
114
+ }), W = {
115
+ popupVisible: !!(z && (l?.length || u.Children.count(a))),
116
+ ...r.triggerProps,
122
117
  // Other trigger types are not supported yet
123
118
  trigger: "focus",
124
- className: [`${k}-popup`].concat((R = l == null ? void 0 : l.triggerProps) == null ? void 0 : R.className)
119
+ className: [`${E}-popup`].concat(r?.triggerProps?.className)
125
120
  };
126
- return /* @__PURE__ */ a(d, { ref: i, ...{
127
- triggerElement: oe,
121
+ return /* @__PURE__ */ n(c, { ref: s, ...{
122
+ triggerElement: Q,
128
123
  // Guarantee that onChange can always be triggered
129
- value: Ae,
130
- inputValue: V,
131
- defaultActiveFirstOption: X,
132
- triggerProps: re,
133
- getPopupContainer: Y,
134
- dropdownRender: Z,
135
- filterOption: te,
136
- virtualListProps: P,
124
+ value: de,
125
+ inputValue: m,
126
+ defaultActiveFirstOption: D,
127
+ triggerProps: W,
128
+ getPopupContainer: j,
129
+ dropdownRender: H,
130
+ filterOption: J,
131
+ virtualListProps: K,
137
132
  notFoundContent: null,
138
- onChange: (e, o) => {
139
- var r, n;
140
- F(e), c == null || c(e, o), e && (N == null || N(e, o)), (n = (r = f.current) == null ? void 0 : r.blur) == null || n.call(r);
133
+ onChange: (e, t) => {
134
+ A(e), O?.(e, t), e && q?.(e, t), i.current?.blur?.();
141
135
  }
142
- }, children: x });
136
+ }, children: g });
143
137
  }
144
- const Ve = p.forwardRef(Ne), I = Ve;
145
- I.displayName = "AutoComplete";
146
- const [we, xe] = [
147
- d.Option,
148
- d.OptGroup
138
+ const he = u.forwardRef(Ce), h = he;
139
+ h.displayName = "AutoComplete";
140
+ const [Oe, ye] = [
141
+ c.Option,
142
+ c.OptGroup
149
143
  ];
150
- I.Option = we;
151
- I.OptGroup = xe;
144
+ h.Option = Oe;
145
+ h.OptGroup = ye;
152
146
  export {
153
- xe as AutoCompleteOptGroup,
154
- we as AutoCompleteOption,
155
- I as default
147
+ ye as AutoCompleteOptGroup,
148
+ Oe as AutoCompleteOption,
149
+ h as default
156
150
  };