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
@@ -0,0 +1,79 @@
1
+ import _RollingText from './RollingText';
2
+ export declare const RollingText: import("../utils").WithInstall<import("vue").DefineComponent<{
3
+ startNum: {
4
+ type: NumberConstructor;
5
+ default: number;
6
+ };
7
+ targetNum: NumberConstructor;
8
+ textList: {
9
+ type: import("vue").PropType<string[]>;
10
+ default: () => never[];
11
+ };
12
+ duration: {
13
+ type: NumberConstructor;
14
+ default: number;
15
+ };
16
+ autoStart: {
17
+ type: BooleanConstructor;
18
+ default: true;
19
+ };
20
+ direction: {
21
+ type: import("vue").PropType<import("./types").RollingTextDirection>;
22
+ default: import("./types").RollingTextDirection;
23
+ };
24
+ stopOrder: {
25
+ type: import("vue").PropType<import("./types").RollingTextStopOrder>;
26
+ default: import("./types").RollingTextStopOrder;
27
+ };
28
+ height: {
29
+ type: NumberConstructor;
30
+ default: number;
31
+ };
32
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
33
+ startNum: {
34
+ type: NumberConstructor;
35
+ default: number;
36
+ };
37
+ targetNum: NumberConstructor;
38
+ textList: {
39
+ type: import("vue").PropType<string[]>;
40
+ default: () => never[];
41
+ };
42
+ duration: {
43
+ type: NumberConstructor;
44
+ default: number;
45
+ };
46
+ autoStart: {
47
+ type: BooleanConstructor;
48
+ default: true;
49
+ };
50
+ direction: {
51
+ type: import("vue").PropType<import("./types").RollingTextDirection>;
52
+ default: import("./types").RollingTextDirection;
53
+ };
54
+ stopOrder: {
55
+ type: import("vue").PropType<import("./types").RollingTextStopOrder>;
56
+ default: import("./types").RollingTextStopOrder;
57
+ };
58
+ height: {
59
+ type: NumberConstructor;
60
+ default: number;
61
+ };
62
+ }>>, {
63
+ height: number;
64
+ duration: number;
65
+ direction: import("./types").RollingTextDirection;
66
+ autoStart: boolean;
67
+ startNum: number;
68
+ textList: string[];
69
+ stopOrder: import("./types").RollingTextStopOrder;
70
+ }, {}>>;
71
+ export default RollingText;
72
+ export { rollingTextProps } from './RollingText';
73
+ export type { RollingTextProps } from './RollingText';
74
+ export type { RollingTextDirection, RollingTextInstance, RollingTextStopOrder, RollingTextThemeVars, } from './types';
75
+ declare module 'vue' {
76
+ interface GlobalComponents {
77
+ VanRollingText: typeof _RollingText;
78
+ }
79
+ }
@@ -0,0 +1,39 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var stdin_exports = {};
29
+ __export(stdin_exports, {
30
+ RollingText: () => RollingText,
31
+ default: () => stdin_default,
32
+ rollingTextProps: () => import_RollingText2.rollingTextProps
33
+ });
34
+ module.exports = __toCommonJS(stdin_exports);
35
+ var import_utils = require("../utils");
36
+ var import_RollingText = __toESM(require("./RollingText"));
37
+ var import_RollingText2 = require("./RollingText");
38
+ const RollingText = (0, import_utils.withInstall)(import_RollingText.default);
39
+ var stdin_default = RollingText;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ require("../../style/base.css");
2
+ require("../index.css");
@@ -0,0 +1,17 @@
1
+ import type { ComponentPublicInstance } from 'vue';
2
+ import type { RollingTextProps } from './RollingText';
3
+ export type RollingTextDirection = 'up' | 'down';
4
+ export type RollingTextStopOrder = 'ltr' | 'rtl';
5
+ export type RollingTextExpose = {
6
+ start: () => void;
7
+ reset: () => void;
8
+ };
9
+ export type RollingTextInstance = ComponentPublicInstance<RollingTextProps, RollingTextExpose>;
10
+ export type RollingTextThemeVars = {
11
+ rollingTextBackground?: string;
12
+ rollingTextColor?: string;
13
+ rollingTextFontSize?: string;
14
+ rollingTextGap?: string;
15
+ rollingTextItemWidth?: string;
16
+ rollingTextItemBorderRadius?: string;
17
+ };
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var stdin_exports = {};
15
+ module.exports = __toCommonJS(stdin_exports);
@@ -52,6 +52,7 @@ export declare const Signature: import("../utils").WithInstall<import("vue").Def
52
52
  }, {}>>;
53
53
  export default Signature;
54
54
  export type { SignatureProps } from './Signature';
55
+ export type { SignatureThemeVars } from './types';
55
56
  declare module 'vue' {
56
57
  interface GlobalComponents {
57
58
  Signature: typeof Signature;
@@ -0,0 +1,6 @@
1
+ export type SignatureThemeVars = {
2
+ signaturePadding?: string;
3
+ signatureContentHeight?: string;
4
+ signatureContentBackground?: string;
5
+ signatureContentBorder?: string;
6
+ };
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var stdin_exports = {};
15
+ module.exports = __toCommonJS(stdin_exports);
@@ -94,7 +94,7 @@ declare const _default: import("vue").DefineComponent<{
94
94
  modelValue: SliderValue;
95
95
  readonly: boolean;
96
96
  vertical: boolean;
97
- step: string | number;
98
97
  min: string | number;
98
+ step: string | number;
99
99
  }, {}>;
100
100
  export default _default;
@@ -233,17 +233,25 @@ var stdin_default = (0, import_vue2.defineComponent)({
233
233
  return bem("button-wrapper", props.reverse ? "left" : "right");
234
234
  };
235
235
  const renderButtonContent = (value, index) => {
236
+ const dragging = dragStatus.value === "dragging";
236
237
  if (typeof index === "number") {
237
238
  const slot = slots[index === 0 ? "left-button" : "right-button"];
239
+ let dragIndex;
240
+ if (dragging && Array.isArray(current)) {
241
+ dragIndex = current[0] > current[1] ? buttonIndex ^ 1 : buttonIndex;
242
+ }
238
243
  if (slot) {
239
244
  return slot({
240
- value
245
+ value,
246
+ dragging,
247
+ dragIndex
241
248
  });
242
249
  }
243
250
  }
244
251
  if (slots.button) {
245
252
  return slots.button({
246
- value
253
+ value,
254
+ dragging
247
255
  });
248
256
  }
249
257
  return (0, import_vue.createVNode)("div", {
@@ -63,8 +63,8 @@ export declare const Slider: import("../utils").WithInstall<import("vue").Define
63
63
  modelValue: number | [number, number];
64
64
  readonly: boolean;
65
65
  vertical: boolean;
66
- step: string | number;
67
66
  min: string | number;
67
+ step: string | number;
68
68
  }, {}>>;
69
69
  export default Slider;
70
70
  export { sliderProps } from './Slider';
@@ -177,9 +177,9 @@ declare const _default: import("vue").DefineComponent<{
177
177
  name: string | number;
178
178
  max: string | number;
179
179
  disabled: boolean;
180
+ min: string | number;
180
181
  longPress: boolean;
181
182
  step: string | number;
182
- min: string | number;
183
183
  integer: boolean;
184
184
  showPlus: boolean;
185
185
  showMinus: boolean;
@@ -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;
@@ -23,21 +23,32 @@ __export(stdin_exports, {
23
23
  module.exports = __toCommonJS(stdin_exports);
24
24
  var import_vue = require("vue");
25
25
  var import_vue2 = require("vue");
26
- var import_utils = require("../utils");
27
- var import_utils2 = require("../date-picker/utils");
26
+ var import_utils = require("../date-picker/utils");
27
+ var import_utils2 = require("../utils");
28
28
  var import_picker = require("../picker");
29
- const [name] = (0, import_utils.createNamespace)("time-picker");
30
- const timePickerProps = (0, import_utils.extend)({}, import_utils2.sharedProps, {
31
- minHour: (0, import_utils.makeNumericProp)(0),
32
- maxHour: (0, import_utils.makeNumericProp)(23),
33
- minMinute: (0, import_utils.makeNumericProp)(0),
34
- maxMinute: (0, import_utils.makeNumericProp)(59),
35
- minSecond: (0, import_utils.makeNumericProp)(0),
36
- maxSecond: (0, import_utils.makeNumericProp)(59),
29
+ const [name] = (0, import_utils2.createNamespace)("time-picker");
30
+ const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
31
+ const fullColumns = ["hour", "minute", "second"];
32
+ const timePickerProps = (0, import_utils2.extend)({}, import_utils.sharedProps, {
33
+ minHour: (0, import_utils2.makeNumericProp)(0),
34
+ maxHour: (0, import_utils2.makeNumericProp)(23),
35
+ minMinute: (0, import_utils2.makeNumericProp)(0),
36
+ maxMinute: (0, import_utils2.makeNumericProp)(59),
37
+ minSecond: (0, import_utils2.makeNumericProp)(0),
38
+ maxSecond: (0, import_utils2.makeNumericProp)(59),
39
+ minTime: {
40
+ type: String,
41
+ validator: validateTime
42
+ },
43
+ maxTime: {
44
+ type: String,
45
+ validator: validateTime
46
+ },
37
47
  columnsType: {
38
48
  type: Array,
39
49
  default: () => ["hour", "minute"]
40
- }
50
+ },
51
+ filter: Function
41
52
  });
42
53
  var stdin_default = (0, import_vue2.defineComponent)({
43
54
  name,
@@ -48,33 +59,74 @@ var stdin_default = (0, import_vue2.defineComponent)({
48
59
  slots
49
60
  }) {
50
61
  const currentValues = (0, import_vue2.ref)(props.modelValue);
51
- const columns = (0, import_vue2.computed)(() => props.columnsType.map((type) => {
52
- const {
53
- filter,
54
- formatter
62
+ const getValidTime = (time) => {
63
+ const timeLimitArr = time.split(":");
64
+ return fullColumns.map((col, i) => props.columnsType.includes(col) ? timeLimitArr[i] : "00");
65
+ };
66
+ const columns = (0, import_vue2.computed)(() => {
67
+ let {
68
+ minHour,
69
+ maxHour,
70
+ minMinute,
71
+ maxMinute,
72
+ minSecond,
73
+ maxSecond
55
74
  } = props;
56
- switch (type) {
57
- case "hour":
58
- return (0, import_utils2.genOptions)(+props.minHour, +props.maxHour, type, formatter, filter);
59
- case "minute":
60
- return (0, import_utils2.genOptions)(+props.minMinute, +props.maxMinute, type, formatter, filter);
61
- case "second":
62
- return (0, import_utils2.genOptions)(+props.minSecond, +props.maxSecond, type, formatter, filter);
63
- default:
64
- if (process.env.NODE_ENV !== "production") {
65
- throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
66
- }
67
- return [];
75
+ if (props.minTime || props.maxTime) {
76
+ const fullTime = {
77
+ hour: 0,
78
+ minute: 0,
79
+ second: 0
80
+ };
81
+ props.columnsType.forEach((col, i) => {
82
+ var _a;
83
+ fullTime[col] = (_a = currentValues.value[i]) != null ? _a : 0;
84
+ });
85
+ const {
86
+ hour,
87
+ minute
88
+ } = fullTime;
89
+ if (props.minTime) {
90
+ const [minH, minM, minS] = getValidTime(props.minTime);
91
+ minHour = minH;
92
+ minMinute = +hour <= +minHour ? minM : "00";
93
+ minSecond = +hour <= +minHour && +minute <= +minMinute ? minS : "00";
94
+ }
95
+ if (props.maxTime) {
96
+ const [maxH, maxM, maxS] = getValidTime(props.maxTime);
97
+ maxHour = maxH;
98
+ maxMinute = +hour >= +maxHour ? maxM : "59";
99
+ maxSecond = +hour >= +maxHour && +minute >= +maxMinute ? maxS : "59";
100
+ }
68
101
  }
69
- }));
102
+ return props.columnsType.map((type) => {
103
+ const {
104
+ filter,
105
+ formatter
106
+ } = props;
107
+ switch (type) {
108
+ case "hour":
109
+ return (0, import_utils.genOptions)(+minHour, +maxHour, type, formatter, filter, currentValues.value);
110
+ case "minute":
111
+ return (0, import_utils.genOptions)(+minMinute, +maxMinute, type, formatter, filter, currentValues.value);
112
+ case "second":
113
+ return (0, import_utils.genOptions)(+minSecond, +maxSecond, type, formatter, filter, currentValues.value);
114
+ default:
115
+ if (process.env.NODE_ENV !== "production") {
116
+ throw new Error(`[Vant] DatePicker: unsupported columns type: ${type}`);
117
+ }
118
+ return [];
119
+ }
120
+ });
121
+ });
70
122
  (0, import_vue2.watch)(currentValues, (newValues) => {
71
- if (!(0, import_utils.isSameValue)(newValues, props.modelValue)) {
123
+ if (!(0, import_utils2.isSameValue)(newValues, props.modelValue)) {
72
124
  emit("update:modelValue", newValues);
73
125
  }
74
126
  });
75
127
  (0, import_vue2.watch)(() => props.modelValue, (newValues) => {
76
- newValues = (0, import_utils2.formatValueRange)(newValues, columns.value);
77
- if (!(0, import_utils.isSameValue)(newValues, currentValues.value)) {
128
+ newValues = (0, import_utils.formatValueRange)(newValues, columns.value);
129
+ if (!(0, import_utils2.isSameValue)(newValues, currentValues.value)) {
78
130
  currentValues.value = newValues;
79
131
  }
80
132
  }, {
@@ -90,6 +142,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
90
142
  "onChange": onChange,
91
143
  "onCancel": onCancel,
92
144
  "onConfirm": onConfirm
93
- }, (0, import_utils.pick)(props, import_utils2.pickerInheritKeys)), slots);
145
+ }, (0, import_utils2.pick)(props, import_utils.pickerInheritKeys)), slots);
94
146
  }
95
147
  });
@@ -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,27 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var stdin_exports = {};
19
+ __export(stdin_exports, {
20
+ closest: () => closest
21
+ });
22
+ module.exports = __toCommonJS(stdin_exports);
23
+ function closest(arr, target) {
24
+ return arr.reduce(
25
+ (pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur
26
+ );
27
+ }
@@ -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;
@@ -27,7 +27,8 @@ __export(stdin_exports, {
27
27
  BORDER_UNSET_TOP_BOTTOM: () => BORDER_UNSET_TOP_BOTTOM,
28
28
  FORM_KEY: () => FORM_KEY,
29
29
  HAPTICS_FEEDBACK: () => HAPTICS_FEEDBACK,
30
- LONG_PRESS_START_TIME: () => LONG_PRESS_START_TIME
30
+ LONG_PRESS_START_TIME: () => LONG_PRESS_START_TIME,
31
+ TAP_OFFSET: () => TAP_OFFSET
31
32
  });
32
33
  module.exports = __toCommonJS(stdin_exports);
33
34
  const BORDER = "van-hairline";
@@ -41,3 +42,4 @@ const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
41
42
  const HAPTICS_FEEDBACK = "van-haptics-feedback";
42
43
  const FORM_KEY = Symbol("van-form");
43
44
  const LONG_PRESS_START_TIME = 500;
45
+ const TAP_OFFSET = 5;
@@ -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';
@@ -23,3 +23,4 @@ __reExport(stdin_exports, require("./constant"), module.exports);
23
23
  __reExport(stdin_exports, require("./validate"), module.exports);
24
24
  __reExport(stdin_exports, require("./interceptor"), module.exports);
25
25
  __reExport(stdin_exports, require("./with-install"), module.exports);
26
+ __reExport(stdin_exports, require("./closest"), module.exports);