@kengic/uni 0.3.2-beta.4 → 0.3.2-beta.6

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 (255) hide show
  1. package/dist/kengic-uni.js +2 -1527
  2. package/dist/src/index.d.ts +0 -1
  3. package/dist/uni-ui/index.ts +5 -0
  4. package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
  5. package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
  6. package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
  7. package/dist/uni-ui/uni-calendar/calendar.js +546 -0
  8. package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
  9. package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
  10. package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
  11. package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
  12. package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
  13. package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
  14. package/dist/uni-ui/uni-calendar/util.js +360 -0
  15. package/dist/uni-ui/uni-card/uni-card.vue +281 -0
  16. package/dist/uni-ui/uni-col/uni-col.vue +317 -0
  17. package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
  18. package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
  19. package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
  20. package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
  21. package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
  22. package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
  23. package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
  24. package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
  25. package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
  26. package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
  27. package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
  28. package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
  29. package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
  30. package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
  31. package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
  32. package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
  33. package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
  34. package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
  35. package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
  36. package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
  37. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  38. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  39. package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
  40. package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
  41. package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
  42. package/dist/uni-ui/uni-drawer/keypress.js +45 -0
  43. package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
  44. package/dist/uni-ui/uni-easyinput/common.js +56 -0
  45. package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
  46. package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
  47. package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
  48. package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
  49. package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
  50. package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
  51. package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
  52. package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
  53. package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
  54. package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
  55. package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
  56. package/dist/uni-ui/uni-file-picker/utils.js +109 -0
  57. package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
  58. package/dist/uni-ui/uni-forms/utils.js +293 -0
  59. package/dist/uni-ui/uni-forms/validate.js +486 -0
  60. package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
  61. package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
  62. package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
  63. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
  64. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
  65. package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
  66. package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
  67. package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
  68. package/dist/uni-ui/uni-group/uni-group.vue +134 -0
  69. package/dist/uni-ui/uni-icons/icons.js +1169 -0
  70. package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
  71. package/dist/uni-ui/uni-icons/uniicons.css +663 -0
  72. package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
  73. package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  74. package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
  75. package/dist/uni-ui/uni-link/uni-link.vue +128 -0
  76. package/dist/uni-ui/uni-list/uni-list.vue +123 -0
  77. package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
  78. package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
  79. package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
  80. package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
  81. package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
  82. package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
  83. package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
  84. package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
  85. package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
  86. package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
  87. package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
  88. package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
  89. package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
  90. package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
  91. package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
  92. package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
  93. package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
  94. package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
  95. package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
  96. package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
  97. package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
  98. package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
  99. package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
  100. package/dist/uni-ui/uni-popup/i18n/index.js +8 -0
  101. package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
  102. package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
  103. package/dist/uni-ui/uni-popup/keypress.js +45 -0
  104. package/dist/uni-ui/uni-popup/popup.js +26 -0
  105. package/dist/uni-ui/uni-popup/uni-popup.vue +473 -0
  106. package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
  107. package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
  108. package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
  109. package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
  110. package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
  111. package/dist/uni-ui/uni-row/uni-row.vue +190 -0
  112. package/dist/uni-ui/uni-scss/changelog.md +8 -0
  113. package/dist/uni-ui/uni-scss/index.scss +1 -0
  114. package/dist/uni-ui/uni-scss/package.json +82 -0
  115. package/dist/uni-ui/uni-scss/readme.md +4 -0
  116. package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
  117. package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
  118. package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
  119. package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
  120. package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
  121. package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
  122. package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
  123. package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
  124. package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
  125. package/dist/uni-ui/uni-scss/theme.scss +31 -0
  126. package/dist/uni-ui/uni-scss/variables.scss +62 -0
  127. package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
  128. package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
  129. package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
  130. package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
  131. package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
  132. package/dist/uni-ui/uni-section/uni-section.vue +167 -0
  133. package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
  134. package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
  135. package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
  136. package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
  137. package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
  138. package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
  139. package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
  140. package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
  141. package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
  142. package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
  143. package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
  144. package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
  145. package/dist/uni-ui/uni-table/uni-table.vue +455 -0
  146. package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
  147. package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
  148. package/dist/uni-ui/uni-td/uni-td.vue +90 -0
  149. package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
  150. package/dist/uni-ui/uni-th/uni-th.vue +285 -0
  151. package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
  152. package/dist/uni-ui/uni-title/uni-title.vue +171 -0
  153. package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
  154. package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
  155. package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
  156. package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
  157. package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
  158. package/package.json +3 -2
  159. package/dist/index.css +0 -1
  160. package/dist/src/components/index.d.ts +0 -5
  161. package/dist/src/components/uni-ui/uni-badge/uni-badge.vue.d.ts +0 -108
  162. package/dist/src/components/uni-ui/uni-breadcrumb/uni-breadcrumb.vue.d.ts +0 -23
  163. package/dist/src/components/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue.d.ts +0 -30
  164. package/dist/src/components/uni-ui/uni-calendar/calendar.d.ts +0 -67
  165. package/dist/src/components/uni-ui/uni-calendar/i18n/index.d.ts +0 -39
  166. package/dist/src/components/uni-ui/uni-calendar/uni-calendar-item.vue.d.ts +0 -47
  167. package/dist/src/components/uni-ui/uni-calendar/uni-calendar.vue.d.ts +0 -166
  168. package/dist/src/components/uni-ui/uni-calendar/util.d.ts +0 -211
  169. package/dist/src/components/uni-ui/uni-card/uni-card.vue.d.ts +0 -117
  170. package/dist/src/components/uni-ui/uni-col/uni-col.vue.d.ts +0 -70
  171. package/dist/src/components/uni-ui/uni-collapse/uni-collapse.vue.d.ts +0 -45
  172. package/dist/src/components/uni-ui/uni-collapse-item/uni-collapse-item.vue.d.ts +0 -102
  173. package/dist/src/components/uni-ui/uni-combox/uni-combox.vue.d.ts +0 -95
  174. package/dist/src/components/uni-ui/uni-countdown/i18n/index.d.ts +0 -21
  175. package/dist/src/components/uni-ui/uni-countdown/uni-countdown.vue.d.ts +0 -158
  176. package/dist/src/components/uni-ui/uni-data-checkbox/uni-data-checkbox.vue.d.ts +0 -192
  177. package/dist/src/components/uni-ui/uni-data-picker/uni-data-picker.vue.d.ts +0 -244
  178. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-picker.d.ts +0 -178
  179. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-pickerview.vue.d.ts +0 -169
  180. package/dist/src/components/uni-ui/uni-data-select/uni-data-select.vue.d.ts +0 -125
  181. package/dist/src/components/uni-ui/uni-dateformat/date-format.d.ts +0 -6
  182. package/dist/src/components/uni-ui/uni-dateformat/uni-dateformat.vue.d.ts +0 -57
  183. package/dist/src/components/uni-ui/uni-datetime-picker/calendar-item.vue.d.ts +0 -44
  184. package/dist/src/components/uni-ui/uni-datetime-picker/calendar.vue.d.ts +0 -253
  185. package/dist/src/components/uni-ui/uni-datetime-picker/i18n/index.d.ts +0 -69
  186. package/dist/src/components/uni-ui/uni-datetime-picker/time-picker.vue.d.ts +0 -225
  187. package/dist/src/components/uni-ui/uni-datetime-picker/uni-datetime-picker.vue.d.ts +0 -236
  188. package/dist/src/components/uni-ui/uni-datetime-picker/util.d.ts +0 -171
  189. package/dist/src/components/uni-ui/uni-drawer/keypress.d.ts +0 -13
  190. package/dist/src/components/uni-ui/uni-drawer/uni-drawer.vue.d.ts +0 -78
  191. package/dist/src/components/uni-ui/uni-easyinput/uni-easyinput.vue.d.ts +0 -269
  192. package/dist/src/components/uni-ui/uni-fab/uni-fab.vue.d.ts +0 -109
  193. package/dist/src/components/uni-ui/uni-fav/i18n/index.d.ts +0 -15
  194. package/dist/src/components/uni-ui/uni-fav/uni-fav.vue.d.ts +0 -99
  195. package/dist/src/components/uni-ui/uni-file-picker/choose-and-upload-file.d.ts +0 -4
  196. package/dist/src/components/uni-ui/uni-file-picker/uni-file-picker.vue.d.ts +0 -254
  197. package/dist/src/components/uni-ui/uni-file-picker/upload-file.vue.d.ts +0 -81
  198. package/dist/src/components/uni-ui/uni-file-picker/upload-image.vue.d.ts +0 -90
  199. package/dist/src/components/uni-ui/uni-file-picker/utils.d.ts +0 -22
  200. package/dist/src/components/uni-ui/uni-forms/uni-forms.vue.d.ts +0 -160
  201. package/dist/src/components/uni-ui/uni-forms/utils.d.ts +0 -20
  202. package/dist/src/components/uni-ui/uni-forms/validate.d.ts +0 -42
  203. package/dist/src/components/uni-ui/uni-forms-item/uni-forms-item.vue.d.ts +0 -127
  204. package/dist/src/components/uni-ui/uni-goods-nav/i18n/index.d.ts +0 -21
  205. package/dist/src/components/uni-ui/uni-goods-nav/uni-goods-nav.vue.d.ts +0 -61
  206. package/dist/src/components/uni-ui/uni-grid/uni-grid.vue.d.ts +0 -59
  207. package/dist/src/components/uni-ui/uni-grid-item/uni-grid-item.vue.d.ts +0 -26
  208. package/dist/src/components/uni-ui/uni-group/uni-group.vue.d.ts +0 -52
  209. package/dist/src/components/uni-ui/uni-icons/icons.d.ts +0 -15
  210. package/dist/src/components/uni-ui/uni-icons/uni-icons.vue.d.ts +0 -56
  211. package/dist/src/components/uni-ui/uni-indexed-list/uni-indexed-list-item.vue.d.ts +0 -45
  212. package/dist/src/components/uni-ui/uni-indexed-list/uni-indexed-list.vue.d.ts +0 -49
  213. package/dist/src/components/uni-ui/uni-link/uni-link.vue.d.ts +0 -75
  214. package/dist/src/components/uni-ui/uni-list/uni-list.vue.d.ts +0 -53
  215. package/dist/src/components/uni-ui/uni-list/uni-refresh.vue.d.ts +0 -22
  216. package/dist/src/components/uni-ui/uni-list-ad/uni-list-ad.vue.d.ts +0 -25
  217. package/dist/src/components/uni-ui/uni-list-chat/uni-list-chat.vue.d.ts +0 -123
  218. package/dist/src/components/uni-ui/uni-list-item/uni-list-item.vue.d.ts +0 -248
  219. package/dist/src/components/uni-ui/uni-load-more/i18n/index.d.ts +0 -18
  220. package/dist/src/components/uni-ui/uni-load-more/uni-load-more.vue.d.ts +0 -89
  221. package/dist/src/components/uni-ui/uni-nav-bar/uni-nav-bar.vue.d.ts +0 -163
  222. package/dist/src/components/uni-ui/uni-nav-bar/uni-status-bar.vue.d.ts +0 -4
  223. package/dist/src/components/uni-ui/uni-notice-bar/uni-notice-bar.vue.d.ts +0 -138
  224. package/dist/src/components/uni-ui/uni-number-box/uni-number-box.vue.d.ts +0 -90
  225. package/dist/src/components/uni-ui/uni-pagination/i18n/index.d.ts +0 -28
  226. package/dist/src/components/uni-ui/uni-pagination/uni-pagination.vue.d.ts +0 -127
  227. package/dist/src/components/uni-ui/uni-popup/i18n/index.d.ts +0 -24
  228. package/dist/src/components/uni-ui/uni-popup/keypress.d.ts +0 -13
  229. package/dist/src/components/uni-ui/uni-popup/popup.d.ts +0 -11
  230. package/dist/src/components/uni-ui/uni-popup/uni-popup.vue.d.ts +0 -136
  231. package/dist/src/components/uni-ui/uni-popup-dialog/uni-popup-dialog.vue.d.ts +0 -123
  232. package/dist/src/components/uni-ui/uni-popup-message/uni-popup-message.vue.d.ts +0 -67
  233. package/dist/src/components/uni-ui/uni-popup-share/uni-popup-share.vue.d.ts +0 -49
  234. package/dist/src/components/uni-ui/uni-rate/uni-rate.vue.d.ts +0 -154
  235. package/dist/src/components/uni-ui/uni-row/uni-row.vue.d.ts +0 -41
  236. package/dist/src/components/uni-ui/uni-search-bar/i18n/index.d.ts +0 -15
  237. package/dist/src/components/uni-ui/uni-search-bar/uni-search-bar.vue.d.ts +0 -126
  238. package/dist/src/components/uni-ui/uni-section/uni-section.vue.d.ts +0 -85
  239. package/dist/src/components/uni-ui/uni-segmented-control/uni-segmented-control.vue.d.ts +0 -47
  240. package/dist/src/components/uni-ui/uni-steps/uni-steps.vue.d.ts +0 -59
  241. package/dist/src/components/uni-ui/uni-swipe-action/uni-swipe-action.vue.d.ts +0 -6
  242. package/dist/src/components/uni-ui/uni-swiper-dot/uni-swiper-dot.vue.d.ts +0 -65
  243. package/dist/src/components/uni-ui/uni-table/uni-table.vue.d.ts +0 -99
  244. package/dist/src/components/uni-ui/uni-tag/uni-tag.vue.d.ts +0 -84
  245. package/dist/src/components/uni-ui/uni-tbody/uni-tbody.vue.d.ts +0 -2
  246. package/dist/src/components/uni-ui/uni-td/uni-td.vue.d.ts +0 -48
  247. package/dist/src/components/uni-ui/uni-th/filter-dropdown.vue.d.ts +0 -99
  248. package/dist/src/components/uni-ui/uni-th/uni-th.vue.d.ts +0 -97
  249. package/dist/src/components/uni-ui/uni-thead/uni-thead.vue.d.ts +0 -15
  250. package/dist/src/components/uni-ui/uni-title/uni-title.vue.d.ts +0 -54
  251. package/dist/src/components/uni-ui/uni-tooltip/uni-tooltip.vue.d.ts +0 -23
  252. package/dist/src/components/uni-ui/uni-tr/table-checkbox.vue.d.ts +0 -58
  253. package/dist/src/components/uni-ui/uni-tr/uni-tr.vue.d.ts +0 -39
  254. package/dist/src/components/uni-ui/uni-transition/createAnimation.d.ts +0 -16
  255. package/dist/src/components/uni-ui/uni-transition/uni-transition.vue.d.ts +0 -240
@@ -0,0 +1,270 @@
1
+ const MIN_DISTANCE = 10;
2
+ export default {
3
+ showWatch(newVal, oldVal, ownerInstance, instance, self) {
4
+ var state = self.state
5
+ var $el = ownerInstance.$el || ownerInstance.$vm && ownerInstance.$vm.$el
6
+ if (!$el) return
7
+ this.getDom(instance, ownerInstance, self)
8
+ if (newVal && newVal !== 'none') {
9
+ this.openState(newVal, instance, ownerInstance, self)
10
+ return
11
+ }
12
+
13
+ if (state.left) {
14
+ this.openState('none', instance, ownerInstance, self)
15
+ }
16
+ this.resetTouchStatus(instance, self)
17
+ },
18
+
19
+ /**
20
+ * 开始触摸操作
21
+ * @param {Object} e
22
+ * @param {Object} ins
23
+ */
24
+ touchstart(e, ownerInstance, self) {
25
+ let instance = e.instance;
26
+ let disabled = instance.getDataset().disabled
27
+ let state = self.state;
28
+ this.getDom(instance, ownerInstance, self)
29
+ // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
30
+ disabled = this.getDisabledType(disabled)
31
+ if (disabled) return
32
+ // 开始触摸时移除动画类
33
+ instance.requestAnimationFrame(function() {
34
+ instance.removeClass('ani');
35
+ ownerInstance.callMethod('closeSwipe');
36
+ })
37
+
38
+ // 记录上次的位置
39
+ state.x = state.left || 0
40
+ // 计算滑动开始位置
41
+ this.stopTouchStart(e, ownerInstance, self)
42
+ },
43
+
44
+ /**
45
+ * 开始滑动操作
46
+ * @param {Object} e
47
+ * @param {Object} ownerInstance
48
+ */
49
+ touchmove(e, ownerInstance, self) {
50
+ let instance = e.instance;
51
+ // 删除之后已经那不到实例了
52
+ if (!instance) return;
53
+ let disabled = instance.getDataset().disabled
54
+ let state = self.state
55
+ // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
56
+ disabled = this.getDisabledType(disabled)
57
+ if (disabled) return
58
+ // 是否可以滑动页面
59
+ this.stopTouchMove(e, self);
60
+ if (state.direction !== 'horizontal') {
61
+ return;
62
+ }
63
+ if (e.preventDefault) {
64
+ // 阻止页面滚动
65
+ e.preventDefault()
66
+ }
67
+ let x = state.x + state.deltaX
68
+ this.move(x, instance, ownerInstance, self)
69
+ },
70
+
71
+ /**
72
+ * 结束触摸操作
73
+ * @param {Object} e
74
+ * @param {Object} ownerInstance
75
+ */
76
+ touchend(e, ownerInstance, self) {
77
+ let instance = e.instance;
78
+ let disabled = instance.getDataset().disabled
79
+ let state = self.state
80
+ // fix by mehaotian, TODO 兼容 app-vue 获取dataset为字符串 , h5 获取 为 undefined 的问题,待框架修复
81
+ disabled = this.getDisabledType(disabled)
82
+
83
+ if (disabled) return
84
+ // 滑动过程中触摸结束,通过阙值判断是开启还是关闭
85
+ // fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13
86
+ this.moveDirection(state.left, instance, ownerInstance, self)
87
+
88
+ },
89
+
90
+ /**
91
+ * 设置移动距离
92
+ * @param {Object} value
93
+ * @param {Object} instance
94
+ * @param {Object} ownerInstance
95
+ */
96
+ move(value, instance, ownerInstance, self) {
97
+ value = value || 0
98
+ let state = self.state
99
+ let leftWidth = state.leftWidth
100
+ let rightWidth = state.rightWidth
101
+ // 获取可滑动范围
102
+ state.left = this.range(value, -rightWidth, leftWidth);
103
+ instance.requestAnimationFrame(function() {
104
+ instance.setStyle({
105
+ transform: 'translateX(' + state.left + 'px)',
106
+ '-webkit-transform': 'translateX(' + state.left + 'px)'
107
+ })
108
+ })
109
+
110
+ },
111
+
112
+ /**
113
+ * 获取元素信息
114
+ * @param {Object} instance
115
+ * @param {Object} ownerInstance
116
+ */
117
+ getDom(instance, ownerInstance, self) {
118
+ var state = self.state
119
+ var $el = ownerInstance.$el || ownerInstance.$vm && ownerInstance.$vm.$el
120
+ var leftDom = $el.querySelector('.button-group--left')
121
+ var rightDom = $el.querySelector('.button-group--right')
122
+
123
+ state.leftWidth = leftDom.offsetWidth || 0
124
+ state.rightWidth = rightDom.offsetWidth || 0
125
+ state.threshold = instance.getDataset().threshold
126
+ },
127
+
128
+ getDisabledType(value) {
129
+ return (typeof(value) === 'string' ? JSON.parse(value) : value) || false;
130
+ },
131
+
132
+ /**
133
+ * 获取范围
134
+ * @param {Object} num
135
+ * @param {Object} min
136
+ * @param {Object} max
137
+ */
138
+ range(num, min, max) {
139
+ return Math.min(Math.max(num, min), max);
140
+ },
141
+
142
+
143
+ /**
144
+ * 移动方向判断
145
+ * @param {Object} left
146
+ * @param {Object} value
147
+ * @param {Object} ownerInstance
148
+ * @param {Object} ins
149
+ */
150
+ moveDirection(left, ins, ownerInstance, self) {
151
+ var state = self.state
152
+ var threshold = state.threshold
153
+ var position = state.position
154
+ var isopen = state.isopen || 'none'
155
+ var leftWidth = state.leftWidth
156
+ var rightWidth = state.rightWidth
157
+ if (state.deltaX === 0) {
158
+ this.openState('none', ins, ownerInstance, self)
159
+ return
160
+ }
161
+ if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 &&
162
+ rightWidth +
163
+ left < threshold)) {
164
+ // right
165
+ this.openState('right', ins, ownerInstance, self)
166
+ } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 &&
167
+ leftWidth - left < threshold)) {
168
+ // left
169
+ this.openState('left', ins, ownerInstance, self)
170
+ } else {
171
+ // default
172
+ this.openState('none', ins, ownerInstance, self)
173
+ }
174
+ },
175
+
176
+
177
+ /**
178
+ * 开启状态
179
+ * @param {Boolean} type
180
+ * @param {Object} ins
181
+ * @param {Object} ownerInstance
182
+ */
183
+ openState(type, ins, ownerInstance, self) {
184
+ let state = self.state
185
+ let leftWidth = state.leftWidth
186
+ let rightWidth = state.rightWidth
187
+ let left = ''
188
+ state.isopen = state.isopen ? state.isopen : 'none'
189
+ switch (type) {
190
+ case "left":
191
+ left = leftWidth
192
+ break
193
+ case "right":
194
+ left = -rightWidth
195
+ break
196
+ default:
197
+ left = 0
198
+ }
199
+
200
+ // && !state.throttle
201
+
202
+ if (state.isopen !== type) {
203
+ state.throttle = true
204
+ ownerInstance.callMethod('change', {
205
+ open: type
206
+ })
207
+
208
+ }
209
+
210
+ state.isopen = type
211
+ // 添加动画类
212
+ ins.requestAnimationFrame(() => {
213
+ ins.addClass('ani');
214
+ this.move(left, ins, ownerInstance, self)
215
+ })
216
+ },
217
+
218
+
219
+ getDirection(x, y) {
220
+ if (x > y && x > MIN_DISTANCE) {
221
+ return 'horizontal';
222
+ }
223
+ if (y > x && y > MIN_DISTANCE) {
224
+ return 'vertical';
225
+ }
226
+ return '';
227
+ },
228
+
229
+ /**
230
+ * 重置滑动状态
231
+ * @param {Object} event
232
+ */
233
+ resetTouchStatus(instance, self) {
234
+ let state = self.state;
235
+ state.direction = '';
236
+ state.deltaX = 0;
237
+ state.deltaY = 0;
238
+ state.offsetX = 0;
239
+ state.offsetY = 0;
240
+ },
241
+
242
+ /**
243
+ * 设置滑动开始位置
244
+ * @param {Object} event
245
+ */
246
+ stopTouchStart(event, ownerInstance, self) {
247
+ let instance = event.instance;
248
+ let state = self.state
249
+ this.resetTouchStatus(instance, self);
250
+ var touch = event.touches[0];
251
+ state.startX = touch.clientX;
252
+ state.startY = touch.clientY;
253
+ },
254
+
255
+ /**
256
+ * 滑动中,是否禁止打开
257
+ * @param {Object} event
258
+ */
259
+ stopTouchMove(event, self) {
260
+ let instance = event.instance;
261
+ let state = self.state;
262
+ let touch = event.touches[0];
263
+
264
+ state.deltaX = touch.clientX - state.startX;
265
+ state.deltaY = touch.clientY - state.startY;
266
+ state.offsetY = Math.abs(state.deltaY);
267
+ state.offsetX = Math.abs(state.deltaX);
268
+ state.direction = state.direction || this.getDirection(state.offsetX, state.offsetY);
269
+ }
270
+ }
@@ -0,0 +1,347 @@
1
+ <template>
2
+ <!-- 在微信小程序 app vue端 h5 使用wxs 实现-->
3
+ <!-- #ifdef APP-VUE || MP-WEIXIN || H5 -->
4
+ <view class="uni-swipe">
5
+ <!-- #ifdef MP-WEIXIN || VUE3 -->
6
+ <view class="uni-swipe_box" :change:prop="wxsswipe.showWatch" :prop="is_show" :data-threshold="threshold"
7
+ :data-disabled="disabled" @touchstart="wxsswipe.touchstart" @touchmove="wxsswipe.touchmove"
8
+ @touchend="wxsswipe.touchend">
9
+ <!-- #endif -->
10
+ <!-- #ifndef MP-WEIXIN || VUE3 -->
11
+ <view class="uni-swipe_box" :change:prop="renderswipe.showWatch" :prop="is_show" :data-threshold="threshold"
12
+ :data-disabled="disabled+''" @touchstart="renderswipe.touchstart" @touchmove="renderswipe.touchmove"
13
+ @touchend="renderswipe.touchend">
14
+ <!-- #endif -->
15
+ <!-- 在微信小程序 app vue端 h5 使用wxs 实现-->
16
+ <view class="uni-swipe_button-group button-group--left">
17
+ <slot name="left">
18
+ <view v-for="(item,index) in leftOptions" :key="index" :style="{
19
+ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD'
20
+ }" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
21
+ @touchend="appTouchEnd($event,index,item,'left')"
22
+ @click.stop="onClickForPC(index,item,'left')">
23
+ <text class="uni-swipe_button-text"
24
+ :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text>
25
+ </view>
26
+ </slot>
27
+ </view>
28
+ <view class="uni-swipe_text--center">
29
+ <slot></slot>
30
+ </view>
31
+ <view class="uni-swipe_button-group button-group--right">
32
+ <slot name="right">
33
+ <view v-for="(item,index) in rightOptions" :key="index" :style="{
34
+ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD'
35
+ }" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
36
+ @touchend="appTouchEnd($event,index,item,'right')"
37
+ @click.stop="onClickForPC(index,item,'right')"><text class="uni-swipe_button-text"
38
+ :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text>
39
+ </view>
40
+ </slot>
41
+ </view>
42
+ </view>
43
+ </view>
44
+ <!-- #endif -->
45
+ <!-- app nvue端 使用 bindingx -->
46
+ <!-- #ifdef APP-NVUE -->
47
+ <view ref="selector-box--hock" class="uni-swipe" @horizontalpan="touchstart" @touchend="touchend">
48
+ <view ref='selector-left-button--hock' class="uni-swipe_button-group button-group--left">
49
+ <slot name="left">
50
+ <view v-for="(item,index) in leftOptions" :key="index" :style="{
51
+ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD'
52
+ }" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'left')"><text
53
+ class="uni-swipe_button-text"
54
+ :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF', fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text>
55
+ </view>
56
+ </slot>
57
+ </view>
58
+ <view ref='selector-right-button--hock' class="uni-swipe_button-group button-group--right">
59
+ <slot name="right">
60
+ <view v-for="(item,index) in rightOptions" :key="index" :style="{
61
+ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD'
62
+ }" class="uni-swipe_button button-hock" @click.stop="onClick(index,item,'right')"><text
63
+ class="uni-swipe_button-text"
64
+ :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'}">{{ item.text }}</text>
65
+ </view>
66
+ </slot>
67
+ </view>
68
+ <view ref='selector-content--hock' class="uni-swipe_box">
69
+ <slot></slot>
70
+ </view>
71
+ </view>
72
+ <!-- #endif -->
73
+ <!-- 其他平台使用 js ,长列表性能可能会有影响-->
74
+ <!-- #ifdef MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-QQ -->
75
+ <view class="uni-swipe">
76
+ <view class="uni-swipe_box" @touchstart="touchstart" @touchmove="touchmove" @touchend="touchend"
77
+ :style="{transform:moveLeft}" :class="{ani:ani}">
78
+ <view class="uni-swipe_button-group button-group--left" :class="[elClass]">
79
+ <slot name="left">
80
+ <view v-for="(item,index) in leftOptions" :key="index" :style="{
81
+ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
82
+ fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'
83
+ }" class="uni-swipe_button button-hock" @touchstart="appTouchStart"
84
+ @touchend="appTouchEnd($event,index,item,'left')"><text class="uni-swipe_button-text"
85
+ :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text>
86
+ </view>
87
+ </slot>
88
+ </view>
89
+ <slot></slot>
90
+ <view class="uni-swipe_button-group button-group--right" :class="[elClass]">
91
+ <slot name="right">
92
+ <view v-for="(item,index) in rightOptions" :key="index" :style="{
93
+ backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : '#C7C6CD',
94
+ fontSize: item.style && item.style.fontSize ? item.style.fontSize : '16px'
95
+ }" @touchstart="appTouchStart" @touchend="appTouchEnd($event,index,item,'right')"
96
+ class="uni-swipe_button button-hock"><text class="uni-swipe_button-text"
97
+ :style="{color: item.style && item.style.color ? item.style.color : '#FFFFFF',}">{{ item.text }}</text>
98
+ </view>
99
+ </slot>
100
+ </view>
101
+ </view>
102
+ </view>
103
+ <!-- #endif -->
104
+
105
+ </template>
106
+ <script src='wx.wxs' module="wxsswipe" lang="wxs"></script>
107
+
108
+ <script module="renderswipe" lang="renderjs">
109
+ import render from './render.js'
110
+ export default {
111
+ mounted(e, ins, owner) {
112
+ this.state = {}
113
+ },
114
+ methods: {
115
+ showWatch(newVal, oldVal, ownerInstance, instance) {
116
+ render.showWatch(newVal, oldVal, ownerInstance, instance, this)
117
+ },
118
+ touchstart(e, ownerInstance) {
119
+ render.touchstart(e, ownerInstance, this)
120
+ },
121
+ touchmove(e, ownerInstance) {
122
+ render.touchmove(e, ownerInstance, this)
123
+ },
124
+ touchend(e, ownerInstance) {
125
+ render.touchend(e, ownerInstance, this)
126
+ }
127
+ }
128
+ }
129
+ </script>
130
+ <script>
131
+ import mpwxs from './mpwxs'
132
+ import bindingx from './bindingx.js'
133
+ import mpother from './mpother'
134
+
135
+ /**
136
+ * SwipeActionItem 滑动操作子组件
137
+ * @description 通过滑动触发选项的容器
138
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=181
139
+ * @property {Boolean} show = [left|right|none] 开启关闭组件,auto-close = false 时生效
140
+ * @property {Boolean} disabled = [true|false] 是否禁止滑动
141
+ * @property {Boolean} autoClose = [true|false] 滑动打开当前组件,是否关闭其他组件
142
+ * @property {Number} threshold 滑动缺省值
143
+ * @property {Array} leftOptions 左侧选项内容及样式
144
+ * @property {Array} rgihtOptions 右侧选项内容及样式
145
+ * @event {Function} click 点击选项按钮时触发事件,e = {content,index} ,content(点击内容)、index(下标)
146
+ * @event {Function} change 组件打开或关闭时触发,left\right\none
147
+ */
148
+
149
+ export default {
150
+ mixins: [mpwxs, bindingx, mpother],
151
+ emits: ['click', 'change'],
152
+ props: {
153
+ // 控制开关
154
+ show: {
155
+ type: String,
156
+ default: 'none'
157
+ },
158
+
159
+ // 禁用
160
+ disabled: {
161
+ type: Boolean,
162
+ default: false
163
+ },
164
+
165
+ // 是否自动关闭
166
+ autoClose: {
167
+ type: Boolean,
168
+ default: true
169
+ },
170
+
171
+ // 滑动缺省距离
172
+ threshold: {
173
+ type: Number,
174
+ default: 20
175
+ },
176
+
177
+ // 左侧按钮内容
178
+ leftOptions: {
179
+ type: Array,
180
+ default () {
181
+ return []
182
+ }
183
+ },
184
+
185
+ // 右侧按钮内容
186
+ rightOptions: {
187
+ type: Array,
188
+ default () {
189
+ return []
190
+ }
191
+ }
192
+
193
+ },
194
+ // #ifndef VUE3
195
+ // TODO vue2
196
+ destroyed() {
197
+ if (this.__isUnmounted) return
198
+ this.uninstall()
199
+ },
200
+ // #endif
201
+ // #ifdef VUE3
202
+ // TODO vue3
203
+ unmounted() {
204
+ this.__isUnmounted = true
205
+ this.uninstall()
206
+ },
207
+ // #endif
208
+
209
+ methods: {
210
+ uninstall() {
211
+ if (this.swipeaction) {
212
+ this.swipeaction.children.forEach((item, index) => {
213
+ if (item === this) {
214
+ this.swipeaction.children.splice(index, 1)
215
+ }
216
+ })
217
+ }
218
+ },
219
+ /**
220
+ * 获取父元素实例
221
+ */
222
+ getSwipeAction(name = 'uniSwipeAction') {
223
+ let parent = this.$parent;
224
+ let parentName = parent.$options.name;
225
+ while (parentName !== name) {
226
+ parent = parent.$parent;
227
+ if (!parent) return false;
228
+ parentName = parent.$options.name;
229
+ }
230
+ return parent;
231
+ }
232
+ }
233
+ }
234
+ </script>
235
+ <style lang="scss">
236
+ .uni-swipe {
237
+ position: relative;
238
+ /* #ifndef APP-NVUE */
239
+ overflow: hidden;
240
+ /* #endif */
241
+ }
242
+
243
+ .uni-swipe_box {
244
+ /* #ifndef APP-NVUE */
245
+ display: flex;
246
+ flex-shrink: 0;
247
+ // touch-action: none;
248
+ /* #endif */
249
+ position: relative;
250
+ }
251
+
252
+ .uni-swipe_content {
253
+ // border: 1px red solid;
254
+ }
255
+
256
+ .uni-swipe_text--center {
257
+ width: 100%;
258
+ /* #ifndef APP-NVUE */
259
+ cursor: grab;
260
+ /* #endif */
261
+ }
262
+
263
+ .uni-swipe_button-group {
264
+ /* #ifndef APP-NVUE */
265
+ box-sizing: border-box;
266
+ display: flex;
267
+ /* #endif */
268
+ flex-direction: row;
269
+ position: absolute;
270
+ top: 0;
271
+ bottom: 0;
272
+ /* #ifdef H5 */
273
+ cursor: pointer;
274
+ /* #endif */
275
+ }
276
+
277
+ .button-group--left {
278
+ left: 0;
279
+ transform: translateX(-100%)
280
+ }
281
+
282
+ .button-group--right {
283
+ right: 0;
284
+ transform: translateX(100%)
285
+ }
286
+
287
+ .uni-swipe_button {
288
+ /* #ifdef APP-NVUE */
289
+ flex: 1;
290
+ /* #endif */
291
+ /* #ifndef APP-NVUE */
292
+ display: flex;
293
+ /* #endif */
294
+ flex-direction: row;
295
+ justify-content: center;
296
+ align-items: center;
297
+ padding: 0 20px;
298
+ }
299
+
300
+ .uni-swipe_button-text {
301
+ /* #ifndef APP-NVUE */
302
+ flex-shrink: 0;
303
+ /* #endif */
304
+ font-size: 14px;
305
+ }
306
+
307
+ .ani {
308
+ transition-property: transform;
309
+ transition-duration: 0.3s;
310
+ transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
311
+ }
312
+
313
+ /* #ifdef MP-ALIPAY */
314
+ .movable-area {
315
+ /* width: 100%; */
316
+ height: 45px;
317
+ }
318
+
319
+ .movable-view {
320
+ display: flex;
321
+ /* justify-content: center; */
322
+ position: relative;
323
+ flex: 1;
324
+ height: 45px;
325
+ z-index: 2;
326
+ }
327
+
328
+ .movable-view-button {
329
+ display: flex;
330
+ flex-shrink: 0;
331
+ flex-direction: row;
332
+ height: 100%;
333
+ background: #C0C0C0;
334
+ }
335
+
336
+ /* .transition {
337
+ transition: all 0.3s;
338
+ } */
339
+
340
+ .movable-view-box {
341
+ flex-shrink: 0;
342
+ height: 100%;
343
+ background-color: #fff;
344
+ }
345
+
346
+ /* #endif */
347
+ </style>