Skip to content

Commit

Permalink
fix(ui): Replaced trim on change with trim on blur
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh4 committed Sep 10, 2024
1 parent 53b5765 commit c55e618
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions packages/libs/ui/src/components/forms/BaseInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ function getComputedInputValue<T extends AllowedInputValueTypes = any>(
return model && property
? computed<T>({
get: () => model[property],
set: (val: T) =>
setTimeout(
() => (model[property] = typeof val === 'string' && props.trim ? val.trim() : val)
),
set: (val: T) => (model[property] = val),
})
: computed<T>({
get: () => props.modelValue,
set: (val: T) =>
emit('update:modelValue', typeof val === 'string' && props.trim ? val.trim() : val),
set: (val: T) => emit('update:modelValue', val),
});
}

Expand Down Expand Up @@ -216,6 +212,20 @@ export function useBaseInputSetup<T extends AllowedInputValueTypes = any>(
}
},
onFocusOut: () => {
debugger;

Check failure on line 215 in packages/libs/ui/src/components/forms/BaseInput.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'debugger' statement
if (props.trim) {
const model = formModelData?.model;
const property = props.property;

const val = model && property ? model[property] : props.modelValue;
if (typeof val === 'string') {
if (model && property) {
model[property] = val.trim();
} else {
emit('update:modelValue', val.trim());
}
}
}
if (useAutoValidation) {
setTimeout(() => validator.validateField(props.property!), 50);
}
Expand Down

0 comments on commit c55e618

Please sign in to comment.