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/lib/vant.cjs.js CHANGED
@@ -41,6 +41,7 @@ function pick(obj, keys, ignoreUndefined) {
41
41
  }
42
42
  const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
43
43
  const toArray = (item) => Array.isArray(item) ? item : [item];
44
+ const flat = (arr) => arr.reduce((acc, val) => acc.concat(val), []);
44
45
  const unknownProp = null;
45
46
  const numericProp = [Number, String];
46
47
  const truthProp = {
@@ -3298,7 +3299,15 @@ var stdin_default$1A = vue.defineComponent({
3298
3299
  const onCancel = () => emit("cancel");
3299
3300
  return () => {
3300
3301
  var _a, _b;
3301
- const childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== vue.Comment);
3302
+ let childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== vue.Comment).map((node) => {
3303
+ if (node.type === vue.Fragment) {
3304
+ return node.children;
3305
+ }
3306
+ return node;
3307
+ });
3308
+ if (childNodes) {
3309
+ childNodes = flat(childNodes);
3310
+ }
3302
3311
  const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
3303
3312
  return vue.createVNode("div", {
3304
3313
  "class": bem$1l()
@@ -5577,11 +5586,11 @@ var stdin_default$1m = vue.defineComponent({
5577
5586
  slots,
5578
5587
  emit
5579
5588
  }) {
5580
- const onClick = () => {
5589
+ const onClick = (event) => {
5581
5590
  if (props2.switchable) {
5582
5591
  emit("select");
5583
5592
  }
5584
- emit("click");
5593
+ emit("click", event);
5585
5594
  };
5586
5595
  const renderRightIcon = () => vue.createVNode(Icon, {
5587
5596
  "name": props2.rightIcon,
@@ -5589,7 +5598,7 @@ var stdin_default$1m = vue.defineComponent({
5589
5598
  "onClick": (event) => {
5590
5599
  event.stopPropagation();
5591
5600
  emit("edit");
5592
- emit("click");
5601
+ emit("click", event);
5593
5602
  }
5594
5603
  }, null);
5595
5604
  const renderTag = () => {
@@ -5671,7 +5680,9 @@ var stdin_default$1l = vue.defineComponent({
5671
5680
  }) {
5672
5681
  const renderItem = (item, index, disabled) => {
5673
5682
  const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
5674
- const onClick = () => emit("clickItem", item, index);
5683
+ const onClick = (event) => emit("clickItem", item, index, {
5684
+ event
5685
+ });
5675
5686
  const onSelect = () => {
5676
5687
  emit(disabled ? "selectDisabled" : "select", item, index);
5677
5688
  if (!disabled) {
@@ -8621,33 +8632,56 @@ const couponCellProps = {
8621
8632
  editable: truthProp,
8622
8633
  coupons: makeArrayProp(),
8623
8634
  currency: makeStringProp("¥"),
8624
- chosenCoupon: makeNumericProp(-1)
8635
+ chosenCoupon: {
8636
+ type: [Number, Array],
8637
+ default: -1
8638
+ }
8625
8639
  };
8626
8640
  function formatValue({
8627
8641
  coupons,
8628
8642
  chosenCoupon,
8629
8643
  currency
8630
8644
  }) {
8631
- const coupon = coupons[+chosenCoupon];
8632
- if (coupon) {
8633
- let value = 0;
8645
+ const getValue = (coupon) => {
8646
+ let value2 = 0;
8647
+ const {
8648
+ value: couponValue,
8649
+ denominations
8650
+ } = coupon;
8634
8651
  if (isDef(coupon.value)) {
8635
- ({
8636
- value
8637
- } = coupon);
8652
+ value2 = couponValue;
8638
8653
  } else if (isDef(coupon.denominations)) {
8639
- value = coupon.denominations;
8654
+ value2 = denominations;
8640
8655
  }
8641
- return `-${currency} ${(value / 100).toFixed(2)}`;
8656
+ return value2;
8657
+ };
8658
+ let value = 0, isExist = false;
8659
+ if (Array.isArray(chosenCoupon)) {
8660
+ chosenCoupon.forEach((i) => {
8661
+ const coupon = coupons[+i];
8662
+ if (coupon) {
8663
+ isExist = true;
8664
+ value += getValue(coupon);
8665
+ }
8666
+ });
8667
+ } else {
8668
+ const coupon = coupons[+chosenCoupon];
8669
+ if (coupon) {
8670
+ isExist = true;
8671
+ value = getValue(coupon);
8672
+ }
8673
+ }
8674
+ if (!isExist) {
8675
+ return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
8642
8676
  }
8643
- return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
8677
+ return `-${currency} ${(value / 100).toFixed(2)}`;
8644
8678
  }
8645
8679
  var stdin_default$_ = vue.defineComponent({
8646
8680
  name: name$R,
8647
8681
  props: couponCellProps,
8648
8682
  setup(props2) {
8649
8683
  return () => {
8650
- const selected = props2.coupons[+props2.chosenCoupon];
8684
+ const selected = Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.length : props2.coupons[+props2.chosenCoupon];
8651
8685
  return vue.createVNode(Cell, {
8652
8686
  "class": bem$Q(),
8653
8687
  "value": formatValue(props2),
@@ -8985,7 +9019,7 @@ const couponListProps = {
8985
9019
  currency: makeStringProp("¥"),
8986
9020
  showCount: truthProp,
8987
9021
  emptyImage: String,
8988
- chosenCoupon: makeNumberProp(-1),
9022
+ chosenCoupon: [Number, Array],
8989
9023
  enabledTitle: String,
8990
9024
  disabledTitle: String,
8991
9025
  disabledCoupons: makeArrayProp(),
@@ -9069,6 +9103,15 @@ var stdin_default$Y = vue.defineComponent({
9069
9103
  } = props2;
9070
9104
  const count = props2.showCount ? ` (${coupons.length})` : "";
9071
9105
  const title = (props2.enabledTitle || t$9("enable")) + count;
9106
+ const getChosenCoupon = (chosenCoupon = [], value = 0) => {
9107
+ const unrefChosenCoupon = vue.unref(chosenCoupon);
9108
+ const index = unrefChosenCoupon.indexOf(value);
9109
+ if (index === -1) {
9110
+ return [...unrefChosenCoupon, value];
9111
+ }
9112
+ unrefChosenCoupon.splice(index, 1);
9113
+ return [...unrefChosenCoupon];
9114
+ };
9072
9115
  return vue.createVNode(Tab, {
9073
9116
  "title": title
9074
9117
  }, {
@@ -9085,9 +9128,9 @@ var stdin_default$Y = vue.defineComponent({
9085
9128
  "key": coupon.id,
9086
9129
  "ref": setCouponRefs(index),
9087
9130
  "coupon": coupon,
9088
- "chosen": index === props2.chosenCoupon,
9131
+ "chosen": Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.includes(index) : index === props2.chosenCoupon,
9089
9132
  "currency": props2.currency,
9090
- "onClick": () => emit("change", index)
9133
+ "onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? getChosenCoupon(props2.chosenCoupon, index) : index)
9091
9134
  }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
9092
9135
  }
9093
9136
  });
@@ -9140,13 +9183,13 @@ var stdin_default$Y = vue.defineComponent({
9140
9183
  default: () => [renderCouponTab(), renderDisabledTab()]
9141
9184
  }), vue.createVNode("div", {
9142
9185
  "class": bem$O("bottom")
9143
- }, [vue.withDirectives(vue.createVNode(Button, {
9186
+ }, [slots["list-button"] ? slots["list-button"]() : vue.withDirectives(vue.createVNode(Button, {
9144
9187
  "round": true,
9145
9188
  "block": true,
9146
9189
  "type": "primary",
9147
9190
  "class": bem$O("close"),
9148
9191
  "text": props2.closeButtonText || t$9("close"),
9149
- "onClick": () => emit("change", -1)
9192
+ "onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? [] : -1)
9150
9193
  }, null), [[vue.vShow, props2.showCloseButton]])])]);
9151
9194
  }
9152
9195
  });
@@ -9179,6 +9222,7 @@ var stdin_default$X = vue.defineComponent({
9179
9222
  }) {
9180
9223
  const currentValues = vue.ref(props2.modelValue);
9181
9224
  const updatedByExternalSources = vue.ref(false);
9225
+ const pickerRef = vue.ref();
9182
9226
  const genYearOptions = () => {
9183
9227
  const minYear = props2.minDate.getFullYear();
9184
9228
  const maxYear = props2.maxDate.getFullYear();
@@ -9220,6 +9264,11 @@ var stdin_default$X = vue.defineComponent({
9220
9264
  const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
9221
9265
  return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter);
9222
9266
  };
9267
+ const confirm = () => {
9268
+ var _a;
9269
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
9270
+ };
9271
+ const getSelectedDate = () => currentValues.value;
9223
9272
  const columns = vue.computed(() => props2.columnsType.map((type) => {
9224
9273
  switch (type) {
9225
9274
  case "year":
@@ -9253,7 +9302,12 @@ var stdin_default$X = vue.defineComponent({
9253
9302
  const onChange = (...args) => emit("change", ...args);
9254
9303
  const onCancel = (...args) => emit("cancel", ...args);
9255
9304
  const onConfirm = (...args) => emit("confirm", ...args);
9305
+ useExpose({
9306
+ confirm,
9307
+ getSelectedDate
9308
+ });
9256
9309
  return () => vue.createVNode(Picker, vue.mergeProps({
9310
+ "ref": pickerRef,
9257
9311
  "modelValue": currentValues.value,
9258
9312
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
9259
9313
  "columns": columns.value,
@@ -10034,7 +10088,9 @@ var stdin_default$S = vue.defineComponent({
10034
10088
  initialized = true;
10035
10089
  });
10036
10090
  });
10037
- vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState);
10091
+ vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState, {
10092
+ deep: true
10093
+ });
10038
10094
  const show = vue.ref(true);
10039
10095
  vue.onActivated(() => {
10040
10096
  show.value = true;
@@ -10787,7 +10843,9 @@ var stdin_default$N = vue.defineComponent({
10787
10843
  default: () => [slots.image ? vue.createVNode("div", {
10788
10844
  "class": bem$E("image-wrap")
10789
10845
  }, [slots.image({
10790
- src: props2.src
10846
+ src: props2.src,
10847
+ onLoad,
10848
+ style: imageStyle.value
10791
10849
  })]) : vue.createVNode(Image$1, {
10792
10850
  "ref": imageRef,
10793
10851
  "src": props2.src,
@@ -15013,6 +15071,7 @@ var stdin_default$9 = vue.defineComponent({
15013
15071
  const expanded = vue.ref(false);
15014
15072
  const hasAction = vue.ref(false);
15015
15073
  const root = vue.ref();
15074
+ let needRecalculate = false;
15016
15075
  const actionText = vue.computed(() => expanded.value ? props2.collapseText : props2.expandText);
15017
15076
  const pxToNum = (value) => {
15018
15077
  if (!value)
@@ -15020,26 +15079,26 @@ var stdin_default$9 = vue.defineComponent({
15020
15079
  const match = value.match(/^\d*(\.\d*)?/);
15021
15080
  return match ? Number(match[0]) : 0;
15022
15081
  };
15082
+ const cloneContainer = () => {
15083
+ if (!root.value || !root.value.isConnected)
15084
+ return;
15085
+ const originStyle = window.getComputedStyle(root.value);
15086
+ const container = document.createElement("div");
15087
+ const styleNames = Array.prototype.slice.apply(originStyle);
15088
+ styleNames.forEach((name2) => {
15089
+ container.style.setProperty(name2, originStyle.getPropertyValue(name2));
15090
+ });
15091
+ container.style.position = "fixed";
15092
+ container.style.zIndex = "-9999";
15093
+ container.style.top = "-9999px";
15094
+ container.style.height = "auto";
15095
+ container.style.minHeight = "auto";
15096
+ container.style.maxHeight = "auto";
15097
+ container.innerText = props2.content;
15098
+ document.body.appendChild(container);
15099
+ return container;
15100
+ };
15023
15101
  const calcEllipsised = () => {
15024
- const cloneContainer = () => {
15025
- if (!root.value)
15026
- return;
15027
- const originStyle = window.getComputedStyle(root.value);
15028
- const container2 = document.createElement("div");
15029
- const styleNames = Array.prototype.slice.apply(originStyle);
15030
- styleNames.forEach((name2) => {
15031
- container2.style.setProperty(name2, originStyle.getPropertyValue(name2));
15032
- });
15033
- container2.style.position = "fixed";
15034
- container2.style.zIndex = "-9999";
15035
- container2.style.top = "-9999px";
15036
- container2.style.height = "auto";
15037
- container2.style.minHeight = "auto";
15038
- container2.style.maxHeight = "auto";
15039
- container2.innerText = props2.content;
15040
- document.body.appendChild(container2);
15041
- return container2;
15042
- };
15043
15102
  const calcEllipsisText = (container2, maxHeight2) => {
15044
15103
  const {
15045
15104
  content,
@@ -15091,8 +15150,10 @@ var stdin_default$9 = vue.defineComponent({
15091
15150
  return container2.innerText;
15092
15151
  };
15093
15152
  const container = cloneContainer();
15094
- if (!container)
15153
+ if (!container) {
15154
+ needRecalculate = true;
15095
15155
  return;
15156
+ }
15096
15157
  const {
15097
15158
  paddingBottom,
15098
15159
  paddingTop,
@@ -15125,6 +15186,12 @@ var stdin_default$9 = vue.defineComponent({
15125
15186
  }, [action]);
15126
15187
  };
15127
15188
  vue.onMounted(calcEllipsised);
15189
+ vue.onActivated(() => {
15190
+ if (needRecalculate) {
15191
+ needRecalculate = false;
15192
+ calcEllipsised();
15193
+ }
15194
+ });
15128
15195
  vue.watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
15129
15196
  useExpose({
15130
15197
  toggle
@@ -15169,10 +15236,16 @@ var stdin_default$8 = vue.defineComponent({
15169
15236
  slots
15170
15237
  }) {
15171
15238
  const currentValues = vue.ref(props2.modelValue);
15239
+ const pickerRef = vue.ref();
15172
15240
  const getValidTime = (time) => {
15173
15241
  const timeLimitArr = time.split(":");
15174
15242
  return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
15175
15243
  };
15244
+ const confirm = () => {
15245
+ var _a;
15246
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
15247
+ };
15248
+ const getSelectedTime = () => currentValues.value;
15176
15249
  const columns = vue.computed(() => {
15177
15250
  let {
15178
15251
  minHour,
@@ -15245,7 +15318,12 @@ var stdin_default$8 = vue.defineComponent({
15245
15318
  const onChange = (...args) => emit("change", ...args);
15246
15319
  const onCancel = (...args) => emit("cancel", ...args);
15247
15320
  const onConfirm = (...args) => emit("confirm", ...args);
15321
+ useExpose({
15322
+ confirm,
15323
+ getSelectedTime
15324
+ });
15248
15325
  return () => vue.createVNode(Picker, vue.mergeProps({
15326
+ "ref": pickerRef,
15249
15327
  "modelValue": currentValues.value,
15250
15328
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
15251
15329
  "columns": columns.value,
@@ -16795,7 +16873,7 @@ const Lazyload = {
16795
16873
  });
16796
16874
  }
16797
16875
  };
16798
- const version = "4.8.7";
16876
+ const version = "4.8.9";
16799
16877
  function install(app) {
16800
16878
  const components = [
16801
16879
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -39,6 +39,7 @@ function pick(obj, keys, ignoreUndefined) {
39
39
  }
40
40
  const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
41
41
  const toArray = (item) => Array.isArray(item) ? item : [item];
42
+ const flat = (arr) => arr.reduce((acc, val) => acc.concat(val), []);
42
43
  const unknownProp = null;
43
44
  const numericProp = [Number, String];
44
45
  const truthProp = {
@@ -3296,7 +3297,15 @@ var stdin_default$1A = defineComponent({
3296
3297
  const onCancel = () => emit("cancel");
3297
3298
  return () => {
3298
3299
  var _a, _b;
3299
- const childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== Comment);
3300
+ let childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== Comment).map((node) => {
3301
+ if (node.type === Fragment) {
3302
+ return node.children;
3303
+ }
3304
+ return node;
3305
+ });
3306
+ if (childNodes) {
3307
+ childNodes = flat(childNodes);
3308
+ }
3300
3309
  const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
3301
3310
  return createVNode("div", {
3302
3311
  "class": bem$1l()
@@ -5575,11 +5584,11 @@ var stdin_default$1m = defineComponent({
5575
5584
  slots,
5576
5585
  emit
5577
5586
  }) {
5578
- const onClick = () => {
5587
+ const onClick = (event) => {
5579
5588
  if (props2.switchable) {
5580
5589
  emit("select");
5581
5590
  }
5582
- emit("click");
5591
+ emit("click", event);
5583
5592
  };
5584
5593
  const renderRightIcon = () => createVNode(Icon, {
5585
5594
  "name": props2.rightIcon,
@@ -5587,7 +5596,7 @@ var stdin_default$1m = defineComponent({
5587
5596
  "onClick": (event) => {
5588
5597
  event.stopPropagation();
5589
5598
  emit("edit");
5590
- emit("click");
5599
+ emit("click", event);
5591
5600
  }
5592
5601
  }, null);
5593
5602
  const renderTag = () => {
@@ -5669,7 +5678,9 @@ var stdin_default$1l = defineComponent({
5669
5678
  }) {
5670
5679
  const renderItem = (item, index, disabled) => {
5671
5680
  const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
5672
- const onClick = () => emit("clickItem", item, index);
5681
+ const onClick = (event) => emit("clickItem", item, index, {
5682
+ event
5683
+ });
5673
5684
  const onSelect = () => {
5674
5685
  emit(disabled ? "selectDisabled" : "select", item, index);
5675
5686
  if (!disabled) {
@@ -8619,33 +8630,56 @@ const couponCellProps = {
8619
8630
  editable: truthProp,
8620
8631
  coupons: makeArrayProp(),
8621
8632
  currency: makeStringProp("¥"),
8622
- chosenCoupon: makeNumericProp(-1)
8633
+ chosenCoupon: {
8634
+ type: [Number, Array],
8635
+ default: -1
8636
+ }
8623
8637
  };
8624
8638
  function formatValue({
8625
8639
  coupons,
8626
8640
  chosenCoupon,
8627
8641
  currency
8628
8642
  }) {
8629
- const coupon = coupons[+chosenCoupon];
8630
- if (coupon) {
8631
- let value = 0;
8643
+ const getValue = (coupon) => {
8644
+ let value2 = 0;
8645
+ const {
8646
+ value: couponValue,
8647
+ denominations
8648
+ } = coupon;
8632
8649
  if (isDef(coupon.value)) {
8633
- ({
8634
- value
8635
- } = coupon);
8650
+ value2 = couponValue;
8636
8651
  } else if (isDef(coupon.denominations)) {
8637
- value = coupon.denominations;
8652
+ value2 = denominations;
8638
8653
  }
8639
- return `-${currency} ${(value / 100).toFixed(2)}`;
8654
+ return value2;
8655
+ };
8656
+ let value = 0, isExist = false;
8657
+ if (Array.isArray(chosenCoupon)) {
8658
+ chosenCoupon.forEach((i) => {
8659
+ const coupon = coupons[+i];
8660
+ if (coupon) {
8661
+ isExist = true;
8662
+ value += getValue(coupon);
8663
+ }
8664
+ });
8665
+ } else {
8666
+ const coupon = coupons[+chosenCoupon];
8667
+ if (coupon) {
8668
+ isExist = true;
8669
+ value = getValue(coupon);
8670
+ }
8671
+ }
8672
+ if (!isExist) {
8673
+ return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
8640
8674
  }
8641
- return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
8675
+ return `-${currency} ${(value / 100).toFixed(2)}`;
8642
8676
  }
8643
8677
  var stdin_default$_ = defineComponent({
8644
8678
  name: name$R,
8645
8679
  props: couponCellProps,
8646
8680
  setup(props2) {
8647
8681
  return () => {
8648
- const selected = props2.coupons[+props2.chosenCoupon];
8682
+ const selected = Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.length : props2.coupons[+props2.chosenCoupon];
8649
8683
  return createVNode(Cell, {
8650
8684
  "class": bem$Q(),
8651
8685
  "value": formatValue(props2),
@@ -8983,7 +9017,7 @@ const couponListProps = {
8983
9017
  currency: makeStringProp("¥"),
8984
9018
  showCount: truthProp,
8985
9019
  emptyImage: String,
8986
- chosenCoupon: makeNumberProp(-1),
9020
+ chosenCoupon: [Number, Array],
8987
9021
  enabledTitle: String,
8988
9022
  disabledTitle: String,
8989
9023
  disabledCoupons: makeArrayProp(),
@@ -9067,6 +9101,15 @@ var stdin_default$Y = defineComponent({
9067
9101
  } = props2;
9068
9102
  const count = props2.showCount ? ` (${coupons.length})` : "";
9069
9103
  const title = (props2.enabledTitle || t$9("enable")) + count;
9104
+ const getChosenCoupon = (chosenCoupon = [], value = 0) => {
9105
+ const unrefChosenCoupon = unref(chosenCoupon);
9106
+ const index = unrefChosenCoupon.indexOf(value);
9107
+ if (index === -1) {
9108
+ return [...unrefChosenCoupon, value];
9109
+ }
9110
+ unrefChosenCoupon.splice(index, 1);
9111
+ return [...unrefChosenCoupon];
9112
+ };
9070
9113
  return createVNode(Tab, {
9071
9114
  "title": title
9072
9115
  }, {
@@ -9083,9 +9126,9 @@ var stdin_default$Y = defineComponent({
9083
9126
  "key": coupon.id,
9084
9127
  "ref": setCouponRefs(index),
9085
9128
  "coupon": coupon,
9086
- "chosen": index === props2.chosenCoupon,
9129
+ "chosen": Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.includes(index) : index === props2.chosenCoupon,
9087
9130
  "currency": props2.currency,
9088
- "onClick": () => emit("change", index)
9131
+ "onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? getChosenCoupon(props2.chosenCoupon, index) : index)
9089
9132
  }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
9090
9133
  }
9091
9134
  });
@@ -9138,13 +9181,13 @@ var stdin_default$Y = defineComponent({
9138
9181
  default: () => [renderCouponTab(), renderDisabledTab()]
9139
9182
  }), createVNode("div", {
9140
9183
  "class": bem$O("bottom")
9141
- }, [withDirectives(createVNode(Button, {
9184
+ }, [slots["list-button"] ? slots["list-button"]() : withDirectives(createVNode(Button, {
9142
9185
  "round": true,
9143
9186
  "block": true,
9144
9187
  "type": "primary",
9145
9188
  "class": bem$O("close"),
9146
9189
  "text": props2.closeButtonText || t$9("close"),
9147
- "onClick": () => emit("change", -1)
9190
+ "onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? [] : -1)
9148
9191
  }, null), [[vShow, props2.showCloseButton]])])]);
9149
9192
  }
9150
9193
  });
@@ -9177,6 +9220,7 @@ var stdin_default$X = defineComponent({
9177
9220
  }) {
9178
9221
  const currentValues = ref(props2.modelValue);
9179
9222
  const updatedByExternalSources = ref(false);
9223
+ const pickerRef = ref();
9180
9224
  const genYearOptions = () => {
9181
9225
  const minYear = props2.minDate.getFullYear();
9182
9226
  const maxYear = props2.maxDate.getFullYear();
@@ -9218,6 +9262,11 @@ var stdin_default$X = defineComponent({
9218
9262
  const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
9219
9263
  return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter);
9220
9264
  };
9265
+ const confirm = () => {
9266
+ var _a;
9267
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
9268
+ };
9269
+ const getSelectedDate = () => currentValues.value;
9221
9270
  const columns = computed(() => props2.columnsType.map((type) => {
9222
9271
  switch (type) {
9223
9272
  case "year":
@@ -9251,7 +9300,12 @@ var stdin_default$X = defineComponent({
9251
9300
  const onChange = (...args) => emit("change", ...args);
9252
9301
  const onCancel = (...args) => emit("cancel", ...args);
9253
9302
  const onConfirm = (...args) => emit("confirm", ...args);
9303
+ useExpose({
9304
+ confirm,
9305
+ getSelectedDate
9306
+ });
9254
9307
  return () => createVNode(Picker, mergeProps({
9308
+ "ref": pickerRef,
9255
9309
  "modelValue": currentValues.value,
9256
9310
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
9257
9311
  "columns": columns.value,
@@ -10032,7 +10086,9 @@ var stdin_default$S = defineComponent({
10032
10086
  initialized = true;
10033
10087
  });
10034
10088
  });
10035
- watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState);
10089
+ watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState, {
10090
+ deep: true
10091
+ });
10036
10092
  const show = ref(true);
10037
10093
  onActivated(() => {
10038
10094
  show.value = true;
@@ -10785,7 +10841,9 @@ var stdin_default$N = defineComponent({
10785
10841
  default: () => [slots.image ? createVNode("div", {
10786
10842
  "class": bem$E("image-wrap")
10787
10843
  }, [slots.image({
10788
- src: props2.src
10844
+ src: props2.src,
10845
+ onLoad,
10846
+ style: imageStyle.value
10789
10847
  })]) : createVNode(Image$1, {
10790
10848
  "ref": imageRef,
10791
10849
  "src": props2.src,
@@ -15011,6 +15069,7 @@ var stdin_default$9 = defineComponent({
15011
15069
  const expanded = ref(false);
15012
15070
  const hasAction = ref(false);
15013
15071
  const root = ref();
15072
+ let needRecalculate = false;
15014
15073
  const actionText = computed(() => expanded.value ? props2.collapseText : props2.expandText);
15015
15074
  const pxToNum = (value) => {
15016
15075
  if (!value)
@@ -15018,26 +15077,26 @@ var stdin_default$9 = defineComponent({
15018
15077
  const match = value.match(/^\d*(\.\d*)?/);
15019
15078
  return match ? Number(match[0]) : 0;
15020
15079
  };
15080
+ const cloneContainer = () => {
15081
+ if (!root.value || !root.value.isConnected)
15082
+ return;
15083
+ const originStyle = window.getComputedStyle(root.value);
15084
+ const container = document.createElement("div");
15085
+ const styleNames = Array.prototype.slice.apply(originStyle);
15086
+ styleNames.forEach((name2) => {
15087
+ container.style.setProperty(name2, originStyle.getPropertyValue(name2));
15088
+ });
15089
+ container.style.position = "fixed";
15090
+ container.style.zIndex = "-9999";
15091
+ container.style.top = "-9999px";
15092
+ container.style.height = "auto";
15093
+ container.style.minHeight = "auto";
15094
+ container.style.maxHeight = "auto";
15095
+ container.innerText = props2.content;
15096
+ document.body.appendChild(container);
15097
+ return container;
15098
+ };
15021
15099
  const calcEllipsised = () => {
15022
- const cloneContainer = () => {
15023
- if (!root.value)
15024
- return;
15025
- const originStyle = window.getComputedStyle(root.value);
15026
- const container2 = document.createElement("div");
15027
- const styleNames = Array.prototype.slice.apply(originStyle);
15028
- styleNames.forEach((name2) => {
15029
- container2.style.setProperty(name2, originStyle.getPropertyValue(name2));
15030
- });
15031
- container2.style.position = "fixed";
15032
- container2.style.zIndex = "-9999";
15033
- container2.style.top = "-9999px";
15034
- container2.style.height = "auto";
15035
- container2.style.minHeight = "auto";
15036
- container2.style.maxHeight = "auto";
15037
- container2.innerText = props2.content;
15038
- document.body.appendChild(container2);
15039
- return container2;
15040
- };
15041
15100
  const calcEllipsisText = (container2, maxHeight2) => {
15042
15101
  const {
15043
15102
  content,
@@ -15089,8 +15148,10 @@ var stdin_default$9 = defineComponent({
15089
15148
  return container2.innerText;
15090
15149
  };
15091
15150
  const container = cloneContainer();
15092
- if (!container)
15151
+ if (!container) {
15152
+ needRecalculate = true;
15093
15153
  return;
15154
+ }
15094
15155
  const {
15095
15156
  paddingBottom,
15096
15157
  paddingTop,
@@ -15123,6 +15184,12 @@ var stdin_default$9 = defineComponent({
15123
15184
  }, [action]);
15124
15185
  };
15125
15186
  onMounted(calcEllipsised);
15187
+ onActivated(() => {
15188
+ if (needRecalculate) {
15189
+ needRecalculate = false;
15190
+ calcEllipsised();
15191
+ }
15192
+ });
15126
15193
  watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
15127
15194
  useExpose({
15128
15195
  toggle
@@ -15167,10 +15234,16 @@ var stdin_default$8 = defineComponent({
15167
15234
  slots
15168
15235
  }) {
15169
15236
  const currentValues = ref(props2.modelValue);
15237
+ const pickerRef = ref();
15170
15238
  const getValidTime = (time) => {
15171
15239
  const timeLimitArr = time.split(":");
15172
15240
  return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
15173
15241
  };
15242
+ const confirm = () => {
15243
+ var _a;
15244
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
15245
+ };
15246
+ const getSelectedTime = () => currentValues.value;
15174
15247
  const columns = computed(() => {
15175
15248
  let {
15176
15249
  minHour,
@@ -15243,7 +15316,12 @@ var stdin_default$8 = defineComponent({
15243
15316
  const onChange = (...args) => emit("change", ...args);
15244
15317
  const onCancel = (...args) => emit("cancel", ...args);
15245
15318
  const onConfirm = (...args) => emit("confirm", ...args);
15319
+ useExpose({
15320
+ confirm,
15321
+ getSelectedTime
15322
+ });
15246
15323
  return () => createVNode(Picker, mergeProps({
15324
+ "ref": pickerRef,
15247
15325
  "modelValue": currentValues.value,
15248
15326
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
15249
15327
  "columns": columns.value,
@@ -16793,7 +16871,7 @@ const Lazyload = {
16793
16871
  });
16794
16872
  }
16795
16873
  };
16796
- const version = "4.8.7";
16874
+ const version = "4.8.9";
16797
16875
  function install(app) {
16798
16876
  const components = [
16799
16877
  ActionBar,