vant 4.2.0 → 4.2.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/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/pagination/Pagination.d.ts +26 -0
- package/es/pagination/Pagination.mjs +14 -4
- package/es/pagination/index.css +1 -1
- package/es/pagination/index.d.ts +18 -0
- package/es/picker/Picker.d.ts +2 -1
- package/es/picker/Picker.mjs +16 -6
- package/es/picker/PickerColumn.d.ts +2 -1
- package/es/picker/PickerColumn.mjs +10 -4
- package/es/picker/index.d.ts +2 -1
- package/es/sticky/Sticky.mjs +20 -4
- package/es/tab/Tab.mjs +24 -6
- package/es/{tabs/TabsTitle.d.ts → tab/TabTitle.d.ts} +1 -2
- package/es/{tabs/TabsTitle.mjs → tab/TabTitle.mjs} +2 -2
- package/es/tabs/Tabs.d.ts +1 -1
- package/es/tabs/Tabs.mjs +15 -30
- package/es/tabs/index.d.ts +1 -1
- package/es/tabs/style/index.mjs +0 -1
- package/es/tabs/types.d.ts +3 -1
- package/es/watermark/Watermark.mjs +3 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/pagination/Pagination.d.ts +26 -0
- package/lib/pagination/Pagination.js +13 -3
- package/lib/pagination/index.css +1 -1
- package/lib/pagination/index.d.ts +18 -0
- package/lib/picker/Picker.d.ts +2 -1
- package/lib/picker/Picker.js +16 -6
- package/lib/picker/PickerColumn.d.ts +2 -1
- package/lib/picker/PickerColumn.js +9 -3
- package/lib/picker/index.d.ts +2 -1
- package/lib/sticky/Sticky.js +18 -2
- package/lib/tab/Tab.js +21 -3
- package/lib/{tabs/TabsTitle.d.ts → tab/TabTitle.d.ts} +1 -2
- package/lib/{tabs/TabsTitle.js → tab/TabTitle.js} +2 -2
- package/lib/tabs/Tabs.d.ts +1 -1
- package/lib/tabs/Tabs.js +13 -28
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/style/index.js +0 -1
- package/lib/tabs/types.d.ts +3 -1
- package/lib/vant.cjs.js +227 -180
- package/lib/vant.es.js +227 -180
- package/lib/vant.js +227 -180
- package/lib/vant.min.js +1 -1
- package/lib/watermark/Watermark.js +3 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
@@ -93,7 +93,7 @@ import { Toast } from "./toast/index.mjs";
|
|
93
93
|
import { TreeSelect } from "./tree-select/index.mjs";
|
94
94
|
import { Uploader } from "./uploader/index.mjs";
|
95
95
|
import { Watermark } from "./watermark/index.mjs";
|
96
|
-
const version = "4.2.
|
96
|
+
const version = "4.2.1";
|
97
97
|
function install(app) {
|
98
98
|
const components = [
|
99
99
|
ActionBar,
|
@@ -28,6 +28,14 @@ export declare const paginationProps: {
|
|
28
28
|
default: number;
|
29
29
|
};
|
30
30
|
forceEllipses: BooleanConstructor;
|
31
|
+
showPrevButton: {
|
32
|
+
type: BooleanConstructor;
|
33
|
+
default: true;
|
34
|
+
};
|
35
|
+
showNextButton: {
|
36
|
+
type: BooleanConstructor;
|
37
|
+
default: true;
|
38
|
+
};
|
31
39
|
};
|
32
40
|
export type PaginationProps = ExtractPropTypes<typeof paginationProps>;
|
33
41
|
declare const _default: import("vue").DefineComponent<{
|
@@ -58,6 +66,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
58
66
|
default: number;
|
59
67
|
};
|
60
68
|
forceEllipses: BooleanConstructor;
|
69
|
+
showPrevButton: {
|
70
|
+
type: BooleanConstructor;
|
71
|
+
default: true;
|
72
|
+
};
|
73
|
+
showNextButton: {
|
74
|
+
type: BooleanConstructor;
|
75
|
+
default: true;
|
76
|
+
};
|
61
77
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
62
78
|
mode: {
|
63
79
|
type: import("vue").PropType<PaginationMode>;
|
@@ -86,6 +102,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
86
102
|
default: number;
|
87
103
|
};
|
88
104
|
forceEllipses: BooleanConstructor;
|
105
|
+
showPrevButton: {
|
106
|
+
type: BooleanConstructor;
|
107
|
+
default: true;
|
108
|
+
};
|
109
|
+
showNextButton: {
|
110
|
+
type: BooleanConstructor;
|
111
|
+
default: true;
|
112
|
+
};
|
89
113
|
}>> & {
|
90
114
|
onChange?: ((...args: any[]) => any) | undefined;
|
91
115
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
@@ -97,5 +121,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
97
121
|
showPageSize: string | number;
|
98
122
|
itemsPerPage: string | number;
|
99
123
|
forceEllipses: boolean;
|
124
|
+
showPrevButton: boolean;
|
125
|
+
showNextButton: boolean;
|
100
126
|
}>;
|
101
127
|
export default _default;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
2
|
import { computed, watchEffect, defineComponent } from "vue";
|
3
|
-
import { clamp, makeStringProp, makeNumberProp, makeNumericProp, createNamespace, BORDER_SURROUND } from "../utils/index.mjs";
|
3
|
+
import { clamp, truthProp, makeStringProp, makeNumberProp, makeNumericProp, createNamespace, BORDER_SURROUND } from "../utils/index.mjs";
|
4
4
|
const [name, bem, t] = createNamespace("pagination");
|
5
5
|
const makePage = (number, text, active) => ({
|
6
6
|
number,
|
@@ -16,7 +16,9 @@ const paginationProps = {
|
|
16
16
|
totalItems: makeNumericProp(0),
|
17
17
|
showPageSize: makeNumericProp(5),
|
18
18
|
itemsPerPage: makeNumericProp(10),
|
19
|
-
forceEllipses: Boolean
|
19
|
+
forceEllipses: Boolean,
|
20
|
+
showPrevButton: truthProp,
|
21
|
+
showNextButton: truthProp
|
20
22
|
};
|
21
23
|
var stdin_default = defineComponent({
|
22
24
|
name,
|
@@ -86,8 +88,12 @@ var stdin_default = defineComponent({
|
|
86
88
|
const renderPrevButton = () => {
|
87
89
|
const {
|
88
90
|
mode,
|
89
|
-
modelValue
|
91
|
+
modelValue,
|
92
|
+
showPrevButton
|
90
93
|
} = props;
|
94
|
+
if (!showPrevButton) {
|
95
|
+
return;
|
96
|
+
}
|
91
97
|
const slot = slots["prev-text"];
|
92
98
|
const disabled = modelValue === 1;
|
93
99
|
return _createVNode("li", {
|
@@ -105,8 +111,12 @@ var stdin_default = defineComponent({
|
|
105
111
|
const renderNextButton = () => {
|
106
112
|
const {
|
107
113
|
mode,
|
108
|
-
modelValue
|
114
|
+
modelValue,
|
115
|
+
showNextButton
|
109
116
|
} = props;
|
117
|
+
if (!showNextButton) {
|
118
|
+
return;
|
119
|
+
}
|
110
120
|
const slot = slots["next-text"];
|
111
121
|
const disabled = modelValue === count.value;
|
112
122
|
return _createVNode("li", {
|
package/es/pagination/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
:root{--van-pagination-height: 40px;--van-pagination-font-size: var(--van-font-size-md);--van-pagination-item-width: 36px;--van-pagination-item-default-color: var(--van-primary-color);--van-pagination-item-disabled-color: var(--van-gray-7);--van-pagination-item-disabled-background: var(--van-background);--van-pagination-background: var(--van-background-2);--van-pagination-desc-color: var(--van-gray-7);--van-pagination-disabled-opacity: var(--van-disabled-opacity)}.van-pagination{font-size:var(--van-pagination-font-size)}.van-pagination__items{display:flex}.van-pagination__item,.van-pagination__page-desc{display:flex;align-items:center;justify-content:center}.van-pagination__item{flex:1;box-sizing:border-box;min-width:var(--van-pagination-item-width);height:var(--van-pagination-height);color:var(--van-pagination-item-default-color);background:var(--van-pagination-background);cursor:pointer;-webkit-user-select:none;user-select:none}.van-pagination__item button{flex:1;height:100%;border:none;padding:0;background:transparent}.van-pagination__item button[disabled]{cursor:not-allowed}.van-pagination__item:active{color:var(--van-white);background-color:var(--van-pagination-item-default-color)}.van-pagination__item:not(:last-child):after{border-right-width:0}.van-pagination__item--active{color:var(--van-white);background-color:var(--van-pagination-item-default-color)}.van-pagination__item--page{flex-grow:0}.van-pagination__item--prev,.van-pagination__item--next{padding:0 var(--van-padding-base);cursor:pointer}.van-pagination__item--border:after{border-width:var(--van-border-width)}.van-pagination__item--disabled{color:var(--van-pagination-item-disabled-color);background-color:var(--van-pagination-item-disabled-background);opacity:var(--van-pagination-disabled-opacity)}.van-pagination__page-desc{flex:1;height:var(--van-pagination-height);color:var(--van-pagination-desc-color)}
|
1
|
+
:root{--van-pagination-height: 40px;--van-pagination-font-size: var(--van-font-size-md);--van-pagination-item-width: 36px;--van-pagination-item-default-color: var(--van-primary-color);--van-pagination-item-disabled-color: var(--van-gray-7);--van-pagination-item-disabled-background: var(--van-background);--van-pagination-background: var(--van-background-2);--van-pagination-desc-color: var(--van-gray-7);--van-pagination-disabled-opacity: var(--van-disabled-opacity)}.van-pagination{font-size:var(--van-pagination-font-size)}.van-pagination__items{display:flex}.van-pagination__item,.van-pagination__page-desc{display:flex;align-items:center;justify-content:center}.van-pagination__item{flex:1;box-sizing:border-box;min-width:var(--van-pagination-item-width);height:var(--van-pagination-height);color:var(--van-pagination-item-default-color);background:var(--van-pagination-background);cursor:pointer;-webkit-user-select:none;user-select:none}.van-pagination__item button{flex:1;height:100%;border:none;padding:0;background:transparent}.van-pagination__item button[disabled]{cursor:not-allowed}.van-pagination__item:active{color:var(--van-white);background-color:var(--van-pagination-item-default-color)}.van-pagination__item:not(:last-child):after{border-right-width:0}.van-pagination__item--active{color:var(--van-white);background-color:var(--van-pagination-item-default-color)}.van-pagination__item--page{flex-grow:0}.van-pagination__item--prev,.van-pagination__item--next{padding:0 var(--van-padding-base);cursor:pointer}.van-pagination__item--border:after{border-width:var(--van-border-width)}.van-pagination__item--disabled,.van-pagination__item--disabled:active{color:var(--van-pagination-item-disabled-color);background-color:var(--van-pagination-item-disabled-background);opacity:var(--van-pagination-disabled-opacity)}.van-pagination__page-desc{flex:1;height:var(--van-pagination-height);color:var(--van-pagination-desc-color)}
|
package/es/pagination/index.d.ts
CHANGED
@@ -26,6 +26,14 @@ export declare const Pagination: import("../utils").WithInstall<import("vue").De
|
|
26
26
|
default: number;
|
27
27
|
};
|
28
28
|
forceEllipses: BooleanConstructor;
|
29
|
+
showPrevButton: {
|
30
|
+
type: BooleanConstructor;
|
31
|
+
default: true;
|
32
|
+
};
|
33
|
+
showNextButton: {
|
34
|
+
type: BooleanConstructor;
|
35
|
+
default: true;
|
36
|
+
};
|
29
37
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
30
38
|
mode: {
|
31
39
|
type: import("vue").PropType<import("./Pagination").PaginationMode>;
|
@@ -54,6 +62,14 @@ export declare const Pagination: import("../utils").WithInstall<import("vue").De
|
|
54
62
|
default: number;
|
55
63
|
};
|
56
64
|
forceEllipses: BooleanConstructor;
|
65
|
+
showPrevButton: {
|
66
|
+
type: BooleanConstructor;
|
67
|
+
default: true;
|
68
|
+
};
|
69
|
+
showNextButton: {
|
70
|
+
type: BooleanConstructor;
|
71
|
+
default: true;
|
72
|
+
};
|
57
73
|
}>> & {
|
58
74
|
onChange?: ((...args: any[]) => any) | undefined;
|
59
75
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
@@ -65,6 +81,8 @@ export declare const Pagination: import("../utils").WithInstall<import("vue").De
|
|
65
81
|
showPageSize: string | number;
|
66
82
|
itemsPerPage: string | number;
|
67
83
|
forceEllipses: boolean;
|
84
|
+
showPrevButton: boolean;
|
85
|
+
showNextButton: boolean;
|
68
86
|
}>>;
|
69
87
|
export default Pagination;
|
70
88
|
export { paginationProps } from './Pagination';
|
package/es/picker/Picker.d.ts
CHANGED
@@ -104,7 +104,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
104
104
|
default: PickerToolbarPosition;
|
105
105
|
};
|
106
106
|
columnsFieldNames: PropType<PickerFieldNames>;
|
107
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "clickOption" | "confirm")[], "update:modelValue" | "cancel" | "change" | "clickOption" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
107
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "clickOption" | "scrollInto" | "confirm")[], "update:modelValue" | "cancel" | "change" | "clickOption" | "scrollInto" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
108
108
|
loading: BooleanConstructor;
|
109
109
|
readonly: BooleanConstructor;
|
110
110
|
allowHtml: BooleanConstructor;
|
@@ -147,6 +147,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
147
147
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
148
148
|
onCancel?: ((...args: any[]) => any) | undefined;
|
149
149
|
onClickOption?: ((...args: any[]) => any) | undefined;
|
150
|
+
onScrollInto?: ((...args: any[]) => any) | undefined;
|
150
151
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
151
152
|
}, {
|
152
153
|
modelValue: Numeric[];
|
package/es/picker/Picker.mjs
CHANGED
@@ -26,7 +26,7 @@ const pickerProps = extend({}, pickerSharedProps, {
|
|
26
26
|
var stdin_default = defineComponent({
|
27
27
|
name,
|
28
28
|
props: pickerProps,
|
29
|
-
emits: ["confirm", "cancel", "change", "clickOption", "update:modelValue"],
|
29
|
+
emits: ["confirm", "cancel", "change", "scrollInto", "clickOption", "update:modelValue"],
|
30
30
|
setup(props, {
|
31
31
|
emit,
|
32
32
|
slots
|
@@ -88,10 +88,14 @@ var stdin_default = defineComponent({
|
|
88
88
|
}, getEventParams()));
|
89
89
|
});
|
90
90
|
};
|
91
|
-
const onClickOption = (currentOption, columnIndex) =>
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
const onClickOption = (currentOption, columnIndex) => {
|
92
|
+
const params = {
|
93
|
+
columnIndex,
|
94
|
+
currentOption
|
95
|
+
};
|
96
|
+
emit("clickOption", extend(getEventParams(), params));
|
97
|
+
emit("scrollInto", params);
|
98
|
+
};
|
95
99
|
const confirm = () => {
|
96
100
|
children.forEach((child) => child.stopMomentum());
|
97
101
|
const params = getEventParams();
|
@@ -111,7 +115,13 @@ var stdin_default = defineComponent({
|
|
111
115
|
"swipeDuration": props.swipeDuration,
|
112
116
|
"visibleOptionNum": props.visibleOptionNum,
|
113
117
|
"onChange": (value) => onChange(value, columnIndex),
|
114
|
-
"onClickOption": (option) => onClickOption(option, columnIndex)
|
118
|
+
"onClickOption": (option) => onClickOption(option, columnIndex),
|
119
|
+
"onScrollInto": (option) => {
|
120
|
+
emit("scrollInto", {
|
121
|
+
currentOption: option,
|
122
|
+
columnIndex
|
123
|
+
});
|
124
|
+
}
|
115
125
|
}, {
|
116
126
|
option: slots.option
|
117
127
|
}));
|
@@ -25,7 +25,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
25
25
|
type: (NumberConstructor | StringConstructor)[];
|
26
26
|
required: true;
|
27
27
|
};
|
28
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "clickOption")[], "change" | "clickOption", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
28
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "clickOption" | "scrollInto")[], "change" | "clickOption" | "scrollInto", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
29
29
|
value: (NumberConstructor | StringConstructor)[];
|
30
30
|
fields: {
|
31
31
|
type: PropType<Required<PickerFieldNames>>;
|
@@ -52,6 +52,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
52
52
|
}>> & {
|
53
53
|
onChange?: ((...args: any[]) => any) | undefined;
|
54
54
|
onClickOption?: ((...args: any[]) => any) | undefined;
|
55
|
+
onScrollInto?: ((...args: any[]) => any) | undefined;
|
55
56
|
}, {
|
56
57
|
readonly: boolean;
|
57
58
|
allowHtml: boolean;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
|
-
import { ref, watchEffect, defineComponent } from "vue";
|
2
|
+
import { ref, computed, watchEffect, defineComponent } from "vue";
|
3
3
|
import { clamp, numericProp, makeArrayProp, preventDefault, createNamespace, makeRequiredProp } from "../utils/index.mjs";
|
4
4
|
import { getElementTranslateY, findIndexOfEnabledOption } from "./utils.mjs";
|
5
5
|
import { useEventListener, useParent } from "@vant/use";
|
@@ -22,7 +22,7 @@ var stdin_default = defineComponent({
|
|
22
22
|
swipeDuration: makeRequiredProp(numericProp),
|
23
23
|
visibleOptionNum: makeRequiredProp(numericProp)
|
24
24
|
},
|
25
|
-
emits: ["change", "clickOption"],
|
25
|
+
emits: ["change", "clickOption", "scrollInto"],
|
26
26
|
setup(props, {
|
27
27
|
emit,
|
28
28
|
slots
|
@@ -66,6 +66,7 @@ var stdin_default = defineComponent({
|
|
66
66
|
emit("clickOption", props.options[index]);
|
67
67
|
};
|
68
68
|
const getIndexByOffset = (offset) => clamp(Math.round(-offset / props.optionHeight), 0, count() - 1);
|
69
|
+
const currentIndex = computed(() => getIndexByOffset(currentOffset.value));
|
69
70
|
const momentum = (distance, duration) => {
|
70
71
|
const speed = Math.abs(distance / duration);
|
71
72
|
distance = currentOffset.value + speed / 3e-3 * (distance < 0 ? -1 : 1);
|
@@ -105,11 +106,16 @@ var stdin_default = defineComponent({
|
|
105
106
|
moving = true;
|
106
107
|
preventDefault(event, true);
|
107
108
|
}
|
108
|
-
|
109
|
+
const newOffset = clamp(startOffset + touch.deltaY.value, -(count() * props.optionHeight), props.optionHeight);
|
110
|
+
const newIndex = getIndexByOffset(newOffset);
|
111
|
+
if (newIndex !== currentIndex.value) {
|
112
|
+
emit("scrollInto", props.options[newIndex]);
|
113
|
+
}
|
114
|
+
currentOffset.value = newOffset;
|
109
115
|
const now = Date.now();
|
110
116
|
if (now - touchStartTime > MOMENTUM_TIME) {
|
111
117
|
touchStartTime = now;
|
112
|
-
momentumOffset =
|
118
|
+
momentumOffset = newOffset;
|
113
119
|
}
|
114
120
|
};
|
115
121
|
const onTouchEnd = () => {
|
package/es/picker/index.d.ts
CHANGED
@@ -37,7 +37,7 @@ export declare const Picker: import("../utils").WithInstall<import("vue").Define
|
|
37
37
|
default: import("./types").PickerToolbarPosition;
|
38
38
|
};
|
39
39
|
columnsFieldNames: import("vue").PropType<import("./types").PickerFieldNames>;
|
40
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "clickOption" | "confirm")[], "update:modelValue" | "cancel" | "change" | "clickOption" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
40
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "clickOption" | "scrollInto" | "confirm")[], "update:modelValue" | "cancel" | "change" | "clickOption" | "scrollInto" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
41
41
|
loading: BooleanConstructor;
|
42
42
|
readonly: BooleanConstructor;
|
43
43
|
allowHtml: BooleanConstructor;
|
@@ -80,6 +80,7 @@ export declare const Picker: import("../utils").WithInstall<import("vue").Define
|
|
80
80
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
81
81
|
onCancel?: ((...args: any[]) => any) | undefined;
|
82
82
|
onClickOption?: ((...args: any[]) => any) | undefined;
|
83
|
+
onScrollInto?: ((...args: any[]) => any) | undefined;
|
83
84
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
84
85
|
}, {
|
85
86
|
modelValue: import("../utils").Numeric[];
|
package/es/sticky/Sticky.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
|
-
import { ref, watch, computed, reactive, defineComponent } from "vue";
|
3
|
-
import { extend, isHidden, unitToPx, numericProp, getScrollTop, getZIndexStyle, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
2
|
+
import { ref, watch, computed, nextTick, reactive, defineComponent } from "vue";
|
3
|
+
import { extend, isHidden, unitToPx, numericProp, windowWidth, windowHeight, getScrollTop, getZIndexStyle, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { useRect, useEventListener, useScrollParent } from "@vant/use";
|
5
5
|
import { useVisibilityChange } from "../composables/use-visibility-change.mjs";
|
6
6
|
const [name, bem] = createNamespace("sticky");
|
@@ -29,8 +29,12 @@ var stdin_default = defineComponent({
|
|
29
29
|
// root height
|
30
30
|
transform: 0
|
31
31
|
});
|
32
|
+
const isReset = ref(false);
|
32
33
|
const offset = computed(() => unitToPx(props.position === "top" ? props.offsetTop : props.offsetBottom));
|
33
34
|
const rootStyle = computed(() => {
|
35
|
+
if (isReset.value) {
|
36
|
+
return;
|
37
|
+
}
|
34
38
|
const {
|
35
39
|
fixed,
|
36
40
|
height,
|
@@ -44,7 +48,7 @@ var stdin_default = defineComponent({
|
|
44
48
|
}
|
45
49
|
});
|
46
50
|
const stickyStyle = computed(() => {
|
47
|
-
if (!state.fixed) {
|
51
|
+
if (!state.fixed || isReset.value) {
|
48
52
|
return;
|
49
53
|
}
|
50
54
|
const style = extend(getZIndexStyle(props.zIndex), {
|
@@ -103,6 +107,18 @@ var stdin_default = defineComponent({
|
|
103
107
|
passive: true
|
104
108
|
});
|
105
109
|
useVisibilityChange(root, onScroll);
|
110
|
+
watch([windowWidth, windowHeight], () => {
|
111
|
+
if (!root.value || isHidden(root) || !state.fixed) {
|
112
|
+
return;
|
113
|
+
}
|
114
|
+
isReset.value = true;
|
115
|
+
nextTick(() => {
|
116
|
+
const rootRect = useRect(root);
|
117
|
+
state.width = rootRect.width;
|
118
|
+
state.height = rootRect.height;
|
119
|
+
isReset.value = false;
|
120
|
+
});
|
121
|
+
});
|
106
122
|
return () => {
|
107
123
|
var _a;
|
108
124
|
return _createVNode("div", {
|
@@ -110,7 +126,7 @@ var stdin_default = defineComponent({
|
|
110
126
|
"style": rootStyle.value
|
111
127
|
}, [_createVNode("div", {
|
112
128
|
"class": bem({
|
113
|
-
fixed: state.fixed
|
129
|
+
fixed: state.fixed && !isReset.value
|
114
130
|
}),
|
115
131
|
"style": stickyStyle.value
|
116
132
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
|
package/es/tab/Tab.mjs
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
import { withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode } from "vue";
|
2
|
-
import { ref, watch, provide, computed, nextTick, defineComponent } from "vue";
|
3
|
-
import { extend, truthProp, unknownProp, numericProp, createNamespace } from "../utils/index.mjs";
|
1
|
+
import { withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
2
|
+
import { ref, watch, provide, computed, nextTick, defineComponent, getCurrentInstance } from "vue";
|
3
|
+
import { pick, extend, truthProp, unknownProp, numericProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { TABS_KEY } from "../tabs/Tabs.mjs";
|
5
5
|
import { doubleRaf, useParent } from "@vant/use";
|
6
6
|
import { useId } from "../composables/use-id.mjs";
|
7
7
|
import { useExpose } from "../composables/use-expose.mjs";
|
8
8
|
import { routeProps } from "../composables/use-route.mjs";
|
9
9
|
import { TAB_STATUS_KEY } from "../composables/use-tab-status.mjs";
|
10
|
+
import { TabTitle } from "./TabTitle.mjs";
|
10
11
|
import { SwipeItem } from "../swipe-item/index.mjs";
|
11
12
|
const [name, bem] = createNamespace("tab");
|
12
13
|
const tabProps = extend({}, routeProps, {
|
@@ -27,6 +28,7 @@ var stdin_default = defineComponent({
|
|
27
28
|
}) {
|
28
29
|
const id = useId();
|
29
30
|
const inited = ref(false);
|
31
|
+
const instance = getCurrentInstance();
|
30
32
|
const {
|
31
33
|
parent,
|
32
34
|
index
|
@@ -56,6 +58,21 @@ var stdin_default = defineComponent({
|
|
56
58
|
}
|
57
59
|
return isActive;
|
58
60
|
});
|
61
|
+
const renderTitle = (onClickTab) => _createVNode(TabTitle, _mergeProps({
|
62
|
+
"key": id,
|
63
|
+
"id": `${parent.id}-${index.value}`,
|
64
|
+
"ref": parent.setTitleRefs(index.value),
|
65
|
+
"style": props.titleStyle,
|
66
|
+
"class": props.titleClass,
|
67
|
+
"isActive": active.value,
|
68
|
+
"controls": id,
|
69
|
+
"scrollable": parent.scrollable.value,
|
70
|
+
"activeColor": parent.props.titleActiveColor,
|
71
|
+
"inactiveColor": parent.props.titleInactiveColor,
|
72
|
+
"onClick": (event) => onClickTab(instance.proxy, index.value, event)
|
73
|
+
}, pick(parent.props, ["type", "color", "shrink"]), pick(props, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
|
74
|
+
title: slots.title
|
75
|
+
});
|
59
76
|
const hasInactiveClass = ref(!active.value);
|
60
77
|
watch(active, (val) => {
|
61
78
|
if (val) {
|
@@ -71,6 +88,10 @@ var stdin_default = defineComponent({
|
|
71
88
|
parent.scrollIntoView();
|
72
89
|
});
|
73
90
|
provide(TAB_STATUS_KEY, active);
|
91
|
+
useExpose({
|
92
|
+
id,
|
93
|
+
renderTitle
|
94
|
+
});
|
74
95
|
return () => {
|
75
96
|
var _a;
|
76
97
|
const label = `${parent.id}-${index.value}`;
|
@@ -105,9 +126,6 @@ var stdin_default = defineComponent({
|
|
105
126
|
}
|
106
127
|
const shouldRender = inited.value || scrollspy || !lazyRender;
|
107
128
|
const Content = shouldRender ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null;
|
108
|
-
useExpose({
|
109
|
-
id
|
110
|
-
});
|
111
129
|
return _withDirectives(_createVNode("div", {
|
112
130
|
"id": id,
|
113
131
|
"role": "tabpanel",
|
@@ -1,4 +1,4 @@
|
|
1
|
-
declare const
|
1
|
+
export declare const TabTitle: import("vue").DefineComponent<{
|
2
2
|
id: StringConstructor;
|
3
3
|
dot: BooleanConstructor;
|
4
4
|
type: StringConstructor;
|
@@ -42,4 +42,3 @@ declare const _default: import("vue").DefineComponent<{
|
|
42
42
|
scrollable: boolean;
|
43
43
|
showZeroBadge: boolean;
|
44
44
|
}>;
|
45
|
-
export default _default;
|
@@ -3,7 +3,7 @@ import { computed, defineComponent } from "vue";
|
|
3
3
|
import { isDef, truthProp, numericProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { Badge } from "../badge/index.mjs";
|
5
5
|
const [name, bem] = createNamespace("tab");
|
6
|
-
|
6
|
+
const TabTitle = defineComponent({
|
7
7
|
name,
|
8
8
|
props: {
|
9
9
|
id: String,
|
@@ -86,5 +86,5 @@ var stdin_default = defineComponent({
|
|
86
86
|
}
|
87
87
|
});
|
88
88
|
export {
|
89
|
-
|
89
|
+
TabTitle
|
90
90
|
};
|
package/es/tabs/Tabs.d.ts
CHANGED
@@ -145,9 +145,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
145
145
|
duration: string | number;
|
146
146
|
lazyRender: boolean;
|
147
147
|
offsetTop: string | number;
|
148
|
-
shrink: boolean;
|
149
148
|
animated: boolean;
|
150
149
|
swipeable: boolean;
|
150
|
+
shrink: boolean;
|
151
151
|
scrollspy: boolean;
|
152
152
|
swipeThreshold: string | number;
|
153
153
|
}>;
|
package/es/tabs/Tabs.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { createVNode as _createVNode
|
1
|
+
import { createVNode as _createVNode } from "vue";
|
2
2
|
import { ref, watch, computed, reactive, nextTick, onActivated, defineComponent } from "vue";
|
3
|
-
import {
|
3
|
+
import { isDef, addUnit, isHidden, unitToPx, truthProp, numericProp, windowWidth, getElementTop, makeStringProp, callInterceptor, createNamespace, makeNumericProp, setRootScrollTop, BORDER_TOP_BOTTOM } from "../utils/index.mjs";
|
4
4
|
import { scrollLeftTo, scrollTopTo } from "./utils.mjs";
|
5
5
|
import { useRect, useChildren, useScrollParent, useEventListener, onMountedOrActivated } from "@vant/use";
|
6
6
|
import { useId } from "../composables/use-id.mjs";
|
@@ -10,7 +10,6 @@ import { useExpose } from "../composables/use-expose.mjs";
|
|
10
10
|
import { onPopupReopen } from "../composables/on-popup-reopen.mjs";
|
11
11
|
import { useVisibilityChange } from "../composables/use-visibility-change.mjs";
|
12
12
|
import { Sticky } from "../sticky/index.mjs";
|
13
|
-
import TabsTitle from "./TabsTitle.mjs";
|
14
13
|
import TabsContent from "./TabsContent.mjs";
|
15
14
|
const [name, bem] = createNamespace("tabs");
|
16
15
|
const tabsProps = {
|
@@ -226,24 +225,6 @@ var stdin_default = defineComponent({
|
|
226
225
|
setCurrentIndex(index);
|
227
226
|
}
|
228
227
|
};
|
229
|
-
const renderNav = () => children.map((item, index) => _createVNode(TabsTitle, _mergeProps({
|
230
|
-
"key": item.id,
|
231
|
-
"id": `${id}-${index}`,
|
232
|
-
"ref": setTitleRefs(index),
|
233
|
-
"type": props.type,
|
234
|
-
"color": props.color,
|
235
|
-
"style": item.titleStyle,
|
236
|
-
"class": item.titleClass,
|
237
|
-
"shrink": props.shrink,
|
238
|
-
"isActive": index === state.currentIndex,
|
239
|
-
"controls": item.id,
|
240
|
-
"scrollable": scrollable.value,
|
241
|
-
"activeColor": props.titleActiveColor,
|
242
|
-
"inactiveColor": props.titleInactiveColor,
|
243
|
-
"onClick": (event) => onClickTab(item, index, event)
|
244
|
-
}, pick(item, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
|
245
|
-
title: item.$slots.title
|
246
|
-
}));
|
247
228
|
const renderLine = () => {
|
248
229
|
if (props.type === "line" && children.length) {
|
249
230
|
return _createVNode("div", {
|
@@ -273,7 +254,7 @@ var stdin_default = defineComponent({
|
|
273
254
|
}]),
|
274
255
|
"style": navStyle.value,
|
275
256
|
"aria-orientation": "horizontal"
|
276
|
-
}, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots),
|
257
|
+
}, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), children.map((item) => item.renderTitle(onClickTab)), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
|
277
258
|
if (sticky) {
|
278
259
|
return _createVNode("div", {
|
279
260
|
"ref": wrapRef
|
@@ -281,7 +262,16 @@ var stdin_default = defineComponent({
|
|
281
262
|
}
|
282
263
|
return Header;
|
283
264
|
};
|
284
|
-
|
265
|
+
const resize = () => {
|
266
|
+
setLine();
|
267
|
+
nextTick(() => {
|
268
|
+
var _a, _b;
|
269
|
+
scrollIntoView(true);
|
270
|
+
(_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
|
271
|
+
});
|
272
|
+
};
|
273
|
+
watch(() => [props.color, props.duration, props.lineWidth, props.lineHeight], setLine);
|
274
|
+
watch(windowWidth, resize);
|
285
275
|
watch(() => props.active, (value) => {
|
286
276
|
if (value !== currentName.value) {
|
287
277
|
setCurrentIndexByName(value);
|
@@ -307,13 +297,6 @@ var stdin_default = defineComponent({
|
|
307
297
|
});
|
308
298
|
};
|
309
299
|
const onRendered = (name2, title) => emit("rendered", name2, title);
|
310
|
-
const resize = () => {
|
311
|
-
setLine();
|
312
|
-
nextTick(() => {
|
313
|
-
var _a, _b;
|
314
|
-
return (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
|
315
|
-
});
|
316
|
-
};
|
317
300
|
useExpose({
|
318
301
|
resize,
|
319
302
|
scrollTo
|
@@ -330,8 +313,10 @@ var stdin_default = defineComponent({
|
|
330
313
|
id,
|
331
314
|
props,
|
332
315
|
setLine,
|
316
|
+
scrollable,
|
333
317
|
onRendered,
|
334
318
|
currentName,
|
319
|
+
setTitleRefs,
|
335
320
|
scrollIntoView
|
336
321
|
});
|
337
322
|
return () => _createVNode("div", {
|
package/es/tabs/index.d.ts
CHANGED
@@ -98,9 +98,9 @@ export declare const Tabs: import("../utils").WithInstall<import("vue").DefineCo
|
|
98
98
|
duration: string | number;
|
99
99
|
lazyRender: boolean;
|
100
100
|
offsetTop: string | number;
|
101
|
-
shrink: boolean;
|
102
101
|
animated: boolean;
|
103
102
|
swipeable: boolean;
|
103
|
+
shrink: boolean;
|
104
104
|
scrollspy: boolean;
|
105
105
|
swipeThreshold: string | number;
|
106
106
|
}>>;
|
package/es/tabs/style/index.mjs
CHANGED
package/es/tabs/types.d.ts
CHANGED
@@ -12,9 +12,11 @@ export type TabsProvide = {
|
|
12
12
|
id: string;
|
13
13
|
props: TabsProps;
|
14
14
|
setLine: () => void;
|
15
|
+
scrollable: ComputedRef<boolean>;
|
15
16
|
onRendered: (name: Numeric, title?: string) => void;
|
16
|
-
scrollIntoView: (immediate?: boolean) => void;
|
17
17
|
currentName: ComputedRef<Numeric | undefined>;
|
18
|
+
setTitleRefs: (index: number) => (el: unknown) => void;
|
19
|
+
scrollIntoView: (immediate?: boolean) => void;
|
18
20
|
};
|
19
21
|
export type TabsExpose = {
|
20
22
|
resize: () => void;
|
@@ -33,6 +33,7 @@ var stdin_default = defineComponent({
|
|
33
33
|
if (props.image && !slots.content) {
|
34
34
|
return _createVNode("image", {
|
35
35
|
"href": imageBase64.value,
|
36
|
+
"xlink:href": imageBase64.value,
|
36
37
|
"x": "0",
|
37
38
|
"y": "0",
|
38
39
|
"width": props.width,
|
@@ -61,6 +62,7 @@ var stdin_default = defineComponent({
|
|
61
62
|
"width": svgWidth,
|
62
63
|
"height": svgHeight,
|
63
64
|
"xmlns": "http://www.w3.org/2000/svg",
|
65
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
64
66
|
"style": {
|
65
67
|
padding: `0 ${props.gapX}px ${props.gapY}px 0`,
|
66
68
|
opacity: props.opacity
|
@@ -83,7 +85,7 @@ var stdin_default = defineComponent({
|
|
83
85
|
};
|
84
86
|
const makeSvgToBlobUrl = (svgStr) => {
|
85
87
|
const svgBlob = new Blob([svgStr], {
|
86
|
-
type: "image/svg+xml
|
88
|
+
type: "image/svg+xml"
|
87
89
|
});
|
88
90
|
return URL.createObjectURL(svgBlob);
|
89
91
|
};
|