divkit.dsl.PhoneInputMask.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-json-builder Show documentation
Show all versions of kotlin-json-builder Show documentation
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.
@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)