2020-07-09 09:08:47 +00:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { set } from '@ember/object';
|
|
|
|
import Slotted from 'block-slots';
|
|
|
|
|
|
|
|
import chart from './chart.xstate';
|
|
|
|
export default Component.extend(Slotted, {
|
|
|
|
tagName: '',
|
|
|
|
onchange: data => data,
|
|
|
|
init: function() {
|
|
|
|
this._super(...arguments);
|
|
|
|
this.chart = chart;
|
|
|
|
},
|
|
|
|
didReceiveAttrs: function() {
|
|
|
|
this._super(...arguments);
|
|
|
|
if (typeof this.items !== 'undefined') {
|
|
|
|
this.actions.change.apply(this, [this.items]);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
didInsertElement: function() {
|
|
|
|
this._super(...arguments);
|
|
|
|
this.dispatch('LOAD');
|
|
|
|
},
|
|
|
|
actions: {
|
|
|
|
isLoaded: function() {
|
2020-07-17 13:42:45 +00:00
|
|
|
return typeof this.items !== 'undefined' || typeof this.src === 'undefined';
|
2020-07-09 09:08:47 +00:00
|
|
|
},
|
|
|
|
change: function(data) {
|
|
|
|
set(this, 'data', this.onchange(data));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|