xt-element-ui 1.1.0 → 1.1.2
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/lib/css/2.3f7aa432.css +1 -0
- package/lib/css/3.ffcc175d.css +1 -0
- package/lib/css/4.9abd1f2b.css +1 -0
- package/lib/css/5.1a31ed8a.css +1 -0
- package/lib/css/6.c2d0d77e.css +1 -0
- package/lib/index.common.0.js +120208 -0
- package/lib/index.common.2.js +1053 -0
- package/lib/index.common.3.js +996 -0
- package/lib/index.common.4.js +1108 -0
- package/lib/index.common.5.js +1009 -0
- package/lib/index.common.6.js +973 -0
- package/lib/index.common.js +8003 -211
- package/lib/index.css +1 -1
- package/lib/index.umd.0.js +120208 -0
- package/lib/index.umd.2.js +1053 -0
- package/lib/index.umd.3.js +996 -0
- package/lib/index.umd.4.js +1108 -0
- package/lib/index.umd.5.js +1009 -0
- package/lib/index.umd.6.js +973 -0
- package/lib/index.umd.js +8003 -211
- package/lib/index.umd.min.0.js +34 -0
- package/lib/index.umd.min.2.js +1 -0
- package/lib/index.umd.min.3.js +1 -0
- package/lib/index.umd.min.4.js +1 -0
- package/lib/index.umd.min.5.js +1 -0
- package/lib/index.umd.min.6.js +1 -0
- package/lib/index.umd.min.js +1 -1
- package/package.json +7 -3
- package/src/components/button/index.vue +5 -5
- package/src/components/button/style/index.scss +743 -90
- package/src/components/chart/ExBar.vue +203 -0
- package/src/components/chart/ExLine.vue +146 -0
- package/src/components/chart/ExMulti.vue +257 -0
- package/src/components/chart/ExPie.vue +159 -0
- package/src/components/chart/ExTrend.vue +121 -0
- package/src/components/chart/index.js +2 -0
- package/src/components/chart/index.vue +51 -0
- package/src/components/chart/pieList.vue +110 -0
- package/src/components/chart/theme/blue.js +91 -0
- package/src/components/chart/theme/dark.js +91 -0
- package/src/components/chart/theme/orange.js +92 -0
- package/src/components/chart/theme/starry.js +106 -0
- package/src/components/chart/theme/white.js +110 -0
- package/src/components/chart/utils.js +273 -0
- package/src/components/config-provider/index.vue +150 -51
- package/src/components/config-provider/style/index.scss +2 -2
- package/src/components/date-picker/SearchDate.vue +45 -0
- package/src/components/date-picker/index.js +2 -0
- package/src/components/date-picker/index.vue +131 -0
- package/src/components/date-picker/quarter.vue +152 -0
- package/src/components/grid-box/index.js +2 -0
- package/src/components/grid-box/index.vue +42 -0
- package/src/components/layout/BaseCollapse.vue +48 -0
- package/src/components/layout/ExFieldset.vue +204 -0
- package/src/components/page/index.js +0 -0
- package/src/components/page/index.vue +109 -0
- package/src/components/select-tree/index.js +0 -0
- package/src/components/select-tree/index.vue +386 -0
- package/src/components/table/ExCell.vue +27 -0
- package/src/components/table/ExColumn.vue +36 -0
- package/src/components/table/index.js +2 -0
- package/src/components/table/index.vue +731 -0
- package/src/components/table/processor.js +380 -0
- package/src/components/text/index.vue +79 -2
- package/src/components/text/style/index.scss +28 -6
- package/src/components/upload/index.js +2 -0
- package/src/components/upload/index.vue +225 -0
- package/src/components/upload/preview.vue +333 -0
- package/src/index.js +11 -2
- package/src/styles/css-variables.scss +238 -148
- package/src/styles/theme/background.scss +1 -1
- package/src/styles/theme/colors.scss +90 -1
- package/src/styles/variables.scss +1 -1
- package/src/components/button/style/index copy.scss +0 -221
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BaseFlexBox type="inline-flex" gap="5px">
|
|
3
|
+
<el-upload
|
|
4
|
+
v-if="action"
|
|
5
|
+
ref="uploadFile"
|
|
6
|
+
:disabled="disabled || uploading"
|
|
7
|
+
:action="YSSQP + action"
|
|
8
|
+
:file-list="fileList"
|
|
9
|
+
:data="{accessToken,...data}"
|
|
10
|
+
:multiple="multiple"
|
|
11
|
+
:limit="limit"
|
|
12
|
+
:on-success="uploadSuccess"
|
|
13
|
+
:show-file-list="false"
|
|
14
|
+
:auto-upload="autoUpload"
|
|
15
|
+
:before-upload="uploadBefore"
|
|
16
|
+
accept=".jpg,.jpeg,.png"
|
|
17
|
+
>
|
|
18
|
+
<i class="el-icon-camera" style="font-size: 20px;padding: 20px;background:#f0f0f1;color:#409EFF" :style="{padding: plusPx / 2 + 'px',cursor:disabled ? 'not-allowed':'pointer'}"></i>
|
|
19
|
+
</el-upload>
|
|
20
|
+
<BaseFlexBox class="el-upload-list el-upload-list--picture-card" gap="5px" wrap="wrap" style="flex: 1" v-if="fileList!==null&&fileList.length>0">
|
|
21
|
+
<li v-for="(ite,index) in fileList" :key="index" class="el-upload-list__item is-ready" style="margin: 0;width:62px;height: 62px;" :style="{ width: (plusPx + 22)+ 'px',height: (plusPx + 22)+ 'px'}">
|
|
22
|
+
<el-image class="el-upload-list__item-thumbnail" :src="YSSQP+'/'+ite" alt="" @click="clickHandler" />
|
|
23
|
+
<span class="el-upload-list__item-actions" @click="preShowPicture(ite, index)">
|
|
24
|
+
<span class="el-upload-list__item-preview" @click.stop="preShowPicture(ite, index)">
|
|
25
|
+
<i class="el-icon-zoom-in" />
|
|
26
|
+
</span>
|
|
27
|
+
<span v-if="!uploading&&!disabled" class="el-upload-list__item-delete" style="margin-left: 0" @click.stop="handleRemove(index)">
|
|
28
|
+
<i class="el-icon-delete" />
|
|
29
|
+
</span>
|
|
30
|
+
</span>
|
|
31
|
+
</li>
|
|
32
|
+
</BaseFlexBox>
|
|
33
|
+
<template v-if="preview">
|
|
34
|
+
<ImageViewer v-if="previewVisible" :z-index="3000" :base-url="baseUrl + '/'" :infiniteLoop="false" :initial-index="imageIndex" :url-list="allFileList || fileList" :on-close="closeViewer" />
|
|
35
|
+
</template>
|
|
36
|
+
</BaseFlexBox>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import ImageViewer from "./preview.vue";
|
|
40
|
+
import { getToken } from "@/utils/auth";
|
|
41
|
+
export default {
|
|
42
|
+
components: {
|
|
43
|
+
ImageViewer
|
|
44
|
+
},
|
|
45
|
+
model: {
|
|
46
|
+
prop: "src",
|
|
47
|
+
event: "change"
|
|
48
|
+
},
|
|
49
|
+
props: {
|
|
50
|
+
data: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => {
|
|
53
|
+
return { };
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
src: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "",
|
|
59
|
+
required: true
|
|
60
|
+
},
|
|
61
|
+
autoUpload: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: true
|
|
64
|
+
},
|
|
65
|
+
action: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: ""
|
|
68
|
+
},
|
|
69
|
+
baseUrl: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: ""
|
|
72
|
+
},
|
|
73
|
+
multiple: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
accept: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: ".jpg,.jpeg,.png"
|
|
80
|
+
},
|
|
81
|
+
limit: {
|
|
82
|
+
type: Number,
|
|
83
|
+
default: 5
|
|
84
|
+
},
|
|
85
|
+
disabled: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
},
|
|
89
|
+
size: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: ""
|
|
92
|
+
},
|
|
93
|
+
beforeEmitData: {
|
|
94
|
+
type: Function,
|
|
95
|
+
default: (res, file, type) => {
|
|
96
|
+
if (res.code == 200) {
|
|
97
|
+
if (res.data.Result) {
|
|
98
|
+
return res.data.Data;
|
|
99
|
+
} else {
|
|
100
|
+
return res.data[0];
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
// 当前图片在图片库中预览
|
|
108
|
+
allFileList: {
|
|
109
|
+
type: Array
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
data() {
|
|
113
|
+
return {
|
|
114
|
+
accessToken: getToken(),
|
|
115
|
+
YSSQP: this.baseUrl,
|
|
116
|
+
// upload: {
|
|
117
|
+
// data: { accessToken: getToken() },
|
|
118
|
+
// limit: 5,
|
|
119
|
+
// accept: ".jpg,.png,.pdf",
|
|
120
|
+
// multiple: false
|
|
121
|
+
// },
|
|
122
|
+
previewVisible: false,
|
|
123
|
+
uploading: false,
|
|
124
|
+
imageUrl: "",
|
|
125
|
+
fileList: [],
|
|
126
|
+
imageIndex: 0
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
computed: {
|
|
130
|
+
preview() {
|
|
131
|
+
const { fileList } = this;
|
|
132
|
+
return Array.isArray(fileList) && fileList.length > 0;
|
|
133
|
+
},
|
|
134
|
+
plusPx() {
|
|
135
|
+
const _size = this.size == "big" ? 100 : 20;
|
|
136
|
+
return 2 * _size;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
watch: {
|
|
140
|
+
src: {
|
|
141
|
+
immediate: true,
|
|
142
|
+
deep: true,
|
|
143
|
+
handler(v) {
|
|
144
|
+
if (v) {
|
|
145
|
+
this.fileList = v.split(",");
|
|
146
|
+
} else {
|
|
147
|
+
this.fileList = [];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
methods: {
|
|
153
|
+
clickHandler() {
|
|
154
|
+
if (!this.preview) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
this.previewVisible = true;
|
|
158
|
+
},
|
|
159
|
+
closeViewer() {
|
|
160
|
+
this.previewVisible = false;
|
|
161
|
+
},
|
|
162
|
+
preShowPicture(url, ind) {
|
|
163
|
+
if (!this.allFileList || this.allFileList.length == 0) {
|
|
164
|
+
this.imageIndex = ind;
|
|
165
|
+
} else {
|
|
166
|
+
const imgInd = this.allFileList.findIndex(src => src == url);
|
|
167
|
+
if (imgInd > -1) {
|
|
168
|
+
this.imageIndex = imgInd;
|
|
169
|
+
} else {
|
|
170
|
+
this.imageIndex = ind;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (url.indexOf(".pdf") > -1) {
|
|
174
|
+
window.open(url, "_blank");
|
|
175
|
+
} else {
|
|
176
|
+
this.imageUrl = this.baseUrl + "/" + url;
|
|
177
|
+
this.previewVisible = true;
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
handleRemove(index, type) {
|
|
181
|
+
try {
|
|
182
|
+
this.fileList.splice(index, 1);
|
|
183
|
+
this.$emit("change", this.fileList.join(","));
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.log(error);
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
getPathName(v) {
|
|
189
|
+
return v.split("/").pop().split(".")[0];
|
|
190
|
+
},
|
|
191
|
+
uploadBefore(file, type) {
|
|
192
|
+
console.log(file);
|
|
193
|
+
const isJPG = file.type === "image/jpeg" || file.type === "image/jpg" || file.type === "image/png" || file.type === "application/pdf";
|
|
194
|
+
const isLt2M = file.size / 1024 / 1024 < 50;
|
|
195
|
+
if (!isJPG) {
|
|
196
|
+
this.$message.error("上传图片只能是jpg,jpeg,png,pdf格式!");
|
|
197
|
+
}
|
|
198
|
+
if (!isLt2M) {
|
|
199
|
+
this.$message.error("上传图片大小不能超过50MB!");
|
|
200
|
+
}
|
|
201
|
+
return isJPG && isLt2M;
|
|
202
|
+
},
|
|
203
|
+
// 上传文件
|
|
204
|
+
uploadSuccess(res, file, type) {
|
|
205
|
+
const _data = this.beforeEmitData(res, file, type);
|
|
206
|
+
if (_data) {
|
|
207
|
+
this.fileList.push(_data);
|
|
208
|
+
this.$emit("change", this.fileList.join(","));
|
|
209
|
+
this.$message({
|
|
210
|
+
message: "上传成功",
|
|
211
|
+
center: true,
|
|
212
|
+
type: "success"
|
|
213
|
+
});
|
|
214
|
+
return res.data[0];
|
|
215
|
+
} else {
|
|
216
|
+
this.$message({
|
|
217
|
+
message: "上传失败",
|
|
218
|
+
center: true,
|
|
219
|
+
type: "error"
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
</script>
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition name="viewer-fade">
|
|
3
|
+
<div tabindex="-1" ref="el-image-viewer__wrapper" class="el-image-viewer__wrapper" :style="{ 'z-index': zIndex }">
|
|
4
|
+
<div class="el-image-viewer__mask" @click="hide"></div>
|
|
5
|
+
<!-- CLOSE -->
|
|
6
|
+
<span class="el-image-viewer__btn fix_close" @click="hide">
|
|
7
|
+
<i class="el-icon-close"></i>
|
|
8
|
+
</span>
|
|
9
|
+
<!-- ARROW -->
|
|
10
|
+
<template v-if="!isSingle">
|
|
11
|
+
<span
|
|
12
|
+
class="el-image-viewer__btn el-image-viewer__prev"
|
|
13
|
+
:class="{ 'is-disabled': !infinite && isFirst }"
|
|
14
|
+
@click="prev">
|
|
15
|
+
<i class="el-icon-arrow-left"/>
|
|
16
|
+
</span>
|
|
17
|
+
<span
|
|
18
|
+
class="el-image-viewer__btn el-image-viewer__next"
|
|
19
|
+
:class="{ 'is-disabled': !infinite && isLast }"
|
|
20
|
+
@click="next">
|
|
21
|
+
<i class="el-icon-arrow-right"/>
|
|
22
|
+
</span>
|
|
23
|
+
</template>
|
|
24
|
+
<!-- ACTIONS -->
|
|
25
|
+
<div class="el-image-viewer__btn el-image-viewer__actions">
|
|
26
|
+
<div class="el-image-viewer__actions__inner">
|
|
27
|
+
<i class="el-icon-zoom-out" @click.stop="handleActions('zoomOut')"></i>
|
|
28
|
+
<i class="el-icon-zoom-in" @click.stop="handleActions('zoomIn')"></i>
|
|
29
|
+
<i class="el-image-viewer__actions__divider"></i>
|
|
30
|
+
<i :class="mode.icon" @click.stop="toggleMode"></i>
|
|
31
|
+
<i class="el-image-viewer__actions__divider"></i>
|
|
32
|
+
<i class="el-icon-refresh-left" @click.stop="handleActions('anticlocelise')"></i>
|
|
33
|
+
<i class="el-icon-refresh-right" @click.stop="handleActions('clocelise')"></i>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<!-- CANVAS -->
|
|
37
|
+
<div class="el-image-viewer__canvas">
|
|
38
|
+
<img
|
|
39
|
+
v-for="(url, i) in urlList"
|
|
40
|
+
v-if="i === index"
|
|
41
|
+
ref="img"
|
|
42
|
+
class="el-image-viewer__img"
|
|
43
|
+
:key="url"
|
|
44
|
+
:src="currentImg"
|
|
45
|
+
:style="imgStyle"
|
|
46
|
+
@load="handleImgLoad"
|
|
47
|
+
@error="handleImgError"
|
|
48
|
+
@mousedown="handleMouseDown">
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</transition>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script>
|
|
55
|
+
import { on, off } from 'element-ui/src/utils/dom';
|
|
56
|
+
import { rafThrottle, isFirefox } from 'element-ui/src/utils/util';
|
|
57
|
+
|
|
58
|
+
const Mode = {
|
|
59
|
+
CONTAIN: {
|
|
60
|
+
name: 'contain',
|
|
61
|
+
icon: 'el-icon-full-screen'
|
|
62
|
+
},
|
|
63
|
+
ORIGINAL: {
|
|
64
|
+
name: 'original',
|
|
65
|
+
icon: 'el-icon-c-scale-to-original'
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const mousewheelEventName = isFirefox() ? 'DOMMouseScroll' : 'mousewheel';
|
|
70
|
+
|
|
71
|
+
export default {
|
|
72
|
+
name: 'elImageViewer',
|
|
73
|
+
|
|
74
|
+
props: {
|
|
75
|
+
baseUrl: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: ""
|
|
78
|
+
},
|
|
79
|
+
urlList: {
|
|
80
|
+
type: Array,
|
|
81
|
+
default: () => []
|
|
82
|
+
},
|
|
83
|
+
zIndex: {
|
|
84
|
+
type: Number,
|
|
85
|
+
default: 2000
|
|
86
|
+
},
|
|
87
|
+
onSwitch: {
|
|
88
|
+
type: Function,
|
|
89
|
+
default: () => {}
|
|
90
|
+
},
|
|
91
|
+
onClose: {
|
|
92
|
+
type: Function,
|
|
93
|
+
default: () => {}
|
|
94
|
+
},
|
|
95
|
+
initialIndex: {
|
|
96
|
+
type: Number,
|
|
97
|
+
default: 0
|
|
98
|
+
},
|
|
99
|
+
infiniteLoop: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
data() {
|
|
106
|
+
return {
|
|
107
|
+
index: this.initialIndex,
|
|
108
|
+
isShow: false,
|
|
109
|
+
infinite: this.infiniteLoop,
|
|
110
|
+
loading: false,
|
|
111
|
+
mode: Mode.CONTAIN,
|
|
112
|
+
transform: {
|
|
113
|
+
scale: 1,
|
|
114
|
+
deg: 0,
|
|
115
|
+
offsetX: 0,
|
|
116
|
+
offsetY: 0,
|
|
117
|
+
enableTransition: false
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
computed: {
|
|
122
|
+
isSingle() {
|
|
123
|
+
return this.urlList.length <= 1;
|
|
124
|
+
},
|
|
125
|
+
isFirst() {
|
|
126
|
+
return this.index === 0;
|
|
127
|
+
},
|
|
128
|
+
isLast() {
|
|
129
|
+
return this.index === this.urlList.length - 1;
|
|
130
|
+
},
|
|
131
|
+
currentImg() {
|
|
132
|
+
return this.baseUrl + this.urlList[this.index];
|
|
133
|
+
},
|
|
134
|
+
imgStyle() {
|
|
135
|
+
const { scale, deg, offsetX, offsetY, enableTransition } = this.transform;
|
|
136
|
+
const style = {
|
|
137
|
+
// transform: `scale(${scale * window.devicePixelRatio}) rotate(${deg}deg)`, // 解决手机屏幕放大问题
|
|
138
|
+
transform: `scale(${scale * 1}) rotate(${deg}deg)`,
|
|
139
|
+
transition: enableTransition ? 'transform .3s' : '',
|
|
140
|
+
'margin-left': `${offsetX}px`,
|
|
141
|
+
'margin-top': `${offsetY}px`
|
|
142
|
+
};
|
|
143
|
+
if (this.mode === Mode.CONTAIN) {
|
|
144
|
+
style.maxWidth = style.maxHeight = `80%`;
|
|
145
|
+
}
|
|
146
|
+
return style;
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
watch: {
|
|
150
|
+
index: {
|
|
151
|
+
handler: function(val) {
|
|
152
|
+
this.reset();
|
|
153
|
+
this.onSwitch(val);
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
currentImg(val) {
|
|
157
|
+
this.$nextTick(_ => {
|
|
158
|
+
const $img = this.$refs.img[0];
|
|
159
|
+
if (!$img.complete) {
|
|
160
|
+
this.loading = true;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
methods: {
|
|
166
|
+
hide() {
|
|
167
|
+
this.deviceSupportUninstall();
|
|
168
|
+
this.onClose();
|
|
169
|
+
},
|
|
170
|
+
deviceSupportInstall() {
|
|
171
|
+
this._keyDownHandler = rafThrottle(e => {
|
|
172
|
+
const keyCode = e.keyCode;
|
|
173
|
+
switch (keyCode) {
|
|
174
|
+
// ESC
|
|
175
|
+
case 27:
|
|
176
|
+
this.hide();
|
|
177
|
+
break;
|
|
178
|
+
// SPACE
|
|
179
|
+
case 32:
|
|
180
|
+
this.toggleMode();
|
|
181
|
+
break;
|
|
182
|
+
// LEFT_ARROW
|
|
183
|
+
case 37:
|
|
184
|
+
this.prev();
|
|
185
|
+
break;
|
|
186
|
+
// UP_ARROW
|
|
187
|
+
case 38:
|
|
188
|
+
this.handleActions('zoomIn');
|
|
189
|
+
break;
|
|
190
|
+
// RIGHT_ARROW
|
|
191
|
+
case 39:
|
|
192
|
+
this.next();
|
|
193
|
+
break;
|
|
194
|
+
// DOWN_ARROW
|
|
195
|
+
case 40:
|
|
196
|
+
this.handleActions('zoomOut');
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
this._mouseWheelHandler = rafThrottle(e => {
|
|
201
|
+
const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
|
|
202
|
+
if (delta > 0) {
|
|
203
|
+
this.handleActions('zoomIn', {
|
|
204
|
+
zoomRate: 0.015,
|
|
205
|
+
enableTransition: false
|
|
206
|
+
});
|
|
207
|
+
} else {
|
|
208
|
+
this.handleActions('zoomOut', {
|
|
209
|
+
zoomRate: 0.015,
|
|
210
|
+
enableTransition: false
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
on(document, 'keydown', this._keyDownHandler);
|
|
215
|
+
on(document, mousewheelEventName, this._mouseWheelHandler);
|
|
216
|
+
},
|
|
217
|
+
deviceSupportUninstall() {
|
|
218
|
+
off(document, 'keydown', this._keyDownHandler);
|
|
219
|
+
off(document, mousewheelEventName, this._mouseWheelHandler);
|
|
220
|
+
this._keyDownHandler = null;
|
|
221
|
+
this._mouseWheelHandler = null;
|
|
222
|
+
},
|
|
223
|
+
handleImgLoad(e) {
|
|
224
|
+
this.loading = false;
|
|
225
|
+
},
|
|
226
|
+
handleImgError(e) {
|
|
227
|
+
this.loading = false;
|
|
228
|
+
e.target.alt = '加载失败';
|
|
229
|
+
},
|
|
230
|
+
handleMouseDown(e) {
|
|
231
|
+
if (this.loading || e.button !== 0) return;
|
|
232
|
+
|
|
233
|
+
const { offsetX, offsetY } = this.transform;
|
|
234
|
+
const startX = e.pageX;
|
|
235
|
+
const startY = e.pageY;
|
|
236
|
+
this._dragHandler = rafThrottle(ev => {
|
|
237
|
+
this.transform.offsetX = offsetX + ev.pageX - startX;
|
|
238
|
+
this.transform.offsetY = offsetY + ev.pageY - startY;
|
|
239
|
+
});
|
|
240
|
+
on(document, 'mousemove', this._dragHandler);
|
|
241
|
+
on(document, 'mouseup', ev => {
|
|
242
|
+
off(document, 'mousemove', this._dragHandler);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
e.preventDefault();
|
|
246
|
+
},
|
|
247
|
+
reset() {
|
|
248
|
+
this.transform = {
|
|
249
|
+
scale: 1,
|
|
250
|
+
deg: 0,
|
|
251
|
+
offsetX: 0,
|
|
252
|
+
offsetY: 0,
|
|
253
|
+
enableTransition: false
|
|
254
|
+
};
|
|
255
|
+
},
|
|
256
|
+
toggleMode() {
|
|
257
|
+
if (this.loading) return;
|
|
258
|
+
|
|
259
|
+
const modeNames = Object.keys(Mode);
|
|
260
|
+
const modeValues = Object.values(Mode);
|
|
261
|
+
const index = modeValues.indexOf(this.mode);
|
|
262
|
+
const nextIndex = (index + 1) % modeNames.length;
|
|
263
|
+
this.mode = Mode[modeNames[nextIndex]];
|
|
264
|
+
this.reset();
|
|
265
|
+
},
|
|
266
|
+
prev() {
|
|
267
|
+
if (this.isFirst && !this.infinite) return;
|
|
268
|
+
const len = this.urlList.length;
|
|
269
|
+
this.index = (this.index - 1 + len) % len;
|
|
270
|
+
},
|
|
271
|
+
next() {
|
|
272
|
+
if (this.isLast && !this.infinite) return;
|
|
273
|
+
const len = this.urlList.length;
|
|
274
|
+
this.index = (this.index + 1) % len;
|
|
275
|
+
},
|
|
276
|
+
handleActions(action, options = {}) {
|
|
277
|
+
if (this.loading) return;
|
|
278
|
+
const { zoomRate, rotateDeg, enableTransition } = {
|
|
279
|
+
zoomRate: 0.2,
|
|
280
|
+
rotateDeg: 90,
|
|
281
|
+
enableTransition: true,
|
|
282
|
+
...options
|
|
283
|
+
};
|
|
284
|
+
const { transform } = this;
|
|
285
|
+
switch (action) {
|
|
286
|
+
case 'zoomOut':
|
|
287
|
+
if (transform.scale > 0.2) {
|
|
288
|
+
transform.scale = parseFloat((transform.scale - zoomRate).toFixed(3));
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
case 'zoomIn':
|
|
292
|
+
if (transform.scale < 10) {
|
|
293
|
+
transform.scale = parseFloat((transform.scale + zoomRate).toFixed(3));
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
case 'clocelise':
|
|
297
|
+
transform.deg += rotateDeg;
|
|
298
|
+
break;
|
|
299
|
+
case 'anticlocelise':
|
|
300
|
+
transform.deg -= rotateDeg;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
transform.enableTransition = enableTransition;
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
mounted() {
|
|
307
|
+
this.deviceSupportInstall();
|
|
308
|
+
// add tabindex then wrapper can be focusable via Javascript
|
|
309
|
+
// focus wrapper so arrow key can't cause inner scroll behavior underneath
|
|
310
|
+
this.$refs['el-image-viewer__wrapper'].focus();
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
</script>
|
|
314
|
+
<style scoped lang="scss">
|
|
315
|
+
.fix_close{
|
|
316
|
+
>i{
|
|
317
|
+
position: relative;
|
|
318
|
+
right: 18px;
|
|
319
|
+
top: 18px;
|
|
320
|
+
}
|
|
321
|
+
&:hover{
|
|
322
|
+
background: #409EFF;
|
|
323
|
+
}
|
|
324
|
+
height: 100px;
|
|
325
|
+
width: 100px;
|
|
326
|
+
border-radius: 50px;
|
|
327
|
+
right: -50px;
|
|
328
|
+
top: -50px;
|
|
329
|
+
background: #606266;
|
|
330
|
+
font-size: 23px;
|
|
331
|
+
color: #fff;
|
|
332
|
+
}
|
|
333
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -23,16 +23,22 @@ import Card from './components/card'
|
|
|
23
23
|
import CardItem from './components/card-item'
|
|
24
24
|
import ConfigProvider from './components/config-provider'
|
|
25
25
|
import Text from './components/text'
|
|
26
|
+
import Chart from './components/chart' // Chart 组件
|
|
27
|
+
import GridBox from './components/grid-box'
|
|
28
|
+
import DatePicker from './components/date-picker'
|
|
26
29
|
|
|
27
30
|
// 存储组件列表
|
|
28
31
|
const components = [
|
|
29
32
|
Button,
|
|
30
33
|
Input,
|
|
31
34
|
FlexBox,
|
|
32
|
-
Card,
|
|
35
|
+
Card,
|
|
33
36
|
CardItem,
|
|
34
37
|
ConfigProvider,
|
|
35
|
-
Text
|
|
38
|
+
Text,
|
|
39
|
+
Chart,
|
|
40
|
+
GridBox,
|
|
41
|
+
DatePicker
|
|
36
42
|
]
|
|
37
43
|
|
|
38
44
|
|
|
@@ -99,6 +105,9 @@ export default {
|
|
|
99
105
|
Text
|
|
100
106
|
}
|
|
101
107
|
|
|
108
|
+
// Chart 组件按需导出(使用时需自行安装 echarts 依赖)
|
|
109
|
+
export { default as Chart } from './components/chart'
|
|
110
|
+
|
|
102
111
|
// 导出工具函数和变量
|
|
103
112
|
export {
|
|
104
113
|
utils,
|