@lowdefy/blocks-echarts 4.7.3 → 5.1.0

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.
@@ -13,7 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import React from 'react';
16
- import { blockDefaultProps } from '@lowdefy/block-utils';
16
+ import { withBlockDefaults } from '@lowdefy/block-utils';
17
17
  import { registerTheme } from 'echarts';
18
18
  import ReactECharts from 'echarts-for-react';
19
19
  let EChart = class EChart extends React.Component {
@@ -25,9 +25,12 @@ let EChart = class EChart extends React.Component {
25
25
  }
26
26
  render() {
27
27
  return /*#__PURE__*/ React.createElement("div", {
28
+ className: this.props.classNames?.element,
28
29
  style: {
29
30
  height: this.props.properties.height ?? 300,
30
- width: this.props.properties.width ?? '100%'
31
+ width: this.props.properties.width ?? '100%',
32
+ minWidth: 0,
33
+ ...this.props.styles?.element
31
34
  }
32
35
  }, /*#__PURE__*/ React.createElement(ReactECharts, {
33
36
  lazyUpdate: true,
@@ -40,11 +43,11 @@ let EChart = class EChart extends React.Component {
40
43
  source: []
41
44
  } : this.props.properties.option?.dataset
42
45
  },
43
- opts: {
44
- height: this.props.properties.height ?? 300,
45
- ...this.props.properties.init ?? {}
46
+ opts: this.props.properties.init,
47
+ style: {
48
+ width: '100%',
49
+ height: '100%'
46
50
  },
47
- style: this.props.properties.style ?? {},
48
51
  theme: this.props.properties.theme && `custom_theme_${this.props.blockId}`
49
52
  }));
50
53
  }
@@ -98,10 +101,4 @@ let EChart = class EChart extends React.Component {
98
101
  }
99
102
  }
100
103
  };
101
- EChart.defaultProps = blockDefaultProps;
102
- EChart.meta = {
103
- category: 'display',
104
- icons: [],
105
- styles: []
106
- };
107
- export default EChart;
104
+ export default withBlockDefaults(EChart);
@@ -13,7 +13,15 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ export default {
16
- type: 'object',
16
+ category: 'display',
17
+ icons: [],
18
+ valueType: null,
19
+ cssKeys: {
20
+ element: 'The EChart element.'
21
+ },
22
+ events: {
23
+ click: 'Trigger actions when the element is clicked.'
24
+ },
17
25
  properties: {
18
26
  type: 'object',
19
27
  additionalProperties: false,
@@ -77,22 +85,6 @@
77
85
  description: 'Specify the locale.'
78
86
  }
79
87
  }
80
- },
81
- style: {
82
- type: 'object',
83
- description: 'Css style object to apply to EChart div.',
84
- docs: {
85
- displayType: 'yaml'
86
- }
87
- }
88
- }
89
- },
90
- events: {
91
- type: 'object',
92
- properties: {
93
- click: {
94
- type: 'array',
95
- description: 'Trigger actions when the element is clicked.'
96
88
  }
97
89
  }
98
90
  }
@@ -12,4 +12,4 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ export { default as EChart } from './blocks/EChart/schema.js';
15
+ */ export { default as EChart } from './blocks/EChart/meta.js';
package/dist/types.js CHANGED
@@ -1,4 +1,4 @@
1
- /* eslint-disable import/namespace */ /*
1
+ /*
2
2
  Copyright 2020-2026 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,18 +12,6 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import * as blocks from './blocks.js';
16
- const icons = {};
17
- const styles = {};
18
- Object.keys(blocks).forEach((block)=>{
19
- icons[block] = blocks[block].meta.icons ?? [];
20
- styles[block] = blocks[block].meta.styles ?? [];
21
- });
22
- export default {
23
- blocks: Object.keys(blocks),
24
- icons,
25
- styles: {
26
- default: [],
27
- ...styles
28
- }
29
- };
15
+ */ import { extractBlockTypes } from '@lowdefy/block-utils';
16
+ import * as metas from './metas.js';
17
+ export default extractBlockTypes(metas);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-echarts",
3
- "version": "4.7.3",
3
+ "version": "5.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "ECharts Blocks for Lowdefy.",
6
6
  "homepage": "https://lowdefy.com",
@@ -36,33 +36,35 @@
36
36
  "exports": {
37
37
  "./*": "./dist/*",
38
38
  "./blocks": "./dist/blocks.js",
39
+ "./metas": "./dist/metas.js",
39
40
  "./e2e": "./dist/e2e.js",
40
- "./schemas": "./dist/schemas.js",
41
41
  "./types": "./dist/types.js"
42
42
  },
43
43
  "files": [
44
44
  "dist/*"
45
45
  ],
46
46
  "dependencies": {
47
- "@lowdefy/block-utils": "4.7.3",
48
- "echarts": "5.5.1",
49
- "echarts-for-react": "3.0.2",
50
- "react": "18.2.0",
51
- "react-dom": "18.2.0"
47
+ "@lowdefy/block-utils": "5.1.0",
48
+ "echarts": "6.0.0",
49
+ "echarts-for-react": "3.0.5"
50
+ },
51
+ "peerDependencies": {
52
+ "react": ">=18",
53
+ "react-dom": ">=18"
52
54
  },
53
55
  "devDependencies": {
54
- "@lowdefy/block-dev-e2e": "4.7.3",
55
- "@lowdefy/e2e-utils": "4.7.3",
56
+ "@lowdefy/block-dev-e2e": "5.1.0",
57
+ "@lowdefy/e2e-utils": "5.1.0",
56
58
  "@playwright/test": "1.50.1",
57
- "@swc/cli": "0.1.63",
58
- "@swc/core": "1.3.99",
59
+ "@swc/cli": "0.8.0",
60
+ "@swc/core": "1.15.18",
59
61
  "copyfiles": "2.4.1"
60
62
  },
61
63
  "publishConfig": {
62
64
  "access": "public"
63
65
  },
64
66
  "scripts": {
65
- "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && pnpm copyfiles",
67
+ "build": "swc src --out-dir dist --config-file ../../../../.swcrc --cli-config-file ../../../../.swc-cli.json && pnpm copyfiles",
66
68
  "clean": "rm -rf dist",
67
69
  "copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
68
70
  "e2e": "playwright test --config e2e/playwright.config.js",
@@ -1,73 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "type": "object",
5
- "additionalProperties": false,
6
- "properties": {
7
- "option": {
8
- "type": "object",
9
- "description": "EChart settings object.",
10
- "docs": {
11
- "displayType": "yaml"
12
- }
13
- },
14
- "theme": {
15
- "type": "object",
16
- "description": "EChart theme object.",
17
- "docs": {
18
- "displayType": "yaml"
19
- }
20
- },
21
- "width": {
22
- "type": ["number", "string"],
23
- "default": "auto",
24
- "description": "Specify chart width explicitly, in pixel.",
25
- "docs": {
26
- "displayType": "string"
27
- }
28
- },
29
- "height": {
30
- "type": ["number", "string"],
31
- "default": "auto",
32
- "description": "Specify chart height explicitly, in pixel.",
33
- "docs": {
34
- "displayType": "string"
35
- }
36
- },
37
- "init": {
38
- "type": "object",
39
- "description": "EChart init object.",
40
- "properties": {
41
- "renderer": {
42
- "type": "string",
43
- "enum": ["canvas", "svg"],
44
- "default": "canvas",
45
- "description": "Chart renderer."
46
- },
47
- "locale": {
48
- "type": "string",
49
- "enum": ["EN", "ZH"],
50
- "default": "EN",
51
- "description": "Specify the locale."
52
- }
53
- }
54
- },
55
- "style": {
56
- "type": "object",
57
- "description": "Css style object to apply to EChart div.",
58
- "docs": {
59
- "displayType": "yaml"
60
- }
61
- }
62
- }
63
- },
64
- "events": {
65
- "type": "object",
66
- "properties": {
67
- "click": {
68
- "type": "array",
69
- "description": "Trigger actions when the element is clicked."
70
- }
71
- }
72
- }
73
- }