/** * @license * Copyright Paperbits. All Rights Reserved. * * Use of this source code is governed by a Commercial license that can be found in the LICENSE file and at https://paperbits.io/license/commercial. */ import * as ko from "knockout"; import template from "./row.html"; import { Component } from "@paperbits/common/ko/decorators"; import { WidgetViewModel } from "@paperbits/core/ko/widgetViewModel"; @Component({ selector: "email-layout-row", template: template }) export class RowViewModel implements WidgetViewModel { public widgets: ko.ObservableArray; public css: ko.Computed; public alignSm: ko.Observable; public alignMd: ko.Observable; public alignLg: ko.Observable; public justifySm: ko.Observable; public justifyMd: ko.Observable; public justifyLg: ko.Observable; constructor() { this.widgets = ko.observableArray(); this.alignSm = ko.observable(); this.alignMd = ko.observable(); this.alignLg = ko.observable(); this.justifySm = ko.observable(); this.justifyMd = ko.observable(); this.justifyLg = ko.observable(); this.css = ko.computed(() => { let css = ""; if (this.alignSm()) { css += " " + this.alignSm() + "-sm"; } if (this.alignMd()) { css += " " + this.alignMd() + "-md"; } if (this.alignLg()) { css += " " + this.alignLg() + "-lg"; } if (this.justifySm()) { css += " " + this.justifySm() + "-sm"; } if (this.justifyMd()) { css += " " + this.justifyMd() + "-md"; } if (this.justifyLg()) { css += " " + this.justifyLg() + "-lg"; } return css; }); } }