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.
- package/dist/api/BottomSheet.json +2 -2
- package/dist/api/Loading.json +0 -2
- package/dist/api/LoadingBar.json +1 -1
- package/dist/api/Notify.json +25 -25
- package/dist/api/QAjaxBar.json +23 -4
- package/dist/api/QAvatar.json +1 -1
- package/dist/api/QBreadcrumbsEl.json +32 -11
- package/dist/api/QBtn.json +35 -14
- package/dist/api/QBtnDropdown.json +36 -15
- package/dist/api/QBtnToggle.json +1 -1
- package/dist/api/QCarousel.json +7 -7
- package/dist/api/QCarouselSlide.json +2 -2
- package/dist/api/QChatMessage.json +1 -5
- package/dist/api/QChip.json +4 -4
- package/dist/api/QColor.json +6 -0
- package/dist/api/QDialog.json +7 -1
- package/dist/api/QExpansionItem.json +34 -13
- package/dist/api/QFab.json +34 -2
- package/dist/api/QFabAction.json +9 -1
- package/dist/api/QField.json +80 -6
- package/dist/api/QFile.json +80 -6
- package/dist/api/QImg.json +2 -2
- package/dist/api/QInnerLoading.json +32 -0
- package/dist/api/QInput.json +82 -6
- package/dist/api/QItem.json +31 -10
- package/dist/api/QOptionGroup.json +58 -1
- package/dist/api/QPagination.json +4 -4
- package/dist/api/QParallax.json +1 -1
- package/dist/api/QPopupEdit.json +14 -7
- package/dist/api/QPullToRefresh.json +1 -1
- package/dist/api/QRange.json +581 -96
- package/dist/api/QRating.json +3 -3
- package/dist/api/QRouteTab.json +32 -12
- package/dist/api/QScrollArea.json +188 -20
- package/dist/api/QSelect.json +82 -10
- package/dist/api/QSeparator.json +1 -1
- package/dist/api/QSlider.json +499 -34
- package/dist/api/QStep.json +4 -4
- package/dist/api/QStepper.json +4 -4
- package/dist/api/QTab.json +1 -1
- package/dist/api/QTable.json +4 -4
- package/dist/api/QTabs.json +9 -0
- package/dist/api/QTimelineEntry.json +2 -2
- package/dist/api/QToggle.json +1 -1
- package/dist/api/QTree.json +7 -1
- package/dist/api/QVideo.json +10 -0
- package/dist/icon-set/bootstrap-icons.umd.min.js +1 -1
- package/dist/icon-set/eva-icons.umd.min.js +1 -1
- package/dist/icon-set/fontawesome-v5-pro.umd.min.js +1 -1
- package/dist/icon-set/fontawesome-v5.umd.min.js +1 -1
- package/dist/icon-set/ionicons-v4.umd.min.js +1 -1
- package/dist/icon-set/line-awesome.umd.min.js +1 -1
- package/dist/icon-set/material-icons-outlined.umd.min.js +1 -1
- package/dist/icon-set/material-icons-round.umd.min.js +1 -1
- package/dist/icon-set/material-icons-sharp.umd.min.js +1 -1
- package/dist/icon-set/material-icons.umd.min.js +1 -1
- package/dist/icon-set/mdi-v3.umd.min.js +1 -1
- package/dist/icon-set/mdi-v4.umd.min.js +1 -1
- package/dist/icon-set/mdi-v5.umd.min.js +1 -1
- package/dist/icon-set/mdi-v6.umd.min.js +1 -1
- package/dist/icon-set/svg-bootstrap-icons.umd.min.js +1 -1
- package/dist/icon-set/svg-eva-icons.umd.min.js +1 -1
- package/dist/icon-set/svg-fontawesome-v5.umd.min.js +1 -1
- package/dist/icon-set/svg-ionicons-v4.umd.min.js +1 -1
- package/dist/icon-set/svg-ionicons-v5.umd.min.js +1 -1
- package/dist/icon-set/svg-ionicons-v6.umd.min.js +6 -0
- package/dist/icon-set/svg-line-awesome.umd.min.js +1 -1
- package/dist/icon-set/svg-material-icons-outlined.umd.min.js +1 -1
- package/dist/icon-set/svg-material-icons-round.umd.min.js +1 -1
- package/dist/icon-set/svg-material-icons-sharp.umd.min.js +1 -1
- package/dist/icon-set/svg-material-icons.umd.min.js +1 -1
- package/dist/icon-set/svg-mdi-v4.umd.min.js +1 -1
- package/dist/icon-set/svg-mdi-v5.umd.min.js +1 -1
- package/dist/icon-set/svg-mdi-v6.umd.min.js +1 -1
- package/dist/icon-set/svg-themify.umd.min.js +1 -1
- package/dist/icon-set/themify.umd.min.js +1 -1
- package/dist/lang/ar.umd.min.js +2 -2
- package/dist/lang/az-latn.umd.min.js +1 -1
- package/dist/lang/bg.umd.min.js +1 -1
- package/dist/lang/ca.umd.min.js +1 -1
- package/dist/lang/cs.umd.min.js +1 -1
- package/dist/lang/da.umd.min.js +1 -1
- package/dist/lang/de.umd.min.js +1 -1
- package/dist/lang/el.umd.min.js +1 -1
- package/dist/lang/en-gb.umd.min.js +1 -1
- package/dist/lang/en-us.umd.min.js +1 -1
- package/dist/lang/eo.umd.min.js +1 -1
- package/dist/lang/es.umd.min.js +1 -1
- package/dist/lang/et.umd.min.js +1 -1
- package/dist/lang/fa-ir.umd.min.js +1 -1
- package/dist/lang/fa.umd.min.js +1 -1
- package/dist/lang/fi.umd.min.js +1 -1
- package/dist/lang/fr.umd.min.js +2 -2
- package/dist/lang/gn.umd.min.js +1 -1
- package/dist/lang/he.umd.min.js +1 -1
- package/dist/lang/hr.umd.min.js +1 -1
- package/dist/lang/hu.umd.min.js +1 -1
- package/dist/lang/id.umd.min.js +1 -1
- package/dist/lang/is.umd.min.js +1 -1
- package/dist/lang/it.umd.min.js +1 -1
- package/dist/lang/ja.umd.min.js +1 -1
- package/dist/lang/km.umd.min.js +1 -1
- package/dist/lang/ko-kr.umd.min.js +1 -1
- package/dist/lang/kur-ckb.umd.min.js +1 -1
- package/dist/lang/lu.umd.min.js +1 -1
- package/dist/lang/lv.umd.min.js +1 -1
- package/dist/lang/ml.umd.min.js +1 -1
- package/dist/lang/ms.umd.min.js +1 -1
- package/dist/lang/nb-no.umd.min.js +1 -1
- package/dist/lang/nl.umd.min.js +1 -1
- package/dist/lang/pl.umd.min.js +1 -1
- package/dist/lang/pt-br.umd.min.js +1 -1
- package/dist/lang/pt.umd.min.js +1 -1
- package/dist/lang/ro.umd.min.js +1 -1
- package/dist/lang/ru.umd.min.js +1 -1
- package/dist/lang/sk.umd.min.js +1 -1
- package/dist/lang/sl.umd.min.js +1 -1
- package/dist/lang/sr.umd.min.js +2 -2
- package/dist/lang/sv.umd.min.js +1 -1
- package/dist/lang/ta.umd.min.js +1 -1
- package/dist/lang/th.umd.min.js +1 -1
- package/dist/lang/tr.umd.min.js +1 -1
- package/dist/lang/ug.umd.min.js +2 -2
- package/dist/lang/uk.umd.min.js +1 -1
- package/dist/lang/vi.umd.min.js +1 -1
- package/dist/lang/zh-hans.umd.min.js +2 -2
- package/dist/lang/zh-hant.umd.min.js +2 -2
- package/dist/quasar.addon.css +1 -1
- package/dist/quasar.addon.rtl.css +1 -1
- package/dist/quasar.common.js +2 -2
- package/dist/quasar.css +380 -227
- package/dist/quasar.esm.js +2 -2
- package/dist/quasar.ie.polyfills.js +1 -1
- package/dist/quasar.ie.polyfills.umd.min.js +1 -1
- package/dist/quasar.min.css +1 -1
- package/dist/quasar.rtl.css +512 -303
- package/dist/quasar.rtl.min.css +1 -1
- package/dist/quasar.sass +328 -210
- package/dist/quasar.styl +328 -210
- package/dist/quasar.umd.js +3244 -1894
- package/dist/quasar.umd.min.js +2 -2
- package/dist/quasar.umd.modern.js +3199 -1875
- package/dist/quasar.umd.modern.min.js +2 -2
- package/dist/transform-asset-urls.json +20 -0
- package/dist/types/index.d.ts +427 -105
- package/dist/types/utils/scroll.d.ts +1 -0
- package/dist/vetur/quasar-attributes.json +320 -92
- package/dist/vetur/quasar-tags.json +76 -19
- package/dist/web-types/web-types.json +1296 -257
- package/icon-set/svg-ionicons-v6.js +225 -0
- package/lang/ar.js +1 -1
- package/lang/fa-ir.js +3 -1
- package/lang/fa.js +3 -1
- package/lang/fr.js +1 -1
- package/lang/index.json +1 -1
- package/lang/kur-ckb.js +2 -2
- package/lang/sr.js +4 -4
- package/lang/ug.js +48 -46
- package/lang/zh-hans.js +1 -1
- package/lang/zh-hant.js +18 -18
- package/package.json +1 -1
- package/src/api.extends.json +1 -2
- package/src/components/ajax-bar/QAjaxBar.js +48 -26
- package/src/components/ajax-bar/QAjaxBar.json +22 -4
- package/src/components/breadcrumbs/QBreadcrumbs.js +15 -11
- package/src/components/breadcrumbs/QBreadcrumbs.sass +0 -3
- package/src/components/breadcrumbs/QBreadcrumbs.styl +0 -3
- package/src/components/breadcrumbs/QBreadcrumbsEl.js +25 -9
- package/src/components/btn/QBtn.js +3 -3
- package/src/components/btn-dropdown/QBtnDropdown.sass +2 -0
- package/src/components/btn-dropdown/QBtnDropdown.styl +2 -0
- package/src/components/btn-toggle/QBtnToggle.js +4 -1
- package/src/components/carousel/QCarousel.js +6 -2
- package/src/components/carousel/QCarousel.json +9 -1
- package/src/components/carousel/QCarouselSlide.json +2 -2
- package/src/components/chat/QChatMessage.json +1 -1
- package/src/components/color/QColor.js +100 -85
- package/src/components/color/QColor.json +7 -0
- package/src/components/color/QColor.sass +14 -24
- package/src/components/color/QColor.styl +14 -24
- package/src/components/date/QDate.js +7 -1
- package/src/components/date/QDate.sass +2 -0
- package/src/components/date/QDate.styl +2 -0
- package/src/components/dialog/QDialog.js +8 -4
- package/src/components/dialog/QDialog.json +8 -1
- package/src/components/drawer/QDrawer.js +16 -15
- package/src/components/editor/QEditor.js +2 -2
- package/src/components/editor/QEditor.sass +13 -1
- package/src/components/editor/QEditor.styl +13 -1
- package/src/components/expansion-item/QExpansionItem.js +13 -11
- package/src/components/fab/QFab.js +20 -11
- package/src/components/fab/QFab.json +35 -0
- package/src/components/fab/QFabAction.js +16 -9
- package/src/components/fab/QFabAction.json +10 -0
- package/src/components/field/QField.js +28 -23
- package/src/components/field/__QField.json +72 -8
- package/src/components/file/QFile.js +12 -4
- package/src/components/file/QFile.sass +4 -3
- package/src/components/file/QFile.styl +4 -3
- package/src/components/footer/QFooter.js +1 -1
- package/src/components/form/QForm.js +1 -1
- package/src/components/header/QHeader.js +1 -1
- package/src/components/icon/QIcon.js +89 -75
- package/src/components/icon/QIcon.sass +2 -2
- package/src/components/icon/QIcon.styl +2 -2
- package/src/components/img/QImg.json +2 -2
- package/src/components/infinite-scroll/QInfiniteScroll.js +49 -36
- package/src/components/inner-loading/QInnerLoading.js +54 -22
- package/src/components/inner-loading/QInnerLoading.json +29 -0
- package/src/components/inner-loading/QInnerLoading.sass +3 -0
- package/src/components/inner-loading/QInnerLoading.styl +3 -0
- package/src/components/item/QItem.js +9 -15
- package/src/components/layout/QLayout.js +49 -0
- package/src/components/linear-progress/QLinearProgress.js +6 -2
- package/src/components/menu/QMenu.js +5 -1
- package/src/components/option-group/QOptionGroup.js +32 -22
- package/src/components/option-group/QOptionGroup.json +50 -1
- package/src/components/parallax/QParallax.js +3 -0
- package/src/components/parallax/QParallax.json +1 -1
- package/src/components/popup-edit/QPopupEdit.js +41 -16
- package/src/components/popup-edit/QPopupEdit.json +15 -8
- package/src/components/range/QRange.js +223 -278
- package/src/components/range/QRange.json +11 -122
- package/src/components/rating/QRating.js +56 -38
- package/src/components/rating/QRating.json +3 -3
- package/src/components/rating/QRating.sass +8 -6
- package/src/components/rating/QRating.styl +8 -6
- package/src/components/resize-observer/QResizeObserver.js +15 -10
- package/src/components/scroll-area/QScrollArea.js +342 -126
- package/src/components/scroll-area/QScrollArea.json +164 -20
- package/src/components/scroll-area/QScrollArea.sass +5 -0
- package/src/components/scroll-area/QScrollArea.styl +5 -0
- package/src/components/scroll-observer/QScrollObserver.js +12 -7
- package/src/components/select/QSelect.js +8 -2
- package/src/components/select/QSelect.json +1 -1
- package/src/components/separator/QSeparator.js +0 -1
- package/src/components/separator/QSeparator.json +1 -1
- package/src/components/slider/QSlider.js +97 -140
- package/src/components/slider/QSlider.json +1 -122
- package/src/components/slider/QSlider.sass +205 -139
- package/src/components/slider/QSlider.styl +205 -139
- package/src/components/slider/slider-utils.js +468 -123
- package/src/components/slider/slider-utils.json +546 -0
- package/src/components/stepper/QStepper.js +1 -1
- package/src/components/stepper/QStepper.sass +25 -26
- package/src/components/stepper/QStepper.styl +25 -26
- package/src/components/table/QTable.sass +3 -0
- package/src/components/table/QTable.styl +3 -0
- package/src/components/tabs/QRouteTab.js +13 -13
- package/src/components/tabs/QRouteTab.json +0 -7
- package/src/components/tabs/QTab.js +71 -20
- package/src/components/tabs/QTabs.js +237 -52
- package/src/components/tabs/QTabs.json +8 -0
- package/src/components/tabs/QTabs.sass +6 -6
- package/src/components/tabs/QTabs.styl +6 -6
- package/src/components/time/QTime.js +6 -2
- package/src/components/timeline/QTimeline.sass +1 -2
- package/src/components/timeline/QTimeline.styl +1 -2
- package/src/components/timeline/QTimelineEntry.json +1 -1
- package/src/components/tree/QTree.js +10 -6
- package/src/components/tree/QTree.json +5 -0
- package/src/components/tree/QTree.sass +58 -4
- package/src/components/tree/QTree.styl +58 -4
- package/src/components/uploader/QUploaderBase.js +15 -19
- package/src/components/video/QVideo.js +4 -1
- package/src/components/video/QVideo.json +11 -0
- package/src/components/virtual-scroll/QVirtualScroll.sass +1 -0
- package/src/components/virtual-scroll/QVirtualScroll.styl +1 -0
- package/src/css/core/helpers.sass +3 -0
- package/src/css/core/helpers.styl +3 -0
- package/src/css/core/positioning.sass +5 -0
- package/src/css/core/positioning.styl +5 -0
- package/src/css/variables.sass +4 -6
- package/src/css/variables.styl +4 -6
- package/src/directives/Scroll.js +2 -2
- package/src/directives/ScrollFire.js +1 -0
- package/src/ie-compat/ie.js +13 -13
- package/src/install.js +1 -1
- package/src/lang.js +7 -4
- package/src/mixins/anchor.js +3 -13
- package/src/mixins/btn.js +33 -38
- package/src/mixins/btn.json +26 -11
- package/src/mixins/file.js +27 -5
- package/src/mixins/fullscreen.js +16 -4
- package/src/mixins/portal.js +10 -10
- package/src/mixins/router-link.js +88 -14
- package/src/mixins/router-link.json +26 -10
- package/src/mixins/validate.js +33 -15
- package/src/mixins/virtual-scroll.js +40 -42
- package/src/plugins/AppFullscreen.js +41 -16
- package/src/plugins/BottomSheet.json +1 -1
- package/src/plugins/Cookies.js +1 -1
- package/src/plugins/Loading.js +8 -0
- package/src/plugins/LoadingBar.js +9 -0
- package/src/plugins/LoadingBar.json +1 -1
- package/src/plugins/Notify.js +351 -333
- package/src/plugins/Notify.json +20 -20
- package/src/plugins/Notify.sass +9 -3
- package/src/plugins/Notify.styl +9 -3
- package/src/utils/clone.js +53 -4
- package/src/utils/date.js +134 -69
- package/src/utils/dom.js +28 -9
- package/src/utils/extend.js +2 -2
- package/src/utils/focus-manager.js +8 -10
- package/src/utils/global-dialog.js +18 -1
- package/src/utils/is.js +2 -2
- package/src/utils/morph.js +2 -12
- package/src/utils/scroll.js +71 -35
package/src/plugins/Notify.js
CHANGED
|
@@ -7,10 +7,16 @@ import QSpinner from '../components/spinner/QSpinner.js'
|
|
|
7
7
|
|
|
8
8
|
import { noop } from '../utils/event.js'
|
|
9
9
|
import { getBodyFullscreenElement } from '../utils/dom.js'
|
|
10
|
+
import debounce from '../utils/debounce.js'
|
|
10
11
|
import { isSSR } from './Platform.js'
|
|
11
12
|
|
|
12
|
-
let uid = 0
|
|
13
|
+
let uid = 0, vm
|
|
14
|
+
|
|
13
15
|
const defaults = {}
|
|
16
|
+
const groups = {}
|
|
17
|
+
const notificationsList = {}
|
|
18
|
+
const positionClass = {}
|
|
19
|
+
const emptyRE = /^\s*$/
|
|
14
20
|
|
|
15
21
|
const positionList = [
|
|
16
22
|
'top-left', 'top-right',
|
|
@@ -25,23 +31,23 @@ const badgePositions = [
|
|
|
25
31
|
|
|
26
32
|
const notifTypes = {
|
|
27
33
|
positive: {
|
|
28
|
-
icon
|
|
34
|
+
icon: $q => $q.iconSet.type.positive,
|
|
29
35
|
color: 'positive'
|
|
30
36
|
},
|
|
31
37
|
|
|
32
38
|
negative: {
|
|
33
|
-
icon
|
|
39
|
+
icon: $q => $q.iconSet.type.negative,
|
|
34
40
|
color: 'negative'
|
|
35
41
|
},
|
|
36
42
|
|
|
37
43
|
warning: {
|
|
38
|
-
icon
|
|
44
|
+
icon: $q => $q.iconSet.type.warning,
|
|
39
45
|
color: 'warning',
|
|
40
46
|
textColor: 'dark'
|
|
41
47
|
},
|
|
42
48
|
|
|
43
49
|
info: {
|
|
44
|
-
icon
|
|
50
|
+
icon: $q => $q.iconSet.type.info,
|
|
45
51
|
color: 'info'
|
|
46
52
|
},
|
|
47
53
|
|
|
@@ -53,329 +59,334 @@ const notifTypes = {
|
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
console.error(`Notify: ${error}`, config)
|
|
61
|
-
return false
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const Notifications = {
|
|
65
|
-
name: 'QNotifications',
|
|
62
|
+
function addNotification (config, vm, originalApi) {
|
|
63
|
+
if (!config) {
|
|
64
|
+
return logError('parameter required')
|
|
65
|
+
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
let Api
|
|
68
|
+
const notif = { textColor: 'white' }
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
if (config.ignoreDefaults !== true) {
|
|
71
|
+
Object.assign(notif, defaults)
|
|
72
|
+
}
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
if (Object(config) !== config) {
|
|
75
|
+
if (notif.type) {
|
|
76
|
+
Object.assign(notif, notifTypes[notif.type])
|
|
77
|
+
}
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
79
|
+
config = { message: config }
|
|
80
|
+
}
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
add (config, originalApi) {
|
|
84
|
-
if (!config) {
|
|
85
|
-
return logError('parameter required')
|
|
86
|
-
}
|
|
82
|
+
Object.assign(notif, notifTypes[config.type || notif.type], config)
|
|
87
83
|
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
if (typeof notif.icon === 'function') {
|
|
85
|
+
notif.icon = notif.icon(vm.$q)
|
|
86
|
+
}
|
|
90
87
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
if (!notif.spinner) {
|
|
89
|
+
notif.spinner = false
|
|
90
|
+
}
|
|
91
|
+
else if (notif.spinner === true) {
|
|
92
|
+
notif.spinner = QSpinner
|
|
93
|
+
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
notif.meta = {
|
|
96
|
+
hasMedia: Boolean(notif.spinner !== false || notif.icon || notif.avatar),
|
|
97
|
+
hasText: hasContent(notif.message) || hasContent(notif.caption)
|
|
98
|
+
}
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
if (notif.position) {
|
|
101
|
+
if (positionList.includes(notif.position) === false) {
|
|
102
|
+
return logError('wrong position', config)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
notif.position = 'bottom'
|
|
107
|
+
}
|
|
102
108
|
|
|
103
|
-
|
|
109
|
+
if (notif.timeout === void 0) {
|
|
110
|
+
notif.timeout = 5000
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const t = parseInt(notif.timeout, 10)
|
|
114
|
+
if (isNaN(t) || t < 0) {
|
|
115
|
+
return logError('wrong timeout', config)
|
|
116
|
+
}
|
|
117
|
+
notif.timeout = t
|
|
118
|
+
}
|
|
104
119
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
120
|
+
if (notif.timeout === 0) {
|
|
121
|
+
notif.progress = false
|
|
122
|
+
}
|
|
123
|
+
else if (notif.progress === true) {
|
|
124
|
+
notif.meta.progressClass = 'q-notification__progress' + (
|
|
125
|
+
notif.progressClass
|
|
126
|
+
? ` ${notif.progressClass}`
|
|
127
|
+
: ''
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
notif.meta.progressStyle = {
|
|
131
|
+
animationDuration: `${notif.timeout + 1000}ms`
|
|
132
|
+
}
|
|
133
|
+
}
|
|
108
134
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
135
|
+
const actions = (
|
|
136
|
+
Array.isArray(config.actions) === true
|
|
137
|
+
? config.actions
|
|
138
|
+
: []
|
|
139
|
+
).concat(
|
|
140
|
+
config.ignoreDefaults !== true && Array.isArray(defaults.actions) === true
|
|
141
|
+
? defaults.actions
|
|
142
|
+
: []
|
|
143
|
+
).concat(
|
|
144
|
+
notifTypes[config.type] !== void 0 && Array.isArray(notifTypes[config.type].actions) === true
|
|
145
|
+
? notifTypes[config.type].actions
|
|
146
|
+
: []
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
const { closeBtn } = notif
|
|
150
|
+
closeBtn && actions.push({
|
|
151
|
+
label: typeof closeBtn === 'string'
|
|
152
|
+
? closeBtn
|
|
153
|
+
: this.$q.lang.label.close
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
notif.actions = actions.map(({ handler, noDismiss, style, class: klass, attrs, ...props }) => ({
|
|
157
|
+
staticClass: klass,
|
|
158
|
+
style,
|
|
159
|
+
props: { flat: true, ...props },
|
|
160
|
+
attrs,
|
|
161
|
+
on: {
|
|
162
|
+
click: typeof handler === 'function'
|
|
163
|
+
? () => {
|
|
164
|
+
handler()
|
|
165
|
+
noDismiss !== true && dismiss()
|
|
166
|
+
}
|
|
167
|
+
: () => { dismiss() }
|
|
168
|
+
}
|
|
169
|
+
}))
|
|
115
170
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
171
|
+
if (notif.multiLine === void 0) {
|
|
172
|
+
notif.multiLine = notif.actions.length > 1
|
|
173
|
+
}
|
|
119
174
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
notif.position = 'bottom'
|
|
127
|
-
}
|
|
175
|
+
Object.assign(notif.meta, {
|
|
176
|
+
staticClass: 'q-notification row items-stretch' +
|
|
177
|
+
` q-notification--${notif.multiLine === true ? 'multi-line' : 'standard'}` +
|
|
178
|
+
(notif.color !== void 0 ? ` bg-${notif.color}` : '') +
|
|
179
|
+
(notif.textColor !== void 0 ? ` text-${notif.textColor}` : '') +
|
|
180
|
+
(notif.classes !== void 0 ? ` ${notif.classes}` : ''),
|
|
128
181
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
const t = parseInt(notif.timeout, 10)
|
|
134
|
-
if (isNaN(t) || t < 0) {
|
|
135
|
-
return logError('wrong timeout', config)
|
|
136
|
-
}
|
|
137
|
-
notif.timeout = t
|
|
138
|
-
}
|
|
182
|
+
wrapperClass: 'q-notification__wrapper col relative-position border-radius-inherit ' +
|
|
183
|
+
(notif.multiLine === true ? 'column no-wrap justify-center' : 'row items-center'),
|
|
139
184
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
else if (notif.progress === true) {
|
|
144
|
-
notif.meta.progressStyle = {
|
|
145
|
-
animationDuration: `${notif.timeout + 1000}ms`
|
|
146
|
-
}
|
|
147
|
-
}
|
|
185
|
+
contentClass: 'q-notification__content row items-center' +
|
|
186
|
+
(notif.multiLine === true ? '' : ' col'),
|
|
148
187
|
|
|
149
|
-
|
|
150
|
-
Array.isArray(config.actions) === true
|
|
151
|
-
? config.actions
|
|
152
|
-
: []
|
|
153
|
-
).concat(
|
|
154
|
-
config.ignoreDefaults !== true && Array.isArray(defaults.actions) === true
|
|
155
|
-
? defaults.actions
|
|
156
|
-
: []
|
|
157
|
-
).concat(
|
|
158
|
-
notifTypes[config.type] !== void 0 && Array.isArray(notifTypes[config.type].actions) === true
|
|
159
|
-
? notifTypes[config.type].actions
|
|
160
|
-
: []
|
|
161
|
-
)
|
|
162
|
-
|
|
163
|
-
notif.closeBtn && actions.push({
|
|
164
|
-
label: typeof notif.closeBtn === 'string'
|
|
165
|
-
? notif.closeBtn
|
|
166
|
-
: this.$q.lang.label.close
|
|
167
|
-
})
|
|
188
|
+
leftClass: notif.meta.hasText === true ? 'additional' : 'single',
|
|
168
189
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
on: {
|
|
175
|
-
click: typeof handler === 'function'
|
|
176
|
-
? () => {
|
|
177
|
-
handler()
|
|
178
|
-
noDismiss !== true && dismiss()
|
|
179
|
-
}
|
|
180
|
-
: () => { dismiss() }
|
|
181
|
-
}
|
|
182
|
-
}))
|
|
190
|
+
attrs: {
|
|
191
|
+
role: 'alert',
|
|
192
|
+
...notif.attrs
|
|
193
|
+
}
|
|
194
|
+
})
|
|
183
195
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
196
|
+
if (notif.group === false) {
|
|
197
|
+
notif.group = void 0
|
|
198
|
+
notif.meta.group = void 0
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
if (notif.group === void 0 || notif.group === true) {
|
|
202
|
+
// do not replace notifications with different buttons
|
|
203
|
+
notif.group = [
|
|
204
|
+
notif.message,
|
|
205
|
+
notif.caption,
|
|
206
|
+
notif.multiline
|
|
207
|
+
].concat(
|
|
208
|
+
notif.actions.map(({ props }) => `${props.label}*${props.icon}`)
|
|
209
|
+
).join('|')
|
|
210
|
+
}
|
|
187
211
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
` q-notification--${notif.multiLine === true ? 'multi-line' : 'standard'}` +
|
|
191
|
-
(notif.color !== void 0 ? ` bg-${notif.color}` : '') +
|
|
192
|
-
(notif.textColor !== void 0 ? ` text-${notif.textColor}` : '') +
|
|
193
|
-
(notif.classes !== void 0 ? ` ${notif.classes}` : ''),
|
|
212
|
+
notif.meta.group = notif.group + '|' + notif.position
|
|
213
|
+
}
|
|
194
214
|
|
|
195
|
-
|
|
196
|
-
|
|
215
|
+
if (notif.actions.length === 0) {
|
|
216
|
+
notif.actions = void 0
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
notif.meta.actionsClass = 'q-notification__actions row items-center ' +
|
|
220
|
+
(notif.multiLine === true ? 'justify-end' : 'col-auto') +
|
|
221
|
+
(notif.meta.hasMedia === true ? ' q-notification__actions--with-media' : '')
|
|
222
|
+
}
|
|
197
223
|
|
|
198
|
-
|
|
199
|
-
|
|
224
|
+
if (originalApi !== void 0) {
|
|
225
|
+
// reset timeout if any
|
|
226
|
+
clearTimeout(originalApi.notif.meta.timer)
|
|
200
227
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
...notif.attrs
|
|
204
|
-
}
|
|
205
|
-
})
|
|
228
|
+
// retain uid
|
|
229
|
+
notif.meta.uid = originalApi.notif.meta.uid
|
|
206
230
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
231
|
+
// replace notif
|
|
232
|
+
const index = notificationsList[notif.position].indexOf(originalApi.notif)
|
|
233
|
+
notificationsList[notif.position][index] = notif
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
const original = groups[notif.meta.group]
|
|
237
|
+
|
|
238
|
+
// woohoo, it's a new notification
|
|
239
|
+
if (original === void 0) {
|
|
240
|
+
notif.meta.uid = uid++
|
|
241
|
+
notif.meta.badge = 1
|
|
242
|
+
|
|
243
|
+
if (['left', 'right', 'center'].indexOf(notif.position) !== -1) {
|
|
244
|
+
notificationsList[notif.position].splice(
|
|
245
|
+
Math.floor(notificationsList[notif.position].length / 2),
|
|
246
|
+
0,
|
|
247
|
+
notif
|
|
248
|
+
)
|
|
210
249
|
}
|
|
211
250
|
else {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
notif.group = [
|
|
215
|
-
notif.message,
|
|
216
|
-
notif.caption,
|
|
217
|
-
notif.multiline
|
|
218
|
-
].concat(
|
|
219
|
-
notif.actions.map(a => `${a.props.label}*${a.props.icon}`)
|
|
220
|
-
).join('|')
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
notif.meta.group = notif.group + '|' + notif.position
|
|
251
|
+
const action = notif.position.indexOf('top') > -1 ? 'unshift' : 'push'
|
|
252
|
+
notificationsList[notif.position][action](notif)
|
|
224
253
|
}
|
|
225
254
|
|
|
226
|
-
if (notif.
|
|
227
|
-
notif.
|
|
255
|
+
if (notif.group !== void 0) {
|
|
256
|
+
groups[notif.meta.group] = notif
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
// ok, so it's NOT a new one
|
|
260
|
+
else {
|
|
261
|
+
// reset timeout if any
|
|
262
|
+
clearTimeout(original.meta.timer)
|
|
263
|
+
|
|
264
|
+
if (notif.badgePosition !== void 0) {
|
|
265
|
+
if (badgePositions.includes(notif.badgePosition) === false) {
|
|
266
|
+
return logError('wrong badgePosition', config)
|
|
267
|
+
}
|
|
228
268
|
}
|
|
229
269
|
else {
|
|
230
|
-
notif.
|
|
231
|
-
(notif.multiLine === true ? 'justify-end' : 'col-auto') +
|
|
232
|
-
(notif.meta.hasMedia === true ? ' q-notification__actions--with-media' : '')
|
|
270
|
+
notif.badgePosition = `top-${notif.position.indexOf('left') > -1 ? 'right' : 'left'}`
|
|
233
271
|
}
|
|
234
272
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
273
|
+
notif.meta.uid = original.meta.uid
|
|
274
|
+
notif.meta.badge = original.meta.badge + 1
|
|
275
|
+
notif.meta.badgeClass = `q-notification__badge q-notification__badge--${notif.badgePosition}` +
|
|
276
|
+
(notif.badgeColor !== void 0 ? ` bg-${notif.badgeColor}` : '') +
|
|
277
|
+
(notif.badgeTextColor !== void 0 ? ` text-${notif.badgeTextColor}` : '') +
|
|
278
|
+
(notif.badgeClass ? ` ${notif.badgeClass}` : '')
|
|
238
279
|
|
|
239
|
-
|
|
240
|
-
|
|
280
|
+
const index = notificationsList[notif.position].indexOf(original)
|
|
281
|
+
notificationsList[notif.position][index] = groups[notif.meta.group] = notif
|
|
282
|
+
}
|
|
283
|
+
}
|
|
241
284
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
else {
|
|
247
|
-
const original = groups[notif.meta.group]
|
|
248
|
-
|
|
249
|
-
// woohoo, it's a new notification
|
|
250
|
-
if (original === void 0) {
|
|
251
|
-
notif.meta.uid = uid++
|
|
252
|
-
notif.meta.badge = 1
|
|
253
|
-
|
|
254
|
-
if (['left', 'right', 'center'].indexOf(notif.position) !== -1) {
|
|
255
|
-
this.notifs[notif.position].splice(
|
|
256
|
-
Math.floor(this.notifs[notif.position].length / 2),
|
|
257
|
-
0,
|
|
258
|
-
notif
|
|
259
|
-
)
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
const action = notif.position.indexOf('top') > -1 ? 'unshift' : 'push'
|
|
263
|
-
this.notifs[notif.position][action](notif)
|
|
264
|
-
}
|
|
285
|
+
const dismiss = () => {
|
|
286
|
+
removeNotification(notif, vm)
|
|
287
|
+
Api = void 0
|
|
288
|
+
}
|
|
265
289
|
|
|
266
|
-
|
|
267
|
-
groups[notif.meta.group] = notif
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
// ok, so it's NOT a new one
|
|
271
|
-
else {
|
|
272
|
-
// reset timeout if any
|
|
273
|
-
clearTimeout(original.meta.timer)
|
|
274
|
-
|
|
275
|
-
if (notif.badgePosition !== void 0) {
|
|
276
|
-
if (badgePositions.includes(notif.badgePosition) === false) {
|
|
277
|
-
return logError('wrong badgePosition', config)
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
notif.badgePosition = `top-${notif.position.indexOf('left') > -1 ? 'right' : 'left'}`
|
|
282
|
-
}
|
|
290
|
+
vm.$forceUpdate()
|
|
283
291
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
292
|
+
if (notif.timeout > 0) {
|
|
293
|
+
notif.meta.timer = setTimeout(() => {
|
|
294
|
+
dismiss()
|
|
295
|
+
}, notif.timeout + /* show duration */ 1000)
|
|
296
|
+
}
|
|
289
297
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
298
|
+
// only non-groupable can be updated
|
|
299
|
+
if (notif.group !== void 0) {
|
|
300
|
+
return props => {
|
|
301
|
+
if (props !== void 0) {
|
|
302
|
+
logError('trying to update a grouped one which is forbidden', config)
|
|
293
303
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
this.remove(notif)
|
|
297
|
-
Api = void 0
|
|
304
|
+
else {
|
|
305
|
+
dismiss()
|
|
298
306
|
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
299
309
|
|
|
300
|
-
|
|
310
|
+
Api = {
|
|
311
|
+
dismiss,
|
|
312
|
+
config,
|
|
313
|
+
notif
|
|
314
|
+
}
|
|
301
315
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
316
|
+
if (originalApi !== void 0) {
|
|
317
|
+
Object.assign(originalApi, Api)
|
|
318
|
+
return
|
|
319
|
+
}
|
|
307
320
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
else {
|
|
315
|
-
dismiss()
|
|
316
|
-
}
|
|
317
|
-
}
|
|
321
|
+
return props => {
|
|
322
|
+
// if notification wasn't previously dismissed
|
|
323
|
+
if (Api !== void 0) {
|
|
324
|
+
// if no params, then we must dismiss the notification
|
|
325
|
+
if (props === void 0) {
|
|
326
|
+
Api.dismiss()
|
|
318
327
|
}
|
|
328
|
+
// otherwise we're updating it
|
|
329
|
+
else {
|
|
330
|
+
const newNotif = Object.assign({}, Api.config, props, {
|
|
331
|
+
group: false,
|
|
332
|
+
position: notif.position
|
|
333
|
+
})
|
|
319
334
|
|
|
320
|
-
|
|
321
|
-
dismiss,
|
|
322
|
-
config,
|
|
323
|
-
notif
|
|
335
|
+
addNotification(newNotif, vm, Api)
|
|
324
336
|
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
325
340
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
return
|
|
329
|
-
}
|
|
341
|
+
function removeNotification (notif, vm) {
|
|
342
|
+
clearTimeout(notif.meta.timer)
|
|
330
343
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
Api.dismiss()
|
|
337
|
-
}
|
|
338
|
-
// otherwise we're updating it
|
|
339
|
-
else {
|
|
340
|
-
const newNotif = Object.assign({}, Api.config, props, {
|
|
341
|
-
group: false,
|
|
342
|
-
position: notif.position
|
|
343
|
-
})
|
|
344
|
+
const index = notificationsList[notif.position].indexOf(notif)
|
|
345
|
+
if (index !== -1) {
|
|
346
|
+
if (notif.group !== void 0) {
|
|
347
|
+
delete groups[notif.meta.group]
|
|
348
|
+
}
|
|
344
349
|
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
+
const el = vm.$refs['' + notif.meta.uid]
|
|
350
351
|
|
|
351
|
-
|
|
352
|
-
|
|
352
|
+
if (el) {
|
|
353
|
+
const { width, height } = getComputedStyle(el)
|
|
353
354
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
355
|
+
el.style.left = `${el.offsetLeft}px`
|
|
356
|
+
el.style.width = width
|
|
357
|
+
el.style.height = height
|
|
358
|
+
}
|
|
359
359
|
|
|
360
|
-
|
|
360
|
+
notificationsList[notif.position].splice(index, 1)
|
|
361
361
|
|
|
362
|
-
|
|
363
|
-
const { width, height } = getComputedStyle(el)
|
|
362
|
+
vm.$forceUpdate()
|
|
364
363
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
364
|
+
if (typeof notif.onDismiss === 'function') {
|
|
365
|
+
notif.onDismiss()
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
369
|
|
|
370
|
-
|
|
370
|
+
function hasContent (str) {
|
|
371
|
+
return str !== void 0 &&
|
|
372
|
+
str !== null &&
|
|
373
|
+
emptyRE.test(str) !== true
|
|
374
|
+
}
|
|
371
375
|
|
|
372
|
-
|
|
376
|
+
function logError (error, config) {
|
|
377
|
+
console.error(`Notify: ${error}`, config)
|
|
378
|
+
return false
|
|
379
|
+
}
|
|
373
380
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
381
|
+
const Notifications = {
|
|
382
|
+
name: 'QNotifications',
|
|
383
|
+
|
|
384
|
+
// hide App from Vue devtools
|
|
385
|
+
devtools: { hide: true },
|
|
386
|
+
|
|
387
|
+
beforeCreate () {
|
|
388
|
+
// prevent error in Vue devtools
|
|
389
|
+
this._routerRoot === void 0 && (this._routerRoot = {})
|
|
379
390
|
},
|
|
380
391
|
|
|
381
392
|
render (h) {
|
|
@@ -388,43 +399,22 @@ const Notifications = {
|
|
|
388
399
|
name: `q-notification--${pos}`,
|
|
389
400
|
mode: 'out-in'
|
|
390
401
|
}
|
|
391
|
-
},
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
const meta = notif.meta
|
|
395
|
-
const msgData = { staticClass: 'q-notification__message col' }
|
|
396
|
-
|
|
397
|
-
if (notif.html === true) {
|
|
398
|
-
msgData.domProps = {
|
|
399
|
-
innerHTML: notif.caption
|
|
400
|
-
? `<div>${notif.message}</div><div class="q-notification__caption">${notif.caption}</div>`
|
|
401
|
-
: notif.message
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
const msgNode = [ notif.message ]
|
|
406
|
-
msgChild = notif.caption
|
|
407
|
-
? [
|
|
408
|
-
h('div', msgNode),
|
|
409
|
-
h('div', { staticClass: 'q-notification__caption' }, [ notif.caption ])
|
|
410
|
-
]
|
|
411
|
-
: msgNode
|
|
412
|
-
}
|
|
413
|
-
|
|
402
|
+
}, notificationsList[pos].map(notif => {
|
|
403
|
+
const { meta } = notif
|
|
414
404
|
const mainChild = []
|
|
415
405
|
|
|
416
406
|
if (meta.hasMedia === true) {
|
|
417
407
|
if (notif.spinner !== false) {
|
|
418
408
|
mainChild.push(
|
|
419
409
|
h(notif.spinner, {
|
|
420
|
-
staticClass: 'q-notification__spinner'
|
|
410
|
+
staticClass: 'q-notification__spinner q-notification__spinner--' + meta.leftClass
|
|
421
411
|
})
|
|
422
412
|
)
|
|
423
413
|
}
|
|
424
414
|
else if (notif.icon) {
|
|
425
415
|
mainChild.push(
|
|
426
416
|
h(QIcon, {
|
|
427
|
-
staticClass: 'q-notification__icon',
|
|
417
|
+
staticClass: 'q-notification__icon q-notification__icon--' + meta.leftClass,
|
|
428
418
|
attrs: { role: 'img' },
|
|
429
419
|
props: { name: notif.icon }
|
|
430
420
|
})
|
|
@@ -432,16 +422,38 @@ const Notifications = {
|
|
|
432
422
|
}
|
|
433
423
|
else if (notif.avatar) {
|
|
434
424
|
mainChild.push(
|
|
435
|
-
h(QAvatar, { staticClass: 'q-notification__avatar' }, [
|
|
425
|
+
h(QAvatar, { staticClass: 'q-notification__avatar q-notification__avatar--' + meta.leftClass }, [
|
|
436
426
|
h('img', { attrs: { src: notif.avatar, 'aria-hidden': 'true' } })
|
|
437
427
|
])
|
|
438
428
|
)
|
|
439
429
|
}
|
|
440
430
|
}
|
|
441
431
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
432
|
+
if (meta.hasText === true) {
|
|
433
|
+
let msgChild
|
|
434
|
+
const msgData = { staticClass: 'q-notification__message col' }
|
|
435
|
+
|
|
436
|
+
if (notif.html === true) {
|
|
437
|
+
msgData.domProps = {
|
|
438
|
+
innerHTML: notif.caption
|
|
439
|
+
? `<div>${notif.message}</div><div class="q-notification__caption">${notif.caption}</div>`
|
|
440
|
+
: notif.message
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
const msgNode = [ notif.message ]
|
|
445
|
+
msgChild = notif.caption
|
|
446
|
+
? [
|
|
447
|
+
h('div', msgNode),
|
|
448
|
+
h('div', { staticClass: 'q-notification__caption' }, [notif.caption])
|
|
449
|
+
]
|
|
450
|
+
: msgNode
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
mainChild.push(
|
|
454
|
+
h('div', msgData, msgChild)
|
|
455
|
+
)
|
|
456
|
+
}
|
|
445
457
|
|
|
446
458
|
const child = [
|
|
447
459
|
h('div', { staticClass: meta.contentClass }, mainChild)
|
|
@@ -450,9 +462,8 @@ const Notifications = {
|
|
|
450
462
|
notif.progress === true && child.push(
|
|
451
463
|
h('div', {
|
|
452
464
|
key: `${meta.uid}|p|${meta.badge}`,
|
|
453
|
-
staticClass:
|
|
454
|
-
style: meta.progressStyle
|
|
455
|
-
class: notif.progressClass
|
|
465
|
+
staticClass: meta.progressClass,
|
|
466
|
+
style: meta.progressStyle
|
|
456
467
|
})
|
|
457
468
|
)
|
|
458
469
|
|
|
@@ -465,14 +476,13 @@ const Notifications = {
|
|
|
465
476
|
meta.badge > 1 && child.push(
|
|
466
477
|
h('div', {
|
|
467
478
|
key: `${meta.uid}|${meta.badge}`,
|
|
468
|
-
staticClass: meta.
|
|
469
|
-
style: notif.badgeStyle
|
|
470
|
-
class: notif.badgeClass
|
|
479
|
+
staticClass: meta.badgeClass,
|
|
480
|
+
style: notif.badgeStyle
|
|
471
481
|
}, [ meta.badge ])
|
|
472
482
|
)
|
|
473
483
|
|
|
474
484
|
return h('div', {
|
|
475
|
-
ref:
|
|
485
|
+
ref: '' + meta.uid,
|
|
476
486
|
key: meta.uid,
|
|
477
487
|
staticClass: meta.staticClass,
|
|
478
488
|
attrs: meta.attrs
|
|
@@ -485,21 +495,18 @@ const Notifications = {
|
|
|
485
495
|
|
|
486
496
|
mounted () {
|
|
487
497
|
if (this.$q.fullscreen !== void 0 && this.$q.fullscreen.isCapable === true) {
|
|
488
|
-
const append =
|
|
489
|
-
const newParent = getBodyFullscreenElement(
|
|
490
|
-
isFullscreen,
|
|
491
|
-
this.$q.fullscreen.activeEl
|
|
492
|
-
)
|
|
498
|
+
const append = () => {
|
|
499
|
+
const newParent = getBodyFullscreenElement(this.$q.fullscreen.activeEl)
|
|
493
500
|
|
|
494
501
|
if (this.$el.parentElement !== newParent) {
|
|
495
502
|
newParent.appendChild(this.$el)
|
|
496
503
|
}
|
|
497
504
|
}
|
|
498
505
|
|
|
499
|
-
this.unwatchFullscreen = this.$watch('$q.fullscreen.
|
|
506
|
+
this.unwatchFullscreen = this.$watch('$q.fullscreen.activeEl', debounce(append, 50))
|
|
500
507
|
|
|
501
508
|
if (this.$q.fullscreen.isActive === true) {
|
|
502
|
-
append(
|
|
509
|
+
append()
|
|
503
510
|
}
|
|
504
511
|
}
|
|
505
512
|
},
|
|
@@ -510,36 +517,47 @@ const Notifications = {
|
|
|
510
517
|
}
|
|
511
518
|
|
|
512
519
|
export default {
|
|
513
|
-
create (opts) {
|
|
514
|
-
if (isSSR === true) { return noop }
|
|
515
|
-
return this.__vm.add(opts)
|
|
516
|
-
},
|
|
517
520
|
setDefaults (opts) {
|
|
518
|
-
opts === Object(opts)
|
|
521
|
+
if (isSSR !== true && opts === Object(opts)) {
|
|
522
|
+
Object.assign(defaults, opts)
|
|
523
|
+
}
|
|
519
524
|
},
|
|
525
|
+
|
|
520
526
|
registerType (typeName, typeOpts) {
|
|
521
527
|
if (isSSR !== true && typeOpts === Object(typeOpts)) {
|
|
522
528
|
notifTypes[typeName] = typeOpts
|
|
523
529
|
}
|
|
524
530
|
},
|
|
525
531
|
|
|
526
|
-
install ({
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
return
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
this.setDefaults(cfg.notify)
|
|
532
|
+
install ({ $q }) {
|
|
533
|
+
$q.notify = this.create = isSSR === true
|
|
534
|
+
? noop
|
|
535
|
+
: opts => addNotification(opts, vm)
|
|
534
536
|
|
|
535
|
-
$q.notify = this.create.bind(this)
|
|
536
537
|
$q.notify.setDefaults = this.setDefaults
|
|
537
538
|
$q.notify.registerType = this.registerType
|
|
538
539
|
|
|
539
|
-
|
|
540
|
-
|
|
540
|
+
if ($q.config.notify !== void 0) {
|
|
541
|
+
this.setDefaults($q.config.notify)
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if (isSSR !== true) {
|
|
545
|
+
positionList.forEach(pos => {
|
|
546
|
+
notificationsList[pos] = []
|
|
547
|
+
|
|
548
|
+
const
|
|
549
|
+
vert = ['left', 'center', 'right'].includes(pos) === true ? 'center' : (pos.indexOf('top') > -1 ? 'top' : 'bottom'),
|
|
550
|
+
align = pos.indexOf('left') > -1 ? 'start' : (pos.indexOf('right') > -1 ? 'end' : 'center'),
|
|
551
|
+
classes = ['left', 'right'].includes(pos) ? `items-${pos === 'left' ? 'start' : 'end'} justify-center` : (pos === 'center' ? 'flex-center' : `items-${align}`)
|
|
541
552
|
|
|
542
|
-
|
|
543
|
-
|
|
553
|
+
positionClass[pos] = `q-notifications__list q-notifications__list--${vert} fixed column no-wrap ${classes}`
|
|
554
|
+
})
|
|
555
|
+
|
|
556
|
+
const node = document.createElement('div')
|
|
557
|
+
document.body.appendChild(node)
|
|
558
|
+
|
|
559
|
+
vm = new Vue(Notifications)
|
|
560
|
+
vm.$mount(node)
|
|
561
|
+
}
|
|
544
562
|
}
|
|
545
563
|
}
|