vant 3.3.6 → 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.
Files changed (51) hide show
  1. package/es/badge/Badge.d.ts +12 -0
  2. package/es/badge/Badge.js +4 -3
  3. package/es/badge/index.css +1 -1
  4. package/es/badge/index.d.ts +8 -1
  5. package/es/badge/index.less +22 -1
  6. package/es/calendar/Calendar.d.ts +2 -2
  7. package/es/calendar/index.d.ts +2 -2
  8. package/es/datetime-picker/DatePicker.js +2 -2
  9. package/es/datetime-picker/TimePicker.js +2 -2
  10. package/es/datetime-picker/utils.d.ts +2 -0
  11. package/es/datetime-picker/utils.js +17 -1
  12. package/es/field/Field.js +5 -5
  13. package/es/field/utils.d.ts +2 -0
  14. package/es/field/utils.js +9 -0
  15. package/es/index.d.ts +1 -1
  16. package/es/index.js +1 -1
  17. package/es/pagination/Pagination.js +3 -3
  18. package/es/popup/Popup.d.ts +2 -2
  19. package/es/popup/index.d.ts +2 -2
  20. package/es/toast/Toast.d.ts +2 -2
  21. package/lib/badge/Badge.d.ts +12 -0
  22. package/lib/badge/Badge.js +4 -3
  23. package/lib/badge/index.css +1 -1
  24. package/lib/badge/index.d.ts +8 -1
  25. package/lib/badge/index.less +22 -1
  26. package/lib/calendar/Calendar.d.ts +2 -2
  27. package/lib/calendar/index.d.ts +2 -2
  28. package/lib/datetime-picker/DatePicker.js +1 -1
  29. package/lib/datetime-picker/TimePicker.js +1 -1
  30. package/lib/datetime-picker/utils.d.ts +2 -0
  31. package/lib/datetime-picker/utils.js +22 -3
  32. package/lib/field/Field.js +4 -4
  33. package/lib/field/utils.d.ts +2 -0
  34. package/lib/field/utils.js +13 -0
  35. package/lib/index.css +1 -1
  36. package/lib/index.d.ts +1 -1
  37. package/lib/index.js +1 -1
  38. package/lib/pagination/Pagination.js +3 -3
  39. package/lib/popup/Popup.d.ts +2 -2
  40. package/lib/popup/index.d.ts +2 -2
  41. package/lib/toast/Toast.d.ts +2 -2
  42. package/lib/vant.cjs.js +34 -13
  43. package/lib/vant.cjs.min.js +1 -1
  44. package/lib/vant.es.js +34 -13
  45. package/lib/vant.es.min.js +34 -13
  46. package/lib/vant.js +202 -55
  47. package/lib/vant.min.js +1 -1
  48. package/package.json +14 -12
  49. package/vetur/attributes.json +89 -85
  50. package/vetur/tags.json +26 -25
  51. package/vetur/web-types.json +217 -207
@@ -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
- exports.getMonthEndDay = getMonthEndDay;
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;
@@ -218,14 +218,14 @@ var _default = (0, _vue.defineComponent)({
218
218
  maxlength
219
219
  } = props;
220
220
 
221
- if ((0, _utils.isDef)(maxlength) && value.length > maxlength) {
221
+ if ((0, _utils.isDef)(maxlength) && (0, _utils2.getStringLength)(value) > maxlength) {
222
222
  var modelValue = getModelValue();
223
223
 
224
- if (modelValue && modelValue.length === +maxlength) {
224
+ if (modelValue && (0, _utils2.getStringLength)(modelValue) === +maxlength) {
225
225
  return modelValue;
226
226
  }
227
227
 
228
- return value.slice(0, +maxlength);
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().length;
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", {
@@ -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;
@@ -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
  }