@cgeui/utils 0.0.2 → 0.0.4

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 (98) hide show
  1. package/dist/esm/charts/Chart/utils/complementData.js +714 -0
  2. package/dist/esm/charts/Chart/utils/convertToEchartsConfig/chartsToEchartsConfig.js +99 -0
  3. package/dist/esm/charts/Chart/utils/convertToEchartsConfig/index.js +2 -0
  4. package/dist/esm/charts/Chart/utils/convertToEchartsConfig/pieChartToEchartsConfig.js +140 -0
  5. package/dist/esm/charts/Chart/utils/getOption.js +365 -0
  6. package/dist/esm/charts/Chart/utils/handleChartConfig.js +279 -0
  7. package/dist/esm/charts/Chart/utils/index.js +5 -0
  8. package/dist/esm/charts/Chart/utils/preConfig/index.js +307 -0
  9. package/dist/esm/charts/Chart/utils/preConfig/type.js +1 -0
  10. package/dist/esm/charts/PieChart/interface.js +1 -0
  11. package/dist/esm/charts/PieChart/locales/en-US.js +9 -0
  12. package/dist/esm/charts/PieChart/locales/index.js +7 -0
  13. package/dist/esm/charts/PieChart/locales/zh-CN.js +9 -0
  14. package/dist/esm/charts/PieChart/util.js +434 -0
  15. package/dist/esm/charts/SuperChart/config/bar.js +39 -0
  16. package/dist/esm/charts/SuperChart/config/index.js +237 -0
  17. package/dist/esm/charts/SuperChart/configStyle/color.js +23 -0
  18. package/dist/esm/charts/SuperChart/configStyle/dataZoom.js +13 -0
  19. package/dist/esm/charts/SuperChart/configStyle/grid.js +20 -0
  20. package/dist/esm/charts/SuperChart/configStyle/index.js +10 -0
  21. package/dist/esm/charts/SuperChart/configStyle/legend.js +68 -0
  22. package/dist/esm/charts/SuperChart/configStyle/lineStyle.js +80 -0
  23. package/dist/esm/charts/SuperChart/configStyle/title.js +16 -0
  24. package/dist/esm/charts/SuperChart/configStyle/tooltip.js +38 -0
  25. package/dist/esm/charts/SuperChart/configStyle/visualMap.js +18 -0
  26. package/dist/esm/charts/SuperChart/configStyle/xAxis.js +19 -0
  27. package/dist/esm/charts/SuperChart/configStyle/yAxis.js +56 -0
  28. package/dist/esm/charts/SuperChart/interface.js +1 -0
  29. package/dist/esm/charts/chartTheme/colorUtil.js +22 -0
  30. package/dist/esm/charts/chartTheme/darkChart.js +508 -0
  31. package/dist/esm/charts/chartTheme/defaultChart.js +492 -0
  32. package/dist/esm/charts/chartTheme/index.js +4 -0
  33. package/dist/esm/charts/chartTheme/themeColor.js +168 -0
  34. package/dist/esm/charts/index.js +5 -0
  35. package/dist/esm/charts/utils/charts/hex2Rgb.js +32 -0
  36. package/dist/esm/charts/utils/constants/env.js +6 -0
  37. package/dist/esm/charts/utils/constants/helper.js +5 -0
  38. package/dist/esm/charts/utils/constants/index.js +3 -0
  39. package/dist/esm/charts/utils/constants/table.js +17 -0
  40. package/dist/esm/charts/utils/data.js +450 -0
  41. package/dist/esm/charts/utils/index.js +5 -0
  42. package/dist/esm/charts/utils/locale.js +7 -0
  43. package/dist/esm/charts/utils/time/index.js +14 -0
  44. package/dist/esm/charts/utils/types/action.d.ts +33 -0
  45. package/dist/esm/charts/utils/types/chart.d.ts +220 -0
  46. package/dist/esm/charts/utils/types/data.d.ts +51 -0
  47. package/dist/esm/charts/utils/types/index.d.ts +3 -0
  48. package/dist/esm/index.js +3 -0
  49. package/dist/lib/charts/Chart/utils/complementData.js +721 -0
  50. package/dist/lib/charts/Chart/utils/convertToEchartsConfig/chartsToEchartsConfig.js +105 -0
  51. package/dist/lib/charts/Chart/utils/convertToEchartsConfig/index.js +27 -0
  52. package/dist/lib/charts/Chart/utils/convertToEchartsConfig/pieChartToEchartsConfig.js +147 -0
  53. package/dist/lib/charts/Chart/utils/getOption.js +371 -0
  54. package/dist/lib/charts/Chart/utils/handleChartConfig.js +284 -0
  55. package/dist/lib/charts/Chart/utils/index.js +60 -0
  56. package/dist/lib/charts/Chart/utils/preConfig/index.js +313 -0
  57. package/dist/lib/charts/Chart/utils/preConfig/type.js +5 -0
  58. package/dist/lib/charts/PieChart/interface.js +5 -0
  59. package/dist/lib/charts/PieChart/locales/en-US.js +15 -0
  60. package/dist/lib/charts/PieChart/locales/index.js +14 -0
  61. package/dist/lib/charts/PieChart/locales/zh-CN.js +15 -0
  62. package/dist/lib/charts/PieChart/util.js +441 -0
  63. package/dist/lib/charts/SuperChart/config/bar.js +45 -0
  64. package/dist/lib/charts/SuperChart/config/index.js +243 -0
  65. package/dist/lib/charts/SuperChart/configStyle/color.js +29 -0
  66. package/dist/lib/charts/SuperChart/configStyle/dataZoom.js +19 -0
  67. package/dist/lib/charts/SuperChart/configStyle/grid.js +26 -0
  68. package/dist/lib/charts/SuperChart/configStyle/index.js +76 -0
  69. package/dist/lib/charts/SuperChart/configStyle/legend.js +74 -0
  70. package/dist/lib/charts/SuperChart/configStyle/lineStyle.js +86 -0
  71. package/dist/lib/charts/SuperChart/configStyle/title.js +22 -0
  72. package/dist/lib/charts/SuperChart/configStyle/tooltip.js +44 -0
  73. package/dist/lib/charts/SuperChart/configStyle/visualMap.js +24 -0
  74. package/dist/lib/charts/SuperChart/configStyle/xAxis.js +25 -0
  75. package/dist/lib/charts/SuperChart/configStyle/yAxis.js +62 -0
  76. package/dist/lib/charts/SuperChart/interface.js +5 -0
  77. package/dist/lib/charts/chartTheme/colorUtil.js +28 -0
  78. package/dist/lib/charts/chartTheme/darkChart.js +514 -0
  79. package/dist/lib/charts/chartTheme/defaultChart.js +498 -0
  80. package/dist/lib/charts/chartTheme/index.js +49 -0
  81. package/dist/lib/charts/chartTheme/themeColor.js +174 -0
  82. package/dist/lib/charts/index.js +60 -0
  83. package/dist/lib/charts/utils/charts/hex2Rgb.js +38 -0
  84. package/dist/lib/charts/utils/constants/env.js +12 -0
  85. package/dist/lib/charts/utils/constants/helper.js +11 -0
  86. package/dist/lib/charts/utils/constants/index.js +38 -0
  87. package/dist/lib/charts/utils/constants/table.js +23 -0
  88. package/dist/lib/charts/utils/data.js +454 -0
  89. package/dist/lib/charts/utils/index.js +60 -0
  90. package/dist/lib/charts/utils/locale.js +13 -0
  91. package/dist/lib/charts/utils/time/index.js +21 -0
  92. package/dist/lib/charts/utils/types/action.d.ts +33 -0
  93. package/dist/lib/charts/utils/types/chart.d.ts +220 -0
  94. package/dist/lib/charts/utils/types/data.d.ts +51 -0
  95. package/dist/lib/charts/utils/types/index.d.ts +3 -0
  96. package/dist/lib/index.js +25 -0
  97. package/dist/tsconfig.declaration.tsbuildinfo +1 -0
  98. package/package.json +3 -3
@@ -0,0 +1,220 @@
1
+ import type { EChartsOption, EChartsReactProps } from "echarts-for-react";
2
+ import type { CSSProperties } from "react";
3
+ /**
4
+ * 图表数据记录
5
+ */
6
+ export declare type ChartDataRecord = {
7
+ /**
8
+ * 数据记录维度1,一般用于x轴展示
9
+ */
10
+ name: string;
11
+ /**
12
+ * 数据记录维度2,一般用于y轴展示
13
+ */
14
+ value: string;
15
+ /**
16
+ * 数据记录维度3,一般用于按颜色区分等级
17
+ */
18
+ level?: string;
19
+ /**
20
+ * 数据记录维度x,可根据后端数据模型扩展
21
+ */
22
+ // [x?: string]: string | number | boolean;
23
+ /**
24
+ * 关联的数据记录,一般用于返回和特征关联的原始数据记录
25
+ */
26
+ children?: ChartDataRecord[];
27
+ };
28
+
29
+ /**
30
+ * 图表数据分组
31
+ */
32
+ export declare type ChartDataGroup = {
33
+ /**
34
+ * 数据分组唯一标识
35
+ */
36
+ groupKey: string;
37
+ /**
38
+ * 数据分组名称,用于前端展示
39
+ */
40
+ groupName: string;
41
+ /**
42
+ * 数据分组包含的数据记录集合
43
+ */
44
+ source: ChartDataRecord[];
45
+ };
46
+
47
+ /**
48
+ * 图表数据填充规则
49
+ */
50
+ export declare type DataFillConfig = {
51
+ /**
52
+ * x轴范围,是一个数组包含x轴的起始点和结束点
53
+ * 1. SoC切片的场['20','80']
54
+ * 2. 时间的场景: ['1669188760086', '1669188980086']
55
+ * 3. 开闭区间 (,80) [80,85] (100,)
56
+ */
57
+ range?: string[] | number[];
58
+ /**
59
+ * 起始点和结束点之间每个点的间隔
60
+ * 1. SoC切片的场景: [10]
61
+ * 2. 时间的场景: [1,'d']
62
+ */
63
+ interval?: [number, string?];
64
+ /**
65
+ * 填充规则,指定的维度字段补'ZERO' 0 还是 'EMPTY' 空字符串或 'LINE' 连线,其它表示填充的字符串'L1'
66
+ * 如果后端没有返回,默认按照'EMPTY'来处理
67
+ */
68
+ fillWith?: string;
69
+ };
70
+
71
+ /**
72
+ * 图表数据
73
+ */
74
+ export declare type ChartData = {
75
+ /**
76
+ * 图表配置,暂时由前端维护后端不需要关心
77
+ */
78
+ config?: ChartConfig;
79
+ /*
80
+ * 图表数据填充规则
81
+ */
82
+ dataFillConfig?: DataFillConfig;
83
+ /**
84
+ * 图表数据集合
85
+ */
86
+ list: ChartDataGroup[];
87
+ };
88
+
89
+ /**
90
+ * 图表样式配置
91
+ */
92
+ export declare type ChartConfig = {
93
+ title?: any;
94
+ series?: any;
95
+ } & EChartsOption;
96
+
97
+ export type ChartProps = {
98
+ loading: boolean;
99
+ onEvents: any;
100
+ helper: any;
101
+ value: any;
102
+ configStyle: any;
103
+ actionValue: any;
104
+ configData: any;
105
+ dataFillConfig: any;
106
+ maxLegendNum: number;
107
+ maxTooltipNum: number;
108
+ is2Dim: boolean;
109
+ selfTheme: string;
110
+ theme: string;
111
+ totalTitle?: { text: string; value: any };
112
+ transform?: any;
113
+ readLegend?: any;
114
+ dimensions?: any;
115
+ } & EChartsReactProps;
116
+
117
+ export type ChartParseProps = {
118
+ data?: any;
119
+ xAxis?: any;
120
+ configStyle: any;
121
+ configData: any;
122
+ helper?: any;
123
+ series?: any;
124
+ maxLegendNum?: number;
125
+ maxTooltipNum?: number;
126
+ isComplementData?: boolean;
127
+ extraData?: any;
128
+ is2Dim?: boolean;
129
+ dataFillConfig?: any;
130
+ dataset: any;
131
+ totalTitle?: { text: string; value: any };
132
+ transformData?: any;
133
+ transform?: any;
134
+ };
135
+
136
+ export type DatasetParams = {
137
+ is2Dim?: boolean;
138
+ data: any;
139
+ dataFillConfig: any;
140
+ isComplementData: boolean;
141
+ extraData: any;
142
+ xAxis: any;
143
+ transform: ChartDataSetTransform[];
144
+ };
145
+
146
+ export type ChartOptionProps = {
147
+ data?: any;
148
+ helper: any;
149
+ configStyle: any;
150
+ configData: any;
151
+ dataFillConfig?: any;
152
+ maxLegendNum?: number;
153
+ maxTooltipNum?: number;
154
+ is2Dim?: boolean;
155
+ totalTitle?: { text: string; value: any };
156
+ transform?: any;
157
+ };
158
+
159
+ export type ChartType = "bar" | "line" | "pie" | "gauge" | "boxplot";
160
+ export type CatLegendType =
161
+ | "rectangle"
162
+ | "dashed"
163
+ | "diamond"
164
+ | "dotted"
165
+ | "solid";
166
+ export type CatLegendItem = {
167
+ text: string;
168
+ color?: string;
169
+ type: CatLegendType;
170
+ width?: string;
171
+ };
172
+ export type SuperChartProps = {
173
+ type: ChartType;
174
+ name: string;
175
+ params?: any;
176
+ handleResponse?: (...args: any) => any;
177
+ outputKey?: string;
178
+ action?: any;
179
+ onEvents?: any;
180
+ chartConfig?: DataChartConfig;
181
+ is2Dim?: boolean;
182
+ value?: any;
183
+ loading?: boolean;
184
+ theme?: "default" | "dark";
185
+ readLegend?: CatLegendItem[];
186
+ style?: CSSProperties;
187
+ };
188
+
189
+ export declare type DataChartConfig = {
190
+ configStyle?: ChartConfig;
191
+ configData: ChartConfig;
192
+ /*
193
+ * 图表数据填充规则
194
+ */
195
+ dataFillConfig?: DataFillConfig;
196
+ helper?: any;
197
+ dimensions?: string[];
198
+ transform?: any;
199
+ };
200
+ export interface ChartDataSetTransform {
201
+ //数据转换类型
202
+ type: string;
203
+ // 转换的系列Key值
204
+ fillGroupKey: string[];
205
+ // 压缩后的值
206
+ compress: number;
207
+ // 参数值
208
+ param: any;
209
+ // 转换的字段
210
+ fillField: string[];
211
+ }
212
+
213
+ export type CompressDataType = {
214
+ dataset: any;
215
+ startGroup: any;
216
+ endGroup: any;
217
+ start: any;
218
+ end: any;
219
+ output: any;
220
+ };
@@ -0,0 +1,51 @@
1
+ export type TableListItem = {
2
+ key: number;
3
+ disabled?: boolean;
4
+ href: string;
5
+ avatar: string;
6
+ name: string;
7
+ owner: string;
8
+ desc: string;
9
+ callNo: number;
10
+ status: string;
11
+ updatedAt: Date;
12
+ createdAt: Date;
13
+ progress: number;
14
+ };
15
+
16
+ export type TableListPagination = {
17
+ total: number;
18
+ pageSize: number;
19
+ current: number;
20
+ };
21
+
22
+ export type TableListData = {
23
+ list: TableListItem[];
24
+ pagination: Partial<TableListPagination>;
25
+ };
26
+
27
+ export type TableListParams = {
28
+ status?: string;
29
+ name?: string;
30
+ desc?: string;
31
+ key?: number;
32
+ pageSize?: number;
33
+ currentPage?: number;
34
+ filter?: Record<string, any[]>;
35
+ sorter?: Record<string, any>;
36
+ };
37
+
38
+ /**
39
+ * lookUp
40
+ */
41
+ export enum Operations {
42
+ lookUp = '查看',
43
+ }
44
+
45
+ export type OperationType = {
46
+ name: string;
47
+ action: {
48
+ targetName?: string;
49
+ paramsHandler?: (...args: any) => any;
50
+ };
51
+ };
@@ -0,0 +1,3 @@
1
+ export type * from "./action.d";
2
+ export type * from "./chart.d";
3
+ export type * from "./data.d";
@@ -0,0 +1,3 @@
1
+ import * as utilsCharts from "./charts";
2
+ export * from "./charts";
3
+ export { utilsCharts };