first commit
This commit is contained in:
81
node_modules/vant/es/list/List.d.ts
generated
vendored
Normal file
81
node_modules/vant/es/list/List.d.ts
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
import { type PropType, type ExtractPropTypes } from 'vue';
|
||||
import type { ListDirection } from './types';
|
||||
export declare const listProps: {
|
||||
error: BooleanConstructor;
|
||||
offset: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
finished: BooleanConstructor;
|
||||
scroller: PropType<Element>;
|
||||
errorText: StringConstructor;
|
||||
direction: {
|
||||
type: PropType<ListDirection>;
|
||||
default: ListDirection;
|
||||
};
|
||||
loadingText: StringConstructor;
|
||||
finishedText: StringConstructor;
|
||||
immediateCheck: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
};
|
||||
export type ListProps = ExtractPropTypes<typeof listProps>;
|
||||
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
||||
error: BooleanConstructor;
|
||||
offset: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
finished: BooleanConstructor;
|
||||
scroller: PropType<Element>;
|
||||
errorText: StringConstructor;
|
||||
direction: {
|
||||
type: PropType<ListDirection>;
|
||||
default: ListDirection;
|
||||
};
|
||||
loadingText: StringConstructor;
|
||||
finishedText: StringConstructor;
|
||||
immediateCheck: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("load" | "update:error" | "update:loading")[], "load" | "update:error" | "update:loading", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
||||
error: BooleanConstructor;
|
||||
offset: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
finished: BooleanConstructor;
|
||||
scroller: PropType<Element>;
|
||||
errorText: StringConstructor;
|
||||
direction: {
|
||||
type: PropType<ListDirection>;
|
||||
default: ListDirection;
|
||||
};
|
||||
loadingText: StringConstructor;
|
||||
finishedText: StringConstructor;
|
||||
immediateCheck: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onLoad?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:error"?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:loading"?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
offset: string | number;
|
||||
disabled: boolean;
|
||||
error: boolean;
|
||||
loading: boolean;
|
||||
direction: ListDirection;
|
||||
finished: boolean;
|
||||
immediateCheck: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
143
node_modules/vant/es/list/List.mjs
generated
vendored
Normal file
143
node_modules/vant/es/list/List.mjs
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
import { ref, watch, computed, nextTick, onUpdated, onMounted, defineComponent, createVNode as _createVNode } from "vue";
|
||||
import { isHidden, truthProp, makeStringProp, makeNumericProp, createNamespace } from "../utils/index.mjs";
|
||||
import { useRect, useScrollParent, useEventListener } from "@vant/use";
|
||||
import { useExpose } from "../composables/use-expose.mjs";
|
||||
import { useAllTabStatus } from "../composables/use-tab-status.mjs";
|
||||
import { Loading } from "../loading/index.mjs";
|
||||
const [name, bem, t] = createNamespace("list");
|
||||
const listProps = {
|
||||
error: Boolean,
|
||||
offset: makeNumericProp(300),
|
||||
loading: Boolean,
|
||||
disabled: Boolean,
|
||||
finished: Boolean,
|
||||
scroller: Object,
|
||||
errorText: String,
|
||||
direction: makeStringProp("down"),
|
||||
loadingText: String,
|
||||
finishedText: String,
|
||||
immediateCheck: truthProp
|
||||
};
|
||||
var stdin_default = defineComponent({
|
||||
name,
|
||||
props: listProps,
|
||||
emits: ["load", "update:error", "update:loading"],
|
||||
setup(props, {
|
||||
emit,
|
||||
slots
|
||||
}) {
|
||||
const loading = ref(props.loading);
|
||||
const root = ref();
|
||||
const placeholder = ref();
|
||||
const tabStatus = useAllTabStatus();
|
||||
const scrollParent = useScrollParent(root);
|
||||
const scroller = computed(() => props.scroller || scrollParent.value);
|
||||
const check = () => {
|
||||
nextTick(() => {
|
||||
if (loading.value || props.finished || props.disabled || props.error || // skip check when inside an inactive tab
|
||||
(tabStatus == null ? void 0 : tabStatus.value) === false) {
|
||||
return;
|
||||
}
|
||||
const {
|
||||
direction
|
||||
} = props;
|
||||
const offset = +props.offset;
|
||||
const scrollParentRect = useRect(scroller);
|
||||
if (!scrollParentRect.height || isHidden(root)) {
|
||||
return;
|
||||
}
|
||||
let isReachEdge = false;
|
||||
const placeholderRect = useRect(placeholder);
|
||||
if (direction === "up") {
|
||||
isReachEdge = scrollParentRect.top - placeholderRect.top <= offset;
|
||||
} else {
|
||||
isReachEdge = placeholderRect.bottom - scrollParentRect.bottom <= offset;
|
||||
}
|
||||
if (isReachEdge) {
|
||||
loading.value = true;
|
||||
emit("update:loading", true);
|
||||
emit("load");
|
||||
}
|
||||
});
|
||||
};
|
||||
const renderFinishedText = () => {
|
||||
if (props.finished) {
|
||||
const text = slots.finished ? slots.finished() : props.finishedText;
|
||||
if (text) {
|
||||
return _createVNode("div", {
|
||||
"class": bem("finished-text")
|
||||
}, [text]);
|
||||
}
|
||||
}
|
||||
};
|
||||
const clickErrorText = () => {
|
||||
emit("update:error", false);
|
||||
check();
|
||||
};
|
||||
const renderErrorText = () => {
|
||||
if (props.error) {
|
||||
const text = slots.error ? slots.error() : props.errorText;
|
||||
if (text) {
|
||||
return _createVNode("div", {
|
||||
"role": "button",
|
||||
"class": bem("error-text"),
|
||||
"tabindex": 0,
|
||||
"onClick": clickErrorText
|
||||
}, [text]);
|
||||
}
|
||||
}
|
||||
};
|
||||
const renderLoading = () => {
|
||||
if (loading.value && !props.finished && !props.disabled) {
|
||||
return _createVNode("div", {
|
||||
"class": bem("loading")
|
||||
}, [slots.loading ? slots.loading() : _createVNode(Loading, {
|
||||
"class": bem("loading-icon")
|
||||
}, {
|
||||
default: () => [props.loadingText || t("loading")]
|
||||
})]);
|
||||
}
|
||||
};
|
||||
watch(() => [props.loading, props.finished, props.error], check);
|
||||
if (tabStatus) {
|
||||
watch(tabStatus, (tabActive) => {
|
||||
if (tabActive) {
|
||||
check();
|
||||
}
|
||||
});
|
||||
}
|
||||
onUpdated(() => {
|
||||
loading.value = props.loading;
|
||||
});
|
||||
onMounted(() => {
|
||||
if (props.immediateCheck) {
|
||||
check();
|
||||
}
|
||||
});
|
||||
useExpose({
|
||||
check
|
||||
});
|
||||
useEventListener("scroll", check, {
|
||||
target: scroller,
|
||||
passive: true
|
||||
});
|
||||
return () => {
|
||||
var _a;
|
||||
const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
||||
const Placeholder = _createVNode("div", {
|
||||
"ref": placeholder,
|
||||
"class": bem("placeholder")
|
||||
}, null);
|
||||
return _createVNode("div", {
|
||||
"ref": root,
|
||||
"role": "feed",
|
||||
"class": bem(),
|
||||
"aria-busy": loading.value
|
||||
}, [props.direction === "down" ? Content : Placeholder, renderLoading(), renderFinishedText(), renderErrorText(), props.direction === "up" ? Content : Placeholder]);
|
||||
};
|
||||
}
|
||||
});
|
||||
export {
|
||||
stdin_default as default,
|
||||
listProps
|
||||
};
|
||||
1
node_modules/vant/es/list/index.css
generated
vendored
Normal file
1
node_modules/vant/es/list/index.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
:root,:host{--van-list-text-color: var(--van-text-color-2);--van-list-text-font-size: var(--van-font-size-md);--van-list-text-line-height: 50px;--van-list-loading-icon-size: 16px}.van-list__loading,.van-list__finished-text,.van-list__error-text{color:var(--van-list-text-color);font-size:var(--van-list-text-font-size);line-height:var(--van-list-text-line-height);text-align:center}.van-list__placeholder{height:0;pointer-events:none}.van-list__loading-icon .van-loading__spinner{width:var(--van-list-loading-icon-size);height:var(--van-list-loading-icon-size)}
|
||||
65
node_modules/vant/es/list/index.d.ts
generated
vendored
Normal file
65
node_modules/vant/es/list/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import { ListProps } from './List';
|
||||
export declare const List: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
error: BooleanConstructor;
|
||||
offset: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
finished: BooleanConstructor;
|
||||
scroller: import("vue").PropType<Element>;
|
||||
errorText: StringConstructor;
|
||||
direction: {
|
||||
type: import("vue").PropType<import("./types").ListDirection>;
|
||||
default: import("./types").ListDirection;
|
||||
};
|
||||
loadingText: StringConstructor;
|
||||
finishedText: StringConstructor;
|
||||
immediateCheck: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("load" | "update:error" | "update:loading")[], "load" | "update:error" | "update:loading", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
error: BooleanConstructor;
|
||||
offset: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
loading: BooleanConstructor;
|
||||
disabled: BooleanConstructor;
|
||||
finished: BooleanConstructor;
|
||||
scroller: import("vue").PropType<Element>;
|
||||
errorText: StringConstructor;
|
||||
direction: {
|
||||
type: import("vue").PropType<import("./types").ListDirection>;
|
||||
default: import("./types").ListDirection;
|
||||
};
|
||||
loadingText: StringConstructor;
|
||||
finishedText: StringConstructor;
|
||||
immediateCheck: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onLoad?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:error"?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:loading"?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
offset: string | number;
|
||||
disabled: boolean;
|
||||
error: boolean;
|
||||
loading: boolean;
|
||||
direction: import("./types").ListDirection;
|
||||
finished: boolean;
|
||||
immediateCheck: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default List;
|
||||
export { listProps } from './List';
|
||||
export type { ListProps };
|
||||
export type { ListInstance, ListDirection, ListThemeVars } from './types';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
VanList: typeof List;
|
||||
}
|
||||
}
|
||||
10
node_modules/vant/es/list/index.mjs
generated
vendored
Normal file
10
node_modules/vant/es/list/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { withInstall } from "../utils/index.mjs";
|
||||
import _List from "./List.mjs";
|
||||
const List = withInstall(_List);
|
||||
var stdin_default = List;
|
||||
import { listProps } from "./List.mjs";
|
||||
export {
|
||||
List,
|
||||
stdin_default as default,
|
||||
listProps
|
||||
};
|
||||
1
node_modules/vant/es/list/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/es/list/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
3
node_modules/vant/es/list/style/index.mjs
generated
vendored
Normal file
3
node_modules/vant/es/list/style/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import "../../style/base.css";
|
||||
import "../../loading/index.css";
|
||||
import "../index.css";
|
||||
13
node_modules/vant/es/list/types.d.ts
generated
vendored
Normal file
13
node_modules/vant/es/list/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { ComponentPublicInstance } from 'vue';
|
||||
import type { ListProps } from './List';
|
||||
export type ListDirection = 'up' | 'down';
|
||||
export type ListExpose = {
|
||||
check: () => void;
|
||||
};
|
||||
export type ListInstance = ComponentPublicInstance<ListProps, ListExpose>;
|
||||
export type ListThemeVars = {
|
||||
listTextColor?: string;
|
||||
listTextFontSize?: string;
|
||||
listTextLineHeight?: number | string;
|
||||
listLoadingIconSize?: string;
|
||||
};
|
||||
0
node_modules/vant/es/list/types.mjs
generated
vendored
Normal file
0
node_modules/vant/es/list/types.mjs
generated
vendored
Normal file
Reference in New Issue
Block a user