2023-03-01 13:04:04 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Dock is a navigation component consisting of menuitems.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/dock/)
|
|
|
|
*
|
|
|
|
* @module dock
|
|
|
|
*
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
import { VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { MenuItem } from '../menuitem';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2024-05-16 10:50:43 +00:00
|
|
|
import { DefineComponent, DesignToken, EmitFn, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type DockPassThroughOptionType = DockPassThroughAttributes | ((options: DockPassThroughMethodOptions) => DockPassThroughAttributes | string) | string | null | undefined;
|
2023-04-26 10:49:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface DockPassThroughMethodOptions {
|
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-26 10:49:14 +00:00
|
|
|
props: DockProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-04-26 10:49:14 +00:00
|
|
|
state: DockState;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current options.
|
|
|
|
*/
|
2023-04-28 10:15:44 +00:00
|
|
|
context: DockContext;
|
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-26 10:49:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link DockProps.pt}
|
|
|
|
*/
|
|
|
|
export interface DockPassThroughOptions {
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-04-26 10:49:14 +00:00
|
|
|
*/
|
|
|
|
root?: DockPassThroughOptionType;
|
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the list container's DOM element.
|
2023-04-26 10:49:14 +00:00
|
|
|
*/
|
2024-04-30 11:51:44 +00:00
|
|
|
listContainer?: DockPassThroughOptionType;
|
2023-04-26 10:49:14 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the list's DOM element.
|
2023-04-26 10:49:14 +00:00
|
|
|
*/
|
2024-04-30 11:51:44 +00:00
|
|
|
list?: DockPassThroughOptionType;
|
2023-04-26 10:49:14 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the item's DOM element.
|
2023-04-26 10:49:14 +00:00
|
|
|
*/
|
2024-04-30 11:51:44 +00:00
|
|
|
item?: DockPassThroughOptionType;
|
2023-04-26 10:49:14 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the item content's DOM element.
|
2023-04-26 10:49:14 +00:00
|
|
|
*/
|
2024-04-30 11:51:44 +00:00
|
|
|
itemContent?: DockPassThroughOptionType;
|
2023-04-26 10:49:14 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the item link's DOM element.
|
2023-04-26 10:49:14 +00:00
|
|
|
*/
|
2024-04-30 11:51:44 +00:00
|
|
|
itemLink?: DockPassThroughOptionType;
|
2023-04-26 10:49:14 +00:00
|
|
|
/**
|
2024-05-15 09:24:26 +00:00
|
|
|
* Used to pass attributes to the item icon's DOM element.
|
2023-04-26 10:49:14 +00:00
|
|
|
*/
|
2024-04-30 11:51:44 +00:00
|
|
|
itemIcon?: DockPassThroughOptionType;
|
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-26 10:49:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface DockPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in Dock component.
|
|
|
|
*/
|
|
|
|
export interface DockState {
|
|
|
|
/**
|
|
|
|
* Current id state as a string.
|
|
|
|
*/
|
|
|
|
id: string;
|
|
|
|
/**
|
|
|
|
* Current index as a number.
|
2024-03-27 15:45:52 +00:00
|
|
|
* @defaultValue -3
|
2023-04-26 10:49:14 +00:00
|
|
|
*/
|
|
|
|
currentIndex: number;
|
|
|
|
/**
|
|
|
|
* Current focus state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
focused: boolean;
|
|
|
|
/**
|
|
|
|
* Current focused item index as a number.
|
2024-03-27 15:45:52 +00:00
|
|
|
* @defaultValue -1
|
2023-04-26 10:49:14 +00:00
|
|
|
*/
|
|
|
|
focusedOptionIndex: number;
|
|
|
|
}
|
|
|
|
|
2023-04-28 10:15:44 +00:00
|
|
|
/**
|
|
|
|
* Defines current options in Dock component.
|
|
|
|
*/
|
|
|
|
export interface DockContext {
|
2023-07-19 12:03:52 +00:00
|
|
|
/**
|
|
|
|
* Current index of the menuitem.
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-07-25 09:11:01 +00:00
|
|
|
/**
|
|
|
|
* Current menuitem
|
|
|
|
*/
|
|
|
|
item: any;
|
2023-04-28 10:15:44 +00:00
|
|
|
/**
|
|
|
|
* Current active state of menuitem as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
active: boolean;
|
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:04 +00:00
|
|
|
/**
|
|
|
|
* Defines tooltip options
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface DockTooltipOptions {
|
|
|
|
/**
|
|
|
|
* Event to show the tooltip, valid values are hover and focus.
|
|
|
|
*/
|
2023-03-01 13:04:04 +00:00
|
|
|
event: 'hover' | 'focus' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Position of element.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue bottom
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 13:04:04 +00:00
|
|
|
position: 'bottom' | 'top' | 'left' | 'right' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Optional options.
|
|
|
|
*/
|
2023-03-01 13:04:04 +00:00
|
|
|
[key: string]: any;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-09-04 09:16:03 +00:00
|
|
|
/**
|
|
|
|
* Defines valid router binding props in Dock component.
|
|
|
|
*/
|
|
|
|
export interface DockRouterBindProps {
|
|
|
|
/**
|
|
|
|
* Action element binding
|
|
|
|
*/
|
|
|
|
action: object;
|
|
|
|
/**
|
|
|
|
* Icon element binding
|
|
|
|
*/
|
|
|
|
icon: object;
|
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in Dock component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface DockProps {
|
|
|
|
/**
|
|
|
|
* MenuModel instance to define the action items.
|
|
|
|
*/
|
|
|
|
model?: MenuItem[] | undefined;
|
|
|
|
/**
|
|
|
|
* Position of element.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue bottom
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 13:04:04 +00:00
|
|
|
position?: 'bottom' | 'top' | 'left' | 'right' | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Style class of the element.
|
|
|
|
*/
|
|
|
|
class?: any;
|
|
|
|
/**
|
|
|
|
* Inline style of the element.
|
|
|
|
*/
|
|
|
|
style?: any;
|
2023-11-15 10:45:42 +00:00
|
|
|
/**
|
|
|
|
* The breakpoint to define the maximum width boundary.
|
|
|
|
* @defaultValue 960px
|
|
|
|
*/
|
|
|
|
breakpoint?: string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Whether to apply 'router-link-active-exact' class if route exactly matches the item path.
|
2023-11-08 12:48:23 +00:00
|
|
|
* @deprecated since v3.40.0.
|
2023-03-01 13:04:04 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
exact?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to display the tooltip on items. The modifiers of Tooltip can be used like an object in it. Valid keys are 'event' and 'position'.
|
2023-03-01 13:04:04 +00:00
|
|
|
* @type {DockTooltipOptions}
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
tooltipOptions?: DockTooltipOptions;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Unique identifier of the menu.
|
|
|
|
*/
|
|
|
|
menuId?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Index of the element in tabbing order.
|
|
|
|
*/
|
|
|
|
tabindex?: number | string | undefined;
|
|
|
|
/**
|
|
|
|
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
|
|
|
*/
|
2023-11-24 12:21:54 +00:00
|
|
|
ariaLabelledby?: string | undefined;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Establishes a string value that labels the component.
|
|
|
|
*/
|
2023-11-24 12:21:54 +00:00
|
|
|
ariaLabel?: string | 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-26 10:49:14 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-04-26 10:49:14 +00:00
|
|
|
* @type {DockPassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<DockPassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-05-30 12:56:18 +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:04:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in Dock component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface DockSlots {
|
|
|
|
/**
|
|
|
|
* Custom item content.
|
|
|
|
* @param {Object} scope - item slot's params.
|
|
|
|
*/
|
2023-03-01 13:04:04 +00:00
|
|
|
item(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom content for item.
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Index of the menuitem
|
|
|
|
*/
|
|
|
|
index: number;
|
2023-08-30 13:28:00 +00:00
|
|
|
/**
|
|
|
|
* Label property of the menuitem
|
|
|
|
*/
|
|
|
|
label: string | ((...args: any) => string) | undefined;
|
|
|
|
/**
|
|
|
|
* Binding properties of the menuitem
|
|
|
|
*/
|
2023-09-04 09:16:03 +00:00
|
|
|
props: DockRouterBindProps;
|
2023-03-01 13:04:04 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2024-05-06 10:32:30 +00:00
|
|
|
* @deprecated since v4.0. Use 'itemicon' slot.
|
2022-09-06 12:03:37 +00:00
|
|
|
* Custom icon content.
|
2024-05-06 10:32:30 +00:00
|
|
|
* @param {Object} scope - item icon slot's params.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 13:04:04 +00:00
|
|
|
icon(scope: {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2024-05-06 10:32:30 +00:00
|
|
|
* Custom content for item icon.
|
|
|
|
*/
|
|
|
|
item: MenuItem;
|
|
|
|
}): VNode[];
|
|
|
|
/**
|
|
|
|
* Custom icon content.
|
|
|
|
* @param {Object} scope - item icon slot's params.
|
|
|
|
*/
|
|
|
|
itemicon(scope: {
|
|
|
|
/**
|
|
|
|
* Custom content for item icon.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
item: MenuItem;
|
2023-03-01 13:04:04 +00:00
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 13:04:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in Dock component.
|
|
|
|
*/
|
2024-05-16 10:50:43 +00:00
|
|
|
interface DockEmitsOptions {
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the component receives focus.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
2023-03-01 13:04:04 +00:00
|
|
|
focus(event: Event): void;
|
2022-12-08 11:04:25 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the component loses focus.
|
|
|
|
* @param {Event} event - Browser event.
|
|
|
|
*/
|
2023-03-01 13:04:04 +00:00
|
|
|
blur(event: Event): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2024-05-16 10:50:43 +00:00
|
|
|
export declare type DockEmits = EmitFn<DockEmitsOptions>;
|
|
|
|
|
2023-03-01 13:04:04 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Dock**
|
|
|
|
*
|
|
|
|
* _Dock is a navigation component consisting of menuitems._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/dock/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 13:04:04 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2024-05-16 10:50:43 +00:00
|
|
|
declare const Dock: DefineComponent<DockProps, DockSlots, DockEmits>;
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2024-03-14 22:58:11 +00:00
|
|
|
declare module 'vue' {
|
|
|
|
export interface GlobalComponents {
|
2024-05-16 10:50:43 +00:00
|
|
|
Dock: GlobalComponentConstructor<DockProps, DockSlots, DockEmits>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Dock;
|