Commit Graph

19 Commits

Author SHA1 Message Date
Igor Minar 6ece7db37a build: TypeScript 3.5 upgrade (#31615)
https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#typescript-35

PR Close #31615
2019-07-25 17:05:23 -07:00
Paul Gschwendtner 647d7bdd88 refactor: fix typescript strict flag failures in all tests (#30993)
Fixes all TypeScript failures caused by enabling the `--strict`
flag for test source files. We also want to enable the strict
options for tests as the strictness enforcement improves the
overall codehealth, unveiled common issues and additionally it
allows us to enable `strict` in the `tsconfig.json` that is picked
up by IDE's.

PR Close #30993
2019-07-18 14:21:26 -07:00
Martin Sikora ef6728207b fix(forms): don't override form group's dirty state when disabling controls (#24591)
Update packages/forms/src/model.ts

Co-Authored-By: martinsik <martin.sikora.ahoj@gmail.com>

PR Close #24591
2019-01-25 12:59:07 -08:00
alsami 45bf911df8 feat(forms): add `markAllAsTouched()` to `AbstractControl` (#26812)
Add functionality to mark a control and its descendant controls as touched

Closes #19400

PR Close #26812
2019-01-18 10:12:21 -08:00
Fabian Wiles e86b64b620 feat(forms): allow markAsPending to emit events (#20212)
closes #17958

BREAKING CHANGE:
- `AbstractControl#statusChanges` now emits an event of `'PENDING'` when you call `AbstractControl#markAsPending`
- Previously it did not emit an event when you called `markAsPending`
- To migrate you would need to ensure that if you are filtering or checking events from `statusChanges` that you account for the new event when calling `markAsPending`

PR Close #20212
2018-02-22 11:15:33 -08:00
Kevin Fahy 0bcfae7cac fix(forms): prevent event emission on enable/disable when emitEvent is false (#12366) (#21018)
Previously, the emitEvent flag was only checked when emitting on the current control.
Thus, if  the control was part of a hierarchy, events were emitted on the parent and the childrens.
This fixes the issue by properly passing the emitEvent flag to both parent and childrens.

Fixes #12366

PR Close #21018
2018-02-07 12:05:26 -08:00
Misko Hevery 3d50fd7cac build: add bazel test rules for remainder of packages (#21053)
PR Close #21053
2017-12-22 13:10:51 -08:00
Misko Hevery 47e251a80a build: remove `main()` from specs (#21053)
PR Close #21053
2017-12-22 13:10:51 -08:00
Kara ff5c58be6b feat(forms): add default updateOn values for groups and arrays (#18536)
This commit adds support for setting default `updateOn` values
in `FormGroups` and `FormArrays`. If you set `updateOn` to
’blur’` at the group level, all child controls will default to `’blur’`,
unless the child has explicitly specified a different `updateOn` value.

```
const c = new FormGroup({
   one: new FormControl()
}, {updateOn: blur});
```

 It's worth noting that parent groups will always update their value and
validity immediately upon value/validity updates from children. In other
words, if a group is set to update on blur and its children are individually
set to update on change, the group will still update on change with its
children; its default value will simply not be used.
2017-08-09 15:41:53 -07:00
Kara 333a708bb6 feat(forms): add updateOn blur option to FormControls (#18408)
By default, the value and validation status of a `FormControl` updates
whenever its value changes. If an application has heavy validation
requirements, updating on every text change can sometimes be too expensive.

This commit introduces a new option that improves performance by delaying
form control updates until the "blur" event.  To use it, set the `updateOn`
option to `blur` when instantiating the `FormControl`.

```ts
// example without validators
const c = new FormControl(, { updateOn: blur });

// example with validators
const c= new FormControl(, {
   validators: Validators.required,
   updateOn: blur
});
```

Like in AngularJS, setting `updateOn` to `blur` will delay the update of
the value as well as the validation status. Updating value and validity
together keeps the system easy to reason about, as the two will always be
in sync. It's  also worth noting that the value/validation pipeline does
still run when the form is initialized (in order to support initial values).

Closes #7113
2017-08-02 18:10:10 -07:00
Kara Erickson ebef5e697a feat(forms): add options arg to abstract controls
FormControls, FormGroups, and FormArrays now optionally accept an options
object as their second argument. Validators and async validators can be
passed in as part of this options object (though they can still be passed
in as the second and third arg as before).

```ts
const c = new FormControl(, {
   validators: [Validators.required],
   asyncValidators: [myAsyncValidator]
});
```

This commit also adds support for passing arrays of validators and async
validators to FormGroups and FormArrays, which formerly only accepted
individual functions.

```ts
const g = new FormGroup({
   one: new FormControl()
}, [myPasswordValidator, myOtherValidator]);
```

This change paves the way for adding more options to AbstractControls,
such as more fine-grained control of validation timing.
2017-07-31 11:29:32 -07:00
Miško Hevery 57bc245cb4 fix(forms): Update types for TypeScript nullability support
This reverts commit 6d930d2fc5.
2017-04-18 12:07:33 -07:00
Tobias Bosch 6d930d2fc5 Revert "fix(forms): Update types for TypeScript nullability support"
This reverts commit 6649743a2d.

Broke in G3.
2017-04-17 09:56:09 -07:00
Miško Hevery 6649743a2d fix(forms): Update types for TypeScript nullability support
This reverts commit 2e47a0d19f.
2017-04-14 15:10:26 -07:00
Tobias Bosch 2e47a0d19f Revert "fix(forms): Update types for TypeScript nullability support (#15859)" (#15977)
This reverts commit 6a2e08d0a8.
2017-04-13 18:03:42 -07:00
Miško Hevery 6a2e08d0a8 fix(forms): Update types for TypeScript nullability support (#15859) 2017-04-13 17:14:08 -07:00
Kara 26d4ce29e8 fix(forms): ensure observable validators are properly canceled (#15132)
Observable subscriptions from previous validation runs should be canceled
before a new subscription is created for the next validation run.
Currently the subscription that sets the errors is canceled properly,
but the source observable created by the validator is not. While this
does not affect validation status or error setting, the source
observables will incorrectly continue through the pipeline until they
complete. This change ensures that the whole stream is canceled.

AsyncValidatorFn previously had an "any" return type, but now it more
explicitly requires a Promise or Observable return type. We don't
anticipate this causing problems given that any other return type
would have caused a runtime error already.
2017-03-16 10:15:17 -07:00
Jason Aden 8573e36574 build: fix file paths after moving modules/@angular/* to packages/* 2017-03-08 16:29:28 -08:00
Jason Aden 3e51a19983 refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00