Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-06-20 00:17:07 +03:00
parent 963b73e7b0
commit b44d647b82

View File

@@ -150,10 +150,11 @@
</div> </div>
<div <div
ref="tableWrapRef"
class="table-wrap" class="table-wrap"
:style="{ :style="{
'--sticky-scroll-comp': `${stickyScrollComp}px`, '--sticky-scroll-comp': `${scrollRightComp}px`,
'--sticky-left-width': `${stickyLeftWidth}px` '--sticky-left-width': `${topScrollLeftWidth}px`
}" }"
> >
<div v-if="showGuidanceOverlay" class="empty-overlay"> <div v-if="showGuidanceOverlay" class="empty-overlay">
@@ -670,7 +671,7 @@
</template> </template>
<script setup> <script setup>
import { computed, nextTick, onMounted, ref, watch } from 'vue' import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { Notify } from 'quasar' import { Notify } from 'quasar'
import api from 'src/services/api' import api from 'src/services/api'
@@ -722,6 +723,9 @@ const imageListCache = new Map()
const variantCodeCollator = new Intl.Collator('tr', { numeric: true, sensitivity: 'base' }) const variantCodeCollator = new Intl.Collator('tr', { numeric: true, sensitivity: 'base' })
const mainTableRef = ref(null) const mainTableRef = ref(null)
const topScrollRef = ref(null) const topScrollRef = ref(null)
const tableWrapRef = ref(null)
const tableWrapWidth = ref(0)
let tableWrapResizeObserver = null
let syncingScroll = false let syncingScroll = false
const productCardDialog = ref(false) const productCardDialog = ref(false)
@@ -1473,9 +1477,16 @@ const filteredRows = computed(() => {
}) })
const tableMinWidth = computed(() => visibleColumns.value.reduce((sum, c) => sum + extractWidth(c.style), 0)) const tableMinWidth = computed(() => visibleColumns.value.reduce((sum, c) => sum + extractWidth(c.style), 0))
const measuredTableScrollWidth = ref(0) const measuredTableScrollWidth = ref(0)
const horizontalOverflowActive = computed(() => {
const wrapWidth = Number(tableWrapWidth.value || 0)
if (wrapWidth <= 0) return true
return tableMinWidth.value > wrapWidth - 8
})
const scrollRightComp = computed(() => horizontalOverflowActive.value ? stickyScrollComp.value : 0)
const topScrollLeftWidth = computed(() => horizontalOverflowActive.value ? stickyLeftWidth.value : 0)
const tableScrollWidth = computed(() => Math.max( const tableScrollWidth = computed(() => Math.max(
tableMinWidth.value + stickyScrollComp.value + 48, tableMinWidth.value + scrollRightComp.value + (horizontalOverflowActive.value ? 48 : 0),
measuredTableScrollWidth.value horizontalOverflowActive.value ? measuredTableScrollWidth.value : tableMinWidth.value
)) ))
const tableStyle = computed(() => ({ const tableStyle = computed(() => ({
width: `${tableMinWidth.value}px`, width: `${tableMinWidth.value}px`,
@@ -1740,10 +1751,16 @@ function updateTableScrollWidth () {
const measured = Math.max( const measured = Math.max(
Number(middle?.scrollWidth || 0), Number(middle?.scrollWidth || 0),
Number(table?.scrollWidth || 0), Number(table?.scrollWidth || 0),
tableMinWidth.value + stickyScrollComp.value + 48 tableMinWidth.value + scrollRightComp.value + (horizontalOverflowActive.value ? 48 : 0)
) )
if (measured > 0 && measured !== measuredTableScrollWidth.value) { const nextMeasured = horizontalOverflowActive.value ? measured : tableMinWidth.value
measuredTableScrollWidth.value = measured if (nextMeasured > 0 && nextMeasured !== measuredTableScrollWidth.value) {
measuredTableScrollWidth.value = nextMeasured
}
if (!horizontalOverflowActive.value) {
const top = topScrollRef.value
if (middle && middle.scrollLeft !== 0) middle.scrollLeft = 0
if (top && top.scrollLeft !== 0) top.scrollLeft = 0
} }
} }
@@ -1774,6 +1791,21 @@ function bindTableScrollSync () {
}, { passive: true }) }, { passive: true })
} }
function updateTableWrapWidth () {
tableWrapWidth.value = Number(tableWrapRef.value?.clientWidth || 0)
}
function bindTableWrapResize () {
updateTableWrapWidth()
if (!tableWrapRef.value || tableWrapResizeObserver) return
if (typeof ResizeObserver === 'undefined') return
tableWrapResizeObserver = new ResizeObserver(() => {
updateTableWrapWidth()
updateTableScrollWidth()
})
tableWrapResizeObserver.observe(tableWrapRef.value)
}
function escapeHtml (value) { function escapeHtml (value) {
return String(value ?? '') return String(value ?? '')
.replace(/&/g, '&amp;') .replace(/&/g, '&amp;')
@@ -1789,7 +1821,7 @@ watch(selectedProductCodes, (list) => {
} }
}) })
watch([tableMinWidth, rows, leftDetailsExpanded, selectedPriceOptions], async () => { watch([tableMinWidth, tableWrapWidth, rows, leftDetailsExpanded, selectedPriceOptions], async () => {
await nextTick() await nextTick()
bindTableScrollSync() bindTableScrollSync()
updateTableScrollWidth() updateTableScrollWidth()
@@ -1805,10 +1837,18 @@ onMounted(() => {
void fetchServerFilterOptions('urunAnaGrubu', '') void fetchServerFilterOptions('urunAnaGrubu', '')
void fetchServerFilterOptions('productCode', '') void fetchServerFilterOptions('productCode', '')
void nextTick(() => { void nextTick(() => {
bindTableWrapResize()
bindTableScrollSync() bindTableScrollSync()
updateTableScrollWidth() updateTableScrollWidth()
}) })
}) })
onBeforeUnmount(() => {
if (tableWrapResizeObserver) {
tableWrapResizeObserver.disconnect()
tableWrapResizeObserver = null
}
})
</script> </script>
<style scoped> <style scoped>