@manojadams/metaforms
Version:
Meta-data driven forms
222 lines (221 loc) • 5.29 kB
TypeScript
export interface IUISchema {
schema: ISchema;
}
export interface ISchema {
fields: Array<IField>;
theme?: ITheme;
buttons?: Array<IField>;
rest?: IRest;
}
export interface IRest {
config: IConfig;
}
export interface IConfig {
apihost?: string;
basepath?: string;
protocol?: string;
headers?: Array<IConfigParam>;
}
export interface IConfigParam {
key: string;
value: string;
}
export interface IField {
name: string;
prop?: string;
meta: IMeta;
fields?: Array<IField>;
}
export interface IMeta {
type?: string;
display?: boolean;
isArray?: boolean;
displayName?: string;
displayType?: string;
placeholder?: string;
value?: string | number | boolean;
displayProps?: IDisplayProps;
options?: Array<IOption>;
isDisabled?: boolean;
isReadonly?: boolean;
validation?: IValidation;
dependencies?: IDependency;
loader?: ILoader;
mui?: any;
bootstrap?: any;
url?: string;
className?: string;
events?: IEvent;
labelPlacement?: string;
error?: {
hasError: boolean;
errorMsg: string;
};
init?: IURLLoaderConfig;
config?: any;
icons?: IIconConfig;
}
export interface IOption {
value: string;
label: string;
ref?: any;
}
export interface ITemplateConfig {
params: Record<string, string>;
}
export interface IURLLoaderConfig {
type: string;
url: string;
url_type?: string;
queryParams?: Array<TParam>;
pathParams?: Array<TParam>;
responseKey?: string;
valueKey?: string;
labelKey?: string;
loadOn?: Array<string>;
openTo?: string;
inputFormat?: string;
views?: string;
inputs?: Array<IMultitextInput>;
separator?: string;
accept?: string;
toolbarVersion?: number;
}
export interface IIconConfig {
[key: string]: {
type: string;
position?: string;
};
}
export interface IFieldConfig extends IURLLoaderConfig {
}
export interface IDisplayProps {
lg?: number;
md?: number;
sm?: number;
xs?: number;
offset?: string;
rs?: boolean;
isStandalone?: boolean;
align?: string;
fieldLayout?: string;
optionsLayout?: string;
}
export interface ITheme {
type: string;
sectionLayout?: string;
spacing?: string;
className?: string;
mui?: IMUITheme;
bootstrap?: IBootstrapTheme;
}
export interface IValidation {
required?: boolean;
requiredDetail?: IValidationDetail;
required_detail?: IValidationDetail;
pattern?: string;
patternDetail?: IPatternValidationDetail;
pattern_detail?: IPatternValidationDetail;
min?: number | string;
minDetail?: IValidationDetail;
min_detail?: IValidationDetail;
max?: number | string;
maxDetail?: IValidationDetail;
max_detail?: IValidationDetail;
infoDetail?: IInfoDetail;
info_detail?: IInfoDetail;
}
export interface IValidationDetail {
errorMsg?: string;
}
export interface IPatternValidationDetail extends IValidationDetail {
allowValidOnly?: boolean;
}
export interface IInfoDetail {
infoMsg?: string;
infoMsgFn?: string;
}
export interface IDependency {
exists?: IExistsDependency;
enabled?: IEnabledDependency;
load?: ILoadDependency;
equals?: IEqualsDependency;
displayType?: IDisplayTypeDependency;
}
export interface IBaseDependency {
section: string;
ref: string;
value: string;
}
export interface IExistsDependency extends IBaseDependency {
}
export interface IEnabledDependency extends IBaseDependency {
}
export interface ILoadDependency extends IBaseDependency {
url: string;
}
export interface IEqualsDependency extends IBaseDependency {
currentValue: any;
resetValue: any;
}
export interface IDisplayTypeDependency extends IBaseDependency {
}
export interface ILoader {
}
export interface IFieldChange {
type: string;
reference: string;
}
export interface IEvent {
click?: IClickEvent;
input?: IInputEvent;
change?: IChangeEvent | Array<IChangeEvent>;
open?: IConfig;
}
export interface IMUITheme {
variant?: string;
size?: string;
tabs?: {
variant: string;
};
}
export interface IBootstrapTheme {
}
export interface IClickEvent {
type: string;
value?: string;
}
export interface IInputEvent {
type: string;
url: string;
params: Array<TParam>;
labelKey?: string;
valueKey?: string;
responseKey?: string;
response?: string;
value?: string;
}
export interface IChangeEvent {
type: string;
ref: string;
valueKey: string;
value: any;
}
export interface IParamType {
type?: string;
ref?: string;
section?: string;
}
export declare type TParamType = IParamType | string | undefined;
export declare type TParam = [string, TParamType];
export interface IFormatterType {
[key: string]: Function;
}
export interface IMultitextInput {
chars: string;
width: string;
isReadonly?: boolean;
required?: boolean;
placeholder?: string;
value?: string;
}