@dataloop-ai/components 0.19.60 → 0.19.62

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.60",
3
+ "version": "0.19.62",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -78,8 +78,6 @@ export default defineComponent({
78
78
  ]
79
79
 
80
80
  const inputValue = ref('')
81
- const isInputActive = ref(false)
82
- const inputBorderLeft = ref('2px solid transparent')
83
81
  const currentSelectedLabel = ref<DlLabelPickerItem>(null)
84
82
 
85
83
  const handleRowClick = (_: MouseEvent, item: DlLabelPickerItem) => {
@@ -103,16 +101,16 @@ export default defineComponent({
103
101
  })
104
102
 
105
103
  const inputStyles = computed(() => {
104
+ if (!selectedColor.value) {
105
+ return {}
106
+ }
106
107
  return { 'border-left': `2px solid ${selectedColor.value}` }
107
108
  })
108
109
 
109
110
  return {
110
111
  handleRowClick,
111
112
  inputValue,
112
- inputBorderLeft,
113
- isInputActive,
114
113
  columns,
115
- selectedColor,
116
114
  placeHolderText,
117
115
  inputStyles
118
116
  }
@@ -815,7 +815,7 @@
815
815
  </div>
816
816
 
817
817
  <div
818
- v-if="!hideBottom"
818
+ v-if="!hideBottom || (nothingToDisplay && !hideNoData)"
819
819
  :class="bottomClasses"
820
820
  >
821
821
  <div
@@ -294,7 +294,7 @@ export default defineComponent({
294
294
 
295
295
  const mainTbodyUuid = `dl-tree-table-tbody-${v4()}`
296
296
 
297
- const mainTableKey = ref()
297
+ const mainTableKey = ref(v4())
298
298
 
299
299
  const { rows: tableRows, columns: tableColumns } = toRefs(props)
300
300
 
@@ -317,7 +317,8 @@ export default defineComponent({
317
317
  const getRowKey = computed(() =>
318
318
  typeof props.rowKey === 'function'
319
319
  ? props.rowKey
320
- : (row: Record<string, any>) => row[props.rowKey as string]
320
+ : (row: Record<string, any>) =>
321
+ row[props.rowKey as string] ?? ''
321
322
  )
322
323
 
323
324
  const hasDraggableRows = computed(() =>
@@ -347,45 +348,44 @@ export default defineComponent({
347
348
  name: string,
348
349
  rowsArr: DlTableRow[] = tableRows.value
349
350
  ) => {
350
- rowsArr.some((o) => {
351
- if (getRowKey.value(o) === name) {
351
+ for (const row of rowsArr) {
352
+ if (getRowKey.value(row) === name) {
352
353
  if (isVue2) {
353
- set(o, 'isExpanded', isExpanded)
354
+ set(row, 'isExpanded', isExpanded)
354
355
  } else {
355
- o.isExpanded = isExpanded
356
+ row.isExpanded = isExpanded
356
357
  }
357
- updateNestedRows(o, isExpanded)
358
+ updateNestedRows(row, isExpanded)
358
359
  } else {
359
- if ((o.children || []).length > 0) {
360
- updateExpandedRow(isExpanded, name, o.children)
360
+ if ((row.children || []).length > 0) {
361
+ updateExpandedRow(isExpanded, name, row.children)
361
362
  }
362
363
  }
363
- })
364
+ }
364
365
  }
365
366
  const updateNestedRows = (
366
367
  row: (typeof computedRows.value)[number],
367
368
  isExpanded: boolean
368
369
  ) => {
369
- if ((row.children || []).length > 0) {
370
- row.children.forEach(
371
- (r: (typeof computedRows.value)[number]) => {
372
- if (isVue2) {
373
- set(r, 'isExpanded', isExpanded)
374
- } else {
375
- r.isExpanded = isExpanded
376
- }
377
-
378
- if (!isExpanded) {
379
- if (isVue2) {
380
- set(r, 'isExpanded', isExpanded)
381
- } else {
382
- r.isExpanded = isExpanded
383
- }
370
+ if (!row.children) {
371
+ return
372
+ }
373
+
374
+ for (const r of row.children) {
375
+ if (isVue2) {
376
+ set(r, 'isExpanded', isExpanded)
377
+ } else {
378
+ r.isExpanded = isExpanded
379
+ }
384
380
 
385
- updateNestedRows(r, isExpanded)
386
- }
381
+ if (!isExpanded) {
382
+ if (isVue2) {
383
+ set(r, 'isExpanded', isExpanded)
384
+ } else {
385
+ r.isExpanded = isExpanded
387
386
  }
388
- )
387
+ updateNestedRows(r, isExpanded)
388
+ }
389
389
  }
390
390
  }
391
391
  const updateSelectionHierarchy = (
@@ -61,6 +61,9 @@ export default defineComponent({
61
61
  watch: {
62
62
  'props.row': {
63
63
  handler(row: DlTableRow) {
64
+ if (!this.$refs.dlTrTreeRef) {
65
+ return
66
+ }
64
67
  (this.$refs.dlTrTreeRef as any).setAttribute(
65
68
  'data-is-visible',
66
69
  row.isExpandedParent || row.level === 1
@@ -1,7 +1,11 @@
1
1
  <template>
2
2
  <div>
3
3
  <div>Label picker component</div>
4
- <DlLabelPicker :items="items" />
4
+ <DlLabelPicker
5
+ :items="items"
6
+ @selected-label="setSelectedEvent"
7
+ />
8
+ <div>last selected: {{ lastSelected }}</div>
5
9
  </div>
6
10
  </template>
7
11
 
@@ -63,7 +67,11 @@ export default defineComponent({
63
67
  },
64
68
  setup() {
65
69
  const items = ref(rows)
66
- return { items }
70
+ const lastSelected = ref<DlLabelPickerItem>(null)
71
+ const setSelectedEvent = (item: DlLabelPickerItem) => {
72
+ lastSelected.value = item
73
+ }
74
+ return { items, lastSelected, setSelectedEvent }
67
75
  }
68
76
  })
69
77
  </script>
@@ -506,6 +506,30 @@
506
506
  no-data-label="NOoooooOOOOOoooooo"
507
507
  />
508
508
  </div>
509
+ <div>
510
+ <p>With empty data virtual scroll</p>
511
+ <DlTable
512
+ :rows="[]"
513
+ :columns="tableColumns"
514
+ title="empty data"
515
+ no-data-label="NOoooooOOOOOoooooo"
516
+ virtual-scroll
517
+ />
518
+ </div>
519
+ <div>
520
+ <p>With empty data virtual scroll no data slot</p>
521
+ <DlTable
522
+ :rows="[]"
523
+ :columns="tableColumns"
524
+ title="empty data"
525
+ virtual-scroll
526
+ hide-bottom
527
+ >
528
+ <template #no-data>
529
+ <div>&lt slot#no-data ></div>
530
+ </template>
531
+ </DlTable>
532
+ </div>
509
533
  <div>
510
534
  <p>With alignments</p>
511
535
  <DlTable