table of contents visibility fix
This commit is contained in:
parent
dcf2f89b22
commit
5f796edc62
|
@ -18,9 +18,16 @@ export class VisibilityRulesService {
|
||||||
private allDescriptionTemplateFields: DescriptionTemplateField[] = null;
|
private allDescriptionTemplateFields: DescriptionTemplateField[] = null;
|
||||||
private allDescriptionTemplateFieldSets: DescriptionTemplateFieldSet[] = null;
|
private allDescriptionTemplateFieldSets: DescriptionTemplateFieldSet[] = null;
|
||||||
|
|
||||||
|
public rulesChangedSubject: Subject<{ [key: string]: boolean }>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected formService: FormService
|
protected formService: FormService
|
||||||
) {
|
) {
|
||||||
|
this.rulesChangedSubject = new Subject<{ [key: string]: boolean }>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public getRulesChangedObservable(): Observable<{ [key: string]: boolean }> {
|
||||||
|
return this.rulesChangedSubject.asObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public setContext(definition: DescriptionTemplateDefinition, form: AbstractControl) {
|
public setContext(definition: DescriptionTemplateDefinition, form: AbstractControl) {
|
||||||
|
@ -75,6 +82,8 @@ export class VisibilityRulesService {
|
||||||
this.hideParentIfAllChildrenAreHidden(propertyDefinition);
|
this.hideParentIfAllChildrenAreHidden(propertyDefinition);
|
||||||
this.ensureFieldSetVisibility(propertyDefinition);
|
this.ensureFieldSetVisibility(propertyDefinition);
|
||||||
this.isVisibleMap = this._isVisibleMap;
|
this.isVisibleMap = this._isVisibleMap;
|
||||||
|
|
||||||
|
this.rulesChangedSubject.next(this._isVisibleMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private initRules(){
|
private initRules(){
|
||||||
|
|
|
@ -84,11 +84,12 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
|
this.visibilityRulesService.getRulesChangedObservable().pipe(takeUntil(this._destroyed)).subscribe(data => {
|
||||||
|
this.hiddenEntries = this._findHiddenEntries(this.tocentries);
|
||||||
|
});
|
||||||
if (this.descriptionTemplate) {
|
if (this.descriptionTemplate) {
|
||||||
this.tocentries = this.getTocEntries(this.descriptionTemplate);
|
this.tocentries = this.getTocEntries(this.descriptionTemplate);
|
||||||
if (this.visibilityRulesService) {
|
|
||||||
this.hiddenEntries = this._findHiddenEntries(this.tocentries);
|
this.hiddenEntries = this._findHiddenEntries(this.tocentries);
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -178,8 +179,6 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
|
||||||
|
|
||||||
return invisibleEntries;
|
return invisibleEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _visibilityRulesSubscription: Subscription;
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
|
||||||
if (this.selectedFieldsetId) {
|
if (this.selectedFieldsetId) {
|
||||||
|
@ -198,36 +197,8 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
|
||||||
}
|
}
|
||||||
if (changes['descriptionTemplate'] && changes.descriptionTemplate != null) {
|
if (changes['descriptionTemplate'] && changes.descriptionTemplate != null) {
|
||||||
this.tocentries = this.getTocEntries(this.descriptionTemplate);
|
this.tocentries = this.getTocEntries(this.descriptionTemplate);
|
||||||
// if (this.visibilityRulesService) {
|
this.hiddenEntries = this._findHiddenEntries(this.tocentries);
|
||||||
// this.hiddenEntries = this._findHiddenEntries(this.tocentries);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('visibilityRulesService') {
|
|
||||||
if (this._visibilityRulesSubscription) {
|
|
||||||
this._visibilityRulesSubscription.unsubscribe();
|
|
||||||
this._visibilityRulesSubscription = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.visibilityRulesService) return;
|
|
||||||
|
|
||||||
// this._visibilityRulesSubscription = this.visibilityRulesService.visibilityChange
|
|
||||||
// .pipe(takeUntil(this._destroyed))
|
|
||||||
// .pipe(debounceTime(200))
|
|
||||||
// .subscribe(_ => {
|
|
||||||
// if (this.hasFocus) {
|
|
||||||
// this._resetObserver();
|
|
||||||
// // this.hiddenEntries = this._findHiddenEntries(this.tocentries);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// this.hiddenEntries = this._findHiddenEntries(this.tocentries);
|
|
||||||
}
|
|
||||||
// if (!this.isActive && this.links && this.links.length > 0) {
|
|
||||||
// this.links.forEach(link => {
|
|
||||||
// link.selected = false;
|
|
||||||
// })
|
|
||||||
// this.links[0].selected = true;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue