vant 2.12.37 → 2.12.41
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.
- package/es/cascader/index.js +20 -13
- package/es/datetime-picker/utils.js +4 -0
- package/es/icon/index.css +1 -1
- package/es/icon/index.less +1 -0
- package/es/image-preview/ImagePreviewItem.js +8 -3
- package/es/index.js +1 -1
- package/es/mixins/touch.js +10 -6
- package/es/nav-bar/index.js +9 -1
- package/es/slider/index.js +23 -4
- package/es/swipe/index.js +2 -8
- package/es/tabbar/index.js +14 -6
- package/lib/cascader/index.js +20 -13
- package/lib/datetime-picker/utils.js +4 -0
- package/lib/icon/index.css +1 -1
- package/lib/icon/index.less +1 -0
- package/lib/image-preview/ImagePreviewItem.js +8 -3
- package/lib/index.css +1 -1
- package/lib/index.js +1 -1
- package/lib/mixins/touch.js +10 -7
- package/lib/nav-bar/index.js +9 -1
- package/lib/slider/index.js +23 -4
- package/lib/swipe/index.js +2 -8
- package/lib/tabbar/index.js +14 -6
- package/lib/vant.js +91 -42
- package/lib/vant.min.js +1 -1
- package/package.json +4 -1
- package/vetur/attributes.json +152 -148
- package/vetur/tags.json +50 -49
- package/vetur/web-types.json +578 -561
package/lib/index.js
CHANGED
@@ -361,7 +361,7 @@ exports.TreeSelect = _treeSelect.default;
|
|
361
361
|
var _uploader = _interopRequireDefault(require("./uploader"));
|
362
362
|
|
363
363
|
exports.Uploader = _uploader.default;
|
364
|
-
var version = '2.12.
|
364
|
+
var version = '2.12.41';
|
365
365
|
exports.version = version;
|
366
366
|
|
367
367
|
function install(Vue) {
|
package/lib/mixins/touch.js
CHANGED
@@ -5,14 +5,12 @@ exports.TouchMixin = void 0;
|
|
5
5
|
|
6
6
|
var _event = require("../utils/dom/event");
|
7
7
|
|
8
|
-
var MIN_DISTANCE = 10;
|
9
|
-
|
10
8
|
function getDirection(x, y) {
|
11
|
-
if (x > y
|
9
|
+
if (x > y) {
|
12
10
|
return 'horizontal';
|
13
11
|
}
|
14
12
|
|
15
|
-
if (y > x
|
13
|
+
if (y > x) {
|
16
14
|
return 'vertical';
|
17
15
|
}
|
18
16
|
|
@@ -32,13 +30,18 @@ var TouchMixin = {
|
|
32
30
|
this.startY = event.touches[0].clientY;
|
33
31
|
},
|
34
32
|
touchMove: function touchMove(event) {
|
35
|
-
var touch = event.touches[0]; //
|
33
|
+
var touch = event.touches[0]; // safari back will set clientX to negative number
|
36
34
|
|
37
35
|
this.deltaX = touch.clientX < 0 ? 0 : touch.clientX - this.startX;
|
38
36
|
this.deltaY = touch.clientY - this.startY;
|
39
37
|
this.offsetX = Math.abs(this.deltaX);
|
40
|
-
this.offsetY = Math.abs(this.deltaY);
|
41
|
-
|
38
|
+
this.offsetY = Math.abs(this.deltaY); // lock direction when distance is greater than a certain value
|
39
|
+
|
40
|
+
var LOCK_DIRECTION_DISTANCE = 10;
|
41
|
+
|
42
|
+
if (!this.direction || this.offsetX < LOCK_DIRECTION_DISTANCE && this.offsetY < LOCK_DIRECTION_DISTANCE) {
|
43
|
+
this.direction = getDirection(this.offsetX, this.offsetY);
|
44
|
+
}
|
42
45
|
},
|
43
46
|
resetTouchStatus: function resetTouchStatus() {
|
44
47
|
this.direction = '';
|
package/lib/nav-bar/index.js
CHANGED
@@ -38,8 +38,16 @@ var _default = createComponent({
|
|
38
38
|
};
|
39
39
|
},
|
40
40
|
mounted: function mounted() {
|
41
|
+
var _this = this;
|
42
|
+
|
41
43
|
if (this.placeholder && this.fixed) {
|
42
|
-
|
44
|
+
var setHeight = function setHeight() {
|
45
|
+
_this.height = _this.$refs.navBar.getBoundingClientRect().height;
|
46
|
+
};
|
47
|
+
|
48
|
+
setHeight(); // https://github.com/youzan/vant/issues/10131
|
49
|
+
|
50
|
+
setTimeout(setHeight, 100);
|
43
51
|
}
|
44
52
|
},
|
45
53
|
methods: {
|
package/lib/slider/index.js
CHANGED
@@ -243,6 +243,7 @@ var _default = createComponent({
|
|
243
243
|
var renderButton = function renderButton(i) {
|
244
244
|
var map = ['left', 'right'];
|
245
245
|
var isNumber = typeof i === 'number';
|
246
|
+
var current = isNumber ? _this.value[i] : _this.value;
|
246
247
|
|
247
248
|
var getClassName = function getClassName() {
|
248
249
|
if (isNumber) {
|
@@ -260,6 +261,27 @@ var _default = createComponent({
|
|
260
261
|
return "wrapper";
|
261
262
|
};
|
262
263
|
|
264
|
+
var renderButtonContent = function renderButtonContent() {
|
265
|
+
if (isNumber) {
|
266
|
+
var slot = _this.slots(i === 0 ? 'left-button' : 'right-button', {
|
267
|
+
value: current
|
268
|
+
});
|
269
|
+
|
270
|
+
if (slot) {
|
271
|
+
return slot;
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
if (_this.slots('button')) {
|
276
|
+
return _this.slots('button');
|
277
|
+
}
|
278
|
+
|
279
|
+
return h("div", {
|
280
|
+
"class": bem('button'),
|
281
|
+
"style": _this.buttonStyle
|
282
|
+
});
|
283
|
+
};
|
284
|
+
|
263
285
|
return h("div", {
|
264
286
|
"ref": getRefName(),
|
265
287
|
"attrs": {
|
@@ -282,10 +304,7 @@ var _default = createComponent({
|
|
282
304
|
return e.stopPropagation();
|
283
305
|
}
|
284
306
|
}
|
285
|
-
}, [
|
286
|
-
"class": bem('button'),
|
287
|
-
"style": _this.buttonStyle
|
288
|
-
})]);
|
307
|
+
}, [renderButtonContent()]);
|
289
308
|
};
|
290
309
|
|
291
310
|
return h("div", {
|
package/lib/swipe/index.js
CHANGED
@@ -193,16 +193,10 @@ var _default = createComponent({
|
|
193
193
|
},
|
194
194
|
onTouchMove: function onTouchMove(event) {
|
195
195
|
if (!this.touchable || !this.swiping) return;
|
196
|
-
this.touchMove(event);
|
197
|
-
// avoid affecting the parent components
|
198
|
-
|
199
|
-
var shouldPrevent = this.isCorrectDirection || this.offsetY > this.offsetX === this.vertical;
|
200
|
-
|
201
|
-
if (shouldPrevent) {
|
202
|
-
(0, _event.preventDefault)(event, this.stopPropagation);
|
203
|
-
}
|
196
|
+
this.touchMove(event);
|
204
197
|
|
205
198
|
if (this.isCorrectDirection) {
|
199
|
+
(0, _event.preventDefault)(event, this.stopPropagation);
|
206
200
|
this.move({
|
207
201
|
offset: this.delta
|
208
202
|
});
|
package/lib/tabbar/index.js
CHANGED
@@ -61,28 +61,36 @@ var _default = createComponent({
|
|
61
61
|
children: 'setActiveItem'
|
62
62
|
},
|
63
63
|
mounted: function mounted() {
|
64
|
+
var _this = this;
|
65
|
+
|
64
66
|
if (this.placeholder && this.fixed) {
|
65
|
-
|
67
|
+
var setHeight = function setHeight() {
|
68
|
+
_this.height = _this.$refs.tabbar.getBoundingClientRect().height;
|
69
|
+
};
|
70
|
+
|
71
|
+
setHeight(); // https://github.com/youzan/vant/issues/10131
|
72
|
+
|
73
|
+
setTimeout(setHeight, 100);
|
66
74
|
}
|
67
75
|
},
|
68
76
|
methods: {
|
69
77
|
setActiveItem: function setActiveItem() {
|
70
|
-
var
|
78
|
+
var _this2 = this;
|
71
79
|
|
72
80
|
this.children.forEach(function (item, index) {
|
73
|
-
item.nameMatched = (item.name || index) ===
|
81
|
+
item.nameMatched = (item.name || index) === _this2.value;
|
74
82
|
});
|
75
83
|
},
|
76
84
|
triggerChange: function triggerChange(active, afterChange) {
|
77
|
-
var
|
85
|
+
var _this3 = this;
|
78
86
|
|
79
87
|
(0, _interceptor.callInterceptor)({
|
80
88
|
interceptor: this.beforeChange,
|
81
89
|
args: [active],
|
82
90
|
done: function done() {
|
83
|
-
|
91
|
+
_this3.$emit('input', active);
|
84
92
|
|
85
|
-
|
93
|
+
_this3.$emit('change', active);
|
86
94
|
|
87
95
|
afterChange();
|
88
96
|
}
|
package/lib/vant.js
CHANGED
@@ -1194,14 +1194,13 @@ function getVisibleTop(el) {
|
|
1194
1194
|
}
|
1195
1195
|
// CONCATENATED MODULE: ./es/mixins/touch.js
|
1196
1196
|
|
1197
|
-
var MIN_DISTANCE = 10;
|
1198
1197
|
|
1199
1198
|
function getDirection(x, y) {
|
1200
|
-
if (x > y
|
1199
|
+
if (x > y) {
|
1201
1200
|
return 'horizontal';
|
1202
1201
|
}
|
1203
1202
|
|
1204
|
-
if (y > x
|
1203
|
+
if (y > x) {
|
1205
1204
|
return 'vertical';
|
1206
1205
|
}
|
1207
1206
|
|
@@ -1221,13 +1220,18 @@ var TouchMixin = {
|
|
1221
1220
|
this.startY = event.touches[0].clientY;
|
1222
1221
|
},
|
1223
1222
|
touchMove: function touchMove(event) {
|
1224
|
-
var touch = event.touches[0]; //
|
1223
|
+
var touch = event.touches[0]; // safari back will set clientX to negative number
|
1225
1224
|
|
1226
1225
|
this.deltaX = touch.clientX < 0 ? 0 : touch.clientX - this.startX;
|
1227
1226
|
this.deltaY = touch.clientY - this.startY;
|
1228
1227
|
this.offsetX = Math.abs(this.deltaX);
|
1229
|
-
this.offsetY = Math.abs(this.deltaY);
|
1230
|
-
|
1228
|
+
this.offsetY = Math.abs(this.deltaY); // lock direction when distance is greater than a certain value
|
1229
|
+
|
1230
|
+
var LOCK_DIRECTION_DISTANCE = 10;
|
1231
|
+
|
1232
|
+
if (!this.direction || this.offsetX < LOCK_DIRECTION_DISTANCE && this.offsetY < LOCK_DIRECTION_DISTANCE) {
|
1233
|
+
this.direction = getDirection(this.offsetX, this.offsetY);
|
1234
|
+
}
|
1231
1235
|
},
|
1232
1236
|
resetTouchStatus: function resetTouchStatus() {
|
1233
1237
|
this.direction = '';
|
@@ -6557,6 +6561,10 @@ function copyDates(dates) {
|
|
6557
6561
|
// CONCATENATED MODULE: ./es/datetime-picker/utils.js
|
6558
6562
|
|
6559
6563
|
function times(n, iteratee) {
|
6564
|
+
if (n < 0) {
|
6565
|
+
return [];
|
6566
|
+
}
|
6567
|
+
|
6560
6568
|
var index = -1;
|
6561
6569
|
var result = Array(n);
|
6562
6570
|
|
@@ -8835,6 +8843,10 @@ var cascader_createNamespace = Object(create["a" /* createNamespace */])('cascad
|
|
8835
8843
|
closeable: {
|
8836
8844
|
type: Boolean,
|
8837
8845
|
default: true
|
8846
|
+
},
|
8847
|
+
showHeader: {
|
8848
|
+
type: Boolean,
|
8849
|
+
default: true
|
8838
8850
|
}
|
8839
8851
|
},
|
8840
8852
|
data: function data() {
|
@@ -8995,19 +9007,22 @@ var cascader_createNamespace = Object(create["a" /* createNamespace */])('cascad
|
|
8995
9007
|
},
|
8996
9008
|
renderHeader: function renderHeader() {
|
8997
9009
|
var h = this.$createElement;
|
8998
|
-
|
8999
|
-
|
9000
|
-
|
9001
|
-
|
9002
|
-
|
9003
|
-
|
9004
|
-
|
9005
|
-
|
9006
|
-
|
9007
|
-
|
9008
|
-
"
|
9009
|
-
|
9010
|
-
|
9010
|
+
|
9011
|
+
if (this.showHeader) {
|
9012
|
+
return h("div", {
|
9013
|
+
"class": cascader_bem('header')
|
9014
|
+
}, [h("h2", {
|
9015
|
+
"class": cascader_bem('title')
|
9016
|
+
}, [this.slots('title') || this.title]), this.closeable ? h(es_icon, {
|
9017
|
+
"attrs": {
|
9018
|
+
"name": "cross"
|
9019
|
+
},
|
9020
|
+
"class": cascader_bem('close-icon'),
|
9021
|
+
"on": {
|
9022
|
+
"click": this.onClose
|
9023
|
+
}
|
9024
|
+
}) : null]);
|
9025
|
+
}
|
9011
9026
|
},
|
9012
9027
|
renderOptions: function renderOptions(options, selectedOption, tabIndex) {
|
9013
9028
|
var _this4 = this;
|
@@ -12816,16 +12831,10 @@ var swipe_createNamespace = Object(create["a" /* createNamespace */])('swipe'),
|
|
12816
12831
|
},
|
12817
12832
|
onTouchMove: function onTouchMove(event) {
|
12818
12833
|
if (!this.touchable || !this.swiping) return;
|
12819
|
-
this.touchMove(event);
|
12820
|
-
// avoid affecting the parent components
|
12821
|
-
|
12822
|
-
var shouldPrevent = this.isCorrectDirection || this.offsetY > this.offsetX === this.vertical;
|
12823
|
-
|
12824
|
-
if (shouldPrevent) {
|
12825
|
-
preventDefault(event, this.stopPropagation);
|
12826
|
-
}
|
12834
|
+
this.touchMove(event);
|
12827
12835
|
|
12828
12836
|
if (this.isCorrectDirection) {
|
12837
|
+
preventDefault(event, this.stopPropagation);
|
12829
12838
|
this.move({
|
12830
12839
|
offset: this.delta
|
12831
12840
|
});
|
@@ -13267,10 +13276,11 @@ function getDistance(touches) {
|
|
13267
13276
|
offsetX = _this$offsetX === void 0 ? 0 : _this$offsetX;
|
13268
13277
|
this.touchStart(event);
|
13269
13278
|
this.touchStartTime = new Date();
|
13279
|
+
this.fingerNum = touches.length;
|
13270
13280
|
this.startMoveX = this.moveX;
|
13271
13281
|
this.startMoveY = this.moveY;
|
13272
|
-
this.moving =
|
13273
|
-
this.zooming =
|
13282
|
+
this.moving = this.fingerNum === 1 && this.scale !== 1;
|
13283
|
+
this.zooming = this.fingerNum === 2 && !offsetX;
|
13274
13284
|
|
13275
13285
|
if (this.zooming) {
|
13276
13286
|
this.startScale = this.scale;
|
@@ -13335,13 +13345,17 @@ function getDistance(touches) {
|
|
13335
13345
|
checkTap: function checkTap() {
|
13336
13346
|
var _this = this;
|
13337
13347
|
|
13348
|
+
if (this.fingerNum > 1) {
|
13349
|
+
return;
|
13350
|
+
}
|
13351
|
+
|
13338
13352
|
var _this$offsetX2 = this.offsetX,
|
13339
13353
|
offsetX = _this$offsetX2 === void 0 ? 0 : _this$offsetX2,
|
13340
13354
|
_this$offsetY = this.offsetY,
|
13341
13355
|
offsetY = _this$offsetY === void 0 ? 0 : _this$offsetY;
|
13342
13356
|
var deltaTime = new Date() - this.touchStartTime;
|
13343
13357
|
var TAP_TIME = 250;
|
13344
|
-
var TAP_OFFSET =
|
13358
|
+
var TAP_OFFSET = 5;
|
13345
13359
|
|
13346
13360
|
if (offsetX < TAP_OFFSET && offsetY < TAP_OFFSET && deltaTime < TAP_TIME) {
|
13347
13361
|
if (this.doubleTapTimer) {
|
@@ -14246,8 +14260,16 @@ var nav_bar_createNamespace = Object(create["a" /* createNamespace */])('nav-bar
|
|
14246
14260
|
};
|
14247
14261
|
},
|
14248
14262
|
mounted: function mounted() {
|
14263
|
+
var _this = this;
|
14264
|
+
|
14249
14265
|
if (this.placeholder && this.fixed) {
|
14250
|
-
|
14266
|
+
var setHeight = function setHeight() {
|
14267
|
+
_this.height = _this.$refs.navBar.getBoundingClientRect().height;
|
14268
|
+
};
|
14269
|
+
|
14270
|
+
setHeight(); // https://github.com/youzan/vant/issues/10131
|
14271
|
+
|
14272
|
+
setTimeout(setHeight, 100);
|
14251
14273
|
}
|
14252
14274
|
},
|
14253
14275
|
methods: {
|
@@ -21109,6 +21131,7 @@ var isSameValue = function isSameValue(newValue, oldValue) {
|
|
21109
21131
|
var renderButton = function renderButton(i) {
|
21110
21132
|
var map = ['left', 'right'];
|
21111
21133
|
var isNumber = typeof i === 'number';
|
21134
|
+
var current = isNumber ? _this.value[i] : _this.value;
|
21112
21135
|
|
21113
21136
|
var getClassName = function getClassName() {
|
21114
21137
|
if (isNumber) {
|
@@ -21126,6 +21149,27 @@ var isSameValue = function isSameValue(newValue, oldValue) {
|
|
21126
21149
|
return "wrapper";
|
21127
21150
|
};
|
21128
21151
|
|
21152
|
+
var renderButtonContent = function renderButtonContent() {
|
21153
|
+
if (isNumber) {
|
21154
|
+
var slot = _this.slots(i === 0 ? 'left-button' : 'right-button', {
|
21155
|
+
value: current
|
21156
|
+
});
|
21157
|
+
|
21158
|
+
if (slot) {
|
21159
|
+
return slot;
|
21160
|
+
}
|
21161
|
+
}
|
21162
|
+
|
21163
|
+
if (_this.slots('button')) {
|
21164
|
+
return _this.slots('button');
|
21165
|
+
}
|
21166
|
+
|
21167
|
+
return h("div", {
|
21168
|
+
"class": slider_bem('button'),
|
21169
|
+
"style": _this.buttonStyle
|
21170
|
+
});
|
21171
|
+
};
|
21172
|
+
|
21129
21173
|
return h("div", {
|
21130
21174
|
"ref": getRefName(),
|
21131
21175
|
"attrs": {
|
@@ -21148,10 +21192,7 @@ var isSameValue = function isSameValue(newValue, oldValue) {
|
|
21148
21192
|
return e.stopPropagation();
|
21149
21193
|
}
|
21150
21194
|
}
|
21151
|
-
}, [
|
21152
|
-
"class": slider_bem('button'),
|
21153
|
-
"style": _this.buttonStyle
|
21154
|
-
})]);
|
21195
|
+
}, [renderButtonContent()]);
|
21155
21196
|
};
|
21156
21197
|
|
21157
21198
|
return h("div", {
|
@@ -21768,28 +21809,36 @@ var tabbar_createNamespace = Object(create["a" /* createNamespace */])('tabbar')
|
|
21768
21809
|
children: 'setActiveItem'
|
21769
21810
|
},
|
21770
21811
|
mounted: function mounted() {
|
21812
|
+
var _this = this;
|
21813
|
+
|
21771
21814
|
if (this.placeholder && this.fixed) {
|
21772
|
-
|
21815
|
+
var setHeight = function setHeight() {
|
21816
|
+
_this.height = _this.$refs.tabbar.getBoundingClientRect().height;
|
21817
|
+
};
|
21818
|
+
|
21819
|
+
setHeight(); // https://github.com/youzan/vant/issues/10131
|
21820
|
+
|
21821
|
+
setTimeout(setHeight, 100);
|
21773
21822
|
}
|
21774
21823
|
},
|
21775
21824
|
methods: {
|
21776
21825
|
setActiveItem: function setActiveItem() {
|
21777
|
-
var
|
21826
|
+
var _this2 = this;
|
21778
21827
|
|
21779
21828
|
this.children.forEach(function (item, index) {
|
21780
|
-
item.nameMatched = (item.name || index) ===
|
21829
|
+
item.nameMatched = (item.name || index) === _this2.value;
|
21781
21830
|
});
|
21782
21831
|
},
|
21783
21832
|
triggerChange: function triggerChange(active, afterChange) {
|
21784
|
-
var
|
21833
|
+
var _this3 = this;
|
21785
21834
|
|
21786
21835
|
callInterceptor({
|
21787
21836
|
interceptor: this.beforeChange,
|
21788
21837
|
args: [active],
|
21789
21838
|
done: function done() {
|
21790
|
-
|
21839
|
+
_this3.$emit('input', active);
|
21791
21840
|
|
21792
|
-
|
21841
|
+
_this3.$emit('change', active);
|
21793
21842
|
|
21794
21843
|
afterChange();
|
21795
21844
|
}
|
@@ -22173,7 +22222,7 @@ TreeSelect.props = {
|
|
22173
22222
|
|
22174
22223
|
|
22175
22224
|
|
22176
|
-
var version = '2.12.
|
22225
|
+
var version = '2.12.41';
|
22177
22226
|
|
22178
22227
|
function install(Vue) {
|
22179
22228
|
var components = [action_sheet, address_edit, address_list, es_area, badge, es_button, calendar, card, cascader, cell, cell_group, es_checkbox, checkbox_group, circle, col, collapse, collapse_item, contact_card, contact_edit, contact_list, count_down, es_coupon, coupon_cell, coupon_list, datetime_picker, dialog, divider, dropdown_item, dropdown_menu, empty, es_field, es_form, goods_action, goods_action_button, goods_action_icon, grid, grid_item, es_icon, es_image, image_preview, index_anchor, index_bar, es_info, es_list, es_loading, locale["a" /* default */], nav_bar, notice_bar, notify, number_keyboard, es_overlay, pagination, panel, password_input, es_picker, popover, popup, es_progress, pull_refresh, es_radio, radio_group, es_rate, row, search, share_sheet, sidebar, sidebar_item, skeleton, es_sku, slider, es_step, stepper, steps, es_sticky, submit_bar, swipe, swipe_cell, swipe_item, es_switch, switch_cell, tab, tabbar, tabbar_item, tabs, es_tag, es_toast, tree_select, uploader];
|