@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,98 +9,72 @@ 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
  import React from 'react';
30
24
  import { CSSTransition } from 'react-transition-group';
31
25
  import classNames from 'classnames';
32
-
33
- var Collapse =
34
- /** @class */
35
- function (_super) {
26
+ var Collapse = /** @class */function (_super) {
36
27
  __extends(Collapse, _super);
37
-
38
28
  function Collapse(props) {
39
29
  var _this = _super.call(this, props) || this;
40
-
41
30
  _this.prefixCls = 'ab-collapse';
42
-
43
31
  _this.onEnter = function (el) {
44
32
  _this.cacheHeight = "".concat(el.offsetHeight, "px");
45
33
  el.style.height = '0px';
46
34
  };
47
-
48
35
  _this.onEntering = function (el) {
49
36
  el.style.height = _this.cacheHeight;
50
37
  };
51
-
52
38
  _this.onEntered = function (el) {
53
39
  el.style.height = '';
54
-
55
40
  if (_this.props.onEntered) {
56
41
  _this.props.onEntered(el, _this.props.name);
57
42
  }
58
43
  };
59
-
60
44
  _this.onExit = function (el) {
61
45
  el.style.height = "".concat(el.offsetHeight, "px");
62
46
  };
63
-
64
47
  _this.onExiting = function (el) {
65
48
  el.style.height = '0px';
66
49
  };
67
-
68
50
  _this.onExited = function (el) {
69
51
  el.style.height = '';
70
-
71
52
  if (_this.props.onExited) {
72
53
  _this.props.onExited(el, _this.props.name);
73
54
  }
74
55
  };
75
-
76
56
  _this.onChange = function () {
77
57
  var visible = !_this.state.visible;
78
-
79
58
  if (!('visible' in _this.props)) {
80
59
  var isUserClicked = _this.state.isUserClicked || visible;
81
-
82
60
  _this.setState({
83
61
  visible: visible,
84
62
  isUserClicked: isUserClicked
85
63
  });
86
64
  }
87
-
88
65
  var _a = _this.props,
89
- onChange = _a.onChange,
90
- name = _a.name;
91
-
66
+ onChange = _a.onChange,
67
+ name = _a.name;
92
68
  if (onChange) {
93
69
  onChange(visible, name);
94
70
  }
95
71
  };
96
-
97
72
  _this.state = {
98
73
  visible: props.defaultVisible,
99
74
  isUserClicked: false
100
75
  };
101
76
  return _this;
102
77
  }
103
-
104
78
  Collapse.getDerivedStateFromProps = function (nextProps, preState) {
105
79
  if ('visible' in nextProps) {
106
80
  var isUserClicked = preState.isUserClicked || nextProps.visible;
@@ -109,25 +83,19 @@ function (_super) {
109
83
  isUserClicked: isUserClicked
110
84
  };
111
85
  }
112
-
113
86
  return null;
114
87
  };
115
-
116
88
  Collapse.prototype.renderTitle = function () {
117
89
  var title = this.props.title;
118
-
119
90
  if (!title) {
120
91
  return null;
121
92
  }
122
-
123
93
  var child;
124
-
125
94
  if (typeof title === 'function') {
126
95
  child = title(this.state.visible);
127
96
  } else {
128
97
  child = React.Children.only(title);
129
98
  }
130
-
131
99
  return /*#__PURE__*/React.cloneElement(child, {
132
100
  onClick: child.props.onClick || this.onChange
133
101
  });
@@ -135,19 +103,16 @@ function (_super) {
135
103
  /**
136
104
  * @returns {*}
137
105
  */
138
-
139
-
140
106
  Collapse.prototype.renderContent = function () {
141
107
  var _a;
142
-
143
108
  var _b = this.props,
144
- children = _b.children,
145
- className = _b.className,
146
- appear = _b.appear,
147
- mountOnEnter = _b.mountOnEnter;
109
+ children = _b.children,
110
+ className = _b.className,
111
+ appear = _b.appear,
112
+ mountOnEnter = _b.mountOnEnter;
148
113
  var _c = this.state,
149
- visible = _c.visible,
150
- isUserClicked = _c.isUserClicked;
114
+ visible = _c.visible,
115
+ isUserClicked = _c.isUserClicked;
151
116
  var cls = this.prefixCls;
152
117
  return /*#__PURE__*/React.createElement(CSSTransition, {
153
118
  "in": visible,
@@ -167,12 +132,10 @@ function (_super) {
167
132
  className: "".concat(cls, "-content")
168
133
  }, children)));
169
134
  };
170
-
171
135
  Collapse.prototype.render = function () {
172
136
  return /*#__PURE__*/React.createElement(React.Fragment, null, this.renderTitle(), this.renderContent());
173
- }; // 默认值
174
-
175
-
137
+ };
138
+ // 默认值
176
139
  Collapse.defaultProps = {
177
140
  defaultVisible: false,
178
141
  appear: true,
@@ -180,5 +143,4 @@ function (_super) {
180
143
  };
181
144
  return Collapse;
182
145
  }(React.Component);
183
-
184
146
  export default Collapse;
@@ -32,6 +32,14 @@ export interface ConfirmProps extends Omit<ModalProps, 'visible'> {
32
32
  * 点击取消的回调函数
33
33
  */
34
34
  onCancel?: () => void;
35
+ /**
36
+ *自定义渲染 cancel 按钮,cancelText 和 cancelClassName 不再生效
37
+ */
38
+ renderCancel?: (onCancel: () => void) => React.ReactChild;
39
+ /**
40
+ *自定义渲染 ok 按钮,okText 和 okClassName 不再生效
41
+ */
42
+ renderOk?: (onOk: () => void) => React.ReactChild;
35
43
  }
36
44
  declare const Confirm: (config: ConfirmProps) => {
37
45
  destroy: (type?: string) => void;
@@ -2,18 +2,14 @@ var __assign = this && this.__assign || function () {
2
2
  __assign = Object.assign || function (t) {
3
3
  for (var s, i = 1, n = arguments.length; i < n; i++) {
4
4
  s = arguments[i];
5
-
6
5
  for (var p in s) {
7
6
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
7
  }
9
8
  }
10
-
11
9
  return t;
12
10
  };
13
-
14
11
  return __assign.apply(this, arguments);
15
12
  };
16
-
17
13
  import React from 'react';
18
14
  import ReactDOM from 'react-dom';
19
15
  import classNames from 'classnames';
@@ -34,16 +30,13 @@ var defaultConfig = {
34
30
  onOk: function onOk() {},
35
31
  onCancel: function onCancel() {}
36
32
  };
37
-
38
33
  var Confirm = function Confirm(config) {
39
34
  if (!canUseDOM) {
40
35
  throw new Error('Confirm use client!');
41
36
  }
42
-
43
37
  var div = document.createElement('div');
44
38
  document.body.appendChild(div);
45
39
  var currentConfig = defaultConfig;
46
-
47
40
  function updateCurrentConfig(nextConfig) {
48
41
  var cancelClassName = classNames(currentConfig.cancelClassName, nextConfig.cancelClassName);
49
42
  var okClassName = classNames(currentConfig.okClassName, nextConfig.okClassName);
@@ -53,66 +46,66 @@ var Confirm = function Confirm(config) {
53
46
  onDestroy: onDestroy
54
47
  });
55
48
  }
56
-
57
49
  updateCurrentConfig(config);
58
-
59
50
  function close(type) {
60
51
  if (type === void 0) {
61
52
  type = 'cancel';
62
- } // 防止重复触发close
63
-
64
-
53
+ }
54
+ // 防止重复触发close
65
55
  if (!currentConfig.visible) {
66
56
  return;
67
57
  }
68
-
69
58
  currentConfig = __assign(__assign({}, currentConfig), {
70
59
  visible: false
71
60
  });
72
61
  render(currentConfig);
73
-
74
62
  if (type === 'ok') {
75
63
  currentConfig.onOk();
76
64
  } else {
77
65
  currentConfig.onCancel();
78
66
  }
79
67
  }
80
-
81
68
  function onDestroy() {
82
69
  var unmountResult = ReactDOM.unmountComponentAtNode(div);
83
-
84
70
  if (unmountResult && div.parentNode) {
85
71
  try {
86
72
  div.parentNode.removeChild(div);
87
73
  } catch (e) {}
88
74
  }
89
75
  }
90
-
91
76
  function onVisible() {
92
77
  close('cancel');
93
78
  }
94
-
95
79
  function onConfirm() {
96
80
  close('ok');
97
81
  }
98
-
99
82
  function render(props) {
83
+ var className = props.className,
84
+ content = props.content,
85
+ hiddenCancel = props.hiddenCancel,
86
+ hiddenOk = props.hiddenOk,
87
+ cancelClassName = props.cancelClassName,
88
+ okClassName = props.okClassName,
89
+ okText = props.okText,
90
+ cancelText = props.cancelText,
91
+ renderOk = props.renderOk,
92
+ renderCancel = props.renderCancel,
93
+ visible = props.visible;
100
94
  ReactDOM.render( /*#__PURE__*/React.createElement(Modal, __assign({}, props, {
101
- className: classNames("".concat(prefixCls, "-wrap"), props.className),
102
- visible: props.visible,
95
+ className: classNames("".concat(prefixCls, "-wrap"), className),
96
+ visible: visible,
103
97
  onClose: onVisible
104
- }), props.content, props.hiddenCancel && props.hiddenOk ? null : /*#__PURE__*/React.createElement("div", {
98
+ }), content, hiddenCancel && hiddenOk ? null : /*#__PURE__*/React.createElement("div", {
105
99
  className: "".concat(prefixCls, "-btns")
106
- }, props.hiddenCancel ? null : /*#__PURE__*/React.createElement("button", {
107
- className: props.cancelClassName,
100
+ }, !hiddenCancel && (renderCancel ? renderCancel(onVisible) : /*#__PURE__*/React.createElement("button", {
101
+ className: cancelClassName,
108
102
  onClick: onVisible
109
- }, props.cancelText), props.hiddenOk ? null : /*#__PURE__*/React.createElement("button", {
110
- className: props.okClassName,
103
+ }, cancelText)), !hiddenOk && (renderOk ? renderOk(onConfirm) : /*#__PURE__*/React.createElement("button", {
104
+ className: okClassName,
111
105
  onClick: onConfirm
112
- }, props.okText))), div);
113
- } // 渲染组件
114
-
115
-
106
+ }, okText)))), div);
107
+ }
108
+ // 渲染组件
116
109
  render(currentConfig);
117
110
  return {
118
111
  destroy: close,
@@ -122,5 +115,4 @@ var Confirm = function Confirm(config) {
122
115
  }
123
116
  };
124
117
  };
125
-
126
118
  export default Confirm;
@@ -1 +1 @@
1
- .ab-confirm-btns{display:flex;justify-content:flex-end;padding-top:.42rem}.ab-confirm-cancel,.ab-confirm-ok{overflow:hidden;position:relative;font-size:.12rem;border-width:1px;border-style:solid;outline:0;cursor:pointer;font-weight:700;padding:.05rem .3rem;display:inline-block;color:#fff;margin-left:.3rem}.ab-confirm-ok{border-color:#bc0000;background:linear-gradient(180deg,#c00000 0,#c00000 0,#a00000 100%,#a00000 100%)}.ab-confirm-ok:hover{border-color:#bc0000;background:#bc0000}.ab-confirm-cancel{border-color:grey;background:linear-gradient(180deg,#909090 0,#909090 0,#707070 100%,#707070 100%)}.ab-confirm-cancel:hover{border-color:grey;background:grey}
1
+ .ab-mask{position:fixed;top:0;left:0;z-index:101;width:100%;height:100%;background-color:rgba(0,0,0,.45);transition:opacity .4s cubic-bezier(.7,.3,.1,1)}.ab-mask-fade-appear,.ab-mask-fade-enter{opacity:0}.ab-mask-fade-appear-active,.ab-mask-fade-enter-active,.ab-mask-fade-enter-done,.ab-mask-fade-exit{opacity:1}.ab-mask-fade-exit-active{opacity:0}.ab-mask-fade-exit-done{display:none}.ab-modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:101;overflow:auto;outline:0}.ab-modal.ab-modal-center{text-align:center}.ab-modal.ab-modal-center::before{display:inline-block;width:0;height:100%;vertical-align:middle;content:""}.ab-modal.ab-modal-center .ab-modal-content{top:0;text-align:left;display:inline-block;vertical-align:middle}.ab-modal-content{position:relative;background-color:#fff;max-width:calc(100vw - .3rem);margin-left:auto;margin-right:auto;overflow:auto;-webkit-overflow-scrolling:touch;transition:transform .3s,opacity .3s cubic-bezier(.7,.3,.1,1);z-index:101}.ab-modal-title{position:relative;width:100%}.ab-modal-title .ab-modal-times{top:50%;transform:translateY(-50%)}.ab-modal-times{position:absolute;top:.12rem;right:.12rem;font-size:.15rem;color:#b0b0b0;cursor:pointer}.ab-modal-times svg{display:block}.ab-modal-times:hover{color:#333}.ab-modal-hidden{display:none}@media only screen and (max-width:767px){.ab-modal-content{width:calc(100vw - .3rem)}}.ab-modal-fade-appear,.ab-modal-fade-enter{transform:translate3d(0,-30px,0);opacity:0}.ab-modal-fade-appear-active,.ab-modal-fade-enter-active,.ab-modal-fade-enter-done,.ab-modal-fade-exit{transform:translateZ(0);opacity:1}.ab-modal-fade-exit-active{transform:translate3d(0,-30px,0);opacity:0}.ab-modal-fade-exit-done{display:none}.ab-confirm-btns{display:flex;justify-content:flex-end;padding-top:.42rem}.ab-confirm-cancel,.ab-confirm-ok{overflow:hidden;position:relative;font-size:.12rem;border-width:1px;border-style:solid;outline:0;cursor:pointer;font-weight:700;padding:.05rem .3rem;display:inline-block;color:#fff;margin-left:.3rem}.ab-confirm-ok{border-color:#bc0000;background:linear-gradient(180deg,#c00000 0,#c00000 0,#a00000 100%,#a00000 100%)}.ab-confirm-ok:hover{border-color:#bc0000;background:#bc0000}.ab-confirm-cancel{border-color:grey;background:linear-gradient(180deg,#909090 0,#909090 0,#707070 100%,#707070 100%)}.ab-confirm-cancel:hover{border-color:grey;background:grey}
@@ -1,5 +1,4 @@
1
1
  export var DayOfWeek;
2
-
3
2
  (function (DayOfWeek) {
4
3
  DayOfWeek[DayOfWeek["Sunday"] = 0] = "Sunday";
5
4
  DayOfWeek[DayOfWeek["Monday"] = 1] = "Monday";
@@ -9,9 +8,7 @@ export var DayOfWeek;
9
8
  DayOfWeek[DayOfWeek["Friday"] = 5] = "Friday";
10
9
  DayOfWeek[DayOfWeek["Saturday"] = 6] = "Saturday";
11
10
  })(DayOfWeek || (DayOfWeek = {}));
12
-
13
11
  export var MonthOfYear;
14
-
15
12
  (function (MonthOfYear) {
16
13
  MonthOfYear[MonthOfYear["January"] = 0] = "January";
17
14
  MonthOfYear[MonthOfYear["February"] = 1] = "February";
@@ -3,21 +3,19 @@ import { compareDate, getDateValue, getDayAdd, getDaysInMonth, getEndWeekInMonth
3
3
  import { DayOfWeek } from '../DateEnum';
4
4
  import CalendarGrid from './grid';
5
5
  var weekList = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
6
-
7
6
  var getTitle = function getTitle(date) {
8
7
  return "".concat(getMonthFullName(date.getMonth()), " ").concat(date.getFullYear());
9
8
  };
10
-
11
9
  var DayCalendar = function DayCalendar(props) {
12
10
  var cls = props.prefixCls,
13
- today = props.today,
14
- minDate = props.minDate,
15
- maxDate = props.maxDate,
16
- navigatedDate = props.navigatedDate,
17
- selectedDate = props.selectedDate,
18
- onChangeNavigatedDate = props.onChangeNavigatedDate,
19
- onChangeSelectedDate = props.onChangeSelectedDate,
20
- firstDayOfWeek = props.firstDayOfWeek;
11
+ today = props.today,
12
+ minDate = props.minDate,
13
+ maxDate = props.maxDate,
14
+ navigatedDate = props.navigatedDate,
15
+ selectedDate = props.selectedDate,
16
+ onChangeNavigatedDate = props.onChangeNavigatedDate,
17
+ onChangeSelectedDate = props.onChangeSelectedDate,
18
+ firstDayOfWeek = props.firstDayOfWeek;
21
19
  var onPrev = useCallback(function () {
22
20
  onChangeNavigatedDate(getMonthAdd(navigatedDate, -1));
23
21
  }, [navigatedDate, onChangeNavigatedDate]);
@@ -27,79 +25,66 @@ var DayCalendar = function DayCalendar(props) {
27
25
  var onSelect = useCallback(function (date) {
28
26
  onChangeSelectedDate(date);
29
27
  }, [onChangeSelectedDate]);
30
-
31
28
  var _a = useMemo(function () {
32
- var getItem = function getItem(date, isOut) {
33
- if (isOut === void 0) {
34
- isOut = false;
35
- }
36
-
37
- var disabled = isOutOfDate(date, minDate, maxDate);
38
- return {
39
- value: date,
40
- name: date.getDate(),
41
- disabled: disabled,
42
- selected: compareDate(date, selectedDate) === 0,
43
- isToday: compareDate(date, today) === 0,
44
- onClick: disabled ? null : function () {
45
- return onSelect(date);
46
- },
47
- className: !disabled && isOut ? "".concat(cls, "-out") : null
29
+ var getItem = function getItem(date, isOut) {
30
+ if (isOut === void 0) {
31
+ isOut = false;
32
+ }
33
+ var disabled = isOutOfDate(date, minDate, maxDate);
34
+ return {
35
+ value: date,
36
+ name: date.getDate(),
37
+ disabled: disabled,
38
+ selected: compareDate(date, selectedDate) === 0,
39
+ isToday: compareDate(date, today) === 0,
40
+ onClick: disabled ? null : function () {
41
+ return onSelect(date);
42
+ },
43
+ className: !disabled && isOut ? "".concat(cls, "-out") : null
44
+ };
48
45
  };
49
- };
50
-
51
- var currentTitle = getTitle(navigatedDate);
52
- var currentHeadList = weekList.slice(firstDayOfWeek, weekList.length).concat(weekList.slice(0, firstDayOfWeek));
53
- var dayList = [];
54
-
55
- var _a = getDateValue(navigatedDate),
46
+ var currentTitle = getTitle(navigatedDate);
47
+ var currentHeadList = weekList.slice(firstDayOfWeek, weekList.length).concat(weekList.slice(0, firstDayOfWeek));
48
+ var dayList = [];
49
+ var _a = getDateValue(navigatedDate),
56
50
  navigatedYear = _a.year,
57
51
  navigatedMonth = _a.month;
58
-
59
- var thisMonthDays = getDaysInMonth(navigatedDate);
60
- var thisMonthFirstDay = getMonthStart(navigatedYear, navigatedMonth);
61
- var firstWeekday = getStartWeekInMonth(navigatedDate);
62
- var lastWeekday = getEndWeekInMonth(navigatedDate);
63
-
64
- if (firstWeekday !== firstDayOfWeek) {
65
- // 补充上个月的日子
66
- var lackDay = firstWeekday - firstDayOfWeek > 0 ? firstWeekday - firstDayOfWeek : firstDayOfWeek - firstWeekday;
67
-
68
- for (var i = lackDay; i > 0; i--) {
69
- dayList.push(getItem(getDayAdd(thisMonthFirstDay, -i), true));
52
+ var thisMonthDays = getDaysInMonth(navigatedDate);
53
+ var thisMonthFirstDay = getMonthStart(navigatedYear, navigatedMonth);
54
+ var firstWeekday = getStartWeekInMonth(navigatedDate);
55
+ var lastWeekday = getEndWeekInMonth(navigatedDate);
56
+ if (firstWeekday !== firstDayOfWeek) {
57
+ // 补充上个月的日子
58
+ var lackDay = firstWeekday - firstDayOfWeek > 0 ? firstWeekday - firstDayOfWeek : firstDayOfWeek - firstWeekday;
59
+ for (var i = lackDay; i > 0; i--) {
60
+ dayList.push(getItem(getDayAdd(thisMonthFirstDay, -i), true));
61
+ }
62
+ }
63
+ for (var thisMonth = 0; thisMonth < thisMonthDays; thisMonth++) {
64
+ dayList.push(getItem(getDayAdd(thisMonthFirstDay, thisMonth)));
70
65
  }
71
- }
72
-
73
- for (var thisMonth = 0; thisMonth < thisMonthDays; thisMonth++) {
74
- dayList.push(getItem(getDayAdd(thisMonthFirstDay, thisMonth)));
75
- }
76
-
77
- var weekEndDay = (firstDayOfWeek + 6) % 7;
78
- var thisMonthLastDay = getMonthEnd(navigatedYear, navigatedMonth);
79
-
80
- if (lastWeekday !== weekEndDay) {
81
- // 补充下个月的日子
82
- var lackDay = weekEndDay - lastWeekday > 0 ? weekEndDay - lastWeekday : lastWeekday - weekEndDay;
83
-
84
- for (var i = 1; i <= lackDay; i++) {
85
- dayList.push(getItem(getDayAdd(thisMonthLastDay, i), true));
66
+ var weekEndDay = (firstDayOfWeek + 6) % 7;
67
+ var thisMonthLastDay = getMonthEnd(navigatedYear, navigatedMonth);
68
+ if (lastWeekday !== weekEndDay) {
69
+ // 补充下个月的日子
70
+ var lackDay = weekEndDay - lastWeekday > 0 ? weekEndDay - lastWeekday : lastWeekday - weekEndDay;
71
+ for (var i = 1; i <= lackDay; i++) {
72
+ dayList.push(getItem(getDayAdd(thisMonthLastDay, i), true));
73
+ }
86
74
  }
87
- }
88
-
89
- return {
90
- title: currentTitle,
91
- startDate: dayList[0].value,
92
- endDate: dayList[dayList.length - 1].value,
93
- headList: currentHeadList,
94
- dateList: dayList
95
- };
96
- }, [today, navigatedDate, minDate, maxDate, firstDayOfWeek, selectedDate, onSelect, cls]),
97
- title = _a.title,
98
- startDate = _a.startDate,
99
- endDate = _a.endDate,
100
- headList = _a.headList,
101
- dateList = _a.dateList;
102
-
75
+ return {
76
+ title: currentTitle,
77
+ startDate: dayList[0].value,
78
+ endDate: dayList[dayList.length - 1].value,
79
+ headList: currentHeadList,
80
+ dateList: dayList
81
+ };
82
+ }, [today, navigatedDate, minDate, maxDate, firstDayOfWeek, selectedDate, onSelect, cls]),
83
+ title = _a.title,
84
+ startDate = _a.startDate,
85
+ endDate = _a.endDate,
86
+ headList = _a.headList,
87
+ dateList = _a.dateList;
103
88
  var prevEnabled = minDate ? compareDate(minDate, startDate) < 0 : true;
104
89
  var nextEnabled = maxDate ? compareDate(endDate, maxDate) < 0 : true;
105
90
  return /*#__PURE__*/React.createElement("div", {
@@ -113,7 +98,6 @@ var DayCalendar = function DayCalendar(props) {
113
98
  onNext: nextEnabled ? onNext : null
114
99
  }));
115
100
  };
116
-
117
101
  DayCalendar.defaultProps = {
118
102
  firstDayOfWeek: DayOfWeek.Sunday
119
103
  };