fix(files): use inline NcActions

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
pull/36534/head
John Molakvoæ 2023-03-28 12:28:49 +07:00
parent 7215a9ae9c
commit 4942747ff8
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
1 changed files with 12 additions and 19 deletions

@ -58,21 +58,12 @@
<!-- Actions -->
<td :class="`files-list__row-actions-${uniqueId}`" class="files-list__row-actions">
<!-- Inline actions -->
<template v-for="action in enabledInlineActions">
<!-- TODO: implement CustomElementRender -->
<NcButton :key="action.id"
type="tertiary"
@click="onActionClick(action)">
<template #icon>
<NcLoadingIcon v-if="loading === action.id" :size="18" />
<CustomSvgIconRender v-else :svg="action.iconSvgInline([source], currentView)" />
</template>
{{ action.displayName([source], currentView) }}
</NcButton>
</template>
<!-- TODO: implement CustomElementRender -->
<!-- Menu actions -->
<NcActions ref="actionsMenu" :force-menu="true">
<NcActions ref="actionsMenu"
:force-title="true"
:inline="enabledInlineActions.length">
<NcActionButton v-for="action in enabledMenuActions"
:key="action.id"
:class="'files-list__row-action-' + action.id"
@ -280,15 +271,17 @@ export default Vue.extend({
.sort((a, b) => (a.order || 0) - (b.order || 0))
},
enabledMenuActions() {
return actions
.filter(action => !action.inline)
},
enabledInlineActions() {
return this.enabledActions.filter(action => action?.inline?.(this.source, this.currentView))
},
enabledMenuActions() {
return [
...this.enabledInlineActions,
...actions.filter(action => !action.inline),
]
},
uniqueId() {
return this.hashCode(this.source.source)
},
@ -305,7 +298,7 @@ export default Vue.extend({
return
}
// Restore default tabindex
this.$el.parentNode.style.removeProperty('display')
this.$el.parentNode.style.display = ''
},
/**
* When the source changes, reset the preview