Skip to content

Commit

Permalink
wip: Refactor collections based components #917
Browse files Browse the repository at this point in the history
  • Loading branch information
cnouguier committed Aug 22, 2024
1 parent 2168886 commit a98f804
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/client/components/collection/KGrid.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="column no-wrap">
<div class="fit column no-wrap">
<!--
Header
-->
Expand Down
10 changes: 5 additions & 5 deletions core/client/components/collection/KScrollDown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<script setup>
import { ref, watch } from 'vue'
import { useQuasar, scroll as qScroll } from 'quasar'
import { useQuasar, scroll as qScrollUtils } from 'quasar'
import { clamp } from '../../utils'
// Props
Expand Down Expand Up @@ -62,20 +62,20 @@ function refresh () {
const targetElement = document.getElementById(props.target)
if (!targetElement) return
const containerHeight = targetElement.offsetHeight
const scrollHeight = qScroll.getScrollHeight(targetElement)
const scrollHeight = qScrollUtils.getScrollHeight(targetElement)
const diff = scrollHeight - containerHeight
if (diff <= 0) isVisible.value = false
else {
const ratio = clamp(qScroll.getVerticalScrollPosition(targetElement) / diff, 0, 1)
const ratio = clamp(qScrollUtils.getVerticalScrollPosition(targetElement) / diff, 0, 1)
const percent = Math.round(ratio * 10000) / 10000
isVisible.value = percent < 1
}
}
function scrollOnce () {
const targetElement = document.getElementById(props.target)
if (!targetElement) return
const position = qScroll.getVerticalScrollPosition(targetElement)
qScroll.setVerticalScrollPosition(targetElement, position + targetElement.offsetHeight, props.duration)
const position = qScrollUtils.getVerticalScrollPosition(targetElement)
qScrollUtils.setVerticalScrollPosition(targetElement, position + targetElement.offsetHeight, props.duration)
refresh()
}
Expand Down
6 changes: 3 additions & 3 deletions core/client/components/collection/KScrollToTop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<script setup>
import { ref, watch } from 'vue'
import { useQuasar, scroll as qScroll } from 'quasar'
import { useQuasar, scroll as qScrollUtils } from 'quasar'
// Props
const props = defineProps({
Expand Down Expand Up @@ -54,12 +54,12 @@ watch(() => [$q.screen.width, $q.screen.height], () => {
function refresh () {
const targetElement = document.getElementById(props.target)
if (!targetElement) return
isVisible.value = qScroll.getVerticalScrollPosition(targetElement) > 0
isVisible.value = qScrollUtils.getVerticalScrollPosition(targetElement) > 0
}
function scrollToTop () {
const targetElement = document.getElementById(props.target)
if (!targetElement) return
qScroll.setVerticalScrollPosition(targetElement, 0, props.duration)
qScrollUtils.setVerticalScrollPosition(targetElement, 0, props.duration)
refresh()
}
Expand Down
2 changes: 1 addition & 1 deletion core/client/components/collection/KTimeLine.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="column no-wrap">
<div class="fit column no-wrap">
<!--
Header
-->
Expand Down

0 comments on commit a98f804

Please sign in to comment.