devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
111 lines (110 loc) • 3.99 kB
JavaScript
/**
* DevExtreme (cjs/__internal/grids/pivot_grid/data_area/module.js)
* Version: 22.1.9
* Build date: Tue Apr 18 2023
*
* Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
var __importDefault = this && this.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : {
default: mod
}
};
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DataArea = void 0;
var renderer_1 = __importDefault(require("../../../../core/renderer"));
var support_1 = require("../../../../core/utils/support");
var module_1 = require("../area_item/module");
var module_widget_utils_1 = require("../module_widget_utils");
var PIVOTGRID_AREA_CLASS = "dx-pivotgrid-area";
var PIVOTGRID_AREA_DATA_CLASS = "dx-pivotgrid-area-data";
var PIVOTGRID_TOTAL_CLASS = "dx-total";
var PIVOTGRID_GRAND_TOTAL_CLASS = "dx-grandtotal";
var PIVOTGRID_ROW_TOTAL_CLASS = "dx-row-total";
var DataArea = module_1.AreaItem.inherit({
_getAreaName: function() {
return "data"
},
_createGroupElement: function() {
return renderer_1.default("<div>").addClass(PIVOTGRID_AREA_CLASS).addClass(PIVOTGRID_AREA_DATA_CLASS).css("borderTopWidth", 0)
},
_applyCustomStyles: function(options) {
var cell = options.cell;
var classArray = options.classArray;
if ("T" === cell.rowType || "T" === cell.columnType) {
classArray.push(PIVOTGRID_TOTAL_CLASS)
}
if ("GT" === cell.rowType || "GT" === cell.columnType) {
classArray.push(PIVOTGRID_GRAND_TOTAL_CLASS)
}
if ("T" === cell.rowType || "GT" === cell.rowType) {
classArray.push(PIVOTGRID_ROW_TOTAL_CLASS)
}
if (options.rowIndex === options.rowsCount - 1) {
options.cssArray.push("border-bottom: 0px")
}
this.callBase(options)
},
_moveFakeTable: function(scrollPos) {
this._moveFakeTableHorizontally(scrollPos.x);
this._moveFakeTableTop(scrollPos.y);
this.callBase()
},
renderScrollable: function() {
this._groupElement.dxScrollable({
useNative: this.getUseNativeValue(),
useSimulatedScrollbar: false,
rtlEnabled: this.component.option("rtlEnabled"),
bounceEnabled: false,
updateManually: true
})
},
getUseNativeValue: function() {
var useNative = this.component.option("scrolling").useNative;
return "auto" === useNative ? !!support_1.nativeScrolling : !!useNative
},
getScrollbarWidth: function() {
return this.getUseNativeValue() ? module_widget_utils_1.calculateScrollbarWidth() : 0
},
updateScrollableOptions: function(_a) {
var direction = _a.direction,
rtlEnabled = _a.rtlEnabled;
var scrollable = this._getScrollable();
scrollable.option("useNative", this.getUseNativeValue());
scrollable.option({
direction: direction,
rtlEnabled: rtlEnabled
})
},
getScrollableDirection: function(horizontal, vertical) {
if (horizontal && !vertical) {
return "horizontal"
}
if (!horizontal && vertical) {
return "vertical"
}
return "both"
},
reset: function() {
this.callBase();
if (this._virtualContent) {
this._virtualContent.parent().css("height", "auto")
}
},
setVirtualContentParams: function(params) {
this.callBase(params);
this._virtualContent.parent().css("height", params.height);
this._setTableCss({
top: params.top,
left: params.left
})
}
});
exports.DataArea = DataArea;
exports.default = {
DataArea: DataArea
};