@ng-formworks/core
Version:
Angular ng-formworks - JSON Schema Form builder core
1,156 lines (1,137 loc) • 120 kB
TypeScript
import * as _angular_core from '@angular/core';
import { OnDestroy, Signal, OnChanges, OnInit, SimpleChanges, ElementRef, ComponentRef, ViewContainerRef, Renderer2 } from '@angular/core';
import * as i27 from '@angular/forms';
import { AbstractControl, UntypedFormArray, UntypedFormGroup, ControlValueAccessor, ValidationErrors, ValidatorFn } from '@angular/forms';
import * as rxjs from 'rxjs';
import { Subject, Subscription, Observable } from 'rxjs';
import Ajv2019, { Options, ErrorObject, ValidateFunction } from 'ajv/dist/2019';
import * as i2 from '@angular/common';
import * as i28 from 'nxt-sortablejs';
type WidgetContext = {
formControl?: AbstractControl;
layoutNode?: Signal<any>;
layoutIndex?: Signal<number[]>;
dataIndex?: Signal<number[]>;
options?: any;
controlValue?: any;
boundControl?: boolean;
controlName?: string;
controlDisabled?: boolean;
};
type AJVRegistryItem = {
[name: string]: {
name: string;
ajvInstance: Ajv2019;
ajvValidator: ValidateFunction;
};
};
interface TitleMapItem {
name?: string;
value?: any;
checked?: boolean;
group?: string;
items?: TitleMapItem[];
}
interface ErrorMessages {
[control_name: string]: {
message: string | Function | Object;
code: string;
}[];
}
declare class JsonSchemaFormService implements OnDestroy {
JsonFormCompatibility: boolean;
ReactJsonSchemaFormCompatibility: boolean;
AngularSchemaFormCompatibility: boolean;
tpldata: any;
ajvOptions: Options;
ajv: any;
validateFormData: any;
formValues: any;
data: any;
schema: any;
layout: any[];
formGroupTemplate: any;
formGroup: any;
framework: any;
formOptions: any;
validData: any;
isValid: boolean;
ajvErrors: ErrorObject[];
validationErrors: any;
dataErrors: any;
formValueSubscription: any;
dataChanges: Subject<any>;
isValidChanges: Subject<any>;
validationErrorChanges: Subject<any>;
arrayMap: Map<string, number>;
dataMap: Map<string, any>;
dataRecursiveRefMap: Map<string, string>;
schemaRecursiveRefMap: Map<string, string>;
schemaRefLibrary: any;
layoutRefLibrary: any;
templateRefLibrary: any;
hasRootReference: boolean;
language: string;
defaultFormOptions: any;
fcValueChangesSubs: Subscription;
fcStatusChangesSubs: Subscription;
private draggableStateSubject;
draggableState$: rxjs.Observable<boolean>;
setDraggableState(value: boolean): void;
private sortableOptionsSubject;
sortableOptions$: rxjs.Observable<any>;
setSortableOptions(value: any): void;
createAjvInstance(ajvOptions: any): Ajv2019;
createAndRegisterAjvInstance(ajvOptions: any, name?: string): {
name: string;
ajvInstance: Ajv2019;
ajvValidator: ValidateFunction;
};
ajvRegistry: AJVRegistryItem;
getAjvInstance(name?: string): Ajv2019;
getAjvValidator(name?: string): ValidateFunction<unknown>;
constructor();
ngOnDestroy(): void;
setLanguage(language?: string): void;
getData(): any;
getSchema(): any;
getLayout(): any[];
resetAllValues(): void;
/**
* 'buildRemoteError' function
*
* Example errors:
* {
* last_name: [ {
* message: 'Last name must by start with capital letter.',
* code: 'capital_letter'
* } ],
* email: [ {
* message: 'Email must be from example.com domain.',
* code: 'special_domain'
* }, {
* message: 'Email must contain an @ symbol.',
* code: 'at_symbol'
* } ]
* }
* //{ErrorMessages} errors
*/
buildRemoteError(errors: ErrorMessages): void;
validateData(newValue: any, updateSubscriptions?: boolean, ajvInstanceName?: string): void;
buildFormGroupTemplate(formValues?: any, setValues?: boolean): void;
buildFormGroup(ajvInstanceName?: string): void;
buildLayout(widgetLibrary: any): void;
setOptions(newOptions: any): void;
compileAjvSchema(ajvInstanceName?: string): void;
buildSchemaFromData(data?: any, requireAllFields?: boolean): any;
buildSchemaFromLayout(layout?: any): any;
setTpldata(newTpldata?: any): void;
parseText(text?: string, value?: any, values?: any, key?: number | string): string;
parseExpression(expression?: string, value?: any, values?: any, key?: number | string, tpldata?: any): any;
setArrayItemTitle(parentCtx?: any, childNode?: any, index?: number): string;
setItemTitle(ctx: WidgetContext): string;
evaluateCondition(layoutNode: any, dataIndex: number[]): boolean;
initializeControl(ctx: WidgetContext, bind?: boolean): boolean;
formatErrors(errors: any, validationMessages?: any): string;
updateValue(ctx: WidgetContext, value: any): void;
updateArrayCheckboxList(ctx: WidgetContext, checkboxList: TitleMapItem[]): void;
updateArrayMultiSelectList(ctx: WidgetContext, selectList: TitleMapItem[]): void;
getFormControl(ctx: WidgetContext): AbstractControl;
setFormControl(ctx: WidgetContext, control: AbstractControl): AbstractControl;
getFormControlValue(ctx: WidgetContext): AbstractControl;
getFormControlGroup(ctx: WidgetContext): UntypedFormArray | UntypedFormGroup;
getFormControlName(ctx: WidgetContext): string;
getLayoutArray(ctx: WidgetContext): any[];
getParentNode(ctx: WidgetContext): any;
getDataPointer(ctx: WidgetContext): string;
getLayoutPointer(ctx: WidgetContext): string;
isControlBound(ctx: WidgetContext): boolean;
addItem(ctx: WidgetContext, name?: string): boolean;
moveArrayItem(ctx: WidgetContext, oldIndex: number, newIndex: number, moveLayout?: boolean): boolean;
removeItem(ctx: WidgetContext): boolean;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<JsonSchemaFormService, never>;
static ɵprov: _angular_core.ɵɵInjectableDeclaration<JsonSchemaFormService>;
}
/**
* @module 'JsonSchemaFormComponent' - Angular JSON Schema Form
*
* Root module of the Angular JSON Schema Form client-side library,
* an Angular library which generates an HTML form from a JSON schema
* structured data model and/or a JSON Schema Form layout description.
*
* This library also validates input data by the user, using both validators on
* individual controls to provide real-time feedback while the user is filling
* out the form, and then validating the entire input against the schema when
* the form is submitted to make sure the returned JSON data object is valid.
*
* This library is similar to, and mostly API compatible with:
*
* - JSON Schema Form's Angular Schema Form library for AngularJs
* http://schemaform.io
* http://schemaform.io/examples/bootstrap-example.html (examples)
*
* - Mozilla's react-jsonschema-form library for React
* https://github.com/mozilla-services/react-jsonschema-form
* https://mozilla-services.github.io/react-jsonschema-form (examples)
*
* - Joshfire's JSON Form library for jQuery
* https://github.com/joshfire/jsonform
* http://ulion.github.io/jsonform/playground (examples)
*
* This library depends on:
* - Angular (obviously) https://angular.io
* - lodash, JavaScript utility library https://github.com/lodash/lodash
* - ajv, Another JSON Schema validator https://github.com/epoberezkin/ajv
*
* In addition, the Example Playground also depends on:
* - brace, Browserified Ace editor http://thlorenz.github.io/brace
*/
declare class JsonSchemaFormComponent implements ControlValueAccessor, OnChanges, OnInit, OnDestroy {
private changeDetector;
private frameworkLibrary;
private widgetLibrary;
jsf: JsonSchemaFormService;
private unsubscribeOnActivateForm$;
debugOutput: any;
formValueSubscription: any;
formInitialized: boolean;
objectWrap: boolean;
formValuesInput: string;
previousInputs: {
schema: any;
layout: any[];
data: any;
options: any;
framework: any | string;
widgets: any;
form: any;
model: any;
JSONSchema: any;
UISchema: any;
formData: any;
loadExternalAssets: boolean;
debug: boolean;
ajvOptions: any;
};
readonly schema: _angular_core.InputSignal<any>;
readonly layout: _angular_core.InputSignal<any[]>;
readonly data: _angular_core.InputSignal<any>;
readonly options: _angular_core.InputSignal<any>;
readonly framework: _angular_core.InputSignal<any>;
readonly widgets: _angular_core.InputSignal<any>;
readonly form: _angular_core.InputSignal<any>;
readonly model: _angular_core.InputSignal<any>;
readonly JSONSchema: _angular_core.InputSignal<any>;
readonly UISchema: _angular_core.InputSignal<any>;
readonly formData: _angular_core.InputSignal<any>;
readonly ngModel: _angular_core.InputSignal<any>;
readonly language: _angular_core.InputSignal<string>;
readonly loadExternalAssets: _angular_core.InputSignal<boolean>;
readonly debug: _angular_core.InputSignal<boolean>;
readonly theme: _angular_core.InputSignal<string>;
readonly ajvOptions: _angular_core.InputSignal<any>;
private ajvInstanceName;
get value(): any;
set value(value: any);
readonly onChanges: _angular_core.OutputEmitterRef<any>;
readonly onSubmit: _angular_core.OutputEmitterRef<any>;
readonly isValid: _angular_core.OutputEmitterRef<boolean>;
readonly validationErrors: _angular_core.OutputEmitterRef<any>;
readonly formSchema: _angular_core.OutputEmitterRef<any>;
readonly formLayout: _angular_core.OutputEmitterRef<any>;
readonly dataChange: _angular_core.OutputEmitterRef<any>;
readonly modelChange: _angular_core.OutputEmitterRef<any>;
readonly formDataChange: _angular_core.OutputEmitterRef<any>;
readonly ngModelChange: _angular_core.OutputEmitterRef<any>;
onChange: Function;
onTouched: Function;
dataChangesSubs: Subscription;
statusChangesSubs: Subscription;
isValidChangesSubs: Subscription;
validationErrorChangesSubs: Subscription;
ngOnDestroy(): void;
private getInputValue;
private resetScriptsAndStyleSheets;
private loadScripts;
private loadStyleSheets;
private loadAssets;
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
writeValue(value: any): void;
registerOnChange(fn: Function): void;
registerOnTouched(fn: Function): void;
setDisabledState(isDisabled: boolean): void;
updateForm(): void;
setFormValues(formValues: any, resetFirst?: boolean): void;
submitForm(): void;
/**
* 'initializeForm' function
*
* - Update 'schema', 'layout', and 'formValues', from inputs.
*
* - Create 'schemaRefLibrary' and 'schemaRecursiveRefMap'
* to resolve schema $ref links, including recursive $ref links.
*
* - Create 'dataRecursiveRefMap' to resolve recursive links in data
* and corectly set output formats for recursively nested values.
*
* - Create 'layoutRefLibrary' and 'templateRefLibrary' to store
* new layout nodes and formGroup elements to use when dynamically
* adding form components to arrays and recursive $ref points.
*
* - Create 'dataMap' to map the data to the schema and template.
*
* - Create the master 'formGroupTemplate' then from it 'formGroup'
* the Angular formGroup used to control the reactive form.
*/
initializeForm(initialData?: any): void;
/**
* 'initializeAjv' function
*
* Initialize ajv from 'ajvOptions'
*/
private initializeAjv;
/**
* 'initializeOptions' function
*
* Initialize 'options' (global form options) and set framework
* Combine available inputs:
* 1. options - recommended
* 2. form.options - Single input style
*/
private initializeOptions;
/**
* 'initializeSchema' function
*
* Initialize 'schema'
* Use first available input:
* 1. schema - recommended / Angular Schema Form style
* 2. form.schema - Single input / JSON Form style
* 3. JSONSchema - React JSON Schema Form style
* 4. form.JSONSchema - For testing single input React JSON Schema Forms
* 5. form - For testing single schema-only inputs
*
* ... if no schema input found, the 'activateForm' function, below,
* will make two additional attempts to build a schema
* 6. If layout input - build schema from layout
* 7. If data input - build schema from data
*/
private initializeSchema;
/**
* 'initializeData' function
*
* Initialize 'formValues'
* defulat or previously submitted values used to populate form
* Use first available input:
* 1. data - recommended
* 2. model - Angular Schema Form style
* 3. form.value - JSON Form style
* 4. form.data - Single input style
* 5. formData - React JSON Schema Form style
* 6. form.formData - For easier testing of React JSON Schema Forms
* 7. (none) no data - initialize data from schema and layout defaults only
*/
private initializeData;
/**
* 'initializeLayout' function
*
* Initialize 'layout'
* Use first available array input:
* 1. layout - recommended
* 2. form - Angular Schema Form style
* 3. form.form - JSON Form style
* 4. form.layout - Single input style
* 5. (none) no layout - set default layout instead
* (full layout will be built later from the schema)
*
* Also, if alternate layout formats are available,
* import from 'UISchema' or 'customFormItems'
* used for React JSON Schema Form and JSON Form API compatibility
* Use first available input:
* 1. UISchema - React JSON Schema Form style
* 2. form.UISchema - For testing single input React JSON Schema Forms
* 2. form.customFormItems - JSON Form style
* 3. (none) no input - don't import
*/
private initializeLayout;
/**
* 'activateForm' function
*
* ...continued from 'initializeSchema' function, above
* If 'schema' has not been initialized (i.e. no schema input found)
* 6. If layout input - build schema from layout input
* 7. If data input - build schema from data input
*
* Create final layout,
* build the FormGroup template and the Angular FormGroup,
* subscribe to changes,
* and activate the form.
*/
private activateForm;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<JsonSchemaFormComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<JsonSchemaFormComponent, "json-schema-form", never, { "schema": { "alias": "schema"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "framework": { "alias": "framework"; "required": false; "isSignal": true; }; "widgets": { "alias": "widgets"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": false; "isSignal": true; }; "JSONSchema": { "alias": "JSONSchema"; "required": false; "isSignal": true; }; "UISchema": { "alias": "UISchema"; "required": false; "isSignal": true; }; "formData": { "alias": "formData"; "required": false; "isSignal": true; }; "ngModel": { "alias": "ngModel"; "required": false; "isSignal": true; }; "language": { "alias": "language"; "required": false; "isSignal": true; }; "loadExternalAssets": { "alias": "loadExternalAssets"; "required": false; "isSignal": true; }; "debug": { "alias": "debug"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "ajvOptions": { "alias": "ajvOptions"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; }; }, { "onChanges": "onChanges"; "onSubmit": "onSubmit"; "isValid": "isValid"; "validationErrors": "validationErrors"; "formSchema": "formSchema"; "formLayout": "formLayout"; "dataChange": "dataChange"; "modelChange": "modelChange"; "formDataChange": "formDataChange"; "ngModelChange": "ngModelChange"; }, never, never, false, never>;
}
declare class AddReferenceComponent implements OnInit {
private jsf;
options: any;
itemCount: number;
previousLayoutIndex: number[];
previousDataIndex: number[];
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
ngOnInit(): void;
get showAddButton(): boolean;
addItem(event: any): void;
get buttonText(): string;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AddReferenceComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AddReferenceComponent, "add-reference-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class OneOfComponent implements OnInit, OnDestroy {
private jsf;
formControl: AbstractControl;
controlName: string;
controlValue: any;
controlDisabled: boolean;
boundControl: boolean;
options: any;
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
ngOnInit(): void;
findSelectedTab(): number;
updateValue(event: any): void;
ngOnDestroy(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<OneOfComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<OneOfComponent, "one-of-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class ButtonComponent implements OnInit, OnDestroy {
private jsf;
formControl: AbstractControl;
controlName: string;
controlValue: any;
controlDisabled: boolean;
boundControl: boolean;
options: any;
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
ngOnInit(): void;
updateValue(event: any): void;
ngOnDestroy(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ButtonComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ButtonComponent, "button-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class CheckboxComponent implements OnInit, OnDestroy {
private jsf;
formControl: AbstractControl;
controlName: string;
controlValue: any;
controlDisabled: boolean;
boundControl: boolean;
options: any;
trueValue: any;
falseValue: any;
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
ngOnInit(): void;
updateValue(event: any): void;
get isChecked(): boolean;
ngOnDestroy(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CheckboxComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CheckboxComponent, "checkbox-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class CheckboxesComponent implements OnInit, OnDestroy {
private jsf;
formControl: AbstractControl;
controlName: string;
controlValue: any;
controlDisabled: boolean;
boundControl: boolean;
options: any;
layoutOrientation: string;
formArray: AbstractControl;
checkboxList: TitleMapItem[];
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
ngOnInit(): void;
updateValue(event: any): void;
ngOnDestroy(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CheckboxesComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CheckboxesComponent, "checkboxes-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class FileComponent implements OnInit, OnDestroy {
private jsf;
formControl: AbstractControl;
controlName: string;
controlValue: any;
controlDisabled: boolean;
boundControl: boolean;
options: any;
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
ngOnInit(): void;
updateValue(event: any): void;
ngOnDestroy(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FileComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FileComponent, "file-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class HiddenComponent implements OnInit, OnDestroy {
private jsf;
formControl: AbstractControl;
controlName: string;
controlValue: any;
controlDisabled: boolean;
boundControl: boolean;
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
ngOnInit(): void;
ngOnDestroy(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HiddenComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HiddenComponent, "hidden-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class InputComponent implements OnInit, OnDestroy {
private jsf;
formControl: AbstractControl;
controlName: string;
controlValue: string;
controlDisabled: boolean;
boundControl: boolean;
options: any;
autoCompleteList: string[];
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
get inputAttributes(): any;
ngOnInit(): void;
updateValue(event: any): void;
ngOnDestroy(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<InputComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<InputComponent, "input-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class MessageComponent implements OnInit {
private jsf;
options: any;
message: string;
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
ngOnInit(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MessageComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MessageComponent, "message-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class NoneComponent {
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NoneComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NoneComponent, "none-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class NumberComponent implements OnInit, OnDestroy {
private jsf;
formControl: AbstractControl;
controlName: string;
controlValue: any;
controlDisabled: boolean;
boundControl: boolean;
options: any;
allowNegative: boolean;
allowDecimal: boolean;
allowExponents: boolean;
lastValidNumber: string;
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
get inputAttributes(): any;
inputControl: ElementRef;
div: ElementRef;
ngOnInit(): void;
updateValue(event: any): void;
ngOnDestroy(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NumberComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NumberComponent, "number-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class RadiosComponent implements OnInit, OnDestroy {
private jsf;
formControl: AbstractControl;
controlName: string;
controlValue: any;
controlDisabled: boolean;
boundControl: boolean;
options: any;
layoutOrientation: string;
radiosList: any[];
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
ngOnInit(): void;
updateValue(event: any): void;
ngOnDestroy(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RadiosComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RadiosComponent, "radios-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class RootComponent implements OnInit, OnDestroy {
private jsf;
options: any;
readonly dataIndex: _angular_core.InputSignal<number[]>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly layout: _angular_core.InputSignal<any[]>;
readonly isOrderable: _angular_core.InputSignal<boolean>;
readonly isFlexItem: _angular_core.InputSignal<boolean>;
sortableObj: any;
sortableConfig: any;
private sortableOptionsSubscription;
sortableInit(sortable: any): void;
isDraggable(node: any): boolean;
isFixed(node: any): boolean;
getFlexAttribute(node: any, attribute: string): any;
showWidget(layoutNode: any): boolean;
ngOnInit(): void;
ngOnDestroy(): void;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RootComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RootComponent, "root-widget", never, { "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "isOrderable": { "alias": "isOrderable"; "required": false; "isSignal": true; }; "isFlexItem": { "alias": "isFlexItem"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
declare class SectionComponent implements OnInit {
private jsf;
options: any;
expanded: boolean;
containerType: string;
readonly layoutNode: _angular_core.InputSignal<any>;
readonly layoutIndex: _angular_core.InputSignal<number[]>;
readonly dataIndex: _angular_core.InputSignal<number[]>;
get sectionTitle(): string;
ngOnInit(): void;
toggleExpanded(): void;
getFlexAttribute(attribute: string): any;
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SectionComponent, never>;
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SectionComponent, "section-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; "isSignal": true; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; "isSignal": true; }; "dataIndex": { "alias": "dataIndex"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>;
}
/**
* Validator utility function library:
*
* Validator and error utilities:
* _executeValidators, _executeAsyncValidators, _mergeObjects, _mergeErrors
*
* Individual value checking:
* isDefined, hasValue, isEmpty
*
* Individual type checking:
* isString, isNumber, isInteger, isBoolean, isFunction, isObject, isArray,
* isMap, isSet, isPromise, isObservable
*
* Multiple type checking and fixing:
* getType, isType, isPrimitive, toJavaScriptType, toSchemaType,
* _toPromise, toObservable
*
* Utility functions:
* inArray, xor
*
* Typescript types and interfaces:
* SchemaPrimitiveType, SchemaType, JavaScriptPrimitiveType, JavaScriptType,
* PrimitiveValue, PlainObject, IValidatorFn, AsyncIValidatorFn
*
* Note: 'IValidatorFn' is short for 'invertable validator function',
* which is a validator functions that accepts an optional second
* argument which, if set to TRUE, causes the validator to perform
* the opposite of its original function.
*/
type SchemaPrimitiveType = 'string' | 'number' | 'integer' | 'boolean' | 'null';
type SchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'null' | 'object' | 'array';
type JavaScriptPrimitiveType = 'string' | 'number' | 'boolean' | 'null' | 'undefined';
type JavaScriptType = 'string' | 'number' | 'boolean' | 'null' | 'undefined' | 'object' | 'array' | 'map' | 'set' | 'arguments' | 'date' | 'error' | 'function' | 'json' | 'math' | 'regexp';
type PrimitiveValue = string | number | boolean | null | undefined;
interface PlainObject {
[k: string]: any;
}
type IValidatorFn = (c: AbstractControl, i?: boolean) => PlainObject;
type AsyncIValidatorFn = (c: AbstractControl, i?: boolean) => any;
/**
* '_executeValidators' utility function
*
* Validates a control against an array of validators, and returns
* an array of the same length containing a combination of error messages
* (from invalid validators) and null values (from valid validators)
*
* // { AbstractControl } control - control to validate
* // { IValidatorFn[] } validators - array of validators
* // { boolean } invert - invert?
* // { PlainObject[] } - array of nulls and error message
*/
declare function _executeValidators(control: any, validators: any, invert?: boolean): any;
/**
* '_executeAsyncValidators' utility function
*
* Validates a control against an array of async validators, and returns
* an array of observabe results of the same length containing a combination of
* error messages (from invalid validators) and null values (from valid ones)
*
* // { AbstractControl } control - control to validate
* // { AsyncIValidatorFn[] } validators - array of async validators
* // { boolean } invert - invert?
* // - array of observable nulls and error message
*/
declare function _executeAsyncValidators(control: any, validators: any, invert?: boolean): any;
/**
* '_mergeObjects' utility function
*
* Recursively Merges one or more objects into a single object with combined keys.
* Automatically detects and ignores null and undefined inputs.
* Also detects duplicated boolean 'not' keys and XORs their values.
*
* // { PlainObject[] } objects - one or more objects to merge
* // { PlainObject } - merged object
*/
declare function _mergeObjects(...objects: any[]): PlainObject;
/**
* '_mergeErrors' utility function
*
* Merges an array of objects.
* Used for combining the validator errors returned from 'executeValidators'
*
* // { PlainObject[] } arrayOfErrors - array of objects
* // { PlainObject } - merged object, or null if no usable input objectcs
*/
declare function _mergeErrors(arrayOfErrors: any): PlainObject;
/**
* 'isDefined' utility function
*
* Checks if a variable contains a value of any type.
* Returns true even for otherwise 'falsey' values of 0, '', and false.
*
* // value - the value to check
* // { boolean } - false if undefined or null, otherwise true
*/
declare function isDefined(value: any): boolean;
/**
* 'hasValue' utility function
*
* Checks if a variable contains a value.
* Returs false for null, undefined, or a zero-length strng, '',
* otherwise returns true.
* (Stricter than 'isDefined' because it also returns false for '',
* though it stil returns true for otherwise 'falsey' values 0 and false.)
*
* // value - the value to check
* // { boolean } - false if undefined, null, or '', otherwise true
*/
declare function hasValue(value: any): boolean;
/**
* 'isEmpty' utility function
*
* Similar to !hasValue, but also returns true for empty arrays and objects.
*
* // value - the value to check
* // { boolean } - false if undefined, null, or '', otherwise true
*/
declare function isEmpty(value: any): boolean;
/**
* 'isString' utility function
*
* Checks if a value is a string.
*
* // value - the value to check
* // { boolean } - true if string, false if not
*/
declare function isString(value: any): value is string;
/**
* 'isNumber' utility function
*
* Checks if a value is a regular number, numeric string, or JavaScript Date.
*
* // value - the value to check
* // { any = false } strict - if truthy, also checks JavaScript tyoe
* // { boolean } - true if number, false if not
*/
declare function isNumber(value: any, strict?: any): boolean;
/**
* 'isInteger' utility function
*
* Checks if a value is an integer.
*
* // value - the value to check
* // { any = false } strict - if truthy, also checks JavaScript tyoe
* // {boolean } - true if number, false if not
*/
declare function isInteger(value: any, strict?: any): boolean;
/**
* 'isBoolean' utility function
*
* Checks if a value is a boolean.
*
* // value - the value to check
* // { any = null } option - if 'strict', also checks JavaScript type
* if TRUE or FALSE, checks only for that value
* // { boolean } - true if boolean, false if not
*/
declare function isBoolean(value: any, option?: any): boolean;
declare function isFunction(item: any): boolean;
declare function isObject(item: any): boolean;
declare function isArray(item: any): boolean;
declare function isDate(item: any): boolean;
declare function isMap(item: any): boolean;
declare function isSet(item: any): boolean;
/**
* 'getType' function
*
* Detects the JSON Schema Type of a value.
* By default, detects numbers and integers even if formatted as strings.
* (So all integers are also numbers, and any number may also be a string.)
* However, it only detects true boolean values (to detect boolean values
* in non-boolean formats, use isBoolean() instead).
*
* If passed a second optional parameter of 'strict', it will only detect
* numbers and integers if they are formatted as JavaScript numbers.
*
* Examples:
* getType('10.5') = 'number'
* getType(10.5) = 'number'
* getType('10') = 'integer'
* getType(10) = 'integer'
* getType('true') = 'string'
* getType(true) = 'boolean'
* getType(null) = 'null'
* getType({ }) = 'object'
* getType([]) = 'array'
*
* getType('10.5', 'strict') = 'string'
* getType(10.5, 'strict') = 'number'
* getType('10', 'strict') = 'string'
* getType(10, 'strict') = 'integer'
* getType('true', 'strict') = 'string'
* getType(true, 'strict') = 'boolean'
*
* // value - value to check
* // { any = false } strict - if truthy, also checks JavaScript tyoe
* // { SchemaType }
*/
declare function getType(value: any, strict?: any): "string" | "number" | "integer" | "boolean" | "null" | "object" | "array";
/**
* 'isType' function
*
* Checks wether an input (probably string) value contains data of
* a specified JSON Schema type
*
* // { PrimitiveValue } value - value to check
* // { SchemaPrimitiveType } type - type to check
* // { boolean }
*/
declare function isType(value: any, type: any): boolean;
/**
* 'isPrimitive' function
*
* Checks wether an input value is a JavaScript primitive type:
* string, number, boolean, or null.
*
* // value - value to check
* // { boolean }
*/
declare function isPrimitive(value: any): boolean;
/**
* 'toJavaScriptType' function
*
* Converts an input (probably string) value to a JavaScript primitive type -
* 'string', 'number', 'boolean', or 'null' - before storing in a JSON object.
*
* Does not coerce values (other than null), and only converts the types
* of values that would otherwise be valid.
*
* If the optional third parameter 'strictIntegers' is TRUE, and the
* JSON Schema type 'integer' is specified, it also verifies the input value
* is an integer and, if it is, returns it as a JaveScript number.
* If 'strictIntegers' is FALSE (or not set) the type 'integer' is treated
* exactly the same as 'number', and allows decimals.
*
* Valid Examples:
* toJavaScriptType('10', 'number' ) = 10 // '10' is a number
* toJavaScriptType('10', 'integer') = 10 // '10' is also an integer
* toJavaScriptType( 10, 'integer') = 10 // 10 is still an integer
* toJavaScriptType( 10, 'string' ) = '10' // 10 can be made into a string
* toJavaScriptType('10.5', 'number' ) = 10.5 // '10.5' is a number
*
* Invalid Examples:
* toJavaScriptType('10.5', 'integer') = null // '10.5' is not an integer
* toJavaScriptType( 10.5, 'integer') = null // 10.5 is still not an integer
*
* // { PrimitiveValue } value - value to convert
* // { SchemaPrimitiveType | SchemaPrimitiveType[] } types - types to convert to
* // { boolean = false } strictIntegers - if FALSE, treat integers as numbers
* // { PrimitiveValue }
*/
declare function toJavaScriptType(value: any, types: any, strictIntegers?: boolean): any;
/**
* 'toSchemaType' function
*
* Converts an input (probably string) value to the "best" JavaScript
* equivalent available from an allowed list of JSON Schema types, which may
* contain 'string', 'number', 'integer', 'boolean', and/or 'null'.
* If necssary, it does progressively agressive type coersion.
* It will not return null unless null is in the list of allowed types.
*
* Number conversion examples:
* toSchemaType('10', ['number','integer','string']) = 10 // integer
* toSchemaType('10', ['number','string']) = 10 // number
* toSchemaType('10', ['string']) = '10' // string
* toSchemaType('10.5', ['number','integer','string']) = 10.5 // number
* toSchemaType('10.5', ['integer','string']) = '10.5' // string
* toSchemaType('10.5', ['integer']) = 10 // integer
* toSchemaType(10.5, ['null','boolean','string']) = '10.5' // string
* toSchemaType(10.5, ['null','boolean']) = true // boolean
*
* String conversion examples:
* toSchemaType('1.5x', ['boolean','number','integer','string']) = '1.5x' // string
* toSchemaType('1.5x', ['boolean','number','integer']) = '1.5' // number
* toSchemaType('1.5x', ['boolean','integer']) = '1' // integer
* toSchemaType('1.5x', ['boolean']) = true // boolean
* toSchemaType('xyz', ['number','integer','boolean','null']) = true // boolean
* toSchemaType('xyz', ['number','integer','null']) = null // null
* toSchemaType('xyz', ['number','integer']) = 0 // number
*
* Boolean conversion examples:
* toSchemaType('1', ['integer','number','string','boolean']) = 1 // integer
* toSchemaType('1', ['number','string','boolean']) = 1 // number
* toSchemaType('1', ['string','boolean']) = '1' // string
* toSchemaType('1', ['boolean']) = true // boolean
* toSchemaType('true', ['number','string','boolean']) = 'true' // string
* toSchemaType('true', ['boolean']) = true // boolean
* toSchemaType('true', ['number']) = 0 // number
* toSchemaType(true, ['number','string','boolean']) = true // boolean
* toSchemaType(true, ['number','string']) = 'true' // string
* toSchemaType(true, ['number']) = 1 // number
*
* // { PrimitiveValue } value - value to convert
* // { SchemaPrimitiveType | SchemaPrimitiveType[] } types - allowed types to convert to
* // { PrimitiveValue }
*/
declare function toSchemaType(value: any, types: any): any;
/**
* 'isPromise' function
*
* // object
* // { boolean }
*/
declare function isPromise(object: any): object is Promise<any>;
/**
* 'isObservable' function
*
* // object
* // { boolean }
*/
declare function isObservable(object: any): object is Observable<any>;
/**
* '_toPromise' function
*
* // { object } object
* // { Promise<any> }
*/
declare function _toPromise(object: any): Promise<any>;
/**
* 'toObservable' function
*
* // { object } object
* // { Observable<any> }
*/
declare function toObservable(object: any): Observable<any>;
/**
* 'inArray' function
*
* Searches an array for an item, or one of a list of items, and returns true
* as soon as a match is found, or false if no match.
*
* If the optional third parameter allIn is set to TRUE, and the item to find
* is an array, then the function returns true only if all elements from item
* are found in the array list, and false if any element is not found. If the
* item to find is not an array, setting allIn to TRUE has no effect.
*
* // { any|any[] } item - the item to search for
* // array - the array to search
* // { boolean = false } allIn - if TRUE, all items must be in array
* // { boolean } - true if item(s) in array, false otherwise
*/
declare function inArray(item: any, array: any, allIn?: boolean): any;
/**
* 'xor' utility function - exclusive or
*
* Returns true if exactly one of two values is truthy.
*
* // value1 - first value to check
* // value2 - second value to check
* // { boolean } - true if exactly one input value is truthy, false if not
*/
declare function xor(value1: any, value2: any): boolean;
/**
* Utility function library:
*
* addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject,
* uniqueItems, commonItems, fixTitle, toTitleCase
*/
/**
* 'addClasses' function
*
* Merges two space-delimited lists of CSS classes and removes duplicates.
*
* // {string | string[] | Set<string>} oldClasses
* // {string | string[] | Set<string>} newClasses
* // {string | string[] | Set<string>} - Combined classes
*/
declare function addClasses(oldClasses: string | string[] | Set<string>, newClasses: string | string[] | Set<string>): string | string[] | Set<string>;
/**
* 'copy' function
*
* Makes a shallow copy of a JavaScript object, array, Map, or Set.
* If passed a JavaScript primitive value (string, number, boolean, or null),
* it returns the value.
*
* // {Object|Array|string|number|boolean|null} object - The object to copy
* // {boolean = false} errors - Show errors?
* // {Object|Array|string|number|boolean|null} - The copied object
*/
declare function copy(object: any, errors?: boolean): any;
/**
* 'forEach' function
*
* Iterates over all items in the first level of an object or array
* and calls an iterator funciton on each item.
*
* The iterator function is called with four values:
* 1. The current item's value
* 2. The current item's key
* 3. The parent object, which contains the current item
* 4. The root object
*
* Setting the optional third parameter to 'top-down' or 'bottom-up' will cause
* it to also recursively iterate over items in sub-objects or sub-arrays in the
* specified direction.
*
* // {Object|Array} object - The object or array to iterate over
* // {function} fn - the iterator funciton to call on each item
* // {boolean = false} errors - Show errors?
* // {void}
*/
declare function forEach(object: any, fn: (v: any, k?: string | number, c?: any, rc?: any) => any, recurse?: boolean | string, rootObject?: any, errors?: boolean): void;
/**
* 'forEachCopy' function
*
* Iterates over all items in the first level of an object or array
* and calls an iterator function on each item. Returns a new object or array
* with the same keys or indexes as the original, and values set to the results
* of the iterator function.
*
* Does NOT recursively iterate over items in sub-objects or sub-arrays.
*
* // {Object | Array} object - The object or array to iterate over
* // {function} fn - The iterator funciton to call on each item
* // {boolean = false} errors - Show errors?
* // {Object | Array} - The resulting object or array
*/
declare function forEachCopy(object: any, fn: (v: any, k?: string | number, o?: any, p?: string) => any, errors?: boolean): any;
/**
* 'hasOwn' utility function
*
* Checks whether an object or array has a particular property.
*
* // {any} object - the object to check
* // {string} property - the property to look for
* // {boolean} - true if object has property, false if not
*/
declare function hasOwn(object: any, property: string): boolean;
/**
* 'mergeFilteredObject' utility function
*
* Shallowly merges two objects, setting key and values from source object
* in target object, excluding specified keys.
*
* Optionally, it can also use functions to transform the key names and/or
* the values of the merging object.
*
* // {PlainObject} targetObject - Target object to add keys and values to
* // {PlainObject} sourceObject - Source object to copy keys and values from
* // {string[]} excludeKeys - Array of keys to exclude
* // {(string: string) => string = (k) => k} keyFn - Function to apply to keys
* // {(any: any) => any = (v) => v} valueFn - Function to apply to values
* // {PlainObject} - Returns targetObject
*/
declare function mergeFilteredObject(targetObject: PlainObject, sourceObject: PlainObject, excludeKeys?: string[], keyFn?: (key: string) => string, valFn?: (val: any) => any): PlainObject;
/**
* 'uniqueItems' function
*
* Accepts any number of string value inputs,
* and returns an array of all input vaues, excluding duplicates.
*
* // {...string} ...items -
* // {string[]} -
*/
declare function uniqueItems(...items: any[]): string[];
/**
* 'commonItems' function
*
* Accepts any number of strings or arrays of string values,
* and returns a single array containing only values present in all inputs.
*
* // {...string|string[]} ...arrays -
* // {string[]} -
*/
declare function commonItems(...arrays: any[]): string[];
/**
* 'fixTitle' function
*
*
* // {string} input -
* // {string} -
*/
declare function fixTitle(name: string): string;
/**
* 'toTitleCase' function
*
* Intelligently converts an input string to Title Case.
*
* Accepts an optional second parameter with a list of additional
* words and abbreviations to force into a particular case.
*
* This function is built on prior work by John Gruber and David Gouch:
* http://daringfireball.net/2008/08/title_case_update
* https://github.com/gouch/to-title-case
*
* // {string} input -
* // {string|string[]} forceWords? -
* // {string} -
*/
declare function toTitleCase(input: string, forceWords?: string | string[]): string;
/**
* Recursively checks if at least one property of the given object (including nested objects)
* has a non-null and non-undefined value.
*
* @param obj - The object to check.
* @returns `true` if at least one property has a non-null and non-undefined value, otherwise `false`.
*
* @example
* const testObj = { a: null, b: { b1: null, b2: undefined } };
* console.log(hasNonNullValue(testObj)); // Output: false
*
* const testObj2 = { a: 1, b: { b1: null, b2: undefined } };
* console.log(hasNonNullValue(testObj2)); // Output: true
*/
declare function hasNonNullValue(obj: Record<string, any>): boolean;
/**
* 'JsonPointer' class
*
* Some utilities for using JSON Pointers with JSON objects
* https://tools.ietf.org/html/rfc6901
*
* get, getCopy, getFirst, set, setCopy, insert, insertCopy, remove, has, dict,
* forEachDeep, forEachDeepCopy, escape, unescape, parse, compile, toKey,
* isJsonPointer, isSubPointer, toIndexedPointer, toGenericPointer,
* toControlPointer, toSchemaPointer, toDataPointer, parseObjectPath
*
* Some functions based on manuelstofer's json-pointer utilities
* https://github.com/manuelstofer/json-pointer
*/
type Pointer = string | string[];
declare class JsonPointer {
/**
* 'get' function
*
* Uses a JSON Pointer to retrieve a value fr