Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Combobox value was not selected if the user typed very fast and then pressed #2226

Merged
merged 3 commits into from Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -127,11 +127,11 @@ export const TagInputEditor = inject(({property}: { property: IProperty }, {valu
}
}, []);

function handleInputKeyDown(event: any) {
async function handleInputKeyDown(event: any) {
if (event.key === "Backspace" && event.target.value === "" && value.length > 0) {
removeItem(event, value[value.length - 1]);
}
beh.handleInputKeyDown(event);
await beh.handleInputKeyDown(event);
props.onKeyDown?.(event);
}

Expand Down
Expand Up @@ -56,7 +56,7 @@ export class NotificationContainer extends React.Component<{}> {
return (
<div className={S.root}>
{formScreen.notifications.map(x =>
<div className={S.row}>
<div key={x.text + x.icon} className={S.row}>
<div className={S.iconContainer}>
{this.getIcon(x.icon)}
</div>
Expand Down
Expand Up @@ -226,7 +226,7 @@ export class DropdownEditorBehavior implements IDropdownEditorBehavior {
}

@action.bound
handleInputKeyDown(event: any) {
async handleInputKeyDown(event: any) {
const wasDropped = this.isDropped;
switch (event.key) {
case "Escape":
Expand Down Expand Up @@ -257,6 +257,9 @@ export class DropdownEditorBehavior implements IDropdownEditorBehavior {
if (this.cursorRowId) {
this.data.chooseNewValue(this.cursorRowId === "" ? null : this.cursorRowId);
}
else {
this.handleTabPressedBeforeDropdownReady();
}
}
else if (!this.isDropped && this.userEnteredValue === ""){
this.data.chooseNewValue(null);
Expand Down Expand Up @@ -309,6 +312,20 @@ export class DropdownEditorBehavior implements IDropdownEditorBehavior {
this.onKeyDown && this.onKeyDown(event);
}

private handleTabPressedBeforeDropdownReady() {
if (this.dataTable.allRows.length !== 0) {
return;
}
setTimeout(async () => {
this.handleInputChangeDeb.cancel();
if (!this.runningPromise) {
this.ensureRequestRunning();
}
await this.runningPromise;
this.data.chooseNewValue(!this.cursorRowId ? null : this.cursorRowId);
});
}

private clearSelection() {
this.userEnteredValue = undefined;
this.cursorRowId = "";
Expand Down
Expand Up @@ -3,6 +3,7 @@
xmlns:x="http://schemas.origam.com/model-persistence/1.0.0"
xmlns:adl="http://schemas.origam.com/Origam.Schema.LookupModel.AbstractDataLookup/6.0.0"
xmlns:asi="http://schemas.origam.com/Origam.Schema.AbstractSchemaItem/6.0.0"
xmlns:dlmb="http://schemas.origam.com/Origam.Schema.LookupModel.DataLookupMenuBinding/6.0.0"
xmlns:dsdl="http://schemas.origam.com/Origam.Schema.LookupModel.DataServiceDataLookup/6.0.0"
xmlns:nrsb="http://schemas.origam.com/Origam.Schema.LookupModel.NewRecordScreenBinding/6.0.0">
<dsdl:DataLookup
Expand All @@ -21,6 +22,13 @@
adl:valueDisplayMember="Label"
adl:valueMethod="Widgets/DataStructure/Widgets/LookupTagInputSource_Label_GetId.origam#LookupTagInputSource_Label_GetId/GetId/b21a1c22-3e17-492b-ad87-0fd028d1fa0d"
adl:valueValueMember="Id">
<dlmb:DataLookupMenuBinding
asi:abstract="false"
x:id="4b98a936-78c7-4d59-8420-bdd483af058e"
dlmb:level="100"
dlmb:menuItem="Widgets/Menu/Menu.origam#Menu/Widgets/MasterData/TagInputSource/83efdf7d-fa37-4c5e-905f-ff9cff25bbf2"
asi:name="MenuBinding"
dlmb:roles="*" />
<nrsb:NewRecordScreenBinding
asi:abstract="false"
nrsb:dialogHeight="200"
Expand Down