quasar 2.4.10 → 2.4.11

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 (111) hide show
  1. package/dist/api/LoadingBar.json +7 -0
  2. package/dist/api/Platform.json +171 -0
  3. package/dist/api/QAjaxBar.json +13 -1
  4. package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
  5. package/dist/icon-set/eva-icons.umd.prod.js +1 -1
  6. package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
  7. package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
  8. package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
  9. package/dist/icon-set/line-awesome.umd.prod.js +1 -1
  10. package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
  11. package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
  12. package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
  13. package/dist/icon-set/material-icons.umd.prod.js +1 -1
  14. package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
  15. package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
  16. package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
  17. package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
  18. package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
  19. package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
  20. package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
  21. package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
  22. package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
  23. package/dist/icon-set/svg-ionicons-v6.umd.prod.js +1 -1
  24. package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
  25. package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
  26. package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
  27. package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
  28. package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
  29. package/dist/icon-set/svg-mdi-v4.umd.prod.js +1 -1
  30. package/dist/icon-set/svg-mdi-v5.umd.prod.js +1 -1
  31. package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
  32. package/dist/icon-set/svg-themify.umd.prod.js +1 -1
  33. package/dist/icon-set/themify.umd.prod.js +1 -1
  34. package/dist/lang/ar.umd.prod.js +1 -1
  35. package/dist/lang/az-Latn.umd.prod.js +1 -1
  36. package/dist/lang/bg.umd.prod.js +1 -1
  37. package/dist/lang/bn.umd.prod.js +1 -1
  38. package/dist/lang/ca.umd.prod.js +1 -1
  39. package/dist/lang/cs.umd.prod.js +1 -1
  40. package/dist/lang/da.umd.prod.js +1 -1
  41. package/dist/lang/de.umd.prod.js +1 -1
  42. package/dist/lang/el.umd.prod.js +1 -1
  43. package/dist/lang/en-GB.umd.prod.js +1 -1
  44. package/dist/lang/en-US.umd.prod.js +1 -1
  45. package/dist/lang/eo.umd.prod.js +1 -1
  46. package/dist/lang/es.umd.prod.js +1 -1
  47. package/dist/lang/et.umd.prod.js +1 -1
  48. package/dist/lang/fa-IR.umd.prod.js +1 -1
  49. package/dist/lang/fa.umd.prod.js +1 -1
  50. package/dist/lang/fi.umd.prod.js +1 -1
  51. package/dist/lang/fr.umd.prod.js +1 -1
  52. package/dist/lang/gn.umd.prod.js +1 -1
  53. package/dist/lang/he.umd.prod.js +1 -1
  54. package/dist/lang/hr.umd.prod.js +1 -1
  55. package/dist/lang/hu.umd.prod.js +1 -1
  56. package/dist/lang/id.umd.prod.js +1 -1
  57. package/dist/lang/is.umd.prod.js +1 -1
  58. package/dist/lang/it.umd.prod.js +1 -1
  59. package/dist/lang/ja.umd.prod.js +1 -1
  60. package/dist/lang/km.umd.prod.js +1 -1
  61. package/dist/lang/ko-KR.umd.prod.js +1 -1
  62. package/dist/lang/kur-CKB.umd.prod.js +1 -1
  63. package/dist/lang/lt.umd.prod.js +1 -1
  64. package/dist/lang/lu.umd.prod.js +1 -1
  65. package/dist/lang/lv.umd.prod.js +1 -1
  66. package/dist/lang/ml.umd.prod.js +1 -1
  67. package/dist/lang/ms.umd.prod.js +1 -1
  68. package/dist/lang/my.umd.prod.js +1 -1
  69. package/dist/lang/nb-NO.umd.prod.js +1 -1
  70. package/dist/lang/nl.umd.prod.js +1 -1
  71. package/dist/lang/pl.umd.prod.js +1 -1
  72. package/dist/lang/pt-BR.umd.prod.js +1 -1
  73. package/dist/lang/pt.umd.prod.js +1 -1
  74. package/dist/lang/ro.umd.prod.js +1 -1
  75. package/dist/lang/ru.umd.prod.js +1 -1
  76. package/dist/lang/sk.umd.prod.js +1 -1
  77. package/dist/lang/sl.umd.prod.js +1 -1
  78. package/dist/lang/sr-CYR.umd.prod.js +1 -1
  79. package/dist/lang/sr.umd.prod.js +1 -1
  80. package/dist/lang/sv.umd.prod.js +1 -1
  81. package/dist/lang/ta.umd.prod.js +1 -1
  82. package/dist/lang/th.umd.prod.js +1 -1
  83. package/dist/lang/tr.umd.prod.js +1 -1
  84. package/dist/lang/ug.umd.prod.js +1 -1
  85. package/dist/lang/uk.umd.prod.js +1 -1
  86. package/dist/lang/vi.umd.prod.js +1 -1
  87. package/dist/lang/zh-CN.umd.prod.js +1 -1
  88. package/dist/lang/zh-TW.umd.prod.js +1 -1
  89. package/dist/quasar.cjs.prod.js +2 -2
  90. package/dist/quasar.esm.prod.js +2 -2
  91. package/dist/quasar.sass +1 -1
  92. package/dist/quasar.umd.js +110 -32
  93. package/dist/quasar.umd.prod.js +2 -2
  94. package/dist/ssr-directives/Morph.js +1 -1
  95. package/dist/types/api/validation.d.ts +1 -1
  96. package/dist/types/index.d.ts +136 -4
  97. package/dist/web-types/web-types.json +1 -1
  98. package/package.json +1 -1
  99. package/src/components/ajax-bar/QAjaxBar.js +22 -12
  100. package/src/components/ajax-bar/QAjaxBar.json +16 -1
  101. package/src/components/form/QForm.js +11 -1
  102. package/src/components/infinite-scroll/QInfiniteScroll.js +3 -2
  103. package/src/components/scroll-area/QScrollArea.js +21 -1
  104. package/src/components/tabs/QTabs.js +10 -2
  105. package/src/components/tree/QTree.js +5 -3
  106. package/src/components/virtual-scroll/use-virtual-scroll.js +11 -3
  107. package/src/composables/private/use-field.js +11 -1
  108. package/src/plugins/LoadingBar.js +3 -3
  109. package/src/plugins/LoadingBar.json +8 -0
  110. package/src/plugins/Platform.js +15 -8
  111. package/src/plugins/Platform.json +166 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Quasar Framework v2.4.10
2
+ * Quasar Framework v2.4.11
3
3
  * (c) 2015-present Razvan Stoenescu
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with ui/src/utils/patterns.js
2
2
  export type EmbeddedValidationRule = "date" | "time" | "fulltime" | "timeOrFulltime" | "hexColor" | "hexaColor" | "hexOrHexaColor" | "rgbColor" | "rgbaColor" | "rgbOrRgbaColor" | "hexOrRgbColor" | "hexaOrRgbaColor" | "anyColor";
3
3
 
4
- export type ValidationRule<T = any> = EmbeddedValidationRule | ((value: T) => boolean | string);
4
+ export type ValidationRule<T = any> = EmbeddedValidationRule | ((value: T) => boolean | string | Promise<boolean | string>);
@@ -334,6 +334,10 @@ export interface Loading {
334
334
  }
335
335
 
336
336
  export interface LoadingBar {
337
+ /**
338
+ * Is LoadingBar active?
339
+ */
340
+ isActive: boolean;
337
341
  /**
338
342
  * Notify bar you've started a background activity
339
343
  * @param speed Delay (in milliseconds) between bar progress increments
@@ -884,7 +888,132 @@ export interface Platform {
884
888
  /**
885
889
  * Client browser details (property names depend on browser)
886
890
  */
887
- is: any;
891
+ is: {
892
+ /**
893
+ * Browser name
894
+ */
895
+ name: string;
896
+ /**
897
+ * Platform name
898
+ */
899
+ platform: string;
900
+ /**
901
+ * Detailed browser version
902
+ */
903
+ version?: string;
904
+ /**
905
+ * Major browser version as a number
906
+ */
907
+ versionNumber?: number;
908
+ /**
909
+ * Whether the platform is desktop
910
+ */
911
+ desktop?: boolean;
912
+ /**
913
+ * Whether the platform is mobile
914
+ */
915
+ mobile?: boolean;
916
+ /**
917
+ * Whether the platform is Electron
918
+ */
919
+ electron?: boolean;
920
+ /**
921
+ * Whether the platform is BEX(Browser Extension)
922
+ */
923
+ bex?: boolean;
924
+ /**
925
+ * Whether the platform is Capacitor
926
+ */
927
+ capacitor?: boolean;
928
+ /**
929
+ * Whether the platform is Cordova
930
+ */
931
+ cordova?: boolean;
932
+ /**
933
+ * Whether the platform is a native mobile wrapper
934
+ */
935
+ nativeMobile?: boolean;
936
+ /**
937
+ * Type of the native mobile wrapper
938
+ */
939
+ nativeMobileWrapper?: "cordova" | "capacitor";
940
+ /**
941
+ * Whether the browser is Google Chrome
942
+ */
943
+ chrome?: boolean;
944
+ /**
945
+ * Whether the browser is Firefox
946
+ */
947
+ firefox?: boolean;
948
+ /**
949
+ * Whether the browser is Safari
950
+ */
951
+ safari?: boolean;
952
+ /**
953
+ * Whether the browser is Microsoft Edge (Chromium)
954
+ */
955
+ edgeChromium?: boolean;
956
+ /**
957
+ * Whether the browser is Microsoft Edge Legacy
958
+ */
959
+ edge?: boolean;
960
+ /**
961
+ * Whether the browser is Opera
962
+ */
963
+ opera?: boolean;
964
+ /**
965
+ * Whether the browser is Vivaldi
966
+ */
967
+ vivaldi?: boolean;
968
+ /**
969
+ * Whether the operating system is Windows
970
+ */
971
+ win?: boolean;
972
+ /**
973
+ * Whether the operating system is Linux
974
+ */
975
+ linux?: boolean;
976
+ /**
977
+ * Whether the operating system is Mac OS
978
+ */
979
+ mac?: boolean;
980
+ /**
981
+ * Whether the operating system is Chrome OS
982
+ */
983
+ cros?: boolean;
984
+ /**
985
+ * Whether the operating system is Android
986
+ */
987
+ android?: boolean;
988
+ /**
989
+ * Whether the operating system is iOS
990
+ */
991
+ ios?: boolean;
992
+ /**
993
+ * Whether the operating system is Windows Phone
994
+ */
995
+ winphone?: boolean;
996
+ /**
997
+ * Whether the device is an iPhone
998
+ */
999
+ iphone?: boolean;
1000
+ /**
1001
+ * Whether the device is an iPad
1002
+ */
1003
+ ipad?: boolean;
1004
+ /**
1005
+ * Whether the device is an iPod
1006
+ */
1007
+ ipod?: boolean;
1008
+ /**
1009
+ * Whether the device is a Kindle
1010
+ */
1011
+ kindle?: boolean;
1012
+ /**
1013
+ * Whether the browser is Amazon Silk
1014
+ */
1015
+ silk?: boolean;
1016
+ };
888
1017
  /**
889
1018
  * Client browser detectable properties
890
1019
  */
@@ -1181,17 +1310,20 @@ export interface QAjaxBar extends ComponentPublicInstance<QAjaxBarProps> {
1181
1310
  /**
1182
1311
  * Notify bar you are waiting for a new process to finish
1183
1312
  * @param speed Delay (in milliseconds) between progress auto-increments; If delay is 0 then it disables auto-incrementing
1313
+ * @returns Number of active simultaneous sessions
1184
1314
  */
1185
- start: (speed?: number) => void;
1315
+ start: (speed?: number) => number;
1186
1316
  /**
1187
1317
  * Manually trigger a bar progress increment
1188
1318
  * @param amount Amount (0 < x <= 100) to increment with
1319
+ * @returns Number of active simultaneous sessions
1189
1320
  */
1190
- increment: (amount?: number) => void;
1321
+ increment: (amount?: number) => number;
1191
1322
  /**
1192
1323
  * Notify bar that one process you were waiting has finished
1324
+ * @returns Number of active simultaneous sessions
1193
1325
  */
1194
- stop: () => void;
1326
+ stop: () => number;
1195
1327
  }
1196
1328
 
1197
1329
  export interface QAvatarProps {
@@ -2,7 +2,7 @@
2
2
  "$schema": "",
3
3
  "framework": "vue",
4
4
  "name": "quasar",
5
- "version": "2.4.10",
5
+ "version": "2.4.11",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "types-syntax": "typescript",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar",
3
- "version": "2.4.10",
3
+ "version": "2.4.11",
4
4
  "description": "Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time",
5
5
  "main": "dist/quasar.cjs.prod.js",
6
6
  "module": "dist/quasar.esm.prod.js",
@@ -119,7 +119,7 @@ export default createComponent({
119
119
  const onScreen = ref(false)
120
120
  const animate = ref(true)
121
121
 
122
- let calls = 0, timer, speed
122
+ let sessions = 0, timer, speed
123
123
 
124
124
  const classes = computed(() =>
125
125
  `q-loading-bar q-loading-bar--${ props.position }`
@@ -165,16 +165,17 @@ export default createComponent({
165
165
  const oldSpeed = speed
166
166
  speed = Math.max(0, newSpeed) || 0
167
167
 
168
- calls++
168
+ sessions++
169
169
 
170
- if (calls > 1) {
170
+ if (sessions > 1) {
171
171
  if (oldSpeed === 0 && newSpeed > 0) {
172
172
  planNextStep()
173
173
  }
174
174
  else if (oldSpeed > 0 && newSpeed <= 0) {
175
175
  clearTimeout(timer)
176
176
  }
177
- return
177
+
178
+ return sessions
178
179
  }
179
180
 
180
181
  clearTimeout(timer)
@@ -182,25 +183,32 @@ export default createComponent({
182
183
 
183
184
  progress.value = 0
184
185
 
185
- if (onScreen.value === true) { return }
186
-
187
- onScreen.value = true
188
- animate.value = false
189
186
  timer = setTimeout(() => {
190
187
  animate.value = true
191
188
  newSpeed > 0 && planNextStep()
192
- }, 100)
189
+ }, onScreen.value === true ? 500 : 1)
190
+
191
+ if (onScreen.value !== true) {
192
+ onScreen.value = true
193
+ animate.value = false
194
+ }
195
+
196
+ return sessions
193
197
  }
194
198
 
195
199
  function increment (amount) {
196
- if (calls > 0) {
200
+ if (sessions > 0) {
197
201
  progress.value = inc(progress.value, amount)
198
202
  }
203
+
204
+ return sessions
199
205
  }
200
206
 
201
207
  function stop () {
202
- calls = Math.max(0, calls - 1)
203
- if (calls > 0) { return }
208
+ sessions = Math.max(0, sessions - 1)
209
+ if (sessions > 0) {
210
+ return sessions
211
+ }
204
212
 
205
213
  clearTimeout(timer)
206
214
  emit('stop')
@@ -219,6 +227,8 @@ export default createComponent({
219
227
  else {
220
228
  end()
221
229
  }
230
+
231
+ return sessions
222
232
  }
223
233
 
224
234
  function planNextStep () {
@@ -73,6 +73,11 @@
73
73
  "desc": "Delay (in milliseconds) between progress auto-increments; If delay is 0 then it disables auto-incrementing",
74
74
  "examples": [ 400, 0 ]
75
75
  }
76
+ },
77
+ "returns": {
78
+ "type": "Number",
79
+ "desc": "Number of active simultaneous sessions",
80
+ "__exemption": [ "examples" ]
76
81
  }
77
82
  },
78
83
 
@@ -84,11 +89,21 @@
84
89
  "desc": "Amount (0 < x <= 100) to increment with",
85
90
  "examples": [ 1 ]
86
91
  }
92
+ },
93
+ "returns": {
94
+ "type": "Number",
95
+ "desc": "Number of active simultaneous sessions",
96
+ "__exemption": [ "examples" ]
87
97
  }
88
98
  },
89
99
 
90
100
  "stop": {
91
- "desc": "Notify bar that one process you were waiting has finished"
101
+ "desc": "Notify bar that one process you were waiting has finished",
102
+ "returns": {
103
+ "type": "Number",
104
+ "desc": "Number of active simultaneous sessions",
105
+ "__exemption": [ "examples" ]
106
+ }
92
107
  }
93
108
  }
94
109
  }
@@ -1,4 +1,4 @@
1
- import { h, ref, onMounted, getCurrentInstance, nextTick, provide } from 'vue'
1
+ import { h, ref, onActivated, onDeactivated, onMounted, getCurrentInstance, nextTick, provide } from 'vue'
2
2
 
3
3
  import { createComponent } from '../../utils/private/create.js'
4
4
  import { stopAndPrevent } from '../../utils/event.js'
@@ -161,6 +161,16 @@ export default createComponent({
161
161
  }
162
162
  })
163
163
 
164
+ let shouldActivate = false
165
+
166
+ onDeactivated(() => {
167
+ shouldActivate = true
168
+ })
169
+
170
+ onActivated(() => {
171
+ shouldActivate === true && props.autofocus === true && focus()
172
+ })
173
+
164
174
  onMounted(() => {
165
175
  props.autofocus === true && focus()
166
176
  })
@@ -41,7 +41,6 @@ export default createComponent({
41
41
  const rootRef = ref(null)
42
42
 
43
43
  let index = props.initialIndex || 0
44
- let scrollPos = false
45
44
  let localScrollTarget, poll
46
45
 
47
46
  const classes = computed(() =>
@@ -180,8 +179,10 @@ export default createComponent({
180
179
  watch(() => props.scrollTarget, updateScrollTarget)
181
180
  watch(() => props.debounce, setDebounce)
182
181
 
182
+ let scrollPos = false
183
+
183
184
  onActivated(() => {
184
- if (localScrollTarget && scrollPos !== false) {
185
+ if (scrollPos !== false && localScrollTarget) {
185
186
  setVerticalScrollPosition(localScrollTarget, scrollPos)
186
187
  }
187
188
  })
@@ -1,4 +1,4 @@
1
- import { h, ref, computed, withDirectives, onBeforeUnmount, getCurrentInstance } from 'vue'
1
+ import { h, ref, computed, withDirectives, onActivated, onDeactivated, onBeforeUnmount, getCurrentInstance } from 'vue'
2
2
 
3
3
  import useDark, { useDarkProps } from '../../composables/private/use-dark.js'
4
4
 
@@ -380,6 +380,26 @@ export default createComponent({
380
380
  }
381
381
  })
382
382
 
383
+ let scrollPosition = null
384
+
385
+ onDeactivated(() => {
386
+ scrollPosition = {
387
+ top: scroll.vertical.position.value,
388
+ left: scroll.horizontal.position.value
389
+ }
390
+ })
391
+
392
+ onActivated(() => {
393
+ if (scrollPosition === null) { return }
394
+
395
+ const scrollTarget = targetRef.value
396
+
397
+ if (scrollTarget !== null) {
398
+ setHorizontalScrollPosition(scrollTarget, scrollPosition.left)
399
+ setVerticalScrollPosition(scrollTarget, scrollPosition.top)
400
+ }
401
+ })
402
+
383
403
  onBeforeUnmount(emitScroll.cancel)
384
404
 
385
405
  return () => {
@@ -1,4 +1,4 @@
1
- import { h, ref, computed, watch, nextTick, onBeforeUnmount, onActivated, getCurrentInstance, provide } from 'vue'
1
+ import { h, ref, computed, watch, nextTick, onBeforeUnmount, onActivated, onDeactivated, getCurrentInstance, provide } from 'vue'
2
2
 
3
3
  import QIcon from '../icon/QIcon.js'
4
4
  import QResizeObserver from '../resize-observer/QResizeObserver.js'
@@ -568,7 +568,15 @@ export default createComponent({
568
568
  unwatchRoute !== void 0 && unwatchRoute()
569
569
  })
570
570
 
571
- onActivated(recalculateScroll)
571
+ let shouldActivate = false
572
+
573
+ onDeactivated(() => {
574
+ shouldActivate = true
575
+ })
576
+
577
+ onActivated(() => {
578
+ shouldActivate === true && recalculateScroll()
579
+ })
572
580
 
573
581
  return () => {
574
582
  const child = [
@@ -617,9 +617,11 @@ export default createComponent({
617
617
 
618
618
  if (hasSelection.value) {
619
619
  if (meta.selectable) {
620
- const val = meta.key !== props.selected ? meta.key : null
621
- if (props.noSelectionUnset !== true || val !== null) {
622
- emit('update:selected', val)
620
+ if (props.noSelectionUnset === false) {
621
+ emit('update:selected', meta.key !== props.selected ? meta.key : null)
622
+ }
623
+ else if (meta.key !== props.selected) {
624
+ emit('update:selected', meta.key || null)
623
625
  }
624
626
  }
625
627
  }
@@ -1,4 +1,4 @@
1
- import { h, ref, computed, watch, onActivated, onBeforeMount, onBeforeUnmount, nextTick, getCurrentInstance } from 'vue'
1
+ import { h, ref, computed, watch, onActivated, onDeactivated, onBeforeMount, onBeforeUnmount, nextTick, getCurrentInstance } from 'vue'
2
2
 
3
3
  import debounce from '../../utils/debounce.js'
4
4
  import { noop } from '../../utils/event.js'
@@ -596,9 +596,9 @@ export function useVirtualScroll ({
596
596
  : Math.ceil(scrollViewSize / virtualScrollItemSizeComputed.value)
597
597
 
598
598
  const baseSize = Math.max(
599
- 10,
599
+ 1,
600
600
  view,
601
- Math.ceil(props.virtualScrollSliceSize / multiplier)
601
+ Math.ceil((props.virtualScrollSliceSize > 0 ? props.virtualScrollSliceSize : 10) / multiplier)
602
602
  )
603
603
 
604
604
  virtualScrollSliceSizeComputed.value = {
@@ -691,7 +691,15 @@ export function useVirtualScroll ({
691
691
  setVirtualScrollSize()
692
692
  })
693
693
 
694
+ let shouldActivate = false
695
+
696
+ onDeactivated(() => {
697
+ shouldActivate = true
698
+ })
699
+
694
700
  onActivated(() => {
701
+ if (shouldActivate !== true) { return }
702
+
695
703
  const scrollEl = getVirtualScrollTarget()
696
704
 
697
705
  if (prevScrollStart !== void 0 && scrollEl !== void 0 && scrollEl !== null && scrollEl.nodeType !== 8) {
@@ -1,4 +1,4 @@
1
- import { h, ref, computed, watch, Transition, nextTick, onBeforeUnmount, onMounted, getCurrentInstance } from 'vue'
1
+ import { h, ref, computed, watch, Transition, nextTick, onActivated, onDeactivated, onBeforeUnmount, onMounted, getCurrentInstance } from 'vue'
2
2
 
3
3
  import { isRuntimeSsrPreHydration } from '../../plugins/Platform.js'
4
4
 
@@ -532,6 +532,16 @@ export default function (state) {
532
532
  // expose public methods
533
533
  Object.assign(proxy, { focus, blur })
534
534
 
535
+ let shouldActivate = false
536
+
537
+ onDeactivated(() => {
538
+ shouldActivate = true
539
+ })
540
+
541
+ onActivated(() => {
542
+ shouldActivate === true && props.autofocus === true && proxy.focus()
543
+ })
544
+
535
545
  onMounted(() => {
536
546
  if (isRuntimeSsrPreHydration.value === true && props.for === void 0) {
537
547
  state.targetUid.value = getTargetUid()
@@ -49,11 +49,11 @@ const Plugin = defineReactivePlugin({
49
49
  Object.assign(this, {
50
50
  start (speed) {
51
51
  barRef.value.start(speed)
52
- Plugin.isActive = barRef.value.calls > 0
52
+ Plugin.isActive = true
53
53
  },
54
54
  stop () {
55
- barRef.value.stop()
56
- Plugin.isActive = barRef.value.calls > 0
55
+ const sessions = barRef.value.stop()
56
+ Plugin.isActive = sessions > 0
57
57
  },
58
58
  increment () {
59
59
  barRef.value.increment.apply(null, arguments)
@@ -16,6 +16,14 @@
16
16
  }
17
17
  },
18
18
 
19
+ "props": {
20
+ "isActive": {
21
+ "type": "Boolean",
22
+ "desc": "Is LoadingBar active?",
23
+ "reactive": true
24
+ }
25
+ },
26
+
19
27
  "methods": {
20
28
  "start": {
21
29
  "desc": "Notify bar you've started a background activity",
@@ -1,6 +1,4 @@
1
1
  /* eslint-disable no-useless-escape */
2
- /* eslint-disable no-unused-expressions */
3
- /* eslint-disable no-mixed-operators */
4
2
 
5
3
  import { ref, reactive } from 'vue'
6
4
  import { injectProp } from '../utils/private/inject-obj-prop'
@@ -25,19 +23,15 @@ export let iosEmulated = false
25
23
  export let iosCorrection
26
24
 
27
25
  function getMatch (userAgent, platformMatch) {
28
- const match = /(edge|edga|edgios)\/([\w.]+)/.exec(userAgent)
26
+ const match = /(edg|edge|edga|edgios)\/([\w.]+)/.exec(userAgent)
29
27
  || /(opr)[\/]([\w.]+)/.exec(userAgent)
30
28
  || /(vivaldi)[\/]([\w.]+)/.exec(userAgent)
31
29
  || /(chrome|crios)[\/]([\w.]+)/.exec(userAgent)
32
- || /(iemobile)[\/]([\w.]+)/.exec(userAgent)
33
30
  || /(version)(applewebkit)[\/]([\w.]+).*(safari)[\/]([\w.]+)/.exec(userAgent)
34
31
  || /(webkit)[\/]([\w.]+).*(version)[\/]([\w.]+).*(safari)[\/]([\w.]+)/.exec(userAgent)
35
32
  || /(firefox|fxios)[\/]([\w.]+)/.exec(userAgent)
36
33
  || /(webkit)[\/]([\w.]+)/.exec(userAgent)
37
34
  || /(opera)(?:.*version|)[\/]([\w.]+)/.exec(userAgent)
38
- || /(msie) ([\w.]+)/.exec(userAgent)
39
- || (userAgent.indexOf('trident') >= 0 && /(rv)(?::| )([\w.]+)/.exec(userAgent))
40
- || (userAgent.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(userAgent))
41
35
  || []
42
36
 
43
37
  return {
@@ -60,6 +54,8 @@ function getPlatformMatch (userAgent) {
60
54
  || /(mac)/.exec(userAgent)
61
55
  || /(linux)/.exec(userAgent)
62
56
  || /(cros)/.exec(userAgent)
57
+ // TODO: Remove BlackBerry detection. BlackBerry OS, BlackBerry 10, and BlackBerry PlayBook OS
58
+ // is officially dead as of January 4, 2022 (https://www.blackberry.com/us/en/support/devices/end-of-life)
63
59
  || /(playbook)/.exec(userAgent)
64
60
  || /(bb)/.exec(userAgent)
65
61
  || /(blackberry)/.exec(userAgent)
@@ -151,6 +147,10 @@ function getPlatform (UA) {
151
147
  delete browser[ 'windows phone' ]
152
148
  }
153
149
 
150
+ // TODO: The assumption about WebKit based browsers below is not completely accurate.
151
+ // Google released Blink(a fork of WebKit) engine on April 3, 2013, which is really different than WebKit today.
152
+ // Today, one might want to check for WebKit to deal with its bugs, which is used on all browsers on iOS, and Safari browser on all platforms.
153
+
154
154
  // Chrome, Opera 15+, Vivaldi and Safari are webkit based browsers
155
155
  if (
156
156
  browser.chrome
@@ -167,8 +167,15 @@ function getPlatform (UA) {
167
167
  browser.webkit = true
168
168
  }
169
169
 
170
+ // TODO: (Qv3) rename the terms 'edge' to 'edge legacy'(or remove it) then 'edge chromium' to 'edge' to match with the known up-to-date terms
171
+ // Microsoft Edge is the new Chromium-based browser. Microsoft Edge Legacy is the old EdgeHTML-based browser (EOL: March 9, 2021).
172
+ if (browser.edg) {
173
+ matched.browser = 'edgechromium'
174
+ browser.edgeChromium = true
175
+ }
176
+
170
177
  // Blackberry browsers are marked as Safari on BlackBerry
171
- if (browser.safari && browser.blackberry || browser.bb) {
178
+ if ((browser.safari && browser.blackberry) || browser.bb) {
172
179
  matched.browser = 'blackberry'
173
180
  browser.blackberry = true
174
181
  }