vant 4.8.7 → 4.8.9

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/README.md +1 -1
  2. package/es/address-list/AddressList.mjs +3 -1
  3. package/es/address-list/AddressListItem.mjs +3 -3
  4. package/es/coupon-cell/CouponCell.d.ts +4 -4
  5. package/es/coupon-cell/CouponCell.mjs +35 -12
  6. package/es/coupon-cell/index.d.ts +3 -3
  7. package/es/coupon-list/CouponList.d.ts +3 -13
  8. package/es/coupon-list/CouponList.mjs +15 -6
  9. package/es/coupon-list/index.d.ts +2 -9
  10. package/es/date-picker/DatePicker.d.ts +6 -1
  11. package/es/date-picker/DatePicker.mjs +12 -0
  12. package/es/date-picker/index.d.ts +1 -1
  13. package/es/floating-bubble/FloatingBubble.mjs +3 -1
  14. package/es/image-preview/ImagePreviewItem.mjs +3 -1
  15. package/es/index.d.ts +1 -1
  16. package/es/index.mjs +1 -1
  17. package/es/picker-group/PickerGroup.mjs +11 -3
  18. package/es/text-ellipsis/TextEllipsis.mjs +30 -21
  19. package/es/time-picker/TimePicker.d.ts +6 -1
  20. package/es/time-picker/TimePicker.mjs +13 -1
  21. package/es/time-picker/index.d.ts +1 -1
  22. package/es/utils/basic.d.ts +1 -0
  23. package/es/utils/basic.mjs +2 -0
  24. package/lib/address-list/AddressList.js +3 -1
  25. package/lib/address-list/AddressListItem.js +3 -3
  26. package/lib/coupon-cell/CouponCell.d.ts +4 -4
  27. package/lib/coupon-cell/CouponCell.js +34 -11
  28. package/lib/coupon-cell/index.d.ts +3 -3
  29. package/lib/coupon-list/CouponList.d.ts +3 -13
  30. package/lib/coupon-list/CouponList.js +14 -5
  31. package/lib/coupon-list/index.d.ts +2 -9
  32. package/lib/date-picker/DatePicker.d.ts +6 -1
  33. package/lib/date-picker/DatePicker.js +12 -0
  34. package/lib/date-picker/index.d.ts +1 -1
  35. package/lib/floating-bubble/FloatingBubble.js +3 -1
  36. package/lib/image-preview/ImagePreviewItem.js +3 -1
  37. package/lib/index.d.ts +1 -1
  38. package/lib/index.js +1 -1
  39. package/lib/picker-group/PickerGroup.js +9 -1
  40. package/lib/text-ellipsis/TextEllipsis.js +29 -20
  41. package/lib/time-picker/TimePicker.d.ts +6 -1
  42. package/lib/time-picker/TimePicker.js +12 -0
  43. package/lib/time-picker/index.d.ts +1 -1
  44. package/lib/utils/basic.d.ts +1 -0
  45. package/lib/utils/basic.js +2 -0
  46. package/lib/vant.cjs.js +122 -44
  47. package/lib/vant.es.js +122 -44
  48. package/lib/vant.js +123 -45
  49. package/lib/vant.min.js +3 -3
  50. package/lib/web-types.json +1 -1
  51. package/package.json +10 -10
package/README.md CHANGED
@@ -126,7 +126,7 @@ Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3)
126
126
  | [vant-playground](https://github.com/LadyChatterleyLover/vant-playground) | Vant Playground |
127
127
  | [sfc-playground-vant](https://github.com/zhixiaoqiang/sfc-playground-vant) | Vant Playground |
128
128
  | [vue3-h5-template](https://github.com/yulimchen/vue3-h5-template) | Mobile project template based on Vant |
129
- | [vue3-vant-mobile](https://github.com/CharleeWa/vue3-vant-mobile) | Mobile project template based on Vant |
129
+ | [vue3-vant-mobile](https://github.com/easy-temps/vue3-vant-mobile) | Mobile project template based on Vant |
130
130
  | [vscode-common-intellisense](https://github.com/Simon-He95/vscode-common-intellisense) | A VS Code extension that provides better intellisense to Vant developers |
131
131
 
132
132
  ## Links
@@ -26,7 +26,9 @@ var stdin_default = defineComponent({
26
26
  }) {
27
27
  const renderItem = (item, index, disabled) => {
28
28
  const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
29
- const onClick = () => emit("clickItem", item, index);
29
+ const onClick = (event) => emit("clickItem", item, index, {
30
+ event
31
+ });
30
32
  const onSelect = () => {
31
33
  emit(disabled ? "selectDisabled" : "select", item, index);
32
34
  if (!disabled) {
@@ -20,11 +20,11 @@ var stdin_default = defineComponent({
20
20
  slots,
21
21
  emit
22
22
  }) {
23
- const onClick = () => {
23
+ const onClick = (event) => {
24
24
  if (props.switchable) {
25
25
  emit("select");
26
26
  }
27
- emit("click");
27
+ emit("click", event);
28
28
  };
29
29
  const renderRightIcon = () => _createVNode(Icon, {
30
30
  "name": props.rightIcon,
@@ -32,7 +32,7 @@ var stdin_default = defineComponent({
32
32
  "onClick": (event) => {
33
33
  event.stopPropagation();
34
34
  emit("edit");
35
- emit("click");
35
+ emit("click", event);
36
36
  }
37
37
  }, null);
38
38
  const renderTag = () => {
@@ -19,7 +19,7 @@ export declare const couponCellProps: {
19
19
  default: string;
20
20
  };
21
21
  chosenCoupon: {
22
- type: (NumberConstructor | StringConstructor)[];
22
+ type: (NumberConstructor | ArrayConstructor)[];
23
23
  default: number;
24
24
  };
25
25
  };
@@ -43,7 +43,7 @@ declare const _default: import("vue").DefineComponent<{
43
43
  default: string;
44
44
  };
45
45
  chosenCoupon: {
46
- type: (NumberConstructor | StringConstructor)[];
46
+ type: (NumberConstructor | ArrayConstructor)[];
47
47
  default: number;
48
48
  };
49
49
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
@@ -65,7 +65,7 @@ declare const _default: import("vue").DefineComponent<{
65
65
  default: string;
66
66
  };
67
67
  chosenCoupon: {
68
- type: (NumberConstructor | StringConstructor)[];
68
+ type: (NumberConstructor | ArrayConstructor)[];
69
69
  default: number;
70
70
  };
71
71
  }>>, {
@@ -73,6 +73,6 @@ declare const _default: import("vue").DefineComponent<{
73
73
  currency: string;
74
74
  editable: boolean;
75
75
  coupons: CouponInfo[];
76
- chosenCoupon: string | number;
76
+ chosenCoupon: number | unknown[];
77
77
  }, {}>;
78
78
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
2
  import { defineComponent } from "vue";
3
- import { isDef, truthProp, makeArrayProp, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
3
+ import { isDef, truthProp, makeArrayProp, makeStringProp, createNamespace } from "../utils/index.mjs";
4
4
  import { Cell } from "../cell/index.mjs";
5
5
  const [name, bem, t] = createNamespace("coupon-cell");
6
6
  const couponCellProps = {
@@ -9,33 +9,56 @@ const couponCellProps = {
9
9
  editable: truthProp,
10
10
  coupons: makeArrayProp(),
11
11
  currency: makeStringProp("\xA5"),
12
- chosenCoupon: makeNumericProp(-1)
12
+ chosenCoupon: {
13
+ type: [Number, Array],
14
+ default: -1
15
+ }
13
16
  };
14
17
  function formatValue({
15
18
  coupons,
16
19
  chosenCoupon,
17
20
  currency
18
21
  }) {
19
- const coupon = coupons[+chosenCoupon];
20
- if (coupon) {
21
- let value = 0;
22
+ const getValue = (coupon) => {
23
+ let value2 = 0;
24
+ const {
25
+ value: couponValue,
26
+ denominations
27
+ } = coupon;
22
28
  if (isDef(coupon.value)) {
23
- ({
24
- value
25
- } = coupon);
29
+ value2 = couponValue;
26
30
  } else if (isDef(coupon.denominations)) {
27
- value = coupon.denominations;
31
+ value2 = denominations;
32
+ }
33
+ return value2;
34
+ };
35
+ let value = 0, isExist = false;
36
+ if (Array.isArray(chosenCoupon)) {
37
+ chosenCoupon.forEach((i) => {
38
+ const coupon = coupons[+i];
39
+ if (coupon) {
40
+ isExist = true;
41
+ value += getValue(coupon);
42
+ }
43
+ });
44
+ } else {
45
+ const coupon = coupons[+chosenCoupon];
46
+ if (coupon) {
47
+ isExist = true;
48
+ value = getValue(coupon);
28
49
  }
29
- return `-${currency} ${(value / 100).toFixed(2)}`;
30
50
  }
31
- return coupons.length === 0 ? t("noCoupon") : t("count", coupons.length);
51
+ if (!isExist) {
52
+ return coupons.length === 0 ? t("noCoupon") : t("count", coupons.length);
53
+ }
54
+ return `-${currency} ${(value / 100).toFixed(2)}`;
32
55
  }
33
56
  var stdin_default = defineComponent({
34
57
  name,
35
58
  props: couponCellProps,
36
59
  setup(props) {
37
60
  return () => {
38
- const selected = props.coupons[+props.chosenCoupon];
61
+ const selected = Array.isArray(props.chosenCoupon) ? props.chosenCoupon.length : props.coupons[+props.chosenCoupon];
39
62
  return _createVNode(Cell, {
40
63
  "class": bem(),
41
64
  "value": formatValue(props),
@@ -17,7 +17,7 @@ export declare const CouponCell: import("../utils").WithInstall<import("vue").De
17
17
  default: string;
18
18
  };
19
19
  chosenCoupon: {
20
- type: (NumberConstructor | StringConstructor)[];
20
+ type: (NumberConstructor | ArrayConstructor)[];
21
21
  default: number;
22
22
  };
23
23
  }, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -39,7 +39,7 @@ export declare const CouponCell: import("../utils").WithInstall<import("vue").De
39
39
  default: string;
40
40
  };
41
41
  chosenCoupon: {
42
- type: (NumberConstructor | StringConstructor)[];
42
+ type: (NumberConstructor | ArrayConstructor)[];
43
43
  default: number;
44
44
  };
45
45
  }>>, {
@@ -47,7 +47,7 @@ export declare const CouponCell: import("../utils").WithInstall<import("vue").De
47
47
  currency: string;
48
48
  editable: boolean;
49
49
  coupons: import("..").CouponInfo[];
50
- chosenCoupon: string | number;
50
+ chosenCoupon: number | unknown[];
51
51
  }, {}>>;
52
52
  export default CouponCell;
53
53
  export { couponCellProps } from './CouponCell';
@@ -18,10 +18,7 @@ export declare const couponListProps: {
18
18
  default: true;
19
19
  };
20
20
  emptyImage: StringConstructor;
21
- chosenCoupon: {
22
- type: NumberConstructor;
23
- default: number;
24
- };
21
+ chosenCoupon: (NumberConstructor | ArrayConstructor)[];
25
22
  enabledTitle: StringConstructor;
26
23
  disabledTitle: StringConstructor;
27
24
  disabledCoupons: {
@@ -69,10 +66,7 @@ declare const _default: import("vue").DefineComponent<{
69
66
  default: true;
70
67
  };
71
68
  emptyImage: StringConstructor;
72
- chosenCoupon: {
73
- type: NumberConstructor;
74
- default: number;
75
- };
69
+ chosenCoupon: (NumberConstructor | ArrayConstructor)[];
76
70
  enabledTitle: StringConstructor;
77
71
  disabledTitle: StringConstructor;
78
72
  disabledCoupons: {
@@ -118,10 +112,7 @@ declare const _default: import("vue").DefineComponent<{
118
112
  default: true;
119
113
  };
120
114
  emptyImage: StringConstructor;
121
- chosenCoupon: {
122
- type: NumberConstructor;
123
- default: number;
124
- };
115
+ chosenCoupon: (NumberConstructor | ArrayConstructor)[];
125
116
  enabledTitle: StringConstructor;
126
117
  disabledTitle: StringConstructor;
127
118
  disabledCoupons: {
@@ -157,7 +148,6 @@ declare const _default: import("vue").DefineComponent<{
157
148
  code: string;
158
149
  currency: string;
159
150
  coupons: CouponInfo[];
160
- chosenCoupon: number;
161
151
  showCount: boolean;
162
152
  disabledCoupons: CouponInfo[];
163
153
  showExchangeBar: boolean;
@@ -1,5 +1,5 @@
1
1
  import { withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode } from "vue";
2
- import { ref, watch, computed, nextTick, onMounted, defineComponent } from "vue";
2
+ import { ref, watch, computed, nextTick, onMounted, unref, defineComponent } from "vue";
3
3
  import { truthProp, windowHeight, makeArrayProp, makeStringProp, makeNumberProp, createNamespace } from "../utils/index.mjs";
4
4
  import { useRefs } from "../composables/use-refs.mjs";
5
5
  import { Tab } from "../tab/index.mjs";
@@ -16,7 +16,7 @@ const couponListProps = {
16
16
  currency: makeStringProp("\xA5"),
17
17
  showCount: truthProp,
18
18
  emptyImage: String,
19
- chosenCoupon: makeNumberProp(-1),
19
+ chosenCoupon: [Number, Array],
20
20
  enabledTitle: String,
21
21
  disabledTitle: String,
22
22
  disabledCoupons: makeArrayProp(),
@@ -100,6 +100,15 @@ var stdin_default = defineComponent({
100
100
  } = props;
101
101
  const count = props.showCount ? ` (${coupons.length})` : "";
102
102
  const title = (props.enabledTitle || t("enable")) + count;
103
+ const getChosenCoupon = (chosenCoupon = [], value = 0) => {
104
+ const unrefChosenCoupon = unref(chosenCoupon);
105
+ const index = unrefChosenCoupon.indexOf(value);
106
+ if (index === -1) {
107
+ return [...unrefChosenCoupon, value];
108
+ }
109
+ unrefChosenCoupon.splice(index, 1);
110
+ return [...unrefChosenCoupon];
111
+ };
103
112
  return _createVNode(Tab, {
104
113
  "title": title
105
114
  }, {
@@ -116,9 +125,9 @@ var stdin_default = defineComponent({
116
125
  "key": coupon.id,
117
126
  "ref": setCouponRefs(index),
118
127
  "coupon": coupon,
119
- "chosen": index === props.chosenCoupon,
128
+ "chosen": Array.isArray(props.chosenCoupon) ? props.chosenCoupon.includes(index) : index === props.chosenCoupon,
120
129
  "currency": props.currency,
121
- "onClick": () => emit("change", index)
130
+ "onClick": () => emit("change", Array.isArray(props.chosenCoupon) ? getChosenCoupon(props.chosenCoupon, index) : index)
122
131
  }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
123
132
  }
124
133
  });
@@ -171,13 +180,13 @@ var stdin_default = defineComponent({
171
180
  default: () => [renderCouponTab(), renderDisabledTab()]
172
181
  }), _createVNode("div", {
173
182
  "class": bem("bottom")
174
- }, [_withDirectives(_createVNode(Button, {
183
+ }, [slots["list-button"] ? slots["list-button"]() : _withDirectives(_createVNode(Button, {
175
184
  "round": true,
176
185
  "block": true,
177
186
  "type": "primary",
178
187
  "class": bem("close"),
179
188
  "text": props.closeButtonText || t("close"),
180
- "onClick": () => emit("change", -1)
189
+ "onClick": () => emit("change", Array.isArray(props.chosenCoupon) ? [] : -1)
181
190
  }, null), [[_vShow, props.showCloseButton]])])]);
182
191
  }
183
192
  });
@@ -16,10 +16,7 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
16
16
  default: true;
17
17
  };
18
18
  emptyImage: StringConstructor;
19
- chosenCoupon: {
20
- type: NumberConstructor;
21
- default: number;
22
- };
19
+ chosenCoupon: (NumberConstructor | ArrayConstructor)[];
23
20
  enabledTitle: StringConstructor;
24
21
  disabledTitle: StringConstructor;
25
22
  disabledCoupons: {
@@ -65,10 +62,7 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
65
62
  default: true;
66
63
  };
67
64
  emptyImage: StringConstructor;
68
- chosenCoupon: {
69
- type: NumberConstructor;
70
- default: number;
71
- };
65
+ chosenCoupon: (NumberConstructor | ArrayConstructor)[];
72
66
  enabledTitle: StringConstructor;
73
67
  disabledTitle: StringConstructor;
74
68
  disabledCoupons: {
@@ -104,7 +98,6 @@ export declare const CouponList: import("../utils").WithInstall<import("vue").De
104
98
  code: string;
105
99
  currency: string;
106
100
  coupons: import("..").CouponInfo[];
107
- chosenCoupon: number;
108
101
  showCount: boolean;
109
102
  disabledCoupons: import("..").CouponInfo[];
110
103
  showExchangeBar: boolean;
@@ -1,4 +1,4 @@
1
- import { type PropType, type ExtractPropTypes } from 'vue';
1
+ import { type ComponentPublicInstance, type PropType, type ExtractPropTypes } from 'vue';
2
2
  export type DatePickerColumnType = 'year' | 'month' | 'day';
3
3
  export declare const datePickerProps: {
4
4
  loading: BooleanConstructor;
@@ -50,7 +50,12 @@ export declare const datePickerProps: {
50
50
  validator: (val: unknown) => val is Date;
51
51
  };
52
52
  };
53
+ export type DatePickerExpose = {
54
+ confirm: () => void;
55
+ getSelectedDate: () => string[];
56
+ };
53
57
  export type DatePickerProps = ExtractPropTypes<typeof datePickerProps>;
58
+ export type DatePickerInstance = ComponentPublicInstance<DatePickerProps, DatePickerExpose>;
54
59
  declare const _default: import("vue").DefineComponent<{
55
60
  loading: BooleanConstructor;
56
61
  readonly: BooleanConstructor;
@@ -2,6 +2,7 @@ import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
2
  import { ref, watch, computed, defineComponent } from "vue";
3
3
  import { pick, extend, isDate, isSameValue, createNamespace } from "../utils/index.mjs";
4
4
  import { genOptions, sharedProps, getMonthEndDay, pickerInheritKeys, formatValueRange } from "./utils.mjs";
5
+ import { useExpose } from "../composables/use-expose.mjs";
5
6
  import { Picker } from "../picker/index.mjs";
6
7
  const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
7
8
  const [name] = createNamespace("date-picker");
@@ -31,6 +32,7 @@ var stdin_default = defineComponent({
31
32
  }) {
32
33
  const currentValues = ref(props.modelValue);
33
34
  const updatedByExternalSources = ref(false);
35
+ const pickerRef = ref();
34
36
  const genYearOptions = () => {
35
37
  const minYear = props.minDate.getFullYear();
36
38
  const maxYear = props.maxDate.getFullYear();
@@ -72,6 +74,11 @@ var stdin_default = defineComponent({
72
74
  const maxDate = isMaxYear(year) && isMaxMonth(month) ? props.maxDate.getDate() : getMonthEndDay(year, month);
73
75
  return genOptions(minDate, maxDate, "day", props.formatter, props.filter);
74
76
  };
77
+ const confirm = () => {
78
+ var _a;
79
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
80
+ };
81
+ const getSelectedDate = () => currentValues.value;
75
82
  const columns = computed(() => props.columnsType.map((type) => {
76
83
  switch (type) {
77
84
  case "year":
@@ -105,7 +112,12 @@ var stdin_default = defineComponent({
105
112
  const onChange = (...args) => emit("change", ...args);
106
113
  const onCancel = (...args) => emit("cancel", ...args);
107
114
  const onConfirm = (...args) => emit("confirm", ...args);
115
+ useExpose({
116
+ confirm,
117
+ getSelectedDate
118
+ });
108
119
  return () => _createVNode(Picker, _mergeProps({
120
+ "ref": pickerRef,
109
121
  "modelValue": currentValues.value,
110
122
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
111
123
  "columns": columns.value,
@@ -119,7 +119,7 @@ export declare const DatePicker: import("../utils").WithInstall<import("vue").De
119
119
  export default DatePicker;
120
120
  export { datePickerProps } from './DatePicker';
121
121
  export type { DatePickerProps };
122
- export type { DatePickerColumnType } from './DatePicker';
122
+ export type { DatePickerColumnType, DatePickerInstance } from './DatePicker';
123
123
  declare module 'vue' {
124
124
  interface GlobalComponents {
125
125
  VanDatePicker: typeof DatePicker;
@@ -144,7 +144,9 @@ var stdin_default = defineComponent({
144
144
  initialized = true;
145
145
  });
146
146
  });
147
- watch([windowWidth, windowHeight, () => props.gap, () => props.offset], updateState);
147
+ watch([windowWidth, windowHeight, () => props.gap, () => props.offset], updateState, {
148
+ deep: true
149
+ });
148
150
  const show = ref(true);
149
151
  onActivated(() => {
150
152
  show.value = true;
@@ -318,7 +318,9 @@ var stdin_default = defineComponent({
318
318
  default: () => [slots.image ? _createVNode("div", {
319
319
  "class": bem("image-wrap")
320
320
  }, [slots.image({
321
- src: props.src
321
+ src: props.src,
322
+ onLoad,
323
+ style: imageStyle.value
322
324
  })]) : _createVNode(Image, {
323
325
  "ref": imageRef,
324
326
  "src": props.src,
package/es/index.d.ts CHANGED
@@ -106,4 +106,4 @@ declare namespace _default {
106
106
  }
107
107
  export default _default;
108
108
  export function install(app: any): void;
109
- export const version: "4.8.7";
109
+ export const version: "4.8.9";
package/es/index.mjs CHANGED
@@ -99,7 +99,7 @@ import { Toast } from "./toast/index.mjs";
99
99
  import { TreeSelect } from "./tree-select/index.mjs";
100
100
  import { Uploader } from "./uploader/index.mjs";
101
101
  import { Watermark } from "./watermark/index.mjs";
102
- const version = "4.8.7";
102
+ const version = "4.8.9";
103
103
  function install(app) {
104
104
  const components = [
105
105
  ActionBar,
@@ -1,6 +1,6 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
- import { defineComponent, Comment } from "vue";
3
- import { pick, extend, makeArrayProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
2
+ import { defineComponent, Comment, Fragment } from "vue";
3
+ import { flat, pick, extend, makeArrayProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
4
4
  import { useChildren } from "@vant/use";
5
5
  import { useSyncPropRef } from "../composables/use-sync-prop-ref.mjs";
6
6
  import { Tab } from "../tab/index.mjs";
@@ -38,7 +38,15 @@ var stdin_default = defineComponent({
38
38
  const onCancel = () => emit("cancel");
39
39
  return () => {
40
40
  var _a, _b;
41
- const childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== Comment);
41
+ let childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== Comment).map((node) => {
42
+ if (node.type === Fragment) {
43
+ return node.children;
44
+ }
45
+ return node;
46
+ });
47
+ if (childNodes) {
48
+ childNodes = flat(childNodes);
49
+ }
42
50
  const confirmButtonText = showNextButton() ? props.nextStepText : props.confirmButtonText;
43
51
  return _createVNode("div", {
44
52
  "class": bem()
@@ -1,5 +1,5 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
- import { ref, watch, computed, onMounted, defineComponent } from "vue";
2
+ import { ref, watch, computed, onActivated, onMounted, defineComponent } from "vue";
3
3
  import { makeNumericProp, makeStringProp, createNamespace, windowWidth } from "../utils/index.mjs";
4
4
  import { useExpose } from "../composables/use-expose.mjs";
5
5
  const [name, bem] = createNamespace("text-ellipsis");
@@ -23,6 +23,7 @@ var stdin_default = defineComponent({
23
23
  const expanded = ref(false);
24
24
  const hasAction = ref(false);
25
25
  const root = ref();
26
+ let needRecalculate = false;
26
27
  const actionText = computed(() => expanded.value ? props.collapseText : props.expandText);
27
28
  const pxToNum = (value) => {
28
29
  if (!value)
@@ -30,26 +31,26 @@ var stdin_default = defineComponent({
30
31
  const match = value.match(/^\d*(\.\d*)?/);
31
32
  return match ? Number(match[0]) : 0;
32
33
  };
34
+ const cloneContainer = () => {
35
+ if (!root.value || !root.value.isConnected)
36
+ return;
37
+ const originStyle = window.getComputedStyle(root.value);
38
+ const container = document.createElement("div");
39
+ const styleNames = Array.prototype.slice.apply(originStyle);
40
+ styleNames.forEach((name2) => {
41
+ container.style.setProperty(name2, originStyle.getPropertyValue(name2));
42
+ });
43
+ container.style.position = "fixed";
44
+ container.style.zIndex = "-9999";
45
+ container.style.top = "-9999px";
46
+ container.style.height = "auto";
47
+ container.style.minHeight = "auto";
48
+ container.style.maxHeight = "auto";
49
+ container.innerText = props.content;
50
+ document.body.appendChild(container);
51
+ return container;
52
+ };
33
53
  const calcEllipsised = () => {
34
- const cloneContainer = () => {
35
- if (!root.value)
36
- return;
37
- const originStyle = window.getComputedStyle(root.value);
38
- const container2 = document.createElement("div");
39
- const styleNames = Array.prototype.slice.apply(originStyle);
40
- styleNames.forEach((name2) => {
41
- container2.style.setProperty(name2, originStyle.getPropertyValue(name2));
42
- });
43
- container2.style.position = "fixed";
44
- container2.style.zIndex = "-9999";
45
- container2.style.top = "-9999px";
46
- container2.style.height = "auto";
47
- container2.style.minHeight = "auto";
48
- container2.style.maxHeight = "auto";
49
- container2.innerText = props.content;
50
- document.body.appendChild(container2);
51
- return container2;
52
- };
53
54
  const calcEllipsisText = (container2, maxHeight2) => {
54
55
  const {
55
56
  content,
@@ -101,8 +102,10 @@ var stdin_default = defineComponent({
101
102
  return container2.innerText;
102
103
  };
103
104
  const container = cloneContainer();
104
- if (!container)
105
+ if (!container) {
106
+ needRecalculate = true;
105
107
  return;
108
+ }
106
109
  const {
107
110
  paddingBottom,
108
111
  paddingTop,
@@ -135,6 +138,12 @@ var stdin_default = defineComponent({
135
138
  }, [action]);
136
139
  };
137
140
  onMounted(calcEllipsised);
141
+ onActivated(() => {
142
+ if (needRecalculate) {
143
+ needRecalculate = false;
144
+ calcEllipsised();
145
+ }
146
+ });
138
147
  watch([windowWidth, () => [props.content, props.rows, props.position]], calcEllipsised);
139
148
  useExpose({
140
149
  toggle
@@ -1,4 +1,4 @@
1
- import { type ExtractPropTypes, type PropType } from 'vue';
1
+ import { type ExtractPropTypes, type PropType, type ComponentPublicInstance } from 'vue';
2
2
  export type TimePickerColumnType = 'hour' | 'minute' | 'second';
3
3
  export declare const timePickerProps: {
4
4
  loading: BooleanConstructor;
@@ -74,6 +74,11 @@ export declare const timePickerProps: {
74
74
  filter: PropType<(columnType: string, options: import("../picker").PickerOption[], values: string[]) => import("../picker").PickerOption[]>;
75
75
  };
76
76
  export type TimePickerProps = ExtractPropTypes<typeof timePickerProps>;
77
+ export type TimePickerExpose = {
78
+ confirm: () => void;
79
+ getSelectedTime: () => string[];
80
+ };
81
+ export type TimePickerInstance = ComponentPublicInstance<TimePickerProps, TimePickerExpose>;
77
82
  declare const _default: import("vue").DefineComponent<{
78
83
  loading: BooleanConstructor;
79
84
  readonly: BooleanConstructor;
@@ -1,7 +1,8 @@
1
1
  import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
2
  import { computed, defineComponent, ref, watch } from "vue";
3
3
  import { formatValueRange, genOptions, pickerInheritKeys, sharedProps } from "../date-picker/utils.mjs";
4
- import { createNamespace, extend, isSameValue, makeNumericProp, pick } from "../utils/index.mjs";
4
+ import { pick, extend, isSameValue, makeNumericProp, createNamespace } from "../utils/index.mjs";
5
+ import { useExpose } from "../composables/use-expose.mjs";
5
6
  import { Picker } from "../picker/index.mjs";
6
7
  const [name] = createNamespace("time-picker");
7
8
  const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
@@ -36,10 +37,16 @@ var stdin_default = defineComponent({
36
37
  slots
37
38
  }) {
38
39
  const currentValues = ref(props.modelValue);
40
+ const pickerRef = ref();
39
41
  const getValidTime = (time) => {
40
42
  const timeLimitArr = time.split(":");
41
43
  return fullColumns.map((col, i) => props.columnsType.includes(col) ? timeLimitArr[i] : "00");
42
44
  };
45
+ const confirm = () => {
46
+ var _a;
47
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
48
+ };
49
+ const getSelectedTime = () => currentValues.value;
43
50
  const columns = computed(() => {
44
51
  let {
45
52
  minHour,
@@ -112,7 +119,12 @@ var stdin_default = defineComponent({
112
119
  const onChange = (...args) => emit("change", ...args);
113
120
  const onCancel = (...args) => emit("cancel", ...args);
114
121
  const onConfirm = (...args) => emit("confirm", ...args);
122
+ useExpose({
123
+ confirm,
124
+ getSelectedTime
125
+ });
115
126
  return () => _createVNode(Picker, _mergeProps({
127
+ "ref": pickerRef,
116
128
  "modelValue": currentValues.value,
117
129
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
118
130
  "columns": columns.value,
@@ -169,7 +169,7 @@ export declare const TimePicker: import("../utils").WithInstall<import("vue").De
169
169
  export default TimePicker;
170
170
  export { timePickerProps } from './TimePicker';
171
171
  export type { TimePickerProps };
172
- export type { TimePickerColumnType } from './TimePicker';
172
+ export type { TimePickerColumnType, TimePickerInstance } from './TimePicker';
173
173
  declare module 'vue' {
174
174
  interface GlobalComponents {
175
175
  VanTimePicker: typeof TimePicker;
@@ -27,3 +27,4 @@ export type RequiredParams<T> = T extends (...args: infer P) => infer R ? (...ar
27
27
  export declare function pick<T, U extends keyof T>(obj: T, keys: ReadonlyArray<U>, ignoreUndefined?: boolean): Writeable<Pick<T, U>>;
28
28
  export declare const isSameValue: (newValue: unknown, oldValue: unknown) => boolean;
29
29
  export declare const toArray: <T>(item: T | T[]) => T[];
30
+ export declare const flat: <T>(arr: (T | T[])[]) => T[];
@@ -35,8 +35,10 @@ function pick(obj, keys, ignoreUndefined) {
35
35
  }
36
36
  const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
37
37
  const toArray = (item) => Array.isArray(item) ? item : [item];
38
+ const flat = (arr) => arr.reduce((acc, val) => acc.concat(val), []);
38
39
  export {
39
40
  extend,
41
+ flat,
40
42
  get,
41
43
  inBrowser,
42
44
  isDate,
@@ -59,7 +59,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
59
59
  }) {
60
60
  const renderItem = (item, index, disabled) => {
61
61
  const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
62
- const onClick = () => emit("clickItem", item, index);
62
+ const onClick = (event) => emit("clickItem", item, index, {
63
+ event
64
+ });
63
65
  const onSelect = () => {
64
66
  emit(disabled ? "selectDisabled" : "select", item, index);
65
67
  if (!disabled) {