vant 4.8.7 → 4.8.8

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.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) {
@@ -10032,7 +10043,9 @@ var stdin_default$S = defineComponent({
10032
10043
  initialized = true;
10033
10044
  });
10034
10045
  });
10035
- watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState);
10046
+ watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState, {
10047
+ deep: true
10048
+ });
10036
10049
  const show = ref(true);
10037
10050
  onActivated(() => {
10038
10051
  show.value = true;
@@ -10785,7 +10798,9 @@ var stdin_default$N = defineComponent({
10785
10798
  default: () => [slots.image ? createVNode("div", {
10786
10799
  "class": bem$E("image-wrap")
10787
10800
  }, [slots.image({
10788
- src: props2.src
10801
+ src: props2.src,
10802
+ onLoad,
10803
+ style: imageStyle.value
10789
10804
  })]) : createVNode(Image$1, {
10790
10805
  "ref": imageRef,
10791
10806
  "src": props2.src,
@@ -15011,6 +15026,7 @@ var stdin_default$9 = defineComponent({
15011
15026
  const expanded = ref(false);
15012
15027
  const hasAction = ref(false);
15013
15028
  const root = ref();
15029
+ let needRecalculate = false;
15014
15030
  const actionText = computed(() => expanded.value ? props2.collapseText : props2.expandText);
15015
15031
  const pxToNum = (value) => {
15016
15032
  if (!value)
@@ -15018,26 +15034,26 @@ var stdin_default$9 = defineComponent({
15018
15034
  const match = value.match(/^\d*(\.\d*)?/);
15019
15035
  return match ? Number(match[0]) : 0;
15020
15036
  };
15037
+ const cloneContainer = () => {
15038
+ if (!root.value || !root.value.isConnected)
15039
+ return;
15040
+ const originStyle = window.getComputedStyle(root.value);
15041
+ const container = document.createElement("div");
15042
+ const styleNames = Array.prototype.slice.apply(originStyle);
15043
+ styleNames.forEach((name2) => {
15044
+ container.style.setProperty(name2, originStyle.getPropertyValue(name2));
15045
+ });
15046
+ container.style.position = "fixed";
15047
+ container.style.zIndex = "-9999";
15048
+ container.style.top = "-9999px";
15049
+ container.style.height = "auto";
15050
+ container.style.minHeight = "auto";
15051
+ container.style.maxHeight = "auto";
15052
+ container.innerText = props2.content;
15053
+ document.body.appendChild(container);
15054
+ return container;
15055
+ };
15021
15056
  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
15057
  const calcEllipsisText = (container2, maxHeight2) => {
15042
15058
  const {
15043
15059
  content,
@@ -15089,8 +15105,10 @@ var stdin_default$9 = defineComponent({
15089
15105
  return container2.innerText;
15090
15106
  };
15091
15107
  const container = cloneContainer();
15092
- if (!container)
15108
+ if (!container) {
15109
+ needRecalculate = true;
15093
15110
  return;
15111
+ }
15094
15112
  const {
15095
15113
  paddingBottom,
15096
15114
  paddingTop,
@@ -15123,6 +15141,12 @@ var stdin_default$9 = defineComponent({
15123
15141
  }, [action]);
15124
15142
  };
15125
15143
  onMounted(calcEllipsised);
15144
+ onActivated(() => {
15145
+ if (needRecalculate) {
15146
+ needRecalculate = false;
15147
+ calcEllipsised();
15148
+ }
15149
+ });
15126
15150
  watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
15127
15151
  useExpose({
15128
15152
  toggle
@@ -16793,7 +16817,7 @@ const Lazyload = {
16793
16817
  });
16794
16818
  }
16795
16819
  };
16796
- const version = "4.8.7";
16820
+ const version = "4.8.8";
16797
16821
  function install(app) {
16798
16822
  const components = [
16799
16823
  ActionBar,
package/lib/vant.js CHANGED
@@ -39,6 +39,7 @@
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 = {
@@ -2368,7 +2369,7 @@
2368
2369
  return propRef;
2369
2370
  };
2370
2371
  /**
2371
- * @vue/shared v3.4.12
2372
+ * @vue/shared v3.4.15
2372
2373
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
2373
2374
  * @license MIT
2374
2375
  **/
@@ -3760,7 +3761,15 @@
3760
3761
  const onCancel = () => emit("cancel");
3761
3762
  return () => {
3762
3763
  var _a, _b;
3763
- const childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== vue.Comment);
3764
+ let childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== vue.Comment).map((node) => {
3765
+ if (node.type === vue.Fragment) {
3766
+ return node.children;
3767
+ }
3768
+ return node;
3769
+ });
3770
+ if (childNodes) {
3771
+ childNodes = flat(childNodes);
3772
+ }
3764
3773
  const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
3765
3774
  return vue.createVNode("div", {
3766
3775
  "class": bem$1l()
@@ -6039,11 +6048,11 @@
6039
6048
  slots,
6040
6049
  emit
6041
6050
  }) {
6042
- const onClick = () => {
6051
+ const onClick = (event) => {
6043
6052
  if (props2.switchable) {
6044
6053
  emit("select");
6045
6054
  }
6046
- emit("click");
6055
+ emit("click", event);
6047
6056
  };
6048
6057
  const renderRightIcon = () => vue.createVNode(Icon, {
6049
6058
  "name": props2.rightIcon,
@@ -6051,7 +6060,7 @@
6051
6060
  "onClick": (event) => {
6052
6061
  event.stopPropagation();
6053
6062
  emit("edit");
6054
- emit("click");
6063
+ emit("click", event);
6055
6064
  }
6056
6065
  }, null);
6057
6066
  const renderTag = () => {
@@ -6133,7 +6142,9 @@
6133
6142
  }) {
6134
6143
  const renderItem = (item, index, disabled) => {
6135
6144
  const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
6136
- const onClick = () => emit("clickItem", item, index);
6145
+ const onClick = (event) => emit("clickItem", item, index, {
6146
+ event
6147
+ });
6137
6148
  const onSelect = () => {
6138
6149
  emit(disabled ? "selectDisabled" : "select", item, index);
6139
6150
  if (!disabled) {
@@ -10470,7 +10481,9 @@
10470
10481
  initialized = true;
10471
10482
  });
10472
10483
  });
10473
- vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState);
10484
+ vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState, {
10485
+ deep: true
10486
+ });
10474
10487
  const show = vue.ref(true);
10475
10488
  vue.onActivated(() => {
10476
10489
  show.value = true;
@@ -11220,7 +11233,9 @@
11220
11233
  default: () => [slots.image ? vue.createVNode("div", {
11221
11234
  "class": bem$E("image-wrap")
11222
11235
  }, [slots.image({
11223
- src: props2.src
11236
+ src: props2.src,
11237
+ onLoad,
11238
+ style: imageStyle.value
11224
11239
  })]) : vue.createVNode(Image$1, {
11225
11240
  "ref": imageRef,
11226
11241
  "src": props2.src,
@@ -16246,6 +16261,7 @@
16246
16261
  const expanded = vue.ref(false);
16247
16262
  const hasAction = vue.ref(false);
16248
16263
  const root = vue.ref();
16264
+ let needRecalculate = false;
16249
16265
  const actionText = vue.computed(() => expanded.value ? props2.collapseText : props2.expandText);
16250
16266
  const pxToNum = (value) => {
16251
16267
  if (!value)
@@ -16253,26 +16269,26 @@
16253
16269
  const match = value.match(/^\d*(\.\d*)?/);
16254
16270
  return match ? Number(match[0]) : 0;
16255
16271
  };
16272
+ const cloneContainer = () => {
16273
+ if (!root.value || !root.value.isConnected)
16274
+ return;
16275
+ const originStyle = window.getComputedStyle(root.value);
16276
+ const container = document.createElement("div");
16277
+ const styleNames = Array.prototype.slice.apply(originStyle);
16278
+ styleNames.forEach((name2) => {
16279
+ container.style.setProperty(name2, originStyle.getPropertyValue(name2));
16280
+ });
16281
+ container.style.position = "fixed";
16282
+ container.style.zIndex = "-9999";
16283
+ container.style.top = "-9999px";
16284
+ container.style.height = "auto";
16285
+ container.style.minHeight = "auto";
16286
+ container.style.maxHeight = "auto";
16287
+ container.innerText = props2.content;
16288
+ document.body.appendChild(container);
16289
+ return container;
16290
+ };
16256
16291
  const calcEllipsised = () => {
16257
- const cloneContainer = () => {
16258
- if (!root.value)
16259
- return;
16260
- const originStyle = window.getComputedStyle(root.value);
16261
- const container2 = document.createElement("div");
16262
- const styleNames = Array.prototype.slice.apply(originStyle);
16263
- styleNames.forEach((name2) => {
16264
- container2.style.setProperty(name2, originStyle.getPropertyValue(name2));
16265
- });
16266
- container2.style.position = "fixed";
16267
- container2.style.zIndex = "-9999";
16268
- container2.style.top = "-9999px";
16269
- container2.style.height = "auto";
16270
- container2.style.minHeight = "auto";
16271
- container2.style.maxHeight = "auto";
16272
- container2.innerText = props2.content;
16273
- document.body.appendChild(container2);
16274
- return container2;
16275
- };
16276
16292
  const calcEllipsisText = (container2, maxHeight2) => {
16277
16293
  const {
16278
16294
  content,
@@ -16324,8 +16340,10 @@
16324
16340
  return container2.innerText;
16325
16341
  };
16326
16342
  const container = cloneContainer();
16327
- if (!container)
16343
+ if (!container) {
16344
+ needRecalculate = true;
16328
16345
  return;
16346
+ }
16329
16347
  const {
16330
16348
  paddingBottom,
16331
16349
  paddingTop,
@@ -16358,6 +16376,12 @@
16358
16376
  }, [action]);
16359
16377
  };
16360
16378
  vue.onMounted(calcEllipsised);
16379
+ vue.onActivated(() => {
16380
+ if (needRecalculate) {
16381
+ needRecalculate = false;
16382
+ calcEllipsised();
16383
+ }
16384
+ });
16361
16385
  vue.watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
16362
16386
  useExpose({
16363
16387
  toggle
@@ -18008,7 +18032,7 @@
18008
18032
  });
18009
18033
  }
18010
18034
  };
18011
- const version = "4.8.7";
18035
+ const version = "4.8.8";
18012
18036
  function install(app) {
18013
18037
  const components = [
18014
18038
  ActionBar,