@dataloop-ai/components 0.19.131 → 0.19.132
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
|
@@ -139,6 +139,7 @@
|
|
|
139
139
|
:virtual-scroll="vScroll"
|
|
140
140
|
style="height: 500px"
|
|
141
141
|
:rows-per-page-options="rowsPerPageOptions"
|
|
142
|
+
:selected-rows-label="(val) => 'Selected rows ' + val"
|
|
142
143
|
@row-click="log"
|
|
143
144
|
@th-click="log"
|
|
144
145
|
@update:selected="updateSeleted"
|
|
@@ -677,6 +678,48 @@
|
|
|
677
678
|
</template>
|
|
678
679
|
</DlTable>
|
|
679
680
|
</div>
|
|
681
|
+
<div style="margin-top: 100px">
|
|
682
|
+
<p>Infinite scrolling With custom data and weird expandable</p>
|
|
683
|
+
<DlTable
|
|
684
|
+
:selected="selected"
|
|
685
|
+
:separator="separator"
|
|
686
|
+
:draggable="draggable"
|
|
687
|
+
:filter="filter"
|
|
688
|
+
:resizable="resizable"
|
|
689
|
+
:selection="selection"
|
|
690
|
+
:dense="dense"
|
|
691
|
+
title="Treats"
|
|
692
|
+
color="dl-color-secondary"
|
|
693
|
+
:loading="infiniteLoading"
|
|
694
|
+
:rows="generatedRows"
|
|
695
|
+
:columns="tableColumns"
|
|
696
|
+
style="height: 500px"
|
|
697
|
+
row-key="index"
|
|
698
|
+
virtual-scroll
|
|
699
|
+
expandable-rows
|
|
700
|
+
@virtual-scroll="onScrollGenerate"
|
|
701
|
+
@update:pagination="() => console.log('@@@@ hey')"
|
|
702
|
+
@col-update="updateColumns"
|
|
703
|
+
>
|
|
704
|
+
<template #body-cell-expandable-content="{ row }">
|
|
705
|
+
<div>
|
|
706
|
+
{{ row }}
|
|
707
|
+
</div>
|
|
708
|
+
<div>
|
|
709
|
+
{{ row }}
|
|
710
|
+
</div>
|
|
711
|
+
<div>
|
|
712
|
+
{{ row }}
|
|
713
|
+
</div>
|
|
714
|
+
<div>
|
|
715
|
+
{{ row }}
|
|
716
|
+
</div>
|
|
717
|
+
<div>
|
|
718
|
+
{{ row }}
|
|
719
|
+
</div>
|
|
720
|
+
</template>
|
|
721
|
+
</DlTable>
|
|
722
|
+
</div>
|
|
680
723
|
</div>
|
|
681
724
|
</template>
|
|
682
725
|
|
|
@@ -691,7 +734,7 @@ import {
|
|
|
691
734
|
} from '../components'
|
|
692
735
|
import { defineComponent, ref, computed, nextTick } from 'vue-demi'
|
|
693
736
|
import { times, cloneDeep, isNumber } from 'lodash'
|
|
694
|
-
import { DlTablePagination } from '../types'
|
|
737
|
+
import { DlTablePagination, DlVirtualScrollEvent } from '../types'
|
|
695
738
|
|
|
696
739
|
const columns = [
|
|
697
740
|
{
|
|
@@ -1037,6 +1080,10 @@ export default defineComponent({
|
|
|
1037
1080
|
allRows.slice(0, pageSize * (nextPageNumber.value - 1))
|
|
1038
1081
|
)
|
|
1039
1082
|
|
|
1083
|
+
const generatedRows = ref<any>(
|
|
1084
|
+
allRows.slice(0, pageSize * nextPageNumber.value)
|
|
1085
|
+
)
|
|
1086
|
+
|
|
1040
1087
|
const onScroll = ({ to, ref }: { to: number; ref: any }) => {
|
|
1041
1088
|
const lastIndex = computedRows.value.length - 1
|
|
1042
1089
|
|
|
@@ -1057,6 +1104,29 @@ export default defineComponent({
|
|
|
1057
1104
|
}
|
|
1058
1105
|
}
|
|
1059
1106
|
|
|
1107
|
+
const onScrollGenerate = ({ index, to, ref }: DlVirtualScrollEvent) => {
|
|
1108
|
+
const lastIndex = generatedRows.value.length - 1
|
|
1109
|
+
|
|
1110
|
+
const getRandomInt = (min: number, max: number) => {
|
|
1111
|
+
min = Math.ceil(min)
|
|
1112
|
+
max = Math.floor(max)
|
|
1113
|
+
return Math.floor(Math.random() * (max - min + 1)) + min
|
|
1114
|
+
}
|
|
1115
|
+
// todo: here we can see that even if we are loading the event keeps getting called with same payload. maybe we shouldnt send the same event payload over and over
|
|
1116
|
+
if (index >= lastIndex) {
|
|
1117
|
+
infiniteLoading.value = true
|
|
1118
|
+
|
|
1119
|
+
setTimeout(() => {
|
|
1120
|
+
generatedRows.value = generatedRows.value.concat(
|
|
1121
|
+
cloneDeep(generatedRows.value)
|
|
1122
|
+
.slice(-10)
|
|
1123
|
+
.map((r: any) => ({ ...r }))
|
|
1124
|
+
)
|
|
1125
|
+
infiniteLoading.value = false
|
|
1126
|
+
}, getRandomInt(500, 2000))
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1060
1130
|
const pagination = ref<DlTablePagination>({
|
|
1061
1131
|
sortBy: 'desc',
|
|
1062
1132
|
descending: false,
|
|
@@ -1166,7 +1236,9 @@ export default defineComponent({
|
|
|
1166
1236
|
isFirstPage,
|
|
1167
1237
|
rows2,
|
|
1168
1238
|
columns2,
|
|
1169
|
-
tableColumnsAligned
|
|
1239
|
+
tableColumnsAligned,
|
|
1240
|
+
generatedRows,
|
|
1241
|
+
onScrollGenerate
|
|
1170
1242
|
}
|
|
1171
1243
|
},
|
|
1172
1244
|
|