matrix/keyboard: id variable in script is now the id of the child widget that triggered the event
This commit is contained in:
parent
42f316cf81
commit
cfcf22b9dd
5 changed files with 25 additions and 19 deletions
|
|
@ -216,7 +216,9 @@ class Widget extends EventEmitter {
|
|||
event: 'value'
|
||||
}, builtIn: true, parent: this})
|
||||
this.on('change', (e)=>{
|
||||
if (e.widget === this && this.mounted && !e.options.fromEdit) this.script.setValue(this.value, {...e.options, id: e.options.id || e.id})
|
||||
if (e.widget === this && this.mounted && !e.options.fromEdit) {
|
||||
this.script.setValue(e.options.widget ? e.options.widget.value : this.value, {...e.options, id: e.options.id || e.id})
|
||||
}
|
||||
})
|
||||
if (String(this.getProp('script')).includes('touch')) {
|
||||
this.on('touch', (e)=>{
|
||||
|
|
|
|||
|
|
@ -51,21 +51,27 @@ class Keyboard extends Panel {
|
|||
|
||||
this.childrenType = undefined
|
||||
this.value = []
|
||||
|
||||
|
||||
this.on('change',(e)=>{
|
||||
|
||||
if (e.widget === this) return
|
||||
var widget = e.widget
|
||||
|
||||
this.value[e.widget._index] = e.widget.getValue()
|
||||
if (widget === this) return
|
||||
|
||||
this.value[widget._index] = widget.getValue()
|
||||
|
||||
if (e.options.send) {
|
||||
var start = parseInt(this.getProp('start'))
|
||||
this.sendValue({
|
||||
v: [e.widget._index + start, e.widget.getValue() ? this.getProp('on') : this.getProp('off')]
|
||||
v: [e.widget._index + start, widget.getValue() ? this.getProp('on') : this.getProp('off')]
|
||||
})
|
||||
}
|
||||
|
||||
this.changed(e.options)
|
||||
this.changed({
|
||||
...e.options,
|
||||
id: widget.getProp('id')
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -44,22 +44,16 @@ class Matrix extends Panel {
|
|||
|
||||
if (e.widget === this) return
|
||||
|
||||
if (this.getProp('widgetType') === 'clone') {
|
||||
var widget = this.getProp('widgetType') === 'clone' ? e.widget.parent : e.widget
|
||||
|
||||
if (e.widget.parent.parent !== this) return
|
||||
if (widget.parent !== this) return
|
||||
|
||||
this.value[e.widget.parent._index] = e.widget.getValue()
|
||||
this.value[widget._index] = e.widget.getValue()
|
||||
|
||||
} else {
|
||||
|
||||
if (e.widget.parent !== this) return
|
||||
|
||||
this.value[e.widget._index] = e.widget.getValue()
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.changed(e.options)
|
||||
this.changed({
|
||||
...e.options,
|
||||
id: widget.getProp('id')
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue