UNPKG

ayongui

Version:
38 lines (37 loc) 1.09 kB
import n from "react"; function s({ columns: t, children: o }) { let p = 0; if (t.length) return { columns: t, colSpanSize: p }; if (o) return { columns: n.Children.map(o, (e) => { if (e.type.displayName === "Column") return { title: e.props.title, dataIndex: e.props.dataIndex, render: e.props.render, key: e.key, width: e.props.width, showOverflowTooltip: e.props.showOverflowTooltip }; if (e.type.displayName === "ColumnGroup") return { title: e.props.title, type: "columnGroup", children: n.Children.map(e.props.children, (r) => r.type.displayName === "Column" ? (p = e.props.children.length, { title: r.props.title, dataIndex: r.props.dataIndex, render: r.props.render, key: r.key }) : null).filter(Boolean), // 过滤掉 null key: e.key }; }), colSpanSize: p }; } export { s as groupHandle };