import { Component, Input } from '@angular/core';
import { defaultInfoResolverConfig } from '../config';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@ionic/angular";
import * as i3 from "../tap-config-item/tap-config-item.component";
import * as i4 from "./tap-config-item-displayed.pipe";
export class TapConfigListComponent {
    constructor() {
        this.itemRefresh = false;
        this.editMode = false;
        this.globalSubmit = false;
        this.lines = 'full';
        this._items = [];
    }
    set items(items) {
        if (!items) {
            items = [];
        }
        this._items = items.reduce((prev, item) => {
            if (typeof item === 'string') {
                const existingItem = defaultInfoResolverConfig.find((d) => item === d.key);
                if (!existingItem) {
                    console.warn('invalid item key', item);
                }
                else {
                    prev.push(existingItem);
                }
                return prev;
            }
            const defaultOption = defaultInfoResolverConfig.find((d) => item.key === d.key);
            if (defaultOption) {
                item = { ...defaultOption, ...item };
            }
            prev.push(item);
            return prev;
        }, []);
    }
}
/** @nocollapse */ TapConfigListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TapConfigListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ TapConfigListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: TapConfigListComponent, selector: "tap-config-list", inputs: { itemRefresh: "itemRefresh", editMode: "editMode", globalSubmit: "globalSubmit", lines: "lines", items: "items" }, ngImport: i0, template: "<ion-grid *ngIf=\"_items && _items.length > 0\">\n  <ion-row *ngFor=\"let item of _items\" class=\"tap-config-row-{{ item.key }}\">\n    <ng-container *ngIf=\"item | tapConfigItemDisplayed | async\">\n      <ion-col size-xs=\"12\" size-sm=\"6\">\n        <ion-label>\n          <span class=\"item-title\"\n            ><ion-icon\n              slot=\"start\"\n              *ngIf=\"item.icon\"\n              [name]=\"item.icon\"\n            ></ion-icon>\n            {{ item.title }}</span\n          >\n          <br *ngIf=\"item.description\" />\n          <span class=\"item-description\">{{ item.description }}</span>\n        </ion-label>\n      </ion-col>\n      <ion-col size-xs=\"12\" size-sm=\"6\">\n        <tap-config-item\n          [info]=\"item\"\n          [refresh]=\"itemRefresh\"\n          [editable]=\"editMode\"\n          [editMode]=\"editMode\"\n          [globalSubmit]=\"globalSubmit\"\n        ></tap-config-item>\n      </ion-col>\n    </ng-container>\n  </ion-row>\n</ion-grid>\n", styles: [".item-title{display:inline-block;vertical-align:middle}.item-description{font-size:.8em;color:#777}@media (prefers-color-scheme: dark){:root .item-title{color:#eee}}@media (max-width: 575px){ion-row{border-bottom:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, .13))))}ion-grid{padding:0}}ion-col{padding-top:0;padding-bottom:0}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: i2.IonGrid, selector: "ion-grid", inputs: ["fixed"] }, { kind: "component", type: i2.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2.IonRow, selector: "ion-row" }, { kind: "component", type: i3.TapConfigItemComponent, selector: "tap-config-item", inputs: ["editable", "info", "refresh", "editMode", "globalSubmit"], outputs: ["focusOut", "onSubmit"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TapConfigItemDisplayedPipe, name: "tapConfigItemDisplayed" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TapConfigListComponent, decorators: [{
            type: Component,
            args: [{ selector: 'tap-config-list', template: "<ion-grid *ngIf=\"_items && _items.length > 0\">\n  <ion-row *ngFor=\"let item of _items\" class=\"tap-config-row-{{ item.key }}\">\n    <ng-container *ngIf=\"item | tapConfigItemDisplayed | async\">\n      <ion-col size-xs=\"12\" size-sm=\"6\">\n        <ion-label>\n          <span class=\"item-title\"\n            ><ion-icon\n              slot=\"start\"\n              *ngIf=\"item.icon\"\n              [name]=\"item.icon\"\n            ></ion-icon>\n            {{ item.title }}</span\n          >\n          <br *ngIf=\"item.description\" />\n          <span class=\"item-description\">{{ item.description }}</span>\n        </ion-label>\n      </ion-col>\n      <ion-col size-xs=\"12\" size-sm=\"6\">\n        <tap-config-item\n          [info]=\"item\"\n          [refresh]=\"itemRefresh\"\n          [editable]=\"editMode\"\n          [editMode]=\"editMode\"\n          [globalSubmit]=\"globalSubmit\"\n        ></tap-config-item>\n      </ion-col>\n    </ng-container>\n  </ion-row>\n</ion-grid>\n", styles: [".item-title{display:inline-block;vertical-align:middle}.item-description{font-size:.8em;color:#777}@media (prefers-color-scheme: dark){:root .item-title{color:#eee}}@media (max-width: 575px){ion-row{border-bottom:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, .13))))}ion-grid{padding:0}}ion-col{padding-top:0;padding-bottom:0}\n"] }]
        }], propDecorators: { itemRefresh: [{
                type: Input
            }], editMode: [{
                type: Input
            }], globalSubmit: [{
                type: Input
            }], lines: [{
                type: Input
            }], items: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 