@dataloop-ai/components 0.19.130 → 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
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
<dl-tooltip
|
|
50
50
|
v-if="tooltip || hasTooltipSlot"
|
|
51
51
|
style="pointer-events: auto"
|
|
52
|
+
:trigger-percentage="tooltipTriggerPercentage"
|
|
52
53
|
>
|
|
53
54
|
<slot name="tooltip">
|
|
54
55
|
{{ tooltip }}
|
|
@@ -173,6 +174,13 @@ export default defineComponent({
|
|
|
173
174
|
* The tooltip displayed when hovering over the button
|
|
174
175
|
*/
|
|
175
176
|
tooltip: { type: String, default: null, required: false },
|
|
177
|
+
/**
|
|
178
|
+
* The percentage of the button's width that will trigger the tooltip
|
|
179
|
+
*/
|
|
180
|
+
tooltipTriggerPercentage: {
|
|
181
|
+
type: Number,
|
|
182
|
+
default: 1
|
|
183
|
+
},
|
|
176
184
|
/**
|
|
177
185
|
* The button will maintain the styles it has when it's pressed if this prop is active
|
|
178
186
|
*/
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
+
<div style="padding-bottom: 10px">
|
|
4
|
+
<div>switch the disalbed prop: {{ disabledInput }}</div>
|
|
5
|
+
<dl-switch v-model="disabledInput" />
|
|
6
|
+
<dl-input
|
|
7
|
+
v-model="textVal"
|
|
8
|
+
placeholder="Test reactivity"
|
|
9
|
+
:disabled="disabledInput"
|
|
10
|
+
/>
|
|
11
|
+
</div>
|
|
3
12
|
<div>
|
|
4
13
|
<input v-model="textVal">
|
|
5
14
|
<div>This is to test v-model reactivity</div>
|
|
@@ -255,11 +264,12 @@
|
|
|
255
264
|
<script lang="ts">
|
|
256
265
|
import { v4 } from 'uuid'
|
|
257
266
|
import { computed, defineComponent, ref } from 'vue-demi'
|
|
258
|
-
import { DlInput, DlButton, DlIcon } from '../components'
|
|
267
|
+
import { DlInput, DlButton, DlIcon, DlSwitch } from '../components'
|
|
259
268
|
import { DlInputFile } from '../components/compound/DlInput/types'
|
|
260
269
|
export default defineComponent({
|
|
261
270
|
name: 'DlInputDemo',
|
|
262
271
|
components: {
|
|
272
|
+
DlSwitch,
|
|
263
273
|
DlInput,
|
|
264
274
|
DlButton,
|
|
265
275
|
DlIcon
|
|
@@ -298,6 +308,8 @@ export default defineComponent({
|
|
|
298
308
|
files.value = val
|
|
299
309
|
}
|
|
300
310
|
|
|
311
|
+
const disabledInput = ref<boolean>(false)
|
|
312
|
+
|
|
301
313
|
const textVal = ref<string>('test me')
|
|
302
314
|
|
|
303
315
|
const trimmedValue = ref('')
|
|
@@ -305,6 +317,7 @@ export default defineComponent({
|
|
|
305
317
|
return {
|
|
306
318
|
log: console.log,
|
|
307
319
|
textVal,
|
|
320
|
+
disabledInput,
|
|
308
321
|
trimmedValue,
|
|
309
322
|
textInputValue,
|
|
310
323
|
passFieldValue,
|
|
@@ -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
|
|