38 lines
1000 B
JavaScript
38 lines
1000 B
JavaScript
class ComponentLabView extends EICDomContent {
|
|
|
|
|
|
|
|
DOMContentLoaded() {
|
|
this.components = ui.eicfy(this.el);
|
|
|
|
this.tConfig = this.components.find(c => c.el.name == 'config');
|
|
this.tData = this.components.find(c => c.el.name == 'data');
|
|
this.btReset = this.components.find(c => c.el.classList.contains('button-update'));
|
|
|
|
this.reset(JSON.parse(this.tConfig.value), JSON.parse(this.tData.value));
|
|
|
|
this.btReset.addEventListener('click', this.onReset.bind(this));
|
|
}
|
|
|
|
onReset(event) {
|
|
event.stopPropagation();
|
|
event.preventDefault();
|
|
|
|
this.reset(JSON.parse(this.tConfig.value), JSON.parse(this.tData.value));
|
|
}
|
|
|
|
reset(config, data) {
|
|
this.map = new StateChart(this.find('.relation-map'), config)
|
|
|
|
this.map.data = data;
|
|
this.map.click = this.testBadge.bind(this)
|
|
}
|
|
|
|
testBadge(entity) {
|
|
entity.badge = 23
|
|
}
|
|
}
|
|
|
|
app.registerClass('ComponentLabView',ComponentLabView);
|
|
|