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,31 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { TreemapSeriesOption } from "echarts";
3
+ import {
4
+ BoolControl,
5
+ MultiCompBuilder,
6
+ showLabelPropertyView,
7
+ } from "lowcoder-sdk";
8
+
9
+ export const TreemapChartConfig = (function () {
10
+ return new MultiCompBuilder(
11
+ {
12
+ showLabel: BoolControl,
13
+ },
14
+ (_): TreemapSeriesOption => {
15
+ const config: TreemapSeriesOption = {
16
+ type: "treemap",
17
+ };
18
+ return config;
19
+ }
20
+ )
21
+ .setPropertyViewFn((children) => (
22
+ <>
23
+ {showLabelPropertyView(children)}
24
+ {children.type.propertyView({
25
+ label: trans("treemapChart.treemapType"),
26
+ radioButton: true,
27
+ })}
28
+ </>
29
+ ))
30
+ .build();
31
+ })();
@@ -0,0 +1,3 @@
1
+ import { NumberControl, withDefault } from "lowcoder-sdk";
2
+
3
+ export const AnimationDuration = withDefault(NumberControl, 1000);
@@ -0,0 +1,2 @@
1
+ import { AutoHeightControl } from "lowcoder-sdk";
2
+ export { AutoHeightControl };
@@ -0,0 +1,146 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { XAXisComponentOption, YAXisComponentOption } from "echarts";
3
+ import {
4
+ MultiCompBuilder,
5
+ NumberControl,
6
+ StringControl,
7
+ dropdownControl,
8
+ withContext,
9
+ } from "lowcoder-sdk";
10
+
11
+ export const XAxisTypeOptions = [
12
+ {
13
+ label: trans("chart.auto"),
14
+ value: "default",
15
+ },
16
+ {
17
+ label: trans("chart.categoryAxis"),
18
+ value: "category",
19
+ },
20
+ {
21
+ label: trans("chart.valueAxis"),
22
+ value: "value",
23
+ },
24
+ {
25
+ label: trans("chart.timeAxis"),
26
+ value: "time",
27
+ },
28
+ {
29
+ label: trans("chart.logAxis"),
30
+ value: "log",
31
+ },
32
+ ] as const;
33
+
34
+ export const YAxisTypeOptions = [
35
+ {
36
+ label: trans("chart.valueAxis"),
37
+ value: "value",
38
+ },
39
+ {
40
+ label: trans("chart.categoryAxis"),
41
+ value: "category",
42
+ },
43
+ {
44
+ label: trans("chart.timeAxis"),
45
+ value: "time",
46
+ },
47
+ {
48
+ label: trans("chart.logAxis"),
49
+ value: "log",
50
+ },
51
+ ] as const;
52
+
53
+ export const AxisFormatterComp = withContext(
54
+ new MultiCompBuilder({ value: StringControl }, (props) => props.value)
55
+ .setPropertyViewFn((children) =>
56
+ children.value.propertyView({
57
+ label: trans("chart.yAxisDataFormat"),
58
+ placeholder: "{{value}}",
59
+ tooltip: trans("chart.yAxisDataFormatTooltip"),
60
+ })
61
+ )
62
+ .build(),
63
+ ["value"] as const
64
+ );
65
+
66
+ const axisCommonMap = {
67
+ axisName: StringControl,
68
+ logBase: NumberControl,
69
+ };
70
+
71
+ // X-Axis Config
72
+ export const XAxisConfig = new MultiCompBuilder(
73
+ {
74
+ ...axisCommonMap,
75
+ type: dropdownControl(XAxisTypeOptions, "default"),
76
+ },
77
+ (props): XAXisComponentOption => {
78
+ const config: XAXisComponentOption = {
79
+ name: props.axisName,
80
+ nameGap: 22,
81
+ nameLocation: "middle",
82
+ };
83
+ if (props.type !== "default") {
84
+ config.type = props.type;
85
+ }
86
+ return config;
87
+ }
88
+ )
89
+ .setPropertyViewFn((children) => (
90
+ <>
91
+ {children.axisName.propertyView({ label: trans("chart.xAxisName") })}
92
+ {children.type.propertyView({
93
+ label: trans("chart.xAxisType"),
94
+ tooltip: trans("chart.xAxisTypeTooltip"),
95
+ })}
96
+ {children.type.getView() === "log" &&
97
+ children.logBase.propertyView({ label: trans("chart.logBase") })}
98
+ </>
99
+ ))
100
+ .build();
101
+
102
+ // Y-Axis Config
103
+ export const YAxisConfig = new MultiCompBuilder(
104
+ {
105
+ ...axisCommonMap,
106
+ yAxisType: dropdownControl(YAxisTypeOptions, "value"),
107
+ formatter: AxisFormatterComp,
108
+ },
109
+ (props): YAXisComponentOption => {
110
+ const config: YAXisComponentOption = {
111
+ name: props.axisName,
112
+ type: props.yAxisType,
113
+ nameTextStyle: { align: "left" },
114
+ };
115
+ const numberFormat = new Intl.NumberFormat(undefined, {
116
+ notation: "compact",
117
+ });
118
+ (config.axisLabel as any) = {
119
+ formatter: (value: string | number) => {
120
+ const res = (props.formatter as any)({ value });
121
+ if (res) return res;
122
+ if (
123
+ (props.yAxisType === "value" || props.yAxisType === "log") &&
124
+ typeof value === "number"
125
+ ) {
126
+ return numberFormat.format(value);
127
+ }
128
+ return value + "";
129
+ },
130
+ };
131
+ if (props.yAxisType === "log") {
132
+ (config as any).logBase = props.logBase || 10;
133
+ }
134
+ return config;
135
+ }
136
+ )
137
+ .setPropertyViewFn((children) => (
138
+ <>
139
+ {children.axisName.propertyView({ label: trans("chart.yAxisName") })}
140
+ {children.yAxisType.propertyView({ label: trans("chart.yAxisType") })}
141
+ {children.yAxisType.getView() === "log" &&
142
+ children.logBase.propertyView({ label: trans("chart.logBase") })}
143
+ {children.formatter.getPropertyView()}
144
+ </>
145
+ ))
146
+ .build();
@@ -0,0 +1,14 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { BoolControl, dropdownControl } from "lowcoder-sdk";
3
+
4
+ export const ShowAxisControl = dropdownControl(
5
+ [
6
+ { label: trans("chart.hide"), value: "hide" },
7
+ { label: trans("chart.show"), value: "show" },
8
+ { label: trans("chart.custom"), value: "custom" },
9
+ ],
10
+ "show"
11
+ );
12
+
13
+ export const ShowXAxisControl = BoolControl;
14
+ export const ShowYAxisControl = BoolControl;
@@ -0,0 +1,15 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { dropdownControl } from "lowcoder-sdk";
3
+
4
+ export const ChartTypeOptions = [
5
+ { label: trans("chart.bar"), value: "bar" },
6
+ { label: trans("chart.line"), value: "line" },
7
+ { label: "Line V2", value: "linev2" },
8
+ { label: trans("chart.scatter"), value: "scatter" },
9
+ { label: trans("chart.pie"), value: "pie" },
10
+ ] as const;
11
+
12
+ export type ChartType = (typeof ChartTypeOptions)[number]["value"];
13
+
14
+ export const ChartTypeControl = (defaultValue: ChartType) =>
15
+ dropdownControl(ChartTypeOptions, defaultValue);
@@ -0,0 +1,221 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import {
3
+ ChangeEventHandlerControl,
4
+ ColorControl,
5
+ JSONValue,
6
+ list,
7
+ MultiCompBuilder,
8
+ NumberControl,
9
+ Option,
10
+ RedButton,
11
+ RefControl,
12
+ StringControl,
13
+ withContext,
14
+ } from "lowcoder-sdk";
15
+
16
+ import { radioControl } from "./radioControl";
17
+
18
+ export const ColorScaleTypeOptions = [
19
+ {
20
+ label: trans("colorScale.sequential"),
21
+ value: "sequential",
22
+ },
23
+ {
24
+ label: trans("colorScale.diverging"),
25
+ value: "diverging",
26
+ },
27
+ {
28
+ label: trans("colorScale.categorical"),
29
+ value: "categorical",
30
+ },
31
+ ] as const;
32
+
33
+ export const ColorFormatterComp = withContext(
34
+ new MultiCompBuilder({ value: StringControl }, (props) => props.value)
35
+ .setPropertyViewFn((children) =>
36
+ children.value.propertyView({
37
+ label: trans("colorScale.colorFormat"),
38
+ placeholder: "#{{value}}",
39
+ tooltip: trans("colorScale.colorFormatTooltip"),
40
+ })
41
+ )
42
+ .build(),
43
+ ["value"] as const
44
+ );
45
+
46
+ interface ColorRange {
47
+ id: string;
48
+ from?: number;
49
+ to?: number;
50
+ color: string;
51
+ }
52
+
53
+ const colorScaleCommonMap = {
54
+ scaleType: radioControl(ColorScaleTypeOptions, "sequential"),
55
+ minColor: ColorControl,
56
+ maxColor: ColorControl,
57
+ midColor: ColorControl,
58
+ onEvent: ChangeEventHandlerControl,
59
+ viewRef: RefControl,
60
+ };
61
+
62
+ export const ColorRangeConfig = new MultiCompBuilder(
63
+ {
64
+ from: NumberControl,
65
+ to: NumberControl,
66
+ color: ColorControl,
67
+ },
68
+ (props): ColorRange => ({
69
+ id: `${props.from}-${props.to}-${Math.random().toString(36).substr(2, 9)}`,
70
+ from: props.from,
71
+ to: props.to,
72
+ color: props.color,
73
+ })
74
+ )
75
+ .setPropertyViewFn((children) => (
76
+ <>
77
+ {children.from.propertyView({
78
+ label: trans("colorScale.valueFrom"),
79
+ })}
80
+ {children.to.propertyView({ label: trans("colorScale.valueTo") })}
81
+ {children.color.propertyView({ label: trans("colorScale.color") })}
82
+ </>
83
+ ))
84
+ .build();
85
+
86
+ export const ColorScaleConfig = new MultiCompBuilder(
87
+ {
88
+ ...colorScaleCommonMap,
89
+ colorRanges: list(ColorRangeConfig),
90
+ formatter: ColorFormatterComp,
91
+ },
92
+ (props) => {
93
+ const config: any = {
94
+ scaleType: props.scaleType,
95
+ };
96
+
97
+ if (props.scaleType === "sequential" || props.scaleType === "diverging") {
98
+ config.minColor = props.minColor;
99
+ config.maxColor = props.maxColor;
100
+ }
101
+
102
+ if (props.scaleType === "diverging") {
103
+ config.midColor = props.midColor;
104
+ }
105
+
106
+ if (props.scaleType === "categorical") {
107
+ config.colorRanges = props.colorRanges;
108
+ }
109
+
110
+ return config;
111
+ }
112
+ )
113
+ .setPropertyViewFn((children) => {
114
+ const scaleType = children.scaleType.getView();
115
+
116
+ return (
117
+ <>
118
+ {children.scaleType.propertyView({
119
+ label: trans("colorScale.colorScaleType"),
120
+ direction: "vertical",
121
+ })}
122
+
123
+ {(scaleType === "sequential" || scaleType === "diverging") && (
124
+ <>
125
+ {children.minColor.propertyView({
126
+ label: trans("colorScale.minColor"),
127
+ })}
128
+ {children.maxColor.propertyView({
129
+ label: trans("colorScale.maxColor"),
130
+ })}
131
+ </>
132
+ )}
133
+
134
+ {scaleType === "diverging" && (
135
+ <>
136
+ {children.midColor.propertyView({
137
+ label: trans("colorScale.midColor"),
138
+ })}
139
+ </>
140
+ )}
141
+
142
+ {scaleType === "categorical" && (
143
+ <Option
144
+ items={children.colorRanges.getView()}
145
+ title={trans("colorScale.colorRanges")}
146
+ itemTitle={(item) => {
147
+ const view = item.getView();
148
+ return `[${view.from}-${view.to}] ${view.color}`;
149
+ }}
150
+ popoverTitle={() => trans("colorScale.colorRange")}
151
+ content={(item, index) => (
152
+ <>
153
+ {item.children.from.propertyView({
154
+ label: trans("colorScale.valueFrom"),
155
+ })}
156
+ {item.children.to.propertyView({
157
+ label: trans("colorScale.valueTo"),
158
+ })}
159
+ {item.children.color.propertyView({
160
+ label: trans("colorScale.color"),
161
+ })}
162
+ <RedButton
163
+ onClick={() => {
164
+ children.colorRanges.dispatch(
165
+ children.colorRanges.deleteAction(index)
166
+ );
167
+ }}
168
+ style={{ marginTop: "8px" }}
169
+ >
170
+ {trans("colorScale.deleteRange")}
171
+ </RedButton>
172
+ </>
173
+ )}
174
+ onAdd={() => {
175
+ const old = children.colorRanges
176
+ .getView()
177
+ .map((i: any) => i.getView())
178
+ .at(-1);
179
+
180
+ children.colorRanges.dispatch(
181
+ children.colorRanges.pushAction({
182
+ from: old?.from + 100 || 0,
183
+ to: old?.to + 100 || 100,
184
+ color: "#ff0000",
185
+ })
186
+ );
187
+ }}
188
+ onMove={(fromIndex, toIndex) => {
189
+ const action = children.colorRanges.arrayMoveAction(
190
+ fromIndex,
191
+ toIndex
192
+ );
193
+ children.colorRanges.dispatch(action);
194
+ }}
195
+ hide={(item) => false}
196
+ dataIndex={(item) => item.getView().id}
197
+ />
198
+ )}
199
+ </>
200
+ );
201
+ })
202
+ .build();
203
+
204
+ // Componen
205
+ export function calcColorScaleType(
206
+ data: Array<JSONValue | undefined>
207
+ ): "sequential" | "diverging" | "categorical" {
208
+ if (!data || data.length === 0) return "sequential";
209
+
210
+ const hasNegative = data.some((item) => typeof item === "number" && item < 0);
211
+ const hasPositive = data.some((item) => typeof item === "number" && item > 0);
212
+
213
+ if (hasNegative && hasPositive) return "diverging";
214
+
215
+ const uniqueValues = new Set(data.map((item) => String(item)));
216
+ if (uniqueValues.size <= 10) return "categorical";
217
+
218
+ return "sequential";
219
+ }
220
+
221
+ export const ColorScaleControls = ColorScaleConfig;
@@ -0,0 +1,204 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import {
3
+ AlignClose,
4
+ AlignLeft,
5
+ AlignRight,
6
+ BoolControl,
7
+ ColorControl,
8
+ dropdownControl,
9
+ EchartDefaultChartStyle,
10
+ EchartDefaultTextStyle,
11
+ MultiCompBuilder,
12
+ NumberControl,
13
+ StringControl,
14
+ withDefault,
15
+ } from "lowcoder-sdk";
16
+
17
+ const SortOptions = [
18
+ { label: trans("chart.none"), value: "none" },
19
+ { label: trans("chart.ascending"), value: "asc" },
20
+ { label: trans("chart.descending"), value: "desc" },
21
+ ] as const;
22
+
23
+ export const AlignOptions = [
24
+ {
25
+ label: <AlignLeft />,
26
+ value: "left",
27
+ },
28
+ {
29
+ label: <AlignClose />,
30
+ value: "center",
31
+ },
32
+ {
33
+ label: <AlignRight />,
34
+ value: "right",
35
+ },
36
+ ] as const;
37
+
38
+ export const TableStyle = Array.from(
39
+ new Set(EchartDefaultTextStyle.concat(EchartDefaultChartStyle))
40
+ );
41
+
42
+ const ColumnStyleControls = [
43
+ {
44
+ name: "color",
45
+ label: trans("style.color"),
46
+ control: ColorControl,
47
+ defaultValue: "#000000",
48
+ },
49
+ {
50
+ name: "fontSize",
51
+ label: trans("style.fontSize"),
52
+ tooltip: trans("style.fontSizeTooltip"),
53
+ control: StringControl,
54
+ defaultValue: "14px",
55
+ },
56
+ {
57
+ name: "fontWeight",
58
+ label: trans("style.fontWeight"),
59
+ tooltip: trans("style.fontWeightTooltip"),
60
+ control: StringControl,
61
+ defaultValue: "normal",
62
+ },
63
+ {
64
+ name: "fontFamily",
65
+ label: trans("style.fontFamily"),
66
+ control: StringControl,
67
+ defaultValue: "Arial, sans-serif",
68
+ },
69
+ {
70
+ name: "fontStyle",
71
+ label: trans("style.fontStyle"),
72
+ control: dropdownControl(
73
+ [
74
+ { label: trans("style.normal"), value: "normal" },
75
+ { label: trans("style.italic"), value: "italic" },
76
+ { label: trans("style.oblique"), value: "oblique" },
77
+ ],
78
+ "normal"
79
+ ),
80
+ },
81
+ {
82
+ name: "shadowColor",
83
+ label: trans("style.shadowColor"),
84
+ control: ColorControl,
85
+ },
86
+ {
87
+ name: "boxShadow",
88
+ label: trans("style.boxShadow"),
89
+ control: StringControl,
90
+ defaultValue: "none",
91
+ },
92
+ {
93
+ name: "background",
94
+ label: trans("style.backgroundColor"),
95
+ control: ColorControl,
96
+ },
97
+ {
98
+ name: "borderColor",
99
+ label: trans("style.borderColor"),
100
+ control: ColorControl,
101
+ defaultValue: "#d9d9d9",
102
+ },
103
+ {
104
+ name: "borderStyle",
105
+ label: trans("style.borderStyle"),
106
+ tooltip: trans("style.borderStyleTooltip"),
107
+ control: StringControl,
108
+ },
109
+ {
110
+ name: "borderRadius",
111
+ label: trans("style.borderRadius"),
112
+ control: StringControl,
113
+ },
114
+ {
115
+ name: "borderWidth",
116
+ label: trans("style.borderWidth"),
117
+ control: StringControl,
118
+ },
119
+ ];
120
+
121
+ const createColumnStyleControl = () => {
122
+ const styleMap: any = {};
123
+
124
+ ColumnStyleControls.forEach((styleConfig) => {
125
+ styleMap[styleConfig.name] = styleConfig.control;
126
+ if (styleConfig.defaultValue !== undefined) {
127
+ styleMap[styleConfig.name] = withDefault(
128
+ styleMap[styleConfig.name],
129
+ styleConfig.defaultValue
130
+ );
131
+ }
132
+ });
133
+
134
+ return new MultiCompBuilder(styleMap, (props) => props)
135
+ .setPropertyViewFn((children) => (
136
+ <div>
137
+ {ColumnStyleControls.map((styleConfig) => (
138
+ <div key={styleConfig.name} style={{ marginBottom: "8px" }}>
139
+ {children[styleConfig.name].propertyView({
140
+ label: styleConfig.label,
141
+ tooltip: styleConfig.tooltip,
142
+ })}
143
+ </div>
144
+ ))}
145
+ </div>
146
+ ))
147
+ .build();
148
+ };
149
+
150
+ const markColumnChildrenMap = {
151
+ title: StringControl,
152
+ dataIndex: StringControl,
153
+ key: StringControl,
154
+ visible: withDefault(BoolControl, false),
155
+ sortable: withDefault(BoolControl, true),
156
+ defaultSortOrder: dropdownControl(SortOptions, "none"),
157
+ align: dropdownControl(AlignOptions, "left"),
158
+ fixed: dropdownControl(
159
+ [
160
+ { label: trans("tableChart.none"), value: "none" },
161
+ { label: trans("tableChart.left"), value: "left" },
162
+ { label: trans("tableChart.right"), value: "right" },
163
+ ],
164
+ "none"
165
+ ),
166
+ width: NumberControl,
167
+ styles: createColumnStyleControl(),
168
+ };
169
+
170
+ export const ColumnConfigComp = new MultiCompBuilder(
171
+ markColumnChildrenMap,
172
+ (props) => {
173
+ return props;
174
+ }
175
+ )
176
+ .setPropertyViewFn((children: any) => (
177
+ <>
178
+ {children.title.propertyView({
179
+ label: trans("tableChart.title"),
180
+ })}
181
+ {children.dataIndex.propertyView({
182
+ label: trans("tableChart.dataValue"),
183
+ })}
184
+ {children.visible.propertyView({ label: trans("tableChart.visible") })}
185
+ {children.sortable.propertyView({
186
+ label: trans("chart.sortable"),
187
+ })}
188
+ {children.sortable.getView() &&
189
+ children.defaultSortOrder.propertyView({
190
+ label: trans("chart.sortOrder"),
191
+ })}
192
+ {children.align.propertyView({
193
+ label: trans("tableChart.align"),
194
+ tooltip: trans("style.alignTooltip"),
195
+ radioButton: true,
196
+ })}
197
+ {children.fixed.propertyView({ label: trans("tableChart.fixed") })}
198
+ {children.width.propertyView({ label: trans("tableChart.width") })}
199
+ {children.styles.getPropertyView()}
200
+ </>
201
+ ))
202
+ .build();
203
+
204
+ export { ColumnStyleControls };
@@ -0,0 +1,37 @@
1
+ import { BarChartConfig } from "@/configs/barChartConfig";
2
+ import { FunnelChartConfig } from "@/configs/funnelChartConfig";
3
+ import { GaugeChartConfig } from "@/configs/gaugeChartConfig";
4
+ import { LineChartConfig } from "@/configs/lineChartConfig";
5
+ import { MapChartConfig } from "@/configs/mapChartConfig";
6
+ import { MapChartConfigV2 } from "@/configs/mapChartConfigv2";
7
+
8
+ import { MixedChartConfig } from "@/configs/mixedChartConfig";
9
+ import { PieChartConfig } from "@/configs/pieChartConfig";
10
+ import { ScatterChartConfig } from "@/configs/scatterChartConfig";
11
+ import { TableChartConfig } from "@/configs/tableChartConfig";
12
+ import { TotalChartConfig } from "@/configs/totalChartConfig";
13
+ import { withType } from "lowcoder-sdk";
14
+
15
+ export const ChartOptionMap = {
16
+ bar: BarChartConfig,
17
+ line: LineChartConfig,
18
+ linev2: LineChartConfig,
19
+ pie: PieChartConfig,
20
+ scatter: ScatterChartConfig,
21
+ map: MapChartConfig,
22
+ mapv2: MapChartConfigV2,
23
+ total: TotalChartConfig,
24
+ mixed: MixedChartConfig,
25
+ table: TableChartConfig,
26
+ };
27
+
28
+ export const ConfigControl = withType(ChartOptionMap, "line");
29
+
30
+ export const EchartsOptionMap = {
31
+ funnel: FunnelChartConfig,
32
+ gauge: GaugeChartConfig,
33
+ };
34
+
35
+ export const ChartOptionComp = withType(ChartOptionMap, "line");
36
+ export const EchartsOptionComp = withType(EchartsOptionMap, "funnel");
37
+ export type CharOptionCompType = keyof typeof ChartOptionMap;
@@ -0,0 +1,20 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { dropdownControl, ValueFromOption } from "lowcoder-sdk";
3
+
4
+ export const XAxisDirectionOptions = [
5
+ {
6
+ label: trans("chart.horizontal"),
7
+ value: "horizontal",
8
+ },
9
+ {
10
+ label: trans("chart.vertical"),
11
+ value: "vertical",
12
+ },
13
+ ] as const;
14
+
15
+ export const XAxisDirection = dropdownControl(
16
+ XAxisDirectionOptions,
17
+ "horizontal"
18
+ );
19
+
20
+ export type XAxisDirectionType = ValueFromOption<typeof XAxisDirectionOptions>;