waibu-bootstrap 2.2.0 → 2.2.2
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.
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
function formatSentence (item, params) {
|
|
2
2
|
const { kebabCase, omit, merge } = this.app.lib._
|
|
3
|
+
const { isSet } = this.app.lib.aneka
|
|
4
|
+
if (item.divider) return '<c:li class="nav-item"><c:hr margin="y-2"/></c:li>'
|
|
3
5
|
const cmp = kebabCase(item.component ?? 'navItem')
|
|
4
6
|
const icon = item.icon
|
|
5
7
|
const html = item.html ?? ''
|
|
@@ -8,6 +10,7 @@ function formatSentence (item, params) {
|
|
|
8
10
|
if (this.params.attr.expanded) attr.rounded = 'width:0'
|
|
9
11
|
merge(attr, omit(item, ['component', 'icon', 'ohref', 'html']))
|
|
10
12
|
if (this.params.attr.text && !attr.active) attr.text = this.params.attr.text
|
|
13
|
+
if (!isSet(attr.active)) attr.active = this.component.req.url.split('?')[0] === attr.href
|
|
11
14
|
if (!attr.active) attr.background = 'color:transparent'
|
|
12
15
|
const result = [`<c:${cmp}`]
|
|
13
16
|
for (const k in attr) {
|
|
@@ -52,22 +55,20 @@ async function sidebar () {
|
|
|
52
55
|
this.params.attr.align = this.params.attr.align ?? 'center'
|
|
53
56
|
this.params.attr.margin = 'all-0'
|
|
54
57
|
if (this.params.attr.autoFill) {
|
|
58
|
+
// top
|
|
55
59
|
let items = filter(this.component.locals.sidebar ?? [], s => !s.bottom)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
html.push(formatSentence.call(this, item, this.params))
|
|
60
|
-
}
|
|
61
|
-
html.push('</c:nav>')
|
|
60
|
+
html.push(`<c:nav tag="ul" flex="column" margin="bottom-auto" text="align:${this.params.attr.align}" type="pills" ${this.params.attr.expanded ? '' : 'padding="all-1"'}>`)
|
|
61
|
+
for (const item of items) {
|
|
62
|
+
html.push(formatSentence.call(this, item, this.params))
|
|
62
63
|
}
|
|
64
|
+
html.push('</c:nav>')
|
|
65
|
+
// bottom
|
|
66
|
+
html.push(`<c:nav tag="ul" flex="column" text="align:${this.params.attr.align}" type="pills" ${this.params.attr.expanded ? '' : 'padding="all-1"'} ${this.params.attr.fancyProfile ? 'fancy-profile' : ''}>`)
|
|
63
67
|
items = filter(this.component.locals.sidebar ?? [], s => s.bottom)
|
|
64
|
-
|
|
65
|
-
html.push(
|
|
66
|
-
for (const item of items) {
|
|
67
|
-
html.push(formatSentence.call(this, item, this.params))
|
|
68
|
-
}
|
|
69
|
-
html.push('</c:nav>')
|
|
68
|
+
for (const item of items) {
|
|
69
|
+
html.push(formatSentence.call(this, item, this.params))
|
|
70
70
|
}
|
|
71
|
+
html.push('</c:nav>')
|
|
71
72
|
}
|
|
72
73
|
} else {
|
|
73
74
|
this.params.attr.style.width = this.params.attr.style.width ?? '280px'
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED