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
@@ -10,8 +10,14 @@ import { noop } from '../utils/event.js'
10
10
  import { createGlobalNode } from '../utils/private/global-nodes.js'
11
11
  import { createChildApp } from '../install-quasar.js'
12
12
 
13
- let uid = 0, addNotification
13
+ let uid = 0
14
+
14
15
  const defaults = {}
16
+ const groups = {}
17
+ const notificationsList = {}
18
+ const positionClass = {}
19
+ const emptyRE = /^\s*$/
20
+ const notifRefs = []
15
21
 
16
22
  const positionList = [
17
23
  'top-left', 'top-right',
@@ -54,342 +60,329 @@ const notifTypes = {
54
60
  }
55
61
  }
56
62
 
57
- const groups = {}
58
- const positionClass = {}
59
-
60
- function logError (error, config) {
61
- console.error(`Notify: ${ error }`, config)
62
- return false
63
- }
64
-
65
- function getComponent ($q) {
66
- return createComponent({
67
- name: 'QNotifications',
68
-
69
- // hide App from Vue devtools
70
- devtools: { hide: true },
71
-
72
- setup () {
73
- const notificationsList = {}
74
- const notifRefs = []
75
-
76
- positionList.forEach(pos => {
77
- notificationsList[ pos ] = ref([])
78
-
79
- const
80
- vert = [ 'left', 'center', 'right' ].includes(pos) === true ? 'center' : (pos.indexOf('top') > -1 ? 'top' : 'bottom'),
81
- align = pos.indexOf('left') > -1 ? 'start' : (pos.indexOf('right') > -1 ? 'end' : 'center'),
82
- classes = [ 'left', 'right' ].includes(pos) ? `items-${ pos === 'left' ? 'start' : 'end' } justify-center` : (pos === 'center' ? 'flex-center' : `items-${ align }`)
63
+ function addNotification (config, $q, originalApi) {
64
+ if (!config) {
65
+ return logError('parameter required')
66
+ }
83
67
 
84
- positionClass[ pos ] = `q-notifications__list q-notifications__list--${ vert } fixed column no-wrap ${ classes }`
85
- })
68
+ let Api
69
+ const notif = { textColor: 'white' }
86
70
 
87
- addNotification = (config, originalApi) => {
88
- if (!config) {
89
- return logError('parameter required')
90
- }
71
+ if (config.ignoreDefaults !== true) {
72
+ Object.assign(notif, defaults)
73
+ }
91
74
 
92
- let Api
93
- const notif = { textColor: 'white' }
75
+ if (Object(config) !== config) {
76
+ if (notif.type) {
77
+ Object.assign(notif, notifTypes[ notif.type ])
78
+ }
94
79
 
95
- if (config.ignoreDefaults !== true) {
96
- Object.assign(notif, defaults)
97
- }
80
+ config = { message: config }
81
+ }
98
82
 
99
- if (Object(config) !== config) {
100
- if (notif.type) {
101
- Object.assign(notif, notifTypes[ notif.type ])
102
- }
83
+ Object.assign(notif, notifTypes[ config.type || notif.type ], config)
103
84
 
104
- config = { message: config }
105
- }
85
+ if (typeof notif.icon === 'function') {
86
+ notif.icon = notif.icon($q)
87
+ }
106
88
 
107
- Object.assign(notif, notifTypes[ config.type || notif.type ], config)
89
+ if (!notif.spinner) {
90
+ notif.spinner = false
91
+ }
92
+ else {
93
+ if (notif.spinner === true) {
94
+ notif.spinner = QSpinner
95
+ }
108
96
 
109
- if (typeof notif.icon === 'function') {
110
- notif.icon = notif.icon($q)
111
- }
97
+ notif.spinner = markRaw(notif.spinner)
98
+ }
112
99
 
113
- if (!notif.spinner) {
114
- notif.spinner = false
115
- }
116
- else {
117
- if (notif.spinner === true) {
118
- notif.spinner = QSpinner
119
- }
100
+ notif.meta = {
101
+ hasMedia: Boolean(notif.spinner !== false || notif.icon || notif.avatar),
102
+ hasText: hasContent(notif.message) || hasContent(notif.caption)
103
+ }
120
104
 
121
- notif.spinner = markRaw(notif.spinner)
122
- }
105
+ if (notif.position) {
106
+ if (positionList.includes(notif.position) === false) {
107
+ return logError('wrong position', config)
108
+ }
109
+ }
110
+ else {
111
+ notif.position = 'bottom'
112
+ }
123
113
 
124
- notif.meta = {
125
- hasMedia: Boolean(notif.spinner !== false || notif.icon || notif.avatar),
126
- hasText: Boolean(
127
- (notif.message !== void 0 && notif.message !== null)
128
- || (notif.caption !== void 0 && notif.caption !== null)
129
- )
130
- }
114
+ if (notif.timeout === void 0) {
115
+ notif.timeout = 5000
116
+ }
117
+ else {
118
+ const t = parseInt(notif.timeout, 10)
119
+ if (isNaN(t) || t < 0) {
120
+ return logError('wrong timeout', config)
121
+ }
122
+ notif.timeout = t
123
+ }
131
124
 
132
- if (notif.position) {
133
- if (positionList.includes(notif.position) === false) {
134
- return logError('wrong position', config)
135
- }
136
- }
137
- else {
138
- notif.position = 'bottom'
139
- }
125
+ if (notif.timeout === 0) {
126
+ notif.progress = false
127
+ }
128
+ else if (notif.progress === true) {
129
+ notif.meta.progressClass = 'q-notification__progress' + (
130
+ notif.progressClass
131
+ ? ` ${ notif.progressClass }`
132
+ : ''
133
+ )
134
+
135
+ notif.meta.progressStyle = {
136
+ animationDuration: `${ notif.timeout + 1000 }ms`
137
+ }
138
+ }
140
139
 
141
- if (notif.timeout === void 0) {
142
- notif.timeout = 5000
143
- }
144
- else {
145
- const t = parseInt(notif.timeout, 10)
146
- if (isNaN(t) || t < 0) {
147
- return logError('wrong timeout', config)
148
- }
149
- notif.timeout = t
150
- }
140
+ const actions = (
141
+ Array.isArray(config.actions) === true
142
+ ? config.actions
143
+ : []
144
+ ).concat(
145
+ config.ignoreDefaults !== true && Array.isArray(defaults.actions) === true
146
+ ? defaults.actions
147
+ : []
148
+ ).concat(
149
+ notifTypes[ config.type ] !== void 0 && Array.isArray(notifTypes[ config.type ].actions) === true
150
+ ? notifTypes[ config.type ].actions
151
+ : []
152
+ )
153
+
154
+ const { closeBtn } = notif
155
+ closeBtn && actions.push({
156
+ label: typeof closeBtn === 'string'
157
+ ? closeBtn
158
+ : $q.lang.label.close
159
+ })
151
160
 
152
- if (notif.timeout === 0) {
153
- notif.progress = false
161
+ notif.actions = actions.map(({ handler, noDismiss, ...item }) => ({
162
+ flat: true,
163
+ ...item,
164
+ onClick: typeof handler === 'function'
165
+ ? () => {
166
+ handler()
167
+ noDismiss !== true && dismiss()
154
168
  }
155
- else if (notif.progress === true) {
156
- notif.meta.progressClass = 'q-notification__progress' + (
157
- notif.progressClass
158
- ? ` ${ notif.progressClass }`
159
- : ''
160
- )
169
+ : () => { dismiss() }
170
+ }))
161
171
 
162
- notif.meta.progressStyle = {
163
- animationDuration: `${ notif.timeout + 1000 }ms`
164
- }
165
- }
172
+ if (notif.multiLine === void 0) {
173
+ notif.multiLine = notif.actions.length > 1
174
+ }
166
175
 
167
- const actions = (
168
- Array.isArray(config.actions) === true
169
- ? config.actions
170
- : []
171
- ).concat(
172
- config.ignoreDefaults !== true && Array.isArray(defaults.actions) === true
173
- ? defaults.actions
174
- : []
175
- ).concat(
176
- notifTypes[ config.type ] !== void 0 && Array.isArray(notifTypes[ config.type ].actions) === true
177
- ? notifTypes[ config.type ].actions
178
- : []
179
- )
176
+ Object.assign(notif.meta, {
177
+ class: 'q-notification row items-stretch'
178
+ + ` q-notification--${ notif.multiLine === true ? 'multi-line' : 'standard' }`
179
+ + (notif.color !== void 0 ? ` bg-${ notif.color }` : '')
180
+ + (notif.textColor !== void 0 ? ` text-${ notif.textColor }` : '')
181
+ + (notif.classes !== void 0 ? ` ${ notif.classes }` : ''),
180
182
 
181
- notif.closeBtn && actions.push({
182
- label: typeof notif.closeBtn === 'string'
183
- ? notif.closeBtn
184
- : $q.lang.label.close
185
- })
183
+ wrapperClass: 'q-notification__wrapper col relative-position border-radius-inherit '
184
+ + (notif.multiLine === true ? 'column no-wrap justify-center' : 'row items-center'),
186
185
 
187
- notif.actions = actions.map(({ handler, noDismiss, ...item }) => ({
188
- flat: true,
189
- ...item,
190
- onClick: typeof handler === 'function'
191
- ? () => {
192
- handler()
193
- noDismiss !== true && dismiss()
194
- }
195
- : () => { dismiss() }
196
- }))
186
+ contentClass: 'q-notification__content row items-center'
187
+ + (notif.multiLine === true ? '' : ' col'),
197
188
 
198
- if (notif.multiLine === void 0) {
199
- notif.multiLine = notif.actions.length > 1
200
- }
189
+ leftClass: notif.meta.hasText === true ? 'additional' : 'single',
201
190
 
202
- Object.assign(notif.meta, {
203
- class: 'q-notification row items-stretch'
204
- + ` q-notification--${ notif.multiLine === true ? 'multi-line' : 'standard' }`
205
- + (notif.color !== void 0 ? ` bg-${ notif.color }` : '')
206
- + (notif.textColor !== void 0 ? ` text-${ notif.textColor }` : '')
207
- + (notif.classes !== void 0 ? ` ${ notif.classes }` : ''),
191
+ attrs: {
192
+ role: 'alert',
193
+ ...notif.attrs
194
+ }
195
+ })
208
196
 
209
- wrapperClass: 'q-notification__wrapper col relative-position border-radius-inherit '
210
- + (notif.multiLine === true ? 'column no-wrap justify-center' : 'row items-center'),
197
+ if (notif.group === false) {
198
+ notif.group = void 0
199
+ notif.meta.group = void 0
200
+ }
201
+ else {
202
+ if (notif.group === void 0 || notif.group === true) {
203
+ // do not replace notifications with different buttons
204
+ notif.group = [
205
+ notif.message,
206
+ notif.caption,
207
+ notif.multiline
208
+ ].concat(
209
+ notif.actions.map(props => `${ props.label }*${ props.icon }`)
210
+ ).join('|')
211
+ }
211
212
 
212
- contentClass: 'q-notification__content row items-center'
213
- + (notif.multiLine === true ? '' : ' col'),
213
+ notif.meta.group = notif.group + '|' + notif.position
214
+ }
214
215
 
215
- leftClass: notif.meta.hasText === true ? 'additional' : 'single',
216
+ if (notif.actions.length === 0) {
217
+ notif.actions = void 0
218
+ }
219
+ else {
220
+ notif.meta.actionsClass = 'q-notification__actions row items-center '
221
+ + (notif.multiLine === true ? 'justify-end' : 'col-auto')
222
+ + (notif.meta.hasMedia === true ? ' q-notification__actions--with-media' : '')
223
+ }
216
224
 
217
- attrs: {
218
- role: 'alert',
219
- ...notif.attrs
220
- }
221
- })
225
+ if (originalApi !== void 0) {
226
+ // reset timeout if any
227
+ clearTimeout(originalApi.notif.meta.timer)
222
228
 
223
- if (notif.group === false) {
224
- notif.group = void 0
225
- notif.meta.group = void 0
226
- }
227
- else {
228
- if (notif.group === void 0 || notif.group === true) {
229
- // do not replace notifications with different buttons
230
- notif.group = [
231
- notif.message,
232
- notif.caption,
233
- notif.multiline
234
- ].concat(
235
- notif.actions.map(props => `${ props.label }*${ props.icon }`)
236
- ).join('|')
237
- }
229
+ // retain uid
230
+ notif.meta.uid = originalApi.notif.meta.uid
238
231
 
239
- notif.meta.group = notif.group + '|' + notif.position
240
- }
232
+ // replace notif
233
+ const index = notificationsList[ notif.position ].value.indexOf(originalApi.notif)
234
+ notificationsList[ notif.position ].value[ index ] = notif
235
+ }
236
+ else {
237
+ const original = groups[ notif.meta.group ]
238
+
239
+ // woohoo, it's a new notification
240
+ if (original === void 0) {
241
+ notif.meta.uid = uid++
242
+ notif.meta.badge = 1
243
+
244
+ if ([ 'left', 'right', 'center' ].indexOf(notif.position) !== -1) {
245
+ notificationsList[ notif.position ].value.splice(
246
+ Math.floor(notificationsList[ notif.position ].value.length / 2),
247
+ 0,
248
+ notif
249
+ )
250
+ }
251
+ else {
252
+ const action = notif.position.indexOf('top') > -1 ? 'unshift' : 'push'
253
+ notificationsList[ notif.position ].value[ action ](notif)
254
+ }
241
255
 
242
- if (notif.actions.length === 0) {
243
- notif.actions = void 0
244
- }
245
- else {
246
- notif.meta.actionsClass = 'q-notification__actions row items-center '
247
- + (notif.multiLine === true ? 'justify-end' : 'col-auto')
248
- + (notif.meta.hasMedia === true ? ' q-notification__actions--with-media' : '')
256
+ if (notif.group !== void 0) {
257
+ groups[ notif.meta.group ] = notif
258
+ }
259
+ }
260
+ // ok, so it's NOT a new one
261
+ else {
262
+ // reset timeout if any
263
+ clearTimeout(original.meta.timer)
264
+
265
+ if (notif.badgePosition !== void 0) {
266
+ if (badgePositions.includes(notif.badgePosition) === false) {
267
+ return logError('wrong badgePosition', config)
249
268
  }
269
+ }
270
+ else {
271
+ notif.badgePosition = `top-${ notif.position.indexOf('left') > -1 ? 'right' : 'left' }`
272
+ }
250
273
 
251
- if (originalApi !== void 0) {
252
- // reset timeout if any
253
- clearTimeout(originalApi.notif.meta.timer)
274
+ notif.meta.uid = original.meta.uid
275
+ notif.meta.badge = original.meta.badge + 1
276
+ notif.meta.badgeClass = `q-notification__badge q-notification__badge--${ notif.badgePosition }`
277
+ + (notif.badgeColor !== void 0 ? ` bg-${ notif.badgeColor }` : '')
278
+ + (notif.badgeTextColor !== void 0 ? ` text-${ notif.badgeTextColor }` : '')
279
+ + (notif.badgeClass ? ` ${ notif.badgeClass }` : '')
254
280
 
255
- // retain uid
256
- notif.meta.uid = originalApi.notif.meta.uid
281
+ const index = notificationsList[ notif.position ].value.indexOf(original)
282
+ notificationsList[ notif.position ].value[ index ] = groups[ notif.meta.group ] = notif
283
+ }
284
+ }
257
285
 
258
- // replace notif
259
- const index = notificationsList[ notif.position ].value.indexOf(originalApi.notif)
260
- notificationsList[ notif.position ].value[ index ] = notif
261
- }
262
- else {
263
- const original = groups[ notif.meta.group ]
264
-
265
- // woohoo, it's a new notification
266
- if (original === void 0) {
267
- notif.meta.uid = uid++
268
- notif.meta.badge = 1
269
-
270
- if ([ 'left', 'right', 'center' ].indexOf(notif.position) !== -1) {
271
- notificationsList[ notif.position ].value.splice(
272
- Math.floor(notificationsList[ notif.position ].value.length / 2),
273
- 0,
274
- notif
275
- )
276
- }
277
- else {
278
- const action = notif.position.indexOf('top') > -1 ? 'unshift' : 'push'
279
- notificationsList[ notif.position ].value[ action ](notif)
280
- }
286
+ const dismiss = () => {
287
+ removeNotification(notif)
288
+ Api = void 0
289
+ }
281
290
 
282
- if (notif.group !== void 0) {
283
- groups[ notif.meta.group ] = notif
284
- }
285
- }
286
- // ok, so it's NOT a new one
287
- else {
288
- // reset timeout if any
289
- clearTimeout(original.meta.timer)
290
-
291
- if (notif.badgePosition !== void 0) {
292
- if (badgePositions.includes(notif.badgePosition) === false) {
293
- return logError('wrong badgePosition', config)
294
- }
295
- }
296
- else {
297
- notif.badgePosition = `top-${ notif.position.indexOf('left') > -1 ? 'right' : 'left' }`
298
- }
291
+ if (notif.timeout > 0) {
292
+ notif.meta.timer = setTimeout(() => {
293
+ dismiss()
294
+ }, notif.timeout + /* show duration */ 1000)
295
+ }
299
296
 
300
- notif.meta.uid = original.meta.uid
301
- notif.meta.badge = original.meta.badge + 1
302
- notif.meta.badgeClass = `q-notification__badge q-notification__badge--${ notif.badgePosition }`
303
- + (notif.badgeColor !== void 0 ? ` bg-${ notif.badgeColor }` : '')
304
- + (notif.badgeTextColor !== void 0 ? ` text-${ notif.badgeTextColor }` : '')
305
- + (notif.badgeClass ? ` ${ notif.badgeClass }` : '')
297
+ // only non-groupable can be updated
298
+ if (notif.group !== void 0) {
299
+ return props => {
300
+ if (props !== void 0) {
301
+ logError('trying to update a grouped one which is forbidden', config)
302
+ }
303
+ else {
304
+ dismiss()
305
+ }
306
+ }
307
+ }
306
308
 
307
- const index = notificationsList[ notif.position ].value.indexOf(original)
308
- notificationsList[ notif.position ].value[ index ] = groups[ notif.meta.group ] = notif
309
- }
310
- }
309
+ Api = {
310
+ dismiss,
311
+ config,
312
+ notif
313
+ }
311
314
 
312
- const dismiss = () => {
313
- remove(notif)
314
- Api = void 0
315
- }
315
+ if (originalApi !== void 0) {
316
+ Object.assign(originalApi, Api)
317
+ return
318
+ }
316
319
 
317
- if (notif.timeout > 0) {
318
- notif.meta.timer = setTimeout(() => {
319
- dismiss()
320
- }, notif.timeout + /* show duration */ 1000)
321
- }
320
+ return props => {
321
+ // if notification wasn't previously dismissed
322
+ if (Api !== void 0) {
323
+ // if no params, then we must dismiss the notification
324
+ if (props === void 0) {
325
+ Api.dismiss()
326
+ }
327
+ // otherwise we're updating it
328
+ else {
329
+ const newNotif = Object.assign({}, Api.config, props, {
330
+ group: false,
331
+ position: notif.position
332
+ })
322
333
 
323
- // only non-groupable can be updated
324
- if (notif.group !== void 0) {
325
- return props => {
326
- if (props !== void 0) {
327
- logError('trying to update a grouped one which is forbidden', config)
328
- }
329
- else {
330
- dismiss()
331
- }
332
- }
333
- }
334
+ addNotification(newNotif, $q, Api)
335
+ }
336
+ }
337
+ }
338
+ }
334
339
 
335
- Api = {
336
- dismiss,
337
- config,
338
- notif
339
- }
340
+ function removeNotification (notif) {
341
+ clearTimeout(notif.meta.timer)
340
342
 
341
- if (originalApi !== void 0) {
342
- Object.assign(originalApi, Api)
343
- return
344
- }
343
+ const index = notificationsList[ notif.position ].value.indexOf(notif)
344
+ if (index !== -1) {
345
+ if (notif.group !== void 0) {
346
+ delete groups[ notif.meta.group ]
347
+ }
345
348
 
346
- return props => {
347
- // if notification wasn't previously dismissed
348
- if (Api !== void 0) {
349
- // if no params, then we must dismiss the notification
350
- if (props === void 0) {
351
- Api.dismiss()
352
- }
353
- // otherwise we're updating it
354
- else {
355
- const newNotif = Object.assign({}, Api.config, props, {
356
- group: false,
357
- position: notif.position
358
- })
349
+ const el = notifRefs[ '' + notif.meta.uid ]
359
350
 
360
- addNotification(newNotif, Api)
361
- }
362
- }
363
- }
364
- }
351
+ if (el) {
352
+ const { width, height } = getComputedStyle(el)
365
353
 
366
- function remove (notif) {
367
- clearTimeout(notif.meta.timer)
354
+ el.style.left = `${ el.offsetLeft }px`
355
+ el.style.width = width
356
+ el.style.height = height
357
+ }
368
358
 
369
- const index = notificationsList[ notif.position ].value.indexOf(notif)
370
- if (index !== -1) {
371
- if (notif.group !== void 0) {
372
- delete groups[ notif.meta.group ]
373
- }
359
+ notificationsList[ notif.position ].value.splice(index, 1)
374
360
 
375
- const el = notifRefs[ '' + notif.meta.uid ]
361
+ if (typeof notif.onDismiss === 'function') {
362
+ notif.onDismiss()
363
+ }
364
+ }
365
+ }
376
366
 
377
- if (el) {
378
- const { width, height } = getComputedStyle(el)
367
+ function hasContent (str) {
368
+ return str !== void 0
369
+ && str !== null
370
+ && emptyRE.test(str) !== true
371
+ }
379
372
 
380
- el.style.left = `${ el.offsetLeft }px`
381
- el.style.width = width
382
- el.style.height = height
383
- }
373
+ function logError (error, config) {
374
+ console.error(`Notify: ${ error }`, config)
375
+ return false
376
+ }
384
377
 
385
- notificationsList[ notif.position ].value.splice(index, 1)
378
+ function getComponent () {
379
+ return createComponent({
380
+ name: 'QNotifications',
386
381
 
387
- if (typeof notif.onDismiss === 'function') {
388
- notif.onDismiss()
389
- }
390
- }
391
- }
382
+ // hide App from Vue devtools
383
+ devtools: { hide: true },
392
384
 
385
+ setup () {
393
386
  return () => h('div', { class: 'q-notifications' }, positionList.map(pos => {
394
387
  return h(TransitionGroup, {
395
388
  key: pos,
@@ -489,12 +482,6 @@ function getComponent ($q) {
489
482
  }
490
483
 
491
484
  export default {
492
- create (opts) {
493
- return __QUASAR_SSR_SERVER__
494
- ? noop
495
- : addNotification(opts)
496
- },
497
-
498
485
  setDefaults (opts) {
499
486
  if (__QUASAR_SSR_SERVER__ !== true) {
500
487
  opts === Object(opts) && Object.assign(defaults, opts)
@@ -508,7 +495,10 @@ export default {
508
495
  },
509
496
 
510
497
  install ({ $q, parentApp }) {
511
- $q.notify = this.create
498
+ $q.notify = this.create = __QUASAR_SSR_SERVER__
499
+ ? noop
500
+ : opts => addNotification(opts, $q)
501
+
512
502
  $q.notify.setDefaults = this.setDefaults
513
503
  $q.notify.registerType = this.registerType
514
504
 
@@ -517,8 +507,19 @@ export default {
517
507
  }
518
508
 
519
509
  if (__QUASAR_SSR_SERVER__ !== true && this.__installed !== true) {
510
+ positionList.forEach(pos => {
511
+ notificationsList[ pos ] = ref([])
512
+
513
+ const
514
+ vert = [ 'left', 'center', 'right' ].includes(pos) === true ? 'center' : (pos.indexOf('top') > -1 ? 'top' : 'bottom'),
515
+ align = pos.indexOf('left') > -1 ? 'start' : (pos.indexOf('right') > -1 ? 'end' : 'center'),
516
+ classes = [ 'left', 'right' ].includes(pos) ? `items-${ pos === 'left' ? 'start' : 'end' } justify-center` : (pos === 'center' ? 'flex-center' : `items-${ align }`)
517
+
518
+ positionClass[ pos ] = `q-notifications__list q-notifications__list--${ vert } fixed column no-wrap ${ classes }`
519
+ })
520
+
520
521
  const el = createGlobalNode('q-notify')
521
- createChildApp(getComponent($q), parentApp).mount(el)
522
+ createChildApp(getComponent(), parentApp).mount(el)
522
523
  }
523
524
  }
524
525
  }