Refactor #3797 - Fieldset updates

This commit is contained in:
Tuğçe Küçükoğlu 2023-03-24 18:07:46 +03:00
parent 1ccf0f13b9
commit 02307960ec
3 changed files with 96 additions and 9 deletions

View file

@ -10,6 +10,16 @@
import { AnchorHTMLAttributes, VNode } from 'vue';
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
export declare type FieldsetPassThroughOptionType = FieldsetPassThroughAttributes | ((options: FieldsetPassThroughMethodOptions) => FieldsetPassThroughAttributes) | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface FieldsetPassThroughMethodOptions {
props: FieldsetProps;
state: FieldsetState;
}
/**
* Custom toggle event.
* @see {@link FieldsetEmits.toggle}
@ -25,6 +35,59 @@ export interface FieldsetToggleEvent {
value: boolean;
}
/**
* Custom passthrough(pt) options.
* @see {@link FieldsetProps.pt}
*/
export interface FieldsetPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the legend's DOM element.
*/
legend?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the legend title's DOM element.
*/
legendtitle?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the toggler's DOM element.
*/
toggler?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the toggler icon's DOM element.
*/
togglericon?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the toggleable content's DOM element.
*/
toggleablecontent?: FieldsetPassThroughOptionType;
/**
* Uses to pass attributes to the content's DOM element.
*/
content?: FieldsetPassThroughOptionType;
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface FieldsetPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Fieldset component.
*/
export interface FieldsetState {
/**
* Current collapsed state as a boolean.
* @defaultValue false
*/
d_collapsed: boolean;
}
/**
* Defines valid properties in Fieldset component.
*/
@ -45,8 +108,14 @@ export interface FieldsetProps {
collapsed?: boolean | undefined;
/**
* Uses to pass the custom value to read for the AnchorHTMLAttributes inside the component.
* @deprecated since v3.26.0. Use 'pt' property instead.
*/
toggleButtonProps?: AnchorHTMLAttributes | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {FieldsetPassThroughOptions}
*/
pt?: FieldsetPassThroughOptions;
}
/**
@ -61,6 +130,10 @@ export interface FieldsetSlots {
* Custom legend template.
*/
legend: () => VNode[];
/**
* Custom toggler icon template.
*/
togglericon: () => VNode[];
}
/**