devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
42 lines (40 loc) • 2.07 kB
JavaScript
/**
* DevExtreme (cjs/__internal/grids/grid_core/views/utils.js)
* Version: 26.1.6
* Build date: Fri Oct 16 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isSameColumnLayout = exports.isRowElementVisible = exports.insertRowElement = exports.getMaxHorizontalScrollOffset = exports.getCellText = void 0;
var _columns_controller_utils = require("../../../grids/grid_core/columns_controller/columns_controller_utils");
var _m_utils = _interopRequireDefault(require("../m_utils"));
function _interopRequireDefault(e) {
return e && e.__esModule ? e : {
default: e
}
}
const INVISIBLE_CLASS = "dx-state-invisible";
const getCellText = (column, displayValue) => (0, _columns_controller_utils.columnHasValue)(column) ? _m_utils.default.formatValue(displayValue, column) : "";
exports.getCellText = getCellText;
const getMaxHorizontalScrollOffset = container => container ? Math.round(container.scrollWidth - container.clientWidth) : 0;
exports.getMaxHorizontalScrollOffset = getMaxHorizontalScrollOffset;
const isSameColumnLayout = (renderedColumns, columns) => renderedColumns.length === columns.length && renderedColumns.every((column, index) => column.index === columns[index].index && column.command === columns[index].command);
exports.isSameColumnLayout = isSameColumnLayout;
const isRowElementVisible = rowElement => "none" !== rowElement.style.display && !rowElement.classList.contains(INVISIBLE_CLASS);
exports.isRowElementVisible = isRowElementVisible;
const insertRowElement = ($newRow, $rows, rowIndex, $table) => {
const $row = $rows.eq(rowIndex);
if ($row.length) {
$newRow.insertBefore($row)
} else if ($rows.length) {
$newRow.insertAfter($rows.last())
} else if ($table) {
$newRow.prependTo($newRow.is("tbody") ? $table : $table.children("tbody"))
}
};
exports.insertRowElement = insertRowElement;