From cae2bf165a7a9099d3714264eef9933f67d26aef Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Wed, 25 Aug 2021 10:09:50 +0300 Subject: [PATCH] Prevent duplicate event invocation --- api-generator/components/checkbox.js | 8 -------- api-generator/components/inputswitch.js | 8 -------- src/components/checkbox/Checkbox.d.ts | 2 -- src/components/checkbox/Checkbox.vue | 4 +--- src/components/inputswitch/InputSwitch.d.ts | 2 -- src/components/inputswitch/InputSwitch.vue | 8 +++----- src/views/checkbox/CheckboxDoc.vue | 11 +---------- src/views/inputswitch/InputSwitchDoc.vue | 11 +---------- 8 files changed, 6 insertions(+), 48 deletions(-) diff --git a/api-generator/components/checkbox.js b/api-generator/components/checkbox.js index 9e1c3d3f4..d28a4e59a 100644 --- a/api-generator/components/checkbox.js +++ b/api-generator/components/checkbox.js @@ -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." } ]; diff --git a/api-generator/components/inputswitch.js b/api-generator/components/inputswitch.js index ac794a9fa..704ef145f 100644 --- a/api-generator/components/inputswitch.js +++ b/api-generator/components/inputswitch.js @@ -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." } ]; diff --git a/src/components/checkbox/Checkbox.d.ts b/src/components/checkbox/Checkbox.d.ts index 5bba8c09c..0d3d95af3 100755 --- a/src/components/checkbox/Checkbox.d.ts +++ b/src/components/checkbox/Checkbox.d.ts @@ -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; diff --git a/src/components/checkbox/Checkbox.vue b/src/components/checkbox/Checkbox.vue index a5ee1d75a..d7d8f767e 100755 --- a/src/components/checkbox/Checkbox.vue +++ b/src/components/checkbox/Checkbox.vue @@ -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: { diff --git a/src/components/inputswitch/InputSwitch.d.ts b/src/components/inputswitch/InputSwitch.d.ts index a39f0e324..6d418abcf 100755 --- a/src/components/inputswitch/InputSwitch.d.ts +++ b/src/components/inputswitch/InputSwitch.d.ts @@ -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; diff --git a/src/components/inputswitch/InputSwitch.vue b/src/components/inputswitch/InputSwitch.vue index f630ee273..ec4c70702 100755 --- a/src/components/inputswitch/InputSwitch.vue +++ b/src/components/inputswitch/InputSwitch.vue @@ -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: { diff --git a/src/views/checkbox/CheckboxDoc.vue b/src/views/checkbox/CheckboxDoc.vue index 581225983..30822bbfd 100755 --- a/src/views/checkbox/CheckboxDoc.vue +++ b/src/views/checkbox/CheckboxDoc.vue @@ -97,6 +97,7 @@ export default {
Events
+

In addition to the following events, any other valid events such as focus and blur are passed implicitly.

@@ -117,16 +118,6 @@ export default { - - - - - - - - - - diff --git a/src/views/inputswitch/InputSwitchDoc.vue b/src/views/inputswitch/InputSwitchDoc.vue index ce9e563fe..e9348a61b 100755 --- a/src/views/inputswitch/InputSwitchDoc.vue +++ b/src/views/inputswitch/InputSwitchDoc.vue @@ -85,6 +85,7 @@ export default {
Events
+

In addition to the following events, any other valid events such as focus and blur are passed implicitly.

event: Browser event Callback to invoke on value change.
focusevent: Browser eventCallback to invoke when element receives focus.
blurevent: Browser eventCallback to invoke when element loses focus.
input value: New value
@@ -105,16 +106,6 @@ export default { - - - - - - - - - -
event: Browser event Callback to invoke on value change.
focusevent: Browser eventCallback to invoke when element receives focus.
blurevent: Browser eventCallback to invoke when element loses focus.
input value: New value