2023-03-01 13:12:34 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* ScrollTop gets displayed after a certain scroll position and used to navigates to the top of the page quickly.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/scrolltop/)
|
|
|
|
*
|
|
|
|
* @module scrolltop
|
|
|
|
*
|
|
|
|
*/
|
2023-04-07 23:06:45 +00:00
|
|
|
import { VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
|
|
|
2023-04-21 13:42:00 +00:00
|
|
|
export declare type ScrollTopPassThroughOptionType = ScrollTopPassThroughAttributes | ((options: ScrollTopPassThroughMethodOptions) => ScrollTopPassThroughAttributes) | null | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface ScrollTopPassThroughMethodOptions {
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-04-21 13:42:00 +00:00
|
|
|
props: ScrollTopProps;
|
|
|
|
state: ScrollTopState;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link ScrollTopProps.pt}
|
|
|
|
*/
|
|
|
|
export interface ScrollTopPassThroughOptions {
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the root's DOM element.
|
|
|
|
*/
|
|
|
|
root?: ScrollTopPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the icon's DOM element.
|
|
|
|
*/
|
|
|
|
icon?: ScrollTopPassThroughOptionType;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
|
|
|
* Uses to manage all lifecycle hooks
|
|
|
|
* @see {@link BaseComponent.ComponentHooks}
|
|
|
|
*/
|
|
|
|
hooks?: ComponentHooks;
|
2023-04-21 13:42:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface ScrollTopPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in ScrollTop component.
|
|
|
|
*/
|
|
|
|
export interface ScrollTopState {
|
|
|
|
/**
|
|
|
|
* Current visible state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
visible: boolean;
|
|
|
|
}
|
|
|
|
|
2023-03-01 13:12:34 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in ScrollTop component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface ScrollTopProps {
|
|
|
|
/**
|
|
|
|
* Target of the ScrollTop.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue window
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 13:12:34 +00:00
|
|
|
target?: 'window' | 'parent' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Defines the threshold value of the vertical scroll position of the target to toggle the visibility.
|
2023-03-01 13:12:34 +00:00
|
|
|
* @defaultValue 400
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
threshold?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display.
|
2023-04-18 13:42:36 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'icon' slot.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
icon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Defines the scrolling behaviour, 'smooth' adds an animation and 'auto' scrolls with a jump.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue smooth
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
behavior?: string | undefined;
|
2023-04-21 13:42:00 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to DOM elements inside the component.
|
|
|
|
* @type {ScrollTopPassThroughOptions}
|
|
|
|
*/
|
|
|
|
pt?: ScrollTopPassThroughOptions;
|
2023-05-24 10:09:45 +00:00
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 13:12:34 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in ScrollTop component.
|
|
|
|
*/
|
2023-04-07 23:06:45 +00:00
|
|
|
export interface ScrollTopSlots {
|
|
|
|
/**
|
|
|
|
* Custom scrolltop icon template.
|
|
|
|
*/
|
|
|
|
icon(): VNode[];
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 13:12:34 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in ScrollTop component.
|
|
|
|
*/
|
|
|
|
export interface ScrollTopEmits {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 13:12:34 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - ScrollTop**
|
|
|
|
*
|
|
|
|
* _ScrollTop gets displayed after a certain scroll position and used to navigates to the top of the page quickly._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/scrolltop/)
|
|
|
|
* --- ---
|
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class ScrollTop extends ClassComponent<ScrollTopProps, ScrollTopSlots, ScrollTopEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
ScrollTop: GlobalComponentConstructor<ScrollTop>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ScrollTop;
|