2023-03-01 12:11:30 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* SplitButton groups a set of commands in an overlay with a default command.
|
|
|
|
*
|
2023-03-01 13:05:44 +00:00
|
|
|
* [Live Demo](https://www.primevue.org/splitbutton/)
|
2023-03-01 12:11:30 +00:00
|
|
|
*
|
|
|
|
* @module splitbutton
|
|
|
|
*
|
|
|
|
*/
|
2022-12-08 11:04:25 +00:00
|
|
|
import { ButtonHTMLAttributes, VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2023-05-02 08:00:39 +00:00
|
|
|
import { ButtonPassThroughOptions } from '../button';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { MenuItem } from '../menuitem';
|
2023-04-28 16:05:48 +00:00
|
|
|
import { TieredMenuPassThroughOptions } from '../tieredmenu';
|
2023-08-17 23:51:01 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, PTOptions } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type SplitButtonPassThroughOptionType = SplitButtonPassThroughAttributes | ((options: SplitButtonPassThroughMethodOptions) => SplitButtonPassThroughAttributes | string) | string | null | undefined;
|
2023-04-24 14:10:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface SplitButtonPassThroughMethodOptions {
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-04-24 14:10:17 +00:00
|
|
|
props: SplitButtonProps;
|
|
|
|
state: SplitButtonState;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link SplitButtonProps.pt}
|
|
|
|
*/
|
|
|
|
export interface SplitButtonPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-04-24 14:10:17 +00:00
|
|
|
*/
|
|
|
|
root?: SplitButtonPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the button's DOM element.
|
2023-04-24 14:10:17 +00:00
|
|
|
*/
|
|
|
|
button?: SplitButtonPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the Button component.
|
2023-05-02 08:00:39 +00:00
|
|
|
* @see {@link ButtonPassThroughOptions}
|
2023-04-24 14:10:17 +00:00
|
|
|
*/
|
2023-05-02 08:00:39 +00:00
|
|
|
menuButton?: ButtonPassThroughOptions;
|
2023-04-24 14:10:17 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the TieredMenu component.
|
2023-04-28 16:05:48 +00:00
|
|
|
* @see {@link TieredMenuPassThroughOptions}
|
2023-04-24 14:10:17 +00:00
|
|
|
*/
|
2023-04-28 16:05:48 +00:00
|
|
|
menu?: TieredMenuPassThroughOptions;
|
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 14:10:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface SplitButtonPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in SplitButton component.
|
|
|
|
*/
|
|
|
|
export interface SplitButtonState {
|
|
|
|
/**
|
|
|
|
* Current blocked state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
isBlocked: boolean;
|
|
|
|
}
|
|
|
|
|
2023-03-01 12:11:30 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in SplitButton component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface SplitButtonProps {
|
|
|
|
/**
|
|
|
|
* Text of the button.
|
|
|
|
*/
|
|
|
|
label?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Name of the icon.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'icon' slot.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
icon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* MenuModel instance to define the overlay items.
|
|
|
|
*/
|
|
|
|
model?: MenuItem[] | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to automatically manage layering.
|
2023-03-01 12:11:30 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
autoZIndex?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Base zIndex value to use in layering.
|
2023-03-01 12:11:30 +00:00
|
|
|
* @defaultValue 0
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
baseZIndex?: number | undefined;
|
|
|
|
/**
|
|
|
|
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
|
2023-03-01 12:11:30 +00:00
|
|
|
* Special keywords are 'body' for document body and 'self' for the element itself.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue body
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 12:11:30 +00:00
|
|
|
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* When present, it specifies that the element should be disabled.
|
2023-03-01 12:11:30 +00:00
|
|
|
* @defaultValue false
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
disabled?: boolean | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Style class of the component.
|
|
|
|
*/
|
2022-12-08 11:04:25 +00:00
|
|
|
class?: any | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Inline style of the component.
|
|
|
|
*/
|
2022-12-08 11:04:25 +00:00
|
|
|
style?: any | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLButtonElement to the default button.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
buttonProps?: ButtonHTMLAttributes | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLButtonElement to the menu button.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
menuButtonProps?: ButtonHTMLAttributes | undefined;
|
2023-01-02 08:40:36 +00:00
|
|
|
/**
|
|
|
|
* Name of the menu button icon.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'menubuttonicon' slot.
|
2023-01-02 08:40:36 +00:00
|
|
|
*/
|
|
|
|
menuButtonIcon?: string | undefined;
|
2023-03-03 12:41:32 +00:00
|
|
|
/**
|
|
|
|
* Defines the style of the button.
|
|
|
|
*/
|
2023-03-27 08:09:36 +00:00
|
|
|
severity?: 'secondary' | 'success' | 'info' | 'warning' | 'help' | 'danger' | string | undefined;
|
2023-03-03 12:41:32 +00:00
|
|
|
/**
|
|
|
|
* Add a shadow to indicate elevation.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
raised?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Add a circular border radius to the button.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
rounded?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Add a textual class to the button without a background initially.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
text?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Add a border class without a background initially.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
outlined?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Defines the size of the button.
|
|
|
|
*/
|
|
|
|
size?: 'small' | 'large' | undefined;
|
2023-03-06 08:16:57 +00:00
|
|
|
/**
|
|
|
|
* Add a plain textual class to the button without a background initially.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
plain?: boolean | undefined;
|
2023-04-24 14:10:17 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-04-24 14:10:17 +00:00
|
|
|
* @type {SplitButtonPassThroughOptions}
|
|
|
|
*/
|
2023-08-17 23:51:01 +00:00
|
|
|
pt?: PTOptions<SplitButtonPassThroughOptions>;
|
2023-05-30 14:17:32 +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 12:11:30 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in SplitButton component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface SplitButtonSlots {
|
|
|
|
/**
|
|
|
|
* Button part of the content can easily be customized with the default slot instead of using the built-in modes.
|
|
|
|
*/
|
2023-03-01 12:11:30 +00:00
|
|
|
default(): VNode[];
|
2023-04-18 10:51:10 +00:00
|
|
|
/**
|
|
|
|
* Custom menu button icon template.
|
2023-08-17 07:16:25 +00:00
|
|
|
* @param {Object} scope - icon slot's params.
|
2023-04-18 10:51:10 +00:00
|
|
|
*/
|
2023-06-06 08:14:14 +00:00
|
|
|
icon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2023-04-10 11:57:23 +00:00
|
|
|
/**
|
|
|
|
* Custom menu button icon template.
|
2023-08-17 07:16:25 +00:00
|
|
|
* @param {Object} scope - menubuttonicon slot's params.
|
2023-04-10 11:57:23 +00:00
|
|
|
*/
|
2023-06-06 08:14:14 +00:00
|
|
|
menubuttonicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2023-08-28 13:29:49 +00:00
|
|
|
/**
|
|
|
|
* Custom menu item icon template.
|
|
|
|
* @param {Object} scope - menubuttonicon slot's params.
|
|
|
|
*/
|
|
|
|
menuitemicon(scope: {
|
|
|
|
/**
|
|
|
|
* Menuitem instance
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 12:11:30 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in SplitButton component.
|
|
|
|
*/
|
|
|
|
export interface SplitButtonEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when main button is clicked.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
2023-03-01 12:11:30 +00:00
|
|
|
click(event: Event): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 12:11:30 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - SplitButton**
|
|
|
|
*
|
|
|
|
* _SplitButton groups a set of commands in an overlay with a default command._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/splitbutton/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 12:11:30 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class SplitButton extends ClassComponent<SplitButtonProps, SplitButtonSlots, SplitButtonEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
SplitButton: GlobalComponentConstructor<SplitButton>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SplitButton;
|