quasar 2.4.2 → 2.4.6
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 +6 -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 +1 -1
- package/dist/api/QBtn.json +2 -2
- package/dist/api/QBtnDropdown.json +3 -3
- package/dist/api/QBtnToggle.json +1 -1
- package/dist/api/QCarousel.json +4 -4
- package/dist/api/QCarouselSlide.json +2 -2
- package/dist/api/QChatMessage.json +1 -1
- package/dist/api/QChip.json +4 -4
- package/dist/api/QExpansionItem.json +3 -3
- package/dist/api/QFab.json +2 -2
- package/dist/api/QFabAction.json +1 -1
- package/dist/api/QImg.json +2 -2
- package/dist/api/QLinearProgress.json +1 -1
- package/dist/api/QPagination.json +4 -4
- package/dist/api/QParallax.json +1 -1
- package/dist/api/QPullToRefresh.json +1 -1
- package/dist/api/QRadio.json +3 -1
- package/dist/api/QRating.json +3 -3
- package/dist/api/QRouteTab.json +1 -1
- package/dist/api/QSelect.json +2 -2
- 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 +2 -2
- package/dist/api/QToggle.json +1 -1
- package/dist/api/QTree.json +1 -1
- 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 +7 -6
- package/dist/quasar.esm.prod.js +2 -2
- package/dist/quasar.prod.css +1 -1
- package/dist/quasar.rtl.css +7 -6
- package/dist/quasar.rtl.prod.css +1 -1
- package/dist/quasar.sass +7 -7
- package/dist/quasar.umd.js +420 -284
- package/dist/quasar.umd.prod.js +2 -2
- package/dist/ssr-directives/Morph.js +1 -1
- package/dist/types/index.d.ts +29 -11
- package/dist/types/utils/date.d.ts +2 -1
- package/dist/vetur/quasar-attributes.json +13 -5
- package/dist/vetur/quasar-tags.json +4 -2
- package/dist/web-types/web-types.json +80 -62
- package/package.json +1 -1
- package/src/api.extends.json +1 -1
- package/src/components/ajax-bar/QAjaxBar.js +47 -26
- package/src/components/ajax-bar/QAjaxBar.json +22 -4
- package/src/components/breadcrumbs/QBreadcrumbs.js +3 -3
- package/src/components/breadcrumbs/QBreadcrumbsEl.js +2 -2
- package/src/components/btn/use-btn.js +4 -1
- package/src/components/btn-toggle/QBtnToggle.js +2 -0
- package/src/components/carousel/QCarouselSlide.json +2 -2
- package/src/components/chat/QChatMessage.json +1 -1
- package/src/components/dialog/QDialog.js +7 -5
- package/src/components/icon/QIcon.js +36 -32
- package/src/components/icon/QIcon.sass +0 -1
- package/src/components/img/QImg.json +2 -2
- package/src/components/layout/QLayout.js +49 -1
- package/src/components/linear-progress/QLinearProgress.json +1 -1
- package/src/components/menu/QMenu.js +6 -2
- package/src/components/pagination/QPagination.js +4 -4
- package/src/components/parallax/QParallax.json +1 -1
- package/src/components/radio/QRadio.js +2 -6
- package/src/components/radio/QRadio.json +1 -1
- package/src/components/range/QRange.js +67 -89
- package/src/components/rating/QRating.json +3 -3
- package/src/components/resize-observer/QResizeObserver.js +11 -10
- package/src/components/scroll-area/QScrollArea.js +5 -1
- package/src/components/scroll-area/QScrollArea.sass +1 -0
- package/src/components/scroll-observer/QScrollObserver.js +2 -0
- package/src/components/select/QSelect.json +1 -1
- package/src/components/slider/QSlider.js +20 -10
- package/src/components/slider/QSlider.sass +5 -6
- package/src/components/slider/use-slider.js +19 -16
- package/src/components/tabs/QTabs.js +27 -11
- package/src/components/timeline/QTimeline.sass +1 -2
- package/src/components/timeline/QTimelineEntry.json +1 -1
- package/src/components/tooltip/QTooltip.js +1 -2
- package/src/components/video/QVideo.js +4 -1
- package/src/components/video/QVideo.json +12 -1
- package/src/composables/private/use-field.js +13 -15
- package/src/composables/private/use-model-toggle.js +1 -1
- package/src/composables/private/use-portal.js +9 -7
- package/src/composables/private/use-tick.js +7 -14
- package/src/css/core/visibility.sass +0 -1
- package/src/plugins/BottomSheet.json +7 -1
- package/src/plugins/LoadingBar.json +1 -1
- package/src/plugins/Notify.json +22 -22
- package/src/utils/clone.js +53 -4
- package/src/utils/private/focus-manager.js +8 -10
- package/src/utils/private/global-dialog.js +4 -4
|
@@ -24,13 +24,8 @@ export default createComponent({
|
|
|
24
24
|
|
|
25
25
|
modelValue: {
|
|
26
26
|
type: Object,
|
|
27
|
-
default: () => ({
|
|
28
|
-
|
|
29
|
-
max: null
|
|
30
|
-
}),
|
|
31
|
-
validator (val) {
|
|
32
|
-
return 'min' in val && 'max' in val
|
|
33
|
-
}
|
|
27
|
+
default: () => ({ min: null, max: null }),
|
|
28
|
+
validator: v => 'min' in v && 'max' in v
|
|
34
29
|
},
|
|
35
30
|
|
|
36
31
|
dragRange: Boolean,
|
|
@@ -65,13 +60,24 @@ export default createComponent({
|
|
|
65
60
|
const rootRef = ref(null)
|
|
66
61
|
const curMinRatio = ref(0)
|
|
67
62
|
const curMaxRatio = ref(0)
|
|
63
|
+
const model = ref({ min: 0, max: 0 })
|
|
68
64
|
|
|
69
|
-
|
|
70
|
-
min
|
|
71
|
-
|
|
72
|
-
|
|
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)
|
|
73
69
|
|
|
74
|
-
|
|
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()
|
|
75
81
|
|
|
76
82
|
const modelMinRatio = computed(() => methods.convertModelToRatio(model.value.min))
|
|
77
83
|
const modelMaxRatio = computed(() => methods.convertModelToRatio(model.value.max))
|
|
@@ -94,7 +100,7 @@ export default createComponent({
|
|
|
94
100
|
return acc
|
|
95
101
|
})
|
|
96
102
|
|
|
97
|
-
const
|
|
103
|
+
const trackContainerEvents = computed(() => {
|
|
98
104
|
if (state.editable.value !== true) {
|
|
99
105
|
return {}
|
|
100
106
|
}
|
|
@@ -105,34 +111,45 @@ export default createComponent({
|
|
|
105
111
|
|
|
106
112
|
const evt = { onMousedown: methods.onActivate }
|
|
107
113
|
|
|
108
|
-
props.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
+
}
|
|
114
122
|
|
|
115
123
|
return evt
|
|
116
124
|
})
|
|
117
125
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
state.editable.value === true && $q.platform.is.mobile !== true && props.dragOnlyRange !== true
|
|
126
|
+
function getEvents (side) {
|
|
127
|
+
return $q.platform.is.mobile !== true && state.editable.value === true && props.dragOnlyRange !== true
|
|
121
128
|
? {
|
|
122
|
-
onFocus: () => {
|
|
129
|
+
onFocus: () => { state.focus.value = side },
|
|
123
130
|
onBlur: methods.onBlur,
|
|
124
131
|
onKeydown,
|
|
125
132
|
onKeyup: methods.onKeyup
|
|
126
133
|
}
|
|
127
134
|
: {}
|
|
135
|
+
}
|
|
136
|
+
|
|
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
|
|
128
142
|
))
|
|
143
|
+
|
|
144
|
+
const minThumbRef = ref(null)
|
|
145
|
+
const minEvents = computed(() => getEvents('min'))
|
|
129
146
|
const getMinThumb = methods.getThumbRenderFn({
|
|
130
147
|
focusValue: 'min',
|
|
131
|
-
nextFocus,
|
|
132
148
|
getNodeData: () => ({
|
|
133
149
|
ref: minThumbRef,
|
|
150
|
+
key: 'tmin',
|
|
134
151
|
...minEvents.value,
|
|
135
|
-
tabindex:
|
|
152
|
+
tabindex: thumbTabindex.value
|
|
136
153
|
}),
|
|
137
154
|
ratio: ratioMin,
|
|
138
155
|
label: computed(() => (
|
|
@@ -145,22 +162,13 @@ export default createComponent({
|
|
|
145
162
|
labelTextColor: computed(() => props.leftLabelTextColor || props.labelTextColor)
|
|
146
163
|
})
|
|
147
164
|
|
|
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
|
-
))
|
|
165
|
+
const maxEvents = computed(() => getEvents('max'))
|
|
158
166
|
const getMaxThumb = methods.getThumbRenderFn({
|
|
159
167
|
focusValue: 'max',
|
|
160
|
-
nextFocus,
|
|
161
168
|
getNodeData: () => ({
|
|
162
169
|
...maxEvents.value,
|
|
163
|
-
|
|
170
|
+
key: 'tmax',
|
|
171
|
+
tabindex: thumbTabindex.value
|
|
164
172
|
}),
|
|
165
173
|
ratio: ratioMax,
|
|
166
174
|
label: computed(() => (
|
|
@@ -173,19 +181,6 @@ export default createComponent({
|
|
|
173
181
|
labelTextColor: computed(() => props.rightLabelTextColor || props.labelTextColor)
|
|
174
182
|
})
|
|
175
183
|
|
|
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)
|
|
182
|
-
|
|
183
|
-
model.value.max = props.modelValue.max === null
|
|
184
|
-
? state.innerMax.value
|
|
185
|
-
: between(props.modelValue.max, state.innerMin.value, state.innerMax.value)
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
|
|
189
184
|
function updateValue (change) {
|
|
190
185
|
if (model.value.min !== props.modelValue.min || model.value.max !== props.modelValue.max) {
|
|
191
186
|
emit('update:modelValue', { ...model.value })
|
|
@@ -214,15 +209,14 @@ export default createComponent({
|
|
|
214
209
|
ratioMax: modelMaxRatio.value
|
|
215
210
|
}
|
|
216
211
|
|
|
217
|
-
let type
|
|
218
212
|
const ratio = methods.getDraggingRatio(event, dragging)
|
|
219
213
|
|
|
220
214
|
if (props.dragOnlyRange !== true && ratio < dragging.ratioMin + sensitivity) {
|
|
221
|
-
type = dragType.MIN
|
|
215
|
+
dragging.type = dragType.MIN
|
|
222
216
|
}
|
|
223
217
|
else if (props.dragOnlyRange === true || ratio < dragging.ratioMax - sensitivity) {
|
|
224
218
|
if (props.dragRange === true || props.dragOnlyRange === true) {
|
|
225
|
-
type = dragType.RANGE
|
|
219
|
+
dragging.type = dragType.RANGE
|
|
226
220
|
Object.assign(dragging, {
|
|
227
221
|
offsetRatio: ratio,
|
|
228
222
|
offsetModel: methods.convertRatioToModel(ratio),
|
|
@@ -231,18 +225,15 @@ export default createComponent({
|
|
|
231
225
|
})
|
|
232
226
|
}
|
|
233
227
|
else {
|
|
234
|
-
type = dragging.ratioMax - ratio < ratio - dragging.ratioMin
|
|
228
|
+
dragging.type = dragging.ratioMax - ratio < ratio - dragging.ratioMin
|
|
235
229
|
? dragType.MAX
|
|
236
230
|
: dragType.MIN
|
|
237
231
|
}
|
|
238
232
|
}
|
|
239
233
|
else {
|
|
240
|
-
type = dragType.MAX
|
|
234
|
+
dragging.type = dragType.MAX
|
|
241
235
|
}
|
|
242
236
|
|
|
243
|
-
dragging.type = type
|
|
244
|
-
nextFocus.value = null
|
|
245
|
-
|
|
246
237
|
return dragging
|
|
247
238
|
}
|
|
248
239
|
|
|
@@ -260,7 +251,7 @@ export default createComponent({
|
|
|
260
251
|
min: localModel,
|
|
261
252
|
max: dragging.valueMax
|
|
262
253
|
}
|
|
263
|
-
|
|
254
|
+
state.focus.value = 'min'
|
|
264
255
|
}
|
|
265
256
|
else {
|
|
266
257
|
pos = {
|
|
@@ -269,7 +260,7 @@ export default createComponent({
|
|
|
269
260
|
min: dragging.valueMax,
|
|
270
261
|
max: localModel
|
|
271
262
|
}
|
|
272
|
-
|
|
263
|
+
state.focus.value = 'max'
|
|
273
264
|
}
|
|
274
265
|
break
|
|
275
266
|
|
|
@@ -281,7 +272,7 @@ export default createComponent({
|
|
|
281
272
|
min: dragging.valueMin,
|
|
282
273
|
max: localModel
|
|
283
274
|
}
|
|
284
|
-
|
|
275
|
+
state.focus.value = 'max'
|
|
285
276
|
}
|
|
286
277
|
else {
|
|
287
278
|
pos = {
|
|
@@ -290,7 +281,7 @@ export default createComponent({
|
|
|
290
281
|
min: localModel,
|
|
291
282
|
max: dragging.valueMin
|
|
292
283
|
}
|
|
293
|
-
|
|
284
|
+
state.focus.value = 'min'
|
|
294
285
|
}
|
|
295
286
|
break
|
|
296
287
|
|
|
@@ -307,34 +298,26 @@ export default createComponent({
|
|
|
307
298
|
min: parseFloat(min.toFixed(state.decimals.value)),
|
|
308
299
|
max: parseFloat((min + dragging.rangeValue).toFixed(state.decimals.value))
|
|
309
300
|
}
|
|
310
|
-
break
|
|
311
|
-
}
|
|
312
301
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
max: pos.max
|
|
302
|
+
state.focus.value = 'both'
|
|
303
|
+
break
|
|
316
304
|
}
|
|
317
305
|
|
|
318
306
|
// If either of the values to be emitted are null, set them to the defaults the user has entered.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
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 }
|
|
323
310
|
|
|
324
311
|
if (props.snap !== true || props.step === 0) {
|
|
325
312
|
curMinRatio.value = pos.minR
|
|
326
313
|
curMaxRatio.value = pos.maxR
|
|
327
314
|
}
|
|
328
315
|
else {
|
|
329
|
-
curMinRatio.value =
|
|
330
|
-
curMaxRatio.value =
|
|
316
|
+
curMinRatio.value = methods.convertModelToRatio(model.value.min)
|
|
317
|
+
curMaxRatio.value = methods.convertModelToRatio(model.value.max)
|
|
331
318
|
}
|
|
332
319
|
}
|
|
333
320
|
|
|
334
|
-
function onFocus (which) {
|
|
335
|
-
state.focus.value = which
|
|
336
|
-
}
|
|
337
|
-
|
|
338
321
|
function onKeydown (evt) {
|
|
339
322
|
if (!keyCodes.includes(evt.keyCode)) {
|
|
340
323
|
return
|
|
@@ -343,14 +326,11 @@ export default createComponent({
|
|
|
343
326
|
stopAndPrevent(evt)
|
|
344
327
|
|
|
345
328
|
const
|
|
346
|
-
stepVal = ([ 34, 33 ].includes(evt.keyCode) ? 10 : 1) *
|
|
347
|
-
offset = [ 34, 37, 40 ].includes(evt.keyCode) ? -
|
|
348
|
-
|
|
349
|
-
if (props.dragOnlyRange) {
|
|
350
|
-
const interval = props.dragOnlyRange
|
|
351
|
-
? model.value.max - model.value.min
|
|
352
|
-
: 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
|
|
353
331
|
|
|
332
|
+
if (state.focus.value === 'both') {
|
|
333
|
+
const interval = model.value.max - model.value.min
|
|
354
334
|
const min = between(
|
|
355
335
|
parseFloat((model.value.min + offset).toFixed(state.decimals.value)),
|
|
356
336
|
state.innerMin.value,
|
|
@@ -384,7 +364,8 @@ export default createComponent({
|
|
|
384
364
|
return () => {
|
|
385
365
|
const content = methods.getContent(
|
|
386
366
|
selectionBarStyle,
|
|
387
|
-
|
|
367
|
+
trackContainerTabindex,
|
|
368
|
+
trackContainerEvents,
|
|
388
369
|
node => {
|
|
389
370
|
node.push(
|
|
390
371
|
getMinThumb(),
|
|
@@ -401,10 +382,7 @@ export default createComponent({
|
|
|
401
382
|
: ''
|
|
402
383
|
),
|
|
403
384
|
...state.attributes.value,
|
|
404
|
-
'aria-valuenow': props.modelValue.min + '|' + props.modelValue.max
|
|
405
|
-
tabindex: props.dragOnlyRange === true && $q.platform.is.mobile !== true
|
|
406
|
-
? state.tabindex.value
|
|
407
|
-
: null
|
|
385
|
+
'aria-valuenow': props.modelValue.min + '|' + props.modelValue.max
|
|
408
386
|
}, content)
|
|
409
387
|
}
|
|
410
388
|
}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"map",
|
|
28
28
|
"ion-add",
|
|
29
29
|
"img:https://cdn.quasar.dev/logo-v2/svg/logo.svg",
|
|
30
|
-
"img:
|
|
30
|
+
"img:path/to/some_image.png"
|
|
31
31
|
],
|
|
32
32
|
"category": "content"
|
|
33
33
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"map",
|
|
40
40
|
"ion-add",
|
|
41
41
|
"img:https://cdn.quasar.dev/logo-v2/svg/logo.svg",
|
|
42
|
-
"img:
|
|
42
|
+
"img:path/to/some_image.png"
|
|
43
43
|
],
|
|
44
44
|
"category": "content"
|
|
45
45
|
},
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"map",
|
|
52
52
|
"ion-add",
|
|
53
53
|
"img:https://cdn.quasar.dev/logo-v2/svg/logo.svg",
|
|
54
|
-
"img:
|
|
54
|
+
"img:path/to/some_image.png"
|
|
55
55
|
],
|
|
56
56
|
"category": "content"
|
|
57
57
|
},
|
|
@@ -28,19 +28,20 @@ export default createComponent({
|
|
|
28
28
|
setup (props, { emit }) {
|
|
29
29
|
if (__QUASAR_SSR_SERVER__) { return noop }
|
|
30
30
|
|
|
31
|
-
let timer, targetEl, size = { width: -1, height: -1 }
|
|
31
|
+
let timer = null, targetEl, size = { width: -1, height: -1 }
|
|
32
32
|
|
|
33
|
-
function trigger (
|
|
34
|
-
if (
|
|
35
|
-
|
|
33
|
+
function trigger (immediately) {
|
|
34
|
+
if (immediately === true || props.debounce === 0 || props.debounce === '0') {
|
|
35
|
+
emitEvent()
|
|
36
36
|
}
|
|
37
|
-
else if (
|
|
38
|
-
timer = setTimeout(
|
|
37
|
+
else if (timer === null) {
|
|
38
|
+
timer = setTimeout(emitEvent, props.debounce)
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
function
|
|
43
|
-
timer
|
|
42
|
+
function emitEvent () {
|
|
43
|
+
clearTimeout(timer)
|
|
44
|
+
timer = null
|
|
44
45
|
|
|
45
46
|
if (targetEl) {
|
|
46
47
|
const { offsetWidth: width, offsetHeight: height } = targetEl
|
|
@@ -67,7 +68,7 @@ export default createComponent({
|
|
|
67
68
|
if (targetEl) {
|
|
68
69
|
observer = new ResizeObserver(trigger)
|
|
69
70
|
observer.observe(targetEl)
|
|
70
|
-
|
|
71
|
+
emitEvent()
|
|
71
72
|
}
|
|
72
73
|
})
|
|
73
74
|
})
|
|
@@ -110,7 +111,7 @@ export default createComponent({
|
|
|
110
111
|
if (targetEl && targetEl.contentDocument) {
|
|
111
112
|
curDocView = targetEl.contentDocument.defaultView
|
|
112
113
|
curDocView.addEventListener('resize', trigger, listenOpts.passive)
|
|
113
|
-
|
|
114
|
+
emitEvent()
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
|
|
@@ -393,6 +393,7 @@ export default createComponent({
|
|
|
393
393
|
style: mainStyle.value
|
|
394
394
|
}, hMergeSlot(slots.default, [
|
|
395
395
|
h(QResizeObserver, {
|
|
396
|
+
debounce: 0,
|
|
396
397
|
onResize: updateScrollSize
|
|
397
398
|
})
|
|
398
399
|
])),
|
|
@@ -403,7 +404,10 @@ export default createComponent({
|
|
|
403
404
|
})
|
|
404
405
|
]),
|
|
405
406
|
|
|
406
|
-
h(QResizeObserver, {
|
|
407
|
+
h(QResizeObserver, {
|
|
408
|
+
debounce: 0,
|
|
409
|
+
onResize: updateContainer
|
|
410
|
+
}),
|
|
407
411
|
|
|
408
412
|
h('div', {
|
|
409
413
|
class: scroll.vertical.barClass.value,
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
"desc": "Style definitions to be attributed to the popup content",
|
|
229
229
|
"examples": [
|
|
230
230
|
"background-color: #ff0000",
|
|
231
|
-
":content-style=\"{ backgroundColor: '#ff0000' }\""
|
|
231
|
+
":popup-content-style=\"{ backgroundColor: '#ff0000' }\""
|
|
232
232
|
],
|
|
233
233
|
"category": "style"
|
|
234
234
|
},
|
|
@@ -12,6 +12,8 @@ import { createComponent } from '../../utils/private/create.js'
|
|
|
12
12
|
import { between } from '../../utils/format.js'
|
|
13
13
|
import { stopAndPrevent } from '../../utils/event.js'
|
|
14
14
|
|
|
15
|
+
const getNodeData = () => ({})
|
|
16
|
+
|
|
15
17
|
export default createComponent({
|
|
16
18
|
name: 'QSlider',
|
|
17
19
|
|
|
@@ -39,8 +41,20 @@ export default createComponent({
|
|
|
39
41
|
|
|
40
42
|
const rootRef = ref(null)
|
|
41
43
|
const curRatio = ref(0)
|
|
44
|
+
const model = ref(0)
|
|
45
|
+
|
|
46
|
+
function normalizeModel () {
|
|
47
|
+
model.value = props.modelValue === null
|
|
48
|
+
? state.innerMin.value
|
|
49
|
+
: between(props.modelValue, state.innerMin.value, state.innerMax.value)
|
|
50
|
+
}
|
|
42
51
|
|
|
43
|
-
|
|
52
|
+
watch(
|
|
53
|
+
() => `${ props.modelValue }|${ state.innerMin.value }|${ state.innerMax.value }`,
|
|
54
|
+
normalizeModel
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
normalizeModel()
|
|
44
58
|
|
|
45
59
|
const modelRatio = computed(() => methods.convertModelToRatio(model.value))
|
|
46
60
|
const ratio = computed(() => (state.active.value === true ? curRatio.value : modelRatio.value))
|
|
@@ -58,6 +72,7 @@ export default createComponent({
|
|
|
58
72
|
|
|
59
73
|
const getThumb = methods.getThumbRenderFn({
|
|
60
74
|
focusValue: true,
|
|
75
|
+
getNodeData,
|
|
61
76
|
ratio,
|
|
62
77
|
label: computed(() => (
|
|
63
78
|
props.labelValue !== void 0
|
|
@@ -69,7 +84,7 @@ export default createComponent({
|
|
|
69
84
|
labelTextColor: computed(() => props.labelTextColor)
|
|
70
85
|
})
|
|
71
86
|
|
|
72
|
-
const
|
|
87
|
+
const trackContainerEvents = computed(() => {
|
|
73
88
|
if (state.editable.value !== true) {
|
|
74
89
|
return {}
|
|
75
90
|
}
|
|
@@ -85,12 +100,6 @@ export default createComponent({
|
|
|
85
100
|
}
|
|
86
101
|
})
|
|
87
102
|
|
|
88
|
-
watch(() => props.modelValue + state.innerMin.value + state.innerMax.value, () => {
|
|
89
|
-
model.value = props.modelValue === null
|
|
90
|
-
? state.innerMin.value
|
|
91
|
-
: between(props.modelValue, state.innerMin.value, state.innerMax.value)
|
|
92
|
-
})
|
|
93
|
-
|
|
94
103
|
function updateValue (change) {
|
|
95
104
|
if (model.value !== props.modelValue) {
|
|
96
105
|
emit('update:modelValue', model.value)
|
|
@@ -125,7 +134,7 @@ export default createComponent({
|
|
|
125
134
|
|
|
126
135
|
const
|
|
127
136
|
stepVal = ([ 34, 33 ].includes(evt.keyCode) ? 10 : 1) * state.step.value,
|
|
128
|
-
offset = [ 34, 37, 40 ].includes(evt.keyCode) ? -
|
|
137
|
+
offset = ([ 34, 37, 40 ].includes(evt.keyCode) ? -1 : 1) * (state.isReversed.value === true ? -1 : 1) * stepVal
|
|
129
138
|
|
|
130
139
|
model.value = between(
|
|
131
140
|
parseFloat((model.value + offset).toFixed(state.decimals.value)),
|
|
@@ -139,7 +148,8 @@ export default createComponent({
|
|
|
139
148
|
return () => {
|
|
140
149
|
const content = methods.getContent(
|
|
141
150
|
selectionBarStyle,
|
|
142
|
-
|
|
151
|
+
state.tabindex,
|
|
152
|
+
trackContainerEvents,
|
|
143
153
|
node => { node.push(getThumb()) }
|
|
144
154
|
)
|
|
145
155
|
|
|
@@ -107,6 +107,9 @@
|
|
|
107
107
|
color: var(--q-primary)
|
|
108
108
|
transition: transform .18s ease-out, fill .18s ease-out, stroke .18s ease-out
|
|
109
109
|
|
|
110
|
+
&.q-slider--focus
|
|
111
|
+
opacity: 1 !important
|
|
112
|
+
|
|
110
113
|
&--h
|
|
111
114
|
top: 50%
|
|
112
115
|
will-change: left
|
|
@@ -224,11 +227,7 @@
|
|
|
224
227
|
.q-slider__thumb,
|
|
225
228
|
.q-slider__inner,
|
|
226
229
|
.q-slider__selection
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
&--focus
|
|
230
|
-
.q-slider__thumb
|
|
231
|
-
transform: scale(1)
|
|
230
|
+
opacity: 0
|
|
232
231
|
|
|
233
232
|
&--focus,
|
|
234
233
|
body.desktop &.q-slider--editable .q-slider__track-container:hover
|
|
@@ -239,7 +238,7 @@
|
|
|
239
238
|
.q-slider__thumb,
|
|
240
239
|
.q-slider__inner,
|
|
241
240
|
.q-slider__selection
|
|
242
|
-
|
|
241
|
+
opacity: 1
|
|
243
242
|
|
|
244
243
|
&--inactive
|
|
245
244
|
.q-slider__thumb
|
|
@@ -142,7 +142,7 @@ export default function ({ updateValue, updatePosition, getDragging, formAttrs }
|
|
|
142
142
|
const positionProp = computed(() => (
|
|
143
143
|
props.vertical === true
|
|
144
144
|
? (isReversed.value === true ? 'bottom' : 'top')
|
|
145
|
-
: isReversed.value === true ? 'right' : 'left'
|
|
145
|
+
: (isReversed.value === true ? 'right' : 'left')
|
|
146
146
|
))
|
|
147
147
|
|
|
148
148
|
const sizeProp = computed(() => (props.vertical === true ? 'height' : 'width'))
|
|
@@ -152,8 +152,8 @@ export default function ({ updateValue, updatePosition, getDragging, formAttrs }
|
|
|
152
152
|
const attributes = computed(() => {
|
|
153
153
|
const acc = {
|
|
154
154
|
role: 'slider',
|
|
155
|
-
'aria-valuemin':
|
|
156
|
-
'aria-valuemax':
|
|
155
|
+
'aria-valuemin': innerMin.value,
|
|
156
|
+
'aria-valuemax': innerMax.value,
|
|
157
157
|
'aria-orientation': orientation.value,
|
|
158
158
|
'data-step': props.step
|
|
159
159
|
}
|
|
@@ -344,15 +344,19 @@ export default function ({ updateValue, updatePosition, getDragging, formAttrs }
|
|
|
344
344
|
})
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
const filterFn = ({ value }) => value >= props.min && value <= props.max
|
|
348
|
+
|
|
347
349
|
if (Array.isArray(def) === true) {
|
|
348
|
-
return def
|
|
350
|
+
return def
|
|
351
|
+
.map(item => (Object(item) === item ? item : { value: item }))
|
|
352
|
+
.filter(filterFn)
|
|
349
353
|
}
|
|
350
354
|
|
|
351
355
|
return Object.keys(def).map(key => {
|
|
352
356
|
const item = def[ key ]
|
|
353
357
|
const value = Number(key)
|
|
354
358
|
return Object(item) === item ? { ...item, value } : { value, label: item }
|
|
355
|
-
})
|
|
359
|
+
}).filter(filterFn)
|
|
356
360
|
}
|
|
357
361
|
|
|
358
362
|
function getMarkerLabelStyle (val) {
|
|
@@ -407,6 +411,7 @@ export default function ({ updateValue, updatePosition, getDragging, formAttrs }
|
|
|
407
411
|
emit('pan', 'end')
|
|
408
412
|
}
|
|
409
413
|
active.value = false
|
|
414
|
+
focus.value = false
|
|
410
415
|
}
|
|
411
416
|
else if (event.isFirst === true) {
|
|
412
417
|
dragging.value = getDragging(event.evt)
|
|
@@ -467,7 +472,7 @@ export default function ({ updateValue, updatePosition, getDragging, formAttrs }
|
|
|
467
472
|
|
|
468
473
|
function getThumbRenderFn (thumb) {
|
|
469
474
|
const focusClass = computed(() => (
|
|
470
|
-
preventFocus.value === false && focus.value === thumb.focusValue
|
|
475
|
+
preventFocus.value === false && (focus.value === thumb.focusValue || focus.value === 'both')
|
|
471
476
|
? ' q-slider--focus'
|
|
472
477
|
: ''
|
|
473
478
|
))
|
|
@@ -482,9 +487,7 @@ export default function ({ updateValue, updatePosition, getDragging, formAttrs }
|
|
|
482
487
|
width: props.thumbSize,
|
|
483
488
|
height: props.thumbSize,
|
|
484
489
|
[ positionProp.value ]: `${ 100 * thumb.ratio.value }%`,
|
|
485
|
-
|
|
486
|
-
? thumb.nextFocus.value === 'min' ? 2 : void 0
|
|
487
|
-
: void 0
|
|
490
|
+
zIndex: focus.value === thumb.focusValue ? 2 : void 0
|
|
488
491
|
}))
|
|
489
492
|
|
|
490
493
|
const pinColor = computed(() => (
|
|
@@ -540,12 +543,12 @@ export default function ({ updateValue, updatePosition, getDragging, formAttrs }
|
|
|
540
543
|
return h('div', {
|
|
541
544
|
class: classes.value,
|
|
542
545
|
style: style.value,
|
|
543
|
-
...
|
|
546
|
+
...thumb.getNodeData()
|
|
544
547
|
}, thumbContent)
|
|
545
548
|
}
|
|
546
549
|
}
|
|
547
550
|
|
|
548
|
-
function getContent (selectionBarStyle,
|
|
551
|
+
function getContent (selectionBarStyle, trackContainerTabindex, trackContainerEvents, injectThumb) {
|
|
549
552
|
const trackContent = []
|
|
550
553
|
|
|
551
554
|
props.innerTrackColor !== 'transparent' && trackContent.push(
|
|
@@ -580,15 +583,14 @@ export default function ({ updateValue, updatePosition, getDragging, formAttrs }
|
|
|
580
583
|
{
|
|
581
584
|
key: 'trackC',
|
|
582
585
|
class: trackContainerClass.value,
|
|
583
|
-
tabindex:
|
|
584
|
-
...
|
|
586
|
+
tabindex: trackContainerTabindex.value,
|
|
587
|
+
...trackContainerEvents.value
|
|
585
588
|
},
|
|
586
589
|
[
|
|
587
590
|
h('div', {
|
|
588
591
|
class: trackClass.value,
|
|
589
592
|
style: trackStyle.value
|
|
590
|
-
},
|
|
591
|
-
trackContent)
|
|
593
|
+
}, trackContent)
|
|
592
594
|
],
|
|
593
595
|
'slide',
|
|
594
596
|
editable.value, () => panDirective.value
|
|
@@ -635,7 +637,8 @@ export default function ({ updateValue, updatePosition, getDragging, formAttrs }
|
|
|
635
637
|
innerMax,
|
|
636
638
|
innerMaxRatio,
|
|
637
639
|
positionProp,
|
|
638
|
-
sizeProp
|
|
640
|
+
sizeProp,
|
|
641
|
+
isReversed
|
|
639
642
|
},
|
|
640
643
|
|
|
641
644
|
methods: {
|