🌈 style(eslint): add eslint rules
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import React, { FC, MutableRefObject } from "react"
|
||||
import SelectSaleType from "../SelectSaleType"
|
||||
import SelectTimePicker from "../SelectTimePicker"
|
||||
import type { FC } from 'react'
|
||||
import React, { MutableRefObject } from 'react'
|
||||
import SelectSaleType from '../SelectSaleType'
|
||||
import SelectTimePicker from '../SelectTimePicker'
|
||||
import SelectMarketingDepartment from '../SelectMarketingDepartment'
|
||||
|
||||
|
||||
interface PropsType {
|
||||
children?: React.ReactNode
|
||||
}
|
||||
@@ -11,23 +11,23 @@ interface PropsType {
|
||||
const GroupItem = [
|
||||
SelectMarketingDepartment.name,
|
||||
SelectSaleType.name,
|
||||
SelectTimePicker.name
|
||||
SelectTimePicker.name,
|
||||
]
|
||||
|
||||
const SelectGroup: FC<PropsType> = (props: PropsType) => {
|
||||
const {children} = props
|
||||
const { children } = props
|
||||
|
||||
function handleChange(children,childEle) {
|
||||
return function (value: any){
|
||||
function handleChange(children, childEle) {
|
||||
return function(value: any) {
|
||||
childEle.props.onChange(value)
|
||||
children.forEach((child)=>{
|
||||
children.forEach((child) => {
|
||||
child.ref?.current.closePopup()
|
||||
})
|
||||
}
|
||||
}
|
||||
function handleCloseOverlay(children) {
|
||||
return function (){
|
||||
children.forEach((child)=>{
|
||||
return function() {
|
||||
children.forEach((child) => {
|
||||
child.ref?.current.closePopup()
|
||||
})
|
||||
}
|
||||
@@ -36,7 +36,7 @@ const SelectGroup: FC<PropsType> = (props: PropsType) => {
|
||||
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 React.cloneElement(childEle, { onChange: handleChange(children, childEle), onCloseOverlay: handleCloseOverlay(children) })
|
||||
})
|
||||
}
|
||||
return <>{renderChildren()}</>
|
||||
|
||||
Reference in New Issue
Block a user