UNPKG

@rxdi/ui-kit

Version:

UI Components for building graphql-server website

59 lines 2.48 kB
"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); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.NavComponent = void 0; const lit_html_1 = require("@rxdi/lit-html"); const core_1 = require("@rxdi/core"); const nav_service_1 = require("./nav.service"); const operators_1 = require("rxjs/operators"); const rxjs_1 = require("rxjs"); let NavComponent = class NavComponent extends lit_html_1.LitElement { constructor() { super(...arguments); this.defaultDelay = 30; } OnInit() { this.styles = this.nav.getStylesSubject(); this.template = this.nav.getTemplateSubject(); this.openSubject = this.nav.getOpenSubject().pipe((0, operators_1.mergeMap)(i => (0, rxjs_1.of)(i).pipe((0, operators_1.delay)(this.initDelaySet ? this.defaultDelay : i.delay || this.defaultDelay), (0, operators_1.tap)(() => (this.initDelaySet = true)))), (0, operators_1.map)(options => (0, lit_html_1.html) ` <style> :host { left: ${options.left}px; } </style> `)); } close() { this.nav.close(); } }; __decorate([ (0, core_1.Inject)(nav_service_1.Nav), __metadata("design:type", nav_service_1.Nav) ], NavComponent.prototype, "nav", void 0); NavComponent = __decorate([ (0, lit_html_1.Component)({ selector: 'rx-nav', template() { return (0, lit_html_1.html) ` <style> :host { z-index: 1000; } ${(0, lit_html_1.async)(this.styles)} </style> ${(0, lit_html_1.async)(this.openSubject)} ${(0, lit_html_1.async)(this.template)} `; } }) ], NavComponent); exports.NavComponent = NavComponent; //# sourceMappingURL=nav.component.js.map