fix: refs #8441 handle blur and focusout events to format date input
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
83ecfca6b8
commit
31e337c77b
|
@ -141,6 +141,16 @@ const formatDate = () => {
|
||||||
textColor.value = '';
|
textColor.value = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const didFormat = ref(false);
|
||||||
|
|
||||||
|
const handleBlurOrFocusout = (e) => {
|
||||||
|
if (!didFormat.value) {
|
||||||
|
formatDate();
|
||||||
|
didFormat.value = true;
|
||||||
|
nextTick(() => (didFormat.value = false));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleEnter = (event) => {
|
const handleEnter = (event) => {
|
||||||
formatDate();
|
formatDate();
|
||||||
|
|
||||||
|
@ -170,7 +180,8 @@ const handleEnter = (event) => {
|
||||||
:input-style="{ color: textColor }"
|
:input-style="{ color: textColor }"
|
||||||
@click="isPopupOpen = !isPopupOpen"
|
@click="isPopupOpen = !isPopupOpen"
|
||||||
@keydown="isPopupOpen = false"
|
@keydown="isPopupOpen = false"
|
||||||
@blur="formatDate"
|
@blur="handleBlurOrFocusout"
|
||||||
|
@focusout="handleBlurOrFocusout"
|
||||||
@keydown.enter.prevent="handleEnter"
|
@keydown.enter.prevent="handleEnter"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:data-cy="($attrs['data-cy'] ?? $attrs.label) + '_inputDate'"
|
:data-cy="($attrs['data-cy'] ?? $attrs.label) + '_inputDate'"
|
||||||
|
|
Loading…
Reference in New Issue