/**
 * @license
 * Copyright Alibaba.com All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */
import { ChangeDetectionStrategy, Component, ElementRef, Renderer2, ViewChild, ViewEncapsulation } from '@angular/core';
import { BehaviorSubject, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { NzTableStyleService } from '../table-style.service';
import * as i0 from "@angular/core";
import * as i1 from "../table-style.service";
import * as i2 from "@angular/common";
var _c0 = ["tdElement"];
var _c1 = ["nz-table-fixed-row", ""];
function NzTableFixedRowComponent_div_2_ng_template_2_Template(rf, ctx) { }
function NzTableFixedRowComponent_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 4);
    i0.ɵɵpipe(1, "async");
    i0.ɵɵtemplate(2, NzTableFixedRowComponent_div_2_ng_template_2_Template, 0, 0, "ng-template", 5);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r2993 = i0.ɵɵnextContext();
    var _r2994 = i0.ɵɵreference(5);
    i0.ɵɵstyleProp("width", i0.ɵɵpipeBind1(1, 3, ctx_r2993.hostWidth$), "px");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", _r2994);
} }
function NzTableFixedRowComponent_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0);
} }
var _c2 = ["*"];
var NzTableFixedRowComponent = /** @class */ (function () {
    function NzTableFixedRowComponent(nzTableStyleService, renderer) {
        this.nzTableStyleService = nzTableStyleService;
        this.renderer = renderer;
        this.hostWidth$ = new BehaviorSubject(null);
        this.enableAutoMeasure$ = new BehaviorSubject(false);
        this.destroy$ = new Subject();
    }
    NzTableFixedRowComponent.prototype.ngOnInit = function () {
        if (this.nzTableStyleService) {
            var _a = this.nzTableStyleService, enableAutoMeasure$ = _a.enableAutoMeasure$, hostWidth$ = _a.hostWidth$;
            enableAutoMeasure$.subscribe(this.enableAutoMeasure$);
            hostWidth$.subscribe(this.hostWidth$);
        }
    };
    NzTableFixedRowComponent.prototype.ngAfterViewInit = function () {
        var _this = this;
        this.nzTableStyleService.columnCount$.pipe(takeUntil(this.destroy$)).subscribe(function (count) {
            _this.renderer.setAttribute(_this.tdElement.nativeElement, 'colspan', "" + count);
        });
    };
    NzTableFixedRowComponent.prototype.ngOnDestroy = function () {
        this.destroy$.next();
        this.destroy$.complete();
    };
    /** @nocollapse */ NzTableFixedRowComponent.ɵfac = function NzTableFixedRowComponent_Factory(t) { return new (t || NzTableFixedRowComponent)(i0.ɵɵdirectiveInject(i1.NzTableStyleService), i0.ɵɵdirectiveInject(i0.Renderer2)); };
    /** @nocollapse */ NzTableFixedRowComponent.ɵcmp = i0.ɵɵdefineComponent({ type: NzTableFixedRowComponent, selectors: [["tr", "nz-table-fixed-row", ""], ["tr", "nzExpand", ""]], viewQuery: function NzTableFixedRowComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, true);
        } if (rf & 2) {
            var _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tdElement = _t.first);
        } }, attrs: _c1, ngContentSelectors: _c2, decls: 6, vars: 4, consts: [[1, "nz-disable-td", "ant-table-cell"], ["tdElement", ""], ["class", "ant-table-expanded-row-fixed", "style", "position: sticky; left: 0px; overflow: hidden;", 3, "width", 4, "ngIf", "ngIfElse"], ["contentTemplate", ""], [1, "ant-table-expanded-row-fixed", 2, "position", "sticky", "left", "0px", "overflow", "hidden"], [3, "ngTemplateOutlet"]], template: function NzTableFixedRowComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵprojectionDef();
            i0.ɵɵelementStart(0, "td", 0, 1);
            i0.ɵɵtemplate(2, NzTableFixedRowComponent_div_2_Template, 3, 5, "div", 2);
            i0.ɵɵpipe(3, "async");
            i0.ɵɵelementEnd();
            i0.ɵɵtemplate(4, NzTableFixedRowComponent_ng_template_4_Template, 1, 0, "ng-template", null, 3, i0.ɵɵtemplateRefExtractor);
        } if (rf & 2) {
            var _r2994 = i0.ɵɵreference(5);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind1(3, 2, ctx.enableAutoMeasure$))("ngIfElse", _r2994);
        } }, directives: [i2.NgIf, i2.NgTemplateOutlet], pipes: [i2.AsyncPipe], encapsulation: 2, changeDetection: 0 });
    return NzTableFixedRowComponent;
}());
export { NzTableFixedRowComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(NzTableFixedRowComponent, [{
        type: Component,
        args: [{
                selector: 'tr[nz-table-fixed-row], tr[nzExpand]',
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None,
                template: "\n    <td class=\"nz-disable-td ant-table-cell\" #tdElement>\n      <div\n        class=\"ant-table-expanded-row-fixed\"\n        *ngIf=\"enableAutoMeasure$ | async; else contentTemplate\"\n        style=\"position: sticky; left: 0px; overflow: hidden;\"\n        [style.width.px]=\"hostWidth$ | async\"\n      >\n        <ng-template [ngTemplateOutlet]=\"contentTemplate\"></ng-template>\n      </div>\n    </td>\n    <ng-template #contentTemplate><ng-content></ng-content></ng-template>\n  "
            }]
    }], function () { return [{ type: i1.NzTableStyleService }, { type: i0.Renderer2 }]; }, { tdElement: [{
            type: ViewChild,
            args: ['tdElement']
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 