waibu-db 2.34.2 → 2.34.4

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.
@@ -7,6 +7,7 @@ async function echartsBar () {
7
7
  build = async () => {
8
8
  const { jsonStringify } = this.app.waibuMpa
9
9
  const { merge } = this.app.lib._
10
+ const style = this.params.attr.type ?? 'bar'
10
11
  merge(this.setting, {
11
12
  tooltip: {
12
13
  trigger: 'axis',
@@ -33,21 +34,27 @@ async function echartsBar () {
33
34
  },
34
35
  series: [{
35
36
  data: [],
36
- type: 'bar'
37
+ type: style
37
38
  }]
38
39
  })
39
40
  const onLoad = []
40
41
  const remote = this.params.attr.remote ? this._parseBase64Attr(this.params.attr.remote) : {}
41
42
  const data = [
42
- `async load (params) {
43
+ `async load (params = {}) {
43
44
  this.chart.showLoading('default', { text: '' })
44
- const remote = params ?? ${jsonStringify(remote, true)}
45
+ const remote = params.remote ?? ${jsonStringify(remote, true)}
45
46
  const agg = remote.filter.aggregate ?? 'count'
46
47
  const recs = await wmpa.fetchApi(remote.url, { fetching: false }, remote.filter)
47
48
  this.chart.hideLoading()
48
- this.option = {
49
+ let smooth = false
50
+ let style = params.style ?? '${style}'
51
+ if (style === 'lineSmooth') {
52
+ smooth = true
53
+ style = 'line'
54
+ }
55
+ this.option = params.option ?? {
49
56
  xAxis: { data: _.map(recs, remote.key.name) },
50
- series: [{ type: 'bar', data: _.map(recs, remote.key.value ?? agg ) }]
57
+ series: [{ type: style, smooth, data: _.map(recs, remote.key.value ?? agg ) }]
51
58
  }
52
59
  }`
53
60
  ]
@@ -19,16 +19,16 @@ async function echartsPie () {
19
19
  const onLoad = []
20
20
  const remote = this.params.attr.remote ? this._parseBase64Attr(this.params.attr.remote) : {}
21
21
  const data = [
22
- `async load (params) {
22
+ `async load (params = {}) {
23
23
  this.chart.showLoading('default', { text: '' })
24
- const remote = params ?? ${jsonStringify(remote, true)}
24
+ const remote = params.remote ?? ${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)
28
28
  const recs = await wmpa.fetchApi(remote.url, { fetching: false }, remote.filter)
29
29
  const data = recs.map(r => ({ name: r[keyName], value: r[keyValue] }))
30
30
  this.chart.hideLoading()
31
- this.option = { series: [{ type: 'pie', data }]}
31
+ this.option = params.option ?? { series: [{ type: 'pie', data }]}
32
32
  }`
33
33
  ]
34
34
  if (!this.params.attr.noAutoLoad) {
@@ -21,7 +21,7 @@ async function echarts () {
21
21
  }
22
22
  this.params.tag = 'div'
23
23
  this.params.attr.id = this.params.attr.id ?? generateId('alpha')
24
- this.params.attr['x-data'] = `chart${this.params.attr.id}`
24
+ this.params.attr['x-data'] = `echart${this.params.attr.id}`
25
25
  this.params.attr['@resize.window.debounce.500ms'] = 'resize()'
26
26
  this.params.attr['@load.window'] = 'await windowLoad()'
27
27
  }
@@ -32,7 +32,7 @@ async function echarts () {
32
32
  if (!isArray(onLoad)) onLoad = [onLoad]
33
33
  const option = merge({}, this.defSetting, this.setting, setting)
34
34
  this.component.addScriptBlock('alpineInit', `
35
- Alpine.data('chart${this.params.attr.id}', () => {
35
+ Alpine.data('echart${this.params.attr.id}', () => {
36
36
  let chart
37
37
  return {
38
38
  init () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "2.34.2",
3
+ "version": "2.34.4",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-11-08
4
+
5
+ - [2.34.4] Bug fix in `echarts.js`
6
+
7
+ ## 2026-11-05
8
+
9
+ - [2.34.3] Bug fix in `echarts-bar.js`
10
+ - [2.34.3] Bug fix in `echarts-pie.js`
11
+
3
12
  ## 2026-11-02
4
13
 
5
14
  - [2.34.1] Bug fix in `echarts.js`