Skip to content

Commit

Permalink
fix(core): enable input field to remain active on mouse selection of …
Browse files Browse the repository at this point in the history
…the entered text (#51)

* fix(core): fix the invalid date issue when no time is selected for date/time column

* fix(core): enable input field to remain active on mouse selection of the entered text
  • Loading branch information
arpit1503khanna authored Feb 15, 2024
1 parent 100eb56 commit d10636e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,17 @@
let-nodeWithInput="nodeWithInput"
let-hide="hide"
>
<div (document:click)="hide()">
<div (document:click)="handleDocumentClick($event)">
<input
type="text"
class="text-input"
autofocus
value="{{ input.setValueName(nodeWithInput.node.state) }}"
(focusout)="callback($event.target)"
(mousedown)="handleMouseDown($event)"
(mouseup)="handleMouseUp()"
(mouseleave)="handleMouseLeave($event)"
placeholder="Enter the text here"
/>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class GroupComponent<E> implements OnInit, AfterViewInit {
private readonly localizationSvc: LocalizationProviderService,
) {}
public inputType = InputTypes;

private isMouseDown: boolean = false;
@Input()
group: AbstractBaseGroup<E>;

Expand Down Expand Up @@ -568,6 +568,27 @@ export class GroupComponent<E> implements OnInit, AfterViewInit {
return;
}

handleMouseDown(event: MouseEvent): void {
this.isMouseDown = true;
}

handleMouseUp(): void {
this.isMouseDown = false;
}

handleMouseLeave(event: MouseEvent): void {
this.isMouseDown = false;
}

handleDocumentClick(event: MouseEvent): void {
const target = event.target as HTMLElement;

// Check if the click is outside the input element and not part of a drag
if (!this.isMouseDown) {
// If not a drag and click outside the input, hide the input box
this.hidePopper();
}
}
/**
* It removes all the inputs that come after the current input
* @param element - NodeWithInput<E>
Expand Down
2 changes: 1 addition & 1 deletion projects/workflows-element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"access": "public",
"directory": "dist"
},
"hash": "388809af6444a8fc997fa5e1e76c0f7847b34244a3cb68d956706dec8c470733"
"hash": "04a0e776afc8afd96f827f3e10f8c4ae642720bd7f79d9dcc9ca4552b9295eb2"
}

0 comments on commit d10636e

Please sign in to comment.