2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google Inc. 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
|
|
|
|
|
*/
|
|
|
|
|
|
2016-06-10 11:15:59 -07:00
|
|
|
import {FormControl, FormGroup} from '../model';
|
2016-06-08 16:38:52 -07:00
|
|
|
|
2016-06-12 16:37:42 -07:00
|
|
|
import {AbstractFormGroupDirective} from './abstract_form_group_directive';
|
2016-06-08 15:36:24 -07:00
|
|
|
import {NgControl} from './ng_control';
|
2016-06-12 16:37:42 -07:00
|
|
|
|
2016-06-08 16:38:52 -07:00
|
|
|
|
2016-06-08 15:36:24 -07:00
|
|
|
|
|
|
|
|
/**
|
2018-08-27 15:37:47 -05:00
|
|
|
* @description
|
|
|
|
|
* An interface implemented by `FormGroupDirective` and `NgForm` directives.
|
2018-04-05 22:31:44 +01:00
|
|
|
*
|
2018-09-17 14:36:00 -05:00
|
|
|
* Only used by the `ReactiveFormsModule` and `FormsModule`.
|
2018-10-19 17:36:24 +01:00
|
|
|
*
|
|
|
|
|
* @publicApi
|
2016-06-08 15:36:24 -07:00
|
|
|
*/
|
|
|
|
|
export interface Form {
|
|
|
|
|
/**
|
2018-08-27 15:37:47 -05:00
|
|
|
* @description
|
2016-06-08 15:36:24 -07:00
|
|
|
* Add a control to this form.
|
2018-08-27 15:37:47 -05:00
|
|
|
*
|
2018-09-17 14:36:00 -05:00
|
|
|
* @param dir The control directive to add to the form.
|
2016-06-08 15:36:24 -07:00
|
|
|
*/
|
2016-06-23 09:55:26 -07:00
|
|
|
addControl(dir: NgControl): void;
|
2016-06-08 15:36:24 -07:00
|
|
|
|
|
|
|
|
/**
|
2018-08-27 15:37:47 -05:00
|
|
|
* @description
|
2016-06-08 15:36:24 -07:00
|
|
|
* Remove a control from this form.
|
2018-08-27 15:37:47 -05:00
|
|
|
*
|
2018-09-17 14:36:00 -05:00
|
|
|
* @param dir: The control directive to remove from the form.
|
2016-06-08 15:36:24 -07:00
|
|
|
*/
|
|
|
|
|
removeControl(dir: NgControl): void;
|
|
|
|
|
|
|
|
|
|
/**
|
2018-08-27 15:37:47 -05:00
|
|
|
* @description
|
2018-09-17 14:36:00 -05:00
|
|
|
* The control directive from which to get the `FormControl`.
|
2018-08-27 15:37:47 -05:00
|
|
|
*
|
2018-09-17 14:36:00 -05:00
|
|
|
* @param dir: The control directive.
|
2016-06-08 15:36:24 -07:00
|
|
|
*/
|
2016-06-10 11:15:59 -07:00
|
|
|
getControl(dir: NgControl): FormControl;
|
2016-06-08 15:36:24 -07:00
|
|
|
|
|
|
|
|
/**
|
2018-08-27 15:37:47 -05:00
|
|
|
* @description
|
2016-06-08 15:36:24 -07:00
|
|
|
* Add a group of controls to this form.
|
2018-08-27 15:37:47 -05:00
|
|
|
*
|
2018-09-17 14:36:00 -05:00
|
|
|
* @param dir: The control group directive to add.
|
2016-06-08 15:36:24 -07:00
|
|
|
*/
|
2016-06-12 16:37:42 -07:00
|
|
|
addFormGroup(dir: AbstractFormGroupDirective): void;
|
2016-06-08 15:36:24 -07:00
|
|
|
|
|
|
|
|
/**
|
2018-08-27 15:37:47 -05:00
|
|
|
* @description
|
|
|
|
|
* Remove a group of controls to this form.
|
|
|
|
|
*
|
2018-09-17 14:36:00 -05:00
|
|
|
* @param dir: The control group directive to remove.
|
2016-06-08 15:36:24 -07:00
|
|
|
*/
|
2016-06-12 16:37:42 -07:00
|
|
|
removeFormGroup(dir: AbstractFormGroupDirective): void;
|
2016-06-08 15:36:24 -07:00
|
|
|
|
|
|
|
|
/**
|
2018-08-27 15:37:47 -05:00
|
|
|
* @description
|
2018-09-17 14:36:00 -05:00
|
|
|
* The `FormGroup` associated with a particular `AbstractFormGroupDirective`.
|
2018-08-27 15:37:47 -05:00
|
|
|
*
|
2018-09-17 14:36:00 -05:00
|
|
|
* @param dir: The form group directive from which to get the `FormGroup`.
|
2016-06-08 15:36:24 -07:00
|
|
|
*/
|
2016-06-12 16:37:42 -07:00
|
|
|
getFormGroup(dir: AbstractFormGroupDirective): FormGroup;
|
2016-06-08 15:36:24 -07:00
|
|
|
|
|
|
|
|
/**
|
2018-08-27 15:37:47 -05:00
|
|
|
* @description
|
2016-06-08 15:36:24 -07:00
|
|
|
* Update the model for a particular control with a new value.
|
2018-08-27 15:37:47 -05:00
|
|
|
*
|
2018-09-17 14:36:00 -05:00
|
|
|
* @param dir: The control directive to update.
|
|
|
|
|
* @param value: The new value for the control.
|
2016-06-08 15:36:24 -07:00
|
|
|
*/
|
|
|
|
|
updateModel(dir: NgControl, value: any): void;
|
|
|
|
|
}
|