diff --git a/api-generator/components/scrolltop.js b/api-generator/components/scrolltop.js index 4f59e0804..4dfc7beb1 100644 --- a/api-generator/components/scrolltop.js +++ b/api-generator/components/scrolltop.js @@ -22,6 +22,12 @@ const ScrollTopProps = [ type: 'string', default: 'smooth', description: 'Defines the scrolling behavi, "smooth" adds an animation and "auto" scrolls with a jump.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/scrolltop/ScrollTop.d.ts b/components/lib/scrolltop/ScrollTop.d.ts index dcb696f5d..bc65e65d2 100644 --- a/components/lib/scrolltop/ScrollTop.d.ts +++ b/components/lib/scrolltop/ScrollTop.d.ts @@ -10,6 +10,49 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type ScrollTopPassThroughOptionType = ScrollTopPassThroughAttributes | ((options: ScrollTopPassThroughMethodOptions) => ScrollTopPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface ScrollTopPassThroughMethodOptions { + 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; +} + +/** + * 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; +} + /** * Defines valid properties in ScrollTop component. */ @@ -34,6 +77,11 @@ export interface ScrollTopProps { * @defaultValue smooth */ behavior?: string | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {ScrollTopPassThroughOptions} + */ + pt?: ScrollTopPassThroughOptions; } /** diff --git a/components/lib/scrolltop/ScrollTop.vue b/components/lib/scrolltop/ScrollTop.vue index b4aae9c96..3e12a1e7d 100644 --- a/components/lib/scrolltop/ScrollTop.vue +++ b/components/lib/scrolltop/ScrollTop.vue @@ -1,18 +1,21 @@