waibu-db 1.1.14 → 1.1.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,22 +24,13 @@ async function echarts () {
24
24
  build = async () => {
25
25
  const { generateId } = this.plugin.app.bajo
26
26
  const { base64JsonDecode, jsonStringify } = this.plugin.app.waibuMpa
27
- const { merge, cloneDeep } = this.plugin.app.bajo.lib._
27
+ const { merge, cloneDeep, omit } = this.plugin.app.bajo.lib._
28
28
  this.params.attr.id = generateId('alpha')
29
29
  this.params.attr['x-data'] = `chart${this.params.attr.id}`
30
- this.params.attr['@resize.window.debounce.500ms'] = `
31
- if (chart) {
32
- chart.resize()
33
- }
34
- `
30
+ this.params.attr['x-bind'] = 'resize'
35
31
  let option = cloneDeep(this.defOption)
36
32
  if (this.params.attr.option === true) this.params.attr.option = 'e30='
37
33
  if (this.params.attr.option) option = merge(option, base64JsonDecode(this.params.attr.option))
38
- this.params.attr['x-init'] = `
39
- $watch('option', val => {
40
- if (chart) chart.setOption(val)
41
- })
42
- `
43
34
  this.params.append = `
44
35
  <script>
45
36
  document.addEventListener('alpine:init', () => {
@@ -50,16 +41,27 @@ async function echarts () {
50
41
  const el = document.getElementById('${this.params.attr.id}')
51
42
  chart = echarts.init(el, null, { renderer: 'canvas' })
52
43
  chart.setOption(this.option)
44
+ this.$watch('option', val => {
45
+ chart.setOption(val)
46
+ })
53
47
  },
54
48
  get chart () {
55
49
  return chart
56
50
  },
51
+ resize: {
52
+ ['@resize.window.debounce.500ms']() {
53
+ if (chart) {
54
+ chart.resize()
55
+ }
56
+ }
57
+ },
57
58
  option: ${jsonStringify(option, true)}
58
59
  }
59
60
  })
60
61
  })
61
62
  </script>
62
63
  `
64
+ this.params.attr = omit(this.params.attr, ['option'])
63
65
  }
64
66
  }
65
67
  }