@dataloop-ai/components 0.19.136 → 0.19.138
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/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +1 -0
- package/src/components/compound/DlTable/DlTable.vue +30 -19
- package/src/components/compound/DlTable/styles/dl-table-styles.scss +28 -8
- package/src/components/compound/DlTable/types.ts +0 -1
- package/src/components/shared/DlVirtualScroll/useVirtualScroll.ts +5 -1
- package/src/demos/DlTableDemo.vue +5 -12
- package/src/utils/table-columns.ts +0 -4
package/package.json
CHANGED
|
@@ -148,16 +148,16 @@
|
|
|
148
148
|
}
|
|
149
149
|
"
|
|
150
150
|
>
|
|
151
|
-
<dl-ellipsis>
|
|
151
|
+
<dl-ellipsis v-if="fitAllColumns">
|
|
152
152
|
{{ col.label }}
|
|
153
153
|
</dl-ellipsis>
|
|
154
|
+
<span v-else> {{ col.label }} </span>
|
|
154
155
|
</span>
|
|
155
156
|
</DlTh>
|
|
156
157
|
</slot>
|
|
157
158
|
<DlTh
|
|
158
159
|
v-if="showRowActions"
|
|
159
160
|
key="visibleColumnsSlot"
|
|
160
|
-
:col-index="-1"
|
|
161
161
|
no-tooltip
|
|
162
162
|
padding="0"
|
|
163
163
|
>
|
|
@@ -390,7 +390,6 @@
|
|
|
390
390
|
v-if="showRowActions"
|
|
391
391
|
key="visibleColumnsSlot"
|
|
392
392
|
class="visible-columns-justify-end"
|
|
393
|
-
:col-index="-1"
|
|
394
393
|
no-tooltip
|
|
395
394
|
>
|
|
396
395
|
<slot
|
|
@@ -541,17 +540,18 @@
|
|
|
541
540
|
}
|
|
542
541
|
"
|
|
543
542
|
>
|
|
544
|
-
<dl-ellipsis>
|
|
543
|
+
<dl-ellipsis v-if="fitAllColumns">
|
|
545
544
|
{{ col.label }}
|
|
546
545
|
</dl-ellipsis>
|
|
546
|
+
<span v-else> {{ col.label }} </span>
|
|
547
547
|
</span>
|
|
548
548
|
</DlTh>
|
|
549
549
|
</slot>
|
|
550
550
|
<DlTh
|
|
551
551
|
v-if="showRowActions"
|
|
552
552
|
key="visibleColumnsSlot"
|
|
553
|
-
:col-index="-1"
|
|
554
553
|
no-tooltip
|
|
554
|
+
style="width: 25px"
|
|
555
555
|
:padding="isTreeTable ? '0' : '0 10px'"
|
|
556
556
|
>
|
|
557
557
|
<slot
|
|
@@ -794,7 +794,6 @@
|
|
|
794
794
|
v-if="showRowActions"
|
|
795
795
|
key="visibleColumnsSlot"
|
|
796
796
|
class="visible-columns-justify-end"
|
|
797
|
-
:col-index="-1"
|
|
798
797
|
no-tooltip
|
|
799
798
|
>
|
|
800
799
|
<slot
|
|
@@ -884,10 +883,7 @@
|
|
|
884
883
|
v-bind="marginalsScope"
|
|
885
884
|
>
|
|
886
885
|
<div
|
|
887
|
-
v-if="
|
|
888
|
-
hasBotomSelectionBanner &&
|
|
889
|
-
selectedRowsLabel(rowsSelectedNumber)
|
|
890
|
-
"
|
|
886
|
+
v-if="hasBotomSelectionBanner"
|
|
891
887
|
class="dl-table__control"
|
|
892
888
|
>
|
|
893
889
|
<div>
|
|
@@ -931,6 +927,7 @@ import {
|
|
|
931
927
|
getCurrentInstance,
|
|
932
928
|
ComputedRef,
|
|
933
929
|
onMounted,
|
|
930
|
+
onBeforeUnmount,
|
|
934
931
|
toRefs,
|
|
935
932
|
nextTick,
|
|
936
933
|
PropType
|
|
@@ -1246,7 +1243,7 @@ export default defineComponent({
|
|
|
1246
1243
|
default: 'No data'
|
|
1247
1244
|
},
|
|
1248
1245
|
stickyColumns: {
|
|
1249
|
-
type:
|
|
1246
|
+
type: String as PropType<TableStickyPosition>,
|
|
1250
1247
|
default: null,
|
|
1251
1248
|
validator: (value: string) =>
|
|
1252
1249
|
['first', 'last', 'both'].includes(value)
|
|
@@ -1284,7 +1281,6 @@ export default defineComponent({
|
|
|
1284
1281
|
noDataLabel,
|
|
1285
1282
|
columns,
|
|
1286
1283
|
fitAllColumns,
|
|
1287
|
-
stickyColumns,
|
|
1288
1284
|
resizable,
|
|
1289
1285
|
hidePagination,
|
|
1290
1286
|
hideSelectedBanner,
|
|
@@ -1417,7 +1413,7 @@ export default defineComponent({
|
|
|
1417
1413
|
return computedPagination.value.rowsNumber || rows.value.length
|
|
1418
1414
|
})
|
|
1419
1415
|
|
|
1420
|
-
|
|
1416
|
+
const updateTableSizing = () => {
|
|
1421
1417
|
tableEl =
|
|
1422
1418
|
tableRef.value ||
|
|
1423
1419
|
virtScrollRef.value.rootRef.querySelector('table') ||
|
|
@@ -1427,10 +1423,19 @@ export default defineComponent({
|
|
|
1427
1423
|
setAllColumnWidths(
|
|
1428
1424
|
tableEl,
|
|
1429
1425
|
columns.value as DlTableColumn[],
|
|
1430
|
-
stickyColumns
|
|
1431
|
-
fitAllColumns
|
|
1426
|
+
props.stickyColumns,
|
|
1427
|
+
props.fitAllColumns
|
|
1432
1428
|
)
|
|
1433
1429
|
})
|
|
1430
|
+
return tableEl
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
onMounted(() => {
|
|
1434
|
+
const tableEl = updateTableSizing()
|
|
1435
|
+
window.addEventListener(
|
|
1436
|
+
'virtual-scroll-content-update',
|
|
1437
|
+
updateTableSizing
|
|
1438
|
+
)
|
|
1434
1439
|
if (visibleColumns.value) return
|
|
1435
1440
|
if (resizable.value) {
|
|
1436
1441
|
applyResizableColumns(tableEl, vm)
|
|
@@ -1443,6 +1448,12 @@ export default defineComponent({
|
|
|
1443
1448
|
)
|
|
1444
1449
|
}
|
|
1445
1450
|
})
|
|
1451
|
+
onBeforeUnmount(() => {
|
|
1452
|
+
window.removeEventListener(
|
|
1453
|
+
'virtual-scroll-content-update',
|
|
1454
|
+
updateTableSizing
|
|
1455
|
+
)
|
|
1456
|
+
})
|
|
1446
1457
|
|
|
1447
1458
|
watch(
|
|
1448
1459
|
hasVirtScroll,
|
|
@@ -1458,8 +1469,8 @@ export default defineComponent({
|
|
|
1458
1469
|
setAllColumnWidths(
|
|
1459
1470
|
tableEl,
|
|
1460
1471
|
props.columns as DlTableColumn[],
|
|
1461
|
-
stickyColumns
|
|
1462
|
-
fitAllColumns
|
|
1472
|
+
props.stickyColumns,
|
|
1473
|
+
props.fitAllColumns
|
|
1463
1474
|
)
|
|
1464
1475
|
})
|
|
1465
1476
|
if (visibleColumns.value) return
|
|
@@ -1498,8 +1509,8 @@ export default defineComponent({
|
|
|
1498
1509
|
setAllColumnWidths(
|
|
1499
1510
|
tableRef.value,
|
|
1500
1511
|
newColumns as DlTableColumn[],
|
|
1501
|
-
stickyColumns
|
|
1502
|
-
fitAllColumns
|
|
1512
|
+
props.stickyColumns,
|
|
1513
|
+
props.fitAllColumns
|
|
1503
1514
|
)
|
|
1504
1515
|
})
|
|
1505
1516
|
},
|
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
z-index: 50;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
.dl-th {
|
|
18
|
+
z-index: 100;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.dl-th.sticky-col {
|
|
22
|
+
z-index: 101;
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
.inner-th-wrapper {
|
|
18
26
|
display: flex;
|
|
19
27
|
align-items: center;
|
|
@@ -21,7 +29,13 @@
|
|
|
21
29
|
gap: 6px;
|
|
22
30
|
height: 34px;
|
|
23
31
|
position: relative;
|
|
32
|
+
line-height: 34px;
|
|
33
|
+
&--left {
|
|
34
|
+
left: 0;
|
|
35
|
+
transform: none;
|
|
36
|
+
}
|
|
24
37
|
}
|
|
38
|
+
|
|
25
39
|
.inner-th {
|
|
26
40
|
display: inline-block;
|
|
27
41
|
flex: 0 1 auto;
|
|
@@ -31,11 +45,13 @@
|
|
|
31
45
|
overflow: hidden;
|
|
32
46
|
position: relative;
|
|
33
47
|
line-height: 34px;
|
|
48
|
+
|
|
34
49
|
&--left {
|
|
35
50
|
left: 0;
|
|
36
51
|
transform: none;
|
|
37
52
|
}
|
|
38
53
|
}
|
|
54
|
+
|
|
39
55
|
.th-icons {
|
|
40
56
|
display: flex;
|
|
41
57
|
flex: 0 1 auto;
|
|
@@ -54,7 +70,7 @@
|
|
|
54
70
|
border-collapse: separate;
|
|
55
71
|
border-spacing: 0;
|
|
56
72
|
|
|
57
|
-
&__drag-icon
|
|
73
|
+
&__drag-icon>div {
|
|
58
74
|
transition: all ease-in 0.1s;
|
|
59
75
|
opacity: 0;
|
|
60
76
|
}
|
|
@@ -108,7 +124,7 @@
|
|
|
108
124
|
height: 40px;
|
|
109
125
|
|
|
110
126
|
&:not(.dl-tr--no-hover):hover {
|
|
111
|
-
.dl-table__drag-icon
|
|
127
|
+
.dl-table__drag-icon>div {
|
|
112
128
|
opacity: 1;
|
|
113
129
|
}
|
|
114
130
|
td:not(.dl-td--no-hover) {
|
|
@@ -176,7 +192,7 @@
|
|
|
176
192
|
}
|
|
177
193
|
}
|
|
178
194
|
|
|
179
|
-
tbody
|
|
195
|
+
tbody>tr:not(.dl-tr--no-hover):hover>td:not(.dl-td--no-hover):before {
|
|
180
196
|
content: '';
|
|
181
197
|
}
|
|
182
198
|
|
|
@@ -206,6 +222,7 @@
|
|
|
206
222
|
}
|
|
207
223
|
|
|
208
224
|
&--no-wrap {
|
|
225
|
+
|
|
209
226
|
th,
|
|
210
227
|
td {
|
|
211
228
|
white-space: nowrap;
|
|
@@ -215,12 +232,12 @@
|
|
|
215
232
|
&__container {
|
|
216
233
|
position: relative;
|
|
217
234
|
|
|
218
|
-
|
|
235
|
+
*>div:first-child {
|
|
219
236
|
border-top-left-radius: inherit;
|
|
220
237
|
border-top-right-radius: inherit;
|
|
221
238
|
}
|
|
222
239
|
|
|
223
|
-
|
|
240
|
+
*>div:last-child {
|
|
224
241
|
border-bottom-left-radius: inherit;
|
|
225
242
|
border-bottom-right-radius: inherit;
|
|
226
243
|
}
|
|
@@ -331,7 +348,7 @@
|
|
|
331
348
|
td {
|
|
332
349
|
border-color: var(--dl-color-separator);
|
|
333
350
|
|
|
334
|
-
|
|
351
|
+
&>label {
|
|
335
352
|
padding: 0;
|
|
336
353
|
}
|
|
337
354
|
}
|
|
@@ -465,6 +482,7 @@
|
|
|
465
482
|
}
|
|
466
483
|
|
|
467
484
|
.dl-table__select {
|
|
485
|
+
|
|
468
486
|
.dl-field__control,
|
|
469
487
|
.dl-field__native {
|
|
470
488
|
min-height: 24px;
|
|
@@ -495,18 +513,20 @@
|
|
|
495
513
|
|
|
496
514
|
.dl-table--horizontal-separator,
|
|
497
515
|
.dl-table--cell-separator {
|
|
516
|
+
|
|
498
517
|
thead th,
|
|
499
|
-
tbody tr:not(:last-child)
|
|
518
|
+
tbody tr:not(:last-child)>td {
|
|
500
519
|
border-bottom-width: 1px;
|
|
501
520
|
}
|
|
502
521
|
|
|
503
|
-
tbody:not(:last-child)
|
|
522
|
+
tbody:not(:last-child)>tr>td {
|
|
504
523
|
border-bottom-width: 1px;
|
|
505
524
|
}
|
|
506
525
|
}
|
|
507
526
|
|
|
508
527
|
.dl-table--vertical-separator,
|
|
509
528
|
.dl-table--cell-separator {
|
|
529
|
+
|
|
510
530
|
td,
|
|
511
531
|
th {
|
|
512
532
|
border-left-width: 1px;
|
|
@@ -846,6 +846,7 @@ export function useVirtualScroll({
|
|
|
846
846
|
['--dl-virtual-scroll-item-' + paddingSize]:
|
|
847
847
|
virtualScrollItemSizeComputed.value + 'px'
|
|
848
848
|
}
|
|
849
|
+
const onUpdate = new Event('virtual-scroll-content-update')
|
|
849
850
|
|
|
850
851
|
return [
|
|
851
852
|
tag === 'tbody'
|
|
@@ -890,7 +891,10 @@ export function useVirtualScroll({
|
|
|
890
891
|
ref: styles ? 'grid' : contentRef,
|
|
891
892
|
tabindex: -1
|
|
892
893
|
},
|
|
893
|
-
|
|
894
|
+
(() => {
|
|
895
|
+
window.dispatchEvent(onUpdate)
|
|
896
|
+
return content.flat()
|
|
897
|
+
})()
|
|
894
898
|
),
|
|
895
899
|
|
|
896
900
|
tag === 'tbody'
|
|
@@ -139,7 +139,6 @@
|
|
|
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"
|
|
143
142
|
@row-click="log"
|
|
144
143
|
@th-click="log"
|
|
145
144
|
@update:selected="updateSeleted"
|
|
@@ -257,10 +256,11 @@
|
|
|
257
256
|
</div>
|
|
258
257
|
|
|
259
258
|
<div style="margin-top: 100px">
|
|
260
|
-
With sticky columns: both
|
|
259
|
+
With sticky columns: both AND virtual scroll
|
|
261
260
|
<DlTable
|
|
262
261
|
:columns="[...tableColumns, ...tableColumns]"
|
|
263
262
|
sticky-columns="both"
|
|
263
|
+
:virtual-scroll="true"
|
|
264
264
|
:rows="tableRows"
|
|
265
265
|
row-key="id"
|
|
266
266
|
style="height: 300px"
|
|
@@ -552,13 +552,8 @@
|
|
|
552
552
|
:visible-columns="
|
|
553
553
|
tableColumns.slice(0, -1).map((c) => c.name)
|
|
554
554
|
"
|
|
555
|
-
loading
|
|
556
555
|
:resizable="true"
|
|
557
|
-
|
|
558
|
-
<template #body-cell-row-actions>
|
|
559
|
-
<dl-button label="ActionButton" />
|
|
560
|
-
</template>
|
|
561
|
-
</DlTable>
|
|
556
|
+
/>
|
|
562
557
|
</div>
|
|
563
558
|
<div>
|
|
564
559
|
<p>Virtual With editable columns</p>
|
|
@@ -753,7 +748,7 @@ const columns = [
|
|
|
753
748
|
label: 'Calories',
|
|
754
749
|
field: 'calories',
|
|
755
750
|
sortable: true,
|
|
756
|
-
width: '
|
|
751
|
+
width: '10%'
|
|
757
752
|
},
|
|
758
753
|
{
|
|
759
754
|
name: 'fat',
|
|
@@ -1086,21 +1081,19 @@ export default defineComponent({
|
|
|
1086
1081
|
|
|
1087
1082
|
const onScroll = ({ to, ref }: { to: number; ref: any }) => {
|
|
1088
1083
|
const lastIndex = computedRows.value.length - 1
|
|
1089
|
-
|
|
1090
1084
|
if (
|
|
1091
1085
|
infiniteLoading.value !== true &&
|
|
1092
1086
|
nextPageNumber.value < lastPageNumber &&
|
|
1093
1087
|
to === lastIndex
|
|
1094
1088
|
) {
|
|
1095
1089
|
infiniteLoading.value = true
|
|
1096
|
-
|
|
1097
1090
|
setTimeout(() => {
|
|
1098
1091
|
nextPageNumber.value++
|
|
1099
1092
|
nextTick(() => {
|
|
1100
1093
|
ref.refresh()
|
|
1101
1094
|
infiniteLoading.value = false
|
|
1102
1095
|
})
|
|
1103
|
-
},
|
|
1096
|
+
}, 1500)
|
|
1104
1097
|
}
|
|
1105
1098
|
}
|
|
1106
1099
|
|
|
@@ -140,9 +140,6 @@ export function setAllColumnWidths(
|
|
|
140
140
|
stickyColumns: TableStickyPosition,
|
|
141
141
|
fitAllColumns: boolean
|
|
142
142
|
) {
|
|
143
|
-
const hasWidth = columns.some((col) => col.hasOwnProperty('width'))
|
|
144
|
-
if (!hasWidth) return
|
|
145
|
-
table.style.tableLayout = 'fixed'
|
|
146
143
|
columns.forEach((col, i) => {
|
|
147
144
|
browseNestedNodes(
|
|
148
145
|
table,
|
|
@@ -157,7 +154,6 @@ export function setAllColumnWidths(
|
|
|
157
154
|
targetEl.querySelector('.inner-th').scrollWidth) +
|
|
158
155
|
getIconWidth(targetEl) +
|
|
159
156
|
35
|
|
160
|
-
|
|
161
157
|
// Set the width of the column
|
|
162
158
|
targetEl.style.width =
|
|
163
159
|
typeof col.width === 'number' || !col.width
|