Skip to content

Commit

Permalink
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions panel/src/components/Forms/Input/DateInput.vue
Original file line number Diff line number Diff line change
@@ -281,6 +281,8 @@ export default {
* => select the last affected part
* d. cursor selection cover last part
* => tab should blur the input, focus on next tabbale element
* e. cursor is at the end of the pattern
* => tab should blur the input, focus on next tabbale element
*
* @param {Event} event
*/
@@ -322,8 +324,33 @@ export default {
this.selectNext(selection.index);
}
} else {
// select default part (step unit)
event.shiftKey ? this.selectLast() : this.selectFirst();
// nothing or no part fully selected
if (
this.$refs.input &&
this.$refs.input.selectionStart == selection.end + 1 &&
selection.index == this.pattern.parts.length - 1
) {
// cursor at the end of the pattern, jump out
return;
}
// more than one part selected, select last affected part
else if (
this.$refs.input &&
this.$refs.input.selectionEnd - 1 > selection.end
) {
const last = this.pattern.at(
this.$refs.input.selectionEnd,
this.$refs.input.selectionEnd
);
this.select(this.pattern.parts[last.index]);
}
// select part where the cursor is located
else {
this.select(this.pattern.parts[selection.index]);
}
}
event.preventDefault();

0 comments on commit 25e075b

Please sign in to comment.