Skip to content

Commit

Permalink
New field type: option-custom (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchop authored Mar 19, 2024
1 parent 067784b commit 5ee722e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
28 changes: 24 additions & 4 deletions src/components/ObjectFields.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<template>
<div v-if="object">
<div v-for="field in fields">
<v-text-field v-if="field.type === 'text'" :label="field.label" v-model="object[field.field]"></v-text-field>
<v-text-field
density="default"
v-if="field.type === 'text'"
:label="field.label"
v-model="object[field.field]"
></v-text-field>
<v-textarea v-if="field.type === 'longtext'" :label="field.label" v-model="object[field.field]"></v-textarea>
<v-combobox
v-if="field.type === 'list' && field.field !== 'tags'"
Expand All @@ -10,14 +15,19 @@
chips
clearable
multiple
density="compact"
density="default"
:delimiters="[',', ' ', ';']"
prepend-inner-icon="mdi-tag"
>
<template v-slot:chip="tag"> <v-chip :text="tag.item.value" label size="large" color="primary" /></template>
</v-combobox>

<v-text-field v-if="field.type === 'date'" v-model="object[field.field]" :label="field.label"></v-text-field>
<v-text-field
density="default"
v-if="field.type === 'date'"
v-model="object[field.field]"
:label="field.label"
></v-text-field>

<v-textarea
v-if="field.type === 'code'"
Expand All @@ -31,11 +41,21 @@
v-model="object[field.field]"
:items="field.choices"
:label="field.label"
density="default"
variant="outlined"
></v-select>

<v-combobox
v-if="field.type === 'option-custom'"
v-model="object[field.field]"
:items="field.choices"
:label="field.label"
density="default"
variant="outlined"
></v-combobox>

<v-checkbox
density="compact"
density="default"
:indeterminate="object[field.field] === null"
v-if="field.type === 'bool'"
:label="field.label"
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/indicatorDefinitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const INDICATOR_TYPES = [
{ field: "relevant_tags", type: "list", label: "Relevant tags", displayList: true, editable: true },
{
field: "query_type",
type: "option",
type: "option-custom",
choices: QUERY_TYPES,
label: "Query type",
displayList: true,
Expand Down

0 comments on commit 5ee722e

Please sign in to comment.