(rootNode: ColumnViewNode)
| 551 | }; |
| 552 | |
| 553 | function generateNodeTable(rootNode: ColumnViewNode): NodeTable { |
| 554 | const nodesById: { [id: string]: NodeRecord } = {}; |
| 555 | |
| 556 | function addNode(node: ColumnViewNode, parentId?: string) { |
| 557 | const nodeRecord: NodeRecord = { |
| 558 | id: node.id, |
| 559 | node, |
| 560 | parentId, |
| 561 | children: [], |
| 562 | }; |
| 563 | |
| 564 | nodesById[node.id] = nodeRecord; |
| 565 | |
| 566 | if (node.children) { |
| 567 | node.children.forEach((child) => { |
| 568 | addNode(child, node.id); |
| 569 | }); |
| 570 | |
| 571 | nodeRecord.children = node.children.map((child) => child.id); |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | addNode(rootNode); |
| 576 | |
| 577 | return nodesById; |
| 578 | } |
| 579 | |
| 580 | function getHighlightedSibling( |
| 581 | state: ColumnViewState, |
no test coverage detected