forked from NG-ZORRO/ng-zorro-antd-mobile
-
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.
feat(module: picker): feat create 'Picker' with dynamic (NG-ZORRO#105)
* feat(module: picker): feat create 'Picker' with dynamic feat (module: picker): feat demo-data structure unification feat (module: picker): feat add indicatorStyle * docs(module: picker): uptdate function description * fix(module: picker): fix init default value * feat(module:core): feat add base popup service * docs(module: picker-view): delete unuse description * fix(module:core): fix set providers of PopupService
- Loading branch information
1 parent
ba9e43b
commit 90866df
Showing
16 changed files
with
312 additions
and
127 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
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,35 @@ | ||
import { Injectable, Injector, ViewContainerRef } from '@angular/core'; | ||
import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; | ||
import { ComponentPortal } from '@angular/cdk/portal'; | ||
|
||
@Injectable() | ||
export class PopupService { | ||
static viewContainerRef: ViewContainerRef = null; | ||
static overlay: Overlay = null; | ||
static overlayRef: OverlayRef = null; | ||
|
||
constructor( | ||
public _overlay: Overlay, | ||
public _viewContainerRef: ViewContainerRef | ||
) { | ||
PopupService.viewContainerRef = this._viewContainerRef; | ||
PopupService.overlay = this._overlay; | ||
} | ||
|
||
static showPopup(component, childInjector?: Injector): void { | ||
let overlayConfig = new OverlayConfig(); | ||
overlayConfig.hasBackdrop = true; | ||
PopupService.overlayRef = PopupService.overlay.create(overlayConfig); | ||
PopupService.overlayRef.backdropClick().subscribe(() => { | ||
PopupService.overlayRef.dispose(); | ||
}); | ||
|
||
PopupService.overlayRef.attach(new ComponentPortal(component, PopupService.viewContainerRef, childInjector)); | ||
} | ||
|
||
static hidePopup(): void { | ||
if (PopupService.overlayRef) { | ||
PopupService.overlayRef.dispose(); | ||
} | ||
} | ||
} |
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
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.