Skip to content

Commit

Permalink
adds date datatype #147
Browse files Browse the repository at this point in the history
  • Loading branch information
chrabyrd committed Jan 3, 2025
1 parent 10b4718 commit e4ddace
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 0 deletions.
33 changes: 33 additions & 0 deletions arches_lingo/src/arches_lingo/components/generic/DateDatatype.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<script setup lang="ts">
import DateDatatypeViewer from "@/arches_lingo/components/generic/date-datatype/DateDatatypeViewer.vue";
import DateDatatypeEditor from "@/arches_lingo/components/generic/date-datatype/DateDatatypeEditor.vue";
import { EDIT, VIEW } from "@/arches_lingo/constants.ts";
import type { DataComponentMode } from "@/arches_lingo/types.ts";
const { mode = VIEW } = defineProps<{
mode?: DataComponentMode;
value?: string;
}>();
const emits = defineEmits(["update"]);
const onUpdate = (val: string) => {
emits("update", val);
};
</script>

<template>
<div>
<div v-if="mode === VIEW">
<DateDatatypeViewer :value="value" />
</div>
<div v-if="mode === EDIT">
<DateDatatypeEditor
:value="value"
@update="onUpdate"
/>
</div>
</div>
</template>
12 changes: 12 additions & 0 deletions arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
fetchTextualWorkRdmSystemList,
} from "@/arches_lingo/api.ts";
import DateDatatype from "@/arches_lingo/components/generic/DateDatatype.vue";
import NonLocalizedString from "@/arches_lingo/components/generic/NonLocalizedString.vue";
import ReferenceDatatype from "@/arches_lingo/components/generic/ReferenceDatatype.vue";
import ResourceInstanceRelationships from "@/arches_lingo/components/generic/ResourceInstanceRelationships.vue";
Expand Down Expand Up @@ -155,11 +156,22 @@ onMounted(async () => {
:options="metatypeOptions"
@update="onUpdate"
/>

<!-- Label Temporal Validity Start: date -->
<label for="">{{ $gettext("Label Temporal Validity Start") }}</label>
<DateDatatype
:value="value?.appellative_status_timespan_begin_of_the_begin"
:mode="EDIT"
@update="onUpdate"
/>

<!-- Label Temporal Validity End: date -->
<label for="">{{ $gettext("Label Temporal Validity End") }}</label>
<DateDatatype
:value="value?.appellative_status_timespan_end_of_the_end"
:mode="EDIT"
@update="onUpdate"
/>

<!-- Contributor: resource instance -->
<label for="">{{ $gettext("Contributor") }}</label>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script setup lang="ts">
import { toRef, watch } from "vue";
import DatePicker from "primevue/datepicker";
const props = defineProps<{
value: string | undefined;
}>();
const emit = defineEmits(["update"]);
const modelValue = toRef(props.value);
watch(
() => props.value,
(newValue) => {
modelValue.value = newValue;
},
);
</script>

<template>
<DatePicker
v-model="modelValue"
show-icon
icon-display="input"
date-format="yy-mm-dd"
@update:model-value="() => emit('update', modelValue)"
/>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script setup lang="ts">
import { toRef, watch } from "vue";
import DatePicker from "primevue/datepicker";
const props = defineProps<{
value: string | undefined;
}>();
const modelValue = toRef(props.value);
watch(
() => props.value,
(newValue) => {
modelValue.value = newValue;
},
);
</script>

<template>
<DatePicker
v-model="modelValue"
disabled
date-format="yy-mm-dd"
/>
</template>
2 changes: 2 additions & 0 deletions arches_lingo/src/arches_lingo/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ export interface AppellativeStatus {
appellative_status_data_assignment_object_used: ResourceInstanceReference[];
appellative_status_data_assignment_actor: ResourceInstanceReference[];
appellative_status_data_assignment_type: ControlledListItem[];
appellative_status_timespan_begin_of_the_begin: string;
appellative_status_timespan_end_of_the_end: string;
}

export interface SchemeInstance {
Expand Down

0 comments on commit e4ddace

Please sign in to comment.