vant 2.12.31 → 2.12.32
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/README.md +3 -2
- package/README.zh-CN.md +2 -1
- package/es/field/index.js +5 -3
- package/es/index.js +1 -1
- package/es/notice-bar/index.js +28 -30
- package/es/picker/PickerColumn.js +63 -14
- package/es/switch/index.css +1 -1
- package/es/switch/index.less +2 -0
- package/es/tabbar/index.js +12 -12
- package/es/tabbar-item/index.js +17 -8
- package/lib/field/index.js +5 -3
- package/lib/index.css +1 -1
- package/lib/index.js +1 -1
- package/lib/notice-bar/index.js +28 -30
- package/lib/picker/PickerColumn.js +64 -12
- package/lib/switch/index.css +1 -1
- package/lib/switch/index.less +2 -0
- package/lib/tabbar/index.js +13 -13
- package/lib/tabbar-item/index.js +17 -8
- package/lib/vant.js +127 -69
- package/lib/vant.min.js +1 -1
- package/package.json +1 -1
- package/vetur/attributes.json +153 -153
- package/vetur/tags.json +52 -52
- package/vetur/web-types.json +506 -506
package/lib/vant.js
CHANGED
@@ -2221,8 +2221,12 @@ function getElementTranslateY(element) {
|
|
2221
2221
|
|
2222
2222
|
function isOptionDisabled(option) {
|
2223
2223
|
return Object(utils["f" /* isObject */])(option) && option.disabled;
|
2224
|
-
}
|
2224
|
+
} // use standard WheelEvent:
|
2225
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
|
2226
|
+
|
2225
2227
|
|
2228
|
+
var supportMousewheel = ('onwheel' in window);
|
2229
|
+
var mousewheelTimer = null;
|
2226
2230
|
/* harmony default export */ var PickerColumn = (PickerColumn_createComponent({
|
2227
2231
|
mixins: [TouchMixin],
|
2228
2232
|
props: {
|
@@ -2258,6 +2262,10 @@ function isOptionDisabled(option) {
|
|
2258
2262
|
},
|
2259
2263
|
mounted: function mounted() {
|
2260
2264
|
this.bindTouchEvent(this.$el);
|
2265
|
+
|
2266
|
+
if (supportMousewheel) {
|
2267
|
+
event_on(this.$el, 'wheel', this.onMouseWheel, false);
|
2268
|
+
}
|
2261
2269
|
},
|
2262
2270
|
destroyed: function destroyed() {
|
2263
2271
|
var children = this.$parent.children;
|
@@ -2265,6 +2273,10 @@ function isOptionDisabled(option) {
|
|
2265
2273
|
if (children) {
|
2266
2274
|
children.splice(children.indexOf(this), 1);
|
2267
2275
|
}
|
2276
|
+
|
2277
|
+
if (supportMousewheel) {
|
2278
|
+
off(this.$el, 'wheel');
|
2279
|
+
}
|
2268
2280
|
},
|
2269
2281
|
watch: {
|
2270
2282
|
initialOptions: 'setOptions',
|
@@ -2352,6 +2364,43 @@ function isOptionDisabled(option) {
|
|
2352
2364
|
_this.moving = false;
|
2353
2365
|
}, 0);
|
2354
2366
|
},
|
2367
|
+
onMouseWheel: function onMouseWheel(event) {
|
2368
|
+
var _this2 = this;
|
2369
|
+
|
2370
|
+
if (this.readonly) {
|
2371
|
+
return;
|
2372
|
+
}
|
2373
|
+
|
2374
|
+
preventDefault(event, true); // simply combine touchstart and touchmove
|
2375
|
+
|
2376
|
+
var translateY = getElementTranslateY(this.$refs.wrapper);
|
2377
|
+
this.startOffset = Math.min(0, translateY - this.baseOffset);
|
2378
|
+
this.momentumOffset = this.startOffset;
|
2379
|
+
this.transitionEndTrigger = null; // directly use deltaY, see https://caniuse.com/?search=deltaY
|
2380
|
+
// use deltaY to detect direction for not special setting device
|
2381
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event
|
2382
|
+
|
2383
|
+
var deltaY = event.deltaY;
|
2384
|
+
|
2385
|
+
if (this.startOffset === 0 && deltaY < 0) {
|
2386
|
+
return;
|
2387
|
+
} // get offset
|
2388
|
+
// if necessary, can adjust distance value to make scrolling smoother
|
2389
|
+
|
2390
|
+
|
2391
|
+
var distance = -deltaY;
|
2392
|
+
this.offset = range(this.startOffset + distance, -(this.count * this.itemHeight), this.itemHeight);
|
2393
|
+
|
2394
|
+
if (mousewheelTimer) {
|
2395
|
+
clearTimeout(mousewheelTimer);
|
2396
|
+
}
|
2397
|
+
|
2398
|
+
mousewheelTimer = setTimeout(function () {
|
2399
|
+
_this2.onTouchEnd();
|
2400
|
+
|
2401
|
+
_this2.touchStartTime = 0;
|
2402
|
+
}, MOMENTUM_LIMIT_TIME);
|
2403
|
+
},
|
2355
2404
|
onTransitionEnd: function onTransitionEnd() {
|
2356
2405
|
this.stopMomentum();
|
2357
2406
|
},
|
@@ -2383,17 +2432,17 @@ function isOptionDisabled(option) {
|
|
2383
2432
|
return option;
|
2384
2433
|
},
|
2385
2434
|
setIndex: function setIndex(index, emitChange) {
|
2386
|
-
var
|
2435
|
+
var _this3 = this;
|
2387
2436
|
|
2388
2437
|
index = this.adjustIndex(index) || 0;
|
2389
2438
|
var offset = -index * this.itemHeight;
|
2390
2439
|
|
2391
2440
|
var trigger = function trigger() {
|
2392
|
-
if (index !==
|
2393
|
-
|
2441
|
+
if (index !== _this3.currentIndex) {
|
2442
|
+
_this3.currentIndex = index;
|
2394
2443
|
|
2395
2444
|
if (emitChange) {
|
2396
|
-
|
2445
|
+
_this3.$emit('change', index);
|
2397
2446
|
}
|
2398
2447
|
}
|
2399
2448
|
}; // trigger the change event after transitionend when moving
|
@@ -2439,7 +2488,7 @@ function isOptionDisabled(option) {
|
|
2439
2488
|
}
|
2440
2489
|
},
|
2441
2490
|
genOptions: function genOptions() {
|
2442
|
-
var
|
2491
|
+
var _this4 = this;
|
2443
2492
|
|
2444
2493
|
var h = this.$createElement;
|
2445
2494
|
var optionStyle = {
|
@@ -2448,7 +2497,7 @@ function isOptionDisabled(option) {
|
|
2448
2497
|
return this.options.map(function (option, index) {
|
2449
2498
|
var _domProps;
|
2450
2499
|
|
2451
|
-
var text =
|
2500
|
+
var text = _this4.getOptionText(option);
|
2452
2501
|
|
2453
2502
|
var disabled = isOptionDisabled(option);
|
2454
2503
|
var data = {
|
@@ -2459,19 +2508,19 @@ function isOptionDisabled(option) {
|
|
2459
2508
|
},
|
2460
2509
|
class: [PickerColumn_bem('item', {
|
2461
2510
|
disabled: disabled,
|
2462
|
-
selected: index ===
|
2511
|
+
selected: index === _this4.currentIndex
|
2463
2512
|
})],
|
2464
2513
|
on: {
|
2465
2514
|
click: function click() {
|
2466
|
-
|
2515
|
+
_this4.onClickItem(index);
|
2467
2516
|
}
|
2468
2517
|
}
|
2469
2518
|
};
|
2470
2519
|
var childData = {
|
2471
2520
|
class: 'van-ellipsis',
|
2472
|
-
domProps: (_domProps = {}, _domProps[
|
2521
|
+
domProps: (_domProps = {}, _domProps[_this4.allowHtml ? 'innerHTML' : 'textContent'] = text, _domProps)
|
2473
2522
|
};
|
2474
|
-
return h("li", helper_default()([{}, data]), [
|
2523
|
+
return h("li", helper_default()([{}, data]), [_this4.slots('option', option) || h("div", helper_default()([{}, childData]))]);
|
2475
2524
|
});
|
2476
2525
|
}
|
2477
2526
|
},
|
@@ -3751,13 +3800,15 @@ var field_createNamespace = Object(create["a" /* createNamespace */])('field'),
|
|
3751
3800
|
|
3752
3801
|
/* istanbul ignore if */
|
3753
3802
|
|
3754
|
-
|
3755
|
-
|
3756
|
-
if (readonly) {
|
3803
|
+
if (this.getProp('readonly')) {
|
3757
3804
|
this.blur();
|
3758
3805
|
}
|
3759
3806
|
},
|
3760
3807
|
onBlur: function onBlur(event) {
|
3808
|
+
if (this.getProp('readonly')) {
|
3809
|
+
return;
|
3810
|
+
}
|
3811
|
+
|
3761
3812
|
this.focused = false;
|
3762
3813
|
this.updateValue(this.value, 'onBlur');
|
3763
3814
|
this.$emit('blur', event);
|
@@ -14259,7 +14310,7 @@ var notice_bar_createNamespace = Object(create["a" /* createNamespace */])('noti
|
|
14259
14310
|
mixins: [BindEventMixin(function (bind) {
|
14260
14311
|
// fix cache issues with forwards and back history in safari
|
14261
14312
|
// see: https://guwii.com/cache-issues-with-forwards-and-back-history-in-safari/
|
14262
|
-
bind(window, 'pageshow', this.
|
14313
|
+
bind(window, 'pageshow', this.reset);
|
14263
14314
|
})],
|
14264
14315
|
inject: {
|
14265
14316
|
vanPopup: {
|
@@ -14296,24 +14347,20 @@ var notice_bar_createNamespace = Object(create["a" /* createNamespace */])('noti
|
|
14296
14347
|
};
|
14297
14348
|
},
|
14298
14349
|
watch: {
|
14299
|
-
scrollable: '
|
14350
|
+
scrollable: 'reset',
|
14300
14351
|
text: {
|
14301
|
-
handler: '
|
14352
|
+
handler: 'reset',
|
14302
14353
|
immediate: true
|
14303
14354
|
}
|
14304
14355
|
},
|
14305
14356
|
created: function created() {
|
14306
|
-
|
14307
|
-
|
14308
|
-
|
14357
|
+
// https://github.com/youzan/vant/issues/8634
|
14309
14358
|
if (this.vanPopup) {
|
14310
|
-
this.vanPopup.onReopen(
|
14311
|
-
_this.start();
|
14312
|
-
});
|
14359
|
+
this.vanPopup.onReopen(this.reset);
|
14313
14360
|
}
|
14314
14361
|
},
|
14315
14362
|
activated: function activated() {
|
14316
|
-
this.
|
14363
|
+
this.reset();
|
14317
14364
|
},
|
14318
14365
|
methods: {
|
14319
14366
|
onClickIcon: function onClickIcon(event) {
|
@@ -14323,7 +14370,7 @@ var notice_bar_createNamespace = Object(create["a" /* createNamespace */])('noti
|
|
14323
14370
|
}
|
14324
14371
|
},
|
14325
14372
|
onTransitionEnd: function onTransitionEnd() {
|
14326
|
-
var
|
14373
|
+
var _this = this;
|
14327
14374
|
|
14328
14375
|
this.offset = this.wrapWidth;
|
14329
14376
|
this.duration = 0; // wait for Vue to render offset
|
@@ -14332,50 +14379,52 @@ var notice_bar_createNamespace = Object(create["a" /* createNamespace */])('noti
|
|
14332
14379
|
Object(raf["c" /* raf */])(function () {
|
14333
14380
|
// use double raf to ensure animation can start
|
14334
14381
|
Object(raf["b" /* doubleRaf */])(function () {
|
14335
|
-
|
14336
|
-
|
14382
|
+
_this.offset = -_this.contentWidth;
|
14383
|
+
_this.duration = (_this.contentWidth + _this.wrapWidth) / _this.speed;
|
14337
14384
|
|
14338
|
-
|
14385
|
+
_this.$emit('replay');
|
14339
14386
|
});
|
14340
14387
|
});
|
14341
14388
|
},
|
14389
|
+
// not an exposed-api, but may used by some users
|
14390
|
+
start: function start() {
|
14391
|
+
this.reset();
|
14392
|
+
},
|
14393
|
+
// @exposed-api
|
14342
14394
|
reset: function reset() {
|
14395
|
+
var _this2 = this;
|
14396
|
+
|
14397
|
+
var delay = Object(utils["c" /* isDef */])(this.delay) ? this.delay * 1000 : 0;
|
14343
14398
|
this.offset = 0;
|
14344
14399
|
this.duration = 0;
|
14345
14400
|
this.wrapWidth = 0;
|
14346
14401
|
this.contentWidth = 0;
|
14347
|
-
},
|
14348
|
-
start: function start() {
|
14349
|
-
var _this3 = this;
|
14350
|
-
|
14351
|
-
var delay = Object(utils["c" /* isDef */])(this.delay) ? this.delay * 1000 : 0;
|
14352
|
-
this.reset();
|
14353
14402
|
clearTimeout(this.startTimer);
|
14354
14403
|
this.startTimer = setTimeout(function () {
|
14355
|
-
var
|
14356
|
-
wrap =
|
14357
|
-
content =
|
14404
|
+
var _this2$$refs = _this2.$refs,
|
14405
|
+
wrap = _this2$$refs.wrap,
|
14406
|
+
content = _this2$$refs.content;
|
14358
14407
|
|
14359
|
-
if (!wrap || !content ||
|
14408
|
+
if (!wrap || !content || _this2.scrollable === false) {
|
14360
14409
|
return;
|
14361
14410
|
}
|
14362
14411
|
|
14363
14412
|
var wrapWidth = wrap.getBoundingClientRect().width;
|
14364
14413
|
var contentWidth = content.getBoundingClientRect().width;
|
14365
14414
|
|
14366
|
-
if (
|
14415
|
+
if (_this2.scrollable || contentWidth > wrapWidth) {
|
14367
14416
|
Object(raf["b" /* doubleRaf */])(function () {
|
14368
|
-
|
14369
|
-
|
14370
|
-
|
14371
|
-
|
14417
|
+
_this2.offset = -contentWidth;
|
14418
|
+
_this2.duration = contentWidth / _this2.speed;
|
14419
|
+
_this2.wrapWidth = wrapWidth;
|
14420
|
+
_this2.contentWidth = contentWidth;
|
14372
14421
|
});
|
14373
14422
|
}
|
14374
14423
|
}, delay);
|
14375
14424
|
}
|
14376
14425
|
},
|
14377
14426
|
render: function render() {
|
14378
|
-
var
|
14427
|
+
var _this3 = this;
|
14379
14428
|
|
14380
14429
|
var h = arguments[0];
|
14381
14430
|
var slots = this.slots,
|
@@ -14450,7 +14499,7 @@ var notice_bar_createNamespace = Object(create["a" /* createNamespace */])('noti
|
|
14450
14499
|
"style": barStyle,
|
14451
14500
|
"on": {
|
14452
14501
|
"click": function click(event) {
|
14453
|
-
|
14502
|
+
_this3.$emit('click', event);
|
14454
14503
|
}
|
14455
14504
|
}
|
14456
14505
|
}, [LeftIcon(), h("div", {
|
@@ -15616,10 +15665,10 @@ var right = 'right';
|
|
15616
15665
|
var esm_left = 'left';
|
15617
15666
|
var auto = 'auto';
|
15618
15667
|
var basePlacements = [esm_top, esm_bottom, right, esm_left];
|
15619
|
-
var
|
15668
|
+
var start = 'start';
|
15620
15669
|
var end = 'end';
|
15621
15670
|
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
15622
|
-
return acc.concat([placement, placement + "-" +
|
15671
|
+
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
15623
15672
|
}, []); // modifiers that need to read the DOM
|
15624
15673
|
|
15625
15674
|
var beforeRead = 'beforeRead';
|
@@ -15872,7 +15921,7 @@ function computeOffsets(_ref) {
|
|
15872
15921
|
var len = mainAxis === 'y' ? 'height' : 'width';
|
15873
15922
|
|
15874
15923
|
switch (variation) {
|
15875
|
-
case
|
15924
|
+
case start:
|
15876
15925
|
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
15877
15926
|
break;
|
15878
15927
|
|
@@ -21671,23 +21720,23 @@ var tabbar_createNamespace = Object(create["a" /* createNamespace */])('tabbar')
|
|
21671
21720
|
var _this = this;
|
21672
21721
|
|
21673
21722
|
this.children.forEach(function (item, index) {
|
21674
|
-
item.
|
21723
|
+
item.nameMatched = (item.name || index) === _this.value;
|
21675
21724
|
});
|
21676
21725
|
},
|
21677
|
-
|
21726
|
+
triggerChange: function triggerChange(active, afterChange) {
|
21678
21727
|
var _this2 = this;
|
21679
21728
|
|
21680
|
-
|
21681
|
-
|
21682
|
-
|
21683
|
-
|
21684
|
-
|
21685
|
-
_this2.$emit('input', active);
|
21729
|
+
callInterceptor({
|
21730
|
+
interceptor: this.beforeChange,
|
21731
|
+
args: [active],
|
21732
|
+
done: function done() {
|
21733
|
+
_this2.$emit('input', active);
|
21686
21734
|
|
21687
|
-
|
21688
|
-
|
21689
|
-
|
21690
|
-
|
21735
|
+
_this2.$emit('change', active);
|
21736
|
+
|
21737
|
+
afterChange();
|
21738
|
+
}
|
21739
|
+
});
|
21691
21740
|
},
|
21692
21741
|
genTabbar: function genTabbar() {
|
21693
21742
|
var _ref;
|
@@ -21748,11 +21797,11 @@ var tabbar_item_createNamespace = Object(create["a" /* createNamespace */])('tab
|
|
21748
21797
|
}),
|
21749
21798
|
data: function data() {
|
21750
21799
|
return {
|
21751
|
-
|
21800
|
+
nameMatched: false
|
21752
21801
|
};
|
21753
21802
|
},
|
21754
21803
|
computed: {
|
21755
|
-
|
21804
|
+
routeMatched: function routeMatched() {
|
21756
21805
|
var to = this.to,
|
21757
21806
|
$route = this.$route;
|
21758
21807
|
|
@@ -21764,18 +21813,27 @@ var tabbar_item_createNamespace = Object(create["a" /* createNamespace */])('tab
|
|
21764
21813
|
var nameMatched = Object(utils["c" /* isDef */])(config.name) && config.name === $route.name;
|
21765
21814
|
return pathMatched || nameMatched;
|
21766
21815
|
}
|
21816
|
+
},
|
21817
|
+
active: function active() {
|
21818
|
+
return this.parent.route ? this.routeMatched : this.nameMatched;
|
21767
21819
|
}
|
21768
21820
|
},
|
21769
21821
|
methods: {
|
21770
21822
|
onClick: function onClick(event) {
|
21771
|
-
|
21823
|
+
var _this = this;
|
21824
|
+
|
21825
|
+
if (!this.active) {
|
21826
|
+
this.parent.triggerChange(this.name || this.index, function () {
|
21827
|
+
route(_this.$router, _this);
|
21828
|
+
});
|
21829
|
+
}
|
21830
|
+
|
21772
21831
|
this.$emit('click', event);
|
21773
|
-
route(this.$router, this);
|
21774
21832
|
},
|
21775
|
-
genIcon: function genIcon(
|
21833
|
+
genIcon: function genIcon() {
|
21776
21834
|
var h = this.$createElement;
|
21777
21835
|
var slot = this.slots('icon', {
|
21778
|
-
active: active
|
21836
|
+
active: this.active
|
21779
21837
|
});
|
21780
21838
|
|
21781
21839
|
if (slot) {
|
@@ -21796,7 +21854,7 @@ var tabbar_item_createNamespace = Object(create["a" /* createNamespace */])('tab
|
|
21796
21854
|
var _this$badge;
|
21797
21855
|
|
21798
21856
|
var h = arguments[0];
|
21799
|
-
var active = this.
|
21857
|
+
var active = this.active;
|
21800
21858
|
var color = this.parent[active ? 'activeColor' : 'inactiveColor'];
|
21801
21859
|
|
21802
21860
|
if (false) {}
|
@@ -21813,7 +21871,7 @@ var tabbar_item_createNamespace = Object(create["a" /* createNamespace */])('tab
|
|
21813
21871
|
}
|
21814
21872
|
}, [h("div", {
|
21815
21873
|
"class": tabbar_item_bem('icon')
|
21816
|
-
}, [this.genIcon(
|
21874
|
+
}, [this.genIcon(), h(es_info, {
|
21817
21875
|
"attrs": {
|
21818
21876
|
"dot": this.dot,
|
21819
21877
|
"info": (_this$badge = this.badge) != null ? _this$badge : this.info
|
@@ -22056,7 +22114,7 @@ TreeSelect.props = {
|
|
22056
22114
|
|
22057
22115
|
|
22058
22116
|
|
22059
|
-
var version = '2.12.
|
22117
|
+
var version = '2.12.32';
|
22060
22118
|
|
22061
22119
|
function install(Vue) {
|
22062
22120
|
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, 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];
|