aldehyde 0.2.283 → 0.2.285

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.
Files changed (203) hide show
  1. package/lib/controls/entity-select/entity-select.d.ts +2 -2
  2. package/lib/controls/entity-select/entity-select.d.ts.map +1 -1
  3. package/lib/controls/entity-select/entity-select.js +14 -12
  4. package/lib/controls/entity-select/entity-select.js.map +1 -1
  5. package/lib/controls/entry-control.d.ts.map +1 -1
  6. package/lib/controls/entry-control.js +4 -0
  7. package/lib/controls/entry-control.js.map +1 -1
  8. package/lib/controls/select/index.d.ts.map +1 -1
  9. package/lib/controls/select/index.js +1 -0
  10. package/lib/controls/select/index.js.map +1 -1
  11. package/lib/controls/view-control.d.ts.map +1 -1
  12. package/lib/controls/view-control.js +1 -0
  13. package/lib/controls/view-control.js.map +1 -1
  14. package/lib/detail/view/act-dtmpl-view.d.ts.map +1 -1
  15. package/lib/detail/view/act-dtmpl-view.js +3 -2
  16. package/lib/detail/view/act-dtmpl-view.js.map +1 -1
  17. package/lib/detail/view/dtmpl-view.js +1 -1
  18. package/lib/detail/view/dtmpl-view.js.map +1 -1
  19. package/lib/form/form-Item-group.d.ts.map +1 -1
  20. package/lib/form/form-Item-group.js +0 -1
  21. package/lib/form/form-Item-group.js.map +1 -1
  22. package/lib/lowcode-components/bar-chart/index.d.ts +10 -6
  23. package/lib/lowcode-components/bar-chart/index.d.ts.map +1 -1
  24. package/lib/lowcode-components/bar-chart/index.js +91 -11
  25. package/lib/lowcode-components/bar-chart/index.js.map +1 -1
  26. package/lib/lowcode-components/base-map/index.d.ts +10 -6
  27. package/lib/lowcode-components/base-map/index.d.ts.map +1 -1
  28. package/lib/lowcode-components/base-map/index.js +86 -7
  29. package/lib/lowcode-components/base-map/index.js.map +1 -1
  30. package/lib/lowcode-components/base-table/index.d.ts +53 -0
  31. package/lib/lowcode-components/base-table/index.d.ts.map +1 -0
  32. package/lib/lowcode-components/base-table/index.js +158 -0
  33. package/lib/lowcode-components/base-table/index.js.map +1 -0
  34. package/lib/lowcode-components/base-table/index.less +59 -0
  35. package/lib/lowcode-components/capsule-bar-chart/index.d.ts +43 -0
  36. package/lib/lowcode-components/capsule-bar-chart/index.d.ts.map +1 -0
  37. package/lib/lowcode-components/capsule-bar-chart/index.js +179 -0
  38. package/lib/lowcode-components/capsule-bar-chart/index.js.map +1 -0
  39. package/lib/lowcode-components/circular-progress-chart/index.d.ts +26 -0
  40. package/lib/lowcode-components/circular-progress-chart/index.d.ts.map +1 -0
  41. package/lib/lowcode-components/circular-progress-chart/index.js +179 -0
  42. package/lib/lowcode-components/circular-progress-chart/index.js.map +1 -0
  43. package/lib/lowcode-components/column-chart/index.d.ts +11 -6
  44. package/lib/lowcode-components/column-chart/index.d.ts.map +1 -1
  45. package/lib/lowcode-components/column-chart/index.js +115 -16
  46. package/lib/lowcode-components/column-chart/index.js.map +1 -1
  47. package/lib/lowcode-components/data-number/index.d.ts +10 -0
  48. package/lib/lowcode-components/data-number/index.d.ts.map +1 -1
  49. package/lib/lowcode-components/data-number/index.js +80 -6
  50. package/lib/lowcode-components/data-number/index.js.map +1 -1
  51. package/lib/lowcode-components/decoration/decoration1/index.d.ts +19 -0
  52. package/lib/lowcode-components/decoration/decoration1/index.d.ts.map +1 -0
  53. package/lib/lowcode-components/decoration/decoration1/index.js +58 -0
  54. package/lib/lowcode-components/decoration/decoration1/index.js.map +1 -0
  55. package/lib/lowcode-components/decoration/decoration1/index.less +8 -0
  56. package/lib/lowcode-components/decoration/decoration10/index.d.ts +20 -0
  57. package/lib/lowcode-components/decoration/decoration10/index.d.ts.map +1 -0
  58. package/lib/lowcode-components/decoration/decoration10/index.js +29 -0
  59. package/lib/lowcode-components/decoration/decoration10/index.js.map +1 -0
  60. package/lib/lowcode-components/decoration/decoration10/index.less +6 -0
  61. package/lib/lowcode-components/decoration/decoration11/index.d.ts +20 -0
  62. package/lib/lowcode-components/decoration/decoration11/index.d.ts.map +1 -0
  63. package/lib/lowcode-components/decoration/decoration11/index.js +81 -0
  64. package/lib/lowcode-components/decoration/decoration11/index.js.map +1 -0
  65. package/lib/lowcode-components/decoration/decoration11/index.less +6 -0
  66. package/lib/lowcode-components/decoration/decoration2/index.d.ts +19 -0
  67. package/lib/lowcode-components/decoration/decoration2/index.d.ts.map +1 -0
  68. package/lib/lowcode-components/decoration/decoration2/index.js +23 -0
  69. package/lib/lowcode-components/decoration/decoration2/index.js.map +1 -0
  70. package/lib/lowcode-components/decoration/decoration2/index.less +7 -0
  71. package/lib/lowcode-components/decoration/decoration3/index.d.ts +19 -0
  72. package/lib/lowcode-components/decoration/decoration3/index.d.ts.map +1 -0
  73. package/lib/lowcode-components/decoration/decoration3/index.js +39 -0
  74. package/lib/lowcode-components/decoration/decoration3/index.js.map +1 -0
  75. package/lib/lowcode-components/decoration/decoration3/index.less +8 -0
  76. package/lib/lowcode-components/decoration/decoration4/index.d.ts +19 -0
  77. package/lib/lowcode-components/decoration/decoration4/index.d.ts.map +1 -0
  78. package/lib/lowcode-components/decoration/decoration4/index.js +20 -0
  79. package/lib/lowcode-components/decoration/decoration4/index.js.map +1 -0
  80. package/lib/lowcode-components/decoration/decoration4/index.less +30 -0
  81. package/lib/lowcode-components/decoration/decoration5/index.d.ts +19 -0
  82. package/lib/lowcode-components/decoration/decoration5/index.d.ts.map +1 -0
  83. package/lib/lowcode-components/decoration/decoration5/index.js +56 -0
  84. package/lib/lowcode-components/decoration/decoration5/index.js.map +1 -0
  85. package/lib/lowcode-components/decoration/decoration5/index.less +4 -0
  86. package/lib/lowcode-components/decoration/decoration6/index.d.ts +19 -0
  87. package/lib/lowcode-components/decoration/decoration6/index.d.ts.map +1 -0
  88. package/lib/lowcode-components/decoration/decoration6/index.js +55 -0
  89. package/lib/lowcode-components/decoration/decoration6/index.js.map +1 -0
  90. package/lib/lowcode-components/decoration/decoration6/index.less +8 -0
  91. package/lib/lowcode-components/decoration/decoration7/index.d.ts +20 -0
  92. package/lib/lowcode-components/decoration/decoration7/index.d.ts.map +1 -0
  93. package/lib/lowcode-components/decoration/decoration7/index.js +28 -0
  94. package/lib/lowcode-components/decoration/decoration7/index.js.map +1 -0
  95. package/lib/lowcode-components/decoration/decoration7/index.less +5 -0
  96. package/lib/lowcode-components/decoration/decoration8/index.d.ts +20 -0
  97. package/lib/lowcode-components/decoration/decoration8/index.d.ts.map +1 -0
  98. package/lib/lowcode-components/decoration/decoration8/index.js +31 -0
  99. package/lib/lowcode-components/decoration/decoration8/index.js.map +1 -0
  100. package/lib/lowcode-components/decoration/decoration8/index.less +15 -0
  101. package/lib/lowcode-components/decoration/decoration9/index.d.ts +20 -0
  102. package/lib/lowcode-components/decoration/decoration9/index.d.ts.map +1 -0
  103. package/lib/lowcode-components/decoration/decoration9/index.js +52 -0
  104. package/lib/lowcode-components/decoration/decoration9/index.js.map +1 -0
  105. package/lib/lowcode-components/decoration/decoration9/index.less +5 -0
  106. package/lib/lowcode-components/effectScatter-map/index.d.ts +10 -6
  107. package/lib/lowcode-components/effectScatter-map/index.d.ts.map +1 -1
  108. package/lib/lowcode-components/effectScatter-map/index.js +87 -9
  109. package/lib/lowcode-components/effectScatter-map/index.js.map +1 -1
  110. package/lib/lowcode-components/gauge-chart/index.d.ts +10 -6
  111. package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -1
  112. package/lib/lowcode-components/gauge-chart/index.js +65 -8
  113. package/lib/lowcode-components/gauge-chart/index.js.map +1 -1
  114. package/lib/lowcode-components/index.d.ts +30 -0
  115. package/lib/lowcode-components/index.d.ts.map +1 -1
  116. package/lib/lowcode-components/index.js +25 -28
  117. package/lib/lowcode-components/index.js.map +1 -1
  118. package/lib/lowcode-components/line-chart/index.d.ts +10 -6
  119. package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
  120. package/lib/lowcode-components/line-chart/index.js +91 -11
  121. package/lib/lowcode-components/line-chart/index.js.map +1 -1
  122. package/lib/lowcode-components/liquid-chart/index.d.ts +10 -6
  123. package/lib/lowcode-components/liquid-chart/index.d.ts.map +1 -1
  124. package/lib/lowcode-components/liquid-chart/index.js +64 -7
  125. package/lib/lowcode-components/liquid-chart/index.js.map +1 -1
  126. package/lib/lowcode-components/lowcode-view/component/assets.d.ts.map +1 -1
  127. package/lib/lowcode-components/lowcode-view/component/assets.js +134 -0
  128. package/lib/lowcode-components/lowcode-view/component/assets.js.map +1 -1
  129. package/lib/lowcode-components/lowcode-view/component/component-container.d.ts.map +1 -1
  130. package/lib/lowcode-components/lowcode-view/component/component-container.js +30 -29
  131. package/lib/lowcode-components/lowcode-view/component/component-container.js.map +1 -1
  132. package/lib/lowcode-components/pie-chart/index.d.ts +11 -6
  133. package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -1
  134. package/lib/lowcode-components/pie-chart/index.js +102 -15
  135. package/lib/lowcode-components/pie-chart/index.js.map +1 -1
  136. package/lib/lowcode-components/text-scroller/index.d.ts +23 -0
  137. package/lib/lowcode-components/text-scroller/index.d.ts.map +1 -0
  138. package/lib/lowcode-components/text-scroller/index.js +96 -0
  139. package/lib/lowcode-components/text-scroller/index.js.map +1 -0
  140. package/lib/lowcode-components/text-scroller/index.less +29 -0
  141. package/lib/table/act-table.d.ts.map +1 -1
  142. package/lib/table/act-table.js.map +1 -1
  143. package/lib/table/query-table.js +5 -5
  144. package/lib/table/query-table.js.map +1 -1
  145. package/lib/table/relation-table.d.ts.map +1 -1
  146. package/lib/table/relation-table.js +0 -2
  147. package/lib/table/relation-table.js.map +1 -1
  148. package/lib/tmpl/control-type-supportor.d.ts.map +1 -1
  149. package/lib/tmpl/control-type-supportor.js +1 -0
  150. package/lib/tmpl/control-type-supportor.js.map +1 -1
  151. package/package.json +1 -1
  152. package/src/aldehyde/controls/entity-select/entity-select.tsx +15 -15
  153. package/src/aldehyde/controls/entry-control.tsx +12 -0
  154. package/src/aldehyde/controls/select/index.tsx +1 -0
  155. package/src/aldehyde/controls/view-control.tsx +1 -0
  156. package/src/aldehyde/detail/view/act-dtmpl-view.tsx +22 -23
  157. package/src/aldehyde/detail/view/dtmpl-view.tsx +1 -1
  158. package/src/aldehyde/form/form-Item-group.tsx +0 -1
  159. package/src/aldehyde/lowcode-components/bar-chart/index.tsx +100 -19
  160. package/src/aldehyde/lowcode-components/base-map/index.tsx +94 -15
  161. package/src/aldehyde/lowcode-components/base-table/index.less +59 -0
  162. package/src/aldehyde/lowcode-components/base-table/index.tsx +233 -0
  163. package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +219 -0
  164. package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +201 -0
  165. package/src/aldehyde/lowcode-components/column-chart/index.tsx +128 -24
  166. package/src/aldehyde/lowcode-components/data-number/index.tsx +89 -7
  167. package/src/aldehyde/lowcode-components/data.d.ts +6 -0
  168. package/src/aldehyde/lowcode-components/decoration/decoration1/index.less +8 -0
  169. package/src/aldehyde/lowcode-components/decoration/decoration1/index.tsx +153 -0
  170. package/src/aldehyde/lowcode-components/decoration/decoration10/index.less +6 -0
  171. package/src/aldehyde/lowcode-components/decoration/decoration10/index.tsx +89 -0
  172. package/src/aldehyde/lowcode-components/decoration/decoration11/index.less +6 -0
  173. package/src/aldehyde/lowcode-components/decoration/decoration11/index.tsx +133 -0
  174. package/src/aldehyde/lowcode-components/decoration/decoration2/index.less +7 -0
  175. package/src/aldehyde/lowcode-components/decoration/decoration2/index.tsx +61 -0
  176. package/src/aldehyde/lowcode-components/decoration/decoration3/index.less +8 -0
  177. package/src/aldehyde/lowcode-components/decoration/decoration3/index.tsx +87 -0
  178. package/src/aldehyde/lowcode-components/decoration/decoration4/index.less +30 -0
  179. package/src/aldehyde/lowcode-components/decoration/decoration4/index.tsx +53 -0
  180. package/src/aldehyde/lowcode-components/decoration/decoration5/index.less +4 -0
  181. package/src/aldehyde/lowcode-components/decoration/decoration5/index.tsx +116 -0
  182. package/src/aldehyde/lowcode-components/decoration/decoration6/index.less +8 -0
  183. package/src/aldehyde/lowcode-components/decoration/decoration6/index.tsx +121 -0
  184. package/src/aldehyde/lowcode-components/decoration/decoration7/index.less +5 -0
  185. package/src/aldehyde/lowcode-components/decoration/decoration7/index.tsx +70 -0
  186. package/src/aldehyde/lowcode-components/decoration/decoration8/index.less +15 -0
  187. package/src/aldehyde/lowcode-components/decoration/decoration8/index.tsx +122 -0
  188. package/src/aldehyde/lowcode-components/decoration/decoration9/index.less +5 -0
  189. package/src/aldehyde/lowcode-components/decoration/decoration9/index.tsx +196 -0
  190. package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +93 -19
  191. package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +73 -16
  192. package/src/aldehyde/lowcode-components/index.ts +40 -29
  193. package/src/aldehyde/lowcode-components/line-chart/index.tsx +105 -22
  194. package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +70 -15
  195. package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +134 -0
  196. package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +29 -28
  197. package/src/aldehyde/lowcode-components/pie-chart/index.tsx +111 -25
  198. package/src/aldehyde/lowcode-components/text-scroller/index.less +29 -0
  199. package/src/aldehyde/lowcode-components/text-scroller/index.tsx +122 -0
  200. package/src/aldehyde/table/act-table.tsx +0 -1
  201. package/src/aldehyde/table/query-table.tsx +5 -5
  202. package/src/aldehyde/table/relation-table.tsx +0 -2
  203. package/src/aldehyde/tmpl/control-type-supportor.tsx +1 -0
@@ -0,0 +1,70 @@
1
+ import React, { ForwardedRef, forwardRef, useImperativeHandle, useState, useMemo } from "react";
2
+ import "./index.less";
3
+
4
+ interface ComponentStyle {
5
+ mainColor?: string;
6
+ subColor?: string;
7
+ reverse?: boolean;
8
+ }
9
+
10
+ export interface ComponentProps {
11
+ style?: ComponentStyle;
12
+ base?: { width?: number, height?: number }
13
+ }
14
+
15
+ export interface ComponentRef {
16
+ updateConfig: (config: ComponentProps) => void;
17
+ }
18
+ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
19
+ const [style, setStyle] = useState<ComponentStyle>({ ...props.style });
20
+ const [width, setWidth] = useState<number>(300)
21
+ const [height, setHeight] = useState<number>(100);
22
+ const { mainColor = "#83BFF6", subColor = "#00CED1", reverse } = style || {};
23
+
24
+ useImperativeHandle(ref, () => ({
25
+ updateConfig: (newConfig) => {
26
+ setStyle({ ...newConfig.style });
27
+ setWidth(newConfig.base.width);
28
+ setHeight(newConfig.base.height);
29
+ },
30
+ }));
31
+
32
+ const xPos = pos => (!reverse ? pos : width - pos)
33
+
34
+ const [pointsOne, pointsTwo, pointsThree] = useMemo(
35
+ () => [
36
+ `${xPos(0)}, 0 ${xPos(30)}, ${height / 2}`,
37
+ `${xPos(20)}, 0 ${xPos(50)}, ${height / 2} ${xPos(width)}, ${height / 2}`,
38
+ `${xPos(0)}, ${height - 3}, ${xPos(200)}, ${height - 3}`
39
+ ],
40
+ [reverse, width, height]
41
+ )
42
+
43
+
44
+ return <div className="decoration-7" >
45
+ <svg width={width} height={height}>
46
+ <polyline
47
+ stroke={mainColor}
48
+ strokeWidth='2'
49
+ fill='transparent'
50
+ points={pointsOne}
51
+ />
52
+
53
+ <polyline
54
+ stroke={mainColor}
55
+ strokeWidth='2'
56
+ fill='transparent'
57
+ points={pointsTwo}
58
+ />
59
+
60
+ <polyline
61
+ stroke={subColor}
62
+ fill='transparent'
63
+ strokeWidth='3'
64
+ points={pointsThree}
65
+ />
66
+ </svg>
67
+ </div>;
68
+ });
69
+
70
+ export default Index;
@@ -0,0 +1,15 @@
1
+ .decoration-8 {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: center;
8
+
9
+ .decoration-8-svg {
10
+ position: absolute;
11
+ left: 0px;
12
+ top: 0px;
13
+ transform-origin: left top;
14
+ }
15
+ }
@@ -0,0 +1,122 @@
1
+ import React, { ForwardedRef, forwardRef, useImperativeHandle, useState, useMemo } from "react";
2
+ import "./index.less";
3
+
4
+ interface ComponentStyle {
5
+ mainColor?: string;
6
+ subColor?: string;
7
+ }
8
+
9
+ export interface ComponentProps {
10
+ style?: ComponentStyle;
11
+ base?: { width?: number, height?: number, id: string }
12
+ }
13
+
14
+ export interface ComponentRef {
15
+ updateConfig: (config: ComponentProps) => void;
16
+ }
17
+ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
18
+ const polygonId = `decoration-8-polygon-${props.base?.id}`
19
+ const [style, setStyle] = useState<ComponentStyle>({ ...props.style });
20
+ const [width, setWidth] = useState<number>(200)
21
+ const [height, setHeight] = useState<number>(200);
22
+ const { mainColor = "#83BFF6", subColor = "#00CED1" } = style || {};
23
+
24
+ useImperativeHandle(ref, () => ({
25
+ updateConfig: (newConfig) => {
26
+ setStyle({ ...newConfig.style });
27
+ setWidth(newConfig.base.width);
28
+ setHeight(newConfig.base.height);
29
+ },
30
+ }));
31
+
32
+ return <div className="decoration-8" >
33
+ <svg
34
+ className="decoration-8-svg"
35
+ width="100px"
36
+ height="100px"
37
+ style={{ transform: `scale(${width / 100},${height / 100})` }}
38
+ >
39
+ <defs>
40
+ <polygon
41
+ id={polygonId}
42
+ points='15, 46.5, 21, 47.5, 21, 52.5, 15, 53.5'
43
+ />
44
+ </defs>
45
+ <circle
46
+ cx='50'
47
+ cy='50'
48
+ r='45'
49
+ fill='transparent'
50
+ stroke={subColor}
51
+ strokeWidth='10'
52
+ strokeDasharray='80, 100, 30, 100'
53
+ >
54
+ <animateTransform
55
+ attributeName='transform'
56
+ type='rotate'
57
+ values='0 50 50;360 50 50'
58
+ dur="3s"
59
+ repeatCount='indefinite'
60
+ />
61
+ </circle>
62
+ <circle
63
+ cx='50'
64
+ cy='50'
65
+ r='45'
66
+ fill='transparent'
67
+ stroke={mainColor}
68
+ strokeWidth='6'
69
+ strokeDasharray='50, 66, 100, 66'
70
+ >
71
+ <animateTransform
72
+ attributeName='transform'
73
+ type='rotate'
74
+ values='0 50 50;-360 50 50'
75
+ dur="3s"
76
+ repeatCount='indefinite'
77
+ />
78
+ </circle>
79
+ <circle
80
+ cx='50'
81
+ cy='50'
82
+ r='38'
83
+ fill='transparent'
84
+ stroke={subColor}
85
+ strokeOpacity={0.3}
86
+ strokeWidth='1'
87
+ strokeDasharray='5, 1'
88
+ />
89
+ {new Array(20).fill(0).map((foo, i) => (
90
+ <use
91
+ key={i}
92
+ href={`#${polygonId}`}
93
+ stroke={subColor}
94
+ fill={
95
+ Math.random() > 0.4 ? 'transparent' : mainColor
96
+ }
97
+ >
98
+ <animateTransform
99
+ attributeName='transform'
100
+ type='rotate'
101
+ values='0 50 50;360 50 50'
102
+ dur="3s"
103
+ begin={`${i * 3 / 20}s`}
104
+ repeatCount='indefinite'
105
+ />
106
+ </use>
107
+ ))}
108
+ <circle
109
+ cx='50'
110
+ cy='50'
111
+ r='26'
112
+ fill='transparent'
113
+ stroke={subColor}
114
+ strokeOpacity={0.3}
115
+ strokeWidth='1'
116
+ strokeDasharray='5, 1'
117
+ />
118
+ </svg>
119
+ </div>;
120
+ });
121
+
122
+ export default Index;
@@ -0,0 +1,5 @@
1
+ .decoration-9 {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: flex;
5
+ }
@@ -0,0 +1,196 @@
1
+ import React, { ForwardedRef, forwardRef, useImperativeHandle, useState, useRef } from "react";
2
+ import "./index.less";
3
+
4
+ interface ComponentStyle {
5
+ mainColor?: string;
6
+ subColor?: string;
7
+ }
8
+
9
+ export interface ComponentProps {
10
+ style?: ComponentStyle;
11
+ base?: { width?: number, height?: number, id: string }
12
+ }
13
+
14
+ export interface ComponentRef {
15
+ updateConfig: (config: ComponentProps) => void;
16
+ }
17
+ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
18
+ const [style, setStyle] = useState<ComponentStyle>({ ...props.style });
19
+ const [width, setWidth] = useState<number>(300)
20
+ const [height, setHeight] = useState<number>(100);
21
+ const { mainColor = "#83BFF6", subColor = "#00CED1" } = style || {};
22
+ const {
23
+ animationId1,
24
+ animationId2,
25
+ animationId3,
26
+ animationId4,
27
+ animationId5,
28
+ animationId6,
29
+ animationId7
30
+ } = useRef({
31
+ animationId1: `d9ani1${props.base?.id}`,
32
+ animationId2: `d9ani2${props.base?.id}`,
33
+ animationId3: `d9ani3${props.base?.id}`,
34
+ animationId4: `d9ani4${props.base?.id}`,
35
+ animationId5: `d9ani5${props.base?.id}`,
36
+ animationId6: `d9ani6${props.base?.id}`,
37
+ animationId7: `d9ani7${props.base?.id}`
38
+ }).current
39
+
40
+ useImperativeHandle(ref, () => ({
41
+ updateConfig: (newConfig) => {
42
+ setStyle({ ...newConfig.style });
43
+ setWidth(newConfig.base.width);
44
+ setHeight(newConfig.base.height);
45
+ },
46
+ }));
47
+
48
+ return <div className="decoration-9" >
49
+ <svg width={width} height={height}>
50
+ <polyline
51
+ stroke={subColor}
52
+ strokeWidth='2'
53
+ points={`0, ${height / 2} ${width}, ${height / 2}`}
54
+ />
55
+
56
+ <polyline
57
+ stroke={mainColor}
58
+ strokeWidth='2'
59
+ points={`5, ${height / 2} ${width * 0.2 - 3}, ${height / 2}`}
60
+ strokeDasharray={`0, ${width * 0.2}`}
61
+ fill='freeze'
62
+ >
63
+ <animate
64
+ id={animationId2}
65
+ attributeName='stroke-dasharray'
66
+ values={`0, ${width * 0.2};${width * 0.2}, 0;`}
67
+ dur='3s'
68
+ begin={`${animationId1}.end`}
69
+ fill='freeze'
70
+ />
71
+ <animate
72
+ attributeName='stroke-dasharray'
73
+ values={`${width * 0.2}, 0;0, ${width * 0.2}`}
74
+ dur='0.01s'
75
+ begin={`${animationId7}.end`}
76
+ fill='freeze'
77
+ />
78
+ </polyline>
79
+
80
+ <polyline
81
+ stroke={mainColor}
82
+ strokeWidth='2'
83
+ points={`${width * 0.2 + 3}, ${height / 2} ${width * 0.8 -
84
+ 3}, ${height / 2}`}
85
+ strokeDasharray={`0, ${width * 0.6}`}
86
+ >
87
+ <animate
88
+ id={animationId4}
89
+ attributeName='stroke-dasharray'
90
+ values={`0, ${width * 0.6};${width * 0.6}, 0`}
91
+ dur='3s'
92
+ begin={`${animationId3}.end + 1s`}
93
+ fill='freeze'
94
+ />
95
+ <animate
96
+ attributeName='stroke-dasharray'
97
+ values={`${width * 0.6}, 0;0, ${width * 0.6}`}
98
+ dur='0.01s'
99
+ begin={`${animationId7}.end`}
100
+ fill='freeze'
101
+ />
102
+ </polyline>
103
+
104
+ <polyline
105
+ stroke={mainColor}
106
+ strokeWidth='2'
107
+ points={`${width * 0.8 + 3}, ${height / 2} ${width - 5}, ${height /
108
+ 2}`}
109
+ strke-dasharray={`0, ${width * 0.2}`}
110
+ >
111
+ <animate
112
+ id={animationId6}
113
+ attributeName='stroke-dasharray'
114
+ values={`0, ${width * 0.2};${width * 0.2}, 0`}
115
+ dur='3s'
116
+ begin={`${animationId5}.end + 1s`}
117
+ fill='freeze'
118
+ />
119
+ <animate
120
+ attributeName='stroke-dasharray'
121
+ values={`${width * 0.2}, 0;0, ${width * 0.3}`}
122
+ dur='0.01s'
123
+ begin={`${animationId7}.end`}
124
+ fill='freeze'
125
+ />
126
+ </polyline>
127
+
128
+ <circle cx='2' cy={height / 2} r='2' fill={subColor}>
129
+ <animate
130
+ id={animationId1}
131
+ attributeName='fill'
132
+ values={`${subColor};${mainColor}`}
133
+ begin={`0s;${animationId7}.end`}
134
+ dur='0.3s'
135
+ fill='freeze'
136
+ />
137
+ </circle>
138
+
139
+ <circle cx={width * 0.2} cy={height / 2} r='2' fill={subColor}>
140
+ <animate
141
+ id={animationId3}
142
+ attributeName='fill'
143
+ values={`${subColor};${mainColor}`}
144
+ begin={`${animationId2}.end`}
145
+ dur='0.3s'
146
+ fill='freeze'
147
+ />
148
+ <animate
149
+ attributeName='fill'
150
+ values={`${subColor};${subColor}`}
151
+ dur='0.01s'
152
+ begin={`${animationId7}.end`}
153
+ fill='freeze'
154
+ />
155
+ </circle>
156
+
157
+ <circle cx={width * 0.8} cy={height / 2} r='2' fill={subColor}>
158
+ <animate
159
+ id={animationId5}
160
+ attributeName='fill'
161
+ values={`${subColor};${mainColor}`}
162
+ begin={`${animationId4}.end`}
163
+ dur='0.3s'
164
+ fill='freeze'
165
+ />
166
+ <animate
167
+ attributeName='fill'
168
+ values={`${subColor};${subColor}`}
169
+ dur='0.01s'
170
+ begin={`${animationId7}.end`}
171
+ fill='freeze'
172
+ />
173
+ </circle>
174
+
175
+ <circle cx={width - 2} cy={height / 2} r='2' fill={subColor}>
176
+ <animate
177
+ id={animationId7}
178
+ attributeName='fill'
179
+ values={`${subColor};${mainColor}`}
180
+ begin={`${animationId6}.end`}
181
+ dur='0.3s'
182
+ fill='freeze'
183
+ />
184
+ <animate
185
+ attributeName='fill'
186
+ values={`${subColor};${subColor}`}
187
+ dur='0.01s'
188
+ begin={`${animationId7}.end`}
189
+ fill='freeze'
190
+ />
191
+ </circle>
192
+ </svg>
193
+ </div>;
194
+ });
195
+
196
+ export default Index;
@@ -2,6 +2,11 @@ import * as echarts from 'echarts';
2
2
  import React, { useEffect, useRef, useState, ForwardedRef, forwardRef, useImperativeHandle } from 'react';
3
3
  import _ from 'lodash';
4
4
  import chinaJson from "../assets/china.json";
5
+ import HydrocarbonService from "../../tmpl/hcservice-v3";
6
+ import { DataConfigProps } from "../data";
7
+
8
+ const defData = [{ name: '北京', value: [116.41, 40.19, 100] }];
9
+
5
10
 
6
11
  const defOption = {
7
12
  tooltip: {
@@ -34,7 +39,8 @@ const defOption = {
34
39
  map: 'china',
35
40
  geoIndex: 0,
36
41
  aspectScale: 0.75, //长宽比
37
- data: []
42
+ data: [],
43
+ tooltip: { show: false }
38
44
  },
39
45
  {
40
46
  type: 'effectScatter',
@@ -51,38 +57,72 @@ const defOption = {
51
57
  },
52
58
  zlevel: 1,
53
59
  encode: { value: 2 },
54
- data: [{ name: '北京', value: [116.46, 39.92, 100] }]
60
+ data: defData
55
61
  }
56
62
  ]
57
63
  };
58
64
 
59
- export interface ChartComponentStyle {
65
+ // 处理数据格式
66
+ const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
67
+ if (!data?.length) {
68
+ return [];
69
+ }
70
+ const temData = data.map((r) => {
71
+ const { config, value } = r;
72
+ const vNames = Object.keys(config).filter((r) => r.startsWith("v")).sort((a, b) => parseInt(a.substring(1)) - parseInt(b.substring(1)));
73
+ return {
74
+ name: config.d1,
75
+ data: vNames.map((r) => ({
76
+ name: config[r],
77
+ value: value[0]?.[r],
78
+ }))
79
+ };
80
+ });
81
+ return temData[0]?.data || [];
82
+ };
83
+
84
+ export interface ComponentStyle {
60
85
  tooltip?: { show: boolean };
61
86
  geo?: { [key: string]: any };
62
87
  effectScatter?: { [key: string]: any };
63
88
  }
64
89
 
65
- export interface ChartComponentProps {
66
- style?: ChartComponentStyle;
67
- base: { width: number, height: number }
90
+ export interface ComponentProps {
91
+ style?: ComponentStyle;
92
+ base: { width: number, height: number },
93
+ data?: DataConfigProps;
94
+ isDesignMode?: boolean; // 是否编辑模式
68
95
  }
69
96
 
70
- export interface BaseTextComponentRef {
71
- updateConfig: (newConfig: ChartComponentProps) => void;
97
+ export interface ComponentRef {
98
+ updateConfig: (newConfig: ComponentProps) => void;
99
+ destroy: () => void;
72
100
  }
73
101
 
74
- const Index = forwardRef((props: ChartComponentProps, ref: ForwardedRef<BaseTextComponentRef>) => {
75
- const [config, setConfig] = useState<ChartComponentStyle>(props.style || {});
76
- const [size, setSize] = useState<{ width: number, height: number }>()
102
+ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
103
+ const { style, data: propsData, isDesignMode } = props;
104
+ const [config, setConfig] = useState<ComponentStyle>(style || {});
105
+ const [size, setSize] = useState<{ width: number, height: number }>();
106
+ const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
107
+ const [data, setData] = useState<{ name: string, value: number[] }[]>([]);
77
108
  const chartRef = useRef<HTMLDivElement>(null);
78
109
  const chart = useRef<any>(null);
110
+ const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
111
+
112
+ const handleDestroy = () => {
113
+ pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
114
+ window.removeEventListener('resize', handleResize);
115
+ chart.current.dispose();
116
+ };
79
117
 
80
118
  useImperativeHandle(ref, () => ({
81
119
  updateConfig: (newConfig) => {
82
- const { base, style } = newConfig;
83
- setConfig({ ...(style || {}) });
120
+ const { base, style: newStyle, data: newDataConfig } = newConfig;
121
+ setConfig({ ...(newStyle || {}) });
84
122
  setSize({ width: base.width, height: base.height });
123
+ setDataConfig(newDataConfig);
85
124
  },
125
+ destroy: handleDestroy,
86
126
  }));
87
127
 
88
128
  // 窗口大小变化时重新调整图表大小
@@ -95,21 +135,55 @@ const Index = forwardRef((props: ChartComponentProps, ref: ForwardedRef<BaseText
95
135
  chart.current = echarts.init(chartRef.current, null, { renderer: 'svg' });
96
136
  window.addEventListener('resize', handleResize);
97
137
  return () => {
98
- window.removeEventListener('resize', handleResize);
99
- chart.current.dispose();
138
+ handleDestroy();
100
139
  }
101
140
  }, []);
102
141
 
142
+ // 请求数据
143
+ const getData = async () => {
144
+ const { entities: { config, value } } = await HydrocarbonService.requestMstrucLtmplQueryTop(null, dataConfig?.sourceId, null) || {};
145
+ setData(handleData(value));
146
+ return config;
147
+ };
148
+
149
+ // 初始化请求数据
150
+ const getInitData = async () => {
151
+ pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
152
+ const config = await getData();
153
+ if (config?.requestType === "polling") {
154
+ pollingIntervalRef.current = setInterval(() => { getData() }, config?.pollingInterval || 60000);
155
+ }
156
+ };
157
+
158
+ // 静态数据处理
159
+ useEffect(() => {
160
+ if (dataConfig?.sourceType === 'staticData') {
161
+ setData(dataConfig.staticData || []);
162
+ }
163
+ }, [dataConfig?.sourceType, dataConfig?.staticData]);
164
+
165
+ /**
166
+ * 数据源数据请求
167
+ * 1、编辑态不请求数据
168
+ */
169
+ useEffect(() => {
170
+ if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId) {
171
+ getInitData();
172
+ } else if (dataConfig?.sourceType === 'sourceId') {
173
+ setData([]);
174
+ }
175
+ }, [dataConfig?.sourceType, dataConfig?.sourceId]);
176
+
103
177
  const renderChart = () => {
104
178
  const { tooltip, geo, effectScatter } = config
105
179
  const option = _.cloneDeep(defOption);
180
+ // 编辑态无数据显示默认数据
181
+ const temData = isDesignMode && !data?.length ? defData : data;
106
182
  option.tooltip = { trigger: "item", ...tooltip };
107
183
  option.geo = { ...option.geo, ...geo, ...geo.normal };
108
184
  option.series = option.series.map((item: any) => {
109
185
  if (item.type === 'effectScatter') {
110
- return {
111
- ...item, ...effectScatter
112
- };
186
+ return { ...item, ...effectScatter, data: temData };
113
187
  }
114
188
  return item;
115
189
  });
@@ -119,7 +193,7 @@ const Index = forwardRef((props: ChartComponentProps, ref: ForwardedRef<BaseText
119
193
  if (config) {
120
194
  renderChart();
121
195
  }
122
- }, [config]);
196
+ }, [config, data]);
123
197
 
124
198
  useEffect(() => {
125
199
  if (size) {