first commit
This commit is contained in:
167
node_modules/vant/lib/tabs/Tabs.d.ts
generated
vendored
Normal file
167
node_modules/vant/lib/tabs/Tabs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
import { type PropType, type InjectionKey, type ExtractPropTypes } from 'vue';
|
||||
import { type Interceptor } from '../utils';
|
||||
import type { TabsProvide, TabsType } from './types';
|
||||
export declare const tabsProps: {
|
||||
type: {
|
||||
type: PropType<TabsType>;
|
||||
default: TabsType;
|
||||
};
|
||||
color: StringConstructor;
|
||||
border: BooleanConstructor;
|
||||
sticky: BooleanConstructor;
|
||||
shrink: BooleanConstructor;
|
||||
active: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
duration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
animated: BooleanConstructor;
|
||||
ellipsis: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeable: BooleanConstructor;
|
||||
scrollspy: BooleanConstructor;
|
||||
offsetTop: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
background: StringConstructor;
|
||||
lazyRender: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
showHeader: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
lineWidth: (NumberConstructor | StringConstructor)[];
|
||||
lineHeight: (NumberConstructor | StringConstructor)[];
|
||||
beforeChange: PropType<Interceptor>;
|
||||
swipeThreshold: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
titleActiveColor: StringConstructor;
|
||||
titleInactiveColor: StringConstructor;
|
||||
};
|
||||
export type TabsProps = ExtractPropTypes<typeof tabsProps>;
|
||||
export declare const TABS_KEY: InjectionKey<TabsProvide>;
|
||||
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
||||
type: {
|
||||
type: PropType<TabsType>;
|
||||
default: TabsType;
|
||||
};
|
||||
color: StringConstructor;
|
||||
border: BooleanConstructor;
|
||||
sticky: BooleanConstructor;
|
||||
shrink: BooleanConstructor;
|
||||
active: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
duration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
animated: BooleanConstructor;
|
||||
ellipsis: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeable: BooleanConstructor;
|
||||
scrollspy: BooleanConstructor;
|
||||
offsetTop: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
background: StringConstructor;
|
||||
lazyRender: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
showHeader: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
lineWidth: (NumberConstructor | StringConstructor)[];
|
||||
lineHeight: (NumberConstructor | StringConstructor)[];
|
||||
beforeChange: PropType<Interceptor>;
|
||||
swipeThreshold: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
titleActiveColor: StringConstructor;
|
||||
titleInactiveColor: StringConstructor;
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("scroll" | "change" | "rendered" | "clickTab" | "update:active")[], "scroll" | "change" | "rendered" | "clickTab" | "update:active", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
||||
type: {
|
||||
type: PropType<TabsType>;
|
||||
default: TabsType;
|
||||
};
|
||||
color: StringConstructor;
|
||||
border: BooleanConstructor;
|
||||
sticky: BooleanConstructor;
|
||||
shrink: BooleanConstructor;
|
||||
active: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
duration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
animated: BooleanConstructor;
|
||||
ellipsis: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeable: BooleanConstructor;
|
||||
scrollspy: BooleanConstructor;
|
||||
offsetTop: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
background: StringConstructor;
|
||||
lazyRender: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
showHeader: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
lineWidth: (NumberConstructor | StringConstructor)[];
|
||||
lineHeight: (NumberConstructor | StringConstructor)[];
|
||||
beforeChange: PropType<Interceptor>;
|
||||
swipeThreshold: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
titleActiveColor: StringConstructor;
|
||||
titleInactiveColor: StringConstructor;
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
onScroll?: ((...args: any[]) => any) | undefined;
|
||||
onRendered?: ((...args: any[]) => any) | undefined;
|
||||
onClickTab?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:active"?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
type: TabsType;
|
||||
ellipsis: boolean;
|
||||
sticky: boolean;
|
||||
border: boolean;
|
||||
active: string | number;
|
||||
duration: string | number;
|
||||
lazyRender: boolean;
|
||||
offsetTop: string | number;
|
||||
animated: boolean;
|
||||
swipeable: boolean;
|
||||
shrink: boolean;
|
||||
scrollspy: boolean;
|
||||
showHeader: boolean;
|
||||
swipeThreshold: string | number;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
385
node_modules/vant/lib/tabs/Tabs.js
generated
vendored
Normal file
385
node_modules/vant/lib/tabs/Tabs.js
generated
vendored
Normal file
@@ -0,0 +1,385 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name2 in all)
|
||||
__defProp(target, name2, { get: all[name2], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
TABS_KEY: () => TABS_KEY,
|
||||
default: () => stdin_default,
|
||||
tabsProps: () => tabsProps
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_vue = require("vue");
|
||||
var import_utils = require("../utils");
|
||||
var import_utils2 = require("./utils");
|
||||
var import_use = require("@vant/use");
|
||||
var import_use_id = require("../composables/use-id");
|
||||
var import_use_route = require("../composables/use-route");
|
||||
var import_use_refs = require("../composables/use-refs");
|
||||
var import_use_expose = require("../composables/use-expose");
|
||||
var import_on_popup_reopen = require("../composables/on-popup-reopen");
|
||||
var import_use_visibility_change = require("../composables/use-visibility-change");
|
||||
var import_sticky = require("../sticky");
|
||||
var import_TabsContent = __toESM(require("./TabsContent"));
|
||||
const [name, bem] = (0, import_utils.createNamespace)("tabs");
|
||||
const tabsProps = {
|
||||
type: (0, import_utils.makeStringProp)("line"),
|
||||
color: String,
|
||||
border: Boolean,
|
||||
sticky: Boolean,
|
||||
shrink: Boolean,
|
||||
active: (0, import_utils.makeNumericProp)(0),
|
||||
duration: (0, import_utils.makeNumericProp)(0.3),
|
||||
animated: Boolean,
|
||||
ellipsis: import_utils.truthProp,
|
||||
swipeable: Boolean,
|
||||
scrollspy: Boolean,
|
||||
offsetTop: (0, import_utils.makeNumericProp)(0),
|
||||
background: String,
|
||||
lazyRender: import_utils.truthProp,
|
||||
showHeader: import_utils.truthProp,
|
||||
lineWidth: import_utils.numericProp,
|
||||
lineHeight: import_utils.numericProp,
|
||||
beforeChange: Function,
|
||||
swipeThreshold: (0, import_utils.makeNumericProp)(5),
|
||||
titleActiveColor: String,
|
||||
titleInactiveColor: String
|
||||
};
|
||||
const TABS_KEY = Symbol(name);
|
||||
var stdin_default = (0, import_vue.defineComponent)({
|
||||
name,
|
||||
props: tabsProps,
|
||||
emits: ["change", "scroll", "rendered", "clickTab", "update:active"],
|
||||
setup(props, {
|
||||
emit,
|
||||
slots
|
||||
}) {
|
||||
let tabHeight;
|
||||
let lockScroll;
|
||||
let stickyFixed;
|
||||
let cancelScrollLeftToRaf;
|
||||
let cancelScrollTopToRaf;
|
||||
const root = (0, import_vue.ref)();
|
||||
const navRef = (0, import_vue.ref)();
|
||||
const wrapRef = (0, import_vue.ref)();
|
||||
const contentRef = (0, import_vue.ref)();
|
||||
const id = (0, import_use_id.useId)();
|
||||
const scroller = (0, import_use.useScrollParent)(root);
|
||||
const [titleRefs, setTitleRefs] = (0, import_use_refs.useRefs)();
|
||||
const {
|
||||
children,
|
||||
linkChildren
|
||||
} = (0, import_use.useChildren)(TABS_KEY);
|
||||
const state = (0, import_vue.reactive)({
|
||||
inited: false,
|
||||
position: "",
|
||||
lineStyle: {},
|
||||
currentIndex: -1
|
||||
});
|
||||
const scrollable = (0, import_vue.computed)(() => children.length > +props.swipeThreshold || !props.ellipsis || props.shrink);
|
||||
const navStyle = (0, import_vue.computed)(() => ({
|
||||
borderColor: props.color,
|
||||
background: props.background
|
||||
}));
|
||||
const getTabName = (tab, index) => {
|
||||
var _a;
|
||||
return (_a = tab.name) != null ? _a : index;
|
||||
};
|
||||
const currentName = (0, import_vue.computed)(() => {
|
||||
const activeTab = children[state.currentIndex];
|
||||
if (activeTab) {
|
||||
return getTabName(activeTab, state.currentIndex);
|
||||
}
|
||||
});
|
||||
const offsetTopPx = (0, import_vue.computed)(() => (0, import_utils.unitToPx)(props.offsetTop));
|
||||
const scrollOffset = (0, import_vue.computed)(() => {
|
||||
if (props.sticky) {
|
||||
return offsetTopPx.value + tabHeight;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
const scrollIntoView = (immediate) => {
|
||||
const nav = navRef.value;
|
||||
const titles = titleRefs.value;
|
||||
if (!scrollable.value || !nav || !titles || !titles[state.currentIndex]) {
|
||||
return;
|
||||
}
|
||||
const title = titles[state.currentIndex].$el;
|
||||
const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
|
||||
if (cancelScrollLeftToRaf) cancelScrollLeftToRaf();
|
||||
cancelScrollLeftToRaf = (0, import_utils2.scrollLeftTo)(nav, to, immediate ? 0 : +props.duration);
|
||||
};
|
||||
const setLine = () => {
|
||||
const shouldAnimate = state.inited;
|
||||
(0, import_vue.nextTick)(() => {
|
||||
const titles = titleRefs.value;
|
||||
if (!titles || !titles[state.currentIndex] || props.type !== "line" || (0, import_utils.isHidden)(root.value)) {
|
||||
return;
|
||||
}
|
||||
const title = titles[state.currentIndex].$el;
|
||||
const {
|
||||
lineWidth,
|
||||
lineHeight
|
||||
} = props;
|
||||
const left = title.offsetLeft + title.offsetWidth / 2;
|
||||
const lineStyle = {
|
||||
width: (0, import_utils.addUnit)(lineWidth),
|
||||
backgroundColor: props.color,
|
||||
transform: `translateX(${left}px) translateX(-50%)`
|
||||
};
|
||||
if (shouldAnimate) {
|
||||
lineStyle.transitionDuration = `${props.duration}s`;
|
||||
}
|
||||
if ((0, import_utils.isDef)(lineHeight)) {
|
||||
const height = (0, import_utils.addUnit)(lineHeight);
|
||||
lineStyle.height = height;
|
||||
lineStyle.borderRadius = height;
|
||||
}
|
||||
state.lineStyle = lineStyle;
|
||||
});
|
||||
};
|
||||
const findAvailableTab = (index) => {
|
||||
const diff = index < state.currentIndex ? -1 : 1;
|
||||
while (index >= 0 && index < children.length) {
|
||||
if (!children[index].disabled) {
|
||||
return index;
|
||||
}
|
||||
index += diff;
|
||||
}
|
||||
};
|
||||
const setCurrentIndex = (currentIndex, skipScrollIntoView) => {
|
||||
const newIndex = findAvailableTab(currentIndex);
|
||||
if (!(0, import_utils.isDef)(newIndex)) {
|
||||
return;
|
||||
}
|
||||
const newTab = children[newIndex];
|
||||
const newName = getTabName(newTab, newIndex);
|
||||
const shouldEmitChange = state.currentIndex !== null;
|
||||
if (state.currentIndex !== newIndex) {
|
||||
state.currentIndex = newIndex;
|
||||
if (!skipScrollIntoView) {
|
||||
scrollIntoView();
|
||||
}
|
||||
setLine();
|
||||
}
|
||||
if (newName !== props.active) {
|
||||
emit("update:active", newName);
|
||||
if (shouldEmitChange) {
|
||||
emit("change", newName, newTab.title);
|
||||
}
|
||||
}
|
||||
if (stickyFixed && !props.scrollspy) {
|
||||
(0, import_utils.setRootScrollTop)(Math.ceil((0, import_utils.getElementTop)(root.value) - offsetTopPx.value));
|
||||
}
|
||||
};
|
||||
const setCurrentIndexByName = (name2, skipScrollIntoView) => {
|
||||
const index = children.findIndex((tab, index2) => getTabName(tab, index2) === name2);
|
||||
setCurrentIndex(index === -1 ? 0 : index, skipScrollIntoView);
|
||||
};
|
||||
const scrollToCurrentContent = (immediate = false) => {
|
||||
if (props.scrollspy) {
|
||||
const target = children[state.currentIndex].$el;
|
||||
if (target && scroller.value) {
|
||||
const to = (0, import_utils.getElementTop)(target, scroller.value) - scrollOffset.value;
|
||||
lockScroll = true;
|
||||
if (cancelScrollTopToRaf) cancelScrollTopToRaf();
|
||||
cancelScrollTopToRaf = (0, import_utils2.scrollTopTo)(scroller.value, to, immediate ? 0 : +props.duration, () => {
|
||||
lockScroll = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
const onClickTab = (item, index, event) => {
|
||||
const {
|
||||
title,
|
||||
disabled
|
||||
} = children[index];
|
||||
const name2 = getTabName(children[index], index);
|
||||
if (!disabled) {
|
||||
(0, import_utils.callInterceptor)(props.beforeChange, {
|
||||
args: [name2],
|
||||
done: () => {
|
||||
setCurrentIndex(index);
|
||||
scrollToCurrentContent();
|
||||
}
|
||||
});
|
||||
(0, import_use_route.route)(item);
|
||||
}
|
||||
emit("clickTab", {
|
||||
name: name2,
|
||||
title,
|
||||
event,
|
||||
disabled
|
||||
});
|
||||
};
|
||||
const onStickyScroll = (params) => {
|
||||
stickyFixed = params.isFixed;
|
||||
emit("scroll", params);
|
||||
};
|
||||
const scrollTo = (name2) => {
|
||||
(0, import_vue.nextTick)(() => {
|
||||
setCurrentIndexByName(name2);
|
||||
scrollToCurrentContent(true);
|
||||
});
|
||||
};
|
||||
const getCurrentIndexOnScroll = () => {
|
||||
for (let index = 0; index < children.length; index++) {
|
||||
const {
|
||||
top
|
||||
} = (0, import_use.useRect)(children[index].$el);
|
||||
if (top > scrollOffset.value) {
|
||||
return index === 0 ? 0 : index - 1;
|
||||
}
|
||||
}
|
||||
return children.length - 1;
|
||||
};
|
||||
const onScroll = () => {
|
||||
if (props.scrollspy && !lockScroll) {
|
||||
const index = getCurrentIndexOnScroll();
|
||||
setCurrentIndex(index);
|
||||
}
|
||||
};
|
||||
const renderLine = () => {
|
||||
if (props.type === "line" && children.length) {
|
||||
return (0, import_vue.createVNode)("div", {
|
||||
"class": bem("line"),
|
||||
"style": state.lineStyle
|
||||
}, null);
|
||||
}
|
||||
};
|
||||
const renderHeader = () => {
|
||||
var _a, _b, _c;
|
||||
const {
|
||||
type,
|
||||
border,
|
||||
sticky
|
||||
} = props;
|
||||
const Header = [(0, import_vue.createVNode)("div", {
|
||||
"ref": sticky ? void 0 : wrapRef,
|
||||
"class": [bem("wrap"), {
|
||||
[import_utils.BORDER_TOP_BOTTOM]: type === "line" && border
|
||||
}]
|
||||
}, [(0, import_vue.createVNode)("div", {
|
||||
"ref": navRef,
|
||||
"role": "tablist",
|
||||
"class": bem("nav", [type, {
|
||||
shrink: props.shrink,
|
||||
complete: scrollable.value
|
||||
}]),
|
||||
"style": navStyle.value,
|
||||
"aria-orientation": "horizontal"
|
||||
}, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), children.map((item) => item.renderTitle(onClickTab)), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
|
||||
if (sticky) {
|
||||
return (0, import_vue.createVNode)("div", {
|
||||
"ref": wrapRef
|
||||
}, [Header]);
|
||||
}
|
||||
return Header;
|
||||
};
|
||||
const resize = () => {
|
||||
setLine();
|
||||
(0, import_vue.nextTick)(() => {
|
||||
var _a, _b;
|
||||
scrollIntoView(true);
|
||||
(_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
|
||||
});
|
||||
};
|
||||
(0, import_vue.watch)(() => [props.color, props.duration, props.lineWidth, props.lineHeight], setLine);
|
||||
(0, import_vue.watch)(import_utils.windowWidth, resize);
|
||||
(0, import_vue.watch)(() => props.active, (value) => {
|
||||
if (value !== currentName.value) {
|
||||
setCurrentIndexByName(value);
|
||||
}
|
||||
});
|
||||
(0, import_vue.watch)(() => children.length, () => {
|
||||
if (state.inited) {
|
||||
setCurrentIndexByName(props.active);
|
||||
setLine();
|
||||
(0, import_vue.nextTick)(() => {
|
||||
scrollIntoView(true);
|
||||
});
|
||||
}
|
||||
});
|
||||
const init = () => {
|
||||
setCurrentIndexByName(props.active, true);
|
||||
(0, import_vue.nextTick)(() => {
|
||||
state.inited = true;
|
||||
if (wrapRef.value) {
|
||||
tabHeight = (0, import_use.useRect)(wrapRef.value).height;
|
||||
}
|
||||
scrollIntoView(true);
|
||||
});
|
||||
};
|
||||
const onRendered = (name2, title) => emit("rendered", name2, title);
|
||||
(0, import_use_expose.useExpose)({
|
||||
resize,
|
||||
scrollTo
|
||||
});
|
||||
(0, import_vue.onActivated)(setLine);
|
||||
(0, import_on_popup_reopen.onPopupReopen)(setLine);
|
||||
(0, import_use.onMountedOrActivated)(init);
|
||||
(0, import_use_visibility_change.useVisibilityChange)(root, setLine);
|
||||
(0, import_use.useEventListener)("scroll", onScroll, {
|
||||
target: scroller,
|
||||
passive: true
|
||||
});
|
||||
linkChildren({
|
||||
id,
|
||||
props,
|
||||
setLine,
|
||||
scrollable,
|
||||
onRendered,
|
||||
currentName,
|
||||
setTitleRefs,
|
||||
scrollIntoView
|
||||
});
|
||||
return () => (0, import_vue.createVNode)("div", {
|
||||
"ref": root,
|
||||
"class": bem([props.type])
|
||||
}, [props.showHeader ? props.sticky ? (0, import_vue.createVNode)(import_sticky.Sticky, {
|
||||
"container": root.value,
|
||||
"offsetTop": offsetTopPx.value,
|
||||
"onScroll": onStickyScroll
|
||||
}, {
|
||||
default: () => [renderHeader()]
|
||||
}) : renderHeader() : null, (0, import_vue.createVNode)(import_TabsContent.default, {
|
||||
"ref": contentRef,
|
||||
"count": children.length,
|
||||
"inited": state.inited,
|
||||
"animated": props.animated,
|
||||
"duration": props.duration,
|
||||
"swipeable": props.swipeable,
|
||||
"lazyRender": props.lazyRender,
|
||||
"currentIndex": state.currentIndex,
|
||||
"onChange": setCurrentIndex
|
||||
}, {
|
||||
default: () => {
|
||||
var _a;
|
||||
return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
||||
}
|
||||
})]);
|
||||
}
|
||||
});
|
||||
43
node_modules/vant/lib/tabs/TabsContent.d.ts
generated
vendored
Normal file
43
node_modules/vant/lib/tabs/TabsContent.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
count: {
|
||||
type: NumberConstructor;
|
||||
required: true;
|
||||
};
|
||||
inited: BooleanConstructor;
|
||||
animated: BooleanConstructor;
|
||||
duration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
required: true;
|
||||
};
|
||||
swipeable: BooleanConstructor;
|
||||
lazyRender: BooleanConstructor;
|
||||
currentIndex: {
|
||||
type: NumberConstructor;
|
||||
required: true;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
count: {
|
||||
type: NumberConstructor;
|
||||
required: true;
|
||||
};
|
||||
inited: BooleanConstructor;
|
||||
animated: BooleanConstructor;
|
||||
duration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
required: true;
|
||||
};
|
||||
swipeable: BooleanConstructor;
|
||||
lazyRender: BooleanConstructor;
|
||||
currentIndex: {
|
||||
type: NumberConstructor;
|
||||
required: true;
|
||||
};
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
lazyRender: boolean;
|
||||
inited: boolean;
|
||||
animated: boolean;
|
||||
swipeable: boolean;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
86
node_modules/vant/lib/tabs/TabsContent.js
generated
vendored
Normal file
86
node_modules/vant/lib/tabs/TabsContent.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name2 in all)
|
||||
__defProp(target, name2, { get: all[name2], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
default: () => stdin_default
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_vue = require("vue");
|
||||
var import_utils = require("../utils");
|
||||
var import_swipe = require("../swipe");
|
||||
var import_use_expose = require("../composables/use-expose");
|
||||
const [name, bem] = (0, import_utils.createNamespace)("tabs");
|
||||
var stdin_default = (0, import_vue.defineComponent)({
|
||||
name,
|
||||
props: {
|
||||
count: (0, import_utils.makeRequiredProp)(Number),
|
||||
inited: Boolean,
|
||||
animated: Boolean,
|
||||
duration: (0, import_utils.makeRequiredProp)(import_utils.numericProp),
|
||||
swipeable: Boolean,
|
||||
lazyRender: Boolean,
|
||||
currentIndex: (0, import_utils.makeRequiredProp)(Number)
|
||||
},
|
||||
emits: ["change"],
|
||||
setup(props, {
|
||||
emit,
|
||||
slots
|
||||
}) {
|
||||
const swipeRef = (0, import_vue.ref)();
|
||||
const onChange = (index) => emit("change", index);
|
||||
const renderChildren = () => {
|
||||
var _a;
|
||||
const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
||||
if (props.animated || props.swipeable) {
|
||||
return (0, import_vue.createVNode)(import_swipe.Swipe, {
|
||||
"ref": swipeRef,
|
||||
"loop": false,
|
||||
"class": bem("track"),
|
||||
"duration": +props.duration * 1e3,
|
||||
"touchable": props.swipeable,
|
||||
"lazyRender": props.lazyRender,
|
||||
"showIndicators": false,
|
||||
"onChange": onChange
|
||||
}, {
|
||||
default: () => [Content]
|
||||
});
|
||||
}
|
||||
return Content;
|
||||
};
|
||||
const swipeToCurrentTab = (index) => {
|
||||
const swipe = swipeRef.value;
|
||||
if (swipe && swipe.state.active !== index) {
|
||||
swipe.swipeTo(index, {
|
||||
immediate: !props.inited
|
||||
});
|
||||
}
|
||||
};
|
||||
(0, import_vue.watch)(() => props.currentIndex, swipeToCurrentTab);
|
||||
(0, import_vue.onMounted)(() => {
|
||||
swipeToCurrentTab(props.currentIndex);
|
||||
});
|
||||
(0, import_use_expose.useExpose)({
|
||||
swipeRef
|
||||
});
|
||||
return () => (0, import_vue.createVNode)("div", {
|
||||
"class": bem("content", {
|
||||
animated: props.animated || props.swipeable
|
||||
})
|
||||
}, [renderChildren()]);
|
||||
}
|
||||
});
|
||||
1
node_modules/vant/lib/tabs/index.css
generated
vendored
Normal file
1
node_modules/vant/lib/tabs/index.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
:root,:host{--van-tab-text-color: var(--van-gray-7);--van-tab-active-text-color: var(--van-text-color);--van-tab-disabled-text-color: var(--van-text-color-3);--van-tab-font-size: var(--van-font-size-md);--van-tab-line-height: var(--van-line-height-md);--van-tabs-default-color: var(--van-primary-color);--van-tabs-line-height: 44px;--van-tabs-card-height: 30px;--van-tabs-nav-background: var(--van-background-2);--van-tabs-bottom-bar-width: 40px;--van-tabs-bottom-bar-height: 3px;--van-tabs-bottom-bar-color: var(--van-primary-color)}.van-tab{position:relative;display:flex;flex:1;align-items:center;justify-content:center;box-sizing:border-box;padding:0 var(--van-padding-base);color:var(--van-tab-text-color);font-size:var(--van-tab-font-size);line-height:var(--van-tab-line-height);cursor:pointer}.van-tab--active{color:var(--van-tab-active-text-color);font-weight:var(--van-font-bold)}.van-tab--disabled{color:var(--van-tab-disabled-text-color);cursor:not-allowed}.van-tab--grow{flex:1 0 auto;padding:0 var(--van-padding-sm)}.van-tab--shrink{flex:none;padding:0 var(--van-padding-xs)}.van-tab--card{color:var(--van-tabs-default-color);border-right:var(--van-border-width) solid var(--van-tabs-default-color)}.van-tab--card:last-child{border-right:none}.van-tab--card.van-tab--active{color:var(--van-white);background-color:var(--van-tabs-default-color)}.van-tab--card.van-tab--disabled{color:var(--van-tab-disabled-text-color)}.van-tab__text--ellipsis{display:-webkit-box;overflow:hidden;-webkit-line-clamp:1;-webkit-box-orient:vertical}.van-tabs{position:relative}.van-tabs__wrap{overflow:hidden}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__nav{position:relative;display:flex;background:var(--van-tabs-nav-background);-webkit-user-select:none;user-select:none}.van-tabs__nav--complete{overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-tabs__nav--complete::-webkit-scrollbar{display:none}.van-tabs__nav--line{box-sizing:content-box;height:100%;padding-bottom:15px}.van-tabs__nav--line.van-tabs__nav--shrink,.van-tabs__nav--line.van-tabs__nav--complete{padding-right:var(--van-padding-xs);padding-left:var(--van-padding-xs)}.van-tabs__nav--card{box-sizing:border-box;height:var(--van-tabs-card-height);margin:0 var(--van-padding-md);border:var(--van-border-width) solid var(--van-tabs-default-color);border-radius:var(--van-radius-sm)}.van-tabs__nav--card.van-tabs__nav--shrink{display:inline-flex}.van-tabs__line{position:absolute;bottom:15px;left:0;z-index:1;width:var(--van-tabs-bottom-bar-width);height:var(--van-tabs-bottom-bar-height);background:var(--van-tabs-bottom-bar-color);border-radius:var(--van-tabs-bottom-bar-height)}.van-tabs__track{position:relative;display:flex;width:100%;height:100%;will-change:left}.van-tabs__content--animated{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--van-tabs-line-height)}.van-tabs--card>.van-tabs__wrap{height:var(--van-tabs-card-height)}
|
||||
124
node_modules/vant/lib/tabs/index.d.ts
generated
vendored
Normal file
124
node_modules/vant/lib/tabs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
import { TabsProps } from './Tabs';
|
||||
export declare const Tabs: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
type: {
|
||||
type: import("vue").PropType<import("./types").TabsType>;
|
||||
default: import("./types").TabsType;
|
||||
};
|
||||
color: StringConstructor;
|
||||
border: BooleanConstructor;
|
||||
sticky: BooleanConstructor;
|
||||
shrink: BooleanConstructor;
|
||||
active: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
duration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
animated: BooleanConstructor;
|
||||
ellipsis: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeable: BooleanConstructor;
|
||||
scrollspy: BooleanConstructor;
|
||||
offsetTop: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
background: StringConstructor;
|
||||
lazyRender: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
showHeader: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
lineWidth: (NumberConstructor | StringConstructor)[];
|
||||
lineHeight: (NumberConstructor | StringConstructor)[];
|
||||
beforeChange: import("vue").PropType<import("../utils").Interceptor>;
|
||||
swipeThreshold: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
titleActiveColor: StringConstructor;
|
||||
titleInactiveColor: StringConstructor;
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("scroll" | "change" | "rendered" | "clickTab" | "update:active")[], "scroll" | "change" | "rendered" | "clickTab" | "update:active", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
type: {
|
||||
type: import("vue").PropType<import("./types").TabsType>;
|
||||
default: import("./types").TabsType;
|
||||
};
|
||||
color: StringConstructor;
|
||||
border: BooleanConstructor;
|
||||
sticky: BooleanConstructor;
|
||||
shrink: BooleanConstructor;
|
||||
active: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
duration: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
animated: BooleanConstructor;
|
||||
ellipsis: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
swipeable: BooleanConstructor;
|
||||
scrollspy: BooleanConstructor;
|
||||
offsetTop: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
background: StringConstructor;
|
||||
lazyRender: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
showHeader: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
lineWidth: (NumberConstructor | StringConstructor)[];
|
||||
lineHeight: (NumberConstructor | StringConstructor)[];
|
||||
beforeChange: import("vue").PropType<import("../utils").Interceptor>;
|
||||
swipeThreshold: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: number;
|
||||
};
|
||||
titleActiveColor: StringConstructor;
|
||||
titleInactiveColor: StringConstructor;
|
||||
}>> & Readonly<{
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
onScroll?: ((...args: any[]) => any) | undefined;
|
||||
onRendered?: ((...args: any[]) => any) | undefined;
|
||||
onClickTab?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:active"?: ((...args: any[]) => any) | undefined;
|
||||
}>, {
|
||||
type: import("./types").TabsType;
|
||||
ellipsis: boolean;
|
||||
sticky: boolean;
|
||||
border: boolean;
|
||||
active: string | number;
|
||||
duration: string | number;
|
||||
lazyRender: boolean;
|
||||
offsetTop: string | number;
|
||||
animated: boolean;
|
||||
swipeable: boolean;
|
||||
shrink: boolean;
|
||||
scrollspy: boolean;
|
||||
showHeader: boolean;
|
||||
swipeThreshold: string | number;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default Tabs;
|
||||
export { tabsProps } from './Tabs';
|
||||
export type { TabsProps };
|
||||
export type { TabsType, TabsInstance, TabsThemeVars } from './types';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
VanTabs: typeof Tabs;
|
||||
}
|
||||
}
|
||||
39
node_modules/vant/lib/tabs/index.js
generated
vendored
Normal file
39
node_modules/vant/lib/tabs/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
Tabs: () => Tabs,
|
||||
default: () => stdin_default,
|
||||
tabsProps: () => import_Tabs2.tabsProps
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_utils = require("../utils");
|
||||
var import_Tabs = __toESM(require("./Tabs"));
|
||||
var import_Tabs2 = require("./Tabs");
|
||||
const Tabs = (0, import_utils.withInstall)(import_Tabs.default);
|
||||
var stdin_default = Tabs;
|
||||
1
node_modules/vant/lib/tabs/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/lib/tabs/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
4
node_modules/vant/lib/tabs/style/index.js
generated
vendored
Normal file
4
node_modules/vant/lib/tabs/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
require("../../style/base.css");
|
||||
require("../../sticky/index.css");
|
||||
require("../../swipe/index.css");
|
||||
require("../index.css");
|
||||
39
node_modules/vant/lib/tabs/types.d.ts
generated
vendored
Normal file
39
node_modules/vant/lib/tabs/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { ComponentPublicInstance, ComputedRef } from 'vue';
|
||||
import type { Numeric } from '../utils';
|
||||
import type { TabsProps } from './Tabs';
|
||||
export type TabsType = 'line' | 'card';
|
||||
export type TabsClickTabEventParams = {
|
||||
name: Numeric;
|
||||
title: string;
|
||||
event: MouseEvent;
|
||||
disabled: boolean;
|
||||
};
|
||||
export type TabsProvide = {
|
||||
id: string;
|
||||
props: TabsProps;
|
||||
setLine: () => void;
|
||||
scrollable: ComputedRef<boolean>;
|
||||
onRendered: (name: Numeric, title?: string) => void;
|
||||
currentName: ComputedRef<Numeric | undefined>;
|
||||
setTitleRefs: (index: number) => (el: unknown) => void;
|
||||
scrollIntoView: (immediate?: boolean) => void;
|
||||
};
|
||||
export type TabsExpose = {
|
||||
resize: () => void;
|
||||
scrollTo: (name: Numeric) => void;
|
||||
};
|
||||
export type TabsInstance = ComponentPublicInstance<TabsProps, TabsExpose>;
|
||||
export type TabsThemeVars = {
|
||||
tabTextColor?: string;
|
||||
tabActiveTextColor?: string;
|
||||
tabDisabledTextColor?: string;
|
||||
tabFontSize?: string;
|
||||
tabLineHeight?: number | string;
|
||||
tabsDefaultColor?: string;
|
||||
tabsLineHeight?: number | string;
|
||||
tabsCardHeight?: string;
|
||||
tabsNavBackground?: string;
|
||||
tabsBottomBarWidth?: string;
|
||||
tabsBottomBarHeight?: string;
|
||||
tabsBottomBarColor?: string;
|
||||
};
|
||||
15
node_modules/vant/lib/tabs/types.js
generated
vendored
Normal file
15
node_modules/vant/lib/tabs/types.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
3
node_modules/vant/lib/tabs/utils.d.ts
generated
vendored
Normal file
3
node_modules/vant/lib/tabs/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { ScrollElement } from '../utils';
|
||||
export declare function scrollLeftTo(scroller: HTMLElement, to: number, duration: number): () => void;
|
||||
export declare function scrollTopTo(scroller: ScrollElement, to: number, duration: number, callback: () => void): () => void;
|
||||
68
node_modules/vant/lib/tabs/utils.js
generated
vendored
Normal file
68
node_modules/vant/lib/tabs/utils.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
scrollLeftTo: () => scrollLeftTo,
|
||||
scrollTopTo: () => scrollTopTo
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_use = require("@vant/use");
|
||||
var import_utils = require("../utils");
|
||||
function scrollLeftTo(scroller, to, duration) {
|
||||
let rafId;
|
||||
let count = 0;
|
||||
const from = scroller.scrollLeft;
|
||||
const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
|
||||
let scrollLeft = from;
|
||||
function cancel() {
|
||||
(0, import_use.cancelRaf)(rafId);
|
||||
}
|
||||
function animate() {
|
||||
scrollLeft += (to - from) / frames;
|
||||
scroller.scrollLeft = scrollLeft;
|
||||
if (++count < frames) {
|
||||
rafId = (0, import_use.raf)(animate);
|
||||
}
|
||||
}
|
||||
animate();
|
||||
return cancel;
|
||||
}
|
||||
function scrollTopTo(scroller, to, duration, callback) {
|
||||
let rafId;
|
||||
let current = (0, import_utils.getScrollTop)(scroller);
|
||||
const isDown = current < to;
|
||||
const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
|
||||
const step = (to - current) / frames;
|
||||
function cancel() {
|
||||
(0, import_use.cancelRaf)(rafId);
|
||||
}
|
||||
function animate() {
|
||||
current += step;
|
||||
if (isDown && current > to || !isDown && current < to) {
|
||||
current = to;
|
||||
}
|
||||
(0, import_utils.setScrollTop)(scroller, current);
|
||||
if (isDown && current < to || !isDown && current > to) {
|
||||
rafId = (0, import_use.raf)(animate);
|
||||
} else if (callback) {
|
||||
rafId = (0, import_use.raf)(callback);
|
||||
}
|
||||
}
|
||||
animate();
|
||||
return cancel;
|
||||
}
|
||||
Reference in New Issue
Block a user