Skip to content

Commit c8472e5

Browse files
JeanMecheatscott
authored andcommitted
refactor(forms): deprecate unwanted control events aliases (angular#55698)
This commit deprecates the aliases for the control events to ease the changes in G3 A follow-up commit will remove those deprecated entries. PR Close angular#55698
1 parent b90c6aa commit c8472e5

File tree

5 files changed

+61
-11
lines changed

5 files changed

+61
-11
lines changed

goldens/public-api/forms/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,10 @@ export class PatternValidator extends AbstractValidatorDirective {
800800
}
801801

802802
// @public
803+
export class PristineChangeEvent extends PristineEvent {
804+
}
805+
806+
// @public @deprecated (undocumented)
803807
export class PristineEvent extends ControlEvent {
804808
constructor(pristine: boolean, source: AbstractControl);
805809
// (undocumented)
@@ -894,6 +898,10 @@ export class SelectMultipleControlValueAccessor extends BuiltInControlValueAcces
894898
export type SetDisabledStateOption = 'whenDisabledForLegacyCode' | 'always';
895899

896900
// @public
901+
export class StatusChangeEvent extends StatusEvent {
902+
}
903+
904+
// @public @deprecated (undocumented)
897905
export class StatusEvent extends ControlEvent {
898906
constructor(status: FormControlStatus, source: AbstractControl);
899907
// (undocumented)
@@ -903,6 +911,10 @@ export class StatusEvent extends ControlEvent {
903911
}
904912

905913
// @public
914+
export class TouchedChangeEvent extends TouchedEvent {
915+
}
916+
917+
// @public @deprecated (undocumented)
906918
export class TouchedEvent extends ControlEvent {
907919
constructor(touched: boolean, source: AbstractControl);
908920
// (undocumented)

packages/core/test/bundling/forms_reactive/bundle.golden_symbols.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,9 @@
479479
{
480480
"name": "PristineChangeEvent"
481481
},
482+
{
483+
"name": "PristineEvent"
484+
},
482485
{
483486
"name": "R3Injector"
484487
},
@@ -548,6 +551,9 @@
548551
{
549552
"name": "StatusChangeEvent"
550553
},
554+
{
555+
"name": "StatusEvent"
556+
},
551557
{
552558
"name": "Subject"
553559
},
@@ -587,6 +593,9 @@
587593
{
588594
"name": "TouchedChangeEvent"
589595
},
596+
{
597+
"name": "TouchedEvent"
598+
},
590599
{
591600
"name": "USE_VALUE"
592601
},

packages/core/test/bundling/forms_template_driven/bundle.golden_symbols.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,9 @@
464464
{
465465
"name": "PristineChangeEvent"
466466
},
467+
{
468+
"name": "PristineEvent"
469+
},
467470
{
468471
"name": "R3Injector"
469472
},
@@ -530,6 +533,9 @@
530533
{
531534
"name": "StatusChangeEvent"
532535
},
536+
{
537+
"name": "StatusEvent"
538+
},
533539
{
534540
"name": "Subject"
535541
},
@@ -575,6 +581,9 @@
575581
{
576582
"name": "TouchedChangeEvent"
577583
},
584+
{
585+
"name": "TouchedEvent"
586+
},
578587
{
579588
"name": "USE_VALUE"
580589
},

packages/forms/src/forms.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,12 @@ export {
7676
FormControlStatus,
7777
FormResetEvent,
7878
FormSubmittedEvent,
79-
PristineChangeEvent as PristineEvent,
80-
StatusChangeEvent as StatusEvent,
81-
TouchedChangeEvent as TouchedEvent,
79+
PristineEvent,
80+
StatusEvent,
81+
TouchedEvent,
82+
PristineChangeEvent,
83+
StatusChangeEvent,
84+
TouchedChangeEvent,
8285
ValueChangeEvent,
8386
ɵCoerceStrArrToNumArr,
8487
ɵGetProperty,

packages/forms/src/model/abstract_model.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,10 @@ export class ValueChangeEvent<T> extends ControlEvent<T> {
103103
}
104104

105105
/**
106-
* Event fired when the control's pristine state changes (pristine <=> dirty).
107-
*
108-
* @publicApi
106+
* @deprecated use `PristineChangeEvent` symbol instead.
109107
*/
110-
export class PristineChangeEvent extends ControlEvent {
108+
109+
export class PristineEvent extends ControlEvent {
111110
constructor(
112111
public readonly pristine: boolean,
113112
public readonly source: AbstractControl,
@@ -117,11 +116,17 @@ export class PristineChangeEvent extends ControlEvent {
117116
}
118117

119118
/**
120-
* Event fired when the control's touched status changes (touched <=> untouched).
119+
* Event fired when the control's pristine state changes (pristine <=> dirty).
121120
*
122121
* @publicApi
123122
*/
124-
export class TouchedChangeEvent extends ControlEvent {
123+
124+
export class PristineChangeEvent extends PristineEvent {}
125+
126+
/**
127+
* @deprecated use `TouchedChangeEvent` symbol instead.
128+
*/
129+
export class TouchedEvent extends ControlEvent {
125130
constructor(
126131
public readonly touched: boolean,
127132
public readonly source: AbstractControl,
@@ -131,11 +136,16 @@ export class TouchedChangeEvent extends ControlEvent {
131136
}
132137

133138
/**
134-
* Event fired when the control's status changes.
139+
* Event fired when the control's touched status changes (touched <=> untouched).
135140
*
136141
* @publicApi
137142
*/
138-
export class StatusChangeEvent extends ControlEvent {
143+
export class TouchedChangeEvent extends TouchedEvent {}
144+
145+
/**
146+
* @deprecated use `StatusChangeEvent` symbol instead.
147+
*/
148+
export class StatusEvent extends ControlEvent {
139149
constructor(
140150
public readonly status: FormControlStatus,
141151
public readonly source: AbstractControl,
@@ -144,6 +154,13 @@ export class StatusChangeEvent extends ControlEvent {
144154
}
145155
}
146156

157+
/**
158+
* Event fired when the control's status changes.
159+
*
160+
* @publicApi
161+
*/
162+
export class StatusChangeEvent extends StatusEvent {}
163+
147164
/**
148165
* Event fired when a form is submitted
149166
*

0 commit comments

Comments
 (0)