()
| 117 | } |
| 118 | |
| 119 | render() { |
| 120 | const { expandTrigger, popperClass } = this.parent().props; |
| 121 | const { activeValue, visible } = this.state; |
| 122 | const activeOptions = this.activeOptions(); |
| 123 | |
| 124 | const menus = activeOptions.map((menu, menuIndex) => { |
| 125 | let isFlat = false; |
| 126 | |
| 127 | const items = menu.map((item, index) => { |
| 128 | const events = {}; |
| 129 | |
| 130 | if (item.__IS__FLAT__OPTIONS) isFlat = true; |
| 131 | |
| 132 | if (!item.disabled) { |
| 133 | if (item.children) { |
| 134 | let triggerEvent = { |
| 135 | click: 'onClick', |
| 136 | hover: 'onMouseEnter' |
| 137 | }[expandTrigger]; |
| 138 | events[triggerEvent] = () => { this.activeItem(item, menuIndex); }; |
| 139 | } else { |
| 140 | events.onClick = () => { this.select(item, menuIndex); }; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | return ( |
| 145 | <li key={index} className={this.classNames({ |
| 146 | 'el-cascader-menu__item': true, |
| 147 | 'el-cascader-menu__item--extensible': item.children, |
| 148 | 'is-active': item.value === activeValue[menuIndex], |
| 149 | 'is-disabled': item.disabled |
| 150 | })} |
| 151 | {...events} |
| 152 | > |
| 153 | {item.label} |
| 154 | </li> |
| 155 | ); |
| 156 | }); |
| 157 | |
| 158 | let menuStyle = {}; |
| 159 | |
| 160 | if (isFlat) { |
| 161 | menuStyle.minWidth = this.inputWidth + 'px'; |
| 162 | } |
| 163 | |
| 164 | return ( |
| 165 | <ul key={menuIndex} className={this.classNames({ |
| 166 | 'el-cascader-menu': true, |
| 167 | 'el-cascader-menu--flexible': isFlat |
| 168 | })} style={menuStyle}> |
| 169 | {items} |
| 170 | </ul> |
| 171 | ); |
| 172 | }); |
| 173 | |
| 174 | return ( |
| 175 | <Transition name="el-zoom-in-top"> |
| 176 | <View show={visible}> |
nothing calls this directly
no test coverage detected