vant 4.0.0-beta.0 → 4.0.0-beta.1
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 +13 -9
- package/changelog.generated.md +191 -150
- package/es/badge/Badge.mjs +1 -1
- package/es/calendar/Calendar.mjs +3 -4
- 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.mjs +3 -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 +13 -3
- package/es/config-provider/ConfigProvider.mjs +25 -9
- package/es/config-provider/index.d.ts +8 -2
- package/es/dialog/index.css +1 -1
- package/es/dropdown-menu/DropdownMenu.mjs +2 -1
- package/es/empty/Empty.d.ts +1 -1
- package/es/empty/Empty.mjs +281 -16
- package/es/field/Field.mjs +4 -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/image-preview/ImagePreviewItem.mjs +1 -1
- package/es/image-preview/index.css +1 -1
- package/es/index-bar/IndexBar.mjs +3 -2
- package/es/index.d.ts +2 -1
- package/es/index.mjs +4 -1
- package/es/list/List.mjs +2 -1
- package/es/number-keyboard/NumberKeyboard.mjs +1 -2
- package/es/number-keyboard/NumberKeyboardKey.mjs +2 -2
- package/es/password-input/PasswordInput.mjs +1 -1
- package/es/picker/Picker.d.ts +2 -1
- package/es/picker/Picker.mjs +9 -2
- package/es/picker/PickerColumn.d.ts +2 -1
- package/es/picker/PickerColumn.mjs +5 -4
- package/es/picker/index.d.ts +2 -1
- package/es/popover/Popover.mjs +28 -27
- package/es/popup/Popup.mjs +6 -5
- package/es/popup/index.css +1 -1
- package/es/pull-refresh/PullRefresh.mjs +7 -3
- package/es/rate/Rate.mjs +1 -1
- package/es/search/index.css +1 -1
- package/es/slider/Slider.mjs +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.mjs +8 -0
- package/es/space/style/index.d.ts +1 -0
- package/es/space/style/index.mjs +2 -0
- package/es/stepper/Stepper.mjs +1 -1
- package/es/sticky/Sticky.mjs +2 -1
- package/es/swipe/Swipe.mjs +1 -1
- package/es/swipe-cell/SwipeCell.mjs +1 -1
- package/es/tabs/Tabs.mjs +12 -2
- package/es/tabs/TabsContent.mjs +4 -0
- package/es/vue-tsx-shim.d.ts +7 -0
- package/lib/badge/Badge.js +1 -1
- package/lib/calendar/Calendar.js +3 -4
- 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.js +3 -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 +13 -3
- package/lib/config-provider/ConfigProvider.js +23 -7
- package/lib/config-provider/index.d.ts +8 -2
- package/lib/dialog/index.css +1 -1
- package/lib/dropdown-menu/DropdownMenu.js +2 -1
- package/lib/empty/Empty.d.ts +1 -1
- package/lib/empty/Empty.js +281 -16
- package/lib/field/Field.js +3 -0
- 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/image-preview/ImagePreviewItem.js +1 -1
- package/lib/image-preview/index.css +1 -1
- package/lib/index-bar/IndexBar.js +3 -2
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/list/List.js +2 -1
- package/lib/number-keyboard/NumberKeyboard.js +1 -2
- package/lib/number-keyboard/NumberKeyboardKey.js +2 -2
- package/lib/password-input/PasswordInput.js +1 -1
- package/lib/picker/Picker.d.ts +2 -1
- package/lib/picker/Picker.js +9 -2
- package/lib/picker/PickerColumn.d.ts +2 -1
- package/lib/picker/PickerColumn.js +5 -4
- package/lib/picker/index.d.ts +2 -1
- package/lib/popover/Popover.js +27 -26
- package/lib/popup/Popup.js +6 -5
- package/lib/popup/index.css +1 -1
- package/lib/pull-refresh/PullRefresh.js +6 -2
- package/lib/rate/Rate.js +1 -1
- package/lib/search/index.css +1 -1
- package/lib/slider/Slider.js +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/style/index.d.ts +1 -0
- package/lib/space/style/index.js +2 -0
- package/lib/stepper/Stepper.js +1 -1
- package/lib/sticky/Sticky.js +2 -1
- package/lib/swipe/Swipe.js +1 -1
- package/lib/swipe-cell/SwipeCell.js +1 -1
- package/lib/tabs/Tabs.js +12 -2
- package/lib/tabs/TabsContent.js +4 -0
- package/lib/vant.cjs.js +1332 -1101
- package/lib/vant.es.js +1440 -1100
- package/lib/vant.js +1285 -1102
- package/lib/vant.min.js +1 -1
- package/lib/vue-tsx-shim.d.ts +7 -0
- package/{vetur → lib}/web-types.json +2304 -2203
- package/package.json +6 -11
- 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 -3530
- package/vetur/tags.json +0 -1212
package/es/collapse/Collapse.mjs
CHANGED
@@ -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
|
package/es/collapse/index.d.ts
CHANGED
@@ -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;
|
@@ -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({
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { Ref } from 'vue';
|
2
|
-
export declare const useHeight: (element: Element | Ref<Element | 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
|
-
|
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
|
-
|
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 ?
|
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": {
|
@@ -5,6 +5,7 @@ export declare type ConfigProviderProvide = {
|
|
5
5
|
iconPrefix?: string;
|
6
6
|
};
|
7
7
|
export declare const CONFIG_PROVIDER_KEY: InjectionKey<ConfigProviderProvide>;
|
8
|
+
export declare type ThemeVars = PropType<Record<string, Numeric>>;
|
8
9
|
declare const configProviderProps: {
|
9
10
|
tag: {
|
10
11
|
type: PropType<keyof HTMLElementTagNameMap>;
|
@@ -14,7 +15,10 @@ declare const configProviderProps: {
|
|
14
15
|
type: PropType<ConfigProviderTheme>;
|
15
16
|
default: ConfigProviderTheme;
|
16
17
|
};
|
17
|
-
|
18
|
+
zIndex: NumberConstructor;
|
19
|
+
themeVars: ThemeVars;
|
20
|
+
themeVarsDark: ThemeVars;
|
21
|
+
themeVarsLight: ThemeVars;
|
18
22
|
iconPrefix: StringConstructor;
|
19
23
|
};
|
20
24
|
export declare type ConfigProviderProps = ExtractPropTypes<typeof configProviderProps>;
|
@@ -27,7 +31,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
27
31
|
type: PropType<ConfigProviderTheme>;
|
28
32
|
default: ConfigProviderTheme;
|
29
33
|
};
|
30
|
-
|
34
|
+
zIndex: NumberConstructor;
|
35
|
+
themeVars: ThemeVars;
|
36
|
+
themeVarsDark: ThemeVars;
|
37
|
+
themeVarsLight: ThemeVars;
|
31
38
|
iconPrefix: StringConstructor;
|
32
39
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
33
40
|
tag: {
|
@@ -38,7 +45,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
38
45
|
type: PropType<ConfigProviderTheme>;
|
39
46
|
default: ConfigProviderTheme;
|
40
47
|
};
|
41
|
-
|
48
|
+
zIndex: NumberConstructor;
|
49
|
+
themeVars: ThemeVars;
|
50
|
+
themeVarsDark: ThemeVars;
|
51
|
+
themeVarsLight: ThemeVars;
|
42
52
|
iconPrefix: StringConstructor;
|
43
53
|
}>>, {
|
44
54
|
tag: keyof HTMLElementTagNameMap;
|
@@ -1,12 +1,16 @@
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
2
|
-
import { watch, provide, computed, defineComponent } from "vue";
|
3
|
-
import { inBrowser, kebabCase, makeStringProp, createNamespace } from "../utils/index.mjs";
|
2
|
+
import { watch, provide, computed, watchEffect, onActivated, onDeactivated, onBeforeUnmount, defineComponent } from "vue";
|
3
|
+
import { extend, inBrowser, 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"),
|
8
9
|
theme: makeStringProp("light"),
|
10
|
+
zIndex: Number,
|
9
11
|
themeVars: Object,
|
12
|
+
themeVarsDark: Object,
|
13
|
+
themeVarsLight: Object,
|
10
14
|
iconPrefix: String
|
11
15
|
};
|
12
16
|
function mapThemeVarsToCSSVars(themeVars) {
|
@@ -22,20 +26,32 @@ var stdin_default = defineComponent({
|
|
22
26
|
setup(props, {
|
23
27
|
slots
|
24
28
|
}) {
|
25
|
-
const style = computed(() => {
|
26
|
-
if (props.themeVars) {
|
27
|
-
return mapThemeVarsToCSSVars(props.themeVars);
|
28
|
-
}
|
29
|
-
});
|
29
|
+
const style = computed(() => mapThemeVarsToCSSVars(extend({}, props.themeVars, props.theme === "dark" ? props.themeVarsDark : props.themeVarsLight)));
|
30
30
|
if (inBrowser) {
|
31
|
+
const addTheme = () => {
|
32
|
+
document.body.classList.add(`van-theme-${props.theme}`);
|
33
|
+
};
|
34
|
+
const removeTheme = (theme = props.theme) => {
|
35
|
+
document.body.classList.remove(`van-theme-${theme}`);
|
36
|
+
};
|
31
37
|
watch(() => props.theme, (newVal, oldVal) => {
|
32
|
-
|
33
|
-
|
38
|
+
if (oldVal) {
|
39
|
+
removeTheme(oldVal);
|
40
|
+
}
|
41
|
+
addTheme();
|
34
42
|
}, {
|
35
43
|
immediate: true
|
36
44
|
});
|
45
|
+
onActivated(addTheme);
|
46
|
+
onDeactivated(removeTheme);
|
47
|
+
onBeforeUnmount(removeTheme);
|
37
48
|
}
|
38
49
|
provide(CONFIG_PROVIDER_KEY, props);
|
50
|
+
watchEffect(() => {
|
51
|
+
if (props.zIndex !== void 0) {
|
52
|
+
setGlobalZIndex(props.zIndex);
|
53
|
+
}
|
54
|
+
});
|
39
55
|
return () => _createVNode(props.tag, {
|
40
56
|
"class": bem(),
|
41
57
|
"style": style.value
|
@@ -7,7 +7,10 @@ export declare const ConfigProvider: import("../utils").WithInstall<import("vue"
|
|
7
7
|
type: import("vue").PropType<import("./ConfigProvider").ConfigProviderTheme>;
|
8
8
|
default: import("./ConfigProvider").ConfigProviderTheme;
|
9
9
|
};
|
10
|
-
|
10
|
+
zIndex: NumberConstructor;
|
11
|
+
themeVars: import("./ConfigProvider").ThemeVars;
|
12
|
+
themeVarsDark: import("./ConfigProvider").ThemeVars;
|
13
|
+
themeVarsLight: import("./ConfigProvider").ThemeVars;
|
11
14
|
iconPrefix: StringConstructor;
|
12
15
|
}, () => 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<{
|
13
16
|
tag: {
|
@@ -18,7 +21,10 @@ export declare const ConfigProvider: import("../utils").WithInstall<import("vue"
|
|
18
21
|
type: import("vue").PropType<import("./ConfigProvider").ConfigProviderTheme>;
|
19
22
|
default: import("./ConfigProvider").ConfigProviderTheme;
|
20
23
|
};
|
21
|
-
|
24
|
+
zIndex: NumberConstructor;
|
25
|
+
themeVars: import("./ConfigProvider").ThemeVars;
|
26
|
+
themeVarsDark: import("./ConfigProvider").ThemeVars;
|
27
|
+
themeVarsLight: import("./ConfigProvider").ThemeVars;
|
22
28
|
iconPrefix: StringConstructor;
|
23
29
|
}>>, {
|
24
30
|
tag: keyof HTMLElementTagNameMap;
|
package/es/dialog/index.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
body{--van-dialog-width: 320px;--van-dialog-small-screen-width: 90%;--van-dialog-font-size: var(--van-font-size-lg);--van-dialog-transition: var(--van-duration-base);--van-dialog-radius: 16px;--van-dialog-background: var(--van-background-2);--van-dialog-header-font-weight: var(--van-font-bold);--van-dialog-header-line-height: 24px;--van-dialog-header-padding-top: 26px;--van-dialog-header-isolated-padding: var(--van-padding-lg) 0;--van-dialog-message-padding: var(--van-padding-lg);--van-dialog-message-font-size: var(--van-font-size-md);--van-dialog-message-line-height: var(--van-line-height-md);--van-dialog-message-max-height: 60vh;--van-dialog-has-title-message-text-color: var(--van-gray-7);--van-dialog-has-title-message-padding-top: var(--van-padding-xs);--van-dialog-button-height: 48px;--van-dialog-round-button-height: 36px;--van-dialog-confirm-button-text-color: var(--van-primary-color)}.van-dialog{top:45%;
|
1
|
+
body{--van-dialog-width: 320px;--van-dialog-small-screen-width: 90%;--van-dialog-font-size: var(--van-font-size-lg);--van-dialog-transition: var(--van-duration-base);--van-dialog-radius: 16px;--van-dialog-background: var(--van-background-2);--van-dialog-header-font-weight: var(--van-font-bold);--van-dialog-header-line-height: 24px;--van-dialog-header-padding-top: 26px;--van-dialog-header-isolated-padding: var(--van-padding-lg) 0;--van-dialog-message-padding: var(--van-padding-lg);--van-dialog-message-font-size: var(--van-font-size-md);--van-dialog-message-line-height: var(--van-line-height-md);--van-dialog-message-max-height: 60vh;--van-dialog-has-title-message-text-color: var(--van-gray-7);--van-dialog-has-title-message-padding-top: var(--van-padding-xs);--van-dialog-button-height: 48px;--van-dialog-round-button-height: 36px;--van-dialog-confirm-button-text-color: var(--van-primary-color)}.van-dialog{top:45%;width:var(--van-dialog-width);overflow:hidden;font-size:var(--van-dialog-font-size);background:var(--van-dialog-background);border-radius:var(--van-dialog-radius);-webkit-backface-visibility:hidden;backface-visibility:hidden;transition:var(--van-dialog-transition);transition-property:transform,opacity}@media (max-width: 321px){.van-dialog{width:var(--van-dialog-small-screen-width)}}.van-dialog__header{color:var(--van-text-color);padding-top:var(--van-dialog-header-padding-top);font-weight:var(--van-dialog-header-font-weight);line-height:var(--van-dialog-header-line-height);text-align:center}.van-dialog__header--isolated{padding:var(--van-dialog-header-isolated-padding)}.van-dialog__content--isolated{display:flex;align-items:center;min-height:104px}.van-dialog__message{color:var(--van-text-color);flex:1;max-height:var(--van-dialog-message-max-height);padding:26px var(--van-dialog-message-padding);overflow-y:auto;font-size:var(--van-dialog-message-font-size);line-height:var(--van-dialog-message-line-height);white-space:pre-wrap;text-align:center;word-wrap:break-word;-webkit-overflow-scrolling:touch}.van-dialog__message--has-title{padding-top:var(--van-dialog-has-title-message-padding-top);color:var(--van-dialog-has-title-message-text-color)}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.van-dialog__footer{display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-dialog__confirm,.van-dialog__cancel{flex:1;height:var(--van-dialog-button-height);margin:0;border:0}.van-dialog__confirm,.van-dialog__confirm:active{color:var(--van-dialog-confirm-button-text-color)}.van-dialog--round-button .van-dialog__footer{position:relative;height:auto;padding:var(--van-padding-xs) var(--van-padding-lg) var(--van-padding-md)}.van-dialog--round-button .van-dialog__message{padding-bottom:var(--van-padding-md);color:var(--van-text-color)}.van-dialog--round-button .van-dialog__confirm,.van-dialog--round-button .van-dialog__cancel{height:var(--van-dialog-round-button-height)}.van-dialog--round-button .van-dialog__confirm{color:var(--van-white)}.van-dialog-bounce-enter-from{transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-dialog-bounce-leave-active{transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}
|
package/es/empty/Empty.d.ts
CHANGED
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.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/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;
|