@mixd-id/web-scaffold 0.1.2301231343 → 0.1.2301231345
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
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<div :class="$style.inner">
|
|
4
4
|
<span v-if="images && images.length && images.length > 0" v-for="image in images" :key="image">
|
|
5
5
|
<a v-if="image.target && image.target.indexOf('://') >= 0" :href="image.target" @click="checkClick">
|
|
6
|
-
<Image :src="image.imageUrl" :
|
|
6
|
+
<Image :src="image.imageUrl" :class="imageClass" />
|
|
7
7
|
</a>
|
|
8
8
|
<router-link v-if="image.target" :to="scrolling ? '' : image.target">
|
|
9
|
-
<Image :src="image.imageUrl" :
|
|
9
|
+
<Image :src="image.imageUrl" :class="imageClass"/>
|
|
10
10
|
</router-link>
|
|
11
|
-
<Image v-else :src="image.imageUrl" :
|
|
11
|
+
<Image v-else :src="image.imageUrl" :class="imageClass" />
|
|
12
12
|
</span>
|
|
13
13
|
<div v-else :class="imageClass" class="bg-gray-200 animate-pulse"></div>
|
|
14
14
|
</div>
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
|
|
4
|
+
<slot v-if="display >= 4 && $slots.day" name="day" :day="day"></slot>
|
|
5
|
+
<div ref="day" v-else-if="display >= 4" :class="$style.lap">
|
|
6
|
+
<div></div>
|
|
7
|
+
<div></div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<slot v-if="display >= 3 && $slots.hour" name="hour" :hour="hour"></slot>
|
|
11
|
+
<div ref="hour" v-else-if="display >= 3" :class="$style.lap">
|
|
12
|
+
<div></div>
|
|
13
|
+
<div></div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div>:</div>
|
|
17
|
+
|
|
18
|
+
<slot v-if="display >= 2 && $slots.minute" name="minute" :minute="minute"></slot>
|
|
19
|
+
<div ref="minute" v-else-if="display >= 2" :class="$style.lap">
|
|
20
|
+
<div></div>
|
|
21
|
+
<div></div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div>:</div>
|
|
25
|
+
|
|
26
|
+
<slot v-if="display >= 1 && $slots.second" name="second" :second="second"></slot>
|
|
27
|
+
<div ref="second" v-else-if="display >= 1" :class="$style.lap">
|
|
28
|
+
<div></div>
|
|
29
|
+
<div></div>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
|
|
37
|
+
import debounce from "lodash/debounce";
|
|
38
|
+
|
|
39
|
+
export default{
|
|
40
|
+
|
|
41
|
+
props: {
|
|
42
|
+
|
|
43
|
+
display: {
|
|
44
|
+
type: [ String, Number ], // default: 3
|
|
45
|
+
default: 3
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
value: [ String, Number ] // value in second
|
|
49
|
+
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
computed:{
|
|
53
|
+
|
|
54
|
+
day(){
|
|
55
|
+
return Math.floor(this.timer / 86400).toString().padStart(2, '0')
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
hour(){
|
|
59
|
+
return (Math.floor(this.timer / 3600) % 24).toString().padStart(2, '0')
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
minute(){
|
|
63
|
+
return (Math.floor(this.timer / 60) % 60).toString().padStart(2, '0')
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
second(){
|
|
67
|
+
return (this.timer % 60).toString().padStart(2, '0')
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
data(){
|
|
73
|
+
return {
|
|
74
|
+
timer: null,
|
|
75
|
+
timeoutId: null,
|
|
76
|
+
beforeSecond: null,
|
|
77
|
+
afterSecond: null,
|
|
78
|
+
tick: false
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
mounted() {
|
|
83
|
+
this.start()
|
|
84
|
+
|
|
85
|
+
if(this.$refs.second) this.$refs.second.addEventListener('transitionend', this.onSecondEnd)
|
|
86
|
+
if(this.$refs.minute) this.$refs.minute.addEventListener('transitionend', this.onMinuteEnd)
|
|
87
|
+
if(this.$refs.hour) this.$refs.hour.addEventListener('transitionend', this.onHourEnd)
|
|
88
|
+
if(this.$refs.day) this.$refs.day.addEventListener('transitionend', this.onDayEnd)
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
methods: {
|
|
92
|
+
|
|
93
|
+
onSecondEnd: debounce(function (e){
|
|
94
|
+
this.$refs.second.insertBefore(this.$refs.second.childNodes[1], this.$refs.second.childNodes[0])
|
|
95
|
+
this.$refs.second.classList.remove(this.$style.tick)
|
|
96
|
+
this.$refs.second.childNodes[0].innerHTML = ''
|
|
97
|
+
}, 100),
|
|
98
|
+
|
|
99
|
+
onMinuteEnd: debounce(function (e){
|
|
100
|
+
this.$refs.minute.insertBefore(this.$refs.minute.childNodes[1], this.$refs.minute.childNodes[0])
|
|
101
|
+
this.$refs.minute.classList.remove(this.$style.tick)
|
|
102
|
+
this.$refs.minute.childNodes[0].innerHTML = ''
|
|
103
|
+
}, 100),
|
|
104
|
+
|
|
105
|
+
onHourEnd: debounce(function (e){
|
|
106
|
+
this.$refs.hour.insertBefore(this.$refs.hour.childNodes[1], this.$refs.hour.childNodes[0])
|
|
107
|
+
this.$refs.hour.classList.remove(this.$style.tick)
|
|
108
|
+
this.$refs.hour.childNodes[0].innerHTML = ''
|
|
109
|
+
}, 100),
|
|
110
|
+
|
|
111
|
+
onDayEnd: debounce(function (e){
|
|
112
|
+
this.$refs.day.insertBefore(this.$refs.day.childNodes[1], this.$refs.day.childNodes[0])
|
|
113
|
+
this.$refs.day.classList.remove(this.$style.tick)
|
|
114
|
+
this.$refs.day.childNodes[0].innerHTML = ''
|
|
115
|
+
}, 100),
|
|
116
|
+
|
|
117
|
+
setInitial(){
|
|
118
|
+
if(this.$refs.day) this.$refs.day.lastElementChild.innerHTML = '1 hari'
|
|
119
|
+
if(this.$refs.hour) this.$refs.hour.lastElementChild.innerHTML = (Math.floor(this.timer / 3600) % 24).toString().padStart(2, '0')
|
|
120
|
+
if(this.$refs.minute) this.$refs.minute.lastElementChild.innerHTML = (Math.floor(this.timer / 60) % 60).toString().padStart(2, '0')
|
|
121
|
+
if(this.$refs.second) this.$refs.second.lastElementChild.innerHTML = (this.timer % 60).toString().padStart(2, '0')
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
start(){
|
|
125
|
+
|
|
126
|
+
this.timer = this.value
|
|
127
|
+
|
|
128
|
+
this.setInitial()
|
|
129
|
+
|
|
130
|
+
this.timeoutId = window.setInterval(() => {
|
|
131
|
+
this.timer--
|
|
132
|
+
this.tick = true
|
|
133
|
+
|
|
134
|
+
if(this.timer <= 0){
|
|
135
|
+
window.clearTimeout(this.timeoutId)
|
|
136
|
+
}
|
|
137
|
+
}, 1000)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
watch: {
|
|
143
|
+
|
|
144
|
+
value(to){
|
|
145
|
+
this.start()
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
day(to, from){
|
|
149
|
+
if(!this.tick || !this.$refs.day) return
|
|
150
|
+
this.$refs.day.firstElementChild.innerHTML = to > 0 ? to + ' hari' : ''
|
|
151
|
+
this.$refs.day.lastElementChild.innerHTML = from + ' hari'
|
|
152
|
+
this.$refs.day.classList.add(this.$style.tick)
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
hour(to, from){
|
|
156
|
+
if(!this.tick) return
|
|
157
|
+
this.$refs.hour.firstElementChild.innerHTML = to
|
|
158
|
+
this.$refs.hour.lastElementChild.innerHTML = from
|
|
159
|
+
this.$refs.hour.classList.add(this.$style.tick)
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
minute(to, from){
|
|
163
|
+
if(!this.tick) return
|
|
164
|
+
this.$refs.minute.firstElementChild.innerHTML = to
|
|
165
|
+
this.$refs.minute.lastElementChild.innerHTML = from
|
|
166
|
+
this.$refs.minute.classList.add(this.$style.tick)
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
second(to, from){
|
|
170
|
+
if(!this.tick) return
|
|
171
|
+
this.$refs.second.firstElementChild.innerHTML = to
|
|
172
|
+
this.$refs.second.lastElementChild.innerHTML = from
|
|
173
|
+
this.$refs.second.classList.add(this.$style.tick)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<style module>
|
|
182
|
+
|
|
183
|
+
.comp{
|
|
184
|
+
@apply flex flex-row gap-2;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.lap{
|
|
188
|
+
@apply relative overflow-hidden bg-gray-200 min-w-[1.8rem] rounded-lg text-center;
|
|
189
|
+
}
|
|
190
|
+
.lap>*{
|
|
191
|
+
@apply whitespace-nowrap font-bold;
|
|
192
|
+
}
|
|
193
|
+
.lap>*:first-child{
|
|
194
|
+
@apply absolute top-0 left-0 right-0 text-center;
|
|
195
|
+
transform: translate3d(0, -1.3rem, 0);
|
|
196
|
+
}
|
|
197
|
+
.lap>*:last-child{
|
|
198
|
+
transform: translate3d(0, 0, 0);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.tick{
|
|
202
|
+
}
|
|
203
|
+
.tick>*{
|
|
204
|
+
transition: transform 300ms ease;
|
|
205
|
+
}
|
|
206
|
+
.tick>*:first-child{
|
|
207
|
+
transform: translate3d(0, 0, 0);
|
|
208
|
+
}
|
|
209
|
+
.tick>*:last-child{
|
|
210
|
+
transform: translate3d(0, 1.3rem, 0);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
</style>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
|
|
4
|
+
<div class="absolute top-0 right-0 bg-black/50 rounded-lg flex flex-row gap-2 items-center m-1">
|
|
5
|
+
<button type="button" class="p-1" @click="prev">Prev</button>
|
|
6
|
+
<button type="button" class="p-1" @click="next">Next</button>
|
|
7
|
+
<button type="button" class="p-1" @click="toggleMode" :class="mode === 1 ? 'bg-red-500' : 'bg-green-500'">360</button>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<img v-if="mode === 1" :src="staticSrc" class="pointer-events-none" style="user-select: none" />
|
|
11
|
+
<div v-else-if="mode === 2 && status === 1">Loading...</div>
|
|
12
|
+
<div v-else-if="mode === 2 && status === 2">
|
|
13
|
+
<img v-for="(path, idx) in src" :src="path" :class="idx === index ? '' : 'hidden'"
|
|
14
|
+
class="pointer-events-none" style="user-select: none"/>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
|
|
21
|
+
export default{
|
|
22
|
+
|
|
23
|
+
props: {
|
|
24
|
+
|
|
25
|
+
src: Array,
|
|
26
|
+
|
|
27
|
+
staticSrc: String
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
data(){
|
|
32
|
+
return {
|
|
33
|
+
status: 0,
|
|
34
|
+
index: 0,
|
|
35
|
+
mode: 1,
|
|
36
|
+
startX: null
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
mounted(){
|
|
41
|
+
this.load()
|
|
42
|
+
|
|
43
|
+
this.$el.addEventListener('mousedown', this.onMouseDown)
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
methods: {
|
|
47
|
+
|
|
48
|
+
load(){
|
|
49
|
+
|
|
50
|
+
this.status = 1
|
|
51
|
+
let loadedCount = 0
|
|
52
|
+
|
|
53
|
+
const loadComplete = () => {
|
|
54
|
+
loadedCount++
|
|
55
|
+
|
|
56
|
+
if(loadedCount >= this.src.length){
|
|
57
|
+
this.status = 2
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
this.src.forEach((src) => {
|
|
62
|
+
var img = new Image()
|
|
63
|
+
img.addEventListener('load', () => {
|
|
64
|
+
loadComplete()
|
|
65
|
+
})
|
|
66
|
+
img.addEventListener('error', () => {
|
|
67
|
+
loadComplete()
|
|
68
|
+
})
|
|
69
|
+
img.src = src
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
prev(){
|
|
75
|
+
this.index--
|
|
76
|
+
if(this.index < 0)
|
|
77
|
+
this.index = this.src.length - 1
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
next(){
|
|
81
|
+
this.index++
|
|
82
|
+
if(this.index >= this.src.length)
|
|
83
|
+
this.index = 0
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
toggleMode(){
|
|
87
|
+
this.mode = this.mode === 1 ? 2 : 1
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
onMouseMove(e){
|
|
91
|
+
const curX = e.touches ? e.touches[0].clientX : e.clientX
|
|
92
|
+
const distance = curX - this.startX
|
|
93
|
+
if(distance > 5){
|
|
94
|
+
this.next()
|
|
95
|
+
this.startX = curX
|
|
96
|
+
}
|
|
97
|
+
else if(distance < -5){
|
|
98
|
+
this.prev()
|
|
99
|
+
this.startX = curX
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
onMouseUp(){
|
|
104
|
+
window.removeEventListener('mousemove', this.onMouseMove)
|
|
105
|
+
window.removeEventListener('mouseup', this.onMouseUp)
|
|
106
|
+
this.startX = null
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
onMouseDown(e){
|
|
110
|
+
|
|
111
|
+
if(this.mode !== 2) return
|
|
112
|
+
|
|
113
|
+
this.startX = e.touches ? e.touches[0].clientX : e.clientX
|
|
114
|
+
window.addEventListener('mousemove', this.onMouseMove)
|
|
115
|
+
window.addEventListener('mouseup', this.onMouseUp)
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
watch: {
|
|
122
|
+
|
|
123
|
+
src(to){
|
|
124
|
+
console.log('src', to)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<style module>
|
|
135
|
+
|
|
136
|
+
.comp{
|
|
137
|
+
@apply relative;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -156,6 +156,7 @@ export default{
|
|
|
156
156
|
app.component('ChatTyping', defineAsyncComponent(() => import("./components/ChatTyping.vue")))
|
|
157
157
|
app.component('Checkbox', defineAsyncComponent(() => import("./components/Checkbox.vue")))
|
|
158
158
|
app.component('CopyToClipboard', defineAsyncComponent(() => import("./components/CopyToClipboard.vue")))
|
|
159
|
+
app.component('Countdown', defineAsyncComponent(() => import("./components/Countdown.vue")))
|
|
159
160
|
app.component('Dropdown', defineAsyncComponent(() => import("./components/Dropdown.vue")))
|
|
160
161
|
app.component('Datepicker', defineAsyncComponent(() => import("./components/Datepicker.vue")))
|
|
161
162
|
app.component('ErrorText', defineAsyncComponent(() => import("./components/ErrorText.vue")))
|
|
@@ -164,6 +165,7 @@ export default{
|
|
|
164
165
|
app.component('Ahref', defineAsyncComponent(() => import("./components/Ahref.vue")))
|
|
165
166
|
app.component('Switch', defineAsyncComponent(() => import("./components/Switch.vue")))
|
|
166
167
|
app.component('Image', defineAsyncComponent(() => import("./components/Image.vue")))
|
|
168
|
+
app.component('Image360', defineAsyncComponent(() => import("./components/Image360.vue")))
|
|
167
169
|
app.component('ImagePreview', defineAsyncComponent(() => import("./components/ImagePreview.vue")))
|
|
168
170
|
app.component('ImageFullScreen', defineAsyncComponent(() => import("./components/ImageFullScreen.vue")))
|
|
169
171
|
app.component('ImportModal', defineAsyncComponent(() => import("./components/ImportModal.vue")))
|