vue-devui 1.5.7 → 1.5.8
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/alert/index.es.js +13 -3
- package/alert/index.umd.js +11 -1
- package/avatar/index.es.js +10 -2
- package/avatar/index.umd.js +9 -1
- package/code-editor/index.es.js +13 -12
- package/code-editor/index.umd.js +5 -5
- package/code-review/index.es.js +357 -8
- package/code-review/index.umd.js +74 -19
- package/code-review/style.css +1 -1
- package/git-graph/index.es.js +6061 -0
- package/git-graph/index.umd.js +32 -0
- package/git-graph/package.json +8 -0
- package/global.d.ts +1 -0
- package/nuxt/components/GitGraph.js +2 -0
- package/nuxt/components/gitGraphProps.js +2 -0
- package/package.json +2 -1
- package/pagination/index.es.js +7 -1
- package/pagination/index.umd.js +7 -1
- package/select/index.es.js +7 -1
- package/select/index.umd.js +7 -1
- package/style.css +1 -1
- package/time-select/index.es.js +7 -1
- package/time-select/index.umd.js +7 -1
- package/types/avatar/src/components/icon-body.d.ts +1 -1
- package/types/code-editor/src/code-editor-types.d.ts +1 -1
- package/types/code-editor/src/code-editor.d.ts +1 -1
- package/types/code-editor/src/composables/use-code-editor.d.ts +2 -2
- package/types/code-review/src/code-review-types.d.ts +16 -0
- package/types/code-review/src/code-review.d.ts +10 -1
- package/types/code-review/src/components/code-review-icons.d.ts +4 -0
- package/types/code-review/src/composables/use-code-review-comment.d.ts +13 -0
- package/types/code-review/src/composables/use-code-review-expand.d.ts +5 -0
- package/types/code-review/src/composables/use-code-review.d.ts +2 -0
- package/types/code-review/src/const.d.ts +2 -0
- package/types/code-review/src/utils.d.ts +7 -0
- package/types/git-graph/index.d.ts +11 -0
- package/types/git-graph/src/git-graph-class.d.ts +43 -0
- package/types/git-graph/src/git-graph-types.d.ts +84 -0
- package/types/git-graph/src/git-graph.d.ts +10 -0
- package/types/git-graph/src/use-git-graph.d.ts +6 -0
- package/types/vue-devui.d.ts +2 -1
- package/vue-devui.es.js +1025 -29
- package/vue-devui.umd.js +139 -61
package/vue-devui.es.js
CHANGED
|
@@ -1137,7 +1137,13 @@ const AlertCloseIcon = () => createVNode("svg", {
|
|
|
1137
1137
|
"transform": "translate(-3.000000, -3.000000)",
|
|
1138
1138
|
"fill-rule": "nonzero"
|
|
1139
1139
|
}, [createVNode("path", {
|
|
1140
|
-
"d":
|
|
1140
|
+
"d": `M11.6426,3.19816936 C11.9239974,2.91574512 12.4131626,2.93784891 12.7352108,3.24751057 C13.0571998,3.5572302
|
|
1141
|
+
13.0901298,4.03723416 12.8087324,4.31965839 L9.14064666,7.99900183 L12.8087324,11.6803416 C13.0645482,11.9370909
|
|
1142
|
+
13.0605893,12.3571292 12.8158402,12.6640749 L12.7352108,12.7524894 C12.4131626,13.0621511 11.9239974,13.0842548
|
|
1143
|
+
11.6426,12.8018306 L8,9.14489021 L4.35740003,12.8018306 C4.10158422,13.05858 3.6740594,13.0636532 3.35648225,12.8298003
|
|
1144
|
+
L3.26478919,12.7524894 C2.94280021,12.4427698 2.90987023,11.9627658 3.19126762,11.6803416 L6.8583349,7.99900183
|
|
1145
|
+
L3.19126762,4.31965839 C2.93545181,4.06290908 2.93941068,3.64287076 3.18415975,3.3359251 L3.26478919,3.24751057
|
|
1146
|
+
C3.58683735,2.93784891 4.07600264,2.91574512 4.35740003,3.19816936 L8,6.85411161 L11.6426,3.19816936 Z`
|
|
1141
1147
|
}, null)])])]);
|
|
1142
1148
|
const ns$k = useNamespace("alert");
|
|
1143
1149
|
const AlertTypeIcon = (props) => createVNode("svg", {
|
|
@@ -1171,12 +1177,16 @@ const AlertTypeIcon = (props) => createVNode("svg", {
|
|
|
1171
1177
|
"fill-rule": "evenodd"
|
|
1172
1178
|
}, [createVNode("path", {
|
|
1173
1179
|
"class": "warning-outer",
|
|
1174
|
-
"d":
|
|
1180
|
+
"d": `M8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158
|
|
1181
|
+
C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343
|
|
1182
|
+
C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838
|
|
1183
|
+
7.98165058,-0.153569987 8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 Z`
|
|
1175
1184
|
}, null), createVNode("path", {
|
|
1176
1185
|
"class": "warning-inner",
|
|
1177
1186
|
"stroke-width": "0.3",
|
|
1178
1187
|
"fill-rule": "nonzero",
|
|
1179
|
-
"d":
|
|
1188
|
+
"d": `M8.87894737,13 L7.08947368,13 L7.08947368,11.2105263 L8.87894737,11.2105263 L8.87894737,13 Z M8.62102372,9.86842105
|
|
1189
|
+
L7.32800539,9.86842105 L7,4.5 L8.96842105,4.5 L8.62102372,9.86842105 Z`
|
|
1180
1190
|
}, null)]);
|
|
1181
1191
|
case "info":
|
|
1182
1192
|
return createVNode("g", {
|
|
@@ -6632,7 +6642,7 @@ var lodash = { exports: {} };
|
|
|
6632
6642
|
position -= target.length;
|
|
6633
6643
|
return position >= 0 && string3.slice(position, end) == target;
|
|
6634
6644
|
}
|
|
6635
|
-
function
|
|
6645
|
+
function escape2(string3) {
|
|
6636
6646
|
string3 = toString(string3);
|
|
6637
6647
|
return string3 && reHasUnescapedHtml.test(string3) ? string3.replace(reUnescapedHtml, escapeHtmlChar) : string3;
|
|
6638
6648
|
}
|
|
@@ -7235,7 +7245,7 @@ var lodash = { exports: {} };
|
|
|
7235
7245
|
lodash2.divide = divide;
|
|
7236
7246
|
lodash2.endsWith = endsWith;
|
|
7237
7247
|
lodash2.eq = eq2;
|
|
7238
|
-
lodash2.escape =
|
|
7248
|
+
lodash2.escape = escape2;
|
|
7239
7249
|
lodash2.escapeRegExp = escapeRegExp;
|
|
7240
7250
|
lodash2.every = every;
|
|
7241
7251
|
lodash2.find = find;
|
|
@@ -10604,7 +10614,9 @@ const IconBody = (props) => {
|
|
|
10604
10614
|
"cy": "15",
|
|
10605
10615
|
"r": "15"
|
|
10606
10616
|
}, null), createVNode("path", {
|
|
10607
|
-
"d":
|
|
10617
|
+
"d": `M14.9997866,16 C12.5145053,16 10.4997866,13.9852814 10.4997866, 11.5 C10.4997866,9.01471863 12.5145053,7 14.9997866,7
|
|
10618
|
+
C17.485068, 7 19.4997866,9.01471863 19.4997866,11.5 C19.4997866,13.9852814 17.485068, 16 14.9997866,16 Z M23,23 L7,22.998553
|
|
10619
|
+
C7,19.0122153 10.8892296, 16.5 14.9997866,16.5 C19.1103437,16.5 23,20 23,23 Z`,
|
|
10608
10620
|
"id": "\u5F62\u72B6\u7ED3\u5408",
|
|
10609
10621
|
"fill": "#FFFFFF"
|
|
10610
10622
|
}, null)])]);
|
|
@@ -10652,7 +10664,13 @@ const IconNobody = (props) => {
|
|
|
10652
10664
|
"fill": "none",
|
|
10653
10665
|
"fill-rule": "evenodd"
|
|
10654
10666
|
}, [createVNode("path", {
|
|
10655
|
-
"d":
|
|
10667
|
+
"d": `M22.31,19.2474562 L22.31,21.9974562 L20.81,21.9974562 L20.81, 19.2474562 L18.06,19.2474562 L18.06,17.7474562
|
|
10668
|
+
L20.81,17.7474562 L20.81, 14.9974562 L22.31,14.9974562 L22.31,17.7474562 L25.06,17.7474562 L25.06, 19.2474562
|
|
10669
|
+
L22.31,19.2474562 Z M14.9297866,14.9974562 C12.4445053, 14.9974562 10.4297866,12.9827376 10.4297866,10.4974562
|
|
10670
|
+
C10.4297866, 8.01217483 12.4445053,5.9974562 14.9297866,5.9974562 C17.415068, 5.9974562 19.4297866,8.01217483
|
|
10671
|
+
19.4297866,10.4974562 C19.4297866, 12.9827376 17.415068,14.9974562 14.9297866,14.9974562 Z M19.6797866, 20.2474562
|
|
10672
|
+
L19.6797866,21.9971623 L6.93,21.9960092 C6.93,18.0096715 10.8192296, 15.4974562 14.9297866,15.4974562 C16.4608397,15.4974562
|
|
10673
|
+
17.9612467,15.983021 19.2414296, 16.7474562 L17.06,16.7474562 L17.06,20.2474562 L19.6797866,20.2474562 Z`,
|
|
10656
10674
|
"id": "\u5F62\u72B6\u7ED3\u5408",
|
|
10657
10675
|
"fill": "#959EB2"
|
|
10658
10676
|
}, null), createVNode("path", {
|
|
@@ -13759,8 +13777,8 @@ function useCodeEditor(props, ctx2) {
|
|
|
13759
13777
|
if (mode.value === "review") {
|
|
13760
13778
|
nextTick(() => {
|
|
13761
13779
|
refreshDecorations();
|
|
13762
|
-
refreshOverlayWidgets();
|
|
13763
13780
|
refreshViewZones();
|
|
13781
|
+
refreshOverlayWidgets();
|
|
13764
13782
|
});
|
|
13765
13783
|
}
|
|
13766
13784
|
}
|
|
@@ -13807,11 +13825,10 @@ function useCodeEditor(props, ctx2) {
|
|
|
13807
13825
|
}
|
|
13808
13826
|
}
|
|
13809
13827
|
function setEditorValue() {
|
|
13810
|
-
var _a;
|
|
13811
13828
|
if (!editor || !editor.getModel()) {
|
|
13812
13829
|
return;
|
|
13813
13830
|
}
|
|
13814
|
-
|
|
13831
|
+
editor.getModel().setValue(modelValue.value);
|
|
13815
13832
|
}
|
|
13816
13833
|
function setDiffEditorValue() {
|
|
13817
13834
|
var _a;
|
|
@@ -13847,9 +13864,9 @@ function useCodeEditor(props, ctx2) {
|
|
|
13847
13864
|
} else if (diffEditor) {
|
|
13848
13865
|
model = diffEditor.getModel().modified;
|
|
13849
13866
|
}
|
|
13850
|
-
model.onDidChangeContent(lodash.exports.throttle(() => {
|
|
13867
|
+
model == null ? void 0 : model.onDidChangeContent(lodash.exports.throttle(() => {
|
|
13851
13868
|
modifyValueFromInner = true;
|
|
13852
|
-
ctx2.emit("update:
|
|
13869
|
+
ctx2.emit("update:modelValue", model.getValue());
|
|
13853
13870
|
}, 100));
|
|
13854
13871
|
}
|
|
13855
13872
|
function setDiffEditorOriginValue() {
|
|
@@ -13863,6 +13880,8 @@ function useCodeEditor(props, ctx2) {
|
|
|
13863
13880
|
const language = options.value.language;
|
|
13864
13881
|
if (editor) {
|
|
13865
13882
|
if (mode.value === "normal" || mode.value === "review") {
|
|
13883
|
+
monaco2.editor.setModelLanguage(editor.getModel(), language);
|
|
13884
|
+
} else if (mode.value === "diff") {
|
|
13866
13885
|
const model = diffEditor.getModel();
|
|
13867
13886
|
monaco2.editor.setModelLanguage(model.modified, language);
|
|
13868
13887
|
monaco2.editor.setModelLanguage(model.original, language);
|
|
@@ -13894,7 +13913,7 @@ function useCodeEditor(props, ctx2) {
|
|
|
13894
13913
|
const lineDecoration = [
|
|
13895
13914
|
{
|
|
13896
13915
|
range: new monaco2.Range(currentLineNumber, 0, currentLineNumber, 0),
|
|
13897
|
-
|
|
13916
|
+
options: {
|
|
13898
13917
|
isWholeLine: true,
|
|
13899
13918
|
glyphMarginClassName: `icon-pointer ${addCommentIcon.value}`
|
|
13900
13919
|
}
|
|
@@ -13920,7 +13939,7 @@ function useCodeEditor(props, ctx2) {
|
|
|
13920
13939
|
setTimeout(() => {
|
|
13921
13940
|
currentDecorations = editor.deltaDecorations(currentDecorations, tempDecorations);
|
|
13922
13941
|
});
|
|
13923
|
-
|
|
13942
|
+
currentLineDecoration = editor.deltaDecorations(currentLineDecoration, []);
|
|
13924
13943
|
}
|
|
13925
13944
|
}
|
|
13926
13945
|
function setDecorations(decoration) {
|
|
@@ -13965,7 +13984,7 @@ function useCodeEditor(props, ctx2) {
|
|
|
13965
13984
|
heightInPx: comment2.heightInPx ? comment2.heightInPx : 0,
|
|
13966
13985
|
afterColumn: 1,
|
|
13967
13986
|
domNode: document.createElement("div"),
|
|
13968
|
-
|
|
13987
|
+
onDomNodeTop: (top) => {
|
|
13969
13988
|
layoutOverlayWidget(comment2.lineNumber, { top });
|
|
13970
13989
|
},
|
|
13971
13990
|
onComputedHeight: (height) => {
|
|
@@ -13988,7 +14007,7 @@ function useCodeEditor(props, ctx2) {
|
|
|
13988
14007
|
}
|
|
13989
14008
|
function calculateLayoutInfo(positionInfos, editorLayoutInfo, index2) {
|
|
13990
14009
|
let _offsetLeft = 0;
|
|
13991
|
-
const indexOffsetLeft = comments.value[index2].
|
|
14010
|
+
const indexOffsetLeft = comments.value[index2].offsetLeft;
|
|
13992
14011
|
if (indexOffsetLeft) {
|
|
13993
14012
|
_offsetLeft = indexOffsetLeft;
|
|
13994
14013
|
} else {
|
|
@@ -14001,8 +14020,8 @@ function useCodeEditor(props, ctx2) {
|
|
|
14001
14020
|
offsetLeft: _offsetLeft
|
|
14002
14021
|
};
|
|
14003
14022
|
}
|
|
14004
|
-
function handleDomNodePosition(top,
|
|
14005
|
-
comments.value[index2].domNode.style.height = `${
|
|
14023
|
+
function handleDomNodePosition(top, height, index2) {
|
|
14024
|
+
comments.value[index2].domNode.style.height = `${height}px`;
|
|
14006
14025
|
if (heightMap.get(index2) === 0) {
|
|
14007
14026
|
comments.value[index2].domNode.style.top = `-${1e4 + top}px`;
|
|
14008
14027
|
} else {
|
|
@@ -14068,7 +14087,7 @@ var codeEditor = "";
|
|
|
14068
14087
|
var CodeEditor = defineComponent({
|
|
14069
14088
|
name: "DCodeEditor",
|
|
14070
14089
|
props: codeEditorProps,
|
|
14071
|
-
emits: ["update:
|
|
14090
|
+
emits: ["update:modelValue", "afterEditorInit", "click"],
|
|
14072
14091
|
setup(props, ctx2) {
|
|
14073
14092
|
const {
|
|
14074
14093
|
editorEl
|
|
@@ -14137,6 +14156,88 @@ function CopyIcon() {
|
|
|
14137
14156
|
"fill-rule": "nonzero"
|
|
14138
14157
|
}, null)])]);
|
|
14139
14158
|
}
|
|
14159
|
+
function CommentIcon() {
|
|
14160
|
+
return createVNode("svg", {
|
|
14161
|
+
"width": "12px",
|
|
14162
|
+
"height": "12px",
|
|
14163
|
+
"viewBox": "0 0 16 16",
|
|
14164
|
+
"version": "1.1",
|
|
14165
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
14166
|
+
}, [createVNode("g", {
|
|
14167
|
+
"stroke": "none",
|
|
14168
|
+
"stroke-width": "1",
|
|
14169
|
+
"fill": "none",
|
|
14170
|
+
"fill-rule": "evenodd"
|
|
14171
|
+
}, [createVNode("path", {
|
|
14172
|
+
"d": `M14,1 C15.1045695,1 16,1.8954305 16,3 L16,11 C16,12.1045695 15.1045695,13 14,13 L11,13 L8,16 L5,13 L2,13
|
|
14173
|
+
C0.8954305,13 0,12.1045695 0,11 L0,3 C0,1.8954305 0.8954305,1 2,1 L14,1 Z M14,3 L2,3 L2,11 L5,11 C5.47149598,11
|
|
14174
|
+
5.92582641,11.1664898 6.28439337,11.4669131 L6.41421356,11.5857864 L8,13.171 L9.58578644,11.5857864
|
|
14175
|
+
C9.91918444,11.2523884 10.3581707,11.0488544 10.8241472,11.0077406 L11,11 L14,11 L14,3 Z M8,6 C8.55228475,6
|
|
14176
|
+
9,6.44771525 9,7 C9,7.55228475 8.55228475,8 8,8 C7.44771525,8 7,7.55228475 7,7 C7,6.44771525 7.44771525,6
|
|
14177
|
+
8,6 Z M11,6 C11.5522847,6 12,6.44771525 12,7 C12,7.55228475 11.5522847,8 11,8 C10.4477153,8 10,7.55228475
|
|
14178
|
+
10,7 C10,6.44771525 10.4477153,6 11,6 Z M5,6 C5.55228475,6 6,6.44771525 6,7 C6,7.55228475 5.55228475,8
|
|
14179
|
+
5,8 C4.44771525,8 4,7.55228475 4,7 C4,6.44771525 4.44771525,6 5,6 Z`,
|
|
14180
|
+
"fill": "#5e7ce0",
|
|
14181
|
+
"fill-rule": "nonzero"
|
|
14182
|
+
}, null)])]);
|
|
14183
|
+
}
|
|
14184
|
+
function UpExpandIcon() {
|
|
14185
|
+
return `<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
14186
|
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
14187
|
+
<g transform="translate(-1365.000000,-11.000000)">
|
|
14188
|
+
<g transform="translate(1365.000000,11.000000)">
|
|
14189
|
+
<rect x="0" y="0" width="16" height="16"></rect>
|
|
14190
|
+
<g
|
|
14191
|
+
transform="translate(8.000000, 8.000000) scale(1, -1) translate(-8.000000, -8.000000) translate(1.000000, 4.000000)"
|
|
14192
|
+
fill="#71757F">
|
|
14193
|
+
<path
|
|
14194
|
+
d='M0.5,0 L13.5,0 C13.7761424,0 14,0.223857625 14,0.5 C14,0.776142375 13.7761424,1 13.5,1 L0.5,1 C0.223857625,1
|
|
14195
|
+
0,0.776142375 0,0.5 C0,0.223857625 0.223857625,0 0.5,0 Z'></path>
|
|
14196
|
+
<polygon
|
|
14197
|
+
transform="translate(7.000000, 5.5000000) scale(1, -1) translate(-7.000000, -5.5000000)"
|
|
14198
|
+
points="7 3 10 8 4 8"></polygon>
|
|
14199
|
+
</g>
|
|
14200
|
+
</g>
|
|
14201
|
+
</g>
|
|
14202
|
+
</g>
|
|
14203
|
+
</svg>`;
|
|
14204
|
+
}
|
|
14205
|
+
function DownExpandIcon() {
|
|
14206
|
+
return `<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
14207
|
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
14208
|
+
<g transform="translate(-1344.000000,-11.000000)">
|
|
14209
|
+
<g transform="translate(1344.000000,11.000000)">
|
|
14210
|
+
<rect x="0" y="0" width="16" height="16"></rect>
|
|
14211
|
+
<g transform="translate(1.000000, 5.000000)" fill="#71757F">
|
|
14212
|
+
<path
|
|
14213
|
+
d="M0.5,0 L13.5,0 C13.7761424,0 14,0.223857625 14,0.5 C14,0.776142375 13.7761424,1 13.5,1 L0.5,1 C0.223857625,1
|
|
14214
|
+
0,0.776142375 0,0.5 C0,0.223857625 0.223857625,0 0.5,0 Z"></path>
|
|
14215
|
+
<polygon
|
|
14216
|
+
transform="translate(7.000000,5.500000) scale(1, -1) translate(-7.000000, -5.500000)"
|
|
14217
|
+
points="7 3 10 8 4 8"></polygon>
|
|
14218
|
+
</g>
|
|
14219
|
+
</g>
|
|
14220
|
+
</g>
|
|
14221
|
+
</g>
|
|
14222
|
+
</svg>`;
|
|
14223
|
+
}
|
|
14224
|
+
function AllExpandIcon() {
|
|
14225
|
+
return `<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
14226
|
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
14227
|
+
<g transform="translate(-1301.000000,-11.000000)">
|
|
14228
|
+
<rect x="1301" y="11" width="16" height="16"></rect>
|
|
14229
|
+
<path
|
|
14230
|
+
d="M1302.5,18 L1315.5,18 C1315.77614,18 1316,18.2238576 1316,18.5 1316,18.7761424 1315.77614,19 1315.5,19 L1302.5,19
|
|
14231
|
+
C1302.22386,19 1302,18.7761424 1302,18.5 C1302,18.2238576 1302.22386,18 1302.5,18 Z" fill="#71757F"></path>
|
|
14232
|
+
<polygon fill="#71757F" points="1309 11 1312 16 1306 16"></polygon>
|
|
14233
|
+
<polygon
|
|
14234
|
+
fill="#71757F"
|
|
14235
|
+
transform="translate(1309.000000, 23.500000) scale(1, -1) translate(-1309.000000, -23.500000)"
|
|
14236
|
+
points="1309 21 1312 26 1306 26"></polygon>
|
|
14237
|
+
</g>
|
|
14238
|
+
</g>
|
|
14239
|
+
</svg>`;
|
|
14240
|
+
}
|
|
14140
14241
|
const codeReviewProps = {
|
|
14141
14242
|
diff: {
|
|
14142
14243
|
type: String,
|
|
@@ -14150,6 +14251,10 @@ const codeReviewProps = {
|
|
|
14150
14251
|
outputFormat: {
|
|
14151
14252
|
type: String,
|
|
14152
14253
|
default: "line-by-line"
|
|
14254
|
+
},
|
|
14255
|
+
expandAllThreshold: {
|
|
14256
|
+
type: Number,
|
|
14257
|
+
default: 50
|
|
14153
14258
|
}
|
|
14154
14259
|
};
|
|
14155
14260
|
const CodeReviewInjectionKey = Symbol("d-code-review");
|
|
@@ -14219,17 +14324,159 @@ var CodeReviewHeader = defineComponent({
|
|
|
14219
14324
|
}, [rootCtx.slots.headOperate()])]);
|
|
14220
14325
|
}
|
|
14221
14326
|
});
|
|
14327
|
+
const ExpandLineReg = /^@@ -(\d+),(\d+) \+(\d+),(\d+) @@/;
|
|
14328
|
+
const FirstLineReg = /^@@ -[0,1](?!\d)/;
|
|
14329
|
+
function notEmptyNode(node) {
|
|
14330
|
+
const classes = node.classList;
|
|
14331
|
+
return !classes.contains("d2h-info") && !classes.contains("d2h-emptyplaceholder") && !classes.contains("comment-cell");
|
|
14332
|
+
}
|
|
14333
|
+
function insertNode(parent, child) {
|
|
14334
|
+
if (parent.firstChild) {
|
|
14335
|
+
parent.insertBefore(child, parent.firstChild);
|
|
14336
|
+
} else {
|
|
14337
|
+
parent.appendChild(child);
|
|
14338
|
+
}
|
|
14339
|
+
}
|
|
14340
|
+
function addExpandButton(parentNode, className2, icon2) {
|
|
14341
|
+
const expandButton = document.createElement("div");
|
|
14342
|
+
expandButton.innerHTML = icon2;
|
|
14343
|
+
expandButton.classList.add("expand-icon");
|
|
14344
|
+
expandButton.classList.add(className2);
|
|
14345
|
+
insertNode(parentNode, expandButton);
|
|
14346
|
+
}
|
|
14347
|
+
function attachExpandUpDownButton(parentNode, direction) {
|
|
14348
|
+
var _a;
|
|
14349
|
+
const expandDirectionMap = {
|
|
14350
|
+
up: "up-expand",
|
|
14351
|
+
down: "down-expand",
|
|
14352
|
+
all: "all-expand"
|
|
14353
|
+
};
|
|
14354
|
+
const expandDirectionIconMap = {
|
|
14355
|
+
up: UpExpandIcon,
|
|
14356
|
+
down: DownExpandIcon,
|
|
14357
|
+
all: AllExpandIcon
|
|
14358
|
+
};
|
|
14359
|
+
parentNode.classList.add("expand-icon-wrapper");
|
|
14360
|
+
if (direction === "updown") {
|
|
14361
|
+
addExpandButton(parentNode, "up-expand", UpExpandIcon());
|
|
14362
|
+
addExpandButton(parentNode, "down-expand", DownExpandIcon());
|
|
14363
|
+
} else {
|
|
14364
|
+
addExpandButton(parentNode, expandDirectionMap[direction], (_a = expandDirectionIconMap[direction]) == null ? void 0 : _a.call(expandDirectionIconMap));
|
|
14365
|
+
}
|
|
14366
|
+
}
|
|
14367
|
+
function addCommentToPage(lineHost, commentDom, lineSide) {
|
|
14368
|
+
var _a, _b;
|
|
14369
|
+
const newLine = document.createElement("tr");
|
|
14370
|
+
const newCell = document.createElement("td");
|
|
14371
|
+
newCell.classList.add("comment-cell");
|
|
14372
|
+
newCell.style.width = "100%";
|
|
14373
|
+
newCell.setAttribute("colspan", "2");
|
|
14374
|
+
newCell.appendChild(commentDom);
|
|
14375
|
+
newLine.classList.add("comment-block");
|
|
14376
|
+
newLine.classList.add(lineSide);
|
|
14377
|
+
newLine.appendChild(newCell);
|
|
14378
|
+
if (lineHost.nextElementSibling) {
|
|
14379
|
+
(_a = lineHost.parentElement) == null ? void 0 : _a.insertBefore(newLine, lineHost.nextElementSibling);
|
|
14380
|
+
} else {
|
|
14381
|
+
(_b = lineHost.parentElement) == null ? void 0 : _b.appendChild(newLine);
|
|
14382
|
+
}
|
|
14383
|
+
}
|
|
14384
|
+
function useCodeReviewExpand(reviewContentRef, expandAllThreshold, outputFormat) {
|
|
14385
|
+
const processSideBySide = () => {
|
|
14386
|
+
const [leftTable, rightTable] = reviewContentRef.value.querySelectorAll("table");
|
|
14387
|
+
const trNodes = Array.from(leftTable.querySelectorAll("tr"));
|
|
14388
|
+
const totalLines = trNodes.length;
|
|
14389
|
+
for (const index2 in trNodes) {
|
|
14390
|
+
const lineIndex = parseInt(index2);
|
|
14391
|
+
const lineChildren = Array.from(trNodes[lineIndex].children);
|
|
14392
|
+
const lineNumberBox = lineChildren[0];
|
|
14393
|
+
const lineContentBox = lineChildren[1];
|
|
14394
|
+
const lineClassList = lineContentBox.classList.value;
|
|
14395
|
+
const lineContent = lineContentBox.innerText.trim();
|
|
14396
|
+
if (lineContent.match(ExpandLineReg) && !FirstLineReg.test(lineContent) && lineClassList && lineClassList.includes("d2h-info")) {
|
|
14397
|
+
const nextLineIndex = lineIndex + 1;
|
|
14398
|
+
const prevLineIndex = lineIndex - 1;
|
|
14399
|
+
if (lineIndex === 0 && nextLineIndex in trNodes) {
|
|
14400
|
+
attachExpandUpDownButton(lineNumberBox, "up");
|
|
14401
|
+
} else if (lineIndex > 0 && lineIndex < totalLines - 1 && nextLineIndex in trNodes && prevLineIndex in trNodes) {
|
|
14402
|
+
const preLineChildren = Array.from(trNodes[prevLineIndex].children);
|
|
14403
|
+
const nextLineChildren = Array.from(trNodes[nextLineIndex].children);
|
|
14404
|
+
const isExpandAll = parseInt(nextLineChildren[0].innerText) - parseInt(preLineChildren[0].innerText) - 1 < expandAllThreshold;
|
|
14405
|
+
attachExpandUpDownButton(lineNumberBox, isExpandAll ? "all" : "updown");
|
|
14406
|
+
}
|
|
14407
|
+
}
|
|
14408
|
+
}
|
|
14409
|
+
const endLine = trNodes[0].cloneNode(true);
|
|
14410
|
+
if (Object.prototype.hasOwnProperty.call(endLine.children[0].children, 0)) {
|
|
14411
|
+
endLine.children[0].removeChild(endLine.children[0].children[0]);
|
|
14412
|
+
}
|
|
14413
|
+
endLine.children[1].innerText = "";
|
|
14414
|
+
const leftEndLine = endLine.cloneNode(true);
|
|
14415
|
+
const rightEndLint = endLine.cloneNode(true);
|
|
14416
|
+
attachExpandUpDownButton(leftEndLine.children[0], "down");
|
|
14417
|
+
leftTable.tBodies[0].appendChild(leftEndLine);
|
|
14418
|
+
rightTable.tBodies[0].appendChild(rightEndLint);
|
|
14419
|
+
};
|
|
14420
|
+
const processLineByLine = () => {
|
|
14421
|
+
var _a;
|
|
14422
|
+
const trNodes = Array.from(reviewContentRef.value.querySelectorAll("tr"));
|
|
14423
|
+
const totalLines = trNodes.length;
|
|
14424
|
+
for (const index2 in trNodes) {
|
|
14425
|
+
const lineIndex = parseInt(index2);
|
|
14426
|
+
const tdNodes = Array.from(trNodes[lineIndex].children);
|
|
14427
|
+
const lineNumberBox = tdNodes[0];
|
|
14428
|
+
const lineContentBox = tdNodes[1];
|
|
14429
|
+
if (!lineContentBox) {
|
|
14430
|
+
continue;
|
|
14431
|
+
}
|
|
14432
|
+
const lineClassList = lineContentBox.classList.value;
|
|
14433
|
+
const lineContent = lineContentBox.innerText.trim();
|
|
14434
|
+
if (lineContent.match(ExpandLineReg) && !FirstLineReg.test(lineContent) && lineClassList && lineClassList.includes("d2h-info")) {
|
|
14435
|
+
const nextLineIndex = lineIndex + 1;
|
|
14436
|
+
const prevLineIndex = lineIndex - 1;
|
|
14437
|
+
if (lineIndex === 0 && nextLineIndex in trNodes) {
|
|
14438
|
+
attachExpandUpDownButton(lineNumberBox, "up");
|
|
14439
|
+
} else if (lineIndex > 0 && lineIndex < totalLines - 1 && nextLineIndex in trNodes && prevLineIndex in trNodes) {
|
|
14440
|
+
const prevTdNodes = Array.from(trNodes[prevLineIndex].children);
|
|
14441
|
+
const prevLineNumber = parseInt(prevTdNodes[0].children[0].innerText);
|
|
14442
|
+
const nextTdNodes = Array.from(trNodes[nextLineIndex].children);
|
|
14443
|
+
const nextLineNumber = parseInt(nextTdNodes[0].children[0].innerText);
|
|
14444
|
+
const isExpandAll = nextLineNumber - prevLineNumber - 1 < expandAllThreshold;
|
|
14445
|
+
attachExpandUpDownButton(lineNumberBox, isExpandAll ? "all" : "updown");
|
|
14446
|
+
}
|
|
14447
|
+
}
|
|
14448
|
+
}
|
|
14449
|
+
const loadMoreLine = trNodes[0].cloneNode(true);
|
|
14450
|
+
loadMoreLine.children[0].removeChild(loadMoreLine.children[0].children[0]);
|
|
14451
|
+
loadMoreLine.children[1].innerText = "";
|
|
14452
|
+
loadMoreLine.children[1].style.height = "20px";
|
|
14453
|
+
const lastTrNode = trNodes[totalLines - 1].children;
|
|
14454
|
+
const leftLineStart = parseInt(lastTrNode[0].children[0].innerText) + 1;
|
|
14455
|
+
const rightLineStart = parseInt(lastTrNode[0].children[1].innerText) + 1;
|
|
14456
|
+
if (leftLineStart && rightLineStart) {
|
|
14457
|
+
attachExpandUpDownButton(loadMoreLine.children[0], "down");
|
|
14458
|
+
}
|
|
14459
|
+
(_a = trNodes[0].parentElement) == null ? void 0 : _a.appendChild(loadMoreLine);
|
|
14460
|
+
};
|
|
14461
|
+
const insertExpandButton = () => {
|
|
14462
|
+
outputFormat === "side-by-side" ? processSideBySide() : processLineByLine();
|
|
14463
|
+
};
|
|
14464
|
+
return { insertExpandButton };
|
|
14465
|
+
}
|
|
14222
14466
|
function useCodeReview(props, ctx2) {
|
|
14223
|
-
const { diff, fold, outputFormat } = toRefs(props);
|
|
14467
|
+
const { diff, fold, outputFormat, expandAllThreshold } = toRefs(props);
|
|
14224
14468
|
const renderHtml = ref("");
|
|
14225
14469
|
const isFold = ref(fold.value);
|
|
14470
|
+
const reviewContentRef = ref();
|
|
14226
14471
|
const diffFile = Diff2Html.parse(diff.value);
|
|
14472
|
+
const { insertExpandButton } = useCodeReviewExpand(reviewContentRef, expandAllThreshold.value, outputFormat.value);
|
|
14227
14473
|
const initDiffContent = () => {
|
|
14228
14474
|
renderHtml.value = Diff2Html.html(diffFile, {
|
|
14229
14475
|
drawFileList: false,
|
|
14230
14476
|
matching: "lines",
|
|
14231
14477
|
outputFormat: outputFormat.value
|
|
14232
14478
|
});
|
|
14479
|
+
nextTick(insertExpandButton);
|
|
14233
14480
|
};
|
|
14234
14481
|
const toggleFold = (status2) => {
|
|
14235
14482
|
if (status2 !== void 0) {
|
|
@@ -14252,21 +14499,130 @@ function useCodeReview(props, ctx2) {
|
|
|
14252
14499
|
initDiffContent();
|
|
14253
14500
|
}
|
|
14254
14501
|
});
|
|
14255
|
-
provide(CodeReviewInjectionKey, { diffInfo: diffFile[0], isFold, rootCtx: ctx2 });
|
|
14256
|
-
|
|
14257
|
-
|
|
14502
|
+
provide(CodeReviewInjectionKey, { reviewContentRef, diffInfo: diffFile[0], isFold, rootCtx: ctx2 });
|
|
14503
|
+
return { renderHtml, isFold, reviewContentRef, toggleFold };
|
|
14504
|
+
}
|
|
14505
|
+
function useCodeReviewComment(reviewContentRef, ctx2) {
|
|
14506
|
+
const ns2 = useNamespace("code-review");
|
|
14507
|
+
const commentLeft = ref(-100);
|
|
14508
|
+
const commentTop = ref(-100);
|
|
14509
|
+
let currentLeftLineNumber = -1;
|
|
14510
|
+
let currentRightLineNumber = -1;
|
|
14511
|
+
const resetLeftTop = () => {
|
|
14512
|
+
commentLeft.value = -100;
|
|
14513
|
+
commentTop.value = -100;
|
|
14514
|
+
currentLeftLineNumber = -1;
|
|
14515
|
+
currentRightLineNumber = -1;
|
|
14516
|
+
};
|
|
14517
|
+
const onMouseEnter = (e) => {
|
|
14518
|
+
e.currentTarget.getBoundingClientRect();
|
|
14519
|
+
};
|
|
14520
|
+
const onMouseMove = (e) => {
|
|
14521
|
+
var _a, _b;
|
|
14522
|
+
const composedPath = e.composedPath();
|
|
14523
|
+
const trNode = composedPath.find((item) => item.tagName === "TR");
|
|
14524
|
+
if (trNode) {
|
|
14525
|
+
const lineNumberContainer = Array.from(trNode.children)[0];
|
|
14526
|
+
if (notEmptyNode(lineNumberContainer)) {
|
|
14527
|
+
const { top, left } = lineNumberContainer.getBoundingClientRect();
|
|
14528
|
+
commentLeft.value = left;
|
|
14529
|
+
commentTop.value = top;
|
|
14530
|
+
currentLeftLineNumber = parseInt((_a = lineNumberContainer.children[0]) == null ? void 0 : _a.innerText) || -1;
|
|
14531
|
+
currentRightLineNumber = parseInt((_b = lineNumberContainer.children[1]) == null ? void 0 : _b.innerText) || -1;
|
|
14532
|
+
} else {
|
|
14533
|
+
resetLeftTop();
|
|
14534
|
+
}
|
|
14535
|
+
}
|
|
14536
|
+
};
|
|
14537
|
+
const onMouseleave = (e) => {
|
|
14538
|
+
var _a;
|
|
14539
|
+
if (!((_a = e.relatedTarget) == null ? void 0 : _a.classList.contains("comment-icon"))) {
|
|
14540
|
+
resetLeftTop();
|
|
14541
|
+
}
|
|
14542
|
+
};
|
|
14543
|
+
const onCommentMouseLeave = (e) => {
|
|
14544
|
+
var _a;
|
|
14545
|
+
if (!((_a = e.relatedTarget) == null ? void 0 : _a.classList.contains(ns2.e("content")))) {
|
|
14546
|
+
resetLeftTop();
|
|
14547
|
+
}
|
|
14548
|
+
};
|
|
14549
|
+
const onCommentIconClick = () => {
|
|
14550
|
+
ctx2.emit("addComment", { left: currentLeftLineNumber, right: currentRightLineNumber });
|
|
14551
|
+
};
|
|
14552
|
+
const findReferenceDom = (lineNumber, lineSide) => {
|
|
14553
|
+
var _a, _b, _c, _d;
|
|
14554
|
+
const trNodes = Array.from(reviewContentRef.value.querySelectorAll("tr"));
|
|
14555
|
+
for (const index2 in trNodes) {
|
|
14556
|
+
const lineIndex = parseInt(index2);
|
|
14557
|
+
const lineNumberBox = Array.from(trNodes[lineIndex].children)[0];
|
|
14558
|
+
if (notEmptyNode(lineNumberBox)) {
|
|
14559
|
+
const oldLineNumber = parseInt((_b = (_a = lineNumberBox.children[0]) == null ? void 0 : _a.innerText) != null ? _b : -1);
|
|
14560
|
+
const newLineNumber = parseInt((_d = (_c = lineNumberBox.children[1]) == null ? void 0 : _c.innerText) != null ? _d : -1);
|
|
14561
|
+
if (lineSide === "left" && oldLineNumber === lineNumber || lineSide === "right" && newLineNumber === lineNumber) {
|
|
14562
|
+
return trNodes[lineIndex];
|
|
14563
|
+
}
|
|
14564
|
+
}
|
|
14565
|
+
}
|
|
14566
|
+
};
|
|
14567
|
+
const insertComment = (lineNumber, lineSide, commentDom) => {
|
|
14568
|
+
const lineHost = findReferenceDom(lineNumber, lineSide);
|
|
14569
|
+
lineHost && addCommentToPage(lineHost, commentDom, lineSide);
|
|
14570
|
+
};
|
|
14571
|
+
const removeComment = (lineNumber, lineSide) => {
|
|
14572
|
+
const lineHost = findReferenceDom(lineNumber, lineSide);
|
|
14573
|
+
let nextLineHost = lineHost == null ? void 0 : lineHost.nextElementSibling;
|
|
14574
|
+
while (nextLineHost) {
|
|
14575
|
+
const classList = nextLineHost == null ? void 0 : nextLineHost.classList;
|
|
14576
|
+
if ((classList == null ? void 0 : classList.contains("comment-block")) && classList.contains(lineSide)) {
|
|
14577
|
+
nextLineHost.remove();
|
|
14578
|
+
return;
|
|
14579
|
+
}
|
|
14580
|
+
nextLineHost = nextLineHost.nextElementSibling;
|
|
14581
|
+
}
|
|
14582
|
+
};
|
|
14583
|
+
return {
|
|
14584
|
+
commentLeft,
|
|
14585
|
+
commentTop,
|
|
14586
|
+
onMouseEnter,
|
|
14587
|
+
onMouseMove,
|
|
14588
|
+
onMouseleave,
|
|
14589
|
+
onCommentMouseLeave,
|
|
14590
|
+
onCommentIconClick,
|
|
14591
|
+
insertComment,
|
|
14592
|
+
removeComment
|
|
14593
|
+
};
|
|
14258
14594
|
}
|
|
14259
14595
|
var codeReview = "";
|
|
14260
14596
|
var CodeReview = defineComponent({
|
|
14261
14597
|
name: "DCodeReview",
|
|
14262
14598
|
props: codeReviewProps,
|
|
14263
|
-
emits: ["foldChange"],
|
|
14599
|
+
emits: ["foldChange", "addComment", "afterViewInit"],
|
|
14264
14600
|
setup(props, ctx2) {
|
|
14265
14601
|
const ns2 = useNamespace("code-review");
|
|
14266
14602
|
const {
|
|
14267
14603
|
renderHtml,
|
|
14268
|
-
isFold
|
|
14604
|
+
isFold,
|
|
14605
|
+
reviewContentRef,
|
|
14606
|
+
toggleFold
|
|
14269
14607
|
} = useCodeReview(props, ctx2);
|
|
14608
|
+
const {
|
|
14609
|
+
commentLeft,
|
|
14610
|
+
commentTop,
|
|
14611
|
+
onMouseEnter,
|
|
14612
|
+
onMouseMove,
|
|
14613
|
+
onMouseleave,
|
|
14614
|
+
onCommentMouseLeave,
|
|
14615
|
+
onCommentIconClick,
|
|
14616
|
+
insertComment,
|
|
14617
|
+
removeComment
|
|
14618
|
+
} = useCodeReviewComment(reviewContentRef, ctx2);
|
|
14619
|
+
onMounted(() => {
|
|
14620
|
+
ctx2.emit("afterViewInit", {
|
|
14621
|
+
toggleFold,
|
|
14622
|
+
insertComment,
|
|
14623
|
+
removeComment
|
|
14624
|
+
});
|
|
14625
|
+
});
|
|
14270
14626
|
return () => createVNode("div", {
|
|
14271
14627
|
"class": ns2.b()
|
|
14272
14628
|
}, [createVNode(CodeReviewHeader, {
|
|
@@ -14275,8 +14631,20 @@ var CodeReview = defineComponent({
|
|
|
14275
14631
|
"class": [ns2.e("content"), {
|
|
14276
14632
|
"hide-content": isFold.value
|
|
14277
14633
|
}],
|
|
14278
|
-
"innerHTML": renderHtml.value
|
|
14279
|
-
|
|
14634
|
+
"innerHTML": renderHtml.value,
|
|
14635
|
+
"ref": reviewContentRef,
|
|
14636
|
+
"onMouseenter": onMouseEnter,
|
|
14637
|
+
"onMousemove": onMouseMove,
|
|
14638
|
+
"onMouseleave": onMouseleave
|
|
14639
|
+
}, null), createVNode("div", {
|
|
14640
|
+
"class": "comment-icon",
|
|
14641
|
+
"style": {
|
|
14642
|
+
left: commentLeft.value + "px",
|
|
14643
|
+
top: commentTop.value + "px"
|
|
14644
|
+
},
|
|
14645
|
+
"onClick": onCommentIconClick,
|
|
14646
|
+
"onMouseleave": onCommentMouseLeave
|
|
14647
|
+
}, [createVNode(CommentIcon, null, null)])]);
|
|
14280
14648
|
}
|
|
14281
14649
|
});
|
|
14282
14650
|
var CodeReviewInstall = {
|
|
@@ -26129,6 +26497,633 @@ var GanttInstall = {
|
|
|
26129
26497
|
app.use(Gantt);
|
|
26130
26498
|
}
|
|
26131
26499
|
};
|
|
26500
|
+
const gitGraphProps = {
|
|
26501
|
+
option: {
|
|
26502
|
+
type: Object
|
|
26503
|
+
}
|
|
26504
|
+
};
|
|
26505
|
+
class GitGraph$1 {
|
|
26506
|
+
constructor() {
|
|
26507
|
+
__publicField(this, "element");
|
|
26508
|
+
__publicField(this, "options");
|
|
26509
|
+
__publicField(this, "mtime", 0);
|
|
26510
|
+
__publicField(this, "mspace", 0);
|
|
26511
|
+
__publicField(this, "parents", {});
|
|
26512
|
+
__publicField(this, "offsetX", 70);
|
|
26513
|
+
__publicField(this, "offsetY", 60);
|
|
26514
|
+
__publicField(this, "unitTime", 50);
|
|
26515
|
+
__publicField(this, "unitSpace", 15);
|
|
26516
|
+
__publicField(this, "prev_start", -1);
|
|
26517
|
+
__publicField(this, "preparedCommits", {});
|
|
26518
|
+
__publicField(this, "preStart", 1);
|
|
26519
|
+
__publicField(this, "isDark", false);
|
|
26520
|
+
__publicField(this, "daysBefore", "\u5929\u524D");
|
|
26521
|
+
__publicField(this, "hoursAgo", "\u5C0F\u65F6\u524D");
|
|
26522
|
+
__publicField(this, "minutesAgo", "\u5206\u949F\u524D");
|
|
26523
|
+
__publicField(this, "aMinutesAgo", "1\u5206\u949F\u524D");
|
|
26524
|
+
__publicField(this, "maxNameLength", 25);
|
|
26525
|
+
__publicField(this, "commits", []);
|
|
26526
|
+
__publicField(this, "graphHeight", 0);
|
|
26527
|
+
__publicField(this, "graphWidth", 0);
|
|
26528
|
+
__publicField(this, "svg");
|
|
26529
|
+
__publicField(this, "barHeight", 0);
|
|
26530
|
+
__publicField(this, "messageBoxWidth", 0);
|
|
26531
|
+
__publicField(this, "colors", [
|
|
26532
|
+
"#5C8DFF",
|
|
26533
|
+
"#BC94FF",
|
|
26534
|
+
"#54D2EB",
|
|
26535
|
+
"#A6DD82",
|
|
26536
|
+
"#FCDA6B",
|
|
26537
|
+
"#CA7ED6",
|
|
26538
|
+
"#7298F1",
|
|
26539
|
+
"#73CEA6",
|
|
26540
|
+
"#EDD249",
|
|
26541
|
+
"#CAABFF",
|
|
26542
|
+
"#85CAFF",
|
|
26543
|
+
"#93D99A",
|
|
26544
|
+
"#96ADFA",
|
|
26545
|
+
"#F4AF8F",
|
|
26546
|
+
"#A282E9",
|
|
26547
|
+
"#FFBB6B",
|
|
26548
|
+
"#69DBB9",
|
|
26549
|
+
"#76DBEF",
|
|
26550
|
+
"#B1CE4F",
|
|
26551
|
+
"#5DA4DC"
|
|
26552
|
+
]);
|
|
26553
|
+
__publicField(this, "toolTipList");
|
|
26554
|
+
}
|
|
26555
|
+
load(element, options, isDark) {
|
|
26556
|
+
this.element = element;
|
|
26557
|
+
this.options = options;
|
|
26558
|
+
this.isDark = !!isDark;
|
|
26559
|
+
this.daysBefore = options.params.daysBefore || this.daysBefore;
|
|
26560
|
+
this.hoursAgo = options.params.hoursAgo || this.hoursAgo;
|
|
26561
|
+
this.minutesAgo = options.params.minutesAgo || this.minutesAgo;
|
|
26562
|
+
this.aMinutesAgo = options.params.aMinutesAgo || this.aMinutesAgo;
|
|
26563
|
+
this.maxNameLength = options.params.maxNameLength || 25;
|
|
26564
|
+
const commits = lodash.exports.cloneDeep(this.options.data.commits);
|
|
26565
|
+
this.prepareData(commits);
|
|
26566
|
+
return this.buildGraph("refName");
|
|
26567
|
+
}
|
|
26568
|
+
prepareData(commits) {
|
|
26569
|
+
var _a;
|
|
26570
|
+
let c;
|
|
26571
|
+
this.commits = commits;
|
|
26572
|
+
this.collectParent();
|
|
26573
|
+
this.graphHeight = this.element.getBoundingClientRect().height;
|
|
26574
|
+
this.graphWidth = this.element.getBoundingClientRect().width;
|
|
26575
|
+
const ch = Math.max(this.graphHeight, this.offsetY + this.unitTime * this.mtime + 150);
|
|
26576
|
+
Math.max(this.graphWidth, this.offsetX + this.unitSpace * this.mspace + 300);
|
|
26577
|
+
this.svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
26578
|
+
this.svg.setAttribute("height", ch + "");
|
|
26579
|
+
this.svg.setAttribute("width", "100%");
|
|
26580
|
+
(_a = this.element) == null ? void 0 : _a.appendChild(this.svg);
|
|
26581
|
+
this.barHeight = Math.max(this.graphHeight, this.unitTime * this.commits.length + 320);
|
|
26582
|
+
const _ref = this.commits;
|
|
26583
|
+
for (let _i = 0; _i < _ref.length; _i++) {
|
|
26584
|
+
c = _ref[_i];
|
|
26585
|
+
this.preparedCommits[c.id] = c;
|
|
26586
|
+
}
|
|
26587
|
+
}
|
|
26588
|
+
collectParent() {
|
|
26589
|
+
let c;
|
|
26590
|
+
let p;
|
|
26591
|
+
let _i;
|
|
26592
|
+
let _len;
|
|
26593
|
+
const _this = this;
|
|
26594
|
+
const _ref = this.commits;
|
|
26595
|
+
const _results = [];
|
|
26596
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
26597
|
+
c = _ref[_i];
|
|
26598
|
+
this.mtime = Math.max(this.mtime, c.time);
|
|
26599
|
+
this.mspace = Math.max(this.mspace, c.space);
|
|
26600
|
+
_results.push(function() {
|
|
26601
|
+
let _j;
|
|
26602
|
+
let _len2;
|
|
26603
|
+
const _ref2 = c.parents;
|
|
26604
|
+
const _result2 = [];
|
|
26605
|
+
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
|
|
26606
|
+
p = _ref2[_j];
|
|
26607
|
+
_this.parents[p[0]] = true;
|
|
26608
|
+
_result2.push(_this.mspace = Math.max(_this.mspace, p[1]));
|
|
26609
|
+
}
|
|
26610
|
+
return _result2;
|
|
26611
|
+
}.call(_this));
|
|
26612
|
+
}
|
|
26613
|
+
return _results;
|
|
26614
|
+
}
|
|
26615
|
+
buildGraph(refName) {
|
|
26616
|
+
let curDay = new Date(0);
|
|
26617
|
+
let day;
|
|
26618
|
+
let mm;
|
|
26619
|
+
let _len;
|
|
26620
|
+
const _ref = this.commits;
|
|
26621
|
+
for (mm = 0, _len = _ref.length; mm < _len; mm++) {
|
|
26622
|
+
day = _ref[mm].date;
|
|
26623
|
+
if (curDay.getDate() !== new Date(day).getDate() || curDay.getMonth() !== new Date(day).getMonth() || curDay.getFullYear() !== new Date(day).getFullYear()) {
|
|
26624
|
+
const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
26625
|
+
const date4 = new Date(day);
|
|
26626
|
+
const attrs = {
|
|
26627
|
+
x: this.offsetX + this.unitSpace * this.mspace + 56,
|
|
26628
|
+
y: this.offsetY + this.unitTime * mm - 22,
|
|
26629
|
+
"font-size": "12px",
|
|
26630
|
+
fill: "#999",
|
|
26631
|
+
"text-anchor": "start"
|
|
26632
|
+
};
|
|
26633
|
+
this.setNodeAttr(text, attrs);
|
|
26634
|
+
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
26635
|
+
tspan.appendChild(document.createTextNode(date4.getFullYear() + " / " + (date4.getMonth() + 1) + " / " + date4.getDate()));
|
|
26636
|
+
text.appendChild(tspan);
|
|
26637
|
+
this.svg.appendChild(text);
|
|
26638
|
+
curDay = date4;
|
|
26639
|
+
}
|
|
26640
|
+
}
|
|
26641
|
+
this.renderPartialGraph(refName);
|
|
26642
|
+
}
|
|
26643
|
+
setNodeAttr(node, attrs) {
|
|
26644
|
+
Object.keys(attrs).forEach((key) => {
|
|
26645
|
+
node.setAttribute(key, attrs[key]);
|
|
26646
|
+
});
|
|
26647
|
+
}
|
|
26648
|
+
__transform(time) {
|
|
26649
|
+
let timeTip = "";
|
|
26650
|
+
const now = new Date().getTime();
|
|
26651
|
+
const commitTime = new Date(time).getTime();
|
|
26652
|
+
const day = (now - commitTime) / (60 * 60 * 24 * 1e3);
|
|
26653
|
+
const hour = (now - commitTime) / (60 * 60 * 1e3);
|
|
26654
|
+
const minutes = (now - commitTime) / (60 * 1e3);
|
|
26655
|
+
if (day >= 1) {
|
|
26656
|
+
timeTip = Math.floor(day) + this.daysBefore;
|
|
26657
|
+
} else {
|
|
26658
|
+
if (hour >= 1) {
|
|
26659
|
+
timeTip = Math.floor(hour) + this.hoursAgo;
|
|
26660
|
+
} else {
|
|
26661
|
+
if (minutes >= 1) {
|
|
26662
|
+
timeTip = Math.floor(minutes) + this.minutesAgo;
|
|
26663
|
+
} else {
|
|
26664
|
+
timeTip = this.aMinutesAgo;
|
|
26665
|
+
}
|
|
26666
|
+
}
|
|
26667
|
+
}
|
|
26668
|
+
return timeTip;
|
|
26669
|
+
}
|
|
26670
|
+
renderPartialGraph(refName) {
|
|
26671
|
+
let commit;
|
|
26672
|
+
let end;
|
|
26673
|
+
let i;
|
|
26674
|
+
let isGraphEdge;
|
|
26675
|
+
let start;
|
|
26676
|
+
let x;
|
|
26677
|
+
let y;
|
|
26678
|
+
start = Math.floor((this.element.scrollTop - this.offsetY) / this.unitTime) - 10;
|
|
26679
|
+
if (start < 0) {
|
|
26680
|
+
isGraphEdge = true;
|
|
26681
|
+
start = 0;
|
|
26682
|
+
}
|
|
26683
|
+
end = this.element.scrollHeight > this.element.clientHeight ? start + 40 : Infinity;
|
|
26684
|
+
if (this.preStart <= end) {
|
|
26685
|
+
isGraphEdge = true;
|
|
26686
|
+
start = this.preStart - 1;
|
|
26687
|
+
this.preStart = end;
|
|
26688
|
+
}
|
|
26689
|
+
if (this.commits.length < end) {
|
|
26690
|
+
isGraphEdge = true;
|
|
26691
|
+
end = this.commits.length;
|
|
26692
|
+
}
|
|
26693
|
+
if (this.prev_start === -1 || Math.abs(this.prev_start - start) > 10 || isGraphEdge) {
|
|
26694
|
+
i = start;
|
|
26695
|
+
this.prev_start = start;
|
|
26696
|
+
while (i < end) {
|
|
26697
|
+
commit = this.commits[i];
|
|
26698
|
+
i += 1;
|
|
26699
|
+
if (commit["hasDrawn"] !== true) {
|
|
26700
|
+
x = this.offsetX + this.unitSpace * (this.mspace - commit.space);
|
|
26701
|
+
y = this.offsetY + this.unitTime * commit.time;
|
|
26702
|
+
this.drawDot(x, y, commit);
|
|
26703
|
+
this.drawLines(x, y, commit);
|
|
26704
|
+
this.appendLabel(x, y, commit);
|
|
26705
|
+
this.appendAnchor(x, y, commit, refName);
|
|
26706
|
+
commit["hasDrawn"] = true;
|
|
26707
|
+
}
|
|
26708
|
+
}
|
|
26709
|
+
}
|
|
26710
|
+
}
|
|
26711
|
+
drawDot(x, y, commit) {
|
|
26712
|
+
const options = this.options;
|
|
26713
|
+
const isdark = this.isDark;
|
|
26714
|
+
const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
26715
|
+
const attrs = {
|
|
26716
|
+
cx: x,
|
|
26717
|
+
cy: y,
|
|
26718
|
+
r: 4,
|
|
26719
|
+
fill: "#fff",
|
|
26720
|
+
strokeWidth: 1,
|
|
26721
|
+
stroke: this.colors[commit.space],
|
|
26722
|
+
style: "cursor: pointer;"
|
|
26723
|
+
};
|
|
26724
|
+
this.setNodeAttr(circle, attrs);
|
|
26725
|
+
this.svg.appendChild(circle);
|
|
26726
|
+
const avatar_box_x = this.offsetX + this.unitSpace * this.mspace + 16;
|
|
26727
|
+
const avatar_box_y = y - 13;
|
|
26728
|
+
const img = document.createElementNS("http://www.w3.org/2000/svg", "image");
|
|
26729
|
+
const imgAttrs = {
|
|
26730
|
+
width: 30,
|
|
26731
|
+
height: 30,
|
|
26732
|
+
preserveAspectRatio: "none",
|
|
26733
|
+
href: commit.author.avatar_url,
|
|
26734
|
+
x: avatar_box_x,
|
|
26735
|
+
y: avatar_box_y,
|
|
26736
|
+
style: "clip-path: circle(50%)"
|
|
26737
|
+
};
|
|
26738
|
+
this.setNodeAttr(img, imgAttrs);
|
|
26739
|
+
this.svg.appendChild(img);
|
|
26740
|
+
if (!this.messageBoxWidth) {
|
|
26741
|
+
this.messageBoxWidth = this.svg.getBoundingClientRect.width - (avatar_box_x + 40);
|
|
26742
|
+
}
|
|
26743
|
+
let route = ["M", avatar_box_x + 15, avatar_box_y - 20, "L", avatar_box_x + 15, avatar_box_y];
|
|
26744
|
+
const line1 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
26745
|
+
const lineAttrs1 = {
|
|
26746
|
+
d: route.join(" "),
|
|
26747
|
+
stroke: "#ccc",
|
|
26748
|
+
fill: "none",
|
|
26749
|
+
"stroke-width": 2
|
|
26750
|
+
};
|
|
26751
|
+
this.setNodeAttr(line1, lineAttrs1);
|
|
26752
|
+
this.svg.appendChild(line1);
|
|
26753
|
+
route = ["M", avatar_box_x + 15, avatar_box_y + 30, "L", avatar_box_x + 15, avatar_box_y + 50];
|
|
26754
|
+
const line2 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
26755
|
+
const lineAttrs2 = {
|
|
26756
|
+
d: route.join(" "),
|
|
26757
|
+
stroke: "#ccc",
|
|
26758
|
+
"stroke-width": 2
|
|
26759
|
+
};
|
|
26760
|
+
this.setNodeAttr(line2, lineAttrs2);
|
|
26761
|
+
this.svg.appendChild(line2);
|
|
26762
|
+
if (commit.author.name.length > this.maxNameLength) {
|
|
26763
|
+
commit.author.name = commit.author.name.substr(0, this.maxNameLength) + "...";
|
|
26764
|
+
}
|
|
26765
|
+
const commitText = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
26766
|
+
const commitAttrs = {
|
|
26767
|
+
x: avatar_box_x + 40,
|
|
26768
|
+
y: y + 4,
|
|
26769
|
+
"text-anchor": "start",
|
|
26770
|
+
style: "cursor: pointer;text-anchor: start;",
|
|
26771
|
+
fill: isdark ? "#e8e8e8" : "#2e2e2e",
|
|
26772
|
+
"font-size": 14
|
|
26773
|
+
};
|
|
26774
|
+
this.setNodeAttr(commitText, commitAttrs);
|
|
26775
|
+
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
26776
|
+
tspan.appendChild(document.createTextNode(commit.message.replace(/\n/g, " ")));
|
|
26777
|
+
commitText.appendChild(tspan);
|
|
26778
|
+
const titleText = document.createElementNS("http://www.w3.org/2000/svg", "title");
|
|
26779
|
+
titleText.appendChild(document.createTextNode(commit.message));
|
|
26780
|
+
commitText.appendChild(titleText);
|
|
26781
|
+
this.svg.appendChild(commitText);
|
|
26782
|
+
commitText.onclick = function() {
|
|
26783
|
+
const url2 = commit.customUrl || (options == null ? void 0 : options.commit_url.replace("{commitId}", commit.id));
|
|
26784
|
+
return window.open(url2, "_blank");
|
|
26785
|
+
};
|
|
26786
|
+
}
|
|
26787
|
+
drawLines(x, y, commit) {
|
|
26788
|
+
let arrow2;
|
|
26789
|
+
let color2;
|
|
26790
|
+
let offset2;
|
|
26791
|
+
let parent;
|
|
26792
|
+
let parentCommit;
|
|
26793
|
+
let parentX1;
|
|
26794
|
+
let parentX2;
|
|
26795
|
+
let parentY;
|
|
26796
|
+
let route;
|
|
26797
|
+
const _ref = commit.parents;
|
|
26798
|
+
for (let i = 0; i < _ref.length; i++) {
|
|
26799
|
+
parent = _ref[i];
|
|
26800
|
+
parentCommit = this.preparedCommits[parent[0]];
|
|
26801
|
+
if (!parentCommit) {
|
|
26802
|
+
break;
|
|
26803
|
+
}
|
|
26804
|
+
parentY = this.offsetY + this.unitTime * parentCommit.time;
|
|
26805
|
+
parentX1 = this.offsetX + this.unitSpace * (this.mspace - parentCommit.space);
|
|
26806
|
+
parentX2 = this.offsetX + this.unitSpace * (this.mspace - parent[1]);
|
|
26807
|
+
if (parentCommit.space <= commit.space) {
|
|
26808
|
+
color2 = this.colors[commit.space];
|
|
26809
|
+
} else {
|
|
26810
|
+
color2 = this.colors[parentCommit.space];
|
|
26811
|
+
}
|
|
26812
|
+
if (parent[1] === commit.space) {
|
|
26813
|
+
offset2 = [0, 5];
|
|
26814
|
+
arrow2 = "l-2,5,4,0,-2,-5,0,5".split(",");
|
|
26815
|
+
} else if (parent[1] < commit.space) {
|
|
26816
|
+
offset2 = [3, 3];
|
|
26817
|
+
arrow2 = "l5,0,-2,4,-3,-4,4,2".split(",");
|
|
26818
|
+
} else {
|
|
26819
|
+
offset2 = [-3, 3];
|
|
26820
|
+
arrow2 = "l-5,0,2,4,3,-4,-4,2".split(",");
|
|
26821
|
+
}
|
|
26822
|
+
route = ["M", x + offset2[0], y + offset2[1]];
|
|
26823
|
+
if (i > 0) {
|
|
26824
|
+
route.push(...arrow2);
|
|
26825
|
+
}
|
|
26826
|
+
if (commit.space !== parentCommit.space || commit.space !== parent[1]) {
|
|
26827
|
+
route.push("L", parentX2, y + 10, "L", parentX2, parentY - 5);
|
|
26828
|
+
}
|
|
26829
|
+
route.push("L", parentX1, parentY);
|
|
26830
|
+
const line = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
26831
|
+
const lineAttrs = {
|
|
26832
|
+
d: route.join(" "),
|
|
26833
|
+
stroke: color2,
|
|
26834
|
+
"stroke-width": 1,
|
|
26835
|
+
fill: "none"
|
|
26836
|
+
};
|
|
26837
|
+
this.setNodeAttr(line, lineAttrs);
|
|
26838
|
+
this.svg.appendChild(line);
|
|
26839
|
+
}
|
|
26840
|
+
}
|
|
26841
|
+
appendLabel(x, y, commit) {
|
|
26842
|
+
let shortrefs;
|
|
26843
|
+
if (!commit.refs) {
|
|
26844
|
+
return;
|
|
26845
|
+
}
|
|
26846
|
+
shortrefs = commit.refs;
|
|
26847
|
+
if (shortrefs.length > 7) {
|
|
26848
|
+
if (escape(shortrefs).indexOf("%u") < 0) {
|
|
26849
|
+
shortrefs = shortrefs.substr(0, 5) + "...";
|
|
26850
|
+
} else {
|
|
26851
|
+
shortrefs = shortrefs.substr(0, 3) + "...";
|
|
26852
|
+
}
|
|
26853
|
+
}
|
|
26854
|
+
const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
26855
|
+
const textAttrs = {
|
|
26856
|
+
x: x + 4,
|
|
26857
|
+
y: y + 4,
|
|
26858
|
+
"text-anchor": "start",
|
|
26859
|
+
fill: "none",
|
|
26860
|
+
style: "font-size: 10px;"
|
|
26861
|
+
};
|
|
26862
|
+
this.setNodeAttr(text, textAttrs);
|
|
26863
|
+
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
26864
|
+
const rect = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
26865
|
+
tspan.appendChild(document.createTextNode(shortrefs));
|
|
26866
|
+
text.appendChild(tspan);
|
|
26867
|
+
const titleText = document.createElementNS("http://www.w3.org/2000/svg", "title");
|
|
26868
|
+
titleText.appendChild(document.createTextNode(commit.refs));
|
|
26869
|
+
text.appendChild(titleText);
|
|
26870
|
+
this.svg.appendChild(rect);
|
|
26871
|
+
this.svg.appendChild(text);
|
|
26872
|
+
setTimeout(() => {
|
|
26873
|
+
const textbox = text.getBBox();
|
|
26874
|
+
const path = [
|
|
26875
|
+
"M",
|
|
26876
|
+
x,
|
|
26877
|
+
y - 7,
|
|
26878
|
+
"L",
|
|
26879
|
+
x,
|
|
26880
|
+
y - 7 + textbox.height + 4,
|
|
26881
|
+
"L",
|
|
26882
|
+
x + textbox.width + 8,
|
|
26883
|
+
y - 7 + textbox.height + 4,
|
|
26884
|
+
"L",
|
|
26885
|
+
x + textbox.width + 8,
|
|
26886
|
+
y + 4,
|
|
26887
|
+
"L",
|
|
26888
|
+
x + textbox.width + 18,
|
|
26889
|
+
y,
|
|
26890
|
+
"L",
|
|
26891
|
+
x + textbox.width + 8,
|
|
26892
|
+
y - 4,
|
|
26893
|
+
"L",
|
|
26894
|
+
x + textbox.width + 8,
|
|
26895
|
+
y - 7,
|
|
26896
|
+
"Z"
|
|
26897
|
+
];
|
|
26898
|
+
const rectAttrs = {
|
|
26899
|
+
fill: this.isDark ? "#4C4C4C" : "#fff",
|
|
26900
|
+
stroke: this.colors[commit.space],
|
|
26901
|
+
"stroke-width": "1px",
|
|
26902
|
+
d: path.join(" "),
|
|
26903
|
+
transform: `matrix(1,0,0,1,-${textbox.width + 26},0)`
|
|
26904
|
+
};
|
|
26905
|
+
const newAttrs = {
|
|
26906
|
+
transform: `matrix(1,0,0,1,-${textbox.width + 26},0)`,
|
|
26907
|
+
fill: this.colors[commit.space]
|
|
26908
|
+
};
|
|
26909
|
+
this.setNodeAttr(text, newAttrs);
|
|
26910
|
+
this.setNodeAttr(rect, rectAttrs);
|
|
26911
|
+
});
|
|
26912
|
+
}
|
|
26913
|
+
appendAnchor(x, y, commit, refName) {
|
|
26914
|
+
const options = this.options;
|
|
26915
|
+
const isDark = this.isDark;
|
|
26916
|
+
const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
26917
|
+
const attrs = {
|
|
26918
|
+
cx: x,
|
|
26919
|
+
cy: y,
|
|
26920
|
+
r: 10,
|
|
26921
|
+
fill: "#000",
|
|
26922
|
+
opacity: 0,
|
|
26923
|
+
style: "cursor:pointer;"
|
|
26924
|
+
};
|
|
26925
|
+
this.setNodeAttr(circle, attrs);
|
|
26926
|
+
circle.onclick = function() {
|
|
26927
|
+
localStorage.setItem("refName", refName);
|
|
26928
|
+
const url2 = commit.customUrl || (options == null ? void 0 : options.commit_url.replace("{commitId}", commit.id));
|
|
26929
|
+
return window.open(url2, "_blank");
|
|
26930
|
+
};
|
|
26931
|
+
circle.onmouseover = () => {
|
|
26932
|
+
this.commitTooltip(x + 20, y + 20, commit, isDark);
|
|
26933
|
+
};
|
|
26934
|
+
circle.onmouseleave = () => {
|
|
26935
|
+
this.toolTipList.forEach((element) => {
|
|
26936
|
+
this.svg.removeChild(element);
|
|
26937
|
+
});
|
|
26938
|
+
};
|
|
26939
|
+
this.svg.appendChild(circle);
|
|
26940
|
+
}
|
|
26941
|
+
getText(x, y, text, attrs = {}) {
|
|
26942
|
+
const resText = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
26943
|
+
this.setNodeAttr(resText, __spreadValues({
|
|
26944
|
+
x,
|
|
26945
|
+
y
|
|
26946
|
+
}, attrs));
|
|
26947
|
+
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
26948
|
+
tspan.appendChild(document.createTextNode(text));
|
|
26949
|
+
resText.appendChild(tspan);
|
|
26950
|
+
return resText;
|
|
26951
|
+
}
|
|
26952
|
+
commitTooltip(x, y, commit, isDark) {
|
|
26953
|
+
let boxHeight;
|
|
26954
|
+
let boxWidth;
|
|
26955
|
+
let messageText;
|
|
26956
|
+
boxWidth = 300;
|
|
26957
|
+
boxHeight = 200;
|
|
26958
|
+
const nameText = this.getText(x, y + 10, commit.author.name, {
|
|
26959
|
+
font: "14px Arial",
|
|
26960
|
+
"font-weight": "bold",
|
|
26961
|
+
"text-anchor": "start"
|
|
26962
|
+
});
|
|
26963
|
+
const idText = this.getText(x, y + 55, commit.id, {
|
|
26964
|
+
fill: isDark ? "#73788a" : "#71757f",
|
|
26965
|
+
"text-anchor": "start"
|
|
26966
|
+
});
|
|
26967
|
+
const timeText = this.getText(x, y + 35, this.__transform(commit.date), {
|
|
26968
|
+
font: "12px Arial",
|
|
26969
|
+
fill: isDark ? "#73788a" : "#71757f",
|
|
26970
|
+
"text-anchor": "start"
|
|
26971
|
+
});
|
|
26972
|
+
const branchText = commit.branch ? this.getText(x + 70, y + 35, commit.branch, {
|
|
26973
|
+
font: "12px Arial",
|
|
26974
|
+
fill: isDark ? "#73788a" : "#71757f"
|
|
26975
|
+
}) : null;
|
|
26976
|
+
const strList = commit.message.split("\n");
|
|
26977
|
+
if (strList.length > 10) {
|
|
26978
|
+
messageText = this.getText(x, y + 70, strList.slice(0, 10).join("\n") + "...", {
|
|
26979
|
+
fill: isDark ? "#E8E8E8" : "#2e2e2e",
|
|
26980
|
+
"text-anchor": "start",
|
|
26981
|
+
font: "12px Monaco, monospace"
|
|
26982
|
+
});
|
|
26983
|
+
} else if (commit.message.length > 1500) {
|
|
26984
|
+
messageText = this.getText(x, y + 70, commit.message.slice(0, 1500) + "...", {
|
|
26985
|
+
fill: isDark ? "#E8E8E8" : "#2e2e2e",
|
|
26986
|
+
"text-anchor": "start",
|
|
26987
|
+
font: "12px Monaco, monospace"
|
|
26988
|
+
});
|
|
26989
|
+
} else {
|
|
26990
|
+
messageText = this.getText(x, y + 70, commit.message, {
|
|
26991
|
+
fill: isDark ? "#E8E8E8" : "#2e2e2e",
|
|
26992
|
+
"text-anchor": "start",
|
|
26993
|
+
font: "12px Monaco, monospace"
|
|
26994
|
+
});
|
|
26995
|
+
}
|
|
26996
|
+
const textArr = commit.branch ? [nameText, idText, messageText, timeText, branchText] : [nameText, idText, messageText, timeText];
|
|
26997
|
+
this.textWrap(messageText, boxWidth - 50, x);
|
|
26998
|
+
const rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
26999
|
+
this.setNodeAttr(rect, {
|
|
27000
|
+
x: x - 10,
|
|
27001
|
+
y: y - 10,
|
|
27002
|
+
width: boxWidth,
|
|
27003
|
+
height: 100,
|
|
27004
|
+
fill: isDark ? "#4c4c4c" : "#fff",
|
|
27005
|
+
stroke: isDark ? "#4c4c4c" : "#fff",
|
|
27006
|
+
"stroke-linecap": "round",
|
|
27007
|
+
"stroke-width": "1px"
|
|
27008
|
+
});
|
|
27009
|
+
textArr.unshift(rect);
|
|
27010
|
+
const rectShadow = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
27011
|
+
this.setNodeAttr(rectShadow, {
|
|
27012
|
+
x: x - 11,
|
|
27013
|
+
y: y - 10,
|
|
27014
|
+
width: boxWidth + 2,
|
|
27015
|
+
height: 100,
|
|
27016
|
+
fill: isDark ? "#4c4c4c" : "#eee",
|
|
27017
|
+
stroke: isDark ? "#4c4c4c" : "#eee",
|
|
27018
|
+
"stroke-linecap": "round",
|
|
27019
|
+
"stroke-width": "1px"
|
|
27020
|
+
});
|
|
27021
|
+
textArr.unshift(rectShadow);
|
|
27022
|
+
textArr.forEach((t) => {
|
|
27023
|
+
this.svg.appendChild(t);
|
|
27024
|
+
});
|
|
27025
|
+
boxWidth = messageText.getBBox().width + 20 > boxWidth ? messageText.getBBox().width + 20 : boxWidth;
|
|
27026
|
+
boxHeight = 80 + messageText.getBBox().height;
|
|
27027
|
+
this.toolTipList = textArr;
|
|
27028
|
+
this.setNodeAttr(rect, {
|
|
27029
|
+
height: boxHeight + 10,
|
|
27030
|
+
width: boxWidth
|
|
27031
|
+
});
|
|
27032
|
+
this.setNodeAttr(rectShadow, {
|
|
27033
|
+
height: boxHeight + 13,
|
|
27034
|
+
width: boxWidth + 2
|
|
27035
|
+
});
|
|
27036
|
+
}
|
|
27037
|
+
textWrap(t, width, x) {
|
|
27038
|
+
const content2 = t.children[0].innerHTML;
|
|
27039
|
+
let words = content2.split("\n").filter((item) => item !== "");
|
|
27040
|
+
words = words.map((str) => {
|
|
27041
|
+
str = str.trim();
|
|
27042
|
+
let len = str.length;
|
|
27043
|
+
const strList = [];
|
|
27044
|
+
while (len > 70) {
|
|
27045
|
+
strList.push(str.slice(0, 70));
|
|
27046
|
+
str = str.slice(70);
|
|
27047
|
+
len = str.length;
|
|
27048
|
+
}
|
|
27049
|
+
strList.push(str);
|
|
27050
|
+
return strList.join("\n");
|
|
27051
|
+
});
|
|
27052
|
+
t.removeChild(t.children[0]);
|
|
27053
|
+
words.forEach((str) => {
|
|
27054
|
+
const list2 = str.split("\n");
|
|
27055
|
+
list2.forEach((item) => {
|
|
27056
|
+
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
27057
|
+
tspan.appendChild(document.createTextNode(item));
|
|
27058
|
+
this.setNodeAttr(tspan, {
|
|
27059
|
+
dy: 14.4,
|
|
27060
|
+
x
|
|
27061
|
+
});
|
|
27062
|
+
t.appendChild(tspan);
|
|
27063
|
+
});
|
|
27064
|
+
const space = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
27065
|
+
space.appendChild(document.createTextNode(" "));
|
|
27066
|
+
this.setNodeAttr(space, {
|
|
27067
|
+
dy: 14.4,
|
|
27068
|
+
x
|
|
27069
|
+
});
|
|
27070
|
+
t.appendChild(space);
|
|
27071
|
+
});
|
|
27072
|
+
}
|
|
27073
|
+
}
|
|
27074
|
+
function useGitGraph(props, ctx2, isDark) {
|
|
27075
|
+
let themeService;
|
|
27076
|
+
const graph = new GitGraph$1();
|
|
27077
|
+
const themeChange = () => {
|
|
27078
|
+
var _a;
|
|
27079
|
+
isDark.value = !!((_a = themeService == null ? void 0 : themeService.currentTheme) == null ? void 0 : _a.isDark);
|
|
27080
|
+
};
|
|
27081
|
+
const initTheme = () => {
|
|
27082
|
+
var _a;
|
|
27083
|
+
themeService = window["devuiThemeService"];
|
|
27084
|
+
isDark.value = !!((_a = themeService == null ? void 0 : themeService.currentTheme) == null ? void 0 : _a.isDark);
|
|
27085
|
+
if (themeService) {
|
|
27086
|
+
themeService.eventBus.add("themeChanged", themeChange);
|
|
27087
|
+
}
|
|
27088
|
+
};
|
|
27089
|
+
const initGraph = (element, options, isDarkMode) => {
|
|
27090
|
+
graph.load(element, options, isDarkMode);
|
|
27091
|
+
};
|
|
27092
|
+
return {
|
|
27093
|
+
initTheme,
|
|
27094
|
+
initGraph
|
|
27095
|
+
};
|
|
27096
|
+
}
|
|
27097
|
+
var GitGraph = defineComponent({
|
|
27098
|
+
name: "DGitGraph",
|
|
27099
|
+
props: gitGraphProps,
|
|
27100
|
+
emits: ["scrollToBottom"],
|
|
27101
|
+
setup(props, ctx2) {
|
|
27102
|
+
const isDark = ref(false);
|
|
27103
|
+
const {
|
|
27104
|
+
initTheme,
|
|
27105
|
+
initGraph
|
|
27106
|
+
} = useGitGraph(props, ctx2, isDark);
|
|
27107
|
+
onMounted(() => {
|
|
27108
|
+
nextTick(() => {
|
|
27109
|
+
const graphEle = document.getElementsByClassName("d-graph-wrapper")[0];
|
|
27110
|
+
initTheme();
|
|
27111
|
+
initGraph(graphEle, props.option, isDark.value);
|
|
27112
|
+
});
|
|
27113
|
+
});
|
|
27114
|
+
return () => createVNode("div", {
|
|
27115
|
+
"class": "d-graph-wrapper"
|
|
27116
|
+
}, null);
|
|
27117
|
+
}
|
|
27118
|
+
});
|
|
27119
|
+
var GitGraphInstall = {
|
|
27120
|
+
title: "GitGraph \u63D0\u4EA4\u7F51\u7EDC\u56FE",
|
|
27121
|
+
category: "\u6F14\u8FDB\u4E2D",
|
|
27122
|
+
status: "100%",
|
|
27123
|
+
install(app) {
|
|
27124
|
+
app.component(GitGraph.name, GitGraph);
|
|
27125
|
+
}
|
|
27126
|
+
};
|
|
26132
27127
|
const rowProps = {
|
|
26133
27128
|
align: {
|
|
26134
27129
|
type: String,
|
|
@@ -42149,6 +43144,7 @@ const installs = [
|
|
|
42149
43144
|
FormInstall,
|
|
42150
43145
|
FullscreenInstall,
|
|
42151
43146
|
GanttInstall,
|
|
43147
|
+
GitGraphInstall,
|
|
42152
43148
|
GridInstall,
|
|
42153
43149
|
IconInstall,
|
|
42154
43150
|
ImagePreviewInstall,
|
|
@@ -42203,9 +43199,9 @@ const installs = [
|
|
|
42203
43199
|
VirtualListInstall
|
|
42204
43200
|
];
|
|
42205
43201
|
var vueDevui = {
|
|
42206
|
-
version: "1.5.
|
|
43202
|
+
version: "1.5.8",
|
|
42207
43203
|
install(app) {
|
|
42208
43204
|
installs.forEach((p) => app.use(p));
|
|
42209
43205
|
}
|
|
42210
43206
|
};
|
|
42211
|
-
export { Accordion, ActionTimeline, Alert, Anchor, Aside, AutoComplete, Avatar, BackTop, Badge, Breadcrumb, BreadcrumbItem, DButton as Button, ButtonGroup, Card, Carousel, CarouselItem, Cascader, Checkbox, CheckboxButton, DCheckboxGroup as CheckboxGroup, CodeEditor, CodeReview, Col, Collapse, CollapseItem, ColorPicker, Column, Comment, Content, Countdown, DChart, DRangeDatePickerPro, DatePicker, DatePickerPro, DraggableDirective, Drawer, DrawerService, Dropdown$1 as Dropdown, DropdownMenu, DroppableDirective, EditableSelect, EditorMd, FixedOverlay, FlexibleOverlay, Footer, Form, FormItem, FormOperation, Fullscreen, Gantt, Header, DIcon as Icon, IconGroup, ImagePreviewDirective, ImagePreviewService, DInput as Input, InputIcon, InputNumber, Layout, List, ListItem, LoadingDirective, loading as LoadingService, MdRender, Mention, Menu, MenuItem, Message, Modal, ModalBody, ModalFooter, ModalHeader, MultiAutoComplete, NavSprite, Notification, NotificationService, Option, OptionGroup, Pagination, Panel, PanelBody, PanelFooter, PanelHeader, Popover, Progress, QuadrantDiagram, Radio, RadioButton, RadioGroup, Rate, ReadTip, Result, RippleDirective, Row, DSearch as Search, Select, Skeleton, SkeletonItem, Slider, SortableDirective, Splitter, SplitterPane, Statistic, Status, Step, Steps, StepsGuide, StepsGuideDirective, StickSlider, Sticky, SubMenu, Switch, Tab, Table, Tabs, Tag, TagInput, Textarea, TimePicker, TimeSelect, Timeline, TimelineItem, Tooltip, Transfer, Tree, TreeSelect, Upload, VirtualList, vueDevui as default, fileDropDirective };
|
|
43207
|
+
export { Accordion, ActionTimeline, Alert, Anchor, Aside, AutoComplete, Avatar, BackTop, Badge, Breadcrumb, BreadcrumbItem, DButton as Button, ButtonGroup, Card, Carousel, CarouselItem, Cascader, Checkbox, CheckboxButton, DCheckboxGroup as CheckboxGroup, CodeEditor, CodeReview, Col, Collapse, CollapseItem, ColorPicker, Column, Comment, Content, Countdown, DChart, DRangeDatePickerPro, DatePicker, DatePickerPro, DraggableDirective, Drawer, DrawerService, Dropdown$1 as Dropdown, DropdownMenu, DroppableDirective, EditableSelect, EditorMd, FixedOverlay, FlexibleOverlay, Footer, Form, FormItem, FormOperation, Fullscreen, Gantt, GitGraph, Header, DIcon as Icon, IconGroup, ImagePreviewDirective, ImagePreviewService, DInput as Input, InputIcon, InputNumber, Layout, List, ListItem, LoadingDirective, loading as LoadingService, MdRender, Mention, Menu, MenuItem, Message, Modal, ModalBody, ModalFooter, ModalHeader, MultiAutoComplete, NavSprite, Notification, NotificationService, Option, OptionGroup, Pagination, Panel, PanelBody, PanelFooter, PanelHeader, Popover, Progress, QuadrantDiagram, Radio, RadioButton, RadioGroup, Rate, ReadTip, Result, RippleDirective, Row, DSearch as Search, Select, Skeleton, SkeletonItem, Slider, SortableDirective, Splitter, SplitterPane, Statistic, Status, Step, Steps, StepsGuide, StepsGuideDirective, StickSlider, Sticky, SubMenu, Switch, Tab, Table, Tabs, Tag, TagInput, Textarea, TimePicker, TimeSelect, Timeline, TimelineItem, Tooltip, Transfer, Tree, TreeSelect, Upload, VirtualList, vueDevui as default, fileDropDirective };
|