Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add blur handler for text fields #2100

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading