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:
|
|
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
|
-
|
|
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:
|
|
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'] = `
|
|
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('
|
|
35
|
+
Alpine.data('echart${this.params.attr.id}', () => {
|
|
36
36
|
let chart
|
|
37
37
|
return {
|
|
38
38
|
init () {
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED