add headerCustomizer to table

This commit is contained in:
InsanusMokrassar 2022-01-25 20:13:03 +06:00
parent 2a76519843
commit 598e481f75
3 changed files with 9 additions and 2 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ out/
secret.gradle
local.properties
local.*
kotlin-js-store/

View File

@ -2,6 +2,8 @@
## 0.0.23
* New parameter of tables `headerCustomizer`
## 0.0.22
* Add opportunity to customize table header cells

View File

@ -14,6 +14,7 @@ fun <T> DefaultTable(
dataList: SnapshotStateList<T>,
vararg tableModifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLTableElement> = {},
headerCustomizer: AttrBuilderContext<HTMLTableSectionElement> = {},
headerCellCustomizer: AttrsBuilder<HTMLTableCellElement>.(i: Int) -> Unit = {},
rowAttributes: AttrsBuilder<HTMLTableRowElement>.(t: T) -> Unit = {},
cellCustomizer: AttrsBuilder<HTMLTableCellElement>.(i: Int, t: T) -> Unit = { _, _ -> },
@ -27,7 +28,7 @@ fun <T> DefaultTable(
attributesCustomizer()
}
) {
Thead {
Thead(headerCustomizer) {
Tr {
headerBuilders.forEachIndexed { i, t ->
Th(
@ -40,6 +41,7 @@ fun <T> DefaultTable(
}
}
}
Tbody {
dataList.forEach {
Tr(
@ -68,6 +70,7 @@ fun <T> DefaultTable(
dataList: SnapshotStateList<T>,
vararg tableModifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLTableElement> = {},
headerCustomizer: AttrBuilderContext<HTMLTableSectionElement> = {},
headerCellCustomizer: AttrsBuilder<HTMLTableCellElement>.(i: Int, title: String) -> Unit = { _, _ -> },
rowAttributes: AttrsBuilder<HTMLTableRowElement>.(t: T) -> Unit = {},
cellCustomizer: AttrsBuilder<HTMLTableCellElement>.(i: Int, t: T) -> Unit = { _, _ -> },
@ -89,6 +92,7 @@ fun <T> DefaultTable(
dataList,
tableModifiers = tableModifiers,
attributesCustomizer,
headerCustomizer,
headerCellCustomizer,
rowAttributes,
cellCustomizer,