mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Fixed #1471 - Add input, focus, blur events for Checkbox
This commit is contained in:
parent
53a69ebd72
commit
a1cf1d4277
4 changed files with 37 additions and 19 deletions
|
@ -45,26 +45,24 @@ const CheckboxProps = [
|
|||
|
||||
const CheckboxEvents = [
|
||||
{
|
||||
"name": "click",
|
||||
"description": "Callback to invoke on value click.",
|
||||
arguments: [
|
||||
{
|
||||
name: "event",
|
||||
type: "object",
|
||||
description: "Browser event"
|
||||
}
|
||||
]
|
||||
name: "click",
|
||||
description: "Callback to invoke on value click.",
|
||||
},
|
||||
{
|
||||
"name": "change",
|
||||
"description": "Callback to invoke on value change.",
|
||||
arguments: [
|
||||
{
|
||||
name: "event",
|
||||
type: "object",
|
||||
description: "Browser event"
|
||||
}
|
||||
]
|
||||
name: "change",
|
||||
description: "Callback to invoke on value change.",
|
||||
},
|
||||
{
|
||||
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."
|
||||
}
|
||||
];
|
||||
|
||||
|
|
3
src/components/checkbox/Checkbox.d.ts
vendored
3
src/components/checkbox/Checkbox.d.ts
vendored
|
@ -13,6 +13,9 @@ declare class Checkbox {
|
|||
$emit(eventName: 'update:page', value: any): this;
|
||||
$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;
|
||||
|
|
|
@ -54,14 +54,17 @@ export default {
|
|||
this.$emit('click', event);
|
||||
this.$emit('update:modelValue', newModelValue);
|
||||
this.$emit('change', event);
|
||||
this.$emit('input', newModelValue);
|
||||
this.$refs.input.focus();
|
||||
}
|
||||
},
|
||||
onFocus() {
|
||||
this.focused = true;
|
||||
this.$emit('focus', event);
|
||||
},
|
||||
onBlur() {
|
||||
this.focused = false;
|
||||
this.$emit('blur', event);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -97,7 +97,6 @@ export default {
|
|||
</div>
|
||||
|
||||
<h5>Events</h5>
|
||||
<p>Any valid event such as focus and blur.</p>
|
||||
<div class="doc-tablewrapper">
|
||||
<table class="doc-table">
|
||||
<thead>
|
||||
|
@ -118,6 +117,21 @@ 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>
|
||||
<td>Callback to invoke on value change.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue