@gpa-gemstone/react-interactive
Version:
Interactive UI Components for GPA products
72 lines (71 loc) • 2.22 kB
TypeScript
import * as React from 'react';
interface IProps<T> {
/**
* List of available fields to be searched/filtered by
*/
CollumnList: Search.IField<T>[];
/**
* Setter to set filters
* @param filters current filters
* @returns
*/
SetFilter: (filters: Search.IFilter<T>[]) => void;
/**
* Optional default column to be used for searching via the input box
*/
defaultCollumn?: Search.IField<T>;
/**
* Optional direction to control where filter popover is placed
*/
Direction?: 'left' | 'right';
/**
* Optional width to be used on the search bar
*/
Width?: string | number;
/**
* Optional label to used for search filter
*/
Label?: string;
/**
* Optional function used to populate enum-type filter options dynamically, will be called when enum filter is being added or edited.
*/
GetEnum?: EnumSetter<T>;
/**
* Optional flag to render a loading icon in quick search input box
*/
ShowLoading?: boolean;
/**
* Optional note to be used under quick search input
*/
ResultNote?: string;
/**
* If provided, component stores and loads filters to/from localStorage using this key
*/
StorageID?: string;
}
interface IOptions {
Value: string;
Label: string;
}
type EnumSetter<T> = (setOptions: (options: IOptions[]) => void, field: Search.IField<T>) => () => void;
export declare namespace Search {
type FieldType = ('string' | 'number' | 'enum' | 'integer' | 'datetime' | 'boolean' | 'date' | 'time' | "query");
interface IField<T> {
label: string;
key: string;
type: FieldType;
enum?: IOptions[];
isPivotField: boolean;
}
type OperatorType = ('=' | '<>' | '>' | '<' | '>=' | '<=' | 'LIKE' | 'NOT LIKE' | 'IN' | 'NOT IN');
interface IFilter<T> {
FieldName: string;
SearchText: string;
Operator: Search.OperatorType;
Type: Search.FieldType;
IsPivotColumn: boolean;
}
}
export default function SearchBar<T>(props: React.PropsWithChildren<IProps<T>>): JSX.Element;
export declare const GetStoredFilters: (storageID: string) => any[];
export {};