UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

65 lines (64 loc) 3.23 kB
import * as React from 'react'; import { ReactNode } from 'react'; export type ValueSelectorProps<OPTION_TYPE, ID_TYPE extends number | string> = { options: OPTION_TYPE[]; value: ID_TYPE[]; onChange: (selected: ID_TYPE[], selectedMap: Map<ID_TYPE, OPTION_TYPE>) => void; allowReorder?: boolean | ((option: OPTION_TYPE) => boolean); filter?: null | ((o: OPTION_TYPE, searchValue: string) => boolean); /** * To show the filter input, filter needs also to be defined. */ showFilterInput?: boolean; singleSelect?: boolean; toIdentifier: (v: OPTION_TYPE) => ID_TYPE; toLabel: (v: OPTION_TYPE) => string | React.ReactElement; /** * Used to render list items, this extra prop allows to have different rendering for list & bottom tags. */ toListLabel?: (v: OPTION_TYPE) => string | React.ReactElement; noSelectionLabel?: ReactNode; clearSelectionLabel?: ReactNode; showSelectedOnlyLabel?: ReactNode; showSelectedOnlyPosition?: 'floating' | 'top'; xSelectedLabel?: (count: number) => ReactNode; selectionBoxPosition?: 'top' | 'bottom'; onShowSelectedOnlyChange?: (selectedOnly: boolean) => void; isOptionDisabled?: (option: OPTION_TYPE) => boolean; disabled?: boolean; style?: React.CSSProperties; }; export declare function ValueSelector<OPTION_TYPE, ID_TYPE extends number | string>(props: ValueSelectorProps<OPTION_TYPE, ID_TYPE>): React.JSX.Element; export declare const renderSelectionSection: (props: { noSelectionLabel?: ValueSelectorProps<any, any>['noSelectionLabel']; clearSelectionLabel?: ValueSelectorProps<any, any>['clearSelectionLabel']; value: ValueSelectorProps<any, any>['value']; options: ValueSelectorProps<any, any>['options']; disabled?: ValueSelectorProps<any, any>['disabled']; isOptionDisabled?: ValueSelectorProps<any, any>['isOptionDisabled']; singleSelect?: ValueSelectorProps<any, any>['singleSelect']; toIdentifier: ValueSelectorProps<any, any>['toIdentifier']; toLabel: ValueSelectorProps<any, any>['toLabel']; onChange: ValueSelectorProps<any, any>['onChange']; xSelectedLabel?: ValueSelectorProps<any, any>['xSelectedLabel']; selectionBoxPosition?: ValueSelectorProps<any, any>['selectionBoxPosition']; onSelectAll: () => void; onClear: () => void; onClearOption: (id: any) => void; }) => React.JSX.Element; type ValueOptionsTagsProps<OPTION_TYPE, ID_TYPE extends number | string> = { style?: React.CSSProperties; options: OPTION_TYPE[]; value: ID_TYPE[]; selectedMap?: Map<ID_TYPE, OPTION_TYPE>; toLabel: ValueSelectorProps<OPTION_TYPE, ID_TYPE>['toLabel']; isOptionDisabled?: ValueSelectorProps<OPTION_TYPE, ID_TYPE>['isOptionDisabled']; toIdentifier: ValueSelectorProps<OPTION_TYPE, ID_TYPE>['toIdentifier']; renderLabel?: (label: string | React.ReactElement) => ReactNode; onChange?: ValueSelectorProps<OPTION_TYPE, ID_TYPE>['onChange']; readOnly?: boolean; allowWrap?: boolean; onClearOption?: (id: ID_TYPE) => void; }; export declare function ValueOptionsTags<OPTION_TYPE, ID_TYPE extends number | string>(props: ValueOptionsTagsProps<OPTION_TYPE, ID_TYPE>): React.JSX.Element; export {};