UNPKG

@docsvision/webclient

Version:

Type definitions for DocsVision WebClient scripts and extensions.

90 lines (89 loc) 4.55 kB
/// <reference types="react" /> import { IBoxWithButtonsButtonInfo } from "@docsvision/webclient/Helpers/BoxWithButtons"; import { ITypeaheadSearchQuery } from "@docsvision/webclient/Helpers/Typeahead/Models/ITypeaheadSearchQuery"; import { ITypeaheadSearchResult } from "@docsvision/webclient/Helpers/Typeahead/Models/ITypeaheadSearchResult"; import { ITypeaheadVariant } from "@docsvision/webclient/Helpers/Typeahead/Models/ITypeaheadVariant"; import { Typeahead } from "@docsvision/webclient/Helpers/Typeahead/Typeahead"; import { BasicApiEvent } from "@docsvision/webclient/System/ApiEvent"; import { BasicEvent } from "@docsvision/webclient/System/BasicEvent"; /** @internal */ export interface ITypeaheadProps { /** Curreint input value. */ searchText: string; /** Event, that translate input key down events */ inputKeyDown: BasicEvent<React.KeyboardEvent<any>> | BasicApiEvent<React.KeyboardEvent<any>>; /** Function, that send search request to the server. */ findItems: (query: ITypeaheadSearchQuery) => Promise<ITypeaheadSearchResult>; /** User selected some variant. */ onSelected: (selectedVariant: ITypeaheadVariant) => void; /** Makes control readonly */ disabled?: boolean; /** Callback function, that should focus input. */ focusInput?: Function; /** Callback function, that handler OnMouseDownEvent. */ onMouseDown?: Function; /** How many symbols should user enter, before search request will be sent. Default value: 3 */ searchIndex?: number; /** How often should send search requests, while user entereing text. Time interval in ms. Default value: 500ms. */ searchTimeout?: number; /** Count of items shown, before 'show more' clicked. Default value: 8 */ firstPageSize?: number; /** Count of items, loaded when user clicked 'show more' button. Default value 15 */ nextPageSize?: number; /** Show clear button, or not. Default value: true */ clearButton?: boolean; /** Show 'show variants' button, or not. Default value: false */ showVariantsButton?: boolean; /** Custom class for show variants button. Default value: dv-ico ico-arrow-down */ showVariantsButtonIconClass?: string; /** Special text, that will be sent in search query when requested all available results. Default value: null */ showAllSearchText?: string; /** Should send special text in search query when requested all available results (for example, down arrow keydown). Default value: false */ showAllEnabled?: boolean; /** How loading queries should be performed. Default value: LoadOnlyNewItems */ paginatorLoadLogic?: PaginatorLoadLogic; /** Some extra buttons info, that would be showed at the right side of the control */ extraButtons?: IBoxWithButtonsButtonInfo[]; /** Some buttons info, that would be showed at the left side of the control */ leftButtons?: IBoxWithButtonsButtonInfo[]; /** Additional class for the control */ optionButtonsClassName?: string; /** Show buttons inside the box with absolute positioning. Defautl value: false */ buttonsInside?: boolean; /** Tooltip */ title?: string; /** Value of TabIndex for Tab navigation. */ tabIndex?: number; /** Custom class for the control */ className?: string; /** Custom class for the popover panel (wich is outside of the DOM). */ popoverClassName?: string; /** Custom attributes for the popover panel (wich is outside of the DOM). */ popoverAttributes?: object; /** Control name, for the autotesting purposes */ name?: string; /** External state for autorefresh cached data */ externalState?: any; /** Top most part of popover, that alway will be visible. */ popoverHeader?: React.ReactNode; /** Selector, wich determine elements to ignore clicks on. */ ignoreClicksUnder?: string; /** Minimum width */ minWidth?: string; /** Minimum distance to screen borders in pixels. */ screenPadding?: number; /** Called on open/close dropdown. */ onDropdownStateChanged?: (sender: Typeahead) => void; /** Callback after open dropdown. */ afterOpenCallback?: () => void; /** Hide the pop-up if it crossed the padding */ hideIfBehindPadding?: boolean; /** Function when clicking on the icon in edit in place mode */ onIconMouseDown?: () => void; /** Need to highlight search result */ highlightSearchResult?: boolean; } export declare enum PaginatorLoadLogic { LoadOnlyNewItems = 0, LoadAllItems = 1 }