forked from avallete/ag-grid-autocomplete-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
39 lines (35 loc) · 1.47 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { ICellEditorParams, PopupComponent } from '@ag-grid-community/core'
import { AutocompleteItem, EventTrigger } from './autocompleter/types'
export interface DataFormat extends AutocompleteItem {
value: number | string
label: string
group?: string
}
export type AutocompleteClient = DataFormat & AutocompleteItem
export interface IAutocompleterSettings<T extends AutocompleteItem, U extends PopupComponent> {
render?: (cellEditor: U, item: T, currentValue: string) => HTMLElement
renderGroup?: (cellEditor: U, name: string, currentValue: string) => HTMLElement
className?: string
minLength?: number
emptyMsg?: string
strict?: boolean
autoselectfirst?: boolean
onFreeTextSelect?: (cellEditor: U, item: T, input: HTMLInputElement) => void
onSelect?: (cellEditor: U, item: T | undefined, input: HTMLInputElement) => void
fetch?: (cellEditor: U, text: string, update: (items: T[] | false) => void, trigger?: EventTrigger) => void
debounceWaitMs?: number
showOnFocus?: boolean
customize?: (
cellEditor: U,
input: HTMLInputElement,
inputRect: ClientRect | DOMRect,
container: HTMLDivElement,
maxHeight: number
) => void
}
export interface IAutocompleteSelectCellEditorParameters<U extends PopupComponent> extends ICellEditorParams {
autocomplete?: IAutocompleterSettings<DataFormat, U>
selectData: Array<DataFormat> | ((parameters: IAutocompleteSelectCellEditorParameters<U>) => Array<DataFormat>)
placeholder?: string
required?: boolean
}