2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 10:58:59 +00:00

Merge pull request #1060 from frappe/fix-check-control

fix: null value assigned to controls
This commit is contained in:
Akshay 2024-12-17 10:46:54 +05:30 committed by GitHub
commit 4a69be8303
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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;
}