vant 3.3.3 → 3.3.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/badge/Badge.d.ts +12 -0
- package/es/badge/Badge.js +4 -3
- package/es/badge/index.css +1 -1
- package/es/badge/index.d.ts +8 -1
- package/es/badge/index.less +22 -1
- package/es/calendar/Calendar.d.ts +2 -2
- package/es/calendar/index.d.ts +2 -2
- package/es/datetime-picker/DatePicker.js +2 -2
- package/es/datetime-picker/TimePicker.js +2 -2
- package/es/datetime-picker/utils.d.ts +2 -0
- package/es/datetime-picker/utils.js +17 -1
- package/es/field/Field.js +5 -5
- package/es/field/utils.d.ts +2 -0
- package/es/field/utils.js +9 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/pagination/Pagination.js +3 -3
- package/es/popup/Popup.d.ts +2 -2
- package/es/popup/index.d.ts +2 -2
- package/es/toast/Toast.d.ts +2 -2
- package/lib/badge/Badge.d.ts +12 -0
- package/lib/badge/Badge.js +4 -3
- package/lib/badge/index.css +1 -1
- package/lib/badge/index.d.ts +8 -1
- package/lib/badge/index.less +22 -1
- package/lib/calendar/Calendar.d.ts +2 -2
- package/lib/calendar/index.d.ts +2 -2
- package/lib/datetime-picker/DatePicker.js +1 -1
- package/lib/datetime-picker/TimePicker.js +1 -1
- package/lib/datetime-picker/utils.d.ts +2 -0
- package/lib/datetime-picker/utils.js +22 -3
- package/lib/field/Field.js +4 -4
- package/lib/field/utils.d.ts +2 -0
- package/lib/field/utils.js +13 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/pagination/Pagination.js +3 -3
- package/lib/popup/Popup.d.ts +2 -2
- package/lib/popup/index.d.ts +2 -2
- package/lib/ssr.js +7 -0
- package/lib/ssr.mjs +1 -0
- package/lib/toast/Toast.d.ts +2 -2
- package/lib/vant.cjs.js +34 -13
- package/lib/vant.cjs.min.js +1 -1
- package/lib/vant.es.js +34 -13
- package/lib/vant.es.min.js +34 -13
- package/lib/vant.js +202 -55
- package/lib/vant.min.js +1 -1
- package/package.json +17 -13
- package/vetur/attributes.json +89 -85
- package/vetur/tags.json +26 -25
- package/vetur/web-types.json +217 -207
package/lib/calendar/index.d.ts
CHANGED
@@ -114,13 +114,13 @@ export declare const Calendar: import("../utils").WithInstall<import("vue").Defi
|
|
114
114
|
firstDayOfWeek?: unknown;
|
115
115
|
} & {
|
116
116
|
type: import("./types").CalendarType;
|
117
|
+
position: import("..").PopupPosition;
|
117
118
|
round: boolean;
|
118
119
|
readonly: boolean;
|
119
120
|
safeAreaInsetBottom: boolean;
|
120
121
|
show: boolean;
|
121
122
|
lazyRender: boolean;
|
122
123
|
closeOnClickOverlay: boolean;
|
123
|
-
position: import("..").PopupPosition;
|
124
124
|
closeOnPopstate: boolean;
|
125
125
|
minDate: Date;
|
126
126
|
maxDate: Date;
|
@@ -153,13 +153,13 @@ export declare const Calendar: import("../utils").WithInstall<import("vue").Defi
|
|
153
153
|
"onOver-range"?: ((...args: any[]) => any) | undefined;
|
154
154
|
}, {
|
155
155
|
type: import("./types").CalendarType;
|
156
|
+
position: import("..").PopupPosition;
|
156
157
|
round: boolean;
|
157
158
|
readonly: boolean;
|
158
159
|
safeAreaInsetBottom: boolean;
|
159
160
|
show: boolean;
|
160
161
|
lazyRender: boolean;
|
161
162
|
closeOnClickOverlay: boolean;
|
162
|
-
position: import("..").PopupPosition;
|
163
163
|
closeOnPopstate: boolean;
|
164
164
|
minDate: Date;
|
165
165
|
maxDate: Date;
|
@@ -290,7 +290,7 @@ var _default = (0, _vue.defineComponent)({
|
|
290
290
|
}
|
291
291
|
});
|
292
292
|
(0, _useExpose.useExpose)({
|
293
|
-
getPicker: () => picker.value
|
293
|
+
getPicker: () => picker.value && (0, _utils2.proxyPickerMethods)(picker.value, updateInnerValue)
|
294
294
|
});
|
295
295
|
return () => (0, _vue.createVNode)(_picker.Picker, (0, _vue.mergeProps)({
|
296
296
|
"ref": picker,
|
@@ -131,7 +131,7 @@ var _default = (0, _vue.defineComponent)({
|
|
131
131
|
}
|
132
132
|
});
|
133
133
|
(0, _useExpose.useExpose)({
|
134
|
-
getPicker: () => picker.value
|
134
|
+
getPicker: () => picker.value && (0, _utils2.proxyPickerMethods)(picker.value, updateInnerValue)
|
135
135
|
});
|
136
136
|
return () => (0, _vue.createVNode)(_picker.Picker, (0, _vue.mergeProps)({
|
137
137
|
"ref": picker,
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { PropType } from 'vue';
|
2
|
+
import type { PickerInstance } from '../picker';
|
2
3
|
import type { DatetimePickerColumnType } from './types';
|
3
4
|
export declare const sharedProps: {
|
4
5
|
title: StringConstructor;
|
@@ -35,3 +36,4 @@ export declare const pickerInheritKeys: ("title" | "readonly" | "loading" | "all
|
|
35
36
|
export declare function times<T>(n: number, iteratee: (index: number) => T): T[];
|
36
37
|
export declare function getTrueValue(value: string | undefined): number;
|
37
38
|
export declare const getMonthEndDay: (year: number, month: number) => number;
|
39
|
+
export declare const proxyPickerMethods: (picker: PickerInstance, callback: () => void) => PickerInstance;
|
@@ -3,7 +3,7 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.getMonthEndDay = void 0;
|
5
5
|
exports.getTrueValue = getTrueValue;
|
6
|
-
exports.sharedProps = exports.pickerInheritKeys = void 0;
|
6
|
+
exports.sharedProps = exports.proxyPickerMethods = exports.pickerInheritKeys = void 0;
|
7
7
|
exports.times = times;
|
8
8
|
|
9
9
|
var _utils = require("../utils");
|
@@ -49,6 +49,25 @@ function getTrueValue(value) {
|
|
49
49
|
return parseInt(value, 10);
|
50
50
|
}
|
51
51
|
|
52
|
-
var getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
|
52
|
+
var getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate(); // https://github.com/youzan/vant/issues/10013
|
53
53
|
|
54
|
-
|
54
|
+
|
55
|
+
exports.getMonthEndDay = getMonthEndDay;
|
56
|
+
|
57
|
+
var proxyPickerMethods = (picker, callback) => {
|
58
|
+
var methods = ['setValues', 'setIndexes', 'setColumnIndex', 'setColumnValue'];
|
59
|
+
return new Proxy(picker, {
|
60
|
+
get: (target, prop) => {
|
61
|
+
if (methods.includes(prop)) {
|
62
|
+
return function () {
|
63
|
+
target[prop](...arguments);
|
64
|
+
callback();
|
65
|
+
};
|
66
|
+
}
|
67
|
+
|
68
|
+
return target[prop];
|
69
|
+
}
|
70
|
+
});
|
71
|
+
};
|
72
|
+
|
73
|
+
exports.proxyPickerMethods = proxyPickerMethods;
|
package/lib/field/Field.js
CHANGED
@@ -218,14 +218,14 @@ var _default = (0, _vue.defineComponent)({
|
|
218
218
|
maxlength
|
219
219
|
} = props;
|
220
220
|
|
221
|
-
if ((0, _utils.isDef)(maxlength) && value
|
221
|
+
if ((0, _utils.isDef)(maxlength) && (0, _utils2.getStringLength)(value) > maxlength) {
|
222
222
|
var modelValue = getModelValue();
|
223
223
|
|
224
|
-
if (modelValue && modelValue
|
224
|
+
if (modelValue && (0, _utils2.getStringLength)(modelValue) === +maxlength) {
|
225
225
|
return modelValue;
|
226
226
|
}
|
227
227
|
|
228
|
-
return
|
228
|
+
return (0, _utils2.cutString)(value, +maxlength);
|
229
229
|
}
|
230
230
|
|
231
231
|
return value;
|
@@ -432,7 +432,7 @@ var _default = (0, _vue.defineComponent)({
|
|
432
432
|
|
433
433
|
var renderWordLimit = () => {
|
434
434
|
if (props.showWordLimit && props.maxlength) {
|
435
|
-
var count = getModelValue()
|
435
|
+
var count = (0, _utils2.getStringLength)(getModelValue());
|
436
436
|
return (0, _vue.createVNode)("div", {
|
437
437
|
"class": bem('word-limit')
|
438
438
|
}, [(0, _vue.createVNode)("span", {
|
package/lib/field/utils.d.ts
CHANGED
@@ -10,3 +10,5 @@ export declare function mapInputType(type: FieldType): {
|
|
10
10
|
type: InputHTMLAttributes['type'];
|
11
11
|
inputmode?: HTMLAttributes['inputmode'];
|
12
12
|
};
|
13
|
+
export declare function getStringLength(str: string): number;
|
14
|
+
export declare function cutString(str: string, maxlength: number): string;
|
package/lib/field/utils.js
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
+
exports.cutString = cutString;
|
4
5
|
exports.endComposing = endComposing;
|
5
6
|
exports.getRuleMessage = getRuleMessage;
|
7
|
+
exports.getStringLength = getStringLength;
|
6
8
|
exports.mapInputType = mapInputType;
|
7
9
|
exports.resizeTextarea = resizeTextarea;
|
8
10
|
exports.runRuleValidator = runRuleValidator;
|
@@ -124,4 +126,15 @@ function mapInputType(type) {
|
|
124
126
|
return {
|
125
127
|
type
|
126
128
|
};
|
129
|
+
} // get correct length of emoji
|
130
|
+
// https://github.com/youzan/vant/issues/10032
|
131
|
+
|
132
|
+
|
133
|
+
function getStringLength(str) {
|
134
|
+
return [...str].length;
|
135
|
+
} // cut string with emoji
|
136
|
+
|
137
|
+
|
138
|
+
function cutString(str, maxlength) {
|
139
|
+
return [...str].slice(0, maxlength).join('');
|
127
140
|
}
|