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';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2024-04-02 08:24:31 +00:00
|
|
|
import { ClassComponent, DesignToken, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +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-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines instance.
|
|
|
|
*/
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
2023-04-24 09:40:50 +00:00
|
|
|
props: InplaceProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-04-24 09:40:50 +00:00
|
|
|
state: InplaceState;
|
2023-12-10 21:41:17 +00:00
|
|
|
/**
|
|
|
|
* Defines valid attributes.
|
|
|
|
*/
|
|
|
|
attrs: any;
|
2023-12-05 11:06:32 +00:00
|
|
|
/**
|
|
|
|
* 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 09:40:50 +00:00
|
|
|
}
|
|
|
|
|
2023-12-05 07:06:55 +00:00
|
|
|
/**
|
|
|
|
* Custom shared passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface InplaceSharedPassThroughMethodOptions {
|
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
|
|
|
props: InplaceProps;
|
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
|
|
|
state: InplaceState;
|
|
|
|
}
|
|
|
|
|
2023-04-24 09:40:50 +00:00
|
|
|
/**
|
|
|
|
* 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-12-05 07:06:55 +00:00
|
|
|
closeButton?: ButtonPassThroughOptions<InplaceSharedPassThroughMethodOptions>;
|
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-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.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @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;
|
2024-04-02 08:24:31 +00:00
|
|
|
/**
|
|
|
|
* It generates scoped CSS variables using design tokens for the component.
|
|
|
|
*/
|
|
|
|
dt?: DesignToken<any>;
|
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}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<InplacePassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
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[];
|
2023-04-18 10:51:10 +00:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
2024-03-14 22:58:11 +00:00
|
|
|
declare module 'vue' {
|
|
|
|
export interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
Inplace: GlobalComponentConstructor<Inplace>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Inplace;
|