vue-devui 1.5.6 → 1.5.7-hotfix.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/action-timeline/style.css +1 -1
  2. package/alert/index.es.js +13 -3
  3. package/alert/index.umd.js +11 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/style.css +1 -1
  6. package/badge/style.css +1 -1
  7. package/breadcrumb/style.css +1 -1
  8. package/button/style.css +1 -1
  9. package/card/style.css +1 -1
  10. package/carousel/style.css +1 -1
  11. package/checkbox/style.css +1 -1
  12. package/code-editor/index.es.js +39 -23
  13. package/code-editor/index.umd.js +7 -7
  14. package/code-review/index.es.js +6229 -23
  15. package/code-review/index.umd.js +38 -1
  16. package/code-review/style.css +1 -1
  17. package/collapse/style.css +1 -1
  18. package/date-picker-pro/style.css +1 -1
  19. package/drawer/style.css +1 -1
  20. package/dropdown/style.css +1 -1
  21. package/editable-select/style.css +1 -1
  22. package/editor-md/index.es.js +2 -1
  23. package/editor-md/index.umd.js +30 -30
  24. package/editor-md/style.css +1 -1
  25. package/form/style.css +1 -1
  26. package/global.d.ts +2 -1
  27. package/icon/style.css +1 -1
  28. package/image-preview/style.css +1 -1
  29. package/input/style.css +1 -1
  30. package/input-number/index.es.js +1 -0
  31. package/input-number/index.umd.js +14 -14
  32. package/input-number/style.css +1 -1
  33. package/mention/style.css +1 -1
  34. package/menu/index.es.js +1 -0
  35. package/menu/index.umd.js +1 -1
  36. package/menu/style.css +1 -1
  37. package/message/style.css +1 -1
  38. package/modal/style.css +1 -1
  39. package/notification/style.css +1 -1
  40. package/nuxt/components/CodeReviewInjectionKey.js +3 -0
  41. package/overlay/style.css +1 -1
  42. package/package.json +10 -9
  43. package/pagination/index.es.js +7 -1
  44. package/pagination/index.umd.js +7 -1
  45. package/pagination/style.css +1 -1
  46. package/panel/style.css +1 -1
  47. package/popover/style.css +1 -1
  48. package/progress/index.es.js +1 -0
  49. package/progress/index.umd.js +2 -2
  50. package/radio/style.css +1 -1
  51. package/result/style.css +1 -1
  52. package/search/style.css +1 -1
  53. package/select/index.es.js +7 -1
  54. package/select/index.umd.js +7 -1
  55. package/select/style.css +1 -1
  56. package/slider/index.es.js +1 -0
  57. package/slider/index.umd.js +1 -1
  58. package/slider/style.css +1 -1
  59. package/splitter/index.es.js +1 -0
  60. package/splitter/index.umd.js +9 -9
  61. package/splitter/style.css +1 -1
  62. package/status/style.css +1 -1
  63. package/steps/style.css +1 -1
  64. package/style.css +1 -1
  65. package/switch/style.css +1 -1
  66. package/table/index.es.js +1 -0
  67. package/table/index.umd.js +12 -12
  68. package/table/style.css +1 -1
  69. package/tabs/style.css +1 -1
  70. package/tag/style.css +1 -1
  71. package/textarea/style.css +1 -1
  72. package/time-picker/style.css +1 -1
  73. package/time-select/index.es.js +7 -1
  74. package/time-select/index.umd.js +7 -1
  75. package/time-select/style.css +1 -1
  76. package/timeline/style.css +1 -1
  77. package/tooltip/style.css +1 -1
  78. package/tree/index.es.js +1 -0
  79. package/tree/index.umd.js +11 -11
  80. package/tree/style.css +1 -1
  81. package/types/code-editor/src/code-highlight-directive.d.ts +5 -0
  82. package/types/code-editor/src/composables/use-code-editor.d.ts +2 -2
  83. package/types/code-review/src/code-review-types.d.ts +12 -1
  84. package/types/code-review/src/code-review.d.ts +10 -2
  85. package/types/code-review/src/components/code-review-header.d.ts +2 -0
  86. package/types/code-review/src/components/code-review-icons.d.ts +2 -0
  87. package/types/code-review/src/composables/use-code-review-header.d.ts +6 -0
  88. package/types/code-review/src/composables/use-code-review.d.ts +3 -1
  89. package/types/shared/utils/index.d.ts +1 -0
  90. package/types/shared/utils/to-clipboard.d.ts +1 -0
  91. package/upload/style.css +1 -1
  92. package/vue-devui.es.js +225 -40
  93. package/vue-devui.umd.js +63 -50
@@ -5498,7 +5498,7 @@ function useCodeEditor(props, ctx) {
5498
5498
  addCommentIcon,
5499
5499
  expandCommentIcon
5500
5500
  } = toRefs(props);
5501
- let monaco;
5501
+ let monaco2;
5502
5502
  let editor;
5503
5503
  let diffEditor;
5504
5504
  let themeService;
@@ -5537,14 +5537,14 @@ function useCodeEditor(props, ctx) {
5537
5537
  });
5538
5538
  onMounted(async () => {
5539
5539
  if (inBrowser) {
5540
- monaco = await import("monaco-editor");
5540
+ monaco2 = await import("monaco-editor");
5541
5541
  setCurrentTheme();
5542
5542
  init();
5543
5543
  if (mode.value === "review") {
5544
5544
  nextTick(() => {
5545
5545
  refreshDecorations();
5546
- refreshOverlayWidgets();
5547
5546
  refreshViewZones();
5547
+ refreshOverlayWidgets();
5548
5548
  });
5549
5549
  }
5550
5550
  }
@@ -5556,15 +5556,15 @@ function useCodeEditor(props, ctx) {
5556
5556
  initDiffEditor();
5557
5557
  }
5558
5558
  if (!options.value["theme"]) {
5559
- monaco.editor.setTheme(currentTheme);
5559
+ monaco2.editor.setTheme(currentTheme);
5560
5560
  }
5561
5561
  handleAutoHeight();
5562
5562
  setValueEmitter();
5563
5563
  }
5564
5564
  function initNormalEditor() {
5565
5565
  if (!editor) {
5566
- editor = monaco.editor.create(editorEl.value, options.value);
5567
- editor.setModel(monaco.editor.createModel(modelValue.value, options.value["language"]));
5566
+ editor = monaco2.editor.create(editorEl.value, options.value);
5567
+ editor.setModel(monaco2.editor.createModel(modelValue.value, options.value["language"]));
5568
5568
  ctx.emit("afterEditorInit", editor);
5569
5569
  if (mode.value === "review") {
5570
5570
  editor.onMouseMove(handleMouseMove);
@@ -5575,10 +5575,10 @@ function useCodeEditor(props, ctx) {
5575
5575
  }
5576
5576
  function initDiffEditor() {
5577
5577
  if (!diffEditor) {
5578
- diffEditor = monaco.editor.createDiffEditor(editorEl.value, options.value);
5578
+ diffEditor = monaco2.editor.createDiffEditor(editorEl.value, options.value);
5579
5579
  diffEditor.setModel({
5580
- original: monaco.editor.createModel(originalText.value, options.value["language"]),
5581
- modified: monaco.editor.createModel(modelValue.value, options.value["language"])
5580
+ original: monaco2.editor.createModel(originalText.value, options.value["language"]),
5581
+ modified: monaco2.editor.createModel(modelValue.value, options.value["language"])
5582
5582
  });
5583
5583
  ctx.emit("afterEditorInit", diffEditor);
5584
5584
  }
@@ -5591,11 +5591,10 @@ function useCodeEditor(props, ctx) {
5591
5591
  }
5592
5592
  }
5593
5593
  function setEditorValue() {
5594
- var _a;
5595
5594
  if (!editor || !editor.getModel()) {
5596
5595
  return;
5597
5596
  }
5598
- (_a = editor.getModel().modified) == null ? void 0 : _a.setValue(modelValue.value);
5597
+ editor.getModel().setValue(modelValue.value);
5599
5598
  }
5600
5599
  function setDiffEditorValue() {
5601
5600
  var _a;
@@ -5614,7 +5613,7 @@ function useCodeEditor(props, ctx) {
5614
5613
  currentTheme = themeService && themeService.currentTheme.isDark ? "vs" : "vs-dark";
5615
5614
  }
5616
5615
  if (editor) {
5617
- monaco.editor.setTheme(currentTheme);
5616
+ monaco2.editor.setTheme(currentTheme);
5618
5617
  }
5619
5618
  }
5620
5619
  function handleAutoHeight() {
@@ -5647,9 +5646,11 @@ function useCodeEditor(props, ctx) {
5647
5646
  const language = options.value.language;
5648
5647
  if (editor) {
5649
5648
  if (mode.value === "normal" || mode.value === "review") {
5649
+ monaco2.editor.setModelLanguage(editor.getModel(), language);
5650
+ } else if (mode.value === "diff") {
5650
5651
  const model = diffEditor.getModel();
5651
- monaco.editor.setModelLanguage(model.modified, language);
5652
- monaco.editor.setModelLanguage(model.original, language);
5652
+ monaco2.editor.setModelLanguage(model.modified, language);
5653
+ monaco2.editor.setModelLanguage(model.original, language);
5653
5654
  }
5654
5655
  }
5655
5656
  }
@@ -5663,7 +5664,7 @@ function useCodeEditor(props, ctx) {
5663
5664
  }
5664
5665
  function updateEditorHeightAuto() {
5665
5666
  var _a;
5666
- const lineHeight = editor.getOption(monaco.editor.EditorOption.lineHeight);
5667
+ const lineHeight = editor.getOption(monaco2.editor.EditorOption.lineHeight);
5667
5668
  const lineCount = ((_a = editor.getModel()) == null ? void 0 : _a.getLineCount()) || 1;
5668
5669
  const height = editor.getTopForLineNumber(lineCount + 1) + lineHeight;
5669
5670
  if (editorEl.value) {
@@ -5677,8 +5678,8 @@ function useCodeEditor(props, ctx) {
5677
5678
  if (!isDecorationExisted(currentLineNumber)) {
5678
5679
  const lineDecoration = [
5679
5680
  {
5680
- range: new monaco.Range(currentLineNumber, 0, currentLineNumber, 0),
5681
- option: {
5681
+ range: new monaco2.Range(currentLineNumber, 0, currentLineNumber, 0),
5682
+ options: {
5682
5683
  isWholeLine: true,
5683
5684
  glyphMarginClassName: `icon-pointer ${addCommentIcon.value}`
5684
5685
  }
@@ -5704,12 +5705,12 @@ function useCodeEditor(props, ctx) {
5704
5705
  setTimeout(() => {
5705
5706
  currentDecorations = editor.deltaDecorations(currentDecorations, tempDecorations);
5706
5707
  });
5707
- currentDecorations = editor.deltaDecorations(currentLineDecoration, []);
5708
+ currentLineDecoration = editor.deltaDecorations(currentLineDecoration, []);
5708
5709
  }
5709
5710
  }
5710
5711
  function setDecorations(decoration) {
5711
5712
  return {
5712
- range: new monaco.Range(decoration.lineNumber, 1, decoration.lineNumber, 1),
5713
+ range: new monaco2.Range(decoration.lineNumber, 1, decoration.lineNumber, 1),
5713
5714
  options: {
5714
5715
  isWholeLine: true,
5715
5716
  className: decoration.customClasses || "",
@@ -5749,7 +5750,7 @@ function useCodeEditor(props, ctx) {
5749
5750
  heightInPx: comment.heightInPx ? comment.heightInPx : 0,
5750
5751
  afterColumn: 1,
5751
5752
  domNode: document.createElement("div"),
5752
- ondomNodeTop: (top) => {
5753
+ onDomNodeTop: (top) => {
5753
5754
  layoutOverlayWidget(comment.lineNumber, { top });
5754
5755
  },
5755
5756
  onComputedHeight: (height) => {
@@ -5772,7 +5773,7 @@ function useCodeEditor(props, ctx) {
5772
5773
  }
5773
5774
  function calculateLayoutInfo(positionInfos, editorLayoutInfo, index2) {
5774
5775
  let _offsetLeft = 0;
5775
- const indexOffsetLeft = comments.value[index2].offserLeft;
5776
+ const indexOffsetLeft = comments.value[index2].offsetLeft;
5776
5777
  if (indexOffsetLeft) {
5777
5778
  _offsetLeft = indexOffsetLeft;
5778
5779
  } else {
@@ -5785,8 +5786,8 @@ function useCodeEditor(props, ctx) {
5785
5786
  offsetLeft: _offsetLeft
5786
5787
  };
5787
5788
  }
5788
- function handleDomNodePosition(top, hieght, index2) {
5789
- comments.value[index2].domNode.style.height = `${hieght}px`;
5789
+ function handleDomNodePosition(top, height, index2) {
5790
+ comments.value[index2].domNode.style.height = `${height}px`;
5790
5791
  if (heightMap.get(index2) === 0) {
5791
5792
  comments.value[index2].domNode.style.top = `-${1e4 + top}px`;
5792
5793
  } else {
@@ -5863,11 +5864,26 @@ var CodeEditor = defineComponent({
5863
5864
  }, null);
5864
5865
  }
5865
5866
  });
5867
+ let monaco;
5868
+ const CodeHighlightDirective = {
5869
+ async mounted(el) {
5870
+ if (inBrowser) {
5871
+ monaco = await import("monaco-editor");
5872
+ monaco.editor.colorizeElement(el);
5873
+ }
5874
+ },
5875
+ updated(el) {
5876
+ if (inBrowser) {
5877
+ monaco.editor.colorizeElement(el);
5878
+ }
5879
+ }
5880
+ };
5866
5881
  var index = {
5867
5882
  title: "Code Editor \u4EE3\u7801\u7F16\u8F91\u5668",
5868
5883
  category: "\u6F14\u8FDB\u4E2D",
5869
5884
  status: "100%",
5870
5885
  install(app) {
5886
+ app.directive("d-code-highlight", CodeHighlightDirective);
5871
5887
  app.component(CodeEditor.name, CodeEditor);
5872
5888
  }
5873
5889
  };