@cmstops/pro-compo 0.3.71 → 0.3.72

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.
@@ -17,6 +17,10 @@ const _hoisted_5 = {
17
17
  class: "resource-list-content-empty"
18
18
  };
19
19
  const _hoisted_6 = { class: "resource-list-footer" };
20
+ const _hoisted_7 = {
21
+ key: 0,
22
+ class: "footer-right"
23
+ };
20
24
  const _sfc_main = vue.defineComponent({
21
25
  __name: "ListWraper",
22
26
  props: {
@@ -52,7 +56,9 @@ const _sfc_main = vue.defineComponent({
52
56
  ]),
53
57
  vue.createElementVNode("div", _hoisted_6, [
54
58
  vue.renderSlot(_ctx.$slots, "footer"),
55
- vue.renderSlot(_ctx.$slots, "footer-extra")
59
+ _ctx.$slots["footer-extra"] ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
60
+ vue.renderSlot(_ctx.$slots, "footer-extra")
61
+ ])) : vue.createCommentVNode("v-if", true)
56
62
  ])
57
63
  ]);
58
64
  };
@@ -29,7 +29,10 @@ function useCompoentLifycycle(props, emits) {
29
29
  return {
30
30
  wrapProps,
31
31
  close: () => emits("update:visible", false),
32
- submit: (data) => emits("submit", JSON.parse(JSON.stringify(data)))
32
+ submit: (data, ...args) => {
33
+ emits("submit", JSON.parse(JSON.stringify(data)), ...args);
34
+ emits("update:visible", false);
35
+ }
33
36
  };
34
37
  }
35
38
  module.exports = useCompoentLifycycle;
@@ -178,7 +178,7 @@
178
178
  .resource-list-footer {
179
179
  display: flex;
180
180
  justify-content: space-between;
181
- padding-bottom: 10px;
181
+ padding-bottom: 20px;
182
182
  }
183
183
  .resource-list-footer .footer-right {
184
184
  display: flex;
@@ -21,7 +21,7 @@
21
21
  &-footer {
22
22
  display: flex;
23
23
  justify-content: space-between;
24
- padding-bottom: 10px;
24
+ padding-bottom: 20px;
25
25
 
26
26
  .footer-right {
27
27
  display: flex;
@@ -12,10 +12,12 @@ const _sfc_main = vue.defineComponent({
12
12
  __name: "component",
13
13
  props: {
14
14
  BASE_API: {},
15
+ value: {},
15
16
  src: {},
16
- duration: {}
17
+ duration: {},
18
+ offset: {}
17
19
  },
18
- emits: ["select"],
20
+ emits: ["select", "update:value"],
19
21
  setup(__props, { emit: __emit }) {
20
22
  const props = __props;
21
23
  const emit = __emit;
@@ -23,46 +25,44 @@ const _sfc_main = vue.defineComponent({
23
25
  const { thumbs, curThumb, getVideoThumbs, handleSelectThumb } = useVideoThumbs.useVideoThumbs();
24
26
  const videoThumbRef = vue.ref();
25
27
  const videoThumbDrager = vue.ref();
26
- const isDrag = vue.ref(false);
27
28
  const width = vue.computed(() => {
28
29
  if (!videoThumbRef.value)
29
30
  return 0;
30
31
  const rect = videoThumbRef.value.getBoundingClientRect();
31
32
  return parseInt((rect.width / thumbs.value.length).toFixed(0), 10);
32
33
  });
34
+ const startPos = vue.ref(0);
33
35
  function moveDragger(moveX) {
34
36
  if (!videoThumbDrager.value || !videoThumbRef.value)
35
37
  return;
36
38
  const rect = videoThumbRef.value.getBoundingClientRect();
37
- if (moveX < 0 || moveX > rect.width)
39
+ const pos = startPos.value + moveX;
40
+ if (pos < 0 || pos > rect.width - 5)
38
41
  return;
39
- videoThumbDrager.value.style.left = `${moveX}px`;
40
- const index = Math.floor(moveX / width.value);
41
- curThumb.value = thumbs.value[index];
42
+ videoThumbDrager.value.style.left = `${pos}px`;
43
+ const index = Math.floor(pos / width.value);
44
+ curThumb.value = thumbs.value[index < thumbs.value.length ? index : thumbs.value.length - 1];
42
45
  }
43
- const handleMousedown = () => {
44
- isDrag.value = true;
45
- window.onmouseup = handleMouseup;
46
- window.onmousemove = handleMousemove;
47
- };
48
- const handleMouseup = () => {
49
- isDrag.value = false;
50
- window.onmouseup = null;
51
- window.onmousemove = null;
52
- };
53
- const handleMousemove = (e) => {
54
- if (!isDrag.value)
46
+ function upDragger() {
47
+ startPos.value = 0;
48
+ }
49
+ function downDragger() {
50
+ if (!videoThumbDrager.value)
55
51
  return;
56
- const moveX = e.x - 30;
57
- moveDragger(moveX);
58
- };
52
+ const originX = parseInt(videoThumbDrager.value.style.left.replace("px", ""), 10) || 0;
53
+ startPos.value = originX;
54
+ }
59
55
  function handleSelect(idx) {
60
56
  handleSelectThumb(idx);
61
57
  moveDragger(idx * width.value + width.value / 2);
62
58
  }
59
+ const { handleMousedown } = useVideoThumbs.useDragger(moveDragger, upDragger, downDragger);
63
60
  vue.watch(
64
61
  () => curThumb.value,
65
- () => emit("select", curThumb.value),
62
+ () => {
63
+ emit("select", curThumb.value);
64
+ emit("update:value", curThumb.value);
65
+ },
66
66
  { immediate: true }
67
67
  );
68
68
  vue.onMounted(() => {
@@ -79,12 +79,13 @@ const _sfc_main = vue.defineComponent({
79
79
  ref: videoThumbRef,
80
80
  class: "video-thumb-list"
81
81
  }, [
82
- vue.createElementVNode("div", {
82
+ vue.unref(thumbs).length > 0 ? (vue.openBlock(), vue.createElementBlock("div", {
83
+ key: 0,
83
84
  ref_key: "videoThumbDrager",
84
85
  ref: videoThumbDrager,
85
86
  class: "video-thumb-list-drager",
86
- onMousedown: handleMousedown
87
- }, null, 544),
87
+ onMousedown: _cache[0] || (_cache[0] = (...args) => vue.unref(handleMousedown) && vue.unref(handleMousedown)(...args))
88
+ }, null, 544)) : vue.createCommentVNode("v-if", true),
88
89
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(thumbs), (thumb, idx) => {
89
90
  return vue.openBlock(), vue.createElementBlock("div", {
90
91
  key: thumb,
@@ -47,4 +47,32 @@ function useVideoThumbs() {
47
47
  handleSelectThumb
48
48
  };
49
49
  }
50
+ function useDragger(moveCallback, upCallback, downCallback) {
51
+ const x = vue.ref(0);
52
+ const isDrag = vue.ref(false);
53
+ const handleMousedown = (e) => {
54
+ isDrag.value = true;
55
+ x.value = e.x;
56
+ window.onmouseup = handleMouseup;
57
+ window.onmousemove = handleMousemove;
58
+ downCallback && downCallback();
59
+ };
60
+ const handleMouseup = () => {
61
+ isDrag.value = false;
62
+ x.value = 0;
63
+ window.onmouseup = null;
64
+ window.onmousemove = null;
65
+ upCallback && upCallback();
66
+ };
67
+ const handleMousemove = (e) => {
68
+ if (!isDrag.value)
69
+ return;
70
+ moveCallback && moveCallback(e.x - x.value);
71
+ };
72
+ return {
73
+ isDrag,
74
+ handleMousedown
75
+ };
76
+ }
77
+ exports.useDragger = useDragger;
50
78
  exports.useVideoThumbs = useVideoThumbs;
@@ -5,23 +5,25 @@
5
5
  box-sizing: border-box;
6
6
  width: 100%;
7
7
  height: 100%;
8
- padding: 10px;
9
8
  overflow: hidden;
10
9
  }
11
10
  .video-thumb .video-player-container {
12
11
  display: flex;
13
12
  flex: 1;
14
13
  flex-direction: column;
14
+ align-items: center;
15
+ justify-content: center;
15
16
  overflow: hidden;
16
17
  }
17
- .video-thumb .video-player-container video {
18
- height: 100%;
18
+ .video-thumb .video-player-container img {
19
+ max-width: 800px;
20
+ max-height: 100%;
19
21
  }
20
22
  .video-thumb .video-thumb-list {
21
23
  position: relative;
22
24
  display: flex;
23
25
  height: 80px;
24
- padding: 20px 0;
26
+ padding: 10px 0;
25
27
  }
26
28
  .video-thumb .video-thumb-list .video-thumb-list-item {
27
29
  flex: 1;
@@ -40,10 +42,15 @@
40
42
  }
41
43
  .video-thumb .video-thumb-list .video-thumb-list-drager {
42
44
  position: absolute;
43
- top: 20px;
45
+ top: 10px;
44
46
  left: 0;
47
+ z-index: 100;
45
48
  width: 6px;
46
- height: calc(100% - 40px);
49
+ height: calc(100% - 20px);
47
50
  background-color: rgb(var(--primary-5));
48
51
  cursor: pointer;
52
+ transition: transform 0.3s ease-in-out;
53
+ }
54
+ .video-thumb .video-thumb-list .video-thumb-list-drager:hover {
55
+ transform: scale(1.05);
49
56
  }
@@ -5,7 +5,6 @@
5
5
  box-sizing: border-box;
6
6
  width: 100%;
7
7
  height: 100%;
8
- padding: 10px;
9
8
  overflow: hidden;
10
9
 
11
10
  // 播放器
@@ -13,10 +12,13 @@
13
12
  display: flex;
14
13
  flex: 1;
15
14
  flex-direction: column;
15
+ align-items: center;
16
+ justify-content: center;
16
17
  overflow: hidden;
17
18
 
18
- video {
19
- height: 100%;
19
+ img {
20
+ max-width: 800px;
21
+ max-height: 100%;
20
22
  }
21
23
  }
22
24
 
@@ -25,7 +27,7 @@
25
27
  position: relative;
26
28
  display: flex;
27
29
  height: 80px;
28
- padding: 20px 0;
30
+ padding: 10px 0;
29
31
 
30
32
  .video-thumb-list-item {
31
33
  flex: 1;
@@ -50,12 +52,18 @@
50
52
 
51
53
  .video-thumb-list-drager {
52
54
  position: absolute;
53
- top: 20px;
55
+ top: 10px;
54
56
  left: 0;
57
+ z-index: 100;
55
58
  width: 6px;
56
- height: calc(100% - 40px);
59
+ height: calc(100% - 20px);
57
60
  background-color: rgb(var(--primary-5));
58
61
  cursor: pointer;
62
+ transition: transform 0.3s ease-in-out;
63
+
64
+ &:hover {
65
+ transform: scale(1.05);
66
+ }
59
67
  }
60
68
  }
61
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmstops/pro-compo",
3
- "version": "0.3.71",
3
+ "version": "0.3.72",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vue",