@mixd-id/web-scaffold 0.1.2301231317 → 0.1.2301231318
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/package.json
CHANGED
|
@@ -123,9 +123,7 @@ export default{
|
|
|
123
123
|
})
|
|
124
124
|
left *= -1
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if(noAnimation){
|
|
126
|
+
if(!noAnimation){
|
|
129
127
|
this.$el.firstElementChild.addEventListener('transitionend', function(){
|
|
130
128
|
this.classList.remove('transition-carousel')
|
|
131
129
|
})
|
package/src/components/Image.vue
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
2
|
+
<div :class="computedOuterClass">
|
|
3
3
|
<img :class="computedClass" :src="actualSrc" ref="img" @click="onClick" :style="imageStyle"/>
|
|
4
4
|
<input v-if="Boolean(editable)" class="hidden" type="file" accept="image/*" ref="file" @change="onChange"/>
|
|
5
5
|
<slot></slot>
|
|
6
|
+
<div :class="$style.isLoading" v-if="isLoading">
|
|
7
|
+
<svg class="animate-spin aspect-square w-[15%] text-primary" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
|
|
8
|
+
</div>
|
|
6
9
|
</div>
|
|
7
10
|
</template>
|
|
8
11
|
|
|
@@ -42,13 +45,20 @@ export default{
|
|
|
42
45
|
|
|
43
46
|
defaultSrc: {
|
|
44
47
|
type: String,
|
|
45
|
-
|
|
48
|
+
default: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsb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OC41OTE0NCA5Ljg5MDgxIDkuMjEzOTUgMTAuMzI0OUM5LjIxOTUxIDEwLjMyODggOS4yMjUwNSAxMC4zMzI3IDkuMjMwNTcgMTAuMzM2N0M5LjMxMzMyIDEwLjM5NjEgOS4zOTE0MSAxMC40NjUgOS40NjMzMiAxMC41NDM1TDE4LjU5MDEgMjAuNUg1WiIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iLjA4Ii8+CjxjaXJjbGUgY3g9IjE3IiBjeT0iNyIgcj0iMS4yNSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLW9wYWNpdHk9Ii4wOCIgc3Ryb2tlLXdpZHRoPSIxLjUiLz4KPC9zdmc+Cg=="
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
},
|
|
49
52
|
|
|
50
53
|
computed:{
|
|
51
54
|
|
|
55
|
+
computedOuterClass(){
|
|
56
|
+
return [
|
|
57
|
+
this.$style.img
|
|
58
|
+
]
|
|
59
|
+
.join(' ')
|
|
60
|
+
},
|
|
61
|
+
|
|
52
62
|
computedClass(){
|
|
53
63
|
return [
|
|
54
64
|
this.class
|
|
@@ -58,7 +68,8 @@ export default{
|
|
|
58
68
|
|
|
59
69
|
imageStyle(){
|
|
60
70
|
return {
|
|
61
|
-
...(this.aspectRatio ? { 'aspect-ratio':this.aspectRatio } : {})
|
|
71
|
+
...(this.aspectRatio ? { 'aspect-ratio':this.aspectRatio } : {}),
|
|
72
|
+
...(this.actualSrc ? {} : { visibility:'hidden' })
|
|
62
73
|
}
|
|
63
74
|
}
|
|
64
75
|
|
|
@@ -67,7 +78,9 @@ export default{
|
|
|
67
78
|
data(){
|
|
68
79
|
return {
|
|
69
80
|
visible: 0,
|
|
70
|
-
|
|
81
|
+
isLoading: false,
|
|
82
|
+
actualSrc: null,
|
|
83
|
+
loaded: false
|
|
71
84
|
}
|
|
72
85
|
},
|
|
73
86
|
|
|
@@ -96,8 +109,12 @@ export default{
|
|
|
96
109
|
},
|
|
97
110
|
|
|
98
111
|
async loadSrc(){
|
|
112
|
+
|
|
113
|
+
this.loaded = false
|
|
114
|
+
|
|
99
115
|
if(typeof this.src === 'string') {
|
|
100
116
|
if (this.src.startsWith('data:image')) {
|
|
117
|
+
this.loaded = true
|
|
101
118
|
this.actualSrc = this.src
|
|
102
119
|
}
|
|
103
120
|
else{
|
|
@@ -117,33 +134,52 @@ export default{
|
|
|
117
134
|
|
|
118
135
|
var img = new Image()
|
|
119
136
|
img.addEventListener('load', () => {
|
|
137
|
+
this.loaded = true
|
|
120
138
|
this.actualSrc = img.src
|
|
139
|
+
this.isLoading = false
|
|
140
|
+
})
|
|
141
|
+
img.addEventListener('error', () => {
|
|
142
|
+
this.loaded = true
|
|
143
|
+
this.actualSrc = this.defaultSrc
|
|
144
|
+
this.isLoading = false
|
|
121
145
|
})
|
|
122
|
-
img.addEventListener('error', () => {})
|
|
123
146
|
img.src = src[screens[b]]
|
|
124
|
-
|
|
125
|
-
//this.actualSrc = src[screens[b]]
|
|
126
147
|
}
|
|
127
148
|
}
|
|
128
149
|
}
|
|
129
150
|
}
|
|
130
|
-
|
|
131
151
|
else if(this.src instanceof File){
|
|
132
152
|
var reader = new FileReader();
|
|
153
|
+
|
|
133
154
|
reader.addEventListener('load', () => {
|
|
155
|
+
this.loaded = true
|
|
134
156
|
this.actualSrc = reader.result
|
|
157
|
+
this.isLoading = false
|
|
135
158
|
}, false)
|
|
159
|
+
|
|
160
|
+
reader.addEventListener('error', () => {
|
|
161
|
+
this.loaded = true
|
|
162
|
+
this.actualSrc = this.defaultSrc
|
|
163
|
+
this.isLoading = false
|
|
164
|
+
})
|
|
165
|
+
|
|
136
166
|
reader.readAsDataURL(this.src)
|
|
137
167
|
}
|
|
138
|
-
|
|
139
168
|
}
|
|
140
169
|
|
|
141
170
|
},
|
|
142
171
|
|
|
143
172
|
watch:{
|
|
144
173
|
|
|
145
|
-
src(){
|
|
174
|
+
src(to){
|
|
146
175
|
this.loadSrc()
|
|
176
|
+
|
|
177
|
+
window.setTimeout(() => {
|
|
178
|
+
if(!this.loaded){
|
|
179
|
+
this.actualSrc = null
|
|
180
|
+
this.isLoading = true
|
|
181
|
+
}
|
|
182
|
+
}, 200)
|
|
147
183
|
}
|
|
148
184
|
|
|
149
185
|
}
|
|
@@ -154,7 +190,12 @@ export default{
|
|
|
154
190
|
<style module>
|
|
155
191
|
|
|
156
192
|
.img{
|
|
157
|
-
@apply relative
|
|
193
|
+
@apply relative;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.isLoading{
|
|
197
|
+
@apply absolute top-0 left-0 right-0 bottom-0;
|
|
198
|
+
@apply flex items-center justify-center;
|
|
158
199
|
}
|
|
159
200
|
|
|
160
201
|
|