| 108 | * using the Select component. |
| 109 | */ |
| 110 | export function TreeSelect(t0) { |
| 111 | const $ = _c(48); |
| 112 | const { |
| 113 | nodes, |
| 114 | onSelect, |
| 115 | onCancel, |
| 116 | onFocus, |
| 117 | focusNodeId, |
| 118 | visibleOptionCount, |
| 119 | layout: t1, |
| 120 | isDisabled: t2, |
| 121 | hideIndexes: t3, |
| 122 | isNodeExpanded, |
| 123 | onExpand, |
| 124 | onCollapse, |
| 125 | getParentPrefix, |
| 126 | getChildPrefix, |
| 127 | onUpFromFirstItem |
| 128 | } = t0; |
| 129 | const layout = t1 === undefined ? "expanded" : t1; |
| 130 | const isDisabled = t2 === undefined ? false : t2; |
| 131 | const hideIndexes = t3 === undefined ? false : t3; |
| 132 | let t4; |
| 133 | if ($[0] === Symbol.for("react.memo_cache_sentinel")) { |
| 134 | t4 = new Set(); |
| 135 | $[0] = t4; |
| 136 | } else { |
| 137 | t4 = $[0]; |
| 138 | } |
| 139 | const [internalExpandedIds, setInternalExpandedIds] = React.useState(t4); |
| 140 | const isProgrammaticFocusRef = React.useRef(false); |
| 141 | const lastFocusedIdRef = React.useRef(null); |
| 142 | let t5; |
| 143 | if ($[1] !== internalExpandedIds || $[2] !== isNodeExpanded) { |
| 144 | t5 = nodeId => { |
| 145 | if (isNodeExpanded) { |
| 146 | return isNodeExpanded(nodeId); |
| 147 | } |
| 148 | return internalExpandedIds.has(nodeId); |
| 149 | }; |
| 150 | $[1] = internalExpandedIds; |
| 151 | $[2] = isNodeExpanded; |
| 152 | $[3] = t5; |
| 153 | } else { |
| 154 | t5 = $[3]; |
| 155 | } |
| 156 | const isExpanded = t5; |
| 157 | let result; |
| 158 | if ($[4] !== isExpanded || $[5] !== nodes) { |
| 159 | result = []; |
| 160 | function traverse(node, depth, parentId) { |
| 161 | const hasChildren = !!node.children && node.children.length > 0; |
| 162 | const nodeIsExpanded = isExpanded(node.id); |
| 163 | result.push({ |
| 164 | node, |
| 165 | depth, |
| 166 | isExpanded: nodeIsExpanded, |
| 167 | hasChildren, |