quasar 2.3.4 → 2.4.0
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/Loading.json +2 -6
- package/dist/api/QBreadcrumbsEl.json +31 -10
- package/dist/api/QBtn.json +30 -14
- package/dist/api/QBtnDropdown.json +30 -14
- package/dist/api/QBtnToggle.json +3 -0
- package/dist/api/QChatMessage.json +4 -12
- package/dist/api/QExpansionItem.json +31 -10
- package/dist/api/QFab.json +30 -0
- package/dist/api/QFabAction.json +8 -0
- 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/QOptionGroup.json +74 -4
- package/dist/api/QRange.json +592 -107
- package/dist/api/QRouteTab.json +31 -11
- package/dist/api/QSelect.json +3 -6
- package/dist/api/QSlider.json +504 -39
- package/dist/api/QUploader.json +16 -2
- 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 +264 -183
- package/dist/quasar.esm.prod.js +2 -2
- package/dist/quasar.prod.css +1 -1
- package/dist/quasar.rtl.css +331 -262
- package/dist/quasar.rtl.prod.css +1 -1
- package/dist/quasar.sass +235 -178
- package/dist/quasar.umd.js +16537 -16226
- 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 +594 -120
- package/dist/vetur/quasar-attributes.json +250 -82
- package/dist/vetur/quasar-tags.json +59 -17
- package/dist/web-types/web-types.json +578 -149
- package/package.json +1 -1
- package/src/api.extends.json +0 -1
- 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/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/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 +103 -222
- package/src/components/range/QRange.json +11 -121
- package/src/components/scroll-area/QScrollArea.js +3 -1
- package/src/components/slider/QSlider.js +46 -132
- package/src/components/slider/QSlider.json +1 -121
- package/src/components/slider/QSlider.sass +198 -132
- package/src/components/slider/use-slider.js +453 -109
- 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 +71 -20
- package/src/components/tabs/use-tab.js +26 -13
- 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/virtual-scroll/QVirtualScroll.sass +1 -0
- package/src/components/virtual-scroll/use-virtual-scroll.js +30 -17
- package/src/composables/private/use-field.js +5 -5
- 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-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-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/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/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/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,7 +20,6 @@ export default createComponent({
|
|
|
25
20
|
name: 'QRange',
|
|
26
21
|
|
|
27
22
|
props: {
|
|
28
|
-
...useFormProps,
|
|
29
23
|
...useSliderProps,
|
|
30
24
|
|
|
31
25
|
modelValue: {
|
|
@@ -39,8 +33,6 @@ export default createComponent({
|
|
|
39
33
|
}
|
|
40
34
|
},
|
|
41
35
|
|
|
42
|
-
name: String,
|
|
43
|
-
|
|
44
36
|
dragRange: Boolean,
|
|
45
37
|
dragOnlyRange: Boolean,
|
|
46
38
|
|
|
@@ -50,7 +42,10 @@ export default createComponent({
|
|
|
50
42
|
rightLabelTextColor: String,
|
|
51
43
|
|
|
52
44
|
leftLabelValue: [ String, Number ],
|
|
53
|
-
rightLabelValue: [ String, Number ]
|
|
45
|
+
rightLabelValue: [ String, Number ],
|
|
46
|
+
|
|
47
|
+
leftThumbColor: String,
|
|
48
|
+
rightThumbColor: String
|
|
54
49
|
},
|
|
55
50
|
|
|
56
51
|
emits: useSliderEmits,
|
|
@@ -58,51 +53,46 @@ export default createComponent({
|
|
|
58
53
|
setup (props, { emit }) {
|
|
59
54
|
const { proxy: { $q } } = getCurrentInstance()
|
|
60
55
|
|
|
61
|
-
const
|
|
62
|
-
|
|
56
|
+
const { state, methods } = useSlider({
|
|
57
|
+
updateValue, updatePosition, getDragging,
|
|
58
|
+
formAttrs: computed(() => ({
|
|
63
59
|
type: 'hidden',
|
|
64
60
|
name: props.name,
|
|
65
61
|
value: `${ props.modelValue.min }|${ props.modelValue.max }`
|
|
66
|
-
}
|
|
62
|
+
}))
|
|
67
63
|
})
|
|
68
64
|
|
|
69
|
-
const injectFormInput = useFormInject(formAttrs)
|
|
70
|
-
|
|
71
65
|
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
66
|
const curMinRatio = ref(0)
|
|
80
67
|
const curMaxRatio = ref(0)
|
|
81
68
|
|
|
82
|
-
const
|
|
83
|
-
|
|
69
|
+
const model = ref({
|
|
70
|
+
min: props.modelValue.min === null ? state.innerMin.value : props.modelValue.min,
|
|
71
|
+
max: props.modelValue.max === null ? state.innerMax.value : props.modelValue.max
|
|
84
72
|
})
|
|
85
73
|
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
))
|
|
74
|
+
const nextFocus = ref(null)
|
|
75
|
+
|
|
76
|
+
const modelMinRatio = computed(() => methods.convertModelToRatio(model.value.min))
|
|
77
|
+
const modelMaxRatio = computed(() => methods.convertModelToRatio(model.value.max))
|
|
89
78
|
|
|
90
79
|
const ratioMin = computed(() => (
|
|
91
80
|
state.active.value === true ? curMinRatio.value : modelMinRatio.value
|
|
92
81
|
))
|
|
93
|
-
|
|
94
|
-
const modelMaxRatio = computed(() => (
|
|
95
|
-
state.minMaxDiff.value === 0 ? 0 : (model.value.max - props.min) / state.minMaxDiff.value
|
|
96
|
-
))
|
|
97
|
-
|
|
98
82
|
const ratioMax = computed(() => (
|
|
99
83
|
state.active.value === true ? curMaxRatio.value : modelMaxRatio.value
|
|
100
84
|
))
|
|
101
85
|
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
86
|
+
const selectionBarStyle = computed(() => {
|
|
87
|
+
const acc = {
|
|
88
|
+
[ state.positionProp.value ]: `${ 100 * ratioMin.value }%`,
|
|
89
|
+
[ state.sizeProp.value ]: `${ 100 * (ratioMax.value - ratioMin.value) }%`
|
|
90
|
+
}
|
|
91
|
+
if (props.selectionImg !== void 0) {
|
|
92
|
+
acc.backgroundImage = `url(${ props.selectionImg }) !important`
|
|
93
|
+
}
|
|
94
|
+
return acc
|
|
95
|
+
})
|
|
106
96
|
|
|
107
97
|
const events = computed(() => {
|
|
108
98
|
if (state.editable.value !== true) {
|
|
@@ -125,128 +115,76 @@ export default createComponent({
|
|
|
125
115
|
return evt
|
|
126
116
|
})
|
|
127
117
|
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
}),
|
|
157
|
-
|
|
158
|
-
pinTextClass: computed(() => {
|
|
159
|
-
const color = props.leftLabelTextColor || props.labelTextColor
|
|
160
|
-
return color ? ` text-${ color }` : ''
|
|
161
|
-
}),
|
|
162
|
-
|
|
163
|
-
pinStyle: computed(() => {
|
|
164
|
-
const percent = (props.reverse === true ? -ratioMin.value : ratioMin.value - 1)
|
|
165
|
-
return methods.getPinStyle(percent, ratioMin.value)
|
|
118
|
+
const minThumbRef = ref(null)
|
|
119
|
+
const minEvents = computed(() => (
|
|
120
|
+
state.editable.value === true && $q.platform.is.mobile !== true && props.dragOnlyRange !== true
|
|
121
|
+
? {
|
|
122
|
+
onFocus: () => { onFocus('min') },
|
|
123
|
+
onBlur: methods.onBlur,
|
|
124
|
+
onKeydown,
|
|
125
|
+
onKeyup: methods.onKeyup
|
|
126
|
+
}
|
|
127
|
+
: {}
|
|
128
|
+
))
|
|
129
|
+
const getMinThumb = methods.getThumbRenderFn({
|
|
130
|
+
focusValue: 'min',
|
|
131
|
+
nextFocus,
|
|
132
|
+
getNodeData: () => ({
|
|
133
|
+
ref: minThumbRef,
|
|
134
|
+
...minEvents.value,
|
|
135
|
+
tabindex: props.dragOnlyRange !== true ? state.tabindex.value : null
|
|
166
136
|
}),
|
|
167
|
-
|
|
137
|
+
ratio: ratioMin,
|
|
168
138
|
label: computed(() => (
|
|
169
139
|
props.leftLabelValue !== void 0
|
|
170
140
|
? props.leftLabelValue
|
|
171
141
|
: 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
142
|
)),
|
|
143
|
+
thumbColor: computed(() => props.leftThumbColor || props.thumbColor || props.color),
|
|
144
|
+
labelColor: computed(() => props.leftLabelColor || props.labelColor),
|
|
145
|
+
labelTextColor: computed(() => props.leftLabelTextColor || props.labelTextColor)
|
|
146
|
+
})
|
|
198
147
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
148
|
+
const maxEvents = computed(() => (
|
|
149
|
+
state.editable.value === true && $q.platform.is.mobile !== true && props.dragOnlyRange !== true
|
|
150
|
+
? {
|
|
151
|
+
onFocus: () => { onFocus('max') },
|
|
152
|
+
onBlur: methods.onBlur,
|
|
153
|
+
onKeydown,
|
|
154
|
+
onKeyup: methods.onKeyup
|
|
155
|
+
}
|
|
156
|
+
: {}
|
|
157
|
+
))
|
|
158
|
+
const getMaxThumb = methods.getThumbRenderFn({
|
|
159
|
+
focusValue: 'max',
|
|
160
|
+
nextFocus,
|
|
161
|
+
getNodeData: () => ({
|
|
162
|
+
...maxEvents.value,
|
|
163
|
+
tabindex: props.dragOnlyRange !== true ? state.tabindex.value : null
|
|
212
164
|
}),
|
|
213
|
-
|
|
165
|
+
ratio: ratioMax,
|
|
214
166
|
label: computed(() => (
|
|
215
167
|
props.rightLabelValue !== void 0
|
|
216
168
|
? props.rightLabelValue
|
|
217
169
|
: model.value.max
|
|
218
|
-
))
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
model.value.min = val === null
|
|
223
|
-
? props.min
|
|
224
|
-
: val
|
|
170
|
+
)),
|
|
171
|
+
thumbColor: computed(() => props.rightThumbColor || props.thumbColor || props.color),
|
|
172
|
+
labelColor: computed(() => props.rightLabelColor || props.labelColor),
|
|
173
|
+
labelTextColor: computed(() => props.rightLabelTextColor || props.labelTextColor)
|
|
225
174
|
})
|
|
226
175
|
|
|
227
|
-
watch(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
176
|
+
watch(
|
|
177
|
+
() => props.modelValue.min + props.modelValue.max + state.innerMin.value + state.innerMax.value,
|
|
178
|
+
() => {
|
|
179
|
+
model.value.min = props.modelValue.min === null
|
|
180
|
+
? state.innerMin.value
|
|
181
|
+
: between(props.modelValue.min, state.innerMin.value, state.innerMax.value)
|
|
232
182
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
if (model.value.max < value) {
|
|
238
|
-
model.value.max = value
|
|
183
|
+
model.value.max = props.modelValue.max === null
|
|
184
|
+
? state.innerMax.value
|
|
185
|
+
: between(props.modelValue.max, state.innerMin.value, state.innerMax.value)
|
|
239
186
|
}
|
|
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
|
-
}
|
|
249
|
-
})
|
|
187
|
+
)
|
|
250
188
|
|
|
251
189
|
function updateValue (change) {
|
|
252
190
|
if (model.value.min !== props.modelValue.min || model.value.max !== props.modelValue.max) {
|
|
@@ -261,8 +199,8 @@ export default createComponent({
|
|
|
261
199
|
sensitivity = props.dragOnlyRange === true
|
|
262
200
|
? 0
|
|
263
201
|
: (props.vertical === true
|
|
264
|
-
?
|
|
265
|
-
:
|
|
202
|
+
? minThumbRef.value.offsetHeight / (2 * height)
|
|
203
|
+
: minThumbRef.value.offsetWidth / (2 * width)
|
|
266
204
|
)
|
|
267
205
|
|
|
268
206
|
const dragging = {
|
|
@@ -276,8 +214,8 @@ export default createComponent({
|
|
|
276
214
|
ratioMax: modelMaxRatio.value
|
|
277
215
|
}
|
|
278
216
|
|
|
279
|
-
const ratio = getRatio(event, dragging, state.isReversed.value, props.vertical)
|
|
280
217
|
let type
|
|
218
|
+
const ratio = methods.getDraggingRatio(event, dragging)
|
|
281
219
|
|
|
282
220
|
if (props.dragOnlyRange !== true && ratio < dragging.ratioMin + sensitivity) {
|
|
283
221
|
type = dragType.MIN
|
|
@@ -287,7 +225,7 @@ export default createComponent({
|
|
|
287
225
|
type = dragType.RANGE
|
|
288
226
|
Object.assign(dragging, {
|
|
289
227
|
offsetRatio: ratio,
|
|
290
|
-
offsetModel:
|
|
228
|
+
offsetModel: methods.convertRatioToModel(ratio),
|
|
291
229
|
rangeValue: dragging.valueMax - dragging.valueMin,
|
|
292
230
|
rangeRatio: dragging.ratioMax - dragging.ratioMin
|
|
293
231
|
})
|
|
@@ -309,10 +247,9 @@ export default createComponent({
|
|
|
309
247
|
}
|
|
310
248
|
|
|
311
249
|
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
250
|
let pos
|
|
251
|
+
const ratio = methods.getDraggingRatio(event, dragging)
|
|
252
|
+
const localModel = methods.convertRatioToModel(ratio)
|
|
316
253
|
|
|
317
254
|
switch (dragging.type) {
|
|
318
255
|
case dragType.MIN:
|
|
@@ -389,8 +326,8 @@ export default createComponent({
|
|
|
389
326
|
curMaxRatio.value = pos.maxR
|
|
390
327
|
}
|
|
391
328
|
else {
|
|
392
|
-
curMinRatio.value = state.
|
|
393
|
-
curMaxRatio.value = state.
|
|
329
|
+
curMinRatio.value = state.trackLen.value === 0 ? 0 : (model.value.min - props.min) / state.trackLen.value
|
|
330
|
+
curMaxRatio.value = state.trackLen.value === 0 ? 0 : (model.value.max - props.min) / state.trackLen.value
|
|
394
331
|
}
|
|
395
332
|
}
|
|
396
333
|
|
|
@@ -416,8 +353,8 @@ export default createComponent({
|
|
|
416
353
|
|
|
417
354
|
const min = between(
|
|
418
355
|
parseFloat((model.value.min + offset).toFixed(state.decimals.value)),
|
|
419
|
-
|
|
420
|
-
|
|
356
|
+
state.innerMin.value,
|
|
357
|
+
state.innerMax.value - interval
|
|
421
358
|
)
|
|
422
359
|
|
|
423
360
|
model.value = {
|
|
@@ -435,8 +372,8 @@ export default createComponent({
|
|
|
435
372
|
...model.value,
|
|
436
373
|
[ which ]: between(
|
|
437
374
|
parseFloat((model.value[ which ] + offset).toFixed(state.decimals.value)),
|
|
438
|
-
which === 'min' ?
|
|
439
|
-
which === 'max' ?
|
|
375
|
+
which === 'min' ? state.innerMin.value : model.value.min,
|
|
376
|
+
which === 'max' ? state.innerMax.value : model.value.max
|
|
440
377
|
)
|
|
441
378
|
}
|
|
442
379
|
}
|
|
@@ -444,72 +381,19 @@ export default createComponent({
|
|
|
444
381
|
updateValue()
|
|
445
382
|
}
|
|
446
383
|
|
|
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
384
|
return () => {
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
class: `q-slider__track-markers q-slider__track-markers${ state.axis.value } absolute-full fit`,
|
|
495
|
-
style: state.markerStyle.value
|
|
496
|
-
})
|
|
385
|
+
const content = methods.getContent(
|
|
386
|
+
selectionBarStyle,
|
|
387
|
+
events,
|
|
388
|
+
node => {
|
|
389
|
+
node.push(
|
|
390
|
+
getMinThumb(),
|
|
391
|
+
getMaxThumb()
|
|
392
|
+
)
|
|
393
|
+
}
|
|
497
394
|
)
|
|
498
395
|
|
|
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 = {
|
|
396
|
+
return h('div', {
|
|
513
397
|
ref: rootRef,
|
|
514
398
|
class: 'q-range ' + state.classes.value + (
|
|
515
399
|
props.modelValue.min === null || props.modelValue.max === null
|
|
@@ -520,11 +404,8 @@ export default createComponent({
|
|
|
520
404
|
'aria-valuenow': props.modelValue.min + '|' + props.modelValue.max,
|
|
521
405
|
tabindex: props.dragOnlyRange === true && $q.platform.is.mobile !== true
|
|
522
406
|
? state.tabindex.value
|
|
523
|
-
: null
|
|
524
|
-
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
return hDir('div', data, child, 'slide', state.editable.value, () => state.panDirective.value)
|
|
407
|
+
: null
|
|
408
|
+
}, content)
|
|
528
409
|
}
|
|
529
410
|
}
|
|
530
411
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"mixins": [ "
|
|
2
|
+
"mixins": [ "components/slider/use-slider" ],
|
|
3
3
|
|
|
4
4
|
"meta": {
|
|
5
5
|
"docsUrl": "https://v2.quasar.dev/vue-components/range"
|
|
@@ -25,42 +25,6 @@
|
|
|
25
25
|
"examples": [ "v-model=\"positionModel\"" ]
|
|
26
26
|
},
|
|
27
27
|
|
|
28
|
-
"min": {
|
|
29
|
-
"type": "Number",
|
|
30
|
-
"desc": "Minimum value of the model",
|
|
31
|
-
"default": 0,
|
|
32
|
-
"examples": [ ":min=\"0\"" ],
|
|
33
|
-
"category": "model"
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
"max": {
|
|
37
|
-
"type": "Number",
|
|
38
|
-
"desc": "Maximum value of the model",
|
|
39
|
-
"default": 100,
|
|
40
|
-
"examples": [ ":max=\"100\"" ],
|
|
41
|
-
"category": "model"
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
"step": {
|
|
45
|
-
"type": "Number",
|
|
46
|
-
"desc": "Specify step amount between valid values (> 0.0); When step equals to 0 it defines infinite granularity",
|
|
47
|
-
"default": 1,
|
|
48
|
-
"examples": [ ":step=\"1\"" ],
|
|
49
|
-
"category": "model"
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
"reverse": {
|
|
53
|
-
"type": "Boolean",
|
|
54
|
-
"desc": "Work in reverse (changes direction)",
|
|
55
|
-
"category": "behavior"
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
"vertical": {
|
|
59
|
-
"type": "Boolean",
|
|
60
|
-
"desc": "Display in vertical direction",
|
|
61
|
-
"category": "behavior"
|
|
62
|
-
},
|
|
63
|
-
|
|
64
28
|
"drag-range": {
|
|
65
29
|
"type": "Boolean",
|
|
66
30
|
"desc": "User can drag range instead of just the two thumbs",
|
|
@@ -73,28 +37,6 @@
|
|
|
73
37
|
"category": "content"
|
|
74
38
|
},
|
|
75
39
|
|
|
76
|
-
"color": {
|
|
77
|
-
"extends": "color"
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
"label": {
|
|
81
|
-
"type": "Boolean",
|
|
82
|
-
"desc": "Popup labels (for left and right thumbs) when user clicks/taps on the slider thumb and moves it",
|
|
83
|
-
"category": "labels"
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
"label-color": {
|
|
87
|
-
"extends": "color",
|
|
88
|
-
"desc": "Color name for labels background from the Quasar Color Palette; Applies to both labels, unless specific label color props are used",
|
|
89
|
-
"category": "labels"
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
"label-text-color": {
|
|
93
|
-
"extends": "color",
|
|
94
|
-
"desc": "Color name for labels text from the Quasar Color Palette; Applies to both labels, unless specific label text color props are used",
|
|
95
|
-
"category": "labels"
|
|
96
|
-
},
|
|
97
|
-
|
|
98
40
|
"left-label-color": {
|
|
99
41
|
"extends": "color",
|
|
100
42
|
"desc": "Color name for left label background from the Quasar Color Palette",
|
|
@@ -137,76 +79,24 @@
|
|
|
137
79
|
"category": "labels"
|
|
138
80
|
},
|
|
139
81
|
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"desc": "
|
|
143
|
-
"category": "labels"
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
"markers": {
|
|
147
|
-
"type": [ "Boolean", "Number" ],
|
|
148
|
-
"desc": "Display markers on the track, one for each possible value for the model or using a custom step (when specifying a Number)",
|
|
149
|
-
"category": "content",
|
|
150
|
-
"examples": [
|
|
151
|
-
"markers",
|
|
152
|
-
":markers=\"5\""
|
|
153
|
-
]
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
"snap": {
|
|
157
|
-
"type": "Boolean",
|
|
158
|
-
"desc": "Snap thumbs on valid values, rather than sliding freely; Suggestion: use with 'step' prop",
|
|
159
|
-
"category": "content"
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
"thumb-path": {
|
|
163
|
-
"type": "String",
|
|
164
|
-
"desc": "Set custom thumbs svg path",
|
|
165
|
-
"default": "M 4, 10 a 6,6 0 1,0 12,0 a 6,6 0 1,0 -12,0",
|
|
166
|
-
"examples": [ "M5 5 h10 v10 h-10 v-10" ],
|
|
167
|
-
"category": "style"
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
"dark": {
|
|
171
|
-
"extends": "dark"
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
"dense": {
|
|
175
|
-
"extends": "dense"
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
"disable": {
|
|
179
|
-
"extends": "disable"
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
"readonly": {
|
|
183
|
-
"extends": "readonly"
|
|
82
|
+
"left-thumb-color": {
|
|
83
|
+
"extends": "color",
|
|
84
|
+
"desc": "Color name (from the Quasar Color Palette) for left thumb",
|
|
85
|
+
"category": "labels",
|
|
86
|
+
"addedIn": "v2.4"
|
|
184
87
|
},
|
|
185
88
|
|
|
186
|
-
"
|
|
187
|
-
"extends": "
|
|
89
|
+
"right-thumb-color": {
|
|
90
|
+
"extends": "color",
|
|
91
|
+
"desc": "Color name (from the Quasar Color Palette) for right thumb",
|
|
92
|
+
"category": "labels",
|
|
93
|
+
"addedIn": "v2.4"
|
|
188
94
|
}
|
|
189
95
|
},
|
|
190
96
|
|
|
191
97
|
"events": {
|
|
192
98
|
"update:model-value": {
|
|
193
99
|
"extends": "update:model-value"
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
"change": {
|
|
197
|
-
"extends": "update:model-value",
|
|
198
|
-
"desc": "Emitted on lazy model value change (after user slides then releases thumb)"
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
"pan": {
|
|
202
|
-
"desc": "Triggered when user starts panning on the component",
|
|
203
|
-
"params": {
|
|
204
|
-
"phase": {
|
|
205
|
-
"type": "String",
|
|
206
|
-
"desc": "Phase of panning",
|
|
207
|
-
"values": [ "start", "end" ]
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
100
|
}
|
|
211
101
|
}
|
|
212
102
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, ref, computed, withDirectives, getCurrentInstance } from 'vue'
|
|
1
|
+
import { h, ref, computed, withDirectives, onBeforeUnmount, getCurrentInstance } from 'vue'
|
|
2
2
|
|
|
3
3
|
import useDark, { useDarkProps } from '../../composables/private/use-dark.js'
|
|
4
4
|
|
|
@@ -375,6 +375,8 @@ export default createComponent({
|
|
|
375
375
|
}
|
|
376
376
|
})
|
|
377
377
|
|
|
378
|
+
onBeforeUnmount(emitScroll.cancel)
|
|
379
|
+
|
|
378
380
|
return () => {
|
|
379
381
|
return h('div', {
|
|
380
382
|
class: classes.value,
|