array¶
arrayの主な機能¶
- 項目追加ボタン
- minItems / maxItemsによる追加・削除ボタン制御
プロパティ | 内容 | 必須 | 国際化 | 備考 |
---|---|---|---|---|
type | widgetsの種別 | 必須 | array | |
key | Schemaの項目キー | 必須 | ||
previousLabel | 前ラベル | 対象 | ||
postLabel | 後ラベル | 対象 | ||
add | 項目追加リンク | 対象 | dataで規定値を指定しない場合、必須 | |
flex | flex定義 | wrapper,section内のみ有効 | ||
items | widgetの配列 |
注釈
JSON SchemaでminItemsおよび、maxItemsが未設定の場合、 minItems=1,maxItems=10が指定されているものして動作します。
なお、dataにminItemsの個数分のデータを設定する必要があります。 未設定の場合、初期表示では1件も表示されませんので注意してください。
arrayのレイアウトサンプル:
[
{
"type": "array",
"key": "tiers",
"items": [
{
"type": "section",
"direction": "row",
"items": [
{
"type": "icon",
"kind": "add",
"icon": "add_circle_outline",
"target": "tiers",
"flex": "1 1 auto"
},
{
"type": "icon",
"kind": "remove",
"icon": "remove_circle_outline",
"target": "tiers",
"flex": "1 1 auto"
},
{
"type": "input",
"key": "min_amount",
"title": "min_amount",
"flex": "8 8 auto"
},
{
"type": "input",
"key": "max_amount",
"title": "max_amount",
"flex": "8 8 auto"
}
]
}
]
}
]