waibu-db 2.18.2 → 2.18.4
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.
|
@@ -23,7 +23,8 @@ async function table () {
|
|
|
23
23
|
const { req } = this.component
|
|
24
24
|
const { escape, attrToArray } = this.app.waibu
|
|
25
25
|
const { groupAttrs } = this.app.waibuMpa
|
|
26
|
-
const {
|
|
26
|
+
const { isHtmlLink } = this.app.bajoExtra
|
|
27
|
+
const { get, omit, set, find, isEmpty, without, merge } = this.app.lib._
|
|
27
28
|
const group = groupAttrs(this.params.attr, ['body', 'head', 'foot'])
|
|
28
29
|
this.params.attr = group._
|
|
29
30
|
const prettyUrl = this.params.attr.prettyUrl
|
|
@@ -127,16 +128,10 @@ async function table () {
|
|
|
127
128
|
if (!prop) continue
|
|
128
129
|
let dataValue = d[f]
|
|
129
130
|
if (['datetime'].includes(prop.type) && dataValue instanceof Date && !isNaN(dataValue)) dataValue = escape(dataValue.toISOString())
|
|
130
|
-
else if (['string', 'text'].includes(prop.type)) dataValue = escape(dataValue)
|
|
131
|
-
else if (['array', 'object'].includes(prop.type)) dataValue = escape(JSON.stringify(dataValue))
|
|
131
|
+
else if (['string', 'text', 'array', 'object'].includes(prop.type)) dataValue = escape(dataValue)
|
|
132
132
|
const refName = get(schema, `view.widget.${f}.attr.refName`)
|
|
133
133
|
let value = this.getRefValue({ field: f, data: d, refName }) ?? get(d, `_fmt.${f}`, d[f])
|
|
134
|
-
if (!get(schema, 'view.noEscape', []).includes(f)) value = escape(value)
|
|
135
134
|
const attr = { dataValue, dataKey: prop.name, dataType: prop.type }
|
|
136
|
-
if (isString(d[f]) && d[f].startsWith('<a ')) {
|
|
137
|
-
delete attr.dataValue
|
|
138
|
-
value = d[f]
|
|
139
|
-
}
|
|
140
135
|
if (!disableds.includes('get')) attr.style = { cursor: 'pointer' }
|
|
141
136
|
const formatCell = get(schema, `view.formatCell.${f}`)
|
|
142
137
|
if (formatCell) merge(attr, await formatCell.call(this, value, d, { params: this.params, req }))
|
|
@@ -145,6 +140,7 @@ async function table () {
|
|
|
145
140
|
else attr.text = `${noWrap}`
|
|
146
141
|
const format = get(schema, `view.format.${f}`)
|
|
147
142
|
if (format) value = await format.call(this, value, d, { params: this.params, req })
|
|
143
|
+
if (!get(schema, 'view.noEscape', []).includes(f) && !isHtmlLink(value)) value = escape(value)
|
|
148
144
|
const line = await this.component.buildTag({ tag: 'td', attr, html: value })
|
|
149
145
|
lines.push(line)
|
|
150
146
|
}
|
package/package.json
CHANGED