feat(datepicker): introduce ZDatepicker component for enhanced date selection functionality

This commit is contained in:
Matej Glasnák committed 2025-12-02 15:30:55 +01:00
1 parent 205b3a7e42
commit a1e71006f0
4 files changed
+506 -29

No files matched your search

+61 -8
View File
@@ -57,17 +57,15 @@
<div class="splitted-inputs">
<!-- TODO: Bialko validacie -->
<div
@click="openDatepicker('datepicker-01')"
class="datepicker-wrapper"
>
<Datepicker
<div class="w-100 modal-input">
<Z-datepicker
v-model="subtask.deadline"
@open="onDateOpen"
ref="datepicker-01"
label="Deadline"
:auto-apply="true"
:min-date="new Date()"
class="modal-input left datepicker-input"
class="modal-input"
format="dd.MM.yyyy"
locale="sk"
select-text="Vybrať"
@@ -348,7 +346,7 @@
</template>
<script>
import Datepicker from '@vuepic/vue-datepicker';
import ZDatepicker from '@/plugins/tm@_components/z-datepicker.vue';
import ZFilesUpload from '@/plugins/tm@_components/z-files-upload.vue';
import useVuelidate from '@vuelidate/core';
import { required, requiredIf, optional } from '@vuelidate/validators';
@@ -375,7 +373,7 @@ export default {
ZTaskReadonlyInfo,
ATimeblock,
ZFilesUpload,
Datepicker,
ZDatepicker,
// ATaskTimeblocks,
QuillEditor,
},
@@ -505,6 +503,46 @@ export default {
},
methods: {
// Override onDateOpen from VuetifyFixFocusMixin to add logging
onDateOpen($event) {
console.log(
'🟡 [z-task-modal] onDateOpen called at:',
new Date().toISOString(),
'with event:',
$event,
);
// Call the parent mixin's onDateOpen method
if (
VuetifyFixFocusMixin.methods &&
VuetifyFixFocusMixin.methods.onDateOpen
) {
VuetifyFixFocusMixin.methods.onDateOpen.call(this, $event);
}
},
// Override onInputFocus from VuetifyFixFocusMixin to add logging
onInputFocus($event) {
const target = $event?.target;
console.log(
'🟡 [z-task-modal] onInputFocus called at:',
new Date().toISOString(),
'on:',
{
tagName: target?.tagName,
type: target?.type,
id: target?.id,
className: target?.className,
},
);
// Call the parent mixin's onInputFocus method
if (
VuetifyFixFocusMixin.methods &&
VuetifyFixFocusMixin.methods.onInputFocus
) {
VuetifyFixFocusMixin.methods.onInputFocus.call(this, $event);
}
},
toggleEditMode() {
if (this.subtask.type == 'office365')
return this.$events.emit('show-unable-to-edit-office-task-modal', {
@@ -560,6 +598,13 @@ export default {
async showModal({ subtask, editMode = false, mastertask = {} }) {
this.isSaving = false;
this.subtask = null;
// CRITICAL: Prevent v-dialog autofocus BEFORE modal opens
this.preventInputFocus = true;
console.log(
'🟡 [z-task-modal] showModal - preventInputFocus set to true BEFORE modal opens',
);
this.visible = true;
this.timeblocks = [
{
@@ -571,6 +616,14 @@ export default {
this.$nextTick(() => {
this.v$.$reset();
this.setFocusEvent();
// Reset after modal is fully rendered and v-dialog autofocus has been blocked
setTimeout(() => {
this.preventInputFocus = false;
console.log(
'🟡 [z-task-modal] showModal - preventInputFocus reset to false after 300ms',
);
}, 300);
});
try {