waibu-bootstrap 1.0.11 → 1.0.13
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/package.json
CHANGED
|
@@ -23,8 +23,8 @@ async function img () {
|
|
|
23
23
|
if (isString(this.params.attr['@mouseleave'])) mouseleave.push(...this.params.attr['@mouseleave'].split('\n'))
|
|
24
24
|
if (isString(this.params.attr.srcHover)) {
|
|
25
25
|
this.params.attr.srcStby = this.params.attr.src
|
|
26
|
-
mouseenter.unshift(
|
|
27
|
-
mouseleave.unshift(
|
|
26
|
+
mouseenter.unshift("$el.src = $el.getAttribute('src-hover')")
|
|
27
|
+
mouseleave.unshift("$el.src = $el.getAttribute('src-stby')")
|
|
28
28
|
}
|
|
29
29
|
if (mouseenter.length > 0) this.params.attr['@mouseenter'] = mouseenter.join('\n')
|
|
30
30
|
if (mouseleave.length > 0) this.params.attr['@mouseleave'] = mouseleave.join('\n')
|
|
@@ -3,11 +3,13 @@ async function navDropdownUser () {
|
|
|
3
3
|
async build () {
|
|
4
4
|
const { routePath } = this.plugin.app.waibu
|
|
5
5
|
const icon = this.component.req.iconset ? await this.component.buildTag({ tag: 'icon', attr: { name: 'person' } }) : ''
|
|
6
|
-
|
|
6
|
+
let text = this.component.req.user ? `${this.component.req.user.firstName} ${this.component.req.user.lastName}` : this.component.req.t('Guest')
|
|
7
|
+
if (this.params.attr.noText) text = ''
|
|
7
8
|
const html = []
|
|
8
9
|
const attr = {
|
|
9
10
|
dropdown: true,
|
|
10
|
-
|
|
11
|
+
dropdownDir: this.params.attr.dropdownDir,
|
|
12
|
+
dropdownMenudir: this.params.attr.dropdownMenudir,
|
|
11
13
|
content: `${icon} ${text}`
|
|
12
14
|
}
|
|
13
15
|
if (this.params.attr.noMenu) {
|
|
@@ -13,7 +13,7 @@ async function navItem () {
|
|
|
13
13
|
const { isString } = this.plugin.app.bajo.lib._
|
|
14
14
|
const { groupAttrs } = this.plugin.app.waibuMpa
|
|
15
15
|
const { $ } = this.component
|
|
16
|
-
const group = groupAttrs(this.params.attr, ['dropdown'])
|
|
16
|
+
const group = groupAttrs(this.params.attr, ['dropdown', 'badge'])
|
|
17
17
|
if (group.dropdown) {
|
|
18
18
|
this.params.attr = group._
|
|
19
19
|
this.params.attr.class.push('dropdown-toggle')
|
|
@@ -35,6 +35,12 @@ async function navItem () {
|
|
|
35
35
|
}
|
|
36
36
|
this.params.prepend = `<li class="${cls}${group.dropdown ? ' dropdown' : ''}${(group.dropdown ?? {}).dir ? (' drop' + group.dropdown.dir) : ''}">`
|
|
37
37
|
this.params.append = '</li>'
|
|
38
|
+
if (group.badge) {
|
|
39
|
+
group.badge.color = group.badge.color ?? 'danger'
|
|
40
|
+
group.badge.content = group.badge.content ?? ''
|
|
41
|
+
const badge = await this.component.buildSentence(`<c:badge position="relative top-0 start-0 true" rounded="type:pill" background="color:${group.badge.color}" t:content="${group.badge.content}" />`)
|
|
42
|
+
this.params.html += badge
|
|
43
|
+
}
|
|
38
44
|
delete this.params.attr.dropdown
|
|
39
45
|
}
|
|
40
46
|
|