kwikid-forms
Version:
KwikID's JSON Configuration based Forms Renderer and Builder
365 lines (364 loc) • 10.5 kB
TypeScript
import { TAction, TEngine, TRule, TSource } from "kwikid-toolkit";
import { TApi } from "./form-view.apis.definition";
import { TMessage } from "./form-view.commons.definition";
import { TValidator } from "./form-view.form-validations.definition";
import { TTrigger } from "./form-view.triggers.definition";
export declare enum EFieldType {
HTML = "html",
TITLE = "title",
TEXT = "text",
BUTTON = "button",
TEXTAREA = "textarea",
CHECKBOX = "checkbox",
NUMBER = "number",
DATE = "date",
TIME = "time",
IMAGE = "image",
PREVIEW_IMAGE = "preview-image",
PHONE = "phone",
RADIO = "radio",
SELECT = "select",
DROPDOWN_WITH_SEARCH = "dropdown-with-search",
API_CALL = "api-call",
API = "api",
OTP = "otp",
AADHAAR_NUMBER = "aadhaar-number",
SLIDER = "slider",
FILE = "file",
PASSWORD = "password",
EMAIL = "email",
CAPTURE = "capture",
RECORD = "record",
STAR_RATING = "star-rating",
LIVE_LOCATION = "live-location",
DATA_HOLDER = "data-holder",
CURRENCY = "currency"
}
export declare type TFieldType = EFieldType.HTML | EFieldType.TITLE | EFieldType.BUTTON | EFieldType.TEXT | EFieldType.TEXTAREA | EFieldType.CHECKBOX | EFieldType.NUMBER | EFieldType.DATE | EFieldType.TIME | EFieldType.PREVIEW_IMAGE | EFieldType.PHONE | EFieldType.RADIO | EFieldType.DROPDOWN_WITH_SEARCH | EFieldType.SELECT | EFieldType.API | EFieldType.API_CALL | EFieldType.OTP | EFieldType.AADHAAR_NUMBER | EFieldType.SLIDER | EFieldType.FILE | EFieldType.PASSWORD | EFieldType.EMAIL | EFieldType.CAPTURE | EFieldType.RECORD | EFieldType.STAR_RATING | EFieldType.LIVE_LOCATION | EFieldType.DATA_HOLDER | EFieldType.CURRENCY;
export declare type TFieldSelectOption = {
title: string;
value: string;
};
export declare type TFieldRadioOption = {
label: string;
disabled: boolean;
};
export declare type TFieldDefaultValue = {
value: any;
source?: TEngine;
sources?: Array<TSource>;
};
export declare type TFieldDefaultDropdownOptions = {
triggers: TTrigger[];
rules: TRule[];
actions: TAction[];
};
export declare type TFieldDefaultApiValue = {
triggers: TTrigger[];
rules: TRule[];
actions: TAction[];
};
export declare type TFieldDefault = {
value: TFieldDefaultValue;
options: TFieldDefaultDropdownOptions;
api: TFieldDefaultApiValue;
};
export declare type TFieldTextProperties = {
case: string;
placeholder: string;
readOnly: string;
};
export declare type TFieldCurrencyProperties = {
containerStyles: string;
currencyType: string;
placeholder: string;
readOnly: string;
};
export declare type TFieldEmailProperties = {
case: string;
domains: Array<string>;
placeholder: string;
readOnly: string;
};
export declare type TFieldPasswordProperties = {
placeholder: string;
hintContent: string;
readOnly: string;
};
export declare type TFieldTextareaProperties = {
placeholder: string;
readOnly: string;
};
export declare type TFieldCheckboxProperties = {
contentAlign: string;
size: string;
readOnly: string;
placeholder: string;
};
export declare type TFieldNumberProperties = {
min: number;
max: number;
prefix: number;
postfix: number;
precision: number;
placeholder: string;
decimal: string;
readOnly: boolean;
};
export declare type TFieldDateProperties = {
placeholder: string;
min: {
year: number;
month: number;
day: number;
};
max: {
year: number;
month: number;
day: number;
};
readOnly: boolean;
};
export declare type TFieldPhoneProperties = {
countryCode: string;
phoneMaskAfterCountryCode: string;
removeCountryCodeFromValue: boolean;
placeholder: string;
readOnly: boolean;
};
export declare type TFieldPreviewImageProperties = {
altText: string;
html: {
before: string;
after: string;
};
imageType: string;
loadingType: string;
placeholder: string;
};
export declare type TFieldSliderProperties = {
min: number;
max: number;
step: number;
quantum: number;
placeholder: string;
readOnly: boolean;
};
export declare type TFieldRadioProperties = {
size: string;
orientation: string;
readOnly: string;
placeholder: string;
};
export declare type TFieldSelectProperties = {
placeholder: string;
readOnly: boolean;
};
export declare type TFieldApiCallProperties = {};
export declare type TFieldDataHolderProperties = {};
export declare type TFieldOtpProperties = {
placeholder: string;
mask: string;
};
export declare type TFieldAadhaarNumberProperties = {
mask: string;
readOnly: string;
};
export declare type TFieldCaptureProperties = {
containerStyles: string;
buttonText: string;
icon: string;
showMediaFiles: boolean;
uploadFileToServer: boolean;
isCroppedImage: boolean;
isMaskedImage: boolean;
features: {
ocr: {
isEnabled: boolean;
documentType: "PAN" | "AADHAAR";
documentSide: "FRONT" | "BACK";
isOcrFromServer: boolean;
};
facematch: {
isEnabled: boolean;
isFacematchFromServer: boolean;
sources: TSource[];
};
liveliness: {
isEnabled: boolean;
isLivelinessFromServer: boolean;
};
watermark: {
isEnabled: boolean;
isWatermarkFromServer: boolean;
sources: TSource[];
};
};
cameraConfig: {
header: {
title: string;
isBack: boolean;
isExpand: boolean;
isClose: boolean;
};
footer: {
isUpload: boolean;
isFlip: boolean;
isSwitch: boolean;
};
others: {
isFrontCamera: boolean;
flipHorizontal: boolean;
mask: {
shape: string;
};
preview: {
show: boolean;
header: {
isBack: boolean;
isClose: boolean;
};
};
};
};
};
export declare type TFieldRecordProperties = {
containerStyles: string;
buttonText: string;
icon: string;
showMediaFiles: boolean;
uploadFileToServer: boolean;
cameraConfig: {
header: {
title: string;
isBack: boolean;
isExpand: boolean;
isClose: boolean;
};
footer: {
isUpload: boolean;
isFlip: boolean;
isSwitch: boolean;
};
others: {
isFrontCamera: boolean;
flipHorizontal: boolean;
minRecordingTimeInSeconds: number;
maxRecordingTimeInSeconds: number;
preview: {
show: boolean;
header: {
isBack: boolean;
isClose: boolean;
};
};
};
};
};
export declare type TFieldStarRatingProperties = {
color: string;
icon: string;
iconMarked: string;
min: number;
max: number;
placeholder: string;
size: string;
};
export declare type TFieldLiveLocationProperties = {
isGetLocationFromLatLong: boolean;
isShowLatLongCaptureTimestamp: boolean;
color: string;
containerStyles: string;
placeholder: string;
size: string;
styles: string;
shape: string;
};
export declare type TFieldProperties = TFieldTextProperties | TFieldCurrencyProperties | TFieldEmailProperties | TFieldPasswordProperties | TFieldTextareaProperties | TFieldCheckboxProperties | TFieldNumberProperties | TFieldDateProperties | TFieldPhoneProperties | TFieldPreviewImageProperties | TFieldSliderProperties | TFieldRadioProperties | TFieldSelectProperties | TFieldApiCallProperties | TFieldOtpProperties | TFieldAadhaarNumberProperties | TFieldCaptureProperties | TFieldRecordProperties | TFieldStarRatingProperties | TFieldLiveLocationProperties;
export declare type TField = {
label: string;
type: TFieldType;
key: string;
disabled: boolean;
messages: Array<TMessage>;
default: TFieldDefault;
validators: TValidator;
validation: TEngine;
api?: TApi;
properties: TFieldProperties;
options?: Array<any>;
};
export declare type TFieldTitle = {
type: TFieldType;
label: string;
key: string;
reset?: {
fields: Array<{
fieldKey: string;
actions: Array<TAction>;
}>;
fieldGroups: Array<{
groupKey: string;
actions: Array<TAction>;
}>;
};
properties?: {
bypassResetConfirmation?: boolean;
};
};
export declare type TFieldText = TField & {
properties: TFieldTextProperties;
};
export declare type TFieldCurrency = TField & {
properties: TFieldCurrencyProperties;
};
export declare type TFieldTextArea = TField & {
properties: TFieldTextareaProperties;
};
export declare type TFieldCheckbox = TField & {
properties: TFieldCheckboxProperties;
};
export declare type TFieldNumber = TField & {
properties: TFieldNumberProperties;
};
export declare type TFieldDate = TField & {
properties: TFieldDateProperties;
};
export declare type TFieldPhone = TField & {
properties: TFieldPhoneProperties;
};
export declare type TFieldRadio = TField & {
options: Array<TFieldRadioOption>;
properties: TFieldRadioProperties;
};
export declare type TFieldEmail = TField & {
properties: TFieldEmailProperties;
};
export declare type TFieldSelect = TField & {
options: Array<TFieldSelectOption>;
properties: TFieldSelectProperties;
};
export declare type TFieldApiCall = TField & {
api: TApi;
showLoader: boolean;
properties: TFieldApiCallProperties;
};
export declare type TFieldLiveLocation = TField & {
api: TApi;
properties: TFieldLiveLocationProperties;
};
export declare type TFieldOtp = TField & {
properties: TFieldOtpProperties;
};
export declare type TFieldAadhaarNumber = TField & {
properties: TFieldAadhaarNumberProperties;
};
export declare type TFieldPreviewImage = TField & {
properties: TFieldPreviewImageProperties;
};
export declare type TFieldCapture = TField & {
properties: TFieldCaptureProperties;
};
export declare type TFieldStarRating = TField & {
properties: TFieldStarRatingProperties;
};