waibu-db 2.33.2 → 2.34.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.
@@ -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
  `)
package/lib/util.js CHANGED
@@ -85,6 +85,7 @@ export async function prepCrud (options = {}) {
85
85
  if (isSet(headers['x-refs'])) refs = headers['x-refs']
86
86
  if (typeof refs === 'string' && !['*', 'all'].includes(refs)) refs = [refs]
87
87
  if (refs.length > 0) _options.refs = refs
88
+ _options.attachments = headers['x-attachments'] === 'true'
88
89
 
89
90
  const recId = id ?? params.id ?? req.query.id
90
91
  let mdl = model
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "2.33.2",
3
+ "version": "2.34.1",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,15 @@
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
+
9
+ ## 2026-10-21
10
+
11
+ - [2.34.0] Add support for `_attachments`
12
+
3
13
  ## 2026-10-19
4
14
 
5
15
  - [2.33.2] Bug fix in `get-schema-ext.js`
@@ -355,4 +365,4 @@
355
365
 
356
366
  ## 2025-12-28
357
367
 
358
- - [2.1.0] Ported to ```bajo@2.2.x``` & ```dobo@2.2.x``` specs
368
+ - [2.1.0] Ported to ```bajo@2.2.x``` & ```dobo@2.2.x``` specs