* TP-74739|basic layout,popper|varshitha * TP-74739|cobntroller added|varshitha * TP-74739|validations added|varshitha * TP-74739|custom copy dropdown|varshitha * TP-74739|others fix|varshitha * TP-74739|validate api added|varshitha * TP-74739|globalAccess|varshitha * TP-74739|contract changes|varshitha * TP-74739|slice changes|varshitha * TP-74739|error msg changes|varshitha * TP-74739|fixes|varshitha * TP-74739|integration fixes|varshitha * TP-74739|cross option requirement,dropdown fix|varshitha * TP-74739|more validations added,retain dropdown state|varshitha * TP-74739|code cleanup|varshitha * TP-74739|webui update|varshitha
75 lines
2.0 KiB
TypeScript
75 lines
2.0 KiB
TypeScript
import { ComponentPropsWithRef } from 'react';
|
|
|
|
export interface IOption {
|
|
value: string;
|
|
label: string;
|
|
additionalData?: any;
|
|
}
|
|
|
|
export interface IAutoCompleteProps extends ComponentPropsWithRef<'input'> {
|
|
options: IOption[];
|
|
selectedOptions: IOption[];
|
|
containerClasses?: string;
|
|
showLoader?: boolean;
|
|
maxSelectedChipToShow?: number;
|
|
error?: string;
|
|
maxOptionsToSelect?:
|
|
| number
|
|
| {
|
|
count: number;
|
|
message: string;
|
|
};
|
|
disabled?: boolean;
|
|
onSearch: (searchTerm: string) => void;
|
|
onSelectionChange: (selectedOptions: IOption[]) => void;
|
|
customOptionTemplate?: (option: IOption) => React.ReactNode;
|
|
}
|
|
|
|
export interface ISingleAutocompleteDropdown extends ComponentPropsWithRef<'input'> {
|
|
options: IOption[];
|
|
selectedOption: string | number;
|
|
containerClasses?: string;
|
|
error?: string;
|
|
disabled?: boolean;
|
|
sortOptions?: boolean;
|
|
hideCloseOption?: boolean;
|
|
showSearchIcon?: boolean;
|
|
enableFuzzySearch?: boolean;
|
|
notFoundCopy?: string;
|
|
fuzzySearchAdditionalKeys?: string[];
|
|
customOptionsContainer?: string;
|
|
onSearch?: (searchTerm: string) => void;
|
|
onSelectionChange: (selectedOptions: IOption | null) => void;
|
|
customOptionTemplate?: (option: IOption) => React.ReactNode;
|
|
customSortFunction?: (a: IOption, b: IOption) => number;
|
|
}
|
|
|
|
export interface IOptionsList {
|
|
options: IOption[];
|
|
showLoader?: boolean;
|
|
isMultiSelect?: boolean;
|
|
onOptionClick: (option: IOption) => void;
|
|
isOptionSelected: (option: IOption) => boolean;
|
|
optionTemplate?: (option: IOption) => React.ReactNode;
|
|
notFoundCopy?: string;
|
|
customOptionsContainer?: string;
|
|
}
|
|
|
|
export interface ISelectedOptions {
|
|
selectedOptions: IOption[];
|
|
maxSelectedChipToShow?: number;
|
|
disabled?: boolean;
|
|
onOptionClick: (option: IOption) => void;
|
|
}
|
|
|
|
export interface ISelectedOptionChip {
|
|
option: IOption;
|
|
onOptionClick: (option: IOption) => void;
|
|
}
|
|
|
|
export enum InputStates {
|
|
DEFAULT = 'DEFAULT',
|
|
ACTIVE = 'ACTIVE',
|
|
ERROR = 'ERROR'
|
|
}
|