waibu-bootstrap 1.0.14 → 1.0.16
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/drawer.js +8 -8
- package/waibuMpa/theme/component/factory/form.js +1 -1
- package/waibuMpa/theme/component/factory/modal.js +8 -8
- package/waibuMpa/theme/component/factory/nav-dropdown-darkmode.js +2 -2
- package/waibuMpa/theme/component/factory/nav-dropdown-language.js +2 -2
- package/waibuMpa/theme/component/factory/nav-dropdown-setting.js +8 -8
- package/waibuMpa/theme/component/factory/nav-dropdown-user.js +7 -7
- package/waibuMpa/theme/component/method/after-build-tag/_lib.js +1 -1
- package/waibuStatic/asset/js/wbs.js +8 -8
- /package/{bajoI18N/resource → bajo/intl}/id.json +0 -0
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ async function drawer () {
|
|
|
13
13
|
const { isString, omit, trim } = 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, ['
|
|
16
|
+
const group = groupAttrs(this.params.attr, ['trigger'])
|
|
17
17
|
this.params.attr.responsive = this.params.attr.responsive ?? true
|
|
18
18
|
this.params.attr.class.push(parseVariant.call(this, { cls, value: this.params.attr.responsive, values: breakpoints }))
|
|
19
19
|
this.params.attr = group._
|
|
@@ -39,15 +39,15 @@ async function drawer () {
|
|
|
39
39
|
}
|
|
40
40
|
if (this.params.attr.divider) header.push('<hr class="m-0" />')
|
|
41
41
|
this.params.html = `${header.join('\n')}<div${this.params.attr.noPadding ? '' : ' class="offcanvas-body"'}>${this.params.html}</div>`
|
|
42
|
-
if (group.
|
|
43
|
-
group.
|
|
44
|
-
group.
|
|
45
|
-
group.
|
|
46
|
-
if (this.params.attr.responsive) group.
|
|
42
|
+
if (group.trigger) {
|
|
43
|
+
group.trigger.dataBsTarget = `#${this.params.attr.id}`
|
|
44
|
+
group.trigger.dataBsToggle = 'offcanvas'
|
|
45
|
+
group.trigger.ariaControls = this.params.attr.id
|
|
46
|
+
if (this.params.attr.responsive) group.trigger.display = `type:none-${this.params.attr.responsive}`
|
|
47
47
|
const btnParams = {
|
|
48
48
|
tag: 'btn',
|
|
49
|
-
attr: group.
|
|
50
|
-
html: group._.
|
|
49
|
+
attr: group.trigger,
|
|
50
|
+
html: group._.trigger
|
|
51
51
|
}
|
|
52
52
|
this.params.prepend = await this.component.buildTag(btnParams)
|
|
53
53
|
}
|
|
@@ -19,7 +19,7 @@ async function form () {
|
|
|
19
19
|
const group = groupAttrs(this.params.attr, ['grid'])
|
|
20
20
|
this.params.attr = group._
|
|
21
21
|
if (group.grid) this.params.html = await this.component.buildTag({ tag: 'gridRow', attr: group.grid, html: this.params.html })
|
|
22
|
-
if (this.params.attr.button === true) this.params.attr.button = 'reset:
|
|
22
|
+
if (this.params.attr.button === true) this.params.attr.button = 'reset:reset-link submit:submit-primary'
|
|
23
23
|
if (this.params.attr.button) {
|
|
24
24
|
const rBtns = []
|
|
25
25
|
const lBtns = []
|
|
@@ -15,7 +15,7 @@ async function modal () {
|
|
|
15
15
|
const { isString, omit } = this.plugin.app.bajo.lib._
|
|
16
16
|
const { groupAttrs } = this.plugin.app.waibuMpa
|
|
17
17
|
const { $ } = this.component
|
|
18
|
-
const group = groupAttrs(this.params.attr, ['
|
|
18
|
+
const group = groupAttrs(this.params.attr, ['trigger'])
|
|
19
19
|
this.params.attr = group._
|
|
20
20
|
this.params.attr.class.push(this.params.attr.noFade ? '' : 'fade')
|
|
21
21
|
if (this.params.attr.noDismiss) this.params.attr.dataBsBackdrop = 'static'
|
|
@@ -40,16 +40,16 @@ async function modal () {
|
|
|
40
40
|
` ${!this.params.attr.size ? '' : parseSimple.call(this, { cls, value: this.params.attr.size, values: modalSizes })}` +
|
|
41
41
|
` ${this.params.attr.noCenter ? '' : 'modal-dialog-centered'} ${fullscreen}">` +
|
|
42
42
|
`<div class="modal-content">${this.params.html}</div></div>`
|
|
43
|
-
if (group.
|
|
44
|
-
group.
|
|
45
|
-
group.
|
|
46
|
-
group.
|
|
43
|
+
if (group.trigger) {
|
|
44
|
+
group.trigger.dataBsTarget = `#${this.params.attr.id}`
|
|
45
|
+
group.trigger.dataBsToggle = 'modal'
|
|
46
|
+
group.trigger.ariaControls = this.params.attr.id
|
|
47
47
|
const btnParams = {
|
|
48
48
|
tag: 'btn',
|
|
49
|
-
attr: group.
|
|
50
|
-
html: group._.
|
|
49
|
+
attr: group.trigger,
|
|
50
|
+
html: group._.trigger
|
|
51
51
|
}
|
|
52
|
-
const pos = group.
|
|
52
|
+
const pos = group.trigger.onEnd ? 'append' : 'prepend'
|
|
53
53
|
this.params[pos] = await this.component.buildTag(btnParams)
|
|
54
54
|
}
|
|
55
55
|
this.params.attr = omit(this.params.attr, ['title', 'fullscreen'])
|
|
@@ -13,8 +13,8 @@ async function navDropdownDarkmode () {
|
|
|
13
13
|
content
|
|
14
14
|
}
|
|
15
15
|
const html = [
|
|
16
|
-
await this.component.buildTag({ tag: 'dropdownItem', attr: { href: this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'false') }), active: !this.component.req.darkMode }, html: this.component.req.t('
|
|
17
|
-
await this.component.buildTag({ tag: 'dropdownItem', attr: { href: this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'true') }), active: this.component.req.darkMode }, html: this.component.req.t('
|
|
16
|
+
await this.component.buildTag({ tag: 'dropdownItem', attr: { href: this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'false') }), active: !this.component.req.darkMode }, html: this.component.req.t('brightMode') }),
|
|
17
|
+
await this.component.buildTag({ tag: 'dropdownItem', attr: { href: this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'true') }), active: this.component.req.darkMode }, html: this.component.req.t('darkMode') })
|
|
18
18
|
].join('\n')
|
|
19
19
|
this.params.noTag = true
|
|
20
20
|
this.params.html = await this.component.buildTag({ tag: 'navItem', attr, html })
|
|
@@ -2,7 +2,7 @@ async function navDropdownLanguage () {
|
|
|
2
2
|
return class NavDropdownLanguage extends this.baseFactory {
|
|
3
3
|
async build () {
|
|
4
4
|
const { camelCase } = this.plugin.app.bajo.lib._
|
|
5
|
-
const {
|
|
5
|
+
const { supported } = this.plugin.app.bajo.config.intl
|
|
6
6
|
const lang = this.component.req.lang
|
|
7
7
|
const attr = {
|
|
8
8
|
dropdown: true,
|
|
@@ -11,7 +11,7 @@ async function navDropdownLanguage () {
|
|
|
11
11
|
content: lang.toUpperCase()
|
|
12
12
|
}
|
|
13
13
|
const html = []
|
|
14
|
-
for (const s of
|
|
14
|
+
for (const s of supported) {
|
|
15
15
|
html.push(await this.component.buildTag({
|
|
16
16
|
tag: 'dropdownItem',
|
|
17
17
|
attr: { href: this.component.buildUrl({ params: { lang: s } }), active: lang === s },
|
|
@@ -2,7 +2,7 @@ async function navDropdownSetting () {
|
|
|
2
2
|
return class NavDropdownSetting extends this.baseFactory {
|
|
3
3
|
async build () {
|
|
4
4
|
const { set, camelCase } = this.plugin.app.bajo.lib._
|
|
5
|
-
const {
|
|
5
|
+
const { supported } = this.plugin.app.bajo.config.intl
|
|
6
6
|
const { groupAttrs } = this.plugin.app.waibuMpa
|
|
7
7
|
const { generateId } = this.plugin.app.bajo
|
|
8
8
|
const { routePath } = this.plugin.app.waibu
|
|
@@ -18,28 +18,28 @@ async function navDropdownSetting () {
|
|
|
18
18
|
<c:dropdown-item href="${this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'false') })}" ${this.component.req.darkMode ? '' : 'active'} t:content="Bright" />
|
|
19
19
|
<c:dropdown-item href="${this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'true') })}" ${!this.component.req.darkMode ? '' : 'active'} t:content="Dark" />
|
|
20
20
|
`
|
|
21
|
-
if (
|
|
21
|
+
if (supported.length > 0) {
|
|
22
22
|
html += `
|
|
23
23
|
<c:dropdown-item divider />
|
|
24
24
|
<c:dropdown-item header t:content="Language" />
|
|
25
25
|
`
|
|
26
|
-
for (const s of
|
|
26
|
+
for (const s of supported) {
|
|
27
27
|
html += `<c:dropdown-item href="${this.component.buildUrl({ params: { lang: s } })}" ${this.component.req.lang === s ? 'active' : ''} t:content="${camelCase('lang ' + s)}" />`
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
html += `
|
|
31
31
|
<c:dropdown-item divider />
|
|
32
|
-
<c:dropdown-item t:content="
|
|
32
|
+
<c:dropdown-item t:content="fullscreen"
|
|
33
33
|
x-data="{
|
|
34
|
-
inText: '${this.component.req.t('
|
|
35
|
-
outText: '${this.component.req.t('
|
|
34
|
+
inText: '${this.component.req.t('fullscreen')}',
|
|
35
|
+
outText: '${this.component.req.t('exitFullscreen')}',
|
|
36
36
|
async toggle () {
|
|
37
37
|
const el = document.querySelector('body')
|
|
38
38
|
if (!document.fullscreenElement) {
|
|
39
39
|
try {
|
|
40
40
|
await el.requestFullscreen()
|
|
41
41
|
} catch (err) {
|
|
42
|
-
await wbs.notify('
|
|
42
|
+
await wbs.notify('cantGoFullscreen', { type: 'danger' })
|
|
43
43
|
}
|
|
44
44
|
} else {
|
|
45
45
|
document.exitFullscreen()
|
|
@@ -61,7 +61,7 @@ async function navDropdownSetting () {
|
|
|
61
61
|
if (this.component.req.user) {
|
|
62
62
|
const id = generateId('alpha')
|
|
63
63
|
html += `
|
|
64
|
-
<c:dropdown-item t:content="
|
|
64
|
+
<c:dropdown-item t:content="signout"
|
|
65
65
|
id="${id}"
|
|
66
66
|
x-data="{
|
|
67
67
|
async signout () {
|
|
@@ -3,7 +3,7 @@ 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
|
-
let text = this.component.req.user ? `${this.component.req.user.firstName} ${this.component.req.user.lastName}` : this.component.req.t('
|
|
6
|
+
let text = this.component.req.user ? `${this.component.req.user.firstName} ${this.component.req.user.lastName}` : this.component.req.t('guest')
|
|
7
7
|
if (this.params.attr.noText) text = ''
|
|
8
8
|
const html = []
|
|
9
9
|
const attr = {
|
|
@@ -18,15 +18,15 @@ async function navDropdownUser () {
|
|
|
18
18
|
attr.href = routePath(this.component.req.user ? 'sumba:/my-stuff/profile' : 'sumba:/signin')
|
|
19
19
|
} else {
|
|
20
20
|
if (this.component.req.user) {
|
|
21
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/my-stuff/profile') }, html: this.component.req.t('
|
|
22
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/my-stuff/change-password') }, html: this.component.req.t('
|
|
21
|
+
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/my-stuff/profile') }, html: this.component.req.t('yourProfile') }))
|
|
22
|
+
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/my-stuff/change-password') }, html: this.component.req.t('changePassword') }))
|
|
23
23
|
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
|
|
24
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signout') }, html: this.component.req.t('
|
|
24
|
+
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signout') }, html: this.component.req.t('signout') }))
|
|
25
25
|
} else {
|
|
26
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signin') }, html: this.component.req.t('
|
|
26
|
+
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signin') }, html: this.component.req.t('signin') }))
|
|
27
27
|
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
|
|
28
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/user/signup') }, html: this.component.req.t('
|
|
29
|
-
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/user/forgot-password') }, html: this.component.req.t('
|
|
28
|
+
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/user/signup') }, html: this.component.req.t('signup') }))
|
|
29
|
+
html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/user/forgot-password') }, html: this.component.req.t('forgotPassword') }))
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
this.params.noTag = true
|
|
@@ -6,7 +6,7 @@ export const heights = ['1', 'sm', 'base', 'lg']
|
|
|
6
6
|
export const cvariants = ['emphasis', 'secondary', 'tertiary']
|
|
7
7
|
export const cbgvariants = ['subtle', 'secondary', 'tertiary']
|
|
8
8
|
export const opacities = ['25', '50', '75', '100']
|
|
9
|
-
export const aligns = ['top', 'bottom', 'start', 'end']
|
|
9
|
+
export const aligns = ['top', 'bottom', 'start', 'end', 'middle']
|
|
10
10
|
export const dirs = ['up', 'down', 'start', 'end']
|
|
11
11
|
export const widths = ['0', '1', '2', '3', '4', '5']
|
|
12
12
|
export const dims = ['25', '50', '75', '100', 'auto']
|
|
@@ -65,10 +65,10 @@ class Wbs {
|
|
|
65
65
|
}
|
|
66
66
|
opts.icon = 'signQuestion'
|
|
67
67
|
opts.buttons = [
|
|
68
|
-
{ label: '
|
|
69
|
-
{ label: '
|
|
68
|
+
{ label: 'cancel', color: 'secondary', dismiss: true },
|
|
69
|
+
{ label: 'ok', color: 'primary', dismiss: !opts.ok, alertType: 'confirmation', handler: opts.ok, handlerOpts: opts.opts ?? '', close: opts.close ?? '' }
|
|
70
70
|
]
|
|
71
|
-
return await this.alert(msg, opts.title ?? '
|
|
71
|
+
return await this.alert(msg, opts.title ?? 'confirmation', opts)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
async prompt (msg, handler, opts = {}) {
|
|
@@ -88,8 +88,8 @@ class Wbs {
|
|
|
88
88
|
].join('\n')
|
|
89
89
|
opts.close = opts.close ?? ''
|
|
90
90
|
opts.buttons = [
|
|
91
|
-
{ label: '
|
|
92
|
-
{ label: '
|
|
91
|
+
{ label: 'cancel', color: 'secondary', dismiss: true },
|
|
92
|
+
{ label: 'ok', type: 'submit', color: 'primary', dismiss: !opts.ok, alertType: 'prompt', handler: opts.ok, handlerOpts: opts.opts ?? '', close: opts.close ?? '' }
|
|
93
93
|
]
|
|
94
94
|
return await this.alert(msg, opts.title ?? 'Prompt', opts)
|
|
95
95
|
}
|
|
@@ -121,9 +121,9 @@ class Wbs {
|
|
|
121
121
|
buttons = buttons ?? [{ label: 'OK', color: 'primary', dismiss: true }]
|
|
122
122
|
icon = icon ?? 'sign' + (type.charAt(0).toUpperCase() + type.slice(1))
|
|
123
123
|
switch (type) {
|
|
124
|
-
case 'danger': title = title ?? '
|
|
125
|
-
case 'warning': title = title ?? '
|
|
126
|
-
default: title = title ?? '
|
|
124
|
+
case 'danger': title = title ?? 'error'; break
|
|
125
|
+
case 'warning': title = title ?? 'warning'; break
|
|
126
|
+
default: title = title ?? 'information'
|
|
127
127
|
}
|
|
128
128
|
buttons = buttons.map(b => {
|
|
129
129
|
b.handlerOpts = wmpa.toBase64(JSON.stringify(b.handlerOpts))
|
|
File without changes
|