@kengic/uni 0.5.1 → 0.5.2-beta.1

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 (146) hide show
  1. package/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
  2. package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
  3. package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
  4. package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
  5. package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
  6. package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
  7. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
  8. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
  9. package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
  10. package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
  11. package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
  12. package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
  13. package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
  14. package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
  15. package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
  16. package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
  17. package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
  18. package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
  19. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
  20. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
  21. package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
  22. package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
  23. package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
  24. package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
  25. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
  26. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
  27. package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
  28. package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
  29. package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
  30. package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
  31. package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
  32. package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
  33. package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
  34. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
  35. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
  36. package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
  37. package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
  38. package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
  39. package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
  40. package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
  41. package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
  42. package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
  43. package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
  44. package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
  45. package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
  46. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
  47. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
  48. package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
  49. package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
  50. package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
  51. package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
  52. package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
  53. package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
  54. package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
  55. package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
  56. package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
  57. package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
  58. package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
  59. package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
  60. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
  61. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
  62. package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
  63. package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
  64. package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
  65. package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
  66. package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
  67. package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
  68. package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
  69. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
  70. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
  71. package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
  72. package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
  73. package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
  74. package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
  75. package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
  76. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
  77. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
  78. package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
  79. package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
  80. package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
  81. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
  82. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
  83. package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
  84. package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
  85. package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
  86. package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
  87. package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
  88. package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
  89. package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
  90. package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
  91. package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
  92. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
  93. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
  94. package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
  95. package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
  96. package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
  97. package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
  98. package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
  99. package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
  100. package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
  101. package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
  102. package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
  103. package/dist/uni/uni-ui/uni-scss/package.json +73 -73
  104. package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
  105. package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
  106. package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
  107. package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
  108. package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
  109. package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
  110. package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
  111. package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
  112. package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
  113. package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
  114. package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
  115. package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
  116. package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
  117. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
  118. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
  119. package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
  120. package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
  121. package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
  122. package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
  123. package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
  124. package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
  125. package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
  126. package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
  127. package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
  128. package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
  129. package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
  130. package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
  131. package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
  132. package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
  133. package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
  134. package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
  135. package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
  136. package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
  137. package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
  138. package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
  139. package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
  140. package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
  141. package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
  142. package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
  143. package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
  144. package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
  145. package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
  146. package/package.json +1 -1
@@ -1,270 +1,261 @@
1
1
  const MIN_DISTANCE = 10;
2
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
- }
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
12
 
13
- if (state.left) {
14
- this.openState('none', instance, ownerInstance, self)
15
- }
16
- this.resetTouchStatus(instance, self)
17
- },
13
+ if (state.left) {
14
+ this.openState('none', instance, ownerInstance, self);
15
+ }
16
+ this.resetTouchStatus(instance, self);
17
+ },
18
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
- })
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
37
 
38
- // 记录上次的位置
39
- state.x = state.left || 0
40
- // 计算滑动开始位置
41
- this.stopTouchStart(e, ownerInstance, self)
42
- },
38
+ // 记录上次的位置
39
+ state.x = state.left || 0;
40
+ // 计算滑动开始位置
41
+ this.stopTouchStart(e, ownerInstance, self);
42
+ },
43
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
- },
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
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)
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
82
 
83
- if (disabled) return
84
- // 滑动过程中触摸结束,通过阙值判断是开启还是关闭
85
- // fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13
86
- this.moveDirection(state.left, instance, ownerInstance, self)
83
+ if (disabled) return;
84
+ // 滑动过程中触摸结束,通过阙值判断是开启还是关闭
85
+ // fixed by mehaotian 定时器解决点击按钮,touchend 触发比 click 事件时机早的问题 ,主要是 ios13
86
+ this.moveDirection(state.left, instance, ownerInstance, self);
87
+ },
87
88
 
88
- },
89
+ /**
90
+ * 设置移动距离
91
+ * @param {Object} value
92
+ * @param {Object} instance
93
+ * @param {Object} ownerInstance
94
+ */
95
+ move(value, instance, ownerInstance, self) {
96
+ value = value || 0;
97
+ let state = self.state;
98
+ let leftWidth = state.leftWidth;
99
+ let rightWidth = state.rightWidth;
100
+ // 获取可滑动范围
101
+ state.left = this.range(value, -rightWidth, leftWidth);
102
+ instance.requestAnimationFrame(function () {
103
+ instance.setStyle({
104
+ transform: 'translateX(' + state.left + 'px)',
105
+ '-webkit-transform': 'translateX(' + state.left + 'px)',
106
+ });
107
+ });
108
+ },
89
109
 
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
- })
110
+ /**
111
+ * 获取元素信息
112
+ * @param {Object} instance
113
+ * @param {Object} ownerInstance
114
+ */
115
+ getDom(instance, ownerInstance, self) {
116
+ var state = self.state;
117
+ var $el = ownerInstance.$el || (ownerInstance.$vm && ownerInstance.$vm.$el);
118
+ var leftDom = $el.querySelector('.button-group--left');
119
+ var rightDom = $el.querySelector('.button-group--right');
109
120
 
110
- },
121
+ state.leftWidth = leftDom.offsetWidth || 0;
122
+ state.rightWidth = rightDom.offsetWidth || 0;
123
+ state.threshold = instance.getDataset().threshold;
124
+ },
111
125
 
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')
126
+ getDisabledType(value) {
127
+ return (typeof value === 'string' ? JSON.parse(value) : value) || false;
128
+ },
122
129
 
123
- state.leftWidth = leftDom.offsetWidth || 0
124
- state.rightWidth = rightDom.offsetWidth || 0
125
- state.threshold = instance.getDataset().threshold
126
- },
130
+ /**
131
+ * 获取范围
132
+ * @param {Object} num
133
+ * @param {Object} min
134
+ * @param {Object} max
135
+ */
136
+ range(num, min, max) {
137
+ return Math.min(Math.max(num, min), max);
138
+ },
127
139
 
128
- getDisabledType(value) {
129
- return (typeof(value) === 'string' ? JSON.parse(value) : value) || false;
130
- },
140
+ /**
141
+ * 移动方向判断
142
+ * @param {Object} left
143
+ * @param {Object} value
144
+ * @param {Object} ownerInstance
145
+ * @param {Object} ins
146
+ */
147
+ moveDirection(left, ins, ownerInstance, self) {
148
+ var state = self.state;
149
+ var threshold = state.threshold;
150
+ var position = state.position;
151
+ var isopen = state.isopen || 'none';
152
+ var leftWidth = state.leftWidth;
153
+ var rightWidth = state.rightWidth;
154
+ if (state.deltaX === 0) {
155
+ this.openState('none', ins, ownerInstance, self);
156
+ return;
157
+ }
158
+ if ((isopen === 'none' && rightWidth > 0 && -left > threshold) || (isopen !== 'none' && rightWidth > 0 && rightWidth + left < threshold)) {
159
+ // right
160
+ this.openState('right', ins, ownerInstance, self);
161
+ } else if ((isopen === 'none' && leftWidth > 0 && left > threshold) || (isopen !== 'none' && leftWidth > 0 && leftWidth - left < threshold)) {
162
+ // left
163
+ this.openState('left', ins, ownerInstance, self);
164
+ } else {
165
+ // default
166
+ this.openState('none', ins, ownerInstance, self);
167
+ }
168
+ },
131
169
 
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
- },
170
+ /**
171
+ * 开启状态
172
+ * @param {Boolean} type
173
+ * @param {Object} ins
174
+ * @param {Object} ownerInstance
175
+ */
176
+ openState(type, ins, ownerInstance, self) {
177
+ let state = self.state;
178
+ let leftWidth = state.leftWidth;
179
+ let rightWidth = state.rightWidth;
180
+ let left = '';
181
+ state.isopen = state.isopen ? state.isopen : 'none';
182
+ switch (type) {
183
+ case 'left':
184
+ left = leftWidth;
185
+ break;
186
+ case 'right':
187
+ left = -rightWidth;
188
+ break;
189
+ default:
190
+ left = 0;
191
+ }
141
192
 
193
+ // && !state.throttle
142
194
 
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
- },
195
+ if (state.isopen !== type) {
196
+ state.throttle = true;
197
+ ownerInstance.callMethod('change', {
198
+ open: type,
199
+ });
200
+ }
175
201
 
202
+ state.isopen = type;
203
+ // 添加动画类
204
+ ins.requestAnimationFrame(() => {
205
+ ins.addClass('ani');
206
+ this.move(left, ins, ownerInstance, self);
207
+ });
208
+ },
176
209
 
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
- }
210
+ getDirection(x, y) {
211
+ if (x > y && x > MIN_DISTANCE) {
212
+ return 'horizontal';
213
+ }
214
+ if (y > x && y > MIN_DISTANCE) {
215
+ return 'vertical';
216
+ }
217
+ return '';
218
+ },
199
219
 
200
- // && !state.throttle
220
+ /**
221
+ * 重置滑动状态
222
+ * @param {Object} event
223
+ */
224
+ resetTouchStatus(instance, self) {
225
+ let state = self.state;
226
+ state.direction = '';
227
+ state.deltaX = 0;
228
+ state.deltaY = 0;
229
+ state.offsetX = 0;
230
+ state.offsetY = 0;
231
+ },
201
232
 
202
- if (state.isopen !== type) {
203
- state.throttle = true
204
- ownerInstance.callMethod('change', {
205
- open: type
206
- })
233
+ /**
234
+ * 设置滑动开始位置
235
+ * @param {Object} event
236
+ */
237
+ stopTouchStart(event, ownerInstance, self) {
238
+ let instance = event.instance;
239
+ let state = self.state;
240
+ this.resetTouchStatus(instance, self);
241
+ var touch = event.touches[0];
242
+ state.startX = touch.clientX;
243
+ state.startY = touch.clientY;
244
+ },
207
245
 
208
- }
246
+ /**
247
+ * 滑动中,是否禁止打开
248
+ * @param {Object} event
249
+ */
250
+ stopTouchMove(event, self) {
251
+ let instance = event.instance;
252
+ let state = self.state;
253
+ let touch = event.touches[0];
209
254
 
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
- }
255
+ state.deltaX = touch.clientX - state.startX;
256
+ state.deltaY = touch.clientY - state.startY;
257
+ state.offsetY = Math.abs(state.deltaY);
258
+ state.offsetX = Math.abs(state.deltaX);
259
+ state.direction = state.direction || this.getDirection(state.offsetX, state.offsetY);
260
+ },
261
+ };