vant 4.4.1 → 4.5.0
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/address-list/AddressList.d.ts +13 -0
- package/es/address-list/AddressList.mjs +4 -2
- package/es/address-list/AddressListItem.d.ts +9 -0
- package/es/address-list/AddressListItem.mjs +4 -3
- package/es/address-list/index.d.ts +9 -0
- package/es/back-top/BackTop.mjs +14 -1
- package/es/date-picker/DatePicker.d.ts +3 -3
- package/es/date-picker/index.d.ts +2 -2
- package/es/date-picker/utils.d.ts +4 -2
- package/es/date-picker/utils.mjs +8 -3
- package/es/dropdown-menu/DropdownMenu.mjs +10 -3
- package/es/dropdown-menu/types.d.ts +5 -1
- package/es/floating-panel/FloatingPanel.d.ts +77 -0
- package/es/floating-panel/FloatingPanel.mjs +126 -0
- package/es/floating-panel/index.css +1 -0
- package/es/floating-panel/index.d.ts +60 -0
- package/es/floating-panel/index.mjs +8 -0
- package/es/floating-panel/style/index.d.ts +1 -0
- package/es/floating-panel/style/index.mjs +2 -0
- package/es/index.d.ts +2 -1
- package/es/index.mjs +4 -1
- package/es/slider/Slider.mjs +10 -2
- package/es/time-picker/TimePicker.d.ts +31 -4
- package/es/time-picker/TimePicker.mjs +73 -21
- package/es/time-picker/index.d.ts +20 -2
- package/es/utils/basic.d.ts +3 -0
- package/lib/address-list/AddressList.d.ts +13 -0
- package/lib/address-list/AddressList.js +3 -1
- package/lib/address-list/AddressListItem.d.ts +9 -0
- package/lib/address-list/AddressListItem.js +3 -2
- package/lib/address-list/index.d.ts +9 -0
- package/lib/back-top/BackTop.js +13 -0
- package/lib/date-picker/DatePicker.d.ts +3 -3
- package/lib/date-picker/index.d.ts +2 -2
- package/lib/date-picker/utils.d.ts +4 -2
- package/lib/date-picker/utils.js +2 -2
- package/lib/dropdown-menu/DropdownMenu.js +10 -3
- package/lib/dropdown-menu/types.d.ts +5 -1
- package/lib/floating-panel/FloatingPanel.d.ts +77 -0
- package/lib/floating-panel/FloatingPanel.js +145 -0
- package/lib/floating-panel/index.css +1 -0
- package/lib/floating-panel/index.d.ts +60 -0
- package/lib/floating-panel/index.js +37 -0
- package/lib/floating-panel/style/index.d.ts +1 -0
- package/lib/floating-panel/style/index.js +2 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/slider/Slider.js +10 -2
- package/lib/time-picker/TimePicker.d.ts +31 -4
- package/lib/time-picker/TimePicker.js +84 -32
- package/lib/time-picker/index.d.ts +20 -2
- package/lib/utils/basic.d.ts +3 -0
- package/lib/vant.cjs.js +770 -570
- package/lib/vant.es.js +770 -570
- package/lib/vant.js +766 -566
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
@@ -0,0 +1,77 @@
|
|
1
|
+
import { type ExtractPropTypes } from 'vue';
|
2
|
+
export declare const floatingPanelProps: {
|
3
|
+
height: {
|
4
|
+
type: (NumberConstructor | StringConstructor)[];
|
5
|
+
default: number;
|
6
|
+
};
|
7
|
+
anchors: {
|
8
|
+
type: import("vue").PropType<number[]>;
|
9
|
+
default: () => never[];
|
10
|
+
};
|
11
|
+
duration: {
|
12
|
+
type: (NumberConstructor | StringConstructor)[];
|
13
|
+
default: number;
|
14
|
+
};
|
15
|
+
contentDraggable: {
|
16
|
+
type: BooleanConstructor;
|
17
|
+
default: true;
|
18
|
+
};
|
19
|
+
safeAreaInsetBottom: {
|
20
|
+
type: BooleanConstructor;
|
21
|
+
default: true;
|
22
|
+
};
|
23
|
+
};
|
24
|
+
export type FloatingPanelProps = ExtractPropTypes<typeof floatingPanelProps>;
|
25
|
+
declare const _default: import("vue").DefineComponent<{
|
26
|
+
height: {
|
27
|
+
type: (NumberConstructor | StringConstructor)[];
|
28
|
+
default: number;
|
29
|
+
};
|
30
|
+
anchors: {
|
31
|
+
type: import("vue").PropType<number[]>;
|
32
|
+
default: () => never[];
|
33
|
+
};
|
34
|
+
duration: {
|
35
|
+
type: (NumberConstructor | StringConstructor)[];
|
36
|
+
default: number;
|
37
|
+
};
|
38
|
+
contentDraggable: {
|
39
|
+
type: BooleanConstructor;
|
40
|
+
default: true;
|
41
|
+
};
|
42
|
+
safeAreaInsetBottom: {
|
43
|
+
type: BooleanConstructor;
|
44
|
+
default: true;
|
45
|
+
};
|
46
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("heightChange" | "update:height")[], "heightChange" | "update:height", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
47
|
+
height: {
|
48
|
+
type: (NumberConstructor | StringConstructor)[];
|
49
|
+
default: number;
|
50
|
+
};
|
51
|
+
anchors: {
|
52
|
+
type: import("vue").PropType<number[]>;
|
53
|
+
default: () => never[];
|
54
|
+
};
|
55
|
+
duration: {
|
56
|
+
type: (NumberConstructor | StringConstructor)[];
|
57
|
+
default: number;
|
58
|
+
};
|
59
|
+
contentDraggable: {
|
60
|
+
type: BooleanConstructor;
|
61
|
+
default: true;
|
62
|
+
};
|
63
|
+
safeAreaInsetBottom: {
|
64
|
+
type: BooleanConstructor;
|
65
|
+
default: true;
|
66
|
+
};
|
67
|
+
}>> & {
|
68
|
+
onHeightChange?: ((...args: any[]) => any) | undefined;
|
69
|
+
"onUpdate:height"?: ((...args: any[]) => any) | undefined;
|
70
|
+
}, {
|
71
|
+
height: string | number;
|
72
|
+
safeAreaInsetBottom: boolean;
|
73
|
+
duration: string | number;
|
74
|
+
anchors: number[];
|
75
|
+
contentDraggable: boolean;
|
76
|
+
}, {}>;
|
77
|
+
export default _default;
|
@@ -0,0 +1,145 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name2 in all)
|
7
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var stdin_exports = {};
|
19
|
+
__export(stdin_exports, {
|
20
|
+
default: () => stdin_default,
|
21
|
+
floatingPanelProps: () => floatingPanelProps
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(stdin_exports);
|
24
|
+
var import_vue = require("vue");
|
25
|
+
var import_vue2 = require("vue");
|
26
|
+
var import_utils = require("../utils");
|
27
|
+
var import_use = require("@vant/use");
|
28
|
+
var import_use_lock_scroll = require("../composables/use-lock-scroll");
|
29
|
+
var import_use_touch = require("../composables/use-touch");
|
30
|
+
var import_use_sync_prop_ref = require("../composables/use-sync-prop-ref");
|
31
|
+
const {
|
32
|
+
height: windowHeight
|
33
|
+
} = (0, import_use.useWindowSize)();
|
34
|
+
const floatingPanelProps = {
|
35
|
+
height: (0, import_utils.makeNumericProp)(0),
|
36
|
+
anchors: (0, import_utils.makeArrayProp)(),
|
37
|
+
duration: (0, import_utils.makeNumericProp)(0.2),
|
38
|
+
contentDraggable: import_utils.truthProp,
|
39
|
+
safeAreaInsetBottom: import_utils.truthProp
|
40
|
+
};
|
41
|
+
const [name, bem] = (0, import_utils.createNamespace)("floating-panel");
|
42
|
+
const DAMP = 0.2;
|
43
|
+
var stdin_default = (0, import_vue2.defineComponent)({
|
44
|
+
name,
|
45
|
+
props: floatingPanelProps,
|
46
|
+
emits: ["heightChange", "update:height"],
|
47
|
+
setup(props, {
|
48
|
+
emit,
|
49
|
+
slots
|
50
|
+
}) {
|
51
|
+
const rootRef = (0, import_vue2.ref)();
|
52
|
+
const contentRef = (0, import_vue2.ref)();
|
53
|
+
const height = (0, import_use_sync_prop_ref.useSyncPropRef)(() => +props.height, (value) => emit("update:height", value));
|
54
|
+
const boundary = (0, import_vue2.computed)(() => {
|
55
|
+
var _a, _b;
|
56
|
+
return {
|
57
|
+
min: (_a = props.anchors[0]) != null ? _a : 100,
|
58
|
+
max: (_b = props.anchors[props.anchors.length - 1]) != null ? _b : Math.round(windowHeight.value * 0.6)
|
59
|
+
};
|
60
|
+
});
|
61
|
+
const anchors = (0, import_vue2.computed)(() => props.anchors.length >= 2 ? props.anchors : [boundary.value.min, boundary.value.max]);
|
62
|
+
const dragging = (0, import_vue2.ref)(false);
|
63
|
+
const rootStyle = (0, import_vue2.computed)(() => ({
|
64
|
+
height: (0, import_utils.addUnit)(boundary.value.max),
|
65
|
+
transform: `translateY(calc(100% + ${(0, import_utils.addUnit)(-height.value)}))`,
|
66
|
+
transition: !dragging.value ? `transform ${props.duration}s` : "none"
|
67
|
+
}));
|
68
|
+
const ease = (moveY) => {
|
69
|
+
const absDistance = Math.abs(moveY);
|
70
|
+
const {
|
71
|
+
min,
|
72
|
+
max
|
73
|
+
} = boundary.value;
|
74
|
+
if (absDistance > max) {
|
75
|
+
return -(max + (absDistance - max) * DAMP);
|
76
|
+
}
|
77
|
+
if (absDistance < min) {
|
78
|
+
return -(min - (min - absDistance) * DAMP);
|
79
|
+
}
|
80
|
+
return moveY;
|
81
|
+
};
|
82
|
+
const closest = (arr, target) => arr.reduce((pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur);
|
83
|
+
let startY;
|
84
|
+
const touch = (0, import_use_touch.useTouch)();
|
85
|
+
const onTouchstart = (e) => {
|
86
|
+
touch.start(e);
|
87
|
+
dragging.value = true;
|
88
|
+
startY = -height.value;
|
89
|
+
};
|
90
|
+
const onTouchmove = (e) => {
|
91
|
+
var _a;
|
92
|
+
touch.move(e);
|
93
|
+
const target = e.target;
|
94
|
+
if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
|
95
|
+
if (!props.contentDraggable)
|
96
|
+
return;
|
97
|
+
if (-startY < boundary.value.max) {
|
98
|
+
if (e.cancelable)
|
99
|
+
e.preventDefault();
|
100
|
+
e.stopPropagation();
|
101
|
+
} else if (!(contentRef.value.scrollTop <= 0 && touch.deltaY.value > 0)) {
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
const moveY = touch.deltaY.value + startY;
|
106
|
+
height.value = -ease(moveY);
|
107
|
+
};
|
108
|
+
const onTouchend = () => {
|
109
|
+
dragging.value = false;
|
110
|
+
height.value = closest(anchors.value, height.value);
|
111
|
+
if (height.value !== -startY) {
|
112
|
+
emit("heightChange", {
|
113
|
+
height: height.value
|
114
|
+
});
|
115
|
+
}
|
116
|
+
};
|
117
|
+
(0, import_vue2.watch)(boundary, () => {
|
118
|
+
height.value = closest(anchors.value, height.value);
|
119
|
+
}, {
|
120
|
+
immediate: true
|
121
|
+
});
|
122
|
+
(0, import_use_lock_scroll.useLockScroll)(rootRef, () => true);
|
123
|
+
return () => {
|
124
|
+
var _a;
|
125
|
+
return (0, import_vue.createVNode)("div", {
|
126
|
+
"class": [bem(), {
|
127
|
+
"van-safe-area-bottom": props.safeAreaInsetBottom
|
128
|
+
}],
|
129
|
+
"ref": rootRef,
|
130
|
+
"style": rootStyle.value,
|
131
|
+
"onTouchstartPassive": onTouchstart,
|
132
|
+
"onTouchmove": onTouchmove,
|
133
|
+
"onTouchend": onTouchend,
|
134
|
+
"onTouchcancel": onTouchend
|
135
|
+
}, [(0, import_vue.createVNode)("div", {
|
136
|
+
"class": bem("header")
|
137
|
+
}, [(0, import_vue.createVNode)("div", {
|
138
|
+
"class": bem("header-bar")
|
139
|
+
}, null)]), (0, import_vue.createVNode)("div", {
|
140
|
+
"class": bem("content"),
|
141
|
+
"ref": contentRef
|
142
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
|
143
|
+
};
|
144
|
+
}
|
145
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
:root{--van-floating-panel-border-radius: 16px;--van-floating-panel-header-height: 30px;--van-floating-panel-z-index: 999;--van-floating-panel-background: var(--van-background-2);--van-floating-panel-bar-width: 20px;--van-floating-panel-bar-height: 3px;--van-floating-panel-bar-color: var(--van-gray-5)}.van-floating-panel{position:fixed;left:0;bottom:0;width:100vw;z-index:var(--van-floating-panel-z-index);display:flex;flex-direction:column;touch-action:none;border-top-left-radius:var(--van-floating-panel-border-radius);border-top-right-radius:var(--van-floating-panel-border-radius);background:var(--van-floating-panel-background)}.van-floating-panel:after{content:"";display:block;position:absolute;bottom:-100vh;height:100vh;width:100vw;background-color:inherit}.van-floating-panel__header{height:var(--van-floating-panel-header-height);display:flex;justify-content:center;align-items:center;cursor:-webkit-grab;cursor:grab;-webkit-user-select:none;user-select:none}.van-floating-panel__header-bar{height:var(--van-floating-panel-bar-height);width:var(--van-floating-panel-bar-width);border-radius:var(--van-radius-md);background:var(--van-floating-panel-bar-color)}.van-floating-panel__content{flex:1;overflow-y:auto;background-color:var(--van-floating-panel-background)}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { FloatingPanelProps } from './FloatingPanel';
|
2
|
+
export declare const FloatingPanel: import("../utils").WithInstall<import("vue").DefineComponent<{
|
3
|
+
height: {
|
4
|
+
type: (NumberConstructor | StringConstructor)[];
|
5
|
+
default: number;
|
6
|
+
};
|
7
|
+
anchors: {
|
8
|
+
type: import("vue").PropType<number[]>;
|
9
|
+
default: () => never[];
|
10
|
+
};
|
11
|
+
duration: {
|
12
|
+
type: (NumberConstructor | StringConstructor)[];
|
13
|
+
default: number;
|
14
|
+
};
|
15
|
+
contentDraggable: {
|
16
|
+
type: BooleanConstructor;
|
17
|
+
default: true;
|
18
|
+
};
|
19
|
+
safeAreaInsetBottom: {
|
20
|
+
type: BooleanConstructor;
|
21
|
+
default: true;
|
22
|
+
};
|
23
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("heightChange" | "update:height")[], "heightChange" | "update:height", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
24
|
+
height: {
|
25
|
+
type: (NumberConstructor | StringConstructor)[];
|
26
|
+
default: number;
|
27
|
+
};
|
28
|
+
anchors: {
|
29
|
+
type: import("vue").PropType<number[]>;
|
30
|
+
default: () => never[];
|
31
|
+
};
|
32
|
+
duration: {
|
33
|
+
type: (NumberConstructor | StringConstructor)[];
|
34
|
+
default: number;
|
35
|
+
};
|
36
|
+
contentDraggable: {
|
37
|
+
type: BooleanConstructor;
|
38
|
+
default: true;
|
39
|
+
};
|
40
|
+
safeAreaInsetBottom: {
|
41
|
+
type: BooleanConstructor;
|
42
|
+
default: true;
|
43
|
+
};
|
44
|
+
}>> & {
|
45
|
+
onHeightChange?: ((...args: any[]) => any) | undefined;
|
46
|
+
"onUpdate:height"?: ((...args: any[]) => any) | undefined;
|
47
|
+
}, {
|
48
|
+
height: string | number;
|
49
|
+
safeAreaInsetBottom: boolean;
|
50
|
+
duration: string | number;
|
51
|
+
anchors: number[];
|
52
|
+
contentDraggable: boolean;
|
53
|
+
}, {}>>;
|
54
|
+
export default FloatingPanel;
|
55
|
+
export type { FloatingPanelProps };
|
56
|
+
declare module 'vue' {
|
57
|
+
interface GlobalComponents {
|
58
|
+
VanFloatingPanel: typeof FloatingPanel;
|
59
|
+
}
|
60
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
var __create = Object.create;
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __export = (target, all) => {
|
8
|
+
for (var name in all)
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
+
};
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
+
for (let key of __getOwnPropNames(from))
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
+
}
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
+
mod
|
26
|
+
));
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
+
var stdin_exports = {};
|
29
|
+
__export(stdin_exports, {
|
30
|
+
FloatingPanel: () => FloatingPanel,
|
31
|
+
default: () => stdin_default
|
32
|
+
});
|
33
|
+
module.exports = __toCommonJS(stdin_exports);
|
34
|
+
var import_utils = require("../utils");
|
35
|
+
var import_FloatingPanel = __toESM(require("./FloatingPanel"));
|
36
|
+
const FloatingPanel = (0, import_utils.withInstall)(import_FloatingPanel.default);
|
37
|
+
var stdin_default = FloatingPanel;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|