From 7b2737df312ea8e1dc53662fe3b4902ecbbcf78b Mon Sep 17 00:00:00 2001 From: Aaron Gundel Date: Mon, 23 Dec 2024 16:48:16 -0700 Subject: [PATCH 1/2] genericizes label viewer --- .../components/generic/ControlledListItem.vue | 6 +- .../components/generic/LabelViewer.vue | 66 ++++++------------- .../components/generic/NonLocalizedString.vue | 4 +- .../generic/ResourceInstanceRelationships.vue | 6 +- .../components/scheme/report/SchemeLabel.vue | 52 ++++++++++++++- 5 files changed, 78 insertions(+), 56 deletions(-) diff --git a/arches_lingo/src/arches_lingo/components/generic/ControlledListItem.vue b/arches_lingo/src/arches_lingo/components/generic/ControlledListItem.vue index 695c039..c650fb3 100644 --- a/arches_lingo/src/arches_lingo/components/generic/ControlledListItem.vue +++ b/arches_lingo/src/arches_lingo/components/generic/ControlledListItem.vue @@ -3,12 +3,12 @@ import type { ControlledListItem, DataComponentMode, } from "@/arches_lingo/types"; -import ControlledListItemViewer from "@/arches_lingo/components/generic/ControlledListItemViewer.vue"; +import ControlledListItemViewer from "@/arches_lingo/components/generic/controlled-list-item/ControlledListItemViewer.vue"; import { EDIT, VIEW } from "@/arches_lingo/constants.ts"; -const { mode = EDIT } = defineProps<{ +const { mode = VIEW } = defineProps<{ mode?: DataComponentMode; - value?: ControlledListItem; + value?: ControlledListItem[] | ControlledListItem; }>(); defineEmits(["update"]); diff --git a/arches_lingo/src/arches_lingo/components/generic/LabelViewer.vue b/arches_lingo/src/arches_lingo/components/generic/LabelViewer.vue index 20a3d38..68c573a 100644 --- a/arches_lingo/src/arches_lingo/components/generic/LabelViewer.vue +++ b/arches_lingo/src/arches_lingo/components/generic/LabelViewer.vue @@ -7,9 +7,6 @@ import Button from "primevue/button"; import ConfirmDialog from "primevue/confirmdialog"; import { useConfirm } from "primevue/useconfirm"; -import ControlledListItem from "@/arches_lingo/components/generic/ControlledListItemViewer.vue"; -import ResourceInstanceRelationships from "@/arches_lingo/components/generic/ResourceInstanceRelationships.vue"; - import type { AppellativeStatus } from "@/arches_lingo/types"; const { $gettext } = useGettext(); @@ -17,7 +14,7 @@ const expandedRows = ref([]); const confirm = useConfirm(); const props = defineProps<{ - value?: AppellativeStatus[]; + labels?: object[]; }>(); const emits = defineEmits(["editLabel", "deleteLabel"]); @@ -30,12 +27,12 @@ function confirmDelete(tileId: string) { emits("deleteLabel", tileId); }, rejectProps: { - label: "Cancel", + label: $gettext("Cancel"), severity: "secondary", outlined: true, }, acceptProps: { - label: "Delete", + label: $gettext("Delete"), severity: "danger", }, }); @@ -48,7 +45,7 @@ function confirmDelete(tileId: string) { > @@ -130,24 +118,10 @@ function confirmDelete(tileId: string) { diff --git a/arches_lingo/src/arches_lingo/components/generic/NonLocalizedString.vue b/arches_lingo/src/arches_lingo/components/generic/NonLocalizedString.vue index cf2ae83..e48ae27 100644 --- a/arches_lingo/src/arches_lingo/components/generic/NonLocalizedString.vue +++ b/arches_lingo/src/arches_lingo/components/generic/NonLocalizedString.vue @@ -1,10 +1,10 @@