Skip to content

Commit

Permalink
Add MouseEvent & KeyboardEvent to click:row
Browse files Browse the repository at this point in the history
feat(VDataTable): add event as 3rd argument

Change click:row event documentation

Add MouseEvent to click:row

Add KeyboardEvent to click:row
  • Loading branch information
Leinad Mind committed Jan 27, 2022
1 parent b786cdd commit f447ad5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/api-generator/src/locale/en/v-data-table.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"top": "Slot to add content above the table"
},
"events": {
"click:row": "Emits when a table row is clicked. This event provides 2 arguments: the first is the item data that was clicked and the second is the other related data provided by the `item` slot. **NOTE:** will not emit when table rows are defined through a slot such as `item` or `body`.",
"click:row": "Emits when a table row is clicked. This event provides 3 arguments: the first is the item data that was clicked, the second is the other related data provided by the `item` slot and the third is the events. **NOTE:** will not emit when table rows are defined through a slot such as `item` or `body`.",
"contextmenu:row": "Emits when a table row is right-clicked. The item for the row is included. **NOTE:** will not emit when table rows are defined through a slot such as `item` or `body`.",
"dblclick:row": "Emits when a table row is double-clicked. The item for the row is included. **NOTE:** will not emit when table rows are defined through a slot such as `item` or `body`.",
"current-items": "Emits the items provided via the **items** prop, every time the internal **computedItems** is changed.",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-generator/src/maps/v-data-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const DataTableEvents = [
{
name: 'click:row',
source: 'v-data-table',
value: `any, ${dataString}`,
value: `any, ${dataString}, MouseEvent | KeyboardEvent`,
},
{
name: 'contextmenu:row',
Expand Down
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VDataTable/VDataTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ export default mixins(
on: {
// TODO: for click, the first argument should be the event, and the second argument should be data,
// but this is a breaking change so it's for v3
click: () => this.$emit('click:row', item, data),
click: (event: MouseEvent | KeyboardEvent) => this.$emit('click:row', item, data, event),
contextmenu: (event: MouseEvent) => this.$emit('contextmenu:row', event, data),
dblclick: (event: MouseEvent) => this.$emit('dblclick:row', event, data),
},
Expand Down

0 comments on commit f447ad5

Please sign in to comment.