Skip to content

Commit

Permalink
Fixed #1748 - New change event for SelectButton
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Nov 12, 2021
1 parent f2b9b8d commit 3d343c9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
16 changes: 16 additions & 0 deletions api-generator/components/selectbutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ const SelectButtonProps = [
];

const SelectButtonEvents = [
{
name: "change",
description: "Callback to invoke on value change.",
arguments: [
{
name: "event.originalEvent",
type: "object",
description: "Browser event"
},
{
name: "event.value",
type: "any",
description: "Single value or an array of values that are selected."
}
]
},
{
name: "focus",
description: "Callback to invoke on focus.",
Expand Down
1 change: 1 addition & 0 deletions src/components/selectbutton/SelectButton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface SelectButtonOptionSlotInterface {
declare class SelectButton {
$props: SelectButtonProps;
$emit(eventName: 'update:modelValue', value: any): this;
$emit(eventName: 'change', event: {originalEvent: Event, value: any}): this;
$emit(eventName: 'focus', event: Event): this;
$emit(eventName: 'blur', event: Event): this;
$slots: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/selectbutton/SelectButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Ripple from 'primevue/ripple';
export default {
name: 'SelectButton',
emits: ['update:modelValue', 'focus', 'blur'],
emits: ['update:modelValue', 'focus', 'blur', 'change'],
props: {
modelValue: null,
options: Array,
Expand Down Expand Up @@ -62,6 +62,7 @@ export default {
}
this.$emit('update:modelValue', newValue);
this.$emit('change', {event: event, value: newValue});
},
isSelected(option) {
let selected = false;
Expand Down
6 changes: 6 additions & 0 deletions src/views/selectbutton/SelectButtonDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ export default {
</tr>
</thead>
<tbody>
<tr>
<td>change</td>
<td>event.originalEvent: browser event <br>
event.value: Single value or an array of values that are selected.</td>
<td>Callback to invoke on value change.</td>
</tr>
<tr>
<td>focus</td>
<td>event: Browser event</td>
Expand Down

0 comments on commit 3d343c9

Please sign in to comment.