Browse Source

fix comments

pull/6575/head
Erwin-N 1 week ago
committed by Thomas Kaul
parent
commit
ba2e9d8672
  1. 9
      libs/ui/src/lib/value/value.component.html
  2. 4
      libs/ui/src/lib/value/value.component.scss
  3. 38
      libs/ui/src/lib/value/value.component.ts

9
libs/ui/src/lib/value/value.component.html

@ -11,8 +11,13 @@
</ng-template> </ng-template>
<ng-template #copyIcon> <ng-template #copyIcon>
@if (enableCopyToClipboardButton) { @if (enableCopyToClipboardButton) {
<a class="cursor-pointer mdc-copy" (click)="onCopyValueToClipboard()"> <a
<ion-icon class="ml-1 icon-small" name="copy-outline" role="img" /> class="bg-transparent no-min-width"
mat-icon-button
type="button"
(click)="onCopyValueToClipboard()"
>
<ion-icon class="ml-1 icon-small" name="copy-outline" />
</a> </a>
} }
</ng-template> </ng-template>

4
libs/ui/src/lib/value/value.component.scss

@ -7,8 +7,4 @@
font-variant-numeric: initial; font-variant-numeric: initial;
line-height: 1; line-height: 1;
} }
.mdc-copy {
display: inline-flex;
vertical-align: middle;
}
} }

38
libs/ui/src/lib/value/value.component.ts

@ -80,15 +80,6 @@ export class GfValueComponent implements AfterViewInit, OnChanges {
return precision !== undefined && precision >= 0; return precision !== undefined && precision >= 0;
} }
private initializeVariables() {
this.absoluteValue = 0;
this.formattedValue = '';
this.isNumber = false;
this.isString = false;
this.locale = this.locale || getLocale();
this.useAbsoluteValue = false;
}
public ngAfterViewInit() { public ngAfterViewInit() {
const el = this.labelContent.nativeElement; const el = this.labelContent.nativeElement;
this.hasLabel = el.textContent.trim().length > 0 || el.children.length > 0; this.hasLabel = el.textContent.trim().length > 0 || el.children.length > 0;
@ -173,19 +164,22 @@ export class GfValueComponent implements AfterViewInit, OnChanges {
} }
public onCopyValueToClipboard() { public onCopyValueToClipboard() {
if (this.value || this.value === 0) { this.clipboard.copy(this.formattedValue);
this.clipboard.copy(this.formattedValue); this.snackBar.open(
this.snackBar.open( '✅ ' + $localize`Value has been copied to the clipboard`,
'✅ ' + $localize`Value has been copied to the clipboard`, undefined,
undefined, {
{
duration: ms('3 seconds')
}
);
} else {
this.snackBar.open($localize`Value is empty`, undefined, {
duration: ms('3 seconds') duration: ms('3 seconds')
}); }
} );
}
private initializeVariables() {
this.absoluteValue = 0;
this.formattedValue = '';
this.isNumber = false;
this.isString = false;
this.locale = this.locale || getLocale();
this.useAbsoluteValue = false;
} }
} }

Loading…
Cancel
Save