48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
export type KbxLookupColumnSource =
|
|
| 'code'
|
|
| 'displayName'
|
|
| 'secondaryText'
|
|
| 'status'
|
|
| `metadata.${string}`
|
|
|
|
export interface KbxLookupColumnDefinition {
|
|
key: string
|
|
label: string
|
|
source: KbxLookupColumnSource
|
|
width?: number
|
|
align?: 'left' | 'center' | 'right'
|
|
}
|
|
|
|
export interface KbxLookupDefinition {
|
|
entity: string
|
|
columns?: KbxLookupColumnDefinition[]
|
|
pageSize?: number
|
|
}
|
|
|
|
export interface KbxLookupItem<TId = string> {
|
|
id: TId
|
|
code: string
|
|
displayName: string
|
|
secondaryText?: string
|
|
status?: string
|
|
metadata?: Record<string, unknown>
|
|
}
|
|
|
|
export interface KbxLookupSearchRequest {
|
|
query?: string
|
|
page: number
|
|
pageSize: number
|
|
filters?: Record<string, unknown>
|
|
}
|
|
|
|
export interface KbxLookupSearchResult<TId = string> {
|
|
items: KbxLookupItem<TId>[]
|
|
totalCount: number
|
|
}
|
|
|
|
export interface KbxLookupProvider<TId = string> {
|
|
search(request: KbxLookupSearchRequest): Promise<KbxLookupSearchResult<TId>>
|
|
resolveById(id: TId): Promise<KbxLookupItem<TId> | null>
|
|
resolveByCode(code: string): Promise<KbxLookupItem<TId> | null>
|
|
}
|