props inheritance: default @{widgetId} to @{widgetId._value}

This commit is contained in:
jean-emmanuel 2018-02-05 15:45:13 +01:00
parent b14263d5c3
commit 058dfd4676
4 changed files with 41 additions and 6 deletions

View file

@ -22,6 +22,8 @@ If the retreived property is an object (`[] / {}`), a subset can be defined by a
The special property name `_value`<i class="md-icon">flash_on</i> refers to a widget's value, as opposed to its `value` property.
When omitted, the property name defaults to `_value` : `@{widgetId}` => `@{widgetId._value}`
## Dynamic properties
Some properties, when changed, trigger a complete widget recreation that ends any ongoing user interaction. Also, updating these properties continuously (e.g. when linked to a slider's dynamic value) can be very cpu expensive.

View file

@ -0,0 +1,19 @@
# Property maths
The following syntax allow writing mathematical formulas in widgets' properties:
```
#{ FORMULA }
```
Where FORMULA is a valid [MathJS](http://mathjs.org/docs/expressions/syntax.html) expression:
- [syntax documentation](http://mathjs.org/docs/expressions/syntax.html)
- [available functions](http://mathjs.org/docs/reference/functions.html)
- [available constants](http://mathjs.org/docs/reference/constants.html)
- property inheritance calls (`@{...}`) are always resolved before formulas
- arrays / matrices indexes are **zero-based** (ie `['a','b'][0]` returns `'a'`)
Additionnal functions:
- `unpack`: remove an array's brackets (`unpack([1,2])` returns `'1, 2'`)