diff --git a/build.sbt b/build.sbt index feadb329e..77d5a0122 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ import org.scalajs.linker.interface.ModuleSplitStyle -ThisBuild / tlBaseVersion := "0.118" +ThisBuild / tlBaseVersion := "0.119" ThisBuild / tlCiReleaseBranches := Seq("master") val Versions = new { diff --git a/modules/ui/src/main/scala/lucuma/ui/syntax/table.scala b/modules/ui/src/main/scala/lucuma/ui/syntax/table.scala index cf01e180b..fd722d6d1 100644 --- a/modules/ui/src/main/scala/lucuma/ui/syntax/table.scala +++ b/modules/ui/src/main/scala/lucuma/ui/syntax/table.scala @@ -9,8 +9,8 @@ import japgolly.scalajs.react.ReactMouseEvent import lucuma.react.table.* trait table: - extension [T, TM](row: Row[T, TM]) - def getMultiRowSelectedHandler(table: Table[T, TM]): ReactMouseEvent => Callback = + extension [T, TM](table: Table[T, TM]) + def getMultiRowSelectedHandler(rowId: RowId): ReactMouseEvent => Callback = (e: ReactMouseEvent) => val isShiftPressed: Boolean = e.shiftKey val isCmdCtrlPressed: Boolean = e.metaKey || e.ctrlKey @@ -22,11 +22,10 @@ trait table: if (isShiftPressed && selectedRows.nonEmpty) { // If shift is pressed extend val allRows: List[(Row[T, TM], Int)] = table.getRowModel().rows.zipWithIndex - val currentId: RowId = row.id // selectedRow is not empty, these won't fail val firstId: RowId = selectedRows.head.id val lastId: RowId = selectedRows.last.id - val indexOfCurrent: Int = allRows.indexWhere(_._1.id == currentId) + val indexOfCurrent: Int = allRows.indexWhere(_._1.id == rowId) val indexOfFirst: Int = allRows.indexWhere(_._1.id == firstId) val indexOfLast: Int = allRows.indexWhere(_._1.id == lastId) if (indexOfCurrent =!= -1 && indexOfFirst =!= -1 && indexOfLast =!= -1) @@ -44,7 +43,10 @@ trait table: .map { case (row, _) => row.id -> true }* ) else Callback.empty - } else row.toggleSelected() + } else + table.modRowSelection: rowSelection => + RowSelection: + rowSelection.value + (rowId -> rowSelection.value.get(rowId).fold(true)(!_)) ) object table extends table