sard 1.0.12 → 1.0.14
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 +6 -7
- package/all-components.js +0 -2
- package/components/action-sheet/action-sheet.vue.d.ts +1 -0
- package/components/action-sheet/action-sheet.vue.js +11 -1
- package/components/action-sheet/common.d.ts +1 -0
- package/components/action-sheet/common.js +4 -1
- package/components/badge/index.css +1 -1
- package/components/crop-image/common.d.ts +1 -0
- package/components/crop-image/common.js +2 -1
- package/components/crop-image/crop-image.vue.d.ts +1 -0
- package/components/crop-image/crop-image.vue.js +10 -1
- package/components/dialog/common.d.ts +1 -0
- package/components/dialog/common.js +2 -1
- package/components/dialog/dialog.vue.d.ts +1 -0
- package/components/dialog/dialog.vue.js +14 -1
- package/components/index.d.ts +0 -1
- package/components/index.js +3 -3
- package/components/infinite-list/common.d.ts +5 -10
- package/components/infinite-list/common.js +1 -1
- package/components/infinite-list/index.css +0 -1
- package/components/infinite-list/infinite-list.vue.d.ts +5 -6
- package/components/infinite-list/infinite-list.vue.js +41 -82
- package/components/load-more/common.d.ts +9 -3
- package/components/load-more/common.js +9 -2
- package/components/load-more/index.d.ts +3 -2
- package/components/load-more/index.js +2 -2
- package/components/load-more/load-more.vue.d.ts +6 -6
- package/components/load-more/load-more.vue.js +33 -5
- package/components/popout/common.d.ts +1 -0
- package/components/popout/common.js +2 -1
- package/components/popout/popout.vue.d.ts +1 -0
- package/components/popout/popout.vue.js +11 -1
- package/components/popup/common.d.ts +2 -0
- package/components/popup/index.d.ts +1 -0
- package/components/popup/index.js +2 -1
- package/components/popup/popup-manager.d.ts +15 -0
- package/components/popup/popup-manager.js +25 -0
- package/components/popup/popup.vue.d.ts +3 -0
- package/components/popup/popup.vue.js +16 -1
- package/components/preview-image/common.d.ts +1 -0
- package/components/preview-image/common.js +2 -1
- package/components/preview-image/preview-image.vue.d.ts +1 -0
- package/components/preview-image/preview-image.vue.js +14 -1
- package/components/pull-down-refresh/common.d.ts +1 -0
- package/components/pull-down-refresh/common.js +1 -1
- package/components/pull-down-refresh/pull-down-refresh.vue.d.ts +1 -0
- package/components/pull-down-refresh/pull-down-refresh.vue.js +28 -10
- package/components/select/common.d.ts +4 -4
- package/components/select/common.js +0 -1
- package/components/select/index.css +1 -1
- package/components/select/select.vue.d.ts +3 -5
- package/components/select/select.vue.js +14 -51
- package/components/select-input/common.d.ts +2 -2
- package/components/select-input/select-input.vue.d.ts +5 -3
- package/components/select-input/select-input.vue.js +29 -19
- package/components/select-popout/common.d.ts +3 -5
- package/components/select-popout/select-popout.vue.d.ts +5 -3
- package/components/select-popout/select-popout.vue.js +27 -20
- package/components/share-sheet/common.d.ts +1 -0
- package/components/share-sheet/common.js +4 -1
- package/components/share-sheet/share-sheet.vue.d.ts +1 -0
- package/components/share-sheet/share-sheet.vue.js +14 -2
- package/global.d.ts +0 -1
- package/index.css +1 -1
- package/index.js +3 -3
- package/package.json +1 -1
- package/use/useIntersectionObserver.d.ts +1 -0
- package/use/useIntersectionObserver.js +4 -1
- package/components/load-more/useLoadMore.d.ts +0 -22
- package/components/load-more/useLoadMore.js +0 -71
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createBem } from "../../utils/bem.js";
|
|
2
|
+
import { useIntersectionObserver } from "../../use/useIntersectionObserver.js";
|
|
2
3
|
import loading_default from "../loading/loading.vue.js";
|
|
3
4
|
import { useTranslateWithPrefix } from "../../locale/index.js";
|
|
4
|
-
import { defaultLoadMoreProps } from "./common.js";
|
|
5
|
-
import {
|
|
5
|
+
import { LoadMoreStatus, defaultLoadMoreProps } from "./common.js";
|
|
6
|
+
import { useScrollParent } from "../../use/useScrollParent.js";
|
|
7
|
+
import { computed, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, mergeDefaults, normalizeClass, openBlock, renderSlot, toDisplayString, unref, useTemplateRef, watch, withCtx } from "vue";
|
|
6
8
|
//#region packages/sard/components/load-more/load-more.vue
|
|
7
9
|
var load_more_default = /*@__PURE__*/ defineComponent({
|
|
8
10
|
__name: "load-more",
|
|
@@ -26,23 +28,49 @@ var load_more_default = /*@__PURE__*/ defineComponent({
|
|
|
26
28
|
errorText: {
|
|
27
29
|
type: String,
|
|
28
30
|
required: false
|
|
31
|
+
},
|
|
32
|
+
disabled: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
required: false
|
|
35
|
+
},
|
|
36
|
+
rootMargin: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: false
|
|
29
39
|
}
|
|
30
40
|
}, defaultLoadMoreProps),
|
|
31
|
-
emits: ["load
|
|
41
|
+
emits: ["load"],
|
|
32
42
|
setup(__props, { emit: __emit }) {
|
|
33
43
|
const props = __props;
|
|
34
44
|
const emit = __emit;
|
|
35
45
|
const bem = createBem("load-more");
|
|
36
46
|
const { t } = useTranslateWithPrefix("loadMore");
|
|
47
|
+
const loadMoreRef = useTemplateRef("loadMore");
|
|
48
|
+
const scrollParent = useScrollParent(loadMoreRef);
|
|
37
49
|
const onClick = () => {
|
|
38
|
-
if (props.status === "incomplete") emit("load
|
|
39
|
-
else if (props.status === "error") emit("
|
|
50
|
+
if (props.status === "incomplete") emit("load");
|
|
51
|
+
else if (props.status === "error") emit("load");
|
|
40
52
|
};
|
|
53
|
+
const { isIntersecting } = useIntersectionObserver({
|
|
54
|
+
root: scrollParent,
|
|
55
|
+
rootMargin: () => props.rootMargin,
|
|
56
|
+
threshold: 0,
|
|
57
|
+
target: loadMoreRef,
|
|
58
|
+
disabled: () => props.disabled
|
|
59
|
+
});
|
|
60
|
+
watch(isIntersecting, () => {
|
|
61
|
+
if (!props.disabled && isIntersecting.value && props.status === LoadMoreStatus.INCOMPLETE) emit("load");
|
|
62
|
+
});
|
|
63
|
+
watch(() => props.status, (status, prevStatus) => {
|
|
64
|
+
if (prevStatus === LoadMoreStatus.LOADING && status === LoadMoreStatus.INCOMPLETE) setTimeout(() => {
|
|
65
|
+
if (!props.disabled && isIntersecting.value && status === LoadMoreStatus.INCOMPLETE) emit("load");
|
|
66
|
+
}, 30);
|
|
67
|
+
});
|
|
41
68
|
const loadMoreClass = computed(() => {
|
|
42
69
|
return [bem.b(), bem.m(props.status)];
|
|
43
70
|
});
|
|
44
71
|
return (_ctx, _cache) => {
|
|
45
72
|
return openBlock(), createElementBlock("div", {
|
|
73
|
+
ref: "loadMore",
|
|
46
74
|
class: normalizeClass(loadMoreClass.value),
|
|
47
75
|
onClick
|
|
48
76
|
}, [__props.status === "incomplete" ? renderSlot(_ctx.$slots, "incomplete", { key: 0 }, () => [createTextVNode(toDisplayString(__props.incompleteText || unref(t)("incompleteText")), 1)]) : __props.status === "loading" ? renderSlot(_ctx.$slots, "loading", { key: 1 }, () => [createVNode(loading_default, null, {
|
|
@@ -41,6 +41,7 @@ declare const __VLS_base: import("vue").DefineComponent<PopoutProps, {}, {}, {},
|
|
|
41
41
|
overlayClosable: boolean;
|
|
42
42
|
destroyOnClose: boolean;
|
|
43
43
|
lazy: boolean;
|
|
44
|
+
closeOnBackPress: boolean;
|
|
44
45
|
showCancel: boolean;
|
|
45
46
|
beforeClose: import("./common").PopoutBeforeClose;
|
|
46
47
|
cancelText: string;
|
|
@@ -91,6 +91,10 @@ var popout_default = /*@__PURE__*/ defineComponent({
|
|
|
91
91
|
lazy: {
|
|
92
92
|
type: Boolean,
|
|
93
93
|
required: false
|
|
94
|
+
},
|
|
95
|
+
closeOnBackPress: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
required: false
|
|
94
98
|
}
|
|
95
99
|
}, defaultPopoutProps),
|
|
96
100
|
emits: [
|
|
@@ -163,6 +167,9 @@ var popout_default = /*@__PURE__*/ defineComponent({
|
|
|
163
167
|
const onOverlayClick = () => {
|
|
164
168
|
if (props.overlayClosable) perhapsClose("close");
|
|
165
169
|
};
|
|
170
|
+
const onBackPress = () => {
|
|
171
|
+
perhapsClose("close");
|
|
172
|
+
};
|
|
166
173
|
const onCloseClick = () => {
|
|
167
174
|
perhapsClose("close");
|
|
168
175
|
};
|
|
@@ -192,7 +199,9 @@ var popout_default = /*@__PURE__*/ defineComponent({
|
|
|
192
199
|
transparent: __props.transparent,
|
|
193
200
|
"destroy-on-close": __props.destroyOnClose,
|
|
194
201
|
lazy: __props.lazy,
|
|
202
|
+
"close-on-back-press": __props.closeOnBackPress,
|
|
195
203
|
onOverlayClick,
|
|
204
|
+
onBackPress,
|
|
196
205
|
onVisibleHook
|
|
197
206
|
}, {
|
|
198
207
|
default: withCtx(() => [createElementVNode("div", {
|
|
@@ -299,7 +308,8 @@ var popout_default = /*@__PURE__*/ defineComponent({
|
|
|
299
308
|
"background",
|
|
300
309
|
"transparent",
|
|
301
310
|
"destroy-on-close",
|
|
302
|
-
"lazy"
|
|
311
|
+
"lazy",
|
|
312
|
+
"close-on-back-press"
|
|
303
313
|
]);
|
|
304
314
|
};
|
|
305
315
|
}
|
|
@@ -14,6 +14,7 @@ export interface PopupProps {
|
|
|
14
14
|
lockScroll?: boolean;
|
|
15
15
|
destroyOnClose?: boolean;
|
|
16
16
|
lazy?: boolean;
|
|
17
|
+
closeOnBackPress?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export declare const mapEffectMotion: Record<PopupEffect, MotionName>;
|
|
19
20
|
export declare const defaultPopupProps: DefaultProps<PopupProps>;
|
|
@@ -33,6 +34,7 @@ export interface TransitionHookCallbacks {
|
|
|
33
34
|
}
|
|
34
35
|
export interface PopupEmits extends MotionEmits {
|
|
35
36
|
(e: 'overlay-click', event: any): void;
|
|
37
|
+
(e: 'back-press'): void;
|
|
36
38
|
(e: 'update:visible', visible: boolean): void;
|
|
37
39
|
}
|
|
38
40
|
export interface PopupExpose {
|
|
@@ -3,3 +3,4 @@ import _Popup from './popup.vue';
|
|
|
3
3
|
export declare const Popup: EnhancedComponent<typeof _Popup>;
|
|
4
4
|
export default Popup;
|
|
5
5
|
export { type PopupProps, type PopupSlots, type PopupEmits, type PopupExpose, type PopupContext, usePopupVisibleHookProvide, usePopupEnter, useInPopup, } from './common';
|
|
6
|
+
export { type PopupItem, popupManager } from './popup-manager';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { enhanceComponent } from "../../utils/component.js";
|
|
2
2
|
import { useInPopup, usePopupEnter, usePopupVisibleHookProvide } from "./common.js";
|
|
3
|
+
import { popupManager } from "./popup-manager.js";
|
|
3
4
|
import popup_default from "./popup.vue.js";
|
|
4
5
|
//#region packages/sard/components/popup/index.ts
|
|
5
6
|
const Popup = enhanceComponent(popup_default);
|
|
6
7
|
//#endregion
|
|
7
|
-
export { Popup, Popup as default, useInPopup, usePopupEnter, usePopupVisibleHookProvide };
|
|
8
|
+
export { Popup, Popup as default, popupManager, useInPopup, usePopupEnter, usePopupVisibleHookProvide };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface PopupItem {
|
|
2
|
+
close: () => void;
|
|
3
|
+
}
|
|
4
|
+
export declare function createPopupManager(): {
|
|
5
|
+
stack: import("vue").Reactive<PopupItem[]>;
|
|
6
|
+
push: (item: PopupItem) => void;
|
|
7
|
+
pop: () => void;
|
|
8
|
+
remove: (item: PopupItem) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const popupManager: {
|
|
11
|
+
stack: import("vue").Reactive<PopupItem[]>;
|
|
12
|
+
push: (item: PopupItem) => void;
|
|
13
|
+
pop: () => void;
|
|
14
|
+
remove: (item: PopupItem) => void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
//#region packages/sard/components/popup/popup-manager.ts
|
|
3
|
+
function createPopupManager() {
|
|
4
|
+
const stack = reactive([]);
|
|
5
|
+
const push = (item) => {
|
|
6
|
+
if (!stack.includes(item)) stack.push(item);
|
|
7
|
+
};
|
|
8
|
+
const pop = () => {
|
|
9
|
+
const item = stack.pop();
|
|
10
|
+
if (item) item.close();
|
|
11
|
+
};
|
|
12
|
+
const remove = (item) => {
|
|
13
|
+
const index = stack.indexOf(item);
|
|
14
|
+
if (index !== -1) stack.splice(index, 1);
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
stack,
|
|
18
|
+
push,
|
|
19
|
+
pop,
|
|
20
|
+
remove
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const popupManager = createPopupManager();
|
|
24
|
+
//#endregion
|
|
25
|
+
export { createPopupManager, popupManager };
|
|
@@ -12,6 +12,7 @@ declare const __VLS_base: import("vue").DefineComponent<PopupProps, {}, {}, {},
|
|
|
12
12
|
"leave-cancelled": (el: Element) => any;
|
|
13
13
|
"visible-hook": (name: MotionHookName, el: Element) => any;
|
|
14
14
|
"overlay-click": (event: any) => any;
|
|
15
|
+
"back-press": () => any;
|
|
15
16
|
"update:visible": (visible: boolean) => any;
|
|
16
17
|
}, string, import("vue").PublicProps, Readonly<PopupProps> & Readonly<{
|
|
17
18
|
"onBefore-enter"?: ((el: Element) => any) | undefined;
|
|
@@ -24,6 +25,7 @@ declare const __VLS_base: import("vue").DefineComponent<PopupProps, {}, {}, {},
|
|
|
24
25
|
"onLeave-cancelled"?: ((el: Element) => any) | undefined;
|
|
25
26
|
"onVisible-hook"?: ((name: MotionHookName, el: Element) => any) | undefined;
|
|
26
27
|
"onOverlay-click"?: ((event: any) => any) | undefined;
|
|
28
|
+
"onBack-press"?: (() => any) | undefined;
|
|
27
29
|
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
28
30
|
}>, {
|
|
29
31
|
background: string;
|
|
@@ -37,6 +39,7 @@ declare const __VLS_base: import("vue").DefineComponent<PopupProps, {}, {}, {},
|
|
|
37
39
|
lockScroll: boolean;
|
|
38
40
|
destroyOnClose: boolean;
|
|
39
41
|
lazy: boolean;
|
|
42
|
+
closeOnBackPress: boolean;
|
|
40
43
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
44
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
42
45
|
declare const _default: typeof __VLS_export;
|
|
@@ -4,7 +4,8 @@ import { defaultPopupProps, mapEffectMotion, usePopupVisibleHookProvide } from "
|
|
|
4
4
|
import { useLockScroll } from "../../use/useLockScroll.js";
|
|
5
5
|
import motion_default from "../motion/motion.vue.js";
|
|
6
6
|
import overlay_default from "../overlay/overlay.vue.js";
|
|
7
|
-
import {
|
|
7
|
+
import { popupManager } from "./popup-manager.js";
|
|
8
|
+
import { Teleport, computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, mergeDefaults, mergeProps, normalizeClass, normalizeStyle, onUnmounted, openBlock, ref, renderSlot, unref, vShow, withCtx, withDirectives } from "vue";
|
|
8
9
|
//#region packages/sard/components/popup/popup.vue
|
|
9
10
|
var popup_default = /*@__PURE__*/ defineComponent({
|
|
10
11
|
inheritAttrs: false,
|
|
@@ -67,10 +68,15 @@ var popup_default = /*@__PURE__*/ defineComponent({
|
|
|
67
68
|
lazy: {
|
|
68
69
|
type: Boolean,
|
|
69
70
|
required: false
|
|
71
|
+
},
|
|
72
|
+
closeOnBackPress: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
required: false
|
|
70
75
|
}
|
|
71
76
|
}, defaultPopupProps),
|
|
72
77
|
emits: [
|
|
73
78
|
"overlay-click",
|
|
79
|
+
"back-press",
|
|
74
80
|
"update:visible",
|
|
75
81
|
"before-enter",
|
|
76
82
|
"enter",
|
|
@@ -96,8 +102,10 @@ var popup_default = /*@__PURE__*/ defineComponent({
|
|
|
96
102
|
if (name === "before-enter") {
|
|
97
103
|
increaseZIndex();
|
|
98
104
|
rendered.value = true;
|
|
105
|
+
if (props.closeOnBackPress) popupManager.push(popupItem);
|
|
99
106
|
} else if (name === "after-leave") {
|
|
100
107
|
if (props.destroyOnClose) rendered.value = false;
|
|
108
|
+
popupManager.remove(popupItem);
|
|
101
109
|
}
|
|
102
110
|
callVisibleHook(name);
|
|
103
111
|
emit("visible-hook", name, el);
|
|
@@ -108,6 +116,13 @@ var popup_default = /*@__PURE__*/ defineComponent({
|
|
|
108
116
|
if (props.overlayClosable) emit("update:visible", false);
|
|
109
117
|
};
|
|
110
118
|
useLockScroll(() => props.visible, props.lockScroll);
|
|
119
|
+
const popupItem = { close: () => {
|
|
120
|
+
emit("back-press");
|
|
121
|
+
emit("update:visible", false);
|
|
122
|
+
} };
|
|
123
|
+
onUnmounted(() => {
|
|
124
|
+
popupManager.remove(popupItem);
|
|
125
|
+
});
|
|
111
126
|
const popupClass = computed(() => {
|
|
112
127
|
return [bem.b(), bem.m(props.effect)];
|
|
113
128
|
});
|
|
@@ -27,6 +27,7 @@ declare const __VLS_base: import("vue").DefineComponent<PreviewImageProps, Previ
|
|
|
27
27
|
"onUpdate:current"?: ((current: number) => any) | undefined;
|
|
28
28
|
}>, {
|
|
29
29
|
visible: boolean;
|
|
30
|
+
closeOnBackPress: boolean;
|
|
30
31
|
current: number;
|
|
31
32
|
urls: string[];
|
|
32
33
|
showIndicator: boolean;
|
|
@@ -34,6 +34,10 @@ var preview_image_default = /*@__PURE__*/ defineComponent({
|
|
|
34
34
|
loop: {
|
|
35
35
|
type: Boolean,
|
|
36
36
|
required: false
|
|
37
|
+
},
|
|
38
|
+
closeOnBackPress: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
required: false
|
|
37
41
|
}
|
|
38
42
|
}, defaultPreviewImageProps),
|
|
39
43
|
emits: [
|
|
@@ -62,6 +66,9 @@ var preview_image_default = /*@__PURE__*/ defineComponent({
|
|
|
62
66
|
visibleSwitching.value = false;
|
|
63
67
|
}, 150);
|
|
64
68
|
});
|
|
69
|
+
const onBackPress = () => {
|
|
70
|
+
close();
|
|
71
|
+
};
|
|
65
72
|
const onVisibleHook = (name, el) => {
|
|
66
73
|
if (name === "before-enter") resetSlideDown();
|
|
67
74
|
emit("visible-hook", name, el);
|
|
@@ -141,6 +148,8 @@ var preview_image_default = /*@__PURE__*/ defineComponent({
|
|
|
141
148
|
unref(bem).is("immersive", isImmersive.value)
|
|
142
149
|
],
|
|
143
150
|
visible: unref(innerVisible),
|
|
151
|
+
"close-on-back-press": __props.closeOnBackPress,
|
|
152
|
+
onBackPress,
|
|
144
153
|
onVisibleHook
|
|
145
154
|
}, {
|
|
146
155
|
default: withCtx(() => [createElementVNode("div", {
|
|
@@ -176,7 +185,11 @@ var preview_image_default = /*@__PURE__*/ defineComponent({
|
|
|
176
185
|
class: normalizeClass(unref(bem).e("indicator"))
|
|
177
186
|
}, toDisplayString(unref(current) + 1) + " / " + toDisplayString(__props.urls.length), 3)) : createCommentVNode("v-if", true)], 2)]),
|
|
178
187
|
_: 1
|
|
179
|
-
}, 8, [
|
|
188
|
+
}, 8, [
|
|
189
|
+
"overlay-class",
|
|
190
|
+
"visible",
|
|
191
|
+
"close-on-back-press"
|
|
192
|
+
]);
|
|
180
193
|
};
|
|
181
194
|
}
|
|
182
195
|
});
|
|
@@ -7,6 +7,7 @@ export interface PullDownRefreshProps {
|
|
|
7
7
|
transitionDuration?: number;
|
|
8
8
|
doneDuration?: number;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
+
error?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare const defaultPullDownRefreshProps: DefaultProps<PullDownRefreshProps>;
|
|
12
13
|
export interface PullDownRefreshSlots {
|
|
@@ -5,6 +5,7 @@ declare const __VLS_base: import("vue").DefineComponent<PullDownRefreshProps, Pu
|
|
|
5
5
|
}, string, import("vue").PublicProps, Readonly<PullDownRefreshProps> & Readonly<{
|
|
6
6
|
onRefresh?: (() => any) | undefined;
|
|
7
7
|
}>, {
|
|
8
|
+
error: boolean;
|
|
8
9
|
loading: boolean;
|
|
9
10
|
threshold: number;
|
|
10
11
|
disabled: boolean;
|
|
@@ -3,9 +3,10 @@ import { getScrollTop } from "../../utils/dom.js";
|
|
|
3
3
|
import { useTimeout } from "../../use/useTimeout.js";
|
|
4
4
|
import { usePointerDown } from "../../use/usePointerDown.js";
|
|
5
5
|
import loading_default from "../loading/loading.vue.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useTranslateWithPrefix } from "../../locale/index.js";
|
|
7
7
|
import { useScrollParent } from "../../use/useScrollParent.js";
|
|
8
|
-
import {
|
|
8
|
+
import { defaultPullDownRefreshProps } from "./common.js";
|
|
9
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeDefaults, normalizeClass, normalizeStyle, onMounted, openBlock, ref, renderSlot, toDisplayString, unref, useTemplateRef, watch, withCtx } from "vue";
|
|
9
10
|
//#region packages/sard/components/pull-down-refresh/pull-down-refresh.vue
|
|
10
11
|
var pull_down_refresh_default = /*@__PURE__*/ defineComponent({
|
|
11
12
|
__name: "pull-down-refresh",
|
|
@@ -33,6 +34,10 @@ var pull_down_refresh_default = /*@__PURE__*/ defineComponent({
|
|
|
33
34
|
disabled: {
|
|
34
35
|
type: Boolean,
|
|
35
36
|
required: false
|
|
37
|
+
},
|
|
38
|
+
error: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
required: false
|
|
36
41
|
}
|
|
37
42
|
}, defaultPullDownRefreshProps),
|
|
38
43
|
emits: ["refresh"],
|
|
@@ -40,6 +45,7 @@ var pull_down_refresh_default = /*@__PURE__*/ defineComponent({
|
|
|
40
45
|
const props = __props;
|
|
41
46
|
const emit = __emit;
|
|
42
47
|
const bem = createBem("pull-down-refresh");
|
|
48
|
+
const { t } = useTranslateWithPrefix("pullDownRefresh");
|
|
43
49
|
const scrollParent = useScrollParent(useTemplateRef("root"));
|
|
44
50
|
const status = ref("initial");
|
|
45
51
|
const translateY = ref(0);
|
|
@@ -52,7 +58,7 @@ var pull_down_refresh_default = /*@__PURE__*/ defineComponent({
|
|
|
52
58
|
recoveringTimer.clear();
|
|
53
59
|
initialTimer.clear();
|
|
54
60
|
status.value = "loading";
|
|
55
|
-
translateY.value = props.headerHeight;
|
|
61
|
+
if (!props.disabled) translateY.value = props.headerHeight;
|
|
56
62
|
};
|
|
57
63
|
const toRecovering = () => {
|
|
58
64
|
status.value = "recovering";
|
|
@@ -117,6 +123,9 @@ var pull_down_refresh_default = /*@__PURE__*/ defineComponent({
|
|
|
117
123
|
}
|
|
118
124
|
};
|
|
119
125
|
const onPointerDown = usePointerDown(onTouchStart, onTouchMove, onTouchEnd);
|
|
126
|
+
const rootClass = computed(() => {
|
|
127
|
+
return [bem.b(), bem.m(status.value)];
|
|
128
|
+
});
|
|
120
129
|
const pullDownRefreshStyle = computed(() => {
|
|
121
130
|
return {
|
|
122
131
|
transform: `translate3d(0,${translateY.value}px,0)`,
|
|
@@ -130,7 +139,7 @@ var pull_down_refresh_default = /*@__PURE__*/ defineComponent({
|
|
|
130
139
|
return (_ctx, _cache) => {
|
|
131
140
|
return openBlock(), createElementBlock("div", {
|
|
132
141
|
ref: "root",
|
|
133
|
-
class: normalizeClass(
|
|
142
|
+
class: normalizeClass(rootClass.value)
|
|
134
143
|
}, [createElementVNode("div", {
|
|
135
144
|
class: normalizeClass(unref(bem).e("gesture")),
|
|
136
145
|
style: normalizeStyle(pullDownRefreshStyle.value),
|
|
@@ -147,17 +156,26 @@ var pull_down_refresh_default = /*@__PURE__*/ defineComponent({
|
|
|
147
156
|
progress: progress.value
|
|
148
157
|
}, () => [createVNode(loading_default, {
|
|
149
158
|
type: "clock",
|
|
150
|
-
|
|
159
|
+
size: "16px",
|
|
151
160
|
animated: false,
|
|
152
161
|
progress: progress.value
|
|
153
|
-
},
|
|
162
|
+
}, {
|
|
163
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("unready")), 1)]),
|
|
164
|
+
_: 1
|
|
165
|
+
}, 8, ["progress"])]) : status.value === "ready" ? renderSlot(_ctx.$slots, "ready", { key: 1 }, () => [createVNode(loading_default, {
|
|
154
166
|
type: "clock",
|
|
155
|
-
|
|
167
|
+
size: "16px",
|
|
156
168
|
animated: false
|
|
157
|
-
},
|
|
169
|
+
}, {
|
|
170
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("ready")), 1)]),
|
|
171
|
+
_: 1
|
|
172
|
+
})]) : status.value === "loading" ? renderSlot(_ctx.$slots, "loading", { key: 2 }, () => [createVNode(loading_default, {
|
|
158
173
|
type: "clock",
|
|
159
|
-
|
|
160
|
-
},
|
|
174
|
+
size: "16px"
|
|
175
|
+
}, {
|
|
176
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("loading")), 1)]),
|
|
177
|
+
_: 1
|
|
178
|
+
})]) : status.value === "done" ? renderSlot(_ctx.$slots, "done", { key: 3 }, () => [createTextVNode(toDisplayString(__props.error ? unref(t)("doneFail") : unref(t)("doneSuccess")), 1)]) : createCommentVNode("v-if", true)], 6), renderSlot(_ctx.$slots, "default")], 38)], 2);
|
|
161
179
|
};
|
|
162
180
|
}
|
|
163
181
|
});
|
|
@@ -9,17 +9,16 @@ export interface SelectProps {
|
|
|
9
9
|
filterPlaceholder?: string;
|
|
10
10
|
filterMethod?: (query: string) => void;
|
|
11
11
|
filterValue?: string;
|
|
12
|
-
remote?: boolean;
|
|
13
|
-
remoteMethod?: (query: string, page: number, isRefresh: boolean) => Promise<boolean>;
|
|
14
|
-
threshold?: number;
|
|
15
12
|
showToolbar?: boolean;
|
|
16
13
|
options?: any[];
|
|
17
14
|
optionKeys?: OptionKeys;
|
|
18
15
|
valueKey?: string;
|
|
16
|
+
filterLoading?: boolean;
|
|
19
17
|
}
|
|
20
18
|
export declare const defaultSelectProps: DefaultProps<SelectProps>;
|
|
21
19
|
export interface SelectSlots {
|
|
22
20
|
default?(): any;
|
|
21
|
+
bottom?(): any;
|
|
23
22
|
option?(props: {
|
|
24
23
|
disabled: boolean;
|
|
25
24
|
selected: boolean;
|
|
@@ -37,9 +36,10 @@ export interface SelectEmits {
|
|
|
37
36
|
(e: 'update:modelValue', value: any): void;
|
|
38
37
|
(e: 'change', value: any): void;
|
|
39
38
|
(e: 'select', value: any): void;
|
|
40
|
-
(e: 'update:
|
|
39
|
+
(e: 'update:filterValue', value: string): void;
|
|
41
40
|
}
|
|
42
41
|
export interface SelectExpose {
|
|
42
|
+
scrollTop: () => void;
|
|
43
43
|
}
|
|
44
44
|
export interface SelectMember {
|
|
45
45
|
el: HTMLElement | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--s-select-max-height:320px;--s-select-bg:var(--s-bg-color-container);--s-select-search-padding-x:var(--s-content-padding-x);--s-select-search-padding-y:var(--s-content-padding-y);--s-select-option-min-height:var(--s-content-height-sm);--s-select-option-padding-x:var(--s-content-padding-x);--s-select-option-padding-y:var(--s-content-padding-y);--s-select-option-bg-active:var(--s-bg-color-active);--s-select-option-opacity-disabled:var(--s-opacity-disabled);--s-select-option-color-selected:var(--s-color-primary);--s-select-option-label-font-size:var(--s-font-size);--s-select-option-group-label-padding-x:var(--s-content-padding-x);--s-select-option-group-label-padding-y:var(--s-content-padding-y);--s-select-option-group-label-font-size:var(--s-font-size-sm);--s-select-option-group-label-color:var(--s-text-color-tertiary);--s-select-option-group-label-bg:var(--s-fill-color-fourth);--s-select-toolbar-padding-x:var(--s-content-padding-x);--s-select-toolbar-padding-y:0
|
|
1
|
+
:root{--s-select-max-height:320px;--s-select-bg:var(--s-bg-color-container);--s-select-search-padding-x:var(--s-content-padding-x);--s-select-search-padding-y:var(--s-content-padding-y);--s-select-option-min-height:var(--s-content-height-sm);--s-select-option-padding-x:var(--s-content-padding-x);--s-select-option-padding-y:var(--s-content-padding-y);--s-select-option-bg-active:var(--s-bg-color-active);--s-select-option-opacity-disabled:var(--s-opacity-disabled);--s-select-option-color-selected:var(--s-color-primary);--s-select-option-label-font-size:var(--s-font-size);--s-select-option-group-label-padding-x:var(--s-content-padding-x);--s-select-option-group-label-padding-y:var(--s-content-padding-y);--s-select-option-group-label-font-size:var(--s-font-size-sm);--s-select-option-group-label-color:var(--s-text-color-tertiary);--s-select-option-group-label-bg:var(--s-fill-color-fourth);--s-select-toolbar-padding-x:var(--s-content-padding-x);--s-select-toolbar-padding-y:0}.s-select{background:var(--s-select-bg)}.s-select__container{position:relative}.s-select__container::before,.s-select__container::after{content:"";position:absolute;left:0;right:0;z-index:10;height:10px;overflow:hidden;box-shadow:none;touch-action:none;pointer-events:none;transition:box-shadow var(--s-duration)}.s-select__container::before{top:0}.s-select__container::after{bottom:0}.s-select__container--none::before,.s-select__container--end::before{box-shadow:var(--s-box-shadow-top)}.s-select__container--none::after,.s-select__container--start::after{box-shadow:var(--s-box-shadow-bottom)}.s-select__search{padding:var(--s-select-search-padding-y) var(--s-select-search-padding-x)}.s-select__loading{color:var(--s-text-color-fourth)}.s-select__scroll{overflow-x:hidden;overflow-y:auto;max-height:var(--s-select-max-height)}.s-select__scroll--filterable{height:var(--s-select-max-height)}.s-select__toolbar{display:flex;align-items:center;padding:var(--s-select-toolbar-padding-y) var(--s-select-toolbar-padding-x)}.s-select__num{font-size:var(--s-font-size);color:var(--s-color-primary);margin-inline-end:auto}.s-select__empty{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center}.s-select-option{position:relative;display:flex;align-items:center;cursor:pointer}.s-select-option:not(.is-plain){min-height:var(--s-select-option-min-height);padding:var(--s-select-option-padding-y) var(--s-select-option-padding-x)}.s-select-option:not(.is-plain)::before{position:absolute;z-index:1;pointer-events:none;touch-action:none;opacity:1;content:"";left:0;right:0;transform:scaleY(0.5);top:0;border-top:var(--s-border-width) var(--s-border-style) var(--s-border-color);transform-origin:top center;left:var(--s-select-option-padding-x);right:var(--s-select-option-padding-x)}.s-select-option:not(.is-plain):first-child::before{display:none}.s-select-option:is(.is-selected){color:var(--s-select-option-color-selected);font-weight:var(--s-font-weight-bold)}.s-select-option:is(.is-selected) .s-select-option__icon{display:flex}.s-select-option:is(.is-disabled){color:var(--s-text-color-disabled);cursor:var(--s-cursor-disabled)}.s-select-option:not(.is-disabled,.is-plain):active{background:var(--s-select-option-bg-active)}.s-select-option__label{flex:1;min-width:0;word-break:break-all;font-size:var(--s-select-option-label-font-size);line-height:var(--s-line-height-normal)}.s-select-option__icon{display:none;justify-content:center;align-items:center;margin-inline-start:8px}.s-select-option-group__label{position:sticky;top:0;z-index:2;padding:var(--s-select-option-group-label-padding-y) var(--s-select-option-group-label-padding-x);font-size:var(--s-select-option-group-label-font-size);line-height:var(--s-line-height-snug);color:var(--s-select-option-group-label-color);background:var(--s-select-option-group-label-bg)}.s-select-option-group__content{position:relative}
|
|
@@ -4,16 +4,15 @@ declare const __VLS_base: import("vue").DefineComponent<SelectProps, SelectExpos
|
|
|
4
4
|
select: (value: any) => any;
|
|
5
5
|
change: (value: any) => any;
|
|
6
6
|
"update:modelValue": (value: any) => any;
|
|
7
|
-
"update:
|
|
7
|
+
"update:filterValue": (value: string) => any;
|
|
8
8
|
}, string, import("vue").PublicProps, Readonly<SelectProps> & Readonly<{
|
|
9
9
|
onSelect?: ((value: any) => any) | undefined;
|
|
10
10
|
onChange?: ((value: any) => any) | undefined;
|
|
11
11
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
12
|
-
"onUpdate:
|
|
12
|
+
"onUpdate:filterValue"?: ((value: string) => any) | undefined;
|
|
13
13
|
}>, {
|
|
14
14
|
multiple: boolean;
|
|
15
15
|
options: any[];
|
|
16
|
-
threshold: number;
|
|
17
16
|
modelValue: any;
|
|
18
17
|
optionKeys: import("../../use").OptionKeys;
|
|
19
18
|
filterPlaceholder: string;
|
|
@@ -21,10 +20,9 @@ declare const __VLS_base: import("vue").DefineComponent<SelectProps, SelectExpos
|
|
|
21
20
|
filterable: boolean;
|
|
22
21
|
filterMethod: (query: string) => void;
|
|
23
22
|
filterValue: string;
|
|
24
|
-
remote: boolean;
|
|
25
|
-
remoteMethod: (query: string, page: number, isRefresh: boolean) => Promise<boolean>;
|
|
26
23
|
showToolbar: boolean;
|
|
27
24
|
valueKey: string;
|
|
25
|
+
filterLoading: boolean;
|
|
28
26
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
27
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
30
28
|
declare const _default: typeof __VLS_export;
|