vue-devui 1.6.21 → 1.6.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-devui",
3
- "version": "1.6.21",
3
+ "version": "1.6.23",
4
4
  "license": "MIT",
5
5
  "description": "DevUI components based on Vite and Vue3",
6
6
  "keywords": [
@@ -55,6 +55,10 @@ export declare const codeReviewProps: {
55
55
  expandLoader: {
56
56
  type: PropType<(interval: Array<number | undefined>, update: (code: string) => void) => void>;
57
57
  };
58
+ options: {
59
+ type: PropType<Record<string, any>>;
60
+ default: () => {};
61
+ };
58
62
  };
59
63
  export type CodeReviewProps = ExtractPropTypes<typeof codeReviewProps>;
60
64
  export interface CodeReviewContext {
@@ -11,6 +11,7 @@ export declare function useCodeReviewComment(reviewContentRef: Ref<HTMLElement>,
11
11
  onMouseleave?: undefined;
12
12
  };
13
13
  updateCheckedLineClass: () => void;
14
+ clearCheckedLines: () => void;
14
15
  onCommentMouseLeave: (e: MouseEvent) => void;
15
16
  onCommentIconClick: (e: Event) => void;
16
17
  onCommentKeyDown: () => void;
@@ -2,5 +2,5 @@ import type { Ref } from 'vue';
2
2
  import type { CodeReviewProps } from '../code-review-types';
3
3
  export declare function useCodeReviewExpand(reviewContentRef: Ref<HTMLElement>, props: CodeReviewProps): {
4
4
  insertExpandButton: () => void;
5
- onExpandButtonClick: (e: Event) => void;
5
+ onExpandButtonClick: (e: Event, options: Record<string, any>) => void;
6
6
  };
@@ -4,7 +4,7 @@ export declare function insertIncrementLineToPage(referenceDom: HTMLElement, trN
4
4
  export declare function ifRemoveExpandLineForDoubleColumn(expandDom: HTMLElement, newExpandDom: HTMLTableRowElement, direction: IncrementCodeInsertDirection): boolean;
5
5
  export declare function ifRemoveExpandLine(expandDom: HTMLElement, newExpandDom: HTMLTableRowElement, direction: IncrementCodeInsertDirection): boolean;
6
6
  export declare function updateExpandLineCount(expandDom: HTMLElement, newExpandDom: HTMLElement): void;
7
- export declare function parseDiffCode(container: HTMLElement, code: string, outputFormat: OutputFormat, isAddCode?: boolean): void;
7
+ export declare function parseDiffCode(container: HTMLElement, code: string, outputFormat: OutputFormat, options: Record<string, any>, isAddCode?: boolean): void;
8
8
  export declare function setLineNumberInDataset(trNode: HTMLElement, prevL: number, prevR: number, nextL: number, nextR: number): void;
9
9
  export declare function updateExpandUpDownButton(trNode: HTMLElement): void;
10
10
  export declare function updateLineNumberInDatasetForDoubleColumn(trNode: HTMLElement, expandThreshold: number, position: 'top' | 'bottom' | 'middle', updateExpandButton?: boolean): boolean;
@@ -5,7 +5,7 @@ export declare const BOLD_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"
5
5
  export declare const ITALIC_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill=\"#293040\">\n <polygon id=\"\u8DEF\u5F84\" points=\"6 15 9 1 6 1 6 0 13 0 13 1 10 1 7 15 10 15 10 16 3 16 3 15\"></polygon>\n </g>\n</g>\n</svg>";
6
6
  export declare const UNDERLINE_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill=\"#293040\">\n <path d=\"M4,0 L4,7 C4,9.209139 5.790861,11 8,11 C10.209139,11 12,9.209139 12,7 L12,0 L13,0 L13,7 C13,9.76142375 10.7614237,12 8,12 C5.23857625,12 3,9.76142375 3,7 L3,0 L4,0 Z M2,14 L14,14 L14,16 L2,16 L2,14 Z\" id=\"\u5F62\u72B6\"></path>\n </g>\n</g>\n</svg>";
7
7
  export declare const STRIKE_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill=\"#293040\">\n <path d=\"M16,8 L16,10 L11.4648712,10 C11.8052114,10.5883467 12,11.2714257 12,12 C12,14.209139 10.209139,16 8,16 C5.790861,16 4,14.209139 4,12 C4,11.6547004 4.043753,11.3196199 4.12601749,11 L5.17070571,11 C5.06015422,11.3127789 5,11.6493646 5,12 C5,13.6568542 6.34314575,15 8,15 C9.65685425,15 11,13.6568542 11,12 C11,11.2316456 10.7111464,10.5307565 10.2361065,10 L0,10 L0,8 L5.3541756,8 C4.52375489,7.26705555 4,6.19469253 4,5 C4,2.790861 5.790861,1 8,1 C10.209139,1 12,2.790861 12,5 C12,5.72857429 11.8052114,6.41165327 11.4648712,7 L10.2361065,7 C10.7111464,6.46924351 11,5.76835444 11,5 C11,3.34314575 9.65685425,2 8,2 C6.34314575,2 5,3.34314575 5,5 C5,6.65685425 6.34314575,8 8,8 L16,8 Z M4.53512878,10 L5.76389349,10 L4.53512878,10 L4.53512878,10 Z\" id=\"\u5F62\u72B6\"></path>\n </g>\n</g>\n</svg>";
8
- export declare const COLOR_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g id=\"edit-icon/background-color\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill=\"#293040\">\n <g>\n <path d=\"M10.4761905,8 L5.52380952,8 L4,12 L3,12 L7.5,-3.84581256e-13 L8.5,-3.84581256e-13 L13,12 L12,12 L10.4761905,8 L10.4761905,8 Z M10.0952381,7 L8,1.5 L5.9047619,7 L10.0952381,7 Z M2,14 L14,14 L14,16 L2,16 L2,14 Z\" id=\"\u5F62\u72B6\"></path>\n </g>\n </g>\n</g>\n</svg>";
8
+ export declare const COLOR_ICON = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.05597 9.5L4.05895 12H2.94092L7.55273 0.776367H8.44716L13.059 12H11.9409L10.9439 9.5H5.05597ZM5.45477 8.5H10.5451L7.99995 2.11801L5.45477 8.5Z\" fill=\"#3B3E55\"/>\n <path d=\"M1 13H15V16H1V13Z\" fill=\"#3B3E55\"/>\n</svg>";
9
9
  export declare const BACKGROUND_COLOR_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g id=\"edit-icon/background-color\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill=\"#293040\">\n <g>\n <path d=\"M10.4761905,8 L5.52380952,8 L4,12 L3,12 L7.5,-3.84581256e-13 L8.5,-3.84581256e-13 L13,12 L12,12 L10.4761905,8 L10.4761905,8 Z M10.0952381,7 L8,1.5 L5.9047619,7 L10.0952381,7 Z M2,14 L14,14 L14,16 L2,16 L2,14 Z\" id=\"\u5F62\u72B6\"></path>\n </g>\n </g>\n</g>\n</svg>";
10
10
  export declare const LIST_UNORDERED_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g id=\"edit-icon/unordered-list\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill=\"#293040\">\n <g>\n <path d=\"M5,1 L16,1 L16,2.5 L5,2.5 L5,1 Z M2,4 C0.8954305,4 0,3.1045695 0,2 C0,0.8954305 0.8954305,0 2,0 C3.1045695,0 4,0.8954305 4,2 C4,3.1045695 3.1045695,4 2,4 Z M2,3 C2.55228475,3 3,2.55228475 3,2 C3,1.44771525 2.55228475,1 2,1 C1.44771525,1 1,1.44771525 1,2 C1,2.55228475 1.44771525,3 2,3 Z M2,10 C0.8954305,10 0,9.1045695 0,8 C0,6.8954305 0.8954305,6 2,6 C3.1045695,6 4,6.8954305 4,8 C4,9.1045695 3.1045695,10 2,10 Z M2,9 C2.55228475,9 3,8.55228475 3,8 C3,7.44771525 2.55228475,7 2,7 C1.44771525,7 1,7.44771525 1,8 C1,8.55228475 1.44771525,9 2,9 Z M2,16 C0.8954305,16 0,15.1045695 0,14 C0,12.8954305 0.8954305,12 2,12 C3.1045695,12 4,12.8954305 4,14 C4,15.1045695 3.1045695,16 2,16 Z M2,15 C2.55228475,15 3,14.5522847 3,14 C3,13.4477153 2.55228475,13 2,13 C1.44771525,13 1,13.4477153 1,14 C1,14.5522847 1.44771525,15 2,15 Z M5,7 L16,7 L16,8.5 L5,8.5 L5,7 Z M5,13 L16,13 L16,14.5 L5,14.5 L5,13 Z\" id=\"\u5F62\u72B6\"></path>\n </g>\n </g>\n</g>\n</svg>";
11
11
  export declare const LIST_ORDERED_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill=\"#293040\">\n <path d=\"M5,1 L16,1 L16,2.5 L5,2.5 L5,1 Z M0,0 L2,0 L2,3 L3,3 L3,4 L0,4 L0,3 L1,3 L1,1 L0,1 L0,0 Z M5,7 L16,7 L16,8.5 L5,8.5 L5,7 Z M5,13 L16,13 L16,14.5 L5,14.5 L5,13 Z M0,15 L1.75,15 C1.88807119,15 2,14.8880712 2,14.75 C2,14.6119288 1.88807119,14.5 1.75,14.5 L0,14.5 L0,13.5 L1.75,13.5 C1.88807119,13.5 2,13.3880712 2,13.25 C2,13.1119288 1.88807119,13 1.75,13 L0,13 L0,12 L1.5,12 C2.32842712,12 3,12.6715729 3,13.5 C3,13.6753177 2.96992289,13.8436105 2.91464715,14 C2.96992289,14.1563895 3,14.3246823 3,14.5 C3,15.3284271 2.32842712,16 1.5,16 L0,16 L0,15 Z M2,7.5 C2,7.35127258 1.9375,7.22627258 1.84375,7.13845444 C1.76307119,7.05596441 1.63807119,7 1.5,7 C1.22385763,7 1,7.22385763 1,7.5 L1.62630326e-19,7.5 C0.147399902,6.5 0.647399902,6 1.5,6 C2.32842712,6 3,6.67157288 3,7.5 C3,8.07312512 2.50016007,8.55650475 2.22821045,8.74661255 C1.95626083,8.93672035 1.77325955,8.99789088 1.76769962,9 L3,9 L3,10 L0,10 L1.62630326e-19,9 C0.619515577,8.77257137 1.06188822,8.55939591 1.32711792,8.36047363 C1.6371448,8.12795347 1.87259637,7.91592701 1.96143498,7.69289356 C1.98627694,7.633537 2,7.5683711 2,7.5 Z\" id=\"\u5F62\u72B6\"></path>\n </g>\n</g>\n</svg>";
package/vue-devui.es.js CHANGED
@@ -17014,6 +17014,10 @@ const codeReviewProps = {
17014
17014
  },
17015
17015
  expandLoader: {
17016
17016
  type: Function
17017
+ },
17018
+ options: {
17019
+ type: Object,
17020
+ default: () => ({})
17017
17021
  }
17018
17022
  };
17019
17023
  const CodeReviewInjectionKey = Symbol("d-code-review");
@@ -17238,14 +17242,15 @@ function addClassToDiffCode(codeStrArr, theClassName) {
17238
17242
  });
17239
17243
  return newArray;
17240
17244
  }
17241
- function parseDiffCode(container, code, outputFormat, isAddCode = false) {
17245
+ function parseDiffCode(container, code, outputFormat, options, isAddCode = false) {
17242
17246
  var _a;
17243
17247
  const diff2HtmlUi = new Diff2HtmlUI(container, code, {
17244
17248
  drawFileList: false,
17245
17249
  matching: "lines",
17246
17250
  outputFormat,
17247
17251
  highlight: true,
17248
- rawTemplates: TemplateMap[outputFormat]
17252
+ rawTemplates: TemplateMap[outputFormat],
17253
+ ...options
17249
17254
  });
17250
17255
  if (outputFormat === "side-by-side") {
17251
17256
  let diffHtmlStr = diff2HtmlUi.diffHtml;
@@ -17550,7 +17555,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
17550
17555
  }
17551
17556
  attachExpandUpDownButton(loadMoreLine.children[0], "down");
17552
17557
  };
17553
- const insertIncrementCodeForDoubleColumn = (code, direction, referenceDom) => {
17558
+ const insertIncrementCodeForDoubleColumn = (code, direction, referenceDom, options) => {
17554
17559
  if (!referenceDom) {
17555
17560
  return;
17556
17561
  }
@@ -17559,7 +17564,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
17559
17564
  }
17560
17565
  const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
17561
17566
  const container = document.createElement("div");
17562
- parseDiffCode(container, prefix + code, outputFormat.value, true);
17567
+ parseDiffCode(container, prefix + code, outputFormat.value, options, true);
17563
17568
  const trNodes = Array.from(container.querySelectorAll("tr"));
17564
17569
  const expandLine = trNodes.find((element) => {
17565
17570
  var _a;
@@ -17633,7 +17638,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
17633
17638
  }
17634
17639
  attachExpandUpDownButton(loadMoreLine.children[0], "down");
17635
17640
  };
17636
- const insertIncrementCode = (code, direction, referenceDom) => {
17641
+ const insertIncrementCode = (code, direction, referenceDom, options) => {
17637
17642
  if (!referenceDom) {
17638
17643
  return;
17639
17644
  }
@@ -17642,7 +17647,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
17642
17647
  }
17643
17648
  const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
17644
17649
  const container = document.createElement("div");
17645
- parseDiffCode(container, prefix + code, outputFormat.value, true);
17650
+ parseDiffCode(container, prefix + code, outputFormat.value, options, true);
17646
17651
  const trNodes = Array.from(container.querySelectorAll("tr"));
17647
17652
  const expandLine = trNodes.find((element) => {
17648
17653
  var _a;
@@ -17672,7 +17677,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
17672
17677
  }
17673
17678
  }
17674
17679
  };
17675
- const onExpandButtonClick = (e) => {
17680
+ const onExpandButtonClick = (e, options) => {
17676
17681
  var _a, _b;
17677
17682
  const composedPath = e.composedPath();
17678
17683
  const expandIconDom = composedPath.find((element) => {
@@ -17685,7 +17690,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
17685
17690
  const [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd] = getLineNumberFromDataset(expandIconDom, expandThreshold.value);
17686
17691
  (_b = expandLoader == null ? void 0 : expandLoader.value) == null ? void 0 : _b.call(expandLoader, [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd], (code) => {
17687
17692
  var _a2, _b2;
17688
- outputFormat.value === "line-by-line" ? insertIncrementCode(code, direction, (_a2 = expandIconDom.parentElement) == null ? void 0 : _a2.parentElement) : insertIncrementCodeForDoubleColumn(code, direction, (_b2 = expandIconDom.parentElement) == null ? void 0 : _b2.parentElement);
17693
+ outputFormat.value === "line-by-line" ? insertIncrementCode(code, direction, (_a2 = expandIconDom.parentElement) == null ? void 0 : _a2.parentElement, options) : insertIncrementCodeForDoubleColumn(code, direction, (_b2 = expandIconDom.parentElement) == null ? void 0 : _b2.parentElement, options);
17689
17694
  });
17690
17695
  }
17691
17696
  };
@@ -17704,14 +17709,14 @@ function useCodeReview(props, ctx2) {
17704
17709
  diffFile.value = Diff2Html.parse(diff.value);
17705
17710
  nextTick(() => {
17706
17711
  if (inBrowser && !showBlob.value) {
17707
- parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value);
17712
+ parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value, props.options);
17708
17713
  allowExpand.value && insertExpandButton();
17709
17714
  ctx2.emit("contentRefresh", JSON.parse(JSON.stringify(diffFile.value)));
17710
17715
  }
17711
17716
  });
17712
17717
  };
17713
17718
  const onContentClick = (e) => {
17714
- onExpandButtonClick(e);
17719
+ onExpandButtonClick(e, props.options);
17715
17720
  };
17716
17721
  watch(showBlob, initDiffContent);
17717
17722
  watch(outputFormat, initDiffContent);
@@ -18029,6 +18034,12 @@ function useCodeReviewComment(reviewContentRef, props, ctx2) {
18029
18034
  }
18030
18035
  }
18031
18036
  };
18037
+ const clearCheckedLines = () => {
18038
+ currentLeftLineNumbers = [];
18039
+ currentRightLineNumbers = [];
18040
+ checkedLineCodeString = [];
18041
+ resetCommentClass();
18042
+ };
18032
18043
  const mouseEvent = allowComment.value ? { onMousemove: onMouseMove, onMouseleave } : {};
18033
18044
  window.addEventListener("scroll", resetLeftTop);
18034
18045
  onUnmounted(() => {
@@ -18039,6 +18050,7 @@ function useCodeReviewComment(reviewContentRef, props, ctx2) {
18039
18050
  commentTop,
18040
18051
  mouseEvent,
18041
18052
  updateCheckedLineClass,
18053
+ clearCheckedLines,
18042
18054
  onCommentMouseLeave,
18043
18055
  onCommentIconClick,
18044
18056
  onCommentKeyDown,
@@ -18077,14 +18089,16 @@ var CodeReview = defineComponent({
18077
18089
  unCommentKeyDown,
18078
18090
  insertComment,
18079
18091
  removeComment,
18080
- updateCheckedLineClass
18092
+ updateCheckedLineClass,
18093
+ clearCheckedLines
18081
18094
  } = useCodeReviewComment(reviewContentRef, props, ctx2);
18082
18095
  onMounted(() => {
18083
18096
  ctx2.emit("afterViewInit", {
18084
18097
  toggleFold,
18085
18098
  insertComment,
18086
18099
  removeComment,
18087
- updateCheckedLineClass
18100
+ updateCheckedLineClass,
18101
+ clearCheckedLines
18088
18102
  });
18089
18103
  onCommentKeyDown();
18090
18104
  });
@@ -34969,14 +34983,9 @@ const STRIKE_ICON = `<svg width="16px" height="16px" viewBox="0 0 16 16">
34969
34983
  </g>
34970
34984
  </g>
34971
34985
  </svg>`;
34972
- const COLOR_ICON = `<svg width="16px" height="16px" viewBox="0 0 16 16">
34973
- <g id="edit-icon/background-color" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
34974
- <g fill="#293040">
34975
- <g>
34976
- <path d="M10.4761905,8 L5.52380952,8 L4,12 L3,12 L7.5,-3.84581256e-13 L8.5,-3.84581256e-13 L13,12 L12,12 L10.4761905,8 L10.4761905,8 Z M10.0952381,7 L8,1.5 L5.9047619,7 L10.0952381,7 Z M2,14 L14,14 L14,16 L2,16 L2,14 Z" id="\u5F62\u72B6"></path>
34977
- </g>
34978
- </g>
34979
- </g>
34986
+ const COLOR_ICON = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
34987
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M5.05597 9.5L4.05895 12H2.94092L7.55273 0.776367H8.44716L13.059 12H11.9409L10.9439 9.5H5.05597ZM5.45477 8.5H10.5451L7.99995 2.11801L5.45477 8.5Z" fill="#3B3E55"/>
34988
+ <path d="M1 13H15V16H1V13Z" fill="#3B3E55"/>
34980
34989
  </svg>`;
34981
34990
  const LIST_UNORDERED_ICON = `<svg width="16px" height="16px" viewBox="0 0 16 16">
34982
34991
  <g id="edit-icon/unordered-list" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
@@ -35247,7 +35256,8 @@ ToolBarHandler.code = (editor) => {
35247
35256
  }
35248
35257
  };
35249
35258
  ToolBarHandler.table = (editor) => {
35250
- const table2 = `| | | |
35259
+ const table2 = `
35260
+ | | | |
35251
35261
  |--|--|--|
35252
35262
  | | | |`;
35253
35263
  editor.replaceSelection(table2);
@@ -54130,7 +54140,7 @@ const installs = [
54130
54140
  VirtualListInstall
54131
54141
  ];
54132
54142
  var vueDevui = {
54133
- version: "1.6.21",
54143
+ version: "1.6.23",
54134
54144
  install(app) {
54135
54145
  installs.forEach((p) => app.use(p));
54136
54146
  }