var AgGridSortingHelper = (function () {
    function AgGridSortingHelper(gridOptions) {
        this.gridOptions = gridOptions;
    }
    AgGridSortingHelper.prototype.applyDefaultSortModel = function () {
        var _a;
        (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.columnApi.applyColumnState(this.getDefaultSortModel());
    };
    AgGridSortingHelper.prototype.getDefaultSortModel = function () {
        var _a;
        return {
            state: ((_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.columnDefs)
                .filter(function (colDef) { return colDef.sort != null; })
                .map(function (_a) {
                var field = _a.field, sort = _a.sort;
                return { colId: field, sort: sort };
            }),
            defaultState: { sort: null }
        };
    };
    AgGridSortingHelper.prototype.isCurrentSortDefault = function () {
        var _a;
        var currentSort = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.columnApi.getColumnState().filter(function (x) { return x.sort != null; }).sortBy('colId');
        var defaultSort = this.getDefaultSortModel().state.sortBy('colId');
        return currentSort.length == defaultSort.length && false == currentSort.some(function (current, index) { return defaultSort[index].colId != current.colId || defaultSort[index].sort != current.sort; });
    };
    AgGridSortingHelper.prototype.hasAnySorting = function () {
        var _a, _b;
        return (_b = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.columnApi) === null || _b === void 0 ? void 0 : _b.getColumnState().some(function (x) { return x.sort != null; });
    };
    return AgGridSortingHelper;
}());
export { AgGridSortingHelper };
var SortDef = (function () {
    function SortDef() {
    }
    return SortDef;
}());
export { SortDef };

//# sourceMappingURL=ag-grid-helpers.js.map
