Compare commits

..

9 Commits

4 changed files with 29 additions and 4 deletions

View File

@@ -1,5 +1,17 @@
# Changelog
## 0.0.14
* Add DefaultTable parameter cellCustomizer
## 0.0.13
* Add `Icon#Custom`
## 0.0.12
* Add `rowAttributes` to table fun
## 0.0.11
* Upfill `Nav` and `UIKitNav`

View File

@@ -9,4 +9,4 @@ android.enableJetifier=true
# Project data
group=dev.inmo
version=0.0.11
version=0.0.14

View File

@@ -226,6 +226,8 @@ sealed class Icon(val name: String) {
}
}
class Custom(name: String) : Icon(name)
@Composable
fun drawAsButton(
vararg modifiers: UIKitModifier,

View File

@@ -3,6 +3,7 @@ package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import androidx.compose.runtime.snapshots.SnapshotStateList
import dev.inmo.jsuikit.modifiers.*
import org.jetbrains.compose.web.attributes.AttrsBuilder
import org.jetbrains.compose.web.dom.*
import org.jetbrains.compose.web.dom.Text
import org.w3c.dom.*
@@ -14,7 +15,9 @@ fun <T> DefaultTable(
vararg tableModifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLTableElement> = {},
headingCustomizer: AttrBuilderContext<HTMLTableCellElement> = {},
cellFiller: @Composable (i: Int, t: T) -> Unit
rowAttributes: AttrsBuilder<HTMLTableRowElement>.(t: T) -> Unit = {},
cellCustomizer: AttrsBuilder<HTMLTableCellElement>.(i: Int, t: T) -> Unit = { _, _ -> },
cellFiller: @Composable ElementScope<HTMLTableCellElement>.(i: Int, t: T) -> Unit
) {
val headingIndexes = heading.indices
Table(
@@ -39,9 +42,17 @@ fun <T> DefaultTable(
}
Tbody {
dataList.forEach {
Tr {
Tr(
{
rowAttributes(it)
}
) {
headingIndexes.forEach { i ->
Td {
Td(
{
cellCustomizer(i, it)
}
) {
cellFiller(i, it)
}
}