Merge remote-tracking branch 'origin/main' into feature/220_ui_issues_2
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
b1f6d29ca1
7 changed files with 45 additions and 44 deletions
|
|
@ -499,6 +499,7 @@ defmodule MvWeb.CoreComponents do
|
|||
slot :col, required: true do
|
||||
attr :label, :string
|
||||
attr :class, :string
|
||||
attr :col_click, :any, doc: "optional column-specific click handler that overrides row_click"
|
||||
end
|
||||
|
||||
slot :action, doc: "the slot for showing user actions in the last table column"
|
||||
|
|
@ -534,9 +535,13 @@ defmodule MvWeb.CoreComponents do
|
|||
<tr :for={row <- @rows} id={@row_id && @row_id.(row)}>
|
||||
<td
|
||||
:for={col <- @col}
|
||||
phx-click={@row_click && @row_click.(row)}
|
||||
phx-click={
|
||||
(col[:col_click] && col[:col_click].(@row_item.(row))) ||
|
||||
(@row_click && @row_click.(row))
|
||||
}
|
||||
class={
|
||||
col_class = Map.get(col, :class)
|
||||
has_click = col[:col_click] || @row_click
|
||||
classes = ["max-w-xs"]
|
||||
|
||||
classes =
|
||||
|
|
@ -547,7 +552,7 @@ defmodule MvWeb.CoreComponents do
|
|||
end
|
||||
|
||||
classes =
|
||||
if @row_click do
|
||||
if has_click do
|
||||
["hover:cursor-pointer" | classes]
|
||||
else
|
||||
classes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue