divkit.dsl.ActionFocusElement.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
/**
* Requests focus for an element. May require a user action on the web.
*
* Can be created using the method [actionFocusElement].
*
* Required parameters: `type, element_id`.
*/
@Generated
class ActionFocusElement internal constructor(
@JsonIgnore
val properties: Properties,
) : ActionTyped {
@JsonAnyGetter
internal fun getJsonProperties(): Map = properties.mergeWith(
mapOf("type" to "focus_element")
)
operator fun plus(additive: Properties): ActionFocusElement = ActionFocusElement(
Properties(
elementId = additive.elementId ?: properties.elementId,
)
)
class Properties internal constructor(
val elementId: Property?,
) {
internal fun mergeWith(properties: Map): Map {
val result = mutableMapOf()
result.putAll(properties)
result.tryPutProperty("element_id", elementId)
return result
}
}
}
@Generated
fun DivScope.actionFocusElement(
`use named arguments`: Guard = Guard.instance,
elementId: String? = null,
): ActionFocusElement = ActionFocusElement(
ActionFocusElement.Properties(
elementId = valueOrNull(elementId),
)
)
@Generated
fun DivScope.actionFocusElementProps(
`use named arguments`: Guard = Guard.instance,
elementId: String? = null,
) = ActionFocusElement.Properties(
elementId = valueOrNull(elementId),
)
@Generated
fun TemplateScope.actionFocusElementRefs(
`use named arguments`: Guard = Guard.instance,
elementId: ReferenceProperty? = null,
) = ActionFocusElement.Properties(
elementId = elementId,
)
@Generated
fun ActionFocusElement.override(
`use named arguments`: Guard = Guard.instance,
elementId: String? = null,
): ActionFocusElement = ActionFocusElement(
ActionFocusElement.Properties(
elementId = valueOrNull(elementId) ?: properties.elementId,
)
)
@Generated
fun ActionFocusElement.defer(
`use named arguments`: Guard = Guard.instance,
elementId: ReferenceProperty? = null,
): ActionFocusElement = ActionFocusElement(
ActionFocusElement.Properties(
elementId = elementId ?: properties.elementId,
)
)
@Generated
fun ActionFocusElement.evaluate(
`use named arguments`: Guard = Guard.instance,
elementId: ExpressionProperty? = null,
): ActionFocusElement = ActionFocusElement(
ActionFocusElement.Properties(
elementId = elementId ?: properties.elementId,
)
)
@Generated
fun ActionFocusElement.asList() = listOf(this)