import { Component, ContentChildren, ElementRef, EventEmitter, Output, QueryList, Renderer2 } from '@angular/core';
import { TableThComponent } from '../head/th/th.component';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/forms";
import * as i3 from "ng-devui/checkbox";
import * as i4 from "ng-devui/dropdown";
export class TableTrComponent {
    constructor(eleRef, render2) {
        this.eleRef = eleRef;
        this.render2 = render2;
        this.headerRowspan = 1;
        this.headerCheckStatusEvent = new EventEmitter();
        this.checkStatusEvent = new EventEmitter();
    }
    ngOnInit() {
    }
    ngAfterContentInit() {
        if (this.thList) {
            this.firstTh = this.thList.first;
        }
        this.initFixedColumnStatus();
    }
    initFixedColumnStatus() {
        const fixLeftList = this.eleRef.nativeElement.querySelectorAll('.devui-sticky-left-cell');
        const fixRightList = this.eleRef.nativeElement.querySelectorAll('.devui-sticky-right-cell');
        if (fixLeftList?.length) {
            const lastEle = fixLeftList[fixLeftList.length - 1];
            this.render2.addClass(lastEle, 'devui-last-sticky-left-cell');
        }
        if (fixRightList?.length) {
            const firstEle = fixRightList[0];
            this.render2.addClass(firstEle, 'devui-first-sticky-right-cell');
        }
    }
    onHeaderCheckChange(checked) {
        this.headerChecked = checked;
        this.headerHalfChecked = false;
        this.headerCheckStatusEvent.emit(checked);
    }
    onOptionSelect(option) {
        if (option.onChecked) {
            option.onChecked();
        }
    }
}
TableTrComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TableTrComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
TableTrComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: TableTrComponent, selector: "[dTableRow]", outputs: { headerCheckStatusEvent: "headerCheckStatusEvent", checkStatusEvent: "checkStatusEvent" }, queries: [{ propertyName: "thList", predicate: TableThComponent }], ngImport: i0, template: "<th\r\n  *ngIf=\"headerCheckable\"\r\n  [attr.rowspan]=\"headerRowspan\"\r\n  class=\"devui-checkable-cell\"\r\n  [ngClass]=\"{ 'devui-sticky-left-cell': firstTh?.fixedLeft }\"\r\n  [style.left]=\"'0px'\"\r\n>\r\n  <d-checkbox\r\n    class=\"check-box-all\"\r\n    [name]=\"'checkbox'\"\r\n    (change)=\"onHeaderCheckChange($event)\"\r\n    [(ngModel)]=\"headerChecked\"\r\n    [halfchecked]=\"headerHalfChecked\"\r\n    [disabled]=\"headerCheckDisabled\"\r\n  ></d-checkbox>\r\n\r\n  <div *ngIf=\"headerCheckOptions && headerCheckOptions.length > 0\" dDropDown appendToBody [trigger]=\"'hover'\" class=\"select-options\">\r\n    <div dDropDownToggle>\r\n      <svg\r\n        xmlns:xlink=\"http://www.w3.org/1999/xlink\"\r\n        height=\"16px\"\r\n        version=\"1.1\"\r\n        viewBox=\"0 0 16 16\"\r\n        width=\"16px\"\r\n        xmlns=\"http://www.w3.org/2000/svg\"\r\n      >\r\n        <g fill=\"none\" fill-rule=\"evenodd\" id=\"chevron_down\" stroke=\"none\" stroke-width=\"1\">\r\n          <polygon points=\"4.5 5 8 8.76923077 11.5 5 13 6.61538462 8 12 3 6.61538462\"></polygon>\r\n        </g>\r\n      </svg>\r\n    </div>\r\n    <ul dDropDownMenu class=\"devui-dropdown-menu\" role=\"menu\">\r\n      <li *ngFor=\"let option of headerCheckOptions\" role=\"menuitem\" (click)=\"onOptionSelect(option)\">\r\n        <a class=\"devui-dropdown-item\">{{ option.label }}</a>\r\n      </li>\r\n    </ul>\r\n  </div>\r\n</th>\r\n<ng-content></ng-content>\r\n", styles: [".select-options{cursor:pointer;vertical-align:middle}svg>g>polygon{fill:#71757f;fill:var(--devui-icon-text, #71757f)}\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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3.CheckBoxComponent, selector: "d-checkbox", inputs: ["name", "label", "cssClass", "color", "disabled", "isShowTitle", "title", "labelTemplate", "halfchecked", "showAnimation", "beforeChange"], outputs: ["change"] }, { kind: "directive", type: i4.DropDownDirective, selector: "[dDropDown]", inputs: ["isOpen", "disabled", "showAnimation", "trigger", "closeScope", "closeOnMouseLeaveMenu"], outputs: ["toggleEvent"], exportAs: ["d-dropdown"] }, { kind: "directive", type: i4.DropDownMenuDirective, selector: "[dDropDownMenu]", exportAs: ["d-dropdown-menu"] }, { kind: "directive", type: i4.DropDownToggleDirective, selector: "[dDropDownToggle]", inputs: ["toggleOnFocus", "autoFocus"], exportAs: ["d-dropdown-toggle"] }, { kind: "component", type: i4.DropDownAppendToBodyComponent, selector: "[dDropDown][appendToBody]", inputs: ["alignOrigin", "appendToBodyDirections"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TableTrComponent, decorators: [{
            type: Component,
            args: [{ selector: '[dTableRow]', template: "<th\r\n  *ngIf=\"headerCheckable\"\r\n  [attr.rowspan]=\"headerRowspan\"\r\n  class=\"devui-checkable-cell\"\r\n  [ngClass]=\"{ 'devui-sticky-left-cell': firstTh?.fixedLeft }\"\r\n  [style.left]=\"'0px'\"\r\n>\r\n  <d-checkbox\r\n    class=\"check-box-all\"\r\n    [name]=\"'checkbox'\"\r\n    (change)=\"onHeaderCheckChange($event)\"\r\n    [(ngModel)]=\"headerChecked\"\r\n    [halfchecked]=\"headerHalfChecked\"\r\n    [disabled]=\"headerCheckDisabled\"\r\n  ></d-checkbox>\r\n\r\n  <div *ngIf=\"headerCheckOptions && headerCheckOptions.length > 0\" dDropDown appendToBody [trigger]=\"'hover'\" class=\"select-options\">\r\n    <div dDropDownToggle>\r\n      <svg\r\n        xmlns:xlink=\"http://www.w3.org/1999/xlink\"\r\n        height=\"16px\"\r\n        version=\"1.1\"\r\n        viewBox=\"0 0 16 16\"\r\n        width=\"16px\"\r\n        xmlns=\"http://www.w3.org/2000/svg\"\r\n      >\r\n        <g fill=\"none\" fill-rule=\"evenodd\" id=\"chevron_down\" stroke=\"none\" stroke-width=\"1\">\r\n          <polygon points=\"4.5 5 8 8.76923077 11.5 5 13 6.61538462 8 12 3 6.61538462\"></polygon>\r\n        </g>\r\n      </svg>\r\n    </div>\r\n    <ul dDropDownMenu class=\"devui-dropdown-menu\" role=\"menu\">\r\n      <li *ngFor=\"let option of headerCheckOptions\" role=\"menuitem\" (click)=\"onOptionSelect(option)\">\r\n        <a class=\"devui-dropdown-item\">{{ option.label }}</a>\r\n      </li>\r\n    </ul>\r\n  </div>\r\n</th>\r\n<ng-content></ng-content>\r\n", styles: [".select-options{cursor:pointer;vertical-align:middle}svg>g>polygon{fill:#71757f;fill:var(--devui-icon-text, #71757f)}\n"] }]
        }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { thList: [{
                type: ContentChildren,
                args: [TableThComponent]
            }], headerCheckStatusEvent: [{
                type: Output
            }], checkStatusEvent: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 