Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var rest = omit(restProps, ['inputIcon']);
var prefixCls = getPrefixCls('select', customizePrefixCls);
var cls = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-lg"), size === 'large'), _defineProperty(_classNames, "".concat(prefixCls, "-sm"), size === 'small'), _defineProperty(_classNames, "".concat(prefixCls, "-show-arrow"), showArrow), _classNames), className);
var optionLabelProp = _this.props.optionLabelProp;
if (_this.isCombobox()) {
// children 带 dom ç»“æž„æ—¶ï¼Œæ— æ³•å¡«å…¥è¾“å…¥æ¡†
optionLabelProp = optionLabelProp || 'value';
}
var modeConfig = {
multiple: mode === 'multiple',
tags: mode === 'tags',
combobox: _this.isCombobox()
};
var finalRemoveIcon = removeIcon && (React.isValidElement(removeIcon) ? React.cloneElement(removeIcon, {
className: classNames(removeIcon.props.className, "".concat(prefixCls, "-remove-icon"))
}) : removeIcon) || React.createElement(Icon, {
type: "close",
className: "".concat(prefixCls, "-remove-icon")
});
var finalClearIcon = clearIcon && (React.isValidElement(clearIcon) ? React.cloneElement(clearIcon, {
className: classNames(clearIcon.props.className, "".concat(prefixCls, "-clear-icon"))
}) : clearIcon) || React.createElement(Icon, {
type: "close-circle",
theme: "filled",
className: "".concat(prefixCls, "-clear-icon")
});
var finalMenuItemSelectedIcon = menuItemSelectedIcon && (React.isValidElement(menuItemSelectedIcon) ? React.cloneElement(menuItemSelectedIcon, {
className: classNames(menuItemSelectedIcon.props.className, "".concat(prefixCls, "-selected-icon"))
}) : menuItemSelectedIcon) || React.createElement(Icon, {
type: "check",
export function safeMerge(objValue: any, srcValue: any) {
// don't merge arrays
if (_.isArray(srcValue) && _.isArray(objValue)) {
return srcValue;
}
// guards against traversing react elements which can cause cyclical recursion
// If we don't have this clause, lodash (as of 4.7.0) will attempt to
// deeply clone the react children, which is really freaking slow.
if (
isValidElement(srcValue) ||
(_.isArray(srcValue) && _.some(srcValue, isValidElement)) ||
(_.isArray(srcValue) && _.isUndefined(objValue))
) {
return srcValue;
}
}
isValidElement(element) {
return React.isValidElement(element);
}
const newChildren = Children.map(children, (child) => {
if (isValidElement(child)) {
return cloneElement(child, { blocked: openValid });
}
return child;
});
export const isValidFiberElement = (element: React.ReactElement) =>
typeof element === 'string' || typeof element === 'number' || React.isValidElement(element);
function renderValue(v: Value) {
if (v == null) return ''
if (typeof v === 'boolean') return v ? 'yes' : 'no'
if (React.isValidElement(v)) return v
if (Array.isArray(v)) return renderInfo(v)
if (v instanceof Uint8Array) return hexDump(v)
if (typeof v === 'object') return renderInfo(v)
return String(v)
}
getRenderType = () => {
const { render, children } = this.props;
if (isFunction(render)) {
return 'renderProp';
}
if (isFunction(children)) {
return 'childFunction';
}
if (isValidElement(children)) {
return 'child';
}
if (Array.isArray(children)) {
return 'childArray';
}
return 'parent';
};
function renderContent(content: ContentType, props: Props) {
if (React.isValidElement(content)) {
return React.cloneElement(content, props);
} if (_.isFunction(content)) {
return content(props);
}
return
};