import { Component, createRef, ReactNode } from "react"; import { FontLevel, Theme } from "@Component/Theme/Theme"; import { PickerList, IDisplayItem } from "../PickerList/PickerList"; import { AllI18nKeys, Localization } from "@Component/Localization/Localization"; import { Icon } from "@fluentui/react"; import "./ComboInput.scss"; interface IComboInputProps { keyI18n: AllI18nKeys; infoI18n?: AllI18nKeys; allOption?: IDisplayItem[]; value?: IDisplayItem; valueChange?: (value: IDisplayItem) => any; } interface IComboInputState { isPickerVisible: boolean; } class ComboInput extends Component { public constructor(props: IComboInputProps) { super(props); this.state = { isPickerVisible: false } } private pickerTarget = createRef(); private renderPicker() { return { return item.key === this.props.value?.key ? {...item, mark: true} : item; })} clickDisplayItems={((item) => { if (this.props.valueChange) { this.props.valueChange(item); } this.setState({ isPickerVisible: false }) })} dismiss={() => { this.setState({ isPickerVisible: false }) }} /> } public render(): ReactNode { return <>
{ this.setState({ isPickerVisible: true }) }} >
{ this.props.value ? : null }
{this.state.isPickerVisible ? this.renderPicker(): null} } } export { ComboInput, IDisplayItem };