@dataloop-ai/components 0.19.140 → 0.19.142

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