@nocobase/plugin-charts 0.11.1-alpha.5 → 0.12.0-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 (180) hide show
  1. package/client.d.ts +2 -3
  2. package/client.js +1 -1
  3. package/{lib → dist}/client/index.d.ts +1 -0
  4. package/dist/client/index.js +3234 -0
  5. package/{lib → dist}/index.d.ts +1 -0
  6. package/dist/index.js +18 -0
  7. package/dist/locale/en-US.js +26 -0
  8. package/{src/locale/es-ES.ts → dist/locale/es-ES.js} +22 -18
  9. package/dist/locale/fr-FR.js +5 -0
  10. package/dist/locale/ja-JP.js +5 -0
  11. package/dist/locale/pt-BR.js +26 -0
  12. package/dist/locale/ru-RU.js +5 -0
  13. package/dist/locale/tr-TR.js +5 -0
  14. package/dist/locale/zh-CN.js +65 -0
  15. package/dist/node_modules/json5/dist/index.js +1737 -0
  16. package/dist/node_modules/json5/dist/index.min.js +1 -0
  17. package/dist/node_modules/json5/lib/cli.js +152 -0
  18. package/dist/node_modules/json5/lib/index.d.ts +4 -0
  19. package/dist/node_modules/json5/lib/index.js +1 -0
  20. package/dist/node_modules/json5/lib/parse.d.ts +15 -0
  21. package/dist/node_modules/json5/lib/parse.js +1114 -0
  22. package/dist/node_modules/json5/lib/register.js +13 -0
  23. package/dist/node_modules/json5/lib/require.js +4 -0
  24. package/dist/node_modules/json5/lib/stringify.d.ts +89 -0
  25. package/dist/node_modules/json5/lib/stringify.js +261 -0
  26. package/dist/node_modules/json5/lib/unicode.d.ts +3 -0
  27. package/dist/node_modules/json5/lib/unicode.js +4 -0
  28. package/dist/node_modules/json5/lib/util.d.ts +5 -0
  29. package/dist/node_modules/json5/lib/util.js +35 -0
  30. package/dist/node_modules/json5/package.json +1 -0
  31. package/dist/server/actions/chartsQueries.js +57 -0
  32. package/dist/server/actions/index.js +2 -0
  33. package/dist/server/collections/chartsQueries.js +30 -0
  34. package/dist/server/index.js +11 -0
  35. package/dist/server/plugin.js +66 -0
  36. package/dist/server/query.js +39 -0
  37. package/dist/server/shared/index.js +5 -0
  38. package/package.json +17 -28
  39. package/server.d.ts +2 -3
  40. package/server.js +1 -1
  41. package/lib/client/ChartBlockEngine.js +0 -146
  42. package/lib/client/ChartBlockEngineDesigner.js +0 -293
  43. package/lib/client/ChartBlockInitializer.js +0 -263
  44. package/lib/client/ChartQueryBlockInitializer.js +0 -191
  45. package/lib/client/ChartQueryMetadataProvider.js +0 -91
  46. package/lib/client/DataSetPreviewTable.js +0 -113
  47. package/lib/client/Icons.js +0 -210
  48. package/lib/client/chartRenderComponents/index.js +0 -20
  49. package/lib/client/hooks/index.js +0 -38
  50. package/lib/client/index.js +0 -143
  51. package/lib/client/locale/index.js +0 -37
  52. package/lib/client/select/CustomSelect.js +0 -148
  53. package/lib/client/select/ReadPretty.js +0 -77
  54. package/lib/client/select/index.js +0 -27
  55. package/lib/client/select/shared.js +0 -66
  56. package/lib/client/settings/AddNewQuery.js +0 -270
  57. package/lib/client/settings/ConfigureFields.js +0 -39
  58. package/lib/client/settings/QueriesTable.js +0 -77
  59. package/lib/client/settings/queryTypes.js +0 -77
  60. package/lib/client/settings/schemas/chartsQueries.js +0 -353
  61. package/lib/client/templates/AreaTemplate.js +0 -81
  62. package/lib/client/templates/BarTemplate.js +0 -98
  63. package/lib/client/templates/ColumnTemplate.js +0 -98
  64. package/lib/client/templates/FunnelTemplate.js +0 -82
  65. package/lib/client/templates/LineTemplate.js +0 -89
  66. package/lib/client/templates/PieTemplate.js +0 -87
  67. package/lib/client/templates/RadarTemplate.js +0 -88
  68. package/lib/client/templates/ScatterTemplate.js +0 -107
  69. package/lib/client/templates/TableTemplate.js +0 -54
  70. package/lib/client/templates/index.js +0 -25
  71. package/lib/client/utils.js +0 -50
  72. package/lib/index.js +0 -13
  73. package/lib/locale/en-US.js +0 -29
  74. package/lib/locale/es-ES.js +0 -59
  75. package/lib/locale/fr-FR.js +0 -8
  76. package/lib/locale/ja-JP.js +0 -8
  77. package/lib/locale/pt-BR.js +0 -29
  78. package/lib/locale/ru-RU.js +0 -8
  79. package/lib/locale/tr-TR.js +0 -8
  80. package/lib/locale/zh-CN.js +0 -68
  81. package/lib/server/actions/chartsQueries.js +0 -89
  82. package/lib/server/actions/index.js +0 -1
  83. package/lib/server/collections/chartsQueries.js +0 -33
  84. package/lib/server/index.js +0 -13
  85. package/lib/server/plugin.js +0 -106
  86. package/lib/server/query.js +0 -71
  87. package/lib/server/shared/index.js +0 -8
  88. package/src/client/ChartBlockEngine.tsx +0 -121
  89. package/src/client/ChartBlockEngineDesigner.tsx +0 -248
  90. package/src/client/ChartBlockInitializer.tsx +0 -223
  91. package/src/client/ChartQueryBlockInitializer.tsx +0 -156
  92. package/src/client/ChartQueryMetadataProvider.tsx +0 -64
  93. package/src/client/DataSetPreviewTable.tsx +0 -71
  94. package/src/client/Icons.tsx +0 -99
  95. package/src/client/chartRenderComponents/index.ts +0 -7
  96. package/src/client/hooks/index.ts +0 -19
  97. package/src/client/index.tsx +0 -115
  98. package/src/client/locale/index.ts +0 -18
  99. package/src/client/select/CustomSelect.tsx +0 -126
  100. package/src/client/select/ReadPretty.tsx +0 -39
  101. package/src/client/select/index.md +0 -31
  102. package/src/client/select/index.ts +0 -2
  103. package/src/client/select/shared.ts +0 -37
  104. package/src/client/settings/AddNewQuery.tsx +0 -176
  105. package/src/client/settings/ConfigureFields.tsx +0 -18
  106. package/src/client/settings/QueriesTable.tsx +0 -26
  107. package/src/client/settings/queryTypes.ts +0 -65
  108. package/src/client/settings/schemas/chartsQueries.ts +0 -319
  109. package/src/client/templates/AreaTemplate.tsx +0 -64
  110. package/src/client/templates/BarTemplate.tsx +0 -80
  111. package/src/client/templates/ColumnTemplate.tsx +0 -81
  112. package/src/client/templates/FunnelTemplate.tsx +0 -65
  113. package/src/client/templates/LineTemplate.tsx +0 -72
  114. package/src/client/templates/PieTemplate.tsx +0 -68
  115. package/src/client/templates/RadarTemplate.tsx +0 -71
  116. package/src/client/templates/ScatterTemplate.tsx +0 -90
  117. package/src/client/templates/TableTemplate.tsx +0 -48
  118. package/src/client/templates/index.ts +0 -21
  119. package/src/client/utils.ts +0 -39
  120. package/src/index.ts +0 -1
  121. package/src/locale/en-US.ts +0 -23
  122. package/src/locale/fr-FR.ts +0 -1
  123. package/src/locale/ja-JP.ts +0 -1
  124. package/src/locale/pt-BR.ts +0 -23
  125. package/src/locale/ru-RU.ts +0 -1
  126. package/src/locale/tr-TR.ts +0 -1
  127. package/src/locale/zh-CN.ts +0 -64
  128. package/src/server/actions/chartsQueries.ts +0 -49
  129. package/src/server/actions/index.ts +0 -0
  130. package/src/server/collections/.gitkeep +0 -0
  131. package/src/server/collections/chartsQueries.ts +0 -26
  132. package/src/server/index.ts +0 -1
  133. package/src/server/plugin.ts +0 -61
  134. package/src/server/query.ts +0 -39
  135. package/src/server/shared/index.ts +0 -2
  136. /package/{lib → dist}/client/ChartBlockEngine.d.ts +0 -0
  137. /package/{lib → dist}/client/ChartBlockEngineDesigner.d.ts +0 -0
  138. /package/{lib → dist}/client/ChartBlockInitializer.d.ts +0 -0
  139. /package/{lib → dist}/client/ChartQueryBlockInitializer.d.ts +0 -0
  140. /package/{lib → dist}/client/ChartQueryMetadataProvider.d.ts +0 -0
  141. /package/{lib → dist}/client/DataSetPreviewTable.d.ts +0 -0
  142. /package/{lib → dist}/client/Icons.d.ts +0 -0
  143. /package/{lib → dist}/client/chartRenderComponents/index.d.ts +0 -0
  144. /package/{lib → dist}/client/hooks/index.d.ts +0 -0
  145. /package/{lib → dist}/client/locale/index.d.ts +0 -0
  146. /package/{lib → dist}/client/select/CustomSelect.d.ts +0 -0
  147. /package/{lib → dist}/client/select/ReadPretty.d.ts +0 -0
  148. /package/{lib → dist}/client/select/index.d.ts +0 -0
  149. /package/{lib → dist}/client/select/shared.d.ts +0 -0
  150. /package/{lib → dist}/client/settings/AddNewQuery.d.ts +0 -0
  151. /package/{lib → dist}/client/settings/ConfigureFields.d.ts +0 -0
  152. /package/{lib → dist}/client/settings/QueriesTable.d.ts +0 -0
  153. /package/{lib → dist}/client/settings/queryTypes.d.ts +0 -0
  154. /package/{lib → dist}/client/settings/schemas/chartsQueries.d.ts +0 -0
  155. /package/{lib → dist}/client/templates/AreaTemplate.d.ts +0 -0
  156. /package/{lib → dist}/client/templates/BarTemplate.d.ts +0 -0
  157. /package/{lib → dist}/client/templates/ColumnTemplate.d.ts +0 -0
  158. /package/{lib → dist}/client/templates/FunnelTemplate.d.ts +0 -0
  159. /package/{lib → dist}/client/templates/LineTemplate.d.ts +0 -0
  160. /package/{lib → dist}/client/templates/PieTemplate.d.ts +0 -0
  161. /package/{lib → dist}/client/templates/RadarTemplate.d.ts +0 -0
  162. /package/{lib → dist}/client/templates/ScatterTemplate.d.ts +0 -0
  163. /package/{lib → dist}/client/templates/TableTemplate.d.ts +0 -0
  164. /package/{lib → dist}/client/templates/index.d.ts +0 -0
  165. /package/{lib → dist}/client/utils.d.ts +0 -0
  166. /package/{lib → dist}/locale/en-US.d.ts +0 -0
  167. /package/{lib → dist}/locale/es-ES.d.ts +0 -0
  168. /package/{lib → dist}/locale/fr-FR.d.ts +0 -0
  169. /package/{lib → dist}/locale/ja-JP.d.ts +0 -0
  170. /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
  171. /package/{lib → dist}/locale/ru-RU.d.ts +0 -0
  172. /package/{lib → dist}/locale/tr-TR.d.ts +0 -0
  173. /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
  174. /package/{lib → dist}/server/actions/chartsQueries.d.ts +0 -0
  175. /package/{lib → dist}/server/actions/index.d.ts +0 -0
  176. /package/{lib → dist}/server/collections/chartsQueries.d.ts +0 -0
  177. /package/{lib → dist}/server/index.d.ts +0 -0
  178. /package/{lib → dist}/server/plugin.d.ts +0 -0
  179. /package/{lib → dist}/server/query.d.ts +0 -0
  180. /package/{lib → dist}/server/shared/index.d.ts +0 -0
@@ -1,80 +0,0 @@
1
- import JSON5 from 'json5';
2
-
3
- const chartConfig = {
4
- appendPadding: 10,
5
- isGroup: true,
6
- yField: '{{dimension}}',
7
- xField: '{{metric}}',
8
- seriesField: '{{category}}',
9
- label: {
10
- // 可手动配置 label 数据标签位置
11
- position: 'middle', // 'top', 'bottom', 'middle',
12
- // 配置样式
13
- style: {
14
- fill: '#FFFFFF',
15
- opacity: 0.6,
16
- },
17
- },
18
- xAxis: {
19
- label: {
20
- autoHide: true,
21
- autoRotate: false,
22
- },
23
- },
24
- };
25
- export const barTemplate = {
26
- description: '1 「time」 or 「ordered noun」 field, 1 「value」 field, 0~ 1 「unordered noun」',
27
- type: 'Bar',
28
- title: 'Bar',
29
- iconId: 'icon-bar',
30
- group: 2,
31
- renderComponent: 'G2Plot',
32
- defaultChartOptions: chartConfig,
33
- configurableProperties: {
34
- type: 'void',
35
- properties: {
36
- dimension: {
37
- required: true,
38
- type: 'string',
39
- title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
40
- 'x-decorator': 'FormItem',
41
- 'x-component': 'Select',
42
- enum: '{{dataSource}}',
43
- },
44
- metric: {
45
- required: true,
46
- type: 'string',
47
- title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
48
- 'x-decorator': 'FormItem',
49
- 'x-component': 'Select',
50
- enum: '{{dataSource}}',
51
- },
52
- category: {
53
- type: 'string',
54
- title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
55
- 'x-decorator': 'FormItem',
56
- 'x-component': 'Select',
57
- enum: '{{dataSource}}',
58
- },
59
- jsonConfig: {
60
- type: 'void',
61
- 'x-component': 'div',
62
- properties: {
63
- template: {
64
- required: true,
65
- title: '{{t("JSON config",{ns:"charts"})}}',
66
- type: 'string',
67
- default: JSON5.stringify(chartConfig, null, 2),
68
- 'x-decorator': 'FormItem',
69
- 'x-component': 'Input.TextArea',
70
- 'x-component-props': {
71
- autoSize: { minRows: 8, maxRows: 16 },
72
- },
73
- description: '{{jsonConfigDesc("Bar | G2Plot","https://g2plot.antv.antgroup.com/api/plots/bar")}}',
74
- 'x-validator': { json5: true },
75
- },
76
- },
77
- },
78
- },
79
- },
80
- };
@@ -1,81 +0,0 @@
1
- import JSON5 from 'json5';
2
-
3
- const chartConfig = {
4
- appendPadding: 10,
5
- isGroup: true,
6
- yField: '{{metric}}',
7
- xField: '{{dimension}}',
8
- seriesField: '{{category}}',
9
- label: {
10
- // 可手动配置 label 数据标签位置
11
- position: 'middle', // 'top', 'bottom', 'middle',
12
- // 配置样式
13
- style: {
14
- fill: '#FFFFFF',
15
- opacity: 0.6,
16
- },
17
- },
18
- xAxis: {
19
- label: {
20
- autoHide: true,
21
- autoRotate: false,
22
- },
23
- },
24
- };
25
-
26
- export const columnTemplate = {
27
- description: '1 「time」 or 「ordered noun」 field, 1 「value」 field, 0 to 1 「unordered noun」',
28
- type: 'Column',
29
- title: 'Column',
30
- iconId: 'icon-column',
31
- group: 2,
32
- renderComponent: 'G2Plot',
33
- defaultChartOptions: chartConfig,
34
- configurableProperties: {
35
- type: 'void',
36
- properties: {
37
- dimension: {
38
- required: true,
39
- type: 'string',
40
- title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
41
- 'x-decorator': 'FormItem',
42
- 'x-component': 'Select',
43
- enum: '{{dataSource}}',
44
- },
45
- metric: {
46
- required: true,
47
- type: 'string',
48
- title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
49
- 'x-decorator': 'FormItem',
50
- 'x-component': 'Select',
51
- enum: '{{dataSource}}',
52
- },
53
- category: {
54
- type: 'string',
55
- title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
56
- 'x-decorator': 'FormItem',
57
- 'x-component': 'Select',
58
- enum: '{{dataSource}}',
59
- },
60
- jsonConfig: {
61
- type: 'void',
62
- 'x-component': 'div',
63
- properties: {
64
- template: {
65
- required: true,
66
- title: '{{t("JSON config",{ns:"charts"})}}',
67
- type: 'string',
68
- default: JSON5.stringify(chartConfig, null, 2),
69
- 'x-decorator': 'FormItem',
70
- 'x-component': 'Input.TextArea',
71
- 'x-component-props': {
72
- autoSize: { minRows: 8, maxRows: 16 },
73
- },
74
- description: '{{jsonConfigDesc("Column | G2Plot","https://g2plot.antv.antgroup.com/api/plots/column")}}',
75
- 'x-validator': { json5: true },
76
- },
77
- },
78
- },
79
- },
80
- },
81
- };
@@ -1,65 +0,0 @@
1
- import JSON5 from 'json5';
2
-
3
- const chartConfig = {
4
- xField: '{{dimension}}',
5
- yField: '{{metric}}',
6
- seriesField: '{{category}}',
7
- legend: false,
8
- };
9
-
10
- export const funnelTemplate = {
11
- description: '1 「Unordered Noun」 field, 1 「Numeric」 field',
12
- type: 'Funnel',
13
- title: 'Funnel',
14
- iconId: 'icon-funnel',
15
- group: 1,
16
- renderComponent: 'G2Plot',
17
- defaultChartOptions: chartConfig,
18
- configurableProperties: {
19
- type: 'void',
20
- properties: {
21
- dimension: {
22
- required: true,
23
- type: 'string',
24
- title: '{{t("Sector label / Dimensional",{ns:"charts"})}}',
25
- 'x-decorator': 'FormItem',
26
- 'x-component': 'Select',
27
- enum: '{{dataSource}}',
28
- },
29
- metric: {
30
- required: true,
31
- type: 'string',
32
- title: '{{t("Funnel Layer Width/Metrics",{ns:"charts"})}}',
33
- 'x-decorator': 'FormItem',
34
- 'x-component': 'Select',
35
- enum: '{{dataSource}}',
36
- },
37
- category: {
38
- type: 'string',
39
- title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
40
- 'x-decorator': 'FormItem',
41
- 'x-component': 'Select',
42
- enum: '{{dataSource}}',
43
- },
44
- jsonConfig: {
45
- type: 'void',
46
- 'x-component': 'div',
47
- properties: {
48
- template: {
49
- required: true,
50
- title: '{{t("JSON config",{ns:"charts"})}}',
51
- type: 'string',
52
- default: JSON5.stringify(chartConfig, null, 2),
53
- 'x-decorator': 'FormItem',
54
- 'x-component': 'Input.TextArea',
55
- 'x-component-props': {
56
- autoSize: { minRows: 8, maxRows: 16 },
57
- },
58
- description: '{{jsonConfigDesc("Funnel | G2Plot","https://g2plot.antv.antgroup.com/api/plots/funnel")}}',
59
- 'x-validator': { json5: true },
60
- },
61
- },
62
- },
63
- },
64
- },
65
- };
@@ -1,72 +0,0 @@
1
- import JSON5 from 'json5';
2
-
3
- const chartConfig = {
4
- yField: '{{metric}}',
5
- xField: '{{dimension}}',
6
- seriesField: '{{category}}',
7
- xAxis: {
8
- //type: 'time',
9
- },
10
- yAxis: {
11
- // label: {
12
- // formatter: '{{(v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`)}}',
13
- // },
14
- },
15
- };
16
-
17
- export const lineTemplate = {
18
- description: '1 「Time」 or 「Order Noun」 field, 1 「Value」 field',
19
- type: 'Line',
20
- title: 'Line',
21
- iconId: 'icon-line',
22
- group: 2,
23
- renderComponent: 'G2Plot',
24
- defaultChartOptions: chartConfig,
25
- configurableProperties: {
26
- type: 'void',
27
- properties: {
28
- dimension: {
29
- required: true,
30
- type: 'string',
31
- title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
32
- 'x-decorator': 'FormItem',
33
- 'x-component': 'Select',
34
- enum: '{{dataSource}}',
35
- },
36
- metric: {
37
- required: true,
38
- type: 'string',
39
- title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
40
- 'x-decorator': 'FormItem',
41
- 'x-component': 'Select',
42
- enum: '{{dataSource}}',
43
- },
44
- category: {
45
- type: 'string',
46
- title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
47
- 'x-decorator': 'FormItem',
48
- 'x-component': 'Select',
49
- enum: '{{dataSource}}',
50
- },
51
- jsonConfig: {
52
- type: 'void',
53
- 'x-component': 'div',
54
- properties: {
55
- template: {
56
- required: true,
57
- title: '{{t("JSON config",{ns:"charts"})}}',
58
- type: 'string',
59
- default: JSON5.stringify(chartConfig, null, 2),
60
- 'x-decorator': 'FormItem',
61
- 'x-component': 'Input.TextArea',
62
- 'x-component-props': {
63
- autoSize: { minRows: 8, maxRows: 16 },
64
- },
65
- description: '{{jsonConfigDesc("Line | G2Plot","https://g2plot.antv.antgroup.com/api/plots/line")}}',
66
- 'x-validator': { json5: true },
67
- },
68
- },
69
- },
70
- },
71
- },
72
- };
@@ -1,68 +0,0 @@
1
- import JSON5 from 'json5';
2
-
3
- const chartConfig = {
4
- appendPadding: 10,
5
- angleField: '{{metric}}',
6
- colorField: '{{dimension}}',
7
- radius: 0.9,
8
- label: {
9
- type: 'inner',
10
- offset: '-30%',
11
- content: '{{({percent}) => `${(percent * 100).toFixed(0)}%`}}',
12
- style: {
13
- fontSize: 14,
14
- textAlign: 'center',
15
- },
16
- },
17
- interactions: [{ type: 'element-active' }],
18
- };
19
-
20
- export const pieTemplate = {
21
- description: '1 「Time」 or 「Order Noun」 field, 1 「Value」 field',
22
- title: 'Pie',
23
- type: 'Pie',
24
- iconId: 'icon-pie',
25
- group: 2,
26
- renderComponent: 'G2Plot',
27
- defaultChartOptions: chartConfig,
28
- configurableProperties: {
29
- type: 'void',
30
- properties: {
31
- dimension: {
32
- required: true,
33
- type: 'string',
34
- title: '{{t("Sector label / Dimensional",{ns:"charts"})}}',
35
- 'x-decorator': 'FormItem',
36
- 'x-component': 'Select',
37
- enum: '{{dataSource}}',
38
- },
39
- metric: {
40
- required: true,
41
- type: 'string',
42
- title: '{{t("Sector Angle / Metric",{ns:"charts"})}}',
43
- 'x-decorator': 'FormItem',
44
- 'x-component': 'Select',
45
- enum: '{{dataSource}}',
46
- },
47
- jsonConfig: {
48
- type: 'void',
49
- 'x-component': 'div',
50
- properties: {
51
- template: {
52
- required: true,
53
- title: '{{t("JSON config",{ns:"charts"})}}',
54
- type: 'string',
55
- default: JSON5.stringify(chartConfig, null, 2),
56
- 'x-decorator': 'FormItem',
57
- 'x-component': 'Input.TextArea',
58
- 'x-component-props': {
59
- autoSize: { minRows: 8, maxRows: 16 },
60
- },
61
- description: '{{jsonConfigDesc("Pie | G2Plot","https://g2plot.antv.antgroup.com/api/plots/pie")}}',
62
- 'x-validator': { json5: true },
63
- },
64
- },
65
- },
66
- },
67
- },
68
- };
@@ -1,71 +0,0 @@
1
- import JSON5 from 'json5';
2
-
3
- const chartConfig = {
4
- xField: '{{dimension}}',
5
- yField: '{{metric}}',
6
- appendPadding: [0, 10, 0, 10],
7
- xAxis: {
8
- tickLine: null,
9
- },
10
- yAxis: {
11
- label: false,
12
- grid: {
13
- alternateColor: 'rgba(0, 0, 0, 0.04)',
14
- },
15
- },
16
- // 开启辅助点
17
- point: {
18
- size: 2,
19
- },
20
- area: {},
21
- };
22
-
23
- export const radarTemplate = {
24
- description: '1~ 2 「Unordered Noun」 fields, 1 「Numeric」 field',
25
- type: 'Radar',
26
- title: 'Radar',
27
- iconId: 'icon-radar',
28
- group: 1,
29
- renderComponent: 'G2Plot',
30
- defaultChartOptions: chartConfig,
31
- configurableProperties: {
32
- type: 'void',
33
- properties: {
34
- dimension: {
35
- required: true,
36
- type: 'string',
37
- title: '{{t("Branch Tags/Dimensions",{ns:"charts"})}}',
38
- 'x-decorator': 'FormItem',
39
- 'x-component': 'Select',
40
- enum: '{{dataSource}}',
41
- },
42
- metric: {
43
- required: true,
44
- type: 'string',
45
- title: '{{t("Branch Length/Metrics",{ns:"charts"})}}',
46
- 'x-decorator': 'FormItem',
47
- 'x-component': 'Select',
48
- enum: '{{dataSource}}',
49
- },
50
- jsonConfig: {
51
- type: 'void',
52
- 'x-component': 'div',
53
- properties: {
54
- template: {
55
- required: true,
56
- title: '{{t("JSON config",{ns:"charts"})}}',
57
- type: 'string',
58
- default: JSON5.stringify(chartConfig, null, 2),
59
- 'x-decorator': 'FormItem',
60
- 'x-component': 'Input.TextArea',
61
- 'x-component-props': {
62
- autoSize: { minRows: 8, maxRows: 16 },
63
- },
64
- description: '{{jsonConfigDesc("Radar | G2Plot","https://g2plot.antv.antgroup.com/api/plots/radar")}}',
65
- 'x-validator': { json5: true },
66
- },
67
- },
68
- },
69
- },
70
- },
71
- };
@@ -1,90 +0,0 @@
1
- import JSON5 from 'json5';
2
-
3
- const chartConfig = {
4
- appendPadding: 10,
5
- xField: '{{metric}}',
6
- yField: '{{dimension}}',
7
- colorField: '{{category}}',
8
- shape: 'circle',
9
- size: 4,
10
- yAxis: {
11
- nice: true,
12
- line: {
13
- style: {
14
- stroke: '#aaa',
15
- },
16
- },
17
- },
18
- xAxis: {
19
- min: -100,
20
- grid: {
21
- line: {
22
- style: {
23
- stroke: '#eee',
24
- },
25
- },
26
- },
27
- line: {
28
- style: {
29
- stroke: '#aaa',
30
- },
31
- },
32
- },
33
- };
34
-
35
- export const scatterTemplate = {
36
- description: '1 「Numeric」 field, 0~ 1 「Unordered Noun」 field',
37
- type: 'Scatter',
38
- title: 'Scatter',
39
- iconId: 'icon-scatter',
40
- group: 2,
41
- renderComponent: 'G2Plot',
42
- defaultChartOptions: chartConfig,
43
- configurableProperties: {
44
- type: 'void',
45
- properties: {
46
- dimension: {
47
- required: true,
48
- type: 'string',
49
- title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
50
- 'x-decorator': 'FormItem',
51
- 'x-component': 'Select',
52
- enum: '{{dataSource}}',
53
- },
54
- metric: {
55
- required: true,
56
- type: 'string',
57
- title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
58
- 'x-decorator': 'FormItem',
59
- 'x-component': 'Select',
60
- enum: '{{dataSource}}',
61
- },
62
- category: {
63
- type: 'string',
64
- title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
65
- 'x-decorator': 'FormItem',
66
- 'x-component': 'Select',
67
- enum: '{{dataSource}}',
68
- },
69
- jsonConfig: {
70
- type: 'void',
71
- 'x-component': 'div',
72
- properties: {
73
- template: {
74
- required: true,
75
- title: '{{t("JSON config",{ns:"charts"})}}',
76
- type: 'string',
77
- default: JSON5.stringify(chartConfig, null, 2),
78
- 'x-decorator': 'FormItem',
79
- 'x-component': 'Input.TextArea',
80
- 'x-component-props': {
81
- autoSize: { minRows: 8, maxRows: 16 },
82
- },
83
- description: '{{jsonConfigDesc("Scatter | G2Plot","https://g2plot.antv.antgroup.com/api/plots/scatter")}}',
84
- 'x-validator': { json5: true },
85
- },
86
- },
87
- },
88
- },
89
- },
90
- };
@@ -1,48 +0,0 @@
1
- import JSON5 from 'json5';
2
-
3
- const validateJSON = {
4
- validator: `{{(value, rule)=> {
5
- if (!value) {
6
- return '';
7
- }
8
- try {
9
- const val = JSON5.parse(value);
10
- if(!isNaN(val)) {
11
- return false;
12
- }
13
- return true;
14
- } catch(error) {
15
- console.error(error);
16
- return false;
17
- }
18
- }}}`,
19
- message: '{{t("Invalid JSON format",{ ns: "charts" })}}',
20
- };
21
-
22
- const chartConfig = {
23
- appendPadding: 10,
24
- angleField: '{{metric}}',
25
- colorField: '{{dimension}}',
26
- radius: 0.9,
27
- label: {
28
- type: 'inner',
29
- offset: '-30%',
30
- content: '{{({percent}) => `${(percent * 100).toFixed(0)}%`}}',
31
- style: {
32
- fontSize: 14,
33
- textAlign: 'center',
34
- },
35
- },
36
- interactions: [{ type: 'element-active' }],
37
- };
38
- export const tableTemplate = {
39
- title: '表格展示',
40
- type: 'DataSetPreviewTable',
41
- group: 2,
42
- renderComponent: 'DataSetPreviewTable',
43
- defaultChartOptions: chartConfig,
44
- configurableProperties: {
45
- type: 'void',
46
- properties: {},
47
- },
48
- };
@@ -1,21 +0,0 @@
1
- import { pieTemplate } from './PieTemplate';
2
- import { barTemplate } from './BarTemplate';
3
- import { columnTemplate } from './ColumnTemplate';
4
- import { lineTemplate } from './LineTemplate';
5
- import { areaTemplate } from './AreaTemplate';
6
- import { tableTemplate } from './TableTemplate';
7
- import { scatterTemplate } from './ScatterTemplate';
8
- import { radarTemplate } from './RadarTemplate';
9
- import { funnelTemplate } from './FunnelTemplate';
10
-
11
- export const templates = new Map();
12
-
13
- templates.set('Pie', pieTemplate);
14
- templates.set('Line', lineTemplate);
15
- templates.set('Area', areaTemplate);
16
- templates.set('Bar', barTemplate);
17
- templates.set('Column', columnTemplate);
18
- templates.set('Scatter', scatterTemplate);
19
- templates.set('Radar', radarTemplate);
20
- templates.set('Funnel', funnelTemplate);
21
- // templates.set('DataSetPreviewTable', tableTemplate);
@@ -1,39 +0,0 @@
1
- import JSON5 from 'json5';
2
- import { uid } from '@formily/shared';
3
-
4
- const validateArray = (value) => {
5
- try {
6
- value = JSON5.parse(value);
7
- } catch (e) {
8
- return 'Please input validate dataset';
9
- }
10
- if (Array.isArray(value)) {
11
- if (
12
- value.every((item) => {
13
- return typeof item === 'object' && Object.keys(item).length > 1;
14
- })
15
- )
16
- return true;
17
- }
18
- return 'Please input validate dataset';
19
- };
20
-
21
- const parseDataSetString = (str) => {
22
- const dataSetDataArray = JSON5.parse(str);
23
- if (Array.isArray(dataSetDataArray)) {
24
- if (
25
- dataSetDataArray.every((item) => {
26
- return typeof item === 'object' && Object.keys(item).length > 1;
27
- })
28
- )
29
- dataSetDataArray.map((item) => {
30
- if (!item?.id) {
31
- item.id = uid();
32
- }
33
- return item;
34
- });
35
- }
36
- return dataSetDataArray;
37
- };
38
-
39
- export { validateArray, parseDataSetString };
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export { default } from './server';
@@ -1,23 +0,0 @@
1
- export default {
2
- Edit: 'Edit',
3
- Delete: 'Delete',
4
- Cancel: 'Cancel',
5
- Submit: 'Submit',
6
- Actions: 'Actions',
7
- Title: 'Title',
8
- Enable: 'Enable',
9
- 'SAML manager': 'SAML manager',
10
- 'SAML Providers': 'SAML Providers',
11
- 'Redirect url': 'Redirect url',
12
- 'SP entity id': 'SP entity id',
13
- 'Add provider': 'Add',
14
- 'Edit provider': 'Edit',
15
- 'Client id': 'Client id',
16
- 'Entity id or issuer': 'Entity id or issuer',
17
- 'Login Url': 'Login Url',
18
- 'Public cert': 'Public cert',
19
- 'Delete provider': 'Delete',
20
- 'Are you sure you want to delete it?': 'Are you sure you want to delete it?',
21
- 'Sign in button name, which will be displayed on the sign in page':
22
- 'Sign in button name, which will be displayed on the sign in page',
23
- };
@@ -1 +0,0 @@
1
- export default {};
@@ -1 +0,0 @@
1
- export default {};