@angular/forms
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -19,10 +19,12 @@ /** | ||
export { RadioControlValueAccessor } from './directives/radio_control_value_accessor'; | ||
export { FormArrayName } from './directives/reactive_directives/form_array_name'; | ||
export { FormControlDirective } from './directives/reactive_directives/form_control_directive'; | ||
export { FormControlName } from './directives/reactive_directives/form_control_name'; | ||
export { FormGroupDirective } from './directives/reactive_directives/form_group_directive'; | ||
export { FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
export { FormArrayName, FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
export { NgSelectOption, SelectControlValueAccessor } from './directives/select_control_value_accessor'; | ||
export { NgSelectMultipleOption, SelectMultipleControlValueAccessor } from './directives/select_multiple_control_value_accessor'; | ||
export { MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator } from './directives/validators'; | ||
export declare const SHARED_FORM_DIRECTIVES: Type[]; | ||
export declare const TEMPLATE_DRIVEN_DIRECTIVES: Type[]; | ||
export declare const REACTIVE_DRIVEN_DIRECTIVES: Type[]; | ||
/** | ||
@@ -45,6 +47,11 @@ * | ||
*/ | ||
export declare const FORM_DIRECTIVES: Type[]; | ||
export declare const FORM_DIRECTIVES: Type[][]; | ||
/** | ||
* @experimental | ||
*/ | ||
export declare const REACTIVE_FORM_DIRECTIVES: Type[]; | ||
export declare const REACTIVE_FORM_DIRECTIVES: Type[][]; | ||
/** | ||
* Internal module used for sharing directives between FormsModule and ReactiveFormsModule | ||
*/ | ||
export declare class InternalFormsSharedModule { | ||
} |
@@ -8,2 +8,3 @@ /** | ||
*/ | ||
import { NgModule } from '@angular/core'; | ||
import { CheckboxControlValueAccessor } from './directives/checkbox_value_accessor'; | ||
@@ -17,7 +18,6 @@ import { DefaultValueAccessor } from './directives/default_value_accessor'; | ||
import { RadioControlValueAccessor } from './directives/radio_control_value_accessor'; | ||
import { FormArrayName } from './directives/reactive_directives/form_array_name'; | ||
import { FormControlDirective } from './directives/reactive_directives/form_control_directive'; | ||
import { FormControlName } from './directives/reactive_directives/form_control_name'; | ||
import { FormGroupDirective } from './directives/reactive_directives/form_group_directive'; | ||
import { FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
import { FormArrayName, FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
import { NgSelectOption, SelectControlValueAccessor } from './directives/select_control_value_accessor'; | ||
@@ -35,10 +35,17 @@ import { NgSelectMultipleOption, SelectMultipleControlValueAccessor } from './directives/select_multiple_control_value_accessor'; | ||
export { RadioControlValueAccessor } from './directives/radio_control_value_accessor'; | ||
export { FormArrayName } from './directives/reactive_directives/form_array_name'; | ||
export { FormControlDirective } from './directives/reactive_directives/form_control_directive'; | ||
export { FormControlName } from './directives/reactive_directives/form_control_name'; | ||
export { FormGroupDirective } from './directives/reactive_directives/form_group_directive'; | ||
export { FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
export { FormArrayName, FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
export { NgSelectOption, SelectControlValueAccessor } from './directives/select_control_value_accessor'; | ||
export { NgSelectMultipleOption, SelectMultipleControlValueAccessor } from './directives/select_multiple_control_value_accessor'; | ||
export { MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator } from './directives/validators'; | ||
export const SHARED_FORM_DIRECTIVES = [ | ||
NgSelectOption, NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor, | ||
CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor, | ||
RadioControlValueAccessor, NgControlStatus, RequiredValidator, MinLengthValidator, | ||
MaxLengthValidator, PatternValidator | ||
]; | ||
export const TEMPLATE_DRIVEN_DIRECTIVES = [NgModel, NgModelGroup, NgForm]; | ||
export const REACTIVE_DRIVEN_DIRECTIVES = [FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName]; | ||
/** | ||
@@ -61,16 +68,13 @@ * | ||
*/ | ||
export const FORM_DIRECTIVES = [ | ||
NgModel, NgModelGroup, NgForm, | ||
NgSelectOption, NgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor, | ||
CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor, | ||
RadioControlValueAccessor, NgControlStatus, | ||
RequiredValidator, MinLengthValidator, MaxLengthValidator, PatternValidator | ||
]; | ||
export const FORM_DIRECTIVES = [TEMPLATE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES]; | ||
/** | ||
* @experimental | ||
*/ | ||
export const REACTIVE_FORM_DIRECTIVES = | ||
/*@ts2dart_const*/ [ | ||
FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName | ||
export const REACTIVE_FORM_DIRECTIVES = [REACTIVE_DRIVEN_DIRECTIVES, SHARED_FORM_DIRECTIVES]; | ||
export class InternalFormsSharedModule { | ||
} | ||
/** @nocollapse */ | ||
InternalFormsSharedModule.decorators = [ | ||
{ type: NgModule, args: [{ declarations: SHARED_FORM_DIRECTIVES, exports: SHARED_FORM_DIRECTIVES },] }, | ||
]; | ||
//# sourceMappingURL=directives.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"FORM_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/ng_model","name":"NgModel"},{"__symbolic":"reference","module":"./directives/ng_model_group","name":"NgModelGroup"},{"__symbolic":"reference","module":"./directives/ng_form","name":"NgForm"},{"__symbolic":"reference","module":"./directives/select_control_value_accessor","name":"NgSelectOption"},{"__symbolic":"reference","module":"./directives/select_multiple_control_value_accessor","name":"NgSelectMultipleOption"},{"__symbolic":"reference","module":"./directives/default_value_accessor","name":"DefaultValueAccessor"},{"__symbolic":"reference","module":"./directives/number_value_accessor","name":"NumberValueAccessor"},{"__symbolic":"reference","module":"./directives/checkbox_value_accessor","name":"CheckboxControlValueAccessor"},{"__symbolic":"reference","module":"./directives/select_control_value_accessor","name":"SelectControlValueAccessor"},{"__symbolic":"reference","module":"./directives/select_multiple_control_value_accessor","name":"SelectMultipleControlValueAccessor"},{"__symbolic":"reference","module":"./directives/radio_control_value_accessor","name":"RadioControlValueAccessor"},{"__symbolic":"reference","module":"./directives/ng_control_status","name":"NgControlStatus"},{"__symbolic":"reference","module":"./directives/validators","name":"RequiredValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"MinLengthValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"MaxLengthValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"PatternValidator"}],"REACTIVE_FORM_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/reactive_directives/form_control_directive","name":"FormControlDirective"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_group_directive","name":"FormGroupDirective"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_control_name","name":"FormControlName"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_group_name","name":"FormGroupName"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_array_name","name":"FormArrayName"}]}} | ||
{"__symbolic":"module","version":1,"metadata":{"SHARED_FORM_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/select_control_value_accessor","name":"NgSelectOption"},{"__symbolic":"reference","module":"./directives/select_multiple_control_value_accessor","name":"NgSelectMultipleOption"},{"__symbolic":"reference","module":"./directives/default_value_accessor","name":"DefaultValueAccessor"},{"__symbolic":"reference","module":"./directives/number_value_accessor","name":"NumberValueAccessor"},{"__symbolic":"reference","module":"./directives/checkbox_value_accessor","name":"CheckboxControlValueAccessor"},{"__symbolic":"reference","module":"./directives/select_control_value_accessor","name":"SelectControlValueAccessor"},{"__symbolic":"reference","module":"./directives/select_multiple_control_value_accessor","name":"SelectMultipleControlValueAccessor"},{"__symbolic":"reference","module":"./directives/radio_control_value_accessor","name":"RadioControlValueAccessor"},{"__symbolic":"reference","module":"./directives/ng_control_status","name":"NgControlStatus"},{"__symbolic":"reference","module":"./directives/validators","name":"RequiredValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"MinLengthValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"MaxLengthValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"PatternValidator"}],"TEMPLATE_DRIVEN_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/ng_model","name":"NgModel"},{"__symbolic":"reference","module":"./directives/ng_model_group","name":"NgModelGroup"},{"__symbolic":"reference","module":"./directives/ng_form","name":"NgForm"}],"REACTIVE_DRIVEN_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/reactive_directives/form_control_directive","name":"FormControlDirective"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_group_directive","name":"FormGroupDirective"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_control_name","name":"FormControlName"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_group_name","name":"FormGroupName"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_group_name","name":"FormArrayName"}],"FORM_DIRECTIVES":[{"__symbolic":"reference","name":"TEMPLATE_DRIVEN_DIRECTIVES"},{"__symbolic":"reference","name":"SHARED_FORM_DIRECTIVES"}],"REACTIVE_FORM_DIRECTIVES":[{"__symbolic":"reference","name":"REACTIVE_DRIVEN_DIRECTIVES"},{"__symbolic":"reference","name":"SHARED_FORM_DIRECTIVES"}],"InternalFormsSharedModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":{"__symbolic":"reference","name":"SHARED_FORM_DIRECTIVES"},"exports":{"__symbolic":"reference","name":"SHARED_FORM_DIRECTIVES"}}]}]}},"exports":[{"from":"./directives/checkbox_value_accessor","export":["CheckboxControlValueAccessor"]},{"from":"./directives/control_value_accessor","export":["ControlValueAccessor"]},{"from":"./directives/default_value_accessor","export":["DefaultValueAccessor"]},{"from":"./directives/ng_control","export":["NgControl"]},{"from":"./directives/ng_control_status","export":["NgControlStatus"]},{"from":"./directives/ng_form","export":["NgForm"]},{"from":"./directives/ng_model","export":["NgModel"]},{"from":"./directives/ng_model_group","export":["NgModelGroup"]},{"from":"./directives/number_value_accessor","export":["NumberValueAccessor"]},{"from":"./directives/radio_control_value_accessor","export":["RadioControlValueAccessor"]},{"from":"./directives/reactive_directives/form_control_directive","export":["FormControlDirective"]},{"from":"./directives/reactive_directives/form_control_name","export":["FormControlName"]},{"from":"./directives/reactive_directives/form_group_directive","export":["FormGroupDirective"]},{"from":"./directives/reactive_directives/form_group_name","export":["FormArrayName","FormGroupName"]},{"from":"./directives/select_control_value_accessor","export":["NgSelectOption","SelectControlValueAccessor"]},{"from":"./directives/select_multiple_control_value_accessor","export":["NgSelectMultipleOption","SelectMultipleControlValueAccessor"]},{"from":"./directives/validators","export":["MaxLengthValidator","MinLengthValidator","PatternValidator","RequiredValidator"]}]} |
@@ -21,2 +21,4 @@ /** | ||
readonly valid: boolean; | ||
readonly invalid: boolean; | ||
readonly pending: boolean; | ||
readonly errors: { | ||
@@ -32,2 +34,3 @@ [key: string]: any; | ||
readonly path: string[]; | ||
reset(value?: any): void; | ||
} |
@@ -21,2 +21,4 @@ /** | ||
get valid() { return isPresent(this.control) ? this.control.valid : null; } | ||
get invalid() { return isPresent(this.control) ? this.control.invalid : null; } | ||
get pending() { return isPresent(this.control) ? this.control.pending : null; } | ||
get errors() { | ||
@@ -36,3 +38,7 @@ return isPresent(this.control) ? this.control.errors : null; | ||
get path() { return null; } | ||
reset(value = undefined) { | ||
if (isPresent(this.control)) | ||
this.control.reset(value); | ||
} | ||
} | ||
//# sourceMappingURL=abstract_control_directive.js.map |
@@ -14,3 +14,5 @@ /** | ||
/** | ||
This is a base class for code shared between {@link NgModelGroup} and {@link FormGroupName}. | ||
* This is a base class for code shared between {@link NgModelGroup} and {@link FormGroupName}. | ||
* | ||
* @experimental | ||
*/ | ||
@@ -17,0 +19,0 @@ export declare class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy { |
@@ -11,6 +11,11 @@ /** | ||
/** | ||
This is a base class for code shared between {@link NgModelGroup} and {@link FormGroupName}. | ||
* This is a base class for code shared between {@link NgModelGroup} and {@link FormGroupName}. | ||
* | ||
* @experimental | ||
*/ | ||
export class AbstractFormGroupDirective extends ControlContainer { | ||
ngOnInit() { this.formDirective.addFormGroup(this); } | ||
ngOnInit() { | ||
this._checkParentType(); | ||
this.formDirective.addFormGroup(this); | ||
} | ||
ngOnDestroy() { this.formDirective.removeFormGroup(this); } | ||
@@ -31,3 +36,5 @@ /** | ||
get asyncValidator() { return composeAsyncValidators(this._asyncValidators); } | ||
/** @internal */ | ||
_checkParentType() { } | ||
} | ||
//# sourceMappingURL=abstract_form_group_directive.js.map |
@@ -15,4 +15,3 @@ /** | ||
*/ | ||
export const NG_VALUE_ACCESSOR = | ||
/*@ts2dart_const*/ new OpaqueToken('NgValueAccessor'); | ||
export const NG_VALUE_ACCESSOR = new OpaqueToken('NgValueAccessor'); | ||
//# sourceMappingURL=control_value_accessor.js.map |
@@ -11,4 +11,3 @@ /** | ||
import { NG_VALUE_ACCESSOR } from './control_value_accessor'; | ||
export const DEFAULT_VALUE_ACCESSOR = | ||
/* @ts2dart_Provider */ { | ||
export const DEFAULT_VALUE_ACCESSOR = { | ||
provide: NG_VALUE_ACCESSOR, | ||
@@ -15,0 +14,0 @@ useExisting: forwardRef(() => DefaultValueAccessor), |
@@ -15,3 +15,3 @@ import { EventEmitter } from '../facade/async'; | ||
* | ||
* Include `FORM_DIRECTIVES` in the `directives` section of a {@link View} annotation | ||
* Include `FORM_DIRECTIVES` in the `directives` section of a {@link Component} annotation | ||
* to use `NgForm` and its associated controls. | ||
@@ -88,3 +88,7 @@ * | ||
updateModel(dir: NgControl, value: any): void; | ||
setValue(value: { | ||
[key: string]: any; | ||
}): void; | ||
onSubmit(): boolean; | ||
onReset(): void; | ||
} |
@@ -9,3 +9,3 @@ /** | ||
import { Directive, Inject, Optional, Self, forwardRef } from '@angular/core'; | ||
import { EventEmitter, ObservableWrapper, PromiseWrapper } from '../facade/async'; | ||
import { EventEmitter } from '../facade/async'; | ||
import { ListWrapper } from '../facade/collection'; | ||
@@ -17,4 +17,7 @@ import { isPresent } from '../facade/lang'; | ||
import { composeAsyncValidators, composeValidators, setUpControl, setUpFormContainer } from './shared'; | ||
export const formDirectiveProvider = | ||
/*@ts2dart_const*/ { provide: ControlContainer, useExisting: forwardRef(() => NgForm) }; | ||
export const formDirectiveProvider = { | ||
provide: ControlContainer, | ||
useExisting: forwardRef(() => NgForm) | ||
}; | ||
const resolvedPromise = Promise.resolve(null); | ||
export class NgForm extends ControlContainer { | ||
@@ -33,3 +36,3 @@ constructor(validators, asyncValidators) { | ||
addControl(dir) { | ||
PromiseWrapper.scheduleMicrotask(() => { | ||
resolvedPromise.then(() => { | ||
const container = this._findContainer(dir.path); | ||
@@ -41,5 +44,5 @@ dir._control = container.registerControl(dir.name, dir.control); | ||
} | ||
getControl(dir) { return this.form.find(dir.path); } | ||
getControl(dir) { return this.form.get(dir.path); } | ||
removeControl(dir) { | ||
PromiseWrapper.scheduleMicrotask(() => { | ||
resolvedPromise.then(() => { | ||
var container = this._findContainer(dir.path); | ||
@@ -52,3 +55,3 @@ if (isPresent(container)) { | ||
addFormGroup(dir) { | ||
PromiseWrapper.scheduleMicrotask(() => { | ||
resolvedPromise.then(() => { | ||
var container = this._findContainer(dir.path); | ||
@@ -62,3 +65,3 @@ var group = new FormGroup({}); | ||
removeFormGroup(dir) { | ||
PromiseWrapper.scheduleMicrotask(() => { | ||
resolvedPromise.then(() => { | ||
var container = this._findContainer(dir.path); | ||
@@ -70,18 +73,20 @@ if (isPresent(container)) { | ||
} | ||
getFormGroup(dir) { return this.form.find(dir.path); } | ||
getFormGroup(dir) { return this.form.get(dir.path); } | ||
updateModel(dir, value) { | ||
PromiseWrapper.scheduleMicrotask(() => { | ||
var ctrl = this.form.find(dir.path); | ||
ctrl.updateValue(value); | ||
resolvedPromise.then(() => { | ||
var ctrl = this.form.get(dir.path); | ||
ctrl.setValue(value); | ||
}); | ||
} | ||
setValue(value) { this.control.setValue(value); } | ||
onSubmit() { | ||
this._submitted = true; | ||
ObservableWrapper.callEmit(this.ngSubmit, null); | ||
this.ngSubmit.emit(null); | ||
return false; | ||
} | ||
onReset() { this.form.reset(); } | ||
/** @internal */ | ||
_findContainer(path) { | ||
path.pop(); | ||
return ListWrapper.isEmpty(path) ? this.form : this.form.find(path); | ||
return ListWrapper.isEmpty(path) ? this.form : this.form.get(path); | ||
} | ||
@@ -94,5 +99,3 @@ } | ||
providers: [formDirectiveProvider], | ||
host: { | ||
'(submit)': 'onSubmit()', | ||
}, | ||
host: { '(submit)': 'onSubmit()', '(reset)': 'onReset()' }, | ||
outputs: ['ngSubmit'], | ||
@@ -99,0 +102,0 @@ exportAs: 'ngForm' |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"formDirectiveProvider":{"provide":{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"NgForm"}},"NgForm":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]","providers":[{"__symbolic":"reference","name":"formDirectiveProvider"}],"host":{"(submit)":"onSubmit()"},"outputs":["ngSubmit"],"exportAs":"ngForm"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"addControl":[{"__symbolic":"method"}],"getControl":[{"__symbolic":"method"}],"removeControl":[{"__symbolic":"method"}],"addFormGroup":[{"__symbolic":"method"}],"removeFormGroup":[{"__symbolic":"method"}],"getFormGroup":[{"__symbolic":"method"}],"updateModel":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"_findContainer":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"formDirectiveProvider":{"provide":{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"NgForm"}},"NgForm":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]","providers":[{"__symbolic":"reference","name":"formDirectiveProvider"}],"host":{"(submit)":"onSubmit()","(reset)":"onReset()"},"outputs":["ngSubmit"],"exportAs":"ngForm"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"addControl":[{"__symbolic":"method"}],"getControl":[{"__symbolic":"method"}],"removeControl":[{"__symbolic":"method"}],"addFormGroup":[{"__symbolic":"method"}],"removeFormGroup":[{"__symbolic":"method"}],"getFormGroup":[{"__symbolic":"method"}],"updateModel":[{"__symbolic":"method"}],"setValue":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"onReset":[{"__symbolic":"method"}],"_findContainer":[{"__symbolic":"method"}]}}}} |
@@ -12,4 +12,5 @@ /** | ||
import { ControlContainer } from './control_container'; | ||
export const modelGroupProvider = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
import { NgForm } from './ng_form'; | ||
import { TemplateDrivenErrors } from './template_driven_errors'; | ||
export const modelGroupProvider = { | ||
provide: ControlContainer, | ||
@@ -25,2 +26,8 @@ useExisting: forwardRef(() => NgModelGroup) | ||
} | ||
/** @internal */ | ||
_checkParentType() { | ||
if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) { | ||
TemplateDrivenErrors.modelGroupParentException(); | ||
} | ||
} | ||
} | ||
@@ -27,0 +34,0 @@ /** @nocollapse */ |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"modelGroupProvider":{"provide":{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"NgModelGroup"}},"NgModelGroup":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ngModelGroup]","providers":[{"__symbolic":"reference","name":"modelGroupProvider"}],"exportAs":"ngModelGroup"}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModelGroup"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"modelGroupProvider":{"provide":{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"NgModelGroup"}},"NgModelGroup":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ngModelGroup]","providers":[{"__symbolic":"reference","name":"modelGroupProvider"}],"exportAs":"ngModelGroup"}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModelGroup"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"_checkParentType":[{"__symbolic":"method"}]}}}} |
@@ -62,4 +62,6 @@ /** | ||
private _setUpStandalone(); | ||
private _checkForErrors(); | ||
private _checkParentType(); | ||
private _checkName(); | ||
private _updateValue(value); | ||
} |
@@ -9,15 +9,18 @@ /** | ||
import { Directive, Host, Inject, Input, Optional, Output, Self, forwardRef } from '@angular/core'; | ||
import { EventEmitter, ObservableWrapper, PromiseWrapper } from '../facade/async'; | ||
import { BaseException } from '../facade/exceptions'; | ||
import { EventEmitter } from '../facade/async'; | ||
import { FormControl } from '../model'; | ||
import { NG_ASYNC_VALIDATORS, NG_VALIDATORS } from '../validators'; | ||
import { AbstractFormGroupDirective } from './abstract_form_group_directive'; | ||
import { ControlContainer } from './control_container'; | ||
import { NG_VALUE_ACCESSOR } from './control_value_accessor'; | ||
import { NgControl } from './ng_control'; | ||
import { NgForm } from './ng_form'; | ||
import { NgModelGroup } from './ng_model_group'; | ||
import { composeAsyncValidators, composeValidators, controlPath, isPropertyUpdated, selectValueAccessor, setUpControl } from './shared'; | ||
export const formControlBinding = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
import { TemplateDrivenErrors } from './template_driven_errors'; | ||
export const formControlBinding = { | ||
provide: NgControl, | ||
useExisting: forwardRef(() => NgModel) | ||
}; | ||
const resolvedPromise = Promise.resolve(null); | ||
export class NgModel extends NgControl { | ||
@@ -37,3 +40,3 @@ constructor(_parent, _validators, _asyncValidators, valueAccessors) { | ||
ngOnChanges(changes) { | ||
this._checkName(); | ||
this._checkForErrors(); | ||
if (!this._registered) | ||
@@ -49,3 +52,3 @@ this._setUpControl(); | ||
get path() { | ||
return this._parent ? controlPath(this.name, this._parent) : []; | ||
return this._parent ? controlPath(this.name, this._parent) : [this.name]; | ||
} | ||
@@ -59,3 +62,3 @@ get formDirective() { return this._parent ? this._parent.formDirective : null; } | ||
this.viewModel = newValue; | ||
ObservableWrapper.callEmit(this.update, newValue); | ||
this.update.emit(newValue); | ||
} | ||
@@ -74,2 +77,17 @@ _setUpControl() { | ||
} | ||
_checkForErrors() { | ||
if (!this._isStandalone()) { | ||
this._checkParentType(); | ||
} | ||
this._checkName(); | ||
} | ||
_checkParentType() { | ||
if (!(this._parent instanceof NgModelGroup) && | ||
this._parent instanceof AbstractFormGroupDirective) { | ||
TemplateDrivenErrors.formGroupNameException(); | ||
} | ||
else if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) { | ||
TemplateDrivenErrors.modelParentException(); | ||
} | ||
} | ||
_checkName() { | ||
@@ -79,12 +97,7 @@ if (this.options && this.options.name) | ||
if (!this._isStandalone() && !this.name) { | ||
throw new BaseException(`If ngModel is used within a form tag, either the name attribute must be set | ||
or the form control must be defined as 'standalone' in ngModelOptions. | ||
Example 1: <input [(ngModel)]="person.firstName" name="first"> | ||
Example 2: <input [(ngModel)]="person.firstName" [ngModelOptions]="{standalone: true}"> | ||
`); | ||
TemplateDrivenErrors.missingNameException(); | ||
} | ||
} | ||
_updateValue(value) { | ||
PromiseWrapper.scheduleMicrotask(() => { this.control.updateValue(value); }); | ||
resolvedPromise.then(() => { this.control.setValue(value, { emitViewToModelChange: false }); }); | ||
} | ||
@@ -91,0 +104,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"formControlBinding":{"provide":{"__symbolic":"reference","module":"./ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"NgModel"}},"NgModel":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ngModel]:not([formControlName]):not([formControl])","providers":[{"__symbolic":"reference","name":"formControlBinding"}],"exportAs":"ngModel"}]}],"members":{"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModelOptions"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_setUpControl":[{"__symbolic":"method"}],"_isStandalone":[{"__symbolic":"method"}],"_setUpStandalone":[{"__symbolic":"method"}],"_checkName":[{"__symbolic":"method"}],"_updateValue":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"formControlBinding":{"provide":{"__symbolic":"reference","module":"./ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"NgModel"}},"NgModel":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ngModel]:not([formControlName]):not([formControl])","providers":[{"__symbolic":"reference","name":"formControlBinding"}],"exportAs":"ngModel"}]}],"members":{"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModelOptions"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_setUpControl":[{"__symbolic":"method"}],"_isStandalone":[{"__symbolic":"method"}],"_setUpStandalone":[{"__symbolic":"method"}],"_checkForErrors":[{"__symbolic":"method"}],"_checkParentType":[{"__symbolic":"method"}],"_checkName":[{"__symbolic":"method"}],"_updateValue":[{"__symbolic":"method"}]}}}} |
@@ -9,3 +9,3 @@ /** | ||
import { Directive, ElementRef, Renderer, forwardRef } from '@angular/core'; | ||
import { NumberWrapper } from '../facade/lang'; | ||
import { NumberWrapper, isBlank } from '../facade/lang'; | ||
import { NG_VALUE_ACCESSOR } from './control_value_accessor'; | ||
@@ -25,3 +25,5 @@ export const NUMBER_VALUE_ACCESSOR = { | ||
writeValue(value) { | ||
this._renderer.setElementProperty(this._elementRef.nativeElement, 'value', value); | ||
// The value needs to be normalized for IE9, otherwise it is set to 'null' when null | ||
const normalizedValue = isBlank(value) ? '' : value; | ||
this._renderer.setElementProperty(this._elementRef.nativeElement, 'value', normalizedValue); | ||
} | ||
@@ -28,0 +30,0 @@ registerOnChange(fn) { |
@@ -9,3 +9,3 @@ /** | ||
import { Directive, Inject, Input, Optional, Output, Self, forwardRef } from '@angular/core'; | ||
import { EventEmitter, ObservableWrapper } from '../../facade/async'; | ||
import { EventEmitter } from '../../facade/async'; | ||
import { StringMapWrapper } from '../../facade/collection'; | ||
@@ -16,4 +16,3 @@ import { NG_ASYNC_VALIDATORS, NG_VALIDATORS } from '../../validators'; | ||
import { composeAsyncValidators, composeValidators, isPropertyUpdated, selectValueAccessor, setUpControl } from '../shared'; | ||
export const formControlBinding = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
export const formControlBinding = { | ||
provide: NgControl, | ||
@@ -36,3 +35,3 @@ useExisting: forwardRef(() => FormControlDirective) | ||
if (isPropertyUpdated(changes, this.viewModel)) { | ||
this.form.updateValue(this.model); | ||
this.form.setValue(this.model); | ||
this.viewModel = this.model; | ||
@@ -49,3 +48,3 @@ } | ||
this.viewModel = newValue; | ||
ObservableWrapper.callEmit(this.update, newValue); | ||
this.update.emit(newValue); | ||
} | ||
@@ -52,0 +51,0 @@ _isControlChanged(changes) { |
@@ -101,2 +101,3 @@ /** | ||
readonly control: FormControl; | ||
private _checkParentType(); | ||
} |
@@ -9,10 +9,13 @@ /** | ||
import { Directive, Host, Inject, Input, Optional, Output, Self, SkipSelf, forwardRef } from '@angular/core'; | ||
import { EventEmitter, ObservableWrapper } from '../../facade/async'; | ||
import { EventEmitter } from '../../facade/async'; | ||
import { NG_ASYNC_VALIDATORS, NG_VALIDATORS } from '../../validators'; | ||
import { AbstractFormGroupDirective } from '../abstract_form_group_directive'; | ||
import { ControlContainer } from '../control_container'; | ||
import { NG_VALUE_ACCESSOR } from '../control_value_accessor'; | ||
import { NgControl } from '../ng_control'; | ||
import { ReactiveErrors } from '../reactive_errors'; | ||
import { composeAsyncValidators, composeValidators, controlPath, isPropertyUpdated, selectValueAccessor } from '../shared'; | ||
export const controlNameBinding = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
import { FormGroupDirective } from './form_group_directive'; | ||
import { FormArrayName, FormGroupName } from './form_group_name'; | ||
export const controlNameBinding = { | ||
provide: NgControl, | ||
@@ -33,2 +36,3 @@ useExisting: forwardRef(() => FormControlName) | ||
if (!this._added) { | ||
this._checkParentType(); | ||
this.formDirective.addControl(this); | ||
@@ -45,3 +49,3 @@ this._added = true; | ||
this.viewModel = newValue; | ||
ObservableWrapper.callEmit(this.update, newValue); | ||
this.update.emit(newValue); | ||
} | ||
@@ -55,2 +59,13 @@ get path() { return controlPath(this.name, this._parent); } | ||
get control() { return this.formDirective.getControl(this); } | ||
_checkParentType() { | ||
if (!(this._parent instanceof FormGroupName) && | ||
this._parent instanceof AbstractFormGroupDirective) { | ||
ReactiveErrors.ngModelGroupException(); | ||
} | ||
else if (!(this._parent instanceof FormGroupName) && | ||
!(this._parent instanceof FormGroupDirective) && | ||
!(this._parent instanceof FormArrayName)) { | ||
ReactiveErrors.controlParentException(); | ||
} | ||
} | ||
} | ||
@@ -63,3 +78,3 @@ /** @nocollapse */ | ||
FormControlName.ctorParameters = [ | ||
{ type: ControlContainer, decorators: [{ type: Host }, { type: SkipSelf },] }, | ||
{ type: ControlContainer, decorators: [{ type: Optional }, { type: Host }, { type: SkipSelf },] }, | ||
{ type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] }, | ||
@@ -66,0 +81,0 @@ { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] }, |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"controlNameBinding":{"provide":{"__symbolic":"reference","module":"../ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"FormControlName"}},"FormControlName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formControlName]","providers":[{"__symbolic":"reference","name":"controlNameBinding"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formControlName"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"controlNameBinding":{"provide":{"__symbolic":"reference","module":"../ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"FormControlName"}},"FormControlName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formControlName]","providers":[{"__symbolic":"reference","name":"controlNameBinding"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formControlName"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_checkParentType":[{"__symbolic":"method"}]}}}} |
@@ -14,4 +14,3 @@ /** | ||
import { NgControl } from '../ng_control'; | ||
import { FormArrayName } from './form_array_name'; | ||
import { FormGroupName } from './form_group_name'; | ||
import { FormArrayName, FormGroupName } from './form_group_name'; | ||
export declare const formDirectiveProvider: any; | ||
@@ -116,3 +115,4 @@ /** | ||
onSubmit(): boolean; | ||
onReset(): void; | ||
private _checkFormPresent(); | ||
} |
@@ -9,11 +9,10 @@ /** | ||
import { Directive, Inject, Input, Optional, Output, Self, forwardRef } from '@angular/core'; | ||
import { EventEmitter, ObservableWrapper } from '../../facade/async'; | ||
import { EventEmitter } from '../../facade/async'; | ||
import { ListWrapper, StringMapWrapper } from '../../facade/collection'; | ||
import { BaseException } from '../../facade/exceptions'; | ||
import { isBlank } from '../../facade/lang'; | ||
import { NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators } from '../../validators'; | ||
import { ControlContainer } from '../control_container'; | ||
import { ReactiveErrors } from '../reactive_errors'; | ||
import { composeAsyncValidators, composeValidators, setUpControl, setUpFormContainer } from '../shared'; | ||
export const formDirectiveProvider = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
export const formDirectiveProvider = { | ||
provide: ControlContainer, | ||
@@ -48,3 +47,3 @@ useExisting: forwardRef(() => FormGroupDirective) | ||
addControl(dir) { | ||
const ctrl = this.form.find(dir.path); | ||
const ctrl = this.form.get(dir.path); | ||
setUpControl(ctrl, dir); | ||
@@ -54,6 +53,6 @@ ctrl.updateValueAndValidity({ emitEvent: false }); | ||
} | ||
getControl(dir) { return this.form.find(dir.path); } | ||
getControl(dir) { return this.form.get(dir.path); } | ||
removeControl(dir) { ListWrapper.remove(this.directives, dir); } | ||
addFormGroup(dir) { | ||
var ctrl = this.form.find(dir.path); | ||
var ctrl = this.form.get(dir.path); | ||
setUpFormContainer(ctrl, dir); | ||
@@ -63,5 +62,5 @@ ctrl.updateValueAndValidity({ emitEvent: false }); | ||
removeFormGroup(dir) { } | ||
getFormGroup(dir) { return this.form.find(dir.path); } | ||
getFormGroup(dir) { return this.form.get(dir.path); } | ||
addFormArray(dir) { | ||
var ctrl = this.form.find(dir.path); | ||
var ctrl = this.form.get(dir.path); | ||
setUpFormContainer(ctrl, dir); | ||
@@ -71,16 +70,17 @@ ctrl.updateValueAndValidity({ emitEvent: false }); | ||
removeFormArray(dir) { } | ||
getFormArray(dir) { return this.form.find(dir.path); } | ||
getFormArray(dir) { return this.form.get(dir.path); } | ||
updateModel(dir, value) { | ||
var ctrl = this.form.find(dir.path); | ||
ctrl.updateValue(value); | ||
var ctrl = this.form.get(dir.path); | ||
ctrl.setValue(value); | ||
} | ||
onSubmit() { | ||
this._submitted = true; | ||
ObservableWrapper.callEmit(this.ngSubmit, null); | ||
this.ngSubmit.emit(null); | ||
return false; | ||
} | ||
onReset() { this.form.reset(); } | ||
/** @internal */ | ||
_updateDomValue() { | ||
this.directives.forEach(dir => { | ||
var ctrl = this.form.find(dir.path); | ||
var ctrl = this.form.get(dir.path); | ||
dir.valueAccessor.writeValue(ctrl.value); | ||
@@ -91,5 +91,3 @@ }); | ||
if (isBlank(this.form)) { | ||
throw new BaseException(`formGroup expects a FormGroup instance. Please pass one in. | ||
Example: <form [formGroup]="myFormGroup"> | ||
`); | ||
ReactiveErrors.missingFormException(); | ||
} | ||
@@ -103,3 +101,3 @@ } | ||
providers: [formDirectiveProvider], | ||
host: { '(submit)': 'onSubmit()' }, | ||
host: { '(submit)': 'onSubmit()', '(reset)': 'onReset()' }, | ||
exportAs: 'ngForm' | ||
@@ -106,0 +104,0 @@ },] }, |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"formDirectiveProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormGroupDirective"}},"FormGroupDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formGroup]","providers":[{"__symbolic":"reference","name":"formDirectiveProvider"}],"host":{"(submit)":"onSubmit()"},"exportAs":"ngForm"}]}],"members":{"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formGroup"]}]}],"ngSubmit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"addControl":[{"__symbolic":"method"}],"getControl":[{"__symbolic":"method"}],"removeControl":[{"__symbolic":"method"}],"addFormGroup":[{"__symbolic":"method"}],"removeFormGroup":[{"__symbolic":"method"}],"getFormGroup":[{"__symbolic":"method"}],"addFormArray":[{"__symbolic":"method"}],"removeFormArray":[{"__symbolic":"method"}],"getFormArray":[{"__symbolic":"method"}],"updateModel":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"_updateDomValue":[{"__symbolic":"method"}],"_checkFormPresent":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"formDirectiveProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormGroupDirective"}},"FormGroupDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formGroup]","providers":[{"__symbolic":"reference","name":"formDirectiveProvider"}],"host":{"(submit)":"onSubmit()","(reset)":"onReset()"},"exportAs":"ngForm"}]}],"members":{"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formGroup"]}]}],"ngSubmit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"addControl":[{"__symbolic":"method"}],"getControl":[{"__symbolic":"method"}],"removeControl":[{"__symbolic":"method"}],"addFormGroup":[{"__symbolic":"method"}],"removeFormGroup":[{"__symbolic":"method"}],"getFormGroup":[{"__symbolic":"method"}],"addFormArray":[{"__symbolic":"method"}],"removeFormArray":[{"__symbolic":"method"}],"getFormArray":[{"__symbolic":"method"}],"updateModel":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"onReset":[{"__symbolic":"method"}],"_updateDomValue":[{"__symbolic":"method"}],"_checkFormPresent":[{"__symbolic":"method"}]}}}} |
@@ -9,4 +9,7 @@ /** | ||
import { OnDestroy, OnInit } from '@angular/core'; | ||
import { FormArray } from '../../model'; | ||
import { AbstractFormGroupDirective } from '../abstract_form_group_directive'; | ||
import { ControlContainer } from '../control_container'; | ||
import { AsyncValidatorFn, ValidatorFn } from '../validators'; | ||
import { FormGroupDirective } from './form_group_directive'; | ||
export declare const formGroupNameProvider: any; | ||
@@ -65,1 +68,49 @@ /** | ||
} | ||
export declare const formArrayNameProvider: any; | ||
/** | ||
* Syncs an existing form array to a DOM element. | ||
* | ||
* This directive can only be used as a child of {@link FormGroupDirective}. | ||
* | ||
* ```typescript | ||
* @Component({ | ||
* selector: 'my-app', | ||
* template: ` | ||
* <div> | ||
* <h2>Angular FormArray Example</h2> | ||
* <form [formGroup]="myForm"> | ||
* <div formArrayName="cities"> | ||
* <div *ngFor="let city of cityArray.controls; let i=index"> | ||
* <input [formControlName]="i"> | ||
* </div> | ||
* </div> | ||
* </form> | ||
* {{ myForm.value | json }} // {cities: ['SF', 'NY']} | ||
* </div> | ||
* ` | ||
* }) | ||
* export class App { | ||
* cityArray = new FormArray([ | ||
* new FormControl('SF'), | ||
* new FormControl('NY') | ||
* ]); | ||
* myForm = new FormGroup({ | ||
* cities: this.cityArray | ||
* }); | ||
* } | ||
* ``` | ||
* | ||
* @experimental | ||
*/ | ||
export declare class FormArrayName extends ControlContainer implements OnInit, OnDestroy { | ||
name: string; | ||
constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]); | ||
ngOnInit(): void; | ||
ngOnDestroy(): void; | ||
readonly control: FormArray; | ||
readonly formDirective: FormGroupDirective; | ||
readonly path: string[]; | ||
readonly validator: ValidatorFn; | ||
readonly asyncValidator: AsyncValidatorFn; | ||
private _checkParentType(); | ||
} |
@@ -12,4 +12,6 @@ /** | ||
import { ControlContainer } from '../control_container'; | ||
export const formGroupNameProvider = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
import { ReactiveErrors } from '../reactive_errors'; | ||
import { composeAsyncValidators, composeValidators, controlPath } from '../shared'; | ||
import { FormGroupDirective } from './form_group_directive'; | ||
export const formGroupNameProvider = { | ||
provide: ControlContainer, | ||
@@ -25,2 +27,8 @@ useExisting: forwardRef(() => FormGroupName) | ||
} | ||
/** @internal */ | ||
_checkParentType() { | ||
if (_hasInvalidParent(this._parent)) { | ||
ReactiveErrors.groupParentException(); | ||
} | ||
} | ||
} | ||
@@ -33,3 +41,3 @@ /** @nocollapse */ | ||
FormGroupName.ctorParameters = [ | ||
{ type: ControlContainer, decorators: [{ type: Host }, { type: SkipSelf },] }, | ||
{ type: ControlContainer, decorators: [{ type: Optional }, { type: Host }, { type: SkipSelf },] }, | ||
{ type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] }, | ||
@@ -42,2 +50,47 @@ { type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] }, | ||
}; | ||
export const formArrayNameProvider = { | ||
provide: ControlContainer, | ||
useExisting: forwardRef(() => FormArrayName) | ||
}; | ||
export class FormArrayName extends ControlContainer { | ||
constructor(parent, validators, asyncValidators) { | ||
super(); | ||
this._parent = parent; | ||
this._validators = validators; | ||
this._asyncValidators = asyncValidators; | ||
} | ||
ngOnInit() { | ||
this._checkParentType(); | ||
this.formDirective.addFormArray(this); | ||
} | ||
ngOnDestroy() { this.formDirective.removeFormArray(this); } | ||
get control() { return this.formDirective.getFormArray(this); } | ||
get formDirective() { return this._parent.formDirective; } | ||
get path() { return controlPath(this.name, this._parent); } | ||
get validator() { return composeValidators(this._validators); } | ||
get asyncValidator() { return composeAsyncValidators(this._asyncValidators); } | ||
_checkParentType() { | ||
if (_hasInvalidParent(this._parent)) { | ||
ReactiveErrors.arrayParentException(); | ||
} | ||
} | ||
} | ||
/** @nocollapse */ | ||
FormArrayName.decorators = [ | ||
{ type: Directive, args: [{ selector: '[formArrayName]', providers: [formArrayNameProvider] },] }, | ||
]; | ||
/** @nocollapse */ | ||
FormArrayName.ctorParameters = [ | ||
{ type: ControlContainer, decorators: [{ type: Optional }, { type: Host }, { type: SkipSelf },] }, | ||
{ type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_VALIDATORS,] },] }, | ||
{ type: Array, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] },] }, | ||
]; | ||
/** @nocollapse */ | ||
FormArrayName.propDecorators = { | ||
'name': [{ type: Input, args: ['formArrayName',] },], | ||
}; | ||
function _hasInvalidParent(parent) { | ||
return !(parent instanceof FormGroupName) && !(parent instanceof FormGroupDirective) && | ||
!(parent instanceof FormArrayName); | ||
} | ||
//# sourceMappingURL=form_group_name.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"formGroupNameProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormGroupName"}},"FormGroupName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formGroupName]","providers":[{"__symbolic":"reference","name":"formGroupNameProvider"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formGroupName"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"formGroupNameProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormGroupName"}},"FormGroupName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formGroupName]","providers":[{"__symbolic":"reference","name":"formGroupNameProvider"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formGroupName"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"_checkParentType":[{"__symbolic":"method"}]}},"formArrayNameProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormArrayName"}},"FormArrayName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formArrayName]","providers":[{"__symbolic":"reference","name":"formArrayNameProvider"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formArrayName"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"_checkParentType":[{"__symbolic":"method"}]}}}} |
@@ -8,6 +8,13 @@ /** | ||
*/ | ||
import { ElementRef, OnDestroy, Renderer } from '@angular/core'; | ||
import { ElementRef, OnDestroy, OpaqueToken, Renderer, Type } from '@angular/core'; | ||
import { ControlValueAccessor } from './control_value_accessor'; | ||
export declare const SELECT_MULTIPLE_VALUE_ACCESSOR: { | ||
provide: OpaqueToken; | ||
useExisting: Type; | ||
multi: boolean; | ||
}; | ||
/** | ||
* The accessor for writing a value and listening to changes on a select element. | ||
* | ||
* @experimental | ||
*/ | ||
@@ -14,0 +21,0 @@ export declare class SelectMultipleControlValueAccessor implements ControlValueAccessor { |
@@ -12,3 +12,3 @@ /** | ||
import { NG_VALUE_ACCESSOR } from './control_value_accessor'; | ||
const SELECT_MULTIPLE_VALUE_ACCESSOR = { | ||
export const SELECT_MULTIPLE_VALUE_ACCESSOR = { | ||
provide: NG_VALUE_ACCESSOR, | ||
@@ -100,3 +100,3 @@ useExisting: forwardRef(() => SelectMultipleControlValueAccessor), | ||
selector: 'select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]', | ||
host: { '(input)': 'onChange($event.target)', '(blur)': 'onTouched()' }, | ||
host: { '(change)': 'onChange($event.target)', '(blur)': 'onTouched()' }, | ||
providers: [SELECT_MULTIPLE_VALUE_ACCESSOR] | ||
@@ -103,0 +103,0 @@ },] }, |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"SelectMultipleControlValueAccessor":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]","host":{"(input)":"onChange($event.target)","(blur)":"onTouched()"},"providers":[{"__symbolic":"reference","name":"SELECT_MULTIPLE_VALUE_ACCESSOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"_registerOption":[{"__symbolic":"method"}],"_getOptionId":[{"__symbolic":"method"}],"_getOptionValue":[{"__symbolic":"method"}]}},"NgSelectMultipleOption":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"option"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer"},{"__symbolic":"reference","name":"SelectMultipleControlValueAccessor"}]}],"ngValue":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngValue"]}]}],"value":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["value"]}]}],"_setElementValue":[{"__symbolic":"method"}],"_setSelected":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"SELECT_DIRECTIVES":[{"__symbolic":"reference","name":"SelectMultipleControlValueAccessor"},{"__symbolic":"reference","name":"NgSelectMultipleOption"}]}} | ||
{"__symbolic":"module","version":1,"metadata":{"SELECT_MULTIPLE_VALUE_ACCESSOR":{"provide":{"__symbolic":"reference","module":"./control_value_accessor","name":"NG_VALUE_ACCESSOR"},"useExisting":{"__symbolic":"reference","name":"SelectMultipleControlValueAccessor"},"multi":true},"SelectMultipleControlValueAccessor":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]","host":{"(change)":"onChange($event.target)","(blur)":"onTouched()"},"providers":[{"__symbolic":"reference","name":"SELECT_MULTIPLE_VALUE_ACCESSOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"_registerOption":[{"__symbolic":"method"}],"_getOptionId":[{"__symbolic":"method"}],"_getOptionValue":[{"__symbolic":"method"}]}},"NgSelectMultipleOption":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"option"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer"},{"__symbolic":"reference","name":"SelectMultipleControlValueAccessor"}]}],"ngValue":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngValue"]}]}],"value":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["value"]}]}],"_setElementValue":[{"__symbolic":"method"}],"_setSelected":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"SELECT_DIRECTIVES":[{"__symbolic":"reference","name":"SelectMultipleControlValueAccessor"},{"__symbolic":"reference","name":"NgSelectMultipleOption"}]}} |
@@ -6,3 +6,3 @@ import { FormArray, FormControl, FormGroup } from '../model'; | ||
import { NgControl } from './ng_control'; | ||
import { FormArrayName } from './reactive_directives/form_array_name'; | ||
import { FormArrayName } from './reactive_directives/form_group_name'; | ||
import { AsyncValidatorFn, ValidatorFn } from './validators'; | ||
@@ -9,0 +9,0 @@ export declare function controlPath(name: string, parent: ControlContainer): string[]; |
@@ -26,5 +26,5 @@ /** | ||
if (isBlank(control)) | ||
_throwError(dir, 'Cannot find control'); | ||
_throwError(dir, 'Cannot find control with'); | ||
if (isBlank(dir.valueAccessor)) | ||
_throwError(dir, 'No value accessor for'); | ||
_throwError(dir, 'No value accessor for form control with'); | ||
control.validator = Validators.compose([control.validator, dir.validator]); | ||
@@ -36,7 +36,12 @@ control.asyncValidator = Validators.composeAsync([control.asyncValidator, dir.asyncValidator]); | ||
dir.viewToModelUpdate(newValue); | ||
control.updateValue(newValue, { emitModelToViewChange: false }); | ||
control.markAsDirty(); | ||
control.setValue(newValue, { emitModelToViewChange: false }); | ||
}); | ||
// model -> view | ||
control.registerOnChange((newValue) => dir.valueAccessor.writeValue(newValue)); | ||
control.registerOnChange((newValue, emitModelEvent) => { | ||
// control -> view | ||
dir.valueAccessor.writeValue(newValue); | ||
// control -> ngModel | ||
if (emitModelEvent) | ||
dir.viewToModelUpdate(newValue); | ||
}); | ||
// touched | ||
@@ -47,3 +52,3 @@ dir.valueAccessor.registerOnTouched(() => control.markAsTouched()); | ||
if (isBlank(control)) | ||
_throwError(dir, 'Cannot find control'); | ||
_throwError(dir, 'Cannot find control with'); | ||
control.validator = Validators.compose([control.validator, dir.validator]); | ||
@@ -53,4 +58,13 @@ control.asyncValidator = Validators.composeAsync([control.asyncValidator, dir.asyncValidator]); | ||
function _throwError(dir, message) { | ||
var path = dir.path.join(' -> '); | ||
throw new BaseException(`${message} '${path}'`); | ||
let messageEnd; | ||
if (dir.path.length > 1) { | ||
messageEnd = `path: '${dir.path.join(' -> ')}'`; | ||
} | ||
else if (dir.path[0]) { | ||
messageEnd = `name: '${dir.path}'`; | ||
} | ||
else { | ||
messageEnd = 'unspecified name attribute'; | ||
} | ||
throw new BaseException(`${message} ${messageEnd}`); | ||
} | ||
@@ -88,3 +102,3 @@ export function composeValidators(validators) { | ||
if (isPresent(builtinAccessor)) | ||
_throwError(dir, 'More than one built-in value accessor matches'); | ||
_throwError(dir, 'More than one built-in value accessor matches form control with'); | ||
builtinAccessor = v; | ||
@@ -94,3 +108,3 @@ } | ||
if (isPresent(customAccessor)) | ||
_throwError(dir, 'More than one custom value accessor matches'); | ||
_throwError(dir, 'More than one custom value accessor matches form control with'); | ||
customAccessor = v; | ||
@@ -105,5 +119,5 @@ } | ||
return defaultAccessor; | ||
_throwError(dir, 'No valid value accessor for'); | ||
_throwError(dir, 'No valid value accessor for form control with'); | ||
return null; | ||
} | ||
//# sourceMappingURL=shared.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"composeValidators":{"__symbolic":"function","parameters":["validators"],"value":{"__symbolic":"error","message":"Expression form not supported","line":71,"character":8}},"composeAsyncValidators":{"__symbolic":"function","parameters":["validators"],"value":{"__symbolic":"error","message":"Expression form not supported","line":76,"character":8}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"composeValidators":{"__symbolic":"function","parameters":["validators"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"../facade/lang","name":"isPresent"},"arguments":[{"__symbolic":"reference","name":"validators"}]},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"../validators","name":"Validators"},"member":"compose"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"validators"},"member":"map"},"arguments":[{"__symbolic":"reference","module":"./normalize_validator","name":"normalizeValidator"}]}]},"elseExpression":null}},"composeAsyncValidators":{"__symbolic":"function","parameters":["validators"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"../facade/lang","name":"isPresent"},"arguments":[{"__symbolic":"reference","name":"validators"}]},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"../validators","name":"Validators"},"member":"composeAsync"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"validators"},"member":"map"},"arguments":[{"__symbolic":"reference","module":"./normalize_validator","name":"normalizeAsyncValidator"}]}]},"elseExpression":null}}}} |
import { AbstractControl } from '../model'; | ||
import { Validators } from '../validators'; | ||
/** | ||
@@ -26,2 +27,3 @@ * An interface that can be implemented by classes that can act as validators. | ||
} | ||
export declare const REQUIRED: typeof Validators.required; | ||
export declare const REQUIRED_VALIDATOR: any; | ||
@@ -57,3 +59,3 @@ /** | ||
/** | ||
* Provivder which adds {@link MinLengthValidator} to {@link NG_VALIDATORS}. | ||
* Provider which adds {@link MinLengthValidator} to {@link NG_VALIDATORS}. | ||
* | ||
@@ -60,0 +62,0 @@ * ## Example: |
@@ -11,3 +11,3 @@ /** | ||
import { NG_VALIDATORS, Validators } from '../validators'; | ||
const REQUIRED = Validators.required; | ||
export const REQUIRED = Validators.required; | ||
export const REQUIRED_VALIDATOR = { | ||
@@ -28,3 +28,3 @@ provide: NG_VALIDATORS, | ||
/** | ||
* Provivder which adds {@link MinLengthValidator} to {@link NG_VALIDATORS}. | ||
* Provider which adds {@link MinLengthValidator} to {@link NG_VALIDATORS}. | ||
* | ||
@@ -31,0 +31,0 @@ * ## Example: |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"REQUIRED_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useValue":{"__symbolic":"reference","name":"REQUIRED"},"multi":true},"RequiredValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[required][formControlName],[required][formControl],[required][ngModel]","providers":[{"__symbolic":"reference","name":"REQUIRED_VALIDATOR"}]}]}]},"MIN_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MinLengthValidator"},"multi":true},"MinLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[minlength][formControlName],[minlength][formControl],[minlength][ngModel]","providers":[{"__symbolic":"reference","name":"MIN_LENGTH_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["minlength"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}},"MAX_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MaxLengthValidator"},"multi":true},"MaxLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]","providers":[{"__symbolic":"reference","name":"MAX_LENGTH_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["maxlength"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}},"PATTERN_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"PatternValidator"},"multi":true},"PatternValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[pattern][formControlName],[pattern][formControl],[pattern][ngModel]","providers":[{"__symbolic":"reference","name":"PATTERN_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["pattern"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"REQUIRED":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"../validators","name":"Validators"},"member":"required"},"REQUIRED_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useValue":{"__symbolic":"reference","name":"REQUIRED"},"multi":true},"RequiredValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[required][formControlName],[required][formControl],[required][ngModel]","providers":[{"__symbolic":"reference","name":"REQUIRED_VALIDATOR"}]}]}]},"MIN_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MinLengthValidator"},"multi":true},"MinLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[minlength][formControlName],[minlength][formControl],[minlength][ngModel]","providers":[{"__symbolic":"reference","name":"MIN_LENGTH_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["minlength"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}},"MAX_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MaxLengthValidator"},"multi":true},"MaxLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]","providers":[{"__symbolic":"reference","name":"MAX_LENGTH_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["maxlength"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}},"PATTERN_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"PatternValidator"},"multi":true},"PatternValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[pattern][formControlName],[pattern][formControl],[pattern][ngModel]","providers":[{"__symbolic":"reference","name":"PATTERN_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["pattern"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}}}} |
@@ -8,31 +8,5 @@ /** | ||
*/ | ||
import { Observable } from 'rxjs/Observable'; | ||
import { Subject } from 'rxjs/Subject'; | ||
export { Observable } from 'rxjs/Observable'; | ||
export { Subject } from 'rxjs/Subject'; | ||
export { PromiseCompleter, PromiseWrapper } from './promise'; | ||
export declare class TimerWrapper { | ||
static setTimeout(fn: (...args: any[]) => void, millis: number): number; | ||
static clearTimeout(id: number): void; | ||
static setInterval(fn: (...args: any[]) => void, millis: number): number; | ||
static clearInterval(id: number): void; | ||
} | ||
export declare class ObservableWrapper { | ||
static subscribe<T>(emitter: any, onNext: (value: T) => void, onError?: (exception: any) => void, onComplete?: () => void): Object; | ||
static isObservable(obs: any): boolean; | ||
/** | ||
* Returns whether `obs` has any subscribers listening to events. | ||
*/ | ||
static hasSubscribers(obs: EventEmitter<any>): boolean; | ||
static dispose(subscription: any): void; | ||
/** | ||
* @deprecated - use callEmit() instead | ||
*/ | ||
static callNext(emitter: EventEmitter<any>, value: any): void; | ||
static callEmit(emitter: EventEmitter<any>, value: any): void; | ||
static callError(emitter: EventEmitter<any>, error: any): void; | ||
static callComplete(emitter: EventEmitter<any>): void; | ||
static fromPromise(promise: Promise<any>): Observable<any>; | ||
static toPromise(obj: Observable<any>): Promise<any>; | ||
} | ||
/** | ||
@@ -92,3 +66,3 @@ * Use by directives and components to emit custom Events. | ||
constructor(isAsync?: boolean); | ||
emit(value: T): void; | ||
emit(value?: T): void; | ||
/** | ||
@@ -95,0 +69,0 @@ * @deprecated - use .emit(value) instead |
@@ -9,43 +9,4 @@ /** | ||
import { Subject } from 'rxjs/Subject'; | ||
import { PromiseObservable } from 'rxjs/observable/PromiseObservable'; | ||
import { toPromise } from 'rxjs/operator/toPromise'; | ||
import { global, noop } from './lang'; | ||
export { Observable } from 'rxjs/Observable'; | ||
export { Subject } from 'rxjs/Subject'; | ||
export { PromiseCompleter, PromiseWrapper } from './promise'; | ||
export class TimerWrapper { | ||
static setTimeout(fn, millis) { | ||
return global.setTimeout(fn, millis); | ||
} | ||
static clearTimeout(id) { global.clearTimeout(id); } | ||
static setInterval(fn, millis) { | ||
return global.setInterval(fn, millis); | ||
} | ||
static clearInterval(id) { global.clearInterval(id); } | ||
} | ||
export class ObservableWrapper { | ||
// TODO(vsavkin): when we use rxnext, try inferring the generic type from the first arg | ||
static subscribe(emitter, onNext, onError, onComplete = () => { }) { | ||
onError = (typeof onError === 'function') && onError || noop; | ||
onComplete = (typeof onComplete === 'function') && onComplete || noop; | ||
return emitter.subscribe({ next: onNext, error: onError, complete: onComplete }); | ||
} | ||
static isObservable(obs) { return !!obs.subscribe; } | ||
/** | ||
* Returns whether `obs` has any subscribers listening to events. | ||
*/ | ||
static hasSubscribers(obs) { return obs.observers.length > 0; } | ||
static dispose(subscription) { subscription.unsubscribe(); } | ||
/** | ||
* @deprecated - use callEmit() instead | ||
*/ | ||
static callNext(emitter, value) { emitter.emit(value); } | ||
static callEmit(emitter, value) { emitter.emit(value); } | ||
static callError(emitter, error) { emitter.error(error); } | ||
static callComplete(emitter) { emitter.complete(); } | ||
static fromPromise(promise) { | ||
return PromiseObservable.create(promise); | ||
} | ||
static toPromise(obj) { return toPromise.call(obj); } | ||
} | ||
/** | ||
@@ -52,0 +13,0 @@ * Use by directives and components to emit custom Events. |
@@ -47,3 +47,3 @@ export declare var Map: MapConstructor; | ||
[key: string]: V; | ||
}, callback: Function): void; | ||
}, callback: (v: V, K: string) => void): void; | ||
static merge<V>(m1: { | ||
@@ -50,0 +50,0 @@ [key: string]: V; |
@@ -120,6 +120,3 @@ /** | ||
static values(map) { | ||
return Object.keys(map).reduce((r, a) => { | ||
r.push(map[a]); | ||
return r; | ||
}, []); | ||
return Object.keys(map).map((k) => map[k]); | ||
} | ||
@@ -134,6 +131,4 @@ static isEmpty(map) { | ||
static forEach(map, callback) { | ||
for (var prop in map) { | ||
if (map.hasOwnProperty(prop)) { | ||
callback(map[prop], prop); | ||
} | ||
for (let k of Object.keys(map)) { | ||
callback(map[k], k); | ||
} | ||
@@ -143,11 +138,7 @@ } | ||
var m = {}; | ||
for (var attr in m1) { | ||
if (m1.hasOwnProperty(attr)) { | ||
m[attr] = m1[attr]; | ||
} | ||
for (let k of Object.keys(m1)) { | ||
m[k] = m1[k]; | ||
} | ||
for (var attr in m2) { | ||
if (m2.hasOwnProperty(attr)) { | ||
m[attr] = m2[attr]; | ||
} | ||
for (let k of Object.keys(m2)) { | ||
m[k] = m2[k]; | ||
} | ||
@@ -154,0 +145,0 @@ return m; |
@@ -18,3 +18,3 @@ /** | ||
* | ||
* bootstrap(MyApp, {provide: ExceptionHandler, useClass: MyExceptionHandler}]) | ||
* bootstrap(MyApp, [{provide: ExceptionHandler, useClass: MyExceptionHandler}]) | ||
* | ||
@@ -21,0 +21,0 @@ * ``` |
@@ -38,3 +38,3 @@ /** | ||
* | ||
* bootstrap(MyApp, {provide: ExceptionHandler, useClass: MyExceptionHandler}]) | ||
* bootstrap(MyApp, [{provide: ExceptionHandler, useClass: MyExceptionHandler}]) | ||
* | ||
@@ -41,0 +41,0 @@ * ``` |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"makeTypeError":{"__symbolic":"function","parameters":["message"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"TypeError"},"arguments":[{"__symbolic":"reference","name":"message"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"makeTypeError":{"__symbolic":"function","parameters":["message"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"TypeError"},"arguments":[{"__symbolic":"reference","name":"message"}]}}},"exports":[{"from":"./exception_handler","export":["ExceptionHandler"]}]} |
@@ -30,3 +30,2 @@ /** | ||
export declare function scheduleMicroTask(fn: Function): void; | ||
export declare const IS_DART: boolean; | ||
declare var _global: BrowserNodeGlobal; | ||
@@ -109,18 +108,2 @@ export { _global as global }; | ||
export declare var RegExp: RegExpConstructor; | ||
export declare class RegExpWrapper { | ||
static create(regExpStr: string, flags?: string): RegExp; | ||
static firstMatch(regExp: RegExp, input: string): RegExpExecArray; | ||
static test(regExp: RegExp, input: string): boolean; | ||
static matcher(regExp: RegExp, input: string): { | ||
re: RegExp; | ||
input: string; | ||
}; | ||
static replaceAll(regExp: RegExp, input: string, replace: Function): string; | ||
} | ||
export declare class RegExpMatcherWrapper { | ||
static next(matcher: { | ||
re: RegExp; | ||
input: string; | ||
}): RegExpExecArray; | ||
} | ||
export declare class FunctionWrapper { | ||
@@ -127,0 +110,0 @@ static apply(fn: Function, posArgs: any): any; |
@@ -24,3 +24,2 @@ /** | ||
} | ||
export const IS_DART = false; | ||
// Need to declare a new variable for global here since TypeScript | ||
@@ -82,3 +81,5 @@ // exports the original value of the symbol. | ||
export function isPromise(obj) { | ||
return obj instanceof _global.Promise; | ||
// allow any Promise/A+ compliant thenable. | ||
// It's up to the caller to ensure that obj.then conforms to the spec | ||
return isPresent(obj) && isFunction(obj.then); | ||
} | ||
@@ -99,8 +100,8 @@ export function isArray(obj) { | ||
} | ||
if (token.overriddenName) { | ||
return token.overriddenName; | ||
} | ||
if (token.name) { | ||
return token.name; | ||
} | ||
if (token.overriddenName) { | ||
return token.overriddenName; | ||
} | ||
var res = token.toString(); | ||
@@ -231,44 +232,2 @@ var newLineIndex = res.indexOf('\n'); | ||
export var RegExp = _global.RegExp; | ||
export class RegExpWrapper { | ||
static create(regExpStr, flags = '') { | ||
flags = flags.replace(/g/g, ''); | ||
return new _global.RegExp(regExpStr, flags + 'g'); | ||
} | ||
static firstMatch(regExp, input) { | ||
// Reset multimatch regex state | ||
regExp.lastIndex = 0; | ||
return regExp.exec(input); | ||
} | ||
static test(regExp, input) { | ||
regExp.lastIndex = 0; | ||
return regExp.test(input); | ||
} | ||
static matcher(regExp, input) { | ||
// Reset regex state for the case | ||
// someone did not loop over all matches | ||
// last time. | ||
regExp.lastIndex = 0; | ||
return { re: regExp, input: input }; | ||
} | ||
static replaceAll(regExp, input, replace) { | ||
let c = regExp.exec(input); | ||
let res = ''; | ||
regExp.lastIndex = 0; | ||
let prev = 0; | ||
while (c) { | ||
res += input.substring(prev, c.index); | ||
res += replace(c); | ||
prev = c.index + c[0].length; | ||
regExp.lastIndex = prev; | ||
c = regExp.exec(input); | ||
} | ||
res += input.substring(prev); | ||
return res; | ||
} | ||
} | ||
export class RegExpMatcherWrapper { | ||
static next(matcher) { | ||
return matcher.re.exec(matcher.input); | ||
} | ||
} | ||
export class FunctionWrapper { | ||
@@ -275,0 +234,0 @@ static apply(fn, posArgs) { return fn.apply(null, posArgs); } |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"IS_DART":false,"Type":{"__symbolic":"reference","name":"Function"},"Math":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_global"},"member":"Math"},"Date":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_global"},"member":"Date"},"isPresent":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBoolean":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":106,"character":8},"right":"boolean"}},"isNumber":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":110,"character":8},"right":"number"}},"isString":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":114,"character":8},"right":"string"}},"isFunction":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":118,"character":8},"right":"function"}},"isType":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFunction"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":126,"character":8},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isStrictStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isStringMap"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"reference","name":"STRING_MAP_PROTO"}}}},"isPromise":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_global"},"member":"Promise"}}},"isArray":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Array"},"member":"isArray"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isDate":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"Date"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"valueOf"}}]}}}},"serializeEnum":{"__symbolic":"function","parameters":["val"],"value":{"__symbolic":"reference","name":"val"}},"deserializeEnum":{"__symbolic":"function","parameters":["val","values"],"value":{"__symbolic":"reference","name":"val"}},"resolveEnumToken":{"__symbolic":"function","parameters":["enumValue","val"],"value":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"enumValue"},"index":{"__symbolic":"reference","name":"val"}}},"RegExp":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_global"},"member":"RegExp"},"looseIdentical":{"__symbolic":"function","parameters":["a","b"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"a"},"right":{"__symbolic":"reference","name":"b"}},"right":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":366,"character":19},"right":"number"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":366,"character":44},"right":"number"}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"a"}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"b"}]}}}},"getMapKey":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"reference","name":"value"}},"normalizeBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"error","message":"Expression form not supported","line":376,"character":8}},"normalizeBool":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"error","message":"Expression form not supported","line":380,"character":8}},"isJsObject":{"__symbolic":"function","parameters":["o"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"o"},"right":null},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":384,"character":24},"right":"function"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":384,"character":50},"right":"object"}}}},"isPrimitive":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isJsObject"},"arguments":[{"__symbolic":"reference","name":"obj"}]}}},"hasConstructor":{"__symbolic":"function","parameters":["value","type"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"value"},"member":"constructor"},"right":{"__symbolic":"reference","name":"type"}}},"escape":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_global"},"member":"encodeURI"},"arguments":[{"__symbolic":"reference","name":"s"}]}},"escapeRegExp":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Expression form not supported","line":481,"character":19}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"Type":{"__symbolic":"reference","name":"Function"},"Math":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":3,"context":{"name":"_global"}},"Date":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":3,"context":{"name":"_global"}},"isPresent":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBoolean":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":104,"character":8},"right":"boolean"}},"isNumber":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":108,"character":8},"right":"number"}},"isString":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":112,"character":8},"right":"string"}},"isFunction":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":116,"character":8},"right":"function"}},"isType":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFunction"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":124,"character":8},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isStrictStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isStringMap"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"error","message":"Reference to a local symbol","line":127,"character":5,"context":{"name":"STRING_MAP_PROTO"}}}}},"isPromise":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isPresent"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFunction"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"then"}]}}},"isArray":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Array"},"member":"isArray"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isDate":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"Date"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"valueOf"}}]}}}},"serializeEnum":{"__symbolic":"function","parameters":["val"],"value":{"__symbolic":"reference","name":"val"}},"deserializeEnum":{"__symbolic":"function","parameters":["val","values"],"value":{"__symbolic":"reference","name":"val"}},"resolveEnumToken":{"__symbolic":"function","parameters":["enumValue","val"],"value":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"enumValue"},"index":{"__symbolic":"reference","name":"val"}}},"RegExp":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":3,"context":{"name":"_global"}},"looseIdentical":{"__symbolic":"function","parameters":["a","b"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"a"},"right":{"__symbolic":"reference","name":"b"}},"right":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":322,"character":19},"right":"number"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":322,"character":44},"right":"number"}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"a"}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"b"}]}}}},"getMapKey":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"reference","name":"value"}},"normalizeBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":null,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"normalizeBool":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":false,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"isJsObject":{"__symbolic":"function","parameters":["o"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"o"},"right":null},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":340,"character":24},"right":"function"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":340,"character":50},"right":"object"}}}},"isPrimitive":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isJsObject"},"arguments":[{"__symbolic":"reference","name":"obj"}]}}},"hasConstructor":{"__symbolic":"function","parameters":["value","type"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"value"},"member":"constructor"},"right":{"__symbolic":"reference","name":"type"}}},"escape":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":3,"context":{"name":"_global"}}},"escapeRegExp":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Expression form not supported","line":437,"character":19}}}} |
@@ -0,11 +1,11 @@ | ||
/** | ||
* @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 | ||
*/ | ||
import { Type } from '@angular/core'; | ||
/** | ||
* Shorthand set of providers used for building Angular forms. | ||
* | ||
* ### Example | ||
* | ||
* ```typescript | ||
* bootstrap(MyApp, [FORM_PROVIDERS]); | ||
* ``` | ||
* | ||
* @experimental | ||
@@ -15,8 +15,25 @@ */ | ||
/** | ||
* Shorthand set of providers used for building reactive Angular forms. | ||
* @experimental | ||
*/ | ||
export declare function disableDeprecatedForms(): any[]; | ||
export declare const REACTIVE_FORM_PROVIDERS: Type[]; | ||
/** | ||
* The ng module for forms. | ||
* @experimental | ||
*/ | ||
export declare class FormsModule { | ||
} | ||
/** | ||
* The ng module for reactive forms. | ||
* @experimental | ||
*/ | ||
export declare class ReactiveFormsModule { | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare function disableDeprecatedForms(): any[]; | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare function provideForms(): any[]; |
@@ -8,55 +8,50 @@ /** | ||
*/ | ||
import { FORM_DIRECTIVES as OLD_FORM_DIRECTIVES } from '@angular/common'; | ||
import { CompilerConfig } from '@angular/compiler'; | ||
import { PLATFORM_DIRECTIVES, PLATFORM_PIPES } from '@angular/core'; | ||
import { FORM_DIRECTIVES as NEW_FORM_DIRECTIVES } from './directives'; | ||
import { RadioControlRegistry as NewRadioControlRegistry } from './directives/radio_control_value_accessor'; | ||
import { ListWrapper } from './facade/collection'; | ||
import { FormBuilder as NewFormBuilder } from './form_builder'; | ||
import { NgModule, PLATFORM_DIRECTIVES } from '@angular/core'; | ||
import { FORM_DIRECTIVES, InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES, TEMPLATE_DRIVEN_DIRECTIVES } from './directives'; | ||
import { RadioControlRegistry } from './directives/radio_control_value_accessor'; | ||
import { FormBuilder } from './form_builder'; | ||
/** | ||
* Shorthand set of providers used for building Angular forms. | ||
* | ||
* ### Example | ||
* | ||
* ```typescript | ||
* bootstrap(MyApp, [FORM_PROVIDERS]); | ||
* ``` | ||
* | ||
* @experimental | ||
*/ | ||
export const FORM_PROVIDERS = [NewFormBuilder, NewRadioControlRegistry]; | ||
function flatten(platformDirectives) { | ||
let flattenedDirectives = []; | ||
platformDirectives.forEach((directives) => { | ||
if (Array.isArray(directives)) { | ||
flattenedDirectives = flattenedDirectives.concat(directives); | ||
} | ||
else { | ||
flattenedDirectives.push(directives); | ||
} | ||
}); | ||
return flattenedDirectives; | ||
} | ||
export const FORM_PROVIDERS = [RadioControlRegistry]; | ||
/** | ||
* Shorthand set of providers used for building reactive Angular forms. | ||
* @experimental | ||
*/ | ||
export const REACTIVE_FORM_PROVIDERS = [FormBuilder, RadioControlRegistry]; | ||
export class FormsModule { | ||
} | ||
/** @nocollapse */ | ||
FormsModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
declarations: TEMPLATE_DRIVEN_DIRECTIVES, | ||
providers: [FORM_PROVIDERS], | ||
exports: [InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES] | ||
},] }, | ||
]; | ||
export class ReactiveFormsModule { | ||
} | ||
/** @nocollapse */ | ||
ReactiveFormsModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
declarations: [REACTIVE_DRIVEN_DIRECTIVES], | ||
providers: [REACTIVE_FORM_PROVIDERS], | ||
exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES] | ||
},] }, | ||
]; | ||
/** | ||
* @deprecated | ||
*/ | ||
export function disableDeprecatedForms() { | ||
return [{ | ||
provide: CompilerConfig, | ||
useFactory: (platformDirectives, platformPipes) => { | ||
const flattenedDirectives = flatten(platformDirectives); | ||
ListWrapper.remove(flattenedDirectives, OLD_FORM_DIRECTIVES); | ||
return new CompilerConfig({ platformDirectives: flattenedDirectives, platformPipes }); | ||
}, | ||
deps: [PLATFORM_DIRECTIVES, PLATFORM_PIPES] | ||
}]; | ||
return []; | ||
} | ||
/** | ||
* @experimental | ||
* @deprecated | ||
*/ | ||
export function provideForms() { | ||
return [ | ||
{ provide: PLATFORM_DIRECTIVES, useValue: NEW_FORM_DIRECTIVES, multi: true }, FORM_PROVIDERS | ||
{ provide: PLATFORM_DIRECTIVES, useValue: FORM_DIRECTIVES, multi: true }, REACTIVE_FORM_PROVIDERS | ||
]; | ||
} | ||
//# sourceMappingURL=form_providers.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"FORM_PROVIDERS":[{"__symbolic":"reference","module":"./form_builder","name":"FormBuilder"},{"__symbolic":"reference","module":"./directives/radio_control_value_accessor","name":"RadioControlRegistry"}],"disableDeprecatedForms":{"__symbolic":"function","parameters":[],"value":{"__symbolic":"error","message":"Function call not supported","line":52,"character":15}},"provideForms":{"__symbolic":"function","parameters":[],"value":[{"provide":{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_DIRECTIVES"},"useValue":{"__symbolic":"reference","module":"./directives","name":"FORM_DIRECTIVES"},"multi":true},{"__symbolic":"reference","name":"FORM_PROVIDERS"}]}}} | ||
{"__symbolic":"module","version":1,"metadata":{"FORM_PROVIDERS":[{"__symbolic":"reference","module":"./directives/radio_control_value_accessor","name":"RadioControlRegistry"}],"REACTIVE_FORM_PROVIDERS":[{"__symbolic":"reference","module":"./form_builder","name":"FormBuilder"},{"__symbolic":"reference","module":"./directives/radio_control_value_accessor","name":"RadioControlRegistry"}],"FormsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":{"__symbolic":"reference","module":"./directives","name":"TEMPLATE_DRIVEN_DIRECTIVES"},"providers":[{"__symbolic":"reference","name":"FORM_PROVIDERS"}],"exports":[{"__symbolic":"reference","module":"./directives","name":"InternalFormsSharedModule"},{"__symbolic":"reference","module":"./directives","name":"TEMPLATE_DRIVEN_DIRECTIVES"}]}]}]},"ReactiveFormsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./directives","name":"REACTIVE_DRIVEN_DIRECTIVES"}],"providers":[{"__symbolic":"reference","name":"REACTIVE_FORM_PROVIDERS"}],"exports":[{"__symbolic":"reference","module":"./directives","name":"InternalFormsSharedModule"},{"__symbolic":"reference","module":"./directives","name":"REACTIVE_DRIVEN_DIRECTIVES"}]}]}]},"disableDeprecatedForms":{"__symbolic":"function","parameters":[],"value":[]},"provideForms":{"__symbolic":"function","parameters":[],"value":[{"provide":{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_DIRECTIVES"},"useValue":{"__symbolic":"reference","module":"./directives","name":"FORM_DIRECTIVES"},"multi":true},{"__symbolic":"reference","name":"REACTIVE_FORM_PROVIDERS"}]}}} |
@@ -23,2 +23,3 @@ /** | ||
export { AbstractControlDirective } from './directives/abstract_control_directive'; | ||
export { AbstractFormGroupDirective } from './directives/abstract_form_group_directive'; | ||
export { CheckboxControlValueAccessor } from './directives/checkbox_value_accessor'; | ||
@@ -34,8 +35,9 @@ export { ControlContainer } from './directives/control_container'; | ||
export { NgModelGroup } from './directives/ng_model_group'; | ||
export { FormArrayName } from './directives/reactive_directives/form_array_name'; | ||
export { FormControlDirective } from './directives/reactive_directives/form_control_directive'; | ||
export { FormControlName } from './directives/reactive_directives/form_control_name'; | ||
export { FormGroupDirective } from './directives/reactive_directives/form_group_directive'; | ||
export { FormArrayName } from './directives/reactive_directives/form_group_name'; | ||
export { FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
export { NgSelectOption, SelectControlValueAccessor } from './directives/select_control_value_accessor'; | ||
export { SelectMultipleControlValueAccessor } from './directives/select_multiple_control_value_accessor'; | ||
export { AsyncValidatorFn, MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, Validator, ValidatorFn } from './directives/validators'; | ||
@@ -42,0 +44,0 @@ export { FormBuilder } from './form_builder'; |
@@ -23,2 +23,3 @@ /** | ||
export { AbstractControlDirective } from './directives/abstract_control_directive'; | ||
export { AbstractFormGroupDirective } from './directives/abstract_form_group_directive'; | ||
export { CheckboxControlValueAccessor } from './directives/checkbox_value_accessor'; | ||
@@ -33,8 +34,9 @@ export { ControlContainer } from './directives/control_container'; | ||
export { NgModelGroup } from './directives/ng_model_group'; | ||
export { FormArrayName } from './directives/reactive_directives/form_array_name'; | ||
export { FormControlDirective } from './directives/reactive_directives/form_control_directive'; | ||
export { FormControlName } from './directives/reactive_directives/form_control_name'; | ||
export { FormGroupDirective } from './directives/reactive_directives/form_group_directive'; | ||
export { FormArrayName } from './directives/reactive_directives/form_group_name'; | ||
export { FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
export { NgSelectOption, SelectControlValueAccessor } from './directives/select_control_value_accessor'; | ||
export { SelectMultipleControlValueAccessor } from './directives/select_multiple_control_value_accessor'; | ||
export { MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator } from './directives/validators'; | ||
@@ -41,0 +43,0 @@ export { FormBuilder } from './form_builder'; |
@@ -35,2 +35,3 @@ import { AsyncValidatorFn, ValidatorFn } from './directives/validators'; | ||
readonly valid: boolean; | ||
readonly invalid: boolean; | ||
/** | ||
@@ -53,6 +54,14 @@ * Returns the errors of this control. | ||
clearValidators(): void; | ||
markAsTouched(): void; | ||
markAsTouched({onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
markAsDirty({onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
markAsPristine({onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
markAsUntouched({onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
markAsPending({onlySelf}?: { | ||
@@ -62,2 +71,5 @@ onlySelf?: boolean; | ||
setParent(parent: FormGroup | FormArray): void; | ||
abstract setValue(value: any, options?: Object): void; | ||
abstract patchValue(value: any, options?: Object): void; | ||
abstract reset(value?: any, options?: Object): void; | ||
updateValueAndValidity({onlySelf, emitEvent}?: { | ||
@@ -98,3 +110,7 @@ onlySelf?: boolean; | ||
}): void; | ||
/** | ||
* @deprecated - use get() instead | ||
*/ | ||
find(path: Array<string | number> | string): AbstractControl; | ||
get(path: Array<string | number> | string): AbstractControl; | ||
getError(errorCode: string, path?: string[]): any; | ||
@@ -136,9 +152,35 @@ hasError(errorCode: string, path?: string[]): boolean; | ||
* specified. | ||
* | ||
* If `emitViewToModelChange` is `true`, an ngModelChange event will be fired to update the | ||
* model. This is the default behavior if `emitViewToModelChange` is not specified. | ||
*/ | ||
updateValue(value: any, {onlySelf, emitEvent, emitModelToViewChange}?: { | ||
setValue(value: any, {onlySelf, emitEvent, emitModelToViewChange, emitViewToModelChange}?: { | ||
onlySelf?: boolean; | ||
emitEvent?: boolean; | ||
emitModelToViewChange?: boolean; | ||
emitViewToModelChange?: boolean; | ||
}): void; | ||
/** | ||
* This function is functionally the same as updateValue() at this level. It exists for | ||
* symmetry with patchValue() on FormGroups and FormArrays, where it does behave differently. | ||
*/ | ||
patchValue(value: any, options?: { | ||
onlySelf?: boolean; | ||
emitEvent?: boolean; | ||
emitModelToViewChange?: boolean; | ||
emitViewToModelChange?: boolean; | ||
}): void; | ||
/** | ||
* @deprecated Please use setValue() instead. | ||
*/ | ||
updateValue(value: any, options?: { | ||
onlySelf?: boolean; | ||
emitEvent?: boolean; | ||
emitModelToViewChange?: boolean; | ||
emitViewToModelChange?: boolean; | ||
}): void; | ||
reset(value?: any, {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
/** | ||
* Register a listener for change events. | ||
@@ -198,2 +240,15 @@ */ | ||
contains(controlName: string): boolean; | ||
setValue(value: { | ||
[key: string]: any; | ||
}, {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
patchValue(value: { | ||
[key: string]: any; | ||
}, {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
reset(value?: any, {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
} | ||
@@ -247,2 +302,11 @@ /** | ||
readonly length: number; | ||
setValue(value: any[], {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
patchValue(value: any[], {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
reset(value?: any, {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
} |
@@ -8,5 +8,7 @@ /** | ||
*/ | ||
import { PromiseObservable } from 'rxjs/observable/PromiseObservable'; | ||
import { composeAsyncValidators, composeValidators } from './directives/shared'; | ||
import { EventEmitter, ObservableWrapper } from './facade/async'; | ||
import { EventEmitter } from './facade/async'; | ||
import { ListWrapper, StringMapWrapper } from './facade/collection'; | ||
import { BaseException } from './facade/exceptions'; | ||
import { isBlank, isPresent, isPromise, normalizeBool } from './facade/lang'; | ||
@@ -29,7 +31,7 @@ /** | ||
} | ||
function _find(control, path) { | ||
function _find(control, path, delimiter) { | ||
if (isBlank(path)) | ||
return null; | ||
if (!(path instanceof Array)) { | ||
path = path.split('/'); | ||
path = path.split(delimiter); | ||
} | ||
@@ -52,3 +54,3 @@ if (path instanceof Array && ListWrapper.isEmpty(path)) | ||
function toObservable(r) { | ||
return isPromise(r) ? ObservableWrapper.fromPromise(r) : r; | ||
return isPromise(r) ? PromiseObservable.create(r) : r; | ||
} | ||
@@ -74,2 +76,3 @@ function coerceToValidator(validator) { | ||
get valid() { return this._status === VALID; } | ||
get invalid() { return this._status === INVALID; } | ||
/** | ||
@@ -94,3 +97,9 @@ * Returns the errors of this control. | ||
clearValidators() { this.validator = null; } | ||
markAsTouched() { this._touched = true; } | ||
markAsTouched({ onlySelf } = {}) { | ||
onlySelf = normalizeBool(onlySelf); | ||
this._touched = true; | ||
if (isPresent(this._parent) && !onlySelf) { | ||
this._parent.markAsTouched({ onlySelf: onlySelf }); | ||
} | ||
} | ||
markAsDirty({ onlySelf } = {}) { | ||
@@ -103,2 +112,16 @@ onlySelf = normalizeBool(onlySelf); | ||
} | ||
markAsPristine({ onlySelf } = {}) { | ||
this._pristine = true; | ||
this._forEachChild((control) => { control.markAsPristine({ onlySelf: true }); }); | ||
if (isPresent(this._parent) && !onlySelf) { | ||
this._parent._updatePristine({ onlySelf: onlySelf }); | ||
} | ||
} | ||
markAsUntouched({ onlySelf } = {}) { | ||
this._touched = false; | ||
this._forEachChild((control) => { control.markAsUntouched({ onlySelf: true }); }); | ||
if (isPresent(this._parent) && !onlySelf) { | ||
this._parent._updateTouched({ onlySelf: onlySelf }); | ||
} | ||
} | ||
markAsPending({ onlySelf } = {}) { | ||
@@ -122,4 +145,4 @@ onlySelf = normalizeBool(onlySelf); | ||
if (emitEvent) { | ||
ObservableWrapper.callEmit(this._valueChanges, this._value); | ||
ObservableWrapper.callEmit(this._statusChanges, this._status); | ||
this._valueChanges.emit(this._value); | ||
this._statusChanges.emit(this._status); | ||
} | ||
@@ -138,3 +161,3 @@ if (isPresent(this._parent) && !onlySelf) { | ||
var obs = toObservable(this.asyncValidator(this)); | ||
this._asyncValidationSubscription = ObservableWrapper.subscribe(obs, (res) => this.setErrors(res, { emitEvent: emitEvent })); | ||
this._asyncValidationSubscription = obs.subscribe({ next: (res) => this.setErrors(res, { emitEvent: emitEvent }) }); | ||
} | ||
@@ -144,3 +167,3 @@ } | ||
if (isPresent(this._asyncValidationSubscription)) { | ||
ObservableWrapper.dispose(this._asyncValidationSubscription); | ||
this._asyncValidationSubscription.unsubscribe(); | ||
} | ||
@@ -176,3 +199,7 @@ } | ||
} | ||
find(path) { return _find(this, path); } | ||
/** | ||
* @deprecated - use get() instead | ||
*/ | ||
find(path) { return _find(this, path, '/'); } | ||
get(path) { return _find(this, path, '.'); } | ||
getError(errorCode, path = null) { | ||
@@ -201,3 +228,3 @@ var control = isPresent(path) && !ListWrapper.isEmpty(path) ? this.find(path) : this; | ||
if (emitEvent) { | ||
ObservableWrapper.callEmit(this._statusChanges, this._status); | ||
this._statusChanges.emit(this._status); | ||
} | ||
@@ -222,2 +249,28 @@ if (isPresent(this._parent)) { | ||
} | ||
/** @internal */ | ||
_anyControlsHaveStatus(status) { | ||
return this._anyControls((control) => control.status == status); | ||
} | ||
/** @internal */ | ||
_anyControlsDirty() { | ||
return this._anyControls((control) => control.dirty); | ||
} | ||
/** @internal */ | ||
_anyControlsTouched() { | ||
return this._anyControls((control) => control.touched); | ||
} | ||
/** @internal */ | ||
_updatePristine({ onlySelf } = {}) { | ||
this._pristine = !this._anyControlsDirty(); | ||
if (isPresent(this._parent) && !onlySelf) { | ||
this._parent._updatePristine({ onlySelf: onlySelf }); | ||
} | ||
} | ||
/** @internal */ | ||
_updateTouched({ onlySelf } = {}) { | ||
this._touched = this._anyControlsTouched(); | ||
if (isPresent(this._parent) && !onlySelf) { | ||
this._parent._updateTouched({ onlySelf: onlySelf }); | ||
} | ||
} | ||
} | ||
@@ -262,8 +315,12 @@ /** | ||
* specified. | ||
* | ||
* If `emitViewToModelChange` is `true`, an ngModelChange event will be fired to update the | ||
* model. This is the default behavior if `emitViewToModelChange` is not specified. | ||
*/ | ||
updateValue(value, { onlySelf, emitEvent, emitModelToViewChange } = {}) { | ||
setValue(value, { onlySelf, emitEvent, emitModelToViewChange, emitViewToModelChange } = {}) { | ||
emitModelToViewChange = isPresent(emitModelToViewChange) ? emitModelToViewChange : true; | ||
emitViewToModelChange = isPresent(emitViewToModelChange) ? emitViewToModelChange : true; | ||
this._value = value; | ||
if (this._onChange.length && emitModelToViewChange) { | ||
this._onChange.forEach((changeFn) => changeFn(this._value)); | ||
this._onChange.forEach((changeFn) => changeFn(this._value, emitViewToModelChange)); | ||
} | ||
@@ -273,2 +330,20 @@ this.updateValueAndValidity({ onlySelf: onlySelf, emitEvent: emitEvent }); | ||
/** | ||
* This function is functionally the same as updateValue() at this level. It exists for | ||
* symmetry with patchValue() on FormGroups and FormArrays, where it does behave differently. | ||
*/ | ||
patchValue(value, options = {}) { | ||
this.setValue(value, options); | ||
} | ||
/** | ||
* @deprecated Please use setValue() instead. | ||
*/ | ||
updateValue(value, options = {}) { | ||
this.setValue(value, options); | ||
} | ||
reset(value = null, { onlySelf } = {}) { | ||
this.markAsPristine({ onlySelf: onlySelf }); | ||
this.markAsUntouched({ onlySelf: onlySelf }); | ||
this.setValue(value, { onlySelf: onlySelf }); | ||
} | ||
/** | ||
* @internal | ||
@@ -280,3 +355,3 @@ */ | ||
*/ | ||
_anyControlsHaveStatus(status) { return false; } | ||
_anyControls(condition) { return false; } | ||
/** | ||
@@ -286,2 +361,6 @@ * Register a listener for change events. | ||
registerOnChange(fn) { this._onChange.push(fn); } | ||
/** | ||
* @internal | ||
*/ | ||
_forEachChild(cb) { } | ||
} | ||
@@ -358,5 +437,45 @@ /** | ||
} | ||
setValue(value, { onlySelf } = {}) { | ||
this._checkAllValuesPresent(value); | ||
StringMapWrapper.forEach(value, (newValue, name) => { | ||
this._throwIfControlMissing(name); | ||
this.controls[name].setValue(newValue, { onlySelf: true }); | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
} | ||
patchValue(value, { onlySelf } = {}) { | ||
StringMapWrapper.forEach(value, (newValue, name) => { | ||
if (this.controls[name]) { | ||
this.controls[name].patchValue(newValue, { onlySelf: true }); | ||
} | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
} | ||
reset(value = {}, { onlySelf } = {}) { | ||
this._forEachChild((control, name) => { | ||
control.reset(value[name], { onlySelf: true }); | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
this._updatePristine({ onlySelf: onlySelf }); | ||
this._updateTouched({ onlySelf: onlySelf }); | ||
} | ||
/** @internal */ | ||
_throwIfControlMissing(name) { | ||
if (!Object.keys(this.controls).length) { | ||
throw new BaseException(` | ||
There are no form controls registered with this group yet. If you're using ngModel, | ||
you may want to check next tick (e.g. use setTimeout). | ||
`); | ||
} | ||
if (!this.controls[name]) { | ||
throw new BaseException(`Cannot find form control with name: ${name}.`); | ||
} | ||
} | ||
/** @internal */ | ||
_forEachChild(cb) { | ||
StringMapWrapper.forEach(this.controls, cb); | ||
} | ||
/** @internal */ | ||
_setParentForControls() { | ||
StringMapWrapper.forEach(this.controls, (control, name) => { control.setParent(this); }); | ||
this._forEachChild((control, name) => { control.setParent(this); }); | ||
} | ||
@@ -366,6 +485,6 @@ /** @internal */ | ||
/** @internal */ | ||
_anyControlsHaveStatus(status) { | ||
_anyControls(condition) { | ||
var res = false; | ||
StringMapWrapper.forEach(this.controls, (control, name) => { | ||
res = res || (this.contains(name) && control.status == status); | ||
this._forEachChild((control, name) => { | ||
res = res || (this.contains(name) && condition(control)); | ||
}); | ||
@@ -384,3 +503,3 @@ return res; | ||
var res = initValue; | ||
StringMapWrapper.forEach(this.controls, (control, name) => { | ||
this._forEachChild((control, name) => { | ||
if (this._included(name)) { | ||
@@ -397,2 +516,10 @@ res = fn(res, control, name); | ||
} | ||
/** @internal */ | ||
_checkAllValuesPresent(value) { | ||
this._forEachChild((control, name) => { | ||
if (value[name] === undefined) { | ||
throw new BaseException(`Must supply a value for form control with name: '${name}'.`); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -462,13 +589,61 @@ /** | ||
get length() { return this.controls.length; } | ||
setValue(value, { onlySelf } = {}) { | ||
this._checkAllValuesPresent(value); | ||
value.forEach((newValue, index) => { | ||
this._throwIfControlMissing(index); | ||
this.at(index).setValue(newValue, { onlySelf: true }); | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
} | ||
patchValue(value, { onlySelf } = {}) { | ||
value.forEach((newValue, index) => { | ||
if (this.at(index)) { | ||
this.at(index).patchValue(newValue, { onlySelf: true }); | ||
} | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
} | ||
reset(value = [], { onlySelf } = {}) { | ||
this._forEachChild((control, index) => { | ||
control.reset(value[index], { onlySelf: true }); | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
this._updatePristine({ onlySelf: onlySelf }); | ||
this._updateTouched({ onlySelf: onlySelf }); | ||
} | ||
/** @internal */ | ||
_throwIfControlMissing(index) { | ||
if (!this.controls.length) { | ||
throw new BaseException(` | ||
There are no form controls registered with this array yet. If you're using ngModel, | ||
you may want to check next tick (e.g. use setTimeout). | ||
`); | ||
} | ||
if (!this.at(index)) { | ||
throw new BaseException(`Cannot find form control at index ${index}`); | ||
} | ||
} | ||
/** @internal */ | ||
_forEachChild(cb) { | ||
this.controls.forEach((control, index) => { cb(control, index); }); | ||
} | ||
/** @internal */ | ||
_updateValue() { this._value = this.controls.map((control) => control.value); } | ||
/** @internal */ | ||
_anyControlsHaveStatus(status) { | ||
return this.controls.some(c => c.status == status); | ||
_anyControls(condition) { | ||
return this.controls.some((control) => condition(control)); | ||
} | ||
/** @internal */ | ||
_setParentForControls() { | ||
this.controls.forEach((control) => { control.setParent(this); }); | ||
this._forEachChild((control) => { control.setParent(this); }); | ||
} | ||
/** @internal */ | ||
_checkAllValuesPresent(value) { | ||
this._forEachChild((control, i) => { | ||
if (value[i] === undefined) { | ||
throw new BaseException(`Must supply a value for form control at index: ${i}.`); | ||
} | ||
}); | ||
} | ||
} | ||
//# sourceMappingURL=model.js.map |
@@ -9,6 +9,5 @@ /** | ||
import { OpaqueToken } from '@angular/core'; | ||
import { ObservableWrapper } from './facade/async'; | ||
import { toPromise } from 'rxjs/operator/toPromise'; | ||
import { StringMapWrapper } from './facade/collection'; | ||
import { isBlank, isPresent, isPromise, isString } from './facade/lang'; | ||
import { PromiseWrapper } from './facade/promise'; | ||
/** | ||
@@ -35,4 +34,3 @@ * Providers for validators to be used for {@link FormControl}s in a form. | ||
*/ | ||
export const NG_ASYNC_VALIDATORS = | ||
/*@ts2dart_const*/ new OpaqueToken('NgAsyncValidators'); | ||
export const NG_ASYNC_VALIDATORS = new OpaqueToken('NgAsyncValidators'); | ||
/** | ||
@@ -126,3 +124,3 @@ * Provides a set of validators used by form controls. | ||
let promises = _executeAsyncValidators(control, presentValidators).map(_convertToPromise); | ||
return PromiseWrapper.all(promises).then(_mergeErrors); | ||
return Promise.all(promises).then(_mergeErrors); | ||
}; | ||
@@ -132,3 +130,3 @@ } | ||
function _convertToPromise(obj) { | ||
return isPromise(obj) ? obj : ObservableWrapper.toPromise(obj); | ||
return isPromise(obj) ? obj : toPromise.call(obj); | ||
} | ||
@@ -135,0 +133,0 @@ function _executeValidators(control, validators) { |
{ | ||
"name": "@angular/forms", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "", | ||
@@ -11,5 +11,5 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"@angular/core": "^2.0.0-rc.4", | ||
"@angular/common": "^2.0.0-rc.4", | ||
"@angular/compiler": "^2.0.0-rc.4" | ||
"@angular/core": "^2.0.0-rc.5", | ||
"@angular/common": "^2.0.0-rc.5", | ||
"@angular/compiler": "^2.0.0-rc.5" | ||
}, | ||
@@ -16,0 +16,0 @@ "repository": { |
@@ -19,10 +19,12 @@ /** | ||
export { RadioControlValueAccessor } from './directives/radio_control_value_accessor'; | ||
export { FormArrayName } from './directives/reactive_directives/form_array_name'; | ||
export { FormControlDirective } from './directives/reactive_directives/form_control_directive'; | ||
export { FormControlName } from './directives/reactive_directives/form_control_name'; | ||
export { FormGroupDirective } from './directives/reactive_directives/form_group_directive'; | ||
export { FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
export { FormArrayName, FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
export { NgSelectOption, SelectControlValueAccessor } from './directives/select_control_value_accessor'; | ||
export { NgSelectMultipleOption, SelectMultipleControlValueAccessor } from './directives/select_multiple_control_value_accessor'; | ||
export { MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator } from './directives/validators'; | ||
export declare const SHARED_FORM_DIRECTIVES: Type[]; | ||
export declare const TEMPLATE_DRIVEN_DIRECTIVES: Type[]; | ||
export declare const REACTIVE_DRIVEN_DIRECTIVES: Type[]; | ||
/** | ||
@@ -45,6 +47,11 @@ * | ||
*/ | ||
export declare const FORM_DIRECTIVES: Type[]; | ||
export declare const FORM_DIRECTIVES: Type[][]; | ||
/** | ||
* @experimental | ||
*/ | ||
export declare const REACTIVE_FORM_DIRECTIVES: Type[]; | ||
export declare const REACTIVE_FORM_DIRECTIVES: Type[][]; | ||
/** | ||
* Internal module used for sharing directives between FormsModule and ReactiveFormsModule | ||
*/ | ||
export declare class InternalFormsSharedModule { | ||
} |
@@ -9,2 +9,3 @@ /** | ||
"use strict"; | ||
var core_1 = require('@angular/core'); | ||
var checkbox_value_accessor_1 = require('./directives/checkbox_value_accessor'); | ||
@@ -18,3 +19,2 @@ var default_value_accessor_1 = require('./directives/default_value_accessor'); | ||
var radio_control_value_accessor_1 = require('./directives/radio_control_value_accessor'); | ||
var form_array_name_1 = require('./directives/reactive_directives/form_array_name'); | ||
var form_control_directive_1 = require('./directives/reactive_directives/form_control_directive'); | ||
@@ -45,4 +45,2 @@ var form_control_name_1 = require('./directives/reactive_directives/form_control_name'); | ||
exports.RadioControlValueAccessor = radio_control_value_accessor_2.RadioControlValueAccessor; | ||
var form_array_name_2 = require('./directives/reactive_directives/form_array_name'); | ||
exports.FormArrayName = form_array_name_2.FormArrayName; | ||
var form_control_directive_2 = require('./directives/reactive_directives/form_control_directive'); | ||
@@ -55,2 +53,3 @@ exports.FormControlDirective = form_control_directive_2.FormControlDirective; | ||
var form_group_name_2 = require('./directives/reactive_directives/form_group_name'); | ||
exports.FormArrayName = form_group_name_2.FormArrayName; | ||
exports.FormGroupName = form_group_name_2.FormGroupName; | ||
@@ -68,2 +67,10 @@ var select_control_value_accessor_2 = require('./directives/select_control_value_accessor'); | ||
exports.RequiredValidator = validators_2.RequiredValidator; | ||
exports.SHARED_FORM_DIRECTIVES = [ | ||
select_control_value_accessor_1.NgSelectOption, select_multiple_control_value_accessor_1.NgSelectMultipleOption, default_value_accessor_1.DefaultValueAccessor, number_value_accessor_1.NumberValueAccessor, | ||
checkbox_value_accessor_1.CheckboxControlValueAccessor, select_control_value_accessor_1.SelectControlValueAccessor, select_multiple_control_value_accessor_1.SelectMultipleControlValueAccessor, | ||
radio_control_value_accessor_1.RadioControlValueAccessor, ng_control_status_1.NgControlStatus, validators_1.RequiredValidator, validators_1.MinLengthValidator, | ||
validators_1.MaxLengthValidator, validators_1.PatternValidator | ||
]; | ||
exports.TEMPLATE_DRIVEN_DIRECTIVES = [ng_model_1.NgModel, ng_model_group_1.NgModelGroup, ng_form_1.NgForm]; | ||
exports.REACTIVE_DRIVEN_DIRECTIVES = [form_control_directive_1.FormControlDirective, form_group_directive_1.FormGroupDirective, form_control_name_1.FormControlName, form_group_name_1.FormGroupName, form_group_name_1.FormArrayName]; | ||
/** | ||
@@ -86,16 +93,17 @@ * | ||
*/ | ||
exports.FORM_DIRECTIVES = [ | ||
ng_model_1.NgModel, ng_model_group_1.NgModelGroup, ng_form_1.NgForm, | ||
select_control_value_accessor_1.NgSelectOption, select_multiple_control_value_accessor_1.NgSelectMultipleOption, default_value_accessor_1.DefaultValueAccessor, number_value_accessor_1.NumberValueAccessor, | ||
checkbox_value_accessor_1.CheckboxControlValueAccessor, select_control_value_accessor_1.SelectControlValueAccessor, select_multiple_control_value_accessor_1.SelectMultipleControlValueAccessor, | ||
radio_control_value_accessor_1.RadioControlValueAccessor, ng_control_status_1.NgControlStatus, | ||
validators_1.RequiredValidator, validators_1.MinLengthValidator, validators_1.MaxLengthValidator, validators_1.PatternValidator | ||
]; | ||
exports.FORM_DIRECTIVES = [exports.TEMPLATE_DRIVEN_DIRECTIVES, exports.SHARED_FORM_DIRECTIVES]; | ||
/** | ||
* @experimental | ||
*/ | ||
exports.REACTIVE_FORM_DIRECTIVES = | ||
/*@ts2dart_const*/ [ | ||
form_control_directive_1.FormControlDirective, form_group_directive_1.FormGroupDirective, form_control_name_1.FormControlName, form_group_name_1.FormGroupName, form_array_name_1.FormArrayName | ||
]; | ||
exports.REACTIVE_FORM_DIRECTIVES = [exports.REACTIVE_DRIVEN_DIRECTIVES, exports.SHARED_FORM_DIRECTIVES]; | ||
var InternalFormsSharedModule = (function () { | ||
function InternalFormsSharedModule() { | ||
} | ||
/** @nocollapse */ | ||
InternalFormsSharedModule.decorators = [ | ||
{ type: core_1.NgModule, args: [{ declarations: exports.SHARED_FORM_DIRECTIVES, exports: exports.SHARED_FORM_DIRECTIVES },] }, | ||
]; | ||
return InternalFormsSharedModule; | ||
}()); | ||
exports.InternalFormsSharedModule = InternalFormsSharedModule; | ||
//# sourceMappingURL=directives.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"FORM_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/ng_model","name":"NgModel"},{"__symbolic":"reference","module":"./directives/ng_model_group","name":"NgModelGroup"},{"__symbolic":"reference","module":"./directives/ng_form","name":"NgForm"},{"__symbolic":"reference","module":"./directives/select_control_value_accessor","name":"NgSelectOption"},{"__symbolic":"reference","module":"./directives/select_multiple_control_value_accessor","name":"NgSelectMultipleOption"},{"__symbolic":"reference","module":"./directives/default_value_accessor","name":"DefaultValueAccessor"},{"__symbolic":"reference","module":"./directives/number_value_accessor","name":"NumberValueAccessor"},{"__symbolic":"reference","module":"./directives/checkbox_value_accessor","name":"CheckboxControlValueAccessor"},{"__symbolic":"reference","module":"./directives/select_control_value_accessor","name":"SelectControlValueAccessor"},{"__symbolic":"reference","module":"./directives/select_multiple_control_value_accessor","name":"SelectMultipleControlValueAccessor"},{"__symbolic":"reference","module":"./directives/radio_control_value_accessor","name":"RadioControlValueAccessor"},{"__symbolic":"reference","module":"./directives/ng_control_status","name":"NgControlStatus"},{"__symbolic":"reference","module":"./directives/validators","name":"RequiredValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"MinLengthValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"MaxLengthValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"PatternValidator"}],"REACTIVE_FORM_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/reactive_directives/form_control_directive","name":"FormControlDirective"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_group_directive","name":"FormGroupDirective"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_control_name","name":"FormControlName"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_group_name","name":"FormGroupName"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_array_name","name":"FormArrayName"}]}} | ||
{"__symbolic":"module","version":1,"metadata":{"SHARED_FORM_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/select_control_value_accessor","name":"NgSelectOption"},{"__symbolic":"reference","module":"./directives/select_multiple_control_value_accessor","name":"NgSelectMultipleOption"},{"__symbolic":"reference","module":"./directives/default_value_accessor","name":"DefaultValueAccessor"},{"__symbolic":"reference","module":"./directives/number_value_accessor","name":"NumberValueAccessor"},{"__symbolic":"reference","module":"./directives/checkbox_value_accessor","name":"CheckboxControlValueAccessor"},{"__symbolic":"reference","module":"./directives/select_control_value_accessor","name":"SelectControlValueAccessor"},{"__symbolic":"reference","module":"./directives/select_multiple_control_value_accessor","name":"SelectMultipleControlValueAccessor"},{"__symbolic":"reference","module":"./directives/radio_control_value_accessor","name":"RadioControlValueAccessor"},{"__symbolic":"reference","module":"./directives/ng_control_status","name":"NgControlStatus"},{"__symbolic":"reference","module":"./directives/validators","name":"RequiredValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"MinLengthValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"MaxLengthValidator"},{"__symbolic":"reference","module":"./directives/validators","name":"PatternValidator"}],"TEMPLATE_DRIVEN_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/ng_model","name":"NgModel"},{"__symbolic":"reference","module":"./directives/ng_model_group","name":"NgModelGroup"},{"__symbolic":"reference","module":"./directives/ng_form","name":"NgForm"}],"REACTIVE_DRIVEN_DIRECTIVES":[{"__symbolic":"reference","module":"./directives/reactive_directives/form_control_directive","name":"FormControlDirective"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_group_directive","name":"FormGroupDirective"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_control_name","name":"FormControlName"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_group_name","name":"FormGroupName"},{"__symbolic":"reference","module":"./directives/reactive_directives/form_group_name","name":"FormArrayName"}],"FORM_DIRECTIVES":[{"__symbolic":"reference","name":"TEMPLATE_DRIVEN_DIRECTIVES"},{"__symbolic":"reference","name":"SHARED_FORM_DIRECTIVES"}],"REACTIVE_FORM_DIRECTIVES":[{"__symbolic":"reference","name":"REACTIVE_DRIVEN_DIRECTIVES"},{"__symbolic":"reference","name":"SHARED_FORM_DIRECTIVES"}],"InternalFormsSharedModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":{"__symbolic":"reference","name":"SHARED_FORM_DIRECTIVES"},"exports":{"__symbolic":"reference","name":"SHARED_FORM_DIRECTIVES"}}]}]}},"exports":[{"from":"./directives/checkbox_value_accessor","export":["CheckboxControlValueAccessor"]},{"from":"./directives/control_value_accessor","export":["ControlValueAccessor"]},{"from":"./directives/default_value_accessor","export":["DefaultValueAccessor"]},{"from":"./directives/ng_control","export":["NgControl"]},{"from":"./directives/ng_control_status","export":["NgControlStatus"]},{"from":"./directives/ng_form","export":["NgForm"]},{"from":"./directives/ng_model","export":["NgModel"]},{"from":"./directives/ng_model_group","export":["NgModelGroup"]},{"from":"./directives/number_value_accessor","export":["NumberValueAccessor"]},{"from":"./directives/radio_control_value_accessor","export":["RadioControlValueAccessor"]},{"from":"./directives/reactive_directives/form_control_directive","export":["FormControlDirective"]},{"from":"./directives/reactive_directives/form_control_name","export":["FormControlName"]},{"from":"./directives/reactive_directives/form_group_directive","export":["FormGroupDirective"]},{"from":"./directives/reactive_directives/form_group_name","export":["FormArrayName","FormGroupName"]},{"from":"./directives/select_control_value_accessor","export":["NgSelectOption","SelectControlValueAccessor"]},{"from":"./directives/select_multiple_control_value_accessor","export":["NgSelectMultipleOption","SelectMultipleControlValueAccessor"]},{"from":"./directives/validators","export":["MaxLengthValidator","MinLengthValidator","PatternValidator","RequiredValidator"]}]} |
@@ -21,2 +21,4 @@ /** | ||
valid: boolean; | ||
invalid: boolean; | ||
pending: boolean; | ||
errors: { | ||
@@ -32,2 +34,3 @@ [key: string]: any; | ||
path: string[]; | ||
reset(value?: any): void; | ||
} |
@@ -36,2 +36,12 @@ /** | ||
}); | ||
Object.defineProperty(AbstractControlDirective.prototype, "invalid", { | ||
get: function () { return lang_1.isPresent(this.control) ? this.control.invalid : null; }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(AbstractControlDirective.prototype, "pending", { | ||
get: function () { return lang_1.isPresent(this.control) ? this.control.pending : null; }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(AbstractControlDirective.prototype, "errors", { | ||
@@ -83,2 +93,7 @@ get: function () { | ||
}); | ||
AbstractControlDirective.prototype.reset = function (value) { | ||
if (value === void 0) { value = undefined; } | ||
if (lang_1.isPresent(this.control)) | ||
this.control.reset(value); | ||
}; | ||
return AbstractControlDirective; | ||
@@ -85,0 +100,0 @@ }()); |
@@ -14,3 +14,5 @@ /** | ||
/** | ||
This is a base class for code shared between {@link NgModelGroup} and {@link FormGroupName}. | ||
* This is a base class for code shared between {@link NgModelGroup} and {@link FormGroupName}. | ||
* | ||
* @experimental | ||
*/ | ||
@@ -17,0 +19,0 @@ export declare class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy { |
@@ -17,3 +17,5 @@ /** | ||
/** | ||
This is a base class for code shared between {@link NgModelGroup} and {@link FormGroupName}. | ||
* This is a base class for code shared between {@link NgModelGroup} and {@link FormGroupName}. | ||
* | ||
* @experimental | ||
*/ | ||
@@ -25,3 +27,6 @@ var AbstractFormGroupDirective = (function (_super) { | ||
} | ||
AbstractFormGroupDirective.prototype.ngOnInit = function () { this.formDirective.addFormGroup(this); }; | ||
AbstractFormGroupDirective.prototype.ngOnInit = function () { | ||
this._checkParentType(); | ||
this.formDirective.addFormGroup(this); | ||
}; | ||
AbstractFormGroupDirective.prototype.ngOnDestroy = function () { this.formDirective.removeFormGroup(this); }; | ||
@@ -62,2 +67,4 @@ Object.defineProperty(AbstractFormGroupDirective.prototype, "control", { | ||
}); | ||
/** @internal */ | ||
AbstractFormGroupDirective.prototype._checkParentType = function () { }; | ||
return AbstractFormGroupDirective; | ||
@@ -64,0 +71,0 @@ }(control_container_1.ControlContainer)); |
@@ -16,4 +16,3 @@ /** | ||
*/ | ||
exports.NG_VALUE_ACCESSOR = | ||
/*@ts2dart_const*/ new core_1.OpaqueToken('NgValueAccessor'); | ||
exports.NG_VALUE_ACCESSOR = new core_1.OpaqueToken('NgValueAccessor'); | ||
//# sourceMappingURL=control_value_accessor.js.map |
@@ -12,4 +12,3 @@ /** | ||
var control_value_accessor_1 = require('./control_value_accessor'); | ||
exports.DEFAULT_VALUE_ACCESSOR = | ||
/* @ts2dart_Provider */ { | ||
exports.DEFAULT_VALUE_ACCESSOR = { | ||
provide: control_value_accessor_1.NG_VALUE_ACCESSOR, | ||
@@ -16,0 +15,0 @@ useExisting: core_1.forwardRef(function () { return DefaultValueAccessor; }), |
@@ -15,3 +15,3 @@ import { EventEmitter } from '../facade/async'; | ||
* | ||
* Include `FORM_DIRECTIVES` in the `directives` section of a {@link View} annotation | ||
* Include `FORM_DIRECTIVES` in the `directives` section of a {@link Component} annotation | ||
* to use `NgForm` and its associated controls. | ||
@@ -88,3 +88,7 @@ * | ||
updateModel(dir: NgControl, value: any): void; | ||
setValue(value: { | ||
[key: string]: any; | ||
}): void; | ||
onSubmit(): boolean; | ||
onReset(): void; | ||
} |
@@ -22,4 +22,7 @@ /** | ||
var shared_1 = require('./shared'); | ||
exports.formDirectiveProvider = | ||
/*@ts2dart_const*/ { provide: control_container_1.ControlContainer, useExisting: core_1.forwardRef(function () { return NgForm; }) }; | ||
exports.formDirectiveProvider = { | ||
provide: control_container_1.ControlContainer, | ||
useExisting: core_1.forwardRef(function () { return NgForm; }) | ||
}; | ||
var resolvedPromise = Promise.resolve(null); | ||
var NgForm = (function (_super) { | ||
@@ -60,3 +63,3 @@ __extends(NgForm, _super); | ||
var _this = this; | ||
async_1.PromiseWrapper.scheduleMicrotask(function () { | ||
resolvedPromise.then(function () { | ||
var container = _this._findContainer(dir.path); | ||
@@ -68,6 +71,6 @@ dir._control = container.registerControl(dir.name, dir.control); | ||
}; | ||
NgForm.prototype.getControl = function (dir) { return this.form.find(dir.path); }; | ||
NgForm.prototype.getControl = function (dir) { return this.form.get(dir.path); }; | ||
NgForm.prototype.removeControl = function (dir) { | ||
var _this = this; | ||
async_1.PromiseWrapper.scheduleMicrotask(function () { | ||
resolvedPromise.then(function () { | ||
var container = _this._findContainer(dir.path); | ||
@@ -81,3 +84,3 @@ if (lang_1.isPresent(container)) { | ||
var _this = this; | ||
async_1.PromiseWrapper.scheduleMicrotask(function () { | ||
resolvedPromise.then(function () { | ||
var container = _this._findContainer(dir.path); | ||
@@ -92,3 +95,3 @@ var group = new model_1.FormGroup({}); | ||
var _this = this; | ||
async_1.PromiseWrapper.scheduleMicrotask(function () { | ||
resolvedPromise.then(function () { | ||
var container = _this._findContainer(dir.path); | ||
@@ -100,19 +103,21 @@ if (lang_1.isPresent(container)) { | ||
}; | ||
NgForm.prototype.getFormGroup = function (dir) { return this.form.find(dir.path); }; | ||
NgForm.prototype.getFormGroup = function (dir) { return this.form.get(dir.path); }; | ||
NgForm.prototype.updateModel = function (dir, value) { | ||
var _this = this; | ||
async_1.PromiseWrapper.scheduleMicrotask(function () { | ||
var ctrl = _this.form.find(dir.path); | ||
ctrl.updateValue(value); | ||
resolvedPromise.then(function () { | ||
var ctrl = _this.form.get(dir.path); | ||
ctrl.setValue(value); | ||
}); | ||
}; | ||
NgForm.prototype.setValue = function (value) { this.control.setValue(value); }; | ||
NgForm.prototype.onSubmit = function () { | ||
this._submitted = true; | ||
async_1.ObservableWrapper.callEmit(this.ngSubmit, null); | ||
this.ngSubmit.emit(null); | ||
return false; | ||
}; | ||
NgForm.prototype.onReset = function () { this.form.reset(); }; | ||
/** @internal */ | ||
NgForm.prototype._findContainer = function (path) { | ||
path.pop(); | ||
return collection_1.ListWrapper.isEmpty(path) ? this.form : this.form.find(path); | ||
return collection_1.ListWrapper.isEmpty(path) ? this.form : this.form.get(path); | ||
}; | ||
@@ -124,5 +129,3 @@ /** @nocollapse */ | ||
providers: [exports.formDirectiveProvider], | ||
host: { | ||
'(submit)': 'onSubmit()', | ||
}, | ||
host: { '(submit)': 'onSubmit()', '(reset)': 'onReset()' }, | ||
outputs: ['ngSubmit'], | ||
@@ -129,0 +132,0 @@ exportAs: 'ngForm' |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"formDirectiveProvider":{"provide":{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"NgForm"}},"NgForm":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]","providers":[{"__symbolic":"reference","name":"formDirectiveProvider"}],"host":{"(submit)":"onSubmit()"},"outputs":["ngSubmit"],"exportAs":"ngForm"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"addControl":[{"__symbolic":"method"}],"getControl":[{"__symbolic":"method"}],"removeControl":[{"__symbolic":"method"}],"addFormGroup":[{"__symbolic":"method"}],"removeFormGroup":[{"__symbolic":"method"}],"getFormGroup":[{"__symbolic":"method"}],"updateModel":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"_findContainer":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"formDirectiveProvider":{"provide":{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"NgForm"}},"NgForm":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]","providers":[{"__symbolic":"reference","name":"formDirectiveProvider"}],"host":{"(submit)":"onSubmit()","(reset)":"onReset()"},"outputs":["ngSubmit"],"exportAs":"ngForm"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"addControl":[{"__symbolic":"method"}],"getControl":[{"__symbolic":"method"}],"removeControl":[{"__symbolic":"method"}],"addFormGroup":[{"__symbolic":"method"}],"removeFormGroup":[{"__symbolic":"method"}],"getFormGroup":[{"__symbolic":"method"}],"updateModel":[{"__symbolic":"method"}],"setValue":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"onReset":[{"__symbolic":"method"}],"_findContainer":[{"__symbolic":"method"}]}}}} |
@@ -18,4 +18,5 @@ /** | ||
var control_container_1 = require('./control_container'); | ||
exports.modelGroupProvider = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
var ng_form_1 = require('./ng_form'); | ||
var template_driven_errors_1 = require('./template_driven_errors'); | ||
exports.modelGroupProvider = { | ||
provide: control_container_1.ControlContainer, | ||
@@ -32,2 +33,8 @@ useExisting: core_1.forwardRef(function () { return NgModelGroup; }) | ||
} | ||
/** @internal */ | ||
NgModelGroup.prototype._checkParentType = function () { | ||
if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof ng_form_1.NgForm)) { | ||
template_driven_errors_1.TemplateDrivenErrors.modelGroupParentException(); | ||
} | ||
}; | ||
/** @nocollapse */ | ||
@@ -34,0 +41,0 @@ NgModelGroup.decorators = [ |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"modelGroupProvider":{"provide":{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"NgModelGroup"}},"NgModelGroup":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ngModelGroup]","providers":[{"__symbolic":"reference","name":"modelGroupProvider"}],"exportAs":"ngModelGroup"}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModelGroup"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"modelGroupProvider":{"provide":{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"NgModelGroup"}},"NgModelGroup":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ngModelGroup]","providers":[{"__symbolic":"reference","name":"modelGroupProvider"}],"exportAs":"ngModelGroup"}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModelGroup"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"_checkParentType":[{"__symbolic":"method"}]}}}} |
@@ -62,4 +62,6 @@ /** | ||
private _setUpStandalone(); | ||
private _checkForErrors(); | ||
private _checkParentType(); | ||
private _checkName(); | ||
private _updateValue(value); | ||
} |
@@ -16,14 +16,17 @@ /** | ||
var async_1 = require('../facade/async'); | ||
var exceptions_1 = require('../facade/exceptions'); | ||
var model_1 = require('../model'); | ||
var validators_1 = require('../validators'); | ||
var abstract_form_group_directive_1 = require('./abstract_form_group_directive'); | ||
var control_container_1 = require('./control_container'); | ||
var control_value_accessor_1 = require('./control_value_accessor'); | ||
var ng_control_1 = require('./ng_control'); | ||
var ng_form_1 = require('./ng_form'); | ||
var ng_model_group_1 = require('./ng_model_group'); | ||
var shared_1 = require('./shared'); | ||
exports.formControlBinding = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
var template_driven_errors_1 = require('./template_driven_errors'); | ||
exports.formControlBinding = { | ||
provide: ng_control_1.NgControl, | ||
useExisting: core_1.forwardRef(function () { return NgModel; }) | ||
}; | ||
var resolvedPromise = Promise.resolve(null); | ||
var NgModel = (function (_super) { | ||
@@ -44,3 +47,3 @@ __extends(NgModel, _super); | ||
NgModel.prototype.ngOnChanges = function (changes) { | ||
this._checkName(); | ||
this._checkForErrors(); | ||
if (!this._registered) | ||
@@ -61,3 +64,3 @@ this._setUpControl(); | ||
get: function () { | ||
return this._parent ? shared_1.controlPath(this.name, this._parent) : []; | ||
return this._parent ? shared_1.controlPath(this.name, this._parent) : [this.name]; | ||
}, | ||
@@ -86,3 +89,3 @@ enumerable: true, | ||
this.viewModel = newValue; | ||
async_1.ObservableWrapper.callEmit(this.update, newValue); | ||
this.update.emit(newValue); | ||
}; | ||
@@ -101,2 +104,17 @@ NgModel.prototype._setUpControl = function () { | ||
}; | ||
NgModel.prototype._checkForErrors = function () { | ||
if (!this._isStandalone()) { | ||
this._checkParentType(); | ||
} | ||
this._checkName(); | ||
}; | ||
NgModel.prototype._checkParentType = function () { | ||
if (!(this._parent instanceof ng_model_group_1.NgModelGroup) && | ||
this._parent instanceof abstract_form_group_directive_1.AbstractFormGroupDirective) { | ||
template_driven_errors_1.TemplateDrivenErrors.formGroupNameException(); | ||
} | ||
else if (!(this._parent instanceof ng_model_group_1.NgModelGroup) && !(this._parent instanceof ng_form_1.NgForm)) { | ||
template_driven_errors_1.TemplateDrivenErrors.modelParentException(); | ||
} | ||
}; | ||
NgModel.prototype._checkName = function () { | ||
@@ -106,3 +124,3 @@ if (this.options && this.options.name) | ||
if (!this._isStandalone() && !this.name) { | ||
throw new exceptions_1.BaseException("If ngModel is used within a form tag, either the name attribute must be set\n or the form control must be defined as 'standalone' in ngModelOptions.\n\n Example 1: <input [(ngModel)]=\"person.firstName\" name=\"first\">\n Example 2: <input [(ngModel)]=\"person.firstName\" [ngModelOptions]=\"{standalone: true}\">\n "); | ||
template_driven_errors_1.TemplateDrivenErrors.missingNameException(); | ||
} | ||
@@ -112,3 +130,3 @@ }; | ||
var _this = this; | ||
async_1.PromiseWrapper.scheduleMicrotask(function () { _this.control.updateValue(value); }); | ||
resolvedPromise.then(function () { _this.control.setValue(value, { emitViewToModelChange: false }); }); | ||
}; | ||
@@ -115,0 +133,0 @@ /** @nocollapse */ |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"formControlBinding":{"provide":{"__symbolic":"reference","module":"./ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"NgModel"}},"NgModel":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ngModel]:not([formControlName]):not([formControl])","providers":[{"__symbolic":"reference","name":"formControlBinding"}],"exportAs":"ngModel"}]}],"members":{"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModelOptions"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_setUpControl":[{"__symbolic":"method"}],"_isStandalone":[{"__symbolic":"method"}],"_setUpStandalone":[{"__symbolic":"method"}],"_checkName":[{"__symbolic":"method"}],"_updateValue":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"formControlBinding":{"provide":{"__symbolic":"reference","module":"./ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"NgModel"}},"NgModel":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ngModel]:not([formControlName]):not([formControl])","providers":[{"__symbolic":"reference","name":"formControlBinding"}],"exportAs":"ngModel"}]}],"members":{"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModelOptions"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_setUpControl":[{"__symbolic":"method"}],"_isStandalone":[{"__symbolic":"method"}],"_setUpStandalone":[{"__symbolic":"method"}],"_checkForErrors":[{"__symbolic":"method"}],"_checkParentType":[{"__symbolic":"method"}],"_checkName":[{"__symbolic":"method"}],"_updateValue":[{"__symbolic":"method"}]}}}} |
@@ -25,3 +25,5 @@ /** | ||
NumberValueAccessor.prototype.writeValue = function (value) { | ||
this._renderer.setElementProperty(this._elementRef.nativeElement, 'value', value); | ||
// The value needs to be normalized for IE9, otherwise it is set to 'null' when null | ||
var normalizedValue = lang_1.isBlank(value) ? '' : value; | ||
this._renderer.setElementProperty(this._elementRef.nativeElement, 'value', normalizedValue); | ||
}; | ||
@@ -28,0 +30,0 @@ NumberValueAccessor.prototype.registerOnChange = function (fn) { |
@@ -21,4 +21,3 @@ /** | ||
var shared_1 = require('../shared'); | ||
exports.formControlBinding = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
exports.formControlBinding = { | ||
provide: ng_control_1.NgControl, | ||
@@ -42,3 +41,3 @@ useExisting: core_1.forwardRef(function () { return FormControlDirective; }) | ||
if (shared_1.isPropertyUpdated(changes, this.viewModel)) { | ||
this.form.updateValue(this.model); | ||
this.form.setValue(this.model); | ||
this.viewModel = this.model; | ||
@@ -71,3 +70,3 @@ } | ||
this.viewModel = newValue; | ||
async_1.ObservableWrapper.callEmit(this.update, newValue); | ||
this.update.emit(newValue); | ||
}; | ||
@@ -74,0 +73,0 @@ FormControlDirective.prototype._isControlChanged = function (changes) { |
@@ -101,2 +101,3 @@ /** | ||
control: FormControl; | ||
private _checkParentType(); | ||
} |
@@ -17,8 +17,11 @@ /** | ||
var validators_1 = require('../../validators'); | ||
var abstract_form_group_directive_1 = require('../abstract_form_group_directive'); | ||
var control_container_1 = require('../control_container'); | ||
var control_value_accessor_1 = require('../control_value_accessor'); | ||
var ng_control_1 = require('../ng_control'); | ||
var reactive_errors_1 = require('../reactive_errors'); | ||
var shared_1 = require('../shared'); | ||
exports.controlNameBinding = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
var form_group_directive_1 = require('./form_group_directive'); | ||
var form_group_name_1 = require('./form_group_name'); | ||
exports.controlNameBinding = { | ||
provide: ng_control_1.NgControl, | ||
@@ -40,2 +43,3 @@ useExisting: core_1.forwardRef(function () { return FormControlName; }) | ||
if (!this._added) { | ||
this._checkParentType(); | ||
this.formDirective.addControl(this); | ||
@@ -52,3 +56,3 @@ this._added = true; | ||
this.viewModel = newValue; | ||
async_1.ObservableWrapper.callEmit(this.update, newValue); | ||
this.update.emit(newValue); | ||
}; | ||
@@ -82,2 +86,13 @@ Object.defineProperty(FormControlName.prototype, "path", { | ||
}); | ||
FormControlName.prototype._checkParentType = function () { | ||
if (!(this._parent instanceof form_group_name_1.FormGroupName) && | ||
this._parent instanceof abstract_form_group_directive_1.AbstractFormGroupDirective) { | ||
reactive_errors_1.ReactiveErrors.ngModelGroupException(); | ||
} | ||
else if (!(this._parent instanceof form_group_name_1.FormGroupName) && | ||
!(this._parent instanceof form_group_directive_1.FormGroupDirective) && | ||
!(this._parent instanceof form_group_name_1.FormArrayName)) { | ||
reactive_errors_1.ReactiveErrors.controlParentException(); | ||
} | ||
}; | ||
/** @nocollapse */ | ||
@@ -89,3 +104,3 @@ FormControlName.decorators = [ | ||
FormControlName.ctorParameters = [ | ||
{ type: control_container_1.ControlContainer, decorators: [{ type: core_1.Host }, { type: core_1.SkipSelf },] }, | ||
{ type: control_container_1.ControlContainer, decorators: [{ type: core_1.Optional }, { type: core_1.Host }, { type: core_1.SkipSelf },] }, | ||
{ type: Array, decorators: [{ type: core_1.Optional }, { type: core_1.Self }, { type: core_1.Inject, args: [validators_1.NG_VALIDATORS,] },] }, | ||
@@ -92,0 +107,0 @@ { type: Array, decorators: [{ type: core_1.Optional }, { type: core_1.Self }, { type: core_1.Inject, args: [validators_1.NG_ASYNC_VALIDATORS,] },] }, |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"controlNameBinding":{"provide":{"__symbolic":"reference","module":"../ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"FormControlName"}},"FormControlName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formControlName]","providers":[{"__symbolic":"reference","name":"controlNameBinding"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formControlName"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"controlNameBinding":{"provide":{"__symbolic":"reference","module":"../ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"FormControlName"}},"FormControlName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formControlName]","providers":[{"__symbolic":"reference","name":"controlNameBinding"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formControlName"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_checkParentType":[{"__symbolic":"method"}]}}}} |
@@ -14,4 +14,3 @@ /** | ||
import { NgControl } from '../ng_control'; | ||
import { FormArrayName } from './form_array_name'; | ||
import { FormGroupName } from './form_group_name'; | ||
import { FormArrayName, FormGroupName } from './form_group_name'; | ||
export declare const formDirectiveProvider: any; | ||
@@ -116,3 +115,4 @@ /** | ||
onSubmit(): boolean; | ||
onReset(): void; | ||
private _checkFormPresent(); | ||
} |
@@ -17,9 +17,8 @@ /** | ||
var collection_1 = require('../../facade/collection'); | ||
var exceptions_1 = require('../../facade/exceptions'); | ||
var lang_1 = require('../../facade/lang'); | ||
var validators_1 = require('../../validators'); | ||
var control_container_1 = require('../control_container'); | ||
var reactive_errors_1 = require('../reactive_errors'); | ||
var shared_1 = require('../shared'); | ||
exports.formDirectiveProvider = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
exports.formDirectiveProvider = { | ||
provide: control_container_1.ControlContainer, | ||
@@ -71,3 +70,3 @@ useExisting: core_1.forwardRef(function () { return FormGroupDirective; }) | ||
FormGroupDirective.prototype.addControl = function (dir) { | ||
var ctrl = this.form.find(dir.path); | ||
var ctrl = this.form.get(dir.path); | ||
shared_1.setUpControl(ctrl, dir); | ||
@@ -77,6 +76,6 @@ ctrl.updateValueAndValidity({ emitEvent: false }); | ||
}; | ||
FormGroupDirective.prototype.getControl = function (dir) { return this.form.find(dir.path); }; | ||
FormGroupDirective.prototype.getControl = function (dir) { return this.form.get(dir.path); }; | ||
FormGroupDirective.prototype.removeControl = function (dir) { collection_1.ListWrapper.remove(this.directives, dir); }; | ||
FormGroupDirective.prototype.addFormGroup = function (dir) { | ||
var ctrl = this.form.find(dir.path); | ||
var ctrl = this.form.get(dir.path); | ||
shared_1.setUpFormContainer(ctrl, dir); | ||
@@ -86,5 +85,5 @@ ctrl.updateValueAndValidity({ emitEvent: false }); | ||
FormGroupDirective.prototype.removeFormGroup = function (dir) { }; | ||
FormGroupDirective.prototype.getFormGroup = function (dir) { return this.form.find(dir.path); }; | ||
FormGroupDirective.prototype.getFormGroup = function (dir) { return this.form.get(dir.path); }; | ||
FormGroupDirective.prototype.addFormArray = function (dir) { | ||
var ctrl = this.form.find(dir.path); | ||
var ctrl = this.form.get(dir.path); | ||
shared_1.setUpFormContainer(ctrl, dir); | ||
@@ -94,12 +93,13 @@ ctrl.updateValueAndValidity({ emitEvent: false }); | ||
FormGroupDirective.prototype.removeFormArray = function (dir) { }; | ||
FormGroupDirective.prototype.getFormArray = function (dir) { return this.form.find(dir.path); }; | ||
FormGroupDirective.prototype.getFormArray = function (dir) { return this.form.get(dir.path); }; | ||
FormGroupDirective.prototype.updateModel = function (dir, value) { | ||
var ctrl = this.form.find(dir.path); | ||
ctrl.updateValue(value); | ||
var ctrl = this.form.get(dir.path); | ||
ctrl.setValue(value); | ||
}; | ||
FormGroupDirective.prototype.onSubmit = function () { | ||
this._submitted = true; | ||
async_1.ObservableWrapper.callEmit(this.ngSubmit, null); | ||
this.ngSubmit.emit(null); | ||
return false; | ||
}; | ||
FormGroupDirective.prototype.onReset = function () { this.form.reset(); }; | ||
/** @internal */ | ||
@@ -109,3 +109,3 @@ FormGroupDirective.prototype._updateDomValue = function () { | ||
this.directives.forEach(function (dir) { | ||
var ctrl = _this.form.find(dir.path); | ||
var ctrl = _this.form.get(dir.path); | ||
dir.valueAccessor.writeValue(ctrl.value); | ||
@@ -116,3 +116,3 @@ }); | ||
if (lang_1.isBlank(this.form)) { | ||
throw new exceptions_1.BaseException("formGroup expects a FormGroup instance. Please pass one in.\n Example: <form [formGroup]=\"myFormGroup\">\n "); | ||
reactive_errors_1.ReactiveErrors.missingFormException(); | ||
} | ||
@@ -125,3 +125,3 @@ }; | ||
providers: [exports.formDirectiveProvider], | ||
host: { '(submit)': 'onSubmit()' }, | ||
host: { '(submit)': 'onSubmit()', '(reset)': 'onReset()' }, | ||
exportAs: 'ngForm' | ||
@@ -128,0 +128,0 @@ },] }, |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"formDirectiveProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormGroupDirective"}},"FormGroupDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formGroup]","providers":[{"__symbolic":"reference","name":"formDirectiveProvider"}],"host":{"(submit)":"onSubmit()"},"exportAs":"ngForm"}]}],"members":{"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formGroup"]}]}],"ngSubmit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"addControl":[{"__symbolic":"method"}],"getControl":[{"__symbolic":"method"}],"removeControl":[{"__symbolic":"method"}],"addFormGroup":[{"__symbolic":"method"}],"removeFormGroup":[{"__symbolic":"method"}],"getFormGroup":[{"__symbolic":"method"}],"addFormArray":[{"__symbolic":"method"}],"removeFormArray":[{"__symbolic":"method"}],"getFormArray":[{"__symbolic":"method"}],"updateModel":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"_updateDomValue":[{"__symbolic":"method"}],"_checkFormPresent":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"formDirectiveProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormGroupDirective"}},"FormGroupDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formGroup]","providers":[{"__symbolic":"reference","name":"formDirectiveProvider"}],"host":{"(submit)":"onSubmit()","(reset)":"onReset()"},"exportAs":"ngForm"}]}],"members":{"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formGroup"]}]}],"ngSubmit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"addControl":[{"__symbolic":"method"}],"getControl":[{"__symbolic":"method"}],"removeControl":[{"__symbolic":"method"}],"addFormGroup":[{"__symbolic":"method"}],"removeFormGroup":[{"__symbolic":"method"}],"getFormGroup":[{"__symbolic":"method"}],"addFormArray":[{"__symbolic":"method"}],"removeFormArray":[{"__symbolic":"method"}],"getFormArray":[{"__symbolic":"method"}],"updateModel":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"onReset":[{"__symbolic":"method"}],"_updateDomValue":[{"__symbolic":"method"}],"_checkFormPresent":[{"__symbolic":"method"}]}}}} |
@@ -9,4 +9,7 @@ /** | ||
import { OnDestroy, OnInit } from '@angular/core'; | ||
import { FormArray } from '../../model'; | ||
import { AbstractFormGroupDirective } from '../abstract_form_group_directive'; | ||
import { ControlContainer } from '../control_container'; | ||
import { AsyncValidatorFn, ValidatorFn } from '../validators'; | ||
import { FormGroupDirective } from './form_group_directive'; | ||
export declare const formGroupNameProvider: any; | ||
@@ -65,1 +68,49 @@ /** | ||
} | ||
export declare const formArrayNameProvider: any; | ||
/** | ||
* Syncs an existing form array to a DOM element. | ||
* | ||
* This directive can only be used as a child of {@link FormGroupDirective}. | ||
* | ||
* ```typescript | ||
* @Component({ | ||
* selector: 'my-app', | ||
* template: ` | ||
* <div> | ||
* <h2>Angular FormArray Example</h2> | ||
* <form [formGroup]="myForm"> | ||
* <div formArrayName="cities"> | ||
* <div *ngFor="let city of cityArray.controls; let i=index"> | ||
* <input [formControlName]="i"> | ||
* </div> | ||
* </div> | ||
* </form> | ||
* {{ myForm.value | json }} // {cities: ['SF', 'NY']} | ||
* </div> | ||
* ` | ||
* }) | ||
* export class App { | ||
* cityArray = new FormArray([ | ||
* new FormControl('SF'), | ||
* new FormControl('NY') | ||
* ]); | ||
* myForm = new FormGroup({ | ||
* cities: this.cityArray | ||
* }); | ||
* } | ||
* ``` | ||
* | ||
* @experimental | ||
*/ | ||
export declare class FormArrayName extends ControlContainer implements OnInit, OnDestroy { | ||
name: string; | ||
constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]); | ||
ngOnInit(): void; | ||
ngOnDestroy(): void; | ||
control: FormArray; | ||
formDirective: FormGroupDirective; | ||
path: string[]; | ||
validator: ValidatorFn; | ||
asyncValidator: AsyncValidatorFn; | ||
private _checkParentType(); | ||
} |
@@ -18,4 +18,6 @@ /** | ||
var control_container_1 = require('../control_container'); | ||
exports.formGroupNameProvider = | ||
/*@ts2dart_const*/ /* @ts2dart_Provider */ { | ||
var reactive_errors_1 = require('../reactive_errors'); | ||
var shared_1 = require('../shared'); | ||
var form_group_directive_1 = require('./form_group_directive'); | ||
exports.formGroupNameProvider = { | ||
provide: control_container_1.ControlContainer, | ||
@@ -32,2 +34,8 @@ useExisting: core_1.forwardRef(function () { return FormGroupName; }) | ||
} | ||
/** @internal */ | ||
FormGroupName.prototype._checkParentType = function () { | ||
if (_hasInvalidParent(this._parent)) { | ||
reactive_errors_1.ReactiveErrors.groupParentException(); | ||
} | ||
}; | ||
/** @nocollapse */ | ||
@@ -39,3 +47,3 @@ FormGroupName.decorators = [ | ||
FormGroupName.ctorParameters = [ | ||
{ type: control_container_1.ControlContainer, decorators: [{ type: core_1.Host }, { type: core_1.SkipSelf },] }, | ||
{ type: control_container_1.ControlContainer, decorators: [{ type: core_1.Optional }, { type: core_1.Host }, { type: core_1.SkipSelf },] }, | ||
{ type: Array, decorators: [{ type: core_1.Optional }, { type: core_1.Self }, { type: core_1.Inject, args: [validators_1.NG_VALIDATORS,] },] }, | ||
@@ -51,2 +59,70 @@ { type: Array, decorators: [{ type: core_1.Optional }, { type: core_1.Self }, { type: core_1.Inject, args: [validators_1.NG_ASYNC_VALIDATORS,] },] }, | ||
exports.FormGroupName = FormGroupName; | ||
exports.formArrayNameProvider = { | ||
provide: control_container_1.ControlContainer, | ||
useExisting: core_1.forwardRef(function () { return FormArrayName; }) | ||
}; | ||
var FormArrayName = (function (_super) { | ||
__extends(FormArrayName, _super); | ||
function FormArrayName(parent, validators, asyncValidators) { | ||
_super.call(this); | ||
this._parent = parent; | ||
this._validators = validators; | ||
this._asyncValidators = asyncValidators; | ||
} | ||
FormArrayName.prototype.ngOnInit = function () { | ||
this._checkParentType(); | ||
this.formDirective.addFormArray(this); | ||
}; | ||
FormArrayName.prototype.ngOnDestroy = function () { this.formDirective.removeFormArray(this); }; | ||
Object.defineProperty(FormArrayName.prototype, "control", { | ||
get: function () { return this.formDirective.getFormArray(this); }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(FormArrayName.prototype, "formDirective", { | ||
get: function () { return this._parent.formDirective; }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(FormArrayName.prototype, "path", { | ||
get: function () { return shared_1.controlPath(this.name, this._parent); }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(FormArrayName.prototype, "validator", { | ||
get: function () { return shared_1.composeValidators(this._validators); }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(FormArrayName.prototype, "asyncValidator", { | ||
get: function () { return shared_1.composeAsyncValidators(this._asyncValidators); }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
FormArrayName.prototype._checkParentType = function () { | ||
if (_hasInvalidParent(this._parent)) { | ||
reactive_errors_1.ReactiveErrors.arrayParentException(); | ||
} | ||
}; | ||
/** @nocollapse */ | ||
FormArrayName.decorators = [ | ||
{ type: core_1.Directive, args: [{ selector: '[formArrayName]', providers: [exports.formArrayNameProvider] },] }, | ||
]; | ||
/** @nocollapse */ | ||
FormArrayName.ctorParameters = [ | ||
{ type: control_container_1.ControlContainer, decorators: [{ type: core_1.Optional }, { type: core_1.Host }, { type: core_1.SkipSelf },] }, | ||
{ type: Array, decorators: [{ type: core_1.Optional }, { type: core_1.Self }, { type: core_1.Inject, args: [validators_1.NG_VALIDATORS,] },] }, | ||
{ type: Array, decorators: [{ type: core_1.Optional }, { type: core_1.Self }, { type: core_1.Inject, args: [validators_1.NG_ASYNC_VALIDATORS,] },] }, | ||
]; | ||
/** @nocollapse */ | ||
FormArrayName.propDecorators = { | ||
'name': [{ type: core_1.Input, args: ['formArrayName',] },], | ||
}; | ||
return FormArrayName; | ||
}(control_container_1.ControlContainer)); | ||
exports.FormArrayName = FormArrayName; | ||
function _hasInvalidParent(parent) { | ||
return !(parent instanceof FormGroupName) && !(parent instanceof form_group_directive_1.FormGroupDirective) && | ||
!(parent instanceof FormArrayName); | ||
} | ||
//# sourceMappingURL=form_group_name.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"formGroupNameProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormGroupName"}},"FormGroupName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formGroupName]","providers":[{"__symbolic":"reference","name":"formGroupNameProvider"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formGroupName"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"formGroupNameProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormGroupName"}},"FormGroupName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formGroupName]","providers":[{"__symbolic":"reference","name":"formGroupNameProvider"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formGroupName"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"_checkParentType":[{"__symbolic":"method"}]}},"formArrayNameProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormArrayName"}},"FormArrayName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formArrayName]","providers":[{"__symbolic":"reference","name":"formArrayNameProvider"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formArrayName"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"_checkParentType":[{"__symbolic":"method"}]}}}} |
@@ -8,6 +8,13 @@ /** | ||
*/ | ||
import { ElementRef, OnDestroy, Renderer } from '@angular/core'; | ||
import { ElementRef, OnDestroy, OpaqueToken, Renderer, Type } from '@angular/core'; | ||
import { ControlValueAccessor } from './control_value_accessor'; | ||
export declare const SELECT_MULTIPLE_VALUE_ACCESSOR: { | ||
provide: OpaqueToken; | ||
useExisting: Type; | ||
multi: boolean; | ||
}; | ||
/** | ||
* The accessor for writing a value and listening to changes on a select element. | ||
* | ||
* @experimental | ||
*/ | ||
@@ -14,0 +21,0 @@ export declare class SelectMultipleControlValueAccessor implements ControlValueAccessor { |
@@ -13,3 +13,3 @@ /** | ||
var control_value_accessor_1 = require('./control_value_accessor'); | ||
var SELECT_MULTIPLE_VALUE_ACCESSOR = { | ||
exports.SELECT_MULTIPLE_VALUE_ACCESSOR = { | ||
provide: control_value_accessor_1.NG_VALUE_ACCESSOR, | ||
@@ -106,4 +106,4 @@ useExisting: core_1.forwardRef(function () { return SelectMultipleControlValueAccessor; }), | ||
selector: 'select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]', | ||
host: { '(input)': 'onChange($event.target)', '(blur)': 'onTouched()' }, | ||
providers: [SELECT_MULTIPLE_VALUE_ACCESSOR] | ||
host: { '(change)': 'onChange($event.target)', '(blur)': 'onTouched()' }, | ||
providers: [exports.SELECT_MULTIPLE_VALUE_ACCESSOR] | ||
},] }, | ||
@@ -110,0 +110,0 @@ ]; |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"SelectMultipleControlValueAccessor":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]","host":{"(input)":"onChange($event.target)","(blur)":"onTouched()"},"providers":[{"__symbolic":"reference","name":"SELECT_MULTIPLE_VALUE_ACCESSOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"_registerOption":[{"__symbolic":"method"}],"_getOptionId":[{"__symbolic":"method"}],"_getOptionValue":[{"__symbolic":"method"}]}},"NgSelectMultipleOption":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"option"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer"},{"__symbolic":"reference","name":"SelectMultipleControlValueAccessor"}]}],"ngValue":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngValue"]}]}],"value":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["value"]}]}],"_setElementValue":[{"__symbolic":"method"}],"_setSelected":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"SELECT_DIRECTIVES":[{"__symbolic":"reference","name":"SelectMultipleControlValueAccessor"},{"__symbolic":"reference","name":"NgSelectMultipleOption"}]}} | ||
{"__symbolic":"module","version":1,"metadata":{"SELECT_MULTIPLE_VALUE_ACCESSOR":{"provide":{"__symbolic":"reference","module":"./control_value_accessor","name":"NG_VALUE_ACCESSOR"},"useExisting":{"__symbolic":"reference","name":"SelectMultipleControlValueAccessor"},"multi":true},"SelectMultipleControlValueAccessor":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]","host":{"(change)":"onChange($event.target)","(blur)":"onTouched()"},"providers":[{"__symbolic":"reference","name":"SELECT_MULTIPLE_VALUE_ACCESSOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"_registerOption":[{"__symbolic":"method"}],"_getOptionId":[{"__symbolic":"method"}],"_getOptionValue":[{"__symbolic":"method"}]}},"NgSelectMultipleOption":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"option"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"Renderer"},{"__symbolic":"reference","name":"SelectMultipleControlValueAccessor"}]}],"ngValue":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngValue"]}]}],"value":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["value"]}]}],"_setElementValue":[{"__symbolic":"method"}],"_setSelected":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"SELECT_DIRECTIVES":[{"__symbolic":"reference","name":"SelectMultipleControlValueAccessor"},{"__symbolic":"reference","name":"NgSelectMultipleOption"}]}} |
@@ -6,3 +6,3 @@ import { FormArray, FormControl, FormGroup } from '../model'; | ||
import { NgControl } from './ng_control'; | ||
import { FormArrayName } from './reactive_directives/form_array_name'; | ||
import { FormArrayName } from './reactive_directives/form_group_name'; | ||
import { AsyncValidatorFn, ValidatorFn } from './validators'; | ||
@@ -9,0 +9,0 @@ export declare function controlPath(name: string, parent: ControlContainer): string[]; |
@@ -28,5 +28,5 @@ /** | ||
if (lang_1.isBlank(control)) | ||
_throwError(dir, 'Cannot find control'); | ||
_throwError(dir, 'Cannot find control with'); | ||
if (lang_1.isBlank(dir.valueAccessor)) | ||
_throwError(dir, 'No value accessor for'); | ||
_throwError(dir, 'No value accessor for form control with'); | ||
control.validator = validators_1.Validators.compose([control.validator, dir.validator]); | ||
@@ -38,7 +38,12 @@ control.asyncValidator = validators_1.Validators.composeAsync([control.asyncValidator, dir.asyncValidator]); | ||
dir.viewToModelUpdate(newValue); | ||
control.updateValue(newValue, { emitModelToViewChange: false }); | ||
control.markAsDirty(); | ||
control.setValue(newValue, { emitModelToViewChange: false }); | ||
}); | ||
// model -> view | ||
control.registerOnChange(function (newValue) { return dir.valueAccessor.writeValue(newValue); }); | ||
control.registerOnChange(function (newValue, emitModelEvent) { | ||
// control -> view | ||
dir.valueAccessor.writeValue(newValue); | ||
// control -> ngModel | ||
if (emitModelEvent) | ||
dir.viewToModelUpdate(newValue); | ||
}); | ||
// touched | ||
@@ -50,3 +55,3 @@ dir.valueAccessor.registerOnTouched(function () { return control.markAsTouched(); }); | ||
if (lang_1.isBlank(control)) | ||
_throwError(dir, 'Cannot find control'); | ||
_throwError(dir, 'Cannot find control with'); | ||
control.validator = validators_1.Validators.compose([control.validator, dir.validator]); | ||
@@ -57,4 +62,13 @@ control.asyncValidator = validators_1.Validators.composeAsync([control.asyncValidator, dir.asyncValidator]); | ||
function _throwError(dir, message) { | ||
var path = dir.path.join(' -> '); | ||
throw new exceptions_1.BaseException(message + " '" + path + "'"); | ||
var messageEnd; | ||
if (dir.path.length > 1) { | ||
messageEnd = "path: '" + dir.path.join(' -> ') + "'"; | ||
} | ||
else if (dir.path[0]) { | ||
messageEnd = "name: '" + dir.path + "'"; | ||
} | ||
else { | ||
messageEnd = 'unspecified name attribute'; | ||
} | ||
throw new exceptions_1.BaseException(message + " " + messageEnd); | ||
} | ||
@@ -95,3 +109,3 @@ function composeValidators(validators) { | ||
if (lang_1.isPresent(builtinAccessor)) | ||
_throwError(dir, 'More than one built-in value accessor matches'); | ||
_throwError(dir, 'More than one built-in value accessor matches form control with'); | ||
builtinAccessor = v; | ||
@@ -101,3 +115,3 @@ } | ||
if (lang_1.isPresent(customAccessor)) | ||
_throwError(dir, 'More than one custom value accessor matches'); | ||
_throwError(dir, 'More than one custom value accessor matches form control with'); | ||
customAccessor = v; | ||
@@ -112,3 +126,3 @@ } | ||
return defaultAccessor; | ||
_throwError(dir, 'No valid value accessor for'); | ||
_throwError(dir, 'No valid value accessor for form control with'); | ||
return null; | ||
@@ -115,0 +129,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"composeValidators":{"__symbolic":"function","parameters":["validators"],"value":{"__symbolic":"error","message":"Expression form not supported","line":71,"character":8}},"composeAsyncValidators":{"__symbolic":"function","parameters":["validators"],"value":{"__symbolic":"error","message":"Expression form not supported","line":76,"character":8}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"composeValidators":{"__symbolic":"function","parameters":["validators"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"../facade/lang","name":"isPresent"},"arguments":[{"__symbolic":"reference","name":"validators"}]},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"../validators","name":"Validators"},"member":"compose"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"validators"},"member":"map"},"arguments":[{"__symbolic":"reference","module":"./normalize_validator","name":"normalizeValidator"}]}]},"elseExpression":null}},"composeAsyncValidators":{"__symbolic":"function","parameters":["validators"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"../facade/lang","name":"isPresent"},"arguments":[{"__symbolic":"reference","name":"validators"}]},"thenExpression":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"../validators","name":"Validators"},"member":"composeAsync"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"validators"},"member":"map"},"arguments":[{"__symbolic":"reference","module":"./normalize_validator","name":"normalizeAsyncValidator"}]}]},"elseExpression":null}}}} |
import { AbstractControl } from '../model'; | ||
import { Validators } from '../validators'; | ||
/** | ||
@@ -26,2 +27,3 @@ * An interface that can be implemented by classes that can act as validators. | ||
} | ||
export declare const REQUIRED: typeof Validators.required; | ||
export declare const REQUIRED_VALIDATOR: any; | ||
@@ -57,3 +59,3 @@ /** | ||
/** | ||
* Provivder which adds {@link MinLengthValidator} to {@link NG_VALIDATORS}. | ||
* Provider which adds {@link MinLengthValidator} to {@link NG_VALIDATORS}. | ||
* | ||
@@ -60,0 +62,0 @@ * ## Example: |
@@ -12,6 +12,6 @@ /** | ||
var validators_1 = require('../validators'); | ||
var REQUIRED = validators_1.Validators.required; | ||
exports.REQUIRED = validators_1.Validators.required; | ||
exports.REQUIRED_VALIDATOR = { | ||
provide: validators_1.NG_VALIDATORS, | ||
useValue: REQUIRED, | ||
useValue: exports.REQUIRED, | ||
multi: true | ||
@@ -33,3 +33,3 @@ }; | ||
/** | ||
* Provivder which adds {@link MinLengthValidator} to {@link NG_VALIDATORS}. | ||
* Provider which adds {@link MinLengthValidator} to {@link NG_VALIDATORS}. | ||
* | ||
@@ -36,0 +36,0 @@ * ## Example: |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"REQUIRED_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useValue":{"__symbolic":"reference","name":"REQUIRED"},"multi":true},"RequiredValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[required][formControlName],[required][formControl],[required][ngModel]","providers":[{"__symbolic":"reference","name":"REQUIRED_VALIDATOR"}]}]}]},"MIN_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MinLengthValidator"},"multi":true},"MinLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[minlength][formControlName],[minlength][formControl],[minlength][ngModel]","providers":[{"__symbolic":"reference","name":"MIN_LENGTH_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["minlength"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}},"MAX_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MaxLengthValidator"},"multi":true},"MaxLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]","providers":[{"__symbolic":"reference","name":"MAX_LENGTH_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["maxlength"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}},"PATTERN_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"PatternValidator"},"multi":true},"PatternValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[pattern][formControlName],[pattern][formControl],[pattern][ngModel]","providers":[{"__symbolic":"reference","name":"PATTERN_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["pattern"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"REQUIRED":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"../validators","name":"Validators"},"member":"required"},"REQUIRED_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useValue":{"__symbolic":"reference","name":"REQUIRED"},"multi":true},"RequiredValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[required][formControlName],[required][formControl],[required][ngModel]","providers":[{"__symbolic":"reference","name":"REQUIRED_VALIDATOR"}]}]}]},"MIN_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MinLengthValidator"},"multi":true},"MinLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[minlength][formControlName],[minlength][formControl],[minlength][ngModel]","providers":[{"__symbolic":"reference","name":"MIN_LENGTH_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["minlength"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}},"MAX_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MaxLengthValidator"},"multi":true},"MaxLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]","providers":[{"__symbolic":"reference","name":"MAX_LENGTH_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["maxlength"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}},"PATTERN_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"PatternValidator"},"multi":true},"PatternValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[pattern][formControlName],[pattern][formControl],[pattern][ngModel]","providers":[{"__symbolic":"reference","name":"PATTERN_VALIDATOR"}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Attribute"},"arguments":["pattern"]}]],"parameters":[{"__symbolic":"reference","name":"string"}]}],"validate":[{"__symbolic":"method"}]}}}} |
@@ -8,31 +8,5 @@ /** | ||
*/ | ||
import { Observable } from 'rxjs/Observable'; | ||
import { Subject } from 'rxjs/Subject'; | ||
export { Observable } from 'rxjs/Observable'; | ||
export { Subject } from 'rxjs/Subject'; | ||
export { PromiseCompleter, PromiseWrapper } from './promise'; | ||
export declare class TimerWrapper { | ||
static setTimeout(fn: (...args: any[]) => void, millis: number): number; | ||
static clearTimeout(id: number): void; | ||
static setInterval(fn: (...args: any[]) => void, millis: number): number; | ||
static clearInterval(id: number): void; | ||
} | ||
export declare class ObservableWrapper { | ||
static subscribe<T>(emitter: any, onNext: (value: T) => void, onError?: (exception: any) => void, onComplete?: () => void): Object; | ||
static isObservable(obs: any): boolean; | ||
/** | ||
* Returns whether `obs` has any subscribers listening to events. | ||
*/ | ||
static hasSubscribers(obs: EventEmitter<any>): boolean; | ||
static dispose(subscription: any): void; | ||
/** | ||
* @deprecated - use callEmit() instead | ||
*/ | ||
static callNext(emitter: EventEmitter<any>, value: any): void; | ||
static callEmit(emitter: EventEmitter<any>, value: any): void; | ||
static callError(emitter: EventEmitter<any>, error: any): void; | ||
static callComplete(emitter: EventEmitter<any>): void; | ||
static fromPromise(promise: Promise<any>): Observable<any>; | ||
static toPromise(obj: Observable<any>): Promise<any>; | ||
} | ||
/** | ||
@@ -92,3 +66,3 @@ * Use by directives and components to emit custom Events. | ||
constructor(isAsync?: boolean); | ||
emit(value: T): void; | ||
emit(value?: T): void; | ||
/** | ||
@@ -95,0 +69,0 @@ * @deprecated - use .emit(value) instead |
@@ -15,5 +15,2 @@ /** | ||
var Subject_1 = require('rxjs/Subject'); | ||
var PromiseObservable_1 = require('rxjs/observable/PromiseObservable'); | ||
var toPromise_1 = require('rxjs/operator/toPromise'); | ||
var lang_1 = require('./lang'); | ||
var Observable_1 = require('rxjs/Observable'); | ||
@@ -23,49 +20,2 @@ exports.Observable = Observable_1.Observable; | ||
exports.Subject = Subject_2.Subject; | ||
var promise_1 = require('./promise'); | ||
exports.PromiseCompleter = promise_1.PromiseCompleter; | ||
exports.PromiseWrapper = promise_1.PromiseWrapper; | ||
var TimerWrapper = (function () { | ||
function TimerWrapper() { | ||
} | ||
TimerWrapper.setTimeout = function (fn, millis) { | ||
return lang_1.global.setTimeout(fn, millis); | ||
}; | ||
TimerWrapper.clearTimeout = function (id) { lang_1.global.clearTimeout(id); }; | ||
TimerWrapper.setInterval = function (fn, millis) { | ||
return lang_1.global.setInterval(fn, millis); | ||
}; | ||
TimerWrapper.clearInterval = function (id) { lang_1.global.clearInterval(id); }; | ||
return TimerWrapper; | ||
}()); | ||
exports.TimerWrapper = TimerWrapper; | ||
var ObservableWrapper = (function () { | ||
function ObservableWrapper() { | ||
} | ||
// TODO(vsavkin): when we use rxnext, try inferring the generic type from the first arg | ||
ObservableWrapper.subscribe = function (emitter, onNext, onError, onComplete) { | ||
if (onComplete === void 0) { onComplete = function () { }; } | ||
onError = (typeof onError === 'function') && onError || lang_1.noop; | ||
onComplete = (typeof onComplete === 'function') && onComplete || lang_1.noop; | ||
return emitter.subscribe({ next: onNext, error: onError, complete: onComplete }); | ||
}; | ||
ObservableWrapper.isObservable = function (obs) { return !!obs.subscribe; }; | ||
/** | ||
* Returns whether `obs` has any subscribers listening to events. | ||
*/ | ||
ObservableWrapper.hasSubscribers = function (obs) { return obs.observers.length > 0; }; | ||
ObservableWrapper.dispose = function (subscription) { subscription.unsubscribe(); }; | ||
/** | ||
* @deprecated - use callEmit() instead | ||
*/ | ||
ObservableWrapper.callNext = function (emitter, value) { emitter.emit(value); }; | ||
ObservableWrapper.callEmit = function (emitter, value) { emitter.emit(value); }; | ||
ObservableWrapper.callError = function (emitter, error) { emitter.error(error); }; | ||
ObservableWrapper.callComplete = function (emitter) { emitter.complete(); }; | ||
ObservableWrapper.fromPromise = function (promise) { | ||
return PromiseObservable_1.PromiseObservable.create(promise); | ||
}; | ||
ObservableWrapper.toPromise = function (obj) { return toPromise_1.toPromise.call(obj); }; | ||
return ObservableWrapper; | ||
}()); | ||
exports.ObservableWrapper = ObservableWrapper; | ||
/** | ||
@@ -72,0 +22,0 @@ * Use by directives and components to emit custom Events. |
@@ -47,3 +47,3 @@ export declare var Map: MapConstructor; | ||
[key: string]: V; | ||
}, callback: Function): void; | ||
}, callback: (v: V, K: string) => void): void; | ||
static merge<V>(m1: { | ||
@@ -50,0 +50,0 @@ [key: string]: V; |
@@ -127,6 +127,3 @@ /** | ||
StringMapWrapper.values = function (map) { | ||
return Object.keys(map).reduce(function (r, a) { | ||
r.push(map[a]); | ||
return r; | ||
}, []); | ||
return Object.keys(map).map(function (k) { return map[k]; }); | ||
}; | ||
@@ -141,6 +138,5 @@ StringMapWrapper.isEmpty = function (map) { | ||
StringMapWrapper.forEach = function (map, callback) { | ||
for (var prop in map) { | ||
if (map.hasOwnProperty(prop)) { | ||
callback(map[prop], prop); | ||
} | ||
for (var _i = 0, _a = Object.keys(map); _i < _a.length; _i++) { | ||
var k = _a[_i]; | ||
callback(map[k], k); | ||
} | ||
@@ -150,11 +146,9 @@ }; | ||
var m = {}; | ||
for (var attr in m1) { | ||
if (m1.hasOwnProperty(attr)) { | ||
m[attr] = m1[attr]; | ||
} | ||
for (var _i = 0, _a = Object.keys(m1); _i < _a.length; _i++) { | ||
var k = _a[_i]; | ||
m[k] = m1[k]; | ||
} | ||
for (var attr in m2) { | ||
if (m2.hasOwnProperty(attr)) { | ||
m[attr] = m2[attr]; | ||
} | ||
for (var _b = 0, _c = Object.keys(m2); _b < _c.length; _b++) { | ||
var k = _c[_b]; | ||
m[k] = m2[k]; | ||
} | ||
@@ -161,0 +155,0 @@ return m; |
@@ -18,3 +18,3 @@ /** | ||
* | ||
* bootstrap(MyApp, {provide: ExceptionHandler, useClass: MyExceptionHandler}]) | ||
* bootstrap(MyApp, [{provide: ExceptionHandler, useClass: MyExceptionHandler}]) | ||
* | ||
@@ -21,0 +21,0 @@ * ``` |
@@ -40,3 +40,3 @@ /** | ||
* | ||
* bootstrap(MyApp, {provide: ExceptionHandler, useClass: MyExceptionHandler}]) | ||
* bootstrap(MyApp, [{provide: ExceptionHandler, useClass: MyExceptionHandler}]) | ||
* | ||
@@ -43,0 +43,0 @@ * ``` |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"makeTypeError":{"__symbolic":"function","parameters":["message"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"TypeError"},"arguments":[{"__symbolic":"reference","name":"message"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"makeTypeError":{"__symbolic":"function","parameters":["message"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"TypeError"},"arguments":[{"__symbolic":"reference","name":"message"}]}}},"exports":[{"from":"./exception_handler","export":["ExceptionHandler"]}]} |
@@ -30,3 +30,2 @@ /** | ||
export declare function scheduleMicroTask(fn: Function): void; | ||
export declare const IS_DART: boolean; | ||
declare var _global: BrowserNodeGlobal; | ||
@@ -109,18 +108,2 @@ export { _global as global }; | ||
export declare var RegExp: RegExpConstructor; | ||
export declare class RegExpWrapper { | ||
static create(regExpStr: string, flags?: string): RegExp; | ||
static firstMatch(regExp: RegExp, input: string): RegExpExecArray; | ||
static test(regExp: RegExp, input: string): boolean; | ||
static matcher(regExp: RegExp, input: string): { | ||
re: RegExp; | ||
input: string; | ||
}; | ||
static replaceAll(regExp: RegExp, input: string, replace: Function): string; | ||
} | ||
export declare class RegExpMatcherWrapper { | ||
static next(matcher: { | ||
re: RegExp; | ||
input: string; | ||
}): RegExpExecArray; | ||
} | ||
export declare class FunctionWrapper { | ||
@@ -127,0 +110,0 @@ static apply(fn: Function, posArgs: any): any; |
@@ -31,3 +31,2 @@ /** | ||
exports.scheduleMicroTask = scheduleMicroTask; | ||
exports.IS_DART = false; | ||
// Need to declare a new variable for global here since TypeScript | ||
@@ -99,3 +98,5 @@ // exports the original value of the symbol. | ||
function isPromise(obj) { | ||
return obj instanceof _global.Promise; | ||
// allow any Promise/A+ compliant thenable. | ||
// It's up to the caller to ensure that obj.then conforms to the spec | ||
return isPresent(obj) && isFunction(obj.then); | ||
} | ||
@@ -120,8 +121,8 @@ exports.isPromise = isPromise; | ||
} | ||
if (token.overriddenName) { | ||
return token.overriddenName; | ||
} | ||
if (token.name) { | ||
return token.name; | ||
} | ||
if (token.overriddenName) { | ||
return token.overriddenName; | ||
} | ||
var res = token.toString(); | ||
@@ -280,53 +281,2 @@ var newLineIndex = res.indexOf('\n'); | ||
exports.RegExp = _global.RegExp; | ||
var RegExpWrapper = (function () { | ||
function RegExpWrapper() { | ||
} | ||
RegExpWrapper.create = function (regExpStr, flags) { | ||
if (flags === void 0) { flags = ''; } | ||
flags = flags.replace(/g/g, ''); | ||
return new _global.RegExp(regExpStr, flags + 'g'); | ||
}; | ||
RegExpWrapper.firstMatch = function (regExp, input) { | ||
// Reset multimatch regex state | ||
regExp.lastIndex = 0; | ||
return regExp.exec(input); | ||
}; | ||
RegExpWrapper.test = function (regExp, input) { | ||
regExp.lastIndex = 0; | ||
return regExp.test(input); | ||
}; | ||
RegExpWrapper.matcher = function (regExp, input) { | ||
// Reset regex state for the case | ||
// someone did not loop over all matches | ||
// last time. | ||
regExp.lastIndex = 0; | ||
return { re: regExp, input: input }; | ||
}; | ||
RegExpWrapper.replaceAll = function (regExp, input, replace) { | ||
var c = regExp.exec(input); | ||
var res = ''; | ||
regExp.lastIndex = 0; | ||
var prev = 0; | ||
while (c) { | ||
res += input.substring(prev, c.index); | ||
res += replace(c); | ||
prev = c.index + c[0].length; | ||
regExp.lastIndex = prev; | ||
c = regExp.exec(input); | ||
} | ||
res += input.substring(prev); | ||
return res; | ||
}; | ||
return RegExpWrapper; | ||
}()); | ||
exports.RegExpWrapper = RegExpWrapper; | ||
var RegExpMatcherWrapper = (function () { | ||
function RegExpMatcherWrapper() { | ||
} | ||
RegExpMatcherWrapper.next = function (matcher) { | ||
return matcher.re.exec(matcher.input); | ||
}; | ||
return RegExpMatcherWrapper; | ||
}()); | ||
exports.RegExpMatcherWrapper = RegExpMatcherWrapper; | ||
var FunctionWrapper = (function () { | ||
@@ -333,0 +283,0 @@ function FunctionWrapper() { |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"IS_DART":false,"Type":{"__symbolic":"reference","name":"Function"},"Math":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_global"},"member":"Math"},"Date":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_global"},"member":"Date"},"isPresent":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBoolean":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":106,"character":8},"right":"boolean"}},"isNumber":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":110,"character":8},"right":"number"}},"isString":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":114,"character":8},"right":"string"}},"isFunction":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":118,"character":8},"right":"function"}},"isType":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFunction"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":126,"character":8},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isStrictStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isStringMap"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"reference","name":"STRING_MAP_PROTO"}}}},"isPromise":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_global"},"member":"Promise"}}},"isArray":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Array"},"member":"isArray"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isDate":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"Date"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"valueOf"}}]}}}},"serializeEnum":{"__symbolic":"function","parameters":["val"],"value":{"__symbolic":"reference","name":"val"}},"deserializeEnum":{"__symbolic":"function","parameters":["val","values"],"value":{"__symbolic":"reference","name":"val"}},"resolveEnumToken":{"__symbolic":"function","parameters":["enumValue","val"],"value":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"enumValue"},"index":{"__symbolic":"reference","name":"val"}}},"RegExp":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_global"},"member":"RegExp"},"looseIdentical":{"__symbolic":"function","parameters":["a","b"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"a"},"right":{"__symbolic":"reference","name":"b"}},"right":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":366,"character":19},"right":"number"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":366,"character":44},"right":"number"}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"a"}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"b"}]}}}},"getMapKey":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"reference","name":"value"}},"normalizeBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"error","message":"Expression form not supported","line":376,"character":8}},"normalizeBool":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"error","message":"Expression form not supported","line":380,"character":8}},"isJsObject":{"__symbolic":"function","parameters":["o"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"o"},"right":null},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":384,"character":24},"right":"function"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":384,"character":50},"right":"object"}}}},"isPrimitive":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isJsObject"},"arguments":[{"__symbolic":"reference","name":"obj"}]}}},"hasConstructor":{"__symbolic":"function","parameters":["value","type"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"value"},"member":"constructor"},"right":{"__symbolic":"reference","name":"type"}}},"escape":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"_global"},"member":"encodeURI"},"arguments":[{"__symbolic":"reference","name":"s"}]}},"escapeRegExp":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Expression form not supported","line":481,"character":19}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"Type":{"__symbolic":"reference","name":"Function"},"Math":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":3,"context":{"name":"_global"}},"Date":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":3,"context":{"name":"_global"}},"isPresent":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBoolean":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":104,"character":8},"right":"boolean"}},"isNumber":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":108,"character":8},"right":"number"}},"isString":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":112,"character":8},"right":"string"}},"isFunction":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":116,"character":8},"right":"function"}},"isType":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFunction"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":124,"character":8},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isStrictStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isStringMap"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"error","message":"Reference to a local symbol","line":127,"character":5,"context":{"name":"STRING_MAP_PROTO"}}}}},"isPromise":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isPresent"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFunction"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"then"}]}}},"isArray":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Array"},"member":"isArray"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isDate":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"Date"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"valueOf"}}]}}}},"serializeEnum":{"__symbolic":"function","parameters":["val"],"value":{"__symbolic":"reference","name":"val"}},"deserializeEnum":{"__symbolic":"function","parameters":["val","values"],"value":{"__symbolic":"reference","name":"val"}},"resolveEnumToken":{"__symbolic":"function","parameters":["enumValue","val"],"value":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"enumValue"},"index":{"__symbolic":"reference","name":"val"}}},"RegExp":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":3,"context":{"name":"_global"}},"looseIdentical":{"__symbolic":"function","parameters":["a","b"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"a"},"right":{"__symbolic":"reference","name":"b"}},"right":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":322,"character":19},"right":"number"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":322,"character":44},"right":"number"}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"a"}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"b"}]}}}},"getMapKey":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"reference","name":"value"}},"normalizeBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":null,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"normalizeBool":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":false,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"isJsObject":{"__symbolic":"function","parameters":["o"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"o"},"right":null},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":340,"character":24},"right":"function"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":340,"character":50},"right":"object"}}}},"isPrimitive":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isJsObject"},"arguments":[{"__symbolic":"reference","name":"obj"}]}}},"hasConstructor":{"__symbolic":"function","parameters":["value","type"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"value"},"member":"constructor"},"right":{"__symbolic":"reference","name":"type"}}},"escape":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":3,"context":{"name":"_global"}}},"escapeRegExp":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Expression form not supported","line":437,"character":19}}}} |
@@ -0,11 +1,11 @@ | ||
/** | ||
* @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 | ||
*/ | ||
import { Type } from '@angular/core'; | ||
/** | ||
* Shorthand set of providers used for building Angular forms. | ||
* | ||
* ### Example | ||
* | ||
* ```typescript | ||
* bootstrap(MyApp, [FORM_PROVIDERS]); | ||
* ``` | ||
* | ||
* @experimental | ||
@@ -15,8 +15,25 @@ */ | ||
/** | ||
* Shorthand set of providers used for building reactive Angular forms. | ||
* @experimental | ||
*/ | ||
export declare function disableDeprecatedForms(): any[]; | ||
export declare const REACTIVE_FORM_PROVIDERS: Type[]; | ||
/** | ||
* The ng module for forms. | ||
* @experimental | ||
*/ | ||
export declare class FormsModule { | ||
} | ||
/** | ||
* The ng module for reactive forms. | ||
* @experimental | ||
*/ | ||
export declare class ReactiveFormsModule { | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare function disableDeprecatedForms(): any[]; | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare function provideForms(): any[]; |
@@ -9,54 +9,57 @@ /** | ||
"use strict"; | ||
var common_1 = require('@angular/common'); | ||
var compiler_1 = require('@angular/compiler'); | ||
var core_1 = require('@angular/core'); | ||
var directives_1 = require('./directives'); | ||
var radio_control_value_accessor_1 = require('./directives/radio_control_value_accessor'); | ||
var collection_1 = require('./facade/collection'); | ||
var form_builder_1 = require('./form_builder'); | ||
/** | ||
* Shorthand set of providers used for building Angular forms. | ||
* | ||
* ### Example | ||
* | ||
* ```typescript | ||
* bootstrap(MyApp, [FORM_PROVIDERS]); | ||
* ``` | ||
* | ||
* @experimental | ||
*/ | ||
exports.FORM_PROVIDERS = [form_builder_1.FormBuilder, radio_control_value_accessor_1.RadioControlRegistry]; | ||
function flatten(platformDirectives) { | ||
var flattenedDirectives = []; | ||
platformDirectives.forEach(function (directives) { | ||
if (Array.isArray(directives)) { | ||
flattenedDirectives = flattenedDirectives.concat(directives); | ||
} | ||
else { | ||
flattenedDirectives.push(directives); | ||
} | ||
}); | ||
return flattenedDirectives; | ||
} | ||
exports.FORM_PROVIDERS = [radio_control_value_accessor_1.RadioControlRegistry]; | ||
/** | ||
* Shorthand set of providers used for building reactive Angular forms. | ||
* @experimental | ||
*/ | ||
exports.REACTIVE_FORM_PROVIDERS = [form_builder_1.FormBuilder, radio_control_value_accessor_1.RadioControlRegistry]; | ||
var FormsModule = (function () { | ||
function FormsModule() { | ||
} | ||
/** @nocollapse */ | ||
FormsModule.decorators = [ | ||
{ type: core_1.NgModule, args: [{ | ||
declarations: directives_1.TEMPLATE_DRIVEN_DIRECTIVES, | ||
providers: [exports.FORM_PROVIDERS], | ||
exports: [directives_1.InternalFormsSharedModule, directives_1.TEMPLATE_DRIVEN_DIRECTIVES] | ||
},] }, | ||
]; | ||
return FormsModule; | ||
}()); | ||
exports.FormsModule = FormsModule; | ||
var ReactiveFormsModule = (function () { | ||
function ReactiveFormsModule() { | ||
} | ||
/** @nocollapse */ | ||
ReactiveFormsModule.decorators = [ | ||
{ type: core_1.NgModule, args: [{ | ||
declarations: [directives_1.REACTIVE_DRIVEN_DIRECTIVES], | ||
providers: [exports.REACTIVE_FORM_PROVIDERS], | ||
exports: [directives_1.InternalFormsSharedModule, directives_1.REACTIVE_DRIVEN_DIRECTIVES] | ||
},] }, | ||
]; | ||
return ReactiveFormsModule; | ||
}()); | ||
exports.ReactiveFormsModule = ReactiveFormsModule; | ||
/** | ||
* @deprecated | ||
*/ | ||
function disableDeprecatedForms() { | ||
return [{ | ||
provide: compiler_1.CompilerConfig, | ||
useFactory: function (platformDirectives, platformPipes) { | ||
var flattenedDirectives = flatten(platformDirectives); | ||
collection_1.ListWrapper.remove(flattenedDirectives, common_1.FORM_DIRECTIVES); | ||
return new compiler_1.CompilerConfig({ platformDirectives: flattenedDirectives, platformPipes: platformPipes }); | ||
}, | ||
deps: [core_1.PLATFORM_DIRECTIVES, core_1.PLATFORM_PIPES] | ||
}]; | ||
return []; | ||
} | ||
exports.disableDeprecatedForms = disableDeprecatedForms; | ||
/** | ||
* @experimental | ||
* @deprecated | ||
*/ | ||
function provideForms() { | ||
return [ | ||
{ provide: core_1.PLATFORM_DIRECTIVES, useValue: directives_1.FORM_DIRECTIVES, multi: true }, exports.FORM_PROVIDERS | ||
{ provide: core_1.PLATFORM_DIRECTIVES, useValue: directives_1.FORM_DIRECTIVES, multi: true }, exports.REACTIVE_FORM_PROVIDERS | ||
]; | ||
@@ -63,0 +66,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"FORM_PROVIDERS":[{"__symbolic":"reference","module":"./form_builder","name":"FormBuilder"},{"__symbolic":"reference","module":"./directives/radio_control_value_accessor","name":"RadioControlRegistry"}],"disableDeprecatedForms":{"__symbolic":"function","parameters":[],"value":{"__symbolic":"error","message":"Function call not supported","line":52,"character":15}},"provideForms":{"__symbolic":"function","parameters":[],"value":[{"provide":{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_DIRECTIVES"},"useValue":{"__symbolic":"reference","module":"./directives","name":"FORM_DIRECTIVES"},"multi":true},{"__symbolic":"reference","name":"FORM_PROVIDERS"}]}}} | ||
{"__symbolic":"module","version":1,"metadata":{"FORM_PROVIDERS":[{"__symbolic":"reference","module":"./directives/radio_control_value_accessor","name":"RadioControlRegistry"}],"REACTIVE_FORM_PROVIDERS":[{"__symbolic":"reference","module":"./form_builder","name":"FormBuilder"},{"__symbolic":"reference","module":"./directives/radio_control_value_accessor","name":"RadioControlRegistry"}],"FormsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":{"__symbolic":"reference","module":"./directives","name":"TEMPLATE_DRIVEN_DIRECTIVES"},"providers":[{"__symbolic":"reference","name":"FORM_PROVIDERS"}],"exports":[{"__symbolic":"reference","module":"./directives","name":"InternalFormsSharedModule"},{"__symbolic":"reference","module":"./directives","name":"TEMPLATE_DRIVEN_DIRECTIVES"}]}]}]},"ReactiveFormsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./directives","name":"REACTIVE_DRIVEN_DIRECTIVES"}],"providers":[{"__symbolic":"reference","name":"REACTIVE_FORM_PROVIDERS"}],"exports":[{"__symbolic":"reference","module":"./directives","name":"InternalFormsSharedModule"},{"__symbolic":"reference","module":"./directives","name":"REACTIVE_DRIVEN_DIRECTIVES"}]}]}]},"disableDeprecatedForms":{"__symbolic":"function","parameters":[],"value":[]},"provideForms":{"__symbolic":"function","parameters":[],"value":[{"provide":{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_DIRECTIVES"},"useValue":{"__symbolic":"reference","module":"./directives","name":"FORM_DIRECTIVES"},"multi":true},{"__symbolic":"reference","name":"REACTIVE_FORM_PROVIDERS"}]}}} |
@@ -23,2 +23,3 @@ /** | ||
export { AbstractControlDirective } from './directives/abstract_control_directive'; | ||
export { AbstractFormGroupDirective } from './directives/abstract_form_group_directive'; | ||
export { CheckboxControlValueAccessor } from './directives/checkbox_value_accessor'; | ||
@@ -34,8 +35,9 @@ export { ControlContainer } from './directives/control_container'; | ||
export { NgModelGroup } from './directives/ng_model_group'; | ||
export { FormArrayName } from './directives/reactive_directives/form_array_name'; | ||
export { FormControlDirective } from './directives/reactive_directives/form_control_directive'; | ||
export { FormControlName } from './directives/reactive_directives/form_control_name'; | ||
export { FormGroupDirective } from './directives/reactive_directives/form_group_directive'; | ||
export { FormArrayName } from './directives/reactive_directives/form_group_name'; | ||
export { FormGroupName } from './directives/reactive_directives/form_group_name'; | ||
export { NgSelectOption, SelectControlValueAccessor } from './directives/select_control_value_accessor'; | ||
export { SelectMultipleControlValueAccessor } from './directives/select_multiple_control_value_accessor'; | ||
export { AsyncValidatorFn, MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, Validator, ValidatorFn } from './directives/validators'; | ||
@@ -42,0 +44,0 @@ export { FormBuilder } from './form_builder'; |
@@ -30,2 +30,4 @@ /** | ||
exports.AbstractControlDirective = abstract_control_directive_1.AbstractControlDirective; | ||
var abstract_form_group_directive_1 = require('./directives/abstract_form_group_directive'); | ||
exports.AbstractFormGroupDirective = abstract_form_group_directive_1.AbstractFormGroupDirective; | ||
var checkbox_value_accessor_1 = require('./directives/checkbox_value_accessor'); | ||
@@ -49,4 +51,2 @@ exports.CheckboxControlValueAccessor = checkbox_value_accessor_1.CheckboxControlValueAccessor; | ||
exports.NgModelGroup = ng_model_group_1.NgModelGroup; | ||
var form_array_name_1 = require('./directives/reactive_directives/form_array_name'); | ||
exports.FormArrayName = form_array_name_1.FormArrayName; | ||
var form_control_directive_1 = require('./directives/reactive_directives/form_control_directive'); | ||
@@ -59,6 +59,10 @@ exports.FormControlDirective = form_control_directive_1.FormControlDirective; | ||
var form_group_name_1 = require('./directives/reactive_directives/form_group_name'); | ||
exports.FormGroupName = form_group_name_1.FormGroupName; | ||
exports.FormArrayName = form_group_name_1.FormArrayName; | ||
var form_group_name_2 = require('./directives/reactive_directives/form_group_name'); | ||
exports.FormGroupName = form_group_name_2.FormGroupName; | ||
var select_control_value_accessor_1 = require('./directives/select_control_value_accessor'); | ||
exports.NgSelectOption = select_control_value_accessor_1.NgSelectOption; | ||
exports.SelectControlValueAccessor = select_control_value_accessor_1.SelectControlValueAccessor; | ||
var select_multiple_control_value_accessor_1 = require('./directives/select_multiple_control_value_accessor'); | ||
exports.SelectMultipleControlValueAccessor = select_multiple_control_value_accessor_1.SelectMultipleControlValueAccessor; | ||
var validators_1 = require('./directives/validators'); | ||
@@ -65,0 +69,0 @@ exports.MaxLengthValidator = validators_1.MaxLengthValidator; |
@@ -35,2 +35,3 @@ import { AsyncValidatorFn, ValidatorFn } from './directives/validators'; | ||
valid: boolean; | ||
invalid: boolean; | ||
/** | ||
@@ -53,6 +54,14 @@ * Returns the errors of this control. | ||
clearValidators(): void; | ||
markAsTouched(): void; | ||
markAsTouched({onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
markAsDirty({onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
markAsPristine({onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
markAsUntouched({onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
markAsPending({onlySelf}?: { | ||
@@ -62,2 +71,5 @@ onlySelf?: boolean; | ||
setParent(parent: FormGroup | FormArray): void; | ||
abstract setValue(value: any, options?: Object): void; | ||
abstract patchValue(value: any, options?: Object): void; | ||
abstract reset(value?: any, options?: Object): void; | ||
updateValueAndValidity({onlySelf, emitEvent}?: { | ||
@@ -98,3 +110,7 @@ onlySelf?: boolean; | ||
}): void; | ||
/** | ||
* @deprecated - use get() instead | ||
*/ | ||
find(path: Array<string | number> | string): AbstractControl; | ||
get(path: Array<string | number> | string): AbstractControl; | ||
getError(errorCode: string, path?: string[]): any; | ||
@@ -136,9 +152,35 @@ hasError(errorCode: string, path?: string[]): boolean; | ||
* specified. | ||
* | ||
* If `emitViewToModelChange` is `true`, an ngModelChange event will be fired to update the | ||
* model. This is the default behavior if `emitViewToModelChange` is not specified. | ||
*/ | ||
updateValue(value: any, {onlySelf, emitEvent, emitModelToViewChange}?: { | ||
setValue(value: any, {onlySelf, emitEvent, emitModelToViewChange, emitViewToModelChange}?: { | ||
onlySelf?: boolean; | ||
emitEvent?: boolean; | ||
emitModelToViewChange?: boolean; | ||
emitViewToModelChange?: boolean; | ||
}): void; | ||
/** | ||
* This function is functionally the same as updateValue() at this level. It exists for | ||
* symmetry with patchValue() on FormGroups and FormArrays, where it does behave differently. | ||
*/ | ||
patchValue(value: any, options?: { | ||
onlySelf?: boolean; | ||
emitEvent?: boolean; | ||
emitModelToViewChange?: boolean; | ||
emitViewToModelChange?: boolean; | ||
}): void; | ||
/** | ||
* @deprecated Please use setValue() instead. | ||
*/ | ||
updateValue(value: any, options?: { | ||
onlySelf?: boolean; | ||
emitEvent?: boolean; | ||
emitModelToViewChange?: boolean; | ||
emitViewToModelChange?: boolean; | ||
}): void; | ||
reset(value?: any, {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
/** | ||
* Register a listener for change events. | ||
@@ -198,2 +240,15 @@ */ | ||
contains(controlName: string): boolean; | ||
setValue(value: { | ||
[key: string]: any; | ||
}, {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
patchValue(value: { | ||
[key: string]: any; | ||
}, {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
reset(value?: any, {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
} | ||
@@ -247,2 +302,11 @@ /** | ||
length: number; | ||
setValue(value: any[], {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
patchValue(value: any[], {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
reset(value?: any, {onlySelf}?: { | ||
onlySelf?: boolean; | ||
}): void; | ||
} |
238
src/model.js
@@ -14,5 +14,7 @@ /** | ||
}; | ||
var PromiseObservable_1 = require('rxjs/observable/PromiseObservable'); | ||
var shared_1 = require('./directives/shared'); | ||
var async_1 = require('./facade/async'); | ||
var collection_1 = require('./facade/collection'); | ||
var exceptions_1 = require('./facade/exceptions'); | ||
var lang_1 = require('./facade/lang'); | ||
@@ -36,7 +38,7 @@ /** | ||
exports.isControl = isControl; | ||
function _find(control, path) { | ||
function _find(control, path, delimiter) { | ||
if (lang_1.isBlank(path)) | ||
return null; | ||
if (!(path instanceof Array)) { | ||
path = path.split('/'); | ||
path = path.split(delimiter); | ||
} | ||
@@ -59,3 +61,3 @@ if (path instanceof Array && collection_1.ListWrapper.isEmpty(path)) | ||
function toObservable(r) { | ||
return lang_1.isPromise(r) ? async_1.ObservableWrapper.fromPromise(r) : r; | ||
return lang_1.isPromise(r) ? PromiseObservable_1.PromiseObservable.create(r) : r; | ||
} | ||
@@ -93,2 +95,7 @@ function coerceToValidator(validator) { | ||
}); | ||
Object.defineProperty(AbstractControl.prototype, "invalid", { | ||
get: function () { return this._status === exports.INVALID; }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(AbstractControl.prototype, "errors", { | ||
@@ -145,3 +152,10 @@ /** | ||
AbstractControl.prototype.clearValidators = function () { this.validator = null; }; | ||
AbstractControl.prototype.markAsTouched = function () { this._touched = true; }; | ||
AbstractControl.prototype.markAsTouched = function (_a) { | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
onlySelf = lang_1.normalizeBool(onlySelf); | ||
this._touched = true; | ||
if (lang_1.isPresent(this._parent) && !onlySelf) { | ||
this._parent.markAsTouched({ onlySelf: onlySelf }); | ||
} | ||
}; | ||
AbstractControl.prototype.markAsDirty = function (_a) { | ||
@@ -155,2 +169,18 @@ var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
}; | ||
AbstractControl.prototype.markAsPristine = function (_a) { | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
this._pristine = true; | ||
this._forEachChild(function (control) { control.markAsPristine({ onlySelf: true }); }); | ||
if (lang_1.isPresent(this._parent) && !onlySelf) { | ||
this._parent._updatePristine({ onlySelf: onlySelf }); | ||
} | ||
}; | ||
AbstractControl.prototype.markAsUntouched = function (_a) { | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
this._touched = false; | ||
this._forEachChild(function (control) { control.markAsUntouched({ onlySelf: true }); }); | ||
if (lang_1.isPresent(this._parent) && !onlySelf) { | ||
this._parent._updateTouched({ onlySelf: onlySelf }); | ||
} | ||
}; | ||
AbstractControl.prototype.markAsPending = function (_a) { | ||
@@ -176,4 +206,4 @@ var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
if (emitEvent) { | ||
async_1.ObservableWrapper.callEmit(this._valueChanges, this._value); | ||
async_1.ObservableWrapper.callEmit(this._statusChanges, this._status); | ||
this._valueChanges.emit(this._value); | ||
this._statusChanges.emit(this._status); | ||
} | ||
@@ -193,3 +223,3 @@ if (lang_1.isPresent(this._parent) && !onlySelf) { | ||
var obs = toObservable(this.asyncValidator(this)); | ||
this._asyncValidationSubscription = async_1.ObservableWrapper.subscribe(obs, function (res) { return _this.setErrors(res, { emitEvent: emitEvent }); }); | ||
this._asyncValidationSubscription = obs.subscribe({ next: function (res) { return _this.setErrors(res, { emitEvent: emitEvent }); } }); | ||
} | ||
@@ -199,3 +229,3 @@ }; | ||
if (lang_1.isPresent(this._asyncValidationSubscription)) { | ||
async_1.ObservableWrapper.dispose(this._asyncValidationSubscription); | ||
this._asyncValidationSubscription.unsubscribe(); | ||
} | ||
@@ -232,3 +262,7 @@ }; | ||
}; | ||
AbstractControl.prototype.find = function (path) { return _find(this, path); }; | ||
/** | ||
* @deprecated - use get() instead | ||
*/ | ||
AbstractControl.prototype.find = function (path) { return _find(this, path, '/'); }; | ||
AbstractControl.prototype.get = function (path) { return _find(this, path, '.'); }; | ||
AbstractControl.prototype.getError = function (errorCode, path) { | ||
@@ -263,3 +297,3 @@ if (path === void 0) { path = null; } | ||
if (emitEvent) { | ||
async_1.ObservableWrapper.callEmit(this._statusChanges, this._status); | ||
this._statusChanges.emit(this._status); | ||
} | ||
@@ -284,2 +318,30 @@ if (lang_1.isPresent(this._parent)) { | ||
}; | ||
/** @internal */ | ||
AbstractControl.prototype._anyControlsHaveStatus = function (status) { | ||
return this._anyControls(function (control) { return control.status == status; }); | ||
}; | ||
/** @internal */ | ||
AbstractControl.prototype._anyControlsDirty = function () { | ||
return this._anyControls(function (control) { return control.dirty; }); | ||
}; | ||
/** @internal */ | ||
AbstractControl.prototype._anyControlsTouched = function () { | ||
return this._anyControls(function (control) { return control.touched; }); | ||
}; | ||
/** @internal */ | ||
AbstractControl.prototype._updatePristine = function (_a) { | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
this._pristine = !this._anyControlsDirty(); | ||
if (lang_1.isPresent(this._parent) && !onlySelf) { | ||
this._parent._updatePristine({ onlySelf: onlySelf }); | ||
} | ||
}; | ||
/** @internal */ | ||
AbstractControl.prototype._updateTouched = function (_a) { | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
this._touched = this._anyControlsTouched(); | ||
if (lang_1.isPresent(this._parent) && !onlySelf) { | ||
this._parent._updateTouched({ onlySelf: onlySelf }); | ||
} | ||
}; | ||
return AbstractControl; | ||
@@ -330,10 +392,14 @@ }()); | ||
* specified. | ||
* | ||
* If `emitViewToModelChange` is `true`, an ngModelChange event will be fired to update the | ||
* model. This is the default behavior if `emitViewToModelChange` is not specified. | ||
*/ | ||
FormControl.prototype.updateValue = function (value, _a) { | ||
FormControl.prototype.setValue = function (value, _a) { | ||
var _this = this; | ||
var _b = _a === void 0 ? {} : _a, onlySelf = _b.onlySelf, emitEvent = _b.emitEvent, emitModelToViewChange = _b.emitModelToViewChange; | ||
var _b = _a === void 0 ? {} : _a, onlySelf = _b.onlySelf, emitEvent = _b.emitEvent, emitModelToViewChange = _b.emitModelToViewChange, emitViewToModelChange = _b.emitViewToModelChange; | ||
emitModelToViewChange = lang_1.isPresent(emitModelToViewChange) ? emitModelToViewChange : true; | ||
emitViewToModelChange = lang_1.isPresent(emitViewToModelChange) ? emitViewToModelChange : true; | ||
this._value = value; | ||
if (this._onChange.length && emitModelToViewChange) { | ||
this._onChange.forEach(function (changeFn) { return changeFn(_this._value); }); | ||
this._onChange.forEach(function (changeFn) { return changeFn(_this._value, emitViewToModelChange); }); | ||
} | ||
@@ -343,2 +409,24 @@ this.updateValueAndValidity({ onlySelf: onlySelf, emitEvent: emitEvent }); | ||
/** | ||
* This function is functionally the same as updateValue() at this level. It exists for | ||
* symmetry with patchValue() on FormGroups and FormArrays, where it does behave differently. | ||
*/ | ||
FormControl.prototype.patchValue = function (value, options) { | ||
if (options === void 0) { options = {}; } | ||
this.setValue(value, options); | ||
}; | ||
/** | ||
* @deprecated Please use setValue() instead. | ||
*/ | ||
FormControl.prototype.updateValue = function (value, options) { | ||
if (options === void 0) { options = {}; } | ||
this.setValue(value, options); | ||
}; | ||
FormControl.prototype.reset = function (value, _a) { | ||
if (value === void 0) { value = null; } | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
this.markAsPristine({ onlySelf: onlySelf }); | ||
this.markAsUntouched({ onlySelf: onlySelf }); | ||
this.setValue(value, { onlySelf: onlySelf }); | ||
}; | ||
/** | ||
* @internal | ||
@@ -350,3 +438,3 @@ */ | ||
*/ | ||
FormControl.prototype._anyControlsHaveStatus = function (status) { return false; }; | ||
FormControl.prototype._anyControls = function (condition) { return false; }; | ||
/** | ||
@@ -356,2 +444,6 @@ * Register a listener for change events. | ||
FormControl.prototype.registerOnChange = function (fn) { this._onChange.push(fn); }; | ||
/** | ||
* @internal | ||
*/ | ||
FormControl.prototype._forEachChild = function (cb) { }; | ||
return FormControl; | ||
@@ -434,6 +526,49 @@ }(AbstractControl)); | ||
}; | ||
FormGroup.prototype.setValue = function (value, _a) { | ||
var _this = this; | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
this._checkAllValuesPresent(value); | ||
collection_1.StringMapWrapper.forEach(value, function (newValue, name) { | ||
_this._throwIfControlMissing(name); | ||
_this.controls[name].setValue(newValue, { onlySelf: true }); | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
}; | ||
FormGroup.prototype.patchValue = function (value, _a) { | ||
var _this = this; | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
collection_1.StringMapWrapper.forEach(value, function (newValue, name) { | ||
if (_this.controls[name]) { | ||
_this.controls[name].patchValue(newValue, { onlySelf: true }); | ||
} | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
}; | ||
FormGroup.prototype.reset = function (value, _a) { | ||
if (value === void 0) { value = {}; } | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
this._forEachChild(function (control, name) { | ||
control.reset(value[name], { onlySelf: true }); | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
this._updatePristine({ onlySelf: onlySelf }); | ||
this._updateTouched({ onlySelf: onlySelf }); | ||
}; | ||
/** @internal */ | ||
FormGroup.prototype._throwIfControlMissing = function (name) { | ||
if (!Object.keys(this.controls).length) { | ||
throw new exceptions_1.BaseException("\n There are no form controls registered with this group yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n "); | ||
} | ||
if (!this.controls[name]) { | ||
throw new exceptions_1.BaseException("Cannot find form control with name: " + name + "."); | ||
} | ||
}; | ||
/** @internal */ | ||
FormGroup.prototype._forEachChild = function (cb) { | ||
collection_1.StringMapWrapper.forEach(this.controls, cb); | ||
}; | ||
/** @internal */ | ||
FormGroup.prototype._setParentForControls = function () { | ||
var _this = this; | ||
collection_1.StringMapWrapper.forEach(this.controls, function (control, name) { control.setParent(_this); }); | ||
this._forEachChild(function (control, name) { control.setParent(_this); }); | ||
}; | ||
@@ -443,7 +578,7 @@ /** @internal */ | ||
/** @internal */ | ||
FormGroup.prototype._anyControlsHaveStatus = function (status) { | ||
FormGroup.prototype._anyControls = function (condition) { | ||
var _this = this; | ||
var res = false; | ||
collection_1.StringMapWrapper.forEach(this.controls, function (control, name) { | ||
res = res || (_this.contains(name) && control.status == status); | ||
this._forEachChild(function (control, name) { | ||
res = res || (_this.contains(name) && condition(control)); | ||
}); | ||
@@ -463,3 +598,3 @@ return res; | ||
var res = initValue; | ||
collection_1.StringMapWrapper.forEach(this.controls, function (control, name) { | ||
this._forEachChild(function (control, name) { | ||
if (_this._included(name)) { | ||
@@ -476,2 +611,10 @@ res = fn(res, control, name); | ||
}; | ||
/** @internal */ | ||
FormGroup.prototype._checkAllValuesPresent = function (value) { | ||
this._forEachChild(function (control, name) { | ||
if (value[name] === undefined) { | ||
throw new exceptions_1.BaseException("Must supply a value for form control with name: '" + name + "'."); | ||
} | ||
}); | ||
}; | ||
return FormGroup; | ||
@@ -550,7 +693,50 @@ }(AbstractControl)); | ||
}); | ||
FormArray.prototype.setValue = function (value, _a) { | ||
var _this = this; | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
this._checkAllValuesPresent(value); | ||
value.forEach(function (newValue, index) { | ||
_this._throwIfControlMissing(index); | ||
_this.at(index).setValue(newValue, { onlySelf: true }); | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
}; | ||
FormArray.prototype.patchValue = function (value, _a) { | ||
var _this = this; | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
value.forEach(function (newValue, index) { | ||
if (_this.at(index)) { | ||
_this.at(index).patchValue(newValue, { onlySelf: true }); | ||
} | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
}; | ||
FormArray.prototype.reset = function (value, _a) { | ||
if (value === void 0) { value = []; } | ||
var onlySelf = (_a === void 0 ? {} : _a).onlySelf; | ||
this._forEachChild(function (control, index) { | ||
control.reset(value[index], { onlySelf: true }); | ||
}); | ||
this.updateValueAndValidity({ onlySelf: onlySelf }); | ||
this._updatePristine({ onlySelf: onlySelf }); | ||
this._updateTouched({ onlySelf: onlySelf }); | ||
}; | ||
/** @internal */ | ||
FormArray.prototype._throwIfControlMissing = function (index) { | ||
if (!this.controls.length) { | ||
throw new exceptions_1.BaseException("\n There are no form controls registered with this array yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n "); | ||
} | ||
if (!this.at(index)) { | ||
throw new exceptions_1.BaseException("Cannot find form control at index " + index); | ||
} | ||
}; | ||
/** @internal */ | ||
FormArray.prototype._forEachChild = function (cb) { | ||
this.controls.forEach(function (control, index) { cb(control, index); }); | ||
}; | ||
/** @internal */ | ||
FormArray.prototype._updateValue = function () { this._value = this.controls.map(function (control) { return control.value; }); }; | ||
/** @internal */ | ||
FormArray.prototype._anyControlsHaveStatus = function (status) { | ||
return this.controls.some(function (c) { return c.status == status; }); | ||
FormArray.prototype._anyControls = function (condition) { | ||
return this.controls.some(function (control) { return condition(control); }); | ||
}; | ||
@@ -560,4 +746,12 @@ /** @internal */ | ||
var _this = this; | ||
this.controls.forEach(function (control) { control.setParent(_this); }); | ||
this._forEachChild(function (control) { control.setParent(_this); }); | ||
}; | ||
/** @internal */ | ||
FormArray.prototype._checkAllValuesPresent = function (value) { | ||
this._forEachChild(function (control, i) { | ||
if (value[i] === undefined) { | ||
throw new exceptions_1.BaseException("Must supply a value for form control at index: " + i + "."); | ||
} | ||
}); | ||
}; | ||
return FormArray; | ||
@@ -564,0 +758,0 @@ }(AbstractControl)); |
@@ -10,6 +10,5 @@ /** | ||
var core_1 = require('@angular/core'); | ||
var async_1 = require('./facade/async'); | ||
var toPromise_1 = require('rxjs/operator/toPromise'); | ||
var collection_1 = require('./facade/collection'); | ||
var lang_1 = require('./facade/lang'); | ||
var promise_1 = require('./facade/promise'); | ||
/** | ||
@@ -36,4 +35,3 @@ * Providers for validators to be used for {@link FormControl}s in a form. | ||
*/ | ||
exports.NG_ASYNC_VALIDATORS = | ||
/*@ts2dart_const*/ new core_1.OpaqueToken('NgAsyncValidators'); | ||
exports.NG_ASYNC_VALIDATORS = new core_1.OpaqueToken('NgAsyncValidators'); | ||
/** | ||
@@ -129,3 +127,3 @@ * Provides a set of validators used by form controls. | ||
var promises = _executeAsyncValidators(control, presentValidators).map(_convertToPromise); | ||
return promise_1.PromiseWrapper.all(promises).then(_mergeErrors); | ||
return Promise.all(promises).then(_mergeErrors); | ||
}; | ||
@@ -137,3 +135,3 @@ }; | ||
function _convertToPromise(obj) { | ||
return lang_1.isPromise(obj) ? obj : async_1.ObservableWrapper.toPromise(obj); | ||
return lang_1.isPromise(obj) ? obj : toPromise_1.toPromise.call(obj); | ||
} | ||
@@ -140,0 +138,0 @@ function _executeValidators(control, validators) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1384811
295
16406