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

34 lines
678 B
JavaScript

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