first commit
This commit is contained in:
11
node_modules/vant/es/index-anchor/IndexAnchor.d.ts
generated
vendored
Normal file
11
node_modules/vant/es/index-anchor/IndexAnchor.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { type ExtractPropTypes } from 'vue';
|
||||
export declare const indexAnchorProps: {
|
||||
index: (NumberConstructor | StringConstructor)[];
|
||||
};
|
||||
export type IndexAnchorProps = ExtractPropTypes<typeof indexAnchorProps>;
|
||||
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
||||
index: (NumberConstructor | StringConstructor)[];
|
||||
}>, (() => import("vue/jsx-runtime").JSX.Element) | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
||||
index: (NumberConstructor | StringConstructor)[];
|
||||
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
87
node_modules/vant/es/index-anchor/IndexAnchor.mjs
generated
vendored
Normal file
87
node_modules/vant/es/index-anchor/IndexAnchor.mjs
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
import { ref, reactive, computed, defineComponent, createVNode as _createVNode } from "vue";
|
||||
import { extend, numericProp, BORDER_BOTTOM, getZIndexStyle, createNamespace } from "../utils/index.mjs";
|
||||
import { INDEX_BAR_KEY } from "../index-bar/IndexBar.mjs";
|
||||
import { getScrollTop, getRootScrollTop } from "../utils/dom.mjs";
|
||||
import { useRect, useParent } from "@vant/use";
|
||||
import { useExpose } from "../composables/use-expose.mjs";
|
||||
const [name, bem] = createNamespace("index-anchor");
|
||||
const indexAnchorProps = {
|
||||
index: numericProp
|
||||
};
|
||||
var stdin_default = defineComponent({
|
||||
name,
|
||||
props: indexAnchorProps,
|
||||
setup(props, {
|
||||
slots
|
||||
}) {
|
||||
const state = reactive({
|
||||
top: 0,
|
||||
left: null,
|
||||
rect: {
|
||||
top: 0,
|
||||
height: 0
|
||||
},
|
||||
width: null,
|
||||
active: false
|
||||
});
|
||||
const root = ref();
|
||||
const {
|
||||
parent
|
||||
} = useParent(INDEX_BAR_KEY);
|
||||
if (!parent) {
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
console.error("[Vant] <IndexAnchor> must be a child component of <IndexBar>.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
const isSticky = () => state.active && parent.props.sticky;
|
||||
const anchorStyle = computed(() => {
|
||||
const {
|
||||
zIndex,
|
||||
highlightColor
|
||||
} = parent.props;
|
||||
if (isSticky()) {
|
||||
return extend(getZIndexStyle(zIndex), {
|
||||
left: state.left ? `${state.left}px` : void 0,
|
||||
width: state.width ? `${state.width}px` : void 0,
|
||||
transform: state.top ? `translate3d(0, ${state.top}px, 0)` : void 0,
|
||||
color: highlightColor
|
||||
});
|
||||
}
|
||||
});
|
||||
const getRect = (scrollParent, scrollParentRect) => {
|
||||
const rootRect = useRect(root);
|
||||
state.rect.height = rootRect.height;
|
||||
if (scrollParent === window || scrollParent === document.body) {
|
||||
state.rect.top = rootRect.top + getRootScrollTop();
|
||||
} else {
|
||||
state.rect.top = rootRect.top + getScrollTop(scrollParent) - scrollParentRect.top;
|
||||
}
|
||||
return state.rect;
|
||||
};
|
||||
useExpose({
|
||||
state,
|
||||
getRect
|
||||
});
|
||||
return () => {
|
||||
const sticky = isSticky();
|
||||
return _createVNode("div", {
|
||||
"ref": root,
|
||||
"style": {
|
||||
height: sticky ? `${state.rect.height}px` : void 0
|
||||
}
|
||||
}, [_createVNode("div", {
|
||||
"style": anchorStyle.value,
|
||||
"class": [bem({
|
||||
sticky
|
||||
}), {
|
||||
[BORDER_BOTTOM]: sticky
|
||||
}]
|
||||
}, [slots.default ? slots.default() : props.index])]);
|
||||
};
|
||||
}
|
||||
});
|
||||
export {
|
||||
stdin_default as default,
|
||||
indexAnchorProps
|
||||
};
|
||||
1
node_modules/vant/es/index-anchor/index.css
generated
vendored
Normal file
1
node_modules/vant/es/index-anchor/index.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
:root,:host{--van-index-anchor-z-index: 1;--van-index-anchor-padding: 0 var(--van-padding-md);--van-index-anchor-text-color: var(--van-text-color);--van-index-anchor-font-weight: var(--van-font-bold);--van-index-anchor-font-size: var(--van-font-size-md);--van-index-anchor-line-height: 32px;--van-index-anchor-background: transparent;--van-index-anchor-sticky-text-color: var(--van-primary-color);--van-index-anchor-sticky-background: var(--van-background-2)}.van-index-anchor{z-index:var(--van-index-anchor-z-index);box-sizing:border-box;padding:var(--van-index-anchor-padding);color:var(--van-index-anchor-text-color);font-weight:var(--van-index-anchor-font-weight);font-size:var(--van-index-anchor-font-size);line-height:var(--van-index-anchor-line-height);background:var(--van-index-anchor-background)}.van-index-anchor--sticky{position:fixed;top:0;right:0;left:0;color:var(--van-index-anchor-sticky-text-color);background:var(--van-index-anchor-sticky-background)}
|
||||
14
node_modules/vant/es/index-anchor/index.d.ts
generated
vendored
Normal file
14
node_modules/vant/es/index-anchor/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export declare const IndexAnchor: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
index: (NumberConstructor | StringConstructor)[];
|
||||
}>, (() => import("vue/jsx-runtime").JSX.Element) | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
index: (NumberConstructor | StringConstructor)[];
|
||||
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default IndexAnchor;
|
||||
export { indexAnchorProps } from './IndexAnchor';
|
||||
export type { IndexAnchorProps } from './IndexAnchor';
|
||||
export type { IndexAnchorThemeVars } from './types';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
VanIndexAnchor: typeof IndexAnchor;
|
||||
}
|
||||
}
|
||||
10
node_modules/vant/es/index-anchor/index.mjs
generated
vendored
Normal file
10
node_modules/vant/es/index-anchor/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { withInstall } from "../utils/index.mjs";
|
||||
import _IndexAnchor from "./IndexAnchor.mjs";
|
||||
const IndexAnchor = withInstall(_IndexAnchor);
|
||||
var stdin_default = IndexAnchor;
|
||||
import { indexAnchorProps } from "./IndexAnchor.mjs";
|
||||
export {
|
||||
IndexAnchor,
|
||||
stdin_default as default,
|
||||
indexAnchorProps
|
||||
};
|
||||
1
node_modules/vant/es/index-anchor/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/es/index-anchor/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
3
node_modules/vant/es/index-anchor/style/index.mjs
generated
vendored
Normal file
3
node_modules/vant/es/index-anchor/style/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import "../../style/base.css";
|
||||
import "../../index-bar/index.css";
|
||||
import "../index.css";
|
||||
11
node_modules/vant/es/index-anchor/types.d.ts
generated
vendored
Normal file
11
node_modules/vant/es/index-anchor/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export type IndexAnchorThemeVars = {
|
||||
indexAnchorZIndex?: number | string;
|
||||
indexAnchorPadding?: string;
|
||||
indexAnchorTextColor?: string;
|
||||
indexAnchorFontWeight?: string;
|
||||
indexAnchorFontSize?: string;
|
||||
indexAnchorLineHeight?: number | string;
|
||||
indexAnchorBackground?: string;
|
||||
indexAnchorStickyTextColor?: string;
|
||||
indexAnchorStickyBackground?: string;
|
||||
};
|
||||
0
node_modules/vant/es/index-anchor/types.mjs
generated
vendored
Normal file
0
node_modules/vant/es/index-anchor/types.mjs
generated
vendored
Normal file
Reference in New Issue
Block a user