waibu-bootstrap 2.0.1 → 2.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.
- package/.github/FUNDING.yml +0 -0
- package/.github/workflows/repo-lockdown.yml +0 -0
- package/.jsdoc.conf.json +0 -0
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/docs/WaibuBootstrap.html +0 -0
- package/docs/data/search.json +0 -0
- package/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/global.html +0 -0
- package/docs/index.html +0 -0
- package/docs/index.js.html +2 -2
- package/docs/scripts/core.js +0 -0
- package/docs/scripts/core.min.js +0 -0
- package/docs/scripts/resize.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/scripts/search.min.js +0 -0
- package/docs/scripts/third-party/Apache-License-2.0.txt +0 -0
- package/docs/scripts/third-party/fuse.js +0 -0
- package/docs/scripts/third-party/hljs-line-num-original.js +0 -0
- package/docs/scripts/third-party/hljs-line-num.js +0 -0
- package/docs/scripts/third-party/hljs-original.js +0 -0
- package/docs/scripts/third-party/hljs.js +0 -0
- package/docs/scripts/third-party/popper.js +0 -0
- package/docs/scripts/third-party/tippy.js +0 -0
- package/docs/scripts/third-party/tocbot.js +0 -0
- package/docs/scripts/third-party/tocbot.min.js +0 -0
- package/docs/static/bitcoin.jpeg +0 -0
- package/docs/static/home.md +0 -0
- package/docs/static/logo-ecosystem.png +0 -0
- package/docs/static/logo.png +0 -0
- package/docs/styles/clean-jsdoc-theme-base.css +0 -0
- package/docs/styles/clean-jsdoc-theme-dark.css +0 -0
- package/docs/styles/clean-jsdoc-theme-light.css +0 -0
- package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -0
- package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
- package/docs/styles/clean-jsdoc-theme.min.css +0 -0
- package/extend/bajo/hook/waibu-mpa.bootstrap@after-build-page.js +0 -0
- package/extend/bajo/intl/id.json +0 -0
- package/extend/waibuMpa/theme/component/factory/_lib.js +19 -13
- package/extend/waibuMpa/theme/component/factory/a.js +1 -1
- package/extend/waibuMpa/theme/component/factory/accordion-item.js +2 -2
- package/extend/waibuMpa/theme/component/factory/accordion.js +0 -0
- package/extend/waibuMpa/theme/component/factory/alert.js +0 -0
- package/extend/waibuMpa/theme/component/factory/app-launcher-trigger.js +3 -3
- package/extend/waibuMpa/theme/component/factory/app-launcher.js +2 -2
- package/extend/waibuMpa/theme/component/factory/badge.js +0 -0
- package/extend/waibuMpa/theme/component/factory/blockquote.js +0 -0
- package/extend/waibuMpa/theme/component/factory/breadcrumb-item.js +1 -1
- package/extend/waibuMpa/theme/component/factory/breadcrumb.js +2 -2
- package/extend/waibuMpa/theme/component/factory/btn-back-to-top.js +0 -0
- package/extend/waibuMpa/theme/component/factory/btn-close.js +0 -0
- package/extend/waibuMpa/theme/component/factory/btn-group.js +0 -0
- package/extend/waibuMpa/theme/component/factory/btn-toolbar.js +0 -0
- package/extend/waibuMpa/theme/component/factory/btn.js +0 -0
- package/extend/waibuMpa/theme/component/factory/card-body.js +0 -0
- package/extend/waibuMpa/theme/component/factory/card-footer.js +0 -0
- package/extend/waibuMpa/theme/component/factory/card-group.js +0 -0
- package/extend/waibuMpa/theme/component/factory/card-header.js +0 -0
- package/extend/waibuMpa/theme/component/factory/card-link.js +0 -0
- package/extend/waibuMpa/theme/component/factory/card-subtitle.js +0 -0
- package/extend/waibuMpa/theme/component/factory/card-text.js +0 -0
- package/extend/waibuMpa/theme/component/factory/card-title.js +0 -0
- package/extend/waibuMpa/theme/component/factory/card.js +0 -0
- package/extend/waibuMpa/theme/component/factory/carousel-item.js +0 -0
- package/extend/waibuMpa/theme/component/factory/carousel.js +1 -1
- package/extend/waibuMpa/theme/component/factory/collapse-item.js +0 -0
- package/extend/waibuMpa/theme/component/factory/collapse.js +2 -2
- package/extend/waibuMpa/theme/component/factory/container.js +0 -0
- package/extend/waibuMpa/theme/component/factory/drawer-toolbar.js +0 -0
- package/extend/waibuMpa/theme/component/factory/drawer.js +1 -1
- package/extend/waibuMpa/theme/component/factory/dropdown-item.js +0 -0
- package/extend/waibuMpa/theme/component/factory/dropdown.js +3 -3
- package/extend/waibuMpa/theme/component/factory/fieldset.js +1 -1
- package/extend/waibuMpa/theme/component/factory/figcaption.js +0 -0
- package/extend/waibuMpa/theme/component/factory/figure.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-check-toggle.js +3 -2
- package/extend/waibuMpa/theme/component/factory/form-check.js +3 -2
- package/extend/waibuMpa/theme/component/factory/form-color.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-date.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-datetime.js +2 -2
- package/extend/waibuMpa/theme/component/factory/form-file.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-input-addon.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-input.js +4 -5
- package/extend/waibuMpa/theme/component/factory/form-password.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-plaintext.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-radio-toggle.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-radio.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-range.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-select-country.js +2 -2
- package/extend/waibuMpa/theme/component/factory/form-select-ext.js +4 -4
- package/extend/waibuMpa/theme/component/factory/form-select.js +1 -1
- package/extend/waibuMpa/theme/component/factory/form-switch.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-textarea.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form-time.js +0 -0
- package/extend/waibuMpa/theme/component/factory/form.js +2 -2
- package/extend/waibuMpa/theme/component/factory/grid-col.js +1 -1
- package/extend/waibuMpa/theme/component/factory/grid-row.js +0 -0
- package/extend/waibuMpa/theme/component/factory/heading.js +0 -0
- package/extend/waibuMpa/theme/component/factory/img.js +0 -0
- package/extend/waibuMpa/theme/component/factory/lead.js +0 -0
- package/extend/waibuMpa/theme/component/factory/list-item.js +1 -1
- package/extend/waibuMpa/theme/component/factory/list.js +2 -2
- package/extend/waibuMpa/theme/component/factory/masonry.js +2 -2
- package/extend/waibuMpa/theme/component/factory/modal-body.js +0 -0
- package/extend/waibuMpa/theme/component/factory/modal-footer.js +0 -0
- package/extend/waibuMpa/theme/component/factory/modal-header.js +0 -0
- package/extend/waibuMpa/theme/component/factory/modal.js +1 -1
- package/extend/waibuMpa/theme/component/factory/nav-divider.js +0 -0
- package/extend/waibuMpa/theme/component/factory/nav-dropdown-darkmode.js +2 -2
- package/extend/waibuMpa/theme/component/factory/nav-dropdown-language.js +1 -1
- package/extend/waibuMpa/theme/component/factory/nav-dropdown-setting.js +22 -22
- package/extend/waibuMpa/theme/component/factory/nav-item-signout.js +2 -2
- package/extend/waibuMpa/theme/component/factory/nav-item.js +4 -4
- package/extend/waibuMpa/theme/component/factory/nav-toggle-fullscreen.js +0 -0
- package/extend/waibuMpa/theme/component/factory/nav.js +0 -0
- package/extend/waibuMpa/theme/component/factory/navbar-brand.js +0 -0
- package/extend/waibuMpa/theme/component/factory/navbar-text.js +0 -0
- package/extend/waibuMpa/theme/component/factory/navbar.js +3 -2
- package/extend/waibuMpa/theme/component/factory/pagination-item.js +0 -0
- package/extend/waibuMpa/theme/component/factory/pagination.js +0 -0
- package/extend/waibuMpa/theme/component/factory/progress-stack.js +0 -0
- package/extend/waibuMpa/theme/component/factory/progress.js +1 -1
- package/extend/waibuMpa/theme/component/factory/scrollspy.js +1 -1
- package/extend/waibuMpa/theme/component/factory/sidebar.js +2 -1
- package/extend/waibuMpa/theme/component/factory/spinner.js +0 -0
- package/extend/waibuMpa/theme/component/factory/table.js +0 -0
- package/extend/waibuMpa/theme/component/factory/tbody.js +0 -0
- package/extend/waibuMpa/theme/component/factory/td.js +0 -0
- package/extend/waibuMpa/theme/component/factory/tfoot.js +0 -0
- package/extend/waibuMpa/theme/component/factory/th.js +0 -0
- package/extend/waibuMpa/theme/component/factory/thead.js +0 -0
- package/extend/waibuMpa/theme/component/factory/toast-stack.js +0 -0
- package/extend/waibuMpa/theme/component/factory/toast.js +0 -0
- package/extend/waibuMpa/theme/component/factory/tr.js +0 -0
- package/extend/waibuMpa/theme/component/method/after-build-tag/_lib.js +0 -0
- package/extend/waibuMpa/theme/component/method/after-build-tag/active.js +0 -0
- package/extend/waibuMpa/theme/component/method/after-build-tag/background.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/border.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/dim.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/disabled.js +0 -0
- package/extend/waibuMpa/theme/component/method/after-build-tag/display.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/flex.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/font.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/gutter.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/label.js +0 -0
- package/extend/waibuMpa/theme/component/method/after-build-tag/link.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/margin-padding.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/popover.js +0 -0
- package/extend/waibuMpa/theme/component/method/after-build-tag/position.js +2 -2
- package/extend/waibuMpa/theme/component/method/after-build-tag/rounded.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/text.js +1 -1
- package/extend/waibuMpa/theme/component/method/after-build-tag/tooltip.js +0 -0
- package/extend/waibuMpa/theme/component/method/after-build-tag.js +0 -0
- package/extend/waibuMpa/theme.js +0 -0
- package/extend/waibuStatic/asset/css/wbs.css +0 -0
- package/extend/waibuStatic/asset/js/wbs.js +0 -0
- package/extend/waibuStatic/virtual.json +0 -0
- package/index.js +1 -4
- package/package.json +9 -3
- package/wiki/CHANGES.md +6 -0
- package/wiki/CONFIG.md +0 -0
- package/wiki/CONTRIBUTING.md +0 -0
package/.github/FUNDING.yml
CHANGED
|
File without changes
|
|
File without changes
|
package/.jsdoc.conf.json
CHANGED
|
File without changes
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/docs/WaibuBootstrap.html
CHANGED
|
File without changes
|
package/docs/data/search.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/global.html
CHANGED
|
File without changes
|
package/docs/index.html
CHANGED
|
File without changes
|
package/docs/index.js.html
CHANGED
|
@@ -14,9 +14,9 @@ async function factory (pkgName) {
|
|
|
14
14
|
*
|
|
15
15
|
* @class
|
|
16
16
|
*/
|
|
17
|
-
class WaibuBootstrap extends this.app.
|
|
17
|
+
class WaibuBootstrap extends this.app.baseClass.Base {
|
|
18
18
|
static alias = 'wbs'
|
|
19
|
-
static dependencies = ['waibu-mpa', 'waibu-extra']
|
|
19
|
+
static dependencies = ['waibu-mpa', 'waibu-extra', 'waibu-alpinejs']
|
|
20
20
|
|
|
21
21
|
constructor () {
|
|
22
22
|
super(pkgName, me.app)
|
package/docs/scripts/core.js
CHANGED
|
File without changes
|
package/docs/scripts/core.min.js
CHANGED
|
File without changes
|
package/docs/scripts/resize.js
CHANGED
|
File without changes
|
package/docs/scripts/search.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/static/bitcoin.jpeg
CHANGED
|
File without changes
|
package/docs/static/home.md
CHANGED
|
File without changes
|
|
File without changes
|
package/docs/static/logo.png
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/extend/bajo/intl/id.json
CHANGED
|
File without changes
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { sizes } from '../method/after-build-tag/_lib.js'
|
|
2
2
|
|
|
3
|
+
const trueValues = ['true', 'on', 'yes', '1', 1, true]
|
|
4
|
+
|
|
3
5
|
function getInputAttr (group, formControl = true, ro) {
|
|
4
|
-
const { omit, get, isPlainObject, isArray, isString, has, forOwn } = this.app.lib._
|
|
5
|
-
const { escape } = this.
|
|
6
|
+
const { omit, get, set, isPlainObject, isArray, isString, has, forOwn } = this.app.lib._
|
|
7
|
+
const { escape } = this.app.waibu
|
|
6
8
|
if (formControl) group._.class.push('form-control')
|
|
7
9
|
const attr = omit(group._, ['hint', 'label', 'wrapper'])
|
|
8
10
|
if (attr.href) {
|
|
@@ -10,17 +12,21 @@ function getInputAttr (group, formControl = true, ro) {
|
|
|
10
12
|
attr.href = attr.href.replace(`%7B${k}%7D`, v)
|
|
11
13
|
})
|
|
12
14
|
}
|
|
13
|
-
if (has(attr, 'name') && !attr
|
|
15
|
+
if (has(attr, 'name') && !has(attr, 'value') && this.component.locals.form) {
|
|
14
16
|
attr.dataType = attr.dataType ?? 'auto'
|
|
15
|
-
|
|
17
|
+
let val = get(this, `component.locals.form.${attr.name}`)
|
|
18
|
+
if (attr.dataType === 'boolean') {
|
|
19
|
+
val = trueValues.includes(val)
|
|
20
|
+
set(this, `component.locals.form.${attr.name}`, val)
|
|
21
|
+
}
|
|
16
22
|
if (isPlainObject(val) || isArray(val)) attr.dataValue = escape(JSON.stringify(val))
|
|
17
23
|
else if (isString(val)) attr.dataValue = escape(val)
|
|
18
24
|
else attr.dataValue = val
|
|
19
25
|
if (ro) {
|
|
20
|
-
if (attr.
|
|
21
|
-
const [
|
|
22
|
-
attr.value = get(this, `component.locals.form.
|
|
23
|
-
} else if (attr.dataType === 'boolean') attr.value = this.component.req.t(val ? '
|
|
26
|
+
if (attr.ref) {
|
|
27
|
+
const [ref, fieldName = 'id'] = attr.ref.split(':')
|
|
28
|
+
attr.value = get(this, `component.locals.form._ref.${ref}.${fieldName}`, val)
|
|
29
|
+
} else if (attr.dataType === 'boolean') attr.value = this.component.req.t(val ? 'true' : 'false')
|
|
24
30
|
else if (has(attr, 'name') === 'lat') attr.value = escape(this.component.req.format(val, attr.dataType, { latitude: true }))
|
|
25
31
|
else if (has(attr, 'name') === 'lng') attr.value = escape(this.component.req.format(val, attr.dataType, { longitude: true }))
|
|
26
32
|
else attr.value = escape(this.component.req.format(val, attr.dataType))
|
|
@@ -55,19 +61,19 @@ export async function buildFormCheck (group, params) {
|
|
|
55
61
|
const attr = getInputAttr.call(this, group, false)
|
|
56
62
|
attr.type = 'checkbox'
|
|
57
63
|
attr.class.push('form-check-input')
|
|
58
|
-
if (has(attr, 'name') && !attr
|
|
59
|
-
if (has(attr, 'name') && !has(attr, 'checked') && attr.value === get(this, `locals.form.${attr.name}`)) attr.checked = true
|
|
64
|
+
if (has(attr, 'name') && !has(attr, 'value')) attr.value = 'true'
|
|
65
|
+
if (has(attr, 'name') && !has(attr, 'checked') && attr.value === get(this, `component.locals.form.${attr.name}`)) attr.checked = true
|
|
60
66
|
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
export async function buildFormSwitch (group, params) {
|
|
64
|
-
const { has
|
|
70
|
+
const { has } = this.app.lib._
|
|
65
71
|
const attr = getInputAttr.call(this, group, false)
|
|
66
72
|
attr.type = 'checkbox'
|
|
67
73
|
attr.class.push('form-check-input')
|
|
68
74
|
attr.role = 'switch'
|
|
69
|
-
if (has(attr, 'name')
|
|
70
|
-
if (has(attr, 'name') && !has(attr, 'checked') && attr.
|
|
75
|
+
if (has(attr, 'name')) attr.value = 'true'
|
|
76
|
+
if (has(attr, 'name') && !has(attr, 'checked') && attr.dataValue) attr.checked = 'true'
|
|
71
77
|
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
72
78
|
}
|
|
73
79
|
|
|
@@ -4,7 +4,7 @@ async function a () {
|
|
|
4
4
|
super(options)
|
|
5
5
|
this.component.normalizeAttr(this.params, { tag: 'a' })
|
|
6
6
|
if (!this.params.attr.href) this.params.attr.href = '#'
|
|
7
|
-
if (this.params.html.includes('<i class="')) this.params.attr.class.push('icon-link')
|
|
7
|
+
if (this.params.html.includes('<i class="') && !this.params.attr.noIconLink) this.params.attr.class.push('icon-link')
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -11,12 +11,12 @@ async function accordionItem () {
|
|
|
11
11
|
|
|
12
12
|
build = async () => {
|
|
13
13
|
const { omit, without } = this.app.lib._
|
|
14
|
-
const { groupAttrs,
|
|
14
|
+
const { groupAttrs, stringifyAttribs } = this.app.waibuMpa
|
|
15
15
|
const group = groupAttrs(this.params.attr, ['body', 'header'])
|
|
16
16
|
if (!group.body.noPadding) group.body.class.push('accordion-body')
|
|
17
17
|
const clsList = without(this.params.attr.class, cls)
|
|
18
18
|
group.header.class.push('accordion-header')
|
|
19
|
-
const header = [`<c:h2 ${
|
|
19
|
+
const header = [`<c:h2 ${stringifyAttribs(group.header)}>`,
|
|
20
20
|
`<button class="${this.params.attr.narrowHeader ? 'px-3 py-2 ' : ''}accordion-button${this.params.attr.showOnStart ? '' : ' collapsed'}"`,
|
|
21
21
|
`type="button" data-bs-toggle="collapse" data-bs-target="#${this.params.attr.id}"`,
|
|
22
22
|
`aria-expanded="${this.params.attr.showOnStart}"`,
|
|
File without changes
|
|
File without changes
|
|
@@ -21,13 +21,13 @@ async function appLauncherTrigger () {
|
|
|
21
21
|
|
|
22
22
|
build = async () => {
|
|
23
23
|
const { fastGlob } = this.app.lib
|
|
24
|
-
const { groupAttrs,
|
|
24
|
+
const { groupAttrs, stringifyAttribs } = this.app.waibuMpa
|
|
25
25
|
const group = groupAttrs(this.params.attr, ['img'])
|
|
26
26
|
this.params.attr = group._
|
|
27
27
|
let src = group.img.src
|
|
28
28
|
if (!src) {
|
|
29
29
|
let logo = 'waibu'
|
|
30
|
-
const files = await fastGlob(`${this.
|
|
30
|
+
const files = await fastGlob(`${this.app.main.dir.pkg}/logo.*`)
|
|
31
31
|
if (files.length > 0) logo = 'main'
|
|
32
32
|
src = `waibuMpa:/logo/${logo}`
|
|
33
33
|
}
|
|
@@ -36,7 +36,7 @@ async function appLauncherTrigger () {
|
|
|
36
36
|
`<c:img src="${src}"`,
|
|
37
37
|
`width="${group.img.dimWidth}" height="${group.img.dimHeight}"`
|
|
38
38
|
]
|
|
39
|
-
if (group.img.style) sentence.push(`style="${
|
|
39
|
+
if (group.img.style) sentence.push(`style="${stringifyAttribs(group.img.style)}"`)
|
|
40
40
|
sentence.push('/>')
|
|
41
41
|
this.params.html = await this.component.buildSentence(sentence)
|
|
42
42
|
}
|
|
@@ -2,7 +2,7 @@ async function appLauncher () {
|
|
|
2
2
|
return class AppLauncher extends this.baseFactory {
|
|
3
3
|
constructor (options) {
|
|
4
4
|
super(options)
|
|
5
|
-
const { generateId } = this.
|
|
5
|
+
const { generateId } = this.app.lib.aneka
|
|
6
6
|
this.params.noTag = true
|
|
7
7
|
this.params.attr.id = this.params.attr.id ?? generateId('alpha')
|
|
8
8
|
this.params.attr.type = this.params.attr.type ?? 'drawer'
|
|
@@ -25,7 +25,7 @@ async function appLauncher () {
|
|
|
25
25
|
launcher += '</c:nav>\n<c:nav tag="ul">\n'
|
|
26
26
|
for (const t of toolbar) {
|
|
27
27
|
if (t === 'home') launcher += '<c:nav-item href="/" icon="house" padding="end-2" />\n'
|
|
28
|
-
if (t === 'user' && this.
|
|
28
|
+
if (t === 'user' && this.app.sumba) launcher += '<c:sumba-nav-dropdown-user padding="end-2" />\n'
|
|
29
29
|
if (t === '-') launcher += '<c:nav-divider />\n'
|
|
30
30
|
if (t === 'fullscreen') launcher += '<c:nav-toggle-fullscreen padding="end-2" />\n'
|
|
31
31
|
if (t === 'darkmode') launcher += '<c:nav-dropdown-darkmode padding="end-2" dropdown-menudir="end" />\n'
|
|
File without changes
|
|
File without changes
|
|
@@ -10,7 +10,7 @@ async function breadcrumbItem () {
|
|
|
10
10
|
|
|
11
11
|
build = async () => {
|
|
12
12
|
const { omit } = this.app.lib._
|
|
13
|
-
const { attrToArray } = this.
|
|
13
|
+
const { attrToArray } = this.app.waibuMpa
|
|
14
14
|
if (this.params.attr.href) {
|
|
15
15
|
if (this.params.attr.hrefRebuild) {
|
|
16
16
|
this.params.attr.hrefRebuild = attrToArray(this.params.attr.hrefRebuild)
|
|
@@ -38,8 +38,8 @@ async function breadcrumb () {
|
|
|
38
38
|
|
|
39
39
|
build = async () => {
|
|
40
40
|
const { isString, omit } = this.app.lib._
|
|
41
|
-
const { routePath } = this.
|
|
42
|
-
const { urlToBreadcrumb, attrToArray } = this.
|
|
41
|
+
const { routePath } = this.app.waibu
|
|
42
|
+
const { urlToBreadcrumb, attrToArray } = this.app.waibuMpa
|
|
43
43
|
let divider = ''
|
|
44
44
|
if (this.params.attr.noDivider) divider = ' style="--bs-breadcrumb-divider: \'\';"'
|
|
45
45
|
else if (isString(this.params.attr.divider)) divider = ` style="--bs-breadcrumb-divider: '${this.params.attr.divider}';"`
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -14,7 +14,7 @@ async function carousel () {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
build = async () => {
|
|
17
|
-
const { attrToArray } = this.
|
|
17
|
+
const { attrToArray } = this.app.waibuMpa
|
|
18
18
|
const { $ } = this.component
|
|
19
19
|
let activeItem = 0
|
|
20
20
|
$(this.params.html).children().each(function (idx) {
|
|
File without changes
|
|
@@ -9,9 +9,9 @@ function collectAttr (group, item) {
|
|
|
9
9
|
async function collapse () {
|
|
10
10
|
return class Collapse extends this.baseFactory {
|
|
11
11
|
build = async () => {
|
|
12
|
-
const { generateId } = this.
|
|
12
|
+
const { generateId } = this.app.lib.aneka
|
|
13
13
|
const { merge, isString } = this.app.lib._
|
|
14
|
-
const { attrToArray, groupAttrs } = this.
|
|
14
|
+
const { attrToArray, groupAttrs } = this.app.waibuMpa
|
|
15
15
|
const items = []
|
|
16
16
|
const { $ } = this.component
|
|
17
17
|
const me = this
|
|
File without changes
|
|
File without changes
|
|
@@ -11,7 +11,7 @@ async function drawer () {
|
|
|
11
11
|
|
|
12
12
|
build = async () => {
|
|
13
13
|
const { isString, omit, trim } = this.app.lib._
|
|
14
|
-
const { groupAttrs } = this.
|
|
14
|
+
const { groupAttrs } = this.app.waibuMpa
|
|
15
15
|
const { $ } = this.component
|
|
16
16
|
const group = groupAttrs(this.params.attr, ['trigger'])
|
|
17
17
|
this.params.attr.responsive = this.params.attr.responsive ?? true
|
|
File without changes
|
|
@@ -5,7 +5,7 @@ const variants = ['center']
|
|
|
5
5
|
export const autoCloses = ['true', 'false', 'inside', 'outside']
|
|
6
6
|
|
|
7
7
|
export async function buildMenu (params = {}) { // scope: component
|
|
8
|
-
const { numUnit } = this.
|
|
8
|
+
const { numUnit } = this.app.bajo
|
|
9
9
|
const { isString } = this.app.lib._
|
|
10
10
|
const $ = this.$
|
|
11
11
|
let menuHtml = params.html
|
|
@@ -73,8 +73,8 @@ async function dropdown () {
|
|
|
73
73
|
|
|
74
74
|
build = async () => {
|
|
75
75
|
const { merge, cloneDeep, omit } = this.app.lib._
|
|
76
|
-
const { groupAttrs } = this.
|
|
77
|
-
const alpinejs = this.
|
|
76
|
+
const { groupAttrs } = this.app.waibuMpa
|
|
77
|
+
const alpinejs = this.app.waibuAlpinejs
|
|
78
78
|
const [dir, variant] = (this.params.attr.dir ?? 'down').split('-')
|
|
79
79
|
const xcls = ['drop' + parseSimple.call(this, { value: dir, values: dirs })]
|
|
80
80
|
if (variants.includes(variant)) xcls.push(`${xcls[0]}-${variant}`)
|
|
@@ -8,7 +8,7 @@ async function fieldset () {
|
|
|
8
8
|
|
|
9
9
|
build = async () => {
|
|
10
10
|
const { omit } = this.app.lib._
|
|
11
|
-
const { groupAttrs } = this.
|
|
11
|
+
const { groupAttrs } = this.app.waibuMpa
|
|
12
12
|
const group = groupAttrs(this.params.attr, ['grid', 'legend', 'card'])
|
|
13
13
|
if (group.grid && !this.params.attr.card && !group.grid.margin) group.grid.margin = 'bottom-3'
|
|
14
14
|
if (group.grid) this.params.html = await this.component.buildTag({ tag: 'gridRow', attr: group.grid, html: this.params.html })
|
|
File without changes
|
|
File without changes
|
|
@@ -3,12 +3,13 @@ import { parseVariant, colors } from '../method/after-build-tag/_lib.js'
|
|
|
3
3
|
const variants = ['outline']
|
|
4
4
|
|
|
5
5
|
export async function build (handler, params = {}) {
|
|
6
|
-
const { groupAttrs } = this.
|
|
6
|
+
const { groupAttrs } = this.app.waibuMpa
|
|
7
|
+
const { generateId } = this.app.lib.aneka
|
|
7
8
|
this.component.normalizeAttr(this.params)
|
|
8
9
|
if (!this.params.attr.label && this.params.attr.name) this.params.attr.label = this.component.req.t(`field.${this.params.attr.name}`)
|
|
9
10
|
const attr = groupAttrs(this.params.attr, ['label', 'hint', 'wrapper'])
|
|
10
11
|
const contents = []
|
|
11
|
-
attr._.id = this.params.attr.id ??
|
|
12
|
+
attr._.id = this.params.attr.id ?? generateId()
|
|
12
13
|
if (attr._.color) attr.label.class.push(parseVariant.call(this, { cls: 'btn', value: attr._.color, values: colors, variants, prepend: true }))
|
|
13
14
|
delete attr._.color
|
|
14
15
|
|
|
@@ -2,14 +2,15 @@ import { buildFormHint, buildFormLabel, buildFormCheck } from './_lib.js'
|
|
|
2
2
|
|
|
3
3
|
export async function build (handler, params = {}) {
|
|
4
4
|
const { isEmpty, get, find } = this.app.lib._
|
|
5
|
-
const { groupAttrs } = this.
|
|
5
|
+
const { groupAttrs } = this.app.waibuMpa
|
|
6
|
+
const { generateId } = this.app.lib.aneka
|
|
6
7
|
const { $ } = this.component
|
|
7
8
|
this.component.normalizeAttr(this.params)
|
|
8
9
|
if (!this.params.attr.label && this.params.attr.name) this.params.attr.label = this.component.req.t(`field.${this.params.attr.name}`)
|
|
9
10
|
if (this.params.attr.noLabel) this.params.attr.label = undefined
|
|
10
11
|
const group = groupAttrs(this.params.attr, ['label', 'hint', 'wrapper', 'col'], false)
|
|
11
12
|
const contents = []
|
|
12
|
-
group._.id = this.params.attr.id ??
|
|
13
|
+
group._.id = this.params.attr.id ?? generateId()
|
|
13
14
|
if (!isEmpty(group._.label)) {
|
|
14
15
|
group.wrapper.class.push('form-check')
|
|
15
16
|
if (group.wrapper.inline) group.wrapper.class.push('form-check-inline')
|
|
File without changes
|
|
File without changes
|
|
@@ -11,7 +11,7 @@ export function scripts (req) {
|
|
|
11
11
|
return items
|
|
12
12
|
}
|
|
13
13
|
export function inlineScript (req) {
|
|
14
|
-
const { jsonStringify } = this.
|
|
14
|
+
const { jsonStringify } = this.app.waibuMpa
|
|
15
15
|
const opts = {
|
|
16
16
|
display: {
|
|
17
17
|
icons: {
|
|
@@ -45,7 +45,7 @@ export function inlineScript (req) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export async function handler (opts, params = {}) {
|
|
48
|
-
const { jsonStringify } = this.
|
|
48
|
+
const { jsonStringify } = this.app.waibuMpa
|
|
49
49
|
this.params.attr['x-ref'] = 'self'
|
|
50
50
|
this.params.attr['x-data'] = `{
|
|
51
51
|
instance: null,
|
|
File without changes
|
|
File without changes
|
|
@@ -3,7 +3,7 @@ import { sizes } from '../method/after-build-tag/_lib.js'
|
|
|
3
3
|
|
|
4
4
|
export async function handleInput ({ handler, group, params } = {}) {
|
|
5
5
|
const { trim, filter, has, omit, pull, find, get } = this.app.lib._
|
|
6
|
-
const { attrToArray } = this.
|
|
6
|
+
const { attrToArray } = this.app.waibuMpa
|
|
7
7
|
const { $ } = this.component
|
|
8
8
|
const addons = []
|
|
9
9
|
const isLabel = has(this.params.attr, 'label')
|
|
@@ -29,9 +29,8 @@ export async function handleInput ({ handler, group, params } = {}) {
|
|
|
29
29
|
const details = get(this, 'component.locals.error.details', [])
|
|
30
30
|
const err = find(details, { field: group._.name })
|
|
31
31
|
if (err) {
|
|
32
|
-
const ext = err.ext ?? {}
|
|
33
32
|
result.input = $(result.input).addClass('is-invalid').prop('outerHTML')
|
|
34
|
-
result.input += `\n<div class="invalid-feedback">${
|
|
33
|
+
result.input += `\n<div class="invalid-feedback">${err.error}</div>`
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
const el = {
|
|
@@ -84,8 +83,8 @@ export async function handleInput ({ handler, group, params } = {}) {
|
|
|
84
83
|
}
|
|
85
84
|
|
|
86
85
|
export async function build (handler, params = {}) {
|
|
87
|
-
const { generateId } = this.
|
|
88
|
-
const { groupAttrs } = this.
|
|
86
|
+
const { generateId } = this.app.lib.aneka
|
|
87
|
+
const { groupAttrs } = this.app.waibuMpa
|
|
89
88
|
this.component.normalizeAttr(this.params, { autoId: true, type: this.params.attr.type ?? 'text' })
|
|
90
89
|
if (!this.params.attr.label && this.params.attr.name) this.params.attr.label = this.component.req.t(`field.${this.params.attr.name}`)
|
|
91
90
|
if (this.params.attr.noLabel) delete this.params.attr.label
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -14,9 +14,9 @@ async function formSelectCountry () {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
build = async () => {
|
|
17
|
-
const { readConfig } = this.
|
|
17
|
+
const { readConfig } = this.app.bajo
|
|
18
18
|
const { map } = this.app.lib._
|
|
19
|
-
const { base64JsonEncode } = this.
|
|
19
|
+
const { base64JsonEncode } = this.app.waibuMpa
|
|
20
20
|
const countries = await readConfig('bajoCommonDb:/extend/dobo/fixture/country.json', { ignoreError: true, defValue: [] })
|
|
21
21
|
this.params.attr.options = base64JsonEncode(map(countries, c => {
|
|
22
22
|
return { value: c.id, text: c.name.replaceAll('\'', '') }
|
|
@@ -44,13 +44,13 @@ async function formSelectExt () {
|
|
|
44
44
|
static inlineCss = inlineCss
|
|
45
45
|
|
|
46
46
|
build = async () => {
|
|
47
|
-
const { generateId } = this.
|
|
47
|
+
const { generateId } = this.app.lib.aneka
|
|
48
48
|
const { omit, merge, has } = this.app.lib._
|
|
49
|
-
const { routePath } = this.
|
|
50
|
-
const { jsonStringify, base64JsonDecode, groupAttrs } = this.
|
|
49
|
+
const { routePath } = this.app.waibu
|
|
50
|
+
const { jsonStringify, base64JsonDecode, groupAttrs } = this.app.waibuMpa
|
|
51
51
|
const { req } = this.component
|
|
52
52
|
let apiKey = ''
|
|
53
|
-
if (req.user && this.
|
|
53
|
+
if (req.user && this.app.sumba) apiKey = await this.app.sumba.getApiKeyFromUserId(req.user.id)
|
|
54
54
|
const xref = this.params.attr['x-ref'] ?? 'select'
|
|
55
55
|
this.params.attr.id = this.params.attr.id ?? generateId('alpha')
|
|
56
56
|
this.params.attr['x-ref'] = xref
|
|
@@ -11,7 +11,7 @@ async function formSelect () {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
build = async () => {
|
|
14
|
-
const { groupAttrs } = this.
|
|
14
|
+
const { groupAttrs } = this.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 })
|
|
17
17
|
if (this.params.attr.noWrapper) this.params.noTag = true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -10,8 +10,8 @@ async function form () {
|
|
|
10
10
|
this.component.locals.form = this.component.locals.form ?? {}
|
|
11
11
|
const { pascalCase } = this.app.lib.aneka
|
|
12
12
|
const { isEmpty, omit, has } = this.app.lib._
|
|
13
|
-
const { attrToArray } = this.
|
|
14
|
-
const { groupAttrs } = this.
|
|
13
|
+
const { attrToArray } = this.app.waibuMpa
|
|
14
|
+
const { groupAttrs } = this.app.waibuMpa
|
|
15
15
|
if (!has(this.params.attr, 'autocomplete')) this.params.attr.autocomplete = 'off'
|
|
16
16
|
if (!has(this.params.attr, 'method')) this.params.attr.method = 'POST'
|
|
17
17
|
if (this.params.attr.referer) {
|
|
@@ -22,7 +22,7 @@ async function gridCol () {
|
|
|
22
22
|
|
|
23
23
|
build = async () => {
|
|
24
24
|
const { map, without, isString } = this.app.lib._
|
|
25
|
-
const { attrToArray } = this.
|
|
25
|
+
const { attrToArray } = this.app.waibuMpa
|
|
26
26
|
if (this.params.attr.break) {
|
|
27
27
|
const ext = breakpoints.includes(this.params.attr.break) ? `d-none d-${this.params.attr.break}-block` : ''
|
|
28
28
|
this.params.attr.class.push('w-100', ext)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -9,7 +9,7 @@ async function listItem () {
|
|
|
9
9
|
|
|
10
10
|
build = async () => {
|
|
11
11
|
const { isString } = this.app.lib._
|
|
12
|
-
const { groupAttrs } = this.
|
|
12
|
+
const { groupAttrs } = this.app.waibuMpa
|
|
13
13
|
const group = groupAttrs(this.params.attr, ['badge'])
|
|
14
14
|
this.params.attr = group._
|
|
15
15
|
if (this.params.attr.inline) this.params.attr.class.push(inlineClass)
|