quasar 2.3.4 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/dist/api/BottomSheet.json +1 -1
  2. package/dist/api/Loading.json +2 -6
  3. package/dist/api/Notify.json +5 -5
  4. package/dist/api/QAvatar.json +1 -1
  5. package/dist/api/QBreadcrumbsEl.json +32 -11
  6. package/dist/api/QBtn.json +32 -16
  7. package/dist/api/QBtnDropdown.json +33 -17
  8. package/dist/api/QBtnToggle.json +4 -1
  9. package/dist/api/QCarousel.json +4 -4
  10. package/dist/api/QChatMessage.json +4 -12
  11. package/dist/api/QChip.json +4 -4
  12. package/dist/api/QExpansionItem.json +34 -13
  13. package/dist/api/QFab.json +32 -2
  14. package/dist/api/QFabAction.json +9 -1
  15. package/dist/api/QField.json +1 -0
  16. package/dist/api/QFile.json +1 -0
  17. package/dist/api/QInput.json +1 -0
  18. package/dist/api/QItem.json +31 -10
  19. package/dist/api/QLinearProgress.json +1 -1
  20. package/dist/api/QOptionGroup.json +74 -4
  21. package/dist/api/QPagination.json +4 -4
  22. package/dist/api/QPullToRefresh.json +1 -1
  23. package/dist/api/QRange.json +592 -107
  24. package/dist/api/QRating.json +3 -3
  25. package/dist/api/QRouteTab.json +32 -12
  26. package/dist/api/QSelect.json +4 -7
  27. package/dist/api/QSlider.json +504 -39
  28. package/dist/api/QStep.json +4 -4
  29. package/dist/api/QStepper.json +4 -4
  30. package/dist/api/QTab.json +1 -1
  31. package/dist/api/QTable.json +4 -4
  32. package/dist/api/QTimelineEntry.json +1 -1
  33. package/dist/api/QToggle.json +1 -1
  34. package/dist/api/QTree.json +1 -1
  35. package/dist/api/QUploader.json +16 -2
  36. package/dist/api/QVideo.json +11 -1
  37. package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
  38. package/dist/icon-set/eva-icons.umd.prod.js +1 -1
  39. package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
  40. package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
  41. package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
  42. package/dist/icon-set/line-awesome.umd.prod.js +1 -1
  43. package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
  44. package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
  45. package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
  46. package/dist/icon-set/material-icons.umd.prod.js +1 -1
  47. package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
  48. package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
  49. package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
  50. package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
  51. package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
  52. package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
  53. package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
  54. package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
  55. package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
  56. package/dist/icon-set/svg-ionicons-v6.umd.prod.js +1 -1
  57. package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
  58. package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
  59. package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
  60. package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
  61. package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
  62. package/dist/icon-set/svg-mdi-v4.umd.prod.js +1 -1
  63. package/dist/icon-set/svg-mdi-v5.umd.prod.js +1 -1
  64. package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
  65. package/dist/icon-set/svg-themify.umd.prod.js +1 -1
  66. package/dist/icon-set/themify.umd.prod.js +1 -1
  67. package/dist/lang/ar.umd.prod.js +1 -1
  68. package/dist/lang/az-Latn.umd.prod.js +1 -1
  69. package/dist/lang/bg.umd.prod.js +1 -1
  70. package/dist/lang/bn.umd.prod.js +1 -1
  71. package/dist/lang/ca.umd.prod.js +1 -1
  72. package/dist/lang/cs.umd.prod.js +1 -1
  73. package/dist/lang/da.umd.prod.js +1 -1
  74. package/dist/lang/de.umd.prod.js +1 -1
  75. package/dist/lang/el.umd.prod.js +1 -1
  76. package/dist/lang/en-GB.umd.prod.js +1 -1
  77. package/dist/lang/en-US.umd.prod.js +1 -1
  78. package/dist/lang/eo.umd.prod.js +1 -1
  79. package/dist/lang/es.umd.prod.js +1 -1
  80. package/dist/lang/et.umd.prod.js +1 -1
  81. package/dist/lang/fa-IR.umd.prod.js +1 -1
  82. package/dist/lang/fa.umd.prod.js +1 -1
  83. package/dist/lang/fi.umd.prod.js +1 -1
  84. package/dist/lang/fr.umd.prod.js +1 -1
  85. package/dist/lang/gn.umd.prod.js +1 -1
  86. package/dist/lang/he.umd.prod.js +1 -1
  87. package/dist/lang/hr.umd.prod.js +1 -1
  88. package/dist/lang/hu.umd.prod.js +1 -1
  89. package/dist/lang/id.umd.prod.js +1 -1
  90. package/dist/lang/is.umd.prod.js +1 -1
  91. package/dist/lang/it.umd.prod.js +1 -1
  92. package/dist/lang/ja.umd.prod.js +1 -1
  93. package/dist/lang/km.umd.prod.js +1 -1
  94. package/dist/lang/ko-KR.umd.prod.js +1 -1
  95. package/dist/lang/kur-CKB.umd.prod.js +1 -1
  96. package/dist/lang/lt.umd.prod.js +1 -1
  97. package/dist/lang/lu.umd.prod.js +1 -1
  98. package/dist/lang/lv.umd.prod.js +1 -1
  99. package/dist/lang/ml.umd.prod.js +1 -1
  100. package/dist/lang/ms.umd.prod.js +1 -1
  101. package/dist/lang/nb-NO.umd.prod.js +1 -1
  102. package/dist/lang/nl.umd.prod.js +1 -1
  103. package/dist/lang/pl.umd.prod.js +1 -1
  104. package/dist/lang/pt-BR.umd.prod.js +1 -1
  105. package/dist/lang/pt.umd.prod.js +1 -1
  106. package/dist/lang/ro.umd.prod.js +1 -1
  107. package/dist/lang/ru.umd.prod.js +1 -1
  108. package/dist/lang/sk.umd.prod.js +1 -1
  109. package/dist/lang/sl.umd.prod.js +1 -1
  110. package/dist/lang/sr-CYR.umd.prod.js +1 -1
  111. package/dist/lang/sr.umd.prod.js +1 -1
  112. package/dist/lang/sv.umd.prod.js +1 -1
  113. package/dist/lang/ta.umd.prod.js +1 -1
  114. package/dist/lang/th.umd.prod.js +1 -1
  115. package/dist/lang/tr.umd.prod.js +1 -1
  116. package/dist/lang/ug.umd.prod.js +1 -1
  117. package/dist/lang/uk.umd.prod.js +1 -1
  118. package/dist/lang/vi.umd.prod.js +1 -1
  119. package/dist/lang/zh-CN.umd.prod.js +1 -1
  120. package/dist/lang/zh-TW.umd.prod.js +1 -1
  121. package/dist/quasar.cjs.prod.js +2 -2
  122. package/dist/quasar.css +277 -196
  123. package/dist/quasar.esm.prod.js +2 -2
  124. package/dist/quasar.prod.css +1 -1
  125. package/dist/quasar.rtl.css +344 -275
  126. package/dist/quasar.rtl.prod.css +1 -1
  127. package/dist/quasar.sass +243 -189
  128. package/dist/quasar.umd.js +16670 -16294
  129. package/dist/quasar.umd.prod.js +2 -2
  130. package/dist/ssr-directives/Morph.js +1 -1
  131. package/dist/transforms/loader-asset-urls.json +20 -0
  132. package/dist/types/api/slider.d.ts +46 -0
  133. package/dist/types/api/validation.d.ts +4 -0
  134. package/dist/types/api.d.ts +2 -0
  135. package/dist/types/composables.d.ts +3 -3
  136. package/dist/types/index.d.ts +599 -121
  137. package/dist/types/utils/date.d.ts +2 -1
  138. package/dist/vetur/quasar-attributes.json +254 -82
  139. package/dist/vetur/quasar-tags.json +61 -18
  140. package/dist/web-types/web-types.json +635 -197
  141. package/package.json +1 -1
  142. package/src/api.extends.json +1 -2
  143. package/src/components/breadcrumbs/QBreadcrumbs.js +7 -2
  144. package/src/components/breadcrumbs/QBreadcrumbs.sass +0 -3
  145. package/src/components/breadcrumbs/QBreadcrumbsEl.js +14 -8
  146. package/src/components/btn/QBtn.js +5 -5
  147. package/src/components/btn/use-btn.js +21 -21
  148. package/src/components/btn/use-btn.json +22 -13
  149. package/src/components/btn-toggle/QBtnToggle.json +3 -0
  150. package/src/components/checkbox/use-checkbox.js +1 -1
  151. package/src/components/color/QColor.js +32 -26
  152. package/src/components/color/QColor.sass +10 -23
  153. package/src/components/date/QDate.sass +2 -0
  154. package/src/components/dialog/QDialog.js +7 -5
  155. package/src/components/drawer/QDrawer.js +18 -15
  156. package/src/components/editor/QEditor.js +1 -1
  157. package/src/components/editor/QEditor.sass +10 -1
  158. package/src/components/expansion-item/QExpansionItem.js +4 -1
  159. package/src/components/fab/QFab.js +18 -12
  160. package/src/components/fab/QFab.json +33 -0
  161. package/src/components/fab/QFab.sass +1 -1
  162. package/src/components/fab/QFabAction.js +14 -7
  163. package/src/components/fab/QFabAction.json +10 -0
  164. package/src/components/file/QFile.js +12 -5
  165. package/src/components/file/QFile.sass +4 -2
  166. package/src/components/footer/QFooter.js +1 -1
  167. package/src/components/header/QHeader.js +1 -1
  168. package/src/components/icon/QIcon.js +1 -1
  169. package/src/components/infinite-scroll/QInfiniteScroll.js +4 -5
  170. package/src/components/item/QItem.js +2 -3
  171. package/src/components/linear-progress/QLinearProgress.json +1 -1
  172. package/src/components/menu/QMenu.js +6 -2
  173. package/src/components/option-group/QOptionGroup.js +3 -0
  174. package/src/components/option-group/QOptionGroup.json +48 -2
  175. package/src/components/parallax/QParallax.js +4 -2
  176. package/src/components/popup-edit/QPopupEdit.js +2 -5
  177. package/src/components/radio/QRadio.js +2 -7
  178. package/src/components/range/QRange.js +132 -273
  179. package/src/components/range/QRange.json +11 -121
  180. package/src/components/rating/QRating.json +3 -3
  181. package/src/components/resize-observer/QResizeObserver.js +11 -10
  182. package/src/components/scroll-area/QScrollArea.js +8 -2
  183. package/src/components/scroll-observer/QScrollObserver.js +2 -0
  184. package/src/components/select/QSelect.js +4 -1
  185. package/src/components/slider/QSlider.js +61 -137
  186. package/src/components/slider/QSlider.json +1 -121
  187. package/src/components/slider/QSlider.sass +203 -138
  188. package/src/components/slider/use-slider.js +454 -107
  189. package/src/components/slider/use-slider.json +546 -0
  190. package/src/components/stepper/QStepper.js +3 -3
  191. package/src/components/stepper/QStepper.sass +24 -26
  192. package/src/components/table/QTable.js +26 -46
  193. package/src/components/tabs/QRouteTab.js +1 -2
  194. package/src/components/tabs/QRouteTab.json +0 -7
  195. package/src/components/tabs/QTabs.js +91 -24
  196. package/src/components/tabs/use-tab.js +26 -13
  197. package/src/components/tooltip/QTooltip.js +1 -2
  198. package/src/components/tree/QTree.js +14 -12
  199. package/src/components/uploader/QUploader.json +14 -2
  200. package/src/components/uploader/uploader-core.js +16 -9
  201. package/src/components/video/QVideo.js +4 -1
  202. package/src/components/video/QVideo.json +12 -1
  203. package/src/components/virtual-scroll/QVirtualScroll.sass +1 -0
  204. package/src/components/virtual-scroll/use-virtual-scroll.js +30 -17
  205. package/src/composables/private/use-field.js +18 -20
  206. package/src/composables/private/use-file.js +20 -5
  207. package/src/composables/private/use-form.js +2 -3
  208. package/src/composables/private/use-fullscreen.js +15 -4
  209. package/src/composables/private/use-model-toggle.js +1 -1
  210. package/src/composables/private/use-portal.js +9 -7
  211. package/src/composables/private/use-router-link.js +44 -23
  212. package/src/composables/private/use-router-link.json +26 -10
  213. package/src/composables/private/use-split-attrs.js +4 -4
  214. package/src/composables/private/use-tick.js +7 -14
  215. package/src/composables/private/use-validate.js +21 -15
  216. package/src/composables/private/use-validate.json +1 -0
  217. package/src/css/core/helpers.sass +3 -0
  218. package/src/css/core/positioning.sass +5 -0
  219. package/src/css/variables.sass +4 -6
  220. package/src/directives/ScrollFire.js +1 -0
  221. package/src/icon-set.js +2 -4
  222. package/src/plugins/AppFullscreen.js +70 -53
  223. package/src/plugins/AppVisibility.js +2 -3
  224. package/src/plugins/BottomSheet.js +3 -5
  225. package/src/plugins/Dialog.js +3 -5
  226. package/src/plugins/LoadingBar.js +17 -18
  227. package/src/plugins/Notify.js +296 -295
  228. package/src/plugins/Platform.js +14 -14
  229. package/src/utils/clone.js +53 -4
  230. package/src/utils/date.js +4 -4
  231. package/src/utils/dom.js +2 -2
  232. package/src/utils/open-url.js +2 -2
  233. package/src/utils/patterns.js +1 -0
  234. package/src/utils/private/define-reactive-plugin.js +10 -8
  235. package/src/utils/private/focus-manager.js +8 -10
  236. package/src/utils/private/global-dialog.js +6 -8
  237. package/src/utils/private/inject-obj-prop.js +13 -0
  238. package/src/utils/private/is.js +2 -2
@@ -1,5 +1,5 @@
1
1
  {
2
- "mixins": [ "composables/private/use-form" ],
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
- "label-always": {
141
- "type": "Boolean",
142
- "desc": "Always display the labels",
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
- "tabindex": {
187
- "extends": "tabindex"
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
  }
@@ -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:statics/path/to/some_image.png"
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:statics/path/to/some_image.png"
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:statics/path/to/some_image.png"
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 (now) {
34
- if (now === true || props.debounce === 0 || props.debounce === '0') {
35
- onResize()
33
+ function trigger (immediately) {
34
+ if (immediately === true || props.debounce === 0 || props.debounce === '0') {
35
+ emitEvent()
36
36
  }
37
- else if (!timer) {
38
- timer = setTimeout(onResize, props.debounce)
37
+ else if (timer === null) {
38
+ timer = setTimeout(emitEvent, props.debounce)
39
39
  }
40
40
  }
41
41
 
42
- function onResize () {
43
- timer = void 0
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
- onResize()
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
- onResize()
114
+ emitEvent()
114
115
  }
115
116
  }
116
117
 
@@ -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,
@@ -391,6 +393,7 @@ export default createComponent({
391
393
  style: mainStyle.value
392
394
  }, hMergeSlot(slots.default, [
393
395
  h(QResizeObserver, {
396
+ debounce: 0,
394
397
  onResize: updateScrollSize
395
398
  })
396
399
  ])),
@@ -401,7 +404,10 @@ export default createComponent({
401
404
  })
402
405
  ]),
403
406
 
404
- h(QResizeObserver, { onResize: updateContainer }),
407
+ h(QResizeObserver, {
408
+ debounce: 0,
409
+ onResize: updateContainer
410
+ }),
405
411
 
406
412
  h('div', {
407
413
  class: scroll.vertical.barClass.value,
@@ -55,6 +55,8 @@ export default createComponent({
55
55
  })
56
56
 
57
57
  function emitEvent () {
58
+ clearTimeout(timer)
59
+ cancelAnimationFrame(timer)
58
60
  timer = null
59
61
 
60
62
  const top = Math.max(0, getVerticalScrollPosition(localScrollTarget))
@@ -511,7 +511,10 @@ export default createComponent({
511
511
 
512
512
  targetRef.value !== null && targetRef.value.focus()
513
513
 
514
- if (isDeepEqual(getOptionValue.value(innerValue.value[ 0 ]), optValue) !== true) {
514
+ if (
515
+ innerValue.value.length === 0
516
+ || isDeepEqual(getOptionValue.value(innerValue.value[ 0 ]), optValue) !== true
517
+ ) {
515
518
  emit('update:modelValue', props.emitValue === true ? optValue : opt)
516
519
  }
517
520
  return
@@ -1,26 +1,24 @@
1
1
  import { h, ref, computed, watch, getCurrentInstance } from 'vue'
2
2
 
3
- import { useFormInject, useFormProps, useFormAttrs } from '../../composables/private/use-form.js'
3
+ import { useFormAttrs } from '../../composables/private/use-form.js'
4
4
 
5
5
  import useSlider, {
6
6
  useSliderProps,
7
7
  useSliderEmits,
8
- getRatio,
9
- getModel,
10
8
  keyCodes
11
9
  } from './use-slider.js'
12
10
 
13
11
  import { createComponent } from '../../utils/private/create.js'
14
12
  import { between } from '../../utils/format.js'
15
13
  import { stopAndPrevent } from '../../utils/event.js'
16
- import { hDir } from '../../utils/private/render.js'
14
+
15
+ const getNodeData = () => ({})
17
16
 
18
17
  export default createComponent({
19
18
  name: 'QSlider',
20
19
 
21
20
  props: {
22
21
  ...useSliderProps,
23
- ...useFormProps,
24
22
 
25
23
  modelValue: {
26
24
  required: true,
@@ -36,49 +34,57 @@ export default createComponent({
36
34
  setup (props, { emit }) {
37
35
  const { proxy: { $q } } = getCurrentInstance()
38
36
 
39
- const formAttrs = useFormAttrs(props)
40
- const injectFormInput = useFormInject(formAttrs)
37
+ const { state, methods } = useSlider({
38
+ updateValue, updatePosition, getDragging,
39
+ formAttrs: useFormAttrs(props)
40
+ })
41
41
 
42
42
  const rootRef = ref(null)
43
- const model = ref(props.modelValue === null ? props.min : props.modelValue)
44
43
  const curRatio = ref(0)
44
+ const model = ref(0)
45
45
 
46
- const { state, methods } = useSlider({
47
- updateValue, updatePosition, getDragging
48
- })
46
+ function normalizeModel () {
47
+ model.value = props.modelValue === null
48
+ ? state.innerMin.value
49
+ : between(props.modelValue, state.innerMin.value, state.innerMax.value)
50
+ }
51
+
52
+ watch(
53
+ () => `${ props.modelValue }|${ state.innerMin.value }|${ state.innerMax.value }`,
54
+ normalizeModel
55
+ )
49
56
 
50
- const modelRatio = computed(() => (
51
- state.minMaxDiff.value === 0 ? 0 : (model.value - props.min) / state.minMaxDiff.value
52
- ))
57
+ normalizeModel()
58
+
59
+ const modelRatio = computed(() => methods.convertModelToRatio(model.value))
53
60
  const ratio = computed(() => (state.active.value === true ? curRatio.value : modelRatio.value))
54
61
 
55
- const trackStyle = computed(() => ({
56
- [ state.positionProp.value ]: 0,
57
- [ state.sizeProp.value ]: `${ 100 * ratio.value }%`
58
- }))
59
-
60
- const thumbStyle = computed(() => ({
61
- [ state.positionProp.value ]: `${ 100 * ratio.value }%`
62
- }))
63
-
64
- const thumbClass = computed(() => (
65
- state.preventFocus.value === false && state.focus.value === true
66
- ? ' q-slider--focus'
67
- : ''
68
- ))
69
-
70
- const pinClass = computed(() => (
71
- props.labelColor !== void 0
72
- ? `text-${ props.labelColor }`
73
- : ''
74
- ))
75
-
76
- const pinTextClass = computed(() =>
77
- 'q-slider__pin-value-marker-text'
78
- + (props.labelTextColor !== void 0 ? ` text-${ props.labelTextColor }` : '')
79
- )
62
+ const selectionBarStyle = computed(() => {
63
+ const acc = {
64
+ [ state.positionProp.value ]: `${ 100 * state.innerMinRatio.value }%`,
65
+ [ state.sizeProp.value ]: `${ 100 * (ratio.value - state.innerMinRatio.value) }%`
66
+ }
67
+ if (props.selectionImg !== void 0) {
68
+ acc.backgroundImage = `url(${ props.selectionImg }) !important`
69
+ }
70
+ return acc
71
+ })
72
+
73
+ const getThumb = methods.getThumbRenderFn({
74
+ focusValue: true,
75
+ getNodeData,
76
+ ratio,
77
+ label: computed(() => (
78
+ props.labelValue !== void 0
79
+ ? props.labelValue
80
+ : model.value
81
+ )),
82
+ thumbColor: computed(() => props.thumbColor || props.color),
83
+ labelColor: computed(() => props.labelColor),
84
+ labelTextColor: computed(() => props.labelTextColor)
85
+ })
80
86
 
81
- const events = computed(() => {
87
+ const trackContainerEvents = computed(() => {
82
88
  if (state.editable.value !== true) {
83
89
  return {}
84
90
  }
@@ -94,27 +100,6 @@ export default createComponent({
94
100
  }
95
101
  })
96
102
 
97
- const label = computed(() => (
98
- props.labelValue !== void 0
99
- ? props.labelValue
100
- : model.value
101
- ))
102
-
103
- const pinStyle = computed(() => {
104
- const percent = (props.reverse === true ? -ratio.value : ratio.value - 1)
105
- return methods.getPinStyle(percent, ratio.value)
106
- })
107
-
108
- watch(() => props.modelValue, v => {
109
- model.value = v === null
110
- ? 0
111
- : between(v, props.min, props.max)
112
- })
113
-
114
- watch(() => props.min + props.max, () => {
115
- model.value = between(model.value, props.min, props.max)
116
- })
117
-
118
103
  function updateValue (change) {
119
104
  if (model.value !== props.modelValue) {
120
105
  emit('update:modelValue', model.value)
@@ -127,19 +112,13 @@ export default createComponent({
127
112
  }
128
113
 
129
114
  function updatePosition (event, dragging = state.dragging.value) {
130
- const ratio = getRatio(
131
- event,
132
- dragging,
133
- state.isReversed.value,
134
- props.vertical
135
- )
115
+ const ratio = methods.getDraggingRatio(event, dragging)
116
+
117
+ model.value = methods.convertRatioToModel(ratio)
136
118
 
137
- model.value = getModel(ratio, props.min, props.max, props.step, state.decimals.value)
138
119
  curRatio.value = props.snap !== true || props.step === 0
139
120
  ? ratio
140
- : (
141
- state.minMaxDiff.value === 0 ? 0 : (model.value - props.min) / state.minMaxDiff.value
142
- )
121
+ : methods.convertModelToRatio(model.value)
143
122
  }
144
123
 
145
124
  function onFocus () {
@@ -155,86 +134,31 @@ export default createComponent({
155
134
 
156
135
  const
157
136
  stepVal = ([ 34, 33 ].includes(evt.keyCode) ? 10 : 1) * state.step.value,
158
- offset = [ 34, 37, 40 ].includes(evt.keyCode) ? -stepVal : stepVal
137
+ offset = ([ 34, 37, 40 ].includes(evt.keyCode) ? -1 : 1) * (state.isReversed.value === true ? -1 : 1) * stepVal
159
138
 
160
139
  model.value = between(
161
140
  parseFloat((model.value + offset).toFixed(state.decimals.value)),
162
- props.min,
163
- props.max
141
+ state.innerMin.value,
142
+ state.innerMax.value
164
143
  )
165
144
 
166
145
  updateValue()
167
146
  }
168
147
 
169
148
  return () => {
170
- const child = [
171
- methods.getThumbSvg(),
172
- h('div', { class: 'q-slider__focus-ring' })
173
- ]
174
-
175
- if (props.label === true || props.labelAlways === true) {
176
- child.push(
177
- h('div', {
178
- class: `q-slider__pin q-slider__pin${ state.axis.value } absolute ` + pinClass.value,
179
- style: pinStyle.value.pin
180
- }, [
181
- h('div', {
182
- class: `q-slider__pin-text-container q-slider__pin-text-container${ state.axis.value }`,
183
- style: pinStyle.value.pinTextContainer
184
- }, [
185
- h('span', {
186
- class: 'q-slider__pin-text ' + pinTextClass.value
187
- }, [
188
- label.value
189
- ])
190
- ])
191
- ]),
192
-
193
- h('div', {
194
- class: `q-slider__arrow q-slider__arrow${ state.axis.value } ${ pinClass.value }`
195
- })
196
- )
197
- }
198
-
199
- if (props.name !== void 0 && props.disable !== true) {
200
- injectFormInput(child, 'push')
201
- }
202
-
203
- const track = [
204
- h('div', {
205
- class: `q-slider__track q-slider__track${ state.axis.value } absolute`,
206
- style: trackStyle.value
207
- })
208
- ]
209
-
210
- props.markers !== false && track.push(
211
- h('div', {
212
- class: `q-slider__track-markers q-slider__track-markers${ state.axis.value } absolute-full fit`,
213
- style: state.markerStyle.value
214
- })
149
+ const content = methods.getContent(
150
+ selectionBarStyle,
151
+ state.tabindex,
152
+ trackContainerEvents,
153
+ node => { node.push(getThumb()) }
215
154
  )
216
155
 
217
- const content = [
218
- h('div', {
219
- class: `q-slider__track-container q-slider__track-container${ state.axis.value } absolute`
220
- }, track),
221
-
222
- h('div', {
223
- class: `q-slider__thumb-container q-slider__thumb-container${ state.axis.value } absolute non-selectable` + thumbClass.value,
224
- style: thumbStyle.value
225
- }, child)
226
- ]
227
-
228
- const data = {
156
+ return h('div', {
229
157
  ref: rootRef,
230
158
  class: state.classes.value + (props.modelValue === null ? ' q-slider--no-value' : ''),
231
159
  ...state.attributes.value,
232
- 'aria-valuenow': props.modelValue,
233
- tabindex: state.tabindex.value,
234
- ...events.value
235
- }
236
-
237
- return hDir('div', data, content, 'slide', state.editable.value, () => state.panDirective.value)
160
+ 'aria-valuenow': props.modelValue
161
+ }, content)
238
162
  }
239
163
  }
240
164
  })