UNPKG

857 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.getColumnsKey = getColumnsKey;
7exports.validateValue = validateValue;
8var INTERNAL_KEY_PREFIX = 'RC_TABLE_KEY';
9function toArray(arr) {
10 if (arr === undefined || arr === null) {
11 return [];
12 }
13 return Array.isArray(arr) ? arr : [arr];
14}
15function getColumnsKey(columns) {
16 var columnKeys = [];
17 var keys = {};
18 columns.forEach(function (column) {
19 var _ref = column || {},
20 key = _ref.key,
21 dataIndex = _ref.dataIndex;
22 var mergedKey = key || toArray(dataIndex).join('-') || INTERNAL_KEY_PREFIX;
23 while (keys[mergedKey]) {
24 mergedKey = "".concat(mergedKey, "_next");
25 }
26 keys[mergedKey] = true;
27 columnKeys.push(mergedKey);
28 });
29 return columnKeys;
30}
31function validateValue(val) {
32 return val !== null && val !== undefined;
33}
\No newline at end of file