2019-10-02 17:24:42 +00:00
|
|
|
import ngModule from '../../module';
|
|
|
|
import './style.scss';
|
|
|
|
|
|
|
|
export default class DataViewer {
|
2019-10-03 17:34:24 +00:00
|
|
|
get isReady() {
|
|
|
|
return this.status == 'ready';
|
2019-10-02 17:24:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get status() {
|
2019-10-03 17:34:24 +00:00
|
|
|
if (this.isLoading)
|
2019-10-02 17:24:42 +00:00
|
|
|
return 'loading';
|
2023-05-11 10:07:14 +00:00
|
|
|
if (this.model)
|
|
|
|
return this.model.status;
|
2019-10-03 17:34:24 +00:00
|
|
|
if (!this.data)
|
2019-10-02 17:24:42 +00:00
|
|
|
return 'clear';
|
2019-10-03 17:34:24 +00:00
|
|
|
if (this.data.length)
|
|
|
|
return 'ready';
|
|
|
|
else
|
|
|
|
return 'empty';
|
2019-10-02 17:24:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-24 15:04:34 +00:00
|
|
|
ngModule.vnComponent('vnDataViewer', {
|
2019-10-02 17:24:42 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
transclude: true,
|
|
|
|
controller: DataViewer,
|
|
|
|
bindings: {
|
|
|
|
model: '<?',
|
|
|
|
data: '<?',
|
|
|
|
isLoading: '<?'
|
|
|
|
}
|
|
|
|
});
|