refactor(forms): deprecate unwanted control events aliases (#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 #55698
This commit is contained in:
Matthieu Riegler 2024-05-07 02:03:10 +02:00 committed by Andrew Scott
parent b90c6aa2ea
commit c8472e5e9e
5 changed files with 65 additions and 15 deletions

View file

@ -800,6 +800,10 @@ export class PatternValidator extends AbstractValidatorDirective {
}
// @public
export class PristineChangeEvent extends PristineEvent {
}
// @public @deprecated (undocumented)
export class PristineEvent extends ControlEvent {
constructor(pristine: boolean, source: AbstractControl);
// (undocumented)
@ -894,6 +898,10 @@ export class SelectMultipleControlValueAccessor extends BuiltInControlValueAcces
export type SetDisabledStateOption = 'whenDisabledForLegacyCode' | 'always';
// @public
export class StatusChangeEvent extends StatusEvent {
}
// @public @deprecated (undocumented)
export class StatusEvent extends ControlEvent {
constructor(status: FormControlStatus, source: AbstractControl);
// (undocumented)
@ -903,6 +911,10 @@ export class StatusEvent extends ControlEvent {
}
// @public
export class TouchedChangeEvent extends TouchedEvent {
}
// @public @deprecated (undocumented)
export class TouchedEvent extends ControlEvent {
constructor(touched: boolean, source: AbstractControl);
// (undocumented)

View file

@ -479,6 +479,9 @@
{
"name": "PristineChangeEvent"
},
{
"name": "PristineEvent"
},
{
"name": "R3Injector"
},
@ -548,6 +551,9 @@
{
"name": "StatusChangeEvent"
},
{
"name": "StatusEvent"
},
{
"name": "Subject"
},
@ -587,6 +593,9 @@
{
"name": "TouchedChangeEvent"
},
{
"name": "TouchedEvent"
},
{
"name": "USE_VALUE"
},

View file

@ -464,6 +464,9 @@
{
"name": "PristineChangeEvent"
},
{
"name": "PristineEvent"
},
{
"name": "R3Injector"
},
@ -530,6 +533,9 @@
{
"name": "StatusChangeEvent"
},
{
"name": "StatusEvent"
},
{
"name": "Subject"
},
@ -575,6 +581,9 @@
{
"name": "TouchedChangeEvent"
},
{
"name": "TouchedEvent"
},
{
"name": "USE_VALUE"
},

View file

@ -76,9 +76,12 @@ export {
FormControlStatus,
FormResetEvent,
FormSubmittedEvent,
PristineChangeEvent as PristineEvent,
StatusChangeEvent as StatusEvent,
TouchedChangeEvent as TouchedEvent,
PristineEvent,
StatusEvent,
TouchedEvent,
PristineChangeEvent,
StatusChangeEvent,
TouchedChangeEvent,
ValueChangeEvent,
ɵCoerceStrArrToNumArr,
ɵGetProperty,

View file

@ -102,14 +102,33 @@ export class ValueChangeEvent<T> extends ControlEvent<T> {
}
}
/**
* @deprecated use `PristineChangeEvent` symbol instead.
*/
export class PristineEvent extends ControlEvent {
constructor(
public readonly pristine: boolean,
public readonly source: AbstractControl,
) {
super();
}
}
/**
* Event fired when the control's pristine state changes (pristine <=> dirty).
*
* @publicApi
*/
export class PristineChangeEvent extends ControlEvent {
export class PristineChangeEvent extends PristineEvent {}
/**
* @deprecated use `TouchedChangeEvent` symbol instead.
*/
export class TouchedEvent extends ControlEvent {
constructor(
public readonly pristine: boolean,
public readonly touched: boolean,
public readonly source: AbstractControl,
) {
super();
@ -121,9 +140,14 @@ export class PristineChangeEvent extends ControlEvent {
*
* @publicApi
*/
export class TouchedChangeEvent extends ControlEvent {
export class TouchedChangeEvent extends TouchedEvent {}
/**
* @deprecated use `StatusChangeEvent` symbol instead.
*/
export class StatusEvent extends ControlEvent {
constructor(
public readonly touched: boolean,
public readonly status: FormControlStatus,
public readonly source: AbstractControl,
) {
super();
@ -135,14 +159,7 @@ export class TouchedChangeEvent extends ControlEvent {
*
* @publicApi
*/
export class StatusChangeEvent extends ControlEvent {
constructor(
public readonly status: FormControlStatus,
public readonly source: AbstractControl,
) {
super();
}
}
export class StatusChangeEvent extends StatusEvent {}
/**
* Event fired when a form is submitted