cluedin-widget
Version:
This is the project for creating and managing widgets in CluedIn.
31 lines (23 loc) • 533 B
JavaScript
var Row = function( w ) {
this.widgets = [];
if ( w ) {
this.widgets.push( w );
}
};
Row.prototype.calculate = function() {
var total = 0;
this.widgets.forEach( function( w ) {
total += w.size;
}, this );
return total;
};
Row.prototype.placeLeft = function() {
return ( 12 - this.calculate() );
};
Row.prototype.addWidget = function( w ) {
this.widgets.push( w );
};
Row.prototype.hasSpace = function( w ) {
return (this.placeLeft() >= w.size);
};
module.exports = Row;