(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/table'), require('@angular/common'), require('@angular/core'), require('@angular/cdk/coercion'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/bidi'), require('@angular/cdk/collections'), require('@angular/cdk/platform')) :
    typeof define === 'function' && define.amd ? define('@ng-tangram/components/table', ['exports', '@angular/cdk/table', '@angular/common', '@angular/core', '@angular/cdk/coercion', 'rxjs', 'rxjs/operators', '@angular/cdk/bidi', '@angular/cdk/collections', '@angular/cdk/platform'], factory) :
    (global = global || self, factory((global.nt = global.nt || {}, global.nt.components = global.nt.components || {}, global.nt.components.table = {}), global.ng.cdk.table, global.ng.common, global.ng.core, global.ng.cdk.coercion, global.rxjs, global.rxjs.operators, global.ng.cdk.bidi, global.ng.cdk.collections, global.ng.cdk.platform));
}(this, (function (exports, table, common, core, coercion, rxjs, operators, bidi, collections, platform) { 'use strict';

    var __extends = (this && this.__extends) || (function () {
        var extendStatics = function (d, b) {
            extendStatics = Object.setPrototypeOf ||
                ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
                function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
            return extendStatics(d, b);
        };
        return function (d, b) {
            extendStatics(d, b);
            function __() { this.constructor = d; }
            d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
        };
    })();
    var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };

    (function (NtColumnSort) {
        NtColumnSort["ASC"] = "asc";
        NtColumnSort["DESC"] = "desc";
        NtColumnSort["NONE"] = "";
    })(exports.NtColumnSort || (exports.NtColumnSort = {}));
    var NtColumnSortChange = (function () {
        function NtColumnSortChange(isUserInput, column, sort) {
            if (isUserInput === void 0) { isUserInput = false; }
            this.isUserInput = isUserInput;
            this.column = column;
            this.sort = sort;
        }
        return NtColumnSortChange;
    }());
    var NtCellDefDirective = (function (_super) {
        __extends(NtCellDefDirective, _super);
        function NtCellDefDirective() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        NtCellDefDirective_1 = NtCellDefDirective;
        var NtCellDefDirective_1;
        NtCellDefDirective = NtCellDefDirective_1 = __decorate([
            core.Directive({
                selector: '[ntCellDef]',
                providers: [{ provide: table.CdkCellDef, useExisting: NtCellDefDirective_1 }]
            })
        ], NtCellDefDirective);
        return NtCellDefDirective;
    }(table.CdkCellDef));
    var NtHeaderCellDefDirective = (function (_super) {
        __extends(NtHeaderCellDefDirective, _super);
        function NtHeaderCellDefDirective() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        NtHeaderCellDefDirective_1 = NtHeaderCellDefDirective;
        var NtHeaderCellDefDirective_1;
        NtHeaderCellDefDirective = NtHeaderCellDefDirective_1 = __decorate([
            core.Directive({
                selector: '[ntHeaderCellDef]',
                providers: [{ provide: table.CdkHeaderCellDef, useExisting: NtHeaderCellDefDirective_1 }]
            })
        ], NtHeaderCellDefDirective);
        return NtHeaderCellDefDirective;
    }(table.CdkHeaderCellDef));
    var NtFooterCellDefDirective = (function (_super) {
        __extends(NtFooterCellDefDirective, _super);
        function NtFooterCellDefDirective() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        NtFooterCellDefDirective_1 = NtFooterCellDefDirective;
        var NtFooterCellDefDirective_1;
        NtFooterCellDefDirective = NtFooterCellDefDirective_1 = __decorate([
            core.Directive({
                selector: '[ntFooterCellDef]',
                providers: [{ provide: table.CdkFooterCellDef, useExisting: NtFooterCellDefDirective_1 }]
            })
        ], NtFooterCellDefDirective);
        return NtFooterCellDefDirective;
    }(table.CdkFooterCellDef));
    var NtColumnDirective = (function (_super) {
        __extends(NtColumnDirective, _super);
        function NtColumnDirective() {
            var _this = _super !== null && _super.apply(this, arguments) || this;
            _this._sortable = false;
            _this.sort = exports.NtColumnSort.NONE;
            _this._sortChange = new core.EventEmitter();
            return _this;
        }
        NtColumnDirective_1 = NtColumnDirective;
        Object.defineProperty(NtColumnDirective.prototype, "ntColumn", {
            set: function (value) { this.name = value; },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtColumnDirective.prototype, "sortable", {
            get: function () { return this._sortable; },
            set: function (value) { this._sortable = coercion.coerceBooleanProperty(value); },
            enumerable: true,
            configurable: true
        });
        NtColumnDirective.prototype.sorting = function (isUserInput) {
            if (isUserInput === void 0) { isUserInput = false; }
            if (this.sortable) {
                switch (this.sort) {
                    case exports.NtColumnSort.ASC:
                        this.sort = exports.NtColumnSort.DESC;
                        break;
                    case exports.NtColumnSort.DESC:
                        this.sort = exports.NtColumnSort.NONE;
                        break;
                    default:
                        this.sort = exports.NtColumnSort.ASC;
                        break;
                }
                this._sortChange.emit(new NtColumnSortChange(isUserInput, this.name, this.sort));
            }
        };
        var NtColumnDirective_1;
        __decorate([
            core.Input('nt-column')
        ], NtColumnDirective.prototype, "ntColumn", null);
        __decorate([
            core.Input()
        ], NtColumnDirective.prototype, "name", void 0);
        __decorate([
            core.Input()
        ], NtColumnDirective.prototype, "sticky", void 0);
        __decorate([
            core.Input()
        ], NtColumnDirective.prototype, "stickyEnd", void 0);
        __decorate([
            core.Input()
        ], NtColumnDirective.prototype, "sortable", null);
        NtColumnDirective = NtColumnDirective_1 = __decorate([
            core.Directive({
                selector: 'nt-column, [nt-column]',
                providers: [{ provide: table.CdkColumnDef, useExisting: NtColumnDirective_1 }],
            })
        ], NtColumnDirective);
        return NtColumnDirective;
    }(table.CdkColumnDef));
    var NtHeaderCellDirective = (function (_super) {
        __extends(NtHeaderCellDirective, _super);
        function NtHeaderCellDirective(columnDef, elementRef) {
            var _this = _super.call(this, columnDef, elementRef) || this;
            _this.columnDef = columnDef;
            elementRef.nativeElement.classList.add("nt-column-" + columnDef.cssClassFriendlyName);
            return _this;
        }
        NtHeaderCellDirective.ctorParameters = function () { return [
            { type: NtColumnDirective },
            { type: core.ElementRef }
        ]; };
        NtHeaderCellDirective = __decorate([
            core.Directive({
                selector: 'nt-header-cell, th[nt-header-cell]',
                host: {
                    'class': 'nt-header-cell',
                    '[class.nt-column-sortable]': 'columnDef.sortable',
                    '[class.asc]': 'columnDef.sort === "asc"',
                    '[class.desc]': 'columnDef.sort === "desc"',
                    '(click)': 'columnDef.sorting(true)',
                    'role': 'columnheader',
                },
            })
        ], NtHeaderCellDirective);
        return NtHeaderCellDirective;
    }(table.CdkHeaderCell));
    var NtFooterCellDirective = (function (_super) {
        __extends(NtFooterCellDirective, _super);
        function NtFooterCellDirective(columnDef, elementRef) {
            var _this = _super.call(this, columnDef, elementRef) || this;
            elementRef.nativeElement.classList.add("nt-column-" + columnDef.cssClassFriendlyName);
            return _this;
        }
        NtFooterCellDirective.ctorParameters = function () { return [
            { type: NtColumnDirective },
            { type: core.ElementRef }
        ]; };
        NtFooterCellDirective = __decorate([
            core.Directive({
                selector: 'nt-footer-cell, td[nt-footer-cell]',
                host: {
                    'class': 'nt-footer-cell',
                    'role': 'gridcell',
                },
            })
        ], NtFooterCellDirective);
        return NtFooterCellDirective;
    }(table.CdkFooterCell));
    var NtCellDirective = (function (_super) {
        __extends(NtCellDirective, _super);
        function NtCellDirective(columnDef, elementRef) {
            var _this = _super.call(this, columnDef, elementRef) || this;
            elementRef.nativeElement.classList.add("nt-column-" + columnDef.cssClassFriendlyName);
            return _this;
        }
        NtCellDirective.ctorParameters = function () { return [
            { type: NtColumnDirective },
            { type: core.ElementRef }
        ]; };
        NtCellDirective = __decorate([
            core.Directive({
                selector: 'nt-cell, td[nt-cell]',
                host: {
                    'class': 'nt-cell',
                    'role': 'gridcell',
                },
            })
        ], NtCellDirective);
        return NtCellDirective;
    }(table.CdkCell));

    var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var NtTableResizable = (function () {
        function NtTableResizable() {
        }
        NtTableResizable = __decorate$1([
            core.Directive({
                selector: 'table[ntTableResizable], nt-table[ntTableResizable]'
            })
        ], NtTableResizable);
        return NtTableResizable;
    }());

    var __extends$1 = (this && this.__extends) || (function () {
        var extendStatics = function (d, b) {
            extendStatics = Object.setPrototypeOf ||
                ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
                function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
            return extendStatics(d, b);
        };
        return function (d, b) {
            extendStatics(d, b);
            function __() { this.constructor = d; }
            d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
        };
    })();
    var __decorate$2 = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var NtHeaderRowDefDirective = (function (_super) {
        __extends$1(NtHeaderRowDefDirective, _super);
        function NtHeaderRowDefDirective() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        NtHeaderRowDefDirective_1 = NtHeaderRowDefDirective;
        var NtHeaderRowDefDirective_1;
        NtHeaderRowDefDirective = NtHeaderRowDefDirective_1 = __decorate$2([
            core.Directive({
                selector: '[ntHeaderRowDef]',
                providers: [{ provide: table.CdkHeaderRowDef, useExisting: NtHeaderRowDefDirective_1 }],
                inputs: ['columns: ntHeaderRowDef', 'sticky: ntHeaderRowDefSticky'],
            })
        ], NtHeaderRowDefDirective);
        return NtHeaderRowDefDirective;
    }(table.CdkHeaderRowDef));
    var NtFooterRowDefDirective = (function (_super) {
        __extends$1(NtFooterRowDefDirective, _super);
        function NtFooterRowDefDirective() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        NtFooterRowDefDirective_1 = NtFooterRowDefDirective;
        var NtFooterRowDefDirective_1;
        NtFooterRowDefDirective = NtFooterRowDefDirective_1 = __decorate$2([
            core.Directive({
                selector: '[ntFooterRowDef]',
                providers: [{ provide: table.CdkFooterRowDef, useExisting: NtFooterRowDefDirective_1 }],
                inputs: ['columns: ntFooterRowDef', 'sticky: ntFooterRowDefSticky'],
            })
        ], NtFooterRowDefDirective);
        return NtFooterRowDefDirective;
    }(table.CdkFooterRowDef));
    var NtRowDefDirective = (function (_super) {
        __extends$1(NtRowDefDirective, _super);
        function NtRowDefDirective() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        NtRowDefDirective_1 = NtRowDefDirective;
        var NtRowDefDirective_1;
        NtRowDefDirective = NtRowDefDirective_1 = __decorate$2([
            core.Directive({
                selector: '[ntRowDef]',
                providers: [{ provide: table.CdkRowDef, useExisting: NtRowDefDirective_1 }],
                inputs: ['columns: ntRowDefColumns', 'when: ntRowDefWhen'],
            })
        ], NtRowDefDirective);
        return NtRowDefDirective;
    }(table.CdkRowDef));
    var NtHeaderRowComponent = (function (_super) {
        __extends$1(NtHeaderRowComponent, _super);
        function NtHeaderRowComponent() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        NtHeaderRowComponent_1 = NtHeaderRowComponent;
        var NtHeaderRowComponent_1;
        NtHeaderRowComponent = NtHeaderRowComponent_1 = __decorate$2([
            core.Component({
                selector: 'nt-header-row, tr[nt-header-row]',
                template: table.CDK_ROW_TEMPLATE,
                host: {
                    'class': 'nt-header-row',
                    'role': 'row',
                },
                changeDetection: core.ChangeDetectionStrategy.OnPush,
                encapsulation: core.ViewEncapsulation.None,
                exportAs: 'ntHeaderRow',
                providers: [{ provide: table.CdkHeaderRow, useExisting: NtHeaderRowComponent_1 }]
            })
        ], NtHeaderRowComponent);
        return NtHeaderRowComponent;
    }(table.CdkHeaderRow));
    var NtFooterRowComponent = (function (_super) {
        __extends$1(NtFooterRowComponent, _super);
        function NtFooterRowComponent() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        NtFooterRowComponent_1 = NtFooterRowComponent;
        var NtFooterRowComponent_1;
        NtFooterRowComponent = NtFooterRowComponent_1 = __decorate$2([
            core.Component({
                selector: 'nt-footer-row, tr[nt-footer-row]',
                template: table.CDK_ROW_TEMPLATE,
                host: {
                    'class': 'nt-footer-row',
                    'role': 'row',
                },
                changeDetection: core.ChangeDetectionStrategy.OnPush,
                encapsulation: core.ViewEncapsulation.None,
                exportAs: 'ntFooterRow',
                providers: [{ provide: table.CdkFooterRow, useExisting: NtFooterRowComponent_1 }]
            })
        ], NtFooterRowComponent);
        return NtFooterRowComponent;
    }(table.CdkFooterRow));
    var NtRowComponent = (function (_super) {
        __extends$1(NtRowComponent, _super);
        function NtRowComponent() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        NtRowComponent_1 = NtRowComponent;
        var NtRowComponent_1;
        NtRowComponent = NtRowComponent_1 = __decorate$2([
            core.Component({
                selector: 'nt-row, tr[nt-row]',
                template: table.CDK_ROW_TEMPLATE,
                host: {
                    'class': 'nt-row',
                    'role': 'row',
                },
                changeDetection: core.ChangeDetectionStrategy.OnPush,
                encapsulation: core.ViewEncapsulation.None,
                exportAs: 'ntRow',
                providers: [{ provide: table.CdkRow, useExisting: NtRowComponent_1 }]
            })
        ], NtRowComponent);
        return NtRowComponent;
    }(table.CdkRow));

    var __extends$2 = (this && this.__extends) || (function () {
        var extendStatics = function (d, b) {
            extendStatics = Object.setPrototypeOf ||
                ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
                function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
            return extendStatics(d, b);
        };
        return function (d, b) {
            extendStatics(d, b);
            function __() { this.constructor = d; }
            d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
        };
    })();
    var __decorate$3 = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __param = (this && this.__param) || function (paramIndex, decorator) {
        return function (target, key) { decorator(target, key, paramIndex); }
    };
    var __read = (this && this.__read) || function (o, n) {
        var m = typeof Symbol === "function" && o[Symbol.iterator];
        if (!m) return o;
        var i = m.call(o), r, ar = [], e;
        try {
            while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
        }
        catch (error) { e = { error: error }; }
        finally {
            try {
                if (r && !r.done && (m = i["return"])) m.call(i);
            }
            finally { if (e) throw e.error; }
        }
        return ar;
    };
    var __spread = (this && this.__spread) || function () {
        for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
        return ar;
    };
    var NtTableComponent = (function (_super) {
        __extends$2(NtTableComponent, _super);
        function NtTableComponent(_ngZone, _differs, _changeDetectorRef, _elementRef, role, _dir, _document, _platform) {
            var _this = _super.call(this, _differs, _changeDetectorRef, _elementRef, role, _dir, _document, _platform) || this;
            _this._ngZone = _ngZone;
            _this._differs = _differs;
            _this._changeDetectorRef = _changeDetectorRef;
            _this._elementRef = _elementRef;
            _this._dir = _dir;
            _this._selectionModel = new collections.SelectionModel(true, undefined, false);
            _this._multiSortable = false;
            _this._selectable = false;
            _this._destroy = new rxjs.Subject();
            _this.columSortChanges = rxjs.defer(function () {
                if (_this._contentColumns) {
                    return rxjs.merge.apply(void 0, __spread(_this._contentColumns.map(function (column) { return column._sortChange; })));
                }
                return _this._ngZone.onStable
                    .asObservable()
                    .pipe(operators.take(1), operators.switchMap(function () { return _this.columSortChanges; }));
            });
            _this.selectedChange = new core.EventEmitter();
            _this.sortChange = new core.EventEmitter();
            return _this;
        }
        Object.defineProperty(NtTableComponent.prototype, "selectable", {
            get: function () { return this._selectable; },
            set: function (value) { this._selectable = coercion.coerceBooleanProperty(value); },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtTableComponent.prototype, "isAllSelected", {
            get: function () { return false; },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtTableComponent.prototype, "selected", {
            get: function () { return this._selectionModel.selected; },
            enumerable: true,
            configurable: true
        });
        NtTableComponent.prototype.ngAfterContentInit = function () {
            var _this = this;
            this._contentColumns.changes.pipe(operators.startWith(null), operators.takeUntil(this._destroy)).subscribe(function () {
                _this._resetOptions();
                _this._changeDetectorRef.markForCheck();
            });
        };
        NtTableComponent.prototype.selectAll = function () {
            if (!this.isAllSelected) {
            }
            else {
                this._selectionModel.clear();
            }
            this.selectedChange.emit(this._selectionModel.selected);
        };
        NtTableComponent.prototype.select = function (item) {
            var wasSelected = this.checkSelected(item);
            if (wasSelected) {
                this._selectionModel.deselect(item);
            }
            else {
                this._selectionModel.select(item);
            }
            this.selectedChange.emit(this._selectionModel.selected);
        };
        NtTableComponent.prototype.ngOnChanges = function (change) {
            if (change && change.dataSource && !change.dataSource.firstChange) {
                this._selectionModel.clear();
            }
        };
        NtTableComponent.prototype.checkSelected = function (item) {
            return this._selectionModel.isSelected(item);
        };
        NtTableComponent.prototype._clearSort = function (filter) {
            this._contentColumns
                .filter(function (column) { return column.name !== (filter ? filter.column : ''); })
                .forEach(function (column) { return column.sort = exports.NtColumnSort.NONE; });
            this._changeDetectorRef.markForCheck();
        };
        NtTableComponent.prototype._resetOptions = function () {
            var _this = this;
            var changedOrDestroyed = rxjs.merge(this._contentColumns.changes, this._destroy);
            this.columSortChanges
                .pipe(operators.takeUntil(changedOrDestroyed), operators.filter(function (event) { return event.isUserInput; }))
                .subscribe(function (event) {
                if (!_this._multiSortable) {
                    _this._clearSort(event);
                }
                _this.sortChange.emit(event);
            });
            rxjs.merge.apply(void 0, __spread(this._contentColumns.map(function (column) { return column._sortChange; }))).pipe(operators.takeUntil(changedOrDestroyed))
                .subscribe(function () {
                _this._changeDetectorRef.markForCheck();
            });
        };
        NtTableComponent.prototype.ngOnDestroy = function () {
            this._destroy.next();
            this._destroy.complete();
            _super.prototype.ngOnDestroy.call(this);
        };
        NtTableComponent.ctorParameters = function () { return [
            { type: core.NgZone },
            { type: core.IterableDiffers },
            { type: core.ChangeDetectorRef },
            { type: core.ElementRef },
            { type: String, decorators: [{ type: core.Attribute, args: ['role',] }] },
            { type: bidi.Directionality, decorators: [{ type: core.Optional }] },
            { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
            { type: platform.Platform }
        ]; };
        __decorate$3([
            core.Input()
        ], NtTableComponent.prototype, "selectable", null);
        __decorate$3([
            core.ContentChildren(NtColumnDirective)
        ], NtTableComponent.prototype, "_contentColumns", void 0);
        __decorate$3([
            core.Output()
        ], NtTableComponent.prototype, "selectedChange", void 0);
        __decorate$3([
            core.Output()
        ], NtTableComponent.prototype, "sortChange", void 0);
        NtTableComponent = __decorate$3([
            core.Component({
                selector: 'nt-table, table[nt-table]',
                template: table.CDK_TABLE_TEMPLATE,
                encapsulation: core.ViewEncapsulation.None,
                changeDetection: core.ChangeDetectionStrategy.OnPush,
                host: {
                    'class': 'nt-table'
                }
            }),
            __param(4, core.Attribute('role')),
            __param(5, core.Optional()),
            __param(6, core.Inject(common.DOCUMENT))
        ], NtTableComponent);
        return NtTableComponent;
    }(table.CdkTable));

    var __decorate$4 = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var EXPORTS_DECLARATIONS = [
        NtTableComponent,
        NtTableResizable,
        NtCellDefDirective,
        NtCellDirective,
        NtColumnDirective,
        NtFooterCellDefDirective,
        NtFooterCellDirective,
        NtHeaderCellDefDirective,
        NtHeaderCellDirective,
        NtFooterRowComponent,
        NtFooterRowDefDirective,
        NtHeaderRowComponent,
        NtHeaderRowDefDirective,
        NtRowComponent,
        NtRowDefDirective
    ];
    var NtTableModule = (function () {
        function NtTableModule() {
        }
        NtTableModule = __decorate$4([
            core.NgModule({
                imports: [common.CommonModule, table.CdkTableModule],
                exports: EXPORTS_DECLARATIONS,
                declarations: EXPORTS_DECLARATIONS
            })
        ], NtTableModule);
        return NtTableModule;
    }());

    var __extends$3 = (this && this.__extends) || (function () {
        var extendStatics = function (d, b) {
            extendStatics = Object.setPrototypeOf ||
                ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
                function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
            return extendStatics(d, b);
        };
        return function (d, b) {
            extendStatics(d, b);
            function __() { this.constructor = d; }
            d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
        };
    })();
    var __read$1 = (this && this.__read) || function (o, n) {
        var m = typeof Symbol === "function" && o[Symbol.iterator];
        if (!m) return o;
        var i = m.call(o), r, ar = [], e;
        try {
            while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
        }
        catch (error) { e = { error: error }; }
        finally {
            try {
                if (r && !r.done && (m = i["return"])) m.call(i);
            }
            finally { if (e) throw e.error; }
        }
        return ar;
    };
    var NtTableDataSource = (function (_super) {
        __extends$3(NtTableDataSource, _super);
        function NtTableDataSource(initialData) {
            if (initialData === void 0) { initialData = []; }
            var _this = _super.call(this) || this;
            _this._renderData = new rxjs.BehaviorSubject([]);
            _this._filter = new rxjs.BehaviorSubject('');
            _this._renderChangesSubscription = rxjs.Subscription.EMPTY;
            _this.filterPredicate = function (data, filter) {
                var accumulator = function (currentTerm, key) { return currentTerm + data[key]; };
                var dataStr = Object.keys(data).reduce(accumulator, '').toLowerCase();
                var transformedFilter = filter.trim().toLowerCase();
                return dataStr.indexOf(transformedFilter) !== -1;
            };
            _this._data = new rxjs.BehaviorSubject(initialData);
            _this._updateChangeSubscription();
            return _this;
        }
        Object.defineProperty(NtTableDataSource.prototype, "data", {
            get: function () { return this._data.value; },
            set: function (data) { this._data.next(data); },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtTableDataSource.prototype, "filter", {
            get: function () { return this._filter.value; },
            set: function (filter) { this._filter.next(filter); },
            enumerable: true,
            configurable: true
        });
        NtTableDataSource.prototype._updateChangeSubscription = function () {
            var _this = this;
            var dataStream = this._data;
            var filteredData = rxjs.combineLatest(dataStream, this._filter)
                .pipe(operators.map(function (_a) {
                var _b = __read$1(_a, 1), data = _b[0];
                return _this._filterData(data);
            }));
            this._renderChangesSubscription.unsubscribe();
            this._renderChangesSubscription = filteredData.subscribe(function (data) { return _this._renderData.next(data); });
        };
        NtTableDataSource.prototype._filterData = function (data) {
            var _this = this;
            this.filteredData =
                !this.filter ? data : data.filter(function (obj) { return _this.filterPredicate(obj, _this.filter); });
            return this.filteredData;
        };
        NtTableDataSource.prototype.connect = function () { return this._renderData; };
        NtTableDataSource.prototype.disconnect = function () { };
        return NtTableDataSource;
    }(table.DataSource));

    exports.NtCellDefDirective = NtCellDefDirective;
    exports.NtCellDirective = NtCellDirective;
    exports.NtColumnDirective = NtColumnDirective;
    exports.NtColumnSortChange = NtColumnSortChange;
    exports.NtFooterCellDefDirective = NtFooterCellDefDirective;
    exports.NtFooterCellDirective = NtFooterCellDirective;
    exports.NtFooterRowComponent = NtFooterRowComponent;
    exports.NtFooterRowDefDirective = NtFooterRowDefDirective;
    exports.NtHeaderCellDefDirective = NtHeaderCellDefDirective;
    exports.NtHeaderCellDirective = NtHeaderCellDirective;
    exports.NtHeaderRowComponent = NtHeaderRowComponent;
    exports.NtHeaderRowDefDirective = NtHeaderRowDefDirective;
    exports.NtRowComponent = NtRowComponent;
    exports.NtRowDefDirective = NtRowDefDirective;
    exports.NtTableComponent = NtTableComponent;
    exports.NtTableDataSource = NtTableDataSource;
    exports.NtTableModule = NtTableModule;
    exports.NtTableResizable = NtTableResizable;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=table.umd.js.map
