vant 3.2.8 → 3.3.3-beta.nuxt3

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 (189) hide show
  1. package/es/address-edit/AddressEdit.js +154 -180
  2. package/es/address-edit/AddressEditDetail.d.ts +10 -9
  3. package/es/address-edit/AddressEditDetail.js +6 -6
  4. package/es/button/Button.js +2 -2
  5. package/es/calendar/Calendar.js +8 -14
  6. package/es/calendar/CalendarHeader.js +1 -3
  7. package/es/calendar/CalendarMonth.js +11 -10
  8. package/es/calendar/types.d.ts +1 -1
  9. package/es/cascader/Cascader.js +10 -2
  10. package/es/checkbox/Checker.js +1 -1
  11. package/es/checkbox/types.d.ts +2 -6
  12. package/es/composables/use-id.d.ts +1 -0
  13. package/es/composables/use-id.js +14 -0
  14. package/es/composables/use-route.d.ts +1 -1
  15. package/es/composables/use-route.js +4 -4
  16. package/es/count-down/CountDown.js +1 -0
  17. package/es/coupon-list/CouponList.js +40 -24
  18. package/es/coupon-list/index.css +1 -1
  19. package/es/coupon-list/index.less +0 -5
  20. package/es/dropdown-item/DropdownItem.js +7 -2
  21. package/es/dropdown-item/types.d.ts +2 -6
  22. package/es/dropdown-menu/DropdownMenu.js +7 -3
  23. package/es/dropdown-menu/types.d.ts +1 -0
  24. package/es/empty/Network.js +22 -34
  25. package/es/field/Field.d.ts +1 -1
  26. package/es/field/Field.js +13 -5
  27. package/es/field/index.d.ts +2 -2
  28. package/es/field/types.d.ts +7 -6
  29. package/es/form/Form.js +2 -2
  30. package/es/image/Image.js +4 -9
  31. package/es/image-preview/ImagePreview.js +3 -4
  32. package/es/index.d.ts +1 -1
  33. package/es/index.js +1 -1
  34. package/es/lazyload/index.d.ts +1 -1
  35. package/es/lazyload/index.js +1 -1
  36. package/es/lazyload/vue-lazyload/index.d.ts +55 -0
  37. package/es/lazyload/vue-lazyload/index.js +46 -0
  38. package/es/lazyload/vue-lazyload/lazy-component.js +53 -0
  39. package/es/lazyload/vue-lazyload/lazy-container.js +98 -0
  40. package/es/lazyload/vue-lazyload/lazy-image.js +115 -0
  41. package/es/lazyload/vue-lazyload/lazy.js +507 -0
  42. package/es/lazyload/vue-lazyload/listener.js +241 -0
  43. package/es/lazyload/vue-lazyload/util.js +183 -0
  44. package/es/list/List.js +3 -1
  45. package/es/locale/lang/pt-BR.d.ts +73 -0
  46. package/es/locale/lang/pt-BR.js +72 -0
  47. package/es/number-keyboard/NumberKeyboardKey.js +4 -4
  48. package/es/pagination/Pagination.js +67 -49
  49. package/es/pagination/index.css +1 -1
  50. package/es/pagination/index.less +32 -31
  51. package/es/password-input/PasswordInput.d.ts +1 -1
  52. package/es/password-input/index.d.ts +1 -1
  53. package/es/popover/Popover.js +2 -0
  54. package/es/popup/Popup.d.ts +1 -2
  55. package/es/popup/Popup.js +2 -5
  56. package/es/popup/index.d.ts +1 -2
  57. package/es/rate/Rate.js +5 -3
  58. package/es/search/Search.js +8 -2
  59. package/es/sidebar/Sidebar.js +1 -0
  60. package/es/sidebar-item/SidebarItem.js +4 -1
  61. package/es/slider/Slider.js +5 -3
  62. package/es/stepper/Stepper.js +11 -8
  63. package/es/swipe/Swipe.js +11 -6
  64. package/es/swipe/index.css +1 -1
  65. package/es/swipe/index.less +2 -0
  66. package/es/swipe/types.d.ts +1 -3
  67. package/es/switch/Switch.js +1 -0
  68. package/es/switch/index.css +1 -1
  69. package/es/switch/index.less +2 -0
  70. package/es/tab/Tab.js +18 -5
  71. package/es/tab/index.css +1 -1
  72. package/es/tab/index.less +1 -1
  73. package/es/tabbar/Tabbar.d.ts +1 -1
  74. package/es/tabbar/Tabbar.js +10 -10
  75. package/es/tabbar-item/TabbarItem.js +16 -7
  76. package/es/tabs/Tabs.js +10 -5
  77. package/es/tabs/TabsTitle.d.ts +6 -0
  78. package/es/tabs/TabsTitle.js +7 -1
  79. package/es/tabs/types.d.ts +1 -0
  80. package/es/uploader/UploaderPreviewItem.js +4 -1
  81. package/es/uploader/utils.d.ts +2 -2
  82. package/es/uploader/utils.js +2 -2
  83. package/es/utils/dom.d.ts +1 -0
  84. package/es/utils/dom.js +6 -2
  85. package/es/utils/format.js +6 -5
  86. package/es/vue-tsx-shim.d.ts +1 -0
  87. package/lib/address-edit/AddressEdit.js +155 -180
  88. package/lib/address-edit/AddressEditDetail.d.ts +10 -9
  89. package/lib/address-edit/AddressEditDetail.js +6 -6
  90. package/lib/button/Button.js +1 -1
  91. package/lib/calendar/Calendar.js +8 -14
  92. package/lib/calendar/CalendarHeader.js +1 -3
  93. package/lib/calendar/CalendarMonth.js +11 -10
  94. package/lib/calendar/types.d.ts +1 -1
  95. package/lib/cascader/Cascader.js +10 -2
  96. package/lib/checkbox/Checker.js +1 -1
  97. package/lib/checkbox/types.d.ts +2 -6
  98. package/lib/composables/use-id.d.ts +1 -0
  99. package/lib/composables/use-id.js +21 -0
  100. package/lib/composables/use-route.d.ts +1 -1
  101. package/lib/composables/use-route.js +4 -4
  102. package/lib/count-down/CountDown.js +1 -0
  103. package/lib/coupon-list/CouponList.js +39 -22
  104. package/lib/coupon-list/index.css +1 -1
  105. package/lib/coupon-list/index.less +0 -5
  106. package/lib/dropdown-item/DropdownItem.js +7 -2
  107. package/lib/dropdown-item/types.d.ts +2 -6
  108. package/lib/dropdown-menu/DropdownMenu.js +7 -2
  109. package/lib/dropdown-menu/types.d.ts +1 -0
  110. package/lib/empty/Network.js +22 -34
  111. package/lib/field/Field.d.ts +1 -1
  112. package/lib/field/Field.js +14 -5
  113. package/lib/field/index.d.ts +2 -2
  114. package/lib/field/types.d.ts +7 -6
  115. package/lib/form/Form.js +1 -1
  116. package/lib/image/Image.js +4 -9
  117. package/lib/image-preview/ImagePreview.js +1 -2
  118. package/lib/index.css +1 -1
  119. package/lib/index.d.ts +1 -1
  120. package/lib/index.js +1 -1
  121. package/lib/lazyload/index.d.ts +1 -1
  122. package/lib/lazyload/index.js +3 -3
  123. package/lib/lazyload/vue-lazyload/index.d.ts +55 -0
  124. package/lib/lazyload/vue-lazyload/index.js +58 -0
  125. package/lib/lazyload/vue-lazyload/lazy-component.js +62 -0
  126. package/lib/lazyload/vue-lazyload/lazy-container.js +106 -0
  127. package/lib/lazyload/vue-lazyload/lazy-image.js +125 -0
  128. package/lib/lazyload/vue-lazyload/lazy.js +520 -0
  129. package/lib/lazyload/vue-lazyload/listener.js +251 -0
  130. package/lib/lazyload/vue-lazyload/util.js +213 -0
  131. package/lib/list/List.js +3 -1
  132. package/lib/locale/lang/pt-BR.d.ts +73 -0
  133. package/lib/locale/lang/pt-BR.js +77 -0
  134. package/lib/number-keyboard/NumberKeyboardKey.js +3 -3
  135. package/lib/pagination/Pagination.js +65 -47
  136. package/lib/pagination/index.css +1 -1
  137. package/lib/pagination/index.less +32 -31
  138. package/lib/password-input/PasswordInput.d.ts +1 -1
  139. package/lib/password-input/index.d.ts +1 -1
  140. package/lib/popover/Popover.js +2 -0
  141. package/lib/popup/Popup.d.ts +1 -2
  142. package/lib/popup/Popup.js +2 -5
  143. package/lib/popup/index.d.ts +1 -2
  144. package/lib/rate/Rate.js +5 -3
  145. package/lib/search/Search.js +9 -2
  146. package/lib/sidebar/Sidebar.js +1 -0
  147. package/lib/sidebar-item/SidebarItem.js +4 -1
  148. package/lib/slider/Slider.js +5 -3
  149. package/lib/ssr.js +7 -0
  150. package/lib/ssr.mjs +1 -0
  151. package/lib/stepper/Stepper.js +11 -8
  152. package/lib/swipe/Swipe.js +9 -4
  153. package/lib/swipe/index.css +1 -1
  154. package/lib/swipe/index.less +2 -0
  155. package/lib/swipe/types.d.ts +1 -3
  156. package/lib/switch/Switch.js +1 -0
  157. package/lib/switch/index.css +1 -1
  158. package/lib/switch/index.less +2 -0
  159. package/lib/tab/Tab.js +20 -5
  160. package/lib/tab/index.css +1 -1
  161. package/lib/tab/index.less +1 -1
  162. package/lib/tabbar/Tabbar.d.ts +1 -1
  163. package/lib/tabbar/Tabbar.js +10 -10
  164. package/lib/tabbar-item/TabbarItem.js +16 -7
  165. package/lib/tabs/Tabs.js +9 -3
  166. package/lib/tabs/TabsTitle.d.ts +6 -0
  167. package/lib/tabs/TabsTitle.js +7 -1
  168. package/lib/tabs/types.d.ts +1 -0
  169. package/lib/uploader/UploaderPreviewItem.js +3 -0
  170. package/lib/uploader/utils.d.ts +2 -2
  171. package/lib/uploader/utils.js +3 -2
  172. package/lib/utils/dom.d.ts +1 -0
  173. package/lib/utils/dom.js +9 -2
  174. package/lib/utils/format.js +7 -5
  175. package/lib/vant.cjs.js +14407 -0
  176. package/lib/vant.cjs.min.js +1 -0
  177. package/lib/vant.es.js +1125 -2186
  178. package/lib/vant.es.min.js +1125 -2186
  179. package/lib/vant.js +1109 -1089
  180. package/lib/vant.min.js +1 -1
  181. package/lib/vue-tsx-shim.d.ts +1 -0
  182. package/package.json +26 -11
  183. package/vetur/attributes.json +557 -557
  184. package/vetur/tags.json +183 -183
  185. package/vetur/web-types.json +1577 -1577
  186. package/es/composables/use-link-field.d.ts +0 -0
  187. package/es/composables/use-link-field.js +0 -0
  188. package/lib/composables/use-link-field.d.ts +0 -0
  189. package/lib/composables/use-link-field.js +0 -1
package/es/tab/Tab.js CHANGED
@@ -5,6 +5,8 @@ import { extend, truthProp, unknownProp, numericProp, createNamespace } from '..
5
5
  import { TABS_KEY } from '../tabs/Tabs'; // Composables
6
6
 
7
7
  import { useParent } from '@vant/use';
8
+ import { useId } from '../composables/use-id';
9
+ import { useExpose } from '../composables/use-expose';
8
10
  import { routeProps } from '../composables/use-route';
9
11
  import { TAB_STATUS_KEY } from '../composables/use-tab-status'; // Components
10
12
 
@@ -28,6 +30,7 @@ export default defineComponent({
28
30
  var {
29
31
  slots
30
32
  } = _ref;
33
+ var id = useId();
31
34
  var inited = ref(false);
32
35
  var {
33
36
  parent,
@@ -73,6 +76,7 @@ export default defineComponent({
73
76
  });
74
77
  provide(TAB_STATUS_KEY, active);
75
78
  return () => {
79
+ var label = parent.id + "-" + index.value;
76
80
  var {
77
81
  animated,
78
82
  swipeable,
@@ -88,23 +92,32 @@ export default defineComponent({
88
92
 
89
93
  if (animated || swipeable) {
90
94
  return _createVNode(SwipeItem, {
95
+ "id": id,
91
96
  "role": "tabpanel",
92
- "aria-hidden": !active.value,
93
- "class": bem('pane-wrapper', {
97
+ "class": bem('panel-wrapper', {
94
98
  inactive: !active.value
95
- })
99
+ }),
100
+ "tabindex": active.value ? 0 : -1,
101
+ "aria-hidden": !active.value,
102
+ "aria-labelledby": label
96
103
  }, {
97
104
  default: () => [_createVNode("div", {
98
- "class": bem('pane')
105
+ "class": bem('panel')
99
106
  }, [slots.default == null ? void 0 : slots.default()])]
100
107
  });
101
108
  }
102
109
 
103
110
  var shouldRender = inited.value || scrollspy || !lazyRender;
104
111
  var Content = shouldRender ? slots.default == null ? void 0 : slots.default() : null;
112
+ useExpose({
113
+ id
114
+ });
105
115
  return _withDirectives(_createVNode("div", {
116
+ "id": id,
106
117
  "role": "tabpanel",
107
- "class": bem('pane')
118
+ "class": bem('panel'),
119
+ "tabindex": show ? 0 : -1,
120
+ "aria-labelledby": label
108
121
  }, [Content]), [[_vShow, show]]);
109
122
  };
110
123
  }
package/es/tab/index.css CHANGED
@@ -1 +1 @@
1
- .van-tab__pane,.van-tab__pane-wrapper{flex-shrink:0;box-sizing:border-box;width:100%}.van-tab__pane-wrapper--inactive{height:0;overflow:visible}
1
+ .van-tab__panel,.van-tab__panel-wrapper{flex-shrink:0;box-sizing:border-box;width:100%}.van-tab__panel-wrapper--inactive{height:0;overflow:visible}
package/es/tab/index.less CHANGED
@@ -1,5 +1,5 @@
1
1
  .van-tab {
2
- &__pane {
2
+ &__panel {
3
3
  &,
4
4
  &-wrapper {
5
5
  flex-shrink: 0;
@@ -27,7 +27,7 @@ declare const tabbarProps: {
27
27
  export declare type TabbarProps = ExtractPropTypes<typeof tabbarProps>;
28
28
  export declare type TabbarProvide = {
29
29
  props: TabbarProps;
30
- setActive: (active: number | string) => void;
30
+ setActive: (active: number | string, afterChange: () => void) => void;
31
31
  };
32
32
  export declare const TABBAR_KEY: InjectionKey<TabbarProvide>;
33
33
  declare const _default: import("vue").DefineComponent<{
@@ -52,6 +52,7 @@ export default defineComponent({
52
52
  } = props;
53
53
  return _createVNode("div", {
54
54
  "ref": root,
55
+ "role": "tablist",
55
56
  "style": getZIndexStyle(zIndex),
56
57
  "class": [bem({
57
58
  fixed
@@ -62,18 +63,17 @@ export default defineComponent({
62
63
  }, [slots.default == null ? void 0 : slots.default()]);
63
64
  };
64
65
 
65
- var setActive = active => {
66
- if (active !== props.modelValue) {
67
- callInterceptor(props.beforeChange, {
68
- args: [active],
66
+ var setActive = (active, afterChange) => {
67
+ callInterceptor(props.beforeChange, {
68
+ args: [active],
69
69
 
70
- done() {
71
- emit('update:modelValue', active);
72
- emit('change', active);
73
- }
70
+ done() {
71
+ emit('update:modelValue', active);
72
+ emit('change', active);
73
+ afterChange();
74
+ }
74
75
 
75
- });
76
- }
76
+ });
77
77
  };
78
78
 
79
79
  linkChildren({
@@ -43,6 +43,8 @@ export default defineComponent({
43
43
  }
44
44
 
45
45
  var active = computed(() => {
46
+ var _props$name;
47
+
46
48
  var {
47
49
  route,
48
50
  modelValue
@@ -58,20 +60,24 @@ export default defineComponent({
58
60
  var config = isObject(to) ? to : {
59
61
  path: to
60
62
  };
61
- var pathMatched = 'path' in config && config.path === $route.path;
62
- var nameMatched = 'name' in config && config.name === $route.name;
63
- return pathMatched || nameMatched;
63
+ return !!$route.matched.find(val => {
64
+ var pathMatched = 'path' in config && config.path === val.path;
65
+ var nameMatched = 'name' in config && config.name === val.name;
66
+ return pathMatched || nameMatched;
67
+ });
64
68
  }
65
69
 
66
- return (props.name || index.value) === modelValue;
70
+ return ((_props$name = props.name) != null ? _props$name : index.value) === modelValue;
67
71
  });
68
72
 
69
73
  var onClick = event => {
70
- var _props$name;
74
+ if (!active.value) {
75
+ var _props$name2;
76
+
77
+ parent.setActive((_props$name2 = props.name) != null ? _props$name2 : index.value, route);
78
+ }
71
79
 
72
- parent.setActive((_props$name = props.name) != null ? _props$name : index.value);
73
80
  emit('click', event);
74
- route();
75
81
  };
76
82
 
77
83
  var renderIcon = () => {
@@ -100,12 +106,15 @@ export default defineComponent({
100
106
  } = parent.props;
101
107
  var color = active.value ? activeColor : inactiveColor;
102
108
  return _createVNode("div", {
109
+ "role": "tab",
103
110
  "class": bem({
104
111
  active: active.value
105
112
  }),
106
113
  "style": {
107
114
  color
108
115
  },
116
+ "tabindex": 0,
117
+ "aria-selected": active.value,
109
118
  "onClick": onClick
110
119
  }, [_createVNode(Badge, {
111
120
  "dot": dot,
package/es/tabs/Tabs.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
2
  import { ref, watch, computed, reactive, nextTick, onActivated, defineComponent, getCurrentInstance } from 'vue'; // Utils
3
3
 
4
- import { pick, isDef, addUnit, isHidden, unitToPx, truthProp, numericProp, getElementTop, makeStringProp, callInterceptor, createNamespace, makeNumericProp, setRootScrollTop, BORDER_TOP_BOTTOM } from '../utils';
4
+ import { pick, isDef, addUnit, isHidden, unitToPx, truthProp, numericProp, windowWidth, getElementTop, makeStringProp, callInterceptor, createNamespace, makeNumericProp, setRootScrollTop, BORDER_TOP_BOTTOM } from '../utils';
5
5
  import { scrollLeftTo, scrollTopTo } from './utils'; // Composables
6
6
 
7
- import { useRect, useChildren, useWindowSize, useScrollParent, useEventListener, onMountedOrActivated } from '@vant/use';
7
+ import { useRect, useChildren, useScrollParent, useEventListener, onMountedOrActivated } from '@vant/use';
8
+ import { useId } from '../composables/use-id';
8
9
  import { route } from '../composables/use-route';
9
10
  import { useRefs } from '../composables/use-refs';
10
11
  import { useExpose } from '../composables/use-expose';
@@ -68,7 +69,7 @@ export default defineComponent({
68
69
  var root = ref();
69
70
  var navRef = ref();
70
71
  var wrapRef = ref();
71
- var windowSize = useWindowSize();
72
+ var id = useId();
72
73
  var scroller = useScrollParent(root);
73
74
  var [titleRefs, setTitleRefs] = useRefs();
74
75
  var {
@@ -285,12 +286,14 @@ export default defineComponent({
285
286
  };
286
287
 
287
288
  var renderNav = () => children.map((item, index) => _createVNode(TabsTitle, _mergeProps({
289
+ "id": id + "-" + index,
288
290
  "ref": setTitleRefs(index),
289
291
  "type": props.type,
290
292
  "color": props.color,
291
293
  "style": item.titleStyle,
292
294
  "class": item.titleClass,
293
295
  "isActive": index === state.currentIndex,
296
+ "controls": item.id,
294
297
  "scrollable": scrollable.value,
295
298
  "renderTitle": item.$slots.title,
296
299
  "activeColor": props.titleActiveColor,
@@ -318,14 +321,15 @@ export default defineComponent({
318
321
  "class": bem('nav', [type, {
319
322
  complete: scrollable.value
320
323
  }]),
321
- "style": navStyle.value
324
+ "style": navStyle.value,
325
+ "aria-orientation": "horizontal"
322
326
  }, [(_slots$navLeft = slots['nav-left']) == null ? void 0 : _slots$navLeft.call(slots), renderNav(), type === 'line' && _createVNode("div", {
323
327
  "class": bem('line'),
324
328
  "style": state.lineStyle
325
329
  }, null), (_slots$navRight = slots['nav-right']) == null ? void 0 : _slots$navRight.call(slots)])]);
326
330
  };
327
331
 
328
- watch([() => props.color, windowSize.width], setLine);
332
+ watch([() => props.color, windowWidth], setLine);
329
333
  watch(() => props.active, value => {
330
334
  if (value !== currentName.value) {
331
335
  setCurrentIndexByName(value);
@@ -375,6 +379,7 @@ export default defineComponent({
375
379
  target: scroller
376
380
  });
377
381
  linkChildren({
382
+ id,
378
383
  props,
379
384
  setLine,
380
385
  onRendered,
@@ -1,4 +1,5 @@
1
1
  declare const _default: import("vue").DefineComponent<{
2
+ id: StringConstructor;
2
3
  dot: BooleanConstructor;
3
4
  type: StringConstructor;
4
5
  color: StringConstructor;
@@ -6,6 +7,7 @@ declare const _default: import("vue").DefineComponent<{
6
7
  badge: (NumberConstructor | StringConstructor)[];
7
8
  isActive: BooleanConstructor;
8
9
  disabled: BooleanConstructor;
10
+ controls: StringConstructor;
9
11
  scrollable: BooleanConstructor;
10
12
  activeColor: StringConstructor;
11
13
  renderTitle: FunctionConstructor;
@@ -15,6 +17,7 @@ declare const _default: import("vue").DefineComponent<{
15
17
  default: true;
16
18
  };
17
19
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<{
20
+ id?: unknown;
18
21
  dot?: unknown;
19
22
  type?: unknown;
20
23
  color?: unknown;
@@ -22,6 +25,7 @@ declare const _default: import("vue").DefineComponent<{
22
25
  badge?: unknown;
23
26
  isActive?: unknown;
24
27
  disabled?: unknown;
28
+ controls?: unknown;
25
29
  scrollable?: unknown;
26
30
  activeColor?: unknown;
27
31
  renderTitle?: unknown;
@@ -38,6 +42,8 @@ declare const _default: import("vue").DefineComponent<{
38
42
  badge?: string | number | undefined;
39
43
  title?: string | undefined;
40
44
  color?: string | undefined;
45
+ controls?: string | undefined;
46
+ id?: string | undefined;
41
47
  activeColor?: string | undefined;
42
48
  inactiveColor?: string | undefined;
43
49
  renderTitle?: Function | undefined;
@@ -6,6 +6,7 @@ var [name, bem] = createNamespace('tab');
6
6
  export default defineComponent({
7
7
  name,
8
8
  props: {
9
+ id: String,
9
10
  dot: Boolean,
10
11
  type: String,
11
12
  color: String,
@@ -13,6 +14,7 @@ export default defineComponent({
13
14
  badge: numericProp,
14
15
  isActive: Boolean,
15
16
  disabled: Boolean,
17
+ controls: String,
16
18
  scrollable: Boolean,
17
19
  activeColor: String,
18
20
  renderTitle: Function,
@@ -75,13 +77,17 @@ export default defineComponent({
75
77
  };
76
78
 
77
79
  return () => _createVNode("div", {
80
+ "id": props.id,
78
81
  "role": "tab",
79
82
  "class": [bem({
80
83
  active: props.isActive,
81
84
  disabled: props.disabled
82
85
  })],
83
86
  "style": style.value,
84
- "aria-selected": props.isActive
87
+ "tabindex": props.disabled ? undefined : props.isActive ? 0 : -1,
88
+ "aria-selected": props.isActive,
89
+ "aria-disabled": props.disabled || undefined,
90
+ "aria-controls": props.controls
85
91
  }, [renderText()]);
86
92
  }
87
93
 
@@ -8,6 +8,7 @@ export declare type TabsClickTabEventParams = {
8
8
  disabled: boolean;
9
9
  };
10
10
  export declare type TabsProvide = {
11
+ id: string;
11
12
  props: TabsProps;
12
13
  setLine: () => void;
13
14
  onRendered: (name: string | number, title?: string) => void;
@@ -1,7 +1,7 @@
1
1
  import { resolveDirective as _resolveDirective, createVNode as _createVNode } from "vue";
2
2
  import { defineComponent } from 'vue'; // Utils
3
3
 
4
- import { bem, isImageFile } from './utils';
4
+ import { t, bem, isImageFile } from './utils';
5
5
  import { isDef, extend, numericProp, getSizeStyle, callInterceptor, makeRequiredProp } from '../utils'; // Components
6
6
 
7
7
  import { Icon } from '../icon';
@@ -71,7 +71,10 @@ export default defineComponent({
71
71
  var renderDeleteIcon = () => {
72
72
  if (props.deletable && props.item.status !== 'uploading') {
73
73
  return _createVNode("div", {
74
+ "role": "button",
74
75
  "class": bem('preview-delete'),
76
+ "tabindex": 0,
77
+ "aria-label": t('delete'),
75
78
  "onClick": onDelete
76
79
  }, [_createVNode(Icon, {
77
80
  "name": "cross",
@@ -1,6 +1,6 @@
1
1
  import type { UploaderMaxSize, UploaderResultType, UploaderFileListItem } from './types';
2
- declare const name: string, bem: (el?: import("../utils").Mods | undefined, mods?: import("../utils").Mods | undefined) => import("../utils").Mods;
3
- export { name, bem };
2
+ declare const name: string, bem: (el?: import("../utils").Mods | undefined, mods?: import("../utils").Mods | undefined) => import("../utils").Mods, t: (path: string, ...args: unknown[]) => any;
3
+ export { name, bem, t };
4
4
  export declare const toArray: <T>(item: T | T[]) => T[];
5
5
  export declare function readFileContent(file: File, resultType: UploaderResultType): Promise<string | void>;
6
6
  export declare function isOversize(items: UploaderFileListItem | UploaderFileListItem[], maxSize: UploaderMaxSize): boolean;
@@ -1,6 +1,6 @@
1
1
  import { createNamespace, isFunction } from '../utils';
2
- var [name, bem] = createNamespace('uploader');
3
- export { name, bem };
2
+ var [name, bem, t] = createNamespace('uploader');
3
+ export { name, bem, t };
4
4
  export var toArray = item => Array.isArray(item) ? item : [item];
5
5
  export function readFileContent(file, resultType) {
6
6
  return new Promise(resolve => {
package/es/utils/dom.d.ts CHANGED
@@ -9,3 +9,4 @@ export declare function resetScroll(): void;
9
9
  export declare const stopPropagation: (event: Event) => void;
10
10
  export declare function preventDefault(event: Event, isStopPropagation?: boolean): void;
11
11
  export declare function isHidden(elementRef: HTMLElement | Ref<HTMLElement | undefined>): boolean;
12
+ export declare const windowWidth: Ref<number>, windowHeight: Ref<number>;
package/es/utils/dom.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useRect } from '@vant/use';
1
+ import { useRect, useWindowSize } from '@vant/use';
2
2
  import { unref } from 'vue';
3
3
  import { isIOS as checkIsIOS } from './validate';
4
4
  export function getScrollTop(el) {
@@ -62,4 +62,8 @@ export function isHidden(elementRef) {
62
62
 
63
63
  var parentHidden = el.offsetParent === null && style.position !== 'fixed';
64
64
  return hidden || parentHidden;
65
- }
65
+ }
66
+ export var {
67
+ width: windowWidth,
68
+ height: windowHeight
69
+ } = useWindowSize();
@@ -1,11 +1,12 @@
1
1
  import { inBrowser } from './basic';
2
+ import { windowWidth, windowHeight } from './dom';
2
3
  import { isDef, isNumeric } from './validate';
3
4
  export function addUnit(value) {
4
- if (!isDef(value)) {
5
- return undefined;
5
+ if (isDef(value)) {
6
+ return isNumeric(value) ? value + "px" : String(value);
6
7
  }
7
8
 
8
- return isNumeric(value) ? value + "px" : String(value);
9
+ return undefined;
9
10
  }
10
11
  export function getSizeStyle(originSize) {
11
12
  if (isDef(originSize)) {
@@ -45,12 +46,12 @@ function convertRem(value) {
45
46
 
46
47
  function convertVw(value) {
47
48
  value = value.replace(/vw/g, '');
48
- return +value * window.innerWidth / 100;
49
+ return +value * windowWidth.value / 100;
49
50
  }
50
51
 
51
52
  function convertVh(value) {
52
53
  value = value.replace(/vh/g, '');
53
- return +value * window.innerHeight / 100;
54
+ return +value * windowHeight.value / 100;
54
55
  }
55
56
 
56
57
  export function unitToPx(value) {
@@ -4,6 +4,7 @@ type EventHandler = (...args: any[]) => void;
4
4
 
5
5
  declare module 'vue' {
6
6
  interface ComponentCustomProps {
7
+ id?: string;
7
8
  role?: string;
8
9
  tabindex?: number;
9
10
  onClick?: EventHandler;