vant 4.0.0-rc.6 → 4.0.0-rc.7
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/action-sheet/index.css +1 -1
- package/es/composables/use-sync-prop-ref.d.ts +2 -0
- package/es/composables/use-sync-prop-ref.mjs +18 -0
- package/es/date-picker/DatePicker.mjs +4 -1
- package/es/image-preview/ImagePreview.d.ts +2 -1
- package/es/image-preview/ImagePreview.mjs +6 -3
- package/es/image-preview/ImagePreviewItem.d.ts +2 -1
- package/es/image-preview/ImagePreviewItem.mjs +15 -11
- package/es/image-preview/index.d.ts +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/lazyload/vue-lazyload/lazy-image.mjs +5 -5
- package/es/picker/Picker.mjs +4 -2
- package/es/picker/PickerColumn.mjs +5 -4
- package/es/popover/Popover.mjs +13 -8
- package/es/skeleton/Skeleton.d.ts +23 -23
- package/es/skeleton/Skeleton.mjs +28 -23
- package/es/skeleton/SkeletonAvatar.d.ts +26 -0
- package/es/skeleton/SkeletonAvatar.mjs +22 -0
- package/es/skeleton/SkeletonImage.d.ts +26 -0
- package/es/skeleton/SkeletonImage.mjs +26 -0
- package/es/skeleton/SkeletonParagraph.d.ts +27 -0
- package/es/skeleton/SkeletonParagraph.mjs +31 -0
- package/es/skeleton/SkeletonTitle.d.ts +16 -0
- package/es/skeleton/SkeletonTitle.mjs +26 -0
- package/es/skeleton/index.css +1 -1
- package/es/skeleton/index.d.ts +85 -18
- package/es/skeleton/index.mjs +22 -2
- package/es/skeleton/style/index.mjs +2 -0
- package/es/skeleton/types.d.ts +7 -3
- package/es/stepper/Stepper.d.ts +1 -1
- package/es/stepper/Stepper.mjs +1 -2
- package/es/stepper/index.d.ts +1 -1
- package/es/time-picker/TimePicker.mjs +4 -1
- package/es/uploader/Uploader.mjs +4 -4
- package/es/utils/constant.d.ts +1 -0
- package/es/utils/constant.mjs +3 -1
- package/lib/action-sheet/index.css +1 -1
- package/lib/composables/use-sync-prop-ref.d.ts +2 -0
- package/lib/composables/use-sync-prop-ref.js +37 -0
- package/lib/date-picker/DatePicker.js +4 -1
- package/lib/image-preview/ImagePreview.d.ts +2 -1
- package/lib/image-preview/ImagePreview.js +6 -3
- package/lib/image-preview/ImagePreviewItem.d.ts +2 -1
- package/lib/image-preview/ImagePreviewItem.js +14 -10
- package/lib/image-preview/index.d.ts +2 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/lazyload/vue-lazyload/lazy-image.js +6 -6
- package/lib/picker/Picker.js +3 -1
- package/lib/picker/PickerColumn.js +5 -4
- package/lib/popover/Popover.js +13 -8
- package/lib/skeleton/Skeleton.d.ts +23 -23
- package/lib/skeleton/Skeleton.js +34 -23
- package/lib/skeleton/SkeletonAvatar.d.ts +26 -0
- package/lib/skeleton/SkeletonAvatar.js +41 -0
- package/lib/skeleton/SkeletonImage.d.ts +26 -0
- package/lib/skeleton/SkeletonImage.js +45 -0
- package/lib/skeleton/SkeletonParagraph.d.ts +27 -0
- package/lib/skeleton/SkeletonParagraph.js +50 -0
- package/lib/skeleton/SkeletonTitle.d.ts +16 -0
- package/lib/skeleton/SkeletonTitle.js +45 -0
- package/lib/skeleton/index.css +1 -1
- package/lib/skeleton/index.d.ts +85 -18
- package/lib/skeleton/index.js +22 -2
- package/lib/skeleton/style/index.js +2 -0
- package/lib/skeleton/types.d.ts +7 -3
- package/lib/stepper/Stepper.d.ts +1 -1
- package/lib/stepper/Stepper.js +1 -2
- package/lib/stepper/index.d.ts +1 -1
- package/lib/time-picker/TimePicker.js +4 -1
- package/lib/uploader/Uploader.js +3 -3
- package/lib/utils/constant.d.ts +1 -0
- package/lib/utils/constant.js +3 -1
- package/lib/vant.cjs.js +900 -778
- package/lib/vant.es.js +900 -778
- package/lib/vant.js +894 -778
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -12164
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
:root{--van-action-sheet-max-height: 80%;--van-action-sheet-header-height: 48px;--van-action-sheet-header-font-size: var(--van-font-size-lg);--van-action-sheet-description-color: var(--van-text-color-2);--van-action-sheet-description-font-size: var(--van-font-size-md);--van-action-sheet-description-line-height: var(--van-line-height-md);--van-action-sheet-item-background: var(--van-background-2);--van-action-sheet-item-font-size: var(--van-font-size-lg);--van-action-sheet-item-line-height: var(--van-line-height-lg);--van-action-sheet-item-text-color: var(--van-text-color);--van-action-sheet-item-disabled-text-color: var(--van-text-color-3);--van-action-sheet-subname-color: var(--van-text-color-2);--van-action-sheet-subname-font-size: var(--van-font-size-sm);--van-action-sheet-subname-line-height: var(--van-line-height-sm);--van-action-sheet-close-icon-size: 22px;--van-action-sheet-close-icon-color: var(--van-gray-5);--van-action-sheet-close-icon-padding: 0 var(--van-padding-md);--van-action-sheet-cancel-text-color: var(--van-gray-7);--van-action-sheet-cancel-padding-top: var(--van-padding-xs);--van-action-sheet-cancel-padding-color: var(--van-background);--van-action-sheet-loading-icon-size: 22px}.van-action-sheet{display:flex;flex-direction:column;max-height:var(--van-action-sheet-max-height);overflow:hidden;color:var(--van-action-sheet-item-text-color)}.van-action-sheet__content{flex:1 auto;overflow-y:auto;-webkit-overflow-scrolling:touch}.van-action-sheet__item,.van-action-sheet__cancel{display:block;width:100%;padding:14px var(--van-padding-md);font-size:var(--van-action-sheet-item-font-size);background:var(--van-action-sheet-item-background);border:none;cursor:pointer}.van-action-sheet__item:active,.van-action-sheet__cancel:active{background-color:var(--van-active-color)}.van-action-sheet__item{line-height:var(--van-action-sheet-item-line-height)}.van-action-sheet__item--loading,.van-action-sheet__item--disabled{color:var(--van-action-sheet-item-disabled-text-color)}.van-action-sheet__item--loading:active,.van-action-sheet__item--disabled:active{background-color:var(--van-action-sheet-item-background)}.van-action-sheet__item--disabled{cursor:not-allowed}.van-action-sheet__item--loading{cursor:default}.van-action-sheet__cancel{flex-shrink:0;box-sizing:border-box;color:var(--van-action-sheet-cancel-text-color)}.van-action-sheet__subname{margin-top:var(--van-padding-xs);color:var(--van-action-sheet-subname-color);font-size:var(--van-action-sheet-subname-font-size);line-height:var(--van-action-sheet-subname-line-height)}.van-action-sheet__gap{display:block;height:var(--van-action-sheet-cancel-padding-top);background:var(--van-action-sheet-cancel-padding-color)}.van-action-sheet__header{flex-shrink:0;font-weight:var(--van-font-bold);font-size:var(--van-action-sheet-header-font-size);line-height:var(--van-action-sheet-header-height);text-align:center}.van-action-sheet__description{position:relative;flex-shrink:0;padding:20px var(--van-padding-md);color:var(--van-action-sheet-description-color);font-size:var(--van-action-sheet-description-font-size);line-height:var(--van-action-sheet-description-line-height);text-align:center}.van-action-sheet__description:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;right:var(--van-padding-md);bottom:0;left:var(--van-padding-md);border-bottom:1px solid var(--van-border-color);transform:scaleY(.5)}.van-action-sheet__loading-icon .van-loading__spinner{width:var(--van-action-sheet-loading-icon-size);height:var(--van-action-sheet-loading-icon-size)}.van-action-sheet__close{position:absolute;top:0;right:0;padding:var(--van-action-sheet-close-icon-padding);color:var(--van-action-sheet-close-icon-color);font-size:var(--van-action-sheet-close-icon-size);line-height:inherit}
|
1
|
+
:root{--van-action-sheet-max-height: 80%;--van-action-sheet-header-height: 48px;--van-action-sheet-header-font-size: var(--van-font-size-lg);--van-action-sheet-description-color: var(--van-text-color-2);--van-action-sheet-description-font-size: var(--van-font-size-md);--van-action-sheet-description-line-height: var(--van-line-height-md);--van-action-sheet-item-background: var(--van-background-2);--van-action-sheet-item-font-size: var(--van-font-size-lg);--van-action-sheet-item-line-height: var(--van-line-height-lg);--van-action-sheet-item-text-color: var(--van-text-color);--van-action-sheet-item-disabled-text-color: var(--van-text-color-3);--van-action-sheet-subname-color: var(--van-text-color-2);--van-action-sheet-subname-font-size: var(--van-font-size-sm);--van-action-sheet-subname-line-height: var(--van-line-height-sm);--van-action-sheet-close-icon-size: 22px;--van-action-sheet-close-icon-color: var(--van-gray-5);--van-action-sheet-close-icon-padding: 0 var(--van-padding-md);--van-action-sheet-cancel-text-color: var(--van-gray-7);--van-action-sheet-cancel-padding-top: var(--van-padding-xs);--van-action-sheet-cancel-padding-color: var(--van-background);--van-action-sheet-loading-icon-size: 22px}.van-action-sheet{display:flex;flex-direction:column;max-height:var(--van-action-sheet-max-height);overflow:hidden;color:var(--van-action-sheet-item-text-color)}.van-action-sheet__content{flex:1 auto;overflow-y:auto;-webkit-overflow-scrolling:touch}.van-action-sheet__item,.van-action-sheet__cancel{display:block;width:100%;padding:14px var(--van-padding-md);font-size:var(--van-action-sheet-item-font-size);background:var(--van-action-sheet-item-background);border:none;cursor:pointer}.van-action-sheet__item:active,.van-action-sheet__cancel:active{background-color:var(--van-active-color)}.van-action-sheet__item{line-height:var(--van-action-sheet-item-line-height)}.van-action-sheet__item--loading,.van-action-sheet__item--disabled{color:var(--van-action-sheet-item-disabled-text-color)}.van-action-sheet__item--loading:active,.van-action-sheet__item--disabled:active{background-color:var(--van-action-sheet-item-background)}.van-action-sheet__item--disabled{cursor:not-allowed}.van-action-sheet__item--loading{cursor:default}.van-action-sheet__cancel{flex-shrink:0;box-sizing:border-box;color:var(--van-action-sheet-cancel-text-color)}.van-action-sheet__subname{margin-top:var(--van-padding-xs);color:var(--van-action-sheet-subname-color);font-size:var(--van-action-sheet-subname-font-size);line-height:var(--van-action-sheet-subname-line-height)}.van-action-sheet__gap{display:block;height:var(--van-action-sheet-cancel-padding-top);background:var(--van-action-sheet-cancel-padding-color)}.van-action-sheet__header{flex-shrink:0;font-weight:var(--van-font-bold);font-size:var(--van-action-sheet-header-font-size);line-height:var(--van-action-sheet-header-height);text-align:center}.van-action-sheet__description{position:relative;flex-shrink:0;padding:20px var(--van-padding-md);color:var(--van-action-sheet-description-color);font-size:var(--van-action-sheet-description-font-size);line-height:var(--van-action-sheet-description-line-height);text-align:center}.van-action-sheet__description:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;right:var(--van-padding-md);bottom:0;left:var(--van-padding-md);border-bottom:1px solid var(--van-border-color);transform:scaleY(.5)}.van-action-sheet__loading-icon .van-loading__spinner{width:var(--van-action-sheet-loading-icon-size);height:var(--van-action-sheet-loading-icon-size)}.van-action-sheet__close{position:absolute;top:0;right:0;z-index:1;padding:var(--van-action-sheet-close-icon-padding);color:var(--van-action-sheet-close-icon-color);font-size:var(--van-action-sheet-close-icon-size);line-height:inherit}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { ref, watch } from "vue";
|
2
|
+
const useSyncPropRef = (getProp, setProp) => {
|
3
|
+
const propRef = ref(getProp());
|
4
|
+
watch(getProp, (value) => {
|
5
|
+
if (value !== propRef.value) {
|
6
|
+
propRef.value = value;
|
7
|
+
}
|
8
|
+
});
|
9
|
+
watch(propRef, (value) => {
|
10
|
+
if (value !== getProp()) {
|
11
|
+
setProp(value);
|
12
|
+
}
|
13
|
+
});
|
14
|
+
return propRef;
|
15
|
+
};
|
16
|
+
export {
|
17
|
+
useSyncPropRef
|
18
|
+
};
|
@@ -80,7 +80,10 @@ var stdin_default = defineComponent({
|
|
80
80
|
case "day":
|
81
81
|
return genDayOptions();
|
82
82
|
default:
|
83
|
-
|
83
|
+
if (process.env.NODE_ENV !== "production") {
|
84
|
+
throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
|
85
|
+
}
|
86
|
+
return [];
|
84
87
|
}
|
85
88
|
}));
|
86
89
|
watch(currentValues, (newValues) => {
|
@@ -109,7 +109,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
109
109
|
type: PropType<PopupCloseIconPosition>;
|
110
110
|
default: PopupCloseIconPosition;
|
111
111
|
};
|
112
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "closed" | "update:show" | "scale")[], "change" | "close" | "closed" | "update:show" | "scale", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
112
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "closed" | "update:show" | "scale" | "longPress")[], "change" | "close" | "closed" | "update:show" | "scale" | "longPress", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
113
113
|
show: BooleanConstructor;
|
114
114
|
loop: {
|
115
115
|
type: BooleanConstructor;
|
@@ -168,6 +168,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
168
168
|
onClosed?: ((...args: any[]) => any) | undefined;
|
169
169
|
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
170
170
|
onScale?: ((...args: any[]) => any) | undefined;
|
171
|
+
onLongPress?: ((...args: any[]) => any) | undefined;
|
171
172
|
}, {
|
172
173
|
loop: boolean;
|
173
174
|
overlay: boolean;
|
@@ -33,7 +33,7 @@ const imagePreviewProps = {
|
|
33
33
|
var stdin_default = defineComponent({
|
34
34
|
name,
|
35
35
|
props: imagePreviewProps,
|
36
|
-
emits: ["scale", "close", "closed", "change", "update:show"],
|
36
|
+
emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
|
37
37
|
setup(props, {
|
38
38
|
emit,
|
39
39
|
slots
|
@@ -93,7 +93,7 @@ var stdin_default = defineComponent({
|
|
93
93
|
"indicatorColor": "white",
|
94
94
|
"onChange": setActive
|
95
95
|
}, {
|
96
|
-
default: () => [props.images.map((image) => _createVNode(ImagePreviewItem, {
|
96
|
+
default: () => [props.images.map((image, index) => _createVNode(ImagePreviewItem, {
|
97
97
|
"src": image,
|
98
98
|
"show": props.show,
|
99
99
|
"active": state.active,
|
@@ -102,7 +102,10 @@ var stdin_default = defineComponent({
|
|
102
102
|
"rootWidth": state.rootWidth,
|
103
103
|
"rootHeight": state.rootHeight,
|
104
104
|
"onScale": emitScale,
|
105
|
-
"onClose": emitClose
|
105
|
+
"onClose": emitClose,
|
106
|
+
"onLongPress": () => emit("longPress", {
|
107
|
+
index
|
108
|
+
})
|
106
109
|
}, {
|
107
110
|
image: slots.image
|
108
111
|
}))]
|
@@ -18,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
18
18
|
type: NumberConstructor;
|
19
19
|
required: true;
|
20
20
|
};
|
21
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "scale")[], "close" | "scale", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
21
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "scale" | "longPress")[], "close" | "scale" | "longPress", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
22
22
|
src: StringConstructor;
|
23
23
|
show: BooleanConstructor;
|
24
24
|
active: NumberConstructor;
|
@@ -41,6 +41,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
41
41
|
}>> & {
|
42
42
|
onClose?: ((...args: any[]) => any) | undefined;
|
43
43
|
onScale?: ((...args: any[]) => any) | undefined;
|
44
|
+
onLongPress?: ((...args: any[]) => any) | undefined;
|
44
45
|
}, {
|
45
46
|
show: boolean;
|
46
47
|
}>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
2
|
import { ref, watch, computed, reactive, defineComponent } from "vue";
|
3
|
-
import { clamp, numericProp, preventDefault, createNamespace, makeRequiredProp } from "../utils/index.mjs";
|
3
|
+
import { clamp, numericProp, preventDefault, createNamespace, makeRequiredProp, LONG_PRESS_START_TIME } from "../utils/index.mjs";
|
4
4
|
import { useTouch } from "../composables/use-touch.mjs";
|
5
5
|
import { useEventListener } from "@vant/use";
|
6
6
|
import { Image } from "../image/index.mjs";
|
@@ -18,7 +18,7 @@ var stdin_default = defineComponent({
|
|
18
18
|
rootWidth: makeRequiredProp(Number),
|
19
19
|
rootHeight: makeRequiredProp(Number)
|
20
20
|
},
|
21
|
-
emits: ["scale", "close"],
|
21
|
+
emits: ["scale", "close", "longPress"],
|
22
22
|
setup(props, {
|
23
23
|
emit,
|
24
24
|
slots
|
@@ -165,16 +165,20 @@ var stdin_default = defineComponent({
|
|
165
165
|
const deltaTime = Date.now() - touchStartTime;
|
166
166
|
const TAP_TIME = 250;
|
167
167
|
const TAP_OFFSET = 5;
|
168
|
-
if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET
|
169
|
-
if (
|
170
|
-
|
171
|
-
|
172
|
-
toggleScale();
|
173
|
-
} else {
|
174
|
-
doubleTapTimer = setTimeout(() => {
|
175
|
-
emit("close");
|
168
|
+
if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET) {
|
169
|
+
if (deltaTime < TAP_TIME) {
|
170
|
+
if (doubleTapTimer) {
|
171
|
+
clearTimeout(doubleTapTimer);
|
176
172
|
doubleTapTimer = null;
|
177
|
-
|
173
|
+
toggleScale();
|
174
|
+
} else {
|
175
|
+
doubleTapTimer = setTimeout(() => {
|
176
|
+
emit("close");
|
177
|
+
doubleTapTimer = null;
|
178
|
+
}, TAP_TIME);
|
179
|
+
}
|
180
|
+
} else if (deltaTime > LONG_PRESS_START_TIME) {
|
181
|
+
emit("longPress");
|
178
182
|
}
|
179
183
|
}
|
180
184
|
};
|
@@ -52,7 +52,7 @@ export declare const ImagePreview: import("../utils").WithInstall<import("vue").
|
|
52
52
|
type: import("vue").PropType<import("..").PopupCloseIconPosition>;
|
53
53
|
default: import("..").PopupCloseIconPosition;
|
54
54
|
};
|
55
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "closed" | "update:show" | "scale")[], "change" | "close" | "closed" | "update:show" | "scale", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
55
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "closed" | "update:show" | "scale" | "longPress")[], "change" | "close" | "closed" | "update:show" | "scale" | "longPress", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
56
56
|
show: BooleanConstructor;
|
57
57
|
loop: {
|
58
58
|
type: BooleanConstructor;
|
@@ -111,6 +111,7 @@ export declare const ImagePreview: import("../utils").WithInstall<import("vue").
|
|
111
111
|
onClosed?: ((...args: any[]) => any) | undefined;
|
112
112
|
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
113
113
|
onScale?: ((...args: any[]) => any) | undefined;
|
114
|
+
onLongPress?: ((...args: any[]) => any) | undefined;
|
114
115
|
}, {
|
115
116
|
loop: boolean;
|
116
117
|
overlay: boolean;
|
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
@@ -86,7 +86,7 @@ import { TimePicker } from "./time-picker/index.mjs";
|
|
86
86
|
import { Toast } from "./toast/index.mjs";
|
87
87
|
import { TreeSelect } from "./tree-select/index.mjs";
|
88
88
|
import { Uploader } from "./uploader/index.mjs";
|
89
|
-
const version = "4.0.0-rc.
|
89
|
+
const version = "4.0.0-rc.7";
|
90
90
|
function install(app) {
|
91
91
|
const components = [
|
92
92
|
ActionBar,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { useRect } from "@vant/use";
|
2
2
|
import { loadImageAsync } from "./util.mjs";
|
3
3
|
import { noop } from "../../utils/index.mjs";
|
4
|
+
import { h } from "vue";
|
4
5
|
var stdin_default = (lazyManager) => ({
|
5
6
|
props: {
|
6
7
|
src: [String, Object],
|
@@ -9,15 +10,14 @@ var stdin_default = (lazyManager) => ({
|
|
9
10
|
default: "img"
|
10
11
|
}
|
11
12
|
},
|
12
|
-
render(
|
13
|
+
render() {
|
14
|
+
var _a, _b;
|
13
15
|
return h(
|
14
16
|
this.tag,
|
15
17
|
{
|
16
|
-
|
17
|
-
src: this.renderSrc
|
18
|
-
}
|
18
|
+
src: this.renderSrc
|
19
19
|
},
|
20
|
-
this.$slots.default
|
20
|
+
(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
|
21
21
|
);
|
22
22
|
},
|
23
23
|
data() {
|
package/es/picker/Picker.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
2
|
-
import { ref, watch, computed, defineComponent } from "vue";
|
2
|
+
import { ref, watch, computed, nextTick, defineComponent } from "vue";
|
3
3
|
import { pick, extend, unitToPx, truthProp, isSameValue, makeArrayProp, preventDefault, makeStringProp, makeNumericProp, BORDER_UNSET_TOP_BOTTOM } from "../utils/index.mjs";
|
4
4
|
import { bem, name, isOptionExist, getColumnsType, findOptionByValue, assignDefaultFields, formatCascadeColumns, getFirstEnabledOption } from "./utils.mjs";
|
5
5
|
import { useChildren, useEventListener, useParent } from "@vant/use";
|
@@ -91,7 +91,9 @@ var stdin_default = defineComponent({
|
|
91
91
|
const confirm = () => {
|
92
92
|
children.forEach((child) => child.stopMomentum());
|
93
93
|
const params = getEventParams();
|
94
|
-
|
94
|
+
nextTick(() => {
|
95
|
+
emit("confirm", params);
|
96
|
+
});
|
95
97
|
return params;
|
96
98
|
};
|
97
99
|
const cancel = () => emit("cancel", getEventParams());
|
@@ -55,8 +55,9 @@ var stdin_default = defineComponent({
|
|
55
55
|
}
|
56
56
|
currentOffset.value = offset;
|
57
57
|
};
|
58
|
+
const isReadonly = () => props.readonly || !props.options.length;
|
58
59
|
const onClickOption = (index) => {
|
59
|
-
if (moving ||
|
60
|
+
if (moving || isReadonly()) {
|
60
61
|
return;
|
61
62
|
}
|
62
63
|
transitionEndTrigger = null;
|
@@ -81,7 +82,7 @@ var stdin_default = defineComponent({
|
|
81
82
|
}
|
82
83
|
};
|
83
84
|
const onTouchStart = (event) => {
|
84
|
-
if (
|
85
|
+
if (isReadonly()) {
|
85
86
|
return;
|
86
87
|
}
|
87
88
|
touch.start(event);
|
@@ -96,7 +97,7 @@ var stdin_default = defineComponent({
|
|
96
97
|
transitionEndTrigger = null;
|
97
98
|
};
|
98
99
|
const onTouchMove = (event) => {
|
99
|
-
if (
|
100
|
+
if (isReadonly()) {
|
100
101
|
return;
|
101
102
|
}
|
102
103
|
touch.move(event);
|
@@ -112,7 +113,7 @@ var stdin_default = defineComponent({
|
|
112
113
|
}
|
113
114
|
};
|
114
115
|
const onTouchEnd = () => {
|
115
|
-
if (
|
116
|
+
if (isReadonly()) {
|
116
117
|
return;
|
117
118
|
}
|
118
119
|
const distance = currentOffset.value - momentumOffset;
|
package/es/popover/Popover.mjs
CHANGED
@@ -3,10 +3,11 @@ import { ref, watch, nextTick, onMounted, watchEffect, onBeforeUnmount, defineCo
|
|
3
3
|
import { createPopper, offsetModifier } from "@vant/popperjs";
|
4
4
|
import { pick, extend, truthProp, numericProp, unknownProp, BORDER_BOTTOM, makeArrayProp, makeStringProp, createNamespace } from "../utils/index.mjs";
|
5
5
|
import { useClickAway } from "@vant/use";
|
6
|
+
import { useSyncPropRef } from "../composables/use-sync-prop-ref.mjs";
|
6
7
|
import { Icon } from "../icon/index.mjs";
|
7
8
|
import { Popup } from "../popup/index.mjs";
|
8
9
|
const [name, bem] = createNamespace("popover");
|
9
|
-
const popupProps = ["
|
10
|
+
const popupProps = ["overlay", "duration", "teleport", "overlayStyle", "overlayClass", "closeOnClickOverlay"];
|
10
11
|
const popoverProps = {
|
11
12
|
show: Boolean,
|
12
13
|
theme: makeStringProp("light"),
|
@@ -44,6 +45,7 @@ var stdin_default = defineComponent({
|
|
44
45
|
const popupRef = ref();
|
45
46
|
const wrapperRef = ref();
|
46
47
|
const popoverRef = ref();
|
48
|
+
const show = useSyncPropRef(() => props.show, (value) => emit("update:show", value));
|
47
49
|
const getPopoverOptions = () => ({
|
48
50
|
placement: props.placement,
|
49
51
|
modifiers: [{
|
@@ -66,7 +68,7 @@ var stdin_default = defineComponent({
|
|
66
68
|
};
|
67
69
|
const updateLocation = () => {
|
68
70
|
nextTick(() => {
|
69
|
-
if (!
|
71
|
+
if (!show.value) {
|
70
72
|
return;
|
71
73
|
}
|
72
74
|
if (!popper) {
|
@@ -76,10 +78,12 @@ var stdin_default = defineComponent({
|
|
76
78
|
}
|
77
79
|
});
|
78
80
|
};
|
79
|
-
const updateShow = (value) =>
|
81
|
+
const updateShow = (value) => {
|
82
|
+
show.value = value;
|
83
|
+
};
|
80
84
|
const onClickWrapper = () => {
|
81
85
|
if (props.trigger === "click") {
|
82
|
-
|
86
|
+
show.value = !show.value;
|
83
87
|
}
|
84
88
|
};
|
85
89
|
const onClickAction = (action, index) => {
|
@@ -88,12 +92,12 @@ var stdin_default = defineComponent({
|
|
88
92
|
}
|
89
93
|
emit("select", action, index);
|
90
94
|
if (props.closeOnClickAction) {
|
91
|
-
|
95
|
+
show.value = false;
|
92
96
|
}
|
93
97
|
};
|
94
98
|
const onClickAway = () => {
|
95
|
-
if (
|
96
|
-
|
99
|
+
if (show.value && props.closeOnClickOutside && (!props.overlay || props.closeOnClickOverlay)) {
|
100
|
+
show.value = false;
|
97
101
|
}
|
98
102
|
};
|
99
103
|
const renderActionContent = (action, index) => {
|
@@ -145,7 +149,7 @@ var stdin_default = defineComponent({
|
|
145
149
|
popper = null;
|
146
150
|
}
|
147
151
|
});
|
148
|
-
watch(() => [
|
152
|
+
watch(() => [show.value, props.offset, props.placement], updateLocation);
|
149
153
|
useClickAway([wrapperRef, popupRef], onClickAway, {
|
150
154
|
eventName: "touchstart"
|
151
155
|
});
|
@@ -157,6 +161,7 @@ var stdin_default = defineComponent({
|
|
157
161
|
"onClick": onClickWrapper
|
158
162
|
}, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), _createVNode(Popup, _mergeProps({
|
159
163
|
"ref": popoverRef,
|
164
|
+
"show": show.value,
|
160
165
|
"class": bem([props.theme]),
|
161
166
|
"position": "",
|
162
167
|
"transition": "van-popover-zoom",
|
@@ -1,14 +1,20 @@
|
|
1
1
|
import { type PropType, type ExtractPropTypes } from 'vue';
|
2
2
|
import { type Numeric } from '../utils';
|
3
|
-
|
3
|
+
import type { SkeletonAvatarShape } from './types';
|
4
4
|
export declare const skeletonProps: {
|
5
5
|
row: {
|
6
6
|
type: (NumberConstructor | StringConstructor)[];
|
7
7
|
default: number;
|
8
8
|
};
|
9
|
-
title: BooleanConstructor;
|
10
9
|
round: BooleanConstructor;
|
10
|
+
title: BooleanConstructor;
|
11
|
+
titleWidth: (NumberConstructor | StringConstructor)[];
|
11
12
|
avatar: BooleanConstructor;
|
13
|
+
avatarSize: (NumberConstructor | StringConstructor)[];
|
14
|
+
avatarShape: {
|
15
|
+
type: PropType<SkeletonAvatarShape>;
|
16
|
+
default: SkeletonAvatarShape;
|
17
|
+
};
|
12
18
|
loading: {
|
13
19
|
type: BooleanConstructor;
|
14
20
|
default: true;
|
@@ -17,12 +23,6 @@ export declare const skeletonProps: {
|
|
17
23
|
type: BooleanConstructor;
|
18
24
|
default: true;
|
19
25
|
};
|
20
|
-
avatarSize: (NumberConstructor | StringConstructor)[];
|
21
|
-
titleWidth: (NumberConstructor | StringConstructor)[];
|
22
|
-
avatarShape: {
|
23
|
-
type: PropType<SkeletonAvatarShape>;
|
24
|
-
default: SkeletonAvatarShape;
|
25
|
-
};
|
26
26
|
rowWidth: {
|
27
27
|
type: PropType<Numeric | Numeric[]>;
|
28
28
|
default: string;
|
@@ -34,9 +34,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
34
34
|
type: (NumberConstructor | StringConstructor)[];
|
35
35
|
default: number;
|
36
36
|
};
|
37
|
-
title: BooleanConstructor;
|
38
37
|
round: BooleanConstructor;
|
38
|
+
title: BooleanConstructor;
|
39
|
+
titleWidth: (NumberConstructor | StringConstructor)[];
|
39
40
|
avatar: BooleanConstructor;
|
41
|
+
avatarSize: (NumberConstructor | StringConstructor)[];
|
42
|
+
avatarShape: {
|
43
|
+
type: PropType<SkeletonAvatarShape>;
|
44
|
+
default: SkeletonAvatarShape;
|
45
|
+
};
|
40
46
|
loading: {
|
41
47
|
type: BooleanConstructor;
|
42
48
|
default: true;
|
@@ -45,12 +51,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
45
51
|
type: BooleanConstructor;
|
46
52
|
default: true;
|
47
53
|
};
|
48
|
-
avatarSize: (NumberConstructor | StringConstructor)[];
|
49
|
-
titleWidth: (NumberConstructor | StringConstructor)[];
|
50
|
-
avatarShape: {
|
51
|
-
type: PropType<SkeletonAvatarShape>;
|
52
|
-
default: SkeletonAvatarShape;
|
53
|
-
};
|
54
54
|
rowWidth: {
|
55
55
|
type: PropType<Numeric | Numeric[]>;
|
56
56
|
default: string;
|
@@ -62,9 +62,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
62
62
|
type: (NumberConstructor | StringConstructor)[];
|
63
63
|
default: number;
|
64
64
|
};
|
65
|
-
title: BooleanConstructor;
|
66
65
|
round: BooleanConstructor;
|
66
|
+
title: BooleanConstructor;
|
67
|
+
titleWidth: (NumberConstructor | StringConstructor)[];
|
67
68
|
avatar: BooleanConstructor;
|
69
|
+
avatarSize: (NumberConstructor | StringConstructor)[];
|
70
|
+
avatarShape: {
|
71
|
+
type: PropType<SkeletonAvatarShape>;
|
72
|
+
default: SkeletonAvatarShape;
|
73
|
+
};
|
68
74
|
loading: {
|
69
75
|
type: BooleanConstructor;
|
70
76
|
default: true;
|
@@ -73,12 +79,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
73
79
|
type: BooleanConstructor;
|
74
80
|
default: true;
|
75
81
|
};
|
76
|
-
avatarSize: (NumberConstructor | StringConstructor)[];
|
77
|
-
titleWidth: (NumberConstructor | StringConstructor)[];
|
78
|
-
avatarShape: {
|
79
|
-
type: PropType<SkeletonAvatarShape>;
|
80
|
-
default: SkeletonAvatarShape;
|
81
|
-
};
|
82
82
|
rowWidth: {
|
83
83
|
type: PropType<Numeric | Numeric[]>;
|
84
84
|
default: string;
|
@@ -89,8 +89,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
89
89
|
round: boolean;
|
90
90
|
loading: boolean;
|
91
91
|
row: string | number;
|
92
|
-
avatar: boolean;
|
93
92
|
avatarShape: SkeletonAvatarShape;
|
94
93
|
rowWidth: Numeric | Numeric[];
|
94
|
+
avatar: boolean;
|
95
95
|
}>;
|
96
96
|
export default _default;
|
package/es/skeleton/Skeleton.mjs
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
-
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
1
|
+
import { mergeProps as _mergeProps, Fragment as _Fragment, createVNode as _createVNode } from "vue";
|
2
2
|
import { defineComponent } from "vue";
|
3
|
-
import { addUnit, truthProp, numericProp,
|
3
|
+
import { addUnit, truthProp, numericProp, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
4
|
+
import SkeletonTitle from "./SkeletonTitle.mjs";
|
5
|
+
import SkeletonAvatar from "./SkeletonAvatar.mjs";
|
6
|
+
import SkeletonParagraph, { DEFAULT_ROW_WIDTH } from "./SkeletonParagraph.mjs";
|
4
7
|
const [name, bem] = createNamespace("skeleton");
|
5
|
-
const DEFAULT_ROW_WIDTH = "100%";
|
6
8
|
const DEFAULT_LAST_ROW_WIDTH = "60%";
|
7
9
|
const skeletonProps = {
|
8
10
|
row: makeNumericProp(0),
|
9
|
-
title: Boolean,
|
10
11
|
round: Boolean,
|
12
|
+
title: Boolean,
|
13
|
+
titleWidth: numericProp,
|
11
14
|
avatar: Boolean,
|
12
|
-
loading: truthProp,
|
13
|
-
animate: truthProp,
|
14
15
|
avatarSize: numericProp,
|
15
|
-
titleWidth: numericProp,
|
16
16
|
avatarShape: makeStringProp("round"),
|
17
|
+
loading: truthProp,
|
18
|
+
animate: truthProp,
|
17
19
|
rowWidth: {
|
18
20
|
type: [Number, String, Array],
|
19
21
|
default: DEFAULT_ROW_WIDTH
|
@@ -29,19 +31,17 @@ var stdin_default = defineComponent({
|
|
29
31
|
}) {
|
30
32
|
const renderAvatar = () => {
|
31
33
|
if (props.avatar) {
|
32
|
-
return _createVNode(
|
33
|
-
"
|
34
|
-
"
|
34
|
+
return _createVNode(SkeletonAvatar, {
|
35
|
+
"avatarShape": props.avatarShape,
|
36
|
+
"avatarSize": props.avatarSize
|
35
37
|
}, null);
|
36
38
|
}
|
37
39
|
};
|
38
40
|
const renderTitle = () => {
|
39
41
|
if (props.title) {
|
40
|
-
return _createVNode(
|
41
|
-
"
|
42
|
-
"
|
43
|
-
width: addUnit(props.titleWidth)
|
44
|
-
}
|
42
|
+
return _createVNode(SkeletonTitle, {
|
43
|
+
"round": props.round,
|
44
|
+
"titleWidth": props.titleWidth
|
45
45
|
}, null);
|
46
46
|
}
|
47
47
|
};
|
@@ -57,12 +57,19 @@ var stdin_default = defineComponent({
|
|
57
57
|
}
|
58
58
|
return rowWidth;
|
59
59
|
};
|
60
|
-
const renderRows = () => Array(+props.row).fill("").map((_, i) => _createVNode(
|
61
|
-
"
|
62
|
-
"
|
63
|
-
|
64
|
-
}
|
60
|
+
const renderRows = () => Array(+props.row).fill("").map((_, i) => _createVNode(SkeletonParagraph, {
|
61
|
+
"key": i,
|
62
|
+
"round": props.round,
|
63
|
+
"rowWidth": addUnit(getRowWidth(i))
|
65
64
|
}, null));
|
65
|
+
const renderContents = () => {
|
66
|
+
if (slots.template) {
|
67
|
+
return slots.template();
|
68
|
+
}
|
69
|
+
return _createVNode(_Fragment, null, [renderAvatar(), _createVNode("div", {
|
70
|
+
"class": bem("content")
|
71
|
+
}, [renderTitle(), renderRows()])]);
|
72
|
+
};
|
66
73
|
return () => {
|
67
74
|
var _a;
|
68
75
|
if (!props.loading) {
|
@@ -73,9 +80,7 @@ var stdin_default = defineComponent({
|
|
73
80
|
animate: props.animate,
|
74
81
|
round: props.round
|
75
82
|
})
|
76
|
-
}, attrs), [
|
77
|
-
"class": bem("content")
|
78
|
-
}, [renderTitle(), renderRows()])]);
|
83
|
+
}, attrs), [renderContents()]);
|
79
84
|
};
|
80
85
|
}
|
81
86
|
});
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { ExtractPropTypes } from 'vue';
|
2
|
+
import type { SkeletonAvatarShape } from './types';
|
3
|
+
export declare const skeletonAvatarProps: {
|
4
|
+
avatarSize: (NumberConstructor | StringConstructor)[];
|
5
|
+
avatarShape: {
|
6
|
+
type: import("vue").PropType<SkeletonAvatarShape>;
|
7
|
+
default: SkeletonAvatarShape;
|
8
|
+
};
|
9
|
+
};
|
10
|
+
export declare type SkeletonAvatarProps = ExtractPropTypes<typeof skeletonAvatarProps>;
|
11
|
+
declare const _default: import("vue").DefineComponent<{
|
12
|
+
avatarSize: (NumberConstructor | StringConstructor)[];
|
13
|
+
avatarShape: {
|
14
|
+
type: import("vue").PropType<SkeletonAvatarShape>;
|
15
|
+
default: SkeletonAvatarShape;
|
16
|
+
};
|
17
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
18
|
+
avatarSize: (NumberConstructor | StringConstructor)[];
|
19
|
+
avatarShape: {
|
20
|
+
type: import("vue").PropType<SkeletonAvatarShape>;
|
21
|
+
default: SkeletonAvatarShape;
|
22
|
+
};
|
23
|
+
}>>, {
|
24
|
+
avatarShape: SkeletonAvatarShape;
|
25
|
+
}>;
|
26
|
+
export default _default;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { createVNode as _createVNode } from "vue";
|
2
|
+
import { defineComponent } from "vue";
|
3
|
+
import { numericProp, getSizeStyle, makeStringProp, createNamespace } from "../utils/index.mjs";
|
4
|
+
const [name, bem] = createNamespace("skeleton-avatar");
|
5
|
+
const skeletonAvatarProps = {
|
6
|
+
avatarSize: numericProp,
|
7
|
+
avatarShape: makeStringProp("round")
|
8
|
+
};
|
9
|
+
var stdin_default = defineComponent({
|
10
|
+
name,
|
11
|
+
props: skeletonAvatarProps,
|
12
|
+
setup(props) {
|
13
|
+
return () => _createVNode("div", {
|
14
|
+
"class": bem([props.avatarShape]),
|
15
|
+
"style": getSizeStyle(props.avatarSize)
|
16
|
+
}, null);
|
17
|
+
}
|
18
|
+
});
|
19
|
+
export {
|
20
|
+
stdin_default as default,
|
21
|
+
skeletonAvatarProps
|
22
|
+
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { type ExtractPropTypes } from 'vue';
|
2
|
+
import type { SkeletonImageShape } from './types';
|
3
|
+
export declare const skeletonImageProps: {
|
4
|
+
imageSize: (NumberConstructor | StringConstructor)[];
|
5
|
+
imageShape: {
|
6
|
+
type: import("vue").PropType<SkeletonImageShape>;
|
7
|
+
default: SkeletonImageShape;
|
8
|
+
};
|
9
|
+
};
|
10
|
+
export declare type SkeletonImageProps = ExtractPropTypes<typeof skeletonImageProps>;
|
11
|
+
declare const _default: import("vue").DefineComponent<{
|
12
|
+
imageSize: (NumberConstructor | StringConstructor)[];
|
13
|
+
imageShape: {
|
14
|
+
type: import("vue").PropType<SkeletonImageShape>;
|
15
|
+
default: SkeletonImageShape;
|
16
|
+
};
|
17
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
18
|
+
imageSize: (NumberConstructor | StringConstructor)[];
|
19
|
+
imageShape: {
|
20
|
+
type: import("vue").PropType<SkeletonImageShape>;
|
21
|
+
default: SkeletonImageShape;
|
22
|
+
};
|
23
|
+
}>>, {
|
24
|
+
imageShape: SkeletonImageShape;
|
25
|
+
}>;
|
26
|
+
export default _default;
|