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

navigate between popup

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