primevue-mirror/components/lib/overlaypanel/OverlayPanel.d.ts

282 lines
7.3 KiB
TypeScript
Raw Normal View History

2023-03-01 10:19:01 +00:00
/**
*
* OverlayPanel is a container component positioned as connected to its target.
*
2023-03-03 14:17:03 +00:00
* [Live Demo](https://primevue.org/overlaypanel)
2023-03-01 10:19:01 +00:00
*
* @module overlaypanel
*
*/
2023-08-02 14:07:22 +00:00
import { 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, HintedString } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type OverlayPanelPassThroughOptionType = OverlayPanelPassThroughAttributes | ((options: OverlayPanelPassThroughMethodOptions) => OverlayPanelPassThroughAttributes | string) | string | null | undefined;
2023-04-24 11:44:13 +00:00
2023-08-02 14:07:22 +00:00
export declare type OverlayPanelPassThroughTransitionType = TransitionProps | ((options: OverlayPanelPassThroughMethodOptions) => TransitionProps) | undefined;
2023-04-24 11:44:13 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface OverlayPanelPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-04-24 11:44:13 +00:00
props: OverlayPanelProps;
/**
* Defines current inline state.
*/
2023-04-24 11:44:13 +00:00
state: OverlayPanelState;
/**
* Defines valid attributes.
*/
attrs: any;
/**
* Defines parent options.
*/
parent: any;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-04-24 11:44:13 +00:00
}
/**
* Custom passthrough(pt) options.
* @see {@link OverlayPanelProps.pt}
*/
export interface OverlayPanelPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-04-24 11:44:13 +00:00
*/
root?: OverlayPanelPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the content's DOM element.
2023-04-24 11:44:13 +00:00
*/
content?: OverlayPanelPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the close button's DOM element.
2023-04-24 11:44:13 +00:00
*/
closeButton?: OverlayPanelPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the close icon's DOM element.
2023-04-24 11:44:13 +00:00
*/
closeIcon?: OverlayPanelPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
2023-11-07 06:16:39 +00:00
* Used to manage all lifecycle hooks.
2023-07-06 11:09:01 +00:00
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
2023-08-02 12:01:58 +00:00
/**
* Used to control Vue Transition API.
*/
2023-08-02 14:07:22 +00:00
transition?: OverlayPanelPassThroughTransitionType;
2023-04-24 11:44:13 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface OverlayPanelPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in OverlayPanel component.
*/
export interface OverlayPanelState {
/**
* Current visible state as a boolean.
* @defaultValue false
*/
visible: boolean;
}
2023-03-01 10:19:01 +00:00
/**
* OverlayPanel breakpoint metadata.
*/
2022-09-06 12:03:37 +00:00
export interface OverlayPanelBreakpoints {
/**
* Breakpoint for responsive mode.
*
* Example:
*
* <OverlayPanel :breakpoints="{'960px': '75vw', '640px': '100vw'}" ... />
*
* Result:
*
* @media screen and (max-width: ${breakpoint[key]}) {
* .p-overlaypanel[attributeSelector] {
2023-12-21 07:56:38 +00:00
* width: ${breakpoint[value]} !important;
2022-09-06 12:03:37 +00:00
* }
* }
*/
[key: string]: string;
}
2023-03-01 10:19:01 +00:00
/**
* Defines valid properties in OverlayPanel component.
*/
2022-09-06 12:03:37 +00:00
export interface OverlayPanelProps {
/**
* Enables to hide the overlay when outside is clicked.
2023-03-01 10:19:01 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
dismissable?: boolean;
/**
* When enabled, displays a close icon at top right corner.
2023-03-01 10:19:01 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
showCloseIcon?: boolean;
/**
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
2023-03-08 10:51:52 +00:00
* @defaultValue body
2022-09-06 12:03:37 +00:00
*/
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
2022-09-06 12:03:37 +00:00
/**
* Base zIndex value to use in layering.
2023-03-01 10:19:01 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
baseZIndex?: number;
/**
* Whether to automatically manage layering.
2023-03-01 10:19:01 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
autoZIndex?: boolean;
/**
* Object literal to define widths per screen size.
*/
breakpoints?: OverlayPanelBreakpoints;
/**
* Icon to display in the overlaypanel close button.
* @deprecated since v3.27.0. Use 'closeicon' slot.
*/
closeIcon?: string | undefined;
2023-04-24 11:44:13 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-04-24 11:44:13 +00:00
* @type {OverlayPanelPassThroughOptions}
*/
pt?: PassThrough<OverlayPanelPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-05-29 20:18:28 +00:00
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
/**
* Specifies if pressing escape key should hide the dialog.
* @defaultValue true
*/
closeOnEscape?: boolean | undefined;
2022-09-06 12:03:37 +00:00
}
2023-03-01 10:19:01 +00:00
/**
* Defines valid slots in OverlayPanel component.
*/
2022-09-06 12:03:37 +00:00
export interface OverlayPanelSlots {
/**
* Custom content template.
*/
2023-03-01 10:19:01 +00:00
default(): VNode[];
/**
* Custom close icon template.
*/
closeicon(): VNode[];
2023-09-19 10:23:50 +00:00
/**
* Custom container slot.
* @param {Object} scope - container slot's params.
*/
container(scope: {
/**
* Close overlay panel function.
* @deprecated since v3.39.0. Use 'closeCallback' property instead.
2023-09-19 10:23:50 +00:00
*/
onClose: () => void;
/**
* Close button keydown function.
* @param {Event} event - Browser event
* @deprecated since v3.39.0. Use 'keydownCallback' property instead.
2023-09-19 10:23:50 +00:00
*/
onKeydown: (event: Event) => void;
/**
* Close overlay panel function.
*/
closeCallback: () => void;
/**
* Close button keydown function.
* @param {Event} event - Browser event
*/
keydownCallback: (event: Event) => void;
2023-09-19 10:23:50 +00:00
}): VNode[];
2023-03-01 10:19:01 +00:00
}
2022-09-06 12:03:37 +00:00
/**
* Defines valid emits in OverlayPanel component.
*/
export interface OverlayPanelEmits {
/**
* Callback to invoke when the overlay is shown.
*/
show(): void;
/**
* Callback to invoke when the overlay is hidden.
*/
hide(): void;
}
2023-03-01 10:19:01 +00:00
/**
* **PrimeVue - OverlayPanel**
*
* _OverlayPanel, also known as Popover, is a container component that can overlay other components on page._
*
* [Live Demo](https://www.primevue.org/overlaypanel/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*/
2023-03-01 14:48:23 +00:00
declare class OverlayPanel extends ClassComponent<OverlayPanelProps, OverlayPanelSlots, OverlayPanelEmits> {
/**
* Aligns overlay panel based on the current position of the container.
*/
alignOverlay(): void;
2022-09-06 12:03:37 +00:00
/**
* Toggles the visibility of the overlay.
* @param {Event} event - Browser event.
2022-12-08 11:04:25 +00:00
* @param {*} [target] - Optional target if event.currentTarget should not be used.
2022-09-06 12:03:37 +00:00
*
* @memberof OverlayPanel
*/
2023-03-01 10:19:01 +00:00
toggle(event: Event, target?: any): void;
2022-09-06 12:03:37 +00:00
/**
* Shows the overlay.
* @param {Event} event - Browser event.
* @param {*} [target] - Optional target if event.currentTarget should not be used.
*
* @memberof OverlayPanel
*/
2023-03-01 10:19:01 +00:00
show(event: Event, target?: any): void;
2022-09-06 12:03:37 +00:00
/**
* Hides the overlay.
*
* @memberof OverlayPanel
*/
2023-03-01 10:19:01 +00:00
hide(): void;
2022-09-06 12:03:37 +00:00
}
declare module 'vue' {
export interface GlobalComponents {
2022-09-14 11:26:01 +00:00
OverlayPanel: GlobalComponentConstructor<OverlayPanel>;
2022-09-06 12:03:37 +00:00
}
}
export default OverlayPanel;