parent
3903e5ebe7
commit
982bc7f2aa
|
@ -16,6 +16,7 @@ import {ValidationErrors} from './validators';
|
|||
*
|
||||
* This class is only used internally in the `ReactiveFormsModule` and the `FormsModule`.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class AbstractControlDirective {
|
||||
/**
|
||||
|
|
|
@ -21,6 +21,7 @@ import {AsyncValidatorFn, ValidatorFn} from './validators';
|
|||
* @description
|
||||
* A base class for code shared between the `NgModelGroup` and `FormGroupName` directives.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,7 @@ export const CHECKBOX_VALUE_ACCESSOR: any = {
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector:
|
||||
|
|
|
@ -14,6 +14,8 @@ import {Form} from './form_interface';
|
|||
* @description
|
||||
* A base class for directives that contain multiple registered instances of `NgControl`.
|
||||
* Only used by the forms module.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class ControlContainer extends AbstractControlDirective {
|
||||
/**
|
||||
|
|
|
@ -17,6 +17,8 @@ import {InjectionToken} from '@angular/core';
|
|||
* that integrates with Angular forms.
|
||||
*
|
||||
* @see DefaultValueAccessor
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface ControlValueAccessor {
|
||||
/**
|
||||
|
@ -134,5 +136,6 @@ export interface ControlValueAccessor {
|
|||
*
|
||||
* See `DefaultValueAccessor` for how to implement one.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const NG_VALUE_ACCESSOR = new InjectionToken<ControlValueAccessor>('NgValueAccessor');
|
||||
|
|
|
@ -44,6 +44,7 @@ export const COMPOSITION_BUFFER_MODE = new InjectionToken<boolean>('CompositionE
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector:
|
||||
|
|
|
@ -18,6 +18,8 @@ import {NgControl} from './ng_control';
|
|||
* An interface implemented by `FormGroupDirective` and `NgForm` directives.
|
||||
*
|
||||
* Only used by the `ReactiveFormsModule` and `FormsModule`.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface Form {
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,8 @@ function unimplemented(): any {
|
|||
* @description
|
||||
* A base class that all control `FormControl`-based directives extend. It binds a `FormControl`
|
||||
* object to a DOM element.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class NgControl extends AbstractControlDirective {
|
||||
/**
|
||||
|
|
|
@ -51,6 +51,7 @@ export const ngControlStatusHost = {
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({selector: '[formControlName],[ngModel],[formControl]', host: ngControlStatusHost})
|
||||
export class NgControlStatus extends AbstractControlStatus {
|
||||
|
@ -63,6 +64,7 @@ export class NgControlStatus extends AbstractControlStatus {
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector:
|
||||
|
|
|
@ -74,6 +74,7 @@ const resolvedPromise = Promise.resolve(null);
|
|||
* {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
|
||||
*
|
||||
* @ngModule FormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,ng-form,[ngForm]',
|
||||
|
|
|
@ -19,6 +19,7 @@ export const NG_FORM_SELECTOR_WARNING = new InjectionToken('NgFormSelectorWarnin
|
|||
*
|
||||
* @deprecated in Angular v6 and will be removed in Angular v9.
|
||||
* @ngModule FormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({selector: 'ngForm'})
|
||||
export class NgFormSelectorWarning {
|
||||
|
|
|
@ -98,6 +98,7 @@ const resolvedPromise = Promise.resolve(null);
|
|||
* * Selects: `SelectControlValueAccessor`
|
||||
*
|
||||
* @ngModule FormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector: '[ngModel]:not([formControlName]):not([formControl])',
|
||||
|
|
|
@ -40,6 +40,7 @@ export const modelGroupProvider: any = {
|
|||
* {@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'}
|
||||
*
|
||||
* @ngModule FormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup'})
|
||||
export class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {
|
||||
|
|
|
@ -82,6 +82,7 @@ export class RadioControlRegistry {
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector:
|
||||
|
|
|
@ -133,6 +133,7 @@ export const formControlBinding: any = {
|
|||
* the pattern is being used as the code is being updated.
|
||||
*
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({selector: '[formControl]', providers: [formControlBinding], exportAs: 'ngForm'})
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ export const controlNameBinding: any = {
|
|||
* the pattern is being used as the code is being updated.
|
||||
*
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({selector: '[formControlName]', providers: [controlNameBinding]})
|
||||
export class FormControlName extends NgControl implements OnChanges, OnDestroy {
|
||||
|
|
|
@ -54,6 +54,7 @@ export const formDirectiveProvider: any = {
|
|||
* {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
|
||||
*
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector: '[formGroup]',
|
||||
|
|
|
@ -63,6 +63,7 @@ export const formGroupNameProvider: any = {
|
|||
* {@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
|
||||
*
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({selector: '[formGroupName]', providers: [formGroupNameProvider]})
|
||||
export class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy {
|
||||
|
@ -135,6 +136,7 @@ export const formArrayNameProvider: any = {
|
|||
* {@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
|
||||
*
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({selector: '[formArrayName]', providers: [formArrayNameProvider]})
|
||||
export class FormArrayName extends ControlContainer implements OnInit, OnDestroy {
|
||||
|
|
|
@ -88,6 +88,7 @@ function _extractId(valueString: string): string {
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector:
|
||||
|
@ -166,6 +167,7 @@ export class SelectControlValueAccessor implements ControlValueAccessor {
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({selector: 'option'})
|
||||
export class NgSelectOption implements OnDestroy {
|
||||
|
|
|
@ -71,6 +71,7 @@ abstract class HTMLCollection {
|
|||
*
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @ngModule FormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector:
|
||||
|
|
|
@ -45,6 +45,8 @@ export type ValidationErrors = {
|
|||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface Validator {
|
||||
/**
|
||||
|
@ -135,6 +137,7 @@ export const CHECKBOX_REQUIRED_VALIDATOR: StaticProvider = {
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector:
|
||||
|
@ -240,8 +243,14 @@ export class EmailValidator implements Validator {
|
|||
registerOnValidatorChange(fn: () => void): void { this._onChange = fn; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export interface ValidatorFn { (control: AbstractControl): ValidationErrors|null; }
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export interface AsyncValidatorFn {
|
||||
(control: AbstractControl): Promise<ValidationErrors|null>|Observable<ValidationErrors|null>;
|
||||
}
|
||||
|
@ -266,6 +275,7 @@ export const MIN_LENGTH_VALIDATOR: any = {
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector: '[minlength][formControlName],[minlength][formControl],[minlength][ngModel]',
|
||||
|
@ -320,6 +330,7 @@ export const MAX_LENGTH_VALIDATOR: any = {
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]',
|
||||
|
@ -377,6 +388,7 @@ export const PATTERN_VALIDATOR: any = {
|
|||
*
|
||||
* @ngModule FormsModule
|
||||
* @ngModule ReactiveFormsModule
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive({
|
||||
selector: '[pattern][formControlName],[pattern][formControl],[pattern][ngModel]',
|
||||
|
|
|
@ -21,6 +21,7 @@ import {AbstractControl, FormArray, FormControl, FormGroup} from './model';
|
|||
*
|
||||
* @see [Reactive Forms Guide](/guide/reactive-forms)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
@Injectable()
|
||||
export class FormBuilder {
|
||||
|
|
|
@ -18,6 +18,8 @@ import {FormBuilder} from './form_builder';
|
|||
* @see [Forms](guide/forms)
|
||||
*
|
||||
* @see [Forms Guide](/guide/forms)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
@NgModule({
|
||||
declarations: TEMPLATE_DRIVEN_DIRECTIVES,
|
||||
|
@ -51,6 +53,7 @@ export class FormsModule {
|
|||
*
|
||||
* @see [Reactive Forms Guide](/guide/reactive-forms)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
@NgModule({
|
||||
declarations: [REACTIVE_DRIVEN_DIRECTIVES],
|
||||
|
|
|
@ -130,6 +130,7 @@ function isOptionsObj(
|
|||
* @see [Reactive Forms Guide](/guide/reactive-forms)
|
||||
* @see [Dynamic Forms Guide](/guide/dynamic-form)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class AbstractControl {
|
||||
/** @internal */
|
||||
|
@ -868,7 +869,8 @@ export abstract class AbstractControl {
|
|||
* console.log(control.value); // 'Drew'
|
||||
* console.log(control.status); // 'DISABLED'
|
||||
*
|
||||
*/
|
||||
* @publicApi
|
||||
*/
|
||||
export class FormControl extends AbstractControl {
|
||||
/** @internal */
|
||||
_onChange: Function[] = [];
|
||||
|
@ -1124,6 +1126,8 @@ export class FormControl extends AbstractControl {
|
|||
* one: new FormControl()
|
||||
* }, { updateOn: 'blur' });
|
||||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class FormGroup extends AbstractControl {
|
||||
/**
|
||||
|
@ -1540,7 +1544,7 @@ export class FormGroup extends AbstractControl {
|
|||
* the `FormArray` directly, as that result in strange and unexpected behavior such
|
||||
* as broken change detection.
|
||||
*
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class FormArray extends AbstractControl {
|
||||
/**
|
||||
|
|
|
@ -42,6 +42,7 @@ function isEmptyInputValue(value: any): boolean {
|
|||
* }
|
||||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const NG_VALIDATORS = new InjectionToken<Array<Validator|Function>>('NgValidators');
|
||||
|
||||
|
@ -51,6 +52,7 @@ export const NG_VALIDATORS = new InjectionToken<Array<Validator|Function>>('NgVa
|
|||
*
|
||||
* @see `NG_VALIDATORS`
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export const NG_ASYNC_VALIDATORS =
|
||||
new InjectionToken<Array<Validator|Function>>('NgAsyncValidators');
|
||||
|
@ -67,6 +69,7 @@ const EMAIL_REGEXP =
|
|||
*
|
||||
* @see [Form Validation](/guide/form-validation)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class Validators {
|
||||
/**
|
||||
|
|
|
@ -14,4 +14,7 @@
|
|||
|
||||
import {Version} from '@angular/core';
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export const VERSION = new Version('0.0.0-PLACEHOLDER');
|
||||
|
|
|
@ -85,7 +85,6 @@ export declare abstract class AbstractControlDirective {
|
|||
reset(value?: any): void;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export interface AbstractControlOptions {
|
||||
asyncValidators?: AsyncValidatorFn | AsyncValidatorFn[] | null;
|
||||
updateOn?: 'change' | 'blur' | 'submit';
|
||||
|
@ -102,7 +101,6 @@ export declare class AbstractFormGroupDirective extends ControlContainer impleme
|
|||
ngOnInit(): void;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export interface AsyncValidator extends Validator {
|
||||
validate(control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>;
|
||||
}
|
||||
|
@ -121,12 +119,10 @@ export declare class CheckboxControlValueAccessor implements ControlValueAccesso
|
|||
writeValue(value: any): void;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class CheckboxRequiredValidator extends RequiredValidator {
|
||||
validate(control: AbstractControl): ValidationErrors | null;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare const COMPOSITION_BUFFER_MODE: InjectionToken<boolean>;
|
||||
|
||||
export declare abstract class ControlContainer extends AbstractControlDirective {
|
||||
|
@ -152,7 +148,6 @@ export declare class DefaultValueAccessor implements ControlValueAccessor {
|
|||
writeValue(value: any): void;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class EmailValidator implements Validator {
|
||||
email: boolean | string;
|
||||
registerOnValidatorChange(fn: () => void): void;
|
||||
|
@ -498,7 +493,6 @@ export declare class SelectMultipleControlValueAccessor implements ControlValueA
|
|||
writeValue(value: any): void;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare type ValidationErrors = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue