docs: update forms with `@publicApi` tags (#26595)

PR Close #26595
This commit is contained in:
Pete Bacon Darwin 2018-10-19 17:36:24 +01:00 committed by Alex Rickabaugh
parent 3903e5ebe7
commit 982bc7f2aa
27 changed files with 56 additions and 8 deletions

View File

@ -16,6 +16,7 @@ import {ValidationErrors} from './validators';
* *
* This class is only used internally in the `ReactiveFormsModule` and the `FormsModule`. * This class is only used internally in the `ReactiveFormsModule` and the `FormsModule`.
* *
* @publicApi
*/ */
export abstract class AbstractControlDirective { export abstract class AbstractControlDirective {
/** /**

View File

@ -21,6 +21,7 @@ import {AsyncValidatorFn, ValidatorFn} from './validators';
* @description * @description
* A base class for code shared between the `NgModelGroup` and `FormGroupName` directives. * A base class for code shared between the `NgModelGroup` and `FormGroupName` directives.
* *
* @publicApi
*/ */
export class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy { export class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
/** /**

View File

@ -28,6 +28,7 @@ export const CHECKBOX_VALUE_ACCESSOR: any = {
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: selector:

View File

@ -14,6 +14,8 @@ import {Form} from './form_interface';
* @description * @description
* A base class for directives that contain multiple registered instances of `NgControl`. * A base class for directives that contain multiple registered instances of `NgControl`.
* Only used by the forms module. * Only used by the forms module.
*
* @publicApi
*/ */
export abstract class ControlContainer extends AbstractControlDirective { export abstract class ControlContainer extends AbstractControlDirective {
/** /**

View File

@ -17,6 +17,8 @@ import {InjectionToken} from '@angular/core';
* that integrates with Angular forms. * that integrates with Angular forms.
* *
* @see DefaultValueAccessor * @see DefaultValueAccessor
*
* @publicApi
*/ */
export interface ControlValueAccessor { export interface ControlValueAccessor {
/** /**
@ -134,5 +136,6 @@ export interface ControlValueAccessor {
* *
* See `DefaultValueAccessor` for how to implement one. * See `DefaultValueAccessor` for how to implement one.
* *
* @publicApi
*/ */
export const NG_VALUE_ACCESSOR = new InjectionToken<ControlValueAccessor>('NgValueAccessor'); export const NG_VALUE_ACCESSOR = new InjectionToken<ControlValueAccessor>('NgValueAccessor');

View File

@ -44,6 +44,7 @@ export const COMPOSITION_BUFFER_MODE = new InjectionToken<boolean>('CompositionE
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: selector:

View File

@ -18,6 +18,8 @@ import {NgControl} from './ng_control';
* An interface implemented by `FormGroupDirective` and `NgForm` directives. * An interface implemented by `FormGroupDirective` and `NgForm` directives.
* *
* Only used by the `ReactiveFormsModule` and `FormsModule`. * Only used by the `ReactiveFormsModule` and `FormsModule`.
*
* @publicApi
*/ */
export interface Form { export interface Form {
/** /**

View File

@ -20,6 +20,8 @@ function unimplemented(): any {
* @description * @description
* A base class that all control `FormControl`-based directives extend. It binds a `FormControl` * A base class that all control `FormControl`-based directives extend. It binds a `FormControl`
* object to a DOM element. * object to a DOM element.
*
* @publicApi
*/ */
export abstract class NgControl extends AbstractControlDirective { export abstract class NgControl extends AbstractControlDirective {
/** /**

View File

@ -51,6 +51,7 @@ export const ngControlStatusHost = {
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({selector: '[formControlName],[ngModel],[formControl]', host: ngControlStatusHost}) @Directive({selector: '[formControlName],[ngModel],[formControl]', host: ngControlStatusHost})
export class NgControlStatus extends AbstractControlStatus { export class NgControlStatus extends AbstractControlStatus {
@ -63,6 +64,7 @@ export class NgControlStatus extends AbstractControlStatus {
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: selector:

View File

@ -74,6 +74,7 @@ const resolvedPromise = Promise.resolve(null);
* {@example forms/ts/simpleForm/simple_form_example.ts region='Component'} * {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
* *
* @ngModule FormsModule * @ngModule FormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,ng-form,[ngForm]', selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,ng-form,[ngForm]',

View File

@ -19,6 +19,7 @@ export const NG_FORM_SELECTOR_WARNING = new InjectionToken('NgFormSelectorWarnin
* *
* @deprecated in Angular v6 and will be removed in Angular v9. * @deprecated in Angular v6 and will be removed in Angular v9.
* @ngModule FormsModule * @ngModule FormsModule
* @publicApi
*/ */
@Directive({selector: 'ngForm'}) @Directive({selector: 'ngForm'})
export class NgFormSelectorWarning { export class NgFormSelectorWarning {

View File

@ -98,6 +98,7 @@ const resolvedPromise = Promise.resolve(null);
* * Selects: `SelectControlValueAccessor` * * Selects: `SelectControlValueAccessor`
* *
* @ngModule FormsModule * @ngModule FormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: '[ngModel]:not([formControlName]):not([formControl])', selector: '[ngModel]:not([formControlName]):not([formControl])',

View File

@ -40,6 +40,7 @@ export const modelGroupProvider: any = {
* {@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'} * {@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'}
* *
* @ngModule FormsModule * @ngModule FormsModule
* @publicApi
*/ */
@Directive({selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup'}) @Directive({selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup'})
export class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy { export class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {

View File

@ -82,6 +82,7 @@ export class RadioControlRegistry {
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: selector:

View File

@ -133,6 +133,7 @@ export const formControlBinding: any = {
* the pattern is being used as the code is being updated. * the pattern is being used as the code is being updated.
* *
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({selector: '[formControl]', providers: [formControlBinding], exportAs: 'ngForm'}) @Directive({selector: '[formControl]', providers: [formControlBinding], exportAs: 'ngForm'})

View File

@ -145,6 +145,7 @@ export const controlNameBinding: any = {
* the pattern is being used as the code is being updated. * the pattern is being used as the code is being updated.
* *
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({selector: '[formControlName]', providers: [controlNameBinding]}) @Directive({selector: '[formControlName]', providers: [controlNameBinding]})
export class FormControlName extends NgControl implements OnChanges, OnDestroy { export class FormControlName extends NgControl implements OnChanges, OnDestroy {

View File

@ -54,6 +54,7 @@ export const formDirectiveProvider: any = {
* {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'} * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
* *
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: '[formGroup]', selector: '[formGroup]',

View File

@ -63,6 +63,7 @@ export const formGroupNameProvider: any = {
* {@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'} * {@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
* *
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({selector: '[formGroupName]', providers: [formGroupNameProvider]}) @Directive({selector: '[formGroupName]', providers: [formGroupNameProvider]})
export class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy { 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'} * {@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
* *
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({selector: '[formArrayName]', providers: [formArrayNameProvider]}) @Directive({selector: '[formArrayName]', providers: [formArrayNameProvider]})
export class FormArrayName extends ControlContainer implements OnInit, OnDestroy { export class FormArrayName extends ControlContainer implements OnInit, OnDestroy {

View File

@ -88,6 +88,7 @@ function _extractId(valueString: string): string {
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: selector:
@ -166,6 +167,7 @@ export class SelectControlValueAccessor implements ControlValueAccessor {
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({selector: 'option'}) @Directive({selector: 'option'})
export class NgSelectOption implements OnDestroy { export class NgSelectOption implements OnDestroy {

View File

@ -71,6 +71,7 @@ abstract class HTMLCollection {
* *
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @ngModule FormsModule * @ngModule FormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: selector:

View File

@ -45,6 +45,8 @@ export type ValidationErrors = {
* } * }
* } * }
* ``` * ```
*
* @publicApi
*/ */
export interface Validator { export interface Validator {
/** /**
@ -135,6 +137,7 @@ export const CHECKBOX_REQUIRED_VALIDATOR: StaticProvider = {
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: selector:
@ -240,8 +243,14 @@ export class EmailValidator implements Validator {
registerOnValidatorChange(fn: () => void): void { this._onChange = fn; } registerOnValidatorChange(fn: () => void): void { this._onChange = fn; }
} }
/**
* @publicApi
*/
export interface ValidatorFn { (control: AbstractControl): ValidationErrors|null; } export interface ValidatorFn { (control: AbstractControl): ValidationErrors|null; }
/**
* @publicApi
*/
export interface AsyncValidatorFn { export interface AsyncValidatorFn {
(control: AbstractControl): Promise<ValidationErrors|null>|Observable<ValidationErrors|null>; (control: AbstractControl): Promise<ValidationErrors|null>|Observable<ValidationErrors|null>;
} }
@ -266,6 +275,7 @@ export const MIN_LENGTH_VALIDATOR: any = {
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: '[minlength][formControlName],[minlength][formControl],[minlength][ngModel]', selector: '[minlength][formControlName],[minlength][formControl],[minlength][ngModel]',
@ -320,6 +330,7 @@ export const MAX_LENGTH_VALIDATOR: any = {
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]', selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]',
@ -377,6 +388,7 @@ export const PATTERN_VALIDATOR: any = {
* *
* @ngModule FormsModule * @ngModule FormsModule
* @ngModule ReactiveFormsModule * @ngModule ReactiveFormsModule
* @publicApi
*/ */
@Directive({ @Directive({
selector: '[pattern][formControlName],[pattern][formControl],[pattern][ngModel]', selector: '[pattern][formControlName],[pattern][formControl],[pattern][ngModel]',

View File

@ -21,6 +21,7 @@ import {AbstractControl, FormArray, FormControl, FormGroup} from './model';
* *
* @see [Reactive Forms Guide](/guide/reactive-forms) * @see [Reactive Forms Guide](/guide/reactive-forms)
* *
* @publicApi
*/ */
@Injectable() @Injectable()
export class FormBuilder { export class FormBuilder {

View File

@ -18,6 +18,8 @@ import {FormBuilder} from './form_builder';
* @see [Forms](guide/forms) * @see [Forms](guide/forms)
* *
* @see [Forms Guide](/guide/forms) * @see [Forms Guide](/guide/forms)
*
* @publicApi
*/ */
@NgModule({ @NgModule({
declarations: TEMPLATE_DRIVEN_DIRECTIVES, declarations: TEMPLATE_DRIVEN_DIRECTIVES,
@ -51,6 +53,7 @@ export class FormsModule {
* *
* @see [Reactive Forms Guide](/guide/reactive-forms) * @see [Reactive Forms Guide](/guide/reactive-forms)
* *
* @publicApi
*/ */
@NgModule({ @NgModule({
declarations: [REACTIVE_DRIVEN_DIRECTIVES], declarations: [REACTIVE_DRIVEN_DIRECTIVES],

View File

@ -130,6 +130,7 @@ function isOptionsObj(
* @see [Reactive Forms Guide](/guide/reactive-forms) * @see [Reactive Forms Guide](/guide/reactive-forms)
* @see [Dynamic Forms Guide](/guide/dynamic-form) * @see [Dynamic Forms Guide](/guide/dynamic-form)
* *
* @publicApi
*/ */
export abstract class AbstractControl { export abstract class AbstractControl {
/** @internal */ /** @internal */
@ -868,7 +869,8 @@ export abstract class AbstractControl {
* console.log(control.value); // 'Drew' * console.log(control.value); // 'Drew'
* console.log(control.status); // 'DISABLED' * console.log(control.status); // 'DISABLED'
* *
*/ * @publicApi
*/
export class FormControl extends AbstractControl { export class FormControl extends AbstractControl {
/** @internal */ /** @internal */
_onChange: Function[] = []; _onChange: Function[] = [];
@ -1124,6 +1126,8 @@ export class FormControl extends AbstractControl {
* one: new FormControl() * one: new FormControl()
* }, { updateOn: 'blur' }); * }, { updateOn: 'blur' });
* ``` * ```
*
* @publicApi
*/ */
export class FormGroup extends AbstractControl { 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 * the `FormArray` directly, as that result in strange and unexpected behavior such
* as broken change detection. * as broken change detection.
* *
* * @publicApi
*/ */
export class FormArray extends AbstractControl { export class FormArray extends AbstractControl {
/** /**

View File

@ -42,6 +42,7 @@ function isEmptyInputValue(value: any): boolean {
* } * }
* ``` * ```
* *
* @publicApi
*/ */
export const NG_VALIDATORS = new InjectionToken<Array<Validator|Function>>('NgValidators'); 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` * @see `NG_VALIDATORS`
* *
* @publicApi
*/ */
export const NG_ASYNC_VALIDATORS = export const NG_ASYNC_VALIDATORS =
new InjectionToken<Array<Validator|Function>>('NgAsyncValidators'); new InjectionToken<Array<Validator|Function>>('NgAsyncValidators');
@ -67,6 +69,7 @@ const EMAIL_REGEXP =
* *
* @see [Form Validation](/guide/form-validation) * @see [Form Validation](/guide/form-validation)
* *
* @publicApi
*/ */
export class Validators { export class Validators {
/** /**

View File

@ -14,4 +14,7 @@
import {Version} from '@angular/core'; import {Version} from '@angular/core';
/**
* @publicApi
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER'); export const VERSION = new Version('0.0.0-PLACEHOLDER');

View File

@ -85,7 +85,6 @@ export declare abstract class AbstractControlDirective {
reset(value?: any): void; reset(value?: any): void;
} }
/** @experimental */
export interface AbstractControlOptions { export interface AbstractControlOptions {
asyncValidators?: AsyncValidatorFn | AsyncValidatorFn[] | null; asyncValidators?: AsyncValidatorFn | AsyncValidatorFn[] | null;
updateOn?: 'change' | 'blur' | 'submit'; updateOn?: 'change' | 'blur' | 'submit';
@ -102,7 +101,6 @@ export declare class AbstractFormGroupDirective extends ControlContainer impleme
ngOnInit(): void; ngOnInit(): void;
} }
/** @experimental */
export interface AsyncValidator extends Validator { export interface AsyncValidator extends Validator {
validate(control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>; validate(control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>;
} }
@ -121,12 +119,10 @@ export declare class CheckboxControlValueAccessor implements ControlValueAccesso
writeValue(value: any): void; writeValue(value: any): void;
} }
/** @experimental */
export declare class CheckboxRequiredValidator extends RequiredValidator { export declare class CheckboxRequiredValidator extends RequiredValidator {
validate(control: AbstractControl): ValidationErrors | null; validate(control: AbstractControl): ValidationErrors | null;
} }
/** @experimental */
export declare const COMPOSITION_BUFFER_MODE: InjectionToken<boolean>; export declare const COMPOSITION_BUFFER_MODE: InjectionToken<boolean>;
export declare abstract class ControlContainer extends AbstractControlDirective { export declare abstract class ControlContainer extends AbstractControlDirective {
@ -152,7 +148,6 @@ export declare class DefaultValueAccessor implements ControlValueAccessor {
writeValue(value: any): void; writeValue(value: any): void;
} }
/** @experimental */
export declare class EmailValidator implements Validator { export declare class EmailValidator implements Validator {
email: boolean | string; email: boolean | string;
registerOnValidatorChange(fn: () => void): void; registerOnValidatorChange(fn: () => void): void;
@ -498,7 +493,6 @@ export declare class SelectMultipleControlValueAccessor implements ControlValueA
writeValue(value: any): void; writeValue(value: any): void;
} }
/** @experimental */
export declare type ValidationErrors = { export declare type ValidationErrors = {
[key: string]: any; [key: string]: any;
}; };