chore(forms): update forms labels (#10873)
This commit is contained in:
@ -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>[][] =
|
||||
|
@ -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'); }
|
||||
|
@ -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 */
|
||||
|
@ -24,7 +24,7 @@ export const CHECKBOX_VALUE_ACCESSOR: any = {
|
||||
* <input type="checkbox" name="rememberLogin" ngModel>
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
* @stable
|
||||
*/
|
||||
@Directive({
|
||||
selector:
|
||||
|
@ -15,7 +15,7 @@ import {Form} from './form_interface';
|
||||
*
|
||||
* Only used by the forms module.
|
||||
*
|
||||
* @experimental
|
||||
* @stable
|
||||
*/
|
||||
export class ControlContainer extends AbstractControlDirective {
|
||||
name: string;
|
||||
|
@ -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');
|
||||
|
@ -27,7 +27,7 @@ export const DEFAULT_VALUE_ACCESSOR: any = {
|
||||
* <input type="text" name="searchQuery" ngModel>
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
* @stable
|
||||
*/
|
||||
@Directive({
|
||||
selector:
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -85,7 +85,7 @@ const resolvedPromise = Promise.resolve(null);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
* @stable
|
||||
*/
|
||||
@Directive({
|
||||
selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]',
|
||||
|
@ -49,7 +49,7 @@ const resolvedPromise = Promise.resolve(null);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
* @stable
|
||||
*/
|
||||
@Directive({
|
||||
selector: '[ngModel]:not([formControlName]):not([formControl])',
|
||||
|
@ -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 {
|
||||
|
@ -70,7 +70,7 @@ export const formControlBinding: any = {
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
* @stable
|
||||
*/
|
||||
@Directive({selector: '[formControl]', providers: [formControlBinding], exportAs: 'ngForm'})
|
||||
|
||||
|
@ -92,7 +92,7 @@ export const controlNameBinding: any = {
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
* @stable
|
||||
*/
|
||||
@Directive({selector: '[formControlName]', providers: [controlNameBinding]})
|
||||
export class FormControlName extends NgControl implements OnChanges, OnDestroy {
|
||||
|
@ -94,7 +94,7 @@ export const formDirectiveProvider: any = {
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
* @stable
|
||||
*/
|
||||
@Directive({
|
||||
selector: '[formGroup]',
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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:
|
||||
|
@ -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]',
|
||||
|
@ -53,7 +53,7 @@ import {AbstractControl, FormArray, FormControl, FormGroup} from './model';
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @experimental
|
||||
* @stable
|
||||
*/
|
||||
@Injectable()
|
||||
export class FormBuilder {
|
||||
|
@ -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 {
|
||||
}
|
||||
}
|
||||
|
@ -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(
|
||||
|
@ -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 {
|
||||
/**
|
||||
|
Reference in New Issue
Block a user