forked from hazza/dspace-angular
Merged in DURACOM-237-align-to-angular-16 (pull request #1431)
DURACOM-237 align to angular 16 Approved-by: Giuseppe Digilio
This commit is contained in:
@@ -1,26 +1,25 @@
|
|||||||
<div [className]="'float-left w-100 ' + wrapperClass">
|
<div [className]="'float-left w-100 ' + wrapperClass">
|
||||||
<div role="list" class="nav nav-pills d-flex flex-column flex-sm-row">
|
<div role="list" class="nav nav-pills d-flex flex-column flex-sm-row" cdkDropList cdkDropListOrientation="horizontal" (cdkDropListDropped)="onDrop($event)">
|
||||||
<ng-container *ngFor="let c of chips.getChips(); let i = index">
|
<ng-template #tipContent>
|
||||||
<ng-template #tipContent>
|
<p class="text-left p-0 m-0" *ngFor="let tip of tipText">
|
||||||
<p class="text-left p-0 m-0" *ngFor="let tip of tipText">
|
{{tip}}
|
||||||
{{tip}}
|
</p>
|
||||||
</p>
|
</ng-template>
|
||||||
</ng-template>
|
<div role="listitem" class="nav-item mr-2 mb-1"
|
||||||
|
*ngFor="let c of chips.getChips(); let i = index"
|
||||||
<div role="listitem" class="nav-item mr-2 mb-1"
|
#t="ngbTooltip"
|
||||||
#t="ngbTooltip"
|
triggers="manual"
|
||||||
triggers="manual"
|
[ngbTooltip]="tipContent"
|
||||||
[ngbTooltip]="tipContent"
|
(mouseover)="showTooltip(t, i)"
|
||||||
(dragstart)="t.close();onDragStart(i)"
|
(mouseout)="t.close()">
|
||||||
(dragend)="onDragEnd(i)"
|
|
||||||
(mouseover)="showTooltip(t, i)"
|
|
||||||
(mouseout)="t.close()">
|
|
||||||
<a class="flex-sm-fill text-sm-center nav-link active bg-info"
|
<a class="flex-sm-fill text-sm-center nav-link active bg-info"
|
||||||
|
cdkDrag
|
||||||
|
(cdkDragStarted)="onDrag($event)"
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
[ngClass]="{'chip-selected disabled': (editable && c.editMode) || dragged === i}"
|
[ngClass]="{'chip-selected disabled': (editable && c.editMode) || dragged === i}"
|
||||||
(click)="chipsSelected($event, i);">
|
(click)="chipsSelected($event, i);">
|
||||||
<span>
|
<span>
|
||||||
<i *ngIf="showIcons && !c.isNestedItem()" dsAuthorityConfidenceState [authorityValue]="c.item" class="far fa-circle" aria-hidden="true"></i>
|
<i *ngIf="showIcons && !c.isNestedItem()" dsAuthorityConfidenceState [authorityValue]="c.item" class="far fa-circle" aria-hidden="true"> </i>
|
||||||
<ng-container *ngIf="showIcons && c.hasVisibleIcons()">
|
<ng-container *ngIf="showIcons && c.hasVisibleIcons()">
|
||||||
<i *ngFor="let icon of c.icons; let l = last"
|
<i *ngFor="let icon of c.icons; let l = last"
|
||||||
[ngbTooltip]="tipContent"
|
[ngbTooltip]="tipContent"
|
||||||
@@ -33,7 +32,6 @@
|
|||||||
[authorityValue]="c.item[icon.metadata] || c.item"
|
[authorityValue]="c.item[icon.metadata] || c.item"
|
||||||
[visibleWhenAuthorityEmpty]="icon.visibleWhenAuthorityEmpty"
|
[visibleWhenAuthorityEmpty]="icon.visibleWhenAuthorityEmpty"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
(dragstart)="t.close();"
|
|
||||||
(mouseover)="showTooltip(t, i, icon.metadata)"
|
(mouseover)="showTooltip(t, i, icon.metadata)"
|
||||||
(mouseout)="t.close()"></i>
|
(mouseout)="t.close()"></i>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@@ -41,7 +39,6 @@
|
|||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
|
||||||
<div [class.chips-sort-ignore]="(isDragging | async)" class="flex-grow-1">
|
<div [class.chips-sort-ignore]="(isDragging | async)" class="flex-grow-1">
|
||||||
<ng-content ></ng-content>
|
<ng-content ></ng-content>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,7 +1,11 @@
|
|||||||
.chip-selected {
|
.cdk-drag-placeholder {
|
||||||
background-color: var(--bs-secondary) !important;
|
filter: grayscale(100%);
|
||||||
|
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
.cdk-drag-preview {
|
||||||
.chip-label {
|
color: white;
|
||||||
max-width: 10rem;
|
box-sizing: border-box;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
|
||||||
|
0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,10 @@
|
|||||||
|
import {
|
||||||
|
CdkDrag,
|
||||||
|
CdkDragDrop,
|
||||||
|
CdkDragStart,
|
||||||
|
CdkDropList,
|
||||||
|
moveItemInArray,
|
||||||
|
} from '@angular/cdk/drag-drop';
|
||||||
import {
|
import {
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
NgClass,
|
NgClass,
|
||||||
@@ -24,7 +31,6 @@ import {
|
|||||||
import isObject from 'lodash/isObject';
|
import isObject from 'lodash/isObject';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
|
|
||||||
import { DragService } from '../../../core/drag.service';
|
|
||||||
import { AuthorityConfidenceStateDirective } from '../directives/authority-confidence-state.directive';
|
import { AuthorityConfidenceStateDirective } from '../directives/authority-confidence-state.directive';
|
||||||
import { Chips } from './models/chips.model';
|
import { Chips } from './models/chips.model';
|
||||||
import { ChipsItem } from './models/chips-item.model';
|
import { ChipsItem } from './models/chips-item.model';
|
||||||
@@ -41,6 +47,8 @@ import { ChipsItem } from './models/chips-item.model';
|
|||||||
AuthorityConfidenceStateDirective,
|
AuthorityConfidenceStateDirective,
|
||||||
NgIf,
|
NgIf,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
|
CdkDrag,
|
||||||
|
CdkDropList,
|
||||||
],
|
],
|
||||||
standalone: true,
|
standalone: true,
|
||||||
})
|
})
|
||||||
@@ -61,7 +69,6 @@ export class ChipsComponent implements OnChanges {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private cdr: ChangeDetectorRef,
|
private cdr: ChangeDetectorRef,
|
||||||
private dragService: DragService,
|
|
||||||
private translate: TranslateService) {
|
private translate: TranslateService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,21 +101,19 @@ export class ChipsComponent implements OnChanges {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onDragStart(index) {
|
onDrag(event: CdkDragStart<ChipsItem[]>) {
|
||||||
this.isDragging.next(true);
|
this.isDragging.next(true);
|
||||||
this.dragService.overrideDragOverPage();
|
|
||||||
this.dragged = index;
|
|
||||||
}
|
}
|
||||||
|
onDrop(event: CdkDragDrop<ChipsItem[]>) {
|
||||||
onDragEnd(event) {
|
moveItemInArray(this.chips.chipsItems.getValue(), event.previousIndex, event.currentIndex);
|
||||||
this.dragService.allowDragOverPage();
|
|
||||||
this.dragged = -1;
|
|
||||||
this.chips.updateOrder();
|
this.chips.updateOrder();
|
||||||
this.isDragging.next(false);
|
this.isDragging.next(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
showTooltip(tooltip: NgbTooltip, index, field?) {
|
showTooltip(tooltip: NgbTooltip, index, field?) {
|
||||||
tooltip.close();
|
tooltip.close();
|
||||||
|
if (this.isDragging.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const chipsItem = this.chips.getChipByIndex(index);
|
const chipsItem = this.chips.getChipByIndex(index);
|
||||||
const textToDisplay: string[] = [];
|
const textToDisplay: string[] = [];
|
||||||
if (!chipsItem.editMode && this.dragged === -1) {
|
if (!chipsItem.editMode && this.dragged === -1) {
|
||||||
@@ -139,5 +144,4 @@ export class ChipsComponent implements OnChanges {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -6,9 +6,7 @@ import {
|
|||||||
TransferState,
|
TransferState,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import {
|
import { ServerModule } from '@angular/platform-server';
|
||||||
ServerModule,
|
|
||||||
} from '@angular/platform-server';
|
|
||||||
import { EffectsModule } from '@ngrx/effects';
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
import {
|
import {
|
||||||
Action,
|
Action,
|
||||||
|
Reference in New Issue
Block a user