chore(forms): update forms labels (#10873)

This commit is contained in:
Kara 2016-08-17 07:44:39 -07:00 committed by vikerman
parent 675e582ffd
commit 6fd5bc075d
24 changed files with 93 additions and 90 deletions

View File

@ -69,12 +69,12 @@ export const REACTIVE_DRIVEN_DIRECTIVES: Type<any>[] =
* })
* class MyApp {}
* ```
* @experimental
* @stable
*/
export const FORM_DIRECTIVES: Type<any>[][] = [TEMPLATE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES];
/**
* @experimental
* @stable
*/
export const REACTIVE_FORM_DIRECTIVES: Type<any>[][] =

View File

@ -16,7 +16,7 @@ import {AbstractControl} from '../model';
*
* Only used internally in the forms module.
*
* @experimental
* @stable
*/
export abstract class AbstractControlDirective {
get control(): AbstractControl { throw new BaseException('unimplemented'); }

View File

@ -20,7 +20,7 @@ import {AsyncValidatorFn, ValidatorFn} from './validators';
/**
* This is a base class for code shared between {@link NgModelGroup} and {@link FormGroupName}.
*
* @experimental
* @stable
*/
export class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
/** @internal */

View File

@ -24,7 +24,7 @@ export const CHECKBOX_VALUE_ACCESSOR: any = {
* <input type="checkbox" name="rememberLogin" ngModel>
* ```
*
* @experimental
* @stable
*/
@Directive({
selector:

View File

@ -15,7 +15,7 @@ import {Form} from './form_interface';
*
* Only used by the forms module.
*
* @experimental
* @stable
*/
export class ControlContainer extends AbstractControlDirective {
name: string;

View File

@ -16,7 +16,7 @@ import {OpaqueToken} from '@angular/core';
*
* Please see {@link DefaultValueAccessor} for more information.
*
* @experimental
* @stable
*/
export interface ControlValueAccessor {
/**
@ -39,6 +39,6 @@ export interface ControlValueAccessor {
* Used to provide a {@link ControlValueAccessor} for form controls.
*
* See {@link DefaultValueAccessor} for how to implement one.
* @experimental
* @stable
*/
export const NG_VALUE_ACCESSOR: OpaqueToken = new OpaqueToken('NgValueAccessor');

View File

@ -27,7 +27,7 @@ export const DEFAULT_VALUE_ACCESSOR: any = {
* <input type="text" name="searchQuery" ngModel>
* ```
*
* @experimental
* @stable
*/
@Directive({
selector:

View File

@ -18,11 +18,11 @@ function unimplemented(): any {
/**
* A base class that all control directive extend.
* It binds a {@link Control} object to a DOM element.
* It binds a {@link FormControl} object to a DOM element.
*
* Used internally by Angular forms.
*
* @experimental
* @stable
*/
export abstract class NgControl extends AbstractControlDirective {
name: string = null;

View File

@ -52,7 +52,7 @@ export const ngControlStatusHost = {
* Directive automatically applied to Angular form controls that sets CSS classes
* based on control status (valid/invalid/dirty/etc).
*
* @experimental
* @stable
*/
@Directive({selector: '[formControlName],[ngModel],[formControl]', host: ngControlStatusHost})
export class NgControlStatus extends AbstractControlStatus {
@ -63,7 +63,7 @@ export class NgControlStatus extends AbstractControlStatus {
* Directive automatically applied to Angular form groups that sets CSS classes
* based on control status (valid/invalid/dirty/etc).
*
* @experimental
* @stable
*/
@Directive({
selector:

View File

@ -85,7 +85,7 @@ const resolvedPromise = Promise.resolve(null);
* }
* ```
*
* @experimental
* @stable
*/
@Directive({
selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]',

View File

@ -49,7 +49,7 @@ const resolvedPromise = Promise.resolve(null);
* }
* ```
*
* @experimental
* @stable
*/
@Directive({
selector: '[ngModel]:not([formControlName]):not([formControl])',

View File

@ -55,7 +55,7 @@ export const modelGroupProvider: any = {
* This example declares a model group for a user's name. The value and validation state of
* this group can be accessed separately from the overall form.
*
* @experimental
* @stable
*/
@Directive({selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup'})
export class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {

View File

@ -70,7 +70,7 @@ export const formControlBinding: any = {
* }
* ```
*
* @experimental
* @stable
*/
@Directive({selector: '[formControl]', providers: [formControlBinding], exportAs: 'ngForm'})

View File

@ -92,7 +92,7 @@ export const controlNameBinding: any = {
* }
* ```
*
* @experimental
* @stable
*/
@Directive({selector: '[formControlName]', providers: [controlNameBinding]})
export class FormControlName extends NgControl implements OnChanges, OnDestroy {

View File

@ -94,7 +94,7 @@ export const formDirectiveProvider: any = {
* }
* ```
*
* @experimental
* @stable
*/
@Directive({
selector: '[formGroup]',

View File

@ -68,7 +68,7 @@ export const formGroupNameProvider: any = {
* This example syncs the form group for the user's name. The value and validation state of
* this group can be accessed separately from the overall form.
*
* @experimental
* @stable
*/
@Directive({selector: '[formGroupName]', providers: [formGroupNameProvider]})
export class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy {
@ -131,7 +131,7 @@ export const formArrayNameProvider: any = {
* }
* ```
*
* @experimental
* @stable
*/
@Directive({selector: '[formArrayName]', providers: [formArrayNameProvider]})
export class FormArrayName extends ControlContainer implements OnInit, OnDestroy {

View File

@ -37,7 +37,7 @@ function _extractId(valueString: string): string {
* https://bugzilla.mozilla.org/show_bug.cgi?id=1024350
* https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/4660045/
*
* @experimental
* @stable
*/
@Directive({
selector:
@ -100,7 +100,7 @@ export class SelectControlValueAccessor implements ControlValueAccessor {
* </select>
* ```
*
* @experimental
* @stable
*/
@Directive({selector: 'option'})
export class NgSelectOption implements OnDestroy {

View File

@ -45,7 +45,7 @@ abstract class HTMLCollection {
/**
* The accessor for writing a value and listening to changes on a select element.
*
* @experimental
* @stable
*/
@Directive({
selector:

View File

@ -31,7 +31,7 @@ import {NG_VALIDATORS, Validators} from '../validators';
* }
* ```
*
* @experimental
* @stable
*/
export interface Validator { validate(c: AbstractControl): {[key: string]: any}; }
@ -53,7 +53,7 @@ export const REQUIRED_VALIDATOR: any = {
* <input name="fullName" ngModel required>
* ```
*
* @experimental
* @stable
*/
@Directive({
selector: '[required][formControlName],[required][formControl],[required][ngModel]',
@ -63,12 +63,12 @@ export class RequiredValidator {
}
/**
* @experimental
* @stable
*/
export interface ValidatorFn { (c: AbstractControl): {[key: string]: any}; }
/**
* @experimental
* @stable
*/
export interface AsyncValidatorFn {
(c: AbstractControl): any /*Promise<{[key: string]: any}>|Observable<{[key: string]: any}>*/;
@ -91,7 +91,7 @@ export const MIN_LENGTH_VALIDATOR: any = {
* A directive which installs the {@link MinLengthValidator} for any `formControlName`,
* `formControl`, or control with `ngModel` that also has a `minlength` attribute.
*
* @experimental
* @stable
*/
@Directive({
selector: '[minlength][formControlName],[minlength][formControl],[minlength][ngModel]',
@ -125,7 +125,7 @@ export const MAX_LENGTH_VALIDATOR: any = {
* `formControl`,
* or control with `ngModel` that also has a `maxlength` attribute.
*
* @experimental
* @stable
*/
@Directive({
selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]',
@ -160,7 +160,7 @@ export const PATTERN_VALIDATOR: any = {
* ```
* <input [name]="fullName" pattern="[a-zA-Z ]*" ngModel>
* ```
* @experimental
* @stable
*/
@Directive({
selector: '[pattern][formControlName],[pattern][formControl],[pattern][ngModel]',

View File

@ -53,7 +53,7 @@ import {AbstractControl, FormArray, FormControl, FormGroup} from './model';
* }
* ```
*
* @experimental
* @stable
*/
@Injectable()
export class FormBuilder {

View File

@ -16,19 +16,19 @@ import {FormBuilder} from './form_builder';
/**
* Shorthand set of providers used for building Angular forms.
* @experimental
* @stable
*/
export const FORM_PROVIDERS: Type<any>[] = [RadioControlRegistry];
/**
* Shorthand set of providers used for building reactive Angular forms.
* @experimental
* @stable
*/
export const REACTIVE_FORM_PROVIDERS: Type<any>[] = [FormBuilder, RadioControlRegistry];
/**
* The ng module for forms.
* @experimental
* @stable
*/
@NgModule({
declarations: TEMPLATE_DRIVEN_DIRECTIVES,
@ -40,7 +40,7 @@ export class FormsModule {
/**
* The ng module for reactive forms.
* @experimental
* @stable
*/
@NgModule({
declarations: [REACTIVE_DRIVEN_DIRECTIVES],
@ -48,4 +48,4 @@ export class FormsModule {
exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES]
})
export class ReactiveFormsModule {
}
}

View File

@ -71,7 +71,7 @@ function coerceToAsyncValidator(asyncValidator: AsyncValidatorFn | AsyncValidato
}
/**
* @experimental
* @stable
*/
export abstract class AbstractControl {
/** @internal */
@ -368,7 +368,7 @@ export abstract class AbstractControl {
* can be bound to a DOM element instead. This `FormControl` can be configured with a custom
* validation function.
*
* @experimental
* @stable
*/
export class FormControl extends AbstractControl {
/** @internal */
@ -467,14 +467,15 @@ export class FormControl extends AbstractControl {
* controls, but is of variable length.
*
*
* @experimental
* @stable
*/
export class FormGroup extends AbstractControl {
private _optionals: {[key: string]: boolean};
constructor(
public controls: {[key: string]: AbstractControl}, optionals: {[key: string]: boolean} = null,
validator: ValidatorFn = null, asyncValidator: AsyncValidatorFn = null) {
public controls: {[key: string]: AbstractControl},
/* @deprecated */ optionals: {[key: string]: boolean} = null, validator: ValidatorFn = null,
asyncValidator: AsyncValidatorFn = null) {
super(validator, asyncValidator);
this._optionals = isPresent(optionals) ? optionals : {};
this._initObservables();
@ -510,6 +511,7 @@ export class FormGroup extends AbstractControl {
/**
* Mark the named control as non-optional.
* @deprecated
*/
include(controlName: string): void {
StringMapWrapper.set(this._optionals, controlName, true);
@ -518,6 +520,7 @@ export class FormGroup extends AbstractControl {
/**
* Mark the named control as optional.
* @deprecated
*/
exclude(controlName: string): void {
StringMapWrapper.set(this._optionals, controlName, false);
@ -651,7 +654,7 @@ export class FormGroup extends AbstractControl {
* as broken change detection.
*
*
* @experimental
* @stable
*/
export class FormArray extends AbstractControl {
constructor(

View File

@ -23,7 +23,7 @@ import {AbstractControl} from './model';
* ### Example
*
* {@example core/forms/ts/ng_validators/ng_validators.ts region='ng_validators'}
* @experimental
* @stable
*/
export const NG_VALIDATORS: OpaqueToken = new OpaqueToken('NgValidators');
@ -35,7 +35,7 @@ export const NG_VALIDATORS: OpaqueToken = new OpaqueToken('NgValidators');
*
* See {@link NG_VALIDATORS} for more details.
*
* @experimental
* @stable
*/
export const NG_ASYNC_VALIDATORS: OpaqueToken = new OpaqueToken('NgAsyncValidators');
@ -51,7 +51,7 @@ export const NG_ASYNC_VALIDATORS: OpaqueToken = new OpaqueToken('NgAsyncValidato
* var loginControl = new FormControl("", Validators.required)
* ```
*
* @experimental
* @stable
*/
export class Validators {
/**

View File

@ -1,4 +1,4 @@
/** @experimental */
/** @stable */
export declare abstract class AbstractControl {
asyncValidator: AsyncValidatorFn;
dirty: boolean;
@ -55,7 +55,7 @@ export declare abstract class AbstractControl {
}): void;
}
/** @experimental */
/** @stable */
export declare abstract class AbstractControlDirective {
control: AbstractControl;
dirty: boolean;
@ -75,7 +75,7 @@ export declare abstract class AbstractControlDirective {
reset(value?: any): void;
}
/** @experimental */
/** @stable */
export declare class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
asyncValidator: AsyncValidatorFn;
control: FormGroup;
@ -86,12 +86,12 @@ export declare class AbstractFormGroupDirective extends ControlContainer impleme
ngOnInit(): void;
}
/** @experimental */
/** @stable */
export interface AsyncValidatorFn {
(c: AbstractControl): any;
}
/** @experimental */
/** @stable */
export declare class CheckboxControlValueAccessor implements ControlValueAccessor {
onChange: (_: any) => void;
onTouched: () => void;
@ -101,21 +101,21 @@ export declare class CheckboxControlValueAccessor implements ControlValueAccesso
writeValue(value: any): void;
}
/** @experimental */
/** @stable */
export declare class ControlContainer extends AbstractControlDirective {
formDirective: Form;
name: string;
path: string[];
}
/** @experimental */
/** @stable */
export interface ControlValueAccessor {
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
writeValue(obj: any): void;
}
/** @experimental */
/** @stable */
export declare class DefaultValueAccessor implements ControlValueAccessor {
onChange: (_: any) => void;
onTouched: () => void;
@ -136,13 +136,13 @@ export interface Form {
updateModel(dir: NgControl, value: any): void;
}
/** @experimental */
/** @stable */
export declare const FORM_DIRECTIVES: Type<any>[][];
/** @experimental */
/** @stable */
export declare const FORM_PROVIDERS: Type<any>[];
/** @experimental */
/** @stable */
export declare class FormArray extends AbstractControl {
controls: AbstractControl[];
length: number;
@ -162,7 +162,7 @@ export declare class FormArray extends AbstractControl {
}): void;
}
/** @experimental */
/** @stable */
export declare class FormArrayName extends ControlContainer implements OnInit, OnDestroy {
asyncValidator: AsyncValidatorFn;
control: FormArray;
@ -175,7 +175,7 @@ export declare class FormArrayName extends ControlContainer implements OnInit, O
ngOnInit(): void;
}
/** @experimental */
/** @stable */
export declare class FormBuilder {
array(controlsConfig: any[], validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn): FormArray;
control(value: Object, validator?: ValidatorFn | ValidatorFn[], asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[]): FormControl;
@ -186,7 +186,7 @@ export declare class FormBuilder {
}): FormGroup;
}
/** @experimental */
/** @stable */
export declare class FormControl extends AbstractControl {
constructor(value?: any, validator?: ValidatorFn | ValidatorFn[], asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[]);
patchValue(value: any, options?: {
@ -207,7 +207,7 @@ export declare class FormControl extends AbstractControl {
}): void;
}
/** @experimental */
/** @stable */
export declare class FormControlDirective extends NgControl implements OnChanges {
asyncValidator: AsyncValidatorFn;
control: FormControl;
@ -222,7 +222,7 @@ export declare class FormControlDirective extends NgControl implements OnChanges
viewToModelUpdate(newValue: any): void;
}
/** @experimental */
/** @stable */
export declare class FormControlName extends NgControl implements OnChanges, OnDestroy {
asyncValidator: AsyncValidatorFn;
control: FormControl;
@ -238,7 +238,7 @@ export declare class FormControlName extends NgControl implements OnChanges, OnD
viewToModelUpdate(newValue: any): void;
}
/** @experimental */
/** @stable */
export declare class FormGroup extends AbstractControl {
controls: {
[key: string]: AbstractControl;
@ -250,8 +250,8 @@ export declare class FormGroup extends AbstractControl {
}, validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn);
addControl(name: string, control: AbstractControl): void;
contains(controlName: string): boolean;
exclude(controlName: string): void;
include(controlName: string): void;
/** @deprecated */ exclude(controlName: string): void;
/** @deprecated */ include(controlName: string): void;
patchValue(value: {
[key: string]: any;
}, {onlySelf}?: {
@ -269,7 +269,7 @@ export declare class FormGroup extends AbstractControl {
}): void;
}
/** @experimental */
/** @stable */
export declare class FormGroupDirective extends ControlContainer implements Form, OnChanges {
control: FormGroup;
directives: NgControl[];
@ -295,17 +295,17 @@ export declare class FormGroupDirective extends ControlContainer implements Form
updateModel(dir: NgControl, value: any): void;
}
/** @experimental */
/** @stable */
export declare class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy {
name: string;
constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]);
}
/** @experimental */
/** @stable */
export declare class FormsModule {
}
/** @experimental */
/** @stable */
export declare class MaxLengthValidator implements Validator {
constructor(maxLength: string);
validate(c: AbstractControl): {
@ -313,7 +313,7 @@ export declare class MaxLengthValidator implements Validator {
};
}
/** @experimental */
/** @stable */
export declare class MinLengthValidator implements Validator {
constructor(minLength: string);
validate(c: AbstractControl): {
@ -321,16 +321,16 @@ export declare class MinLengthValidator implements Validator {
};
}
/** @experimental */
/** @stable */
export declare const NG_ASYNC_VALIDATORS: OpaqueToken;
/** @experimental */
/** @stable */
export declare const NG_VALIDATORS: OpaqueToken;
/** @experimental */
/** @stable */
export declare const NG_VALUE_ACCESSOR: OpaqueToken;
/** @experimental */
/** @stable */
export declare abstract class NgControl extends AbstractControlDirective {
asyncValidator: AsyncValidatorFn;
name: string;
@ -339,17 +339,17 @@ export declare abstract class NgControl extends AbstractControlDirective {
abstract viewToModelUpdate(newValue: any): void;
}
/** @experimental */
/** @stable */
export declare class NgControlStatus extends AbstractControlStatus {
constructor(cd: NgControl);
}
/** @experimental */
/** @stable */
export declare class NgControlStatusGroup extends AbstractControlStatus {
constructor(cd: ControlContainer);
}
/** @experimental */
/** @stable */
export declare class NgForm extends ControlContainer implements Form {
control: FormGroup;
controls: {
@ -376,7 +376,7 @@ export declare class NgForm extends ControlContainer implements Form {
updateModel(dir: NgControl, value: any): void;
}
/** @experimental */
/** @stable */
export declare class NgModel extends NgControl implements OnChanges, OnDestroy {
asyncValidator: AsyncValidatorFn;
control: FormControl;
@ -397,13 +397,13 @@ export declare class NgModel extends NgControl implements OnChanges, OnDestroy {
viewToModelUpdate(newValue: any): void;
}
/** @experimental */
/** @stable */
export declare class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {
name: string;
constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]);
}
/** @experimental */
/** @stable */
export declare class NgSelectOption implements OnDestroy {
id: string;
ngValue: any;
@ -412,7 +412,7 @@ export declare class NgSelectOption implements OnDestroy {
ngOnDestroy(): void;
}
/** @experimental */
/** @stable */
export declare class PatternValidator implements Validator {
constructor(pattern: string);
validate(c: AbstractControl): {
@ -420,21 +420,21 @@ export declare class PatternValidator implements Validator {
};
}
/** @experimental */
/** @stable */
export declare const REACTIVE_FORM_DIRECTIVES: Type<any>[][];
/** @experimental */
/** @stable */
export declare const REACTIVE_FORM_PROVIDERS: Type<any>[];
/** @experimental */
/** @stable */
export declare class ReactiveFormsModule {
}
/** @experimental */
/** @stable */
export declare class RequiredValidator {
}
/** @experimental */
/** @stable */
export declare class SelectControlValueAccessor implements ControlValueAccessor {
onChange: (_: any) => void;
onTouched: () => void;
@ -445,7 +445,7 @@ export declare class SelectControlValueAccessor implements ControlValueAccessor
writeValue(value: any): void;
}
/** @experimental */
/** @stable */
export declare class SelectMultipleControlValueAccessor implements ControlValueAccessor {
onChange: (_: any) => void;
onTouched: () => void;
@ -456,21 +456,21 @@ export declare class SelectMultipleControlValueAccessor implements ControlValueA
writeValue(value: any): void;
}
/** @experimental */
/** @stable */
export interface Validator {
validate(c: AbstractControl): {
[key: string]: any;
};
}
/** @experimental */
/** @stable */
export interface ValidatorFn {
(c: AbstractControl): {
[key: string]: any;
};
}
/** @experimental */
/** @stable */
export declare class Validators {
static compose(validators: ValidatorFn[]): ValidatorFn;
static composeAsync(validators: AsyncValidatorFn[]): AsyncValidatorFn;