|
@@ -10,6 +10,8 @@ import { EntitiesSelectService } from '../../services/entities-select.service';
|
|
|
import { EntitiesSelectItem } from '../entities-select/entities-select.component';
|
|
|
import { LemsSelectService } from '../../services/lems-select.service';
|
|
|
import { LemsSelectItem } from '../lems-select/lems-select.component';
|
|
|
+import { IperlemsSelectService } from '../../services/iperlems-select.service';
|
|
|
+import { IperlemsSelectItem } from '../iperlems-select/iperlems-select.component';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'evt-content-viewer',
|
|
@@ -36,11 +38,20 @@ export class ContentViewerComponent implements OnDestroy {
|
|
|
this.itemsLemsToHighlightChange.next(i);
|
|
|
}
|
|
|
get itemsLemsToHighlight() { return this.ithlems; }
|
|
|
+
|
|
|
+ private ithiperlems: IperlemsSelectItem[];
|
|
|
+ @Input() set itemsIperlemsToHighlight(i: IperlemsSelectItem[]) {
|
|
|
+ this.ithiperlems = i;
|
|
|
+ this.itemsIperlemsToHighlightChange.next(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ get itemsIperlemsToHighlight() { return this.ithiperlems; }
|
|
|
|
|
|
contentChange = new BehaviorSubject<GenericElement>(undefined);
|
|
|
@ViewChild('container', { read: ViewContainerRef }) container: ViewContainerRef;
|
|
|
itemsToHighlightChange = new BehaviorSubject<EntitiesSelectItem[]>([]);
|
|
|
itemsLemsToHighlightChange = new BehaviorSubject<LemsSelectItem[]>([]);
|
|
|
+ itemsIperlemsToHighlightChange = new BehaviorSubject<IperlemsSelectItem[]>([]);
|
|
|
|
|
|
private edLevel: EditionLevelType;
|
|
|
@Input() set editionLevel(el: EditionLevelType) {
|
|
@@ -62,6 +73,7 @@ export class ContentViewerComponent implements OnDestroy {
|
|
|
private componentRegister: ComponentRegisterService,
|
|
|
private entitiesSelectService: EntitiesSelectService,
|
|
|
private lemsSelectService: LemsSelectService,
|
|
|
+ private iperlemsSelectService: IperlemsSelectService,
|
|
|
) {
|
|
|
}
|
|
|
|
|
@@ -79,17 +91,20 @@ export class ContentViewerComponent implements OnDestroy {
|
|
|
this.contentChange,
|
|
|
this.itemsToHighlightChange,
|
|
|
this.itemsLemsToHighlightChange,
|
|
|
+ this.itemsIperlemsToHighlightChange,
|
|
|
this.editionLevelChange,
|
|
|
this.textFlowChange,
|
|
|
]).pipe(
|
|
|
- map(([data, itemsToHighlight, itemsLemsToHighlight, editionLevel, textFlow]) => {
|
|
|
+ map(([data, itemsToHighlight, itemsLemsToHighlight, itemsIperlemsToHighlight, editionLevel, textFlow]) => {
|
|
|
if (this.toBeHighlighted()) {
|
|
|
return {
|
|
|
data,
|
|
|
highlightData: this.getHighlightData(data, itemsToHighlight),
|
|
|
highlightDataLem: this.getHighlightDataLem(data, itemsLemsToHighlight),
|
|
|
+ highlightDataIperlem: this.getHighlightDataIperlem(data, itemsIperlemsToHighlight),
|
|
|
itemsToHighlight,
|
|
|
itemsLemsToHighlight,
|
|
|
+ itemsIperlemsToHighlight,
|
|
|
editionLevel,
|
|
|
textFlow,
|
|
|
};
|
|
@@ -146,6 +161,13 @@ export class ContentViewerComponent implements OnDestroy {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ private getHighlightDataIperlem(data, ithiperlems: IperlemsSelectItem[]) {
|
|
|
+ return {
|
|
|
+ highlight: ithiperlems?.some(i => this.iperlemsSelectService.matchClassAndAttributes(i.value, data?.attributes ?? {}, data?.class)) ?? false,
|
|
|
+ highlightColor: this.iperlemsSelectService.getHighlightColor(data?.attributes ?? {}, data?.class, ithiperlems),
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
ngOnDestroy() {
|
|
|
if (this.componentRef) {
|
|
|
this.componentRef.destroy();
|