diff --git a/api-generator/components/dock.js b/api-generator/components/dock.js index b5615d452..8c105e8b6 100644 --- a/api-generator/components/dock.js +++ b/api-generator/components/dock.js @@ -34,6 +34,12 @@ const DockProps = [ type: 'object', default: 'null', description: "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'." + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/dock/Dock.d.ts b/components/lib/dock/Dock.d.ts index c0f0814bd..ca2ceb066 100644 --- a/components/lib/dock/Dock.d.ts +++ b/components/lib/dock/Dock.d.ts @@ -11,6 +11,83 @@ import { VNode } from 'vue'; import { MenuItem } from '../menuitem'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type DockPassThroughOptionType = DockPassThroughAttributes | ((options: DockPassThroughMethodOptions) => DockPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface DockPassThroughMethodOptions { + props: DockProps; + state: DockState; +} + +/** + * Custom passthrough(pt) options. + * @see {@link DockProps.pt} + */ +export interface DockPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: DockPassThroughOptionType; + /** + * Uses to pass attributes to the container's DOM element. + */ + container?: DockPassThroughOptionType; + /** + * Uses to pass attributes to the list's DOM element. + */ + menu?: DockPassThroughOptionType; + /** + * Uses to pass attributes to the list item's DOM element. + */ + menuitem?: DockPassThroughOptionType; + /** + * Uses to pass attributes to the content's DOM element. + */ + content?: DockPassThroughOptionType; + /** + * Uses to pass attributes to the action's DOM element. + */ + action?: DockPassThroughOptionType; + /** + * Uses to pass attributes to the icon's DOM element. + */ + icon?: DockPassThroughOptionType; +} + +/** + * 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. + * @defaultvalue -3 + */ + currentIndex: number; + /** + * Current focus state as a boolean. + * @defaultValue false + */ + focused: boolean; + /** + * Current focused item index as a number. + * @defaultvalue -1 + */ + focusedOptionIndex: number; +} + /** * Defines tooltip options */ @@ -77,6 +154,11 @@ export interface DockProps { * Establishes a string value that labels the component. */ 'aria-label'?: string | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {DockPassThroughOptions} + */ + pt?: DockPassThroughOptions; } /** diff --git a/components/lib/dock/Dock.vue b/components/lib/dock/Dock.vue index 3ffb265b9..44e6b2adf 100644 --- a/components/lib/dock/Dock.vue +++ b/components/lib/dock/Dock.vue @@ -1,14 +1,16 @@