| 54 | 'aria-label': props['aria-label'], |
| 55 | hasChildNodes: true, |
| 56 | *childNodes() { |
| 57 | // Process cells first |
| 58 | if (context.showDragButtons) { |
| 59 | yield { |
| 60 | type: 'cell', |
| 61 | key: 'header-drag', // this is combined with the row key by CollectionBuilder |
| 62 | props: { |
| 63 | isDragButtonCell: true |
| 64 | } |
| 65 | }; |
| 66 | } |
| 67 | |
| 68 | if (context.showSelectionCheckboxes && context.selectionMode !== 'none') { |
| 69 | yield { |
| 70 | type: 'cell', |
| 71 | key: 'header', // this is combined with the row key by CollectionBuilder |
| 72 | props: { |
| 73 | isSelectionCell: true |
| 74 | } |
| 75 | }; |
| 76 | } |
| 77 | |
| 78 | if (typeof children === 'function') { |
| 79 | for (let column of context.columns) { |
| 80 | yield { |
| 81 | type: 'cell', |
| 82 | element: children(column.key), |
| 83 | key: column.key // this is combined with the row key by CollectionBuilder |
| 84 | }; |
| 85 | } |
| 86 | |
| 87 | if (UNSTABLE_childItems) { |
| 88 | for (let child of UNSTABLE_childItems) { |
| 89 | // Note: in order to reuse the render function of TableBody for our child rows, we just need to yield a type and a value here. CollectionBuilder will then look up |
| 90 | // the parent renderer and use that to build the full node of this child row, using the value provided here to generate the cells |
| 91 | yield { |
| 92 | type: 'item', |
| 93 | value: child |
| 94 | }; |
| 95 | } |
| 96 | } |
| 97 | } else { |
| 98 | let cells: PartialNode<T>[] = []; |
| 99 | let childRows: PartialNode<T>[] = []; |
| 100 | let columnCount = 0; |
| 101 | React.Children.forEach(children, node => { |
| 102 | if (node.type === Row) { |
| 103 | if (cells.length < context.columns.length) { |
| 104 | throw new Error( |
| 105 | "All of a Row's child Cells must be positioned before any child Rows." |
| 106 | ); |
| 107 | } |
| 108 | |
| 109 | childRows.push({ |
| 110 | type: 'item', |
| 111 | element: node |
| 112 | }); |
| 113 | } else { |