@autobest-ui/components 2.2.1 → 2.4.0

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 (378) hide show
  1. package/esm/accordion/Item.js +6 -23
  2. package/esm/accordion/index.js +8 -36
  3. package/esm/accordion/style/index.css +1 -0
  4. package/esm/affix/PortalAffix.js +7 -11
  5. package/esm/affix/index.js +30 -70
  6. package/esm/affix/style/index.css +1 -1
  7. package/esm/base.css +1 -1
  8. package/esm/carousel/index.js +45 -141
  9. package/esm/checkbox/index.js +12 -37
  10. package/esm/checkbox/style/index.css +1 -1
  11. package/esm/collapse/index.js +11 -49
  12. package/esm/confirm/index.d.ts +8 -0
  13. package/esm/confirm/index.js +23 -31
  14. package/esm/confirm/style/index.css +1 -1
  15. package/esm/date-picker/DateEnum.js +0 -3
  16. package/esm/date-picker/calendar/Day.js +62 -78
  17. package/esm/date-picker/calendar/MonthYear.js +20 -53
  18. package/esm/date-picker/calendar/grid/index.js +7 -12
  19. package/esm/date-picker/calendar/index.js +4 -31
  20. package/esm/date-picker/index.js +11 -51
  21. package/esm/date-picker/style/index.css +1 -1
  22. package/esm/date-picker/utils.js +6 -11
  23. package/esm/drawer/Child.js +10 -20
  24. package/esm/drawer/index.js +22 -71
  25. package/esm/drawer/style/index.css +1 -1
  26. package/esm/ellipsis/index.js +9 -17
  27. package/esm/ellipsis/style/index.css +1 -1
  28. package/esm/guide/index.js +25 -63
  29. package/esm/guide/style/index.css +1 -1
  30. package/esm/index.d.ts +1 -1
  31. package/esm/input-number/ControlArrow.js +0 -2
  32. package/esm/input-number/constants.js +2 -2
  33. package/esm/input-number/index.js +26 -106
  34. package/esm/input-number/style/index.css +1 -1
  35. package/esm/lazy-image/index.js +10 -55
  36. package/esm/lazy-image/style/index.css +1 -1
  37. package/esm/link-list/index.js +11 -35
  38. package/esm/link-list/style/index.css +1 -1
  39. package/esm/loading/index.js +15 -42
  40. package/esm/loading/style/index.css +1 -1
  41. package/esm/loading-bar/style/index.css +1 -1
  42. package/esm/loading-container/index.js +3 -6
  43. package/esm/loading-container/style/index.css +1 -1
  44. package/esm/loading-icon/index.js +0 -2
  45. package/esm/loading-icon/style/index.css +1 -1
  46. package/esm/mask/index.js +6 -9
  47. package/esm/mask/style/index.css +1 -1
  48. package/esm/message/index.d.ts +17 -6
  49. package/esm/message/index.js +68 -96
  50. package/esm/message/renderMessage.d.ts +17 -0
  51. package/esm/message/renderMessage.js +137 -0
  52. package/esm/message/style/index.css +1 -1
  53. package/esm/modal/Title.js +5 -12
  54. package/esm/modal/getPopupLocation.js +5 -7
  55. package/esm/modal/index.js +44 -125
  56. package/esm/modal/style/index.css +1 -1
  57. package/esm/move/index.js +32 -132
  58. package/esm/move/range.js +6 -12
  59. package/esm/move/utils.js +3 -10
  60. package/esm/popover/index.js +9 -28
  61. package/esm/popover/style/index.css +1 -1
  62. package/esm/portal/index.js +1 -22
  63. package/esm/script/index.js +19 -59
  64. package/esm/select/index.js +28 -106
  65. package/esm/select/style/index.css +1 -1
  66. package/esm/show-more/index.js +40 -103
  67. package/esm/skeleton/Item.js +1 -3
  68. package/esm/skeleton/index.js +5 -11
  69. package/esm/skeleton/style/index.css +1 -1
  70. package/esm/style.css +1 -33
  71. package/esm/table/body/BodyRow.js +11 -28
  72. package/esm/table/body/CheckIcon.js +10 -18
  73. package/esm/table/body/index.js +8 -12
  74. package/esm/table/header/CheckIcon.js +3 -11
  75. package/esm/table/header/HeaderCell.js +12 -33
  76. package/esm/table/header/HeaderRow.js +6 -17
  77. package/esm/table/index.js +30 -100
  78. package/esm/table/style/index.css +1 -1
  79. package/esm/tabs/index.js +35 -118
  80. package/esm/tabs/style/index.css +1 -1
  81. package/esm/tooltip/index.js +0 -4
  82. package/esm/tooltip/style/index.css +1 -1
  83. package/esm/trigger/align.js +6 -6
  84. package/esm/trigger/bottomAlign.js +33 -45
  85. package/esm/trigger/constants.js +0 -1
  86. package/esm/trigger/getPopupLocation.js +48 -68
  87. package/esm/trigger/index.js +52 -187
  88. package/esm/trigger/leftAlign.js +33 -47
  89. package/esm/trigger/ref.js +2 -7
  90. package/esm/trigger/rightAlign.js +33 -45
  91. package/esm/trigger/topAlign.js +33 -45
  92. package/esm/trigger/utils.js +28 -45
  93. package/lib/accordion/Item.js +6 -27
  94. package/lib/accordion/index.js +8 -41
  95. package/lib/accordion/style/index.css +1 -0
  96. package/lib/affix/PortalAffix.js +7 -17
  97. package/lib/affix/index.js +30 -75
  98. package/lib/affix/style/index.css +1 -1
  99. package/lib/base.css +1 -1
  100. package/lib/carousel/index.js +45 -146
  101. package/lib/checkbox/index.js +12 -41
  102. package/lib/checkbox/style/index.css +1 -1
  103. package/lib/collapse/index.js +11 -53
  104. package/lib/confirm/index.d.ts +8 -0
  105. package/lib/confirm/index.js +23 -38
  106. package/lib/confirm/style/index.css +1 -1
  107. package/lib/date-picker/DateEnum.js +0 -3
  108. package/lib/date-picker/calendar/Day.js +62 -87
  109. package/lib/date-picker/calendar/MonthYear.js +20 -62
  110. package/lib/date-picker/calendar/grid/index.js +7 -16
  111. package/lib/date-picker/calendar/index.js +4 -37
  112. package/lib/date-picker/index.js +9 -58
  113. package/lib/date-picker/style/index.css +1 -1
  114. package/lib/date-picker/utils.js +6 -26
  115. package/lib/drawer/Child.js +10 -25
  116. package/lib/drawer/index.js +22 -78
  117. package/lib/drawer/style/index.css +1 -1
  118. package/lib/ellipsis/index.js +9 -23
  119. package/lib/ellipsis/style/index.css +1 -1
  120. package/lib/guide/index.js +25 -71
  121. package/lib/guide/style/index.css +1 -1
  122. package/lib/index.d.ts +1 -1
  123. package/lib/index.js +0 -29
  124. package/lib/input-number/ControlArrow.js +0 -4
  125. package/lib/input-number/constants.js +2 -2
  126. package/lib/input-number/index.js +26 -114
  127. package/lib/input-number/style/index.css +1 -1
  128. package/lib/lazy-image/index.js +10 -58
  129. package/lib/lazy-image/style/index.css +1 -1
  130. package/lib/link-list/index.js +11 -40
  131. package/lib/link-list/style/index.css +1 -1
  132. package/lib/loading/index.js +13 -48
  133. package/lib/loading/style/index.css +1 -1
  134. package/lib/loading-bar/index.js +0 -5
  135. package/lib/loading-bar/style/index.css +1 -1
  136. package/lib/loading-container/index.js +3 -11
  137. package/lib/loading-container/style/index.css +1 -1
  138. package/lib/loading-icon/index.js +0 -7
  139. package/lib/loading-icon/style/index.css +1 -1
  140. package/lib/mask/index.js +6 -17
  141. package/lib/mask/style/index.css +1 -1
  142. package/lib/message/index.d.ts +17 -6
  143. package/lib/message/index.js +67 -104
  144. package/lib/message/renderMessage.d.ts +17 -0
  145. package/lib/message/renderMessage.js +144 -0
  146. package/lib/message/style/index.css +1 -1
  147. package/lib/modal/Affix.js +0 -4
  148. package/lib/modal/Title.js +5 -15
  149. package/lib/modal/getPopupLocation.js +5 -9
  150. package/lib/modal/index.js +44 -135
  151. package/lib/modal/style/index.css +1 -1
  152. package/lib/move/index.js +32 -144
  153. package/lib/move/range.js +6 -14
  154. package/lib/move/utils.js +3 -12
  155. package/lib/popover/index.js +9 -33
  156. package/lib/popover/style/index.css +1 -1
  157. package/lib/portal/index.js +1 -25
  158. package/lib/script/index.js +19 -61
  159. package/lib/select/index.js +28 -113
  160. package/lib/select/style/index.css +1 -1
  161. package/lib/show-more/index.js +40 -110
  162. package/lib/skeleton/Item.js +1 -8
  163. package/lib/skeleton/index.js +5 -16
  164. package/lib/skeleton/style/index.css +1 -1
  165. package/lib/style.css +1 -33
  166. package/lib/table/body/BodyRow.js +11 -33
  167. package/lib/table/body/CheckIcon.js +10 -22
  168. package/lib/table/body/index.js +8 -17
  169. package/lib/table/header/CheckIcon.js +3 -15
  170. package/lib/table/header/HeaderCell.js +12 -37
  171. package/lib/table/header/HeaderRow.js +6 -22
  172. package/lib/table/index.js +30 -107
  173. package/lib/table/style/index.css +1 -1
  174. package/lib/tabs/index.js +35 -122
  175. package/lib/tabs/style/index.css +1 -1
  176. package/lib/tooltip/index.js +0 -9
  177. package/lib/tooltip/style/index.css +1 -1
  178. package/lib/trigger/align.js +0 -4
  179. package/lib/trigger/bottomAlign.js +33 -48
  180. package/lib/trigger/constants.js +0 -2
  181. package/lib/trigger/getPopupLocation.js +48 -74
  182. package/lib/trigger/index.js +52 -198
  183. package/lib/trigger/leftAlign.js +33 -50
  184. package/lib/trigger/ref.js +2 -12
  185. package/lib/trigger/rightAlign.js +33 -48
  186. package/lib/trigger/topAlign.js +33 -48
  187. package/lib/trigger/utils.js +28 -53
  188. package/package.json +9 -3
  189. package/esm/accordion/style/index.d.ts +0 -1
  190. package/esm/accordion/style/index.js +0 -5
  191. package/esm/affix/style/index.d.ts +0 -1
  192. package/esm/affix/style/index.js +0 -5
  193. package/esm/affix/style/index.scss +0 -35
  194. package/esm/base.scss +0 -42
  195. package/esm/carousel/style/index.d.ts +0 -1
  196. package/esm/carousel/style/index.js +0 -5
  197. package/esm/carousel/style/index.scss +0 -37
  198. package/esm/checkbox/style/index.d.ts +0 -1
  199. package/esm/checkbox/style/index.js +0 -5
  200. package/esm/checkbox/style/index.scss +0 -118
  201. package/esm/collapse/style/index.d.ts +0 -1
  202. package/esm/collapse/style/index.js +0 -5
  203. package/esm/collapse/style/index.scss +0 -43
  204. package/esm/confirm/style/index.d.ts +0 -1
  205. package/esm/confirm/style/index.js +0 -7
  206. package/esm/confirm/style/index.scss +0 -44
  207. package/esm/date-picker/calendar/grid/index.scss +0 -90
  208. package/esm/date-picker/calendar/index.scss +0 -58
  209. package/esm/date-picker/style/index.d.ts +0 -1
  210. package/esm/date-picker/style/index.js +0 -11
  211. package/esm/date-picker/style/index.scss +0 -24
  212. package/esm/drawer/style/index.d.ts +0 -1
  213. package/esm/drawer/style/index.js +0 -7
  214. package/esm/drawer/style/index.scss +0 -44
  215. package/esm/ellipsis/style/index.d.ts +0 -1
  216. package/esm/ellipsis/style/index.js +0 -5
  217. package/esm/ellipsis/style/index.scss +0 -35
  218. package/esm/guide/style/index.d.ts +0 -1
  219. package/esm/guide/style/index.js +0 -7
  220. package/esm/guide/style/index.scss +0 -18
  221. package/esm/input-number/style/index.d.ts +0 -1
  222. package/esm/input-number/style/index.js +0 -5
  223. package/esm/input-number/style/index.scss +0 -70
  224. package/esm/lazy-image/style/index.d.ts +0 -1
  225. package/esm/lazy-image/style/index.js +0 -5
  226. package/esm/lazy-image/style/index.scss +0 -25
  227. package/esm/link-list/style/index.d.ts +0 -1
  228. package/esm/link-list/style/index.js +0 -7
  229. package/esm/link-list/style/index.scss +0 -125
  230. package/esm/loading/style/index.d.ts +0 -1
  231. package/esm/loading/style/index.js +0 -7
  232. package/esm/loading/style/index.scss +0 -21
  233. package/esm/loading-bar/style/index.d.ts +0 -1
  234. package/esm/loading-bar/style/index.js +0 -5
  235. package/esm/loading-bar/style/index.scss +0 -62
  236. package/esm/loading-container/style/index.d.ts +0 -1
  237. package/esm/loading-container/style/index.js +0 -7
  238. package/esm/loading-container/style/index.scss +0 -28
  239. package/esm/loading-icon/style/index.d.ts +0 -1
  240. package/esm/loading-icon/style/index.js +0 -5
  241. package/esm/loading-icon/style/index.scss +0 -24
  242. package/esm/mask/style/index.d.ts +0 -1
  243. package/esm/mask/style/index.js +0 -5
  244. package/esm/mask/style/index.scss +0 -35
  245. package/esm/message/style/index.d.ts +0 -1
  246. package/esm/message/style/index.js +0 -5
  247. package/esm/message/style/index.scss +0 -71
  248. package/esm/modal/style/index.d.ts +0 -1
  249. package/esm/modal/style/index.js +0 -7
  250. package/esm/modal/style/index.scss +0 -112
  251. package/esm/move/style/index.d.ts +0 -1
  252. package/esm/move/style/index.js +0 -5
  253. package/esm/move/style/index.scss +0 -7
  254. package/esm/popover/style/index.d.ts +0 -1
  255. package/esm/popover/style/index.js +0 -7
  256. package/esm/popover/style/index.scss +0 -60
  257. package/esm/portal/style/index.d.ts +0 -1
  258. package/esm/portal/style/index.js +0 -5
  259. package/esm/portal/style/index.scss +0 -0
  260. package/esm/script/style/index.d.ts +0 -1
  261. package/esm/script/style/index.js +0 -1
  262. package/esm/script/style/index.scss +0 -0
  263. package/esm/select/style/index.d.ts +0 -1
  264. package/esm/select/style/index.js +0 -7
  265. package/esm/select/style/index.scss +0 -126
  266. package/esm/show-more/style/index.d.ts +0 -1
  267. package/esm/show-more/style/index.js +0 -5
  268. package/esm/show-more/style/index.scss +0 -23
  269. package/esm/skeleton/style/index.d.ts +0 -1
  270. package/esm/skeleton/style/index.js +0 -5
  271. package/esm/skeleton/style/index.scss +0 -27
  272. package/esm/table/style/index.d.ts +0 -1
  273. package/esm/table/style/index.js +0 -9
  274. package/esm/table/style/index.scss +0 -45
  275. package/esm/tabs/style/index.d.ts +0 -1
  276. package/esm/tabs/style/index.js +0 -5
  277. package/esm/tabs/style/index.scss +0 -62
  278. package/esm/tooltip/style/index.d.ts +0 -1
  279. package/esm/tooltip/style/index.js +0 -7
  280. package/esm/tooltip/style/index.scss +0 -62
  281. package/esm/trigger/style/index.d.ts +0 -1
  282. package/esm/trigger/style/index.js +0 -5
  283. package/esm/trigger/style/index.scss +0 -79
  284. package/lib/accordion/style/index.d.ts +0 -1
  285. package/lib/accordion/style/index.js +0 -7
  286. package/lib/affix/style/index.d.ts +0 -1
  287. package/lib/affix/style/index.js +0 -7
  288. package/lib/affix/style/index.scss +0 -35
  289. package/lib/base.scss +0 -42
  290. package/lib/carousel/style/index.d.ts +0 -1
  291. package/lib/carousel/style/index.js +0 -7
  292. package/lib/carousel/style/index.scss +0 -37
  293. package/lib/checkbox/style/index.d.ts +0 -1
  294. package/lib/checkbox/style/index.js +0 -7
  295. package/lib/checkbox/style/index.scss +0 -118
  296. package/lib/collapse/style/index.d.ts +0 -1
  297. package/lib/collapse/style/index.js +0 -7
  298. package/lib/collapse/style/index.scss +0 -43
  299. package/lib/confirm/style/index.d.ts +0 -1
  300. package/lib/confirm/style/index.js +0 -9
  301. package/lib/confirm/style/index.scss +0 -44
  302. package/lib/date-picker/calendar/grid/index.scss +0 -90
  303. package/lib/date-picker/calendar/index.scss +0 -58
  304. package/lib/date-picker/style/index.d.ts +0 -1
  305. package/lib/date-picker/style/index.js +0 -13
  306. package/lib/date-picker/style/index.scss +0 -24
  307. package/lib/drawer/style/index.d.ts +0 -1
  308. package/lib/drawer/style/index.js +0 -9
  309. package/lib/drawer/style/index.scss +0 -44
  310. package/lib/ellipsis/style/index.d.ts +0 -1
  311. package/lib/ellipsis/style/index.js +0 -7
  312. package/lib/ellipsis/style/index.scss +0 -35
  313. package/lib/guide/style/index.d.ts +0 -1
  314. package/lib/guide/style/index.js +0 -9
  315. package/lib/guide/style/index.scss +0 -18
  316. package/lib/input-number/style/index.d.ts +0 -1
  317. package/lib/input-number/style/index.js +0 -7
  318. package/lib/input-number/style/index.scss +0 -70
  319. package/lib/lazy-image/style/index.d.ts +0 -1
  320. package/lib/lazy-image/style/index.js +0 -7
  321. package/lib/lazy-image/style/index.scss +0 -25
  322. package/lib/link-list/style/index.d.ts +0 -1
  323. package/lib/link-list/style/index.js +0 -9
  324. package/lib/link-list/style/index.scss +0 -125
  325. package/lib/loading/style/index.d.ts +0 -1
  326. package/lib/loading/style/index.js +0 -9
  327. package/lib/loading/style/index.scss +0 -21
  328. package/lib/loading-bar/style/index.d.ts +0 -1
  329. package/lib/loading-bar/style/index.js +0 -7
  330. package/lib/loading-bar/style/index.scss +0 -62
  331. package/lib/loading-container/style/index.d.ts +0 -1
  332. package/lib/loading-container/style/index.js +0 -9
  333. package/lib/loading-container/style/index.scss +0 -28
  334. package/lib/loading-icon/style/index.d.ts +0 -1
  335. package/lib/loading-icon/style/index.js +0 -7
  336. package/lib/loading-icon/style/index.scss +0 -24
  337. package/lib/mask/style/index.d.ts +0 -1
  338. package/lib/mask/style/index.js +0 -7
  339. package/lib/mask/style/index.scss +0 -35
  340. package/lib/message/style/index.d.ts +0 -1
  341. package/lib/message/style/index.js +0 -7
  342. package/lib/message/style/index.scss +0 -71
  343. package/lib/modal/style/index.d.ts +0 -1
  344. package/lib/modal/style/index.js +0 -9
  345. package/lib/modal/style/index.scss +0 -112
  346. package/lib/move/style/index.d.ts +0 -1
  347. package/lib/move/style/index.js +0 -7
  348. package/lib/move/style/index.scss +0 -7
  349. package/lib/popover/style/index.d.ts +0 -1
  350. package/lib/popover/style/index.js +0 -9
  351. package/lib/popover/style/index.scss +0 -60
  352. package/lib/portal/style/index.d.ts +0 -1
  353. package/lib/portal/style/index.js +0 -7
  354. package/lib/portal/style/index.scss +0 -0
  355. package/lib/script/style/index.d.ts +0 -1
  356. package/lib/script/style/index.js +0 -1
  357. package/lib/script/style/index.scss +0 -0
  358. package/lib/select/style/index.d.ts +0 -1
  359. package/lib/select/style/index.js +0 -9
  360. package/lib/select/style/index.scss +0 -126
  361. package/lib/show-more/style/index.d.ts +0 -1
  362. package/lib/show-more/style/index.js +0 -7
  363. package/lib/show-more/style/index.scss +0 -23
  364. package/lib/skeleton/style/index.d.ts +0 -1
  365. package/lib/skeleton/style/index.js +0 -7
  366. package/lib/skeleton/style/index.scss +0 -27
  367. package/lib/table/style/index.d.ts +0 -1
  368. package/lib/table/style/index.js +0 -11
  369. package/lib/table/style/index.scss +0 -45
  370. package/lib/tabs/style/index.d.ts +0 -1
  371. package/lib/tabs/style/index.js +0 -7
  372. package/lib/tabs/style/index.scss +0 -62
  373. package/lib/tooltip/style/index.d.ts +0 -1
  374. package/lib/tooltip/style/index.js +0 -9
  375. package/lib/tooltip/style/index.scss +0 -62
  376. package/lib/trigger/style/index.d.ts +0 -1
  377. package/lib/trigger/style/index.js +0 -7
  378. package/lib/trigger/style/index.scss +0 -79
@@ -9,39 +9,29 @@ var __extends = this && this.__extends || function () {
9
9
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
10
10
  }
11
11
  };
12
-
13
12
  return _extendStatics(d, b);
14
13
  };
15
-
16
14
  return function (d, b) {
17
15
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18
-
19
16
  _extendStatics(d, b);
20
-
21
17
  function __() {
22
18
  this.constructor = d;
23
19
  }
24
-
25
20
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26
21
  };
27
22
  }();
28
-
29
23
  var __assign = this && this.__assign || function () {
30
24
  __assign = Object.assign || function (t) {
31
25
  for (var s, i = 1, n = arguments.length; i < n; i++) {
32
26
  s = arguments[i];
33
-
34
27
  for (var p in s) {
35
28
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
36
29
  }
37
30
  }
38
-
39
31
  return t;
40
32
  };
41
-
42
33
  return __assign.apply(this, arguments);
43
34
  };
44
-
45
35
  import React from 'react';
46
36
  import { findDOMNode } from 'react-dom';
47
37
  import classNames from 'classnames';
@@ -50,108 +40,83 @@ import { CSSTransition } from 'react-transition-group';
50
40
  import Portal from '../portal';
51
41
  import { supportRef, composeRef } from './ref';
52
42
  import getPopupLocation from './getPopupLocation';
53
-
54
43
  function noop() {}
55
-
56
- var Trigger =
57
- /** @class */
58
- function (_super) {
44
+ var Trigger = /** @class */function (_super) {
59
45
  __extends(Trigger, _super);
60
-
61
46
  function Trigger(props) {
62
47
  var _this = _super.call(this, props) || this;
63
-
64
48
  _this.prefixCls = 'ab-trigger';
65
49
  _this.popupRef = /*#__PURE__*/React.createRef();
66
50
  _this.maskRef = /*#__PURE__*/React.createRef();
67
51
  _this.triggerRef = /*#__PURE__*/React.createRef();
68
-
69
52
  _this.isClickToHide = function () {
70
53
  return _this.props.trigger.indexOf('click') !== -1;
71
54
  };
72
-
73
55
  _this.clearPopupTimer = function (popupEl) {
74
56
  clearTimeout(_this.popupTimer);
75
-
76
57
  var element = popupEl || _this.getPopupDomNode();
77
-
78
58
  if (element) {
79
59
  element.style.visibility = '';
80
60
  }
81
61
  };
82
-
83
62
  _this.forceAlign = function (popupEl) {
84
63
  var rootEl = _this.getRootDomNode();
85
-
86
64
  popupEl = popupEl || _this.getPopupDomNode();
87
-
88
65
  if (!popupEl || !rootEl) {
89
66
  return;
90
67
  }
91
-
92
68
  _this.clearPopupTimer(popupEl);
93
-
94
69
  var _a = _this.props,
95
- placement = _a.placement,
96
- translateX = _a.translateX,
97
- translateY = _a.translateY,
98
- rootToPopupSpacing = _a.rootToPopupSpacing,
99
- popupLimitSpacing = _a.popupLimitSpacing,
100
- isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
101
- hiddenArrow = _a.hiddenArrow,
102
- onArrowStyleChange = _a.onArrowStyleChange,
103
- maxHeight = _a.maxHeight,
104
- isMinRootWidth = _a.isMinRootWidth,
105
- isMaxRootWidth = _a.isMaxRootWidth,
106
- isInsertNode = _a.isInsertNode;
107
-
70
+ placement = _a.placement,
71
+ translateX = _a.translateX,
72
+ translateY = _a.translateY,
73
+ rootToPopupSpacing = _a.rootToPopupSpacing,
74
+ popupLimitSpacing = _a.popupLimitSpacing,
75
+ isTransformHorizontalDirection = _a.isTransformHorizontalDirection,
76
+ hiddenArrow = _a.hiddenArrow,
77
+ onArrowStyleChange = _a.onArrowStyleChange,
78
+ maxHeight = _a.maxHeight,
79
+ isMinRootWidth = _a.isMinRootWidth,
80
+ isMaxRootWidth = _a.isMaxRootWidth,
81
+ isInsertNode = _a.isInsertNode;
108
82
  if (maxHeight) {
109
83
  popupEl.style.maxHeight = "".concat(maxHeight, "px");
110
84
  popupEl.style.overflowY = 'auto';
111
85
  }
112
-
113
86
  if (isMinRootWidth || isMaxRootWidth) {
114
87
  var rootWidth = getElementSize(rootEl).width;
115
-
116
88
  if (isMinRootWidth) {
117
89
  popupEl.style.minWidth = "".concat(rootWidth, "px");
118
90
  }
119
-
120
91
  if (isMaxRootWidth) {
121
92
  popupEl.style.maxWidth = "".concat(rootWidth, "px");
122
93
  popupEl.style.overflowX = 'auto';
123
94
  }
124
- } // 计算Popup元素应该显示的位置
125
-
126
-
95
+ }
96
+ // 计算Popup元素应该显示的位置
127
97
  var _b = getPopupLocation(placement, rootEl, popupEl, translateX, translateY, rootToPopupSpacing, popupLimitSpacing, isTransformHorizontalDirection, hiddenArrow, isInsertNode),
128
- left = _b.left,
129
- top = _b.top,
130
- arrowStyle = _b.arrowStyle,
131
- transformOrigin = _b.transformOrigin,
132
- popupMaxWidthByCalc = _b.maxWidth,
133
- popupMaxHeightByCalc = _b.maxHeight,
134
- width = _b.width,
135
- height = _b.height;
136
-
98
+ left = _b.left,
99
+ top = _b.top,
100
+ arrowStyle = _b.arrowStyle,
101
+ transformOrigin = _b.transformOrigin,
102
+ popupMaxWidthByCalc = _b.maxWidth,
103
+ popupMaxHeightByCalc = _b.maxHeight,
104
+ width = _b.width,
105
+ height = _b.height;
137
106
  _this.prevPopupSize = {
138
107
  width: width,
139
108
  height: height
140
109
  };
141
-
142
110
  if (!hiddenArrow && onArrowStyleChange && JSON.stringify(arrowStyle) !== JSON.stringify(_this.prevArrowStyle)) {
143
111
  _this.prevArrowStyle = arrowStyle;
144
112
  onArrowStyleChange(arrowStyle);
145
113
  }
146
-
147
114
  popupEl.style.transformOrigin = transformOrigin;
148
115
  popupEl.style.left = "".concat(left, "px");
149
116
  popupEl.style.top = "".concat(top, "px");
150
-
151
117
  if (popupMaxHeightByCalc) {
152
118
  popupEl.style.maxHeight = "".concat(popupMaxWidthByCalc, "px");
153
119
  }
154
-
155
120
  if (popupMaxWidthByCalc) {
156
121
  popupEl.style.maxWidth = "".concat(popupMaxWidthByCalc, "px");
157
122
  popupEl.style.overflowX = 'auto';
@@ -159,89 +124,67 @@ function (_super) {
159
124
  popupEl.style.maxWidth = '';
160
125
  }
161
126
  };
162
-
163
127
  _this.getRootDomNode = function () {
164
128
  var getCurrentDOMNode = _this.props.getCurrentDOMNode;
165
-
166
129
  if (getCurrentDOMNode) {
167
130
  return getCurrentDOMNode(_this.triggerRef.current);
168
131
  }
169
-
170
132
  try {
171
133
  // 支持children是组件的情况, 穿透组件获取HTML元素
172
134
  // eslint-disable-next-line react/no-find-dom-node
173
135
  var domNode = findDOMNode(_this.triggerRef.current);
174
-
175
136
  if (domNode) {
176
137
  return domNode;
177
138
  }
178
139
  } catch (err) {}
179
-
180
140
  return null;
181
141
  };
182
142
  /**
183
143
  * 全局事件回调
184
144
  * @param event
185
145
  */
186
-
187
-
188
146
  _this.onDocumentClick = function (event) {
189
147
  if (!_this.state.visible) {
190
148
  return;
191
149
  }
192
-
193
150
  var target = event.target;
194
-
195
151
  var root = _this.getRootDomNode();
196
-
197
152
  var popupNode = _this.getPopupDomNode();
198
-
199
153
  if (!root || !target || !popupNode) {
200
154
  return;
201
155
  }
202
-
203
156
  var showMask = _this.props.showMask;
204
-
205
157
  var maskEl = _this.getMaskDomNode();
206
-
207
158
  if (showMask && !maskEl) {
208
159
  return;
209
- } // 排除操作当前元素
210
-
211
-
160
+ }
161
+ // 排除操作当前元素
212
162
  if (!contains(root, target) && (!showMask || maskEl === target) && !contains(popupNode, target) && !_this.hasPopupMouseDown) {
213
163
  _this.hidePopup();
214
164
  }
215
165
  };
216
-
217
166
  _this.showPopup = function () {
218
167
  _this.triggerPopup(true);
219
168
  };
220
-
221
169
  _this.hidePopup = function (ev) {
222
170
  if (ev) {
223
171
  ev.stopPropagation();
224
172
  ev.nativeEvent.stopImmediatePropagation();
225
173
  }
226
-
227
174
  _this.triggerPopup(false);
228
175
  };
229
-
230
176
  _this.onVisibleChange = function (visible) {
231
177
  var prevVisible = _this.state.visible;
232
178
  clearTimeout(_this.delayTimer);
233
-
234
179
  if (prevVisible !== visible) {
235
180
  if (!_this.isOutsideControl()) {
236
181
  _this.setState({
237
182
  visible: visible
238
183
  });
239
184
  }
240
-
241
185
  var _a = _this.props,
242
- onVisibleChange = _a.onVisibleChange,
243
- name_1 = _a.name;
244
-
186
+ onVisibleChange = _a.onVisibleChange,
187
+ name_1 = _a.name;
245
188
  if (onVisibleChange) {
246
189
  onVisibleChange(visible, name_1);
247
190
  }
@@ -251,21 +194,17 @@ function (_super) {
251
194
  * 设置显示与隐藏
252
195
  * @param nextVisible
253
196
  */
254
-
255
-
256
197
  _this.triggerPopup = function (nextVisible) {
257
198
  if (nextVisible) {
258
- _this.hasPopupMouseDown = true; // 禁止执行全局监听,回调函数中的隐藏功能
259
-
199
+ _this.hasPopupMouseDown = true;
200
+ // 禁止执行全局监听,回调函数中的隐藏功能
260
201
  clearTimeout(_this.mouseDownTimeout);
261
202
  _this.mouseDownTimeout = setTimeout(function () {
262
203
  _this.hasPopupMouseDown = false;
263
204
  }, 0);
264
205
  }
265
-
266
206
  _this.onVisibleChange(nextVisible);
267
207
  };
268
-
269
208
  _this.onPopupMouseDown = function () {
270
209
  _this.hasPopupMouseDown = true;
271
210
  clearTimeout(_this.mouseDownTimeout);
@@ -273,59 +212,45 @@ function (_super) {
273
212
  _this.hasPopupMouseDown = false;
274
213
  }, 0);
275
214
  };
276
-
277
215
  _this.onClick = function (event) {
278
216
  if (event && event.preventDefault) {
279
217
  event.preventDefault();
280
218
  }
281
-
282
219
  var touch = isTouchScreen();
283
-
284
220
  if (event.type === 'touchstart' && touch || event.type === 'mousedown' && !touch) {
285
221
  _this.triggerPopup(!_this.state.visible);
286
222
  }
287
223
  };
288
-
289
224
  _this.onMouseEnter = function () {
290
225
  _this.delaySetPopupVisible(true, _this.props.mouseEnterDelay);
291
226
  };
292
-
293
227
  _this.onMouseLeave = function () {
294
228
  _this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);
295
229
  };
296
-
297
230
  _this.onPopupMouseEnter = function () {
298
231
  clearTimeout(_this.delayTimer);
299
232
  };
300
-
301
233
  _this.onPopupMouseLeave = function () {
302
234
  _this.delaySetPopupVisible(false, _this.props.mouseLeaveDelay);
303
235
  };
304
-
305
236
  _this.onExited = function () {
306
237
  _this.clearPopupTimer();
307
-
308
238
  var onDestroy = _this.props.onDestroy;
309
-
310
239
  if (onDestroy) {
311
240
  onDestroy();
312
241
  }
313
242
  };
314
-
315
243
  _this.isCurrentTrigger = function (eventName, trigger) {
316
244
  return trigger.indexOf(eventName) !== -1;
317
245
  };
318
-
319
246
  _this.isOutsideControl = function () {
320
247
  return 'visible' in _this.props;
321
248
  };
322
-
323
249
  _this.onPreventThrough = function (event) {
324
250
  if (event && event.preventDefault) {
325
251
  event.preventDefault();
326
252
  }
327
253
  };
328
-
329
254
  _this.state = {
330
255
  visible: false,
331
256
  isUserOperated: false,
@@ -333,7 +258,6 @@ function (_super) {
333
258
  };
334
259
  return _this;
335
260
  }
336
-
337
261
  Trigger.getPopupInnerHeight = function (element) {
338
262
  if (element.children && element.children.length) {
339
263
  var height_1 = getStyleValue(element, 'padding-top') + getStyleValue(element, 'padding-bottom');
@@ -343,53 +267,40 @@ function (_super) {
343
267
  });
344
268
  return height_1;
345
269
  }
346
-
347
270
  return getElementSize(element).height;
348
271
  };
349
-
350
272
  Trigger.getDerivedStateFromProps = function (nextProps, preState) {
351
273
  var nextState = {};
352
-
353
274
  if ('visible' in nextProps) {
354
275
  nextState.visible = nextProps.visible;
355
- } // 在触摸屏下, hover 事件转成click
356
-
357
-
276
+ }
277
+ // 在触摸屏下, hover 事件转成click
358
278
  if (nextProps.trigger === 'hover' && isTouchScreen()) {
359
279
  nextState.trigger = 'click';
360
280
  }
361
-
362
281
  var isUserOperated = preState.isUserOperated || nextState.visible || preState.visible;
363
-
364
282
  if (isUserOperated !== preState.isUserOperated) {
365
283
  nextState.isUserOperated = isUserOperated;
366
284
  }
367
-
368
285
  if (isEmptyObject(nextState)) {
369
286
  return null;
370
287
  }
371
-
372
288
  return nextState;
373
289
  };
374
-
375
290
  Trigger.prototype.componentDidMount = function () {
376
291
  this.componentDidUpdate();
377
292
  };
378
-
379
293
  Trigger.prototype.componentDidUpdate = function () {
380
294
  var _this = this;
381
-
382
295
  var visible = this.state.visible;
383
-
384
296
  if (!visible) {
385
297
  // 其中参数是解决: 当同时多个trigger在同一个组件中,一个更新(一个使用visible)导致多个都发生componentDidUpdate
386
298
  // 应该不让其他trigger 的delay事件销毁
387
299
  this.clearOutsideHandler(true);
388
300
  return;
389
301
  }
390
-
391
- var popupEl = this.getPopupDomNode(); // 加入 resize 监听
392
-
302
+ var popupEl = this.getPopupDomNode();
303
+ // 加入 resize 监听
393
304
  if (this.props.monitorWindowResize && !this.resizeHandler) {
394
305
  var handle = this.props.windowResizeHidden ? throttleWithRAF(function () {
395
306
  return _this.triggerPopup(false);
@@ -397,126 +308,99 @@ function (_super) {
397
308
  return _this.forceAlign();
398
309
  });
399
310
  this.resizeHandler = addEventListener(window, 'resize', handle);
400
- } // 加入 scroll 监听
401
-
402
-
311
+ }
312
+ // 加入 scroll 监听
403
313
  if (visible && this.props.scrollClosable && !this.scrollHandler) {
404
314
  this.scrollHandler = addEventListener(window, 'scroll', function () {
405
315
  if (_this.scrollHandler) {
406
316
  _this.scrollHandler.remove();
407
-
408
317
  _this.scrollHandler = null;
409
318
  }
410
-
411
319
  _this.triggerPopup(false);
412
320
  });
413
- } // 需要监听 `mousedown` or `touchstart`, 而不是click
414
-
415
-
321
+ }
322
+ // 需要监听 `mousedown` or `touchstart`, 而不是click
416
323
  var currentDocument;
417
324
  var touch = isTouchScreen();
418
-
419
325
  if (!this.clickOutsideHandler && !touch && this.isClickToHide()) {
420
326
  currentDocument = window.document;
421
327
  this.clickOutsideHandler = addEventListener(currentDocument, 'mousedown', this.onDocumentClick);
422
- } // always hide on mobile
423
-
424
-
328
+ }
329
+ // always hide on mobile
425
330
  if (!this.touchOutsideHandler) {
426
331
  currentDocument = currentDocument || window.document;
427
332
  this.touchOutsideHandler = addEventListener(currentDocument, 'touchstart', this.onDocumentClick);
428
333
  }
429
-
430
334
  if (popupEl && this.prevPopupSize) {
431
335
  var _a = getElementSize(popupEl),
432
- width = _a.width,
433
- height = _a.height;
434
-
336
+ width = _a.width,
337
+ height = _a.height;
435
338
  if (this.prevPopupSize.width !== width || this.prevPopupSize.height !== height) {
436
339
  this.clearPopupTimer(popupEl);
437
340
  popupEl.style.visibility = 'hidden';
438
341
  this.popupTimer = setTimeout(function () {
439
342
  _this.forceAlign(popupEl);
440
-
441
343
  popupEl.style.visibility = '';
442
344
  });
443
345
  }
444
346
  }
445
347
  };
446
-
447
348
  Trigger.prototype.componentWillUnmount = function () {
448
349
  // remove绑定事件
449
350
  this.clearOutsideHandler();
450
351
  };
451
-
452
352
  Trigger.prototype.getPopupDomNode = function () {
453
353
  if (this.popupRef && this.popupRef.current) {
454
354
  return this.popupRef.current;
455
355
  }
456
-
457
356
  return null;
458
357
  };
459
-
460
358
  Trigger.prototype.getMaskDomNode = function () {
461
359
  if (this.maskRef && this.maskRef.current) {
462
360
  return this.maskRef.current;
463
361
  }
464
-
465
362
  return null;
466
363
  };
467
-
468
364
  Trigger.prototype.clearOutsideHandler = function (ignoreDelayTimer) {
469
365
  // clearTimeout(this.mouseDownTimeout);
470
366
  if (!ignoreDelayTimer) {
471
367
  clearTimeout(this.delayTimer);
472
368
  }
473
-
474
369
  this.clearPopupTimer();
475
-
476
370
  if (this.resizeHandler) {
477
371
  this.resizeHandler.remove();
478
372
  this.resizeHandler = null;
479
373
  }
480
-
481
374
  if (this.scrollHandler) {
482
375
  this.scrollHandler.remove();
483
376
  this.scrollHandler = null;
484
377
  }
485
-
486
378
  if (this.clickOutsideHandler) {
487
379
  this.clickOutsideHandler.remove();
488
380
  this.clickOutsideHandler = null;
489
381
  }
490
-
491
382
  if (this.touchOutsideHandler) {
492
383
  this.touchOutsideHandler.remove();
493
384
  this.touchOutsideHandler = null;
494
385
  }
495
386
  };
496
-
497
387
  Trigger.prototype.delaySetPopupVisible = function (visible, delayTime) {
498
388
  var _this = this;
499
-
500
389
  clearTimeout(this.delayTimer);
501
-
502
390
  if (delayTime) {
503
391
  var delay = delayTime * 1000;
504
392
  this.delayTimer = setTimeout(function () {
505
393
  _this.triggerPopup(visible);
506
-
507
394
  clearTimeout(_this.delayTimer);
508
395
  }, delay);
509
396
  } else {
510
397
  this.triggerPopup(visible);
511
398
  }
512
399
  };
513
-
514
400
  Trigger.prototype.renderMask = function () {
515
401
  var _a;
516
-
517
402
  var visible = this.state.visible;
518
403
  var showMask = this.props.showMask;
519
-
520
404
  if (showMask) {
521
405
  var cls = this.prefixCls;
522
406
  return /*#__PURE__*/React.createElement("div", {
@@ -525,32 +409,27 @@ function (_super) {
525
409
  onTouchEnd: this.onPreventThrough
526
410
  });
527
411
  }
528
-
529
412
  return null;
530
413
  };
531
-
532
414
  Trigger.prototype.renderPopupContent = function () {
533
415
  var _a;
534
-
535
416
  var cls = this.prefixCls;
536
417
  var _b = this.props,
537
- popup = _b.popup,
538
- wrapClassName = _b.wrapClassName,
539
- isTransformHorizontalDirection = _b.isTransformHorizontalDirection,
540
- isInsertNode = _b.isInsertNode;
418
+ popup = _b.popup,
419
+ wrapClassName = _b.wrapClassName,
420
+ isTransformHorizontalDirection = _b.isTransformHorizontalDirection,
421
+ isInsertNode = _b.isInsertNode;
541
422
  var _c = this.state,
542
- visible = _c.visible,
543
- isUserOperated = _c.isUserOperated,
544
- trigger = _c.trigger;
545
- var wrapClass = classNames("".concat(cls, "-wrap"), wrapClassName, (_a = {}, _a["".concat(cls, "-hidden")] = isInsertNode && !isUserOperated && !visible, _a)); // hover 下,对popup增加相应的事件,延迟隐藏,可以在弹框中停留
546
-
423
+ visible = _c.visible,
424
+ isUserOperated = _c.isUserOperated,
425
+ trigger = _c.trigger;
426
+ var wrapClass = classNames("".concat(cls, "-wrap"), wrapClassName, (_a = {}, _a["".concat(cls, "-hidden")] = isInsertNode && !isUserOperated && !visible, _a));
427
+ // hover 下,对popup增加相应的事件,延迟隐藏,可以在弹框中停留
547
428
  var mouseProps = {};
548
-
549
429
  if (this.isCurrentTrigger('hover', trigger)) {
550
430
  mouseProps.onMouseEnter = this.onPopupMouseEnter;
551
431
  mouseProps.onMouseLeave = this.onPopupMouseLeave;
552
432
  }
553
-
554
433
  mouseProps.onMouseDown = this.onPopupMouseDown;
555
434
  mouseProps.onTouchStart = this.onPopupMouseDown;
556
435
  return /*#__PURE__*/React.createElement(CSSTransition, {
@@ -568,8 +447,6 @@ function (_super) {
568
447
  /**
569
448
  * 扩充children属性,根据trigger绑定不同事件
570
449
  */
571
-
572
-
573
450
  Trigger.prototype.renderChildComponent = function () {
574
451
  var children = this.props.children;
575
452
  var trigger = this.state.trigger;
@@ -577,50 +454,39 @@ function (_super) {
577
454
  var newChildProps = {
578
455
  key: 'trigger'
579
456
  };
580
-
581
457
  if (this.isCurrentTrigger('hover', trigger) && this.props.trigger === trigger) {
582
458
  newChildProps.onMouseEnter = this.onMouseEnter;
583
459
  newChildProps.onMouseLeave = this.onMouseLeave;
584
460
  }
585
-
586
461
  if (!this.isOutsideControl() || this.props.trigger !== trigger) {
587
462
  if (this.isCurrentTrigger('click', trigger)) {
588
463
  newChildProps.onMouseDown = this.onClick;
589
464
  newChildProps.onTouchStart = this.onClick;
590
465
  }
591
-
592
466
  if (this.isCurrentTrigger('focus', trigger)) {
593
467
  newChildProps.onFocus = this.showPopup;
594
468
  newChildProps.onBlur = this.hidePopup;
595
469
  }
596
470
  }
597
-
598
471
  var cloneProps = __assign({}, newChildProps);
599
-
600
472
  if (supportRef(child)) {
601
473
  cloneProps.ref = composeRef(this.triggerRef, child.ref);
602
- } // 对当前children元素添加额外属性
603
-
604
-
474
+ }
475
+ // 对当前children元素添加额外属性
605
476
  return /*#__PURE__*/React.cloneElement(child, cloneProps);
606
477
  };
607
-
608
478
  Trigger.prototype.renderPopupComponent = function () {
609
479
  if (this.props.isInsertNode) {
610
480
  return /*#__PURE__*/React.createElement(React.Fragment, null, this.renderMask(), this.renderPopupContent());
611
481
  }
612
-
613
482
  if (this.state.visible || this.popupRef.current) {
614
483
  return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(React.Fragment, null, this.renderMask(), this.renderPopupContent()));
615
484
  }
616
-
617
485
  return null;
618
486
  };
619
-
620
487
  Trigger.prototype.render = function () {
621
488
  return /*#__PURE__*/React.createElement(React.Fragment, null, this.renderChildComponent(), this.renderPopupComponent());
622
489
  };
623
-
624
490
  Trigger.defaultProps = {
625
491
  placement: 'Top',
626
492
  trigger: 'hover',
@@ -644,5 +510,4 @@ function (_super) {
644
510
  };
645
511
  return Trigger;
646
512
  }(React.Component);
647
-
648
513
  export default Trigger;