Skip to content

Commit

Permalink
Fixed #1490 - Add tooltipOptions property to Dock
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Aug 31, 2021
1 parent a89c51b commit aeba883
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/components/dock/Dock.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface DockProps {
class?: string;
style?: any;
exact?: boolean;
tooltipOptions?: any;
}

declare class Dock {
Expand Down
3 changes: 2 additions & 1 deletion src/components/dock/Dock.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div :class="containerClass" :style="style">
<DockSub :model="model" :template="$slots.item" :exact="exact"></DockSub>
<DockSub :model="model" :template="$slots.item" :exact="exact" :tooltipOptions="tooltipOptions"></DockSub>
</div>
</template>

Expand All @@ -17,6 +17,7 @@ export default {
model: null,
class: null,
style: null,
tooltipOptions: null,
exact: {
type: Boolean,
default: true
Expand Down
7 changes: 4 additions & 3 deletions src/components/dock/DockSub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<template v-if="!template">
<router-link v-if="item.to && !disabled(item)" :to="item.to" custom v-slot="{navigate, href, isActive, isExactActive}">
<a :href="href" role="menuitem" :class="linkClass(item, {isActive, isExactActive})" :target="item.target"
:data-pr-tooltip="item.label" @click="onItemClick($event, item, navigate)">
v-tooltip:[tooltipOptions]="{value: item.label, disabled: !tooltipOptions}" @click="onItemClick($event, item, navigate)">
<template v-if="typeof item.icon === 'string'">
<span :class="['p-dock-action-icon', item.icon]" v-ripple></span>
</template>
<component v-else :is="item.icon"></component>
</a>
</router-link>
<a v-else :href="item.url" role="menuitem" :class="linkClass(item)" :target="item.target"
:data-pr-tooltip="item.label" @click="onItemClick($event, item)" :tabindex="disabled(item) ? null : '0'">
v-tooltip:[tooltipOptions]="{value: item.label, disabled: !tooltipOptions}" @click="onItemClick($event, item)" :tabindex="disabled(item) ? null : '0'">
<template v-if="typeof item.icon === 'string'">
<span :class="['p-dock-action-icon', item.icon]" v-ripple></span>
</template>
Expand Down Expand Up @@ -41,7 +41,8 @@ export default {
exact: {
type: Boolean,
default: true
}
},
tooltipOptions: null
},
data() {
return {
Expand Down

0 comments on commit aeba883

Please sign in to comment.