widget base: props: add a list of dynamic props that don't need any action when changed to take effect

This commit is contained in:
jean-emmanuel 2018-02-04 23:25:42 +01:00
parent 1e7d13c279
commit d00eedc5f8

View file

@ -27,6 +27,7 @@ module.exports = class _widgets_base extends EventEmitter {
this.container = options.container || fallbackContainer
this.widget = DOM.create(options.html)
this.props = options.props
this.dynamicProps = []
this.parent = options.root ? widgetManager : options.parent
this.parentNode = options.parentNode
this.hash = shortid.generate()
@ -324,12 +325,16 @@ module.exports = class _widgets_base extends EventEmitter {
onPropChanged(propName, options) {
if (this.dynamicProps.indexOf(propName) != -1) return
switch(propName) {
case 'value':
this.setValue(this.getProp('value'), {sync:true, send: options && options.send})
return
default:
this.reCreateWidget()
return true