Compare commits

..

9 Commits

4 changed files with 34 additions and 7 deletions

View File

@@ -1,5 +1,17 @@
# Changelog
## 0.0.15
* Add support of link icons
## 0.0.14
* Add DefaultTable parameter cellCustomizer
## 0.0.13
* Add `Icon#Custom`
## 0.0.12
* Add `rowAttributes` to table fun

View File

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

View File

@@ -219,13 +219,15 @@ sealed class Icon(val name: String) {
}
attributesCustomizer()
}
if (type == UIKitIconType.Button) {
Button(configurer)
} else {
Span(configurer)
when (type) {
UIKitIconType.Default -> Span(configurer)
UIKitIconType.Link -> A(href = "#", configurer)
UIKitIconType.Button -> Button(configurer)
}
}
class Custom(name: String) : Icon(name)
@Composable
fun drawAsButton(
vararg modifiers: UIKitModifier,
@@ -241,4 +243,12 @@ sealed class Icon(val name: String) {
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, type = UIKitIconType.Default, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
@Composable
fun drawAsLink(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, type = UIKitIconType.Link, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
}

View File

@@ -16,7 +16,8 @@ fun <T> DefaultTable(
attributesCustomizer: AttrBuilderContext<HTMLTableElement> = {},
headingCustomizer: AttrBuilderContext<HTMLTableCellElement> = {},
rowAttributes: AttrsBuilder<HTMLTableRowElement>.(t: T) -> Unit = {},
cellFiller: @Composable (i: Int, 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(
@@ -47,7 +48,11 @@ fun <T> DefaultTable(
}
) {
headingIndexes.forEach { i ->
Td {
Td(
{
cellCustomizer(i, it)
}
) {
cellFiller(i, it)
}
}