DispatchWrapper
dispatch-wrapper
Description
A metric / imperial entry control that supports various units.
Attributes
unit
: mass | lengthsingleEntry
: true | false; applies to length, if true then only inches if false feet and inches.
Version 4 changes
- onDispatch and onGroupChange are not supported
- onDispatchLoad adds support for dynamic scripts replacing declarative approach for version 3
Example
{
"type": "string",
"$capture": {
"as": "dispatch-wrapper",
"query": "current user, given tracker [regular-medicine]",
"onDispatch": [
{
"pick": "values.number_a_day",
"apply": "sum(ls)",
"save": "medicineGoal"
}
],
"onGroupChange": [
{
"pick": "{size(values.self)}",
"apply": "sum(ls)",
"save": "medicineStatus"
}
],
"form": {
"as": "toggle-button",
"mode": "list",
"width": "full",
"styles": {
"title": {
"fontSize": "1rem"
}
},
"classes": {
"root": "mt-2"
}
},
"mapping": [
{
"from": "values.name",
"to": "title"
},
{
"from": "id",
"to": "$api"
},
{
"from": "values.number_a_day",
"to": "$capture.maximum"
}
]
},
"$display": {
"rule": {
"setting": "never"
}
},
"title": "Medicine Loop",
"$data": {
"source": [
{
"display": "朝",
"value": "朝",
"tableData": {
"id": 0
}
},
{
"display": "昼",
"value": "昼",
"tableData": {
"id": 1
}
},
{
"display": "夜",
"value": "夜",
"tableData": {
"id": 2
}
}
]
}
}