forked from pkp/ui-library
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7040ec0
commit 32e6455
Showing
13 changed files
with
409 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<template> | ||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
d="M20.5477 4.79141V14.8916C20.5471 15.0505 20.4836 15.2028 20.3713 15.3151C20.2589 15.4275 20.1067 15.491 19.9477 15.4916H16.9717V18.6141C16.9714 18.7732 16.9081 18.9256 16.7956 19.038C16.6832 19.1505 16.5308 19.2138 16.3717 19.2141H4.05215C3.89312 19.2138 3.7407 19.1505 3.62825 19.038C3.5158 18.9256 3.45248 18.7732 3.45215 18.6141V8.51393C3.45248 8.3549 3.5158 8.20249 3.62825 8.09004C3.7407 7.97759 3.89312 7.91427 4.05215 7.91393H7.02815V4.79141C7.02848 4.63238 7.0918 4.47996 7.20425 4.36751C7.3167 4.25506 7.46912 4.19174 7.62815 4.19141H19.9477C20.1068 4.19174 20.2592 4.25506 20.3716 4.36751C20.4841 4.47996 20.5474 4.63238 20.5477 4.79141ZM15.5709 15.4916H7.62941C7.47049 15.491 7.31826 15.4275 7.20588 15.3151C7.0935 15.2028 7.03008 15.0505 7.02941 14.8916V10.8962H4.85046V17.8133H15.5709V15.4916ZM19.1481 7.17372H8.42773V14.0908H19.1481V7.17372Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
</template> |
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
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,55 @@ | ||
<template> | ||
<PkpTable> | ||
<template #label>{{ t('submission.layout.galleys') }}</template> | ||
<template #bottom-controls> | ||
<div class="space-x-y flex"> | ||
<PkpButton | ||
v-for="action in galleyManagerStore.bottomActions" | ||
:key="action.name" | ||
class="-ms-3" | ||
is-link | ||
@click="galleyManagerStore.handleAction(action.name)" | ||
> | ||
{{ action.label }} | ||
</PkpButton> | ||
</div> | ||
</template> | ||
<TableHeader> | ||
<TableColumn>{{ t('common.name') }}</TableColumn> | ||
<TableColumn>{{ t('common.language') }}</TableColumn> | ||
<TableColumn> | ||
<span class="sr-only">{{ t('common.moreActions') }}</span> | ||
</TableColumn> | ||
</TableHeader> | ||
<TableBody> | ||
<GalleyManagerTableRow | ||
v-for="galley in galleyManagerStore.galleys" | ||
:key="galley.id" | ||
:galley="galley" | ||
:metadata-locales="submission.metadataLocales" | ||
:item-actions="galleyManagerStore.itemActions" | ||
@action="galleyManagerStore.handleAction" | ||
></GalleyManagerTableRow> | ||
</TableBody> | ||
</PkpTable> | ||
</template> | ||
|
||
<script setup> | ||
import {useLocalize} from '@/composables/useLocalize'; | ||
import {useGalleyManagerStore} from './galleyManagerStore'; | ||
import PkpTable from '@/components/TableNext/Table.vue'; | ||
import TableColumn from '@/components/TableNext/TableColumn.vue'; | ||
import TableHeader from '@/components/TableNext/TableHeader.vue'; | ||
import TableBody from '@/components/TableNext/TableBody.vue'; | ||
import GalleyManagerTableRow from './GalleyManagerTableRow.vue'; | ||
import PkpButton from '@/components/Button/Button.vue'; | ||
const props = defineProps({ | ||
publication: {type: Object, required: true}, | ||
submission: {type: Object, required: true}, | ||
}); | ||
const {t} = useLocalize(); | ||
const galleyManagerStore = useGalleyManagerStore(props); | ||
</script> |
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,60 @@ | ||
<template> | ||
<TableRow> | ||
<TableCell> | ||
<div class="flex items-center"> | ||
<Icon :icon="fileIcon" class="h-6 w-6 flex-none text-heading" /> | ||
|
||
<span class="ms-2 text-base-normal"> | ||
<a | ||
v-if="galley?.file?.url" | ||
class="hover:underline" | ||
target="_blank" | ||
:href="galley.file.url" | ||
> | ||
{{ galley.label }} | ||
</a> | ||
<template v-else>{{ galley.label }}</template> | ||
</span> | ||
</div> | ||
</TableCell> | ||
<TableCell> | ||
<span class="text-base-normal"> | ||
{{ language }} | ||
</span> | ||
</TableCell> | ||
<TableCell> | ||
<DropdownActions | ||
:label="t('common.moreActions')" | ||
:display-as-ellipsis="true" | ||
:actions="itemActions" | ||
@action="(actionName) => emit('action', actionName, {galley})" | ||
></DropdownActions> | ||
</TableCell> | ||
</TableRow> | ||
</template> | ||
<script setup> | ||
import {computed} from 'vue'; | ||
import Icon from '@/components/Icon/Icon.vue'; | ||
import TableRow from '@/components/TableNext/TableRow.vue'; | ||
import TableCell from '@/components/TableNext/TableCell.vue'; | ||
import DropdownActions from '@/components/DropdownActions/DropdownActions.vue'; | ||
const props = defineProps({ | ||
galley: {type: Object, required: true}, | ||
metadataLocales: {type: Object, required: true}, | ||
itemActions: {type: Array, required: true}, | ||
}); | ||
const emit = defineEmits(['action']); | ||
const language = computed(() => { | ||
return props.metadataLocales[props.galley.locale]; | ||
}); | ||
const fileIcon = computed(() => | ||
!!pkp.documentTypeIcons && | ||
!!pkp.documentTypeIcons[props.galley?.file?.documentType] | ||
? pkp.documentTypeIcons[props.galley?.file?.documentType] | ||
: 'DocumentDefault', | ||
); | ||
</script> |
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,46 @@ | ||
import {defineComponentStore} from '@/utils/defineComponentStore'; | ||
import {computed} from 'vue'; | ||
import {useGalleyManagerActions} from './useGalleyManagerActions'; | ||
import {useDataChanged} from '@/composables/useDataChanged'; | ||
|
||
export const useGalleyManagerStore = defineComponentStore( | ||
'galleyManager', | ||
(props) => { | ||
const galleys = computed(() => { | ||
return props?.publication?.galleys || []; | ||
}); | ||
|
||
/** Reload files when data on screen changes */ | ||
|
||
/** | ||
* Actions | ||
*/ | ||
const _galleyActionsFns = useGalleyManagerActions(); | ||
|
||
const itemActions = computed(() => _galleyActionsFns.getItemActions()); | ||
const bottomActions = computed(() => _galleyActionsFns.getBottomActions()); | ||
|
||
const {triggerDataChange} = useDataChanged(); | ||
|
||
function handleAction(actionName, _args = {}) { | ||
_galleyActionsFns.handleAction( | ||
actionName, | ||
{ | ||
..._args, | ||
submission: props.submission, | ||
publication: props.publication, | ||
}, | ||
() => { | ||
triggerDataChange(); | ||
}, | ||
); | ||
} | ||
return { | ||
galleys, | ||
itemActions, | ||
bottomActions, | ||
_galleyActionsFns, | ||
handleAction, | ||
}; | ||
}, | ||
); |
Oops, something went wrong.