zartui 2.1.6 → 2.1.7

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/es/action-sheet/index.js +15 -26
  2. package/es/area/index.js +5 -41
  3. package/es/avatar/index.js +3 -16
  4. package/es/back-top/index.js +4 -19
  5. package/es/badge/index.js +4 -12
  6. package/es/button/index.js +20 -40
  7. package/es/calendar/components/Header.js +3 -12
  8. package/es/calendar/components/Month.js +12 -65
  9. package/es/calendar/index.js +23 -94
  10. package/es/calendar/types.js +9 -15
  11. package/es/calendar/utils.js +5 -16
  12. package/es/cascader/index.js +4 -37
  13. package/es/cell/index.js +19 -37
  14. package/es/cell-group/index.js +5 -8
  15. package/es/checkbox/index.js +4 -11
  16. package/es/checkbox-group/index.js +4 -9
  17. package/es/col/index.js +6 -11
  18. package/es/collapse/index.js +2 -5
  19. package/es/collapse-item/index.js +19 -35
  20. package/es/count-down/index.js +2 -15
  21. package/es/count-down/utils.js +3 -10
  22. package/es/datetime-picker/DatePicker.js +12 -70
  23. package/es/datetime-picker/TimePicker.js +10 -23
  24. package/es/datetime-picker/index.js +2 -26
  25. package/es/datetime-picker/shared.js +5 -21
  26. package/es/datetime-picker/utils.js +0 -5
  27. package/es/dialog/Dialog.js +6 -21
  28. package/es/dialog/index.js +0 -16
  29. package/es/divider/index.js +5 -6
  30. package/es/dropdown-item/index.js +13 -39
  31. package/es/dropdown-menu/index.js +4 -9
  32. package/es/empty/images/Developing.js +0 -3
  33. package/es/empty/images/EmptyInterface.js +0 -3
  34. package/es/empty/images/EmptyResult.js +0 -3
  35. package/es/empty/images/FindNull.js +0 -3
  36. package/es/empty/images/NetworkError.js +0 -3
  37. package/es/empty/images/NotFound.js +0 -3
  38. package/es/empty/images/ReportSuccess.js +0 -3
  39. package/es/empty/images/Restricted.js +0 -3
  40. package/es/empty/images/ServerError.js +0 -3
  41. package/es/empty/index.js +3 -11
  42. package/es/field/index.js +21 -86
  43. package/es/fold-dialog/index.js +5 -20
  44. package/es/form/index.js +2 -18
  45. package/es/grid/index.js +2 -6
  46. package/es/grid-item/index.js +18 -30
  47. package/es/hierarchy-select/breadcrumb.js +2 -6
  48. package/es/hierarchy-select/index.js +13 -15
  49. package/es/hierarchy-select/markList.js +9 -30
  50. package/es/hierarchy-select/svg/SubIcon.js +0 -1
  51. package/es/icon/index.js +9 -13
  52. package/es/image/index.js +3 -19
  53. package/es/image-preview/ImagePreview.js +4 -8
  54. package/es/image-preview/ImagePreviewItem.js +14 -30
  55. package/es/image-preview/index.js +0 -12
  56. package/es/image-preview/shared.js +2 -4
  57. package/es/index-anchor/index.js +2 -6
  58. package/es/index-bar/IndexIndicate.js +0 -1
  59. package/es/index-bar/index.js +7 -28
  60. package/es/index.js +1 -4
  61. package/es/info/index.js +6 -8
  62. package/es/list/index.js +11 -27
  63. package/es/loading/index.js +7 -15
  64. package/es/locale/index.js +0 -2
  65. package/es/media-picker/index.js +34 -120
  66. package/es/media-picker/media-util.js +2 -5
  67. package/es/media-picker/type.js +9 -14
  68. package/es/media-picker/wx-util.js +0 -1
  69. package/es/media-player/index.js +7 -19
  70. package/es/mixins/bind-event.js +0 -3
  71. package/es/mixins/checkbox.js +5 -11
  72. package/es/mixins/click-outside.js +0 -2
  73. package/es/mixins/close-on-popstate.js +0 -1
  74. package/es/mixins/field.js +0 -2
  75. package/es/mixins/popup/index.js +12 -28
  76. package/es/mixins/popup/overlay.js +1 -11
  77. package/es/mixins/portal.js +2 -8
  78. package/es/mixins/relation.js +0 -8
  79. package/es/mixins/slots.js +1 -4
  80. package/es/mixins/touch.js +4 -9
  81. package/es/multiple-picker/MultiplePickerOptions.js +3 -20
  82. package/es/multiple-picker/index.js +5 -17
  83. package/es/nav-bar/index.js +4 -12
  84. package/es/notice-bar/index.js +10 -28
  85. package/es/number-keyboard/Key.js +2 -10
  86. package/es/number-keyboard/index.js +4 -19
  87. package/es/overlay/index.js +5 -8
  88. package/es/password-input/index.js +10 -16
  89. package/es/picker/PickerColumn.js +21 -56
  90. package/es/picker/index.js +12 -45
  91. package/es/popover/index.js +65 -90
  92. package/es/popup/index.js +5 -21
  93. package/es/pull-refresh/index.js +10 -29
  94. package/es/radio/index.js +2 -4
  95. package/es/radio-group/index.js +2 -4
  96. package/es/rate/index.js +12 -26
  97. package/es/row/index.js +3 -9
  98. package/es/search/index.js +9 -15
  99. package/es/signature/bezier.js +13 -20
  100. package/es/signature/force-landscape.js +0 -5
  101. package/es/signature/index.js +5 -24
  102. package/es/signature/point.js +1 -6
  103. package/es/signature/throttle.js +1 -10
  104. package/es/skeleton/index.js +5 -15
  105. package/es/slider/index.js +19 -55
  106. package/es/step/index.js +5 -12
  107. package/es/stepper/index.js +11 -39
  108. package/es/steps/index.js +2 -4
  109. package/es/sticky/index.js +8 -50
  110. package/es/swipe/index.js +19 -62
  111. package/es/swipe-cell/index.js +7 -23
  112. package/es/swipe-item/index.js +10 -19
  113. package/es/switch/index.js +8 -10
  114. package/es/switch/shared.js +1 -0
  115. package/es/switch-cell/index.js +7 -7
  116. package/es/tab/index.js +4 -15
  117. package/es/tabbar/index.js +4 -14
  118. package/es/tabbar-item/index.js +7 -15
  119. package/es/table/index.js +5 -28
  120. package/es/table/type.js +3 -4
  121. package/es/tabs/Content.js +5 -9
  122. package/es/tabs/Title.js +11 -20
  123. package/es/tabs/index.js +16 -51
  124. package/es/tabs/utils.js +0 -8
  125. package/es/tag/index.js +13 -17
  126. package/es/text-ellipsis/index.js +25 -42
  127. package/es/timeline/index.js +2 -25
  128. package/es/toast/Toast.js +11 -23
  129. package/es/toast/index.js +6 -33
  130. package/es/toast/lock-click.js +0 -2
  131. package/es/uploader/index.js +11 -62
  132. package/es/uploader/utils.js +0 -10
  133. package/es/utils/constant.js +2 -1
  134. package/es/utils/create/bem.js +1 -5
  135. package/es/utils/create/component.js +4 -8
  136. package/es/utils/create/i18n.js +0 -2
  137. package/es/utils/deep-assign.js +0 -4
  138. package/es/utils/deep-clone.js +0 -3
  139. package/es/utils/dom/event.js +2 -5
  140. package/es/utils/dom/node.js +0 -1
  141. package/es/utils/dom/raf.js +7 -6
  142. package/es/utils/dom/reset-scroll.js +2 -1
  143. package/es/utils/dom/scroll.js +8 -17
  144. package/es/utils/dom/style.js +3 -2
  145. package/es/utils/easings.js +2 -4
  146. package/es/utils/format/date-util.js +54 -122
  147. package/es/utils/format/number.js +2 -11
  148. package/es/utils/format/string.js +0 -3
  149. package/es/utils/format/unit.js +2 -12
  150. package/es/utils/functional.js +6 -9
  151. package/es/utils/getScroll.js +0 -5
  152. package/es/utils/index.js +3 -5
  153. package/es/utils/interceptor.js +2 -4
  154. package/es/utils/media/image-util.js +7 -19
  155. package/es/utils/raf.js +4 -12
  156. package/es/utils/router.js +7 -6
  157. package/es/utils/scrollTo.js +10 -15
  158. package/es/utils/validate/number.js +2 -2
  159. package/es/utils/vnodes.js +2 -8
  160. package/lib/action-sheet/index.js +12 -37
  161. package/lib/area/index.js +7 -48
  162. package/lib/avatar/index.js +5 -21
  163. package/lib/back-top/index.js +6 -28
  164. package/lib/badge/index.js +6 -18
  165. package/lib/button/index.js +20 -52
  166. package/lib/calendar/FastForwardImg.js +2 -3
  167. package/lib/calendar/SlowForwardImg.js +2 -3
  168. package/lib/calendar/components/Header.js +5 -21
  169. package/lib/calendar/components/Month.js +14 -74
  170. package/lib/calendar/index.js +23 -109
  171. package/lib/calendar/types.js +11 -22
  172. package/lib/calendar/utils.js +18 -46
  173. package/lib/cascader/index.js +6 -49
  174. package/lib/cell/index.js +19 -50
  175. package/lib/cell/shared.js +2 -3
  176. package/lib/cell-group/index.js +6 -17
  177. package/lib/checkbox/index.js +6 -17
  178. package/lib/checkbox-group/index.js +6 -16
  179. package/lib/col/index.js +8 -17
  180. package/lib/collapse/index.js +4 -11
  181. package/lib/collapse-item/index.js +20 -46
  182. package/lib/count-down/index.js +4 -22
  183. package/lib/count-down/utils.js +5 -17
  184. package/lib/datetime-picker/DatePicker.js +14 -84
  185. package/lib/datetime-picker/TimePicker.js +12 -33
  186. package/lib/datetime-picker/index.js +7 -41
  187. package/lib/datetime-picker/shared.js +9 -35
  188. package/lib/datetime-picker/utils.js +2 -11
  189. package/lib/dialog/Dialog.js +8 -31
  190. package/lib/dialog/index.js +1 -24
  191. package/lib/divider/index.js +6 -14
  192. package/lib/dropdown-item/index.js +14 -52
  193. package/lib/dropdown-menu/index.js +6 -18
  194. package/lib/empty/context.js +2 -3
  195. package/lib/empty/images/Developing.js +2 -9
  196. package/lib/empty/images/EmptyInterface.js +2 -9
  197. package/lib/empty/images/EmptyResult.js +2 -9
  198. package/lib/empty/images/FindNull.js +2 -9
  199. package/lib/empty/images/NetworkError.js +2 -9
  200. package/lib/empty/images/NotFound.js +2 -9
  201. package/lib/empty/images/ReportSuccess.js +2 -9
  202. package/lib/empty/images/Restricted.js +2 -9
  203. package/lib/empty/images/ServerError.js +2 -9
  204. package/lib/empty/index.js +5 -26
  205. package/lib/field/ClearIcon.js +2 -3
  206. package/lib/field/SearchIcon.js +2 -3
  207. package/lib/field/index.js +22 -99
  208. package/lib/fold-dialog/index.js +7 -25
  209. package/lib/form/index.js +4 -24
  210. package/lib/grid/index.js +4 -13
  211. package/lib/grid-item/index.js +19 -40
  212. package/lib/hierarchy-select/breadcrumb.js +5 -13
  213. package/lib/hierarchy-select/index.js +16 -26
  214. package/lib/hierarchy-select/markList.js +12 -39
  215. package/lib/hierarchy-select/svg/SubIcon.js +2 -4
  216. package/lib/icon/index.js +9 -21
  217. package/lib/image/index.js +4 -25
  218. package/lib/image-preview/ImagePreview.js +2 -19
  219. package/lib/image-preview/ImagePreviewItem.js +15 -39
  220. package/lib/image-preview/index.js +1 -18
  221. package/lib/image-preview/shared.js +3 -8
  222. package/lib/index-anchor/index.js +4 -14
  223. package/lib/index-bar/IndexIndicate.js +2 -4
  224. package/lib/index-bar/index.js +9 -40
  225. package/lib/index.js +5 -164
  226. package/lib/info/index.js +7 -16
  227. package/lib/lazyload/index.js +1 -5
  228. package/lib/list/index.js +12 -36
  229. package/lib/loading/index.js +8 -23
  230. package/lib/locale/index.js +2 -10
  231. package/lib/locale/lang/de-DE-formal.js +2 -3
  232. package/lib/locale/lang/de-DE.js +2 -3
  233. package/lib/locale/lang/en-US.js +2 -3
  234. package/lib/locale/lang/es-ES.js +2 -3
  235. package/lib/locale/lang/fr-FR.js +2 -3
  236. package/lib/locale/lang/ja-JP.js +2 -3
  237. package/lib/locale/lang/nb-NO.js +2 -3
  238. package/lib/locale/lang/ro-RO.js +2 -3
  239. package/lib/locale/lang/th-TH.js +2 -3
  240. package/lib/locale/lang/tr-TR.js +2 -3
  241. package/lib/locale/lang/zh-CN.js +2 -3
  242. package/lib/locale/lang/zh-HK.js +2 -3
  243. package/lib/locale/lang/zh-TW.js +2 -3
  244. package/lib/media-picker/image/DefaultAudioIcon.js +2 -3
  245. package/lib/media-picker/image/DefaultDocIcon.js +2 -3
  246. package/lib/media-picker/image/DefaultExcelIcon.js +2 -3
  247. package/lib/media-picker/image/DefaultFileIcon.js +2 -3
  248. package/lib/media-picker/image/DefaultPdfIcon.js +2 -3
  249. package/lib/media-picker/image/DefaultPptIcon.js +2 -3
  250. package/lib/media-picker/image/DefaultTextIcon.js +2 -3
  251. package/lib/media-picker/image/DefaultVideoIcon.js +2 -3
  252. package/lib/media-picker/image/DeleteIcon.js +2 -3
  253. package/lib/media-picker/image/Img64.js +4 -7
  254. package/lib/media-picker/image/PickFileIcon.js +2 -3
  255. package/lib/media-picker/image/PickPhotoIcon.js +2 -3
  256. package/lib/media-picker/image/ReUpload.js +2 -3
  257. package/lib/media-picker/image/TakeAudioIcon.js +2 -3
  258. package/lib/media-picker/image/TakePhotoIcon.js +2 -3
  259. package/lib/media-picker/image/TakeVideoIcon.js +2 -3
  260. package/lib/media-picker/index.js +32 -164
  261. package/lib/media-picker/media-util.js +9 -22
  262. package/lib/media-picker/type.js +10 -18
  263. package/lib/media-picker/wx-util.js +4 -15
  264. package/lib/media-player/index.js +8 -27
  265. package/lib/mixins/bind-event.js +1 -6
  266. package/lib/mixins/checkbox.js +8 -21
  267. package/lib/mixins/click-outside.js +3 -8
  268. package/lib/mixins/close-on-popstate.js +2 -7
  269. package/lib/mixins/field.js +2 -5
  270. package/lib/mixins/popup/context.js +2 -3
  271. package/lib/mixins/popup/index.js +12 -38
  272. package/lib/mixins/popup/overlay.js +3 -25
  273. package/lib/mixins/portal.js +2 -9
  274. package/lib/mixins/relation.js +0 -11
  275. package/lib/mixins/slots.js +3 -8
  276. package/lib/mixins/touch.js +6 -14
  277. package/lib/multiple-picker/MultiplePickerOptions.js +4 -26
  278. package/lib/multiple-picker/index.js +7 -29
  279. package/lib/multiple-picker/shared.js +3 -5
  280. package/lib/nav-bar/index.js +6 -19
  281. package/lib/notice-bar/CloseIcon.js +2 -3
  282. package/lib/notice-bar/MenuIcon.js +2 -3
  283. package/lib/notice-bar/NoticeIcon.js +2 -3
  284. package/lib/notice-bar/OpenIcon.js +2 -3
  285. package/lib/notice-bar/TipIcon.js +2 -3
  286. package/lib/notice-bar/WarningIcon.js +2 -3
  287. package/lib/notice-bar/index.js +12 -43
  288. package/lib/number-keyboard/CollapseIcon.js +2 -3
  289. package/lib/number-keyboard/DeleteIcon.js +2 -3
  290. package/lib/number-keyboard/Key.js +4 -20
  291. package/lib/number-keyboard/index.js +6 -29
  292. package/lib/overlay/index.js +6 -18
  293. package/lib/password-input/index.js +11 -25
  294. package/lib/picker/PickerColumn.js +24 -71
  295. package/lib/picker/index.js +14 -59
  296. package/lib/picker/shared.js +3 -5
  297. package/lib/popover/index.js +65 -104
  298. package/lib/popup/index.js +7 -30
  299. package/lib/pull-refresh/index.js +11 -38
  300. package/lib/radio/index.js +4 -10
  301. package/lib/radio-group/index.js +4 -11
  302. package/lib/rate/index.js +13 -34
  303. package/lib/row/index.js +5 -15
  304. package/lib/search/index.js +8 -23
  305. package/lib/signature/bezier.js +14 -25
  306. package/lib/signature/force-landscape.js +5 -19
  307. package/lib/signature/index.js +8 -34
  308. package/lib/signature/point.js +2 -11
  309. package/lib/signature/throttle.js +1 -11
  310. package/lib/skeleton/index.js +6 -23
  311. package/lib/slider/index.js +21 -66
  312. package/lib/step/index.js +7 -21
  313. package/lib/stepper/index.js +12 -49
  314. package/lib/steps/index.js +4 -10
  315. package/lib/sticky/index.js +10 -62
  316. package/lib/swipe/index.js +21 -73
  317. package/lib/swipe-cell/index.js +9 -32
  318. package/lib/swipe-item/index.js +12 -27
  319. package/lib/switch/index.js +9 -17
  320. package/lib/switch/shared.js +3 -4
  321. package/lib/switch-cell/index.js +7 -18
  322. package/lib/tab/index.js +6 -24
  323. package/lib/tabbar/index.js +6 -22
  324. package/lib/tabbar-item/index.js +7 -24
  325. package/lib/table/index.js +7 -38
  326. package/lib/table/type.js +3 -5
  327. package/lib/tabs/Content.js +7 -18
  328. package/lib/tabs/Title.js +13 -27
  329. package/lib/tabs/index.js +17 -68
  330. package/lib/tabs/utils.js +0 -13
  331. package/lib/tag/index.js +13 -25
  332. package/lib/text-ellipsis/index.js +27 -49
  333. package/lib/timeline/index.js +4 -35
  334. package/lib/timeline/svg/current.js +2 -3
  335. package/lib/timeline/svg/pass.js +2 -3
  336. package/lib/toast/Toast.js +12 -33
  337. package/lib/toast/index.js +7 -40
  338. package/lib/toast/lock-click.js +0 -3
  339. package/lib/toast/svg/SuccessIcon.js +2 -3
  340. package/lib/toast/svg/WarnIcon.js +2 -3
  341. package/lib/uploader/index.js +12 -75
  342. package/lib/uploader/utils.js +4 -21
  343. package/lib/utils/constant.js +12 -21
  344. package/lib/utils/create/bem.js +1 -6
  345. package/lib/utils/create/component.js +6 -17
  346. package/lib/utils/create/i18n.js +0 -8
  347. package/lib/utils/create/index.js +0 -4
  348. package/lib/utils/deep-assign.js +0 -6
  349. package/lib/utils/deep-clone.js +0 -5
  350. package/lib/utils/device.js +1 -3
  351. package/lib/utils/dom/event.js +5 -14
  352. package/lib/utils/dom/node.js +0 -2
  353. package/lib/utils/dom/raf.js +9 -13
  354. package/lib/utils/dom/reset-scroll.js +2 -4
  355. package/lib/utils/dom/scroll.js +16 -37
  356. package/lib/utils/dom/style.js +3 -3
  357. package/lib/utils/easings.js +2 -5
  358. package/lib/utils/format/date-util.js +88 -203
  359. package/lib/utils/format/number.js +4 -15
  360. package/lib/utils/format/string.js +0 -5
  361. package/lib/utils/format/unit.js +2 -16
  362. package/lib/utils/functional.js +7 -15
  363. package/lib/utils/getScroll.js +1 -8
  364. package/lib/utils/index.js +10 -26
  365. package/lib/utils/interceptor.js +2 -6
  366. package/lib/utils/media/image-util.js +10 -28
  367. package/lib/utils/raf.js +4 -13
  368. package/lib/utils/router.js +10 -13
  369. package/lib/utils/scrollTo.js +12 -24
  370. package/lib/utils/validate/date.js +0 -2
  371. package/lib/utils/validate/email.js +0 -1
  372. package/lib/utils/validate/mobile.js +0 -1
  373. package/lib/utils/validate/number.js +3 -5
  374. package/lib/utils/validate/system.js +0 -3
  375. package/lib/utils/vnodes.js +2 -9
  376. package/lib/zart.js +2324 -4741
  377. package/lib/zart.min.js +7 -1
  378. package/package.json +1 -1
@@ -5,22 +5,18 @@ import { getScrollTop, getElementTop, getScroller } from '../utils/dom/scroll';
5
5
  import { BindEventMixin } from '../mixins/bind-event';
6
6
  import { TouchMixin } from '../mixins/touch';
7
7
  import Loading from '../loading';
8
-
9
8
  var _createNamespace = createNamespace('sticky'),
10
- createComponent = _createNamespace[0],
11
- bem = _createNamespace[1];
12
-
9
+ createComponent = _createNamespace[0],
10
+ bem = _createNamespace[1];
13
11
  export default createComponent({
14
12
  mixins: [BindEventMixin(function (bind, isBind) {
15
13
  if (!this.scroller) {
16
14
  this.scroller = getScroller(this.$el);
17
15
  }
18
-
19
16
  if (this.observer) {
20
17
  var method = isBind ? 'observe' : 'unobserve';
21
18
  this.observer[method](this.$el);
22
19
  }
23
-
24
20
  bind(this.scroller, 'scroll', this.onScroll, true);
25
21
  this.onScroll();
26
22
  }), TouchMixin],
@@ -92,21 +88,16 @@ export default createComponent({
92
88
  if (!this.fixed) {
93
89
  return;
94
90
  }
95
-
96
91
  var style = {};
97
-
98
92
  if (isDef(this.zIndex)) {
99
93
  style.zIndex = this.zIndex;
100
94
  }
101
-
102
95
  if (this.offsetTopPx && this.fixed) {
103
96
  style.top = this.offsetTopPx + "px";
104
97
  }
105
-
106
98
  if (this.transform) {
107
99
  style.transform = "translate3d(0, " + this.transform + "px, 0)";
108
100
  }
109
-
110
101
  return style;
111
102
  }
112
103
  },
@@ -117,7 +108,6 @@ export default createComponent({
117
108
  },
118
109
  created: function created() {
119
110
  var _this2 = this;
120
-
121
111
  // compatibility: https://caniuse.com/#feat=intersectionobserver
122
112
  if (!isServer && window.IntersectionObserver) {
123
113
  this.observer = new IntersectionObserver(function (entries) {
@@ -136,31 +126,25 @@ export default createComponent({
136
126
  methods: {
137
127
  onScroll: function onScroll() {
138
128
  var _this3 = this;
139
-
140
129
  // if(!this.overScroll&&this.refresh){
141
130
  // return
142
131
  // }
143
132
  var container = this.container,
144
- offsetTopPx = this.offsetTopPx;
145
-
133
+ offsetTopPx = this.offsetTopPx;
146
134
  if (isHidden(this.$el)) {
147
135
  return;
148
136
  }
149
-
150
137
  setTimeout(function () {
151
138
  if (_this3.refresh && _this3.refreshtopToPageTop === null) {
152
139
  _this3.refreshtopToPageTop = getElementTop(_this3.$el);
153
140
  }
154
141
  }, 500);
155
-
156
142
  if (this.refresh && this.refreshOffsetTop === null) {
157
143
  this.refreshOffsetTop = this.offsetTopPx;
158
144
  }
159
-
160
145
  this.height = this.$el.offsetHeight;
161
146
  var scrollTop = getScrollTop(window);
162
147
  var topToPageTop = getElementTop(this.$el);
163
-
164
148
  var emitScrollEvent = function emitScrollEvent() {
165
149
  _this3.$emit('scroll', {
166
150
  scrollTop: scrollTop,
@@ -168,18 +152,14 @@ export default createComponent({
168
152
  distance: overpx + scrollTop + offsetTopPx - topToPageTop
169
153
  });
170
154
  };
171
-
172
- var overpx = this.refresh && this.lockfixed ? this.refreshDistance : 0; // The sticky component should be kept inside the container element
173
-
155
+ var overpx = this.refresh && this.lockfixed ? this.refreshDistance : 0;
156
+ // The sticky component should be kept inside the container element
174
157
  var currentY = document.documentElement.scrollTop || document.body.scrollTop;
175
158
  this.pull = currentY < this.refreshtopToPageTop - this.offsetTopPx;
176
-
177
159
  if (container) {
178
160
  var bottomToPageTop = topToPageTop - overpx + container.offsetHeight;
179
-
180
161
  if (scrollTop + offsetTopPx + this.height > bottomToPageTop) {
181
162
  var distanceToBottom = this.height + scrollTop - bottomToPageTop;
182
-
183
163
  if (distanceToBottom < this.height) {
184
164
  this.fixed = true;
185
165
  this.transform = -(distanceToBottom + offsetTopPx);
@@ -188,12 +168,10 @@ export default createComponent({
188
168
  this.fixed = false;
189
169
  this.lockfixed = false;
190
170
  }
191
-
192
171
  emitScrollEvent();
193
172
  return;
194
173
  }
195
174
  }
196
-
197
175
  if (scrollTop + offsetTopPx > topToPageTop - overpx) {
198
176
  this.fixed = true;
199
177
  this.lockfixed = true;
@@ -202,45 +180,33 @@ export default createComponent({
202
180
  this.lockfixed = false;
203
181
  this.fixed = false;
204
182
  }
205
-
206
183
  if (this.refresh && this.pc && !this.touchOn) {
207
184
  this.t1 = getScrollTop(window);
208
185
  clearTimeout(this.timer);
209
-
210
186
  var _this = this;
211
-
212
187
  this.timer = setTimeout(function () {
213
188
  _this.t2 = getScrollTop(window);
214
-
215
189
  if (!_this.autoScroll) {
216
190
  return;
217
191
  }
218
-
219
192
  var currentY = document.documentElement.scrollTop || document.body.scrollTop;
220
-
221
193
  if (_this.refresh && !_this.fixed && getScrollTop(window) > _this.refreshtopToPageTop * _this.updownPercent / 100) {
222
194
  _this.scrollAnimation(currentY, _this.refreshtopToPageTop - _this.refreshOffsetTop, true);
223
-
224
195
  _this.touchOn = false;
225
196
  return;
226
197
  } else if (_this.refresh && !_this.fixed && getScrollTop(window) <= _this.refreshtopToPageTop * _this.updownPercent / 100) {
227
198
  _this.scrollAnimation(currentY, 0, false);
228
-
229
199
  _this.touchOn = false;
230
200
  return;
231
201
  } else if (_this.refresh && _this.fixed && currentY < _this.refreshtopToPageTop - _this.offsetTopPx) {
232
202
  _this.$emit('refreshcallback');
233
-
234
203
  _this.scrollAnimation(currentY, _this.refreshtopToPageTop - _this.refreshOffsetTop, true);
235
-
236
204
  _this.touchOn = false;
237
205
  return;
238
206
  }
239
-
240
207
  _this.touchOn = false;
241
208
  }, _this.delayTime);
242
209
  }
243
-
244
210
  emitScrollEvent();
245
211
  },
246
212
  onTouchStart: function onTouchStart(event) {
@@ -249,7 +215,6 @@ export default createComponent({
249
215
  },
250
216
  onTouchMove: function onTouchMove(event) {
251
217
  this.touchMove(event);
252
-
253
218
  if (this.deltaY > 10) {
254
219
  this.overScroll = true;
255
220
  }
@@ -258,10 +223,8 @@ export default createComponent({
258
223
  if (!this.autoScroll) {
259
224
  return;
260
225
  }
261
-
262
226
  var that = this;
263
227
  var currentY = document.documentElement.scrollTop || document.body.scrollTop;
264
-
265
228
  if (this.refresh && !this.fixed && getScrollTop(window) > this.refreshtopToPageTop * this.updownPercent / 100) {
266
229
  this.scrollAnimation(currentY, this.refreshtopToPageTop - this.refreshOffsetTop, true);
267
230
  this.touchOn = false;
@@ -276,23 +239,19 @@ export default createComponent({
276
239
  this.touchOn = false;
277
240
  return;
278
241
  }
279
-
280
242
  this.touchOn = false;
281
243
  },
282
244
  renderLoading: function renderLoading() {
283
245
  var h = this.$createElement;
284
-
285
246
  if (this.lockfixed && this.refresh && this.touchOn && this.pull && this.pulling) {
286
247
  if (this.$slots.pull) {
287
248
  return this.slots('pull');
288
249
  }
289
-
290
250
  return h(Loading);
291
251
  }
292
252
  },
293
253
  scrollAnimation: function scrollAnimation(currentY, targetY, lockfixed) {
294
254
  var _this4 = this;
295
-
296
255
  // 获取当前位置方法
297
256
  // 计算需要移动的距离
298
257
  var needScrollTop = targetY - currentY;
@@ -301,8 +260,9 @@ export default createComponent({
301
260
  // 一次调用滑动帧数,每次调用会不一样
302
261
  var dist = Math.ceil(needScrollTop / _this4.scrollSpeed);
303
262
  _currentY += dist;
304
- window.scrollTo(_currentY, currentY); // 如果移动幅度小于十个像素,直接移动,否则递归调用,实现动画效果
263
+ window.scrollTo(_currentY, currentY);
305
264
 
265
+ // 如果移动幅度小于十个像素,直接移动,否则递归调用,实现动画效果
306
266
  if (needScrollTop > _this4.scrollSpeed || needScrollTop < -_this4.scrollSpeed) {
307
267
  _this4.scrollAnimation(_currentY, targetY, lockfixed);
308
268
  } else {
@@ -315,15 +275,13 @@ export default createComponent({
315
275
  render: function render() {
316
276
  var h = arguments[0];
317
277
  var fixed = this.fixed,
318
- cover = this.cover;
278
+ cover = this.cover;
319
279
  var style = {
320
280
  height: fixed ? this.height + "px" : null
321
281
  };
322
-
323
282
  if (cover && this.fixed) {
324
283
  style.width = "100%";
325
284
  }
326
-
327
285
  return h("div", {
328
286
  "style": style
329
287
  }, [h("div", {
package/es/swipe/index.js CHANGED
@@ -3,22 +3,20 @@ import { createNamespace } from '../utils';
3
3
  import { isHidden } from '../utils/dom/style';
4
4
  import { preventDefault } from '../utils/dom/event';
5
5
  import { doubleRaf } from '../utils/dom/raf';
6
- import { range } from '../utils/format/number'; // Mixins
6
+ import { range } from '../utils/format/number';
7
7
 
8
+ // Mixins
8
9
  import { TouchMixin } from '../mixins/touch';
9
10
  import { ParentMixin } from '../mixins/relation';
10
11
  import { BindEventMixin } from '../mixins/bind-event';
11
-
12
12
  var _createNamespace = createNamespace('swipe'),
13
- createComponent = _createNamespace[0],
14
- bem = _createNamespace[1];
15
-
13
+ createComponent = _createNamespace[0],
14
+ bem = _createNamespace[1];
16
15
  export default createComponent({
17
16
  mixins: [TouchMixin, ParentMixin('vanSwipe'), BindEventMixin(function (bind, isBind) {
18
17
  bind(window, 'resize', this.resize, true);
19
18
  bind(window, 'orientationchange', this.resize, true);
20
19
  bind(window, 'visibilitychange', this.onVisibilityChange);
21
-
22
20
  if (isBind) {
23
21
  this.initialize();
24
22
  } else {
@@ -113,14 +111,12 @@ export default createComponent({
113
111
  transitionDuration: (this.swiping ? 0 : this.duration) + "ms",
114
112
  transform: "translate" + (this.vertical ? 'Y' : 'X') + "(" + this.offset + "px)"
115
113
  };
116
-
117
114
  if (this.size) {
118
115
  var mainAxis = this.vertical ? 'height' : 'width';
119
116
  var crossAxis = this.vertical ? 'width' : 'height';
120
117
  style[mainAxis] = this.trackSize + "px";
121
118
  style[crossAxis] = this[crossAxis] ? this[crossAxis] + "px" : '';
122
119
  }
123
-
124
120
  return style;
125
121
  },
126
122
  indicatorStyle: function indicatorStyle() {
@@ -141,11 +137,9 @@ export default createComponent({
141
137
  if (active === void 0) {
142
138
  active = +this.initialSwipe;
143
139
  }
144
-
145
140
  if (!this.$el || isHidden(this.$el)) {
146
141
  return;
147
142
  }
148
-
149
143
  clearTimeout(this.timer);
150
144
  var rect = {
151
145
  width: this.$el.offsetWidth,
@@ -183,7 +177,6 @@ export default createComponent({
183
177
  onTouchMove: function onTouchMove(event) {
184
178
  if (!this.touchable || !this.swiping) return;
185
179
  this.touchMove(event);
186
-
187
180
  if (this.isCorrectDirection) {
188
181
  preventDefault(event, this.stopPropagation);
189
182
  this.move({
@@ -194,21 +187,18 @@ export default createComponent({
194
187
  onTouchEnd: function onTouchEnd() {
195
188
  if (!this.touchable || !this.swiping) return;
196
189
  var size = this.size,
197
- delta = this.delta;
190
+ delta = this.delta;
198
191
  var duration = Date.now() - this.touchStartTime;
199
192
  var speed = delta / duration;
200
193
  var shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta) > size / 2;
201
-
202
194
  if (shouldSwipe && this.isCorrectDirection) {
203
195
  var offset = this.vertical ? this.offsetY : this.offsetX;
204
196
  var pace = 0;
205
-
206
197
  if (this.loop) {
207
198
  pace = offset > 0 ? delta > 0 ? -1 : 1 : 0;
208
199
  } else {
209
200
  pace = -Math[delta > 0 ? 'ceil' : 'floor'](delta / size);
210
201
  }
211
-
212
202
  this.move({
213
203
  pace: pace,
214
204
  emitChange: true
@@ -218,79 +208,66 @@ export default createComponent({
218
208
  pace: 0
219
209
  });
220
210
  }
221
-
222
211
  this.swiping = false;
223
212
  this.autoPlay();
224
213
  },
225
214
  getTargetActive: function getTargetActive(pace) {
226
215
  var active = this.active,
227
- count = this.count,
228
- maxCount = this.maxCount;
229
-
216
+ count = this.count,
217
+ maxCount = this.maxCount;
230
218
  if (pace) {
231
219
  if (this.loop) {
232
220
  return range(active + pace, -1, count);
233
221
  }
234
-
235
222
  return range(active + pace, 0, maxCount);
236
223
  }
237
-
238
224
  return active;
239
225
  },
240
226
  getTargetOffset: function getTargetOffset(targetActive, offset) {
241
227
  if (offset === void 0) {
242
228
  offset = 0;
243
229
  }
244
-
245
230
  var currentPosition = targetActive * this.size;
246
-
247
231
  if (!this.loop) {
248
232
  currentPosition = Math.min(currentPosition, -this.minOffset);
249
233
  }
250
-
251
234
  var targetOffset = offset - currentPosition;
252
-
253
235
  if (!this.loop) {
254
236
  targetOffset = range(targetOffset, this.minOffset, 0);
255
237
  }
256
-
257
238
  return targetOffset;
258
239
  },
259
240
  move: function move(_ref) {
260
241
  var _ref$pace = _ref.pace,
261
- pace = _ref$pace === void 0 ? 0 : _ref$pace,
262
- _ref$offset = _ref.offset,
263
- offset = _ref$offset === void 0 ? 0 : _ref$offset,
264
- emitChange = _ref.emitChange;
242
+ pace = _ref$pace === void 0 ? 0 : _ref$pace,
243
+ _ref$offset = _ref.offset,
244
+ offset = _ref$offset === void 0 ? 0 : _ref$offset,
245
+ emitChange = _ref.emitChange;
265
246
  var loop = this.loop,
266
- count = this.count,
267
- active = this.active,
268
- children = this.children,
269
- trackSize = this.trackSize,
270
- minOffset = this.minOffset;
271
-
247
+ count = this.count,
248
+ active = this.active,
249
+ children = this.children,
250
+ trackSize = this.trackSize,
251
+ minOffset = this.minOffset;
272
252
  if (count <= 1) {
273
253
  return;
274
254
  }
275
-
276
255
  var targetActive = this.getTargetActive(pace);
277
- var targetOffset = this.getTargetOffset(targetActive, offset); // auto move first and last swipe in loop mode
256
+ var targetOffset = this.getTargetOffset(targetActive, offset);
278
257
 
258
+ // auto move first and last swipe in loop mode
279
259
  if (loop) {
280
260
  if (children[0] && targetOffset !== minOffset) {
281
261
  var outRightBound = targetOffset < minOffset;
282
262
  children[0].offset = outRightBound ? trackSize : 0;
283
263
  }
284
-
285
264
  if (children[count - 1] && targetOffset !== 0) {
286
265
  var outLeftBound = targetOffset > 0;
287
266
  children[count - 1].offset = outLeftBound ? -trackSize : 0;
288
267
  }
289
268
  }
290
-
291
269
  this.active = targetActive;
292
270
  this.offset = targetOffset;
293
-
294
271
  if (emitChange && targetActive !== active) {
295
272
  this.$emit('change', this.activeIndicator);
296
273
  }
@@ -298,12 +275,10 @@ export default createComponent({
298
275
  // @exposed-api
299
276
  prev: function prev() {
300
277
  var _this = this;
301
-
302
278
  this.correctPosition();
303
279
  this.resetTouchStatus();
304
280
  doubleRaf(function () {
305
281
  _this.swiping = false;
306
-
307
282
  _this.move({
308
283
  pace: -1,
309
284
  emitChange: true
@@ -313,12 +288,10 @@ export default createComponent({
313
288
  // @exposed-api
314
289
  next: function next() {
315
290
  var _this2 = this;
316
-
317
291
  this.correctPosition();
318
292
  this.resetTouchStatus();
319
293
  doubleRaf(function () {
320
294
  _this2.swiping = false;
321
-
322
295
  _this2.move({
323
296
  pace: 1,
324
297
  emitChange: true
@@ -328,22 +301,18 @@ export default createComponent({
328
301
  // @exposed-api
329
302
  swipeTo: function swipeTo(index, options) {
330
303
  var _this3 = this;
331
-
332
304
  if (options === void 0) {
333
305
  options = {};
334
306
  }
335
-
336
307
  this.correctPosition();
337
308
  this.resetTouchStatus();
338
309
  doubleRaf(function () {
339
310
  var targetIndex;
340
-
341
311
  if (_this3.loop && index === _this3.count) {
342
312
  targetIndex = _this3.active === 0 ? 0 : index;
343
313
  } else {
344
314
  targetIndex = index % _this3.count;
345
315
  }
346
-
347
316
  if (options.immediate) {
348
317
  doubleRaf(function () {
349
318
  _this3.swiping = false;
@@ -351,7 +320,6 @@ export default createComponent({
351
320
  } else {
352
321
  _this3.swiping = false;
353
322
  }
354
-
355
323
  _this3.move({
356
324
  pace: targetIndex - _this3.active,
357
325
  emitChange: true
@@ -360,13 +328,11 @@ export default createComponent({
360
328
  },
361
329
  correctPosition: function correctPosition() {
362
330
  this.swiping = true;
363
-
364
331
  if (this.active <= -1) {
365
332
  this.move({
366
333
  pace: this.count
367
334
  });
368
335
  }
369
-
370
336
  if (this.active >= this.count) {
371
337
  this.move({
372
338
  pace: -this.count
@@ -378,21 +344,17 @@ export default createComponent({
378
344
  },
379
345
  autoPlay: function autoPlay() {
380
346
  var _this4 = this;
381
-
382
347
  var autoplay = this.autoplay;
383
-
384
348
  if (autoplay > 0 && this.count > 1) {
385
349
  this.clear();
386
350
  this.timer = setTimeout(function () {
387
351
  _this4.next();
388
-
389
352
  _this4.autoPlay();
390
353
  }, autoplay);
391
354
  }
392
355
  },
393
356
  titleDiv: function titleDiv() {
394
357
  var h = this.$createElement;
395
-
396
358
  if (this.$slots.title) {
397
359
  return this.$slots.title;
398
360
  } else if (this.title) {
@@ -401,7 +363,6 @@ export default createComponent({
401
363
  "class": bem('title')
402
364
  }, [this.title[this.active == this.count ? 0 : this.active]]);
403
365
  }
404
-
405
366
  return h("div", {
406
367
  "class": bem('title')
407
368
  }, [this.title]);
@@ -411,7 +372,6 @@ export default createComponent({
411
372
  },
412
373
  foot: function foot() {
413
374
  var h = this.$createElement;
414
-
415
375
  if (this.title) {
416
376
  return h("div", {
417
377
  "class": bem('foot')
@@ -422,16 +382,13 @@ export default createComponent({
422
382
  },
423
383
  genIndicator: function genIndicator() {
424
384
  var _this5 = this;
425
-
426
385
  var h = this.$createElement;
427
386
  var count = this.count,
428
- activeIndicator = this.activeIndicator;
387
+ activeIndicator = this.activeIndicator;
429
388
  var slot = this.slots('indicator');
430
-
431
389
  if (slot) {
432
390
  return slot;
433
391
  }
434
-
435
392
  if (this.showIndicators && count > 1) {
436
393
  return h("div", {
437
394
  "class": bem('indicators', {
@@ -1,15 +1,14 @@
1
1
  // Utils
2
2
  import { createNamespace } from '../utils';
3
3
  import { range } from '../utils/format/number';
4
- import { preventDefault } from '../utils/dom/event'; // Mixins
4
+ import { preventDefault } from '../utils/dom/event';
5
5
 
6
+ // Mixins
6
7
  import { TouchMixin } from '../mixins/touch';
7
8
  import { ClickOutsideMixin } from '../mixins/click-outside';
8
-
9
9
  var _createNamespace = createNamespace('swipe-cell'),
10
- createComponent = _createNamespace[0],
11
- bem = _createNamespace[1];
12
-
10
+ createComponent = _createNamespace[0],
11
+ bem = _createNamespace[1];
13
12
  var THRESHOLD = 0.15;
14
13
  export default createComponent({
15
14
  mixins: [TouchMixin, ClickOutsideMixin({
@@ -53,7 +52,6 @@ export default createComponent({
53
52
  var rect = this.$refs[ref].getBoundingClientRect();
54
53
  return rect.width;
55
54
  }
56
-
57
55
  return 0;
58
56
  },
59
57
  // @exposed-api
@@ -72,7 +70,6 @@ export default createComponent({
72
70
  // @exposed-api
73
71
  close: function close(position) {
74
72
  this.offset = 0;
75
-
76
73
  if (this.opened) {
77
74
  this.opened = false;
78
75
  this.$emit('close', {
@@ -85,7 +82,6 @@ export default createComponent({
85
82
  if (this.disabled) {
86
83
  return;
87
84
  }
88
-
89
85
  this.startOffset = this.offset;
90
86
  this.touchStart(event);
91
87
  },
@@ -93,32 +89,27 @@ export default createComponent({
93
89
  if (this.disabled) {
94
90
  return;
95
91
  }
96
-
97
92
  this.touchMove(event);
98
-
99
93
  if (this.direction === 'horizontal') {
100
94
  this.dragging = true;
101
95
  this.lockClick = true;
102
96
  var isPrevent = !this.opened || this.deltaX * this.startOffset < 0;
103
-
104
97
  if (isPrevent) {
105
98
  preventDefault(event, this.stopPropagation);
106
99
  }
107
-
108
100
  this.offset = range(this.deltaX + this.startOffset, -this.computedRightWidth, this.computedLeftWidth);
109
101
  }
110
102
  },
111
103
  onTouchEnd: function onTouchEnd() {
112
104
  var _this = this;
113
-
114
105
  if (this.disabled) {
115
106
  return;
116
107
  }
117
-
118
108
  if (this.dragging) {
119
109
  this.toggle(this.offset > 0 ? 'left' : 'right');
120
- this.dragging = false; // compatible with desktop scenario
110
+ this.dragging = false;
121
111
 
112
+ // compatible with desktop scenario
122
113
  setTimeout(function () {
123
114
  _this.lockClick = false;
124
115
  }, 0);
@@ -128,8 +119,7 @@ export default createComponent({
128
119
  var offset = Math.abs(this.offset);
129
120
  var threshold = this.opened ? 1 - THRESHOLD : THRESHOLD;
130
121
  var computedLeftWidth = this.computedLeftWidth,
131
- computedRightWidth = this.computedRightWidth;
132
-
122
+ computedRightWidth = this.computedRightWidth;
133
123
  if (computedRightWidth && direction === 'right' && offset > computedRightWidth * threshold) {
134
124
  this.open('right');
135
125
  } else if (computedLeftWidth && direction === 'left' && offset > computedLeftWidth * threshold) {
@@ -142,9 +132,7 @@ export default createComponent({
142
132
  if (position === void 0) {
143
133
  position = 'outside';
144
134
  }
145
-
146
135
  this.$emit('click', position);
147
-
148
136
  if (this.opened && !this.lockClick) {
149
137
  if (this.beforeClose) {
150
138
  this.beforeClose({
@@ -163,19 +151,16 @@ export default createComponent({
163
151
  },
164
152
  getClickHandler: function getClickHandler(position, stop) {
165
153
  var _this2 = this;
166
-
167
154
  return function (event) {
168
155
  if (stop) {
169
156
  event.stopPropagation();
170
157
  }
171
-
172
158
  _this2.onClick(position);
173
159
  };
174
160
  },
175
161
  genLeftPart: function genLeftPart() {
176
162
  var h = this.$createElement;
177
163
  var content = this.slots('left');
178
-
179
164
  if (content) {
180
165
  return h("div", {
181
166
  "ref": "left",
@@ -189,7 +174,6 @@ export default createComponent({
189
174
  genRightPart: function genRightPart() {
190
175
  var h = this.$createElement;
191
176
  var content = this.slots('right');
192
-
193
177
  if (content) {
194
178
  return h("div", {
195
179
  "ref": "right",