1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.getColumnsKey = getColumnsKey;
|
7 | exports.validateValue = validateValue;
|
8 | var INTERNAL_KEY_PREFIX = 'RC_TABLE_KEY';
|
9 | function toArray(arr) {
|
10 | if (arr === undefined || arr === null) {
|
11 | return [];
|
12 | }
|
13 | return Array.isArray(arr) ? arr : [arr];
|
14 | }
|
15 | function 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 | }
|
31 | function validateValue(val) {
|
32 | return val !== null && val !== undefined;
|
33 | } |
\ | No newline at end of file |