waibu-db 2.34.0 → 2.34.2

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.
@@ -1,6 +1,6 @@
1
1
  <c:grid-row gutter="3">
2
2
  <c:grid-col col="5-lg">
3
- <c:wdb-query />
3
+ <c:wdb-query mini />
4
4
  </c:grid-col>
5
5
  <c:grid-col col="7-lg" flex="justify-content:end-lg">
6
6
  <c:btn-group margin="end-2">
@@ -1,4 +1,4 @@
1
- <c:card>
1
+ <c:card border>
2
2
  <c:card-header>
3
3
  <c:card-title t:content="<%= attr.name %>" />
4
4
  </c:card-header>
@@ -37,13 +37,13 @@ async function table () {
37
37
  const count = get(locals, 'list.count', 0)
38
38
  const allowed = await this.isActionAllowed('READ')
39
39
  if (!allowed) {
40
- const alert = '<c:alert color="error" t:content="accessDenied" margin="top-4"/>'
40
+ const alert = '<c:alert color="error" t:content="accessDenied" margin="top-4 x-4"/>'
41
41
  this.params.noTag = true
42
42
  this.params.html = await buildSentence(alert)
43
43
  return
44
44
  }
45
45
  if (count === 0 || data.length === 0) {
46
- const alert = '<c:alert color="warning" t:content="noRecordFound" margin="top-4"/>'
46
+ const alert = '<c:alert color="warning" t:content="noRecordFound" margin="top-4 x-4"/>'
47
47
  this.params.noTag = true
48
48
  this.params.html = await buildSentence(alert)
49
49
  return
@@ -37,11 +37,11 @@ async function echartsBar () {
37
37
  }]
38
38
  })
39
39
  const onLoad = []
40
- if (this.params.attr.remote) {
41
- const remote = this._parseBase64Attr(this.params.attr.remote)
42
- onLoad.push(`
40
+ const remote = this.params.attr.remote ? this._parseBase64Attr(this.params.attr.remote) : {}
41
+ const data = [
42
+ `async load (params) {
43
43
  this.chart.showLoading('default', { text: '' })
44
- const remote = ${jsonStringify(remote, true)}
44
+ const remote = params ?? ${jsonStringify(remote, true)}
45
45
  const agg = remote.filter.aggregate ?? 'count'
46
46
  const recs = await wmpa.fetchApi(remote.url, { fetching: false }, remote.filter)
47
47
  this.chart.hideLoading()
@@ -49,9 +49,14 @@ async function echartsBar () {
49
49
  xAxis: { data: _.map(recs, remote.key.name) },
50
50
  series: [{ type: 'bar', data: _.map(recs, remote.key.value ?? agg ) }]
51
51
  }
52
+ }`
53
+ ]
54
+ if (!this.params.attr.noAutoLoad) {
55
+ onLoad.push(`
56
+ this.load()
52
57
  `)
53
58
  }
54
- this._build({ onLoad })
59
+ this._build({ onLoad, data })
55
60
  }
56
61
  }
57
62
  }
@@ -17,11 +17,11 @@ async function echartsPie () {
17
17
  }]
18
18
  })
19
19
  const onLoad = []
20
- if (this.params.attr.remote) {
21
- const remote = this._parseBase64Attr(this.params.attr.remote)
22
- onLoad.push(`
20
+ const remote = this.params.attr.remote ? this._parseBase64Attr(this.params.attr.remote) : {}
21
+ const data = [
22
+ `async load (params) {
23
23
  this.chart.showLoading('default', { text: '' })
24
- const remote = ${jsonStringify(remote, true)}
24
+ const remote = params ?? ${jsonStringify(remote, true)}
25
25
  const agg = remote.filter.aggregate ?? 'count'
26
26
  const keyName = remote.key.name ?? remote.filter.group
27
27
  const keyValue = remote.key.value ?? keyName + _.upperFirst(agg)
@@ -29,9 +29,14 @@ async function echartsPie () {
29
29
  const data = recs.map(r => ({ name: r[keyName], value: r[keyValue] }))
30
30
  this.chart.hideLoading()
31
31
  this.option = { series: [{ type: 'pie', data }]}
32
+ }`
33
+ ]
34
+ if (!this.params.attr.noAutoLoad) {
35
+ onLoad.push(`
36
+ this.load()
32
37
  `)
33
38
  }
34
- this._build({ onLoad })
39
+ this._build({ onLoad, data })
35
40
  }
36
41
  }
37
42
  }
@@ -26,7 +26,7 @@ async function echarts () {
26
26
  this.params.attr['@load.window'] = 'await windowLoad()'
27
27
  }
28
28
 
29
- _build = ({ setting = {}, onLoad = [] } = {}) => {
29
+ _build = ({ setting = {}, onLoad = [], data = [] } = {}) => {
30
30
  const { jsonStringify } = this.app.waibuMpa
31
31
  const { merge, isArray } = this.app.lib._
32
32
  if (!isArray(onLoad)) onLoad = [onLoad]
@@ -55,6 +55,7 @@ async function echarts () {
55
55
  ${onLoad.join('\n')}
56
56
  },
57
57
  option: ${jsonStringify(option, true)}
58
+ ${data.length > 0 ? (',' + data.join(',')) : ''}
58
59
  }
59
60
  })
60
61
  `)
@@ -40,7 +40,7 @@ export async function addOnsHandler (opts = {}) {
40
40
  const key = o.dbOpts.fields[0]
41
41
  data.push({
42
42
  name: escape(d[key]),
43
- value: d[key + 'Count']
43
+ value: d.count
44
44
  })
45
45
  }
46
46
  _opts[idx].chartOpts = base64JsonEncode({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "2.34.0",
3
+ "version": "2.34.2",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-11-02
4
+
5
+ - [2.34.1] Bug fix in `echarts.js`
6
+ - [2.34.1] Bug fix in `echarts-bar.js`
7
+ - [2.34.1] Bug fix in `echarts-pie.js`
8
+ - [2.34.2] Bug fix in templates
9
+ - [2.34.2] Bug fix in `helper.addOnsHandler()`
10
+ - [2.34.2] Bug fix in `data-table.js` widget
11
+
12
+ ## 2026-10-21
13
+
14
+ - [2.34.0] Add support for `_attachments`
15
+
3
16
  ## 2026-10-19
4
17
 
5
18
  - [2.33.2] Bug fix in `get-schema-ext.js`
@@ -355,4 +368,4 @@
355
368
 
356
369
  ## 2025-12-28
357
370
 
358
- - [2.1.0] Ported to ```bajo@2.2.x``` & ```dobo@2.2.x``` specs
371
+ - [2.1.0] Ported to ```bajo@2.2.x``` & ```dobo@2.2.x``` specs