quasar 2.3.4 → 2.4.3
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 +1 -1
- package/dist/api/Loading.json +2 -6
- package/dist/api/Notify.json +5 -5
- package/dist/api/QAvatar.json +1 -1
- package/dist/api/QBreadcrumbsEl.json +32 -11
- package/dist/api/QBtn.json +32 -16
- package/dist/api/QBtnDropdown.json +33 -17
- package/dist/api/QBtnToggle.json +4 -1
- package/dist/api/QCarousel.json +4 -4
- package/dist/api/QChatMessage.json +4 -12
- package/dist/api/QChip.json +4 -4
- package/dist/api/QExpansionItem.json +34 -13
- package/dist/api/QFab.json +32 -2
- package/dist/api/QFabAction.json +9 -1
- package/dist/api/QField.json +1 -0
- package/dist/api/QFile.json +1 -0
- package/dist/api/QInput.json +1 -0
- package/dist/api/QItem.json +31 -10
- package/dist/api/QLinearProgress.json +1 -1
- package/dist/api/QOptionGroup.json +74 -4
- package/dist/api/QPagination.json +4 -4
- package/dist/api/QPullToRefresh.json +1 -1
- package/dist/api/QRange.json +592 -107
- package/dist/api/QRating.json +3 -3
- package/dist/api/QRouteTab.json +32 -12
- package/dist/api/QSelect.json +4 -7
- package/dist/api/QSlider.json +504 -39
- 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/QTimelineEntry.json +1 -1
- package/dist/api/QToggle.json +1 -1
- package/dist/api/QTree.json +1 -1
- package/dist/api/QUploader.json +16 -2
- package/dist/api/QVideo.json +11 -1
- package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/material-icons.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v4.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-themify.umd.prod.js +1 -1
- package/dist/icon-set/themify.umd.prod.js +1 -1
- package/dist/lang/ar.umd.prod.js +1 -1
- package/dist/lang/az-Latn.umd.prod.js +1 -1
- package/dist/lang/bg.umd.prod.js +1 -1
- package/dist/lang/bn.umd.prod.js +1 -1
- package/dist/lang/ca.umd.prod.js +1 -1
- package/dist/lang/cs.umd.prod.js +1 -1
- package/dist/lang/da.umd.prod.js +1 -1
- package/dist/lang/de.umd.prod.js +1 -1
- package/dist/lang/el.umd.prod.js +1 -1
- package/dist/lang/en-GB.umd.prod.js +1 -1
- package/dist/lang/en-US.umd.prod.js +1 -1
- package/dist/lang/eo.umd.prod.js +1 -1
- package/dist/lang/es.umd.prod.js +1 -1
- package/dist/lang/et.umd.prod.js +1 -1
- package/dist/lang/fa-IR.umd.prod.js +1 -1
- package/dist/lang/fa.umd.prod.js +1 -1
- package/dist/lang/fi.umd.prod.js +1 -1
- package/dist/lang/fr.umd.prod.js +1 -1
- package/dist/lang/gn.umd.prod.js +1 -1
- package/dist/lang/he.umd.prod.js +1 -1
- package/dist/lang/hr.umd.prod.js +1 -1
- package/dist/lang/hu.umd.prod.js +1 -1
- package/dist/lang/id.umd.prod.js +1 -1
- package/dist/lang/is.umd.prod.js +1 -1
- package/dist/lang/it.umd.prod.js +1 -1
- package/dist/lang/ja.umd.prod.js +1 -1
- package/dist/lang/km.umd.prod.js +1 -1
- package/dist/lang/ko-KR.umd.prod.js +1 -1
- package/dist/lang/kur-CKB.umd.prod.js +1 -1
- package/dist/lang/lt.umd.prod.js +1 -1
- package/dist/lang/lu.umd.prod.js +1 -1
- package/dist/lang/lv.umd.prod.js +1 -1
- package/dist/lang/ml.umd.prod.js +1 -1
- package/dist/lang/ms.umd.prod.js +1 -1
- package/dist/lang/nb-NO.umd.prod.js +1 -1
- package/dist/lang/nl.umd.prod.js +1 -1
- package/dist/lang/pl.umd.prod.js +1 -1
- package/dist/lang/pt-BR.umd.prod.js +1 -1
- package/dist/lang/pt.umd.prod.js +1 -1
- package/dist/lang/ro.umd.prod.js +1 -1
- package/dist/lang/ru.umd.prod.js +1 -1
- package/dist/lang/sk.umd.prod.js +1 -1
- package/dist/lang/sl.umd.prod.js +1 -1
- package/dist/lang/sr-CYR.umd.prod.js +1 -1
- package/dist/lang/sr.umd.prod.js +1 -1
- package/dist/lang/sv.umd.prod.js +1 -1
- package/dist/lang/ta.umd.prod.js +1 -1
- package/dist/lang/th.umd.prod.js +1 -1
- package/dist/lang/tr.umd.prod.js +1 -1
- package/dist/lang/ug.umd.prod.js +1 -1
- package/dist/lang/uk.umd.prod.js +1 -1
- package/dist/lang/vi.umd.prod.js +1 -1
- package/dist/lang/zh-CN.umd.prod.js +1 -1
- package/dist/lang/zh-TW.umd.prod.js +1 -1
- package/dist/quasar.cjs.prod.js +2 -2
- package/dist/quasar.css +277 -196
- package/dist/quasar.esm.prod.js +2 -2
- package/dist/quasar.prod.css +1 -1
- package/dist/quasar.rtl.css +344 -275
- package/dist/quasar.rtl.prod.css +1 -1
- package/dist/quasar.sass +243 -189
- package/dist/quasar.umd.js +16670 -16294
- package/dist/quasar.umd.prod.js +2 -2
- package/dist/ssr-directives/Morph.js +1 -1
- package/dist/transforms/loader-asset-urls.json +20 -0
- package/dist/types/api/slider.d.ts +46 -0
- package/dist/types/api/validation.d.ts +4 -0
- package/dist/types/api.d.ts +2 -0
- package/dist/types/composables.d.ts +3 -3
- package/dist/types/index.d.ts +599 -121
- package/dist/types/utils/date.d.ts +2 -1
- package/dist/vetur/quasar-attributes.json +254 -82
- package/dist/vetur/quasar-tags.json +61 -18
- package/dist/web-types/web-types.json +635 -197
- package/package.json +1 -1
- package/src/api.extends.json +1 -2
- package/src/components/breadcrumbs/QBreadcrumbs.js +7 -2
- package/src/components/breadcrumbs/QBreadcrumbs.sass +0 -3
- package/src/components/breadcrumbs/QBreadcrumbsEl.js +14 -8
- package/src/components/btn/QBtn.js +5 -5
- package/src/components/btn/use-btn.js +21 -21
- package/src/components/btn/use-btn.json +22 -13
- package/src/components/btn-toggle/QBtnToggle.json +3 -0
- package/src/components/checkbox/use-checkbox.js +1 -1
- package/src/components/color/QColor.js +32 -26
- package/src/components/color/QColor.sass +10 -23
- package/src/components/date/QDate.sass +2 -0
- package/src/components/dialog/QDialog.js +7 -5
- package/src/components/drawer/QDrawer.js +18 -15
- package/src/components/editor/QEditor.js +1 -1
- package/src/components/editor/QEditor.sass +10 -1
- package/src/components/expansion-item/QExpansionItem.js +4 -1
- package/src/components/fab/QFab.js +18 -12
- package/src/components/fab/QFab.json +33 -0
- package/src/components/fab/QFab.sass +1 -1
- package/src/components/fab/QFabAction.js +14 -7
- package/src/components/fab/QFabAction.json +10 -0
- package/src/components/file/QFile.js +12 -5
- package/src/components/file/QFile.sass +4 -2
- package/src/components/footer/QFooter.js +1 -1
- package/src/components/header/QHeader.js +1 -1
- package/src/components/icon/QIcon.js +1 -1
- package/src/components/infinite-scroll/QInfiniteScroll.js +4 -5
- package/src/components/item/QItem.js +2 -3
- package/src/components/linear-progress/QLinearProgress.json +1 -1
- package/src/components/menu/QMenu.js +6 -2
- package/src/components/option-group/QOptionGroup.js +3 -0
- package/src/components/option-group/QOptionGroup.json +48 -2
- package/src/components/parallax/QParallax.js +4 -2
- package/src/components/popup-edit/QPopupEdit.js +2 -5
- package/src/components/radio/QRadio.js +2 -7
- package/src/components/range/QRange.js +132 -273
- package/src/components/range/QRange.json +11 -121
- package/src/components/rating/QRating.json +3 -3
- package/src/components/resize-observer/QResizeObserver.js +11 -10
- package/src/components/scroll-area/QScrollArea.js +8 -2
- package/src/components/scroll-observer/QScrollObserver.js +2 -0
- package/src/components/select/QSelect.js +4 -1
- package/src/components/slider/QSlider.js +61 -137
- package/src/components/slider/QSlider.json +1 -121
- package/src/components/slider/QSlider.sass +203 -138
- package/src/components/slider/use-slider.js +454 -107
- package/src/components/slider/use-slider.json +546 -0
- package/src/components/stepper/QStepper.js +3 -3
- package/src/components/stepper/QStepper.sass +24 -26
- package/src/components/table/QTable.js +26 -46
- package/src/components/tabs/QRouteTab.js +1 -2
- package/src/components/tabs/QRouteTab.json +0 -7
- package/src/components/tabs/QTabs.js +91 -24
- package/src/components/tabs/use-tab.js +26 -13
- package/src/components/tooltip/QTooltip.js +1 -2
- package/src/components/tree/QTree.js +14 -12
- package/src/components/uploader/QUploader.json +14 -2
- package/src/components/uploader/uploader-core.js +16 -9
- package/src/components/video/QVideo.js +4 -1
- package/src/components/video/QVideo.json +12 -1
- package/src/components/virtual-scroll/QVirtualScroll.sass +1 -0
- package/src/components/virtual-scroll/use-virtual-scroll.js +30 -17
- package/src/composables/private/use-field.js +18 -20
- package/src/composables/private/use-file.js +20 -5
- package/src/composables/private/use-form.js +2 -3
- package/src/composables/private/use-fullscreen.js +15 -4
- package/src/composables/private/use-model-toggle.js +1 -1
- package/src/composables/private/use-portal.js +9 -7
- package/src/composables/private/use-router-link.js +44 -23
- package/src/composables/private/use-router-link.json +26 -10
- package/src/composables/private/use-split-attrs.js +4 -4
- package/src/composables/private/use-tick.js +7 -14
- package/src/composables/private/use-validate.js +21 -15
- package/src/composables/private/use-validate.json +1 -0
- package/src/css/core/helpers.sass +3 -0
- package/src/css/core/positioning.sass +5 -0
- package/src/css/variables.sass +4 -6
- package/src/directives/ScrollFire.js +1 -0
- package/src/icon-set.js +2 -4
- package/src/plugins/AppFullscreen.js +70 -53
- package/src/plugins/AppVisibility.js +2 -3
- package/src/plugins/BottomSheet.js +3 -5
- package/src/plugins/Dialog.js +3 -5
- package/src/plugins/LoadingBar.js +17 -18
- package/src/plugins/Notify.js +296 -295
- package/src/plugins/Platform.js +14 -14
- package/src/utils/clone.js +53 -4
- package/src/utils/date.js +4 -4
- package/src/utils/dom.js +2 -2
- package/src/utils/open-url.js +2 -2
- package/src/utils/patterns.js +1 -0
- package/src/utils/private/define-reactive-plugin.js +10 -8
- package/src/utils/private/focus-manager.js +8 -10
- package/src/utils/private/global-dialog.js +6 -8
- package/src/utils/private/inject-obj-prop.js +13 -0
- package/src/utils/private/is.js +2 -2
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { h, ref, computed, watch, getCurrentInstance } from 'vue'
|
|
2
2
|
|
|
3
|
-
import { useFormInject, useFormProps } from '../../composables/private/use-form.js'
|
|
4
|
-
|
|
5
3
|
import useSlider, {
|
|
6
4
|
useSliderProps,
|
|
7
5
|
useSliderEmits,
|
|
8
|
-
getRatio,
|
|
9
|
-
getModel,
|
|
10
6
|
keyCodes
|
|
11
7
|
} from '../slider/use-slider.js'
|
|
12
8
|
|
|
13
9
|
import { createComponent } from '../../utils/private/create.js'
|
|
14
10
|
import { stopAndPrevent } from '../../utils/event.js'
|
|
15
11
|
import { between } from '../../utils/format.js'
|
|
16
|
-
import { hDir } from '../../utils/private/render.js'
|
|
17
12
|
|
|
18
13
|
const dragType = {
|
|
19
14
|
MIN: 0,
|
|
@@ -25,22 +20,14 @@ export default createComponent({
|
|
|
25
20
|
name: 'QRange',
|
|
26
21
|
|
|
27
22
|
props: {
|
|
28
|
-
...useFormProps,
|
|
29
23
|
...useSliderProps,
|
|
30
24
|
|
|
31
25
|
modelValue: {
|
|
32
26
|
type: Object,
|
|
33
|
-
default: () => ({
|
|
34
|
-
|
|
35
|
-
max: null
|
|
36
|
-
}),
|
|
37
|
-
validator (val) {
|
|
38
|
-
return 'min' in val && 'max' in val
|
|
39
|
-
}
|
|
27
|
+
default: () => ({ min: null, max: null }),
|
|
28
|
+
validator: v => 'min' in v && 'max' in v
|
|
40
29
|
},
|
|
41
30
|
|
|
42
|
-
name: String,
|
|
43
|
-
|
|
44
31
|
dragRange: Boolean,
|
|
45
32
|
dragOnlyRange: Boolean,
|
|
46
33
|
|
|
@@ -50,7 +37,10 @@ export default createComponent({
|
|
|
50
37
|
rightLabelTextColor: String,
|
|
51
38
|
|
|
52
39
|
leftLabelValue: [ String, Number ],
|
|
53
|
-
rightLabelValue: [ String, Number ]
|
|
40
|
+
rightLabelValue: [ String, Number ],
|
|
41
|
+
|
|
42
|
+
leftThumbColor: String,
|
|
43
|
+
rightThumbColor: String
|
|
54
44
|
},
|
|
55
45
|
|
|
56
46
|
emits: useSliderEmits,
|
|
@@ -58,53 +48,59 @@ export default createComponent({
|
|
|
58
48
|
setup (props, { emit }) {
|
|
59
49
|
const { proxy: { $q } } = getCurrentInstance()
|
|
60
50
|
|
|
61
|
-
const
|
|
62
|
-
|
|
51
|
+
const { state, methods } = useSlider({
|
|
52
|
+
updateValue, updatePosition, getDragging,
|
|
53
|
+
formAttrs: computed(() => ({
|
|
63
54
|
type: 'hidden',
|
|
64
55
|
name: props.name,
|
|
65
56
|
value: `${ props.modelValue.min }|${ props.modelValue.max }`
|
|
66
|
-
}
|
|
57
|
+
}))
|
|
67
58
|
})
|
|
68
59
|
|
|
69
|
-
const injectFormInput = useFormInject(formAttrs)
|
|
70
|
-
|
|
71
60
|
const rootRef = ref(null)
|
|
72
|
-
const model = ref({
|
|
73
|
-
min: props.modelValue.min === null ? props.min : props.modelValue.min,
|
|
74
|
-
max: props.modelValue.max === null ? props.max : props.modelValue.max
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
const nextFocus = ref(null)
|
|
78
|
-
|
|
79
61
|
const curMinRatio = ref(0)
|
|
80
62
|
const curMaxRatio = ref(0)
|
|
63
|
+
const model = ref({ min: 0, max: 0 })
|
|
81
64
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
65
|
+
function normalizeModel () {
|
|
66
|
+
model.value.min = props.modelValue.min === null
|
|
67
|
+
? state.innerMin.value
|
|
68
|
+
: between(props.modelValue.min, state.innerMin.value, state.innerMax.value)
|
|
85
69
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
70
|
+
model.value.max = props.modelValue.max === null
|
|
71
|
+
? state.innerMax.value
|
|
72
|
+
: between(props.modelValue.max, state.innerMin.value, state.innerMax.value)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
watch(
|
|
76
|
+
() => `${ props.modelValue.min }|${ props.modelValue.max }|${ state.innerMin.value }|${ state.innerMax.value }`,
|
|
77
|
+
normalizeModel
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
normalizeModel()
|
|
81
|
+
|
|
82
|
+
const modelMinRatio = computed(() => methods.convertModelToRatio(model.value.min))
|
|
83
|
+
const modelMaxRatio = computed(() => methods.convertModelToRatio(model.value.max))
|
|
89
84
|
|
|
90
85
|
const ratioMin = computed(() => (
|
|
91
86
|
state.active.value === true ? curMinRatio.value : modelMinRatio.value
|
|
92
87
|
))
|
|
93
|
-
|
|
94
|
-
const modelMaxRatio = computed(() => (
|
|
95
|
-
state.minMaxDiff.value === 0 ? 0 : (model.value.max - props.min) / state.minMaxDiff.value
|
|
96
|
-
))
|
|
97
|
-
|
|
98
88
|
const ratioMax = computed(() => (
|
|
99
89
|
state.active.value === true ? curMaxRatio.value : modelMaxRatio.value
|
|
100
90
|
))
|
|
101
91
|
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
92
|
+
const selectionBarStyle = computed(() => {
|
|
93
|
+
const acc = {
|
|
94
|
+
[ state.positionProp.value ]: `${ 100 * ratioMin.value }%`,
|
|
95
|
+
[ state.sizeProp.value ]: `${ 100 * (ratioMax.value - ratioMin.value) }%`
|
|
96
|
+
}
|
|
97
|
+
if (props.selectionImg !== void 0) {
|
|
98
|
+
acc.backgroundImage = `url(${ props.selectionImg }) !important`
|
|
99
|
+
}
|
|
100
|
+
return acc
|
|
101
|
+
})
|
|
106
102
|
|
|
107
|
-
const
|
|
103
|
+
const trackContainerEvents = computed(() => {
|
|
108
104
|
if (state.editable.value !== true) {
|
|
109
105
|
return {}
|
|
110
106
|
}
|
|
@@ -115,137 +111,74 @@ export default createComponent({
|
|
|
115
111
|
|
|
116
112
|
const evt = { onMousedown: methods.onActivate }
|
|
117
113
|
|
|
118
|
-
props.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
if (props.dragRange === true || props.dragOnlyRange === true) {
|
|
115
|
+
Object.assign(evt, {
|
|
116
|
+
onFocus: () => { state.focus.value = 'both' },
|
|
117
|
+
onBlur: methods.onBlur,
|
|
118
|
+
onKeydown,
|
|
119
|
+
onKeyup: methods.onKeyup
|
|
120
|
+
})
|
|
121
|
+
}
|
|
124
122
|
|
|
125
123
|
return evt
|
|
126
124
|
})
|
|
127
125
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
: {}
|
|
140
|
-
)),
|
|
141
|
-
|
|
142
|
-
thumbStyle: computed(() => ({
|
|
143
|
-
[ state.positionProp.value ]: `${ 100 * ratioMin.value }%`,
|
|
144
|
-
'z-index': nextFocus.value === 'min' ? 2 : void 0
|
|
145
|
-
})),
|
|
146
|
-
|
|
147
|
-
thumbClass: computed(() => (
|
|
148
|
-
state.preventFocus.value === false && state.focus.value === 'min'
|
|
149
|
-
? ' q-slider--focus'
|
|
150
|
-
: ''
|
|
151
|
-
)),
|
|
152
|
-
|
|
153
|
-
pinClass: computed(() => {
|
|
154
|
-
const color = props.leftLabelColor || props.labelColor
|
|
155
|
-
return color ? ` text-${ color }` : ''
|
|
156
|
-
}),
|
|
126
|
+
function getEvents (side) {
|
|
127
|
+
return $q.platform.is.mobile !== true && state.editable.value === true && props.dragOnlyRange !== true
|
|
128
|
+
? {
|
|
129
|
+
onFocus: () => { state.focus.value = side },
|
|
130
|
+
onBlur: methods.onBlur,
|
|
131
|
+
onKeydown,
|
|
132
|
+
onKeyup: methods.onKeyup
|
|
133
|
+
}
|
|
134
|
+
: {}
|
|
135
|
+
}
|
|
157
136
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
137
|
+
const thumbTabindex = computed(() => (props.dragOnlyRange !== true ? state.tabindex.value : null))
|
|
138
|
+
const trackContainerTabindex = computed(() => (
|
|
139
|
+
$q.platform.is.mobile !== true && (props.dragRange || props.dragOnlyRange === true)
|
|
140
|
+
? state.tabindex.value
|
|
141
|
+
: null
|
|
142
|
+
))
|
|
162
143
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
144
|
+
const minThumbRef = ref(null)
|
|
145
|
+
const minEvents = computed(() => getEvents('min'))
|
|
146
|
+
const getMinThumb = methods.getThumbRenderFn({
|
|
147
|
+
focusValue: 'min',
|
|
148
|
+
getNodeData: () => ({
|
|
149
|
+
ref: minThumbRef,
|
|
150
|
+
key: 'tmin',
|
|
151
|
+
...minEvents.value,
|
|
152
|
+
tabindex: thumbTabindex.value
|
|
166
153
|
}),
|
|
167
|
-
|
|
154
|
+
ratio: ratioMin,
|
|
168
155
|
label: computed(() => (
|
|
169
156
|
props.leftLabelValue !== void 0
|
|
170
157
|
? props.leftLabelValue
|
|
171
158
|
: model.value.min
|
|
172
|
-
))
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const maxProps = {
|
|
176
|
-
domRef: ref(null),
|
|
177
|
-
|
|
178
|
-
events: computed(() => (
|
|
179
|
-
state.editable.value === true && $q.platform.is.mobile !== true && props.dragOnlyRange !== true
|
|
180
|
-
? {
|
|
181
|
-
onFocus: () => { onFocus('max') },
|
|
182
|
-
onBlur: methods.onBlur,
|
|
183
|
-
onKeydown,
|
|
184
|
-
onKeyup: methods.onKeyup
|
|
185
|
-
}
|
|
186
|
-
: {}
|
|
187
|
-
)),
|
|
188
|
-
|
|
189
|
-
thumbStyle: computed(() => ({
|
|
190
|
-
[ state.positionProp.value ]: `${ 100 * ratioMax.value }%`
|
|
191
|
-
})),
|
|
192
|
-
|
|
193
|
-
thumbClass: computed(() => (
|
|
194
|
-
state.preventFocus.value === false && state.focus.value === 'max'
|
|
195
|
-
? ' q-slider--focus'
|
|
196
|
-
: ''
|
|
197
159
|
)),
|
|
160
|
+
thumbColor: computed(() => props.leftThumbColor || props.thumbColor || props.color),
|
|
161
|
+
labelColor: computed(() => props.leftLabelColor || props.labelColor),
|
|
162
|
+
labelTextColor: computed(() => props.leftLabelTextColor || props.labelTextColor)
|
|
163
|
+
})
|
|
198
164
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return color ? ` text-${ color }` : ''
|
|
207
|
-
}),
|
|
208
|
-
|
|
209
|
-
pinStyle: computed(() => {
|
|
210
|
-
const percent = (props.reverse === true ? -ratioMax.value : ratioMax.value - 1)
|
|
211
|
-
return methods.getPinStyle(percent, ratioMax.value)
|
|
165
|
+
const maxEvents = computed(() => getEvents('max'))
|
|
166
|
+
const getMaxThumb = methods.getThumbRenderFn({
|
|
167
|
+
focusValue: 'max',
|
|
168
|
+
getNodeData: () => ({
|
|
169
|
+
...maxEvents.value,
|
|
170
|
+
key: 'tmax',
|
|
171
|
+
tabindex: thumbTabindex.value
|
|
212
172
|
}),
|
|
213
|
-
|
|
173
|
+
ratio: ratioMax,
|
|
214
174
|
label: computed(() => (
|
|
215
175
|
props.rightLabelValue !== void 0
|
|
216
176
|
? props.rightLabelValue
|
|
217
177
|
: model.value.max
|
|
218
|
-
))
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
model.value.min = val === null
|
|
223
|
-
? props.min
|
|
224
|
-
: val
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
watch(() => props.modelValue.max, val => {
|
|
228
|
-
model.value.max = val === null
|
|
229
|
-
? props.max
|
|
230
|
-
: val
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
watch(() => props.min, value => {
|
|
234
|
-
if (model.value.min < value) {
|
|
235
|
-
model.value.min = value
|
|
236
|
-
}
|
|
237
|
-
if (model.value.max < value) {
|
|
238
|
-
model.value.max = value
|
|
239
|
-
}
|
|
240
|
-
})
|
|
241
|
-
|
|
242
|
-
watch(() => props.max, value => {
|
|
243
|
-
if (model.value.min > value) {
|
|
244
|
-
model.value.min = value
|
|
245
|
-
}
|
|
246
|
-
if (model.value.max > value) {
|
|
247
|
-
model.value.max = value
|
|
248
|
-
}
|
|
178
|
+
)),
|
|
179
|
+
thumbColor: computed(() => props.rightThumbColor || props.thumbColor || props.color),
|
|
180
|
+
labelColor: computed(() => props.rightLabelColor || props.labelColor),
|
|
181
|
+
labelTextColor: computed(() => props.rightLabelTextColor || props.labelTextColor)
|
|
249
182
|
})
|
|
250
183
|
|
|
251
184
|
function updateValue (change) {
|
|
@@ -261,8 +194,8 @@ export default createComponent({
|
|
|
261
194
|
sensitivity = props.dragOnlyRange === true
|
|
262
195
|
? 0
|
|
263
196
|
: (props.vertical === true
|
|
264
|
-
?
|
|
265
|
-
:
|
|
197
|
+
? minThumbRef.value.offsetHeight / (2 * height)
|
|
198
|
+
: minThumbRef.value.offsetWidth / (2 * width)
|
|
266
199
|
)
|
|
267
200
|
|
|
268
201
|
const dragging = {
|
|
@@ -276,43 +209,38 @@ export default createComponent({
|
|
|
276
209
|
ratioMax: modelMaxRatio.value
|
|
277
210
|
}
|
|
278
211
|
|
|
279
|
-
const ratio =
|
|
280
|
-
let type
|
|
212
|
+
const ratio = methods.getDraggingRatio(event, dragging)
|
|
281
213
|
|
|
282
214
|
if (props.dragOnlyRange !== true && ratio < dragging.ratioMin + sensitivity) {
|
|
283
|
-
type = dragType.MIN
|
|
215
|
+
dragging.type = dragType.MIN
|
|
284
216
|
}
|
|
285
217
|
else if (props.dragOnlyRange === true || ratio < dragging.ratioMax - sensitivity) {
|
|
286
218
|
if (props.dragRange === true || props.dragOnlyRange === true) {
|
|
287
|
-
type = dragType.RANGE
|
|
219
|
+
dragging.type = dragType.RANGE
|
|
288
220
|
Object.assign(dragging, {
|
|
289
221
|
offsetRatio: ratio,
|
|
290
|
-
offsetModel:
|
|
222
|
+
offsetModel: methods.convertRatioToModel(ratio),
|
|
291
223
|
rangeValue: dragging.valueMax - dragging.valueMin,
|
|
292
224
|
rangeRatio: dragging.ratioMax - dragging.ratioMin
|
|
293
225
|
})
|
|
294
226
|
}
|
|
295
227
|
else {
|
|
296
|
-
type = dragging.ratioMax - ratio < ratio - dragging.ratioMin
|
|
228
|
+
dragging.type = dragging.ratioMax - ratio < ratio - dragging.ratioMin
|
|
297
229
|
? dragType.MAX
|
|
298
230
|
: dragType.MIN
|
|
299
231
|
}
|
|
300
232
|
}
|
|
301
233
|
else {
|
|
302
|
-
type = dragType.MAX
|
|
234
|
+
dragging.type = dragType.MAX
|
|
303
235
|
}
|
|
304
236
|
|
|
305
|
-
dragging.type = type
|
|
306
|
-
nextFocus.value = null
|
|
307
|
-
|
|
308
237
|
return dragging
|
|
309
238
|
}
|
|
310
239
|
|
|
311
240
|
function updatePosition (event, dragging = state.dragging.value) {
|
|
312
|
-
const
|
|
313
|
-
ratio = getRatio(event, dragging, state.isReversed.value, props.vertical),
|
|
314
|
-
localModel = getModel(ratio, props.min, props.max, props.step, state.decimals.value)
|
|
315
241
|
let pos
|
|
242
|
+
const ratio = methods.getDraggingRatio(event, dragging)
|
|
243
|
+
const localModel = methods.convertRatioToModel(ratio)
|
|
316
244
|
|
|
317
245
|
switch (dragging.type) {
|
|
318
246
|
case dragType.MIN:
|
|
@@ -323,7 +251,7 @@ export default createComponent({
|
|
|
323
251
|
min: localModel,
|
|
324
252
|
max: dragging.valueMax
|
|
325
253
|
}
|
|
326
|
-
|
|
254
|
+
state.focus.value = 'min'
|
|
327
255
|
}
|
|
328
256
|
else {
|
|
329
257
|
pos = {
|
|
@@ -332,7 +260,7 @@ export default createComponent({
|
|
|
332
260
|
min: dragging.valueMax,
|
|
333
261
|
max: localModel
|
|
334
262
|
}
|
|
335
|
-
|
|
263
|
+
state.focus.value = 'max'
|
|
336
264
|
}
|
|
337
265
|
break
|
|
338
266
|
|
|
@@ -344,7 +272,7 @@ export default createComponent({
|
|
|
344
272
|
min: dragging.valueMin,
|
|
345
273
|
max: localModel
|
|
346
274
|
}
|
|
347
|
-
|
|
275
|
+
state.focus.value = 'max'
|
|
348
276
|
}
|
|
349
277
|
else {
|
|
350
278
|
pos = {
|
|
@@ -353,7 +281,7 @@ export default createComponent({
|
|
|
353
281
|
min: localModel,
|
|
354
282
|
max: dragging.valueMin
|
|
355
283
|
}
|
|
356
|
-
|
|
284
|
+
state.focus.value = 'min'
|
|
357
285
|
}
|
|
358
286
|
break
|
|
359
287
|
|
|
@@ -370,34 +298,26 @@ export default createComponent({
|
|
|
370
298
|
min: parseFloat(min.toFixed(state.decimals.value)),
|
|
371
299
|
max: parseFloat((min + dragging.rangeValue).toFixed(state.decimals.value))
|
|
372
300
|
}
|
|
373
|
-
break
|
|
374
|
-
}
|
|
375
301
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
max: pos.max
|
|
302
|
+
state.focus.value = 'both'
|
|
303
|
+
break
|
|
379
304
|
}
|
|
380
305
|
|
|
381
306
|
// If either of the values to be emitted are null, set them to the defaults the user has entered.
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}
|
|
307
|
+
model.value = model.value.min === null || model.value.max === null
|
|
308
|
+
? { min: pos.min || props.min, max: pos.max || props.max }
|
|
309
|
+
: { min: pos.min, max: pos.max }
|
|
386
310
|
|
|
387
311
|
if (props.snap !== true || props.step === 0) {
|
|
388
312
|
curMinRatio.value = pos.minR
|
|
389
313
|
curMaxRatio.value = pos.maxR
|
|
390
314
|
}
|
|
391
315
|
else {
|
|
392
|
-
curMinRatio.value =
|
|
393
|
-
curMaxRatio.value =
|
|
316
|
+
curMinRatio.value = methods.convertModelToRatio(model.value.min)
|
|
317
|
+
curMaxRatio.value = methods.convertModelToRatio(model.value.max)
|
|
394
318
|
}
|
|
395
319
|
}
|
|
396
320
|
|
|
397
|
-
function onFocus (which) {
|
|
398
|
-
state.focus.value = which
|
|
399
|
-
}
|
|
400
|
-
|
|
401
321
|
function onKeydown (evt) {
|
|
402
322
|
if (!keyCodes.includes(evt.keyCode)) {
|
|
403
323
|
return
|
|
@@ -406,18 +326,15 @@ export default createComponent({
|
|
|
406
326
|
stopAndPrevent(evt)
|
|
407
327
|
|
|
408
328
|
const
|
|
409
|
-
stepVal = ([ 34, 33 ].includes(evt.keyCode) ? 10 : 1) *
|
|
410
|
-
offset = [ 34, 37, 40 ].includes(evt.keyCode) ? -
|
|
411
|
-
|
|
412
|
-
if (props.dragOnlyRange) {
|
|
413
|
-
const interval = props.dragOnlyRange
|
|
414
|
-
? model.value.max - model.value.min
|
|
415
|
-
: 0
|
|
329
|
+
stepVal = ([ 34, 33 ].includes(evt.keyCode) ? 10 : 1) * state.step.value,
|
|
330
|
+
offset = ([ 34, 37, 40 ].includes(evt.keyCode) ? -1 : 1) * (state.isReversed.value === true ? -1 : 1) * stepVal
|
|
416
331
|
|
|
332
|
+
if (state.focus.value === 'both') {
|
|
333
|
+
const interval = model.value.max - model.value.min
|
|
417
334
|
const min = between(
|
|
418
335
|
parseFloat((model.value.min + offset).toFixed(state.decimals.value)),
|
|
419
|
-
|
|
420
|
-
|
|
336
|
+
state.innerMin.value,
|
|
337
|
+
state.innerMax.value - interval
|
|
421
338
|
)
|
|
422
339
|
|
|
423
340
|
model.value = {
|
|
@@ -435,8 +352,8 @@ export default createComponent({
|
|
|
435
352
|
...model.value,
|
|
436
353
|
[ which ]: between(
|
|
437
354
|
parseFloat((model.value[ which ] + offset).toFixed(state.decimals.value)),
|
|
438
|
-
which === 'min' ?
|
|
439
|
-
which === 'max' ?
|
|
355
|
+
which === 'min' ? state.innerMin.value : model.value.min,
|
|
356
|
+
which === 'max' ? state.innerMax.value : model.value.max
|
|
440
357
|
)
|
|
441
358
|
}
|
|
442
359
|
}
|
|
@@ -444,72 +361,20 @@ export default createComponent({
|
|
|
444
361
|
updateValue()
|
|
445
362
|
}
|
|
446
363
|
|
|
447
|
-
function getThumb (sideProps) {
|
|
448
|
-
const child = [
|
|
449
|
-
methods.getThumbSvg(),
|
|
450
|
-
h('div', { class: 'q-slider__focus-ring' })
|
|
451
|
-
]
|
|
452
|
-
|
|
453
|
-
if (props.label === true || props.labelAlways === true) {
|
|
454
|
-
child.push(
|
|
455
|
-
h('div', {
|
|
456
|
-
class: `q-slider__pin q-slider__pin${ state.axis.value } absolute` + sideProps.pinClass.value,
|
|
457
|
-
style: sideProps.pinStyle.value.pin
|
|
458
|
-
}, [
|
|
459
|
-
h('div', {
|
|
460
|
-
class: `q-slider__pin-text-container q-slider__pin-text-container${ state.axis.value }`,
|
|
461
|
-
style: sideProps.pinStyle.value.pinTextContainer
|
|
462
|
-
}, [
|
|
463
|
-
h('span', {
|
|
464
|
-
class: 'q-slider__pin-text' + sideProps.pinTextClass.value
|
|
465
|
-
}, sideProps.label.value)
|
|
466
|
-
])
|
|
467
|
-
]),
|
|
468
|
-
|
|
469
|
-
h('div', {
|
|
470
|
-
class: `q-slider__arrow q-slider__arrow${ state.axis.value }` + sideProps.pinClass.value
|
|
471
|
-
})
|
|
472
|
-
)
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
return h('div', {
|
|
476
|
-
ref: sideProps.domRef,
|
|
477
|
-
class: `q-slider__thumb-container q-slider__thumb-container${ state.axis.value } absolute non-selectable` + sideProps.thumbClass.value,
|
|
478
|
-
style: sideProps.thumbStyle.value,
|
|
479
|
-
...sideProps.events.value,
|
|
480
|
-
tabindex: props.dragOnlyRange !== true ? state.tabindex.value : null
|
|
481
|
-
}, child)
|
|
482
|
-
}
|
|
483
|
-
|
|
484
364
|
return () => {
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
style: state.markerStyle.value
|
|
496
|
-
})
|
|
365
|
+
const content = methods.getContent(
|
|
366
|
+
selectionBarStyle,
|
|
367
|
+
trackContainerTabindex,
|
|
368
|
+
trackContainerEvents,
|
|
369
|
+
node => {
|
|
370
|
+
node.push(
|
|
371
|
+
getMinThumb(),
|
|
372
|
+
getMaxThumb()
|
|
373
|
+
)
|
|
374
|
+
}
|
|
497
375
|
)
|
|
498
376
|
|
|
499
|
-
|
|
500
|
-
h('div', {
|
|
501
|
-
class: `q-slider__track-container q-slider__track-container${ state.axis.value } absolute`
|
|
502
|
-
}, track),
|
|
503
|
-
|
|
504
|
-
getThumb(minProps),
|
|
505
|
-
getThumb(maxProps)
|
|
506
|
-
]
|
|
507
|
-
|
|
508
|
-
if (props.name !== void 0 && props.disable !== true) {
|
|
509
|
-
injectFormInput(child, 'push')
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
const data = {
|
|
377
|
+
return h('div', {
|
|
513
378
|
ref: rootRef,
|
|
514
379
|
class: 'q-range ' + state.classes.value + (
|
|
515
380
|
props.modelValue.min === null || props.modelValue.max === null
|
|
@@ -517,14 +382,8 @@ export default createComponent({
|
|
|
517
382
|
: ''
|
|
518
383
|
),
|
|
519
384
|
...state.attributes.value,
|
|
520
|
-
'aria-valuenow': props.modelValue.min + '|' + props.modelValue.max
|
|
521
|
-
|
|
522
|
-
? state.tabindex.value
|
|
523
|
-
: null,
|
|
524
|
-
...events.value
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
return hDir('div', data, child, 'slide', state.editable.value, () => state.panDirective.value)
|
|
385
|
+
'aria-valuenow': props.modelValue.min + '|' + props.modelValue.max
|
|
386
|
+
}, content)
|
|
528
387
|
}
|
|
529
388
|
}
|
|
530
389
|
})
|