import React, { Component, createRef, FC, HTMLAttributes } from 'react' import { FunctionSetData, FunctionSetProps } from './types' import { Popover } from '../popover' import Overlay from './overlay' import { Button } from '../button' import { getLocale } from '@gm-pc/locales' import { IconDownUp } from '../icon_down_up' import { ConfigConsumer, ConfigProvider } from '../config_provider' interface InnerProps extends HTMLAttributes { disabled: boolean } const Inner: FC = ({ disabled, className, children, ...rest }) => { return (
{children ?? ( )}
) } interface DefaultProps { disabled: boolean active: boolean } const Default: FC = ({ disabled, active }) => { return ( ) } class FunctionSet extends Component { private _popoverRef = createRef() public apiDoSetActive = (active?: boolean): void => { this._popoverRef.current!.apiDoSetActive(active) } private _handleSelect = (select: FunctionSetData): void => { if (!select.onClick) { return } this._popoverRef.current!.apiDoSetActive() select.onClick() } render() { const { data, right, disabled, children } = this.props const newData = data.filter((value) => value.show !== false) if (!newData.length) { return null } return ( {(config) => ( } right={right} type='hover' disabled={disabled} pureContainer > {children} )} ) } } export default FunctionSet