vue-devui 1.5.7 → 1.5.9

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 (106) hide show
  1. package/alert/index.es.js +13 -3
  2. package/alert/index.umd.js +11 -1
  3. package/auto-complete/index.es.js +7 -1
  4. package/auto-complete/index.umd.js +7 -7
  5. package/auto-complete/style.css +1 -1
  6. package/avatar/index.es.js +10 -2
  7. package/avatar/index.umd.js +9 -1
  8. package/checkbox/index.es.js +7 -1
  9. package/checkbox/index.umd.js +13 -13
  10. package/checkbox/style.css +1 -1
  11. package/code-editor/index.es.js +13 -12
  12. package/code-editor/index.umd.js +5 -5
  13. package/code-review/index.es.js +589 -21
  14. package/code-review/index.umd.js +76 -19
  15. package/code-review/style.css +1 -1
  16. package/date-picker-pro/index.es.js +7 -1
  17. package/date-picker-pro/index.umd.js +8 -8
  18. package/date-picker-pro/style.css +1 -1
  19. package/dragdrop/index.es.js +158 -0
  20. package/dragdrop/index.umd.js +1 -0
  21. package/dragdrop/package.json +8 -0
  22. package/editor-md/style.css +1 -1
  23. package/form/index.es.js +7 -1
  24. package/form/index.umd.js +7 -7
  25. package/form/style.css +1 -1
  26. package/git-graph/index.es.js +6061 -0
  27. package/git-graph/index.umd.js +32 -0
  28. package/git-graph/package.json +8 -0
  29. package/global.d.ts +2 -0
  30. package/input/index.es.js +7 -1
  31. package/input/index.umd.js +6 -6
  32. package/input/style.css +1 -1
  33. package/input-number/index.es.js +7 -1
  34. package/input-number/index.umd.js +10 -10
  35. package/input-number/style.css +1 -1
  36. package/mention/index.es.js +7 -1
  37. package/mention/index.umd.js +9 -9
  38. package/mention/style.css +1 -1
  39. package/modal/index.es.js +2 -1
  40. package/modal/index.umd.js +1 -1
  41. package/nuxt/components/GitGraph.js +2 -0
  42. package/nuxt/components/gitGraphProps.js +2 -0
  43. package/package.json +2 -1
  44. package/pagination/index.es.js +14 -2
  45. package/pagination/index.umd.js +13 -7
  46. package/pagination/style.css +1 -1
  47. package/radio/index.es.js +7 -1
  48. package/radio/index.umd.js +13 -13
  49. package/radio/style.css +1 -1
  50. package/search/index.es.js +7 -1
  51. package/search/index.umd.js +8 -8
  52. package/search/style.css +1 -1
  53. package/select/index.es.js +14 -2
  54. package/select/index.umd.js +11 -5
  55. package/select/style.css +1 -1
  56. package/splitter/index.es.js +14 -3
  57. package/splitter/index.umd.js +12 -12
  58. package/style.css +1 -1
  59. package/switch/index.es.js +7 -1
  60. package/switch/index.umd.js +14 -14
  61. package/switch/style.css +1 -1
  62. package/table/index.es.js +7 -1
  63. package/table/index.umd.js +5 -5
  64. package/table/style.css +1 -1
  65. package/textarea/index.es.js +7 -1
  66. package/textarea/index.umd.js +12 -12
  67. package/textarea/style.css +1 -1
  68. package/time-picker/index.es.js +7 -1
  69. package/time-picker/index.umd.js +7 -7
  70. package/time-picker/style.css +1 -1
  71. package/time-select/index.es.js +14 -2
  72. package/time-select/index.umd.js +11 -5
  73. package/time-select/style.css +1 -1
  74. package/tree/index.es.js +7 -1
  75. package/tree/index.umd.js +7 -7
  76. package/tree/style.css +1 -1
  77. package/types/avatar/src/components/icon-body.d.ts +1 -1
  78. package/types/code-editor/src/code-editor-types.d.ts +1 -1
  79. package/types/code-editor/src/code-editor.d.ts +1 -1
  80. package/types/code-editor/src/composables/use-code-editor.d.ts +2 -2
  81. package/types/code-review/src/code-review-types.d.ts +20 -0
  82. package/types/code-review/src/code-review.d.ts +16 -1
  83. package/types/code-review/src/components/code-review-icons.d.ts +4 -0
  84. package/types/code-review/src/composables/use-code-review-comment.d.ts +13 -0
  85. package/types/code-review/src/composables/use-code-review-expand.d.ts +6 -0
  86. package/types/code-review/src/composables/use-code-review-fold.d.ts +6 -0
  87. package/types/code-review/src/composables/use-code-review.d.ts +6 -3
  88. package/types/code-review/src/const.d.ts +2 -0
  89. package/types/code-review/src/utils.d.ts +15 -0
  90. package/types/dragdrop/src/const.d.ts +0 -1
  91. package/types/dragdrop/src/draggable-directive.d.ts +1 -18
  92. package/types/dragdrop/src/droppable-directive.d.ts +1 -14
  93. package/types/dragdrop/src/sortable-directive.d.ts +1 -15
  94. package/types/dragdrop/src/utils.d.ts +2 -80
  95. package/types/form/src/form-types.d.ts +4 -0
  96. package/types/form/src/form.d.ts +9 -0
  97. package/types/git-graph/index.d.ts +11 -0
  98. package/types/git-graph/src/git-graph-class.d.ts +43 -0
  99. package/types/git-graph/src/git-graph-types.d.ts +84 -0
  100. package/types/git-graph/src/git-graph.d.ts +10 -0
  101. package/types/git-graph/src/use-git-graph.d.ts +6 -0
  102. package/types/modal/src/modal-types.d.ts +1 -1
  103. package/types/modal/src/modal.d.ts +2 -1
  104. package/types/vue-devui.d.ts +2 -1
  105. package/vue-devui.es.js +1411 -225
  106. package/vue-devui.umd.js +140 -60
package/vue-devui.es.js CHANGED
@@ -39,6 +39,7 @@ import Clipboard from "clipboard";
39
39
  import { offset, autoPlacement, arrow, shift, computePosition, flip } from "@floating-ui/dom";
40
40
  import { onClickOutside, toRefs as toRefs$1, useResizeObserver } from "@vueuse/core";
41
41
  import * as Diff2Html from "diff2html";
42
+ import { Diff2HtmlUI } from "diff2html/lib/ui/js/diff2html-ui";
42
43
  import * as echarts from "echarts";
43
44
  import * as hljs from "highlight.js";
44
45
  import MarkdownIt from "markdown-it";
@@ -1137,7 +1138,13 @@ const AlertCloseIcon = () => createVNode("svg", {
1137
1138
  "transform": "translate(-3.000000, -3.000000)",
1138
1139
  "fill-rule": "nonzero"
1139
1140
  }, [createVNode("path", {
1140
- "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"
1141
+ "d": `M11.6426,3.19816936 C11.9239974,2.91574512 12.4131626,2.93784891 12.7352108,3.24751057 C13.0571998,3.5572302
1142
+ 13.0901298,4.03723416 12.8087324,4.31965839 L9.14064666,7.99900183 L12.8087324,11.6803416 C13.0645482,11.9370909
1143
+ 13.0605893,12.3571292 12.8158402,12.6640749 L12.7352108,12.7524894 C12.4131626,13.0621511 11.9239974,13.0842548
1144
+ 11.6426,12.8018306 L8,9.14489021 L4.35740003,12.8018306 C4.10158422,13.05858 3.6740594,13.0636532 3.35648225,12.8298003
1145
+ L3.26478919,12.7524894 C2.94280021,12.4427698 2.90987023,11.9627658 3.19126762,11.6803416 L6.8583349,7.99900183
1146
+ L3.19126762,4.31965839 C2.93545181,4.06290908 2.93941068,3.64287076 3.18415975,3.3359251 L3.26478919,3.24751057
1147
+ C3.58683735,2.93784891 4.07600264,2.91574512 4.35740003,3.19816936 L8,6.85411161 L11.6426,3.19816936 Z`
1141
1148
  }, null)])])]);
1142
1149
  const ns$k = useNamespace("alert");
1143
1150
  const AlertTypeIcon = (props) => createVNode("svg", {
@@ -1171,12 +1178,16 @@ const AlertTypeIcon = (props) => createVNode("svg", {
1171
1178
  "fill-rule": "evenodd"
1172
1179
  }, [createVNode("path", {
1173
1180
  "class": "warning-outer",
1174
- "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"
1181
+ "d": `M8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158
1182
+ C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343
1183
+ C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838
1184
+ 7.98165058,-0.153569987 8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 Z`
1175
1185
  }, null), createVNode("path", {
1176
1186
  "class": "warning-inner",
1177
1187
  "stroke-width": "0.3",
1178
1188
  "fill-rule": "nonzero",
1179
- "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"
1189
+ "d": `M8.87894737,13 L7.08947368,13 L7.08947368,11.2105263 L8.87894737,11.2105263 L8.87894737,13 Z M8.62102372,9.86842105
1190
+ L7.32800539,9.86842105 L7,4.5 L8.96842105,4.5 L8.62102372,9.86842105 Z`
1180
1191
  }, null)]);
1181
1192
  case "info":
1182
1193
  return createVNode("g", {
@@ -2124,6 +2135,10 @@ const formProps = {
2124
2135
  },
2125
2136
  size: {
2126
2137
  type: String
2138
+ },
2139
+ hideRequiredMark: {
2140
+ type: Boolean,
2141
+ default: false
2127
2142
  }
2128
2143
  };
2129
2144
  const FORM_TOKEN = Symbol("dForm");
@@ -6632,7 +6647,7 @@ var lodash = { exports: {} };
6632
6647
  position -= target.length;
6633
6648
  return position >= 0 && string3.slice(position, end) == target;
6634
6649
  }
6635
- function escape(string3) {
6650
+ function escape2(string3) {
6636
6651
  string3 = toString(string3);
6637
6652
  return string3 && reHasUnescapedHtml.test(string3) ? string3.replace(reUnescapedHtml, escapeHtmlChar) : string3;
6638
6653
  }
@@ -6917,7 +6932,7 @@ var lodash = { exports: {} };
6917
6932
  function iteratee(func) {
6918
6933
  return baseIteratee(typeof func == "function" ? func : baseClone2(func, CLONE_DEEP_FLAG2));
6919
6934
  }
6920
- function matches(source) {
6935
+ function matches2(source) {
6921
6936
  return baseMatches(baseClone2(source, CLONE_DEEP_FLAG2));
6922
6937
  }
6923
6938
  function matchesProperty(path, srcValue) {
@@ -7129,7 +7144,7 @@ var lodash = { exports: {} };
7129
7144
  lodash2.map = map;
7130
7145
  lodash2.mapKeys = mapKeys;
7131
7146
  lodash2.mapValues = mapValues;
7132
- lodash2.matches = matches;
7147
+ lodash2.matches = matches2;
7133
7148
  lodash2.matchesProperty = matchesProperty;
7134
7149
  lodash2.memoize = memoize;
7135
7150
  lodash2.merge = merge;
@@ -7235,7 +7250,7 @@ var lodash = { exports: {} };
7235
7250
  lodash2.divide = divide;
7236
7251
  lodash2.endsWith = endsWith;
7237
7252
  lodash2.eq = eq2;
7238
- lodash2.escape = escape;
7253
+ lodash2.escape = escape2;
7239
7254
  lodash2.escapeRegExp = escapeRegExp;
7240
7255
  lodash2.every = every;
7241
7256
  lodash2.find = find;
@@ -8409,6 +8424,7 @@ function PendingIcon() {
8409
8424
  }, null)])]);
8410
8425
  }
8411
8426
  function useFormLabel() {
8427
+ const formContext = inject(FORM_TOKEN);
8412
8428
  const formItemContext = inject(FORM_ITEM_TOKEN);
8413
8429
  const labelData = inject(LABEL_DATA);
8414
8430
  const ns2 = useNamespace("form");
@@ -8420,7 +8436,8 @@ function useFormLabel() {
8420
8436
  }));
8421
8437
  const labelInnerClasses = computed(() => ({
8422
8438
  [`${ns2.e("label-span")}`]: true,
8423
- [`${ns2.em("label", "required")}`]: formItemContext.isRequired
8439
+ [`${ns2.em("label", "required")}`]: formItemContext.isRequired,
8440
+ [`${ns2.em("label", "required-hide")}`]: formItemContext.isRequired && formContext.hideRequiredMark
8424
8441
  }));
8425
8442
  return { labelClasses, labelInnerClasses };
8426
8443
  }
@@ -10604,7 +10621,9 @@ const IconBody = (props) => {
10604
10621
  "cy": "15",
10605
10622
  "r": "15"
10606
10623
  }, null), createVNode("path", {
10607
- "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 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 C7,19.0122153 10.8892296, 16.5 14.9997866,16.5 C19.1103437,16.5 23,20 23,23 Z",
10624
+ "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
10625
+ 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
10626
+ C7,19.0122153 10.8892296, 16.5 14.9997866,16.5 C19.1103437,16.5 23,20 23,23 Z`,
10608
10627
  "id": "\u5F62\u72B6\u7ED3\u5408",
10609
10628
  "fill": "#FFFFFF"
10610
10629
  }, null)])]);
@@ -10652,7 +10671,13 @@ const IconNobody = (props) => {
10652
10671
  "fill": "none",
10653
10672
  "fill-rule": "evenodd"
10654
10673
  }, [createVNode("path", {
10655
- "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 L20.81,17.7474562 L20.81, 14.9974562 L22.31,14.9974562 L22.31,17.7474562 L25.06,17.7474562 L25.06, 19.2474562 L22.31,19.2474562 Z M14.9297866,14.9974562 C12.4445053, 14.9974562 10.4297866,12.9827376 10.4297866,10.4974562 C10.4297866, 8.01217483 12.4445053,5.9974562 14.9297866,5.9974562 C17.415068, 5.9974562 19.4297866,8.01217483 19.4297866,10.4974562 C19.4297866, 12.9827376 17.415068,14.9974562 14.9297866,14.9974562 Z M19.6797866, 20.2474562 L19.6797866,21.9971623 L6.93,21.9960092 C6.93,18.0096715 10.8192296, 15.4974562 14.9297866,15.4974562 C16.4608397,15.4974562 17.9612467,15.983021 19.2414296, 16.7474562 L17.06,16.7474562 L17.06,20.2474562 L19.6797866,20.2474562 Z",
10674
+ "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
10675
+ L20.81,17.7474562 L20.81, 14.9974562 L22.31,14.9974562 L22.31,17.7474562 L25.06,17.7474562 L25.06, 19.2474562
10676
+ L22.31,19.2474562 Z M14.9297866,14.9974562 C12.4445053, 14.9974562 10.4297866,12.9827376 10.4297866,10.4974562
10677
+ C10.4297866, 8.01217483 12.4445053,5.9974562 14.9297866,5.9974562 C17.415068, 5.9974562 19.4297866,8.01217483
10678
+ 19.4297866,10.4974562 C19.4297866, 12.9827376 17.415068,14.9974562 14.9297866,14.9974562 Z M19.6797866, 20.2474562
10679
+ L19.6797866,21.9971623 L6.93,21.9960092 C6.93,18.0096715 10.8192296, 15.4974562 14.9297866,15.4974562 C16.4608397,15.4974562
10680
+ 17.9612467,15.983021 19.2414296, 16.7474562 L17.06,16.7474562 L17.06,20.2474562 L19.6797866,20.2474562 Z`,
10656
10681
  "id": "\u5F62\u72B6\u7ED3\u5408",
10657
10682
  "fill": "#959EB2"
10658
10683
  }, null), createVNode("path", {
@@ -13759,8 +13784,8 @@ function useCodeEditor(props, ctx2) {
13759
13784
  if (mode.value === "review") {
13760
13785
  nextTick(() => {
13761
13786
  refreshDecorations();
13762
- refreshOverlayWidgets();
13763
13787
  refreshViewZones();
13788
+ refreshOverlayWidgets();
13764
13789
  });
13765
13790
  }
13766
13791
  }
@@ -13807,11 +13832,10 @@ function useCodeEditor(props, ctx2) {
13807
13832
  }
13808
13833
  }
13809
13834
  function setEditorValue() {
13810
- var _a;
13811
13835
  if (!editor || !editor.getModel()) {
13812
13836
  return;
13813
13837
  }
13814
- (_a = editor.getModel().modified) == null ? void 0 : _a.setValue(modelValue.value);
13838
+ editor.getModel().setValue(modelValue.value);
13815
13839
  }
13816
13840
  function setDiffEditorValue() {
13817
13841
  var _a;
@@ -13847,9 +13871,9 @@ function useCodeEditor(props, ctx2) {
13847
13871
  } else if (diffEditor) {
13848
13872
  model = diffEditor.getModel().modified;
13849
13873
  }
13850
- model.onDidChangeContent(lodash.exports.throttle(() => {
13874
+ model == null ? void 0 : model.onDidChangeContent(lodash.exports.throttle(() => {
13851
13875
  modifyValueFromInner = true;
13852
- ctx2.emit("update: modelValue", model.getValue());
13876
+ ctx2.emit("update:modelValue", model.getValue());
13853
13877
  }, 100));
13854
13878
  }
13855
13879
  function setDiffEditorOriginValue() {
@@ -13863,6 +13887,8 @@ function useCodeEditor(props, ctx2) {
13863
13887
  const language = options.value.language;
13864
13888
  if (editor) {
13865
13889
  if (mode.value === "normal" || mode.value === "review") {
13890
+ monaco2.editor.setModelLanguage(editor.getModel(), language);
13891
+ } else if (mode.value === "diff") {
13866
13892
  const model = diffEditor.getModel();
13867
13893
  monaco2.editor.setModelLanguage(model.modified, language);
13868
13894
  monaco2.editor.setModelLanguage(model.original, language);
@@ -13894,7 +13920,7 @@ function useCodeEditor(props, ctx2) {
13894
13920
  const lineDecoration = [
13895
13921
  {
13896
13922
  range: new monaco2.Range(currentLineNumber, 0, currentLineNumber, 0),
13897
- option: {
13923
+ options: {
13898
13924
  isWholeLine: true,
13899
13925
  glyphMarginClassName: `icon-pointer ${addCommentIcon.value}`
13900
13926
  }
@@ -13920,7 +13946,7 @@ function useCodeEditor(props, ctx2) {
13920
13946
  setTimeout(() => {
13921
13947
  currentDecorations = editor.deltaDecorations(currentDecorations, tempDecorations);
13922
13948
  });
13923
- currentDecorations = editor.deltaDecorations(currentLineDecoration, []);
13949
+ currentLineDecoration = editor.deltaDecorations(currentLineDecoration, []);
13924
13950
  }
13925
13951
  }
13926
13952
  function setDecorations(decoration) {
@@ -13965,7 +13991,7 @@ function useCodeEditor(props, ctx2) {
13965
13991
  heightInPx: comment2.heightInPx ? comment2.heightInPx : 0,
13966
13992
  afterColumn: 1,
13967
13993
  domNode: document.createElement("div"),
13968
- ondomNodeTop: (top) => {
13994
+ onDomNodeTop: (top) => {
13969
13995
  layoutOverlayWidget(comment2.lineNumber, { top });
13970
13996
  },
13971
13997
  onComputedHeight: (height) => {
@@ -13988,7 +14014,7 @@ function useCodeEditor(props, ctx2) {
13988
14014
  }
13989
14015
  function calculateLayoutInfo(positionInfos, editorLayoutInfo, index2) {
13990
14016
  let _offsetLeft = 0;
13991
- const indexOffsetLeft = comments.value[index2].offserLeft;
14017
+ const indexOffsetLeft = comments.value[index2].offsetLeft;
13992
14018
  if (indexOffsetLeft) {
13993
14019
  _offsetLeft = indexOffsetLeft;
13994
14020
  } else {
@@ -14001,8 +14027,8 @@ function useCodeEditor(props, ctx2) {
14001
14027
  offsetLeft: _offsetLeft
14002
14028
  };
14003
14029
  }
14004
- function handleDomNodePosition(top, hieght, index2) {
14005
- comments.value[index2].domNode.style.height = `${hieght}px`;
14030
+ function handleDomNodePosition(top, height, index2) {
14031
+ comments.value[index2].domNode.style.height = `${height}px`;
14006
14032
  if (heightMap.get(index2) === 0) {
14007
14033
  comments.value[index2].domNode.style.top = `-${1e4 + top}px`;
14008
14034
  } else {
@@ -14068,7 +14094,7 @@ var codeEditor = "";
14068
14094
  var CodeEditor = defineComponent({
14069
14095
  name: "DCodeEditor",
14070
14096
  props: codeEditorProps,
14071
- emits: ["update: modelValue", "afterEditorInit", "click"],
14097
+ emits: ["update:modelValue", "afterEditorInit", "click"],
14072
14098
  setup(props, ctx2) {
14073
14099
  const {
14074
14100
  editorEl
@@ -14137,6 +14163,88 @@ function CopyIcon() {
14137
14163
  "fill-rule": "nonzero"
14138
14164
  }, null)])]);
14139
14165
  }
14166
+ function CommentIcon() {
14167
+ return createVNode("svg", {
14168
+ "width": "12px",
14169
+ "height": "12px",
14170
+ "viewBox": "0 0 16 16",
14171
+ "version": "1.1",
14172
+ "xmlns": "http://www.w3.org/2000/svg"
14173
+ }, [createVNode("g", {
14174
+ "stroke": "none",
14175
+ "stroke-width": "1",
14176
+ "fill": "none",
14177
+ "fill-rule": "evenodd"
14178
+ }, [createVNode("path", {
14179
+ "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
14180
+ 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
14181
+ 5.92582641,11.1664898 6.28439337,11.4669131 L6.41421356,11.5857864 L8,13.171 L9.58578644,11.5857864
14182
+ C9.91918444,11.2523884 10.3581707,11.0488544 10.8241472,11.0077406 L11,11 L14,11 L14,3 Z M8,6 C8.55228475,6
14183
+ 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
14184
+ 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
14185
+ 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
14186
+ 5,8 C4.44771525,8 4,7.55228475 4,7 C4,6.44771525 4.44771525,6 5,6 Z`,
14187
+ "fill": "#5e7ce0",
14188
+ "fill-rule": "nonzero"
14189
+ }, null)])]);
14190
+ }
14191
+ function UpExpandIcon() {
14192
+ return `<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
14193
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
14194
+ <g transform="translate(-1365.000000,-11.000000)">
14195
+ <g transform="translate(1365.000000,11.000000)">
14196
+ <rect x="0" y="0" width="16" height="16"></rect>
14197
+ <g
14198
+ transform="translate(8.000000, 8.000000) scale(1, -1) translate(-8.000000, -8.000000) translate(1.000000, 4.000000)"
14199
+ fill="#71757F">
14200
+ <path
14201
+ 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
14202
+ 0,0.776142375 0,0.5 C0,0.223857625 0.223857625,0 0.5,0 Z'></path>
14203
+ <polygon
14204
+ transform="translate(7.000000, 5.5000000) scale(1, -1) translate(-7.000000, -5.5000000)"
14205
+ points="7 3 10 8 4 8"></polygon>
14206
+ </g>
14207
+ </g>
14208
+ </g>
14209
+ </g>
14210
+ </svg>`;
14211
+ }
14212
+ function DownExpandIcon() {
14213
+ return `<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
14214
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
14215
+ <g transform="translate(-1344.000000,-11.000000)">
14216
+ <g transform="translate(1344.000000,11.000000)">
14217
+ <rect x="0" y="0" width="16" height="16"></rect>
14218
+ <g transform="translate(1.000000, 5.000000)" fill="#71757F">
14219
+ <path
14220
+ 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
14221
+ 0,0.776142375 0,0.5 C0,0.223857625 0.223857625,0 0.5,0 Z"></path>
14222
+ <polygon
14223
+ transform="translate(7.000000,5.500000) scale(1, -1) translate(-7.000000, -5.500000)"
14224
+ points="7 3 10 8 4 8"></polygon>
14225
+ </g>
14226
+ </g>
14227
+ </g>
14228
+ </g>
14229
+ </svg>`;
14230
+ }
14231
+ function AllExpandIcon() {
14232
+ return `<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
14233
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
14234
+ <g transform="translate(-1301.000000,-11.000000)">
14235
+ <rect x="1301" y="11" width="16" height="16"></rect>
14236
+ <path
14237
+ 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
14238
+ C1302.22386,19 1302,18.7761424 1302,18.5 C1302,18.2238576 1302.22386,18 1302.5,18 Z" fill="#71757F"></path>
14239
+ <polygon fill="#71757F" points="1309 11 1312 16 1306 16"></polygon>
14240
+ <polygon
14241
+ fill="#71757F"
14242
+ transform="translate(1309.000000, 23.500000) scale(1, -1) translate(-1309.000000, -23.500000)"
14243
+ points="1309 21 1312 26 1306 26"></polygon>
14244
+ </g>
14245
+ </g>
14246
+ </svg>`;
14247
+ }
14140
14248
  const codeReviewProps = {
14141
14249
  diff: {
14142
14250
  type: String,
@@ -14150,6 +14258,13 @@ const codeReviewProps = {
14150
14258
  outputFormat: {
14151
14259
  type: String,
14152
14260
  default: "line-by-line"
14261
+ },
14262
+ expandAllThreshold: {
14263
+ type: Number,
14264
+ default: 50
14265
+ },
14266
+ codeLoader: {
14267
+ type: Function
14153
14268
  }
14154
14269
  };
14155
14270
  const CodeReviewInjectionKey = Symbol("d-code-review");
@@ -14219,18 +14334,369 @@ var CodeReviewHeader = defineComponent({
14219
14334
  }, [rootCtx.slots.headOperate()])]);
14220
14335
  }
14221
14336
  });
14337
+ const ExpandLineReg = /^@@ -(\d+),(\d+) \+(\d+),(\d+) @@/;
14338
+ const FirstLineReg = /^@@ -[0,1](?!\d)/;
14339
+ function notEmptyNode(node) {
14340
+ const classes = node.classList;
14341
+ return !classes.contains("d2h-info") && !classes.contains("d2h-emptyplaceholder") && !classes.contains("comment-cell");
14342
+ }
14343
+ function insertIncrementLineToPage(referenceDom, trNodes, direction) {
14344
+ const trNodesToBeInserted = trNodes.filter((element) => element.children[0].children.length === 2);
14345
+ if (direction === "up") {
14346
+ const nextSibling = referenceDom.nextElementSibling;
14347
+ trNodesToBeInserted.forEach((item) => {
14348
+ var _a;
14349
+ (_a = referenceDom.parentNode) == null ? void 0 : _a.insertBefore(item, nextSibling);
14350
+ });
14351
+ } else {
14352
+ trNodesToBeInserted.forEach((item) => {
14353
+ var _a;
14354
+ (_a = referenceDom.parentNode) == null ? void 0 : _a.insertBefore(item, referenceDom);
14355
+ });
14356
+ }
14357
+ }
14358
+ function ifRemoveExpandLine(expandDom, newExpandDom, direction) {
14359
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
14360
+ const matches2 = newExpandDom.children[1].innerText.trim().match(ExpandLineReg);
14361
+ if (!matches2) {
14362
+ return true;
14363
+ }
14364
+ const leftLineNumber = parseInt(matches2[1]);
14365
+ const addedLine = parseInt(matches2[2]);
14366
+ const rightLineNumber = parseInt(matches2[3]);
14367
+ if (direction === "up") {
14368
+ const prevSibling = expandDom.previousElementSibling;
14369
+ if (!prevSibling) {
14370
+ if (leftLineNumber === 1 && rightLineNumber === 1) {
14371
+ expandDom == null ? void 0 : expandDom.remove();
14372
+ return true;
14373
+ }
14374
+ } else {
14375
+ const prevLeftLineNumber = parseInt((_c = (_b = (_a = prevSibling.children) == null ? void 0 : _a[0].children) == null ? void 0 : _b[0]) == null ? void 0 : _c.innerText);
14376
+ const prevRightLineNumber = parseInt((_f = (_e = (_d = prevSibling.children) == null ? void 0 : _d[0].children) == null ? void 0 : _e[1]) == null ? void 0 : _f.innerText);
14377
+ if (leftLineNumber === prevLeftLineNumber + 1 && rightLineNumber === prevRightLineNumber + 1) {
14378
+ expandDom.remove();
14379
+ return true;
14380
+ }
14381
+ }
14382
+ } else {
14383
+ const nextSibling = expandDom.nextElementSibling;
14384
+ 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);
14385
+ 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);
14386
+ if (leftLineNumber + addedLine === nextLeftLineNumber && rightLineNumber + addedLine === nextRightLineNumber) {
14387
+ expandDom.remove();
14388
+ return true;
14389
+ }
14390
+ }
14391
+ return false;
14392
+ }
14393
+ function updateExpandLineCount(expandDom, newExpandDom) {
14394
+ if (!expandDom.nextElementSibling) {
14395
+ return;
14396
+ }
14397
+ const curMatches = expandDom.children[1].innerText.trim().match(ExpandLineReg);
14398
+ const newMatches = newExpandDom.children[1].innerText.trim().match(ExpandLineReg);
14399
+ const newChangedNumLeft = parseInt((curMatches == null ? void 0 : curMatches[2]) || "") + parseInt((newMatches == null ? void 0 : newMatches[2]) || "");
14400
+ const newChangedNumRight = parseInt((curMatches == null ? void 0 : curMatches[4]) || "") + parseInt((newMatches == null ? void 0 : newMatches[4]) || "");
14401
+ expandDom.children[1].children[0].innerText = `@@ -${(newMatches == null ? void 0 : newMatches[1]) || 0},${newChangedNumLeft} +${(newMatches == null ? void 0 : newMatches[3]) || 0},${newChangedNumRight} @@`;
14402
+ }
14403
+ function parseDiffCode(container, code, outputFormat) {
14404
+ const diff2HtmlUi = new Diff2HtmlUI(container, code, {
14405
+ drawFileList: false,
14406
+ matching: "lines",
14407
+ outputFormat,
14408
+ highlight: true
14409
+ });
14410
+ diff2HtmlUi.draw();
14411
+ diff2HtmlUi.highlightCode();
14412
+ }
14413
+ function setLineNumberInDataset(trNode, prevL, prevR, nextL, nextR) {
14414
+ if (trNode) {
14415
+ trNode.classList.add("expand-line");
14416
+ trNode.dataset.prevL = String(prevL);
14417
+ trNode.dataset.prevR = String(prevR);
14418
+ trNode.dataset.nextL = String(nextL);
14419
+ trNode.dataset.nextR = String(nextR);
14420
+ }
14421
+ }
14422
+ function updateExpandUpDownButton(trNode) {
14423
+ trNode.children[0].children[0].remove();
14424
+ trNode.children[0].children[0].classList.remove("up-expand");
14425
+ trNode.children[0].children[0].classList.add("all-expand");
14426
+ trNode.children[0].children[0].innerHTML = AllExpandIcon();
14427
+ }
14428
+ function updateLineNumberInDataset(trNode, expandAllThreshold, position, updateExpandButton = false) {
14429
+ let nextL;
14430
+ let prevL;
14431
+ let nextR;
14432
+ let prevR;
14433
+ if (position === "top") {
14434
+ const nextLineNode = trNode.nextElementSibling;
14435
+ nextL = parseInt(nextLineNode.children[0].children[0].innerText) - 1;
14436
+ prevL = Math.max(nextL - expandAllThreshold + 1, 1);
14437
+ nextR = parseInt(nextLineNode.children[0].children[1].innerText) - 1;
14438
+ prevR = Math.max(nextR - expandAllThreshold + 1, 1);
14439
+ } else if (position === "bottom") {
14440
+ const prevLineNode = trNode.previousElementSibling;
14441
+ prevL = parseInt(prevLineNode.children[0].children[0].innerText) + 1;
14442
+ nextL = prevL + expandAllThreshold - 1;
14443
+ prevR = parseInt(prevLineNode.children[0].children[1].innerText) + 1;
14444
+ nextR = prevR + expandAllThreshold - 1;
14445
+ } else {
14446
+ const prevLineNode = trNode.previousElementSibling;
14447
+ const nextLineNode = trNode.nextElementSibling;
14448
+ const prevLineNumber = parseInt(prevLineNode.children[0].children[0].innerText);
14449
+ const nextLineNumber = parseInt(nextLineNode.children[0].children[0].innerText);
14450
+ prevL = prevLineNumber + 1;
14451
+ prevR = parseInt(prevLineNode.children[0].children[1].innerText) + 1;
14452
+ nextL = nextLineNumber - 1;
14453
+ nextR = parseInt(nextLineNode.children[0].children[1].innerText) - 1;
14454
+ const isExpandAll = nextLineNumber - prevLineNumber <= expandAllThreshold;
14455
+ if (isExpandAll && updateExpandButton) {
14456
+ updateExpandUpDownButton(trNode);
14457
+ }
14458
+ }
14459
+ setLineNumberInDataset(trNode, prevL, prevR, nextL, nextR);
14460
+ }
14461
+ function getLineNumberFormDataset(expandDom, expandAllThreshold) {
14462
+ var _a, _b, _c;
14463
+ const attrsMap = (_b = (_a = expandDom.parentElement) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.dataset;
14464
+ const prevL = Number(attrsMap == null ? void 0 : attrsMap.prevL);
14465
+ const nextL = Number(attrsMap == null ? void 0 : attrsMap.nextL);
14466
+ const prevR = Number(attrsMap == null ? void 0 : attrsMap.prevR);
14467
+ const nextR = Number(attrsMap == null ? void 0 : attrsMap.nextR);
14468
+ let leftLineStart, leftLineEnd, rightLineStart, rightLineEnd;
14469
+ if (prevL && nextL && prevR && nextR) {
14470
+ const buttonClasses = Array.from(expandDom.classList);
14471
+ const direction = (_c = buttonClasses.find((item) => item.endsWith("expand"))) == null ? void 0 : _c.split("-")[0];
14472
+ if (direction === "up") {
14473
+ leftLineEnd = nextL;
14474
+ leftLineStart = Math.max(leftLineEnd - expandAllThreshold + 1, prevL);
14475
+ rightLineEnd = nextR;
14476
+ rightLineStart = Math.max(rightLineEnd - expandAllThreshold + 1, prevR);
14477
+ } else if (direction === "down") {
14478
+ leftLineStart = prevL;
14479
+ leftLineEnd = Math.min(leftLineStart + expandAllThreshold - 1, nextL);
14480
+ rightLineStart = prevR;
14481
+ rightLineEnd = Math.min(rightLineStart + expandAllThreshold - 1, nextR);
14482
+ } else {
14483
+ leftLineStart = prevL;
14484
+ leftLineEnd = nextL;
14485
+ rightLineStart = prevR;
14486
+ rightLineEnd = nextR;
14487
+ }
14488
+ }
14489
+ return [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd];
14490
+ }
14491
+ function insertNode(parent, child) {
14492
+ if (parent.firstChild) {
14493
+ parent.insertBefore(child, parent.firstChild);
14494
+ } else {
14495
+ parent.appendChild(child);
14496
+ }
14497
+ }
14498
+ function addExpandButton(parentNode, className2, icon2) {
14499
+ const expandButton = document.createElement("div");
14500
+ expandButton.innerHTML = icon2;
14501
+ expandButton.classList.add("expand-icon");
14502
+ expandButton.classList.add(className2);
14503
+ insertNode(parentNode, expandButton);
14504
+ }
14505
+ function attachExpandUpDownButton(parentNode, direction) {
14506
+ var _a;
14507
+ const expandDirectionMap = {
14508
+ up: "up-expand",
14509
+ down: "down-expand",
14510
+ all: "all-expand"
14511
+ };
14512
+ const expandDirectionIconMap = {
14513
+ up: UpExpandIcon,
14514
+ down: DownExpandIcon,
14515
+ all: AllExpandIcon
14516
+ };
14517
+ parentNode.classList.add("expand-icon-wrapper");
14518
+ if (direction === "updown") {
14519
+ addExpandButton(parentNode, "up-expand", UpExpandIcon());
14520
+ addExpandButton(parentNode, "down-expand", DownExpandIcon());
14521
+ } else {
14522
+ addExpandButton(parentNode, expandDirectionMap[direction], (_a = expandDirectionIconMap[direction]) == null ? void 0 : _a.call(expandDirectionIconMap));
14523
+ }
14524
+ }
14525
+ function addCommentToPage(lineHost, commentDom, lineSide) {
14526
+ var _a, _b;
14527
+ const newLine = document.createElement("tr");
14528
+ const newCell = document.createElement("td");
14529
+ newCell.classList.add("comment-cell");
14530
+ newCell.style.width = "100%";
14531
+ newCell.setAttribute("colspan", "2");
14532
+ newCell.appendChild(commentDom);
14533
+ newLine.classList.add("comment-block");
14534
+ newLine.classList.add(lineSide);
14535
+ newLine.appendChild(newCell);
14536
+ if (lineHost.nextElementSibling) {
14537
+ (_a = lineHost.parentElement) == null ? void 0 : _a.insertBefore(newLine, lineHost.nextElementSibling);
14538
+ } else {
14539
+ (_b = lineHost.parentElement) == null ? void 0 : _b.appendChild(newLine);
14540
+ }
14541
+ }
14542
+ function useCodeReviewExpand(reviewContentRef, props) {
14543
+ const { outputFormat, expandAllThreshold, codeLoader } = toRefs(props);
14544
+ const processSideBySide = () => {
14545
+ const [leftTable, rightTable] = reviewContentRef.value.querySelectorAll("table");
14546
+ const trNodes = Array.from(leftTable.querySelectorAll("tr"));
14547
+ const totalLines = trNodes.length;
14548
+ for (const index2 in trNodes) {
14549
+ const lineIndex = parseInt(index2);
14550
+ const lineChildren = Array.from(trNodes[lineIndex].children);
14551
+ const lineNumberBox = lineChildren[0];
14552
+ const lineContentBox = lineChildren[1];
14553
+ const lineClassList = lineContentBox.classList.value;
14554
+ const lineContent = lineContentBox.innerText.trim();
14555
+ if (lineContent.match(ExpandLineReg) && !FirstLineReg.test(lineContent) && lineClassList && lineClassList.includes("d2h-info")) {
14556
+ const nextLineIndex = lineIndex + 1;
14557
+ const prevLineIndex = lineIndex - 1;
14558
+ if (lineIndex === 0 && nextLineIndex in trNodes) {
14559
+ attachExpandUpDownButton(lineNumberBox, "up");
14560
+ } else if (lineIndex > 0 && lineIndex < totalLines - 1 && nextLineIndex in trNodes && prevLineIndex in trNodes) {
14561
+ const preLineChildren = Array.from(trNodes[prevLineIndex].children);
14562
+ const nextLineChildren = Array.from(trNodes[nextLineIndex].children);
14563
+ const isExpandAll = parseInt(nextLineChildren[0].innerText) - parseInt(preLineChildren[0].innerText) - 1 < expandAllThreshold.value;
14564
+ attachExpandUpDownButton(lineNumberBox, isExpandAll ? "all" : "updown");
14565
+ }
14566
+ }
14567
+ }
14568
+ const endLine = trNodes[0].cloneNode(true);
14569
+ if (Object.prototype.hasOwnProperty.call(endLine.children[0].children, 0)) {
14570
+ endLine.children[0].removeChild(endLine.children[0].children[0]);
14571
+ }
14572
+ endLine.children[1].innerText = "";
14573
+ const leftEndLine = endLine.cloneNode(true);
14574
+ const rightEndLint = endLine.cloneNode(true);
14575
+ attachExpandUpDownButton(leftEndLine.children[0], "down");
14576
+ leftTable.tBodies[0].appendChild(leftEndLine);
14577
+ rightTable.tBodies[0].appendChild(rightEndLint);
14578
+ };
14579
+ const processLineByLine = () => {
14580
+ var _a;
14581
+ const trNodes = Array.from(reviewContentRef.value.querySelectorAll("tr"));
14582
+ const totalLines = trNodes.length;
14583
+ for (const index2 in trNodes) {
14584
+ const lineIndex = parseInt(index2);
14585
+ const tdNodes = Array.from(trNodes[lineIndex].children);
14586
+ const lineNumberBox = tdNodes[0];
14587
+ const lineContentBox = tdNodes[1];
14588
+ if (!lineContentBox) {
14589
+ continue;
14590
+ }
14591
+ const lineClassList = lineContentBox.classList.value;
14592
+ const lineContent = lineContentBox.innerText.trim();
14593
+ if (lineContent.match(ExpandLineReg) && !FirstLineReg.test(lineContent) && lineClassList && lineClassList.includes("d2h-info")) {
14594
+ const nextLineIndex = lineIndex + 1;
14595
+ const prevLineIndex = lineIndex - 1;
14596
+ if (lineIndex === 0 && nextLineIndex in trNodes) {
14597
+ updateLineNumberInDataset(trNodes[lineIndex], expandAllThreshold.value, "top");
14598
+ attachExpandUpDownButton(lineNumberBox, "up");
14599
+ } else if (lineIndex > 0 && lineIndex < totalLines - 1 && nextLineIndex in trNodes && prevLineIndex in trNodes) {
14600
+ const prevTdNodes = Array.from(trNodes[prevLineIndex].children);
14601
+ const prevLineNumber = parseInt(prevTdNodes[0].children[0].innerText);
14602
+ const nextTdNodes = Array.from(trNodes[nextLineIndex].children);
14603
+ const nextLineNumber = parseInt(nextTdNodes[0].children[0].innerText);
14604
+ updateLineNumberInDataset(trNodes[lineIndex], expandAllThreshold.value, "middle");
14605
+ const isExpandAll = nextLineNumber - prevLineNumber <= expandAllThreshold.value;
14606
+ attachExpandUpDownButton(lineNumberBox, isExpandAll ? "all" : "updown");
14607
+ }
14608
+ }
14609
+ }
14610
+ const loadMoreLine = trNodes[0].cloneNode(true);
14611
+ loadMoreLine.children[0].removeChild(loadMoreLine.children[0].children[0]);
14612
+ loadMoreLine.children[1].innerText = "";
14613
+ (_a = trNodes[0].parentElement) == null ? void 0 : _a.appendChild(loadMoreLine);
14614
+ updateLineNumberInDataset(loadMoreLine, expandAllThreshold.value, "bottom");
14615
+ attachExpandUpDownButton(loadMoreLine.children[0], "down");
14616
+ };
14617
+ const insertIncrementCode = (code, direction, referenceDom) => {
14618
+ if (!referenceDom) {
14619
+ return;
14620
+ }
14621
+ if (!code) {
14622
+ return referenceDom == null ? void 0 : referenceDom.remove();
14623
+ }
14624
+ const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
14625
+ const container = document.createElement("div");
14626
+ parseDiffCode(container, prefix + code, outputFormat.value);
14627
+ const trNodes = Array.from(container.querySelectorAll("tr"));
14628
+ const expandLine = trNodes.find((element) => {
14629
+ var _a;
14630
+ return (_a = element.children[1]) == null ? void 0 : _a.innerText.trim().match(ExpandLineReg);
14631
+ });
14632
+ if (!expandLine) {
14633
+ return;
14634
+ }
14635
+ insertIncrementLineToPage(referenceDom, trNodes, direction);
14636
+ const removedExpandLine = ifRemoveExpandLine(referenceDom, expandLine, direction);
14637
+ if (removedExpandLine) {
14638
+ return;
14639
+ }
14640
+ updateExpandLineCount(referenceDom, expandLine);
14641
+ if (direction === "up") {
14642
+ if (!referenceDom.previousElementSibling) {
14643
+ updateLineNumberInDataset(referenceDom, expandAllThreshold.value, "top");
14644
+ } else {
14645
+ updateLineNumberInDataset(referenceDom, expandAllThreshold.value, "middle", true);
14646
+ }
14647
+ } else {
14648
+ if (referenceDom.nextElementSibling) {
14649
+ updateLineNumberInDataset(referenceDom, expandAllThreshold.value, "middle", true);
14650
+ } else {
14651
+ updateLineNumberInDataset(referenceDom, expandAllThreshold.value, "bottom");
14652
+ }
14653
+ }
14654
+ };
14655
+ const onExpandButtonClick = (e) => {
14656
+ var _a, _b;
14657
+ const composedPath = e.composedPath();
14658
+ const expandIconDom = composedPath.find((element) => {
14659
+ var _a2;
14660
+ return (_a2 = element.classList) == null ? void 0 : _a2.contains("expand-icon");
14661
+ });
14662
+ if (expandIconDom) {
14663
+ const expandDirection = (_a = Array.from(expandIconDom.classList).find((item) => item.endsWith("expand"))) == null ? void 0 : _a.split("-")[0];
14664
+ const direction = expandDirection === "up" || expandDirection === "all" ? "up" : "down";
14665
+ const [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd] = getLineNumberFormDataset(expandIconDom, expandAllThreshold.value);
14666
+ (_b = codeLoader == null ? void 0 : codeLoader.value) == null ? void 0 : _b.call(codeLoader, [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd], (code) => {
14667
+ var _a2;
14668
+ insertIncrementCode(code, direction, (_a2 = expandIconDom.parentElement) == null ? void 0 : _a2.parentElement);
14669
+ });
14670
+ }
14671
+ };
14672
+ const insertExpandButton = () => {
14673
+ outputFormat.value === "side-by-side" ? processSideBySide() : processLineByLine();
14674
+ };
14675
+ return { insertExpandButton, onExpandButtonClick };
14676
+ }
14222
14677
  function useCodeReview(props, ctx2) {
14223
- const { diff, fold, outputFormat } = toRefs(props);
14678
+ const { diff, outputFormat } = toRefs(props);
14224
14679
  const renderHtml = ref("");
14225
- const isFold = ref(fold.value);
14226
- const diffFile = Diff2Html.parse(diff.value);
14680
+ const reviewContentRef = ref();
14681
+ const diffFile = ref([]);
14682
+ const { insertExpandButton, onExpandButtonClick } = useCodeReviewExpand(reviewContentRef, props);
14227
14683
  const initDiffContent = () => {
14228
- renderHtml.value = Diff2Html.html(diffFile, {
14229
- drawFileList: false,
14230
- matching: "lines",
14231
- outputFormat: outputFormat.value
14684
+ diffFile.value = Diff2Html.parse(diff.value);
14685
+ nextTick(() => {
14686
+ parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value);
14687
+ insertExpandButton();
14688
+ ctx2.emit("contentRefresh", JSON.parse(JSON.stringify(diffFile.value)));
14232
14689
  });
14233
14690
  };
14691
+ const onContentClick = (e) => {
14692
+ onExpandButtonClick(e);
14693
+ };
14694
+ watch(diff, initDiffContent, { immediate: true });
14695
+ return { renderHtml, reviewContentRef, diffFile, onContentClick };
14696
+ }
14697
+ function useCodeReviewFold(props, ctx2) {
14698
+ const { fold } = toRefs(props);
14699
+ const isFold = ref(fold.value);
14234
14700
  const toggleFold = (status2) => {
14235
14701
  if (status2 !== void 0) {
14236
14702
  isFold.value = status2;
@@ -14242,31 +14708,145 @@ function useCodeReview(props, ctx2) {
14242
14708
  isFold.value = val;
14243
14709
  });
14244
14710
  watch(isFold, () => {
14245
- if (!isFold.value && renderHtml.value === "") {
14246
- initDiffContent();
14247
- }
14248
14711
  ctx2.emit("foldChange", isFold.value);
14249
14712
  });
14250
- onBeforeMount(() => {
14251
- if (!isFold.value) {
14252
- initDiffContent();
14713
+ return { isFold, toggleFold };
14714
+ }
14715
+ function useCodeReviewComment(reviewContentRef, ctx2) {
14716
+ const ns2 = useNamespace("code-review");
14717
+ const commentLeft = ref(-100);
14718
+ const commentTop = ref(-100);
14719
+ let currentLeftLineNumber = -1;
14720
+ let currentRightLineNumber = -1;
14721
+ const resetLeftTop = () => {
14722
+ commentLeft.value = -100;
14723
+ commentTop.value = -100;
14724
+ currentLeftLineNumber = -1;
14725
+ currentRightLineNumber = -1;
14726
+ };
14727
+ const onMouseEnter = (e) => {
14728
+ e.currentTarget.getBoundingClientRect();
14729
+ };
14730
+ const onMouseMove = (e) => {
14731
+ var _a, _b;
14732
+ const composedPath = e.composedPath();
14733
+ const trNode = composedPath.find((item) => item.tagName === "TR");
14734
+ if (trNode) {
14735
+ const lineNumberContainer = Array.from(trNode.children)[0];
14736
+ if (notEmptyNode(lineNumberContainer)) {
14737
+ const { top, left } = lineNumberContainer.getBoundingClientRect();
14738
+ commentLeft.value = left;
14739
+ commentTop.value = top;
14740
+ currentLeftLineNumber = parseInt((_a = lineNumberContainer.children[0]) == null ? void 0 : _a.innerText) || -1;
14741
+ currentRightLineNumber = parseInt((_b = lineNumberContainer.children[1]) == null ? void 0 : _b.innerText) || -1;
14742
+ } else {
14743
+ resetLeftTop();
14744
+ }
14745
+ }
14746
+ };
14747
+ const onMouseleave = (e) => {
14748
+ var _a;
14749
+ if (!((_a = e.relatedTarget) == null ? void 0 : _a.classList.contains("comment-icon"))) {
14750
+ resetLeftTop();
14751
+ }
14752
+ };
14753
+ const onCommentMouseLeave = (e) => {
14754
+ var _a;
14755
+ if (!((_a = e.relatedTarget) == null ? void 0 : _a.classList.contains(ns2.e("content")))) {
14756
+ resetLeftTop();
14757
+ }
14758
+ };
14759
+ const onCommentIconClick = () => {
14760
+ ctx2.emit("addComment", { left: currentLeftLineNumber, right: currentRightLineNumber });
14761
+ };
14762
+ const findReferenceDom = (lineNumber, lineSide) => {
14763
+ var _a, _b, _c, _d;
14764
+ const trNodes = Array.from(reviewContentRef.value.querySelectorAll("tr"));
14765
+ for (const index2 in trNodes) {
14766
+ const lineIndex = parseInt(index2);
14767
+ const lineNumberBox = Array.from(trNodes[lineIndex].children)[0];
14768
+ if (notEmptyNode(lineNumberBox)) {
14769
+ const oldLineNumber = parseInt((_b = (_a = lineNumberBox.children[0]) == null ? void 0 : _a.innerText) != null ? _b : -1);
14770
+ const newLineNumber = parseInt((_d = (_c = lineNumberBox.children[1]) == null ? void 0 : _c.innerText) != null ? _d : -1);
14771
+ if (lineSide === "left" && oldLineNumber === lineNumber || lineSide === "right" && newLineNumber === lineNumber) {
14772
+ return trNodes[lineIndex];
14773
+ }
14774
+ }
14775
+ }
14776
+ };
14777
+ const insertComment = (lineNumber, lineSide, commentDom) => {
14778
+ const lineHost = findReferenceDom(lineNumber, lineSide);
14779
+ lineHost && addCommentToPage(lineHost, commentDom, lineSide);
14780
+ };
14781
+ const removeComment = (lineNumber, lineSide) => {
14782
+ const lineHost = findReferenceDom(lineNumber, lineSide);
14783
+ let nextLineHost = lineHost == null ? void 0 : lineHost.nextElementSibling;
14784
+ while (nextLineHost) {
14785
+ const classList = nextLineHost == null ? void 0 : nextLineHost.classList;
14786
+ if ((classList == null ? void 0 : classList.contains("comment-block")) && classList.contains(lineSide)) {
14787
+ nextLineHost.remove();
14788
+ return;
14789
+ }
14790
+ nextLineHost = nextLineHost.nextElementSibling;
14253
14791
  }
14792
+ };
14793
+ window.addEventListener("scroll", resetLeftTop);
14794
+ onUnmounted(() => {
14795
+ window.removeEventListener("scroll", resetLeftTop);
14254
14796
  });
14255
- provide(CodeReviewInjectionKey, { diffInfo: diffFile[0], isFold, rootCtx: ctx2 });
14256
- ctx2.expose({ toggleFold });
14257
- return { renderHtml, isFold };
14797
+ return {
14798
+ commentLeft,
14799
+ commentTop,
14800
+ onMouseEnter,
14801
+ onMouseMove,
14802
+ onMouseleave,
14803
+ onCommentMouseLeave,
14804
+ onCommentIconClick,
14805
+ insertComment,
14806
+ removeComment
14807
+ };
14258
14808
  }
14259
14809
  var codeReview = "";
14260
14810
  var CodeReview = defineComponent({
14261
14811
  name: "DCodeReview",
14262
14812
  props: codeReviewProps,
14263
- emits: ["foldChange"],
14813
+ emits: ["foldChange", "addComment", "afterViewInit", "contentRefresh"],
14264
14814
  setup(props, ctx2) {
14265
14815
  const ns2 = useNamespace("code-review");
14266
14816
  const {
14267
14817
  renderHtml,
14268
- isFold
14818
+ reviewContentRef,
14819
+ diffFile,
14820
+ onContentClick
14269
14821
  } = useCodeReview(props, ctx2);
14822
+ const {
14823
+ isFold,
14824
+ toggleFold
14825
+ } = useCodeReviewFold(props, ctx2);
14826
+ const {
14827
+ commentLeft,
14828
+ commentTop,
14829
+ onMouseEnter,
14830
+ onMouseMove,
14831
+ onMouseleave,
14832
+ onCommentMouseLeave,
14833
+ onCommentIconClick,
14834
+ insertComment,
14835
+ removeComment
14836
+ } = useCodeReviewComment(reviewContentRef, ctx2);
14837
+ onMounted(() => {
14838
+ ctx2.emit("afterViewInit", {
14839
+ toggleFold,
14840
+ insertComment,
14841
+ removeComment
14842
+ });
14843
+ });
14844
+ provide(CodeReviewInjectionKey, {
14845
+ reviewContentRef,
14846
+ diffInfo: diffFile.value[0],
14847
+ isFold,
14848
+ rootCtx: ctx2
14849
+ });
14270
14850
  return () => createVNode("div", {
14271
14851
  "class": ns2.b()
14272
14852
  }, [createVNode(CodeReviewHeader, {
@@ -14275,8 +14855,21 @@ var CodeReview = defineComponent({
14275
14855
  "class": [ns2.e("content"), {
14276
14856
  "hide-content": isFold.value
14277
14857
  }],
14278
- "innerHTML": renderHtml.value
14279
- }, null)]);
14858
+ "innerHTML": renderHtml.value,
14859
+ "ref": reviewContentRef,
14860
+ "onClick": onContentClick,
14861
+ "onMouseenter": onMouseEnter,
14862
+ "onMousemove": onMouseMove,
14863
+ "onMouseleave": onMouseleave
14864
+ }, null), createVNode("div", {
14865
+ "class": "comment-icon",
14866
+ "style": {
14867
+ left: commentLeft.value + "px",
14868
+ top: commentTop.value + "px"
14869
+ },
14870
+ "onClick": onCommentIconClick,
14871
+ "onMouseleave": onCommentMouseLeave
14872
+ }, [createVNode(CommentIcon, null, null)])]);
14280
14873
  }
14281
14874
  });
14282
14875
  var CodeReviewInstall = {
@@ -21063,207 +21656,160 @@ var DatePickerProInstall = {
21063
21656
  app.component(DRangeDatePickerPro.name, DRangeDatePickerPro);
21064
21657
  }
21065
21658
  };
21066
- const SHADOW_ID = "devui-dragdrop-placeholder-shadow";
21067
- function getElementStyle(id, styleName) {
21068
- return document.getElementById(id).currentStyle ? document.getElementById(id).currentStyle[styleName] : window.getComputedStyle(document.getElementById(id), styleName);
21069
- }
21070
- function createShadow(originId) {
21071
- const shadow = document.createElement("div");
21072
- shadow.id = SHADOW_ID;
21073
- shadow.style.background = "rgb(206, 215, 255)";
21074
- shadow.style.width = getElementStyle(originId, "width");
21075
- shadow.style.height = "20px";
21076
- return shadow;
21077
- }
21078
- function changeDragState(el, originId, dragStart, drag, dragover, drop, shouldCreateShadow, dragFlag) {
21079
- el.dataset.originId = originId;
21080
- el.dataset.dragStart = dragStart;
21081
- el.dataset.dragover = dragover;
21082
- el.dataset.drop = drop;
21083
- el.dataset.shouldCreateShadow = shouldCreateShadow;
21084
- el.dataset.dragFlag = dragFlag;
21085
- }
21086
- function computeCompareElementHeight(compareElement) {
21087
- return compareElement.getBoundingClientRect().top + Math.floor(compareElement.offsetHeight / 2);
21088
- }
21089
- function createInsertSortableShadow(sortDropArea, mouseObject, originId) {
21090
- const sortDropAreaArr = [...sortDropArea.children];
21091
- if (sortDropAreaArr.length === 0) {
21092
- if (!document.getElementById(SHADOW_ID)) {
21093
- const shadowElement = createShadow(originId);
21094
- sortDropArea.appendChild(shadowElement);
21095
- }
21096
- } else {
21097
- for (let index2 = 0; index2 < sortDropAreaArr.length; index2++) {
21098
- const compareHeight = computeCompareElementHeight(sortDropAreaArr[index2]);
21099
- document.getElementById(SHADOW_ID) ? sortDropArea.removeChild(document.getElementById(SHADOW_ID)) : null;
21100
- if (Math.floor(mouseObject.clientY) <= Math.floor(compareHeight / 2) + sortDropAreaArr[index2].getBoundingClientRect().top) {
21101
- sortDropArea.insertBefore(createShadow(originId), sortDropAreaArr[index2]);
21102
- break;
21103
- } else {
21104
- index2 === sortDropAreaArr.length - 1 && sortDropArea.appendChild(createShadow(originId));
21105
- }
21106
- }
21107
- }
21108
- }
21109
- function deleteInsertedSortableShadow(dropSortArea) {
21110
- if (dropSortArea) {
21111
- if (document.getElementById(SHADOW_ID)) {
21112
- if (dropSortArea.contains(document.getElementById(SHADOW_ID))) {
21113
- dropSortArea.removeChild(document.getElementById(SHADOW_ID));
21114
- }
21115
- }
21116
- }
21117
- }
21118
- function judgeMouseIsInSortableArea(mouse, sortableArea) {
21119
- const { clientX, clientY } = mouse;
21120
- const eleLeft = sortableArea.getBoundingClientRect().left;
21121
- const eleRight = sortableArea.getBoundingClientRect().right;
21122
- const eleTop = sortableArea.getBoundingClientRect().top;
21123
- const eleBottom = sortableArea.getBoundingClientRect().bottom;
21124
- if (clientX > eleLeft && clientX < eleRight && clientY > eleTop && clientY < eleBottom) {
21125
- return true;
21126
- } else {
21127
- return false;
21128
- }
21129
- }
21130
- function sameOriginExchangeElementPosition(mouse, comparedArr, dragId, dropArea) {
21131
- if (comparedArr.length <= 1) {
21132
- return;
21133
- }
21134
- for (let index2 = 0; index2 < comparedArr.length; index2++) {
21135
- if (mouse.clientY < comparedArr[index2].getBoundingClientRect().top) {
21136
- dropArea.insertBefore(document.getElementById(dragId), comparedArr[index2]);
21137
- break;
21138
- }
21139
- if (index2 === comparedArr.length - 1 && mouse.clientY > comparedArr[index2].getBoundingClientRect().bottom) {
21140
- dropArea.appendChild(document.getElementById(dragId));
21141
- break;
21659
+ var draggableDirective = {};
21660
+ var droppableDirective = {};
21661
+ function matches(element, selector) {
21662
+ const proto = Element.prototype;
21663
+ const func = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector || function(s) {
21664
+ const ctx2 = this;
21665
+ const matchesElements = (ctx2.document || ctx2.ownerDocument).querySelectorAll(s);
21666
+ let i = matchesElements.length;
21667
+ while (--i >= 0 && matchesElements.item(i) !== ctx2) {
21142
21668
  }
21143
- }
21669
+ return i > -1;
21670
+ };
21671
+ return func.call(element, selector);
21144
21672
  }
21145
- function exchangeShadowPosition(mouse, dropAreaElements, dragId, dropArea) {
21146
- var _a, _b, _c;
21147
- for (let index2 = 0; index2 < dropAreaElements.length; index2++) {
21148
- if (((_a = dropAreaElements[index2]) == null ? void 0 : _a.id) !== SHADOW_ID) {
21149
- if (Math.floor(mouse.clientY) <= dropAreaElements[index2].getBoundingClientRect().top) {
21150
- if (((_b = dropAreaElements[index2 - 1]) == null ? void 0 : _b.id) !== SHADOW_ID) {
21151
- if (document.getElementById(SHADOW_ID)) {
21152
- dropArea.removeChild(document.getElementById(SHADOW_ID));
21673
+ var SortableDirective = {
21674
+ mounted(el, binding) {
21675
+ let sourceElement;
21676
+ let sourceIndex;
21677
+ let targetIndex;
21678
+ let mouseoverElement;
21679
+ let isDrop;
21680
+ const canDrag = () => {
21681
+ var _a, _b;
21682
+ if ((_a = binding == null ? void 0 : binding.value) == null ? void 0 : _a.handle) {
21683
+ const handleSelector = (_b = binding == null ? void 0 : binding.value) == null ? void 0 : _b.handle;
21684
+ let element = mouseoverElement;
21685
+ while (element !== el) {
21686
+ if (matches(element, handleSelector)) {
21687
+ return true;
21153
21688
  }
21154
- dropArea.insertBefore(createShadow(dragId), dropAreaElements[index2]);
21155
- break;
21689
+ element = element.parentNode;
21156
21690
  }
21691
+ return false;
21157
21692
  }
21158
- if (Math.floor(mouse.clientY) > dropAreaElements[dropAreaElements.length - 1].getBoundingClientRect().top) {
21159
- if (index2 === dropAreaElements.length - 1 && ((_c = dropAreaElements[index2]) == null ? void 0 : _c.id) !== SHADOW_ID) {
21160
- if (document.getElementById(SHADOW_ID)) {
21161
- dropArea.removeChild(document.getElementById(SHADOW_ID));
21162
- }
21163
- dropArea.appendChild(createShadow(dragId));
21693
+ return true;
21694
+ };
21695
+ const getCurrentTarget = (event) => {
21696
+ let index2 = -1;
21697
+ let element = event.target;
21698
+ while (element !== el) {
21699
+ if (element.parentNode === el) {
21700
+ index2 = Array.from(el.children).indexOf(element);
21164
21701
  }
21165
- break;
21702
+ element = element.parentNode;
21166
21703
  }
21167
- }
21168
- }
21169
- }
21170
- var DraggableDirective = {
21171
- mounted(el, binding) {
21172
- el.setAttribute("draggable", "true");
21173
- el.style.cursor = "grab";
21174
- el.addEventListener("drag", () => {
21175
- changeDragState(el, el.id, "true", "true", "false", "false", "false", "true");
21176
- if (binding.instance.$root.dropElement && document.getElementById(SHADOW_ID)) {
21177
- deleteInsertedSortableShadow(binding.instance.$root.dropElement);
21178
- binding.instance.$root.dropElement = null;
21179
- }
21180
- }, false);
21181
- el.addEventListener("dragstart", () => {
21182
- changeDragState(el, el.id, "true", "true", "false", "false", "false", "false");
21183
- binding.instance.$root.identity = el.id;
21184
- el.dataset.dragArea = el.parentNode.className;
21185
- }, false);
21186
- }
21187
- };
21188
- var DroppableDirective = {
21189
- mounted(el, binding) {
21190
- el.addEventListener("dragover", (event) => {
21191
- event.preventDefault();
21192
- const dragId = binding.instance.$root.identity;
21193
- changeDragState(document.getElementById(dragId), dragId, "true", "false", "true", "false", "false", "false");
21194
- document.getElementById(dragId).dataset.dropArea = [...el.childNodes][1].className;
21195
- }, false);
21196
- el.addEventListener("drop", (event) => {
21197
- event.preventDefault();
21198
- const dragId = binding.instance.$root.identity;
21199
- document.getElementById(dragId).dataset.parent = "not-sortable-drop-area";
21200
- if (document.getElementById(dragId).dataset.dropArea === document.getElementById(dragId).dataset.dragArea) {
21201
- return;
21704
+ return index2;
21705
+ };
21706
+ const getDragClass = () => {
21707
+ var _a;
21708
+ return ((_a = binding == null ? void 0 : binding.value) == null ? void 0 : _a.dragClass) || "devui-drag-item";
21709
+ };
21710
+ const emitEvent = (funcName, event) => {
21711
+ if (binding == null ? void 0 : binding.value[funcName]) {
21712
+ binding == null ? void 0 : binding.value[funcName](event);
21202
21713
  }
21203
- const childrenArr = [...Array.from(el.children)[1].children];
21204
- if (childrenArr.length > 0) {
21205
- for (let index2 = 0; index2 < childrenArr.length; index2++) {
21206
- const childrenYRange = childrenArr[index2].getBoundingClientRect().top + childrenArr[index2].offsetHeight / 2;
21207
- if (parseFloat(event.clientY) < parseFloat(childrenYRange)) {
21208
- el.children[1].insertBefore(document.getElementById(dragId), childrenArr[index2]);
21209
- break;
21210
- }
21211
- if (index2 === childrenArr.length - 1) {
21212
- el.children[1].appendChild(document.getElementById(dragId));
21213
- }
21714
+ };
21715
+ el.addEventListener("mouseover", (event) => {
21716
+ mouseoverElement = event.target;
21717
+ });
21718
+ Array.from(el.children).forEach((element) => {
21719
+ element.setAttribute("draggable", "true");
21720
+ element.addEventListener("dragstart", (event) => {
21721
+ if (canDrag()) {
21722
+ isDrop = false;
21723
+ sourceElement = element;
21724
+ sourceIndex = Array.from(el.children).indexOf(sourceElement);
21725
+ setTimeout(() => {
21726
+ sourceElement.classList.add(getDragClass());
21727
+ });
21728
+ } else {
21729
+ event.preventDefault();
21730
+ event.stopPropagation();
21214
21731
  }
21215
- } else {
21216
- el.childNodes[1].appendChild(document.getElementById(dragId));
21217
- }
21732
+ emitEvent("dragStart", event);
21733
+ });
21734
+ });
21735
+ el.addEventListener("dragenter", function(event) {
21736
+ emitEvent("dragEnter", event);
21218
21737
  });
21219
- }
21220
- };
21221
- var SortableDirective = {
21222
- mounted(el, binding) {
21223
- const self2 = el;
21224
21738
  el.addEventListener("dragover", function(event) {
21225
- var _a;
21226
- event.preventDefault();
21227
- const dragId = binding.instance.$root.identity;
21228
- if (((_a = document.getElementById(dragId)) == null ? void 0 : _a.dataset.parent) === "sortable-drop-area") {
21229
- return;
21230
- }
21231
- if (!document.getElementById(SHADOW_ID) && [...self2.childNodes[1].children].length === 0) {
21232
- createInsertSortableShadow([...self2.childNodes][1], event, dragId);
21233
- } else if ([...self2.childNodes[1].children].length >= 1) {
21234
- exchangeShadowPosition(event, [...self2.childNodes[1].children], dragId, self2.childNodes[1]);
21739
+ var _a, _b;
21740
+ const currentIndex = Array.from(el.children).indexOf(sourceElement);
21741
+ const toIndex = getCurrentTarget(event);
21742
+ if (currentIndex !== -1 && toIndex !== -1) {
21743
+ if (currentIndex > toIndex) {
21744
+ el.removeChild(sourceElement);
21745
+ el.insertBefore(sourceElement, el.children[toIndex]);
21746
+ targetIndex = toIndex;
21747
+ } else if (currentIndex < toIndex) {
21748
+ el.removeChild(sourceElement);
21749
+ if (el.children[toIndex]) {
21750
+ el.insertBefore(sourceElement, el.children[toIndex]);
21751
+ targetIndex = toIndex;
21752
+ } else {
21753
+ el.appendChild(sourceElement);
21754
+ targetIndex = el.children.length - 1;
21755
+ }
21756
+ }
21757
+ ((_a = binding == null ? void 0 : binding.value) == null ? void 0 : _a.dragover) && ((_b = binding == null ? void 0 : binding.value) == null ? void 0 : _b.dragover(event));
21235
21758
  }
21759
+ event.preventDefault();
21760
+ emitEvent("dragOver", event);
21761
+ });
21762
+ el.addEventListener("dragleave", function(event) {
21763
+ emitEvent("dragLeave", event);
21236
21764
  });
21237
21765
  el.addEventListener("drop", function(event) {
21238
- var _a;
21239
- const dropArea = [...el.childNodes][1];
21240
- const dragId = binding.instance.$root.identity;
21241
- if (((_a = document.getElementById(dragId)) == null ? void 0 : _a.dataset.parent) === "sortable-drop-area") {
21242
- sameOriginExchangeElementPosition(event, [...dropArea.children], dragId, dropArea);
21243
- return;
21244
- }
21245
- if (document.getElementById(SHADOW_ID)) {
21246
- dropArea.replaceChild(document.getElementById(dragId), document.getElementById(SHADOW_ID));
21247
- if (document.getElementById(dragId)) {
21248
- document.getElementById(dragId).dataset.parent = "sortable-drop-area";
21766
+ var _a, _b, _c;
21767
+ isDrop = true;
21768
+ if ((_a = binding == null ? void 0 : binding.value) == null ? void 0 : _a.list) {
21769
+ const list2 = (_b = binding == null ? void 0 : binding.value) == null ? void 0 : _b.list;
21770
+ const item = list2[sourceIndex];
21771
+ list2.splice(sourceIndex, 1);
21772
+ list2.splice(targetIndex, 0, item);
21773
+ if ((_c = binding == null ? void 0 : binding.value) == null ? void 0 : _c.drop) {
21774
+ emitEvent("drop", {
21775
+ event,
21776
+ list: list2,
21777
+ fromIndex: sourceIndex,
21778
+ targetIndex
21779
+ });
21249
21780
  }
21250
21781
  }
21251
21782
  });
21252
- el.addEventListener("dragleave", function(event) {
21253
- const dropArea = [...el.childNodes][1];
21254
- if (document.getElementById(SHADOW_ID) && !judgeMouseIsInSortableArea(event, el)) {
21255
- dropArea.removeChild(document.getElementById(SHADOW_ID));
21783
+ el.addEventListener("dragend", function(event) {
21784
+ if (!isDrop) {
21785
+ if (sourceIndex !== -1 && targetIndex !== -1) {
21786
+ if (targetIndex > sourceIndex) {
21787
+ el.removeChild(sourceElement);
21788
+ el.insertBefore(sourceElement, el.children[sourceIndex]);
21789
+ } else if (sourceIndex > targetIndex) {
21790
+ el.removeChild(sourceElement);
21791
+ if (el.children[sourceIndex]) {
21792
+ el.insertBefore(sourceElement, el.children[sourceIndex]);
21793
+ } else {
21794
+ el.appendChild(sourceElement);
21795
+ }
21796
+ }
21797
+ }
21256
21798
  }
21799
+ sourceIndex = -1;
21800
+ targetIndex = -1;
21801
+ setTimeout(() => {
21802
+ sourceElement.classList.remove(getDragClass());
21803
+ });
21804
+ emitEvent("dragEnd", event);
21257
21805
  });
21258
21806
  }
21259
21807
  };
21260
21808
  var DragdropInstall = {
21261
21809
  title: "Dragdrop \u62D6\u62FD",
21262
- category: "\u901A\u7528",
21263
- status: "10%",
21810
+ category: "\u6F14\u8FDB\u4E2D",
21811
+ status: "100%",
21264
21812
  install(app) {
21265
- app.directive("DDraggable", DraggableDirective);
21266
- app.directive("DDroppable", DroppableDirective);
21267
21813
  app.directive("DSortable", SortableDirective);
21268
21814
  }
21269
21815
  };
@@ -26129,6 +26675,633 @@ var GanttInstall = {
26129
26675
  app.use(Gantt);
26130
26676
  }
26131
26677
  };
26678
+ const gitGraphProps = {
26679
+ option: {
26680
+ type: Object
26681
+ }
26682
+ };
26683
+ class GitGraph$1 {
26684
+ constructor() {
26685
+ __publicField(this, "element");
26686
+ __publicField(this, "options");
26687
+ __publicField(this, "mtime", 0);
26688
+ __publicField(this, "mspace", 0);
26689
+ __publicField(this, "parents", {});
26690
+ __publicField(this, "offsetX", 70);
26691
+ __publicField(this, "offsetY", 60);
26692
+ __publicField(this, "unitTime", 50);
26693
+ __publicField(this, "unitSpace", 15);
26694
+ __publicField(this, "prev_start", -1);
26695
+ __publicField(this, "preparedCommits", {});
26696
+ __publicField(this, "preStart", 1);
26697
+ __publicField(this, "isDark", false);
26698
+ __publicField(this, "daysBefore", "\u5929\u524D");
26699
+ __publicField(this, "hoursAgo", "\u5C0F\u65F6\u524D");
26700
+ __publicField(this, "minutesAgo", "\u5206\u949F\u524D");
26701
+ __publicField(this, "aMinutesAgo", "1\u5206\u949F\u524D");
26702
+ __publicField(this, "maxNameLength", 25);
26703
+ __publicField(this, "commits", []);
26704
+ __publicField(this, "graphHeight", 0);
26705
+ __publicField(this, "graphWidth", 0);
26706
+ __publicField(this, "svg");
26707
+ __publicField(this, "barHeight", 0);
26708
+ __publicField(this, "messageBoxWidth", 0);
26709
+ __publicField(this, "colors", [
26710
+ "#5C8DFF",
26711
+ "#BC94FF",
26712
+ "#54D2EB",
26713
+ "#A6DD82",
26714
+ "#FCDA6B",
26715
+ "#CA7ED6",
26716
+ "#7298F1",
26717
+ "#73CEA6",
26718
+ "#EDD249",
26719
+ "#CAABFF",
26720
+ "#85CAFF",
26721
+ "#93D99A",
26722
+ "#96ADFA",
26723
+ "#F4AF8F",
26724
+ "#A282E9",
26725
+ "#FFBB6B",
26726
+ "#69DBB9",
26727
+ "#76DBEF",
26728
+ "#B1CE4F",
26729
+ "#5DA4DC"
26730
+ ]);
26731
+ __publicField(this, "toolTipList");
26732
+ }
26733
+ load(element, options, isDark) {
26734
+ this.element = element;
26735
+ this.options = options;
26736
+ this.isDark = !!isDark;
26737
+ this.daysBefore = options.params.daysBefore || this.daysBefore;
26738
+ this.hoursAgo = options.params.hoursAgo || this.hoursAgo;
26739
+ this.minutesAgo = options.params.minutesAgo || this.minutesAgo;
26740
+ this.aMinutesAgo = options.params.aMinutesAgo || this.aMinutesAgo;
26741
+ this.maxNameLength = options.params.maxNameLength || 25;
26742
+ const commits = lodash.exports.cloneDeep(this.options.data.commits);
26743
+ this.prepareData(commits);
26744
+ return this.buildGraph("refName");
26745
+ }
26746
+ prepareData(commits) {
26747
+ var _a;
26748
+ let c;
26749
+ this.commits = commits;
26750
+ this.collectParent();
26751
+ this.graphHeight = this.element.getBoundingClientRect().height;
26752
+ this.graphWidth = this.element.getBoundingClientRect().width;
26753
+ const ch = Math.max(this.graphHeight, this.offsetY + this.unitTime * this.mtime + 150);
26754
+ Math.max(this.graphWidth, this.offsetX + this.unitSpace * this.mspace + 300);
26755
+ this.svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
26756
+ this.svg.setAttribute("height", ch + "");
26757
+ this.svg.setAttribute("width", "100%");
26758
+ (_a = this.element) == null ? void 0 : _a.appendChild(this.svg);
26759
+ this.barHeight = Math.max(this.graphHeight, this.unitTime * this.commits.length + 320);
26760
+ const _ref = this.commits;
26761
+ for (let _i = 0; _i < _ref.length; _i++) {
26762
+ c = _ref[_i];
26763
+ this.preparedCommits[c.id] = c;
26764
+ }
26765
+ }
26766
+ collectParent() {
26767
+ let c;
26768
+ let p;
26769
+ let _i;
26770
+ let _len;
26771
+ const _this = this;
26772
+ const _ref = this.commits;
26773
+ const _results = [];
26774
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
26775
+ c = _ref[_i];
26776
+ this.mtime = Math.max(this.mtime, c.time);
26777
+ this.mspace = Math.max(this.mspace, c.space);
26778
+ _results.push(function() {
26779
+ let _j;
26780
+ let _len2;
26781
+ const _ref2 = c.parents;
26782
+ const _result2 = [];
26783
+ for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
26784
+ p = _ref2[_j];
26785
+ _this.parents[p[0]] = true;
26786
+ _result2.push(_this.mspace = Math.max(_this.mspace, p[1]));
26787
+ }
26788
+ return _result2;
26789
+ }.call(_this));
26790
+ }
26791
+ return _results;
26792
+ }
26793
+ buildGraph(refName) {
26794
+ let curDay = new Date(0);
26795
+ let day;
26796
+ let mm;
26797
+ let _len;
26798
+ const _ref = this.commits;
26799
+ for (mm = 0, _len = _ref.length; mm < _len; mm++) {
26800
+ day = _ref[mm].date;
26801
+ if (curDay.getDate() !== new Date(day).getDate() || curDay.getMonth() !== new Date(day).getMonth() || curDay.getFullYear() !== new Date(day).getFullYear()) {
26802
+ const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
26803
+ const date4 = new Date(day);
26804
+ const attrs = {
26805
+ x: this.offsetX + this.unitSpace * this.mspace + 56,
26806
+ y: this.offsetY + this.unitTime * mm - 22,
26807
+ "font-size": "12px",
26808
+ fill: "#999",
26809
+ "text-anchor": "start"
26810
+ };
26811
+ this.setNodeAttr(text, attrs);
26812
+ const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
26813
+ tspan.appendChild(document.createTextNode(date4.getFullYear() + " / " + (date4.getMonth() + 1) + " / " + date4.getDate()));
26814
+ text.appendChild(tspan);
26815
+ this.svg.appendChild(text);
26816
+ curDay = date4;
26817
+ }
26818
+ }
26819
+ this.renderPartialGraph(refName);
26820
+ }
26821
+ setNodeAttr(node, attrs) {
26822
+ Object.keys(attrs).forEach((key) => {
26823
+ node.setAttribute(key, attrs[key]);
26824
+ });
26825
+ }
26826
+ __transform(time) {
26827
+ let timeTip = "";
26828
+ const now = new Date().getTime();
26829
+ const commitTime = new Date(time).getTime();
26830
+ const day = (now - commitTime) / (60 * 60 * 24 * 1e3);
26831
+ const hour = (now - commitTime) / (60 * 60 * 1e3);
26832
+ const minutes = (now - commitTime) / (60 * 1e3);
26833
+ if (day >= 1) {
26834
+ timeTip = Math.floor(day) + this.daysBefore;
26835
+ } else {
26836
+ if (hour >= 1) {
26837
+ timeTip = Math.floor(hour) + this.hoursAgo;
26838
+ } else {
26839
+ if (minutes >= 1) {
26840
+ timeTip = Math.floor(minutes) + this.minutesAgo;
26841
+ } else {
26842
+ timeTip = this.aMinutesAgo;
26843
+ }
26844
+ }
26845
+ }
26846
+ return timeTip;
26847
+ }
26848
+ renderPartialGraph(refName) {
26849
+ let commit;
26850
+ let end;
26851
+ let i;
26852
+ let isGraphEdge;
26853
+ let start;
26854
+ let x;
26855
+ let y;
26856
+ start = Math.floor((this.element.scrollTop - this.offsetY) / this.unitTime) - 10;
26857
+ if (start < 0) {
26858
+ isGraphEdge = true;
26859
+ start = 0;
26860
+ }
26861
+ end = this.element.scrollHeight > this.element.clientHeight ? start + 40 : Infinity;
26862
+ if (this.preStart <= end) {
26863
+ isGraphEdge = true;
26864
+ start = this.preStart - 1;
26865
+ this.preStart = end;
26866
+ }
26867
+ if (this.commits.length < end) {
26868
+ isGraphEdge = true;
26869
+ end = this.commits.length;
26870
+ }
26871
+ if (this.prev_start === -1 || Math.abs(this.prev_start - start) > 10 || isGraphEdge) {
26872
+ i = start;
26873
+ this.prev_start = start;
26874
+ while (i < end) {
26875
+ commit = this.commits[i];
26876
+ i += 1;
26877
+ if (commit["hasDrawn"] !== true) {
26878
+ x = this.offsetX + this.unitSpace * (this.mspace - commit.space);
26879
+ y = this.offsetY + this.unitTime * commit.time;
26880
+ this.drawDot(x, y, commit);
26881
+ this.drawLines(x, y, commit);
26882
+ this.appendLabel(x, y, commit);
26883
+ this.appendAnchor(x, y, commit, refName);
26884
+ commit["hasDrawn"] = true;
26885
+ }
26886
+ }
26887
+ }
26888
+ }
26889
+ drawDot(x, y, commit) {
26890
+ const options = this.options;
26891
+ const isdark = this.isDark;
26892
+ const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
26893
+ const attrs = {
26894
+ cx: x,
26895
+ cy: y,
26896
+ r: 4,
26897
+ fill: "#fff",
26898
+ strokeWidth: 1,
26899
+ stroke: this.colors[commit.space],
26900
+ style: "cursor: pointer;"
26901
+ };
26902
+ this.setNodeAttr(circle, attrs);
26903
+ this.svg.appendChild(circle);
26904
+ const avatar_box_x = this.offsetX + this.unitSpace * this.mspace + 16;
26905
+ const avatar_box_y = y - 13;
26906
+ const img = document.createElementNS("http://www.w3.org/2000/svg", "image");
26907
+ const imgAttrs = {
26908
+ width: 30,
26909
+ height: 30,
26910
+ preserveAspectRatio: "none",
26911
+ href: commit.author.avatar_url,
26912
+ x: avatar_box_x,
26913
+ y: avatar_box_y,
26914
+ style: "clip-path: circle(50%)"
26915
+ };
26916
+ this.setNodeAttr(img, imgAttrs);
26917
+ this.svg.appendChild(img);
26918
+ if (!this.messageBoxWidth) {
26919
+ this.messageBoxWidth = this.svg.getBoundingClientRect.width - (avatar_box_x + 40);
26920
+ }
26921
+ let route = ["M", avatar_box_x + 15, avatar_box_y - 20, "L", avatar_box_x + 15, avatar_box_y];
26922
+ const line1 = document.createElementNS("http://www.w3.org/2000/svg", "path");
26923
+ const lineAttrs1 = {
26924
+ d: route.join(" "),
26925
+ stroke: "#ccc",
26926
+ fill: "none",
26927
+ "stroke-width": 2
26928
+ };
26929
+ this.setNodeAttr(line1, lineAttrs1);
26930
+ this.svg.appendChild(line1);
26931
+ route = ["M", avatar_box_x + 15, avatar_box_y + 30, "L", avatar_box_x + 15, avatar_box_y + 50];
26932
+ const line2 = document.createElementNS("http://www.w3.org/2000/svg", "path");
26933
+ const lineAttrs2 = {
26934
+ d: route.join(" "),
26935
+ stroke: "#ccc",
26936
+ "stroke-width": 2
26937
+ };
26938
+ this.setNodeAttr(line2, lineAttrs2);
26939
+ this.svg.appendChild(line2);
26940
+ if (commit.author.name.length > this.maxNameLength) {
26941
+ commit.author.name = commit.author.name.substr(0, this.maxNameLength) + "...";
26942
+ }
26943
+ const commitText = document.createElementNS("http://www.w3.org/2000/svg", "text");
26944
+ const commitAttrs = {
26945
+ x: avatar_box_x + 40,
26946
+ y: y + 4,
26947
+ "text-anchor": "start",
26948
+ style: "cursor: pointer;text-anchor: start;",
26949
+ fill: isdark ? "#e8e8e8" : "#2e2e2e",
26950
+ "font-size": 14
26951
+ };
26952
+ this.setNodeAttr(commitText, commitAttrs);
26953
+ const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
26954
+ tspan.appendChild(document.createTextNode(commit.message.replace(/\n/g, " ")));
26955
+ commitText.appendChild(tspan);
26956
+ const titleText = document.createElementNS("http://www.w3.org/2000/svg", "title");
26957
+ titleText.appendChild(document.createTextNode(commit.message));
26958
+ commitText.appendChild(titleText);
26959
+ this.svg.appendChild(commitText);
26960
+ commitText.onclick = function() {
26961
+ const url2 = commit.customUrl || (options == null ? void 0 : options.commit_url.replace("{commitId}", commit.id));
26962
+ return window.open(url2, "_blank");
26963
+ };
26964
+ }
26965
+ drawLines(x, y, commit) {
26966
+ let arrow2;
26967
+ let color2;
26968
+ let offset2;
26969
+ let parent;
26970
+ let parentCommit;
26971
+ let parentX1;
26972
+ let parentX2;
26973
+ let parentY;
26974
+ let route;
26975
+ const _ref = commit.parents;
26976
+ for (let i = 0; i < _ref.length; i++) {
26977
+ parent = _ref[i];
26978
+ parentCommit = this.preparedCommits[parent[0]];
26979
+ if (!parentCommit) {
26980
+ break;
26981
+ }
26982
+ parentY = this.offsetY + this.unitTime * parentCommit.time;
26983
+ parentX1 = this.offsetX + this.unitSpace * (this.mspace - parentCommit.space);
26984
+ parentX2 = this.offsetX + this.unitSpace * (this.mspace - parent[1]);
26985
+ if (parentCommit.space <= commit.space) {
26986
+ color2 = this.colors[commit.space];
26987
+ } else {
26988
+ color2 = this.colors[parentCommit.space];
26989
+ }
26990
+ if (parent[1] === commit.space) {
26991
+ offset2 = [0, 5];
26992
+ arrow2 = "l-2,5,4,0,-2,-5,0,5".split(",");
26993
+ } else if (parent[1] < commit.space) {
26994
+ offset2 = [3, 3];
26995
+ arrow2 = "l5,0,-2,4,-3,-4,4,2".split(",");
26996
+ } else {
26997
+ offset2 = [-3, 3];
26998
+ arrow2 = "l-5,0,2,4,3,-4,-4,2".split(",");
26999
+ }
27000
+ route = ["M", x + offset2[0], y + offset2[1]];
27001
+ if (i > 0) {
27002
+ route.push(...arrow2);
27003
+ }
27004
+ if (commit.space !== parentCommit.space || commit.space !== parent[1]) {
27005
+ route.push("L", parentX2, y + 10, "L", parentX2, parentY - 5);
27006
+ }
27007
+ route.push("L", parentX1, parentY);
27008
+ const line = document.createElementNS("http://www.w3.org/2000/svg", "path");
27009
+ const lineAttrs = {
27010
+ d: route.join(" "),
27011
+ stroke: color2,
27012
+ "stroke-width": 1,
27013
+ fill: "none"
27014
+ };
27015
+ this.setNodeAttr(line, lineAttrs);
27016
+ this.svg.appendChild(line);
27017
+ }
27018
+ }
27019
+ appendLabel(x, y, commit) {
27020
+ let shortrefs;
27021
+ if (!commit.refs) {
27022
+ return;
27023
+ }
27024
+ shortrefs = commit.refs;
27025
+ if (shortrefs.length > 7) {
27026
+ if (escape(shortrefs).indexOf("%u") < 0) {
27027
+ shortrefs = shortrefs.substr(0, 5) + "...";
27028
+ } else {
27029
+ shortrefs = shortrefs.substr(0, 3) + "...";
27030
+ }
27031
+ }
27032
+ const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
27033
+ const textAttrs = {
27034
+ x: x + 4,
27035
+ y: y + 4,
27036
+ "text-anchor": "start",
27037
+ fill: "none",
27038
+ style: "font-size: 10px;"
27039
+ };
27040
+ this.setNodeAttr(text, textAttrs);
27041
+ const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
27042
+ const rect = document.createElementNS("http://www.w3.org/2000/svg", "path");
27043
+ tspan.appendChild(document.createTextNode(shortrefs));
27044
+ text.appendChild(tspan);
27045
+ const titleText = document.createElementNS("http://www.w3.org/2000/svg", "title");
27046
+ titleText.appendChild(document.createTextNode(commit.refs));
27047
+ text.appendChild(titleText);
27048
+ this.svg.appendChild(rect);
27049
+ this.svg.appendChild(text);
27050
+ setTimeout(() => {
27051
+ const textbox = text.getBBox();
27052
+ const path = [
27053
+ "M",
27054
+ x,
27055
+ y - 7,
27056
+ "L",
27057
+ x,
27058
+ y - 7 + textbox.height + 4,
27059
+ "L",
27060
+ x + textbox.width + 8,
27061
+ y - 7 + textbox.height + 4,
27062
+ "L",
27063
+ x + textbox.width + 8,
27064
+ y + 4,
27065
+ "L",
27066
+ x + textbox.width + 18,
27067
+ y,
27068
+ "L",
27069
+ x + textbox.width + 8,
27070
+ y - 4,
27071
+ "L",
27072
+ x + textbox.width + 8,
27073
+ y - 7,
27074
+ "Z"
27075
+ ];
27076
+ const rectAttrs = {
27077
+ fill: this.isDark ? "#4C4C4C" : "#fff",
27078
+ stroke: this.colors[commit.space],
27079
+ "stroke-width": "1px",
27080
+ d: path.join(" "),
27081
+ transform: `matrix(1,0,0,1,-${textbox.width + 26},0)`
27082
+ };
27083
+ const newAttrs = {
27084
+ transform: `matrix(1,0,0,1,-${textbox.width + 26},0)`,
27085
+ fill: this.colors[commit.space]
27086
+ };
27087
+ this.setNodeAttr(text, newAttrs);
27088
+ this.setNodeAttr(rect, rectAttrs);
27089
+ });
27090
+ }
27091
+ appendAnchor(x, y, commit, refName) {
27092
+ const options = this.options;
27093
+ const isDark = this.isDark;
27094
+ const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
27095
+ const attrs = {
27096
+ cx: x,
27097
+ cy: y,
27098
+ r: 10,
27099
+ fill: "#000",
27100
+ opacity: 0,
27101
+ style: "cursor:pointer;"
27102
+ };
27103
+ this.setNodeAttr(circle, attrs);
27104
+ circle.onclick = function() {
27105
+ localStorage.setItem("refName", refName);
27106
+ const url2 = commit.customUrl || (options == null ? void 0 : options.commit_url.replace("{commitId}", commit.id));
27107
+ return window.open(url2, "_blank");
27108
+ };
27109
+ circle.onmouseover = () => {
27110
+ this.commitTooltip(x + 20, y + 20, commit, isDark);
27111
+ };
27112
+ circle.onmouseleave = () => {
27113
+ this.toolTipList.forEach((element) => {
27114
+ this.svg.removeChild(element);
27115
+ });
27116
+ };
27117
+ this.svg.appendChild(circle);
27118
+ }
27119
+ getText(x, y, text, attrs = {}) {
27120
+ const resText = document.createElementNS("http://www.w3.org/2000/svg", "text");
27121
+ this.setNodeAttr(resText, __spreadValues({
27122
+ x,
27123
+ y
27124
+ }, attrs));
27125
+ const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
27126
+ tspan.appendChild(document.createTextNode(text));
27127
+ resText.appendChild(tspan);
27128
+ return resText;
27129
+ }
27130
+ commitTooltip(x, y, commit, isDark) {
27131
+ let boxHeight;
27132
+ let boxWidth;
27133
+ let messageText;
27134
+ boxWidth = 300;
27135
+ boxHeight = 200;
27136
+ const nameText = this.getText(x, y + 10, commit.author.name, {
27137
+ font: "14px Arial",
27138
+ "font-weight": "bold",
27139
+ "text-anchor": "start"
27140
+ });
27141
+ const idText = this.getText(x, y + 55, commit.id, {
27142
+ fill: isDark ? "#73788a" : "#71757f",
27143
+ "text-anchor": "start"
27144
+ });
27145
+ const timeText = this.getText(x, y + 35, this.__transform(commit.date), {
27146
+ font: "12px Arial",
27147
+ fill: isDark ? "#73788a" : "#71757f",
27148
+ "text-anchor": "start"
27149
+ });
27150
+ const branchText = commit.branch ? this.getText(x + 70, y + 35, commit.branch, {
27151
+ font: "12px Arial",
27152
+ fill: isDark ? "#73788a" : "#71757f"
27153
+ }) : null;
27154
+ const strList = commit.message.split("\n");
27155
+ if (strList.length > 10) {
27156
+ messageText = this.getText(x, y + 70, strList.slice(0, 10).join("\n") + "...", {
27157
+ fill: isDark ? "#E8E8E8" : "#2e2e2e",
27158
+ "text-anchor": "start",
27159
+ font: "12px Monaco, monospace"
27160
+ });
27161
+ } else if (commit.message.length > 1500) {
27162
+ messageText = this.getText(x, y + 70, commit.message.slice(0, 1500) + "...", {
27163
+ fill: isDark ? "#E8E8E8" : "#2e2e2e",
27164
+ "text-anchor": "start",
27165
+ font: "12px Monaco, monospace"
27166
+ });
27167
+ } else {
27168
+ messageText = this.getText(x, y + 70, commit.message, {
27169
+ fill: isDark ? "#E8E8E8" : "#2e2e2e",
27170
+ "text-anchor": "start",
27171
+ font: "12px Monaco, monospace"
27172
+ });
27173
+ }
27174
+ const textArr = commit.branch ? [nameText, idText, messageText, timeText, branchText] : [nameText, idText, messageText, timeText];
27175
+ this.textWrap(messageText, boxWidth - 50, x);
27176
+ const rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
27177
+ this.setNodeAttr(rect, {
27178
+ x: x - 10,
27179
+ y: y - 10,
27180
+ width: boxWidth,
27181
+ height: 100,
27182
+ fill: isDark ? "#4c4c4c" : "#fff",
27183
+ stroke: isDark ? "#4c4c4c" : "#fff",
27184
+ "stroke-linecap": "round",
27185
+ "stroke-width": "1px"
27186
+ });
27187
+ textArr.unshift(rect);
27188
+ const rectShadow = document.createElementNS("http://www.w3.org/2000/svg", "rect");
27189
+ this.setNodeAttr(rectShadow, {
27190
+ x: x - 11,
27191
+ y: y - 10,
27192
+ width: boxWidth + 2,
27193
+ height: 100,
27194
+ fill: isDark ? "#4c4c4c" : "#eee",
27195
+ stroke: isDark ? "#4c4c4c" : "#eee",
27196
+ "stroke-linecap": "round",
27197
+ "stroke-width": "1px"
27198
+ });
27199
+ textArr.unshift(rectShadow);
27200
+ textArr.forEach((t) => {
27201
+ this.svg.appendChild(t);
27202
+ });
27203
+ boxWidth = messageText.getBBox().width + 20 > boxWidth ? messageText.getBBox().width + 20 : boxWidth;
27204
+ boxHeight = 80 + messageText.getBBox().height;
27205
+ this.toolTipList = textArr;
27206
+ this.setNodeAttr(rect, {
27207
+ height: boxHeight + 10,
27208
+ width: boxWidth
27209
+ });
27210
+ this.setNodeAttr(rectShadow, {
27211
+ height: boxHeight + 13,
27212
+ width: boxWidth + 2
27213
+ });
27214
+ }
27215
+ textWrap(t, width, x) {
27216
+ const content2 = t.children[0].innerHTML;
27217
+ let words = content2.split("\n").filter((item) => item !== "");
27218
+ words = words.map((str) => {
27219
+ str = str.trim();
27220
+ let len = str.length;
27221
+ const strList = [];
27222
+ while (len > 70) {
27223
+ strList.push(str.slice(0, 70));
27224
+ str = str.slice(70);
27225
+ len = str.length;
27226
+ }
27227
+ strList.push(str);
27228
+ return strList.join("\n");
27229
+ });
27230
+ t.removeChild(t.children[0]);
27231
+ words.forEach((str) => {
27232
+ const list2 = str.split("\n");
27233
+ list2.forEach((item) => {
27234
+ const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
27235
+ tspan.appendChild(document.createTextNode(item));
27236
+ this.setNodeAttr(tspan, {
27237
+ dy: 14.4,
27238
+ x
27239
+ });
27240
+ t.appendChild(tspan);
27241
+ });
27242
+ const space = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
27243
+ space.appendChild(document.createTextNode(" "));
27244
+ this.setNodeAttr(space, {
27245
+ dy: 14.4,
27246
+ x
27247
+ });
27248
+ t.appendChild(space);
27249
+ });
27250
+ }
27251
+ }
27252
+ function useGitGraph(props, ctx2, isDark) {
27253
+ let themeService;
27254
+ const graph = new GitGraph$1();
27255
+ const themeChange = () => {
27256
+ var _a;
27257
+ isDark.value = !!((_a = themeService == null ? void 0 : themeService.currentTheme) == null ? void 0 : _a.isDark);
27258
+ };
27259
+ const initTheme = () => {
27260
+ var _a;
27261
+ themeService = window["devuiThemeService"];
27262
+ isDark.value = !!((_a = themeService == null ? void 0 : themeService.currentTheme) == null ? void 0 : _a.isDark);
27263
+ if (themeService) {
27264
+ themeService.eventBus.add("themeChanged", themeChange);
27265
+ }
27266
+ };
27267
+ const initGraph = (element, options, isDarkMode) => {
27268
+ graph.load(element, options, isDarkMode);
27269
+ };
27270
+ return {
27271
+ initTheme,
27272
+ initGraph
27273
+ };
27274
+ }
27275
+ var GitGraph = defineComponent({
27276
+ name: "DGitGraph",
27277
+ props: gitGraphProps,
27278
+ emits: ["scrollToBottom"],
27279
+ setup(props, ctx2) {
27280
+ const isDark = ref(false);
27281
+ const {
27282
+ initTheme,
27283
+ initGraph
27284
+ } = useGitGraph(props, ctx2, isDark);
27285
+ onMounted(() => {
27286
+ nextTick(() => {
27287
+ const graphEle = document.getElementsByClassName("d-graph-wrapper")[0];
27288
+ initTheme();
27289
+ initGraph(graphEle, props.option, isDark.value);
27290
+ });
27291
+ });
27292
+ return () => createVNode("div", {
27293
+ "class": "d-graph-wrapper"
27294
+ }, null);
27295
+ }
27296
+ });
27297
+ var GitGraphInstall = {
27298
+ title: "GitGraph \u63D0\u4EA4\u7F51\u7EDC\u56FE",
27299
+ category: "\u6F14\u8FDB\u4E2D",
27300
+ status: "100%",
27301
+ install(app) {
27302
+ app.component(GitGraph.name, GitGraph);
27303
+ }
27304
+ };
26132
27305
  const rowProps = {
26133
27306
  align: {
26134
27307
  type: String,
@@ -29132,6 +30305,7 @@ const modalProps = {
29132
30305
  function useModal(props, emit) {
29133
30306
  function close2() {
29134
30307
  emit("update:modelValue", false);
30308
+ emit("close");
29135
30309
  }
29136
30310
  function execClose() {
29137
30311
  props.beforeClose ? props.beforeClose(close2) : close2();
@@ -29285,7 +30459,7 @@ var Modal = defineComponent({
29285
30459
  name: "DModal",
29286
30460
  inheritAttrs: false,
29287
30461
  props: modalProps,
29288
- emits: ["update:modelValue"],
30462
+ emits: ["update:modelValue", "close"],
29289
30463
  setup(props, {
29290
30464
  slots,
29291
30465
  attrs,
@@ -34379,9 +35553,11 @@ var SplitterPane = defineComponent({
34379
35553
  slots,
34380
35554
  expose
34381
35555
  }) {
35556
+ var _a;
34382
35557
  const store = inject("splitterStore");
34383
35558
  const domRef = ref();
34384
35559
  const orderRef = ref();
35560
+ const currentVnode = (_a = getCurrentInstance()) == null ? void 0 : _a.vnode;
34385
35561
  const ns2 = useNamespace("splitter");
34386
35562
  watch([orderRef, domRef], ([order, ele]) => {
34387
35563
  if (!ele) {
@@ -34475,17 +35651,26 @@ var SplitterPane = defineComponent({
34475
35651
  addClass(ele, flexGrowClass);
34476
35652
  }
34477
35653
  };
35654
+ const updateCollapsed = (collapsed) => {
35655
+ var _a2;
35656
+ if (typeof collapsed === "boolean") {
35657
+ currentVnode.component.props.collapsed = collapsed;
35658
+ return;
35659
+ }
35660
+ currentVnode.component.props.collapsed = !((_a2 = currentVnode == null ? void 0 : currentVnode.component) == null ? void 0 : _a2.props.collapsed);
35661
+ };
34478
35662
  expose({
34479
35663
  order: orderRef,
34480
35664
  getPaneSize,
34481
- toggleNearPaneFlexGrow
35665
+ toggleNearPaneFlexGrow,
35666
+ updateCollapsed
34482
35667
  });
34483
35668
  return () => {
34484
- var _a;
35669
+ var _a2;
34485
35670
  return createVNode("div", {
34486
35671
  "class": ns2.e("pane"),
34487
35672
  "ref": domRef
34488
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
35673
+ }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
34489
35674
  };
34490
35675
  }
34491
35676
  });
@@ -42149,6 +43334,7 @@ const installs = [
42149
43334
  FormInstall,
42150
43335
  FullscreenInstall,
42151
43336
  GanttInstall,
43337
+ GitGraphInstall,
42152
43338
  GridInstall,
42153
43339
  IconInstall,
42154
43340
  ImagePreviewInstall,
@@ -42203,9 +43389,9 @@ const installs = [
42203
43389
  VirtualListInstall
42204
43390
  ];
42205
43391
  var vueDevui = {
42206
- version: "1.5.7",
43392
+ version: "1.5.9",
42207
43393
  install(app) {
42208
43394
  installs.forEach((p) => app.use(p));
42209
43395
  }
42210
43396
  };
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 };
43397
+ 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 as DraggableDirective, Drawer, DrawerService, Dropdown$1 as Dropdown, DropdownMenu, droppableDirective as 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 };