From 9449eccec1df6e40ed6ebadcd2f03677ca0b38c0 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 25 Jan 2022 00:02:29 +0600 Subject: [PATCH] headingCustomizer -> headerCellCustomizer + add index and title parameters for it --- CHANGELOG.md | 3 +++ src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf54d67..d204cf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 0.0.17 +* In `DefaultTable` `headingCustomizer` has been renamed to `headerCellCustomizer` +* Add index and title parameters for `headerCellCustomizer` in `DefaultTable` + ## 0.0.16 * Add opportunity to customize `NavDivider` diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt index 5ef0b74..77db07e 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Table.kt @@ -14,7 +14,7 @@ fun DefaultTable( dataList: SnapshotStateList, vararg tableModifiers: UIKitModifier, attributesCustomizer: AttrBuilderContext = {}, - headingCustomizer: AttrBuilderContext = {}, + headerCellCustomizer: AttrsBuilder.(i: Int, title: String) -> Unit = { _, _ -> }, rowAttributes: AttrsBuilder.(t: T) -> Unit = {}, cellCustomizer: AttrsBuilder.(i: Int, t: T) -> Unit = { _, _ -> }, cellFiller: @Composable ElementScope.(i: Int, t: T) -> Unit @@ -29,13 +29,13 @@ fun DefaultTable( ) { Thead { Tr { - heading.forEach { + heading.forEachIndexed { i, t -> Th( { - headingCustomizer() + headerCellCustomizer(i, t) } ) { - Text(it) + Text(t) } } }