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/es/area/utils.mjs CHANGED
@@ -32,8 +32,8 @@ function formatDataForCascade({
32
32
  county_list: county = {},
33
33
  province_list: province = {}
34
34
  } = areaList;
35
- const showCity = columnsNum > 1;
36
- const showCounty = columnsNum > 2;
35
+ const showCity = +columnsNum > 1;
36
+ const showCounty = +columnsNum > 2;
37
37
  const getProvinceChildren = () => {
38
38
  if (showCity) {
39
39
  return placeholder.length ? [
@@ -43,7 +43,7 @@ var stdin_default = defineComponent({
43
43
  });
44
44
  };
45
45
  const scroll = () => {
46
- show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= props.offset : false;
46
+ show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= +props.offset : false;
47
47
  };
48
48
  const getTarget = () => {
49
49
  const {
@@ -38,7 +38,7 @@ var stdin_default = defineComponent({
38
38
  if (slots.content) {
39
39
  return slots.content();
40
40
  }
41
- if (isDef(max) && isNumeric(content) && +content > max) {
41
+ if (isDef(max) && isNumeric(content) && +content > +max) {
42
42
  return `${max}+`;
43
43
  }
44
44
  return content;
@@ -131,8 +131,8 @@ declare const _default: import("vue").DefineComponent<{
131
131
  size: ButtonSize;
132
132
  loading: boolean;
133
133
  block: boolean;
134
- square: boolean;
135
134
  plain: boolean;
135
+ square: boolean;
136
136
  hairline: boolean;
137
137
  nativeType: ButtonNativeType;
138
138
  iconPosition: ButtonIconPosition;
@@ -87,8 +87,8 @@ export declare const Button: import("../utils").WithInstall<import("vue").Define
87
87
  size: import("./types").ButtonSize;
88
88
  loading: boolean;
89
89
  block: boolean;
90
- square: boolean;
91
90
  plain: boolean;
91
+ square: boolean;
92
92
  hairline: boolean;
93
93
  nativeType: import("./types").ButtonNativeType;
94
94
  iconPosition: import("./types").ButtonIconPosition;
@@ -222,7 +222,7 @@ var stdin_default = defineComponent({
222
222
  rangePrompt,
223
223
  showRangePrompt
224
224
  } = props;
225
- if (maxRange && calcDateNum(date) > maxRange) {
225
+ if (maxRange && calcDateNum(date) > +maxRange) {
226
226
  if (showRangePrompt) {
227
227
  showToast(rangePrompt || t("rangePrompt", maxRange));
228
228
  }
@@ -309,7 +309,7 @@ var stdin_default = defineComponent({
309
309
  if (selectedIndex !== -1) {
310
310
  const [unselectedDate] = dates.splice(selectedIndex, 1);
311
311
  emit("unselect", cloneDate(unselectedDate));
312
- } else if (props.maxRange && dates.length >= props.maxRange) {
312
+ } else if (props.maxRange && dates.length >= +props.maxRange) {
313
313
  showToast(props.rangePrompt || t("rangePrompt", props.maxRange));
314
314
  } else {
315
315
  select([...dates, date]);
@@ -30,7 +30,7 @@ function getDayByOffset(date, offset) {
30
30
  const getPrevDay = (date) => getDayByOffset(date, -1);
31
31
  const getNextDay = (date) => getDayByOffset(date, 1);
32
32
  const getToday = () => {
33
- const today = new Date();
33
+ const today = /* @__PURE__ */ new Date();
34
34
  today.setHours(0, 0, 0, 0);
35
35
  return today;
36
36
  };
@@ -30,7 +30,7 @@ var stdin_default = defineComponent({
30
30
  } = parent.props;
31
31
  const value = modelValue.slice();
32
32
  if (checked2) {
33
- const overlimit = max && value.length >= max;
33
+ const overlimit = max && value.length >= +max;
34
34
  if (!overlimit && !value.includes(name2)) {
35
35
  value.push(name2);
36
36
  if (props.bindGroup) {
@@ -3,7 +3,7 @@ import { ref, watch, computed, defineComponent } from "vue";
3
3
  import { pick, extend, isDate, isSameValue, createNamespace } from "../utils/index.mjs";
4
4
  import { genOptions, sharedProps, getMonthEndDay, pickerInheritKeys, formatValueRange } from "./utils.mjs";
5
5
  import { Picker } from "../picker/index.mjs";
6
- const currentYear = new Date().getFullYear();
6
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
7
7
  const [name] = createNamespace("date-picker");
8
8
  const datePickerProps = extend({}, sharedProps, {
9
9
  columnsType: {
@@ -33,8 +33,8 @@ declare const _default: import("vue").DefineComponent<{
33
33
  default: DividerContentPosition;
34
34
  };
35
35
  }>>, {
36
- dashed: boolean;
37
36
  hairline: boolean;
37
+ dashed: boolean;
38
38
  contentPosition: DividerContentPosition;
39
39
  }>;
40
40
  export default _default;
@@ -19,8 +19,8 @@ export declare const Divider: import("../utils").WithInstall<import("vue").Defin
19
19
  default: import("./Divider").DividerContentPosition;
20
20
  };
21
21
  }>>, {
22
- dashed: boolean;
23
22
  hairline: boolean;
23
+ dashed: boolean;
24
24
  contentPosition: import("./Divider").DividerContentPosition;
25
25
  }>>;
26
26
  export default Divider;
@@ -183,7 +183,7 @@ var stdin_default = defineComponent({
183
183
  const {
184
184
  maxlength
185
185
  } = props;
186
- if (isDef(maxlength) && getStringLength(value) > maxlength) {
186
+ if (isDef(maxlength) && getStringLength(value) > +maxlength) {
187
187
  const modelValue = getModelValue();
188
188
  if (modelValue && getStringLength(modelValue) === +maxlength) {
189
189
  return modelValue;
@@ -214,7 +214,7 @@ var stdin_default = defineComponent({
214
214
  maxlength
215
215
  } = props;
216
216
  value = formatter(value);
217
- if (isDef(maxlength) && getStringLength(value) > maxlength) {
217
+ if (isDef(maxlength) && getStringLength(value) > +maxlength) {
218
218
  value = cutString(value, +maxlength);
219
219
  }
220
220
  if (inputRef.value && state.focused) {
@@ -279,12 +279,12 @@ var stdin_default = defineComponent({
279
279
  }
280
280
  };
281
281
  const onBlur = (event) => {
282
- if (getProp("readonly")) {
283
- return;
284
- }
285
282
  state.focused = false;
286
283
  updateValue(getModelValue(), "onBlur");
287
284
  emit("blur", event);
285
+ if (getProp("readonly")) {
286
+ return;
287
+ }
288
288
  validateWithTrigger("onBlur");
289
289
  nextTick(adjustTextareaSize);
290
290
  resetScroll();
@@ -307,7 +307,8 @@ var stdin_default = defineComponent({
307
307
  });
308
308
  const labelStyle = computed(() => {
309
309
  const labelWidth = getProp("labelWidth");
310
- if (labelWidth) {
310
+ const labelAlign = getProp("labelAlign");
311
+ if (labelWidth && labelAlign !== "top") {
311
312
  return {
312
313
  width: addUnit(labelWidth)
313
314
  };
@@ -417,6 +418,8 @@ var stdin_default = defineComponent({
417
418
  }
418
419
  };
419
420
  const renderLabel = () => {
421
+ const labelWidth = getProp("labelWidth");
422
+ const labelAlign = getProp("labelAlign");
420
423
  const colon = getProp("colon") ? ":" : "";
421
424
  if (slots.label) {
422
425
  return [slots.label(), colon];
@@ -424,7 +427,10 @@ var stdin_default = defineComponent({
424
427
  if (props.label) {
425
428
  return _createVNode("label", {
426
429
  "id": `${id}-label`,
427
- "for": getInputId()
430
+ "for": getInputId(),
431
+ "style": labelAlign === "top" && labelWidth ? {
432
+ width: addUnit(labelWidth)
433
+ } : void 0
428
434
  }, [props.label + colon]);
429
435
  }
430
436
  };
@@ -1 +1 @@
1
- :root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 16px;--van-field-clear-icon-size: 16px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-field--label-top .van-field__value{flex:none;width:100%}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--top{margin-bottom:var(--van-padding-base)}.van-field__label--required:before{margin-right:2px;color:var(--van-field-required-mark-color);content:"*"}.van-field--disabled .van-field__label{color:var(--van-field-disabled-text-color)}.van-field__value{overflow:visible}.van-field__body{display:flex;align-items:center}.van-field__control{display:block;box-sizing:border-box;width:100%;min-width:0;margin:0;padding:0;color:var(--van-field-input-text-color);line-height:inherit;text-align:left;background-color:transparent;border:0;resize:none;-webkit-user-select:auto;user-select:auto}.van-field__control::-webkit-input-placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control::placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control:disabled{color:var(--van-field-input-disabled-text-color);cursor:not-allowed;opacity:1;-webkit-text-fill-color:var(--van-field-input-disabled-text-color)}.van-field__control:read-only{cursor:default}.van-field__control--center{justify-content:center;text-align:center}.van-field__control--right{justify-content:flex-end;text-align:right}.van-field__control--custom{display:flex;align-items:center;min-height:var(--van-cell-line-height)}.van-field__control--error::-webkit-input-placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--error,.van-field__control--error::placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--min-height{min-height:var(--van-field-text-area-min-height)}.van-field__control[type=date],.van-field__control[type=time],.van-field__control[type=datetime-local]{min-height:var(--van-cell-line-height)}.van-field__control[type=search]{-webkit-appearance:none}.van-field__clear,.van-field__icon,.van-field__button,.van-field__right-icon{flex-shrink:0}.van-field__clear,.van-field__right-icon{margin-right:calc(var(--van-padding-xs) * -1);padding:0 var(--van-padding-xs);line-height:inherit}.van-field__clear{color:var(--van-field-clear-icon-color);font-size:var(--van-field-clear-icon-size);cursor:pointer}.van-field__left-icon .van-icon,.van-field__right-icon .van-icon{display:block;font-size:var(--van-field-icon-size);line-height:inherit}.van-field__left-icon{margin-right:var(--van-padding-base)}.van-field__right-icon{color:var(--van-field-right-icon-color)}.van-field__button{padding-left:var(--van-padding-xs)}.van-field__error-message{color:var(--van-field-error-message-color);font-size:var(--van-field-error-message-font-size);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{margin-top:var(--van-padding-base);color:var(--van-field-word-limit-color);font-size:var(--van-field-word-limit-font-size);line-height:var(--van-field-word-limit-line-height);text-align:right}
1
+ :root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 16px;--van-field-clear-icon-size: 16px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--top{display:flex;width:100%;text-align:left;margin-bottom:var(--van-padding-base);word-break:break-word}.van-field__label--required:before{margin-right:2px;color:var(--van-field-required-mark-color);content:"*"}.van-field--disabled .van-field__label{color:var(--van-field-disabled-text-color)}.van-field__value{overflow:visible}.van-field__body{display:flex;align-items:center}.van-field__control{display:block;box-sizing:border-box;width:100%;min-width:0;margin:0;padding:0;color:var(--van-field-input-text-color);line-height:inherit;text-align:left;background-color:transparent;border:0;resize:none;-webkit-user-select:auto;user-select:auto}.van-field__control::-webkit-input-placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control::placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control:disabled{color:var(--van-field-input-disabled-text-color);cursor:not-allowed;opacity:1;-webkit-text-fill-color:var(--van-field-input-disabled-text-color)}.van-field__control:read-only{cursor:default}.van-field__control--center{justify-content:center;text-align:center}.van-field__control--right{justify-content:flex-end;text-align:right}.van-field__control--custom{display:flex;align-items:center;min-height:var(--van-cell-line-height)}.van-field__control--error::-webkit-input-placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--error,.van-field__control--error::placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--min-height{min-height:var(--van-field-text-area-min-height)}.van-field__control[type=date],.van-field__control[type=time],.van-field__control[type=datetime-local]{min-height:var(--van-cell-line-height)}.van-field__control[type=search]{-webkit-appearance:none}.van-field__clear,.van-field__icon,.van-field__button,.van-field__right-icon{flex-shrink:0}.van-field__clear,.van-field__right-icon{margin-right:calc(var(--van-padding-xs) * -1);padding:0 var(--van-padding-xs);line-height:inherit}.van-field__clear{color:var(--van-field-clear-icon-color);font-size:var(--van-field-clear-icon-size);cursor:pointer}.van-field__left-icon .van-icon,.van-field__right-icon .van-icon{display:block;font-size:var(--van-field-icon-size);line-height:inherit}.van-field__left-icon{margin-right:var(--van-padding-base)}.van-field__right-icon{color:var(--van-field-right-icon-color)}.van-field__button{padding-left:var(--van-padding-xs)}.van-field__error-message{color:var(--van-field-error-message-color);font-size:var(--van-field-error-message-font-size);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{margin-top:var(--van-padding-base);color:var(--van-field-word-limit-color);font-size:var(--van-field-word-limit-font-size);line-height:var(--van-field-word-limit-line-height);text-align:right}
@@ -205,7 +205,7 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
205
205
  export default Field;
206
206
  export { fieldProps } from './Field';
207
207
  export type { FieldProps };
208
- export type { FieldType, FieldRule, FieldInstance, FieldTextAlign, FieldThemeVars, FieldRuleMessage, FieldClearTrigger, FieldFormatTrigger, FieldRuleValidator, FiledRuleFormatter, FieldValidateError, FieldAutosizeConfig, FieldValidateTrigger, FieldValidationStatus, } from './types';
208
+ export type { FieldType, FieldRule, FieldInstance, FieldTextAlign, FieldThemeVars, FieldRuleMessage, FieldClearTrigger, FieldFormatTrigger, FieldRuleValidator, FieldRuleFormatter, FieldValidateError, FieldAutosizeConfig, FieldValidateTrigger, FieldValidationStatus, } from './types';
209
209
  declare module 'vue' {
210
210
  interface GlobalComponents {
211
211
  VanField: typeof Field;
@@ -15,14 +15,14 @@ export type FieldValidateError = {
15
15
  };
16
16
  export type FieldRuleMessage = string | ((value: any, rule: FieldRule) => string);
17
17
  export type FieldRuleValidator = (value: any, rule: FieldRule) => boolean | string | Promise<boolean | string>;
18
- export type FiledRuleFormatter = (value: any, rule: FieldRule) => string;
18
+ export type FieldRuleFormatter = (value: any, rule: FieldRule) => string;
19
19
  export type FieldRule = {
20
20
  pattern?: RegExp;
21
21
  trigger?: FieldValidateTrigger | FieldValidateTrigger[];
22
22
  message?: FieldRuleMessage;
23
23
  required?: boolean;
24
24
  validator?: FieldRuleValidator;
25
- formatter?: FiledRuleFormatter;
25
+ formatter?: FieldRuleFormatter;
26
26
  validateEmpty?: boolean;
27
27
  };
28
28
  export type FieldValidationStatus = 'passed' | 'failed' | 'unvalidated';
@@ -48,7 +48,7 @@ var stdin_default = defineComponent({
48
48
  } else if (gutter) {
49
49
  const gutterValue = addUnit(gutter);
50
50
  style.paddingRight = gutterValue;
51
- if (index.value >= columnNum) {
51
+ if (index.value >= +columnNum) {
52
52
  style.marginTop = gutterValue;
53
53
  }
54
54
  }
@@ -148,7 +148,7 @@ var stdin_default = defineComponent({
148
148
  } = touch;
149
149
  const moveX = deltaX.value + startMoveX;
150
150
  const moveY = deltaY.value + startMoveY;
151
- if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved) {
151
+ if ((moveX > maxMoveX.value || moveX < -maxMoveX.value) && !isImageMoved && touch.isHorizontal()) {
152
152
  state.moving = false;
153
153
  return;
154
154
  }
@@ -214,8 +214,9 @@ var stdin_default = defineComponent({
214
214
  if (state.scale < 1) {
215
215
  resetScale();
216
216
  }
217
- if (state.scale > props.maxZoom) {
218
- state.scale = +props.maxZoom;
217
+ const maxZoom = +props.maxZoom;
218
+ if (state.scale > maxZoom) {
219
+ state.scale = maxZoom;
219
220
  }
220
221
  }
221
222
  }
package/es/index.d.ts CHANGED
@@ -99,4 +99,4 @@ declare namespace _default {
99
99
  }
100
100
  export default _default;
101
101
  export function install(app: any): void;
102
- export const version: "4.1.0";
102
+ export const version: "4.1.2";
package/es/index.mjs CHANGED
@@ -92,7 +92,7 @@ import { TimePicker } from "./time-picker/index.mjs";
92
92
  import { Toast } from "./toast/index.mjs";
93
93
  import { TreeSelect } from "./tree-select/index.mjs";
94
94
  import { Uploader } from "./uploader/index.mjs";
95
- const version = "4.1.0";
95
+ const version = "4.1.2";
96
96
  function install(app) {
97
97
  const components = [
98
98
  ActionBar,
@@ -3,6 +3,11 @@ import LazyComponent from "./lazy-component.mjs";
3
3
  import LazyContainer from "./lazy-container.mjs";
4
4
  import LazyImage from "./lazy-image.mjs";
5
5
  const Lazyload = {
6
+ /*
7
+ * install function
8
+ * @param {App} app
9
+ * @param {object} options lazyload options
10
+ */
6
11
  install(app, options = {}) {
7
12
  const LazyClass = Lazy();
8
13
  const lazy = new LazyClass(options);
@@ -46,7 +46,6 @@ var stdin_default = (lazyManager) => ({
46
46
  },
47
47
  created() {
48
48
  this.init();
49
- this.renderSrc = this.options.loading;
50
49
  },
51
50
  mounted() {
52
51
  this.el = this.$el;
@@ -75,12 +75,26 @@ function stdin_default() {
75
75
  );
76
76
  this.setMode(this.options.observer ? modeType.observer : modeType.event);
77
77
  }
78
+ /**
79
+ * update config
80
+ * @param {Object} config params
81
+ * @return
82
+ */
78
83
  config(options = {}) {
79
84
  Object.assign(this.options, options);
80
85
  }
86
+ /**
87
+ * output listener's load performance
88
+ * @return {Array}
89
+ */
81
90
  performance() {
82
91
  return this.listeners.map((item) => item.performance());
83
92
  }
93
+ /*
94
+ * add lazy component to queue
95
+ * @param {Vue} vm lazy component instance
96
+ * @return
97
+ */
84
98
  addLazyBox(vm) {
85
99
  this.listeners.push(vm);
86
100
  if (inBrowser) {
@@ -91,6 +105,13 @@ function stdin_default() {
91
105
  }
92
106
  }
93
107
  }
108
+ /*
109
+ * add image listener to queue
110
+ * @param {DOM} el
111
+ * @param {object} binding vue directive binding
112
+ * @param {vnode} vnode vue directive vnode
113
+ * @return
114
+ */
94
115
  add(el, binding, vnode) {
95
116
  if (this.listeners.some((item) => item.el === el)) {
96
117
  this.update(el, binding);
@@ -131,6 +152,12 @@ function stdin_default() {
131
152
  nextTick(() => this.lazyLoadHandler());
132
153
  });
133
154
  }
155
+ /**
156
+ * update image src
157
+ * @param {DOM} el
158
+ * @param {object} vue directive binding
159
+ * @return
160
+ */
134
161
  update(el, binding, vnode) {
135
162
  const value = this.valueFormatter(binding.value);
136
163
  let { src } = value;
@@ -152,6 +179,11 @@ function stdin_default() {
152
179
  this.lazyLoadHandler();
153
180
  nextTick(() => this.lazyLoadHandler());
154
181
  }
182
+ /**
183
+ * remove listener form list
184
+ * @param {DOM} el
185
+ * @return
186
+ */
155
187
  remove(el) {
156
188
  if (!el)
157
189
  return;
@@ -164,6 +196,11 @@ function stdin_default() {
164
196
  existItem.$destroy();
165
197
  }
166
198
  }
199
+ /*
200
+ * remove lazy components form list
201
+ * @param {Vue} vm Vue instance
202
+ * @return
203
+ */
167
204
  removeComponent(vm) {
168
205
  if (!vm)
169
206
  return;
@@ -196,6 +233,14 @@ function stdin_default() {
196
233
  this.initIntersectionObserver();
197
234
  }
198
235
  }
236
+ /*
237
+ *** Private functions ***
238
+ */
239
+ /*
240
+ * add listener target
241
+ * @param {DOM} el listener target
242
+ * @return
243
+ */
199
244
  addListenerTarget(el) {
200
245
  if (!el)
201
246
  return;
@@ -214,6 +259,11 @@ function stdin_default() {
214
259
  }
215
260
  return this.targetIndex;
216
261
  }
262
+ /*
263
+ * remove listener target or reduce target childrenCount
264
+ * @param {DOM} el or window
265
+ * @return
266
+ */
217
267
  removeListenerTarget(el) {
218
268
  this.targets.forEach((target, index) => {
219
269
  if (target.el === el) {
@@ -226,6 +276,12 @@ function stdin_default() {
226
276
  }
227
277
  });
228
278
  }
279
+ /*
280
+ * add or remove eventlistener
281
+ * @param {DOM} el DOM or Window
282
+ * @param {boolean} start flag
283
+ * @return
284
+ */
229
285
  initListen(el, start) {
230
286
  this.options.ListenEvents.forEach(
231
287
  (evt) => (start ? on : off)(el, evt, this.lazyLoadHandler)
@@ -266,6 +322,10 @@ function stdin_default() {
266
322
  this.Event.listeners[event].forEach((func) => func(context, inCache));
267
323
  };
268
324
  }
325
+ /**
326
+ * find nodes which in viewport and trigger load
327
+ * @return
328
+ */
269
329
  lazyLoadHandler() {
270
330
  const freeList = [];
271
331
  this.listeners.forEach((listener) => {
@@ -282,6 +342,11 @@ function stdin_default() {
282
342
  item.$destroy();
283
343
  });
284
344
  }
345
+ /**
346
+ * init IntersectionObserver
347
+ * set mode to observer
348
+ * @return
349
+ */
285
350
  initIntersectionObserver() {
286
351
  if (!hasIntersectionObserver) {
287
352
  return;
@@ -296,6 +361,10 @@ function stdin_default() {
296
361
  });
297
362
  }
298
363
  }
364
+ /**
365
+ * init IntersectionObserver
366
+ * @return
367
+ */
299
368
  observerHandler(entries) {
300
369
  entries.forEach((entry) => {
301
370
  if (entry.isIntersecting) {
@@ -309,6 +378,13 @@ function stdin_default() {
309
378
  }
310
379
  });
311
380
  }
381
+ /**
382
+ * set element attribute with image'url and state
383
+ * @param {object} lazyload listener object
384
+ * @param {string} state will be rendered
385
+ * @param {bool} inCache is rendered from cache
386
+ * @return
387
+ */
312
388
  elRenderer(listener, state, cache) {
313
389
  if (!listener.el)
314
390
  return;
@@ -340,6 +416,11 @@ function stdin_default() {
340
416
  el.dispatchEvent(event);
341
417
  }
342
418
  }
419
+ /**
420
+ * generate loading loaded error image url
421
+ * @param {string} image's src
422
+ * @return {object} image's loading, loaded, error url
423
+ */
343
424
  valueFormatter(value) {
344
425
  let src = value;
345
426
  let { loading, error } = this.options;
@@ -35,6 +35,10 @@ class ReactiveListener {
35
35
  this.initState();
36
36
  this.render("loading", false);
37
37
  }
38
+ /*
39
+ * init listener state
40
+ * @return
41
+ */
38
42
  initState() {
39
43
  if ("dataset" in this.el) {
40
44
  this.el.dataset.src = this.src;
@@ -48,9 +52,20 @@ class ReactiveListener {
48
52
  rendered: false
49
53
  };
50
54
  }
55
+ /*
56
+ * record performance
57
+ * @return
58
+ */
51
59
  record(event) {
52
60
  this.performanceData[event] = Date.now();
53
61
  }
62
+ /*
63
+ * update image listener data
64
+ * @param {String} image uri
65
+ * @param {String} loading image uri
66
+ * @param {String} error image uri
67
+ * @return
68
+ */
54
69
  update({ src, loading, error }) {
55
70
  const oldSrc = this.src;
56
71
  this.src = src;
@@ -62,15 +77,27 @@ class ReactiveListener {
62
77
  this.initState();
63
78
  }
64
79
  }
80
+ /*
81
+ * check el is in view
82
+ * @return {Boolean} el is in view
83
+ */
65
84
  checkInView() {
66
85
  const rect = useRect(this.el);
67
86
  return rect.top < window.innerHeight * this.options.preLoad && rect.bottom > this.options.preLoadTop && rect.left < window.innerWidth * this.options.preLoad && rect.right > 0;
68
87
  }
88
+ /*
89
+ * listener filter
90
+ */
69
91
  filter() {
70
92
  Object.keys(this.options.filter).forEach((key) => {
71
93
  this.options.filter[key](this, this.options);
72
94
  });
73
95
  }
96
+ /*
97
+ * render loading first
98
+ * @params cb:Function
99
+ * @return
100
+ */
74
101
  renderLoading(cb) {
75
102
  this.state.loading = true;
76
103
  loadImageAsync(
@@ -93,6 +120,10 @@ class ReactiveListener {
93
120
  }
94
121
  );
95
122
  }
123
+ /*
124
+ * try load image and render it
125
+ * @return
126
+ */
96
127
  load(onFinish = noop) {
97
128
  if (this.attempt > this.options.attempt - 1 && this.state.error) {
98
129
  if (process.env.NODE_ENV !== "production" && !this.options.silent) {
@@ -141,9 +172,19 @@ class ReactiveListener {
141
172
  );
142
173
  });
143
174
  }
175
+ /*
176
+ * render image
177
+ * @param {String} state to render // ['loading', 'src', 'error']
178
+ * @param {String} is form cache
179
+ * @return
180
+ */
144
181
  render(state, cache) {
145
182
  this.elRenderer(this, state, cache);
146
183
  }
184
+ /*
185
+ * output performance data
186
+ * @return {Object} performance data
187
+ */
147
188
  performance() {
148
189
  let state = "loading";
149
190
  let time = 0;
@@ -159,6 +200,10 @@ class ReactiveListener {
159
200
  time
160
201
  };
161
202
  }
203
+ /*
204
+ * $destroy
205
+ * @return
206
+ */
162
207
  $destroy() {
163
208
  this.el = null;
164
209
  this.src = null;
package/es/list/List.mjs CHANGED
@@ -33,13 +33,14 @@ var stdin_default = defineComponent({
33
33
  const scrollParent = useScrollParent(root);
34
34
  const check = () => {
35
35
  nextTick(() => {
36
- if (loading.value || props.finished || props.disabled || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
36
+ if (loading.value || props.finished || props.disabled || props.error || // skip check when inside an inactive tab
37
+ (tabStatus == null ? void 0 : tabStatus.value) === false) {
37
38
  return;
38
39
  }
39
40
  const {
40
- offset,
41
41
  direction
42
42
  } = props;
43
+ const offset = +props.offset;
43
44
  const scrollParentRect = useRect(scrollParent);
44
45
  if (!scrollParentRect.height || isHidden(root)) {
45
46
  return;
@@ -0,0 +1,62 @@
1
+ declare const _default: {
2
+ name: string;
3
+ tel: string;
4
+ save: string;
5
+ confirm: string;
6
+ cancel: string;
7
+ delete: string;
8
+ loading: string;
9
+ noCoupon: string;
10
+ nameEmpty: string;
11
+ addContact: string;
12
+ telInvalid: string;
13
+ vanCalendar: {
14
+ end: string;
15
+ start: string;
16
+ title: string;
17
+ weekdays: string[];
18
+ monthTitle: (year: number, month: number) => string;
19
+ rangePrompt: (maxRange: number) => string;
20
+ };
21
+ vanCascader: {
22
+ select: string;
23
+ };
24
+ vanPagination: {
25
+ prev: string;
26
+ next: string;
27
+ };
28
+ vanPullRefresh: {
29
+ pulling: string;
30
+ loosing: string;
31
+ };
32
+ vanSubmitBar: {
33
+ label: string;
34
+ };
35
+ vanCoupon: {
36
+ unlimited: string;
37
+ discount: (discount: number) => string;
38
+ condition: (condition: number) => string;
39
+ };
40
+ vanCouponCell: {
41
+ title: string;
42
+ count: (count: number) => string;
43
+ };
44
+ vanCouponList: {
45
+ exchange: string;
46
+ close: string;
47
+ enable: string;
48
+ disabled: string;
49
+ placeholder: string;
50
+ };
51
+ vanAddressEdit: {
52
+ area: string;
53
+ areaEmpty: string;
54
+ addressEmpty: string;
55
+ addressDetail: string;
56
+ defaultAddress: string;
57
+ };
58
+ vanAddressList: {
59
+ add: string;
60
+ };
61
+ };
62
+ export default _default;