/**
 *
 * @ai-apps/angular v2.147.1-next.0 | table-body.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, Input } from '@angular/core';
import { TableBody } from 'carbon-components-angular';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "./table-row.component";
import * as i3 from "carbon-components-angular";
const _c0 = ["aiTableBody", ""];
const _c1 = function (a0, a1, a2, a3) { return { "tbody_row--success": a0, "tbody_row--warning": a1, "tbody_row--info": a2, "tbody_row--error": a3 }; };
function AITableBody_ng_container_0_ng_container_1_tr_1_Template(rf, ctx) { if (rf & 1) {
    const _r9 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "tr", 4);
    i0.ɵɵlistener("selectRow", function AITableBody_ng_container_0_ng_container_1_tr_1_Template_tr_selectRow_0_listener() { i0.ɵɵrestoreView(_r9); const i_r3 = i0.ɵɵnextContext().index; const ctx_r7 = i0.ɵɵnextContext(2); return ctx_r7.onRowCheckboxChange(i_r3); })("deselectRow", function AITableBody_ng_container_0_ng_container_1_tr_1_Template_tr_deselectRow_0_listener() { i0.ɵɵrestoreView(_r9); const i_r3 = i0.ɵɵnextContext().index; const ctx_r10 = i0.ɵɵnextContext(2); return ctx_r10.onRowCheckboxChange(i_r3); })("expandRow", function AITableBody_ng_container_0_ng_container_1_tr_1_Template_tr_expandRow_0_listener() { i0.ɵɵrestoreView(_r9); const i_r3 = i0.ɵɵnextContext().index; const ctx_r12 = i0.ɵɵnextContext(2); return ctx_r12.model.expandRow(i_r3, !ctx_r12.model.isRowExpanded(i_r3)); })("rowClick", function AITableBody_ng_container_0_ng_container_1_tr_1_Template_tr_rowClick_0_listener() { i0.ɵɵrestoreView(_r9); const i_r3 = i0.ɵɵnextContext().index; const ctx_r14 = i0.ɵɵnextContext(2); return ctx_r14.onRowClick(i_r3); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r16 = i0.ɵɵnextContext();
    const i_r3 = ctx_r16.index;
    const row_r2 = ctx_r16.$implicit;
    const ctx_r4 = i0.ɵɵnextContext(2);
    i0.ɵɵclassMap(ctx_r4.model.rowsClass[i_r3] ? ctx_r4.model.rowsClass[i_r3] : null);
    i0.ɵɵproperty("model", ctx_r4.model)("row", row_r2)("size", ctx_r4.size)("selected", ctx_r4.model.isRowSelected(i_r3))("expandable", ctx_r4.model.isRowExpandable(i_r3))("expanded", ctx_r4.model.isRowExpanded(i_r3))("checkboxLabel", ctx_r4.getCheckboxRowLabel())("expandButtonAriaLabel", ctx_r4.getExpandButtonAriaLabel())("showSelectionColumn", ctx_r4.showSelectionColumn)("enableSingleSelect", ctx_r4.enableSingleSelect)("skeleton", ctx_r4.skeleton)("ngClass", i0.ɵɵpureFunction4(14, _c1, !ctx_r4.model.isRowSelected(i_r3) && ctx_r4.model.getRowContext(i_r3) === "success", !ctx_r4.model.isRowSelected(i_r3) && ctx_r4.model.getRowContext(i_r3) === "warning", !ctx_r4.model.isRowSelected(i_r3) && ctx_r4.model.getRowContext(i_r3) === "info", !ctx_r4.model.isRowSelected(i_r3) && ctx_r4.model.getRowContext(i_r3) === "error"));
} }
function AITableBody_ng_container_0_ng_container_1_tr_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "tr", 5);
} if (rf & 2) {
    const ctx_r17 = i0.ɵɵnextContext();
    const row_r2 = ctx_r17.$implicit;
    const i_r3 = ctx_r17.index;
    const ctx_r5 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("row", row_r2)("expanded", ctx_r5.model.isRowExpanded(i_r3))("skeleton", ctx_r5.skeleton);
} }
function AITableBody_ng_container_0_ng_container_1_ng_container_3_tr_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "tr", 7);
} if (rf & 2) {
    const expandedDataRow_r19 = ctx.$implicit;
    const ctx_r18 = i0.ɵɵnextContext(4);
    i0.ɵɵproperty("model", ctx_r18.model)("showSelectionColumnCheckbox", false)("showSelectionColumn", ctx_r18.showSelectionColumn)("row", expandedDataRow_r19)("size", ctx_r18.size)("skeleton", ctx_r18.skeleton);
} }
function AITableBody_ng_container_0_ng_container_1_ng_container_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, AITableBody_ng_container_0_ng_container_1_ng_container_3_tr_1_Template, 1, 6, "tr", 6);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const row_r2 = i0.ɵɵnextContext().$implicit;
    const ctx_r6 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", ctx_r6.firstExpandedDataInRow(row_r2));
} }
function AITableBody_ng_container_0_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, AITableBody_ng_container_0_ng_container_1_tr_1_Template, 1, 19, "tr", 2);
    i0.ɵɵtemplate(2, AITableBody_ng_container_0_ng_container_1_tr_2_Template, 1, 3, "tr", 3);
    i0.ɵɵtemplate(3, AITableBody_ng_container_0_ng_container_1_ng_container_3_Template, 2, 1, "ng-container", 0);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const row_r2 = ctx.$implicit;
    const i_r3 = ctx.index;
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !ctx_r1.model.isRowFiltered(i_r3));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r1.model.isRowExpandable(i_r3) && !ctx_r1.shouldExpandAsTable(row_r2) && !ctx_r1.model.isRowFiltered(i_r3));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r1.model.isRowExpandable(i_r3) && ctx_r1.shouldExpandAsTable(row_r2) && ctx_r1.model.isRowExpanded(i_r3) && !ctx_r1.model.isRowFiltered(i_r3));
} }
function AITableBody_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, AITableBody_ng_container_0_ng_container_1_Template, 4, 3, "ng-container", 1);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", ctx_r0.model.rows());
} }
const _c2 = ["*"];
export class AITableBody extends TableBody {
}
AITableBody.ɵfac = function AITableBody_Factory(t) { return ɵAITableBody_BaseFactory(t || AITableBody); };
AITableBody.ɵcmp = i0.ɵɵdefineComponent({ type: AITableBody, selectors: [["", "aiTableBody", ""]], inputs: { model: "model" }, features: [i0.ɵɵInheritDefinitionFeature], attrs: _c0, ngContentSelectors: _c2, decls: 2, vars: 1, consts: [[4, "ngIf"], [4, "ngFor", "ngForOf"], ["aiTableRow", "", 3, "model", "row", "size", "selected", "expandable", "expanded", "checkboxLabel", "expandButtonAriaLabel", "showSelectionColumn", "enableSingleSelect", "skeleton", "class", "ngClass", "selectRow", "deselectRow", "expandRow", "rowClick", 4, "ngIf"], ["ibmTableExpandedRow", "", "ibmExpandedRowHover", "", 3, "row", "expanded", "skeleton", 4, "ngIf"], ["aiTableRow", "", 3, "model", "row", "size", "selected", "expandable", "expanded", "checkboxLabel", "expandButtonAriaLabel", "showSelectionColumn", "enableSingleSelect", "skeleton", "ngClass", "selectRow", "deselectRow", "expandRow", "rowClick"], ["ibmTableExpandedRow", "", "ibmExpandedRowHover", "", 3, "row", "expanded", "skeleton"], ["aiTableRow", "", 3, "model", "showSelectionColumnCheckbox", "showSelectionColumn", "row", "size", "skeleton", 4, "ngFor", "ngForOf"], ["aiTableRow", "", 3, "model", "showSelectionColumnCheckbox", "showSelectionColumn", "row", "size", "skeleton"]], template: function AITableBody_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵprojectionDef();
        i0.ɵɵtemplate(0, AITableBody_ng_container_0_Template, 2, 1, "ng-container", 0);
        i0.ɵɵprojection(1);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.model);
    } }, directives: [i1.NgIf, i1.NgForOf, i2.AITableRowComponent, i1.NgClass, i3.TableExpandedRow, i3.ExpandedRowHover], encapsulation: 2 });
const ɵAITableBody_BaseFactory = /*@__PURE__*/ i0.ɵɵgetInheritedFactory(AITableBody);
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AITableBody, [{
        type: Component,
        args: [{
                // tslint:disable-next-line: component-selector
                selector: '[aiTableBody]',
                template: `
    <ng-container *ngIf="model">
      <ng-container *ngFor="let row of model.rows(); let i = index">
        <tr
          aiTableRow
          [model]="model"
          [row]="row"
          [size]="size"
          [selected]="model.isRowSelected(i)"
          [expandable]="model.isRowExpandable(i)"
          [expanded]="model.isRowExpanded(i)"
          [checkboxLabel]="getCheckboxRowLabel()"
          [expandButtonAriaLabel]="getExpandButtonAriaLabel()"
          [showSelectionColumn]="showSelectionColumn"
          [enableSingleSelect]="enableSingleSelect"
          [skeleton]="skeleton"
          (selectRow)="onRowCheckboxChange(i)"
          (deselectRow)="onRowCheckboxChange(i)"
          (expandRow)="model.expandRow(i, !model.isRowExpanded(i))"
          (rowClick)="onRowClick(i)"
          *ngIf="!model.isRowFiltered(i)"
          [class]="model.rowsClass[i] ? model.rowsClass[i] : null"
          [ngClass]="{
            'tbody_row--success': !model.isRowSelected(i) && model.getRowContext(i) === 'success',
            'tbody_row--warning': !model.isRowSelected(i) && model.getRowContext(i) === 'warning',
            'tbody_row--info': !model.isRowSelected(i) && model.getRowContext(i) === 'info',
            'tbody_row--error': !model.isRowSelected(i) && model.getRowContext(i) === 'error'
          }"
        ></tr>
        <tr
          *ngIf="model.isRowExpandable(i) && !shouldExpandAsTable(row) && !model.isRowFiltered(i)"
          ibmTableExpandedRow
          ibmExpandedRowHover
          [row]="row"
          [expanded]="model.isRowExpanded(i)"
          [skeleton]="skeleton"
        ></tr>
        <ng-container
          *ngIf="
            model.isRowExpandable(i) &&
            shouldExpandAsTable(row) &&
            model.isRowExpanded(i) &&
            !model.isRowFiltered(i)
          "
        >
          <tr
            *ngFor="let expandedDataRow of firstExpandedDataInRow(row)"
            aiTableRow
            [model]="model"
            [showSelectionColumnCheckbox]="false"
            [showSelectionColumn]="showSelectionColumn"
            [row]="expandedDataRow"
            [size]="size"
            [skeleton]="skeleton"
          ></tr>
        </ng-container>
      </ng-container>
    </ng-container>
    <ng-content></ng-content>
  `,
            }]
    }], null, { model: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 