vant 4.8.8 → 4.8.10

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.
package/lib/vant.cjs.js CHANGED
@@ -8632,23 +8632,39 @@ const couponCellProps = {
8632
8632
  editable: truthProp,
8633
8633
  coupons: makeArrayProp(),
8634
8634
  currency: makeStringProp("¥"),
8635
- chosenCoupon: makeNumericProp(-1)
8635
+ chosenCoupon: {
8636
+ type: [Number, Array],
8637
+ default: -1
8638
+ }
8639
+ };
8640
+ const getValue = (coupon) => {
8641
+ const {
8642
+ value,
8643
+ denominations
8644
+ } = coupon;
8645
+ if (isDef(value)) {
8646
+ return value;
8647
+ }
8648
+ if (isDef(denominations)) {
8649
+ return denominations;
8650
+ }
8651
+ return 0;
8636
8652
  };
8637
8653
  function formatValue({
8638
8654
  coupons,
8639
8655
  chosenCoupon,
8640
8656
  currency
8641
8657
  }) {
8642
- const coupon = coupons[+chosenCoupon];
8643
- if (coupon) {
8644
- let value = 0;
8645
- if (isDef(coupon.value)) {
8646
- ({
8647
- value
8648
- } = coupon);
8649
- } else if (isDef(coupon.denominations)) {
8650
- value = coupon.denominations;
8658
+ let value = 0;
8659
+ let isExist = false;
8660
+ (Array.isArray(chosenCoupon) ? chosenCoupon : [chosenCoupon]).forEach((i) => {
8661
+ const coupon = coupons[+i];
8662
+ if (coupon) {
8663
+ isExist = true;
8664
+ value += getValue(coupon);
8651
8665
  }
8666
+ });
8667
+ if (isExist) {
8652
8668
  return `-${currency} ${(value / 100).toFixed(2)}`;
8653
8669
  }
8654
8670
  return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
@@ -8658,7 +8674,7 @@ var stdin_default$_ = vue.defineComponent({
8658
8674
  props: couponCellProps,
8659
8675
  setup(props2) {
8660
8676
  return () => {
8661
- const selected = props2.coupons[+props2.chosenCoupon];
8677
+ const selected = Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.length : props2.coupons[+props2.chosenCoupon];
8662
8678
  return vue.createVNode(Cell, {
8663
8679
  "class": bem$Q(),
8664
8680
  "value": formatValue(props2),
@@ -8996,7 +9012,6 @@ const couponListProps = {
8996
9012
  currency: makeStringProp("¥"),
8997
9013
  showCount: truthProp,
8998
9014
  emptyImage: String,
8999
- chosenCoupon: makeNumberProp(-1),
9000
9015
  enabledTitle: String,
9001
9016
  disabledTitle: String,
9002
9017
  disabledCoupons: makeArrayProp(),
@@ -9008,7 +9023,11 @@ const couponListProps = {
9008
9023
  exchangeButtonText: String,
9009
9024
  displayedCouponIndex: makeNumberProp(-1),
9010
9025
  exchangeButtonLoading: Boolean,
9011
- exchangeButtonDisabled: Boolean
9026
+ exchangeButtonDisabled: Boolean,
9027
+ chosenCoupon: {
9028
+ type: [Number, Array],
9029
+ default: -1
9030
+ }
9012
9031
  };
9013
9032
  var stdin_default$Y = vue.defineComponent({
9014
9033
  name: name$P,
@@ -9076,10 +9095,17 @@ var stdin_default$Y = vue.defineComponent({
9076
9095
  };
9077
9096
  const renderCouponTab = () => {
9078
9097
  const {
9079
- coupons
9098
+ coupons,
9099
+ chosenCoupon
9080
9100
  } = props2;
9081
9101
  const count = props2.showCount ? ` (${coupons.length})` : "";
9082
9102
  const title = (props2.enabledTitle || t$9("enable")) + count;
9103
+ const updateChosenCoupon = (currentValues = [], value = 0) => {
9104
+ if (currentValues.includes(value)) {
9105
+ return currentValues.filter((item) => item !== value);
9106
+ }
9107
+ return [...currentValues, value];
9108
+ };
9083
9109
  return vue.createVNode(Tab, {
9084
9110
  "title": title
9085
9111
  }, {
@@ -9096,9 +9122,9 @@ var stdin_default$Y = vue.defineComponent({
9096
9122
  "key": coupon.id,
9097
9123
  "ref": setCouponRefs(index),
9098
9124
  "coupon": coupon,
9099
- "chosen": index === props2.chosenCoupon,
9125
+ "chosen": Array.isArray(chosenCoupon) ? chosenCoupon.includes(index) : index === chosenCoupon,
9100
9126
  "currency": props2.currency,
9101
- "onClick": () => emit("change", index)
9127
+ "onClick": () => emit("change", Array.isArray(chosenCoupon) ? updateChosenCoupon(chosenCoupon, index) : index)
9102
9128
  }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
9103
9129
  }
9104
9130
  });
@@ -9151,13 +9177,13 @@ var stdin_default$Y = vue.defineComponent({
9151
9177
  default: () => [renderCouponTab(), renderDisabledTab()]
9152
9178
  }), vue.createVNode("div", {
9153
9179
  "class": bem$O("bottom")
9154
- }, [vue.withDirectives(vue.createVNode(Button, {
9180
+ }, [slots["list-button"] ? slots["list-button"]() : vue.withDirectives(vue.createVNode(Button, {
9155
9181
  "round": true,
9156
9182
  "block": true,
9157
9183
  "type": "primary",
9158
9184
  "class": bem$O("close"),
9159
9185
  "text": props2.closeButtonText || t$9("close"),
9160
- "onClick": () => emit("change", -1)
9186
+ "onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? [] : -1)
9161
9187
  }, null), [[vue.vShow, props2.showCloseButton]])])]);
9162
9188
  }
9163
9189
  });
@@ -9190,6 +9216,7 @@ var stdin_default$X = vue.defineComponent({
9190
9216
  }) {
9191
9217
  const currentValues = vue.ref(props2.modelValue);
9192
9218
  const updatedByExternalSources = vue.ref(false);
9219
+ const pickerRef = vue.ref();
9193
9220
  const genYearOptions = () => {
9194
9221
  const minYear = props2.minDate.getFullYear();
9195
9222
  const maxYear = props2.maxDate.getFullYear();
@@ -9199,7 +9226,7 @@ var stdin_default$X = vue.defineComponent({
9199
9226
  const isMaxYear = (year) => year === props2.maxDate.getFullYear();
9200
9227
  const isMinMonth = (month) => month === props2.minDate.getMonth() + 1;
9201
9228
  const isMaxMonth = (month) => month === props2.maxDate.getMonth() + 1;
9202
- const getValue = (type) => {
9229
+ const getValue2 = (type) => {
9203
9230
  const {
9204
9231
  minDate,
9205
9232
  columnsType
@@ -9219,18 +9246,23 @@ var stdin_default$X = vue.defineComponent({
9219
9246
  }
9220
9247
  };
9221
9248
  const genMonthOptions = () => {
9222
- const year = getValue("year");
9249
+ const year = getValue2("year");
9223
9250
  const minMonth = isMinYear(year) ? props2.minDate.getMonth() + 1 : 1;
9224
9251
  const maxMonth = isMaxYear(year) ? props2.maxDate.getMonth() + 1 : 12;
9225
9252
  return genOptions(minMonth, maxMonth, "month", props2.formatter, props2.filter);
9226
9253
  };
9227
9254
  const genDayOptions = () => {
9228
- const year = getValue("year");
9229
- const month = getValue("month");
9255
+ const year = getValue2("year");
9256
+ const month = getValue2("month");
9230
9257
  const minDate = isMinYear(year) && isMinMonth(month) ? props2.minDate.getDate() : 1;
9231
9258
  const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
9232
9259
  return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter);
9233
9260
  };
9261
+ const confirm = () => {
9262
+ var _a;
9263
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
9264
+ };
9265
+ const getSelectedDate = () => currentValues.value;
9234
9266
  const columns = vue.computed(() => props2.columnsType.map((type) => {
9235
9267
  switch (type) {
9236
9268
  case "year":
@@ -9264,7 +9296,12 @@ var stdin_default$X = vue.defineComponent({
9264
9296
  const onChange = (...args) => emit("change", ...args);
9265
9297
  const onCancel = (...args) => emit("cancel", ...args);
9266
9298
  const onConfirm = (...args) => emit("confirm", ...args);
9299
+ useExpose({
9300
+ confirm,
9301
+ getSelectedDate
9302
+ });
9267
9303
  return () => vue.createVNode(Picker, vue.mergeProps({
9304
+ "ref": pickerRef,
9268
9305
  "modelValue": currentValues.value,
9269
9306
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
9270
9307
  "columns": columns.value,
@@ -15193,10 +15230,16 @@ var stdin_default$8 = vue.defineComponent({
15193
15230
  slots
15194
15231
  }) {
15195
15232
  const currentValues = vue.ref(props2.modelValue);
15233
+ const pickerRef = vue.ref();
15196
15234
  const getValidTime = (time) => {
15197
15235
  const timeLimitArr = time.split(":");
15198
15236
  return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
15199
15237
  };
15238
+ const confirm = () => {
15239
+ var _a;
15240
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
15241
+ };
15242
+ const getSelectedTime = () => currentValues.value;
15200
15243
  const columns = vue.computed(() => {
15201
15244
  let {
15202
15245
  minHour,
@@ -15269,7 +15312,12 @@ var stdin_default$8 = vue.defineComponent({
15269
15312
  const onChange = (...args) => emit("change", ...args);
15270
15313
  const onCancel = (...args) => emit("cancel", ...args);
15271
15314
  const onConfirm = (...args) => emit("confirm", ...args);
15315
+ useExpose({
15316
+ confirm,
15317
+ getSelectedTime
15318
+ });
15272
15319
  return () => vue.createVNode(Picker, vue.mergeProps({
15320
+ "ref": pickerRef,
15273
15321
  "modelValue": currentValues.value,
15274
15322
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
15275
15323
  "columns": columns.value,
@@ -16819,7 +16867,7 @@ const Lazyload = {
16819
16867
  });
16820
16868
  }
16821
16869
  };
16822
- const version = "4.8.8";
16870
+ const version = "4.8.10";
16823
16871
  function install(app) {
16824
16872
  const components = [
16825
16873
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -8630,23 +8630,39 @@ const couponCellProps = {
8630
8630
  editable: truthProp,
8631
8631
  coupons: makeArrayProp(),
8632
8632
  currency: makeStringProp("¥"),
8633
- chosenCoupon: makeNumericProp(-1)
8633
+ chosenCoupon: {
8634
+ type: [Number, Array],
8635
+ default: -1
8636
+ }
8637
+ };
8638
+ const getValue = (coupon) => {
8639
+ const {
8640
+ value,
8641
+ denominations
8642
+ } = coupon;
8643
+ if (isDef(value)) {
8644
+ return value;
8645
+ }
8646
+ if (isDef(denominations)) {
8647
+ return denominations;
8648
+ }
8649
+ return 0;
8634
8650
  };
8635
8651
  function formatValue({
8636
8652
  coupons,
8637
8653
  chosenCoupon,
8638
8654
  currency
8639
8655
  }) {
8640
- const coupon = coupons[+chosenCoupon];
8641
- if (coupon) {
8642
- let value = 0;
8643
- if (isDef(coupon.value)) {
8644
- ({
8645
- value
8646
- } = coupon);
8647
- } else if (isDef(coupon.denominations)) {
8648
- value = coupon.denominations;
8656
+ let value = 0;
8657
+ let isExist = false;
8658
+ (Array.isArray(chosenCoupon) ? chosenCoupon : [chosenCoupon]).forEach((i) => {
8659
+ const coupon = coupons[+i];
8660
+ if (coupon) {
8661
+ isExist = true;
8662
+ value += getValue(coupon);
8649
8663
  }
8664
+ });
8665
+ if (isExist) {
8650
8666
  return `-${currency} ${(value / 100).toFixed(2)}`;
8651
8667
  }
8652
8668
  return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
@@ -8656,7 +8672,7 @@ var stdin_default$_ = defineComponent({
8656
8672
  props: couponCellProps,
8657
8673
  setup(props2) {
8658
8674
  return () => {
8659
- const selected = props2.coupons[+props2.chosenCoupon];
8675
+ const selected = Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.length : props2.coupons[+props2.chosenCoupon];
8660
8676
  return createVNode(Cell, {
8661
8677
  "class": bem$Q(),
8662
8678
  "value": formatValue(props2),
@@ -8994,7 +9010,6 @@ const couponListProps = {
8994
9010
  currency: makeStringProp("¥"),
8995
9011
  showCount: truthProp,
8996
9012
  emptyImage: String,
8997
- chosenCoupon: makeNumberProp(-1),
8998
9013
  enabledTitle: String,
8999
9014
  disabledTitle: String,
9000
9015
  disabledCoupons: makeArrayProp(),
@@ -9006,7 +9021,11 @@ const couponListProps = {
9006
9021
  exchangeButtonText: String,
9007
9022
  displayedCouponIndex: makeNumberProp(-1),
9008
9023
  exchangeButtonLoading: Boolean,
9009
- exchangeButtonDisabled: Boolean
9024
+ exchangeButtonDisabled: Boolean,
9025
+ chosenCoupon: {
9026
+ type: [Number, Array],
9027
+ default: -1
9028
+ }
9010
9029
  };
9011
9030
  var stdin_default$Y = defineComponent({
9012
9031
  name: name$P,
@@ -9074,10 +9093,17 @@ var stdin_default$Y = defineComponent({
9074
9093
  };
9075
9094
  const renderCouponTab = () => {
9076
9095
  const {
9077
- coupons
9096
+ coupons,
9097
+ chosenCoupon
9078
9098
  } = props2;
9079
9099
  const count = props2.showCount ? ` (${coupons.length})` : "";
9080
9100
  const title = (props2.enabledTitle || t$9("enable")) + count;
9101
+ const updateChosenCoupon = (currentValues = [], value = 0) => {
9102
+ if (currentValues.includes(value)) {
9103
+ return currentValues.filter((item) => item !== value);
9104
+ }
9105
+ return [...currentValues, value];
9106
+ };
9081
9107
  return createVNode(Tab, {
9082
9108
  "title": title
9083
9109
  }, {
@@ -9094,9 +9120,9 @@ var stdin_default$Y = defineComponent({
9094
9120
  "key": coupon.id,
9095
9121
  "ref": setCouponRefs(index),
9096
9122
  "coupon": coupon,
9097
- "chosen": index === props2.chosenCoupon,
9123
+ "chosen": Array.isArray(chosenCoupon) ? chosenCoupon.includes(index) : index === chosenCoupon,
9098
9124
  "currency": props2.currency,
9099
- "onClick": () => emit("change", index)
9125
+ "onClick": () => emit("change", Array.isArray(chosenCoupon) ? updateChosenCoupon(chosenCoupon, index) : index)
9100
9126
  }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
9101
9127
  }
9102
9128
  });
@@ -9149,13 +9175,13 @@ var stdin_default$Y = defineComponent({
9149
9175
  default: () => [renderCouponTab(), renderDisabledTab()]
9150
9176
  }), createVNode("div", {
9151
9177
  "class": bem$O("bottom")
9152
- }, [withDirectives(createVNode(Button, {
9178
+ }, [slots["list-button"] ? slots["list-button"]() : withDirectives(createVNode(Button, {
9153
9179
  "round": true,
9154
9180
  "block": true,
9155
9181
  "type": "primary",
9156
9182
  "class": bem$O("close"),
9157
9183
  "text": props2.closeButtonText || t$9("close"),
9158
- "onClick": () => emit("change", -1)
9184
+ "onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? [] : -1)
9159
9185
  }, null), [[vShow, props2.showCloseButton]])])]);
9160
9186
  }
9161
9187
  });
@@ -9188,6 +9214,7 @@ var stdin_default$X = defineComponent({
9188
9214
  }) {
9189
9215
  const currentValues = ref(props2.modelValue);
9190
9216
  const updatedByExternalSources = ref(false);
9217
+ const pickerRef = ref();
9191
9218
  const genYearOptions = () => {
9192
9219
  const minYear = props2.minDate.getFullYear();
9193
9220
  const maxYear = props2.maxDate.getFullYear();
@@ -9197,7 +9224,7 @@ var stdin_default$X = defineComponent({
9197
9224
  const isMaxYear = (year) => year === props2.maxDate.getFullYear();
9198
9225
  const isMinMonth = (month) => month === props2.minDate.getMonth() + 1;
9199
9226
  const isMaxMonth = (month) => month === props2.maxDate.getMonth() + 1;
9200
- const getValue = (type) => {
9227
+ const getValue2 = (type) => {
9201
9228
  const {
9202
9229
  minDate,
9203
9230
  columnsType
@@ -9217,18 +9244,23 @@ var stdin_default$X = defineComponent({
9217
9244
  }
9218
9245
  };
9219
9246
  const genMonthOptions = () => {
9220
- const year = getValue("year");
9247
+ const year = getValue2("year");
9221
9248
  const minMonth = isMinYear(year) ? props2.minDate.getMonth() + 1 : 1;
9222
9249
  const maxMonth = isMaxYear(year) ? props2.maxDate.getMonth() + 1 : 12;
9223
9250
  return genOptions(minMonth, maxMonth, "month", props2.formatter, props2.filter);
9224
9251
  };
9225
9252
  const genDayOptions = () => {
9226
- const year = getValue("year");
9227
- const month = getValue("month");
9253
+ const year = getValue2("year");
9254
+ const month = getValue2("month");
9228
9255
  const minDate = isMinYear(year) && isMinMonth(month) ? props2.minDate.getDate() : 1;
9229
9256
  const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
9230
9257
  return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter);
9231
9258
  };
9259
+ const confirm = () => {
9260
+ var _a;
9261
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
9262
+ };
9263
+ const getSelectedDate = () => currentValues.value;
9232
9264
  const columns = computed(() => props2.columnsType.map((type) => {
9233
9265
  switch (type) {
9234
9266
  case "year":
@@ -9262,7 +9294,12 @@ var stdin_default$X = defineComponent({
9262
9294
  const onChange = (...args) => emit("change", ...args);
9263
9295
  const onCancel = (...args) => emit("cancel", ...args);
9264
9296
  const onConfirm = (...args) => emit("confirm", ...args);
9297
+ useExpose({
9298
+ confirm,
9299
+ getSelectedDate
9300
+ });
9265
9301
  return () => createVNode(Picker, mergeProps({
9302
+ "ref": pickerRef,
9266
9303
  "modelValue": currentValues.value,
9267
9304
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
9268
9305
  "columns": columns.value,
@@ -15191,10 +15228,16 @@ var stdin_default$8 = defineComponent({
15191
15228
  slots
15192
15229
  }) {
15193
15230
  const currentValues = ref(props2.modelValue);
15231
+ const pickerRef = ref();
15194
15232
  const getValidTime = (time) => {
15195
15233
  const timeLimitArr = time.split(":");
15196
15234
  return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
15197
15235
  };
15236
+ const confirm = () => {
15237
+ var _a;
15238
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
15239
+ };
15240
+ const getSelectedTime = () => currentValues.value;
15198
15241
  const columns = computed(() => {
15199
15242
  let {
15200
15243
  minHour,
@@ -15267,7 +15310,12 @@ var stdin_default$8 = defineComponent({
15267
15310
  const onChange = (...args) => emit("change", ...args);
15268
15311
  const onCancel = (...args) => emit("cancel", ...args);
15269
15312
  const onConfirm = (...args) => emit("confirm", ...args);
15313
+ useExpose({
15314
+ confirm,
15315
+ getSelectedTime
15316
+ });
15270
15317
  return () => createVNode(Picker, mergeProps({
15318
+ "ref": pickerRef,
15271
15319
  "modelValue": currentValues.value,
15272
15320
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
15273
15321
  "columns": columns.value,
@@ -16817,7 +16865,7 @@ const Lazyload = {
16817
16865
  });
16818
16866
  }
16819
16867
  };
16820
- const version = "4.8.8";
16868
+ const version = "4.8.10";
16821
16869
  function install(app) {
16822
16870
  const components = [
16823
16871
  ActionBar,
package/lib/vant.js CHANGED
@@ -2369,7 +2369,7 @@
2369
2369
  return propRef;
2370
2370
  };
2371
2371
  /**
2372
- * @vue/shared v3.4.15
2372
+ * @vue/shared v3.4.21
2373
2373
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
2374
2374
  * @license MIT
2375
2375
  **/
@@ -9074,23 +9074,39 @@
9074
9074
  editable: truthProp,
9075
9075
  coupons: makeArrayProp(),
9076
9076
  currency: makeStringProp("¥"),
9077
- chosenCoupon: makeNumericProp(-1)
9077
+ chosenCoupon: {
9078
+ type: [Number, Array],
9079
+ default: -1
9080
+ }
9081
+ };
9082
+ const getValue = (coupon) => {
9083
+ const {
9084
+ value,
9085
+ denominations
9086
+ } = coupon;
9087
+ if (isDef(value)) {
9088
+ return value;
9089
+ }
9090
+ if (isDef(denominations)) {
9091
+ return denominations;
9092
+ }
9093
+ return 0;
9078
9094
  };
9079
9095
  function formatValue({
9080
9096
  coupons,
9081
9097
  chosenCoupon,
9082
9098
  currency
9083
9099
  }) {
9084
- const coupon = coupons[+chosenCoupon];
9085
- if (coupon) {
9086
- let value = 0;
9087
- if (isDef(coupon.value)) {
9088
- ({
9089
- value
9090
- } = coupon);
9091
- } else if (isDef(coupon.denominations)) {
9092
- value = coupon.denominations;
9100
+ let value = 0;
9101
+ let isExist = false;
9102
+ (Array.isArray(chosenCoupon) ? chosenCoupon : [chosenCoupon]).forEach((i) => {
9103
+ const coupon = coupons[+i];
9104
+ if (coupon) {
9105
+ isExist = true;
9106
+ value += getValue(coupon);
9093
9107
  }
9108
+ });
9109
+ if (isExist) {
9094
9110
  return `-${currency} ${(value / 100).toFixed(2)}`;
9095
9111
  }
9096
9112
  return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
@@ -9100,7 +9116,7 @@
9100
9116
  props: couponCellProps,
9101
9117
  setup(props2) {
9102
9118
  return () => {
9103
- const selected = props2.coupons[+props2.chosenCoupon];
9119
+ const selected = Array.isArray(props2.chosenCoupon) ? props2.chosenCoupon.length : props2.coupons[+props2.chosenCoupon];
9104
9120
  return vue.createVNode(Cell, {
9105
9121
  "class": bem$Q(),
9106
9122
  "value": formatValue(props2),
@@ -9438,7 +9454,6 @@
9438
9454
  currency: makeStringProp("¥"),
9439
9455
  showCount: truthProp,
9440
9456
  emptyImage: String,
9441
- chosenCoupon: makeNumberProp(-1),
9442
9457
  enabledTitle: String,
9443
9458
  disabledTitle: String,
9444
9459
  disabledCoupons: makeArrayProp(),
@@ -9450,7 +9465,11 @@
9450
9465
  exchangeButtonText: String,
9451
9466
  displayedCouponIndex: makeNumberProp(-1),
9452
9467
  exchangeButtonLoading: Boolean,
9453
- exchangeButtonDisabled: Boolean
9468
+ exchangeButtonDisabled: Boolean,
9469
+ chosenCoupon: {
9470
+ type: [Number, Array],
9471
+ default: -1
9472
+ }
9454
9473
  };
9455
9474
  var stdin_default$Y = vue.defineComponent({
9456
9475
  name: name$P,
@@ -9518,10 +9537,17 @@
9518
9537
  };
9519
9538
  const renderCouponTab = () => {
9520
9539
  const {
9521
- coupons
9540
+ coupons,
9541
+ chosenCoupon
9522
9542
  } = props2;
9523
9543
  const count = props2.showCount ? ` (${coupons.length})` : "";
9524
9544
  const title = (props2.enabledTitle || t$9("enable")) + count;
9545
+ const updateChosenCoupon = (currentValues = [], value = 0) => {
9546
+ if (currentValues.includes(value)) {
9547
+ return currentValues.filter((item) => item !== value);
9548
+ }
9549
+ return [...currentValues, value];
9550
+ };
9525
9551
  return vue.createVNode(Tab, {
9526
9552
  "title": title
9527
9553
  }, {
@@ -9538,9 +9564,9 @@
9538
9564
  "key": coupon.id,
9539
9565
  "ref": setCouponRefs(index),
9540
9566
  "coupon": coupon,
9541
- "chosen": index === props2.chosenCoupon,
9567
+ "chosen": Array.isArray(chosenCoupon) ? chosenCoupon.includes(index) : index === chosenCoupon,
9542
9568
  "currency": props2.currency,
9543
- "onClick": () => emit("change", index)
9569
+ "onClick": () => emit("change", Array.isArray(chosenCoupon) ? updateChosenCoupon(chosenCoupon, index) : index)
9544
9570
  }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
9545
9571
  }
9546
9572
  });
@@ -9593,13 +9619,13 @@
9593
9619
  default: () => [renderCouponTab(), renderDisabledTab()]
9594
9620
  }), vue.createVNode("div", {
9595
9621
  "class": bem$O("bottom")
9596
- }, [vue.withDirectives(vue.createVNode(Button, {
9622
+ }, [slots["list-button"] ? slots["list-button"]() : vue.withDirectives(vue.createVNode(Button, {
9597
9623
  "round": true,
9598
9624
  "block": true,
9599
9625
  "type": "primary",
9600
9626
  "class": bem$O("close"),
9601
9627
  "text": props2.closeButtonText || t$9("close"),
9602
- "onClick": () => emit("change", -1)
9628
+ "onClick": () => emit("change", Array.isArray(props2.chosenCoupon) ? [] : -1)
9603
9629
  }, null), [[vue.vShow, props2.showCloseButton]])])]);
9604
9630
  }
9605
9631
  });
@@ -9632,6 +9658,7 @@
9632
9658
  }) {
9633
9659
  const currentValues = vue.ref(props2.modelValue);
9634
9660
  const updatedByExternalSources = vue.ref(false);
9661
+ const pickerRef = vue.ref();
9635
9662
  const genYearOptions = () => {
9636
9663
  const minYear = props2.minDate.getFullYear();
9637
9664
  const maxYear = props2.maxDate.getFullYear();
@@ -9641,7 +9668,7 @@
9641
9668
  const isMaxYear = (year) => year === props2.maxDate.getFullYear();
9642
9669
  const isMinMonth = (month) => month === props2.minDate.getMonth() + 1;
9643
9670
  const isMaxMonth = (month) => month === props2.maxDate.getMonth() + 1;
9644
- const getValue = (type) => {
9671
+ const getValue2 = (type) => {
9645
9672
  const {
9646
9673
  minDate,
9647
9674
  columnsType
@@ -9661,18 +9688,23 @@
9661
9688
  }
9662
9689
  };
9663
9690
  const genMonthOptions = () => {
9664
- const year = getValue("year");
9691
+ const year = getValue2("year");
9665
9692
  const minMonth = isMinYear(year) ? props2.minDate.getMonth() + 1 : 1;
9666
9693
  const maxMonth = isMaxYear(year) ? props2.maxDate.getMonth() + 1 : 12;
9667
9694
  return genOptions(minMonth, maxMonth, "month", props2.formatter, props2.filter);
9668
9695
  };
9669
9696
  const genDayOptions = () => {
9670
- const year = getValue("year");
9671
- const month = getValue("month");
9697
+ const year = getValue2("year");
9698
+ const month = getValue2("month");
9672
9699
  const minDate = isMinYear(year) && isMinMonth(month) ? props2.minDate.getDate() : 1;
9673
9700
  const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
9674
9701
  return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter);
9675
9702
  };
9703
+ const confirm = () => {
9704
+ var _a;
9705
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
9706
+ };
9707
+ const getSelectedDate = () => currentValues.value;
9676
9708
  const columns = vue.computed(() => props2.columnsType.map((type) => {
9677
9709
  switch (type) {
9678
9710
  case "year":
@@ -9703,7 +9735,12 @@
9703
9735
  const onChange = (...args) => emit("change", ...args);
9704
9736
  const onCancel = (...args) => emit("cancel", ...args);
9705
9737
  const onConfirm = (...args) => emit("confirm", ...args);
9738
+ useExpose({
9739
+ confirm,
9740
+ getSelectedDate
9741
+ });
9706
9742
  return () => vue.createVNode(Picker, vue.mergeProps({
9743
+ "ref": pickerRef,
9707
9744
  "modelValue": currentValues.value,
9708
9745
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
9709
9746
  "columns": columns.value,
@@ -16426,10 +16463,16 @@
16426
16463
  slots
16427
16464
  }) {
16428
16465
  const currentValues = vue.ref(props2.modelValue);
16466
+ const pickerRef = vue.ref();
16429
16467
  const getValidTime = (time) => {
16430
16468
  const timeLimitArr = time.split(":");
16431
16469
  return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
16432
16470
  };
16471
+ const confirm = () => {
16472
+ var _a;
16473
+ return (_a = pickerRef.value) == null ? void 0 : _a.confirm();
16474
+ };
16475
+ const getSelectedTime = () => currentValues.value;
16433
16476
  const columns = vue.computed(() => {
16434
16477
  let {
16435
16478
  minHour,
@@ -16499,7 +16542,12 @@
16499
16542
  const onChange = (...args) => emit("change", ...args);
16500
16543
  const onCancel = (...args) => emit("cancel", ...args);
16501
16544
  const onConfirm = (...args) => emit("confirm", ...args);
16545
+ useExpose({
16546
+ confirm,
16547
+ getSelectedTime
16548
+ });
16502
16549
  return () => vue.createVNode(Picker, vue.mergeProps({
16550
+ "ref": pickerRef,
16503
16551
  "modelValue": currentValues.value,
16504
16552
  "onUpdate:modelValue": ($event) => currentValues.value = $event,
16505
16553
  "columns": columns.value,
@@ -18032,7 +18080,7 @@
18032
18080
  });
18033
18081
  }
18034
18082
  };
18035
- const version = "4.8.8";
18083
+ const version = "4.8.10";
18036
18084
  function install(app) {
18037
18085
  const components = [
18038
18086
  ActionBar,