@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
package/lib/move/index.js CHANGED
@@ -1,30 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = void 0;
11
-
12
9
  var _react = _interopRequireDefault(require("react"));
13
-
14
10
  var ReactIs = _interopRequireWildcard(require("react-is"));
15
-
16
11
  var _classnames = _interopRequireDefault(require("classnames"));
17
-
18
12
  var _utils = require("@autobest-ui/utils");
19
-
20
13
  var _range = require("./range");
21
-
22
14
  var _utils2 = require("./utils");
23
-
24
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
-
26
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
-
28
17
  var __extends = void 0 && (void 0).__extends || function () {
29
18
  var _extendStatics = function extendStatics(d, b) {
30
19
  _extendStatics = Object.setPrototypeOf || {
@@ -36,52 +25,37 @@ var __extends = void 0 && (void 0).__extends || function () {
36
25
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
37
26
  }
38
27
  };
39
-
40
28
  return _extendStatics(d, b);
41
29
  };
42
-
43
30
  return function (d, b) {
44
31
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
45
-
46
32
  _extendStatics(d, b);
47
-
48
33
  function __() {
49
34
  this.constructor = d;
50
35
  }
51
-
52
36
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
53
37
  };
54
38
  }();
55
-
56
39
  var __assign = void 0 && (void 0).__assign || function () {
57
40
  __assign = Object.assign || function (t) {
58
41
  for (var s, i = 1, n = arguments.length; i < n; i++) {
59
42
  s = arguments[i];
60
-
61
43
  for (var p in s) {
62
44
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
63
45
  }
64
46
  }
65
-
66
47
  return t;
67
48
  };
68
-
69
49
  return __assign.apply(this, arguments);
70
50
  };
71
-
72
51
  var defaultPosition = {
73
52
  left: 0,
74
53
  top: 0
75
54
  };
76
-
77
- var Move =
78
- /** @class */
79
- function (_super) {
55
+ var Move = /** @class */function (_super) {
80
56
  __extends(Move, _super);
81
-
82
57
  function Move() {
83
58
  var _this = _super !== null && _super.apply(this, arguments) || this;
84
-
85
59
  _this.prefixCls = 'ab-move';
86
60
  _this.prevElementSize = {
87
61
  width: 0,
@@ -103,41 +77,33 @@ function (_super) {
103
77
  _this.currentScaleSize = 1;
104
78
  _this.scaleStart = 0;
105
79
  _this.scaleEnd = 0;
106
- _this.isTouchScale = false; // 强制刷新元素位置
107
-
80
+ _this.isTouchScale = false;
81
+ // 强制刷新元素位置
108
82
  _this.isForceUpdatePlacement = false;
109
83
  _this.moveRef = /*#__PURE__*/_react.default.createRef();
110
84
  _this.updateTimer = null;
111
-
112
85
  _this.refreshInfo = function (el, prevProps) {
113
86
  var element = el || _this.getDomNode();
114
-
115
87
  if (!element) {
116
88
  return;
117
89
  }
118
-
119
90
  var parentNode = element.parentNode;
120
-
121
91
  if (!parentNode) {
122
92
  return;
123
93
  }
124
-
125
94
  var elementSize = (0, _utils.getElementSize)(element);
126
95
  _this.elementSize = {
127
96
  width: elementSize.width,
128
97
  height: elementSize.height
129
98
  };
130
-
131
99
  if (_this.elementSize.width !== _this.prevElementSize.width || _this.elementSize.height !== _this.prevElementSize.height) {
132
100
  _this.isForceUpdatePlacement = true;
133
101
  }
134
-
135
102
  _this.prevElementSize = _this.elementSize;
136
103
  _this.elementParentSize = (0, _utils.getElementSize)(parentNode, true);
137
104
  var _a = _this.props,
138
- horizontalPlacement = _a.horizontalPlacement,
139
- verticalPlacement = _a.verticalPlacement;
140
-
105
+ horizontalPlacement = _a.horizontalPlacement,
106
+ verticalPlacement = _a.verticalPlacement;
141
107
  if (!prevProps || _this.isForceUpdatePlacement || horizontalPlacement !== prevProps.horizontalPlacement || verticalPlacement !== prevProps.verticalPlacement) {
142
108
  _this.currentObj = (0, _utils2.getInitElementPlacement)({
143
109
  horizontalPlacement: horizontalPlacement,
@@ -145,41 +111,32 @@ function (_super) {
145
111
  elementSize: _this.elementSize,
146
112
  elementParentSize: _this.elementParentSize
147
113
  });
148
-
149
114
  var _b = _this.checkRange(),
150
- nextScaleSize = _b.nextScaleSize,
151
- nextX = _b.nextX,
152
- nextY = _b.nextY;
153
-
115
+ nextScaleSize = _b.nextScaleSize,
116
+ nextX = _b.nextX,
117
+ nextY = _b.nextY;
154
118
  _this.currentObj = {
155
119
  left: nextX,
156
120
  top: nextY
157
121
  };
158
122
  _this.currentScaleSize = nextScaleSize;
159
-
160
123
  _this.setElementInfo(element);
161
-
162
124
  element.style.visibility = 'visible';
163
125
  _this.isForceUpdatePlacement = false;
164
126
  }
165
127
  };
166
-
167
128
  _this.resetTranslate = function (info) {
168
129
  var element = _this.getDomNode();
169
-
170
130
  if ((0, _utils.isEmptyObject)(info) || !element) {
171
131
  return;
172
132
  }
173
-
174
133
  _this.currentObj = info;
175
134
  element.style.transition = 'transform 200ms ease-in-out';
176
-
177
135
  var _a = _this.checkRange(),
178
- nextX = _a.nextX,
179
- nextY = _a.nextY,
180
- nextScaleSize = _a.nextScaleSize,
181
- isRefresh = _a.isRefresh;
182
-
136
+ nextX = _a.nextX,
137
+ nextY = _a.nextY,
138
+ nextScaleSize = _a.nextScaleSize,
139
+ isRefresh = _a.isRefresh;
183
140
  if (isRefresh) {
184
141
  _this.currentObj = {
185
142
  left: nextX,
@@ -187,51 +144,40 @@ function (_super) {
187
144
  };
188
145
  _this.currentScaleSize = nextScaleSize;
189
146
  }
190
-
191
147
  _this.setElementInfo(element);
192
148
  };
193
-
194
149
  _this.onMousewheel = function (event, element) {
195
150
  if (event.preventDefault) {
196
151
  event.preventDefault();
197
152
  }
198
-
199
153
  if (event.stopPropagation) {
200
154
  event.stopPropagation();
201
155
  }
202
-
203
156
  var _a = _this.props,
204
- maxScalable = _a.maxScalable,
205
- minScalable = _a.minScalable;
157
+ maxScalable = _a.maxScalable,
158
+ minScalable = _a.minScalable;
206
159
  var nextScaleSize = (0, _range.filterScaleRange)(event.deltaY < 0 ? _this.currentScaleSize + 0.02 : _this.currentScaleSize - 0.02, maxScalable, minScalable);
207
-
208
160
  if (_this.currentScaleSize === nextScaleSize || _this.currentScaleSize === nextScaleSize) {
209
161
  return;
210
162
  }
211
-
212
163
  _this.currentScaleSize = nextScaleSize;
213
164
  element.style.transition = 'transform 200ms';
214
-
215
165
  _this.setElementInfo(element);
216
166
  };
217
-
218
167
  _this.onStart = function (event, element) {
219
168
  if (event.preventDefault) {
220
169
  event.preventDefault();
221
170
  }
222
-
223
171
  if (event.stopPropagation) {
224
172
  event.stopPropagation();
225
173
  }
226
-
227
174
  _this.isTouchScale = false;
228
175
  element.style.transition = '';
229
176
  var isTouch = (0, _utils.isTouchScreen)();
230
177
  _this.prevScaleSize = _this.currentScaleSize;
231
-
232
178
  if (_this.props.scalable && isTouch && event.touches.length > 1) {
233
- _this.isTouchScale = true; // 记录双指的间距长度
234
-
179
+ _this.isTouchScale = true;
180
+ // 记录双指的间距长度
235
181
  _this.scaleStart = (0, _utils2.getDistance)(event.touches);
236
182
  } else {
237
183
  _this.moveObj = __assign({}, defaultPosition);
@@ -241,43 +187,34 @@ function (_super) {
241
187
  top: event.touches ? event.touches[0].pageY : event.clientY
242
188
  };
243
189
  }
244
-
245
190
  if (!_this.moveHandler) {
246
191
  _this.moveHandler = (0, _utils.addEventListener)(window.document, isTouch ? 'touchmove' : 'mousemove', function (ev) {
247
192
  return _this.onMove(ev, element);
248
193
  });
249
194
  }
250
-
251
195
  if (!_this.endHandler) {
252
196
  _this.endHandler = (0, _utils.addEventListener)(window.document, isTouch ? 'touchend' : 'mouseup', function (ev) {
253
197
  return _this.onEnd(ev, element);
254
198
  });
255
199
  }
256
200
  };
257
-
258
201
  _this.onMove = function (event, element) {
259
202
  if (event.preventDefault) {
260
203
  event.preventDefault();
261
204
  }
262
-
263
205
  if (event.stopPropagation) {
264
206
  event.stopPropagation();
265
207
  }
266
-
267
208
  if (_this.isTouchScale && event.touches.length > 1) {
268
- _this.scaleEnd = (0, _utils2.getDistance)(event.touches); // 设置缩放尺寸
269
-
209
+ _this.scaleEnd = (0, _utils2.getDistance)(event.touches);
210
+ // 设置缩放尺寸
270
211
  _this.currentScaleSize = (_this.scaleEnd / _this.scaleStart - 1) / 2 + _this.prevScaleSize;
271
-
272
212
  _this.setElementInfo(element);
273
-
274
213
  return;
275
214
  }
276
-
277
215
  if (_this.isTouchScale && event.touches.length <= 1) {
278
216
  return;
279
217
  }
280
-
281
218
  _this.moveObj = {
282
219
  left: event.touches ? event.touches[0].pageX : event.clientX,
283
220
  top: event.touches ? event.touches[0].pageY : event.clientY
@@ -286,27 +223,21 @@ function (_super) {
286
223
  left: _this.prevObj.left + _this.moveObj.left - _this.startObj.left,
287
224
  top: _this.prevObj.top + _this.moveObj.top - _this.startObj.top
288
225
  };
289
-
290
226
  _this.setElementInfo(element);
291
227
  };
292
-
293
228
  _this.onEnd = function (event, element) {
294
229
  _this.clearHandler();
295
-
296
230
  if (event.preventDefault) {
297
231
  event.preventDefault();
298
232
  }
299
-
300
233
  if (event.stopPropagation) {
301
234
  event.stopPropagation();
302
235
  }
303
-
304
236
  var _a = _this.checkRange(),
305
- nextX = _a.nextX,
306
- nextY = _a.nextY,
307
- nextScaleSize = _a.nextScaleSize,
308
- isRefresh = _a.isRefresh;
309
-
237
+ nextX = _a.nextX,
238
+ nextY = _a.nextY,
239
+ nextScaleSize = _a.nextScaleSize,
240
+ isRefresh = _a.isRefresh;
310
241
  if (isRefresh) {
311
242
  element.style.transition = 'transform 200ms ease-in-out';
312
243
  _this.currentObj = {
@@ -314,93 +245,70 @@ function (_super) {
314
245
  top: nextY
315
246
  };
316
247
  _this.currentScaleSize = nextScaleSize;
317
-
318
248
  _this.setElementInfo(element);
319
249
  }
320
-
321
250
  var onClick = _this.props.onClick;
322
-
323
251
  if (onClick && _this.currentObj.left === _this.prevObj.left && _this.currentObj.top === _this.prevObj.top && _this.prevScaleSize === _this.currentScaleSize) {
324
252
  onClick(event);
325
253
  }
326
254
  };
327
-
328
255
  _this.onTransitionEnd = function () {
329
256
  var element = _this.getDomNode();
330
-
331
257
  if (!element) {
332
258
  return;
333
259
  }
334
-
335
260
  element.style.transition = '';
336
261
  var _a = _this.props,
337
- onAfterChange = _a.onAfterChange,
338
- name = _a.name;
339
-
262
+ onAfterChange = _a.onAfterChange,
263
+ name = _a.name;
340
264
  if (onAfterChange) {
341
265
  onAfterChange(name);
342
266
  }
343
267
  };
344
-
345
268
  return _this;
346
269
  }
347
-
348
270
  Move.prototype.componentDidMount = function () {
349
271
  this.isForceUpdatePlacement = true;
350
272
  this.componentDidUpdate();
351
273
  };
352
-
353
274
  Move.prototype.componentDidUpdate = function (prevProps) {
354
275
  var _this = this;
355
-
356
276
  clearTimeout(this.updateTimer);
357
277
  var element = this.getDomNode();
358
-
359
278
  if (!element) {
360
279
  return;
361
280
  }
362
-
363
281
  var parentNode = element.parentNode;
364
-
365
282
  if (!parentNode) {
366
283
  return;
367
284
  }
368
-
369
285
  parentNode.style.overflow = 'hidden';
370
286
  var _a = this.props,
371
- horizontalPlacement = _a.horizontalPlacement,
372
- verticalPlacement = _a.verticalPlacement;
373
-
287
+ horizontalPlacement = _a.horizontalPlacement,
288
+ verticalPlacement = _a.verticalPlacement;
374
289
  if (prevProps && (horizontalPlacement !== prevProps.horizontalPlacement || verticalPlacement !== prevProps.verticalPlacement)) {
375
290
  this.isForceUpdatePlacement = true;
376
291
  }
377
-
378
292
  this.updateTimer = setTimeout(function () {
379
293
  var currentElement = _this.getDomNode();
380
-
381
294
  if (!currentElement) {
382
295
  return;
383
296
  }
384
-
385
297
  _this.refreshInfo(currentElement, prevProps);
386
-
387
298
  var isTouch = (0, _utils.isTouchScreen)();
388
-
389
299
  if (!_this.startHandler) {
390
300
  var eventType = isTouch ? 'touchstart' : 'mousedown';
391
301
  _this.startHandler = (0, _utils.addEventListener)(currentElement, eventType, function (ev) {
392
302
  return _this.onStart(ev, currentElement);
393
303
  });
394
- } // 不支持Touch的设备监听滚动
395
-
396
-
304
+ }
305
+ // 不支持Touch的设备监听滚动
397
306
  if (_this.props.scalable && !isTouch && !_this.mousewheelHandler) {
398
307
  _this.mousewheelHandler = (0, _utils.addEventListener)(currentElement, 'wheel', function (ev) {
399
308
  return _this.onMousewheel(ev, currentElement);
400
309
  });
401
- } // 加入 resize 监听
402
-
403
-
310
+ }
311
+ // 加入 resize 监听
404
312
  if (_this.props.monitorWindowResize && !_this.resizeHandler) {
405
313
  _this.resizeHandler = (0, _utils.addEventListener)(window, 'resize', (0, _utils.throttleWithRAF)(function () {
406
314
  return _this.refreshInfo(currentElement, prevProps);
@@ -409,51 +317,40 @@ function (_super) {
409
317
  }, 0);
410
318
  this.clearHandler();
411
319
  };
412
-
413
320
  Move.prototype.componentWillUnmount = function () {
414
321
  clearTimeout(this.updateTimer);
415
-
416
322
  if (this.startHandler) {
417
323
  this.startHandler.remove();
418
324
  this.startHandler = null;
419
325
  }
420
-
421
326
  if (this.mousewheelHandler) {
422
327
  this.mousewheelHandler.remove();
423
328
  this.mousewheelHandler = null;
424
329
  }
425
-
426
330
  if (this.resizeHandler) {
427
331
  this.resizeHandler.remove();
428
332
  this.resizeHandler = null;
429
333
  }
430
-
431
334
  this.clearHandler();
432
335
  };
433
-
434
336
  Move.prototype.clearHandler = function () {
435
337
  if (this.moveHandler) {
436
338
  this.moveHandler.remove();
437
339
  this.moveHandler = null;
438
340
  }
439
-
440
341
  if (this.endHandler) {
441
342
  this.endHandler.remove();
442
343
  this.endHandler = null;
443
344
  }
444
345
  };
445
-
446
346
  Move.prototype.checkRange = function () {
447
347
  var nextScaleSize = this.currentScaleSize;
448
-
449
348
  if (this.props.scalable) {
450
349
  nextScaleSize = (0, _range.filterScaleRange)(nextScaleSize, this.props.maxScalable, this.props.minScalable);
451
350
  }
452
-
453
351
  var _a = (0, _range.filterPositionRange)(this.currentObj, this.elementSize, this.elementParentSize, nextScaleSize),
454
- left = _a.left,
455
- top = _a.top;
456
-
352
+ left = _a.left,
353
+ top = _a.top;
457
354
  return {
458
355
  isRefresh: left !== this.currentObj.left || top !== this.currentObj.top || nextScaleSize !== this.currentScaleSize,
459
356
  nextX: left,
@@ -461,24 +358,18 @@ function (_super) {
461
358
  nextScaleSize: nextScaleSize
462
359
  };
463
360
  };
464
-
465
361
  Move.prototype.setElementInfo = function (element) {
466
362
  element.style.transform = "translate(".concat(this.currentObj.left, "px, ").concat(this.currentObj.top, "px) scale(").concat(this.currentScaleSize, ")");
467
363
  };
468
-
469
364
  Move.prototype.getDomNode = function () {
470
365
  if (this.moveRef && this.moveRef.current) {
471
366
  return this.moveRef.current;
472
367
  }
473
-
474
368
  return null;
475
369
  };
476
-
477
370
  Move.prototype.render = function () {
478
371
  var children = this.props.children;
479
-
480
372
  var child = _react.default.Children.only(children);
481
-
482
373
  if (ReactIs.isElement(child) && !ReactIs.isFragment(child)) {
483
374
  return /*#__PURE__*/_react.default.cloneElement(child, {
484
375
  ref: this.moveRef,
@@ -486,10 +377,8 @@ function (_super) {
486
377
  className: (0, _classnames.default)(this.prefixCls, child.props.className)
487
378
  });
488
379
  }
489
-
490
380
  throw new Error('Move component only support HTMLElement!');
491
381
  };
492
-
493
382
  Move.defaultProps = {
494
383
  scalable: true,
495
384
  monitorWindowResize: true,
@@ -500,6 +389,5 @@ function (_super) {
500
389
  };
501
390
  return Move;
502
391
  }(_react.default.Component);
503
-
504
392
  var _default = Move;
505
393
  exports.default = _default;
package/lib/move/range.js CHANGED
@@ -5,54 +5,46 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.filterPositionRange = filterPositionRange;
7
7
  exports.filterScaleRange = filterScaleRange;
8
-
9
8
  function getPositionValue(pValue, cValue, prevValue, scaleSize) {
10
- var cScaleValue = cValue * scaleSize; // 内容缩放后扩展的一半
11
-
12
- var scaleOverValue = (cScaleValue - cValue) / 2; // 内容小于或等于父级时,滑动不能超出
13
-
9
+ var cScaleValue = cValue * scaleSize;
10
+ // 内容缩放后扩展的一半
11
+ var scaleOverValue = (cScaleValue - cValue) / 2;
12
+ // 内容小于或等于父级时,滑动不能超出
14
13
  if (pValue >= cScaleValue) {
15
14
  // 不能超出左边/上边
16
15
  if (prevValue < scaleOverValue) {
17
16
  return scaleOverValue;
18
17
  }
19
-
20
18
  if (prevValue + cScaleValue - scaleOverValue > pValue) {
21
19
  // 不能超出右边/下边
22
20
  return pValue - cScaleValue + scaleOverValue;
23
21
  }
24
- } // 内容大于父级时,
22
+ }
23
+ // 内容大于父级时,
25
24
  // 滑动时,左边/上边只能滑动到内容最左边/上边, 右边/下边可以滑动到内容最右边/下边
26
-
27
-
28
25
  if (pValue < cScaleValue) {
29
26
  // 左边只能滑动到内容最左边/上边
30
27
  if (prevValue > scaleOverValue) {
31
28
  return scaleOverValue;
32
29
  }
33
-
34
30
  if (Math.abs(prevValue) + pValue + scaleOverValue > cScaleValue) {
35
31
  // 右边可以滑动到内容最右边/下边
36
32
  return pValue - cScaleValue + scaleOverValue;
37
33
  }
38
34
  }
39
-
40
35
  return prevValue;
41
36
  }
42
-
43
37
  function filterPositionRange(positionInfo, cSize, pSize, scaleSize) {
44
38
  return {
45
39
  left: getPositionValue(pSize.width, cSize.width, positionInfo.left, scaleSize),
46
40
  top: getPositionValue(pSize.height, cSize.height, positionInfo.top, scaleSize)
47
41
  };
48
42
  }
49
-
50
43
  function filterScaleRange(nextScaleSize, maxScalable, minScalable) {
51
44
  if (nextScaleSize > maxScalable) {
52
45
  nextScaleSize = maxScalable;
53
46
  } else if (nextScaleSize < minScalable) {
54
47
  nextScaleSize = minScalable;
55
48
  }
56
-
57
49
  return nextScaleSize;
58
50
  }
package/lib/move/utils.js CHANGED
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getDistance = getDistance;
7
7
  exports.getInitElementPlacement = getInitElementPlacement;
8
-
9
8
  function getDistance(touches) {
10
9
  var start = {
11
10
  left: touches[0].pageX,
@@ -17,41 +16,33 @@ function getDistance(touches) {
17
16
  };
18
17
  return Math.sqrt(Math.pow(end.left - start.left, 2) + Math.pow(end.top - start.top, 2));
19
18
  }
20
-
21
19
  function getInitElementPlacement(_a) {
22
20
  var elementSize = _a.elementSize,
23
- elementParentSize = _a.elementParentSize,
24
- horizontalPlacement = _a.horizontalPlacement,
25
- verticalPlacement = _a.verticalPlacement;
21
+ elementParentSize = _a.elementParentSize,
22
+ horizontalPlacement = _a.horizontalPlacement,
23
+ verticalPlacement = _a.verticalPlacement;
26
24
  var translateX = 0;
27
25
  var translateY = 0;
28
-
29
26
  switch (horizontalPlacement) {
30
27
  case 'center':
31
28
  translateX = (elementParentSize.width - elementSize.width) / 2;
32
29
  break;
33
-
34
30
  case 'right':
35
31
  translateX = elementParentSize.width - elementSize.width;
36
32
  break;
37
-
38
33
  default:
39
34
  translateX = 0;
40
35
  }
41
-
42
36
  switch (verticalPlacement) {
43
37
  case 'center':
44
38
  translateY = (elementParentSize.height - elementSize.height) / 2;
45
39
  break;
46
-
47
40
  case 'bottom':
48
41
  translateY = elementParentSize.height - elementSize.height;
49
42
  break;
50
-
51
43
  default:
52
44
  translateY = 0;
53
45
  }
54
-
55
46
  return {
56
47
  left: translateX,
57
48
  top: translateY