From b449caae135c56ef34fa8465233a0846d1a072d6 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 25 Jan 2022 20:22:17 +0600 Subject: [PATCH] add opportunity to fill space between header and body of table --- CHANGELOG.md | 2 ++ src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbbd463..1ffc39a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.0.24 +* Add opportunity to fill space between header and body of table + ## 0.0.23 * New parameter of tables `headerCustomizer` diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt index f58c05f..3baaeca 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt @@ -18,6 +18,7 @@ fun DefaultTable( headerCellCustomizer: AttrsBuilder.(i: Int) -> Unit = {}, rowAttributes: AttrsBuilder.(t: T) -> Unit = {}, cellCustomizer: AttrsBuilder.(i: Int, t: T) -> Unit = { _, _ -> }, + betweenHeaderAndBodyFiller: ContentBuilder = {}, cellFiller: @Composable ElementScope.(i: Int, t: T) -> Unit ) { val headingIndexes = headerBuilders.indices @@ -41,7 +42,7 @@ fun DefaultTable( } } } - + betweenHeaderAndBodyFiller() Tbody { dataList.forEach { Tr( @@ -74,6 +75,7 @@ fun DefaultTable( headerCellCustomizer: AttrsBuilder.(i: Int, title: String) -> Unit = { _, _ -> }, rowAttributes: AttrsBuilder.(t: T) -> Unit = {}, cellCustomizer: AttrsBuilder.(i: Int, t: T) -> Unit = { _, _ -> }, + betweenHeaderAndBodyFiller: ContentBuilder = {}, cellFiller: @Composable ElementScope.(i: Int, t: T) -> Unit ) { val headersByIndex = heading.mapIndexed { index, s -> index to s }.toMap() @@ -96,6 +98,7 @@ fun DefaultTable( headerCellCustomizer, rowAttributes, cellCustomizer, + betweenHeaderAndBodyFiller, cellFiller ) }