2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 02:49:03 +00:00

fix: null value assigned to controls

This commit is contained in:
akshayitzme 2024-12-17 10:39:51 +05:30
parent d2ea4cb751
commit 061745907d

View File

@ -21,7 +21,6 @@
@blur="onBlur"
@focus="(e) => !isReadOnly && $emit('focus', e)"
@input="(e) => !isReadOnly && $emit('input', e)"
@keydown.enter="setLoyaltyPoints"
/>
</div>
</div>
@ -50,7 +49,6 @@ export default defineComponent({
border: { type: Boolean, default: false },
size: { type: String, default: 'large' },
placeholder: String,
focusInput: Boolean,
showLabel: { type: Boolean, default: false },
containerStyles: { type: Object, default: () => ({}) },
textRight: {
@ -66,15 +64,6 @@ export default defineComponent({
default: null,
},
},
async created() {
if (this.focusInput) {
await this.$nextTick();
(this.$refs.input as HTMLInputElement).focus();
if (this.value == 0) {
this.triggerChange('');
}
}
},
emits: ['focus', 'input', 'change'],
computed: {
doc(): Doc | undefined {
@ -202,12 +191,6 @@ export default defineComponent({
},
},
methods: {
setLoyaltyPoints() {
const inputElement = this.$refs.input as HTMLInputElement;
if (inputElement && inputElement?.value) {
this.$emit('change', inputElement.value);
}
},
onBlur(e: FocusEvent) {
const target = e.target;
if (!(target instanceof HTMLInputElement)) {
@ -244,7 +227,7 @@ export default defineComponent({
triggerChange(value: unknown): void {
value = this.parse(value);
if (value === '' || value == 0) {
if (value === '') {
value = null;
}