25 lines
987 B
JavaScript
25 lines
987 B
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
|
|
import * as React from 'react';
|
|
import { renderColumnTitle } from '../util';
|
|
|
|
function fillTitle(columns, columnTitleProps) {
|
|
return columns.map(function (column) {
|
|
var cloneColumn = _extends({}, column);
|
|
|
|
cloneColumn.title = renderColumnTitle(column.title, columnTitleProps);
|
|
|
|
if ('children' in cloneColumn) {
|
|
cloneColumn.children = fillTitle(cloneColumn.children, columnTitleProps);
|
|
}
|
|
|
|
return cloneColumn;
|
|
});
|
|
}
|
|
|
|
export default function useTitleColumns(columnTitleProps) {
|
|
var filledColumns = React.useCallback(function (columns) {
|
|
return fillTitle(columns, columnTitleProps);
|
|
}, [columnTitleProps]);
|
|
return [filledColumns];
|
|
} |