Array
Array of items of the same type.
Specification
spec
Describes the data structure of array items.
Parameters inside spec use the syntax of the regular parameters.
Available types:
array
The output will be an array of Objects.
object
The output will be an array of primitive types. If the object contains a name
, it will be ignored.
When no spec is provided, the array will behave as a primitive array of strings. However, the preferred approach is setting the spec to {"type": "text"}
.
validate
Type:
Object
Collection of validation directives.
Available parameters:
maxItems
number
Specifies maximum length that an array parameter can have.
minItems
number
Specifies minimum length that an array parameter can have.
enum
array
Array of allowed values in the array.
mode
Type:
String
If editable (or
editable.enabled
) is set totrue
, you can use this option to set the initial mode of the field.Allowed values are
edit
andchoose
.
labels
Available parameters:
add
string
Default: Add item
. The text which is displayed on the adding button.
edit (deprecated)
string
Default: Edit item
. The text which is displayed on the item edit button.
field (deprecated)
string
If no spec
is provided, this field can be used as a label for the text input.
editable (deprecated)
Type:
Boolean or Object
If set to
true
, the user can map the value of the array.Available parameters:
enabled
boolean
Defines if the value can be mapped or not.
help
string
An alternative help text which is shown only when the editation is turned on.
Examples
Primitive Array
The primitive array is an array of simple variables, like numbers or strings.
Complex Array
The complex array is an array of complex objects - collections.
Complex Array with labeled collections
Amount of Items
You can use the validate
object to set minItems
and maxItems
to control the minimum and/or maximum amount of items in the array.
Mode
When the array is editable
, you can set the default state by using mode
.
Custom Labels
You can customize the button labels using the labels
object.
Editable Array (deprecated)
Since Apps platform version 2, all arrays are mappable(editable) by default.
When editable
is set to true
, you can map an array from another module to the array parameter.
Editable Array with Help (deprecated)
Since Apps platform version 2, this can be achieved by using the mappable
directive and looks exactly the same using the mappable.help
. It is not needed to set enabled
to true
anymore because that is set by default.
By setting help
inside the editable
object, you can set the help text which is shown when the mappable toggle is turned on. Don't forget to set editable.enabled
to true
.
Last updated