External Identifier as component with copy to clipboard (#1774)
Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
d0bc11256d
commit
f459b1ae4e
@@ -0,0 +1,5 @@
|
||||
<span (mouseenter)="mouseEnter()" (mouseleave)="mouseLeave()">
|
||||
<span class="m-l-5" *ngIf="displayL && iconVisible" (click)="copyValue()"><b><fa-icon icon="copy" size="sm" title="Copy Account Number"></fa-icon></b></span>
|
||||
<span class="m-l-5"><b>{{ entityName }}</b></span>
|
||||
<span class="m-l-3" *ngIf="displayR && iconVisible" (click)="copyValue()"><b><fa-icon icon="copy" size="sm" title="Copy Account Number"></fa-icon></b></span>
|
||||
</span>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { EntityNameComponent } from './entity-name.component';
|
||||
|
||||
describe('EntityNameComponent', () => {
|
||||
let component: EntityNameComponent;
|
||||
let fixture: ComponentFixture<EntityNameComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ EntityNameComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(EntityNameComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Clipboard } from '@angular/cdk/clipboard';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-entity-name',
|
||||
templateUrl: './entity-name.component.html',
|
||||
styleUrls: ['./entity-name.component.scss']
|
||||
})
|
||||
export class EntityNameComponent implements OnInit {
|
||||
|
||||
@Input() entityName: string;
|
||||
@Input() display = 'right';
|
||||
|
||||
iconVisible = false;
|
||||
displayL = false;
|
||||
displayR = true;
|
||||
|
||||
constructor(private clipboard: Clipboard) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.displayL = (this.display === 'left');
|
||||
this.displayR = (this.display === 'right');
|
||||
}
|
||||
|
||||
copyValue(): void {
|
||||
this.clipboard.copy(this.entityName);
|
||||
}
|
||||
|
||||
mouseEnter() {
|
||||
this.iconVisible = true;
|
||||
}
|
||||
|
||||
mouseLeave() {
|
||||
this.iconVisible = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user