Skip to content
Snippets Groups Projects
Commit b0e2e7eb authored by jojohoch's avatar jojohoch
Browse files

Rename property "activeAfterIdDelay" from section to "visibilityDelay"

parent 4f622278
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ export class Section {
autoRowSize: boolean = true;
gridColumnSizes: { value: number; unit: string }[] = [{ value: 1, unit: 'fr' }, { value: 1, unit: 'fr' }];
gridRowSizes: { value: number; unit: string }[] = [{ value: 1, unit: 'fr' }];
activeAfterIdDelay: number = 0;
visibilityDelay: number = 0;
visibilityRules: VisibilityRule[] = [];
constructor(blueprint?: Record<string, any>) {
......@@ -34,7 +34,7 @@ export class Section {
if (sanitizedBlueprint.autoRowSize !== undefined) this.autoRowSize = sanitizedBlueprint.autoRowSize;
if (sanitizedBlueprint.gridColumnSizes !== undefined) this.gridColumnSizes = sanitizedBlueprint.gridColumnSizes;
if (sanitizedBlueprint.gridRowSizes !== undefined) this.gridRowSizes = sanitizedBlueprint.gridRowSizes;
if (sanitizedBlueprint.activeAfterIdDelay) this.activeAfterIdDelay = sanitizedBlueprint.activeAfterIdDelay;
if (sanitizedBlueprint.visibilityDelay) this.visibilityDelay = sanitizedBlueprint.visibilityDelay;
if (sanitizedBlueprint.visibilityRules) {
this.visibilityRules = sanitizedBlueprint.visibilityRules
.map(rule => new VisibilityRule(rule.id, rule.operator, rule.value));
......
......@@ -320,11 +320,12 @@ export class SectionMenuComponent implements OnDestroy {
}
showVisibilityRulesDialog(): void {
this.dialogService.showVisibilityRulesDialog(this.section.visibilityRules, this.getControlIds(), this.section.activeAfterIdDelay)
this.dialogService
.showVisibilityRulesDialog(this.section.visibilityRules, this.getControlIds(), this.section.visibilityDelay)
.subscribe(rulesWithDelay => {
if (rulesWithDelay) {
this.updateModel('visibilityRules', rulesWithDelay.visibilityRules);
this.updateModel('activeAfterIdDelay', rulesWithDelay.activeAfterIdDelay);
this.updateModel('visibilityDelay', rulesWithDelay.visibilityDelay);
}
});
}
......
......@@ -13,7 +13,7 @@
<mat-label>Verzögerung in ms</mat-label>
<input matInput
placeholder="Verzögerung in ms"
[(ngModel)]="activeAfterIdDelay">
[(ngModel)]="visibilityDelay">
</mat-form-field>
</ng-container>
......@@ -22,7 +22,7 @@
<div *ngFor="let rule of visibilityRules; let i = index"
class="fx-row-start-stretch fx-gap-10">
<aspect-visibility-rule-editor [controlIds]="controlIds"
[(visibilityRule)]="visibilityRules[i]">
[(visibilityRule)]="visibilityRules[i]">
</aspect-visibility-rule-editor>
<button mat-icon-button
matSuffix
......@@ -39,7 +39,7 @@
</button>
<button *ngIf="controlIds.length"
mat-button
[mat-dialog-close]="{visibilityRules:visibilityRules, activeAfterIdDelay}">
[mat-dialog-close]="{visibilityRules, visibilityDelay}">
Speichern
</button>
</div>
......@@ -8,17 +8,17 @@ import { MAT_DIALOG_DATA } from '@angular/material/dialog';
export class VisibilityRulesDialogComponent {
visibilityRules!: VisibilityRule[];
controlIds!: string[];
activeAfterIdDelay!: number;
visibilityDelay!: number;
constructor(
@Inject(MAT_DIALOG_DATA) private data: {
visibilityRules: VisibilityRule[],
activeAfterIdDelay: number,
visibilityDelay: number,
controlIds: string[],
}
) {
this.visibilityRules = [...data.visibilityRules];
this.activeAfterIdDelay = data.activeAfterIdDelay;
this.visibilityDelay = data.visibilityDelay;
this.controlIds = data.controlIds;
}
......
......@@ -135,10 +135,10 @@ export class DialogService {
showVisibilityRulesDialog(visibilityRules: VisibilityRule[],
controlIds: string[],
activeAfterIdDelay: number
): Observable<{ visibilityRules: VisibilityRule[], activeAfterIdDelay: number }> {
visibilityDelay: number
): Observable<{ visibilityRules: VisibilityRule[], visibilityDelay: number }> {
const dialogRef = this.dialog.open(VisibilityRulesDialogComponent, {
data: { visibilityRules, controlIds, activeAfterIdDelay },
data: { visibilityRules, controlIds, visibilityDelay },
autoFocus: false
});
return dialogRef.afterClosed();
......
......@@ -50,17 +50,17 @@ export class SectionVisibilityHandlingDirective implements OnInit {
displaySection(): void {
if (this.isSectionVisible()) {
if (this.section.activeAfterIdDelay) {
if (this.section.visibilityDelay) {
// sollte die gleiche id wie die dazugehörige Rule benutzen
if (!this.unitStateService.getElementCodeById('test-3000')) {
const st = new TimerStateVariable('test-3000', 0, this.section.activeAfterIdDelay);
const st = new TimerStateVariable('test-3000', 0, this.section.visibilityDelay);
this.unitStateService.registerElement(st.id, st.value, null, null);
st.run();
st.elementValueChanged.subscribe((value: ValueChangeElement) => {
this.unitStateService.changeElementCodeValue(value);
});
}
if ((this.unitStateService.getElementCodeById('test-3000')?.value as number) >= this.section.activeAfterIdDelay) {
if ((this.unitStateService.getElementCodeById('test-3000')?.value as number) >= this.section.visibilityDelay) {
this.elementRef.nativeElement.style.display = 'block';
} else {
this.elementRef.nativeElement.style.display = 'none';
......@@ -110,7 +110,7 @@ export class SectionVisibilityHandlingDirective implements OnInit {
private get isScrollSection(): boolean {
return this.pageSections
.filter(pageSection => pageSection.activeAfterID === this.section.activeAfterID &&
pageSection.activeAfterIdDelay === this.section.activeAfterIdDelay &&
pageSection.visibilityDelay === this.section.visibilityDelay &&
pageSection.getAllElements().length)
.findIndex(section => section === this.section) === 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment