UNPKG

ferngully-aurelia-tools

Version:

Ferngully Tools for Aurelia

100 lines 4.23 kB
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); }; import { customElement, bindable, autoinject, containerless, computedFrom } from "aurelia-framework"; import { bindingMode as BindingMode } from "aurelia-binding"; import "./boolean-input.css"; import "../../../fonts/ferngullyiconfont/styles.css"; var BooleanInput = (function () { function BooleanInput() { this.inverse = false; } Object.defineProperty(BooleanInput.prototype, "iconClass", { get: function () { var target = this.inverse ? !this.target : this.target; var enabledClass = target ? " enabled" : " disabled"; var css; if (target) { css = this.inverse ? "fg-notchecked" : "fg-checked"; } else { if (this.banOnFalse) { css = this.inverse ? "fg-checked" : "fg-notchecked"; } else if (this.grayOnFalse) { css = this.inverse ? "fg-notchecked" : "fg-checked"; } else { css = "fg-checked"; } } return css + enabledClass; }, enumerable: true, configurable: true }); Object.defineProperty(BooleanInput.prototype, "iconStyle", { get: function () { var style = {}; var target = this.inverse ? !this.target : this.target; if (!target) { if (this.grayOnFalse || this.banOnFalse) { style.color = 'lightgray'; } else { style.color = 'transparent'; } } else { style.color = '#8aa300'; } return style; }, enumerable: true, configurable: true }); __decorate([ bindable({ defaultBindingMode: BindingMode.twoWay }), __metadata("design:type", Boolean) ], BooleanInput.prototype, "target", void 0); __decorate([ bindable({ defaultValue: null, defaultBindingMode: BindingMode.oneTime }), __metadata("design:type", String) ], BooleanInput.prototype, "class", void 0); __decorate([ bindable({ defaultValue: false, defaultBindingMode: BindingMode.oneTime }), __metadata("design:type", Boolean) ], BooleanInput.prototype, "banOnFalse", void 0); __decorate([ bindable({ defaultValue: false, defaultBindingMode: BindingMode.oneTime }), __metadata("design:type", Boolean) ], BooleanInput.prototype, "grayOnFalse", void 0); __decorate([ bindable, __metadata("design:type", Boolean) ], BooleanInput.prototype, "inverse", void 0); __decorate([ computedFrom('target', 'inverse', 'grayOnFalse', 'banOnFalse'), __metadata("design:type", String), __metadata("design:paramtypes", []) ], BooleanInput.prototype, "iconClass", null); __decorate([ computedFrom('target', 'inverse', 'grayOnFalse', 'banOnFalse'), __metadata("design:type", Object), __metadata("design:paramtypes", []) ], BooleanInput.prototype, "iconStyle", null); BooleanInput = __decorate([ containerless, autoinject, customElement('boolean-input') ], BooleanInput); return BooleanInput; }()); export { BooleanInput }; //# sourceMappingURL=boolean-input.js.map