UNPKG

@adaptabletools/adaptable

Version:

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

95 lines (94 loc) 3.98 kB
import { ComboboxPrimitive } from '../ui/combobox'; export type ComboboxItemType = { label: React.ReactNode; /** * Plain-text fallback used for the input display and filtering. * Required when `label` is a ReactNode (not a string). */ textLabel?: string; value: any; disabled?: boolean; }; export declare function getItemTextLabel<T extends ComboboxItemType>(item: T & { tooltip?: string; }): string; export type ComboboxGroupType<T extends ComboboxItemType> = { label: React.ReactNode; items: T[]; }; export type ComboboxDataProps<T extends ComboboxItemType> = { items: T[]; groups?: never; } | { groups: ComboboxGroupType<T>[]; items?: never; }; export type ComboboxCommonProps<T extends ComboboxItemType> = { 'data-name'?: string; 'aria-label'?: string; ariaLabel?: string; isLoading?: boolean; isCreatable?: boolean; inputValue?: string; defaultInputValue?: string; onInputValueChange?: (value: string) => void; open?: boolean; defaultOpen?: boolean; onOpenChange?: (open: boolean) => void; onFocus?: () => void; onBlur?: () => void; virtualized?: boolean; /** * When true, each item is wrapped in a `Tooltip` showing its plain-text label * on hover. Useful when labels can be truncated. Defaults to the value of `virtualized`. */ showItemTooltip?: boolean; showSelectAllCheckbox?: boolean; renderItemLabel?: (defaultLabel: React.ReactNode, item: T) => React.ReactNode; multiple?: boolean; showClear?: boolean; clearOnEscape?: boolean; searchable?: boolean | 'inline' | 'menulist'; /** * Only applies when `searchable === 'menulist'` and the search input is * uncontrolled (no `inputValue` prop): when true, the text typed in the * in-popup search input survives closing the popup, so reopening it shows * the list filtered by the previous query. Defaults to false — the filter * is cleared on close and every open starts from the full list. */ persistFilterOnReopen?: boolean; /** * Custom filter function, or `null` to disable built-in filtering * (e.g. when options are already filtered server-side). */ filter?: ((value: T, inputValue: string) => boolean) | null; /** * When true, the dropdown list can be resized by dragging its edges. * Resized dimensions persist for the lifetime of the component instance. */ resizable?: boolean; disabled?: boolean; value?: T['value'] | T['value'][]; defaultValue?: T['value'] | T['value'][]; onValueChange?: (value: T['value'] | T['value'][], item: T | T[] | undefined) => void; className?: string; /** Popup panel (portaled). */ contentClassName?: string; /** Menulist search field; defaults to `className` when omitted. */ searchInputClassName?: string; emptyText?: React.ReactNode; placeholder?: string; /** * Optional content rendered to the right of the in-popup search input * (applies when `searchable === 'menulist'`). Useful for adding per-list * controls such as an Expand All / Collapse All toggle for a tree. */ renderSearchInputTrailing?: React.ReactNode | (() => React.ReactNode); renderCheckboxIndicator?: boolean | null | ComboboxPrimitive.ItemIndicator.Props['render']; showTrigger?: boolean; }; export type AdaptableComboboxProps<T extends ComboboxItemType> = ComboboxCommonProps<T> & ComboboxDataProps<T>; export declare function valueToItem<T extends ComboboxItemType>(stringValue: T['value'] | undefined | null, lookup: Map<any, T>): T | undefined; export declare function valueToItems<T extends ComboboxItemType>(stringValues: T['value'][] | undefined | null, lookup: Map<any, T>): T[] | undefined; export declare function toStringValue<T extends ComboboxItemType>(item: T | null): any; export declare function toStringValues<T extends ComboboxItemType>(items: T[]): any[];