kwikid-forms
Version:
KwikID's JSON Configuration based Forms Renderer and Builder
216 lines (215 loc) • 11.1 kB
TypeScript
import { ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, QueryList, Renderer2, SimpleChanges, TemplateRef } from "@angular/core";
import { FormGroup } from "@angular/forms";
import { TuiPreviewDialogService } from "@taiga-ui/addon-preview";
import { TuiAlertService, TuiDialogContext, TuiDialogService, TuiNotification } from "@taiga-ui/core";
import { TuiPushService } from "@taiga-ui/kit";
import { KwikIDCameraRecordService } from "kwikid-camera";
import { TAction } from "kwikid-toolkit";
import { KwikUILoaderService } from "kwikui";
import { TApi, TApiTimer } from "./definitions/form-view.apis.definition";
import { TFormViewGoBackMode, TMessage } from "./definitions/form-view.commons.definition";
import { TFieldApiCall, TFieldTitle } from "./definitions/form-view.fields.definition";
import { ELogEventType } from "./definitions/form-view.logs.definition";
import { KwikIDFormViewApiService } from "./form-view.api.service";
import { KwikIDFormViewService } from "./form-view.service";
import * as i0 from "@angular/core";
export declare class KwikIDFormViewComponent implements OnInit, OnChanges, OnDestroy {
private cdRef;
private formViewService;
private formViewApiService;
protected readonly pushService: TuiPushService;
protected readonly alertService: TuiAlertService;
private readonly previewDialogService;
private readonly dialogService;
loaderService: KwikUILoaderService;
private cameraRecordService;
private ref;
private renderer;
formFieldContainerRef: ElementRef;
formFieldsRef: QueryList<ElementRef>;
readonly dialog: TemplateRef<TuiDialogContext<void>>;
readonly preview: TemplateRef<TuiDialogContext<void>>;
allFormsData: any;
extraData: any;
apiCallResponse: any;
buttonClickResponse: any;
formConfig: any;
formData: any;
isMobileView: boolean;
popupFormCallback: any;
userConfig: any;
stepConfig: any;
getLogs: EventEmitter<any>;
getUnsavedDataState: EventEmitter<any>;
onActionShowPopupForm: EventEmitter<any>;
onClickApiCall: EventEmitter<any>;
onClickViewFile: EventEmitter<any>;
onClickFormFieldButton: EventEmitter<any>;
onClickGoBack: EventEmitter<any>;
onClickSaveForm: EventEmitter<any>;
onClickViewForms: EventEmitter<any>;
fieldGroups: any;
formFields: any[];
previousFormData: any;
cameraData: any;
isShowCamera: boolean;
isShowCameraFullscreen: boolean;
activeCameraFieldKey: string;
activeCameraData: any;
activeCameraType: "CAPTURE" | "RECORD";
activeCameraImage: string;
activeCameraVideo: string;
activeCameraConfig: any;
activeCameraRecordingTime: number;
activeCameraRecordingTimerSubcription: any;
activeCameraRecordingState: string;
activeCameraRecordingStateSubcription: any;
resetCamera(): void;
previewProperties: any;
loading: boolean;
apiLoading: boolean;
backButton: {
disabled: boolean;
showLoader: boolean;
};
viewFormsButton: {
disabled: boolean;
showLoader: boolean;
};
saveFormButton: {
disabled: boolean;
showLoader: boolean;
};
files: any;
mediaFiles: any;
stopTaskExecution: boolean;
waitingForChanges: boolean;
popupFormConfig: any;
popupFormData: any;
taskData: any;
previewDialogRef: any;
formGroup: FormGroup;
constructor(cdRef: ChangeDetectorRef, formViewService: KwikIDFormViewService, formViewApiService: KwikIDFormViewApiService, pushService: TuiPushService, alertService: TuiAlertService, previewDialogService: TuiPreviewDialogService, dialogService: TuiDialogService, loaderService: KwikUILoaderService, cameraRecordService: KwikIDCameraRecordService, ref: ChangeDetectorRef, renderer: Renderer2);
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
triggerLogs(eventType: ELogEventType, logs: any): void;
initFormConfig(formConfig: any): Promise<boolean>;
setFormFieldsFromFormConfig(formConfig: any): void;
setFormFieldGroupsFromFormConfig(formConfig: any): void;
setFormDataFromAllFormsData(): void;
handleConnectedElementFieldGroupActions(childFieldGroupConfig: any, parentField: any): Promise<void>;
handleConnectedElementFieldGroup(currentField: any, connectedFieldGroupConfig: any, eventType: string): Promise<void>;
handleConnectedElementFieldActions(connectedFieldConfig: any, connectedField: any): Promise<any>;
handleConnectedElementFields(currentField: any, connectedFieldConfig: any, eventType: string, nested: string): Promise<any>;
handleConnectedElements(e: any, eventType: string): Promise<void>;
handleRemovedFile(e: any): void;
handleViewButtonClick(e: any, field: any): void;
handleGetKeyValueFile(e: any): Promise<void>;
/** Methods for Camera related fields like 'CAPTURE' or 'RECORD' */
handleOnClickGetRemovedMediaFile(e: any): void;
handleOnClickInputCamera(e: any, field: any): Promise<void>;
/** KwikID Camera Methods */
/** CameraType = CAPTURE */
setCameraMedia(media: string): Promise<void>;
/** Camera Common Methods */
handleGetCameraMedia(e: any, activeCameraType: "CAPTURE" | "RECORD"): void;
handleOnClickSaveCameraMedia(e: any, activeCameraType: "CAPTURE" | "RECORD"): void;
handleOnClickCameraBack(e: any): void;
handleOnClickCameraClose(e: any): void;
/**
* This method is used to update the files array with the new file and it's state and response from the api of uploading the file.
*/
updateFiles(file: any, state: string, key: string): void;
/**
* This is a api upload mocking method. Set's to loading at first at point when API is called and then changes the status to random status after 2 seconds of delay showing a mocked response from API.
*/
uploadFile(field: any, file: any): Promise<void>;
handleOnClickFormFieldButton(field: any): void;
handleOnLocationPermission(e: any): void;
handleOnClickLiveLocation(e: any): Promise<void>;
handleGetKeyValue(e: any): void;
handleOnClickResetFormFields(e: any, field: TFieldTitle): Promise<void>;
handleFieldApiCall(field: TFieldApiCall, api: any): Promise<{
field: TFieldApiCall;
api: any;
}>;
handleApiCall(api: any): Promise<{
api: any;
}>;
executeApiCall(api: any, object: any): Promise<any>;
isValidRequestHeadersAndBody(api: TApi): any;
showApiLoader(): void;
hideApiLoader(): void;
handleOnClickApiCall(e: any): Promise<void>;
/**
* Method to optimize the DOM update by Angular for using *ngFor on large no. of items.
* @param index number
* @param item fieldConfig
* @returns string
*/
getUniqueIdentifier(index: number, item: any): string;
handleOnClickGoBack(e: any, mode: TFormViewGoBackMode): void;
handleOnClickViewForms(e: any): void;
handleOnClickSaveForm(e: any): Promise<void>;
handleOnApiTimerStop(e: any): Promise<void>;
handleOnScrollToField(fieldKey: string): void;
showErrorNotification: boolean;
toggleErrorNotification(show: boolean): void;
showPermissionErrorNotification: boolean;
togglePermissionErrorNotification(show: boolean): void;
fieldHide(fieldKey: string): void;
fieldGroupHide(fieldGroup: string): void;
fieldShow(fieldKey: string): void;
fieldGroupShow(fieldGroup: string): void;
fieldDisable(fieldKey: string): void;
fieldGroupDisable(fieldGroup: string): void;
fieldEnable(fieldKey: string): void;
fieldGroupEnable(fieldGroup: string): void;
fieldReset(fieldKey: string): void;
fieldGroupReset(fieldGroup: string): void;
fieldHideApiLoader(fieldKey: string): void;
fieldShowApiLoader(fieldKey: string): void;
setHtml(fieldKey: string, message: TMessage): void;
fieldErrorShow(fieldKey: string, message: TMessage): void;
fieldErrorHide(fieldKey: string, message: TMessage): void;
fieldMessageShow(fieldKey: string, message: TMessage): void;
fieldMessageHide(fieldKey: string, message: TMessage): void;
fieldApiTimerMessageShow(fieldKey: string, timer: TApiTimer): Promise<void>;
fieldApiTimerMessageHide(fieldKey: string): Promise<void>;
removeKeyFromObjectPath(action: TAction, object: any): Promise<void>;
setValue(action: TAction, object: any): Promise<void>;
setFieldDefaultValue(action: TAction, object: any): Promise<void>;
setApiStatus(action: TAction, object: any): Promise<void>;
setApiHeaderValue(action: TAction, object: any): Promise<void>;
setApiHeaderValidity(action: TAction, object: any): Promise<void>;
setApiBodyValue(action: TAction, object: any): Promise<void>;
setApiBodyValidity(action: TAction, object: any): Promise<void>;
setFieldValidity(action: TAction, object: any): Promise<void>;
setDropdownOptions(action: TAction, object: any): Promise<void>;
apiCall(action: TAction, object: any): Promise<TApi>;
fieldApiCall(action: TAction, object: any): Promise<void>;
fieldMultipleApiCalls(action: TAction, object: any): Promise<void>;
fieldMultipleApiCallsEnd(action: TAction, object: any): Promise<void>;
taskApiCall(action: TAction, object: any): Promise<void>;
taskMultipleApiCalls(action: TAction, object: any): Promise<void>;
taskMultipleApiCallsEnd(action: TAction, object: any): Promise<void>;
dialogRef: any;
dialogShow(options: any): void;
dialogHide(): void;
redirectToUrl(action: TAction): void;
patchFieldControlValue(key: string, value: any): void;
setFieldControlValue(key: string, value: any): void;
patchFormGroup(formData: any): void;
isFieldValid(fieldKey: string): boolean;
isFieldEnabled(fieldKey: string): boolean;
getFormGroupRawValues(): any;
showPreview(previewProperties: any): void;
showErrorPreview(previewProperties: any): void;
showPopupForm(popupFormKey: string, popupType?: "DIALOG" | "POPUP"): void;
alertShow(type: TuiNotification, message: string): void;
takeActionOnFieldGroup(action: TAction, object: any): Promise<void>;
takeAction(action: TAction, object: any): Promise<void>;
static ɵfac: i0.ɵɵFactoryDeclaration<KwikIDFormViewComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<KwikIDFormViewComponent, "kwikid-form-view", never, { "allFormsData": "allFormsData"; "extraData": "extraData"; "apiCallResponse": "apiCallResponse"; "buttonClickResponse": "buttonClickResponse"; "formConfig": "formConfig"; "formData": "formData"; "isMobileView": "isMobileView"; "popupFormCallback": "popupFormCallback"; "userConfig": "userConfig"; "stepConfig": "stepConfig"; }, { "getLogs": "getLogs"; "getUnsavedDataState": "getUnsavedDataState"; "onActionShowPopupForm": "onActionShowPopupForm"; "onClickApiCall": "onClickApiCall"; "onClickViewFile": "onClickViewFile"; "onClickFormFieldButton": "onClickFormFieldButton"; "onClickGoBack": "onClickGoBack"; "onClickSaveForm": "onClickSaveForm"; "onClickViewForms": "onClickViewForms"; }, never, never>;
}