waibu-bootstrap 2.6.4 → 2.7.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/_lib.js +2 -2
- package/extend/waibuMpa/theme/component/widget/_lib.js +3 -38
- package/extend/waibuMpa/theme/component/widget/container.js +1 -1
- package/extend/waibuMpa/theme/component/widget/form-select-ext.js +0 -1
- package/package.json +1 -1
- package/wiki/CHANGES.md +12 -0
|
@@ -28,7 +28,7 @@ export const colorVariants = ['outline']
|
|
|
28
28
|
export const placements = ['top', 'bottom', 'left', 'right']
|
|
29
29
|
|
|
30
30
|
export function parseVariant ({ cls = '', value = '', values = [], variants = [], prepend } = {}) {
|
|
31
|
-
const { isEmpty } = this.app.lib._
|
|
31
|
+
const { isEmpty } = this.plugin.app.lib._
|
|
32
32
|
if (value === true) return cls
|
|
33
33
|
const [core, variant] = value.split('-')
|
|
34
34
|
const items = []
|
|
@@ -41,7 +41,7 @@ export function parseVariant ({ cls = '', value = '', values = [], variants = []
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export function parseSimple ({ cls = '', value = '', values = [], acceptTrue } = {}) {
|
|
44
|
-
const { isEmpty } = this.app.lib._
|
|
44
|
+
const { isEmpty } = this.plugin.app.lib._
|
|
45
45
|
if (values.includes(value) || (acceptTrue && value === true)) {
|
|
46
46
|
if (isEmpty(cls)) return value
|
|
47
47
|
return acceptTrue && value === true ? cls : `${cls}-${value}`
|
|
@@ -1,48 +1,14 @@
|
|
|
1
1
|
import { sizes } from '../method/after-build-tag/_lib.js'
|
|
2
2
|
|
|
3
|
-
const trueValues = ['true', 'on', 'yes', '1', 1, true]
|
|
4
|
-
|
|
5
3
|
async function getInputAttr (group, formControl = true, ro) {
|
|
6
|
-
const { omit, get,
|
|
7
|
-
const { escape } = this.app.waibu
|
|
8
|
-
const { req } = this.component
|
|
4
|
+
const { omit, get, forOwn } = this.app.lib._
|
|
9
5
|
if (formControl) group._.class.push('form-control')
|
|
10
6
|
const attr = omit(group._, ['hint', 'label', 'wrapper'])
|
|
11
7
|
if (attr.href) {
|
|
12
|
-
forOwn(this
|
|
8
|
+
forOwn(get(this, 'component.locals.form', {}), (v, k) => {
|
|
13
9
|
attr.href = attr.href.replace(`%7B${k}%7D`, v)
|
|
14
10
|
})
|
|
15
11
|
}
|
|
16
|
-
if (has(attr, 'name') && !has(attr, 'value') && this.component.locals.form) {
|
|
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'
|
|
21
|
-
let val = get(this, `component.locals.form.${attr.name}`)
|
|
22
|
-
if (attr.dataType === 'boolean') {
|
|
23
|
-
val = trueValues.includes(val)
|
|
24
|
-
set(this, `component.locals.form.${attr.name}`, val)
|
|
25
|
-
}
|
|
26
|
-
if (isPlainObject(val) || isArray(val)) attr.dataValue = escape(JSON.stringify(val))
|
|
27
|
-
else if (isString(val)) attr.dataValue = escape(val)
|
|
28
|
-
else attr.dataValue = val
|
|
29
|
-
if (ro) {
|
|
30
|
-
if (attr.ref) {
|
|
31
|
-
const [ref, field = 'id'] = attr.ref.split(':')
|
|
32
|
-
attr.value = get(this, `component.locals.form._ref.${ref}.${field}`, val)
|
|
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
|
-
let items = prop.values
|
|
38
|
-
if (typeof prop.values === 'string') items = await this.app.bajo.callHandler(prop.values)
|
|
39
|
-
const item = find(items, { value: val }) ?? {}
|
|
40
|
-
const ttext = camelCase(`${prop.name} ${item.text}`)
|
|
41
|
-
attr.value = escape(req.format(!isEmpty(item) ? (req.te(ttext) ? req.t(ttext) : item.text) : val, attr.dataType))
|
|
42
|
-
} else attr.value = escape(req.format(val, attr.dataType))
|
|
43
|
-
} else attr.value = attr.dataValue
|
|
44
|
-
if (isArray(val)) attr.value = val.join(' ')
|
|
45
|
-
}
|
|
46
12
|
if (sizes.includes(attr.size) && formControl) attr.class.push(`form-control-${attr.size}`)
|
|
47
13
|
return omit(attr, ['size', 'col'])
|
|
48
14
|
}
|
|
@@ -112,7 +78,6 @@ export async function buildFormRadioToggle (group, params) {
|
|
|
112
78
|
|
|
113
79
|
export async function buildFormPlaintext (group, params) {
|
|
114
80
|
const attr = await getInputAttr.call(this, group, false, true)
|
|
115
|
-
delete attr.dataValue
|
|
116
81
|
attr.class.push('form-control-plaintext')
|
|
117
82
|
attr.readonly = ''
|
|
118
83
|
if (['object', 'array', 'text'].includes(attr.dataType)) {
|
|
@@ -120,7 +85,7 @@ export async function buildFormPlaintext (group, params) {
|
|
|
120
85
|
return await this.component.buildTag({ tag: 'textarea', attr, html: attr.value })
|
|
121
86
|
}
|
|
122
87
|
if (attr.href) {
|
|
123
|
-
const content = attr.value ? attr.value : attr.href
|
|
88
|
+
const content = attr.value ? this.component.req.t(attr.value) : attr.href
|
|
124
89
|
const html = await this.component.buildTag({ tag: 'a', attr: { href: attr.href, content } })
|
|
125
90
|
return await this.component.buildTag({ tag: 'div', attr, html })
|
|
126
91
|
}
|
|
@@ -12,7 +12,7 @@ async function container () {
|
|
|
12
12
|
build = async () => {
|
|
13
13
|
const { has, omit } = this.app.lib._
|
|
14
14
|
if (has(this.params.attr, 'responsive')) this.params.attr.class.push(`${cls}-fluid`)
|
|
15
|
-
else if (has(this.params.attr, 'breakpoint')) this.params.attr.class.push(parseSimple({ cls, value: this.params.attr.breakpoint, values: breakpoints }))
|
|
15
|
+
else if (has(this.params.attr, 'breakpoint')) this.params.attr.class.push(parseSimple.call(this, { cls, value: this.params.attr.breakpoint, values: breakpoints }))
|
|
16
16
|
else this.params.attr.class.push(cls)
|
|
17
17
|
this.params.attr = omit(this.params.attr, ['responsive', 'breakpoint'])
|
|
18
18
|
}
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-04-13
|
|
4
|
+
|
|
5
|
+
- [2.7.0] Rewrite ```getInputAttr()``` to not dependent to any template data, rather only depend on attributes
|
|
6
|
+
|
|
7
|
+
## 2026-04-11
|
|
8
|
+
|
|
9
|
+
- [2.6.5] Bug fix in ```form-select-ext``` widget
|
|
10
|
+
- [2.6.5] Bug fix in ```container``` widget
|
|
11
|
+
- [2.6.5] Bug fix in ```getInputAttr()```
|
|
12
|
+
- [2.6.5] Bug fix in ```parseVariant()```
|
|
13
|
+
- [2.6.5] Bug fix in ```parseSimple()```
|
|
14
|
+
|
|
3
15
|
## 2026-04-07
|
|
4
16
|
|
|
5
17
|
- [2.6.4] Bug fix on widget ```form-select-ext```
|