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
- if (items.length > 0) {
57
- 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"'}>`)
58
- for (const item of items) {
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
- if (items.length > 0) {
65
- 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' : ''}>`)
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-bootstrap",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Bootstrap suport for Waibu Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -3,6 +3,8 @@
3
3
  ## 2026-02-09
4
4
 
5
5
  - [2.2.0] Start using simplified ```webAppCtx```
6
+ - [2.2.1] Bug fix on ```sidebar``` widget
7
+ - [2.2.2] Bug fix on ```sidebar``` widget
6
8
 
7
9
  ## 2026-02-04
8
10
 
@@ -1,5 +0,0 @@
1
- async function waibuMpaAfterBuildPage ({ $, theme, req }) {
2
- if (req.darkMode && theme.name === 'bootstrap') $('body').attr('data-bs-theme', 'dark')
3
- }
4
-
5
- export default waibuMpaAfterBuildPage