lowcoder-map-component 0.1.1

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 (123) hide show
  1. package/README.md +37 -0
  2. package/icons/demo-icon.svg +10 -0
  3. package/icons/hills.svg +17 -0
  4. package/index.css +27 -0
  5. package/index.html +35 -0
  6. package/index.tsx +20 -0
  7. package/loader.mjs +11 -0
  8. package/package.json +175 -0
  9. package/src/README.md +35 -0
  10. package/src/components/ChartPropertyView.tsx +961 -0
  11. package/src/components/SeriesComp.tsx +368 -0
  12. package/src/components/TabPropertyView.tsx +127 -0
  13. package/src/comps/Barcharts/comp.tsx +338 -0
  14. package/src/comps/Barcharts/constants.tsx +77 -0
  15. package/src/comps/Linecharts/comp.tsx +350 -0
  16. package/src/comps/Linecharts/constants.tsx +53 -0
  17. package/src/comps/Linechartsv2/comp.tsx +350 -0
  18. package/src/comps/Linechartsv2/constants.tsx +68 -0
  19. package/src/comps/Mapcharts/comp.tsx +381 -0
  20. package/src/comps/Mapcharts/constants.tsx +312 -0
  21. package/src/comps/Mapchartsv2/comp.tsx +393 -0
  22. package/src/comps/Mapchartsv2/constants.tsx +340 -0
  23. package/src/comps/MixedLineBarCharts/comp.tsx +353 -0
  24. package/src/comps/MixedLineBarCharts/constants.tsx +60 -0
  25. package/src/comps/MultiLineCharts/comp.tsx +362 -0
  26. package/src/comps/MultiLineCharts/constants.tsx +96 -0
  27. package/src/comps/PercentageCharts/comp.tsx +359 -0
  28. package/src/comps/PercentageCharts/constants.tsx +98 -0
  29. package/src/comps/Piecharts/comp.tsx +334 -0
  30. package/src/comps/Piecharts/constants.tsx +48 -0
  31. package/src/comps/Tablecharts/comp.tsx +429 -0
  32. package/src/comps/Tablecharts/constants.tsx +97 -0
  33. package/src/comps/Totalcharts/comp.tsx +463 -0
  34. package/src/comps/Totalcharts/constants.tsx +66 -0
  35. package/src/comps/TwoLineCharts/comp.tsx +350 -0
  36. package/src/comps/TwoLineCharts/constants.tsx +82 -0
  37. package/src/comps/mapComponent/comp.tsx +338 -0
  38. package/src/comps/mapComponent/constants.tsx +2149 -0
  39. package/src/comps/tab/comp.tsx +283 -0
  40. package/src/comps/tab/constants.tsx +79 -0
  41. package/src/configs/barChartConfig.tsx +153 -0
  42. package/src/configs/baseConfig.tsx +66 -0
  43. package/src/configs/candleStickChartConfig.tsx +35 -0
  44. package/src/configs/cartesianAxisConfig.tsx +314 -0
  45. package/src/configs/chartUrls.tsx +9 -0
  46. package/src/configs/echartConfig.tsx +260 -0
  47. package/src/configs/echartsLabelConfig.tsx +47 -0
  48. package/src/configs/echartsLegendConfig.tsx +29 -0
  49. package/src/configs/echartsTitleConfig.tsx +49 -0
  50. package/src/configs/echartsTitleVerticalConfig.tsx +50 -0
  51. package/src/configs/funnelChartConfig.tsx +35 -0
  52. package/src/configs/gaugeChartConfig.tsx +31 -0
  53. package/src/configs/graphChartConfig.tsx +31 -0
  54. package/src/configs/heatmapChartConfig.tsx +31 -0
  55. package/src/configs/legendConfig.tsx +55 -0
  56. package/src/configs/lineChartConfig.tsx +246 -0
  57. package/src/configs/lineChartConfigv2.tsx +246 -0
  58. package/src/configs/mapChartConfig.tsx +106 -0
  59. package/src/configs/mapChartConfigv2.tsx +106 -0
  60. package/src/configs/mixedChartConfig.tsx +21 -0
  61. package/src/configs/pieChartConfig.tsx +156 -0
  62. package/src/configs/radarChartConfig.tsx +31 -0
  63. package/src/configs/sankeyChartConfig.tsx +35 -0
  64. package/src/configs/scatterChartConfig.tsx +152 -0
  65. package/src/configs/sunburstChartConfig.tsx +31 -0
  66. package/src/configs/tabConfig.tsx +0 -0
  67. package/src/configs/tableChartConfig.tsx +81 -0
  68. package/src/configs/themeriverChartConfig.tsx +31 -0
  69. package/src/configs/totalChartConfig.tsx +670 -0
  70. package/src/configs/treeChartConfig.tsx +31 -0
  71. package/src/configs/treemapChartConfig.tsx +31 -0
  72. package/src/controls/AnimationsControls.tsx +3 -0
  73. package/src/controls/AutoHeightControl.tsx +2 -0
  74. package/src/controls/AxisControls.tsx +146 -0
  75. package/src/controls/AxisVisibilityControl.tsx +14 -0
  76. package/src/controls/ChartTypeControl.tsx +15 -0
  77. package/src/controls/ColorScaleControl.tsx +221 -0
  78. package/src/controls/ColumnControl.tsx +204 -0
  79. package/src/controls/ConfigControl.tsx +37 -0
  80. package/src/controls/DirectionControls.tsx +20 -0
  81. package/src/controls/IconControl.tsx +88 -0
  82. package/src/controls/LegendControl.tsx +8 -0
  83. package/src/controls/RowLimitControl.tsx +91 -0
  84. package/src/controls/StyleControls.tsx +22 -0
  85. package/src/controls/TimeControls.tsx +41 -0
  86. package/src/controls/TrendlineControl.tsx +89 -0
  87. package/src/controls/UIEventControl.tsx +21 -0
  88. package/src/controls/index.ts +16 -0
  89. package/src/controls/radioControl.tsx +88 -0
  90. package/src/exposing/index.ts +3 -0
  91. package/src/exposing/setPoint.ts +19 -0
  92. package/src/geo/vn.geo.json +369897 -0
  93. package/src/geo/world.geo.json +32127 -0
  94. package/src/i18n/comps/index.tsx +39 -0
  95. package/src/i18n/comps/locales/en.ts +558 -0
  96. package/src/i18n/comps/locales/enObj.tsx +7186 -0
  97. package/src/i18n/comps/locales/index.ts +7 -0
  98. package/src/i18n/comps/locales/pt.ts +37 -0
  99. package/src/i18n/comps/locales/ptObj.tsx +40 -0
  100. package/src/i18n/comps/locales/types.tsx +622 -0
  101. package/src/i18n/comps/locales/zh.ts +3 -0
  102. package/src/i18n/comps/locales/zhObj.tsx +4 -0
  103. package/src/index.ts +31 -0
  104. package/src/types/global.d.ts +9 -0
  105. package/src/types/lowcoder-sdk.d.ts +578 -0
  106. package/src/utils/chartStyle.util.ts +121 -0
  107. package/src/utils/columnExtractor.util.ts +41 -0
  108. package/src/utils/dataTransform.util.ts +37 -0
  109. package/src/utils/deepEqual.util.ts +29 -0
  110. package/src/utils/echarts.util.tsx +822 -0
  111. package/src/utils/getDataKey.util.ts +115 -0
  112. package/src/utils/getLinearRegression.util.ts +46 -0
  113. package/src/utils/googleMaps.util.ts +28 -0
  114. package/src/utils/isEmpty.util.ts +10 -0
  115. package/src/utils/move.util.ts +6 -0
  116. package/src/utils/selection.util.ts +73 -0
  117. package/src/utils/style.util.ts +315 -0
  118. package/src/utils/time.util.ts +221 -0
  119. package/src/utils/timeFormatter.util.ts +104 -0
  120. package/src/utils/timeProcessing.util.ts +38 -0
  121. package/src/utils/trendline.util.ts +342 -0
  122. package/tsconfig.json +25 -0
  123. package/vite.config.js +19 -0
@@ -0,0 +1,50 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { LegendComponentOption } from "echarts";
3
+ import {
4
+ AlignBottom,
5
+ AlignClose,
6
+ AlignTop,
7
+ dropdownControl,
8
+ MultiCompBuilder,
9
+ } from "lowcoder-sdk";
10
+
11
+ export const PositionTitleVerticalOptions = [
12
+ {
13
+ label: <AlignTop />,
14
+ value: "top",
15
+ },
16
+ {
17
+ label: <AlignClose />,
18
+ value: "center",
19
+ },
20
+ {
21
+ label: <AlignBottom />,
22
+ value: "bottom",
23
+ },
24
+ ] as const;
25
+
26
+ export const EchartsTitleVerticalConfig = (function () {
27
+ return new MultiCompBuilder(
28
+ {
29
+ position: dropdownControl(PositionTitleVerticalOptions, "top"),
30
+ },
31
+ (props): LegendComponentOption => {
32
+ const config: LegendComponentOption = {
33
+ top: "top",
34
+ type: "scroll",
35
+ };
36
+ config.top = props.position;
37
+ return config;
38
+ }
39
+ )
40
+ .setPropertyViewFn((children) => (
41
+ <>
42
+ {children.position.propertyView({
43
+ label: trans("chart.titlePositionVertical"),
44
+ radioButton: true,
45
+ tooltip: trans("chart.changingLegend_x_Tooltip"),
46
+ })}
47
+ </>
48
+ ))
49
+ .build();
50
+ })();
@@ -0,0 +1,35 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { FunnelSeriesOption } from "echarts";
3
+ import {
4
+ BoolControl,
5
+ MultiCompBuilder,
6
+ showLabelPropertyView,
7
+ } from "lowcoder-sdk";
8
+
9
+ export const FunnelChartConfig = (function () {
10
+ return new MultiCompBuilder(
11
+ {
12
+ showLabel: BoolControl,
13
+ },
14
+ (props): FunnelSeriesOption => {
15
+ const config: FunnelSeriesOption = {
16
+ type: "funnel",
17
+ label: {
18
+ show: props.showLabel,
19
+ position: "top",
20
+ },
21
+ };
22
+ return config;
23
+ }
24
+ )
25
+ .setPropertyViewFn((children) => (
26
+ <>
27
+ {showLabelPropertyView(children)}
28
+ {children.type.propertyView({
29
+ label: trans("funnelChart.funnelType"),
30
+ radioButton: true,
31
+ })}
32
+ </>
33
+ ))
34
+ .build();
35
+ })();
@@ -0,0 +1,31 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { GaugeSeriesOption } from "echarts";
3
+ import {
4
+ BoolControl,
5
+ MultiCompBuilder,
6
+ showLabelPropertyView,
7
+ } from "lowcoder-sdk";
8
+
9
+ export const GaugeChartConfig = (function () {
10
+ return new MultiCompBuilder(
11
+ {
12
+ showLabel: BoolControl,
13
+ },
14
+ (props): GaugeSeriesOption => {
15
+ const config: GaugeSeriesOption = {
16
+ type: "gauge",
17
+ };
18
+ return config;
19
+ }
20
+ )
21
+ .setPropertyViewFn((children) => (
22
+ <>
23
+ {showLabelPropertyView(children)}
24
+ {children.type.propertyView({
25
+ label: trans("gaugeChart.gaugeType"),
26
+ radioButton: true,
27
+ })}
28
+ </>
29
+ ))
30
+ .build();
31
+ })();
@@ -0,0 +1,31 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { GraphSeriesOption } from "echarts";
3
+ import {
4
+ BoolControl,
5
+ MultiCompBuilder,
6
+ showLabelPropertyView,
7
+ } from "lowcoder-sdk";
8
+
9
+ export const GraphChartConfig = (function () {
10
+ return new MultiCompBuilder(
11
+ {
12
+ showLabel: BoolControl,
13
+ },
14
+ (props): GraphSeriesOption => {
15
+ const config: GraphSeriesOption = {
16
+ type: "graph",
17
+ };
18
+ return config;
19
+ }
20
+ )
21
+ .setPropertyViewFn((children) => (
22
+ <>
23
+ {showLabelPropertyView(children)}
24
+ {children.type.propertyView({
25
+ label: trans("graphChart.graphType"),
26
+ radioButton: true,
27
+ })}
28
+ </>
29
+ ))
30
+ .build();
31
+ })();
@@ -0,0 +1,31 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { HeatmapSeriesOption } from "echarts";
3
+ import {
4
+ BoolControl,
5
+ MultiCompBuilder,
6
+ showLabelPropertyView,
7
+ } from "lowcoder-sdk";
8
+
9
+ export const HeatmapChartConfig = (function () {
10
+ return new MultiCompBuilder(
11
+ {
12
+ showLabel: BoolControl,
13
+ },
14
+ (_): HeatmapSeriesOption => {
15
+ const config: HeatmapSeriesOption = {
16
+ type: "heatmap",
17
+ };
18
+ return config;
19
+ }
20
+ )
21
+ .setPropertyViewFn((children) => (
22
+ <>
23
+ {showLabelPropertyView(children)}
24
+ {children.type.propertyView({
25
+ label: trans("heatmapChart.heatmapType"),
26
+ radioButton: true,
27
+ })}
28
+ </>
29
+ ))
30
+ .build();
31
+ })();
@@ -0,0 +1,55 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { LegendComponentOption } from "echarts";
3
+ import {
4
+ AlignBottom,
5
+ AlignClose,
6
+ AlignRight,
7
+ dropdownControl,
8
+ MultiCompBuilder,
9
+ } from "lowcoder-sdk";
10
+
11
+ export const legendPositionOptions = [
12
+ {
13
+ label: <AlignRight />,
14
+ value: "right",
15
+ },
16
+ {
17
+ label: <AlignBottom />,
18
+ value: "bottom",
19
+ },
20
+ {
21
+ label: <AlignClose />,
22
+ value: "close",
23
+ },
24
+ ] as const;
25
+
26
+ export const LegendConfig = (function () {
27
+ return new MultiCompBuilder(
28
+ {
29
+ position: dropdownControl(legendPositionOptions, "bottom"),
30
+ },
31
+ (props): LegendComponentOption => {
32
+ const config: LegendComponentOption = {
33
+ top: "bottom",
34
+ type: "scroll",
35
+ };
36
+ if (props.position === "right") {
37
+ config.top = "center";
38
+ config.left = "right";
39
+ config.orient = "vertical";
40
+ } else if (props.position === "close") {
41
+ config.show = false;
42
+ }
43
+ return config;
44
+ }
45
+ )
46
+ .setPropertyViewFn((children) => (
47
+ <>
48
+ {children.position.propertyView({
49
+ label: trans("chart.legendPosition"),
50
+ radioButton: true,
51
+ })}
52
+ </>
53
+ ))
54
+ .build();
55
+ })();
@@ -0,0 +1,246 @@
1
+ import TrendlineControl from "@/controls/TrendlineControl";
2
+ import { trans } from "@/i18n/comps";
3
+ import { LineSeriesOption } from "echarts";
4
+ import {
5
+ BoolControl,
6
+ ColorControl,
7
+ ColorOrBoolCodeControl,
8
+ dropdownControl,
9
+ jsonControl,
10
+ MultiCompBuilder,
11
+ NumberControl,
12
+ showLabelPropertyView,
13
+ StringControl,
14
+ toArray,
15
+ withContext,
16
+ withDefault,
17
+ } from "lowcoder-sdk";
18
+
19
+ export const BorderTypeOptions = [
20
+ {
21
+ label: trans("chart.solid"),
22
+ value: "solid",
23
+ },
24
+ {
25
+ label: trans("chart.dashed"),
26
+ value: "dashed",
27
+ },
28
+ {
29
+ label: trans("chart.dotted"),
30
+ value: "dotted",
31
+ },
32
+ ] as const;
33
+
34
+ export const SymbolOptions = [
35
+ {
36
+ label: trans("chart.rect"),
37
+ value: "rect",
38
+ },
39
+ {
40
+ label: trans("chart.circle"),
41
+ value: "circle",
42
+ },
43
+ {
44
+ label: trans("chart.roundRect"),
45
+ value: "roundRect",
46
+ },
47
+ {
48
+ label: trans("chart.triangle"),
49
+ value: "triangle",
50
+ },
51
+ {
52
+ label: trans("chart.diamond"),
53
+ value: "diamond",
54
+ },
55
+ {
56
+ label: trans("chart.pin"),
57
+ value: "pin",
58
+ },
59
+ {
60
+ label: trans("chart.arrow"),
61
+ value: "arrow",
62
+ },
63
+ {
64
+ label: trans("chart.none"),
65
+ value: "none",
66
+ },
67
+ {
68
+ label: trans("chart.emptyCircle"),
69
+ value: "emptyCircle",
70
+ },
71
+ ] as const;
72
+
73
+ export const ItemColorComp = withContext(
74
+ new MultiCompBuilder(
75
+ { value: ColorOrBoolCodeControl },
76
+ (props) => props.value
77
+ )
78
+ .setPropertyViewFn((children) =>
79
+ children.value.propertyView({
80
+ label: trans("chart.pointColorLabel"),
81
+ placeholder: "{{value < 25000}}",
82
+ tooltip: trans("chart.pointColorTooltip"),
83
+ })
84
+ )
85
+ .build(),
86
+ ["seriesName", "value"] as const
87
+ );
88
+
89
+ export const LineChartConfig = (function () {
90
+ return new MultiCompBuilder(
91
+ {
92
+ showLabel: BoolControl,
93
+ showEndLabel: BoolControl,
94
+ stacked: BoolControl,
95
+ area: BoolControl,
96
+ smooth: BoolControl,
97
+ polar: BoolControl,
98
+ itemColor: ItemColorComp,
99
+ symbol: dropdownControl(SymbolOptions, "emptyCircle"),
100
+ symbolSize: withDefault(NumberControl, 4),
101
+ radiusAxisMax: NumberControl,
102
+ polarRadiusStart: withDefault(StringControl, "30"),
103
+ polarRadiusEnd: withDefault(StringControl, "80%"),
104
+ polarStartAngle: withDefault(NumberControl, 90),
105
+ polarEndAngle: withDefault(NumberControl, -180),
106
+ polarIsTangent: withDefault(BoolControl, false),
107
+ labelData: jsonControl(toArray, []),
108
+ borderColor: ColorControl,
109
+ borderWidth: NumberControl,
110
+ borderType: dropdownControl(BorderTypeOptions, "solid"),
111
+ showTrendline: withDefault(BoolControl, false),
112
+ trendlineControl: TrendlineControl,
113
+ },
114
+ (props): LineSeriesOption => {
115
+ const config: LineSeriesOption & {
116
+ polarData: any;
117
+ showTrendline: boolean;
118
+ trendlines: any;
119
+ } = {
120
+ type: "line",
121
+ label: {
122
+ show: props.showLabel,
123
+ },
124
+ symbol: props.symbol,
125
+ symbolSize: props.symbolSize,
126
+ showTrendline: props.showTrendline,
127
+ trendlines: props.trendlineControl,
128
+ itemStyle: {
129
+ color: (params) => {
130
+ const color = (props.itemColor as any)({
131
+ seriesName: params.seriesName,
132
+ value: params.data,
133
+ });
134
+ if (color === "true") {
135
+ return "red";
136
+ } else if (color === "false" || !color) {
137
+ return params.color;
138
+ }
139
+ return color;
140
+ },
141
+ borderColor: props.borderColor,
142
+ borderWidth: props.borderWidth,
143
+ borderType: props.borderType,
144
+ },
145
+ polarData: {
146
+ polar: props.polar,
147
+ radiusAxisMax: props.radiusAxisMax,
148
+ polarRadiusStart: props.polarRadiusStart,
149
+ polarRadiusEnd: props.polarRadiusEnd,
150
+ polarStartAngle: props.polarStartAngle,
151
+ polarEndAngle: props.polarEndAngle,
152
+ labelData: props.labelData,
153
+ polarIsTangent: props.polarIsTangent,
154
+ },
155
+ };
156
+ if (props.stacked) {
157
+ config.stack = "stackValue";
158
+ }
159
+ if (props.area) {
160
+ config.areaStyle = {};
161
+ }
162
+ if (props.smooth) {
163
+ config.smooth = true;
164
+ }
165
+ if (props.showEndLabel) {
166
+ config.endLabel = {
167
+ show: true,
168
+ formatter: "{a}",
169
+ distance: 20,
170
+ };
171
+ }
172
+ if (props.polar) {
173
+ config.coordinateSystem = "polar";
174
+ }
175
+ return config;
176
+ }
177
+ )
178
+ .setPropertyViewFn((children) => (
179
+ <>
180
+ {children.stacked.propertyView({
181
+ label: trans("lineChart.stacked"),
182
+ })}
183
+ {children.area.propertyView({
184
+ label: trans("lineChart.area"),
185
+ })}
186
+ {children.polar.propertyView({
187
+ label: trans("lineChart.polar"),
188
+ })}
189
+ {children.polar.getView() &&
190
+ children.polarIsTangent.propertyView({
191
+ label: trans("barChart.polarIsTangent"),
192
+ })}
193
+ {children.polar.getView() &&
194
+ children.polarStartAngle.propertyView({
195
+ label: trans("barChart.polarStartAngle"),
196
+ })}
197
+ {children.polar.getView() &&
198
+ children.polarEndAngle.propertyView({
199
+ label: trans("barChart.polarEndAngle"),
200
+ })}
201
+ {children.polar.getView() &&
202
+ children.radiusAxisMax.propertyView({
203
+ label: trans("barChart.radiusAxisMax"),
204
+ })}
205
+ {children.polar.getView() &&
206
+ children.polarRadiusStart.propertyView({
207
+ label: trans("barChart.polarRadiusStart"),
208
+ })}
209
+ {children.polar.getView() &&
210
+ children.polarRadiusEnd.propertyView({
211
+ label: trans("barChart.polarRadiusEnd"),
212
+ })}
213
+ {children.polar.getView() &&
214
+ children.labelData.propertyView({
215
+ label: trans("barChart.polarLabelData"),
216
+ })}
217
+ {showLabelPropertyView(children)}
218
+ {children.showEndLabel.propertyView({
219
+ label: trans("lineChart.showEndLabel"),
220
+ })}
221
+ {children.smooth.propertyView({ label: trans("chart.smooth") })}
222
+ {children.symbol.propertyView({
223
+ label: trans("lineChart.symbol"),
224
+ })}
225
+ {children.symbolSize.propertyView({
226
+ label: trans("lineChart.symbolSize"),
227
+ })}
228
+ {children.itemColor.getPropertyView()}
229
+ {children.borderColor.propertyView({
230
+ label: trans("lineChart.borderColor"),
231
+ })}
232
+ {children.borderWidth.propertyView({
233
+ label: trans("lineChart.borderWidth"),
234
+ })}
235
+ {children.borderType.propertyView({
236
+ label: trans("lineChart.borderType"),
237
+ })}
238
+ {children.showTrendline.propertyView({
239
+ label: trans("lineChart.showTrendline"),
240
+ })}
241
+ {children.showTrendline.getView() &&
242
+ children.trendlineControl.getPropertyView()}
243
+ </>
244
+ ))
245
+ .build();
246
+ })();