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