@cmstops/pro-compo 0.3.39 → 0.3.40
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/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/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
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
var vue = require("vue");
|
|
4
|
+
var request = require("../../utils/request.js");
|
|
5
|
+
var diff = require("./diff.js");
|
|
6
|
+
function getDocHistory(BASE_API, id, pub) {
|
|
7
|
+
return request(BASE_API, {
|
|
8
|
+
url: `/poplar/v2/content/${id}/history?pub=${pub}`,
|
|
9
|
+
method: "get"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function useDocHistory(BASE_API) {
|
|
13
|
+
const list = vue.ref([]);
|
|
14
|
+
const loading = vue.ref(true);
|
|
15
|
+
const current = vue.ref(0);
|
|
16
|
+
const diffContent = vue.ref();
|
|
17
|
+
const id = vue.ref();
|
|
18
|
+
const pub = vue.ref(false);
|
|
19
|
+
function initParams(mediaId, docPub) {
|
|
20
|
+
id.value = mediaId;
|
|
21
|
+
pub.value = docPub;
|
|
22
|
+
}
|
|
23
|
+
async function loadData() {
|
|
24
|
+
if (!id.value)
|
|
25
|
+
return;
|
|
26
|
+
loading.value = true;
|
|
27
|
+
try {
|
|
28
|
+
const { code, message } = await getDocHistory(BASE_API, id.value, pub.value);
|
|
29
|
+
if (code !== 0)
|
|
30
|
+
return;
|
|
31
|
+
list.value = message;
|
|
32
|
+
handleSelect(0);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.log(e);
|
|
35
|
+
} finally {
|
|
36
|
+
loading.value = false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function handleSelect(idx) {
|
|
40
|
+
loading.value = true;
|
|
41
|
+
try {
|
|
42
|
+
current.value = idx;
|
|
43
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
44
|
+
const cur = list.value[idx];
|
|
45
|
+
const prev = list.value[idx + 1];
|
|
46
|
+
const value = JSON.parse(JSON.stringify(cur));
|
|
47
|
+
if (!prev) {
|
|
48
|
+
diffContent.value = value;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const curHtml = document.createElement("div");
|
|
52
|
+
curHtml.innerHTML = cur.content;
|
|
53
|
+
const prevHtml = document.createElement("div");
|
|
54
|
+
prevHtml.innerHTML = prev.content;
|
|
55
|
+
value.content = diff.CompareById2(curHtml, prevHtml);
|
|
56
|
+
diffContent.value = value;
|
|
57
|
+
} catch (e) {
|
|
58
|
+
console.log(e, "diff \u5931\u8D25");
|
|
59
|
+
} finally {
|
|
60
|
+
loading.value = false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
diffContent,
|
|
65
|
+
current,
|
|
66
|
+
loading,
|
|
67
|
+
list,
|
|
68
|
+
loadData,
|
|
69
|
+
initParams,
|
|
70
|
+
handleSelect
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
exports.getDocHistory = getDocHistory;
|
|
74
|
+
exports.useDocHistory = useDocHistory;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
.doc-history-list-wrap {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
border-left: 1px solid var(--color-border-1);
|
|
4
|
+
|
|
5
|
+
// 单条历史记录
|
|
6
|
+
.doc-history-item {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: 5px;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
width: 260px;
|
|
12
|
+
padding: 20px 16px;
|
|
13
|
+
border-bottom: 1px solid var(--color-border-1);
|
|
14
|
+
border-left: 3px solid transparent;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
|
|
17
|
+
.update-time {
|
|
18
|
+
color: var(--color-text-1);
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.tips {
|
|
23
|
+
color: var(--color-text-2);
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.doc-author {
|
|
28
|
+
display: flex;
|
|
29
|
+
gap: 8px;
|
|
30
|
+
align-items: center;
|
|
31
|
+
color: var(--color-text-1);
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
|
|
34
|
+
&::before {
|
|
35
|
+
width: 5px;
|
|
36
|
+
height: 5px;
|
|
37
|
+
background-color: rgb(var(--primary-6));
|
|
38
|
+
border-radius: 50%;
|
|
39
|
+
content: ' ';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 激活/选中状态
|
|
44
|
+
&.active {
|
|
45
|
+
background-color: rgba(var(--primary-6), 0.1);
|
|
46
|
+
border-left-color: rgb(var(--primary-6));
|
|
47
|
+
|
|
48
|
+
.update-time {
|
|
49
|
+
color: rgb(var(--primary-6));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 悬浮
|
|
54
|
+
&:hover {
|
|
55
|
+
background-color: var(--color-fill-1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
.doc-diff-panel-wrap {
|
|
2
|
+
padding: 24px;
|
|
3
|
+
}
|
|
4
|
+
.doc-diff-panel-wrap .doc-title {
|
|
5
|
+
color: var(--color-text-1);
|
|
6
|
+
font-weight: bold;
|
|
7
|
+
font-size: 24px;
|
|
8
|
+
}
|
|
9
|
+
.doc-history-list-wrap {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
border-left: 1px solid var(--color-border-1);
|
|
12
|
+
}
|
|
13
|
+
.doc-history-list-wrap .doc-history-item {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 5px;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
width: 260px;
|
|
19
|
+
padding: 20px 16px;
|
|
20
|
+
border-bottom: 1px solid var(--color-border-1);
|
|
21
|
+
border-left: 3px solid transparent;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
}
|
|
24
|
+
.doc-history-list-wrap .doc-history-item .update-time {
|
|
25
|
+
color: var(--color-text-1);
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
}
|
|
28
|
+
.doc-history-list-wrap .doc-history-item .tips {
|
|
29
|
+
color: var(--color-text-2);
|
|
30
|
+
font-size: 12px;
|
|
31
|
+
}
|
|
32
|
+
.doc-history-list-wrap .doc-history-item .doc-author {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: 8px;
|
|
35
|
+
align-items: center;
|
|
36
|
+
color: var(--color-text-1);
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
}
|
|
39
|
+
.doc-history-list-wrap .doc-history-item .doc-author::before {
|
|
40
|
+
width: 5px;
|
|
41
|
+
height: 5px;
|
|
42
|
+
background-color: rgb(var(--primary-6));
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
content: ' ';
|
|
45
|
+
}
|
|
46
|
+
.doc-history-list-wrap .doc-history-item.active {
|
|
47
|
+
background-color: rgba(var(--primary-6), 0.1);
|
|
48
|
+
border-left-color: rgb(var(--primary-6));
|
|
49
|
+
}
|
|
50
|
+
.doc-history-list-wrap .doc-history-item.active .update-time {
|
|
51
|
+
color: rgb(var(--primary-6));
|
|
52
|
+
}
|
|
53
|
+
.doc-history-list-wrap .doc-history-item:hover {
|
|
54
|
+
background-color: var(--color-fill-1);
|
|
55
|
+
}
|
|
56
|
+
.doc-history-wrap {
|
|
57
|
+
display: flex;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
}
|
|
62
|
+
.doc-history-wrap .doc-diff-panel {
|
|
63
|
+
flex: 1;
|
|
64
|
+
height: 100%;
|
|
65
|
+
}
|
|
66
|
+
.doc-history-wrap .doc-diff-panel .doc-diff-panel-wrap {
|
|
67
|
+
padding: 24px;
|
|
68
|
+
}
|
|
69
|
+
.doc-history-wrap .doc-history-list {
|
|
70
|
+
height: 100%;
|
|
71
|
+
}
|
|
72
|
+
.doc-history-drawer .arco-drawer-body {
|
|
73
|
+
padding: 0;
|
|
74
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@import './docDiffPanel.less';
|
|
2
|
+
@import './docHistoryList.less';
|
|
3
|
+
|
|
4
|
+
.doc-history-wrap {
|
|
5
|
+
display: flex;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
.doc-diff-panel {
|
|
11
|
+
flex: 1;
|
|
12
|
+
height: 100%;
|
|
13
|
+
|
|
14
|
+
.doc-diff-panel-wrap {
|
|
15
|
+
padding: 24px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.doc-history-list {
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.doc-history-drawer {
|
|
25
|
+
.arco-drawer-body {
|
|
26
|
+
padding: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
package/lib/index.css
CHANGED
|
@@ -4672,3 +4672,77 @@
|
|
|
4672
4672
|
font-size: 20px;
|
|
4673
4673
|
cursor: pointer;
|
|
4674
4674
|
}
|
|
4675
|
+
.doc-diff-panel-wrap {
|
|
4676
|
+
padding: 24px;
|
|
4677
|
+
}
|
|
4678
|
+
.doc-diff-panel-wrap .doc-title {
|
|
4679
|
+
color: var(--color-text-1);
|
|
4680
|
+
font-weight: bold;
|
|
4681
|
+
font-size: 24px;
|
|
4682
|
+
}
|
|
4683
|
+
.doc-history-list-wrap {
|
|
4684
|
+
box-sizing: border-box;
|
|
4685
|
+
border-left: 1px solid var(--color-border-1);
|
|
4686
|
+
}
|
|
4687
|
+
.doc-history-list-wrap .doc-history-item {
|
|
4688
|
+
display: flex;
|
|
4689
|
+
flex-direction: column;
|
|
4690
|
+
gap: 5px;
|
|
4691
|
+
box-sizing: border-box;
|
|
4692
|
+
width: 260px;
|
|
4693
|
+
padding: 20px 16px;
|
|
4694
|
+
border-bottom: 1px solid var(--color-border-1);
|
|
4695
|
+
border-left: 3px solid transparent;
|
|
4696
|
+
cursor: pointer;
|
|
4697
|
+
}
|
|
4698
|
+
.doc-history-list-wrap .doc-history-item .update-time {
|
|
4699
|
+
color: var(--color-text-1);
|
|
4700
|
+
font-size: 14px;
|
|
4701
|
+
}
|
|
4702
|
+
.doc-history-list-wrap .doc-history-item .tips {
|
|
4703
|
+
color: var(--color-text-2);
|
|
4704
|
+
font-size: 12px;
|
|
4705
|
+
}
|
|
4706
|
+
.doc-history-list-wrap .doc-history-item .doc-author {
|
|
4707
|
+
display: flex;
|
|
4708
|
+
gap: 8px;
|
|
4709
|
+
align-items: center;
|
|
4710
|
+
color: var(--color-text-1);
|
|
4711
|
+
font-size: 14px;
|
|
4712
|
+
}
|
|
4713
|
+
.doc-history-list-wrap .doc-history-item .doc-author::before {
|
|
4714
|
+
width: 5px;
|
|
4715
|
+
height: 5px;
|
|
4716
|
+
background-color: rgb(var(--primary-6));
|
|
4717
|
+
border-radius: 50%;
|
|
4718
|
+
content: ' ';
|
|
4719
|
+
}
|
|
4720
|
+
.doc-history-list-wrap .doc-history-item.active {
|
|
4721
|
+
background-color: rgba(var(--primary-6), 0.1);
|
|
4722
|
+
border-left-color: rgb(var(--primary-6));
|
|
4723
|
+
}
|
|
4724
|
+
.doc-history-list-wrap .doc-history-item.active .update-time {
|
|
4725
|
+
color: rgb(var(--primary-6));
|
|
4726
|
+
}
|
|
4727
|
+
.doc-history-list-wrap .doc-history-item:hover {
|
|
4728
|
+
background-color: var(--color-fill-1);
|
|
4729
|
+
}
|
|
4730
|
+
.doc-history-wrap {
|
|
4731
|
+
display: flex;
|
|
4732
|
+
width: 100%;
|
|
4733
|
+
height: 100%;
|
|
4734
|
+
overflow: hidden;
|
|
4735
|
+
}
|
|
4736
|
+
.doc-history-wrap .doc-diff-panel {
|
|
4737
|
+
flex: 1;
|
|
4738
|
+
height: 100%;
|
|
4739
|
+
}
|
|
4740
|
+
.doc-history-wrap .doc-diff-panel .doc-diff-panel-wrap {
|
|
4741
|
+
padding: 24px;
|
|
4742
|
+
}
|
|
4743
|
+
.doc-history-wrap .doc-history-list {
|
|
4744
|
+
height: 100%;
|
|
4745
|
+
}
|
|
4746
|
+
.doc-history-drawer .arco-drawer-body {
|
|
4747
|
+
padding: 0;
|
|
4748
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -27,6 +27,7 @@ var index$m = require("./mediaView/index.js");
|
|
|
27
27
|
var index$n = require("./thumbCard/index.js");
|
|
28
28
|
var index$o = require("./selectResourceModal/index.js");
|
|
29
29
|
var index$p = require("./docPreview/index.js");
|
|
30
|
+
var index$q = require("./docHistory/index.js");
|
|
30
31
|
exports["default"] = components;
|
|
31
32
|
exports.appCenter = index;
|
|
32
33
|
exports.messageBox = index$1;
|
|
@@ -54,3 +55,4 @@ exports.mediaView = index$m;
|
|
|
54
55
|
exports.thumbCard = index$n;
|
|
55
56
|
exports.selectResourceModal = index$o;
|
|
56
57
|
exports.docPreview = index$p;
|
|
58
|
+
exports.docHistory = index$q;
|
package/lib/index.less
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmstops/pro-compo",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.40",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
"gif.js": "^0.2.0",
|
|
56
56
|
"tus-js-client": "^3.1.1",
|
|
57
57
|
"vue": "^3.2.0",
|
|
58
|
-
"vuedraggable": "^4.1.0"
|
|
58
|
+
"vuedraggable": "^4.1.0",
|
|
59
|
+
"diff": "^5.2.0"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@arco-design/web-vue": "~2",
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
"@storybook/builder-webpack5": "^6.5.9",
|
|
77
78
|
"@storybook/manager-webpack5": "^6.5.9",
|
|
78
79
|
"@storybook/vue3": "^6.3.0",
|
|
80
|
+
"@types/diff": "^5.2.1",
|
|
79
81
|
"@types/fs-extra": "^9.0.6",
|
|
80
82
|
"@types/jest": "^29.5.5",
|
|
81
83
|
"@types/node": "^20.6.2",
|
|
@@ -117,7 +119,8 @@
|
|
|
117
119
|
"vue": "^3.2.0",
|
|
118
120
|
"vue-loader": "^16.2.0",
|
|
119
121
|
"vuedraggable": "^4.1.0",
|
|
120
|
-
"webpack": "^5.88.2"
|
|
122
|
+
"webpack": "^5.88.2",
|
|
123
|
+
"diff": "^5.2.0"
|
|
121
124
|
},
|
|
122
125
|
"arcoMeta": {
|
|
123
126
|
"type": "vue-library",
|
|
@@ -130,6 +133,5 @@
|
|
|
130
133
|
"es",
|
|
131
134
|
"lib",
|
|
132
135
|
"dist"
|
|
133
|
-
]
|
|
134
|
-
"dependencies": {}
|
|
136
|
+
]
|
|
135
137
|
}
|