vue-devui 1.6.22 → 1.6.23
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/code-review/index.es.js +26 -13
- package/code-review/index.umd.js +20 -20
- package/package.json +1 -1
- package/types/code-review/src/code-review-types.d.ts +4 -0
- package/types/code-review/src/composables/use-code-review-comment.d.ts +1 -0
- package/types/code-review/src/composables/use-code-review-expand.d.ts +1 -1
- package/types/code-review/src/utils.d.ts +1 -1
- package/vue-devui.es.js +27 -14
- package/vue-devui.umd.js +39 -39
package/package.json
CHANGED
|
@@ -55,6 +55,10 @@ export declare const codeReviewProps: {
|
|
|
55
55
|
expandLoader: {
|
|
56
56
|
type: PropType<(interval: Array<number | undefined>, update: (code: string) => void) => void>;
|
|
57
57
|
};
|
|
58
|
+
options: {
|
|
59
|
+
type: PropType<Record<string, any>>;
|
|
60
|
+
default: () => {};
|
|
61
|
+
};
|
|
58
62
|
};
|
|
59
63
|
export type CodeReviewProps = ExtractPropTypes<typeof codeReviewProps>;
|
|
60
64
|
export interface CodeReviewContext {
|
|
@@ -11,6 +11,7 @@ export declare function useCodeReviewComment(reviewContentRef: Ref<HTMLElement>,
|
|
|
11
11
|
onMouseleave?: undefined;
|
|
12
12
|
};
|
|
13
13
|
updateCheckedLineClass: () => void;
|
|
14
|
+
clearCheckedLines: () => void;
|
|
14
15
|
onCommentMouseLeave: (e: MouseEvent) => void;
|
|
15
16
|
onCommentIconClick: (e: Event) => void;
|
|
16
17
|
onCommentKeyDown: () => void;
|
|
@@ -2,5 +2,5 @@ import type { Ref } from 'vue';
|
|
|
2
2
|
import type { CodeReviewProps } from '../code-review-types';
|
|
3
3
|
export declare function useCodeReviewExpand(reviewContentRef: Ref<HTMLElement>, props: CodeReviewProps): {
|
|
4
4
|
insertExpandButton: () => void;
|
|
5
|
-
onExpandButtonClick: (e: Event) => void;
|
|
5
|
+
onExpandButtonClick: (e: Event, options: Record<string, any>) => void;
|
|
6
6
|
};
|
|
@@ -4,7 +4,7 @@ export declare function insertIncrementLineToPage(referenceDom: HTMLElement, trN
|
|
|
4
4
|
export declare function ifRemoveExpandLineForDoubleColumn(expandDom: HTMLElement, newExpandDom: HTMLTableRowElement, direction: IncrementCodeInsertDirection): boolean;
|
|
5
5
|
export declare function ifRemoveExpandLine(expandDom: HTMLElement, newExpandDom: HTMLTableRowElement, direction: IncrementCodeInsertDirection): boolean;
|
|
6
6
|
export declare function updateExpandLineCount(expandDom: HTMLElement, newExpandDom: HTMLElement): void;
|
|
7
|
-
export declare function parseDiffCode(container: HTMLElement, code: string, outputFormat: OutputFormat, isAddCode?: boolean): void;
|
|
7
|
+
export declare function parseDiffCode(container: HTMLElement, code: string, outputFormat: OutputFormat, options: Record<string, any>, isAddCode?: boolean): void;
|
|
8
8
|
export declare function setLineNumberInDataset(trNode: HTMLElement, prevL: number, prevR: number, nextL: number, nextR: number): void;
|
|
9
9
|
export declare function updateExpandUpDownButton(trNode: HTMLElement): void;
|
|
10
10
|
export declare function updateLineNumberInDatasetForDoubleColumn(trNode: HTMLElement, expandThreshold: number, position: 'top' | 'bottom' | 'middle', updateExpandButton?: boolean): boolean;
|
package/vue-devui.es.js
CHANGED
|
@@ -17014,6 +17014,10 @@ const codeReviewProps = {
|
|
|
17014
17014
|
},
|
|
17015
17015
|
expandLoader: {
|
|
17016
17016
|
type: Function
|
|
17017
|
+
},
|
|
17018
|
+
options: {
|
|
17019
|
+
type: Object,
|
|
17020
|
+
default: () => ({})
|
|
17017
17021
|
}
|
|
17018
17022
|
};
|
|
17019
17023
|
const CodeReviewInjectionKey = Symbol("d-code-review");
|
|
@@ -17238,15 +17242,15 @@ function addClassToDiffCode(codeStrArr, theClassName) {
|
|
|
17238
17242
|
});
|
|
17239
17243
|
return newArray;
|
|
17240
17244
|
}
|
|
17241
|
-
function parseDiffCode(container, code, outputFormat, isAddCode = false) {
|
|
17245
|
+
function parseDiffCode(container, code, outputFormat, options, isAddCode = false) {
|
|
17242
17246
|
var _a;
|
|
17243
17247
|
const diff2HtmlUi = new Diff2HtmlUI(container, code, {
|
|
17244
17248
|
drawFileList: false,
|
|
17245
17249
|
matching: "lines",
|
|
17246
17250
|
outputFormat,
|
|
17247
17251
|
highlight: true,
|
|
17248
|
-
|
|
17249
|
-
|
|
17252
|
+
rawTemplates: TemplateMap[outputFormat],
|
|
17253
|
+
...options
|
|
17250
17254
|
});
|
|
17251
17255
|
if (outputFormat === "side-by-side") {
|
|
17252
17256
|
let diffHtmlStr = diff2HtmlUi.diffHtml;
|
|
@@ -17551,7 +17555,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
17551
17555
|
}
|
|
17552
17556
|
attachExpandUpDownButton(loadMoreLine.children[0], "down");
|
|
17553
17557
|
};
|
|
17554
|
-
const insertIncrementCodeForDoubleColumn = (code, direction, referenceDom) => {
|
|
17558
|
+
const insertIncrementCodeForDoubleColumn = (code, direction, referenceDom, options) => {
|
|
17555
17559
|
if (!referenceDom) {
|
|
17556
17560
|
return;
|
|
17557
17561
|
}
|
|
@@ -17560,7 +17564,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
17560
17564
|
}
|
|
17561
17565
|
const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
|
|
17562
17566
|
const container = document.createElement("div");
|
|
17563
|
-
parseDiffCode(container, prefix + code, outputFormat.value, true);
|
|
17567
|
+
parseDiffCode(container, prefix + code, outputFormat.value, options, true);
|
|
17564
17568
|
const trNodes = Array.from(container.querySelectorAll("tr"));
|
|
17565
17569
|
const expandLine = trNodes.find((element) => {
|
|
17566
17570
|
var _a;
|
|
@@ -17634,7 +17638,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
17634
17638
|
}
|
|
17635
17639
|
attachExpandUpDownButton(loadMoreLine.children[0], "down");
|
|
17636
17640
|
};
|
|
17637
|
-
const insertIncrementCode = (code, direction, referenceDom) => {
|
|
17641
|
+
const insertIncrementCode = (code, direction, referenceDom, options) => {
|
|
17638
17642
|
if (!referenceDom) {
|
|
17639
17643
|
return;
|
|
17640
17644
|
}
|
|
@@ -17643,7 +17647,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
17643
17647
|
}
|
|
17644
17648
|
const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
|
|
17645
17649
|
const container = document.createElement("div");
|
|
17646
|
-
parseDiffCode(container, prefix + code, outputFormat.value, true);
|
|
17650
|
+
parseDiffCode(container, prefix + code, outputFormat.value, options, true);
|
|
17647
17651
|
const trNodes = Array.from(container.querySelectorAll("tr"));
|
|
17648
17652
|
const expandLine = trNodes.find((element) => {
|
|
17649
17653
|
var _a;
|
|
@@ -17673,7 +17677,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
17673
17677
|
}
|
|
17674
17678
|
}
|
|
17675
17679
|
};
|
|
17676
|
-
const onExpandButtonClick = (e) => {
|
|
17680
|
+
const onExpandButtonClick = (e, options) => {
|
|
17677
17681
|
var _a, _b;
|
|
17678
17682
|
const composedPath = e.composedPath();
|
|
17679
17683
|
const expandIconDom = composedPath.find((element) => {
|
|
@@ -17686,7 +17690,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
17686
17690
|
const [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd] = getLineNumberFromDataset(expandIconDom, expandThreshold.value);
|
|
17687
17691
|
(_b = expandLoader == null ? void 0 : expandLoader.value) == null ? void 0 : _b.call(expandLoader, [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd], (code) => {
|
|
17688
17692
|
var _a2, _b2;
|
|
17689
|
-
outputFormat.value === "line-by-line" ? insertIncrementCode(code, direction, (_a2 = expandIconDom.parentElement) == null ? void 0 : _a2.parentElement) : insertIncrementCodeForDoubleColumn(code, direction, (_b2 = expandIconDom.parentElement) == null ? void 0 : _b2.parentElement);
|
|
17693
|
+
outputFormat.value === "line-by-line" ? insertIncrementCode(code, direction, (_a2 = expandIconDom.parentElement) == null ? void 0 : _a2.parentElement, options) : insertIncrementCodeForDoubleColumn(code, direction, (_b2 = expandIconDom.parentElement) == null ? void 0 : _b2.parentElement, options);
|
|
17690
17694
|
});
|
|
17691
17695
|
}
|
|
17692
17696
|
};
|
|
@@ -17705,14 +17709,14 @@ function useCodeReview(props, ctx2) {
|
|
|
17705
17709
|
diffFile.value = Diff2Html.parse(diff.value);
|
|
17706
17710
|
nextTick(() => {
|
|
17707
17711
|
if (inBrowser && !showBlob.value) {
|
|
17708
|
-
parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value);
|
|
17712
|
+
parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value, props.options);
|
|
17709
17713
|
allowExpand.value && insertExpandButton();
|
|
17710
17714
|
ctx2.emit("contentRefresh", JSON.parse(JSON.stringify(diffFile.value)));
|
|
17711
17715
|
}
|
|
17712
17716
|
});
|
|
17713
17717
|
};
|
|
17714
17718
|
const onContentClick = (e) => {
|
|
17715
|
-
onExpandButtonClick(e);
|
|
17719
|
+
onExpandButtonClick(e, props.options);
|
|
17716
17720
|
};
|
|
17717
17721
|
watch(showBlob, initDiffContent);
|
|
17718
17722
|
watch(outputFormat, initDiffContent);
|
|
@@ -18030,6 +18034,12 @@ function useCodeReviewComment(reviewContentRef, props, ctx2) {
|
|
|
18030
18034
|
}
|
|
18031
18035
|
}
|
|
18032
18036
|
};
|
|
18037
|
+
const clearCheckedLines = () => {
|
|
18038
|
+
currentLeftLineNumbers = [];
|
|
18039
|
+
currentRightLineNumbers = [];
|
|
18040
|
+
checkedLineCodeString = [];
|
|
18041
|
+
resetCommentClass();
|
|
18042
|
+
};
|
|
18033
18043
|
const mouseEvent = allowComment.value ? { onMousemove: onMouseMove, onMouseleave } : {};
|
|
18034
18044
|
window.addEventListener("scroll", resetLeftTop);
|
|
18035
18045
|
onUnmounted(() => {
|
|
@@ -18040,6 +18050,7 @@ function useCodeReviewComment(reviewContentRef, props, ctx2) {
|
|
|
18040
18050
|
commentTop,
|
|
18041
18051
|
mouseEvent,
|
|
18042
18052
|
updateCheckedLineClass,
|
|
18053
|
+
clearCheckedLines,
|
|
18043
18054
|
onCommentMouseLeave,
|
|
18044
18055
|
onCommentIconClick,
|
|
18045
18056
|
onCommentKeyDown,
|
|
@@ -18078,14 +18089,16 @@ var CodeReview = defineComponent({
|
|
|
18078
18089
|
unCommentKeyDown,
|
|
18079
18090
|
insertComment,
|
|
18080
18091
|
removeComment,
|
|
18081
|
-
updateCheckedLineClass
|
|
18092
|
+
updateCheckedLineClass,
|
|
18093
|
+
clearCheckedLines
|
|
18082
18094
|
} = useCodeReviewComment(reviewContentRef, props, ctx2);
|
|
18083
18095
|
onMounted(() => {
|
|
18084
18096
|
ctx2.emit("afterViewInit", {
|
|
18085
18097
|
toggleFold,
|
|
18086
18098
|
insertComment,
|
|
18087
18099
|
removeComment,
|
|
18088
|
-
updateCheckedLineClass
|
|
18100
|
+
updateCheckedLineClass,
|
|
18101
|
+
clearCheckedLines
|
|
18089
18102
|
});
|
|
18090
18103
|
onCommentKeyDown();
|
|
18091
18104
|
});
|
|
@@ -54127,7 +54140,7 @@ const installs = [
|
|
|
54127
54140
|
VirtualListInstall
|
|
54128
54141
|
];
|
|
54129
54142
|
var vueDevui = {
|
|
54130
|
-
version: "1.6.
|
|
54143
|
+
version: "1.6.23",
|
|
54131
54144
|
install(app) {
|
|
54132
54145
|
installs.forEach((p) => app.use(p));
|
|
54133
54146
|
}
|