Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1446,7 +1446,11 @@ const filteredRows = computed(() => {
|
||||
return list
|
||||
})
|
||||
const tableMinWidth = computed(() => visibleColumns.value.reduce((sum, c) => sum + extractWidth(c.style), 0))
|
||||
const tableScrollWidth = computed(() => tableMinWidth.value + stickyScrollComp.value + 48)
|
||||
const measuredTableScrollWidth = ref(0)
|
||||
const tableScrollWidth = computed(() => Math.max(
|
||||
tableMinWidth.value + stickyScrollComp.value + 48,
|
||||
measuredTableScrollWidth.value
|
||||
))
|
||||
const tableStyle = computed(() => ({
|
||||
width: `${tableMinWidth.value}px`,
|
||||
minWidth: `${tableMinWidth.value}px`,
|
||||
@@ -1610,8 +1614,22 @@ function getTableMiddleEl () {
|
||||
return mainTableRef.value?.$el?.querySelector?.('.q-table__middle') || null
|
||||
}
|
||||
|
||||
function updateTableScrollWidth () {
|
||||
const middle = getTableMiddleEl()
|
||||
const table = mainTableRef.value?.$el?.querySelector?.('.q-table')
|
||||
const measured = Math.max(
|
||||
Number(middle?.scrollWidth || 0),
|
||||
Number(table?.scrollWidth || 0),
|
||||
tableMinWidth.value + stickyScrollComp.value + 48
|
||||
)
|
||||
if (measured > 0 && measured !== measuredTableScrollWidth.value) {
|
||||
measuredTableScrollWidth.value = measured
|
||||
}
|
||||
}
|
||||
|
||||
function onTopScroll () {
|
||||
if (syncingScroll) return
|
||||
updateTableScrollWidth()
|
||||
const middle = getTableMiddleEl()
|
||||
const top = topScrollRef.value
|
||||
if (!middle || !top) return
|
||||
@@ -1622,10 +1640,12 @@ function onTopScroll () {
|
||||
|
||||
function bindTableScrollSync () {
|
||||
const middle = getTableMiddleEl()
|
||||
updateTableScrollWidth()
|
||||
if (!middle || middle.__orderPriceListScrollBound) return
|
||||
middle.__orderPriceListScrollBound = true
|
||||
middle.addEventListener('scroll', () => {
|
||||
if (syncingScroll) return
|
||||
updateTableScrollWidth()
|
||||
const top = topScrollRef.value
|
||||
if (!top) return
|
||||
syncingScroll = true
|
||||
@@ -1649,9 +1669,10 @@ watch(selectedProductCodes, (list) => {
|
||||
}
|
||||
})
|
||||
|
||||
watch([tableMinWidth, rows], async () => {
|
||||
watch([tableMinWidth, rows, leftDetailsExpanded, selectedPriceOptions], async () => {
|
||||
await nextTick()
|
||||
bindTableScrollSync()
|
||||
updateTableScrollWidth()
|
||||
})
|
||||
|
||||
watch(allowedPriceOptions, () => {
|
||||
@@ -1663,7 +1684,10 @@ onMounted(() => {
|
||||
void fetchServerFilterOptions('urunIlkGrubu', '')
|
||||
void fetchServerFilterOptions('urunAnaGrubu', '')
|
||||
void fetchServerFilterOptions('productCode', '')
|
||||
void nextTick(bindTableScrollSync)
|
||||
void nextTick(() => {
|
||||
bindTableScrollSync()
|
||||
updateTableScrollWidth()
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user