waibu-db 2.18.1 → 2.18.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.
|
@@ -23,6 +23,7 @@ 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 { isHtmlLink } = this.app.bajoExtra
|
|
26
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._
|
|
@@ -131,7 +132,6 @@ async function table () {
|
|
|
131
132
|
else if (['array', 'object'].includes(prop.type)) dataValue = escape(JSON.stringify(dataValue))
|
|
132
133
|
const refName = get(schema, `view.widget.${f}.attr.refName`)
|
|
133
134
|
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
135
|
const attr = { dataValue, dataKey: prop.name, dataType: prop.type }
|
|
136
136
|
if (!disableds.includes('get')) attr.style = { cursor: 'pointer' }
|
|
137
137
|
const formatCell = get(schema, `view.formatCell.${f}`)
|
|
@@ -141,6 +141,7 @@ async function table () {
|
|
|
141
141
|
else attr.text = `${noWrap}`
|
|
142
142
|
const format = get(schema, `view.format.${f}`)
|
|
143
143
|
if (format) value = await format.call(this, value, d, { params: this.params, req })
|
|
144
|
+
if (!get(schema, 'view.noEscape', []).includes(f) && !isHtmlLink(value)) value = escape(value)
|
|
144
145
|
const line = await this.component.buildTag({ tag: 'td', attr, html: value })
|
|
145
146
|
lines.push(line)
|
|
146
147
|
}
|
|
@@ -15,6 +15,7 @@ async function form () {
|
|
|
15
15
|
if (has(attr, 'name') && !has(attr, 'value')) {
|
|
16
16
|
attr.value = widget.component === 'form-plaintext' ? get(this, `oldData.${attr.name}`, attr.dataValue) : attr.dataValue
|
|
17
17
|
}
|
|
18
|
+
if (prop.virtual) widget.component = 'form-plaintext'
|
|
18
19
|
return `<c:${widget.component} ${stringifyAttribs(attr)} />`
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -30,9 +31,9 @@ async function form () {
|
|
|
30
31
|
body.push(`<c:fieldset ${this.schema.view.card === false ? '' : 'card'} ${l.name[0] !== '_' ? ('t:legend="' + l.name + '"') : ''} grid-gutter="2">`)
|
|
31
32
|
for (const f of fields) {
|
|
32
33
|
const widget = this.schema.view.widget[f]
|
|
33
|
-
|
|
34
|
-
if (!prop) prop = find(this.schema.view.calcFields, { name: f })
|
|
34
|
+
const prop = find(this.schema.properties, { name: f })
|
|
35
35
|
if (!prop) continue
|
|
36
|
+
if (['dobo:image'].includes(prop.feature)) continue
|
|
36
37
|
const attr = {
|
|
37
38
|
'x-ref': widget.name,
|
|
38
39
|
labelFloating: true,
|
package/lib/crud/edit-handler.js
CHANGED
|
@@ -2,10 +2,8 @@ import { attachmentHandler, notFoundTpl } from './helper.js'
|
|
|
2
2
|
|
|
3
3
|
async function editHandler ({ req, reply, model, id, params = {}, template, addOnsHandler, templateDisabled = 'waibuDb.template:/disabled.html', options = {} } = {}) {
|
|
4
4
|
const { pascalCase } = this.app.lib.aneka
|
|
5
|
-
const { getPluginDataDir } = this.app.bajo
|
|
6
5
|
const { updateRecord, getRecord, getSchemaExt } = this.app.waibuDb
|
|
7
6
|
const { buildUrl } = this.app.waibuMpa
|
|
8
|
-
const { fs } = this.app.lib
|
|
9
7
|
const { defaultsDeep } = this.app.lib.aneka
|
|
10
8
|
const { merge, isEmpty, omit, cloneDeep, isArray, isPlainObject } = this.app.lib._
|
|
11
9
|
const opts = merge({}, options.modelOpts)
|
|
@@ -34,12 +32,12 @@ async function editHandler ({ req, reply, model, id, params = {}, template, addO
|
|
|
34
32
|
req.body._value = JSON.parse(req.body._value)
|
|
35
33
|
} catch (err) {}
|
|
36
34
|
if (req.body._action === 'removeatt' && !isEmpty(req.body._value)) {
|
|
37
|
-
const root = `${getPluginDataDir('dobo')}/attachment`
|
|
38
35
|
for (const item of req.body._value) {
|
|
39
36
|
try {
|
|
40
|
-
const
|
|
41
|
-
await
|
|
42
|
-
} catch (err) {
|
|
37
|
+
const [,,, field, fname] = item.split('/')
|
|
38
|
+
await mdl.removeAttachment(id, field, fname)
|
|
39
|
+
} catch (err) {
|
|
40
|
+
}
|
|
43
41
|
}
|
|
44
42
|
if (req && req.flash) req.flash('notify', req.t('attachmentRemoved'))
|
|
45
43
|
} else {
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-05-03
|
|
4
|
+
|
|
5
|
+
- [2.18.3] Bug fix in ```wdb-data-table``` widget
|
|
6
|
+
|
|
7
|
+
## 2026-05-02
|
|
8
|
+
|
|
9
|
+
- [2.18.2] Bug fix in ```wdb-data-table``` widget
|
|
10
|
+
- [2.18.2] Bug fix in ```wdb-form``` widget
|
|
11
|
+
|
|
3
12
|
## 2026-04-25
|
|
4
13
|
|
|
5
14
|
- [2.18.0] Change options to format value using the new key set by dobo
|