Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -275,7 +275,6 @@
|
||||
arrows
|
||||
height="100%"
|
||||
class="product-card-carousel rounded-borders"
|
||||
@update:model-value="onProductCardSlideChange"
|
||||
>
|
||||
<q-carousel-slide
|
||||
v-for="(img, idx) in productCardImages"
|
||||
@@ -666,39 +665,6 @@ function sortImagesForDisplay(list) {
|
||||
return Array.isArray(list) ? [...list] : []
|
||||
}
|
||||
|
||||
function parseGalleryHashIndex() {
|
||||
if (typeof window === 'undefined') return 0
|
||||
const hash = String(window.location?.hash || '').trim()
|
||||
const m = hash.match(/^#([a-z0-9_-]+)-(\d+)$/i)
|
||||
if (!m) return 0
|
||||
const group = String(m[1] || '').toLowerCase()
|
||||
if (group !== 'gallery') return 0
|
||||
const n = Number(m[2] || 1)
|
||||
if (!Number.isFinite(n) || n < 1) return 0
|
||||
return n - 1
|
||||
}
|
||||
|
||||
function setGalleryHashIndex(idx) {
|
||||
if (typeof window === 'undefined') return
|
||||
const n = Math.max(1, Number(idx || 0) + 1)
|
||||
const targetHash = `#gallery-${n}`
|
||||
if (window.location.hash === targetHash) return
|
||||
const url = `${window.location.pathname}${window.location.search}${targetHash}`
|
||||
window.history.replaceState(null, '', url)
|
||||
}
|
||||
|
||||
function applyGalleryHashIndex() {
|
||||
const idx = parseGalleryHashIndex()
|
||||
const maxCard = Math.max(productCardImages.value.length - 1, 0)
|
||||
if (productCardDialog.value && productCardImages.value.length) {
|
||||
productCardSlide.value = Math.min(Math.max(idx, 0), maxCard)
|
||||
}
|
||||
const maxFull = Math.max(fullscreenImages.value.length - 1, 0)
|
||||
if (productImageFullscreenDialog.value && fullscreenImages.value.length) {
|
||||
productImageFullscreenSlide.value = Math.min(Math.max(idx, 0), maxFull)
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveProductImageUrlForCarousel(item) {
|
||||
const resolved = resolveProductImageUrl(item)
|
||||
const contentUrl = String(resolved.contentUrl || '').trim()
|
||||
@@ -1354,9 +1320,7 @@ async function openProductCard(grp1, grp2) {
|
||||
}
|
||||
|
||||
productCardImages.value = uniqueImages
|
||||
const hashIndex = parseGalleryHashIndex()
|
||||
productCardSlide.value = Math.min(Math.max(hashIndex, 0), Math.max(uniqueImages.length - 1, 0))
|
||||
setGalleryHashIndex(productCardSlide.value)
|
||||
productCardSlide.value = 0
|
||||
productCardData.value = {
|
||||
productCode,
|
||||
colorCode,
|
||||
@@ -1381,7 +1345,6 @@ function openProductImageFullscreen(src) {
|
||||
productImageFullscreenSrc.value = value
|
||||
const idx = Math.max(0, fullscreenImages.value.findIndex((x) => String(x || '').trim() === value))
|
||||
productImageFullscreenSlide.value = idx
|
||||
setGalleryHashIndex(idx)
|
||||
productImageFullscreenZoom.value = 1
|
||||
productImageFullscreenOffsetX.value = 0
|
||||
productImageFullscreenOffsetY.value = 0
|
||||
@@ -1440,17 +1403,12 @@ function onFullscreenMouseUp() {
|
||||
}
|
||||
|
||||
function onFullscreenSlideChange() {
|
||||
setGalleryHashIndex(productImageFullscreenSlide.value)
|
||||
productImageFullscreenZoom.value = 1
|
||||
productImageFullscreenOffsetX.value = 0
|
||||
productImageFullscreenOffsetY.value = 0
|
||||
productImageFullscreenDragging.value = false
|
||||
}
|
||||
|
||||
function onProductCardSlideChange() {
|
||||
setGalleryHashIndex(productCardSlide.value)
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
filters.value = createEmptyFilters()
|
||||
rawRows.value = []
|
||||
@@ -1483,14 +1441,11 @@ onMounted(() => {
|
||||
void loadFilterOptions(true)
|
||||
window.addEventListener('mousemove', onFullscreenMouseMove)
|
||||
window.addEventListener('mouseup', onFullscreenMouseUp)
|
||||
window.addEventListener('hashchange', applyGalleryHashIndex)
|
||||
applyGalleryHashIndex()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('mousemove', onFullscreenMouseMove)
|
||||
window.removeEventListener('mouseup', onFullscreenMouseUp)
|
||||
window.removeEventListener('hashchange', applyGalleryHashIndex)
|
||||
if (filterOptionsDebounceTimer) {
|
||||
clearTimeout(filterOptionsDebounceTimer)
|
||||
filterOptionsDebounceTimer = null
|
||||
|
||||
@@ -260,7 +260,6 @@
|
||||
arrows
|
||||
height="100%"
|
||||
class="product-card-carousel rounded-borders"
|
||||
@update:model-value="onProductCardSlideChange"
|
||||
>
|
||||
<q-carousel-slide
|
||||
v-for="(img, idx) in productCardImages"
|
||||
@@ -645,39 +644,6 @@ function sortImagesForDisplay(list) {
|
||||
return Array.isArray(list) ? [...list] : []
|
||||
}
|
||||
|
||||
function parseGalleryHashIndex() {
|
||||
if (typeof window === 'undefined') return 0
|
||||
const hash = String(window.location?.hash || '').trim()
|
||||
const m = hash.match(/^#([a-z0-9_-]+)-(\d+)$/i)
|
||||
if (!m) return 0
|
||||
const group = String(m[1] || '').toLowerCase()
|
||||
if (group !== 'gallery') return 0
|
||||
const n = Number(m[2] || 1)
|
||||
if (!Number.isFinite(n) || n < 1) return 0
|
||||
return n - 1
|
||||
}
|
||||
|
||||
function setGalleryHashIndex(idx) {
|
||||
if (typeof window === 'undefined') return
|
||||
const n = Math.max(1, Number(idx || 0) + 1)
|
||||
const targetHash = `#gallery-${n}`
|
||||
if (window.location.hash === targetHash) return
|
||||
const url = `${window.location.pathname}${window.location.search}${targetHash}`
|
||||
window.history.replaceState(null, '', url)
|
||||
}
|
||||
|
||||
function applyGalleryHashIndex() {
|
||||
const idx = parseGalleryHashIndex()
|
||||
const maxCard = Math.max(productCardImages.value.length - 1, 0)
|
||||
if (productCardDialog.value && productCardImages.value.length) {
|
||||
productCardSlide.value = Math.min(Math.max(idx, 0), maxCard)
|
||||
}
|
||||
const maxFull = Math.max(fullscreenImages.value.length - 1, 0)
|
||||
if (productImageFullscreenDialog.value && fullscreenImages.value.length) {
|
||||
productImageFullscreenSlide.value = Math.min(Math.max(idx, 0), maxFull)
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveProductImageUrlForCarousel(item) {
|
||||
const resolved = resolveProductImageUrl(item)
|
||||
const contentUrl = String(resolved.contentUrl || '').trim()
|
||||
@@ -1164,9 +1130,7 @@ async function openProductCard(grp1, grp2) {
|
||||
}
|
||||
|
||||
productCardImages.value = uniqueImages
|
||||
const hashIndex = parseGalleryHashIndex()
|
||||
productCardSlide.value = Math.min(Math.max(hashIndex, 0), Math.max(uniqueImages.length - 1, 0))
|
||||
setGalleryHashIndex(productCardSlide.value)
|
||||
productCardSlide.value = 0
|
||||
productCardData.value = {
|
||||
productCode,
|
||||
colorCode,
|
||||
@@ -1191,7 +1155,6 @@ function openProductImageFullscreen(src) {
|
||||
productImageFullscreenSrc.value = value
|
||||
const idx = Math.max(0, fullscreenImages.value.findIndex((x) => String(x || '').trim() === value))
|
||||
productImageFullscreenSlide.value = idx
|
||||
setGalleryHashIndex(idx)
|
||||
productImageFullscreenZoom.value = 1
|
||||
productImageFullscreenOffsetX.value = 0
|
||||
productImageFullscreenOffsetY.value = 0
|
||||
@@ -1250,17 +1213,12 @@ function onFullscreenMouseUp() {
|
||||
}
|
||||
|
||||
function onFullscreenSlideChange() {
|
||||
setGalleryHashIndex(productImageFullscreenSlide.value)
|
||||
productImageFullscreenZoom.value = 1
|
||||
productImageFullscreenOffsetX.value = 0
|
||||
productImageFullscreenOffsetY.value = 0
|
||||
productImageFullscreenDragging.value = false
|
||||
}
|
||||
|
||||
function onProductCardSlideChange() {
|
||||
setGalleryHashIndex(productCardSlide.value)
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
selectedProductCode.value = ''
|
||||
rawRows.value = []
|
||||
@@ -1290,7 +1248,6 @@ function resetForm() {
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('mousemove', onFullscreenMouseMove)
|
||||
window.removeEventListener('mouseup', onFullscreenMouseUp)
|
||||
window.removeEventListener('hashchange', applyGalleryHashIndex)
|
||||
for (const url of productImageBlobUrls.value) {
|
||||
try { URL.revokeObjectURL(url) } catch {}
|
||||
}
|
||||
@@ -1301,8 +1258,6 @@ onMounted(() => {
|
||||
loadProductOptions()
|
||||
window.addEventListener('mousemove', onFullscreenMouseMove)
|
||||
window.addEventListener('mouseup', onFullscreenMouseUp)
|
||||
window.addEventListener('hashchange', applyGalleryHashIndex)
|
||||
applyGalleryHashIndex()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user