From c9e6256e7f2c06da8bfda13700f56f6994e76eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20Fei=C3=9F?= <127290039+nfpocket@users.noreply.github.com> Date: Wed, 6 Nov 2024 19:12:51 +0100 Subject: [PATCH] feat(Table): add contextmenu handling to table rows (#2283) --- .../examples/TableExampleContextmenu.vue | 66 +++++++++++++++++++ docs/content/2.components/table.md | 16 +++++ src/runtime/components/data/Table.vue | 12 +++- 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 docs/components/content/examples/TableExampleContextmenu.vue diff --git a/docs/components/content/examples/TableExampleContextmenu.vue b/docs/components/content/examples/TableExampleContextmenu.vue new file mode 100644 index 00000000..ac49db3b --- /dev/null +++ b/docs/components/content/examples/TableExampleContextmenu.vue @@ -0,0 +1,66 @@ + + + diff --git a/docs/content/2.components/table.md b/docs/content/2.components/table.md index a3b421fe..8fbe24fe 100644 --- a/docs/content/2.components/table.md +++ b/docs/content/2.components/table.md @@ -285,6 +285,22 @@ componentProps: --- :: +### Contextmenu + +Use the `contextmenu` listener on your Table to make the rows righ-clickable. The function will receive the original event as the first argument and the row as the second argument. + +You can use this to open a [ContextMenu](/components/context-menu) for that row. + +::component-example{class="grid"} +--- +extraClass: 'overflow-hidden' +padding: false +component: 'table-example-contextmenu' +componentProps: + class: 'flex-1 flex-col overflow-hidden' +--- +:: + ### Searchable You can easily use the [Input](/components/input) component to filter the rows. diff --git a/src/runtime/components/data/Table.vue b/src/runtime/components/data/Table.vue index be766500..1fb1e8c9 100644 --- a/src/runtime/components/data/Table.vue +++ b/src/runtime/components/data/Table.vue @@ -77,7 +77,7 @@