quasar 1.16.3 → 1.17.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.
Files changed (308) hide show
  1. package/dist/api/BottomSheet.json +2 -2
  2. package/dist/api/Loading.json +0 -2
  3. package/dist/api/LoadingBar.json +1 -1
  4. package/dist/api/Notify.json +25 -25
  5. package/dist/api/QAjaxBar.json +23 -4
  6. package/dist/api/QAvatar.json +1 -1
  7. package/dist/api/QBreadcrumbsEl.json +32 -11
  8. package/dist/api/QBtn.json +35 -14
  9. package/dist/api/QBtnDropdown.json +36 -15
  10. package/dist/api/QBtnToggle.json +1 -1
  11. package/dist/api/QCarousel.json +7 -7
  12. package/dist/api/QCarouselSlide.json +2 -2
  13. package/dist/api/QChatMessage.json +1 -5
  14. package/dist/api/QChip.json +4 -4
  15. package/dist/api/QColor.json +6 -0
  16. package/dist/api/QDialog.json +7 -1
  17. package/dist/api/QExpansionItem.json +34 -13
  18. package/dist/api/QFab.json +34 -2
  19. package/dist/api/QFabAction.json +9 -1
  20. package/dist/api/QField.json +80 -6
  21. package/dist/api/QFile.json +80 -6
  22. package/dist/api/QImg.json +2 -2
  23. package/dist/api/QInnerLoading.json +32 -0
  24. package/dist/api/QInput.json +82 -6
  25. package/dist/api/QItem.json +31 -10
  26. package/dist/api/QOptionGroup.json +58 -1
  27. package/dist/api/QPagination.json +4 -4
  28. package/dist/api/QParallax.json +1 -1
  29. package/dist/api/QPopupEdit.json +14 -7
  30. package/dist/api/QPullToRefresh.json +1 -1
  31. package/dist/api/QRange.json +581 -96
  32. package/dist/api/QRating.json +3 -3
  33. package/dist/api/QRouteTab.json +32 -12
  34. package/dist/api/QScrollArea.json +188 -20
  35. package/dist/api/QSelect.json +82 -10
  36. package/dist/api/QSeparator.json +1 -1
  37. package/dist/api/QSlider.json +499 -34
  38. package/dist/api/QStep.json +4 -4
  39. package/dist/api/QStepper.json +4 -4
  40. package/dist/api/QTab.json +1 -1
  41. package/dist/api/QTable.json +4 -4
  42. package/dist/api/QTabs.json +9 -0
  43. package/dist/api/QTimelineEntry.json +2 -2
  44. package/dist/api/QToggle.json +1 -1
  45. package/dist/api/QTree.json +7 -1
  46. package/dist/api/QVideo.json +10 -0
  47. package/dist/icon-set/bootstrap-icons.umd.min.js +1 -1
  48. package/dist/icon-set/eva-icons.umd.min.js +1 -1
  49. package/dist/icon-set/fontawesome-v5-pro.umd.min.js +1 -1
  50. package/dist/icon-set/fontawesome-v5.umd.min.js +1 -1
  51. package/dist/icon-set/ionicons-v4.umd.min.js +1 -1
  52. package/dist/icon-set/line-awesome.umd.min.js +1 -1
  53. package/dist/icon-set/material-icons-outlined.umd.min.js +1 -1
  54. package/dist/icon-set/material-icons-round.umd.min.js +1 -1
  55. package/dist/icon-set/material-icons-sharp.umd.min.js +1 -1
  56. package/dist/icon-set/material-icons.umd.min.js +1 -1
  57. package/dist/icon-set/mdi-v3.umd.min.js +1 -1
  58. package/dist/icon-set/mdi-v4.umd.min.js +1 -1
  59. package/dist/icon-set/mdi-v5.umd.min.js +1 -1
  60. package/dist/icon-set/mdi-v6.umd.min.js +1 -1
  61. package/dist/icon-set/svg-bootstrap-icons.umd.min.js +1 -1
  62. package/dist/icon-set/svg-eva-icons.umd.min.js +1 -1
  63. package/dist/icon-set/svg-fontawesome-v5.umd.min.js +1 -1
  64. package/dist/icon-set/svg-ionicons-v4.umd.min.js +1 -1
  65. package/dist/icon-set/svg-ionicons-v5.umd.min.js +1 -1
  66. package/dist/icon-set/svg-ionicons-v6.umd.min.js +6 -0
  67. package/dist/icon-set/svg-line-awesome.umd.min.js +1 -1
  68. package/dist/icon-set/svg-material-icons-outlined.umd.min.js +1 -1
  69. package/dist/icon-set/svg-material-icons-round.umd.min.js +1 -1
  70. package/dist/icon-set/svg-material-icons-sharp.umd.min.js +1 -1
  71. package/dist/icon-set/svg-material-icons.umd.min.js +1 -1
  72. package/dist/icon-set/svg-mdi-v4.umd.min.js +1 -1
  73. package/dist/icon-set/svg-mdi-v5.umd.min.js +1 -1
  74. package/dist/icon-set/svg-mdi-v6.umd.min.js +1 -1
  75. package/dist/icon-set/svg-themify.umd.min.js +1 -1
  76. package/dist/icon-set/themify.umd.min.js +1 -1
  77. package/dist/lang/ar.umd.min.js +2 -2
  78. package/dist/lang/az-latn.umd.min.js +1 -1
  79. package/dist/lang/bg.umd.min.js +1 -1
  80. package/dist/lang/ca.umd.min.js +1 -1
  81. package/dist/lang/cs.umd.min.js +1 -1
  82. package/dist/lang/da.umd.min.js +1 -1
  83. package/dist/lang/de.umd.min.js +1 -1
  84. package/dist/lang/el.umd.min.js +1 -1
  85. package/dist/lang/en-gb.umd.min.js +1 -1
  86. package/dist/lang/en-us.umd.min.js +1 -1
  87. package/dist/lang/eo.umd.min.js +1 -1
  88. package/dist/lang/es.umd.min.js +1 -1
  89. package/dist/lang/et.umd.min.js +1 -1
  90. package/dist/lang/fa-ir.umd.min.js +1 -1
  91. package/dist/lang/fa.umd.min.js +1 -1
  92. package/dist/lang/fi.umd.min.js +1 -1
  93. package/dist/lang/fr.umd.min.js +2 -2
  94. package/dist/lang/gn.umd.min.js +1 -1
  95. package/dist/lang/he.umd.min.js +1 -1
  96. package/dist/lang/hr.umd.min.js +1 -1
  97. package/dist/lang/hu.umd.min.js +1 -1
  98. package/dist/lang/id.umd.min.js +1 -1
  99. package/dist/lang/is.umd.min.js +1 -1
  100. package/dist/lang/it.umd.min.js +1 -1
  101. package/dist/lang/ja.umd.min.js +1 -1
  102. package/dist/lang/km.umd.min.js +1 -1
  103. package/dist/lang/ko-kr.umd.min.js +1 -1
  104. package/dist/lang/kur-ckb.umd.min.js +1 -1
  105. package/dist/lang/lu.umd.min.js +1 -1
  106. package/dist/lang/lv.umd.min.js +1 -1
  107. package/dist/lang/ml.umd.min.js +1 -1
  108. package/dist/lang/ms.umd.min.js +1 -1
  109. package/dist/lang/nb-no.umd.min.js +1 -1
  110. package/dist/lang/nl.umd.min.js +1 -1
  111. package/dist/lang/pl.umd.min.js +1 -1
  112. package/dist/lang/pt-br.umd.min.js +1 -1
  113. package/dist/lang/pt.umd.min.js +1 -1
  114. package/dist/lang/ro.umd.min.js +1 -1
  115. package/dist/lang/ru.umd.min.js +1 -1
  116. package/dist/lang/sk.umd.min.js +1 -1
  117. package/dist/lang/sl.umd.min.js +1 -1
  118. package/dist/lang/sr.umd.min.js +2 -2
  119. package/dist/lang/sv.umd.min.js +1 -1
  120. package/dist/lang/ta.umd.min.js +1 -1
  121. package/dist/lang/th.umd.min.js +1 -1
  122. package/dist/lang/tr.umd.min.js +1 -1
  123. package/dist/lang/ug.umd.min.js +2 -2
  124. package/dist/lang/uk.umd.min.js +1 -1
  125. package/dist/lang/vi.umd.min.js +1 -1
  126. package/dist/lang/zh-hans.umd.min.js +2 -2
  127. package/dist/lang/zh-hant.umd.min.js +2 -2
  128. package/dist/quasar.addon.css +1 -1
  129. package/dist/quasar.addon.rtl.css +1 -1
  130. package/dist/quasar.common.js +2 -2
  131. package/dist/quasar.css +380 -227
  132. package/dist/quasar.esm.js +2 -2
  133. package/dist/quasar.ie.polyfills.js +1 -1
  134. package/dist/quasar.ie.polyfills.umd.min.js +1 -1
  135. package/dist/quasar.min.css +1 -1
  136. package/dist/quasar.rtl.css +512 -303
  137. package/dist/quasar.rtl.min.css +1 -1
  138. package/dist/quasar.sass +328 -210
  139. package/dist/quasar.styl +328 -210
  140. package/dist/quasar.umd.js +3244 -1894
  141. package/dist/quasar.umd.min.js +2 -2
  142. package/dist/quasar.umd.modern.js +3199 -1875
  143. package/dist/quasar.umd.modern.min.js +2 -2
  144. package/dist/transform-asset-urls.json +20 -0
  145. package/dist/types/index.d.ts +427 -105
  146. package/dist/types/utils/scroll.d.ts +1 -0
  147. package/dist/vetur/quasar-attributes.json +320 -92
  148. package/dist/vetur/quasar-tags.json +76 -19
  149. package/dist/web-types/web-types.json +1296 -257
  150. package/icon-set/svg-ionicons-v6.js +225 -0
  151. package/lang/ar.js +1 -1
  152. package/lang/fa-ir.js +3 -1
  153. package/lang/fa.js +3 -1
  154. package/lang/fr.js +1 -1
  155. package/lang/index.json +1 -1
  156. package/lang/kur-ckb.js +2 -2
  157. package/lang/sr.js +4 -4
  158. package/lang/ug.js +48 -46
  159. package/lang/zh-hans.js +1 -1
  160. package/lang/zh-hant.js +18 -18
  161. package/package.json +1 -1
  162. package/src/api.extends.json +1 -2
  163. package/src/components/ajax-bar/QAjaxBar.js +48 -26
  164. package/src/components/ajax-bar/QAjaxBar.json +22 -4
  165. package/src/components/breadcrumbs/QBreadcrumbs.js +15 -11
  166. package/src/components/breadcrumbs/QBreadcrumbs.sass +0 -3
  167. package/src/components/breadcrumbs/QBreadcrumbs.styl +0 -3
  168. package/src/components/breadcrumbs/QBreadcrumbsEl.js +25 -9
  169. package/src/components/btn/QBtn.js +3 -3
  170. package/src/components/btn-dropdown/QBtnDropdown.sass +2 -0
  171. package/src/components/btn-dropdown/QBtnDropdown.styl +2 -0
  172. package/src/components/btn-toggle/QBtnToggle.js +4 -1
  173. package/src/components/carousel/QCarousel.js +6 -2
  174. package/src/components/carousel/QCarousel.json +9 -1
  175. package/src/components/carousel/QCarouselSlide.json +2 -2
  176. package/src/components/chat/QChatMessage.json +1 -1
  177. package/src/components/color/QColor.js +100 -85
  178. package/src/components/color/QColor.json +7 -0
  179. package/src/components/color/QColor.sass +14 -24
  180. package/src/components/color/QColor.styl +14 -24
  181. package/src/components/date/QDate.js +7 -1
  182. package/src/components/date/QDate.sass +2 -0
  183. package/src/components/date/QDate.styl +2 -0
  184. package/src/components/dialog/QDialog.js +8 -4
  185. package/src/components/dialog/QDialog.json +8 -1
  186. package/src/components/drawer/QDrawer.js +16 -15
  187. package/src/components/editor/QEditor.js +2 -2
  188. package/src/components/editor/QEditor.sass +13 -1
  189. package/src/components/editor/QEditor.styl +13 -1
  190. package/src/components/expansion-item/QExpansionItem.js +13 -11
  191. package/src/components/fab/QFab.js +20 -11
  192. package/src/components/fab/QFab.json +35 -0
  193. package/src/components/fab/QFabAction.js +16 -9
  194. package/src/components/fab/QFabAction.json +10 -0
  195. package/src/components/field/QField.js +28 -23
  196. package/src/components/field/__QField.json +72 -8
  197. package/src/components/file/QFile.js +12 -4
  198. package/src/components/file/QFile.sass +4 -3
  199. package/src/components/file/QFile.styl +4 -3
  200. package/src/components/footer/QFooter.js +1 -1
  201. package/src/components/form/QForm.js +1 -1
  202. package/src/components/header/QHeader.js +1 -1
  203. package/src/components/icon/QIcon.js +89 -75
  204. package/src/components/icon/QIcon.sass +2 -2
  205. package/src/components/icon/QIcon.styl +2 -2
  206. package/src/components/img/QImg.json +2 -2
  207. package/src/components/infinite-scroll/QInfiniteScroll.js +49 -36
  208. package/src/components/inner-loading/QInnerLoading.js +54 -22
  209. package/src/components/inner-loading/QInnerLoading.json +29 -0
  210. package/src/components/inner-loading/QInnerLoading.sass +3 -0
  211. package/src/components/inner-loading/QInnerLoading.styl +3 -0
  212. package/src/components/item/QItem.js +9 -15
  213. package/src/components/layout/QLayout.js +49 -0
  214. package/src/components/linear-progress/QLinearProgress.js +6 -2
  215. package/src/components/menu/QMenu.js +5 -1
  216. package/src/components/option-group/QOptionGroup.js +32 -22
  217. package/src/components/option-group/QOptionGroup.json +50 -1
  218. package/src/components/parallax/QParallax.js +3 -0
  219. package/src/components/parallax/QParallax.json +1 -1
  220. package/src/components/popup-edit/QPopupEdit.js +41 -16
  221. package/src/components/popup-edit/QPopupEdit.json +15 -8
  222. package/src/components/range/QRange.js +223 -278
  223. package/src/components/range/QRange.json +11 -122
  224. package/src/components/rating/QRating.js +56 -38
  225. package/src/components/rating/QRating.json +3 -3
  226. package/src/components/rating/QRating.sass +8 -6
  227. package/src/components/rating/QRating.styl +8 -6
  228. package/src/components/resize-observer/QResizeObserver.js +15 -10
  229. package/src/components/scroll-area/QScrollArea.js +342 -126
  230. package/src/components/scroll-area/QScrollArea.json +164 -20
  231. package/src/components/scroll-area/QScrollArea.sass +5 -0
  232. package/src/components/scroll-area/QScrollArea.styl +5 -0
  233. package/src/components/scroll-observer/QScrollObserver.js +12 -7
  234. package/src/components/select/QSelect.js +8 -2
  235. package/src/components/select/QSelect.json +1 -1
  236. package/src/components/separator/QSeparator.js +0 -1
  237. package/src/components/separator/QSeparator.json +1 -1
  238. package/src/components/slider/QSlider.js +97 -140
  239. package/src/components/slider/QSlider.json +1 -122
  240. package/src/components/slider/QSlider.sass +205 -139
  241. package/src/components/slider/QSlider.styl +205 -139
  242. package/src/components/slider/slider-utils.js +468 -123
  243. package/src/components/slider/slider-utils.json +546 -0
  244. package/src/components/stepper/QStepper.js +1 -1
  245. package/src/components/stepper/QStepper.sass +25 -26
  246. package/src/components/stepper/QStepper.styl +25 -26
  247. package/src/components/table/QTable.sass +3 -0
  248. package/src/components/table/QTable.styl +3 -0
  249. package/src/components/tabs/QRouteTab.js +13 -13
  250. package/src/components/tabs/QRouteTab.json +0 -7
  251. package/src/components/tabs/QTab.js +71 -20
  252. package/src/components/tabs/QTabs.js +237 -52
  253. package/src/components/tabs/QTabs.json +8 -0
  254. package/src/components/tabs/QTabs.sass +6 -6
  255. package/src/components/tabs/QTabs.styl +6 -6
  256. package/src/components/time/QTime.js +6 -2
  257. package/src/components/timeline/QTimeline.sass +1 -2
  258. package/src/components/timeline/QTimeline.styl +1 -2
  259. package/src/components/timeline/QTimelineEntry.json +1 -1
  260. package/src/components/tree/QTree.js +10 -6
  261. package/src/components/tree/QTree.json +5 -0
  262. package/src/components/tree/QTree.sass +58 -4
  263. package/src/components/tree/QTree.styl +58 -4
  264. package/src/components/uploader/QUploaderBase.js +15 -19
  265. package/src/components/video/QVideo.js +4 -1
  266. package/src/components/video/QVideo.json +11 -0
  267. package/src/components/virtual-scroll/QVirtualScroll.sass +1 -0
  268. package/src/components/virtual-scroll/QVirtualScroll.styl +1 -0
  269. package/src/css/core/helpers.sass +3 -0
  270. package/src/css/core/helpers.styl +3 -0
  271. package/src/css/core/positioning.sass +5 -0
  272. package/src/css/core/positioning.styl +5 -0
  273. package/src/css/variables.sass +4 -6
  274. package/src/css/variables.styl +4 -6
  275. package/src/directives/Scroll.js +2 -2
  276. package/src/directives/ScrollFire.js +1 -0
  277. package/src/ie-compat/ie.js +13 -13
  278. package/src/install.js +1 -1
  279. package/src/lang.js +7 -4
  280. package/src/mixins/anchor.js +3 -13
  281. package/src/mixins/btn.js +33 -38
  282. package/src/mixins/btn.json +26 -11
  283. package/src/mixins/file.js +27 -5
  284. package/src/mixins/fullscreen.js +16 -4
  285. package/src/mixins/portal.js +10 -10
  286. package/src/mixins/router-link.js +88 -14
  287. package/src/mixins/router-link.json +26 -10
  288. package/src/mixins/validate.js +33 -15
  289. package/src/mixins/virtual-scroll.js +40 -42
  290. package/src/plugins/AppFullscreen.js +41 -16
  291. package/src/plugins/BottomSheet.json +1 -1
  292. package/src/plugins/Cookies.js +1 -1
  293. package/src/plugins/Loading.js +8 -0
  294. package/src/plugins/LoadingBar.js +9 -0
  295. package/src/plugins/LoadingBar.json +1 -1
  296. package/src/plugins/Notify.js +351 -333
  297. package/src/plugins/Notify.json +20 -20
  298. package/src/plugins/Notify.sass +9 -3
  299. package/src/plugins/Notify.styl +9 -3
  300. package/src/utils/clone.js +53 -4
  301. package/src/utils/date.js +134 -69
  302. package/src/utils/dom.js +28 -9
  303. package/src/utils/extend.js +2 -2
  304. package/src/utils/focus-manager.js +8 -10
  305. package/src/utils/global-dialog.js +18 -1
  306. package/src/utils/is.js +2 -2
  307. package/src/utils/morph.js +2 -12
  308. package/src/utils/scroll.js +71 -35
@@ -1,8 +1,6 @@
1
1
  import Vue from 'vue'
2
2
 
3
3
  import {
4
- getRatio,
5
- getModel,
6
4
  SliderMixin,
7
5
  keyCodes
8
6
  } from '../slider/slider-utils.js'
@@ -24,17 +22,10 @@ export default Vue.extend({
24
22
  props: {
25
23
  value: {
26
24
  type: Object,
27
- default: () => ({
28
- min: null,
29
- max: null
30
- }),
31
- validator (val) {
32
- return 'min' in val && 'max' in val
33
- }
25
+ default: () => ({ min: null, max: null }),
26
+ validator: v => 'min' in v && 'max' in v
34
27
  },
35
28
 
36
- name: String,
37
-
38
29
  dragRange: Boolean,
39
30
  dragOnlyRange: Boolean,
40
31
 
@@ -44,190 +35,173 @@ export default Vue.extend({
44
35
  rightLabelTextColor: String,
45
36
 
46
37
  leftLabelValue: [ String, Number ],
47
- rightLabelValue: [ String, Number ]
38
+ rightLabelValue: [ String, Number ],
39
+
40
+ leftThumbColor: String,
41
+ rightThumbColor: String
48
42
  },
49
43
 
50
44
  data () {
45
+ const innerMin = this.__getInnerMin(this.innerMin)
46
+ const innerMax = this.__getInnerMax(this.innerMax)
51
47
  return {
52
48
  model: {
53
- min: this.value.min === null ? this.min : this.value.min,
54
- max: this.value.max === null ? this.max : this.value.max
49
+ min: this.value.min === null ? innerMin : between(this.value.min, innerMin, innerMax),
50
+ max: this.value.max === null ? innerMax : between(this.value.max, innerMin, innerMax)
55
51
  },
56
52
  curMinRatio: 0,
57
53
  curMaxRatio: 0
58
54
  }
59
55
  },
60
56
 
61
- watch: {
62
- 'value.min' (val) {
63
- this.model.min = val === null
64
- ? this.min
65
- : val
66
- },
67
-
68
- 'value.max' (val) {
69
- this.model.max = val === null
70
- ? this.max
71
- : val
57
+ computed: {
58
+ modelMinRatio () {
59
+ return this.__convertModelToRatio(this.model.min)
72
60
  },
73
-
74
- min (value) {
75
- if (this.model.min < value) {
76
- this.model.min = value
77
- }
78
- if (this.model.max < value) {
79
- this.model.max = value
80
- }
61
+ modelMaxRatio () {
62
+ return this.__convertModelToRatio(this.model.max)
81
63
  },
82
64
 
83
- max (value) {
84
- if (this.model.min > value) {
85
- this.model.min = value
86
- }
87
- if (this.model.max > value) {
88
- this.model.max = value
89
- }
90
- }
91
- },
92
-
93
- computed: {
94
65
  ratioMin () {
95
66
  return this.active === true ? this.curMinRatio : this.modelMinRatio
96
67
  },
97
-
98
68
  ratioMax () {
99
69
  return this.active === true ? this.curMaxRatio : this.modelMaxRatio
100
70
  },
101
71
 
102
- modelMinRatio () {
103
- return this.minMaxDiff === 0 ? 0 : (this.model.min - this.min) / this.minMaxDiff
104
- },
105
-
106
- modelMaxRatio () {
107
- return this.minMaxDiff === 0 ? 0 : (this.model.max - this.min) / this.minMaxDiff
108
- },
109
-
110
- trackStyle () {
111
- return {
72
+ selectionBarStyle () {
73
+ const acc = {
112
74
  [ this.positionProp ]: `${100 * this.ratioMin}%`,
113
75
  [ this.sizeProp ]: `${100 * (this.ratioMax - this.ratioMin)}%`
114
76
  }
115
- },
116
-
117
- minThumbStyle () {
118
- return {
119
- [ this.positionProp ]: `${100 * this.ratioMin}%`,
120
- 'z-index': this.__nextFocus === 'min' ? 2 : void 0
77
+ if (this.selectionImg !== void 0) {
78
+ acc.backgroundImage = `url(${this.selectionImg}) !important`
121
79
  }
80
+ return acc
122
81
  },
123
82
 
124
- maxThumbStyle () {
125
- return {
126
- [ this.positionProp ]: `${100 * this.ratioMax}%`
83
+ trackContainerEvents () {
84
+ if (this.editable !== true) {
85
+ return {}
127
86
  }
128
- },
129
87
 
130
- minThumbClass () {
131
- if (this.preventFocus === false && this.focus === 'min') {
132
- return 'q-slider--focus'
88
+ if (this.$q.platform.is.mobile === true) {
89
+ return { click: this.__onMobileClick }
133
90
  }
134
- },
135
91
 
136
- maxThumbClass () {
137
- if (this.preventFocus === false && this.focus === 'max') {
138
- return 'q-slider--focus'
139
- }
140
- },
141
-
142
- events () {
143
- if (this.editable === true) {
144
- if (this.$q.platform.is.mobile === true) {
145
- return { click: this.__mobileClick }
146
- }
92
+ const evt = { mousedown: this.__onActivate }
147
93
 
148
- const evt = { mousedown: this.__activate }
149
-
150
- this.dragOnlyRange === true && Object.assign(evt, {
151
- focus: () => { this.__focus('both') },
152
- blur: this.__blur,
153
- keydown: this.__keydown,
154
- keyup: this.__keyup
94
+ if (this.dragRange === true || this.dragOnlyRange === true) {
95
+ Object.assign(evt, {
96
+ focus: () => { this.focus = 'both' },
97
+ blur: this.__onBlur,
98
+ keydown: this.__onKeydown,
99
+ keyup: this.__onKeyup
155
100
  })
156
-
157
- return evt
158
- }
159
- },
160
-
161
- minEvents () {
162
- if (this.editable === true && this.$q.platform.is.mobile !== true && this.dragOnlyRange !== true) {
163
- return {
164
- focus: () => { this.__focus('min') },
165
- blur: this.__blur,
166
- keydown: this.__keydown,
167
- keyup: this.__keyup
168
- }
169
101
  }
170
- },
171
102
 
172
- maxEvents () {
173
- if (this.editable === true && this.$q.platform.is.mobile !== true && this.dragOnlyRange !== true) {
174
- return {
175
- focus: () => { this.__focus('max') },
176
- blur: this.__blur,
177
- keydown: this.__keydown,
178
- keyup: this.__keyup
179
- }
180
- }
103
+ return evt
181
104
  },
182
105
 
183
- minPinClass () {
184
- const color = this.leftLabelColor || this.labelColor
185
- if (color) {
186
- return `text-${color}`
106
+ trackContainerAttrs () {
107
+ return {
108
+ tabindex: this.$q.platform.is.mobile !== true && (this.dragRange || this.dragOnlyRange === true)
109
+ ? this.computedTabindex
110
+ : null
187
111
  }
188
112
  },
189
113
 
190
- minPinTextClass () {
191
- const color = this.leftLabelTextColor || this.labelTextColor
192
- if (color) {
193
- return `text-${color}`
114
+ thumbAttrs () {
115
+ return {
116
+ tabindex: this.dragOnlyRange !== true ? this.computedTabindex : null
194
117
  }
195
118
  },
196
119
 
197
- maxPinClass () {
198
- const color = this.rightLabelColor || this.labelColor
199
- if (color) {
200
- return `text-${color}`
201
- }
120
+ thumbMinEvents () {
121
+ return this.__getEvents('min')
202
122
  },
203
-
204
- maxPinTextClass () {
205
- const color = this.rightLabelTextColor || this.labelTextColor
206
- if (color) {
207
- return `text-${color}`
208
- }
123
+ thumbMaxEvents () {
124
+ return this.__getEvents('max')
209
125
  },
210
126
 
211
- minLabel () {
127
+ thumbMinLabel () {
212
128
  return this.leftLabelValue !== void 0
213
129
  ? this.leftLabelValue
214
130
  : this.model.min
215
131
  },
216
-
217
- maxLabel () {
132
+ thumbMaxLabel () {
218
133
  return this.rightLabelValue !== void 0
219
134
  ? this.rightLabelValue
220
135
  : this.model.max
221
136
  },
222
137
 
223
- minPinStyle () {
224
- const percent = (this.reverse === true ? -this.ratioMin : this.ratioMin - 1)
225
- return this.__getPinStyle(percent, this.ratioMin)
138
+ thumbMinClasses () {
139
+ const color = this.leftThumbColor || this.thumbColor || this.color
140
+ return `q-slider__thumb q-slider__thumb${this.axis} q-slider__thumb${this.axis}-${this.isReversed === true ? 'rtl' : 'ltr'} absolute non-selectable` +
141
+ (
142
+ this.preventFocus === false && (this.focus === 'min' || this.focus === 'both')
143
+ ? ' q-slider--focus'
144
+ : ''
145
+ ) +
146
+ (color !== void 0 ? ` text-${color}` : '')
147
+ },
148
+ thumbMaxClasses () {
149
+ const color = this.rightThumbColor || this.thumbColor || this.color
150
+ return `q-slider__thumb q-slider__thumb${this.axis} q-slider__thumb${this.axis}-${this.isReversed === true ? 'rtl' : 'ltr'} absolute non-selectable` +
151
+ (
152
+ this.preventFocus === false && (this.focus === 'max' || this.focus === 'both')
153
+ ? ' q-slider--focus'
154
+ : ''
155
+ ) +
156
+ (color !== void 0 ? ` text-${color}` : '')
226
157
  },
227
158
 
228
- maxPinStyle () {
229
- const percent = (this.reverse === true ? -this.ratioMax : this.ratioMax - 1)
230
- return this.__getPinStyle(percent, this.ratioMax)
159
+ thumbMinStyle () {
160
+ return {
161
+ width: this.thumbSize,
162
+ height: this.thumbSize,
163
+ [ this.positionProp ]: `${100 * this.ratioMin}%`,
164
+ zIndex: this.focus === 'min' ? 2 : void 0
165
+ }
166
+ },
167
+ thumbMaxStyle () {
168
+ return {
169
+ width: this.thumbSize,
170
+ height: this.thumbSize,
171
+ [ this.positionProp ]: `${100 * this.ratioMax}%`,
172
+ zIndex: this.focus === 'max' ? 2 : void 0
173
+ }
174
+ },
175
+
176
+ thumbMinPinColor () {
177
+ const color = this.leftLabelColor || this.labelColor
178
+ return color !== void 0
179
+ ? ` text-${color}`
180
+ : ''
181
+ },
182
+ thumbMaxPinColor () {
183
+ const color = this.rightLabelColor || this.labelColor
184
+ return color !== void 0
185
+ ? ` text-${color}`
186
+ : ''
187
+ },
188
+
189
+ thumbMinTextContainerStyle () {
190
+ return this.__getTextContainerStyle(this.ratioMin)
191
+ },
192
+ thumbMaxTextContainerStyle () {
193
+ return this.__getTextContainerStyle(this.ratioMax)
194
+ },
195
+
196
+ thumbMinTextClass () {
197
+ const color = this.leftLabelTextColor || this.labelTextColor
198
+ return 'q-slider__text' +
199
+ (color !== void 0 ? ` text-${color}` : '')
200
+ },
201
+ thumbMaxTextClass () {
202
+ const color = this.rightLabelTextColor || this.labelTextColor
203
+ return 'q-slider__text' +
204
+ (color !== void 0 ? ` text-${color}` : '')
231
205
  },
232
206
 
233
207
  formAttrs () {
@@ -236,15 +210,31 @@ export default Vue.extend({
236
210
  name: this.name,
237
211
  value: `${this.value.min}|${this.value.max}`
238
212
  }
213
+ },
214
+
215
+ modelUpdate () {
216
+ return `${this.value.min}|${this.value.max}|${this.computedInnerMin}|${this.computedInnerMax}`
217
+ }
218
+ },
219
+
220
+ watch: {
221
+ modelUpdate () {
222
+ this.model.min = this.value.min === null
223
+ ? this.computedInnerMin
224
+ : between(this.value.min, this.computedInnerMin, this.computedInnerMax)
225
+
226
+ this.model.max = this.value.max === null
227
+ ? this.computedInnerMax
228
+ : between(this.value.max, this.computedInnerMin, this.computedInnerMax)
239
229
  }
240
230
  },
241
231
 
242
232
  methods: {
243
233
  __updateValue (change) {
244
234
  if (this.model.min !== this.value.min || this.model.max !== this.value.max) {
245
- this.$emit('input', this.model)
235
+ this.$emit('input', { ...this.model })
246
236
  }
247
- change === true && this.$emit('change', this.model)
237
+ change === true && this.$emit('change', { ...this.model })
248
238
  },
249
239
 
250
240
  __getDragging (event) {
@@ -252,9 +242,10 @@ export default Vue.extend({
252
242
  { left, top, width, height } = this.$el.getBoundingClientRect(),
253
243
  sensitivity = this.dragOnlyRange === true
254
244
  ? 0
255
- : (this.vertical === true
256
- ? this.$refs.minThumb.offsetHeight / (2 * height)
257
- : this.$refs.minThumb.offsetWidth / (2 * width)
245
+ : (
246
+ this.vertical === true
247
+ ? this.$refs.minThumb.offsetHeight / (2 * height)
248
+ : this.$refs.minThumb.offsetWidth / (2 * width)
258
249
  )
259
250
 
260
251
  const dragging = {
@@ -268,43 +259,38 @@ export default Vue.extend({
268
259
  ratioMax: this.modelMaxRatio
269
260
  }
270
261
 
271
- const ratio = getRatio(event, dragging, this.isReversed, this.vertical)
272
- let type
262
+ const ratio = this.__getDraggingRatio(event, dragging)
273
263
 
274
264
  if (this.dragOnlyRange !== true && ratio < dragging.ratioMin + sensitivity) {
275
- type = dragType.MIN
265
+ dragging.type = dragType.MIN
276
266
  }
277
267
  else if (this.dragOnlyRange === true || ratio < dragging.ratioMax - sensitivity) {
278
268
  if (this.dragRange === true || this.dragOnlyRange === true) {
279
- type = dragType.RANGE
269
+ dragging.type = dragType.RANGE
280
270
  Object.assign(dragging, {
281
271
  offsetRatio: ratio,
282
- offsetModel: getModel(ratio, this.min, this.max, this.step, this.decimals),
272
+ offsetModel: this.__convertRatioToModel(ratio),
283
273
  rangeValue: dragging.valueMax - dragging.valueMin,
284
274
  rangeRatio: dragging.ratioMax - dragging.ratioMin
285
275
  })
286
276
  }
287
277
  else {
288
- type = dragging.ratioMax - ratio < ratio - dragging.ratioMin
278
+ dragging.type = dragging.ratioMax - ratio < ratio - dragging.ratioMin
289
279
  ? dragType.MAX
290
280
  : dragType.MIN
291
281
  }
292
282
  }
293
283
  else {
294
- type = dragType.MAX
284
+ dragging.type = dragType.MAX
295
285
  }
296
286
 
297
- dragging.type = type
298
- this.__nextFocus = void 0
299
-
300
287
  return dragging
301
288
  },
302
289
 
303
290
  __updatePosition (event, dragging = this.dragging) {
304
- const
305
- ratio = getRatio(event, dragging, this.isReversed, this.vertical),
306
- model = getModel(ratio, this.min, this.max, this.step, this.decimals)
307
291
  let pos
292
+ const ratio = this.__getDraggingRatio(event, dragging)
293
+ const localModel = this.__convertRatioToModel(ratio)
308
294
 
309
295
  switch (dragging.type) {
310
296
  case dragType.MIN:
@@ -312,19 +298,19 @@ export default Vue.extend({
312
298
  pos = {
313
299
  minR: ratio,
314
300
  maxR: dragging.ratioMax,
315
- min: model,
301
+ min: localModel,
316
302
  max: dragging.valueMax
317
303
  }
318
- this.__nextFocus = 'min'
304
+ this.focus = 'min'
319
305
  }
320
306
  else {
321
307
  pos = {
322
308
  minR: dragging.ratioMax,
323
309
  maxR: ratio,
324
310
  min: dragging.valueMax,
325
- max: model
311
+ max: localModel
326
312
  }
327
- this.__nextFocus = 'max'
313
+ this.focus = 'max'
328
314
  }
329
315
  break
330
316
 
@@ -334,18 +320,18 @@ export default Vue.extend({
334
320
  minR: dragging.ratioMin,
335
321
  maxR: ratio,
336
322
  min: dragging.valueMin,
337
- max: model
323
+ max: localModel
338
324
  }
339
- this.__nextFocus = 'max'
325
+ this.focus = 'max'
340
326
  }
341
327
  else {
342
328
  pos = {
343
329
  minR: ratio,
344
330
  maxR: dragging.ratioMin,
345
- min: model,
331
+ min: localModel,
346
332
  max: dragging.valueMin
347
333
  }
348
- this.__nextFocus = 'min'
334
+ this.focus = 'min'
349
335
  }
350
336
  break
351
337
 
@@ -353,44 +339,47 @@ export default Vue.extend({
353
339
  const
354
340
  ratioDelta = ratio - dragging.offsetRatio,
355
341
  minR = between(dragging.ratioMin + ratioDelta, 0, 1 - dragging.rangeRatio),
356
- modelDelta = model - dragging.offsetModel,
342
+ modelDelta = localModel - dragging.offsetModel,
357
343
  min = between(dragging.valueMin + modelDelta, this.min, this.max - dragging.rangeValue)
358
344
 
359
345
  pos = {
360
346
  minR,
361
347
  maxR: minR + dragging.rangeRatio,
362
- min: parseFloat(min.toFixed(this.decimals)),
363
- max: parseFloat((min + dragging.rangeValue).toFixed(this.decimals))
348
+ min: parseFloat(min.toFixed(this.computedDecimals)),
349
+ max: parseFloat((min + dragging.rangeValue).toFixed(this.computedDecimals))
364
350
  }
365
- break
366
- }
367
351
 
368
- this.model = {
369
- min: pos.min,
370
- max: pos.max
352
+ this.focus = 'both'
353
+ break
371
354
  }
372
355
 
373
356
  // If either of the values to be emitted are null, set them to the defaults the user has entered.
374
- if (this.model.min === null || this.model.max === null) {
375
- this.model.min = pos.min || this.min
376
- this.model.max = pos.max || this.max
377
- }
357
+ this.model = this.model.min === null || this.model.max === null
358
+ ? { min: pos.min || this.min, max: pos.max || this.max }
359
+ : { min: pos.min, max: pos.max }
378
360
 
379
361
  if (this.snap !== true || this.step === 0) {
380
362
  this.curMinRatio = pos.minR
381
363
  this.curMaxRatio = pos.maxR
382
364
  }
383
365
  else {
384
- this.curMinRatio = this.minMaxDiff === 0 ? 0 : (this.model.min - this.min) / this.minMaxDiff
385
- this.curMaxRatio = this.minMaxDiff === 0 ? 0 : (this.model.max - this.min) / this.minMaxDiff
366
+ this.curMinRatio = this.__convertModelToRatio(this.model.min)
367
+ this.curMaxRatio = this.__convertModelToRatio(this.model.max)
386
368
  }
387
369
  },
388
370
 
389
- __focus (which) {
390
- this.focus = which
371
+ __getEvents (side) {
372
+ return this.$q.platform.is.mobile !== true && this.editable === true && this.dragOnlyRange !== true
373
+ ? {
374
+ focus: () => { this.focus = side },
375
+ blur: this.__onBlur,
376
+ keydown: this.__onKeydown,
377
+ keyup: this.__onKeyup
378
+ }
379
+ : {}
391
380
  },
392
381
 
393
- __keydown (evt) {
382
+ __onKeydown (evt) {
394
383
  if (!keyCodes.includes(evt.keyCode)) {
395
384
  return
396
385
  }
@@ -398,23 +387,20 @@ export default Vue.extend({
398
387
  stopAndPrevent(evt)
399
388
 
400
389
  const
401
- step = ([34, 33].includes(evt.keyCode) ? 10 : 1) * this.computedStep,
402
- offset = [34, 37, 40].includes(evt.keyCode) ? -step : step
403
-
404
- if (this.dragOnlyRange) {
405
- const interval = this.dragOnlyRange
406
- ? this.model.max - this.model.min
407
- : 0
390
+ stepVal = ([ 34, 33 ].includes(evt.keyCode) ? 10 : 1) * this.computedStep,
391
+ offset = ([ 34, 37, 40 ].includes(evt.keyCode) ? -1 : 1) * (this.isReversed === true ? -1 : 1) * stepVal
408
392
 
393
+ if (this.focus === 'both') {
394
+ const interval = this.model.max - this.model.min
409
395
  const min = between(
410
- parseFloat((this.model.min + offset).toFixed(this.decimals)),
411
- this.min,
412
- this.max - interval
396
+ parseFloat((this.model.min + offset).toFixed(this.computedDecimals)),
397
+ this.computedInnerMin,
398
+ this.computedInnerMax - interval
413
399
  )
414
400
 
415
401
  this.model = {
416
402
  min,
417
- max: parseFloat((min + interval).toFixed(this.decimals))
403
+ max: parseFloat((min + interval).toFixed(this.computedDecimals))
418
404
  }
419
405
  }
420
406
  else if (this.focus === false) {
@@ -425,103 +411,62 @@ export default Vue.extend({
425
411
 
426
412
  this.model = {
427
413
  ...this.model,
428
- [which]: between(
429
- parseFloat((this.model[which] + offset).toFixed(this.decimals)),
430
- which === 'min' ? this.min : this.model.min,
431
- which === 'max' ? this.max : this.model.max
414
+ [ which ]: between(
415
+ parseFloat((this.model[ which ] + offset).toFixed(this.computedDecimals)),
416
+ which === 'min' ? this.computedInnerMin : this.model.min,
417
+ which === 'max' ? this.computedInnerMax : this.model.max
432
418
  )
433
419
  }
434
420
  }
435
421
 
436
422
  this.__updateValue()
437
- },
438
-
439
- __getThumb (h, which) {
440
- const child = [
441
- this.__getThumbSvg(h),
442
- h('div', { staticClass: 'q-slider__focus-ring' })
443
- ]
444
-
445
- if (this.label === true || this.labelAlways === true) {
446
- child.push(
447
- h('div', {
448
- staticClass: `q-slider__pin q-slider__pin${this.axis} absolute`,
449
- style: this[which + 'PinStyle'].pin,
450
- class: this[which + 'PinClass']
451
- }, [
452
- h('div', {
453
- staticClass: `q-slider__pin-text-container q-slider__pin-text-container${this.axis}`,
454
- style: this[which + 'PinStyle'].pinTextContainer
455
- }, [
456
- h('span', {
457
- staticClass: 'q-slider__pin-text',
458
- class: this[which + 'PinTextClass']
459
- }, [
460
- this[which + 'Label']
461
- ])
462
- ])
463
- ]),
464
-
465
- h('div', {
466
- staticClass: `q-slider__arrow q-slider__arrow${this.axis}`,
467
- class: this[which + 'PinClass']
468
- })
469
- )
470
- }
471
-
472
- return h('div', {
473
- ref: which + 'Thumb',
474
- staticClass: `q-slider__thumb-container q-slider__thumb-container${this.axis} absolute non-selectable`,
475
- style: this[which + 'ThumbStyle'],
476
- class: this[which + 'ThumbClass'],
477
- on: this[which + 'Events'],
478
- attrs: { tabindex: this.dragOnlyRange !== true ? this.computedTabindex : null }
479
- }, child)
480
423
  }
481
424
  },
482
425
 
483
426
  render (h) {
484
- const track = [
485
- h('div', {
486
- staticClass: `q-slider__track q-slider__track${this.axis} absolute`,
487
- style: this.trackStyle
488
- })
489
- ]
490
-
491
- this.markers === true && track.push(
492
- h('div', {
493
- staticClass: `q-slider__track-markers q-slider__track-markers${this.axis} absolute-full fit`,
494
- style: this.markerStyle
495
- })
496
- )
497
-
498
- const child = [
499
- h('div', {
500
- staticClass: `q-slider__track-container q-slider__track-container${this.axis} absolute`
501
- }, track),
502
-
503
- this.__getThumb(h, 'min'),
504
- this.__getThumb(h, 'max')
505
- ]
506
-
507
- if (this.name !== void 0 && this.disable !== true) {
508
- this.__injectFormInput(child, 'push')
509
- }
427
+ const content = this.__getContent(h, node => {
428
+ node.push(
429
+ this.__getThumb(h, {
430
+ pinColor: this.thumbMinPinColor,
431
+ textContainerStyle: this.thumbMinTextContainerStyle,
432
+ textClass: this.thumbMinTextClass,
433
+ label: this.thumbMinLabel,
434
+ classes: this.thumbMinClasses,
435
+ style: this.thumbMinStyle,
436
+ nodeData: {
437
+ ref: 'minThumb',
438
+ key: 'tmin',
439
+ on: this.thumbMinEvents,
440
+ attrs: this.thumbAttrs
441
+ }
442
+ }),
443
+
444
+ this.__getThumb(h, {
445
+ pinColor: this.thumbMaxPinColor,
446
+ textContainerStyle: this.thumbMaxTextContainerStyle,
447
+ textClass: this.thumbMaxTextClass,
448
+ label: this.thumbMaxLabel,
449
+ classes: this.thumbMaxClasses,
450
+ style: this.thumbMaxStyle,
451
+ nodeData: {
452
+ key: 'tmax',
453
+ on: this.thumbMaxEvents,
454
+ attrs: this.thumbAttrs
455
+ }
456
+ })
457
+ )
458
+ })
510
459
 
511
460
  return h('div', {
512
- staticClass: this.value.min === null || this.value.max === null
513
- ? 'q-slider--no-value'
514
- : void 0,
461
+ class: 'q-range ' + this.classes + (
462
+ this.value.min === null || this.value.max === null
463
+ ? ' q-slider--no-value'
464
+ : ''
465
+ ),
515
466
  attrs: {
516
- ...this.attrs,
517
- 'aria-valuenow': this.value.min + '|' + this.value.max,
518
- tabindex: this.dragOnlyRange === true && this.$q.platform.is.mobile !== true
519
- ? this.computedTabindex
520
- : null
521
- },
522
- class: this.classes,
523
- on: this.events,
524
- directives: this.panDirectives
525
- }, child)
467
+ ...this.attributes,
468
+ 'aria-valuenow': this.value.min + '|' + this.value.max
469
+ }
470
+ }, content)
526
471
  }
527
472
  })