import { Component, EventEmitter } from '@angular/core';
import { CommonModule } from '@angular/common';
import { PopoverModule } from '../../../../ui-kit/popover/popover.module';
import { TooltipModule } from '../../../../ui-kit/tooltip/tooltip.module';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "../../../../ui-kit/popover/popover.component";
import * as i3 from "../../../../ui-kit/popover/popover.directive";
import * as i4 from "../../../../ui-kit/tooltip/tooltip.directive";
export class EditModeComponent {
    constructor() {
        this.selectedData = [];
        this.type = '';
        this.nonRemovableIds = [];
        this.isMultiple = false;
        this.countColor = '';
        this.nameDisplayKey = '';
        this.isOnEdit = new EventEmitter();
        this.onRemoveData = new EventEmitter();
    }
    removeItem(index) {
        this.onRemoveData.emit({ index, data: this.selectedData[index] });
    }
    identify(index, item) {
        return item?.item_name ?? item?.name;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditModeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: EditModeComponent, isStandalone: true, selector: "lib-edit-mode", inputs: { selectedData: "selectedData", type: "type", nonRemovableIds: "nonRemovableIds", isMultiple: "isMultiple", countColor: "countColor", nameDisplayKey: "nameDisplayKey" }, outputs: { isOnEdit: "isOnEdit", onRemoveData: "onRemoveData" }, ngImport: i0, template: `
    <div
      *ngIf="selectedData?.length"
      class="selected"
      [class.vx-mb-2]="isMultiple"
    >
      <div class="chipContainer vx-d-flex vx-align-center vx-pl-2 vx-pr-2">
        <i
          *ngIf="
            type !== 'text' &&
            !nonRemovableIds.includes(selectedData[0]?.item_id)
          "
          (click)="removeItem(0)"
          class="icons cross vx-fs-10 vx-paragraph-txt vx-mr-1"
          >&#xe9ae;</i
        >
        <ng-content [select]="'GRC_TYPE'"></ng-content>

        <span
          class="chipName vx-fs-11 vx-label-txt"
          [appTooltip]="
            selectedData[0]?.item_name ??
            selectedData[0]?.name ??
            selectedData[0][nameDisplayKey]
          "
          placement="bottom-left"
          delay="0"
          type="black"
          [tooltipMandatory]="false"
          >{{
            selectedData[0]?.item_name ??
              selectedData[0]?.name ??
              selectedData[0][nameDisplayKey]
          }}</span
        >
        <button
          *ngIf="selectedData.length > 1"
          class="countBtn vx-fs-9 vx-fw-500 vx-txt-white vx-d-flex vx-align-center vx-justify-center vx-lh-4"
          [ngClass]="countColor"
          appPopover
          (click)="selectedList.popover()"
          placement="right"
        >
          +{{ selectedData?.length - 1 }}
        </button>
      </div>
      <button class="edit" type="button" (click)="isOnEdit.emit()">
        <i class="icons">&#xe9ba;</i> Edit
      </button>
    </div>
    <app-popover #selectedList [dontCloseonClick]="true">
      <div class="wf-action-list">
        <ul class="action-item">
          <li
            *ngFor="
              let data of selectedData | slice : 1;
              let i = index;
              trackBy: identify
            "
          >
            <div class="avatar-card">
              <span
                class="value"
                [appTooltip]="
                  data?.item_name ?? data?.name ?? data[nameDisplayKey]
                "
                placement="bottom-left"
                delay="0"
                type="black"
                [tooltipMandatory]="false"
              >
                <i
                  *ngIf="!nonRemovableIds.includes(data?.item_id)"
                  (click)="removeItem(i + 1)"
                  class="icons"
                  >&#xe90d;</i
                >
                {{ data?.item_name ?? data?.name ?? data[nameDisplayKey] }}
              </span>
            </div>
          </li>
        </ul>
      </div>
    </app-popover>
  `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.SlicePipe, name: "slice" }, { kind: "ngmodule", type: PopoverModule }, { kind: "component", type: i2.PopoverComponent, selector: "app-popover", inputs: ["dontCloseonClick"] }, { kind: "directive", type: i3.PopoverDirective, selector: "[appPopover]", inputs: ["refrence", "placement"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i4.ToolTipDirective, selector: "[appTooltip]", inputs: ["appTooltip", "placement", "type", "tooltipMandatory", "showTooltip", "animate"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditModeComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'lib-edit-mode',
                    standalone: true,
                    imports: [CommonModule, PopoverModule, TooltipModule],
                    inputs: [
                        'selectedData',
                        'type',
                        'nonRemovableIds',
                        'isMultiple',
                        'countColor',
                        'nameDisplayKey',
                    ],
                    outputs: ['isOnEdit', 'onRemoveData'],
                    template: `
    <div
      *ngIf="selectedData?.length"
      class="selected"
      [class.vx-mb-2]="isMultiple"
    >
      <div class="chipContainer vx-d-flex vx-align-center vx-pl-2 vx-pr-2">
        <i
          *ngIf="
            type !== 'text' &&
            !nonRemovableIds.includes(selectedData[0]?.item_id)
          "
          (click)="removeItem(0)"
          class="icons cross vx-fs-10 vx-paragraph-txt vx-mr-1"
          >&#xe9ae;</i
        >
        <ng-content [select]="'GRC_TYPE'"></ng-content>

        <span
          class="chipName vx-fs-11 vx-label-txt"
          [appTooltip]="
            selectedData[0]?.item_name ??
            selectedData[0]?.name ??
            selectedData[0][nameDisplayKey]
          "
          placement="bottom-left"
          delay="0"
          type="black"
          [tooltipMandatory]="false"
          >{{
            selectedData[0]?.item_name ??
              selectedData[0]?.name ??
              selectedData[0][nameDisplayKey]
          }}</span
        >
        <button
          *ngIf="selectedData.length > 1"
          class="countBtn vx-fs-9 vx-fw-500 vx-txt-white vx-d-flex vx-align-center vx-justify-center vx-lh-4"
          [ngClass]="countColor"
          appPopover
          (click)="selectedList.popover()"
          placement="right"
        >
          +{{ selectedData?.length - 1 }}
        </button>
      </div>
      <button class="edit" type="button" (click)="isOnEdit.emit()">
        <i class="icons">&#xe9ba;</i> Edit
      </button>
    </div>
    <app-popover #selectedList [dontCloseonClick]="true">
      <div class="wf-action-list">
        <ul class="action-item">
          <li
            *ngFor="
              let data of selectedData | slice : 1;
              let i = index;
              trackBy: identify
            "
          >
            <div class="avatar-card">
              <span
                class="value"
                [appTooltip]="
                  data?.item_name ?? data?.name ?? data[nameDisplayKey]
                "
                placement="bottom-left"
                delay="0"
                type="black"
                [tooltipMandatory]="false"
              >
                <i
                  *ngIf="!nonRemovableIds.includes(data?.item_id)"
                  (click)="removeItem(i + 1)"
                  class="icons"
                  >&#xe90d;</i
                >
                {{ data?.item_name ?? data?.name ?? data[nameDisplayKey] }}
              </span>
            </div>
          </li>
        </ul>
      </div>
    </app-popover>
  `,
                }]
        }], ctorParameters: function () { return []; } });
//# sourceMappingURL=data:application/json;base64, 