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

divkit.dsl.CurrencyInputMask.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

/**
 * Mask for entering currency in the specified regional format.
 * 
 * Can be created using the method [currencyInputMask].
 * 
 * Required parameters: `type, raw_text_variable`.
 */
@Generated
class CurrencyInputMask internal constructor(
    @JsonIgnore
    val properties: Properties,
) : InputMask {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(
        mapOf("type" to "currency")
    )

    operator fun plus(additive: Properties): CurrencyInputMask = CurrencyInputMask(
        Properties(
            locale = additive.locale ?: properties.locale,
            rawTextVariable = additive.rawTextVariable ?: properties.rawTextVariable,
        )
    )

    class Properties internal constructor(
        /**
         * Language tag that the currency format should match, as per [IETF BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag). If the language is not set, it is defined automatically.
         */
        val locale: Property?,
        /**
         * Name of the variable to store the unprocessed value.
         */
        val rawTextVariable: Property?,
    ) {
        internal fun mergeWith(properties: Map): Map {
            val result = mutableMapOf()
            result.putAll(properties)
            result.tryPutProperty("locale", locale)
            result.tryPutProperty("raw_text_variable", rawTextVariable)
            return result
        }
    }
}

/**
 * @param locale Language tag that the currency format should match, as per [IETF BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag). If the language is not set, it is defined automatically.
 * @param rawTextVariable Name of the variable to store the unprocessed value.
 */
@Generated
fun DivScope.currencyInputMask(
    `use named arguments`: Guard = Guard.instance,
    locale: String? = null,
    rawTextVariable: String? = null,
): CurrencyInputMask = CurrencyInputMask(
    CurrencyInputMask.Properties(
        locale = valueOrNull(locale),
        rawTextVariable = valueOrNull(rawTextVariable),
    )
)

/**
 * @param locale Language tag that the currency format should match, as per [IETF BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag). If the language is not set, it is defined automatically.
 * @param rawTextVariable Name of the variable to store the unprocessed value.
 */
@Generated
fun DivScope.currencyInputMaskProps(
    `use named arguments`: Guard = Guard.instance,
    locale: String? = null,
    rawTextVariable: String? = null,
) = CurrencyInputMask.Properties(
    locale = valueOrNull(locale),
    rawTextVariable = valueOrNull(rawTextVariable),
)

/**
 * @param locale Language tag that the currency format should match, as per [IETF BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag). If the language is not set, it is defined automatically.
 * @param rawTextVariable Name of the variable to store the unprocessed value.
 */
@Generated
fun TemplateScope.currencyInputMaskRefs(
    `use named arguments`: Guard = Guard.instance,
    locale: ReferenceProperty? = null,
    rawTextVariable: ReferenceProperty? = null,
) = CurrencyInputMask.Properties(
    locale = locale,
    rawTextVariable = rawTextVariable,
)

/**
 * @param locale Language tag that the currency format should match, as per [IETF BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag). If the language is not set, it is defined automatically.
 * @param rawTextVariable Name of the variable to store the unprocessed value.
 */
@Generated
fun CurrencyInputMask.override(
    `use named arguments`: Guard = Guard.instance,
    locale: String? = null,
    rawTextVariable: String? = null,
): CurrencyInputMask = CurrencyInputMask(
    CurrencyInputMask.Properties(
        locale = valueOrNull(locale) ?: properties.locale,
        rawTextVariable = valueOrNull(rawTextVariable) ?: properties.rawTextVariable,
    )
)

/**
 * @param locale Language tag that the currency format should match, as per [IETF BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag). If the language is not set, it is defined automatically.
 * @param rawTextVariable Name of the variable to store the unprocessed value.
 */
@Generated
fun CurrencyInputMask.defer(
    `use named arguments`: Guard = Guard.instance,
    locale: ReferenceProperty? = null,
    rawTextVariable: ReferenceProperty? = null,
): CurrencyInputMask = CurrencyInputMask(
    CurrencyInputMask.Properties(
        locale = locale ?: properties.locale,
        rawTextVariable = rawTextVariable ?: properties.rawTextVariable,
    )
)

/**
 * @param locale Language tag that the currency format should match, as per [IETF BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag). If the language is not set, it is defined automatically.
 */
@Generated
fun CurrencyInputMask.evaluate(
    `use named arguments`: Guard = Guard.instance,
    locale: ExpressionProperty? = null,
): CurrencyInputMask = CurrencyInputMask(
    CurrencyInputMask.Properties(
        locale = locale ?: properties.locale,
        rawTextVariable = properties.rawTextVariable,
    )
)

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy