|
|
|
@ -15,7 +15,7 @@ |
|
|
|
<NcIconSvgWrapper :key="editSvg" :svg="editSvg" aria-hidden="true" /> |
|
|
|
</template> |
|
|
|
</NcActionButton> |
|
|
|
<NcActionButton v-for="({ action, icon, text }, index) in actions" |
|
|
|
<NcActionButton v-for="({ action, icon, text }, index) in enabledActions" |
|
|
|
:key="index" |
|
|
|
:disabled="disabled" |
|
|
|
:aria-label="text" |
|
|
|
@ -38,8 +38,9 @@ import SvgPencil from '@mdi/svg/svg/pencil.svg?raw' |
|
|
|
|
|
|
|
interface UserAction { |
|
|
|
action: (event: MouseEvent, user: Record<string, unknown>) => void, |
|
|
|
enabled?: (user: Record<string, unknown>) => boolean, |
|
|
|
icon: string, |
|
|
|
text: string |
|
|
|
text: string, |
|
|
|
} |
|
|
|
|
|
|
|
export default defineComponent({ |
|
|
|
@ -87,9 +88,16 @@ export default defineComponent({ |
|
|
|
/** |
|
|
|
* Current MDI logo to show for edit toggle |
|
|
|
*/ |
|
|
|
editSvg() { |
|
|
|
editSvg(): string { |
|
|
|
return this.edit ? SvgCheck : SvgPencil |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Enabled user row actions |
|
|
|
*/ |
|
|
|
enabledActions(): UserAction[] { |
|
|
|
return this.actions.filter(action => typeof action.enabled === 'function' ? action.enabled(this.user) : true) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
|