/**
 *
 * @ai-apps/angular v2.147.1-next.0 | table-head-cell.component.js
 *
 * Copyright 2014, 2022 IBM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


import { Component, HostBinding, Input, ViewEncapsulation } from '@angular/core';
import { TableHeadCell } from 'carbon-components-angular';
import { AITableHeaderItem } from '../table-model.class';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "carbon-components-angular";
const _c0 = ["aiTableHeadCell", ""];
function AITableHeadCell_ng_container_0_button_1_span_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 10);
    i0.ɵɵelementStart(1, "span");
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r5 = i0.ɵɵnextContext(3);
    i0.ɵɵproperty("title", ctx_r5.column.data);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", ctx_r5.column.data, " ");
} }
function AITableHeadCell_ng_container_0_button_1_ng_template_3_Template(rf, ctx) { }
const _c1 = function (a0, a1, a2) { return { "table-header-label-start": a0, "table-header-label-center": a1, "table-header-label-end": a2 }; };
const _c2 = function (a0, a1) { return { "bx--table-sort--active": a0, "bx--table-sort--ascending": a1 }; };
const _c3 = function (a0) { return { data: a0 }; };
function AITableHeadCell_ng_container_0_button_1_Template(rf, ctx) { if (rf & 1) {
    const _r8 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 4);
    i0.ɵɵlistener("click", function AITableHeadCell_ng_container_0_button_1_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r8); const ctx_r7 = i0.ɵɵnextContext(2); return ctx_r7.onClick(); });
    i0.ɵɵpipe(1, "async");
    i0.ɵɵtemplate(2, AITableHeadCell_ng_container_0_button_1_span_2_Template, 3, 2, "span", 5);
    i0.ɵɵtemplate(3, AITableHeadCell_ng_container_0_button_1_ng_template_3_Template, 0, 0, "ng-template", 6);
    i0.ɵɵelementStart(4, "span", 7);
    i0.ɵɵnamespaceSVG();
    i0.ɵɵelement(5, "svg", 8);
    i0.ɵɵelement(6, "svg", 9);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction3(8, _c1, ctx_r2.column.alignment === "start", ctx_r2.column.alignment === "center", ctx_r2.column.alignment === "end"))("ngClass", i0.ɵɵpureFunction2(12, _c2, ctx_r2.column.sorted, ctx_r2.column.ascending));
    i0.ɵɵattribute("aria-label", i0.ɵɵpipeBind1(1, 6, ctx_r2.column.sorted && ctx_r2.column.ascending ? ctx_r2.getSortDescendingLabel() : ctx_r2.getSortAscendingLabel()));
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", !ctx_r2.column.template);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", ctx_r2.column.template)("ngTemplateOutletContext", i0.ɵɵpureFunction1(15, _c3, ctx_r2.column.data));
} }
function AITableHeadCell_ng_container_0_span_2_span_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 13);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r9 = i0.ɵɵnextContext(3);
    i0.ɵɵproperty("title", ctx_r9.column.data);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(ctx_r9.column.data);
} }
function AITableHeadCell_ng_container_0_span_2_ng_template_2_Template(rf, ctx) { }
function AITableHeadCell_ng_container_0_span_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 11);
    i0.ɵɵtemplate(1, AITableHeadCell_ng_container_0_span_2_span_1_Template, 2, 2, "span", 12);
    i0.ɵɵtemplate(2, AITableHeadCell_ng_container_0_span_2_ng_template_2_Template, 0, 0, "ng-template", 6);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !ctx_r3.column.template);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", ctx_r3.column.template)("ngTemplateOutletContext", i0.ɵɵpureFunction1(3, _c3, ctx_r3.column.data));
} }
function AITableHeadCell_ng_container_0_button_3_span_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵnamespaceSVG();
    i0.ɵɵnamespaceHTML();
    i0.ɵɵelementStart(0, "span");
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r11 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r11.column.filterCount, " ");
} }
const _c4 = function (a0) { return { active: a0 }; };
function AITableHeadCell_ng_container_0_button_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "button", 14);
    i0.ɵɵpipe(1, "async");
    i0.ɵɵnamespaceSVG();
    i0.ɵɵelement(2, "svg", 15);
    i0.ɵɵtemplate(3, AITableHeadCell_ng_container_0_button_3_span_3_Template, 2, 1, "span", 0);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r4 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(8, _c4, ctx_r4.column.filterCount > 0))("ibmTooltip", ctx_r4.column.filterTemplate)("title", i0.ɵɵpipeBind1(1, 6, ctx_r4.getFilterTitle()))("data", ctx_r4.column.filterData);
    i0.ɵɵattribute("data-floating-menu-container", true);
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngIf", ctx_r4.column.filterCount > 0);
} }
function AITableHeadCell_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, AITableHeadCell_ng_container_0_button_1_Template, 7, 17, "button", 1);
    i0.ɵɵtemplate(2, AITableHeadCell_ng_container_0_span_2_Template, 3, 5, "span", 2);
    i0.ɵɵtemplate(3, AITableHeadCell_ng_container_0_button_3_Template, 4, 10, "button", 3);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.sort.observers.length > 0 && ctx_r0.column.sortable);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.sort.observers.length === 0 || ctx_r0.sort.observers.length > 0 && !ctx_r0.column.sortable);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.column.filterTemplate);
} }
function AITableHeadCell_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "button", 16);
    i0.ɵɵelement(2, "span", 17);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} }
export class AITableHeadCell extends TableHeadCell {
    constructor() {
        super(...arguments);
        this.cssClass = true;
    }
}
AITableHeadCell.ɵfac = function AITableHeadCell_Factory(t) { return ɵAITableHeadCell_BaseFactory(t || AITableHeadCell); };
AITableHeadCell.ɵcmp = i0.ɵɵdefineComponent({ type: AITableHeadCell, selectors: [["", "aiTableHeadCell", ""]], hostVars: 2, hostBindings: function AITableHeadCell_HostBindings(rf, ctx) { if (rf & 2) {
        i0.ɵɵclassProp("iot--table-head-cell", ctx.cssClass);
    } }, inputs: { column: "column" }, features: [i0.ɵɵInheritDefinitionFeature], attrs: _c0, decls: 2, vars: 2, consts: [[4, "ngIf"], ["class", "bx--table-sort table-header-label iot--table-head--table-header", "aria-live", "polite", 3, "ngClass", "click", 4, "ngIf"], ["class", "bx--table-header-label", 4, "ngIf"], ["type", "button", "aria-expanded", "false", "aria-haspopup", "true", "trigger", "click", "placement", "bottom,top", 3, "ngClass", "ibmTooltip", "title", "data", 4, "ngIf"], ["aria-live", "polite", 1, "bx--table-sort", "table-header-label", "iot--table-head--table-header", 3, "ngClass", "click"], ["class", "bx--table-header-label", "tabindex", "-1", 3, "title", 4, "ngIf"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"], [1, "table-head-cell-icons"], ["ibmIcon", "arrow--down", "size", "16", 1, "bx--table-sort__icon"], ["ibmIcon", "arrows--vertical", "size", "16", 1, "bx--table-sort__icon-unsorted"], ["tabindex", "-1", 1, "bx--table-header-label", 3, "title"], [1, "bx--table-header-label"], [3, "title", 4, "ngIf"], [3, "title"], ["type", "button", "aria-expanded", "false", "aria-haspopup", "true", "trigger", "click", "placement", "bottom,top", 3, "ngClass", "ibmTooltip", "title", "data"], ["ibmIcon", "filter", "size", "16", 1, "icon--sm"], [1, "bx--table-sort"], ["tabindex", "-1", 1, "table-head-cell-text"]], template: function AITableHeadCell_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵtemplate(0, AITableHeadCell_ng_container_0_Template, 4, 3, "ng-container", 0);
        i0.ɵɵtemplate(1, AITableHeadCell_ng_container_1_Template, 3, 0, "ng-container", 0);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", !ctx.skeleton);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.skeleton);
    } }, directives: [i1.NgIf, i1.NgClass, i1.NgTemplateOutlet, i2.TooltipDirective], pipes: [i1.AsyncPipe], encapsulation: 2 });
const ɵAITableHeadCell_BaseFactory = /*@__PURE__*/ i0.ɵɵgetInheritedFactory(AITableHeadCell);
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AITableHeadCell, [{
        type: Component,
        args: [{
                // tslint:disable-next-line: component-selector
                selector: '[aiTableHeadCell]',
                template: `
    <ng-container *ngIf="!skeleton">
      <button
        class="bx--table-sort table-header-label iot--table-head--table-header"
        [ngClass]="{
          'table-header-label-start': column.alignment === 'start',
          'table-header-label-center': column.alignment === 'center',
          'table-header-label-end': column.alignment === 'end'
        }"
        *ngIf="this.sort.observers.length > 0 && column.sortable"
        [attr.aria-label]="
          (column.sorted && column.ascending ? getSortDescendingLabel() : getSortAscendingLabel())
            | async
        "
        aria-live="polite"
        [ngClass]="{
          'bx--table-sort--active': column.sorted,
          'bx--table-sort--ascending': column.ascending
        }"
        (click)="onClick()"
      >
        <span
          *ngIf="!column.template"
          class="bx--table-header-label"
          [title]="column.data"
          tabindex="-1"
        >
          <span>
            {{ column.data }}
          </span>
        </span>
        <ng-template
          [ngTemplateOutlet]="column.template"
          [ngTemplateOutletContext]="{ data: column.data }"
        >
        </ng-template>
        <span class="table-head-cell-icons">
          <svg ibmIcon="arrow--down" size="16" class="bx--table-sort__icon"></svg>
          <svg ibmIcon="arrows--vertical" size="16" class="bx--table-sort__icon-unsorted"></svg>
        </span>
      </button>
      <span
        class="bx--table-header-label"
        *ngIf="
          this.sort.observers.length === 0 || (this.sort.observers.length > 0 && !column.sortable)
        "
      >
        <span *ngIf="!column.template" [title]="column.data">{{ column.data }}</span>
        <ng-template
          [ngTemplateOutlet]="column.template"
          [ngTemplateOutletContext]="{ data: column.data }"
        >
        </ng-template>
      </span>
      <button
        [ngClass]="{ active: column.filterCount > 0 }"
        *ngIf="column.filterTemplate"
        type="button"
        aria-expanded="false"
        aria-haspopup="true"
        [ibmTooltip]="column.filterTemplate"
        trigger="click"
        [attr.data-floating-menu-container]="true"
        [title]="getFilterTitle() | async"
        placement="bottom,top"
        [data]="column.filterData"
      >
        <svg ibmIcon="filter" size="16" class="icon--sm"></svg>
        <span *ngIf="column.filterCount > 0">
          {{ column.filterCount }}
        </span>
      </button>
    </ng-container>
    <ng-container *ngIf="skeleton">
      <button class="bx--table-sort">
        <span class="table-head-cell-text" tabindex="-1"></span>
      </button>
    </ng-container>
  `,
                encapsulation: ViewEncapsulation.None,
            }]
    }], null, { cssClass: [{
            type: HostBinding,
            args: ['class.iot--table-head-cell']
        }], column: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 