vant 4.1.0 → 4.1.2

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 (201) hide show
  1. package/es/area/utils.mjs +2 -2
  2. package/es/back-top/BackTop.mjs +1 -1
  3. package/es/badge/Badge.mjs +1 -1
  4. package/es/button/Button.d.ts +1 -1
  5. package/es/button/index.d.ts +1 -1
  6. package/es/calendar/Calendar.mjs +2 -2
  7. package/es/calendar/utils.mjs +1 -1
  8. package/es/checkbox/Checkbox.mjs +1 -1
  9. package/es/date-picker/DatePicker.mjs +1 -1
  10. package/es/divider/Divider.d.ts +1 -1
  11. package/es/divider/index.d.ts +1 -1
  12. package/es/field/Field.mjs +13 -7
  13. package/es/field/index.css +1 -1
  14. package/es/field/index.d.ts +1 -1
  15. package/es/field/types.d.ts +2 -2
  16. package/es/grid-item/GridItem.mjs +1 -1
  17. package/es/image-preview/ImagePreviewItem.mjs +4 -3
  18. package/es/index.d.ts +1 -1
  19. package/es/index.mjs +1 -1
  20. package/es/lazyload/vue-lazyload/index.mjs +5 -0
  21. package/es/lazyload/vue-lazyload/lazy-image.mjs +0 -1
  22. package/es/lazyload/vue-lazyload/lazy.mjs +81 -0
  23. package/es/lazyload/vue-lazyload/listener.mjs +45 -0
  24. package/es/list/List.mjs +3 -2
  25. package/es/locale/lang/km-KH.d.ts +62 -0
  26. package/es/locale/lang/km-KH.mjs +64 -0
  27. package/es/number-keyboard/NumberKeyboard.mjs +1 -1
  28. package/es/password-input/PasswordInput.mjs +1 -1
  29. package/es/picker/Picker.mjs +1 -0
  30. package/es/popup/shared.mjs +12 -0
  31. package/es/progress/Progress.mjs +1 -1
  32. package/es/search/Search.mjs +4 -4
  33. package/es/slider/Slider.d.ts +1 -1
  34. package/es/slider/index.d.ts +1 -1
  35. package/es/stepper/Stepper.mjs +2 -2
  36. package/es/sticky/Sticky.mjs +2 -0
  37. package/es/swipe/Swipe.mjs +3 -2
  38. package/es/tabs/Tabs.mjs +1 -1
  39. package/es/tag/Tag.d.ts +1 -1
  40. package/es/tag/index.d.ts +1 -1
  41. package/es/text-ellipsis/index.css +1 -1
  42. package/es/tree-select/TreeSelect.mjs +1 -1
  43. package/es/uploader/Uploader.mjs +1 -1
  44. package/es/uploader/utils.mjs +2 -2
  45. package/lib/action-bar/index.js +4 -0
  46. package/lib/action-bar-button/index.js +4 -0
  47. package/lib/action-bar-icon/index.js +4 -0
  48. package/lib/action-sheet/index.js +4 -0
  49. package/lib/address-edit/AddressEdit.js +4 -0
  50. package/lib/address-edit/index.js +4 -0
  51. package/lib/address-list/AddressList.js +4 -0
  52. package/lib/address-list/index.js +4 -0
  53. package/lib/area/index.js +4 -0
  54. package/lib/area/utils.js +2 -2
  55. package/lib/back-top/BackTop.js +1 -1
  56. package/lib/back-top/index.js +4 -0
  57. package/lib/badge/Badge.js +1 -1
  58. package/lib/badge/index.js +4 -0
  59. package/lib/button/Button.d.ts +1 -1
  60. package/lib/button/index.d.ts +1 -1
  61. package/lib/button/index.js +4 -0
  62. package/lib/calendar/Calendar.js +6 -2
  63. package/lib/calendar/CalendarMonth.js +4 -0
  64. package/lib/calendar/index.js +4 -0
  65. package/lib/calendar/utils.js +1 -1
  66. package/lib/card/index.js +4 -0
  67. package/lib/cascader/index.js +4 -0
  68. package/lib/cell/index.js +4 -0
  69. package/lib/cell-group/index.js +4 -0
  70. package/lib/checkbox/Checkbox.js +5 -1
  71. package/lib/checkbox/index.js +4 -0
  72. package/lib/checkbox-group/index.js +4 -0
  73. package/lib/circle/index.js +4 -0
  74. package/lib/col/index.js +4 -0
  75. package/lib/collapse/index.js +4 -0
  76. package/lib/collapse-item/index.js +4 -0
  77. package/lib/config-provider/index.js +4 -0
  78. package/lib/contact-card/index.js +4 -0
  79. package/lib/contact-edit/index.js +4 -0
  80. package/lib/contact-list/index.js +4 -0
  81. package/lib/count-down/index.js +4 -0
  82. package/lib/coupon/index.js +4 -0
  83. package/lib/coupon-cell/index.js +4 -0
  84. package/lib/coupon-list/index.js +4 -0
  85. package/lib/date-picker/DatePicker.js +1 -1
  86. package/lib/date-picker/index.js +4 -0
  87. package/lib/dialog/function-call.js +4 -0
  88. package/lib/dialog/index.js +4 -0
  89. package/lib/divider/Divider.d.ts +1 -1
  90. package/lib/divider/index.d.ts +1 -1
  91. package/lib/divider/index.js +4 -0
  92. package/lib/dropdown-item/index.js +4 -0
  93. package/lib/dropdown-menu/index.js +4 -0
  94. package/lib/empty/index.js +4 -0
  95. package/lib/field/Field.js +13 -7
  96. package/lib/field/index.css +1 -1
  97. package/lib/field/index.d.ts +1 -1
  98. package/lib/field/index.js +4 -0
  99. package/lib/field/types.d.ts +2 -2
  100. package/lib/form/index.js +4 -0
  101. package/lib/grid/index.js +4 -0
  102. package/lib/grid-item/GridItem.js +1 -1
  103. package/lib/grid-item/index.js +4 -0
  104. package/lib/icon/index.js +4 -0
  105. package/lib/image/index.js +4 -0
  106. package/lib/image-preview/ImagePreview.js +4 -0
  107. package/lib/image-preview/ImagePreviewItem.js +4 -3
  108. package/lib/image-preview/function-call.js +4 -0
  109. package/lib/image-preview/index.js +4 -0
  110. package/lib/index-anchor/index.js +4 -0
  111. package/lib/index-bar/index.js +4 -0
  112. package/lib/index.css +1 -1
  113. package/lib/index.d.ts +1 -1
  114. package/lib/index.js +1 -1
  115. package/lib/lazyload/vue-lazyload/index.js +9 -0
  116. package/lib/lazyload/vue-lazyload/lazy-image.js +0 -1
  117. package/lib/lazyload/vue-lazyload/lazy.js +85 -0
  118. package/lib/lazyload/vue-lazyload/listener.js +45 -0
  119. package/lib/list/List.js +3 -2
  120. package/lib/list/index.js +4 -0
  121. package/lib/loading/index.js +4 -0
  122. package/lib/locale/index.js +4 -0
  123. package/lib/locale/lang/km-KH.d.ts +62 -0
  124. package/lib/locale/lang/km-KH.js +83 -0
  125. package/lib/nav-bar/index.js +4 -0
  126. package/lib/notice-bar/index.js +4 -0
  127. package/lib/notify/function-call.js +4 -0
  128. package/lib/notify/index.js +4 -0
  129. package/lib/number-keyboard/NumberKeyboard.js +5 -1
  130. package/lib/number-keyboard/index.js +4 -0
  131. package/lib/overlay/index.js +4 -0
  132. package/lib/pagination/index.js +4 -0
  133. package/lib/password-input/PasswordInput.js +1 -1
  134. package/lib/password-input/index.js +4 -0
  135. package/lib/picker/Picker.js +5 -0
  136. package/lib/picker/index.js +4 -0
  137. package/lib/picker-group/PickerGroup.js +4 -0
  138. package/lib/picker-group/index.js +4 -0
  139. package/lib/popover/index.js +4 -0
  140. package/lib/popup/index.js +4 -0
  141. package/lib/popup/shared.js +12 -0
  142. package/lib/progress/Progress.js +1 -1
  143. package/lib/progress/index.js +4 -0
  144. package/lib/pull-refresh/index.js +4 -0
  145. package/lib/radio/Radio.js +4 -0
  146. package/lib/radio/index.js +4 -0
  147. package/lib/radio-group/index.js +4 -0
  148. package/lib/rate/index.js +4 -0
  149. package/lib/row/index.js +4 -0
  150. package/lib/search/Search.js +4 -4
  151. package/lib/search/index.js +4 -0
  152. package/lib/share-sheet/index.js +4 -0
  153. package/lib/sidebar/index.js +4 -0
  154. package/lib/sidebar-item/index.js +4 -0
  155. package/lib/skeleton/Skeleton.js +4 -0
  156. package/lib/skeleton/index.js +4 -0
  157. package/lib/skeleton-avatar/index.js +4 -0
  158. package/lib/skeleton-image/index.js +4 -0
  159. package/lib/skeleton-paragraph/index.js +4 -0
  160. package/lib/skeleton-title/index.js +4 -0
  161. package/lib/slider/Slider.d.ts +1 -1
  162. package/lib/slider/index.d.ts +1 -1
  163. package/lib/slider/index.js +4 -0
  164. package/lib/space/index.js +4 -0
  165. package/lib/step/index.js +4 -0
  166. package/lib/stepper/Stepper.js +2 -2
  167. package/lib/stepper/index.js +4 -0
  168. package/lib/steps/index.js +4 -0
  169. package/lib/sticky/Sticky.js +2 -0
  170. package/lib/sticky/index.js +4 -0
  171. package/lib/submit-bar/index.js +4 -0
  172. package/lib/swipe/Swipe.js +3 -2
  173. package/lib/swipe/index.js +4 -0
  174. package/lib/swipe-cell/index.js +4 -0
  175. package/lib/swipe-item/index.js +4 -0
  176. package/lib/switch/index.js +4 -0
  177. package/lib/tab/index.js +4 -0
  178. package/lib/tabbar/index.js +4 -0
  179. package/lib/tabbar-item/index.js +4 -0
  180. package/lib/tabs/Tabs.js +5 -1
  181. package/lib/tabs/index.js +4 -0
  182. package/lib/tag/Tag.d.ts +1 -1
  183. package/lib/tag/index.d.ts +1 -1
  184. package/lib/tag/index.js +4 -0
  185. package/lib/text-ellipsis/index.css +1 -1
  186. package/lib/text-ellipsis/index.js +4 -0
  187. package/lib/time-picker/index.js +4 -0
  188. package/lib/toast/function-call.js +4 -0
  189. package/lib/toast/index.js +4 -0
  190. package/lib/tree-select/TreeSelect.js +1 -1
  191. package/lib/tree-select/index.js +4 -0
  192. package/lib/uploader/Uploader.js +5 -1
  193. package/lib/uploader/index.js +4 -0
  194. package/lib/uploader/utils.js +2 -2
  195. package/lib/utils/create.js +4 -0
  196. package/lib/vant.cjs.js +194 -40
  197. package/lib/vant.es.js +194 -40
  198. package/lib/vant.js +231 -47
  199. package/lib/vant.min.js +1 -1
  200. package/lib/web-types.json +1 -1
  201. package/package.json +11 -5
package/lib/vant.js CHANGED
@@ -930,7 +930,7 @@
930
930
  if (slots.content) {
931
931
  return slots.content();
932
932
  }
933
- if (isDef(max) && isNumeric(content) && +content > max) {
933
+ if (isDef(max) && isNumeric(content) && +content > +max) {
934
934
  return `${max}+`;
935
935
  }
936
936
  return content;
@@ -1437,17 +1437,29 @@
1437
1437
  });
1438
1438
  const ActionBarIcon = withInstall(stdin_default$1F);
1439
1439
  const popupSharedProps = {
1440
+ // whether to show popup
1440
1441
  show: Boolean,
1442
+ // z-index
1441
1443
  zIndex: numericProp,
1444
+ // whether to show overlay
1442
1445
  overlay: truthProp,
1446
+ // transition duration
1443
1447
  duration: numericProp,
1448
+ // teleport
1444
1449
  teleport: [String, Object],
1450
+ // prevent body scroll
1445
1451
  lockScroll: truthProp,
1452
+ // whether to lazy render
1446
1453
  lazyRender: truthProp,
1454
+ // callback function before close
1447
1455
  beforeClose: Function,
1456
+ // overlay custom style
1448
1457
  overlayStyle: Object,
1458
+ // overlay custom class name
1449
1459
  overlayClass: unknownProp,
1460
+ // Initial rendering animation
1450
1461
  transitionAppear: Boolean,
1462
+ // whether to close popup when overlay is clicked
1451
1463
  closeOnClickOverlay: truthProp
1452
1464
  };
1453
1465
  const popupSharedPropKeys = Object.keys(
@@ -2331,7 +2343,9 @@
2331
2343
  const state = vue.reactive({
2332
2344
  fixed: false,
2333
2345
  width: 0,
2346
+ // root width
2334
2347
  height: 0,
2348
+ // root height
2335
2349
  transform: 0
2336
2350
  });
2337
2351
  const offset2 = vue.computed(() => unitToPx(props.position === "top" ? props.offsetTop : props.offsetBottom));
@@ -2666,7 +2680,7 @@
2666
2680
  const stopAutoplay = () => clearTimeout(autoplayTimer);
2667
2681
  const autoplay = () => {
2668
2682
  stopAutoplay();
2669
- if (props.autoplay > 0 && count.value > 1) {
2683
+ if (+props.autoplay > 0 && count.value > 1) {
2670
2684
  autoplayTimer = setTimeout(() => {
2671
2685
  next();
2672
2686
  autoplay();
@@ -2711,7 +2725,8 @@
2711
2725
  const resize = () => initialize(state.active);
2712
2726
  let touchStartTime;
2713
2727
  const onTouchStart = (event) => {
2714
- if (!props.touchable || event.touches.length > 1)
2728
+ if (!props.touchable || // avoid resetting position on multi-finger touch
2729
+ event.touches.length > 1)
2715
2730
  return;
2716
2731
  touch.start(event);
2717
2732
  dragging = false;
@@ -2983,7 +2998,7 @@
2983
2998
  lineStyle: {},
2984
2999
  currentIndex: -1
2985
3000
  });
2986
- const scrollable = vue.computed(() => children.length > props.swipeThreshold || !props.ellipsis || props.shrink);
3001
+ const scrollable = vue.computed(() => children.length > +props.swipeThreshold || !props.ellipsis || props.shrink);
2987
3002
  const navStyle = vue.computed(() => ({
2988
3003
  borderColor: props.color,
2989
3004
  background: props.background
@@ -3677,6 +3692,7 @@
3677
3692
  vue.watch(() => props.modelValue, (newValues) => {
3678
3693
  if (!isSameValue(newValues, selectedValues.value) && !isSameValue(newValues, lastEmittedModelValue)) {
3679
3694
  selectedValues.value = newValues.slice(0);
3695
+ lastEmittedModelValue = newValues.slice(0);
3680
3696
  }
3681
3697
  }, {
3682
3698
  deep: true
@@ -3741,8 +3757,8 @@
3741
3757
  county_list: county = {},
3742
3758
  province_list: province = {}
3743
3759
  } = areaList;
3744
- const showCity = columnsNum > 1;
3745
- const showCounty = columnsNum > 2;
3760
+ const showCity = +columnsNum > 1;
3761
+ const showCounty = +columnsNum > 2;
3746
3762
  const getProvinceChildren = () => {
3747
3763
  if (showCity) {
3748
3764
  return placeholder.length ? [
@@ -4397,7 +4413,7 @@
4397
4413
  const {
4398
4414
  maxlength
4399
4415
  } = props;
4400
- if (isDef(maxlength) && getStringLength(value) > maxlength) {
4416
+ if (isDef(maxlength) && getStringLength(value) > +maxlength) {
4401
4417
  const modelValue = getModelValue();
4402
4418
  if (modelValue && getStringLength(modelValue) === +maxlength) {
4403
4419
  return modelValue;
@@ -4428,7 +4444,7 @@
4428
4444
  maxlength
4429
4445
  } = props;
4430
4446
  value = formatter(value);
4431
- if (isDef(maxlength) && getStringLength(value) > maxlength) {
4447
+ if (isDef(maxlength) && getStringLength(value) > +maxlength) {
4432
4448
  value = cutString(value, +maxlength);
4433
4449
  }
4434
4450
  if (inputRef.value && state.focused) {
@@ -4493,12 +4509,12 @@
4493
4509
  }
4494
4510
  };
4495
4511
  const onBlur = (event) => {
4496
- if (getProp("readonly")) {
4497
- return;
4498
- }
4499
4512
  state.focused = false;
4500
4513
  updateValue(getModelValue(), "onBlur");
4501
4514
  emit("blur", event);
4515
+ if (getProp("readonly")) {
4516
+ return;
4517
+ }
4502
4518
  validateWithTrigger("onBlur");
4503
4519
  vue.nextTick(adjustTextareaSize);
4504
4520
  resetScroll();
@@ -4521,7 +4537,8 @@
4521
4537
  });
4522
4538
  const labelStyle = vue.computed(() => {
4523
4539
  const labelWidth = getProp("labelWidth");
4524
- if (labelWidth) {
4540
+ const labelAlign = getProp("labelAlign");
4541
+ if (labelWidth && labelAlign !== "top") {
4525
4542
  return {
4526
4543
  width: addUnit(labelWidth)
4527
4544
  };
@@ -4631,6 +4648,8 @@
4631
4648
  }
4632
4649
  };
4633
4650
  const renderLabel = () => {
4651
+ const labelWidth = getProp("labelWidth");
4652
+ const labelAlign = getProp("labelAlign");
4634
4653
  const colon = getProp("colon") ? ":" : "";
4635
4654
  if (slots.label) {
4636
4655
  return [slots.label(), colon];
@@ -4638,7 +4657,10 @@
4638
4657
  if (props.label) {
4639
4658
  return vue.createVNode("label", {
4640
4659
  "id": `${id}-label`,
4641
- "for": getInputId()
4660
+ "for": getInputId(),
4661
+ "style": labelAlign === "top" && labelWidth ? {
4662
+ width: addUnit(labelWidth)
4663
+ } : void 0
4642
4664
  }, [props.label + colon]);
4643
4665
  }
4644
4666
  };
@@ -6019,7 +6041,7 @@
6019
6041
  });
6020
6042
  };
6021
6043
  const scroll = () => {
6022
- show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= props.offset : false;
6044
+ show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= +props.offset : false;
6023
6045
  };
6024
6046
  const getTarget = () => {
6025
6047
  const {
@@ -6102,7 +6124,7 @@
6102
6124
  const getPrevDay = (date) => getDayByOffset(date, -1);
6103
6125
  const getNextDay = (date) => getDayByOffset(date, 1);
6104
6126
  const getToday = () => {
6105
- const today = new Date();
6127
+ const today = /* @__PURE__ */ new Date();
6106
6128
  today.setHours(0, 0, 0, 0);
6107
6129
  return today;
6108
6130
  };
@@ -6740,7 +6762,7 @@
6740
6762
  rangePrompt,
6741
6763
  showRangePrompt
6742
6764
  } = props;
6743
- if (maxRange && calcDateNum(date) > maxRange) {
6765
+ if (maxRange && calcDateNum(date) > +maxRange) {
6744
6766
  if (showRangePrompt) {
6745
6767
  showToast(rangePrompt || t$f("rangePrompt", maxRange));
6746
6768
  }
@@ -6827,7 +6849,7 @@
6827
6849
  if (selectedIndex !== -1) {
6828
6850
  const [unselectedDate] = dates.splice(selectedIndex, 1);
6829
6851
  emit("unselect", cloneDate(unselectedDate));
6830
- } else if (props.maxRange && dates.length >= props.maxRange) {
6852
+ } else if (props.maxRange && dates.length >= +props.maxRange) {
6831
6853
  showToast(props.rangePrompt || t$f("rangePrompt", props.maxRange));
6832
6854
  } else {
6833
6855
  select([...dates, date]);
@@ -7554,7 +7576,7 @@
7554
7576
  } = parent.props;
7555
7577
  const value = modelValue.slice();
7556
7578
  if (checked2) {
7557
- const overlimit = max && value.length >= max;
7579
+ const overlimit = max && value.length >= +max;
7558
7580
  if (!overlimit && !value.includes(name2)) {
7559
7581
  value.push(name2);
7560
7582
  if (props.bindGroup) {
@@ -9017,7 +9039,7 @@
9017
9039
  }
9018
9040
  });
9019
9041
  const CouponList = withInstall(stdin_default$R);
9020
- const currentYear = new Date().getFullYear();
9042
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
9021
9043
  const [name$H] = createNamespace("date-picker");
9022
9044
  const datePickerProps = extend({}, sharedProps, {
9023
9045
  columnsType: {
@@ -9806,7 +9828,7 @@
9806
9828
  } else if (gutter) {
9807
9829
  const gutterValue = addUnit(gutter);
9808
9830
  style.paddingRight = gutterValue;
9809
- if (index.value >= columnNum) {
9831
+ if (index.value >= +columnNum) {
9810
9832
  style.marginTop = gutterValue;
9811
9833
  }
9812
9834
  }
@@ -10041,7 +10063,7 @@
10041
10063
  } = touch;
10042
10064
  const moveX = deltaX.value + startMoveX;
10043
10065
  const moveY = deltaY.value + startMoveY;
10044
- if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved) {
10066
+ if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved && touch.isHorizontal()) {
10045
10067
  state.moving = false;
10046
10068
  return;
10047
10069
  }
@@ -10107,8 +10129,9 @@
10107
10129
  if (state.scale < 1) {
10108
10130
  resetScale();
10109
10131
  }
10110
- if (state.scale > props.maxZoom) {
10111
- state.scale = +props.maxZoom;
10132
+ const maxZoom = +props.maxZoom;
10133
+ if (state.scale > maxZoom) {
10134
+ state.scale = maxZoom;
10112
10135
  }
10113
10136
  }
10114
10137
  }
@@ -10708,13 +10731,14 @@
10708
10731
  const scrollParent = useScrollParent(root);
10709
10732
  const check = () => {
10710
10733
  vue.nextTick(() => {
10711
- if (loading.value || props.finished || props.disabled || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
10734
+ if (loading.value || props.finished || props.disabled || props.error || // skip check when inside an inactive tab
10735
+ (tabStatus == null ? void 0 : tabStatus.value) === false) {
10712
10736
  return;
10713
10737
  }
10714
10738
  const {
10715
- offset: offset2,
10716
10739
  direction
10717
10740
  } = props;
10741
+ const offset2 = +props.offset;
10718
10742
  const scrollParentRect = useRect(scrollParent);
10719
10743
  if (!scrollParentRect.height || isHidden(root)) {
10720
10744
  return;
@@ -11347,7 +11371,7 @@
11347
11371
  emit("update:modelValue", value.slice(0, value.length - 1));
11348
11372
  } else if (type === "close") {
11349
11373
  onClose();
11350
- } else if (value.length < props.maxlength) {
11374
+ } else if (value.length < +props.maxlength) {
11351
11375
  emit("input", text);
11352
11376
  emit("update:modelValue", value + text);
11353
11377
  }
@@ -11621,10 +11645,10 @@
11621
11645
  const {
11622
11646
  mask,
11623
11647
  value,
11624
- length,
11625
11648
  gutter,
11626
11649
  focused
11627
11650
  } = props;
11651
+ const length = +props.length;
11628
11652
  for (let i = 0; i < length; i++) {
11629
11653
  const char = value[i];
11630
11654
  const showBorder = i !== 0 && !gutter;
@@ -11764,7 +11788,10 @@
11764
11788
  return element ? (element.nodeName || "").toLowerCase() : null;
11765
11789
  }
11766
11790
  function getDocumentElement(element) {
11767
- return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
11791
+ return ((isElement(element) ? element.ownerDocument : (
11792
+ // $FlowFixMe[prop-missing]
11793
+ element.document
11794
+ )) || window.document).documentElement;
11768
11795
  }
11769
11796
  function getWindowScrollBarX(element) {
11770
11797
  return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
@@ -11799,7 +11826,8 @@
11799
11826
  y: 0
11800
11827
  };
11801
11828
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
11802
- if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
11829
+ if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
11830
+ isScrollParent(documentElement)) {
11803
11831
  scroll = getNodeScroll(offsetParent);
11804
11832
  }
11805
11833
  if (isHTMLElement(offsetParent)) {
@@ -11838,7 +11866,16 @@
11838
11866
  if (getNodeName(element) === "html") {
11839
11867
  return element;
11840
11868
  }
11841
- return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
11869
+ return (
11870
+ // this is a quicker (but less type safe) way to save quite some bytes from the bundle
11871
+ // $FlowFixMe[incompatible-return]
11872
+ // $FlowFixMe[prop-missing]
11873
+ element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
11874
+ element.parentNode || // DOM Element detected
11875
+ (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
11876
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
11877
+ getDocumentElement(element)
11878
+ );
11842
11879
  }
11843
11880
  function getScrollParent(node) {
11844
11881
  if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
@@ -11859,13 +11896,17 @@
11859
11896
  var win = getWindow(scrollParent);
11860
11897
  var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
11861
11898
  var updatedList = list.concat(target);
11862
- return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
11899
+ return isBody ? updatedList : (
11900
+ // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
11901
+ updatedList.concat(listScrollParents(getParentNode(target)))
11902
+ );
11863
11903
  }
11864
11904
  function isTableElement(element) {
11865
11905
  return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
11866
11906
  }
11867
11907
  function getTrueOffsetParent(element) {
11868
- if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
11908
+ if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
11909
+ getComputedStyle(element).position === "fixed") {
11869
11910
  return null;
11870
11911
  }
11871
11912
  return element.offsetParent;
@@ -12205,6 +12246,11 @@
12205
12246
  runModifierEffects();
12206
12247
  return instance2.update();
12207
12248
  },
12249
+ // Sync update – it will always be executed, even if not necessary. This
12250
+ // is useful for low frequency updates where sync behavior simplifies the
12251
+ // logic.
12252
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
12253
+ // prefer the async Popper#update method
12208
12254
  forceUpdate: function forceUpdate() {
12209
12255
  if (isDestroyed) {
12210
12256
  return;
@@ -12250,6 +12296,8 @@
12250
12296
  }
12251
12297
  }
12252
12298
  },
12299
+ // Async and optimistically optimized update – it will not be executed if
12300
+ // not necessary (debounced to run at most once-per-tick)
12253
12301
  update: debounce(function() {
12254
12302
  return new Promise(function(resolve) {
12255
12303
  instance2.forceUpdate();
@@ -12396,13 +12444,19 @@
12396
12444
  offsetParent = offsetParent;
12397
12445
  if (placement === top || (placement === left || placement === right) && variation === end) {
12398
12446
  sideY = bottom;
12399
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
12447
+ var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
12448
+ // $FlowFixMe[prop-missing]
12449
+ offsetParent[heightProp]
12450
+ );
12400
12451
  y -= offsetY - popperRect.height;
12401
12452
  y *= gpuAcceleration ? 1 : -1;
12402
12453
  }
12403
12454
  if (placement === left || (placement === top || placement === bottom) && variation === end) {
12404
12455
  sideX = right;
12405
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
12456
+ var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
12457
+ // $FlowFixMe[prop-missing]
12458
+ offsetParent[widthProp]
12459
+ );
12406
12460
  x -= offsetX - popperRect.width;
12407
12461
  x *= gpuAcceleration ? 1 : -1;
12408
12462
  }
@@ -12786,7 +12840,7 @@
12786
12840
  percentage: {
12787
12841
  type: numericProp,
12788
12842
  default: 0,
12789
- validator: (value) => value >= 0 && value <= 100
12843
+ validator: (value) => +value >= 0 && +value <= 100
12790
12844
  }
12791
12845
  };
12792
12846
  var stdin_default$w = vue.defineComponent({
@@ -13260,7 +13314,7 @@
13260
13314
  attrs
13261
13315
  }) {
13262
13316
  const id = useId();
13263
- const filedRef = vue.ref();
13317
+ const fieldRef = vue.ref();
13264
13318
  const onCancel = () => {
13265
13319
  if (!slots.action) {
13266
13320
  emit("update:modelValue", "");
@@ -13296,11 +13350,11 @@
13296
13350
  };
13297
13351
  const blur = () => {
13298
13352
  var _a;
13299
- return (_a = filedRef.value) == null ? void 0 : _a.blur();
13353
+ return (_a = fieldRef.value) == null ? void 0 : _a.blur();
13300
13354
  };
13301
13355
  const focus = () => {
13302
13356
  var _a;
13303
- return (_a = filedRef.value) == null ? void 0 : _a.focus();
13357
+ return (_a = fieldRef.value) == null ? void 0 : _a.focus();
13304
13358
  };
13305
13359
  const onBlur = (event) => emit("blur", event);
13306
13360
  const onFocus = (event) => emit("focus", event);
@@ -13315,7 +13369,7 @@
13315
13369
  });
13316
13370
  const onInput = (value) => emit("update:modelValue", value);
13317
13371
  return vue.createVNode(Field, vue.mergeProps({
13318
- "ref": filedRef,
13372
+ "ref": fieldRef,
13319
13373
  "type": "search",
13320
13374
  "class": bem$k("field"),
13321
13375
  "border": false,
@@ -14282,8 +14336,8 @@
14282
14336
  let actionType;
14283
14337
  const inputRef = vue.ref();
14284
14338
  const current2 = vue.ref(getInitialValue());
14285
- const minusDisabled = vue.computed(() => props.disabled || props.disableMinus || current2.value <= +props.min);
14286
- const plusDisabled = vue.computed(() => props.disabled || props.disablePlus || current2.value >= +props.max);
14339
+ const minusDisabled = vue.computed(() => props.disabled || props.disableMinus || +current2.value <= +props.min);
14340
+ const plusDisabled = vue.computed(() => props.disabled || props.disablePlus || +current2.value >= +props.max);
14287
14341
  const inputStyle = vue.computed(() => ({
14288
14342
  width: addUnit(props.inputWidth),
14289
14343
  height: addUnit(props.buttonSize)
@@ -15100,7 +15154,7 @@
15100
15154
  const index = activeId.indexOf(item.id);
15101
15155
  if (index !== -1) {
15102
15156
  activeId.splice(index, 1);
15103
- } else if (activeId.length < props.max) {
15157
+ } else if (activeId.length < +props.max) {
15104
15158
  activeId.push(item.id);
15105
15159
  }
15106
15160
  } else {
@@ -15187,7 +15241,7 @@
15187
15241
  if (isFunction(maxSize)) {
15188
15242
  return maxSize(item.file);
15189
15243
  }
15190
- return item.file.size > maxSize;
15244
+ return item.file.size > +maxSize;
15191
15245
  }
15192
15246
  return false;
15193
15247
  });
@@ -15204,7 +15258,7 @@
15204
15258
  });
15205
15259
  return { valid, invalid };
15206
15260
  }
15207
- const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
15261
+ const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
15208
15262
  const isImageUrl = (url) => IMAGE_REGEXP.test(url);
15209
15263
  function isImageFile(item) {
15210
15264
  if (item.isImage) {
@@ -15521,7 +15575,7 @@
15521
15575
  };
15522
15576
  const onClickUpload = (event) => emit("clickUpload", event);
15523
15577
  const renderUpload = () => {
15524
- if (props.modelValue.length >= props.maxCount) {
15578
+ if (props.modelValue.length >= +props.maxCount) {
15525
15579
  return;
15526
15580
  }
15527
15581
  const Input = props.readonly ? null : vue.createVNode("input", {
@@ -15610,6 +15664,10 @@
15610
15664
  this.initState();
15611
15665
  this.render("loading", false);
15612
15666
  }
15667
+ /*
15668
+ * init listener state
15669
+ * @return
15670
+ */
15613
15671
  initState() {
15614
15672
  if ("dataset" in this.el) {
15615
15673
  this.el.dataset.src = this.src;
@@ -15623,9 +15681,20 @@
15623
15681
  rendered: false
15624
15682
  };
15625
15683
  }
15684
+ /*
15685
+ * record performance
15686
+ * @return
15687
+ */
15626
15688
  record(event) {
15627
15689
  this.performanceData[event] = Date.now();
15628
15690
  }
15691
+ /*
15692
+ * update image listener data
15693
+ * @param {String} image uri
15694
+ * @param {String} loading image uri
15695
+ * @param {String} error image uri
15696
+ * @return
15697
+ */
15629
15698
  update({ src, loading, error }) {
15630
15699
  const oldSrc = this.src;
15631
15700
  this.src = src;
@@ -15637,15 +15706,27 @@
15637
15706
  this.initState();
15638
15707
  }
15639
15708
  }
15709
+ /*
15710
+ * check el is in view
15711
+ * @return {Boolean} el is in view
15712
+ */
15640
15713
  checkInView() {
15641
15714
  const rect = useRect(this.el);
15642
15715
  return rect.top < window.innerHeight * this.options.preLoad && rect.bottom > this.options.preLoadTop && rect.left < window.innerWidth * this.options.preLoad && rect.right > 0;
15643
15716
  }
15717
+ /*
15718
+ * listener filter
15719
+ */
15644
15720
  filter() {
15645
15721
  Object.keys(this.options.filter).forEach((key) => {
15646
15722
  this.options.filter[key](this, this.options);
15647
15723
  });
15648
15724
  }
15725
+ /*
15726
+ * render loading first
15727
+ * @params cb:Function
15728
+ * @return
15729
+ */
15649
15730
  renderLoading(cb) {
15650
15731
  this.state.loading = true;
15651
15732
  loadImageAsync(
@@ -15664,6 +15745,10 @@
15664
15745
  }
15665
15746
  );
15666
15747
  }
15748
+ /*
15749
+ * try load image and render it
15750
+ * @return
15751
+ */
15667
15752
  load(onFinish = noop) {
15668
15753
  if (this.attempt > this.options.attempt - 1 && this.state.error) {
15669
15754
  onFinish();
@@ -15707,9 +15792,19 @@
15707
15792
  );
15708
15793
  });
15709
15794
  }
15795
+ /*
15796
+ * render image
15797
+ * @param {String} state to render // ['loading', 'src', 'error']
15798
+ * @param {String} is form cache
15799
+ * @return
15800
+ */
15710
15801
  render(state, cache) {
15711
15802
  this.elRenderer(this, state, cache);
15712
15803
  }
15804
+ /*
15805
+ * output performance data
15806
+ * @return {Object} performance data
15807
+ */
15713
15808
  performance() {
15714
15809
  let state = "loading";
15715
15810
  let time = 0;
@@ -15725,6 +15820,10 @@
15725
15820
  time
15726
15821
  };
15727
15822
  }
15823
+ /*
15824
+ * $destroy
15825
+ * @return
15826
+ */
15728
15827
  $destroy() {
15729
15828
  this.el = null;
15730
15829
  this.src = null;
@@ -15795,12 +15894,26 @@
15795
15894
  );
15796
15895
  this.setMode(this.options.observer ? modeType.observer : modeType.event);
15797
15896
  }
15897
+ /**
15898
+ * update config
15899
+ * @param {Object} config params
15900
+ * @return
15901
+ */
15798
15902
  config(options = {}) {
15799
15903
  Object.assign(this.options, options);
15800
15904
  }
15905
+ /**
15906
+ * output listener's load performance
15907
+ * @return {Array}
15908
+ */
15801
15909
  performance() {
15802
15910
  return this.listeners.map((item) => item.performance());
15803
15911
  }
15912
+ /*
15913
+ * add lazy component to queue
15914
+ * @param {Vue} vm lazy component instance
15915
+ * @return
15916
+ */
15804
15917
  addLazyBox(vm) {
15805
15918
  this.listeners.push(vm);
15806
15919
  if (inBrowser) {
@@ -15811,6 +15924,13 @@
15811
15924
  }
15812
15925
  }
15813
15926
  }
15927
+ /*
15928
+ * add image listener to queue
15929
+ * @param {DOM} el
15930
+ * @param {object} binding vue directive binding
15931
+ * @param {vnode} vnode vue directive vnode
15932
+ * @return
15933
+ */
15814
15934
  add(el, binding, vnode) {
15815
15935
  if (this.listeners.some((item) => item.el === el)) {
15816
15936
  this.update(el, binding);
@@ -15851,6 +15971,12 @@
15851
15971
  vue.nextTick(() => this.lazyLoadHandler());
15852
15972
  });
15853
15973
  }
15974
+ /**
15975
+ * update image src
15976
+ * @param {DOM} el
15977
+ * @param {object} vue directive binding
15978
+ * @return
15979
+ */
15854
15980
  update(el, binding, vnode) {
15855
15981
  const value = this.valueFormatter(binding.value);
15856
15982
  let { src } = value;
@@ -15872,6 +15998,11 @@
15872
15998
  this.lazyLoadHandler();
15873
15999
  vue.nextTick(() => this.lazyLoadHandler());
15874
16000
  }
16001
+ /**
16002
+ * remove listener form list
16003
+ * @param {DOM} el
16004
+ * @return
16005
+ */
15875
16006
  remove(el) {
15876
16007
  if (!el)
15877
16008
  return;
@@ -15884,6 +16015,11 @@
15884
16015
  existItem.$destroy();
15885
16016
  }
15886
16017
  }
16018
+ /*
16019
+ * remove lazy components form list
16020
+ * @param {Vue} vm Vue instance
16021
+ * @return
16022
+ */
15887
16023
  removeComponent(vm) {
15888
16024
  if (!vm)
15889
16025
  return;
@@ -15916,6 +16052,14 @@
15916
16052
  this.initIntersectionObserver();
15917
16053
  }
15918
16054
  }
16055
+ /*
16056
+ *** Private functions ***
16057
+ */
16058
+ /*
16059
+ * add listener target
16060
+ * @param {DOM} el listener target
16061
+ * @return
16062
+ */
15919
16063
  addListenerTarget(el) {
15920
16064
  if (!el)
15921
16065
  return;
@@ -15934,6 +16078,11 @@
15934
16078
  }
15935
16079
  return this.targetIndex;
15936
16080
  }
16081
+ /*
16082
+ * remove listener target or reduce target childrenCount
16083
+ * @param {DOM} el or window
16084
+ * @return
16085
+ */
15937
16086
  removeListenerTarget(el) {
15938
16087
  this.targets.forEach((target, index) => {
15939
16088
  if (target.el === el) {
@@ -15946,6 +16095,12 @@
15946
16095
  }
15947
16096
  });
15948
16097
  }
16098
+ /*
16099
+ * add or remove eventlistener
16100
+ * @param {DOM} el DOM or Window
16101
+ * @param {boolean} start flag
16102
+ * @return
16103
+ */
15949
16104
  initListen(el, start2) {
15950
16105
  this.options.ListenEvents.forEach(
15951
16106
  (evt) => (start2 ? on : off)(el, evt, this.lazyLoadHandler)
@@ -15986,6 +16141,10 @@
15986
16141
  this.Event.listeners[event].forEach((func) => func(context, inCache));
15987
16142
  };
15988
16143
  }
16144
+ /**
16145
+ * find nodes which in viewport and trigger load
16146
+ * @return
16147
+ */
15989
16148
  lazyLoadHandler() {
15990
16149
  const freeList = [];
15991
16150
  this.listeners.forEach((listener) => {
@@ -16002,6 +16161,11 @@
16002
16161
  item.$destroy();
16003
16162
  });
16004
16163
  }
16164
+ /**
16165
+ * init IntersectionObserver
16166
+ * set mode to observer
16167
+ * @return
16168
+ */
16005
16169
  initIntersectionObserver() {
16006
16170
  if (!hasIntersectionObserver) {
16007
16171
  return;
@@ -16016,6 +16180,10 @@
16016
16180
  });
16017
16181
  }
16018
16182
  }
16183
+ /**
16184
+ * init IntersectionObserver
16185
+ * @return
16186
+ */
16019
16187
  observerHandler(entries) {
16020
16188
  entries.forEach((entry) => {
16021
16189
  if (entry.isIntersecting) {
@@ -16029,6 +16197,13 @@
16029
16197
  }
16030
16198
  });
16031
16199
  }
16200
+ /**
16201
+ * set element attribute with image'url and state
16202
+ * @param {object} lazyload listener object
16203
+ * @param {string} state will be rendered
16204
+ * @param {bool} inCache is rendered from cache
16205
+ * @return
16206
+ */
16032
16207
  elRenderer(listener, state, cache) {
16033
16208
  if (!listener.el)
16034
16209
  return;
@@ -16060,6 +16235,11 @@
16060
16235
  el.dispatchEvent(event);
16061
16236
  }
16062
16237
  }
16238
+ /**
16239
+ * generate loading loaded error image url
16240
+ * @param {string} image's src
16241
+ * @return {object} image's loading, loaded, error url
16242
+ */
16063
16243
  valueFormatter(value) {
16064
16244
  let src = value;
16065
16245
  let { loading, error } = this.options;
@@ -16236,7 +16416,6 @@
16236
16416
  },
16237
16417
  created() {
16238
16418
  this.init();
16239
- this.renderSrc = this.options.loading;
16240
16419
  },
16241
16420
  mounted() {
16242
16421
  this.el = this.$el;
@@ -16281,6 +16460,11 @@
16281
16460
  }
16282
16461
  });
16283
16462
  const Lazyload = {
16463
+ /*
16464
+ * install function
16465
+ * @param {App} app
16466
+ * @param {object} options lazyload options
16467
+ */
16284
16468
  install(app, options = {}) {
16285
16469
  const LazyClass = stdin_default$3();
16286
16470
  const lazy = new LazyClass(options);
@@ -16304,7 +16488,7 @@
16304
16488
  });
16305
16489
  }
16306
16490
  };
16307
- const version = "4.1.0";
16491
+ const version = "4.1.2";
16308
16492
  function install(app) {
16309
16493
  const components = [
16310
16494
  ActionBar,