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
@@ -22,14 +22,20 @@ __export(stdin_exports, {
|
|
22
22
|
module.exports = __toCommonJS(stdin_exports);
|
23
23
|
var import_use = require("@vant/use");
|
24
24
|
var import_vue = require("vue");
|
25
|
-
|
25
|
+
var import_on_popup_reopen = require("./on-popup-reopen");
|
26
|
+
const useHeight = (element, withSafeArea) => {
|
26
27
|
const height = (0, import_vue.ref)();
|
27
28
|
const setHeight = () => {
|
28
29
|
height.value = (0, import_use.useRect)(element).height;
|
29
30
|
};
|
30
31
|
(0, import_vue.onMounted)(() => {
|
31
32
|
(0, import_vue.nextTick)(setHeight);
|
32
|
-
|
33
|
+
if (withSafeArea) {
|
34
|
+
for (let i = 1; i <= 3; i++) {
|
35
|
+
setTimeout(setHeight, 100 * i);
|
36
|
+
}
|
37
|
+
}
|
33
38
|
});
|
39
|
+
(0, import_on_popup_reopen.onPopupReopen)(() => (0, import_vue.nextTick)(setHeight));
|
34
40
|
return height;
|
35
41
|
};
|
@@ -28,9 +28,11 @@ let totalLockCount = 0;
|
|
28
28
|
const BODY_LOCK_CLASS = "van-overflow-hidden";
|
29
29
|
function useLockScroll(rootRef, shouldLock) {
|
30
30
|
const touch = (0, import_use_touch.useTouch)();
|
31
|
+
const DIRECTION_UP = "01";
|
32
|
+
const DIRECTION_DOWN = "10";
|
31
33
|
const onTouchMove = (event) => {
|
32
34
|
touch.move(event);
|
33
|
-
const direction = touch.deltaY.value > 0 ?
|
35
|
+
const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
|
34
36
|
const el = (0, import_use.getScrollParent)(event.target, rootRef.value);
|
35
37
|
const { scrollHeight, offsetHeight, scrollTop } = el;
|
36
38
|
let status = "11";
|
@@ -23,7 +23,7 @@ module.exports = __toCommonJS(stdin_exports);
|
|
23
23
|
var import_vue = require("vue");
|
24
24
|
var import_use_height = require("./use-height");
|
25
25
|
function usePlaceholder(contentRef, bem) {
|
26
|
-
const height = (0, import_use_height.useHeight)(contentRef);
|
26
|
+
const height = (0, import_use_height.useHeight)(contentRef, true);
|
27
27
|
return (renderContent) => (0, import_vue.createVNode)("div", {
|
28
28
|
"class": bem("placeholder"),
|
29
29
|
"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
|
}>>, {
|
@@ -24,10 +24,12 @@ module.exports = __toCommonJS(stdin_exports);
|
|
24
24
|
var import_vue = require("vue");
|
25
25
|
var import_vue2 = require("vue");
|
26
26
|
var import_utils = require("../utils");
|
27
|
+
var import_use_global_z_index = require("../composables/use-global-z-index");
|
27
28
|
const [name, bem] = (0, import_utils.createNamespace)("config-provider");
|
28
29
|
const CONFIG_PROVIDER_KEY = Symbol(name);
|
29
30
|
const configProviderProps = {
|
30
31
|
tag: (0, import_utils.makeStringProp)("div"),
|
32
|
+
zIndex: Number,
|
31
33
|
themeVars: Object,
|
32
34
|
iconPrefix: String
|
33
35
|
};
|
@@ -50,6 +52,11 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
50
52
|
}
|
51
53
|
});
|
52
54
|
(0, import_vue2.provide)(CONFIG_PROVIDER_KEY, props);
|
55
|
+
(0, import_vue2.watchEffect)(() => {
|
56
|
+
if (props.zIndex !== void 0) {
|
57
|
+
(0, import_use_global_z_index.setGlobalZIndex)(props.zIndex);
|
58
|
+
}
|
59
|
+
});
|
53
60
|
return () => (0, import_vue.createVNode)(props.tag, {
|
54
61
|
"class": bem(),
|
55
62
|
"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
|
}>>, {
|
package/lib/dialog/Dialog.d.ts
CHANGED
@@ -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
|
33
|
+
callback: PropType<(action?: DialogAction) => void>;
|
34
34
|
allowHtml: BooleanConstructor;
|
35
35
|
className: PropType<unknown>;
|
36
36
|
transition: {
|
package/lib/empty/Empty.d.ts
CHANGED
package/lib/empty/Empty.js
CHANGED
@@ -22,15 +22,9 @@ __export(stdin_exports, {
|
|
22
22
|
module.exports = __toCommonJS(stdin_exports);
|
23
23
|
var import_vue = require("vue");
|
24
24
|
var import_vue2 = require("vue");
|
25
|
+
var import_use_id = require("../composables/use-id");
|
25
26
|
var import_utils = require("../utils");
|
26
|
-
var import_Images = require("./Images");
|
27
27
|
const [name, bem] = (0, import_utils.createNamespace)("empty");
|
28
|
-
const PRESET_IMAGES = {
|
29
|
-
error: import_Images.renderError,
|
30
|
-
search: import_Images.renderSearch,
|
31
|
-
network: import_Images.renderNetwork,
|
32
|
-
default: import_Images.renderMaterial
|
33
|
-
};
|
34
28
|
const emptyProps = {
|
35
29
|
image: (0, import_utils.makeStringProp)("default"),
|
36
30
|
imageSize: [Number, String, Array],
|
@@ -42,15 +36,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
42
36
|
setup(props, {
|
43
37
|
slots
|
44
38
|
}) {
|
45
|
-
const renderImage = () => {
|
46
|
-
var _a;
|
47
|
-
if (slots.image) {
|
48
|
-
return slots.image();
|
49
|
-
}
|
50
|
-
return ((_a = PRESET_IMAGES[props.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || (0, import_vue.createVNode)("img", {
|
51
|
-
"src": props.image
|
52
|
-
}, null);
|
53
|
-
};
|
54
39
|
const renderDescription = () => {
|
55
40
|
const description = slots.description ? slots.description() : props.description;
|
56
41
|
if (description) {
|
@@ -66,6 +51,286 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
66
51
|
}, [slots.default()]);
|
67
52
|
}
|
68
53
|
};
|
54
|
+
const baseId = (0, import_use_id.useId)();
|
55
|
+
const getId = (num) => `${baseId}-${num}`;
|
56
|
+
const getUrlById = (num) => `url(#${getId(num)})`;
|
57
|
+
const renderStop = (color, offset, opacity) => (0, import_vue.createVNode)("stop", {
|
58
|
+
"stop-color": color,
|
59
|
+
"offset": `${offset}%`,
|
60
|
+
"stop-opacity": opacity
|
61
|
+
}, null);
|
62
|
+
const renderStops = (fromColor, toColor) => [renderStop(fromColor, 0), renderStop(toColor, 100)];
|
63
|
+
const renderShadow = (id) => [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("radialGradient", {
|
64
|
+
"id": getId(id),
|
65
|
+
"cx": "50%",
|
66
|
+
"cy": "54%",
|
67
|
+
"fx": "50%",
|
68
|
+
"fy": "54%",
|
69
|
+
"r": "297%",
|
70
|
+
"gradientTransform": "matrix(-.16 0 0 -.33 .58 .72)"
|
71
|
+
}, [renderStop("#EBEDF0", 0), renderStop("#F2F3F5", 100, 0.3)])]), (0, import_vue.createVNode)("ellipse", {
|
72
|
+
"fill": getUrlById(id),
|
73
|
+
"opacity": ".8",
|
74
|
+
"cx": "80",
|
75
|
+
"cy": "140",
|
76
|
+
"rx": "46",
|
77
|
+
"ry": "8"
|
78
|
+
}, null)];
|
79
|
+
const renderBuilding = () => [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
|
80
|
+
"id": getId("a"),
|
81
|
+
"x1": "64%",
|
82
|
+
"y1": "100%",
|
83
|
+
"x2": "64%"
|
84
|
+
}, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)])]), (0, import_vue.createVNode)("g", {
|
85
|
+
"opacity": ".8"
|
86
|
+
}, [(0, import_vue.createVNode)("path", {
|
87
|
+
"d": "M36 131V53H16v20H2v58h34z",
|
88
|
+
"fill": getUrlById("a")
|
89
|
+
}, null), (0, import_vue.createVNode)("path", {
|
90
|
+
"d": "M123 15h22v14h9v77h-31V15z",
|
91
|
+
"fill": getUrlById("a")
|
92
|
+
}, null)])];
|
93
|
+
const renderCloud = () => [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
|
94
|
+
"id": getId("b"),
|
95
|
+
"x1": "64%",
|
96
|
+
"y1": "97%",
|
97
|
+
"x2": "64%",
|
98
|
+
"y2": "0%"
|
99
|
+
}, [renderStop("#F2F3F5", 0, 0.3), renderStop("#F2F3F5", 100)])]), (0, import_vue.createVNode)("g", {
|
100
|
+
"opacity": ".8"
|
101
|
+
}, [(0, import_vue.createVNode)("path", {
|
102
|
+
"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",
|
103
|
+
"fill": getUrlById("b")
|
104
|
+
}, null), (0, import_vue.createVNode)("path", {
|
105
|
+
"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",
|
106
|
+
"fill": getUrlById("b")
|
107
|
+
}, null)])];
|
108
|
+
const renderNetwork = () => (0, import_vue.createVNode)("svg", {
|
109
|
+
"viewBox": "0 0 160 160"
|
110
|
+
}, [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
|
111
|
+
"id": getId(1),
|
112
|
+
"x1": "64%",
|
113
|
+
"y1": "100%",
|
114
|
+
"x2": "64%"
|
115
|
+
}, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)]), (0, import_vue.createVNode)("linearGradient", {
|
116
|
+
"id": getId(2),
|
117
|
+
"x1": "50%",
|
118
|
+
"x2": "50%",
|
119
|
+
"y2": "84%"
|
120
|
+
}, [renderStop("#EBEDF0", 0), renderStop("#DCDEE0", 100, 0)]), (0, import_vue.createVNode)("linearGradient", {
|
121
|
+
"id": getId(3),
|
122
|
+
"x1": "100%",
|
123
|
+
"x2": "100%",
|
124
|
+
"y2": "100%"
|
125
|
+
}, [renderStops("#EAEDF0", "#DCDEE0")]), (0, import_vue.createVNode)("radialGradient", {
|
126
|
+
"id": getId(4),
|
127
|
+
"cx": "50%",
|
128
|
+
"cy": "0%",
|
129
|
+
"fx": "50%",
|
130
|
+
"fy": "0%",
|
131
|
+
"r": "100%",
|
132
|
+
"gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
|
133
|
+
}, [renderStop("#EBEDF0", 0), renderStop("#FFF", 100, 0)])]), (0, import_vue.createVNode)("g", {
|
134
|
+
"fill": "none"
|
135
|
+
}, [renderBuilding(), (0, import_vue.createVNode)("path", {
|
136
|
+
"fill": getUrlById(4),
|
137
|
+
"d": "M0 139h160v21H0z"
|
138
|
+
}, null), (0, import_vue.createVNode)("path", {
|
139
|
+
"d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
|
140
|
+
"fill": getUrlById(2)
|
141
|
+
}, null), (0, import_vue.createVNode)("g", {
|
142
|
+
"opacity": ".6",
|
143
|
+
"stroke-linecap": "round",
|
144
|
+
"stroke-width": "7"
|
145
|
+
}, [(0, import_vue.createVNode)("path", {
|
146
|
+
"d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
|
147
|
+
"stroke": getUrlById(3)
|
148
|
+
}, null), (0, import_vue.createVNode)("path", {
|
149
|
+
"d": "M53 36a34 34 0 0 0 0 48",
|
150
|
+
"stroke": getUrlById(3)
|
151
|
+
}, null), (0, import_vue.createVNode)("path", {
|
152
|
+
"d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
|
153
|
+
"stroke": getUrlById(3)
|
154
|
+
}, null), (0, import_vue.createVNode)("path", {
|
155
|
+
"d": "M106 84a34 34 0 0 0 0-48",
|
156
|
+
"stroke": getUrlById(3)
|
157
|
+
}, null)]), (0, import_vue.createVNode)("g", {
|
158
|
+
"transform": "translate(31 105)"
|
159
|
+
}, [(0, import_vue.createVNode)("rect", {
|
160
|
+
"fill": "#EBEDF0",
|
161
|
+
"width": "98",
|
162
|
+
"height": "34",
|
163
|
+
"rx": "2"
|
164
|
+
}, null), (0, import_vue.createVNode)("rect", {
|
165
|
+
"fill": "#FFF",
|
166
|
+
"x": "9",
|
167
|
+
"y": "8",
|
168
|
+
"width": "80",
|
169
|
+
"height": "18",
|
170
|
+
"rx": "1.1"
|
171
|
+
}, null), (0, import_vue.createVNode)("rect", {
|
172
|
+
"fill": "#EBEDF0",
|
173
|
+
"x": "15",
|
174
|
+
"y": "12",
|
175
|
+
"width": "18",
|
176
|
+
"height": "6",
|
177
|
+
"rx": "1.1"
|
178
|
+
}, null)])])]);
|
179
|
+
const renderMaterial = () => (0, import_vue.createVNode)("svg", {
|
180
|
+
"viewBox": "0 0 160 160"
|
181
|
+
}, [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
|
182
|
+
"x1": "50%",
|
183
|
+
"x2": "50%",
|
184
|
+
"y2": "100%",
|
185
|
+
"id": getId(5)
|
186
|
+
}, [renderStops("#F2F3F5", "#DCDEE0")]), (0, import_vue.createVNode)("linearGradient", {
|
187
|
+
"x1": "95%",
|
188
|
+
"y1": "48%",
|
189
|
+
"x2": "5.5%",
|
190
|
+
"y2": "51%",
|
191
|
+
"id": getId(6)
|
192
|
+
}, [renderStops("#EAEDF1", "#DCDEE0")]), (0, import_vue.createVNode)("linearGradient", {
|
193
|
+
"y1": "45%",
|
194
|
+
"x2": "100%",
|
195
|
+
"y2": "54%",
|
196
|
+
"id": getId(7)
|
197
|
+
}, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), (0, import_vue.createVNode)("g", {
|
198
|
+
"transform": "translate(36 50)",
|
199
|
+
"fill": "none"
|
200
|
+
}, [(0, import_vue.createVNode)("g", {
|
201
|
+
"transform": "translate(8)"
|
202
|
+
}, [(0, import_vue.createVNode)("rect", {
|
203
|
+
"fill": "#EBEDF0",
|
204
|
+
"opacity": ".6",
|
205
|
+
"x": "38",
|
206
|
+
"y": "13",
|
207
|
+
"width": "36",
|
208
|
+
"height": "53",
|
209
|
+
"rx": "2"
|
210
|
+
}, null), (0, import_vue.createVNode)("rect", {
|
211
|
+
"fill": getUrlById(5),
|
212
|
+
"width": "64",
|
213
|
+
"height": "66",
|
214
|
+
"rx": "2"
|
215
|
+
}, null), (0, import_vue.createVNode)("rect", {
|
216
|
+
"fill": "#FFF",
|
217
|
+
"x": "6",
|
218
|
+
"y": "6",
|
219
|
+
"width": "52",
|
220
|
+
"height": "55",
|
221
|
+
"rx": "1"
|
222
|
+
}, null), (0, import_vue.createVNode)("g", {
|
223
|
+
"transform": "translate(15 17)",
|
224
|
+
"fill": getUrlById(6)
|
225
|
+
}, [(0, import_vue.createVNode)("rect", {
|
226
|
+
"width": "34",
|
227
|
+
"height": "6",
|
228
|
+
"rx": "1"
|
229
|
+
}, null), (0, import_vue.createVNode)("path", {
|
230
|
+
"d": "M0 14h34v6H0z"
|
231
|
+
}, null), (0, import_vue.createVNode)("rect", {
|
232
|
+
"y": "28",
|
233
|
+
"width": "34",
|
234
|
+
"height": "6",
|
235
|
+
"rx": "1"
|
236
|
+
}, null)])]), (0, import_vue.createVNode)("rect", {
|
237
|
+
"fill": getUrlById(7),
|
238
|
+
"y": "61",
|
239
|
+
"width": "88",
|
240
|
+
"height": "28",
|
241
|
+
"rx": "1"
|
242
|
+
}, null), (0, import_vue.createVNode)("rect", {
|
243
|
+
"fill": "#F7F8FA",
|
244
|
+
"x": "29",
|
245
|
+
"y": "72",
|
246
|
+
"width": "30",
|
247
|
+
"height": "6",
|
248
|
+
"rx": "1"
|
249
|
+
}, null)])]);
|
250
|
+
const renderError = () => (0, import_vue.createVNode)("svg", {
|
251
|
+
"viewBox": "0 0 160 160"
|
252
|
+
}, [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
|
253
|
+
"x1": "50%",
|
254
|
+
"x2": "50%",
|
255
|
+
"y2": "100%",
|
256
|
+
"id": getId(8)
|
257
|
+
}, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), renderShadow("c"), (0, import_vue.createVNode)("path", {
|
258
|
+
"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",
|
259
|
+
"fill": getUrlById(8)
|
260
|
+
}, null)]);
|
261
|
+
const renderSearch = () => (0, import_vue.createVNode)("svg", {
|
262
|
+
"viewBox": "0 0 160 160"
|
263
|
+
}, [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
|
264
|
+
"x1": "50%",
|
265
|
+
"y1": "100%",
|
266
|
+
"x2": "50%",
|
267
|
+
"id": getId(9)
|
268
|
+
}, [renderStops("#EEE", "#D8D8D8")]), (0, import_vue.createVNode)("linearGradient", {
|
269
|
+
"x1": "100%",
|
270
|
+
"y1": "50%",
|
271
|
+
"y2": "50%",
|
272
|
+
"id": getId(10)
|
273
|
+
}, [renderStops("#F2F3F5", "#DCDEE0")]), (0, import_vue.createVNode)("linearGradient", {
|
274
|
+
"x1": "50%",
|
275
|
+
"x2": "50%",
|
276
|
+
"y2": "100%",
|
277
|
+
"id": getId(11)
|
278
|
+
}, [renderStops("#F2F3F5", "#DCDEE0")]), (0, import_vue.createVNode)("linearGradient", {
|
279
|
+
"x1": "50%",
|
280
|
+
"x2": "50%",
|
281
|
+
"y2": "100%",
|
282
|
+
"id": getId(12)
|
283
|
+
}, [renderStops("#FFF", "#F7F8FA")])]), renderBuilding(), renderCloud(), renderShadow("d"), (0, import_vue.createVNode)("g", {
|
284
|
+
"transform": "rotate(-45 113 -4)",
|
285
|
+
"fill": "none"
|
286
|
+
}, [(0, import_vue.createVNode)("rect", {
|
287
|
+
"fill": getUrlById(9),
|
288
|
+
"x": "24",
|
289
|
+
"y": "52.8",
|
290
|
+
"width": "5.8",
|
291
|
+
"height": "19",
|
292
|
+
"rx": "1"
|
293
|
+
}, null), (0, import_vue.createVNode)("rect", {
|
294
|
+
"fill": getUrlById(10),
|
295
|
+
"x": "22.1",
|
296
|
+
"y": "67.3",
|
297
|
+
"width": "9.9",
|
298
|
+
"height": "28",
|
299
|
+
"rx": "1"
|
300
|
+
}, null), (0, import_vue.createVNode)("circle", {
|
301
|
+
"stroke": getUrlById(11),
|
302
|
+
"stroke-width": "8",
|
303
|
+
"cx": "27",
|
304
|
+
"cy": "27",
|
305
|
+
"r": "27"
|
306
|
+
}, null), (0, import_vue.createVNode)("circle", {
|
307
|
+
"fill": getUrlById(12),
|
308
|
+
"cx": "27",
|
309
|
+
"cy": "27",
|
310
|
+
"r": "16"
|
311
|
+
}, null), (0, import_vue.createVNode)("path", {
|
312
|
+
"d": "M37 7c-8 0-15 5-16 12",
|
313
|
+
"stroke": getUrlById(11),
|
314
|
+
"stroke-width": "3",
|
315
|
+
"opacity": ".5",
|
316
|
+
"stroke-linecap": "round",
|
317
|
+
"transform": "rotate(45 29 13)"
|
318
|
+
}, null)])]);
|
319
|
+
const renderImage = () => {
|
320
|
+
var _a;
|
321
|
+
if (slots.image) {
|
322
|
+
return slots.image();
|
323
|
+
}
|
324
|
+
const PRESET_IMAGES = {
|
325
|
+
error: renderError,
|
326
|
+
search: renderSearch,
|
327
|
+
network: renderNetwork,
|
328
|
+
default: renderMaterial
|
329
|
+
};
|
330
|
+
return ((_a = PRESET_IMAGES[props.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || (0, import_vue.createVNode)("img", {
|
331
|
+
"src": props.image
|
332
|
+
}, null);
|
333
|
+
};
|
69
334
|
return () => (0, import_vue.createVNode)("div", {
|
70
335
|
"class": bem()
|
71
336
|
}, [(0, import_vue.createVNode)("div", {
|
package/lib/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/lib/field/Field.js
CHANGED
@@ -140,6 +140,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
140
140
|
return;
|
141
141
|
}
|
142
142
|
if (rule.validator) {
|
143
|
+
if ((0, import_utils2.isEmptyValue)(value) && rule.validateEmpty === false) {
|
144
|
+
return;
|
145
|
+
}
|
143
146
|
return (0, import_utils2.runRuleValidator)(value, rule).then((result) => {
|
144
147
|
if (result && typeof result === "string") {
|
145
148
|
state.status = "failed";
|
package/lib/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/lib/field/index.less
CHANGED
package/lib/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/lib/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/lib/field/utils.js
CHANGED
@@ -21,6 +21,7 @@ __export(stdin_exports, {
|
|
21
21
|
endComposing: () => endComposing,
|
22
22
|
getRuleMessage: () => getRuleMessage,
|
23
23
|
getStringLength: () => getStringLength,
|
24
|
+
isEmptyValue: () => isEmptyValue,
|
24
25
|
mapInputType: () => mapInputType,
|
25
26
|
resizeTextarea: () => resizeTextarea,
|
26
27
|
runRuleValidator: () => runRuleValidator,
|
@@ -39,8 +40,13 @@ function isEmptyValue(value) {
|
|
39
40
|
return !value;
|
40
41
|
}
|
41
42
|
function runSyncRule(value, rule) {
|
42
|
-
if (
|
43
|
-
|
43
|
+
if (isEmptyValue(value)) {
|
44
|
+
if (rule.required) {
|
45
|
+
return false;
|
46
|
+
}
|
47
|
+
if (rule.validateEmpty === false) {
|
48
|
+
return true;
|
49
|
+
}
|
44
50
|
}
|
45
51
|
if (rule.pattern && !rule.pattern.test(String(value))) {
|
46
52
|
return false;
|
package/lib/grid-item/index.less
CHANGED