76 Commits

Author SHA1 Message Date
lazarljubenovic
6c7467a58b perf(forms): optimize internal method _anyControls in FormGroup (#32534)
The method was previously looping through all controls, even after finding at least one that
satisfies the provided condition. This can be a bottleneck with large forms. The new version
of the method returns as soon as a single control which conforms to the condition is found.

PR Close #32534
2020-06-15 14:31:48 -07:00
lazarljubenovic
c7c0c1f626 refactor(forms): use a type guard to get rid of casts (#32541)
Use an explicit type guard when checking if a given object is of type AbstractControlOptions,
instead of a simple function returning a boolean value. This allows us to remove manual type
casting when using this function, relying instead on TypeScript to infer correct types.

PR Close #32541
2020-06-03 12:29:26 -07:00
Joey Perrott
6f829180f7 build: update license headers to reference Google LLC (#37205)
Update the license headers throughout the repository to reference Google LLC
rather than Google Inc, for the required license headers.

PR Close #37205
2020-05-26 14:27:01 -04:00
Judy Bogart
0075017b43 docs: update reactive forms page (#35969)
PR Close #35969
2020-04-07 15:24:17 -07:00
Stanislav Usov
4a18428de6 docs(forms): Remove unnecessary repeating periods (#36474)
PR Close #36474
2020-04-07 11:35:43 -07:00
Andrew Kushnir
7d0af179e3 style(forms): reformat of the forms package after clang update (#36466)
PR Close #36466
2020-04-07 09:47:09 -07:00
Kara Erickson
eef047bc5f fix(forms): change Array.reduce usage to Array.forEach (#35349)
There is currently a bug in Chrome 80 that makes Array.reduce
not work according to spec. The functionality in forms that
retrieves controls from FormGroups and FormArrays (`form.get`)
relied on Array.reduce, so the Chrome bug broke forms for
many users.

This commit refactors our forms code to rely on Array.forEach
instead of Array.reduce to fix forms while we are waiting
for the Chrome fix to go live.

See https://bugs.chromium.org/p/chromium/issues/detail?id=1049982.

PR Close #35349
2020-02-11 17:02:52 -08:00
ajitsinghkaler
fa8d324929 docs: value changes emits on additional events documented (#34497)
The value changes emitted additionally when enable disable were called
documented the above behaviour in AbstractControl class documentaion

Fixes #34407

PR Close #34497
2020-01-23 13:57:46 -08:00
7006
18d89c9c89 docs(forms): remove redundant word (#34584)
PR Close #34584
2020-01-07 10:59:51 -08:00
Colum Ferry
403bb6bee3 docs(forms): fix grammar and add clarification to setValue docs (#33126)
Changed `setValue` documentation for throwing an error as it contained a grammar
mistake and also may have caused ambiguity around when exactly the
method would throw.

PR Close #33126
2019-10-21 15:58:38 -04:00
Nikita Potapenko
f54adf10b5 refactor(forms): replace instanceof Array (#33078)
PR Close #33078
2019-10-10 15:24:45 -07:00
Danny Skoog
6ab5f3648a refactor: utilize type narrowing (#33075)
PR Close #33075
2019-10-10 15:18:44 -07:00
lazarljubenovic
18798a1cb2 docs(forms): correct parameter names in jsdoc (#32530)
PR Close #32530
2019-09-09 15:55:42 -04:00
Paul Gschwendtner
221cbd0b47 refactor(forms): ensure compatibility with typescript strict flag (#30993)
As part of FW-1265, the `@angular/forms` package is made compatible
with the TypeScript `--strict` flag. Read more about the strict flag [here](https://www.typescriptlang.org/docs/handbook/compiler-options.html)

PR Close #30993
2019-07-18 14:21:26 -07:00
Judy Bogart
54794f9b31 docs: clarify docs for runtime validation change (#31596)
PR Close #31596
2019-07-16 23:58:11 -04:00
Ly-lns
d2c83ea81b docs(forms): add comment of the value (#29898)
PR Close #29898
2019-05-09 11:25:58 -07:00
John Reese
e769f9cfe4 docs(forms): fix small typo in forms documentation (#29370)
PR Close #29370
2019-03-19 13:11:11 -04:00
Renan Montebelo
fc305305e1 docs(forms): adding clear method to FormArray documentation (#29180)
PR Close #29180
2019-03-08 12:39:18 -08:00
Renan Montebelo
a68b1a1894 feat(forms): clear (remove all) components from a FormArray (#28918)
This method is a more convenient and efficient way of removing all
components from a FormArray. Before it, we needed to loop the FormArray
removing each component until empty.

Resolves #18531

PR Close #28918
2019-03-07 19:52:49 -08:00
Artem Lanovyy
1df3aefb81 fix(forms): mark form as pristine before emitting value and status change events (#28395)
BREAKING CHANGE

Previous to this change, when a control was reset, value and status change
events would be emitted before the control was reset to pristine. As a
result, if one were to check a control's pristine state in a valueChange
listener, it would appear that the control was still dirty after reset.

This change delays emission of value and status change events until after
controls have been marked pristine. This means the pristine state will be
reset as expected if one checks in a listener.

Theoretically, there could be applications depending on checking whether a
control *used to be dirty*, so this is marked as breaking. In these cases,
apps should cache the state on the app side before calling reset.

Fixes #28130

PR Close #28395
2019-02-13 19:17:35 -08: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
Pete Bacon Darwin
9a128a8068 docs(forms): fix up @see tags for AbstractContol (#28069)
PR Close #28069
2019-01-11 14:35:23 -08:00
Fabian Wiles
1b0b36d143 fix(forms): match getError and hasError to get method signature (#20211)
Internally getError and hasError call the AbstractControl#get method which takes  `path: Array<string | number> | string` as input, since there are different ways to traverse the AbstractControl tree.
This change matches the method signitures of all methods that use this.

PR Close #20211
2019-01-03 10:16:06 -08:00
Kara Erickson
e268a0579a docs(forms): update desc for hasError and getError (#27861)
This commit adds docs for the changes made in #20211.

Closes #19734.

PR Close #27861
2019-01-03 10:15:23 -08:00
Brandon Roberts
a433baf99a docs(forms): update API reference for validator directives (#26926)
PR Close #26926
2018-12-17 16:45:35 -08:00
Nick Tobolski
975c269752 docs(forms): language correction (#27177)
Word missing from docs
PR Close #27177
2018-11-20 10:46:34 -08:00
Huáng Jùnliàng
34306c356e docs(forms): close markdown backticks (#27189)
PR Close #27189
2018-11-20 10:45:16 -08:00
Pete Bacon Darwin
982bc7f2aa docs: update forms with @publicApi tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin
24521f549c docs: convert all @experimental tags to @publicApi tags (#26595)
PR Close #26595
2018-10-19 14:35:52 -07:00
Frederik Schlemmer
1e02cd9961 docs: Fixes typo in FormArray (#26031)
PR Close #26031
2018-09-24 09:14:07 -07:00
Pete Bacon Darwin
7d39bc68fb docs(forms): move extended text to @usageNotes (#26039)
Headings are not allowed in the basic description block.

PR Close #26039
2018-09-24 09:11:02 -07:00
George Wilde
ddd3bf83c7 docs(forms): change documentation of the FormGroup patchValue method (#25901)
Improve the grammar of the description to make it more readable.
PR Close #25901
2018-09-18 13:08:05 -07:00
denjamal
3f6fc00d73 docs(forms): fix incorrect variables naming in the comments (#25150)
PR Close #25150
2018-07-31 11:42:15 -07:00
Brandon Roberts
80a74b450a docs(forms): update form builder API reference (#24693)
PR Close #24693
2018-07-12 16:38:26 -04:00
Rado Kirov
c95437f15d build(bazel): Turning on strictPropertyInitialization for Angular. (#24572)
All errors for existing fields have been detected and suppressed with a
`!` assertion.

Issue/24571 is tracking proper clean up of those instances.

One-line change required in ivy/compilation.ts, because it appears that
the new syntax causes tsickle emitted node to no longer track their
original sourceFiles.

PR Close #24572
2018-06-25 07:57:13 -07:00
Brandon Roberts
5b76f04b7f docs: More edits (#24255)
PR Close #24255
2018-06-19 10:53:13 -07:00
Brandon Roberts
a57825acf3 docs: More form control API edits (#24255)
PR Close #24255
2018-06-19 10:53:13 -07:00
Brandon Roberts
efc7639352 docs: Added multicast to observable descriptions (#24255)
PR Close #24255
2018-06-19 10:53:13 -07:00
Brandon Roberts
3e26cabe02 docs: formatting (#24255)
PR Close #24255
2018-06-19 10:53:13 -07:00
Brandon Roberts
9d114c052a docs: More form control API references fixes (#24255)
PR Close #24255
2018-06-19 10:53:13 -07:00
Brandon Roberts
43e61c25e1 docs(docs-infra): Update with review changes (#24255)
PR Close #24255
2018-06-19 10:53:13 -07:00
Brandon Roberts
4e1493a1d6 docs(forms): update API reference for FormControl (#24255)
PR Close #24255
2018-06-19 10:53:13 -07:00
Trotyl
9367e91402 fix(forms): properly handle special properties in FormGroup.get (#22249)
closes #17195

PR Close #22249
2018-06-05 18:28:13 -07:00
Johnson Lin
b86d4dee4d docs(forms): fix API doc (#24210)
closes #24090

PR Close #24210
2018-05-30 17:06:12 -07:00
Pete Bacon Darwin
4b96a58c5a docs: remove all deprecated @stable jsdoc tags (#23210)
These are no longer needed as stable docs are computed as those that
do not have `@experimental` or `@deprecated` tags.

PR Close #23210
2018-04-10 21:49:32 -07:00
Pete Bacon Darwin
92821e338b docs(forms): remove unnecessary {@link Injector} jsdoc tags (#23186)
Inline code blocks are automatically linked, if possible, to their API
page.

PR Close #23186
2018-04-05 09:27:29 -07:00
Pete Bacon Darwin
1aef4df127 docs(forms): migrate @whatItDoes tags to the description (#23186)
We get the overview for the doc by splitting off the first
paragraph.

PR Close #23186
2018-04-05 09:27:29 -07:00
Pete Bacon Darwin
0a065bbdcf docs(forms): migrate deprecated @howToUse tags (#23186)
In this case they have been converted to `@description` tags.

PR Close #23186
2018-04-05 09:27:29 -07:00
Igor Minar
b43f8bc7d3 feat(core): upgrade rxjs to 6.0.0-alpha.4 (#22573)
PR Close #22573
2018-03-19 21:51:51 -07:00