External Identifier as component with copy to clipboard (#1774)

Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
José Alberto Hernández
2023-06-28 23:19:41 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent d0bc11256d
commit f459b1ae4e
38 changed files with 309 additions and 72 deletions
@@ -1,4 +1,5 @@
import { Component, Input, OnInit } from '@angular/core';
import { Clipboard } from '@angular/cdk/clipboard';
@Component({
selector: 'mifosx-external-identifier',
@@ -7,10 +8,18 @@ import { Component, Input, OnInit } from '@angular/core';
})
export class ExternalIdentifierComponent implements OnInit {
@Input() externalId: string;
@Input() completed = false;
@Input() display = 'right';
constructor() { }
iconVisible = false;
displayL = false;
displayR = true;
constructor(private clipboard: Clipboard) { }
ngOnInit(): void {
this.displayL = (this.display === 'left');
this.displayR = (this.display === 'right');
}
isLongValue(): boolean {
@@ -20,4 +29,15 @@ export class ExternalIdentifierComponent implements OnInit {
return (this.externalId.length > 15);
}
copyValue(): void {
this.clipboard.copy(this.externalId);
}
mouseEnter() {
this.iconVisible = true;
}
mouseLeave() {
this.iconVisible = false;
}
}