@kronscht/former
Version:
Former is an Angular library that provides a declarative way to generate complex forms based on primeng components
75 lines (74 loc) • 2.87 kB
TypeScript
import { ElementType } from '../former.enum';
import { Observable } from 'rxjs';
import { BaseElement, DisableElement } from '../former.model';
import { AutoCompleteCompleteEvent } from 'primeng/autocomplete';
import { ScrollerOptions } from 'primeng/api';
export type FilterProvider = LocalFilterProvider | RemoteFilterProvider;
export interface LocalFilterProvider {
local: (event: AutoCompleteCompleteEvent, data: any[], field?: string) => any[];
}
export interface RemoteFilterProvider {
remote: string;
}
export declare function isRemoteFilterProvider(value: FilterProvider): value is RemoteFilterProvider;
export declare function isLocalFilterProvider(value: FilterProvider): value is LocalFilterProvider;
export type Suggestions = StaticSuggestions | ObservableSuggestions | RemoteSuggestions;
export interface RemoteSuggestions {
remote: string;
}
export interface StaticSuggestions {
static: any[];
}
export interface ObservableSuggestions {
observable: Observable<any[]>;
}
/**
* Checks, if the suggestion are remote suggestion, i.e. loaded by a specific REST endpoint
*/
export declare function isRemoteSuggestions(value: Suggestions): value is RemoteSuggestions;
/**
* Checks, if the suggestions are static suggestions, i.e. an array of plain strings or complex objects
* @param value
*/
export declare function isStaticSuggestions(value: Suggestions): value is StaticSuggestions;
/**
* Checks, if the suggestions are observable suggestions, i.e. suggestions provided by an observable as an array of plain strings or complex objects
* @param value
*/
export declare function isObservableSuggestions(value: Suggestions): value is ObservableSuggestions;
export interface AutoCompleteElement extends BaseElement, DisableElement {
type: ElementType.AutocompleteElement;
suggestions: Suggestions;
field?: string;
filter?: FilterProvider;
width?: string;
options?: AutoCompleteOptions;
}
export interface AutoCompleteOptions {
minLength?: number;
delay?: number;
style?: Record<string, any> | null | undefined;
panelStyle?: Record<string, any> | null | undefined;
styleClass?: string | undefined;
panelStyleClass?: string | undefined;
inputStyle?: Record<string, any> | null | undefined;
inputId?: string | undefined;
inputStyleClass?: string | undefined;
placeholder?: string | undefined;
readonly?: boolean | undefined;
disabled?: boolean | undefined;
scrollHeight?: string;
lazy?: boolean;
virtualScroll?: ScrollerOptions | undefined;
virtualScrollItemSize?: number;
virtualScrollOptions?: ScrollerOptions | undefined;
maxLength?: number | undefined;
name?: string;
size?: number;
appendTo?: any;
autoHighlight?: boolean;
forceSelection?: boolean;
type?: string;
autoZIndex?: boolean;
baseZIndex?: boolean;
}