StringProperty

@Serializable
@SerialName(value = "string")
data class StringProperty(val title: String? = null, val format: String? = null, val description: String? = null, val readOnly: Boolean? = null, val const: JsonPrimitive? = null, val not: Property? = null, val pattern: Regex? = null, val minLength: Int? = null, val maxLength: Int? = null, val enum: ImmutableList<String>? = null, val oneOf: ImmutableList<Property>? = null) : Property

A property which configure a field with a string value.

Constructors

Link copied to clipboard
constructor(title: String? = null, format: String? = null, description: String? = null, readOnly: Boolean? = null, const: JsonPrimitive? = null, not: Property? = null, pattern: Regex? = null, minLength: Int? = null, maxLength: Int? = null, enum: ImmutableList<String>? = null, oneOf: ImmutableList<Property>? = null)

Properties

Link copied to clipboard
open override val const: JsonPrimitive? = null

An optional const value to restrict the value of the property.

Link copied to clipboard
open override val description: String? = null

An optional description.

Link copied to clipboard
@Serializable(with = ImmutableListSerializer::class)
val enum: ImmutableList<String>? = null

An optional enum value to restrict the value of the property.

Link copied to clipboard
open override val format: String? = null

An optional format.

Link copied to clipboard
val maxLength: Int? = null

An optional maximum length to validate the string value.

Link copied to clipboard
val minLength: Int? = null

An optional minimum length to validate the string value.

Link copied to clipboard
open override val not: Property? = null

An optional not value to restrict the value of the property.

Link copied to clipboard
@Serializable(with = ImmutableListSerializer::class)
val oneOf: ImmutableList<Property>? = null

An optional list of key-value to validate the string value.

Link copied to clipboard
@Serializable(with = RegexSerializer::class)
open override val pattern: Regex? = null

An optional pattern to restrict the value of the property.

Link copied to clipboard
open override val readOnly: Boolean? = null

An optional boolean to know if it is interactive.

Link copied to clipboard
open override val title: String? = null

An optional title.

Functions

Link copied to clipboard
fun Property.getMaxCounter(value: String?, control: Control): Pair<Int, Int>?

Return a Pair of Int (current value length to max length), if the property is a TextInputProperty, control options showMaxCounter is true and has a max length specified.

Link copied to clipboard

Check if StringProperty is a dropdown based on the oneOf field.

Link copied to clipboard

Check if StringProperty is an email based on the format.

Link copied to clipboard
fun Property.isEnabled(control: Control, data: Map<String, Any?>): Boolean

Check if the property is enabled from the control rule if it exists. The data property is necessary because rules are based on a condition in relation to another field.

Link copied to clipboard

Check if StringProperty is a password based on the format.

Link copied to clipboard

Check if StringProperty is a phone based on the format.

Link copied to clipboard

Check if StringProperty is a radio based on the format and enum or oneOf fields.

Link copied to clipboard
fun Property.label(required: Boolean, control: Control): String?

Get the label of a field from the Property or the Control with '*' if it is required. If there is no title in the Property or label in the Control, it'll return null as label.