All Downloads are FREE. Search and download functionalities are using the official Maven repository.

divkit.dsl.StretchIndicatorItemPlacement.kt Maven / Gradle / Ivy

Go to download

DivKit is an open source Server-Driven UI (SDUI) framework. SDUI is a an emerging technique that leverage the server to build the user interfaces of their mobile app.

There is a newer version: 30.19.0
Show newest version
@file:Suppress(
    "unused",
    "UNUSED_PARAMETER",
)

package divkit.dsl

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonValue
import divkit.dsl.annotation.*
import divkit.dsl.core.*
import divkit.dsl.scope.*
import kotlin.Any
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.Map

/**
 * Element size adjusts to a parent element.
 * 
 * Can be created using the method [stretchIndicatorItemPlacement].
 * 
 * Required parameters: `type`.
 */
@Generated
class StretchIndicatorItemPlacement internal constructor(
    @JsonIgnore
    val properties: Properties,
) : IndicatorItemPlacement {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(
        mapOf("type" to "stretch")
    )

    operator fun plus(additive: Properties): StretchIndicatorItemPlacement = StretchIndicatorItemPlacement(
        Properties(
            itemSpacing = additive.itemSpacing ?: properties.itemSpacing,
            maxVisibleItems = additive.maxVisibleItems ?: properties.maxVisibleItems,
        )
    )

    class Properties internal constructor(
        /**
         * Spacing between indicator centers.
         * Default value: `{"type": "fixed","value":5}`.
         */
        val itemSpacing: Property?,
        /**
         * Maximum number of visible indicators.
         * Default value: `10`.
         */
        val maxVisibleItems: Property?,
    ) {
        internal fun mergeWith(properties: Map): Map {
            val result = mutableMapOf()
            result.putAll(properties)
            result.tryPutProperty("item_spacing", itemSpacing)
            result.tryPutProperty("max_visible_items", maxVisibleItems)
            return result
        }
    }
}

/**
 * @param itemSpacing Spacing between indicator centers.
 * @param maxVisibleItems Maximum number of visible indicators.
 */
@Generated
fun DivScope.stretchIndicatorItemPlacement(
    `use named arguments`: Guard = Guard.instance,
    itemSpacing: FixedSize? = null,
    maxVisibleItems: Int? = null,
): StretchIndicatorItemPlacement = StretchIndicatorItemPlacement(
    StretchIndicatorItemPlacement.Properties(
        itemSpacing = valueOrNull(itemSpacing),
        maxVisibleItems = valueOrNull(maxVisibleItems),
    )
)

/**
 * @param itemSpacing Spacing between indicator centers.
 * @param maxVisibleItems Maximum number of visible indicators.
 */
@Generated
fun DivScope.stretchIndicatorItemPlacementProps(
    `use named arguments`: Guard = Guard.instance,
    itemSpacing: FixedSize? = null,
    maxVisibleItems: Int? = null,
) = StretchIndicatorItemPlacement.Properties(
    itemSpacing = valueOrNull(itemSpacing),
    maxVisibleItems = valueOrNull(maxVisibleItems),
)

/**
 * @param itemSpacing Spacing between indicator centers.
 * @param maxVisibleItems Maximum number of visible indicators.
 */
@Generated
fun TemplateScope.stretchIndicatorItemPlacementRefs(
    `use named arguments`: Guard = Guard.instance,
    itemSpacing: ReferenceProperty? = null,
    maxVisibleItems: ReferenceProperty? = null,
) = StretchIndicatorItemPlacement.Properties(
    itemSpacing = itemSpacing,
    maxVisibleItems = maxVisibleItems,
)

/**
 * @param itemSpacing Spacing between indicator centers.
 * @param maxVisibleItems Maximum number of visible indicators.
 */
@Generated
fun StretchIndicatorItemPlacement.override(
    `use named arguments`: Guard = Guard.instance,
    itemSpacing: FixedSize? = null,
    maxVisibleItems: Int? = null,
): StretchIndicatorItemPlacement = StretchIndicatorItemPlacement(
    StretchIndicatorItemPlacement.Properties(
        itemSpacing = valueOrNull(itemSpacing) ?: properties.itemSpacing,
        maxVisibleItems = valueOrNull(maxVisibleItems) ?: properties.maxVisibleItems,
    )
)

/**
 * @param itemSpacing Spacing between indicator centers.
 * @param maxVisibleItems Maximum number of visible indicators.
 */
@Generated
fun StretchIndicatorItemPlacement.defer(
    `use named arguments`: Guard = Guard.instance,
    itemSpacing: ReferenceProperty? = null,
    maxVisibleItems: ReferenceProperty? = null,
): StretchIndicatorItemPlacement = StretchIndicatorItemPlacement(
    StretchIndicatorItemPlacement.Properties(
        itemSpacing = itemSpacing ?: properties.itemSpacing,
        maxVisibleItems = maxVisibleItems ?: properties.maxVisibleItems,
    )
)

/**
 * @param maxVisibleItems Maximum number of visible indicators.
 */
@Generated
fun StretchIndicatorItemPlacement.evaluate(
    `use named arguments`: Guard = Guard.instance,
    maxVisibleItems: ExpressionProperty? = null,
): StretchIndicatorItemPlacement = StretchIndicatorItemPlacement(
    StretchIndicatorItemPlacement.Properties(
        itemSpacing = properties.itemSpacing,
        maxVisibleItems = maxVisibleItems ?: properties.maxVisibleItems,
    )
)

@Generated
fun StretchIndicatorItemPlacement.asList() = listOf(this)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy