-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(behaviors): abstract disableRipple inputs and create mixin for r…
…euse (#762)
- Loading branch information
1 parent
d3c8d1b
commit df4fbf1
Showing
6 changed files
with
47 additions
and
46 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/platform/core/common/behaviors/disable-ripple.mixin.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Constructor } from './constructor'; | ||
import { coerceBooleanProperty } from '@angular/cdk'; | ||
|
||
/** Interface to implement when applying the disabled mixin */ | ||
export interface ICanDisableRipple { | ||
disableRipple: boolean; | ||
onDisableRippleChange(v: boolean): void; | ||
} | ||
|
||
/** Mixin to augment a component or directive with a `disabled` property. */ | ||
export function mixinDisableRipple<T extends Constructor<{}>>(base: T): Constructor<ICanDisableRipple> & T { | ||
return class extends base { | ||
private _disableRipple: boolean = false; | ||
|
||
constructor(...args: any[]) { | ||
super(...args); | ||
} | ||
|
||
get disableRipple(): boolean { | ||
return this._disableRipple; | ||
} | ||
set disableRipple(value: boolean) { | ||
let newValue: boolean = coerceBooleanProperty(value); | ||
if (this._disableRipple !== newValue) { | ||
this._disableRipple = newValue; | ||
this.onDisableRippleChange(this._disableRipple); | ||
} | ||
} | ||
|
||
onDisableRippleChange(v: boolean): void { | ||
/** NOT IMPLEMENTED, this needs to be overriden by subclasses if needed */ | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 4 additions & 10 deletions
14
src/platform/core/steps/step-header/step-header.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters