@mixd-id/web-scaffold 0.1.2301231323 → 0.1.2301231324
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/ImagePreview.vue +11 -1
- package/src/components/ListPage1.vue +17 -5
- package/src/components/VirtualTable.vue +24 -1
- package/src/index.js +12 -11
package/package.json
CHANGED
|
@@ -32,11 +32,21 @@ export default{
|
|
|
32
32
|
open(imageUrl){
|
|
33
33
|
this.imageUrl = imageUrl
|
|
34
34
|
this.isOpen = true
|
|
35
|
+
window.addEventListener('keyup', this.onKeyUp)
|
|
35
36
|
},
|
|
36
37
|
|
|
37
38
|
close(){
|
|
38
39
|
this.isOpen = false
|
|
39
40
|
this.imageUrl = null
|
|
41
|
+
window.removeEventListener('keyup', this.onKeyUp)
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
onKeyUp(e){
|
|
45
|
+
if(e.keyCode === 27){
|
|
46
|
+
e.preventDefault()
|
|
47
|
+
e.stopPropagation()
|
|
48
|
+
this.close()
|
|
49
|
+
}
|
|
40
50
|
}
|
|
41
51
|
|
|
42
52
|
}
|
|
@@ -53,7 +63,7 @@ export default{
|
|
|
53
63
|
|
|
54
64
|
.previewModal{
|
|
55
65
|
@apply !w-screen !h-screen !bg-base-300;
|
|
56
|
-
z-index: 21;
|
|
66
|
+
z-index: 21 !important;
|
|
57
67
|
max-width: unset !important;
|
|
58
68
|
max-height: unset !important;
|
|
59
69
|
}
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
<div class="flex-1 flex flex-col">
|
|
6
6
|
|
|
7
7
|
<div class="p-6 pb-0 flex flex-row gap-3 items-center">
|
|
8
|
-
<div class="mr-6">
|
|
8
|
+
<div class="mr-6 hidden md:block">
|
|
9
9
|
<h2>{{ title }}</h2>
|
|
10
10
|
</div>
|
|
11
|
-
<div class="flex-1
|
|
11
|
+
<div class="flex-1"></div>
|
|
12
|
+
<div class="overflow-hidden mr-4 hidden md:block">
|
|
12
13
|
<slot v-if="$slots['lp-search']" name="lp-search" :preset="preset"/>
|
|
13
14
|
<Textbox v-else :clearable="true" placeholder="Cari..." class="w-[200px]" v-model="preset.search"
|
|
14
15
|
@clear="clearSearch" @submit="load">
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
</template>
|
|
22
23
|
</Textbox>
|
|
23
24
|
</div>
|
|
24
|
-
<div>
|
|
25
|
+
<div class="hidden md:block">
|
|
25
26
|
<slot name="lp-tabspace" :preset="preset"/>
|
|
26
27
|
</div>
|
|
27
28
|
<div class="flex flex-row gap-1 items-center">
|
|
@@ -45,8 +46,17 @@
|
|
|
45
46
|
</div>
|
|
46
47
|
</div>
|
|
47
48
|
|
|
48
|
-
<
|
|
49
|
-
|
|
49
|
+
<VirtualScroll v-if="isMobile.value" :items="items" class="flex-1" @scroll-end="loadNext">
|
|
50
|
+
<template #item="{ item, index }">
|
|
51
|
+
<slot v-if="$slots.mobile" name="mobile" :item="item" :index="index"></slot>
|
|
52
|
+
<div v-else>
|
|
53
|
+
<div class="h-[2rem] bg-base-300 rounded-lg my-2"></div>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
</VirtualScroll>
|
|
57
|
+
|
|
58
|
+
<VirtualTable v-else class="flex-1 m-6" :columns="presetColumns" :items="items"
|
|
59
|
+
:appearances="appearances" @scroll-end="loadNext" :pinned="pinned">
|
|
50
60
|
<template v-for="(_, slot) in $slots" #[slot]="{ item, index }">
|
|
51
61
|
<slot :name="slot" :item="item" :index="index"></slot>
|
|
52
62
|
</template>
|
|
@@ -191,6 +201,8 @@ export default{
|
|
|
191
201
|
|
|
192
202
|
title: String,
|
|
193
203
|
|
|
204
|
+
pinned: Function
|
|
205
|
+
|
|
194
206
|
},
|
|
195
207
|
|
|
196
208
|
computed: {
|
|
@@ -80,6 +80,8 @@ export default{
|
|
|
80
80
|
|
|
81
81
|
items: Array,
|
|
82
82
|
|
|
83
|
+
pinned: Function,
|
|
84
|
+
|
|
83
85
|
defaultColumnWidth: {
|
|
84
86
|
type: String,
|
|
85
87
|
default: _DEFAULT_COLUMN_WIDTH
|
|
@@ -108,9 +110,30 @@ export default{
|
|
|
108
110
|
return Math.round(this.scrollTop / this.itemHeight)
|
|
109
111
|
},
|
|
110
112
|
|
|
113
|
+
sortedItems(){
|
|
114
|
+
if(!Array.isArray(this.items)) return []
|
|
115
|
+
|
|
116
|
+
if(typeof this.pinned === 'function'){
|
|
117
|
+
const pinnedItems = []
|
|
118
|
+
const unpinnedItems = []
|
|
119
|
+
this.items.forEach((item) => {
|
|
120
|
+
if(this.pinned(item))
|
|
121
|
+
pinnedItems.push(item)
|
|
122
|
+
else
|
|
123
|
+
unpinnedItems.push(item)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
return [
|
|
127
|
+
...pinnedItems,
|
|
128
|
+
...unpinnedItems
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
return this.items
|
|
132
|
+
},
|
|
133
|
+
|
|
111
134
|
visibleItems(){
|
|
112
135
|
if(this.itemHeight <= 0) return []
|
|
113
|
-
return this.
|
|
136
|
+
return this.sortedItems.slice(this.visibleStartIndex, this.visibleStartIndex + this.maxVisibleItems)
|
|
114
137
|
},
|
|
115
138
|
|
|
116
139
|
spacerStyle(){
|
package/src/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {defineAsyncComponent} from "vue"
|
|
1
|
+
import {defineAsyncComponent, ref} from "vue"
|
|
2
2
|
import {observeInit} from './helper.js'
|
|
3
|
+
import throttle from "lodash-es/throttle";
|
|
3
4
|
//import './index.css'
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const isMobile = () => {
|
|
10
|
-
return isBrowser &&
|
|
11
|
-
(window.innerWidth < window.innerHeight && window.innerWidth <= 800)
|
|
6
|
+
const calculateIsMobile = () => {
|
|
7
|
+
if(typeof window === 'undefined') return false
|
|
8
|
+
return window.innerWidth < window.innerHeight && window.innerWidth <= 800
|
|
12
9
|
}
|
|
13
10
|
|
|
14
11
|
let _UNIQID = 0
|
|
@@ -36,14 +33,18 @@ export default{
|
|
|
36
33
|
install: (app, options) => {
|
|
37
34
|
//console.log('installing webfxfy-vue...')
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
app.config.globalProperties.isMobile = isMobile
|
|
41
|
-
app.config.globalProperties.uniqid = uniqid
|
|
36
|
+
let isMobile = ref(calculateIsMobile())
|
|
42
37
|
|
|
43
38
|
if(typeof window !== 'undefined' && 'IntersectionObserver' in window) {
|
|
44
39
|
app.config.globalProperties.$observe = observeInit()
|
|
40
|
+
|
|
41
|
+
window.addEventListener('resize', throttle(() => {
|
|
42
|
+
isMobile.value = calculateIsMobile()
|
|
43
|
+
}, 600, { trailing:true }))
|
|
45
44
|
}
|
|
46
45
|
|
|
46
|
+
app.config.globalProperties.uniqid = uniqid
|
|
47
|
+
app.config.globalProperties.isMobile = isMobile
|
|
47
48
|
app.config.globalProperties.$download = download
|
|
48
49
|
|
|
49
50
|
app.component('Alert', defineAsyncComponent(() => import("./components/Alert.vue")))
|