@unicom-cloud/ui 0.8.95 → 0.8.97

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 (326) hide show
  1. package/Affix.js +1 -1
  2. package/Carousel.js +1 -1
  3. package/LiquidFill.js +4 -0
  4. package/Message.js +1 -1
  5. package/Notification.js +1 -1
  6. package/OverflowEllipsis.js +1 -1
  7. package/PageHeader.js +1 -1
  8. package/QrCode.js +57 -0
  9. package/Switch.js +1 -1
  10. package/Tour.js +63 -0
  11. package/Trigger.js +2 -2
  12. package/_virtual/_commonjsHelpers.js +6 -0
  13. package/_virtual/index.js +7 -0
  14. package/_virtual/index2.js +4 -0
  15. package/affix/index.js +70 -72
  16. package/alert/index.js +52 -51
  17. package/anchor/Anchor.js +55 -55
  18. package/anchor/Link.js +34 -34
  19. package/anchor/util.js +5 -5
  20. package/auto-complete/index.js +116 -122
  21. package/avatar/Avatar.js +33 -33
  22. package/avatar/Group.js +26 -26
  23. package/back-top/index.js +58 -61
  24. package/badge/index.js +46 -46
  25. package/breadcrumb/Item.js +42 -43
  26. package/breadcrumb/index.js +47 -47
  27. package/button/Group.js +6 -6
  28. package/button/index.js +91 -91
  29. package/calendar/Month.js +75 -75
  30. package/calendar/Year.js +35 -35
  31. package/calendar/header/index.js +25 -25
  32. package/calendar/index.js +103 -103
  33. package/card/Grid.js +8 -8
  34. package/card/Meta.js +16 -16
  35. package/card/index.js +49 -49
  36. package/carousel/Arrow.js +19 -19
  37. package/carousel/Indicator.js +26 -26
  38. package/carousel/index.js +108 -108
  39. package/cascader/Cascader.js +178 -191
  40. package/cascader/base/node.js +133 -136
  41. package/cascader/base/store.js +82 -85
  42. package/cascader/panel/List.js +126 -130
  43. package/cascader/panel/Search.js +79 -81
  44. package/cascader/util.js +13 -13
  45. package/checkbox/Checkbox.js +94 -96
  46. package/checkbox/Group.js +54 -56
  47. package/checkbox/GroupBlock.js +28 -29
  48. package/collapse/Collapse.js +45 -45
  49. package/collapse/Item.js +53 -55
  50. package/color-picker/ControlBar.js +43 -43
  51. package/color-picker/InputAlpha.js +12 -12
  52. package/color-picker/InputHex.js +30 -31
  53. package/color-picker/InputRgb.js +24 -24
  54. package/color-picker/Palette.js +18 -18
  55. package/color-picker/Panel.js +122 -125
  56. package/color-picker/hooks/useColorPicker.js +85 -88
  57. package/color-picker/hooks/useControlBlock.js +38 -40
  58. package/color-picker/index.js +47 -47
  59. package/comment/index.js +29 -29
  60. package/components/common/higher-order/with-speech-synthesis/index.js +37 -40
  61. package/components/common/hooks/useForceUpdate.js +6 -2
  62. package/components/common/hooks/useId.js +4 -4
  63. package/components/common/hooks/useInView.js +16 -16
  64. package/components/common/hooks/useIntersectionObserver.js +1 -1
  65. package/components/common/hooks/useKeyboardEvent.js +9 -10
  66. package/components/common/hooks/useOverflowHidden.js +1 -4
  67. package/components/common/hooks/usePersistCallback.js +7 -7
  68. package/components/common/hooks/useStateCallback.js +9 -10
  69. package/components/common/hooks/useWindowSize.js +8 -8
  70. package/components/common/space/index.js +11 -10
  71. package/components/common/utils/PqbCSSTransition.js +1 -1
  72. package/components/common/utils/convertToDurationBasedOnTimeUnits.js +6 -0
  73. package/components/common/utils/dom.js +27 -29
  74. package/components/common/utils/findScrollParent.js +17 -0
  75. package/components/common/utils/intersectionObserver.js +21 -0
  76. package/components/common/utils/is.js +99 -109
  77. package/components/common/utils/mutationObserver.js +19 -0
  78. package/components/common/utils/reactDOM.js +34 -34
  79. package/components/common/utils/resizeObserver.js +21 -0
  80. package/copy/index.js +38 -40
  81. package/date-picker/Picker.js +290 -295
  82. package/date-picker/RangePicker.js +367 -372
  83. package/date-picker/index.js +33 -35
  84. package/date-picker/panel/Body.js +46 -47
  85. package/date-picker/panel/Header.js +33 -33
  86. package/date-picker/panel/Shortcut.js +31 -31
  87. package/date-picker/panel/date/index.js +85 -85
  88. package/date-picker/panel/month/index.js +59 -59
  89. package/date-picker/panel/quarter/index.js +67 -70
  90. package/date-picker/panel/range/index.js +101 -101
  91. package/date-picker/panel/year/index.js +39 -39
  92. package/date-picker/util.js +17 -18
  93. package/descriptions/index.js +62 -62
  94. package/details/index.js +55 -56
  95. package/development/index.js +9 -9
  96. package/dist/react-transition-group/src/CSSTransition.js +1 -1
  97. package/dist/react-transition-group/src/SwitchTransition.js +1 -1
  98. package/dist/tinycolor/chunk/BOzCVdr0.js +1 -1
  99. package/dist/tween/src/tween.js +24 -25
  100. package/dist/validate/src/index.js +5 -5
  101. package/dist/validate/src/util.js +1 -1
  102. package/divider/index.js +21 -21
  103. package/draggable/Item.js +35 -35
  104. package/draggable/index.js +22 -22
  105. package/drawer/Drawer.js +142 -147
  106. package/dropdown/Button.js +48 -48
  107. package/dropdown/index.js +88 -92
  108. package/empty/index.js +16 -16
  109. package/form/Control.js +211 -225
  110. package/form/Form.js +109 -113
  111. package/form/FormItem.js +118 -120
  112. package/form/FormList.js +60 -66
  113. package/form/FormProvider.js +31 -34
  114. package/form/hook/useContext.js +17 -19
  115. package/form/hook/useState.js +22 -23
  116. package/form/hook/useWatch.js +26 -27
  117. package/form/promisify.js +14 -18
  118. package/form/store.js +304 -316
  119. package/form/util.js +14 -15
  120. package/grid/Col.js +64 -64
  121. package/grid/Grid.js +51 -51
  122. package/grid/GridItem.js +48 -48
  123. package/grid/Row.js +39 -39
  124. package/hooks/index.js +50 -52
  125. package/hooks/useVerificationCode.js +41 -43
  126. package/hooks/useWatermark.js +89 -92
  127. package/icon/index.js +23 -24
  128. package/icon-hover/index.js +16 -16
  129. package/icons/file.js +11 -11
  130. package/image/Image.js +140 -141
  131. package/image/ImagePreview.js +252 -255
  132. package/image/ImagePreviewArrow.js +25 -25
  133. package/image/ImagePreviewGroup.js +62 -62
  134. package/image/util/getScale.js +25 -28
  135. package/index.js +682 -679
  136. package/input/Button.js +48 -50
  137. package/input/Group.js +9 -9
  138. package/input/Input.js +145 -154
  139. package/input/InputElement.js +108 -115
  140. package/input/Password.js +38 -38
  141. package/input/Search.js +51 -55
  142. package/input/Textarea.js +80 -81
  143. package/input/useComposition.js +23 -23
  144. package/input-number/decimal.js +59 -62
  145. package/input-number/index.js +139 -141
  146. package/input-tag/InputTag.js +223 -231
  147. package/layout/Content.js +6 -6
  148. package/layout/Footer.js +8 -8
  149. package/layout/Header.js +7 -7
  150. package/layout/Sider.js +88 -90
  151. package/layout/index.js +30 -30
  152. package/link/index.js +45 -46
  153. package/liquid-fill/LiquidFill.js +189 -0
  154. package/liquid-fill/LiquidFill2.js +3 -0
  155. package/liquid-fill/index.js +4 -0
  156. package/liquid-fill/interface.js +1 -0
  157. package/list/Item.js +28 -28
  158. package/list/Meta.js +12 -12
  159. package/list/index.js +146 -148
  160. package/mentions/index.js +75 -76
  161. package/menu/Item.js +58 -58
  162. package/menu/Menu.js +125 -127
  163. package/menu/OverflowWrap.js +39 -40
  164. package/menu/sub-menu/Inline.js +45 -45
  165. package/menu/util.js +26 -28
  166. package/message/index.js +97 -100
  167. package/message/useMessage.js +26 -27
  168. package/modal/Confirm.js +47 -49
  169. package/modal/Modal.js +250 -257
  170. package/modal/use-modal/Hook.js +26 -28
  171. package/modal/use-modal/index.js +46 -49
  172. package/notice/index.js +89 -90
  173. package/notification/index.js +61 -66
  174. package/notification/withNotification.js +35 -35
  175. package/overflow-ellipsis/OverflowItem.js +19 -20
  176. package/overflow-ellipsis/index.js +45 -46
  177. package/package.json +1 -1
  178. package/page-header/index.js +45 -45
  179. package/pagination/PageItem.js +87 -91
  180. package/pagination/PageJumper.js +40 -41
  181. package/pagination/PageOption.js +31 -35
  182. package/pagination/Pagination.js +162 -163
  183. package/picker/Input.js +90 -96
  184. package/picker/InputRange.js +115 -122
  185. package/popconfirm/index.js +98 -100
  186. package/popover/index.js +28 -28
  187. package/portal/Portal.js +10 -11
  188. package/progress/index.js +36 -36
  189. package/qr-code/index.js +99 -0
  190. package/qr-code/interface.js +1 -0
  191. package/radio/Group.js +48 -48
  192. package/radio/GroupBlock.js +32 -33
  193. package/radio/Radio.js +62 -64
  194. package/rate/index.js +88 -88
  195. package/resize-box/ResizeTrigger.js +39 -39
  196. package/resize-box/Split.js +92 -96
  197. package/resize-box/SplitGroup.js +116 -122
  198. package/resize-box/index.js +112 -115
  199. package/result/index.js +44 -44
  200. package/select/Option.js +53 -56
  201. package/select/Select.js +365 -381
  202. package/select/util.js +95 -99
  203. package/select-view/Core.js +159 -160
  204. package/skeleton/index.js +23 -23
  205. package/slider/Button.js +84 -92
  206. package/slider/Input.js +47 -49
  207. package/slider/Tick.js +28 -31
  208. package/slider/index.js +108 -108
  209. package/slider/util.js +1 -1
  210. package/space/index.js +26 -26
  211. package/space-/index.js +51 -51
  212. package/spin/DotLoading.js +8 -8
  213. package/spin/index.js +47 -47
  214. package/statistic/Countdown.js +37 -37
  215. package/statistic/index.js +61 -61
  216. package/steps/Step.js +42 -42
  217. package/steps/index.js +54 -54
  218. package/style.css +1 -1
  219. package/switch/index.js +78 -79
  220. package/table/ColGroup.js +36 -37
  221. package/table/Table.js +447 -450
  222. package/table/hook/useExpand.js +24 -24
  223. package/table/hook/useRowSelection.js +62 -62
  224. package/table/summary/Row.js +16 -17
  225. package/table/tbody/Td.js +119 -118
  226. package/table/tbody/Tr.js +119 -121
  227. package/table/tbody/index.js +62 -63
  228. package/table/th-resizable/index.js +30 -30
  229. package/table/thead/Column.js +148 -148
  230. package/table/thead/index.js +87 -88
  231. package/tabs/Tab.js +55 -55
  232. package/tabs/TabContent.js +8 -8
  233. package/tabs/TabPane.js +15 -15
  234. package/tabs/hook/useHeaderScroll.js +36 -36
  235. package/tabs/tab-header/TabInk.js +31 -33
  236. package/tabs/tab-header/TabNavIcon.js +34 -35
  237. package/tabs/tab-header/index.js +192 -195
  238. package/tag/index.js +94 -97
  239. package/time-picker/Picker.js +167 -172
  240. package/time-picker/RangePicker.js +28 -28
  241. package/time-picker/TimePicker.js +146 -146
  242. package/time-picker/util.js +4 -4
  243. package/timeline/Item.js +46 -46
  244. package/timeline/Timeline.js +52 -52
  245. package/tooltip/index.js +89 -95
  246. package/tour/index.js +289 -0
  247. package/transfer/Item.js +54 -54
  248. package/transfer/List.js +134 -136
  249. package/transfer/index.js +91 -91
  250. package/tree/Animation.js +49 -52
  251. package/tree/Node.js +114 -122
  252. package/tree/NodeList.js +51 -51
  253. package/tree/Tree.js +386 -393
  254. package/tree-select/List.js +71 -72
  255. package/tree-select/Select.js +135 -143
  256. package/tree-select/hook/useKeyCache.js +39 -39
  257. package/tree-select/hook/useStateValue.js +12 -12
  258. package/trigger/getPopupStyle.js +60 -61
  259. package/trigger/index.js +338 -347
  260. package/types/common/space/interface.d.ts +1 -1
  261. package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
  262. package/types/common/utils/findScrollParent.d.ts +2 -0
  263. package/types/common/utils/index.d.ts +5 -0
  264. package/types/common/utils/intersectionObserver.d.ts +2 -0
  265. package/types/common/utils/math.d.ts +1 -1
  266. package/types/common/utils/mutationObserver.d.ts +2 -0
  267. package/types/common/utils/resizeObserver.d.ts +2 -0
  268. package/types/pc/alert/interface.d.ts +2 -2
  269. package/types/pc/details/interface.d.ts +2 -2
  270. package/types/pc/hooks/index.d.ts +0 -1
  271. package/types/pc/index.d.ts +3 -0
  272. package/types/pc/liquid-fill/LiquidFill.d.ts +30 -0
  273. package/types/pc/liquid-fill/LiquidFill2.d.ts +1 -0
  274. package/types/pc/liquid-fill/index.d.ts +4 -0
  275. package/types/pc/liquid-fill/interface.d.ts +0 -0
  276. package/types/pc/qr-code/index.d.ts +34 -0
  277. package/types/pc/qr-code/interface.d.ts +39 -0
  278. package/types/pc/table/interface.d.ts +2 -2
  279. package/types/pc/tour/index.d.ts +42 -0
  280. package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
  281. package/types/pc/utils/findScrollParent.d.ts +2 -0
  282. package/types/pc/utils/index.d.ts +5 -0
  283. package/types/pc/utils/intersectionObserver.d.ts +2 -0
  284. package/types/pc/utils/math.d.ts +1 -1
  285. package/types/pc/utils/mutationObserver.d.ts +2 -0
  286. package/types/pc/utils/names.d.ts +18 -0
  287. package/types/pc/utils/resizeObserver.d.ts +2 -0
  288. package/typography/Base.js +79 -81
  289. package/typography/EditContent.js +30 -33
  290. package/typography/Ellipsis.js +78 -75
  291. package/typography/Operations.js +50 -52
  292. package/typography/Paragraph.js +7 -7
  293. package/typography/Typography.js +7 -7
  294. package/typography/useEllipsis.js +105 -106
  295. package/upload/TriggerNode.js +69 -76
  296. package/upload/Upload.js +84 -87
  297. package/upload/Uploader.js +115 -118
  298. package/upload/list/PictureItem.js +61 -71
  299. package/upload/list/TextItem.js +61 -67
  300. package/upload/list/UploadProgress.js +42 -49
  301. package/upload/list/index.js +49 -50
  302. package/upload/request_.js +37 -38
  303. package/upload/util.js +39 -39
  304. package/utils/convertToDurationBasedOnTimeUnits.js +6 -0
  305. package/utils/findScrollParent.js +4 -0
  306. package/utils/index.js +274 -275
  307. package/utils/intersectionObserver.js +4 -0
  308. package/utils/math.js +7 -11
  309. package/utils/mutationObserver.js +4 -0
  310. package/utils/names.js +12 -0
  311. package/utils/reactTransitionGroup.js +1 -1
  312. package/utils/resizeObserver.js +4 -0
  313. package/verification-code/VerificationCode.js +50 -51
  314. package/version/index.js +1 -1
  315. package/virtual-list/VirtualList.js +243 -244
  316. package/virtual-list/util/item.js +3 -4
  317. package/watermark/Watermark.js +27 -31
  318. package/components/common/hooks/useComputedState.js +0 -11
  319. package/components/common/utils/resizeObserverEffect.js +0 -23
  320. package/hooks/useComputedState.js +0 -4
  321. package/types/common/hooks/useComputedState.d.ts +0 -4
  322. package/types/common/utils/resizeObserverEffect.d.ts +0 -2
  323. package/types/pc/hooks/useComputedState.d.ts +0 -1
  324. package/types/pc/utils/resizeObserverEffect.d.ts +0 -2
  325. package/utils/resizeObserverEffect.js +0 -4
  326. /package/dist/react-transition-group/chunk/{C6QwjD4L.js → CPfP7aNL.js} +0 -0
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
  };