mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
feat(datepicker): introduce ZDatepicker component for enhanced date selection functionality
This commit is contained in:
1 parent
205b3a7e42
commit
a1e71006f0
4 files changed
+506
-29
No files matched your search
@@ -57,24 +57,22 @@
|
||||
|
||||
<div class="splitted-inputs">
|
||||
<!-- TODO: Bialko validacie -->
|
||||
<div
|
||||
@click="handleDatepickerClick"
|
||||
class="datepicker-wrapper left"
|
||||
ref="datepicker-wrapper"
|
||||
>
|
||||
<Datepicker
|
||||
<div class="datepicker-wrapper left" ref="datepicker-wrapper">
|
||||
<Z-datepicker
|
||||
v-model="mastertask.deadline"
|
||||
ref="datepicker"
|
||||
label="Dátum"
|
||||
:auto-apply="true"
|
||||
:min-date="new Date()"
|
||||
class="modal-input datepicker-input"
|
||||
class="modal-input"
|
||||
format="dd.MM.yyyy"
|
||||
locale="sk"
|
||||
select-text="Vybrať"
|
||||
cancel-text="Zrušiť"
|
||||
placeholder="Dátum"
|
||||
placeholder="Deadline"
|
||||
:class="{ error: v$.mastertask.deadline.$errors?.length }"
|
||||
:validations="v$.mastertask.deadline"
|
||||
@open="onDateOpen"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -118,7 +116,7 @@
|
||||
class="modal-input"
|
||||
variant="solo"
|
||||
type="number"
|
||||
:label="`${mastertask.duration} h`"
|
||||
label="Naplánované hodiny"
|
||||
:disabled="true"
|
||||
></v-text-field>
|
||||
|
||||
@@ -312,7 +310,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, minLength } from '@vuelidate/validators';
|
||||
@@ -344,7 +342,7 @@ export default {
|
||||
components: {
|
||||
AMastertaskDescription,
|
||||
ATasksTable,
|
||||
Datepicker,
|
||||
ZDatepicker,
|
||||
ZFilesUpload,
|
||||
// ZAutocomplete,
|
||||
QuillEditor,
|
||||
@@ -461,11 +459,29 @@ export default {
|
||||
|
||||
methods: {
|
||||
handleDatepickerClick() {
|
||||
// Pass the datepicker wrapper element reference to the mixin
|
||||
const scrollTarget = this.$refs['datepicker-wrapper'];
|
||||
this.onDateOpen(scrollTarget);
|
||||
// Open the datepicker
|
||||
this.$refs['datepicker'].openMenu();
|
||||
// Open the datepicker - it now opens automatically via click on wrapper
|
||||
},
|
||||
|
||||
onDateOpen($event) {
|
||||
// $event should be the element reference (or any truthy value to trigger saving)
|
||||
if ($event) {
|
||||
// Find the scrollable modal container
|
||||
const modalContent = document.querySelector('.v-dialog .modal-content');
|
||||
if (modalContent) {
|
||||
this.savedScrollPosition = modalContent.scrollTop;
|
||||
}
|
||||
|
||||
this.preventInputFocus = true;
|
||||
|
||||
// Reattach focus event listeners
|
||||
this.setFocusEvent();
|
||||
|
||||
// Reset after datepicker is opened
|
||||
setTimeout(() => {
|
||||
this.preventInputFocus = false;
|
||||
this.savedScrollPosition = null;
|
||||
}, 500);
|
||||
}
|
||||
},
|
||||
|
||||
closeBothModals() {
|
||||
@@ -527,11 +543,26 @@ export default {
|
||||
async showModal({ mastertask, editMode = false }) {
|
||||
this.isSaving = false;
|
||||
this.editMode = null;
|
||||
|
||||
// CRITICAL: Prevent v-dialog autofocus BEFORE modal opens
|
||||
this.preventInputFocus = true;
|
||||
console.log(
|
||||
'🟠 [z-master-task-modal] showModal - preventInputFocus set to true BEFORE modal opens',
|
||||
);
|
||||
|
||||
this.visible = true;
|
||||
this.mastertask = null;
|
||||
this.$nextTick(() => {
|
||||
this.setFocusEvent();
|
||||
this.v$.$reset();
|
||||
|
||||
// Reset after modal is fully rendered and v-dialog autofocus has been blocked
|
||||
setTimeout(() => {
|
||||
this.preventInputFocus = false;
|
||||
console.log(
|
||||
'🟠 [z-master-task-modal] showModal - preventInputFocus reset to false after 300ms',
|
||||
);
|
||||
}, 300);
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -787,8 +818,4 @@ export default {
|
||||
|
||||
.datepicker-wrapper
|
||||
width: 100%
|
||||
.datepicker-input
|
||||
width: 100% !important
|
||||
height: 100%
|
||||
pointer-events: none
|
||||
</style>
|
||||
Reference in new issue
Block a user