waibu-db 1.2.10 → 1.2.12
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/index.js
CHANGED
|
@@ -4,7 +4,7 @@ async function detailsHandler ({ req, reply, model, params = {}, id, template, a
|
|
|
4
4
|
const { pascalCase } = this.lib.aneka
|
|
5
5
|
const { recordGet, getSchemaExt } = this.app.waibuDb
|
|
6
6
|
const { merge } = this.lib._
|
|
7
|
-
const opts = {}
|
|
7
|
+
const opts = { rels: '*' }
|
|
8
8
|
model = model ?? pascalCase(req.params.model)
|
|
9
9
|
const { schema } = await getSchemaExt(model, 'details', merge({}, { params }, options))
|
|
10
10
|
if (schema.disabled.includes('get')) return await reply.view(templateDisabled, { action: 'details' })
|
package/package.json
CHANGED
|
@@ -38,10 +38,10 @@ function getCommons (action, schema, ext, options = {}) {
|
|
|
38
38
|
set(schema, 'view.x', x)
|
|
39
39
|
if (schema.disabled.length > 0) schema.view.disabled.push(...schema.disabled)
|
|
40
40
|
let fields = []
|
|
41
|
+
const calcFieldNames = map(calcFields, 'name')
|
|
41
42
|
for (const f of forFields) {
|
|
42
|
-
if (allFields.includes(f)) fields.push(f)
|
|
43
|
+
if (calcFieldNames.includes(f) || allFields.includes(f)) fields.push(f)
|
|
43
44
|
}
|
|
44
|
-
if (calcFields.length > 0) fields.push(...map(calcFields, 'name'))
|
|
45
45
|
fields = uniq(without(fields, ...hidden))
|
|
46
46
|
|
|
47
47
|
options.forceShowId = options.forceShowId ?? true
|
|
@@ -12,8 +12,10 @@ async function form () {
|
|
|
12
12
|
const xModels = get(schema, 'view.x.model', [])
|
|
13
13
|
const xOns = get(schema, 'view.x.on', [])
|
|
14
14
|
for (const l of schema.view.layout) {
|
|
15
|
+
const fields = filter(l.fields, f => schema.view.fields.includes(f))
|
|
16
|
+
if (fields.length === 0) continue
|
|
15
17
|
body.push(`<c:fieldset ${schema.view.card === false ? '' : 'card'} ${l.name[0] !== '_' ? ('t:legend="' + l.name + '"') : ''} grid-gutter="2">`)
|
|
16
|
-
for (const f of
|
|
18
|
+
for (const f of fields) {
|
|
17
19
|
const w = schema.view.widget[f]
|
|
18
20
|
let prop = find(schema.properties, { name: f })
|
|
19
21
|
if (!prop) prop = find(schema.view.calcFields, { name: f })
|
|
@@ -21,7 +23,8 @@ async function form () {
|
|
|
21
23
|
const attr = [`x-ref="${w.name}"`]
|
|
22
24
|
if (xModels.includes(w.name)) attr.push(`x-model="${w.name}"`)
|
|
23
25
|
forOwn(w.attr, (v, k) => {
|
|
24
|
-
attr.push(
|
|
26
|
+
if (v === true) attr.push(k)
|
|
27
|
+
else attr.push(`${k}="${v}"`)
|
|
25
28
|
})
|
|
26
29
|
const xon = filter(xOns, { field: w.name })
|
|
27
30
|
for (const o of xon) {
|