Skip to content

Commit 75b72af

Browse files
committed
fix: Update EsmfTableCellLinkComponent
1 parent 19972cc commit 75b72af

File tree

4 files changed

+35
-15
lines changed

4 files changed

+35
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<!-- <%= options.generationDisclaimerText %> -->
22

3-
@let isDisabled = value === null || value === undefined;
4-
<button (click)="openExternalLink()"
5-
[matTooltipDisabled]="!isDisabled"
6-
[class.button-disabled]="isDisabled"
7-
matTooltipPosition="above"
8-
[matTooltip]="tooltipMessage"
9-
mat-icon-button
10-
aria-label="link row">
11-
<mat-icon class="material-icons">open_in_new</mat-icon>
3+
<button
4+
[matTooltipDisabled]="!isDisabled()"
5+
[class.button-disabled]="isDisabled()"
6+
[matTooltip]="tooltipMessage()"
7+
(click)="openExternalLink()"
8+
matTooltipPosition="above"
9+
mat-icon-button
10+
aria-label="link row"
11+
>
12+
<mat-icon class="material-icons">open_in_new</mat-icon>
1213
</button>
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
/** <%= options.generationDisclaimerText %> **/
22

3+
button {
4+
background-color: transparent;
5+
border: none;
6+
color: inherit;
7+
padding: 0;
8+
font: inherit;
9+
cursor: pointer;
10+
outline: inherit;
11+
}
12+
313
.button-disabled {
4-
pointer-events:none;
514
cursor: not-allowed;
615
opacity: 0.4;
716
}
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
/** <%= options.generationDisclaimerText %> **/
22

3-
import {Component, EventEmitter, Input} from '@angular/core';
3+
import {ChangeDetectionStrategy, Component, computed, input, Signal} from '@angular/core';
4+
import {MatTooltipModule} from '@angular/material/tooltip';
5+
import {MatIconModule} from '@angular/material/icon';
46

57
@Component({
68
standalone: true,
79
selector: '<%= dasherize(name) %>',
810
templateUrl: './<%= dasherize(name) %>.component.html',
911
styleUrls: ['./<%= dasherize(name) %>.component.<%= options.style %>'],
10-
changeDetection: ChangeDetectionStrategy.OnPush
12+
changeDetection: ChangeDetectionStrategy.OnPush,
13+
imports: [MatTooltipModule, MatIconModule]
1114
})
1215
export class EsmfTableCellLinkComponent {
13-
value = input.required<string | null>();
16+
value = input.required<string>();
1417
tooltipMessage = input.required<string>();
1518

16-
openExternalLink() {
17-
window.open(this.value, '_blank');
19+
isDisabled: Signal<boolean> = computed(() => this.value() === '-');
20+
21+
openExternalLink() {
22+
if (this.isDisabled()){
23+
return;
1824
}
25+
26+
window.open(this.value(), '_blank');
27+
}
1928
}

Diff for: src/utils/modules.ts

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const tableModules = (options: Schema) => [
8484
{name: 'DragDropModule', fromLib: '@angular/cdk/drag-drop'},
8585
{name: 'NgTemplateOutlet', fromLib: '@angular/common'},
8686
{name: 'DatePipe', fromLib: '@angular/common'},
87+
{name: 'EsmfTableCellLinkComponent', fromLib: '../../table-cell-link/esmf-table-cell-link.component'},
8788
{
8889
name: 'MatCheckboxModule',
8990
fromLib: '@angular/material/checkbox',

0 commit comments

Comments
 (0)