2024-04-18 14:19:35 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Drawer is a panel component displayed as an overlay at the edges of the screen.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://primevue.org/drawer)
|
|
|
|
*
|
|
|
|
* @module drawer
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
import { TransitionProps, VNode } from 'vue';
|
|
|
|
import { ComponentHooks } from '../basecomponent';
|
|
|
|
import { ButtonPassThroughOptions } from '../button';
|
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2024-05-16 10:50:43 +00:00
|
|
|
import { DefineComponent, DesignToken, EmitFn, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2024-04-18 14:19:35 +00:00
|
|
|
|
|
|
|
export declare type DrawerPassThroughOptionType = DrawerPassThroughAttributes | ((options: DrawerPassThroughMethodOptions) => DrawerPassThroughAttributes | string) | string | null | undefined;
|
|
|
|
|
|
|
|
export declare type DrawerPassThroughTransitionType = TransitionProps | ((options: DrawerPassThroughMethodOptions) => TransitionProps) | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface DrawerPassThroughMethodOptions {
|
|
|
|
/**
|
|
|
|
* Defines instance.
|
|
|
|
*/
|
|
|
|
instance: any;
|
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
|
|
|
props: DrawerProps;
|
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
|
|
|
state: DrawerState;
|
|
|
|
/**
|
|
|
|
* Defines valid attributes.
|
|
|
|
*/
|
|
|
|
attrs: any;
|
|
|
|
/**
|
|
|
|
* Defines parent options.
|
|
|
|
*/
|
|
|
|
parent: any;
|
|
|
|
/**
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom shared passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface DrawerSharedPassThroughMethodOptions {
|
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
|
|
|
props: DrawerProps;
|
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
|
|
|
state: DrawerState;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link DrawerProps.pt}
|
|
|
|
*/
|
|
|
|
export interface DrawerPassThroughOptions {
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2024-04-18 14:19:35 +00:00
|
|
|
*/
|
|
|
|
root?: DrawerPassThroughOptionType;
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the header's DOM element.
|
2024-04-18 14:19:35 +00:00
|
|
|
*/
|
|
|
|
header?: DrawerPassThroughOptionType;
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the header content's DOM element.
|
2024-04-18 14:19:35 +00:00
|
|
|
*/
|
|
|
|
title?: DrawerPassThroughOptionType;
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the close button's DOM element.
|
2024-04-18 14:19:35 +00:00
|
|
|
* @see {@link ButtonPassThroughOptions}
|
|
|
|
*/
|
2024-05-06 15:23:01 +00:00
|
|
|
pcCloseButton?: ButtonPassThroughOptions<DrawerSharedPassThroughMethodOptions>;
|
2024-04-18 14:19:35 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the content's DOM element.
|
2024-04-18 14:19:35 +00:00
|
|
|
*/
|
|
|
|
content?: DrawerPassThroughOptionType;
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the mask's DOM element.
|
2024-04-18 14:19:35 +00:00
|
|
|
*/
|
|
|
|
mask?: DrawerPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Used to manage all lifecycle hooks.
|
|
|
|
* @see {@link BaseComponent.ComponentHooks}
|
|
|
|
*/
|
|
|
|
hooks?: ComponentHooks;
|
|
|
|
/**
|
|
|
|
* Used to control Vue Transition API.
|
|
|
|
*/
|
|
|
|
transition?: DrawerPassThroughTransitionType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface DrawerPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in Drawer component.
|
|
|
|
*/
|
|
|
|
export interface DrawerState {
|
|
|
|
/**
|
|
|
|
* Current container visible state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
containerVisible: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines valid properties in Drawer component.
|
|
|
|
*/
|
|
|
|
export interface DrawerProps {
|
|
|
|
/**
|
|
|
|
* Specifies the visibility of the dialog.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
visible?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Specifies the position of the drawer.
|
|
|
|
* @defaultValue left
|
|
|
|
*/
|
|
|
|
position?: 'left' | 'right' | 'top' | 'bottom' | 'full' | undefined;
|
|
|
|
/**
|
|
|
|
* Title content of the dialog.
|
|
|
|
*/
|
|
|
|
header?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Base zIndex value to use in layering.
|
|
|
|
* @defaultValue 0
|
|
|
|
*/
|
|
|
|
baseZIndex?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to automatically manage layering.
|
|
|
|
* @defaultValue true
|
|
|
|
*/
|
|
|
|
autoZIndex?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Whether clicking outside closes the panel.
|
|
|
|
* @defaultValue true
|
|
|
|
*/
|
|
|
|
dismissable?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to display a close icon inside the panel.
|
|
|
|
* @defaultValue true
|
|
|
|
*/
|
|
|
|
showCloseIcon?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Used to pass the custom value to read for the button inside the component.
|
|
|
|
* @defaultValue { severity: 'secondary', text: true, rounded: true }
|
|
|
|
*/
|
|
|
|
closeButtonProps?: object | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to display in the drawer close button.
|
|
|
|
* @deprecated since v3.27.0. Use 'closeicon' slot.
|
|
|
|
*/
|
|
|
|
closeIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to a modal layer behind the drawer.
|
|
|
|
* @defaultValue true
|
|
|
|
*/
|
|
|
|
modal?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Whether background scroll should be blocked when drawer is visible.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
blockScroll?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* It generates scoped CSS variables using design tokens for the component.
|
|
|
|
*/
|
|
|
|
dt?: DesignToken<any>;
|
|
|
|
/**
|
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
|
|
|
* @type {DrawerPassThroughOptions}
|
|
|
|
*/
|
|
|
|
pt?: PassThrough<DrawerPassThroughOptions>;
|
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines valid slots in Drawer component.
|
|
|
|
*/
|
|
|
|
export interface DrawerSlots {
|
|
|
|
/**
|
|
|
|
* Custom content template.
|
|
|
|
*/
|
|
|
|
default(): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom header template.
|
|
|
|
* @param {Object} scope - header slot's params.
|
|
|
|
*/
|
|
|
|
header(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the header title
|
|
|
|
*/
|
|
|
|
class: any;
|
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom close icon template.
|
|
|
|
* @param {Object} scope - close icon slot's params.
|
|
|
|
*/
|
|
|
|
closeicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the close icon
|
|
|
|
*/
|
|
|
|
class: any;
|
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom container slot.
|
|
|
|
* @param {Object} scope - container slot's params.
|
|
|
|
*/
|
|
|
|
container(scope: {
|
|
|
|
/**
|
|
|
|
* Close drawer function.
|
|
|
|
* @deprecated since v3.39.0. Use 'closeCallback' property instead.
|
|
|
|
*/
|
|
|
|
onClose: () => void;
|
|
|
|
/**
|
|
|
|
* Close drawer function.
|
|
|
|
*/
|
|
|
|
closeCallback: () => void;
|
|
|
|
}): VNode[];
|
2024-05-09 12:42:08 +00:00
|
|
|
/**
|
|
|
|
* Custom footer template.
|
|
|
|
*/
|
|
|
|
footer(): VNode[];
|
2024-04-18 14:19:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines valid emits in Drawer component.
|
|
|
|
*/
|
2024-05-16 10:50:43 +00:00
|
|
|
interface DrawerEmitsOptions {
|
2024-04-18 14:19:35 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the value changes.
|
|
|
|
* @param {boolean} value - New value.
|
|
|
|
*/
|
|
|
|
'update:modelValue'(value: boolean): void;
|
|
|
|
/**
|
|
|
|
* Callback to invoke when drawer gets shown.
|
|
|
|
*/
|
|
|
|
show(): void;
|
|
|
|
/**
|
|
|
|
* Callback to invoke when drawer gets hidden.
|
|
|
|
*/
|
|
|
|
hide(): void;
|
|
|
|
}
|
|
|
|
|
2024-05-16 10:50:43 +00:00
|
|
|
export declare type DrawerEmits = EmitFn<DrawerEmitsOptions>;
|
|
|
|
|
2024-04-18 14:19:35 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Drawer**
|
|
|
|
*
|
|
|
|
* _Drawer is a panel component displayed as an overlay._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/drawer/)
|
|
|
|
* --- ---
|
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
|
|
|
*
|
|
|
|
* @group Component
|
2024-05-16 10:50:43 +00:00
|
|
|
*
|
2024-04-18 14:19:35 +00:00
|
|
|
*/
|
2024-05-16 10:50:43 +00:00
|
|
|
declare const Drawer: DefineComponent<DrawerProps, DrawerSlots, DrawerEmits>;
|
2024-04-18 14:19:35 +00:00
|
|
|
|
|
|
|
declare module 'vue' {
|
|
|
|
export interface GlobalComponents {
|
2024-05-16 10:50:43 +00:00
|
|
|
Drawer: GlobalComponentConstructor<DrawerProps, DrawerSlots, DrawerEmits>;
|
2024-04-18 14:19:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Drawer;
|