@ngx-dynamic-components/tools
Version:
@ngx-dynamic-components/tools is Angular 7+ library what contains a core interfaces to build a configuration driven web pages.
46 lines • 5.59 kB
JavaScript
import { Component } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
import * as i0 from "@angular/core";
import * as i1 from "@angular/material/dialog";
import * as i2 from "@angular/common";
import * as i3 from "@angular/material/list";
export class AddDialogComponent {
dialogRef;
categories = [];
constructor(dialogRef) {
this.dialogRef = dialogRef;
}
ngOnInit() {
this.categories = [];
}
selectComponent(item) {
this.dialogRef.close(item.defaultModel || item.example.uiModel || {
type: `${item.packageName}:${item.name}`,
itemProperties: {},
containerProperties: {}
});
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: AddDialogComponent, deps: [{ token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: AddDialogComponent, selector: "dc-add-dialog", ngImport: i0, template: `
<mat-list role="list" class="components" *ngFor="let cat of categories">
<h3 class="mat-h3">{{cat.name}}</h3>
<mat-list-item role="listitem"
(click)="selectComponent(item)" *ngFor="let item of cat.components">
{{item.name}} - {{item.description}}
</mat-list-item>
</mat-list>
`, isInline: true, styles: [":host{min-width:300px;display:block}mat-list h3{margin:0;text-decoration:underline}.components mat-list-item{height:auto;cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i3.MatList, selector: "mat-list", exportAs: ["matList"] }, { kind: "component", type: i3.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: AddDialogComponent, decorators: [{
type: Component,
args: [{ selector: 'dc-add-dialog', template: `
<mat-list role="list" class="components" *ngFor="let cat of categories">
<h3 class="mat-h3">{{cat.name}}</h3>
<mat-list-item role="listitem"
(click)="selectComponent(item)" *ngFor="let item of cat.components">
{{item.name}} - {{item.description}}
</mat-list-item>
</mat-list>
`, styles: [":host{min-width:300px;display:block}mat-list h3{margin:0;text-decoration:underline}.components mat-list-item{height:auto;cursor:pointer}\n"] }]
}], ctorParameters: function () { return [{ type: i1.MatDialogRef }]; } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkLWRpYWxvZy5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy90b29scy9zcmMvbGliL2NvbXBvbmVudHMvYWRkLWRpYWxvZy9hZGQtZGlhbG9nLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFVLE1BQU0sZUFBZSxDQUFDO0FBQ2xELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQzs7Ozs7QUE4QnhELE1BQU0sT0FBTyxrQkFBa0I7SUFJVjtJQUZuQixVQUFVLEdBQUcsRUFBRSxDQUFDO0lBRWhCLFlBQW1CLFNBQTJDO1FBQTNDLGNBQVMsR0FBVCxTQUFTLENBQWtDO0lBQUksQ0FBQztJQUVuRSxRQUFRO1FBQ04sSUFBSSxDQUFDLFVBQVUsR0FBRyxFQUFFLENBQUM7SUFDdkIsQ0FBQztJQUVELGVBQWUsQ0FBQyxJQUFJO1FBQ2xCLElBQUksQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxZQUFZLElBQUksSUFBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLElBQUk7WUFDaEUsSUFBSSxFQUFFLEdBQUcsSUFBSSxDQUFDLFdBQVcsSUFBSSxJQUFJLENBQUMsSUFB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