UNPKG

@gpa-gemstone/react-forms

Version:
51 lines (50 loc) 2.08 kB
import { IProps as ISearchableSelectProps } from './SearchableSelect'; import { Gemstone } from '@gpa-gemstone/application-typings'; interface IProps<T> extends Omit<ISearchableSelectProps<T>, 'Valid' | 'Feedback' | 'GetLabel' | 'Setter' | 'Search'> { /** * Default value to use when adding an item and when value is null * @type {number} */ DefaultValue: number | string; /** * Function to determine the validity of a field * @param field - Field of the record to check * @returns {boolean} */ ItemValid?: (value: string | number, index: number, arr: Array<string | number>) => boolean; /** * Feedback message to show when input is invalid * @type {string} * @optional */ ItemFeedback?: (value: string | number, index: number, arr: Array<string | number>) => string | undefined; /** * */ GetLabel?: (value: string | number | null, index: number) => Gemstone.TSX.Interfaces.AbortablePromise<string>; /** * Flag to disable add button */ DisableAdd?: boolean; /** * Flag to disable all input fields */ Disabled?: boolean; /** * Setter function to update the Record * @param record - Updated Record * @param index - Index in array field updated * @param selectedOption - Option selected for the update */ Setter: (record: T, index: number, selectedOption?: Gemstone.TSX.Interfaces.ILabelValue<string | number>) => void; /** * Function to perform a search and return a promiselike object with a list of IOption and an optional callback * @param search - Search string * @param value - Current value of the field being updated * @param index - Index in array field being updated * @returns {AbortablePromise<T>} */ Search: (search: string, value: string | number, index: number) => Gemstone.TSX.Interfaces.AbortablePromise<Gemstone.TSX.Interfaces.ILabelValue<string | number>[]>; } declare function MultiSearchableSelect<T>(props: IProps<T>): JSX.Element; export default MultiSearchableSelect;