waibu-db 1.1.2 → 1.1.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.
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ async function table () {
|
|
|
23
23
|
const { callHandler } = this.plugin.app.bajo
|
|
24
24
|
const { escape } = this.plugin.app.waibu
|
|
25
25
|
const { attrToArray, groupAttrs } = this.plugin.app.waibuMpa
|
|
26
|
-
const { get, omit, set, find, isEmpty, without, isFunction } = this.plugin.app.bajo.lib._
|
|
26
|
+
const { get, omit, set, find, isEmpty, without, isFunction, merge } = this.plugin.app.bajo.lib._
|
|
27
27
|
const group = groupAttrs(this.params.attr, ['body', 'head', 'foot'])
|
|
28
28
|
this.params.attr = group._
|
|
29
29
|
const prettyUrl = this.params.attr.prettyUrl
|
|
@@ -127,6 +127,8 @@ async function table () {
|
|
|
127
127
|
if (['string', 'text'].includes(prop.type)) dataValue = escape(dataValue)
|
|
128
128
|
if (['array', 'object'].includes(prop.type)) dataValue = escape(JSON.stringify(d[f]))
|
|
129
129
|
const attr = { dataValue, dataKey: prop.name, dataType: prop.type, style: { cursor: 'pointer' } }
|
|
130
|
+
const cellFormatter = get(schema, `view.cellFormatter.${f}`)
|
|
131
|
+
if (cellFormatter) merge(attr, await cellFormatter(dataValue, d))
|
|
130
132
|
if (!['object', 'array'].includes(prop.type)) {
|
|
131
133
|
const noWrap = this.isNoWrap(f, schema) ? 'nowrap' : ''
|
|
132
134
|
if (this.isRightAligned(f, schema)) attr.text = `align:end ${noWrap}`
|
|
@@ -140,13 +142,13 @@ async function table () {
|
|
|
140
142
|
const formatter = get(schema, `view.formatter.${f}`)
|
|
141
143
|
if (formatter) {
|
|
142
144
|
if (isFunction(formatter)) value = await formatter(dataValue, d)
|
|
143
|
-
else value = await callHandler(
|
|
145
|
+
else value = await callHandler(formatter, req, dataValue, d)
|
|
144
146
|
value = await this.component.buildSentence(value)
|
|
145
147
|
}
|
|
146
148
|
const line = await this.component.buildTag({ tag: 'td', attr, html: value })
|
|
147
149
|
lines.push(line)
|
|
148
150
|
}
|
|
149
|
-
const attr = {}
|
|
151
|
+
const attr = { id: `rec-${d.id}` }
|
|
150
152
|
if (!disableds.includes('update') || !disableds.includes('remove')) attr['@click'] = `toggle('${d.id}')`
|
|
151
153
|
if (!disableds.includes('get')) attr['@dblclick'] = `goDetails('${d.id}')`
|
|
152
154
|
items.push(await this.component.buildTag({ tag: 'tr', attr, html: lines.join('\n') }))
|