'use strict'; const defaultParams = { string: 'param', number: 0, boolean: false, }; exports.template = /* html */`
params
{{paramIndex + 1}}
`; exports.props = [ 'event', 'index', ]; exports.methods = { onConfirm(event) { const that = this; const name = event.target.getAttribute('name'); if (!name) { return; } let index = event.target.getAttribute('index'); const value = event.target.value; const eventInfo = that.event; let params = []; switch (name) { case 'funcName': if (value === event.func) { return; } eventInfo.func = value; break; case 'changeParamType': params = eventInfo.params; params.splice(index, 1, defaultParams[value]); break; case 'param': params = eventInfo.params; if (params[index] === value) { return; } params.splice(index, 1, value); break; } that.$emit('update', that.event, that.index); }, async onMouseDown(event) { const that = this; const name = event.target.getAttribute('name'); let index = event.target.getAttribute('index'); switch (name) { case 'delFunc': that.$emit('delete', that.index); return; case 'addParams': that.event.params.splice(that.event.params.length - 1, 0, 'param'); break; case 'delParams': that.event.params.splice(index, 1); break; case 'clearParams': that.event.params = []; break; } that.$emit('update', that.event, that.index); }, };