waibu-bootstrap 2.6.4 → 2.6.5
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 +7 -30
- 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 +8 -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,11 +1,8 @@
|
|
|
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,
|
|
4
|
+
const { omit, get, isPlainObject, isArray, has, forOwn, find } = this.app.lib._
|
|
7
5
|
const { escape } = this.app.waibu
|
|
8
|
-
const { req } = this.component
|
|
9
6
|
if (formControl) group._.class.push('form-control')
|
|
10
7
|
const attr = omit(group._, ['hint', 'label', 'wrapper'])
|
|
11
8
|
if (attr.href) {
|
|
@@ -17,31 +14,11 @@ async function getInputAttr (group, formControl = true, ro) {
|
|
|
17
14
|
let prop = {}
|
|
18
15
|
const schema = get(this, 'component.locals.schema')
|
|
19
16
|
if (schema) prop = find(schema.properties, { name: attr.name }) ?? {}
|
|
20
|
-
attr.dataType = attr.dataType ?? prop.type
|
|
21
|
-
|
|
22
|
-
if (attr.
|
|
23
|
-
|
|
24
|
-
|
|
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(' ')
|
|
17
|
+
attr.dataType = attr.dataType ?? prop.type
|
|
18
|
+
attr.dataValue = get(this, `component.locals.form._orig.${attr.name}`)
|
|
19
|
+
if (isPlainObject(attr.dataValue) || isArray(attr.dataValue)) attr.dataValue = JSON.stringify(attr.dataValue)
|
|
20
|
+
attr.dataValue = escape(attr.dataValue)
|
|
21
|
+
attr.value = escape(get(this, `component.locals.form.${attr.name}`))
|
|
45
22
|
}
|
|
46
23
|
if (sizes.includes(attr.size) && formControl) attr.class.push(`form-control-${attr.size}`)
|
|
47
24
|
return omit(attr, ['size', 'col'])
|
|
@@ -112,7 +89,7 @@ export async function buildFormRadioToggle (group, params) {
|
|
|
112
89
|
|
|
113
90
|
export async function buildFormPlaintext (group, params) {
|
|
114
91
|
const attr = await getInputAttr.call(this, group, false, true)
|
|
115
|
-
delete attr.dataValue
|
|
92
|
+
// delete attr.dataValue
|
|
116
93
|
attr.class.push('form-control-plaintext')
|
|
117
94
|
attr.readonly = ''
|
|
118
95
|
if (['object', 'array', 'text'].includes(attr.dataType)) {
|
|
@@ -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,13 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-04-11
|
|
4
|
+
|
|
5
|
+
- [2.6.5] Bug fix in ```form-select-ext``` widget
|
|
6
|
+
- [2.6.5] Bug fix in ```container``` widget
|
|
7
|
+
- [2.6.5] Bug fix in ```getInputAttr()```
|
|
8
|
+
- [2.6.5] Bug fix in ```parseVariant()```
|
|
9
|
+
- [2.6.5] Bug fix in ```parseSimple()```
|
|
10
|
+
|
|
3
11
|
## 2026-04-07
|
|
4
12
|
|
|
5
13
|
- [2.6.4] Bug fix on widget ```form-select-ext```
|