waibu-bootstrap 2.7.2 → 2.8.1
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/widget/_lib.js +2 -2
- package/extend/waibuMpa/theme/component/widget/form-check-toggle.js +1 -1
- package/extend/waibuMpa/theme/component/widget/form-check.js +1 -1
- package/extend/waibuMpa/theme/component/widget/form-input.js +1 -1
- package/extend/waibuMpa/theme/component/widget/form-plaintext.js +5 -8
- package/extend/waibuMpa/theme/component/widget/form-select-ext.js +10 -10
- package/extend/waibuMpa/theme/component/widget/navbar.js +1 -1
- package/extend/waibuMpa/theme/component/widget/scrollspy.js +1 -1
- package/package.json +1 -1
- package/wiki/CHANGES.md +5 -0
|
@@ -13,10 +13,10 @@ async function getInputAttr (group, formControl = true, ro) {
|
|
|
13
13
|
else {
|
|
14
14
|
const prop = this.getProp(attr.name)
|
|
15
15
|
attr.dataType = attr.dataType ?? prop.type
|
|
16
|
-
attr.dataValue =
|
|
16
|
+
attr.dataValue = this.formData[attr.name]
|
|
17
17
|
if (isPlainObject(attr.dataValue) || isArray(attr.dataValue)) attr.dataValue = JSON.stringify(attr.dataValue)
|
|
18
|
+
attr.value = escape(get(this.formData, `_fmt.${attr.name}`, attr.dataValue))
|
|
18
19
|
attr.dataValue = escape(attr.dataValue)
|
|
19
|
-
attr.value = attr.dataValue
|
|
20
20
|
if (prop.values) {
|
|
21
21
|
const values = (isString(prop.values) ? await callHandler(prop.values) : [...prop.values]).map(v => {
|
|
22
22
|
if (isString(v)) v = { value: v, text: v }
|
|
@@ -9,7 +9,7 @@ export async function build (handler, params = {}) {
|
|
|
9
9
|
if (!this.params.attr.label && this.params.attr.name) this.params.attr.label = this.component.req.t(`field.${this.params.attr.name}`)
|
|
10
10
|
const attr = groupAttrs(this.params.attr, ['label', 'hint', 'wrapper'])
|
|
11
11
|
const contents = []
|
|
12
|
-
attr._.id = this.params.attr.id ?? generateId()
|
|
12
|
+
attr._.id = this.params.attr.id ?? generateId('alpha')
|
|
13
13
|
if (attr._.color) attr.label.class.push(parseVariant.call(this, { cls: 'btn', value: attr._.color, values: colors, variants, prepend: true }))
|
|
14
14
|
delete attr._.color
|
|
15
15
|
|
|
@@ -10,7 +10,7 @@ export async function build (handler, params = {}) {
|
|
|
10
10
|
if (this.params.attr.noLabel) this.params.attr.label = undefined
|
|
11
11
|
const group = groupAttrs(this.params.attr, ['label', 'hint', 'wrapper', 'col'], false)
|
|
12
12
|
const contents = []
|
|
13
|
-
group._.id = this.params.attr.id ?? generateId()
|
|
13
|
+
group._.id = this.params.attr.id ?? generateId('alpha')
|
|
14
14
|
if (!isEmpty(group._.label)) {
|
|
15
15
|
group.wrapper.class.push('form-check')
|
|
16
16
|
if (group.wrapper.inline) group.wrapper.class.push('form-check-inline')
|
|
@@ -98,7 +98,7 @@ export async function build (handler, params = {}) {
|
|
|
98
98
|
|
|
99
99
|
if (group._.datalist && !['password', 'file', 'checkbox', 'radio'].includes(group._.type)) {
|
|
100
100
|
datalist = group._.datalist
|
|
101
|
-
group._.list = generateId()
|
|
101
|
+
group._.list = generateId('alpha')
|
|
102
102
|
}
|
|
103
103
|
const contents = await handleInput.call(this, { handler, params, group })
|
|
104
104
|
if (datalist) {
|
|
@@ -5,22 +5,19 @@ async function formPlaintext () {
|
|
|
5
5
|
return class FormPlaintext extends this.app.baseClass.MpaWidget {
|
|
6
6
|
build = async () => {
|
|
7
7
|
const { isEmpty, get } = this.app.lib._
|
|
8
|
-
const { req } = this.component
|
|
9
8
|
const { escape } = this.app.waibu
|
|
10
9
|
this.params.attr.disabled = true
|
|
11
10
|
const { name } = this.params.attr
|
|
12
11
|
if (this.params.attr.labelFloating) this.params.attr.class.push('border', 'rounded')
|
|
13
12
|
if (!isEmpty(name) && isEmpty(this.params.attr.value)) {
|
|
14
13
|
const prop = this.getProp(name)
|
|
15
|
-
const dataValue =
|
|
16
|
-
let value = get(this.oldData, name
|
|
14
|
+
const dataValue = this.formData[name] ?? ''
|
|
15
|
+
let value = get(this.oldData, `_fmt.${name}`, get(this.formData, `_fmt.${name}`, dataValue))
|
|
17
16
|
const format = get(this.schema, `view.format.${name}`)
|
|
18
|
-
const formatValue = get(this.schema, `view.formatValue.${name}`)
|
|
19
17
|
const labelField = get(this.schema, `view.widget.${name}.attr.labelField`)
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (format && !isEmpty(value)) this.params.attr.href = await format.call(this, value, this.formData, { linkOnly: true })
|
|
18
|
+
if (prop.ref) {
|
|
19
|
+
const newValue = this.getRefValue({ field: name, labelField, refName: this.getRefName(name) })
|
|
20
|
+
if (format && !isEmpty(newValue)) this.params.attr.href = await format.call(this, newValue, this.formData, { linkOnly: true })
|
|
24
21
|
} else if (format && !isEmpty(value)) value = await format.call(this, value, this.formData)
|
|
25
22
|
this.params.attr.dataValue = escape(dataValue)
|
|
26
23
|
this.params.attr.value = escape(value)
|
|
@@ -21,7 +21,7 @@ async function formSelectExt () {
|
|
|
21
21
|
const { req } = this.component
|
|
22
22
|
let apiKey = ''
|
|
23
23
|
if (req.user && this.app.sumba) apiKey = await this.app.sumba.getApiKeyFromUserId(req.user.id)
|
|
24
|
-
const xref = this.params.attr['x-ref'] ??
|
|
24
|
+
const xref = this.params.attr['x-ref'] ?? this.params.attr.name
|
|
25
25
|
this.params.attr.id = this.params.attr.id ?? generateId('alpha')
|
|
26
26
|
this.params.attr['x-ref'] = xref
|
|
27
27
|
const xData = ['instance: null', 'value: null']
|
|
@@ -31,14 +31,6 @@ async function formSelectExt () {
|
|
|
31
31
|
if (this.params.attr.clearBtn) plugins.push('clear_button')
|
|
32
32
|
if (this.params.attr.optgroupColumns) plugins.push('optgroup_columns')
|
|
33
33
|
if (this.params.attr.noCaret) this.params.attr.class.push('no-caret') // TODO: no caret remove caret on ALL instances, need to make it instance specific
|
|
34
|
-
let options = []
|
|
35
|
-
if (this.params.attr.options) {
|
|
36
|
-
try {
|
|
37
|
-
options = base64JsonDecode(this.params.attr.options)
|
|
38
|
-
} catch (err) {
|
|
39
|
-
options = this.params.attr.options
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
34
|
let opts = { plugins }
|
|
43
35
|
let cOpts = {}
|
|
44
36
|
if (this.params.attr.cOpts) {
|
|
@@ -138,9 +130,17 @@ async function formSelectExt () {
|
|
|
138
130
|
this.params.attr['x-data'] = `{ ${xData.join(',\n')} }`
|
|
139
131
|
// this.params.attr['@load.window'] = 'onLoad()'
|
|
140
132
|
this.params.attr['x-init'] = 'onLoad()'
|
|
133
|
+
await build.call(this, buildFormSelect, this.params)
|
|
134
|
+
let options = []
|
|
135
|
+
if (this.params.attr.options) {
|
|
136
|
+
try {
|
|
137
|
+
options = base64JsonDecode(this.params.attr.options)
|
|
138
|
+
} catch (err) {
|
|
139
|
+
options = this.params.attr.options
|
|
140
|
+
}
|
|
141
|
+
}
|
|
141
142
|
if (options.length > 0) this.params.attr.options = options
|
|
142
143
|
this.params.attr = omit(this.params.attr, ['noDropdownInput', 'removeBtn', 'clearBtn', 'c-opts', 'remoteUrl', 'remoteSearchField', 'remoteLabelField', 'remoteValueField', 'remoteQuery', 'remoteApiKey'])
|
|
143
|
-
await build.call(this, buildFormSelect, this.params)
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -37,7 +37,7 @@ async function navbar () {
|
|
|
37
37
|
if (this.params.attr.scroll) el.prop('style', `--bs-scroll-height: ${numUnit(this.params.attr.scroll, 'px')};`)
|
|
38
38
|
html = el.removeClass('nav').parent().html()
|
|
39
39
|
this.params.attr.class.push(parseSimple.call(this, { cls: `${cls}-expand`, value: this.params.attr.expandable, values: breakpoints }))
|
|
40
|
-
const id = generateId()
|
|
40
|
+
const id = generateId('alpha')
|
|
41
41
|
if (this.params.group.drawer) this.params.group.drawer.id = id
|
|
42
42
|
const btn = `<button class="navbar-toggler" type="button" data-bs-toggle="${type}" ` +
|
|
43
43
|
`data-bs-target="#${id}" aria-controls="${id}"${this.params.attr.drawer ? '' : ' aria-expanded="false"'} aria-label="${this.component.req.t('toggleNavigation')}">` +
|
|
@@ -10,7 +10,7 @@ async function scrollspy () {
|
|
|
10
10
|
build = async () => {
|
|
11
11
|
const { isString } = this.app.lib._
|
|
12
12
|
const { generateId } = this.app.lib.aneka
|
|
13
|
-
const target = isString(this.params.attr.target) ? this.params.attr.target : generateId()
|
|
13
|
+
const target = isString(this.params.attr.target) ? this.params.attr.target : generateId('alpha')
|
|
14
14
|
this.component.normalizeAttr(this.params, {
|
|
15
15
|
tag: 'div',
|
|
16
16
|
dataBsSpy: 'scroll',
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-04-25
|
|
4
|
+
|
|
5
|
+
- [2.8.0] Change options to format value using the new key set by dobo
|
|
6
|
+
- [2.8.0] Use ```generateId('alpha')``` to make sure all generated id in widget doesn;t start with number
|
|
7
|
+
|
|
3
8
|
## 2026-04-18
|
|
4
9
|
|
|
5
10
|
- [2.7.2] Bug fix in ```getInputAttr()``` of ```_lib.js```
|