Fix some bugs in dataset editor while navigating with buttons and scroll in the table of contents
This commit is contained in:
parent
3361b6aff6
commit
4a54915a8e
|
@ -76,7 +76,7 @@
|
||||||
[showErrors]="showtocentriesErrors" [TOCENTRY_ID_PREFIX]="TOCENTRY_ID_PREFIX" [hasFocus]="step > 0"
|
[showErrors]="showtocentriesErrors" [TOCENTRY_ID_PREFIX]="TOCENTRY_ID_PREFIX" [hasFocus]="step > 0"
|
||||||
[formGroup]="formGroup" *ngIf="formGroup && formGroup.get('datasetProfileDefinition')" [links]="links"
|
[formGroup]="formGroup" *ngIf="formGroup && formGroup.get('datasetProfileDefinition')" [links]="links"
|
||||||
[boundary]="boundary" [spacer]="spacer" [isActive]="step !== 0" stickyThing (stepFound)="onStepFound($event)"
|
[boundary]="boundary" [spacer]="spacer" [isActive]="step !== 0" stickyThing (stepFound)="onStepFound($event)"
|
||||||
(currentLinks)="getLinks($event)" (entrySelected)="changeStep($event)"
|
(currentLinks)="getLinks($event)" (entrySelected)="changeStep($event.entry, $event.execute)"
|
||||||
[visibilityRules]="formGroup.get('datasetProfileDefinition').get('rules').value"></table-of-contents>
|
[visibilityRules]="formGroup.get('datasetProfileDefinition').get('rules').value"></table-of-contents>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -61,6 +61,7 @@ import {PopupNotificationDialogComponent} from '@app/library/notification/popup/
|
||||||
import {CheckDeactivateBaseComponent} from '@app/library/deactivate/deactivate.component';
|
import {CheckDeactivateBaseComponent} from '@app/library/deactivate/deactivate.component';
|
||||||
import {PrefillDatasetComponent} from "@app/ui/dataset/dataset-wizard/prefill-dataset/prefill-dataset.component";
|
import {PrefillDatasetComponent} from "@app/ui/dataset/dataset-wizard/prefill-dataset/prefill-dataset.component";
|
||||||
import {ToCEntry, ToCEntryType} from "@app/ui/misc/dataset-description-form/dataset-description.component";
|
import {ToCEntry, ToCEntryType} from "@app/ui/misc/dataset-description-form/dataset-description.component";
|
||||||
|
import {dispatchFakeEvent} from "@angular/cdk/testing/testbed/fake-events";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dataset-wizard-component',
|
selector: 'app-dataset-wizard-component',
|
||||||
|
@ -1192,7 +1193,8 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public changeStep(selected: ToCEntry = null) {
|
public changeStep(selected: ToCEntry = null, execute: boolean = true) {
|
||||||
|
if(execute) {
|
||||||
if(selected) {
|
if(selected) {
|
||||||
let fieldSet = this.getFirstFieldSet(selected);
|
let fieldSet = this.getFirstFieldSet(selected);
|
||||||
let index = this.visibleFieldSets.findIndex(entry => entry.id === fieldSet.id);
|
let index = this.visibleFieldSets.findIndex(entry => entry.id === fieldSet.id);
|
||||||
|
@ -1201,6 +1203,7 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
this.step = 0;
|
this.step = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get maxStep() {
|
get maxStep() {
|
||||||
return this.visibleFieldSets.length;
|
return this.visibleFieldSets.length;
|
||||||
|
@ -1208,22 +1211,22 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme
|
||||||
|
|
||||||
public nextStep() {
|
public nextStep() {
|
||||||
if (this.step < this.maxStep) {//view is changing
|
if (this.step < this.maxStep) {//view is changing
|
||||||
this.step++;
|
this.step = Math.floor(this.step + 1);
|
||||||
let entry = this.visibleFieldSets[Math.floor(this.step) - 1];
|
let entry = this.visibleFieldSets[this.step - 1];
|
||||||
this.table0fContents.onToCentrySelected(entry);
|
this.table0fContents.onToCentrySelected(entry, false);
|
||||||
this.scroll(entry);
|
this.scroll(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public previousStep() {
|
public previousStep() {
|
||||||
if (this.step > 0) {
|
if (this.step > 0) {
|
||||||
this.step--;
|
this.step = Math.ceil(this.step - 1);
|
||||||
if(this.step > 0) {
|
if(this.step >= 1) {
|
||||||
let entry = this.visibleFieldSets[Math.floor(this.step) - 1];
|
let entry = this.visibleFieldSets[this.step - 1];
|
||||||
this.table0fContents.onToCentrySelected(entry);
|
this.table0fContents.onToCentrySelected(entry, false);
|
||||||
this.scroll(entry);
|
this.scroll(entry);
|
||||||
} else {
|
} else {
|
||||||
this.table0fContents.onToCentrySelected();
|
this.table0fContents.onToCentrySelected(null, false);
|
||||||
this.resetScroll();
|
this.resetScroll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
|
||||||
headerSelectors = '.toc-page-header, .toc-section-header, .toc-compositeField-header';
|
headerSelectors = '.toc-page-header, .toc-section-header, .toc-compositeField-header';
|
||||||
@Output() stepFound = new EventEmitter<LinkToScroll>();
|
@Output() stepFound = new EventEmitter<LinkToScroll>();
|
||||||
@Output() currentLinks = new EventEmitter<Link[]>();
|
@Output() currentLinks = new EventEmitter<Link[]>();
|
||||||
@Output() entrySelected = new EventEmitter<ToCEntry>();
|
@Output() entrySelected = new EventEmitter<any>();
|
||||||
subscription: Subscription;
|
subscription: Subscription;
|
||||||
linksSubject: Subject<HTMLElement[]> = new Subject<HTMLElement[]>();
|
linksSubject: Subject<HTMLElement[]> = new Subject<HTMLElement[]>();
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
|
||||||
if(this.selectedFieldsetId){
|
if(this.selectedFieldsetId){
|
||||||
this.onToCentrySelected(this._findTocEntryById(this.selectedFieldsetId,this.tocentries));
|
this.onToCentrySelected(this._findTocEntryById(this.selectedFieldsetId,this.tocentries), false);
|
||||||
this._actOnObservation = false;
|
this._actOnObservation = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this._actOnObservation = true;
|
this._actOnObservation = true;
|
||||||
|
@ -441,9 +441,9 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onToCentrySelected(entry: ToCEntry = null){
|
onToCentrySelected(entry: ToCEntry = null, execute: boolean = true){
|
||||||
this.tocentrySelected = entry;
|
this.tocentrySelected = entry;
|
||||||
this.entrySelected.emit(entry);
|
this.entrySelected.emit({entry: entry, execute: execute});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _findTocEntryById(id: string, tocentries: ToCEntry[]): ToCEntry{
|
private _findTocEntryById(id: string, tocentries: ToCEntry[]): ToCEntry{
|
||||||
|
|
Loading…
Reference in New Issue