vue-devui 1.5.9 → 1.5.11
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 +4 -3
- package/alert/index.umd.js +3 -3
- package/alert/style.css +1 -1
- package/avatar/index.es.js +9 -6
- package/avatar/index.umd.js +3 -3
- package/avatar/style.css +1 -1
- package/badge/index.es.js +1 -0
- package/badge/index.umd.js +1 -1
- package/carousel/index.es.js +46 -9
- package/carousel/index.umd.js +1 -1
- package/carousel/style.css +1 -1
- package/code-review/index.es.js +478 -151
- package/code-review/index.umd.js +49 -24
- package/code-review/style.css +1 -1
- package/collapse/index.es.js +1 -1
- package/collapse/index.umd.js +2 -2
- package/collapse/style.css +1 -1
- package/editor-md/index.es.js +913 -91
- package/editor-md/index.umd.js +47 -47
- package/global.d.ts +0 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/table/index.es.js +3 -3
- package/table/index.umd.js +2 -2
- package/types/avatar/src/avatar.d.ts +4 -2
- package/types/code-review/src/code-review-types.d.ts +14 -2
- package/types/code-review/src/code-review.d.ts +32 -5
- package/types/code-review/src/composables/use-code-review-comment.d.ts +10 -6
- package/types/code-review/src/const.d.ts +20 -0
- package/types/code-review/src/utils.d.ts +8 -3
- package/types/editor-md/src/editor-md.d.ts +2 -2
- package/types/fullscreen/index.d.ts +0 -1
- package/types/fullscreen/src/fullscreen-types.d.ts +2 -3
- package/types/fullscreen/src/fullscreen.d.ts +3 -3
- package/types/shared/utils/index.d.ts +2 -0
- package/types/shared/utils/use-namespace.d.ts +13 -0
- package/vue-devui.es.js +1665 -533
- package/vue-devui.umd.js +110 -85
- package/fullscreen/index.es.js +0 -166
- package/fullscreen/index.umd.js +0 -1
- package/fullscreen/package.json +0 -8
- package/fullscreen/style.css +0 -1
- package/nuxt/components/Fullscreen.js +0 -3
- package/nuxt/components/fullscreenProps.js +0 -3
package/code-review/index.es.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import { watch, onUnmounted, defineComponent, toRefs, createVNode, Transition, mergeProps, ref, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, provide, Teleport, createTextVNode, vShow } from "vue";
|
|
2
18
|
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
3
19
|
import Clipboard from "clipboard";
|
|
4
20
|
import * as Diff2Html from "diff2html";
|
|
@@ -284,6 +300,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
284
300
|
};
|
|
285
301
|
}
|
|
286
302
|
});
|
|
303
|
+
const inBrowser = typeof window !== "undefined";
|
|
287
304
|
const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
|
|
288
305
|
const isObject = (val) => val !== null && typeof val === "object";
|
|
289
306
|
const ns$1 = useNamespace("popper-trigger");
|
|
@@ -1083,7 +1100,7 @@ var lodash = { exports: {} };
|
|
|
1083
1100
|
}
|
|
1084
1101
|
var runInContext = function runInContext2(context) {
|
|
1085
1102
|
context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
|
|
1086
|
-
var Array2 = context.Array, Date = context.Date,
|
|
1103
|
+
var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
|
|
1087
1104
|
var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
|
|
1088
1105
|
var coreJsData = context["__core-js_shared__"];
|
|
1089
1106
|
var funcToString = funcProto.toString;
|
|
@@ -1097,7 +1114,7 @@ var lodash = { exports: {} };
|
|
|
1097
1114
|
var objectCtorString = funcToString.call(Object2);
|
|
1098
1115
|
var oldDash = root._;
|
|
1099
1116
|
var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
1100
|
-
var
|
|
1117
|
+
var Buffer2 = moduleExports ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined$1;
|
|
1101
1118
|
var defineProperty = function() {
|
|
1102
1119
|
try {
|
|
1103
1120
|
var func = getNative(Object2, "defineProperty");
|
|
@@ -1107,11 +1124,11 @@ var lodash = { exports: {} };
|
|
|
1107
1124
|
}
|
|
1108
1125
|
}();
|
|
1109
1126
|
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
|
|
1110
|
-
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer =
|
|
1111
|
-
var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"),
|
|
1112
|
-
var metaMap =
|
|
1127
|
+
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
|
|
1128
|
+
var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
|
|
1129
|
+
var metaMap = WeakMap2 && new WeakMap2();
|
|
1113
1130
|
var realNames = {};
|
|
1114
|
-
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(
|
|
1131
|
+
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap2);
|
|
1115
1132
|
var symbolProto = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1, symbolToString = symbolProto ? symbolProto.toString : undefined$1;
|
|
1116
1133
|
function lodash2(value) {
|
|
1117
1134
|
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
|
|
@@ -1564,7 +1581,7 @@ var lodash = { exports: {} };
|
|
|
1564
1581
|
}
|
|
1565
1582
|
function baseDelay(func, wait, args) {
|
|
1566
1583
|
if (typeof func != "function") {
|
|
1567
|
-
throw new
|
|
1584
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
1568
1585
|
}
|
|
1569
1586
|
return setTimeout(function() {
|
|
1570
1587
|
func.apply(undefined$1, args);
|
|
@@ -2359,7 +2376,7 @@ var lodash = { exports: {} };
|
|
|
2359
2376
|
}
|
|
2360
2377
|
function cloneArrayBuffer(arrayBuffer) {
|
|
2361
2378
|
var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
2362
|
-
new
|
|
2379
|
+
new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
|
|
2363
2380
|
return result2;
|
|
2364
2381
|
}
|
|
2365
2382
|
function cloneDataView(dataView, isDeep) {
|
|
@@ -2608,7 +2625,7 @@ var lodash = { exports: {} };
|
|
|
2608
2625
|
while (index2--) {
|
|
2609
2626
|
var func = funcs[index2];
|
|
2610
2627
|
if (typeof func != "function") {
|
|
2611
|
-
throw new
|
|
2628
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
2612
2629
|
}
|
|
2613
2630
|
if (prereq && !wrapper && getFuncName(func) == "wrapper") {
|
|
2614
2631
|
var wrapper = new LodashWrapper([], true);
|
|
@@ -2821,7 +2838,7 @@ var lodash = { exports: {} };
|
|
|
2821
2838
|
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
|
|
2822
2839
|
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
|
|
2823
2840
|
if (!isBindKey && typeof func != "function") {
|
|
2824
|
-
throw new
|
|
2841
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
2825
2842
|
}
|
|
2826
2843
|
var length = partials ? partials.length : 0;
|
|
2827
2844
|
if (!length) {
|
|
@@ -2941,7 +2958,7 @@ var lodash = { exports: {} };
|
|
|
2941
2958
|
object = object.buffer;
|
|
2942
2959
|
other = other.buffer;
|
|
2943
2960
|
case arrayBufferTag:
|
|
2944
|
-
if (object.byteLength != other.byteLength || !equalFunc(new
|
|
2961
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
|
|
2945
2962
|
return false;
|
|
2946
2963
|
}
|
|
2947
2964
|
return true;
|
|
@@ -3103,7 +3120,7 @@ var lodash = { exports: {} };
|
|
|
3103
3120
|
return result2;
|
|
3104
3121
|
};
|
|
3105
3122
|
var getTag = baseGetTag;
|
|
3106
|
-
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag ||
|
|
3123
|
+
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
|
|
3107
3124
|
getTag = function(value) {
|
|
3108
3125
|
var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined$1, ctorString = Ctor ? toSource(Ctor) : "";
|
|
3109
3126
|
if (ctorString) {
|
|
@@ -4088,7 +4105,7 @@ var lodash = { exports: {} };
|
|
|
4088
4105
|
};
|
|
4089
4106
|
function after(n, func) {
|
|
4090
4107
|
if (typeof func != "function") {
|
|
4091
|
-
throw new
|
|
4108
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4092
4109
|
}
|
|
4093
4110
|
n = toInteger(n);
|
|
4094
4111
|
return function() {
|
|
@@ -4105,7 +4122,7 @@ var lodash = { exports: {} };
|
|
|
4105
4122
|
function before(n, func) {
|
|
4106
4123
|
var result2;
|
|
4107
4124
|
if (typeof func != "function") {
|
|
4108
|
-
throw new
|
|
4125
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4109
4126
|
}
|
|
4110
4127
|
n = toInteger(n);
|
|
4111
4128
|
return function() {
|
|
@@ -4149,7 +4166,7 @@ var lodash = { exports: {} };
|
|
|
4149
4166
|
function debounce(func, wait, options) {
|
|
4150
4167
|
var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
4151
4168
|
if (typeof func != "function") {
|
|
4152
|
-
throw new
|
|
4169
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4153
4170
|
}
|
|
4154
4171
|
wait = toNumber(wait) || 0;
|
|
4155
4172
|
if (isObject2(options)) {
|
|
@@ -4238,7 +4255,7 @@ var lodash = { exports: {} };
|
|
|
4238
4255
|
}
|
|
4239
4256
|
function memoize(func, resolver) {
|
|
4240
4257
|
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
|
4241
|
-
throw new
|
|
4258
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4242
4259
|
}
|
|
4243
4260
|
var memoized = function() {
|
|
4244
4261
|
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
@@ -4255,7 +4272,7 @@ var lodash = { exports: {} };
|
|
|
4255
4272
|
memoize.Cache = MapCache;
|
|
4256
4273
|
function negate(predicate) {
|
|
4257
4274
|
if (typeof predicate != "function") {
|
|
4258
|
-
throw new
|
|
4275
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4259
4276
|
}
|
|
4260
4277
|
return function() {
|
|
4261
4278
|
var args = arguments;
|
|
@@ -4299,14 +4316,14 @@ var lodash = { exports: {} };
|
|
|
4299
4316
|
});
|
|
4300
4317
|
function rest(func, start) {
|
|
4301
4318
|
if (typeof func != "function") {
|
|
4302
|
-
throw new
|
|
4319
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4303
4320
|
}
|
|
4304
4321
|
start = start === undefined$1 ? start : toInteger(start);
|
|
4305
4322
|
return baseRest(func, start);
|
|
4306
4323
|
}
|
|
4307
4324
|
function spread(func, start) {
|
|
4308
4325
|
if (typeof func != "function") {
|
|
4309
|
-
throw new
|
|
4326
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4310
4327
|
}
|
|
4311
4328
|
start = start == null ? 0 : nativeMax(toInteger(start), 0);
|
|
4312
4329
|
return baseRest(function(args) {
|
|
@@ -4320,7 +4337,7 @@ var lodash = { exports: {} };
|
|
|
4320
4337
|
function throttle(func, wait, options) {
|
|
4321
4338
|
var leading = true, trailing = true;
|
|
4322
4339
|
if (typeof func != "function") {
|
|
4323
|
-
throw new
|
|
4340
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
4324
4341
|
}
|
|
4325
4342
|
if (isObject2(options)) {
|
|
4326
4343
|
leading = "leading" in options ? !!options.leading : leading;
|
|
@@ -4462,7 +4479,7 @@ var lodash = { exports: {} };
|
|
|
4462
4479
|
}
|
|
4463
4480
|
function isNative(value) {
|
|
4464
4481
|
if (isMaskable(value)) {
|
|
4465
|
-
throw new
|
|
4482
|
+
throw new Error2(CORE_ERROR_TEXT);
|
|
4466
4483
|
}
|
|
4467
4484
|
return baseIsNative(value);
|
|
4468
4485
|
}
|
|
@@ -5000,7 +5017,7 @@ var lodash = { exports: {} };
|
|
|
5000
5017
|
if (!variable) {
|
|
5001
5018
|
source = "with (obj) {\n" + source + "\n}\n";
|
|
5002
5019
|
} else if (reForbiddenIdentifierChars.test(variable)) {
|
|
5003
|
-
throw new
|
|
5020
|
+
throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
|
|
5004
5021
|
}
|
|
5005
5022
|
source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
|
|
5006
5023
|
source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
|
|
@@ -5119,7 +5136,7 @@ var lodash = { exports: {} };
|
|
|
5119
5136
|
try {
|
|
5120
5137
|
return apply(func, undefined$1, args);
|
|
5121
5138
|
} catch (e) {
|
|
5122
|
-
return isError(e) ? e : new
|
|
5139
|
+
return isError(e) ? e : new Error2(e);
|
|
5123
5140
|
}
|
|
5124
5141
|
});
|
|
5125
5142
|
var bindAll = flatRest(function(object, methodNames) {
|
|
@@ -5133,7 +5150,7 @@ var lodash = { exports: {} };
|
|
|
5133
5150
|
var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
|
|
5134
5151
|
pairs = !length ? [] : arrayMap(pairs, function(pair) {
|
|
5135
5152
|
if (typeof pair[1] != "function") {
|
|
5136
|
-
throw new
|
|
5153
|
+
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
5137
5154
|
}
|
|
5138
5155
|
return [toIteratee(pair[0]), pair[1]];
|
|
5139
5156
|
});
|
|
@@ -6199,15 +6216,27 @@ const codeReviewProps = {
|
|
|
6199
6216
|
type: Boolean,
|
|
6200
6217
|
default: false
|
|
6201
6218
|
},
|
|
6219
|
+
allowComment: {
|
|
6220
|
+
type: Boolean,
|
|
6221
|
+
default: true
|
|
6222
|
+
},
|
|
6223
|
+
allowExpand: {
|
|
6224
|
+
type: Boolean,
|
|
6225
|
+
default: true
|
|
6226
|
+
},
|
|
6227
|
+
showBlob: {
|
|
6228
|
+
type: Boolean,
|
|
6229
|
+
default: false
|
|
6230
|
+
},
|
|
6202
6231
|
outputFormat: {
|
|
6203
6232
|
type: String,
|
|
6204
6233
|
default: "line-by-line"
|
|
6205
6234
|
},
|
|
6206
|
-
|
|
6235
|
+
expandThreshold: {
|
|
6207
6236
|
type: Number,
|
|
6208
6237
|
default: 50
|
|
6209
6238
|
},
|
|
6210
|
-
|
|
6239
|
+
expandLoader: {
|
|
6211
6240
|
type: Function
|
|
6212
6241
|
}
|
|
6213
6242
|
};
|
|
@@ -6300,25 +6329,98 @@ var CodeReviewHeader = defineComponent({
|
|
|
6300
6329
|
});
|
|
6301
6330
|
const ExpandLineReg = /^@@ -(\d+),(\d+) \+(\d+),(\d+) @@/;
|
|
6302
6331
|
const FirstLineReg = /^@@ -[0,1](?!\d)/;
|
|
6332
|
+
const TableTrReg = /<tr[^>]*>[\s\S]*?<\/tr>/gi;
|
|
6333
|
+
const TableTdReg = /<td[^>]*>[\s\S]*?<\/td>/gi;
|
|
6334
|
+
const TableTbodyReg = /<tbody[^>]*>[\s\S]*?<\/tbody>/gi;
|
|
6335
|
+
const TableTbodyAttrReg = /<tbody([^>]*)>/i;
|
|
6336
|
+
const EmptyDataLangReg = /<div[^>]* data-lang="">[\s\S]*?<\/div>/gi;
|
|
6337
|
+
const LineByLineTemplate = `<div id="{{fileHtmlId}}" class="d2h-file-wrapper" data-lang="{{file.language}}">
|
|
6338
|
+
<div class="d2h-file-diff">
|
|
6339
|
+
<div class="d2h-code-wrapper">
|
|
6340
|
+
<table class="d2h-diff-table">
|
|
6341
|
+
<tbody class="d2h-diff-tbody">
|
|
6342
|
+
{{{diffs}}}
|
|
6343
|
+
</tbody>
|
|
6344
|
+
</table>
|
|
6345
|
+
</div>
|
|
6346
|
+
</div>
|
|
6347
|
+
</div>`;
|
|
6348
|
+
const SideBySideTemplate = `<div id="{{fileHtmlId}}" class="d2h-file-wrapper" data-lang="{{file.language}}">
|
|
6349
|
+
<div class="d2h-files-diff">
|
|
6350
|
+
<div class="d2h-file-side-diff">
|
|
6351
|
+
<div class="d2h-code-wrapper">
|
|
6352
|
+
<table class="d2h-diff-table">
|
|
6353
|
+
<tbody class="d2h-diff-tbody">
|
|
6354
|
+
{{{diffs.left}}}
|
|
6355
|
+
{{{diffs.right}}}
|
|
6356
|
+
</tbody>
|
|
6357
|
+
</table>
|
|
6358
|
+
</div>
|
|
6359
|
+
</div>
|
|
6360
|
+
</div>
|
|
6361
|
+
</div>`;
|
|
6362
|
+
const EmptyTemplate = {
|
|
6363
|
+
"generic-empty-diff": ""
|
|
6364
|
+
};
|
|
6365
|
+
const TemplateMap = {
|
|
6366
|
+
"line-by-line": __spreadValues({ "line-by-line-file-diff": LineByLineTemplate }, EmptyTemplate),
|
|
6367
|
+
"side-by-side": __spreadValues({ "side-by-side-file-diff": SideBySideTemplate }, EmptyTemplate)
|
|
6368
|
+
};
|
|
6303
6369
|
function notEmptyNode(node) {
|
|
6304
6370
|
const classes = node.classList;
|
|
6305
6371
|
return !classes.contains("d2h-info") && !classes.contains("d2h-emptyplaceholder") && !classes.contains("comment-cell");
|
|
6306
6372
|
}
|
|
6307
6373
|
function insertIncrementLineToPage(referenceDom, trNodes, direction) {
|
|
6308
|
-
const trNodesToBeInserted = trNodes.filter((element) => element.children[0].children.length === 2);
|
|
6309
6374
|
if (direction === "up") {
|
|
6310
6375
|
const nextSibling = referenceDom.nextElementSibling;
|
|
6311
|
-
|
|
6376
|
+
trNodes.forEach((item) => {
|
|
6312
6377
|
var _a;
|
|
6313
6378
|
(_a = referenceDom.parentNode) == null ? void 0 : _a.insertBefore(item, nextSibling);
|
|
6314
6379
|
});
|
|
6315
6380
|
} else {
|
|
6316
|
-
|
|
6381
|
+
trNodes.forEach((item) => {
|
|
6317
6382
|
var _a;
|
|
6318
6383
|
(_a = referenceDom.parentNode) == null ? void 0 : _a.insertBefore(item, referenceDom);
|
|
6319
6384
|
});
|
|
6320
6385
|
}
|
|
6321
6386
|
}
|
|
6387
|
+
function ifRemoveExpandLineForDoubleColumn(expandDom, newExpandDom, direction) {
|
|
6388
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6389
|
+
const matches = newExpandDom.children[1].innerText.trim().match(ExpandLineReg);
|
|
6390
|
+
if (!matches) {
|
|
6391
|
+
return true;
|
|
6392
|
+
}
|
|
6393
|
+
const leftLineNumber = parseInt(matches[1]);
|
|
6394
|
+
const addedLine = parseInt(matches[2]);
|
|
6395
|
+
const rightLineNumber = parseInt(matches[3]);
|
|
6396
|
+
if (direction === "up") {
|
|
6397
|
+
const prevSibling = expandDom.previousElementSibling;
|
|
6398
|
+
if (!prevSibling) {
|
|
6399
|
+
if (leftLineNumber === 1 && rightLineNumber === 1) {
|
|
6400
|
+
expandDom == null ? void 0 : expandDom.remove();
|
|
6401
|
+
return true;
|
|
6402
|
+
}
|
|
6403
|
+
} else {
|
|
6404
|
+
const prevLeftLineNumber = parseInt((_b = (_a = prevSibling.children) == null ? void 0 : _a[0]) == null ? void 0 : _b.innerText);
|
|
6405
|
+
const prevRightLineNumber = parseInt((_d = (_c = prevSibling.children) == null ? void 0 : _c[2]) == null ? void 0 : _d.innerText);
|
|
6406
|
+
if (leftLineNumber === prevLeftLineNumber + 1 && rightLineNumber === prevRightLineNumber + 1) {
|
|
6407
|
+
expandDom.remove();
|
|
6408
|
+
return true;
|
|
6409
|
+
}
|
|
6410
|
+
}
|
|
6411
|
+
} else {
|
|
6412
|
+
const nextSibling = expandDom.nextElementSibling;
|
|
6413
|
+
if (nextSibling) {
|
|
6414
|
+
const nextLeftLineNumber = parseInt((_f = (_e = nextSibling == null ? void 0 : nextSibling.children) == null ? void 0 : _e[0]) == null ? void 0 : _f.innerText);
|
|
6415
|
+
const nextRightLineNumber = parseInt((_h = (_g = nextSibling == null ? void 0 : nextSibling.children) == null ? void 0 : _g[2]) == null ? void 0 : _h.innerText);
|
|
6416
|
+
if (leftLineNumber + addedLine === nextLeftLineNumber && rightLineNumber + addedLine === nextRightLineNumber) {
|
|
6417
|
+
expandDom.remove();
|
|
6418
|
+
return true;
|
|
6419
|
+
}
|
|
6420
|
+
}
|
|
6421
|
+
}
|
|
6422
|
+
return false;
|
|
6423
|
+
}
|
|
6322
6424
|
function ifRemoveExpandLine(expandDom, newExpandDom, direction) {
|
|
6323
6425
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
6324
6426
|
const matches = newExpandDom.children[1].innerText.trim().match(ExpandLineReg);
|
|
@@ -6345,11 +6447,13 @@ function ifRemoveExpandLine(expandDom, newExpandDom, direction) {
|
|
|
6345
6447
|
}
|
|
6346
6448
|
} else {
|
|
6347
6449
|
const nextSibling = expandDom.nextElementSibling;
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6450
|
+
if (nextSibling) {
|
|
6451
|
+
const nextLeftLineNumber = parseInt((_i = (_h = (_g = nextSibling == null ? void 0 : nextSibling.children) == null ? void 0 : _g[0].children) == null ? void 0 : _h[0]) == null ? void 0 : _i.innerText);
|
|
6452
|
+
const nextRightLineNumber = parseInt((_l = (_k = (_j = nextSibling == null ? void 0 : nextSibling.children) == null ? void 0 : _j[0].children) == null ? void 0 : _k[1]) == null ? void 0 : _l.innerText);
|
|
6453
|
+
if (leftLineNumber + addedLine === nextLeftLineNumber && rightLineNumber + addedLine === nextRightLineNumber) {
|
|
6454
|
+
expandDom.remove();
|
|
6455
|
+
return true;
|
|
6456
|
+
}
|
|
6353
6457
|
}
|
|
6354
6458
|
}
|
|
6355
6459
|
return false;
|
|
@@ -6365,14 +6469,33 @@ function updateExpandLineCount(expandDom, newExpandDom) {
|
|
|
6365
6469
|
expandDom.children[1].children[0].innerText = `@@ -${(newMatches == null ? void 0 : newMatches[1]) || 0},${newChangedNumLeft} +${(newMatches == null ? void 0 : newMatches[3]) || 0},${newChangedNumRight} @@`;
|
|
6366
6470
|
}
|
|
6367
6471
|
function parseDiffCode(container, code, outputFormat) {
|
|
6472
|
+
var _a;
|
|
6368
6473
|
const diff2HtmlUi = new Diff2HtmlUI(container, code, {
|
|
6369
6474
|
drawFileList: false,
|
|
6370
6475
|
matching: "lines",
|
|
6371
6476
|
outputFormat,
|
|
6372
|
-
highlight: true
|
|
6477
|
+
highlight: true,
|
|
6478
|
+
rawTemplates: TemplateMap[outputFormat]
|
|
6373
6479
|
});
|
|
6480
|
+
if (outputFormat === "side-by-side") {
|
|
6481
|
+
let diffHtmlStr = diff2HtmlUi.diffHtml;
|
|
6482
|
+
if (diffHtmlStr.match(EmptyDataLangReg)) {
|
|
6483
|
+
diffHtmlStr = diffHtmlStr.replace(EmptyDataLangReg, "");
|
|
6484
|
+
}
|
|
6485
|
+
const trList = diffHtmlStr.match(TableTrReg);
|
|
6486
|
+
const trListLength = trList.length;
|
|
6487
|
+
let newTrStr = "";
|
|
6488
|
+
const offset2 = trListLength / 2;
|
|
6489
|
+
for (let i = 0; i < trListLength / 2; i++) {
|
|
6490
|
+
const leftTdList = trList[i].match(TableTdReg);
|
|
6491
|
+
const rightTdList = trList[i + offset2].match(TableTdReg);
|
|
6492
|
+
newTrStr += `<tr>${leftTdList == null ? void 0 : leftTdList.join("")}${rightTdList == null ? void 0 : rightTdList.join("")}</tr>`;
|
|
6493
|
+
}
|
|
6494
|
+
const tbodyAttr = ((_a = diffHtmlStr.match(TableTbodyAttrReg)) == null ? void 0 : _a[1]) || "";
|
|
6495
|
+
const newDiffHtmlStr = diffHtmlStr.replace(TableTbodyReg, `<tbody ${tbodyAttr}>${newTrStr}</tbody>`);
|
|
6496
|
+
diff2HtmlUi.diffHtml = newDiffHtmlStr;
|
|
6497
|
+
}
|
|
6374
6498
|
diff2HtmlUi.draw();
|
|
6375
|
-
diff2HtmlUi.highlightCode();
|
|
6376
6499
|
}
|
|
6377
6500
|
function setLineNumberInDataset(trNode, prevL, prevR, nextL, nextR) {
|
|
6378
6501
|
if (trNode) {
|
|
@@ -6389,7 +6512,40 @@ function updateExpandUpDownButton(trNode) {
|
|
|
6389
6512
|
trNode.children[0].children[0].classList.add("all-expand");
|
|
6390
6513
|
trNode.children[0].children[0].innerHTML = AllExpandIcon();
|
|
6391
6514
|
}
|
|
6392
|
-
function
|
|
6515
|
+
function updateLineNumberInDatasetForDoubleColumn(trNode, expandThreshold, position, updateExpandButton = false) {
|
|
6516
|
+
let nextL;
|
|
6517
|
+
let prevL;
|
|
6518
|
+
let nextR;
|
|
6519
|
+
let prevR;
|
|
6520
|
+
if (position === "top") {
|
|
6521
|
+
const nextLineNode = trNode.nextElementSibling;
|
|
6522
|
+
nextL = parseInt(nextLineNode.children[0].innerText) - 1;
|
|
6523
|
+
prevL = Math.max(nextL - expandThreshold + 1, 1);
|
|
6524
|
+
nextR = parseInt(nextLineNode.children[2].innerText) - 1;
|
|
6525
|
+
prevR = Math.max(nextR - expandThreshold + 1, 1);
|
|
6526
|
+
} else if (position === "bottom") {
|
|
6527
|
+
const prevLineNode = trNode.previousElementSibling;
|
|
6528
|
+
prevL = parseInt(prevLineNode.children[0].innerText) + 1;
|
|
6529
|
+
nextL = prevL + expandThreshold - 1;
|
|
6530
|
+
prevR = parseInt(prevLineNode.children[2].innerText) + 1;
|
|
6531
|
+
nextR = prevR + expandThreshold - 1;
|
|
6532
|
+
} else {
|
|
6533
|
+
const prevLineNode = trNode.previousElementSibling;
|
|
6534
|
+
const nextLineNode = trNode.nextElementSibling;
|
|
6535
|
+
const prevLineNumber = parseInt(prevLineNode.children[0].innerText);
|
|
6536
|
+
const nextLineNumber = parseInt(nextLineNode.children[0].innerText);
|
|
6537
|
+
prevL = prevLineNumber + 1;
|
|
6538
|
+
prevR = parseInt(prevLineNode.children[2].innerText) + 1;
|
|
6539
|
+
nextL = nextLineNumber - 1;
|
|
6540
|
+
nextR = parseInt(nextLineNode.children[2].innerText) - 1;
|
|
6541
|
+
const isExpandAll = nextLineNumber - prevLineNumber <= expandThreshold;
|
|
6542
|
+
if (isExpandAll && updateExpandButton) {
|
|
6543
|
+
updateExpandUpDownButton(trNode);
|
|
6544
|
+
}
|
|
6545
|
+
}
|
|
6546
|
+
setLineNumberInDataset(trNode, prevL, prevR, nextL, nextR);
|
|
6547
|
+
}
|
|
6548
|
+
function updateLineNumberInDataset(trNode, expandThreshold, position, updateExpandButton = false) {
|
|
6393
6549
|
let nextL;
|
|
6394
6550
|
let prevL;
|
|
6395
6551
|
let nextR;
|
|
@@ -6397,15 +6553,15 @@ function updateLineNumberInDataset(trNode, expandAllThreshold, position, updateE
|
|
|
6397
6553
|
if (position === "top") {
|
|
6398
6554
|
const nextLineNode = trNode.nextElementSibling;
|
|
6399
6555
|
nextL = parseInt(nextLineNode.children[0].children[0].innerText) - 1;
|
|
6400
|
-
prevL = Math.max(nextL -
|
|
6556
|
+
prevL = Math.max(nextL - expandThreshold + 1, 1);
|
|
6401
6557
|
nextR = parseInt(nextLineNode.children[0].children[1].innerText) - 1;
|
|
6402
|
-
prevR = Math.max(nextR -
|
|
6558
|
+
prevR = Math.max(nextR - expandThreshold + 1, 1);
|
|
6403
6559
|
} else if (position === "bottom") {
|
|
6404
6560
|
const prevLineNode = trNode.previousElementSibling;
|
|
6405
6561
|
prevL = parseInt(prevLineNode.children[0].children[0].innerText) + 1;
|
|
6406
|
-
nextL = prevL +
|
|
6562
|
+
nextL = prevL + expandThreshold - 1;
|
|
6407
6563
|
prevR = parseInt(prevLineNode.children[0].children[1].innerText) + 1;
|
|
6408
|
-
nextR = prevR +
|
|
6564
|
+
nextR = prevR + expandThreshold - 1;
|
|
6409
6565
|
} else {
|
|
6410
6566
|
const prevLineNode = trNode.previousElementSibling;
|
|
6411
6567
|
const nextLineNode = trNode.nextElementSibling;
|
|
@@ -6415,14 +6571,14 @@ function updateLineNumberInDataset(trNode, expandAllThreshold, position, updateE
|
|
|
6415
6571
|
prevR = parseInt(prevLineNode.children[0].children[1].innerText) + 1;
|
|
6416
6572
|
nextL = nextLineNumber - 1;
|
|
6417
6573
|
nextR = parseInt(nextLineNode.children[0].children[1].innerText) - 1;
|
|
6418
|
-
const isExpandAll = nextLineNumber - prevLineNumber <=
|
|
6574
|
+
const isExpandAll = nextLineNumber - prevLineNumber <= expandThreshold;
|
|
6419
6575
|
if (isExpandAll && updateExpandButton) {
|
|
6420
6576
|
updateExpandUpDownButton(trNode);
|
|
6421
6577
|
}
|
|
6422
6578
|
}
|
|
6423
6579
|
setLineNumberInDataset(trNode, prevL, prevR, nextL, nextR);
|
|
6424
6580
|
}
|
|
6425
|
-
function
|
|
6581
|
+
function getLineNumberFromDataset(expandDom, expandThreshold) {
|
|
6426
6582
|
var _a, _b, _c;
|
|
6427
6583
|
const attrsMap = (_b = (_a = expandDom.parentElement) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.dataset;
|
|
6428
6584
|
const prevL = Number(attrsMap == null ? void 0 : attrsMap.prevL);
|
|
@@ -6435,14 +6591,14 @@ function getLineNumberFormDataset(expandDom, expandAllThreshold) {
|
|
|
6435
6591
|
const direction = (_c = buttonClasses.find((item) => item.endsWith("expand"))) == null ? void 0 : _c.split("-")[0];
|
|
6436
6592
|
if (direction === "up") {
|
|
6437
6593
|
leftLineEnd = nextL;
|
|
6438
|
-
leftLineStart = Math.max(leftLineEnd -
|
|
6594
|
+
leftLineStart = Math.max(leftLineEnd - expandThreshold + 1, prevL);
|
|
6439
6595
|
rightLineEnd = nextR;
|
|
6440
|
-
rightLineStart = Math.max(rightLineEnd -
|
|
6596
|
+
rightLineStart = Math.max(rightLineEnd - expandThreshold + 1, prevR);
|
|
6441
6597
|
} else if (direction === "down") {
|
|
6442
6598
|
leftLineStart = prevL;
|
|
6443
|
-
leftLineEnd = Math.min(leftLineStart +
|
|
6599
|
+
leftLineEnd = Math.min(leftLineStart + expandThreshold - 1, nextL);
|
|
6444
6600
|
rightLineStart = prevR;
|
|
6445
|
-
rightLineEnd = Math.min(rightLineStart +
|
|
6601
|
+
rightLineEnd = Math.min(rightLineStart + expandThreshold - 1, nextR);
|
|
6446
6602
|
} else {
|
|
6447
6603
|
leftLineStart = prevL;
|
|
6448
6604
|
leftLineEnd = nextL;
|
|
@@ -6486,7 +6642,7 @@ function attachExpandUpDownButton(parentNode, direction) {
|
|
|
6486
6642
|
addExpandButton(parentNode, expandDirectionMap[direction], (_a = expandDirectionIconMap[direction]) == null ? void 0 : _a.call(expandDirectionIconMap));
|
|
6487
6643
|
}
|
|
6488
6644
|
}
|
|
6489
|
-
function
|
|
6645
|
+
function addCommentToPageForSingleColumn(lineHost, commentDom, lineSide) {
|
|
6490
6646
|
var _a, _b;
|
|
6491
6647
|
const newLine = document.createElement("tr");
|
|
6492
6648
|
const newCell = document.createElement("td");
|
|
@@ -6503,42 +6659,145 @@ function addCommentToPage(lineHost, commentDom, lineSide) {
|
|
|
6503
6659
|
(_b = lineHost.parentElement) == null ? void 0 : _b.appendChild(newLine);
|
|
6504
6660
|
}
|
|
6505
6661
|
}
|
|
6662
|
+
function addCommentToPageForDoubleColumn(lineHost, commentDom, lineSide) {
|
|
6663
|
+
var _a, _b, _c;
|
|
6664
|
+
const nextSibling = lineHost.nextElementSibling;
|
|
6665
|
+
if (nextSibling && ((_a = nextSibling.classList) == null ? void 0 : _a.contains("comment-block"))) {
|
|
6666
|
+
const insertTdDom = lineSide === "left" ? nextSibling.children[0] : nextSibling.children[1];
|
|
6667
|
+
insertTdDom.classList.add("comment-cell");
|
|
6668
|
+
insertTdDom.appendChild(commentDom);
|
|
6669
|
+
} else {
|
|
6670
|
+
const newLine = document.createElement("tr");
|
|
6671
|
+
const newLeftCell = document.createElement("td");
|
|
6672
|
+
const newRightCell = document.createElement("td");
|
|
6673
|
+
newLeftCell.style.width = "50%";
|
|
6674
|
+
newLeftCell.setAttribute("colspan", "2");
|
|
6675
|
+
newRightCell.style.width = "50%";
|
|
6676
|
+
newRightCell.setAttribute("colspan", "2");
|
|
6677
|
+
if (lineSide === "left") {
|
|
6678
|
+
newLeftCell.classList.add("comment-cell");
|
|
6679
|
+
newLeftCell.appendChild(commentDom);
|
|
6680
|
+
} else {
|
|
6681
|
+
newRightCell.classList.add("comment-cell");
|
|
6682
|
+
newRightCell.appendChild(commentDom);
|
|
6683
|
+
}
|
|
6684
|
+
newLine.classList.add("comment-block");
|
|
6685
|
+
newLine.classList.add(lineSide);
|
|
6686
|
+
newLine.appendChild(newLeftCell);
|
|
6687
|
+
newLine.appendChild(newRightCell);
|
|
6688
|
+
if (lineHost.nextElementSibling) {
|
|
6689
|
+
(_b = lineHost.parentElement) == null ? void 0 : _b.insertBefore(newLine, lineHost.nextElementSibling);
|
|
6690
|
+
} else {
|
|
6691
|
+
(_c = lineHost.parentElement) == null ? void 0 : _c.appendChild(newLine);
|
|
6692
|
+
}
|
|
6693
|
+
}
|
|
6694
|
+
}
|
|
6695
|
+
function findReferenceDomForSingleColumn(parentNode, lineNumber, lineSide) {
|
|
6696
|
+
var _a, _b, _c, _d;
|
|
6697
|
+
const trNodes = Array.from(parentNode.querySelectorAll("tr"));
|
|
6698
|
+
for (const index2 in trNodes) {
|
|
6699
|
+
const lineIndex = parseInt(index2);
|
|
6700
|
+
const lineNumberBox = Array.from(trNodes[lineIndex].children)[0];
|
|
6701
|
+
if (notEmptyNode(lineNumberBox)) {
|
|
6702
|
+
const oldLineNumber = parseInt((_b = (_a = lineNumberBox.children[0]) == null ? void 0 : _a.innerText) != null ? _b : -1);
|
|
6703
|
+
const newLineNumber = parseInt((_d = (_c = lineNumberBox.children[1]) == null ? void 0 : _c.innerText) != null ? _d : -1);
|
|
6704
|
+
if (lineSide === "left" && oldLineNumber === lineNumber || lineSide === "right" && newLineNumber === lineNumber) {
|
|
6705
|
+
return trNodes[lineIndex];
|
|
6706
|
+
}
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
}
|
|
6710
|
+
function findReferenceDomForDoubleColumn(parentNode, lineNumber, lineSide) {
|
|
6711
|
+
const trNodes = Array.from(parentNode.querySelectorAll("tr"));
|
|
6712
|
+
for (const index2 in trNodes) {
|
|
6713
|
+
const lineIndex = parseInt(index2);
|
|
6714
|
+
let lineNumberBox;
|
|
6715
|
+
if (lineSide === "left") {
|
|
6716
|
+
lineNumberBox = trNodes[lineIndex].children[0];
|
|
6717
|
+
} else {
|
|
6718
|
+
lineNumberBox = trNodes[lineIndex].children[2];
|
|
6719
|
+
}
|
|
6720
|
+
if (lineNumberBox && notEmptyNode(lineNumberBox)) {
|
|
6721
|
+
const currentLineNumber = parseInt(lineNumberBox.innerText);
|
|
6722
|
+
if (currentLineNumber === lineNumber) {
|
|
6723
|
+
return trNodes[lineIndex];
|
|
6724
|
+
}
|
|
6725
|
+
}
|
|
6726
|
+
}
|
|
6727
|
+
}
|
|
6506
6728
|
function useCodeReviewExpand(reviewContentRef, props) {
|
|
6507
|
-
const { outputFormat,
|
|
6729
|
+
const { outputFormat, expandThreshold, expandLoader } = toRefs(props);
|
|
6508
6730
|
const processSideBySide = () => {
|
|
6509
|
-
|
|
6510
|
-
const trNodes = Array.from(
|
|
6731
|
+
var _a;
|
|
6732
|
+
const trNodes = Array.from(reviewContentRef.value.querySelectorAll("tr"));
|
|
6511
6733
|
const totalLines = trNodes.length;
|
|
6512
6734
|
for (const index2 in trNodes) {
|
|
6513
6735
|
const lineIndex = parseInt(index2);
|
|
6514
6736
|
const lineChildren = Array.from(trNodes[lineIndex].children);
|
|
6515
6737
|
const lineNumberBox = lineChildren[0];
|
|
6516
6738
|
const lineContentBox = lineChildren[1];
|
|
6517
|
-
const
|
|
6518
|
-
const
|
|
6519
|
-
if (lineContent.match(ExpandLineReg) && !FirstLineReg.test(lineContent) && lineClassList && lineClassList.
|
|
6739
|
+
const lineContent = lineContentBox.innerText;
|
|
6740
|
+
const lineClassList = lineContentBox.classList;
|
|
6741
|
+
if (lineContent.match(ExpandLineReg) && !FirstLineReg.test(lineContent) && lineClassList && lineClassList.contains("d2h-info")) {
|
|
6520
6742
|
const nextLineIndex = lineIndex + 1;
|
|
6521
6743
|
const prevLineIndex = lineIndex - 1;
|
|
6522
6744
|
if (lineIndex === 0 && nextLineIndex in trNodes) {
|
|
6745
|
+
updateLineNumberInDatasetForDoubleColumn(trNodes[lineIndex], expandThreshold.value, "top");
|
|
6523
6746
|
attachExpandUpDownButton(lineNumberBox, "up");
|
|
6524
6747
|
} else if (lineIndex > 0 && lineIndex < totalLines - 1 && nextLineIndex in trNodes && prevLineIndex in trNodes) {
|
|
6525
|
-
const
|
|
6526
|
-
const
|
|
6527
|
-
const isExpandAll =
|
|
6748
|
+
const preLineNumber = parseInt(trNodes[prevLineIndex].children[0].innerText);
|
|
6749
|
+
const nextLineNumber = parseInt(trNodes[nextLineIndex].children[0].innerText);
|
|
6750
|
+
const isExpandAll = nextLineNumber - preLineNumber - 1 < expandThreshold.value;
|
|
6751
|
+
updateLineNumberInDatasetForDoubleColumn(trNodes[lineIndex], expandThreshold.value, "middle");
|
|
6528
6752
|
attachExpandUpDownButton(lineNumberBox, isExpandAll ? "all" : "updown");
|
|
6529
6753
|
}
|
|
6530
6754
|
}
|
|
6531
6755
|
}
|
|
6532
|
-
const
|
|
6533
|
-
|
|
6534
|
-
|
|
6756
|
+
const loadMoreLine = trNodes[0].cloneNode(true);
|
|
6757
|
+
loadMoreLine.children[0].removeChild(loadMoreLine.children[0].children[0]);
|
|
6758
|
+
loadMoreLine.children[1].innerText = "";
|
|
6759
|
+
(_a = trNodes[0].parentElement) == null ? void 0 : _a.appendChild(loadMoreLine);
|
|
6760
|
+
updateLineNumberInDatasetForDoubleColumn(loadMoreLine, expandThreshold.value, "bottom");
|
|
6761
|
+
attachExpandUpDownButton(loadMoreLine.children[0], "down");
|
|
6762
|
+
};
|
|
6763
|
+
const insertIncrementCodeForDoubleColumn = (code, direction, referenceDom) => {
|
|
6764
|
+
if (!referenceDom) {
|
|
6765
|
+
return;
|
|
6766
|
+
}
|
|
6767
|
+
if (!code) {
|
|
6768
|
+
return referenceDom == null ? void 0 : referenceDom.remove();
|
|
6769
|
+
}
|
|
6770
|
+
const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
|
|
6771
|
+
const container = document.createElement("div");
|
|
6772
|
+
parseDiffCode(container, prefix + code, outputFormat.value);
|
|
6773
|
+
const trNodes = Array.from(container.querySelectorAll("tr"));
|
|
6774
|
+
const expandLine = trNodes.find((element) => {
|
|
6775
|
+
var _a;
|
|
6776
|
+
return (_a = element.children[1]) == null ? void 0 : _a.innerText.trim().match(ExpandLineReg);
|
|
6777
|
+
});
|
|
6778
|
+
if (!expandLine) {
|
|
6779
|
+
return;
|
|
6780
|
+
}
|
|
6781
|
+
const trNodesToBeInserted = trNodes.filter((element) => element !== expandLine);
|
|
6782
|
+
insertIncrementLineToPage(referenceDom, trNodesToBeInserted, direction);
|
|
6783
|
+
const removedExpandLine = ifRemoveExpandLineForDoubleColumn(referenceDom, expandLine, direction);
|
|
6784
|
+
if (removedExpandLine) {
|
|
6785
|
+
return;
|
|
6786
|
+
}
|
|
6787
|
+
updateExpandLineCount(referenceDom, expandLine);
|
|
6788
|
+
if (direction === "up") {
|
|
6789
|
+
if (!referenceDom.previousElementSibling) {
|
|
6790
|
+
updateLineNumberInDatasetForDoubleColumn(referenceDom, expandThreshold.value, "top");
|
|
6791
|
+
} else {
|
|
6792
|
+
updateLineNumberInDatasetForDoubleColumn(referenceDom, expandThreshold.value, "middle", true);
|
|
6793
|
+
}
|
|
6794
|
+
} else {
|
|
6795
|
+
if (referenceDom.nextElementSibling) {
|
|
6796
|
+
updateLineNumberInDatasetForDoubleColumn(referenceDom, expandThreshold.value, "middle", true);
|
|
6797
|
+
} else {
|
|
6798
|
+
updateLineNumberInDatasetForDoubleColumn(referenceDom, expandThreshold.value, "bottom");
|
|
6799
|
+
}
|
|
6535
6800
|
}
|
|
6536
|
-
endLine.children[1].innerText = "";
|
|
6537
|
-
const leftEndLine = endLine.cloneNode(true);
|
|
6538
|
-
const rightEndLint = endLine.cloneNode(true);
|
|
6539
|
-
attachExpandUpDownButton(leftEndLine.children[0], "down");
|
|
6540
|
-
leftTable.tBodies[0].appendChild(leftEndLine);
|
|
6541
|
-
rightTable.tBodies[0].appendChild(rightEndLint);
|
|
6542
6801
|
};
|
|
6543
6802
|
const processLineByLine = () => {
|
|
6544
6803
|
var _a;
|
|
@@ -6558,15 +6817,15 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6558
6817
|
const nextLineIndex = lineIndex + 1;
|
|
6559
6818
|
const prevLineIndex = lineIndex - 1;
|
|
6560
6819
|
if (lineIndex === 0 && nextLineIndex in trNodes) {
|
|
6561
|
-
updateLineNumberInDataset(trNodes[lineIndex],
|
|
6820
|
+
updateLineNumberInDataset(trNodes[lineIndex], expandThreshold.value, "top");
|
|
6562
6821
|
attachExpandUpDownButton(lineNumberBox, "up");
|
|
6563
6822
|
} else if (lineIndex > 0 && lineIndex < totalLines - 1 && nextLineIndex in trNodes && prevLineIndex in trNodes) {
|
|
6564
6823
|
const prevTdNodes = Array.from(trNodes[prevLineIndex].children);
|
|
6565
6824
|
const prevLineNumber = parseInt(prevTdNodes[0].children[0].innerText);
|
|
6566
6825
|
const nextTdNodes = Array.from(trNodes[nextLineIndex].children);
|
|
6567
6826
|
const nextLineNumber = parseInt(nextTdNodes[0].children[0].innerText);
|
|
6568
|
-
updateLineNumberInDataset(trNodes[lineIndex],
|
|
6569
|
-
const isExpandAll = nextLineNumber - prevLineNumber <=
|
|
6827
|
+
updateLineNumberInDataset(trNodes[lineIndex], expandThreshold.value, "middle");
|
|
6828
|
+
const isExpandAll = nextLineNumber - prevLineNumber <= expandThreshold.value;
|
|
6570
6829
|
attachExpandUpDownButton(lineNumberBox, isExpandAll ? "all" : "updown");
|
|
6571
6830
|
}
|
|
6572
6831
|
}
|
|
@@ -6575,7 +6834,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6575
6834
|
loadMoreLine.children[0].removeChild(loadMoreLine.children[0].children[0]);
|
|
6576
6835
|
loadMoreLine.children[1].innerText = "";
|
|
6577
6836
|
(_a = trNodes[0].parentElement) == null ? void 0 : _a.appendChild(loadMoreLine);
|
|
6578
|
-
updateLineNumberInDataset(loadMoreLine,
|
|
6837
|
+
updateLineNumberInDataset(loadMoreLine, expandThreshold.value, "bottom");
|
|
6579
6838
|
attachExpandUpDownButton(loadMoreLine.children[0], "down");
|
|
6580
6839
|
};
|
|
6581
6840
|
const insertIncrementCode = (code, direction, referenceDom) => {
|
|
@@ -6596,7 +6855,8 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6596
6855
|
if (!expandLine) {
|
|
6597
6856
|
return;
|
|
6598
6857
|
}
|
|
6599
|
-
|
|
6858
|
+
const trNodesToBeInserted = trNodes.filter((element) => element.children[0].children.length === 2);
|
|
6859
|
+
insertIncrementLineToPage(referenceDom, trNodesToBeInserted, direction);
|
|
6600
6860
|
const removedExpandLine = ifRemoveExpandLine(referenceDom, expandLine, direction);
|
|
6601
6861
|
if (removedExpandLine) {
|
|
6602
6862
|
return;
|
|
@@ -6604,15 +6864,15 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6604
6864
|
updateExpandLineCount(referenceDom, expandLine);
|
|
6605
6865
|
if (direction === "up") {
|
|
6606
6866
|
if (!referenceDom.previousElementSibling) {
|
|
6607
|
-
updateLineNumberInDataset(referenceDom,
|
|
6867
|
+
updateLineNumberInDataset(referenceDom, expandThreshold.value, "top");
|
|
6608
6868
|
} else {
|
|
6609
|
-
updateLineNumberInDataset(referenceDom,
|
|
6869
|
+
updateLineNumberInDataset(referenceDom, expandThreshold.value, "middle", true);
|
|
6610
6870
|
}
|
|
6611
6871
|
} else {
|
|
6612
6872
|
if (referenceDom.nextElementSibling) {
|
|
6613
|
-
updateLineNumberInDataset(referenceDom,
|
|
6873
|
+
updateLineNumberInDataset(referenceDom, expandThreshold.value, "middle", true);
|
|
6614
6874
|
} else {
|
|
6615
|
-
updateLineNumberInDataset(referenceDom,
|
|
6875
|
+
updateLineNumberInDataset(referenceDom, expandThreshold.value, "bottom");
|
|
6616
6876
|
}
|
|
6617
6877
|
}
|
|
6618
6878
|
};
|
|
@@ -6626,10 +6886,10 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6626
6886
|
if (expandIconDom) {
|
|
6627
6887
|
const expandDirection = (_a = Array.from(expandIconDom.classList).find((item) => item.endsWith("expand"))) == null ? void 0 : _a.split("-")[0];
|
|
6628
6888
|
const direction = expandDirection === "up" || expandDirection === "all" ? "up" : "down";
|
|
6629
|
-
const [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd] =
|
|
6630
|
-
(_b =
|
|
6631
|
-
var _a2;
|
|
6632
|
-
insertIncrementCode(code, direction, (_a2 = expandIconDom.parentElement) == null ? void 0 : _a2.parentElement);
|
|
6889
|
+
const [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd] = getLineNumberFromDataset(expandIconDom, expandThreshold.value);
|
|
6890
|
+
(_b = expandLoader == null ? void 0 : expandLoader.value) == null ? void 0 : _b.call(expandLoader, [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd], (code) => {
|
|
6891
|
+
var _a2, _b2;
|
|
6892
|
+
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);
|
|
6633
6893
|
});
|
|
6634
6894
|
}
|
|
6635
6895
|
};
|
|
@@ -6639,7 +6899,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6639
6899
|
return { insertExpandButton, onExpandButtonClick };
|
|
6640
6900
|
}
|
|
6641
6901
|
function useCodeReview(props, ctx) {
|
|
6642
|
-
const { diff, outputFormat } = toRefs(props);
|
|
6902
|
+
const { diff, outputFormat, allowExpand, showBlob } = toRefs(props);
|
|
6643
6903
|
const renderHtml = ref("");
|
|
6644
6904
|
const reviewContentRef = ref();
|
|
6645
6905
|
const diffFile = ref([]);
|
|
@@ -6647,14 +6907,18 @@ function useCodeReview(props, ctx) {
|
|
|
6647
6907
|
const initDiffContent = () => {
|
|
6648
6908
|
diffFile.value = Diff2Html.parse(diff.value);
|
|
6649
6909
|
nextTick(() => {
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6910
|
+
if (inBrowser && !showBlob.value) {
|
|
6911
|
+
parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value);
|
|
6912
|
+
allowExpand.value && insertExpandButton();
|
|
6913
|
+
ctx.emit("contentRefresh", JSON.parse(JSON.stringify(diffFile.value)));
|
|
6914
|
+
}
|
|
6653
6915
|
});
|
|
6654
6916
|
};
|
|
6655
6917
|
const onContentClick = (e) => {
|
|
6656
6918
|
onExpandButtonClick(e);
|
|
6657
6919
|
};
|
|
6920
|
+
watch(showBlob, initDiffContent);
|
|
6921
|
+
watch(outputFormat, initDiffContent);
|
|
6658
6922
|
watch(diff, initDiffContent, { immediate: true });
|
|
6659
6923
|
return { renderHtml, reviewContentRef, diffFile, onContentClick };
|
|
6660
6924
|
}
|
|
@@ -6676,35 +6940,81 @@ function useCodeReviewFold(props, ctx) {
|
|
|
6676
6940
|
});
|
|
6677
6941
|
return { isFold, toggleFold };
|
|
6678
6942
|
}
|
|
6679
|
-
function useCodeReviewComment(reviewContentRef, ctx) {
|
|
6943
|
+
function useCodeReviewComment(reviewContentRef, props, ctx) {
|
|
6944
|
+
const { outputFormat, allowComment } = toRefs(props);
|
|
6680
6945
|
const ns2 = useNamespace("code-review");
|
|
6681
6946
|
const commentLeft = ref(-100);
|
|
6682
6947
|
const commentTop = ref(-100);
|
|
6683
6948
|
let currentLeftLineNumber = -1;
|
|
6684
6949
|
let currentRightLineNumber = -1;
|
|
6950
|
+
let lastLineNumberContainer;
|
|
6685
6951
|
const resetLeftTop = () => {
|
|
6686
6952
|
commentLeft.value = -100;
|
|
6687
6953
|
commentTop.value = -100;
|
|
6688
6954
|
currentLeftLineNumber = -1;
|
|
6689
6955
|
currentRightLineNumber = -1;
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
e.currentTarget.getBoundingClientRect();
|
|
6956
|
+
lastLineNumberContainer == null ? void 0 : lastLineNumberContainer.classList.remove("comment-icon-hover");
|
|
6957
|
+
lastLineNumberContainer = null;
|
|
6693
6958
|
};
|
|
6694
6959
|
const onMouseMove = (e) => {
|
|
6695
6960
|
var _a, _b;
|
|
6696
6961
|
const composedPath = e.composedPath();
|
|
6697
6962
|
const trNode = composedPath.find((item) => item.tagName === "TR");
|
|
6698
6963
|
if (trNode) {
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6964
|
+
if (outputFormat.value === "line-by-line") {
|
|
6965
|
+
const lineNumberContainer = Array.from(trNode.children)[0];
|
|
6966
|
+
if (lastLineNumberContainer !== lineNumberContainer) {
|
|
6967
|
+
lastLineNumberContainer == null ? void 0 : lastLineNumberContainer.classList.remove("comment-icon-hover");
|
|
6968
|
+
}
|
|
6969
|
+
if (notEmptyNode(lineNumberContainer)) {
|
|
6970
|
+
lastLineNumberContainer = lineNumberContainer;
|
|
6971
|
+
lineNumberContainer.classList.add("comment-icon-hover");
|
|
6972
|
+
const { top, left } = lineNumberContainer.getBoundingClientRect();
|
|
6973
|
+
commentLeft.value = left;
|
|
6974
|
+
commentTop.value = top;
|
|
6975
|
+
currentLeftLineNumber = parseInt((_a = lineNumberContainer.children[0]) == null ? void 0 : _a.innerText) || -1;
|
|
6976
|
+
currentRightLineNumber = parseInt((_b = lineNumberContainer.children[1]) == null ? void 0 : _b.innerText) || -1;
|
|
6977
|
+
} else {
|
|
6978
|
+
resetLeftTop();
|
|
6979
|
+
}
|
|
6706
6980
|
} else {
|
|
6707
|
-
|
|
6981
|
+
if (trNode.classList.contains("comment-block")) {
|
|
6982
|
+
return resetLeftTop();
|
|
6983
|
+
}
|
|
6984
|
+
const tdNode = composedPath.find((item) => item.tagName === "TD");
|
|
6985
|
+
const tdIndex = Array.from(trNode.children).findIndex((item) => item === tdNode);
|
|
6986
|
+
const tdNodes = Array.from(trNode.children);
|
|
6987
|
+
const leftLineNumberContainer = tdNodes[0];
|
|
6988
|
+
const rightLineNumberContainer = tdNodes[2];
|
|
6989
|
+
if (tdIndex < 2) {
|
|
6990
|
+
if (lastLineNumberContainer !== leftLineNumberContainer) {
|
|
6991
|
+
lastLineNumberContainer == null ? void 0 : lastLineNumberContainer.classList.remove("comment-icon-hover");
|
|
6992
|
+
}
|
|
6993
|
+
if (notEmptyNode(leftLineNumberContainer)) {
|
|
6994
|
+
lastLineNumberContainer = leftLineNumberContainer;
|
|
6995
|
+
leftLineNumberContainer.classList.add("comment-icon-hover");
|
|
6996
|
+
const { top, left } = leftLineNumberContainer.getBoundingClientRect();
|
|
6997
|
+
commentLeft.value = left;
|
|
6998
|
+
commentTop.value = top;
|
|
6999
|
+
currentLeftLineNumber = parseInt(leftLineNumberContainer.innerText);
|
|
7000
|
+
} else {
|
|
7001
|
+
resetLeftTop();
|
|
7002
|
+
}
|
|
7003
|
+
} else {
|
|
7004
|
+
if (lastLineNumberContainer !== rightLineNumberContainer) {
|
|
7005
|
+
lastLineNumberContainer == null ? void 0 : lastLineNumberContainer.classList.remove("comment-icon-hover");
|
|
7006
|
+
}
|
|
7007
|
+
if (rightLineNumberContainer && notEmptyNode(rightLineNumberContainer)) {
|
|
7008
|
+
lastLineNumberContainer = rightLineNumberContainer;
|
|
7009
|
+
rightLineNumberContainer.classList.add("comment-icon-hover");
|
|
7010
|
+
const { top, left } = rightLineNumberContainer.getBoundingClientRect();
|
|
7011
|
+
commentLeft.value = left;
|
|
7012
|
+
commentTop.value = top;
|
|
7013
|
+
currentRightLineNumber = parseInt(rightLineNumberContainer.innerText);
|
|
7014
|
+
} else {
|
|
7015
|
+
resetLeftTop();
|
|
7016
|
+
}
|
|
7017
|
+
}
|
|
6708
7018
|
}
|
|
6709
7019
|
}
|
|
6710
7020
|
};
|
|
@@ -6720,40 +7030,60 @@ function useCodeReviewComment(reviewContentRef, ctx) {
|
|
|
6720
7030
|
resetLeftTop();
|
|
6721
7031
|
}
|
|
6722
7032
|
};
|
|
6723
|
-
const onCommentIconClick = () => {
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
if (notEmptyNode(lineNumberBox)) {
|
|
6733
|
-
const oldLineNumber = parseInt((_b = (_a = lineNumberBox.children[0]) == null ? void 0 : _a.innerText) != null ? _b : -1);
|
|
6734
|
-
const newLineNumber = parseInt((_d = (_c = lineNumberBox.children[1]) == null ? void 0 : _c.innerText) != null ? _d : -1);
|
|
6735
|
-
if (lineSide === "left" && oldLineNumber === lineNumber || lineSide === "right" && newLineNumber === lineNumber) {
|
|
6736
|
-
return trNodes[lineIndex];
|
|
6737
|
-
}
|
|
7033
|
+
const onCommentIconClick = (e) => {
|
|
7034
|
+
if (e) {
|
|
7035
|
+
const composedPath = e.composedPath();
|
|
7036
|
+
const lineNumberBox = composedPath.find((item) => {
|
|
7037
|
+
var _a, _b;
|
|
7038
|
+
return ((_a = item.classList) == null ? void 0 : _a.contains("comment-icon-hover")) || ((_b = item.classList) == null ? void 0 : _b.contains("comment-icon"));
|
|
7039
|
+
});
|
|
7040
|
+
if (!lineNumberBox) {
|
|
7041
|
+
return;
|
|
6738
7042
|
}
|
|
6739
7043
|
}
|
|
7044
|
+
if (outputFormat.value === "line-by-line")
|
|
7045
|
+
;
|
|
7046
|
+
ctx.emit("addComment", { left: currentLeftLineNumber, right: currentRightLineNumber });
|
|
6740
7047
|
};
|
|
6741
7048
|
const insertComment = (lineNumber, lineSide, commentDom) => {
|
|
6742
|
-
|
|
6743
|
-
|
|
7049
|
+
if (outputFormat.value === "line-by-line") {
|
|
7050
|
+
const lineHost = findReferenceDomForSingleColumn(reviewContentRef.value, lineNumber, lineSide);
|
|
7051
|
+
lineHost && addCommentToPageForSingleColumn(lineHost, commentDom, lineSide);
|
|
7052
|
+
} else {
|
|
7053
|
+
const lineHost = findReferenceDomForDoubleColumn(reviewContentRef.value, lineNumber, lineSide);
|
|
7054
|
+
lineHost && addCommentToPageForDoubleColumn(lineHost, commentDom, lineSide);
|
|
7055
|
+
}
|
|
6744
7056
|
};
|
|
6745
7057
|
const removeComment = (lineNumber, lineSide) => {
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
7058
|
+
if (outputFormat.value === "line-by-line") {
|
|
7059
|
+
const lineHost = findReferenceDomForSingleColumn(reviewContentRef.value, lineNumber, lineSide);
|
|
7060
|
+
let nextLineHost = lineHost == null ? void 0 : lineHost.nextElementSibling;
|
|
7061
|
+
while (nextLineHost) {
|
|
7062
|
+
const classList = nextLineHost == null ? void 0 : nextLineHost.classList;
|
|
7063
|
+
if ((classList == null ? void 0 : classList.contains("comment-block")) && classList.contains(lineSide)) {
|
|
7064
|
+
nextLineHost.remove();
|
|
7065
|
+
return;
|
|
7066
|
+
}
|
|
7067
|
+
nextLineHost = nextLineHost.nextElementSibling;
|
|
7068
|
+
}
|
|
7069
|
+
} else {
|
|
7070
|
+
const lineHost = findReferenceDomForDoubleColumn(reviewContentRef.value, lineNumber, lineSide);
|
|
7071
|
+
const nextLineHost = lineHost == null ? void 0 : lineHost.nextElementSibling;
|
|
7072
|
+
if (nextLineHost && nextLineHost.classList.contains("comment-block")) {
|
|
7073
|
+
const leftChildren = nextLineHost.children[0];
|
|
7074
|
+
const rightChildren = nextLineHost.children[1];
|
|
7075
|
+
if (lineSide === "left") {
|
|
7076
|
+
leftChildren.children[0].remove();
|
|
7077
|
+
} else {
|
|
7078
|
+
rightChildren.children[0].remove();
|
|
7079
|
+
}
|
|
7080
|
+
if (!leftChildren.children.length && !rightChildren.children.length) {
|
|
7081
|
+
nextLineHost.remove();
|
|
7082
|
+
}
|
|
6753
7083
|
}
|
|
6754
|
-
nextLineHost = nextLineHost.nextElementSibling;
|
|
6755
7084
|
}
|
|
6756
7085
|
};
|
|
7086
|
+
const mouseEvent = allowComment.value ? { onMousemove: onMouseMove, onMouseleave } : {};
|
|
6757
7087
|
window.addEventListener("scroll", resetLeftTop);
|
|
6758
7088
|
onUnmounted(() => {
|
|
6759
7089
|
window.removeEventListener("scroll", resetLeftTop);
|
|
@@ -6761,9 +7091,7 @@ function useCodeReviewComment(reviewContentRef, ctx) {
|
|
|
6761
7091
|
return {
|
|
6762
7092
|
commentLeft,
|
|
6763
7093
|
commentTop,
|
|
6764
|
-
|
|
6765
|
-
onMouseMove,
|
|
6766
|
-
onMouseleave,
|
|
7094
|
+
mouseEvent,
|
|
6767
7095
|
onCommentMouseLeave,
|
|
6768
7096
|
onCommentIconClick,
|
|
6769
7097
|
insertComment,
|
|
@@ -6790,14 +7118,12 @@ var CodeReview = defineComponent({
|
|
|
6790
7118
|
const {
|
|
6791
7119
|
commentLeft,
|
|
6792
7120
|
commentTop,
|
|
6793
|
-
|
|
6794
|
-
onMouseMove,
|
|
6795
|
-
onMouseleave,
|
|
7121
|
+
mouseEvent,
|
|
6796
7122
|
onCommentMouseLeave,
|
|
6797
7123
|
onCommentIconClick,
|
|
6798
7124
|
insertComment,
|
|
6799
7125
|
removeComment
|
|
6800
|
-
} = useCodeReviewComment(reviewContentRef, ctx);
|
|
7126
|
+
} = useCodeReviewComment(reviewContentRef, props, ctx);
|
|
6801
7127
|
onMounted(() => {
|
|
6802
7128
|
ctx.emit("afterViewInit", {
|
|
6803
7129
|
toggleFold,
|
|
@@ -6811,29 +7137,30 @@ var CodeReview = defineComponent({
|
|
|
6811
7137
|
isFold,
|
|
6812
7138
|
rootCtx: ctx
|
|
6813
7139
|
});
|
|
6814
|
-
return () =>
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
7140
|
+
return () => {
|
|
7141
|
+
var _a, _b;
|
|
7142
|
+
return createVNode("div", {
|
|
7143
|
+
"class": ns2.b()
|
|
7144
|
+
}, [createVNode(CodeReviewHeader, {
|
|
7145
|
+
"onClick": () => isFold.value = !isFold.value
|
|
7146
|
+
}, null), withDirectives(createVNode("div", null, [props.showBlob ? (_b = (_a = ctx.slots).blob) == null ? void 0 : _b.call(_a) : createVNode("div", mergeProps({
|
|
7147
|
+
"class": [ns2.e("content"), props.outputFormat],
|
|
7148
|
+
"innerHTML": renderHtml.value,
|
|
7149
|
+
"ref": reviewContentRef,
|
|
7150
|
+
"onClick": (e) => {
|
|
7151
|
+
onContentClick(e);
|
|
7152
|
+
onCommentIconClick(e);
|
|
7153
|
+
}
|
|
7154
|
+
}, mouseEvent), null)]), [[vShow, !isFold.value]]), props.allowComment && createVNode("div", {
|
|
7155
|
+
"class": "comment-icon",
|
|
7156
|
+
"style": {
|
|
7157
|
+
left: commentLeft.value + "px",
|
|
7158
|
+
top: commentTop.value + "px"
|
|
7159
|
+
},
|
|
7160
|
+
"onClick": onCommentIconClick,
|
|
7161
|
+
"onMouseleave": onCommentMouseLeave
|
|
7162
|
+
}, [createVNode(CommentIcon, null, null)])]);
|
|
7163
|
+
};
|
|
6837
7164
|
}
|
|
6838
7165
|
});
|
|
6839
7166
|
var index = {
|