@db-ux/ngx-core-components 3.1.15 → 3.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2983,39 +2983,53 @@ class DBCustomSelect {
|
|
|
2983
2983
|
if (isCheckbox) {
|
|
2984
2984
|
const listElement = activeElement?.closest("li");
|
|
2985
2985
|
if (event.key === "ArrowDown" || event.key === "ArrowRight") {
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2986
|
+
// Find next element with input, skipping group titles
|
|
2987
|
+
let nextElement = listElement?.nextElementSibling;
|
|
2988
|
+
while (nextElement) {
|
|
2989
|
+
const nextInput = nextElement.querySelector("input");
|
|
2990
|
+
if (nextInput) {
|
|
2991
|
+
nextInput.focus();
|
|
2992
|
+
break;
|
|
2993
|
+
}
|
|
2994
|
+
nextElement = nextElement.nextElementSibling;
|
|
2990
2995
|
}
|
|
2991
|
-
|
|
2996
|
+
if (!nextElement) {
|
|
2992
2997
|
// We are on the last checkbox we move to the top checkbox
|
|
2993
2998
|
this.handleFocusFirstDropdownCheckbox(activeElement);
|
|
2994
2999
|
}
|
|
2995
3000
|
}
|
|
2996
3001
|
else {
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3002
|
+
// Find previous element with input, skipping group titles
|
|
3003
|
+
let prevElement = listElement?.previousElementSibling;
|
|
3004
|
+
while (prevElement) {
|
|
3005
|
+
const prevInput = prevElement.querySelector("input");
|
|
3006
|
+
if (prevInput) {
|
|
3007
|
+
prevInput.focus();
|
|
3008
|
+
break;
|
|
3009
|
+
}
|
|
3010
|
+
prevElement = prevElement.previousElementSibling;
|
|
3005
3011
|
}
|
|
3006
|
-
|
|
3007
|
-
//
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
search.focus();
|
|
3013
|
-
}, 100);
|
|
3012
|
+
if (!prevElement) {
|
|
3013
|
+
// Check if we have a "select all" checkbox (only relevant for multi-select)
|
|
3014
|
+
const selectAllCheckbox = this.detailsRef()?.nativeElement.querySelector(`input[type="checkbox"]`);
|
|
3015
|
+
if (selectAllCheckbox && selectAllCheckbox !== activeElement) {
|
|
3016
|
+
// We are on the top list checkbox but there is a select all checkbox as well
|
|
3017
|
+
this.handleFocusFirstDropdownCheckbox(activeElement);
|
|
3014
3018
|
}
|
|
3015
3019
|
else {
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3020
|
+
// We are on the top checkbox, we need to move to the search
|
|
3021
|
+
// or to the last checkbox
|
|
3022
|
+
const search = getSearchInput(this.detailsRef()?.nativeElement);
|
|
3023
|
+
if (search) {
|
|
3024
|
+
delay(() => {
|
|
3025
|
+
search.focus();
|
|
3026
|
+
}, 100);
|
|
3027
|
+
}
|
|
3028
|
+
else {
|
|
3029
|
+
const checkboxList = Array.from(this.detailsRef()?.nativeElement?.querySelectorAll(`input[type="checkbox"],input[type="radio"]`));
|
|
3030
|
+
if (checkboxList.length) {
|
|
3031
|
+
checkboxList.at(-1)?.focus();
|
|
3032
|
+
}
|
|
3019
3033
|
}
|
|
3020
3034
|
}
|
|
3021
3035
|
}
|