import { ReactFC } from '@formily/reactive-react' import { IconWidget, usePrefix } from '@pind/designable-react' import cls from 'classnames' import React, { useContext } from 'react' import './styles.less' export interface IInputItemsContext { width?: string | number vertical?: boolean } export interface IInputItemsProps { className?: string style?: React.CSSProperties width?: string | number vertical?: boolean } export interface IInputItemProps { className?: string style?: React.CSSProperties icon?: React.ReactNode width?: string | number vertical?: boolean title?: React.ReactNode } const InputItemsContext = React.createContext({}) const InternalInputItems: ReactFC = (props) => { const prefix = usePrefix('input-items') return (
{props.children}
) } const Item: ReactFC = (props) => { const prefix = usePrefix('input-items-item') const ctx = useContext(InputItemsContext) return (
{props.icon && (
)} {props.title &&
{props.title}
}
{props.children}
) } export const InputItems = Object.assign(InternalInputItems, { Item, }) InputItems.defaultProps = { width: '100%', }