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)
|
|
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