-
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.
Stub out reference dt widget rename from controlledlistitem
- Loading branch information
1 parent
78c91c7
commit f459ca5
Showing
8 changed files
with
148 additions
and
22 deletions.
There are no files selected for viewing
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
22 changes: 0 additions & 22 deletions
22
arches_lingo/src/arches_lingo/components/generic/ControlledListItem.vue
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
arches_lingo/src/arches_lingo/components/generic/ReferenceDatatype.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,40 @@ | ||
<script setup lang="ts"> | ||
import type { | ||
ControlledListItem, | ||
DataComponentMode, | ||
} from "@/arches_lingo/types"; | ||
import ReferenceDatatypeViewer from "@/arches_lingo/components/generic/reference-datatype/ReferenceDatatypeViewer.vue"; | ||
import ReferenceDatatypeEditor from "@/arches_lingo/components/generic/reference-datatype/ReferenceDatatypeEditor.vue"; | ||
import ReferenceDatatypeListEditor from "@/arches_lingo/components/generic/reference-datatype/ReferenceDatatypeListEditor.vue"; | ||
import { EDIT, VIEW } from "@/arches_lingo/constants.ts"; | ||
const { mode = VIEW } = defineProps<{ | ||
mode?: DataComponentMode; | ||
value?: ControlledListItem | ControlledListItem[]; | ||
multiValue?: string; | ||
options?: ControlledListItem[]; | ||
}>(); | ||
const emits = defineEmits(["update"]); | ||
const onUpdate = (val: ControlledListItem) => { | ||
emits("update", val); | ||
}; | ||
</script> | ||
<template> | ||
<div> | ||
<div v-if="mode === VIEW"> | ||
<ReferenceDatatypeViewer :value="value" /> | ||
</div> | ||
<div v-if="mode === EDIT && multiValue === '1'"> | ||
<ReferenceDatatypeEditor | ||
:value="value" | ||
@update="onUpdate" | ||
/> | ||
</div> | ||
<div v-if="mode === EDIT && multiValue === 'n'"> | ||
<ReferenceDatatypeListEditor | ||
:value="value" | ||
@update="onUpdate" | ||
/> | ||
</div> | ||
</div> | ||
</template> |
52 changes: 52 additions & 0 deletions
52
..._lingo/src/arches_lingo/components/generic/reference-datatype/ReferenceDatatypeEditor.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,52 @@ | ||
<script setup lang="ts"> | ||
// import { computed, inject, toRef } from "vue"; | ||
import { computed, toRef } from "vue"; | ||
import Select from "primevue/select"; | ||
// import { getItemLabel } from "@/arches_vue_utils/utils.ts"; | ||
// import { systemLanguageKey } from "@/arches_references/constants.ts"; | ||
import type { ControlledListItem } from "@/arches_lingo/types"; | ||
// import type { Language } from "@/arches_vue_utils/types.ts"; | ||
// const systemLanguage = inject(systemLanguageKey) as Language; | ||
const props = withDefaults( | ||
defineProps<{ | ||
val?: ControlledListItem; | ||
options?: ControlledListItem[]; | ||
}>(), | ||
{ | ||
options: () => [], | ||
}, | ||
); | ||
console.log(props); | ||
const emit = defineEmits(["update"]); | ||
const valRef = toRef(props, "val"); | ||
const value = computed({ | ||
get() { | ||
return valRef.value; | ||
}, | ||
set(value) { | ||
emit("update", value); | ||
}, | ||
}); | ||
// const getOptionLabels = (value) => { | ||
// return getItemLabel(value, selectedLanguage.value.code, systemLanguage.code) | ||
// .value; | ||
// }; | ||
// :optionLabel="getOptionLabels" | ||
</script> | ||
<template> | ||
<Select | ||
v-model="value" | ||
:show-toggle-all="!!options?.length" | ||
:options | ||
:pt="{ | ||
emptyMessage: { style: { fontFamily: 'sans-serif' } }, | ||
option: { style: { fontFamily: 'sans-serif' } }, | ||
}" | ||
:placeholder="$gettext('Select References')" | ||
/> | ||
</template> |
46 changes: 46 additions & 0 deletions
46
...go/src/arches_lingo/components/generic/reference-datatype/ReferenceDatatypeListEditor.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,46 @@ | ||
<script setup lang="ts"> | ||
import { computed, toRef } from "vue"; | ||
import MultiSelect from "primevue/multiselect"; | ||
// import { getItemLabel } from "@/arches_vue_utils/utils.ts"; | ||
import type { ControlledListItem } from "@/arches_lingo/types"; | ||
const props = withDefaults( | ||
defineProps<{ | ||
val?: ControlledListItem; | ||
options?: ControlledListItem[]; | ||
}>(), | ||
{ | ||
options: () => [], | ||
}, | ||
); | ||
const emit = defineEmits(["update"]); | ||
const valRef = toRef(props, "val"); | ||
const value = computed({ | ||
get() { | ||
return valRef.value; | ||
}, | ||
set(value) { | ||
emit("update", value); | ||
}, | ||
}); | ||
// const getOptionLabels = (option: ControlledListItem) => { | ||
// return getItemLabel(option); | ||
// }; | ||
// :option-label="getOptionLabels" | ||
</script> | ||
<template> | ||
<MultiSelect | ||
v-model="value" | ||
:show-toggle-all="!!options?.length" | ||
:options | ||
:pt="{ | ||
emptyMessage: { style: { fontFamily: 'sans-serif' } }, | ||
option: { style: { fontFamily: 'sans-serif' } }, | ||
}" | ||
:placeholder="$gettext('Select References')" | ||
/> | ||
</template> |
File renamed without changes.
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
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