vant 4.0.11 → 4.1.1

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 (221) hide show
  1. package/README.md +7 -3
  2. package/es/area/utils.mjs +2 -2
  3. package/es/back-top/BackTop.mjs +1 -1
  4. package/es/badge/Badge.mjs +1 -1
  5. package/es/button/Button.d.ts +1 -1
  6. package/es/button/index.d.ts +1 -1
  7. package/es/calendar/Calendar.mjs +2 -2
  8. package/es/calendar/utils.mjs +1 -1
  9. package/es/checkbox/Checkbox.mjs +1 -1
  10. package/es/date-picker/DatePicker.mjs +1 -1
  11. package/es/divider/Divider.d.ts +1 -1
  12. package/es/divider/index.d.ts +1 -1
  13. package/es/dropdown-item/DropdownItem.mjs +1 -0
  14. package/es/dropdown-menu/DropdownMenu.mjs +2 -2
  15. package/es/dropdown-menu/types.d.ts +1 -0
  16. package/es/field/Field.mjs +2 -2
  17. package/es/field/index.css +1 -1
  18. package/es/field/index.d.ts +1 -1
  19. package/es/field/types.d.ts +2 -2
  20. package/es/grid-item/GridItem.mjs +1 -1
  21. package/es/image-preview/ImagePreviewItem.mjs +3 -2
  22. package/es/index.d.ts +2 -1
  23. package/es/index.mjs +4 -1
  24. package/es/lazyload/vue-lazyload/index.mjs +5 -0
  25. package/es/lazyload/vue-lazyload/lazy-image.mjs +0 -1
  26. package/es/lazyload/vue-lazyload/lazy.mjs +81 -0
  27. package/es/lazyload/vue-lazyload/listener.mjs +45 -0
  28. package/es/list/List.mjs +3 -2
  29. package/es/locale/lang/uk-UA.mjs +15 -15
  30. package/es/number-keyboard/NumberKeyboard.mjs +1 -1
  31. package/es/password-input/PasswordInput.mjs +1 -1
  32. package/es/picker/Picker.mjs +1 -0
  33. package/es/popup/shared.mjs +12 -0
  34. package/es/progress/Progress.mjs +1 -1
  35. package/es/search/Search.mjs +4 -4
  36. package/es/slider/Slider.d.ts +1 -1
  37. package/es/slider/index.d.ts +1 -1
  38. package/es/stepper/Stepper.mjs +2 -2
  39. package/es/sticky/Sticky.mjs +2 -0
  40. package/es/swipe/Swipe.mjs +9 -4
  41. package/es/tabs/Tabs.mjs +1 -1
  42. package/es/tag/Tag.d.ts +1 -1
  43. package/es/tag/index.d.ts +1 -1
  44. package/es/text-ellipsis/TextEllipsis.d.ts +63 -0
  45. package/es/text-ellipsis/TextEllipsis.mjs +108 -0
  46. package/es/text-ellipsis/index.css +1 -0
  47. package/es/text-ellipsis/index.d.ts +51 -0
  48. package/es/text-ellipsis/index.mjs +10 -0
  49. package/es/text-ellipsis/style/index.d.ts +1 -0
  50. package/es/text-ellipsis/style/index.mjs +2 -0
  51. package/es/text-ellipsis/types.d.ts +3 -0
  52. package/es/text-ellipsis/types.mjs +0 -0
  53. package/es/tree-select/TreeSelect.mjs +4 -3
  54. package/es/uploader/Uploader.mjs +1 -1
  55. package/es/uploader/utils.mjs +2 -2
  56. package/lib/action-bar/index.js +4 -0
  57. package/lib/action-bar-button/index.js +4 -0
  58. package/lib/action-bar-icon/index.js +4 -0
  59. package/lib/action-sheet/index.js +4 -0
  60. package/lib/address-edit/AddressEdit.js +4 -0
  61. package/lib/address-edit/index.js +4 -0
  62. package/lib/address-list/AddressList.js +4 -0
  63. package/lib/address-list/index.js +4 -0
  64. package/lib/area/index.js +4 -0
  65. package/lib/area/utils.js +2 -2
  66. package/lib/back-top/BackTop.js +1 -1
  67. package/lib/back-top/index.js +4 -0
  68. package/lib/badge/Badge.js +1 -1
  69. package/lib/badge/index.js +4 -0
  70. package/lib/button/Button.d.ts +1 -1
  71. package/lib/button/index.d.ts +1 -1
  72. package/lib/button/index.js +4 -0
  73. package/lib/calendar/Calendar.js +6 -2
  74. package/lib/calendar/CalendarMonth.js +4 -0
  75. package/lib/calendar/index.js +4 -0
  76. package/lib/calendar/utils.js +1 -1
  77. package/lib/card/index.js +4 -0
  78. package/lib/cascader/index.js +4 -0
  79. package/lib/cell/index.js +4 -0
  80. package/lib/cell-group/index.js +4 -0
  81. package/lib/checkbox/Checkbox.js +5 -1
  82. package/lib/checkbox/index.js +4 -0
  83. package/lib/checkbox-group/index.js +4 -0
  84. package/lib/circle/index.js +4 -0
  85. package/lib/col/index.js +4 -0
  86. package/lib/collapse/index.js +4 -0
  87. package/lib/collapse-item/index.js +4 -0
  88. package/lib/config-provider/index.js +4 -0
  89. package/lib/contact-card/index.js +4 -0
  90. package/lib/contact-edit/index.js +4 -0
  91. package/lib/contact-list/index.js +4 -0
  92. package/lib/count-down/index.js +4 -0
  93. package/lib/coupon/index.js +4 -0
  94. package/lib/coupon-cell/index.js +4 -0
  95. package/lib/coupon-list/index.js +4 -0
  96. package/lib/date-picker/DatePicker.js +1 -1
  97. package/lib/date-picker/index.js +4 -0
  98. package/lib/dialog/function-call.js +4 -0
  99. package/lib/dialog/index.js +4 -0
  100. package/lib/divider/Divider.d.ts +1 -1
  101. package/lib/divider/index.d.ts +1 -1
  102. package/lib/divider/index.js +4 -0
  103. package/lib/dropdown-item/DropdownItem.js +1 -0
  104. package/lib/dropdown-item/index.js +4 -0
  105. package/lib/dropdown-menu/DropdownMenu.js +2 -2
  106. package/lib/dropdown-menu/index.js +4 -0
  107. package/lib/dropdown-menu/types.d.ts +1 -0
  108. package/lib/empty/index.js +4 -0
  109. package/lib/field/Field.js +2 -2
  110. package/lib/field/index.css +1 -1
  111. package/lib/field/index.d.ts +1 -1
  112. package/lib/field/index.js +4 -0
  113. package/lib/field/types.d.ts +2 -2
  114. package/lib/form/index.js +4 -0
  115. package/lib/grid/index.js +4 -0
  116. package/lib/grid-item/GridItem.js +1 -1
  117. package/lib/grid-item/index.js +4 -0
  118. package/lib/icon/index.js +4 -0
  119. package/lib/image/index.js +4 -0
  120. package/lib/image-preview/ImagePreview.js +4 -0
  121. package/lib/image-preview/ImagePreviewItem.js +3 -2
  122. package/lib/image-preview/function-call.js +4 -0
  123. package/lib/image-preview/index.js +4 -0
  124. package/lib/index-anchor/index.js +4 -0
  125. package/lib/index-bar/index.js +4 -0
  126. package/lib/index.css +1 -1
  127. package/lib/index.d.ts +2 -1
  128. package/lib/index.js +4 -1
  129. package/lib/lazyload/vue-lazyload/index.js +9 -0
  130. package/lib/lazyload/vue-lazyload/lazy-image.js +0 -1
  131. package/lib/lazyload/vue-lazyload/lazy.js +85 -0
  132. package/lib/lazyload/vue-lazyload/listener.js +45 -0
  133. package/lib/list/List.js +3 -2
  134. package/lib/list/index.js +4 -0
  135. package/lib/loading/index.js +4 -0
  136. package/lib/locale/index.js +4 -0
  137. package/lib/locale/lang/uk-UA.js +15 -15
  138. package/lib/nav-bar/index.js +4 -0
  139. package/lib/notice-bar/index.js +4 -0
  140. package/lib/notify/function-call.js +4 -0
  141. package/lib/notify/index.js +4 -0
  142. package/lib/number-keyboard/NumberKeyboard.js +5 -1
  143. package/lib/number-keyboard/index.js +4 -0
  144. package/lib/overlay/index.js +4 -0
  145. package/lib/pagination/index.js +4 -0
  146. package/lib/password-input/PasswordInput.js +1 -1
  147. package/lib/password-input/index.js +4 -0
  148. package/lib/picker/Picker.js +5 -0
  149. package/lib/picker/index.js +4 -0
  150. package/lib/picker-group/PickerGroup.js +4 -0
  151. package/lib/picker-group/index.js +4 -0
  152. package/lib/popover/index.js +4 -0
  153. package/lib/popup/index.js +4 -0
  154. package/lib/popup/shared.js +12 -0
  155. package/lib/progress/Progress.js +1 -1
  156. package/lib/progress/index.js +4 -0
  157. package/lib/pull-refresh/index.js +4 -0
  158. package/lib/radio/Radio.js +4 -0
  159. package/lib/radio/index.js +4 -0
  160. package/lib/radio-group/index.js +4 -0
  161. package/lib/rate/index.js +4 -0
  162. package/lib/row/index.js +4 -0
  163. package/lib/search/Search.js +4 -4
  164. package/lib/search/index.js +4 -0
  165. package/lib/share-sheet/index.js +4 -0
  166. package/lib/sidebar/index.js +4 -0
  167. package/lib/sidebar-item/index.js +4 -0
  168. package/lib/skeleton/Skeleton.js +4 -0
  169. package/lib/skeleton/index.js +4 -0
  170. package/lib/skeleton-avatar/index.js +4 -0
  171. package/lib/skeleton-image/index.js +4 -0
  172. package/lib/skeleton-paragraph/index.js +4 -0
  173. package/lib/skeleton-title/index.js +4 -0
  174. package/lib/slider/Slider.d.ts +1 -1
  175. package/lib/slider/index.d.ts +1 -1
  176. package/lib/slider/index.js +4 -0
  177. package/lib/space/index.js +4 -0
  178. package/lib/step/index.js +4 -0
  179. package/lib/stepper/Stepper.js +2 -2
  180. package/lib/stepper/index.js +4 -0
  181. package/lib/steps/index.js +4 -0
  182. package/lib/sticky/Sticky.js +2 -0
  183. package/lib/sticky/index.js +4 -0
  184. package/lib/submit-bar/index.js +4 -0
  185. package/lib/swipe/Swipe.js +9 -4
  186. package/lib/swipe/index.js +4 -0
  187. package/lib/swipe-cell/index.js +4 -0
  188. package/lib/swipe-item/index.js +4 -0
  189. package/lib/switch/index.js +4 -0
  190. package/lib/tab/index.js +4 -0
  191. package/lib/tabbar/index.js +4 -0
  192. package/lib/tabbar-item/index.js +4 -0
  193. package/lib/tabs/Tabs.js +5 -1
  194. package/lib/tabs/index.js +4 -0
  195. package/lib/tag/Tag.d.ts +1 -1
  196. package/lib/tag/index.d.ts +1 -1
  197. package/lib/tag/index.js +4 -0
  198. package/lib/text-ellipsis/TextEllipsis.d.ts +63 -0
  199. package/lib/text-ellipsis/TextEllipsis.js +127 -0
  200. package/lib/text-ellipsis/index.css +1 -0
  201. package/lib/text-ellipsis/index.d.ts +51 -0
  202. package/lib/text-ellipsis/index.js +39 -0
  203. package/lib/text-ellipsis/style/index.d.ts +1 -0
  204. package/lib/text-ellipsis/style/index.js +2 -0
  205. package/lib/text-ellipsis/types.d.ts +3 -0
  206. package/lib/text-ellipsis/types.js +15 -0
  207. package/lib/time-picker/index.js +4 -0
  208. package/lib/toast/function-call.js +4 -0
  209. package/lib/toast/index.js +4 -0
  210. package/lib/tree-select/TreeSelect.js +4 -3
  211. package/lib/tree-select/index.js +4 -0
  212. package/lib/uploader/Uploader.js +5 -1
  213. package/lib/uploader/index.js +4 -0
  214. package/lib/uploader/utils.js +2 -2
  215. package/lib/utils/create.js +4 -0
  216. package/lib/vant.cjs.js +1130 -872
  217. package/lib/vant.es.js +1130 -872
  218. package/lib/vant.js +1167 -879
  219. package/lib/vant.min.js +1 -1
  220. package/lib/web-types.json +1 -1
  221. package/package.json +5 -5
@@ -2,7 +2,7 @@ var stdin_default = {
2
2
  name: "\u0406\u043C'\u044F",
3
3
  tel: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D",
4
4
  save: "\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438",
5
- confirm: "\u043F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0438",
5
+ confirm: "\u041F\u0456\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0438",
6
6
  cancel: "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438",
7
7
  delete: "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438",
8
8
  loading: "\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F...",
@@ -12,30 +12,30 @@ var stdin_default = {
12
12
  telInvalid: "\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0443",
13
13
  vanCalendar: {
14
14
  end: "\u041A\u0456\u043D\u0435\u0446\u044C",
15
- start: "\u041F\u043E\u0447\u0430\u0442\u0438",
15
+ start: "\u041F\u043E\u0447\u0430\u0442\u043E\u043A",
16
16
  title: "\u041A\u0430\u043B\u0435\u043D\u0434\u0430\u0440",
17
17
  weekdays: [
18
- "\u043D\u0435\u0434\u0456\u043B\u044F",
19
- "\u043F\u043E\u043D\u0435\u0434\u0456\u043B\u043E\u043A",
20
- "\u0432\u0456\u0432\u0442\u043E\u0440\u043E\u043A",
21
- "\u0441\u0435\u0440\u0435\u0434\u0430",
22
- "\u0447\u0435\u0442\u0432\u0435\u0440",
23
- "\u043F'\u044F\u0442\u043D\u0438\u0446\u044F",
24
- "\u0441\u0443\u0431\u043E\u0442\u0430"
18
+ "\u041D\u0434",
19
+ "\u041F\u043D",
20
+ "\u0412\u0442",
21
+ "\u0421\u0440",
22
+ "\u0427\u0442",
23
+ "\u041F\u0442",
24
+ "\u0421\u0431"
25
25
  ],
26
26
  monthTitle: (year, month) => `${year}/${month}`,
27
- rangePrompt: (maxRange) => `\u0412\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u043D\u0435 \u0431\u0456\u043B\u044C\u0448\u0435 \u043D\u0456\u0436 ${maxRange} \u0434\u043D\u0456\u0432`
27
+ rangePrompt: (maxRange) => `\u041E\u0431\u0435\u0440\u0456\u0442\u044C \u043D\u0435 \u0431\u0456\u043B\u044C\u0448\u0435 \u043D\u0456\u0436 ${maxRange} \u0434\u043D\u0456\u0432`
28
28
  },
29
29
  vanCascader: {
30
- select: "\u0412\u0438\u0431\u0440\u0430\u0442\u0438"
30
+ select: "\u041E\u0431\u0440\u0430\u0442\u0438"
31
31
  },
32
32
  vanPagination: {
33
- prev: "\u041F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u0456\u0439",
33
+ prev: "\u041F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438\u0441\u044F",
34
34
  next: "\u0414\u0430\u043B\u0456"
35
35
  },
36
36
  vanPullRefresh: {
37
37
  pulling: "\u041F\u043E\u0442\u044F\u0433\u043D\u0456\u0442\u044C, \u0449\u043E\u0431 \u043E\u043D\u043E\u0432\u0438\u0442\u0438...",
38
- loosing: "\u041F\u043E\u0433\u0430\u043D\u043E \u043E\u043D\u043E\u0432\u0438\u0442\u0438..."
38
+ loosing: "\u0412\u0456\u0434\u043F\u0443\u0441\u0442\u0456\u0442\u044C, \u0449\u043E\u0431 \u043E\u043D\u043E\u0432\u0438\u0442\u0438..."
39
39
  },
40
40
  vanSubmitBar: {
41
41
  label: "\u0423\u0441\u044C\u043E\u0433\u043E:"
@@ -54,11 +54,11 @@ var stdin_default = {
54
54
  close: "\u0417\u0430\u043A\u0440\u0438\u0442\u0438",
55
55
  enable: "\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E",
56
56
  disabled: "\u041D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E",
57
- placeholder: "\u041A\u043E\u0434 \u043A\u0443\u043F\u043E\u043D\u0430"
57
+ placeholder: "\u041A\u043E\u0434 \u043A\u0443\u043F\u043E\u043D\u0443"
58
58
  },
59
59
  vanAddressEdit: {
60
60
  area: "\u041E\u0431\u043B\u0430\u0441\u0442\u044C",
61
- areaEmpty: "\u0411\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430, \u0432\u0438\u0431\u0435\u0440\u0456\u0442\u044C \u0437\u043E\u043D\u0443 \u043F\u0440\u0438\u0439\u043E\u043C\u0443",
61
+ areaEmpty: "\u0411\u0443\u0434\u044C \u043B\u0430\u0441\u043A\u0430, \u043E\u0431\u0435\u0440\u0456\u0442\u044C \u0437\u043E\u043D\u0443 \u043F\u0440\u0438\u0439\u043E\u043C\u0443",
62
62
  addressEmpty: "\u0410\u0434\u0440\u0435\u0441\u0430 \u043D\u0435 \u043C\u043E\u0436\u0435 \u0431\u0443\u0442\u0438 \u043F\u043E\u0440\u043E\u0436\u043D\u044C\u043E\u044E",
63
63
  addressDetail: "\u0410\u0434\u0440\u0435\u0441\u0430",
64
64
  defaultAddress: "\u0412\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438 \u044F\u043A \u0430\u0434\u0440\u0435\u0441\u0443 \u0437\u0430 \u0437\u0430\u043C\u043E\u0432\u0447\u0443\u0432\u0430\u043D\u043D\u044F\u043C"
@@ -117,7 +117,7 @@ var stdin_default = defineComponent({
117
117
  emit("update:modelValue", value.slice(0, value.length - 1));
118
118
  } else if (type === "close") {
119
119
  onClose();
120
- } else if (value.length < props.maxlength) {
120
+ } else if (value.length < +props.maxlength) {
121
121
  emit("input", text);
122
122
  emit("update:modelValue", value + text);
123
123
  }
@@ -27,10 +27,10 @@ var stdin_default = defineComponent({
27
27
  const {
28
28
  mask,
29
29
  value,
30
- length,
31
30
  gutter,
32
31
  focused
33
32
  } = props;
33
+ const length = +props.length;
34
34
  for (let i = 0; i < length; i++) {
35
35
  const char = value[i];
36
36
  const showBorder = i !== 0 && !gutter;
@@ -164,6 +164,7 @@ var stdin_default = defineComponent({
164
164
  watch(() => props.modelValue, (newValues) => {
165
165
  if (!isSameValue(newValues, selectedValues.value) && !isSameValue(newValues, lastEmittedModelValue)) {
166
166
  selectedValues.value = newValues.slice(0);
167
+ lastEmittedModelValue = newValues.slice(0);
167
168
  }
168
169
  }, {
169
170
  deep: true
@@ -1,16 +1,28 @@
1
1
  import { truthProp, unknownProp, numericProp } from "../utils/index.mjs";
2
2
  const popupSharedProps = {
3
+ // whether to show popup
3
4
  show: Boolean,
5
+ // z-index
4
6
  zIndex: numericProp,
7
+ // whether to show overlay
5
8
  overlay: truthProp,
9
+ // transition duration
6
10
  duration: numericProp,
11
+ // teleport
7
12
  teleport: [String, Object],
13
+ // prevent body scroll
8
14
  lockScroll: truthProp,
15
+ // whether to lazy render
9
16
  lazyRender: truthProp,
17
+ // callback function before close
10
18
  beforeClose: Function,
19
+ // overlay custom style
11
20
  overlayStyle: Object,
21
+ // overlay custom class name
12
22
  overlayClass: unknownProp,
23
+ // Initial rendering animation
13
24
  transitionAppear: Boolean,
25
+ // whether to close popup when overlay is clicked
14
26
  closeOnClickOverlay: truthProp
15
27
  };
16
28
  const popupSharedPropKeys = Object.keys(
@@ -14,7 +14,7 @@ const progressProps = {
14
14
  percentage: {
15
15
  type: numericProp,
16
16
  default: 0,
17
- validator: (value) => value >= 0 && value <= 100
17
+ validator: (value) => +value >= 0 && +value <= 100
18
18
  }
19
19
  };
20
20
  var stdin_default = defineComponent({
@@ -25,7 +25,7 @@ var stdin_default = defineComponent({
25
25
  attrs
26
26
  }) {
27
27
  const id = useId();
28
- const filedRef = ref();
28
+ const fieldRef = ref();
29
29
  const onCancel = () => {
30
30
  if (!slots.action) {
31
31
  emit("update:modelValue", "");
@@ -61,11 +61,11 @@ var stdin_default = defineComponent({
61
61
  };
62
62
  const blur = () => {
63
63
  var _a;
64
- return (_a = filedRef.value) == null ? void 0 : _a.blur();
64
+ return (_a = fieldRef.value) == null ? void 0 : _a.blur();
65
65
  };
66
66
  const focus = () => {
67
67
  var _a;
68
- return (_a = filedRef.value) == null ? void 0 : _a.focus();
68
+ return (_a = fieldRef.value) == null ? void 0 : _a.focus();
69
69
  };
70
70
  const onBlur = (event) => emit("blur", event);
71
71
  const onFocus = (event) => emit("focus", event);
@@ -80,7 +80,7 @@ var stdin_default = defineComponent({
80
80
  });
81
81
  const onInput = (value) => emit("update:modelValue", value);
82
82
  return _createVNode(Field, _mergeProps({
83
- "ref": filedRef,
83
+ "ref": fieldRef,
84
84
  "type": "search",
85
85
  "class": bem("field"),
86
86
  "border": false,
@@ -87,9 +87,9 @@ declare const _default: import("vue").DefineComponent<{
87
87
  onDragStart?: ((...args: any[]) => any) | undefined;
88
88
  onDragEnd?: ((...args: any[]) => any) | undefined;
89
89
  }, {
90
+ reverse: boolean;
90
91
  range: boolean;
91
92
  max: string | number;
92
- reverse: boolean;
93
93
  disabled: boolean;
94
94
  modelValue: SliderValue;
95
95
  readonly: boolean;
@@ -56,9 +56,9 @@ export declare const Slider: import("../utils").WithInstall<import("vue").Define
56
56
  onDragStart?: ((...args: any[]) => any) | undefined;
57
57
  onDragEnd?: ((...args: any[]) => any) | undefined;
58
58
  }, {
59
+ reverse: boolean;
59
60
  range: boolean;
60
61
  max: string | number;
61
- reverse: boolean;
62
62
  disabled: boolean;
63
63
  modelValue: number | [number, number];
64
64
  readonly: boolean;
@@ -68,8 +68,8 @@ var stdin_default = defineComponent({
68
68
  let actionType;
69
69
  const inputRef = ref();
70
70
  const current = ref(getInitialValue());
71
- const minusDisabled = computed(() => props.disabled || props.disableMinus || current.value <= +props.min);
72
- const plusDisabled = computed(() => props.disabled || props.disablePlus || current.value >= +props.max);
71
+ const minusDisabled = computed(() => props.disabled || props.disableMinus || +current.value <= +props.min);
72
+ const plusDisabled = computed(() => props.disabled || props.disablePlus || +current.value >= +props.max);
73
73
  const inputStyle = computed(() => ({
74
74
  width: addUnit(props.inputWidth),
75
75
  height: addUnit(props.buttonSize)
@@ -24,7 +24,9 @@ var stdin_default = defineComponent({
24
24
  const state = reactive({
25
25
  fixed: false,
26
26
  width: 0,
27
+ // root width
27
28
  height: 0,
29
+ // root height
28
30
  transform: 0
29
31
  });
30
32
  const offset = computed(() => unitToPx(props.position === "top" ? props.offsetTop : props.offsetBottom));
@@ -165,7 +165,7 @@ var stdin_default = defineComponent({
165
165
  const stopAutoplay = () => clearTimeout(autoplayTimer);
166
166
  const autoplay = () => {
167
167
  stopAutoplay();
168
- if (props.autoplay > 0 && count.value > 1) {
168
+ if (+props.autoplay > 0 && count.value > 1) {
169
169
  autoplayTimer = setTimeout(() => {
170
170
  next();
171
171
  autoplay();
@@ -210,7 +210,8 @@ var stdin_default = defineComponent({
210
210
  const resize = () => initialize(state.active);
211
211
  let touchStartTime;
212
212
  const onTouchStart = (event) => {
213
- if (!props.touchable || event.touches.length > 1)
213
+ if (!props.touchable || // avoid resetting position on multi-finger touch
214
+ event.touches.length > 1)
214
215
  return;
215
216
  touch.start(event);
216
217
  dragging = false;
@@ -229,7 +230,9 @@ var stdin_default = defineComponent({
229
230
  offset: delta.value
230
231
  });
231
232
  if (!dragging) {
232
- emit("dragStart");
233
+ emit("dragStart", {
234
+ index: activeIndicator.value
235
+ });
233
236
  dragging = true;
234
237
  }
235
238
  }
@@ -262,7 +265,9 @@ var stdin_default = defineComponent({
262
265
  }
263
266
  dragging = false;
264
267
  state.swiping = false;
265
- emit("dragEnd");
268
+ emit("dragEnd", {
269
+ index: activeIndicator.value
270
+ });
266
271
  autoplay();
267
272
  };
268
273
  const swipeTo = (index, options = {}) => {
package/es/tabs/Tabs.mjs CHANGED
@@ -64,7 +64,7 @@ var stdin_default = defineComponent({
64
64
  lineStyle: {},
65
65
  currentIndex: -1
66
66
  });
67
- const scrollable = computed(() => children.length > props.swipeThreshold || !props.ellipsis || props.shrink);
67
+ const scrollable = computed(() => children.length > +props.swipeThreshold || !props.ellipsis || props.shrink);
68
68
  const navStyle = computed(() => ({
69
69
  borderColor: props.color,
70
70
  background: props.background
package/es/tag/Tag.d.ts CHANGED
@@ -56,8 +56,8 @@ declare const _default: import("vue").DefineComponent<{
56
56
  type: TagType;
57
57
  mark: boolean;
58
58
  round: boolean;
59
- show: boolean;
60
59
  plain: boolean;
60
+ show: boolean;
61
61
  closeable: boolean;
62
62
  }>;
63
63
  export default _default;
package/es/tag/index.d.ts CHANGED
@@ -36,8 +36,8 @@ export declare const Tag: import("../utils").WithInstall<import("vue").DefineCom
36
36
  type: import("./types").TagType;
37
37
  mark: boolean;
38
38
  round: boolean;
39
- show: boolean;
40
39
  plain: boolean;
40
+ show: boolean;
41
41
  closeable: boolean;
42
42
  }>>;
43
43
  export default Tag;
@@ -0,0 +1,63 @@
1
+ import { type ExtractPropTypes } from 'vue';
2
+ export declare const textEllipsisProps: {
3
+ rows: {
4
+ type: (NumberConstructor | StringConstructor)[];
5
+ default: number;
6
+ };
7
+ content: {
8
+ type: import("vue").PropType<string>;
9
+ default: string;
10
+ };
11
+ expandText: {
12
+ type: import("vue").PropType<string>;
13
+ default: string;
14
+ };
15
+ collapseText: {
16
+ type: import("vue").PropType<string>;
17
+ default: string;
18
+ };
19
+ };
20
+ export type TextEllipsisProps = ExtractPropTypes<typeof textEllipsisProps>;
21
+ declare const _default: import("vue").DefineComponent<{
22
+ rows: {
23
+ type: (NumberConstructor | StringConstructor)[];
24
+ default: number;
25
+ };
26
+ content: {
27
+ type: import("vue").PropType<string>;
28
+ default: string;
29
+ };
30
+ expandText: {
31
+ type: import("vue").PropType<string>;
32
+ default: string;
33
+ };
34
+ collapseText: {
35
+ type: import("vue").PropType<string>;
36
+ default: string;
37
+ };
38
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickAction"[], "clickAction", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
39
+ rows: {
40
+ type: (NumberConstructor | StringConstructor)[];
41
+ default: number;
42
+ };
43
+ content: {
44
+ type: import("vue").PropType<string>;
45
+ default: string;
46
+ };
47
+ expandText: {
48
+ type: import("vue").PropType<string>;
49
+ default: string;
50
+ };
51
+ collapseText: {
52
+ type: import("vue").PropType<string>;
53
+ default: string;
54
+ };
55
+ }>> & {
56
+ onClickAction?: ((...args: any[]) => any) | undefined;
57
+ }, {
58
+ content: string;
59
+ rows: string | number;
60
+ expandText: string;
61
+ collapseText: string;
62
+ }>;
63
+ export default _default;
@@ -0,0 +1,108 @@
1
+ import { createVNode as _createVNode } from "vue";
2
+ import { ref, watch, onMounted, defineComponent } from "vue";
3
+ import { useEventListener } from "@vant/use";
4
+ import { makeNumericProp, makeStringProp, createNamespace } from "../utils/index.mjs";
5
+ const [name, bem] = createNamespace("text-ellipsis");
6
+ const textEllipsisProps = {
7
+ rows: makeNumericProp(1),
8
+ content: makeStringProp(""),
9
+ expandText: makeStringProp(""),
10
+ collapseText: makeStringProp("")
11
+ };
12
+ var stdin_default = defineComponent({
13
+ name,
14
+ props: textEllipsisProps,
15
+ emits: ["clickAction"],
16
+ setup(props, {
17
+ emit
18
+ }) {
19
+ const text = ref("");
20
+ const expanded = ref(false);
21
+ const hasAction = ref(false);
22
+ const root = ref();
23
+ const pxToNum = (value) => {
24
+ if (!value)
25
+ return 0;
26
+ const match = value.match(/^\d*(\.\d*)?/);
27
+ return match ? Number(match[0]) : 0;
28
+ };
29
+ const calcEllipsised = () => {
30
+ const cloneContainer = () => {
31
+ if (!root.value)
32
+ return;
33
+ const originStyle = window.getComputedStyle(root.value);
34
+ const container2 = document.createElement("div");
35
+ const styleNames = Array.prototype.slice.apply(originStyle);
36
+ styleNames.forEach((name2) => {
37
+ container2.style.setProperty(name2, originStyle.getPropertyValue(name2));
38
+ });
39
+ container2.style.position = "fixed";
40
+ container2.style.zIndex = "-9999";
41
+ container2.style.top = "-9999px";
42
+ container2.style.height = "auto";
43
+ container2.style.minHeight = "auto";
44
+ container2.style.maxHeight = "auto";
45
+ container2.innerText = props.content;
46
+ document.body.appendChild(container2);
47
+ return container2;
48
+ };
49
+ const calcEllipsisText = (container2, maxHeight2) => {
50
+ const {
51
+ content,
52
+ expandText
53
+ } = props;
54
+ const dot = "...";
55
+ let left = 0;
56
+ let right = content.length;
57
+ let res = -1;
58
+ while (left <= right) {
59
+ const mid = Math.floor((left + right) / 2);
60
+ container2.innerText = content.slice(0, mid) + dot + expandText;
61
+ if (container2.offsetHeight <= maxHeight2) {
62
+ left = mid + 1;
63
+ res = mid;
64
+ } else {
65
+ right = mid - 1;
66
+ }
67
+ }
68
+ return content.slice(0, res) + dot;
69
+ };
70
+ const container = cloneContainer();
71
+ if (!container)
72
+ return;
73
+ const {
74
+ paddingBottom,
75
+ paddingTop,
76
+ lineHeight
77
+ } = container.style;
78
+ const maxHeight = (Number(props.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom);
79
+ if (maxHeight < container.offsetHeight) {
80
+ hasAction.value = true;
81
+ text.value = calcEllipsisText(container, maxHeight);
82
+ } else {
83
+ hasAction.value = false;
84
+ text.value = props.content;
85
+ }
86
+ document.body.removeChild(container);
87
+ };
88
+ const onClickAction = (event) => {
89
+ expanded.value = !expanded.value;
90
+ emit("clickAction", event);
91
+ };
92
+ const renderAction = () => _createVNode("span", {
93
+ "class": bem("action"),
94
+ "onClick": onClickAction
95
+ }, [expanded.value ? props.collapseText : props.expandText]);
96
+ onMounted(calcEllipsised);
97
+ watch(() => [props.content, props.rows], calcEllipsised);
98
+ useEventListener("resize", calcEllipsised);
99
+ return () => _createVNode("div", {
100
+ "ref": root,
101
+ "class": bem()
102
+ }, [expanded.value ? props.content : text.value, hasAction.value ? renderAction() : null]);
103
+ }
104
+ });
105
+ export {
106
+ stdin_default as default,
107
+ textEllipsisProps
108
+ };
@@ -0,0 +1 @@
1
+ :root{--van-text-ellipsis-line-height: 1.6;--van-text-ellipsis-action-color: var(--van-blue)}.van-text-ellipsis{line-height:var(--van-text-ellipsis-line-height);white-space:pre-wrap;word-break:break-word}.van-text-ellipsis__action{cursor:pointer;color:var(--van-text-ellipsis-action-color)}.van-text-ellipsis__action:active{opacity:var(--van-active-opacity)}
@@ -0,0 +1,51 @@
1
+ export declare const TextEllipsis: import("../utils").WithInstall<import("vue").DefineComponent<{
2
+ rows: {
3
+ type: (NumberConstructor | StringConstructor)[];
4
+ default: number;
5
+ };
6
+ content: {
7
+ type: import("vue").PropType<string>;
8
+ default: string;
9
+ };
10
+ expandText: {
11
+ type: import("vue").PropType<string>;
12
+ default: string;
13
+ };
14
+ collapseText: {
15
+ type: import("vue").PropType<string>;
16
+ default: string;
17
+ };
18
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickAction"[], "clickAction", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
19
+ rows: {
20
+ type: (NumberConstructor | StringConstructor)[];
21
+ default: number;
22
+ };
23
+ content: {
24
+ type: import("vue").PropType<string>;
25
+ default: string;
26
+ };
27
+ expandText: {
28
+ type: import("vue").PropType<string>;
29
+ default: string;
30
+ };
31
+ collapseText: {
32
+ type: import("vue").PropType<string>;
33
+ default: string;
34
+ };
35
+ }>> & {
36
+ onClickAction?: ((...args: any[]) => any) | undefined;
37
+ }, {
38
+ content: string;
39
+ rows: string | number;
40
+ expandText: string;
41
+ collapseText: string;
42
+ }>>;
43
+ export default TextEllipsis;
44
+ export { textEllipsisProps } from './TextEllipsis';
45
+ export type { TextEllipsisProps } from './TextEllipsis';
46
+ export type { TextEllipsisThemeVars } from './types';
47
+ declare module 'vue' {
48
+ interface GlobalComponents {
49
+ VanTextEllipsis: typeof TextEllipsis;
50
+ }
51
+ }
@@ -0,0 +1,10 @@
1
+ import { withInstall } from "../utils/index.mjs";
2
+ import _TextEllipsis from "./TextEllipsis.mjs";
3
+ const TextEllipsis = withInstall(_TextEllipsis);
4
+ var stdin_default = TextEllipsis;
5
+ import { textEllipsisProps } from "./TextEllipsis.mjs";
6
+ export {
7
+ TextEllipsis,
8
+ stdin_default as default,
9
+ textEllipsisProps
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import "../../style/base.css";
2
+ import "../index.css";
@@ -0,0 +1,3 @@
1
+ export type TextEllipsisThemeVars = {
2
+ textEllipsisActionColor?: string;
3
+ };
File without changes
@@ -36,7 +36,7 @@ var stdin_default = defineComponent({
36
36
  const index = activeId.indexOf(item.id);
37
37
  if (index !== -1) {
38
38
  activeId.splice(index, 1);
39
- } else if (activeId.length < props.max) {
39
+ } else if (activeId.length < +props.max) {
40
40
  activeId.push(item.id);
41
41
  }
42
42
  } else {
@@ -64,12 +64,13 @@ var stdin_default = defineComponent({
64
64
  const renderSidebar = () => {
65
65
  const Items = props.items.map((item) => _createVNode(SidebarItem, {
66
66
  "dot": item.dot,
67
- "title": item.text,
68
67
  "badge": item.badge,
69
68
  "class": [bem("nav-item"), item.className],
70
69
  "disabled": item.disabled,
71
70
  "onClick": onClickSidebarItem
72
- }, null));
71
+ }, {
72
+ title: () => slots["nav-text"] ? slots["nav-text"](item) : item.text
73
+ }));
73
74
  return _createVNode(Sidebar, {
74
75
  "class": bem("nav"),
75
76
  "modelValue": props.mainActiveIndex,
@@ -189,7 +189,7 @@ var stdin_default = defineComponent({
189
189
  };
190
190
  const onClickUpload = (event) => emit("clickUpload", event);
191
191
  const renderUpload = () => {
192
- if (props.modelValue.length >= props.maxCount) {
192
+ if (props.modelValue.length >= +props.maxCount) {
193
193
  return;
194
194
  }
195
195
  const Input = props.readonly ? null : _createVNode("input", {
@@ -23,7 +23,7 @@ function isOversize(items, maxSize) {
23
23
  if (isFunction(maxSize)) {
24
24
  return maxSize(item.file);
25
25
  }
26
- return item.file.size > maxSize;
26
+ return item.file.size > +maxSize;
27
27
  }
28
28
  return false;
29
29
  });
@@ -40,7 +40,7 @@ function filterFiles(items, maxSize) {
40
40
  });
41
41
  return { valid, invalid };
42
42
  }
43
- const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
43
+ const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
44
44
  const isImageUrl = (url) => IMAGE_REGEXP.test(url);
45
45
  function isImageFile(item) {
46
46
  if (item.isImage) {
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));