@canyonjs/report-component 0.0.5 → 0.0.6
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/dist/index.css +5 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -3
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -118,7 +118,8 @@
|
|
|
118
118
|
border-bottom: 1px solid #e0e0e0;
|
|
119
119
|
color: #333333;
|
|
120
120
|
font-size: 13px;
|
|
121
|
-
font-family:
|
|
121
|
+
font-family:
|
|
122
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
122
123
|
cursor: pointer;
|
|
123
124
|
text-align: left;
|
|
124
125
|
display: flex;
|
|
@@ -157,7 +158,8 @@
|
|
|
157
158
|
.canyonjs-report-html .canyon-changed-code-coverage-table-wrapper {
|
|
158
159
|
padding: 16px;
|
|
159
160
|
background: #ffffff;
|
|
160
|
-
font-family:
|
|
161
|
+
font-family:
|
|
162
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
161
163
|
overflow: auto;
|
|
162
164
|
max-height: 300px;
|
|
163
165
|
}
|
|
@@ -168,3 +170,4 @@
|
|
|
168
170
|
color: #007acc;
|
|
169
171
|
margin-bottom: 12px;
|
|
170
172
|
}
|
|
173
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ interface CanyonReportProps {
|
|
|
21
21
|
value: string;
|
|
22
22
|
dataSource: DataSourceItem[];
|
|
23
23
|
onSelect: (val: string) => Promise<FileDataResponse>;
|
|
24
|
+
/** 默认是否只展示变更的文件,默认为 false(非受控模式使用) */
|
|
25
|
+
defaultOnlyChange?: boolean;
|
|
26
|
+
/** 是否只展示变更的文件(受控模式) */
|
|
27
|
+
onlyChange?: boolean;
|
|
28
|
+
/** 当 onlyChange 状态改变时的回调(受控模式) */
|
|
29
|
+
onChangeOnlyChange?: (value: boolean) => void;
|
|
24
30
|
}
|
|
25
31
|
//#endregion
|
|
26
32
|
//#region src/CanyonReport.d.ts
|
package/dist/index.js
CHANGED
|
@@ -947,7 +947,7 @@ var TopControl_default = TopControl;
|
|
|
947
947
|
|
|
948
948
|
//#endregion
|
|
949
949
|
//#region src/CanyonReport.tsx
|
|
950
|
-
const CanyonReport = ({ value, name, dataSource, onSelect }) => {
|
|
950
|
+
const CanyonReport = ({ value, name, dataSource, onSelect, defaultOnlyChange = false, onlyChange: controlledOnlyChange, onChangeOnlyChange: controlledOnChangeOnlyChange }) => {
|
|
951
951
|
const [_isLoading, _setIsLoading] = useState(false);
|
|
952
952
|
const [filenameKeywords, setFilenameKeywords] = useState("");
|
|
953
953
|
const [showMode, setShowMode] = useState("tree");
|
|
@@ -962,10 +962,13 @@ const CanyonReport = ({ value, name, dataSource, onSelect }) => {
|
|
|
962
962
|
});
|
|
963
963
|
const [fileContent, setFileContent] = useState("");
|
|
964
964
|
const [fileCodeChange, setFileCodeChange] = useState([]);
|
|
965
|
-
const
|
|
965
|
+
const isControlled = controlledOnlyChange !== void 0 && controlledOnChangeOnlyChange !== void 0;
|
|
966
|
+
const [internalOnlyChange, setInternalOnlyChange] = useState(defaultOnlyChange);
|
|
967
|
+
const onlyChange = isControlled ? controlledOnlyChange : internalOnlyChange;
|
|
966
968
|
const rootClassName = useMemo(() => `report-scope-${Math.random().toString(36).slice(2, 9)} canyonjs-report-html`, []);
|
|
967
969
|
function onChangeOnlyChange(v) {
|
|
968
|
-
|
|
970
|
+
if (isControlled && controlledOnChangeOnlyChange) controlledOnChangeOnlyChange(v);
|
|
971
|
+
else setInternalOnlyChange(v);
|
|
969
972
|
}
|
|
970
973
|
const newOnSelect = useMemo(() => {
|
|
971
974
|
return async (val) => {
|