Property

@Serializable
sealed class Property

Common base sealed class for any property element.

Inheritors

Properties

Link copied to clipboard
abstract val const: JsonPrimitive?

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

Link copied to clipboard
abstract val description: String?

An optional description.

Link copied to clipboard
abstract val format: String?

An optional format.

Link copied to clipboard
abstract val not: Property?

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

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

An optional pattern to restrict the value of the property.

Link copied to clipboard
abstract val readOnly: Boolean?

An optional boolean to know if it is interactive.

Link copied to clipboard
abstract val title: String?

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
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
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.