waibu-db 2.9.0 → 2.10.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.
|
@@ -21,7 +21,7 @@ async function table () {
|
|
|
21
21
|
return get(schema, 'view.noWrap', []).includes(field)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
_defFormatter = async ({ req, key, value, data, schema }) => {
|
|
24
|
+
_defFormatter = async ({ req, key, value, data, schema, params }) => {
|
|
25
25
|
const { get, find, camelCase, isEmpty } = this.app.lib._
|
|
26
26
|
const { escape } = this.app.waibu
|
|
27
27
|
const prop = find(schema.properties, { name: key })
|
|
@@ -34,7 +34,7 @@ async function table () {
|
|
|
34
34
|
const item = find(values, { value }) ?? {}
|
|
35
35
|
const ttext = camelCase(`${prop.name} ${item.text}`)
|
|
36
36
|
value = escape(req.format(!isEmpty(item) ? (req.te(ttext) ? req.t(ttext) : item.text) : value, prop.type))
|
|
37
|
-
if (item) value += ` <sup><a href="#" title="${req.t('dataValue')}: ${data[key]}">*</a></sup>`
|
|
37
|
+
if (item && !params.attr.noDataValueRef) value += ` <sup><a href="#" title="${req.t('dataValue')}: ${data[key]}">*</a></sup>`
|
|
38
38
|
} else if (['string', 'text'].includes(prop.type)) {
|
|
39
39
|
if (!get(schema, 'view.noEscape', []).includes(key)) value = escape(value)
|
|
40
40
|
}
|
|
@@ -175,8 +175,8 @@ async function table () {
|
|
|
175
175
|
if (item) value = req.t(item[lookup.field ?? 'name'])
|
|
176
176
|
}
|
|
177
177
|
const formatter = get(schema, `view.formatter.${f}`)
|
|
178
|
-
if (formatter) value = await formatter.call(this, value, d)
|
|
179
|
-
else value = await this._defFormatter({ req, key: f, schema, value, data: d })
|
|
178
|
+
if (formatter) value = await formatter.call(this, value, d, { params: this.params })
|
|
179
|
+
else value = await this._defFormatter({ req, key: f, schema, value, data: d, params: this.params })
|
|
180
180
|
const line = await this.component.buildTag({ tag: 'td', attr, html: value })
|
|
181
181
|
lines.push(line)
|
|
182
182
|
}
|
package/package.json
CHANGED