dist/@ajsf/core/esm2015/lib/json-schema-form.component.js
/**
     * '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.
     */


Create final layout,
build the FormGroup template and the Angular FormGroup,
subscribe to changes,
and activate the form.
Create final layout build the FormGroup template and the Angular FormGroup subscribe to changes and activate the form .
activateForm() {
        if (isEmpty(this.jsf.schema)) {
            if (!isEmpty(this.jsf.formValues)) {
                this.jsf.buildSchemaFromData();
            }
        }
        if (!isEmpty(this.jsf.schema)) {
            this.jsf.compileAjvSchema();
            this.jsf.buildLayout(this.widgetLibrary);
            this.jsf.buildFormGroupTemplate(this.jsf.formValues);
            this.jsf.buildFormGroup();
        }
        if (this.jsf.formGroup) {
            if (!isEmpty(this.jsf.formValues) &&
                this.jsf.formOptions.setSchemaDefaults !== true &&
                this.jsf.formOptions.setLayoutDefaults !== true) {
                this.setFormValues(this.jsf.formValues);
            }
            this.jsf.dataChanges.subscribe(data => {
                this.onChanges.emit(this.objectWrap ? data['1'] : data);
                if (this.formValuesInput && this.formValuesInput.indexOf('.') === -1) {
                    this[`${this.formValuesInput}Change`].emit(this.objectWrap ? data['1'] : data);
                }
            });
            this.jsf.formGroup.statusChanges.subscribe(() => this.changeDetector.markForCheck());
            this.jsf.isValidChanges.subscribe(isValid => this.isValid.emit(isValid));
            this.jsf.validationErrorChanges.subscribe(err => this.validationErrors.emit(err));
            this.formSchema.emit(this.jsf.schema);
            this.formLayout.emit(this.jsf.layout);
            this.onChanges.emit(this.objectWrap ? this.jsf.data['1'] : this.jsf.data);
            const validateOnRender = JsonPointer.get(this.jsf, '/formOptions/validateOnRender');
            if (validateOnRender) { 
                const touchAll = (control) => {
                    if (validateOnRender === true || hasValue(control.value)) {
                        control.markAsTouched();
                    }
                    Object.keys(control.controls || {})
                        .forEach(key => touchAll(control.controls[key]));
                };
                touchAll(this.jsf.formGroup);
                this.isValid.emit(this.jsf.isValid);
                this.validationErrors.emit(this.jsf.ajvErrors);
            }
        }
    }
activateForm ( ) { if ( isEmpty ( this . jsf . schema ) ) { if ( ! isEmpty ( this . jsf . formValues ) ) { this . jsf . buildSchemaFromData ( ) ; } } if ( ! isEmpty ( this . jsf . schema ) ) { this . jsf . compileAjvSchema ( ) ; this . jsf . buildLayout ( this . widgetLibrary ) ; this . jsf . buildFormGroupTemplate ( this . jsf . formValues ) ; this . jsf . buildFormGroup ( ) ; } if ( this . jsf . formGroup ) { if ( ! isEmpty ( this . jsf . formValues ) && this . jsf . formOptions . setSchemaDefaults !== true && this . jsf . formOptions . setLayoutDefaults !== true ) { this . setFormValues ( this . jsf . formValues ) ; } this . jsf . dataChanges . subscribe ( data => { this . onChanges . emit ( this . objectWrap ? data [ '1' ] : data ) ; if ( this . formValuesInput && this . formValuesInput . indexOf ( '.' ) === - 1 ) { this [ ` ${ this . formValuesInput } ` ] . emit ( this . objectWrap ? data [ '1' ] : data ) ; } } ) ; this . jsf . formGroup . statusChanges . subscribe ( ( ) => this . changeDetector . markForCheck ( ) ) ; this . jsf . isValidChanges . subscribe ( isValid => this . isValid . emit ( isValid ) ) ; this . jsf . validationErrorChanges . subscribe ( err => this . validationErrors . emit ( err ) ) ; this . formSchema . emit ( this . jsf . schema ) ; this . formLayout . emit ( this . jsf . layout ) ; this . onChanges . emit ( this . objectWrap ? this . jsf . data [ '1' ] : this . jsf . data ) ; const validateOnRender = JsonPointer . get ( this . jsf , '/formOptions/validateOnRender' ) ; if ( validateOnRender ) { const touchAll = ( control ) => { if ( validateOnRender === true || hasValue ( control . value ) ) { control . markAsTouched ( ) ; } Object . keys ( control . controls || { } ) . forEach ( key => touchAll ( control . controls [ key ] ) ) ; } ; touchAll ( this . jsf . formGroup ) ; this . isValid . emit ( this . jsf . isValid ) ; this . validationErrors . emit ( this . jsf . ajvErrors ) ; } } }
'activateForm' function
 ...continued from 'initializeSchema' function, above
 If 'schema' has not been initialized (i.e.
' activateForm ' function ... continued from ' initializeSchema ' function above If ' schema ' has not been initialized ( i . e .
// If 'schema' not initialized // TODO: If full layout input (with no '*'), build schema from layout // if (!this.jsf.layout.includes('*')) { //   this.jsf.buildSchemaFromLayout(); // } else // If data input, build schema from data // If not already initialized, initialize ajv and compile schema // Update all layout elements, add values, widgets, and validators, // replace any '*' with a layout built from all schema elements, // and update the FormGroup template with any new validators // Build the Angular FormGroup template from the schema // Build the real Angular FormGroup from the FormGroup template // Reset initial form values // TODO: Figure out how to display calculated values without changing object data // See http://ulion.github.io/jsonform/playground/?example=templating-values // Calculate references to other fields // if (!isEmpty(this.jsf.formGroup.value)) { //   forEach(this.jsf.formGroup.value, (value, key, object, rootObject) => { //     if (typeof value === 'string') { //       object[key] = this.jsf.parseText(value, value, rootObject, key); //     } //   }, 'top-down'); // } // Subscribe to form changes to output live data, validation, and errors // Trigger change detection on statusChanges to show updated errors // Output final schema, final layout, and initial data // If validateOnRender, output initial validation and any errors // validateOnRender === 'auto' || true