Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_react2["default"].Children.forEach(children, function (child) {
if (!child) {
return;
}
if (child.type.isSelectOptGroup) {
var innerItems = _this2.renderFilterOptionsFromChildren(child.props.children, childrenKeys, menuItems);
if (innerItems.length) {
var label = child.props.label;
var key = child.key;
if (!key && typeof label === 'string') {
key = label;
} else if (!label && key) {
label = key;
}
sel.push(_react2["default"].createElement(
_rcMenu.ItemGroup,
{ key: key, title: label },
innerItems
));
}
return;
}
(0, _warning2["default"])(child.type.isSelectOption, 'the children of `Select` should be `Select.Option` or `Select.OptGroup`, ' + ('instead of `' + (child.type.name || child.type.displayName || child.type) + '`.'));
var childValue = (0, _util.getValuePropValue)(child);
(0, _util.validateOptionValue)(childValue, _this2.props);
if (_this2.filterOption(inputValue, child)) {
var menuItem = _react2["default"].createElement(_MenuItem2["default"], _extends({
style: _util.UNSELECTABLE_STYLE,
_react2['default'].Children.forEach(children, function (child) {
if (!child) {
return;
}
if (child.type.isSelectOptGroup) {
var innerItems = _this2.renderFilterOptionsFromChildren(child.props.children, false);
if (innerItems.length) {
var label = child.props.label;
var key = child.key;
if (!key && typeof label === 'string') {
key = label;
} else if (!label && key) {
label = key;
}
sel.push(_react2['default'].createElement(
_rcMenu.ItemGroup,
{ key: key, title: label },
innerItems
));
}
return;
}
(0, _warning2['default'])(child.type.isSelectOption, 'the children of `Select` should be `Select.Option` or `Select.OptGroup`, ' + ('instead of `' + (child.type.name || child.type.displayName || child.type) + '`.'));
var childValue = (0, _util.getValuePropValue)(child);
if (_this2.filterOption(inputValue, child)) {
sel.push(_react2['default'].createElement(_rcMenu.Item, (0, _extends3['default'])({
style: _util.UNSELECTABLE_STYLE,
attribute: _util.UNSELECTABLE_ATTRIBUTE,
value: childValue,
key: childValue
_react2['default'].Children.forEach(menuItems, function (item) {
if (item.type === _rcMenu.ItemGroup) {
selectedKeys = selectedKeys.concat(getSelectKeys(item.props.children, value));
} else {
var itemValue = getValuePropValue(item);
var itemKey = item.key;
if (value.indexOf(itemValue) !== -1 && itemKey) {
selectedKeys.push(itemKey);
}
}
});
return selectedKeys;
clonedMenuItems = menuItems.map(function (item) {
if (item.type === _rcMenu.ItemGroup) {
var children = item.props.children.map(clone);
return (0, _react.cloneElement)(item, {}, children);
}
return clone(item);
});
})();
_react2['default'].Children.forEach(children, function (child) {
if (child.type === _OptGroup2['default']) {
var innerItems = _this.renderFilterOptionsFromChildren(child.props.children, false);
if (innerItems.length) {
var label = child.props.label;
var key = child.key;
if (!key && typeof label === 'string') {
key = label;
} else if (!label && key) {
label = key;
}
sel.push(_react2['default'].createElement(
_rcMenu.ItemGroup,
{ key: key, title: label },
innerItems
));
}
return;
}
var childValue = (0, _util.getValuePropValue)(child);
if (_this.filterOption(inputValue, child)) {
sel.push(_react2['default'].createElement(_rcMenu.Item, _extends({
style: _util.UNSELECTABLE_STYLE,
attribute: _util.UNSELECTABLE_ATTRIBUTE,
value: childValue,
key: childValue
}, child.props)));
}
if (tags && !child.props.disabled) {
menuProps.openTransitionName = menuOpenAnimation;
} else {
menuProps.openAnimation = menuOpenAnimation;
}
return _react2['default'].createElement(_rcMenu2['default'], (0, _extends3['default'])({}, this.props, menuProps));
}
}]);
return Menu;
}(_react2['default'].Component);
exports['default'] = Menu;
Menu.Divider = _rcMenu.Divider;
Menu.Item = _MenuItem2['default'];
Menu.SubMenu = _rcMenu.SubMenu;
Menu.ItemGroup = _rcMenu.ItemGroup;
Menu.defaultProps = {
prefixCls: 'ant-menu',
className: '',
theme: 'light'
};
Menu.childContextTypes = {
inlineCollapsed: _propTypes2['default'].bool
};
Menu.contextTypes = {
siderCollapsed: _propTypes2['default'].bool
};
module.exports = exports['default'];
menuProps.openTransitionName = menuOpenAnimation;
} else {
menuProps.openAnimation = menuOpenAnimation;
}
return _react2['default'].createElement(_rcMenu2['default'], (0, _extends3['default'])({}, this.props, menuProps));
}
}]);
return Menu;
}(_react2['default'].Component);
exports['default'] = Menu;
Menu.Divider = _rcMenu.Divider;
Menu.Item = _MenuItem2['default'];
Menu.SubMenu = _rcMenu.SubMenu;
Menu.ItemGroup = _rcMenu.ItemGroup;
Menu.defaultProps = {
prefixCls: 'ant-menu',
className: '',
theme: 'light'
};
Menu.childContextTypes = {
inlineCollapsed: _propTypes2['default'].bool
};
Menu.contextTypes = {
siderCollapsed: _propTypes2['default'].bool
};
module.exports = exports['default'];