Skip to content

Commit

Permalink
fix: add blur handler for text fields
Browse files Browse the repository at this point in the history
  • Loading branch information
RitvikSardana committed Dec 18, 2024
1 parent b83dcb3 commit 3cc7765
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions desk/src/components/UniInput2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,26 @@
>
<component
:is="component"
:key="transValue"
:key="field.fieldname"
class="form-control"
:placeholder="`Add ${field.label}`"
:value="transValue"
@change="
emitUpdate(field.fieldname, $event.value || $event.target.value)
v-on="
textFields.includes(field.fieldtype)
? {
blur: (event) =>
emitUpdate(
field.fieldname,
event.value || event.target.value
),
}
: {
change: (event) =>
emitUpdate(
field.fieldname,
event.value || event.target.value
),
}
"
/>
</div>
Expand Down Expand Up @@ -47,6 +61,8 @@ interface E {
const props = defineProps<P>();
const emit = defineEmits<E>();
const textFields = ["Long Text", "Small Text", "Text"];
const component = computed(() => {
if (props.field.url_method) {
return h(Autocomplete, {
Expand Down Expand Up @@ -75,9 +91,7 @@ const component = computed(() => {
},
],
});
} else if (
["Long Text", "Small Text", "Text"].includes(props.field.fieldtype)
) {
} else if (textFields.includes(props.field.fieldtype)) {
return h(FormControl, {
type: "textarea",
});
Expand Down

0 comments on commit 3cc7765

Please sign in to comment.