-
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
Showing
5 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
arches_lingo/src/arches_lingo/components/generic/DateDatatype.vue
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,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> |
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
30 changes: 30 additions & 0 deletions
30
arches_lingo/src/arches_lingo/components/generic/date-datatype/DateDatatypeEditor.vue
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,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> |
26 changes: 26 additions & 0 deletions
26
arches_lingo/src/arches_lingo/components/generic/date-datatype/DateDatatypeViewer.vue
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,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> |
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