UNPKG

ddc-library-commons

Version:

Angular library for commons modules, components, services and more of the ddc project

177 lines (167 loc) 9.09 kB
import * as i0 from '@angular/core'; import { Component, Input, NgModule, Injectable } from '@angular/core'; import * as i1 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i2 from '@angular/router'; import { RouterModule } from '@angular/router'; class DdcLibraryCommonsComponent { constructor() { } ngOnInit() { } } DdcLibraryCommonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DdcLibraryCommonsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); DdcLibraryCommonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: DdcLibraryCommonsComponent, selector: "ddc-library-commons", ngImport: i0, template: ` <p> ddc-library-commons works! </p> `, isInline: true }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DdcLibraryCommonsComponent, decorators: [{ type: Component, args: [{ selector: 'ddc-library-commons', template: ` <p> ddc-library-commons works! </p> `, styles: [] }] }], ctorParameters: function () { return []; } }); class BreadcrumbDdcComponent { } BreadcrumbDdcComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BreadcrumbDdcComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); BreadcrumbDdcComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: BreadcrumbDdcComponent, selector: "ddc-breadcrumb", inputs: { parts: "parts", position: "position" }, ngImport: i0, template: "<ol class=\"breadcrumb\" [ngClass]=\"position\">\n <li *ngFor=\"let item of parts; last as isLast\" class=\"breadcrumb-item\">\n <a [routerLink]=\"item.url\" *ngIf=\"!isLast\">{{ item.label }}</a>\n <span *ngIf=\"isLast\" class=\"active\">{{ item.label }}</span>\n </li>\n </ol>", styles: [".breadcrumb{display:flex;flex-wrap:wrap;list-style:none}.breadcrumb.relative{padding:0;position:relative}.breadcrumb.absolute{left:0;position:absolute;margin-top:1.25rem;z-index:100}.breadcrumb-item{font-size:.875rem;font-weight:500;line-height:1.25rem;margin-right:.5rem}.breadcrumb-item a{color:#00447c}.breadcrumb-item .active{color:#00447c;text-decoration:underline}.breadcrumb-item+.breadcrumb-item:before{color:#00447c;content:\">\";display:inline-block;padding-right:.625rem}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BreadcrumbDdcComponent, decorators: [{ type: Component, args: [{ selector: 'ddc-breadcrumb', templateUrl: './breadcrumb-ddc.component.html', styleUrls: ['./breadcrumb-ddc.component.scss'] }] }], propDecorators: { parts: [{ type: Input }], position: [{ type: Input }] } }); const COMPONENTS = [BreadcrumbDdcComponent]; class DdcLibraryCommonsModule { } DdcLibraryCommonsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DdcLibraryCommonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); DdcLibraryCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DdcLibraryCommonsModule, declarations: [DdcLibraryCommonsComponent, BreadcrumbDdcComponent], imports: [CommonModule, RouterModule], exports: [DdcLibraryCommonsComponent, BreadcrumbDdcComponent] }); DdcLibraryCommonsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DdcLibraryCommonsModule, imports: [[ CommonModule, RouterModule ]] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DdcLibraryCommonsModule, decorators: [{ type: NgModule, args: [{ declarations: [ DdcLibraryCommonsComponent, ...COMPONENTS ], imports: [ CommonModule, RouterModule ], exports: [ DdcLibraryCommonsComponent, ...COMPONENTS ] }] }] }); class ScrollDdcService { scrollTo(behavior, target) { document.getElementById(target ? target : 'main').scrollIntoView({ behavior }); } } ScrollDdcService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ScrollDdcService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); ScrollDdcService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ScrollDdcService, providedIn: 'root' }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ScrollDdcService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }] }); class RouteStatusDdcService { constructor() { this.routeStatus = {}; this.setMetadata = (pageKey, metadata) => { this.routeStatus[pageKey] = Object.assign(Object.assign({}, this.routeStatus[pageKey]), { metadata }); }; this.setSubmetadata = (pageKey, subKey, submetadata) => { this.routeStatus[pageKey][subKey] = Object.assign(Object.assign({}, this.routeStatus[pageKey][subKey]), submetadata); }; this.getRouteMetadata = pageKey => this.routeStatus[pageKey]; this.deleteMetadata = pageKey => delete this.routeStatus[pageKey]; } } RouteStatusDdcService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: RouteStatusDdcService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); RouteStatusDdcService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: RouteStatusDdcService, providedIn: 'root' }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: RouteStatusDdcService, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }] }); function checkOverflow(element) { return !(element.offsetWidth < element.scrollWidth); } function overflowHeight(element) { return !(element.offsetHeight < element.scrollHeight); } function stringMapToJson(value) { let mapString = value .replace(/=/g, '":"') .replace(/,/g, '","') .replace(/\{/g, '{"') .replace(/\}/g, '"}') .replace(/"{/g, '{') .replace(/}"/g, '}') .replace(/"\[/g, '[') .replace(/\]"/g, ']') .replace(/ /g, ''); return JSON.parse(mapString); } function removeKeyFromObject(obj, key) { let objResults = {}; for (let i in obj) { if (typeof obj[i] == 'object') { let objResult = removeKeyFromObject(obj[i], key); if (i == key) { Object.keys(objResult).forEach(elem => { objResults[elem] = objResult[elem]; }); } else { objResults[i] = {}; Object.keys(objResult).forEach(elem => { objResults[i][elem] = objResult[elem]; }); } } else { objResults[i] = obj[i]; } } return objResults; } function sortArrayByDate(inputArray, sortKey, asc) { inputArray.sort((a, b) => { const dateA = new Date(a[sortKey]).valueOf(); const dateB = new Date(b[sortKey]).valueOf(); return dateA - dateB; }); if (asc) { return inputArray; } return inputArray.reverse(); } /* * Public API Surface of ddc-library-commons */ /** * Generated bundle index. Do not edit. */ export { BreadcrumbDdcComponent, DdcLibraryCommonsComponent, DdcLibraryCommonsModule, RouteStatusDdcService, ScrollDdcService, checkOverflow, overflowHeight, removeKeyFromObject, sortArrayByDate, stringMapToJson }; //# sourceMappingURL=ddc-library-commons.js.map