waibu-bootstrap 2.8.1 → 2.9.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.
@@ -1,7 +1,7 @@
1
1
  import { sizes } from '../method/after-build-tag/_lib.js'
2
2
 
3
3
  async function getInputAttr (group, formControl = true, ro) {
4
- const { has, omit, forOwn, isPlainObject, isArray, get, isString } = this.app.lib._
4
+ const { has, omit, isPlainObject, isArray, isString } = this.app.lib._
5
5
  const { callHandler } = this.app.bajo
6
6
  const { req } = this.component
7
7
  const { escape } = this.app.waibu
@@ -15,8 +15,9 @@ async function getInputAttr (group, formControl = true, ro) {
15
15
  attr.dataType = attr.dataType ?? prop.type
16
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
+ // attr.value = escape(get(this.formData, `_fmt.${attr.name}`, attr.dataValue))
19
19
  attr.dataValue = escape(attr.dataValue)
20
+ attr.value = attr.dataValue
20
21
  if (prop.values) {
21
22
  const values = (isString(prop.values) ? await callHandler(prop.values) : [...prop.values]).map(v => {
22
23
  if (isString(v)) v = { value: v, text: v }
@@ -29,11 +30,6 @@ async function getInputAttr (group, formControl = true, ro) {
29
30
  }
30
31
  }
31
32
  }
32
- if (attr.href) {
33
- forOwn(this.formData, (v, k) => {
34
- attr.href = attr.href.replace(`{${k}}`, v)
35
- })
36
- }
37
33
  if (sizes.includes(attr.size) && formControl) attr.class.push(`form-control-${attr.size}`)
38
34
  return omit(attr, ['size', 'col'])
39
35
  }
@@ -102,19 +98,11 @@ export async function buildFormRadioToggle (group, params) {
102
98
  }
103
99
 
104
100
  export async function buildFormPlaintext (group, params) {
101
+ const { omit } = this.app.lib._
105
102
  const attr = await getInputAttr.call(this, group, false, true)
106
103
  attr.class.push('form-control-plaintext')
107
104
  attr.readonly = ''
108
- if (['object', 'array', 'text'].includes(attr.dataType)) {
109
- attr.style.minHeight = '100px'
110
- return await this.component.buildTag({ tag: 'textarea', attr, html: attr.value })
111
- }
112
- if (attr.href) {
113
- const content = attr.value ? this.component.req.t(attr.value) : attr.href
114
- const html = await this.component.buildTag({ tag: 'a', attr: { href: attr.href, content } })
115
- return await this.component.buildTag({ tag: 'div', attr, html })
116
- }
117
- return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
105
+ return await this.component.buildTag({ tag: 'div', attr: omit(attr, ['value']), html: attr.value })
118
106
  }
119
107
 
120
108
  export async function buildFormColor (group, params) {
@@ -143,7 +131,11 @@ export async function buildFormSelect (group, params) {
143
131
  const { omit, trim } = this.app.lib._
144
132
  const { isSet } = this.app.lib.aneka
145
133
  const { $ } = this.component
134
+ const { unescape } = this.app.waibu
146
135
  let attr = await getInputAttr.call(this, group, false)
136
+ try {
137
+ attr.dataValue = JSON.parse(unescape(attr.dataValue)).join('|')
138
+ } catch (err) {}
147
139
  attr.value = isSet(attr.value) ? (attr.value + '') : undefined
148
140
  attr.class.push('form-select')
149
141
  let html = params.html
@@ -4,6 +4,7 @@ import { build } from './form-input.js'
4
4
  async function formPlaintext () {
5
5
  return class FormPlaintext extends this.app.baseClass.MpaWidget {
6
6
  build = async () => {
7
+ const { req } = this.component
7
8
  const { isEmpty, get } = this.app.lib._
8
9
  const { escape } = this.app.waibu
9
10
  this.params.attr.disabled = true
@@ -16,11 +17,13 @@ async function formPlaintext () {
16
17
  const format = get(this.schema, `view.format.${name}`)
17
18
  const labelField = get(this.schema, `view.widget.${name}.attr.labelField`)
18
19
  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 })
21
- } else if (format && !isEmpty(value)) value = await format.call(this, value, this.formData)
20
+ const result = this.getRefValue({ field: name, labelField, refName: this.getRefName(name) })
21
+ if (result) {
22
+ value = format ? await format.call(this, value, this.formData, { req }) : result
23
+ }
24
+ } else if (format) value = await format.call(this, value, this.formData, { req })
22
25
  this.params.attr.dataValue = escape(dataValue)
23
- this.params.attr.value = escape(value)
26
+ this.params.attr.value = value
24
27
  this.params.attr.dataType = prop.type
25
28
  }
26
29
  await build.call(this, buildFormPlaintext, this.params)
@@ -7,7 +7,10 @@ async function theme () {
7
7
  'waibuBootstrap.virtual:/bootstrap/js/bootstrap.bundle.min.js',
8
8
  'bajo.virtual:/lodash/lodash.min.js',
9
9
  '$waibuMpa:/wmpa.js',
10
- '$waibuBootstrap.asset:/js/wbs.js'
10
+ {
11
+ src: '$waibuBootstrap.asset:/js/wbs.js',
12
+ defer: true
13
+ }
11
14
  ]
12
15
  const meta = [{
13
16
  name: 'viewport',
@@ -3,10 +3,6 @@
3
3
  class Wbs {
4
4
  constructor () {
5
5
  this.engine = window.mdb ?? window.bootstrap
6
- this.init()
7
- }
8
-
9
- init () {
10
6
  window.addEventListener('load', evt => {
11
7
  const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
12
8
  const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new this.engine.Popover(popoverTriggerEl)) // eslint-disable-line no-unused-vars
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-bootstrap",
3
- "version": "2.8.1",
3
+ "version": "2.9.0",
4
4
  "description": "Bootstrap suport for Waibu Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-05-11
4
+
5
+ - [2.9.0] Updates to match ```dobo@2.23.0``` specs
6
+ - [2.9.0] Bug fix in ```theme.js```
7
+ - [2.9.0] Auto link for widget bound to database with refs
8
+
9
+ ## 2026-05-03
10
+
11
+ - [2.8.2] Bug fix in ```form-plaintext``` widgets
12
+
3
13
  ## 2026-04-25
4
14
 
5
15
  - [2.8.0] Change options to format value using the new key set by dobo