/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { CommonModule } from '@angular/common';
import { ChangeDetectorRef, Component, EventEmitter, Input, NgModule, Output } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { IgxCheckboxModule } from '../checkbox/checkbox.component';
import { IgxButtonModule } from '../directives/button/button.directive';
import { IgxColumnHidingItemDirective } from './column-hiding-item.directive';
import { IgxInputGroupModule } from '../input-group/input-group.component';
import { ColumnChooserBase } from './column-chooser-base';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
var IgxColumnHidingComponent = /** @class */ (function (_super) {
    tslib_1.__extends(IgxColumnHidingComponent, _super);
    function IgxColumnHidingComponent(cdr) {
        var _this = _super.call(this, cdr) || this;
        _this.cdr = cdr;
        /**
         * Sets/gets the text of the button that shows all columns if they are hidden.
         * ```typescript
         * let showAllButtonText =  this.columnHiding.showAllText;
         * ```
         *
         * ```html
         * <igx-column-hiding [showAllText] = "'Show Columns'"></igx-column-hiding>
         * ```
         * \@memberof IgxColumnHidingComponent
         */
        _this.showAllText = 'Show All';
        /**
         * Sets/gets the text of the button that hides all columns if they are shown.
         * ```typescript
         * let hideAllButtonText =  this.columnHiding.hideAllText;
         * ```
         *
         * ```html
         * <igx-column-hiding [hideAllText] = "'Hide Columns'"></igx-column-hiding>
         * ```
         * \@memberof IgxColumnHidingComponent
         */
        _this.hideAllText = 'Hide All';
        /**
         * An event that is emitted after the columns visibility is changed.
         * Provides references to the `column` and the `newValue` properties as event arguments.
         * ```html
         *  <igx-column-hiding (onColumnVisibilityChanged) = "onColumnVisibilityChanged($event)"></igx-column-hiding>
         * ```
         * \@memberof IgxColumnHidingComponent
         */
        _this.onColumnVisibilityChanged = new EventEmitter();
        _this.destroy$ = new Subject();
        return _this;
    }
    Object.defineProperty(IgxColumnHidingComponent.prototype, "disableHideAll", {
        /**
         * Returns a boolean indicating whether the `HIDE ALL` button is disabled.
         * ```html
         * <igx-column-hiding #columnHidingUI
         *     [columns]="grid.columns" [title]="'Column Hiding'">
         * </igx-column-hiding>
         * ```
         * ```typescript
         * @ViewChild("'columnHidingUI'")
         * public columnHiding: IgxColumnHidingComponent;
         * let isHideAlldisabled =  this.columnHiding.disableHideAll;
         * ```
         *@memberof IgxColumnHidingComponent
         */
        get: /**
         * Returns a boolean indicating whether the `HIDE ALL` button is disabled.
         * ```html
         * <igx-column-hiding #columnHidingUI
         *     [columns]="grid.columns" [title]="'Column Hiding'">
         * </igx-column-hiding>
         * ```
         * ```typescript
         * \@ViewChild("'columnHidingUI'")
         * public columnHiding: IgxColumnHidingComponent;
         * let isHideAlldisabled =  this.columnHiding.disableHideAll;
         * ```
         * \@memberof IgxColumnHidingComponent
         * @return {?}
         */
        function () {
            if (!this.columnItems || this.columnItems.length < 1 ||
                this.hiddenColumnsCount === this.columns.length) {
                return true;
            }
            else if (this.hidableColumns.length < 1 ||
                this.hidableColumns.length === this.hidableColumns.filter(function (col) { return col.value; }).length) {
                return true;
            }
            else {
                return false;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxColumnHidingComponent.prototype, "disableShowAll", {
        /**
         * Returns a boolean indicating whether the `SHOW ALL` button is disabled.
         * ```typescript
         * let isShowAlldisabled =  this.columnHiding.disableShowAll;
         * ```
         * @memberof IgxColumnHidingComponent
         */
        get: /**
         * Returns a boolean indicating whether the `SHOW ALL` button is disabled.
         * ```typescript
         * let isShowAlldisabled =  this.columnHiding.disableShowAll;
         * ```
         * \@memberof IgxColumnHidingComponent
         * @return {?}
         */
        function () {
            if (!this.columnItems || this.columnItems.length < 1 ||
                this.hiddenColumnsCount < 1 || this.hidableColumns.length < 1) {
                return true;
            }
            else if (this.hidableColumns.length === this.hidableColumns.filter(function (col) { return !col.value; }).length) {
                return true;
            }
            else {
                return false;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxColumnHidingComponent.prototype, "hiddenColumnsCount", {
        /**
         * Gets the count of the hidden columns.
         * ```typescript
         * let hiddenColumnsCount =  this.columnHiding.hiddenColumnsCount;
         * ```
         * @memberof IgxColumnHidingComponent
         */
        get: /**
         * Gets the count of the hidden columns.
         * ```typescript
         * let hiddenColumnsCount =  this.columnHiding.hiddenColumnsCount;
         * ```
         * \@memberof IgxColumnHidingComponent
         * @return {?}
         */
        function () {
            return (this.columns) ? this.columns.filter(function (col) { return col.hidden; }).length : 0;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IgxColumnHidingComponent.prototype, "hidableColumns", {
        /**
         *@hidden
         */
        get: /**
         * @hidden
         * @return {?}
         */
        function () {
            return this.columnItems.filter(function (col) { return !col.disabled; });
        },
        enumerable: true,
        configurable: true
    });
    /**
     *@hidden
     */
    /**
     * @hidden
     * @protected
     * @param {?} container
     * @param {?} column
     * @return {?}
     */
    IgxColumnHidingComponent.prototype.createColumnItem = /**
     * @hidden
     * @protected
     * @param {?} container
     * @param {?} column
     * @return {?}
     */
    function (container, column) {
        var _this = this;
        if (column.grid.hasColumnLayouts && !column.columnLayout) {
            return null;
        }
        /** @type {?} */
        var item = new IgxColumnHidingItemDirective();
        item.container = container;
        item.column = column;
        item.valueChanged.pipe(takeUntil(this.destroy$)).subscribe(function (args) {
            _this.onVisibilityChanged({ column: item.column, newValue: args.newValue });
        });
        return item;
    };
    /**
     * Shows all columns in the grid.
     * ```typescript
     * this.columnHiding.showAllColumns();
     * ```
     * @memberof IgxColumnHidingComponent
     */
    /**
     * Shows all columns in the grid.
     * ```typescript
     * this.columnHiding.showAllColumns();
     * ```
     * \@memberof IgxColumnHidingComponent
     * @return {?}
     */
    IgxColumnHidingComponent.prototype.showAllColumns = /**
     * Shows all columns in the grid.
     * ```typescript
     * this.columnHiding.showAllColumns();
     * ```
     * \@memberof IgxColumnHidingComponent
     * @return {?}
     */
    function () {
        var e_1, _a;
        /** @type {?} */
        var collection = this.hidableColumns;
        try {
            for (var collection_1 = tslib_1.__values(collection), collection_1_1 = collection_1.next(); !collection_1_1.done; collection_1_1 = collection_1.next()) {
                var col = collection_1_1.value;
                col.value = false;
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (collection_1_1 && !collection_1_1.done && (_a = collection_1.return)) _a.call(collection_1);
            }
            finally { if (e_1) throw e_1.error; }
        }
    };
    /**
     * Hides all columns in the grid.
     * ```typescript
     * this.columnHiding.hideAllColumns();
     * ```
     * @memberof IgxColumnHidingComponent
     */
    /**
     * Hides all columns in the grid.
     * ```typescript
     * this.columnHiding.hideAllColumns();
     * ```
     * \@memberof IgxColumnHidingComponent
     * @return {?}
     */
    IgxColumnHidingComponent.prototype.hideAllColumns = /**
     * Hides all columns in the grid.
     * ```typescript
     * this.columnHiding.hideAllColumns();
     * ```
     * \@memberof IgxColumnHidingComponent
     * @return {?}
     */
    function () {
        var e_2, _a;
        /** @type {?} */
        var collection = this.hidableColumns;
        try {
            for (var collection_2 = tslib_1.__values(collection), collection_2_1 = collection_2.next(); !collection_2_1.done; collection_2_1 = collection_2.next()) {
                var col = collection_2_1.value;
                col.value = true;
            }
        }
        catch (e_2_1) { e_2 = { error: e_2_1 }; }
        finally {
            try {
                if (collection_2_1 && !collection_2_1.done && (_a = collection_2.return)) _a.call(collection_2);
            }
            finally { if (e_2) throw e_2.error; }
        }
    };
    /**
     * @hidden
     */
    /**
     * @hidden
     * @param {?} args
     * @return {?}
     */
    IgxColumnHidingComponent.prototype.onVisibilityChanged = /**
     * @hidden
     * @param {?} args
     * @return {?}
     */
    function (args) {
        this.onColumnVisibilityChanged.emit(args);
    };
    /**
     *@hidden
     */
    /**
     * @hidden
     * @return {?}
     */
    IgxColumnHidingComponent.prototype.ngOnDestroy = /**
     * @hidden
     * @return {?}
     */
    function () {
        this.destroy$.next(true);
        this.destroy$.complete();
    };
    IgxColumnHidingComponent.decorators = [
        { type: Component, args: [{
                    preserveWhitespaces: false,
                    selector: 'igx-column-hiding',
                    template: "<div class=\"igx-column-hiding__header\">\n    <h4 class=\"igx-column-hiding__header-title\" *ngIf=\"title\">{{ title }}</h4>\n\n    <igx-input-group class=\"igx-column-hiding__header-input\" *ngIf=\"!disableFilter\">\n        <input igxInput\n            type=\"text\"\n            [(ngModel)]=\"filterCriteria\"\n            [placeholder]=\"filterColumnsPrompt\"\n            autocomplete=\"off\" />\n    </igx-input-group>\n</div>\n\n<div class=\"igx-column-hiding__columns\"\n    [style.max-height]=\"columnsAreaMaxHeight\">\n    <igx-checkbox\n        *ngFor=\"let columnItem of hidableColumns\"\n        class=\"igx-column-hiding__columns-item\"\n        (onColumnVisibilityChanged)=\"onVisibilityChanged($event)\"\n        (change)=\"columnItem.value = !columnItem.value\"\n        [checked]=\"columnItem.value\"\n        [disabled]=\"columnItem.disabled\"\n        [style.margin-left.px]=\"columnItem.calcIndent\">\n        {{ columnItem.name }}\n    </igx-checkbox>\n</div>\n\n<div class=\"igx-column-hiding__buttons\">\n    <button igxButton igxRipple (click)=\"showAllColumns()\" [disabled]=\"disableShowAll\">{{ showAllText }}</button>\n    <button igxButton igxRipple (click)=\"hideAllColumns()\" [disabled]=\"disableHideAll\">{{ hideAllText }}</button>\n</div>\n"
                }] }
    ];
    /** @nocollapse */
    IgxColumnHidingComponent.ctorParameters = function () { return [
        { type: ChangeDetectorRef }
    ]; };
    IgxColumnHidingComponent.propDecorators = {
        disableHideAll: [{ type: Input }],
        disableShowAll: [{ type: Input }],
        showAllText: [{ type: Input }],
        hideAllText: [{ type: Input }],
        onColumnVisibilityChanged: [{ type: Output }]
    };
    return IgxColumnHidingComponent;
}(ColumnChooserBase));
export { IgxColumnHidingComponent };
if (false) {
    /**
     * Sets/gets the text of the button that shows all columns if they are hidden.
     * ```typescript
     * let showAllButtonText =  this.columnHiding.showAllText;
     * ```
     *
     * ```html
     * <igx-column-hiding [showAllText] = "'Show Columns'"></igx-column-hiding>
     * ```
     * \@memberof IgxColumnHidingComponent
     * @type {?}
     */
    IgxColumnHidingComponent.prototype.showAllText;
    /**
     * Sets/gets the text of the button that hides all columns if they are shown.
     * ```typescript
     * let hideAllButtonText =  this.columnHiding.hideAllText;
     * ```
     *
     * ```html
     * <igx-column-hiding [hideAllText] = "'Hide Columns'"></igx-column-hiding>
     * ```
     * \@memberof IgxColumnHidingComponent
     * @type {?}
     */
    IgxColumnHidingComponent.prototype.hideAllText;
    /**
     * An event that is emitted after the columns visibility is changed.
     * Provides references to the `column` and the `newValue` properties as event arguments.
     * ```html
     *  <igx-column-hiding (onColumnVisibilityChanged) = "onColumnVisibilityChanged($event)"></igx-column-hiding>
     * ```
     * \@memberof IgxColumnHidingComponent
     * @type {?}
     */
    IgxColumnHidingComponent.prototype.onColumnVisibilityChanged;
    /**
     * @type {?}
     * @private
     */
    IgxColumnHidingComponent.prototype.destroy$;
    /** @type {?} */
    IgxColumnHidingComponent.prototype.cdr;
}
/**
 * @hidden
 */
var IgxColumnHidingModule = /** @class */ (function () {
    function IgxColumnHidingModule() {
    }
    IgxColumnHidingModule.decorators = [
        { type: NgModule, args: [{
                    declarations: [IgxColumnHidingComponent, IgxColumnHidingItemDirective],
                    exports: [IgxColumnHidingComponent],
                    imports: [
                        IgxButtonModule,
                        IgxCheckboxModule,
                        IgxInputGroupModule,
                        CommonModule,
                        FormsModule,
                    ]
                },] }
    ];
    return IgxColumnHidingModule;
}());
export { IgxColumnHidingModule };
//# sourceMappingURL=data:application/json;base64, 