Update dd's mapped keys list to handle focusing like we want it

rancher/dashboard#2008
This commit is contained in:
Westly Wright 2021-01-05 11:10:03 -07:00
parent c5532582fa
commit 7446d13ca3
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
3 changed files with 75 additions and 18 deletions

View File

@ -8,6 +8,11 @@ export default {
// tab
(out[9] = (e) => {
// user esc'd
if (!vm.open) {
return;
}
e.preventDefault();
const optsLen = vm.filteredOptions.length;
@ -15,22 +20,79 @@ export default {
if (e.shiftKey) {
if (typeAheadPointer === 0) {
vm.$refs.search.focus();
return vm.onEscape();
}
return vm.typeAheadUp();
}
if (typeAheadPointer + 1 === optsLen) {
$(vm.$el).next().focus();
return vm.onEscape();
}
return vm.typeAheadDown();
});
(out[27] = (e) => {
vm.open = false;
vm.search = '';
return false;
});
(out[13] = (e, opt) => {
if (!vm.open) {
vm.open = true;
return;
}
let option = vm.filteredOptions[vm.typeAheadPointer];
vm.$emit('option:selecting', option);
if (!vm.isOptionSelected(option)) {
if (vm.taggable && !vm.optionExists(option)) {
vm.$emit('option:created', option);
}
if (vm.multiple) {
option = vm.selectedValue.concat(option);
}
vm.updateValue(option);
vm.$emit('option:selected', option);
if (vm.closeOnSelect) {
vm.open = false;
vm.typeAheadPointer = -1;
}
if (vm.clearSearchOnSelect) {
vm.search = '';
}
}
});
// up.prevent
(out[38] = (e) => {
e.preventDefault();
if (!vm.open) {
vm.open = true;
}
return vm.typeAheadUp();
});
// down.prevent
(out[40] = (e) => {
e.preventDefault();
if (!vm.open) {
vm.open = true;
}
return vm.typeAheadDown();
});
return out;
},
}

View File

@ -78,7 +78,7 @@
"vue-codemirror": "^4.0.6",
"vue-js-modal": "^1.3.31",
"vue-resize": "^0.4.5",
"vue-select": "^3.9.1",
"vue-select": "^3.11.2",
"vue-shortkey": "^3.1.7",
"vue2-transitions": "^0.3.0",
"xterm": "^4.7.0",

View File

@ -3114,15 +3114,10 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001093, caniuse-lite@^1.0.30001097:
version "1.0.30001100"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001100.tgz#2a58615e0c01cf716ab349b20ca4d86ef944aa4e"
integrity sha512-0eYdp1+wFCnMlCj2oudciuQn2B9xAFq3WpgpcBIZTxk/1HNA/O2YA7rpeYhnOqsqAJq1AHUgx6i1jtafg7m2zA==
caniuse-lite@^1.0.30001133:
version "1.0.30001135"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001135.tgz#995b1eb94404a3c9a0d7600c113c9bb27f2cd8aa"
integrity sha512-ziNcheTGTHlu9g34EVoHQdIu5g4foc8EsxMGC7Xkokmvw0dqNtX8BS8RgCgFBaAiSp2IdjvBxNdh0ssib28eVQ==
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001093, caniuse-lite@^1.0.30001097, caniuse-lite@^1.0.30001133:
version "1.0.30001173"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001173.tgz"
integrity sha512-R3aqmjrICdGCTAnSXtNyvWYMK3YtV5jwudbq0T7nN9k4kmE4CBuwPqyJ+KBzepSTh0huivV2gLbSMEzTTmfeYw==
caseless@~0.12.0:
version "0.12.0"
@ -12419,10 +12414,10 @@ vue-router@^3.4.3:
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.4.3.tgz#fa93768616ee338aa174f160ac965167fa572ffa"
integrity sha512-BADg1mjGWX18Dpmy6bOGzGNnk7B/ZA0RxuA6qedY/YJwirMfKXIDzcccmHbQI0A6k5PzMdMloc0ElHfyOoX35A==
vue-select@^3.9.1:
version "3.10.7"
resolved "https://registry.yarnpkg.com/vue-select/-/vue-select-3.10.7.tgz#58d756a7159bf923ce99abf74c5d6309ea998136"
integrity sha512-6rvIYBNEp9y0xK/sq2ZzDCxKA2BoVNliyctOeMtzarQzvpLlab7l8zvqr2jhGZOxozp7jd2AvZxpF3Ivems2wQ==
vue-select@^3.11.2:
version "3.11.2"
resolved "https://registry.yarnpkg.com/vue-select/-/vue-select-3.11.2.tgz#3ef93e3f2707e133c2df0b2920a05eea78764d18"
integrity sha512-pIOcY8ajWNSwg8Ns4eHVr5ZWwqKCSZeQRymTnlUI8i+3QiQXF6JIM4lylK6mVfbccs4S6vOyxB7zmJBpp7tDUg==
vue-server-renderer@^2.6.12:
version "2.6.12"