@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
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
10
  var _utils = require("@autobest-ui/utils");
15
-
16
11
  var _transition = _interopRequireDefault(require("./transition"));
17
-
18
12
  var __extends = void 0 && (void 0).__extends || function () {
19
13
  var _extendStatics = function extendStatics(d, b) {
20
14
  _extendStatics = Object.setPrototypeOf || {
@@ -26,31 +20,21 @@ var __extends = void 0 && (void 0).__extends || function () {
26
20
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
27
21
  }
28
22
  };
29
-
30
23
  return _extendStatics(d, b);
31
24
  };
32
-
33
25
  return function (d, b) {
34
26
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
35
-
36
27
  _extendStatics(d, b);
37
-
38
28
  function __() {
39
29
  this.constructor = d;
40
30
  }
41
-
42
31
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
43
32
  };
44
33
  }();
45
-
46
- var Carousel =
47
- /** @class */
48
- function (_super) {
34
+ var Carousel = /** @class */function (_super) {
49
35
  __extends(Carousel, _super);
50
-
51
36
  function Carousel(props) {
52
37
  var _this = _super.call(this, props) || this;
53
-
54
38
  _this.prefixCls = 'ab-carousel';
55
39
  _this.listRef = /*#__PURE__*/_react.default.createRef();
56
40
  _this.sliderWidth = 0;
@@ -62,84 +46,65 @@ function (_super) {
62
46
  _this.endX = 0;
63
47
  _this.autoplayTimer = null;
64
48
  _this.fadeEffectTimer = null;
65
-
66
49
  _this.next = function (transition) {
67
50
  _this.interceptorChangePage(_this.state.currentPage + 1, transition);
68
51
  };
69
-
70
52
  _this.prev = function (transition) {
71
53
  _this.interceptorChangePage(_this.state.currentPage - 1, transition);
72
54
  };
73
-
74
55
  _this.goTo = function (nextIndex, transition) {
75
56
  _this.interceptorChangePage(nextIndex - 1, transition);
76
57
  };
77
58
  /**
78
59
  * 获取滚动元素数量
79
60
  */
80
-
81
-
82
61
  _this.getChildCount = function () {
83
62
  return _react.default.Children.count(_this.props.children);
84
63
  };
85
64
  /**
86
65
  * 获取滚动容器元素
87
66
  */
88
-
89
-
90
67
  _this.getListDomNode = function () {
91
68
  if (_this.listRef && _this.listRef.current) {
92
69
  return _this.listRef.current;
93
70
  }
94
-
95
71
  return null;
96
72
  };
97
73
  /**
98
74
  * 初始化,设置各个元素大小,开启自动滚动
99
75
  */
100
-
101
-
102
76
  _this.init = function () {
103
77
  var element = _this.getListDomNode();
104
-
105
78
  if (!element) {
106
79
  return;
107
80
  }
108
-
109
81
  var childCount = _this.getChildCount();
110
-
111
- _this.contentWidth = (0, _utils.getElementSize)(element.parentNode).width; // 没有子元素或者获取不到宽度
112
-
82
+ _this.contentWidth = (0, _utils.getElementSize)(element.parentNode).width;
83
+ // 没有子元素或者获取不到宽度
113
84
  if (!childCount || !_this.contentWidth) {
114
85
  return;
115
- } // 执行一次,控制样式,显示slider
116
-
117
-
86
+ }
87
+ // 执行一次,控制样式,显示slider
118
88
  if (!_this.state.initialized) {
119
89
  _this.setState({
120
90
  initialized: true
121
91
  });
122
92
  }
123
-
124
93
  var currentPage = _this.state.currentPage;
125
94
  var _a = _this.props,
126
- slidesPerView = _a.slidesPerView,
127
- height = _a.height;
95
+ slidesPerView = _a.slidesPerView,
96
+ height = _a.height;
128
97
  _this.sliderWidth = _this.contentWidth / slidesPerView;
129
98
  element.style.width = "".concat(_this.sliderWidth * childCount, "px");
130
-
131
99
  if (height) {
132
100
  element.style.height = height;
133
101
  }
134
-
135
102
  var childList = Array.from(element.children);
136
103
  childList.forEach(function (child) {
137
104
  child.style.width = "".concat(_this.sliderWidth, "px");
138
105
  });
139
106
  _this.prevX = -currentPage * _this.sliderWidth;
140
-
141
107
  _this.setListStyles(element, _this.prevX);
142
-
143
108
  _this.onAutoplay();
144
109
  };
145
110
  /**
@@ -147,40 +112,28 @@ function (_super) {
147
112
  * @param nextPage
148
113
  * @param transition
149
114
  */
150
-
151
-
152
115
  _this.interceptorChangePage = function (nextPage, transition) {
153
116
  // 停止autoplay
154
117
  clearTimeout(_this.autoplayTimer);
155
-
156
118
  var element = _this.getListDomNode();
157
-
158
119
  if (element) {
159
120
  var slidesPerView = _this.props.slidesPerView;
160
-
161
- var childCount = _this.getChildCount(); // 内容未超出容器范围, 将恢复原样
162
-
163
-
121
+ var childCount = _this.getChildCount();
122
+ // 内容未超出容器范围, 将恢复原样
164
123
  if (slidesPerView >= childCount) {
165
124
  _this.setListStyles(element, 0, transition);
166
-
167
125
  return;
168
- } // 已滑动到最左边
169
-
170
-
126
+ }
127
+ // 已滑动到最左边
171
128
  if (nextPage < 0) {
172
129
  nextPage = childCount - slidesPerView;
173
130
  } else if (nextPage > childCount - slidesPerView) {
174
131
  // 已滑动到最右边
175
132
  nextPage = 0;
176
133
  }
177
-
178
134
  _this.prevX = -nextPage * _this.sliderWidth;
179
-
180
135
  _this.onBeforeChange(nextPage);
181
-
182
136
  _this.setListStyles(element, _this.prevX, transition);
183
-
184
137
  _this.setState({
185
138
  currentPage: nextPage
186
139
  }, function () {
@@ -195,11 +148,9 @@ function (_super) {
195
148
  * @param translateX
196
149
  * @param transition
197
150
  */
198
-
199
-
200
151
  _this.setListStyles = function (element, translateX, transition) {
201
- element.style.transition = ''; // 当开启渐变时,直接执行渐变,将没有位置偏移动画
202
-
152
+ element.style.transition = '';
153
+ // 当开启渐变时,直接执行渐变,将没有位置偏移动画
203
154
  if (_this.props.fadeEffect) {
204
155
  clearTimeout(_this.fadeEffectTimer);
205
156
  element.style.visibility = 'none';
@@ -212,27 +163,22 @@ function (_super) {
212
163
  } else {
213
164
  element.style.transition = transition || _transition.default.TransformEaseInOut;
214
165
  }
215
-
216
166
  element.style.transform = "translateX(".concat(translateX, "px)");
217
167
  };
218
-
219
168
  _this.onBeforeChange = function (currentPage) {
220
169
  if (typeof _this.props.onBeforeChange === 'function') {
221
170
  _this.props.onBeforeChange(currentPage + 1);
222
171
  }
223
172
  };
224
-
225
173
  _this.onAfterChange = function () {
226
174
  if (typeof _this.props.onAfterChange === 'function') {
227
175
  _this.props.onAfterChange(_this.state.currentPage + 1);
228
176
  }
229
177
  };
230
-
231
178
  _this.onClick = function () {
232
179
  if ((0, _utils.isTouchScreen)()) {
233
180
  return;
234
181
  }
235
-
236
182
  if (_this.props.onClick) {
237
183
  _this.props.onClick(_this.state.currentPage + 1);
238
184
  }
@@ -241,178 +187,139 @@ function (_super) {
241
187
  * 触摸屏触发滑动,缓存触发位置
242
188
  * @param event
243
189
  */
244
-
245
-
246
190
  _this.onTouchStart = function (event) {
247
191
  if (!_this.props.controllable || _this.props.fadeEffect) {
248
192
  return;
249
193
  }
250
-
251
194
  event.preventDefault();
252
195
  clearTimeout(_this.autoplayTimer);
253
196
  _this.endX = 0;
254
197
  _this.startX = event.touches ? event.touches[0].pageX : event.clientX;
255
-
256
198
  var element = _this.getListDomNode();
257
-
258
199
  if (!element) {
259
200
  return;
260
201
  }
261
-
262
202
  element.style.transition = 'none';
263
203
  };
264
204
  /**
265
205
  * 触摸屏触发滑动,计算移动位置,并设置元素偏移
266
206
  * @param event
267
207
  */
268
-
269
-
270
208
  _this.onTouchMove = function (event) {
271
209
  if (!_this.props.controllable || _this.props.fadeEffect) {
272
210
  return;
273
211
  }
274
-
275
212
  event.preventDefault();
276
213
  _this.endX = event.touches ? event.touches[0].pageX : event.clientX;
277
214
  _this.moveX = _this.prevX + _this.endX - _this.startX;
278
215
  _this.isDirectionLeft = _this.prevX - _this.startX <= _this.prevX - _this.endX;
279
-
280
216
  var element = _this.getListDomNode();
281
-
282
217
  if (!element) {
283
218
  return;
284
219
  }
285
-
286
220
  element.style.transform = "translateX(".concat(_this.moveX, "px)");
287
221
  };
288
222
  /**
289
223
  * 停止滑动,判断用户移动位置,确定用户最终滑动位置
290
224
  * @param event
291
225
  */
292
-
293
-
294
226
  _this.onTouchEnd = function (event) {
295
227
  var _a = _this.props,
296
- onClick = _a.onClick,
297
- controllable = _a.controllable,
298
- fadeEffect = _a.fadeEffect,
299
- sensitivity = _a.sensitivity,
300
- slidesPerView = _a.slidesPerView;
301
-
228
+ onClick = _a.onClick,
229
+ controllable = _a.controllable,
230
+ fadeEffect = _a.fadeEffect,
231
+ sensitivity = _a.sensitivity,
232
+ slidesPerView = _a.slidesPerView;
302
233
  if (!controllable || fadeEffect) {
303
234
  if (onClick) {
304
235
  onClick(_this.state.currentPage + 1);
305
236
  }
306
-
307
237
  return;
308
238
  }
309
-
310
239
  var currentPage = _this.state.currentPage;
311
- var transition = _transition.default.TransformEaseOut; // 移动的偏移量
312
-
313
- var translateX = Math.abs(_this.startX - _this.endX); // 判断用户未产生滑动,认为是点击
314
-
240
+ var transition = _transition.default.TransformEaseOut;
241
+ // 移动的偏移量
242
+ var translateX = Math.abs(_this.startX - _this.endX);
243
+ // 判断用户未产生滑动,认为是点击
315
244
  if (_this.endX === 0 || translateX < sensitivity) {
316
245
  if (onClick) {
317
246
  onClick(_this.state.currentPage + 1);
318
247
  }
319
-
320
248
  _this.interceptorChangePage(currentPage, transition);
321
-
322
249
  return;
323
250
  }
324
-
325
- event.preventDefault(); // 移出左边临界点
326
-
251
+ event.preventDefault();
252
+ // 移出左边临界点
327
253
  if (_this.moveX >= 0) {
328
254
  _this.interceptorChangePage(0, transition);
329
-
330
255
  return;
331
256
  }
332
-
333
- var childCount = _this.getChildCount(); // 移出右边临界点
334
-
335
-
257
+ var childCount = _this.getChildCount();
258
+ // 移出右边临界点
336
259
  var listWidth = _this.sliderWidth * childCount;
337
260
  var moveX = Math.abs(_this.moveX);
338
-
339
261
  if (moveX >= listWidth - _this.contentWidth) {
340
262
  _this.interceptorChangePage(childCount - slidesPerView, transition);
341
-
342
263
  return;
343
- } // 未达到一页,判断是否超出sensitivity, 超出将加1
344
-
345
-
346
- var skipOne = translateX % _this.sliderWidth >= _this.props.sensitivity ? 1 : 0; // 滑动的完整页数
347
-
348
- var skipCount = Math.floor(translateX / _this.sliderWidth); // 判断是否向左滑动
349
-
264
+ }
265
+ // 未达到一页,判断是否超出sensitivity, 超出将加1
266
+ var skipOne = translateX % _this.sliderWidth >= _this.props.sensitivity ? 1 : 0;
267
+ // 滑动的完整页数
268
+ var skipCount = Math.floor(translateX / _this.sliderWidth);
269
+ // 判断是否向左滑动
350
270
  if (_this.isDirectionLeft) {
351
271
  currentPage = currentPage + skipCount + skipOne;
352
272
  } else {
353
273
  currentPage -= skipCount + skipOne;
354
274
  }
355
-
356
275
  _this.interceptorChangePage(currentPage, transition);
357
276
  };
358
-
359
277
  _this.state = {
360
278
  currentPage: props.defaultValue - 1,
361
279
  initialized: false
362
280
  };
363
281
  return _this;
364
282
  }
365
-
366
283
  Carousel.prototype.componentDidMount = function () {
367
- var _this = this; // 先执行一遍,解决异步观察延迟问题
368
-
369
-
284
+ var _this = this;
285
+ // 先执行一遍,解决异步观察延迟问题
370
286
  this.init();
371
287
  var element = this.getListDomNode();
372
-
373
288
  if (element) {
374
289
  // 开启异步观察目标元素
375
290
  this.intersectionObserver = new IntersectionObserver(function (entries) {
376
- var item = entries[0]; // 未显示
377
-
291
+ var item = entries[0];
292
+ // 未显示
378
293
  if (item.intersectionRatio <= 0 || !item.isIntersecting) {
379
294
  clearTimeout(_this.autoplayTimer);
380
295
  return;
381
296
  }
382
-
383
297
  _this.init();
384
- }); // 开启 observing
385
-
298
+ });
299
+ // 开启 observing
386
300
  this.intersectionObserver.observe(element);
387
301
  }
388
302
  };
389
-
390
303
  Carousel.prototype.componentDidUpdate = function (prevProps) {
391
304
  var _this = this;
392
-
393
305
  var children = this.props.children;
394
-
395
306
  if (_react.default.Children.count(children) !== _react.default.Children.count(prevProps.children)) {
396
307
  this.init();
397
- } // 加入 resize 监听
398
-
399
-
308
+ }
309
+ // 加入 resize 监听
400
310
  if (this.props.monitorWindowResize && !this.resizeHandler) {
401
311
  this.resizeHandler = (0, _utils.addEventListener)(window, 'resize', (0, _utils.throttleWithRAF)(function () {
402
312
  return _this.init();
403
313
  }));
404
314
  }
405
315
  };
406
-
407
316
  Carousel.prototype.componentWillUnmount = function () {
408
317
  clearTimeout(this.autoplayTimer);
409
318
  clearTimeout(this.fadeEffectTimer);
410
-
411
319
  if (this.resizeHandler) {
412
320
  this.resizeHandler.remove();
413
321
  this.resizeHandler = null;
414
322
  }
415
-
416
323
  if (this.intersectionObserver) {
417
324
  this.intersectionObserver.disconnect();
418
325
  }
@@ -420,29 +327,23 @@ function (_super) {
420
327
  /**
421
328
  * 开启自动偏移或者渐变,当元素少于2时,将不会开启
422
329
  */
423
-
424
-
425
330
  Carousel.prototype.onAutoplay = function () {
426
331
  var _this = this;
427
-
428
332
  if (!this.props.autoplay || this.getChildCount() <= 1) {
429
333
  return;
430
334
  }
431
-
432
335
  clearTimeout(this.autoplayTimer);
433
336
  this.autoplayTimer = setTimeout(function () {
434
337
  _this.interceptorChangePage(_this.state.currentPage + 1);
435
338
  }, this.props.delay);
436
339
  };
437
-
438
340
  Carousel.prototype.render = function () {
439
341
  var _a;
440
-
441
342
  var cls = this.prefixCls;
442
343
  var _b = this.props,
443
- className = _b.className,
444
- children = _b.children,
445
- pagination = _b.pagination;
344
+ className = _b.className,
345
+ children = _b.children,
346
+ pagination = _b.pagination;
446
347
  return /*#__PURE__*/_react.default.createElement("div", {
447
348
  className: (0, _classnames.default)(cls, className, (_a = {}, _a["".concat(cls, "-init")] = this.state.initialized, _a))
448
349
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -461,9 +362,8 @@ function (_super) {
461
362
  className: "".concat(cls, "-slider")
462
363
  }, child);
463
364
  }))), typeof pagination === 'function' ? pagination(this) : pagination);
464
- }; // 默认值
465
-
466
-
365
+ };
366
+ // 默认值
467
367
  Carousel.defaultProps = {
468
368
  slidesPerView: 1,
469
369
  defaultValue: 1,
@@ -477,6 +377,5 @@ function (_super) {
477
377
  };
478
378
  return Carousel;
479
379
  }(_react.default.Component);
480
-
481
380
  var _default = Carousel;
482
381
  exports.default = _default;
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
10
  var __extends = void 0 && (void 0).__extends || function () {
15
11
  var _extendStatics = function extendStatics(d, b) {
16
12
  _extendStatics = Object.setPrototypeOf || {
@@ -22,61 +18,44 @@ var __extends = void 0 && (void 0).__extends || function () {
22
18
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
23
19
  }
24
20
  };
25
-
26
21
  return _extendStatics(d, b);
27
22
  };
28
-
29
23
  return function (d, b) {
30
24
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
31
-
32
25
  _extendStatics(d, b);
33
-
34
26
  function __() {
35
27
  this.constructor = d;
36
28
  }
37
-
38
29
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
39
30
  };
40
31
  }();
41
-
42
32
  var cls = 'ab-checkbox';
43
-
44
- var Checkbox =
45
- /** @class */
46
- function (_super) {
33
+ var Checkbox = /** @class */function (_super) {
47
34
  __extends(Checkbox, _super);
48
-
49
35
  function Checkbox(props) {
50
36
  var _this = _super.call(this, props) || this;
51
-
52
37
  _this.onVisibleChange = function () {
53
38
  var _a = _this.props,
54
- disabled = _a.disabled,
55
- onChange = _a.onChange,
56
- name = _a.name;
57
-
39
+ disabled = _a.disabled,
40
+ onChange = _a.onChange,
41
+ name = _a.name;
58
42
  if (disabled) {
59
43
  return;
60
44
  }
61
-
62
45
  var visible = !_this.state.visible;
63
-
64
46
  if (!('checked' in _this.props)) {
65
47
  _this.setState({
66
48
  visible: visible
67
49
  });
68
50
  }
69
-
70
51
  onChange(visible, name);
71
52
  };
72
-
73
53
  _this.renderBox = function () {
74
54
  var _a;
75
-
76
55
  var _b = _this.props,
77
- className = _b.className,
78
- disabled = _b.disabled,
79
- size = _b.size;
56
+ className = _b.className,
57
+ disabled = _b.disabled,
58
+ size = _b.size;
80
59
  var visible = _this.state.visible;
81
60
  var innerStyle = {
82
61
  width: "".concat(size, "px"),
@@ -100,13 +79,11 @@ function (_super) {
100
79
  style: iconStyle
101
80
  })));
102
81
  };
103
-
104
82
  _this.state = {
105
83
  visible: props.checked || props.defaultChecked
106
84
  };
107
85
  return _this;
108
86
  }
109
-
110
87
  Checkbox.getDerivedStateFromProps = function (nextProps, prevState) {
111
88
  // 如果父级传了 checked 则更新 state
112
89
  if ('checked' in nextProps && nextProps.checked !== prevState.visible) {
@@ -114,30 +91,25 @@ function (_super) {
114
91
  visible: nextProps.checked
115
92
  };
116
93
  }
117
-
118
94
  return null;
119
95
  };
120
-
121
96
  Checkbox.prototype.render = function () {
122
97
  var _a;
123
-
124
98
  var _b = this.props,
125
- className = _b.className,
126
- disabled = _b.disabled,
127
- children = _b.children,
128
- reverse = _b.reverse; // 只渲染复选框
129
-
99
+ className = _b.className,
100
+ disabled = _b.disabled,
101
+ children = _b.children,
102
+ reverse = _b.reverse;
103
+ // 只渲染复选框
130
104
  if (!children) {
131
105
  return this.renderBox();
132
106
  }
133
-
134
107
  return /*#__PURE__*/_react.default.createElement("label", {
135
108
  className: (0, _classnames.default)("".concat(cls, "-wrap"), className, (_a = {}, _a["".concat(cls, "-reverse")] = reverse, _a["".concat(cls, "-disabled")] = disabled, _a))
136
109
  }, this.renderBox(), children ? /*#__PURE__*/_react.default.createElement("span", {
137
110
  className: "".concat(cls, "-content")
138
111
  }, children) : null);
139
112
  };
140
-
141
113
  Checkbox.defaultProps = {
142
114
  size: 16,
143
115
  disabled: false,
@@ -146,6 +118,5 @@ function (_super) {
146
118
  };
147
119
  return Checkbox;
148
120
  }(_react.default.Component);
149
-
150
121
  var _default = Checkbox;
151
122
  exports.default = _default;
@@ -1 +1 @@
1
- .ab-checkbox{display:inline-block;position:relative;font-size:0;cursor:pointer}.ab-checkbox-input{position:absolute;opacity:0;margin:0;padding:0;width:100%;height:100%;cursor:pointer;z-index:2}.ab-checkbox-inner{display:inline-block;position:relative;width:.16rem;height:.16rem;transition:all .3s;border:.02rem solid #b0b0b0;border-radius:.02rem;background-color:#fff}.ab-checkbox-icon{visibility:hidden;position:absolute;width:.06rem;height:.1rem;left:20%;top:40%;transform:rotate(45deg) scale(0) translate(-50%,-50%);transition:all .2s;border:.02rem solid #e84040;border-top:none;border-left:none}.ab-checkbox.ab-checkbox-checked .ab-checkbox-icon{visibility:visible;transform:rotate(45deg) scale(1) translate(-50%,-50%)}.ab-checkbox.ab-checkbox-disabled{cursor:not-allowed;color:rgba(0,0,0,.25)}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-inner{border-color:#f0f0f0!important;background-color:#f5f5f5!important}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-icon{border-color:#cecece}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-content{text-decoration:none!important}.ab-checkbox-wrap{display:inline-block;position:relative;cursor:pointer}.ab-checkbox-wrap .ab-checkbox{position:absolute;transform:translateY(-50%);top:50%;left:0}.ab-checkbox-wrap:hover .ab-checkbox-content{text-decoration:underline}.ab-checkbox-content{padding-left:.24rem;display:inline-block}.ab-checkbox-wrap.ab-checkbox-reverse .ab-checkbox{left:auto;right:0}.ab-checkbox-wrap.ab-checkbox-reverse .ab-checkbox-content{padding-left:0;padding-right:.24rem}.ab-checkbox-wrap.ab-checkbox-disabled{cursor:not-allowed;color:rgba(0,0,0,.25)}.ab-checkbox-wrap.ab-checkbox-disabled .ab-checkbox-content{text-decoration:none!important}
1
+ .ab-checkbox{display:inline-block;position:relative;font-size:0;cursor:pointer}.ab-checkbox-input{position:absolute;opacity:0;margin:0;padding:0;width:100%;height:100%;cursor:pointer;z-index:2}.ab-checkbox-inner{display:inline-block;position:relative;width:.16rem;height:.16rem;transition:.3s;border:.02rem solid #b0b0b0;border-radius:.02rem;background-color:#fff}.ab-checkbox-icon{visibility:hidden;position:absolute;width:.06rem;height:.1rem;left:20%;top:40%;transform:rotate(45deg) scale(0) translate(-50%,-50%);transition:.2s;border:.02rem solid #e84040;border-top:none;border-left:none}.ab-checkbox.ab-checkbox-checked .ab-checkbox-icon{visibility:visible;transform:rotate(45deg) scale(1) translate(-50%,-50%)}.ab-checkbox.ab-checkbox-disabled{cursor:not-allowed;color:rgba(0,0,0,.25)}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-inner{border-color:#f0f0f0;background-color:#f5f5f5}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-icon{border-color:#cecece}.ab-checkbox.ab-checkbox-disabled .ab-checkbox-content{text-decoration:none}.ab-checkbox-wrap{display:inline-block;position:relative;cursor:pointer}.ab-checkbox-wrap .ab-checkbox{position:absolute;transform:translateY(-50%);top:50%;left:0}.ab-checkbox-wrap:hover .ab-checkbox-content{text-decoration:underline}.ab-checkbox-content{padding-left:.24rem;display:inline-block}.ab-checkbox-wrap.ab-checkbox-reverse .ab-checkbox{left:auto;right:0}.ab-checkbox-wrap.ab-checkbox-reverse .ab-checkbox-content{padding-left:0;padding-right:.24rem}.ab-checkbox-wrap.ab-checkbox-disabled{cursor:not-allowed;color:rgba(0,0,0,.25)}.ab-checkbox-wrap.ab-checkbox-disabled .ab-checkbox-content{text-decoration:none}