waibu-bootstrap 1.2.5 → 1.2.7
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 +1 -1
- package/waibuMpa/theme/component/factory/app-launcher.js +1 -1
- package/waibuMpa/theme/component/factory/form-select-ext.js +5 -5
- package/waibuMpa/theme/component/factory/nav-dropdown-setting.js +4 -4
- package/waibuMpa/theme/component/factory/navbar.js +1 -1
- package/waibuMpa/theme/component/factory/nav-dropdown-user.js +0 -64
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ async function appLauncher () {
|
|
|
21
21
|
launcher += '<c:navbar padding="y-0">\n<c:nav tag="ul" dim="width:100" flex="justify-content:end">\n'
|
|
22
22
|
for (const t of toolbar) {
|
|
23
23
|
if (t === 'home') launcher += '<c:nav-item href="/" icon="house" padding="end-2" />\n'
|
|
24
|
-
if (t === 'user') launcher += '<c:nav-dropdown-user padding="end-2" />\n'
|
|
24
|
+
if (t === 'user' && this.plugin.app.sumba) launcher += '<c:sumba-nav-dropdown-user padding="end-2" />\n'
|
|
25
25
|
if (t === '-') launcher += '<c:nav-divider />\n'
|
|
26
26
|
if (t === 'fullscreen') launcher += '<c:nav-toggle-fullscreen padding="end-2" />\n'
|
|
27
27
|
if (t === 'darkmode') launcher += '<c:nav-dropdown-darkmode padding="end-2" dropdown-menudir="end" />\n'
|
|
@@ -82,15 +82,15 @@ async function formSelectExt () {
|
|
|
82
82
|
const group = groupAttrs(this.params.attr, ['remote'])
|
|
83
83
|
if (group.remote) {
|
|
84
84
|
group.remote.url = routePath(group.remote.url)
|
|
85
|
-
group.remote.searchField = group.remote.searchField ?? '
|
|
86
|
-
group.remote.labelField = group.remote.labelField ?? '
|
|
85
|
+
group.remote.searchField = group.remote.searchField ?? 'id'
|
|
86
|
+
group.remote.labelField = group.remote.labelField ?? 'id'
|
|
87
87
|
group.remote.valueField = group.remote.valueField ?? 'id'
|
|
88
88
|
opts = `{
|
|
89
89
|
searchField: '${group.remote.searchField}',
|
|
90
90
|
labelField: '${group.remote.labelField}',
|
|
91
91
|
valueField: '${group.remote.valueField}',
|
|
92
92
|
load: (query, callback) => {
|
|
93
|
-
fetch('${group.remote.url}?query=${group.remote.searchField}
|
|
93
|
+
fetch('${group.remote.url}?query=${group.remote.searchField}:~\\'' + query + '\\'')
|
|
94
94
|
.then(resp => resp.json())
|
|
95
95
|
.then(json => {
|
|
96
96
|
callback(json.data)
|
|
@@ -101,11 +101,11 @@ async function formSelectExt () {
|
|
|
101
101
|
},
|
|
102
102
|
render: {
|
|
103
103
|
option: (data, escape) => {
|
|
104
|
-
return '<div>' + escape(data.
|
|
104
|
+
return '<div>' + escape(data.${group.remote.labelField}) + '</div>'
|
|
105
105
|
},
|
|
106
106
|
item: (data, escape) => {
|
|
107
107
|
$dispatch('formselectext', { id: '${this.params.attr.id}', data })
|
|
108
|
-
return '<div>' + escape(data.
|
|
108
|
+
return '<div>' + escape(data.${group.remote.labelField}) + '</div>'
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}`
|
|
@@ -54,15 +54,15 @@ async function navDropdownSetting () {
|
|
|
54
54
|
<c:dropdown-item divider />
|
|
55
55
|
<c:dropdown-item t:content="fullscreen"
|
|
56
56
|
x-data="{
|
|
57
|
-
inText:
|
|
58
|
-
outText:
|
|
57
|
+
inText: \`${this.component.req.t('fullscreen')}\`,
|
|
58
|
+
outText: \`${this.component.req.t('exitFullscreen')}\`,
|
|
59
59
|
async toggle () {
|
|
60
60
|
const el = document.querySelector('body')
|
|
61
61
|
if (!document.fullscreenElement) {
|
|
62
62
|
try {
|
|
63
63
|
await el.requestFullscreen()
|
|
64
64
|
} catch (err) {
|
|
65
|
-
await wbs.notify('cantGoFullscreen'
|
|
65
|
+
await wbs.notify(\`${this.component.req.t('cantGoFullscreen')}\`, { type: 'danger' })
|
|
66
66
|
}
|
|
67
67
|
} else {
|
|
68
68
|
document.exitFullscreen()
|
|
@@ -88,7 +88,7 @@ async function navDropdownSetting () {
|
|
|
88
88
|
id="${id}"
|
|
89
89
|
x-data="{
|
|
90
90
|
async signout () {
|
|
91
|
-
await wbs.confirmation(
|
|
91
|
+
await wbs.confirmation(\`${this.component.req.t('signoutWarning')}\`, { ok: '${id}:post', close: 'y' })
|
|
92
92
|
},
|
|
93
93
|
post () {
|
|
94
94
|
wmpa.postForm({}, '${routePath('sumba:/signout')}')
|
|
@@ -39,7 +39,7 @@ async function navbar () {
|
|
|
39
39
|
const id = generateId()
|
|
40
40
|
if (this.params.group.drawer) this.params.group.drawer.id = id
|
|
41
41
|
const btn = `<button class="navbar-toggler" type="button" data-bs-toggle="${type}" ` +
|
|
42
|
-
`data-bs-target="#${id}" aria-controls="${id}"${this.params.attr.drawer ? '' : ' aria-expanded="false"'} aria-label="${this.component.req.t('
|
|
42
|
+
`data-bs-target="#${id}" aria-controls="${id}"${this.params.attr.drawer ? '' : ' aria-expanded="false"'} aria-label="${this.component.req.t('toggleNavigation')}">` +
|
|
43
43
|
'<span class="navbar-toggler-icon"></span></button>'
|
|
44
44
|
if (type === 'offcanvas') html = await this.component.buildTag({ tag: 'drawer', attr: this.params.group.drawer, html })
|
|
45
45
|
else html = `<div class="collapse navbar-collapse justify-content-between" id="${id}">${html}</div>`
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
async function navDropdownUser () {
|
|
2
|
-
return class NavDropdownUser extends this.baseFactory {
|
|
3
|
-
build = async () => {
|
|
4
|
-
if (!this.plugin.app.sumba) {
|
|
5
|
-
this.params.noTag = true
|
|
6
|
-
this.params.html = ''
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
const { has, omit } = this.plugin.lib._
|
|
10
|
-
const { routePath } = this.plugin.app.waibu
|
|
11
|
-
const { req } = this.component
|
|
12
|
-
const icon = this.component.req.iconset ? await this.component.buildTag({ tag: 'icon', attr: { name: 'person' } }) : ''
|
|
13
|
-
let text = ''
|
|
14
|
-
if (has(this.params.attr, 'title')) {
|
|
15
|
-
if (req.user) {
|
|
16
|
-
if (this.params.attr.title === 'short') text = `${req.user.firstName} ${req.user.lastName[0]}.`
|
|
17
|
-
else if (['firstName', 'lastName', 'username'].includes(this.params.attr.title)) text = req.user[this.params.attr.title]
|
|
18
|
-
else text = `${req.user.firstName} ${req.user.lastName}`
|
|
19
|
-
} else text = req.t('guest')
|
|
20
|
-
}
|
|
21
|
-
const html = []
|
|
22
|
-
const attr = omit(this.params.attr, ['text'])
|
|
23
|
-
attr.dropdown = true
|
|
24
|
-
attr.content = `${icon} ${text}`
|
|
25
|
-
if (this.params.attr.noMenu) {
|
|
26
|
-
delete attr.dropdown
|
|
27
|
-
delete attr.dropdownMenu
|
|
28
|
-
attr.href = routePath(this.component.req.user ? 'sumba:/your-stuff/profile' : 'sumba:/signin')
|
|
29
|
-
} else {
|
|
30
|
-
if (req.user) {
|
|
31
|
-
if (this.params.attr.fancyProfile) {
|
|
32
|
-
const replacer = 'sumba.asset:/user-profile.png'
|
|
33
|
-
const profile = await this.component.buildSentence(`
|
|
34
|
-
<div>
|
|
35
|
-
<c:dropdown-item href="sumba:/your-stuff/profile">
|
|
36
|
-
<c:img src="dobo:/attachment/SumbaUser/${req.user.id}/profile/main.png?notfound=${replacer}" responsive rounded />
|
|
37
|
-
<c:div margin="top-1" text="align:center">${req.user.firstName} ${req.user.lastName}</c:div>
|
|
38
|
-
</c:dropdown-item>
|
|
39
|
-
</div>
|
|
40
|
-
`)
|
|
41
|
-
html.push(profile)
|
|
42
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
|
|
43
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/your-stuff/change-password') }, html: this.component.req.t('changePassword') }))
|
|
44
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signout') }, html: this.component.req.t('signout') }))
|
|
45
|
-
} else {
|
|
46
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/your-stuff/profile') }, html: this.component.req.t('yourProfile') }))
|
|
47
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/your-stuff/change-password') }, html: this.component.req.t('changePassword') }))
|
|
48
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
|
|
49
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signout') }, html: this.component.req.t('signout') }))
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signin') }, html: this.component.req.t('signin') }))
|
|
53
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
|
|
54
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/user/signup') }, html: this.component.req.t('signup') }))
|
|
55
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/user/forgot-password') }, html: this.component.req.t('forgotPassword') }))
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
this.params.noTag = true
|
|
59
|
-
this.params.html = await this.component.buildTag({ tag: 'navItem', attr, html: html.join('\n') })
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default navDropdownUser
|