Merge pull request 'fix(VnTable): replace click event with mousedown for editable rows' (!1753) from fixTextSelectionOnInputOnVntable into dev
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1753
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Pablo Natek 2025-04-28 10:06:18 +00:00
commit 9528048b5f
1 changed files with 4 additions and 3 deletions

View File

@ -214,7 +214,7 @@ onBeforeMount(() => {
});
onMounted(async () => {
if ($props.isEditable) document.addEventListener('click', clickHandler);
if ($props.isEditable) document.addEventListener('mousedown', mousedownHandler);
mode.value =
quasar.platform.is.mobile && !$props.disableOption?.card
? CARD_MODE
@ -237,7 +237,7 @@ onMounted(async () => {
});
onUnmounted(async () => {
if ($props.isEditable) document.removeEventListener('click', clickHandler);
if ($props.isEditable) document.removeEventListener('mousedown', mousedownHandler);
});
watch(
@ -385,7 +385,7 @@ function hasEditableFormat(column) {
if (isEditableColumn(column)) return 'editable-text';
}
const clickHandler = async (event) => {
const mousedownHandler = async (event) => {
const clickedElement = event.target.closest('td');
const isDateElement = event.target.closest('.q-date');
const isTimeElement = event.target.closest('.q-time');
@ -408,6 +408,7 @@ const clickHandler = async (event) => {
}
if (isEditableColumn(column)) {
event.preventDefault();
await renderInput(Number(rowIndex), colField, clickedElement);
}
};