Skip to content

Commit

Permalink
fix: null value assigned to controls
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayitzme committed Dec 17, 2024
1 parent d2ea4cb commit 0617459
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/components/Controls/Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
@blur="onBlur"
@focus="(e) => !isReadOnly && $emit('focus', e)"
@input="(e) => !isReadOnly && $emit('input', e)"
@keydown.enter="setLoyaltyPoints"
/>
</div>
</div>
Expand Down Expand Up @@ -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: {
Expand All @@ -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 {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -244,7 +227,7 @@ export default defineComponent({
triggerChange(value: unknown): void {
value = this.parse(value);
if (value === '' || value == 0) {
if (value === '') {
value = null;
}
Expand Down

0 comments on commit 0617459

Please sign in to comment.