From e13a2fd2417b0e9c34e9e929df0b231b48ce3994 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 21 Jan 2022 22:20:02 +0600 Subject: [PATCH] add DefaultTable parameter cellAttributes --- CHANGELOG.md | 2 ++ src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b85709..0dec70b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.0.14 +* Add DefaultTable parameter cellCustomizer + ## 0.0.13 * Add `Icon#Custom` diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt index bb0a43f..5ef0b74 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt @@ -16,7 +16,8 @@ fun DefaultTable( attributesCustomizer: AttrBuilderContext = {}, headingCustomizer: AttrBuilderContext = {}, rowAttributes: AttrsBuilder.(t: T) -> Unit = {}, - cellFiller: @Composable (i: Int, t: T) -> Unit + cellCustomizer: AttrsBuilder.(i: Int, t: T) -> Unit = { _, _ -> }, + cellFiller: @Composable ElementScope.(i: Int, t: T) -> Unit ) { val headingIndexes = heading.indices Table( @@ -47,7 +48,11 @@ fun DefaultTable( } ) { headingIndexes.forEach { i -> - Td { + Td( + { + cellCustomizer(i, it) + } + ) { cellFiller(i, it) } }