@yoka-ui/ui 1.0.6 → 1.0.7
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.
- package/@Docs-yoka/exports.generated.md +3 -3
- package/README.md +6 -6
- package/dist/es/assets/image/skills.zip +0 -0
- package/dist/es/business/Empty/index.js.map +1 -1
- package/dist/es/business/YkCharts/Area.d.ts +18 -0
- package/dist/es/business/YkCharts/Area.js +336 -0
- package/dist/es/business/YkCharts/Area.js.map +7 -0
- package/dist/es/business/YkCharts/Bar.d.ts +21 -0
- package/dist/es/business/YkCharts/Bar.js +316 -0
- package/dist/es/business/YkCharts/Bar.js.map +7 -0
- package/dist/es/business/YkCharts/BarProperty.d.ts +21 -0
- package/dist/es/business/YkCharts/BarProperty.js +357 -0
- package/dist/es/business/YkCharts/BarProperty.js.map +7 -0
- package/dist/es/business/YkCharts/BarTotal.d.ts +21 -0
- package/dist/es/business/YkCharts/BarTotal.js +288 -0
- package/dist/es/business/YkCharts/BarTotal.js.map +7 -0
- package/dist/es/business/YkCharts/Line.d.ts +21 -0
- package/dist/es/business/YkCharts/Line.js +342 -0
- package/dist/es/business/YkCharts/Line.js.map +7 -0
- package/dist/es/business/YkCharts/Pie.d.ts +19 -0
- package/dist/es/business/YkCharts/Pie.js +107 -0
- package/dist/es/business/YkCharts/Pie.js.map +7 -0
- package/dist/es/business/YkCharts/PieProperty.d.ts +18 -0
- package/dist/es/business/YkCharts/PieProperty.js +180 -0
- package/dist/es/business/YkCharts/PieProperty.js.map +7 -0
- package/dist/es/business/YkCharts/Pies.d.ts +26 -0
- package/dist/es/business/YkCharts/Pies.js +348 -0
- package/dist/es/business/YkCharts/Pies.js.map +7 -0
- package/dist/es/business/YkCharts/constants.d.ts +1 -0
- package/dist/es/business/YkCharts/constants.js +47 -0
- package/dist/es/business/YkCharts/constants.js.map +7 -0
- package/dist/es/business/YkCharts/hooks.d.ts +4 -0
- package/dist/es/business/YkCharts/hooks.js +37 -0
- package/dist/es/business/YkCharts/hooks.js.map +7 -0
- package/dist/es/business/YkCharts/index.d.ts +9 -0
- package/dist/es/business/YkCharts/index.js +20 -0
- package/dist/es/business/YkCharts/index.js.map +7 -0
- package/dist/es/business/YkCharts/index.module.less +164 -0
- package/dist/es/business/YkCharts/tooltip.less +92 -0
- package/dist/es/business/YkCharts/transformData.js +16 -0
- package/dist/es/business/YkCharts/transformData.js.map +7 -0
- package/dist/es/business/YkCharts/typing.d.ts +74 -0
- package/dist/es/business/YkCharts/typing.js +1 -0
- package/dist/es/business/YkCharts/typing.js.map +7 -0
- package/dist/es/business/YkCharts/utils.d.ts +4 -0
- package/dist/es/business/YkCharts/utils.js +109 -0
- package/dist/es/business/YkCharts/utils.js.map +7 -0
- package/dist/es/business/YkCharts/variables.less +13 -0
- package/dist/es/components/YKMarkdown/index.d.ts +11 -0
- package/dist/es/components/YKMarkdown/index.js +236 -0
- package/dist/es/components/YKMarkdown/index.js.map +7 -0
- package/dist/es/components/YKMarkdown/index.module.less +83 -0
- package/dist/es/components/YkDateRangePicker/YkDateRangePicker.mdx +3 -3
- package/dist/es/creative/GlassSegmentedRadio/index.d.ts +1 -1
- package/dist/es/creative/SkillsWriter/index.d.ts +3 -0
- package/dist/es/creative/SkillsWriter/index.js +191 -0
- package/dist/es/creative/SkillsWriter/index.js.map +7 -0
- package/dist/es/creative/SkillsWriter/index.module.less +21 -0
- package/dist/es/index.less +6 -1
- package/dist/es/utils/ykStorybookDoc.d.ts +15 -0
- package/dist/es/utils/ykStorybookDoc.js +24 -2
- package/dist/es/utils/ykStorybookDoc.js.map +2 -2
- package/dist/lib/assets/image/skills.zip +0 -0
- package/dist/lib/business/Empty/index.js.map +1 -1
- package/dist/lib/business/YkCharts/Area.d.ts +18 -0
- package/dist/lib/business/YkCharts/Area.js +346 -0
- package/dist/lib/business/YkCharts/Area.js.map +7 -0
- package/dist/lib/business/YkCharts/Bar.d.ts +21 -0
- package/dist/lib/business/YkCharts/Bar.js +323 -0
- package/dist/lib/business/YkCharts/Bar.js.map +7 -0
- package/dist/lib/business/YkCharts/BarProperty.d.ts +21 -0
- package/dist/lib/business/YkCharts/BarProperty.js +370 -0
- package/dist/lib/business/YkCharts/BarProperty.js.map +7 -0
- package/dist/lib/business/YkCharts/BarTotal.d.ts +21 -0
- package/dist/lib/business/YkCharts/BarTotal.js +295 -0
- package/dist/lib/business/YkCharts/BarTotal.js.map +7 -0
- package/dist/lib/business/YkCharts/Line.d.ts +21 -0
- package/dist/lib/business/YkCharts/Line.js +349 -0
- package/dist/lib/business/YkCharts/Line.js.map +7 -0
- package/dist/lib/business/YkCharts/Pie.d.ts +19 -0
- package/dist/lib/business/YkCharts/Pie.js +117 -0
- package/dist/lib/business/YkCharts/Pie.js.map +7 -0
- package/dist/lib/business/YkCharts/PieProperty.d.ts +18 -0
- package/dist/lib/business/YkCharts/PieProperty.js +193 -0
- package/dist/lib/business/YkCharts/PieProperty.js.map +7 -0
- package/dist/lib/business/YkCharts/Pies.d.ts +26 -0
- package/dist/lib/business/YkCharts/Pies.js +337 -0
- package/dist/lib/business/YkCharts/Pies.js.map +7 -0
- package/dist/lib/business/YkCharts/constants.d.ts +1 -0
- package/dist/lib/business/YkCharts/constants.js +71 -0
- package/dist/lib/business/YkCharts/constants.js.map +7 -0
- package/dist/lib/business/YkCharts/hooks.d.ts +4 -0
- package/dist/lib/business/YkCharts/hooks.js +62 -0
- package/dist/lib/business/YkCharts/hooks.js.map +7 -0
- package/dist/lib/business/YkCharts/index.d.ts +9 -0
- package/dist/lib/business/YkCharts/index.js +61 -0
- package/dist/lib/business/YkCharts/index.js.map +7 -0
- package/dist/lib/business/YkCharts/index.module.less +164 -0
- package/dist/lib/business/YkCharts/tooltip.less +92 -0
- package/dist/lib/business/YkCharts/transformData.js +40 -0
- package/dist/lib/business/YkCharts/transformData.js.map +7 -0
- package/dist/lib/business/YkCharts/typing.d.ts +74 -0
- package/dist/lib/business/YkCharts/typing.js +18 -0
- package/dist/lib/business/YkCharts/typing.js.map +7 -0
- package/dist/lib/business/YkCharts/utils.d.ts +4 -0
- package/dist/lib/business/YkCharts/utils.js +143 -0
- package/dist/lib/business/YkCharts/utils.js.map +7 -0
- package/dist/lib/business/YkCharts/variables.less +13 -0
- package/dist/lib/components/YKMarkdown/index.d.ts +11 -0
- package/dist/lib/components/YKMarkdown/index.js +188 -0
- package/dist/lib/components/YKMarkdown/index.js.map +7 -0
- package/dist/lib/components/YKMarkdown/index.module.less +83 -0
- package/dist/lib/components/YkDateRangePicker/YkDateRangePicker.mdx +3 -3
- package/dist/lib/creative/GlassSegmentedRadio/index.d.ts +1 -1
- package/dist/lib/creative/SkillsWriter/index.d.ts +3 -0
- package/dist/lib/creative/SkillsWriter/index.js +200 -0
- package/dist/lib/creative/SkillsWriter/index.js.map +7 -0
- package/dist/lib/creative/SkillsWriter/index.module.less +21 -0
- package/dist/lib/index.less +6 -1
- package/dist/lib/utils/ykStorybookDoc.d.ts +15 -0
- package/dist/lib/utils/ykStorybookDoc.js +23 -1
- package/dist/lib/utils/ykStorybookDoc.js.map +2 -2
- package/package.json +152 -143
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/business/YkCharts/PieProperty.tsx
|
|
30
|
+
var PieProperty_exports = {};
|
|
31
|
+
__export(PieProperty_exports, {
|
|
32
|
+
default: () => PieProperty_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(PieProperty_exports);
|
|
35
|
+
var import_antd = require("antd");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_index_module = __toESM(require("./index.module.less"));
|
|
38
|
+
var import_Pie = __toESM(require("./Pie"));
|
|
39
|
+
var PieProperty = ({
|
|
40
|
+
count,
|
|
41
|
+
// 指标显示数量
|
|
42
|
+
metric,
|
|
43
|
+
// 指标
|
|
44
|
+
groupBys,
|
|
45
|
+
// 维度
|
|
46
|
+
tableData,
|
|
47
|
+
// 表格数据
|
|
48
|
+
baseData,
|
|
49
|
+
// 基础数据
|
|
50
|
+
columnConfigMap,
|
|
51
|
+
// 列配置
|
|
52
|
+
height
|
|
53
|
+
}) => {
|
|
54
|
+
const { x_field } = tableData;
|
|
55
|
+
const legendNames = (0, import_react.useMemo)(() => {
|
|
56
|
+
if (groupBys && groupBys.length > 1) {
|
|
57
|
+
const validGroups = groupBys.slice(1).filter((g) => Array.isArray(g.selected) && g.selected.length > 0);
|
|
58
|
+
const arrays = validGroups.map((g) => g.selected);
|
|
59
|
+
const product = arrays.reduce(
|
|
60
|
+
(acc, curr) => {
|
|
61
|
+
const res = [];
|
|
62
|
+
acc.forEach((a) => {
|
|
63
|
+
curr.forEach((b) => {
|
|
64
|
+
res.push(Array.isArray(a) ? [...a, b] : [a, b]);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
return res;
|
|
68
|
+
},
|
|
69
|
+
[[]]
|
|
70
|
+
);
|
|
71
|
+
return product.map((arr) => arr.join(","));
|
|
72
|
+
} else {
|
|
73
|
+
return metric;
|
|
74
|
+
}
|
|
75
|
+
}, [groupBys, metric]);
|
|
76
|
+
const legendItems = (0, import_react.useMemo)(() => {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
let rows = [];
|
|
79
|
+
let fieldType = "string";
|
|
80
|
+
if (groupBys.length === 0) {
|
|
81
|
+
rows = baseData.map((item) => item[x_field]);
|
|
82
|
+
rows = Array.from(new Set(rows));
|
|
83
|
+
fieldType = ((_a = columnConfigMap[x_field]) == null ? void 0 : _a.type) || "string";
|
|
84
|
+
} else {
|
|
85
|
+
rows = groupBys[0].options.filter((option) => groupBys[0].selected.includes(option));
|
|
86
|
+
fieldType = ((_b = columnConfigMap[groupBys[0].key]) == null ? void 0 : _b.type) || "string";
|
|
87
|
+
}
|
|
88
|
+
if (fieldType === "number") {
|
|
89
|
+
rows = rows.sort((a, b) => {
|
|
90
|
+
return Number(a) > Number(b) ? 1 : -1;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return count ? rows.slice(0, count) : rows;
|
|
94
|
+
}, [baseData, groupBys, x_field, count]);
|
|
95
|
+
const chartData = (0, import_react.useMemo)(() => {
|
|
96
|
+
if (groupBys && groupBys.length > 1) {
|
|
97
|
+
if (Array.isArray(groupBys) && groupBys.some((g) => Array.isArray(g.selected) && g.selected.length === 0)) {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
const validGroups = groupBys.filter((g) => Array.isArray(g.selected) && g.selected.length > 0);
|
|
101
|
+
const arrays = validGroups.map((g) => g.selected);
|
|
102
|
+
const product = arrays.reduce(
|
|
103
|
+
(acc, curr) => {
|
|
104
|
+
const res = [];
|
|
105
|
+
acc.forEach((a) => {
|
|
106
|
+
curr.forEach((b) => {
|
|
107
|
+
res.push(Array.isArray(a) ? [...a, b] : [a, b]);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
return res;
|
|
111
|
+
},
|
|
112
|
+
[[]]
|
|
113
|
+
);
|
|
114
|
+
const result = product.map((arr) => {
|
|
115
|
+
const item = baseData.find((d) => {
|
|
116
|
+
return arr.every((a, i) => {
|
|
117
|
+
return d[groupBys[i].key] === a;
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
if (!item)
|
|
121
|
+
return null;
|
|
122
|
+
return {
|
|
123
|
+
...item,
|
|
124
|
+
name: arr.join(","),
|
|
125
|
+
value: item[metric[0]],
|
|
126
|
+
metricName: metric[0],
|
|
127
|
+
format: columnConfigMap[metric[0]]
|
|
128
|
+
};
|
|
129
|
+
}).filter(Boolean);
|
|
130
|
+
return count ? result.slice(0, count) : result;
|
|
131
|
+
} else if (groupBys && groupBys.length === 1) {
|
|
132
|
+
const selected = groupBys[0].selected;
|
|
133
|
+
const result = selected.map((s) => {
|
|
134
|
+
const item = baseData.find((d) => d[groupBys[0].key] === s);
|
|
135
|
+
if (!item)
|
|
136
|
+
return null;
|
|
137
|
+
return {
|
|
138
|
+
...item,
|
|
139
|
+
name: item[groupBys[0].key],
|
|
140
|
+
value: item[metric[0]],
|
|
141
|
+
metricName: metric[0],
|
|
142
|
+
format: columnConfigMap[metric[0]]
|
|
143
|
+
};
|
|
144
|
+
}).filter((item) => (item == null ? void 0 : item.name) && legendItems.includes(item.name));
|
|
145
|
+
return count ? result.slice(0, count) : result;
|
|
146
|
+
} else {
|
|
147
|
+
const result = baseData.map((item) => {
|
|
148
|
+
return {
|
|
149
|
+
...item,
|
|
150
|
+
name: item[x_field],
|
|
151
|
+
value: item[metric[0]],
|
|
152
|
+
metricName: metric[0],
|
|
153
|
+
format: columnConfigMap[metric[0]]
|
|
154
|
+
};
|
|
155
|
+
}).filter((item) => {
|
|
156
|
+
return legendItems.includes(item.name);
|
|
157
|
+
});
|
|
158
|
+
return count ? result.slice(0, count) : result;
|
|
159
|
+
}
|
|
160
|
+
}, [baseData, x_field, groupBys, metric, columnConfigMap, count]);
|
|
161
|
+
const series = (0, import_react.useMemo)(() => {
|
|
162
|
+
return {
|
|
163
|
+
name: metric[0],
|
|
164
|
+
type: "pie",
|
|
165
|
+
radius: ["50%", "70%"],
|
|
166
|
+
label: {
|
|
167
|
+
color: "#666"
|
|
168
|
+
},
|
|
169
|
+
data: chartData.map((item) => {
|
|
170
|
+
return {
|
|
171
|
+
name: item == null ? void 0 : item.name,
|
|
172
|
+
value: item == null ? void 0 : item.value,
|
|
173
|
+
format: item == null ? void 0 : item.format
|
|
174
|
+
};
|
|
175
|
+
})
|
|
176
|
+
};
|
|
177
|
+
}, [legendNames, chartData]);
|
|
178
|
+
const legend = {
|
|
179
|
+
bottom: 0,
|
|
180
|
+
type: "scroll",
|
|
181
|
+
data: legendItems.map((item) => {
|
|
182
|
+
return {
|
|
183
|
+
name: item,
|
|
184
|
+
textStyle: {
|
|
185
|
+
color: "#666"
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
})
|
|
189
|
+
};
|
|
190
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, chartData.length > 0 ? /* @__PURE__ */ import_react.default.createElement("div", { className: import_index_module.default.pieLegend, style: { height: height || "100%", width: "100%" } }, /* @__PURE__ */ import_react.default.createElement("div", { style: { height: height || "100%", width: "100%", minHeight: 220 } }, /* @__PURE__ */ import_react.default.createElement(import_Pie.default, { item: series, legend }))) : /* @__PURE__ */ import_react.default.createElement(import_antd.Empty, { className: import_index_module.default.empty, description: "暂无数据", image: import_antd.Empty.PRESENTED_IMAGE_SIMPLE }));
|
|
191
|
+
};
|
|
192
|
+
var PieProperty_default = PieProperty;
|
|
193
|
+
//# sourceMappingURL=PieProperty.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/business/YkCharts/PieProperty.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * 用户分析-饼图\n */\nimport { Empty } from 'antd';\nimport React, { type FC, useMemo } from 'react';\nimport styles from './index.module.less';\nimport Pie from './Pie';\nimport type { ColumnConfig, GroupByItem, TableData } from './typing';\n\ntype RowItem = {\n [key: string]: number | string;\n};\n\ntype PageTypes = {\n count?: number;\n metric: string[];\n groupBys: GroupByItem[];\n tableData: TableData;\n baseData: RowItem[];\n columnConfigMap: { [key: string]: ColumnConfig };\n height?: number;\n};\n\nconst PieProperty: FC<PageTypes> = ({\n count, // 指标显示数量\n metric, // 指标\n groupBys, // 维度\n tableData, // 表格数据\n baseData, // 基础数据\n columnConfigMap, // 列配置\n height,\n}) => {\n const { x_field } = tableData;\n\n // 获取图例名称\n const legendNames = useMemo(() => {\n if (groupBys && groupBys.length > 1) {\n const validGroups = groupBys.slice(1).filter((g) => Array.isArray(g.selected) && g.selected.length > 0);\n const arrays = validGroups.map((g) => g.selected);\n const product = arrays.reduce(\n (acc, curr) => {\n const res: any[] = [];\n acc.forEach((a) => {\n curr.forEach((b) => {\n res.push(Array.isArray(a) ? [...a, b] : [a, b]);\n });\n });\n return res;\n },\n [[]],\n );\n return product.map((arr) => arr.join(','));\n } else {\n return metric;\n }\n }, [groupBys, metric]);\n\n // 获取图例项\n const legendItems = useMemo(() => {\n // 当没有选维度时,x轴为合计\n let rows = [];\n let fieldType = 'string';\n if (groupBys.length === 0) {\n rows = baseData.map((item) => item[x_field]);\n rows = Array.from(new Set(rows)); // 去重\n fieldType = columnConfigMap[x_field]?.type || 'string';\n } else {\n // 当选一个维度时,x轴为维度,按照 options 的顺序排序\n rows = groupBys[0].options.filter((option) => groupBys[0].selected.includes(option));\n fieldType = columnConfigMap[groupBys[0].key]?.type || 'string';\n }\n if (fieldType === 'number') {\n rows = rows.sort((a: string | number, b: string | number) => {\n return Number(a) > Number(b) ? 1 : -1;\n });\n }\n return count ? rows.slice(0, count) : rows;\n }, [baseData, groupBys, x_field, count]);\n const chartData = useMemo(() => {\n // 存在多个维度\n if (groupBys && groupBys.length > 1) {\n // 如果存在已选维度为空,则不显示图表\n if (Array.isArray(groupBys) && groupBys.some((g) => Array.isArray(g.selected) && g.selected.length === 0)) {\n return [];\n }\n const validGroups = groupBys.filter((g) => Array.isArray(g.selected) && g.selected.length > 0);\n const arrays = validGroups.map((g) => g.selected);\n const product = arrays.reduce(\n (acc, curr) => {\n const res: any[] = [];\n acc.forEach((a) => {\n curr.forEach((b) => {\n res.push(Array.isArray(a) ? [...a, b] : [a, b]);\n });\n });\n return res;\n },\n [[]],\n );\n const result = product\n .map((arr) => {\n const item = baseData.find((d) => {\n return arr.every((a: string, i: number) => {\n return d[groupBys[i].key] === a;\n });\n });\n if (!item) return null;\n return {\n ...item,\n name: arr.join(','),\n value: item[metric[0]],\n metricName: metric[0],\n format: columnConfigMap[metric[0]],\n };\n })\n .filter(Boolean);\n return count ? result.slice(0, count) : result;\n } else if (groupBys && groupBys.length === 1) {\n // 存在一个维度\n const selected = groupBys[0].selected;\n const result = selected\n .map((s) => {\n const item = baseData.find((d) => d[groupBys[0].key] === s);\n if (!item) return null;\n return {\n ...item,\n name: item[groupBys[0].key],\n value: item[metric[0]],\n metricName: metric[0],\n format: columnConfigMap[metric[0]],\n };\n })\n .filter((item) => item?.name && legendItems.includes(item.name));\n return count ? result.slice(0, count) : result;\n } else {\n // 不存在维度\n const result = baseData\n .map((item) => {\n return {\n ...item,\n name: item[x_field],\n value: item[metric[0]],\n metricName: metric[0],\n format: columnConfigMap[metric[0]],\n };\n })\n .filter((item) => {\n return legendItems.includes(item.name);\n });\n return count ? result.slice(0, count) : result;\n }\n }, [baseData, x_field, groupBys, metric, columnConfigMap, count]);\n\n // 获取series\n const series = useMemo(() => {\n return {\n name: metric[0],\n type: 'pie',\n radius: ['50%', '70%'],\n label: {\n color: '#666',\n },\n data: chartData.map((item) => {\n return {\n name: item?.name,\n value: item?.value,\n format: item?.format,\n };\n }),\n };\n }, [legendNames, chartData]);\n const legend = {\n bottom: 0,\n type: 'scroll',\n data: legendItems.map((item) => {\n return {\n name: item,\n textStyle: {\n color: '#666',\n },\n };\n }),\n };\n\n return (\n <>\n {chartData.length > 0 ? (\n <div className={styles.pieLegend} style={{ height: height || '100%', width: '100%' }}>\n <div style={{ height: height || '100%', width: '100%', minHeight: 220 }}>\n <Pie item={series} legend={legend} />\n </div>\n </div>\n ) : (\n <Empty className={styles.empty} description='暂无数据' image={Empty.PRESENTED_IMAGE_SIMPLE} />\n )}\n </>\n );\n};\n\nexport default PieProperty;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAsB;AACtB,mBAAwC;AACxC,0BAAmB;AACnB,iBAAgB;AAiBhB,IAAM,cAA6B,CAAC;AAAA,EAClC;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,IAAI;AAGpB,QAAM,kBAAc,sBAAQ,MAAM;AAChC,QAAI,YAAY,SAAS,SAAS,GAAG;AACnC,YAAM,cAAc,SAAS,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,MAAM,QAAQ,EAAE,QAAQ,KAAK,EAAE,SAAS,SAAS,CAAC;AACtG,YAAM,SAAS,YAAY,IAAI,CAAC,MAAM,EAAE,QAAQ;AAChD,YAAM,UAAU,OAAO;AAAA,QACrB,CAAC,KAAK,SAAS;AACb,gBAAM,MAAa,CAAC;AACpB,cAAI,QAAQ,CAAC,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A,QAChB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,GAAG,CAAC,aAAa,SAAS,CAAC;AAC3B,QAAM,SAAS;AAAA,IACb,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM,YAAY,IAAI,CAAC,SAAS;AAC9B,aAAO;AAAA,QACL,MAAM;AAAA,QACN,WAAW;AAAA,UACT,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SACE,6BAAAA,QAAA,2BAAAA,QAAA,gBACG,UAAU,SAAS,IAClB,6BAAAA,QAAA,cAAC,SAAI,WAAW,oBAAAC,QAAO,WAAW,OAAO,EAAE,QAAQ,UAAU,QAAQ,OAAO,OAAO,KACjF,6BAAAD,QAAA,cAAC,SAAI,OAAO,EAAE,QAAQ,UAAU,QAAQ,OAAO,QAAQ,WAAW,IAAI,KACpE,6BAAAA,QAAA,cAAC,WAAAE,SAAA,EAAI,MAAM,QAAQ,QAAgB,CACrC,CACF,IAEA,6BAAAF,QAAA,cAAC,qBAAM,WAAW,oBAAAC,QAAO,OAAO,aAAY,QAAO,OAAO,kBAAM,wBAAwB,CAE5F;AAEJ;AAEA,IAAO,sBAAQ;",
|
|
6
|
+
"names": ["React", "styles", "Pie"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ColumnConfig, GroupByItem, SqlMetaConfig, TableData } from './typing';
|
|
3
|
+
import 'swiper/css';
|
|
4
|
+
import 'swiper/css/navigation';
|
|
5
|
+
import 'swiper/css/pagination';
|
|
6
|
+
type RowItem = {
|
|
7
|
+
[key: string]: number | string;
|
|
8
|
+
};
|
|
9
|
+
type PageTypes = {
|
|
10
|
+
count?: number;
|
|
11
|
+
metric: string[];
|
|
12
|
+
groupBys: GroupByItem[];
|
|
13
|
+
reportType: number;
|
|
14
|
+
tableData: TableData;
|
|
15
|
+
baseData: RowItem[];
|
|
16
|
+
columnConfigMap: {
|
|
17
|
+
[key: string]: ColumnConfig;
|
|
18
|
+
};
|
|
19
|
+
sqlFormatMap?: {
|
|
20
|
+
[key: string]: SqlMetaConfig;
|
|
21
|
+
};
|
|
22
|
+
cardSize?: string;
|
|
23
|
+
height?: number;
|
|
24
|
+
};
|
|
25
|
+
declare const _default: React.NamedExoticComponent<PageTypes>;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/business/YkCharts/Pies.tsx
|
|
30
|
+
var Pies_exports = {};
|
|
31
|
+
__export(Pies_exports, {
|
|
32
|
+
default: () => Pies_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Pies_exports);
|
|
35
|
+
var import_antd = require("antd");
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_utils = require("./utils");
|
|
38
|
+
var import_css = require("swiper/css");
|
|
39
|
+
var import_navigation = require("swiper/css/navigation");
|
|
40
|
+
var import_pagination = require("swiper/css/pagination");
|
|
41
|
+
var import_modules = require("swiper/modules");
|
|
42
|
+
var import_react2 = require("swiper/react");
|
|
43
|
+
var import_index_module = __toESM(require("./index.module.less"));
|
|
44
|
+
var import_Pie = __toESM(require("./Pie"));
|
|
45
|
+
var FULL_DATA_MAX_COMBINATIONS = 2e3;
|
|
46
|
+
var MAX_SECTORS = 500;
|
|
47
|
+
var mergeData = (data, metric, isDistribution, maxSectors = MAX_SECTORS) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const byName = /* @__PURE__ */ new Map();
|
|
50
|
+
for (let i = 0; i < data.length; i++) {
|
|
51
|
+
const item = data[i];
|
|
52
|
+
if (isDistribution ? item.name !== metric : item.metricName !== metric)
|
|
53
|
+
continue;
|
|
54
|
+
const name = item.name.startsWith(item.metricName) ? item.name.slice(item.metricName.length + 1).trim() : item.name;
|
|
55
|
+
const val = Number(item.value) || 0;
|
|
56
|
+
const existing = byName.get(name);
|
|
57
|
+
if (existing) {
|
|
58
|
+
existing.value += val;
|
|
59
|
+
} else {
|
|
60
|
+
byName.set(name, {
|
|
61
|
+
name,
|
|
62
|
+
value: val,
|
|
63
|
+
format: item.format,
|
|
64
|
+
formattedValue: (0, import_utils.formatValue)(val, (_a = item.format) == null ? void 0 : _a.format),
|
|
65
|
+
...isDistribution ? { metricName: item.name } : {}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
let result = Array.from(byName.values()).map((r) => {
|
|
70
|
+
var _a2;
|
|
71
|
+
return {
|
|
72
|
+
...r,
|
|
73
|
+
formattedValue: (0, import_utils.formatValue)(r.value, (_a2 = r.format) == null ? void 0 : _a2.format)
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
result.sort((a, b) => b.value - a.value);
|
|
77
|
+
if (result.length > maxSectors) {
|
|
78
|
+
import_antd.message.warning(`数据量过大,仅绘制前 ${maxSectors} 条数据`);
|
|
79
|
+
result = result.slice(0, maxSectors);
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
};
|
|
83
|
+
var Pies = ({
|
|
84
|
+
count,
|
|
85
|
+
// 指标显示数量
|
|
86
|
+
metric,
|
|
87
|
+
// 指标
|
|
88
|
+
groupBys,
|
|
89
|
+
// 维度
|
|
90
|
+
cardSize = "middle",
|
|
91
|
+
// 卡片大小
|
|
92
|
+
tableData,
|
|
93
|
+
// 表格数据
|
|
94
|
+
baseData,
|
|
95
|
+
// 基础数据
|
|
96
|
+
columnConfigMap,
|
|
97
|
+
// 列配置
|
|
98
|
+
sqlFormatMap,
|
|
99
|
+
// 列配置(用于SQL可视化中的格式化处理,SQL中的格式化走了另一套逻辑)
|
|
100
|
+
reportType,
|
|
101
|
+
// 分析模型
|
|
102
|
+
height
|
|
103
|
+
}) => {
|
|
104
|
+
const { x = [], table_head = [], table_body = [], x_field, group_by } = tableData;
|
|
105
|
+
const useMetric = (0, import_react.useMemo)(() => {
|
|
106
|
+
if (metric.length > 0) {
|
|
107
|
+
return metric;
|
|
108
|
+
} else {
|
|
109
|
+
return tableData.metric;
|
|
110
|
+
}
|
|
111
|
+
}, [metric]);
|
|
112
|
+
const fullData = (0, import_react.useMemo)(() => {
|
|
113
|
+
if (!metric || metric.length === 0) {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
if (x.length === 0 && table_head.indexOf(x_field) === -1 && reportType === 4) {
|
|
117
|
+
return metric.map((m) => ({
|
|
118
|
+
x: "合计",
|
|
119
|
+
name: m,
|
|
120
|
+
metricName: m,
|
|
121
|
+
format: columnConfigMap[m],
|
|
122
|
+
value: baseData.reduce((sum, item) => sum + (Number(item[m]) || 0), 0)
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
const index = table_head.indexOf(x_field);
|
|
126
|
+
if (group_by && group_by.length > 0) {
|
|
127
|
+
if (Array.isArray(groupBys) && groupBys.some((g) => Array.isArray(g.selected) && g.selected.length === 0) && reportType !== 4) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
const validGroupBys = groupBys.filter((g) => Array.isArray(g.selected) && g.selected.length > 0);
|
|
131
|
+
const validGroupByKeys = validGroupBys.map((g) => g.key);
|
|
132
|
+
const onlyOneMetric = metric.length === 1;
|
|
133
|
+
if (!baseData || baseData.length === 0) {
|
|
134
|
+
return [];
|
|
135
|
+
}
|
|
136
|
+
const filteredBaseData = baseData.filter((item) => {
|
|
137
|
+
return validGroupBys.every((g) => {
|
|
138
|
+
const itemValue = String(item[g.key] ?? "");
|
|
139
|
+
return g.selected.includes(itemValue);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
const isDistributionTotal = reportType === 4 && validGroupBys.length === 0;
|
|
143
|
+
if (isDistributionTotal) {
|
|
144
|
+
const xValues2 = x.length > 0 ? x : [...new Set(filteredBaseData.map((item) => String(item[x_field] ?? "")))];
|
|
145
|
+
const chartData2 = [];
|
|
146
|
+
xValues2.forEach((xVal) => {
|
|
147
|
+
metric.forEach((cat) => {
|
|
148
|
+
const value = filteredBaseData.filter((item) => String(item[x_field] ?? "") === xVal).reduce((sum, item) => sum + (Number(item[cat]) || 0), 0);
|
|
149
|
+
chartData2.push({
|
|
150
|
+
[x_field]: xVal,
|
|
151
|
+
x: xVal,
|
|
152
|
+
name: cat,
|
|
153
|
+
metricName: cat,
|
|
154
|
+
value,
|
|
155
|
+
format: columnConfigMap[cat]
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
return chartData2;
|
|
160
|
+
}
|
|
161
|
+
const dataIndexMap = /* @__PURE__ */ new Map();
|
|
162
|
+
const existingCombinations = /* @__PURE__ */ new Map();
|
|
163
|
+
const getName = (category, groupByObj) => {
|
|
164
|
+
if (onlyOneMetric) {
|
|
165
|
+
return group_by.map((g) => groupByObj[g]).join(",");
|
|
166
|
+
}
|
|
167
|
+
return [category, ...group_by.map((g) => groupByObj[g]).filter(Boolean)].join(",");
|
|
168
|
+
};
|
|
169
|
+
filteredBaseData.forEach((item) => {
|
|
170
|
+
const groupByValues = validGroupByKeys.map((key) => String(item[key] ?? "")).join("|");
|
|
171
|
+
metric.forEach((cat) => {
|
|
172
|
+
const key = `${item[x_field]}|${groupByValues}|${cat}`;
|
|
173
|
+
dataIndexMap.set(key, item);
|
|
174
|
+
const combinationKey = `${groupByValues}|${cat}`;
|
|
175
|
+
if (!existingCombinations.has(combinationKey)) {
|
|
176
|
+
const groupByObj = { category: cat };
|
|
177
|
+
validGroupByKeys.forEach((gKey) => {
|
|
178
|
+
groupByObj[gKey] = item[gKey];
|
|
179
|
+
});
|
|
180
|
+
const name = getName(cat, groupByObj);
|
|
181
|
+
existingCombinations.set(combinationKey, { groupByValues, category: cat, name });
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
const xValues = x.length > 0 ? x : [...new Set(filteredBaseData.map((item) => String(item[x_field] ?? "")))];
|
|
186
|
+
const combinationsList = Array.from(existingCombinations.values());
|
|
187
|
+
const getSumForCombination = (xVal, groupByValues, category) => filteredBaseData.filter(
|
|
188
|
+
(item) => String(item[x_field] ?? "") === xVal && validGroupByKeys.map((k) => String(item[k] ?? "")).join("|") === groupByValues
|
|
189
|
+
).reduce((sum, item) => sum + (Number(item[category]) || 0), 0);
|
|
190
|
+
if (combinationsList.length > FULL_DATA_MAX_COMBINATIONS) {
|
|
191
|
+
const withSum = combinationsList.map(({ groupByValues, category, name }) => {
|
|
192
|
+
let sum = 0;
|
|
193
|
+
for (let i = 0; i < xValues.length; i++) {
|
|
194
|
+
sum += getSumForCombination(xValues[i], groupByValues, category);
|
|
195
|
+
}
|
|
196
|
+
return { groupByValues, category, name, sum };
|
|
197
|
+
});
|
|
198
|
+
withSum.sort((a, b) => b.sum - a.sum);
|
|
199
|
+
combinationsList.length = 0;
|
|
200
|
+
for (let i = 0; i < FULL_DATA_MAX_COMBINATIONS && i < withSum.length; i++) {
|
|
201
|
+
combinationsList.push({
|
|
202
|
+
groupByValues: withSum[i].groupByValues,
|
|
203
|
+
category: withSum[i].category,
|
|
204
|
+
name: withSum[i].name
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const getSumAndSample = (xVal, groupByValues, category) => {
|
|
209
|
+
const matches = filteredBaseData.filter(
|
|
210
|
+
(item) => String(item[x_field] ?? "") === xVal && validGroupByKeys.map((k) => String(item[k] ?? "")).join("|") === groupByValues
|
|
211
|
+
);
|
|
212
|
+
const value = matches.reduce((sum, item) => sum + (Number(item[category]) || 0), 0);
|
|
213
|
+
const sample = matches[0];
|
|
214
|
+
return { value, sample };
|
|
215
|
+
};
|
|
216
|
+
const chartData = [];
|
|
217
|
+
combinationsList.forEach(({ groupByValues, category, name }) => {
|
|
218
|
+
xValues.forEach((xVal) => {
|
|
219
|
+
const { value, sample } = getSumAndSample(xVal, groupByValues, category);
|
|
220
|
+
chartData.push({
|
|
221
|
+
[x_field]: xVal,
|
|
222
|
+
...validGroupByKeys.reduce((acc, k) => ({ ...acc, [k]: sample == null ? void 0 : sample[k] }), {}),
|
|
223
|
+
x: xVal,
|
|
224
|
+
name,
|
|
225
|
+
metricName: category,
|
|
226
|
+
value: Number(value) || 0,
|
|
227
|
+
format: columnConfigMap[category]
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
return chartData;
|
|
232
|
+
} else {
|
|
233
|
+
const chartData = [];
|
|
234
|
+
metric.forEach((m) => {
|
|
235
|
+
x.forEach((item) => {
|
|
236
|
+
const row = table_body.find((d) => d[index] === item);
|
|
237
|
+
const obj = {
|
|
238
|
+
x: item,
|
|
239
|
+
name: m,
|
|
240
|
+
metricName: m,
|
|
241
|
+
format: columnConfigMap[m]
|
|
242
|
+
};
|
|
243
|
+
table_head.forEach((key, i) => {
|
|
244
|
+
obj[key] = row ? row[i] : 0;
|
|
245
|
+
});
|
|
246
|
+
obj.value = obj[m];
|
|
247
|
+
chartData.push(obj);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
return chartData;
|
|
251
|
+
}
|
|
252
|
+
}, [baseData, metric, groupBys, reportType]);
|
|
253
|
+
const series = (0, import_react.useMemo)(() => {
|
|
254
|
+
return useMetric.map((m) => {
|
|
255
|
+
var _a, _b;
|
|
256
|
+
const pieData = mergeData(fullData, m);
|
|
257
|
+
return {
|
|
258
|
+
name: m,
|
|
259
|
+
type: "pie",
|
|
260
|
+
radius: ["50%", "70%"],
|
|
261
|
+
label: {
|
|
262
|
+
show: pieData.length <= 1 ? false : true,
|
|
263
|
+
textStyle: {
|
|
264
|
+
color: "#666"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
data: pieData,
|
|
268
|
+
...sqlFormatMap && ((_a = sqlFormatMap == null ? void 0 : sqlFormatMap[m]) == null ? void 0 : _a.format) && {
|
|
269
|
+
format: (_b = sqlFormatMap == null ? void 0 : sqlFormatMap[m]) == null ? void 0 : _b.format
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
});
|
|
273
|
+
}, [fullData, metric, count, groupBys]);
|
|
274
|
+
const distributionPie = (0, import_react.useMemo)(() => {
|
|
275
|
+
const isTotalCase = x.length === 0 && fullData.length > 0 && fullData.every((d) => d.x === "合计") && reportType === 4;
|
|
276
|
+
if (isTotalCase) {
|
|
277
|
+
const data2 = fullData.map((d) => {
|
|
278
|
+
var _a;
|
|
279
|
+
return {
|
|
280
|
+
name: d.name,
|
|
281
|
+
value: Number(d.value) || 0,
|
|
282
|
+
format: d.format,
|
|
283
|
+
formattedValue: (0, import_utils.formatValue)(Number(d.value) || 0, (_a = d.format) == null ? void 0 : _a.format)
|
|
284
|
+
};
|
|
285
|
+
});
|
|
286
|
+
return {
|
|
287
|
+
name: "",
|
|
288
|
+
type: "pie",
|
|
289
|
+
radius: ["50%", "70%"],
|
|
290
|
+
label: { textStyle: { color: "#666" } },
|
|
291
|
+
data: data2
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
const firstPointX = x[0];
|
|
295
|
+
if (firstPointX === void 0)
|
|
296
|
+
return [];
|
|
297
|
+
const firstPointData = fullData.filter((d) => d.x === firstPointX);
|
|
298
|
+
const sortedData = reportType === 4 ? firstPointData : firstPointData.sort((a, b) => Number(b.value) - Number(a.value));
|
|
299
|
+
const uniqueNames = [...new Set(sortedData.map((d) => d.name))];
|
|
300
|
+
const sortedNames = reportType === 4 ? uniqueNames : count ? uniqueNames.slice(0, count) : uniqueNames;
|
|
301
|
+
const data = sortedNames.map((item) => {
|
|
302
|
+
return {
|
|
303
|
+
...mergeData(fullData, item, true)[0],
|
|
304
|
+
name: item
|
|
305
|
+
};
|
|
306
|
+
});
|
|
307
|
+
return {
|
|
308
|
+
name: "",
|
|
309
|
+
type: "pie",
|
|
310
|
+
radius: ["50%", "70%"],
|
|
311
|
+
label: {
|
|
312
|
+
textStyle: {
|
|
313
|
+
color: "#666"
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
data
|
|
317
|
+
};
|
|
318
|
+
}, [useMetric, fullData, reportType, groupBys, x]);
|
|
319
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, fullData.length > 0 ? /* @__PURE__ */ import_react.default.createElement("div", { className: import_index_module.default.pieLegend, style: { height: height || "100%", width: "100%" } }, reportType === 4 ? (
|
|
320
|
+
// 分布分析的饼图
|
|
321
|
+
/* @__PURE__ */ import_react.default.createElement(import_Pie.default, { item: distributionPie })
|
|
322
|
+
) : series && series.length > 1 ? /* @__PURE__ */ import_react.default.createElement(
|
|
323
|
+
import_react2.Swiper,
|
|
324
|
+
{
|
|
325
|
+
modules: [import_modules.Navigation, import_modules.Pagination],
|
|
326
|
+
navigation: true,
|
|
327
|
+
slidesPerView: cardSize === "large" ? 2 : 1,
|
|
328
|
+
spaceBetween: 10,
|
|
329
|
+
slidesPerGroup: cardSize === "large" ? 2 : 1,
|
|
330
|
+
className: import_index_module.default.pieSlider,
|
|
331
|
+
style: { height: "100%" }
|
|
332
|
+
},
|
|
333
|
+
series == null ? void 0 : series.map((item) => /* @__PURE__ */ import_react.default.createElement(import_react2.SwiperSlide, { key: item.name, className: import_index_module.default.pieSlideItem, tabIndex: -1 }, /* @__PURE__ */ import_react.default.createElement(import_Pie.default, { item })))
|
|
334
|
+
) : series == null ? void 0 : series.map((item) => /* @__PURE__ */ import_react.default.createElement("div", { key: item.name, style: { height: height || "100%", width: "100%", minHeight: 220 } }, /* @__PURE__ */ import_react.default.createElement(import_Pie.default, { item })))) : /* @__PURE__ */ import_react.default.createElement(import_antd.Empty, { className: import_index_module.default.empty, description: "暂无数据", image: import_antd.Empty.PRESENTED_IMAGE_SIMPLE }));
|
|
335
|
+
};
|
|
336
|
+
var Pies_default = (0, import_react.memo)(Pies);
|
|
337
|
+
//# sourceMappingURL=Pies.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/business/YkCharts/Pies.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Empty, message } from 'antd';\nimport React, { type FC, memo, useMemo } from 'react';\nimport type { ColumnConfig, GroupByItem, SqlMetaConfig, TableData } from './typing';\nimport { formatValue } from './utils';\nimport 'swiper/css';\nimport 'swiper/css/navigation';\nimport 'swiper/css/pagination';\nimport { Navigation, Pagination } from 'swiper/modules';\nimport { Swiper, SwiperSlide } from 'swiper/react';\nimport styles from './index.module.less';\nimport Pie from './Pie';\n\ntype RowItem = {\n [key: string]: number | string;\n};\n\n// 限制 fullData 组合数量与单饼扇区数,防止维度和选项过多时卡死\nconst FULL_DATA_MAX_COMBINATIONS = 2000;\nconst MAX_SECTORS = 500;\n\ntype PageTypes = {\n count?: number;\n metric: string[];\n groupBys: GroupByItem[];\n reportType: number;\n tableData: TableData;\n baseData: RowItem[];\n columnConfigMap: { [key: string]: ColumnConfig };\n sqlFormatMap?: { [key: string]: SqlMetaConfig }; // 列配置(用于SQL可视化中的格式化处理,SQL中的格式化走了另一套逻辑)\n cardSize?: string;\n height?: number;\n};\n\n// 处理饼图数据(用 Map 按 name 聚合,O(n) 避免大数据量时 O(n²) 卡顿)\nconst mergeData = (data: any[], metric: string, isDistribution?: boolean, maxSectors = MAX_SECTORS) => {\n const byName = new Map<\n string,\n { name: string; value: number; format: any; formattedValue?: string; metricName?: string }\n >();\n for (let i = 0; i < data.length; i++) {\n const item = data[i];\n // 分布分析时 sortedNames 为完整 name(如 \"(-∞, 1),IOS\"),需按 name 匹配;否则按 metricName 匹配\n if (isDistribution ? item.name !== metric : item.metricName !== metric) continue;\n const name = item.name.startsWith(item.metricName) ? item.name.slice(item.metricName.length + 1).trim() : item.name;\n const val = Number(item.value) || 0;\n const existing = byName.get(name);\n if (existing) {\n existing.value += val;\n } else {\n byName.set(name, {\n name,\n value: val,\n format: item.format,\n formattedValue: formatValue(val, item.format?.format),\n ...(isDistribution ? { metricName: item.name } : {}),\n });\n }\n }\n let result = Array.from(byName.values()).map((r) => ({\n ...r,\n formattedValue: formatValue(r.value, r.format?.format),\n }));\n result.sort((a, b) => b.value - a.value);\n if (result.length > maxSectors) {\n message.warning(`数据量过大,仅绘制前 ${maxSectors} 条数据`);\n result = result.slice(0, maxSectors);\n }\n return result;\n};\n\nconst Pies: FC<PageTypes> = ({\n count, // 指标显示数量\n metric, // 指标\n groupBys, // 维度\n cardSize = 'middle', // 卡片大小\n tableData, // 表格数据\n baseData, // 基础数据\n columnConfigMap, // 列配置\n sqlFormatMap, // 列配置(用于SQL可视化中的格式化处理,SQL中的格式化走了另一套逻辑)\n reportType, // 分析模型\n height,\n}) => {\n const { x = [], table_head = [], table_body = [], x_field, group_by } = tableData;\n\n const useMetric = useMemo(() => {\n if (metric.length > 0) {\n return metric;\n } else {\n return tableData.metric;\n }\n }, [metric]);\n\n const fullData = useMemo(() => {\n if (!metric || metric.length === 0) {\n return [];\n }\n // 分布分析的日期选择合计时,需要特殊处理(name 用 '合计' 便于饼图显示;避免 mergeData 把 name 裁成空串)\n if (x.length === 0 && table_head.indexOf(x_field) === -1 && reportType === 4) {\n return metric.map((m) => ({\n x: '合计',\n name: m,\n metricName: m,\n format: columnConfigMap[m],\n value: baseData.reduce((sum, item) => sum + (Number(item[m]) || 0), 0),\n }));\n }\n // x_field 在 table_head 中的索引\n const index = table_head.indexOf(x_field);\n // 存在维度时的数据处理(参照 Bar:从 baseData 提取实际组合,不做笛卡尔积)\n if (group_by && group_by.length > 0) {\n if (\n Array.isArray(groupBys) &&\n groupBys.some((g) => Array.isArray(g.selected) && g.selected.length === 0) &&\n reportType !== 4 // 分布分析时,维度为空代表选了总体\n ) {\n return [];\n }\n const validGroupBys = groupBys.filter((g) => Array.isArray(g.selected) && g.selected.length > 0);\n const validGroupByKeys = validGroupBys.map((g) => g.key);\n const onlyOneMetric = metric.length === 1;\n if (!baseData || baseData.length === 0) {\n return [];\n }\n const filteredBaseData = baseData.filter((item) => {\n return validGroupBys.every((g) => {\n const itemValue = String(item[g.key] ?? '');\n return g.selected.includes(itemValue);\n });\n });\n // 分布分析且维度 selected 全为空:按「总体」合计,对每个 (x, category) 在 filteredBaseData 上求和\n const isDistributionTotal = reportType === 4 && validGroupBys.length === 0;\n if (isDistributionTotal) {\n const xValues = x.length > 0 ? x : [...new Set(filteredBaseData.map((item) => String(item[x_field] ?? '')))];\n const chartData: any[] = [];\n xValues.forEach((xVal) => {\n metric.forEach((cat) => {\n const value = filteredBaseData\n .filter((item) => String(item[x_field] ?? '') === xVal)\n .reduce((sum, item) => sum + (Number(item[cat]) || 0), 0);\n chartData.push({\n [x_field]: xVal,\n x: xVal,\n name: cat,\n metricName: cat,\n value,\n format: columnConfigMap[cat],\n });\n });\n });\n return chartData;\n }\n const dataIndexMap = new Map<string, RowItem>();\n const existingCombinations = new Map<string, { groupByValues: string; category: string; name: string }>();\n const getName = (category: string, groupByObj: Record<string, string | number>) => {\n if (onlyOneMetric) {\n return group_by.map((g) => groupByObj[g]).join(',');\n }\n return [category, ...group_by.map((g) => groupByObj[g]).filter(Boolean)].join(',');\n };\n filteredBaseData.forEach((item) => {\n const groupByValues = validGroupByKeys.map((key) => String(item[key] ?? '')).join('|');\n metric.forEach((cat) => {\n const key = `${item[x_field]}|${groupByValues}|${cat}`;\n dataIndexMap.set(key, item);\n const combinationKey = `${groupByValues}|${cat}`;\n if (!existingCombinations.has(combinationKey)) {\n const groupByObj: Record<string, string | number> = { category: cat };\n validGroupByKeys.forEach((gKey) => {\n groupByObj[gKey] = item[gKey];\n });\n const name = getName(cat, groupByObj);\n existingCombinations.set(combinationKey, { groupByValues, category: cat, name });\n }\n });\n });\n // x 为空时(如仅分组、无 x 轴)从数据中取 x_field 的唯一值,否则 dataIndexMap 的 key 对不上\n const xValues = x.length > 0 ? x : [...new Set(filteredBaseData.map((item) => String(item[x_field] ?? '')))];\n const combinationsList = Array.from(existingCombinations.values());\n // 按 (xVal, groupByValues) 聚合:未选中的维度会多行共用一个 groupByValues,需求和而非取单条\n const getSumForCombination = (xVal: string, groupByValues: string, category: string) =>\n filteredBaseData\n .filter(\n (item) =>\n String(item[x_field] ?? '') === xVal &&\n validGroupByKeys.map((k) => String(item[k] ?? '')).join('|') === groupByValues,\n )\n .reduce((sum, item) => sum + (Number(item[category]) || 0), 0);\n // 按该组合在所有 x 上的合计排序,只保留前 N 个,避免维度和选项过多时 fullData 爆炸\n if (combinationsList.length > FULL_DATA_MAX_COMBINATIONS) {\n const withSum = combinationsList.map(({ groupByValues, category, name }) => {\n let sum = 0;\n for (let i = 0; i < xValues.length; i++) {\n sum += getSumForCombination(xValues[i], groupByValues, category);\n }\n return { groupByValues, category, name, sum };\n });\n withSum.sort((a, b) => b.sum - a.sum);\n combinationsList.length = 0;\n for (let i = 0; i < FULL_DATA_MAX_COMBINATIONS && i < withSum.length; i++) {\n combinationsList.push({\n groupByValues: withSum[i].groupByValues,\n category: withSum[i].category,\n name: withSum[i].name,\n });\n }\n }\n const getSumAndSample = (xVal: string, groupByValues: string, category: string) => {\n const matches = filteredBaseData.filter(\n (item) =>\n String(item[x_field] ?? '') === xVal &&\n validGroupByKeys.map((k) => String(item[k] ?? '')).join('|') === groupByValues,\n );\n const value = matches.reduce((sum, item) => sum + (Number(item[category]) || 0), 0);\n const sample = matches[0];\n return { value, sample };\n };\n const chartData: any[] = [];\n combinationsList.forEach(({ groupByValues, category, name }) => {\n xValues.forEach((xVal) => {\n const { value, sample } = getSumAndSample(xVal, groupByValues, category);\n chartData.push({\n [x_field]: xVal,\n ...validGroupByKeys.reduce((acc, k) => ({ ...acc, [k]: sample?.[k] }), {}),\n x: xVal,\n name,\n metricName: category,\n value: Number(value) || 0,\n format: columnConfigMap[category],\n });\n });\n });\n return chartData;\n } else {\n const chartData: any[] = [];\n metric.forEach((m) => {\n x.forEach((item) => {\n const row = table_body.find((d) => d[index] === item);\n const obj: any = {\n x: item,\n name: m,\n metricName: m,\n format: columnConfigMap[m],\n };\n table_head.forEach((key, i) => {\n obj[key] = row ? row[i] : 0;\n });\n obj.value = obj[m];\n chartData.push(obj);\n });\n });\n return chartData;\n }\n }, [baseData, metric, groupBys, reportType]);\n\n // 获取series\n const series = useMemo(() => {\n return useMetric.map((m) => {\n const pieData = mergeData(fullData, m);\n return {\n name: m,\n type: 'pie',\n radius: ['50%', '70%'],\n label: {\n show: pieData.length <= 1 ? false : true,\n textStyle: {\n color: '#666',\n },\n },\n data: pieData,\n ...(sqlFormatMap &&\n sqlFormatMap?.[m]?.format && {\n format: sqlFormatMap?.[m]?.format,\n }),\n };\n });\n }, [fullData, metric, count, groupBys]);\n\n // 分布分析的饼图\n const distributionPie = useMemo(() => {\n // 日期选择合计:x 为空,fullData 为「合计」数据,直接用它建一张饼图\n const isTotalCase =\n x.length === 0 && fullData.length > 0 && fullData.every((d) => d.x === '合计') && reportType === 4;\n if (isTotalCase) {\n const data = fullData.map((d) => ({\n name: d.name,\n value: Number(d.value) || 0,\n format: d.format,\n formattedValue: formatValue(Number(d.value) || 0, (d as any).format?.format),\n }));\n return {\n name: '',\n type: 'pie',\n radius: ['50%', '70%'],\n label: { textStyle: { color: '#666' } },\n data,\n };\n }\n const firstPointX = x[0];\n if (firstPointX === undefined) return [];\n const firstPointData = fullData.filter((d) => d.x === firstPointX);\n const sortedData =\n reportType === 4 ? firstPointData : firstPointData.sort((a, b) => Number(b.value) - Number(a.value));\n // 直接从数据中提取名称\n const uniqueNames = [...new Set(sortedData.map((d) => d.name))];\n // 当分析模型为分布分析时,series的顺序直接按照metric的顺序\n const sortedNames = reportType === 4 ? uniqueNames : count ? uniqueNames.slice(0, count) : uniqueNames;\n const data = sortedNames.map((item) => {\n return {\n ...mergeData(fullData, item, true)[0],\n name: item,\n };\n });\n return {\n name: '',\n type: 'pie',\n radius: ['50%', '70%'],\n label: {\n textStyle: {\n color: '#666',\n },\n },\n data: data,\n };\n }, [useMetric, fullData, reportType, groupBys, x]);\n\n return (\n <>\n {fullData.length > 0 ? (\n <div className={styles.pieLegend} style={{ height: height || '100%', width: '100%' }}>\n {reportType === 4 ? (\n // 分布分析的饼图\n <Pie item={distributionPie} />\n ) : series && series.length > 1 ? (\n <Swiper\n modules={[Navigation, Pagination]}\n navigation\n slidesPerView={cardSize === 'large' ? 2 : 1}\n spaceBetween={10}\n slidesPerGroup={cardSize === 'large' ? 2 : 1}\n className={styles.pieSlider}\n style={{ height: '100%' }}\n >\n {series?.map((item) => (\n <SwiperSlide key={item.name} className={styles.pieSlideItem} tabIndex={-1}>\n <Pie item={item} />\n </SwiperSlide>\n ))}\n </Swiper>\n ) : (\n series?.map((item) => (\n <div key={item.name} style={{ height: height || '100%', width: '100%', minHeight: 220 }}>\n <Pie item={item} />\n </div>\n ))\n )}\n </div>\n ) : (\n <Empty className={styles.empty} description='暂无数据' image={Empty.PRESENTED_IMAGE_SIMPLE} />\n )}\n </>\n );\n};\n\nexport default memo(Pies);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA+B;AAC/B,mBAA8C;AAE9C,mBAA4B;AAC5B,iBAAO;AACP,wBAAO;AACP,wBAAO;AACP,qBAAuC;AACvC,IAAAA,gBAAoC;AACpC,0BAAmB;AACnB,iBAAgB;AAOhB,IAAM,6BAA6B;AACnC,IAAM,cAAc;AAgBpB,IAAM,YAAY,CAAC,MAAa,QAAgB,gBAA0B,aAAa,gBAAgB;AAlCvG;AAmCE,QAAM,SAAS,oBAAI,IAGjB;AACF,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,OAAO,KAAK,CAAC;AAEnB,QAAI,iBAAiB,KAAK,SAAS,SAAS,KAAK,eAAe;AAAQ;AACxE,UAAM,OAAO,KAAK,KAAK,WAAW,KAAK,UAAU,IAAI,KAAK,KAAK,MAAM,KAAK,WAAW,SAAS,CAAC,EAAE,KAAK,IAAI,KAAK;AAC/G,UAAM,MAAM,OAAO,KAAK,KAAK,KAAK;AAClC,UAAM,WAAW,OAAO,IAAI,IAAI;AAChC,QAAI,UAAU;AACZ,eAAS,SAAS;AAAA,IACpB,OAAO;AACL,aAAO,IAAI,MAAM;AAAA,QACf;AAAA,QACA,OAAO;AAAA,QACP,QAAQ,KAAK;AAAA,QACb,oBAAgB,0BAAY,MAAK,UAAK,WAAL,mBAAa,MAAM;AAAA,QACpD,GAAI,iBAAiB,EAAE,YAAY,KAAK,KAAK,IAAI,CAAC;AAAA,MACpD,CAAC;AAAA,IACH;AAAA,EACF;AACA,MAAI,SAAS,MAA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