Skip to content

Commit

Permalink
fix: migration angular 17
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelDemey committed May 20, 2024
1 parent f2756df commit f648383
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 35 deletions.
20 changes: 12 additions & 8 deletions projects/ngx-cream-lib/src/lib/chip/chip.component.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<span class="chip">
<a *ngIf="linkUrl !== ''" [routerLink]="linkUrl">
{{ label }}
</a>
<span *ngIf="linkUrl === ''">
{{ label }}
</span>


Check failure on line 2 in projects/ngx-cream-lib/src/lib/chip/chip.component.html

View workflow job for this annotation

GitHub Actions / Run linters

Replace `⏎··@if(linkUrl·!==·'')` with `@if·(linkUrl·!==·'')·`
@if(linkUrl !== ''){
<a *ngIf="" [routerLink]="linkUrl">
{{ label }}
</a>
} @else {
<span>
{{ label }}
</span>
}

Check failure on line 11 in projects/ngx-cream-lib/src/lib/chip/chip.component.html

View workflow job for this annotation

GitHub Actions / Run linters

Delete `·`

Check failure on line 12 in projects/ngx-cream-lib/src/lib/chip/chip.component.html

View workflow job for this annotation

GitHub Actions / Run linters

Delete `··`
<button *ngIf="deletable" type="button" [disabled]="disabled" (click)="deleteChip()" [attr.aria-label]="'Delete chip ' + label">
<svg role="img" width="25" height="25" aria-hidden="true">
<use href="./assets/img/sprite.svg#bt-close"></use>
</svg>
<ng-container i18n>Delete</ng-container>
{{ label }}
</button>
</span>
</span>

Check failure on line 20 in projects/ngx-cream-lib/src/lib/chip/chip.component.html

View workflow job for this annotation

GitHub Actions / Run linters

Insert `⏎`
21 changes: 5 additions & 16 deletions projects/ngx-cream-lib/src/lib/chip/chip.component.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
import { Component, OnInit, Input, ElementRef, Renderer2 } from '@angular/core';
import { Component, Input, ElementRef, Renderer2, inject } from '@angular/core';

@Component({
selector: 'c3m-chip',
templateUrl: './chip.component.html',
styleUrls: ['./chip.component.css'],
})
export class ChipComponent implements OnInit {
constructor(private elementRef: ElementRef, private renderer: Renderer2) {
this.chipIdNum = this.randomID();
}
export class ChipComponent {

Check failure on line 9 in projects/ngx-cream-lib/src/lib/chip/chip.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Delete `⏎`
elementRef = inject(ElementRef);
renderer = inject(Renderer2)

Check failure on line 11 in projects/ngx-cream-lib/src/lib/chip/chip.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Insert `;`

@Input() label: string = '';
@Input() deletable: boolean = true;
@Input() disabled: boolean = false;
@Input() linkUrl: string = '';

chipIdNum!: number;
chipId!: string;

ngOnInit() {
this.chipId = 'chip' + this.chipIdNum;
}

deleteChip(): void {
this.renderer.removeChild(this.elementRef.nativeElement.parentNode, this.elementRef.nativeElement);
}

Check failure on line 20 in projects/ngx-cream-lib/src/lib/chip/chip.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Delete `⏎`

randomID() {
const idRandom = Math.round(Math.random() * (20000 - 1) + 1);
return idRandom;
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import { Component, OnInit, Input } from '@angular/core';
import { Component, Input } from '@angular/core';

@Component({
selector: 'c3m-collapsible',
templateUrl: './collapsible.component.html',
styleUrls: ['./collapsible.component.css'],
})
export class CollapsibleComponent implements OnInit {
export class CollapsibleComponent {

Check failure on line 8 in projects/ngx-cream-lib/src/lib/collapsible/collapsible.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Delete `·`
@Input() summary: string = '';
@Input() isOpen: boolean = false;
@Input() total: string = '';

randomIdValue!: number;
panelId: string = '';

ngOnInit(): void {
this.randomIdValue = this.randomID();
this.panelId = 'colpanel-' + this.randomIdValue;
}
panelId = 'colpanel-' + this.randomID()

randomID() {
const idRandom = Math.round(Math.random() * (20000 - 1) + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Component, Input } from '@angular/core';
})
export class ProgressSpinnerComponent {
@Input() progressText!: string;

isOpen: boolean = false;
theId = this.randomID();
spinnerTextId = 'progress' + this.theId;
Expand Down

0 comments on commit f648383

Please sign in to comment.