@mixd-id/web-scaffold 0.1.230406371 → 0.1.230406373
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/List.vue +16 -0
- package/src/components/Video.vue +119 -0
- package/src/index.js +1 -0
package/package.json
CHANGED
package/src/components/List.vue
CHANGED
|
@@ -368,6 +368,13 @@ export default{
|
|
|
368
368
|
itemsPerPage: this.data.itemsPerPage,
|
|
369
369
|
})
|
|
370
370
|
.then(data => {
|
|
371
|
+
const firstItem = data.items[0]
|
|
372
|
+
const lastItem = data.items[data.items.length - 1]
|
|
373
|
+
console.log('#Loaded',
|
|
374
|
+
firstItem?.id, firstItem?.lastMessageAt,
|
|
375
|
+
lastItem?.id, lastItem?.lastMessageAt,
|
|
376
|
+
data.length)
|
|
377
|
+
|
|
371
378
|
generatePivotColumns(this.preset, data.items)
|
|
372
379
|
generateTotalColumns(this.preset, data.items)
|
|
373
380
|
this.loadEnums(data.items)
|
|
@@ -387,6 +394,9 @@ export default{
|
|
|
387
394
|
((this.data ?? {}).hasNext !== false) &&
|
|
388
395
|
!(this.preset.pivot ?? {}).enabled) {
|
|
389
396
|
|
|
397
|
+
const afterItem = this.data.items[this.data.items.length - 1]
|
|
398
|
+
console.log('#Next', afterItem.id, afterItem.lastMessageAt)
|
|
399
|
+
|
|
390
400
|
this.readyState = 4
|
|
391
401
|
this.socket.send(this.src, {
|
|
392
402
|
...this.preset,
|
|
@@ -394,6 +404,12 @@ export default{
|
|
|
394
404
|
afterItem: this.data.items[this.data.items.length - 1],
|
|
395
405
|
})
|
|
396
406
|
.then(data => {
|
|
407
|
+
const firstItem = data.items[0]
|
|
408
|
+
const lastItem = data.items[data.items.length - 1]
|
|
409
|
+
console.log('#Loaded',
|
|
410
|
+
firstItem?.id, firstItem?.lastMessageAt,
|
|
411
|
+
lastItem?.id, lastItem?.lastMessageAt,
|
|
412
|
+
data.length)
|
|
397
413
|
|
|
398
414
|
this.data.items.push(...data.items)
|
|
399
415
|
this.loadEnums(data.items)
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp"
|
|
3
|
+
@click="onClick">
|
|
4
|
+
<video v-if="actualSrc" ref="video"
|
|
5
|
+
@ended="playing = false">
|
|
6
|
+
<source :src="actualSrc" type="video/mp4">
|
|
7
|
+
</video>
|
|
8
|
+
|
|
9
|
+
<slot v-else name="empty" :instance="this"></slot>
|
|
10
|
+
|
|
11
|
+
<div v-if="!playing && actualSrc" :class="$style.play">
|
|
12
|
+
<button type="button" @click.stop="play" class="w-[36px] h-[36px] flex items-center justify-center rounded-full bg-white/30">
|
|
13
|
+
<svg width="21" height="21" class="fill-white" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M176 480C148.6 480 128 457.6 128 432v-352c0-25.38 20.4-47.98 48.01-47.98c8.686 0 17.35 2.352 25.02 7.031l288 176C503.3 223.8 512 239.3 512 256s-8.703 32.23-22.97 40.95l-288 176C193.4 477.6 184.7 480 176 480z"/></svg>
|
|
14
|
+
</button>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<input v-if="Boolean(editable)" class="hidden" type="file" accept="video/*" ref="file" @change="onChange"/>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
|
|
23
|
+
export default{
|
|
24
|
+
|
|
25
|
+
emits: [ 'click', 'change' ],
|
|
26
|
+
|
|
27
|
+
props: {
|
|
28
|
+
|
|
29
|
+
editable:{
|
|
30
|
+
type: [ Boolean, String ],
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
src: undefined,
|
|
35
|
+
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
data(){
|
|
39
|
+
return {
|
|
40
|
+
actualSrc: null,
|
|
41
|
+
playing: false,
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
methods: {
|
|
46
|
+
|
|
47
|
+
edit(){
|
|
48
|
+
if(this.$refs.file){
|
|
49
|
+
this.$refs.file.click()
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
onChange(e){
|
|
54
|
+
if(e.target.files.length > 0){
|
|
55
|
+
var reader = new FileReader();
|
|
56
|
+
reader.addEventListener('load', () => {
|
|
57
|
+
this.$emit('change', reader.result, e.target.files[0])
|
|
58
|
+
this.$refs.file.value = null
|
|
59
|
+
}, false)
|
|
60
|
+
reader.readAsDataURL(e.target.files[0]);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
onClick(e){
|
|
65
|
+
if(this.playing){
|
|
66
|
+
this.$refs.video.pause()
|
|
67
|
+
this.playing = false
|
|
68
|
+
}
|
|
69
|
+
else{
|
|
70
|
+
this.$emit('click', e, this)
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
play(){
|
|
75
|
+
this.$refs.video.play()
|
|
76
|
+
this.playing = true
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
watch: {
|
|
82
|
+
|
|
83
|
+
src: {
|
|
84
|
+
immediate: true,
|
|
85
|
+
handler(to){
|
|
86
|
+
if(to instanceof File){
|
|
87
|
+
var reader = new FileReader();
|
|
88
|
+
reader.addEventListener('load', () => {
|
|
89
|
+
this.actualSrc = reader.result
|
|
90
|
+
}, false)
|
|
91
|
+
reader.readAsDataURL(to);
|
|
92
|
+
}
|
|
93
|
+
else{
|
|
94
|
+
this.actualSrc = to
|
|
95
|
+
//this.actualSrc = 'https://www.kliknss.co.id/images/big_buck_bunny_240p_1mb.mp4'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<style module>
|
|
107
|
+
|
|
108
|
+
.comp{
|
|
109
|
+
@apply flex-1 flex items-center justify-center relative overflow-hidden;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.play{
|
|
113
|
+
@apply absolute;
|
|
114
|
+
top: 50%;
|
|
115
|
+
left: 50%;
|
|
116
|
+
transform: translate(-50%, -50%);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -533,6 +533,7 @@ export default{
|
|
|
533
533
|
app.component('IconMenu2', defineAsyncComponent(() => import("./components/IconMenu2.vue")))
|
|
534
534
|
app.component('IconPlus', defineAsyncComponent(() => import("./components/IconPlus.vue")))
|
|
535
535
|
app.component('Image', defineAsyncComponent(() => import("./components/Image.vue")))
|
|
536
|
+
app.component('Video', defineAsyncComponent(() => import("./components/Video.vue")))
|
|
536
537
|
app.component('Image360', defineAsyncComponent(() => import("./components/Image360.vue")))
|
|
537
538
|
app.component('ImagePreview', defineAsyncComponent(() => import("./components/ImagePreview.vue")))
|
|
538
539
|
app.component('ImageFullScreen', defineAsyncComponent(() => import("./components/ImageFullScreen.vue")))
|