primevue-mirror/components/lib/inplace/Inplace.d.ts

177 lines
4.5 KiB
TypeScript
Raw Normal View History

2023-03-01 13:12:23 +00:00
/**
*
* Inplace provides an easy to do editing and display at the same time where clicking the output displays the actual content.
*
* [Live Demo](https://www.primevue.org/inplace)
*
* @module inplace
*
*/
2023-05-02 08:01:27 +00:00
2023-03-01 13:12:23 +00:00
import { ButtonHTMLAttributes, HTMLAttributes, VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
2023-05-02 08:01:27 +00:00
import { ButtonPassThroughOptions } from '../button';
import { ClassComponent, GlobalComponentConstructor, PTOptions } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type InplacePassThroughOptionType = InplacePassThroughAttributes | ((options: InplacePassThroughMethodOptions) => InplacePassThroughAttributes | string) | string | null | undefined;
2023-04-24 09:40:50 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface InplacePassThroughMethodOptions {
2023-07-06 12:01:33 +00:00
instance: any;
2023-04-24 09:40:50 +00:00
props: InplaceProps;
state: InplaceState;
}
/**
* Custom passthrough(pt) options.
* @see {@link InplaceProps.pt}
*/
export interface InplacePassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-04-24 09:40:50 +00:00
*/
root?: InplacePassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the display's DOM element.
2023-04-24 09:40:50 +00:00
*/
display?: InplacePassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the content's DOM element.
2023-04-24 09:40:50 +00:00
*/
content?: InplacePassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-02 08:01:27 +00:00
* @see {@link ButtonPassThroughOptions}
2023-04-24 09:40:50 +00:00
*/
2023-05-02 08:01:27 +00:00
closeButton?: ButtonPassThroughOptions;
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-04-24 09:40:50 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface InplacePassThroughAttributes {
[key: string]: any;
}
/**
* Defines current inline state in Inplace component.
*/
export interface InplaceState {
/**
* Current active state as a boolean.
* @defaultValue false
*/
d_active: boolean;
}
2023-03-01 13:12:23 +00:00
/**
* Defines valid properties in Inplace component.
*/
2022-09-06 12:03:37 +00:00
export interface InplaceProps {
/**
* Displays a button to switch back to display mode.
2023-03-01 13:12:23 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
closable?: boolean | undefined;
/**
* Whether the content is displayed or not.
2023-03-01 13:12:23 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
active?: boolean | undefined;
/**
* When present, it specifies that the element should be disabled.
2023-03-01 13:12:23 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
disabled?: boolean | undefined;
2022-12-08 11:04:25 +00:00
/**
* Icon to display in the close button.
* @deprecated since v3.27.0. Use 'closeicon' slot.
2022-12-08 11:04:25 +00:00
*/
closeIcon?: string | undefined;
/**
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLDivElement to display container.
2022-12-08 11:04:25 +00:00
*/
displayProps?: HTMLAttributes | undefined;
/**
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLButtonElement to the close button.
2022-12-08 11:04:25 +00:00
*/
closeButtonProps?: ButtonHTMLAttributes | undefined;
2023-04-24 09:40:50 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-04-24 09:40:50 +00:00
* @type {InplacePassThroughOptions}
*/
pt?: PTOptions<InplacePassThroughOptions>;
2023-05-24 09:52:20 +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 13:12:23 +00:00
/**
* Defines valid slots in Inplace component.
*/
2022-09-06 12:03:37 +00:00
export interface InplaceSlots {
/**
* Custom display template.
*/
2023-03-01 13:12:23 +00:00
display(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom content template.
*/
2023-03-01 13:12:23 +00:00
content(): VNode[];
/**
* Custom close icon template.
*/
closeicon(): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 13:12:23 +00:00
/**
* Defines valid emits in Inplace component.
*/
export interface InplaceEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the active changes.
* @param {boolean} value - New value.
*/
2023-03-01 13:12:23 +00:00
'update:active'(value: boolean): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when inplace is opened.
* @param {Event} event - Browser event.
*/
2023-03-01 13:12:23 +00:00
open(event: Event): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when inplace is closed.
* @param {Event} event - Browser event.
*/
2023-03-01 13:12:23 +00:00
close(event: Event): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 13:12:23 +00:00
/**
* **PrimeVue - Inplace**
*
* _Inplace provides an easy to do editing and display at the same time where clicking the output displays the actual content._
*
* [Live Demo](https://www.primevue.org/inplace/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*/
2022-09-14 11:26:01 +00:00
declare class Inplace extends ClassComponent<InplaceProps, InplaceSlots, InplaceEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Inplace: GlobalComponentConstructor<Inplace>;
2022-09-06 12:03:37 +00:00
}
}
export default Inplace;