@acrodata/gui
Version:
JSON powered GUI for configurable panels.
73 lines (72 loc) • 3.03 kB
TypeScript
import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
import { FormArray, FormGroup } from '@angular/forms';
import { Subscription } from 'rxjs';
import { GuiControl, GuiFieldType, GuiFields, GuiTabsMode } from './interface';
import { GuiIconsRegistry } from './gui-icons';
import * as i0 from "@angular/core";
export declare class GuiForm implements OnChanges, OnInit, OnDestroy {
/**
* The form instance which allow to track model value and validation status.
*/
form: FormGroup<any>;
/**
* The field configurations for building the form.
*/
config: GuiFields;
/**
* The model to be represented by the form.
*/
model: any;
/**
* Fired on model value change
*/
modelChange: EventEmitter<any>;
formFields: GuiControl[];
formSubscription: Subscription;
controlSubscriptions: Subscription[];
uid: string;
constructor(iconsRegistry: GuiIconsRegistry);
ngOnChanges(changes: SimpleChanges): void;
ngOnInit(): void;
ngOnDestroy(): void;
/**
* Convert the object config to array config and register into the reactive form.
*
* @param form The reactive form instance
* @param config The config of the form fields
* @param model The value of the form control
* @param defaultValue The default value of the form field
* @param parentType The type of the form field parent
* @returns
*/
getFormFieldArray(form: FormGroup | FormArray, config?: GuiFields | GuiControl[], model?: Record<string, any>, defaultValue?: any, parentType?: GuiFieldType): GuiControl[];
/**
* Add a tab item.
*
* @param e The mouse event
* @param formArray The reactive form instance
* @param tabs The config of the tabs field
* @param copy Whether to copy the current tab
* @param index The index of the tabs array
*/
addTab(e: MouseEvent, formArray: FormArray, tabs: GuiControl, copy?: boolean, index?: number): void;
/**
* Remove a tab item.
*
* @param e The mouse event
* @param formArray The reactive form instance
* @param tabs The config of the tabs field
* @param index The index of the tabs array
*/
removeTab(e: MouseEvent, formArray: FormArray, tabs: GuiControl, index?: number): void;
/**
* Change the display mode of tabs.
*
* @param e The mouse event
* @param tabs The config of the tabs field
* @param mode The display mode of tabs
*/
changeTabsMode(e: MouseEvent, tabs: GuiControl, mode?: GuiTabsMode): void;
static ɵfac: i0.ɵɵFactoryDeclaration<GuiForm, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<GuiForm, "gui-form", never, { "form": { "alias": "form"; "required": false; }; "config": { "alias": "config"; "required": false; }; "model": { "alias": "model"; "required": false; }; }, { "modelChange": "modelChange"; }, never, never, true, never>;
}