2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 10:58:59 +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" @blur="onBlur"
@focus="(e) => !isReadOnly && $emit('focus', e)" @focus="(e) => !isReadOnly && $emit('focus', e)"
@input="(e) => !isReadOnly && $emit('input', e)" @input="(e) => !isReadOnly && $emit('input', e)"
@keydown.enter="setLoyaltyPoints"
/> />
</div> </div>
</div> </div>
@ -50,7 +49,6 @@ export default defineComponent({
border: { type: Boolean, default: false }, border: { type: Boolean, default: false },
size: { type: String, default: 'large' }, size: { type: String, default: 'large' },
placeholder: String, placeholder: String,
focusInput: Boolean,
showLabel: { type: Boolean, default: false }, showLabel: { type: Boolean, default: false },
containerStyles: { type: Object, default: () => ({}) }, containerStyles: { type: Object, default: () => ({}) },
textRight: { textRight: {
@ -66,15 +64,6 @@ export default defineComponent({
default: null, 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'], emits: ['focus', 'input', 'change'],
computed: { computed: {
doc(): Doc | undefined { doc(): Doc | undefined {
@ -202,12 +191,6 @@ export default defineComponent({
}, },
}, },
methods: { methods: {
setLoyaltyPoints() {
const inputElement = this.$refs.input as HTMLInputElement;
if (inputElement && inputElement?.value) {
this.$emit('change', inputElement.value);
}
},
onBlur(e: FocusEvent) { onBlur(e: FocusEvent) {
const target = e.target; const target = e.target;
if (!(target instanceof HTMLInputElement)) { if (!(target instanceof HTMLInputElement)) {
@ -244,7 +227,7 @@ export default defineComponent({
triggerChange(value: unknown): void { triggerChange(value: unknown): void {
value = this.parse(value); value = this.parse(value);
if (value === '' || value == 0) { if (value === '') {
value = null; value = null;
} }