forked from blackbaud/skyux2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor improvements; autocomplete adapter service (blackbaud#1474)
- Loading branch information
1 parent
483c44e
commit bb6cc83
Showing
13 changed files
with
73 additions
and
44 deletions.
There are no files selected for viewing
Binary file removed
BIN
-2.46 KB
skyux-spa-visual-tests/screenshots-baseline/autocomplete-chrome-1000x800-dpr-1.png
Binary file not shown.
Binary file removed
BIN
-2.28 KB
skyux-spa-visual-tests/screenshots-baseline/autocomplete-chrome-480x800-dpr-1.png
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
skyux-spa-visual-tests/src/app/autocomplete/autocomplete-visual.component.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"name": "skyux2", | ||
"mode": "easy", | ||
"compileMode": "aot" | ||
"compileMode": "aot", | ||
"cssPath": "src/scss/sky.scss" | ||
} |
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,43 @@ | ||
import { | ||
ElementRef, | ||
Injectable, | ||
Renderer2, | ||
RendererFactory2 | ||
} from '@angular/core'; | ||
|
||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/observable/fromEvent'; | ||
|
||
import { | ||
SkyWindowRefService | ||
} from '../window'; | ||
|
||
@Injectable() | ||
export class SkyAutocompleteAdapterService { | ||
private renderer: Renderer2; | ||
|
||
constructor( | ||
private rendererFactory: RendererFactory2, | ||
private windowRef: SkyWindowRefService | ||
) { | ||
this.renderer = this.rendererFactory.createRenderer(undefined, undefined); | ||
} | ||
|
||
public watchDropdownWidth(elementRef: ElementRef): void { | ||
Observable | ||
.fromEvent(this.windowRef.getWindow(), 'resize') | ||
.subscribe(() => { | ||
this.setDropdownWidth(elementRef); | ||
}); | ||
|
||
this.windowRef.getWindow().setTimeout(() => { | ||
this.setDropdownWidth(elementRef); | ||
}); | ||
} | ||
|
||
private setDropdownWidth(elementRef: ElementRef): void { | ||
const dropdownContainer = elementRef.nativeElement.querySelector('.sky-popover-container'); | ||
const width = elementRef.nativeElement.getBoundingClientRect().width; | ||
this.renderer.setStyle(dropdownContainer, 'width', `${width}px`); | ||
} | ||
} |
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
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