(children)
| 66 | }, |
| 67 | |
| 68 | formatYieldChildren(children){ |
| 69 | let {labelName, searchable, valueName, placeHolder, multi, style, className} = this.props; |
| 70 | const {filterText, value, open} = this.state; |
| 71 | let nodes = [], tags = []; |
| 72 | React.Children.map(children, item => { |
| 73 | const props = item.props; |
| 74 | const item_val = props[valueName]; |
| 75 | const item_label = props[labelName]; |
| 76 | let selected = false; |
| 77 | if (multi) { |
| 78 | const _index = value.indexOf(item_val); |
| 79 | selected = _index !== -1; |
| 80 | if(selected) tags[_index] = item_label; |
| 81 | } else { |
| 82 | selected = value === item_val; |
| 83 | placeHolder = item_label; |
| 84 | } |
| 85 | |
| 86 | if(this.getFilterStatus(filterText, item_label, item_val)) { |
| 87 | nodes.push(this.formatOptionCell({ |
| 88 | label: item_label, |
| 89 | value: item_val, |
| 90 | selected, |
| 91 | children: props.children, |
| 92 | disabled: props.disabled |
| 93 | })); |
| 94 | } |
| 95 | }); |
| 96 | |
| 97 | let labelNode = null; |
| 98 | if (multi) { |
| 99 | labelNode = this.formatMultiInput(tags) |
| 100 | } else { |
| 101 | labelNode = searchable ? |
| 102 | this.formatSearchBar(placeHolder) |
| 103 | : <DropDown.label onClick={() => this.toggleOpen(!open)}> |
| 104 | {placeHolder} |
| 105 | </DropDown.label> |
| 106 | } |
| 107 | |
| 108 | className = klassName('dropdown', className); |
| 109 | |
| 110 | if (open) { |
| 111 | className = `${className} _active`; |
| 112 | } |
| 113 | |
| 114 | return <div className={className} style={style}> |
| 115 | {labelNode} |
| 116 | <ul className="_list"> |
| 117 | {nodes} |
| 118 | </ul> |
| 119 | </div>; |
| 120 | }, |
| 121 | |
| 122 | formatLabelNode(labels){ |
| 123 | const {multi, searchable} = this.props; |
nothing calls this directly
no test coverage detected
searching dependent graphs…