/**
 * DevExtreme (cjs/__internal/grids/pivot_grid/data_area/m_data_area.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.default = exports.DataArea = void 0;
var _renderer = _interopRequireDefault(require("../../../../core/renderer"));
var _support = require("../../../../core/utils/support");
var _m_area_item = require("../area_item/m_area_item");
var _m_widget_utils = require("../m_widget_utils");

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}
const PIVOTGRID_AREA_CLASS = "dx-pivotgrid-area";
const PIVOTGRID_AREA_DATA_CLASS = "dx-pivotgrid-area-data";
const PIVOTGRID_TOTAL_CLASS = "dx-total";
const PIVOTGRID_GRAND_TOTAL_CLASS = "dx-grandtotal";
const PIVOTGRID_ROW_TOTAL_CLASS = "dx-row-total";
const DataArea = _m_area_item.AreaItem.inherit({
    _getAreaName: () => "data",
    _createGroupElement: () => (0, _renderer.default)("<div>").addClass("dx-pivotgrid-area").addClass("dx-pivotgrid-area-data").css("borderTopWidth", 0),
    _applyCustomStyles(options) {
        const {
            cell: cell
        } = options;
        const {
            classArray: classArray
        } = options;
        if ("T" === cell.rowType || "T" === cell.columnType) {
            classArray.push("dx-total")
        }
        if ("GT" === cell.rowType || "GT" === cell.columnType) {
            classArray.push("dx-grandtotal")
        }
        if ("T" === cell.rowType || "GT" === cell.rowType) {
            classArray.push("dx-row-total")
        }
        if (options.rowIndex === options.rowsCount - 1) {
            options.cssArray.push("border-bottom: 0px")
        }
        this.callBase(options)
    },
    _moveFakeTable(scrollPos) {
        this._moveFakeTableHorizontally(scrollPos.x);
        this._moveFakeTableTop(scrollPos.y);
        this.callBase()
    },
    renderScrollable() {
        this._groupElement.dxScrollable({
            useNative: this.getUseNativeValue(),
            useSimulatedScrollbar: false,
            rtlEnabled: this.component.option("rtlEnabled"),
            bounceEnabled: false,
            updateManually: true
        })
    },
    getUseNativeValue() {
        const {
            useNative: useNative
        } = this.component.option("scrolling");
        return "auto" === useNative ? !!_support.nativeScrolling : !!useNative
    },
    getScrollbarWidth() {
        return this.getUseNativeValue() ? (0, _m_widget_utils.calculateScrollbarWidth)() : 0
    },
    updateScrollableOptions(_ref) {
        let {
            direction: direction,
            rtlEnabled: rtlEnabled
        } = _ref;
        const scrollable = this._getScrollable();
        scrollable.option("useNative", this.getUseNativeValue());
        scrollable.option({
            direction: direction,
            rtlEnabled: rtlEnabled
        })
    },
    getScrollableDirection(horizontal, vertical) {
        if (horizontal && !vertical) {
            return "horizontal"
        }
        if (!horizontal && vertical) {
            return "vertical"
        }
        return "both"
    },
    reset() {
        this.callBase();
        if (this._virtualContent) {
            this._virtualContent.parent().css("height", "auto")
        }
    },
    setVirtualContentParams(params) {
        this.callBase(params);
        this._virtualContent.parent().css("height", params.height);
        this._setTableCss({
            top: params.top,
            left: params.left
        })
    }
});
exports.DataArea = DataArea;
var _default = {
    DataArea: DataArea
};
exports.default = _default;
