waibu-bootstrap 1.0.19 → 1.1.0

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.
Files changed (72) hide show
  1. package/package.json +1 -1
  2. package/waibuMpa/theme/component/factory/accordion-item.js +1 -1
  3. package/waibuMpa/theme/component/factory/accordion.js +1 -1
  4. package/waibuMpa/theme/component/factory/alert.js +1 -1
  5. package/waibuMpa/theme/component/factory/app-launcher-trigger.js +1 -1
  6. package/waibuMpa/theme/component/factory/app-launcher.js +1 -1
  7. package/waibuMpa/theme/component/factory/badge.js +1 -1
  8. package/waibuMpa/theme/component/factory/blockquote.js +1 -1
  9. package/waibuMpa/theme/component/factory/breadcrumb-item.js +1 -1
  10. package/waibuMpa/theme/component/factory/breadcrumb.js +1 -1
  11. package/waibuMpa/theme/component/factory/btn-back-to-top.js +1 -1
  12. package/waibuMpa/theme/component/factory/btn-group.js +1 -1
  13. package/waibuMpa/theme/component/factory/btn.js +1 -1
  14. package/waibuMpa/theme/component/factory/card-footer.js +1 -1
  15. package/waibuMpa/theme/component/factory/card-header.js +1 -1
  16. package/waibuMpa/theme/component/factory/card.js +1 -1
  17. package/waibuMpa/theme/component/factory/carousel-item.js +1 -1
  18. package/waibuMpa/theme/component/factory/carousel.js +1 -1
  19. package/waibuMpa/theme/component/factory/collapse.js +1 -1
  20. package/waibuMpa/theme/component/factory/container.js +1 -1
  21. package/waibuMpa/theme/component/factory/drawer.js +1 -1
  22. package/waibuMpa/theme/component/factory/dropdown-item.js +1 -1
  23. package/waibuMpa/theme/component/factory/dropdown.js +1 -1
  24. package/waibuMpa/theme/component/factory/fieldset.js +1 -1
  25. package/waibuMpa/theme/component/factory/figure.js +1 -1
  26. package/waibuMpa/theme/component/factory/form-check-toggle.js +1 -1
  27. package/waibuMpa/theme/component/factory/form-check.js +1 -1
  28. package/waibuMpa/theme/component/factory/form-color.js +1 -1
  29. package/waibuMpa/theme/component/factory/form-date.js +1 -1
  30. package/waibuMpa/theme/component/factory/form-datetime.js +1 -1
  31. package/waibuMpa/theme/component/factory/form-file.js +1 -1
  32. package/waibuMpa/theme/component/factory/form-input.js +1 -1
  33. package/waibuMpa/theme/component/factory/form-password.js +1 -1
  34. package/waibuMpa/theme/component/factory/form-plaintext.js +1 -1
  35. package/waibuMpa/theme/component/factory/form-radio-toggle.js +1 -1
  36. package/waibuMpa/theme/component/factory/form-radio.js +1 -1
  37. package/waibuMpa/theme/component/factory/form-range.js +1 -1
  38. package/waibuMpa/theme/component/factory/form-select-country.js +1 -1
  39. package/waibuMpa/theme/component/factory/form-select-ext.js +1 -1
  40. package/waibuMpa/theme/component/factory/form-select.js +1 -1
  41. package/waibuMpa/theme/component/factory/form-switch.js +1 -1
  42. package/waibuMpa/theme/component/factory/form-textarea.js +1 -1
  43. package/waibuMpa/theme/component/factory/form-time.js +1 -1
  44. package/waibuMpa/theme/component/factory/form.js +1 -1
  45. package/waibuMpa/theme/component/factory/grid-col.js +1 -1
  46. package/waibuMpa/theme/component/factory/img.js +1 -1
  47. package/waibuMpa/theme/component/factory/list-item.js +1 -1
  48. package/waibuMpa/theme/component/factory/list.js +1 -1
  49. package/waibuMpa/theme/component/factory/masonry.js +1 -1
  50. package/waibuMpa/theme/component/factory/modal.js +1 -1
  51. package/waibuMpa/theme/component/factory/nav-divider.js +1 -1
  52. package/waibuMpa/theme/component/factory/nav-dropdown-darkmode.js +1 -1
  53. package/waibuMpa/theme/component/factory/nav-dropdown-language.js +1 -1
  54. package/waibuMpa/theme/component/factory/nav-dropdown-setting.js +20 -5
  55. package/waibuMpa/theme/component/factory/nav-dropdown-user.js +25 -12
  56. package/waibuMpa/theme/component/factory/nav-item-signout.js +1 -1
  57. package/waibuMpa/theme/component/factory/nav-item.js +1 -1
  58. package/waibuMpa/theme/component/factory/nav-toggle-fullscreen.js +1 -1
  59. package/waibuMpa/theme/component/factory/nav.js +1 -1
  60. package/waibuMpa/theme/component/factory/navbar.js +1 -1
  61. package/waibuMpa/theme/component/factory/pagination-item.js +1 -1
  62. package/waibuMpa/theme/component/factory/pagination.js +1 -1
  63. package/waibuMpa/theme/component/factory/progress-stack.js +1 -1
  64. package/waibuMpa/theme/component/factory/progress.js +1 -1
  65. package/waibuMpa/theme/component/factory/scrollspy.js +1 -1
  66. package/waibuMpa/theme/component/factory/sidebar.js +2 -2
  67. package/waibuMpa/theme/component/factory/table.js +1 -1
  68. package/waibuMpa/theme/component/factory/toast.js +1 -1
  69. package/waibuStatic/asset/css/wbs.css +6 -0
  70. /package/{bajo → plugin}/.alias +0 -0
  71. /package/{bajo → plugin}/.dependencies +0 -0
  72. /package/{bajo → plugin}/config.json +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-bootstrap",
3
- "version": "1.0.19",
3
+ "version": "1.1.0",
4
4
  "description": "Bootstrap suport for Waibu Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,7 +9,7 @@ async function accordionItem () {
9
9
  this.params.attr.body = this.params.attr.body ?? true
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  const { omit, without } = this.plugin.app.bajo.lib._
14
14
  const { groupAttrs } = this.plugin.app.waibuMpa
15
15
  const group = groupAttrs(this.params.attr, ['body'])
@@ -9,7 +9,7 @@ async function accordion () {
9
9
  if (this.params.attr.noBorder) this.params.attr.class.push('accordion-flush')
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  const { $ } = this.component
14
14
  if (!this.params.attr.alwaysOpen) {
15
15
  const me = this
@@ -13,7 +13,7 @@ async function alert () {
13
13
  if (this.params.attr.color) this.params.attr.class.push(parseVariant.call(this, { cls, value: this.params.attr.color, values: myColors, prepend: true }))
14
14
  }
15
15
 
16
- async build () {
16
+ build = async () => {
17
17
  const { isEmpty } = this.plugin.app.bajo.lib._
18
18
  const { $ } = this.component
19
19
  const html = $(`<div>${this.params.html}</div>`).children().each(function () {
@@ -19,7 +19,7 @@ async function appLauncherTrigger () {
19
19
  this.params.attr.imgDimHeight = this.params.attr.imgDimHeight ?? 48
20
20
  }
21
21
 
22
- async build () {
22
+ build = async () => {
23
23
  const { fastGlob } = this.plugin.app.bajo.lib
24
24
  const { omit } = this.plugin.app.bajo.lib._
25
25
  let logo = 'waibu'
@@ -8,7 +8,7 @@ async function appLauncher () {
8
8
  this.params.attr.type = this.params.attr.type ?? 'drawer'
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const { groupAttrs, attrToArray } = this.plugin.app.waibuMpa
13
13
  const group = groupAttrs(this.params.attr, ['trigger'])
14
14
  let launcher = `<c:drawer id="${this.params.attr.id}" t:title="Modules" no-padding>\n`
@@ -8,7 +8,7 @@ async function badge () {
8
8
  this.component.normalizeAttr(this.params, { tag: 'span' })
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const { isString, omit } = this.plugin.app.bajo.lib._
13
13
  if (isString(this.params.attr.alt)) this.params.html += `<span class="visually-hidden">${this.params.attr.alt}</span>`
14
14
  if (this.params.attr.dot) {
@@ -7,7 +7,7 @@ async function blockquote () {
7
7
  this.selector = '.' + cls
8
8
  }
9
9
 
10
- async build () {
10
+ build = async () => {
11
11
  const { isString } = this.plugin.app.bajo.lib._
12
12
  this.component.normalizeAttr(this.params, { cls })
13
13
  if (isString(this.params.attr.attribution)) {
@@ -8,7 +8,7 @@ async function breadcrumbItem () {
8
8
  this.component.normalizeAttr(this.params, { tag: 'li', cls })
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const { omit } = this.plugin.app.bajo.lib._
13
13
  const { attrToArray } = this.plugin.app.waibuMpa
14
14
  if (this.params.attr.href) {
@@ -37,7 +37,7 @@ async function breadcrumb () {
37
37
  this.component.normalizeAttr(this.params, { tag: 'ol', cls })
38
38
  }
39
39
 
40
- async build () {
40
+ build = async () => {
41
41
  const { isString, omit } = this.plugin.app.bajo.lib._
42
42
  const { routePath } = this.plugin.app.waibu
43
43
  const { urlToBreadcrumb, attrToArray } = this.plugin.app.waibuMpa
@@ -14,7 +14,7 @@ async function btnBackToTop () {
14
14
  }
15
15
  }
16
16
 
17
- async build () {
17
+ build = async () => {
18
18
  this.params.attr['x-data'] = `{
19
19
  scroll () {
20
20
  if (document.body.scrollTop > ${this.params.attr.revealAt} || document.documentElement.scrollTop > ${this.params.attr.revealAt}) {
@@ -11,7 +11,7 @@ async function btnGroup () {
11
11
  if (this.params.attr.size) this.params.attr.class.push(parseSimple.call(this, { cls, value: this.params.attr.size, values: sizes }))
12
12
  }
13
13
 
14
- async build () {
14
+ build = async () => {
15
15
  const { $ } = this.component
16
16
  const html = []
17
17
  $(`<div>${this.params.html}</div>`).children().each(function () {
@@ -11,7 +11,7 @@ async function btn () {
11
11
  this.params.attr.class.push(cls)
12
12
  }
13
13
 
14
- async build () {
14
+ build = async () => {
15
15
  const { has, omit, isString } = this.plugin.app.bajo.lib._
16
16
  // tag
17
17
  this.params.tag = !!this.params.attr.href || this.params.attr.tag === 'a' ? 'a' : 'button'
@@ -8,7 +8,7 @@ async function cardFooter () {
8
8
  this.selector = '.' + cls
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  await handler.call(this, cls, this.params)
13
13
  }
14
14
  }
@@ -18,7 +18,7 @@ async function cardHeader () {
18
18
  this.selector = '.' + cls
19
19
  }
20
20
 
21
- async build () {
21
+ build = async () => {
22
22
  await handler.call(this, cls, this.params)
23
23
  }
24
24
  }
@@ -8,7 +8,7 @@ async function card () {
8
8
  this.component.normalizeAttr(this.params, { tag: 'div', cls })
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const { $ } = this.component
13
13
  const children = $(`<div>${this.params.html}</div>`).children()
14
14
  this.params.html = children.each(function (idx) {
@@ -8,7 +8,7 @@ async function carouselItem () {
8
8
  this.component.normalizeAttr(this.params, { tag: 'div', cls, dataBsInterval: this.params.attr.interval })
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const { isString } = this.plugin.app.bajo.lib._
13
13
  if (isString(this.params.attr.caption)) {
14
14
  const captions = ['<div class="carousel-caption d-none d-md-block">']
@@ -13,7 +13,7 @@ async function carousel () {
13
13
  this.params.html = `<div class="${cls}-inner">${this.params.html}</div>`
14
14
  }
15
15
 
16
- async build () {
16
+ build = async () => {
17
17
  const { attrToArray } = this.plugin.app.waibuMpa
18
18
  const { $ } = this.component
19
19
  let activeItem = 0
@@ -8,7 +8,7 @@ function collectAttr (group, item) {
8
8
 
9
9
  async function collapse () {
10
10
  return class Collapse extends this.baseFactory {
11
- async build () {
11
+ build = async () => {
12
12
  const { generateId } = this.plugin.app.bajo
13
13
  const { merge, isString } = this.plugin.app.bajo.lib._
14
14
  const { attrToArray, groupAttrs } = this.plugin.app.waibuMpa
@@ -9,7 +9,7 @@ async function container () {
9
9
  this.component.normalizeAttr(this.params, { tag: 'div' })
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  const { has, omit } = this.plugin.app.bajo.lib._
14
14
  if (has(this.params.attr, 'responsive')) this.params.attr.class.push(`${cls}-fluid`)
15
15
  else if (has(this.params.attr, 'breakpoint')) this.params.attr.class.push(parseSimple({ cls, value: this.params.attr.breakpoint, values: breakpoints }))
@@ -9,7 +9,7 @@ async function drawer () {
9
9
  this.component.normalizeAttr(this.params, { tag: 'div', autoId: true, tabIndex: -1 })
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  const { isString, omit, trim } = this.plugin.app.bajo.lib._
14
14
  const { groupAttrs } = this.plugin.app.waibuMpa
15
15
  const { $ } = this.component
@@ -8,7 +8,7 @@ async function dropdownItem () {
8
8
  this.component.normalizeAttr(this.params, { tag: 'a' })
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const { $ } = this.component
13
13
  if ($(this.params.html).children().length === 0 && !this.params.attr.href) this.params.attr.href = '#'
14
14
  if (this.params.attr.divider) {
@@ -71,7 +71,7 @@ async function dropdown () {
71
71
  this.component.normalizeAttr(this.params, { tag })
72
72
  }
73
73
 
74
- async build () {
74
+ build = async () => {
75
75
  const { merge, cloneDeep, omit } = this.plugin.app.bajo.lib._
76
76
  const { groupAttrs } = this.plugin.app.waibuMpa
77
77
  const alpinejs = this.plugin.app.waibuAlpinejs
@@ -6,7 +6,7 @@ async function fieldset () {
6
6
  if (!this.params.attr.legendType) this.params.attr.legendType = '5'
7
7
  }
8
8
 
9
- async build () {
9
+ build = async () => {
10
10
  const { omit } = this.plugin.app.bajo.lib._
11
11
  const { groupAttrs } = this.plugin.app.waibuMpa
12
12
  const group = groupAttrs(this.params.attr, ['grid', 'legend', 'card'])
@@ -8,7 +8,7 @@ async function figure () {
8
8
  this.component.normalizeAttr(this.params, { cls })
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const { $ } = this.component
13
13
  this.params.html = $(`<div>${this.params.html}</div>`).children().each(function () {
14
14
  if (this.name === 'img') $(this).addClass('figure-img')
@@ -21,7 +21,7 @@ export async function build (handler, params = {}) {
21
21
 
22
22
  async function formCheckToggle () {
23
23
  return class FormCheckToggle extends this.baseFactory {
24
- async build () {
24
+ build = async () => {
25
25
  const { has } = this.plugin.app.bajo.lib._
26
26
  const { req } = this.component
27
27
  if (!has(this.params.attr, 'label')) this.params.attr.label = req.t('Toggle Check')
@@ -47,7 +47,7 @@ export async function build (handler, params = {}) {
47
47
 
48
48
  async function formCheck () {
49
49
  return class FormCheck extends this.baseFactory {
50
- async build () {
50
+ build = async () => {
51
51
  await build.call(this, buildFormCheck, this.params)
52
52
  }
53
53
  }
@@ -3,7 +3,7 @@ import { build } from './form-input.js'
3
3
 
4
4
  async function formColor () {
5
5
  return class FormColor extends this.baseFactory {
6
- async build () {
6
+ build = async () => {
7
7
  await build.call(this, buildFormColor, this.params)
8
8
  }
9
9
  }
@@ -9,7 +9,7 @@ async function formDate () {
9
9
  this.inlineScript = inlineScript
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  const { set } = this.plugin.app.bajo.lib._
14
14
  const opts = {}
15
15
  if (this.params.attr.calendarWeeks) set(opts, 'display.calendarWeeks', true)
@@ -67,7 +67,7 @@ async function formDatetime () {
67
67
  this.inlineScript = inlineScript
68
68
  }
69
69
 
70
- async build () {
70
+ build = async () => {
71
71
  const { set } = this.plugin.app.bajo.lib._
72
72
  const opts = {}
73
73
  if (this.params.attr.sideBySide) set(opts, 'display.sideBySide', true)
@@ -8,7 +8,7 @@ async function formFile () {
8
8
  this.params.attr.type = 'file'
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  await build.call(this, buildFormFile, this.params)
13
13
  }
14
14
  }
@@ -123,7 +123,7 @@ export async function build (handler, params = {}) {
123
123
 
124
124
  async function formInput () {
125
125
  return class FormInput extends this.baseFactory {
126
- async build () {
126
+ build = async () => {
127
127
  await build.call(this, buildFormInput, this.params)
128
128
  }
129
129
  }
@@ -3,7 +3,7 @@ import { build } from './form-input.js'
3
3
 
4
4
  async function formPassword () {
5
5
  return class FormPassword extends this.baseFactory {
6
- async build () {
6
+ build = async () => {
7
7
  this.params.attr.type = 'password'
8
8
  await build.call(this, buildFormInput, this.params)
9
9
  }
@@ -3,7 +3,7 @@ import { build } from './form-input.js'
3
3
 
4
4
  async function formPlaintext () {
5
5
  return class FormPlaintext extends this.baseFactory {
6
- async build () {
6
+ build = async () => {
7
7
  this.params.attr.disabled = true
8
8
  if (this.params.attr.labelFloating) this.params.attr.class.push('border', 'rounded')
9
9
  await build.call(this, buildFormPlaintext, this.params)
@@ -3,7 +3,7 @@ import { build } from './form-check-toggle.js'
3
3
 
4
4
  async function formRadioToggle () {
5
5
  return class FormRadioToggle extends this.baseFactory {
6
- async build () {
6
+ build = async () => {
7
7
  if (!this.params.attr.label) this.params.attr.label = this.component.req.t('Toggle Radio')
8
8
  await build.call(this, buildFormRadioToggle, this.params)
9
9
  }
@@ -3,7 +3,7 @@ import { build } from './form-check.js'
3
3
 
4
4
  async function formRadio () {
5
5
  return class FormRadio extends this.baseFactory {
6
- async build () {
6
+ build = async () => {
7
7
  await build.call(this, buildFormRadio, this.params)
8
8
  }
9
9
  }
@@ -3,7 +3,7 @@ import { build } from './form-input.js'
3
3
 
4
4
  async function formRange () {
5
5
  return class FormRange extends this.baseFactory {
6
- async build () {
6
+ build = async () => {
7
7
  this.params.attr.type = 'range'
8
8
  delete this.params.attr.labelFloating
9
9
  await build.call(this, buildFormRange, this.params)
@@ -13,7 +13,7 @@ async function formSelectCountry () {
13
13
  this.params.noTag = true
14
14
  }
15
15
 
16
- async build () {
16
+ build = async () => {
17
17
  const { readConfig } = this.plugin.app.bajo
18
18
  const { map } = this.plugin.app.bajo.lib._
19
19
  const { base64JsonEncode } = this.plugin.app.waibuMpa
@@ -33,7 +33,7 @@ async function formSelectExt () {
33
33
  this.scripts = scripts
34
34
  }
35
35
 
36
- async build () {
36
+ build = async () => {
37
37
  const { omit } = this.plugin.app.bajo.lib._
38
38
  const { jsonStringify, base64JsonDecode } = this.plugin.app.waibuMpa
39
39
  this.params.attr['x-ref'] = 'select'
@@ -10,7 +10,7 @@ async function formSelect () {
10
10
  if (this.params.attr.noLabel) delete this.params.attr.label
11
11
  }
12
12
 
13
- async build () {
13
+ build = async () => {
14
14
  const { groupAttrs } = this.plugin.app.waibuMpa
15
15
  const group = groupAttrs(this.params.attr, ['label', 'hint', 'wrapper', 'col'], false)
16
16
  const contents = await handleInput.call(this, { handler: buildFormSelect, params: this.params, group })
@@ -9,7 +9,7 @@ async function formSwitch () {
9
9
  this.params.attr.wrapperClass += ' form-switch'
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  await build.call(this, buildFormSwitch, this.params)
14
14
  }
15
15
  }
@@ -3,7 +3,7 @@ import { build } from './form-input.js'
3
3
 
4
4
  async function formTextarea () {
5
5
  return class FormTextarea extends this.baseFactory {
6
- async build () {
6
+ build = async () => {
7
7
  await build.call(this, buildFormTextarea, this.params)
8
8
  }
9
9
  }
@@ -9,7 +9,7 @@ async function formTime () {
9
9
  this.scripts = scripts
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  const { set } = this.plugin.app.bajo.lib._
14
14
  const opts = {}
15
15
  set(opts, 'display.components.calendar', false)
@@ -6,7 +6,7 @@ async function form () {
6
6
  if (!this.params.attr.method) this.params.attr.method = 'POST'
7
7
  }
8
8
 
9
- async build () {
9
+ build = async () => {
10
10
  this.component.locals.form = this.component.locals.form ?? {}
11
11
  const { pascalCase } = this.plugin.app.bajo
12
12
  const { isEmpty, omit } = this.plugin.app.bajo.lib._
@@ -20,7 +20,7 @@ async function gridCol () {
20
20
  this.component.normalizeAttr(this.params, { tag: 'div' })
21
21
  }
22
22
 
23
- async build () {
23
+ build = async () => {
24
24
  const { map, without, isString } = this.plugin.app.bajo.lib._
25
25
  const { attrToArray } = this.plugin.app.waibuMpa
26
26
  if (this.params.attr.break) {
@@ -15,7 +15,7 @@ async function img () {
15
15
  delete this.params.attr.holder
16
16
  }
17
17
 
18
- async build () {
18
+ build = async () => {
19
19
  const { isString } = this.plugin.app.bajo.lib._
20
20
  const mouseenter = []
21
21
  const mouseleave = []
@@ -7,7 +7,7 @@ async function listItem () {
7
7
  this.component.normalizeAttr(this.params, { tag: 'li' })
8
8
  }
9
9
 
10
- async build () {
10
+ build = async () => {
11
11
  const { isString } = this.plugin.app.bajo.lib._
12
12
  const { groupAttrs } = this.plugin.app.waibuMpa
13
13
  const group = groupAttrs(this.params.attr, ['badge'])
@@ -9,7 +9,7 @@ async function list () {
9
9
  this.component.normalizeAttr(this.params, { tag: this.params.attr.ordered ? 'ol' : 'ul' })
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  const { isString, omit } = this.plugin.app.bajo.lib._
14
14
  const { attribsStringify } = this.plugin.app.waibuMpa
15
15
  const { $ } = this.component
@@ -8,7 +8,7 @@ async function masonry () {
8
8
  this.params.noTag = true
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const { pick } = this.plugin.app.bajo.lib._
13
13
  const { attribsStringify } = this.plugin.app.waibuMpa
14
14
  const { $ } = this.component
@@ -11,7 +11,7 @@ async function modal () {
11
11
  this.component.normalizeAttr(this.params, { tag: 'div', cls, autoId: true, tabIndex: -1, ariaHidden: 'true' })
12
12
  }
13
13
 
14
- async build () {
14
+ build = async () => {
15
15
  const { isString, omit } = this.plugin.app.bajo.lib._
16
16
  const { groupAttrs } = this.plugin.app.waibuMpa
17
17
  const { $ } = this.component
@@ -8,7 +8,7 @@ async function navDivider () {
8
8
  this.component.normalizeAttr(this.params, { tag: 'li', cls })
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  this.params.attr.padding = 'y-2'
13
13
  const attr = {
14
14
  class: ['vr'],
@@ -1,6 +1,6 @@
1
1
  async function navDropdownDarkmode () {
2
2
  return class NavDropdownDarkmode extends this.baseFactory {
3
- async build () {
3
+ build = async () => {
4
4
  const { titleize } = this.plugin.app.bajo
5
5
  const { set } = this.plugin.app.bajo.lib._
6
6
  const cfgWmpa = this.plugin.app.waibuMpa.config
@@ -1,6 +1,6 @@
1
1
  async function navDropdownLanguage () {
2
2
  return class NavDropdownLanguage extends this.baseFactory {
3
- async build () {
3
+ build = async () => {
4
4
  const { camelCase } = this.plugin.app.bajo.lib._
5
5
  const { supported } = this.plugin.app.bajo.config.intl
6
6
  const lang = this.component.req.lang
@@ -1,11 +1,12 @@
1
1
  async function navDropdownSetting () {
2
2
  return class NavDropdownSetting extends this.baseFactory {
3
- async build () {
3
+ build = async () => {
4
4
  const { set, camelCase } = this.plugin.app.bajo.lib._
5
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
9
+ const { req } = this.component
9
10
  const cfgWmpa = this.plugin.app.waibuMpa.config
10
11
 
11
12
  const group = groupAttrs(this.params.attr, ['icon'])
@@ -13,15 +14,29 @@ async function navDropdownSetting () {
13
14
  const icon = this.component.req.iconset ? await this.component.buildTag({ tag: 'icon', attr: group.icon }) : ''
14
15
  this.params.attr.dropdown = true
15
16
  this.params.attr.content = icon
17
+ let profile = `
18
+ <c:dropdown-item href="sumba:/my-stuff/profile" t:content="yourProfile" />
19
+ <c:dropdown-item href="sumba:/my-stuff/change-password" t:content="changePassword" />
20
+ `
21
+ if (this.params.attr.fancyProfile) {
22
+ profile = await this.component.buildSentence(`
23
+ <div>
24
+ <c:dropdown-item href="sumba:/my-stuff/profile">
25
+ <c:img src="dobo:/attachment/SumbaUser/${req.user.id}/profile/main.png" responsive rounded />
26
+ <c:div margin="top-1">${req.user.firstName} ${req.user.lastName}</c:div>
27
+ </c:dropdown-item>
28
+ </div>
29
+ `)
30
+ }
16
31
  let html = `
17
- <c:dropdown-item header t:content="Display Mode" />
18
- <c:dropdown-item href="${this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'false') })}" ${this.component.req.darkMode ? '' : 'active'} t:content="Bright" />
19
- <c:dropdown-item href="${this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'true') })}" ${!this.component.req.darkMode ? '' : 'active'} t:content="Dark" />
32
+ ${profile}
33
+ <c:dropdown-item divider />
34
+ <c:dropdown-item href="${this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'false') })}" ${this.component.req.darkMode ? '' : 'active'} t:content="bright" />
35
+ <c:dropdown-item href="${this.component.buildUrl({ params: set({}, cfgWmpa.darkMode.qsKey, 'true') })}" ${!this.component.req.darkMode ? '' : 'active'} t:content="dark" />
20
36
  `
21
37
  if (supported.length > 0) {
22
38
  html += `
23
39
  <c:dropdown-item divider />
24
- <c:dropdown-item header t:content="Language" />
25
40
  `
26
41
  for (const s of supported) {
27
42
  html += `<c:dropdown-item href="${this.component.buildUrl({ params: { lang: s } })}" ${this.component.req.lang === s ? 'active' : ''} t:content="${camelCase('lang ' + s)}" />`
@@ -1,20 +1,18 @@
1
1
  async function navDropdownUser () {
2
2
  return class NavDropdownUser extends this.baseFactory {
3
- async build () {
3
+ build = async () => {
4
4
  const { has } = this.plugin.app.bajo.lib._
5
5
  const { routePath } = this.plugin.app.waibu
6
6
  const { req } = this.component
7
7
  const icon = this.component.req.iconset ? await this.component.buildTag({ tag: 'icon', attr: { name: 'person' } }) : ''
8
8
  let text = ''
9
- if (has(this.params.attr, 'showName')) {
9
+ if (has(this.params.attr, 'title')) {
10
10
  if (req.user) {
11
- if (this.params.attr.showName === 'username') text = req.user.username
12
- else if (this.params.attr.showName === 'full') text = `${req.user.firstName} ${req.user.lastName}`
13
- else if (this.params.attr.showName === 'short') text = `${req.user.firstName} ${req.user.lastName[0]}.`
14
- else text = req.user[this.params.attr.showName]
11
+ if (this.params.attr.title === 'short') text = `${req.user.firstName} ${req.user.lastName[0]}.`
12
+ else if (['firstName', 'lastName', 'username'].includes(this.params.attr.title)) text = req.user[this.params.attr.title]
13
+ else text = `${req.user.firstName} ${req.user.lastName}`
15
14
  } else text = req.t('guest')
16
15
  }
17
- if (this.params.attr.noText) text = ''
18
16
  const html = []
19
17
  const attr = {
20
18
  dropdown: true,
@@ -27,11 +25,26 @@ async function navDropdownUser () {
27
25
  delete attr.dropdownMenu
28
26
  attr.href = routePath(this.component.req.user ? 'sumba:/my-stuff/profile' : 'sumba:/signin')
29
27
  } else {
30
- if (this.component.req.user) {
31
- html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/my-stuff/profile') }, html: this.component.req.t('yourProfile') }))
32
- html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/my-stuff/change-password') }, html: this.component.req.t('changePassword') }))
33
- html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
34
- html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signout') }, html: this.component.req.t('signout') }))
28
+ if (req.user) {
29
+ if (this.params.attr.fancyProfile) {
30
+ const profile = await this.component.buildSentence(`
31
+ <div>
32
+ <c:dropdown-item href="sumba:/my-stuff/profile">
33
+ <c:img src="dobo:/attachment/SumbaUser/${req.user.id}/profile/main.png" responsive rounded />
34
+ <c:div margin="top-1">${req.user.firstName} ${req.user.lastName}</c:div>
35
+ </c:dropdown-item>
36
+ </div>
37
+ `)
38
+ html.push(profile)
39
+ html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
40
+ html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/my-stuff/change-password') }, html: this.component.req.t('changePassword') }))
41
+ html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signout') }, html: this.component.req.t('signout') }))
42
+ } else {
43
+ html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/my-stuff/profile') }, html: this.component.req.t('yourProfile') }))
44
+ html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/my-stuff/change-password') }, html: this.component.req.t('changePassword') }))
45
+ html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
46
+ html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signout') }, html: this.component.req.t('signout') }))
47
+ }
35
48
  } else {
36
49
  html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { href: routePath('sumba:/signin') }, html: this.component.req.t('signin') }))
37
50
  html.push(await this.component.buildTag({ tag: 'dropdownItem', attr: { divider: true } }))
@@ -1,6 +1,6 @@
1
1
  async function navItemSignout () {
2
2
  return class NavItemSignout extends this.baseFactory {
3
- async build () {
3
+ build = async () => {
4
4
  if (!this.component.req.user) return
5
5
  const { generateId } = this.plugin.app.bajo
6
6
  const { routePath } = this.plugin.app.waibu
@@ -9,7 +9,7 @@ async function navItem () {
9
9
  this.component.normalizeAttr(this.params, { tag: 'a', cls: 'nav-link', href: this.params.attr.href ?? '#' })
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  const { isString } = this.plugin.app.bajo.lib._
14
14
  const { groupAttrs } = this.plugin.app.waibuMpa
15
15
  const { $ } = this.component
@@ -1,6 +1,6 @@
1
1
  async function navToggleFullscreen () {
2
2
  return class NavToggleFullscreen extends this.baseFactory {
3
- async build () {
3
+ build = async () => {
4
4
  const { iconset, req } = this.component
5
5
  if (!req.iconset) return
6
6
  const inIcon = iconset.resolve('fullscreen')
@@ -13,7 +13,7 @@ async function nav () {
13
13
  if (isString(this.params.attr.tag)) this.params.tag = this.params.attr.tag
14
14
  }
15
15
 
16
- async build () {
16
+ build = async () => {
17
17
  const { $ } = this.component
18
18
  if (!['ol', 'ul'].includes(this.params.tag)) {
19
19
  const html = []
@@ -9,7 +9,7 @@ async function navbar () {
9
9
  this.component.normalizeAttr(this.params, { tag: 'nav', cls })
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  const { omit, cloneDeep, has } = this.plugin.app.bajo.lib._
14
14
  const { generateId, numUnit } = this.plugin.app.bajo
15
15
  const { groupAttrs } = this.plugin.app.waibuMpa
@@ -8,7 +8,7 @@ async function paginationItem () {
8
8
  this.component.normalizeAttr(this.params, { tag: 'li', cls })
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const attr = { class: 'page-link', href: this.params.attr.href ?? '#' }
13
13
  const tag = this.params.attr.active || this.params.attr.disabled ? 'span' : 'a'
14
14
  if (this.params.attr.active || this.params.attr.disabled) delete attr.href
@@ -9,7 +9,7 @@ async function pagination () {
9
9
  this.component.normalizeAttr(this.params, { tag: 'ul', cls })
10
10
  }
11
11
 
12
- async build () {
12
+ build = async () => {
13
13
  const { isString } = this.plugin.app.bajo.lib._
14
14
  if (!this.params.attr.margin) this.params.attr.margin = 'bottom-0'
15
15
  if (this.params.attr.size) this.params.attr.class.push(parseSimple.call(this, { cls, value: this.params.attr.size, values: sizes }))
@@ -8,7 +8,7 @@ async function progressStack () {
8
8
  this.component.normalizeAttr(this.params, { tag: 'div', cls })
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const { pick } = this.plugin.app.bajo.lib._
13
13
  const { $ } = this.component
14
14
  this.params.html = $(`<div>${this.params.html}</div>`).children().each(function () {
@@ -7,7 +7,7 @@ async function progress () {
7
7
  this.selector = '.' + cls
8
8
  }
9
9
 
10
- async build () {
10
+ build = async () => {
11
11
  const { omit, isString } = this.plugin.app.bajo.lib._
12
12
  const { numUnit } = this.plugin.app.bajo
13
13
  const min = Number(this.params.attr.min) || 0
@@ -7,7 +7,7 @@ async function scrollspy () {
7
7
  this.selector = '.' + cls
8
8
  }
9
9
 
10
- async build () {
10
+ build = async () => {
11
11
  const { isString } = this.plugin.app.bajo.lib._
12
12
  const { generateId } = this.plugin.app.bajo
13
13
  const target = isString(this.params.attr.target) ? this.params.attr.target : generateId()
@@ -28,7 +28,7 @@ async function sidebar () {
28
28
  this.component.normalizeAttr(this.params, { tag: 'div', flex: 'column' })
29
29
  }
30
30
 
31
- async build () {
31
+ build = async () => {
32
32
  const { generateId } = this.plugin.app.bajo
33
33
  const { omit, filter } = this.plugin.app.bajo.lib._
34
34
  this.params.attr.margin = this.params.attr.margin ?? 'all-3'
@@ -55,7 +55,7 @@ async function sidebar () {
55
55
  }
56
56
  items = filter(this.component.locals.sidebar ?? [], s => s.bottom)
57
57
  if (items.length > 0) {
58
- html.push(`<c:nav tag="ul" flex="column" text="align:${this.params.attr.align}" type="pills" ${this.params.attr.expanded ? '' : 'padding="all-1"'}>`)
58
+ 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' : ''}>`)
59
59
  for (const item of items) {
60
60
  html.push(formatSentence.call(this, item, this.params))
61
61
  }
@@ -22,7 +22,7 @@ async function table () {
22
22
  this.component.normalizeAttr(this.params, { cls })
23
23
  }
24
24
 
25
- async build () {
25
+ build = async () => {
26
26
  const { omit } = this.plugin.app.bajo.lib._
27
27
  if (this.params.attr.strip) setStrip.call(this, this.params)
28
28
  if (this.params.attr.responsive) setResponsive.call(this, this.params)
@@ -8,7 +8,7 @@ async function toast () {
8
8
  this.component.normalizeAttr(this.params, { cls, tag: 'div', role: 'alert', ariaLive: 'assertive', ariaAtomic: 'true' })
9
9
  }
10
10
 
11
- async build () {
11
+ build = async () => {
12
12
  const { isString, omit, has, get } = this.plugin.app.bajo.lib._
13
13
  const header = []
14
14
  if (this.params.attr.noHide) this.params.attr.dataBsAutohide = 'false'
@@ -10,3 +10,9 @@
10
10
  .icon-rotate-270::before {
11
11
  transform: rotate(270deg);
12
12
  }
13
+ .avtr {
14
+ vertical-align: middle;
15
+ width: 50px;
16
+ height: 50px;
17
+ border-radius: 50%;
18
+ }
File without changes
File without changes
File without changes