From 61ee1f1d532c8d03f2b4e57abd5c6bb7432b4350 Mon Sep 17 00:00:00 2001 From: Silviu Popa Date: Wed, 10 Apr 2019 19:03:55 +0300 Subject: [PATCH] [ADF-4386] - fix style and remove value from tooltip (#4587) --- .../components/document-list.component.scss | 10 --------- lib/core/clipboard/clipboard.directive.ts | 21 ++++++------------- .../datatable/datatable.component.scss | 11 ++++++++++ 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/lib/content-services/document-list/components/document-list.component.scss b/lib/content-services/document-list/components/document-list.component.scss index 162c452e22..e7ef29c265 100644 --- a/lib/content-services/document-list/components/document-list.component.scss +++ b/lib/content-services/document-list/components/document-list.component.scss @@ -188,14 +188,4 @@ } } } - - .adf-datatable-copy-tooltip { - position: absolute; - background: mat-color($primary); - color: mat-color($primary, default-contrast) !important; - padding: 5px 10px; - border-radius: 5px; - bottom: 88%; - left:0; - } } diff --git a/lib/core/clipboard/clipboard.directive.ts b/lib/core/clipboard/clipboard.directive.ts index 0ede53291b..8ca6d16f6e 100644 --- a/lib/core/clipboard/clipboard.directive.ts +++ b/lib/core/clipboard/clipboard.directive.ts @@ -15,14 +15,14 @@ * limitations under the License. */ -import { Directive, Input, HostListener, Component, ViewContainerRef, ComponentFactoryResolver, AfterContentInit } from '@angular/core'; +import { Directive, Input, HostListener, Component, ViewContainerRef, ComponentFactoryResolver, ViewEncapsulation } from '@angular/core'; import { ClipboardService } from './clipboard.service'; @Directive({ selector: '[adf-clipboard]', exportAs: 'adfClipboard' }) -export class ClipboardDirective implements AfterContentInit { +export class ClipboardDirective { // tslint:disable-next-line:no-input-rename @Input('adf-clipboard') placeholder: string; @@ -33,8 +33,6 @@ export class ClipboardDirective implements AfterContentInit { // tslint:disable-next-line:no-input-rename @Input('clipboard-notification') message: string; - private value: string; - constructor(private clipboardService: ClipboardService, public viewContainerRef: ViewContainerRef, private resolver: ComponentFactoryResolver) {} @@ -50,7 +48,6 @@ export class ClipboardDirective implements AfterContentInit { showTooltip() { const componentFactory = this.resolver.resolveComponentFactory(ClipboardComponent); const componentRef = this.viewContainerRef.createComponent(componentFactory).instance; - componentRef.copyText = this.value; componentRef.placeholder = this.placeholder; } @@ -72,21 +69,15 @@ export class ClipboardDirective implements AfterContentInit { private copyContentToClipboard(content) { this.clipboardService.copyContentToClipboard(content, this.message); } - - ngAfterContentInit() { - setTimeout( () => { - this.value = this.viewContainerRef.element.nativeElement.innerHTML; - }); - } } @Component({ - selector: 'adf-datatable-highlight-tooltip', + selector: 'adf-datatable-copy-content-tooltip', template: ` - {{ placeholder | translate }} {{ copyText }} - ` + {{ placeholder | translate }} + `, + encapsulation: ViewEncapsulation.None }) export class ClipboardComponent { - copyText: string; placeholder: string; } diff --git a/lib/core/datatable/components/datatable/datatable.component.scss b/lib/core/datatable/components/datatable/datatable.component.scss index 82899d0c33..7df1810b4e 100644 --- a/lib/core/datatable/components/datatable/datatable.component.scss +++ b/lib/core/datatable/components/datatable/datatable.component.scss @@ -557,4 +557,15 @@ } } } + + .adf-datatable-copy-tooltip { + position: absolute; + background: mat-color($primary); + color: mat-color($primary, default-contrast) !important; + padding: 5px 10px; + border-radius: 5px; + bottom: 94%; + left:0; + z-index: 20; + } }