From f41d29d44e6f978a26f4e95d85d4f53baecfa7d8 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 1 Dec 2021 16:38:36 +0300 Subject: [PATCH] Fixed #1836 - For Fieldset --- src/components/fieldset/Fieldset.d.ts | 74 +++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 11 deletions(-) diff --git a/src/components/fieldset/Fieldset.d.ts b/src/components/fieldset/Fieldset.d.ts index 33ceffd1b..486f0757f 100755 --- a/src/components/fieldset/Fieldset.d.ts +++ b/src/components/fieldset/Fieldset.d.ts @@ -1,19 +1,71 @@ import { VNode } from 'vue'; +import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; -interface FieldsetProps { - legend?: string; - toggleable?: boolean; - collapsed?: boolean; +export interface FieldsetToggleEvent { + /** + * Browser event. + */ + originalEvent: Event; + /** + * Collapsed state as a boolean + */ + value: boolean; } -declare class Fieldset { - $props: FieldsetProps; - $emit(eventName: 'update:collapsed', value: boolean): this; - $emit(eventName: 'toggle', e: { originalEvent: Event, value: boolean }): this; - $slots: { - '': VNode[]; - legend: VNode[]; +export interface FieldsetProps { + /** + * Header text of the fieldset. + */ + legend?: string | undefined; + /** + * When specified, content can toggled by clicking the legend. + */ + toggleable?: boolean | undefined; + /** + * Defines the default visibility state of the content. + */ + collapsed?: boolean | undefined; +} + +export interface FieldsetSlots { + /** + * Default content slot. + */ + default: () => VNode[]; + /** + * Custom legend template. + */ + legend: () => VNode[]; +} + +export declare type FieldsetEmits = { + /** + * Emitted when the collapsed changes. + * @param {boolean} value - New value. + */ + 'update:collapsed': (value: boolean) => void; + /** + * Callback to invoke when a tab gets expanded or collapsed. + * @param {FieldsetToggleEvent} event - Custom toggle event. + */ + 'toggle': (event: FieldsetToggleEvent) => void; +} + +declare class Fieldset extends ClassComponent { } + +declare module '@vue/runtime-core' { + interface GlobalComponents { + Fieldset: GlobalComponentConstructor
} } +/** + * + * Fieldset is a grouping component with the optional content toggle feature. + * + * Demos: + * + * - [Fieldset](https://www.primefaces.org/primevue/showcase/#/fieldset) + * + */ export default Fieldset;