UNPKG

@cardboard-box/ngx-box

Version:

A collection of useful directives, components and services for angular

35 lines 10.3 kB
import { Component, Input } from '@angular/core'; import * as i0 from "@angular/core"; import * as i1 from "@angular/common"; import * as i2 from "../magic-circle/magic-circle.component"; import * as i3 from "../magic-circle/ring/ring.component"; import * as i4 from "../magic-circle/square/square.component"; import * as i5 from "../icon/icon.component"; export class ContainerComponent { constructor() { this.loading = false; this.handleScroll = false; } set notLoading(value) { this.loading = !value; } get notLoading() { return !this.loading; } } ContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: ContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); ContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: ContainerComponent, selector: "box-container", inputs: { loading: "loading", loadingText: ["loading-text", "loadingText"], error: "error", handleScroll: ["handle-scroll", "handleScroll"], notLoading: ["not-loading", "notLoading"] }, ngImport: i0, template: "<main class=\"flex\">\n <section class=\"loading center\" *ngIf=\"loading\">\n <magic-circle spin-speed=\"20s\" width=\"100%\" height=\"100%\">\n <mc-ring [text]=\"loadingText || 'Some fancy stuff is happening... Sit tight...'\">\n <mc-square [total]=\"3\" [index]=\"0\"></mc-square>\n <mc-square [total]=\"3\" [index]=\"1\"></mc-square>\n <mc-square [total]=\"3\" [index]=\"2\">\n <mc-ring text=\"Loading... Loading... Loading...\">\n <mc-square [total]=\"3\" [index]=\"0\"></mc-square>\n <mc-square [total]=\"3\" [index]=\"1\"></mc-square>\n <mc-square [total]=\"3\" [index]=\"2\"></mc-square>\n </mc-ring>\n </mc-square>\n </mc-ring>\n </magic-circle>\n </section>\n <section class=\"error center\" *ngIf=\"error\">\n <h1><box-icon>warning</box-icon>An error occurred:</h1>\n <p>{{ error }}</p>\n </section>\n <section class=\"content\" *ngIf=\"!loading && !error\" [ngClass]=\"{ 'scroll': handleScroll || handleScroll === '' }\">\n <ng-content></ng-content>\n </section>\n</main>", styles: [".static-fill{position:fixed!important;top:0;left:0;width:100vw;height:100vh;overflow:hidden;display:flex;background-color:var(--bg-color);color:var(--text-color);margin:0;padding:0;font-family:Roboto}.flex{display:flex;flex-flow:row;overflow:hidden;color:var(--text-color);position:relative}.flex.row{flex-flow:column}.flex .fill{flex:1}.flex .center-vert{margin-top:auto;margin-bottom:auto}.flex .center-horz{margin-left:auto;margin-right:auto}.flex .center{margin:auto}.flex .pad-left{margin-left:auto}.flex .pad-right{margin-right:auto}\n", "main{position:absolute;width:100%;height:100%}main .loading{width:400px;height:400px;position:relative}main .error h1,main .error p{text-align:center}main .content{position:relative;width:100%;height:100%;overflow:hidden}main .content.scroll{overflow-y:auto}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MagicCircleComponent, selector: "magic-circle", inputs: ["width", "height", "spin-speed"] }, { kind: "component", type: i3.RingComponent, selector: "mc-ring", inputs: ["width", "height", "color", "innerWidth", "text"] }, { kind: "component", type: i4.SquareComponent, selector: "mc-square", inputs: ["width", "height", "color", "rotate", "total", "index"] }, { kind: "component", type: i5.IconComponent, selector: "box-icon", inputs: ["font-size", "unsize", "fill", "spin"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: ContainerComponent, decorators: [{ type: Component, args: [{ selector: 'box-container', template: "<main class=\"flex\">\n <section class=\"loading center\" *ngIf=\"loading\">\n <magic-circle spin-speed=\"20s\" width=\"100%\" height=\"100%\">\n <mc-ring [text]=\"loadingText || 'Some fancy stuff is happening... Sit tight...'\">\n <mc-square [total]=\"3\" [index]=\"0\"></mc-square>\n <mc-square [total]=\"3\" [index]=\"1\"></mc-square>\n <mc-square [total]=\"3\" [index]=\"2\">\n <mc-ring text=\"Loading... Loading... Loading...\">\n <mc-square [total]=\"3\" [index]=\"0\"></mc-square>\n <mc-square [total]=\"3\" [index]=\"1\"></mc-square>\n <mc-square [total]=\"3\" [index]=\"2\"></mc-square>\n </mc-ring>\n </mc-square>\n </mc-ring>\n </magic-circle>\n </section>\n <section class=\"error center\" *ngIf=\"error\">\n <h1><box-icon>warning</box-icon>An error occurred:</h1>\n <p>{{ error }}</p>\n </section>\n <section class=\"content\" *ngIf=\"!loading && !error\" [ngClass]=\"{ 'scroll': handleScroll || handleScroll === '' }\">\n <ng-content></ng-content>\n </section>\n</main>", styles: [".static-fill{position:fixed!important;top:0;left:0;width:100vw;height:100vh;overflow:hidden;display:flex;background-color:var(--bg-color);color:var(--text-color);margin:0;padding:0;font-family:Roboto}.flex{display:flex;flex-flow:row;overflow:hidden;color:var(--text-color);position:relative}.flex.row{flex-flow:column}.flex .fill{flex:1}.flex .center-vert{margin-top:auto;margin-bottom:auto}.flex .center-horz{margin-left:auto;margin-right:auto}.flex .center{margin:auto}.flex .pad-left{margin-left:auto}.flex .pad-right{margin-right:auto}\n", "main{position:absolute;width:100%;height:100%}main .loading{width:400px;height:400px;position:relative}main .error h1,main .error p{text-align:center}main .content{position:relative;width:100%;height:100%;overflow:hidden}main .content.scroll{overflow-y:auto}\n"] }] }], propDecorators: { loading: [{ type: Input }], loadingText: [{ type: Input, args: ['loading-text'] }], error: [{ type: Input }], handleScroll: [{ type: Input, args: ['handle-scroll'] }], notLoading: [{ type: Input, args: ['not-loading'] }] } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udGFpbmVyLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2NhcmRib2FyZGJveC9uZ3gtYm94L3NyYy9saWIvY29tcG9uZW50cy9jb250YWluZXIvY29udGFpbmVyLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3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