-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
6a9627e
commit 2edd1de
Showing
5 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
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,44 @@ | ||
<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"; | ||
interface Props { | ||
dateFormat?: string; | ||
mode?: DataComponentMode; | ||
value?: string; | ||
} | ||
withDefaults(defineProps<Props>(), { | ||
dateFormat: "yy-mm-dd", | ||
mode: VIEW, | ||
value: "", | ||
}); | ||
const emits = defineEmits(["update"]); | ||
const onUpdate = (val: string) => { | ||
emits("update", val); | ||
}; | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div v-if="mode === VIEW"> | ||
<DateDatatypeViewer | ||
:date-format="dateFormat" | ||
:value="value" | ||
/> | ||
</div> | ||
<div v-if="mode === EDIT"> | ||
<DateDatatypeEditor | ||
:date-format="dateFormat" | ||
: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
31 changes: 31 additions & 0 deletions
31
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,31 @@ | ||
<script setup lang="ts"> | ||
import { toRef, watch } from "vue"; | ||
import DatePicker from "primevue/datepicker"; | ||
const props = defineProps<{ | ||
value: string | undefined; | ||
dateFormat: string; | ||
}>(); | ||
const emit = defineEmits(["update"]); | ||
const modelValue = toRef(props.value); | ||
watch( | ||
() => props.value, | ||
(newValue) => { | ||
modelValue.value = newValue; | ||
}, | ||
); | ||
</script> | ||
|
||
<template> | ||
<DatePicker | ||
v-model="modelValue" | ||
icon-display="input" | ||
:date-format="dateFormat" | ||
show-icon | ||
@update:model-value="() => emit('update', modelValue)" | ||
/> | ||
</template> |
27 changes: 27 additions & 0 deletions
27
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,27 @@ | ||
<script setup lang="ts"> | ||
import { toRef, watch } from "vue"; | ||
import DatePicker from "primevue/datepicker"; | ||
const props = defineProps<{ | ||
value: string | undefined; | ||
dateFormat: string; | ||
}>(); | ||
const modelValue = toRef(props.value); | ||
watch( | ||
() => props.value, | ||
(newValue) => { | ||
modelValue.value = newValue; | ||
}, | ||
); | ||
</script> | ||
|
||
<template> | ||
<DatePicker | ||
v-model="modelValue" | ||
:date-format="dateFormat" | ||
disabled | ||
/> | ||
</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