|
@@ -8,6 +8,8 @@ import { GenericElement } from '../../models/evt-models';
|
|
|
import { ComponentRegisterService } from '../../services/component-register.service';
|
|
|
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';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'evt-content-viewer',
|
|
@@ -32,6 +34,15 @@ export class ContentViewerComponent implements OnDestroy {
|
|
|
@ViewChild('container', { read: ViewContainerRef }) container: ViewContainerRef;
|
|
|
itemsToHighlightChange = new BehaviorSubject<EntitiesSelectItem[]>([]);
|
|
|
|
|
|
+ private ithlems: LemsSelectItem[];
|
|
|
+ @Input() set itemsLemsToHighlight(i: LemsSelectItem[]) {
|
|
|
+ this.ithlems = i;
|
|
|
+ this.itemsLemsToHighlightChange.next(i);
|
|
|
+ }
|
|
|
+ get itemsLemsToHighlight() { return this.ithlems; }
|
|
|
+
|
|
|
+ itemsLemsToHighlightChange = new BehaviorSubject<LemsSelectItem[]>([]);
|
|
|
+
|
|
|
private edLevel: EditionLevelType;
|
|
|
@Input() set editionLevel(el: EditionLevelType) {
|
|
|
this.edLevel = el;
|
|
@@ -51,6 +62,7 @@ export class ContentViewerComponent implements OnDestroy {
|
|
|
constructor(
|
|
|
private componentRegister: ComponentRegisterService,
|
|
|
private entitiesSelectService: EntitiesSelectService,
|
|
|
+ private lemsSelectService: LemsSelectService,
|
|
|
) {
|
|
|
}
|
|
|
|
|
@@ -67,15 +79,18 @@ export class ContentViewerComponent implements OnDestroy {
|
|
|
public inputs: Observable<{ [keyName: string]: any }> = combineLatest([
|
|
|
this.contentChange,
|
|
|
this.itemsToHighlightChange,
|
|
|
+ this.itemsLemsToHighlightChange,
|
|
|
this.editionLevelChange,
|
|
|
this.textFlowChange,
|
|
|
]).pipe(
|
|
|
- map(([data, itemsToHighlight, editionLevel, textFlow]) => {
|
|
|
+ map(([data, itemsToHighlight, itemsLemsToHighlight, editionLevel, textFlow]) => {
|
|
|
if (this.toBeHighlighted()) {
|
|
|
return {
|
|
|
data,
|
|
|
highlightData: this.getHighlightData(data, itemsToHighlight),
|
|
|
+ highlightDataLem: this.getHighlightDataLems (data, itemsLemsToHighlight),
|
|
|
itemsToHighlight,
|
|
|
+ itemsLemsToHighlight,
|
|
|
editionLevel,
|
|
|
textFlow,
|
|
|
};
|
|
@@ -125,6 +140,13 @@ export class ContentViewerComponent implements OnDestroy {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ private getHighlightDataLems(data, ithlems: LemsSelectItem[]) {
|
|
|
+ return {
|
|
|
+ highlight: ithlems?.some(i => this.lemsSelectService.matchClassAndAttributes(i.value, data?.attributes ?? {}, data?.class)) ?? false,
|
|
|
+ highlightColor: this.lemsSelectService.getHighlightColor(data?.attributes ?? {}, data?.class, ithlems),
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
ngOnDestroy() {
|
|
|
if (this.componentRef) {
|
|
|
this.componentRef.destroy();
|