lowcoder-comps 0.0.19 → 0.0.20

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 (78) hide show
  1. package/01102044.js +940 -0
  2. package/011ccb4a.js +46688 -0
  3. package/0d5d7030.js +212 -0
  4. package/0e8dfd52.js +793 -0
  5. package/0f25771b.js +1118 -0
  6. package/2470e1d8.js +91 -0
  7. package/256b619e.js +92 -0
  8. package/2ff2c7a6.js +6 -0
  9. package/3196b84f.js +798 -0
  10. package/31c6e136.js +34 -0
  11. package/32432dc3.js +86 -0
  12. package/36552e14.js +849 -0
  13. package/384b70d4.js +24 -0
  14. package/3ad35722.js +365 -0
  15. package/3f4db197.js +943 -0
  16. package/4791bdd6.js +117321 -0
  17. package/5a7c40d7.js +18619 -0
  18. package/5fd0f607.js +447 -0
  19. package/71827e37.js +1032 -0
  20. package/7a200c6a.js +607 -0
  21. package/804e952b.js +451 -0
  22. package/872f2918.js +7 -0
  23. package/8d714103.js +1602 -0
  24. package/93b98f3e.js +832 -0
  25. package/a06ced05.js +326 -0
  26. package/a1f987b7.js +236 -0
  27. package/a42a2ba9.js +2103 -0
  28. package/af0489f3.js +2456 -0
  29. package/b56f953d.js +985 -0
  30. package/b89c6a6a.js +159 -0
  31. package/bc7030d3.js +70 -0
  32. package/c739ba3e.js +2679 -0
  33. package/d306d59c.js +2827 -0
  34. package/d8adcd1e.js +823 -0
  35. package/e1466a22.js +275 -0
  36. package/ef845d7f.js +1246 -0
  37. package/f9637058.js +16 -0
  38. package/index.js +5 -0
  39. package/package.json +4 -3
  40. package/README.md +0 -27
  41. package/index.html +0 -26
  42. package/index.tsx +0 -19
  43. package/jest.config.js +0 -6
  44. package/src/__test__/allComp.test.tsx +0 -61
  45. package/src/app-env.d.ts +0 -3
  46. package/src/comps/calendarComp/calendarComp.tsx +0 -443
  47. package/src/comps/calendarComp/calendarConstants.tsx +0 -898
  48. package/src/comps/chartComp/chartComp.tsx +0 -356
  49. package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +0 -51
  50. package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +0 -307
  51. package/src/comps/chartComp/chartConfigs/chartUrls.tsx +0 -9
  52. package/src/comps/chartComp/chartConfigs/legendConfig.tsx +0 -55
  53. package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +0 -96
  54. package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +0 -83
  55. package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +0 -62
  56. package/src/comps/chartComp/chartConstants.tsx +0 -288
  57. package/src/comps/chartComp/chartPropertyView.tsx +0 -218
  58. package/src/comps/chartComp/chartUtils.ts +0 -291
  59. package/src/comps/chartComp/reactEcharts/core.tsx +0 -194
  60. package/src/comps/chartComp/reactEcharts/index.ts +0 -21
  61. package/src/comps/chartComp/reactEcharts/types.ts +0 -76
  62. package/src/comps/chartComp/seriesComp.tsx +0 -119
  63. package/src/comps/imageEditorComp/imageEditorClass.tsx +0 -52
  64. package/src/comps/imageEditorComp/imageEditorConstants.tsx +0 -109
  65. package/src/comps/imageEditorComp/index.tsx +0 -184
  66. package/src/comps/mermaidComp/index.tsx +0 -44
  67. package/src/comps/mermaidComp/mermaid.tsx +0 -29
  68. package/src/global.ts +0 -1
  69. package/src/i18n/comps/index.tsx +0 -29
  70. package/src/i18n/comps/locales/en.ts +0 -150
  71. package/src/i18n/comps/locales/enObj.tsx +0 -198
  72. package/src/i18n/comps/locales/index.ts +0 -7
  73. package/src/i18n/comps/locales/types.tsx +0 -10
  74. package/src/i18n/comps/locales/zh.ts +0 -145
  75. package/src/i18n/comps/locales/zhObj.tsx +0 -4
  76. package/src/index.ts +0 -11
  77. package/tsconfig.json +0 -22
  78. package/vite.config.js +0 -10
@@ -1,9 +0,0 @@
1
- import { language } from "i18n/comps";
2
-
3
- const echartsUrlLocale = language === "zh" ? "zh" : "en";
4
- export const optionUrl = `https://echarts.apache.org/${echartsUrlLocale}/option.html`;
5
- export const examplesUrl = `https://echarts.apache.org/examples/${echartsUrlLocale}/index.html`;
6
- export const xAxisTypeUrl = `${optionUrl}#xAxis.type`;
7
- export const googleMapsApiUrl = `https://maps.googleapis.com/maps/api/js?v=3.exp`;
8
- export const mapOptionUrl = `https://github.com/plainheart/echarts-extension-gmap`;
9
- export const mapExamplesUrl = `https://codepen.io/plainheart/pen/VweLGbR`;
@@ -1,55 +0,0 @@
1
- import {
2
- AlignBottom,
3
- AlignClose,
4
- AlignRight,
5
- dropdownControl,
6
- MultiCompBuilder,
7
- } from "lowcoder-sdk";
8
- import { LegendComponentOption } from "echarts";
9
- import { trans } from "i18n/comps";
10
-
11
- const LegendPositionOptions = [
12
- {
13
- label: <AlignBottom />,
14
- value: "bottom",
15
- },
16
- {
17
- label: <AlignRight />,
18
- value: "right",
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
- })();
@@ -1,96 +0,0 @@
1
- import { LineSeriesOption } from "echarts";
2
- import {
3
- MultiCompBuilder,
4
- BoolControl,
5
- dropdownControl,
6
- showLabelPropertyView,
7
- withContext,
8
- StringControl,
9
- ColorOrBoolCodeControl,
10
- } from "lowcoder-sdk";
11
- import { trans } from "i18n/comps";
12
-
13
- const BarTypeOptions = [
14
- {
15
- label: trans("chart.basicLine"),
16
- value: "basicLine",
17
- },
18
- {
19
- label: trans("chart.stackedLine"),
20
- value: "stackedLine",
21
- },
22
- {
23
- label: trans("chart.areaLine"),
24
- value: "areaLine",
25
- },
26
- ] as const;
27
-
28
- export const ItemColorComp = withContext(
29
- new MultiCompBuilder({ value: ColorOrBoolCodeControl }, (props) => props.value)
30
- .setPropertyViewFn((children) =>
31
- children.value.propertyView({
32
- label: trans("chart.pointColorLabel"),
33
- placeholder: "{{value < 25000}}",
34
- tooltip: trans("chart.pointColorTooltip"),
35
- })
36
- )
37
- .build(),
38
- ["seriesName", "value"] as const
39
- );
40
-
41
- export const LineChartConfig = (function () {
42
- return new MultiCompBuilder(
43
- {
44
- showLabel: BoolControl,
45
- type: dropdownControl(BarTypeOptions, "basicLine"),
46
- smooth: BoolControl,
47
- itemColor: ItemColorComp,
48
- },
49
- (props): LineSeriesOption => {
50
- const config: LineSeriesOption = {
51
- type: "line",
52
- label: {
53
- show: props.showLabel,
54
- },
55
- itemStyle: {
56
- color: (params) => {
57
- if (!params.encode || !params.dimensionNames) {
58
- return params.color;
59
- }
60
- const dataKey = params.dimensionNames[params.encode["y"][0]];
61
- const color = (props.itemColor as any)({
62
- seriesName: params.seriesName,
63
- value: (params.data as any)[dataKey],
64
- });
65
- if (color === "true") {
66
- return "red";
67
- } else if (color === "false" || !color) {
68
- return params.color;
69
- }
70
- return color;
71
- },
72
- },
73
- };
74
- if (props.type === "stackedLine") {
75
- config.stack = "stackValue";
76
- } else if (props.type === "areaLine") {
77
- config.areaStyle = {};
78
- }
79
- if (props.smooth) {
80
- config.smooth = true;
81
- }
82
- return config;
83
- }
84
- )
85
- .setPropertyViewFn((children) => (
86
- <>
87
- {children.type.propertyView({
88
- label: trans("chart.lineType"),
89
- })}
90
- {showLabelPropertyView(children)}
91
- {children.smooth.propertyView({ label: trans("chart.smooth") })}
92
- {children.itemColor.getPropertyView()}
93
- </>
94
- ))
95
- .build();
96
- })();
@@ -1,83 +0,0 @@
1
- import { MultiCompBuilder } from "lowcoder-sdk";
2
- import { PieSeriesOption } from "echarts";
3
- import { dropdownControl } from "lowcoder-sdk";
4
- import { ConstructorToView } from "lowcoder-core";
5
- import { trans } from "i18n/comps";
6
-
7
- const BarTypeOptions = [
8
- {
9
- label: trans("chart.basicPie"),
10
- value: "basicPie",
11
- },
12
- {
13
- label: trans("chart.doughnutPie"),
14
- value: "doughnutPie",
15
- },
16
- {
17
- label: trans("chart.rosePie"),
18
- value: "rosePie",
19
- },
20
- ] as const;
21
-
22
- // radius percent for each pie chart when one line has [1, 2, 3] pie charts
23
- const pieRadiusConfig = [65, 35, 20];
24
-
25
- type PieConfigViewType = ConstructorToView<typeof PieChartConfig>;
26
-
27
- export const PieChartConfig = (function () {
28
- return new MultiCompBuilder(
29
- {
30
- type: dropdownControl(BarTypeOptions, "basicPie"),
31
- },
32
- (props): PieSeriesOption => {
33
- const config: PieSeriesOption = {
34
- type: "pie",
35
- label: {
36
- show: true,
37
- formatter: "{d}%",
38
- },
39
- };
40
- if (props.type === "rosePie") {
41
- config.roseType = "area";
42
- } else if (props.type === "doughnutPie") {
43
- config.radius = ["40%", "60%"];
44
- }
45
- return config;
46
- }
47
- )
48
- .setPropertyViewFn((children) => (
49
- <>
50
- {children.type.propertyView({
51
- label: trans("chart.pieType"),
52
- })}
53
- </>
54
- ))
55
- .build();
56
- })();
57
-
58
- export function getPieRadiusAndCenter(
59
- seriesLength: number,
60
- pieIndex: number,
61
- pieConfig: PieConfigViewType
62
- ) {
63
- const columnPieNum = Math.min(seriesLength, pieRadiusConfig.length);
64
- const radiusNumber = pieRadiusConfig[columnPieNum - 1];
65
- const isDoughnutPie = Array.isArray(pieConfig.radius);
66
- const radius = isDoughnutPie
67
- ? [(radiusNumber / 1.6).toFixed(2) + "%", radiusNumber + "%"]
68
- : radiusNumber + "%";
69
-
70
- /*** calculate center coordinates ***/
71
- const pieDiameter = 100 / columnPieNum;
72
- const xPosition = (pieDiameter * (pieIndex % columnPieNum) + pieDiameter / 2).toFixed(2) + "%";
73
- const rowIndex = Math.floor(pieIndex / columnPieNum) + 1;
74
- const yPosition =
75
- ((100 / Math.floor((columnPieNum * 2 + seriesLength - 1) / columnPieNum)) * rowIndex).toFixed(
76
- 2
77
- ) + "%";
78
- // log.log("Echarts height: index:", pieConfig, radius, pieIndex, xPosition, yPosition);
79
- return {
80
- radius: radius,
81
- center: [xPosition, yPosition],
82
- } as const;
83
- }
@@ -1,62 +0,0 @@
1
- import {
2
- MultiCompBuilder,
3
- dropdownControl,
4
- BoolControl,
5
- showLabelPropertyView,
6
- } from "lowcoder-sdk";
7
- import { ScatterSeriesOption } from "echarts";
8
- import { trans } from "i18n/comps";
9
-
10
- const ScatterShapeOptions = [
11
- {
12
- label: trans("chart.circle"),
13
- value: "circle",
14
- },
15
- {
16
- label: trans("chart.rect"),
17
- value: "rect",
18
- },
19
- {
20
- label: trans("chart.triangle"),
21
- value: "triangle",
22
- },
23
- {
24
- label: trans("chart.diamond"),
25
- value: "diamond",
26
- },
27
- {
28
- label: trans("chart.pin"),
29
- value: "pin",
30
- },
31
- {
32
- label: trans("chart.arrow"),
33
- value: "arrow",
34
- },
35
- ] as const;
36
-
37
- export const ScatterChartConfig = (function () {
38
- return new MultiCompBuilder(
39
- {
40
- showLabel: BoolControl,
41
- shape: dropdownControl(ScatterShapeOptions, "circle"),
42
- },
43
- (props): ScatterSeriesOption => {
44
- return {
45
- type: "scatter",
46
- symbol: props.shape,
47
- label: {
48
- show: props.showLabel,
49
- },
50
- };
51
- }
52
- )
53
- .setPropertyViewFn((children) => (
54
- <>
55
- {showLabelPropertyView(children)}
56
- {children.shape.propertyView({
57
- label: trans("chart.scatterShape"),
58
- })}
59
- </>
60
- ))
61
- .build();
62
- })();
@@ -1,288 +0,0 @@
1
- import {
2
- jsonControl,
3
- JSONObject,
4
- stateComp,
5
- toJSONObjectArray,
6
- toObject,
7
- BoolControl,
8
- withDefault,
9
- StringControl,
10
- NumberControl,
11
- FunctionControl,
12
- dropdownControl,
13
- eventHandlerControl,
14
- valueComp,
15
- withType,
16
- ValueFromOption,
17
- uiChildren,
18
- } from "lowcoder-sdk";
19
- import { RecordConstructorToComp, RecordConstructorToView } from "lowcoder-core";
20
- import { BarChartConfig } from "./chartConfigs/barChartConfig";
21
- import { XAxisConfig, YAxisConfig } from "./chartConfigs/cartesianAxisConfig";
22
- import { LegendConfig } from "./chartConfigs/legendConfig";
23
- import { LineChartConfig } from "./chartConfigs/lineChartConfig";
24
- import { PieChartConfig } from "./chartConfigs/pieChartConfig";
25
- import { ScatterChartConfig } from "./chartConfigs/scatterChartConfig";
26
- import { SeriesListComp } from "./seriesComp";
27
- import { EChartsOption } from "echarts";
28
- import { i18nObjs, trans } from "i18n/comps";
29
-
30
- export const ChartTypeOptions = [
31
- {
32
- label: trans("chart.bar"),
33
- value: "bar",
34
- },
35
- {
36
- label: trans("chart.line"),
37
- value: "line",
38
- },
39
- {
40
- label: trans("chart.scatter"),
41
- value: "scatter",
42
- },
43
- {
44
- label: trans("chart.pie"),
45
- value: "pie",
46
- },
47
- ] as const;
48
-
49
- const chartModeOptions = [
50
- {
51
- label: trans("chart.UIMode"),
52
- value: "ui",
53
- },
54
- {
55
- label: "ECharts JSON",
56
- value: "json",
57
- },
58
- {
59
- label: "Map",
60
- value: "map",
61
- },
62
- ] as const;
63
-
64
- export const UIEventOptions = [
65
- {
66
- label: trans("chart.select"),
67
- value: "select",
68
- description: trans("chart.selectDesc"),
69
- },
70
-
71
- {
72
- label: trans("chart.unSelect"),
73
- value: "unselect",
74
- description: trans("chart.unselectDesc"),
75
- },
76
- ] as const;
77
-
78
- export const MapEventOptions = [
79
- {
80
- label: trans("chart.mapReady"),
81
- value: "mapReady",
82
- description: trans("chart.mapReadyDesc"),
83
- },
84
- {
85
- label: trans("chart.zoomLevelChange"),
86
- value: "zoomLevelChange",
87
- description: trans("chart.zoomLevelChangeDesc"),
88
- },
89
- {
90
- label: trans("chart.centerPositionChange"),
91
- value: "centerPositionChange",
92
- description: trans("chart.centerPositionChangeDesc"),
93
- },
94
- ] as const;
95
-
96
- export const XAxisDirectionOptions = [
97
- {
98
- label: trans("chart.horizontal"),
99
- value: "horizontal",
100
- },
101
- {
102
- label: trans("chart.vertical"),
103
- value: "vertical",
104
- },
105
- ] as const;
106
-
107
- export type XAxisDirectionType = ValueFromOption<typeof XAxisDirectionOptions>;
108
-
109
- export const noDataAxisConfig = {
110
- animation: false,
111
- xAxis: {
112
- type: "category",
113
- name: trans("chart.noData"),
114
- nameLocation: "middle",
115
- data: [],
116
- axisLine: {
117
- lineStyle: {
118
- color: "#8B8FA3",
119
- },
120
- },
121
- },
122
- yAxis: {
123
- type: "value",
124
- axisLabel: {
125
- color: "#8B8FA3",
126
- },
127
- splitLine: {
128
- lineStyle: {
129
- color: "#F0F0F0",
130
- },
131
- },
132
- },
133
- tooltip: {
134
- show: false,
135
- },
136
- series: [
137
- {
138
- data: [700],
139
- type: "line",
140
- itemStyle: {
141
- opacity: 0,
142
- },
143
- },
144
- ],
145
- } as EChartsOption;
146
-
147
- export const noDataPieChartConfig = {
148
- animation: false,
149
- tooltip: {
150
- show: false,
151
- },
152
- legend: {
153
- formatter: trans("chart.unknown"),
154
- top: "bottom",
155
- selectedMode: false,
156
- },
157
- color: ["#B8BBCC", "#CED0D9", "#DCDEE6", "#E6E6EB"],
158
- series: [
159
- {
160
- type: "pie",
161
- radius: "35%",
162
- center: ["25%", "50%"],
163
- silent: true,
164
- label: {
165
- show: false,
166
- },
167
- data: [
168
- {
169
- name: "1",
170
- value: 70,
171
- },
172
- {
173
- name: "2",
174
- value: 68,
175
- },
176
- {
177
- name: "3",
178
- value: 48,
179
- },
180
- {
181
- name: "4",
182
- value: 40,
183
- },
184
- ],
185
- },
186
- {
187
- type: "pie",
188
- radius: "35%",
189
- center: ["75%", "50%"],
190
- silent: true,
191
- label: {
192
- show: false,
193
- },
194
- data: [
195
- {
196
- name: "1",
197
- value: 70,
198
- },
199
- {
200
- name: "2",
201
- value: 68,
202
- },
203
- {
204
- name: "3",
205
- value: 48,
206
- },
207
- {
208
- name: "4",
209
- value: 40,
210
- },
211
- ],
212
- },
213
- ],
214
- } as EChartsOption;
215
-
216
- export type ChartSize = { w: number; h: number };
217
-
218
- export const getDataKeys = (data: Array<JSONObject>) => {
219
- if (!data) {
220
- return [];
221
- }
222
- const dataKeys: Array<string> = [];
223
- data.slice(0, 50).forEach((d) => {
224
- Object.keys(d).forEach((key) => {
225
- if (!dataKeys.includes(key)) {
226
- dataKeys.push(key);
227
- }
228
- });
229
- });
230
- return dataKeys;
231
- };
232
-
233
- const ChartOptionMap = {
234
- bar: BarChartConfig,
235
- line: LineChartConfig,
236
- pie: PieChartConfig,
237
- scatter: ScatterChartConfig,
238
- };
239
-
240
- const ChartOptionComp = withType(ChartOptionMap, "bar");
241
- export type CharOptionCompType = keyof typeof ChartOptionMap;
242
-
243
- export const chartUiModeChildren = {
244
- title: StringControl,
245
- data: jsonControl(toJSONObjectArray, i18nObjs.defaultDataSource),
246
- xAxisKey: valueComp<string>(""), // x-axis, key from data
247
- xAxisDirection: dropdownControl(XAxisDirectionOptions, "horizontal"),
248
- series: SeriesListComp,
249
- xConfig: XAxisConfig,
250
- yConfig: YAxisConfig,
251
- legendConfig: LegendConfig,
252
- chartConfig: ChartOptionComp,
253
- onUIEvent: eventHandlerControl(UIEventOptions),
254
- };
255
-
256
- const chartMapModeChildren = {
257
- mapInstance: stateComp(),
258
- getMapInstance: FunctionControl,
259
- mapApiKey: withDefault(StringControl, ''),
260
- mapZoomLevel: withDefault(NumberControl, 3),
261
- mapCenterLng: withDefault(NumberControl, 15.932644),
262
- mapCenterLat: withDefault(NumberControl, 50.942063),
263
- mapOptions: jsonControl(toObject, i18nObjs.defaultMapJsonOption),
264
- onMapEvent: eventHandlerControl(MapEventOptions),
265
- showCharts: withDefault(BoolControl, true),
266
- }
267
-
268
- export const chartChildrenMap = {
269
- mode: dropdownControl(chartModeOptions, "ui"),
270
- echartsOption: jsonControl(toObject, i18nObjs.defaultEchartsJsonOption),
271
- selectedPoints: stateComp<
272
- Array<{
273
- seriesName: string;
274
- // coordinate chart
275
- x?: any;
276
- y?: any;
277
- // pie or funnel
278
- itemName?: any;
279
- value?: any;
280
- }>
281
- >([]),
282
- ...chartUiModeChildren,
283
- ...chartMapModeChildren,
284
- };
285
-
286
- const chartUiChildrenMap = uiChildren(chartChildrenMap);
287
- export type ChartCompPropsType = RecordConstructorToView<typeof chartUiChildrenMap>;
288
- export type ChartCompChildrenType = RecordConstructorToComp<typeof chartUiChildrenMap>;