@nocobase/plugin-charts 0.9.1-alpha.2

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 (139) hide show
  1. package/client.d.ts +4 -0
  2. package/client.js +30 -0
  3. package/lib/client/ChartBlockEngine.d.ts +27 -0
  4. package/lib/client/ChartBlockEngine.js +201 -0
  5. package/lib/client/ChartBlockEngineDesigner.d.ts +3 -0
  6. package/lib/client/ChartBlockEngineDesigner.js +348 -0
  7. package/lib/client/ChartBlockInitializer.d.ts +3 -0
  8. package/lib/client/ChartBlockInitializer.js +324 -0
  9. package/lib/client/ChartQueryBlockInitializer.d.ts +9 -0
  10. package/lib/client/ChartQueryBlockInitializer.js +230 -0
  11. package/lib/client/ChartQueryMetadataProvider.d.ts +10 -0
  12. package/lib/client/ChartQueryMetadataProvider.js +118 -0
  13. package/lib/client/DataSetPreviewTable.d.ts +5 -0
  14. package/lib/client/DataSetPreviewTable.js +127 -0
  15. package/lib/client/Icons.d.ts +1 -0
  16. package/lib/client/Icons.js +226 -0
  17. package/lib/client/chartRenderComponents/index.d.ts +2 -0
  18. package/lib/client/chartRenderComponents/index.js +26 -0
  19. package/lib/client/hooks/index.d.ts +4 -0
  20. package/lib/client/hooks/index.js +52 -0
  21. package/lib/client/index.d.ts +4 -0
  22. package/lib/client/index.js +161 -0
  23. package/lib/client/locale/en-US.d.ts +23 -0
  24. package/lib/client/locale/en-US.js +29 -0
  25. package/lib/client/locale/index.d.ts +3 -0
  26. package/lib/client/locale/index.js +46 -0
  27. package/lib/client/locale/ja-JP.d.ts +2 -0
  28. package/lib/client/locale/ja-JP.js +8 -0
  29. package/lib/client/locale/ru-RU.d.ts +2 -0
  30. package/lib/client/locale/ru-RU.js +8 -0
  31. package/lib/client/locale/tr-TR.d.ts +2 -0
  32. package/lib/client/locale/tr-TR.js +8 -0
  33. package/lib/client/locale/zh-CN.d.ts +61 -0
  34. package/lib/client/locale/zh-CN.js +67 -0
  35. package/lib/client/select/CustomSelect.d.ts +11 -0
  36. package/lib/client/select/CustomSelect.js +193 -0
  37. package/lib/client/select/ReadPretty.d.ts +2 -0
  38. package/lib/client/select/ReadPretty.js +102 -0
  39. package/lib/client/select/index.d.ts +2 -0
  40. package/lib/client/select/index.js +31 -0
  41. package/lib/client/select/shared.d.ts +7 -0
  42. package/lib/client/select/shared.js +86 -0
  43. package/lib/client/settings/AddNewQuery.d.ts +2 -0
  44. package/lib/client/settings/AddNewQuery.js +321 -0
  45. package/lib/client/settings/ConfigureFields.d.ts +1 -0
  46. package/lib/client/settings/ConfigureFields.js +51 -0
  47. package/lib/client/settings/QueriesTable.d.ts +1 -0
  48. package/lib/client/settings/QueriesTable.js +108 -0
  49. package/lib/client/settings/queryTypes.d.ts +5 -0
  50. package/lib/client/settings/queryTypes.js +85 -0
  51. package/lib/client/settings/schemas/chartsQueries.d.ts +8 -0
  52. package/lib/client/settings/schemas/chartsQueries.js +378 -0
  53. package/lib/client/templates/AreaTemplate.d.ts +65 -0
  54. package/lib/client/templates/AreaTemplate.js +86 -0
  55. package/lib/client/templates/BarTemplate.d.ts +80 -0
  56. package/lib/client/templates/BarTemplate.js +103 -0
  57. package/lib/client/templates/ColumnTemplate.d.ts +80 -0
  58. package/lib/client/templates/ColumnTemplate.js +103 -0
  59. package/lib/client/templates/FunnelTemplate.d.ts +66 -0
  60. package/lib/client/templates/FunnelTemplate.js +87 -0
  61. package/lib/client/templates/LineTemplate.d.ts +67 -0
  62. package/lib/client/templates/LineTemplate.js +92 -0
  63. package/lib/client/templates/PieTemplate.d.ts +71 -0
  64. package/lib/client/templates/PieTemplate.js +92 -0
  65. package/lib/client/templates/RadarTemplate.d.ts +71 -0
  66. package/lib/client/templates/RadarTemplate.js +93 -0
  67. package/lib/client/templates/ScatterTemplate.d.ts +91 -0
  68. package/lib/client/templates/ScatterTemplate.js +112 -0
  69. package/lib/client/templates/TableTemplate.d.ts +28 -0
  70. package/lib/client/templates/TableTemplate.js +54 -0
  71. package/lib/client/templates/index.d.ts +1 -0
  72. package/lib/client/templates/index.js +33 -0
  73. package/lib/client/utils.d.ts +3 -0
  74. package/lib/client/utils.js +66 -0
  75. package/lib/index.d.ts +1 -0
  76. package/lib/index.js +15 -0
  77. package/lib/server/actions/chartsQueries.d.ts +3 -0
  78. package/lib/server/actions/chartsQueries.js +104 -0
  79. package/lib/server/actions/index.d.ts +1 -0
  80. package/lib/server/actions/index.js +1 -0
  81. package/lib/server/collections/chartsQueries.d.ts +2 -0
  82. package/lib/server/collections/chartsQueries.js +36 -0
  83. package/lib/server/index.d.ts +1 -0
  84. package/lib/server/index.js +15 -0
  85. package/lib/server/plugin.d.ts +14 -0
  86. package/lib/server/plugin.js +142 -0
  87. package/lib/server/query.d.ts +12 -0
  88. package/lib/server/query.js +91 -0
  89. package/lib/server/shared/index.d.ts +2 -0
  90. package/lib/server/shared/index.js +8 -0
  91. package/package.json +14 -0
  92. package/server.d.ts +4 -0
  93. package/server.js +30 -0
  94. package/src/client/ChartBlockEngine.tsx +120 -0
  95. package/src/client/ChartBlockEngineDesigner.tsx +238 -0
  96. package/src/client/ChartBlockInitializer.tsx +216 -0
  97. package/src/client/ChartQueryBlockInitializer.tsx +136 -0
  98. package/src/client/ChartQueryMetadataProvider.tsx +62 -0
  99. package/src/client/DataSetPreviewTable.tsx +73 -0
  100. package/src/client/Icons.tsx +99 -0
  101. package/src/client/chartRenderComponents/index.ts +7 -0
  102. package/src/client/hooks/index.ts +19 -0
  103. package/src/client/index.tsx +101 -0
  104. package/src/client/locale/en-US.ts +23 -0
  105. package/src/client/locale/index.ts +18 -0
  106. package/src/client/locale/ja-JP.ts +1 -0
  107. package/src/client/locale/ru-RU.ts +1 -0
  108. package/src/client/locale/tr-TR.ts +1 -0
  109. package/src/client/locale/zh-CN.ts +63 -0
  110. package/src/client/select/CustomSelect.tsx +127 -0
  111. package/src/client/select/ReadPretty.tsx +36 -0
  112. package/src/client/select/index.md +38 -0
  113. package/src/client/select/index.ts +2 -0
  114. package/src/client/select/shared.ts +36 -0
  115. package/src/client/settings/AddNewQuery.tsx +161 -0
  116. package/src/client/settings/ConfigureFields.tsx +18 -0
  117. package/src/client/settings/QueriesTable.tsx +26 -0
  118. package/src/client/settings/queryTypes.ts +64 -0
  119. package/src/client/settings/schemas/chartsQueries.ts +319 -0
  120. package/src/client/templates/AreaTemplate.tsx +64 -0
  121. package/src/client/templates/BarTemplate.tsx +80 -0
  122. package/src/client/templates/ColumnTemplate.tsx +81 -0
  123. package/src/client/templates/FunnelTemplate.tsx +65 -0
  124. package/src/client/templates/LineTemplate.tsx +72 -0
  125. package/src/client/templates/PieTemplate.tsx +68 -0
  126. package/src/client/templates/RadarTemplate.tsx +71 -0
  127. package/src/client/templates/ScatterTemplate.tsx +90 -0
  128. package/src/client/templates/TableTemplate.tsx +48 -0
  129. package/src/client/templates/index.ts +21 -0
  130. package/src/client/utils.ts +39 -0
  131. package/src/index.ts +1 -0
  132. package/src/server/actions/chartsQueries.ts +44 -0
  133. package/src/server/actions/index.ts +0 -0
  134. package/src/server/collections/.gitkeep +0 -0
  135. package/src/server/collections/chartsQueries.ts +24 -0
  136. package/src/server/index.ts +1 -0
  137. package/src/server/plugin.ts +61 -0
  138. package/src/server/query.ts +39 -0
  139. package/src/server/shared/index.ts +2 -0
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.lineTemplate = void 0;
7
+
8
+ function _json() {
9
+ const data = _interopRequireDefault(require("json5"));
10
+
11
+ _json = function _json() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ const chartConfig = {
21
+ yField: '{{metric}}',
22
+ xField: '{{dimension}}',
23
+ seriesField: '{{category}}',
24
+ xAxis: {//type: 'time',
25
+ },
26
+ yAxis: {// label: {
27
+ // formatter: '{{(v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`)}}',
28
+ // },
29
+ }
30
+ };
31
+ const lineTemplate = {
32
+ description: '1 「Time」 or 「Order Noun」 field, 1 「Value」 field',
33
+ type: 'Line',
34
+ title: 'Line',
35
+ iconId: 'icon-line',
36
+ group: 2,
37
+ renderComponent: 'G2Plot',
38
+ defaultChartOptions: chartConfig,
39
+ configurableProperties: {
40
+ type: 'void',
41
+ properties: {
42
+ dimension: {
43
+ required: true,
44
+ type: 'string',
45
+ title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
46
+ 'x-decorator': 'FormItem',
47
+ 'x-component': 'Select',
48
+ enum: '{{dataSource}}'
49
+ },
50
+ metric: {
51
+ required: true,
52
+ type: 'string',
53
+ title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
54
+ 'x-decorator': 'FormItem',
55
+ 'x-component': 'Select',
56
+ enum: '{{dataSource}}'
57
+ },
58
+ category: {
59
+ type: 'string',
60
+ title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
61
+ 'x-decorator': 'FormItem',
62
+ 'x-component': 'Select',
63
+ enum: '{{dataSource}}'
64
+ },
65
+ jsonConfig: {
66
+ type: 'void',
67
+ 'x-component': 'div',
68
+ properties: {
69
+ template: {
70
+ required: true,
71
+ title: '{{t("JSON config",{ns:"charts"})}}',
72
+ type: 'string',
73
+ default: _json().default.stringify(chartConfig, null, 2),
74
+ 'x-decorator': 'FormItem',
75
+ 'x-component': 'Input.TextArea',
76
+ 'x-component-props': {
77
+ autoSize: {
78
+ minRows: 8,
79
+ maxRows: 16
80
+ }
81
+ },
82
+ description: '{{jsonConfigDesc("Line | G2Plot","https://g2plot.antv.antgroup.com/api/plots/line")}}',
83
+ 'x-validator': {
84
+ json5: true
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ };
92
+ exports.lineTemplate = lineTemplate;
@@ -0,0 +1,71 @@
1
+ export declare const pieTemplate: {
2
+ description: string;
3
+ title: string;
4
+ type: string;
5
+ iconId: string;
6
+ group: number;
7
+ renderComponent: string;
8
+ defaultChartOptions: {
9
+ appendPadding: number;
10
+ angleField: string;
11
+ colorField: string;
12
+ radius: number;
13
+ label: {
14
+ type: string;
15
+ offset: string;
16
+ content: string;
17
+ style: {
18
+ fontSize: number;
19
+ textAlign: string;
20
+ };
21
+ };
22
+ interactions: {
23
+ type: string;
24
+ }[];
25
+ };
26
+ configurableProperties: {
27
+ type: string;
28
+ properties: {
29
+ dimension: {
30
+ required: boolean;
31
+ type: string;
32
+ title: string;
33
+ 'x-decorator': string;
34
+ 'x-component': string;
35
+ enum: string;
36
+ };
37
+ metric: {
38
+ required: boolean;
39
+ type: string;
40
+ title: string;
41
+ 'x-decorator': string;
42
+ 'x-component': string;
43
+ enum: string;
44
+ };
45
+ jsonConfig: {
46
+ type: string;
47
+ 'x-component': string;
48
+ properties: {
49
+ template: {
50
+ required: boolean;
51
+ title: string;
52
+ type: string;
53
+ default: string;
54
+ 'x-decorator': string;
55
+ 'x-component': string;
56
+ 'x-component-props': {
57
+ autoSize: {
58
+ minRows: number;
59
+ maxRows: number;
60
+ };
61
+ };
62
+ description: string;
63
+ 'x-validator': {
64
+ json5: boolean;
65
+ };
66
+ };
67
+ };
68
+ };
69
+ };
70
+ };
71
+ };
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pieTemplate = void 0;
7
+
8
+ function _json() {
9
+ const data = _interopRequireDefault(require("json5"));
10
+
11
+ _json = function _json() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ const chartConfig = {
21
+ appendPadding: 10,
22
+ angleField: '{{metric}}',
23
+ colorField: '{{dimension}}',
24
+ radius: 0.9,
25
+ label: {
26
+ type: 'inner',
27
+ offset: '-30%',
28
+ content: '{{({percent}) => `${(percent * 100).toFixed(0)}%`}}',
29
+ style: {
30
+ fontSize: 14,
31
+ textAlign: 'center'
32
+ }
33
+ },
34
+ interactions: [{
35
+ type: 'element-active'
36
+ }]
37
+ };
38
+ const pieTemplate = {
39
+ description: '1 「Time」 or 「Order Noun」 field, 1 「Value」 field',
40
+ title: 'Pie',
41
+ type: 'Pie',
42
+ iconId: 'icon-pie',
43
+ group: 2,
44
+ renderComponent: 'G2Plot',
45
+ defaultChartOptions: chartConfig,
46
+ configurableProperties: {
47
+ type: 'void',
48
+ properties: {
49
+ dimension: {
50
+ required: true,
51
+ type: 'string',
52
+ title: '{{t("Sector label / Dimensional",{ns:"charts"})}}',
53
+ 'x-decorator': 'FormItem',
54
+ 'x-component': 'Select',
55
+ enum: '{{dataSource}}'
56
+ },
57
+ metric: {
58
+ required: true,
59
+ type: 'string',
60
+ title: '{{t("Sector Angle / Metric",{ns:"charts"})}}',
61
+ 'x-decorator': 'FormItem',
62
+ 'x-component': 'Select',
63
+ enum: '{{dataSource}}'
64
+ },
65
+ jsonConfig: {
66
+ type: 'void',
67
+ 'x-component': 'div',
68
+ properties: {
69
+ template: {
70
+ required: true,
71
+ title: '{{t("JSON config",{ns:"charts"})}}',
72
+ type: 'string',
73
+ default: _json().default.stringify(chartConfig, null, 2),
74
+ 'x-decorator': 'FormItem',
75
+ 'x-component': 'Input.TextArea',
76
+ 'x-component-props': {
77
+ autoSize: {
78
+ minRows: 8,
79
+ maxRows: 16
80
+ }
81
+ },
82
+ description: '{{jsonConfigDesc("Pie | G2Plot","https://g2plot.antv.antgroup.com/api/plots/pie")}}',
83
+ 'x-validator': {
84
+ json5: true
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ };
92
+ exports.pieTemplate = pieTemplate;
@@ -0,0 +1,71 @@
1
+ export declare const radarTemplate: {
2
+ description: string;
3
+ type: string;
4
+ title: string;
5
+ iconId: string;
6
+ group: number;
7
+ renderComponent: string;
8
+ defaultChartOptions: {
9
+ xField: string;
10
+ yField: string;
11
+ appendPadding: number[];
12
+ xAxis: {
13
+ tickLine: any;
14
+ };
15
+ yAxis: {
16
+ label: boolean;
17
+ grid: {
18
+ alternateColor: string;
19
+ };
20
+ };
21
+ point: {
22
+ size: number;
23
+ };
24
+ area: {};
25
+ };
26
+ configurableProperties: {
27
+ type: string;
28
+ properties: {
29
+ dimension: {
30
+ required: boolean;
31
+ type: string;
32
+ title: string;
33
+ 'x-decorator': string;
34
+ 'x-component': string;
35
+ enum: string;
36
+ };
37
+ metric: {
38
+ required: boolean;
39
+ type: string;
40
+ title: string;
41
+ 'x-decorator': string;
42
+ 'x-component': string;
43
+ enum: string;
44
+ };
45
+ jsonConfig: {
46
+ type: string;
47
+ 'x-component': string;
48
+ properties: {
49
+ template: {
50
+ required: boolean;
51
+ title: string;
52
+ type: string;
53
+ default: string;
54
+ 'x-decorator': string;
55
+ 'x-component': string;
56
+ 'x-component-props': {
57
+ autoSize: {
58
+ minRows: number;
59
+ maxRows: number;
60
+ };
61
+ };
62
+ description: string;
63
+ 'x-validator': {
64
+ json5: boolean;
65
+ };
66
+ };
67
+ };
68
+ };
69
+ };
70
+ };
71
+ };
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.radarTemplate = void 0;
7
+
8
+ function _json() {
9
+ const data = _interopRequireDefault(require("json5"));
10
+
11
+ _json = function _json() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ const chartConfig = {
21
+ xField: '{{dimension}}',
22
+ yField: '{{metric}}',
23
+ appendPadding: [0, 10, 0, 10],
24
+ xAxis: {
25
+ tickLine: null
26
+ },
27
+ yAxis: {
28
+ label: false,
29
+ grid: {
30
+ alternateColor: 'rgba(0, 0, 0, 0.04)'
31
+ }
32
+ },
33
+ // 开启辅助点
34
+ point: {
35
+ size: 2
36
+ },
37
+ area: {}
38
+ };
39
+ const radarTemplate = {
40
+ description: '1~ 2 「Unordered Noun」 fields, 1 「Numeric」 field',
41
+ type: 'Radar',
42
+ title: 'Radar',
43
+ iconId: 'icon-radar',
44
+ group: 1,
45
+ renderComponent: 'G2Plot',
46
+ defaultChartOptions: chartConfig,
47
+ configurableProperties: {
48
+ type: 'void',
49
+ properties: {
50
+ dimension: {
51
+ required: true,
52
+ type: 'string',
53
+ title: '{{t("Branch Tags/Dimensions",{ns:"charts"})}}',
54
+ 'x-decorator': 'FormItem',
55
+ 'x-component': 'Select',
56
+ enum: '{{dataSource}}'
57
+ },
58
+ metric: {
59
+ required: true,
60
+ type: 'string',
61
+ title: '{{t("Branch Length/Metrics",{ns:"charts"})}}',
62
+ 'x-decorator': 'FormItem',
63
+ 'x-component': 'Select',
64
+ enum: '{{dataSource}}'
65
+ },
66
+ jsonConfig: {
67
+ type: 'void',
68
+ 'x-component': 'div',
69
+ properties: {
70
+ template: {
71
+ required: true,
72
+ title: '{{t("JSON config",{ns:"charts"})}}',
73
+ type: 'string',
74
+ default: _json().default.stringify(chartConfig, null, 2),
75
+ 'x-decorator': 'FormItem',
76
+ 'x-component': 'Input.TextArea',
77
+ 'x-component-props': {
78
+ autoSize: {
79
+ minRows: 8,
80
+ maxRows: 16
81
+ }
82
+ },
83
+ description: '{{jsonConfigDesc("Radar | G2Plot","https://g2plot.antv.antgroup.com/api/plots/radar")}}',
84
+ 'x-validator': {
85
+ json5: true
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ };
93
+ exports.radarTemplate = radarTemplate;
@@ -0,0 +1,91 @@
1
+ export declare const scatterTemplate: {
2
+ description: string;
3
+ type: string;
4
+ title: string;
5
+ iconId: string;
6
+ group: number;
7
+ renderComponent: string;
8
+ defaultChartOptions: {
9
+ appendPadding: number;
10
+ xField: string;
11
+ yField: string;
12
+ colorField: string;
13
+ shape: string;
14
+ size: number;
15
+ yAxis: {
16
+ nice: boolean;
17
+ line: {
18
+ style: {
19
+ stroke: string;
20
+ };
21
+ };
22
+ };
23
+ xAxis: {
24
+ min: number;
25
+ grid: {
26
+ line: {
27
+ style: {
28
+ stroke: string;
29
+ };
30
+ };
31
+ };
32
+ line: {
33
+ style: {
34
+ stroke: string;
35
+ };
36
+ };
37
+ };
38
+ };
39
+ configurableProperties: {
40
+ type: string;
41
+ properties: {
42
+ dimension: {
43
+ required: boolean;
44
+ type: string;
45
+ title: string;
46
+ 'x-decorator': string;
47
+ 'x-component': string;
48
+ enum: string;
49
+ };
50
+ metric: {
51
+ required: boolean;
52
+ type: string;
53
+ title: string;
54
+ 'x-decorator': string;
55
+ 'x-component': string;
56
+ enum: string;
57
+ };
58
+ category: {
59
+ type: string;
60
+ title: string;
61
+ 'x-decorator': string;
62
+ 'x-component': string;
63
+ enum: string;
64
+ };
65
+ jsonConfig: {
66
+ type: string;
67
+ 'x-component': string;
68
+ properties: {
69
+ template: {
70
+ required: boolean;
71
+ title: string;
72
+ type: string;
73
+ default: string;
74
+ 'x-decorator': string;
75
+ 'x-component': string;
76
+ 'x-component-props': {
77
+ autoSize: {
78
+ minRows: number;
79
+ maxRows: number;
80
+ };
81
+ };
82
+ description: string;
83
+ 'x-validator': {
84
+ json5: boolean;
85
+ };
86
+ };
87
+ };
88
+ };
89
+ };
90
+ };
91
+ };
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.scatterTemplate = void 0;
7
+
8
+ function _json() {
9
+ const data = _interopRequireDefault(require("json5"));
10
+
11
+ _json = function _json() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ const chartConfig = {
21
+ appendPadding: 10,
22
+ xField: '{{metric}}',
23
+ yField: '{{dimension}}',
24
+ colorField: '{{category}}',
25
+ shape: 'circle',
26
+ size: 4,
27
+ yAxis: {
28
+ nice: true,
29
+ line: {
30
+ style: {
31
+ stroke: '#aaa'
32
+ }
33
+ }
34
+ },
35
+ xAxis: {
36
+ min: -100,
37
+ grid: {
38
+ line: {
39
+ style: {
40
+ stroke: '#eee'
41
+ }
42
+ }
43
+ },
44
+ line: {
45
+ style: {
46
+ stroke: '#aaa'
47
+ }
48
+ }
49
+ }
50
+ };
51
+ const scatterTemplate = {
52
+ description: '1 「Numeric」 field, 0~ 1 「Unordered Noun」 field',
53
+ type: 'Scatter',
54
+ title: 'Scatter',
55
+ iconId: 'icon-scatter',
56
+ group: 2,
57
+ renderComponent: 'G2Plot',
58
+ defaultChartOptions: chartConfig,
59
+ configurableProperties: {
60
+ type: 'void',
61
+ properties: {
62
+ dimension: {
63
+ required: true,
64
+ type: 'string',
65
+ title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
66
+ 'x-decorator': 'FormItem',
67
+ 'x-component': 'Select',
68
+ enum: '{{dataSource}}'
69
+ },
70
+ metric: {
71
+ required: true,
72
+ type: 'string',
73
+ title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
74
+ 'x-decorator': 'FormItem',
75
+ 'x-component': 'Select',
76
+ enum: '{{dataSource}}'
77
+ },
78
+ category: {
79
+ type: 'string',
80
+ title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
81
+ 'x-decorator': 'FormItem',
82
+ 'x-component': 'Select',
83
+ enum: '{{dataSource}}'
84
+ },
85
+ jsonConfig: {
86
+ type: 'void',
87
+ 'x-component': 'div',
88
+ properties: {
89
+ template: {
90
+ required: true,
91
+ title: '{{t("JSON config",{ns:"charts"})}}',
92
+ type: 'string',
93
+ default: _json().default.stringify(chartConfig, null, 2),
94
+ 'x-decorator': 'FormItem',
95
+ 'x-component': 'Input.TextArea',
96
+ 'x-component-props': {
97
+ autoSize: {
98
+ minRows: 8,
99
+ maxRows: 16
100
+ }
101
+ },
102
+ description: '{{jsonConfigDesc("Scatter | G2Plot","https://g2plot.antv.antgroup.com/api/plots/scatter")}}',
103
+ 'x-validator': {
104
+ json5: true
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ }
111
+ };
112
+ exports.scatterTemplate = scatterTemplate;
@@ -0,0 +1,28 @@
1
+ export declare const tableTemplate: {
2
+ title: string;
3
+ type: string;
4
+ group: number;
5
+ renderComponent: string;
6
+ defaultChartOptions: {
7
+ appendPadding: number;
8
+ angleField: string;
9
+ colorField: string;
10
+ radius: number;
11
+ label: {
12
+ type: string;
13
+ offset: string;
14
+ content: string;
15
+ style: {
16
+ fontSize: number;
17
+ textAlign: string;
18
+ };
19
+ };
20
+ interactions: {
21
+ type: string;
22
+ }[];
23
+ };
24
+ configurableProperties: {
25
+ type: string;
26
+ properties: {};
27
+ };
28
+ };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tableTemplate = void 0;
7
+ const validateJSON = {
8
+ validator: `{{(value, rule)=> {
9
+ if (!value) {
10
+ return '';
11
+ }
12
+ try {
13
+ const val = JSON5.parse(value);
14
+ if(!isNaN(val)) {
15
+ return false;
16
+ }
17
+ return true;
18
+ } catch(error) {
19
+ console.error(error);
20
+ return false;
21
+ }
22
+ }}}`,
23
+ message: '{{t("Invalid JSON format",{ ns: "charts" })}}'
24
+ };
25
+ const chartConfig = {
26
+ appendPadding: 10,
27
+ angleField: '{{metric}}',
28
+ colorField: '{{dimension}}',
29
+ radius: 0.9,
30
+ label: {
31
+ type: 'inner',
32
+ offset: '-30%',
33
+ content: '{{({percent}) => `${(percent * 100).toFixed(0)}%`}}',
34
+ style: {
35
+ fontSize: 14,
36
+ textAlign: 'center'
37
+ }
38
+ },
39
+ interactions: [{
40
+ type: 'element-active'
41
+ }]
42
+ };
43
+ const tableTemplate = {
44
+ title: '表格展示',
45
+ type: 'DataSetPreviewTable',
46
+ group: 2,
47
+ renderComponent: 'DataSetPreviewTable',
48
+ defaultChartOptions: chartConfig,
49
+ configurableProperties: {
50
+ type: 'void',
51
+ properties: {}
52
+ }
53
+ };
54
+ exports.tableTemplate = tableTemplate;