/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { inject, Injectable } from '@angular/core'; import { AbstractControl } from './model/abstract_model'; import { FormArray } from './model/form_array'; import { FormControl } from './model/form_control'; import { FormGroup, FormRecord } from './model/form_group'; import * as i0 from "@angular/core"; function isAbstractControlOptions(options) { return !!options && (options.asyncValidators !== undefined || options.validators !== undefined || options.updateOn !== undefined); } // clang-format on /** * @description * Creates an `AbstractControl` from a user-specified configuration. * * The `FormBuilder` provides syntactic sugar that shortens creating instances of a * `FormControl`, `FormGroup`, or `FormArray`. It reduces the amount of boilerplate needed to * build complex forms. * * @see [Reactive Forms Guide](guide/reactive-forms) * * @publicApi */ export class FormBuilder { constructor() { this.useNonNullable = false; } /** * @description * Returns a FormBuilder in which automatically constructed `FormControl` elements * have `{nonNullable: true}` and are non-nullable. * * **Constructing non-nullable controls** * * When constructing a control, it will be non-nullable, and will reset to its initial value. * * ```ts * let nnfb = new FormBuilder().nonNullable; * let name = nnfb.control('Alex'); // FormControl * name.reset(); * console.log(name); // 'Alex' * ``` * * **Constructing non-nullable groups or arrays** * * When constructing a group or array, all automatically created inner controls will be * non-nullable, and will reset to their initial values. * * ```ts * let nnfb = new FormBuilder().nonNullable; * let name = nnfb.group({who: 'Alex'}); // FormGroup<{who: FormControl}> * name.reset(); * console.log(name); // {who: 'Alex'} * ``` * **Constructing *nullable* fields on groups or arrays** * * It is still possible to have a nullable field. In particular, any `FormControl` which is * *already* constructed will not be altered. For example: * * ```ts * let nnfb = new FormBuilder().nonNullable; * // FormGroup<{who: FormControl}> * let name = nnfb.group({who: new FormControl('Alex')}); * name.reset(); console.log(name); // {who: null} * ``` * * Because the inner control is constructed explicitly by the caller, the builder has * no control over how it is created, and cannot exclude the `null`. */ get nonNullable() { const nnfb = new FormBuilder(); nnfb.useNonNullable = true; return nnfb; } group(controls, options = null) { const reducedControls = this._reduceControls(controls); let newOptions = {}; if (isAbstractControlOptions(options)) { // `options` are `AbstractControlOptions` newOptions = options; } else if (options !== null) { // `options` are legacy form group options newOptions.validators = options.validator; newOptions.asyncValidators = options.asyncValidator; } return new FormGroup(reducedControls, newOptions); } /** * @description * Constructs a new `FormRecord` instance. Accepts a single generic argument, which is an object * containing all the keys and corresponding inner control types. * * @param controls A collection of child controls. The key for each child is the name * under which it is registered. * * @param options Configuration options object for the `FormRecord`. The object should have the * `AbstractControlOptions` type and might contain the following fields: * * `validators`: A synchronous validator function, or an array of validator functions. * * `asyncValidators`: A single async validator or array of async validator functions. * * `updateOn`: The event upon which the control should be updated (options: 'change' | 'blur' * | submit'). */ record(controls, options = null) { const reducedControls = this._reduceControls(controls); // Cast to `any` because the inferred types are not as specific as Element. return new FormRecord(reducedControls, options); } /** * @description * Constructs a new `FormControl` with the given state, validators and options. Sets * `{nonNullable: true}` in the options to get a non-nullable control. Otherwise, the * control will be nullable. Accepts a single generic argument, which is the type of the * control's value. * * @param formState Initializes the control with an initial state value, or * with an object that contains both a value and a disabled status. * * @param validatorOrOpts A synchronous validator function, or an array of * such functions, or a `FormControlOptions` object that contains * validation functions and a validation trigger. * * @param asyncValidator A single async validator or array of async validator * functions. * * @usageNotes * * ### Initialize a control as disabled * * The following example returns a control with an initial value in a disabled state. * * * */ control(formState, validatorOrOpts, asyncValidator) { let newOptions = {}; if (!this.useNonNullable) { return new FormControl(formState, validatorOrOpts, asyncValidator); } if (isAbstractControlOptions(validatorOrOpts)) { // If the second argument is options, then they are copied. newOptions = validatorOrOpts; } else { // If the other arguments are validators, they are copied into an options object. newOptions.validators = validatorOrOpts; newOptions.asyncValidators = asyncValidator; } return new FormControl(formState, { ...newOptions, nonNullable: true }); } /** * Constructs a new `FormArray` from the given array of configurations, * validators and options. Accepts a single generic argument, which is the type of each control * inside the array. * * @param controls An array of child controls or control configs. Each child control is given an * index when it is registered. * * @param validatorOrOpts A synchronous validator function, or an array of such functions, or an * `AbstractControlOptions` object that contains * validation functions and a validation trigger. * * @param asyncValidator A single async validator or array of async validator functions. */ array(controls, validatorOrOpts, asyncValidator) { const createdControls = controls.map(c => this._createControl(c)); // Cast to `any` because the inferred types are not as specific as Element. return new FormArray(createdControls, validatorOrOpts, asyncValidator); } /** @internal */ _reduceControls(controls) { const createdControls = {}; Object.keys(controls).forEach(controlName => { createdControls[controlName] = this._createControl(controls[controlName]); }); return createdControls; } /** @internal */ _createControl(controls) { if (controls instanceof FormControl) { return controls; } else if (controls instanceof AbstractControl) { // A control; just return it return controls; } else if (Array.isArray(controls)) { // ControlConfig Tuple const value = controls[0]; const validator = controls.length > 1 ? controls[1] : null; const asyncValidator = controls.length > 2 ? controls[2] : null; return this.control(value, validator, asyncValidator); } else { // T or FormControlState return this.control(controls); } } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormBuilder, providedIn: 'root' }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormBuilder, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }] }); /** * @description * `NonNullableFormBuilder` is similar to {@link FormBuilder}, but automatically constructed * {@link FormControl} elements have `{nonNullable: true}` and are non-nullable. * * @publicApi */ export class NonNullableFormBuilder { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NonNullableFormBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NonNullableFormBuilder, providedIn: 'root', useFactory: () => inject(FormBuilder).nonNullable }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NonNullableFormBuilder, decorators: [{ type: Injectable, args: [{ providedIn: 'root', useFactory: () => inject(FormBuilder).nonNullable, }] }] }); /** * UntypedFormBuilder is the same as `FormBuilder`, but it provides untyped controls. */ export class UntypedFormBuilder extends FormBuilder { group(controlsConfig, options = null) { return super.group(controlsConfig, options); } /** * Like `FormBuilder#control`, except the resulting control is untyped. */ control(formState, validatorOrOpts, asyncValidator) { return super.control(formState, validatorOrOpts, asyncValidator); } /** * Like `FormBuilder#array`, except the resulting array is untyped. */ array(controlsConfig, validatorOrOpts, asyncValidator) { return super.array(controlsConfig, validatorOrOpts, asyncValidator); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UntypedFormBuilder, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); } static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UntypedFormBuilder, providedIn: 'root' }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UntypedFormBuilder, decorators: [{ type: Injectable, args: [{ providedIn: 'root' }] }] }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybV9idWlsZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvZm9ybXMvc3JjL2Zvcm1fYnVpbGRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQUMsTUFBTSxFQUFFLFVBQVUsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUdqRCxPQUFPLEVBQUMsZUFBZSxFQUFvQyxNQUFNLHdCQUF3QixDQUFDO0FBQzFGLE9BQU8sRUFBQyxTQUFTLEVBQW1CLE1BQU0sb0JBQW9CLENBQUM7QUFDL0QsT0FBTyxFQUFDLFdBQVcsRUFBMkQsTUFBTSx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cDtcblxuICBncm91cChjb250cm9sczoge1trZXk6IHN0cmluZ106IGFueX0sIG9wdGlvbnM6IEFic3RyYWN0Q29udHJvbE9wdGlvbnN8e1trZXk6IHN0cmluZ106XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFueX18bnVsbCA9IG51bGwpOlxuICAgICAgRm9ybUdyb3VwIHtcbiAgICBjb25zdCByZWR1Y2VkQ29udHJvbHMgPSB0aGlzLl9yZWR1Y2VDb250cm9scyhjb250cm9scyk7XG4gICAgbGV0IG5ld09wdGlvbnM6IEZvcm1Db250cm9sT3B0aW9ucyA9IHt9O1xuICAgIGlmIChpc0Fic3RyYWN0Q29udHJvbE9wdGlvbnMob3B0aW9ucykpIHtcbiAgICAgIC8vIGBvcHRpb25zYCBhcmUgYEFic3RyYWN0Q29udHJvbE9wdGlvbnNgXG4gICAgICBuZXdPcHRpb25zID0gb3B0aW9ucztcbiAgICB9IGVsc2UgaWYgKG9wdGlvbnMgIT09IG51bGwpIHtcbiAgICAgIC8vIGBvcHRpb25zYCBhcmUgbGVnYWN5IGZvcm0gZ3JvdXAgb3B0aW9uc1xuICAgICAgbmV3T3B0aW9ucy52YWxpZGF0b3JzID0gKG9wdGlvbnMgYXMgYW55KS52YWxpZGF0b3I7XG4gICAgICBuZXdPcHRpb25zLmFzeW5jVmFsaWRhdG9ycyA9IChvcHRpb25zIGFzIGFueSkuYXN5bmNWYWxpZGF0b3I7XG4gICAgfVxuICAgIHJldHVybiBuZXcgRm9ybUdyb3VwKHJlZHVjZWRDb250cm9scywgbmV3T3B0aW9ucyk7XG4gIH1cblxuICAvKipcbiAgICogQGRlc2NyaXB0aW9uXG4gICAqIENvbnN0cnVjdHMgYSBuZXcgYEZvcm1SZWNvcmRgIGluc3RhbmNlLiBBY2NlcHRzIGEgc2luZ2xlIGdlbmVyaWMgYXJndW1lbnQsIHdoaWNoIGlzIGFuIG9iamVj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G4gIH1cblxuICAvKiogQGludGVybmFsICovXG4gIF9yZWR1Y2VDb250cm9sczxUPihjb250cm9sczpcbiAgICAgICAgICAgICAgICAgICAgICAgICB7W2s6IHN0cmluZ106IFR8Q29udHJvbENvbmZpZzxUPnxGb3JtQ29udHJvbFN0YXRlPFQ+fEFic3RyYWN0Q29udHJvbDxUPn0pOlxuICAgICAge1trZXk6IHN0cmluZ106IEFic3RyYWN0Q29udHJvbH0ge1xuICAgIGNvbnN0IGNyZWF0ZWRDb250cm9sczoge1trZXk6IHN0cmluZ106IEFic3RyYWN0Q29udHJvbH0gPSB7fTtcbiAgICBPYmplY3Qua2V5cyhjb250cm9scykuZm9yRWFjaChjb250cm9sTmFtZSA9PiB7XG4gICAgICBjcmVhdGVkQ29udHJvbHNbY29udHJvbE5hbWVdID0gdGhpcy5fY3JlYXRlQ29udHJvbChjb250cm9sc1tjb250cm9sTmFtZV0pO1xuICAgIH0pO1xuICAgIHJldHVybiBjcmVhdGVkQ29udHJvbHM7XG4gIH1cblxuICAvKiogQGludGVybmFsICovXG4gIF9jcmVhdGVDb250cm9sPFQ+KGNvbnRyb2xzOiBUfEZvcm1Db250cm9sU3RhdGU8VD58Q29udHJvbENvbmZpZzxUPnxGb3JtQ29udHJvbDxUPnxcbiAgICAgICAgICAgICAgICAgICAgQWJzdHJhY3RDb250cm9sPFQ+KTogRm9ybUNvbnRyb2w8VD58Rm9ybUNvbnRyb2w8VHxudWxsPnxBYnN0cmFjdENvbnRyb2w8VD4ge1xuICAgIGlmIChjb250cm9scyBpbnN0YW5jZW9mIEZvcm1Db250cm9sKSB7XG4gICAgICByZXR1cm4gY29udHJvbHMgYXMgRm9ybUNvbnRyb2w8VD47XG4gICAgfSBlbHNlIGlmIChjb250cm9scyBpbnN0YW5jZW9mIEFic3RyYWN0Q29udHJvbCkgeyAgLy8gQSBjb250cm9sOyBqdXN0IHJldHVybiBpdFxuICAgICAgcmV0dXJuIGNvbnRyb2xzO1xuICAgIH0gZWxzZSBp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