This commit is contained in:
2026-05-25 17:08:18 +08:00
parent df501f6151
commit f1259b71b5
9178 changed files with 1626125 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
import { isNonNullable } from '../_util/is';
export const getColumnKey = (column, defaultKey) => {
if ('key' in column && isNonNullable(column.key)) {
return column.key;
}
if (column.dataIndex) {
return Array.isArray(column.dataIndex) ? column.dataIndex.join('.') : column.dataIndex;
}
return defaultKey;
};
export function getColumnPos(index, pos) {
return pos ? `${pos}-${index}` : `${index}`;
}
export const renderColumnTitle = (title, props) => {
if (typeof title === 'function') {
return title(props);
}
return title;
};
/**
* Safe get column title
*
* Should filter [object Object]
*
* @param title
*/
export const safeColumnTitle = (title, props) => {
const res = renderColumnTitle(title, props);
if (Object.prototype.toString.call(res) === '[object Object]') {
return '';
}
return res;
};