Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Select<Key, Item>

Type parameters

Hierarchy

Index

Constructors

constructor

Properties

context

filterOptions

filterOptions: (keyword: string, options?: Item[], filter: false | ((keyword: string, item: Item) => boolean), creatable: boolean, isValidNewOption: (keyword: string, options: Item[]) => boolean, value: Item | Item[]) => Item[] = ...

Type declaration

    • (keyword: string, options?: Item[], filter: false | ((keyword: string, item: Item) => boolean), creatable: boolean, isValidNewOption: (keyword: string, options: Item[]) => boolean, value: Item | Item[]): Item[]
    • Parameters

      • keyword: string
      • options: Item[] = []
      • filter: false | ((keyword: string, item: Item) => boolean)
      • creatable: boolean
      • isValidNewOption: (keyword: string, options: Item[]) => boolean
          • (keyword: string, options: Item[]): boolean
          • Parameters

            • keyword: string
            • options: Item[]

            Returns boolean

      • value: Item | Item[]

      Returns Item[]

inputRef

inputRef: RefObject<HTMLInputElement> = ...

onKeywordChange

onKeywordChange: ChangeEventHandler<HTMLInputElement> = ...

popoverRef

popoverRef: RefObject<Popover> = ...

Readonly props

props: Readonly<ISelectMultiProps<Key, Item>> & Readonly<{ children?: ReactNode }> & Readonly<ISelectSingleProps<Key, Item>> & Readonly<{ children?: ReactNode }>

refs

refs: {}

Type declaration

  • [key: string]: ReactInstance

renderOption

renderOption: IOptionRenderer<Key, Item> = ...

state

state: Readonly<ISelectState<Key, Item>>

triggerRef

triggerRef: RefObject<HTMLDivElement> = ...

Static contextType

contextType: Context<IDisabledContext> = ...

Static defaultProps

defaultProps: { clearable: boolean; creatable: boolean; filter: <Key, Item>(keyword: string, option: Item) => boolean; highlight: <Key, Item>(keyword: string, option: Item) => React.ReactNode; isEqual: <Key, Item>(a: Item, b: Item) => boolean; isValidNewOption: <Key>(keyword: string, options: ISelectItem<Key>[]) => boolean; loading: boolean; multiple: boolean; renderOptionList: <Key, Item>(options: Item[], renderOption: IOptionRenderer<Key, Item>) => ReactNode[]; size: string } = ...

Type declaration

  • clearable: boolean
  • creatable: boolean
  • filter: <Key, Item>(keyword: string, option: Item) => boolean
      • <Key, Item>(keyword: string, option: Item): boolean
      • Type parameters

        Parameters

        • keyword: string
        • option: Item

        Returns boolean

  • highlight: <Key, Item>(keyword: string, option: Item) => React.ReactNode
      • <Key, Item>(keyword: string, option: Item): React.ReactNode
      • Type parameters

        Parameters

        • keyword: string
        • option: Item

        Returns React.ReactNode

  • isEqual: <Key, Item>(a: Item, b: Item) => boolean
      • <Key, Item>(a: Item, b: Item): boolean
      • Type parameters

        Parameters

        • a: Item
        • b: Item

        Returns boolean

  • isValidNewOption: <Key>(keyword: string, options: ISelectItem<Key>[]) => boolean
      • <Key>(keyword: string, options: ISelectItem<Key>[]): boolean
      • Type parameters

        • Key: string | number = string | number

        Parameters

        Returns boolean

  • loading: boolean
  • multiple: boolean
  • renderOptionList: <Key, Item>(options: Item[], renderOption: IOptionRenderer<Key, Item>) => ReactNode[]
      • <Key, Item>(options: Item[], renderOption: IOptionRenderer<Key, Item>): ReactNode[]
      • Type parameters

        Parameters

        Returns ReactNode[]

  • size: string

Static reviveValue

reviveValue: <K>(reviver: K | { key: K } | ISelectItem<K>["reviver"]) => ISelectItem<K> = ...

Type declaration

Accessors

disabled

  • get disabled(): boolean

Methods

Optional UNSAFE_componentWillMount

  • UNSAFE_componentWillMount(): void

Optional UNSAFE_componentWillReceiveProps

  • UNSAFE_componentWillReceiveProps(nextProps: Readonly<ISelectProps<Key, Item>>, nextContext: any): void

Optional UNSAFE_componentWillUpdate

  • UNSAFE_componentWillUpdate(nextProps: Readonly<ISelectProps<Key, Item>>, nextState: Readonly<ISelectState<Key, Item>>, nextContext: any): void

Optional componentDidCatch

  • componentDidCatch(error: Error, errorInfo: ErrorInfo): void
  • Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.

    Parameters

    • error: Error
    • errorInfo: ErrorInfo

    Returns void

componentDidMount

  • componentDidMount(): void

componentDidUpdate

  • componentDidUpdate(prevProps: ISelectProps<Key, Item>): void

Optional componentWillMount

  • componentWillMount(): void

Optional componentWillReceiveProps

  • componentWillReceiveProps(nextProps: Readonly<ISelectProps<Key, Item>>, nextContext: any): void

Optional componentWillUnmount

  • componentWillUnmount(): void
  • Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.

    Returns void

Optional componentWillUpdate

  • componentWillUpdate(nextProps: Readonly<ISelectProps<Key, Item>>, nextState: Readonly<ISelectState<Key, Item>>, nextContext: any): void

focusSearchInput

  • focusSearchInput(): void

forceUpdate

  • forceUpdate(callback?: () => void): void
  • Parameters

    • Optional callback: () => void
        • (): void
        • Returns void

    Returns void

getSearchPlaceholder

  • getSearchPlaceholder(): string

Optional getSnapshotBeforeUpdate

  • getSnapshotBeforeUpdate(prevProps: Readonly<ISelectProps<Key, Item>>, prevState: Readonly<ISelectState<Key, Item>>): any
  • Runs before React applies the result of render to the document, and returns an object to be given to componentDidUpdate. Useful for saving things such as scroll position before render causes changes to it.

    Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.

    Parameters

    Returns any

globalClick

  • globalClick(e: MouseEvent): void

onClear

  • onClear(e: MouseEvent<Element, MouseEvent>): void

onCreateClick

  • onCreateClick(): void

onIndexChange

  • onIndexChange(delta: 1 | -1): void

onOptionMouseEnter

  • onOptionMouseEnter(index: number): void

onOptionMouseLeave

  • onOptionMouseLeave(index: number): void

onRemove

  • onRemove(item: Item): void

onSelect

  • onSelect(item: Item): void

onVisibleChange

  • onVisibleChange(open: boolean): void

render

  • render(): Element

renderPopoverContent

renderTagCollapsedTrigger

  • renderTagCollapsedTrigger(value: Item[]): Element

renderTagList

renderValue

resetKeyword

  • resetKeyword(source: "user-clear" | "user-change" | "popup-close" | "option-create"): void

selectCurrentIndex

  • selectCurrentIndex(): void

setKeyword

  • setKeyword(keyword: string, source: "user-clear" | "user-change" | "popup-close" | "option-create"): void

setState

  • Type parameters

    Parameters

    Returns void

Optional shouldComponentUpdate

  • shouldComponentUpdate(nextProps: Readonly<ISelectProps<Key, Item>>, nextState: Readonly<ISelectState<Key, Item>>, nextContext: any): boolean
  • Called to determine whether the change in props and state should trigger a re-render.

    Component always returns true. PureComponent implements a shallow comparison on props and state and returns true if any props or states have changed.

    If false is returned, Component#render, componentWillUpdate and componentDidUpdate will not be called.

    Parameters

    Returns boolean

tryReviveOption

Static getDerivedStateFromProps

Generated using TypeDoc