/**
 * DevExtreme (cjs/__internal/grids/data_grid/grouping/m_grouping.js)
 * Version: 23.2.6 (build 24140-0112)
 * Build date: Sun May 19 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.GroupingHeaderPanelExtender = void 0;
var _devices = _interopRequireDefault(require("../../../../core/devices"));
var _renderer = _interopRequireDefault(require("../../../../core/renderer"));
var _deferred = require("../../../../core/utils/deferred");
var _iterator = require("../../../../core/utils/iterator");
var _size = require("../../../../core/utils/size");
var _type = require("../../../../core/utils/type");
var _message = _interopRequireDefault(require("../../../../localization/message"));
var _accessibility = require("../../../../ui/shared/accessibility");
var _m_accessibility = require("../../../grids/grid_core/m_accessibility");
var _m_core = _interopRequireDefault(require("../m_core"));
var _m_data_source_adapter = _interopRequireDefault(require("../m_data_source_adapter"));
var _m_grouping_collapsed = require("./m_grouping_collapsed");
var _m_grouping_expanded = require("./m_grouping_expanded");

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}

function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    _setPrototypeOf(subClass, superClass)
}

function _setPrototypeOf(o, p) {
    _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, p) {
        o.__proto__ = p;
        return o
    };
    return _setPrototypeOf(o, p)
}
const DATAGRID_GROUP_PANEL_CLASS = "dx-datagrid-group-panel";
const DATAGRID_GROUP_PANEL_MESSAGE_CLASS = "dx-group-panel-message";
const DATAGRID_GROUP_PANEL_ITEM_CLASS = "dx-group-panel-item";
const DATAGRID_GROUP_PANEL_LABEL_CLASS = "dx-toolbar-label";
const DATAGRID_GROUP_PANEL_CONTAINER_CLASS = "dx-toolbar-item";
const DATAGRID_EXPAND_CLASS = "dx-datagrid-expand";
const DATAGRID_GROUP_ROW_CLASS = "dx-group-row";
const HEADER_FILTER_CLASS_SELECTOR = ".dx-header-filter";
const dataSourceAdapterExtender = Base => function(_Base) {
    _inheritsLoose(GroupingDataSourceAdapterExtender, _Base);

    function GroupingDataSourceAdapterExtender() {
        return _Base.apply(this, arguments) || this
    }
    var _proto = GroupingDataSourceAdapterExtender.prototype;
    _proto.init = function() {
        _Base.prototype.init.apply(this, arguments);
        this._initGroupingHelper()
    };
    _proto._initGroupingHelper = function(options) {
        const grouping = this._grouping;
        const isAutoExpandAll = this.option("grouping.autoExpandAll");
        const isFocusedRowEnabled = this.option("focusedRowEnabled");
        const remoteOperations = options ? options.remoteOperations : this.remoteOperations();
        const isODataRemoteOperations = remoteOperations.filtering && remoteOperations.sorting && remoteOperations.paging;
        if (isODataRemoteOperations && !remoteOperations.grouping && (isAutoExpandAll || !isFocusedRowEnabled)) {
            if (!grouping || grouping instanceof _m_grouping_collapsed.GroupingHelper) {
                this._grouping = new _m_grouping_expanded.GroupingHelper(this)
            }
        } else if (!grouping || grouping instanceof _m_grouping_expanded.GroupingHelper) {
            this._grouping = new _m_grouping_collapsed.GroupingHelper(this)
        }
    };
    _proto.totalItemsCount = function() {
        const totalCount = _Base.prototype.totalItemsCount.call(this);
        return totalCount > 0 && this._dataSource.group() && this._dataSource.requireTotalCount() ? totalCount + this._grouping.totalCountCorrection() : totalCount
    };
    _proto.itemsCount = function() {
        return this._dataSource.group() ? this._grouping.itemsCount() || 0 : _Base.prototype.itemsCount.apply(this, arguments)
    };
    _proto.allowCollapseAll = function() {
        return this._grouping.allowCollapseAll()
    };
    _proto.isGroupItemCountable = function(item) {
        return this._grouping.isGroupItemCountable(item)
    };
    _proto.isRowExpanded = function(key) {
        const groupInfo = this._grouping.findGroupInfo(key);
        return groupInfo ? groupInfo.isExpanded : !this._grouping.allowCollapseAll()
    };
    _proto.collapseAll = function(groupIndex) {
        return this._collapseExpandAll(groupIndex, false)
    };
    _proto.expandAll = function(groupIndex) {
        return this._collapseExpandAll(groupIndex, true)
    };
    _proto._collapseExpandAll = function(groupIndex, isExpand) {
        const that = this;
        const dataSource = that._dataSource;
        const group = dataSource.group();
        const groups = _m_core.default.normalizeSortingInfo(group || []);
        if (groups.length) {
            for (let i = 0; i < groups.length; i++) {
                if (void 0 === groupIndex || groupIndex === i) {
                    groups[i].isExpanded = isExpand
                } else if (group && group[i]) {
                    groups[i].isExpanded = group[i].isExpanded
                }
            }
            dataSource.group(groups);
            that._grouping.foreachGroups((groupInfo, parents) => {
                if (void 0 === groupIndex || groupIndex === parents.length - 1) {
                    groupInfo.isExpanded = isExpand
                }
            }, false, true);
            that.resetPagesCache()
        }
        return true
    };
    _proto.refresh = function() {
        _Base.prototype.refresh.apply(this, arguments);
        return this._grouping.refresh.apply(this._grouping, arguments)
    };
    _proto.changeRowExpand = function(path) {
        const that = this;
        const dataSource = that._dataSource;
        if (dataSource.group()) {
            dataSource.beginLoading();
            if (that._lastLoadOptions) {
                that._lastLoadOptions.groupExpand = true
            }
            return that._changeRowExpandCore(path).always(() => {
                dataSource.endLoading()
            })
        }
    };
    _proto._changeRowExpandCore = function(path) {
        return this._grouping.changeRowExpand(path)
    };
    _proto._hasGroupLevelsExpandState = function(group, isExpanded) {
        if (group && Array.isArray(group)) {
            for (let i = 0; i < group.length; i++) {
                if (group[i].isExpanded === isExpanded) {
                    return true
                }
            }
        }
    };
    _proto._customizeRemoteOperations = function(options, operationTypes) {
        const {
            remoteOperations: remoteOperations
        } = options;
        if (options.storeLoadOptions.group) {
            if (remoteOperations.grouping && !options.isCustomLoading) {
                if (!remoteOperations.groupPaging || this._hasGroupLevelsExpandState(options.storeLoadOptions.group, true)) {
                    remoteOperations.paging = false
                }
            }
            if (!remoteOperations.grouping && (!remoteOperations.sorting || !remoteOperations.filtering || options.isCustomLoading || this._hasGroupLevelsExpandState(options.storeLoadOptions.group, false))) {
                remoteOperations.paging = false
            }
        } else if (!options.isCustomLoading && remoteOperations.paging && operationTypes.grouping) {
            this.resetCache()
        }
        _Base.prototype._customizeRemoteOperations.apply(this, arguments)
    };
    _proto._handleDataLoading = function(options) {
        _Base.prototype._handleDataLoading.call(this, options);
        this._initGroupingHelper(options);
        return this._grouping.handleDataLoading(options)
    };
    _proto._handleDataLoaded = function(options) {
        return this._grouping.handleDataLoaded(options, _Base.prototype._handleDataLoaded.bind(this))
    };
    _proto._handleDataLoadedCore = function(options) {
        return this._grouping.handleDataLoadedCore(options, _Base.prototype._handleDataLoadedCore.bind(this))
    };
    return GroupingDataSourceAdapterExtender
}(Base);
_m_data_source_adapter.default.extend(dataSourceAdapterExtender);
const GroupingDataControllerExtender = Base => function(_Base2) {
    _inheritsLoose(GroupingDataControllerExtender, _Base2);

    function GroupingDataControllerExtender() {
        return _Base2.apply(this, arguments) || this
    }
    var _proto2 = GroupingDataControllerExtender.prototype;
    _proto2.init = function() {
        _Base2.prototype.init.call(this);
        this.createAction("onRowExpanding");
        this.createAction("onRowExpanded");
        this.createAction("onRowCollapsing");
        this.createAction("onRowCollapsed")
    };
    _proto2._beforeProcessItems = function(items) {
        const groupColumns = this._columnsController.getGroupColumns();
        items = _Base2.prototype._beforeProcessItems.call(this, items);
        if (items.length && groupColumns.length) {
            items = this._processGroupItems(items, groupColumns.length)
        }
        return items
    };
    _proto2._processItem = function(item, options) {
        if ((0, _type.isDefined)(item.groupIndex) && (0, _type.isString)(item.rowType) && 0 === item.rowType.indexOf("group")) {
            item = this._processGroupItem(item, options);
            options.dataIndex = 0
        } else {
            item = _Base2.prototype._processItem.apply(this, arguments)
        }
        return item
    };
    _proto2._processGroupItem = function(item, options) {
        return item
    };
    _proto2._processGroupItems = function(items, groupsCount, options) {
        const that = this;
        const groupedColumns = that._columnsController.getGroupColumns();
        const column = groupedColumns[groupedColumns.length - groupsCount];
        if (!options) {
            const scrollingMode = that.option("scrolling.mode");
            options = {
                collectContinuationItems: "virtual" !== scrollingMode && "infinite" !== scrollingMode,
                resultItems: [],
                path: [],
                values: []
            }
        }
        const {
            resultItems: resultItems
        } = options;
        if (options.data) {
            if (options.collectContinuationItems || !options.data.isContinuation) {
                resultItems.push({
                    rowType: "group",
                    data: options.data,
                    groupIndex: options.path.length - 1,
                    isExpanded: !!options.data.items,
                    key: options.path.slice(0),
                    values: options.values.slice(0)
                })
            }
        }
        if (items) {
            if (0 === groupsCount) {
                resultItems.push.apply(resultItems, items)
            } else {
                for (let i = 0; i < items.length; i++) {
                    const item = items[i];
                    if (item && "items" in item) {
                        options.data = item;
                        options.path.push(item.key);
                        options.values.push(column && column.deserializeValue && !column.calculateDisplayValue ? column.deserializeValue(item.key) : item.key);
                        that._processGroupItems(item.items, groupsCount - 1, options);
                        options.data = void 0;
                        options.path.pop();
                        options.values.pop()
                    } else {
                        resultItems.push(item)
                    }
                }
            }
        }
        return resultItems
    };
    _proto2.publicMethods = function() {
        return _Base2.prototype.publicMethods.call(this).concat(["collapseAll", "expandAll", "isRowExpanded", "expandRow", "collapseRow"])
    };
    _proto2.collapseAll = function(groupIndex) {
        const dataSource = this._dataSource;
        if (dataSource && dataSource.collapseAll(groupIndex)) {
            dataSource.pageIndex(0);
            dataSource.reload()
        }
    };
    _proto2.expandAll = function(groupIndex) {
        const dataSource = this._dataSource;
        if (dataSource && dataSource.expandAll(groupIndex)) {
            dataSource.pageIndex(0);
            dataSource.reload()
        }
    };
    _proto2.changeRowExpand = function(key) {
        const that = this;
        const expanded = that.isRowExpanded(key);
        const args = {
            key: key,
            expanded: expanded
        };
        that.executeAction(expanded ? "onRowCollapsing" : "onRowExpanding", args);
        if (!args.cancel) {
            return (0, _deferred.when)(that._changeRowExpandCore(key)).done(() => {
                args.expanded = !expanded;
                that.executeAction(expanded ? "onRowCollapsed" : "onRowExpanded", args)
            })
        }
        return (new _deferred.Deferred).resolve()
    };
    _proto2._changeRowExpandCore = function(key) {
        const that = this;
        const dataSource = this._dataSource;
        const d = new _deferred.Deferred;
        if (!dataSource) {
            d.resolve()
        } else {
            (0, _deferred.when)(dataSource.changeRowExpand(key)).done(() => {
                that.load().done(d.resolve).fail(d.reject)
            }).fail(d.reject)
        }
        return d
    };
    _proto2.isRowExpanded = function(key) {
        const dataSource = this._dataSource;
        return dataSource && dataSource.isRowExpanded(key)
    };
    _proto2.expandRow = function(key) {
        if (!this.isRowExpanded(key)) {
            return this.changeRowExpand(key)
        }
        return (new _deferred.Deferred).resolve()
    };
    _proto2.collapseRow = function(key) {
        if (this.isRowExpanded(key)) {
            return this.changeRowExpand(key)
        }
        return (new _deferred.Deferred).resolve()
    };
    _proto2.optionChanged = function(args) {
        if ("grouping" === args.name) {
            args.name = "dataSource"
        }
        _Base2.prototype.optionChanged.call(this, args)
    };
    return GroupingDataControllerExtender
}(Base);
const onGroupingMenuItemClick = function(column, params) {
    const columnsController = this._columnsController;
    switch (params.itemData.value) {
        case "group": {
            const groups = columnsController._dataSource.group() || [];
            columnsController.columnOption(column.dataField, "groupIndex", groups.length);
            break
        }
        case "ungroup":
            columnsController.columnOption(column.dataField, "groupIndex", -1);
            break;
        case "ungroupAll":
            this.component.clearGrouping()
    }
};
const isGroupPanelVisible = groupPanelOptions => {
    const visible = null === groupPanelOptions || void 0 === groupPanelOptions ? void 0 : groupPanelOptions.visible;
    return "auto" === visible ? "desktop" === _devices.default.current().deviceType : !!visible
};
const _allowDragging = (groupPanelOptions, column) => {
    const isVisible = isGroupPanelVisible(groupPanelOptions);
    const canDrag = (null === groupPanelOptions || void 0 === groupPanelOptions ? void 0 : groupPanelOptions.allowColumnDragging) && column.allowGrouping;
    return isVisible && !!canDrag
};
const GroupingHeaderPanelExtender = Base => function(_Base3) {
    _inheritsLoose(GroupingHeaderPanelExtender, _Base3);

    function GroupingHeaderPanelExtender() {
        return _Base3.apply(this, arguments) || this
    }
    var _proto3 = GroupingHeaderPanelExtender.prototype;
    _proto3._getToolbarItems = function() {
        const items = _Base3.prototype._getToolbarItems.call(this);
        return this._appendGroupingItem(items)
    };
    _proto3._appendGroupingItem = function(items) {
        if (this._isGroupPanelVisible()) {
            let isRendered = false;
            const toolbarItem = {
                template: () => {
                    const $groupPanel = (0, _renderer.default)("<div>").addClass("dx-datagrid-group-panel");
                    this._updateGroupPanelContent($groupPanel);
                    (0, _m_accessibility.registerKeyboardAction)("groupPanel", this, $groupPanel, void 0, this._handleActionKeyDown.bind(this));
                    return $groupPanel
                },
                name: "groupPanel",
                onItemRendered: () => {
                    isRendered && this.renderCompleted.fire();
                    isRendered = true
                },
                location: "before",
                locateInMenu: "never",
                sortIndex: 1
            };
            items.push(toolbarItem);
            this.updateToolbarDimensions()
        }
        return items
    };
    _proto3._handleActionKeyDown = function(args) {
        const {
            event: event
        } = args;
        const $target = (0, _renderer.default)(event.target);
        const groupColumnIndex = $target.closest(".".concat("dx-group-panel-item")).index();
        const column = this._columnsController.getGroupColumns()[groupColumnIndex];
        const columnIndex = column && column.index;
        if ($target.is(".dx-header-filter")) {
            this._headerFilterController.showHeaderFilterMenu(columnIndex, true)
        } else {
            this._processGroupItemAction(columnIndex)
        }
        event.preventDefault()
    };
    _proto3._isGroupPanelVisible = function() {
        return isGroupPanelVisible(this.option("groupPanel"))
    };
    _proto3._renderGroupPanelItems = function($groupPanel, groupColumns) {
        const that = this;
        $groupPanel.empty();
        (0, _iterator.each)(groupColumns, (index, groupColumn) => {
            that._createGroupPanelItem($groupPanel, groupColumn)
        });
        (0, _accessibility.restoreFocus)(this)
    };
    _proto3._createGroupPanelItem = function($rootElement, groupColumn) {
        const $groupPanelItem = (0, _renderer.default)("<div>").addClass(groupColumn.cssClass).addClass("dx-group-panel-item").data("columnData", groupColumn).appendTo($rootElement).text(groupColumn.caption);
        (0, _accessibility.setTabIndex)(this, $groupPanelItem);
        return $groupPanelItem
    };
    _proto3._columnOptionChanged = function(e) {
        if (!this._requireReady && !_m_core.default.checkChanges(e.optionNames, ["width", "visibleWidth"])) {
            const $toolbarElement = this.element();
            const $groupPanel = $toolbarElement && $toolbarElement.find(".".concat("dx-datagrid-group-panel"));
            if ($groupPanel && $groupPanel.length) {
                this._updateGroupPanelContent($groupPanel);
                this.updateToolbarDimensions();
                this.renderCompleted.fire()
            }
        }
        _Base3.prototype._columnOptionChanged.call(this)
    };
    _proto3._updateGroupPanelContent = function($groupPanel) {
        const groupColumns = this.getColumns();
        const groupPanelOptions = this.option("groupPanel");
        this._renderGroupPanelItems($groupPanel, groupColumns);
        if (groupPanelOptions.allowColumnDragging && !groupColumns.length) {
            (0, _renderer.default)("<div>").addClass("dx-group-panel-message").text(groupPanelOptions.emptyPanelText).appendTo($groupPanel);
            $groupPanel.closest(".".concat("dx-toolbar-item")).addClass("dx-toolbar-label");
            $groupPanel.closest(".".concat("dx-toolbar-label")).css("maxWidth", "none")
        }
    };
    _proto3.allowDragging = function(column) {
        const groupPanelOptions = this.option("groupPanel");
        return _allowDragging(groupPanelOptions, column)
    };
    _proto3.getColumnElements = function() {
        const $element = this.element();
        return $element && $element.find(".".concat("dx-group-panel-item"))
    };
    _proto3.getColumns = function() {
        return this._columnsController.getGroupColumns()
    };
    _proto3.getBoundingRect = function() {
        const $element = this.element();
        if ($element && $element.find(".".concat("dx-datagrid-group-panel")).length) {
            const offset = $element.offset();
            return {
                top: offset.top,
                bottom: offset.top + (0, _size.getHeight)($element)
            }
        }
        return null
    };
    _proto3.getName = function() {
        return "group"
    };
    _proto3.getContextMenuItems = function(options) {
        const that = this;
        const contextMenuEnabled = that.option("grouping.contextMenuEnabled");
        const $groupedColumnElement = (0, _renderer.default)(options.targetElement).closest(".".concat("dx-group-panel-item"));
        let items;
        if ($groupedColumnElement.length) {
            options.column = $groupedColumnElement.data("columnData")
        }
        if (contextMenuEnabled && options.column) {
            const {
                column: column
            } = options;
            const isGroupingAllowed = (0, _type.isDefined)(column.allowGrouping) ? column.allowGrouping : true;
            if (isGroupingAllowed) {
                const isColumnGrouped = (0, _type.isDefined)(column.groupIndex) && column.groupIndex > -1;
                const groupingTexts = that.option("grouping.texts");
                const onItemClick = onGroupingMenuItemClick.bind(that, column);
                items = [{
                    text: groupingTexts.ungroup,
                    value: "ungroup",
                    disabled: !isColumnGrouped,
                    onItemClick: onItemClick
                }, {
                    text: groupingTexts.ungroupAll,
                    value: "ungroupAll",
                    onItemClick: onItemClick
                }]
            }
        }
        return items
    };
    _proto3.isVisible = function() {
        return _Base3.prototype.isVisible.call(this) || this._isGroupPanelVisible()
    };
    _proto3.hasGroupedColumns = function() {
        return this._isGroupPanelVisible() && !!this.getColumns().length
    };
    _proto3.optionChanged = function(args) {
        if ("groupPanel" === args.name) {
            this._invalidate();
            args.handled = true
        } else {
            _Base3.prototype.optionChanged.call(this, args)
        }
    };
    return GroupingHeaderPanelExtender
}(Base);
exports.GroupingHeaderPanelExtender = GroupingHeaderPanelExtender;
const GroupingRowsViewExtender = Base => function(_Base4) {
    _inheritsLoose(GroupingRowsViewExtender, _Base4);

    function GroupingRowsViewExtender() {
        return _Base4.apply(this, arguments) || this
    }
    var _proto4 = GroupingRowsViewExtender.prototype;
    _proto4.getContextMenuItems = function(options) {
        const that = this;
        const contextMenuEnabled = that.option("grouping.contextMenuEnabled");
        let items;
        if (contextMenuEnabled && options.row && "group" === options.row.rowType) {
            const columnsController = that._columnsController;
            const column = columnsController.columnOption("groupIndex:".concat(options.row.groupIndex));
            if (column && column.allowGrouping) {
                const groupingTexts = that.option("grouping.texts");
                const onItemClick = onGroupingMenuItemClick.bind(that, column);
                items = [];
                items.push({
                    text: groupingTexts.ungroup,
                    value: "ungroup",
                    onItemClick: onItemClick
                }, {
                    text: groupingTexts.ungroupAll,
                    value: "ungroupAll",
                    onItemClick: onItemClick
                })
            }
        }
        return items
    };
    _proto4._rowClick = function(e) {
        const that = this;
        const expandMode = that.option("grouping.expandMode");
        const scrollingMode = that.option("scrolling.mode");
        const isGroupRowStateChanged = "infinite" !== scrollingMode && "rowClick" === expandMode && (0, _renderer.default)(e.event.target).closest(".".concat("dx-group-row")).length;
        const isExpandButtonClicked = (0, _renderer.default)(e.event.target).closest(".".concat("dx-datagrid-expand")).length;
        if (isGroupRowStateChanged || isExpandButtonClicked) {
            that._changeGroupRowState(e)
        }
        _Base4.prototype._rowClick.call(this, e)
    };
    _proto4._changeGroupRowState = function(e) {
        const row = this._dataController.items()[e.rowIndex];
        const allowCollapsing = this._columnsController.columnOption("groupIndex:".concat(row.groupIndex), "allowCollapsing");
        if ("data" === row.rowType || "group" === row.rowType && false !== allowCollapsing) {
            this._dataController.changeRowExpand(row.key, true);
            e.event.preventDefault();
            e.handled = true
        }
    };
    return GroupingRowsViewExtender
}(Base);
const columnHeadersViewExtender = Base => function(_Base5) {
    _inheritsLoose(GroupingHeadersViewExtender, _Base5);

    function GroupingHeadersViewExtender() {
        return _Base5.apply(this, arguments) || this
    }
    var _proto5 = GroupingHeadersViewExtender.prototype;
    _proto5.getContextMenuItems = function(options) {
        const that = this;
        const contextMenuEnabled = that.option("grouping.contextMenuEnabled");
        let items = _Base5.prototype.getContextMenuItems.call(this, options);
        if (contextMenuEnabled && options.row && ("header" === options.row.rowType || "detailAdaptive" === options.row.rowType)) {
            const {
                column: column
            } = options;
            if (!column.command && (!(0, _type.isDefined)(column.allowGrouping) || column.allowGrouping)) {
                const groupingTexts = that.option("grouping.texts");
                const isColumnGrouped = (0, _type.isDefined)(column.groupIndex) && column.groupIndex > -1;
                const onItemClick = onGroupingMenuItemClick.bind(that, column);
                items = items || [];
                items.push({
                    text: groupingTexts.groupByThisColumn,
                    value: "group",
                    beginGroup: true,
                    disabled: isColumnGrouped,
                    onItemClick: onItemClick
                });
                if (column.showWhenGrouped) {
                    items.push({
                        text: groupingTexts.ungroup,
                        value: "ungroup",
                        disabled: !isColumnGrouped,
                        onItemClick: onItemClick
                    })
                }
                items.push({
                    text: groupingTexts.ungroupAll,
                    value: "ungroupAll",
                    onItemClick: onItemClick
                })
            }
        }
        return items
    };
    _proto5.allowDragging = function(column) {
        const groupPanelOptions = this.option("groupPanel");
        return _allowDragging(groupPanelOptions, column) || _Base5.prototype.allowDragging.call(this, column)
    };
    return GroupingHeadersViewExtender
}(Base);
_m_core.default.registerModule("grouping", {
    defaultOptions: () => ({
        grouping: {
            autoExpandAll: true,
            allowCollapsing: true,
            contextMenuEnabled: false,
            expandMode: "buttonClick",
            texts: {
                groupContinuesMessage: _message.default.format("dxDataGrid-groupContinuesMessage"),
                groupContinuedMessage: _message.default.format("dxDataGrid-groupContinuedMessage"),
                groupByThisColumn: _message.default.format("dxDataGrid-groupHeaderText"),
                ungroup: _message.default.format("dxDataGrid-ungroupHeaderText"),
                ungroupAll: _message.default.format("dxDataGrid-ungroupAllText")
            }
        },
        groupPanel: {
            visible: false,
            emptyPanelText: _message.default.format("dxDataGrid-groupPanelEmptyText"),
            allowColumnDragging: true
        }
    }),
    extenders: {
        controllers: {
            data: GroupingDataControllerExtender,
            columns: Base => function(_Base6) {
                _inheritsLoose(GroupingColumnsExtender, _Base6);

                function GroupingColumnsExtender() {
                    return _Base6.apply(this, arguments) || this
                }
                var _proto6 = GroupingColumnsExtender.prototype;
                _proto6._getExpandColumnOptions = function() {
                    const options = _Base6.prototype._getExpandColumnOptions.apply(this, arguments);
                    options.cellTemplate = _m_core.default.getExpandCellTemplate();
                    return options
                };
                return GroupingColumnsExtender
            }(Base),
            editing: Base => function(_Base7) {
                _inheritsLoose(GroupingEditingExtender, _Base7);

                function GroupingEditingExtender() {
                    return _Base7.apply(this, arguments) || this
                }
                var _proto7 = GroupingEditingExtender.prototype;
                _proto7._isProcessedItem = function(item) {
                    return (0, _type.isDefined)(item.groupIndex) && (0, _type.isString)(item.rowType) && 0 === item.rowType.indexOf("group")
                };
                return GroupingEditingExtender
            }(Base)
        },
        views: {
            headerPanel: GroupingHeaderPanelExtender,
            rowsView: GroupingRowsViewExtender,
            columnHeadersView: columnHeadersViewExtender
        }
    }
});
