salix/front/core/components/data-viewer/index.js

33 lines
679 B
JavaScript

import ngModule from '../../module';
import './style.scss';
export default class DataViewer {
get isReady() {
return this.status == 'ready';
}
get status() {
if (this.isLoading)
return 'loading';
if (this.model)
return this.model.status;
if (!this.data)
return 'clear';
if (this.data.length)
return 'ready';
else
return 'empty';
}
}
ngModule.vnComponent('vnDataViewer', {
template: require('./index.html'),
transclude: true,
controller: DataViewer,
bindings: {
model: '<?',
data: '<?',
isLoading: '<?'
}
});