-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat : add document action entry and document actions
- Loading branch information
Showing
6 changed files
with
196 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<template> | ||
<b-button-group class="document-actions align-items-center" :vertical="vertical" size="sm"> | ||
<slot name="selection" v-bind="{document}"> | ||
|
||
</slot> | ||
<slot name="actions" v-bind="{document}"> | ||
<document-actions-entry icon-name="star" label="Star" @click="clickStar" :tooltipPlacement="tooltipPlacement" :isFilled="isStarred"/> | ||
<document-actions-entry icon-name="share" label="Share" @click="clickShare" :tooltipPlacement="tooltipPlacement"/> | ||
<document-actions-entry icon-name="download" :disabled="isDownloadAllowed" @click="clickDownload" :label="downloadLabel" :tooltipPlacement="tooltipPlacement" /> | ||
<document-actions-entry icon-name="arrows-out-simple" label="Expand" @click="clickExpand" :tooltipPlacement="tooltipPlacement"/> | ||
</slot> | ||
|
||
</b-button-group> | ||
</template> | ||
|
||
<script setup> | ||
import { findIndex, uniqueId } from 'lodash' | ||
import { mapState, useStore } from 'vuex' | ||
import { FontAwesomeLayers } from '@fortawesome/vue-fontawesome' | ||
import { computed } from 'vue' | ||
import { useI18n } from 'vue-i18n' | ||
import RouterLinkPopup from '@/components/RouterLinkPopup' | ||
import DocumentActionsEntry from '@/components/DocumentActionsEntry' | ||
defineProps({ | ||
/** | ||
* The selected document | ||
*/ | ||
document: { | ||
type: Object | ||
}, | ||
/** | ||
* Use a vertical layoutk | ||
*/ | ||
vertical: { | ||
type: Boolean | ||
}, | ||
/** | ||
* Tooltip's placement on each action using Floating UI: https://floating-ui.com/docs/tutorial#placements | ||
* @values 'auto', 'auto-start', 'auto-end', 'top', 'right', 'bottom', 'left', 'top-start', 'right-start', 'bottom-start', 'left-start', 'top-end', 'right-end', 'bottom-end', 'left-end' | ||
*/ | ||
tooltipPlacement: { | ||
type: String, | ||
default: 'top' | ||
}, | ||
/** | ||
* True if download is allowed for the document | ||
*/ | ||
isDownloadAllowed: { | ||
type: Boolean | ||
}, | ||
/** | ||
* True if download is allowed for the document | ||
*/ | ||
isStarred: { | ||
type: Boolean | ||
} | ||
}) | ||
const { t } = useI18n() | ||
const emit = defineEmits(['click-star','click-download','click-share','click-expand']) | ||
async function clickStar() { | ||
emit("click-star", {id:document.id}) | ||
} | ||
async function clickDownload() { | ||
emit("click-download", {id:document.id}) | ||
} | ||
async function clickShare() { | ||
emit("click-share", {id:document.id}) | ||
} | ||
async function clickExpand() { | ||
emit("click-expand", {id:document.id}) | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.document-actions { | ||
.btn-group { | ||
.btn:not(:first-of-type) { | ||
border-top-right-radius: 0; | ||
border-bottom-right-radius: 0; | ||
} | ||
.dropdown:last-of-type { | ||
display: inline-flex; | ||
&:deep(.btn) { | ||
border-top-left-radius: 0; | ||
border-bottom-left-radius: 0; | ||
} | ||
} | ||
} | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import DocumentActionsEntry from '@/components/DocumentActionsEntry' | ||
|
||
export default { | ||
components: { DocumentActionsEntry }, | ||
title: 'Components/DocumentActionsGroup/Entry', | ||
component: DocumentActionsEntry, | ||
tags: ['autodocs'] | ||
} | ||
|
||
export const Default = { | ||
args: { | ||
iconName: 'star', | ||
label: 'Star', | ||
tooltipPlacement: 'right', | ||
tooltipLabel: 'Test', | ||
filledBtnClass: 'starred', | ||
isFilled: false | ||
} | ||
} | ||
export const Filled = { | ||
args: { | ||
iconName: 'star', | ||
label: 'Star', | ||
tooltipLabel: 'Test', | ||
tooltipPlacement: 'right', | ||
isFilled: true | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import IconButton from '@/components/IconButton' | ||
import { vueRouter } from 'storybook-vue3-router' | ||
import DocumentActionsGroup from '@/components/DocumentActionsGroup' | ||
const routes = [{ name: 'document-modal',path: '/document-modal' }] | ||
|
||
export default { | ||
decorators: [vueRouter(routes)], | ||
components: { DocumentActionsGroup }, | ||
title: 'Components/DocumentActionsGroup', | ||
component: IconButton, | ||
tags: ['autodocs'], | ||
render: (args) => ({ | ||
components: { | ||
DocumentActionsGroup | ||
}, | ||
setup() { | ||
return { | ||
args | ||
} | ||
}, | ||
template: ` | ||
<document-actions-group v-bind="args" /> | ||
` | ||
}) | ||
} | ||
|
||
export const Default = { | ||
args: { | ||
document: { | ||
id:"test" | ||
}, | ||
vertical: false, | ||
tooltipPlacement: 'top', | ||
isStarred: false, | ||
isDownloadAllowed: false | ||
} | ||
} |