waibu-db 1.0.8 → 1.0.9
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
|
@@ -24,7 +24,7 @@ async function btnColumns () {
|
|
|
24
24
|
items.push(await this.component.buildTag({ tag: 'formCheck', attr: { checked: true, label: req.t('ID'), value: f, disabled: true } }))
|
|
25
25
|
continue
|
|
26
26
|
}
|
|
27
|
-
const attr = { 'x-model': 'selected', label: req.t(`field.${f}`), value: f }
|
|
27
|
+
const attr = { 'x-model': 'selected', label: req.t(get(schema, `view.label.${f}`, `field.${f}`)), value: f }
|
|
28
28
|
if (fields.includes(f)) attr.checked = true
|
|
29
29
|
items.push(await this.component.buildTag({ tag: 'formCheck', attr }))
|
|
30
30
|
}
|
|
@@ -32,9 +32,10 @@ async function query () {
|
|
|
32
32
|
if (ops.length === 0) continue
|
|
33
33
|
const sels = ops.map(o => `<c:option>${o}</c:option>`)
|
|
34
34
|
models.push(`${f}Op: 'eq'`, `${f}Val: ''`)
|
|
35
|
+
const label = this.component.req.t(get(schema, `view.label.${f}`, `field.${f}`))
|
|
35
36
|
columns.push(`
|
|
36
37
|
<c:grid-col col="4-md" flex="align-items:center">
|
|
37
|
-
<c:form-check x-model="selected" t:label="
|
|
38
|
+
<c:form-check x-model="selected" t:label="${label}" value="${f}" />
|
|
38
39
|
</c:grid-col>
|
|
39
40
|
<c:grid-col col="3-md">
|
|
40
41
|
<c:form-select x-model="${f}Op">
|
|
@@ -20,9 +20,10 @@ async function table () {
|
|
|
20
20
|
|
|
21
21
|
async build () {
|
|
22
22
|
const { req } = this.component
|
|
23
|
+
const { callHandler } = this.plugin.app.bajo
|
|
23
24
|
const { escape } = this.plugin.app.waibu
|
|
24
25
|
const { attrToArray, groupAttrs } = this.plugin.app.waibuMpa
|
|
25
|
-
const { get, omit, set, find, isEmpty, without } = this.plugin.app.bajo.lib._
|
|
26
|
+
const { get, omit, set, find, isEmpty, without, isFunction } = this.plugin.app.bajo.lib._
|
|
26
27
|
const group = groupAttrs(this.params.attr, ['body', 'head', 'foot'])
|
|
27
28
|
this.params.attr = group._
|
|
28
29
|
const prettyUrl = this.params.attr.prettyUrl
|
|
@@ -69,7 +70,7 @@ async function table () {
|
|
|
69
70
|
const href = this.component.buildUrl({ params: item })
|
|
70
71
|
const attr = this.isRightAligned(f, schema) ? { text: 'align:end' } : {}
|
|
71
72
|
const content = [
|
|
72
|
-
await this.component.buildTag({ tag: 'div', attr, html:
|
|
73
|
+
await this.component.buildTag({ tag: 'div', attr, html: head }),
|
|
73
74
|
await this.component.buildTag({ tag: 'a', attr: { icon, href }, prepend: '<div class="ms-1">', append: '</div>' })
|
|
74
75
|
]
|
|
75
76
|
head = await this.component.buildTag({ tag: 'div', attr: { flex: 'justify-content:between align-items:end' }, html: content.join('\n') })
|
|
@@ -125,7 +126,11 @@ async function table () {
|
|
|
125
126
|
else attr.text = noWrap
|
|
126
127
|
}
|
|
127
128
|
const formatter = get(schema, `formatter.${f}`)
|
|
128
|
-
if (formatter)
|
|
129
|
+
if (formatter) {
|
|
130
|
+
if (isFunction(formatter)) value = await formatter(dataValue, d)
|
|
131
|
+
else value = await callHandler(formatter, req, dataValue, d)
|
|
132
|
+
value = await this.component.buildSentence(value)
|
|
133
|
+
}
|
|
129
134
|
const line = await this.component.buildTag({ tag: 'td', attr, html: value })
|
|
130
135
|
lines.push(line)
|
|
131
136
|
}
|