@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
@@ -1,14 +1,14 @@
1
- import { jsx as v } from "react/jsx-runtime";
2
- import { forwardRef as x, useState as _, useCallback as d, useImperativeHandle as b, useEffect as C } from "react";
3
- import { v4 as I } from "uuid";
4
- function E(l) {
5
- function c(i, h) {
6
- const [n, u] = _(
7
- (i == null ? void 0 : i.notices) ?? []
8
- ), s = d(
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { forwardRef as v, useState as x, useCallback as s, useImperativeHandle as _, useEffect as b } from "react";
3
+ import { v4 as C } from "uuid";
4
+ function q(m) {
5
+ function l(c, p) {
6
+ const [n, i] = x(
7
+ c?.notices ?? []
8
+ ), d = s(
9
9
  (t) => {
10
- const r = (t == null ? void 0 : t.id) ?? `pqb_notice_id_${I()}`;
11
- return t.id && n.findIndex((e) => e.id === t.id) !== -1 ? f(t) : u((e) => [
10
+ const r = t?.id ?? `pqb_notice_id_${C()}`;
11
+ return t.id && n.findIndex((e) => e.id === t.id) !== -1 ? u(t) : i((e) => [
12
12
  ...e,
13
13
  {
14
14
  ...t,
@@ -17,41 +17,41 @@ function E(l) {
17
17
  ]), r;
18
18
  },
19
19
  [n]
20
- ), f = d((t) => {
21
- u((r) => r.map((e) => t.id === e.id ? (delete e.update, t) : e));
22
- }, []), a = d(() => {
23
- u((t) => {
20
+ ), u = s((t) => {
21
+ i((r) => r.map((e) => t.id === e.id ? (delete e.update, t) : e));
22
+ }, []), o = s(() => {
23
+ i((t) => {
24
24
  const r = [...t];
25
25
  return r.shift(), r;
26
26
  });
27
- }, []), o = d((t) => {
28
- u((r) => r.filter((e) => e.id !== t));
29
- }, []), m = d(() => {
30
- u((t) => []);
27
+ }, []), f = s((t) => {
28
+ i((r) => r.filter((e) => e.id !== t));
29
+ }, []), a = s(() => {
30
+ i((t) => []);
31
31
  }, []);
32
- return b(h, () => ({
32
+ return _(p, () => ({
33
33
  notices: n,
34
- add: s,
35
- update: f,
36
- shift: a,
37
- remove: o,
38
- clear: m
39
- }), [n, s, f, a, o, m]), C(() => () => {
40
- }, [n]), /* @__PURE__ */ v(
41
- l,
34
+ add: d,
35
+ update: u,
36
+ shift: o,
37
+ remove: f,
38
+ clear: a
39
+ }), [n, d, u, o, f, a]), b(() => () => {
40
+ }, [n]), /* @__PURE__ */ h(
41
+ m,
42
42
  {
43
- ...i,
43
+ ...c,
44
44
  notices: n,
45
- add: s,
46
- update: f,
47
- shift: a,
48
- remove: o,
49
- clear: m
45
+ add: d,
46
+ update: u,
47
+ shift: o,
48
+ remove: f,
49
+ clear: a
50
50
  }
51
51
  );
52
52
  }
53
- return x(c);
53
+ return v(l);
54
54
  }
55
55
  export {
56
- E as default
56
+ q as default
57
57
  };
@@ -1,36 +1,35 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import s from "lodash/isFunction";
3
- import { useContext as d, useRef as a, useEffect as f } from "react";
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import c from "lodash/isFunction";
3
+ import { useContext as u, useRef as l, useEffect as n } from "react";
4
4
  import "../config-provider/ConfigProvider.js";
5
- import l from "@unicom-cloud/utils/class-name";
6
- import { resizeObserverEffect as h } from "../components/common/utils/resizeObserverEffect.js";
7
- import z from "../config-provider/context.js";
8
- function E(e) {
9
- const { getPrefixCls: t } = d(z), o = t == null ? void 0 : t("overflow-item"), r = a();
10
- f(() => {
11
- if (!s(e.onResize)) return;
12
- const c = h([r.current], (n) => {
13
- var i;
14
- e.onResize((i = n == null ? void 0 : n[0]) == null ? void 0 : i.target);
5
+ import d from "@unicom-cloud/utils/class-name";
6
+ import { resizeObserver as a } from "../components/common/utils/resizeObserver.js";
7
+ import x from "../config-provider/context.js";
8
+ function w(e) {
9
+ const { getPrefixCls: i } = u(x), t = i?.("overflow-item"), r = l();
10
+ n(() => {
11
+ if (!c(e.onResize)) return;
12
+ const s = a([r.current], (f) => {
13
+ e.onResize(f?.[0]?.target);
15
14
  });
16
15
  return () => {
17
- c();
16
+ s();
18
17
  };
19
- }, [r.current, e.onResize]), f(() => (e.onResize(r.current), () => {
18
+ }, [r.current, e.onResize]), n(() => (e.onResize(r.current), () => {
20
19
  e.unregister(r.current);
21
20
  }), []);
22
- const m = e.hidden;
23
- return /* @__PURE__ */ u(
21
+ const o = e.hidden;
22
+ return /* @__PURE__ */ m(
24
23
  "div",
25
24
  {
26
25
  ref: r,
27
- className: l(o, e.className, {
28
- [`${o}-hidden`]: m
26
+ className: d(t, e.className, {
27
+ [`${t}-hidden`]: o
29
28
  }),
30
29
  children: e.children
31
30
  }
32
31
  );
33
32
  }
34
33
  export {
35
- E as default
34
+ w as default
36
35
  };
@@ -1,75 +1,74 @@
1
- import { jsxs as g, jsx as C } from "react/jsx-runtime";
2
- import { useContext as j, useState as i, useLayoutEffect as k, useRef as b, useEffect as E } from "react";
1
+ import { jsxs as $, jsx as C } from "react/jsx-runtime";
2
+ import { useContext as j, useState as i, useLayoutEffect as k, useRef as b, useEffect as z } from "react";
3
3
  import "../config-provider/ConfigProvider.js";
4
- import z from "@unicom-cloud/utils/class-name";
5
- import { resizeObserverEffect as I } from "../components/common/utils/resizeObserverEffect.js";
6
- import O from "./OverflowItem.js";
4
+ import E from "@unicom-cloud/utils/class-name";
5
+ import { resizeObserver as I } from "../components/common/utils/resizeObserver.js";
6
+ import v from "./OverflowItem.js";
7
7
  import M from "../config-provider/context.js";
8
- function B(u) {
9
- const { getPrefixCls: c } = j(M), a = c == null ? void 0 : c("overflow"), { items: m, suffixItems: y } = u, N = u.ellipsisNode || (({ ellipsisCount: e }) => `+${e}`), [d, W] = i(), [h, _] = i(), [l, p] = i({}), [w, x] = i({}), v = m.length - h, $ = v > 0 ? N({ ellipsisCount: v }) : null;
8
+ function A(l) {
9
+ const { getPrefixCls: g } = j(M), f = g?.("overflow"), { items: a, suffixItems: O } = l, y = l.ellipsisNode || (({ ellipsisCount: t }) => `+${t}`), [m, N] = i(), [d, W] = i(), [o, h] = i({}), [x, p] = i({}), w = a.length - d, _ = w > 0 ? y({ ellipsisCount: w }) : null;
10
10
  k(() => {
11
- const e = Object.values(l).length;
12
- let s = Object.values(w).reduce((t, o) => t + ((o == null ? void 0 : o.width) || 0), 0), r = e;
13
- Object.keys(l).some((t, o) => {
14
- const n = l[t];
15
- if (n && s + n.width > d)
16
- return r = o, !0;
17
- s += (n == null ? void 0 : n.width) || 0;
18
- }), _(Math.max(r, 0));
19
- }, [l, d, w]);
20
- const f = b();
21
- return E(() => {
22
- const e = I([f.current], (s) => {
23
- var r, t;
24
- W(((t = (r = s == null ? void 0 : s[0]) == null ? void 0 : r.target) == null ? void 0 : t.clientWidth) || 0);
11
+ const t = Object.values(o).length;
12
+ let r = Object.values(x).reduce((e, n) => e + (n?.width || 0), 0), s = t;
13
+ Object.keys(o).some((e, n) => {
14
+ const c = o[e];
15
+ if (c && r + c.width > m)
16
+ return s = n, !0;
17
+ r += c?.width || 0;
18
+ }), W(Math.max(s, 0));
19
+ }, [o, m, x]);
20
+ const u = b();
21
+ return z(() => {
22
+ const t = I([u.current], (r) => {
23
+ N(r?.[0]?.target?.clientWidth || 0);
25
24
  });
26
25
  return () => {
27
- e();
26
+ t();
28
27
  };
29
- }, [f.current]), /* @__PURE__ */ g("div", { ref: f, className: z(a, u.className), children: [
30
- m.map((e, s) => {
31
- const r = `${(e == null ? void 0 : e.key) || s}_overflow_item_${s}`;
28
+ }, [u.current]), /* @__PURE__ */ $("div", { ref: u, className: E(f, l.className), children: [
29
+ a.map((t, r) => {
30
+ const s = `${t?.key || r}_overflow_item_${r}`;
32
31
  return /* @__PURE__ */ C(
33
- O,
32
+ v,
34
33
  {
35
- onResize: (t) => {
36
- p((o) => (o[r] = { node: t, width: t.clientWidth }, o));
34
+ onResize: (e) => {
35
+ h((n) => (n[s] = { node: e, width: e.clientWidth }, n));
37
36
  },
38
37
  unregister: () => {
39
- p((t) => (delete t[r], t));
38
+ h((e) => (delete e[s], e));
40
39
  },
41
- hidden: h < s + 1,
42
- children: e
40
+ hidden: d < r + 1,
41
+ children: t
43
42
  },
44
- r
43
+ s
45
44
  );
46
45
  }),
47
- [$, ...y].map((e, s) => {
48
- if (!e)
46
+ [_, ...O].map((t, r) => {
47
+ if (!t)
49
48
  return null;
50
- const r = `${(e == null ? void 0 : e.key) || s}_overflow_suffix_item`;
49
+ const s = `${t?.key || r}_overflow_suffix_item`;
51
50
  return /* @__PURE__ */ C(
52
- O,
51
+ v,
53
52
  {
54
- className: `${a}-suffix-item`,
55
- onResize: (t) => {
56
- x((o) => ({
57
- ...o,
58
- [`${r}`]: { node: t, width: t.clientWidth }
53
+ className: `${f}-suffix-item`,
54
+ onResize: (e) => {
55
+ p((n) => ({
56
+ ...n,
57
+ [`${s}`]: { node: e, width: e.clientWidth }
59
58
  }));
60
59
  },
61
60
  unregister: () => {
62
- x((t) => (delete t[r], {
63
- ...t
61
+ p((e) => (delete e[s], {
62
+ ...e
64
63
  }));
65
64
  },
66
- children: e
65
+ children: t
67
66
  },
68
- r
67
+ s
69
68
  );
70
69
  })
71
70
  ] });
72
71
  }
73
72
  export {
74
- B as default
73
+ A as default
75
74
  };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@unicom-cloud/ui","version":"0.8.96","dependencies":{"@unicom-cloud/icons":"latest"},"peerDependencies":{"dayjs":"^1.11.10","lodash":"^4.17.21","react":"^18.3.1","react-dom":"^18.3.1"},"peerDependenciesMeta":{},"type":"module","types":"types/pc/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
1
+ {"name":"@unicom-cloud/ui","version":"0.8.98","dependencies":{"@unicom-cloud/icons":"latest"},"peerDependencies":{"dayjs":"^1.11.10","lodash":"^4.17.21","react":"^18.3.1","react-dom":"^18.3.1"},"peerDependenciesMeta":{},"type":"module","types":"types/pc/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
@@ -1,5 +1,5 @@
1
- import { jsxs as c, jsx as r, Fragment as B } from "react/jsx-runtime";
2
- import C from "@unicom-cloud/icons/IconUiLeft";
1
+ import { jsxs as c, jsx as r, Fragment as H } from "react/jsx-runtime";
2
+ import B from "@unicom-cloud/icons/IconUiLeft";
3
3
  import _ from "@unicom-cloud/icons/IconUiRight";
4
4
  import T, { useContext as W, useState as j, useRef as z, useImperativeHandle as K, useEffect as U } from "react";
5
5
  import D from "../breadcrumb/index.js";
@@ -7,62 +7,62 @@ import "../config-provider/ConfigProvider.js";
7
7
  import F from "../components/common/hooks/useKeyboardEvent.js";
8
8
  import L from "../components/common/hooks/useMergeProps.js";
9
9
  import M from "../icon-hover/index.js";
10
- import $ from "@unicom-cloud/utils/class-name";
10
+ import u from "@unicom-cloud/utils/class-name";
11
11
  import { omit as O } from "../components/common/utils/omit.js";
12
- import { resizeObserverEffect as S } from "../components/common/utils/resizeObserverEffect.js";
12
+ import { resizeObserver as S } from "../components/common/utils/resizeObserver.js";
13
13
  import q from "../config-provider/context.js";
14
- function b(v, N) {
15
- const { getPrefixCls: d, componentConfig: m, rtl: p } = W(q), a = L(
16
- v,
14
+ function p(g, $) {
15
+ const { getPrefixCls: b, componentConfig: v, rtl: h } = W(q), a = L(
16
+ g,
17
17
  {},
18
- m == null ? void 0 : m.PageHeader
18
+ v?.PageHeader
19
19
  ), {
20
- header: g,
21
- title: y,
22
- subTitle: x,
20
+ header: N,
21
+ title: x,
22
+ subTitle: y,
23
23
  extra: k,
24
- children: f,
24
+ children: m,
25
25
  backIcon: l,
26
- footer: h,
27
- breadcrumb: u,
26
+ footer: d,
27
+ breadcrumb: f,
28
28
  ...A
29
29
  } = a;
30
- let i = g;
30
+ let i = N;
31
31
  Array.isArray(i) && !i.length && (i = null);
32
- let n = y;
32
+ let n = x;
33
33
  Array.isArray(n) && !n.length && (n = null);
34
- let s = x;
35
- Array.isArray(s) && !s.length && (s = null);
36
- let o = k;
34
+ let o = y;
37
35
  Array.isArray(o) && !o.length && (o = null);
38
- const w = F(), [R, E] = j(!1), t = z(), e = d == null ? void 0 : d("page-header");
39
- K(N, () => ({
40
- getRootDomElement: I
36
+ let s = k;
37
+ Array.isArray(s) && !s.length && (s = null);
38
+ const C = F(), [w, P] = j(!1), t = z(), e = b?.("page-header");
39
+ K($, () => ({
40
+ getRootDomElement: R
41
41
  }), []);
42
- function I() {
42
+ function R() {
43
43
  return t.current;
44
44
  }
45
- function H() {
46
- t.current && E(t.current.offsetWidth < 768);
45
+ function I() {
46
+ t.current && P(t.current.offsetWidth < 768);
47
47
  }
48
48
  return U(() => {
49
- const P = S([t.current], H);
49
+ const E = S([t.current], I);
50
50
  return () => {
51
- P();
51
+ E();
52
52
  };
53
53
  }, [t.current]), /* @__PURE__ */ c(
54
54
  "div",
55
55
  {
56
56
  ...O(A, ["onBack"]),
57
57
  ref: t,
58
- className: $(
58
+ className: u(
59
59
  `${e}`,
60
60
  {
61
- [`${e}-with-breadcrumb`]: u,
62
- [`${e}-with-content`]: f,
63
- [`${e}-with-footer`]: h,
64
- [`${e}-wrap`]: R,
65
- [`${e}-rtl`]: p
61
+ [`${e}-with-breadcrumb`]: f,
62
+ [`${e}-with-content`]: m,
63
+ [`${e}-with-footer`]: d,
64
+ [`${e}-wrap`]: w,
65
+ [`${e}-rtl`]: h
66
66
  },
67
67
  a.className
68
68
  ),
@@ -70,12 +70,12 @@ function b(v, N) {
70
70
  children: [
71
71
  !!i && /* @__PURE__ */ r("div", { className: `${e}-header`, children: i }),
72
72
  /* @__PURE__ */ c("div", { className: `${e}-head-wrapper`, children: [
73
- u && /* @__PURE__ */ r(D, { ...u }),
73
+ f && /* @__PURE__ */ r(D, { ...f }),
74
74
  /* @__PURE__ */ c("div", { className: `${e}-head`, children: [
75
75
  /* @__PURE__ */ c(
76
76
  "div",
77
77
  {
78
- className: $(`${e}-head-main`, {
78
+ className: u(`${e}-head-main`, {
79
79
  [`${e}-head-main-with-back`]: l
80
80
  }),
81
81
  children: [
@@ -87,31 +87,31 @@ function b(v, N) {
87
87
  role: "button",
88
88
  className: `${e}-back`,
89
89
  onClick: a.onBack,
90
- ...w({
90
+ ...C({
91
91
  onPressEnter: a.onBack
92
92
  }),
93
- children: /* @__PURE__ */ r("span", { className: `${e}-back-icon`, children: l === !0 ? p ? /* @__PURE__ */ r(_, {}) : /* @__PURE__ */ r(C, {}) : l })
93
+ children: /* @__PURE__ */ r("span", { className: `${e}-back-icon`, children: l === !0 ? h ? /* @__PURE__ */ r(_, {}) : /* @__PURE__ */ r(B, {}) : l })
94
94
  }
95
95
  ),
96
96
  n && /* @__PURE__ */ r("div", { className: `${e}-title`, children: n }),
97
- s && /* @__PURE__ */ c(B, { children: [
97
+ o && /* @__PURE__ */ c(H, { children: [
98
98
  /* @__PURE__ */ r("div", { className: `${e}-divider` }),
99
- /* @__PURE__ */ r("div", { className: `${e}-sub-title`, children: s })
99
+ /* @__PURE__ */ r("div", { className: `${e}-sub-title`, children: o })
100
100
  ] })
101
101
  ]
102
102
  }
103
103
  ),
104
- o && /* @__PURE__ */ r("div", { className: `${e}-head-extra`, children: o })
104
+ s && /* @__PURE__ */ r("div", { className: `${e}-head-extra`, children: s })
105
105
  ] })
106
106
  ] }),
107
- f && /* @__PURE__ */ r("div", { className: `${e}-content`, children: f }),
108
- h && /* @__PURE__ */ r("div", { className: `${e}-footer`, children: h })
107
+ m && /* @__PURE__ */ r("div", { className: `${e}-content`, children: m }),
108
+ d && /* @__PURE__ */ r("div", { className: `${e}-footer`, children: d })
109
109
  ]
110
110
  }
111
111
  );
112
112
  }
113
- b.displayName = "PageHeader";
114
- const se = T.forwardRef(b);
113
+ p.displayName = "PageHeader";
114
+ const oe = T.forwardRef(p);
115
115
  export {
116
- se as default
116
+ oe as default
117
117
  };
@@ -1,119 +1,115 @@
1
- import { jsx as y } from "react/jsx-runtime";
2
- import j from "@unicom-cloud/icons/IconUiLeft";
3
- import K from "@unicom-cloud/icons/IconUiMore";
4
- import T from "@unicom-cloud/icons/IconUiRight";
5
- import U, { useContext as N } from "react";
1
+ import { jsx as x } from "react/jsx-runtime";
2
+ import M from "@unicom-cloud/icons/IconUiLeft";
3
+ import R from "@unicom-cloud/icons/IconUiMore";
4
+ import j from "@unicom-cloud/icons/IconUiRight";
5
+ import K, { useContext as h } from "react";
6
6
  import "../config-provider/ConfigProvider.js";
7
- import R from "../components/common/hooks/useKeyboardEvent.js";
8
- import E from "@unicom-cloud/utils/class-name";
9
- import { StepType as S } from "./interface.js";
10
- import k from "../config-provider/context.js";
11
- function _(t) {
12
- var l, r, s;
13
- const { locale: e } = N(k), P = R(), {
14
- pageNum: i,
15
- current: v,
16
- rootPrefixCls: a,
17
- pageItemStyle: d,
18
- activePageItemStyle: m,
19
- itemRender: f
20
- } = t, p = `${a}-item`, x = v === i, b = E(p, x ? `${p}-active` : "");
21
- let o = d;
22
- x && (o = { ...o, ...m });
23
- const I = x ? { "aria-current": !0 } : {}, C = (n) => {
24
- const { pageNum: u, onClick: g, disabled: c } = t;
25
- n.currentTarget.dataset.active !== "true" && (n.stopPropagation(), c || g == null || g(u));
7
+ import N from "../components/common/hooks/useKeyboardEvent.js";
8
+ import S from "@unicom-cloud/utils/class-name";
9
+ import { StepType as b } from "./interface.js";
10
+ import $ from "../config-provider/context.js";
11
+ function T(t) {
12
+ const { locale: e } = h($), u = N(), {
13
+ pageNum: n,
14
+ current: g,
15
+ rootPrefixCls: r,
16
+ pageItemStyle: l,
17
+ activePageItemStyle: o,
18
+ itemRender: c
19
+ } = t, m = `${r}-item`, p = g === n, d = S(m, p ? `${m}-active` : "");
20
+ let a = l;
21
+ p && (a = { ...a, ...o });
22
+ const P = p ? { "aria-current": !0 } : {}, f = (i) => {
23
+ const { pageNum: s, onClick: v, disabled: C } = t;
24
+ i.currentTarget.dataset.active !== "true" && (i.stopPropagation(), C || v?.(s));
26
25
  };
27
- return /* @__PURE__ */ y(
26
+ return /* @__PURE__ */ x(
28
27
  "li",
29
28
  {
30
- style: o,
31
- className: b,
32
- onClick: C,
29
+ style: a,
30
+ className: d,
31
+ onClick: f,
33
32
  tabIndex: t.disabled ? -1 : 0,
34
- "aria-label": (s = (r = (l = e == null ? void 0 : e.Pagination) == null ? void 0 : l.currentPage) == null ? void 0 : r.replace) == null ? void 0 : s.call(r, "{0}", i),
35
- ...P({ onPressEnter: C }),
36
- ...I,
37
- children: f ? f(i, "page", i) : i
33
+ "aria-label": e?.Pagination?.currentPage?.replace?.("{0}", n),
34
+ ...u({ onPressEnter: f }),
35
+ ...P,
36
+ children: c ? c(n, "page", n) : n
38
37
  }
39
38
  );
40
39
  }
41
- function $(t, e) {
40
+ function I(t, e) {
42
41
  switch (t) {
43
42
  case "prev":
44
- return e && e.prev ? e.prev : /* @__PURE__ */ y(j, {});
43
+ return e && e.prev ? e.prev : /* @__PURE__ */ x(M, {});
45
44
  case "next":
46
- return e && e.next ? e.next : /* @__PURE__ */ y(T, {});
45
+ return e && e.next ? e.next : /* @__PURE__ */ x(j, {});
47
46
  case "more":
48
- return e && e.more ? e.more : /* @__PURE__ */ y(K, {});
47
+ return e && e.more ? e.more : /* @__PURE__ */ x(R, {});
49
48
  default:
50
49
  return null;
51
50
  }
52
51
  }
53
- const H = (t) => {
54
- var s, n, u, g, c, h;
55
- const { locale: e } = N(k), {
56
- rootPrefixCls: P,
57
- current: i,
58
- allPages: v,
59
- jumpPage: a,
60
- icons: d,
61
- disabled: m,
62
- pageItemStyle: f,
63
- itemRender: p
64
- } = t, x = v > 0 ? 1 : 0, b = Math.min(v, Math.max(x, i + a)), o = `${P}-item ${P}-item-jumper`, I = E(o), C = () => {
65
- var M;
66
- !m && ((M = t.onClick) == null || M.call(t, b));
67
- }, l = $("more", d), r = a > 0 ? (u = (n = (s = e == null ? void 0 : e.Pagination) == null ? void 0 : s.nextSomePages) == null ? void 0 : n.replace) == null ? void 0 : u.call(n, "{0}", a) : (h = (c = (g = e == null ? void 0 : e.Pagination) == null ? void 0 : g.prevSomePages) == null ? void 0 : c.replace) == null ? void 0 : h.call(c, "{0}", -a);
68
- return /* @__PURE__ */ y(
52
+ const F = (t) => {
53
+ const { locale: e } = h($), {
54
+ rootPrefixCls: u,
55
+ current: n,
56
+ allPages: g,
57
+ jumpPage: r,
58
+ icons: l,
59
+ disabled: o,
60
+ pageItemStyle: c,
61
+ itemRender: m
62
+ } = t, p = g > 0 ? 1 : 0, d = Math.min(g, Math.max(p, n + r)), a = `${u}-item ${u}-item-jumper`, P = S(a), f = () => {
63
+ !o && t.onClick?.(d);
64
+ }, i = I("more", l), s = r > 0 ? e?.Pagination?.nextSomePages?.replace?.("{0}", r) : e?.Pagination?.prevSomePages?.replace?.("{0}", -r);
65
+ return /* @__PURE__ */ x(
69
66
  "li",
70
67
  {
71
- style: f,
72
- className: I,
73
- onClick: C,
74
- "aria-label": r,
75
- children: p ? p(void 0, "more", l) : l
68
+ style: c,
69
+ className: P,
70
+ onClick: f,
71
+ "aria-label": s,
72
+ children: m ? m(void 0, "more", i) : i
76
73
  }
77
74
  );
78
- }, O = (t) => {
79
- const { locale: e, rtl: P } = N(k), i = R(), {
80
- rootPrefixCls: v,
81
- current: a,
82
- allPages: d,
83
- type: m,
84
- icons: f,
85
- disabled: p,
86
- pageItemStyle: x,
87
- itemRender: b
88
- } = t, o = `${v}-item`, [I, C] = P ? ["next", "prev"] : ["prev", "next"], l = m === S.previous ? $(I, f) : $(C, f);
89
- let r = !1;
90
- d === 0 ? r = !0 : m === S.previous ? r = a <= 1 : r = a === d;
91
- const s = p || r;
92
- let n = a + (m === S.previous ? -1 : 1);
93
- n = Math.max(0, Math.min(d, n));
94
- const u = S.previous === m ? "prev" : "next", g = E(o, `${o}-${u}`, {
95
- [`${o}-disabled`]: s
96
- }), c = () => {
97
- var h;
98
- s || (h = t.onClick) == null || h.call(t, n);
75
+ }, G = (t) => {
76
+ const { locale: e, rtl: u } = h($), n = N(), {
77
+ rootPrefixCls: g,
78
+ current: r,
79
+ allPages: l,
80
+ type: o,
81
+ icons: c,
82
+ disabled: m,
83
+ pageItemStyle: p,
84
+ itemRender: d
85
+ } = t, a = `${g}-item`, [P, f] = u ? ["next", "prev"] : ["prev", "next"], i = o === b.previous ? I(P, c) : I(f, c);
86
+ let s = !1;
87
+ l === 0 ? s = !0 : o === b.previous ? s = r <= 1 : s = r === l;
88
+ const v = m || s;
89
+ let C = r + (o === b.previous ? -1 : 1);
90
+ C = Math.max(0, Math.min(l, C));
91
+ const y = b.previous === o ? "prev" : "next", E = S(a, `${a}-${y}`, {
92
+ [`${a}-disabled`]: v
93
+ }), k = () => {
94
+ v || t.onClick?.(C);
99
95
  };
100
- return /* @__PURE__ */ y(
96
+ return /* @__PURE__ */ x(
101
97
  "li",
102
98
  {
103
- style: x,
104
- className: g,
105
- onClick: c,
106
- tabIndex: s ? -1 : 0,
107
- "aria-label": e == null ? void 0 : e.Pagination[u],
108
- ...i({
109
- onPressEnter: c
99
+ style: p,
100
+ className: E,
101
+ onClick: k,
102
+ tabIndex: v ? -1 : 0,
103
+ "aria-label": e?.Pagination[y],
104
+ ...n({
105
+ onPressEnter: k
110
106
  }),
111
- children: b ? b(void 0, u, l) : l
107
+ children: d ? d(void 0, y, i) : i
112
108
  }
113
109
  );
114
- }, Q = U.memo(_);
110
+ }, H = K.memo(T);
115
111
  export {
116
- H as JumpPager,
117
- O as StepPager,
118
- Q as default
112
+ F as JumpPager,
113
+ G as StepPager,
114
+ H as default
119
115
  };