🐞 fix(#1000663#25#26#27): 修复销售统计页面的样式问题
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import React, { FC, MutableRefObject } from "react"
|
||||
import SelectSaleType from "../SelectSaleType"
|
||||
import SelectTimePicker from "../SelectTimePicker"
|
||||
import SelectMarketingDepartment from '../SelectMarketingDepartment'
|
||||
|
||||
|
||||
interface PropsType {
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
const GroupItem = [
|
||||
SelectMarketingDepartment.name,
|
||||
SelectSaleType.name,
|
||||
SelectTimePicker.name
|
||||
]
|
||||
|
||||
const SelectGroup: FC<PropsType> = (props: PropsType) => {
|
||||
const {children} = props
|
||||
|
||||
function handleChange(children,childEle) {
|
||||
return function (value: any){
|
||||
childEle.props.onChange(value)
|
||||
children.forEach((child)=>{
|
||||
child.ref?.current.closePopup()
|
||||
})
|
||||
}
|
||||
}
|
||||
function handleCloseOverlay(children) {
|
||||
return function (){
|
||||
children.forEach((child)=>{
|
||||
child.ref?.current.closePopup()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const renderChildren = () => {
|
||||
return React.Children.map(children, (child) => {
|
||||
const childEle = child as React.FunctionComponentElement<any>
|
||||
return React.cloneElement(childEle, {onChange: handleChange(children,childEle), onCloseOverlay: handleCloseOverlay(children)})
|
||||
})
|
||||
}
|
||||
return <>{renderChildren()}</>
|
||||
}
|
||||
export default SelectGroup
|
||||
Reference in New Issue
Block a user