vue-devui 1.5.6 → 1.5.7-hotfix.2

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.
Files changed (93) hide show
  1. package/action-timeline/style.css +1 -1
  2. package/alert/index.es.js +13 -3
  3. package/alert/index.umd.js +11 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/style.css +1 -1
  6. package/badge/style.css +1 -1
  7. package/breadcrumb/style.css +1 -1
  8. package/button/style.css +1 -1
  9. package/card/style.css +1 -1
  10. package/carousel/style.css +1 -1
  11. package/checkbox/style.css +1 -1
  12. package/code-editor/index.es.js +39 -23
  13. package/code-editor/index.umd.js +7 -7
  14. package/code-review/index.es.js +6229 -23
  15. package/code-review/index.umd.js +38 -1
  16. package/code-review/style.css +1 -1
  17. package/collapse/style.css +1 -1
  18. package/date-picker-pro/style.css +1 -1
  19. package/drawer/style.css +1 -1
  20. package/dropdown/style.css +1 -1
  21. package/editable-select/style.css +1 -1
  22. package/editor-md/index.es.js +2 -1
  23. package/editor-md/index.umd.js +30 -30
  24. package/editor-md/style.css +1 -1
  25. package/form/style.css +1 -1
  26. package/global.d.ts +2 -1
  27. package/icon/style.css +1 -1
  28. package/image-preview/style.css +1 -1
  29. package/input/style.css +1 -1
  30. package/input-number/index.es.js +1 -0
  31. package/input-number/index.umd.js +14 -14
  32. package/input-number/style.css +1 -1
  33. package/mention/style.css +1 -1
  34. package/menu/index.es.js +1 -0
  35. package/menu/index.umd.js +1 -1
  36. package/menu/style.css +1 -1
  37. package/message/style.css +1 -1
  38. package/modal/style.css +1 -1
  39. package/notification/style.css +1 -1
  40. package/nuxt/components/CodeReviewInjectionKey.js +3 -0
  41. package/overlay/style.css +1 -1
  42. package/package.json +10 -9
  43. package/pagination/index.es.js +7 -1
  44. package/pagination/index.umd.js +7 -1
  45. package/pagination/style.css +1 -1
  46. package/panel/style.css +1 -1
  47. package/popover/style.css +1 -1
  48. package/progress/index.es.js +1 -0
  49. package/progress/index.umd.js +2 -2
  50. package/radio/style.css +1 -1
  51. package/result/style.css +1 -1
  52. package/search/style.css +1 -1
  53. package/select/index.es.js +7 -1
  54. package/select/index.umd.js +7 -1
  55. package/select/style.css +1 -1
  56. package/slider/index.es.js +1 -0
  57. package/slider/index.umd.js +1 -1
  58. package/slider/style.css +1 -1
  59. package/splitter/index.es.js +1 -0
  60. package/splitter/index.umd.js +9 -9
  61. package/splitter/style.css +1 -1
  62. package/status/style.css +1 -1
  63. package/steps/style.css +1 -1
  64. package/style.css +1 -1
  65. package/switch/style.css +1 -1
  66. package/table/index.es.js +1 -0
  67. package/table/index.umd.js +12 -12
  68. package/table/style.css +1 -1
  69. package/tabs/style.css +1 -1
  70. package/tag/style.css +1 -1
  71. package/textarea/style.css +1 -1
  72. package/time-picker/style.css +1 -1
  73. package/time-select/index.es.js +7 -1
  74. package/time-select/index.umd.js +7 -1
  75. package/time-select/style.css +1 -1
  76. package/timeline/style.css +1 -1
  77. package/tooltip/style.css +1 -1
  78. package/tree/index.es.js +1 -0
  79. package/tree/index.umd.js +11 -11
  80. package/tree/style.css +1 -1
  81. package/types/code-editor/src/code-highlight-directive.d.ts +5 -0
  82. package/types/code-editor/src/composables/use-code-editor.d.ts +2 -2
  83. package/types/code-review/src/code-review-types.d.ts +12 -1
  84. package/types/code-review/src/code-review.d.ts +10 -2
  85. package/types/code-review/src/components/code-review-header.d.ts +2 -0
  86. package/types/code-review/src/components/code-review-icons.d.ts +2 -0
  87. package/types/code-review/src/composables/use-code-review-header.d.ts +6 -0
  88. package/types/code-review/src/composables/use-code-review.d.ts +3 -1
  89. package/types/shared/utils/index.d.ts +1 -0
  90. package/types/shared/utils/to-clipboard.d.ts +1 -0
  91. package/upload/style.css +1 -1
  92. package/vue-devui.es.js +225 -40
  93. package/vue-devui.umd.js +63 -50
package/vue-devui.es.js CHANGED
@@ -35,6 +35,7 @@ var __publicField = (obj, key, value) => {
35
35
  };
36
36
  import { createVNode, getCurrentInstance, defineComponent, toRefs, inject, computed, Fragment, mergeProps, resolveComponent, isVNode, ref, reactive, createTextVNode, provide, onMounted, watch, Transition, withDirectives, vShow, nextTick, onUnmounted, unref, withModifiers, Comment as Comment$1, Text, h, cloneVNode, Teleport, onBeforeUnmount, render as render$1, resolveDirective, resolveDynamicComponent, toRef, shallowRef, onBeforeMount, onUpdated, readonly, toRaw, watchEffect, renderSlot, useSlots, createApp, shallowReactive, effect, TransitionGroup } from "vue";
37
37
  import { useRoute } from "vue-router";
38
+ import Clipboard from "clipboard";
38
39
  import { offset, autoPlacement, arrow, shift, computePosition, flip } from "@floating-ui/dom";
39
40
  import { onClickOutside, toRefs as toRefs$1, useResizeObserver } from "@vueuse/core";
40
41
  import * as Diff2Html from "diff2html";
@@ -1136,7 +1137,13 @@ const AlertCloseIcon = () => createVNode("svg", {
1136
1137
  "transform": "translate(-3.000000, -3.000000)",
1137
1138
  "fill-rule": "nonzero"
1138
1139
  }, [createVNode("path", {
1139
- "d": "M11.6426,3.19816936 C11.9239974,2.91574512 12.4131626,2.93784891 12.7352108,3.24751057 C13.0571998,3.5572302 13.0901298,4.03723416 12.8087324,4.31965839 L9.14064666,7.99900183 L12.8087324,11.6803416 C13.0645482,11.9370909 13.0605893,12.3571292 12.8158402,12.6640749 L12.7352108,12.7524894 C12.4131626,13.0621511 11.9239974,13.0842548 11.6426,12.8018306 L8,9.14489021 L4.35740003,12.8018306 C4.10158422,13.05858 3.6740594,13.0636532 3.35648225,12.8298003 L3.26478919,12.7524894 C2.94280021,12.4427698 2.90987023,11.9627658 3.19126762,11.6803416 L6.8583349,7.99900183 L3.19126762,4.31965839 C2.93545181,4.06290908 2.93941068,3.64287076 3.18415975,3.3359251 L3.26478919,3.24751057 C3.58683735,2.93784891 4.07600264,2.91574512 4.35740003,3.19816936 L8,6.85411161 L11.6426,3.19816936 Z"
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`
1140
1147
  }, null)])])]);
1141
1148
  const ns$k = useNamespace("alert");
1142
1149
  const AlertTypeIcon = (props) => createVNode("svg", {
@@ -1170,12 +1177,16 @@ const AlertTypeIcon = (props) => createVNode("svg", {
1170
1177
  "fill-rule": "evenodd"
1171
1178
  }, [createVNode("path", {
1172
1179
  "class": "warning-outer",
1173
- "d": "M8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 Z"
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`
1174
1184
  }, null), createVNode("path", {
1175
1185
  "class": "warning-inner",
1176
1186
  "stroke-width": "0.3",
1177
1187
  "fill-rule": "nonzero",
1178
- "d": "M8.87894737,13 L7.08947368,13 L7.08947368,11.2105263 L8.87894737,11.2105263 L8.87894737,13 Z M8.62102372,9.86842105 L7.32800539,9.86842105 L7,4.5 L8.96842105,4.5 L8.62102372,9.86842105 Z"
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`
1179
1190
  }, null)]);
1180
1191
  case "info":
1181
1192
  return createVNode("g", {
@@ -1546,6 +1557,26 @@ function randomId(n = 8) {
1546
1557
  }
1547
1558
  return result2;
1548
1559
  }
1560
+ function toClipboard(text) {
1561
+ return new Promise((resolve, reject) => {
1562
+ const ele = document.createElement("button");
1563
+ const clipboard = new Clipboard(ele, {
1564
+ text: () => text,
1565
+ action: () => "copy"
1566
+ });
1567
+ clipboard.on("success", (e) => {
1568
+ clipboard.destroy();
1569
+ resolve(e);
1570
+ });
1571
+ clipboard.on("error", (e) => {
1572
+ clipboard.destroy();
1573
+ reject(e);
1574
+ });
1575
+ document.body.appendChild(ele);
1576
+ ele.click();
1577
+ document.body.removeChild(ele);
1578
+ });
1579
+ }
1549
1580
  function setStyle(element, style) {
1550
1581
  const oldStyle = {};
1551
1582
  const styleKeys = Object.keys(style);
@@ -13693,7 +13724,7 @@ function useCodeEditor(props, ctx2) {
13693
13724
  addCommentIcon,
13694
13725
  expandCommentIcon
13695
13726
  } = toRefs(props);
13696
- let monaco;
13727
+ let monaco2;
13697
13728
  let editor;
13698
13729
  let diffEditor;
13699
13730
  let themeService;
@@ -13732,14 +13763,14 @@ function useCodeEditor(props, ctx2) {
13732
13763
  });
13733
13764
  onMounted(async () => {
13734
13765
  if (inBrowser) {
13735
- monaco = await import("monaco-editor");
13766
+ monaco2 = await import("monaco-editor");
13736
13767
  setCurrentTheme();
13737
13768
  init();
13738
13769
  if (mode.value === "review") {
13739
13770
  nextTick(() => {
13740
13771
  refreshDecorations();
13741
- refreshOverlayWidgets();
13742
13772
  refreshViewZones();
13773
+ refreshOverlayWidgets();
13743
13774
  });
13744
13775
  }
13745
13776
  }
@@ -13751,15 +13782,15 @@ function useCodeEditor(props, ctx2) {
13751
13782
  initDiffEditor();
13752
13783
  }
13753
13784
  if (!options.value["theme"]) {
13754
- monaco.editor.setTheme(currentTheme);
13785
+ monaco2.editor.setTheme(currentTheme);
13755
13786
  }
13756
13787
  handleAutoHeight();
13757
13788
  setValueEmitter();
13758
13789
  }
13759
13790
  function initNormalEditor() {
13760
13791
  if (!editor) {
13761
- editor = monaco.editor.create(editorEl.value, options.value);
13762
- editor.setModel(monaco.editor.createModel(modelValue.value, options.value["language"]));
13792
+ editor = monaco2.editor.create(editorEl.value, options.value);
13793
+ editor.setModel(monaco2.editor.createModel(modelValue.value, options.value["language"]));
13763
13794
  ctx2.emit("afterEditorInit", editor);
13764
13795
  if (mode.value === "review") {
13765
13796
  editor.onMouseMove(handleMouseMove);
@@ -13770,10 +13801,10 @@ function useCodeEditor(props, ctx2) {
13770
13801
  }
13771
13802
  function initDiffEditor() {
13772
13803
  if (!diffEditor) {
13773
- diffEditor = monaco.editor.createDiffEditor(editorEl.value, options.value);
13804
+ diffEditor = monaco2.editor.createDiffEditor(editorEl.value, options.value);
13774
13805
  diffEditor.setModel({
13775
- original: monaco.editor.createModel(originalText.value, options.value["language"]),
13776
- modified: monaco.editor.createModel(modelValue.value, options.value["language"])
13806
+ original: monaco2.editor.createModel(originalText.value, options.value["language"]),
13807
+ modified: monaco2.editor.createModel(modelValue.value, options.value["language"])
13777
13808
  });
13778
13809
  ctx2.emit("afterEditorInit", diffEditor);
13779
13810
  }
@@ -13786,11 +13817,10 @@ function useCodeEditor(props, ctx2) {
13786
13817
  }
13787
13818
  }
13788
13819
  function setEditorValue() {
13789
- var _a;
13790
13820
  if (!editor || !editor.getModel()) {
13791
13821
  return;
13792
13822
  }
13793
- (_a = editor.getModel().modified) == null ? void 0 : _a.setValue(modelValue.value);
13823
+ editor.getModel().setValue(modelValue.value);
13794
13824
  }
13795
13825
  function setDiffEditorValue() {
13796
13826
  var _a;
@@ -13809,7 +13839,7 @@ function useCodeEditor(props, ctx2) {
13809
13839
  currentTheme = themeService && themeService.currentTheme.isDark ? "vs" : "vs-dark";
13810
13840
  }
13811
13841
  if (editor) {
13812
- monaco.editor.setTheme(currentTheme);
13842
+ monaco2.editor.setTheme(currentTheme);
13813
13843
  }
13814
13844
  }
13815
13845
  function handleAutoHeight() {
@@ -13842,9 +13872,11 @@ function useCodeEditor(props, ctx2) {
13842
13872
  const language = options.value.language;
13843
13873
  if (editor) {
13844
13874
  if (mode.value === "normal" || mode.value === "review") {
13875
+ monaco2.editor.setModelLanguage(editor.getModel(), language);
13876
+ } else if (mode.value === "diff") {
13845
13877
  const model = diffEditor.getModel();
13846
- monaco.editor.setModelLanguage(model.modified, language);
13847
- monaco.editor.setModelLanguage(model.original, language);
13878
+ monaco2.editor.setModelLanguage(model.modified, language);
13879
+ monaco2.editor.setModelLanguage(model.original, language);
13848
13880
  }
13849
13881
  }
13850
13882
  }
@@ -13858,7 +13890,7 @@ function useCodeEditor(props, ctx2) {
13858
13890
  }
13859
13891
  function updateEditorHeightAuto() {
13860
13892
  var _a;
13861
- const lineHeight = editor.getOption(monaco.editor.EditorOption.lineHeight);
13893
+ const lineHeight = editor.getOption(monaco2.editor.EditorOption.lineHeight);
13862
13894
  const lineCount = ((_a = editor.getModel()) == null ? void 0 : _a.getLineCount()) || 1;
13863
13895
  const height = editor.getTopForLineNumber(lineCount + 1) + lineHeight;
13864
13896
  if (editorEl.value) {
@@ -13872,8 +13904,8 @@ function useCodeEditor(props, ctx2) {
13872
13904
  if (!isDecorationExisted(currentLineNumber)) {
13873
13905
  const lineDecoration = [
13874
13906
  {
13875
- range: new monaco.Range(currentLineNumber, 0, currentLineNumber, 0),
13876
- option: {
13907
+ range: new monaco2.Range(currentLineNumber, 0, currentLineNumber, 0),
13908
+ options: {
13877
13909
  isWholeLine: true,
13878
13910
  glyphMarginClassName: `icon-pointer ${addCommentIcon.value}`
13879
13911
  }
@@ -13899,12 +13931,12 @@ function useCodeEditor(props, ctx2) {
13899
13931
  setTimeout(() => {
13900
13932
  currentDecorations = editor.deltaDecorations(currentDecorations, tempDecorations);
13901
13933
  });
13902
- currentDecorations = editor.deltaDecorations(currentLineDecoration, []);
13934
+ currentLineDecoration = editor.deltaDecorations(currentLineDecoration, []);
13903
13935
  }
13904
13936
  }
13905
13937
  function setDecorations(decoration) {
13906
13938
  return {
13907
- range: new monaco.Range(decoration.lineNumber, 1, decoration.lineNumber, 1),
13939
+ range: new monaco2.Range(decoration.lineNumber, 1, decoration.lineNumber, 1),
13908
13940
  options: {
13909
13941
  isWholeLine: true,
13910
13942
  className: decoration.customClasses || "",
@@ -13944,7 +13976,7 @@ function useCodeEditor(props, ctx2) {
13944
13976
  heightInPx: comment2.heightInPx ? comment2.heightInPx : 0,
13945
13977
  afterColumn: 1,
13946
13978
  domNode: document.createElement("div"),
13947
- ondomNodeTop: (top) => {
13979
+ onDomNodeTop: (top) => {
13948
13980
  layoutOverlayWidget(comment2.lineNumber, { top });
13949
13981
  },
13950
13982
  onComputedHeight: (height) => {
@@ -13967,7 +13999,7 @@ function useCodeEditor(props, ctx2) {
13967
13999
  }
13968
14000
  function calculateLayoutInfo(positionInfos, editorLayoutInfo, index2) {
13969
14001
  let _offsetLeft = 0;
13970
- const indexOffsetLeft = comments.value[index2].offserLeft;
14002
+ const indexOffsetLeft = comments.value[index2].offsetLeft;
13971
14003
  if (indexOffsetLeft) {
13972
14004
  _offsetLeft = indexOffsetLeft;
13973
14005
  } else {
@@ -13980,8 +14012,8 @@ function useCodeEditor(props, ctx2) {
13980
14012
  offsetLeft: _offsetLeft
13981
14013
  };
13982
14014
  }
13983
- function handleDomNodePosition(top, hieght, index2) {
13984
- comments.value[index2].domNode.style.height = `${hieght}px`;
14015
+ function handleDomNodePosition(top, height, index2) {
14016
+ comments.value[index2].domNode.style.height = `${height}px`;
13985
14017
  if (heightMap.get(index2) === 0) {
13986
14018
  comments.value[index2].domNode.style.top = `-${1e4 + top}px`;
13987
14019
  } else {
@@ -14058,51 +14090,204 @@ var CodeEditor = defineComponent({
14058
14090
  }, null);
14059
14091
  }
14060
14092
  });
14093
+ let monaco;
14094
+ const CodeHighlightDirective = {
14095
+ async mounted(el) {
14096
+ if (inBrowser) {
14097
+ monaco = await import("monaco-editor");
14098
+ monaco.editor.colorizeElement(el);
14099
+ }
14100
+ },
14101
+ updated(el) {
14102
+ if (inBrowser) {
14103
+ monaco.editor.colorizeElement(el);
14104
+ }
14105
+ }
14106
+ };
14061
14107
  var CodeEditorInstall = {
14062
14108
  title: "Code Editor \u4EE3\u7801\u7F16\u8F91\u5668",
14063
14109
  category: "\u6F14\u8FDB\u4E2D",
14064
14110
  status: "100%",
14065
14111
  install(app) {
14112
+ app.directive("d-code-highlight", CodeHighlightDirective);
14066
14113
  app.component(CodeEditor.name, CodeEditor);
14067
14114
  }
14068
14115
  };
14116
+ function FoldIcon() {
14117
+ return createVNode("svg", {
14118
+ "width": "16px",
14119
+ "height": "16px",
14120
+ "viewBox": "0 0 16 16",
14121
+ "xmlns": "http://www.w3.org/2000/svg"
14122
+ }, [createVNode("g", {
14123
+ "stroke": "none",
14124
+ "stroke-width": "1",
14125
+ "fill-rule": "evenodd"
14126
+ }, [createVNode("polygon", {
14127
+ "points": "4.5 5 8 8.76923077 11.5 5 13 6.61538462 8 12 3 6.61538462"
14128
+ }, null)])]);
14129
+ }
14130
+ function CopyIcon() {
14131
+ return createVNode("svg", {
14132
+ "width": "16px",
14133
+ "height": "16px",
14134
+ "viewBox": "0 0 16 16",
14135
+ "version": "1.1",
14136
+ "xmlns": "http://www.w3.org/2000/svg"
14137
+ }, [createVNode("g", {
14138
+ "stroke": "none",
14139
+ "stroke-width": "1",
14140
+ "fill": "none",
14141
+ "fill-rule": "evenodd"
14142
+ }, [createVNode("path", {
14143
+ "d": `M14,1 C14.5522847,1 15,1.44771525 15,2 L15,10 C15,10.5522847 14.5522847,11 14,11 L11,11 L11,14
14144
+ C11,14.5522847 10.5522847,15 10,15 L2,15 C1.44771525,15 1,14.5522847 1,14 L1,6 C1,5.44771525 1.44771525,5
14145
+ 2,5 L5,5 L5,2 C5,1.44771525 5.44771525,1 6,1 L14,1 Z M10,6 L2,6 L2,14 L10,14 L10,6 Z M9,11 L9,12 L3,12
14146
+ L3,11 L9,11 Z M14,2 L6,2 L6,5 L10,5 C10.5522847,5 11,5.44771525 11,6 L11,10 L14,10 L14,2 Z M9,8 L9,9 L3,9 L3,8 L9,8 Z`,
14147
+ "fill": "#babbc0",
14148
+ "fill-rule": "nonzero"
14149
+ }, null)])]);
14150
+ }
14069
14151
  const codeReviewProps = {
14070
14152
  diff: {
14071
14153
  type: String,
14072
14154
  required: true,
14073
14155
  default: ""
14074
14156
  },
14157
+ fold: {
14158
+ type: Boolean,
14159
+ default: false
14160
+ },
14075
14161
  outputFormat: {
14076
14162
  type: String,
14077
14163
  default: "line-by-line"
14078
14164
  }
14079
14165
  };
14080
- function useCodeReview(props) {
14081
- const { diff, outputFormat } = toRefs(props);
14166
+ const CodeReviewInjectionKey = Symbol("d-code-review");
14167
+ function useCodeReviewCopy(diffInfo) {
14168
+ const copyTipsText = ref("\u590D\u5236\u6587\u4EF6\u8DEF\u5F84");
14169
+ const tipsPopType = ref("default");
14170
+ const onCopy = () => {
14171
+ toClipboard(diffInfo.newName).then(() => {
14172
+ });
14173
+ };
14174
+ return { copyTipsText, tipsPopType, onCopy };
14175
+ }
14176
+ var CodeReviewHeader = defineComponent({
14177
+ name: "DCodeReviewHeader",
14178
+ emits: ["click"],
14179
+ setup(_, ctx2) {
14180
+ const ns2 = useNamespace("code-review");
14181
+ const {
14182
+ diffInfo,
14183
+ isFold,
14184
+ rootCtx
14185
+ } = inject(CodeReviewInjectionKey);
14186
+ const {
14187
+ copyTipsText,
14188
+ tipsPopType,
14189
+ onCopy
14190
+ } = useCodeReviewCopy(diffInfo);
14191
+ const onClick = (e) => {
14192
+ const composedPath = e.composedPath();
14193
+ const isPreventEvent = composedPath.some((item) => {
14194
+ var _a, _b;
14195
+ return ((_a = item.classList) == null ? void 0 : _a.contains("operate-area")) || ((_b = item.classList) == null ? void 0 : _b.contains("icon-copy"));
14196
+ });
14197
+ if (!isPreventEvent) {
14198
+ ctx2.emit("click");
14199
+ }
14200
+ };
14201
+ return () => createVNode("div", {
14202
+ "class": [ns2.e("header"), {
14203
+ [ns2.em("header", "unfold")]: !isFold.value
14204
+ }],
14205
+ "onClick": onClick
14206
+ }, [createVNode("div", {
14207
+ "class": "file-info"
14208
+ }, [createVNode(FoldIcon, {
14209
+ "class": {
14210
+ invert: !isFold.value
14211
+ }
14212
+ }, null), createVNode("span", {
14213
+ "class": "file-name"
14214
+ }, [diffInfo.newName]), createVNode("span", {
14215
+ "class": "diff-lines add-lines"
14216
+ }, [createTextVNode("+"), diffInfo.addedLines]), createVNode("span", {
14217
+ "class": "diff-lines delete-lines"
14218
+ }, [createTextVNode("-"), diffInfo.deletedLines]), createVNode(Popover, {
14219
+ "content": copyTipsText.value,
14220
+ "pop-type": tipsPopType.value,
14221
+ "trigger": "hover",
14222
+ "position": ["right"]
14223
+ }, {
14224
+ default: () => [createVNode(CopyIcon, {
14225
+ "class": "icon-copy",
14226
+ "onClick": onCopy
14227
+ }, null)]
14228
+ })]), rootCtx.slots.headOperate && createVNode("div", {
14229
+ "class": "operate-area"
14230
+ }, [rootCtx.slots.headOperate()])]);
14231
+ }
14232
+ });
14233
+ function useCodeReview(props, ctx2) {
14234
+ const { diff, fold, outputFormat } = toRefs(props);
14082
14235
  const renderHtml = ref("");
14083
- onMounted(() => {
14084
- renderHtml.value = Diff2Html.html(diff.value, {
14085
- drawFileList: true,
14236
+ const isFold = ref(fold.value);
14237
+ const diffFile = Diff2Html.parse(diff.value);
14238
+ const initDiffContent = () => {
14239
+ renderHtml.value = Diff2Html.html(diffFile, {
14240
+ drawFileList: false,
14086
14241
  matching: "lines",
14087
14242
  outputFormat: outputFormat.value
14088
14243
  });
14244
+ };
14245
+ const toggleFold = (status2) => {
14246
+ if (status2 !== void 0) {
14247
+ isFold.value = status2;
14248
+ } else {
14249
+ isFold.value = !isFold.value;
14250
+ }
14251
+ };
14252
+ watch(fold, (val) => {
14253
+ isFold.value = val;
14089
14254
  });
14090
- return { renderHtml };
14255
+ watch(isFold, () => {
14256
+ if (!isFold.value && renderHtml.value === "") {
14257
+ initDiffContent();
14258
+ }
14259
+ ctx2.emit("foldChange", isFold.value);
14260
+ });
14261
+ onBeforeMount(() => {
14262
+ if (!isFold.value) {
14263
+ initDiffContent();
14264
+ }
14265
+ });
14266
+ provide(CodeReviewInjectionKey, { diffInfo: diffFile[0], isFold, rootCtx: ctx2 });
14267
+ ctx2.expose({ toggleFold });
14268
+ return { renderHtml, isFold };
14091
14269
  }
14092
- var diff2html_min = "";
14093
14270
  var codeReview = "";
14094
14271
  var CodeReview = defineComponent({
14095
14272
  name: "DCodeReview",
14096
14273
  props: codeReviewProps,
14097
- setup(props) {
14274
+ emits: ["foldChange"],
14275
+ setup(props, ctx2) {
14098
14276
  const ns2 = useNamespace("code-review");
14099
14277
  const {
14100
- renderHtml
14101
- } = useCodeReview(props);
14278
+ renderHtml,
14279
+ isFold
14280
+ } = useCodeReview(props, ctx2);
14102
14281
  return () => createVNode("div", {
14103
- "class": ns2.b(),
14282
+ "class": ns2.b()
14283
+ }, [createVNode(CodeReviewHeader, {
14284
+ "onClick": () => isFold.value = !isFold.value
14285
+ }, null), createVNode("div", {
14286
+ "class": [ns2.e("content"), {
14287
+ "hide-content": isFold.value
14288
+ }],
14104
14289
  "innerHTML": renderHtml.value
14105
- }, null);
14290
+ }, null)]);
14106
14291
  }
14107
14292
  });
14108
14293
  var CodeReviewInstall = {
@@ -25208,7 +25393,7 @@ function useEditorMdRender(props, ctx2) {
25208
25393
  clearTimeout(timer);
25209
25394
  }
25210
25395
  timer = setTimeout(() => {
25211
- if (!content2.value) {
25396
+ if (content2.value === void 0) {
25212
25397
  return;
25213
25398
  }
25214
25399
  let html = renderService.generateHTML(content2.value);
@@ -42029,7 +42214,7 @@ const installs = [
42029
42214
  VirtualListInstall
42030
42215
  ];
42031
42216
  var vueDevui = {
42032
- version: "1.5.6",
42217
+ version: "1.5.7-hotfix.2",
42033
42218
  install(app) {
42034
42219
  installs.forEach((p) => app.use(p));
42035
42220
  }