-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(table): support sticky headers, footers, and columns (#11483)
* feat(table): support sticky headers, footers, and columns * review * support rtl sticky columns * move sticky to mixin * add bidi to bazel BUILD for spec * fix prerender; reverse rtl * minor revisions * minor changes for g3 internal tests
- Loading branch information
1 parent
966910a
commit edbbc1b
Showing
34 changed files
with
1,745 additions
and
56 deletions.
There are no files selected for viewing
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,5 @@ | ||
{ | ||
"projects": { | ||
"staging": "material2-dev" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {coerceBooleanProperty} from '@angular/cdk/coercion'; | ||
|
||
/** @docs-private */ | ||
export type Constructor<T> = new(...args: any[]) => T; | ||
|
||
/** | ||
* Interface for a mixin to provide a directive with a function that checks if the sticky input has | ||
* been changed since the last time the function was called. Essentially adds a dirty-check to the | ||
* sticky value. | ||
* @docs-private | ||
*/ | ||
export interface CanStick { | ||
/** Whether sticky positioning should be applied. */ | ||
sticky: boolean; | ||
|
||
/** Whether the sticky input has changed since it was last checked. */ | ||
_hasStickyChanged: boolean; | ||
|
||
/** Whether the sticky value has changed since this was last called. */ | ||
hasStickyChanged(): boolean; | ||
|
||
/** Resets the dirty check for cases where the sticky state has been used without checking. */ | ||
resetStickyChanged(): void; | ||
} | ||
|
||
/** | ||
* Mixin to provide a directive with a function that checks if the sticky input has been | ||
* changed since the last time the function was called. Essentially adds a dirty-check to the | ||
* sticky value. | ||
*/ | ||
export function mixinHasStickyInput<T extends Constructor<{}>>(base: T): | ||
Constructor<CanStick> & T { | ||
return class extends base { | ||
/** Whether sticky positioning should be applied. */ | ||
get sticky(): boolean { return this._sticky; } | ||
set sticky(v: boolean) { | ||
const prevValue = this._sticky; | ||
this._sticky = coerceBooleanProperty(v); | ||
this._hasStickyChanged = prevValue !== this._sticky; | ||
} | ||
_sticky: boolean = false; | ||
|
||
/** Whether the sticky input has changed since it was last checked. */ | ||
_hasStickyChanged: boolean = false; | ||
|
||
/** Whether the sticky value has changed since this was last called. */ | ||
hasStickyChanged(): boolean { | ||
const hasStickyChanged = this._hasStickyChanged; | ||
this._hasStickyChanged = false; | ||
return hasStickyChanged; | ||
} | ||
|
||
/** Resets the dirty check for cases where the sticky state has been used without checking. */ | ||
resetStickyChanged() { | ||
this._hasStickyChanged = false; | ||
} | ||
|
||
constructor(...args: any[]) { super(...args); } | ||
}; | ||
} |
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
Oops, something went wrong.