@cmstops/pro-compo 0.3.39 → 0.3.41
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/dist/index.css +74 -0
- package/dist/index.min.css +1 -1
- package/es/contentModal/components/ViewAllColumn/MediaFilter/index.js +45 -51
- package/es/docHistory/component.d.ts +0 -0
- package/es/docHistory/component.js +100 -0
- package/es/docHistory/components/DocDiffPanel/index.d.ts +0 -0
- package/es/docHistory/components/DocDiffPanel/index.js +22 -0
- package/es/docHistory/components/DocHistoryList/index.d.ts +0 -0
- package/es/docHistory/components/DocHistoryList/index.js +37 -0
- package/es/docHistory/index.d.ts +2 -0
- package/es/docHistory/index.js +7 -0
- package/es/docHistory/scripts/diff.d.ts +1 -0
- package/es/docHistory/scripts/diff.js +293 -0
- package/es/docHistory/scripts/useDocHistory.d.ts +10 -0
- package/es/docHistory/scripts/useDocHistory.js +71 -0
- package/es/docHistory/style/css.js +1 -0
- package/es/docHistory/style/docDiffPanel.less +9 -0
- package/es/docHistory/style/docHistoryList.less +58 -0
- package/es/docHistory/style/index.css +74 -0
- package/es/docHistory/style/index.d.ts +1 -0
- package/es/docHistory/style/index.js +1 -0
- package/es/docHistory/style/index.less +28 -0
- package/es/index.css +74 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/index.less +1 -0
- package/lib/contentModal/components/ViewAllColumn/MediaFilter/index.js +44 -50
- package/lib/docHistory/component.js +101 -0
- package/lib/docHistory/components/DocDiffPanel/index.js +23 -0
- package/lib/docHistory/components/DocHistoryList/index.js +38 -0
- package/lib/docHistory/index.js +8 -0
- package/lib/docHistory/scripts/diff.js +295 -0
- package/lib/docHistory/scripts/useDocHistory.js +74 -0
- package/lib/docHistory/style/css.js +2 -0
- package/lib/docHistory/style/docDiffPanel.less +9 -0
- package/lib/docHistory/style/docHistoryList.less +58 -0
- package/lib/docHistory/style/index.css +74 -0
- package/lib/docHistory/style/index.js +2 -0
- package/lib/docHistory/style/index.less +28 -0
- package/lib/index.css +74 -0
- package/lib/index.js +2 -0
- package/lib/index.less +1 -0
- package/package.json +7 -5
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createVNode, unref, withCtx,
|
|
1
|
+
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, createElementVNode, toDisplayString, createBlock, withDirectives, createTextVNode, vShow } from "vue";
|
|
2
2
|
import { Space, Input, Select, Option, Tooltip, Button } from "@arco-design/web-vue";
|
|
3
3
|
import { IconInfoCircle, IconRefresh } from "@arco-design/web-vue/es/icon";
|
|
4
4
|
import { docSeries, docThumbMap } from "../../../../utils/doc.js";
|
|
5
5
|
import _sfc_main$1 from "../columnTree/index.js";
|
|
6
6
|
const _hoisted_1 = { class: "media-filter-container" };
|
|
7
7
|
const _hoisted_2 = { style: { "display": "flex", "align-items": "center", "gap": "5px" } };
|
|
8
|
-
const _hoisted_3 =
|
|
9
|
-
const _hoisted_4 = { style: { "display": "flex", "align-items": "center", "gap": "5px" } };
|
|
10
|
-
const _hoisted_5 = /* @__PURE__ */ createElementVNode("span", null, "\u6A21\u7CCA\u641C", -1);
|
|
11
|
-
const _hoisted_6 = { class: "sort-button" };
|
|
8
|
+
const _hoisted_3 = { class: "sort-button" };
|
|
12
9
|
const _sfc_main = defineComponent({
|
|
13
10
|
...{ name: "MediaFilter" },
|
|
14
11
|
__name: "index",
|
|
@@ -23,7 +20,7 @@ const _sfc_main = defineComponent({
|
|
|
23
20
|
emits: ["update:group_id", "search"],
|
|
24
21
|
setup(__props, { emit: __emit }) {
|
|
25
22
|
const props = __props;
|
|
26
|
-
const column_id = ref(
|
|
23
|
+
const column_id = ref("all");
|
|
27
24
|
const emit = __emit;
|
|
28
25
|
const filter = ref({
|
|
29
26
|
keywords: "",
|
|
@@ -34,6 +31,18 @@ const _sfc_main = defineComponent({
|
|
|
34
31
|
order: "create_time",
|
|
35
32
|
wordState: "precision"
|
|
36
33
|
});
|
|
34
|
+
const wordStateOptions = [
|
|
35
|
+
{
|
|
36
|
+
value: "precision",
|
|
37
|
+
label: "\u7CBE\u51C6\u641C",
|
|
38
|
+
desc: "\u4F1A\u4EE5\u8F93\u5165\u7684\u5B8C\u6574\u5173\u952E\u8BCD\u201C\u6210\u957F\u201D\u8FDB\u884C\u641C\u7D22\uFF0C\u641C\u7D22\u7ED3\u679C\u5173\u8054\u6027\u66F4\u9AD8\uFF0C\u4F46\u641C\u7D22\u7ED3\u679C\u66F4\u5C11"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: "blur",
|
|
42
|
+
label: "\u6A21\u7CCA\u641C",
|
|
43
|
+
desc: "\u4F1A\u5C06\u8F93\u5165\u5185\u5BB9\u5206\u8BCD\uFF0C\u4F8B\u5982\u201C\u6210\u957F\u201D\u4F1A\u5206\u4E3A\u201C\u6210\u201D\u3001\u201C\u957F\u201D\u3001\u201C\u6210\u957F\u201D\uFF0C\u5185\u5BB9\u5305\u542B\u4E09\u4E2A\u8BCD\u4E2D\u4EFB\u610F\u4E00\u4E2A\u5747\u4F1A\u663E\u793A\u51FA\u6765\uFF0C\u641C\u7D22\u5185\u5BB9\u66F4\u52A0\u4E30\u5BCC"
|
|
44
|
+
}
|
|
45
|
+
];
|
|
37
46
|
const bannerOptions = computed(() => {
|
|
38
47
|
const options = [
|
|
39
48
|
{
|
|
@@ -91,22 +100,24 @@ const _sfc_main = defineComponent({
|
|
|
91
100
|
return filter.value.keywords || series || filter.value.cover_type || banner || filter.value.sort !== -1;
|
|
92
101
|
});
|
|
93
102
|
const reset = () => {
|
|
94
|
-
|
|
103
|
+
const _set = {
|
|
95
104
|
keywords: "",
|
|
96
105
|
cover_type: "",
|
|
97
106
|
sort: -1,
|
|
98
107
|
order: "create_time"
|
|
99
108
|
};
|
|
109
|
+
Object.assign(filter.value, _set);
|
|
100
110
|
if (props.banner !== "all") {
|
|
101
111
|
filter.value.banner = props.banner;
|
|
102
112
|
} else {
|
|
103
113
|
filter.value.banner = "";
|
|
104
114
|
}
|
|
105
|
-
if (props.series !== "all") {
|
|
115
|
+
if (props.series !== "all" && props.series.split(",").length === 1) {
|
|
106
116
|
filter.value.type = props.series;
|
|
107
117
|
} else {
|
|
108
118
|
filter.value.type = "";
|
|
109
119
|
}
|
|
120
|
+
column_id.value = "all";
|
|
110
121
|
};
|
|
111
122
|
const checkout = (type) => {
|
|
112
123
|
filter.value.wordState = type;
|
|
@@ -156,6 +167,7 @@ const _sfc_main = defineComponent({
|
|
|
156
167
|
"allow-clear": "",
|
|
157
168
|
class: "filter-item keyword",
|
|
158
169
|
placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9\u6807\u9898",
|
|
170
|
+
style: { width: "240px" },
|
|
159
171
|
onPressEnter: handleSearch
|
|
160
172
|
}, {
|
|
161
173
|
prepend: withCtx(() => [
|
|
@@ -166,48 +178,30 @@ const _sfc_main = defineComponent({
|
|
|
166
178
|
onSelect: checkout
|
|
167
179
|
}, {
|
|
168
180
|
default: withCtx(() => [
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
value
|
|
192
|
-
|
|
193
|
-
}, {
|
|
194
|
-
default: withCtx(() => [
|
|
195
|
-
createElementVNode("div", _hoisted_4, [
|
|
196
|
-
_hoisted_5,
|
|
197
|
-
createVNode(unref(Tooltip), {
|
|
198
|
-
effect: "dark",
|
|
199
|
-
content: "\u4F1A\u5C06\u8F93\u5165\u5185\u5BB9\u5206\u8BCD\uFF0C\u4F8B\u5982\u201C\u6210\u957F\u201D\u4F1A\u5206\u4E3A\u201C\u6210\u201D\u3001\u201C\u957F\u201D\u3001\u201C\u6210\u957F\u201D\uFF0C\u5185\u5BB9\u5305\u542B\u4E09\u4E2A\u8BCD\u4E2D\u4EFB\u610F\u4E00\u4E2A\u5747\u4F1A\u663E\u793A\u51FA\u6765\uFF0C\u641C\u7D22\u5185\u5BB9\u66F4\u52A0\u4E30\u5BCC",
|
|
200
|
-
position: "right"
|
|
201
|
-
}, {
|
|
202
|
-
default: withCtx(() => [
|
|
203
|
-
createVNode(unref(IconInfoCircle))
|
|
204
|
-
]),
|
|
205
|
-
_: 1
|
|
206
|
-
})
|
|
207
|
-
])
|
|
208
|
-
]),
|
|
209
|
-
_: 1
|
|
210
|
-
})
|
|
181
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(wordStateOptions, (item, index) => {
|
|
182
|
+
return createVNode(unref(Option), {
|
|
183
|
+
key: index,
|
|
184
|
+
value: item.value,
|
|
185
|
+
label: item.label
|
|
186
|
+
}, {
|
|
187
|
+
default: withCtx(() => [
|
|
188
|
+
createElementVNode("div", _hoisted_2, [
|
|
189
|
+
createElementVNode("span", null, toDisplayString(item.label), 1),
|
|
190
|
+
createVNode(unref(Tooltip), {
|
|
191
|
+
effect: "dark",
|
|
192
|
+
content: item.desc,
|
|
193
|
+
position: "right"
|
|
194
|
+
}, {
|
|
195
|
+
default: withCtx(() => [
|
|
196
|
+
createVNode(unref(IconInfoCircle))
|
|
197
|
+
]),
|
|
198
|
+
_: 2
|
|
199
|
+
}, 1032, ["content"])
|
|
200
|
+
])
|
|
201
|
+
]),
|
|
202
|
+
_: 2
|
|
203
|
+
}, 1032, ["value", "label"]);
|
|
204
|
+
}), 64))
|
|
211
205
|
]),
|
|
212
206
|
_: 1
|
|
213
207
|
}, 8, ["modelValue"])
|
|
@@ -299,7 +293,7 @@ const _sfc_main = defineComponent({
|
|
|
299
293
|
]),
|
|
300
294
|
_: 1
|
|
301
295
|
}),
|
|
302
|
-
createElementVNode("div",
|
|
296
|
+
createElementVNode("div", _hoisted_3, [
|
|
303
297
|
createVNode(unref(Select), {
|
|
304
298
|
modelValue: filter.value.order,
|
|
305
299
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => filter.value.order = $event),
|
|
File without changes
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineComponent, computed, onMounted, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createCommentVNode } from "vue";
|
|
2
|
+
import { Drawer, Spin, Scrollbar } from "@arco-design/web-vue";
|
|
3
|
+
import { DEFAULT_BASE_API } from "../config.js";
|
|
4
|
+
import { useDocHistory } from "./scripts/useDocHistory.js";
|
|
5
|
+
import _sfc_main$2 from "./components/DocHistoryList/index.js";
|
|
6
|
+
import _sfc_main$1 from "./components/DocDiffPanel/index.js";
|
|
7
|
+
const _hoisted_1 = { class: "doc-history-wrap" };
|
|
8
|
+
const _hoisted_2 = { class: "doc-diff-panel" };
|
|
9
|
+
const _hoisted_3 = { class: "doc-history-list" };
|
|
10
|
+
const _sfc_main = defineComponent({
|
|
11
|
+
...{ name: "docHistory" },
|
|
12
|
+
__name: "component",
|
|
13
|
+
props: {
|
|
14
|
+
BASE_API: {},
|
|
15
|
+
visible: { type: Boolean },
|
|
16
|
+
docInfo: {},
|
|
17
|
+
pub: { type: Boolean }
|
|
18
|
+
},
|
|
19
|
+
emits: ["update:visible"],
|
|
20
|
+
setup(__props, { emit: __emit }) {
|
|
21
|
+
const props = __props;
|
|
22
|
+
const emits = __emit;
|
|
23
|
+
const vis = computed({
|
|
24
|
+
get: () => props.visible,
|
|
25
|
+
set: (val) => {
|
|
26
|
+
emits("update:visible", val);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const BASE_API = props.BASE_API || DEFAULT_BASE_API;
|
|
30
|
+
const {
|
|
31
|
+
initParams,
|
|
32
|
+
loadData,
|
|
33
|
+
handleSelect,
|
|
34
|
+
loading,
|
|
35
|
+
diffContent,
|
|
36
|
+
list,
|
|
37
|
+
current
|
|
38
|
+
} = useDocHistory(BASE_API);
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
if (!props.docInfo)
|
|
41
|
+
return;
|
|
42
|
+
initParams(props.docInfo.id, props.pub);
|
|
43
|
+
loadData();
|
|
44
|
+
});
|
|
45
|
+
return (_ctx, _cache) => {
|
|
46
|
+
return openBlock(), createBlock(unref(Drawer), {
|
|
47
|
+
visible: vis.value,
|
|
48
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => vis.value = $event),
|
|
49
|
+
class: "doc-history-drawer",
|
|
50
|
+
title: "\u7248\u672C\u8BB0\u5F55",
|
|
51
|
+
width: 1e3,
|
|
52
|
+
footer: false
|
|
53
|
+
}, {
|
|
54
|
+
default: withCtx(() => [
|
|
55
|
+
createElementVNode("div", _hoisted_1, [
|
|
56
|
+
createElementVNode("div", _hoisted_2, [
|
|
57
|
+
createVNode(unref(Spin), {
|
|
58
|
+
loading: unref(loading),
|
|
59
|
+
style: { "height": "100%", "width": "100%" }
|
|
60
|
+
}, {
|
|
61
|
+
default: withCtx(() => [
|
|
62
|
+
createVNode(unref(Scrollbar), {
|
|
63
|
+
"outer-style": { height: "100%" },
|
|
64
|
+
style: { "height": "100%", "overflow": "auto" }
|
|
65
|
+
}, {
|
|
66
|
+
default: withCtx(() => [
|
|
67
|
+
unref(diffContent) ? (openBlock(), createBlock(_sfc_main$1, {
|
|
68
|
+
key: 0,
|
|
69
|
+
doc: unref(diffContent)
|
|
70
|
+
}, null, 8, ["doc"])) : createCommentVNode("v-if", true)
|
|
71
|
+
]),
|
|
72
|
+
_: 1
|
|
73
|
+
})
|
|
74
|
+
]),
|
|
75
|
+
_: 1
|
|
76
|
+
}, 8, ["loading"])
|
|
77
|
+
]),
|
|
78
|
+
createElementVNode("div", _hoisted_3, [
|
|
79
|
+
createVNode(unref(Scrollbar), {
|
|
80
|
+
"outer-style": { height: "100%" },
|
|
81
|
+
style: { "height": "100%", "overflow": "auto" }
|
|
82
|
+
}, {
|
|
83
|
+
default: withCtx(() => [
|
|
84
|
+
createVNode(_sfc_main$2, {
|
|
85
|
+
list: unref(list),
|
|
86
|
+
current: unref(current),
|
|
87
|
+
onSelect: unref(handleSelect)
|
|
88
|
+
}, null, 8, ["list", "current", "onSelect"])
|
|
89
|
+
]),
|
|
90
|
+
_: 1
|
|
91
|
+
})
|
|
92
|
+
])
|
|
93
|
+
])
|
|
94
|
+
]),
|
|
95
|
+
_: 1
|
|
96
|
+
}, 8, ["visible"]);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
export { _sfc_main as default };
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString } from "vue";
|
|
2
|
+
const _hoisted_1 = { class: "doc-diff-panel-wrap" };
|
|
3
|
+
const _hoisted_2 = { class: "doc-title" };
|
|
4
|
+
const _hoisted_3 = ["innerHTML"];
|
|
5
|
+
const _sfc_main = defineComponent({
|
|
6
|
+
__name: "index",
|
|
7
|
+
props: {
|
|
8
|
+
doc: {}
|
|
9
|
+
},
|
|
10
|
+
setup(__props) {
|
|
11
|
+
return (_ctx, _cache) => {
|
|
12
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
13
|
+
createElementVNode("div", _hoisted_2, toDisplayString(_ctx.doc.title), 1),
|
|
14
|
+
createElementVNode("div", {
|
|
15
|
+
class: "doc-content",
|
|
16
|
+
innerHTML: _ctx.doc.content
|
|
17
|
+
}, null, 8, _hoisted_3)
|
|
18
|
+
]);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export { _sfc_main as default };
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, unref, createCommentVNode } from "vue";
|
|
2
|
+
import { timeFormat } from "../../../utils/index.js";
|
|
3
|
+
const _hoisted_1 = { class: "doc-history-list-wrap" };
|
|
4
|
+
const _hoisted_2 = ["onClick"];
|
|
5
|
+
const _hoisted_3 = { class: "update-time" };
|
|
6
|
+
const _hoisted_4 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "tips"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_5 = { class: "doc-author" };
|
|
11
|
+
const _sfc_main = defineComponent({
|
|
12
|
+
__name: "index",
|
|
13
|
+
props: {
|
|
14
|
+
list: {},
|
|
15
|
+
current: {}
|
|
16
|
+
},
|
|
17
|
+
emits: ["select"],
|
|
18
|
+
setup(__props, { emit: __emit }) {
|
|
19
|
+
const emits = __emit;
|
|
20
|
+
return (_ctx, _cache) => {
|
|
21
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
22
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item, idx) => {
|
|
23
|
+
return openBlock(), createElementBlock("div", {
|
|
24
|
+
key: item,
|
|
25
|
+
class: normalizeClass(["doc-history-item", { active: idx === _ctx.current }]),
|
|
26
|
+
onClick: ($event) => emits("select", idx)
|
|
27
|
+
}, [
|
|
28
|
+
createElementVNode("div", _hoisted_3, toDisplayString(unref(timeFormat)(item.update_time)), 1),
|
|
29
|
+
idx === 0 ? (openBlock(), createElementBlock("div", _hoisted_4, " \u6700\u8FD1\u66F4\u65B0")) : createCommentVNode("v-if", true),
|
|
30
|
+
createElementVNode("div", _hoisted_5, toDisplayString(item.author), 1)
|
|
31
|
+
], 10, _hoisted_2);
|
|
32
|
+
}), 128))
|
|
33
|
+
]);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CompareById2(leftNode: HTMLElement, rightNode: HTMLElement): string;
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { diffChars } from "diff";
|
|
2
|
+
function GetAllTextNodes(parent) {
|
|
3
|
+
let nodesList = [];
|
|
4
|
+
const layer = parent.childNodes;
|
|
5
|
+
const childNum = layer.length;
|
|
6
|
+
for (let i = 0; i < childNum; i++) {
|
|
7
|
+
const childNode = layer[i];
|
|
8
|
+
const noteType = childNode.nodeType;
|
|
9
|
+
if (noteType === 3 && Trim(childNode.data).length !== 0) {
|
|
10
|
+
nodesList[nodesList.length] = childNode;
|
|
11
|
+
}
|
|
12
|
+
if (noteType === 1) {
|
|
13
|
+
nodesList = nodesList.concat(GetAllTextNodes(childNode));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return nodesList;
|
|
17
|
+
}
|
|
18
|
+
function CompareById2(leftNode, rightNode) {
|
|
19
|
+
const lftList = GetAllTextNodes(leftNode);
|
|
20
|
+
const rhtList = GetAllTextNodes(rightNode);
|
|
21
|
+
CompareNodes(lftList, rhtList);
|
|
22
|
+
return leftNode.innerHTML;
|
|
23
|
+
}
|
|
24
|
+
function Equal(v_node1, v_node2) {
|
|
25
|
+
if (v_node1.data === v_node2.data)
|
|
26
|
+
return true;
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
function CompareText(v_LeftList, v_RightList, lftPNode = null) {
|
|
30
|
+
const leftLen = v_LeftList.length;
|
|
31
|
+
const rightLen = v_RightList.length;
|
|
32
|
+
if (rightLen === leftLen && rightLen === 1) {
|
|
33
|
+
if (v_LeftList[0].data.length === v_RightList[0].data.length && v_RightList[0].data.length === 1)
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (leftLen === 0) {
|
|
37
|
+
let rightFather = null;
|
|
38
|
+
for (let i = 0; i < rightLen; i++) {
|
|
39
|
+
if (!rightFather)
|
|
40
|
+
rightFather = v_RightList[i].parentNode;
|
|
41
|
+
const node = v_RightList[i].clone(true);
|
|
42
|
+
try {
|
|
43
|
+
rightFather.removeChild(v_RightList[i]);
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.log(e);
|
|
46
|
+
}
|
|
47
|
+
if (lftPNode)
|
|
48
|
+
lftPNode.appendChild(node);
|
|
49
|
+
PaintRemove(node);
|
|
50
|
+
}
|
|
51
|
+
} else if (rightLen === 0) {
|
|
52
|
+
for (let i = 0; i < leftLen; i++)
|
|
53
|
+
PaintAdd(v_LeftList[i]);
|
|
54
|
+
} else {
|
|
55
|
+
const LeftTextList = GetCharList(v_LeftList);
|
|
56
|
+
const RightTextList = GetCharList(v_RightList);
|
|
57
|
+
const diff = diffChars(RightTextList.join(""), LeftTextList.join(""));
|
|
58
|
+
let leftFather = null;
|
|
59
|
+
for (let i = 0; i < v_LeftList.length; i++) {
|
|
60
|
+
if (!leftFather)
|
|
61
|
+
leftFather = v_LeftList[i].parentNode;
|
|
62
|
+
try {
|
|
63
|
+
leftFather.removeChild(v_LeftList[i]);
|
|
64
|
+
} catch (e) {
|
|
65
|
+
console.log(e);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
diff.forEach((item) => {
|
|
69
|
+
if (item.added) {
|
|
70
|
+
const addNode = document.createTextNode(item.value);
|
|
71
|
+
leftFather.appendChild(addNode);
|
|
72
|
+
PaintAdd(addNode);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (item.removed) {
|
|
76
|
+
const removeNode = document.createTextNode(item.value);
|
|
77
|
+
leftFather.appendChild(removeNode);
|
|
78
|
+
PaintRemove(removeNode);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const changeNode = document.createTextNode(item.value);
|
|
82
|
+
leftFather.appendChild(changeNode);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function GetCharList(v_nodeList) {
|
|
87
|
+
const CharList = [];
|
|
88
|
+
for (let i = 0; i < v_nodeList.length; i++) {
|
|
89
|
+
const text = v_nodeList[i].data;
|
|
90
|
+
for (let j = 0; j < text.length; j++) {
|
|
91
|
+
CharList[CharList.length] = text.charAt(j);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return CharList;
|
|
95
|
+
}
|
|
96
|
+
function PaintAdd(vNode) {
|
|
97
|
+
const nNode = document.createElement("span");
|
|
98
|
+
nNode.style.background = "#d3fadc";
|
|
99
|
+
const c = vNode.cloneNode(true);
|
|
100
|
+
nNode.appendChild(c);
|
|
101
|
+
const f = vNode.parentNode;
|
|
102
|
+
f.replaceChild(nNode, vNode);
|
|
103
|
+
vNode = c;
|
|
104
|
+
return vNode;
|
|
105
|
+
}
|
|
106
|
+
function PaintRemove(vNode) {
|
|
107
|
+
const nNode = document.createElement("span");
|
|
108
|
+
nNode.style.textDecoration = "line-through";
|
|
109
|
+
nNode.style.background = "#f7cfd3";
|
|
110
|
+
const c = vNode.cloneNode(true);
|
|
111
|
+
nNode.appendChild(c);
|
|
112
|
+
const f = vNode.parentNode;
|
|
113
|
+
f.replaceChild(nNode, vNode);
|
|
114
|
+
vNode = c;
|
|
115
|
+
return vNode;
|
|
116
|
+
}
|
|
117
|
+
function GetNodeList(v_nodesList, v_begin, v_len) {
|
|
118
|
+
const List = [];
|
|
119
|
+
for (let j = 0; j < v_len; j++) {
|
|
120
|
+
List[j] = v_nodesList[v_begin + j];
|
|
121
|
+
}
|
|
122
|
+
return List;
|
|
123
|
+
}
|
|
124
|
+
function LTrim(s) {
|
|
125
|
+
return s.replace(/^\s*/, "");
|
|
126
|
+
}
|
|
127
|
+
function RTrim(s) {
|
|
128
|
+
return s.replace(/\s*$/, "");
|
|
129
|
+
}
|
|
130
|
+
function Trim(s) {
|
|
131
|
+
return RTrim(LTrim(s));
|
|
132
|
+
}
|
|
133
|
+
function CompareNodes(v_LeftNodesList, v_RightNodesList) {
|
|
134
|
+
let PreRightIndex = -1;
|
|
135
|
+
let PreLeftIndex = -1;
|
|
136
|
+
let RightIndex = 0;
|
|
137
|
+
let LeftIndex = 0;
|
|
138
|
+
const nLeftNodesListLen = v_LeftNodesList.length;
|
|
139
|
+
const nRightNodesListLen = v_RightNodesList.length;
|
|
140
|
+
while (LeftIndex <= nLeftNodesListLen || RightIndex <= nRightNodesListLen) {
|
|
141
|
+
const leftFather = LeftIndex === nLeftNodesListLen ? v_LeftNodesList[LeftIndex - 1] : v_LeftNodesList[LeftIndex];
|
|
142
|
+
if (LeftIndex === nLeftNodesListLen) {
|
|
143
|
+
try {
|
|
144
|
+
CompareText(
|
|
145
|
+
GetNodeList(
|
|
146
|
+
v_LeftNodesList,
|
|
147
|
+
PreLeftIndex + 1,
|
|
148
|
+
LeftIndex - PreLeftIndex - 1
|
|
149
|
+
),
|
|
150
|
+
GetNodeList(
|
|
151
|
+
v_RightNodesList,
|
|
152
|
+
PreRightIndex + 1,
|
|
153
|
+
RightIndex - PreRightIndex - 1
|
|
154
|
+
),
|
|
155
|
+
leftFather
|
|
156
|
+
);
|
|
157
|
+
} catch (e) {
|
|
158
|
+
console.log("\u5220\u9664\u6570\u636E\u586B\u5145\u5F02\u5E38");
|
|
159
|
+
throw e;
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
if (RightIndex === nRightNodesListLen) {
|
|
164
|
+
try {
|
|
165
|
+
CompareText(
|
|
166
|
+
GetNodeList(
|
|
167
|
+
v_LeftNodesList,
|
|
168
|
+
PreLeftIndex + 1,
|
|
169
|
+
LeftIndex - PreLeftIndex - 1
|
|
170
|
+
),
|
|
171
|
+
GetNodeList(
|
|
172
|
+
v_RightNodesList,
|
|
173
|
+
PreRightIndex + 1,
|
|
174
|
+
RightIndex - PreRightIndex - 1
|
|
175
|
+
),
|
|
176
|
+
leftFather
|
|
177
|
+
);
|
|
178
|
+
for (let j = LeftIndex; j < nLeftNodesListLen; j++)
|
|
179
|
+
v_RightNodesList[j] = PaintAdd(v_LeftNodesList[j]);
|
|
180
|
+
break;
|
|
181
|
+
} catch (e) {
|
|
182
|
+
console.log("\u65B0\u589E\u6570\u636E\u586B\u5145\u5F02\u5E38");
|
|
183
|
+
throw e;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (Equal(v_LeftNodesList[LeftIndex], v_RightNodesList[RightIndex])) {
|
|
187
|
+
if (v_LeftNodesList[LeftIndex].data.length > 1) {
|
|
188
|
+
try {
|
|
189
|
+
CompareText(
|
|
190
|
+
GetNodeList(
|
|
191
|
+
v_LeftNodesList,
|
|
192
|
+
PreLeftIndex + 1,
|
|
193
|
+
LeftIndex - PreLeftIndex - 1
|
|
194
|
+
),
|
|
195
|
+
GetNodeList(
|
|
196
|
+
v_RightNodesList,
|
|
197
|
+
PreRightIndex + 1,
|
|
198
|
+
RightIndex - PreRightIndex - 1
|
|
199
|
+
),
|
|
200
|
+
leftFather
|
|
201
|
+
);
|
|
202
|
+
} catch (e) {
|
|
203
|
+
console.log("\u76F8\u4F3C\u8282\u70B9\u5BF9\u6BD4\u5F02\u5E38");
|
|
204
|
+
throw e;
|
|
205
|
+
}
|
|
206
|
+
PreLeftIndex = LeftIndex;
|
|
207
|
+
PreRightIndex = RightIndex;
|
|
208
|
+
} else if (v_LeftNodesList[LeftIndex].data.length === 1 && v_LeftNodesList[LeftIndex].data.charCodeAt(0) > 127) {
|
|
209
|
+
PreLeftIndex = LeftIndex;
|
|
210
|
+
PreRightIndex = RightIndex;
|
|
211
|
+
}
|
|
212
|
+
LeftIndex++;
|
|
213
|
+
RightIndex++;
|
|
214
|
+
} else {
|
|
215
|
+
let i = 0;
|
|
216
|
+
for (i = RightIndex + 1; i < nRightNodesListLen; i++) {
|
|
217
|
+
if (Equal(v_LeftNodesList[LeftIndex], v_RightNodesList[i])) {
|
|
218
|
+
if (v_LeftNodesList[LeftIndex].data.length > 1) {
|
|
219
|
+
CompareText(
|
|
220
|
+
GetNodeList(
|
|
221
|
+
v_LeftNodesList,
|
|
222
|
+
PreLeftIndex + 1,
|
|
223
|
+
LeftIndex - PreLeftIndex - 1
|
|
224
|
+
),
|
|
225
|
+
GetNodeList(
|
|
226
|
+
v_RightNodesList,
|
|
227
|
+
PreRightIndex + 1,
|
|
228
|
+
i - PreRightIndex - 1
|
|
229
|
+
),
|
|
230
|
+
leftFather
|
|
231
|
+
);
|
|
232
|
+
PreLeftIndex = LeftIndex;
|
|
233
|
+
PreRightIndex = i;
|
|
234
|
+
LeftIndex++;
|
|
235
|
+
RightIndex = i + 1;
|
|
236
|
+
} else {
|
|
237
|
+
if (v_LeftNodesList[LeftIndex].data.length === 1 && v_LeftNodesList[LeftIndex].data.charCodeAt(0) > 127) {
|
|
238
|
+
PreLeftIndex = LeftIndex;
|
|
239
|
+
PreRightIndex = RightIndex;
|
|
240
|
+
}
|
|
241
|
+
RightIndex++;
|
|
242
|
+
LeftIndex++;
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (i === nRightNodesListLen) {
|
|
248
|
+
i = 0;
|
|
249
|
+
for (i = LeftIndex + 1; i < nLeftNodesListLen; i++) {
|
|
250
|
+
if (Equal(v_RightNodesList[RightIndex], v_LeftNodesList[i])) {
|
|
251
|
+
if (v_LeftNodesList[i].data.length > 1) {
|
|
252
|
+
try {
|
|
253
|
+
CompareText(
|
|
254
|
+
GetNodeList(
|
|
255
|
+
v_LeftNodesList,
|
|
256
|
+
PreLeftIndex + 1,
|
|
257
|
+
i - PreLeftIndex - 1
|
|
258
|
+
),
|
|
259
|
+
GetNodeList(
|
|
260
|
+
v_RightNodesList,
|
|
261
|
+
PreRightIndex + 1,
|
|
262
|
+
RightIndex - PreRightIndex - 1
|
|
263
|
+
),
|
|
264
|
+
leftFather
|
|
265
|
+
);
|
|
266
|
+
} catch (e) {
|
|
267
|
+
console.log("\u975E\u76F8\u4F3C\u8282\u70B9\u5BF9\u6BD4\u5F02\u5E38");
|
|
268
|
+
throw e;
|
|
269
|
+
}
|
|
270
|
+
PreLeftIndex = i;
|
|
271
|
+
PreRightIndex = RightIndex;
|
|
272
|
+
RightIndex++;
|
|
273
|
+
LeftIndex = i + 1;
|
|
274
|
+
} else {
|
|
275
|
+
if (v_LeftNodesList[LeftIndex].data.length === 1 && v_LeftNodesList[LeftIndex].data.charCodeAt(0) > 127) {
|
|
276
|
+
PreLeftIndex = LeftIndex;
|
|
277
|
+
PreRightIndex = RightIndex;
|
|
278
|
+
}
|
|
279
|
+
RightIndex++;
|
|
280
|
+
LeftIndex++;
|
|
281
|
+
}
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (i === nLeftNodesListLen) {
|
|
286
|
+
LeftIndex++;
|
|
287
|
+
RightIndex++;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
export { CompareById2 };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function getDocHistory(BASE_API: string, id: number, pub: boolean): import("axios").AxiosPromise<any>;
|
|
2
|
+
export declare function useDocHistory(BASE_API: string): {
|
|
3
|
+
diffContent: import("vue").Ref<any>;
|
|
4
|
+
current: import("vue").Ref<number>;
|
|
5
|
+
loading: import("vue").Ref<boolean>;
|
|
6
|
+
list: import("vue").Ref<any[]>;
|
|
7
|
+
loadData: () => Promise<void>;
|
|
8
|
+
initParams: (mediaId: number, docPub: boolean) => void;
|
|
9
|
+
handleSelect: (idx: number) => Promise<void>;
|
|
10
|
+
};
|