@croz/nrich-registry-mui
Version:
Contains the UI implementation of registry for the MUI component library
127 lines (120 loc) • 4.05 kB
TypeScript
import { SearchParameter, FormType, RegistryResponse, EntityRegistryRequest } from '@croz/nrich-registry-core';
/**
* {@link RegistryEntity} properties
*/
interface Props$3 {
/**
* Name of the registry entity
*/
entityName: string;
}
/**
* Component that manages full administration for single registry entity. Includes table with paging and filtering, adding, editing
* and deleting entities.
* @param entityName Name of administered registry entity
*/
declare const RegistryEntity: ({ entityName }: Props$3) => JSX.Element;
/**
* {@link RegistryEntityPicker} properties
*/
interface Props$2 {
/**
* Currently picked entity name
*/
value: string;
/**
* Change handler for entity
* @param newValue
*/
setValue: (newValue: string) => void;
}
/**
* Simple dropdown with all entity configurations.
* @param value Currently picked entity name
* @param setValue Change handler for entity
*/
declare const RegistryEntityPicker: ({ value, setValue }: Props$2) => JSX.Element;
/**
* {@link RegistryFilter} properties
*/
interface Props$1 {
/**
* Change handler to be called when filter updates
* @param searchParameter new search values
*/
onFilterUpdate: (searchParameter: SearchParameter) => void;
}
/**
* Component for basic filtering. Has input field for query and dropdown with filterable properties.
* @param onFilterUpdate Change handler to be called when filter updates
*/
declare const RegistryFilter: ({ onFilterUpdate }: Props$1) => JSX.Element;
/**
* {@link RegistryForm} properties
*/
interface Props {
/**
* Initial values of the form. Row data or empty object
*/
initialValues: any;
/**
* Flag if form is currently in create or update mode
*/
type: FormType;
/**
* Handler for submitting values. Called after successful validation of input data
* @param values
*/
onSubmit: (values: any) => void;
/**
* Handler for closing form, called when user explicitly clicks on cancel button
*/
onClose: () => void;
}
/**
* Component which encapsulates create and update forms for single registry entity
* @param initialValues Initial values of the form. Row data or empty object
* @param type Flag if form is currently in create or update mode
* @param onSubmit Handler for submitting values. Called after successful validation of input data
* @param onClose Handler for closing form, called when user explicitly clicks on cancel button
*/
declare const RegistryForm: ({ initialValues, type, onSubmit, onClose, }: Props) => JSX.Element;
/**
* {@link RegistryTable} properties
*/
interface RegistryTableProps {
/**
* Row data of entity
*/
data: RegistryResponse<any>;
/**
* Current request used for latest data fetch
*/
request: EntityRegistryRequest;
/**
* Change function for pagination fields
* @param request new request value
*/
onRequestChange: (request: EntityRegistryRequest) => void;
/**
* Handler for editing specific row
* @param id id field of the row
* @param data row data
*/
onEdit: (id: any, data: any) => void;
/**
* Handler for removing specific row
* @param id id field of the row
*/
onRemove: (id: any) => void;
}
/**
* Component which renders entity data in form of the table. Contains paging and actions for specific rows
* @param data row data of entity
* @param request current request used for latest data fetch
* @param onRequestChange change function for pagination fields
* @param onEdit handler for editing specific row
* @param onRemove handler for removing specific row
*/
declare const RegistryTable: ({ data, request, onRequestChange, onEdit, onRemove, }: RegistryTableProps) => JSX.Element;
export { Props$3 as Props, RegistryEntity, RegistryEntityPicker, RegistryFilter, RegistryForm, RegistryTable };