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.
- package/README.md +17 -13
- package/changelog.generated.md +85 -0
- package/es/badge/Badge.mjs +1 -1
- package/es/button/index.less +1 -1
- package/es/calendar/Calendar.mjs +6 -5
- package/es/calendar/types.d.ts +1 -0
- package/es/cell/Cell.d.ts +1 -1
- package/es/cell/index.d.ts +1 -1
- package/es/collapse/Collapse.d.ts +8 -1
- package/es/collapse/Collapse.mjs +28 -1
- package/es/collapse/index.d.ts +1 -1
- package/es/collapse-item/CollapseItem.d.ts +1 -1
- package/es/collapse-item/CollapseItem.mjs +3 -1
- package/es/collapse-item/index.d.ts +1 -1
- package/es/collapse-item/index.less +1 -1
- package/es/composables/use-global-z-index.d.ts +4 -0
- package/es/composables/use-global-z-index.mjs +9 -0
- package/es/composables/use-height.d.ts +1 -1
- package/es/composables/use-height.mjs +8 -2
- package/es/composables/use-lock-scroll.mjs +3 -1
- package/es/composables/use-placeholder.mjs +1 -1
- package/es/config-provider/ConfigProvider.d.ts +3 -0
- package/es/config-provider/ConfigProvider.mjs +8 -1
- package/es/config-provider/index.d.ts +2 -0
- package/es/dialog/Dialog.d.ts +1 -1
- package/es/empty/Empty.d.ts +1 -1
- package/es/empty/Empty.mjs +281 -16
- package/es/field/Field.d.ts +1 -1
- package/es/field/Field.mjs +4 -1
- package/es/field/index.d.ts +1 -1
- package/es/field/index.less +1 -1
- package/es/field/types.d.ts +1 -0
- package/es/field/utils.d.ts +1 -0
- package/es/field/utils.mjs +8 -2
- package/es/grid-item/index.less +1 -1
- package/es/index.d.ts +2 -1
- package/es/index.mjs +4 -1
- package/es/locale/index.d.ts +1 -1
- package/es/popover/Popover.mjs +28 -27
- package/es/popup/Popup.mjs +6 -5
- package/es/pull-refresh/PullRefresh.mjs +10 -3
- package/es/search/index.css +1 -1
- package/es/search/index.less +3 -1
- package/es/sidebar-item/index.less +1 -1
- package/es/space/Space.d.ts +48 -0
- package/es/space/Space.mjs +87 -0
- package/es/space/index.css +1 -0
- package/es/space/index.d.ts +37 -0
- package/es/space/index.less +38 -0
- package/es/space/index.mjs +8 -0
- package/es/space/style/index.d.ts +1 -0
- package/es/space/style/index.mjs +2 -0
- package/es/space/style/less.d.ts +1 -0
- package/es/space/style/less.mjs +2 -0
- package/es/swipe/index.less +1 -1
- package/es/switch/index.less +1 -1
- package/es/toast/index.less +1 -1
- package/es/uploader/Uploader.mjs +1 -1
- package/es/utils/basic.d.ts +3 -3
- package/es/utils/create.d.ts +1 -1
- package/lib/badge/Badge.js +1 -1
- package/lib/button/index.less +1 -1
- package/lib/calendar/Calendar.js +6 -5
- package/lib/calendar/types.d.ts +1 -0
- package/lib/cell/Cell.d.ts +1 -1
- package/lib/cell/index.d.ts +1 -1
- package/lib/collapse/Collapse.d.ts +8 -1
- package/lib/collapse/Collapse.js +28 -1
- package/lib/collapse/index.d.ts +1 -1
- package/lib/collapse-item/CollapseItem.d.ts +1 -1
- package/lib/collapse-item/CollapseItem.js +3 -1
- package/lib/collapse-item/index.d.ts +1 -1
- package/lib/collapse-item/index.less +1 -1
- package/lib/composables/use-global-z-index.d.ts +4 -0
- package/lib/composables/use-global-z-index.js +28 -0
- package/lib/composables/use-height.d.ts +1 -1
- package/lib/composables/use-height.js +8 -2
- package/lib/composables/use-lock-scroll.js +3 -1
- package/lib/composables/use-placeholder.js +1 -1
- package/lib/config-provider/ConfigProvider.d.ts +3 -0
- package/lib/config-provider/ConfigProvider.js +7 -0
- package/lib/config-provider/index.d.ts +2 -0
- package/lib/dialog/Dialog.d.ts +1 -1
- package/lib/empty/Empty.d.ts +1 -1
- package/lib/empty/Empty.js +281 -16
- package/lib/field/Field.d.ts +1 -1
- package/lib/field/Field.js +3 -0
- package/lib/field/index.d.ts +1 -1
- package/lib/field/index.less +1 -1
- package/lib/field/types.d.ts +1 -0
- package/lib/field/utils.d.ts +1 -0
- package/lib/field/utils.js +8 -2
- package/lib/grid-item/index.less +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/index.less +1 -0
- package/lib/locale/index.d.ts +1 -1
- package/lib/popover/Popover.js +27 -26
- package/lib/popup/Popup.js +6 -5
- package/lib/pull-refresh/PullRefresh.js +9 -2
- package/lib/search/index.css +1 -1
- package/lib/search/index.less +3 -1
- package/lib/sidebar-item/index.less +1 -1
- package/lib/space/Space.d.ts +48 -0
- package/lib/space/Space.js +106 -0
- package/lib/space/index.css +1 -0
- package/lib/space/index.d.ts +37 -0
- package/lib/space/index.js +30 -0
- package/lib/space/index.less +38 -0
- package/lib/space/style/index.d.ts +1 -0
- package/lib/space/style/index.js +2 -0
- package/lib/space/style/less.d.ts +1 -0
- package/lib/space/style/less.js +2 -0
- package/lib/swipe/index.less +1 -1
- package/lib/switch/index.less +1 -1
- package/lib/toast/index.less +1 -1
- package/lib/uploader/Uploader.js +1 -1
- package/lib/utils/basic.d.ts +3 -3
- package/lib/utils/create.d.ts +1 -1
- package/lib/vant.cjs.js +1305 -1084
- package/lib/vant.es.js +1394 -1083
- package/lib/vant.js +1235 -1083
- package/lib/vant.min.js +1 -1
- package/{vetur → lib}/web-types.json +738 -666
- package/package.json +10 -15
- package/es/empty/Images.d.ts +0 -4
- package/es/empty/Images.mjs +0 -271
- package/lib/empty/Images.d.ts +0 -4
- package/lib/empty/Images.js +0 -290
- package/vetur/attributes.json +0 -3482
- package/vetur/tags.json +0 -1204
package/es/empty/Empty.mjs
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
2
|
import { defineComponent } from "vue";
|
3
|
+
import { useId } from "../composables/use-id.mjs";
|
3
4
|
import { getSizeStyle, makeStringProp, createNamespace } from "../utils/index.mjs";
|
4
|
-
import { renderError, renderSearch, renderNetwork, renderMaterial } from "./Images.mjs";
|
5
5
|
const [name, bem] = createNamespace("empty");
|
6
|
-
const PRESET_IMAGES = {
|
7
|
-
error: renderError,
|
8
|
-
search: renderSearch,
|
9
|
-
network: renderNetwork,
|
10
|
-
default: renderMaterial
|
11
|
-
};
|
12
6
|
const emptyProps = {
|
13
7
|
image: makeStringProp("default"),
|
14
8
|
imageSize: [Number, String, Array],
|
@@ -20,15 +14,6 @@ var stdin_default = defineComponent({
|
|
20
14
|
setup(props, {
|
21
15
|
slots
|
22
16
|
}) {
|
23
|
-
const renderImage = () => {
|
24
|
-
var _a;
|
25
|
-
if (slots.image) {
|
26
|
-
return slots.image();
|
27
|
-
}
|
28
|
-
return ((_a = PRESET_IMAGES[props.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || _createVNode("img", {
|
29
|
-
"src": props.image
|
30
|
-
}, null);
|
31
|
-
};
|
32
17
|
const renderDescription = () => {
|
33
18
|
const description = slots.description ? slots.description() : props.description;
|
34
19
|
if (description) {
|
@@ -44,6 +29,286 @@ var stdin_default = defineComponent({
|
|
44
29
|
}, [slots.default()]);
|
45
30
|
}
|
46
31
|
};
|
32
|
+
const baseId = useId();
|
33
|
+
const getId = (num) => `${baseId}-${num}`;
|
34
|
+
const getUrlById = (num) => `url(#${getId(num)})`;
|
35
|
+
const renderStop = (color, offset, opacity) => _createVNode("stop", {
|
36
|
+
"stop-color": color,
|
37
|
+
"offset": `${offset}%`,
|
38
|
+
"stop-opacity": opacity
|
39
|
+
}, null);
|
40
|
+
const renderStops = (fromColor, toColor) => [renderStop(fromColor, 0), renderStop(toColor, 100)];
|
41
|
+
const renderShadow = (id) => [_createVNode("defs", null, [_createVNode("radialGradient", {
|
42
|
+
"id": getId(id),
|
43
|
+
"cx": "50%",
|
44
|
+
"cy": "54%",
|
45
|
+
"fx": "50%",
|
46
|
+
"fy": "54%",
|
47
|
+
"r": "297%",
|
48
|
+
"gradientTransform": "matrix(-.16 0 0 -.33 .58 .72)"
|
49
|
+
}, [renderStop("#EBEDF0", 0), renderStop("#F2F3F5", 100, 0.3)])]), _createVNode("ellipse", {
|
50
|
+
"fill": getUrlById(id),
|
51
|
+
"opacity": ".8",
|
52
|
+
"cx": "80",
|
53
|
+
"cy": "140",
|
54
|
+
"rx": "46",
|
55
|
+
"ry": "8"
|
56
|
+
}, null)];
|
57
|
+
const renderBuilding = () => [_createVNode("defs", null, [_createVNode("linearGradient", {
|
58
|
+
"id": getId("a"),
|
59
|
+
"x1": "64%",
|
60
|
+
"y1": "100%",
|
61
|
+
"x2": "64%"
|
62
|
+
}, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)])]), _createVNode("g", {
|
63
|
+
"opacity": ".8"
|
64
|
+
}, [_createVNode("path", {
|
65
|
+
"d": "M36 131V53H16v20H2v58h34z",
|
66
|
+
"fill": getUrlById("a")
|
67
|
+
}, null), _createVNode("path", {
|
68
|
+
"d": "M123 15h22v14h9v77h-31V15z",
|
69
|
+
"fill": getUrlById("a")
|
70
|
+
}, null)])];
|
71
|
+
const renderCloud = () => [_createVNode("defs", null, [_createVNode("linearGradient", {
|
72
|
+
"id": getId("b"),
|
73
|
+
"x1": "64%",
|
74
|
+
"y1": "97%",
|
75
|
+
"x2": "64%",
|
76
|
+
"y2": "0%"
|
77
|
+
}, [renderStop("#F2F3F5", 0, 0.3), renderStop("#F2F3F5", 100)])]), _createVNode("g", {
|
78
|
+
"opacity": ".8"
|
79
|
+
}, [_createVNode("path", {
|
80
|
+
"d": "M87 6c3 0 7 3 8 6a8 8 0 1 1-1 16H80a7 7 0 0 1-8-6c0-4 3-7 6-7 0-5 4-9 9-9Z",
|
81
|
+
"fill": getUrlById("b")
|
82
|
+
}, null), _createVNode("path", {
|
83
|
+
"d": "M19 23c2 0 3 1 4 3 2 0 4 2 4 4a4 4 0 0 1-4 3v1h-7v-1l-1 1c-2 0-3-2-3-4 0-1 1-3 3-3 0-2 2-4 4-4Z",
|
84
|
+
"fill": getUrlById("b")
|
85
|
+
}, null)])];
|
86
|
+
const renderNetwork = () => _createVNode("svg", {
|
87
|
+
"viewBox": "0 0 160 160"
|
88
|
+
}, [_createVNode("defs", null, [_createVNode("linearGradient", {
|
89
|
+
"id": getId(1),
|
90
|
+
"x1": "64%",
|
91
|
+
"y1": "100%",
|
92
|
+
"x2": "64%"
|
93
|
+
}, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)]), _createVNode("linearGradient", {
|
94
|
+
"id": getId(2),
|
95
|
+
"x1": "50%",
|
96
|
+
"x2": "50%",
|
97
|
+
"y2": "84%"
|
98
|
+
}, [renderStop("#EBEDF0", 0), renderStop("#DCDEE0", 100, 0)]), _createVNode("linearGradient", {
|
99
|
+
"id": getId(3),
|
100
|
+
"x1": "100%",
|
101
|
+
"x2": "100%",
|
102
|
+
"y2": "100%"
|
103
|
+
}, [renderStops("#EAEDF0", "#DCDEE0")]), _createVNode("radialGradient", {
|
104
|
+
"id": getId(4),
|
105
|
+
"cx": "50%",
|
106
|
+
"cy": "0%",
|
107
|
+
"fx": "50%",
|
108
|
+
"fy": "0%",
|
109
|
+
"r": "100%",
|
110
|
+
"gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
|
111
|
+
}, [renderStop("#EBEDF0", 0), renderStop("#FFF", 100, 0)])]), _createVNode("g", {
|
112
|
+
"fill": "none"
|
113
|
+
}, [renderBuilding(), _createVNode("path", {
|
114
|
+
"fill": getUrlById(4),
|
115
|
+
"d": "M0 139h160v21H0z"
|
116
|
+
}, null), _createVNode("path", {
|
117
|
+
"d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
|
118
|
+
"fill": getUrlById(2)
|
119
|
+
}, null), _createVNode("g", {
|
120
|
+
"opacity": ".6",
|
121
|
+
"stroke-linecap": "round",
|
122
|
+
"stroke-width": "7"
|
123
|
+
}, [_createVNode("path", {
|
124
|
+
"d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
|
125
|
+
"stroke": getUrlById(3)
|
126
|
+
}, null), _createVNode("path", {
|
127
|
+
"d": "M53 36a34 34 0 0 0 0 48",
|
128
|
+
"stroke": getUrlById(3)
|
129
|
+
}, null), _createVNode("path", {
|
130
|
+
"d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
|
131
|
+
"stroke": getUrlById(3)
|
132
|
+
}, null), _createVNode("path", {
|
133
|
+
"d": "M106 84a34 34 0 0 0 0-48",
|
134
|
+
"stroke": getUrlById(3)
|
135
|
+
}, null)]), _createVNode("g", {
|
136
|
+
"transform": "translate(31 105)"
|
137
|
+
}, [_createVNode("rect", {
|
138
|
+
"fill": "#EBEDF0",
|
139
|
+
"width": "98",
|
140
|
+
"height": "34",
|
141
|
+
"rx": "2"
|
142
|
+
}, null), _createVNode("rect", {
|
143
|
+
"fill": "#FFF",
|
144
|
+
"x": "9",
|
145
|
+
"y": "8",
|
146
|
+
"width": "80",
|
147
|
+
"height": "18",
|
148
|
+
"rx": "1.1"
|
149
|
+
}, null), _createVNode("rect", {
|
150
|
+
"fill": "#EBEDF0",
|
151
|
+
"x": "15",
|
152
|
+
"y": "12",
|
153
|
+
"width": "18",
|
154
|
+
"height": "6",
|
155
|
+
"rx": "1.1"
|
156
|
+
}, null)])])]);
|
157
|
+
const renderMaterial = () => _createVNode("svg", {
|
158
|
+
"viewBox": "0 0 160 160"
|
159
|
+
}, [_createVNode("defs", null, [_createVNode("linearGradient", {
|
160
|
+
"x1": "50%",
|
161
|
+
"x2": "50%",
|
162
|
+
"y2": "100%",
|
163
|
+
"id": getId(5)
|
164
|
+
}, [renderStops("#F2F3F5", "#DCDEE0")]), _createVNode("linearGradient", {
|
165
|
+
"x1": "95%",
|
166
|
+
"y1": "48%",
|
167
|
+
"x2": "5.5%",
|
168
|
+
"y2": "51%",
|
169
|
+
"id": getId(6)
|
170
|
+
}, [renderStops("#EAEDF1", "#DCDEE0")]), _createVNode("linearGradient", {
|
171
|
+
"y1": "45%",
|
172
|
+
"x2": "100%",
|
173
|
+
"y2": "54%",
|
174
|
+
"id": getId(7)
|
175
|
+
}, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), _createVNode("g", {
|
176
|
+
"transform": "translate(36 50)",
|
177
|
+
"fill": "none"
|
178
|
+
}, [_createVNode("g", {
|
179
|
+
"transform": "translate(8)"
|
180
|
+
}, [_createVNode("rect", {
|
181
|
+
"fill": "#EBEDF0",
|
182
|
+
"opacity": ".6",
|
183
|
+
"x": "38",
|
184
|
+
"y": "13",
|
185
|
+
"width": "36",
|
186
|
+
"height": "53",
|
187
|
+
"rx": "2"
|
188
|
+
}, null), _createVNode("rect", {
|
189
|
+
"fill": getUrlById(5),
|
190
|
+
"width": "64",
|
191
|
+
"height": "66",
|
192
|
+
"rx": "2"
|
193
|
+
}, null), _createVNode("rect", {
|
194
|
+
"fill": "#FFF",
|
195
|
+
"x": "6",
|
196
|
+
"y": "6",
|
197
|
+
"width": "52",
|
198
|
+
"height": "55",
|
199
|
+
"rx": "1"
|
200
|
+
}, null), _createVNode("g", {
|
201
|
+
"transform": "translate(15 17)",
|
202
|
+
"fill": getUrlById(6)
|
203
|
+
}, [_createVNode("rect", {
|
204
|
+
"width": "34",
|
205
|
+
"height": "6",
|
206
|
+
"rx": "1"
|
207
|
+
}, null), _createVNode("path", {
|
208
|
+
"d": "M0 14h34v6H0z"
|
209
|
+
}, null), _createVNode("rect", {
|
210
|
+
"y": "28",
|
211
|
+
"width": "34",
|
212
|
+
"height": "6",
|
213
|
+
"rx": "1"
|
214
|
+
}, null)])]), _createVNode("rect", {
|
215
|
+
"fill": getUrlById(7),
|
216
|
+
"y": "61",
|
217
|
+
"width": "88",
|
218
|
+
"height": "28",
|
219
|
+
"rx": "1"
|
220
|
+
}, null), _createVNode("rect", {
|
221
|
+
"fill": "#F7F8FA",
|
222
|
+
"x": "29",
|
223
|
+
"y": "72",
|
224
|
+
"width": "30",
|
225
|
+
"height": "6",
|
226
|
+
"rx": "1"
|
227
|
+
}, null)])]);
|
228
|
+
const renderError = () => _createVNode("svg", {
|
229
|
+
"viewBox": "0 0 160 160"
|
230
|
+
}, [_createVNode("defs", null, [_createVNode("linearGradient", {
|
231
|
+
"x1": "50%",
|
232
|
+
"x2": "50%",
|
233
|
+
"y2": "100%",
|
234
|
+
"id": getId(8)
|
235
|
+
}, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), renderShadow("c"), _createVNode("path", {
|
236
|
+
"d": "m59 60 21 21 21-21h3l9 9v3L92 93l21 21v3l-9 9h-3l-21-21-21 21h-3l-9-9v-3l21-21-21-21v-3l9-9h3Z",
|
237
|
+
"fill": getUrlById(8)
|
238
|
+
}, null)]);
|
239
|
+
const renderSearch = () => _createVNode("svg", {
|
240
|
+
"viewBox": "0 0 160 160"
|
241
|
+
}, [_createVNode("defs", null, [_createVNode("linearGradient", {
|
242
|
+
"x1": "50%",
|
243
|
+
"y1": "100%",
|
244
|
+
"x2": "50%",
|
245
|
+
"id": getId(9)
|
246
|
+
}, [renderStops("#EEE", "#D8D8D8")]), _createVNode("linearGradient", {
|
247
|
+
"x1": "100%",
|
248
|
+
"y1": "50%",
|
249
|
+
"y2": "50%",
|
250
|
+
"id": getId(10)
|
251
|
+
}, [renderStops("#F2F3F5", "#DCDEE0")]), _createVNode("linearGradient", {
|
252
|
+
"x1": "50%",
|
253
|
+
"x2": "50%",
|
254
|
+
"y2": "100%",
|
255
|
+
"id": getId(11)
|
256
|
+
}, [renderStops("#F2F3F5", "#DCDEE0")]), _createVNode("linearGradient", {
|
257
|
+
"x1": "50%",
|
258
|
+
"x2": "50%",
|
259
|
+
"y2": "100%",
|
260
|
+
"id": getId(12)
|
261
|
+
}, [renderStops("#FFF", "#F7F8FA")])]), renderBuilding(), renderCloud(), renderShadow("d"), _createVNode("g", {
|
262
|
+
"transform": "rotate(-45 113 -4)",
|
263
|
+
"fill": "none"
|
264
|
+
}, [_createVNode("rect", {
|
265
|
+
"fill": getUrlById(9),
|
266
|
+
"x": "24",
|
267
|
+
"y": "52.8",
|
268
|
+
"width": "5.8",
|
269
|
+
"height": "19",
|
270
|
+
"rx": "1"
|
271
|
+
}, null), _createVNode("rect", {
|
272
|
+
"fill": getUrlById(10),
|
273
|
+
"x": "22.1",
|
274
|
+
"y": "67.3",
|
275
|
+
"width": "9.9",
|
276
|
+
"height": "28",
|
277
|
+
"rx": "1"
|
278
|
+
}, null), _createVNode("circle", {
|
279
|
+
"stroke": getUrlById(11),
|
280
|
+
"stroke-width": "8",
|
281
|
+
"cx": "27",
|
282
|
+
"cy": "27",
|
283
|
+
"r": "27"
|
284
|
+
}, null), _createVNode("circle", {
|
285
|
+
"fill": getUrlById(12),
|
286
|
+
"cx": "27",
|
287
|
+
"cy": "27",
|
288
|
+
"r": "16"
|
289
|
+
}, null), _createVNode("path", {
|
290
|
+
"d": "M37 7c-8 0-15 5-16 12",
|
291
|
+
"stroke": getUrlById(11),
|
292
|
+
"stroke-width": "3",
|
293
|
+
"opacity": ".5",
|
294
|
+
"stroke-linecap": "round",
|
295
|
+
"transform": "rotate(45 29 13)"
|
296
|
+
}, null)])]);
|
297
|
+
const renderImage = () => {
|
298
|
+
var _a;
|
299
|
+
if (slots.image) {
|
300
|
+
return slots.image();
|
301
|
+
}
|
302
|
+
const PRESET_IMAGES = {
|
303
|
+
error: renderError,
|
304
|
+
search: renderSearch,
|
305
|
+
network: renderNetwork,
|
306
|
+
default: renderMaterial
|
307
|
+
};
|
308
|
+
return ((_a = PRESET_IMAGES[props.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || _createVNode("img", {
|
309
|
+
"src": props.image
|
310
|
+
}, null);
|
311
|
+
};
|
47
312
|
return () => _createVNode("div", {
|
48
313
|
"class": bem()
|
49
314
|
}, [_createVNode("div", {
|
package/es/field/Field.d.ts
CHANGED
@@ -304,12 +304,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
304
304
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
305
305
|
}, {
|
306
306
|
type: FieldType;
|
307
|
+
required: boolean;
|
307
308
|
center: boolean;
|
308
309
|
autofocus: boolean;
|
309
310
|
disabled: boolean;
|
310
311
|
isLink: boolean;
|
311
312
|
border: boolean;
|
312
|
-
required: boolean;
|
313
313
|
clickable: boolean | null;
|
314
314
|
clearable: boolean;
|
315
315
|
clearIcon: string;
|
package/es/field/Field.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { createTextVNode as _createTextVNode, mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
2
2
|
import { ref, watch, provide, computed, nextTick, reactive, onMounted, defineComponent } from "vue";
|
3
3
|
import { isDef, extend, addUnit, toArray, FORM_KEY, numericProp, unknownProp, resetScroll, formatNumber, preventDefault, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
4
|
-
import { cutString, runSyncRule, endComposing, mapInputType, startComposing, getRuleMessage, resizeTextarea, getStringLength, runRuleValidator } from "./utils.mjs";
|
4
|
+
import { cutString, runSyncRule, endComposing, mapInputType, isEmptyValue, startComposing, getRuleMessage, resizeTextarea, getStringLength, runRuleValidator } from "./utils.mjs";
|
5
5
|
import { cellSharedProps } from "../cell/Cell.mjs";
|
6
6
|
import { CUSTOM_FIELD_INJECTION_KEY, useParent } from "@vant/use";
|
7
7
|
import { useId } from "../composables/use-id.mjs";
|
@@ -117,6 +117,9 @@ var stdin_default = defineComponent({
|
|
117
117
|
return;
|
118
118
|
}
|
119
119
|
if (rule.validator) {
|
120
|
+
if (isEmptyValue(value) && rule.validateEmpty === false) {
|
121
|
+
return;
|
122
|
+
}
|
120
123
|
return runRuleValidator(value, rule).then((result) => {
|
121
124
|
if (result && typeof result === "string") {
|
122
125
|
state.status = "failed";
|
package/es/field/index.d.ts
CHANGED
@@ -176,12 +176,12 @@ export declare const Field: import("../utils").WithInstall<import("vue").DefineC
|
|
176
176
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
177
177
|
}, {
|
178
178
|
type: import("./types").FieldType;
|
179
|
+
required: boolean;
|
179
180
|
center: boolean;
|
180
181
|
autofocus: boolean;
|
181
182
|
disabled: boolean;
|
182
183
|
isLink: boolean;
|
183
184
|
border: boolean;
|
184
|
-
required: boolean;
|
185
185
|
clickable: boolean | null;
|
186
186
|
clearable: boolean;
|
187
187
|
clearIcon: string;
|
package/es/field/index.less
CHANGED
package/es/field/types.d.ts
CHANGED
@@ -23,6 +23,7 @@ export declare type FieldRule = {
|
|
23
23
|
required?: boolean;
|
24
24
|
validator?: FieldRuleValidator;
|
25
25
|
formatter?: FiledRuleFormatter;
|
26
|
+
validateEmpty?: boolean;
|
26
27
|
};
|
27
28
|
export declare type FieldValidationStatus = 'passed' | 'failed' | 'unvalidated';
|
28
29
|
export declare type FieldFormSharedProps = 'colon' | 'disabled' | 'readonly' | 'labelWidth' | 'labelAlign' | 'inputAlign' | 'errorMessageAlign';
|
package/es/field/utils.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { HTMLAttributes, InputHTMLAttributes } from 'vue';
|
2
2
|
import type { FieldRule, FieldType, FieldAutosizeConfig } from './types';
|
3
|
+
export declare function isEmptyValue(value: unknown): boolean;
|
3
4
|
export declare function runSyncRule(value: unknown, rule: FieldRule): boolean;
|
4
5
|
export declare function runRuleValidator(value: unknown, rule: FieldRule): Promise<unknown>;
|
5
6
|
export declare function getRuleMessage(value: unknown, rule: FieldRule): string;
|
package/es/field/utils.mjs
CHANGED
@@ -15,8 +15,13 @@ function isEmptyValue(value) {
|
|
15
15
|
return !value;
|
16
16
|
}
|
17
17
|
function runSyncRule(value, rule) {
|
18
|
-
if (
|
19
|
-
|
18
|
+
if (isEmptyValue(value)) {
|
19
|
+
if (rule.required) {
|
20
|
+
return false;
|
21
|
+
}
|
22
|
+
if (rule.validateEmpty === false) {
|
23
|
+
return true;
|
24
|
+
}
|
20
25
|
}
|
21
26
|
if (rule.pattern && !rule.pattern.test(String(value))) {
|
22
27
|
return false;
|
@@ -93,6 +98,7 @@ export {
|
|
93
98
|
endComposing,
|
94
99
|
getRuleMessage,
|
95
100
|
getStringLength,
|
101
|
+
isEmptyValue,
|
96
102
|
mapInputType,
|
97
103
|
resizeTextarea,
|
98
104
|
runRuleValidator,
|
package/es/grid-item/index.less
CHANGED
package/es/index.d.ts
CHANGED
@@ -67,6 +67,7 @@ export * from "./sidebar";
|
|
67
67
|
export * from "./sidebar-item";
|
68
68
|
export * from "./skeleton";
|
69
69
|
export * from "./slider";
|
70
|
+
export * from "./space";
|
70
71
|
export * from "./step";
|
71
72
|
export * from "./stepper";
|
72
73
|
export * from "./steps";
|
@@ -90,4 +91,4 @@ declare namespace _default {
|
|
90
91
|
}
|
91
92
|
export default _default;
|
92
93
|
export function install(app: any): void;
|
93
|
-
export const version: "3.
|
94
|
+
export const version: "3.6.0";
|
package/es/index.mjs
CHANGED
@@ -66,6 +66,7 @@ import { Sidebar } from "./sidebar/index.mjs";
|
|
66
66
|
import { SidebarItem } from "./sidebar-item/index.mjs";
|
67
67
|
import { Skeleton } from "./skeleton/index.mjs";
|
68
68
|
import { Slider } from "./slider/index.mjs";
|
69
|
+
import { Space } from "./space/index.mjs";
|
69
70
|
import { Step } from "./step/index.mjs";
|
70
71
|
import { Stepper } from "./stepper/index.mjs";
|
71
72
|
import { Steps } from "./steps/index.mjs";
|
@@ -83,7 +84,7 @@ import { Tag } from "./tag/index.mjs";
|
|
83
84
|
import { Toast } from "./toast/index.mjs";
|
84
85
|
import { TreeSelect } from "./tree-select/index.mjs";
|
85
86
|
import { Uploader } from "./uploader/index.mjs";
|
86
|
-
const version = "3.
|
87
|
+
const version = "3.6.0";
|
87
88
|
function install(app) {
|
88
89
|
const components = [
|
89
90
|
ActionBar,
|
@@ -154,6 +155,7 @@ function install(app) {
|
|
154
155
|
SidebarItem,
|
155
156
|
Skeleton,
|
156
157
|
Slider,
|
158
|
+
Space,
|
157
159
|
Step,
|
158
160
|
Stepper,
|
159
161
|
Steps,
|
@@ -249,6 +251,7 @@ export * from "./sidebar/index.mjs";
|
|
249
251
|
export * from "./sidebar-item/index.mjs";
|
250
252
|
export * from "./skeleton/index.mjs";
|
251
253
|
export * from "./slider/index.mjs";
|
254
|
+
export * from "./space/index.mjs";
|
252
255
|
export * from "./step/index.mjs";
|
253
256
|
export * from "./stepper/index.mjs";
|
254
257
|
export * from "./steps/index.mjs";
|
package/es/locale/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
declare type Message = Record<string, any>;
|
2
2
|
export declare const Locale: {
|
3
3
|
messages(): Message;
|
4
|
-
use(newLang: string, newMessages?: Message
|
4
|
+
use(newLang: string, newMessages?: Message): void;
|
5
5
|
add(newMessages?: Message): void;
|
6
6
|
};
|
7
7
|
export default Locale;
|
package/es/popover/Popover.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { mergeProps as _mergeProps, Fragment as _Fragment, createVNode as _createVNode } from "vue";
|
2
|
-
import { ref, watch, nextTick, onMounted, onBeforeUnmount, defineComponent } from "vue";
|
2
|
+
import { ref, watch, nextTick, onMounted, watchEffect, onBeforeUnmount, defineComponent } from "vue";
|
3
3
|
import { createPopper, offsetModifier } from "@vant/popperjs";
|
4
4
|
import { pick, extend, truthProp, numericProp, unknownProp, BORDER_BOTTOM, makeArrayProp, makeStringProp, createNamespace } from "../utils/index.mjs";
|
5
5
|
import { useClickAway } from "@vant/use";
|
@@ -41,24 +41,26 @@ var stdin_default = defineComponent({
|
|
41
41
|
attrs
|
42
42
|
}) {
|
43
43
|
let popper;
|
44
|
+
const popupRef = ref();
|
44
45
|
const wrapperRef = ref();
|
45
46
|
const popoverRef = ref();
|
47
|
+
const getPopoverOptions = () => ({
|
48
|
+
placement: props.placement,
|
49
|
+
modifiers: [{
|
50
|
+
name: "computeStyles",
|
51
|
+
options: {
|
52
|
+
adaptive: false,
|
53
|
+
gpuAcceleration: false
|
54
|
+
}
|
55
|
+
}, extend({}, offsetModifier, {
|
56
|
+
options: {
|
57
|
+
offset: props.offset
|
58
|
+
}
|
59
|
+
})]
|
60
|
+
});
|
46
61
|
const createPopperInstance = () => {
|
47
62
|
if (wrapperRef.value && popoverRef.value) {
|
48
|
-
return createPopper(wrapperRef.value, popoverRef.value.popupRef.value,
|
49
|
-
placement: props.placement,
|
50
|
-
modifiers: [{
|
51
|
-
name: "computeStyles",
|
52
|
-
options: {
|
53
|
-
adaptive: false,
|
54
|
-
gpuAcceleration: false
|
55
|
-
}
|
56
|
-
}, extend({}, offsetModifier, {
|
57
|
-
options: {
|
58
|
-
offset: props.offset
|
59
|
-
}
|
60
|
-
})]
|
61
|
-
});
|
63
|
+
return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, getPopoverOptions());
|
62
64
|
}
|
63
65
|
return null;
|
64
66
|
};
|
@@ -70,9 +72,7 @@ var stdin_default = defineComponent({
|
|
70
72
|
if (!popper) {
|
71
73
|
popper = createPopperInstance();
|
72
74
|
} else {
|
73
|
-
popper.setOptions(
|
74
|
-
placement: props.placement
|
75
|
-
});
|
75
|
+
popper.setOptions(getPopoverOptions());
|
76
76
|
}
|
77
77
|
});
|
78
78
|
};
|
@@ -82,10 +82,6 @@ var stdin_default = defineComponent({
|
|
82
82
|
updateShow(!props.show);
|
83
83
|
}
|
84
84
|
};
|
85
|
-
const onTouchstart = (event) => {
|
86
|
-
event.stopPropagation();
|
87
|
-
emit("touchstart", event);
|
88
|
-
};
|
89
85
|
const onClickAction = (action, index) => {
|
90
86
|
if (action.disabled) {
|
91
87
|
return;
|
@@ -96,7 +92,7 @@ var stdin_default = defineComponent({
|
|
96
92
|
}
|
97
93
|
};
|
98
94
|
const onClickAway = () => {
|
99
|
-
if (props.closeOnClickOutside && (!props.overlay || props.closeOnClickOverlay)) {
|
95
|
+
if (props.show && props.closeOnClickOutside && (!props.overlay || props.closeOnClickOverlay)) {
|
100
96
|
updateShow(false);
|
101
97
|
}
|
102
98
|
};
|
@@ -136,15 +132,21 @@ var stdin_default = defineComponent({
|
|
136
132
|
"onClick": () => onClickAction(action, index)
|
137
133
|
}, [renderActionContent(action, index)]);
|
138
134
|
};
|
139
|
-
onMounted(
|
135
|
+
onMounted(() => {
|
136
|
+
updateLocation();
|
137
|
+
watchEffect(() => {
|
138
|
+
var _a;
|
139
|
+
popupRef.value = (_a = popoverRef.value) == null ? void 0 : _a.popupRef.value;
|
140
|
+
});
|
141
|
+
});
|
140
142
|
onBeforeUnmount(() => {
|
141
143
|
if (popper) {
|
142
144
|
popper.destroy();
|
143
145
|
popper = null;
|
144
146
|
}
|
145
147
|
});
|
146
|
-
watch(() => [props.show, props.placement], updateLocation);
|
147
|
-
useClickAway(wrapperRef, onClickAway, {
|
148
|
+
watch(() => [props.show, props.offset, props.placement], updateLocation);
|
149
|
+
useClickAway([wrapperRef, popupRef], onClickAway, {
|
148
150
|
eventName: "touchstart"
|
149
151
|
});
|
150
152
|
return () => {
|
@@ -159,7 +161,6 @@ var stdin_default = defineComponent({
|
|
159
161
|
"position": "",
|
160
162
|
"transition": "van-popover-zoom",
|
161
163
|
"lockScroll": false,
|
162
|
-
"onTouchstart": onTouchstart,
|
163
164
|
"onUpdate:show": updateShow
|
164
165
|
}, attrs, pick(props, popupProps)), {
|
165
166
|
default: () => [props.showArrow && _createVNode("div", {
|
package/es/popup/Popup.mjs
CHANGED
@@ -7,6 +7,7 @@ import { useExpose } from "../composables/use-expose.mjs";
|
|
7
7
|
import { useLockScroll } from "../composables/use-lock-scroll.mjs";
|
8
8
|
import { useLazyRender } from "../composables/use-lazy-render.mjs";
|
9
9
|
import { POPUP_TOGGLE_KEY } from "../composables/on-popup-reopen.mjs";
|
10
|
+
import { useGlobalZIndex } from "../composables/use-global-z-index.mjs";
|
10
11
|
import { Icon } from "../icon/index.mjs";
|
11
12
|
import { Overlay } from "../overlay/index.mjs";
|
12
13
|
const popupProps = extend({}, popupSharedProps, {
|
@@ -22,7 +23,6 @@ const popupProps = extend({}, popupSharedProps, {
|
|
22
23
|
safeAreaInsetBottom: Boolean
|
23
24
|
});
|
24
25
|
const [name, bem] = createNamespace("popup");
|
25
|
-
let globalZIndex = 2e3;
|
26
26
|
var stdin_default = defineComponent({
|
27
27
|
name,
|
28
28
|
inheritAttrs: false,
|
@@ -50,11 +50,8 @@ var stdin_default = defineComponent({
|
|
50
50
|
});
|
51
51
|
const open = () => {
|
52
52
|
if (!opened) {
|
53
|
-
if (props.zIndex !== void 0) {
|
54
|
-
globalZIndex = +props.zIndex;
|
55
|
-
}
|
56
53
|
opened = true;
|
57
|
-
zIndex.value =
|
54
|
+
zIndex.value = props.zIndex !== void 0 ? +props.zIndex : useGlobalZIndex();
|
58
55
|
emit("open");
|
59
56
|
}
|
60
57
|
};
|
@@ -83,6 +80,8 @@ var stdin_default = defineComponent({
|
|
83
80
|
"zIndex": zIndex.value,
|
84
81
|
"duration": props.duration,
|
85
82
|
"customStyle": props.overlayStyle,
|
83
|
+
"role": props.closeOnClickOverlay ? "button" : void 0,
|
84
|
+
"tabindex": props.closeOnClickOverlay ? 0 : void 0,
|
86
85
|
"onClick": onClickOverlay
|
87
86
|
}, {
|
88
87
|
default: slots["overlay-content"]
|
@@ -119,6 +118,8 @@ var stdin_default = defineComponent({
|
|
119
118
|
return _withDirectives(_createVNode("div", _mergeProps({
|
120
119
|
"ref": popupRef,
|
121
120
|
"style": style.value,
|
121
|
+
"role": "dialog",
|
122
|
+
"tabindex": 0,
|
122
123
|
"class": [bem({
|
123
124
|
round,
|
124
125
|
[position]: position
|