vant 4.4.1 → 4.6.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.
Files changed (161) hide show
  1. package/es/address-list/AddressList.d.ts +13 -0
  2. package/es/address-list/AddressList.mjs +4 -2
  3. package/es/address-list/AddressListItem.d.ts +9 -0
  4. package/es/address-list/AddressListItem.mjs +4 -3
  5. package/es/address-list/index.d.ts +9 -0
  6. package/es/back-top/BackTop.mjs +14 -1
  7. package/es/barrage/index.d.ts +1 -1
  8. package/es/barrage/types.d.ts +6 -0
  9. package/es/composables/use-touch.d.ts +1 -0
  10. package/es/composables/use-touch.mjs +8 -1
  11. package/es/config-provider/types.d.ts +1 -1
  12. package/es/date-picker/DatePicker.d.ts +3 -3
  13. package/es/date-picker/index.d.ts +2 -2
  14. package/es/date-picker/utils.d.ts +4 -2
  15. package/es/date-picker/utils.mjs +8 -3
  16. package/es/dropdown-menu/DropdownMenu.mjs +10 -3
  17. package/es/dropdown-menu/index.d.ts +1 -1
  18. package/es/dropdown-menu/types.d.ts +5 -1
  19. package/es/field/Field.mjs +1 -1
  20. package/es/floating-bubble/FloatingBubble.d.ts +86 -0
  21. package/es/floating-bubble/FloatingBubble.mjs +177 -0
  22. package/es/floating-bubble/index.css +1 -0
  23. package/es/floating-bubble/index.d.ts +63 -0
  24. package/es/floating-bubble/index.mjs +10 -0
  25. package/es/floating-bubble/style/index.d.ts +1 -0
  26. package/es/floating-bubble/style/index.mjs +4 -0
  27. package/es/floating-bubble/types.d.ts +8 -0
  28. package/es/floating-bubble/types.mjs +0 -0
  29. package/es/floating-panel/FloatingPanel.d.ts +77 -0
  30. package/es/floating-panel/FloatingPanel.mjs +127 -0
  31. package/es/floating-panel/index.css +1 -0
  32. package/es/floating-panel/index.d.ts +61 -0
  33. package/es/floating-panel/index.mjs +10 -0
  34. package/es/floating-panel/style/index.d.ts +1 -0
  35. package/es/floating-panel/style/index.mjs +2 -0
  36. package/es/floating-panel/types.d.ts +9 -0
  37. package/es/floating-panel/types.mjs +0 -0
  38. package/es/image-preview/ImagePreviewItem.mjs +1 -2
  39. package/es/index.d.ts +4 -1
  40. package/es/index.mjs +10 -1
  41. package/es/picker/PickerColumn.mjs +7 -2
  42. package/es/rate/Rate.d.ts +4 -0
  43. package/es/rate/Rate.mjs +16 -10
  44. package/es/rate/index.css +1 -1
  45. package/es/rate/index.d.ts +3 -0
  46. package/es/rolling-text/RollingText.d.ts +104 -0
  47. package/es/rolling-text/RollingText.mjs +98 -0
  48. package/es/rolling-text/RollingTextItem.d.ts +67 -0
  49. package/es/rolling-text/RollingTextItem.mjs +47 -0
  50. package/es/rolling-text/index.css +1 -0
  51. package/es/rolling-text/index.d.ts +79 -0
  52. package/es/rolling-text/index.mjs +10 -0
  53. package/es/rolling-text/style/index.d.ts +1 -0
  54. package/es/rolling-text/style/index.mjs +2 -0
  55. package/es/rolling-text/types.d.ts +17 -0
  56. package/es/rolling-text/types.mjs +0 -0
  57. package/es/signature/index.d.ts +1 -0
  58. package/es/signature/types.d.ts +6 -0
  59. package/es/signature/types.mjs +0 -0
  60. package/es/slider/Slider.d.ts +1 -1
  61. package/es/slider/Slider.mjs +10 -2
  62. package/es/slider/index.d.ts +1 -1
  63. package/es/stepper/Stepper.d.ts +1 -1
  64. package/es/stepper/index.d.ts +1 -1
  65. package/es/time-picker/TimePicker.d.ts +31 -4
  66. package/es/time-picker/TimePicker.mjs +73 -21
  67. package/es/time-picker/index.d.ts +20 -2
  68. package/es/utils/basic.d.ts +3 -0
  69. package/es/utils/closest.d.ts +1 -0
  70. package/es/utils/closest.mjs +8 -0
  71. package/es/utils/constant.d.ts +1 -0
  72. package/es/utils/constant.mjs +3 -1
  73. package/es/utils/index.d.ts +1 -0
  74. package/es/utils/index.mjs +1 -0
  75. package/es/watermark/index.d.ts +1 -0
  76. package/es/watermark/types.d.ts +3 -0
  77. package/es/watermark/types.mjs +0 -0
  78. package/lib/address-list/AddressList.d.ts +13 -0
  79. package/lib/address-list/AddressList.js +3 -1
  80. package/lib/address-list/AddressListItem.d.ts +9 -0
  81. package/lib/address-list/AddressListItem.js +3 -2
  82. package/lib/address-list/index.d.ts +9 -0
  83. package/lib/back-top/BackTop.js +13 -0
  84. package/lib/barrage/index.d.ts +1 -1
  85. package/lib/barrage/types.d.ts +6 -0
  86. package/lib/composables/use-touch.d.ts +1 -0
  87. package/lib/composables/use-touch.js +8 -1
  88. package/lib/config-provider/types.d.ts +1 -1
  89. package/lib/date-picker/DatePicker.d.ts +3 -3
  90. package/lib/date-picker/index.d.ts +2 -2
  91. package/lib/date-picker/utils.d.ts +4 -2
  92. package/lib/date-picker/utils.js +2 -2
  93. package/lib/dropdown-menu/DropdownMenu.js +10 -3
  94. package/lib/dropdown-menu/index.d.ts +1 -1
  95. package/lib/dropdown-menu/types.d.ts +5 -1
  96. package/lib/field/Field.js +1 -1
  97. package/lib/floating-bubble/FloatingBubble.d.ts +86 -0
  98. package/lib/floating-bubble/FloatingBubble.js +206 -0
  99. package/lib/floating-bubble/index.css +1 -0
  100. package/lib/floating-bubble/index.d.ts +63 -0
  101. package/lib/floating-bubble/index.js +39 -0
  102. package/lib/floating-bubble/style/index.d.ts +1 -0
  103. package/lib/floating-bubble/style/index.js +4 -0
  104. package/lib/floating-bubble/types.d.ts +8 -0
  105. package/lib/floating-bubble/types.js +15 -0
  106. package/lib/floating-panel/FloatingPanel.d.ts +77 -0
  107. package/lib/floating-panel/FloatingPanel.js +146 -0
  108. package/lib/floating-panel/index.css +1 -0
  109. package/lib/floating-panel/index.d.ts +61 -0
  110. package/lib/floating-panel/index.js +39 -0
  111. package/lib/floating-panel/style/index.d.ts +1 -0
  112. package/lib/floating-panel/style/index.js +2 -0
  113. package/lib/floating-panel/types.d.ts +9 -0
  114. package/lib/floating-panel/types.js +15 -0
  115. package/lib/image-preview/ImagePreviewItem.js +1 -2
  116. package/lib/index.css +1 -1
  117. package/lib/index.d.ts +4 -1
  118. package/lib/index.js +10 -1
  119. package/lib/picker/PickerColumn.js +7 -2
  120. package/lib/rate/Rate.d.ts +4 -0
  121. package/lib/rate/Rate.js +16 -10
  122. package/lib/rate/index.css +1 -1
  123. package/lib/rate/index.d.ts +3 -0
  124. package/lib/rolling-text/RollingText.d.ts +104 -0
  125. package/lib/rolling-text/RollingText.js +127 -0
  126. package/lib/rolling-text/RollingTextItem.d.ts +67 -0
  127. package/lib/rolling-text/RollingTextItem.js +66 -0
  128. package/lib/rolling-text/index.css +1 -0
  129. package/lib/rolling-text/index.d.ts +79 -0
  130. package/lib/rolling-text/index.js +39 -0
  131. package/lib/rolling-text/style/index.d.ts +1 -0
  132. package/lib/rolling-text/style/index.js +2 -0
  133. package/lib/rolling-text/types.d.ts +17 -0
  134. package/lib/rolling-text/types.js +15 -0
  135. package/lib/signature/index.d.ts +1 -0
  136. package/lib/signature/types.d.ts +6 -0
  137. package/lib/signature/types.js +15 -0
  138. package/lib/slider/Slider.d.ts +1 -1
  139. package/lib/slider/Slider.js +10 -2
  140. package/lib/slider/index.d.ts +1 -1
  141. package/lib/stepper/Stepper.d.ts +1 -1
  142. package/lib/stepper/index.d.ts +1 -1
  143. package/lib/time-picker/TimePicker.d.ts +31 -4
  144. package/lib/time-picker/TimePicker.js +84 -32
  145. package/lib/time-picker/index.d.ts +20 -2
  146. package/lib/utils/basic.d.ts +3 -0
  147. package/lib/utils/closest.d.ts +1 -0
  148. package/lib/utils/closest.js +27 -0
  149. package/lib/utils/constant.d.ts +1 -0
  150. package/lib/utils/constant.js +3 -1
  151. package/lib/utils/index.d.ts +1 -0
  152. package/lib/utils/index.js +1 -0
  153. package/lib/vant.cjs.js +2547 -2019
  154. package/lib/vant.es.js +2547 -2019
  155. package/lib/vant.js +2544 -2016
  156. package/lib/vant.min.js +1 -1
  157. package/lib/watermark/index.d.ts +1 -0
  158. package/lib/watermark/types.d.ts +3 -0
  159. package/lib/watermark/types.js +15 -0
  160. package/lib/web-types.json +1 -1
  161. package/package.json +1 -1
@@ -118,9 +118,9 @@ export declare const Stepper: import("../utils").WithInstall<import("vue").Defin
118
118
  name: string | number;
119
119
  max: string | number;
120
120
  disabled: boolean;
121
+ min: string | number;
121
122
  longPress: boolean;
122
123
  step: string | number;
123
- min: string | number;
124
124
  integer: boolean;
125
125
  showPlus: boolean;
126
126
  showMinus: boolean;
@@ -1,4 +1,4 @@
1
- import { type PropType, type ExtractPropTypes } from 'vue';
1
+ import { type ExtractPropTypes, type PropType } from 'vue';
2
2
  export type TimePickerColumnType = 'hour' | 'minute' | 'second';
3
3
  export declare const timePickerProps: {
4
4
  loading: BooleanConstructor;
@@ -29,7 +29,7 @@ export declare const timePickerProps: {
29
29
  type: PropType<string[]>;
30
30
  default: () => never[];
31
31
  };
32
- filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
32
+ filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
33
33
  formatter: {
34
34
  type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
35
35
  default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
@@ -59,10 +59,19 @@ export declare const timePickerProps: {
59
59
  type: (NumberConstructor | StringConstructor)[];
60
60
  default: number;
61
61
  };
62
+ minTime: {
63
+ type: StringConstructor;
64
+ validator: (val: string) => boolean;
65
+ };
66
+ maxTime: {
67
+ type: StringConstructor;
68
+ validator: (val: string) => boolean;
69
+ };
62
70
  columnsType: {
63
71
  type: PropType<TimePickerColumnType[]>;
64
72
  default: () => string[];
65
73
  };
74
+ filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
66
75
  };
67
76
  export type TimePickerProps = ExtractPropTypes<typeof timePickerProps>;
68
77
  declare const _default: import("vue").DefineComponent<{
@@ -94,7 +103,7 @@ declare const _default: import("vue").DefineComponent<{
94
103
  type: PropType<string[]>;
95
104
  default: () => never[];
96
105
  };
97
- filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
106
+ filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
98
107
  formatter: {
99
108
  type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
100
109
  default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
@@ -124,10 +133,19 @@ declare const _default: import("vue").DefineComponent<{
124
133
  type: (NumberConstructor | StringConstructor)[];
125
134
  default: number;
126
135
  };
136
+ minTime: {
137
+ type: StringConstructor;
138
+ validator: (val: string) => boolean;
139
+ };
140
+ maxTime: {
141
+ type: StringConstructor;
142
+ validator: (val: string) => boolean;
143
+ };
127
144
  columnsType: {
128
145
  type: PropType<TimePickerColumnType[]>;
129
146
  default: () => string[];
130
147
  };
148
+ filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
131
149
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm")[], "update:modelValue" | "cancel" | "change" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
132
150
  loading: BooleanConstructor;
133
151
  readonly: BooleanConstructor;
@@ -157,7 +175,7 @@ declare const _default: import("vue").DefineComponent<{
157
175
  type: PropType<string[]>;
158
176
  default: () => never[];
159
177
  };
160
- filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
178
+ filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
161
179
  formatter: {
162
180
  type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
163
181
  default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
@@ -187,10 +205,19 @@ declare const _default: import("vue").DefineComponent<{
187
205
  type: (NumberConstructor | StringConstructor)[];
188
206
  default: number;
189
207
  };
208
+ minTime: {
209
+ type: StringConstructor;
210
+ validator: (val: string) => boolean;
211
+ };
212
+ maxTime: {
213
+ type: StringConstructor;
214
+ validator: (val: string) => boolean;
215
+ };
190
216
  columnsType: {
191
217
  type: PropType<TimePickerColumnType[]>;
192
218
  default: () => string[];
193
219
  };
220
+ filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
194
221
  }>> & {
195
222
  onChange?: ((...args: any[]) => any) | undefined;
196
223
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -1,9 +1,11 @@
1
1
  import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
- import { ref, watch, computed, defineComponent } from "vue";
3
- import { pick, extend, createNamespace, makeNumericProp, isSameValue } from "../utils/index.mjs";
4
- import { genOptions, sharedProps, pickerInheritKeys, formatValueRange } from "../date-picker/utils.mjs";
2
+ import { computed, defineComponent, ref, watch } from "vue";
3
+ import { formatValueRange, genOptions, pickerInheritKeys, sharedProps } from "../date-picker/utils.mjs";
4
+ import { createNamespace, extend, isSameValue, makeNumericProp, pick } from "../utils/index.mjs";
5
5
  import { Picker } from "../picker/index.mjs";
6
6
  const [name] = createNamespace("time-picker");
7
+ const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
8
+ const fullColumns = ["hour", "minute", "second"];
7
9
  const timePickerProps = extend({}, sharedProps, {
8
10
  minHour: makeNumericProp(0),
9
11
  maxHour: makeNumericProp(23),
@@ -11,10 +13,19 @@ const timePickerProps = extend({}, sharedProps, {
11
13
  maxMinute: makeNumericProp(59),
12
14
  minSecond: makeNumericProp(0),
13
15
  maxSecond: makeNumericProp(59),
16
+ minTime: {
17
+ type: String,
18
+ validator: validateTime
19
+ },
20
+ maxTime: {
21
+ type: String,
22
+ validator: validateTime
23
+ },
14
24
  columnsType: {
15
25
  type: Array,
16
26
  default: () => ["hour", "minute"]
17
- }
27
+ },
28
+ filter: Function
18
29
  });
19
30
  var stdin_default = defineComponent({
20
31
  name,
@@ -25,25 +36,66 @@ var stdin_default = defineComponent({
25
36
  slots
26
37
  }) {
27
38
  const currentValues = ref(props.modelValue);
28
- const columns = computed(() => props.columnsType.map((type) => {
29
- const {
30
- filter,
31
- formatter
39
+ const getValidTime = (time) => {
40
+ const timeLimitArr = time.split(":");
41
+ return fullColumns.map((col, i) => props.columnsType.includes(col) ? timeLimitArr[i] : "00");
42
+ };
43
+ const columns = computed(() => {
44
+ let {
45
+ minHour,
46
+ maxHour,
47
+ minMinute,
48
+ maxMinute,
49
+ minSecond,
50
+ maxSecond
32
51
  } = props;
33
- switch (type) {
34
- case "hour":
35
- return genOptions(+props.minHour, +props.maxHour, type, formatter, filter);
36
- case "minute":
37
- return genOptions(+props.minMinute, +props.maxMinute, type, formatter, filter);
38
- case "second":
39
- return genOptions(+props.minSecond, +props.maxSecond, type, formatter, filter);
40
- default:
41
- if (process.env.NODE_ENV !== "production") {
42
- throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
43
- }
44
- return [];
52
+ if (props.minTime || props.maxTime) {
53
+ const fullTime = {
54
+ hour: 0,
55
+ minute: 0,
56
+ second: 0
57
+ };
58
+ props.columnsType.forEach((col, i) => {
59
+ var _a;
60
+ fullTime[col] = (_a = currentValues.value[i]) != null ? _a : 0;
61
+ });
62
+ const {
63
+ hour,
64
+ minute
65
+ } = fullTime;
66
+ if (props.minTime) {
67
+ const [minH, minM, minS] = getValidTime(props.minTime);
68
+ minHour = minH;
69
+ minMinute = +hour <= +minHour ? minM : "00";
70
+ minSecond = +hour <= +minHour && +minute <= +minMinute ? minS : "00";
71
+ }
72
+ if (props.maxTime) {
73
+ const [maxH, maxM, maxS] = getValidTime(props.maxTime);
74
+ maxHour = maxH;
75
+ maxMinute = +hour >= +maxHour ? maxM : "59";
76
+ maxSecond = +hour >= +maxHour && +minute >= +maxMinute ? maxS : "59";
77
+ }
45
78
  }
46
- }));
79
+ return props.columnsType.map((type) => {
80
+ const {
81
+ filter,
82
+ formatter
83
+ } = props;
84
+ switch (type) {
85
+ case "hour":
86
+ return genOptions(+minHour, +maxHour, type, formatter, filter, currentValues.value);
87
+ case "minute":
88
+ return genOptions(+minMinute, +maxMinute, type, formatter, filter, currentValues.value);
89
+ case "second":
90
+ return genOptions(+minSecond, +maxSecond, type, formatter, filter, currentValues.value);
91
+ default:
92
+ if (process.env.NODE_ENV !== "production") {
93
+ throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
94
+ }
95
+ return [];
96
+ }
97
+ });
98
+ });
47
99
  watch(currentValues, (newValues) => {
48
100
  if (!isSameValue(newValues, props.modelValue)) {
49
101
  emit("update:modelValue", newValues);
@@ -28,7 +28,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
28
28
  type: import("vue").PropType<string[]>;
29
29
  default: () => never[];
30
30
  };
31
- filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[]) => import("..").PickerOption[]>;
31
+ filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values?: string[] | undefined) => import("..").PickerOption[]>;
32
32
  formatter: {
33
33
  type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
34
34
  default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
@@ -58,10 +58,19 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
58
58
  type: (NumberConstructor | StringConstructor)[];
59
59
  default: number;
60
60
  };
61
+ minTime: {
62
+ type: StringConstructor;
63
+ validator: (val: string) => boolean;
64
+ };
65
+ maxTime: {
66
+ type: StringConstructor;
67
+ validator: (val: string) => boolean;
68
+ };
61
69
  columnsType: {
62
70
  type: import("vue").PropType<import("./TimePicker").TimePickerColumnType[]>;
63
71
  default: () => string[];
64
72
  };
73
+ filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
65
74
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm")[], "update:modelValue" | "cancel" | "change" | "confirm", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
66
75
  loading: BooleanConstructor;
67
76
  readonly: BooleanConstructor;
@@ -91,7 +100,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
91
100
  type: import("vue").PropType<string[]>;
92
101
  default: () => never[];
93
102
  };
94
- filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[]) => import("..").PickerOption[]>;
103
+ filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values?: string[] | undefined) => import("..").PickerOption[]>;
95
104
  formatter: {
96
105
  type: import("vue").PropType<(type: string, option: import("..").PickerOption) => import("..").PickerOption>;
97
106
  default: (type: string, option: import("..").PickerOption) => import("..").PickerOption;
@@ -121,10 +130,19 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
121
130
  type: (NumberConstructor | StringConstructor)[];
122
131
  default: number;
123
132
  };
133
+ minTime: {
134
+ type: StringConstructor;
135
+ validator: (val: string) => boolean;
136
+ };
137
+ maxTime: {
138
+ type: StringConstructor;
139
+ validator: (val: string) => boolean;
140
+ };
124
141
  columnsType: {
125
142
  type: import("vue").PropType<import("./TimePicker").TimePickerColumnType[]>;
126
143
  default: () => string[];
127
144
  };
145
+ filter: import("vue").PropType<(columnType: string, options: import("..").PickerOption[], values: string[]) => import("..").PickerOption[]>;
128
146
  }>> & {
129
147
  onChange?: ((...args: any[]) => any) | undefined;
130
148
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -13,6 +13,9 @@ export declare function get(object: any, path: string): any;
13
13
  export type Writeable<T> = {
14
14
  -readonly [P in keyof T]: T[P];
15
15
  };
16
+ export type RequiredParams<T> = T extends (...args: infer P) => infer R ? (...args: {
17
+ [K in keyof P]-?: NonNullable<P[K]>;
18
+ }) => R : never;
16
19
  export declare function pick<T, U extends keyof T>(obj: T, keys: ReadonlyArray<U>, ignoreUndefined?: boolean): Writeable<Pick<T, U>>;
17
20
  export declare const isSameValue: (newValue: unknown, oldValue: unknown) => boolean;
18
21
  export declare const toArray: <T>(item: T | T[]) => T[];
@@ -0,0 +1 @@
1
+ export declare function closest(arr: number[], target: number): number;
@@ -0,0 +1,8 @@
1
+ function closest(arr, target) {
2
+ return arr.reduce(
3
+ (pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur
4
+ );
5
+ }
6
+ export {
7
+ closest
8
+ };
@@ -11,3 +11,4 @@ export declare const BORDER_UNSET_TOP_BOTTOM: string;
11
11
  export declare const HAPTICS_FEEDBACK = "van-haptics-feedback";
12
12
  export declare const FORM_KEY: InjectionKey<FormProvide>;
13
13
  export declare const LONG_PRESS_START_TIME = 500;
14
+ export declare const TAP_OFFSET = 5;
@@ -9,6 +9,7 @@ const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
9
9
  const HAPTICS_FEEDBACK = "van-haptics-feedback";
10
10
  const FORM_KEY = Symbol("van-form");
11
11
  const LONG_PRESS_START_TIME = 500;
12
+ const TAP_OFFSET = 5;
12
13
  export {
13
14
  BORDER,
14
15
  BORDER_BOTTOM,
@@ -20,5 +21,6 @@ export {
20
21
  BORDER_UNSET_TOP_BOTTOM,
21
22
  FORM_KEY,
22
23
  HAPTICS_FEEDBACK,
23
- LONG_PRESS_START_TIME
24
+ LONG_PRESS_START_TIME,
25
+ TAP_OFFSET
24
26
  };
@@ -7,3 +7,4 @@ export * from './constant';
7
7
  export * from './validate';
8
8
  export * from './interceptor';
9
9
  export * from './with-install';
10
+ export * from './closest';
@@ -7,3 +7,4 @@ export * from "./constant.mjs";
7
7
  export * from "./validate.mjs";
8
8
  export * from "./interceptor.mjs";
9
9
  export * from "./with-install.mjs";
10
+ export * from "./closest.mjs";
@@ -76,6 +76,7 @@ export declare const Watermark: import("../utils").WithInstall<import("vue").Def
76
76
  export default Watermark;
77
77
  export { watermarkProps } from './Watermark';
78
78
  export type { WatermarkProps } from './Watermark';
79
+ export type { WatermarkThemeVars } from './types';
79
80
  declare module 'vue' {
80
81
  interface GlobalComponents {
81
82
  VanWatermark: typeof Watermark;
@@ -0,0 +1,3 @@
1
+ export type WatermarkThemeVars = {
2
+ watermarkZIndex?: number | string;
3
+ };
File without changes
@@ -17,6 +17,10 @@ export declare const addressListProps: {
17
17
  };
18
18
  addButtonText: StringConstructor;
19
19
  defaultTagText: StringConstructor;
20
+ rightIcon: {
21
+ type: import("vue").PropType<string>;
22
+ default: string;
23
+ };
20
24
  };
21
25
  export type AddressListProps = ExtractPropTypes<typeof addressListProps>;
22
26
  declare const _default: import("vue").DefineComponent<{
@@ -36,6 +40,10 @@ declare const _default: import("vue").DefineComponent<{
36
40
  };
37
41
  addButtonText: StringConstructor;
38
42
  defaultTagText: StringConstructor;
43
+ rightIcon: {
44
+ type: import("vue").PropType<string>;
45
+ default: string;
46
+ };
39
47
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:modelValue" | "add" | "edit" | "clickItem" | "editDisabled" | "selectDisabled")[], "select" | "update:modelValue" | "add" | "edit" | "clickItem" | "editDisabled" | "selectDisabled", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
40
48
  list: {
41
49
  type: import("vue").PropType<AddressListAddress[]>;
@@ -53,6 +61,10 @@ declare const _default: import("vue").DefineComponent<{
53
61
  };
54
62
  addButtonText: StringConstructor;
55
63
  defaultTagText: StringConstructor;
64
+ rightIcon: {
65
+ type: import("vue").PropType<string>;
66
+ default: string;
67
+ };
56
68
  }>> & {
57
69
  onSelect?: ((...args: any[]) => any) | undefined;
58
70
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -62,6 +74,7 @@ declare const _default: import("vue").DefineComponent<{
62
74
  onEditDisabled?: ((...args: any[]) => any) | undefined;
63
75
  onSelectDisabled?: ((...args: any[]) => any) | undefined;
64
76
  }, {
77
+ rightIcon: string;
65
78
  switchable: boolean;
66
79
  list: AddressListAddress[];
67
80
  disabledList: AddressListAddress[];
@@ -45,7 +45,8 @@ const addressListProps = {
45
45
  disabledText: String,
46
46
  disabledList: (0, import_utils.makeArrayProp)(),
47
47
  addButtonText: String,
48
- defaultTagText: String
48
+ defaultTagText: String,
49
+ rightIcon: (0, import_utils.makeStringProp)("edit")
49
50
  };
50
51
  var stdin_default = (0, import_vue2.defineComponent)({
51
52
  name,
@@ -70,6 +71,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
70
71
  "disabled": disabled,
71
72
  "switchable": props.switchable,
72
73
  "defaultTagText": props.defaultTagText,
74
+ "rightIcon": props.rightIcon,
73
75
  "onEdit": onEdit,
74
76
  "onClick": onClick,
75
77
  "onSelect": onSelect
@@ -15,6 +15,10 @@ declare const _default: import("vue").DefineComponent<{
15
15
  disabled: BooleanConstructor;
16
16
  switchable: BooleanConstructor;
17
17
  defaultTagText: StringConstructor;
18
+ rightIcon: {
19
+ type: PropType<string>;
20
+ default: string;
21
+ };
18
22
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "click" | "edit")[], "select" | "click" | "edit", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
19
23
  address: {
20
24
  type: PropType<AddressListAddress>;
@@ -23,12 +27,17 @@ declare const _default: import("vue").DefineComponent<{
23
27
  disabled: BooleanConstructor;
24
28
  switchable: BooleanConstructor;
25
29
  defaultTagText: StringConstructor;
30
+ rightIcon: {
31
+ type: PropType<string>;
32
+ default: string;
33
+ };
26
34
  }>> & {
27
35
  onClick?: ((...args: any[]) => any) | undefined;
28
36
  onSelect?: ((...args: any[]) => any) | undefined;
29
37
  onEdit?: ((...args: any[]) => any) | undefined;
30
38
  }, {
31
39
  disabled: boolean;
40
+ rightIcon: string;
32
41
  switchable: boolean;
33
42
  }, {}>;
34
43
  export default _default;
@@ -34,7 +34,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
34
34
  address: (0, import_utils.makeRequiredProp)(Object),
35
35
  disabled: Boolean,
36
36
  switchable: Boolean,
37
- defaultTagText: String
37
+ defaultTagText: String,
38
+ rightIcon: (0, import_utils.makeStringProp)("edit")
38
39
  },
39
40
  emits: ["edit", "click", "select"],
40
41
  setup(props, {
@@ -48,7 +49,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
48
49
  emit("click");
49
50
  };
50
51
  const renderRightIcon = () => (0, import_vue.createVNode)(import_icon.Icon, {
51
- "name": "edit",
52
+ "name": props.rightIcon,
52
53
  "class": bem("edit"),
53
54
  "onClick": (event) => {
54
55
  event.stopPropagation();
@@ -15,6 +15,10 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
15
15
  };
16
16
  addButtonText: StringConstructor;
17
17
  defaultTagText: StringConstructor;
18
+ rightIcon: {
19
+ type: import("vue").PropType<string>;
20
+ default: string;
21
+ };
18
22
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:modelValue" | "add" | "edit" | "clickItem" | "editDisabled" | "selectDisabled")[], "select" | "update:modelValue" | "add" | "edit" | "clickItem" | "editDisabled" | "selectDisabled", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
19
23
  list: {
20
24
  type: import("vue").PropType<import("./AddressListItem").AddressListAddress[]>;
@@ -32,6 +36,10 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
32
36
  };
33
37
  addButtonText: StringConstructor;
34
38
  defaultTagText: StringConstructor;
39
+ rightIcon: {
40
+ type: import("vue").PropType<string>;
41
+ default: string;
42
+ };
35
43
  }>> & {
36
44
  onSelect?: ((...args: any[]) => any) | undefined;
37
45
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -41,6 +49,7 @@ export declare const AddressList: import("../utils").WithInstall<import("vue").D
41
49
  onEditDisabled?: ((...args: any[]) => any) | undefined;
42
50
  onSelectDisabled?: ((...args: any[]) => any) | undefined;
43
51
  }, {
52
+ rightIcon: string;
44
53
  switchable: boolean;
45
54
  list: import("./AddressListItem").AddressListAddress[];
46
55
  disabledList: import("./AddressListItem").AddressListAddress[];
@@ -50,6 +50,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
50
50
  slots,
51
51
  attrs
52
52
  }) {
53
+ let shouldReshow = false;
53
54
  const show = (0, import_vue2.ref)(false);
54
55
  const root = (0, import_vue2.ref)();
55
56
  const scrollParent = (0, import_vue2.ref)();
@@ -96,6 +97,18 @@ var stdin_default = (0, import_vue2.defineComponent)({
96
97
  target: scrollParent
97
98
  });
98
99
  (0, import_vue2.onMounted)(updateTarget);
100
+ (0, import_vue2.onActivated)(() => {
101
+ if (shouldReshow) {
102
+ show.value = true;
103
+ shouldReshow = false;
104
+ }
105
+ });
106
+ (0, import_vue2.onDeactivated)(() => {
107
+ if (show.value && props.teleport) {
108
+ show.value = false;
109
+ shouldReshow = true;
110
+ }
111
+ });
99
112
  (0, import_vue2.watch)(() => props.target, updateTarget);
100
113
  return () => {
101
114
  const Content = (0, import_vue.createVNode)("div", (0, import_vue.mergeProps)({
@@ -61,7 +61,7 @@ export declare const Barrage: import("../utils").WithInstall<import("vue").Defin
61
61
  export default Barrage;
62
62
  export { barrageProps } from './Barrage';
63
63
  export type { BarrageProps, BarrageItem } from './Barrage';
64
- export type { BarrageInstance } from './types';
64
+ export type { BarrageInstance, BarrageThemeVars } from './types';
65
65
  declare module 'vue' {
66
66
  interface GlobalComponents {
67
67
  VanBarrage: typeof Barrage;
@@ -5,3 +5,9 @@ export type BarrageExpose = {
5
5
  pause(): void;
6
6
  };
7
7
  export type BarrageInstance = ComponentPublicInstance<BarrageProps, BarrageExpose>;
8
+ export type BarrageThemeVars = {
9
+ barrageFontSize?: string;
10
+ barrageSpace?: string;
11
+ barrageFont?: string;
12
+ barrageColor?: string;
13
+ };
@@ -12,5 +12,6 @@ export declare function useTouch(): {
12
12
  direction: import("vue").Ref<Direction>;
13
13
  isVertical: () => boolean;
14
14
  isHorizontal: () => boolean;
15
+ isTap: import("vue").Ref<boolean>;
15
16
  };
16
17
  export {};
@@ -21,6 +21,7 @@ __export(stdin_exports, {
21
21
  });
22
22
  module.exports = __toCommonJS(stdin_exports);
23
23
  var import_vue = require("vue");
24
+ var import_utils = require("../utils");
24
25
  function getDirection(x, y) {
25
26
  if (x > y) {
26
27
  return "horizontal";
@@ -38,6 +39,7 @@ function useTouch() {
38
39
  const offsetX = (0, import_vue.ref)(0);
39
40
  const offsetY = (0, import_vue.ref)(0);
40
41
  const direction = (0, import_vue.ref)("");
42
+ const isTap = (0, import_vue.ref)(true);
41
43
  const isVertical = () => direction.value === "vertical";
42
44
  const isHorizontal = () => direction.value === "horizontal";
43
45
  const reset = () => {
@@ -46,6 +48,7 @@ function useTouch() {
46
48
  offsetX.value = 0;
47
49
  offsetY.value = 0;
48
50
  direction.value = "";
51
+ isTap.value = true;
49
52
  };
50
53
  const start = (event) => {
51
54
  reset();
@@ -62,6 +65,9 @@ function useTouch() {
62
65
  if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
63
66
  direction.value = getDirection(offsetX.value, offsetY.value);
64
67
  }
68
+ if (isTap.value && (offsetX.value > import_utils.TAP_OFFSET || offsetY.value > import_utils.TAP_OFFSET)) {
69
+ isTap.value = false;
70
+ }
65
71
  };
66
72
  return {
67
73
  move,
@@ -75,6 +81,7 @@ function useTouch() {
75
81
  offsetY,
76
82
  direction,
77
83
  isVertical,
78
- isHorizontal
84
+ isHorizontal,
85
+ isTap
79
86
  };
80
87
  }
@@ -1 +1 @@
1
- export type ConfigProviderThemeVars = import('../action-bar').ActionBarThemeVars & import('../action-bar-button').ActionBarButtonThemeVars & import('../action-bar-icon').ActionBarIconThemeVars & import('../action-sheet').ActionSheetThemeVars & import('../address-edit').AddressEditThemeVars & import('../address-list').AddressListThemeVars & import('../badge').BadgeThemeVars & import('../button').ButtonThemeVars & import('../calendar').CalendarThemeVars & import('../card').CardThemeVars & import('../cascader').CascaderThemeVars & import('../cell').CellThemeVars & import('../cell-group').CellGroupThemeVars & import('../checkbox').CheckboxThemeVars & import('../circle').CircleThemeVars & import('../collapse-item').CollapseItemThemeVars & import('../contact-card').ContactCardThemeVars & import('../contact-edit').ContactEditThemeVars & import('../contact-list').ContactListThemeVars & import('../count-down').CountDownThemeVars & import('../coupon').CouponThemeVars & import('../coupon-cell').CouponCellThemeVars & import('../coupon-list').CouponListThemeVars & import('../dialog').DialogThemeVars & import('../divider').DividerThemeVars & import('../dropdown-item').DropdownItemThemeVars & import('../dropdown-menu').DropdownMenuThemeVars & import('../empty').EmptyThemeVars & import('../field').FieldThemeVars & import('../grid-item').GridItemThemeVars & import('../image').ImageThemeVars & import('../image-preview').ImagePreviewThemeVars & import('../index-anchor').IndexAnchorThemeVars & import('../index-bar').IndexBarThemeVars & import('../list').ListThemeVars & import('../loading').LoadingThemeVars & import('../nav-bar').NavBarThemeVars & import('../notice-bar').NoticeBarThemeVars & import('../notify').NotifyThemeVars & import('../number-keyboard').NumberKeyboardThemeVars & import('../overlay').OverlayThemeVars & import('../pagination').PaginationThemeVars & import('../password-input').PasswordInputThemeVars & import('../picker').PickerThemeVars & import('../picker-group').PickerGroupThemeVars & import('../popover').PopoverThemeVars & import('../popup').PopupThemeVars & import('../progress').ProgressThemeVars & import('../pull-refresh').PullRefreshThemeVars & import('../radio').RadioThemeVars & import('../rate').RateThemeVars & import('../search').SearchThemeVars & import('../share-sheet').ShareSheetThemeVars & import('../sidebar').SidebarThemeVars & import('../sidebar-item').SidebarItemThemeVars & import('../skeleton').SkeletonThemeVars & import('../slider').SliderThemeVars & import('../step').StepThemeVars & import('../stepper').StepperThemeVars & import('../steps').StepsThemeVars & import('../sticky').StickyThemeVars & import('../submit-bar').SubmitBarThemeVars & import('../swipe').SwipeThemeVars & import('../switch').SwitchThemeVars & import('../tabbar').TabbarThemeVars & import('../tabbar-item').TabbarItemThemeVars & import('../tabs').TabsThemeVars & import('../tag').TagThemeVars & import('../toast').ToastThemeVars & import('../tree-select').TreeSelectThemeVars & import('../uploader').UploaderThemeVars;
1
+ export type ConfigProviderThemeVars = import('../action-bar').ActionBarThemeVars & import('../action-bar-button').ActionBarButtonThemeVars & import('../action-bar-icon').ActionBarIconThemeVars & import('../action-sheet').ActionSheetThemeVars & import('../address-edit').AddressEditThemeVars & import('../address-list').AddressListThemeVars & import('../badge').BadgeThemeVars & import('../barrage').BarrageThemeVars & import('../button').ButtonThemeVars & import('../calendar').CalendarThemeVars & import('../card').CardThemeVars & import('../cascader').CascaderThemeVars & import('../cell').CellThemeVars & import('../cell-group').CellGroupThemeVars & import('../checkbox').CheckboxThemeVars & import('../circle').CircleThemeVars & import('../collapse-item').CollapseItemThemeVars & import('../contact-card').ContactCardThemeVars & import('../contact-edit').ContactEditThemeVars & import('../contact-list').ContactListThemeVars & import('../count-down').CountDownThemeVars & import('../coupon').CouponThemeVars & import('../coupon-cell').CouponCellThemeVars & import('../coupon-list').CouponListThemeVars & import('../dialog').DialogThemeVars & import('../divider').DividerThemeVars & import('../dropdown-item').DropdownItemThemeVars & import('../dropdown-menu').DropdownMenuThemeVars & import('../empty').EmptyThemeVars & import('../field').FieldThemeVars & import('../floating-bubble').FloatingBubbleThemeVars & import('../floating-panel').FloatingPanelThemeVars & import('../grid-item').GridItemThemeVars & import('../image').ImageThemeVars & import('../image-preview').ImagePreviewThemeVars & import('../index-anchor').IndexAnchorThemeVars & import('../index-bar').IndexBarThemeVars & import('../list').ListThemeVars & import('../loading').LoadingThemeVars & import('../nav-bar').NavBarThemeVars & import('../notice-bar').NoticeBarThemeVars & import('../notify').NotifyThemeVars & import('../number-keyboard').NumberKeyboardThemeVars & import('../overlay').OverlayThemeVars & import('../pagination').PaginationThemeVars & import('../password-input').PasswordInputThemeVars & import('../picker').PickerThemeVars & import('../picker-group').PickerGroupThemeVars & import('../popover').PopoverThemeVars & import('../popup').PopupThemeVars & import('../progress').ProgressThemeVars & import('../pull-refresh').PullRefreshThemeVars & import('../radio').RadioThemeVars & import('../rate').RateThemeVars & import('../rolling-text').RollingTextThemeVars & import('../search').SearchThemeVars & import('../share-sheet').ShareSheetThemeVars & import('../sidebar').SidebarThemeVars & import('../sidebar-item').SidebarItemThemeVars & import('../signature').SignatureThemeVars & import('../skeleton').SkeletonThemeVars & import('../slider').SliderThemeVars & import('../step').StepThemeVars & import('../stepper').StepperThemeVars & import('../steps').StepsThemeVars & import('../sticky').StickyThemeVars & import('../submit-bar').SubmitBarThemeVars & import('../swipe').SwipeThemeVars & import('../switch').SwitchThemeVars & import('../tabbar').TabbarThemeVars & import('../tabbar-item').TabbarItemThemeVars & import('../tabs').TabsThemeVars & import('../tag').TagThemeVars & import('../toast').ToastThemeVars & import('../tree-select').TreeSelectThemeVars & import('../uploader').UploaderThemeVars & import('../watermark').WatermarkThemeVars;
@@ -29,7 +29,7 @@ export declare const datePickerProps: {
29
29
  type: PropType<string[]>;
30
30
  default: () => never[];
31
31
  };
32
- filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
32
+ filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
33
33
  formatter: {
34
34
  type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
35
35
  default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
@@ -80,7 +80,7 @@ declare const _default: import("vue").DefineComponent<{
80
80
  type: PropType<string[]>;
81
81
  default: () => never[];
82
82
  };
83
- filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
83
+ filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
84
84
  formatter: {
85
85
  type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
86
86
  default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;
@@ -129,7 +129,7 @@ declare const _default: import("vue").DefineComponent<{
129
129
  type: PropType<string[]>;
130
130
  default: () => never[];
131
131
  };
132
- filter: PropType<(columnType: string, options: import("../picker").PickerOption[]) => import("../picker").PickerOption[]>;
132
+ filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values?: string[] | undefined) => import("../picker").PickerOption[]>;
133
133
  formatter: {
134
134
  type: PropType<(type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption>;
135
135
  default: (type: string, option: import("../picker").PickerOption) => import("../picker").PickerOption;