quasar 1.16.2 → 1.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/BottomSheet.json +2 -2
- package/dist/api/Loading.json +0 -2
- package/dist/api/LoadingBar.json +1 -1
- package/dist/api/Notify.json +25 -25
- package/dist/api/QAjaxBar.json +23 -4
- package/dist/api/QAvatar.json +1 -1
- package/dist/api/QBreadcrumbsEl.json +32 -11
- package/dist/api/QBtn.json +35 -14
- package/dist/api/QBtnDropdown.json +36 -15
- package/dist/api/QBtnToggle.json +1 -1
- package/dist/api/QCarousel.json +7 -7
- package/dist/api/QCarouselSlide.json +2 -2
- package/dist/api/QChatMessage.json +1 -5
- package/dist/api/QChip.json +4 -4
- package/dist/api/QColor.json +6 -0
- package/dist/api/QDialog.json +7 -1
- package/dist/api/QExpansionItem.json +34 -13
- package/dist/api/QFab.json +34 -2
- package/dist/api/QFabAction.json +9 -1
- package/dist/api/QField.json +80 -6
- package/dist/api/QFile.json +80 -6
- package/dist/api/QImg.json +2 -2
- package/dist/api/QInnerLoading.json +32 -0
- package/dist/api/QInput.json +82 -6
- package/dist/api/QItem.json +31 -10
- package/dist/api/QOptionGroup.json +58 -1
- package/dist/api/QPagination.json +4 -4
- package/dist/api/QParallax.json +1 -1
- package/dist/api/QPopupEdit.json +14 -7
- package/dist/api/QPullToRefresh.json +1 -1
- package/dist/api/QRange.json +581 -96
- package/dist/api/QRating.json +3 -3
- package/dist/api/QRouteTab.json +32 -12
- package/dist/api/QScrollArea.json +188 -20
- package/dist/api/QSelect.json +82 -10
- package/dist/api/QSeparator.json +1 -1
- package/dist/api/QSlider.json +499 -34
- package/dist/api/QStep.json +4 -4
- package/dist/api/QStepper.json +4 -4
- package/dist/api/QTab.json +1 -1
- package/dist/api/QTable.json +4 -4
- package/dist/api/QTabs.json +9 -0
- package/dist/api/QTimelineEntry.json +2 -2
- package/dist/api/QToggle.json +1 -1
- package/dist/api/QTree.json +7 -1
- package/dist/api/QVideo.json +10 -0
- package/dist/icon-set/bootstrap-icons.umd.min.js +1 -1
- package/dist/icon-set/eva-icons.umd.min.js +1 -1
- package/dist/icon-set/fontawesome-v5-pro.umd.min.js +1 -1
- package/dist/icon-set/fontawesome-v5.umd.min.js +1 -1
- package/dist/icon-set/ionicons-v4.umd.min.js +1 -1
- package/dist/icon-set/line-awesome.umd.min.js +1 -1
- package/dist/icon-set/material-icons-outlined.umd.min.js +1 -1
- package/dist/icon-set/material-icons-round.umd.min.js +1 -1
- package/dist/icon-set/material-icons-sharp.umd.min.js +1 -1
- package/dist/icon-set/material-icons.umd.min.js +1 -1
- package/dist/icon-set/mdi-v3.umd.min.js +1 -1
- package/dist/icon-set/mdi-v4.umd.min.js +1 -1
- package/dist/icon-set/mdi-v5.umd.min.js +1 -1
- package/dist/icon-set/mdi-v6.umd.min.js +1 -1
- package/dist/icon-set/svg-bootstrap-icons.umd.min.js +1 -1
- package/dist/icon-set/svg-eva-icons.umd.min.js +1 -1
- package/dist/icon-set/svg-fontawesome-v5.umd.min.js +1 -1
- package/dist/icon-set/svg-ionicons-v4.umd.min.js +1 -1
- package/dist/icon-set/svg-ionicons-v5.umd.min.js +1 -1
- package/dist/icon-set/svg-ionicons-v6.umd.min.js +6 -0
- package/dist/icon-set/svg-line-awesome.umd.min.js +1 -1
- package/dist/icon-set/svg-material-icons-outlined.umd.min.js +1 -1
- package/dist/icon-set/svg-material-icons-round.umd.min.js +1 -1
- package/dist/icon-set/svg-material-icons-sharp.umd.min.js +1 -1
- package/dist/icon-set/svg-material-icons.umd.min.js +1 -1
- package/dist/icon-set/svg-mdi-v4.umd.min.js +1 -1
- package/dist/icon-set/svg-mdi-v5.umd.min.js +1 -1
- package/dist/icon-set/svg-mdi-v6.umd.min.js +1 -1
- package/dist/icon-set/svg-themify.umd.min.js +1 -1
- package/dist/icon-set/themify.umd.min.js +1 -1
- package/dist/lang/ar.umd.min.js +2 -2
- package/dist/lang/az-latn.umd.min.js +1 -1
- package/dist/lang/bg.umd.min.js +1 -1
- package/dist/lang/ca.umd.min.js +1 -1
- package/dist/lang/cs.umd.min.js +1 -1
- package/dist/lang/da.umd.min.js +1 -1
- package/dist/lang/de.umd.min.js +1 -1
- package/dist/lang/el.umd.min.js +1 -1
- package/dist/lang/en-gb.umd.min.js +1 -1
- package/dist/lang/en-us.umd.min.js +1 -1
- package/dist/lang/eo.umd.min.js +1 -1
- package/dist/lang/es.umd.min.js +1 -1
- package/dist/lang/et.umd.min.js +1 -1
- package/dist/lang/fa-ir.umd.min.js +1 -1
- package/dist/lang/fa.umd.min.js +1 -1
- package/dist/lang/fi.umd.min.js +1 -1
- package/dist/lang/fr.umd.min.js +2 -2
- package/dist/lang/gn.umd.min.js +1 -1
- package/dist/lang/he.umd.min.js +1 -1
- package/dist/lang/hr.umd.min.js +1 -1
- package/dist/lang/hu.umd.min.js +1 -1
- package/dist/lang/id.umd.min.js +1 -1
- package/dist/lang/is.umd.min.js +1 -1
- package/dist/lang/it.umd.min.js +1 -1
- package/dist/lang/ja.umd.min.js +1 -1
- package/dist/lang/km.umd.min.js +1 -1
- package/dist/lang/ko-kr.umd.min.js +1 -1
- package/dist/lang/kur-ckb.umd.min.js +1 -1
- package/dist/lang/lu.umd.min.js +1 -1
- package/dist/lang/lv.umd.min.js +1 -1
- package/dist/lang/ml.umd.min.js +1 -1
- package/dist/lang/ms.umd.min.js +1 -1
- package/dist/lang/nb-no.umd.min.js +1 -1
- package/dist/lang/nl.umd.min.js +1 -1
- package/dist/lang/pl.umd.min.js +1 -1
- package/dist/lang/pt-br.umd.min.js +1 -1
- package/dist/lang/pt.umd.min.js +1 -1
- package/dist/lang/ro.umd.min.js +1 -1
- package/dist/lang/ru.umd.min.js +1 -1
- package/dist/lang/sk.umd.min.js +1 -1
- package/dist/lang/sl.umd.min.js +1 -1
- package/dist/lang/sr.umd.min.js +2 -2
- package/dist/lang/sv.umd.min.js +1 -1
- package/dist/lang/ta.umd.min.js +1 -1
- package/dist/lang/th.umd.min.js +1 -1
- package/dist/lang/tr.umd.min.js +1 -1
- package/dist/lang/ug.umd.min.js +2 -2
- package/dist/lang/uk.umd.min.js +1 -1
- package/dist/lang/vi.umd.min.js +1 -1
- package/dist/lang/zh-hans.umd.min.js +2 -2
- package/dist/lang/zh-hant.umd.min.js +2 -2
- package/dist/quasar.addon.css +1 -1
- package/dist/quasar.addon.rtl.css +1 -1
- package/dist/quasar.common.js +2 -2
- package/dist/quasar.css +378 -226
- package/dist/quasar.esm.js +2 -2
- package/dist/quasar.ie.polyfills.js +1 -1
- package/dist/quasar.ie.polyfills.umd.min.js +1 -1
- package/dist/quasar.min.css +1 -1
- package/dist/quasar.rtl.css +510 -302
- package/dist/quasar.rtl.min.css +1 -1
- package/dist/quasar.sass +326 -211
- package/dist/quasar.styl +326 -209
- package/dist/quasar.umd.js +3240 -1889
- package/dist/quasar.umd.min.js +2 -2
- package/dist/quasar.umd.modern.js +3199 -1870
- package/dist/quasar.umd.modern.min.js +2 -2
- package/dist/transform-asset-urls.json +20 -0
- package/dist/types/index.d.ts +427 -105
- package/dist/types/utils/scroll.d.ts +1 -0
- package/dist/vetur/quasar-attributes.json +320 -92
- package/dist/vetur/quasar-tags.json +76 -19
- package/dist/web-types/web-types.json +1296 -257
- package/icon-set/svg-ionicons-v6.js +225 -0
- package/lang/ar.js +1 -1
- package/lang/fa-ir.js +3 -1
- package/lang/fa.js +3 -1
- package/lang/fr.js +1 -1
- package/lang/index.json +1 -1
- package/lang/kur-ckb.js +2 -2
- package/lang/sr.js +4 -4
- package/lang/ug.js +48 -46
- package/lang/zh-hans.js +1 -1
- package/lang/zh-hant.js +18 -18
- package/package.json +1 -1
- package/src/api.extends.json +1 -2
- package/src/components/ajax-bar/QAjaxBar.js +48 -26
- package/src/components/ajax-bar/QAjaxBar.json +22 -4
- package/src/components/breadcrumbs/QBreadcrumbs.js +15 -11
- package/src/components/breadcrumbs/QBreadcrumbs.sass +0 -3
- package/src/components/breadcrumbs/QBreadcrumbs.styl +0 -3
- package/src/components/breadcrumbs/QBreadcrumbsEl.js +25 -9
- package/src/components/btn/QBtn.js +3 -3
- package/src/components/btn-dropdown/QBtnDropdown.sass +2 -0
- package/src/components/btn-dropdown/QBtnDropdown.styl +2 -0
- package/src/components/btn-toggle/QBtnToggle.js +4 -1
- package/src/components/carousel/QCarousel.js +6 -2
- package/src/components/carousel/QCarousel.json +9 -1
- package/src/components/carousel/QCarouselSlide.json +2 -2
- package/src/components/chat/QChatMessage.json +1 -1
- package/src/components/color/QColor.js +100 -85
- package/src/components/color/QColor.json +7 -0
- package/src/components/color/QColor.sass +14 -24
- package/src/components/color/QColor.styl +14 -24
- package/src/components/date/QDate.js +7 -1
- package/src/components/date/QDate.sass +2 -0
- package/src/components/date/QDate.styl +2 -0
- package/src/components/dialog/QDialog.js +8 -4
- package/src/components/dialog/QDialog.json +8 -1
- package/src/components/drawer/QDrawer.js +16 -15
- package/src/components/editor/QEditor.js +2 -2
- package/src/components/editor/QEditor.sass +13 -1
- package/src/components/editor/QEditor.styl +13 -1
- package/src/components/expansion-item/QExpansionItem.js +13 -11
- package/src/components/fab/QFab.js +20 -11
- package/src/components/fab/QFab.json +35 -0
- package/src/components/fab/QFabAction.js +16 -9
- package/src/components/fab/QFabAction.json +10 -0
- package/src/components/field/QField.js +28 -23
- package/src/components/field/__QField.json +72 -8
- package/src/components/file/QFile.js +12 -4
- package/src/components/file/QFile.sass +4 -3
- package/src/components/file/QFile.styl +4 -3
- package/src/components/footer/QFooter.js +1 -1
- package/src/components/form/QForm.js +1 -1
- package/src/components/header/QHeader.js +1 -1
- package/src/components/icon/QIcon.js +92 -75
- package/src/components/icon/QIcon.sass +0 -1
- package/src/components/icon/QIcon.styl +0 -1
- package/src/components/img/QImg.json +2 -2
- package/src/components/infinite-scroll/QInfiniteScroll.js +49 -36
- package/src/components/inner-loading/QInnerLoading.js +54 -22
- package/src/components/inner-loading/QInnerLoading.json +29 -0
- package/src/components/inner-loading/QInnerLoading.sass +3 -0
- package/src/components/inner-loading/QInnerLoading.styl +3 -0
- package/src/components/item/QItem.js +9 -15
- package/src/components/layout/QLayout.js +49 -0
- package/src/components/linear-progress/QLinearProgress.js +6 -2
- package/src/components/menu/QMenu.js +5 -1
- package/src/components/option-group/QOptionGroup.js +32 -22
- package/src/components/option-group/QOptionGroup.json +50 -1
- package/src/components/parallax/QParallax.js +3 -0
- package/src/components/parallax/QParallax.json +1 -1
- package/src/components/popup-edit/QPopupEdit.js +41 -16
- package/src/components/popup-edit/QPopupEdit.json +15 -8
- package/src/components/range/QRange.js +223 -278
- package/src/components/range/QRange.json +11 -122
- package/src/components/rating/QRating.js +56 -38
- package/src/components/rating/QRating.json +3 -3
- package/src/components/rating/QRating.sass +8 -6
- package/src/components/rating/QRating.styl +8 -6
- package/src/components/resize-observer/QResizeObserver.js +15 -10
- package/src/components/scroll-area/QScrollArea.js +342 -126
- package/src/components/scroll-area/QScrollArea.json +164 -20
- package/src/components/scroll-area/QScrollArea.sass +5 -0
- package/src/components/scroll-area/QScrollArea.styl +5 -0
- package/src/components/scroll-observer/QScrollObserver.js +9 -2
- package/src/components/select/QSelect.js +8 -2
- package/src/components/select/QSelect.json +1 -1
- package/src/components/separator/QSeparator.js +0 -1
- package/src/components/separator/QSeparator.json +1 -1
- package/src/components/slider/QSlider.js +97 -140
- package/src/components/slider/QSlider.json +1 -122
- package/src/components/slider/QSlider.sass +205 -139
- package/src/components/slider/QSlider.styl +205 -139
- package/src/components/slider/slider-utils.js +468 -123
- package/src/components/slider/slider-utils.json +546 -0
- package/src/components/stepper/QStepper.js +1 -1
- package/src/components/stepper/QStepper.sass +25 -26
- package/src/components/stepper/QStepper.styl +25 -26
- package/src/components/table/QTable.sass +3 -0
- package/src/components/table/QTable.styl +3 -0
- package/src/components/tabs/QRouteTab.js +13 -13
- package/src/components/tabs/QRouteTab.json +0 -7
- package/src/components/tabs/QTab.js +71 -20
- package/src/components/tabs/QTabs.js +237 -52
- package/src/components/tabs/QTabs.json +8 -0
- package/src/components/tabs/QTabs.sass +6 -6
- package/src/components/tabs/QTabs.styl +6 -6
- package/src/components/time/QTime.js +6 -2
- package/src/components/timeline/QTimeline.sass +1 -2
- package/src/components/timeline/QTimeline.styl +1 -2
- package/src/components/timeline/QTimelineEntry.json +1 -1
- package/src/components/tree/QTree.js +10 -6
- package/src/components/tree/QTree.json +5 -0
- package/src/components/tree/QTree.sass +58 -4
- package/src/components/tree/QTree.styl +58 -4
- package/src/components/uploader/QUploaderBase.js +15 -19
- package/src/components/video/QVideo.js +4 -1
- package/src/components/video/QVideo.json +11 -0
- package/src/components/virtual-scroll/QVirtualScroll.sass +1 -0
- package/src/components/virtual-scroll/QVirtualScroll.styl +1 -0
- package/src/css/core/helpers.sass +3 -0
- package/src/css/core/helpers.styl +3 -0
- package/src/css/core/positioning.sass +5 -0
- package/src/css/core/positioning.styl +5 -0
- package/src/css/normalize.sass +0 -7
- package/src/css/variables.sass +4 -6
- package/src/css/variables.styl +4 -6
- package/src/directives/Scroll.js +2 -2
- package/src/directives/ScrollFire.js +1 -0
- package/src/ie-compat/ie.js +13 -13
- package/src/install.js +1 -1
- package/src/lang.js +7 -4
- package/src/mixins/anchor.js +3 -13
- package/src/mixins/btn.js +33 -38
- package/src/mixins/btn.json +26 -11
- package/src/mixins/file.js +27 -5
- package/src/mixins/fullscreen.js +16 -4
- package/src/mixins/portal.js +10 -10
- package/src/mixins/router-link.js +88 -14
- package/src/mixins/router-link.json +26 -10
- package/src/mixins/validate.js +33 -15
- package/src/mixins/virtual-scroll.js +40 -42
- package/src/plugins/AppFullscreen.js +41 -16
- package/src/plugins/BottomSheet.json +1 -1
- package/src/plugins/Cookies.js +1 -1
- package/src/plugins/Loading.js +8 -0
- package/src/plugins/LoadingBar.js +9 -0
- package/src/plugins/LoadingBar.json +1 -1
- package/src/plugins/Notify.js +351 -333
- package/src/plugins/Notify.json +20 -20
- package/src/plugins/Notify.sass +9 -3
- package/src/plugins/Notify.styl +9 -3
- package/src/utils/clone.js +53 -4
- package/src/utils/date.js +134 -69
- package/src/utils/dom.js +28 -9
- package/src/utils/extend.js +2 -2
- package/src/utils/focus-manager.js +8 -10
- package/src/utils/global-dialog.js +18 -1
- package/src/utils/is.js +2 -2
- package/src/utils/morph.js +2 -12
- package/src/utils/scroll.js +71 -35
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import Vue from 'vue'
|
|
2
2
|
|
|
3
|
+
import QResizeObserver from '../resize-observer/QResizeObserver.js'
|
|
4
|
+
import QScrollObserver from '../scroll-observer/QScrollObserver.js'
|
|
5
|
+
|
|
6
|
+
import TouchPan from '../../directives/TouchPan.js'
|
|
7
|
+
|
|
3
8
|
import { between } from '../../utils/format.js'
|
|
4
|
-
import {
|
|
9
|
+
import { setVerticalScrollPosition, setHorizontalScrollPosition } from '../../utils/scroll.js'
|
|
5
10
|
import { mergeSlot } from '../../utils/slot.js'
|
|
6
11
|
import cache from '../../utils/cache.js'
|
|
7
12
|
import debounce from '../../utils/debounce.js'
|
|
8
13
|
|
|
9
|
-
import QResizeObserver from '../resize-observer/QResizeObserver.js'
|
|
10
|
-
import QScrollObserver from '../scroll-observer/QScrollObserver.js'
|
|
11
|
-
import TouchPan from '../../directives/TouchPan.js'
|
|
12
14
|
import DarkMixin from '../../mixins/dark.js'
|
|
13
15
|
import { ariaHidden } from '../../mixins/attrs'
|
|
14
16
|
|
|
17
|
+
const axisList = [ 'vertical', 'horizontal' ]
|
|
18
|
+
const dirProps = {
|
|
19
|
+
vertical: { offset: 'offsetY', scroll: 'scrollTop', dir: 'down', dist: 'y' },
|
|
20
|
+
horizontal: { offset: 'offsetX', scroll: 'scrollLeft', dir: 'right', dist: 'x' }
|
|
21
|
+
}
|
|
22
|
+
|
|
15
23
|
export default Vue.extend({
|
|
16
24
|
name: 'QScrollArea',
|
|
17
25
|
|
|
@@ -22,13 +30,19 @@ export default Vue.extend({
|
|
|
22
30
|
},
|
|
23
31
|
|
|
24
32
|
props: {
|
|
25
|
-
barStyle: [ Array, String, Object ],
|
|
26
33
|
thumbStyle: Object,
|
|
34
|
+
verticalThumbStyle: Object,
|
|
35
|
+
horizontalThumbStyle: Object,
|
|
36
|
+
|
|
37
|
+
barStyle: [ Array, String, Object ],
|
|
38
|
+
verticalBarStyle: [ Array, String, Object ],
|
|
39
|
+
horizontalBarStyle: [ Array, String, Object ],
|
|
40
|
+
|
|
27
41
|
contentStyle: [ Array, String, Object ],
|
|
28
42
|
contentActiveStyle: [ Array, String, Object ],
|
|
29
43
|
|
|
30
44
|
delay: {
|
|
31
|
-
type: [String, Number],
|
|
45
|
+
type: [ String, Number ],
|
|
32
46
|
default: 1000
|
|
33
47
|
},
|
|
34
48
|
|
|
@@ -39,7 +53,7 @@ export default Vue.extend({
|
|
|
39
53
|
|
|
40
54
|
horizontal: Boolean,
|
|
41
55
|
|
|
42
|
-
tabindex: [String, Number]
|
|
56
|
+
tabindex: [ String, Number ]
|
|
43
57
|
},
|
|
44
58
|
|
|
45
59
|
data () {
|
|
@@ -50,10 +64,22 @@ export default Vue.extend({
|
|
|
50
64
|
hover: false,
|
|
51
65
|
|
|
52
66
|
// other...
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
container: {
|
|
68
|
+
vertical: 0,
|
|
69
|
+
horizontal: 0
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
scroll: {
|
|
73
|
+
vertical: {
|
|
74
|
+
position: 0,
|
|
75
|
+
size: 0
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
horizontal: {
|
|
79
|
+
position: 0,
|
|
80
|
+
size: 0
|
|
81
|
+
}
|
|
82
|
+
}
|
|
57
83
|
}
|
|
58
84
|
},
|
|
59
85
|
|
|
@@ -63,82 +89,148 @@ export default Vue.extend({
|
|
|
63
89
|
(this.isDark === true ? ' q-scrollarea--dark' : '')
|
|
64
90
|
},
|
|
65
91
|
|
|
66
|
-
|
|
92
|
+
verticalScrollPercentage () {
|
|
93
|
+
const diff = this.scroll.vertical.size - this.container.vertical
|
|
94
|
+
if (diff <= 0) { return 0 }
|
|
95
|
+
const p = between(this.scroll.vertical.position / diff, 0, 1)
|
|
96
|
+
return Math.round(p * 10000) / 10000
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
horizontalScrollPercentage () {
|
|
100
|
+
const diff = this.scroll.horizontal.size - this.container.horizontal
|
|
101
|
+
if (diff <= 0) { return 0 }
|
|
102
|
+
const p = between(this.scroll.horizontal.position / diff, 0, 1)
|
|
103
|
+
return Math.round(p * 10000) / 10000
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
verticalThumbHidden () {
|
|
67
107
|
return (
|
|
68
108
|
(this.visible === null ? this.hover : this.visible) !== true &&
|
|
69
109
|
this.tempShowing === false &&
|
|
70
110
|
this.panning === false
|
|
71
|
-
) || this.
|
|
111
|
+
) || this.scroll.vertical.size <= this.container.vertical + 1
|
|
72
112
|
},
|
|
73
113
|
|
|
74
|
-
|
|
114
|
+
horizontalThumbHidden () {
|
|
115
|
+
return (
|
|
116
|
+
(this.visible === null ? this.hover : this.visible) !== true &&
|
|
117
|
+
this.tempShowing === false &&
|
|
118
|
+
this.panning === false
|
|
119
|
+
) || this.scroll.horizontal.size <= this.container.horizontal + 1
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
verticalThumbSize () {
|
|
75
123
|
return Math.round(
|
|
76
124
|
between(
|
|
77
|
-
this.
|
|
125
|
+
this.container.vertical * this.container.vertical / this.scroll.vertical.size,
|
|
78
126
|
50,
|
|
79
|
-
this.
|
|
127
|
+
this.container.vertical
|
|
80
128
|
)
|
|
81
129
|
)
|
|
82
130
|
},
|
|
83
131
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
left: `${pos}px`,
|
|
92
|
-
width: `${this.thumbSize}px`
|
|
93
|
-
}
|
|
94
|
-
: {
|
|
95
|
-
top: `${pos}px`,
|
|
96
|
-
height: `${this.thumbSize}px`
|
|
97
|
-
}
|
|
132
|
+
horizontalThumbSize () {
|
|
133
|
+
return Math.round(
|
|
134
|
+
between(
|
|
135
|
+
this.container.horizontal * this.container.horizontal / this.scroll.horizontal.size,
|
|
136
|
+
50,
|
|
137
|
+
this.container.horizontal
|
|
138
|
+
)
|
|
98
139
|
)
|
|
99
140
|
},
|
|
100
141
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
142
|
+
verticalStyle () {
|
|
143
|
+
const pos = this.verticalScrollPercentage * (this.container.vertical - this.verticalThumbSize)
|
|
144
|
+
return {
|
|
145
|
+
...this.thumbStyle,
|
|
146
|
+
...this.verticalThumbStyle,
|
|
147
|
+
top: `${pos}px`,
|
|
148
|
+
height: `${this.verticalThumbSize}px`
|
|
149
|
+
}
|
|
105
150
|
},
|
|
106
151
|
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
return
|
|
152
|
+
horizontalStyle () {
|
|
153
|
+
const pos = this.horizontalScrollPercentage * (this.container.horizontal - this.horizontalThumbSize)
|
|
154
|
+
return {
|
|
155
|
+
...this.thumbStyle,
|
|
156
|
+
...this.horizontalThumbStyle,
|
|
157
|
+
left: `${pos}px`,
|
|
158
|
+
width: `${this.horizontalThumbSize}px`
|
|
159
|
+
}
|
|
110
160
|
},
|
|
111
161
|
|
|
112
|
-
|
|
113
|
-
return
|
|
162
|
+
verticalThumbClass () {
|
|
163
|
+
return 'q-scrollarea__thumb q-scrollarea__thumb--v absolute-right' +
|
|
164
|
+
(this.verticalThumbHidden === true ? ' q-scrollarea__thumb--invisible' : '')
|
|
114
165
|
},
|
|
115
166
|
|
|
116
|
-
|
|
117
|
-
return
|
|
118
|
-
|
|
119
|
-
: { prefix: 'vertical', suffix: 'Height', scroll: 'scrollTop', classSuffix: 'v absolute-right', dir: 'down', dist: 'y' }
|
|
167
|
+
horizontalThumbClass () {
|
|
168
|
+
return 'q-scrollarea__thumb q-scrollarea__thumb--h absolute-bottom' +
|
|
169
|
+
(this.horizontalThumbHidden === true ? ' q-scrollarea__thumb--invisible' : '')
|
|
120
170
|
},
|
|
121
171
|
|
|
122
|
-
|
|
123
|
-
return
|
|
124
|
-
(this.
|
|
172
|
+
verticalBarClass () {
|
|
173
|
+
return 'q-scrollarea__bar q-scrollarea__bar--v absolute-right' +
|
|
174
|
+
(this.verticalThumbHidden === true ? ' q-scrollarea__bar--invisible' : '')
|
|
125
175
|
},
|
|
126
176
|
|
|
127
|
-
|
|
128
|
-
return
|
|
129
|
-
(this.
|
|
177
|
+
horizontalBarClass () {
|
|
178
|
+
return 'q-scrollarea__bar q-scrollarea__bar--h absolute-bottom' +
|
|
179
|
+
(this.horizontalThumbHidden === true ? ' q-scrollarea__bar--invisible' : '')
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
scrollComputed () {
|
|
183
|
+
return {
|
|
184
|
+
vertical: {
|
|
185
|
+
...this.scroll.vertical,
|
|
186
|
+
percentage: this.verticalScrollPercentage,
|
|
187
|
+
thumbHidden: this.verticalThumbHidden,
|
|
188
|
+
thumbSize: this.verticalThumbSize,
|
|
189
|
+
style: this.verticalStyle,
|
|
190
|
+
thumbClass: this.verticalThumbClass,
|
|
191
|
+
barClass: this.verticalBarClass
|
|
192
|
+
},
|
|
193
|
+
horizontal: {
|
|
194
|
+
...this.scroll.horizontal,
|
|
195
|
+
percentage: this.horizontalScrollPercentage,
|
|
196
|
+
thumbHidden: this.horizontalThumbHidden,
|
|
197
|
+
thumbSize: this.horizontalThumbSize,
|
|
198
|
+
style: this.horizontalStyle,
|
|
199
|
+
thumbClass: this.horizontalThumbClass,
|
|
200
|
+
barClass: this.horizontalBarClass
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
mainStyle () {
|
|
206
|
+
return this.verticalThumbHidden === true && this.horizontalThumbHidden === true
|
|
207
|
+
? this.contentStyle
|
|
208
|
+
: this.contentActiveStyle
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
verticalThumbDirectives () {
|
|
212
|
+
return [{
|
|
213
|
+
name: 'touch-pan',
|
|
214
|
+
modifiers: {
|
|
215
|
+
vertical: true,
|
|
216
|
+
prevent: true,
|
|
217
|
+
mouse: true,
|
|
218
|
+
mouseAllDir: true
|
|
219
|
+
},
|
|
220
|
+
value: e => { this.__panThumb(e, 'vertical') }
|
|
221
|
+
}]
|
|
130
222
|
},
|
|
131
223
|
|
|
132
|
-
|
|
224
|
+
horizontalThumbDirectives () {
|
|
133
225
|
return [{
|
|
134
226
|
name: 'touch-pan',
|
|
135
227
|
modifiers: {
|
|
136
|
-
|
|
228
|
+
horizontal: true,
|
|
137
229
|
prevent: true,
|
|
138
230
|
mouse: true,
|
|
139
231
|
mouseAllDir: true
|
|
140
232
|
},
|
|
141
|
-
value: this.__panThumb
|
|
233
|
+
value: e => { this.__panThumb(e, 'horizontal') }
|
|
142
234
|
}]
|
|
143
235
|
},
|
|
144
236
|
|
|
@@ -154,21 +246,81 @@ export default Vue.extend({
|
|
|
154
246
|
return this.$refs.target
|
|
155
247
|
},
|
|
156
248
|
|
|
157
|
-
|
|
158
|
-
|
|
249
|
+
getScroll () {
|
|
250
|
+
const info = {}
|
|
251
|
+
|
|
252
|
+
axisList.forEach(axis => {
|
|
253
|
+
const data = this.scrollComputed[ axis ]
|
|
254
|
+
|
|
255
|
+
info[ axis + 'Position' ] = data.position
|
|
256
|
+
info[ axis + 'Percentage' ] = data.percentage
|
|
257
|
+
info[ axis + 'Size' ] = data.size
|
|
258
|
+
info[ axis + 'ContainerSize' ] = this.container[ axis ]
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
return info
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
getScrollPosition (axis) {
|
|
265
|
+
if (axis === 'both') {
|
|
266
|
+
return {
|
|
267
|
+
top: this.scroll.vertical.position,
|
|
268
|
+
left: this.scroll.horizontal.position
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (axisList.includes(axis) !== true) {
|
|
273
|
+
axis = this.horizontal === true ? 'horizontal' : 'vertical'
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return this.scroll[axis].position
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
getScrollPercentage (axis) {
|
|
280
|
+
if (axis === 'both') {
|
|
281
|
+
return {
|
|
282
|
+
top: this.verticalScrollPercentage,
|
|
283
|
+
left: this.horizontalScrollPercentage
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (axisList.includes(axis) !== true) {
|
|
288
|
+
axis = this.horizontal === true ? 'horizontal' : 'vertical'
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return this[`${axis}ScrollPercentage`]
|
|
159
292
|
},
|
|
160
293
|
|
|
161
|
-
setScrollPosition (offset, duration) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
294
|
+
setScrollPosition (axis, offset, duration) {
|
|
295
|
+
if (axisList.includes(axis) === false) {
|
|
296
|
+
if (isNaN(axis) === true) {
|
|
297
|
+
console.error('[QScrollArea]: wrong first param of setScrollPosition (vertical/horizontal)')
|
|
298
|
+
return
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
[axis, offset, duration] = [this.horizontal === true ? 'horizontal' : 'vertical', axis, offset]
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const fn = axis === 'vertical'
|
|
305
|
+
? setVerticalScrollPosition
|
|
306
|
+
: setHorizontalScrollPosition
|
|
165
307
|
|
|
166
308
|
fn(this.$refs.target, offset, duration)
|
|
167
309
|
},
|
|
168
310
|
|
|
169
|
-
setScrollPercentage (percentage, duration) {
|
|
311
|
+
setScrollPercentage (axis, percentage, duration) {
|
|
312
|
+
if (axisList.includes(axis) === false) {
|
|
313
|
+
if (isNaN(axis) === true) {
|
|
314
|
+
console.error('[QScrollArea]: wrong first param of setScrollPercentage (vertical/horizontal)')
|
|
315
|
+
return
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
[axis, percentage, duration] = [this.horizontal === true ? 'horizontal' : 'vertical', axis, percentage]
|
|
319
|
+
}
|
|
320
|
+
|
|
170
321
|
this.setScrollPosition(
|
|
171
|
-
|
|
322
|
+
axis,
|
|
323
|
+
percentage * (this.scroll[axis].size - this.container[axis]),
|
|
172
324
|
duration
|
|
173
325
|
)
|
|
174
326
|
},
|
|
@@ -176,75 +328,104 @@ export default Vue.extend({
|
|
|
176
328
|
__updateContainer ({ height, width }) {
|
|
177
329
|
let change = false
|
|
178
330
|
|
|
179
|
-
if (this.
|
|
180
|
-
this.
|
|
331
|
+
if (this.container.vertical !== height) {
|
|
332
|
+
this.container.vertical = height
|
|
181
333
|
change = true
|
|
182
334
|
}
|
|
183
335
|
|
|
184
|
-
if (this.
|
|
185
|
-
this.
|
|
336
|
+
if (this.container.horizontal !== width) {
|
|
337
|
+
this.container.horizontal = width
|
|
186
338
|
change = true
|
|
187
339
|
}
|
|
188
340
|
|
|
189
341
|
change === true && this.__startTimer()
|
|
190
342
|
},
|
|
191
343
|
|
|
192
|
-
|
|
193
|
-
if (this.
|
|
194
|
-
this.
|
|
344
|
+
__updateVerticalScroll ({ position }) {
|
|
345
|
+
if (this.scroll.vertical.position !== position) {
|
|
346
|
+
this.scroll.vertical.position = position
|
|
347
|
+
this.__startTimer()
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
__updateHorizontalScroll ({ position }) {
|
|
352
|
+
if (this.scroll.horizontal.position !== position) {
|
|
353
|
+
this.scroll.horizontal.position = position
|
|
195
354
|
this.__startTimer()
|
|
196
355
|
}
|
|
197
356
|
},
|
|
198
357
|
|
|
199
358
|
__updateScrollSize ({ height, width }) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
359
|
+
let change = false
|
|
360
|
+
|
|
361
|
+
if (this.scroll.horizontal.size !== width) {
|
|
362
|
+
this.scroll.horizontal.size = width
|
|
363
|
+
change = true
|
|
205
364
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
this.
|
|
365
|
+
|
|
366
|
+
if (this.scroll.vertical.size !== height) {
|
|
367
|
+
this.scroll.vertical.size = height
|
|
368
|
+
change = true
|
|
209
369
|
}
|
|
370
|
+
|
|
371
|
+
change === true && this.__startTimer()
|
|
210
372
|
},
|
|
211
373
|
|
|
212
|
-
__panThumb (e) {
|
|
213
|
-
|
|
214
|
-
|
|
374
|
+
__panThumb (e, axis) {
|
|
375
|
+
const data = this.scrollComputed[ axis ]
|
|
376
|
+
|
|
377
|
+
if (e.isFinal === true) {
|
|
378
|
+
if (this.panning !== true) {
|
|
215
379
|
return
|
|
216
380
|
}
|
|
217
381
|
|
|
218
|
-
this.
|
|
382
|
+
this.panning = false
|
|
383
|
+
}
|
|
384
|
+
else if (e.isFirst === true) {
|
|
385
|
+
if (data.thumbHidden === true) {
|
|
386
|
+
return
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
this.refPos = data.position
|
|
219
390
|
this.panning = true
|
|
220
391
|
}
|
|
221
392
|
else if (this.panning !== true) {
|
|
222
393
|
return
|
|
223
394
|
}
|
|
224
395
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
396
|
+
const dProp = dirProps[ axis ]
|
|
397
|
+
const containerSize = this.container[axis]
|
|
228
398
|
|
|
229
|
-
const multiplier = (
|
|
230
|
-
const distance = e.distance[
|
|
231
|
-
const pos = this.refPos + (e.direction ===
|
|
399
|
+
const multiplier = (data.size - containerSize) / (containerSize - data.thumbSize)
|
|
400
|
+
const distance = e.distance[dProp.dist]
|
|
401
|
+
const pos = this.refPos + (e.direction === dProp.dir ? 1 : -1) * distance * multiplier
|
|
232
402
|
|
|
233
|
-
this.__setScroll(pos)
|
|
403
|
+
this.__setScroll(pos, axis)
|
|
234
404
|
},
|
|
235
405
|
|
|
236
|
-
__mouseDown (evt) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
406
|
+
__mouseDown (evt, axis) {
|
|
407
|
+
const data = this.scrollComputed[ axis ]
|
|
408
|
+
|
|
409
|
+
if (data.thumbHidden !== true) {
|
|
410
|
+
const pos = evt[ dirProps[ axis ].offset ] - data.thumbSize / 2
|
|
411
|
+
this.__setScroll(pos / this.container[ axis ] * data.size, axis)
|
|
240
412
|
|
|
413
|
+
const ref = axis === 'vertical' ? this.$refs.verticalThumb : this.$refs.horizontalThumb
|
|
241
414
|
// activate thumb pan
|
|
242
|
-
if (
|
|
243
|
-
|
|
415
|
+
if (ref !== void 0) {
|
|
416
|
+
ref.dispatchEvent(new MouseEvent(evt.type, evt))
|
|
244
417
|
}
|
|
245
418
|
}
|
|
246
419
|
},
|
|
247
420
|
|
|
421
|
+
__verticalMouseDown (evt) {
|
|
422
|
+
this.__mouseDown(evt, 'vertical')
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
__horizontalMouseDown (evt) {
|
|
426
|
+
this.__mouseDown(evt, 'horizontal')
|
|
427
|
+
},
|
|
428
|
+
|
|
248
429
|
__startTimer () {
|
|
249
430
|
if (this.tempShowing === true) {
|
|
250
431
|
clearTimeout(this.timer)
|
|
@@ -253,15 +434,20 @@ export default Vue.extend({
|
|
|
253
434
|
this.tempShowing = true
|
|
254
435
|
}
|
|
255
436
|
|
|
256
|
-
this.timer = setTimeout(() => {
|
|
257
|
-
|
|
258
|
-
|
|
437
|
+
this.timer = setTimeout(() => { this.tempShowing = false }, this.delay)
|
|
438
|
+
this.$listeners.scroll !== void 0 && this.__emitScroll()
|
|
439
|
+
},
|
|
440
|
+
|
|
441
|
+
__setScroll (offset, axis) {
|
|
442
|
+
this.$refs.target[ dirProps[ axis ].scroll ] = offset
|
|
443
|
+
},
|
|
259
444
|
|
|
260
|
-
|
|
445
|
+
__mouseEnter () {
|
|
446
|
+
this.hover = true
|
|
261
447
|
},
|
|
262
448
|
|
|
263
|
-
|
|
264
|
-
this
|
|
449
|
+
__mouseLeave () {
|
|
450
|
+
this.hover = false
|
|
265
451
|
}
|
|
266
452
|
},
|
|
267
453
|
|
|
@@ -269,52 +455,72 @@ export default Vue.extend({
|
|
|
269
455
|
return h('div', {
|
|
270
456
|
class: this.classes,
|
|
271
457
|
on: cache(this, 'desk', {
|
|
272
|
-
mouseenter:
|
|
273
|
-
mouseleave:
|
|
458
|
+
mouseenter: this.__mouseEnter,
|
|
459
|
+
mouseleave: this.__mouseLeave
|
|
274
460
|
})
|
|
275
461
|
}, [
|
|
276
462
|
h('div', {
|
|
277
463
|
ref: 'target',
|
|
278
|
-
staticClass: 'scroll relative-position fit hide-scrollbar',
|
|
464
|
+
staticClass: 'q-scrollarea__container scroll relative-position fit hide-scrollbar',
|
|
279
465
|
attrs: this.scrollAttrs
|
|
280
466
|
}, [
|
|
281
467
|
h('div', {
|
|
282
|
-
staticClass: 'absolute',
|
|
283
|
-
style: this.mainStyle
|
|
284
|
-
class: `full-${this.horizontal === true ? 'height' : 'width'}`
|
|
468
|
+
staticClass: 'q-scrollarea__content absolute',
|
|
469
|
+
style: this.mainStyle
|
|
285
470
|
}, mergeSlot([
|
|
286
471
|
h(QResizeObserver, {
|
|
472
|
+
props: { debounce: 0 },
|
|
287
473
|
on: cache(this, 'resizeIn', { resize: this.__updateScrollSize })
|
|
288
474
|
})
|
|
289
475
|
], this, 'default')),
|
|
290
476
|
|
|
291
477
|
h(QScrollObserver, {
|
|
292
|
-
|
|
293
|
-
|
|
478
|
+
on: cache(this, 'scrollV', { scroll: this.__updateVerticalScroll })
|
|
479
|
+
}),
|
|
480
|
+
|
|
481
|
+
h(QScrollObserver, {
|
|
482
|
+
props: { horizontal: true },
|
|
483
|
+
on: cache(this, 'scrollH', { scroll: this.__updateHorizontalScroll })
|
|
294
484
|
})
|
|
295
485
|
]),
|
|
296
486
|
|
|
297
487
|
h(QResizeObserver, {
|
|
488
|
+
props: { debounce: 0 },
|
|
298
489
|
on: cache(this, 'resizeOut', { resize: this.__updateContainer })
|
|
299
490
|
}),
|
|
300
491
|
|
|
301
492
|
h('div', {
|
|
302
|
-
|
|
303
|
-
style: this.barStyle,
|
|
304
|
-
|
|
493
|
+
class: this.verticalBarClass,
|
|
494
|
+
style: [ this.barStyle, this.verticalBarStyle ],
|
|
495
|
+
attrs: ariaHidden,
|
|
496
|
+
on: cache(this, 'barV', {
|
|
497
|
+
mousedown: this.__verticalMouseDown
|
|
498
|
+
})
|
|
499
|
+
}),
|
|
500
|
+
|
|
501
|
+
h('div', {
|
|
502
|
+
class: this.horizontalBarClass,
|
|
503
|
+
style: [ this.barStyle, this.horizontalBarStyle ],
|
|
305
504
|
attrs: ariaHidden,
|
|
306
|
-
on: cache(this, '
|
|
307
|
-
mousedown: this.
|
|
505
|
+
on: cache(this, 'barH', {
|
|
506
|
+
mousedown: this.__horizontalMouseDown
|
|
308
507
|
})
|
|
309
508
|
}),
|
|
310
509
|
|
|
311
510
|
h('div', {
|
|
312
|
-
ref: '
|
|
313
|
-
|
|
314
|
-
style: this.
|
|
315
|
-
class: this.thumbClass,
|
|
511
|
+
ref: 'verticalThumb',
|
|
512
|
+
class: this.verticalThumbClass,
|
|
513
|
+
style: this.verticalStyle,
|
|
316
514
|
attrs: ariaHidden,
|
|
317
|
-
directives: this.
|
|
515
|
+
directives: this.verticalThumbDirectives
|
|
516
|
+
}),
|
|
517
|
+
|
|
518
|
+
h('div', {
|
|
519
|
+
ref: 'horizontalThumb',
|
|
520
|
+
class: this.horizontalThumbClass,
|
|
521
|
+
style: this.horizontalStyle,
|
|
522
|
+
attrs: ariaHidden,
|
|
523
|
+
directives: this.horizontalThumbDirectives
|
|
318
524
|
})
|
|
319
525
|
])
|
|
320
526
|
},
|
|
@@ -324,17 +530,27 @@ export default Vue.extend({
|
|
|
324
530
|
// ensure we're not emitting same info
|
|
325
531
|
// multiple times
|
|
326
532
|
this.__emitScroll = debounce(() => {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
533
|
+
const info = this.getScroll()
|
|
534
|
+
info.ref = this
|
|
535
|
+
this.$emit('scroll', info)
|
|
536
|
+
}, 0)
|
|
537
|
+
},
|
|
330
538
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
info[prefix + 'Size'] = this.scrollSize
|
|
334
|
-
info[prefix + 'ContainerSize'] = this.containerSize
|
|
539
|
+
activated () {
|
|
540
|
+
const scrollTarget = this.getScrollTarget()
|
|
335
541
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
542
|
+
if (scrollTarget !== void 0 && this.__scrollPosition !== void 0) {
|
|
543
|
+
setHorizontalScrollPosition(scrollTarget, this.__scrollPosition.left)
|
|
544
|
+
setVerticalScrollPosition(scrollTarget, this.__scrollPosition.top)
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
deactivated () {
|
|
549
|
+
this.__scrollPosition = this.getScrollPosition('both')
|
|
550
|
+
},
|
|
551
|
+
|
|
552
|
+
beforeDestroy () {
|
|
553
|
+
this.__emitScroll.cancel()
|
|
554
|
+
clearTimeout(this.timer)
|
|
339
555
|
}
|
|
340
556
|
})
|