source: trip-planner-front/node_modules/@angular/forms/esm2015/src/model.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 219.7 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { EventEmitter } from '@angular/core';
9import { removeListItem } from './directives/shared';
10import { addValidators, composeAsyncValidators, composeValidators, hasValidator, removeValidators, toObservable } from './validators';
11/**
12 * Reports that a FormControl is valid, meaning that no errors exist in the input value.
13 *
14 * @see `status`
15 */
16export const VALID = 'VALID';
17/**
18 * Reports that a FormControl is invalid, meaning that an error exists in the input value.
19 *
20 * @see `status`
21 */
22export const INVALID = 'INVALID';
23/**
24 * Reports that a FormControl is pending, meaning that that async validation is occurring and
25 * errors are not yet available for the input value.
26 *
27 * @see `markAsPending`
28 * @see `status`
29 */
30export const PENDING = 'PENDING';
31/**
32 * Reports that a FormControl is disabled, meaning that the control is exempt from ancestor
33 * calculations of validity or value.
34 *
35 * @see `markAsDisabled`
36 * @see `status`
37 */
38export const DISABLED = 'DISABLED';
39function _find(control, path, delimiter) {
40 if (path == null)
41 return null;
42 if (!Array.isArray(path)) {
43 path = path.split(delimiter);
44 }
45 if (Array.isArray(path) && path.length === 0)
46 return null;
47 // Not using Array.reduce here due to a Chrome 80 bug
48 // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
49 let controlToFind = control;
50 path.forEach((name) => {
51 if (controlToFind instanceof FormGroup) {
52 controlToFind = controlToFind.controls.hasOwnProperty(name) ?
53 controlToFind.controls[name] :
54 null;
55 }
56 else if (controlToFind instanceof FormArray) {
57 controlToFind = controlToFind.at(name) || null;
58 }
59 else {
60 controlToFind = null;
61 }
62 });
63 return controlToFind;
64}
65/**
66 * Gets validators from either an options object or given validators.
67 */
68function pickValidators(validatorOrOpts) {
69 return (isOptionsObj(validatorOrOpts) ? validatorOrOpts.validators : validatorOrOpts) || null;
70}
71/**
72 * Creates validator function by combining provided validators.
73 */
74function coerceToValidator(validator) {
75 return Array.isArray(validator) ? composeValidators(validator) : validator || null;
76}
77/**
78 * Gets async validators from either an options object or given validators.
79 */
80function pickAsyncValidators(asyncValidator, validatorOrOpts) {
81 return (isOptionsObj(validatorOrOpts) ? validatorOrOpts.asyncValidators : asyncValidator) || null;
82}
83/**
84 * Creates async validator function by combining provided async validators.
85 */
86function coerceToAsyncValidator(asyncValidator) {
87 return Array.isArray(asyncValidator) ? composeAsyncValidators(asyncValidator) :
88 asyncValidator || null;
89}
90function isOptionsObj(validatorOrOpts) {
91 return validatorOrOpts != null && !Array.isArray(validatorOrOpts) &&
92 typeof validatorOrOpts === 'object';
93}
94/**
95 * This is the base class for `FormControl`, `FormGroup`, and `FormArray`.
96 *
97 * It provides some of the shared behavior that all controls and groups of controls have, like
98 * running validators, calculating status, and resetting state. It also defines the properties
99 * that are shared between all sub-classes, like `value`, `valid`, and `dirty`. It shouldn't be
100 * instantiated directly.
101 *
102 * @see [Forms Guide](/guide/forms)
103 * @see [Reactive Forms Guide](/guide/reactive-forms)
104 * @see [Dynamic Forms Guide](/guide/dynamic-form)
105 *
106 * @publicApi
107 */
108export class AbstractControl {
109 /**
110 * Initialize the AbstractControl instance.
111 *
112 * @param validators The function or array of functions that is used to determine the validity of
113 * this control synchronously.
114 * @param asyncValidators The function or array of functions that is used to determine validity of
115 * this control asynchronously.
116 */
117 constructor(validators, asyncValidators) {
118 /**
119 * Indicates that a control has its own pending asynchronous validation in progress.
120 *
121 * @internal
122 */
123 this._hasOwnPendingAsyncValidator = false;
124 /** @internal */
125 this._onCollectionChange = () => { };
126 this._parent = null;
127 /**
128 * A control is `pristine` if the user has not yet changed
129 * the value in the UI.
130 *
131 * @returns True if the user has not yet changed the value in the UI; compare `dirty`.
132 * Programmatic changes to a control's value do not mark it dirty.
133 */
134 this.pristine = true;
135 /**
136 * True if the control is marked as `touched`.
137 *
138 * A control is marked `touched` once the user has triggered
139 * a `blur` event on it.
140 */
141 this.touched = false;
142 /** @internal */
143 this._onDisabledChange = [];
144 this._rawValidators = validators;
145 this._rawAsyncValidators = asyncValidators;
146 this._composedValidatorFn = coerceToValidator(this._rawValidators);
147 this._composedAsyncValidatorFn = coerceToAsyncValidator(this._rawAsyncValidators);
148 }
149 /**
150 * Returns the function that is used to determine the validity of this control synchronously.
151 * If multiple validators have been added, this will be a single composed function.
152 * See `Validators.compose()` for additional information.
153 */
154 get validator() {
155 return this._composedValidatorFn;
156 }
157 set validator(validatorFn) {
158 this._rawValidators = this._composedValidatorFn = validatorFn;
159 }
160 /**
161 * Returns the function that is used to determine the validity of this control asynchronously.
162 * If multiple validators have been added, this will be a single composed function.
163 * See `Validators.compose()` for additional information.
164 */
165 get asyncValidator() {
166 return this._composedAsyncValidatorFn;
167 }
168 set asyncValidator(asyncValidatorFn) {
169 this._rawAsyncValidators = this._composedAsyncValidatorFn = asyncValidatorFn;
170 }
171 /**
172 * The parent control.
173 */
174 get parent() {
175 return this._parent;
176 }
177 /**
178 * A control is `valid` when its `status` is `VALID`.
179 *
180 * @see {@link AbstractControl.status}
181 *
182 * @returns True if the control has passed all of its validation tests,
183 * false otherwise.
184 */
185 get valid() {
186 return this.status === VALID;
187 }
188 /**
189 * A control is `invalid` when its `status` is `INVALID`.
190 *
191 * @see {@link AbstractControl.status}
192 *
193 * @returns True if this control has failed one or more of its validation checks,
194 * false otherwise.
195 */
196 get invalid() {
197 return this.status === INVALID;
198 }
199 /**
200 * A control is `pending` when its `status` is `PENDING`.
201 *
202 * @see {@link AbstractControl.status}
203 *
204 * @returns True if this control is in the process of conducting a validation check,
205 * false otherwise.
206 */
207 get pending() {
208 return this.status == PENDING;
209 }
210 /**
211 * A control is `disabled` when its `status` is `DISABLED`.
212 *
213 * Disabled controls are exempt from validation checks and
214 * are not included in the aggregate value of their ancestor
215 * controls.
216 *
217 * @see {@link AbstractControl.status}
218 *
219 * @returns True if the control is disabled, false otherwise.
220 */
221 get disabled() {
222 return this.status === DISABLED;
223 }
224 /**
225 * A control is `enabled` as long as its `status` is not `DISABLED`.
226 *
227 * @returns True if the control has any status other than 'DISABLED',
228 * false if the status is 'DISABLED'.
229 *
230 * @see {@link AbstractControl.status}
231 *
232 */
233 get enabled() {
234 return this.status !== DISABLED;
235 }
236 /**
237 * A control is `dirty` if the user has changed the value
238 * in the UI.
239 *
240 * @returns True if the user has changed the value of this control in the UI; compare `pristine`.
241 * Programmatic changes to a control's value do not mark it dirty.
242 */
243 get dirty() {
244 return !this.pristine;
245 }
246 /**
247 * True if the control has not been marked as touched
248 *
249 * A control is `untouched` if the user has not yet triggered
250 * a `blur` event on it.
251 */
252 get untouched() {
253 return !this.touched;
254 }
255 /**
256 * Reports the update strategy of the `AbstractControl` (meaning
257 * the event on which the control updates itself).
258 * Possible values: `'change'` | `'blur'` | `'submit'`
259 * Default value: `'change'`
260 */
261 get updateOn() {
262 return this._updateOn ? this._updateOn : (this.parent ? this.parent.updateOn : 'change');
263 }
264 /**
265 * Sets the synchronous validators that are active on this control. Calling
266 * this overwrites any existing synchronous validators.
267 *
268 * When you add or remove a validator at run time, you must call
269 * `updateValueAndValidity()` for the new validation to take effect.
270 *
271 * If you want to add a new validator without affecting existing ones, consider
272 * using `addValidators()` method instead.
273 */
274 setValidators(validators) {
275 this._rawValidators = validators;
276 this._composedValidatorFn = coerceToValidator(validators);
277 }
278 /**
279 * Sets the asynchronous validators that are active on this control. Calling this
280 * overwrites any existing asynchronous validators.
281 *
282 * When you add or remove a validator at run time, you must call
283 * `updateValueAndValidity()` for the new validation to take effect.
284 *
285 * If you want to add a new validator without affecting existing ones, consider
286 * using `addAsyncValidators()` method instead.
287 */
288 setAsyncValidators(validators) {
289 this._rawAsyncValidators = validators;
290 this._composedAsyncValidatorFn = coerceToAsyncValidator(validators);
291 }
292 /**
293 * Add a synchronous validator or validators to this control, without affecting other validators.
294 *
295 * When you add or remove a validator at run time, you must call
296 * `updateValueAndValidity()` for the new validation to take effect.
297 *
298 * Adding a validator that already exists will have no effect. If duplicate validator functions
299 * are present in the `validators` array, only the first instance would be added to a form
300 * control.
301 *
302 * @param validators The new validator function or functions to add to this control.
303 */
304 addValidators(validators) {
305 this.setValidators(addValidators(validators, this._rawValidators));
306 }
307 /**
308 * Add an asynchronous validator or validators to this control, without affecting other
309 * validators.
310 *
311 * When you add or remove a validator at run time, you must call
312 * `updateValueAndValidity()` for the new validation to take effect.
313 *
314 * Adding a validator that already exists will have no effect.
315 *
316 * @param validators The new asynchronous validator function or functions to add to this control.
317 */
318 addAsyncValidators(validators) {
319 this.setAsyncValidators(addValidators(validators, this._rawAsyncValidators));
320 }
321 /**
322 * Remove a synchronous validator from this control, without affecting other validators.
323 * Validators are compared by function reference; you must pass a reference to the exact same
324 * validator function as the one that was originally set. If a provided validator is not found,
325 * it is ignored.
326 *
327 * When you add or remove a validator at run time, you must call
328 * `updateValueAndValidity()` for the new validation to take effect.
329 *
330 * @param validators The validator or validators to remove.
331 */
332 removeValidators(validators) {
333 this.setValidators(removeValidators(validators, this._rawValidators));
334 }
335 /**
336 * Remove an asynchronous validator from this control, without affecting other validators.
337 * Validators are compared by function reference; you must pass a reference to the exact same
338 * validator function as the one that was originally set. If a provided validator is not found, it
339 * is ignored.
340 *
341 * When you add or remove a validator at run time, you must call
342 * `updateValueAndValidity()` for the new validation to take effect.
343 *
344 * @param validators The asynchronous validator or validators to remove.
345 */
346 removeAsyncValidators(validators) {
347 this.setAsyncValidators(removeValidators(validators, this._rawAsyncValidators));
348 }
349 /**
350 * Check whether a synchronous validator function is present on this control. The provided
351 * validator must be a reference to the exact same function that was provided.
352 *
353 * @param validator The validator to check for presence. Compared by function reference.
354 * @returns Whether the provided validator was found on this control.
355 */
356 hasValidator(validator) {
357 return hasValidator(this._rawValidators, validator);
358 }
359 /**
360 * Check whether an asynchronous validator function is present on this control. The provided
361 * validator must be a reference to the exact same function that was provided.
362 *
363 * @param validator The asynchronous validator to check for presence. Compared by function
364 * reference.
365 * @returns Whether the provided asynchronous validator was found on this control.
366 */
367 hasAsyncValidator(validator) {
368 return hasValidator(this._rawAsyncValidators, validator);
369 }
370 /**
371 * Empties out the synchronous validator list.
372 *
373 * When you add or remove a validator at run time, you must call
374 * `updateValueAndValidity()` for the new validation to take effect.
375 *
376 */
377 clearValidators() {
378 this.validator = null;
379 }
380 /**
381 * Empties out the async validator list.
382 *
383 * When you add or remove a validator at run time, you must call
384 * `updateValueAndValidity()` for the new validation to take effect.
385 *
386 */
387 clearAsyncValidators() {
388 this.asyncValidator = null;
389 }
390 /**
391 * Marks the control as `touched`. A control is touched by focus and
392 * blur events that do not change the value.
393 *
394 * @see `markAsUntouched()`
395 * @see `markAsDirty()`
396 * @see `markAsPristine()`
397 *
398 * @param opts Configuration options that determine how the control propagates changes
399 * and emits events after marking is applied.
400 * * `onlySelf`: When true, mark only this control. When false or not supplied,
401 * marks all direct ancestors. Default is false.
402 */
403 markAsTouched(opts = {}) {
404 this.touched = true;
405 if (this._parent && !opts.onlySelf) {
406 this._parent.markAsTouched(opts);
407 }
408 }
409 /**
410 * Marks the control and all its descendant controls as `touched`.
411 * @see `markAsTouched()`
412 */
413 markAllAsTouched() {
414 this.markAsTouched({ onlySelf: true });
415 this._forEachChild((control) => control.markAllAsTouched());
416 }
417 /**
418 * Marks the control as `untouched`.
419 *
420 * If the control has any children, also marks all children as `untouched`
421 * and recalculates the `touched` status of all parent controls.
422 *
423 * @see `markAsTouched()`
424 * @see `markAsDirty()`
425 * @see `markAsPristine()`
426 *
427 * @param opts Configuration options that determine how the control propagates changes
428 * and emits events after the marking is applied.
429 * * `onlySelf`: When true, mark only this control. When false or not supplied,
430 * marks all direct ancestors. Default is false.
431 */
432 markAsUntouched(opts = {}) {
433 this.touched = false;
434 this._pendingTouched = false;
435 this._forEachChild((control) => {
436 control.markAsUntouched({ onlySelf: true });
437 });
438 if (this._parent && !opts.onlySelf) {
439 this._parent._updateTouched(opts);
440 }
441 }
442 /**
443 * Marks the control as `dirty`. A control becomes dirty when
444 * the control's value is changed through the UI; compare `markAsTouched`.
445 *
446 * @see `markAsTouched()`
447 * @see `markAsUntouched()`
448 * @see `markAsPristine()`
449 *
450 * @param opts Configuration options that determine how the control propagates changes
451 * and emits events after marking is applied.
452 * * `onlySelf`: When true, mark only this control. When false or not supplied,
453 * marks all direct ancestors. Default is false.
454 */
455 markAsDirty(opts = {}) {
456 this.pristine = false;
457 if (this._parent && !opts.onlySelf) {
458 this._parent.markAsDirty(opts);
459 }
460 }
461 /**
462 * Marks the control as `pristine`.
463 *
464 * If the control has any children, marks all children as `pristine`,
465 * and recalculates the `pristine` status of all parent
466 * controls.
467 *
468 * @see `markAsTouched()`
469 * @see `markAsUntouched()`
470 * @see `markAsDirty()`
471 *
472 * @param opts Configuration options that determine how the control emits events after
473 * marking is applied.
474 * * `onlySelf`: When true, mark only this control. When false or not supplied,
475 * marks all direct ancestors. Default is false.
476 */
477 markAsPristine(opts = {}) {
478 this.pristine = true;
479 this._pendingDirty = false;
480 this._forEachChild((control) => {
481 control.markAsPristine({ onlySelf: true });
482 });
483 if (this._parent && !opts.onlySelf) {
484 this._parent._updatePristine(opts);
485 }
486 }
487 /**
488 * Marks the control as `pending`.
489 *
490 * A control is pending while the control performs async validation.
491 *
492 * @see {@link AbstractControl.status}
493 *
494 * @param opts Configuration options that determine how the control propagates changes and
495 * emits events after marking is applied.
496 * * `onlySelf`: When true, mark only this control. When false or not supplied,
497 * marks all direct ancestors. Default is false.
498 * * `emitEvent`: When true or not supplied (the default), the `statusChanges`
499 * observable emits an event with the latest status the control is marked pending.
500 * When false, no events are emitted.
501 *
502 */
503 markAsPending(opts = {}) {
504 this.status = PENDING;
505 if (opts.emitEvent !== false) {
506 this.statusChanges.emit(this.status);
507 }
508 if (this._parent && !opts.onlySelf) {
509 this._parent.markAsPending(opts);
510 }
511 }
512 /**
513 * Disables the control. This means the control is exempt from validation checks and
514 * excluded from the aggregate value of any parent. Its status is `DISABLED`.
515 *
516 * If the control has children, all children are also disabled.
517 *
518 * @see {@link AbstractControl.status}
519 *
520 * @param opts Configuration options that determine how the control propagates
521 * changes and emits events after the control is disabled.
522 * * `onlySelf`: When true, mark only this control. When false or not supplied,
523 * marks all direct ancestors. Default is false.
524 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
525 * `valueChanges`
526 * observables emit events with the latest status and value when the control is disabled.
527 * When false, no events are emitted.
528 */
529 disable(opts = {}) {
530 // If parent has been marked artificially dirty we don't want to re-calculate the
531 // parent's dirtiness based on the children.
532 const skipPristineCheck = this._parentMarkedDirty(opts.onlySelf);
533 this.status = DISABLED;
534 this.errors = null;
535 this._forEachChild((control) => {
536 control.disable(Object.assign(Object.assign({}, opts), { onlySelf: true }));
537 });
538 this._updateValue();
539 if (opts.emitEvent !== false) {
540 this.valueChanges.emit(this.value);
541 this.statusChanges.emit(this.status);
542 }
543 this._updateAncestors(Object.assign(Object.assign({}, opts), { skipPristineCheck }));
544 this._onDisabledChange.forEach((changeFn) => changeFn(true));
545 }
546 /**
547 * Enables the control. This means the control is included in validation checks and
548 * the aggregate value of its parent. Its status recalculates based on its value and
549 * its validators.
550 *
551 * By default, if the control has children, all children are enabled.
552 *
553 * @see {@link AbstractControl.status}
554 *
555 * @param opts Configure options that control how the control propagates changes and
556 * emits events when marked as untouched
557 * * `onlySelf`: When true, mark only this control. When false or not supplied,
558 * marks all direct ancestors. Default is false.
559 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
560 * `valueChanges`
561 * observables emit events with the latest status and value when the control is enabled.
562 * When false, no events are emitted.
563 */
564 enable(opts = {}) {
565 // If parent has been marked artificially dirty we don't want to re-calculate the
566 // parent's dirtiness based on the children.
567 const skipPristineCheck = this._parentMarkedDirty(opts.onlySelf);
568 this.status = VALID;
569 this._forEachChild((control) => {
570 control.enable(Object.assign(Object.assign({}, opts), { onlySelf: true }));
571 });
572 this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent });
573 this._updateAncestors(Object.assign(Object.assign({}, opts), { skipPristineCheck }));
574 this._onDisabledChange.forEach((changeFn) => changeFn(false));
575 }
576 _updateAncestors(opts) {
577 if (this._parent && !opts.onlySelf) {
578 this._parent.updateValueAndValidity(opts);
579 if (!opts.skipPristineCheck) {
580 this._parent._updatePristine();
581 }
582 this._parent._updateTouched();
583 }
584 }
585 /**
586 * @param parent Sets the parent of the control
587 */
588 setParent(parent) {
589 this._parent = parent;
590 }
591 /**
592 * Recalculates the value and validation status of the control.
593 *
594 * By default, it also updates the value and validity of its ancestors.
595 *
596 * @param opts Configuration options determine how the control propagates changes and emits events
597 * after updates and validity checks are applied.
598 * * `onlySelf`: When true, only update this control. When false or not supplied,
599 * update all direct ancestors. Default is false.
600 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
601 * `valueChanges`
602 * observables emit events with the latest status and value when the control is updated.
603 * When false, no events are emitted.
604 */
605 updateValueAndValidity(opts = {}) {
606 this._setInitialStatus();
607 this._updateValue();
608 if (this.enabled) {
609 this._cancelExistingSubscription();
610 this.errors = this._runValidator();
611 this.status = this._calculateStatus();
612 if (this.status === VALID || this.status === PENDING) {
613 this._runAsyncValidator(opts.emitEvent);
614 }
615 }
616 if (opts.emitEvent !== false) {
617 this.valueChanges.emit(this.value);
618 this.statusChanges.emit(this.status);
619 }
620 if (this._parent && !opts.onlySelf) {
621 this._parent.updateValueAndValidity(opts);
622 }
623 }
624 /** @internal */
625 _updateTreeValidity(opts = { emitEvent: true }) {
626 this._forEachChild((ctrl) => ctrl._updateTreeValidity(opts));
627 this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent });
628 }
629 _setInitialStatus() {
630 this.status = this._allControlsDisabled() ? DISABLED : VALID;
631 }
632 _runValidator() {
633 return this.validator ? this.validator(this) : null;
634 }
635 _runAsyncValidator(emitEvent) {
636 if (this.asyncValidator) {
637 this.status = PENDING;
638 this._hasOwnPendingAsyncValidator = true;
639 const obs = toObservable(this.asyncValidator(this));
640 this._asyncValidationSubscription = obs.subscribe((errors) => {
641 this._hasOwnPendingAsyncValidator = false;
642 // This will trigger the recalculation of the validation status, which depends on
643 // the state of the asynchronous validation (whether it is in progress or not). So, it is
644 // necessary that we have updated the `_hasOwnPendingAsyncValidator` boolean flag first.
645 this.setErrors(errors, { emitEvent });
646 });
647 }
648 }
649 _cancelExistingSubscription() {
650 if (this._asyncValidationSubscription) {
651 this._asyncValidationSubscription.unsubscribe();
652 this._hasOwnPendingAsyncValidator = false;
653 }
654 }
655 /**
656 * Sets errors on a form control when running validations manually, rather than automatically.
657 *
658 * Calling `setErrors` also updates the validity of the parent control.
659 *
660 * @usageNotes
661 *
662 * ### Manually set the errors for a control
663 *
664 * ```
665 * const login = new FormControl('someLogin');
666 * login.setErrors({
667 * notUnique: true
668 * });
669 *
670 * expect(login.valid).toEqual(false);
671 * expect(login.errors).toEqual({ notUnique: true });
672 *
673 * login.setValue('someOtherLogin');
674 *
675 * expect(login.valid).toEqual(true);
676 * ```
677 */
678 setErrors(errors, opts = {}) {
679 this.errors = errors;
680 this._updateControlsErrors(opts.emitEvent !== false);
681 }
682 /**
683 * Retrieves a child control given the control's name or path.
684 *
685 * @param path A dot-delimited string or array of string/number values that define the path to the
686 * control.
687 *
688 * @usageNotes
689 * ### Retrieve a nested control
690 *
691 * For example, to get a `name` control nested within a `person` sub-group:
692 *
693 * * `this.form.get('person.name');`
694 *
695 * -OR-
696 *
697 * * `this.form.get(['person', 'name']);`
698 *
699 * ### Retrieve a control in a FormArray
700 *
701 * When accessing an element inside a FormArray, you can use an element index.
702 * For example, to get a `price` control from the first element in an `items` array you can use:
703 *
704 * * `this.form.get('items.0.price');`
705 *
706 * -OR-
707 *
708 * * `this.form.get(['items', 0, 'price']);`
709 */
710 get(path) {
711 return _find(this, path, '.');
712 }
713 /**
714 * @description
715 * Reports error data for the control with the given path.
716 *
717 * @param errorCode The code of the error to check
718 * @param path A list of control names that designates how to move from the current control
719 * to the control that should be queried for errors.
720 *
721 * @usageNotes
722 * For example, for the following `FormGroup`:
723 *
724 * ```
725 * form = new FormGroup({
726 * address: new FormGroup({ street: new FormControl() })
727 * });
728 * ```
729 *
730 * The path to the 'street' control from the root form would be 'address' -> 'street'.
731 *
732 * It can be provided to this method in one of two formats:
733 *
734 * 1. An array of string control names, e.g. `['address', 'street']`
735 * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
736 *
737 * @returns error data for that particular error. If the control or error is not present,
738 * null is returned.
739 */
740 getError(errorCode, path) {
741 const control = path ? this.get(path) : this;
742 return control && control.errors ? control.errors[errorCode] : null;
743 }
744 /**
745 * @description
746 * Reports whether the control with the given path has the error specified.
747 *
748 * @param errorCode The code of the error to check
749 * @param path A list of control names that designates how to move from the current control
750 * to the control that should be queried for errors.
751 *
752 * @usageNotes
753 * For example, for the following `FormGroup`:
754 *
755 * ```
756 * form = new FormGroup({
757 * address: new FormGroup({ street: new FormControl() })
758 * });
759 * ```
760 *
761 * The path to the 'street' control from the root form would be 'address' -> 'street'.
762 *
763 * It can be provided to this method in one of two formats:
764 *
765 * 1. An array of string control names, e.g. `['address', 'street']`
766 * 1. A period-delimited list of control names in one string, e.g. `'address.street'`
767 *
768 * If no path is given, this method checks for the error on the current control.
769 *
770 * @returns whether the given error is present in the control at the given path.
771 *
772 * If the control is not present, false is returned.
773 */
774 hasError(errorCode, path) {
775 return !!this.getError(errorCode, path);
776 }
777 /**
778 * Retrieves the top-level ancestor of this control.
779 */
780 get root() {
781 let x = this;
782 while (x._parent) {
783 x = x._parent;
784 }
785 return x;
786 }
787 /** @internal */
788 _updateControlsErrors(emitEvent) {
789 this.status = this._calculateStatus();
790 if (emitEvent) {
791 this.statusChanges.emit(this.status);
792 }
793 if (this._parent) {
794 this._parent._updateControlsErrors(emitEvent);
795 }
796 }
797 /** @internal */
798 _initObservables() {
799 this.valueChanges = new EventEmitter();
800 this.statusChanges = new EventEmitter();
801 }
802 _calculateStatus() {
803 if (this._allControlsDisabled())
804 return DISABLED;
805 if (this.errors)
806 return INVALID;
807 if (this._hasOwnPendingAsyncValidator || this._anyControlsHaveStatus(PENDING))
808 return PENDING;
809 if (this._anyControlsHaveStatus(INVALID))
810 return INVALID;
811 return VALID;
812 }
813 /** @internal */
814 _anyControlsHaveStatus(status) {
815 return this._anyControls((control) => control.status === status);
816 }
817 /** @internal */
818 _anyControlsDirty() {
819 return this._anyControls((control) => control.dirty);
820 }
821 /** @internal */
822 _anyControlsTouched() {
823 return this._anyControls((control) => control.touched);
824 }
825 /** @internal */
826 _updatePristine(opts = {}) {
827 this.pristine = !this._anyControlsDirty();
828 if (this._parent && !opts.onlySelf) {
829 this._parent._updatePristine(opts);
830 }
831 }
832 /** @internal */
833 _updateTouched(opts = {}) {
834 this.touched = this._anyControlsTouched();
835 if (this._parent && !opts.onlySelf) {
836 this._parent._updateTouched(opts);
837 }
838 }
839 /** @internal */
840 _isBoxedValue(formState) {
841 return typeof formState === 'object' && formState !== null &&
842 Object.keys(formState).length === 2 && 'value' in formState && 'disabled' in formState;
843 }
844 /** @internal */
845 _registerOnCollectionChange(fn) {
846 this._onCollectionChange = fn;
847 }
848 /** @internal */
849 _setUpdateStrategy(opts) {
850 if (isOptionsObj(opts) && opts.updateOn != null) {
851 this._updateOn = opts.updateOn;
852 }
853 }
854 /**
855 * Check to see if parent has been marked artificially dirty.
856 *
857 * @internal
858 */
859 _parentMarkedDirty(onlySelf) {
860 const parentDirty = this._parent && this._parent.dirty;
861 return !onlySelf && !!parentDirty && !this._parent._anyControlsDirty();
862 }
863}
864/**
865 * Tracks the value and validation status of an individual form control.
866 *
867 * This is one of the three fundamental building blocks of Angular forms, along with
868 * `FormGroup` and `FormArray`. It extends the `AbstractControl` class that
869 * implements most of the base functionality for accessing the value, validation status,
870 * user interactions and events. See [usage examples below](#usage-notes).
871 *
872 * @see `AbstractControl`
873 * @see [Reactive Forms Guide](guide/reactive-forms)
874 * @see [Usage Notes](#usage-notes)
875 *
876 * @usageNotes
877 *
878 * ### Initializing Form Controls
879 *
880 * Instantiate a `FormControl`, with an initial value.
881 *
882 * ```ts
883 * const control = new FormControl('some value');
884 * console.log(control.value); // 'some value'
885 *```
886 *
887 * The following example initializes the control with a form state object. The `value`
888 * and `disabled` keys are required in this case.
889 *
890 * ```ts
891 * const control = new FormControl({ value: 'n/a', disabled: true });
892 * console.log(control.value); // 'n/a'
893 * console.log(control.status); // 'DISABLED'
894 * ```
895 *
896 * The following example initializes the control with a synchronous validator.
897 *
898 * ```ts
899 * const control = new FormControl('', Validators.required);
900 * console.log(control.value); // ''
901 * console.log(control.status); // 'INVALID'
902 * ```
903 *
904 * The following example initializes the control using an options object.
905 *
906 * ```ts
907 * const control = new FormControl('', {
908 * validators: Validators.required,
909 * asyncValidators: myAsyncValidator
910 * });
911 * ```
912 *
913 * ### Configure the control to update on a blur event
914 *
915 * Set the `updateOn` option to `'blur'` to update on the blur `event`.
916 *
917 * ```ts
918 * const control = new FormControl('', { updateOn: 'blur' });
919 * ```
920 *
921 * ### Configure the control to update on a submit event
922 *
923 * Set the `updateOn` option to `'submit'` to update on a submit `event`.
924 *
925 * ```ts
926 * const control = new FormControl('', { updateOn: 'submit' });
927 * ```
928 *
929 * ### Reset the control back to an initial value
930 *
931 * You reset to a specific form state by passing through a standalone
932 * value or a form state object that contains both a value and a disabled state
933 * (these are the only two properties that cannot be calculated).
934 *
935 * ```ts
936 * const control = new FormControl('Nancy');
937 *
938 * console.log(control.value); // 'Nancy'
939 *
940 * control.reset('Drew');
941 *
942 * console.log(control.value); // 'Drew'
943 * ```
944 *
945 * ### Reset the control back to an initial value and disabled
946 *
947 * ```
948 * const control = new FormControl('Nancy');
949 *
950 * console.log(control.value); // 'Nancy'
951 * console.log(control.status); // 'VALID'
952 *
953 * control.reset({ value: 'Drew', disabled: true });
954 *
955 * console.log(control.value); // 'Drew'
956 * console.log(control.status); // 'DISABLED'
957 * ```
958 *
959 * @publicApi
960 */
961export class FormControl extends AbstractControl {
962 /**
963 * Creates a new `FormControl` instance.
964 *
965 * @param formState Initializes the control with an initial value,
966 * or an object that defines the initial value and disabled state.
967 *
968 * @param validatorOrOpts A synchronous validator function, or an array of
969 * such functions, or an `AbstractControlOptions` object that contains validation functions
970 * and a validation trigger.
971 *
972 * @param asyncValidator A single async validator or array of async validator functions
973 *
974 */
975 constructor(formState = null, validatorOrOpts, asyncValidator) {
976 super(pickValidators(validatorOrOpts), pickAsyncValidators(asyncValidator, validatorOrOpts));
977 /** @internal */
978 this._onChange = [];
979 this._applyFormState(formState);
980 this._setUpdateStrategy(validatorOrOpts);
981 this._initObservables();
982 this.updateValueAndValidity({
983 onlySelf: true,
984 // If `asyncValidator` is present, it will trigger control status change from `PENDING` to
985 // `VALID` or `INVALID`.
986 // The status should be broadcasted via the `statusChanges` observable, so we set `emitEvent`
987 // to `true` to allow that during the control creation process.
988 emitEvent: !!this.asyncValidator
989 });
990 }
991 /**
992 * Sets a new value for the form control.
993 *
994 * @param value The new value for the control.
995 * @param options Configuration options that determine how the control propagates changes
996 * and emits events when the value changes.
997 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
998 * updateValueAndValidity} method.
999 *
1000 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
1001 * false.
1002 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1003 * `valueChanges`
1004 * observables emit events with the latest status and value when the control value is updated.
1005 * When false, no events are emitted.
1006 * * `emitModelToViewChange`: When true or not supplied (the default), each change triggers an
1007 * `onChange` event to
1008 * update the view.
1009 * * `emitViewToModelChange`: When true or not supplied (the default), each change triggers an
1010 * `ngModelChange`
1011 * event to update the model.
1012 *
1013 */
1014 setValue(value, options = {}) {
1015 this.value = this._pendingValue = value;
1016 if (this._onChange.length && options.emitModelToViewChange !== false) {
1017 this._onChange.forEach((changeFn) => changeFn(this.value, options.emitViewToModelChange !== false));
1018 }
1019 this.updateValueAndValidity(options);
1020 }
1021 /**
1022 * Patches the value of a control.
1023 *
1024 * This function is functionally the same as {@link FormControl#setValue setValue} at this level.
1025 * It exists for symmetry with {@link FormGroup#patchValue patchValue} on `FormGroups` and
1026 * `FormArrays`, where it does behave differently.
1027 *
1028 * @see `setValue` for options
1029 */
1030 patchValue(value, options = {}) {
1031 this.setValue(value, options);
1032 }
1033 /**
1034 * Resets the form control, marking it `pristine` and `untouched`, and setting
1035 * the value to null.
1036 *
1037 * @param formState Resets the control with an initial value,
1038 * or an object that defines the initial value and disabled state.
1039 *
1040 * @param options Configuration options that determine how the control propagates changes
1041 * and emits events after the value changes.
1042 *
1043 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
1044 * false.
1045 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1046 * `valueChanges`
1047 * observables emit events with the latest status and value when the control is reset.
1048 * When false, no events are emitted.
1049 *
1050 */
1051 reset(formState = null, options = {}) {
1052 this._applyFormState(formState);
1053 this.markAsPristine(options);
1054 this.markAsUntouched(options);
1055 this.setValue(this.value, options);
1056 this._pendingChange = false;
1057 }
1058 /**
1059 * @internal
1060 */
1061 _updateValue() { }
1062 /**
1063 * @internal
1064 */
1065 _anyControls(condition) {
1066 return false;
1067 }
1068 /**
1069 * @internal
1070 */
1071 _allControlsDisabled() {
1072 return this.disabled;
1073 }
1074 /**
1075 * Register a listener for change events.
1076 *
1077 * @param fn The method that is called when the value changes
1078 */
1079 registerOnChange(fn) {
1080 this._onChange.push(fn);
1081 }
1082 /**
1083 * Internal function to unregister a change events listener.
1084 * @internal
1085 */
1086 _unregisterOnChange(fn) {
1087 removeListItem(this._onChange, fn);
1088 }
1089 /**
1090 * Register a listener for disabled events.
1091 *
1092 * @param fn The method that is called when the disabled status changes.
1093 */
1094 registerOnDisabledChange(fn) {
1095 this._onDisabledChange.push(fn);
1096 }
1097 /**
1098 * Internal function to unregister a disabled event listener.
1099 * @internal
1100 */
1101 _unregisterOnDisabledChange(fn) {
1102 removeListItem(this._onDisabledChange, fn);
1103 }
1104 /**
1105 * @internal
1106 */
1107 _forEachChild(cb) { }
1108 /** @internal */
1109 _syncPendingControls() {
1110 if (this.updateOn === 'submit') {
1111 if (this._pendingDirty)
1112 this.markAsDirty();
1113 if (this._pendingTouched)
1114 this.markAsTouched();
1115 if (this._pendingChange) {
1116 this.setValue(this._pendingValue, { onlySelf: true, emitModelToViewChange: false });
1117 return true;
1118 }
1119 }
1120 return false;
1121 }
1122 _applyFormState(formState) {
1123 if (this._isBoxedValue(formState)) {
1124 this.value = this._pendingValue = formState.value;
1125 formState.disabled ? this.disable({ onlySelf: true, emitEvent: false }) :
1126 this.enable({ onlySelf: true, emitEvent: false });
1127 }
1128 else {
1129 this.value = this._pendingValue = formState;
1130 }
1131 }
1132}
1133/**
1134 * Tracks the value and validity state of a group of `FormControl` instances.
1135 *
1136 * A `FormGroup` aggregates the values of each child `FormControl` into one object,
1137 * with each control name as the key. It calculates its status by reducing the status values
1138 * of its children. For example, if one of the controls in a group is invalid, the entire
1139 * group becomes invalid.
1140 *
1141 * `FormGroup` is one of the three fundamental building blocks used to define forms in Angular,
1142 * along with `FormControl` and `FormArray`.
1143 *
1144 * When instantiating a `FormGroup`, pass in a collection of child controls as the first
1145 * argument. The key for each child registers the name for the control.
1146 *
1147 * @usageNotes
1148 *
1149 * ### Create a form group with 2 controls
1150 *
1151 * ```
1152 * const form = new FormGroup({
1153 * first: new FormControl('Nancy', Validators.minLength(2)),
1154 * last: new FormControl('Drew'),
1155 * });
1156 *
1157 * console.log(form.value); // {first: 'Nancy', last; 'Drew'}
1158 * console.log(form.status); // 'VALID'
1159 * ```
1160 *
1161 * ### Create a form group with a group-level validator
1162 *
1163 * You include group-level validators as the second arg, or group-level async
1164 * validators as the third arg. These come in handy when you want to perform validation
1165 * that considers the value of more than one child control.
1166 *
1167 * ```
1168 * const form = new FormGroup({
1169 * password: new FormControl('', Validators.minLength(2)),
1170 * passwordConfirm: new FormControl('', Validators.minLength(2)),
1171 * }, passwordMatchValidator);
1172 *
1173 *
1174 * function passwordMatchValidator(g: FormGroup) {
1175 * return g.get('password').value === g.get('passwordConfirm').value
1176 * ? null : {'mismatch': true};
1177 * }
1178 * ```
1179 *
1180 * Like `FormControl` instances, you choose to pass in
1181 * validators and async validators as part of an options object.
1182 *
1183 * ```
1184 * const form = new FormGroup({
1185 * password: new FormControl('')
1186 * passwordConfirm: new FormControl('')
1187 * }, { validators: passwordMatchValidator, asyncValidators: otherValidator });
1188 * ```
1189 *
1190 * ### Set the updateOn property for all controls in a form group
1191 *
1192 * The options object is used to set a default value for each child
1193 * control's `updateOn` property. If you set `updateOn` to `'blur'` at the
1194 * group level, all child controls default to 'blur', unless the child
1195 * has explicitly specified a different `updateOn` value.
1196 *
1197 * ```ts
1198 * const c = new FormGroup({
1199 * one: new FormControl()
1200 * }, { updateOn: 'blur' });
1201 * ```
1202 *
1203 * @publicApi
1204 */
1205export class FormGroup extends AbstractControl {
1206 /**
1207 * Creates a new `FormGroup` instance.
1208 *
1209 * @param controls A collection of child controls. The key for each child is the name
1210 * under which it is registered.
1211 *
1212 * @param validatorOrOpts A synchronous validator function, or an array of
1213 * such functions, or an `AbstractControlOptions` object that contains validation functions
1214 * and a validation trigger.
1215 *
1216 * @param asyncValidator A single async validator or array of async validator functions
1217 *
1218 */
1219 constructor(controls, validatorOrOpts, asyncValidator) {
1220 super(pickValidators(validatorOrOpts), pickAsyncValidators(asyncValidator, validatorOrOpts));
1221 this.controls = controls;
1222 this._initObservables();
1223 this._setUpdateStrategy(validatorOrOpts);
1224 this._setUpControls();
1225 this.updateValueAndValidity({
1226 onlySelf: true,
1227 // If `asyncValidator` is present, it will trigger control status change from `PENDING` to
1228 // `VALID` or `INVALID`. The status should be broadcasted via the `statusChanges` observable,
1229 // so we set `emitEvent` to `true` to allow that during the control creation process.
1230 emitEvent: !!this.asyncValidator
1231 });
1232 }
1233 /**
1234 * Registers a control with the group's list of controls.
1235 *
1236 * This method does not update the value or validity of the control.
1237 * Use {@link FormGroup#addControl addControl} instead.
1238 *
1239 * @param name The control name to register in the collection
1240 * @param control Provides the control for the given name
1241 */
1242 registerControl(name, control) {
1243 if (this.controls[name])
1244 return this.controls[name];
1245 this.controls[name] = control;
1246 control.setParent(this);
1247 control._registerOnCollectionChange(this._onCollectionChange);
1248 return control;
1249 }
1250 /**
1251 * Add a control to this group.
1252 *
1253 * If a control with a given name already exists, it would *not* be replaced with a new one.
1254 * If you want to replace an existing control, use the {@link FormGroup#setControl setControl}
1255 * method instead. This method also updates the value and validity of the control.
1256 *
1257 * @param name The control name to add to the collection
1258 * @param control Provides the control for the given name
1259 * @param options Specifies whether this FormGroup instance should emit events after a new
1260 * control is added.
1261 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1262 * `valueChanges` observables emit events with the latest status and value when the control is
1263 * added. When false, no events are emitted.
1264 */
1265 addControl(name, control, options = {}) {
1266 this.registerControl(name, control);
1267 this.updateValueAndValidity({ emitEvent: options.emitEvent });
1268 this._onCollectionChange();
1269 }
1270 /**
1271 * Remove a control from this group.
1272 *
1273 * This method also updates the value and validity of the control.
1274 *
1275 * @param name The control name to remove from the collection
1276 * @param options Specifies whether this FormGroup instance should emit events after a
1277 * control is removed.
1278 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1279 * `valueChanges` observables emit events with the latest status and value when the control is
1280 * removed. When false, no events are emitted.
1281 */
1282 removeControl(name, options = {}) {
1283 if (this.controls[name])
1284 this.controls[name]._registerOnCollectionChange(() => { });
1285 delete (this.controls[name]);
1286 this.updateValueAndValidity({ emitEvent: options.emitEvent });
1287 this._onCollectionChange();
1288 }
1289 /**
1290 * Replace an existing control.
1291 *
1292 * If a control with a given name does not exist in this `FormGroup`, it will be added.
1293 *
1294 * @param name The control name to replace in the collection
1295 * @param control Provides the control for the given name
1296 * @param options Specifies whether this FormGroup instance should emit events after an
1297 * existing control is replaced.
1298 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1299 * `valueChanges` observables emit events with the latest status and value when the control is
1300 * replaced with a new one. When false, no events are emitted.
1301 */
1302 setControl(name, control, options = {}) {
1303 if (this.controls[name])
1304 this.controls[name]._registerOnCollectionChange(() => { });
1305 delete (this.controls[name]);
1306 if (control)
1307 this.registerControl(name, control);
1308 this.updateValueAndValidity({ emitEvent: options.emitEvent });
1309 this._onCollectionChange();
1310 }
1311 /**
1312 * Check whether there is an enabled control with the given name in the group.
1313 *
1314 * Reports false for disabled controls. If you'd like to check for existence in the group
1315 * only, use {@link AbstractControl#get get} instead.
1316 *
1317 * @param controlName The control name to check for existence in the collection
1318 *
1319 * @returns false for disabled controls, true otherwise.
1320 */
1321 contains(controlName) {
1322 return this.controls.hasOwnProperty(controlName) && this.controls[controlName].enabled;
1323 }
1324 /**
1325 * Sets the value of the `FormGroup`. It accepts an object that matches
1326 * the structure of the group, with control names as keys.
1327 *
1328 * @usageNotes
1329 * ### Set the complete value for the form group
1330 *
1331 * ```
1332 * const form = new FormGroup({
1333 * first: new FormControl(),
1334 * last: new FormControl()
1335 * });
1336 *
1337 * console.log(form.value); // {first: null, last: null}
1338 *
1339 * form.setValue({first: 'Nancy', last: 'Drew'});
1340 * console.log(form.value); // {first: 'Nancy', last: 'Drew'}
1341 * ```
1342 *
1343 * @throws When strict checks fail, such as setting the value of a control
1344 * that doesn't exist or if you exclude a value of a control that does exist.
1345 *
1346 * @param value The new value for the control that matches the structure of the group.
1347 * @param options Configuration options that determine how the control propagates changes
1348 * and emits events after the value changes.
1349 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
1350 * updateValueAndValidity} method.
1351 *
1352 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
1353 * false.
1354 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1355 * `valueChanges`
1356 * observables emit events with the latest status and value when the control value is updated.
1357 * When false, no events are emitted.
1358 */
1359 setValue(value, options = {}) {
1360 this._checkAllValuesPresent(value);
1361 Object.keys(value).forEach(name => {
1362 this._throwIfControlMissing(name);
1363 this.controls[name].setValue(value[name], { onlySelf: true, emitEvent: options.emitEvent });
1364 });
1365 this.updateValueAndValidity(options);
1366 }
1367 /**
1368 * Patches the value of the `FormGroup`. It accepts an object with control
1369 * names as keys, and does its best to match the values to the correct controls
1370 * in the group.
1371 *
1372 * It accepts both super-sets and sub-sets of the group without throwing an error.
1373 *
1374 * @usageNotes
1375 * ### Patch the value for a form group
1376 *
1377 * ```
1378 * const form = new FormGroup({
1379 * first: new FormControl(),
1380 * last: new FormControl()
1381 * });
1382 * console.log(form.value); // {first: null, last: null}
1383 *
1384 * form.patchValue({first: 'Nancy'});
1385 * console.log(form.value); // {first: 'Nancy', last: null}
1386 * ```
1387 *
1388 * @param value The object that matches the structure of the group.
1389 * @param options Configuration options that determine how the control propagates changes and
1390 * emits events after the value is patched.
1391 * * `onlySelf`: When true, each change only affects this control and not its parent. Default is
1392 * true.
1393 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1394 * `valueChanges` observables emit events with the latest status and value when the control value
1395 * is updated. When false, no events are emitted. The configuration options are passed to
1396 * the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
1397 */
1398 patchValue(value, options = {}) {
1399 // Even though the `value` argument type doesn't allow `null` and `undefined` values, the
1400 // `patchValue` can be called recursively and inner data structures might have these values, so
1401 // we just ignore such cases when a field containing FormGroup instance receives `null` or
1402 // `undefined` as a value.
1403 if (value == null /* both `null` and `undefined` */)
1404 return;
1405 Object.keys(value).forEach(name => {
1406 if (this.controls[name]) {
1407 this.controls[name].patchValue(value[name], { onlySelf: true, emitEvent: options.emitEvent });
1408 }
1409 });
1410 this.updateValueAndValidity(options);
1411 }
1412 /**
1413 * Resets the `FormGroup`, marks all descendants `pristine` and `untouched` and sets
1414 * the value of all descendants to null.
1415 *
1416 * You reset to a specific form state by passing in a map of states
1417 * that matches the structure of your form, with control names as keys. The state
1418 * is a standalone value or a form state object with both a value and a disabled
1419 * status.
1420 *
1421 * @param value Resets the control with an initial value,
1422 * or an object that defines the initial value and disabled state.
1423 *
1424 * @param options Configuration options that determine how the control propagates changes
1425 * and emits events when the group is reset.
1426 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
1427 * false.
1428 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1429 * `valueChanges`
1430 * observables emit events with the latest status and value when the control is reset.
1431 * When false, no events are emitted.
1432 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
1433 * updateValueAndValidity} method.
1434 *
1435 * @usageNotes
1436 *
1437 * ### Reset the form group values
1438 *
1439 * ```ts
1440 * const form = new FormGroup({
1441 * first: new FormControl('first name'),
1442 * last: new FormControl('last name')
1443 * });
1444 *
1445 * console.log(form.value); // {first: 'first name', last: 'last name'}
1446 *
1447 * form.reset({ first: 'name', last: 'last name' });
1448 *
1449 * console.log(form.value); // {first: 'name', last: 'last name'}
1450 * ```
1451 *
1452 * ### Reset the form group values and disabled status
1453 *
1454 * ```
1455 * const form = new FormGroup({
1456 * first: new FormControl('first name'),
1457 * last: new FormControl('last name')
1458 * });
1459 *
1460 * form.reset({
1461 * first: {value: 'name', disabled: true},
1462 * last: 'last'
1463 * });
1464 *
1465 * console.log(form.value); // {last: 'last'}
1466 * console.log(form.get('first').status); // 'DISABLED'
1467 * ```
1468 */
1469 reset(value = {}, options = {}) {
1470 this._forEachChild((control, name) => {
1471 control.reset(value[name], { onlySelf: true, emitEvent: options.emitEvent });
1472 });
1473 this._updatePristine(options);
1474 this._updateTouched(options);
1475 this.updateValueAndValidity(options);
1476 }
1477 /**
1478 * The aggregate value of the `FormGroup`, including any disabled controls.
1479 *
1480 * Retrieves all values regardless of disabled status.
1481 * The `value` property is the best way to get the value of the group, because
1482 * it excludes disabled controls in the `FormGroup`.
1483 */
1484 getRawValue() {
1485 return this._reduceChildren({}, (acc, control, name) => {
1486 acc[name] = control instanceof FormControl ? control.value : control.getRawValue();
1487 return acc;
1488 });
1489 }
1490 /** @internal */
1491 _syncPendingControls() {
1492 let subtreeUpdated = this._reduceChildren(false, (updated, child) => {
1493 return child._syncPendingControls() ? true : updated;
1494 });
1495 if (subtreeUpdated)
1496 this.updateValueAndValidity({ onlySelf: true });
1497 return subtreeUpdated;
1498 }
1499 /** @internal */
1500 _throwIfControlMissing(name) {
1501 if (!Object.keys(this.controls).length) {
1502 throw new Error(`
1503 There are no form controls registered with this group yet. If you're using ngModel,
1504 you may want to check next tick (e.g. use setTimeout).
1505 `);
1506 }
1507 if (!this.controls[name]) {
1508 throw new Error(`Cannot find form control with name: ${name}.`);
1509 }
1510 }
1511 /** @internal */
1512 _forEachChild(cb) {
1513 Object.keys(this.controls).forEach(key => {
1514 // The list of controls can change (for ex. controls might be removed) while the loop
1515 // is running (as a result of invoking Forms API in `valueChanges` subscription), so we
1516 // have to null check before invoking the callback.
1517 const control = this.controls[key];
1518 control && cb(control, key);
1519 });
1520 }
1521 /** @internal */
1522 _setUpControls() {
1523 this._forEachChild((control) => {
1524 control.setParent(this);
1525 control._registerOnCollectionChange(this._onCollectionChange);
1526 });
1527 }
1528 /** @internal */
1529 _updateValue() {
1530 this.value = this._reduceValue();
1531 }
1532 /** @internal */
1533 _anyControls(condition) {
1534 for (const controlName of Object.keys(this.controls)) {
1535 const control = this.controls[controlName];
1536 if (this.contains(controlName) && condition(control)) {
1537 return true;
1538 }
1539 }
1540 return false;
1541 }
1542 /** @internal */
1543 _reduceValue() {
1544 return this._reduceChildren({}, (acc, control, name) => {
1545 if (control.enabled || this.disabled) {
1546 acc[name] = control.value;
1547 }
1548 return acc;
1549 });
1550 }
1551 /** @internal */
1552 _reduceChildren(initValue, fn) {
1553 let res = initValue;
1554 this._forEachChild((control, name) => {
1555 res = fn(res, control, name);
1556 });
1557 return res;
1558 }
1559 /** @internal */
1560 _allControlsDisabled() {
1561 for (const controlName of Object.keys(this.controls)) {
1562 if (this.controls[controlName].enabled) {
1563 return false;
1564 }
1565 }
1566 return Object.keys(this.controls).length > 0 || this.disabled;
1567 }
1568 /** @internal */
1569 _checkAllValuesPresent(value) {
1570 this._forEachChild((control, name) => {
1571 if (value[name] === undefined) {
1572 throw new Error(`Must supply a value for form control with name: '${name}'.`);
1573 }
1574 });
1575 }
1576}
1577/**
1578 * Tracks the value and validity state of an array of `FormControl`,
1579 * `FormGroup` or `FormArray` instances.
1580 *
1581 * A `FormArray` aggregates the values of each child `FormControl` into an array.
1582 * It calculates its status by reducing the status values of its children. For example, if one of
1583 * the controls in a `FormArray` is invalid, the entire array becomes invalid.
1584 *
1585 * `FormArray` is one of the three fundamental building blocks used to define forms in Angular,
1586 * along with `FormControl` and `FormGroup`.
1587 *
1588 * @usageNotes
1589 *
1590 * ### Create an array of form controls
1591 *
1592 * ```
1593 * const arr = new FormArray([
1594 * new FormControl('Nancy', Validators.minLength(2)),
1595 * new FormControl('Drew'),
1596 * ]);
1597 *
1598 * console.log(arr.value); // ['Nancy', 'Drew']
1599 * console.log(arr.status); // 'VALID'
1600 * ```
1601 *
1602 * ### Create a form array with array-level validators
1603 *
1604 * You include array-level validators and async validators. These come in handy
1605 * when you want to perform validation that considers the value of more than one child
1606 * control.
1607 *
1608 * The two types of validators are passed in separately as the second and third arg
1609 * respectively, or together as part of an options object.
1610 *
1611 * ```
1612 * const arr = new FormArray([
1613 * new FormControl('Nancy'),
1614 * new FormControl('Drew')
1615 * ], {validators: myValidator, asyncValidators: myAsyncValidator});
1616 * ```
1617 *
1618 * ### Set the updateOn property for all controls in a form array
1619 *
1620 * The options object is used to set a default value for each child
1621 * control's `updateOn` property. If you set `updateOn` to `'blur'` at the
1622 * array level, all child controls default to 'blur', unless the child
1623 * has explicitly specified a different `updateOn` value.
1624 *
1625 * ```ts
1626 * const arr = new FormArray([
1627 * new FormControl()
1628 * ], {updateOn: 'blur'});
1629 * ```
1630 *
1631 * ### Adding or removing controls from a form array
1632 *
1633 * To change the controls in the array, use the `push`, `insert`, `removeAt` or `clear` methods
1634 * in `FormArray` itself. These methods ensure the controls are properly tracked in the
1635 * form's hierarchy. Do not modify the array of `AbstractControl`s used to instantiate
1636 * the `FormArray` directly, as that result in strange and unexpected behavior such
1637 * as broken change detection.
1638 *
1639 * @publicApi
1640 */
1641export class FormArray extends AbstractControl {
1642 /**
1643 * Creates a new `FormArray` instance.
1644 *
1645 * @param controls An array of child controls. Each child control is given an index
1646 * where it is registered.
1647 *
1648 * @param validatorOrOpts A synchronous validator function, or an array of
1649 * such functions, or an `AbstractControlOptions` object that contains validation functions
1650 * and a validation trigger.
1651 *
1652 * @param asyncValidator A single async validator or array of async validator functions
1653 *
1654 */
1655 constructor(controls, validatorOrOpts, asyncValidator) {
1656 super(pickValidators(validatorOrOpts), pickAsyncValidators(asyncValidator, validatorOrOpts));
1657 this.controls = controls;
1658 this._initObservables();
1659 this._setUpdateStrategy(validatorOrOpts);
1660 this._setUpControls();
1661 this.updateValueAndValidity({
1662 onlySelf: true,
1663 // If `asyncValidator` is present, it will trigger control status change from `PENDING` to
1664 // `VALID` or `INVALID`.
1665 // The status should be broadcasted via the `statusChanges` observable, so we set `emitEvent`
1666 // to `true` to allow that during the control creation process.
1667 emitEvent: !!this.asyncValidator
1668 });
1669 }
1670 /**
1671 * Get the `AbstractControl` at the given `index` in the array.
1672 *
1673 * @param index Index in the array to retrieve the control
1674 */
1675 at(index) {
1676 return this.controls[index];
1677 }
1678 /**
1679 * Insert a new `AbstractControl` at the end of the array.
1680 *
1681 * @param control Form control to be inserted
1682 * @param options Specifies whether this FormArray instance should emit events after a new
1683 * control is added.
1684 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1685 * `valueChanges` observables emit events with the latest status and value when the control is
1686 * inserted. When false, no events are emitted.
1687 */
1688 push(control, options = {}) {
1689 this.controls.push(control);
1690 this._registerControl(control);
1691 this.updateValueAndValidity({ emitEvent: options.emitEvent });
1692 this._onCollectionChange();
1693 }
1694 /**
1695 * Insert a new `AbstractControl` at the given `index` in the array.
1696 *
1697 * @param index Index in the array to insert the control
1698 * @param control Form control to be inserted
1699 * @param options Specifies whether this FormArray instance should emit events after a new
1700 * control is inserted.
1701 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1702 * `valueChanges` observables emit events with the latest status and value when the control is
1703 * inserted. When false, no events are emitted.
1704 */
1705 insert(index, control, options = {}) {
1706 this.controls.splice(index, 0, control);
1707 this._registerControl(control);
1708 this.updateValueAndValidity({ emitEvent: options.emitEvent });
1709 }
1710 /**
1711 * Remove the control at the given `index` in the array.
1712 *
1713 * @param index Index in the array to remove the control
1714 * @param options Specifies whether this FormArray instance should emit events after a
1715 * control is removed.
1716 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1717 * `valueChanges` observables emit events with the latest status and value when the control is
1718 * removed. When false, no events are emitted.
1719 */
1720 removeAt(index, options = {}) {
1721 if (this.controls[index])
1722 this.controls[index]._registerOnCollectionChange(() => { });
1723 this.controls.splice(index, 1);
1724 this.updateValueAndValidity({ emitEvent: options.emitEvent });
1725 }
1726 /**
1727 * Replace an existing control.
1728 *
1729 * @param index Index in the array to replace the control
1730 * @param control The `AbstractControl` control to replace the existing control
1731 * @param options Specifies whether this FormArray instance should emit events after an
1732 * existing control is replaced with a new one.
1733 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1734 * `valueChanges` observables emit events with the latest status and value when the control is
1735 * replaced with a new one. When false, no events are emitted.
1736 */
1737 setControl(index, control, options = {}) {
1738 if (this.controls[index])
1739 this.controls[index]._registerOnCollectionChange(() => { });
1740 this.controls.splice(index, 1);
1741 if (control) {
1742 this.controls.splice(index, 0, control);
1743 this._registerControl(control);
1744 }
1745 this.updateValueAndValidity({ emitEvent: options.emitEvent });
1746 this._onCollectionChange();
1747 }
1748 /**
1749 * Length of the control array.
1750 */
1751 get length() {
1752 return this.controls.length;
1753 }
1754 /**
1755 * Sets the value of the `FormArray`. It accepts an array that matches
1756 * the structure of the control.
1757 *
1758 * This method performs strict checks, and throws an error if you try
1759 * to set the value of a control that doesn't exist or if you exclude the
1760 * value of a control.
1761 *
1762 * @usageNotes
1763 * ### Set the values for the controls in the form array
1764 *
1765 * ```
1766 * const arr = new FormArray([
1767 * new FormControl(),
1768 * new FormControl()
1769 * ]);
1770 * console.log(arr.value); // [null, null]
1771 *
1772 * arr.setValue(['Nancy', 'Drew']);
1773 * console.log(arr.value); // ['Nancy', 'Drew']
1774 * ```
1775 *
1776 * @param value Array of values for the controls
1777 * @param options Configure options that determine how the control propagates changes and
1778 * emits events after the value changes
1779 *
1780 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
1781 * is false.
1782 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1783 * `valueChanges`
1784 * observables emit events with the latest status and value when the control value is updated.
1785 * When false, no events are emitted.
1786 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
1787 * updateValueAndValidity} method.
1788 */
1789 setValue(value, options = {}) {
1790 this._checkAllValuesPresent(value);
1791 value.forEach((newValue, index) => {
1792 this._throwIfControlMissing(index);
1793 this.at(index).setValue(newValue, { onlySelf: true, emitEvent: options.emitEvent });
1794 });
1795 this.updateValueAndValidity(options);
1796 }
1797 /**
1798 * Patches the value of the `FormArray`. It accepts an array that matches the
1799 * structure of the control, and does its best to match the values to the correct
1800 * controls in the group.
1801 *
1802 * It accepts both super-sets and sub-sets of the array without throwing an error.
1803 *
1804 * @usageNotes
1805 * ### Patch the values for controls in a form array
1806 *
1807 * ```
1808 * const arr = new FormArray([
1809 * new FormControl(),
1810 * new FormControl()
1811 * ]);
1812 * console.log(arr.value); // [null, null]
1813 *
1814 * arr.patchValue(['Nancy']);
1815 * console.log(arr.value); // ['Nancy', null]
1816 * ```
1817 *
1818 * @param value Array of latest values for the controls
1819 * @param options Configure options that determine how the control propagates changes and
1820 * emits events after the value changes
1821 *
1822 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
1823 * is false.
1824 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1825 * `valueChanges` observables emit events with the latest status and value when the control value
1826 * is updated. When false, no events are emitted. The configuration options are passed to
1827 * the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
1828 */
1829 patchValue(value, options = {}) {
1830 // Even though the `value` argument type doesn't allow `null` and `undefined` values, the
1831 // `patchValue` can be called recursively and inner data structures might have these values, so
1832 // we just ignore such cases when a field containing FormArray instance receives `null` or
1833 // `undefined` as a value.
1834 if (value == null /* both `null` and `undefined` */)
1835 return;
1836 value.forEach((newValue, index) => {
1837 if (this.at(index)) {
1838 this.at(index).patchValue(newValue, { onlySelf: true, emitEvent: options.emitEvent });
1839 }
1840 });
1841 this.updateValueAndValidity(options);
1842 }
1843 /**
1844 * Resets the `FormArray` and all descendants are marked `pristine` and `untouched`, and the
1845 * value of all descendants to null or null maps.
1846 *
1847 * You reset to a specific form state by passing in an array of states
1848 * that matches the structure of the control. The state is a standalone value
1849 * or a form state object with both a value and a disabled status.
1850 *
1851 * @usageNotes
1852 * ### Reset the values in a form array
1853 *
1854 * ```ts
1855 * const arr = new FormArray([
1856 * new FormControl(),
1857 * new FormControl()
1858 * ]);
1859 * arr.reset(['name', 'last name']);
1860 *
1861 * console.log(arr.value); // ['name', 'last name']
1862 * ```
1863 *
1864 * ### Reset the values in a form array and the disabled status for the first control
1865 *
1866 * ```
1867 * arr.reset([
1868 * {value: 'name', disabled: true},
1869 * 'last'
1870 * ]);
1871 *
1872 * console.log(arr.value); // ['last']
1873 * console.log(arr.at(0).status); // 'DISABLED'
1874 * ```
1875 *
1876 * @param value Array of values for the controls
1877 * @param options Configure options that determine how the control propagates changes and
1878 * emits events after the value changes
1879 *
1880 * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
1881 * is false.
1882 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1883 * `valueChanges`
1884 * observables emit events with the latest status and value when the control is reset.
1885 * When false, no events are emitted.
1886 * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
1887 * updateValueAndValidity} method.
1888 */
1889 reset(value = [], options = {}) {
1890 this._forEachChild((control, index) => {
1891 control.reset(value[index], { onlySelf: true, emitEvent: options.emitEvent });
1892 });
1893 this._updatePristine(options);
1894 this._updateTouched(options);
1895 this.updateValueAndValidity(options);
1896 }
1897 /**
1898 * The aggregate value of the array, including any disabled controls.
1899 *
1900 * Reports all values regardless of disabled status.
1901 * For enabled controls only, the `value` property is the best way to get the value of the array.
1902 */
1903 getRawValue() {
1904 return this.controls.map((control) => {
1905 return control instanceof FormControl ? control.value : control.getRawValue();
1906 });
1907 }
1908 /**
1909 * Remove all controls in the `FormArray`.
1910 *
1911 * @param options Specifies whether this FormArray instance should emit events after all
1912 * controls are removed.
1913 * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
1914 * `valueChanges` observables emit events with the latest status and value when all controls
1915 * in this FormArray instance are removed. When false, no events are emitted.
1916 *
1917 * @usageNotes
1918 * ### Remove all elements from a FormArray
1919 *
1920 * ```ts
1921 * const arr = new FormArray([
1922 * new FormControl(),
1923 * new FormControl()
1924 * ]);
1925 * console.log(arr.length); // 2
1926 *
1927 * arr.clear();
1928 * console.log(arr.length); // 0
1929 * ```
1930 *
1931 * It's a simpler and more efficient alternative to removing all elements one by one:
1932 *
1933 * ```ts
1934 * const arr = new FormArray([
1935 * new FormControl(),
1936 * new FormControl()
1937 * ]);
1938 *
1939 * while (arr.length) {
1940 * arr.removeAt(0);
1941 * }
1942 * ```
1943 */
1944 clear(options = {}) {
1945 if (this.controls.length < 1)
1946 return;
1947 this._forEachChild((control) => control._registerOnCollectionChange(() => { }));
1948 this.controls.splice(0);
1949 this.updateValueAndValidity({ emitEvent: options.emitEvent });
1950 }
1951 /** @internal */
1952 _syncPendingControls() {
1953 let subtreeUpdated = this.controls.reduce((updated, child) => {
1954 return child._syncPendingControls() ? true : updated;
1955 }, false);
1956 if (subtreeUpdated)
1957 this.updateValueAndValidity({ onlySelf: true });
1958 return subtreeUpdated;
1959 }
1960 /** @internal */
1961 _throwIfControlMissing(index) {
1962 if (!this.controls.length) {
1963 throw new Error(`
1964 There are no form controls registered with this array yet. If you're using ngModel,
1965 you may want to check next tick (e.g. use setTimeout).
1966 `);
1967 }
1968 if (!this.at(index)) {
1969 throw new Error(`Cannot find form control at index ${index}`);
1970 }
1971 }
1972 /** @internal */
1973 _forEachChild(cb) {
1974 this.controls.forEach((control, index) => {
1975 cb(control, index);
1976 });
1977 }
1978 /** @internal */
1979 _updateValue() {
1980 this.value =
1981 this.controls.filter((control) => control.enabled || this.disabled)
1982 .map((control) => control.value);
1983 }
1984 /** @internal */
1985 _anyControls(condition) {
1986 return this.controls.some((control) => control.enabled && condition(control));
1987 }
1988 /** @internal */
1989 _setUpControls() {
1990 this._forEachChild((control) => this._registerControl(control));
1991 }
1992 /** @internal */
1993 _checkAllValuesPresent(value) {
1994 this._forEachChild((control, i) => {
1995 if (value[i] === undefined) {
1996 throw new Error(`Must supply a value for form control at index: ${i}.`);
1997 }
1998 });
1999 }
2000 /** @internal */
2001 _allControlsDisabled() {
2002 for (const control of this.controls) {
2003 if (control.enabled)
2004 return false;
2005 }
2006 return this.controls.length > 0 || this.disabled;
2007 }
2008 _registerControl(control) {
2009 control.setParent(this);
2010 control._registerOnCollectionChange(this._onCollectionChange);
2011 }
2012}
2013//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kZWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9mb3Jtcy9zcmMvbW9kZWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLFlBQVksRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUczQyxPQUFPLEVBQUMsY0FBYyxFQUFDLE1BQU0scUJBQXFCLENBQUM7QUFFbkQsT0FBTyxFQUFDLGFBQWEsRUFBRSxzQkFBc0IsRUFBRSxpQkFBaUIsRUFBRSxZQUFZLEVBQXVCLGdCQUFnQixFQUFFLFlBQVksRUFBQyxNQUFNLGNBQWMsQ0FBQztBQUV6Sjs7OztHQUlHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sS0FBSyxHQUFHLE9BQU8sQ0FBQztBQUU3Qjs7OztHQUlHO0FBQ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JvbE1pc3NpbmcoaW5kZXg6IG51bWJlcik6IHZvaWQge1xuICAgIGlmICghdGhpcy5jb250cm9scy5sZW5ndGgpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcihgXG4gICAgICAgIFRoZXJlIGFyZSBubyBmb3JtIGNvbnRyb2xzIHJlZ2lzdGVyZWQgd2l0aCB0aGlzIGFycmF5IHlldC4gSWYgeW91J3JlIHVzaW5nIG5nTW9kZWwsXG4gICAgICAgIHlvdSBtYXkgd2FudCB0byBjaGVjayBuZXh0IHRpY2sgKGUuZy4gdXNlIHNldFRpbWVvdXQpLlxuICAgICAgYCk7XG4gICAgfVxuICAgIGlmICghdGhpcy5hdChpbmRleCkpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcihgQ2Fubm90IGZpbmQgZm9ybSBjb250cm9sIGF0IGluZGV4ICR7aW5kZXh9YCk7XG4gICAgfVxuICB9XG5cbiAgLyoqIEBpbnRlcm5hbCAqL1xuICBvdmVycmlkZSBfZm9yRWFjaENoaWxkKGNiOiBGdW5jdGlvbik6IHZvaWQge1xuICAgIHRoaXMuY29udHJvbHMuZm9yRWFjaCgoY29udHJvbDogQWJzdHJhY3RDb250cm9sLCBpbmRleDogbnVtYmVyKSA9PiB7XG4gICAgICBjYihjb250cm9sLCBpbmRleCk7XG4gICAgfSk7XG4gIH1cblxuICAvKiogQGludGVybmFsICovXG4gIG92ZXJyaWRlIF91cGRhdGVWYWx1ZSgpOiB2b2lkIHtcbiAgICAodGhpcyBhcyB7dmFsdWU6IGFueX0pLnZhbHVlID1cbiAgICAgICAgdGhpcy5jb250cm9scy5maWx0ZXIoKGNvbnRyb2wpID0+IGNvbnRyb2wuZW5hYmxlZCB8fCB0aGlzLmRpc2FibGVkKVxuICAgICAgICAgICAgLm1hcCgoY29udHJvbCkgPT4gY29udHJvbC52YWx1ZSk7XG4gIH1cblxuICAvKiogQGludGVybmFsICovXG4gIG92ZXJyaWRlIF9hbnlDb250cm9scyhjb25kaXRpb246IEZ1b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XRQYXJlbnQodGhpcyk7XG4gICAgY29udHJvbC5fcmVnaXN0ZXJPbkNvbGxlY3Rpb25DaGFuZ2UodGhpcy5fb25Db2xsZWN0aW9uQ2hhbmdlKTtcbiAgfVxufVxuIl19
Note: See TracBrowser for help on using the repository browser.