import { Component, Inject, Input, TemplateRef } from '@angular/core';
import { DATA_TABLE } from './data-table.token';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/cdk/scrolling";
import * as i3 from "ng-devui/dragdrop";
import * as i4 from "./data-table-row.component";
export class DataTableBodyComponent {
    constructor(dt) {
        this.dt = dt;
        this.dataSource = [];
        this.nestedIndex = '-1';
    }
    ngOnChanges(changes) {
        if (changes['columns'] && this.columns) {
            let columnSpan = this.columns.length;
            if (this.showExpandToggle) {
                columnSpan += 1;
            }
            if (this.checkable) {
                columnSpan += 1;
            }
            this.childTdColspan = columnSpan;
        }
    }
    trackByFn(index, item) {
        return index;
    }
}
DataTableBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DataTableBodyComponent, deps: [{ token: DATA_TABLE }], target: i0.ɵɵFactoryTarget.Component });
DataTableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: DataTableBodyComponent, selector: "d-data-table-body, [dDataTableBody]", inputs: { checkable: "checkable", showExpandToggle: "showExpandToggle", allChecked: "allChecked", selectable: "selectable", editModel: "editModel", editRowItem: "editRowItem", dataSource: "dataSource", resizeable: "resizeable", columns: "columns", detailTemplateRef: "detailTemplateRef", timeout: "timeout", type: "type", rowHoveredHighlight: "rowHoveredHighlight", tableLevel: "tableLevel", nestedIndex: "nestedIndex", virtualScroll: "virtualScroll", tableWidthConfig: "tableWidthConfig", headerExpandConfig: "headerExpandConfig", generalRowHoveredData: "generalRowHoveredData" }, usesOnChanges: true, ngImport: i0, template: "<tr *ngIf=\"headerExpandConfig?.expand\">\n  <td [attr.colspan]=\"tableWidthConfig.length\">\n    <ng-template\n      [ngTemplateOutlet]=\"headerExpandConfig?.expandTemplateRef || default\"\n      [ngTemplateOutletContext]=\"{ $implicit: this, columns: columns }\"\n    >\n    </ng-template>\n    <ng-template #default>\n      <div>{{ headerExpandConfig?.description }}</div>\n    </ng-template>\n  </td>\n</tr>\n<ng-container *ngIf=\"!virtualScroll; else scrollViewTpl\">\n  <ng-container *ngFor=\"let rowItem of dataSource; trackBy: trackByFn; let rowIndex = index\">\n    <ng-template [ngTemplateOutlet]=\"trTable\" [ngTemplateOutletContext]=\"{ rowItem: rowItem, rowIndex: rowIndex }\"> </ng-template>\n  </ng-container>\n</ng-container>\n\n<ng-template #scrollViewTpl>\n  <ng-container *cdkVirtualFor=\"let rowItem of dataSource; trackBy: trackByFn; let rowIndex = index\">\n    <ng-template [ngTemplateOutlet]=\"trTable\" [ngTemplateOutletContext]=\"{ rowItem: rowItem || {}, rowIndex: rowIndex }\"> </ng-template>\n  </ng-container>\n</ng-template>\n\n<ng-template #trTable let-rowIndex=\"rowIndex\" let-rowItem=\"rowItem\">\n  <tr\n    *ngIf=\"!rowItem?.$draggable\"\n    dDataTableRow\n    [generalRowHoveredData]=\"generalRowHoveredData\"\n    [resizeable]=\"resizeable\"\n    [checkable]=\"checkable\"\n    [rowIndex]=\"rowIndex\"\n    [rowItem]=\"rowItem\"\n    [columns]=\"columns\"\n    [editRowItem]=\"editRowItem\"\n    [editModel]=\"editModel\"\n    [allChecked]=\"allChecked\"\n    [showExpandToggle]=\"showExpandToggle\"\n    [timeout]=\"timeout\"\n    [tableLevel]=\"tableLevel\"\n    [nestedIndex]=\"nestedIndex\"\n    class=\"{{ rowItem.$rowClass ? rowItem.$rowClass : '' }}\"\n    [ngClass]=\"{ 'table-row-selected': rowItem.$checked }\"\n  ></tr>\n  <tr\n    *ngIf=\"rowItem?.$draggable\"\n    dDataTableRow\n    dDraggable\n    [generalRowHoveredData]=\"generalRowHoveredData\"\n    [resizeable]=\"resizeable\"\n    [checkable]=\"checkable\"\n    [rowIndex]=\"rowIndex\"\n    [rowItem]=\"rowItem\"\n    [columns]=\"columns\"\n    [editRowItem]=\"editRowItem\"\n    [editModel]=\"editModel\"\n    [allChecked]=\"allChecked\"\n    [showExpandToggle]=\"showExpandToggle\"\n    [timeout]=\"timeout\"\n    [tableLevel]=\"tableLevel\"\n    [nestedIndex]=\"nestedIndex\"\n    class=\"{{ rowItem.$rowClass ? rowItem.$rowClass : '' }}\"\n    [ngClass]=\"{ 'table-row-selected': rowItem.$checked }\"\n    [dragData]=\"{ data: rowItem }\"\n    [dragScope]=\"rowItem?.$draggable['scope']\"\n    [dragOverClass]=\"rowItem?.$draggable['class']\"\n    [dragHandle]=\"rowItem?.$draggable['handler']\"\n  ></tr>\n  <tr *ngIf=\"rowItem && rowItem['$isDetailOpen'] && rowItem.detail\">\n    <td [attr.colspan]=\"checkable ? 2 : 1\"></td>\n    <td [attr.colspan]=\"columns.length\" class=\"detail-content\" [style.padding]=\"'13px'\">\n      <ng-template\n        [ngTemplateOutlet]=\"detailTemplateRef || default\"\n        [ngTemplateOutletContext]=\"{ $implicit: this, detail: rowItem.detail, rowIndex: rowIndex, rowItem: rowItem }\"\n      >\n      </ng-template>\n      <ng-template #default let-detail=\"detail\" let-rowIndex=\"rowIndex\" let-rowItem=\"rowItem\">\n        <div>{{ detail }}</div>\n      </ng-template>\n    </td>\n  </tr>\n  <tr class=\"expand-row\" *ngIf=\"rowItem?.$expandConfig?.expand\">\n    <td *ngIf=\"checkable\"></td>\n    <td *ngIf=\"showExpandToggle\"></td>\n    <td [attr.colspan]=\"columns.length\">\n      <ng-template\n        [ngTemplateOutlet]=\"rowItem.$expandConfig?.expandTemplateRef || default\"\n        [ngTemplateOutletContext]=\"{ $implicit: this, columns: columns, rowIndex: rowIndex, rowItem: rowItem }\"\n      >\n      </ng-template>\n      <ng-template #default>\n        <div>{{ rowItem.$expandConfig?.description }}</div>\n      </ng-template>\n    </td>\n  </tr>\n  <tr class=\"child-table\" *ngIf=\"rowItem['$isChildTableOpen'] && rowItem['children']\">\n    <td [attr.colspan]=\"childTdColspan\">\n      <table\n        class=\"devui-table {{ type ? 'table-' + type : '' }} {{ rowHoveredHighlight ? 'table-hover' : '' }}\"\n        [style.table-layout]=\"'fixed'\"\n      >\n        <colgroup>\n          <col [style.width]=\"config.width\" *ngFor=\"let config of tableWidthConfig\" />\n        </colgroup>\n        <tbody\n          dDataTableBody\n          [dataSource]=\"rowItem['children']\"\n          [resizeable]=\"resizeable\"\n          [columns]=\"columns\"\n          [checkable]=\"checkable\"\n          [allChecked]=\"allChecked\"\n          [selectable]=\"selectable\"\n          [editModel]=\"editModel\"\n          [editRowItem]=\"editRowItem\"\n          [showExpandToggle]=\"showExpandToggle\"\n          [detailTemplateRef]=\"detailTemplateRef\"\n          [timeout]=\"timeout\"\n          [type]=\"type\"\n          [rowHoveredHighlight]=\"rowHoveredHighlight\"\n          [tableLevel]=\"tableLevel + 1\"\n          [nestedIndex]=\"nestedIndex + ',' + rowIndex\"\n          [tableWidthConfig]=\"tableWidthConfig\"\n          [generalRowHoveredData]=\"generalRowHoveredData\"\n        ></tbody>\n      </table>\n    </td>\n  </tr>\n</ng-template>\n", styles: [".devui-font-size-base{font-size:12px;font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;line-height:1.5}.devui-font-size-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;line-height:1.5}.devui-font-size-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px);font-weight:700;line-height:1.5}.devui-font-size-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;line-height:1.5}.detail-content{color:#252b3a;color:var(--devui-text, #252b3a);font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;background-color:#f5f5f5;background-color:var(--devui-area, #f5f5f5)}.child-table:hover{background:transparent!important}.child-table .devui-table{background:transparent;margin-bottom:0}.child-table>td{padding:0;border:0}::ng-deep .devui-table tbody>tr.expand-row{background:#f7f8fa;background:var(--devui-table-expand-area-bg, #f7f8fa)}\n"], dependencies: [{ 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: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "directive", type: i3.DraggableDirective, selector: "[dDraggable]", inputs: ["dragData", "dragHandle", "dragEffect", "dragScope", "dragHandleClass", "dragOverClass", "disabled", "enableDragFollow", "dragFollowOptions", "originPlaceholder", "dragIdentity", "dragItemParentName", "dragItemChildrenName"], outputs: ["dragStartEvent", "dragEvent", "dragEndEvent", "dropEndEvent"] }, { kind: "component", type: DataTableBodyComponent, selector: "d-data-table-body, [dDataTableBody]", inputs: ["checkable", "showExpandToggle", "allChecked", "selectable", "editModel", "editRowItem", "dataSource", "resizeable", "columns", "detailTemplateRef", "timeout", "type", "rowHoveredHighlight", "tableLevel", "nestedIndex", "virtualScroll", "tableWidthConfig", "headerExpandConfig", "generalRowHoveredData"] }, { kind: "component", type: i4.DataTableRowComponent, selector: "d-data-table-row, [dDataTableRow]", inputs: ["rowItem", "selectable", "checkable", "showExpandToggle", "rowIndex", "allChecked", "columns", "editModel", "editRowItem", "resizeable", "timeout", "tableLevel", "nestedIndex", "generalRowHoveredData"], outputs: ["detailChange"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DataTableBodyComponent, decorators: [{
            type: Component,
            args: [{ selector: 'd-data-table-body, [dDataTableBody]', preserveWhitespaces: false, template: "<tr *ngIf=\"headerExpandConfig?.expand\">\n  <td [attr.colspan]=\"tableWidthConfig.length\">\n    <ng-template\n      [ngTemplateOutlet]=\"headerExpandConfig?.expandTemplateRef || default\"\n      [ngTemplateOutletContext]=\"{ $implicit: this, columns: columns }\"\n    >\n    </ng-template>\n    <ng-template #default>\n      <div>{{ headerExpandConfig?.description }}</div>\n    </ng-template>\n  </td>\n</tr>\n<ng-container *ngIf=\"!virtualScroll; else scrollViewTpl\">\n  <ng-container *ngFor=\"let rowItem of dataSource; trackBy: trackByFn; let rowIndex = index\">\n    <ng-template [ngTemplateOutlet]=\"trTable\" [ngTemplateOutletContext]=\"{ rowItem: rowItem, rowIndex: rowIndex }\"> </ng-template>\n  </ng-container>\n</ng-container>\n\n<ng-template #scrollViewTpl>\n  <ng-container *cdkVirtualFor=\"let rowItem of dataSource; trackBy: trackByFn; let rowIndex = index\">\n    <ng-template [ngTemplateOutlet]=\"trTable\" [ngTemplateOutletContext]=\"{ rowItem: rowItem || {}, rowIndex: rowIndex }\"> </ng-template>\n  </ng-container>\n</ng-template>\n\n<ng-template #trTable let-rowIndex=\"rowIndex\" let-rowItem=\"rowItem\">\n  <tr\n    *ngIf=\"!rowItem?.$draggable\"\n    dDataTableRow\n    [generalRowHoveredData]=\"generalRowHoveredData\"\n    [resizeable]=\"resizeable\"\n    [checkable]=\"checkable\"\n    [rowIndex]=\"rowIndex\"\n    [rowItem]=\"rowItem\"\n    [columns]=\"columns\"\n    [editRowItem]=\"editRowItem\"\n    [editModel]=\"editModel\"\n    [allChecked]=\"allChecked\"\n    [showExpandToggle]=\"showExpandToggle\"\n    [timeout]=\"timeout\"\n    [tableLevel]=\"tableLevel\"\n    [nestedIndex]=\"nestedIndex\"\n    class=\"{{ rowItem.$rowClass ? rowItem.$rowClass : '' }}\"\n    [ngClass]=\"{ 'table-row-selected': rowItem.$checked }\"\n  ></tr>\n  <tr\n    *ngIf=\"rowItem?.$draggable\"\n    dDataTableRow\n    dDraggable\n    [generalRowHoveredData]=\"generalRowHoveredData\"\n    [resizeable]=\"resizeable\"\n    [checkable]=\"checkable\"\n    [rowIndex]=\"rowIndex\"\n    [rowItem]=\"rowItem\"\n    [columns]=\"columns\"\n    [editRowItem]=\"editRowItem\"\n    [editModel]=\"editModel\"\n    [allChecked]=\"allChecked\"\n    [showExpandToggle]=\"showExpandToggle\"\n    [timeout]=\"timeout\"\n    [tableLevel]=\"tableLevel\"\n    [nestedIndex]=\"nestedIndex\"\n    class=\"{{ rowItem.$rowClass ? rowItem.$rowClass : '' }}\"\n    [ngClass]=\"{ 'table-row-selected': rowItem.$checked }\"\n    [dragData]=\"{ data: rowItem }\"\n    [dragScope]=\"rowItem?.$draggable['scope']\"\n    [dragOverClass]=\"rowItem?.$draggable['class']\"\n    [dragHandle]=\"rowItem?.$draggable['handler']\"\n  ></tr>\n  <tr *ngIf=\"rowItem && rowItem['$isDetailOpen'] && rowItem.detail\">\n    <td [attr.colspan]=\"checkable ? 2 : 1\"></td>\n    <td [attr.colspan]=\"columns.length\" class=\"detail-content\" [style.padding]=\"'13px'\">\n      <ng-template\n        [ngTemplateOutlet]=\"detailTemplateRef || default\"\n        [ngTemplateOutletContext]=\"{ $implicit: this, detail: rowItem.detail, rowIndex: rowIndex, rowItem: rowItem }\"\n      >\n      </ng-template>\n      <ng-template #default let-detail=\"detail\" let-rowIndex=\"rowIndex\" let-rowItem=\"rowItem\">\n        <div>{{ detail }}</div>\n      </ng-template>\n    </td>\n  </tr>\n  <tr class=\"expand-row\" *ngIf=\"rowItem?.$expandConfig?.expand\">\n    <td *ngIf=\"checkable\"></td>\n    <td *ngIf=\"showExpandToggle\"></td>\n    <td [attr.colspan]=\"columns.length\">\n      <ng-template\n        [ngTemplateOutlet]=\"rowItem.$expandConfig?.expandTemplateRef || default\"\n        [ngTemplateOutletContext]=\"{ $implicit: this, columns: columns, rowIndex: rowIndex, rowItem: rowItem }\"\n      >\n      </ng-template>\n      <ng-template #default>\n        <div>{{ rowItem.$expandConfig?.description }}</div>\n      </ng-template>\n    </td>\n  </tr>\n  <tr class=\"child-table\" *ngIf=\"rowItem['$isChildTableOpen'] && rowItem['children']\">\n    <td [attr.colspan]=\"childTdColspan\">\n      <table\n        class=\"devui-table {{ type ? 'table-' + type : '' }} {{ rowHoveredHighlight ? 'table-hover' : '' }}\"\n        [style.table-layout]=\"'fixed'\"\n      >\n        <colgroup>\n          <col [style.width]=\"config.width\" *ngFor=\"let config of tableWidthConfig\" />\n        </colgroup>\n        <tbody\n          dDataTableBody\n          [dataSource]=\"rowItem['children']\"\n          [resizeable]=\"resizeable\"\n          [columns]=\"columns\"\n          [checkable]=\"checkable\"\n          [allChecked]=\"allChecked\"\n          [selectable]=\"selectable\"\n          [editModel]=\"editModel\"\n          [editRowItem]=\"editRowItem\"\n          [showExpandToggle]=\"showExpandToggle\"\n          [detailTemplateRef]=\"detailTemplateRef\"\n          [timeout]=\"timeout\"\n          [type]=\"type\"\n          [rowHoveredHighlight]=\"rowHoveredHighlight\"\n          [tableLevel]=\"tableLevel + 1\"\n          [nestedIndex]=\"nestedIndex + ',' + rowIndex\"\n          [tableWidthConfig]=\"tableWidthConfig\"\n          [generalRowHoveredData]=\"generalRowHoveredData\"\n        ></tbody>\n      </table>\n    </td>\n  </tr>\n</ng-template>\n", styles: [".devui-font-size-base{font-size:12px;font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;line-height:1.5}.devui-font-size-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;line-height:1.5}.devui-font-size-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px);font-weight:700;line-height:1.5}.devui-font-size-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;line-height:1.5}.detail-content{color:#252b3a;color:var(--devui-text, #252b3a);font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;background-color:#f5f5f5;background-color:var(--devui-area, #f5f5f5)}.child-table:hover{background:transparent!important}.child-table .devui-table{background:transparent;margin-bottom:0}.child-table>td{padding:0;border:0}::ng-deep .devui-table tbody>tr.expand-row{background:#f7f8fa;background:var(--devui-table-expand-area-bg, #f7f8fa)}\n"] }]
        }], ctorParameters: function () { return [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [DATA_TABLE]
                }] }]; }, propDecorators: { checkable: [{
                type: Input
            }], showExpandToggle: [{
                type: Input
            }], allChecked: [{
                type: Input
            }], selectable: [{
                type: Input
            }], editModel: [{
                type: Input
            }], editRowItem: [{
                type: Input
            }], dataSource: [{
                type: Input
            }], resizeable: [{
                type: Input
            }], columns: [{
                type: Input
            }], detailTemplateRef: [{
                type: Input
            }], timeout: [{
                type: Input
            }], type: [{
                type: Input
            }], rowHoveredHighlight: [{
                type: Input
            }], tableLevel: [{
                type: Input
            }], nestedIndex: [{
                type: Input
            }], virtualScroll: [{
                type: Input
            }], tableWidthConfig: [{
                type: Input
            }], headerExpandConfig: [{
                type: Input
            }], generalRowHoveredData: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 