Skip to content

Commit

Permalink
autocomplete bug
Browse files Browse the repository at this point in the history
  • Loading branch information
FredericHeem committed Nov 24, 2023
1 parent e42294b commit 2b3c249
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
13 changes: 8 additions & 5 deletions bau-ui/autocomplete/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ export default function (context, componentOptions = {}) {
const dialogClose = () => {
popoverEl.closeDialog();
openState.val = false;
inputState.val = "";
itemIndexActive.val = 0;
};

Expand All @@ -135,10 +134,15 @@ export default function (context, componentOptions = {}) {
popoverEl.open ? dialogClose() : dialogOpen();
};

const saveOption = (option) => {
selectedState.val = option;
inputShadowEl.value = getOptionValue(option);
};

const onclickItem =
({ option, index }) =>
(event) => {
selectedState.val = option;
saveOption(option);
itemIndexActive.val = index;
dialogClose();
};
Expand Down Expand Up @@ -173,8 +177,7 @@ export default function (context, componentOptions = {}) {
break;
case "Enter":
if (popoverEl.open) {
selectedState.val = optionsFilteredState.val[itemIndexActive.val];
inputState.val = "";
saveOption(optionsFilteredState.val[itemIndexActive.val]);
dialogClose();
} else {
dialogOpen();
Expand Down Expand Up @@ -227,7 +230,7 @@ export default function (context, componentOptions = {}) {
position: absolute;
`,
tabindex: -1,
value: inputState,
defaultValue: defaultOption && getOptionValue(defaultOption),
required,
name,
});
Expand Down
6 changes: 3 additions & 3 deletions examples/gccd/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gcmp",
"private": true,
"version": "0.60.0",
"version": "13.0.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -11,8 +11,8 @@
"azure-regions": "cd scripts; node azureRegions.js",
"google-regions": "cd scripts; node googleRegions.js",
"docker:build": "docker build -t grucloud-ui .",
"docker:tag": "docker tag grucloud-ui fredericheem/grucloud-ui:12.21",
"docker:push": "docker push fredericheem/grucloud-ui:12.21",
"docker:tag": "docker tag grucloud-ui fredericheem/grucloud-ui:13.0.0",
"docker:push": "docker push fredericheem/grucloud-ui:13.0.0",
"docker:btp": "npm run docker:build && npm run docker:tag && npm run docker:push"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ export default (context: Context) => {
"Tenant Id",
Input({
"data-input-azure-tenant-id": true,
autofocus: true,
placeholder: "Tenant Id",
name: "AZURE_TENANT_ID",
defaultValue: AZURE_TENANT_ID,
Expand Down

0 comments on commit 2b3c249

Please sign in to comment.