waibu-db 2.21.3 → 2.22.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.
@@ -25,7 +25,7 @@ async function table () {
25
25
  const { groupAttrs } = this.app.waibuMpa
26
26
  const { isHtmlLink } = this.app.bajoExtra
27
27
  const { getTruncated } = this.app.bajoTemplate
28
- const { get, omit, set, find, isEmpty, without, merge, intersection } = this.app.lib._
28
+ const { get, omit, set, find, isEmpty, without, merge, intersection, isPlainObject } = this.app.lib._
29
29
  const { isSet } = this.app.lib.aneka
30
30
  const group = groupAttrs(this.params.attr, ['body', 'head', 'foot'])
31
31
  this.params.attr = group._
@@ -146,7 +146,10 @@ async function table () {
146
146
  else attr.text = `${noWrap}`
147
147
  if (d._immutable) attr.text += ' color:body-tertiary'
148
148
  const format = get(schema, `view.format.${f}`)
149
- if (format) value = await format.call(this, value, d, { params: this.params, req })
149
+ if (format) {
150
+ const formatted = await format.call(this, value, d, { params: this.params, req })
151
+ value = isPlainObject(formatted) ? `<a href="${formatted.href}">${formatted.value}</a>` : formatted
152
+ }
150
153
  if (['object', 'array'].includes(prop.type) && !isHtmlLink(value)) value = getTruncated(value, 20) // TODO: should be handle by css instead
151
154
  if (!get(schema, 'view.noEscape', []).includes(f) && !isHtmlLink(value)) value = escape(value)
152
155
  const line = await this.component.buildTag({ tag: 'td', attr, html: value })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "2.21.3",
3
+ "version": "2.22.0",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -3,6 +3,7 @@
3
3
  ## 2026-06-01
4
4
 
5
5
  - [2.21.3] Bug fix in ```wdb-form``` widget
6
+ - [2.22.0] Now use the new ```format``` definition for ```virtual``` column in ```wdb-data-table``` widget
6
7
 
7
8
  ## 2026-05-28
8
9