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

divkit.dsl.PhoneInputMask.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 phone numbers with dynamic regional format identification.
 * 
 * Can be created using the method [phoneInputMask].
 * 
 * Required parameters: `type, raw_text_variable`.
 */
@Generated
class PhoneInputMask internal constructor(
    @JsonIgnore
    val properties: Properties,
) : InputMask {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(
        mapOf("type" to "phone")
    )

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

    class Properties internal constructor(
        /**
         * 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("raw_text_variable", rawTextVariable)
            return result
        }
    }
}

/**
 * @param rawTextVariable Name of the variable to store the unprocessed value.
 */
@Generated
fun DivScope.phoneInputMask(
    `use named arguments`: Guard = Guard.instance,
    rawTextVariable: String? = null,
): PhoneInputMask = PhoneInputMask(
    PhoneInputMask.Properties(
        rawTextVariable = valueOrNull(rawTextVariable),
    )
)

/**
 * @param rawTextVariable Name of the variable to store the unprocessed value.
 */
@Generated
fun DivScope.phoneInputMaskProps(
    `use named arguments`: Guard = Guard.instance,
    rawTextVariable: String? = null,
) = PhoneInputMask.Properties(
    rawTextVariable = valueOrNull(rawTextVariable),
)

/**
 * @param rawTextVariable Name of the variable to store the unprocessed value.
 */
@Generated
fun TemplateScope.phoneInputMaskRefs(
    `use named arguments`: Guard = Guard.instance,
    rawTextVariable: ReferenceProperty? = null,
) = PhoneInputMask.Properties(
    rawTextVariable = rawTextVariable,
)

/**
 * @param rawTextVariable Name of the variable to store the unprocessed value.
 */
@Generated
fun PhoneInputMask.override(
    `use named arguments`: Guard = Guard.instance,
    rawTextVariable: String? = null,
): PhoneInputMask = PhoneInputMask(
    PhoneInputMask.Properties(
        rawTextVariable = valueOrNull(rawTextVariable) ?: properties.rawTextVariable,
    )
)

/**
 * @param rawTextVariable Name of the variable to store the unprocessed value.
 */
@Generated
fun PhoneInputMask.defer(
    `use named arguments`: Guard = Guard.instance,
    rawTextVariable: ReferenceProperty? = null,
): PhoneInputMask = PhoneInputMask(
    PhoneInputMask.Properties(
        rawTextVariable = rawTextVariable ?: properties.rawTextVariable,
    )
)

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy