vant 4.6.8 → 4.7.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.
- package/README.md +4 -1
- package/es/address-edit/AddressEdit.d.ts +2 -1
- package/es/address-edit/AddressEdit.mjs +9 -3
- package/es/address-edit/index.d.ts +2 -1
- package/es/calendar/Calendar.d.ts +2 -1
- package/es/calendar/Calendar.mjs +3 -2
- package/es/calendar/CalendarDay.d.ts +2 -1
- package/es/calendar/CalendarDay.mjs +3 -1
- package/es/calendar/CalendarMonth.d.ts +2 -1
- package/es/calendar/CalendarMonth.mjs +3 -2
- package/es/calendar/index.d.ts +2 -1
- package/es/cell-group/CellGroup.mjs +2 -1
- package/es/composables/use-scope-id.d.ts +3 -0
- package/es/composables/use-scope-id.mjs +9 -0
- package/es/dialog/function-call.d.ts +18 -3
- package/es/dialog/function-call.mjs +1 -1
- package/es/floating-panel/FloatingPanel.mjs +3 -3
- package/es/floating-panel/index.css +1 -1
- package/es/icon/index.css +1 -1
- package/es/image-preview/function-call.d.ts +3 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/notify/function-call.d.ts +12 -0
- package/es/popover/Popover.mjs +2 -1
- package/es/popup/Popup.mjs +7 -5
- package/es/signature/Signature.mjs +10 -6
- package/es/swipe/Swipe.mjs +1 -1
- package/es/swipe/index.css +1 -1
- package/es/swipe-cell/SwipeCell.mjs +10 -1
- package/es/toast/function-call.d.ts +26 -0
- package/es/uploader/index.css +1 -1
- package/es/utils/interceptor.d.ts +2 -1
- package/es/utils/interceptor.mjs +3 -2
- package/lib/address-edit/AddressEdit.d.ts +2 -1
- package/lib/address-edit/AddressEdit.js +9 -3
- package/lib/address-edit/index.d.ts +2 -1
- package/lib/calendar/Calendar.d.ts +2 -1
- package/lib/calendar/Calendar.js +3 -2
- package/lib/calendar/CalendarDay.d.ts +2 -1
- package/lib/calendar/CalendarDay.js +3 -1
- package/lib/calendar/CalendarMonth.d.ts +2 -1
- package/lib/calendar/CalendarMonth.js +3 -2
- package/lib/calendar/index.d.ts +2 -1
- package/lib/cell-group/CellGroup.js +2 -1
- package/lib/composables/use-scope-id.d.ts +3 -0
- package/lib/composables/use-scope-id.js +28 -0
- package/lib/dialog/function-call.d.ts +18 -3
- package/lib/dialog/function-call.js +1 -1
- package/lib/floating-panel/FloatingPanel.js +3 -3
- package/lib/floating-panel/index.css +1 -1
- package/lib/icon/index.css +1 -1
- package/lib/image-preview/function-call.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/notify/function-call.d.ts +12 -0
- package/lib/popover/Popover.js +2 -1
- package/lib/popup/Popup.js +6 -4
- package/lib/signature/Signature.js +10 -6
- package/lib/swipe/Swipe.js +1 -1
- package/lib/swipe/index.css +1 -1
- package/lib/swipe-cell/SwipeCell.js +10 -1
- package/lib/toast/function-call.d.ts +26 -0
- package/lib/uploader/index.css +1 -1
- package/lib/utils/interceptor.d.ts +2 -1
- package/lib/utils/interceptor.js +3 -2
- package/lib/vant.cjs.js +59 -29
- package/lib/vant.es.js +59 -29
- package/lib/vant.js +59 -29
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +4 -4
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -224,7 +224,7 @@ __reExport(stdin_exports, require("./toast"), module.exports);
|
|
224
224
|
__reExport(stdin_exports, require("./tree-select"), module.exports);
|
225
225
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
226
226
|
__reExport(stdin_exports, require("./watermark"), module.exports);
|
227
|
-
const version = "4.
|
227
|
+
const version = "4.7.1";
|
228
228
|
function install(app) {
|
229
229
|
const components = [
|
230
230
|
import_action_bar.ActionBar,
|
@@ -1,6 +1,18 @@
|
|
1
1
|
import { type ComponentInstance } from '../utils';
|
2
2
|
import type { NotifyMessage, NotifyOptions } from './types';
|
3
|
+
/**
|
4
|
+
* Close the currently displayed Notify
|
5
|
+
*/
|
3
6
|
export declare const closeNotify: () => void;
|
7
|
+
/**
|
8
|
+
* Display Notify at the top of the page
|
9
|
+
*/
|
4
10
|
export declare function showNotify(options: NotifyMessage | NotifyOptions): ComponentInstance | undefined;
|
11
|
+
/**
|
12
|
+
* Modify the default configuration, affecting all `showNotify` calls
|
13
|
+
*/
|
5
14
|
export declare const setNotifyDefaultOptions: (options: NotifyOptions) => NotifyOptions;
|
15
|
+
/**
|
16
|
+
* Reset the default configuration, affecting all `showNotify` calls
|
17
|
+
*/
|
6
18
|
export declare const resetNotifyDefaultOptions: () => void;
|
package/lib/popover/Popover.js
CHANGED
@@ -26,6 +26,7 @@ var import_vue2 = require("vue");
|
|
26
26
|
var import_popperjs = require("@vant/popperjs");
|
27
27
|
var import_utils = require("../utils");
|
28
28
|
var import_use = require("@vant/use");
|
29
|
+
var import_use_scope_id = require("../composables/use-scope-id");
|
29
30
|
var import_use_sync_prop_ref = require("../composables/use-sync-prop-ref");
|
30
31
|
var import_icon = require("../icon");
|
31
32
|
var import_popup = require("../popup");
|
@@ -203,7 +204,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
203
204
|
"transition": "van-popover-zoom",
|
204
205
|
"lockScroll": false,
|
205
206
|
"onUpdate:show": updateShow
|
206
|
-
}, attrs, (0, import_utils.pick)(props, popupProps)), {
|
207
|
+
}, attrs, (0, import_use_scope_id.useScopeId)(), (0, import_utils.pick)(props, popupProps)), {
|
207
208
|
default: () => [props.showArrow && (0, import_vue.createVNode)("div", {
|
208
209
|
"class": bem("arrow")
|
209
210
|
}, null), (0, import_vue.createVNode)("div", {
|
package/lib/popup/Popup.js
CHANGED
@@ -31,6 +31,7 @@ var import_use_lock_scroll = require("../composables/use-lock-scroll");
|
|
31
31
|
var import_use_lazy_render = require("../composables/use-lazy-render");
|
32
32
|
var import_on_popup_reopen = require("../composables/on-popup-reopen");
|
33
33
|
var import_use_global_z_index = require("../composables/use-global-z-index");
|
34
|
+
var import_use_scope_id = require("../composables/use-scope-id");
|
34
35
|
var import_icon = require("../icon");
|
35
36
|
var import_overlay = require("../overlay");
|
36
37
|
const popupProps = (0, import_utils.extend)({}, import_shared.popupSharedProps, {
|
@@ -97,16 +98,17 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
97
98
|
};
|
98
99
|
const renderOverlay = () => {
|
99
100
|
if (props.overlay) {
|
100
|
-
return (0, import_vue.createVNode)(import_overlay.Overlay, {
|
101
|
+
return (0, import_vue.createVNode)(import_overlay.Overlay, (0, import_vue.mergeProps)({
|
101
102
|
"show": props.show,
|
102
103
|
"class": props.overlayClass,
|
103
104
|
"zIndex": zIndex.value,
|
104
105
|
"duration": props.duration,
|
105
106
|
"customStyle": props.overlayStyle,
|
106
107
|
"role": props.closeOnClickOverlay ? "button" : void 0,
|
107
|
-
"tabindex": props.closeOnClickOverlay ? 0 : void 0
|
108
|
+
"tabindex": props.closeOnClickOverlay ? 0 : void 0
|
109
|
+
}, (0, import_use_scope_id.useScopeId)(), {
|
108
110
|
"onClick": onClickOverlay
|
109
|
-
}, {
|
111
|
+
}), {
|
110
112
|
default: slots["overlay-content"]
|
111
113
|
});
|
112
114
|
}
|
@@ -158,7 +160,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
158
160
|
"van-safe-area-bottom": safeAreaInsetBottom
|
159
161
|
}],
|
160
162
|
"onKeydown": onKeydown
|
161
|
-
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[import_vue.vShow, props.show]]);
|
163
|
+
}, attrs, (0, import_use_scope_id.useScopeId)()), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[import_vue.vShow, props.show]]);
|
162
164
|
});
|
163
165
|
const renderTransition = () => {
|
164
166
|
const {
|
@@ -91,12 +91,16 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
91
91
|
const empty = document.createElement("canvas");
|
92
92
|
empty.width = canvas.width;
|
93
93
|
empty.height = canvas.height;
|
94
|
+
if (props.backgroundColor) {
|
95
|
+
const emptyCtx = empty.getContext("2d");
|
96
|
+
setCanvasBgColor(emptyCtx);
|
97
|
+
}
|
94
98
|
return canvas.toDataURL() === empty.toDataURL();
|
95
99
|
};
|
96
|
-
const setCanvasBgColor = () => {
|
97
|
-
if (
|
98
|
-
|
99
|
-
|
100
|
+
const setCanvasBgColor = (ctx) => {
|
101
|
+
if (ctx && props.backgroundColor) {
|
102
|
+
ctx.fillStyle = props.backgroundColor;
|
103
|
+
ctx.fillRect(0, 0, state.width, state.height);
|
100
104
|
}
|
101
105
|
};
|
102
106
|
const submit = () => {
|
@@ -119,7 +123,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
119
123
|
if (state.ctx) {
|
120
124
|
state.ctx.clearRect(0, 0, state.width, state.height);
|
121
125
|
state.ctx.closePath();
|
122
|
-
setCanvasBgColor();
|
126
|
+
setCanvasBgColor(state.ctx);
|
123
127
|
}
|
124
128
|
emit("clear");
|
125
129
|
};
|
@@ -130,7 +134,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
130
134
|
state.width = (((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0) * state.ratio;
|
131
135
|
state.height = (((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0) * state.ratio;
|
132
136
|
(0, import_vue2.nextTick)(() => {
|
133
|
-
setCanvasBgColor();
|
137
|
+
setCanvasBgColor(state.ctx);
|
134
138
|
});
|
135
139
|
}
|
136
140
|
});
|
package/lib/swipe/Swipe.js
CHANGED
@@ -89,7 +89,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
89
89
|
const trackStyle = (0, import_vue2.computed)(() => {
|
90
90
|
const style = {
|
91
91
|
transitionDuration: `${state.swiping ? 0 : props.duration}ms`,
|
92
|
-
transform: `translate${props.vertical ? "Y" : "X"}(${state.offset}px)`
|
92
|
+
transform: `translate${props.vertical ? "Y" : "X"}(${+state.offset.toFixed(2)}px)`
|
93
93
|
};
|
94
94
|
if (size.value) {
|
95
95
|
const mainAxis = props.vertical ? "height" : "width";
|
package/lib/swipe/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-swipe-indicator-size: 6px;--van-swipe-indicator-margin: var(--van-padding-sm);--van-swipe-indicator-active-opacity: 1;--van-swipe-indicator-inactive-opacity: .3;--van-swipe-indicator-active-background: var(--van-primary-color);--van-swipe-indicator-inactive-background: var(--van-border-color)}.van-swipe{position:relative;overflow:hidden;transform:translateZ(0);cursor:-webkit-grab;cursor:grab;-webkit-user-select:none;user-select:none}.van-swipe__track{display:flex;height:100
|
1
|
+
:root{--van-swipe-indicator-size: 6px;--van-swipe-indicator-margin: var(--van-padding-sm);--van-swipe-indicator-active-opacity: 1;--van-swipe-indicator-inactive-opacity: .3;--van-swipe-indicator-active-background: var(--van-primary-color);--van-swipe-indicator-inactive-background: var(--van-border-color)}.van-swipe{position:relative;overflow:hidden;transform:translateZ(0);cursor:-webkit-grab;cursor:grab;-webkit-user-select:none;user-select:none}.van-swipe__track{display:flex;height:100%;transition-property:transform}.van-swipe__track--vertical{flex-direction:column}.van-swipe__indicators{position:absolute;bottom:var(--van-swipe-indicator-margin);left:50%;display:flex;transform:translate(-50%)}.van-swipe__indicators--vertical{top:50%;bottom:auto;left:var(--van-swipe-indicator-margin);flex-direction:column;transform:translateY(-50%)}.van-swipe__indicators--vertical .van-swipe__indicator:not(:last-child){margin-bottom:var(--van-swipe-indicator-size)}.van-swipe__indicator{width:var(--van-swipe-indicator-size);height:var(--van-swipe-indicator-size);background-color:var(--van-swipe-indicator-inactive-background);border-radius:100%;opacity:var(--van-swipe-indicator-inactive-opacity);transition:opacity var(--van-duration-fast),background-color var(--van-duration-fast)}.van-swipe__indicator:not(:last-child){margin-right:var(--van-swipe-indicator-size)}.van-swipe__indicator--active{background-color:var(--van-swipe-indicator-active-background);opacity:var(--van-swipe-indicator-active-opacity)}
|
@@ -47,6 +47,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
47
47
|
let opened;
|
48
48
|
let lockClick;
|
49
49
|
let startOffset;
|
50
|
+
let isInBeforeClosing;
|
50
51
|
const root = (0, import_vue2.ref)();
|
51
52
|
const leftRef = (0, import_vue2.ref)();
|
52
53
|
const rightRef = (0, import_vue2.ref)();
|
@@ -123,14 +124,22 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
123
124
|
}
|
124
125
|
};
|
125
126
|
const onClick = (position = "outside") => {
|
127
|
+
if (isInBeforeClosing)
|
128
|
+
return;
|
126
129
|
emit("click", position);
|
127
130
|
if (opened && !lockClick) {
|
131
|
+
isInBeforeClosing = true;
|
128
132
|
(0, import_utils.callInterceptor)(props.beforeClose, {
|
129
133
|
args: [{
|
130
134
|
name: props.name,
|
131
135
|
position
|
132
136
|
}],
|
133
|
-
done: () =>
|
137
|
+
done: () => {
|
138
|
+
isInBeforeClosing = false;
|
139
|
+
close(position);
|
140
|
+
},
|
141
|
+
canceled: () => isInBeforeClosing = false,
|
142
|
+
error: () => isInBeforeClosing = false
|
134
143
|
});
|
135
144
|
}
|
136
145
|
};
|
@@ -1,10 +1,36 @@
|
|
1
1
|
import type { ToastType, ToastOptions, ToastWrapperInstance } from './types';
|
2
|
+
/**
|
3
|
+
* Display a text toast
|
4
|
+
*/
|
2
5
|
export declare function showToast(options?: string | ToastOptions): ToastWrapperInstance;
|
6
|
+
/**
|
7
|
+
* Display a loading toast
|
8
|
+
*/
|
3
9
|
export declare const showLoadingToast: (options: string | ToastOptions) => ToastWrapperInstance;
|
10
|
+
/**
|
11
|
+
* Display a success toast
|
12
|
+
*/
|
4
13
|
export declare const showSuccessToast: (options: string | ToastOptions) => ToastWrapperInstance;
|
14
|
+
/**
|
15
|
+
* Display a fail toast
|
16
|
+
*/
|
5
17
|
export declare const showFailToast: (options: string | ToastOptions) => ToastWrapperInstance;
|
18
|
+
/**
|
19
|
+
* Close the currently displayed toast
|
20
|
+
*/
|
6
21
|
export declare const closeToast: (all?: boolean) => void;
|
22
|
+
/**
|
23
|
+
* Modify the default configuration that affects all `showToast` calls.
|
24
|
+
* Specify the `type` parameter to modify the default configuration of a specific type of toast
|
25
|
+
*/
|
7
26
|
export declare function setToastDefaultOptions(options: ToastOptions): void;
|
8
27
|
export declare function setToastDefaultOptions(type: ToastType, options: ToastOptions): void;
|
28
|
+
/**
|
29
|
+
* Reset the default configuration that affects all `showToast` calls.
|
30
|
+
* Specify the `type` parameter to reset the default configuration of a specific type of toast
|
31
|
+
*/
|
9
32
|
export declare const resetToastDefaultOptions: (type?: ToastType) => void;
|
33
|
+
/**
|
34
|
+
* Allow multiple toasts to be displayed as the same time
|
35
|
+
*/
|
10
36
|
export declare const allowMultipleToast: (value?: boolean) => void;
|
package/lib/uploader/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-uploader-size: 80px;--van-uploader-icon-size: 24px;--van-uploader-icon-color: var(--van-gray-4);--van-uploader-text-color: var(--van-text-color-2);--van-uploader-text-font-size: var(--van-font-size-sm);--van-uploader-upload-background: var(--van-gray-1);--van-uploader-upload-active-color: var(--van-active-color);--van-uploader-delete-color: var(--van-white);--van-uploader-delete-icon-size: 14px;--van-uploader-delete-background: rgba(0, 0, 0, .7);--van-uploader-file-background: var(--van-background);--van-uploader-file-icon-size: 20px;--van-uploader-file-icon-color: var(--van-gray-7);--van-uploader-file-name-padding: 0 var(--van-padding-base);--van-uploader-file-name-margin-top: var(--van-padding-xs);--van-uploader-file-name-font-size: var(--van-font-size-sm);--van-uploader-file-name-text-color: var(--van-gray-7);--van-uploader-mask-text-color: var(--van-white);--van-uploader-mask-background: rgba(50, 50, 51, .88);--van-uploader-mask-icon-size: 22px;--van-uploader-mask-message-font-size: var(--van-font-size-sm);--van-uploader-mask-message-line-height: var(--van-line-height-xs);--van-uploader-loading-icon-size: 22px;--van-uploader-loading-icon-color: var(--van-white);--van-uploader-disabled-opacity: var(--van-disabled-opacity)}.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:flex;flex-wrap:wrap}.van-uploader__wrapper--disabled{opacity:var(--van-uploader-disabled-opacity)}.van-uploader__input{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;cursor:pointer;opacity:0}.van-uploader__input-wrapper{position:relative}.van-uploader__input:disabled{cursor:not-allowed}.van-uploader__upload{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;box-sizing:border-box;width:var(--van-uploader-size);height:var(--van-uploader-size);margin:0 var(--van-padding-xs) var(--van-padding-xs) 0;background:var(--van-uploader-upload-background)}.van-uploader__upload:active{background-color:var(--van-uploader-upload-active-color)}.van-uploader__upload--readonly:active{background-color:var(--van-uploader-upload-background)}.van-uploader__upload-icon{color:var(--van-uploader-icon-color);font-size:var(--van-uploader-icon-size)}.van-uploader__upload-text{margin-top:var(--van-padding-xs);color:var(--van-uploader-text-color);font-size:var(--van-uploader-text-font-size)}.van-uploader__preview{position:relative;margin:0 var(--van-padding-xs) var(--van-padding-xs) 0;cursor:pointer}.van-uploader__preview-image{display:block;width:var(--van-uploader-size);height:var(--van-uploader-size);overflow:hidden}.van-uploader__preview-delete{position:absolute;top:0;right:0}.van-uploader__preview-delete--shadow{width:var(--van-uploader-delete-icon-size);height:var(--van-uploader-delete-icon-size);background:var(--van-uploader-delete-background);border-radius:0 0 0 12px}.van-uploader__preview-delete-icon{position:absolute;top:0;right:0;color:var(--van-uploader-delete-color);font-size:var(--van-uploader-delete-icon-size);transform:scale(.7) translate(10%,-10%)}.van-uploader__preview-cover{position:absolute;top:0;right:0;bottom:0;left:0}.van-uploader__mask{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--van-uploader-mask-text-color);background:var(--van-uploader-mask-background)}.van-uploader__mask-icon{font-size:var(--van-uploader-mask-icon-size)}.van-uploader__mask-message{margin-top:6px;padding:0 var(--van-padding-base);font-size:var(--van-uploader-mask-message-font-size);line-height:var(--van-uploader-mask-message-line-height)}.van-uploader__loading{width:var(--van-uploader-loading-icon-size);height:var(--van-uploader-loading-icon-size);color:var(--van-uploader-loading-icon-color)}.van-uploader__file{display:flex;flex-direction:column;align-items:center;justify-content:center;width:var(--van-uploader-size);height:var(--van-uploader-size);background:var(--van-uploader-file-background)}.van-uploader__file-icon{color:var(--van-uploader-file-icon-color);font-size:var(--van-uploader-file-icon-size)}.van-uploader__file-name{box-sizing:border-box;width:100%;margin-top:var(--van-uploader-file-name-margin-top);padding:var(--van-uploader-file-name-padding);color:var(--van-uploader-file-name-text-color);font-size:var(--van-uploader-file-name-font-size);text-align:center}
|
1
|
+
:root{--van-uploader-size: 80px;--van-uploader-icon-size: 24px;--van-uploader-icon-color: var(--van-gray-4);--van-uploader-text-color: var(--van-text-color-2);--van-uploader-text-font-size: var(--van-font-size-sm);--van-uploader-upload-background: var(--van-gray-1);--van-uploader-upload-active-color: var(--van-active-color);--van-uploader-delete-color: var(--van-white);--van-uploader-delete-icon-size: 14px;--van-uploader-delete-background: rgba(0, 0, 0, .7);--van-uploader-file-background: var(--van-background);--van-uploader-file-icon-size: 20px;--van-uploader-file-icon-color: var(--van-gray-7);--van-uploader-file-name-padding: 0 var(--van-padding-base);--van-uploader-file-name-margin-top: var(--van-padding-xs);--van-uploader-file-name-font-size: var(--van-font-size-sm);--van-uploader-file-name-text-color: var(--van-gray-7);--van-uploader-mask-text-color: var(--van-white);--van-uploader-mask-background: rgba(50, 50, 51, .88);--van-uploader-mask-icon-size: 22px;--van-uploader-mask-message-font-size: var(--van-font-size-sm);--van-uploader-mask-message-line-height: var(--van-line-height-xs);--van-uploader-loading-icon-size: 22px;--van-uploader-loading-icon-color: var(--van-white);--van-uploader-disabled-opacity: var(--van-disabled-opacity);--van-uploader-border-radius: 0px}.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:flex;flex-wrap:wrap}.van-uploader__wrapper--disabled{opacity:var(--van-uploader-disabled-opacity)}.van-uploader__input{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;cursor:pointer;opacity:0}.van-uploader__input-wrapper{position:relative}.van-uploader__input:disabled{cursor:not-allowed}.van-uploader__upload{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;box-sizing:border-box;width:var(--van-uploader-size);height:var(--van-uploader-size);margin:0 var(--van-padding-xs) var(--van-padding-xs) 0;background:var(--van-uploader-upload-background);border-radius:var(--van-uploader-border-radius)}.van-uploader__upload:active{background-color:var(--van-uploader-upload-active-color)}.van-uploader__upload--readonly:active{background-color:var(--van-uploader-upload-background)}.van-uploader__upload-icon{color:var(--van-uploader-icon-color);font-size:var(--van-uploader-icon-size)}.van-uploader__upload-text{margin-top:var(--van-padding-xs);color:var(--van-uploader-text-color);font-size:var(--van-uploader-text-font-size)}.van-uploader__preview{position:relative;margin:0 var(--van-padding-xs) var(--van-padding-xs) 0;cursor:pointer}.van-uploader__preview-image{display:block;width:var(--van-uploader-size);height:var(--van-uploader-size);overflow:hidden;border-radius:var(--van-uploader-border-radius)}.van-uploader__preview-delete{position:absolute;top:0;right:0}.van-uploader__preview-delete--shadow{width:var(--van-uploader-delete-icon-size);height:var(--van-uploader-delete-icon-size);background:var(--van-uploader-delete-background);border-radius:0 0 0 12px}.van-uploader__preview-delete-icon{position:absolute;top:0;right:0;color:var(--van-uploader-delete-color);font-size:var(--van-uploader-delete-icon-size);transform:scale(.7) translate(10%,-10%)}.van-uploader__preview-cover{position:absolute;top:0;right:0;bottom:0;left:0}.van-uploader__mask{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--van-uploader-mask-text-color);background:var(--van-uploader-mask-background);border-radius:var(--van-uploader-border-radius)}.van-uploader__mask-icon{font-size:var(--van-uploader-mask-icon-size)}.van-uploader__mask-message{margin-top:6px;padding:0 var(--van-padding-base);font-size:var(--van-uploader-mask-message-font-size);line-height:var(--van-uploader-mask-message-line-height)}.van-uploader__loading{width:var(--van-uploader-loading-icon-size);height:var(--van-uploader-loading-icon-size);color:var(--van-uploader-loading-icon-color)}.van-uploader__file{display:flex;flex-direction:column;align-items:center;justify-content:center;width:var(--van-uploader-size);height:var(--van-uploader-size);background:var(--van-uploader-file-background)}.van-uploader__file-icon{color:var(--van-uploader-file-icon-color);font-size:var(--van-uploader-file-icon-size)}.van-uploader__file-name{box-sizing:border-box;width:100%;margin-top:var(--van-uploader-file-name-margin-top);padding:var(--van-uploader-file-name-padding);color:var(--van-uploader-file-name-text-color);font-size:var(--van-uploader-file-name-font-size);text-align:center}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export type Interceptor = (...args: any[]) => Promise<boolean> | boolean | undefined | void;
|
2
|
-
export declare function callInterceptor(interceptor: Interceptor | undefined, { args, done, canceled, }: {
|
2
|
+
export declare function callInterceptor(interceptor: Interceptor | undefined, { args, done, canceled, error, }: {
|
3
3
|
args?: unknown[];
|
4
4
|
done: () => void;
|
5
5
|
canceled?: () => void;
|
6
|
+
error?: () => void;
|
6
7
|
}): void;
|
package/lib/utils/interceptor.js
CHANGED
@@ -24,7 +24,8 @@ var import_basic = require("./basic");
|
|
24
24
|
function callInterceptor(interceptor, {
|
25
25
|
args = [],
|
26
26
|
done,
|
27
|
-
canceled
|
27
|
+
canceled,
|
28
|
+
error
|
28
29
|
}) {
|
29
30
|
if (interceptor) {
|
30
31
|
const returnVal = interceptor.apply(null, args);
|
@@ -35,7 +36,7 @@ function callInterceptor(interceptor, {
|
|
35
36
|
} else if (canceled) {
|
36
37
|
canceled();
|
37
38
|
}
|
38
|
-
}).catch(import_basic.noop);
|
39
|
+
}).catch(error || import_basic.noop);
|
39
40
|
} else if (returnVal) {
|
40
41
|
done();
|
41
42
|
} else if (canceled) {
|
package/lib/vant.cjs.js
CHANGED
@@ -380,7 +380,8 @@ const TAP_OFFSET = 5;
|
|
380
380
|
function callInterceptor(interceptor, {
|
381
381
|
args = [],
|
382
382
|
done,
|
383
|
-
canceled
|
383
|
+
canceled,
|
384
|
+
error
|
384
385
|
}) {
|
385
386
|
if (interceptor) {
|
386
387
|
const returnVal = interceptor.apply(null, args);
|
@@ -391,7 +392,7 @@ function callInterceptor(interceptor, {
|
|
391
392
|
} else if (canceled) {
|
392
393
|
canceled();
|
393
394
|
}
|
394
|
-
}).catch(noop);
|
395
|
+
}).catch(error || noop);
|
395
396
|
} else if (returnVal) {
|
396
397
|
done();
|
397
398
|
} else if (canceled) {
|
@@ -1249,6 +1250,11 @@ function useLazyRender(show) {
|
|
1249
1250
|
);
|
1250
1251
|
return (render) => () => inited.value ? render() : null;
|
1251
1252
|
}
|
1253
|
+
const useScopeId = () => {
|
1254
|
+
var _a;
|
1255
|
+
const { scopeId } = ((_a = vue.getCurrentInstance()) == null ? void 0 : _a.vnode) || {};
|
1256
|
+
return scopeId ? { [scopeId]: "" } : null;
|
1257
|
+
};
|
1252
1258
|
const [name$1B, bem$1w] = createNamespace("overlay");
|
1253
1259
|
const overlayProps = {
|
1254
1260
|
show: Boolean,
|
@@ -1360,16 +1366,17 @@ var stdin_default$1J = vue.defineComponent({
|
|
1360
1366
|
};
|
1361
1367
|
const renderOverlay = () => {
|
1362
1368
|
if (props2.overlay) {
|
1363
|
-
return vue.createVNode(Overlay, {
|
1369
|
+
return vue.createVNode(Overlay, vue.mergeProps({
|
1364
1370
|
"show": props2.show,
|
1365
1371
|
"class": props2.overlayClass,
|
1366
1372
|
"zIndex": zIndex.value,
|
1367
1373
|
"duration": props2.duration,
|
1368
1374
|
"customStyle": props2.overlayStyle,
|
1369
1375
|
"role": props2.closeOnClickOverlay ? "button" : void 0,
|
1370
|
-
"tabindex": props2.closeOnClickOverlay ? 0 : void 0
|
1376
|
+
"tabindex": props2.closeOnClickOverlay ? 0 : void 0
|
1377
|
+
}, useScopeId(), {
|
1371
1378
|
"onClick": onClickOverlay
|
1372
|
-
}, {
|
1379
|
+
}), {
|
1373
1380
|
default: slots["overlay-content"]
|
1374
1381
|
});
|
1375
1382
|
}
|
@@ -1421,7 +1428,7 @@ var stdin_default$1J = vue.defineComponent({
|
|
1421
1428
|
"van-safe-area-bottom": safeAreaInsetBottom
|
1422
1429
|
}],
|
1423
1430
|
"onKeydown": onKeydown
|
1424
|
-
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vue.vShow, props2.show]]);
|
1431
|
+
}, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vue.vShow, props2.show]]);
|
1425
1432
|
});
|
1426
1433
|
const renderTransition = () => {
|
1427
1434
|
const {
|
@@ -2221,7 +2228,7 @@ var stdin_default$1E = vue.defineComponent({
|
|
2221
2228
|
const trackStyle = vue.computed(() => {
|
2222
2229
|
const style = {
|
2223
2230
|
transitionDuration: `${state.swiping ? 0 : props2.duration}ms`,
|
2224
|
-
transform: `translate${props2.vertical ? "Y" : "X"}(${state.offset}px)`
|
2231
|
+
transform: `translate${props2.vertical ? "Y" : "X"}(${+state.offset.toFixed(2)}px)`
|
2225
2232
|
};
|
2226
2233
|
if (size.value) {
|
2227
2234
|
const mainAxis = props2.vertical ? "height" : "width";
|
@@ -4992,7 +4999,7 @@ const addressEditProps = {
|
|
4992
4999
|
var stdin_default$1q = vue.defineComponent({
|
4993
5000
|
name: name$1g,
|
4994
5001
|
props: addressEditProps,
|
4995
|
-
emits: ["save", "focus", "delete", "clickArea", "changeArea", "changeDetail", "selectSearch", "changeDefault"],
|
5002
|
+
emits: ["save", "focus", "change", "delete", "clickArea", "changeArea", "changeDetail", "selectSearch", "changeDefault"],
|
4996
5003
|
setup(props2, {
|
4997
5004
|
emit,
|
4998
5005
|
slots
|
@@ -5026,6 +5033,12 @@ var stdin_default$1q = vue.defineComponent({
|
|
5026
5033
|
detailFocused.value = key === "addressDetail";
|
5027
5034
|
emit("focus", key);
|
5028
5035
|
};
|
5036
|
+
const onChange = (key, value) => {
|
5037
|
+
emit("change", {
|
5038
|
+
key,
|
5039
|
+
value
|
5040
|
+
});
|
5041
|
+
};
|
5029
5042
|
const rules = vue.computed(() => {
|
5030
5043
|
const {
|
5031
5044
|
validator,
|
@@ -5137,7 +5150,7 @@ var stdin_default$1q = vue.defineComponent({
|
|
5137
5150
|
"class": bem$1c("fields")
|
5138
5151
|
}, [vue.createVNode(Field, {
|
5139
5152
|
"modelValue": data.name,
|
5140
|
-
"onUpdate:modelValue": ($event) => data.name = $event,
|
5153
|
+
"onUpdate:modelValue": [($event) => data.name = $event, (val) => onChange("name", val)],
|
5141
5154
|
"clearable": true,
|
5142
5155
|
"label": t$i("name"),
|
5143
5156
|
"rules": rules.value.name,
|
@@ -5145,7 +5158,7 @@ var stdin_default$1q = vue.defineComponent({
|
|
5145
5158
|
"onFocus": () => onFocus("name")
|
5146
5159
|
}, null), vue.createVNode(Field, {
|
5147
5160
|
"modelValue": data.tel,
|
5148
|
-
"onUpdate:modelValue": ($event) => data.tel = $event,
|
5161
|
+
"onUpdate:modelValue": [($event) => data.tel = $event, (val) => onChange("tel", val)],
|
5149
5162
|
"clearable": true,
|
5150
5163
|
"type": "tel",
|
5151
5164
|
"label": t$i("tel"),
|
@@ -6140,7 +6153,7 @@ var stdin_default$1h = vue.defineComponent({
|
|
6140
6153
|
offset: makeNumberProp(0),
|
6141
6154
|
rowHeight: String
|
6142
6155
|
},
|
6143
|
-
emits: ["click"],
|
6156
|
+
emits: ["click", "clickDisabledDate"],
|
6144
6157
|
setup(props2, {
|
6145
6158
|
emit,
|
6146
6159
|
slots
|
@@ -6186,6 +6199,8 @@ var stdin_default$1h = vue.defineComponent({
|
|
6186
6199
|
const onClick = () => {
|
6187
6200
|
if (props2.item.type !== "disabled") {
|
6188
6201
|
emit("click", props2.item);
|
6202
|
+
} else {
|
6203
|
+
emit("clickDisabledDate", props2.item);
|
6189
6204
|
}
|
6190
6205
|
};
|
6191
6206
|
const renderTopInfo = () => {
|
@@ -6272,7 +6287,7 @@ const calendarMonthProps = {
|
|
6272
6287
|
var stdin_default$1g = vue.defineComponent({
|
6273
6288
|
name: name$16,
|
6274
6289
|
props: calendarMonthProps,
|
6275
|
-
emits: ["click"],
|
6290
|
+
emits: ["click", "clickDisabledDate"],
|
6276
6291
|
setup(props2, {
|
6277
6292
|
emit,
|
6278
6293
|
slots
|
@@ -6431,7 +6446,8 @@ var stdin_default$1g = vue.defineComponent({
|
|
6431
6446
|
"color": props2.color,
|
6432
6447
|
"offset": offset.value,
|
6433
6448
|
"rowHeight": rowHeight.value,
|
6434
|
-
"onClick": (item2) => emit("click", item2)
|
6449
|
+
"onClick": (item2) => emit("click", item2),
|
6450
|
+
"onClickDisabledDate": (item2) => emit("clickDisabledDate", item2)
|
6435
6451
|
}, pick(slots, ["top-info", "bottom-info"]));
|
6436
6452
|
const renderDays = () => vue.createVNode("div", {
|
6437
6453
|
"ref": daysRef,
|
@@ -6556,7 +6572,7 @@ const calendarProps = {
|
|
6556
6572
|
var stdin_default$1e = vue.defineComponent({
|
6557
6573
|
name: name$18,
|
6558
6574
|
props: calendarProps,
|
6559
|
-
emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle"],
|
6575
|
+
emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate"],
|
6560
6576
|
setup(props2, {
|
6561
6577
|
emit,
|
6562
6578
|
slots
|
@@ -6824,7 +6840,8 @@ var stdin_default$1e = vue.defineComponent({
|
|
6824
6840
|
"showMonthTitle": showMonthTitle,
|
6825
6841
|
"firstDayOfWeek": dayOffset.value
|
6826
6842
|
}, pick(props2, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
|
6827
|
-
"onClick": onClickDay
|
6843
|
+
"onClick": onClickDay,
|
6844
|
+
"onClickDisabledDate": (item) => emit("clickDisabledDate", item)
|
6828
6845
|
}), pick(slots, ["top-info", "bottom-info", "month-title"]));
|
6829
6846
|
};
|
6830
6847
|
const renderFooterButton = () => {
|
@@ -7442,7 +7459,7 @@ var stdin_default$1a = vue.defineComponent({
|
|
7442
7459
|
}), {
|
7443
7460
|
[BORDER_TOP_BOTTOM]: props2.border && !props2.inset
|
7444
7461
|
}]
|
7445
|
-
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
7462
|
+
}, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
7446
7463
|
};
|
7447
7464
|
const renderTitle = () => vue.createVNode("div", {
|
7448
7465
|
"class": bem$10("title", {
|
@@ -9402,7 +9419,7 @@ function initInstance$2() {
|
|
9402
9419
|
}
|
9403
9420
|
function showDialog(options) {
|
9404
9421
|
if (!inBrowser) {
|
9405
|
-
return Promise.resolve();
|
9422
|
+
return Promise.resolve(void 0);
|
9406
9423
|
}
|
9407
9424
|
return new Promise((resolve, reject) => {
|
9408
9425
|
if (!instance$2) {
|
@@ -9943,7 +9960,7 @@ const FloatingBubble = withInstall(stdin_default$R);
|
|
9943
9960
|
const floatingPanelProps = {
|
9944
9961
|
height: makeNumericProp(0),
|
9945
9962
|
anchors: makeArrayProp(),
|
9946
|
-
duration: makeNumericProp(0.
|
9963
|
+
duration: makeNumericProp(0.3),
|
9947
9964
|
contentDraggable: truthProp,
|
9948
9965
|
lockScroll: Boolean,
|
9949
9966
|
safeAreaInsetBottom: truthProp
|
@@ -9973,7 +9990,7 @@ var stdin_default$Q = vue.defineComponent({
|
|
9973
9990
|
const rootStyle = vue.computed(() => ({
|
9974
9991
|
height: addUnit(boundary.value.max),
|
9975
9992
|
transform: `translateY(calc(100% + ${addUnit(-height.value)}))`,
|
9976
|
-
transition: !dragging.value ? `transform ${props2.duration}s` : "none"
|
9993
|
+
transition: !dragging.value ? `transform ${props2.duration}s cubic-bezier(0.18, 0.89, 0.32, 1.28)` : "none"
|
9977
9994
|
}));
|
9978
9995
|
const ease = (moveY) => {
|
9979
9996
|
const absDistance = Math.abs(moveY);
|
@@ -10033,7 +10050,7 @@ var stdin_default$Q = vue.defineComponent({
|
|
10033
10050
|
}, {
|
10034
10051
|
immediate: true
|
10035
10052
|
});
|
10036
|
-
useLockScroll(rootRef, () => props2.lockScroll);
|
10053
|
+
useLockScroll(rootRef, () => props2.lockScroll || dragging.value);
|
10037
10054
|
use.useEventListener("touchmove", onTouchmove, {
|
10038
10055
|
target: rootRef
|
10039
10056
|
});
|
@@ -12256,7 +12273,7 @@ var stdin_default$B = vue.defineComponent({
|
|
12256
12273
|
"transition": "van-popover-zoom",
|
12257
12274
|
"lockScroll": false,
|
12258
12275
|
"onUpdate:show": updateShow
|
12259
|
-
}, attrs, pick(props2, popupProps)), {
|
12276
|
+
}, attrs, useScopeId(), pick(props2, popupProps)), {
|
12260
12277
|
default: () => [props2.showArrow && vue.createVNode("div", {
|
12261
12278
|
"class": bem$s("arrow")
|
12262
12279
|
}, null), vue.createVNode("div", {
|
@@ -13259,12 +13276,16 @@ var stdin_default$r = vue.defineComponent({
|
|
13259
13276
|
const empty = document.createElement("canvas");
|
13260
13277
|
empty.width = canvas.width;
|
13261
13278
|
empty.height = canvas.height;
|
13279
|
+
if (props2.backgroundColor) {
|
13280
|
+
const emptyCtx = empty.getContext("2d");
|
13281
|
+
setCanvasBgColor(emptyCtx);
|
13282
|
+
}
|
13262
13283
|
return canvas.toDataURL() === empty.toDataURL();
|
13263
13284
|
};
|
13264
|
-
const setCanvasBgColor = () => {
|
13265
|
-
if (
|
13266
|
-
|
13267
|
-
|
13285
|
+
const setCanvasBgColor = (ctx) => {
|
13286
|
+
if (ctx && props2.backgroundColor) {
|
13287
|
+
ctx.fillStyle = props2.backgroundColor;
|
13288
|
+
ctx.fillRect(0, 0, state.width, state.height);
|
13268
13289
|
}
|
13269
13290
|
};
|
13270
13291
|
const submit = () => {
|
@@ -13287,7 +13308,7 @@ var stdin_default$r = vue.defineComponent({
|
|
13287
13308
|
if (state.ctx) {
|
13288
13309
|
state.ctx.clearRect(0, 0, state.width, state.height);
|
13289
13310
|
state.ctx.closePath();
|
13290
|
-
setCanvasBgColor();
|
13311
|
+
setCanvasBgColor(state.ctx);
|
13291
13312
|
}
|
13292
13313
|
emit("clear");
|
13293
13314
|
};
|
@@ -13298,7 +13319,7 @@ var stdin_default$r = vue.defineComponent({
|
|
13298
13319
|
state.width = (((_b = wrapRef.value) == null ? void 0 : _b.offsetWidth) || 0) * state.ratio;
|
13299
13320
|
state.height = (((_c = wrapRef.value) == null ? void 0 : _c.offsetHeight) || 0) * state.ratio;
|
13300
13321
|
vue.nextTick(() => {
|
13301
|
-
setCanvasBgColor();
|
13322
|
+
setCanvasBgColor(state.ctx);
|
13302
13323
|
});
|
13303
13324
|
}
|
13304
13325
|
});
|
@@ -14372,6 +14393,7 @@ var stdin_default$c = vue.defineComponent({
|
|
14372
14393
|
let opened;
|
14373
14394
|
let lockClick2;
|
14374
14395
|
let startOffset;
|
14396
|
+
let isInBeforeClosing;
|
14375
14397
|
const root = vue.ref();
|
14376
14398
|
const leftRef = vue.ref();
|
14377
14399
|
const rightRef = vue.ref();
|
@@ -14448,14 +14470,22 @@ var stdin_default$c = vue.defineComponent({
|
|
14448
14470
|
}
|
14449
14471
|
};
|
14450
14472
|
const onClick = (position = "outside") => {
|
14473
|
+
if (isInBeforeClosing)
|
14474
|
+
return;
|
14451
14475
|
emit("click", position);
|
14452
14476
|
if (opened && !lockClick2) {
|
14477
|
+
isInBeforeClosing = true;
|
14453
14478
|
callInterceptor(props2.beforeClose, {
|
14454
14479
|
args: [{
|
14455
14480
|
name: props2.name,
|
14456
14481
|
position
|
14457
14482
|
}],
|
14458
|
-
done: () =>
|
14483
|
+
done: () => {
|
14484
|
+
isInBeforeClosing = false;
|
14485
|
+
close(position);
|
14486
|
+
},
|
14487
|
+
canceled: () => isInBeforeClosing = false,
|
14488
|
+
error: () => isInBeforeClosing = false
|
14459
14489
|
});
|
14460
14490
|
}
|
14461
14491
|
};
|
@@ -16475,7 +16505,7 @@ const Lazyload = {
|
|
16475
16505
|
});
|
16476
16506
|
}
|
16477
16507
|
};
|
16478
|
-
const version = "4.
|
16508
|
+
const version = "4.7.1";
|
16479
16509
|
function install(app) {
|
16480
16510
|
const components = [
|
16481
16511
|
ActionBar,
|