vant 4.9.2 → 4.9.3

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.js CHANGED
@@ -2369,7 +2369,7 @@
2369
2369
  return propRef;
2370
2370
  };
2371
2371
  /**
2372
- * @vue/shared v3.4.29
2372
+ * @vue/shared v3.4.33
2373
2373
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
2374
2374
  * @license MIT
2375
2375
  **/
@@ -6798,11 +6798,17 @@
6798
6798
  function getMonthByOffset(date, offset2) {
6799
6799
  const cloned = cloneDate(date);
6800
6800
  cloned.setMonth(cloned.getMonth() + offset2);
6801
+ if (cloned.getDate() !== date.getDate()) {
6802
+ cloned.setDate(0);
6803
+ }
6801
6804
  return cloned;
6802
6805
  }
6803
6806
  function getYearByOffset(date, offset2) {
6804
6807
  const cloned = cloneDate(date);
6805
6808
  cloned.setFullYear(cloned.getFullYear() + offset2);
6809
+ if (cloned.getDate() !== date.getDate()) {
6810
+ cloned.setDate(0);
6811
+ }
6806
6812
  return cloned;
6807
6813
  }
6808
6814
  const getPrevDay = (date) => getDayByOffset(date, -1);
@@ -7206,22 +7212,10 @@
7206
7212
  slots,
7207
7213
  emit
7208
7214
  }) {
7209
- const prevMonthDisabled = vue.computed(() => {
7210
- const prevMonth = getPrevMonth(props2.date);
7211
- return props2.minDate && prevMonth < props2.minDate;
7212
- });
7213
- const prevYearDisabled = vue.computed(() => {
7214
- const prevYear = getPrevYear(props2.date);
7215
- return props2.minDate && prevYear < props2.minDate;
7216
- });
7217
- const nextMonthDisabled = vue.computed(() => {
7218
- const nextMonth = getNextMonth(props2.date);
7219
- return props2.maxDate && nextMonth > props2.maxDate;
7220
- });
7221
- const nextYearDisabled = vue.computed(() => {
7222
- const nextYear = getNextYear(props2.date);
7223
- return props2.maxDate && nextYear > props2.maxDate;
7224
- });
7215
+ const prevMonthDisabled = vue.computed(() => props2.date && props2.minDate && compareMonth(getPrevMonth(props2.date), props2.minDate) < 0);
7216
+ const prevYearDisabled = vue.computed(() => props2.date && props2.minDate && compareMonth(getPrevYear(props2.date), props2.minDate) < 0);
7217
+ const nextMonthDisabled = vue.computed(() => props2.date && props2.maxDate && compareMonth(getNextMonth(props2.date), props2.maxDate) > 0);
7218
+ const nextYearDisabled = vue.computed(() => props2.date && props2.maxDate && compareMonth(getNextYear(props2.date), props2.maxDate) > 0);
7225
7219
  const renderTitle = () => {
7226
7220
  if (props2.showTitle) {
7227
7221
  const text = props2.title || t$g("title");
@@ -16470,10 +16464,11 @@
16470
16464
  emit,
16471
16465
  slots
16472
16466
  }) {
16473
- const text = vue.ref("");
16467
+ const text = vue.ref(props2.content);
16474
16468
  const expanded = vue.ref(false);
16475
16469
  const hasAction = vue.ref(false);
16476
16470
  const root = vue.ref();
16471
+ const actionRef = vue.ref();
16477
16472
  let needRecalculate = false;
16478
16473
  const actionText = vue.computed(() => expanded.value ? props2.collapseText : props2.expandText);
16479
16474
  const pxToNum = (value) => {
@@ -16501,57 +16496,60 @@
16501
16496
  document.body.appendChild(container);
16502
16497
  return container;
16503
16498
  };
16504
- const calcEllipsised = () => {
16505
- const calcEllipsisText = (container2, maxHeight2) => {
16506
- const {
16507
- content,
16508
- position,
16509
- dots
16510
- } = props2;
16511
- const end2 = content.length;
16512
- const calcEllipse = () => {
16513
- const tail = (left2, right2) => {
16514
- if (right2 - left2 <= 1) {
16515
- if (position === "end") {
16516
- return content.slice(0, left2) + dots;
16517
- }
16518
- return dots + content.slice(right2, end2);
16519
- }
16520
- const middle2 = Math.round((left2 + right2) / 2);
16499
+ const calcEllipsisText = (container, maxHeight) => {
16500
+ var _a, _b;
16501
+ const {
16502
+ content,
16503
+ position,
16504
+ dots
16505
+ } = props2;
16506
+ const end2 = content.length;
16507
+ const middle = 0 + end2 >> 1;
16508
+ const actionHTML = slots.action ? (_b = (_a = actionRef.value) == null ? void 0 : _a.outerHTML) != null ? _b : "" : props2.expandText;
16509
+ const calcEllipse = () => {
16510
+ const tail = (left2, right2) => {
16511
+ if (right2 - left2 <= 1) {
16521
16512
  if (position === "end") {
16522
- container2.innerText = content.slice(0, middle2) + dots + actionText.value;
16523
- } else {
16524
- container2.innerText = dots + content.slice(middle2, end2) + actionText.value;
16525
- }
16526
- if (container2.offsetHeight > maxHeight2) {
16527
- if (position === "end") {
16528
- return tail(left2, middle2);
16529
- }
16530
- return tail(middle2, right2);
16513
+ return content.slice(0, left2) + dots;
16531
16514
  }
16515
+ return dots + content.slice(right2, end2);
16516
+ }
16517
+ const middle2 = Math.round((left2 + right2) / 2);
16518
+ if (position === "end") {
16519
+ container.innerText = content.slice(0, middle2) + dots;
16520
+ } else {
16521
+ container.innerText = dots + content.slice(middle2, end2);
16522
+ }
16523
+ container.innerHTML += actionHTML;
16524
+ if (container.offsetHeight > maxHeight) {
16532
16525
  if (position === "end") {
16533
- return tail(middle2, right2);
16526
+ return tail(left2, middle2);
16534
16527
  }
16535
- return tail(left2, middle2);
16536
- };
16537
- container2.innerText = tail(0, end2);
16538
- };
16539
- const middleTail = (leftPart, rightPart) => {
16540
- if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
16541
- return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end2);
16528
+ return tail(middle2, right2);
16542
16529
  }
16543
- const leftMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
16544
- const rightMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
16545
- container2.innerText = props2.content.slice(0, leftMiddle) + props2.dots + props2.content.slice(rightMiddle, end2) + props2.expandText;
16546
- if (container2.offsetHeight >= maxHeight2) {
16547
- return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
16530
+ if (position === "end") {
16531
+ return tail(middle2, right2);
16548
16532
  }
16549
- return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
16533
+ return tail(left2, middle2);
16550
16534
  };
16551
- const middle = 0 + end2 >> 1;
16552
- props2.position === "middle" ? container2.innerText = middleTail([0, middle], [middle, end2]) : calcEllipse();
16553
- return container2.innerText;
16535
+ return tail(0, end2);
16536
+ };
16537
+ const middleTail = (leftPart, rightPart) => {
16538
+ if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
16539
+ return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end2);
16540
+ }
16541
+ const leftMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
16542
+ const rightMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
16543
+ container.innerText = props2.content.slice(0, leftMiddle) + props2.dots + props2.content.slice(rightMiddle, end2);
16544
+ container.innerHTML += actionHTML;
16545
+ if (container.offsetHeight >= maxHeight) {
16546
+ return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
16547
+ }
16548
+ return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
16554
16549
  };
16550
+ return props2.position === "middle" ? middleTail([0, middle], [middle, end2]) : calcEllipse();
16551
+ };
16552
+ const calcEllipsised = () => {
16555
16553
  const container = cloneContainer();
16556
16554
  if (!container) {
16557
16555
  needRecalculate = true;
@@ -16584,11 +16582,17 @@
16584
16582
  expanded: expanded.value
16585
16583
  }) : actionText.value;
16586
16584
  return vue.createVNode("span", {
16585
+ "ref": actionRef,
16587
16586
  "class": bem$3("action"),
16588
16587
  "onClick": onClickAction
16589
16588
  }, [action]);
16590
16589
  };
16591
- vue.onMounted(calcEllipsised);
16590
+ vue.onMounted(() => {
16591
+ calcEllipsised();
16592
+ if (slots.action) {
16593
+ vue.nextTick(calcEllipsised);
16594
+ }
16595
+ });
16592
16596
  vue.onActivated(() => {
16593
16597
  if (needRecalculate) {
16594
16598
  needRecalculate = false;
@@ -17184,7 +17188,7 @@
17184
17188
  emit("update:modelValue", fileList);
17185
17189
  emit("delete", item, getDetail(index));
17186
17190
  };
17187
- const reuploadImage = (index) => {
17191
+ const reuploadFile = (index) => {
17188
17192
  isReuploading.value = true;
17189
17193
  reuploadIndex.value = index;
17190
17194
  vue.nextTick(() => chooseFile());
@@ -17204,7 +17208,7 @@
17204
17208
  "onClick": () => emit(props2.reupload ? "clickReupload" : "clickPreview", item, getDetail(index)),
17205
17209
  "onDelete": () => deleteFile(item, index),
17206
17210
  "onPreview": () => previewImage(item),
17207
- "onReupload": () => reuploadImage(index)
17211
+ "onReupload": () => reuploadFile(index)
17208
17212
  }, pick(props2, ["name", "lazyLoad"]), previewData), pick(slots, ["preview-cover", "preview-delete"]));
17209
17213
  };
17210
17214
  const renderPreviewList = () => {
@@ -17214,10 +17218,7 @@
17214
17218
  };
17215
17219
  const onClickUpload = (event) => emit("clickUpload", event);
17216
17220
  const renderUpload = () => {
17217
- if (props2.modelValue.length >= +props2.maxCount && !props2.reupload) {
17218
- return;
17219
- }
17220
- const hideUploader = props2.modelValue.length >= +props2.maxCount && props2.reupload;
17221
+ const lessThanMax = props2.modelValue.length < +props2.maxCount;
17221
17222
  const Input = props2.readonly ? null : vue.createVNode("input", {
17222
17223
  "ref": inputRef,
17223
17224
  "type": "file",
@@ -17233,7 +17234,7 @@
17233
17234
  return vue.withDirectives(vue.createVNode("div", {
17234
17235
  "class": bem$1("input-wrapper"),
17235
17236
  "onClick": onClickUpload
17236
- }, [slots.default(), Input]), [[vue.vShow, !hideUploader]]);
17237
+ }, [slots.default(), Input]), [[vue.vShow, lessThanMax]]);
17237
17238
  }
17238
17239
  return vue.withDirectives(vue.createVNode("div", {
17239
17240
  "class": bem$1("upload", {
@@ -17246,7 +17247,7 @@
17246
17247
  "class": bem$1("upload-icon")
17247
17248
  }, null), props2.uploadText && vue.createVNode("span", {
17248
17249
  "class": bem$1("upload-text")
17249
- }, [props2.uploadText]), Input]), [[vue.vShow, props2.showUpload && !hideUploader]]);
17250
+ }, [props2.uploadText]), Input]), [[vue.vShow, props2.showUpload && lessThanMax]]);
17250
17251
  };
17251
17252
  const chooseFile = () => {
17252
17253
  if (inputRef.value && !props2.disabled) {
@@ -17258,6 +17259,7 @@
17258
17259
  });
17259
17260
  useExpose({
17260
17261
  chooseFile,
17262
+ reuploadFile,
17261
17263
  closeImagePreview
17262
17264
  });
17263
17265
  useCustomFieldValue(() => props2.modelValue);
@@ -18256,7 +18258,7 @@
18256
18258
  });
18257
18259
  }
18258
18260
  };
18259
- const version = "4.9.2";
18261
+ const version = "4.9.3";
18260
18262
  function install(app) {
18261
18263
  const components = [
18262
18264
  ActionBar,