Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const state = this.getStore().getState();
const props = this.props;
const key = getKeyFromChildrenIndex(child, props.eventKey, i);
const childProps = child.props;
const isActive = key === state.activeKey;
const newChildProps = {
mode: props.mode,
level: props.level,
inlineIndent: props.inlineIndent,
renderMenuItem: this.renderMenuItem,
rootPrefixCls: props.prefixCls,
index: i,
parentMenu: this,
// customized ref function, need to be invoked manually in child's componentDidMount
manualRef: childProps.disabled ? undefined :
createChainedFunction(child.ref, saveRef.bind(this, i, subIndex)),
eventKey: key,
active: !childProps.disabled && isActive,
multiple: props.multiple,
onClick: this.onClick,
onItemHover: this.onItemHover,
openTransitionName: this.getOpenTransitionName(),
openAnimation: props.openAnimation,
subMenuOpenDelay: props.subMenuOpenDelay,
subMenuCloseDelay: props.subMenuCloseDelay,
forceSubMenuRender: props.forceSubMenuRender,
onOpenChange: this.onOpenChange,
onDeselect: this.onDeselect,
onSelect: this.onSelect,
...extraProps,
};
if (props.mode === 'inline') {
const state = this.props.store.getState();
const props = this.props;
const key = getKeyFromChildrenIndex(child, props.eventKey, i);
const childProps = child.props;
const isActive = key === state.activeKey;
const newChildProps = {
mode: childProps.mode || props.mode,
level: props.level,
inlineIndent: props.inlineIndent,
renderMenuItem: this.renderMenuItem,
rootPrefixCls: props.prefixCls,
index: i,
parentMenu: props.parentMenu,
// customized ref function, need to be invoked manually in child's componentDidMount
manualRef: childProps.disabled ? undefined :
createChainedFunction(child.ref, saveRef.bind(this)),
eventKey: key,
active: !childProps.disabled && isActive,
multiple: props.multiple,
onClick: (e) => {
(childProps.onClick || noop)(e);
this.onClick(e);
},
onItemHover: this.onItemHover,
openTransitionName: this.getOpenTransitionName(),
openAnimation: props.openAnimation,
subMenuOpenDelay: props.subMenuOpenDelay,
subMenuCloseDelay: props.subMenuCloseDelay,
forceSubMenuRender: props.forceSubMenuRender,
onOpenChange: this.onOpenChange,
onDeselect: this.onDeselect,
onSelect: this.onSelect,
}
const isActive = key === state.activeKey;
const newChildProps: MenuItemProps &
MenuItemGroupProps &
SubPopupMenuProps = {
mode: childProps.mode || props.mode,
level: props.level,
inlineIndent: props.inlineIndent,
renderMenuItem: this.renderMenuItem,
rootPrefixCls: props.prefixCls,
index: i,
parentMenu: props.parentMenu,
// customized ref function, need to be invoked manually in child's componentDidMount
manualRef: childProps.disabled
? undefined
: (createChainedFunction(
(child as any).ref,
saveRef.bind(this),
) as LegacyFunctionRef),
eventKey: key,
active: !childProps.disabled && isActive,
multiple: props.multiple,
onClick: (e: MenuInfo) => {
(childProps.onClick || noop)(e);
this.onClick(e);
},
onItemHover: this.onItemHover,
motion: props.motion,
subMenuOpenDelay: props.subMenuOpenDelay,
subMenuCloseDelay: props.subMenuCloseDelay,
forceSubMenuRender: props.forceSubMenuRender,
onOpenChange: this.onOpenChange,
getCalendarElement = () => {
const props = this.props;
const state = this.state;
const calendarProps = props.calendar.props;
const { value } = state;
const defaultValue = value;
const extraProps = {
ref: this.saveCalendarRef,
defaultValue: defaultValue || calendarProps.defaultValue,
selectedValue: value,
onKeyDown: this.onCalendarKeyDown,
onOk: createChainedFunction(calendarProps.onOk, this.onCalendarOk),
onSelect: createChainedFunction(calendarProps.onSelect, this.onCalendarSelect),
onClear: createChainedFunction(calendarProps.onClear, this.onCalendarClear),
};
return React.cloneElement(props.calendar, extraProps);
}
getCalendarElement = () => {
const { props } = this;
const { state } = this;
const calendarProps = props.calendar.props;
const { value } = state;
const defaultValue = value;
const extraProps = {
ref: this.saveCalendarRef,
defaultValue: defaultValue || calendarProps.defaultValue,
selectedValue: value,
onKeyDown: this.onCalendarKeyDown,
onOk: createChainedFunction(calendarProps.onOk, this.onCalendarOk),
onSelect: createChainedFunction(calendarProps.onSelect, this.onCalendarSelect),
onClear: createChainedFunction(calendarProps.onClear, this.onCalendarClear),
onBlur: createChainedFunction(calendarProps.onBlur, this.onCalendarBlur),
};
return React.cloneElement(props.calendar, extraProps);
};
getCalendarElement = () => {
const { props } = this;
const { state } = this;
const calendarProps = props.calendar.props;
const { value } = state;
const defaultValue = value;
const extraProps = {
ref: this.saveCalendarRef,
defaultValue: defaultValue || calendarProps.defaultValue,
selectedValue: value,
onKeyDown: this.onCalendarKeyDown,
onOk: createChainedFunction(calendarProps.onOk, this.onCalendarOk),
onSelect: createChainedFunction(calendarProps.onSelect, this.onCalendarSelect),
onClear: createChainedFunction(calendarProps.onClear, this.onCalendarClear),
onBlur: createChainedFunction(calendarProps.onBlur, this.onCalendarBlur),
};
return React.cloneElement(props.calendar, extraProps);
};
const noticeNodes = notices.map((notice, index) => {
const update = Boolean(index === notices.length - 1 && notice.updateKey);
const key = notice.updateKey ? notice.updateKey : notice.key;
const onClose = createChainedFunction(this.remove.bind(this, notice.key), notice.onClose);
return (
{notice.content}
);
});
const className = {
getCalendarElement = () => {
const { props } = this;
const { state } = this;
const calendarProps = props.calendar.props;
const { value } = state;
const defaultValue = value;
const extraProps = {
ref: this.saveCalendarRef,
defaultValue: defaultValue || calendarProps.defaultValue,
selectedValue: value,
onKeyDown: this.onCalendarKeyDown,
onOk: createChainedFunction(calendarProps.onOk, this.onCalendarOk),
onSelect: createChainedFunction(calendarProps.onSelect, this.onCalendarSelect),
onClear: createChainedFunction(calendarProps.onClear, this.onCalendarClear),
onBlur: createChainedFunction(calendarProps.onBlur, this.onCalendarBlur),
};
return React.cloneElement(props.calendar, extraProps);
};
getCalendarElement = () => {
const props = this.props;
const state = this.state;
const calendarProps = props.calendar.props;
const { value } = state;
const defaultValue = value;
const extraProps = {
ref: this.saveCalendarRef,
defaultValue: defaultValue || calendarProps.defaultValue,
selectedValue: value,
onKeyDown: this.onCalendarKeyDown,
onOk: createChainedFunction(calendarProps.onOk, this.onCalendarOk),
onSelect: createChainedFunction(calendarProps.onSelect, this.onCalendarSelect),
onClear: createChainedFunction(calendarProps.onClear, this.onCalendarClear),
};
return React.cloneElement(props.calendar, extraProps);
}
getCalendarElement = () => {
const { props } = this;
const { state } = this;
const calendarProps = props.calendar.props;
const { value } = state;
const defaultValue = value;
const extraProps = {
ref: this.saveCalendarRef,
defaultValue: defaultValue || calendarProps.defaultValue,
selectedValue: value,
onKeyDown: this.onCalendarKeyDown,
onOk: createChainedFunction(calendarProps.onOk, this.onCalendarOk),
onSelect: createChainedFunction(calendarProps.onSelect, this.onCalendarSelect),
onClear: createChainedFunction(calendarProps.onClear, this.onCalendarClear),
onBlur: createChainedFunction(calendarProps.onBlur, this.onCalendarBlur),
};
return React.cloneElement(props.calendar, extraProps);
};