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,88 @@
1
+ import * as AntIcons from "@ant-design/icons";
2
+ import { dropdownControl } from "lowcoder-sdk";
3
+ import React from "react";
4
+
5
+ type IconComponentType = React.ComponentType<
6
+ React.ComponentProps<typeof AntIcons.UserOutlined>
7
+ >;
8
+
9
+ export const getAllAntdIcons = () => {
10
+ const iconEntries = Object.entries(AntIcons);
11
+
12
+ const iconOptions = iconEntries.map(([name, component]) => ({
13
+ label: React.createElement(component as IconComponentType),
14
+ value: name,
15
+ icon: React.createElement(component as IconComponentType),
16
+ }));
17
+
18
+ return iconOptions;
19
+ };
20
+
21
+ export const AllIconOptions = getAllAntdIcons();
22
+
23
+ export const getCommonIcons = () => {
24
+ const commonIcons = [
25
+ AntIcons.UserOutlined,
26
+ AntIcons.HomeOutlined,
27
+ AntIcons.SettingOutlined,
28
+ AntIcons.SearchOutlined,
29
+ AntIcons.HeartOutlined,
30
+ AntIcons.StarOutlined,
31
+ AntIcons.MessageOutlined,
32
+ AntIcons.BellOutlined,
33
+ AntIcons.CameraOutlined,
34
+ AntIcons.CloudOutlined,
35
+ AntIcons.EditOutlined,
36
+ AntIcons.DeleteOutlined,
37
+ AntIcons.PlusOutlined,
38
+ AntIcons.MinusOutlined,
39
+ AntIcons.CheckOutlined,
40
+ AntIcons.CloseOutlined,
41
+ AntIcons.WarningOutlined,
42
+ AntIcons.RiseOutlined,
43
+ AntIcons.FallOutlined,
44
+ AntIcons.LineOutlined,
45
+ ];
46
+
47
+ return commonIcons.map((IconComponent) => ({
48
+ label: React.createElement(IconComponent),
49
+ value: IconComponent.displayName || IconComponent.name,
50
+ icon: React.createElement(IconComponent),
51
+ }));
52
+ };
53
+
54
+ export const CommonIconOptions = getCommonIcons();
55
+
56
+ export const IconControl = dropdownControl(CommonIconOptions, "");
57
+
58
+ export const getIconComponent = (value: string): React.ReactElement => {
59
+ const IconComponent = (AntIcons as Record<string, IconComponentType | any>)[
60
+ value
61
+ ];
62
+
63
+ return React.createElement(IconComponent);
64
+ };
65
+
66
+ export const renderIcon = (
67
+ iconName: string,
68
+ props?: React.ComponentProps<IconComponentType>
69
+ ): React.ReactElement => {
70
+ const IconComponent = (AntIcons as Record<string, IconComponentType | any>)[
71
+ iconName
72
+ ];
73
+
74
+ return React.createElement(IconComponent, props);
75
+ };
76
+
77
+ export const IconComponents: Record<string, IconComponentType> = {};
78
+
79
+ Object.entries(AntIcons).forEach(([name, component]) => {
80
+ if (
81
+ typeof component === "function" &&
82
+ !name.startsWith("createFromIconfontCN") &&
83
+ !name.startsWith("getTwoToneColor") &&
84
+ !name.startsWith("setTwoToneColor")
85
+ ) {
86
+ IconComponents[name] = component as IconComponentType;
87
+ }
88
+ });
@@ -0,0 +1,8 @@
1
+ import { jsonControl } from "lowcoder-sdk";
2
+
3
+ export const LegendControl = jsonControl(
4
+ (data) => {
5
+ return data || {};
6
+ },
7
+ { position: "top" }
8
+ );
@@ -0,0 +1,91 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import {
3
+ BoolControl,
4
+ dropdownControl,
5
+ JSONObject,
6
+ MultiCompBuilder,
7
+ NumberControl,
8
+ withDefault,
9
+ } from "lowcoder-sdk";
10
+
11
+ export const CursorOptions = [
12
+ {
13
+ label: trans("chart.inside"),
14
+ value: "inside",
15
+ },
16
+ {
17
+ label: trans("chart.slider"),
18
+ value: "slider",
19
+ },
20
+ {
21
+ label: trans("chart.both"),
22
+ value: "both",
23
+ },
24
+ ] as const;
25
+
26
+ export function applyRowLimit(data: JSONObject[], rowLimit: number) {
27
+ if (rowLimit > 0 && data.length > rowLimit) {
28
+ return data.slice(-rowLimit);
29
+ }
30
+ return data;
31
+ }
32
+
33
+ export const RowLimitConfig = new MultiCompBuilder(
34
+ {
35
+ rowLimit: withDefault(NumberControl, 50),
36
+ rowCursor: withDefault(BoolControl, false),
37
+ rowLimitAction: dropdownControl(CursorOptions, "inside"),
38
+ rowLimitMin: withDefault(NumberControl, 80),
39
+ rowLimitMax: withDefault(NumberControl, 100),
40
+ },
41
+ (props) => {
42
+ const { rowLimit, rowLimitMin, rowLimitMax, rowCursor, rowLimitAction } =
43
+ props;
44
+
45
+ // build dataZoom config
46
+ let dataZoom: any[] = [];
47
+ if (rowCursor) {
48
+ if (rowLimitAction === "inside" || rowLimitAction === "slider") {
49
+ dataZoom.push({
50
+ type: rowLimitAction,
51
+ start: rowLimitMin,
52
+ end: rowLimitMax,
53
+ });
54
+ } else if (rowLimitAction === "both") {
55
+ dataZoom = [
56
+ { type: "inside", start: rowLimitMin, end: rowLimitMax },
57
+ { type: "slider", start: rowLimitMin, end: rowLimitMax },
58
+ ];
59
+ }
60
+ }
61
+
62
+ return {
63
+ rowLimit,
64
+ rowCursor,
65
+ dataZoom,
66
+ };
67
+ }
68
+ )
69
+ .setPropertyViewFn((children) => (
70
+ <>
71
+ {children.rowLimit.propertyView({
72
+ label: trans("chart.rowLimit"),
73
+ tooltip: trans("chart.rowLimitTooltip"),
74
+ })}
75
+ {children.rowCursor.propertyView({ label: trans("chart.rowCursor") })}
76
+ {children.rowCursor.getView() && (
77
+ <>
78
+ {children.rowLimitAction.propertyView({
79
+ label: trans("chart.rowLimitAction"),
80
+ })}
81
+ {children.rowLimitMin.propertyView({
82
+ label: trans("chart.rowLimitMin"),
83
+ })}
84
+ {children.rowLimitMax.propertyView({
85
+ label: trans("chart.rowLimitMax"),
86
+ })}
87
+ </>
88
+ )}
89
+ </>
90
+ ))
91
+ .build();
@@ -0,0 +1,22 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { styleControl } from "lowcoder-sdk";
3
+
4
+ export const CompStyles = [
5
+ { name: "margin", label: trans("style.margin"), margin: "margin" },
6
+ { name: "padding", label: trans("style.padding"), padding: "padding" },
7
+ { name: "textSize", label: trans("style.textSize"), textSize: "textSize" },
8
+ {
9
+ name: "backgroundColor",
10
+ label: trans("style.backgroundColor"),
11
+ backgroundColor: "backgroundColor",
12
+ },
13
+ { name: "border", label: trans("style.border"), border: "border" },
14
+ { name: "radius", label: trans("style.borderRadius"), radius: "radius" },
15
+ {
16
+ name: "borderWidth",
17
+ label: trans("style.borderWidth"),
18
+ borderWidth: "borderWidth",
19
+ },
20
+ ] as const;
21
+
22
+ export const StyleControls = styleControl(CompStyles);
@@ -0,0 +1,41 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import dayjs from "dayjs";
3
+ import { dropdownControl, StringControl, withDefault } from "lowcoder-sdk";
4
+
5
+ export const TimeGranularityControl = dropdownControl(
6
+ [
7
+ { label: trans("chart.second"), value: "second" },
8
+ { label: trans("chart.minute"), value: "minute" },
9
+ { label: trans("chart.hour"), value: "hour" },
10
+ { label: trans("chart.day"), value: "day" },
11
+ { label: trans("chart.week"), value: "week" },
12
+ { label: trans("chart.month"), value: "month" },
13
+ { label: trans("chart.quarter"), value: "quarter" },
14
+ { label: trans("chart.year"), value: "year" },
15
+ ],
16
+ "day"
17
+ );
18
+
19
+ export const TimeRangeControl = dropdownControl(
20
+ [
21
+ { label: trans("chart.lastDay"), value: "lastDay" },
22
+ { label: trans("chart.lastWeek"), value: "lastWeek" },
23
+ { label: trans("chart.lastMonth"), value: "lastMonth" },
24
+ { label: trans("chart.lastQuarter"), value: "lastQuarter" },
25
+ { label: trans("chart.lastYear"), value: "lastYear" },
26
+ { label: trans("chart.currentDay"), value: "currentDay" },
27
+ { label: trans("chart.noFilter"), value: "noFilter" },
28
+ { label: trans("chart.custom"), value: "custom" },
29
+ ],
30
+ "noFilter"
31
+ );
32
+
33
+ export const StartTimeControl = withDefault(
34
+ StringControl,
35
+ dayjs().subtract(1, "month").format("DD-MM-YYYY")
36
+ );
37
+
38
+ export const EndTimeControl = withDefault(
39
+ StringControl,
40
+ dayjs().format("DD-MM-YYYY")
41
+ );
@@ -0,0 +1,89 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import {
3
+ ColorControl,
4
+ dropdownControl,
5
+ MultiCompBuilder,
6
+ NumberControl,
7
+ StringControl,
8
+ withDefault,
9
+ } from "lowcoder-sdk";
10
+
11
+ export const TrendlineTypeOptions = [
12
+ {
13
+ label: trans("trendline.exponential"),
14
+ value: "exponential",
15
+ },
16
+ {
17
+ label: trans("trendline.linear"),
18
+ value: "linear",
19
+ },
20
+ {
21
+ label: trans("trendline.logarithmic"),
22
+ value: "logarithmic",
23
+ },
24
+ {
25
+ label: trans("trendline.polynomial"),
26
+ value: "polynomial",
27
+ },
28
+ {
29
+ label: trans("trendline.power"),
30
+ value: "power",
31
+ },
32
+ {
33
+ label: trans("trendline.movingAverage"),
34
+ value: "movingAverage",
35
+ },
36
+ ] as const;
37
+
38
+ const TrendlineControl = new MultiCompBuilder(
39
+ {
40
+ type: dropdownControl(TrendlineTypeOptions, "polynomial"),
41
+ name: StringControl,
42
+ order: withDefault(NumberControl, 2),
43
+ period: withDefault(NumberControl, 2),
44
+ color: ColorControl,
45
+ },
46
+ (props) => ({
47
+ type: props.type,
48
+ name: props.name,
49
+ order: props.order,
50
+ period: props.period,
51
+ color: props.color,
52
+ })
53
+ )
54
+ .setPropertyViewFn((children) => {
55
+ const trendlineType = children.type.getView();
56
+ return (
57
+ <>
58
+ {children.type.propertyView({
59
+ label: trans("trendline.type"),
60
+ radioButton: false,
61
+ })}
62
+
63
+ {trendlineType === "polynomial" &&
64
+ children.order.propertyView({
65
+ label: trans("trendline.order"),
66
+ tooltip: trans("trendline.orderTooltip"),
67
+ })}
68
+
69
+ {trendlineType === "movingAverage" &&
70
+ children.period.propertyView({
71
+ label: trans("trendline.period"),
72
+ tooltip: trans("trendline.periodTooltip"),
73
+ })}
74
+
75
+ {children.name.propertyView({
76
+ label: trans("trendline.name"),
77
+ tooltip: trans("trendline.nameTooltip"),
78
+ })}
79
+
80
+ {children.color.propertyView({
81
+ label: trans("trendline.color"),
82
+ tooltip: trans("trendline.colorTooltip"),
83
+ })}
84
+ </>
85
+ );
86
+ })
87
+ .build();
88
+
89
+ export default TrendlineControl;
@@ -0,0 +1,21 @@
1
+ import { trans } from "@/i18n/comps";
2
+ import { eventHandlerControl } from "lowcoder-sdk";
3
+
4
+ export const UIEventOptions = [
5
+ {
6
+ label: trans("chart.select"),
7
+ value: "select",
8
+ description: trans("chart.selectDesc"),
9
+ },
10
+ {
11
+ label: trans("chart.unSelect"),
12
+ value: "unselect",
13
+ description: trans("chart.unselectDesc"),
14
+ },
15
+ { label: trans("chart.click"), value: "click" },
16
+ { label: trans("chart.select"), value: "select" },
17
+ { label: trans("chart.timeRangeChange"), value: "timeRangeChange" },
18
+ { label: trans("chart.granularityChange"), value: "granularityChange" },
19
+ ] as const;
20
+
21
+ export const UIEventControl = eventHandlerControl(UIEventOptions);
@@ -0,0 +1,16 @@
1
+ export * from "./AnimationsControls";
2
+ export * from "./AutoHeightControl";
3
+ export * from "./AxisControls";
4
+ export * from "./AxisVisibilityControl";
5
+ export * from "./ChartTypeControl";
6
+ export * from "./ColorScaleControl";
7
+ export * from "./ColumnControl";
8
+ export * from "./ConfigControl";
9
+ export * from "./DirectionControls";
10
+ export * from "./LegendControl";
11
+ export * from "./radioControl";
12
+ export * from "./RowLimitControl";
13
+ export * from "./StyleControls";
14
+ export * from "./TimeControls";
15
+ export * from "./TrendlineControl";
16
+ export * from "./UIEventControl";
@@ -0,0 +1,88 @@
1
+ import { Radio, Space } from "antd";
2
+ import { ControlParams, StringControl } from "lowcoder-sdk";
3
+ import { ReactNode } from "react";
4
+
5
+ export type RadioOption<T extends string> = {
6
+ label: string;
7
+ value: T;
8
+ };
9
+
10
+ export type RadioOptions<T extends string> = ReadonlyArray<RadioOption<T>>;
11
+
12
+ export function radioControl<T extends string>(
13
+ options: RadioOptions<T>,
14
+ defaultValue: T
15
+ ) {
16
+ class RadioControl extends StringControl {
17
+ readonly options: RadioOptions<T> = options;
18
+ readonly defaultValue: T = defaultValue;
19
+
20
+ constructor(params: ControlParams) {
21
+ super({
22
+ ...params,
23
+ value: params.value || defaultValue,
24
+ });
25
+ }
26
+
27
+ // Property view method
28
+ propertyView(options: {
29
+ label?: string;
30
+ tooltip?: string;
31
+ radioButton?: boolean;
32
+ direction?: "vertical" | "horizontal";
33
+ type?: "button" | "default";
34
+ disabled?: boolean;
35
+ }): ReactNode {
36
+ const value = this.getView();
37
+ const disabled = options.disabled ?? false;
38
+
39
+ return (
40
+ <div style={{ marginBottom: "16px" }}>
41
+ {options.label && (
42
+ <div style={{ marginBottom: "8px" }}>
43
+ {options.label}
44
+ {options.tooltip && (
45
+ <span
46
+ title={options.tooltip}
47
+ style={{ marginLeft: "4px", cursor: "help" }}
48
+ >
49
+ (ℹ)
50
+ </span>
51
+ )}
52
+ </div>
53
+ )}
54
+ <Radio.Group
55
+ value={value}
56
+ onChange={(e) => this.dispatchChangeValueAction(e.target.value)}
57
+ disabled={disabled}
58
+ optionType={
59
+ options.radioButton ? "button" : options.type || "default"
60
+ }
61
+ buttonStyle="solid"
62
+ >
63
+ <Space direction={options.direction || "horizontal"}>
64
+ {this.options.map((option) => (
65
+ <Radio key={option.value} value={option.value}>
66
+ {option.label}
67
+ </Radio>
68
+ ))}
69
+ </Space>
70
+ </Radio.Group>
71
+ </div>
72
+ );
73
+ }
74
+
75
+ toJsonValue(value: any): string {
76
+ return String(value);
77
+ }
78
+
79
+ fromJsonValue(value: any): string {
80
+ return String(value);
81
+ }
82
+ }
83
+
84
+ return RadioControl as typeof RadioControl & {
85
+ options: RadioOptions<T>;
86
+ defaultValue: T;
87
+ };
88
+ }
@@ -0,0 +1,3 @@
1
+ import { setPoint } from "./setPoint";
2
+
3
+ export const exposingMethods = [setPoint];
@@ -0,0 +1,19 @@
1
+ import { trans } from "@/i18n/comps";
2
+
3
+ export const setPoint = {
4
+ method: {
5
+ name: "setPoint",
6
+ description: trans("methods.setPoint"),
7
+ params: [{ name: "data", type: "JSON", description: "JSON value" }],
8
+ },
9
+ execute: (comp: any, values: any[]) => {
10
+ const point = values[0];
11
+ if (!point.id || !point.x) {
12
+ return Promise.reject("ID and X are required");
13
+ }
14
+ const data = comp.children.data.getView();
15
+ comp.children.data.dispatchChangeValueAction(
16
+ JSON.stringify([...data, point], null, 2)
17
+ );
18
+ },
19
+ };