vant 4.0.9 → 4.0.11
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 +9 -8
- package/es/back-top/BackTop.d.ts +3 -0
- package/es/back-top/BackTop.mjs +3 -2
- package/es/back-top/index.css +1 -1
- package/es/back-top/index.d.ts +2 -0
- package/es/back-top/types.d.ts +3 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/picker/Picker.mjs +5 -3
- package/es/picker/PickerColumn.mjs +1 -1
- package/es/picker-group/PickerGroup.mjs +5 -4
- package/es/popover/Popover.mjs +9 -1
- package/es/popover/index.css +1 -1
- package/es/slider/Slider.mjs +6 -4
- package/es/space/Space.mjs +2 -2
- package/es/tabs/Tabs.mjs +2 -0
- package/lib/back-top/BackTop.d.ts +3 -0
- package/lib/back-top/BackTop.js +2 -1
- package/lib/back-top/index.css +1 -1
- package/lib/back-top/index.d.ts +2 -0
- package/lib/back-top/types.d.ts +3 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/picker/Picker.js +5 -3
- package/lib/picker/PickerColumn.js +1 -1
- package/lib/picker-group/PickerGroup.js +3 -2
- package/lib/popover/Popover.js +8 -0
- package/lib/popover/index.css +1 -1
- package/lib/slider/Slider.js +6 -4
- package/lib/space/Space.js +1 -1
- package/lib/tabs/Tabs.js +2 -0
- package/lib/vant.cjs.js +33 -18
- package/lib/vant.es.js +29 -14
- package/lib/vant.js +47 -19
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +2 -2
package/lib/vant.js
CHANGED
@@ -325,8 +325,12 @@
|
|
325
325
|
return;
|
326
326
|
}
|
327
327
|
const { target = window, passive: passive2 = false, capture = false } = options;
|
328
|
+
let cleaned = false;
|
328
329
|
let attached;
|
329
330
|
const add = (target2) => {
|
331
|
+
if (cleaned) {
|
332
|
+
return;
|
333
|
+
}
|
330
334
|
const element = vue.unref(target2);
|
331
335
|
if (element && !attached) {
|
332
336
|
element.addEventListener(type, listener, {
|
@@ -337,6 +341,9 @@
|
|
337
341
|
}
|
338
342
|
};
|
339
343
|
const remove2 = (target2) => {
|
344
|
+
if (cleaned) {
|
345
|
+
return;
|
346
|
+
}
|
340
347
|
const element = vue.unref(target2);
|
341
348
|
if (element && attached) {
|
342
349
|
element.removeEventListener(type, listener, capture);
|
@@ -346,12 +353,18 @@
|
|
346
353
|
vue.onUnmounted(() => remove2(target));
|
347
354
|
vue.onDeactivated(() => remove2(target));
|
348
355
|
onMountedOrActivated(() => add(target));
|
356
|
+
let stopWatch;
|
349
357
|
if (vue.isRef(target)) {
|
350
|
-
vue.watch(target, (val, oldVal) => {
|
358
|
+
stopWatch = vue.watch(target, (val, oldVal) => {
|
351
359
|
remove2(oldVal);
|
352
360
|
add(val);
|
353
361
|
});
|
354
362
|
}
|
363
|
+
return () => {
|
364
|
+
stopWatch == null ? void 0 : stopWatch();
|
365
|
+
remove2(target);
|
366
|
+
cleaned = true;
|
367
|
+
};
|
355
368
|
}
|
356
369
|
function useClickAway(target, listener, options = {}) {
|
357
370
|
if (!inBrowser) {
|
@@ -2137,7 +2150,7 @@
|
|
2137
2150
|
class: "van-ellipsis",
|
2138
2151
|
[props.allowHtml ? "innerHTML" : "textContent"]: text
|
2139
2152
|
};
|
2140
|
-
return vue.createVNode("li", data, [slots.option ? slots.option(option) : vue.createVNode("div", childData, null)]);
|
2153
|
+
return vue.createVNode("li", data, [slots.option ? slots.option(option, index) : vue.createVNode("div", childData, null)]);
|
2141
2154
|
});
|
2142
2155
|
};
|
2143
2156
|
useParent(PICKER_KEY);
|
@@ -2460,7 +2473,7 @@
|
|
2460
2473
|
return style2;
|
2461
2474
|
});
|
2462
2475
|
const renderText = () => {
|
2463
|
-
const
|
2476
|
+
const Text = vue.createVNode("span", {
|
2464
2477
|
"class": bem$1i("text", {
|
2465
2478
|
ellipsis: !props.scrollable
|
2466
2479
|
})
|
@@ -2471,10 +2484,10 @@
|
|
2471
2484
|
"content": props.badge,
|
2472
2485
|
"showZero": props.showZeroBadge
|
2473
2486
|
}, {
|
2474
|
-
default: () => [
|
2487
|
+
default: () => [Text]
|
2475
2488
|
});
|
2476
2489
|
}
|
2477
|
-
return
|
2490
|
+
return Text;
|
2478
2491
|
};
|
2479
2492
|
return () => vue.createVNode("div", {
|
2480
2493
|
"id": props.id,
|
@@ -3223,6 +3236,7 @@
|
|
3223
3236
|
vue.onActivated(setLine);
|
3224
3237
|
onPopupReopen(setLine);
|
3225
3238
|
onMountedOrActivated(init);
|
3239
|
+
useVisibilityChange(root, setLine);
|
3226
3240
|
useEventListener("scroll", onScroll, {
|
3227
3241
|
target: scroller,
|
3228
3242
|
passive: true
|
@@ -3485,12 +3499,13 @@
|
|
3485
3499
|
"confirmButtonText": confirmButtonText,
|
3486
3500
|
"onConfirm": onConfirm,
|
3487
3501
|
"onCancel": onCancel
|
3488
|
-
},
|
3502
|
+
}, pick(slots, pickerToolbarSlots)), vue.createVNode(Tabs, {
|
3489
3503
|
"active": activeTab.value,
|
3490
3504
|
"onUpdate:active": ($event) => activeTab.value = $event,
|
3491
3505
|
"class": bem$1c("tabs"),
|
3492
3506
|
"shrink": true,
|
3493
|
-
"animated": true
|
3507
|
+
"animated": true,
|
3508
|
+
"lazyRender": false
|
3494
3509
|
}, {
|
3495
3510
|
default: () => [props.tabs.map((title, index) => vue.createVNode(Tab, {
|
3496
3511
|
"title": title,
|
@@ -3576,9 +3591,11 @@
|
|
3576
3591
|
}
|
3577
3592
|
});
|
3578
3593
|
}
|
3579
|
-
|
3580
|
-
|
3581
|
-
|
3594
|
+
vue.nextTick(() => {
|
3595
|
+
emit("change", extend({
|
3596
|
+
columnIndex
|
3597
|
+
}, getEventParams()));
|
3598
|
+
});
|
3582
3599
|
};
|
3583
3600
|
const onClickOption = (currentOption, columnIndex) => emit("clickOption", extend({
|
3584
3601
|
columnIndex,
|
@@ -5963,6 +5980,7 @@
|
|
5963
5980
|
const backTopProps = {
|
5964
5981
|
right: numericProp,
|
5965
5982
|
bottom: numericProp,
|
5983
|
+
zIndex: numericProp,
|
5966
5984
|
target: [String, Object],
|
5967
5985
|
offset: makeNumericProp(200),
|
5968
5986
|
immediate: Boolean,
|
@@ -5984,7 +6002,7 @@
|
|
5984
6002
|
const show = vue.ref(false);
|
5985
6003
|
const root = vue.ref();
|
5986
6004
|
const scrollParent = vue.ref();
|
5987
|
-
const style = vue.computed(() => ({
|
6005
|
+
const style = vue.computed(() => extend(getZIndexStyle(props.zIndex), {
|
5988
6006
|
right: addUnit(props.right),
|
5989
6007
|
bottom: addUnit(props.bottom)
|
5990
6008
|
}));
|
@@ -7324,7 +7342,7 @@
|
|
7324
7342
|
} = option;
|
7325
7343
|
const selected = !!(selectedOption && option[valueKey] === selectedOption[valueKey]);
|
7326
7344
|
const color = option.color || (selected ? props.activeColor : void 0);
|
7327
|
-
const
|
7345
|
+
const Text = slots.option ? slots.option({
|
7328
7346
|
option,
|
7329
7347
|
selected
|
7330
7348
|
}) : vue.createVNode("span", null, [option[textKey]]);
|
@@ -7341,7 +7359,7 @@
|
|
7341
7359
|
"aria-checked": selected,
|
7342
7360
|
"aria-disabled": disabled || void 0,
|
7343
7361
|
"onClick": () => onSelect(option, tabIndex)
|
7344
|
-
}, [
|
7362
|
+
}, [Text, selected ? vue.createVNode(Icon, {
|
7345
7363
|
"name": "success",
|
7346
7364
|
"class": bem$W("selected-icon")
|
7347
7365
|
}, null) : null]);
|
@@ -12636,6 +12654,10 @@
|
|
12636
12654
|
}
|
12637
12655
|
if (!popper) {
|
12638
12656
|
popper = createPopperInstance();
|
12657
|
+
if (inBrowser$1) {
|
12658
|
+
window.addEventListener("animationend", updateLocation);
|
12659
|
+
window.addEventListener("transitionend", updateLocation);
|
12660
|
+
}
|
12639
12661
|
} else {
|
12640
12662
|
popper.setOptions(getPopoverOptions());
|
12641
12663
|
}
|
@@ -12708,6 +12730,10 @@
|
|
12708
12730
|
});
|
12709
12731
|
vue.onBeforeUnmount(() => {
|
12710
12732
|
if (popper) {
|
12733
|
+
if (inBrowser$1) {
|
12734
|
+
window.removeEventListener("animationend", updateLocation);
|
12735
|
+
window.removeEventListener("transitionend", updateLocation);
|
12736
|
+
}
|
12711
12737
|
popper.destroy();
|
12712
12738
|
popper = null;
|
12713
12739
|
}
|
@@ -13723,7 +13749,7 @@
|
|
13723
13749
|
let current2;
|
13724
13750
|
let startValue;
|
13725
13751
|
const root = vue.ref();
|
13726
|
-
const slider = vue.ref();
|
13752
|
+
const slider = [vue.ref(), vue.ref()];
|
13727
13753
|
const dragStatus = vue.ref();
|
13728
13754
|
const touch = useTouch();
|
13729
13755
|
const scope = vue.computed(() => Number(props.max) - Number(props.min));
|
@@ -13915,7 +13941,7 @@
|
|
13915
13941
|
const renderButton = (index) => {
|
13916
13942
|
const current22 = typeof index === "number" ? props.modelValue[index] : props.modelValue;
|
13917
13943
|
return vue.createVNode("div", {
|
13918
|
-
"ref": slider,
|
13944
|
+
"ref": slider[index != null ? index : 0],
|
13919
13945
|
"role": "slider",
|
13920
13946
|
"class": getButtonClassName(index),
|
13921
13947
|
"tabindex": props.disabled ? void 0 : 0,
|
@@ -13938,8 +13964,10 @@
|
|
13938
13964
|
};
|
13939
13965
|
updateValue(props.modelValue);
|
13940
13966
|
useCustomFieldValue(() => props.modelValue);
|
13941
|
-
|
13942
|
-
|
13967
|
+
slider.forEach((item) => {
|
13968
|
+
useEventListener("touchmove", onTouchMove, {
|
13969
|
+
target: item
|
13970
|
+
});
|
13943
13971
|
});
|
13944
13972
|
return () => vue.createVNode("div", {
|
13945
13973
|
"ref": root,
|
@@ -13983,7 +14011,7 @@
|
|
13983
14011
|
});
|
13984
14012
|
return nodes.filter((c) => {
|
13985
14013
|
var _a;
|
13986
|
-
return !(c && (
|
14014
|
+
return !(c && (c.type === vue.Comment || c.type === vue.Fragment && ((_a = c.children) == null ? void 0 : _a.length) === 0 || c.type === vue.Text && c.children.trim() === ""));
|
13987
14015
|
});
|
13988
14016
|
}
|
13989
14017
|
var stdin_default$f = vue.defineComponent({
|
@@ -16169,7 +16197,7 @@
|
|
16169
16197
|
});
|
16170
16198
|
}
|
16171
16199
|
};
|
16172
|
-
const version = "4.0.
|
16200
|
+
const version = "4.0.11";
|
16173
16201
|
function install(app) {
|
16174
16202
|
const components = [
|
16175
16203
|
ActionBar,
|