@mixd-id/web-scaffold 0.1.230406010 → 0.1.230406012
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,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
<slot v-if="$slots['empty'] && (Array.isArray(items) || items.length <= 0)" name="empty" :preset="preset" />
|
|
5
5
|
|
|
6
|
-
<div v-else class="
|
|
6
|
+
<div v-else :class="$style.main">
|
|
7
7
|
|
|
8
|
-
<div class="
|
|
8
|
+
<div :class="$style.mainHead">
|
|
9
9
|
<slot v-if="$slots['lp-start']" name="lp-start" :preset="preset"/>
|
|
10
|
-
<div v-else
|
|
10
|
+
<div v-else>
|
|
11
11
|
<h2>{{ computedTitle }}</h2>
|
|
12
12
|
</div>
|
|
13
13
|
<div class="flex-1"></div>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<div class="hidden md:block">
|
|
28
28
|
<slot name="lp-tabspace" :preset="preset"/>
|
|
29
29
|
</div>
|
|
30
|
-
<div class="
|
|
30
|
+
<div :class="$style.optArea">
|
|
31
31
|
<Dropdown class="w-[150px]" :value="preset.name" mode="custom" position="bottom-right">
|
|
32
32
|
<div class="min-w-[240px] divide-y divide-text-50 p-2 flex flex-col gap-2">
|
|
33
33
|
<div v-for="(_preset, idx) in configs.presets" class="cursor-pointer flex flex-row hover:bg-primary-100 rounded-md">
|
|
@@ -61,9 +61,8 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
|
|
63
63
|
<div class="flex-1 relative flex" v-if="!hideDetails">
|
|
64
|
-
<VirtualTable v-if="!hideDetails" class="
|
|
65
|
-
|
|
66
|
-
:appearances="presetAppearances" @scroll-end="loadNext" :pinned="pinned">
|
|
64
|
+
<VirtualTable v-if="!hideDetails" ref="table1" :class="$style.vtable" :columns="presetColumns" :items="items"
|
|
65
|
+
:appearances="presetAppearances" @scroll-end="loadNext" :pinned="pinned">
|
|
67
66
|
<template v-for="column in presetColumns" #[colOf(column.key)]="{}">
|
|
68
67
|
<div :class="getHeader(column)" @click="openColumnOptions(column.key, $event.target.closest('.' + $style.header))">
|
|
69
68
|
<div>
|
|
@@ -96,6 +95,12 @@
|
|
|
96
95
|
<slot :name="slot" :item="item" :index="index"></slot>
|
|
97
96
|
</template>
|
|
98
97
|
</VirtualTable>
|
|
98
|
+
<VirtualScroll v-if="!hideDetails" ref="scroll1" :class="$style.vscroll" :items="items"
|
|
99
|
+
@scroll-end="loadNext" :pinned="pinned">
|
|
100
|
+
<template #item="{ item }">
|
|
101
|
+
<slot name="mobileItem" :item="item"></slot>
|
|
102
|
+
</template>
|
|
103
|
+
</VirtualScroll>
|
|
99
104
|
<div v-if="isLoading" :class="$style.overlay">
|
|
100
105
|
<svg class="animate-spin aspect-square w-[48px] h-[48px] 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>
|
|
101
106
|
</div>
|
|
@@ -594,7 +599,7 @@ export default{
|
|
|
594
599
|
},
|
|
595
600
|
|
|
596
601
|
presetColumns(){
|
|
597
|
-
if(!this.preset.columns) return
|
|
602
|
+
if(!this.preset.columns) return
|
|
598
603
|
|
|
599
604
|
for(let i = 0 ; i < (this.preset.columns).length ; i++){
|
|
600
605
|
const presetColumn = this.preset.columns[i]
|
|
@@ -1015,12 +1020,18 @@ export default{
|
|
|
1015
1020
|
},
|
|
1016
1021
|
|
|
1017
1022
|
loadNext(){
|
|
1023
|
+
|
|
1024
|
+
this.$refs.table1.setState(2)
|
|
1018
1025
|
this.socketEmit(`${this.computedDataSource}.load`, {
|
|
1019
1026
|
preset: this.preset,
|
|
1020
1027
|
afterItem: this.items[this.items.length - 1]
|
|
1021
1028
|
}, (res) => {
|
|
1029
|
+
this.$refs.table1.setState(1)
|
|
1022
1030
|
this.items.push(...res.items)
|
|
1023
1031
|
this.hasNext = res.hasNext
|
|
1032
|
+
}, (err) => {
|
|
1033
|
+
this.$refs.table1.setState(1)
|
|
1034
|
+
this.toast(err)
|
|
1024
1035
|
})
|
|
1025
1036
|
},
|
|
1026
1037
|
|
|
@@ -1326,9 +1337,55 @@ export default{
|
|
|
1326
1337
|
background: rgba(0, 0, 0, .3);
|
|
1327
1338
|
}
|
|
1328
1339
|
|
|
1340
|
+
.main{
|
|
1341
|
+
@apply flex-1 flex flex-col gap-6 p-6 relative;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
.mainHead{
|
|
1345
|
+
@apply flex flex-row gap-3 items-center;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1329
1348
|
.overlay{
|
|
1330
1349
|
@apply absolute top-0 right-0 bottom-0 left-0 flex items-center justify-center;
|
|
1331
1350
|
background-color: rgba(var(--base-500), .7);
|
|
1332
1351
|
}
|
|
1333
1352
|
|
|
1353
|
+
.vscroll{
|
|
1354
|
+
@apply hidden;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
.optArea{
|
|
1358
|
+
@apply flex flex-row gap-1 items-center;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
@media screen and (orientation: portrait){
|
|
1362
|
+
|
|
1363
|
+
.main{
|
|
1364
|
+
@apply gap-3 p-0;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
.mainHead{
|
|
1368
|
+
@apply px-6 py-4;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
.vtable{
|
|
1372
|
+
@apply hidden;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
.vscroll{
|
|
1376
|
+
@apply flex-1 flex border-t-[1px] border-b-[1px] border-text-50;
|
|
1377
|
+
}
|
|
1378
|
+
.vscroll>*{
|
|
1379
|
+
@apply divide-y divide-text-50;
|
|
1380
|
+
}
|
|
1381
|
+
.vscroll>*>*{
|
|
1382
|
+
@apply bg-base-500;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
.optArea{
|
|
1386
|
+
@apply hidden;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1334
1391
|
</style>
|
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
</tr>
|
|
40
40
|
</tbody>
|
|
41
41
|
</table>
|
|
42
|
+
<div v-if="state === 2" ref="spinner" class="h-[44px] relative">
|
|
43
|
+
<div class="absolute top-0 left-0 w-screen h-[44px] flex items-center justify-center">
|
|
44
|
+
<svg class="animate-spin aspect-square w-[16px] h-[16px] 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>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
42
47
|
</div>
|
|
43
48
|
</div>
|
|
44
49
|
<div :class="$style.calc" v-if="visibleColumns.length > 0 && items && items.length > 0" ref="calc">
|
|
@@ -54,10 +59,10 @@
|
|
|
54
59
|
</tbody>
|
|
55
60
|
</table>
|
|
56
61
|
</div>
|
|
57
|
-
<div v-else-if="visibleColumns.length <= 0" class="text-center p-3 flex-1 min-h-[100%] flex items-center justify-center">
|
|
62
|
+
<div v-else-if="visibleColumns.length <= 0 && Array.isArray(columns)" class="text-center p-3 flex-1 min-h-[100%] flex items-center justify-center">
|
|
58
63
|
<h5 class="text-text-300">No active column</h5>
|
|
59
64
|
</div>
|
|
60
|
-
<div v-else
|
|
65
|
+
<div v-else-if="Array.isArray(columns)" class="text-center p-3 flex-1 min-h-[100%] flex items-center justify-center">
|
|
61
66
|
<h5 class="text-text-300">No data available</h5>
|
|
62
67
|
</div>
|
|
63
68
|
</div>
|
|
@@ -100,7 +105,8 @@ export default{
|
|
|
100
105
|
itemHeight: 0,
|
|
101
106
|
maxVisibleItems: 0,
|
|
102
107
|
isOnEndScroll: false,
|
|
103
|
-
selectedIndex: -1
|
|
108
|
+
selectedIndex: -1,
|
|
109
|
+
state: 1
|
|
104
110
|
}
|
|
105
111
|
},
|
|
106
112
|
|
|
@@ -146,7 +152,7 @@ export default{
|
|
|
146
152
|
if(!this.items || this.items.length < 1)
|
|
147
153
|
return {}
|
|
148
154
|
|
|
149
|
-
const height = (this.items.length * this.itemHeight)
|
|
155
|
+
const height = (this.items.length * this.itemHeight) + (this.state === 2 ? 48 : 0)
|
|
150
156
|
const width = this.visibleColumns.reduce((r, item) => r + parseInt(item.width ?? _DEFAULT_COLUMN_WIDTH), 0)
|
|
151
157
|
|
|
152
158
|
//console.log('scrollerStyle', { width, height, columns:this.columns })
|
|
@@ -164,7 +170,7 @@ export default{
|
|
|
164
170
|
},
|
|
165
171
|
|
|
166
172
|
visibleColumns(){
|
|
167
|
-
const columns = this.columns.filter(_ => _.visible)
|
|
173
|
+
const columns = (this.columns ?? []).filter(_ => _.visible)
|
|
168
174
|
return columns
|
|
169
175
|
}
|
|
170
176
|
|
|
@@ -369,6 +375,10 @@ export default{
|
|
|
369
375
|
}
|
|
370
376
|
|
|
371
377
|
return text
|
|
378
|
+
},
|
|
379
|
+
|
|
380
|
+
setState(state){
|
|
381
|
+
this.state = state
|
|
372
382
|
}
|
|
373
383
|
|
|
374
384
|
},
|