Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(forms): deprecate unwanted control events aliases #55698

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions goldens/public-api/forms/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@
{
"name": "PristineChangeEvent"
},
{
"name": "PristineEvent"
},
{
"name": "R3Injector"
},
Expand Down Expand Up @@ -548,6 +551,9 @@
{
"name": "StatusChangeEvent"
},
{
"name": "StatusEvent"
},
{
"name": "Subject"
},
Expand Down Expand Up @@ -587,6 +593,9 @@
{
"name": "TouchedChangeEvent"
},
{
"name": "TouchedEvent"
},
{
"name": "USE_VALUE"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@
{
"name": "PristineChangeEvent"
},
{
"name": "PristineEvent"
},
{
"name": "R3Injector"
},
Expand Down Expand Up @@ -530,6 +533,9 @@
{
"name": "StatusChangeEvent"
},
{
"name": "StatusEvent"
},
{
"name": "Subject"
},
Expand Down Expand Up @@ -575,6 +581,9 @@
{
"name": "TouchedChangeEvent"
},
{
"name": "TouchedEvent"
},
{
"name": "USE_VALUE"
},
Expand Down
9 changes: 6 additions & 3 deletions packages/forms/src/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
33 changes: 25 additions & 8 deletions packages/forms/src/model/abstract_model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,10 @@ export class ValueChangeEvent<T> extends ControlEvent<T> {
}

/**
* Event fired when the control's pristine state changes (pristine <=> dirty).
*
* @publicApi
* @deprecated use `PristineChangeEvent` symbol instead.
*/
export class PristineChangeEvent extends ControlEvent {

export class PristineEvent extends ControlEvent {
constructor(
public readonly pristine: boolean,
public readonly source: AbstractControl,
Expand All @@ -117,11 +116,17 @@ export class PristineChangeEvent extends ControlEvent {
}

/**
* Event fired when the control's touched status changes (touched <=> untouched).
* Event fired when the control's pristine state changes (pristine <=> dirty).
*
* @publicApi
*/
export class TouchedChangeEvent extends ControlEvent {

export class PristineChangeEvent extends PristineEvent {}

/**
* @deprecated use `TouchedChangeEvent` symbol instead.
*/
export class TouchedEvent extends ControlEvent {
constructor(
public readonly touched: boolean,
public readonly source: AbstractControl,
Expand All @@ -131,11 +136,16 @@ export class TouchedChangeEvent extends ControlEvent {
}

/**
* Event fired when the control's status changes.
* Event fired when the control's touched status changes (touched <=> untouched).
*
* @publicApi
*/
export class StatusChangeEvent extends ControlEvent {
export class TouchedChangeEvent extends TouchedEvent {}

/**
* @deprecated use `StatusChangeEvent` symbol instead.
*/
export class StatusEvent extends ControlEvent {
constructor(
public readonly status: FormControlStatus,
public readonly source: AbstractControl,
Expand All @@ -144,6 +154,13 @@ export class StatusChangeEvent extends ControlEvent {
}
}

/**
* Event fired when the control's status changes.
*
* @publicApi
*/
export class StatusChangeEvent extends StatusEvent {}

/**
* Event fired when a form is submitted
*
Expand Down