/**
 * DevExtreme (cjs/renovation/ui/grids/data_grid_next/utils.js)
 * Version: 22.1.3 (build 22180-0310)
 * Build date: Wed Jun 29 2022
 *
 * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
exports.getReactRowKey = exports.getElementHeight = exports.createGetKey = void 0;
var _ui = _interopRequireDefault(require("../../../../ui/widget/ui.errors"));
var _type = require("../../../../core/utils/type");
var _get_element_width = require("../../pager/utils/get_element_width");

function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    }
}
var createGetKey = function(featureName) {
    return function(rowData, keyExpr) {
        if (void 0 === keyExpr) {
            return
        }
        if (null === keyExpr) {
            throw _ui.default.Error("E1042", featureName)
        }
        if (!(keyExpr in rowData)) {
            throw _ui.default.Error("E1046", keyExpr)
        }
        return rowData[keyExpr]
    }
};
exports.createGetKey = createGetKey;
var getReactRowKey = function(row, index) {
    if (!row.key || !((0, _type.isNumeric)(row.key) || (0, _type.isString)(row.key))) {
        return "".concat(index)
    }
    return "".concat(row.rowType, "_").concat(row.key)
};
exports.getReactRowKey = getReactRowKey;
var getElementHeight = function(element) {
    return (0, _get_element_width.getElementStyle)("height", element)
};
exports.getElementHeight = getElementHeight;
