vant 3.5.2 → 3.6.0

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 (132) hide show
  1. package/README.md +17 -13
  2. package/changelog.generated.md +85 -0
  3. package/es/badge/Badge.mjs +1 -1
  4. package/es/button/index.less +1 -1
  5. package/es/calendar/Calendar.mjs +6 -5
  6. package/es/calendar/types.d.ts +1 -0
  7. package/es/cell/Cell.d.ts +1 -1
  8. package/es/cell/index.d.ts +1 -1
  9. package/es/collapse/Collapse.d.ts +8 -1
  10. package/es/collapse/Collapse.mjs +28 -1
  11. package/es/collapse/index.d.ts +1 -1
  12. package/es/collapse-item/CollapseItem.d.ts +1 -1
  13. package/es/collapse-item/CollapseItem.mjs +3 -1
  14. package/es/collapse-item/index.d.ts +1 -1
  15. package/es/collapse-item/index.less +1 -1
  16. package/es/composables/use-global-z-index.d.ts +4 -0
  17. package/es/composables/use-global-z-index.mjs +9 -0
  18. package/es/composables/use-height.d.ts +1 -1
  19. package/es/composables/use-height.mjs +8 -2
  20. package/es/composables/use-lock-scroll.mjs +3 -1
  21. package/es/composables/use-placeholder.mjs +1 -1
  22. package/es/config-provider/ConfigProvider.d.ts +3 -0
  23. package/es/config-provider/ConfigProvider.mjs +8 -1
  24. package/es/config-provider/index.d.ts +2 -0
  25. package/es/dialog/Dialog.d.ts +1 -1
  26. package/es/empty/Empty.d.ts +1 -1
  27. package/es/empty/Empty.mjs +281 -16
  28. package/es/field/Field.d.ts +1 -1
  29. package/es/field/Field.mjs +4 -1
  30. package/es/field/index.d.ts +1 -1
  31. package/es/field/index.less +1 -1
  32. package/es/field/types.d.ts +1 -0
  33. package/es/field/utils.d.ts +1 -0
  34. package/es/field/utils.mjs +8 -2
  35. package/es/grid-item/index.less +1 -1
  36. package/es/index.d.ts +2 -1
  37. package/es/index.mjs +4 -1
  38. package/es/locale/index.d.ts +1 -1
  39. package/es/popover/Popover.mjs +28 -27
  40. package/es/popup/Popup.mjs +6 -5
  41. package/es/pull-refresh/PullRefresh.mjs +10 -3
  42. package/es/search/index.css +1 -1
  43. package/es/search/index.less +3 -1
  44. package/es/sidebar-item/index.less +1 -1
  45. package/es/space/Space.d.ts +48 -0
  46. package/es/space/Space.mjs +87 -0
  47. package/es/space/index.css +1 -0
  48. package/es/space/index.d.ts +37 -0
  49. package/es/space/index.less +38 -0
  50. package/es/space/index.mjs +8 -0
  51. package/es/space/style/index.d.ts +1 -0
  52. package/es/space/style/index.mjs +2 -0
  53. package/es/space/style/less.d.ts +1 -0
  54. package/es/space/style/less.mjs +2 -0
  55. package/es/swipe/index.less +1 -1
  56. package/es/switch/index.less +1 -1
  57. package/es/toast/index.less +1 -1
  58. package/es/uploader/Uploader.mjs +1 -1
  59. package/es/utils/basic.d.ts +3 -3
  60. package/es/utils/create.d.ts +1 -1
  61. package/lib/badge/Badge.js +1 -1
  62. package/lib/button/index.less +1 -1
  63. package/lib/calendar/Calendar.js +6 -5
  64. package/lib/calendar/types.d.ts +1 -0
  65. package/lib/cell/Cell.d.ts +1 -1
  66. package/lib/cell/index.d.ts +1 -1
  67. package/lib/collapse/Collapse.d.ts +8 -1
  68. package/lib/collapse/Collapse.js +28 -1
  69. package/lib/collapse/index.d.ts +1 -1
  70. package/lib/collapse-item/CollapseItem.d.ts +1 -1
  71. package/lib/collapse-item/CollapseItem.js +3 -1
  72. package/lib/collapse-item/index.d.ts +1 -1
  73. package/lib/collapse-item/index.less +1 -1
  74. package/lib/composables/use-global-z-index.d.ts +4 -0
  75. package/lib/composables/use-global-z-index.js +28 -0
  76. package/lib/composables/use-height.d.ts +1 -1
  77. package/lib/composables/use-height.js +8 -2
  78. package/lib/composables/use-lock-scroll.js +3 -1
  79. package/lib/composables/use-placeholder.js +1 -1
  80. package/lib/config-provider/ConfigProvider.d.ts +3 -0
  81. package/lib/config-provider/ConfigProvider.js +7 -0
  82. package/lib/config-provider/index.d.ts +2 -0
  83. package/lib/dialog/Dialog.d.ts +1 -1
  84. package/lib/empty/Empty.d.ts +1 -1
  85. package/lib/empty/Empty.js +281 -16
  86. package/lib/field/Field.d.ts +1 -1
  87. package/lib/field/Field.js +3 -0
  88. package/lib/field/index.d.ts +1 -1
  89. package/lib/field/index.less +1 -1
  90. package/lib/field/types.d.ts +1 -0
  91. package/lib/field/utils.d.ts +1 -0
  92. package/lib/field/utils.js +8 -2
  93. package/lib/grid-item/index.less +1 -1
  94. package/lib/index.css +1 -1
  95. package/lib/index.d.ts +2 -1
  96. package/lib/index.js +4 -1
  97. package/lib/index.less +1 -0
  98. package/lib/locale/index.d.ts +1 -1
  99. package/lib/popover/Popover.js +27 -26
  100. package/lib/popup/Popup.js +6 -5
  101. package/lib/pull-refresh/PullRefresh.js +9 -2
  102. package/lib/search/index.css +1 -1
  103. package/lib/search/index.less +3 -1
  104. package/lib/sidebar-item/index.less +1 -1
  105. package/lib/space/Space.d.ts +48 -0
  106. package/lib/space/Space.js +106 -0
  107. package/lib/space/index.css +1 -0
  108. package/lib/space/index.d.ts +37 -0
  109. package/lib/space/index.js +30 -0
  110. package/lib/space/index.less +38 -0
  111. package/lib/space/style/index.d.ts +1 -0
  112. package/lib/space/style/index.js +2 -0
  113. package/lib/space/style/less.d.ts +1 -0
  114. package/lib/space/style/less.js +2 -0
  115. package/lib/swipe/index.less +1 -1
  116. package/lib/switch/index.less +1 -1
  117. package/lib/toast/index.less +1 -1
  118. package/lib/uploader/Uploader.js +1 -1
  119. package/lib/utils/basic.d.ts +3 -3
  120. package/lib/utils/create.d.ts +1 -1
  121. package/lib/vant.cjs.js +1305 -1084
  122. package/lib/vant.es.js +1394 -1083
  123. package/lib/vant.js +1235 -1083
  124. package/lib/vant.min.js +1 -1
  125. package/{vetur → lib}/web-types.json +738 -666
  126. package/package.json +10 -15
  127. package/es/empty/Images.d.ts +0 -4
  128. package/es/empty/Images.mjs +0 -271
  129. package/lib/empty/Images.d.ts +0 -4
  130. package/lib/empty/Images.js +0 -290
  131. package/vetur/attributes.json +0 -3482
  132. package/vetur/tags.json +0 -1204
package/README.md CHANGED
@@ -4,21 +4,20 @@
4
4
 
5
5
  <h1 align="center">Vant</h1>
6
6
 
7
- <p align="center">Mobile UI Components built on Vue</p>
7
+ <p align="center">Lightweight Mobile UI Components built on Vue</p>
8
8
 
9
9
  <p align="center">
10
10
  <img src="https://img.shields.io/npm/v/vant?style=flat-square" alt="npm version" />
11
- <img src="https://img.shields.io/github/workflow/status/youzan/vant/CI/dev?style=flat-square" alt="CI Status" />
12
- <img src="https://img.shields.io/codecov/c/github/youzan/vant/dev.svg?style=flat-square&color=#4fc08d" alt="Coverage Status" />
11
+ <img src="https://img.shields.io/github/workflow/status/vant-ui/vant/CI/dev?style=flat-square" alt="CI Status" />
12
+ <img src="https://img.shields.io/codecov/c/github/vant-ui/vant/dev.svg?style=flat-square&color=#4fc08d" alt="Coverage Status" />
13
13
  <img src="https://img.shields.io/npm/dm/vant.svg?style=flat-square&color=#4fc08d" alt="downloads" />
14
- <img src="https://img.shields.io/jsdelivr/npm/hm/vant?style=flat-square" alt="Jsdelivr Hits">
15
14
  <img src="https://img.badgesize.io/https://unpkg.com/vant@3/lib/vant.min.js?compression=gzip&style=flat-square&label=gzip%20size&color=#4fc08d" alt="Gzip Size" />
16
15
  </p>
17
16
 
18
17
  <p align="center">
19
18
  🔥 <a href="https://vant-contrib.gitee.io/vant">文档网站(国内)</a>
20
19
  &nbsp;
21
- 🌈 <a href="https://youzan.github.io/vant">文档网站(GitHub)</a>
20
+ 🌈 <a href="https://vant-ui.github.io/vant">文档网站(GitHub)</a>
22
21
  &nbsp;
23
22
  🇨🇳 <a href="./README.zh-CN.md">中文版介绍</a>
24
23
  </p>
@@ -29,6 +28,7 @@
29
28
 
30
29
  - 🚀 1KB Component average size (min+gzip)
31
30
  - 🚀 70+ High quality components
31
+ - 🚀 Zero third-party dependencies
32
32
  - 💪 90%+ Unit test coverage
33
33
  - 💪 Written in TypeScript
34
34
  - 📖 Extensive documentation and demos
@@ -67,14 +67,18 @@ pnpm add vant
67
67
 
68
68
  ```js
69
69
  import { createApp } from 'vue';
70
+ // 1. Import the components you need
70
71
  import { Button } from 'vant';
72
+ // 2. Import the components style
71
73
  import 'vant/lib/index.css';
72
74
 
73
75
  const app = createApp();
76
+
77
+ // 3. Register the components you need
74
78
  app.use(Button);
75
79
  ```
76
80
 
77
- See more in [Quickstart](https://youzan.github.io/vant#/en-US/quickstart).
81
+ See more in [Quickstart](https://vant-ui.github.io/vant#/en-US/quickstart).
78
82
 
79
83
  ## Browser Support
80
84
 
@@ -86,11 +90,11 @@ Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3)
86
90
 
87
91
  | Project | Description |
88
92
  | --- | --- |
89
- | [vant-weapp](https://github.com/youzan/vant-weapp) | WeChat MiniProgram UI |
93
+ | [vant-weapp](https://github.com/vant-ui/vant-weapp) | WeChat MiniProgram UI |
90
94
  | [vant-demo](https://github.com/vant-ui/vant-demo) | Collection of Vant demos |
91
- | [vant-cli](https://github.com/youzan/vant/tree/dev/packages/vant-cli) | Scaffold for UI library |
92
- | [vant-icons](https://github.com/youzan/vant/tree/dev/packages/vant-icons) | Vant icons |
93
- | [vant-touch-emulator](https://github.com/youzan/vant/tree/dev/packages/vant-touch-emulator) | Using vant in desktop browsers |
95
+ | [vant-cli](https://github.com/vant-ui/vant/tree/dev/packages/vant-cli) | Scaffold for UI library |
96
+ | [vant-icons](https://github.com/vant-ui/vant/tree/dev/packages/vant-icons) | Vant icons |
97
+ | [vant-touch-emulator](https://github.com/vant-ui/vant/tree/dev/packages/vant-touch-emulator) | Using vant in desktop browsers |
94
98
 
95
99
  ## Community Ecosystem
96
100
 
@@ -106,8 +110,8 @@ Vant 3/4 supports modern browsers and Chrome >= 51、iOS >= 10.0 (same as Vue 3)
106
110
 
107
111
  ## Links
108
112
 
109
- - [Documentation](https://youzan.github.io/vant)
110
- - [Changelog](https://youzan.github.io/vant#/en-US/changelog)
113
+ - [Documentation](https://vant-ui.github.io/vant)
114
+ - [Changelog](https://vant-ui.github.io/vant#/en-US/changelog)
111
115
  - [Gitter](https://gitter.im/vant-contrib/discuss?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
112
116
 
113
117
  ## Preview
@@ -128,7 +132,7 @@ Core contributors of Vant and Vant Weapp:
128
132
 
129
133
  Thanks to the following friends for their contributions to Vant:
130
134
 
131
- <a href="https://github.com/youzan/vant/graphs/contributors">
135
+ <a href="https://github.com/vant-ui/vant/graphs/contributors">
132
136
  <img src="https://opencollective.com/vant/contributors.svg?width=890&button=false" alt="contributors">
133
137
  </a>
134
138
 
@@ -0,0 +1,85 @@
1
+ ### [v3.6.0](https://github.com/vant-ui/vant/compare/v3.5.3...v3.6.0)
2
+
3
+ `2022-08-21`
4
+
5
+ **Bug Fixes**
6
+
7
+ - @vant/cli: should replace NODE_ENV in vite v3 [#10887](https://github.com/vant-ui/vant/issues/10887)
8
+ - Calendar: content disappeared when hiding [#10910](https://github.com/vant-ui/vant/issues/10910)
9
+ - Calendar: fix reading getFullYear error [#10908](https://github.com/vant-ui/vant/issues/10908)
10
+ - Calendar: reading getFullYear error in some cases [#10909](https://github.com/vant-ui/vant/issues/10909)
11
+ - Empty: generate unique id to avoid render issue [#10943](https://github.com/vant-ui/vant/issues/10943)
12
+ - incorrect tag name in WebStorm [#10946](https://github.com/vant-ui/vant/issues/10946)
13
+ - Popover: can not scroll inside popup [#10949](https://github.com/vant-ui/vant/issues/10949)
14
+ - PullRefresh: remove passive event warning [#10938](https://github.com/vant-ui/vant/issues/10938)
15
+ - Search: --van-search-input-height var not work [#10911](https://github.com/vant-ui/vant/issues/10911)
16
+
17
+ **Document**
18
+
19
+ - add import tips [#10941](https://github.com/vant-ui/vant/issues/10941)
20
+ - add tips in advanced-usage.zh-CN.md [#10927](https://github.com/vant-ui/vant/issues/10927)
21
+ - changelog: 3.5.4 [961f70](https://github.com/vant-ui/vant/commit/961f70d523b723c864d99dceb2be1a19ec506d03)
22
+ - changelog: vant@3.5.3 [#10869](https://github.com/vant-ui/vant/issues/10869)
23
+ - Form: fix the type of rule trigger option [#10912](https://github.com/vant-ui/vant/issues/10912)
24
+ - import quick start document [#10945](https://github.com/vant-ui/vant/issues/10945)
25
+ - Search: fix action-text type [#10936](https://github.com/vant-ui/vant/issues/10936)
26
+ - Search: fix action-text type [#10935](https://github.com/vant-ui/vant/issues/10935)
27
+ - Space: add version tip [#10886](https://github.com/vant-ui/vant/issues/10886)
28
+
29
+ **Feature**
30
+
31
+ - @vant/use: useClickAway support multiple targets [#10948](https://github.com/vant-ui/vant/issues/10948)
32
+ - Badge: fix the problem mentioned at README. [#10921](https://github.com/vant-ui/vant/issues/10921)
33
+ - ConfigProvider: add z-index prop [#10915](https://github.com/vant-ui/vant/issues/10915)
34
+ - Form: add validateEmpty option of rule [#10913](https://github.com/vant-ui/vant/issues/10913)
35
+ - Popup: add role and tabindex for a11y [#10894](https://github.com/vant-ui/vant/issues/10894)
36
+ - Space: add new component space [#10857](https://github.com/vant-ui/vant/issues/10857)
37
+ - touch-emulator: support .mjs extension [#10888](https://github.com/vant-ui/vant/issues/10888)
38
+
39
+ **release**
40
+
41
+ - @vant/use 1.4.2 [326880](https://github.com/vant-ui/vant/commit/326880a4e19f8ab8ffe6042a8cc968cc03b02616)
42
+ - 3.5.4 [cfdb5c](https://github.com/vant-ui/vant/commit/cfdb5c1fbe496f6a064ab8bebe7f1ae8734490c0)
43
+ ### [v3.5.3](https://github.com/vant-ui/vant/compare/v3.5.2...v3.5.3)
44
+
45
+ `2022-07-31`
46
+
47
+ **Bug Fixes**
48
+
49
+ - @vant-cli: compilation error when using setup syntactic sugar and including subcomponents [cb7512](https://github.com/vant-ui/vant/commit/cb751211f1184a7a36627b45290f84c64d656f5a)
50
+ - create-vant-cli-app: missing demo registration [#10839](https://github.com/vant-ui/vant/issues/10839)
51
+ - docs: fix button example type in documentation [#10850](https://github.com/vant-ui/vant/issues/10850)
52
+ - failed to get correct height of safe area element [#10827](https://github.com/vant-ui/vant/issues/10827)
53
+ - Popover: allow to dynamically set offset prop [#10840](https://github.com/vant-ui/vant/issues/10840)
54
+ - Uploader: should not preview failed images [#10790](https://github.com/vant-ui/vant/issues/10790)
55
+
56
+ **Document**
57
+
58
+ - changelog: @vant/cli@4.0.3 [#10772](https://github.com/vant-ui/vant/issues/10772)
59
+ - changelog: vant@3.5.2 [e5a3aa](https://github.com/vant-ui/vant/commit/e5a3aa103dcd087f091d757ad244179ad4a70f42)
60
+ - improve description of name and required props [#10841](https://github.com/vant-ui/vant/issues/10841)
61
+ - update readme [#10868](https://github.com/vant-ui/vant/issues/10868)
62
+ - update website domain [#10798](https://github.com/vant-ui/vant/issues/10798)
63
+
64
+ **Feature**
65
+
66
+ - @vant/cli: bump vite 3.0 [#10842](https://github.com/vant-ui/vant/issues/10842)
67
+ - Calendar: expose getSelectedDate method [419a8e](https://github.com/vant-ui/vant/commit/419a8e4f0e6454b9aac30d5800318deabec099cb)
68
+ - cli: support site.headHtml option [#10807](https://github.com/vant-ui/vant/issues/10807)
69
+ - Collapse: collapse add toggleAll method for issues #10818 [#10818](https://github.com/vant-ui/vant/issues/10818) [#10837](https://github.com/vant-ui/vant/issues/10837) [#10818](https://github.com/vant-ui/vant/issues/10818)
70
+
71
+ **perf**
72
+
73
+ - cli: improve cli boot time [#10780](https://github.com/vant-ui/vant/issues/10780)
74
+ - cli: replace lint-staged with nano-staged [#10778](https://github.com/vant-ui/vant/issues/10778)
75
+ - cli: replace ora with nanospinner [#10779](https://github.com/vant-ui/vant/issues/10779)
76
+
77
+ **refactor**
78
+
79
+ - @vant/cli: remove vetur configs [#10866](https://github.com/vant-ui/vant/issues/10866)
80
+
81
+ **release**
82
+
83
+ - @vant/cli 4.0.3 [e4fc6f](https://github.com/vant-ui/vant/commit/e4fc6f9081728d3f59ef8d60c18bc5e7fa72d571)
84
+ - 3.5.3 [d96c42](https://github.com/vant-ui/vant/commit/d96c4228f5c16884d10dc523217194d138bf35c6)
85
+ - create-vant-cli-app 2.0.1 [c628a6](https://github.com/vant-ui/vant/commit/c628a667703b38e3999e1953950a187e97a45efb)
@@ -26,7 +26,7 @@ var stdin_default = defineComponent({
26
26
  content,
27
27
  showZero
28
28
  } = props;
29
- return isDef(content) && content !== "" && (showZero || content !== 0);
29
+ return isDef(content) && content !== "" && (showZero || content !== 0 && content !== "0");
30
30
  };
31
31
  const renderContent = () => {
32
32
  const {
@@ -201,7 +201,7 @@
201
201
  height: 100%;
202
202
 
203
203
  // fix icon vertical align
204
- // see: https://github.com/youzan/vant/issues/7617
204
+ // see: https://github.com/vant-ui/vant/issues/7617
205
205
  &::before {
206
206
  content: ' ';
207
207
  }
@@ -112,9 +112,6 @@ var stdin_default = defineComponent({
112
112
  const months = computed(() => {
113
113
  const months2 = [];
114
114
  const cursor = new Date(props.minDate);
115
- if (props.lazyRender && !props.show && props.poppable) {
116
- return months2;
117
- }
118
115
  cursor.setDate(1);
119
116
  do {
120
117
  months2.push(new Date(cursor));
@@ -133,6 +130,7 @@ var stdin_default = defineComponent({
133
130
  }
134
131
  return !currentDate.value;
135
132
  });
133
+ const getSelectedDate = () => currentDate.value;
136
134
  const onScroll = () => {
137
135
  const top = getScrollTop(bodyRef.value);
138
136
  const bottom = top + bodyHeight;
@@ -191,7 +189,9 @@ var stdin_default = defineComponent({
191
189
  }
192
190
  if (currentDate.value) {
193
191
  const targetDate = props.type === "single" ? currentDate.value : currentDate.value[0];
194
- scrollToDate(targetDate);
192
+ if (isDate(targetDate)) {
193
+ scrollToDate(targetDate);
194
+ }
195
195
  } else {
196
196
  raf(onScroll);
197
197
  }
@@ -375,7 +375,8 @@ var stdin_default = defineComponent({
375
375
  });
376
376
  useExpose({
377
377
  reset,
378
- scrollToDate
378
+ scrollToDate,
379
+ getSelectedDate
379
380
  });
380
381
  onMountedOrActivated(init);
381
382
  return () => {
@@ -15,6 +15,7 @@ export declare type CalendarDayItem = {
15
15
  export declare type CalendarExpose = {
16
16
  reset: (date?: Date | Date[]) => void;
17
17
  scrollToDate: (targetDate: Date) => void;
18
+ getSelectedDate: () => Date | Date[] | null;
18
19
  };
19
20
  export declare type CalendarInstance = ComponentPublicInstance<CalendarProps, CalendarExpose>;
20
21
  export declare type CalendarMonthInstance = ComponentPublicInstance<CalendarMonthProps, {
package/es/cell/Cell.d.ts CHANGED
@@ -110,10 +110,10 @@ declare const _default: import("vue").DefineComponent<{
110
110
  replace: BooleanConstructor;
111
111
  }>>, {
112
112
  replace: boolean;
113
+ required: boolean;
113
114
  center: boolean;
114
115
  isLink: boolean;
115
116
  border: boolean;
116
- required: boolean;
117
117
  clickable: boolean | null;
118
118
  }>;
119
119
  export default _default;
@@ -54,10 +54,10 @@ export declare const Cell: import("../utils").WithInstall<import("vue").DefineCo
54
54
  replace: BooleanConstructor;
55
55
  }>>, {
56
56
  replace: boolean;
57
+ required: boolean;
57
58
  center: boolean;
58
59
  isLink: boolean;
59
60
  border: boolean;
60
- required: boolean;
61
61
  clickable: boolean | null;
62
62
  }>>;
63
63
  export default Cell;
@@ -1,9 +1,13 @@
1
- import { type PropType, type InjectionKey, type ExtractPropTypes } from 'vue';
1
+ import { type PropType, type InjectionKey, type ExtractPropTypes, type ComponentPublicInstance } from 'vue';
2
2
  import { type Numeric } from '../utils';
3
3
  export declare type CollapseProvide = {
4
4
  toggle: (name: Numeric, expanded: boolean) => void;
5
5
  isExpanded: (name: Numeric) => boolean;
6
6
  };
7
+ export declare type CollapseToggleAllOptions = boolean | {
8
+ expanded?: boolean;
9
+ skipDisabled?: boolean;
10
+ };
7
11
  export declare const COLLAPSE_KEY: InjectionKey<CollapseProvide>;
8
12
  declare const collapseProps: {
9
13
  border: {
@@ -17,6 +21,9 @@ declare const collapseProps: {
17
21
  };
18
22
  };
19
23
  export declare type CollapseProps = ExtractPropTypes<typeof collapseProps>;
24
+ export declare type CollapseInstance = ComponentPublicInstance<{
25
+ toggleAll: (options?: boolean | CollapseToggleAllOptions) => void;
26
+ }>;
20
27
  declare const _default: import("vue").DefineComponent<{
21
28
  border: {
22
29
  type: BooleanConstructor;
@@ -2,6 +2,7 @@ import { createVNode as _createVNode } from "vue";
2
2
  import { defineComponent } from "vue";
3
3
  import { truthProp, createNamespace, BORDER_TOP_BOTTOM } from "../utils/index.mjs";
4
4
  import { useChildren } from "@vant/use";
5
+ import { useExpose } from "../composables/use-expose.mjs";
5
6
  const [name, bem] = createNamespace("collapse");
6
7
  const COLLAPSE_KEY = Symbol(name);
7
8
  const collapseProps = {
@@ -32,7 +33,8 @@ var stdin_default = defineComponent({
32
33
  slots
33
34
  }) {
34
35
  const {
35
- linkChildren
36
+ linkChildren,
37
+ children
36
38
  } = useChildren(COLLAPSE_KEY);
37
39
  const updateName = (name2) => {
38
40
  emit("change", name2);
@@ -51,6 +53,28 @@ var stdin_default = defineComponent({
51
53
  updateName(modelValue.filter((activeName) => activeName !== name2));
52
54
  }
53
55
  };
56
+ const toggleAll = (options = {}) => {
57
+ if (props.accordion) {
58
+ return;
59
+ }
60
+ if (typeof options === "boolean") {
61
+ options = {
62
+ expanded: options
63
+ };
64
+ }
65
+ const {
66
+ expanded,
67
+ skipDisabled
68
+ } = options;
69
+ const expandedChildren = children.filter((item) => {
70
+ if (item.disabled && skipDisabled) {
71
+ return item.expanded.value;
72
+ }
73
+ return expanded != null ? expanded : !item.expanded.value;
74
+ });
75
+ const names = expandedChildren.map((item) => item.itemName.value);
76
+ updateName(names);
77
+ };
54
78
  const isExpanded = (name2) => {
55
79
  const {
56
80
  accordion,
@@ -61,6 +85,9 @@ var stdin_default = defineComponent({
61
85
  }
62
86
  return accordion ? modelValue === name2 : modelValue.includes(name2);
63
87
  };
88
+ useExpose({
89
+ toggleAll
90
+ });
64
91
  linkChildren({
65
92
  toggle,
66
93
  isExpanded
@@ -27,7 +27,7 @@ export declare const Collapse: import("../utils").WithInstall<import("vue").Defi
27
27
  accordion: boolean;
28
28
  }>>;
29
29
  export default Collapse;
30
- export type { CollapseProps } from './Collapse';
30
+ export type { CollapseProps, CollapseInstance, CollapseToggleAllOptions, } from './Collapse';
31
31
  declare module 'vue' {
32
32
  interface GlobalComponents {
33
33
  VanCollapse: typeof Collapse;
@@ -107,11 +107,11 @@ declare const _default: import("vue").DefineComponent<{
107
107
  default: true;
108
108
  };
109
109
  }>>, {
110
+ required: boolean;
110
111
  center: boolean;
111
112
  disabled: boolean;
112
113
  isLink: boolean;
113
114
  border: boolean;
114
- required: boolean;
115
115
  clickable: boolean | null;
116
116
  readonly: boolean;
117
117
  lazyRender: boolean;
@@ -120,7 +120,9 @@ var stdin_default = defineComponent({
120
120
  }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]), [[_vShow, show.value]]);
121
121
  });
122
122
  useExpose({
123
- toggle
123
+ toggle,
124
+ expanded,
125
+ itemName: name2
124
126
  });
125
127
  return () => _createVNode("div", {
126
128
  "class": [bem({
@@ -69,11 +69,11 @@ export declare const CollapseItem: import("../utils").WithInstall<import("vue").
69
69
  default: true;
70
70
  };
71
71
  }>>, {
72
+ required: boolean;
72
73
  center: boolean;
73
74
  disabled: boolean;
74
75
  isLink: boolean;
75
76
  border: boolean;
76
- required: boolean;
77
77
  clickable: boolean | null;
78
78
  readonly: boolean;
79
79
  lazyRender: boolean;
@@ -23,7 +23,7 @@
23
23
  &__title {
24
24
  .van-cell__right-icon::before {
25
25
  // using translateZ to fix safari rendering issues
26
- // see: https://github.com/youzan/vant/issues/8608
26
+ // see: https://github.com/vant-ui/vant/issues/8608
27
27
  transform: rotate(90deg) translateZ(0);
28
28
  transition: transform var(--van-collapse-item-transition-duration);
29
29
  }
@@ -0,0 +1,4 @@
1
+ /** the global z-index is automatically incremented after reading */
2
+ export declare const useGlobalZIndex: () => number;
3
+ /** reset the global z-index */
4
+ export declare const setGlobalZIndex: (val: number) => void;
@@ -0,0 +1,9 @@
1
+ let globalZIndex = 2e3;
2
+ const useGlobalZIndex = () => ++globalZIndex;
3
+ const setGlobalZIndex = (val) => {
4
+ globalZIndex = val;
5
+ };
6
+ export {
7
+ setGlobalZIndex,
8
+ useGlobalZIndex
9
+ };
@@ -1,2 +1,2 @@
1
1
  import { Ref } from 'vue';
2
- export declare const useHeight: (element: Element | Ref<Element | undefined>) => Ref<number | undefined>;
2
+ export declare const useHeight: (element: Element | Ref<Element | undefined>, withSafeArea?: boolean) => Ref<number | undefined>;
@@ -1,14 +1,20 @@
1
1
  import { useRect } from "@vant/use";
2
2
  import { ref, onMounted, nextTick } from "vue";
3
- const useHeight = (element) => {
3
+ import { onPopupReopen } from "./on-popup-reopen.mjs";
4
+ const useHeight = (element, withSafeArea) => {
4
5
  const height = ref();
5
6
  const setHeight = () => {
6
7
  height.value = useRect(element).height;
7
8
  };
8
9
  onMounted(() => {
9
10
  nextTick(setHeight);
10
- setTimeout(setHeight, 100);
11
+ if (withSafeArea) {
12
+ for (let i = 1; i <= 3; i++) {
13
+ setTimeout(setHeight, 100 * i);
14
+ }
15
+ }
11
16
  });
17
+ onPopupReopen(() => nextTick(setHeight));
12
18
  return height;
13
19
  };
14
20
  export {
@@ -6,9 +6,11 @@ let totalLockCount = 0;
6
6
  const BODY_LOCK_CLASS = "van-overflow-hidden";
7
7
  function useLockScroll(rootRef, shouldLock) {
8
8
  const touch = useTouch();
9
+ const DIRECTION_UP = "01";
10
+ const DIRECTION_DOWN = "10";
9
11
  const onTouchMove = (event) => {
10
12
  touch.move(event);
11
- const direction = touch.deltaY.value > 0 ? "10" : "01";
13
+ const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
12
14
  const el = getScrollParent(event.target, rootRef.value);
13
15
  const { scrollHeight, offsetHeight, scrollTop } = el;
14
16
  let status = "11";
@@ -1,7 +1,7 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
2
  import { useHeight } from "./use-height.mjs";
3
3
  function usePlaceholder(contentRef, bem) {
4
- const height = useHeight(contentRef);
4
+ const height = useHeight(contentRef, true);
5
5
  return (renderContent) => _createVNode("div", {
6
6
  "class": bem("placeholder"),
7
7
  "style": {
@@ -9,6 +9,7 @@ declare const configProviderProps: {
9
9
  type: PropType<keyof HTMLElementTagNameMap>;
10
10
  default: keyof HTMLElementTagNameMap;
11
11
  };
12
+ zIndex: NumberConstructor;
12
13
  themeVars: PropType<Record<string, Numeric>>;
13
14
  iconPrefix: StringConstructor;
14
15
  };
@@ -18,6 +19,7 @@ declare const _default: import("vue").DefineComponent<{
18
19
  type: PropType<keyof HTMLElementTagNameMap>;
19
20
  default: keyof HTMLElementTagNameMap;
20
21
  };
22
+ zIndex: NumberConstructor;
21
23
  themeVars: PropType<Record<string, Numeric>>;
22
24
  iconPrefix: StringConstructor;
23
25
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
@@ -25,6 +27,7 @@ declare const _default: import("vue").DefineComponent<{
25
27
  type: PropType<keyof HTMLElementTagNameMap>;
26
28
  default: keyof HTMLElementTagNameMap;
27
29
  };
30
+ zIndex: NumberConstructor;
28
31
  themeVars: PropType<Record<string, Numeric>>;
29
32
  iconPrefix: StringConstructor;
30
33
  }>>, {
@@ -1,10 +1,12 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
- import { provide, computed, defineComponent } from "vue";
2
+ import { provide, computed, watchEffect, defineComponent } from "vue";
3
3
  import { kebabCase, makeStringProp, createNamespace } from "../utils/index.mjs";
4
+ import { setGlobalZIndex } from "../composables/use-global-z-index.mjs";
4
5
  const [name, bem] = createNamespace("config-provider");
5
6
  const CONFIG_PROVIDER_KEY = Symbol(name);
6
7
  const configProviderProps = {
7
8
  tag: makeStringProp("div"),
9
+ zIndex: Number,
8
10
  themeVars: Object,
9
11
  iconPrefix: String
10
12
  };
@@ -27,6 +29,11 @@ var stdin_default = defineComponent({
27
29
  }
28
30
  });
29
31
  provide(CONFIG_PROVIDER_KEY, props);
32
+ watchEffect(() => {
33
+ if (props.zIndex !== void 0) {
34
+ setGlobalZIndex(props.zIndex);
35
+ }
36
+ });
30
37
  return () => _createVNode(props.tag, {
31
38
  "class": bem(),
32
39
  "style": style.value
@@ -3,6 +3,7 @@ export declare const ConfigProvider: import("../utils").WithInstall<import("vue"
3
3
  type: import("vue").PropType<keyof HTMLElementTagNameMap>;
4
4
  default: keyof HTMLElementTagNameMap;
5
5
  };
6
+ zIndex: NumberConstructor;
6
7
  themeVars: import("vue").PropType<Record<string, import("../utils").Numeric>>;
7
8
  iconPrefix: StringConstructor;
8
9
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -10,6 +11,7 @@ export declare const ConfigProvider: import("../utils").WithInstall<import("vue"
10
11
  type: import("vue").PropType<keyof HTMLElementTagNameMap>;
11
12
  default: keyof HTMLElementTagNameMap;
12
13
  };
14
+ zIndex: NumberConstructor;
13
15
  themeVars: import("vue").PropType<Record<string, import("../utils").Numeric>>;
14
16
  iconPrefix: StringConstructor;
15
17
  }>>, {
@@ -30,7 +30,7 @@ declare const dialogProps: {
30
30
  theme: PropType<DialogTheme>;
31
31
  width: (NumberConstructor | StringConstructor)[];
32
32
  message: PropType<DialogMessage>;
33
- callback: PropType<(action?: DialogAction | undefined) => void>;
33
+ callback: PropType<(action?: DialogAction) => void>;
34
34
  allowHtml: BooleanConstructor;
35
35
  className: PropType<unknown>;
36
36
  transition: {
@@ -1,4 +1,4 @@
1
- import { PropType, type ExtractPropTypes } from 'vue';
1
+ import { type PropType, type ExtractPropTypes } from 'vue';
2
2
  import { Numeric } from '../utils';
3
3
  declare const emptyProps: {
4
4
  image: {