diff --git a/packages/canyon-platform/src/components/CanyonReport/ShikiDetail.tsx b/packages/canyon-platform/src/components/CanyonReport/ShikiDetail.tsx
index 8f8637b8..44aa0213 100644
--- a/packages/canyon-platform/src/components/CanyonReport/ShikiDetail.tsx
+++ b/packages/canyon-platform/src/components/CanyonReport/ShikiDetail.tsx
@@ -87,41 +87,43 @@ const ShikiDetail = ({ defaultValue, filecoverage, theme }) => {
}
});
- createHighlighterCoreInstance().then(({ codeToHtml }) => {
- try {
- const res = codeToHtml(defaultValue, {
- lang: "javascript",
- theme: theme === "light" ? "light-plus" : "tokyo-night",
- decorations: mergeIntervals(
- [...statementDecorations, ...fnDecorations].filter((item) => {
- // defaultValue
- if (item[0] >= item[1]) {
- return false;
- } else if (item[1] > defaultValue.length) {
- return false;
- } else {
- return item[0] < item[1];
- }
+ useEffect(() => {
+ createHighlighterCoreInstance().then(({ codeToHtml }) => {
+ try {
+ const res = codeToHtml(defaultValue, {
+ lang: "javascript",
+ theme: theme === "light" ? "light-plus" : "tokyo-night",
+ decorations: mergeIntervals(
+ [...statementDecorations, ...fnDecorations].filter((item) => {
+ // defaultValue
+ if (item[0] >= item[1]) {
+ return false;
+ } else if (item[1] > defaultValue.length) {
+ return false;
+ } else {
+ return item[0] < item[1];
+ }
+ }),
+ ).map(([start, end]) => {
+ return {
+ start,
+ end,
+ properties: { class: "content-class-no-found" },
+ };
}),
- ).map(([start, end]) => {
- return {
- start,
- end,
- properties: { class: "content-class-no-found" },
- };
- }),
- });
- setContent(res);
- } catch (err) {
- console.log("覆盖率着色失败", err);
- const r = codeToHtml(defaultValue, {
- lang: "javascript",
- theme: theme === "light" ? "light-plus" : "tokyo-night",
- });
-
- setContent(r);
- }
- });
+ });
+ setContent(res);
+ } catch (err) {
+ console.log("覆盖率着色失败", err);
+ const r = codeToHtml(defaultValue, {
+ lang: "javascript",
+ theme: theme === "light" ? "light-plus" : "tokyo-night",
+ });
+
+ setContent(r);
+ }
+ });
+ }, []);
return (
diff --git a/packages/canyon-report/src/components/Report/Report.tsx b/packages/canyon-report/src/components/Report/Report.tsx
index 800d6eb6..e14ee876 100644
--- a/packages/canyon-report/src/components/Report/Report.tsx
+++ b/packages/canyon-report/src/components/Report/Report.tsx
@@ -15,8 +15,8 @@ const Report: FC
= ({
onSelect,
reportName,
}) => {
- const [keywords,setKeywords] = useState('');
- const [range,setRange] = useState([0,100]);
+ const [filenameKeywords, setFilenameKeywords] = useState("");
+ const [range, setRange] = useState([0, 100]);
const [showMode, setShowMode] = useState("tree");
const [loading, setLoading] = useState(false);
@@ -49,13 +49,20 @@ const Report: FC = ({
newonSelect(value);
}, []);
- const { treeDataSource, rootDataSource } = useMemo(() => {
+ const { treeDataSource, rootDataSource, listDataSource } = useMemo(() => {
+ // 1.过滤
+
+ const listDataSource = dataSource.filter((item) =>
+ item.path.toLowerCase().includes(filenameKeywords.toLowerCase()),
+ );
// @ts-ignore
- const summary = dataSource.reduce((acc: never, cur: never) => {
+ const summary = listDataSource
// @ts-ignore
- acc[cur.path] = cur;
- return acc;
- }, {});
+ .reduce((acc: never, cur: never) => {
+ // @ts-ignore
+ acc[cur.path] = cur;
+ return acc;
+ }, {});
// @ts-ignore
const aaaa = genSummaryTreeItem(value, summary);
@@ -70,12 +77,14 @@ const Report: FC = ({
path: aaaa.path,
...aaaa.summary,
},
+ listDataSource: listDataSource,
};
- }, [dataSource, value]);
+ }, [dataSource, value, filenameKeywords]);
return (
{
setShowMode(val);
@@ -85,6 +94,9 @@ const Report: FC = ({
return item.path.startsWith(value);
}).length
}
+ onChangeKeywords={(val) => {
+ setFilenameKeywords(val);
+ }}
/>
= ({
/>
) : (
)}
diff --git a/packages/canyon-report/src/components/Report/components/FileCoverageDetail.tsx b/packages/canyon-report/src/components/Report/components/FileCoverageDetail.tsx
index 27f3e7ac..4169ee12 100644
--- a/packages/canyon-report/src/components/Report/components/FileCoverageDetail.tsx
+++ b/packages/canyon-report/src/components/Report/components/FileCoverageDetail.tsx
@@ -13,12 +13,29 @@ const FileCoverageDetail: FC<{ fileContent: string }> = ({ fileContent }) => {
setHtmlContent(html);
});
}, [fileContent]);
+
+ const lines = fileContent.split("\n");
return (
-
+
+
+ {lines.map((lin, index) => {
+ return (
+
+ {index + 1}
+
+ );
+ })}
+
+
+
+
);
};
diff --git a/packages/canyon-report/src/components/Report/components/SummaryHeader.tsx b/packages/canyon-report/src/components/Report/components/SummaryHeader.tsx
index 6f65e4f4..189735e6 100644
--- a/packages/canyon-report/src/components/Report/components/SummaryHeader.tsx
+++ b/packages/canyon-report/src/components/Report/components/SummaryHeader.tsx
@@ -8,7 +8,6 @@ const SummaryNav: FC<{
value: string;
onClick: (value: string) => void;
}> = ({ value, onClick, reportName }) => {
- console.log(value, "value");
return (
void;
value: string;
-}> = ({ dataSource, onSelect, value }) => {
+ filenameKeywords: string;
+}> = ({ dataSource, onSelect, value, filenameKeywords }) => {
return (
{
return item.path.startsWith(value);
})}
+ rowKey={"path"}
columns={[
{
title: t("Files"),
@@ -42,7 +44,7 @@ const SummaryListTable: FC<{
>
diff --git a/packages/canyon-report/src/components/Report/components/SummaryTreeTable.tsx b/packages/canyon-report/src/components/Report/components/SummaryTreeTable.tsx
index 95e9ef23..032dbfa0 100644
--- a/packages/canyon-report/src/components/Report/components/SummaryTreeTable.tsx
+++ b/packages/canyon-report/src/components/Report/components/SummaryTreeTable.tsx
@@ -24,6 +24,7 @@ const CanyonReportTreeTable: FC<{
}}
>
void;
-}> = ({ total, showMode, onChangeShowMode }) => {
+ filenameKeywords: string;
+ onChangeShowMode: (mode: string) => void;
+ onChangeKeywords: (word: string) => void;
+}> = ({
+ total,
+ showMode,
+ onChangeShowMode,
+ onChangeKeywords,
+ filenameKeywords,
+}) => {
return (
diff --git a/packages/canyon-report/src/index.css b/packages/canyon-report/src/index.css
index 3acd034c..a0afd282 100644
--- a/packages/canyon-report/src/index.css
+++ b/packages/canyon-report/src/index.css
@@ -5,7 +5,11 @@
.shiki > code {
font-size: 12px;
- line-height: 20px;
+ line-height: 24px;
+}
+
+.line{
+ /*background-color: #0071c2;*/
}
a{