Commit 6f5404f7 authored by Quentin Torck's avatar Quentin Torck
Browse files

navigate between popup

parent 2f745bab
...@@ -1559,6 +1559,7 @@ ...@@ -1559,6 +1559,7 @@
"@angular/compiler": "^8.1.3", "@angular/compiler": "^8.1.3",
"boxen": "^4.1.0", "boxen": "^4.1.0",
"colorette": "^1.1.0", "colorette": "^1.1.0",
"flat": "git://github.com/lenchvolodymyr/flat.git#ffe77efe8c33bc80ffb2f7a465537610dea4f611",
"gettext-parser": "^4.0.1", "gettext-parser": "^4.0.1",
"glob": "^7.1.4", "glob": "^7.1.4",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
...@@ -1591,24 +1592,12 @@ ...@@ -1591,24 +1592,12 @@
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
"dev": true "dev": true
}, },
"flat": {
"version": "git://github.com/lenchvolodymyr/flat.git#ffe77efe8c33bc80ffb2f7a465537610dea4f611",
"from": "git://github.com/lenchvolodymyr/flat.git#ffe77efe8c33bc80ffb2f7a465537610dea4f611",
"requires": {
"is-buffer": "~2.0.3"
}
},
"get-caller-file": { "get-caller-file": {
"version": "2.0.5", "version": "2.0.5",
"resolved": "https://packages.dlcm.ch/repository/npm-group/get-caller-file/-/get-caller-file-2.0.5.tgz", "resolved": "https://packages.dlcm.ch/repository/npm-group/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true "dev": true
}, },
"is-buffer": {
"version": "2.0.4",
"resolved": "https://nexus.unige.ch/repository/npm-all/is-buffer/-/is-buffer-2.0.4.tgz",
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A=="
},
"require-main-filename": { "require-main-filename": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://packages.dlcm.ch/repository/npm-group/require-main-filename/-/require-main-filename-2.0.0.tgz", "resolved": "https://packages.dlcm.ch/repository/npm-group/require-main-filename/-/require-main-filename-2.0.0.tgz",
...@@ -5399,6 +5388,22 @@ ...@@ -5399,6 +5388,22 @@
"locate-path": "^3.0.0" "locate-path": "^3.0.0"
} }
}, },
"flat": {
"version": "git://github.com/lenchvolodymyr/flat.git#ffe77efe8c33bc80ffb2f7a465537610dea4f611",
"from": "git://github.com/lenchvolodymyr/flat.git#ffe77ef",
"dev": true,
"requires": {
"is-buffer": "~2.0.3"
},
"dependencies": {
"is-buffer": {
"version": "2.0.4",
"resolved": "https://nexus.unige.ch/repository/npm-all/is-buffer/-/is-buffer-2.0.4.tgz",
"integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==",
"dev": true
}
}
},
"flatted": { "flatted": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz",
...@@ -5558,8 +5563,7 @@ ...@@ -5558,8 +5563,7 @@
}, },
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"bundled": true, "bundled": true
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
...@@ -5577,13 +5581,11 @@ ...@@ -5577,13 +5581,11 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
...@@ -5596,18 +5598,15 @@ ...@@ -5596,18 +5598,15 @@
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
...@@ -5710,8 +5709,7 @@ ...@@ -5710,8 +5709,7 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
...@@ -5721,7 +5719,6 @@ ...@@ -5721,7 +5719,6 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
...@@ -5734,20 +5731,17 @@ ...@@ -5734,20 +5731,17 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
...@@ -5764,7 +5758,6 @@ ...@@ -5764,7 +5758,6 @@
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
...@@ -5837,8 +5830,7 @@ ...@@ -5837,8 +5830,7 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
...@@ -5848,7 +5840,6 @@ ...@@ -5848,7 +5840,6 @@
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
...@@ -5924,8 +5915,7 @@ ...@@ -5924,8 +5915,7 @@
}, },
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"bundled": true, "bundled": true
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
...@@ -5955,7 +5945,6 @@ ...@@ -5955,7 +5945,6 @@
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
...@@ -5973,7 +5962,6 @@ ...@@ -5973,7 +5962,6 @@
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
...@@ -6012,13 +6000,11 @@ ...@@ -6012,13 +6000,11 @@
}, },
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.0.3", "version": "3.0.3",
"bundled": true, "bundled": true
"optional": true
} }
} }
}, },
...@@ -11346,9 +11332,9 @@ ...@@ -11346,9 +11332,9 @@
} }
}, },
"solidify-frontend": { "solidify-frontend": {
"version": "0.3.9", "version": "0.3.10",
"resolved": "https://nexus.unige.ch/repository/npm-all/solidify-frontend/-/solidify-frontend-0.3.9.tgz", "resolved": "https://nexus.unige.ch/repository/npm-all/solidify-frontend/-/solidify-frontend-0.3.10.tgz",
"integrity": "sha512-CxEF2Q2WwCXPNCtDTOkwGa3yjxA3CkQe+Fz9tngrWPzUBc62vm+K3sr9Yi8v+Badr5X0EaKDRK5oaqkK9xyQlA==", "integrity": "sha512-GhhP+Co8D+3BOy+W6i6ibI35RBR6VWTIwgNRQjCtBrMTe/36eon0IsCmfUJokZH1TuDmA6RpdrePGNDTOdhS7g==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
......
...@@ -38,12 +38,18 @@ export abstract class SharedAbstractContentPresentational<TResource extends Base ...@@ -38,12 +38,18 @@ export abstract class SharedAbstractContentPresentational<TResource extends Base
super(); super();
} }
closeByTab(): void { closeByTab(keyEvent: KeyboardEvent): void {
this._closeByTabBS.next(); if (!keyEvent.defaultPrevented) {
keyEvent.preventDefault();
this._closeByTabBS.next();
}
} }
closeByShiftTab(): void { closeByShiftTab(keyEvent: KeyboardEvent): void {
this._closeByShiftTabBS.next(); if (!keyEvent.defaultPrevented) {
keyEvent.preventDefault();
this._closeByShiftTabBS.next();
}
} }
ngOnInit(): void { ngOnInit(): void {
...@@ -70,7 +76,6 @@ export abstract class SharedAbstractContentPresentational<TResource extends Base ...@@ -70,7 +76,6 @@ export abstract class SharedAbstractContentPresentational<TResource extends Base
} }
selectNextResource(): void { selectNextResource(): void {
debugger
const val = this.host.list; const val = this.host.list;
let activeValIndex = -1; let activeValIndex = -1;
for (let index = 0; index < val.length; index++) { for (let index = 0; index < val.length; index++) {
......
...@@ -183,6 +183,7 @@ export abstract class SharedAbstractMultiSelectPresentational<TResource extends ...@@ -183,6 +183,7 @@ export abstract class SharedAbstractMultiSelectPresentational<TResource extends
this.formControl.markAsTouched(); this.formControl.markAsTouched();
if (this.closeAfterValueSelected) { if (this.closeAfterValueSelected) {
this._closeOverlay(overlayRef); this._closeOverlay(overlayRef);
this._tabulationService.focusNext(this._elementToReFocus);
} else { } else {
overlayRef.updatePosition(); overlayRef.updatePosition();
} }
...@@ -196,6 +197,7 @@ export abstract class SharedAbstractMultiSelectPresentational<TResource extends ...@@ -196,6 +197,7 @@ export abstract class SharedAbstractMultiSelectPresentational<TResource extends
this.formControl.markAsTouched(); this.formControl.markAsTouched();
if (this.closeAfterValueSelected) { if (this.closeAfterValueSelected) {
this._closeOverlay(overlayRef); this._closeOverlay(overlayRef);
this._tabulationService.focusNext(this._elementToReFocus);
} else { } else {
overlayRef.updatePosition(); overlayRef.updatePosition();
} }
...@@ -207,6 +209,7 @@ export abstract class SharedAbstractMultiSelectPresentational<TResource extends ...@@ -207,6 +209,7 @@ export abstract class SharedAbstractMultiSelectPresentational<TResource extends
this.subscribe(componentRef.instance.closeObs.pipe( this.subscribe(componentRef.instance.closeObs.pipe(
tap(() => { tap(() => {
this._closeOverlay(overlayRef); this._closeOverlay(overlayRef);
this._tabulationService.focusNext(this._elementToReFocus);
}), }),
)); ));
} }
...@@ -216,45 +219,30 @@ export abstract class SharedAbstractMultiSelectPresentational<TResource extends ...@@ -216,45 +219,30 @@ export abstract class SharedAbstractMultiSelectPresentational<TResource extends
this.subscribe(overlayRef.backdropClick().pipe( this.subscribe(overlayRef.backdropClick().pipe(
tap(() => { tap(() => {
this._closeOverlay(overlayRef); this._closeOverlay(overlayRef);
this._tabulationService.focusNext(this._elementToReFocus);
}), }),
)); ));
this.subscribe(componentRef.instance.closeByTabObs.pipe( this.subscribe(componentRef.instance.closeByTabObs.pipe(
tap(() => { tap(() => {
debugger this._closeOverlay(overlayRef);
this._closeOverlay(overlayRef, true); this._tabulationService.focusNext(this._elementToReFocus);
}, },
))); )));
this.subscribe(componentRef.instance.closeByShiftTabObs.pipe( this.subscribe(componentRef.instance.closeByShiftTabObs.pipe(
tap(() => { tap(() => {
debugger this._closeOverlay(overlayRef);
this._closeOverlay(overlayRef, false); this._tabulationService.focusPrev(this._elementToReFocus);
}, },
))); )));
} }
private _closeOverlay(overlayRef: OverlayRef, isByTab: boolean = true, keepInOverlayRefs?: boolean): void { private _closeOverlay(overlayRef: OverlayRef, keepInOverlayRefs?: boolean): void {
debugger
overlayRef.detach(); overlayRef.detach();
if (!keepInOverlayRefs) { if (!keepInOverlayRefs) {
this._overlayRefs.delete(overlayRef); this._overlayRefs.delete(overlayRef);
} }
this.formControl.markAsTouched(); this.formControl.markAsTouched();
this._changeDetector.detectChanges(); this._changeDetector.detectChanges();
if (isByTab) {
this._tabulationService.focusNext(this._elementToReFocus);
} else {
this._tabulationService.focusPrev(this._elementToReFocus);
}
}
private _closeOverlays(isByTab: boolean = true): void {
this._overlayRefs.forEach(overlayRef => this._closeOverlay(overlayRef, isByTab, true));
this._overlayRefs.clear();
}
closeOverlays(keyEvent: KeyboardEvent, isByTab: boolean = true): void {
keyEvent.preventDefault();
this._closeOverlays(isByTab);
} }
private _getPosition(elementToConnectTo: ElementRef): FlexibleConnectedPositionStrategy { private _getPosition(elementToConnectTo: ElementRef): FlexibleConnectedPositionStrategy {
......
<lib-empty-container solidifyShortCuts <lib-empty-container solidifyShortCuts
cdkTrapFocus
[solidifyFocusFirstElement]="true" [solidifyFocusFirstElement]="true"
(keydown.tab)="closeByTab()" (keydown.tab)="closeByTab($event)"
(keydown.shift.tab)="closeByShiftTab()" (keydown.shift.tab)="closeByShiftTab($event)"
(onEscape)="close()" (onEscape)="close()"
(keydown.enter)="select(host.list[indexSelected])" (keydown.enter)="select(host.list[indexSelected])"
> >
......
<lib-empty-container [solidifyFocusFirstElement]="true" <lib-empty-container [solidifyFocusFirstElement]="true"
solidifyShortCuts solidifyShortCuts
cdkTrapFocus (keydown.tab)="closeByTab($event)"
(keydown.tab)="closeByTab()" (keydown.shift.tab)="closeByShiftTab($event)"
(keydown.shift.tab)="closeByShiftTab()"
(onEscape)="close()" (onEscape)="close()"
(onEnter)="select(host.list[indexSelected])" (onEnter)="select(host.list[indexSelected])"
> >
......
<form [formGroup]="form" <form [formGroup]="form"
[dlcmAutoScrollIntoView]="!navigationResId" [dlcmAutoScrollIntoView]="!navigationResId"
(keydown.tab)="closeByTab()" (keydown.tab)="closeByTab($event)"
(keydown.escape)="closeByTab()" (keydown.escape)="closeByTab($event)"
(keydown.shift.tab)="closeByShiftTab()" (keydown.shift.tab)="closeByShiftTab($event)"
> >
<div class="input"> <div class="input">
<mat-form-field class="form-field"> <mat-form-field class="form-field">
......
<form [formGroup]="form" <form [formGroup]="form"
[dlcmAutoScrollIntoView]="!navigationResId" [dlcmAutoScrollIntoView]="!navigationResId"
(keydown.shift.tab)="closeByShiftTab()" (keydown.shift.tab)="closeByShiftTab($event)"
(keydown.enter)="select(getFocusedResource())" (keydown.enter)="select(getFocusedResource())"
(keydown.tab)="closeByTab()"> (keydown.tab)="closeByTab($event)"
>
<div class="input"> <div class="input">
<mat-form-field class="form-field"> <mat-form-field class="form-field">
<input #input <input #input
......
...@@ -5,12 +5,12 @@ import { ...@@ -5,12 +5,12 @@ import {
Inject, Inject,
Injectable, Injectable,
} from "@angular/core"; } from "@angular/core";
import {NumberUtil} from "@shared/utils/number.util";
import { import {
isElement, isElement,
isFunction, isFunction,
isHtmlElement, isHtmlElement,
isTruthyObject, isTruthyObject,
NumberUtil,
} from "solidify-frontend"; } from "solidify-frontend";
@Injectable({providedIn: "root"}) @Injectable({providedIn: "root"})
......
import {isNumber} from "solidify-frontend";
export class NumberUtil {
static isBetween(value: number,
lowerBound: number = -Infinity,
upperBound: number = Infinity,
orEqualLowerBound?: boolean,
orEqualUpperBound: boolean = orEqualLowerBound): boolean {
if (!isNumber(value