@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,190 +1,184 @@
1
- import { jsx as D, jsxs as wt } from "react/jsx-runtime";
2
- import dt from "lodash/isFunction";
3
- import Mt from "lodash/isNumber";
4
- import S from "lodash/isPlainObject";
5
- import Ot from "lodash/isString";
6
- import L from "lodash/isUndefined";
7
- import Ct, { forwardRef as xt, useContext as St, useRef as z, useState as b, useEffect as Y, useImperativeHandle as zt } from "react";
1
+ import { jsx as B, jsxs as pt } from "react/jsx-runtime";
2
+ import vt from "lodash/isFunction";
3
+ import ht from "lodash/isNumber";
4
+ import x from "lodash/isPlainObject";
5
+ import wt from "lodash/isString";
6
+ import G from "lodash/isUndefined";
7
+ import dt, { forwardRef as Mt, useContext as Ot, useRef as S, useState as b, useEffect as V, useImperativeHandle as Ct } from "react";
8
8
  import "../config-provider/ConfigProvider.js";
9
- import Rt from "@unicom-cloud/utils/class-name";
10
- import { on as R, off as N } from "../components/common/utils/dom.js";
11
- import { omit as Nt } from "../components/common/utils/omit.js";
12
- import Pt from "./ResizeTrigger.js";
13
- import pt from "../config-provider/context.js";
14
- const j = "horizontal", _ = "vertical";
15
- function Tt(c, J) {
9
+ import xt from "@unicom-cloud/utils/class-name";
10
+ import { on as z, off as P } from "../components/common/utils/dom.js";
11
+ import { omit as St } from "../components/common/utils/omit.js";
12
+ import zt from "./ResizeTrigger.js";
13
+ import Pt from "../config-provider/context.js";
14
+ const D = "horizontal", W = "vertical";
15
+ function Rt(v, L) {
16
16
  const {
17
17
  panes: f,
18
- style: U,
19
- className: Z,
20
- component: q = "div",
21
- direction: K = "horizontal",
22
- icon: Q,
23
- ...tt
24
- } = c, { getPrefixCls: y, rtl: k } = St(pt), et = 1 / f.length, g = z(), A = z(
18
+ style: Y,
19
+ className: _,
20
+ component: J = "div",
21
+ direction: U = "horizontal",
22
+ icon: Z,
23
+ ...q
24
+ } = v, { getPrefixCls: K, rtl: j } = Ot(Pt), Q = 1 / f.length, m = S(), y = S(
25
25
  new Array(f.length).fill({
26
26
  moving: !1,
27
27
  startOffset: 0,
28
28
  startPosition: 0
29
29
  })
30
- ), nt = z([]), P = z(0), p = z([]), [l, E] = b(
31
- new Array(f.length).fill(et)
32
- ), [ot, F] = b(!1), [I, rt] = b(
30
+ ), tt = S([]), R = S(0), N = S([]), [a, A] = b(
31
+ new Array(f.length).fill(Q)
32
+ ), [et, k] = b(!1), [E, nt] = b(
33
33
  new Array(f.length).fill(0)
34
- ), [w, st] = b(
34
+ ), [h, ot] = b(
35
35
  new Array(Math.max(f.length - 1, 0)).fill({ prev: !1, next: !1 })
36
- ), d = y == null ? void 0 : y("resizebox-split-group"), v = K === j, ct = v && k, H = !v, it = Rt(
37
- d,
38
- `${d}-${v ? j : _}`,
39
- { [`${d}-moving`]: ot },
40
- { [`${d}-rtl`]: k },
41
- Z
42
- ), at = q, ft = () => {
36
+ ), w = K?.("resizebox-split-group"), g = U === D, rt = g && j, I = !g, st = xt(
37
+ w,
38
+ `${w}-${g ? D : W}`,
39
+ { [`${w}-moving`]: et },
40
+ { [`${w}-rtl`]: j },
41
+ _
42
+ ), ct = J, it = () => {
43
43
  let t = [];
44
44
  f.forEach((o) => {
45
45
  const { size: s } = o;
46
- L(s) ? t.push(void 0) : t.push(M(s));
46
+ G(s) ? t.push(void 0) : t.push(d(s));
47
47
  });
48
48
  const e = t.filter((o) => !o), r = (1 - t.reduce((o, s) => (o || 0) + (s || 0), 0)) / e.length;
49
- return t = t.map((o) => L(o) ? r : o), t;
50
- }, lt = (t) => {
51
- const e = I[t - 1] || 0, n = I[t];
52
- return `calc(${l[t] * 100}% - ${(e + n) / 2}px)`;
49
+ return t = t.map((o) => G(o) ? r : o), t;
50
+ }, ft = (t) => {
51
+ const e = E[t - 1] || 0, n = E[t];
52
+ return `calc(${a[t] * 100}% - ${(e + n) / 2}px)`;
53
53
  };
54
- function M(t) {
55
- const e = v ? g.current.offsetWidth : g.current.offsetHeight;
56
- if (!t || Mt(t) && t < 0)
54
+ function d(t) {
55
+ const e = g ? m.current.offsetWidth : m.current.offsetHeight;
56
+ if (!t || ht(t) && t < 0)
57
57
  return 0;
58
- const n = Ot(t) ? parseFloat(t) / e : t;
58
+ const n = wt(t) ? parseFloat(t) / e : t;
59
59
  return Math.min(n, 1);
60
60
  }
61
- const X = (t) => {
62
- const e = Math.min(t + 1, f.length - 1), n = l[t] + l[e], r = M(f[t].min) || 0;
63
- let o = M(f[t].max) || n;
64
- const s = M(f[e].min) || 0;
65
- let i = M(f[e].max) || n;
66
- return o = Math.min(n - s, o), i = Math.min(n - r, i), {
61
+ const H = (t) => {
62
+ const e = Math.min(t + 1, f.length - 1), n = a[t] + a[e], r = d(f[t].min) || 0;
63
+ let o = d(f[t].max) || n;
64
+ const s = d(f[e].min) || 0;
65
+ let c = d(f[e].max) || n;
66
+ return o = Math.min(n - s, o), c = Math.min(n - r, c), {
67
67
  currentMin: r,
68
68
  currentMax: o,
69
69
  nextMin: s,
70
- nextMax: i
70
+ nextMax: c
71
71
  };
72
- }, ut = (t, e, n) => {
73
- const r = P.current, o = r + 1, s = [...l], i = ct ? -1 : 1, h = l[r], C = l[o], x = h + C, { currentMin: m, currentMax: a } = X(r);
74
- let u = t + M(`${(n - e) * i}px`);
75
- return u = Math.max(m, u), u = Math.min(a, u), s[r] = u, s[o] = x - u, s;
72
+ }, at = (t, e, n) => {
73
+ const r = R.current, o = r + 1, s = [...a], c = rt ? -1 : 1, p = a[r], O = a[o], C = p + O, { currentMin: u, currentMax: i } = H(r);
74
+ let l = t + d(`${(n - e) * c}px`);
75
+ return l = Math.max(u, l), l = Math.min(i, l), s[r] = l, s[o] = C - l, s;
76
76
  };
77
- function mt(t, e) {
78
- const { contentRect: n } = t[0], r = n[H ? "height" : "width"], o = [...I];
79
- o[e] = r, rt(o);
77
+ function lt(t, e) {
78
+ const { contentRect: n } = t[0], r = n[I ? "height" : "width"], o = [...E];
79
+ o[e] = r, nt(o);
80
80
  }
81
- const gt = (t) => {
81
+ const ut = (t) => {
82
82
  let e = f[t].collapsible;
83
- S(e) || (e = e ? { prev: !0, next: !0 } : {});
83
+ x(e) || (e = e ? { prev: !0, next: !0 } : {});
84
84
  const { prev: n, next: r } = e;
85
85
  if (!n && !r)
86
86
  return {};
87
- if (!w[t])
87
+ if (!h[t])
88
88
  return {};
89
- const o = !!n || !n && w[t].next, s = !!r || !r && w[t].prev;
89
+ const o = !!n || !n && h[t].next, s = !!r || !r && h[t].prev;
90
90
  return { hasPrev: o, hasNext: s };
91
91
  };
92
- function vt(t, e) {
93
- var r;
94
- (r = c.onMovingStart) == null || r.call(c, e), P.current = e;
95
- const n = A.current[e];
96
- n.moving = !0, n.startOffset = l[e], n.startPosition = v ? t.pageX : t.pageY, F(!0), R(window, "mousemove", T), R(window, "touchmove", T), R(window, "mouseup", O), R(window, "touchend", O), R(window, "contextmenu", O), document.body.style.cursor = H ? "row-resize" : "col-resize";
92
+ function mt(t, e) {
93
+ v.onMovingStart?.(e), R.current = e;
94
+ const n = y.current[e];
95
+ n.moving = !0, n.startOffset = a[e], n.startPosition = g ? t.pageX : t.pageY, k(!0), z(window, "mousemove", T), z(window, "touchmove", T), z(window, "mouseup", M), z(window, "touchend", M), z(window, "contextmenu", M), document.body.style.cursor = I ? "row-resize" : "col-resize";
97
96
  }
98
97
  function T(t) {
99
- var o;
100
- const e = P.current, n = A.current[e], r = v ? g.current.offsetWidth : g.current.offsetHeight;
98
+ const e = R.current, n = y.current[e], r = g ? m.current.offsetWidth : m.current.offsetHeight;
101
99
  if (n.moving) {
102
- const s = ut(
100
+ const o = at(
103
101
  n.startOffset,
104
102
  n.startPosition,
105
- v ? t.pageX : t.pageY
103
+ g ? t.pageX : t.pageY
106
104
  );
107
- E(s), p.current = s, (o = c == null ? void 0 : c.onMoving) == null || o.call(
108
- c,
105
+ A(o), N.current = o, v?.onMoving?.(
109
106
  t,
110
- s.map((i) => `${i * r}px`),
107
+ o.map((s) => `${s * r}px`),
111
108
  e
112
109
  );
113
110
  }
114
111
  }
115
- function O() {
116
- var e;
117
- const t = P.current;
118
- A.current[t].moving = !1, F(!1), N(window, "mousemove", T), N(window, "touchmove", T), N(window, "mouseup", O), N(window, "touchend", O), N(window, "contextmenu", O), document.body.style.cursor = "default", (e = c.onMovingEnd) == null || e.call(c, t);
112
+ function M() {
113
+ const t = R.current;
114
+ y.current[t].moving = !1, k(!1), P(window, "mousemove", T), P(window, "touchmove", T), P(window, "mouseup", M), P(window, "touchend", M), P(window, "contextmenu", M), document.body.style.cursor = "default", v.onMovingEnd?.(t);
119
115
  }
120
- function G(t, e, n, r) {
121
- var V, W;
122
- const o = e + 1, s = [...l], i = l[e], h = l[o], C = i + h, x = v ? g.current.offsetWidth : g.current.offsetHeight, { currentMin: m, nextMin: a } = X(e);
123
- let u = p.current[e], $ = p.current[o], B = w[e][n];
124
- n === "prev" ? (h !== a || $ === a) && (u = m, $ = C - m, B = !0) : (i !== m || u === m) && (u = C - a, $ = a, B = !0), s[e] = u, s[o] = $, (V = c == null ? void 0 : c.onMoving) == null || V.call(
125
- c,
116
+ function F(t, e, n, r) {
117
+ const o = e + 1, s = [...a], c = a[e], p = a[o], O = c + p, C = g ? m.current.offsetWidth : m.current.offsetHeight, { currentMin: u, nextMin: i } = H(e);
118
+ let l = N.current[e], $ = N.current[o], X = h[e][n];
119
+ n === "prev" ? (p !== i || $ === i) && (l = u, $ = O - u, X = !0) : (c !== u || l === u) && (l = O - i, $ = i, X = !0), s[e] = l, s[o] = $, v?.onMoving?.(
126
120
  t,
127
- s.map((ht) => `${ht * x}px`),
121
+ s.map((gt) => `${gt * C}px`),
128
122
  e
129
- ), (W = c.onMovingEnd) == null || W.call(c, e), E(s), dt(r) && r(t, e, n, B);
123
+ ), v.onMovingEnd?.(e), A(s), vt(r) && r(t, e, n, X);
130
124
  }
131
- return Y(() => {
132
- const t = ft();
133
- E(t), p.current = t;
134
- }, [JSON.stringify(f.map((t) => t.size))]), zt(J, () => g.current, []), Y(() => {
125
+ return V(() => {
126
+ const t = it();
127
+ A(t), N.current = t;
128
+ }, [JSON.stringify(f.map((t) => t.size))]), Ct(L, () => m.current, []), V(() => {
135
129
  const t = [];
136
- l.forEach((e, n) => {
137
- const r = { prev: !1, next: !1 }, o = n + 1, { currentMin: s, nextMin: i } = X(n);
138
- e === s ? r.prev = !0 : l[o] === i && (r.next = !0), t.push(r);
139
- }), st(t);
140
- }, [l]), /* @__PURE__ */ D(
141
- at,
130
+ a.forEach((e, n) => {
131
+ const r = { prev: !1, next: !1 }, o = n + 1, { currentMin: s, nextMin: c } = H(n);
132
+ e === s ? r.prev = !0 : a[o] === c && (r.next = !0), t.push(r);
133
+ }), ot(t);
134
+ }, [a]), /* @__PURE__ */ B(
135
+ ct,
142
136
  {
143
- ...Nt(tt, [
137
+ ...St(q, [
144
138
  "onMovingStart",
145
139
  "onPaneResize",
146
140
  "onMoving",
147
141
  "onMovingEnd"
148
142
  ]),
149
- style: U,
150
- className: it,
151
- ref: g,
143
+ style: Y,
144
+ className: st,
145
+ ref: m,
152
146
  children: f.map((t, e) => {
153
147
  const {
154
148
  content: n,
155
149
  disabled: r,
156
150
  trigger: o,
157
151
  resizable: s = !0,
158
- collapsible: i = {}
159
- } = t, { hasPrev: h, hasNext: C } = gt(e), x = S(i) && S(i.prev) ? i.prev : {}, m = S(i) && S(i.next) ? i.next : {};
160
- return /* @__PURE__ */ wt(Ct.Fragment, { children: [
161
- /* @__PURE__ */ D(
152
+ collapsible: c = {}
153
+ } = t, { hasPrev: p, hasNext: O } = ut(e), C = x(c) && x(c.prev) ? c.prev : {}, u = x(c) && x(c.next) ? c.next : {};
154
+ return /* @__PURE__ */ pt(dt.Fragment, { children: [
155
+ /* @__PURE__ */ B(
162
156
  "div",
163
157
  {
164
- className: `${d}-pane`,
165
- style: { flexBasis: lt(e) },
166
- ref: (a) => nt.current[e] = a,
158
+ className: `${w}-pane`,
159
+ style: { flexBasis: ft(e) },
160
+ ref: (i) => tt.current[e] = i,
167
161
  children: n
168
162
  }
169
163
  ),
170
- !r && e !== f.length - 1 && /* @__PURE__ */ D(
171
- Pt,
164
+ !r && e !== f.length - 1 && /* @__PURE__ */ B(
165
+ zt,
172
166
  {
173
- className: `${d}-trigger`,
174
- direction: H ? j : _,
175
- icon: Q,
176
- onResize: (a) => mt(a, e),
177
- onMouseDown: (a) => vt(a, e),
167
+ className: `${w}-trigger`,
168
+ direction: I ? D : W,
169
+ icon: Z,
170
+ onResize: (i) => lt(i, e),
171
+ onMouseDown: (i) => mt(i, e),
178
172
  collapsible: {
179
- prev: h ? {
180
- onClick: (a) => G(a, e, "prev", x.onClick),
181
- icon: x.icon,
182
- collapsed: w[e].prev
173
+ prev: p ? {
174
+ onClick: (i) => F(i, e, "prev", C.onClick),
175
+ icon: C.icon,
176
+ collapsed: h[e].prev
183
177
  } : void 0,
184
- next: C ? {
185
- onClick: (a) => G(a, e, "next", m.onClick),
186
- icon: m.icon,
187
- collapsed: w[e].next
178
+ next: O ? {
179
+ onClick: (i) => F(i, e, "next", u.onClick),
180
+ icon: u.icon,
181
+ collapsed: h[e].next
188
182
  } : void 0
189
183
  },
190
184
  resizable: s,
@@ -196,8 +190,8 @@ function Tt(c, J) {
196
190
  }
197
191
  );
198
192
  }
199
- const $t = xt(Tt);
200
- $t.displayName = "ResizeBoxSplitGroup";
193
+ const Nt = Mt(Rt);
194
+ Nt.displayName = "ResizeBoxSplitGroup";
201
195
  export {
202
- $t as default
196
+ Nt as default
203
197
  };
@@ -1,58 +1,58 @@
1
- import { jsxs as ot, jsx as rt } from "react/jsx-runtime";
2
- import E from "lodash/isNumber";
3
- import { forwardRef as nt, useContext as st, useState as it, useRef as W, useImperativeHandle as ct } from "react";
1
+ import { jsxs as et, jsx as ot } from "react/jsx-runtime";
2
+ import O from "lodash/isNumber";
3
+ import { forwardRef as rt, useContext as nt, useState as st, useRef as D, useImperativeHandle as it } from "react";
4
4
  import "../config-provider/ConfigProvider.js";
5
- import at from "../components/common/hooks/useMergeProps.js";
6
- import $ from "../components/common/hooks/useMergeValue.js";
7
- import ut from "@unicom-cloud/utils/class-name";
8
- import { on as g, off as l } from "../components/common/utils/dom.js";
9
- import { omit as mt } from "../components/common/utils/omit.js";
10
- import dt from "./ResizeTrigger.js";
11
- import gt from "./Split.js";
12
- import lt from "./SplitGroup.js";
13
- import ft from "../config-provider/context.js";
14
- const X = "left", b = "right", y = "top", x = "bottom", pt = [
15
- X,
16
- b,
17
- y,
18
- x
19
- ], ht = {
5
+ import ct from "../components/common/hooks/useMergeProps.js";
6
+ import B from "../components/common/hooks/useMergeValue.js";
7
+ import at from "@unicom-cloud/utils/class-name";
8
+ import { on as u, off as m } from "../components/common/utils/dom.js";
9
+ import { omit as ut } from "../components/common/utils/omit.js";
10
+ import mt from "./ResizeTrigger.js";
11
+ import pt from "./Split.js";
12
+ import dt from "./SplitGroup.js";
13
+ import gt from "../config-provider/context.js";
14
+ const E = "left", w = "right", v = "top", R = "bottom", lt = [
15
+ E,
16
+ w,
17
+ v,
18
+ R
19
+ ], ft = {
20
20
  component: "div",
21
21
  directions: ["right"],
22
22
  resizeIcons: {},
23
23
  resizeTriggers: {}
24
- }, wt = (f) => {
25
- switch (f) {
24
+ }, ht = (p) => {
25
+ switch (p) {
26
26
  case "left":
27
27
  return "right";
28
28
  case "right":
29
29
  return "left";
30
30
  default:
31
- return f;
31
+ return p;
32
32
  }
33
33
  };
34
- function vt(f, Y) {
35
- const { getPrefixCls: w, componentConfig: v, rtl: I } = st(ft), r = at(
36
- f,
37
- ht,
38
- v == null ? void 0 : v.ResizeBox
34
+ function wt(p, W) {
35
+ const { getPrefixCls: $, componentConfig: X, rtl: b } = nt(gt), d = ct(
36
+ p,
37
+ ft,
38
+ X?.ResizeBox
39
39
  ), {
40
- style: k,
41
- className: G,
42
- component: _,
43
- directions: C,
44
- resizeIcons: A,
45
- children: P,
46
- resizeTriggers: j,
47
- width: F,
48
- height: q,
49
- ...K
50
- } = r, L = I ? C.map((t) => wt(t)) : C, R = w == null ? void 0 : w("resizebox"), U = ut(R, { [`${R}-rtl`]: I }, G), [V, J] = it({}), [N, S] = $(void 0, { value: F }), [H, M] = $(void 0, { value: q }), o = W({
40
+ style: Y,
41
+ className: P,
42
+ component: k,
43
+ directions: x,
44
+ resizeIcons: G,
45
+ children: _,
46
+ resizeTriggers: A,
47
+ width: j,
48
+ height: F,
49
+ ...q
50
+ } = d, K = b ? x.map((t) => ht(t)) : x, f = $?.("resizebox"), L = at(f, { [`${f}-rtl`]: b }, P), [U, V] = st({}), [y, C] = B(void 0, { value: j }), [T, I] = B(void 0, { value: F }), o = D({
51
51
  startX: 0,
52
52
  startY: 0,
53
53
  startWidth: 0,
54
54
  startHeight: 0,
55
- direction: b,
55
+ direction: w,
56
56
  moving: !1,
57
57
  padding: {
58
58
  top: 0,
@@ -60,110 +60,107 @@ function vt(f, Y) {
60
60
  left: 0,
61
61
  right: 0
62
62
  }
63
- }), p = W();
64
- ct(Y, () => p.current, []);
65
- function z(t) {
66
- return [y, x].indexOf(t) > -1;
63
+ }), g = D();
64
+ it(W, () => g.current, []);
65
+ function h(t) {
66
+ return [v, R].indexOf(t) > -1;
67
67
  }
68
- function O(t, e) {
68
+ function N(t, e) {
69
69
  if (t === 0)
70
70
  return 0;
71
- const n = t - e;
72
- return n <= 0 ? 0 : n;
71
+ const r = t - e;
72
+ return r <= 0 ? 0 : r;
73
73
  }
74
- function D(t) {
74
+ function S(t) {
75
75
  const e = "data-pqb-origin-cursor";
76
76
  if (t)
77
77
  document.body.setAttribute(e, document.body.style.cursor), document.body.style.cursor = t;
78
78
  else {
79
- const n = document.body.getAttribute(e);
80
- document.body.style.cursor = n || "", document.body.removeAttribute(e);
79
+ const r = document.body.getAttribute(e);
80
+ document.body.style.cursor = r || "", document.body.removeAttribute(e);
81
81
  }
82
82
  }
83
- function Q(t, e) {
84
- var i, m, d;
85
- (i = r.onMovingStart) == null || i.call(r), o.current.moving = !0, o.current.startX = e.pageX, o.current.startY = e.pageY, o.current.direction = t;
86
- const { top: n, left: c, right: a, bottom: s } = o.current.padding;
87
- o.current.startWidth = O(
88
- (m = p.current) == null ? void 0 : m.clientWidth,
89
- c + a
90
- ), o.current.startHeight = O(
91
- (d = p.current) == null ? void 0 : d.clientHeight,
92
- n + s
93
- ), g(window, "mousemove", h), g(window, "touchmove", h), g(window, "mouseup", u), g(window, "touchend", u), g(window, "contextmenu", u), D(
94
- z(t) ? "row-resize" : "col-resize"
83
+ function J(t, e) {
84
+ d.onMovingStart?.(), o.current.moving = !0, o.current.startX = e.pageX, o.current.startY = e.pageY, o.current.direction = t;
85
+ const { top: r, left: s, right: i, bottom: n } = o.current.padding;
86
+ o.current.startWidth = N(
87
+ g.current?.clientWidth,
88
+ s + i
89
+ ), o.current.startHeight = N(
90
+ g.current?.clientHeight,
91
+ r + n
92
+ ), u(window, "mousemove", l), u(window, "touchmove", l), u(window, "mouseup", a), u(window, "touchend", a), u(window, "contextmenu", a), S(
93
+ h(t) ? "row-resize" : "col-resize"
95
94
  );
96
95
  }
97
- function h(t) {
98
- var B;
96
+ function l(t) {
99
97
  if (!o.current.moving)
100
98
  return !1;
101
- const { startX: e, startY: n, startWidth: c, startHeight: a } = o.current;
102
- let s = c, i = a;
103
- const m = t.pageX - e, d = t.pageY - n;
99
+ const { startX: e, startY: r, startWidth: s, startHeight: i } = o.current;
100
+ let n = s, c = i;
101
+ const H = t.pageX - e, M = t.pageY - r;
104
102
  switch (o.current.direction) {
105
- case X:
106
- s = c - m, S(s);
103
+ case E:
104
+ n = s - H, C(n);
107
105
  break;
108
- case b:
109
- s = c + m, S(s);
106
+ case w:
107
+ n = s + H, C(n);
110
108
  break;
111
- case y:
112
- i = a - d, M(i);
109
+ case v:
110
+ c = i - M, I(c);
113
111
  break;
114
- case x:
115
- i = a + d, M(i);
112
+ case R:
113
+ c = i + M, I(c);
116
114
  break;
117
115
  }
118
- (B = r.onMoving) == null || B.call(r, t, {
119
- width: s,
120
- height: i
116
+ d.onMoving?.(t, {
117
+ width: n,
118
+ height: c
121
119
  });
122
120
  }
123
- function u() {
124
- var t;
125
- o.current.moving = !1, Z(), D(), (t = r.onMovingEnd) == null || t.call(r);
121
+ function a() {
122
+ o.current.moving = !1, Q(), S(), d.onMovingEnd?.();
126
123
  }
127
- function Z() {
128
- l(window, "mousemove", h), l(window, "touchmove", h), l(window, "mouseup", u), l(window, "touchend", u), l(window, "contextmenu", u);
124
+ function Q() {
125
+ m(window, "mousemove", l), m(window, "touchmove", l), m(window, "mouseup", a), m(window, "touchend", a), m(window, "contextmenu", a);
129
126
  }
130
- function tt(t, e) {
131
- const n = z(t), { contentRect: c } = e[0], a = `${t.slice(0, 1).toUpperCase()}${t.slice(1)}`, s = c[n ? "height" : "width"];
132
- o.current.padding[t] = s, J((i) => ({
133
- ...i,
134
- [`padding${a}`]: s
127
+ function Z(t, e) {
128
+ const r = h(t), { contentRect: s } = e[0], i = `${t.slice(0, 1).toUpperCase()}${t.slice(1)}`, n = s[r ? "height" : "width"];
129
+ o.current.padding[t] = n, V((c) => ({
130
+ ...c,
131
+ [`padding${i}`]: n
135
132
  }));
136
133
  }
137
- const et = {
138
- ...V,
139
- ...k || {},
140
- ...E(N) ? { width: N } : {},
141
- ...E(H) ? { height: H } : {}
134
+ const tt = {
135
+ ...U,
136
+ ...Y || {},
137
+ ...O(y) ? { width: y } : {},
138
+ ...O(T) ? { height: T } : {}
142
139
  };
143
- return /* @__PURE__ */ ot(
144
- _,
140
+ return /* @__PURE__ */ et(
141
+ k,
145
142
  {
146
- ...mt(K, ["onMovingStart", "onMoving", "onMovingEnd"]),
147
- style: et,
148
- className: U,
149
- ref: p,
143
+ ...ut(q, ["onMovingStart", "onMoving", "onMovingEnd"]),
144
+ style: tt,
145
+ className: L,
146
+ ref: g,
150
147
  children: [
151
- P,
152
- L.map((t) => {
153
- if (pt.indexOf(t) !== -1)
154
- return /* @__PURE__ */ rt(
155
- dt,
148
+ _,
149
+ K.map((t) => {
150
+ if (lt.indexOf(t) !== -1)
151
+ return /* @__PURE__ */ ot(
152
+ mt,
156
153
  {
157
- className: `${R}-direction-${t}`,
158
- direction: z(t) ? "horizontal" : "vertical",
159
- icon: A[t],
154
+ className: `${f}-direction-${t}`,
155
+ direction: h(t) ? "horizontal" : "vertical",
156
+ icon: G[t],
160
157
  onMouseDown: (e) => {
161
- Q(t, e);
158
+ J(t, e);
162
159
  },
163
160
  onResize: (e) => {
164
- tt(t, e);
161
+ Z(t, e);
165
162
  },
166
- children: j[t]
163
+ children: A[t]
167
164
  },
168
165
  t
169
166
  );
@@ -172,12 +169,12 @@ function vt(f, Y) {
172
169
  }
173
170
  );
174
171
  }
175
- const Rt = nt(vt), T = Rt;
176
- T.Split = gt;
177
- T.SplitGroup = lt;
178
- T.displayName = "ResizeBox";
172
+ const vt = rt(wt), z = vt;
173
+ z.Split = pt;
174
+ z.SplitGroup = dt;
175
+ z.displayName = "ResizeBox";
179
176
  export {
180
- gt as ResizeBoxSplit,
181
- lt as ResizeBoxSplitGroup,
182
- T as default
177
+ pt as ResizeBoxSplit,
178
+ dt as ResizeBoxSplitGroup,
179
+ z as default
183
180
  };