@unicom-cloud/ui 0.8.66 → 0.8.67

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 (357) hide show
  1. package/Affix.js +79 -79
  2. package/Alert.js +46 -46
  3. package/Anchor.js +1 -1
  4. package/AutoComplete.js +74 -74
  5. package/Avatar.js +36 -36
  6. package/BackTop.js +35 -35
  7. package/Badge.js +55 -55
  8. package/Breadcrumb.js +42 -42
  9. package/Button.js +24 -24
  10. package/Calendar.js +230 -230
  11. package/Card.js +18 -18
  12. package/Carousel.js +165 -165
  13. package/Cascader.js +1 -1
  14. package/Checkbox.js +1 -1
  15. package/Collapse.js +1 -1
  16. package/ColorPicker.js +26 -26
  17. package/Comment.js +18 -18
  18. package/ConfigProvider.js +2 -2
  19. package/Copy.js +28 -27
  20. package/DatePicker.js +872 -871
  21. package/Descriptions.js +34 -34
  22. package/Divider.js +19 -19
  23. package/Draggable.js +27 -26
  24. package/Drawer.js +1 -1
  25. package/Dropdown.js +110 -110
  26. package/Empty.js +3 -3
  27. package/Form.js +984 -945
  28. package/Grid.js +34 -34
  29. package/Icon.js +16 -16
  30. package/IconHover.js +2 -2
  31. package/Image.js +2 -2
  32. package/Input.js +7 -6
  33. package/InputNumber.js +6 -6
  34. package/InputTag.js +1 -1
  35. package/Layout.js +24 -24
  36. package/Link.js +30 -30
  37. package/List.js +95 -95
  38. package/Mentions.js +85 -84
  39. package/Menu.js +2 -2
  40. package/Message.js +7 -6
  41. package/Modal.js +1 -1
  42. package/Notice.js +14 -3
  43. package/Notification.js +9 -7
  44. package/OverflowEllipsis.js +64 -62
  45. package/PageHeader.js +73 -73
  46. package/Pagination.js +1 -1
  47. package/Picker.js +1 -1
  48. package/Popconfirm.js +60 -60
  49. package/Popover.js +31 -31
  50. package/Portal.js +23 -31
  51. package/Progress.js +22 -22
  52. package/Radio.js +2 -2
  53. package/Rate.js +24 -24
  54. package/ResizeBox.js +274 -271
  55. package/Result.js +3 -3
  56. package/Select.js +4 -4
  57. package/SelectView.js +257 -238
  58. package/Skeleton.js +46 -46
  59. package/Slider.js +286 -283
  60. package/Space.js +28 -28
  61. package/SpeechSynthesis.js +62 -55
  62. package/Spin.js +23 -23
  63. package/Statistic.js +80 -80
  64. package/Steps.js +67 -67
  65. package/Switch.js +47 -47
  66. package/Table.js +1445 -1380
  67. package/Tabs.js +5 -5
  68. package/Tag.js +45 -45
  69. package/TimePicker.js +154 -154
  70. package/Timeline.js +2 -2
  71. package/Tooltip.js +80 -79
  72. package/Transfer.js +103 -102
  73. package/Tree.js +3 -2
  74. package/TreeSelect.js +2 -2
  75. package/Trigger.js +699 -772
  76. package/Typography.js +756 -6
  77. package/Upload.js +2 -2
  78. package/VerificationCode.js +1 -1
  79. package/Version.js +1 -1
  80. package/VirtualList.js +1 -1
  81. package/Watermark.js +1 -1
  82. package/chunk/{BHgJ5Y3T.js → -UuKKT0Z.js} +29 -29
  83. package/chunk/{B8QV6E2b.js → AwZqeapI.js} +5 -5
  84. package/chunk/B5gK1Idp.js +19 -0
  85. package/chunk/B7FlazNB.js +24 -0
  86. package/chunk/{DTBtQQ2H.js → BBvWDeuZ.js} +67 -67
  87. package/chunk/BCftTxEy.js +626 -0
  88. package/chunk/{CZOP_ZHJ.js → BGny4zSb.js} +60 -60
  89. package/chunk/BHF15Dog.js +98 -0
  90. package/chunk/BJQ5UNa-.js +1585 -0
  91. package/chunk/BP9sYyk9.js +8 -0
  92. package/chunk/BUdtVdnv.js +38 -0
  93. package/chunk/BVQlOzTS.js +11 -0
  94. package/chunk/B__a_gb_.js +519 -0
  95. package/chunk/BbEYToV1.js +10 -0
  96. package/chunk/BbdDQAnm.js +15 -0
  97. package/chunk/BdUcgWdu.js +11 -0
  98. package/chunk/BfbXSG70.js +26 -0
  99. package/chunk/BndfNLK4.js +186 -0
  100. package/chunk/BoMCZV6K.js +1098 -0
  101. package/chunk/Br0B6y1T.js +18 -0
  102. package/chunk/BrOW642m.js +130 -0
  103. package/chunk/BxUs8_Cr.js +9 -0
  104. package/chunk/{CcV4wQB1.js → C42LIMP9.js} +244 -242
  105. package/chunk/C4YkFMzC.js +778 -0
  106. package/chunk/{Bh23P4l7.js → C9Wcraj7.js} +21 -21
  107. package/chunk/{4-gvEY5y.js → CANgSlh3.js} +10 -10
  108. package/chunk/CJ_o9tZM.js +5 -0
  109. package/chunk/{DNAigumg.js → CK5m7rLl.js} +36 -36
  110. package/chunk/{CANaGbGR.js → CKNyIitu.js} +57 -56
  111. package/chunk/CLiqJm_T.js +10 -0
  112. package/chunk/{BnSVm1YC.js → CNmmhbCn.js} +32 -32
  113. package/chunk/{BFipyA67.js → CP0odX99.js} +51 -51
  114. package/chunk/CPT-OZH2.js +14 -0
  115. package/chunk/CVSF8p0O.js +698 -0
  116. package/chunk/C_agcwLN.js +31 -0
  117. package/chunk/{jhQQCFMn.js → C_gJWGGh.js} +201 -201
  118. package/chunk/{Bc7t9jkb.js → CaasmWg_.js} +11 -11
  119. package/chunk/Ce1j9KTi.js +6 -0
  120. package/chunk/{D_-UD4vO.js → Cf5QNhkG.js} +18 -18
  121. package/chunk/CkNSv2U7.js +56 -0
  122. package/chunk/Cp2f70gB.js +9 -0
  123. package/chunk/CpegYjdC.js +16 -0
  124. package/chunk/CucI3KZr.js +20 -0
  125. package/chunk/CwoFBTYz.js +11 -0
  126. package/chunk/D2KPqPhV.js +17 -0
  127. package/chunk/D7NyvE5f.js +17 -0
  128. package/chunk/D8oTPQ2H.js +384 -0
  129. package/chunk/{CLBavO5c.js → DC1iHEiy.js} +87 -87
  130. package/chunk/{DnvO8A0Z.js → DFrfrmfK.js} +120 -119
  131. package/chunk/DGTIZ_0O.js +6 -0
  132. package/chunk/DJfpiZn_.js +25 -0
  133. package/chunk/DKr2_PYd.js +34 -0
  134. package/chunk/DNUz6zgo.js +11 -0
  135. package/chunk/DRtM649q.js +11 -0
  136. package/chunk/DS_mUWn6.js +41 -0
  137. package/chunk/DU6bs_19.js +10 -0
  138. package/chunk/DWdbwz22.js +10 -0
  139. package/chunk/DcveZuqd.js +6 -0
  140. package/chunk/DdVFknul.js +24 -0
  141. package/chunk/DgRfikwe.js +16 -0
  142. package/chunk/{znkyQ-HR.js → DkyR2EfG.js} +66 -66
  143. package/chunk/{DUeHQKtx.js → DleQ5HwG.js} +42 -42
  144. package/chunk/DnrZEnQ_.js +27 -0
  145. package/chunk/DsRSHWtX.js +1025 -0
  146. package/chunk/Dz5BdmXo.js +270 -0
  147. package/chunk/EANe01DF.js +1030 -0
  148. package/chunk/{CwhPMMWy.js → Ey4YJCkX.js} +7 -7
  149. package/chunk/GoNx5R4F.js +873 -0
  150. package/chunk/HDUQku8d.js +20 -0
  151. package/chunk/HrAP__Hi.js +25 -0
  152. package/chunk/JPPo5nY_.js +9 -0
  153. package/chunk/{Du-bw6qA.js → SLWP34OR.js} +90 -85
  154. package/chunk/VVKtwaGf.js +278 -0
  155. package/chunk/WPNpLxSI.js +16 -0
  156. package/chunk/{CPvvjMwZ.js → WpO_DsK4.js} +49 -48
  157. package/chunk/fdU3ang6.js +14 -0
  158. package/chunk/{DQAot004.js → fkclKOAL.js} +298 -292
  159. package/chunk/flvYlqx3.js +22 -0
  160. package/chunk/kTDayEpF.js +288 -0
  161. package/chunk/{CssIjN1g.js → pZoNQ75H.js} +31 -31
  162. package/chunk/qFf1w_Jq.js +8 -0
  163. package/chunk/{CHnFKgbk.js → w-kM1L5W.js} +155 -155
  164. package/hooks/index.js +53 -49
  165. package/hooks/useComputedState.js +2 -10
  166. package/hooks/useCreate.js +2 -7
  167. package/hooks/useForceUpdate.js +2 -7
  168. package/hooks/useId.js +2 -10
  169. package/hooks/useInView.js +2 -30
  170. package/hooks/useIntersectionObserver.js +2 -23
  171. package/hooks/useInterval.js +2 -17
  172. package/hooks/useIsFirstRender.js +2 -9
  173. package/hooks/useIsomorphicLayoutEffect.js +2 -5
  174. package/hooks/useKeyboardEvent.js +2 -16
  175. package/hooks/useMedia.js +2 -15
  176. package/hooks/useMergeProps.js +2 -18
  177. package/hooks/useMergeValue.js +2 -19
  178. package/hooks/useOnlineStatus.js +4 -0
  179. package/hooks/useOverflowHidden.js +2 -25
  180. package/hooks/useOverrideRef.js +2 -13
  181. package/hooks/usePersistCallback.js +2 -13
  182. package/hooks/usePrefersColorSchemeDark.js +4 -0
  183. package/hooks/usePrevious.js +2 -9
  184. package/hooks/useRefs.js +2 -9
  185. package/hooks/useResizeObserver.js +2 -15
  186. package/hooks/useStateCallback.js +2 -15
  187. package/hooks/useStateWithPromise.js +2 -24
  188. package/hooks/useUpdateEffect.js +2 -9
  189. package/hooks/useVerificationCode.js +73 -0
  190. package/hooks/useWatch.js +2 -10
  191. package/hooks/{use-watermark.js → useWatermark.js} +27 -26
  192. package/hooks/useWindowSize.js +2 -20
  193. package/index.js +571 -584
  194. package/locale/en-US.js +4 -2
  195. package/locale/interface.js +1 -4
  196. package/locale/ja-JP.js +3 -1
  197. package/locale/tr-TR.js +1 -1
  198. package/locale/zh-CN.js +3 -1
  199. package/locale/zh-HK.js +3 -1
  200. package/locale/zh-TW.js +3 -1
  201. package/package.json +1 -1
  202. package/style.css +1 -1
  203. package/types/anchor/util.d.ts +1 -1
  204. package/types/button/index.d.ts +2 -2
  205. package/types/color-picker/hooks/useColorPicker.d.ts +2 -2
  206. package/types/form/Control-old.d.ts +56 -0
  207. package/types/form/Control.d.ts +6 -54
  208. package/types/form/FormItem.d.ts +1 -1
  209. package/types/form/store.d.ts +0 -1
  210. package/types/hooks/index.d.ts +2 -0
  211. package/types/hooks/useComputedState.d.ts +1 -4
  212. package/types/hooks/useCreate.d.ts +1 -2
  213. package/types/hooks/useForceUpdate.d.ts +1 -2
  214. package/types/hooks/useId.d.ts +1 -2
  215. package/types/hooks/useInView.d.ts +1 -11
  216. package/types/hooks/useIntersectionObserver.d.ts +1 -7
  217. package/types/hooks/useInterval.d.ts +1 -2
  218. package/types/hooks/useIsFirstRender.d.ts +1 -2
  219. package/types/hooks/useIsomorphicLayoutEffect.d.ts +1 -3
  220. package/types/hooks/useKeyboardEvent.d.ts +1 -8
  221. package/types/hooks/useMedia.d.ts +1 -2
  222. package/types/hooks/useMergeProps.d.ts +1 -5
  223. package/types/hooks/useMergeValue.d.ts +1 -6
  224. package/types/hooks/useOnlineStatus.d.ts +1 -0
  225. package/types/hooks/useOverflowHidden.d.ts +1 -5
  226. package/types/hooks/useOverrideRef.d.ts +1 -6
  227. package/types/hooks/usePersistCallback.d.ts +1 -2
  228. package/types/hooks/usePrefersColorSchemeDark.d.ts +1 -0
  229. package/types/hooks/usePrevious.d.ts +1 -3
  230. package/types/hooks/useRefs.d.ts +1 -2
  231. package/types/hooks/useResizeObserver.d.ts +1 -6
  232. package/types/hooks/useStateCallback.d.ts +1 -5
  233. package/types/hooks/useStateWithPromise.d.ts +1 -2
  234. package/types/hooks/useUpdateEffect.d.ts +1 -3
  235. package/types/hooks/useWatch.d.ts +1 -3
  236. package/types/hooks/useWindowSize.d.ts +1 -5
  237. package/types/image/interface.d.ts +1 -0
  238. package/types/index.d.ts +157 -86
  239. package/types/input/Input.d.ts +1 -1
  240. package/types/input/Textarea.d.ts +2 -2
  241. package/types/locale/en-US.d.ts +2 -0
  242. package/types/locale/interface.d.ts +1 -2
  243. package/types/locale/ja-JP.d.ts +2 -0
  244. package/types/locale/zh-CN.d.ts +2 -0
  245. package/types/locale/zh-HK.d.ts +2 -0
  246. package/types/locale/zh-TW.d.ts +2 -0
  247. package/types/menu/context.d.ts +1 -1
  248. package/types/message/index.d.ts +14 -14
  249. package/types/message/interface.d.ts +2 -0
  250. package/types/modal/config.d.ts +0 -1
  251. package/types/modal/interface.d.ts +0 -1
  252. package/types/notice/index.d.ts +2 -27
  253. package/types/notification/index.d.ts +15 -16
  254. package/types/notification/interface.d.ts +2 -0
  255. package/types/notification/withNotification.d.ts +2 -0
  256. package/types/select/util.d.ts +1 -2
  257. package/types/select-view/interface.d.ts +2 -1
  258. package/types/speech-synthesis/index.d.ts +1 -1
  259. package/types/table/constant.d.ts +2 -0
  260. package/types/table/hook/useThResizable.d.ts +7 -0
  261. package/types/table/index.d.ts +10 -1
  262. package/types/table/style/index.d.ts +1 -0
  263. package/types/table/th-resizable/index.d.ts +2 -0
  264. package/types/table/thead/Column.d.ts +1 -2
  265. package/types/tree/Tree.d.ts +12 -67
  266. package/types/tree-select/Select.d.ts +2 -2
  267. package/types/trigger/index.d.ts +2 -120
  268. package/types/trigger/interface.d.ts +2 -1
  269. package/types/utils/CSSTransition.d.ts +2 -3
  270. package/types/utils/caseName.d.ts +1 -1
  271. package/types/utils/className.d.ts +1 -1
  272. package/types/utils/constant.d.ts +2 -2
  273. package/types/utils/copy.d.ts +1 -1
  274. package/types/utils/dayjs.d.ts +1 -21
  275. package/types/utils/dom.d.ts +1 -6
  276. package/types/utils/fileToURL.d.ts +1 -1
  277. package/types/utils/fillNBSP.d.ts +1 -1
  278. package/types/utils/getHighlightText.d.ts +1 -5
  279. package/types/utils/getHotkeyHandler.d.ts +1 -8
  280. package/types/utils/getStringLength.d.ts +1 -1
  281. package/types/utils/include.d.ts +1 -1
  282. package/types/utils/index.d.ts +3 -4
  283. package/types/utils/is.d.ts +1 -16
  284. package/types/utils/keyboardCode.d.ts +3 -0
  285. package/types/utils/lodash.d.ts +1 -17
  286. package/types/utils/mergeProps.d.ts +1 -1
  287. package/types/utils/mergedToString.d.ts +1 -1
  288. package/types/utils/omit.d.ts +1 -1
  289. package/types/utils/pad.d.ts +1 -2
  290. package/types/utils/pick.d.ts +2 -4
  291. package/types/utils/reactDOM.d.ts +1 -7
  292. package/types/utils/resizeObserverEffect.d.ts +2 -0
  293. package/types/utils/saveAs.d.ts +1 -1
  294. package/types/utils/screenfull.d.ts +2 -0
  295. package/types/utils/scrollIntoView.d.ts +1 -2
  296. package/types/utils/style.d.ts +1 -3
  297. package/types/utils/throttleByRaf.d.ts +1 -5
  298. package/types/utils/throttleByRaf2.d.ts +1 -0
  299. package/types/utils/warning.d.ts +1 -2
  300. package/types/version/index.d.ts +1 -1
  301. package/utils/CSSTransition.js +2 -6
  302. package/utils/className.js +2 -2
  303. package/utils/constant.js +8 -9
  304. package/utils/contextHolder.js +1 -1
  305. package/utils/copy.js +1 -1
  306. package/utils/dayjs.js +14 -173
  307. package/utils/dom.js +33 -29
  308. package/utils/fillNBSP.js +2 -4
  309. package/utils/getHighlightText.js +2 -38
  310. package/utils/getHotkeyHandler.js +2 -25
  311. package/utils/getStringLength.js +2 -7
  312. package/utils/include.js +2 -7
  313. package/utils/index.js +237 -240
  314. package/utils/is.js +116 -156
  315. package/utils/keyboardCode.js +27 -0
  316. package/utils/mergeProps.js +2 -9
  317. package/utils/mergedToString.js +2 -13
  318. package/utils/omit.js +2 -9
  319. package/utils/pad.js +12 -12
  320. package/utils/pick.js +4 -15
  321. package/utils/reactDOM.js +3 -54
  322. package/utils/resizeObserverEffect.js +4 -0
  323. package/utils/saveAs.js +1 -1
  324. package/utils/screenfull.js +4 -0
  325. package/utils/scrollIntoView.js +2 -21
  326. package/utils/style.js +12 -11
  327. package/utils/throttleByRaf.js +13 -12
  328. package/utils/throttleByRaf2.js +5 -0
  329. package/utils/warning.js +5 -4
  330. package/NotificationBase.js +0 -53
  331. package/chunk/-zpSUpGE.js +0 -1501
  332. package/chunk/BAWsPQBM.js +0 -11
  333. package/chunk/BIT0j3HT.js +0 -269
  334. package/chunk/BbLKnaNO.js +0 -871
  335. package/chunk/Bfhv56O2.js +0 -638
  336. package/chunk/C2lIz2F9.js +0 -60
  337. package/chunk/C6QWSzsM.js +0 -376
  338. package/chunk/CVkHTbic.js +0 -995
  339. package/chunk/CeGEvXby.js +0 -278
  340. package/chunk/D3NFxdmG.js +0 -518
  341. package/chunk/DApXtulb.js +0 -1102
  342. package/chunk/DPByB1ab.js +0 -698
  343. package/chunk/DV1Ab_cG.js +0 -284
  344. package/chunk/dBnNCOIU.js +0 -778
  345. package/chunk/it8qlDZ3.js +0 -1032
  346. package/chunk/l0sNRNKZ.js +0 -1
  347. package/chunk/te_43YrB.js +0 -776
  348. package/hooks/use-verification-code.js +0 -73
  349. package/types/notification-base/index.d.ts +0 -15
  350. package/types/notification-base/style/index.d.ts +0 -2
  351. package/types/trigger/Portal.d.ts +0 -7
  352. package/types/utils/keyCode.d.ts +0 -45
  353. package/types/utils/raf.d.ts +0 -3
  354. package/types/utils/throttleByRafV2.d.ts +0 -5
  355. package/utils/keyCode.js +0 -12
  356. package/utils/raf.js +0 -19
  357. package/utils/throttleByRafV2.js +0 -16
package/Trigger.js CHANGED
@@ -1,229 +1,218 @@
1
- var ot = Object.defineProperty;
2
- var st = (h, l, t) => l in h ? ot(h, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[l] = t;
3
- var s = (h, l, t) => st(h, typeof l != "symbol" ? l + "" : l, t);
4
- import { jsx as N, jsxs as X } from "react/jsx-runtime";
5
- import { $ as nt } from "./chunk/CLBavO5c.js";
6
- import rt from "lodash/isArray";
7
- import lt from "lodash/isEqual";
8
- import W from "lodash/isFunction";
9
- import A, { useRef as pt, useEffect as ht, PureComponent as ut, createRef as q } from "react";
10
- import { d as at } from "./chunk/-zpSUpGE.js";
11
- import { y as _ } from "./chunk/BAWsPQBM.js";
12
- import { isServerRendering as et, on as U, off as Y, getScrollElements as ct, isScrollElement as ft, contains as Q } from "./utils/dom.js";
13
- import { supportRef as dt } from "./utils/is.js";
14
- import { d as K } from "./chunk/C2lIz2F9.js";
15
- import gt from "./utils/mergeProps.js";
16
- import { pickDataAttributes as mt } from "./utils/pick.js";
17
- import { caf as G, raf as Pt } from "./utils/raf.js";
18
- import { findDOMNode as bt, callbackOriginRef as yt } from "./utils/reactDOM.js";
19
- import j from "./utils/throttleByRaf.js";
20
- import wt from "react-dom";
21
- import { useIsFirstRender as Tt } from "./hooks/useIsFirstRender.js";
1
+ import { jsx as X, jsxs as Rt } from "react/jsx-runtime";
2
+ import { $ as fe } from "./chunk/DC1iHEiy.js";
3
+ import pe from "lodash/isArray";
4
+ import j from "lodash/isFunction";
5
+ import { forwardRef as ae, useContext as de, useRef as ut, useState as me, Children as Wt, useCallback as Ft, cloneElement as _t, useImperativeHandle as he, useLayoutEffect as ge, useEffect as F, Fragment as ye } from "react";
6
+ import { createPortal as we } from "react-dom";
7
+ import { a as be } from "./chunk/BJQ5UNa-.js";
8
+ import { m as wt } from "./chunk/JPPo5nY_.js";
9
+ import { isServerRendering as Te, on as bt, off as Tt, getScrollElements as Ce, isScrollElement as xe, contains as Yt } from "./utils/dom.js";
10
+ import { A as De } from "./chunk/CkNSv2U7.js";
11
+ import { o as Xt } from "./chunk/BrOW642m.js";
12
+ import { b as Me } from "./chunk/DNUz6zgo.js";
13
+ import { r as Pe } from "./chunk/D7NyvE5f.js";
14
+ import { D as Ee, g as Se } from "./chunk/BUdtVdnv.js";
15
+ import { l as Ct } from "./chunk/flvYlqx3.js";
16
+ import Kt from "./utils/throttleByRaf.js";
22
17
  import "./chunk/CSC_V_25.js";
23
- import Ct from "lodash/isArray.js";
24
- import J from "lodash/isPlainObject.js";
25
- const Mt = (h) => {
26
- const { getContainer: l, children: t } = h, e = pt();
27
- return (Tt() || e.current === null) && !et && (e.current = l()), ht(() => () => {
28
- const n = e.current;
29
- n && n.parentNode && (n.parentNode.removeChild(n), e.current = null);
30
- }, []), e.current ? wt.createPortal(t, e.current) : null;
31
- }, B = 0, I = (h, l) => {
32
- const { position: t } = l, { width: e, height: i, left: n, right: r, top: u, bottom: y } = h.getBoundingClientRect(), o = l.boundaryDistance || {}, v = "left" in o && o.left || B, g = "top" in o && o.top || B;
33
- let a, c, f, m;
34
- return ["bottom", "bl", "br"].indexOf(t) > -1 ? (f = u, m = y) : (f = u - g, m = y - g), ["right", "rt", "rb"].indexOf(t) > -1 ? (a = n, c = r) : (a = n - v, c = r - v), {
35
- width: e,
36
- height: i,
37
- left: a,
38
- right: c,
39
- top: f,
40
- bottom: m
18
+ import Oe from "lodash/isArray.js";
19
+ import xt from "lodash/isPlainObject.js";
20
+ const ot = 0, at = (u, c) => {
21
+ const { position: l } = c, { width: x, height: g, left: M, right: s, top: V, bottom: L } = u.getBoundingClientRect(), e = c.boundaryDistance || {}, P = "left" in e && e.left || ot, d = "top" in e && e.top || ot;
22
+ let f, p, b, y;
23
+ return ["bottom", "bl", "br"].indexOf(l) > -1 ? (b = V, y = L) : (b = V - d, y = L - d), ["right", "rt", "rb"].indexOf(l) > -1 ? (f = M, p = s) : (f = M - P, p = s - P), {
24
+ width: x,
25
+ height: g,
26
+ left: f,
27
+ right: p,
28
+ top: b,
29
+ bottom: y
41
30
  };
42
31
  };
43
- function vt(h, l, t, e) {
44
- if (!t || !h || et)
32
+ function Ne(u, c, l, x) {
33
+ if (!l || !u || Te)
45
34
  return { left: 0, width: 0, height: 0, top: 0 };
46
- const i = (m) => document.documentElement[m] || document.body[m], n = t === document.body ? i("scrollTop") : t.scrollTop, r = t === document.body ? i("scrollLeft") : t.scrollLeft, { left: u, top: y, width: o, height: v } = l, g = t === document.body ? 0 : I(t, e).left, a = t === document.body ? 0 : I(t, e).top, c = y + n - a;
35
+ const g = (y) => document.documentElement[y] || document.body[y], M = l === document.body ? g("scrollTop") : l.scrollTop, s = l === document.body ? g("scrollLeft") : l.scrollLeft, { left: V, top: L, width: e, height: P } = c, d = l === document.body ? 0 : at(l, x).left, f = l === document.body ? 0 : at(l, x).top, p = L + M - f;
47
36
  return {
48
- left: u + r - g,
49
- top: c,
50
- width: o,
51
- height: v
37
+ left: V + s - d,
38
+ top: p,
39
+ width: e,
40
+ height: P
52
41
  };
53
42
  }
54
- const O = function(h, l, t) {
55
- return t < h ? h : t > l ? l : t;
56
- }, Et = (h, l) => {
57
- let t = 0, e = 0, i = {};
58
- l ? i = {
43
+ const B = function(u, c, l) {
44
+ return l < u ? u : l > c ? c : l;
45
+ }, ve = (u, c) => {
46
+ let l = 0, x = 0, g = {};
47
+ c ? g = {
59
48
  left: 12,
60
49
  right: 12,
61
50
  top: 12,
62
51
  bottom: 12,
63
- ...h
64
- } : i = { ...h };
65
- for (const n in i)
66
- if (Ct(i[n])) {
67
- let r = 0;
68
- ["top", "bottom"].indexOf(n) > -1 ? (r = 1, t = i[n][0]) : e = i[n][1], i[n] = i[n][r];
52
+ ...u
53
+ } : g = { ...u };
54
+ for (const M in g)
55
+ if (Oe(g[M])) {
56
+ let s = 0;
57
+ ["top", "bottom"].indexOf(M) > -1 ? (s = 1, l = g[M][0]) : x = g[M][1], g[M] = g[M][s];
69
58
  }
70
59
  return {
71
- ...i,
72
- horizontalOffset: t,
73
- verticalOffset: e
60
+ ...g,
61
+ horizontalOffset: l,
62
+ verticalOffset: x
74
63
  };
75
- }, Dt = (h, l, { boundaryDistance: t, position: e }) => l ? {
76
- left: l.clientX,
77
- top: l.clientY,
64
+ }, $e = (u, c, { boundaryDistance: l, position: x }) => c ? {
65
+ left: c.clientX,
66
+ top: c.clientY,
78
67
  width: 0,
79
68
  height: 0,
80
- right: l.clientX,
81
- bottom: l.clientY
82
- } : I(h, { boundaryDistance: t, position: e }), Ot = (h) => {
83
- const l = h.offsetWidth, t = h.offsetHeight;
69
+ right: c.clientX,
70
+ bottom: c.clientY
71
+ } : at(u, { boundaryDistance: l, position: x }), He = (u) => {
72
+ const c = u.offsetWidth, l = u.offsetHeight;
84
73
  return {
85
- width: l,
86
- height: t
74
+ width: c,
75
+ height: l
87
76
  };
88
- }, xt = (h) => {
89
- var r, u;
90
- const l = h, t = "left" in l ? l.left : "right" in l ? l.right : B, e = "top" in l ? l.top : "bottom" in l ? l.bottom : B, i = (((r = document.documentElement) == null ? void 0 : r.clientHeight) || window.innerHeight) - (e || B), n = (((u = document.documentElement) == null ? void 0 : u.clientWidth) || window.innerWidth) - (t || B);
77
+ }, Le = (u) => {
78
+ var s, V;
79
+ const c = u || {}, l = "left" in c ? c.left : "right" in c ? c.right : ot, x = "top" in c ? c.top : "bottom" in c ? c.bottom : ot, g = (((s = document.documentElement) == null ? void 0 : s.clientHeight) || window.innerHeight) - (x || ot), M = (((V = document.documentElement) == null ? void 0 : V.clientWidth) || window.innerWidth) - (l || ot);
91
80
  return {
92
- windowHeight: i,
93
- windowWidth: n
81
+ windowHeight: g,
82
+ windowWidth: M
94
83
  };
95
- }, Rt = (h, l, t, e, i) => {
84
+ }, ke = (u, c, l, x, g) => {
96
85
  const {
97
- autoAlignPopupWidth: n,
98
- autoAlignPopupMinWidth: r,
99
- alignPoint: u,
100
- style: y
101
- } = h;
102
- if (!t || !l || !e)
86
+ autoAlignPopupWidth: M,
87
+ autoAlignPopupMinWidth: s,
88
+ alignPoint: V,
89
+ style: L
90
+ } = u;
91
+ if (!l || !c || !x)
103
92
  return {};
104
- const o = {}, v = !h.alignPoint && h.boundaryDistance || {}, g = Dt(t, u && i, {
105
- boundaryDistance: v,
106
- position: h.position
107
- }), { left: a, top: c, width: f, height: m } = vt(
108
- t,
109
- g,
110
- e,
93
+ const e = {}, P = !u.alignPoint && u.boundaryDistance || {}, d = $e(l, V && g, {
94
+ boundaryDistance: P,
95
+ position: u.position
96
+ }), { left: f, top: p, width: b, height: y } = Ne(
97
+ l,
98
+ d,
99
+ x,
111
100
  {
112
- boundaryDistance: v,
113
- position: h.position
101
+ boundaryDistance: P,
102
+ position: u.position
114
103
  }
115
- ), z = Et(h.popupAlign, h.showArrow), V = z.left || 0, H = z.right || 0, k = z.top || 0, F = z.bottom || 0;
116
- n && (y == null ? void 0 : y.width) === void 0 && (l.style.width = `${t.offsetWidth}px`), r && (l.style.minWidth = `${t.offsetWidth}px`);
117
- const p = Ot(l);
118
- let M = h.position;
119
- const T = {}, E = (D) => {
120
- if (!h.autoFitPosition)
104
+ ), _ = ve(u.popupAlign, u.showArrow), q = _.left || 0, G = _.right || 0, k = _.top || 0, J = _.bottom || 0;
105
+ M && (L == null ? void 0 : L.width) === void 0 && (c.style.width = `${l.offsetWidth}px`), s && (c.style.minWidth = `${l.offsetWidth}px`);
106
+ const r = He(c);
107
+ let E = u.position;
108
+ const S = {}, N = (n) => {
109
+ if (!u.autoFitPosition)
121
110
  return;
122
- const { windowHeight: R, windowWidth: S } = xt(v);
123
- let L = !1;
124
- const b = {
125
- left: a - g.left,
126
- top: c - g.top
127
- }, { top: $ = 0, left: P = 0 } = o;
128
- if ((D === "top" || D === "bottom") && (b.left > P && g.right > 12 ? (o.left = Math.max(b.left, a - p.width), o.left = Math.max(
129
- o.left,
130
- a - p.width + 24
131
- )) : P - b.left + p.width > S && S - g.left > 12 && (o.left = Math.max(
132
- b.left,
133
- b.left + S - p.width
134
- ), o.left = Math.max(
135
- o.left,
136
- a - p.width + 24
137
- ))), (D === "left" || D === "right") && (b.top > $ && g.bottom > 12 ? (o.top = b.top, o.top = Math.max(
138
- o.top,
139
- c - p.height + g.height / 2
140
- )) : $ - b.top + p.height > R && R - g.top > 12 && (o.top = Math.max(
141
- b.top,
142
- b.top + R - p.height
143
- ), o.top = Math.max(
144
- o.top,
145
- c - p.height + g.height / 2
146
- ))), D === "top" && b.top > $ && (g.top < R - g.bottom ? (o.top = Math.min(
147
- c + m + (k || 0),
148
- b.top + R - p.height
149
- ), L = !0) : o.top = b.top), D === "bottom" && $ - b.top + p.height > R && (R - g.bottom < g.top ? (o.top = Math.max(
150
- c - p.height - (F || 0),
151
- b.top
152
- ), L = !0) : o.top = b.top + R - p.height), D === "left" && b.left > P && (g.left < S - g.right ? (o.left = Math.min(
153
- f + a + H,
154
- b.left + S - p.width
155
- ), L = !0) : o.left = b.left), D === "right" && P - b.left + p.width > S && (S - g.right < g.left ? (o.left = Math.max(
156
- a - p.width - V,
157
- b.left
158
- ), L = !0) : o.left = b.left + S - p.width), o.left < 0)
159
- o.left = 0;
111
+ const { windowHeight: A, windowWidth: H } = Le(P);
112
+ let R = !1;
113
+ const T = {
114
+ left: f - d.left,
115
+ top: p - d.top
116
+ }, { top: m = 0, left: h = 0 } = e;
117
+ if ((n === "top" || n === "bottom") && (T.left > h && d.right > 12 ? (e.left = Math.max(T.left, f - r.width), e.left = Math.max(
118
+ e.left,
119
+ f - r.width + 24
120
+ )) : h - T.left + r.width > H && H - d.left > 12 && (e.left = Math.max(
121
+ T.left,
122
+ T.left + H - r.width
123
+ ), e.left = Math.max(
124
+ e.left,
125
+ f - r.width + 24
126
+ ))), (n === "left" || n === "right") && (T.top > m && d.bottom > 12 ? (e.top = T.top, e.top = Math.max(
127
+ e.top,
128
+ p - r.height + d.height / 2
129
+ )) : m - T.top + r.height > A && A - d.top > 12 && (e.top = Math.max(
130
+ T.top,
131
+ T.top + A - r.height
132
+ ), e.top = Math.max(
133
+ e.top,
134
+ p - r.height + d.height / 2
135
+ ))), n === "top" && T.top > m && (d.top < A - d.bottom ? (e.top = Math.min(
136
+ p + y + (k || 0),
137
+ T.top + A - r.height
138
+ ), R = !0) : e.top = T.top), n === "bottom" && m - T.top + r.height > A && (A - d.bottom < d.top ? (e.top = Math.max(
139
+ p - r.height - (J || 0),
140
+ T.top
141
+ ), R = !0) : e.top = T.top + A - r.height), n === "left" && T.left > h && (d.left < H - d.right ? (e.left = Math.min(
142
+ b + f + G,
143
+ T.left + H - r.width
144
+ ), R = !0) : e.left = T.left), n === "right" && h - T.left + r.width > H && (H - d.right < d.left ? (e.left = Math.max(
145
+ f - r.width - q,
146
+ T.left
147
+ ), R = !0) : e.left = T.left + H - r.width), e.left < 0)
148
+ e.left = 0;
160
149
  else {
161
- const it = e.scrollWidth - p.width;
162
- o.left = Math.min(it, o.left);
150
+ const nt = x.scrollWidth - r.width;
151
+ e.left = Math.min(nt, e.left);
163
152
  }
164
- return L;
165
- }, d = z.horizontalOffset || 0, x = z.verticalOffset || 0;
166
- let w = a - Number(o.left) + f / 2, C = c - Number(o.top) + m / 2;
167
- switch (h.position) {
153
+ return R;
154
+ }, D = _.horizontalOffset || 0, I = _.verticalOffset || 0;
155
+ let v = f - Number(e.left) + b / 2, $ = p - Number(e.top) + y / 2;
156
+ switch (u.position) {
168
157
  case "top": {
169
- o.top = c - p.height - k, o.left = a + f / 2 - p.width / 2, E("top") && (M = "bottom"), o.left += d, w = a - Number(o.left) + f / 2, T.left = O(12, p.width - 12, w);
158
+ e.top = p - r.height - k, e.left = f + b / 2 - r.width / 2, N("top") && (E = "bottom"), e.left += D, v = f - Number(e.left) + b / 2, S.left = B(12, r.width - 12, v);
170
159
  break;
171
160
  }
172
161
  case "tl":
173
- o.top = c - p.height - k, o.left = a, E("top") && (M = "bl"), o.left += d, w = a - Number(o.left) + Math.min(f / 2, 50), T.left = O(12, p.width - 12, w);
162
+ e.top = p - r.height - k, e.left = f, N("top") && (E = "bl"), e.left += D, v = f - Number(e.left) + Math.min(b / 2, 50), S.left = B(12, r.width - 12, v);
174
163
  break;
175
164
  case "tr":
176
- o.top = -l.clientHeight + c - k, o.left = a + f - p.width, E("top") && (M = "br"), o.left += d, w = a - Number(o.left) + Math.max(f / 2, f - 50), T.left = O(12, p.width - 12, w);
165
+ e.top = -c.clientHeight + p - k, e.left = f + b - r.width, N("top") && (E = "br"), e.left += D, v = f - Number(e.left) + Math.max(b / 2, b - 50), S.left = B(12, r.width - 12, v);
177
166
  break;
178
167
  case "bottom": {
179
- o.top = m + c + F, o.left = a + f / 2 - p.width / 2, E("bottom") && (M = "top"), o.left += d, w = a - Number(o.left) + f / 2, T.left = O(12, p.width - 12, w);
168
+ e.top = y + p + J, e.left = f + b / 2 - r.width / 2, N("bottom") && (E = "top"), e.left += D, v = f - Number(e.left) + b / 2, S.left = B(12, r.width - 12, v);
180
169
  break;
181
170
  }
182
171
  case "bl":
183
- o.top = m + c + F, o.left = a, E("bottom") && (M = "tl"), o.left += d, w = a - Number(o.left) + Math.min(f / 2, 50), T.left = O(12, p.width - 12, w);
172
+ e.top = y + p + J, e.left = f, N("bottom") && (E = "tl"), e.left += D, v = f - Number(e.left) + Math.min(b / 2, 50), S.left = B(12, r.width - 12, v);
184
173
  break;
185
174
  case "br":
186
- o.top = m + c + F, o.left = a + f - p.width, E("bottom") && (M = "tr"), o.left += d, w = a - Number(o.left) + Math.max(f / 2, f - 50), T.left = O(12, p.width - 12, w);
175
+ e.top = y + p + J, e.left = f + b - r.width, N("bottom") && (E = "tr"), e.left += D, v = f - Number(e.left) + Math.max(b / 2, b - 50), S.left = B(12, r.width - 12, v);
187
176
  break;
188
177
  case "left": {
189
- o.top = c + m / 2 - p.height / 2, o.left = a - p.width - V, E("left") && (M = "right"), o.top += x, C = c - Number(o.top) + m / 2, T.top = O(12, p.height - 12, C);
178
+ e.top = p + y / 2 - r.height / 2, e.left = f - r.width - q, N("left") && (E = "right"), e.top += I, $ = p - Number(e.top) + y / 2, S.top = B(12, r.height - 12, $);
190
179
  break;
191
180
  }
192
181
  case "lt":
193
- o.top = c, o.left = a - p.width - V, E("left") && (M = "rt"), o.top += x, C = c - Number(o.top) + Math.min(m / 2, 50), T.top = O(12, p.height - 12, C);
182
+ e.top = p, e.left = f - r.width - q, N("left") && (E = "rt"), e.top += I, $ = p - Number(e.top) + Math.min(y / 2, 50), S.top = B(12, r.height - 12, $);
194
183
  break;
195
184
  case "lb":
196
- o.top = c + m - p.height, o.left = a - p.width - V, E("left") && (M = "rb"), o.top += x, C = c - Number(o.top) + Math.max(m / 2, m - 50), T.top = O(12, p.height - 12, C);
185
+ e.top = p + y - r.height, e.left = f - r.width - q, N("left") && (E = "rb"), e.top += I, $ = p - Number(e.top) + Math.max(y / 2, y - 50), S.top = B(12, r.height - 12, $);
197
186
  break;
198
187
  case "right": {
199
- o.top = c + m / 2 - p.height / 2, o.left = f + a + H, E("right") && (M = "left"), o.top += x, C = c - Number(o.top) + m / 2, T.top = O(12, p.height - 12, C);
188
+ e.top = p + y / 2 - r.height / 2, e.left = b + f + G, N("right") && (E = "left"), e.top += I, $ = p - Number(e.top) + y / 2, S.top = B(12, r.height - 12, $);
200
189
  break;
201
190
  }
202
191
  case "rt":
203
- o.top = c, o.left = f + a + H, E("right") && (M = "lt"), o.top += x, C = c - Number(o.top) + Math.min(m / 2, 50), T.top = O(12, p.height - 12, C);
192
+ e.top = p, e.left = b + f + G, N("right") && (E = "lt"), e.top += I, $ = p - Number(e.top) + Math.min(y / 2, 50), S.top = B(12, r.height - 12, $);
204
193
  break;
205
194
  case "rb":
206
- o.top = c + m - p.height, o.left = f + a + H, E("right") && (M = "lb"), o.top += x, C = c - Number(o.top) + Math.max(m / 2, m - 50), T.top = O(12, p.height - 12, C);
195
+ e.top = p + y - r.height, e.left = b + f + G, N("right") && (E = "lb"), e.top += I, $ = p - Number(e.top) + Math.max(y / 2, y - 50), S.top = B(12, r.height - 12, $);
207
196
  break;
208
197
  }
209
198
  return {
210
- style: o,
211
- arrowStyle: T,
212
- realPosition: M
199
+ style: e,
200
+ arrowStyle: S,
201
+ realPosition: E
213
202
  };
214
203
  };
215
- function Z(h, l) {
216
- if (!h)
204
+ function Ie(u, c) {
205
+ if (!u)
217
206
  return {};
218
- const { width: t, height: e, left: i, right: n } = I(h, l);
207
+ const { width: l, height: x, left: g, right: M } = at(u, c);
219
208
  return {
220
- width: t,
221
- height: e,
222
- left: i,
223
- right: n
209
+ width: l,
210
+ height: x,
211
+ left: g,
212
+ right: M
224
213
  };
225
214
  }
226
- const te = [
215
+ const ro = [
227
216
  "onClick",
228
217
  "onMouseEnter",
229
218
  "onMouseLeave",
@@ -233,13 +222,13 @@ const te = [
233
222
  "onContextMenu",
234
223
  "onKeyDown"
235
224
  ];
236
- function St(h, l) {
237
- const t = {}, e = { ...h };
238
- return l.forEach((i) => {
239
- h && i in h && (t[i] = h[i], delete e[i]);
240
- }), { picked: t, omitted: e };
225
+ function Ve(u, c) {
226
+ const l = {}, x = { ...u };
227
+ return c.forEach((g) => {
228
+ u && g in u && (l[g] = u[g], delete x[g]);
229
+ }), { picked: l, omitted: x };
241
230
  }
242
- const zt = {
231
+ const Ae = {
243
232
  blurToHide: !0,
244
233
  // clickToClose: true,
245
234
  classNames: "fadeIn",
@@ -257,628 +246,566 @@ const zt = {
257
246
  autoFixPosition: !0,
258
247
  mouseEnterDelay: 100,
259
248
  mouseLeaveDelay: 100,
260
- autoFitPosition: !0
249
+ autoFitPosition: !0,
250
+ updateOnScroll: !0
261
251
  };
262
- class tt extends ut {
263
- constructor(t, e) {
264
- super(t, e);
265
- s(this, "context");
266
- s(this, "popupContainer");
267
- s(this, "rootElementRef");
268
- s(this, "triggerRef", q());
252
+ function Be(u, c) {
253
+ var Vt, At;
254
+ const l = de(be), { getPrefixCls: x, zIndex: g, rtl: M } = l, s = C(u), {
255
+ children: V,
256
+ style: L,
257
+ className: e,
258
+ arrowProps: P,
259
+ disabled: d,
260
+ popup: f,
261
+ classNames: p,
262
+ duration: b,
263
+ unmountOnExit: y,
264
+ alignPoint: _,
265
+ autoAlignPopupWidth: q,
266
+ position: G,
267
+ childrenPrefix: k,
268
+ showArrow: J,
269
+ popupStyle: r,
270
+ __onExit: E,
271
+ __onExited: S
272
+ } = s;
273
+ if (!f)
274
+ return null;
275
+ const N = V || V === 0, D = ut(null), I = ut(null), v = ut(null), $ = ut(null), n = ut({
276
+ rootElement: void 0,
277
+ triggerDestoried: !1,
269
278
  // 标志 popup 是否被销毁
270
- s(this, "triggerRefDestoried");
271
- s(this, "delayTimer", null);
272
- s(this, "updatePositionTimer", null);
279
+ realPosition: null,
273
280
  // popup 真正出现的位置
274
- s(this, "realPosition");
281
+ arrowStyle: null,
275
282
  // arrow 箭头的位置
276
- s(this, "arrowStyle");
277
- // is popup open?
278
- s(this, "popupOpen", !1);
283
+ mousedownToHide: !1,
279
284
  // if mousedown to hide popup, ignore onFocus
280
- s(this, "mousedownToHide", !1);
281
- s(this, "mouseDownTimeout");
282
- s(this, "hasPopupMouseDown", !1);
283
- // handle click outside document
284
- s(this, "handleClickOutside");
285
- // 是否监听了window 的resize
286
- s(this, "handleWindowResize");
287
- s(this, "unmount", !1);
288
- s(this, "isDidMount", !1);
289
- // 保存鼠标的位置
290
- s(this, "mouseLocation", {
285
+ hasPopupMouseDown: !1,
286
+ mouseLocation: {
291
287
  clientX: 0,
292
288
  clientY: 0
293
- });
294
- // 保存当前的mount container dom元素
295
- s(this, "observerContainer", null);
296
- // 保存当前节点到 popupContainer 间的所有滚动元素
297
- s(this, "scrollElements", null);
298
- // container 触发 resize时执行
299
- s(this, "resizeObserver", new ResizeObserver(() => {
300
- window.requestAnimationFrame(this.handleUpdatePosition);
301
- }));
302
- s(this, "resizeObserver2", new ResizeObserver(() => {
303
- window.requestAnimationFrame(() => {
304
- const t = this.triggerRef.current;
305
- if (t) {
306
- const e = this.getPopupStyle(), i = this.props.style || {};
307
- t.style.top = String(i.top || `${e.top}px`), t.style.left = String(i.left || `${e.left}px`);
308
- }
309
- this.onResize();
310
- });
311
- }));
312
- s(this, "onResizeObserver2", () => {
313
- var e, i;
314
- this.offResizeObserver2();
315
- const t = this.getPopupElement();
316
- t && ((i = (e = this.resizeObserver2) == null ? void 0 : e.observe) == null || i.call(e, t));
317
- });
318
- s(this, "offResizeObserver2", () => {
319
- var e, i;
320
- const t = this.getPopupElement();
321
- t && ((i = (e = this.resizeObserver2) == null ? void 0 : e.unobserve) == null || i.call(e, t));
322
- });
323
- s(this, "resizeObserver3", new ResizeObserver(() => {
324
- window.requestAnimationFrame(this.onResize);
325
- }));
326
- s(this, "onResizeObserver3", () => {
327
- var e, i;
328
- this.offResizeObserver3();
329
- const t = this.getRootElement();
330
- t && ((i = (e = this.resizeObserver3) == null ? void 0 : e.observe) == null || i.call(e, t));
331
- });
332
- s(this, "offResizeObserver3", () => {
333
- var e, i;
334
- const t = this.getRootElement();
335
- t && ((i = (e = this.resizeObserver3) == null ? void 0 : e.unobserve) == null || i.call(e, t));
336
- });
337
- s(this, "childrenDom", null);
338
- // 保存children节点的尺寸。 主要用于在弹出层动画前和动画完成后比较尺寸是否有变化。
339
- s(this, "childrenDomSize", {});
340
- s(this, "getMergedProps", (t) => {
341
- const { componentConfig: e } = this.context ?? {};
342
- return gt(
343
- t && J(t) ? t : this.props,
344
- zt,
345
- e == null ? void 0 : e.Trigger,
346
- t && rt(t) ? t : void 0
347
- );
348
- });
349
- s(this, "getRootElement", () => {
350
- var t, e;
351
- return this.childrenDom = bt(
352
- ((e = (t = this.props).getTargetDOMNode) == null ? void 0 : e.call(t)) || this.rootElementRef,
353
- this
354
- ), this.childrenDom;
355
- });
356
- s(this, "getPopupElement", () => this.triggerRef.current || null);
357
- s(this, "offScrollListeners", () => {
358
- (this.scrollElements || []).forEach((t) => {
359
- Y(t, "scroll", this.handleScroll);
360
- }), this.scrollElements = null;
361
- });
362
- s(this, "offWindowResize", () => {
363
- this.handleWindowResize = !1, Y(window, "resize", this.handleUpdatePosition);
364
- });
365
- s(this, "offContainerResize", () => {
366
- this.resizeObserver && this.observerContainer && (this.resizeObserver.unobserve(this.observerContainer), this.observerContainer = null);
367
- });
368
- s(this, "handleScroll", () => {
369
- const t = this.getMergedProps([
370
- "containerScrollToClose",
371
- "updateOnScroll"
372
- ]);
373
- t.containerScrollToClose ? this.setPopupVisible(!1) : t.updateOnScroll && this.handleUpdatePosition();
374
- });
375
- s(this, "onContainersScroll", (t) => {
376
- var e, i;
377
- this.scrollElements || (this.scrollElements = ct(
378
- this.childrenDom,
379
- (e = this.popupContainer) == null ? void 0 : e.parentNode
380
- ), t.containerScrollToClose && ((i = this.popupContainer) == null ? void 0 : i.parentNode) === document.body && this.scrollElements.indexOf(document.body) === -1 && ft(document.documentElement) && this.scrollElements.push(window), this.scrollElements.forEach((n) => {
381
- U(n, "scroll", this.handleScroll);
382
- }));
383
- });
384
- s(this, "onContainerResize", () => {
385
- var e;
386
- const t = (e = this.popupContainer) == null ? void 0 : e.parentNode;
387
- this.resizeObserver && this.observerContainer !== t && (this.offContainerResize(), t && this.resizeObserver.observe(t), this.observerContainer = t);
388
- });
389
- // getPopupContainer 改变时候触发
390
- s(this, "handleUpdatePosition", j(() => {
391
- this.updatePopupPosition();
392
- }));
393
- s(this, "isClickTrigger", () => {
394
- const { trigger: t } = this.getMergedProps(["trigger"]);
395
- return [].concat(t).indexOf("click") > -1;
396
- });
397
- s(this, "isFocusTrigger", () => {
398
- const { trigger: t } = this.getMergedProps(["trigger"]);
399
- return [].concat(t).indexOf("focus") > -1;
400
- });
401
- s(this, "isHoverTrigger", () => {
402
- const { trigger: t } = this.getMergedProps(["trigger"]);
403
- return [].concat(t).indexOf("hover") > -1;
404
- });
405
- s(this, "isContextMenuTrigger", () => {
406
- const { trigger: t } = this.getMergedProps(["trigger"]);
407
- return [].concat(t).indexOf("contextMenu") > -1;
408
- });
409
- // 是否在鼠标移出触发节点和popup的时候隐藏弹出层
410
- s(this, "isMouseLeaveToClose", () => this.isHoverTrigger() && this.getMergedProps(["mouseLeaveToClose"]).mouseLeaveToClose);
411
- // 是否在悬浮到popup的时候隐藏弹出层
412
- s(this, "isPopupHoverHide", () => this.isHoverTrigger() && !this.getMergedProps(["popupHoverStay"]).popupHoverStay);
413
- s(this, "isClickToHide", () => {
414
- if (this.isClickTrigger() || this.isContextMenuTrigger()) {
415
- const { clickToClose: t = !0 } = this.getMergedProps(["clickToClose"]);
416
- return t;
417
- }
418
- return this.isHoverTrigger() && this.props.clickToClose;
419
- });
420
- s(this, "isBlurToHide", () => this.isFocusTrigger() && this.getMergedProps(["blurToHide"]).blurToHide);
421
- s(this, "clearTimer", () => {
422
- this.updatePositionTimer && (this.updatePositionTimer.cancel ? this.updatePositionTimer.cancel() : (clearTimeout(this.updatePositionTimer), this.updatePositionTimer = null)), this.delayTimer && (clearTimeout(this.delayTimer), this.delayTimer = null), this.mouseDownTimeout && (clearTimeout(this.mouseDownTimeout), this.mouseDownTimeout = null);
423
- });
424
- s(this, "offClickOutside", () => {
425
- if (this.handleClickOutside) {
426
- const { getDocument: t } = this.getMergedProps(["getDocument"]), e = W(t) && t();
427
- Y(e, "mousedown", this.onClickOutside), this.handleClickOutside = !1;
428
- }
429
- });
430
- s(this, "getTransformOrigin", (t) => {
431
- var o, v;
432
- const e = this.getPopupElement();
433
- if (!e) return {};
434
- const { showArrow: i, classNames: n } = this.getMergedProps([
435
- "showArrow",
436
- "classNames"
437
- ]);
438
- let r = i && ((o = this.arrowStyle) == null ? void 0 : o.top) || 0, u = i && ((v = this.arrowStyle) == null ? void 0 : v.left) || 0;
439
- r = r ? `${r}px` : "", u = u ? `${u}px` : "";
440
- const y = {
441
- top: `${u || "50%"} 100% 0`,
442
- tl: `${u || "15px"} 100% 0`,
443
- tr: `${u || `${e.clientWidth - 15}px`} 100% 0`,
444
- bottom: `${u || "50%"} 0 0`,
445
- bl: `${u || "15px"} 0 0`,
446
- br: `${u || `${e.clientWidth - 15}px`} 0 0`,
447
- left: `100% ${r || "50%"} 0`,
448
- lt: `100% ${r || "15px"} 0`,
449
- lb: `100% ${r || `${e.clientHeight - 15}px`} 0`,
450
- right: `0 ${r || "50%"} 0`,
451
- rt: `0 ${r || "15px"} 0`,
452
- rb: `0 ${r || `${e.clientHeight - 15}px`} 0`
453
- };
454
- if (n && n.indexOf("zoom") > -1)
455
- return {
456
- transformOrigin: y[t]
457
- };
458
- if (n === "slideDynamicOrigin") {
459
- let g = "0% 0%";
460
- return ["top", "tl", "tr"].indexOf(t) > -1 && (g = "100% 100%"), {
461
- transformOrigin: g
462
- };
463
- }
289
+ },
290
+ // 保存鼠标的位置
291
+ childrenDomSize: {},
292
+ scrollElements: null,
293
+ // 保存当前节点到弹出容器间的所有滚动元素
294
+ delayTimeoutID: -1,
295
+ updatePositionTimeoutID: -1
296
+ }), [A, H] = me({ popupVisible: !1, popupStyle: {} }), R = s.popupVisible, T = A.popupVisible, m = R ?? T, h = {}, nt = {
297
+ onMouseDown() {
298
+ n.current.hasPopupMouseDown = !0, setTimeout(() => {
299
+ n.current.hasPopupMouseDown = !1;
300
+ }, 0);
301
+ }
302
+ };
303
+ st() && !d ? (h.onMouseEnter = Zt, h.onMouseLeave = vt, ht() && (h.onClick = $t), _ && (h.onMouseMove = te), jt() || (nt.onMouseEnter = ee, nt.onMouseLeave = oe)) : (h.onMouseEnter = Q("onMouseEnter"), h.onMouseLeave = Q("onMouseLeave")), Mt() && !d ? (h.onContextMenu = ne, h.onClick = $t) : h.onContextMenu = Q("onContextMenu"), Dt() && !d ? h.onClick = ie : h.onClick = h.onClick || Q("onClick"), mt() && !d ? (h.onFocus = re, Pt() && (h.onBlur = se)) : (h.onFocus = Q("onFocus"), h.onBlur = Q("onBlur")), d ? h.onKeyDown = Q("onKeyDown") : h.onKeyDown = Gt;
304
+ const it = ft(), rt = Wt.only(f());
305
+ it.props.className && (h.className = it.props.className), k && m && (h.className = h.className ? `${h.className} ${k}-open` : `${k}-open`), mt() && (h.tabIndex = d ? -1 : 0);
306
+ const Z = x("trigger"), Qt = wt(
307
+ Z,
308
+ k,
309
+ `${Z}-position-${G}`,
310
+ { [`${Z}-rtl`]: M },
311
+ e
312
+ );
313
+ function C(t) {
314
+ const { componentConfig: o } = l ?? {};
315
+ return Me(
316
+ xt(t) ? t : u,
317
+ Ae,
318
+ (o == null ? void 0 : o.Trigger) ?? {},
319
+ pe(t) ? t : void 0
320
+ );
321
+ }
322
+ function tt() {
323
+ var o, i;
324
+ const t = Se(
325
+ ((o = s.getTargetDOMNode) == null ? void 0 : o.call(s)) || ((i = s.getRootElement) == null ? void 0 : i.call(s)) || n.current.child
326
+ );
327
+ return n.current.rootElement = t, t;
328
+ }
329
+ const dt = Ft(
330
+ Kt(() => {
331
+ et();
332
+ }),
333
+ [m]
334
+ );
335
+ function Dt() {
336
+ const { trigger: t } = C(["trigger"]);
337
+ return [].concat(t).indexOf("click") > -1;
338
+ }
339
+ function mt() {
340
+ const { trigger: t } = C(["trigger"]);
341
+ return [].concat(t).indexOf("focus") > -1;
342
+ }
343
+ function st() {
344
+ const { trigger: t } = C(["trigger"]);
345
+ return [].concat(t).indexOf("hover") > -1;
346
+ }
347
+ function Mt() {
348
+ const { trigger: t } = C(["trigger"]);
349
+ return [].concat(t).indexOf("contextMenu") > -1;
350
+ }
351
+ function Ut() {
352
+ return st() && C(["mouseLeaveToClose"]).mouseLeaveToClose;
353
+ }
354
+ function jt() {
355
+ return st() && !C(["popupHoverStay"]).popupHoverStay;
356
+ }
357
+ function ht() {
358
+ if (Dt() || Mt()) {
359
+ const { clickToClose: t = !0 } = C(["clickToClose"]);
360
+ return t;
361
+ }
362
+ return st() && s.clickToClose;
363
+ }
364
+ function Pt() {
365
+ return mt() && C(["blurToHide"]).blurToHide;
366
+ }
367
+ function qt() {
368
+ n.current.updatePositionTimeoutID && (n.current.updatePositionTimeoutID.cancel ? n.current.updatePositionTimeoutID.cancel() : (clearTimeout(n.current.updatePositionTimeoutID), n.current.updatePositionTimeoutID = null)), K();
369
+ }
370
+ function Et(t) {
371
+ var lt, Bt;
372
+ const o = D.current;
373
+ if (!o)
464
374
  return {};
465
- });
466
- // 下拉框存在初始translateY/translateX,需要根据真实的弹出位置确定
467
- s(this, "getTransformTranslate", () => {
468
- if (this.getMergedProps(["classNames"]).classNames !== "slideDynamicOrigin")
375
+ const { showArrow: i, classNames: a } = C([
376
+ "showArrow",
377
+ "classNames"
378
+ ]);
379
+ let w = i && ((lt = n.current.arrowStyle) == null ? void 0 : lt.top) || 0, O = i && ((Bt = n.current.arrowStyle) == null ? void 0 : Bt.left) || 0;
380
+ w = w ? `${w}px` : "", O = O ? `${O}px` : "";
381
+ const U = {
382
+ top: `${O || "50%"} 100% 0`,
383
+ tl: `${O || "15px"} 100% 0`,
384
+ tr: `${O || `${o.clientWidth - 15}px`} 100% 0`,
385
+ bottom: `${O || "50%"} 0 0`,
386
+ bl: `${O || "15px"} 0 0`,
387
+ br: `${O || `${o.clientWidth - 15}px`} 0 0`,
388
+ left: `100% ${w || "50%"} 0`,
389
+ lt: `100% ${w || "15px"} 0`,
390
+ lb: `100% ${w || `${o.clientHeight - 15}px`} 0`,
391
+ right: `0 ${w || "50%"} 0`,
392
+ rt: `0 ${w || "15px"} 0`,
393
+ rb: `0 ${w || `${o.clientHeight - 15}px`} 0`
394
+ };
395
+ if (a && a.indexOf("zoom") > -1)
396
+ return {
397
+ transformOrigin: U[t]
398
+ };
399
+ if (a === "slideDynamicOrigin") {
400
+ let zt = "0% 0%";
401
+ return ["top", "tl", "tr"].indexOf(t) > -1 && (zt = "100% 100%"), {
402
+ transformOrigin: zt
403
+ };
404
+ }
405
+ return {};
406
+ }
407
+ function St() {
408
+ if (C(["classNames"]).classNames !== "slideDynamicOrigin")
409
+ return "";
410
+ switch (n.current.realPosition) {
411
+ case "bottom":
412
+ case "bl":
413
+ case "br":
414
+ return "scaleY(0.9) translateY(-4px)";
415
+ case "top":
416
+ case "tl":
417
+ case "tr":
418
+ return "scaleY(0.9) translateY(4px)";
419
+ default:
469
420
  return "";
470
- switch (this.realPosition) {
471
- case "bottom":
472
- case "bl":
473
- case "br":
474
- return "scaleY(0.9) translateY(-4px)";
475
- case "top":
476
- case "tl":
477
- case "tr":
478
- return "scaleY(0.9) translateY(4px)";
479
- default:
480
- return "";
481
- }
482
- });
483
- s(this, "getPopupStyle", () => {
484
- if (this.unmount || !this.popupContainer)
421
+ }
422
+ }
423
+ function gt() {
424
+ var lt;
425
+ if (!I.current)
426
+ return {};
427
+ const t = D.current, o = tt();
428
+ if (!(o != null && o.offsetParent) && !((lt = o == null ? void 0 : o.getClientRects()) != null && lt.length))
429
+ return A.popupStyle;
430
+ const { style: i, arrowStyle: a, realPosition: w } = ke(
431
+ s,
432
+ t,
433
+ o,
434
+ I.current,
435
+ n.current.mouseLocation
436
+ );
437
+ n.current.arrowStyle = a || {};
438
+ const O = w || s.position;
439
+ return n.current.realPosition = O, {
440
+ ...i,
441
+ ...Et(O)
442
+ };
443
+ }
444
+ function Y(t) {
445
+ const o = gt();
446
+ H((i) => {
447
+ const a = { ...i };
448
+ return a.popupStyle = o, a;
449
+ }), j(t) && setTimeout(() => {
450
+ t();
451
+ }, 0);
452
+ }
453
+ const ct = Ft(Kt(Y), [
454
+ m
455
+ ]);
456
+ function et(t = 0, o) {
457
+ if (m) {
458
+ if (t < 4) {
459
+ n.current.updatePositionTimeoutID = ct(o);
485
460
  return;
486
- const t = this.popupContainer, e = this.triggerRef.current, i = this.getRootElement();
487
- if (!i.offsetParent && !i.getClientRects().length)
488
- return this.state.popupStyle;
489
- const n = this.getMergedProps(), { style: r, arrowStyle: u, realPosition: y } = Rt(
490
- n,
491
- e,
492
- i,
493
- t,
494
- this.mouseLocation
495
- );
496
- return this.realPosition = y || n.position, this.arrowStyle = u || {}, {
497
- ...r,
498
- ...this.getTransformOrigin(this.realPosition)
499
- };
500
- });
501
- s(this, "showPopup", (t = () => {
502
- }) => {
503
- const e = this.getPopupStyle();
504
- this.setState(
505
- {
506
- popupStyle: e
507
- },
508
- t
509
- );
461
+ }
462
+ n.current.updatePositionTimeoutID = setTimeout(() => {
463
+ const i = gt();
464
+ H((a) => {
465
+ const w = { ...a };
466
+ return w.popupStyle = i, w;
467
+ }), j(o) && setTimeout(() => {
468
+ o();
469
+ }, 0);
470
+ }, t);
471
+ }
472
+ }
473
+ function z(t, o = 0, i) {
474
+ const a = C(["onVisibleChange", "popupVisible"]);
475
+ t !== m ? Ot(o, () => {
476
+ var w;
477
+ (w = a.onVisibleChange) == null || w.call(a, t), "popupVisible" in a ? i == null || i() : (H((O) => {
478
+ const U = { ...O };
479
+ return U.popupVisible = !!t, U;
480
+ }), setTimeout(t ? () => {
481
+ Y(i);
482
+ } : () => {
483
+ i == null || i();
484
+ }, 0));
485
+ }) : i == null || i();
486
+ }
487
+ function Ot(t, o) {
488
+ t ? (K(), n.current.delayTimeoutID = setTimeout(() => {
489
+ o(), K();
490
+ }, t)) : o();
491
+ }
492
+ function K() {
493
+ n.current.delayTimeoutID && (clearTimeout(n.current.delayTimeoutID), n.current.delayTimeoutID = null);
494
+ }
495
+ function Nt(t) {
496
+ var a;
497
+ const o = C(["onClickOutside", "clickOutsideToClose"]);
498
+ let i = Yt(D.current, t.target);
499
+ i || (i = Yt(tt(), t.target)), i || (i = !!n.current.hasPopupMouseDown), i || ((a = o.onClickOutside) == null || a.call(o), o.clickOutsideToClose && (Pt() || st() || z(!1)));
500
+ }
501
+ function Gt(t) {
502
+ const o = t.key;
503
+ W("onKeyDown", t), o === Xt.key && Jt(t);
504
+ }
505
+ function Jt(t) {
506
+ const { escToClose: o } = C(["escToClose"]);
507
+ o && t && t.key === Xt.key && m && z(!1);
508
+ }
509
+ function Zt(t) {
510
+ const { mouseEnterDelay: o } = C(["mouseEnterDelay"]);
511
+ W("onMouseEnter", t), K(), z(!0, o || 0);
512
+ }
513
+ function te(t) {
514
+ W("onMouseMove", t), yt(t), m && ct();
515
+ }
516
+ function vt(t) {
517
+ const { mouseLeaveDelay: o } = C(["mouseLeaveDelay"]);
518
+ K(), W("onMouseLeave", t), Ut() && m && z(!1, o || 0);
519
+ }
520
+ function ee() {
521
+ K();
522
+ }
523
+ function oe(t) {
524
+ vt(t);
525
+ }
526
+ function yt(t) {
527
+ C(["alignPoint"]).alignPoint && (n.current.mouseLocation = {
528
+ clientX: t.clientX,
529
+ clientY: t.clientY
510
530
  });
511
- s(this, "update", j((t) => {
512
- if (this.unmount || !this.state.popupVisible)
513
- return;
514
- const e = this.getPopupStyle();
515
- this.setState(
531
+ }
532
+ function ne(t) {
533
+ t.preventDefault(), W("onContextMenu", t), yt(t), m ? C(["alignPoint"]).alignPoint && ct() : z(!0, 0);
534
+ }
535
+ function $t(t) {
536
+ m && (n.current.mousedownToHide = !0), W("onClick", t), ht() && m && z(!m, 0);
537
+ }
538
+ function ie(t) {
539
+ m && (n.current.mousedownToHide = !0), W("onClick", t), yt(t), !(!ht() && m) && z(!m, 0);
540
+ }
541
+ function re(t) {
542
+ const { focusDelay: o } = C(["focusDelay"]), i = () => {
543
+ W("onFocus", t);
544
+ };
545
+ K(), n.current.mousedownToHide || (m ? i == null || i() : z(!0, o || 0, i)), n.current.mousedownToHide = !1;
546
+ }
547
+ function se(t) {
548
+ z(!1, 200, () => W("onBlur", t));
549
+ }
550
+ function Ht() {
551
+ m && C(["autoFixPosition"]).autoFixPosition && et();
552
+ }
553
+ function ft() {
554
+ var w;
555
+ const { children: t } = s, o = t, i = o && typeof o != "string" && o.type;
556
+ let a = t;
557
+ if (["string", "number"].indexOf(typeof t) > -1 || Wt.count(t) > 1)
558
+ a = /* @__PURE__ */ X("span", { children: t });
559
+ else if (o && i && (i.__PQB_BUTTON === !0 || i.__PQB_CHECKBOX === !0 || i.__PQB_SWITCH === !0 || i.__PQB_RADIO === !0 || i === "button") && o.props.disabled) {
560
+ const { picked: O, omitted: U } = Ve(o.props.style, [
561
+ "position",
562
+ "left",
563
+ "right",
564
+ "top",
565
+ "bottom",
566
+ "float",
567
+ "display",
568
+ "zIndex"
569
+ ]);
570
+ a = /* @__PURE__ */ X(
571
+ "span",
516
572
  {
517
- popupStyle: e
518
- },
519
- () => {
520
- t == null || t();
573
+ className: (w = o.props) == null ? void 0 : w.className,
574
+ style: { display: "inline-block", ...O, cursor: "not-allowed" },
575
+ children: _t(o, {
576
+ style: {
577
+ ...U,
578
+ pointerEvents: "none"
579
+ },
580
+ className: void 0
581
+ })
521
582
  }
522
583
  );
523
- }));
524
- s(this, "getRootDOMNode", () => this.getRootElement());
525
- s(this, "updatePopupPosition", (t = 0, e) => {
526
- if (this.state.popupVisible) {
527
- if (t < 4) {
528
- this.updatePositionTimer = this.update(e);
529
- return;
530
- }
531
- this.updatePositionTimer = setTimeout(() => {
532
- const n = this.getPopupStyle();
533
- this.setState(
534
- {
535
- popupStyle: n
536
- },
537
- () => {
538
- e == null || e();
539
- }
540
- );
541
- }, t);
542
- }
543
- });
544
- s(this, "setPopupVisible", (t, e = 0, i) => {
545
- const n = this.getMergedProps([
546
- "onVisibleChange",
547
- "popupVisible"
548
- ]), { onVisibleChange: r } = n, u = this.state.popupVisible;
549
- t !== u ? this.delayToDo(e, () => {
550
- r == null || r(t), "popupVisible" in n ? i == null || i() : t ? this.setState(
551
- {
552
- popupVisible: !0
553
- },
554
- () => {
555
- this.showPopup(i);
556
- }
557
- ) : this.setState(
558
- {
559
- popupVisible: !1
584
+ }
585
+ return a || /* @__PURE__ */ X("span", {});
586
+ }
587
+ function W(t, o) {
588
+ const i = ft(), a = i && i.props && i.props[t], w = C([t])[t];
589
+ j(a) && a(o), j(w) && w(o);
590
+ }
591
+ function Q(t) {
592
+ const o = ft(), i = o && o.props && o.props[t], a = C([t])[t];
593
+ return j(a) && j(i) ? (w) => {
594
+ i(w), a(w);
595
+ } : i || a;
596
+ }
597
+ function Lt() {
598
+ const t = C(["containerScrollToClose", "updateOnScroll"]);
599
+ t.containerScrollToClose ? z(!1) : t.updateOnScroll && et();
600
+ }
601
+ function le() {
602
+ var t;
603
+ n.current.scrollElements || (n.current.scrollElements = Ce(
604
+ tt()
605
+ // refPopupContainer.current.parentNode as HTMLElement,
606
+ ), Array.isArray(n.current.scrollElements) && (s.containerScrollToClose && ((t = I.current) == null ? void 0 : t.parentNode) === document.body && n.current.scrollElements.indexOf(document.body) === -1 && xe(document.documentElement) && n.current.scrollElements.push(window), n.current.scrollElements.forEach((o) => {
607
+ bt(o, "scroll", Lt);
608
+ })));
609
+ }
610
+ function kt() {
611
+ n.current.scrollElements && (n.current.scrollElements.forEach((t) => {
612
+ Tt(t, "scroll", Lt);
613
+ }), n.current.scrollElements = null);
614
+ }
615
+ he(c, () => ({
616
+ getRootDOMNode: tt,
617
+ getRootElement: tt,
618
+ getPopupElement() {
619
+ return D.current;
620
+ },
621
+ getChild: ft,
622
+ getPopupStyle: gt,
623
+ getTransformTranslate: St,
624
+ getTransformOrigin: Et,
625
+ updateThrottleByRaf: ct,
626
+ update: Y,
627
+ updatePopupStyle: Y,
628
+ updatePopupPosition: et,
629
+ handleUpdatePosition: dt,
630
+ setPopupVisible: z,
631
+ delayToDo: Ot
632
+ })), ge(() => (Y(), () => {
633
+ }), [
634
+ D.current,
635
+ v.current,
636
+ $.current,
637
+ n.current.rootElement
638
+ ]), F(() => {
639
+ var i;
640
+ const t = (i = I.current) == null ? void 0 : i.parentNode, o = Ct([t], et);
641
+ return () => {
642
+ o();
643
+ };
644
+ }, [(Vt = I.current) == null ? void 0 : Vt.parentNode]), F(() => {
645
+ const t = D.current, o = Ct([t], Ht);
646
+ return () => {
647
+ o();
648
+ };
649
+ }, [D.current]), F(() => {
650
+ const t = n.current.rootElement, o = Ct([t], Ht);
651
+ return () => {
652
+ o();
653
+ };
654
+ }, [n.current.rootElement]), F(() => {
655
+ const t = n.current.rootElement;
656
+ return m && (n.current.childrenDomSize = Ie(t, {
657
+ boundaryDistance: s.alignPoint ? void 0 : s.boundaryDistance,
658
+ position: s.position
659
+ })), () => {
660
+ };
661
+ }, [
662
+ n.current.rootElement,
663
+ s.alignPoint,
664
+ s.boundaryDistance,
665
+ s.position
666
+ ]), F(() => (m && (s.updateOnScroll || s.containerScrollToClose ? le() : (et(), kt())), () => {
667
+ kt();
668
+ }), [
669
+ m,
670
+ s.updateOnScroll,
671
+ s.containerScrollToClose
672
+ ]), F(() => {
673
+ const { clickOutsideToClose: t, getDocument: o } = C([
674
+ "clickOutsideToClose",
675
+ "getDocument"
676
+ ]), i = (o == null ? void 0 : o()) || window.document, a = {
677
+ // clickOutside 必须监听mousedown。
678
+ // 1. 如果事件目标元素在click后被移除,document.onclick被触发时已经没有该元素,会错误触发clickOutside逻辑,隐藏popup。
679
+ // 2. 点击label标签,会触发对应input元素的点击事件,导致触发clickOutside,隐藏popup。
680
+ capture: xt(t) ? t.capture : !1
681
+ };
682
+ return m && (bt(i, "mousedown", Nt, a), bt(window, "resize", dt)), () => {
683
+ Tt(i, "mousedown", Nt, a), Tt(window, "resize", dt);
684
+ };
685
+ }, [m]), F(() => ("defaultPopupVisible" in s && H((t) => {
686
+ const o = { ...t };
687
+ return o.popupVisible = !!(s != null && s.defaultPopupVisible), o;
688
+ }), () => {
689
+ }), []), F(() => ("popupVisible" in s && H((t) => {
690
+ const o = { ...t };
691
+ return o.popupVisible = !!R, o;
692
+ }), () => {
693
+ }), [R]), F(() => () => {
694
+ qt();
695
+ }, []);
696
+ const ue = N && _t(it, {
697
+ ...h,
698
+ ref: De(it) ? (t) => {
699
+ n.current.child = t, Ee(it, t);
700
+ } : void 0
701
+ }), ce = /* @__PURE__ */ X(
702
+ fe,
703
+ {
704
+ in: !!m,
705
+ timeout: b,
706
+ classNames: p,
707
+ unmountOnExit: y,
708
+ appear: !0,
709
+ mountOnEnter: !0,
710
+ onEnter: () => {
711
+ n.current.triggerDestoried = !1;
712
+ const t = D.current;
713
+ t && (t.style.display = "initial", t.style.pointerEvents = "none", p === "slideDynamicOrigin" && (t.style.transform = St()), Y());
714
+ },
715
+ onEntering: () => {
716
+ const t = D.current;
717
+ t && (p === "slideDynamicOrigin" && (t.style.transform = ""), Y());
718
+ },
719
+ onEntered: () => {
720
+ const t = D.current;
721
+ t && (t.style.pointerEvents = "auto", Y());
722
+ },
723
+ onExit: () => {
724
+ const t = D.current;
725
+ t && (t.style.pointerEvents = "none", E == null || E(t));
726
+ },
727
+ onExited: () => {
728
+ const t = D.current;
729
+ t && (t.style.display = "none", y && (n.current.triggerDestoried = !0), H((o) => {
730
+ const i = { ...o };
731
+ return i.popupStyle = {}, i;
732
+ }), S == null || S(t));
733
+ },
734
+ nodeRef: D,
735
+ children: /* @__PURE__ */ Rt(
736
+ "span",
737
+ {
738
+ ref: D,
739
+ "trigger-placement": n.current.realPosition,
740
+ ...Pe(s),
741
+ style: {
742
+ width: q && (L == null ? void 0 : L.width) === void 0 ? (At = n.current.childrenDomSize) == null ? void 0 : At.width : "",
743
+ ...A.popupStyle,
744
+ position: "absolute",
745
+ zIndex: g || "",
746
+ ...L
747
+ // display
560
748
  },
561
- () => {
562
- i == null || i();
563
- }
564
- );
565
- }) : i == null || i();
566
- });
567
- s(this, "delayToDo", (t, e) => {
568
- t ? (this.clearDelayTimer(), this.delayTimer = setTimeout(() => {
569
- e(), this.clearDelayTimer();
570
- }, t)) : e();
571
- });
572
- // 点击非popup内部,非children内部的节点,触发clickoutside 逻辑
573
- s(this, "onClickOutside", (t) => {
574
- const { onClickOutside: e, clickOutsideToClose: i } = this.getMergedProps([
575
- "onClickOutside",
576
- "clickOutsideToClose"
577
- ]), n = this.getPopupElement(), r = this.getRootElement();
578
- !Q(n, t.target) && !Q(r, t.target) && !this.hasPopupMouseDown && (e == null || e(), i && !this.isBlurToHide() && !this.isHoverTrigger() && this.setPopupVisible(!1));
579
- });
580
- s(this, "onKeyDown", (t) => {
581
- const e = t.key;
582
- this.triggerPropsEvent("onKeyDown", t), e === K.key && this.onPressEsc(t);
583
- });
584
- s(this, "onPressEsc", (t) => {
585
- const { escToClose: e } = this.getMergedProps(["escToClose"]);
586
- e && t && t.key === K.key && this.state.popupVisible && this.setPopupVisible(!1);
587
- });
588
- s(this, "onMouseEnter", (t) => {
589
- const { mouseEnterDelay: e } = this.getMergedProps(["mouseEnterDelay"]);
590
- this.triggerPropsEvent("onMouseEnter", t), this.clearDelayTimer(), this.setPopupVisible(!0, e || 0);
591
- });
592
- s(this, "onMouseMove", (t) => {
593
- this.triggerPropsEvent("onMouseMove", t), this.setMouseLocation(t), this.state.popupVisible && this.update();
594
- });
595
- s(this, "onMouseLeave", (t) => {
596
- const { mouseLeaveDelay: e } = this.getMergedProps(["mouseLeaveDelay"]);
597
- this.clearDelayTimer(), this.triggerPropsEvent("onMouseLeave", t), this.isMouseLeaveToClose() && this.state.popupVisible && this.setPopupVisible(!1, e || 0);
598
- });
599
- s(this, "onPopupMouseEnter", () => {
600
- this.clearDelayTimer();
601
- });
602
- s(this, "onPopupMouseLeave", (t) => {
603
- this.onMouseLeave(t);
604
- });
605
- s(this, "setMouseLocation", (t) => {
606
- this.getMergedProps(["alignPoint"]).alignPoint && (this.mouseLocation = {
607
- clientX: t.clientX,
608
- clientY: t.clientY
609
- });
610
- });
611
- s(this, "onContextMenu", (t) => {
612
- t.preventDefault(), this.triggerPropsEvent("onContextMenu", t), this.setMouseLocation(t), this.state.popupVisible ? this.getMergedProps(["alignPoint"]).alignPoint && this.update() : this.setPopupVisible(!0, 0);
613
- });
614
- s(this, "clickToHidePopup", (t) => {
615
- const { popupVisible: e } = this.state;
616
- e && (this.mousedownToHide = !0), this.triggerPropsEvent("onClick", t), this.isClickToHide() && e && this.setPopupVisible(!e, 0);
617
- });
618
- s(this, "onClick", (t) => {
619
- const { popupVisible: e } = this.state;
620
- e && (this.mousedownToHide = !0), this.triggerPropsEvent("onClick", t), this.setMouseLocation(t), !(!this.isClickToHide() && e) && this.setPopupVisible(!e, 0);
621
- });
622
- s(this, "onFocus", (t) => {
623
- const { focusDelay: e } = this.getMergedProps(["focusDelay"]), i = () => {
624
- this.triggerPropsEvent("onFocus", t);
625
- };
626
- this.clearDelayTimer(), this.mousedownToHide || (this.state.popupVisible ? i == null || i() : this.setPopupVisible(!0, e || 0, i)), this.mousedownToHide = !1;
627
- });
628
- s(this, "onBlur", (t) => {
629
- this.setPopupVisible(!1, 200, () => this.triggerPropsEvent("onBlur", t));
630
- });
631
- s(this, "onResize", () => {
632
- this.getMergedProps(["autoFixPosition"]).autoFixPosition && this.state.popupVisible && this.updatePopupPosition();
633
- });
634
- s(this, "onPopupMouseDown", () => {
635
- this.hasPopupMouseDown = !0, clearTimeout(this.mouseDownTimeout), this.mouseDownTimeout = setTimeout(() => {
636
- this.hasPopupMouseDown = !1;
637
- }, 0);
638
- });
639
- // 当 children 中的元素 disabled 时,不能正确触发 hover 等事件,所以当监测到对应
640
- // 组件有 disabled 时,给元素加一层 span,处理事件,模拟样式
641
- s(this, "getChild", () => {
642
- var r;
643
- const { children: t } = this.props, e = t, i = e && typeof e != "string" && e.type;
644
- let n = t;
645
- if (["string", "number"].indexOf(typeof t) > -1 || A.Children.count(t) > 1)
646
- n = /* @__PURE__ */ N("span", { children: t });
647
- else if (e && i && (i.__PQB_BUTTON === !0 || i.__PQB_CHECKBOX === !0 || i.__PQB_SWITCH === !0 || i.__PQB_RADIO === !0 || i === "button") && e.props.disabled) {
648
- const { picked: u, omitted: y } = St(e.props.style, [
649
- "position",
650
- "left",
651
- "right",
652
- "top",
653
- "bottom",
654
- "float",
655
- "display",
656
- "zIndex"
657
- ]);
658
- n = /* @__PURE__ */ N(
659
- "span",
660
- {
661
- className: (r = e.props) == null ? void 0 : r.className,
662
- style: { display: "inline-block", ...u, cursor: "not-allowed" },
663
- children: A.cloneElement(e, {
664
- style: {
665
- ...y,
666
- pointerEvents: "none"
667
- },
668
- className: void 0
669
- })
670
- }
671
- );
672
- }
673
- return n || /* @__PURE__ */ N("span", {});
674
- });
675
- s(this, "rafId");
676
- // 创建的dom节点插入getPopupContainer。
677
- s(this, "appendToContainer", (t) => {
678
- if (G(this.rafId), this.isDidMount) {
679
- const { getPopupContainer: e } = this.context, { getPopupContainer: i } = this.getMergedProps(["getPopupContainer"]), n = i || e, r = this.getRootElement(), u = n == null ? void 0 : n(r);
680
- if (u) {
681
- u.appendChild(t);
682
- return;
749
+ ...nt,
750
+ className: Qt,
751
+ children: [
752
+ xt(r) ? /* @__PURE__ */ X(
753
+ rt.type,
754
+ {
755
+ ref: rt.ref,
756
+ ...rt.props,
757
+ style: { ...rt.props.style, ...r }
758
+ }
759
+ ) : rt,
760
+ (J || P) && /* @__PURE__ */ X(
761
+ "div",
762
+ {
763
+ ref: v,
764
+ className: wt(`${Z}-arrow-container`, {
765
+ [`${k}-arrow-container`]: k
766
+ }),
767
+ children: /* @__PURE__ */ X(
768
+ "div",
769
+ {
770
+ ref: $,
771
+ ...P,
772
+ className: wt(
773
+ `${Z}-arrow`,
774
+ {
775
+ [`${k}-arrow`]: k
776
+ },
777
+ P == null ? void 0 : P.className
778
+ ),
779
+ style: { ...n.current.arrowStyle, ...P == null ? void 0 : P.style }
780
+ }
781
+ )
782
+ }
783
+ )
784
+ ]
683
785
  }
684
- }
685
- this.rafId = Pt(() => {
686
- this.appendToContainer(t);
687
- });
688
- });
689
- s(this, "getContainer", () => {
690
- const t = document.createElement("div");
691
- return t.style.width = "100%", t.style.position = "absolute", t.style.top = "0", t.style.left = "0", this.popupContainer = t, this.appendToContainer(t), t;
692
- });
693
- // 1. 触发直接附加到 Trigger 上的事件,大多是Trigger直接嵌套Trigger的情况
694
- // 2. 触发children上直接被附加的事件
695
- s(this, "triggerPropsEvent", (t, e) => {
696
- const i = this.getChild(), n = i && i.props && i.props[t], r = this.getMergedProps([t])[t];
697
- W(n) && n(e), W(r) && r(e);
698
- });
699
- // 触发 children/ trigger 组件上被附加的事件
700
- s(this, "triggerOriginEvent", (t) => {
701
- const e = this.getChild(), i = e && e.props && e.props[t], n = this.getMergedProps([t])[t];
702
- return W(n) && W(i) ? (r) => {
703
- i(r), n(r);
704
- } : i || n;
705
- });
706
- const i = this.getMergedProps(t), n = "popupVisible" in i ? i.popupVisible : i.defaultPopupVisible;
707
- this.popupOpen = !!n, this.triggerRef = q(), this.state = {
708
- popupVisible: !!n,
709
- popupStyle: {}
710
- };
711
- }
712
- static getDerivedStateFromProps(t, e) {
713
- return "popupVisible" in t && t.popupVisible !== e.popupVisible ? {
714
- popupVisible: t.popupVisible
715
- } : null;
716
- }
717
- componentDidMount() {
718
- this.componentDidUpdate(this.getMergedProps()), this.isDidMount = !0, this.unmount = !1, this.childrenDom = this.getRootElement(), this.state.popupVisible && (this.childrenDomSize = Z(this.childrenDom, {
719
- boundaryDistance: this.props.alignPoint ? void 0 : this.props.boundaryDistance,
720
- position: this.props.position
721
- }));
722
- }
723
- componentDidUpdate(t) {
724
- const e = this.getMergedProps(t), i = this.getMergedProps();
725
- !e.popupVisible && i.popupVisible && this.update();
726
- const { popupVisible: n } = this.state;
727
- this.popupOpen = n;
728
- const { getDocument: r } = i;
729
- if (!n) {
730
- this.offClickOutside(), this.offContainerResize(), this.offWindowResize(), this.offScrollListeners(), this.offResizeObserver2(), this.offResizeObserver3();
731
- return;
786
+ )
732
787
  }
733
- const u = Z(this.childrenDom, {
734
- boundaryDistance: this.props.alignPoint ? {} : this.props.boundaryDistance,
735
- position: this.props.position
736
- });
737
- if (lt(u, this.childrenDomSize) || (this.updatePopupPosition(), this.childrenDomSize = u), this.onContainerResize(), (i.updateOnScroll || i.containerScrollToClose) && this.onContainersScroll(i), this.handleWindowResize || (U(window, "resize", this.handleUpdatePosition), this.handleWindowResize = !0), !this.handleClickOutside) {
738
- const y = W(r) && r();
739
- y && (U(y, "mousedown", this.onClickOutside, {
740
- capture: J(i.clickOutsideToClose) ? i.clickOutsideToClose.capture : !1
741
- }), this.handleClickOutside = !0);
788
+ );
789
+ let pt, It = m;
790
+ if (It || (It = !!D.current && !n.current.triggerDestoried), It) {
791
+ const t = s.getPopupContainer || l.getPopupContainer;
792
+ if (j(t)) {
793
+ const o = t(tt());
794
+ o && (pt = we(
795
+ /* @__PURE__ */ X("div", { ref: I, className: `${Z}-container`, children: ce }),
796
+ o
797
+ // popupVisible ? 1 : 0,
798
+ ));
742
799
  }
743
- this.onResizeObserver2(), this.onResizeObserver3();
744
- }
745
- componentWillUnmount() {
746
- this.unmount = !0, this.offClickOutside(), this.clearTimer(), this.offWindowResize(), this.offScrollListeners(), this.offContainerResize(), G(this.rafId), this.offResizeObserver2(), this.offResizeObserver3();
747
- }
748
- clearDelayTimer() {
749
- this.delayTimer && (clearTimeout(this.delayTimer), this.delayTimer = null);
750
- }
751
- render() {
752
- var $;
753
- const {
754
- children: t,
755
- style: e,
756
- className: i,
757
- arrowProps: n,
758
- disabled: r,
759
- popup: u,
760
- classNames: y,
761
- duration: o,
762
- unmountOnExit: v,
763
- alignPoint: g,
764
- autoAlignPopupWidth: a,
765
- position: c,
766
- childrenPrefix: f,
767
- showArrow: m,
768
- popupStyle: z,
769
- __onExit: V,
770
- __onExited: H
771
- } = this.getMergedProps(), k = t || t === 0, { getPrefixCls: F, zIndex: p, rtl: M } = this.context, { popupVisible: T, popupStyle: E } = this.state;
772
- if (!u)
773
- return null;
774
- const d = {}, x = {
775
- onMouseDown: this.onPopupMouseDown
776
- };
777
- this.isHoverTrigger() && !r ? (d.onMouseEnter = this.onMouseEnter, d.onMouseLeave = this.onMouseLeave, this.isClickToHide() && (d.onClick = this.clickToHidePopup), g && (d.onMouseMove = this.onMouseMove), this.isPopupHoverHide() || (x.onMouseEnter = this.onPopupMouseEnter, x.onMouseLeave = this.onPopupMouseLeave)) : (d.onMouseEnter = this.triggerOriginEvent("onMouseEnter"), d.onMouseLeave = this.triggerOriginEvent("onMouseLeave")), this.isContextMenuTrigger() && !r ? (d.onContextMenu = this.onContextMenu, d.onClick = this.clickToHidePopup) : d.onContextMenu = this.triggerOriginEvent("onContextMenu"), this.isClickTrigger() && !r ? d.onClick = this.onClick : d.onClick = d.onClick || this.triggerOriginEvent("onClick"), this.isFocusTrigger() && !r ? (d.onFocus = this.onFocus, this.isBlurToHide() && (d.onBlur = this.onBlur)) : (d.onFocus = this.triggerOriginEvent("onFocus"), d.onBlur = this.triggerOriginEvent("onBlur")), r ? d.onKeyDown = this.triggerOriginEvent("onKeyDown") : d.onKeyDown = this.onKeyDown;
778
- const w = this.getChild(), C = A.Children.only(u());
779
- w.props.className && (d.className = w.props.className), f && T && (d.className = d.className ? `${d.className} ${f}-open` : `${f}-open`), this.isFocusTrigger() && (d.tabIndex = r ? -1 : 0);
780
- const D = F("trigger"), R = _(
781
- D,
782
- f,
783
- `${D}-position-${c}`,
784
- { [`${D}-rtl`]: M },
785
- i
786
- ), S = k && A.cloneElement(w, {
787
- ...d,
788
- ref: dt(w) ? (P) => {
789
- this.rootElementRef = P, yt(w, P);
790
- } : void 0
791
- }), L = /* @__PURE__ */ N(
792
- nt,
793
- {
794
- in: !!T,
795
- timeout: o,
796
- classNames: y,
797
- unmountOnExit: v,
798
- appear: !0,
799
- mountOnEnter: !0,
800
- onEnter: () => {
801
- this.triggerRefDestoried = !1;
802
- const P = this.getPopupElement();
803
- P && (P.style.display = "initial", P.style.pointerEvents = "none", y === "slideDynamicOrigin" && (P.style.transform = this.getTransformTranslate()));
804
- },
805
- onEntering: () => {
806
- const P = this.getPopupElement();
807
- P && y === "slideDynamicOrigin" && (P.style.transform = "");
808
- },
809
- onEntered: () => {
810
- const P = this.getPopupElement();
811
- P && (P.style.pointerEvents = "auto", this.forceUpdate());
812
- },
813
- onExit: () => {
814
- const P = this.getPopupElement();
815
- P && (P.style.pointerEvents = "none", V == null || V(P));
816
- },
817
- onExited: () => {
818
- const P = this.getPopupElement();
819
- P && (P.style.display = "none", v && (this.triggerRefDestoried = !0), this.setState({ popupStyle: {} }), H == null || H(P));
820
- },
821
- nodeRef: this.triggerRef,
822
- children: /* @__PURE__ */ X(
823
- "span",
824
- {
825
- ref: this.triggerRef,
826
- "trigger-placement": this.realPosition,
827
- style: {
828
- width: a && (e == null ? void 0 : e.width) === void 0 ? ($ = this.childrenDomSize) == null ? void 0 : $.width : "",
829
- ...E,
830
- position: "absolute",
831
- zIndex: p || "",
832
- ...e
833
- // display
834
- },
835
- ...x,
836
- className: R,
837
- ...mt(this.props),
838
- children: [
839
- /* @__PURE__ */ N(
840
- C.type,
841
- {
842
- ref: C.ref,
843
- ...C.props,
844
- style: { ...C.props.style, ...z }
845
- }
846
- ),
847
- (m || n) && /* @__PURE__ */ N(
848
- "div",
849
- {
850
- className: _(`${D}-arrow-container`, {
851
- [`${f}-arrow-container`]: f
852
- }),
853
- children: /* @__PURE__ */ N(
854
- "div",
855
- {
856
- ...n,
857
- className: _(
858
- `${D}-arrow`,
859
- {
860
- [`${f}-arrow`]: f
861
- },
862
- n == null ? void 0 : n.className
863
- ),
864
- style: { ...this.arrowStyle, ...n == null ? void 0 : n.style }
865
- }
866
- )
867
- }
868
- )
869
- ]
870
- }
871
- )
872
- }
873
- ), b = T || this.getPopupElement() && !this.triggerRefDestoried ? /* @__PURE__ */ N(Mt, { getContainer: this.getContainer, children: L }) : null;
874
- return k ? /* @__PURE__ */ X(A.Fragment, { children: [
875
- S,
876
- b
877
- ] }) : b;
878
800
  }
801
+ return N && (pt = /* @__PURE__ */ Rt(ye, { children: [
802
+ ue,
803
+ pt
804
+ ] })), pt;
879
805
  }
880
- s(tt, "displayName", "Trigger"), s(tt, "contextType", at);
806
+ const ze = ae(Be);
807
+ ze.displayName = "Trigger";
881
808
  export {
882
- te as EventsByTriggerNeed,
883
- tt as default
809
+ ro as EventsByTriggerNeed,
810
+ ze as default
884
811
  };