primevue-mirror/components/lib/picklist/PickList.d.ts

605 lines
17 KiB
TypeScript
Raw Normal View History

2023-03-01 11:46:01 +00:00
/**
*
* PickList is used to reorder items between different lists.
*
2023-03-03 14:17:03 +00:00
* [Live Demo](https://primevue.org/picklist)
2023-03-01 11:46:01 +00:00
*
* @module picklist
*
*/
2024-03-21 13:52:26 +00:00
import { TransitionProps, VNode } from 'vue';
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
import { ButtonPassThroughOptions } from '../button';
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, DesignToken, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type PickListPassThroughOptionType = PickListPassThroughAttributes | ((options: PickListPassThroughMethodOptions) => PickListPassThroughAttributes | string) | string | null | undefined;
2023-05-09 22:03:24 +00:00
2023-08-02 14:07:22 +00:00
export declare type PickListPassThroughTransitionType = TransitionProps | ((options: PickListPassThroughMethodOptions) => TransitionProps) | undefined;
2023-05-09 22:03:24 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface PickListPassThroughMethodOptions {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-05-09 22:03:24 +00:00
props: PickListProps;
/**
* Defines current inline state.
*/
2023-05-09 22:03:24 +00:00
state: PickListState;
/**
* Defines current options.
*/
2023-07-13 07:46:31 +00:00
context: PickListContext;
/**
* 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-05-09 22:03:24 +00:00
}
/**
* Custom shared passthrough(pt) option method.
*/
export interface PickListSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: PickListProps;
/**
* Defines current inline state.
*/
state: PickListState;
}
2023-03-01 11:46:01 +00:00
/**
* Custom reorder event.
2023-03-06 20:35:39 +00:00
* @see {@link PickListEmits.reorder}
2023-03-01 11:46:01 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface PickListReorderEvent {
/**
* Browser event
*/
originalEvent: Event;
/**
* Ordered list
*/
value: any[];
/**
* Direction of the change; 'up', 'down', 'bottom', 'top'
*/
direction: string;
/**
* Index of the list that is ordered, 0 represents the source and 1 represents the target list.
*/
listIndex: number;
}
2023-03-01 11:46:01 +00:00
/**
* Custom selection change event.
2023-03-06 20:35:39 +00:00
* @see {@link PickListEmits['selection-change']}
2023-03-01 11:46:01 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface PickListSelectionChangeEvent {
/**
* Browser event
*/
originalEvent: Event;
/**
* Selected item
*/
value: any[];
}
2023-03-01 11:46:01 +00:00
/**
* Custom move-to-target event.
2023-03-06 20:35:39 +00:00
* @see {@link PickListEmits['move-to-target']}
2023-03-01 11:46:01 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface PickListMoveToTargetEvent {
/**
* Browser event
*/
originalEvent: Event;
/**
* Moved items
*/
items: any[];
}
/**
2023-03-01 11:46:01 +00:00
* Custom move-all-to-target event.
2023-03-06 20:35:39 +00:00
* @see {@link PickListEmits['move-all-to-target']}
2022-09-06 12:03:37 +00:00
* @extends PickListMoveToTargetEvent
*/
2022-09-14 11:26:01 +00:00
export interface PickListMoveAllToTargetEvent extends PickListMoveToTargetEvent {}
2022-09-06 12:03:37 +00:00
/**
2023-03-01 11:46:01 +00:00
* Custom move-to-source event.
2023-03-06 20:35:39 +00:00
* @see {@link PickListEmits['move-all-to-target']}
2022-09-06 12:03:37 +00:00
* @extends PickListMoveToTargetEvent
*/
2022-09-14 11:26:01 +00:00
export interface PickListMoveToSourceEvent extends PickListMoveToTargetEvent {}
2022-09-06 12:03:37 +00:00
/**
2023-03-01 11:46:01 +00:00
* Custom move-all-to-source event.
2023-03-06 20:35:39 +00:00
* @see {@link PickListEmits['move-all-to-target']}
2022-09-06 12:03:37 +00:00
* @extends PickListMoveToTargetEvent
*/
2022-09-14 11:26:01 +00:00
export interface PickListMoveAllToSourceEvent extends PickListMoveToTargetEvent {}
2022-09-06 12:03:37 +00:00
2023-05-09 22:03:24 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link PickListProps.pt}
*/
export interface PickListPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-05-09 22:03:24 +00:00
*/
root?: PickListPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the source controls' DOM element.
2023-05-09 22:03:24 +00:00
*/
sourceControls?: PickListPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
sourceMoveUpButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
sourceMoveTopButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
sourceMoveDownButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
sourceMoveBottomButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
* Used to pass attributes to the source list containerr's DOM element.
2023-05-09 22:03:24 +00:00
*/
sourceListContainer?: PickListPassThroughOptionType;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the source list's DOM element.
2023-05-09 22:03:24 +00:00
*/
sourceList?: PickListPassThroughOptionType;
/**
* Used to pass attributes to the transfer controls' DOM element.
2023-05-09 22:03:24 +00:00
*/
transferControls?: PickListPassThroughOptionType;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
moveToTargetButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
moveAllToTargetButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
moveToSourceButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
moveAllToSourceButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
* Used to pass attributes to the target list container's DOM element.
2023-05-09 22:03:24 +00:00
*/
targetListContainer?: PickListPassThroughOptionType;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the target list's DOM element.
2023-05-09 22:03:24 +00:00
*/
targetList?: PickListPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the target item's DOM element.
*/
item?: PickListPassThroughOptionType;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the target controls' DOM element.
2023-05-09 22:03:24 +00:00
*/
targetControls?: PickListPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
targetMoveUpButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
targetMoveTopButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
targetMoveDownButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the Button component.
2023-05-09 22:03:24 +00:00
*/
targetMoveBottomButton?: ButtonPassThroughOptions<PickListSharedPassThroughMethodOptions>;
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:02:28 +00:00
/**
* Used to control Vue Transition API.
*/
2023-08-02 14:07:22 +00:00
transition?: PickListPassThroughTransitionType;
2023-05-09 22:03:24 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface PickListPassThroughAttributes {
[key: string]: any;
}
2023-05-09 22:10:31 +00:00
export interface PickListFocusedState {
/**
* Current source list's focused state as a boolean.
* @defaultValue false
*/
sourceList: boolean;
/**
* Current target list's focused state as a boolean.
* @defaultValue false
*/
targetList: boolean;
}
2023-05-09 22:03:24 +00:00
/**
* Defines current inline state in PickList component.
*/
export interface PickListState {
/**
* Current id state as a string.
*/
id: string;
/**
* Current id state as a string.
*/
d_selection: any[];
2023-05-09 22:10:31 +00:00
/**
* Current view change state as a boolean.
* @defaultValue false
*/
viewChanged: boolean;
2023-05-09 22:03:24 +00:00
}
2023-07-13 07:46:31 +00:00
/**
2023-07-13 07:47:34 +00:00
* Defines current options in PickList component.
2023-07-13 07:46:31 +00:00
*/
export interface PickListContext {
/**
* Current active state of the item as a boolean.
* @defaultValue false
*/
active: boolean;
/**
* Current focus state of the item as a boolean.
* @defaultValue false
*/
focused: boolean;
}
2023-03-01 11:46:01 +00:00
/**
* Defines valid properties in PickList component.
*/
2022-09-06 12:03:37 +00:00
export interface PickListProps {
/**
* Value of the component as a multidimensional array.
*/
modelValue?: any[][] | undefined;
/**
* Selected items in the list as a multidimensional array.
*/
selection?: any[][] | undefined;
/**
* Name of the field that uniquely identifies the a record in the data.
*/
dataKey?: string | undefined;
/**
* Defines whether metaKey is requred or not for the selection.
* When true metaKey needs to be pressed to select or unselect an item and
* when set to false selection of each item can be toggled individually. On touch enabled devices, metaKeySelection is turned off automatically.
2023-12-20 10:35:18 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
metaKeySelection?: boolean | undefined;
/**
* Whether to focus on the first visible or selected element.
2024-01-24 07:02:00 +00:00
* @defaultValue true
*/
autoOptionFocus?: boolean | undefined;
2024-01-24 07:02:00 +00:00
/**
* When enabled, the focus is placed on the hovered option.
* @defaultValue true
*/
focusOnHover?: boolean | undefined;
2022-09-06 12:03:37 +00:00
/**
* Inline style of the the list element.
*/
listStyle?: any | undefined;
/**
* Whether the list optimizes layout based on screen size.
2023-03-01 11:46:01 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
responsive?: boolean | undefined;
/**
* The breakpoint to define the maximum width boundary when responsiveness is enabled.
2023-03-01 11:46:01 +00:00
* @defaultValue 960px
2022-09-06 12:03:37 +00:00
*/
breakpoint?: string | undefined;
2024-03-26 14:21:39 +00:00
/**
* Height of the viewport, a scrollbar is defined if height of list exceeds this value.
* @defaultValue 14rem
*/
scrollHeight?: string | undefined;
2022-09-06 12:03:37 +00:00
/**
* Whether to displays rows with alternating colors.
2023-03-01 11:46:01 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
stripedRows?: boolean | undefined;
/**
* Whether to show buttons of source list.
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
showSourceControls?: boolean | undefined;
/**
* Whether to show buttons of target list.
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
showTargetControls?: boolean | undefined;
2024-03-22 08:57:54 +00:00
/**
* Used to pass all properties of the ButtonProps to the move up button inside the component.
* @type {ButtonProps}
* @defaultValue { severity: 'secondary' }
2024-03-22 08:57:54 +00:00
*/
buttonProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the move up button inside the component.
*/
moveUpButtonProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the move top button inside the component.
*/
moveTopButtonProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the move down button inside the component.
*/
moveDownButtonProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the move bottom button inside the component.
*/
moveBottomButtonProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the move to target button inside the component.
*/
moveToTargetProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the move all to target button inside the component.
*/
moveAllToTargetProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the move to source button inside the component.
*/
moveToSourceProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the move all to source button inside the component.
*/
moveAllToSourceProps?: object | undefined;
2022-12-08 11:04:25 +00:00
/**
* Index of the list element in tabbing order.
*/
tabindex?: number | string | undefined;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
2023-05-09 22:03:24 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-05-09 22:03:24 +00:00
* @type {PickListPassThroughOptions}
*/
pt?: PassThrough<PickListPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
2023-06-02 15:43:30 +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 11:46:01 +00:00
/**
* Defines valid slots in PickList component.
*/
2022-09-06 12:03:37 +00:00
export interface PickListSlots {
/**
* Custom header template.
*/
2023-03-01 11:46:01 +00:00
header(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom item template.
* @param {Object} scope - item slot's params.
*/
2023-03-01 11:46:01 +00:00
item(scope: {
2022-09-06 12:03:37 +00:00
/**
* Item of the component
*/
item: any;
/**
* Index of the item
*/
index: number;
2023-03-01 11:46:01 +00:00
}): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom source header template.
*/
2023-03-01 11:46:01 +00:00
sourceheader(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom target header template.
*/
2023-03-01 11:46:01 +00:00
targetheader(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom source controls start template.
*/
2023-03-01 11:46:01 +00:00
sourcecontrolsstart(): VNode[];
2022-09-14 11:26:01 +00:00
/**
2022-09-06 12:03:37 +00:00
* Custom source controls end template.
*/
2023-03-01 11:46:01 +00:00
sourcecontrolsend(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom move controls start template.
*/
2023-03-01 11:46:01 +00:00
movecontrolsstart(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom move controls end template.
*/
2023-03-01 11:46:01 +00:00
movecontrolsend(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom target controls start template.
*/
2023-03-01 11:46:01 +00:00
targetcontrolsstart(): VNode[];
2022-09-06 12:03:37 +00:00
/**
* Custom target controls end template.
*/
2023-03-01 11:46:01 +00:00
targetcontrolsend(): VNode[];
/**
* Custom move up icon template.
*/
moveupicon(): VNode[];
/**
* Custom move top icon template.
*/
movetopicon(): VNode[];
/**
* Custom move down icon template.
*/
movedownicon(): VNode[];
/**
* Custom move bottom icon template.
*/
movebottomicon(): VNode[];
/**
* Custom move to target icon template.
2023-04-18 14:09:53 +00:00
* @param {Object} scope - movetotargeticon slot's params.
*/
2023-04-18 14:09:53 +00:00
movetotargeticon(scope: {
/**
* Whether view change.
*/
viewChanged: boolean;
}): VNode[];
/**
* Custom move all to target icon template.
2023-04-18 14:09:53 +00:00
* @param {Object} scope - movealltotargeticon slot's params.
*/
2023-04-18 14:09:53 +00:00
movealltotargeticon(scope: {
/**
* Whether view change.
*/
viewChanged: boolean;
}): VNode[];
/**
* Custom move to source icon template.
2023-04-18 14:09:53 +00:00
* @param {Object} scope - movetosourceicon slot's params.
*/
2023-04-18 14:09:53 +00:00
movetosourceicon(scope: {
/**
* Whether view change.
*/
viewChanged: boolean;
}): VNode[];
/**
* Custom move all to source icon template.
2023-04-18 14:09:53 +00:00
* @param {Object} scope - movealltosourceicon slot's params.
*/
2023-04-18 14:09:53 +00:00
movealltosourceicon(scope: {
/**
* Whether view change.
*/
viewChanged: boolean;
}): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 11:46:01 +00:00
/**
* Defines valid emits in PickList component.
*/
export interface PickListEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the value changes.
* @param {*} value - New value.
*/
2023-03-01 11:46:01 +00:00
'update:modelValue'(value: any[][]): void;
2022-09-06 12:03:37 +00:00
/**
* Emitted when the selection changes.
* @param {*} value - New value.
*/
2023-03-01 11:46:01 +00:00
'update:selection'(value: any[][]): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when the list is reordered.
* @param {PickListReorderEvent} event - Custom reorder event.
*/
2023-03-01 11:46:01 +00:00
reorder(event: PickListReorderEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when one or more items are moved to the other list.
* @param {PickListSelectionChangeEvent} event - Custom selection change event.
*/
2023-03-01 11:46:01 +00:00
'selection-change'(event: PickListSelectionChangeEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when one or more items are moved to the target list.
* @param {PickListMoveToTargetEvent} event - Custom move to target event.
*/
2023-03-01 11:46:01 +00:00
'move-to-target'(event: PickListMoveToTargetEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when all items are moved to the target list.
* @param {PickListMoveAllToTargetEvent} event - Custom move all to target event.
*/
2023-03-01 11:46:01 +00:00
'move-all-to-target'(event: PickListMoveAllToTargetEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when one or more items are moved to the source list.
* @param {PickListMoveToSourceEvent} event - Custom move to source event.
*/
2023-03-01 11:46:01 +00:00
'move-to-source'(event: PickListMoveToSourceEvent): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when all items are moved to the source list.
* @param {PickListMoveAllToSourceEvent} event - Custom move all to source event.
*/
2023-03-01 11:46:01 +00:00
'move-all-to-source'(event: PickListMoveAllToSourceEvent): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 11:46:01 +00:00
/**
* **PrimeVue - PickList**
*
* _PickList is used to reorder items between different lists._
*
* [Live Demo](https://www.primevue.org/picklist/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*/
2022-09-14 11:26:01 +00:00
declare class PickList extends ClassComponent<PickListProps, PickListSlots, PickListEmits> {}
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
2022-09-14 11:26:01 +00:00
PickList: GlobalComponentConstructor<PickList>;
2022-09-06 12:03:37 +00:00
}
}
export default PickList;