waibu-db 2.12.0 → 2.12.1
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/extend/bajoTemplate/partial/crud/_list-btns.html +1 -0
- package/extend/waibuBootstrap/theme/component/widget/btn-details.js +1 -1
- package/extend/waibuBootstrap/theme/component/widget/form.js +8 -1
- package/extend/waibuBootstrap/theme/component/widget/table.js +2 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/wiki/CHANGES.md +5 -0
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<c:grid-col col="8-lg" flex="justify-content:end-lg">
|
|
6
6
|
<c:btn-group margin="end-2">
|
|
7
7
|
<c:wdb-btn-add text="nowrap"/>
|
|
8
|
+
<c:wdb-btn-details on-list text="nowrap"/>
|
|
8
9
|
<c:wdb-btn-edit on-list menu-dir="end"/>
|
|
9
10
|
</c:btn-group>
|
|
10
11
|
<c:wdb-btn-delete on-list margin="end-2" />
|
|
@@ -10,7 +10,7 @@ async function btnDetails () {
|
|
|
10
10
|
const { isEmpty, get } = this.app.lib._
|
|
11
11
|
this.params.noTag = true
|
|
12
12
|
const schema = get(this, 'component.locals.schema', {})
|
|
13
|
-
if (schema.view.disabled.includes('
|
|
13
|
+
if (schema.view.disabled.includes('get')) {
|
|
14
14
|
this.params.html = ''
|
|
15
15
|
return
|
|
16
16
|
}
|
|
@@ -7,7 +7,9 @@ async function form () {
|
|
|
7
7
|
build = async () => {
|
|
8
8
|
const { get, find, filter, forOwn, isEmpty } = this.app.lib._
|
|
9
9
|
const { base64JsonEncode } = this.app.waibu
|
|
10
|
+
const { req } = this.component
|
|
10
11
|
const schema = get(this, 'component.locals.schema', {})
|
|
12
|
+
const data = get(this, 'component.locals.form', {})
|
|
11
13
|
const body = []
|
|
12
14
|
const xModels = get(schema, 'view.x.model', [])
|
|
13
15
|
const xOns = get(schema, 'view.x.on', [])
|
|
@@ -31,7 +33,12 @@ async function form () {
|
|
|
31
33
|
attr.push(`@${o.bind}="${o.handler}"`)
|
|
32
34
|
}
|
|
33
35
|
if (w.componentOpts) attr.push(`c-opts="${base64JsonEncode(w.componentOpts)}"`)
|
|
34
|
-
|
|
36
|
+
if (schema.view.valueFormatter[f] && this.params.attr.method !== 'POST') {
|
|
37
|
+
const value = await schema.view.valueFormatter[f].call(this, data[f], data, { req })
|
|
38
|
+
body.push(`<c:${w.component} ${w.attr.label ? ('t:label="' + w.attr.label + '"') : ''} value="${value}" label-floating name="${w.name}" ${attr.join(' ')} />`)
|
|
39
|
+
} else {
|
|
40
|
+
body.push(`<c:${w.component} ${w.attr.label ? ('t:label="' + w.attr.label + '"') : ''} data-type="${prop.type}" label-floating name="${w.name}" ${attr.join(' ')} />`)
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
body.push('</c:fieldset>')
|
|
37
44
|
}
|
|
@@ -165,7 +165,7 @@ async function table () {
|
|
|
165
165
|
const attr = { dataValue, dataKey: prop.name, dataType: prop.type }
|
|
166
166
|
if (!disableds.includes('get')) attr.style = { cursor: 'pointer' }
|
|
167
167
|
const cellFormatter = get(schema, `view.cellFormatter.${f}`)
|
|
168
|
-
if (cellFormatter) merge(attr, await cellFormatter.call(this, dataValue, d))
|
|
168
|
+
if (cellFormatter) merge(attr, await cellFormatter.call(this, dataValue, d, { params: this.params, req }))
|
|
169
169
|
const noWrap = this.isNoWrap(f, schema, group.body.nowrap) ? 'nowrap' : ''
|
|
170
170
|
if (this.isRightAligned(f, schema)) attr.text = `align:end ${noWrap}`
|
|
171
171
|
else attr.text = noWrap
|
|
@@ -175,7 +175,7 @@ async function table () {
|
|
|
175
175
|
if (item) value = req.t(item[lookup.field ?? 'name'])
|
|
176
176
|
}
|
|
177
177
|
const formatter = get(schema, `view.formatter.${f}`)
|
|
178
|
-
if (formatter) value = await formatter.call(this, value, d, { params: this.params })
|
|
178
|
+
if (formatter) value = await formatter.call(this, value, d, { params: this.params, req })
|
|
179
179
|
else value = await this._defFormatter({ req, key: f, schema, value, data: d, params: this.params })
|
|
180
180
|
const line = await this.component.buildTag({ tag: 'td', attr, html: value })
|
|
181
181
|
lines.push(line)
|
package/index.js
CHANGED
|
@@ -203,7 +203,7 @@ async function factory (pkgName) {
|
|
|
203
203
|
rec[f] = format(data[f], prop.type, opts)
|
|
204
204
|
const vf = get(schema, `view.valueFormatter.${f}`)
|
|
205
205
|
if (vf) {
|
|
206
|
-
if (isFunction(vf)) rec[f] = await vf.call(this, data[f], data)
|
|
206
|
+
if (isFunction(vf)) rec[f] = await vf.call(this, data[f], data, { req })
|
|
207
207
|
else rec[f] = await callHandler(vf, { req, value: data[f], data })
|
|
208
208
|
} else if (['string', 'text'].includes(prop.type)) rec[f] = escape(rec[f])
|
|
209
209
|
}
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-03-27
|
|
4
|
+
|
|
5
|
+
- [2.12.1] Bug fix in all ```view.formatter``` & ```view.valueFormatter```
|
|
6
|
+
- [2.12.1] Bug fix in ```wdb-form``` & ```wdb-table``` widgets, now correctly use value from formatter if provided
|
|
7
|
+
|
|
3
8
|
## 2026-03-26
|
|
4
9
|
|
|
5
10
|
- [2.11.0] Adding ```suppressError``` to model options
|