@rxdi/ui-kit
Version:
UI Components for building graphql-server website
89 lines • 3.63 kB
JavaScript
;
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.MainModalComponent = void 0;
const lit_html_1 = require("@rxdi/lit-html");
const core_1 = require("@rxdi/core");
const modal_service_1 = require("../../modal/modal.service");
const interface_1 = require("../../modal/interface");
const style_css_1 = require("./style.css");
let MainModalComponent = class MainModalComponent extends lit_html_1.LitElement {
constructor() {
super(...arguments);
this.modalService = core_1.Container.get(modal_service_1.ModalService);
}
OnUpdateFirst() {
if (this.options.backdropClose) {
this.backdrop.addEventListener('click', () => this.close());
}
this.modalService.setContainerRef(this.container);
}
close() {
this.modalService.close();
}
};
exports.MainModalComponent = MainModalComponent;
__decorate([
(0, core_1.Injector)(interface_1.MODAL_DIALOG_DATA),
__metadata("design:type", Object)
], MainModalComponent.prototype, "data", void 0);
__decorate([
(0, core_1.Injector)(interface_1.MODAL_DIALOG_OPTIONS),
__metadata("design:type", Object)
], MainModalComponent.prototype, "options", void 0);
__decorate([
(0, lit_html_1.query)('.backdrop'),
__metadata("design:type", HTMLElement)
], MainModalComponent.prototype, "backdrop", void 0);
__decorate([
(0, lit_html_1.query)('.container'),
__metadata("design:type", HTMLElement)
], MainModalComponent.prototype, "container", void 0);
exports.MainModalComponent = MainModalComponent = __decorate([
(0, lit_html_1.Component)({
selector: 'rx-modal-main',
styles: [
style_css_1.style,
style_css_1.button
],
template() {
return (0, lit_html_1.html) `
<style>
${this.data.style}
</style>
<div class="container" @scroll=${(e) => this.modalService.setScrollWidth(e.currentTarget.scrollTop)}>
<div class="dialog">
<button class="close-button" @click=${() => this.close()}>
${(0, lit_html_1.svg) `
<svg width="14" height="14" viewBox="0 0 14 14">
<line fill="none" stroke="#666" stroke-width="1.1" x1="1" y1="1" x2="13" y2="13"></line>
<line fill="none" stroke="#666" stroke-width="1.1" x1="13" y1="1" x2="1" y2="13"></line>
</svg>
`}
</button>
${this.data.template
? (0, lit_html_1.html) `
${this.data.template}
`
: (0, lit_html_1.html) `
<h1>${this.data.title}</h1>
<p>
${this.data.description}
</p>
`}
</div>
</div>
<div class="backdrop"></div>
`;
}
})
], MainModalComponent);
//# sourceMappingURL=main.js.map