digitaform-preview-react
Version:
A comprehensive React form preview component library with form controls,responsive design
139 lines • 3.91 kB
TypeScript
import { EFormTemplateStatus } from '../services/form-templates.enum';
export interface ITranslation {
label?: string;
description?: string;
}
export interface TFormComponent {
id: string;
_id: string;
name: string;
category: string;
basic: {
label?: string;
value: string;
defaultValue: string;
placeholder: string;
options: any[];
inlineLayout?: boolean;
comments?: string;
description?: string;
collapsed?: boolean;
showLabel?: boolean;
valid?: boolean;
rows?: number;
decimalPlaces?: number;
timeFormat?: string;
minDateTime?: string;
maxDateTime?: string;
minDate?: string;
maxDate?: string;
height?: number;
penColor?: string;
backgroundColor?: string;
translations?: Record<string, ITranslation> | Map<string, ITranslation>;
enableNotes?: boolean;
enableAttachment?: boolean;
enableRaiseIssue?: boolean;
enableSendEmail?: boolean;
};
validation: {
required: boolean;
customValidationMessage: string;
readonly: boolean;
};
styles: {
labelAlignment: string;
width?: number;
height?: number;
minWidth?: number;
maxWidth?: number;
minHeight?: number;
maxHeight?: number;
column?: number;
backgroundColor?: string;
borderColor?: string;
borderWidth?: string;
borderRadius?: string;
padding?: string;
margin?: string;
};
position: number;
options: any[];
conditional: {
action: 'show' | 'hide' | 'always';
when: 'all' | 'any';
conditions: Array<{
id: string;
when: string;
operator: 'equals' | 'notEquals' | 'isEmpty' | 'isNotEmpty' | 'contains' | 'notContains' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual';
value: string | number | boolean;
}>;
};
threshold?: {
conditions: Array<{
id: string;
operator: 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'equals' | 'notEquals';
value: number | string;
enableNotes?: boolean;
enableAttachment?: boolean;
enableRaiseIssue?: boolean;
}>;
};
table?: {
rows: number;
columns: number;
displayAsTable: boolean;
columnNames: string;
showColumns: boolean;
};
cells?: Array<Array<{
id: string;
row: number;
column: number;
components: TFormComponent[];
styles?: {
backgroundColor?: string;
borderColor?: string;
padding?: string;
minHeight?: string;
verticalAlign?: 'top' | 'middle' | 'bottom';
};
}>>;
[key: string]: any;
}
export interface IGetFormTemplateResponse {
_id: string;
title: string;
description: string;
projectId: string;
createdById: string;
createdAt: string;
updatedById: string;
updatedAt: string;
versionNumber: string;
parentVersionId: string;
status: EFormTemplateStatus;
components: TFormComponent[];
tags: IFormTag[];
}
export interface IGetFormSubmissionRequest extends Omit<IUpdateFormTemplateRequest, 'updatedAt'> {
formTemplateId: string;
}
export interface IUpdateFormTemplateRequest {
title?: string;
description?: string;
projectId: string;
createdById: string;
updatedAt: string;
updatedById: string;
components: TFormComponent[];
tags?: IFormTag[];
status: EFormTemplateStatus;
isStandalone?: boolean;
}
export interface IFormTag {
_id?: string;
id: string;
name: string;
}
//# sourceMappingURL=form-template.interface.d.ts.map