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.
- package/dist/api/BottomSheet.json +1 -1
- package/dist/api/Loading.json +2 -6
- package/dist/api/Notify.json +5 -5
- package/dist/api/QAvatar.json +1 -1
- package/dist/api/QBreadcrumbsEl.json +32 -11
- package/dist/api/QBtn.json +32 -16
- package/dist/api/QBtnDropdown.json +33 -17
- package/dist/api/QBtnToggle.json +4 -1
- package/dist/api/QCarousel.json +4 -4
- package/dist/api/QChatMessage.json +4 -12
- package/dist/api/QChip.json +4 -4
- package/dist/api/QExpansionItem.json +34 -13
- package/dist/api/QFab.json +32 -2
- package/dist/api/QFabAction.json +9 -1
- package/dist/api/QField.json +1 -0
- package/dist/api/QFile.json +1 -0
- package/dist/api/QInput.json +1 -0
- package/dist/api/QItem.json +31 -10
- package/dist/api/QLinearProgress.json +1 -1
- package/dist/api/QOptionGroup.json +74 -4
- package/dist/api/QPagination.json +4 -4
- package/dist/api/QPullToRefresh.json +1 -1
- package/dist/api/QRange.json +592 -107
- package/dist/api/QRating.json +3 -3
- package/dist/api/QRouteTab.json +32 -12
- package/dist/api/QSelect.json +4 -7
- package/dist/api/QSlider.json +504 -39
- 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/QTimelineEntry.json +1 -1
- package/dist/api/QToggle.json +1 -1
- package/dist/api/QTree.json +1 -1
- package/dist/api/QUploader.json +16 -2
- package/dist/api/QVideo.json +11 -1
- package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/material-icons.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v4.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-themify.umd.prod.js +1 -1
- package/dist/icon-set/themify.umd.prod.js +1 -1
- package/dist/lang/ar.umd.prod.js +1 -1
- package/dist/lang/az-Latn.umd.prod.js +1 -1
- package/dist/lang/bg.umd.prod.js +1 -1
- package/dist/lang/bn.umd.prod.js +1 -1
- package/dist/lang/ca.umd.prod.js +1 -1
- package/dist/lang/cs.umd.prod.js +1 -1
- package/dist/lang/da.umd.prod.js +1 -1
- package/dist/lang/de.umd.prod.js +1 -1
- package/dist/lang/el.umd.prod.js +1 -1
- package/dist/lang/en-GB.umd.prod.js +1 -1
- package/dist/lang/en-US.umd.prod.js +1 -1
- package/dist/lang/eo.umd.prod.js +1 -1
- package/dist/lang/es.umd.prod.js +1 -1
- package/dist/lang/et.umd.prod.js +1 -1
- package/dist/lang/fa-IR.umd.prod.js +1 -1
- package/dist/lang/fa.umd.prod.js +1 -1
- package/dist/lang/fi.umd.prod.js +1 -1
- package/dist/lang/fr.umd.prod.js +1 -1
- package/dist/lang/gn.umd.prod.js +1 -1
- package/dist/lang/he.umd.prod.js +1 -1
- package/dist/lang/hr.umd.prod.js +1 -1
- package/dist/lang/hu.umd.prod.js +1 -1
- package/dist/lang/id.umd.prod.js +1 -1
- package/dist/lang/is.umd.prod.js +1 -1
- package/dist/lang/it.umd.prod.js +1 -1
- package/dist/lang/ja.umd.prod.js +1 -1
- package/dist/lang/km.umd.prod.js +1 -1
- package/dist/lang/ko-KR.umd.prod.js +1 -1
- package/dist/lang/kur-CKB.umd.prod.js +1 -1
- package/dist/lang/lt.umd.prod.js +1 -1
- package/dist/lang/lu.umd.prod.js +1 -1
- package/dist/lang/lv.umd.prod.js +1 -1
- package/dist/lang/ml.umd.prod.js +1 -1
- package/dist/lang/ms.umd.prod.js +1 -1
- package/dist/lang/nb-NO.umd.prod.js +1 -1
- package/dist/lang/nl.umd.prod.js +1 -1
- package/dist/lang/pl.umd.prod.js +1 -1
- package/dist/lang/pt-BR.umd.prod.js +1 -1
- package/dist/lang/pt.umd.prod.js +1 -1
- package/dist/lang/ro.umd.prod.js +1 -1
- package/dist/lang/ru.umd.prod.js +1 -1
- package/dist/lang/sk.umd.prod.js +1 -1
- package/dist/lang/sl.umd.prod.js +1 -1
- package/dist/lang/sr-CYR.umd.prod.js +1 -1
- package/dist/lang/sr.umd.prod.js +1 -1
- package/dist/lang/sv.umd.prod.js +1 -1
- package/dist/lang/ta.umd.prod.js +1 -1
- package/dist/lang/th.umd.prod.js +1 -1
- package/dist/lang/tr.umd.prod.js +1 -1
- package/dist/lang/ug.umd.prod.js +1 -1
- package/dist/lang/uk.umd.prod.js +1 -1
- package/dist/lang/vi.umd.prod.js +1 -1
- package/dist/lang/zh-CN.umd.prod.js +1 -1
- package/dist/lang/zh-TW.umd.prod.js +1 -1
- package/dist/quasar.cjs.prod.js +2 -2
- package/dist/quasar.css +277 -196
- package/dist/quasar.esm.prod.js +2 -2
- package/dist/quasar.prod.css +1 -1
- package/dist/quasar.rtl.css +344 -275
- package/dist/quasar.rtl.prod.css +1 -1
- package/dist/quasar.sass +243 -189
- package/dist/quasar.umd.js +16670 -16294
- package/dist/quasar.umd.prod.js +2 -2
- package/dist/ssr-directives/Morph.js +1 -1
- package/dist/transforms/loader-asset-urls.json +20 -0
- package/dist/types/api/slider.d.ts +46 -0
- package/dist/types/api/validation.d.ts +4 -0
- package/dist/types/api.d.ts +2 -0
- package/dist/types/composables.d.ts +3 -3
- package/dist/types/index.d.ts +599 -121
- package/dist/types/utils/date.d.ts +2 -1
- package/dist/vetur/quasar-attributes.json +254 -82
- package/dist/vetur/quasar-tags.json +61 -18
- package/dist/web-types/web-types.json +635 -197
- package/package.json +1 -1
- package/src/api.extends.json +1 -2
- package/src/components/breadcrumbs/QBreadcrumbs.js +7 -2
- package/src/components/breadcrumbs/QBreadcrumbs.sass +0 -3
- package/src/components/breadcrumbs/QBreadcrumbsEl.js +14 -8
- package/src/components/btn/QBtn.js +5 -5
- package/src/components/btn/use-btn.js +21 -21
- package/src/components/btn/use-btn.json +22 -13
- package/src/components/btn-toggle/QBtnToggle.json +3 -0
- package/src/components/checkbox/use-checkbox.js +1 -1
- package/src/components/color/QColor.js +32 -26
- package/src/components/color/QColor.sass +10 -23
- package/src/components/date/QDate.sass +2 -0
- package/src/components/dialog/QDialog.js +7 -5
- package/src/components/drawer/QDrawer.js +18 -15
- package/src/components/editor/QEditor.js +1 -1
- package/src/components/editor/QEditor.sass +10 -1
- package/src/components/expansion-item/QExpansionItem.js +4 -1
- package/src/components/fab/QFab.js +18 -12
- package/src/components/fab/QFab.json +33 -0
- package/src/components/fab/QFab.sass +1 -1
- package/src/components/fab/QFabAction.js +14 -7
- package/src/components/fab/QFabAction.json +10 -0
- package/src/components/file/QFile.js +12 -5
- package/src/components/file/QFile.sass +4 -2
- package/src/components/footer/QFooter.js +1 -1
- package/src/components/header/QHeader.js +1 -1
- package/src/components/icon/QIcon.js +1 -1
- package/src/components/infinite-scroll/QInfiniteScroll.js +4 -5
- package/src/components/item/QItem.js +2 -3
- package/src/components/linear-progress/QLinearProgress.json +1 -1
- package/src/components/menu/QMenu.js +6 -2
- package/src/components/option-group/QOptionGroup.js +3 -0
- package/src/components/option-group/QOptionGroup.json +48 -2
- package/src/components/parallax/QParallax.js +4 -2
- package/src/components/popup-edit/QPopupEdit.js +2 -5
- package/src/components/radio/QRadio.js +2 -7
- package/src/components/range/QRange.js +132 -273
- package/src/components/range/QRange.json +11 -121
- package/src/components/rating/QRating.json +3 -3
- package/src/components/resize-observer/QResizeObserver.js +11 -10
- package/src/components/scroll-area/QScrollArea.js +8 -2
- package/src/components/scroll-observer/QScrollObserver.js +2 -0
- package/src/components/select/QSelect.js +4 -1
- package/src/components/slider/QSlider.js +61 -137
- package/src/components/slider/QSlider.json +1 -121
- package/src/components/slider/QSlider.sass +203 -138
- package/src/components/slider/use-slider.js +454 -107
- package/src/components/slider/use-slider.json +546 -0
- package/src/components/stepper/QStepper.js +3 -3
- package/src/components/stepper/QStepper.sass +24 -26
- package/src/components/table/QTable.js +26 -46
- package/src/components/tabs/QRouteTab.js +1 -2
- package/src/components/tabs/QRouteTab.json +0 -7
- package/src/components/tabs/QTabs.js +91 -24
- package/src/components/tabs/use-tab.js +26 -13
- package/src/components/tooltip/QTooltip.js +1 -2
- package/src/components/tree/QTree.js +14 -12
- package/src/components/uploader/QUploader.json +14 -2
- package/src/components/uploader/uploader-core.js +16 -9
- package/src/components/video/QVideo.js +4 -1
- package/src/components/video/QVideo.json +12 -1
- package/src/components/virtual-scroll/QVirtualScroll.sass +1 -0
- package/src/components/virtual-scroll/use-virtual-scroll.js +30 -17
- package/src/composables/private/use-field.js +18 -20
- package/src/composables/private/use-file.js +20 -5
- package/src/composables/private/use-form.js +2 -3
- package/src/composables/private/use-fullscreen.js +15 -4
- package/src/composables/private/use-model-toggle.js +1 -1
- package/src/composables/private/use-portal.js +9 -7
- package/src/composables/private/use-router-link.js +44 -23
- package/src/composables/private/use-router-link.json +26 -10
- package/src/composables/private/use-split-attrs.js +4 -4
- package/src/composables/private/use-tick.js +7 -14
- package/src/composables/private/use-validate.js +21 -15
- package/src/composables/private/use-validate.json +1 -0
- package/src/css/core/helpers.sass +3 -0
- package/src/css/core/positioning.sass +5 -0
- package/src/css/variables.sass +4 -6
- package/src/directives/ScrollFire.js +1 -0
- package/src/icon-set.js +2 -4
- package/src/plugins/AppFullscreen.js +70 -53
- package/src/plugins/AppVisibility.js +2 -3
- package/src/plugins/BottomSheet.js +3 -5
- package/src/plugins/Dialog.js +3 -5
- package/src/plugins/LoadingBar.js +17 -18
- package/src/plugins/Notify.js +296 -295
- package/src/plugins/Platform.js +14 -14
- package/src/utils/clone.js +53 -4
- package/src/utils/date.js +4 -4
- package/src/utils/dom.js +2 -2
- package/src/utils/open-url.js +2 -2
- package/src/utils/patterns.js +1 -0
- package/src/utils/private/define-reactive-plugin.js +10 -8
- package/src/utils/private/focus-manager.js +8 -10
- package/src/utils/private/global-dialog.js +6 -8
- package/src/utils/private/inject-obj-prop.js +13 -0
- package/src/utils/private/is.js +2 -2
package/src/plugins/Notify.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
85
|
-
|
|
68
|
+
let Api
|
|
69
|
+
const notif = { textColor: 'white' }
|
|
86
70
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
71
|
+
if (config.ignoreDefaults !== true) {
|
|
72
|
+
Object.assign(notif, defaults)
|
|
73
|
+
}
|
|
91
74
|
|
|
92
|
-
|
|
93
|
-
|
|
75
|
+
if (Object(config) !== config) {
|
|
76
|
+
if (notif.type) {
|
|
77
|
+
Object.assign(notif, notifTypes[ notif.type ])
|
|
78
|
+
}
|
|
94
79
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
80
|
+
config = { message: config }
|
|
81
|
+
}
|
|
98
82
|
|
|
99
|
-
|
|
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
|
-
|
|
105
|
-
|
|
85
|
+
if (typeof notif.icon === 'function') {
|
|
86
|
+
notif.icon = notif.icon($q)
|
|
87
|
+
}
|
|
106
88
|
|
|
107
|
-
|
|
89
|
+
if (!notif.spinner) {
|
|
90
|
+
notif.spinner = false
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (notif.spinner === true) {
|
|
94
|
+
notif.spinner = QSpinner
|
|
95
|
+
}
|
|
108
96
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
97
|
+
notif.spinner = markRaw(notif.spinner)
|
|
98
|
+
}
|
|
112
99
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
153
|
-
|
|
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
|
-
|
|
156
|
-
|
|
157
|
-
notif.progressClass
|
|
158
|
-
? ` ${ notif.progressClass }`
|
|
159
|
-
: ''
|
|
160
|
-
)
|
|
169
|
+
: () => { dismiss() }
|
|
170
|
+
}))
|
|
161
171
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
172
|
+
if (notif.multiLine === void 0) {
|
|
173
|
+
notif.multiLine = notif.actions.length > 1
|
|
174
|
+
}
|
|
166
175
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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
|
-
|
|
182
|
-
|
|
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
|
-
|
|
188
|
-
|
|
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
|
-
|
|
199
|
-
notif.multiLine = notif.actions.length > 1
|
|
200
|
-
}
|
|
189
|
+
leftClass: notif.meta.hasText === true ? 'additional' : 'single',
|
|
201
190
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
+ (notif.classes !== void 0 ? ` ${ notif.classes }` : ''),
|
|
191
|
+
attrs: {
|
|
192
|
+
role: 'alert',
|
|
193
|
+
...notif.attrs
|
|
194
|
+
}
|
|
195
|
+
})
|
|
208
196
|
|
|
209
|
-
|
|
210
|
-
|
|
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
|
-
|
|
213
|
-
|
|
213
|
+
notif.meta.group = notif.group + '|' + notif.position
|
|
214
|
+
}
|
|
214
215
|
|
|
215
|
-
|
|
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
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
})
|
|
225
|
+
if (originalApi !== void 0) {
|
|
226
|
+
// reset timeout if any
|
|
227
|
+
clearTimeout(originalApi.notif.meta.timer)
|
|
222
228
|
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
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
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
256
|
-
|
|
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
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
Api = {
|
|
310
|
+
dismiss,
|
|
311
|
+
config,
|
|
312
|
+
notif
|
|
313
|
+
}
|
|
311
314
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
315
|
+
if (originalApi !== void 0) {
|
|
316
|
+
Object.assign(originalApi, Api)
|
|
317
|
+
return
|
|
318
|
+
}
|
|
316
319
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
dismiss()
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
+
addNotification(newNotif, $q, Api)
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
334
339
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
config,
|
|
338
|
-
notif
|
|
339
|
-
}
|
|
340
|
+
function removeNotification (notif) {
|
|
341
|
+
clearTimeout(notif.meta.timer)
|
|
340
342
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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
|
-
|
|
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
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
351
|
+
if (el) {
|
|
352
|
+
const { width, height } = getComputedStyle(el)
|
|
365
353
|
|
|
366
|
-
|
|
367
|
-
|
|
354
|
+
el.style.left = `${ el.offsetLeft }px`
|
|
355
|
+
el.style.width = width
|
|
356
|
+
el.style.height = height
|
|
357
|
+
}
|
|
368
358
|
|
|
369
|
-
|
|
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
|
-
|
|
361
|
+
if (typeof notif.onDismiss === 'function') {
|
|
362
|
+
notif.onDismiss()
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
376
366
|
|
|
377
|
-
|
|
378
|
-
|
|
367
|
+
function hasContent (str) {
|
|
368
|
+
return str !== void 0
|
|
369
|
+
&& str !== null
|
|
370
|
+
&& emptyRE.test(str) !== true
|
|
371
|
+
}
|
|
379
372
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
373
|
+
function logError (error, config) {
|
|
374
|
+
console.error(`Notify: ${ error }`, config)
|
|
375
|
+
return false
|
|
376
|
+
}
|
|
384
377
|
|
|
385
|
-
|
|
378
|
+
function getComponent () {
|
|
379
|
+
return createComponent({
|
|
380
|
+
name: 'QNotifications',
|
|
386
381
|
|
|
387
|
-
|
|
388
|
-
|
|
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(
|
|
522
|
+
createChildApp(getComponent(), parentApp).mount(el)
|
|
522
523
|
}
|
|
523
524
|
}
|
|
524
525
|
}
|