2023-03-01 11:45:26 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* OrderList is used to managed the order of a collection.
|
|
|
|
*
|
2023-03-03 14:17:03 +00:00
|
|
|
* [Live Demo](https://primevue.org/orderlist)
|
2023-03-01 11:45:26 +00:00
|
|
|
*
|
|
|
|
* @module orderlist
|
|
|
|
*
|
|
|
|
*/
|
2023-08-02 14:07:22 +00:00
|
|
|
import { ButtonHTMLAttributes, HTMLAttributes, TransitionProps, VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2023-12-05 07:06:55 +00:00
|
|
|
import { ButtonPassThroughOptions } from '../button';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2023-09-05 11:28:04 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type OrderListPassThroughOptionType = OrderListPassThroughAttributes | ((options: OrderListPassThroughMethodOptions) => OrderListPassThroughAttributes | string) | string | null | undefined;
|
2023-05-09 16:03:01 +00:00
|
|
|
|
2023-08-02 14:07:22 +00:00
|
|
|
export declare type OrderListPassThroughTransitionType = TransitionProps | ((options: OrderListPassThroughMethodOptions) => TransitionProps) | undefined;
|
|
|
|
|
2023-05-09 16:03:01 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface OrderListPassThroughMethodOptions {
|
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-05-09 16:03:01 +00:00
|
|
|
props: OrderListProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-05-09 16:03:01 +00:00
|
|
|
state: OrderListState;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current options.
|
|
|
|
*/
|
2023-07-13 07:48:22 +00:00
|
|
|
context: OrderListContext;
|
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-05-09 16:03:01 +00:00
|
|
|
}
|
|
|
|
|
2023-12-05 07:06:55 +00:00
|
|
|
/**
|
|
|
|
* Custom shared passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface OrderListSharedPassThroughMethodOptions {
|
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
|
|
|
props: OrderListProps;
|
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
|
|
|
state: OrderListState;
|
|
|
|
}
|
|
|
|
|
2023-03-01 11:45:26 +00:00
|
|
|
/**
|
|
|
|
* Custom reorder event
|
2023-03-06 20:35:39 +00:00
|
|
|
* @see {@link OrderListEmits.reorder}
|
2023-03-01 11:45:26 +00:00
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface OrderListReorderEvent {
|
|
|
|
/**
|
|
|
|
* Browser event
|
|
|
|
*/
|
|
|
|
originalEvent: Event;
|
|
|
|
/**
|
|
|
|
* Ordered list
|
|
|
|
*/
|
|
|
|
value: any[];
|
|
|
|
/**
|
|
|
|
* Direction of the change; 'up', 'down', 'bottom', 'top'
|
|
|
|
*/
|
|
|
|
direction: string;
|
|
|
|
}
|
|
|
|
|
2023-03-01 11:45:26 +00:00
|
|
|
/**
|
|
|
|
* Custom selection change event
|
2023-03-06 20:35:39 +00:00
|
|
|
* @see {@link OrderListEmits['selection-change']}
|
2023-03-01 11:45:26 +00:00
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface OrderListSelectionChangeEvent {
|
|
|
|
/**
|
|
|
|
* Browser event
|
|
|
|
*/
|
|
|
|
originalEvent: Event;
|
|
|
|
/**
|
|
|
|
* Ordered list
|
|
|
|
*/
|
|
|
|
value: any[];
|
|
|
|
}
|
|
|
|
|
2023-05-09 16:03:01 +00:00
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link OrderListProps.pt}
|
|
|
|
*/
|
|
|
|
export interface OrderListPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-05-09 16:03:01 +00:00
|
|
|
*/
|
|
|
|
root?: OrderListPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the controls' DOM element.
|
2023-05-09 16:03:01 +00:00
|
|
|
*/
|
|
|
|
controls?: OrderListPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the Button component.
|
2023-05-09 16:03:01 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
moveUpButton?: ButtonPassThroughOptions<OrderListSharedPassThroughMethodOptions>;
|
2023-05-09 16:03:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the Button component.
|
2023-05-09 16:03:01 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
moveTopButton?: ButtonPassThroughOptions<OrderListSharedPassThroughMethodOptions>;
|
2023-05-09 16:03:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the Button component.
|
2023-05-09 16:03:01 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
moveDownButton?: ButtonPassThroughOptions<OrderListSharedPassThroughMethodOptions>;
|
2023-05-09 16:03:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the Button component.
|
2023-05-09 16:03:01 +00:00
|
|
|
*/
|
2023-12-05 07:06:55 +00:00
|
|
|
moveBottomButton?: ButtonPassThroughOptions<OrderListSharedPassThroughMethodOptions>;
|
2023-05-09 16:03:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the container's DOM element.
|
2023-05-09 16:03:01 +00:00
|
|
|
*/
|
|
|
|
container?: OrderListPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the header's DOM element.
|
2023-05-09 16:03:01 +00:00
|
|
|
*/
|
|
|
|
header?: OrderListPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the list's DOM element.
|
2023-05-09 16:03:01 +00:00
|
|
|
*/
|
|
|
|
list?: OrderListPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the item's DOM element.
|
2023-05-09 16:03:01 +00:00
|
|
|
*/
|
|
|
|
item?: OrderListPassThroughOptionType;
|
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:01:49 +00:00
|
|
|
/**
|
|
|
|
* Used to control Vue Transition API.
|
|
|
|
*/
|
2023-08-02 14:07:22 +00:00
|
|
|
transition?: OrderListPassThroughTransitionType;
|
2023-05-09 16:03:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface OrderListPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in OrderList component.
|
|
|
|
*/
|
|
|
|
export interface OrderListState {
|
|
|
|
/**
|
|
|
|
* Current id state as a string.
|
|
|
|
*/
|
|
|
|
id: string;
|
|
|
|
/**
|
|
|
|
* Current id state as a string.
|
|
|
|
*/
|
|
|
|
d_selection: any[];
|
|
|
|
/**
|
|
|
|
* Current focused state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
focused: boolean;
|
|
|
|
/**
|
|
|
|
* Current focused item index as a number.
|
|
|
|
* @defaultvalue -1
|
|
|
|
*/
|
|
|
|
focusedOptionIndex: number;
|
|
|
|
}
|
|
|
|
|
2023-07-13 07:48:22 +00:00
|
|
|
/**
|
|
|
|
* Defines current options in OrderList component.
|
|
|
|
*/
|
|
|
|
export interface OrderListContext {
|
|
|
|
/**
|
|
|
|
* 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:45:26 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in OrderList component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface OrderListProps {
|
|
|
|
/**
|
|
|
|
* Value of the component.
|
|
|
|
*/
|
|
|
|
modelValue?: any[];
|
|
|
|
/**
|
|
|
|
* Name of the field that uniquely identifies the a record in the data.
|
|
|
|
*/
|
|
|
|
dataKey?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Selected items in the list.
|
|
|
|
*/
|
|
|
|
selection?: any[];
|
|
|
|
/**
|
|
|
|
* 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;
|
2024-01-17 14:09:34 +00:00
|
|
|
/**
|
|
|
|
* Whether to focus on the first visible or selected element.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
autoOptionFocus?: boolean | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Inline style of the the list element.
|
|
|
|
*/
|
|
|
|
listStyle?: any;
|
|
|
|
/**
|
|
|
|
* Whether the list optimizes layout based on screen size.
|
2023-03-01 11:45:26 +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-08 10:51:52 +00:00
|
|
|
* @defaultValue 960px
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
breakpoint?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to displays rows with alternating colors.
|
|
|
|
*/
|
|
|
|
stripedRows?: boolean | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Index of the element in tabbing order.
|
|
|
|
*/
|
|
|
|
tabindex?: number | string | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLAttributes to the list element.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
listProps?: HTMLAttributes | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLButtonElement to the move up button inside the component.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
moveUpButtonProps?: ButtonHTMLAttributes | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLButtonElement to the move top button inside the component.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
moveTopButtonProps?: ButtonHTMLAttributes | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLButtonElement to the move down button inside the component.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
moveDownButtonProps?: ButtonHTMLAttributes | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLButtonElement to the move bottom button inside the component.
|
2022-12-08 11:04:25 +00:00
|
|
|
*/
|
|
|
|
moveBottomButtonProps?: ButtonHTMLAttributes | undefined;
|
|
|
|
/**
|
|
|
|
* Defines a string value that labels an interactive list element.
|
|
|
|
*/
|
2023-11-24 12:21:54 +00:00
|
|
|
ariaLabel?: string | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Identifier of the underlying list element.
|
|
|
|
*/
|
2023-11-24 12:21:54 +00:00
|
|
|
ariaLabelledby?: string | undefined;
|
2023-05-09 21:43:42 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-05-09 21:43:42 +00:00
|
|
|
* @type {OrderListPassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<OrderListPassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-06-02 09:10:49 +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:45:26 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in OrderList component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface OrderListSlots {
|
|
|
|
/**
|
|
|
|
* Custom header template.
|
|
|
|
*/
|
2023-03-01 11:45:26 +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:45:26 +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:45:26 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom controls start template.
|
|
|
|
*/
|
2023-03-01 11:45:26 +00:00
|
|
|
controlsstart(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom controls end template.
|
|
|
|
*/
|
2023-03-01 11:45:26 +00:00
|
|
|
controlsend(): VNode[];
|
2023-04-07 06:47:23 +00:00
|
|
|
/**
|
|
|
|
* 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[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 11:45:26 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in OrderList component.
|
|
|
|
*/
|
|
|
|
export interface OrderListEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the value changes.
|
|
|
|
* @param {*} value - New value.
|
|
|
|
*/
|
2023-03-01 11:45:26 +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:45:26 +00:00
|
|
|
'update:selection'(value: any[]): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the list is reordered.
|
|
|
|
* @param {OrderListReorderEvent} event - Custom reorder event.
|
|
|
|
*/
|
2023-03-01 11:45:26 +00:00
|
|
|
reorder(event: OrderListReorderEvent): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when selection changes.
|
|
|
|
* @param {OrderListSelectionChangeEvent} event - Custom selection change event.
|
|
|
|
*/
|
2023-03-01 11:45:26 +00:00
|
|
|
'selection-change'(event: OrderListSelectionChangeEvent): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 11:45:26 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - OrderList**
|
|
|
|
*
|
|
|
|
* _OrderList is used to sort a collection._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/orderlist/)
|
|
|
|
* --- ---
|
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class OrderList extends ClassComponent<OrderListProps, OrderListSlots, OrderListEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
OrderList: GlobalComponentConstructor<OrderList>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default OrderList;
|