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

239 lines
6.1 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, PTOptions } 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;
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-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-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] {
* width: ${breakpoint[value]} !important;
* }
* }
*/
[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
*/
2023-03-01 10:19:01 +00:00
appendTo?: 'body' | 'self' | string | 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?: PTOptions<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;
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[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 10:19:01 +00:00
/**
* Defines valid emits in OverlayPanel component.
*/
export interface OverlayPanelEmits {
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when the overlay is shown.
*/
2023-03-01 10:19:01 +00:00
show(): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when the overlay is hidden.
*/
2023-03-01 10:19:01 +00:00
hide(): void;
}
2022-09-06 12:03:37 +00:00
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> {
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/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
OverlayPanel: GlobalComponentConstructor<OverlayPanel>;
2022-09-06 12:03:37 +00:00
}
}
export default OverlayPanel;