ng2-flex-layout
Version:
Angular 2 Material Responsive Layout Directives
209 lines • 8.55 kB
JavaScript
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require('@angular/core');
var selector = "\n [layout], [layout-xs], [layout-gt-xs], [layout-sm], [layout-gt-sm], [layout-md], [layout-gt-md], [layout-lg], [layout-gt-lg], [layout-xl],\n [flex], [flex-xs], [flex-gt-xs], [flex-sm], [flex-gt-sm], [flex-md], [flex-gt-md], [flex-lg], [flex-gt-lg], [flex-xl]\n";
var LayoutDirective = (function () {
function LayoutDirective() {
}
Object.defineProperty(LayoutDirective.prototype, "classes", {
get: function () {
var previousClass = '';
if (this.class) {
previousClass = this.class;
}
var layoutClasses = this._getLayoutClasses();
var flexClasses = this._getFlexClasses();
return previousClass + " " + layoutClasses + " " + flexClasses;
},
enumerable: true,
configurable: true
});
LayoutDirective.prototype._getLayoutClasses = function () {
var layoutClasses = [];
if (this.layout) {
layoutClasses.push(this.layout === 'column' ? 'layout-column' : 'layout-row');
}
if (this.layoutXs) {
layoutClasses.push(this.layoutXs === 'column' ? 'layout-xs-column' : 'layout-xs-row');
}
if (this.layoutGtXs) {
layoutClasses.push(this.layoutGtXs === 'column' ? 'layout-gt-xs-column' : 'layout-gt-xs-row');
}
if (this.layoutSm) {
layoutClasses.push(this.layoutSm === 'column' ? 'layout-sm-column' : 'layout-sm-row');
}
if (this.layoutGtSm) {
layoutClasses.push(this.layoutGtSm === 'column' ? 'layout-gt-sm-column' : 'layout-gt-sm-row');
}
if (this.layoutMd) {
layoutClasses.push(this.layoutMd === 'column' ? 'layout-md-column' : 'layout-md-row');
}
if (this.layoutGtMd) {
layoutClasses.push(this.layoutGtMd === 'column' ? 'layout-gt-md-column' : 'layout-gt-md-row');
}
if (this.layoutLg) {
layoutClasses.push(this.layoutLg === 'column' ? 'layout-lg-column' : 'layout-lg-row');
}
if (this.layoutGtLg) {
layoutClasses.push(this.layoutGtLg === 'column' ? 'layout-gt-lg-column' : 'layout-gt-lg-row');
}
if (this.layoutXl) {
layoutClasses.push(this.layoutXl === 'column' ? 'layout-xl-column' : 'layout-xl-row');
}
return layoutClasses.join(' ');
};
LayoutDirective.prototype._getFlexClasses = function () {
var flexClasses = [];
if (typeof this.flex !== 'undefined') {
flexClasses.push(this.flex.length ? "flex-" + this.flex : 'flex');
}
if (typeof this.flexXs !== 'undefined') {
flexClasses.push(this.flexXs.length ? "flex-xs-" + this.flexXs : 'flex-xs');
}
if (typeof this.flexGtXs !== 'undefined') {
flexClasses.push(this.flexGtXs.length ? "flex-gt-xs-" + this.flexGtXs : 'flex-gt-xs');
}
if (typeof this.flexSm !== 'undefined') {
flexClasses.push(this.flexSm ? "flex-sm-" + this.flexSm : 'flex-sm');
}
if (typeof this.flexGtSm !== 'undefined') {
flexClasses.push(this.flexGtSm ? "flex-gt-sm-" + this.flexGtSm : 'flex-gt-sm');
}
if (typeof this.flexMd !== 'undefined') {
flexClasses.push(this.flexMd ? "flex-md-" + this.flexMd : 'flex-md');
}
if (typeof this.flexGtMd !== 'undefined') {
flexClasses.push(this.flexGtMd ? "flex-gt-md-" + this.flexGtMd : 'flex-gt-md');
}
if (typeof this.flexLg !== 'undefined') {
flexClasses.push(this.flexLg ? "flex-lg-" + this.flexLg : 'flex-lg');
}
if (typeof this.flexGtLg !== 'undefined') {
flexClasses.push(this.flexGtLg ? "flex-gt-lg-" + this.flexGtLg : 'flex-gt-lg');
}
if (typeof this.flexXl !== 'undefined') {
flexClasses.push(this.flexXl ? "flex-xl-" + this.flexXl : 'flex-xl');
}
return flexClasses.join(' ');
};
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "class", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "layout", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "layoutXs", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "layoutGtXs", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "layoutSm", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "layoutGtSm", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "layoutMd", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "layoutGtMd", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "layoutLg", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "layoutGtLg", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "layoutXl", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "flex", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "flexXs", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "flexGtXs", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "flexSm", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "flexGtSm", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "flexMd", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "flexGtMd", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "flexLg", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "flexGtLg", void 0);
__decorate([
core_1.Input(),
__metadata('design:type', String)
], LayoutDirective.prototype, "flexXl", void 0);
__decorate([
core_1.HostBinding('class'),
__metadata('design:type', Object)
], LayoutDirective.prototype, "classes", null);
LayoutDirective = __decorate([
core_1.Directive({ selector: selector }),
__metadata('design:paramtypes', [])
], LayoutDirective);
return LayoutDirective;
}());
exports.LayoutDirective = LayoutDirective;
var LayoutModule = (function () {
function LayoutModule() {
}
LayoutModule = __decorate([
core_1.NgModule({
exports: [
LayoutDirective
],
declarations: [
LayoutDirective
],
}),
__metadata('design:paramtypes', [])
], LayoutModule);
return LayoutModule;
}());
exports.LayoutModule = LayoutModule;
//# sourceMappingURL=index.js.map