diff options
author | 2018-07-24 17:34:04 +0300 | |
---|---|---|
committer | 2018-07-25 11:39:10 +0300 | |
commit | a52d50e788792a63e97a9176ab319d53db7a2853 (patch) | |
tree | b1c2222cacf4b8192aea16d1e0315b1f005c5347 /sdc-workflow-designer-ui/src/app/paletx/util/popup.ts | |
parent | 3c2665debb400aef7f0ed9e235698d2ff9f859db (diff) |
Replaced old implementation at root
Old project files and directories has been moved
under 'deprecated-workflow-designer'. The old project
is not built by the CI anymore, but can be still built manually.
New modules/directories have been moved up and integrated with
the CI system.
Change-Id: I1528c792bcbcce9e50bfc294a1328a20e72c91cf
Issue-ID: SDC-1559
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/paletx/util/popup.ts')
-rw-r--r-- | sdc-workflow-designer-ui/src/app/paletx/util/popup.ts | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/sdc-workflow-designer-ui/src/app/paletx/util/popup.ts b/sdc-workflow-designer-ui/src/app/paletx/util/popup.ts deleted file mode 100644 index dacbc0b9..00000000 --- a/sdc-workflow-designer-ui/src/app/paletx/util/popup.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { - Injector, - TemplateRef, - ViewRef, - ViewContainerRef, - Renderer, - ComponentRef, - ComponentFactory, - ComponentFactoryResolver -} from '@angular/core'; - -export class ContentRef { - constructor(public nodes: any[], public viewRef?: ViewRef, public componentRef?: ComponentRef<any>) { - } -} - -export class PopupService<T> { - private _windowFactory: ComponentFactory<T>; - private _windowRef: ComponentRef<T>; - private _contentRef: ContentRef; - - constructor(type: any, private _injector: Injector, private _viewContainerRef: ViewContainerRef, private _renderer: Renderer, - componentFactoryResolver: ComponentFactoryResolver) { - this._windowFactory = componentFactoryResolver.resolveComponentFactory<T>(type); - } - - public open(content?: string | TemplateRef<any>, context?: any): ComponentRef<T> { - if (!this._windowRef) { - this._contentRef = this._getContentRef(content, context); - this._windowRef = - this._viewContainerRef.createComponent(this._windowFactory, 0, this._injector, this._contentRef.nodes); - } - - return this._windowRef; - } - - public close() { - if (this._windowRef) { - this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._windowRef.hostView)); - this._windowRef = null; - - if (this._contentRef.viewRef) { - this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._contentRef.viewRef)); - this._contentRef = null; - } - } - } - - private _getContentRef(content: string | TemplateRef<any>, context?: any): ContentRef { - if (!content) { - return new ContentRef([]); - } else if (content instanceof TemplateRef) { - const viewRef = this._viewContainerRef.createEmbeddedView(<TemplateRef<T>>content, context); - return new ContentRef([viewRef.rootNodes], viewRef); - } else { - return new ContentRef([[this._renderer.createText(null, `${content}`)]]); - } - } -} |