@gct-paas/core-web 0.1.4-dev.18 → 0.1.4-dev.19
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.min.css +1 -1
- package/dist/loader.esm.min.js +1 -1
- package/es/components/icon-next/src/IconNextPicker.vue_vue_type_style_index_0_lang.css +3 -0
- package/es/index.d.ts +2 -1
- package/es/index.mjs +10 -2
- package/es/modules/picture-cropper/index.d.ts +6 -0
- package/es/modules/picture-cropper/index.mjs +5 -0
- package/es/modules/{Cropper → picture-cropper}/src/CopperFreeModal.vue.d.ts +2 -3
- package/es/modules/{Cropper → picture-cropper}/src/CopperFreeModal.vue.mjs +3 -3
- package/es/modules/{Cropper → picture-cropper}/src/CopperFreeModal.vue_vue_type_script_setup_true_name_CropperModal_lang.mjs +1 -1
- package/es/modules/{Cropper/src/CopperFreeModal.vue_vue_type_style_index_0_scoped_d24895d3_lang.css → picture-cropper/src/CopperFreeModal.vue_vue_type_style_index_0_scoped_488ed4c7_lang.css} +10 -10
- package/es/modules/{Cropper → picture-cropper}/src/CopperModal.vue.d.ts +2 -3
- package/es/modules/{Cropper → picture-cropper}/src/CopperModal.vue.mjs +3 -3
- package/es/modules/{Cropper → picture-cropper}/src/CopperModal.vue_vue_type_script_setup_true_name_CropperModal_lang.mjs +1 -1
- package/es/modules/{Cropper/src/CopperModal.vue_vue_type_style_index_0_scoped_a65b9ff7_lang.css → picture-cropper/src/CopperModal.vue_vue_type_style_index_0_scoped_ceff5f65_lang.css} +14 -14
- package/es/modules/{Cropper → picture-cropper}/src/Cropper.vue.mjs +1 -1
- package/es/modules/{Cropper → picture-cropper}/src/Cropper.vue_vue_type_script_lang.mjs +1 -1
- package/es/modules/{Cropper → picture-cropper}/src/CropperAvatar.vue.d.ts +2 -3
- package/es/modules/{Cropper → picture-cropper}/src/CropperAvatar.vue.mjs +3 -3
- package/es/modules/{Cropper → picture-cropper}/src/CropperAvatar.vue_vue_type_script_setup_true_name_CropperAvatar_lang.mjs +10 -9
- package/es/modules/{Cropper/src/CropperAvatar.vue_vue_type_style_index_0_scoped_683cf5bb_lang.css → picture-cropper/src/CropperAvatar.vue_vue_type_style_index_0_scoped_af219c4c_lang.css} +7 -7
- package/es/modules/{Cropper → picture-cropper}/src/CropperFree.vue.d.ts +2 -3
- package/es/modules/{Cropper → picture-cropper}/src/CropperFree.vue.mjs +3 -3
- package/es/modules/{Cropper → picture-cropper}/src/CropperFree.vue_vue_type_script_setup_true_name_CropperPhoto_lang.mjs +22 -17
- package/es/modules/{Cropper/src/CropperFree.vue_vue_type_style_index_0_scoped_dc019220_lang.css → picture-cropper/src/CropperFree.vue_vue_type_style_index_0_scoped_f287eb8f_lang.css} +16 -16
- package/es/modules/picture-preview/index.d.ts +2 -0
- package/es/modules/picture-preview/index.mjs +2 -0
- package/es/modules/picture-preview/src/Functional.vue.d.ts +60 -0
- package/es/modules/picture-preview/src/Functional.vue.mjs +6 -0
- package/es/modules/picture-preview/src/Functional.vue_vue_type_script_lang.mjs +287 -0
- package/es/modules/picture-preview/src/Functional.vue_vue_type_style_index_0_lang.css +101 -0
- package/es/modules/picture-preview/src/functional.d.ts +2 -0
- package/es/modules/picture-preview/src/functional.mjs +19 -0
- package/es/modules/picture-preview/src/picture-preview.vue.d.ts +51 -0
- package/es/modules/picture-preview/src/picture-preview.vue.mjs +6 -0
- package/es/modules/picture-preview/src/picture-preview.vue_vue_type_script_setup_true_lang.mjs +49 -0
- package/es/modules/picture-preview/src/picture-preview.vue_vue_type_style_index_0_lang.css +70 -0
- package/es/modules/picture-preview/src/typing.d.ts +51 -0
- package/package.json +5 -5
- package/es/modules/Cropper/index.d.ts +0 -5
- package/es/modules/Cropper/index.mjs +0 -11
- package/es/modules/Cropper/src/typing.d.ts +0 -11
- /package/es/modules/{Cropper → picture-cropper}/src/Cropper.vue.d.ts +0 -0
- /package/es/modules/{Cropper → picture-cropper}/src/Cropper.vue_vue_type_style_index_0_lang.css +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.cropper-photo[data-v-
|
|
1
|
+
.cropper-photo[data-v-f287eb8f] {
|
|
2
2
|
display: inline-block;
|
|
3
3
|
position: relative;
|
|
4
4
|
width: var(--width, 200px);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
text-align: center;
|
|
8
8
|
cursor: pointer;
|
|
9
9
|
}
|
|
10
|
-
.cropper-photo__trigger[data-v-
|
|
10
|
+
.cropper-photo__trigger[data-v-f287eb8f] {
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
align-items: center;
|
|
@@ -19,25 +19,25 @@
|
|
|
19
19
|
background: #fbfbfc;
|
|
20
20
|
color: #9b9b9b;
|
|
21
21
|
}
|
|
22
|
-
.cropper-photo__trigger .iconfont[data-v-
|
|
22
|
+
.cropper-photo__trigger .iconfont[data-v-f287eb8f] {
|
|
23
23
|
color: #c3c3c3;
|
|
24
24
|
font-size: 32px;
|
|
25
25
|
}
|
|
26
|
-
.cropper-photo__trigger .ant-icon[data-v-
|
|
26
|
+
.cropper-photo__trigger .ant-icon[data-v-f287eb8f] {
|
|
27
27
|
margin-bottom: 3px;
|
|
28
28
|
color: #666;
|
|
29
29
|
}
|
|
30
|
-
.cropper-photo__trigger .prompt[data-v-
|
|
31
|
-
.cropper-photo__trigger .auxiliary[data-v-
|
|
30
|
+
.cropper-photo__trigger .prompt[data-v-f287eb8f],
|
|
31
|
+
.cropper-photo__trigger .auxiliary[data-v-f287eb8f] {
|
|
32
32
|
margin: 0;
|
|
33
33
|
}
|
|
34
|
-
.cropper-photo__trigger .prompt[data-v-
|
|
34
|
+
.cropper-photo__trigger .prompt[data-v-f287eb8f] {
|
|
35
35
|
color: #797a7d;
|
|
36
36
|
}
|
|
37
|
-
.cropper-photo__trigger .auxiliary[data-v-
|
|
37
|
+
.cropper-photo__trigger .auxiliary[data-v-f287eb8f] {
|
|
38
38
|
color: #c3c3c3;
|
|
39
39
|
}
|
|
40
|
-
.cropper-photo__mask[data-v-
|
|
40
|
+
.cropper-photo__mask[data-v-f287eb8f] {
|
|
41
41
|
display: flex;
|
|
42
42
|
position: absolute;
|
|
43
43
|
top: 0;
|
|
@@ -51,31 +51,31 @@
|
|
|
51
51
|
opacity: 0;
|
|
52
52
|
background: rgba(0, 0, 0, 0.4);
|
|
53
53
|
}
|
|
54
|
-
.cropper-photo__mask .anticon[data-v-
|
|
54
|
+
.cropper-photo__mask .anticon[data-v-f287eb8f] {
|
|
55
55
|
margin-right: 20px;
|
|
56
56
|
}
|
|
57
|
-
.cropper-photo__mask .anticon[data-v-
|
|
57
|
+
.cropper-photo__mask .anticon[data-v-f287eb8f]:last-child {
|
|
58
58
|
margin-right: 0;
|
|
59
59
|
}
|
|
60
|
-
.cropper-photo__mask[data-v-
|
|
60
|
+
.cropper-photo__mask[data-v-f287eb8f]:hover {
|
|
61
61
|
opacity: 40;
|
|
62
62
|
}
|
|
63
|
-
.cropper-photo__wrapper[data-v-
|
|
63
|
+
.cropper-photo__wrapper[data-v-f287eb8f] {
|
|
64
64
|
width: 100%;
|
|
65
65
|
height: 100%;
|
|
66
66
|
border: 1px solid var(--gct-color-border);
|
|
67
67
|
border-radius: 4px;
|
|
68
68
|
}
|
|
69
|
-
.cropper-photo__wrapper img[data-v-
|
|
69
|
+
.cropper-photo__wrapper img[data-v-f287eb8f] {
|
|
70
70
|
width: 100%;
|
|
71
71
|
height: 100%;
|
|
72
72
|
object-fit: contain;
|
|
73
73
|
}
|
|
74
|
-
.not-allow[data-v-
|
|
74
|
+
.not-allow[data-v-f287eb8f] {
|
|
75
75
|
cursor: default;
|
|
76
76
|
pointer-events: none;
|
|
77
77
|
}
|
|
78
|
-
.defult-img[data-v-
|
|
78
|
+
.defult-img[data-v-f287eb8f] {
|
|
79
79
|
position: absolute;
|
|
80
80
|
z-index: 2;
|
|
81
81
|
border: 1px solid #d9d9d9;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
3
|
+
show: {
|
|
4
|
+
type: PropType<boolean>;
|
|
5
|
+
default: boolean;
|
|
6
|
+
};
|
|
7
|
+
imageList: {
|
|
8
|
+
type: PropType<string[]>;
|
|
9
|
+
default: null;
|
|
10
|
+
};
|
|
11
|
+
index: {
|
|
12
|
+
type: PropType<number>;
|
|
13
|
+
default: number;
|
|
14
|
+
};
|
|
15
|
+
scaleStep: {
|
|
16
|
+
type: PropType<number>;
|
|
17
|
+
};
|
|
18
|
+
defaultWidth: {
|
|
19
|
+
type: PropType<number>;
|
|
20
|
+
};
|
|
21
|
+
maskClosable: {
|
|
22
|
+
type: PropType<boolean>;
|
|
23
|
+
};
|
|
24
|
+
rememberState: {
|
|
25
|
+
type: PropType<boolean>;
|
|
26
|
+
};
|
|
27
|
+
}>, () => false | import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("img-load" | "img-error")[], "img-load" | "img-error", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
28
|
+
show: {
|
|
29
|
+
type: PropType<boolean>;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
imageList: {
|
|
33
|
+
type: PropType<string[]>;
|
|
34
|
+
default: null;
|
|
35
|
+
};
|
|
36
|
+
index: {
|
|
37
|
+
type: PropType<number>;
|
|
38
|
+
default: number;
|
|
39
|
+
};
|
|
40
|
+
scaleStep: {
|
|
41
|
+
type: PropType<number>;
|
|
42
|
+
};
|
|
43
|
+
defaultWidth: {
|
|
44
|
+
type: PropType<number>;
|
|
45
|
+
};
|
|
46
|
+
maskClosable: {
|
|
47
|
+
type: PropType<boolean>;
|
|
48
|
+
};
|
|
49
|
+
rememberState: {
|
|
50
|
+
type: PropType<boolean>;
|
|
51
|
+
};
|
|
52
|
+
}>> & Readonly<{
|
|
53
|
+
"onImg-load"?: ((...args: any[]) => any) | undefined;
|
|
54
|
+
"onImg-error"?: ((...args: any[]) => any) | undefined;
|
|
55
|
+
}>, {
|
|
56
|
+
index: number;
|
|
57
|
+
imageList: string[];
|
|
58
|
+
show: boolean;
|
|
59
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
60
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import Functional_vue_vue_type_script_lang_default from "./Functional.vue_vue_type_script_lang.mjs";
|
|
2
|
+
import './Functional.vue_vue_type_style_index_0_lang.css';/* empty css */
|
|
3
|
+
//#region src/modules/picture-preview/src/Functional.vue
|
|
4
|
+
var Functional_default = Functional_vue_vue_type_script_lang_default;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Functional_default as default };
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { computed, createTextVNode, createVNode, defineComponent, reactive, ref, unref, watchEffect } from "vue";
|
|
2
|
+
import { CloseOutlined, LeftOutlined, RightOutlined } from "@ant-design/icons-vue";
|
|
3
|
+
//#region src/modules/picture-preview/src/Functional.vue?vue&type=script&lang.tsx
|
|
4
|
+
var StatueEnum = /* @__PURE__ */ function(StatueEnum) {
|
|
5
|
+
StatueEnum[StatueEnum["LOADING"] = 0] = "LOADING";
|
|
6
|
+
StatueEnum[StatueEnum["DONE"] = 1] = "DONE";
|
|
7
|
+
StatueEnum[StatueEnum["FAIL"] = 2] = "FAIL";
|
|
8
|
+
return StatueEnum;
|
|
9
|
+
}(StatueEnum || {});
|
|
10
|
+
var props = {
|
|
11
|
+
show: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
},
|
|
15
|
+
imageList: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: null
|
|
18
|
+
},
|
|
19
|
+
index: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 0
|
|
22
|
+
},
|
|
23
|
+
scaleStep: { type: Number },
|
|
24
|
+
defaultWidth: { type: Number },
|
|
25
|
+
maskClosable: { type: Boolean },
|
|
26
|
+
rememberState: { type: Boolean }
|
|
27
|
+
};
|
|
28
|
+
var prefixCls = "img-preview";
|
|
29
|
+
var Functional_vue_vue_type_script_lang_default = /* @__PURE__ */ defineComponent({
|
|
30
|
+
name: "ImagePreview",
|
|
31
|
+
props,
|
|
32
|
+
emits: ["img-load", "img-error"],
|
|
33
|
+
setup(props, { expose, emit }) {
|
|
34
|
+
const stateMap = /* @__PURE__ */ new Map();
|
|
35
|
+
const imgState = reactive({
|
|
36
|
+
currentUrl: "",
|
|
37
|
+
imgScale: 1,
|
|
38
|
+
imgRotate: 0,
|
|
39
|
+
imgTop: 0,
|
|
40
|
+
imgLeft: 0,
|
|
41
|
+
status: StatueEnum.LOADING,
|
|
42
|
+
currentIndex: 0,
|
|
43
|
+
moveX: 0,
|
|
44
|
+
moveY: 0,
|
|
45
|
+
show: props.show
|
|
46
|
+
});
|
|
47
|
+
const wrapElRef = ref(null);
|
|
48
|
+
const imgElRef = ref(null);
|
|
49
|
+
function init() {
|
|
50
|
+
initMouseWheel();
|
|
51
|
+
const { index, imageList } = props;
|
|
52
|
+
if (!imageList || !imageList.length) throw new Error("imageList is undefined");
|
|
53
|
+
imgState.currentIndex = index;
|
|
54
|
+
handleIChangeImage(imageList[index]);
|
|
55
|
+
}
|
|
56
|
+
function initState() {
|
|
57
|
+
imgState.imgScale = 1;
|
|
58
|
+
imgState.imgRotate = 0;
|
|
59
|
+
imgState.imgTop = 0;
|
|
60
|
+
imgState.imgLeft = 0;
|
|
61
|
+
}
|
|
62
|
+
function initMouseWheel() {
|
|
63
|
+
const wrapEl = unref(wrapElRef);
|
|
64
|
+
if (!wrapEl) return;
|
|
65
|
+
wrapEl.onmousewheel = scrollFunc;
|
|
66
|
+
document.body.addEventListener("DOMMouseScroll", scrollFunc);
|
|
67
|
+
document.ondragstart = function() {
|
|
68
|
+
return false;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const getScaleStep = computed(() => {
|
|
72
|
+
const scaleStep = props?.scaleStep ?? 0;
|
|
73
|
+
if (scaleStep > 0 && scaleStep < 100) return scaleStep / 100;
|
|
74
|
+
else return imgState.imgScale / 10;
|
|
75
|
+
});
|
|
76
|
+
function scrollFunc(e) {
|
|
77
|
+
e = e || window.event;
|
|
78
|
+
e.delta = e.wheelDelta || -e.detail;
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
if (e.delta > 0) scaleFunc(getScaleStep.value);
|
|
81
|
+
if (e.delta < 0) scaleFunc(-getScaleStep.value);
|
|
82
|
+
}
|
|
83
|
+
function scaleFunc(num) {
|
|
84
|
+
const MIN_SCALE = .02;
|
|
85
|
+
const GRA = .1;
|
|
86
|
+
if (imgState.imgScale <= .2 && num < 0) return;
|
|
87
|
+
imgState.imgScale += num * GRA;
|
|
88
|
+
if (imgState.imgScale < 0) imgState.imgScale = MIN_SCALE;
|
|
89
|
+
}
|
|
90
|
+
function rotateFunc(deg) {
|
|
91
|
+
imgState.imgRotate += deg;
|
|
92
|
+
}
|
|
93
|
+
function handleMouseUp() {
|
|
94
|
+
const imgEl = unref(imgElRef);
|
|
95
|
+
if (!imgEl) return;
|
|
96
|
+
imgEl.onmousemove = null;
|
|
97
|
+
}
|
|
98
|
+
function handleIChangeImage(url) {
|
|
99
|
+
imgState.status = StatueEnum.LOADING;
|
|
100
|
+
const img = new Image();
|
|
101
|
+
img.src = url;
|
|
102
|
+
img.onload = (e) => {
|
|
103
|
+
if (imgState.currentUrl !== url) {
|
|
104
|
+
const ele = e.composedPath();
|
|
105
|
+
if (props.rememberState) {
|
|
106
|
+
stateMap.set(imgState.currentUrl, {
|
|
107
|
+
scale: imgState.imgScale,
|
|
108
|
+
top: imgState.imgTop,
|
|
109
|
+
left: imgState.imgLeft,
|
|
110
|
+
rotate: imgState.imgRotate
|
|
111
|
+
});
|
|
112
|
+
const stateInfo = stateMap.get(url);
|
|
113
|
+
if (stateInfo) {
|
|
114
|
+
imgState.imgScale = stateInfo.scale;
|
|
115
|
+
imgState.imgTop = stateInfo.top;
|
|
116
|
+
imgState.imgRotate = stateInfo.rotate;
|
|
117
|
+
imgState.imgLeft = stateInfo.left;
|
|
118
|
+
} else {
|
|
119
|
+
initState();
|
|
120
|
+
if (props.defaultWidth) imgState.imgScale = props.defaultWidth / ele[0].naturalWidth;
|
|
121
|
+
}
|
|
122
|
+
} else if (props.defaultWidth) imgState.imgScale = props.defaultWidth / ele[0].naturalWidth;
|
|
123
|
+
ele && emit("img-load", {
|
|
124
|
+
index: imgState.currentIndex,
|
|
125
|
+
dom: ele[0],
|
|
126
|
+
url
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
imgState.currentUrl = url;
|
|
130
|
+
imgState.status = StatueEnum.DONE;
|
|
131
|
+
};
|
|
132
|
+
img.onerror = (e) => {
|
|
133
|
+
const ele = e.composedPath();
|
|
134
|
+
ele && emit("img-error", {
|
|
135
|
+
index: imgState.currentIndex,
|
|
136
|
+
dom: ele[0],
|
|
137
|
+
url
|
|
138
|
+
});
|
|
139
|
+
imgState.status = StatueEnum.FAIL;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function handleClose(e) {
|
|
143
|
+
e && e.stopPropagation();
|
|
144
|
+
close();
|
|
145
|
+
}
|
|
146
|
+
function close() {
|
|
147
|
+
imgState.show = false;
|
|
148
|
+
document.body.removeEventListener("DOMMouseScroll", scrollFunc);
|
|
149
|
+
document.ondragstart = null;
|
|
150
|
+
}
|
|
151
|
+
function resume() {
|
|
152
|
+
initState();
|
|
153
|
+
}
|
|
154
|
+
expose({
|
|
155
|
+
resume,
|
|
156
|
+
close,
|
|
157
|
+
prev: handleChange.bind(null, "left"),
|
|
158
|
+
next: handleChange.bind(null, "right"),
|
|
159
|
+
setScale: (scale) => {
|
|
160
|
+
if (scale > 0 && scale <= 10) imgState.imgScale = scale;
|
|
161
|
+
},
|
|
162
|
+
setRotate: (rotate) => {
|
|
163
|
+
imgState.imgRotate = rotate;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
function handleChange(direction) {
|
|
167
|
+
const { currentIndex } = imgState;
|
|
168
|
+
const { imageList } = props;
|
|
169
|
+
if (direction === "left") {
|
|
170
|
+
imgState.currentIndex -= 1;
|
|
171
|
+
if (currentIndex <= 0) imgState.currentIndex = imageList.length - 1;
|
|
172
|
+
}
|
|
173
|
+
if (direction === "right") {
|
|
174
|
+
imgState.currentIndex += 1;
|
|
175
|
+
if (currentIndex >= imageList.length - 1) imgState.currentIndex = 0;
|
|
176
|
+
}
|
|
177
|
+
handleIChangeImage(imageList[imgState.currentIndex]);
|
|
178
|
+
}
|
|
179
|
+
function handleAddMoveListener(e) {
|
|
180
|
+
e = e || window.event;
|
|
181
|
+
imgState.moveX = e.clientX;
|
|
182
|
+
imgState.moveY = e.clientY;
|
|
183
|
+
const imgEl = unref(imgElRef);
|
|
184
|
+
if (imgEl) imgEl.onmousemove = moveFunc;
|
|
185
|
+
}
|
|
186
|
+
function moveFunc(e) {
|
|
187
|
+
e = e || window.event;
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
const movementX = e.clientX - imgState.moveX;
|
|
190
|
+
const movementY = e.clientY - imgState.moveY;
|
|
191
|
+
imgState.imgLeft += movementX;
|
|
192
|
+
imgState.imgTop += movementY;
|
|
193
|
+
imgState.moveX = e.clientX;
|
|
194
|
+
imgState.moveY = e.clientY;
|
|
195
|
+
}
|
|
196
|
+
const getImageStyle = computed(() => {
|
|
197
|
+
const { imgScale, imgRotate, imgTop, imgLeft } = imgState;
|
|
198
|
+
return {
|
|
199
|
+
transform: `scale(${imgScale}) rotate(${imgRotate}deg)`,
|
|
200
|
+
marginTop: `${imgTop}px`,
|
|
201
|
+
marginLeft: `${imgLeft}px`,
|
|
202
|
+
maxWidth: props.defaultWidth ? "unset" : "100%"
|
|
203
|
+
};
|
|
204
|
+
});
|
|
205
|
+
const getIsMultipleImage = computed(() => {
|
|
206
|
+
const { imageList } = props;
|
|
207
|
+
return imageList.length > 1;
|
|
208
|
+
});
|
|
209
|
+
watchEffect(() => {
|
|
210
|
+
if (props.show) init();
|
|
211
|
+
if (props.imageList) initState();
|
|
212
|
+
});
|
|
213
|
+
const handleMaskClick = (e) => {
|
|
214
|
+
if (props.maskClosable && e.target && e.target.classList.contains(`${prefixCls}-content`)) handleClose(e);
|
|
215
|
+
};
|
|
216
|
+
const renderClose = () => {
|
|
217
|
+
return createVNode("div", {
|
|
218
|
+
"class": `${prefixCls}__close`,
|
|
219
|
+
"onClick": handleClose
|
|
220
|
+
}, [createVNode(CloseOutlined, { "class": `${prefixCls}__close-icon` }, null)]);
|
|
221
|
+
};
|
|
222
|
+
const renderIndex = () => {
|
|
223
|
+
if (!unref(getIsMultipleImage)) return null;
|
|
224
|
+
const { currentIndex } = imgState;
|
|
225
|
+
const { imageList } = props;
|
|
226
|
+
return createVNode("div", { "class": `${prefixCls}__index` }, [
|
|
227
|
+
currentIndex + 1,
|
|
228
|
+
createTextVNode(" / "),
|
|
229
|
+
imageList.length
|
|
230
|
+
]);
|
|
231
|
+
};
|
|
232
|
+
const renderController = () => {
|
|
233
|
+
return createVNode("div", { "class": `${prefixCls}__controller` }, [
|
|
234
|
+
createVNode("div", {
|
|
235
|
+
"class": `${prefixCls}__controller-item`,
|
|
236
|
+
"onClick": () => scaleFunc(-getScaleStep.value)
|
|
237
|
+
}, [createVNode("img", { "src": "/extras-assets/svg/preview/unscale.svg" }, null)]),
|
|
238
|
+
createVNode("div", {
|
|
239
|
+
"class": `${prefixCls}__controller-item`,
|
|
240
|
+
"onClick": () => scaleFunc(getScaleStep.value)
|
|
241
|
+
}, [createVNode("img", { "src": "/extras-assets/svg/preview/scale.svg" }, null)]),
|
|
242
|
+
createVNode("div", {
|
|
243
|
+
"class": `${prefixCls}__controller-item`,
|
|
244
|
+
"onClick": resume
|
|
245
|
+
}, [createVNode("img", { "src": "/extras-assets/svg/preview/resume.svg" }, null)]),
|
|
246
|
+
createVNode("div", {
|
|
247
|
+
"class": `${prefixCls}__controller-item`,
|
|
248
|
+
"onClick": () => rotateFunc(-90)
|
|
249
|
+
}, [createVNode("img", { "src": "/extras-assets/svg/preview/unrotate.svg" }, null)]),
|
|
250
|
+
createVNode("div", {
|
|
251
|
+
"class": `${prefixCls}__controller-item`,
|
|
252
|
+
"onClick": () => rotateFunc(90)
|
|
253
|
+
}, [createVNode("img", { "src": "/extras-assets/svg/preview/p-rotate.svg" }, null)])
|
|
254
|
+
]);
|
|
255
|
+
};
|
|
256
|
+
const renderArrow = (direction) => {
|
|
257
|
+
if (!unref(getIsMultipleImage)) return null;
|
|
258
|
+
return createVNode("div", {
|
|
259
|
+
"class": [`${prefixCls}__arrow`, direction],
|
|
260
|
+
"onClick": () => handleChange(direction)
|
|
261
|
+
}, [direction === "left" ? createVNode(LeftOutlined, null, null) : createVNode(RightOutlined, null, null)]);
|
|
262
|
+
};
|
|
263
|
+
return () => {
|
|
264
|
+
return imgState.show && createVNode("div", {
|
|
265
|
+
"class": prefixCls,
|
|
266
|
+
"ref": wrapElRef,
|
|
267
|
+
"onMouseup": handleMouseUp,
|
|
268
|
+
"onClick": handleMaskClick
|
|
269
|
+
}, [createVNode("div", { "class": `${prefixCls}-content` }, [
|
|
270
|
+
createVNode("img", {
|
|
271
|
+
"style": unref(getImageStyle),
|
|
272
|
+
"class": [`${prefixCls}-image`, imgState.status === StatueEnum.DONE ? "" : "hidden"],
|
|
273
|
+
"ref": imgElRef,
|
|
274
|
+
"src": imgState.currentUrl,
|
|
275
|
+
"onMousedown": handleAddMoveListener
|
|
276
|
+
}, null),
|
|
277
|
+
renderClose(),
|
|
278
|
+
renderIndex(),
|
|
279
|
+
renderController(),
|
|
280
|
+
renderArrow("left"),
|
|
281
|
+
renderArrow("right")
|
|
282
|
+
])]);
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
//#endregion
|
|
287
|
+
export { Functional_vue_vue_type_script_lang_default as default };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
.img-preview {
|
|
2
|
+
position: fixed;
|
|
3
|
+
z-index: 9999;
|
|
4
|
+
inset: 0;
|
|
5
|
+
background: rgba(0, 0, 0, 0.5);
|
|
6
|
+
user-select: none;
|
|
7
|
+
}
|
|
8
|
+
.img-preview-content {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
color: var(--gct-color-white);
|
|
15
|
+
}
|
|
16
|
+
.img-preview-image {
|
|
17
|
+
transition: transform 0.3s;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
}
|
|
20
|
+
.img-preview__close {
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: -40px;
|
|
23
|
+
right: -40px;
|
|
24
|
+
width: 80px;
|
|
25
|
+
height: 80px;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
transition: all 0.2s;
|
|
28
|
+
border-radius: 50%;
|
|
29
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
30
|
+
color: var(--gct-color-white);
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
}
|
|
33
|
+
.img-preview__close-icon {
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 46px;
|
|
36
|
+
left: 16px;
|
|
37
|
+
font-size: 16px;
|
|
38
|
+
}
|
|
39
|
+
.img-preview__close:hover {
|
|
40
|
+
background-color: rgba(0, 0, 0, 0.8);
|
|
41
|
+
}
|
|
42
|
+
.img-preview__index {
|
|
43
|
+
position: absolute;
|
|
44
|
+
bottom: 5%;
|
|
45
|
+
left: 50%;
|
|
46
|
+
padding: 0 22px;
|
|
47
|
+
transform: translateX(-50%);
|
|
48
|
+
border-radius: 15px;
|
|
49
|
+
background: rgba(109, 109, 109, 0.6);
|
|
50
|
+
font-size: 16px;
|
|
51
|
+
}
|
|
52
|
+
.img-preview__controller {
|
|
53
|
+
display: flex;
|
|
54
|
+
position: absolute;
|
|
55
|
+
bottom: 10%;
|
|
56
|
+
left: 50%;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
width: 260px;
|
|
59
|
+
height: 44px;
|
|
60
|
+
margin-left: -139px;
|
|
61
|
+
padding: 0 22px;
|
|
62
|
+
border-radius: 22px;
|
|
63
|
+
background: rgba(109, 109, 109, 0.6);
|
|
64
|
+
}
|
|
65
|
+
.img-preview__controller-item {
|
|
66
|
+
display: flex;
|
|
67
|
+
height: 100%;
|
|
68
|
+
padding: 0 9px;
|
|
69
|
+
transition: all 0.2s;
|
|
70
|
+
font-size: 24px;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
}
|
|
73
|
+
.img-preview__controller-item:hover {
|
|
74
|
+
transform: scale(1.2);
|
|
75
|
+
}
|
|
76
|
+
.img-preview__controller-item img {
|
|
77
|
+
width: 1em;
|
|
78
|
+
}
|
|
79
|
+
.img-preview__arrow {
|
|
80
|
+
display: flex;
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 50%;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
width: 50px;
|
|
86
|
+
height: 50px;
|
|
87
|
+
transition: all 0.2s;
|
|
88
|
+
border-radius: 50%;
|
|
89
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
90
|
+
font-size: 28px;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
}
|
|
93
|
+
.img-preview__arrow:hover {
|
|
94
|
+
background-color: rgba(0, 0, 0, 0.8);
|
|
95
|
+
}
|
|
96
|
+
.img-preview__arrow.left {
|
|
97
|
+
left: 50px;
|
|
98
|
+
}
|
|
99
|
+
.img-preview__arrow.right {
|
|
100
|
+
right: 50px;
|
|
101
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Functional_default from "./Functional.vue.mjs";
|
|
2
|
+
import { createVNode, render } from "vue";
|
|
3
|
+
//#region src/modules/picture-preview/src/functional.ts
|
|
4
|
+
var instance = null;
|
|
5
|
+
function createImgPreview(options) {
|
|
6
|
+
const propsData = {};
|
|
7
|
+
const container = document.createElement("div");
|
|
8
|
+
Object.assign(propsData, {
|
|
9
|
+
show: true,
|
|
10
|
+
index: 0,
|
|
11
|
+
scaleStep: 100
|
|
12
|
+
}, options);
|
|
13
|
+
instance = createVNode(Functional_default, propsData);
|
|
14
|
+
render(instance, container);
|
|
15
|
+
document.body.appendChild(container);
|
|
16
|
+
return instance.component?.exposed;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { createImgPreview };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
interface ImageProps {
|
|
3
|
+
alt?: string;
|
|
4
|
+
fallback?: string;
|
|
5
|
+
src: string;
|
|
6
|
+
width: string | number;
|
|
7
|
+
height?: string | number;
|
|
8
|
+
placeholder?: string | boolean;
|
|
9
|
+
preview?: boolean | {
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
onVisibleChange?: (visible: boolean, prevVisible: boolean) => void;
|
|
12
|
+
getContainer: string | HTMLElement | (() => HTMLElement);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
type ImageItem = string | ImageProps;
|
|
16
|
+
declare function __VLS_template(): {
|
|
17
|
+
attrs: Partial<{}>;
|
|
18
|
+
slots: {
|
|
19
|
+
default?(_: {}): any;
|
|
20
|
+
};
|
|
21
|
+
refs: {};
|
|
22
|
+
rootEl: HTMLDivElement;
|
|
23
|
+
};
|
|
24
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
25
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
26
|
+
functional: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
};
|
|
29
|
+
imageList: {
|
|
30
|
+
type: PropType<ImageItem[]>;
|
|
31
|
+
default: () => never[];
|
|
32
|
+
};
|
|
33
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
34
|
+
functional: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
};
|
|
37
|
+
imageList: {
|
|
38
|
+
type: PropType<ImageItem[]>;
|
|
39
|
+
default: () => never[];
|
|
40
|
+
};
|
|
41
|
+
}>> & Readonly<{}>, {
|
|
42
|
+
functional: boolean;
|
|
43
|
+
imageList: ImageItem[];
|
|
44
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
45
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
46
|
+
export default _default;
|
|
47
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
48
|
+
new (): {
|
|
49
|
+
$slots: S;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import picture_preview_vue_vue_type_script_setup_true_lang_default from "./picture-preview.vue_vue_type_script_setup_true_lang.mjs";
|
|
2
|
+
import './picture-preview.vue_vue_type_style_index_0_lang.css';/* empty css */
|
|
3
|
+
//#region src/modules/picture-preview/src/picture-preview.vue
|
|
4
|
+
var picture_preview_default = picture_preview_vue_vue_type_script_setup_true_lang_default;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { picture_preview_default as default };
|
package/es/modules/picture-preview/src/picture-preview.vue_vue_type_script_setup_true_lang.mjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Fragment, computed, createBlock, createElementBlock, createSlots, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, renderSlot, resolveComponent, unref, withCtx } from "vue";
|
|
2
|
+
import { isString } from "lodash-es";
|
|
3
|
+
import { useNamespace } from "@gct-paas/core";
|
|
4
|
+
import { Image } from "ant-design-vue";
|
|
5
|
+
//#region src/modules/picture-preview/src/picture-preview.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var picture_preview_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "picture-preview",
|
|
8
|
+
props: {
|
|
9
|
+
functional: { type: Boolean },
|
|
10
|
+
imageList: {
|
|
11
|
+
type: Array,
|
|
12
|
+
default: () => []
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const ns = useNamespace("image-preview");
|
|
18
|
+
const getImageList = computed(() => {
|
|
19
|
+
return props.imageList.map((item) => {
|
|
20
|
+
if (isString(item)) return {
|
|
21
|
+
src: item,
|
|
22
|
+
placeholder: false
|
|
23
|
+
};
|
|
24
|
+
return item;
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return (_ctx, _cache) => {
|
|
28
|
+
const _component_PreviewGroup = resolveComponent("PreviewGroup");
|
|
29
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [createVNode(_component_PreviewGroup, null, {
|
|
30
|
+
default: withCtx(() => [!__props.imageList || _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(getImageList.value, (item) => {
|
|
31
|
+
return openBlock(), createBlock(unref(Image), mergeProps({
|
|
32
|
+
key: item.src,
|
|
33
|
+
ref_for: true
|
|
34
|
+
}, item), createSlots({ _: 2 }, [item.placeholder ? {
|
|
35
|
+
name: "placeholder",
|
|
36
|
+
fn: withCtx(() => [createVNode(unref(Image), mergeProps({ ref_for: true }, item, {
|
|
37
|
+
src: item.placeholder,
|
|
38
|
+
preview: false
|
|
39
|
+
}), null, 16, ["src"])]),
|
|
40
|
+
key: "0"
|
|
41
|
+
} : void 0]), 1040);
|
|
42
|
+
}), 128))]),
|
|
43
|
+
_: 3
|
|
44
|
+
})], 2);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
export { picture_preview_vue_vue_type_script_setup_true_lang_default as default };
|