@cmstops/pro-compo 0.3.71 → 0.3.73

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 (29) hide show
  1. package/dist/index.css +14 -7
  2. package/dist/index.min.css +1 -1
  3. package/es/index.css +14 -7
  4. package/es/selectResourceModal/component.js +66 -23
  5. package/es/selectResourceModal/components/List/ListVideo/index.js +25 -4
  6. package/es/selectResourceModal/components/List/ListWraper.js +7 -1
  7. package/es/selectResourceModal/scripts/useCompoLf.d.ts +9 -3
  8. package/es/selectResourceModal/scripts/useCompoLf.js +14 -5
  9. package/es/selectResourceModal/scripts/useTabFilter.js +0 -1
  10. package/es/selectResourceModal/style/index.css +1 -1
  11. package/es/selectResourceModal/style/list.less +1 -1
  12. package/es/videoThumb/component.js +28 -27
  13. package/es/videoThumb/scripts/useVideoThumbs.d.ts +4 -0
  14. package/es/videoThumb/scripts/useVideoThumbs.js +28 -1
  15. package/es/videoThumb/style/index.css +13 -6
  16. package/es/videoThumb/style/index.less +14 -6
  17. package/lib/index.css +14 -7
  18. package/lib/selectResourceModal/component.js +65 -22
  19. package/lib/selectResourceModal/components/List/ListVideo/index.js +24 -3
  20. package/lib/selectResourceModal/components/List/ListWraper.js +7 -1
  21. package/lib/selectResourceModal/scripts/useCompoLf.js +14 -5
  22. package/lib/selectResourceModal/scripts/useTabFilter.js +0 -1
  23. package/lib/selectResourceModal/style/index.css +1 -1
  24. package/lib/selectResourceModal/style/list.less +1 -1
  25. package/lib/videoThumb/component.js +27 -26
  26. package/lib/videoThumb/scripts/useVideoThumbs.js +28 -0
  27. package/lib/videoThumb/style/index.css +13 -6
  28. package/lib/videoThumb/style/index.less +14 -6
  29. package/package.json +1 -1
@@ -14,10 +14,6 @@ const _hoisted_3 = {
14
14
  key: 0,
15
15
  class: "resource-select-container"
16
16
  };
17
- const _hoisted_4 = {
18
- key: 0,
19
- class: "footer-right"
20
- };
21
17
  const _sfc_main = vue.defineComponent({
22
18
  ...{ name: "selectResourceModal" },
23
19
  __name: "component",
@@ -38,7 +34,19 @@ const _sfc_main = vue.defineComponent({
38
34
  const emits = __emit;
39
35
  const { selected, selectedKeys, disableSelect, handleSelect, handleClear } = useResourceSelect.useResourceSelect(props);
40
36
  const { activeKey, activeComponent, tabKeyList, handelChangeTab } = useTabFilter(props);
41
- const { wrapProps, close, submit } = useCompoLf(props, emits);
37
+ const { wrapProps, close, submit } = useCompoLf(props, emits, {
38
+ onClose: () => {
39
+ handleClear();
40
+ }
41
+ });
42
+ vue.watch(
43
+ () => props.visible,
44
+ (val) => {
45
+ if (val)
46
+ activeKey.value = tabKeyList.value[0].key;
47
+ },
48
+ { immediate: true }
49
+ );
42
50
  const handleOptions = (options, handleOptions2) => {
43
51
  const { key, item } = options;
44
52
  if (key === "select-one") {
@@ -51,8 +59,15 @@ const _sfc_main = vue.defineComponent({
51
59
  }
52
60
  handleOptions2 && handleOptions2(options);
53
61
  };
54
- function handleConfirm() {
55
- submit(selected.value);
62
+ function confirm(type, meta) {
63
+ let result = JSON.parse(JSON.stringify(selected.value));
64
+ if (meta && typeof meta === "function")
65
+ result = meta();
66
+ if (type === "crop") {
67
+ submit(result, "edit");
68
+ } else {
69
+ submit(result);
70
+ }
56
71
  }
57
72
  return (_ctx, _cache) => {
58
73
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
@@ -68,7 +83,8 @@ const _sfc_main = vue.defineComponent({
68
83
  onClose: vue.unref(close)
69
84
  }, null, 8, ["model-value", "tabList", "onClose"]),
70
85
  vue.createCommentVNode(" \u5217\u8868\u5206\u53D1\u5668 "),
71
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), {
86
+ _ctx.visible ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), {
87
+ key: 0,
72
88
  "active-key": vue.unref(activeKey),
73
89
  onChangeTab: vue.unref(handelChangeTab)
74
90
  }, {
@@ -81,14 +97,32 @@ const _sfc_main = vue.defineComponent({
81
97
  onOptions: (e) => handleOptions(e, onOptions)
82
98
  }, null, 8, ["item", "select-keys", "disable", "onSelect", "onOptions"])
83
99
  ]),
84
- "footer-extra": vue.withCtx(() => [
85
- vue.unref(selected).length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
86
- vue.createVNode(index$1, {
87
- maxcount: _ctx.maxcount,
88
- selected: vue.unref(selected),
89
- onRemove: vue.unref(handleSelect),
90
- onClear: vue.unref(handleClear)
91
- }, null, 8, ["maxcount", "selected", "onRemove", "onClear"]),
100
+ "footer-extra": vue.withCtx(({ type, onConfirm }) => [
101
+ type !== "video" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
102
+ vue.unref(selected).length ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
103
+ vue.createVNode(index$1, {
104
+ maxcount: _ctx.maxcount,
105
+ selected: vue.unref(selected),
106
+ onRemove: vue.unref(handleSelect),
107
+ onClear: vue.unref(handleClear)
108
+ }, null, 8, ["maxcount", "selected", "onRemove", "onClear"]),
109
+ vue.createVNode(vue.unref(webVue.Button), { onClick: vue.unref(close) }, {
110
+ default: vue.withCtx(() => [
111
+ vue.createTextVNode("\u53D6\u6D88")
112
+ ]),
113
+ _: 1
114
+ }, 8, ["onClick"]),
115
+ vue.createVNode(vue.unref(webVue.Button), {
116
+ type: "primary",
117
+ onClick: confirm
118
+ }, {
119
+ default: vue.withCtx(() => [
120
+ vue.createTextVNode(" \u786E\u5B9A ")
121
+ ]),
122
+ _: 1
123
+ })
124
+ ], 64)) : vue.createCommentVNode("v-if", true)
125
+ ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
92
126
  vue.createVNode(vue.unref(webVue.Button), { onClick: vue.unref(close) }, {
93
127
  default: vue.withCtx(() => [
94
128
  vue.createTextVNode("\u53D6\u6D88")
@@ -97,17 +131,26 @@ const _sfc_main = vue.defineComponent({
97
131
  }, 8, ["onClick"]),
98
132
  vue.createVNode(vue.unref(webVue.Button), {
99
133
  type: "primary",
100
- onClick: handleConfirm
134
+ onClick: ($event) => confirm("crop", onConfirm)
101
135
  }, {
102
136
  default: vue.withCtx(() => [
103
- vue.createTextVNode(" \u786E\u5B9A ")
137
+ vue.createTextVNode(" \u88C1\u526A ")
104
138
  ]),
105
- _: 1
106
- })
107
- ])) : vue.createCommentVNode("v-if", true)
139
+ _: 2
140
+ }, 1032, ["onClick"]),
141
+ vue.createVNode(vue.unref(webVue.Button), {
142
+ type: "primary",
143
+ onClick: ($event) => confirm("use", onConfirm)
144
+ }, {
145
+ default: vue.withCtx(() => [
146
+ vue.createTextVNode(" \u4F7F\u7528 ")
147
+ ]),
148
+ _: 2
149
+ }, 1032, ["onClick"])
150
+ ], 64))
108
151
  ]),
109
152
  _: 1
110
- }, 40, ["active-key", "onChangeTab"]))
153
+ }, 40, ["active-key", "onChangeTab"])) : vue.createCommentVNode("v-if", true)
111
154
  ])) : (vue.openBlock(), vue.createBlock(vue.unref(index$2), {
112
155
  key: 1,
113
156
  type: "empty",
@@ -6,13 +6,34 @@ const _sfc_main = vue.defineComponent({
6
6
  __name: "index",
7
7
  setup(__props) {
8
8
  const videoThumbOptions = vue.inject("videoThumbOptions");
9
+ const curSelect = vue.ref("");
10
+ function handlerConfirm() {
11
+ const url = curSelect.value;
12
+ return [
13
+ {
14
+ url,
15
+ alias: url,
16
+ catalog: "image",
17
+ thumb: url
18
+ }
19
+ ];
20
+ }
9
21
  return (_ctx, _cache) => {
10
22
  return vue.openBlock(), vue.createBlock(ListWraper, null, {
11
- "footer-extra": vue.withCtx(() => []),
23
+ "footer-extra": vue.withCtx(() => [
24
+ vue.renderSlot(_ctx.$slots, "footer-extra", {
25
+ type: "video",
26
+ onConfirm: handlerConfirm
27
+ })
28
+ ]),
12
29
  default: vue.withCtx(() => [
13
- vue.unref(videoThumbOptions) ? (vue.openBlock(), vue.createBlock(vue.unref(index), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(videoThumbOptions))), null, 16)) : vue.createCommentVNode("v-if", true)
30
+ vue.unref(videoThumbOptions) ? (vue.openBlock(), vue.createBlock(vue.unref(index), vue.mergeProps({
31
+ key: 0,
32
+ value: curSelect.value,
33
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => curSelect.value = $event)
34
+ }, vue.unref(videoThumbOptions), { offset: 115 }), null, 16, ["value"])) : vue.createCommentVNode("v-if", true)
14
35
  ]),
15
- _: 1
36
+ _: 3
16
37
  });
17
38
  };
18
39
  }
@@ -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
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var vue = require("vue");
3
3
  var config = require("../../config.js");
4
- function useCompoentLifycycle(props, emits) {
4
+ function useCompoentLifycycle(props, emits, handler) {
5
5
  const BASE_API = props.BASE_API || config.DEFAULT_BASE_API;
6
6
  const wrapProps = vue.computed(() => {
7
7
  if (props.wrap === "drawer") {
@@ -9,7 +9,8 @@ function useCompoentLifycycle(props, emits) {
9
9
  class: "resource-select-drawer",
10
10
  header: false,
11
11
  width: "1024px",
12
- footer: false
12
+ footer: false,
13
+ unmountOnClose: true
13
14
  };
14
15
  }
15
16
  return {
@@ -17,7 +18,8 @@ function useCompoentLifycycle(props, emits) {
17
18
  width: "986px",
18
19
  closable: false,
19
20
  hideTitle: false,
20
- footer: false
21
+ footer: false,
22
+ unmountOnClose: true
21
23
  };
22
24
  });
23
25
  vue.provide("baseAPI", BASE_API);
@@ -26,10 +28,17 @@ function useCompoentLifycycle(props, emits) {
26
28
  vue.provide("mediaUseType", vue.computed(() => props.mediaUseType));
27
29
  vue.provide("aiThumbList", vue.computed(() => props.aiThumbList));
28
30
  vue.provide("videoThumbOptions", vue.computed(() => props.videoThumbOptions));
31
+ function close() {
32
+ emits("update:visible", false);
33
+ handler == null ? void 0 : handler.onClose();
34
+ }
29
35
  return {
30
36
  wrapProps,
31
- close: () => emits("update:visible", false),
32
- submit: (data) => emits("submit", JSON.parse(JSON.stringify(data)))
37
+ close,
38
+ submit: (data, ...args) => {
39
+ emits("submit", JSON.parse(JSON.stringify(data)), ...args);
40
+ close();
41
+ }
33
42
  };
34
43
  }
35
44
  module.exports = useCompoentLifycycle;
@@ -27,7 +27,6 @@ function useTabFilter(props) {
27
27
  keys.unshift("ai");
28
28
  if (videoThumbOptions)
29
29
  keys.unshift("video");
30
- [activeKey.value] = keys;
31
30
  return keys.map((key) => ({
32
31
  key,
33
32
  title: TAB_DICT[key].title
@@ -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.73",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vue",