Prevent duplicate event invocation

pull/1478/head
Cagatay Civici 2021-08-25 10:09:50 +03:00
parent a3e3058c2f
commit cae2bf165a
8 changed files with 6 additions and 48 deletions

View File

@ -55,14 +55,6 @@ const CheckboxEvents = [
{
name: "input",
description: "Callback to invoke on value change."
},
{
name: "focus",
description: "Callback to invoke when element receives focus."
},
{
name: "blur",
description: "Callback to invoke when element loses focus."
}
];

View File

@ -43,14 +43,6 @@ const InputSwitchEvents = [
{
name: "input",
description: "Callback to invoke on value change."
},
{
name: "focus",
description: "Callback to invoke when element receives focus."
},
{
name: "blur",
description: "Callback to invoke when element loses focus."
}
];

View File

@ -14,8 +14,6 @@ declare class Checkbox {
$emit(eventName: 'click', event: Event): this;
$emit(eventName: 'change', event: Event): this;
$emit(eventName: 'input', value: boolean): this;
$emit(eventName: 'focus', event: Event): this;
$emit(eventName: 'blur', event: Event): this;
}
export default Checkbox;

View File

@ -15,7 +15,7 @@ import {ObjectUtils} from 'primevue/utils';
export default {
name: 'Checkbox',
inheritAttrs: false,
emits: ['click', 'update:modelValue', 'change'],
emits: ['click', 'update:modelValue', 'change', 'input'],
props: {
value: null,
modelValue: null,
@ -60,11 +60,9 @@ export default {
},
onFocus() {
this.focused = true;
this.$emit('focus', event);
},
onBlur() {
this.focused = false;
this.$emit('blur', event);
}
},
computed: {

View File

@ -12,8 +12,6 @@ declare class InputSwitch {
$emit(eventName: 'click', event: Event): this;
$emit(eventName: 'change', event: Event): this;
$emit(eventName: 'input', value: boolean): this;
$emit(eventName: 'focus', event: Event): this;
$emit(eventName: 'blur', event: Event): this;
}
export default InputSwitch;

View File

@ -12,7 +12,7 @@
export default {
name: 'InputSwitch',
inheritAttrs: false,
emits: ['update:modelValue', 'click', 'change'],
emits: ['update:modelValue', 'click', 'change', 'input'],
props: {
modelValue: Boolean,
class: null,
@ -43,13 +43,11 @@ export default {
}
event.preventDefault();
},
onFocus(event) {
onFocus() {
this.focused = true;
this.$emit('focus', event);
},
onBlur(event) {
onBlur() {
this.focused = false;
this.$emit('blur', event);
}
},
computed: {

View File

@ -97,6 +97,7 @@ export default {
</div>
<h5>Events</h5>
<p>In addition to the following events, any other valid events such as focus and blur are passed implicitly.</p>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
@ -117,16 +118,6 @@ export default {
<td>event: Browser event</td>
<td>Callback to invoke on value change.</td>
</tr>
<tr>
<td>focus</td>
<td>event: Browser event</td>
<td>Callback to invoke when element receives focus.</td>
</tr>
<tr>
<td>blur</td>
<td>event: Browser event</td>
<td>Callback to invoke when element loses focus.</td>
</tr>
<tr>
<td>input</td>
<td>value: New value</td>

View File

@ -85,6 +85,7 @@ export default {
</div>
<h5>Events</h5>
<p>In addition to the following events, any other valid events such as focus and blur are passed implicitly.</p>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
@ -105,16 +106,6 @@ export default {
<td>event: Browser event</td>
<td>Callback to invoke on value change.</td>
</tr>
<tr>
<td>focus</td>
<td>event: Browser event</td>
<td>Callback to invoke when element receives focus.</td>
</tr>
<tr>
<td>blur</td>
<td>event: Browser event</td>
<td>Callback to invoke when element loses focus.</td>
</tr>
<tr>
<td>input</td>
<td>value: New value</td>