vue-devui 1.6.22 → 1.6.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6284,6 +6284,10 @@ const codeReviewProps = {
6284
6284
  },
6285
6285
  expandLoader: {
6286
6286
  type: Function
6287
+ },
6288
+ options: {
6289
+ type: Object,
6290
+ default: () => ({})
6287
6291
  }
6288
6292
  };
6289
6293
  const CodeReviewInjectionKey = Symbol("d-code-review");
@@ -6528,15 +6532,15 @@ function addClassToDiffCode(codeStrArr, theClassName) {
6528
6532
  });
6529
6533
  return newArray;
6530
6534
  }
6531
- function parseDiffCode(container, code, outputFormat, isAddCode = false) {
6535
+ function parseDiffCode(container, code, outputFormat, options, isAddCode = false) {
6532
6536
  var _a;
6533
6537
  const diff2HtmlUi = new Diff2HtmlUI(container, code, {
6534
6538
  drawFileList: false,
6535
6539
  matching: "lines",
6536
6540
  outputFormat,
6537
6541
  highlight: true,
6538
- diffStyle: "char",
6539
- rawTemplates: TemplateMap[outputFormat]
6542
+ rawTemplates: TemplateMap[outputFormat],
6543
+ ...options
6540
6544
  });
6541
6545
  if (outputFormat === "side-by-side") {
6542
6546
  let diffHtmlStr = diff2HtmlUi.diffHtml;
@@ -6841,7 +6845,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
6841
6845
  }
6842
6846
  attachExpandUpDownButton(loadMoreLine.children[0], "down");
6843
6847
  };
6844
- const insertIncrementCodeForDoubleColumn = (code, direction, referenceDom) => {
6848
+ const insertIncrementCodeForDoubleColumn = (code, direction, referenceDom, options) => {
6845
6849
  if (!referenceDom) {
6846
6850
  return;
6847
6851
  }
@@ -6850,7 +6854,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
6850
6854
  }
6851
6855
  const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
6852
6856
  const container = document.createElement("div");
6853
- parseDiffCode(container, prefix + code, outputFormat.value, true);
6857
+ parseDiffCode(container, prefix + code, outputFormat.value, options, true);
6854
6858
  const trNodes = Array.from(container.querySelectorAll("tr"));
6855
6859
  const expandLine = trNodes.find((element) => {
6856
6860
  var _a;
@@ -6924,7 +6928,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
6924
6928
  }
6925
6929
  attachExpandUpDownButton(loadMoreLine.children[0], "down");
6926
6930
  };
6927
- const insertIncrementCode = (code, direction, referenceDom) => {
6931
+ const insertIncrementCode = (code, direction, referenceDom, options) => {
6928
6932
  if (!referenceDom) {
6929
6933
  return;
6930
6934
  }
@@ -6933,7 +6937,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
6933
6937
  }
6934
6938
  const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
6935
6939
  const container = document.createElement("div");
6936
- parseDiffCode(container, prefix + code, outputFormat.value, true);
6940
+ parseDiffCode(container, prefix + code, outputFormat.value, options, true);
6937
6941
  const trNodes = Array.from(container.querySelectorAll("tr"));
6938
6942
  const expandLine = trNodes.find((element) => {
6939
6943
  var _a;
@@ -6963,7 +6967,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
6963
6967
  }
6964
6968
  }
6965
6969
  };
6966
- const onExpandButtonClick = (e) => {
6970
+ const onExpandButtonClick = (e, options) => {
6967
6971
  var _a, _b;
6968
6972
  const composedPath = e.composedPath();
6969
6973
  const expandIconDom = composedPath.find((element) => {
@@ -6976,7 +6980,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
6976
6980
  const [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd] = getLineNumberFromDataset(expandIconDom, expandThreshold.value);
6977
6981
  (_b = expandLoader == null ? void 0 : expandLoader.value) == null ? void 0 : _b.call(expandLoader, [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd], (code) => {
6978
6982
  var _a2, _b2;
6979
- 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);
6983
+ outputFormat.value === "line-by-line" ? insertIncrementCode(code, direction, (_a2 = expandIconDom.parentElement) == null ? void 0 : _a2.parentElement, options) : insertIncrementCodeForDoubleColumn(code, direction, (_b2 = expandIconDom.parentElement) == null ? void 0 : _b2.parentElement, options);
6980
6984
  });
6981
6985
  }
6982
6986
  };
@@ -6995,14 +6999,14 @@ function useCodeReview(props, ctx) {
6995
6999
  diffFile.value = Diff2Html.parse(diff.value);
6996
7000
  nextTick(() => {
6997
7001
  if (inBrowser && !showBlob.value) {
6998
- parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value);
7002
+ parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value, props.options);
6999
7003
  allowExpand.value && insertExpandButton();
7000
7004
  ctx.emit("contentRefresh", JSON.parse(JSON.stringify(diffFile.value)));
7001
7005
  }
7002
7006
  });
7003
7007
  };
7004
7008
  const onContentClick = (e) => {
7005
- onExpandButtonClick(e);
7009
+ onExpandButtonClick(e, props.options);
7006
7010
  };
7007
7011
  watch(showBlob, initDiffContent);
7008
7012
  watch(outputFormat, initDiffContent);
@@ -7320,6 +7324,12 @@ function useCodeReviewComment(reviewContentRef, props, ctx) {
7320
7324
  }
7321
7325
  }
7322
7326
  };
7327
+ const clearCheckedLines = () => {
7328
+ currentLeftLineNumbers = [];
7329
+ currentRightLineNumbers = [];
7330
+ checkedLineCodeString = [];
7331
+ resetCommentClass();
7332
+ };
7323
7333
  const mouseEvent = allowComment.value ? { onMousemove: onMouseMove, onMouseleave } : {};
7324
7334
  window.addEventListener("scroll", resetLeftTop);
7325
7335
  onUnmounted(() => {
@@ -7330,6 +7340,7 @@ function useCodeReviewComment(reviewContentRef, props, ctx) {
7330
7340
  commentTop,
7331
7341
  mouseEvent,
7332
7342
  updateCheckedLineClass,
7343
+ clearCheckedLines,
7333
7344
  onCommentMouseLeave,
7334
7345
  onCommentIconClick,
7335
7346
  onCommentKeyDown,
@@ -7368,14 +7379,16 @@ var CodeReview = defineComponent({
7368
7379
  unCommentKeyDown,
7369
7380
  insertComment,
7370
7381
  removeComment,
7371
- updateCheckedLineClass
7382
+ updateCheckedLineClass,
7383
+ clearCheckedLines
7372
7384
  } = useCodeReviewComment(reviewContentRef, props, ctx);
7373
7385
  onMounted(() => {
7374
7386
  ctx.emit("afterViewInit", {
7375
7387
  toggleFold,
7376
7388
  insertComment,
7377
7389
  removeComment,
7378
- updateCheckedLineClass
7390
+ updateCheckedLineClass,
7391
+ clearCheckedLines
7379
7392
  });
7380
7393
  onCommentKeyDown();
7381
7394
  });