@mixd-id/web-scaffold 0.1.230406212 → 0.1.230406214
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 +1 -1
- package/src/components/Carousel.vue +11 -11
- package/src/components/Countdown.vue +16 -8
- package/src/components/Modal.vue +16 -10
- package/src/components/YoutubeVideo.vue +121 -0
- package/src/index.js +2 -0
- package/src/widgets/WebPageBuilder.vue +2 -0
- package/src/widgets/YoutubeVideoSetting.vue +48 -0
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
|
-
<div v-if="items && items.length > 1" :class="$style.carouselNext" @click="next(
|
|
14
|
+
<div v-if="items && items.length > 1" :class="$style.carouselNext" @click="next(true)">
|
|
15
15
|
<slot name="next">
|
|
16
16
|
</slot>
|
|
17
17
|
</div>
|
|
@@ -105,7 +105,6 @@ export default{
|
|
|
105
105
|
watch:{
|
|
106
106
|
|
|
107
107
|
index(to){
|
|
108
|
-
this.setPosition()
|
|
109
108
|
this.$emit('change', to)
|
|
110
109
|
},
|
|
111
110
|
|
|
@@ -134,7 +133,7 @@ export default{
|
|
|
134
133
|
for(let curIndex = 0 ; curIndex < this.items.length ; curIndex++){
|
|
135
134
|
const item = this.$refs.inner.children[curIndex]
|
|
136
135
|
if(curIndex < index)
|
|
137
|
-
left += (item.clientWidth + gapPx)
|
|
136
|
+
left += (item.clientWidth + (!isNaN(gapPx) ? gapPx : 0))
|
|
138
137
|
}
|
|
139
138
|
|
|
140
139
|
left *= -1
|
|
@@ -146,7 +145,9 @@ export default{
|
|
|
146
145
|
this.$el.firstElementChild.classList.add('transition-carousel')
|
|
147
146
|
}
|
|
148
147
|
|
|
149
|
-
|
|
148
|
+
window.requestAnimationFrame(() => {
|
|
149
|
+
this.$el.firstElementChild.style.transform = `translate3d(${left}px, 0, 0)`
|
|
150
|
+
})
|
|
150
151
|
},
|
|
151
152
|
|
|
152
153
|
setIndex(index){
|
|
@@ -156,8 +157,7 @@ export default{
|
|
|
156
157
|
}
|
|
157
158
|
},
|
|
158
159
|
|
|
159
|
-
next(
|
|
160
|
-
|
|
160
|
+
next(useBack){
|
|
161
161
|
let index = this.index + 1
|
|
162
162
|
|
|
163
163
|
if(index >= this.items.length)
|
|
@@ -165,10 +165,10 @@ export default{
|
|
|
165
165
|
|
|
166
166
|
this.index = index
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
this.setPosition()
|
|
169
169
|
},
|
|
170
170
|
|
|
171
|
-
prev(
|
|
171
|
+
prev(){
|
|
172
172
|
|
|
173
173
|
let index = this.index - 1;
|
|
174
174
|
|
|
@@ -176,11 +176,11 @@ export default{
|
|
|
176
176
|
|
|
177
177
|
this.index = index
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
this.setPosition()
|
|
180
180
|
},
|
|
181
181
|
|
|
182
182
|
play(){
|
|
183
|
-
this.timeoutId = window.setTimeout(() => { this.next(true
|
|
183
|
+
this.timeoutId = window.setTimeout(() => { this.next(true); this.play() }, this.autoPlay)
|
|
184
184
|
},
|
|
185
185
|
|
|
186
186
|
stop(){
|
|
@@ -207,7 +207,7 @@ export default{
|
|
|
207
207
|
let ix
|
|
208
208
|
if((this.index === this.items.length - 1 && dx < 0) ||
|
|
209
209
|
(this.index === 0 && dx > 0)){
|
|
210
|
-
ix = parseInt(this._props['ix'] + (dx * .
|
|
210
|
+
ix = parseInt(this._props['ix'] + (dx * .19812))
|
|
211
211
|
}
|
|
212
212
|
else{
|
|
213
213
|
ix = parseInt(this._props['ix'] + dx)
|
|
@@ -188,32 +188,40 @@ export default{
|
|
|
188
188
|
if(!this.tick || !this.$refs.day) return
|
|
189
189
|
this.$refs.day.firstElementChild.innerHTML = to > 0 ? to + ' hari' : ''
|
|
190
190
|
this.$refs.day.lastElementChild.innerHTML = from + ' hari'
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
window.requestAnimationFrame(() => {
|
|
192
|
+
this.$refs.day.classList.add(this.$style.tick)
|
|
193
|
+
this.state[0] = 1
|
|
194
|
+
})
|
|
193
195
|
},
|
|
194
196
|
|
|
195
197
|
hour(to, from){
|
|
196
198
|
if(!this.tick) return
|
|
197
199
|
this.$refs.hour.firstElementChild.innerHTML = to
|
|
198
200
|
this.$refs.hour.lastElementChild.innerHTML = from
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
window.requestAnimationFrame(() => {
|
|
202
|
+
this.$refs.hour.classList.add(this.$style.tick)
|
|
203
|
+
this.state[1] = 1
|
|
204
|
+
})
|
|
201
205
|
},
|
|
202
206
|
|
|
203
207
|
minute(to, from){
|
|
204
208
|
if(!this.tick) return
|
|
205
209
|
this.$refs.minute.firstElementChild.innerHTML = to
|
|
206
210
|
this.$refs.minute.lastElementChild.innerHTML = from
|
|
207
|
-
|
|
208
|
-
|
|
211
|
+
window.requestAnimationFrame(() => {
|
|
212
|
+
this.$refs.minute.classList.add(this.$style.tick)
|
|
213
|
+
this.state[2] = 1
|
|
214
|
+
})
|
|
209
215
|
},
|
|
210
216
|
|
|
211
217
|
second(to, from){
|
|
212
218
|
if(!this.tick) return
|
|
213
219
|
this.$refs.second.firstElementChild.innerHTML = to
|
|
214
220
|
this.$refs.second.lastElementChild.innerHTML = from
|
|
215
|
-
|
|
216
|
-
|
|
221
|
+
window.requestAnimationFrame(() => {
|
|
222
|
+
this.$refs.second.classList.add(this.$style.tick)
|
|
223
|
+
this.state[3] = 1
|
|
224
|
+
})
|
|
217
225
|
}
|
|
218
226
|
}
|
|
219
227
|
|
package/src/components/Modal.vue
CHANGED
|
@@ -152,12 +152,14 @@ export default{
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
else{
|
|
155
|
-
this.$nextTick(() =>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this
|
|
160
|
-
|
|
155
|
+
this.$nextTick(() => {
|
|
156
|
+
this.onAfterLeave()
|
|
157
|
+
unRegisterModal(this)
|
|
158
|
+
|
|
159
|
+
if(this.mode === 'v-show') {
|
|
160
|
+
this.$emit('hide')
|
|
161
|
+
}
|
|
162
|
+
})
|
|
161
163
|
}
|
|
162
164
|
}
|
|
163
165
|
},
|
|
@@ -222,10 +224,16 @@ export default{
|
|
|
222
224
|
}
|
|
223
225
|
},
|
|
224
226
|
|
|
227
|
+
unmounted() {
|
|
228
|
+
this.setState(false)
|
|
229
|
+
},
|
|
230
|
+
|
|
225
231
|
watch:{
|
|
226
232
|
|
|
227
|
-
computedState
|
|
228
|
-
|
|
233
|
+
computedState: {
|
|
234
|
+
handler(to, from){
|
|
235
|
+
this.setState(to)
|
|
236
|
+
}
|
|
229
237
|
},
|
|
230
238
|
|
|
231
239
|
'$route.hash'(to){
|
|
@@ -251,8 +259,6 @@ export default{
|
|
|
251
259
|
})
|
|
252
260
|
},
|
|
253
261
|
|
|
254
|
-
|
|
255
|
-
|
|
256
262
|
}
|
|
257
263
|
|
|
258
264
|
</script>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp" :style="computedStyle">
|
|
3
|
+
<div id="player" :class="videoClass" class="relative" @click="loadVideo">
|
|
4
|
+
<Image :src="thumbnailUrl" :class="videoClass" />
|
|
5
|
+
<div class="absolute top-0 left-0 right-0 bottom-0 flex items-center justify-center">
|
|
6
|
+
<div class="bg-primary-500 cursor-pointer hover:bg-primary-600 p-3 px-4 rounded-lg">
|
|
7
|
+
<svg class="w-[16px] h-[16px] fill-white" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"/></svg>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
|
|
16
|
+
import { componentMixin } from '../mixin/component'
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export default{
|
|
20
|
+
|
|
21
|
+
inject: [ 'alert' ],
|
|
22
|
+
|
|
23
|
+
mixins: [ componentMixin ],
|
|
24
|
+
|
|
25
|
+
props: {
|
|
26
|
+
|
|
27
|
+
videoId: String
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
computed: {
|
|
32
|
+
|
|
33
|
+
videoUrl(){
|
|
34
|
+
return `https://www.youtube.com/embed/${this.videoId}?autoplay=1`
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
thumbnailUrl(){
|
|
38
|
+
return `https://img.youtube.com/vi/${this.videoId}/0.jpg`
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
videoClass(){
|
|
42
|
+
return [
|
|
43
|
+
this.$style.video,
|
|
44
|
+
/*this.width[0] ? `w-${this.width[0]}` : undefined,
|
|
45
|
+
this.width[1] ? `md:w-${this.width[1]}` : undefined,*/
|
|
46
|
+
]
|
|
47
|
+
.filter(_ => _)
|
|
48
|
+
.join(' ')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
methods: {
|
|
54
|
+
|
|
55
|
+
loadVideo(){
|
|
56
|
+
|
|
57
|
+
if(!('YT' in window)){
|
|
58
|
+
const script = document.createElement('script')
|
|
59
|
+
script.src = 'https://www.youtube.com/iframe_api'
|
|
60
|
+
document.head.appendChild(script)
|
|
61
|
+
}
|
|
62
|
+
else{
|
|
63
|
+
|
|
64
|
+
if(!this.player){
|
|
65
|
+
this.player = new YT.Player('player', {
|
|
66
|
+
videoId: this.videoId,
|
|
67
|
+
playerVars: {
|
|
68
|
+
autoplay: 1,
|
|
69
|
+
controls: 0,
|
|
70
|
+
rel: 0,
|
|
71
|
+
},
|
|
72
|
+
events: {
|
|
73
|
+
onReady: () => console.log('onReady'),
|
|
74
|
+
onStateChange: () => console.log('onStateChange'),
|
|
75
|
+
onAutoplayBlocked: () => this.alert('onAutoplayBlocked'),
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else{
|
|
80
|
+
this.player.loadVideoById(this.videoId)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
mounted() {
|
|
88
|
+
this.id = this.uniqid()
|
|
89
|
+
window.onYouTubeIframeAPIReady = () => {
|
|
90
|
+
this.loadVideo()
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
data(){
|
|
95
|
+
return {
|
|
96
|
+
id: null,
|
|
97
|
+
player: null,
|
|
98
|
+
start: false
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<style module>
|
|
107
|
+
|
|
108
|
+
.comp{
|
|
109
|
+
@apply flex flex-col;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.video{
|
|
113
|
+
@apply max-w-full;
|
|
114
|
+
aspect-ratio: 16 / 9;
|
|
115
|
+
width: 100%;
|
|
116
|
+
}
|
|
117
|
+
.video img{
|
|
118
|
+
@apply object-cover;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -428,6 +428,7 @@ export default{
|
|
|
428
428
|
app.component('TextBlock', defineAsyncComponent(() => import("./components/TextBlock.vue")))
|
|
429
429
|
app.component('TextEditor', defineAsyncComponent(() => import("./components/TextEditor.vue")))
|
|
430
430
|
app.component('DataList', defineAsyncComponent(() => import("./components/DataList.vue")))
|
|
431
|
+
app.component('YoutubeVideo', defineAsyncComponent(() => import("./components/YoutubeVideo.vue")))
|
|
431
432
|
|
|
432
433
|
app.component('AhrefSetting', defineAsyncComponent(() => import("./widgets/AhrefSetting.vue")))
|
|
433
434
|
app.component('ArticleSetting', defineAsyncComponent(() => import("./widgets/ArticleSetting.vue")))
|
|
@@ -477,5 +478,6 @@ export default{
|
|
|
477
478
|
app.component('WebTemplateCreator', defineAsyncComponent(() => import("./widgets/WebTemplateCreator.vue")))
|
|
478
479
|
app.component('ModalSetting', defineAsyncComponent(() => import("./widgets/ModalSetting.vue")))
|
|
479
480
|
app.component('DataListSetting', defineAsyncComponent(() => import("./widgets/DataListSetting.vue")))
|
|
481
|
+
app.component('YoutubeVideoSetting', defineAsyncComponent(() => import("./widgets/YoutubeVideoSetting.vue")))
|
|
480
482
|
}
|
|
481
483
|
}
|
|
@@ -1627,6 +1627,8 @@ export default{
|
|
|
1627
1627
|
|
|
1628
1628
|
{ type:'Countdown', name:'Countdown', group:'Components', props:{}},
|
|
1629
1629
|
|
|
1630
|
+
{ type:'YoutubeVideo', name:'YoutubeVideo', group:'Components', props:{}},
|
|
1631
|
+
|
|
1630
1632
|
{ type:'Test', name:'Test', group:'Components', props:{}},
|
|
1631
1633
|
|
|
1632
1634
|
],
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
|
|
4
|
+
<div>
|
|
5
|
+
<label class="text-text-400">Video ID</label>
|
|
6
|
+
<Textbox v-model="item.props.videoId"
|
|
7
|
+
@keyup.enter="$emit('change')" />
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<ComponentSetting :item="item"
|
|
11
|
+
:view-type="viewType"
|
|
12
|
+
:view-types="viewTypes"
|
|
13
|
+
defaultDisplay="flex"
|
|
14
|
+
@change="$emit('change')" />
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
|
|
21
|
+
export default{
|
|
22
|
+
|
|
23
|
+
emits: [ 'change' ],
|
|
24
|
+
|
|
25
|
+
props: {
|
|
26
|
+
|
|
27
|
+
item: {
|
|
28
|
+
type: Object,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
viewType: String,
|
|
33
|
+
|
|
34
|
+
viewTypes: Array,
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<style module>
|
|
43
|
+
|
|
44
|
+
.comp{
|
|
45
|
+
@apply flex flex-col gap-4;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
</style>
|