waibu-bootstrap 2.3.0 → 2.5.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/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/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/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/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/widget/_lib.js +15 -8
- package/extend/waibuMpa/theme/component/widget/app-launcher.js +2 -2
- package/extend/waibuMpa/theme/component/widget/breadcrumb-item.js +1 -1
- package/extend/waibuMpa/theme/component/widget/breadcrumb.js +2 -2
- package/extend/waibuMpa/theme/component/widget/carousel.js +1 -1
- package/extend/waibuMpa/theme/component/widget/collapse.js +2 -1
- package/extend/waibuMpa/theme/component/widget/form-input.js +1 -1
- package/extend/waibuMpa/theme/component/widget/form-select-ext.js +5 -6
- package/extend/waibuMpa/theme/component/widget/form.js +1 -1
- package/extend/waibuMpa/theme/component/widget/grid-col.js +1 -1
- package/package.json +1 -1
- package/wiki/CHANGES.md +9 -0
- package/extend/waibuMpa/theme/component/widget/form-select-country.js +0 -26
|
@@ -5,7 +5,7 @@ const variants = ['subtle', 'secondary', 'tertiary']
|
|
|
5
5
|
|
|
6
6
|
function background ({ key, params }) {
|
|
7
7
|
const { uniq } = this.app.lib._
|
|
8
|
-
const attrs = this.app.
|
|
8
|
+
const attrs = this.app.waibu.attrToArray(params.attr[key])
|
|
9
9
|
const bgColors = ['body', 'black', 'white', 'transparent', ...colors]
|
|
10
10
|
for (const attr of attrs) {
|
|
11
11
|
const [item, val] = attr.split(':')
|
|
@@ -5,7 +5,7 @@ const variants = ['subtle', 'secondary', 'tertiary']
|
|
|
5
5
|
function border ({ tag, key, params }) {
|
|
6
6
|
if (['table'].includes(tag)) return
|
|
7
7
|
const { uniq } = this.app.lib._
|
|
8
|
-
const attrs = this.app.
|
|
8
|
+
const attrs = this.app.waibu.attrToArray(params.attr[key])
|
|
9
9
|
const borderColors = ['body', 'black', 'white', ...colors]
|
|
10
10
|
let hasSide
|
|
11
11
|
for (const attr of attrs) {
|
|
@@ -2,7 +2,7 @@ import { dims } from './_lib.js'
|
|
|
2
2
|
|
|
3
3
|
function dim ({ key, params }) {
|
|
4
4
|
const { uniq } = this.app.lib._
|
|
5
|
-
const attrs = this.app.
|
|
5
|
+
const attrs = this.app.waibu.attrToArray(params.attr[key])
|
|
6
6
|
for (const attr of attrs) {
|
|
7
7
|
const [item, val] = attr.split(':')
|
|
8
8
|
for (const value of uniq((val ?? '').split(','))) {
|
|
@@ -2,7 +2,7 @@ import { breakpoints, displays } from './_lib.js'
|
|
|
2
2
|
|
|
3
3
|
function display ({ key, params }) {
|
|
4
4
|
const { uniq, isEmpty } = this.app.lib._
|
|
5
|
-
const attrs = this.app.
|
|
5
|
+
const attrs = this.app.waibu.attrToArray(params.attr[key])
|
|
6
6
|
let canHaveGap
|
|
7
7
|
for (const attr of attrs) {
|
|
8
8
|
const [item, val] = attr.split(':')
|
|
@@ -19,7 +19,7 @@ function flex ({ key, params }) {
|
|
|
19
19
|
params.attr.class.push('d-flex')
|
|
20
20
|
return
|
|
21
21
|
}
|
|
22
|
-
const attrs = this.app.
|
|
22
|
+
const attrs = this.app.waibu.attrToArray(params.attr[key])
|
|
23
23
|
const inline = attrs.includes('inline')
|
|
24
24
|
let hasFlex = false
|
|
25
25
|
for (const attr of attrs) {
|
|
@@ -2,7 +2,7 @@ import { levels, weights, fstyles, parseSimple } from './_lib.js'
|
|
|
2
2
|
|
|
3
3
|
function font ({ key, params }) {
|
|
4
4
|
const { uniq } = this.app.lib._
|
|
5
|
-
const attrs = this.app.
|
|
5
|
+
const attrs = this.app.waibu.attrToArray(params.attr[key])
|
|
6
6
|
for (const attr of attrs) {
|
|
7
7
|
const [item, val] = attr.split(':')
|
|
8
8
|
for (const value of uniq((val ?? '').split(','))) {
|
|
@@ -5,7 +5,7 @@ const prefixes = ['x', 'y', '']
|
|
|
5
5
|
|
|
6
6
|
function gutter ({ key, params }) {
|
|
7
7
|
const { isString } = this.app.lib._
|
|
8
|
-
const { attrToArray } = this.app.
|
|
8
|
+
const { attrToArray } = this.app.waibu
|
|
9
9
|
if (isString(params.attr.gutter)) {
|
|
10
10
|
const items = attrToArray(params.attr.gutter)
|
|
11
11
|
for (const item of items) {
|
|
@@ -5,7 +5,7 @@ const ovariants = ['hover']
|
|
|
5
5
|
|
|
6
6
|
function link ({ key, params }) {
|
|
7
7
|
const { uniq } = this.app.lib._
|
|
8
|
-
const attrs = this.app.
|
|
8
|
+
const attrs = this.app.waibu.attrToArray(params.attr[key])
|
|
9
9
|
const linkColors = ['body', 'black', 'white', ...colors]
|
|
10
10
|
for (const attr of attrs) {
|
|
11
11
|
const [item, val] = attr.split(':')
|
|
@@ -4,7 +4,7 @@ const sides = ['x', 'y', 'all', ...aligns]
|
|
|
4
4
|
const sizes = ['0', 'auto', ...widths]
|
|
5
5
|
|
|
6
6
|
function marginPadding ({ key, params }) {
|
|
7
|
-
for (const item of this.app.
|
|
7
|
+
for (const item of this.app.waibu.attrToArray(params.attr[key])) {
|
|
8
8
|
let [side, size, bp] = item.split('-')
|
|
9
9
|
if (bp && !breakpoints.includes(bp)) bp = undefined
|
|
10
10
|
if (sides.includes(side) && (!size || sizes.includes(size))) {
|
|
@@ -4,7 +4,7 @@ const zes = ['n1', '0', '1', '2', '3']
|
|
|
4
4
|
function position ({ key, params }) {
|
|
5
5
|
const { without } = this.app.lib._
|
|
6
6
|
if (params.attr[key].includes(':')) {
|
|
7
|
-
const attrs = this.app.
|
|
7
|
+
const attrs = this.app.waibu.attrToArray(params.attr[key])
|
|
8
8
|
for (const attr of attrs) {
|
|
9
9
|
const [item, val] = attr.split(':')
|
|
10
10
|
/*
|
|
@@ -19,7 +19,7 @@ function position ({ key, params }) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
} else {
|
|
22
|
-
const [type, arrangeStart, arrangeEnd, translateMiddle] = this.app.
|
|
22
|
+
const [type, arrangeStart, arrangeEnd, translateMiddle] = this.app.waibu.attrToArray(params.attr[key])
|
|
23
23
|
if (positions.includes(type)) {
|
|
24
24
|
params.attr.class.push(`position-${type}`)
|
|
25
25
|
if (without(positions, 'static').includes(type) && arrangeStart &&
|
|
@@ -7,7 +7,7 @@ function rounded ({ key, params }) {
|
|
|
7
7
|
params.attr.class.push('rounded')
|
|
8
8
|
return
|
|
9
9
|
}
|
|
10
|
-
const attrs = this.app.
|
|
10
|
+
const attrs = this.app.waibu.attrToArray(params.attr[key])
|
|
11
11
|
let hasType
|
|
12
12
|
for (const attr of attrs) {
|
|
13
13
|
const [item, val] = attr.split(':')
|
|
@@ -8,7 +8,7 @@ const variants = ['emphasis', 'secondary', 'tertiary']
|
|
|
8
8
|
|
|
9
9
|
function text ({ key, params }) {
|
|
10
10
|
const { uniq } = this.app.lib._
|
|
11
|
-
const attrs = this.app.
|
|
11
|
+
const attrs = this.app.waibu.attrToArray(params.attr[key])
|
|
12
12
|
const textColors = ['body', 'black', 'white', ...colors]
|
|
13
13
|
for (const attr of attrs) {
|
|
14
14
|
const [item, val] = attr.split(':')
|
|
@@ -3,8 +3,9 @@ import { sizes } from '../method/after-build-tag/_lib.js'
|
|
|
3
3
|
const trueValues = ['true', 'on', 'yes', '1', 1, true]
|
|
4
4
|
|
|
5
5
|
function getInputAttr (group, formControl = true, ro) {
|
|
6
|
-
const { omit, get, set, isPlainObject, isArray, isString, has, forOwn } = this.app.lib._
|
|
6
|
+
const { omit, get, set, isPlainObject, isArray, isString, has, forOwn, find } = this.app.lib._
|
|
7
7
|
const { escape } = this.app.waibu
|
|
8
|
+
const { req } = this.component
|
|
8
9
|
if (formControl) group._.class.push('form-control')
|
|
9
10
|
const attr = omit(group._, ['hint', 'label', 'wrapper'])
|
|
10
11
|
if (attr.href) {
|
|
@@ -13,7 +14,10 @@ function getInputAttr (group, formControl = true, ro) {
|
|
|
13
14
|
})
|
|
14
15
|
}
|
|
15
16
|
if (has(attr, 'name') && !has(attr, 'value') && this.component.locals.form) {
|
|
16
|
-
|
|
17
|
+
let prop = {}
|
|
18
|
+
const schema = get(this, 'component.locals.schema')
|
|
19
|
+
if (schema) prop = find(schema.properties, { name: attr.name }) ?? {}
|
|
20
|
+
attr.dataType = attr.dataType ?? prop.type ?? 'auto'
|
|
17
21
|
let val = get(this, `component.locals.form.${attr.name}`)
|
|
18
22
|
if (attr.dataType === 'boolean') {
|
|
19
23
|
val = trueValues.includes(val)
|
|
@@ -26,10 +30,13 @@ function getInputAttr (group, formControl = true, ro) {
|
|
|
26
30
|
if (attr.ref) {
|
|
27
31
|
const [ref, fieldName = 'id'] = attr.ref.split(':')
|
|
28
32
|
attr.value = get(this, `component.locals.form._ref.${ref}.${fieldName}`, val)
|
|
29
|
-
} else if (attr.dataType === 'boolean') attr.value =
|
|
30
|
-
else if (has(attr, 'name') === 'lat') attr.value = escape(
|
|
31
|
-
else if (has(attr, 'name') === 'lng') attr.value = escape(
|
|
32
|
-
else
|
|
33
|
+
} else if (attr.dataType === 'boolean') attr.value = req.t(val ? 'true' : 'false')
|
|
34
|
+
else if (has(attr, 'name') === 'lat') attr.value = escape(req.format(val, attr.dataType, { latitude: true }))
|
|
35
|
+
else if (has(attr, 'name') === 'lng') attr.value = escape(req.format(val, attr.dataType, { longitude: true }))
|
|
36
|
+
else if (prop.values) {
|
|
37
|
+
const item = find(prop.values, { value: val })
|
|
38
|
+
attr.value = escape(req.format(item ? req.t(item.text) : val, attr.dataType))
|
|
39
|
+
} else attr.value = escape(req.format(val, attr.dataType))
|
|
33
40
|
} else attr.value = attr.dataValue
|
|
34
41
|
if (isArray(val)) attr.value = val.join(' ')
|
|
35
42
|
}
|
|
@@ -110,7 +117,7 @@ export async function buildFormPlaintext (group, params) {
|
|
|
110
117
|
return await this.component.buildTag({ tag: 'textarea', attr, html: attr.value })
|
|
111
118
|
}
|
|
112
119
|
if (attr.href) {
|
|
113
|
-
const content = attr.value ?
|
|
120
|
+
const content = attr.value ? attr.value : attr.href
|
|
114
121
|
const html = await this.component.buildTag({ tag: 'a', attr: { href: attr.href, content } })
|
|
115
122
|
return await this.component.buildTag({ tag: 'div', attr, html })
|
|
116
123
|
}
|
|
@@ -147,7 +154,7 @@ export async function buildFormSelect (group, params) {
|
|
|
147
154
|
attr.class.push('form-select')
|
|
148
155
|
let html = params.html
|
|
149
156
|
if (sizes.includes(attr.size)) attr.class.push(`form-select-${attr.size}`)
|
|
150
|
-
if (attr.options) html = this.component.buildOptions({ attr
|
|
157
|
+
if (attr.options) html = this.component.buildOptions({ attr })
|
|
151
158
|
else {
|
|
152
159
|
const items = []
|
|
153
160
|
$(`<div>${trim(html ?? '')}</div>`).find('option').each(function () {
|
|
@@ -10,8 +10,8 @@ async function appLauncher () {
|
|
|
10
10
|
|
|
11
11
|
build = async () => {
|
|
12
12
|
const { locals } = this.component
|
|
13
|
-
const { routePath } = this.app.waibu
|
|
14
|
-
const { groupAttrs
|
|
13
|
+
const { routePath, attrToArray } = this.app.waibu
|
|
14
|
+
const { groupAttrs } = this.app.waibuMpa
|
|
15
15
|
const menu = this.params.attr.menu ?? 'pages'
|
|
16
16
|
const group = groupAttrs(this.params.attr, ['trigger'])
|
|
17
17
|
let launcher = `<c:drawer id="${this.params.attr.id}" t:title="Modules" no-padding style="${menu === 'pages' ? 'width:350px' : ''}">\n`
|
|
@@ -10,7 +10,7 @@ async function breadcrumbItem () {
|
|
|
10
10
|
|
|
11
11
|
build = async () => {
|
|
12
12
|
const { omit } = this.app.lib._
|
|
13
|
-
const { attrToArray } = this.app.
|
|
13
|
+
const { attrToArray } = this.app.waibu
|
|
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.app.waibu
|
|
42
|
-
const { urlToBreadcrumb
|
|
41
|
+
const { routePath, attrToArray } = this.app.waibu
|
|
42
|
+
const { urlToBreadcrumb } = 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}';"`
|
|
@@ -11,7 +11,8 @@ async function collapse () {
|
|
|
11
11
|
build = async () => {
|
|
12
12
|
const { generateId } = this.app.lib.aneka
|
|
13
13
|
const { merge, isString } = this.app.lib._
|
|
14
|
-
const { attrToArray
|
|
14
|
+
const { attrToArray } = this.app.waibu
|
|
15
|
+
const { groupAttrs } = this.app.waibuMpa
|
|
15
16
|
const items = []
|
|
16
17
|
const { $ } = this.component
|
|
17
18
|
const me = this
|
|
@@ -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.app.
|
|
6
|
+
const { attrToArray } = this.app.waibu
|
|
7
7
|
const { $ } = this.component
|
|
8
8
|
const addons = []
|
|
9
9
|
const isLabel = has(this.params.attr, 'label')
|
|
@@ -9,14 +9,15 @@ export const scripts = 'waibuExtra.virtual:/tom-select/js/tom-select.complete.mi
|
|
|
9
9
|
|
|
10
10
|
async function formSelectExt () {
|
|
11
11
|
return class FormSelectExt extends this.app.baseClass.MpaWidget {
|
|
12
|
-
static css = [...super.css, css]
|
|
12
|
+
static css = [...super.css, ...css]
|
|
13
13
|
static scripts = [...super.scripts, scripts]
|
|
14
14
|
|
|
15
15
|
build = async () => {
|
|
16
16
|
const { generateId } = this.app.lib.aneka
|
|
17
17
|
const { omit, merge, has } = this.app.lib._
|
|
18
18
|
const { routePath } = this.app.waibu
|
|
19
|
-
const { jsonStringify,
|
|
19
|
+
const { jsonStringify, groupAttrs } = this.app.waibuMpa
|
|
20
|
+
const { base64JsonDecode } = this.app.waibu
|
|
20
21
|
const { req } = this.component
|
|
21
22
|
let apiKey = ''
|
|
22
23
|
if (req.user && this.app.sumba) apiKey = await this.app.sumba.getApiKeyFromUserId(req.user.id)
|
|
@@ -35,9 +36,7 @@ async function formSelectExt () {
|
|
|
35
36
|
try {
|
|
36
37
|
options = base64JsonDecode(this.params.attr.options)
|
|
37
38
|
} catch (err) {
|
|
38
|
-
options = this.params.attr.options
|
|
39
|
-
return { value: item, text: item }
|
|
40
|
-
})
|
|
39
|
+
options = this.params.attr.options
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
let opts = { plugins }
|
|
@@ -131,7 +130,7 @@ async function formSelectExt () {
|
|
|
131
130
|
this.params.attr['x-data'] = `{ ${xData.join(',\n')} }`
|
|
132
131
|
// this.params.attr['@load.window'] = 'onLoad()'
|
|
133
132
|
this.params.attr['x-init'] = 'onLoad()'
|
|
134
|
-
this.params.attr.options = options
|
|
133
|
+
if (options.length > 0) this.params.attr.options = options
|
|
135
134
|
this.params.attr = omit(this.params.attr, ['noDropdownInput', 'removeBtn', 'clearBtn', 'c-opts', 'remoteUrl', 'remoteSearchField', 'remoteLabelField', 'remoteValueField'])
|
|
136
135
|
await build.call(this, buildFormSelect, this.params)
|
|
137
136
|
}
|
|
@@ -10,7 +10,7 @@ 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.app.
|
|
13
|
+
const { attrToArray } = this.app.waibu
|
|
14
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'
|
|
@@ -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.app.
|
|
25
|
+
const { attrToArray } = this.app.waibu
|
|
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)
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-02-18
|
|
4
|
+
|
|
5
|
+
- [2.4.0] Update attribute functions from ```waibu```
|
|
6
|
+
- [2.4.0] Bug fix on ```FormSelectExt``` 's static css
|
|
7
|
+
- [2.4.0] Bug fix on ```FormSelectCountry``` 's static css
|
|
8
|
+
- [2.5.0] Remove ```FormSelectCountry``` alltogther
|
|
9
|
+
- [2.5.0] Bug fix on ```FormSelectExt```'s options
|
|
10
|
+
- [2.5.0] In read only mode, auto detect value from model's values
|
|
11
|
+
|
|
3
12
|
## 2026-02-15
|
|
4
13
|
|
|
5
14
|
- [2.3.0] Add capability to use custom tag on ```select```
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { css, scripts } from './form-select-ext.js'
|
|
2
|
-
|
|
3
|
-
async function formSelectCountry () {
|
|
4
|
-
return class FormSelectCountry extends this.app.baseClass.MpaWidget {
|
|
5
|
-
static css = [...super.css, css]
|
|
6
|
-
static scripts = [...super.scripts, scripts]
|
|
7
|
-
|
|
8
|
-
constructor (options) {
|
|
9
|
-
super(options)
|
|
10
|
-
this.params.noTag = true
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
build = async () => {
|
|
14
|
-
const { readConfig } = this.app.bajo
|
|
15
|
-
const { map } = this.app.lib._
|
|
16
|
-
const { base64JsonEncode } = this.app.waibuMpa
|
|
17
|
-
const countries = await readConfig('bajoCommonDb:/extend/dobo/fixture/country.json', { ignoreError: true, defValue: [] })
|
|
18
|
-
this.params.attr.options = base64JsonEncode(map(countries, c => {
|
|
19
|
-
return { value: c.id, text: c.name.replaceAll('\'', '') }
|
|
20
|
-
}))
|
|
21
|
-
this.params.html = await this.component.buildTag({ tag: 'formSelectExt', attr: this.params.attr, html: '' })
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default formSelectCountry
|