From e3c0ee65ec7b7239c044a84dd1b5415c573d3661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bahad=C4=B1r=20Sofuo=C4=9Flu?= Date: Sat, 8 Apr 2023 02:06:45 +0300 Subject: [PATCH] Refactor #3832 Refactor #3833 - For ScrollTop --- api-generator/components/scrolltop.js | 12 ++++++++++-- components/lib/scrolltop/ScrollTop.d.ts | 9 +++++++-- components/lib/scrolltop/ScrollTop.vue | 14 ++++++++------ 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/api-generator/components/scrolltop.js b/api-generator/components/scrolltop.js index 3c694f2a3..4f59e0804 100644 --- a/api-generator/components/scrolltop.js +++ b/api-generator/components/scrolltop.js @@ -14,7 +14,7 @@ const ScrollTopProps = [ { name: 'icon', type: 'string', - default: 'pi pi-chevron-up', + default: 'undefined', description: 'Icon to display.' }, { @@ -25,10 +25,18 @@ const ScrollTopProps = [ } ]; +const ScrollTopSlots = [ + { + name: 'icon', + description: 'Custom scrolltop icon template.' + } +]; + module.exports = { scrolltop: { name: 'ScrollTop', description: 'ScrollTop gets displayed after a certain scroll position and used to navigates to the top of the page quickly.', - props: ScrollTopProps + props: ScrollTopProps, + slots: ScrollTopSlots } }; diff --git a/components/lib/scrolltop/ScrollTop.d.ts b/components/lib/scrolltop/ScrollTop.d.ts index 0cebe8d90..a6e6595ad 100644 --- a/components/lib/scrolltop/ScrollTop.d.ts +++ b/components/lib/scrolltop/ScrollTop.d.ts @@ -7,6 +7,7 @@ * @module scrolltop * */ +import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; /** @@ -25,7 +26,6 @@ export interface ScrollTopProps { threshold?: number | undefined; /** * Icon to display. - * @defaultValue pi pi-chevron-up */ icon?: string | undefined; /** @@ -38,7 +38,12 @@ export interface ScrollTopProps { /** * Defines valid slots in ScrollTop component. */ -export interface ScrollTopSlots {} +export interface ScrollTopSlots { + /** + * Custom scrolltop icon template. + */ + icon(): VNode[]; +} /** * Defines valid emits in ScrollTop component. diff --git a/components/lib/scrolltop/ScrollTop.vue b/components/lib/scrolltop/ScrollTop.vue index 59b6e2df4..63a150771 100644 --- a/components/lib/scrolltop/ScrollTop.vue +++ b/components/lib/scrolltop/ScrollTop.vue @@ -1,14 +1,16 @@