primevue-mirror/components/lib/panel/Panel.d.ts

245 lines
5.9 KiB
TypeScript
Raw Normal View History

2023-02-28 17:39:21 +00:00
/**
*
* Panel is a container with the optional content toggle feature.
*
* [Live Demo](https://www.primevue.org/panel/)
*
* @module panel
*
*/
2023-08-02 14:07:22 +00:00
import { ButtonHTMLAttributes, TransitionProps, VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type PanelPassThroughOptionType = PanelPassThroughAttributes | ((options: PanelPassThroughMethodOptions) => PanelPassThroughAttributes | string) | string | null | undefined;
2023-08-02 14:07:22 +00:00
export declare type PanelPassThroughTransitionType = TransitionProps | ((options: PanelPassThroughMethodOptions) => TransitionProps) | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface PanelPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
props: PanelProps;
/**
* Defines current inline state.
*/
state: PanelState;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
}
2023-03-21 15:53:39 +00:00
2023-02-28 17:39:21 +00:00
/**
* Custom toggle event.
2023-03-06 20:35:39 +00:00
* @see {@link PanelEmits.toggle}
2023-02-28 17:39:21 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface PanelToggleEvent {
/**
* Browser event.
*/
originalEvent: Event;
/**
* Collapsed state as a boolean
*/
value: boolean;
}
2023-03-21 15:53:39 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link PanelProps.pt}
*/
export interface PanelPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-03-21 15:53:39 +00:00
*/
root?: PanelPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the header's DOM element.
2023-03-21 15:53:39 +00:00
*/
header?: PanelPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the title's DOM element.
2023-03-21 15:53:39 +00:00
*/
title?: PanelPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the icons' DOM element.
2023-03-21 15:53:39 +00:00
*/
icons?: PanelPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the toggler's DOM element.
2023-03-21 15:53:39 +00:00
*/
toggler?: PanelPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the togglericon's DOM element.
2023-03-21 15:53:39 +00:00
*/
2023-04-19 08:00:52 +00:00
togglerIcon?: PanelPassThroughOptionType;
2023-03-21 15:53:39 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the toggleablecontent's DOM element.
2023-03-21 15:53:39 +00:00
*/
2023-04-19 08:00:52 +00:00
toggleableContent?: PanelPassThroughOptionType;
2023-03-21 15:53:39 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the content's DOM element.
2023-03-21 15:53:39 +00:00
*/
content?: PanelPassThroughOptionType;
2023-03-31 13:42:19 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the footer's DOM element.
2023-03-31 13:42:19 +00:00
*/
footer?: PanelPassThroughOptionType;
2023-08-02 14:07:22 +00:00
/**
* Used to control Vue Transition API.
*/
transition?: PanelPassThroughTransitionType;
2023-07-06 11:09:01 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to manage all lifecycle hooks
2023-07-06 11:09:01 +00:00
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
2023-03-21 15:53:39 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface PanelPassThroughAttributes {
[key: string]: any;
}
/**
2023-03-21 15:54:36 +00:00
* Defines current inline state in Panel component.
2023-03-21 15:53:39 +00:00
*/
export interface PanelState {
/**
2023-03-24 15:06:26 +00:00
* Current collapsed state as a boolean.
* @defaultValue false
2023-03-21 15:53:39 +00:00
*/
d_collapsed: boolean;
}
2023-02-28 17:39:21 +00:00
/**
* Defines valid properties in Panel component.
*/
2022-09-06 12:03:37 +00:00
export interface PanelProps {
/**
* Header text of the panel.
*/
header?: string;
/**
* Defines if content of panel can be expanded and collapsed.
2023-03-10 14:00:58 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
toggleable?: boolean;
/**
* Defines the initial state of panel content.
2023-03-10 14:00:58 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
collapsed?: boolean;
2022-09-14 11:26:01 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass the custom value to read for the button inside the component.
2023-03-21 17:20:54 +00:00
* @deprecated since v3.26.0. Use 'pt' property instead.
2022-09-14 11:26:01 +00:00
*/
2022-12-08 11:04:25 +00:00
toggleButtonProps?: ButtonHTMLAttributes | undefined;
2023-03-21 15:53:39 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-03-21 15:53:39 +00:00
* @type {PanelPassThroughOptions}
*/
pt?: PassThrough<PanelPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-16 10:43:21 +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-02-28 17:39:21 +00:00
/**
* Defines valid slots in Panel slots.
*/
2022-09-06 12:03:37 +00:00
export interface PanelSlots {
/**
* Custom content template.
*/
2023-02-28 17:39:21 +00:00
default(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom header template.
2023-08-17 07:16:25 +00:00
* @param {Object} scope - header slot's params.
2022-09-06 12:03:37 +00:00
*/
header(scope: {
/**
* Current id state as a string
*/
id: string;
/**
* Style class of the icon
*/
class: string;
}): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom icons template.
*/
2023-02-28 17:39:21 +00:00
icons(): VNode[];
2023-03-21 15:53:39 +00:00
/**
2023-04-05 08:07:25 +00:00
* Custom toggler icon template of panel.
* @param {Object} scope - toggler icon slot's params.
2023-03-21 15:53:39 +00:00
*/
2023-04-05 08:07:25 +00:00
togglericon(scope: {
2023-03-21 15:53:39 +00:00
/**
* Collapsed state as a boolean
*/
collapsed: boolean;
}): VNode[];
2023-03-31 13:43:48 +00:00
/**
2023-03-31 13:42:19 +00:00
* Custom footer template.
*/
2023-03-31 13:43:48 +00:00
footer(): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-02-28 17:39:21 +00:00
/**
* Defines valid emits in Panel component.
*/
export interface PanelEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the collapsed changes.
* @param {boolean} value - New value.
*/
2023-03-17 13:42:11 +00:00
'update:collapsed'(value: boolean): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a tab toggle.
* @param {PanelToggleEvent} event - Custom toggle event.
*/
2023-03-17 13:42:11 +00:00
toggle(event: PanelToggleEvent): void;
2023-02-28 17:39:21 +00:00
}
2022-09-06 12:03:37 +00:00
2023-02-28 17:39:21 +00:00
/**
* **PrimeVue - Panel**
*
* _Panel is a container with the optional content toggle feature._
*
* [Live Demo](https://www.primevue.org/panel/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-02-28 17:39:21 +00:00
*
* @group Component
*
*/
2023-03-01 12:30:54 +00:00
declare class Panel extends ClassComponent<PanelProps, PanelSlots, PanelEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Panel: GlobalComponentConstructor<Panel>;
2022-09-06 12:03:37 +00:00
}
}
export default Panel;