Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

genericizes label viewer #161

Open
wants to merge 4 commits into
base: adg/146-scheme-names
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 0 additions & 163 deletions arches_lingo/src/arches_lingo/components/generic/LabelViewer.vue

This file was deleted.

136 changes: 136 additions & 0 deletions arches_lingo/src/arches_lingo/components/generic/MetaStringViewer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<script setup lang="ts">
import { ref } from "vue";
import { useGettext } from "vue3-gettext";
import DataTable from "primevue/datatable";
import Column from "primevue/column";
import Button from "primevue/button";
import ConfirmDialog from "primevue/confirmdialog";
import { useConfirm } from "primevue/useconfirm";

import type { MetaString, MetaStringText } from "@/arches_lingo/types.ts";

const { $gettext } = useGettext();
const expandedRows = ref([]);
const confirm = useConfirm();

const props = defineProps<{
metaStringText: MetaStringText;
metaStrings?: object[];
}>();

const emits = defineEmits(["editString", "deleteString"]);

function confirmDelete(tileId: string) {
confirm.require({
header: $gettext("Confirmation"),
message: props.metaStringText.deleteConfirm,
accept: () => {
emits("deleteString", tileId);
},
rejectProps: {
label: $gettext("Cancel"),
severity: "secondary",
outlined: true,
},
acceptProps: {
label: $gettext("Delete"),
severity: "danger",
},
});
}
</script>

<template>
<ConfirmDialog
:pt="{ root: { style: { fontFamily: 'sans-serif' } } }"
></ConfirmDialog>
<DataTable
v-model:expanded-rows="expandedRows"
:value="props.metaStrings"
table-style="min-width: 50rem"
>
<Column
expander
style="width: 3rem"
/>
<Column
:header="props.metaStringText.name"
sortable
>
<template #body="slotProps">
<slot
name="name"
:row-data="slotProps.data"
></slot>
</template>
</Column>
<Column
:header="props.metaStringText.type"
sortable
>
<template #body="slotProps">
<slot
name="type"
:row-data="slotProps.data"
></slot>
</template>
</Column>
<Column
:header="props.metaStringText.language"
sortable
>
<template #body="slotProps">
<slot
name="language"
:row-data="slotProps.data"
></slot>
</template>
</Column>
<Column>
<template #body="slotProps">
<div class="controls">
<Button
icon="pi pi-file-edit"
:aria-label="$gettext('edit')"
@click="
() =>
emits(
'editString',
(slotProps.data as MetaString).tileid,
)
"
/>
<Button
icon="pi pi-trash"
:aria-label="$gettext('delete')"
severity="danger"
outlined
@click="
() =>
confirmDelete(
(slotProps.data as MetaString).tileid,
)
"
/>
</div>
</template>
</Column>
<template #expansion="slotProps">
<div class="drawer">
<slot
name="drawer"
:row-data="slotProps.data"
></slot>
</div>
</template>
</DataTable>
</template>
<style scoped>
.controls {
display: flex;
flex-direction: row;
}
.controls button {
margin: 0 0.5rem;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import ResourceInstanceRelationshipsViewer from "@/arches_lingo/components/generic//resource-instance-relationships/ResourceInstanceRelationshipsViewer.vue";
import ResourceInstanceRelationshipsViewer from "@/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsViewer.vue";
import ResourceInstanceRelationshipsEditor from "@/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsEditor.vue";
import { EDIT, VIEW } from "@/arches_lingo/constants.ts";
import type {
Expand Down
Loading
Loading