vant 3.5.3 → 3.6.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 +4 -0
- package/changelog.generated.md +39 -42
- package/es/badge/Badge.mjs +1 -1
- package/es/calendar/Calendar.mjs +3 -4
- 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.mjs +2 -0
- package/es/composables/use-lock-scroll.mjs +3 -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/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/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/PickerColumn.mjs +1 -1
- package/es/popover/Popover.mjs +11 -9
- package/es/popup/Popup.mjs +6 -5
- package/es/pull-refresh/PullRefresh.mjs +7 -3
- package/es/rate/Rate.mjs +1 -1
- package/es/search/index.css +1 -1
- package/es/search/index.less +3 -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.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/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/composables/use-global-z-index.d.ts +4 -0
- package/lib/composables/use-global-z-index.js +28 -0
- package/lib/composables/use-height.js +2 -0
- package/lib/composables/use-lock-scroll.js +3 -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/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/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/index.less +1 -0
- 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/PickerColumn.js +1 -1
- package/lib/popover/Popover.js +10 -8
- package/lib/popup/Popup.js +6 -5
- package/lib/pull-refresh/PullRefresh.js +6 -2
- package/lib/rate/Rate.js +1 -1
- package/lib/search/index.css +1 -1
- package/lib/search/index.less +3 -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/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/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 +1202 -1074
- package/lib/vant.es.js +1203 -1075
- package/lib/vant.js +1212 -1150
- package/lib/vant.min.js +1 -1
- package/lib/vue-tsx-shim.d.ts +7 -0
- package/lib/web-types.json +1189 -1117
- package/package.json +2 -2
- package/es/empty/Images.d.ts +0 -4
- package/es/empty/Images.mjs +0 -271
- package/lib/.DS_Store +0 -0
- package/lib/action-bar/.DS_Store +0 -0
- package/lib/action-bar-button/.DS_Store +0 -0
- package/lib/action-bar-icon/.DS_Store +0 -0
- package/lib/action-sheet/.DS_Store +0 -0
- package/lib/address-edit/.DS_Store +0 -0
- package/lib/address-list/.DS_Store +0 -0
- package/lib/area/.DS_Store +0 -0
- package/lib/badge/.DS_Store +0 -0
- package/lib/button/.DS_Store +0 -0
- package/lib/calendar/.DS_Store +0 -0
- package/lib/card/.DS_Store +0 -0
- package/lib/cascader/.DS_Store +0 -0
- package/lib/cell/.DS_Store +0 -0
- package/lib/cell-group/.DS_Store +0 -0
- package/lib/checkbox/.DS_Store +0 -0
- package/lib/checkbox-group/.DS_Store +0 -0
- package/lib/circle/.DS_Store +0 -0
- package/lib/col/.DS_Store +0 -0
- package/lib/collapse/.DS_Store +0 -0
- package/lib/collapse-item/.DS_Store +0 -0
- package/lib/config-provider/.DS_Store +0 -0
- package/lib/contact-card/.DS_Store +0 -0
- package/lib/contact-edit/.DS_Store +0 -0
- package/lib/contact-list/.DS_Store +0 -0
- package/lib/count-down/.DS_Store +0 -0
- package/lib/coupon/.DS_Store +0 -0
- package/lib/coupon-cell/.DS_Store +0 -0
- package/lib/coupon-list/.DS_Store +0 -0
- package/lib/datetime-picker/.DS_Store +0 -0
- package/lib/dialog/.DS_Store +0 -0
- package/lib/divider/.DS_Store +0 -0
- package/lib/dropdown-item/.DS_Store +0 -0
- package/lib/dropdown-menu/.DS_Store +0 -0
- package/lib/empty/.DS_Store +0 -0
- package/lib/empty/Images.d.ts +0 -4
- package/lib/empty/Images.js +0 -290
- package/lib/field/.DS_Store +0 -0
- package/lib/form/.DS_Store +0 -0
- package/lib/grid/.DS_Store +0 -0
- package/lib/grid-item/.DS_Store +0 -0
- package/lib/icon/.DS_Store +0 -0
- package/lib/image/.DS_Store +0 -0
- package/lib/image-preview/.DS_Store +0 -0
- package/lib/index-anchor/.DS_Store +0 -0
- package/lib/index-bar/.DS_Store +0 -0
- package/lib/lazyload/.DS_Store +0 -0
- package/lib/list/.DS_Store +0 -0
- package/lib/loading/.DS_Store +0 -0
- package/lib/locale/.DS_Store +0 -0
- package/lib/nav-bar/.DS_Store +0 -0
- package/lib/notice-bar/.DS_Store +0 -0
- package/lib/notify/.DS_Store +0 -0
- package/lib/number-keyboard/.DS_Store +0 -0
- package/lib/overlay/.DS_Store +0 -0
- package/lib/pagination/.DS_Store +0 -0
- package/lib/password-input/.DS_Store +0 -0
- package/lib/picker/.DS_Store +0 -0
- package/lib/popover/.DS_Store +0 -0
- package/lib/popup/.DS_Store +0 -0
- package/lib/progress/.DS_Store +0 -0
- package/lib/pull-refresh/.DS_Store +0 -0
- package/lib/radio/.DS_Store +0 -0
- package/lib/radio-group/.DS_Store +0 -0
- package/lib/rate/.DS_Store +0 -0
- package/lib/row/.DS_Store +0 -0
- package/lib/search/.DS_Store +0 -0
- package/lib/share-sheet/.DS_Store +0 -0
- package/lib/sidebar/.DS_Store +0 -0
- package/lib/sidebar-item/.DS_Store +0 -0
- package/lib/skeleton/.DS_Store +0 -0
- package/lib/slider/.DS_Store +0 -0
- package/lib/step/.DS_Store +0 -0
- package/lib/stepper/.DS_Store +0 -0
- package/lib/steps/.DS_Store +0 -0
- package/lib/sticky/.DS_Store +0 -0
- package/lib/submit-bar/.DS_Store +0 -0
- package/lib/swipe/.DS_Store +0 -0
- package/lib/swipe-cell/.DS_Store +0 -0
- package/lib/swipe-item/.DS_Store +0 -0
- package/lib/switch/.DS_Store +0 -0
- package/lib/tab/.DS_Store +0 -0
- package/lib/tabbar/.DS_Store +0 -0
- package/lib/tabbar-item/.DS_Store +0 -0
- package/lib/tabs/.DS_Store +0 -0
- package/lib/tag/.DS_Store +0 -0
- package/lib/toast/.DS_Store +0 -0
- package/lib/tree-select/.DS_Store +0 -0
- package/lib/uploader/.DS_Store +0 -0
package/es/tabs/Tabs.mjs
CHANGED
@@ -59,6 +59,7 @@ var stdin_default = defineComponent({
|
|
59
59
|
const root = ref();
|
60
60
|
const navRef = ref();
|
61
61
|
const wrapRef = ref();
|
62
|
+
const contentRef = ref();
|
62
63
|
const id = useId();
|
63
64
|
const scroller = useScrollParent(root);
|
64
65
|
const [titleRefs, setTitleRefs] = useRefs();
|
@@ -309,15 +310,23 @@ var stdin_default = defineComponent({
|
|
309
310
|
});
|
310
311
|
};
|
311
312
|
const onRendered = (name2, title) => emit("rendered", name2, title);
|
313
|
+
const resize = () => {
|
314
|
+
setLine();
|
315
|
+
nextTick(() => {
|
316
|
+
var _a2, _b2;
|
317
|
+
return (_b2 = (_a2 = contentRef.value) == null ? void 0 : _a2.swipeRef.value) == null ? void 0 : _b2.resize();
|
318
|
+
});
|
319
|
+
};
|
312
320
|
useExpose({
|
313
|
-
resize
|
321
|
+
resize,
|
314
322
|
scrollTo
|
315
323
|
});
|
316
324
|
onActivated(setLine);
|
317
325
|
onPopupReopen(setLine);
|
318
326
|
onMountedOrActivated(init);
|
319
327
|
useEventListener("scroll", onScroll, {
|
320
|
-
target: scroller
|
328
|
+
target: scroller,
|
329
|
+
passive: true
|
321
330
|
});
|
322
331
|
linkChildren({
|
323
332
|
id,
|
@@ -342,6 +351,7 @@ var stdin_default = defineComponent({
|
|
342
351
|
return [renderHeader(), (_a3 = slots["nav-bottom"]) == null ? void 0 : _a3.call(slots)];
|
343
352
|
}
|
344
353
|
}) : [renderHeader(), (_a2 = slots["nav-bottom"]) == null ? void 0 : _a2.call(slots)], _createVNode(TabsContent, {
|
354
|
+
"ref": contentRef,
|
345
355
|
"count": children.length,
|
346
356
|
"inited": state.inited,
|
347
357
|
"animated": props.animated,
|
package/es/tabs/TabsContent.mjs
CHANGED
@@ -2,6 +2,7 @@ import { createVNode as _createVNode } from "vue";
|
|
2
2
|
import { ref, watch, onMounted, defineComponent } from "vue";
|
3
3
|
import { numericProp, makeRequiredProp, createNamespace } from "../utils/index.mjs";
|
4
4
|
import { Swipe } from "../swipe/index.mjs";
|
5
|
+
import { useExpose } from "../composables/use-expose.mjs";
|
5
6
|
const [name, bem] = createNamespace("tabs");
|
6
7
|
var stdin_default = defineComponent({
|
7
8
|
name,
|
@@ -52,6 +53,9 @@ var stdin_default = defineComponent({
|
|
52
53
|
onMounted(() => {
|
53
54
|
swipeToCurrentTab(props.currentIndex);
|
54
55
|
});
|
56
|
+
useExpose({
|
57
|
+
swipeRef
|
58
|
+
});
|
55
59
|
return () => _createVNode("div", {
|
56
60
|
"class": bem("content", {
|
57
61
|
animated: props.animated || props.swipeable
|
package/es/vue-tsx-shim.d.ts
CHANGED
@@ -12,5 +12,12 @@ declare module 'vue' {
|
|
12
12
|
onTouchmove?: EventHandler;
|
13
13
|
onTouchstart?: EventHandler;
|
14
14
|
onTouchcancel?: EventHandler;
|
15
|
+
onTouchmovePassive?: EventHandler;
|
16
|
+
onTouchstartPassive?: EventHandler;
|
17
|
+
}
|
18
|
+
|
19
|
+
interface HTMLAttributes {
|
20
|
+
onTouchmovePassive?: EventHandler;
|
21
|
+
onTouchstartPassive?: EventHandler;
|
15
22
|
}
|
16
23
|
}
|
package/lib/badge/Badge.js
CHANGED
@@ -48,7 +48,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
48
48
|
content,
|
49
49
|
showZero
|
50
50
|
} = props;
|
51
|
-
return (0, import_utils.isDef)(content) && content !== "" && (showZero || content !== 0);
|
51
|
+
return (0, import_utils.isDef)(content) && content !== "" && (showZero || content !== 0 && content !== "0");
|
52
52
|
};
|
53
53
|
const renderContent = () => {
|
54
54
|
const {
|
package/lib/calendar/Calendar.js
CHANGED
@@ -137,9 +137,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
137
137
|
const months = (0, import_vue2.computed)(() => {
|
138
138
|
const months2 = [];
|
139
139
|
const cursor = new Date(props.minDate);
|
140
|
-
if (props.lazyRender && !props.show && props.poppable) {
|
141
|
-
return months2;
|
142
|
-
}
|
143
140
|
cursor.setDate(1);
|
144
141
|
do {
|
145
142
|
months2.push(new Date(cursor));
|
@@ -217,7 +214,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
217
214
|
}
|
218
215
|
if (currentDate.value) {
|
219
216
|
const targetDate = props.type === "single" ? currentDate.value : currentDate.value[0];
|
220
|
-
|
217
|
+
if ((0, import_utils.isDate)(targetDate)) {
|
218
|
+
scrollToDate(targetDate);
|
219
|
+
}
|
221
220
|
} else {
|
222
221
|
(0, import_use.raf)(onScroll);
|
223
222
|
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
var stdin_exports = {};
|
19
|
+
__export(stdin_exports, {
|
20
|
+
setGlobalZIndex: () => setGlobalZIndex,
|
21
|
+
useGlobalZIndex: () => useGlobalZIndex
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(stdin_exports);
|
24
|
+
let globalZIndex = 2e3;
|
25
|
+
const useGlobalZIndex = () => ++globalZIndex;
|
26
|
+
const setGlobalZIndex = (val) => {
|
27
|
+
globalZIndex = val;
|
28
|
+
};
|
@@ -22,6 +22,7 @@ __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
|
+
var import_on_popup_reopen = require("./on-popup-reopen");
|
25
26
|
const useHeight = (element, withSafeArea) => {
|
26
27
|
const height = (0, import_vue.ref)();
|
27
28
|
const setHeight = () => {
|
@@ -35,5 +36,6 @@ const useHeight = (element, withSafeArea) => {
|
|
35
36
|
}
|
36
37
|
}
|
37
38
|
});
|
39
|
+
(0, import_on_popup_reopen.onPopupReopen)(() => (0, import_vue.nextTick)(setHeight));
|
38
40
|
return height;
|
39
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";
|
@@ -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
|
}>>, {
|
@@ -135,7 +135,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
135
135
|
});
|
136
136
|
(0, import_use.useClickAway)(root, onClickAway);
|
137
137
|
(0, import_use.useEventListener)("scroll", onScroll, {
|
138
|
-
target: scrollParent
|
138
|
+
target: scrollParent,
|
139
|
+
passive: true
|
139
140
|
});
|
140
141
|
return () => {
|
141
142
|
var _a;
|
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.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/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;
|
@@ -247,7 +247,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
247
247
|
};
|
248
248
|
return (0, import_vue.createVNode)(import_swipe_item.SwipeItem, {
|
249
249
|
"class": bem("swipe-item"),
|
250
|
-
"
|
250
|
+
"onTouchstartPassive": onTouchStart,
|
251
251
|
"onTouchmove": onTouchMove,
|
252
252
|
"onTouchend": onTouchEnd,
|
253
253
|
"onTouchcancel": onTouchEnd
|
@@ -144,7 +144,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
144
144
|
(0, import_vue2.nextTick)(onScroll);
|
145
145
|
};
|
146
146
|
(0, import_use.useEventListener)("scroll", onScroll, {
|
147
|
-
target: scrollParent
|
147
|
+
target: scrollParent,
|
148
|
+
passive: true
|
148
149
|
});
|
149
150
|
(0, import_vue2.onMounted)(init);
|
150
151
|
(0, import_vue2.watch)(() => props.indexList, init);
|
@@ -219,7 +220,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
219
220
|
"class": bem("sidebar"),
|
220
221
|
"style": sidebarStyle.value,
|
221
222
|
"onClick": onClickSidebar,
|
222
|
-
"
|
223
|
+
"onTouchstartPassive": touch.start,
|
223
224
|
"onTouchmove": onTouchMove
|
224
225
|
}, [renderIndexes()]);
|
225
226
|
(0, import_use_expose.useExpose)({
|