import { Component } from '@angular/core';
import { PopupSelectComponentClass } from '../select/select.component';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
export class PopupCustomInputComponent extends PopupSelectComponentClass {
    constructor() {
        super(...arguments);
        this.isValid = true;
        this.deal = '';
    }
    addCustom(custom) {
        const item = {
            type: this.type,
            value: custom,
            name: custom,
        };
        const selectedArray = Array.from(this.selectedSet);
        const duplicateOfSelections = selectedArray.find(selection => selection.name === item.name);
        if (custom && !duplicateOfSelections) {
            this.selectedSet.add(item);
        }
        this.isValid = true;
        this.popupSelectOutput.emit(this.selectedSet);
        this.deal = '';
    }
}
PopupCustomInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PopupCustomInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
PopupCustomInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PopupCustomInputComponent, selector: "epom-popup-custom-input", usesInheritance: true, ngImport: i0, template: "<div class=\"select-popup-content\">\n  <div class=\"column column-left\">\n    <div class=\"form-control-wrapper\">\n      <div class=\"input-group-with-button\">\n        <input\n          type=\"text\"\n          class=\"form-control\"\n          placeholder=\"Enter Deal\"\n          (change)=\"deal = $event.target.value\"\n          [value]=\"deal\"\n        />\n        <button class=\"button button-outlined\" (click)=\"addCustom(deal)\">Add</button>\n      </div>\n      <label class=\"control-label\">Deal</label>\n    </div>\n  </div>\n\n  <hr class=\"vertical-line\" />\n\n  <div class=\"column column-right right-column\">\n    <div *ngIf=\"!isDisabled\">\n      <div class=\"headline-4\">\n        Added ({{ selectedSet.size }})\n        <span class=\"pull-right button-link\" (click)=\"clearSelected()\" *ngIf=\"selectedSet.size\"> Clear all </span>\n      </div>\n    </div>\n\n    <div *ngIf=\"!selectedSet.size\" class=\"sub-headline text-center\">No added PMP deals.</div>\n\n    <ul class=\"table-list\">\n      <li *ngFor=\"let item of selectedSet\" class=\"right-column-item\">\n        <div class=\"table-list-item-card table-list-item-allow\">\n          <span class=\"filter-name-span\">{{ item.name ? item.name : item.value }}</span>\n        </div>\n        <span\n          *ngIf=\"!isDisabled\"\n          class=\"material-icons material-icons-outlined button-icon button-icon-middle button-icon-outline\"\n          (click)=\"deleteFromSelected(item)\"\n          >close</span\n        >\n      </li>\n    </ul>\n  </div>\n</div>\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"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PopupCustomInputComponent, decorators: [{
            type: Component,
            args: [{ selector: 'epom-popup-custom-input', template: "<div class=\"select-popup-content\">\n  <div class=\"column column-left\">\n    <div class=\"form-control-wrapper\">\n      <div class=\"input-group-with-button\">\n        <input\n          type=\"text\"\n          class=\"form-control\"\n          placeholder=\"Enter Deal\"\n          (change)=\"deal = $event.target.value\"\n          [value]=\"deal\"\n        />\n        <button class=\"button button-outlined\" (click)=\"addCustom(deal)\">Add</button>\n      </div>\n      <label class=\"control-label\">Deal</label>\n    </div>\n  </div>\n\n  <hr class=\"vertical-line\" />\n\n  <div class=\"column column-right right-column\">\n    <div *ngIf=\"!isDisabled\">\n      <div class=\"headline-4\">\n        Added ({{ selectedSet.size }})\n        <span class=\"pull-right button-link\" (click)=\"clearSelected()\" *ngIf=\"selectedSet.size\"> Clear all </span>\n      </div>\n    </div>\n\n    <div *ngIf=\"!selectedSet.size\" class=\"sub-headline text-center\">No added PMP deals.</div>\n\n    <ul class=\"table-list\">\n      <li *ngFor=\"let item of selectedSet\" class=\"right-column-item\">\n        <div class=\"table-list-item-card table-list-item-allow\">\n          <span class=\"filter-name-span\">{{ item.name ? item.name : item.value }}</span>\n        </div>\n        <span\n          *ngIf=\"!isDisabled\"\n          class=\"material-icons material-icons-outlined button-icon button-icon-middle button-icon-outline\"\n          (click)=\"deleteFromSelected(item)\"\n          >close</span\n        >\n      </li>\n    </ul>\n  </div>\n</div>\n" }]
        }] });
//# sourceMappingURL=data:application/json;base64, 