vant 4.8.2 → 4.8.4
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/dropdown-menu/DropdownMenu.mjs +2 -2
- package/es/icon/index.css +1 -1
- package/es/image/Image.d.ts +6 -8
- package/es/image/index.d.ts +6 -6
- package/es/image/types.d.ts +3 -0
- package/es/image-preview/ImagePreview.d.ts +13 -0
- package/es/image-preview/ImagePreview.mjs +2 -0
- package/es/image-preview/ImagePreviewItem.d.ts +4 -0
- package/es/image-preview/ImagePreviewItem.mjs +7 -1
- package/es/image-preview/index.d.ts +9 -0
- package/es/image-preview/types.d.ts +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/notify/Notify.mjs +5 -8
- package/es/picker/PickerToolbar.mjs +10 -2
- package/es/tab/TabTitle.d.ts +1 -1
- package/es/tabs/index.css +1 -1
- package/es/text-ellipsis/TextEllipsis.mjs +11 -5
- package/es/toast/Toast.d.ts +3 -0
- package/es/toast/Toast.mjs +3 -2
- package/es/toast/index.d.ts +2 -0
- package/es/toast/types.d.ts +3 -2
- package/es/uploader/Uploader.d.ts +7 -8
- package/es/uploader/UploaderPreviewItem.d.ts +2 -3
- package/es/uploader/index.d.ts +5 -5
- package/es/utils/constant.d.ts +7 -7
- package/lib/dropdown-menu/DropdownMenu.js +1 -1
- package/lib/icon/index.css +1 -1
- package/lib/image/Image.d.ts +6 -8
- package/lib/image/index.d.ts +6 -6
- package/lib/image/types.d.ts +3 -0
- package/lib/image-preview/ImagePreview.d.ts +13 -0
- package/lib/image-preview/ImagePreview.js +2 -0
- package/lib/image-preview/ImagePreviewItem.d.ts +4 -0
- package/lib/image-preview/ImagePreviewItem.js +7 -1
- package/lib/image-preview/index.d.ts +9 -0
- package/lib/image-preview/types.d.ts +1 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/notify/Notify.js +3 -6
- package/lib/picker/PickerToolbar.js +10 -2
- package/lib/tab/TabTitle.d.ts +1 -1
- package/lib/tabs/index.css +1 -1
- package/lib/text-ellipsis/TextEllipsis.js +11 -5
- package/lib/toast/Toast.d.ts +3 -0
- package/lib/toast/Toast.js +3 -2
- package/lib/toast/index.d.ts +2 -0
- package/lib/toast/types.d.ts +3 -2
- package/lib/uploader/Uploader.d.ts +7 -8
- package/lib/uploader/UploaderPreviewItem.d.ts +2 -3
- package/lib/uploader/index.d.ts +5 -5
- package/lib/utils/constant.d.ts +7 -7
- package/lib/vant.cjs.js +39 -19
- package/lib/vant.es.js +40 -20
- package/lib/vant.js +45 -22
- package/lib/vant.min.js +6 -1
- package/lib/web-types.json +1 -1
- package/package.json +10 -9
package/lib/vant.es.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { unref, ref, reactive, inject, watch, onMounted, nextTick, createVNode, defineComponent, getCurrentInstance, computed, onActivated, onDeactivated, onBeforeUnmount, provide, watchEffect, mergeProps, Transition, withDirectives, vShow, Teleport, Fragment, onBeforeUpdate, Comment, createTextVNode, onUnmounted, createApp, resolveDirective, withKeys, onUpdated, Text, h } from "vue";
|
1
|
+
import { unref, ref, reactive, inject, watch, onMounted, nextTick, createVNode, defineComponent, getCurrentInstance, computed, onActivated, onDeactivated, onBeforeUnmount, provide, watchEffect, mergeProps, Transition, withDirectives, vShow, Teleport, Fragment, onBeforeUpdate, Comment, createTextVNode, onUnmounted, createApp, resolveDirective, withKeys, toRaw, onUpdated, Text, h } from "vue";
|
2
2
|
import { useWindowSize, useRect, useChildren, useParent, onMountedOrActivated, getScrollParent, useEventListener, cancelRaf, raf, useScrollParent, usePageVisibility, doubleRaf, CUSTOM_FIELD_INJECTION_KEY, useCustomFieldValue, inBrowser as inBrowser$1, useToggle, useCountDown, useClickAway } from "@vant/use";
|
3
3
|
import { normalizeClass, stringifyStyle, normalizeStyle } from "@vue/shared";
|
4
4
|
import { offsetModifier, createPopper } from "@vant/popperjs";
|
@@ -1927,7 +1927,11 @@ var stdin_default$1H = defineComponent({
|
|
1927
1927
|
const onCancel = () => emit("cancel");
|
1928
1928
|
const onConfirm = () => emit("confirm");
|
1929
1929
|
const renderCancel = () => {
|
1930
|
-
|
1930
|
+
var _a;
|
1931
|
+
const text = (_a = props2.cancelButtonText) != null ? _a : t$k("cancel");
|
1932
|
+
if (!slots.cancel && !text) {
|
1933
|
+
return;
|
1934
|
+
}
|
1931
1935
|
return createVNode("button", {
|
1932
1936
|
"type": "button",
|
1933
1937
|
"class": [bem$1u("cancel"), HAPTICS_FEEDBACK],
|
@@ -1935,7 +1939,11 @@ var stdin_default$1H = defineComponent({
|
|
1935
1939
|
}, [slots.cancel ? slots.cancel() : text]);
|
1936
1940
|
};
|
1937
1941
|
const renderConfirm = () => {
|
1938
|
-
|
1942
|
+
var _a;
|
1943
|
+
const text = (_a = props2.confirmButtonText) != null ? _a : t$k("confirm");
|
1944
|
+
if (!slots.confirm && !text) {
|
1945
|
+
return;
|
1946
|
+
}
|
1939
1947
|
return createVNode("button", {
|
1940
1948
|
"type": "button",
|
1941
1949
|
"class": [bem$1u("confirm"), HAPTICS_FEEDBACK],
|
@@ -4562,7 +4570,7 @@ function lockClick(lock) {
|
|
4562
4570
|
}
|
4563
4571
|
}
|
4564
4572
|
const [name$1k, bem$1g] = createNamespace("toast");
|
4565
|
-
const popupInheritProps = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay"];
|
4573
|
+
const popupInheritProps$1 = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay", "zIndex"];
|
4566
4574
|
const toastProps = {
|
4567
4575
|
icon: String,
|
4568
4576
|
show: Boolean,
|
@@ -4582,7 +4590,8 @@ const toastProps = {
|
|
4582
4590
|
overlayClass: unknownProp,
|
4583
4591
|
overlayStyle: Object,
|
4584
4592
|
closeOnClick: Boolean,
|
4585
|
-
closeOnClickOverlay: Boolean
|
4593
|
+
closeOnClickOverlay: Boolean,
|
4594
|
+
zIndex: numericProp
|
4586
4595
|
};
|
4587
4596
|
var stdin_default$1u = defineComponent({
|
4588
4597
|
name: name$1k,
|
@@ -4672,7 +4681,7 @@ var stdin_default$1u = defineComponent({
|
|
4672
4681
|
"onClick": onClick,
|
4673
4682
|
"onClosed": clearTimer,
|
4674
4683
|
"onUpdate:show": updateShow
|
4675
|
-
}, pick(props2, popupInheritProps)), {
|
4684
|
+
}, pick(props2, popupInheritProps$1)), {
|
4676
4685
|
default: () => [renderIcon(), renderMessage()]
|
4677
4686
|
});
|
4678
4687
|
}
|
@@ -9630,7 +9639,7 @@ var stdin_default$U = defineComponent({
|
|
9630
9639
|
const {
|
9631
9640
|
disabled,
|
9632
9641
|
titleClass
|
9633
|
-
} = item;
|
9642
|
+
} = toRaw(item.$props);
|
9634
9643
|
return createVNode("div", {
|
9635
9644
|
"id": `${id}-${index}`,
|
9636
9645
|
"role": "button",
|
@@ -10470,6 +10479,7 @@ const imagePreviewItemProps = {
|
|
10470
10479
|
rootHeight: makeRequiredProp(Number),
|
10471
10480
|
disableZoom: Boolean,
|
10472
10481
|
doubleScale: Boolean,
|
10482
|
+
closeOnClickImage: Boolean,
|
10473
10483
|
closeOnClickOverlay: Boolean
|
10474
10484
|
};
|
10475
10485
|
var stdin_default$N = defineComponent({
|
@@ -10634,7 +10644,12 @@ var stdin_default$N = defineComponent({
|
|
10634
10644
|
};
|
10635
10645
|
const checkClose = (event) => {
|
10636
10646
|
var _a;
|
10637
|
-
const
|
10647
|
+
const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
|
10648
|
+
const imageEl = swipeItemEl.firstElementChild;
|
10649
|
+
const isClickOverlay = event.target === swipeItemEl;
|
10650
|
+
const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
|
10651
|
+
if (!props2.closeOnClickImage && isClickImage)
|
10652
|
+
return;
|
10638
10653
|
if (!props2.closeOnClickOverlay && isClickOverlay)
|
10639
10654
|
return;
|
10640
10655
|
emit("close");
|
@@ -10794,6 +10809,7 @@ const imagePreviewProps = {
|
|
10794
10809
|
startPosition: makeNumericProp(0),
|
10795
10810
|
showIndicators: Boolean,
|
10796
10811
|
closeOnPopstate: truthProp,
|
10812
|
+
closeOnClickImage: truthProp,
|
10797
10813
|
closeOnClickOverlay: truthProp,
|
10798
10814
|
closeIconPosition: makeStringProp("top-right"),
|
10799
10815
|
teleport: [String, Object]
|
@@ -10886,6 +10902,7 @@ var stdin_default$M = defineComponent({
|
|
10886
10902
|
"rootHeight": state.rootHeight,
|
10887
10903
|
"disableZoom": state.disableZoom,
|
10888
10904
|
"doubleScale": props2.doubleScale,
|
10905
|
+
"closeOnClickImage": props2.closeOnClickImage,
|
10889
10906
|
"closeOnClickOverlay": props2.closeOnClickOverlay,
|
10890
10907
|
"onScale": emitScale,
|
10891
10908
|
"onClose": emitClose,
|
@@ -11695,6 +11712,7 @@ var stdin_default$H = defineComponent({
|
|
11695
11712
|
});
|
11696
11713
|
const NoticeBar = withInstall(stdin_default$H);
|
11697
11714
|
const [name$y, bem$x] = createNamespace("notify");
|
11715
|
+
const popupInheritProps = ["lockScroll", "position", "show", "teleport", "zIndex"];
|
11698
11716
|
const notifyProps = extend({}, popupSharedProps, {
|
11699
11717
|
type: makeStringProp("danger"),
|
11700
11718
|
color: String,
|
@@ -11713,20 +11731,16 @@ var stdin_default$G = defineComponent({
|
|
11713
11731
|
slots
|
11714
11732
|
}) {
|
11715
11733
|
const updateShow = (show) => emit("update:show", show);
|
11716
|
-
return () => createVNode(Popup, {
|
11717
|
-
"show": props2.show,
|
11734
|
+
return () => createVNode(Popup, mergeProps({
|
11718
11735
|
"class": [bem$x([props2.type]), props2.className],
|
11719
11736
|
"style": {
|
11720
11737
|
color: props2.color,
|
11721
11738
|
background: props2.background
|
11722
11739
|
},
|
11723
11740
|
"overlay": false,
|
11724
|
-
"zIndex": props2.zIndex,
|
11725
|
-
"position": props2.position,
|
11726
11741
|
"duration": 0.2,
|
11727
|
-
"lockScroll": props2.lockScroll,
|
11728
11742
|
"onUpdate:show": updateShow
|
11729
|
-
}, {
|
11743
|
+
}, pick(props2, popupInheritProps)), {
|
11730
11744
|
default: () => [slots.default ? slots.default() : props2.message]
|
11731
11745
|
});
|
11732
11746
|
}
|
@@ -14971,7 +14985,8 @@ var stdin_default$9 = defineComponent({
|
|
14971
14985
|
props: textEllipsisProps,
|
14972
14986
|
emits: ["clickAction"],
|
14973
14987
|
setup(props2, {
|
14974
|
-
emit
|
14988
|
+
emit,
|
14989
|
+
slots
|
14975
14990
|
}) {
|
14976
14991
|
const text = ref("");
|
14977
14992
|
const expanded = ref(false);
|
@@ -15079,10 +15094,15 @@ var stdin_default$9 = defineComponent({
|
|
15079
15094
|
toggle();
|
15080
15095
|
emit("clickAction", event);
|
15081
15096
|
};
|
15082
|
-
const renderAction = () =>
|
15083
|
-
|
15084
|
-
|
15085
|
-
|
15097
|
+
const renderAction = () => {
|
15098
|
+
const action = slots.action ? slots.action({
|
15099
|
+
expanded: expanded.value
|
15100
|
+
}) : actionText.value;
|
15101
|
+
return createVNode("span", {
|
15102
|
+
"class": bem$3("action"),
|
15103
|
+
"onClick": onClickAction
|
15104
|
+
}, [action]);
|
15105
|
+
};
|
15086
15106
|
onMounted(calcEllipsised);
|
15087
15107
|
watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
|
15088
15108
|
useExpose({
|
@@ -16754,7 +16774,7 @@ const Lazyload = {
|
|
16754
16774
|
});
|
16755
16775
|
}
|
16756
16776
|
};
|
16757
|
-
const version = "4.8.
|
16777
|
+
const version = "4.8.4";
|
16758
16778
|
function install(app) {
|
16759
16779
|
const components = [
|
16760
16780
|
ActionBar,
|
package/lib/vant.js
CHANGED
@@ -2317,7 +2317,11 @@
|
|
2317
2317
|
const onCancel = () => emit("cancel");
|
2318
2318
|
const onConfirm = () => emit("confirm");
|
2319
2319
|
const renderCancel = () => {
|
2320
|
-
|
2320
|
+
var _a;
|
2321
|
+
const text = (_a = props2.cancelButtonText) != null ? _a : t$k("cancel");
|
2322
|
+
if (!slots.cancel && !text) {
|
2323
|
+
return;
|
2324
|
+
}
|
2321
2325
|
return vue.createVNode("button", {
|
2322
2326
|
"type": "button",
|
2323
2327
|
"class": [bem$1u("cancel"), HAPTICS_FEEDBACK],
|
@@ -2325,7 +2329,11 @@
|
|
2325
2329
|
}, [slots.cancel ? slots.cancel() : text]);
|
2326
2330
|
};
|
2327
2331
|
const renderConfirm = () => {
|
2328
|
-
|
2332
|
+
var _a;
|
2333
|
+
const text = (_a = props2.confirmButtonText) != null ? _a : t$k("confirm");
|
2334
|
+
if (!slots.confirm && !text) {
|
2335
|
+
return;
|
2336
|
+
}
|
2329
2337
|
return vue.createVNode("button", {
|
2330
2338
|
"type": "button",
|
2331
2339
|
"class": [bem$1u("confirm"), HAPTICS_FEEDBACK],
|
@@ -2351,6 +2359,11 @@
|
|
2351
2359
|
});
|
2352
2360
|
return propRef;
|
2353
2361
|
};
|
2362
|
+
/**
|
2363
|
+
* @vue/shared v3.4.12
|
2364
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
2365
|
+
* @license MIT
|
2366
|
+
**/
|
2354
2367
|
const isArray = Array.isArray;
|
2355
2368
|
const isString = (val) => typeof val === "string";
|
2356
2369
|
const isObject = (val) => val !== null && typeof val === "object";
|
@@ -2378,9 +2391,7 @@
|
|
2378
2391
|
}
|
2379
2392
|
}
|
2380
2393
|
return res;
|
2381
|
-
} else if (isString(value)) {
|
2382
|
-
return value;
|
2383
|
-
} else if (isObject(value)) {
|
2394
|
+
} else if (isString(value) || isObject(value)) {
|
2384
2395
|
return value;
|
2385
2396
|
}
|
2386
2397
|
}
|
@@ -5023,7 +5034,7 @@
|
|
5023
5034
|
}
|
5024
5035
|
}
|
5025
5036
|
const [name$1k, bem$1g] = createNamespace("toast");
|
5026
|
-
const popupInheritProps = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay"];
|
5037
|
+
const popupInheritProps$1 = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay", "zIndex"];
|
5027
5038
|
const toastProps = {
|
5028
5039
|
icon: String,
|
5029
5040
|
show: Boolean,
|
@@ -5043,7 +5054,8 @@
|
|
5043
5054
|
overlayClass: unknownProp,
|
5044
5055
|
overlayStyle: Object,
|
5045
5056
|
closeOnClick: Boolean,
|
5046
|
-
closeOnClickOverlay: Boolean
|
5057
|
+
closeOnClickOverlay: Boolean,
|
5058
|
+
zIndex: numericProp
|
5047
5059
|
};
|
5048
5060
|
var stdin_default$1u = vue.defineComponent({
|
5049
5061
|
name: name$1k,
|
@@ -5133,7 +5145,7 @@
|
|
5133
5145
|
"onClick": onClick,
|
5134
5146
|
"onClosed": clearTimer,
|
5135
5147
|
"onUpdate:show": updateShow
|
5136
|
-
}, pick(props2, popupInheritProps)), {
|
5148
|
+
}, pick(props2, popupInheritProps$1)), {
|
5137
5149
|
default: () => [renderIcon(), renderMessage()]
|
5138
5150
|
});
|
5139
5151
|
}
|
@@ -10068,7 +10080,7 @@
|
|
10068
10080
|
const {
|
10069
10081
|
disabled,
|
10070
10082
|
titleClass
|
10071
|
-
} = item;
|
10083
|
+
} = vue.toRaw(item.$props);
|
10072
10084
|
return vue.createVNode("div", {
|
10073
10085
|
"id": `${id}-${index}`,
|
10074
10086
|
"role": "button",
|
@@ -10902,6 +10914,7 @@
|
|
10902
10914
|
rootHeight: makeRequiredProp(Number),
|
10903
10915
|
disableZoom: Boolean,
|
10904
10916
|
doubleScale: Boolean,
|
10917
|
+
closeOnClickImage: Boolean,
|
10905
10918
|
closeOnClickOverlay: Boolean
|
10906
10919
|
};
|
10907
10920
|
var stdin_default$N = vue.defineComponent({
|
@@ -11066,7 +11079,12 @@
|
|
11066
11079
|
};
|
11067
11080
|
const checkClose = (event) => {
|
11068
11081
|
var _a;
|
11069
|
-
const
|
11082
|
+
const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
|
11083
|
+
const imageEl = swipeItemEl.firstElementChild;
|
11084
|
+
const isClickOverlay = event.target === swipeItemEl;
|
11085
|
+
const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
|
11086
|
+
if (!props2.closeOnClickImage && isClickImage)
|
11087
|
+
return;
|
11070
11088
|
if (!props2.closeOnClickOverlay && isClickOverlay)
|
11071
11089
|
return;
|
11072
11090
|
emit("close");
|
@@ -11226,6 +11244,7 @@
|
|
11226
11244
|
startPosition: makeNumericProp(0),
|
11227
11245
|
showIndicators: Boolean,
|
11228
11246
|
closeOnPopstate: truthProp,
|
11247
|
+
closeOnClickImage: truthProp,
|
11229
11248
|
closeOnClickOverlay: truthProp,
|
11230
11249
|
closeIconPosition: makeStringProp("top-right"),
|
11231
11250
|
teleport: [String, Object]
|
@@ -11318,6 +11337,7 @@
|
|
11318
11337
|
"rootHeight": state.rootHeight,
|
11319
11338
|
"disableZoom": state.disableZoom,
|
11320
11339
|
"doubleScale": props2.doubleScale,
|
11340
|
+
"closeOnClickImage": props2.closeOnClickImage,
|
11321
11341
|
"closeOnClickOverlay": props2.closeOnClickOverlay,
|
11322
11342
|
"onScale": emitScale,
|
11323
11343
|
"onClose": emitClose,
|
@@ -12124,6 +12144,7 @@
|
|
12124
12144
|
});
|
12125
12145
|
const NoticeBar = withInstall(stdin_default$H);
|
12126
12146
|
const [name$y, bem$x] = createNamespace("notify");
|
12147
|
+
const popupInheritProps = ["lockScroll", "position", "show", "teleport", "zIndex"];
|
12127
12148
|
const notifyProps = extend({}, popupSharedProps, {
|
12128
12149
|
type: makeStringProp("danger"),
|
12129
12150
|
color: String,
|
@@ -12142,20 +12163,16 @@
|
|
12142
12163
|
slots
|
12143
12164
|
}) {
|
12144
12165
|
const updateShow = (show) => emit("update:show", show);
|
12145
|
-
return () => vue.createVNode(Popup, {
|
12146
|
-
"show": props2.show,
|
12166
|
+
return () => vue.createVNode(Popup, vue.mergeProps({
|
12147
12167
|
"class": [bem$x([props2.type]), props2.className],
|
12148
12168
|
"style": {
|
12149
12169
|
color: props2.color,
|
12150
12170
|
background: props2.background
|
12151
12171
|
},
|
12152
12172
|
"overlay": false,
|
12153
|
-
"zIndex": props2.zIndex,
|
12154
|
-
"position": props2.position,
|
12155
12173
|
"duration": 0.2,
|
12156
|
-
"lockScroll": props2.lockScroll,
|
12157
12174
|
"onUpdate:show": updateShow
|
12158
|
-
}, {
|
12175
|
+
}, pick(props2, popupInheritProps)), {
|
12159
12176
|
default: () => [slots.default ? slots.default() : props2.message]
|
12160
12177
|
});
|
12161
12178
|
}
|
@@ -16203,7 +16220,8 @@
|
|
16203
16220
|
props: textEllipsisProps,
|
16204
16221
|
emits: ["clickAction"],
|
16205
16222
|
setup(props2, {
|
16206
|
-
emit
|
16223
|
+
emit,
|
16224
|
+
slots
|
16207
16225
|
}) {
|
16208
16226
|
const text = vue.ref("");
|
16209
16227
|
const expanded = vue.ref(false);
|
@@ -16311,10 +16329,15 @@
|
|
16311
16329
|
toggle();
|
16312
16330
|
emit("clickAction", event);
|
16313
16331
|
};
|
16314
|
-
const renderAction = () =>
|
16315
|
-
|
16316
|
-
|
16317
|
-
|
16332
|
+
const renderAction = () => {
|
16333
|
+
const action = slots.action ? slots.action({
|
16334
|
+
expanded: expanded.value
|
16335
|
+
}) : actionText.value;
|
16336
|
+
return vue.createVNode("span", {
|
16337
|
+
"class": bem$3("action"),
|
16338
|
+
"onClick": onClickAction
|
16339
|
+
}, [action]);
|
16340
|
+
};
|
16318
16341
|
vue.onMounted(calcEllipsised);
|
16319
16342
|
vue.watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
|
16320
16343
|
useExpose({
|
@@ -17966,7 +17989,7 @@
|
|
17966
17989
|
});
|
17967
17990
|
}
|
17968
17991
|
};
|
17969
|
-
const version = "4.8.
|
17992
|
+
const version = "4.8.4";
|
17970
17993
|
function install(app) {
|
17971
17994
|
const components = [
|
17972
17995
|
ActionBar,
|