UNPKG

@ngfx/ui

Version:

Angular UI library for gaming and creative applications

54 lines (53 loc) 3.06 kB
import { Component, Input } from '@angular/core'; import { NgFxController } from '../../services/controller/controller.service'; import { DomSanitizer } from '@angular/platform-browser'; var NgFxSurfaceComponent = (function () { function NgFxSurfaceComponent(_controller, _sanitizer) { this._controller = _controller; this._sanitizer = _sanitizer; this.controlMap = new Array(); } NgFxSurfaceComponent.prototype.ngOnChanges = function (changes) { if (changes["controller"]) { this.controlMap = this.mapToControls(changes["controller"].currentValue); } }; NgFxSurfaceComponent.prototype.mapToControls = function (key) { var _this = this; return Object.keys(this._controller.surfaces[key].controls).map(function (prop) { return _this._controller.surfaces[key].controls[prop]; }); }; NgFxSurfaceComponent.prototype.sanitize = function (style) { return this._sanitizer.bypassSecurityTrustStyle(style); }; NgFxSurfaceComponent.prototype.ngOnInit = function () { }; NgFxSurfaceComponent.decorators = [ { type: Component, args: [{ selector: 'ngfx-surface, [ngfx-surface]', template: "<div class=\"control__group\" [style.display]=\"sanitize(display)\" [style.grid]=\"sanitize(grid)\" [style.grid-gap]=\"sanitize(gridGap)\"><ng-container *ngFor=\"let control of controlMap\"><ngfx-slider *ngIf=\"control.type === \'slider\'\" [control]=\"control\" class=\"control__pane\"></ngfx-slider><ngfx-button *ngIf=\"control.type === \'button\'\" [control]=\"control\" class=\"control__pane\"></ngfx-button></ng-container></div>", styles: ["/**\n * Convert font-size from px to rem with px fallback\n *\n * @param $size - the value in pixel you want to convert\n *\n * e.g. p {@include fontSize(12px);}\n *\n */\n:host {\n display: block;\n overflow: hidden;\n}\n\n:host:after {\n content: \'\';\n display: table;\n clear: both;\n}\n\n.control__group {\n width: 100%;\n height: 100vh;\n overflow: hidden;\n display: grid;\n}\n\n.control__group:after {\n content: \'\';\n display: table;\n clear: both;\n}\n"] },] }, ]; NgFxSurfaceComponent.ctorParameters = function () { return [ { type: NgFxController }, { type: DomSanitizer } ]; }; NgFxSurfaceComponent.propDecorators = { controller: [{ type: Input, args: ['controller',] }], grid: [{ type: Input, args: ['grid',] }], gridGap: [{ type: Input, args: ['gridGap',] }], display: [{ type: Input, args: ['display',] }] }; return NgFxSurfaceComponent; }()); export { NgFxSurfaceComponent }; if (false) { NgFxSurfaceComponent.prototype.controller; NgFxSurfaceComponent.prototype.grid; NgFxSurfaceComponent.prototype.gridGap; NgFxSurfaceComponent.prototype.display; NgFxSurfaceComponent.prototype.controlMap; NgFxSurfaceComponent.prototype._controller; NgFxSurfaceComponent.prototype._sanitizer; }