@cmstops/pro-compo 0.3.42 → 0.3.44

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 (37) hide show
  1. package/dist/index.css +38 -2
  2. package/dist/index.min.css +1 -1
  3. package/es/docHistory/component.js +45 -38
  4. package/es/docHistory/scripts/useDocHistory.js +1 -1
  5. package/es/hooks/useAttachement.d.ts +5 -0
  6. package/es/hooks/useLocalStorage.d.ts +8 -0
  7. package/es/hooks/useUpload.d.ts +2 -1
  8. package/es/hooks/useUpload.js +42 -9
  9. package/es/index.css +38 -2
  10. package/es/selectResourceModal/components/ListCardWrapper/index.js +9 -7
  11. package/es/selectResourceModal/components/ListContentLocal/index.js +15 -9
  12. package/es/selectResourceModal/components/ListSelected/index.js +19 -6
  13. package/es/selectResourceModal/components/Main/index.js +1 -1
  14. package/es/selectResourceModal/style/index.css +30 -1
  15. package/es/selectResourceModal/style/listCardWrapper.less +25 -1
  16. package/es/selectResourceModal/style/listSelected.less +9 -0
  17. package/es/thumbCard/component.js +21 -13
  18. package/es/thumbCard/style/index.css +8 -1
  19. package/es/thumbCard/style/index.less +8 -1
  20. package/es/utils/transcodeMedia.d.ts +13 -0
  21. package/es/utils/transcodeMedia.js +46 -0
  22. package/lib/docHistory/component.js +44 -37
  23. package/lib/docHistory/scripts/useDocHistory.js +1 -1
  24. package/lib/hooks/useUpload.js +42 -9
  25. package/lib/index.css +38 -2
  26. package/lib/selectResourceModal/components/ListCardWrapper/index.js +9 -7
  27. package/lib/selectResourceModal/components/ListContentLocal/index.js +14 -8
  28. package/lib/selectResourceModal/components/ListSelected/index.js +18 -5
  29. package/lib/selectResourceModal/components/Main/index.js +1 -1
  30. package/lib/selectResourceModal/style/index.css +30 -1
  31. package/lib/selectResourceModal/style/listCardWrapper.less +25 -1
  32. package/lib/selectResourceModal/style/listSelected.less +9 -0
  33. package/lib/thumbCard/component.js +19 -11
  34. package/lib/thumbCard/style/index.css +8 -1
  35. package/lib/thumbCard/style/index.less +8 -1
  36. package/lib/utils/transcodeMedia.js +49 -0
  37. package/package.json +2 -2
@@ -71,10 +71,18 @@
71
71
  overflow: hidden;
72
72
  }
73
73
  .list-panel-wrapper .list-selected-record .list-selected-item .item-thumb {
74
+ position: relative;
74
75
  width: 50px;
75
76
  height: 38px;
76
77
  overflow: hidden;
77
78
  }
79
+ .list-panel-wrapper .list-selected-record .list-selected-item .item-thumb .item-tag {
80
+ position: absolute;
81
+ top: 50%;
82
+ left: 50%;
83
+ color: white;
84
+ transform: translate(-50%, -50%);
85
+ }
78
86
  .list-panel-wrapper .list-selected-record .list-selected-item .item-alias {
79
87
  flex: 1;
80
88
  overflow: hidden;
@@ -104,13 +112,31 @@
104
112
  .card-wrapper-image {
105
113
  position: relative;
106
114
  overflow: hidden;
107
- cursor: pointer;
108
115
  }
109
116
  .card-wrapper-image .card-wrapper {
110
117
  position: relative;
111
118
  overflow: hidden;
119
+ border-radius: 2px;
120
+ transition: all 0.3s ease-in-out;
112
121
  aspect-ratio: 4 / 3;
113
122
  }
123
+ .card-wrapper-image .card-wrapper.disable:not(.active) {
124
+ opacity: 0.4;
125
+ }
126
+ .card-wrapper-image .card-wrapper .mask {
127
+ position: absolute;
128
+ top: 0;
129
+ z-index: 9;
130
+ display: none;
131
+ width: 100%;
132
+ height: 100%;
133
+ font-size: 18px;
134
+ background: rgba(0, 0, 0, 0.3);
135
+ cursor: pointer;
136
+ }
137
+ .card-wrapper-image .card-wrapper.active .mask {
138
+ display: block;
139
+ }
114
140
  .card-wrapper-image .card-alias {
115
141
  width: 100%;
116
142
  margin-top: 6px;
@@ -120,6 +146,8 @@
120
146
  line-height: 22px;
121
147
  white-space: nowrap;
122
148
  text-overflow: ellipsis;
149
+ user-select: none;
150
+ -webkit-user-drag: none;
123
151
  }
124
152
  .card-wrapper-image:hover .check-box-wrapper .check-box,
125
153
  .card-wrapper-image .check-box-wrapper .check-box.active {
@@ -129,6 +157,7 @@
129
157
  position: absolute;
130
158
  top: 8px;
131
159
  left: 8px;
160
+ z-index: 10;
132
161
  cursor: pointer;
133
162
  }
134
163
  .card-wrapper-image .check-box-wrapper .check-box {
@@ -1,13 +1,34 @@
1
1
  .card-wrapper-image {
2
2
  position: relative;
3
3
  overflow: hidden;
4
- cursor: pointer;
5
4
 
6
5
  .card-wrapper {
7
6
  position: relative;
8
7
  overflow: hidden;
8
+ border-radius: 2px;
9
+ transition: all 0.3s ease-in-out;
9
10
  // 宽高:43
10
11
  aspect-ratio: 4 / 3;
12
+
13
+ &.disable:not(.active) {
14
+ opacity: 0.4;
15
+ }
16
+
17
+ .mask {
18
+ position: absolute;
19
+ top: 0;
20
+ z-index: 9;
21
+ display: none;
22
+ width: 100%;
23
+ height: 100%;
24
+ font-size: 18px;
25
+ background: rgba(0, 0, 0, 0.3);
26
+ cursor: pointer;
27
+ }
28
+
29
+ &.active .mask {
30
+ display: block;
31
+ }
11
32
  }
12
33
 
13
34
  .card-alias {
@@ -19,6 +40,8 @@
19
40
  line-height: 22px;
20
41
  white-space: nowrap;
21
42
  text-overflow: ellipsis;
43
+ user-select: none;
44
+ -webkit-user-drag: none;
22
45
  }
23
46
 
24
47
  &:hover .check-box-wrapper .check-box,
@@ -30,6 +53,7 @@
30
53
  position: absolute;
31
54
  top: 8px;
32
55
  left: 8px;
56
+ z-index: 10;
33
57
  cursor: pointer;
34
58
 
35
59
  .check-box {
@@ -59,9 +59,18 @@
59
59
  overflow: hidden;
60
60
 
61
61
  .item-thumb {
62
+ position: relative;
62
63
  width: 50px;
63
64
  height: 38px;
64
65
  overflow: hidden;
66
+
67
+ .item-tag {
68
+ position: absolute;
69
+ top: 50%;
70
+ left: 50%;
71
+ color: white;
72
+ transform: translate(-50%, -50%);
73
+ }
65
74
  }
66
75
 
67
76
  .item-alias {
@@ -10,9 +10,13 @@ const _hoisted_1 = {
10
10
  key: 0,
11
11
  class: "thumb-upload-loading"
12
12
  };
13
- const _hoisted_2 = { class: "thumb-handler-list" };
14
- const _hoisted_3 = ["onClick"];
15
- const _hoisted_4 = {
13
+ const _hoisted_2 = {
14
+ key: 0,
15
+ class: "thumb-upload-text"
16
+ };
17
+ const _hoisted_3 = { class: "thumb-handler-list" };
18
+ const _hoisted_4 = ["onClick"];
19
+ const _hoisted_5 = {
16
20
  key: 3,
17
21
  class: "thumb-select-tag"
18
22
  };
@@ -40,7 +44,7 @@ const _sfc_main = vue.defineComponent({
40
44
  var _a;
41
45
  return ((_a = props.meta) == null ? void 0 : _a.progress) != null;
42
46
  });
43
- const thumb = vue.computed(() => {
47
+ const realThumb = vue.computed(() => {
44
48
  if (["image", "video"].includes(props.catalog || "")) {
45
49
  return props.thumb || props.url || "";
46
50
  }
@@ -76,7 +80,7 @@ const _sfc_main = vue.defineComponent({
76
80
  emits("edit", { key });
77
81
  }
78
82
  return (_ctx, _cache) => {
79
- var _a, _b;
83
+ var _a, _b, _c;
80
84
  return vue.openBlock(), vue.createElementBlock("div", {
81
85
  class: vue.normalizeClass(["thumb-select-wrapper", classList.value]),
82
86
  style: vue.normalizeStyle(styleObject.value)
@@ -84,8 +88,9 @@ const _sfc_main = vue.defineComponent({
84
88
  isUploading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
85
89
  vue.createVNode(vue.unref(webVue.Progress), {
86
90
  type: "circle",
87
- percent: ((_a = _ctx.meta) == null ? void 0 : _a.progress) / 10
88
- }, null, 8, ["percent"])
91
+ percent: (_a = _ctx.meta) == null ? void 0 : _a.progress
92
+ }, null, 8, ["percent"]),
93
+ ((_b = _ctx.meta) == null ? void 0 : _b.isTrans) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, "\u8F6C\u7801\u4E2D...")) : vue.createCommentVNode("v-if", true)
89
94
  ])) : _ctx.isEdit && !_ctx.url ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
90
95
  vue.createCommentVNode(" \u7F16\u8F91\u6A21\u5F0F\u4E0B\u53EF\u4F7F\u7528\u60AC\u6D6E\u6846\u5FEB\u901F\u63D2\u5165\u7D20\u6750 "),
91
96
  vue.createVNode(vue.unref(webVue.Dropdown), {
@@ -124,20 +129,23 @@ const _sfc_main = vue.defineComponent({
124
129
  _ctx.catalog ? (vue.openBlock(), vue.createBlock(vue.unref(webVue.Image), vue.mergeProps({
125
130
  key: 0,
126
131
  class: "thumb-image",
127
- src: thumb.value
132
+ src: realThumb.value
128
133
  }, aImageAttr.value), null, 16, ["src"])) : vue.createCommentVNode("v-if", true),
129
134
  vue.createCommentVNode(" \u5C55\u793A\u6A21\u5F0F "),
130
- vue.createElementVNode("div", _hoisted_2, [
135
+ vue.createElementVNode("div", _hoisted_3, [
131
136
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.handlersKey, (item) => {
132
137
  return vue.openBlock(), vue.createElementBlock("div", {
133
138
  key: item.key,
134
139
  class: "handler-item",
135
140
  onClick: vue.withModifiers(() => handleOption(item.key), ["stop"])
136
- }, vue.toDisplayString(item.label), 9, _hoisted_3);
141
+ }, vue.toDisplayString(item.label), 9, _hoisted_4);
137
142
  }), 128))
138
143
  ])
139
144
  ], 64)) : vue.createCommentVNode("v-if", true),
140
- ["video", "audio"].includes(_ctx.catalog) && _ctx.meta ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, vue.toDisplayString(vue.unref(index.mediaTime)((_b = _ctx.meta) == null ? void 0 : _b.length)), 1)) : vue.createCommentVNode("v-if", true)
145
+ ["video", "audio"].includes(_ctx.catalog) && _ctx.meta ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
146
+ _ctx.catalog === "video" ? (vue.openBlock(), vue.createBlock(vue.unref(vueCmstopIcons.IconVideoTag), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(vueCmstopIcons.IconAudioTag), { key: 1 })),
147
+ vue.createTextVNode(" " + vue.toDisplayString(vue.unref(index.mediaTime)((_c = _ctx.meta) == null ? void 0 : _c.length)), 1)
148
+ ])) : vue.createCommentVNode("v-if", true)
141
149
  ], 6);
142
150
  };
143
151
  }
@@ -11,6 +11,7 @@
11
11
  }
12
12
  .thumb-select-wrapper .thumb-upload-loading {
13
13
  display: flex;
14
+ flex-direction: column;
14
15
  align-items: center;
15
16
  justify-content: center;
16
17
  width: 100%;
@@ -29,6 +30,8 @@
29
30
  .thumb-select-wrapper .thumb-image img {
30
31
  width: 100%;
31
32
  height: 100%;
33
+ user-select: none;
34
+ -webkit-user-drag: none;
32
35
  }
33
36
  .thumb-select-wrapper .thumb-handler-list {
34
37
  position: absolute;
@@ -68,9 +71,13 @@
68
71
  position: absolute;
69
72
  right: 5px;
70
73
  bottom: 5px;
71
- padding: 2px 10px;
74
+ display: flex;
75
+ gap: 2px;
76
+ align-items: center;
77
+ padding: 2px 5px;
72
78
  color: #fff;
73
79
  font-size: 12px;
80
+ line-height: 14px;
74
81
  background-color: rgba(0, 0, 0, 0.5);
75
82
  border-radius: 16px;
76
83
  opacity: 1;
@@ -13,6 +13,7 @@
13
13
  // loading 模式
14
14
  .thumb-upload-loading {
15
15
  display: flex;
16
+ flex-direction: column;
16
17
  align-items: center;
17
18
  justify-content: center;
18
19
  width: 100%;
@@ -37,6 +38,8 @@
37
38
  img {
38
39
  width: 100%;
39
40
  height: 100%;
41
+ user-select: none;
42
+ -webkit-user-drag: none;
40
43
  }
41
44
  }
42
45
 
@@ -89,9 +92,13 @@
89
92
  position: absolute;
90
93
  right: 5px;
91
94
  bottom: 5px;
92
- padding: 2px 10px;
95
+ display: flex;
96
+ gap: 2px;
97
+ align-items: center;
98
+ padding: 2px 5px;
93
99
  color: #fff;
94
100
  font-size: 12px;
101
+ line-height: 14px;
95
102
  background-color: rgba(0, 0, 0, 0.5);
96
103
  border-radius: 16px;
97
104
  opacity: 1;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ var request = require("./request.js");
4
+ function getTranscodingProgress(BASE_API, id) {
5
+ return request(BASE_API, {
6
+ url: `/poplar/v2/transcoding/progress?id=${id}`,
7
+ method: "get"
8
+ });
9
+ }
10
+ class TranscodingTask {
11
+ constructor(file) {
12
+ this.file = file;
13
+ this.pollCount = 0;
14
+ }
15
+ start(BASE_API, callback) {
16
+ if (!this.file.id)
17
+ return Promise.reject(new Error("file error"));
18
+ return new Promise((resolve, reject) => {
19
+ const handleTranscoding = async () => {
20
+ const { code, message } = await getTranscodingProgress(
21
+ BASE_API,
22
+ this.file.id
23
+ );
24
+ if (code !== 0)
25
+ reject(new Error(message));
26
+ if (message.state === 1) {
27
+ callback(message.progress);
28
+ if (message.progress === 1 && ++this.pollCount === 3) {
29
+ this.abort();
30
+ resolve(false);
31
+ }
32
+ } else if (message.state === 2) {
33
+ this.abort();
34
+ resolve(false);
35
+ } else if (message.state === 3) {
36
+ this.abort();
37
+ resolve(true);
38
+ }
39
+ };
40
+ this.taskInterval = setInterval(handleTranscoding, 5e3);
41
+ });
42
+ }
43
+ abort() {
44
+ clearInterval(this.taskInterval);
45
+ this.taskInterval = null;
46
+ }
47
+ }
48
+ exports.TranscodingTask = TranscodingTask;
49
+ exports.getTranscodingProgress = getTranscodingProgress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmstops/pro-compo",
3
- "version": "0.3.42",
3
+ "version": "0.3.44",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vue",
@@ -60,7 +60,7 @@
60
60
  },
61
61
  "devDependencies": {
62
62
  "@arco-design/web-vue": "~2",
63
- "@arco-iconbox/vue-cmstop-icons": "^0.0.30",
63
+ "@arco-iconbox/vue-cmstop-icons": "^0.0.31",
64
64
  "@babel/core": "^7.14.6",
65
65
  "@babel/plugin-proposal-class-properties": "^7.14.5",
66
66
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",