waibu-db 2.21.2 → 2.21.3

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.
@@ -5,7 +5,7 @@ async function form () {
5
5
 
6
6
  return class WdbForm extends WdbBase {
7
7
  static async handleRo ({ attr = {}, prop = {}, widget = {} } = {}) {
8
- return await this.component.buildTag({ tag: 'formPlaintext', attr, selfCosing: true, noEscape: true }, { prop, widget })
8
+ return await this.component.buildTag({ tag: 'formPlaintext', attr, addons: widget.addons, selfCosing: true, noEscape: true }, { prop, widget })
9
9
  }
10
10
 
11
11
  static async handleRw ({ attr = {}, prop = {}, widget = {} } = {}) {
@@ -15,12 +15,11 @@ async function form () {
15
15
  if (has(attr, 'name') && !has(attr, 'value')) {
16
16
  attr.value = widget.component === 'form-plaintext' ? get(this, `oldData.${attr.name}`, attr.dataValue) : attr.dataValue
17
17
  }
18
- if (prop.virtual) widget.component = 'form-plaintext'
19
18
  return `<c:${widget.component} ${stringifyAttribs(attr)} />`
20
19
  }
21
20
 
22
21
  build = async () => {
23
- const { get, find, filter, forOwn, isEmpty, omit } = this.app.lib._
22
+ const { get, find, filter, forOwn, isEmpty, omit, isArray } = this.app.lib._
24
23
  const { base64JsonEncode } = this.app.waibu
25
24
  const body = []
26
25
  const xModels = get(this.schema, 'view.x.model', [])
@@ -51,11 +50,21 @@ async function form () {
51
50
  attr[`@${o.bind}`] = o.handler
52
51
  }
53
52
  if (widget.componentOpts) attr['c-opts'] = base64JsonEncode(widget.componentOpts)
53
+ if (prop.virtual) widget.component = 'form-plaintext'
54
+ widget.addons = widget.addons ?? []
55
+ if (!isArray(widget.addons)) widget.addons = [widget.addons]
56
+ for (const ao of widget.addons) {
57
+ const tag = ao.type === 'button' ? 'btn' : 'formInputAddon'
58
+ ao.html = await this.component.buildTag({ tag, attr: ao.attr, html: ao.html })
59
+ ao.position = ao.position ?? 'append'
60
+ }
61
+ let html
54
62
  if (widget.component === 'form-plaintext' || this.params.attr.method !== 'POST') {
55
- body.push(await WdbForm.handleRo.call(this, { attr, prop, widget }))
63
+ html = await WdbForm.handleRo.call(this, { attr, prop, widget })
56
64
  } else {
57
- body.push(await WdbForm.handleRw.call(this, { attr, prop, widget }))
65
+ html = await WdbForm.handleRw.call(this, { attr, prop, widget })
58
66
  }
67
+ body.push(html)
59
68
  }
60
69
  body.push('</c:fieldset>')
61
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "2.21.2",
3
+ "version": "2.21.3",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-06-01
4
+
5
+ - [2.21.3] Bug fix in ```wdb-form``` widget
6
+
3
7
  ## 2026-05-28
4
8
 
5
9
  - [2.21.1] Bug fix in ```get-schema-ext.js```