devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
39 lines (38 loc) • 1.34 kB
JavaScript
/**
* DevExtreme (cjs/__internal/grids/data_grid/summary/utils/get_summary_item_index.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.getSummaryItemIndex = void 0;
var _m_type = require("../../../../core/utils/m_type");
const getFullName = summaryItem => {
const {
summaryType: summaryType,
column: column
} = summaryItem;
if (summaryType && column) {
return `${summaryType}_${column}`
}
return summaryType ?? column
};
const getSummaryItemIndex = (summaryItems, name) => {
if (!(null !== summaryItems && void 0 !== summaryItems && summaryItems.length) || !(0, _m_type.isDefined)(name)) {
return -1
}
for (let index = 0; index < summaryItems.length; index += 1) {
const summaryItem = summaryItems[index];
const isNameMatch = summaryItem.name === name || index === name || summaryItem.summaryType === name || summaryItem.column === name || getFullName(summaryItem) === name;
if (isNameMatch) {
return index
}
}
return -1
};
exports.getSummaryItemIndex = getSummaryItemIndex;