matrix: refine widget recreation process on props update

This commit is contained in:
jean-emmanuel 2018-06-28 10:28:35 +02:00
parent ba168881b5
commit 39d0146370

View file

@ -93,16 +93,30 @@ class Matrix extends _matrix_base {
case 'props':
var hashes = [...this.childrenHashes]
this.childrenHashes = []
for (var i in this.childrenHashes) {
for (var i in hashes) {
let widget = widgetManager.widgets[this.childrenHashes[i]],
let widget = widgetManager.widgets[hashes[i]],
data = this.resolveProp('props', undefined, false, false, false, {'i':i})
Object.assign(widget.props, data)
widget.updateProps(Object.keys(data), this)
}
if (!this.childrenHashes.length) {
// only dynamic props updated
this.childrenHashes = hashes
} else {
// widgets recreated
for (i in this.childrenHashes) {
let widget = widgetManager.widgets[this.childrenHashes[i]]
widget.container.classList.add('not-editable')
}
}
return
}