TSK-1510: Update angular-svg-icon from 7.2.1 to 9.2.0

This commit is contained in:
Sofie Hofmann 2021-02-08 12:03:05 +01:00
parent 23734dd187
commit 2a93e44fcb
13 changed files with 50 additions and 40 deletions

9
web/package-lock.json generated
View File

@ -3559,12 +3559,9 @@
"dev": true "dev": true
}, },
"angular-svg-icon": { "angular-svg-icon": {
"version": "7.2.1", "version": "9.2.0",
"resolved": "https://registry.npmjs.org/angular-svg-icon/-/angular-svg-icon-7.2.1.tgz", "resolved": "https://registry.npmjs.org/angular-svg-icon/-/angular-svg-icon-9.2.0.tgz",
"integrity": "sha512-N31QL1IejPqpeMQnuCx92yFLpTZLLsi3ffQ/8HpuP3chevVBbydd5kSmPBYR++awhVUxBB7IOt0VjCJL5TV7xQ==", "integrity": "sha512-ca7dT27kmJYy8vLcRuM8kOzQhLkS+2WOs1kkNw6MoUSyYtYQe0StKAP634Zl/xICPWcka2QtcQ/zSGT7D/jovw=="
"requires": {
"tslib": "^1.9.0"
}
}, },
"angular-tree-component": { "angular-tree-component": {
"version": "8.5.6", "version": "8.5.6",

View File

@ -30,7 +30,7 @@
"@angular/router": "9.1.12", "@angular/router": "9.1.12",
"@ngxs/devtools-plugin": "3.7.1", "@ngxs/devtools-plugin": "3.7.1",
"@ngxs/store": "3.7.1", "@ngxs/store": "3.7.1",
"angular-svg-icon": "7.2.1", "angular-svg-icon": "9.2.0",
"angular-tree-component": "8.5.6", "angular-tree-component": "8.5.6",
"bootstrap": "4.6.0", "bootstrap": "4.6.0",
"core-js": "3.8.3", "core-js": "3.8.3",

View File

@ -4,7 +4,6 @@ import { FormsValidatorService } from '../../../shared/services/forms-validator/
import { Actions, NgxsModule, ofActionDispatched, Store } from '@ngxs/store'; import { Actions, NgxsModule, ofActionDispatched, Store } from '@ngxs/store';
import { Component, DebugElement, EventEmitter, Input, Output } from '@angular/core'; import { Component, DebugElement, EventEmitter, Input, Output } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AngularSvgIconModule } from 'angular-svg-icon';
import { RequestInProgressService } from '../../../shared/services/request-in-progress/request-in-progress.service'; import { RequestInProgressService } from '../../../shared/services/request-in-progress/request-in-progress.service';
import { NotificationService } from '../../../shared/services/notifications/notification.service'; import { NotificationService } from '../../../shared/services/notifications/notification.service';
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
@ -54,6 +53,9 @@ const mockDialogRef = {
close: jasmine.createSpy('close') close: jasmine.createSpy('close')
}; };
@Component({ selector: 'svg-icon', template: '' })
class SvgIconStub {}
describe('AccessItemsManagementComponent', () => { describe('AccessItemsManagementComponent', () => {
let fixture: ComponentFixture<AccessItemsManagementComponent>; let fixture: ComponentFixture<AccessItemsManagementComponent>;
let debugElement: DebugElement; let debugElement: DebugElement;
@ -80,7 +82,6 @@ describe('AccessItemsManagementComponent', () => {
NgxsModule.forRoot([EngineConfigurationState, AccessItemsManagementState]), NgxsModule.forRoot([EngineConfigurationState, AccessItemsManagementState]),
FormsModule, FormsModule,
ReactiveFormsModule, ReactiveFormsModule,
AngularSvgIconModule,
MatSnackBarModule, MatSnackBarModule,
MatDialogModule, MatDialogModule,
TypeaheadModule.forRoot(), TypeaheadModule.forRoot(),
@ -102,7 +103,8 @@ describe('AccessItemsManagementComponent', () => {
AccessItemsManagementComponent, AccessItemsManagementComponent,
TypeAheadComponent, TypeAheadComponent,
TaskanaSharedSortStub, TaskanaSharedSortStub,
TaskanaSharedSpinnerStub TaskanaSharedSpinnerStub,
SvgIconStub
], ],
providers: [ providers: [
{ provide: FormsValidatorService, useClass: formValidatorServiceSpy }, { provide: FormsValidatorService, useClass: formValidatorServiceSpy },

View File

@ -27,7 +27,6 @@
<mat-icon *ngIf="selectedCategory == ''">filter_list</mat-icon> <mat-icon *ngIf="selectedCategory == ''">filter_list</mat-icon>
<svg-icon class="classification-list__icons" [src]="(getCategoryIcon(selectedCategory) | async)?.left" <svg-icon class="classification-list__icons" [src]="(getCategoryIcon(selectedCategory) | async)?.left"
[title]="(getCategoryIcon(selectedCategory) | async)?.right"
*ngIf="selectedCategory != ''"> *ngIf="selectedCategory != ''">
</svg-icon> </svg-icon>
</button> </button>
@ -38,7 +37,7 @@
</button> </button>
<button mat-menu-item *ngFor="let category of categories$ | async" (click)="selectCategory(category)"> <button mat-menu-item *ngFor="let category of categories$ | async" (click)="selectCategory(category)">
<svg-icon class="classification-list__categories" [src]="(getCategoryIcon(category) | async)?.left" <svg-icon class="classification-list__categories" [src]="(getCategoryIcon(category) | async)?.left"
[title]="(getCategoryIcon(category) | async)?.right"></svg-icon> matTooltip="{{(getCategoryIcon(category) | async)?.right}}"></svg-icon>
<span> {{category}} </span> <span> {{category}} </span>
</button> </button>
</mat-menu> </mat-menu>

View File

@ -40,6 +40,7 @@ class TreeStub {
@Component({ selector: 'svg-icon', template: '' }) @Component({ selector: 'svg-icon', template: '' })
class SvgIconStub { class SvgIconStub {
@Input() src; @Input() src;
@Input() matTooltip;
} }
@Component({ selector: 'input', template: '' }) @Component({ selector: 'input', template: '' })

View File

@ -2,8 +2,12 @@
(moveNode)="onMoveNode($event)" (treeDrop)="onDrop($event)"> (moveNode)="onMoveNode($event)" (treeDrop)="onDrop($event)">
<ng-template #treeNodeTemplate let-node let-index="index"> <ng-template #treeNodeTemplate let-node let-index="index">
<span class="text-top"> <span class="text-top">
<svg-icon *ngIf="node.data.category" class="fa-fw pr-1" [src]="(getCategoryIcon(node.data.category) | async)?.left" data-toggle="tooltip" <svg-icon
[title]="(getCategoryIcon(node.data.category) | async)?.right"></svg-icon> *ngIf="node.data.category"
class="fa-fw pr-1"
[src]="(getCategoryIcon(node.data.category) | async)?.left"
matTooltip="{{(getCategoryIcon(node.data.category) | async)?.right}}">
</svg-icon>
</span> </span>
<span> <span>
<strong>{{ node.data.key }}</strong> <strong>{{ node.data.key }}</strong>

View File

@ -1,3 +1,6 @@
<svg-icon class="{{selected? 'white': 'gray' }} {{size}}" src="./assets/icons/{{getIconPath(type)}}" <svg-icon
[title]="!type? 'All' : type"></svg-icon> [svgStyle]="{'width.px': iconSize, 'fill': iconColor, 'position': 'relative', 'top.px': '3' }"
src="./assets/icons/{{getIconPath(type)}}"
matTooltip="{{tooltip? type : ''}}">
</svg-icon>
{{text}} {{text}}

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 212 B

View File

@ -1,10 +0,0 @@
.large {
height: 24px;
width: 24px;
}
.gray {
fill: #555;
top: -3px;
}

View File

@ -1,12 +1,13 @@
import { Component, DebugElement, Input } from '@angular/core'; import { Component, DebugElement, Input } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IconTypeComponent } from './icon-type.component'; import { IconTypeComponent } from './icon-type.component';
import { SvgIconComponent, SvgIconRegistryService } from 'angular-svg-icon';
import { WorkbasketType } from '../../../shared/models/workbasket-type'; import { WorkbasketType } from '../../../shared/models/workbasket-type';
@Component({ selector: 'svg-icon', template: '' }) @Component({ selector: 'svg-icon', template: '' })
class SvgIconStub { class SvgIconStub {
@Input() src; @Input() src;
@Input() svgStyle;
@Input() matTooltip;
} }
describe('IconTypeComponent', () => { describe('IconTypeComponent', () => {

View File

@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core'; import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { WorkbasketType } from 'app/shared/models/workbasket-type'; import { WorkbasketType } from 'app/shared/models/workbasket-type';
@Component({ @Component({
@ -6,7 +6,7 @@ import { WorkbasketType } from 'app/shared/models/workbasket-type';
templateUrl: './icon-type.component.html', templateUrl: './icon-type.component.html',
styleUrls: ['./icon-type.component.scss'] styleUrls: ['./icon-type.component.scss']
}) })
export class IconTypeComponent { export class IconTypeComponent implements OnInit, OnChanges {
@Input() @Input()
type: WorkbasketType; type: WorkbasketType;
@ -22,6 +22,17 @@ export class IconTypeComponent {
@Input() @Input()
size = 'small'; size = 'small';
iconSize: string;
iconColor: string;
ngOnInit() {
this.iconSize = this.size === 'large' ? '24' : '16';
}
ngOnChanges(changes: SimpleChanges) {
this.iconColor = changes['selected']?.currentValue ? 'white' : '#555';
}
getIconPath(type: WorkbasketType) { getIconPath(type: WorkbasketType) {
switch (type) { switch (type) {
case WorkbasketType.PERSONAL: case WorkbasketType.PERSONAL:

View File

@ -68,7 +68,7 @@ const MODULES = [
BrowserModule, BrowserModule,
FormsModule, FormsModule,
AppRoutingModule, AppRoutingModule,
AngularSvgIconModule, AngularSvgIconModule.forRoot(),
HttpClientModule, HttpClientModule,
BrowserAnimationsModule, BrowserAnimationsModule,
ReactiveFormsModule, ReactiveFormsModule,

View File

@ -1,9 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DebugElement } from '@angular/core'; import { Component, DebugElement } from '@angular/core';
import { NavBarComponent } from './nav-bar.component'; import { NavBarComponent } from './nav-bar.component';
import { SelectedRouteService } from '../../services/selected-route/selected-route'; import { SelectedRouteService } from '../../services/selected-route/selected-route';
import { SidenavService } from '../../services/sidenav/sidenav.service'; import { SidenavService } from '../../services/sidenav/sidenav.service';
import { AngularSvgIconModule } from 'angular-svg-icon';
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { of } from 'rxjs/internal/observable/of'; import { of } from 'rxjs/internal/observable/of';
@ -22,6 +21,9 @@ const SelectedRouteServiceSpy = jest.fn().mockImplementation(
}) })
); );
@Component({ selector: 'svg-icon', template: '' })
class SvgIconStub {}
describe('NavBarComponent', () => { describe('NavBarComponent', () => {
let component: NavBarComponent; let component: NavBarComponent;
let fixture: ComponentFixture<NavBarComponent>; let fixture: ComponentFixture<NavBarComponent>;
@ -30,8 +32,8 @@ describe('NavBarComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [NavBarComponent], declarations: [NavBarComponent, SvgIconStub],
imports: [MatIconModule, HttpClientTestingModule, AngularSvgIconModule, MatToolbarModule], imports: [MatIconModule, HttpClientTestingModule, MatToolbarModule],
providers: [ providers: [
{ provide: SidenavService, useClass: SidenavServiceSpy }, { provide: SidenavService, useClass: SidenavServiceSpy },
{ provide: SelectedRouteService, useClass: SelectedRouteServiceSpy } { provide: SelectedRouteService, useClass: SelectedRouteServiceSpy }

View File

@ -1,15 +1,12 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Component, DebugElement } from '@angular/core'; import { Component, DebugElement, Input } from '@angular/core';
import { UserInformationComponent } from './user-information.component'; import { UserInformationComponent } from './user-information.component';
import { BrowserModule, By } from '@angular/platform-browser'; import { BrowserModule, By } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service'; import { TaskanaEngineService } from '../../services/taskana-engine/taskana-engine.service';
import { TaskanaEngineServiceMock } from '../../services/taskana-engine/taskana-engine.mock.service'; import { TaskanaEngineServiceMock } from '../../services/taskana-engine/taskana-engine.mock.service';
import { of } from 'rxjs/internal/observable/of'; import { of } from 'rxjs/internal/observable/of';
import { expandDown } from '../../animations/expand.animation';
import { AngularSvgIconModule } from 'angular-svg-icon';
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing';
import { fromEventPattern } from 'rxjs';
const TaskanaEngingeServiceSpy = jest.fn().mockImplementation( const TaskanaEngingeServiceSpy = jest.fn().mockImplementation(
(): Partial<TaskanaEngineServiceMock> => ({ (): Partial<TaskanaEngineServiceMock> => ({
@ -18,6 +15,9 @@ const TaskanaEngingeServiceSpy = jest.fn().mockImplementation(
}) })
); );
@Component({ selector: 'svg-icon', template: '' })
class SvgIconStub {}
describe('UserInformationComponent', () => { describe('UserInformationComponent', () => {
let component: UserInformationComponent; let component: UserInformationComponent;
let fixture: ComponentFixture<UserInformationComponent>; let fixture: ComponentFixture<UserInformationComponent>;
@ -25,8 +25,8 @@ describe('UserInformationComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [UserInformationComponent], declarations: [UserInformationComponent, SvgIconStub],
imports: [BrowserModule, AngularSvgIconModule, HttpClientTestingModule, BrowserAnimationsModule], imports: [BrowserModule, HttpClientTestingModule, BrowserAnimationsModule],
providers: [{ provide: TaskanaEngineService, useClass: TaskanaEngingeServiceSpy }] providers: [{ provide: TaskanaEngineService, useClass: TaskanaEngingeServiceSpy }]
}).compileComponents(); }).compileComponents();
})); }));