@dataloop-ai/components 0.19.54 → 0.19.56

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.54",
3
+ "version": "0.19.56",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -1750,7 +1750,14 @@ export default defineComponent({
1750
1750
  }
1751
1751
  }
1752
1752
 
1753
+ const prevScroll = ref<DlVirtualScrollEvent>(null)
1754
+
1753
1755
  function onVScroll(info: DlVirtualScrollEvent) {
1756
+ if (isEqual(prevScroll.value, info)) {
1757
+ return
1758
+ }
1759
+
1760
+ prevScroll.value = info
1754
1761
  emit('virtual-scroll', info)
1755
1762
  }
1756
1763
 
@@ -35,7 +35,11 @@ export default defineComponent({
35
35
  type: Number,
36
36
  default: null
37
37
  },
38
- noTooltip: Boolean
38
+ noTooltip: Boolean,
39
+ padding: {
40
+ type: String,
41
+ default: '0 10px'
42
+ }
39
43
  },
40
44
  setup(props) {
41
45
  const vm = getCurrentInstance()
@@ -63,7 +67,7 @@ export default defineComponent({
63
67
  })
64
68
 
65
69
  const tdStyles = computed(() => {
66
- let styles = ''
70
+ let styles = `padding: ${props.padding};`
67
71
 
68
72
  if (props.bgColor) {
69
73
  styles = styles.concat(
@@ -75,6 +75,10 @@ export default defineComponent({
75
75
  pagination: {
76
76
  type: Object,
77
77
  default: () => ({})
78
+ },
79
+ padding: {
80
+ type: String,
81
+ default: '0 10px'
78
82
  }
79
83
  },
80
84
  emits: ['click'],
@@ -176,6 +180,9 @@ export default defineComponent({
176
180
  iconClass: column?.value?.iconClass ?? null,
177
181
  hasOptionalProps,
178
182
  headerStyle: [
183
+ {
184
+ padding: props.padding
185
+ },
179
186
  isString(attrs.style)
180
187
  ? stringStyleToRecord(attrs.style)
181
188
  : attrs.style,
@@ -54,7 +54,7 @@ export function useTableColumnSelection(
54
54
  : colList.value
55
55
 
56
56
  const updatedCols = cols.map((col) => {
57
- const align = col.align || 'right'
57
+ const align = col.align || 'left'
58
58
  const alignClass = ` text-${align}`
59
59
 
60
60
  const transform: string = col.textTransform || 'default'
@@ -25,6 +25,7 @@
25
25
  name="John"
26
26
  />
27
27
  <dl-avatar
28
+ name="test"
28
29
  tooltip="popcat@gmail.com"
29
30
  size="72px"
30
31
  >
@@ -505,6 +505,67 @@
505
505
  no-data-label="NOoooooOOOOOoooooo"
506
506
  />
507
507
  </div>
508
+ <div>
509
+ <p>With alignments</p>
510
+ <DlTable
511
+ :expanded="expanded"
512
+ :columns="tableColumnsAligned"
513
+ expandable-rows
514
+ class="sticky-header"
515
+ :rows="tableRows"
516
+ row-key="id"
517
+ style="height: 500px"
518
+ :rows-per-page-options="rowsPerPageOptions"
519
+ @row-click="log"
520
+ @th-click="log"
521
+ @update:selected="updateSeleted"
522
+ @update:expanded="updateExpanded"
523
+ >
524
+ <template #body-cell-carbs="{ row }">
525
+ <div class="row">
526
+ {{ row.carbs }}
527
+ <dl-avatar
528
+ tooltip="popcat@gmail.com"
529
+ size="15px"
530
+ >
531
+ <img
532
+ src="https://popcat.click/twitter-card.jpg"
533
+ style="width: 15px; height: 15px"
534
+ >
535
+ </dl-avatar>
536
+ </div>
537
+ </template>
538
+ <template #body-cell-expandable-content="{ row }">
539
+ <div
540
+ v-if="
541
+ [
542
+ tableRows[0].name,
543
+ tableRows[1].name,
544
+ tableRows[2].name
545
+ ].includes(row.name)
546
+ "
547
+ class="expanded-row"
548
+ >
549
+ This is some more information about {{ row.name }}
550
+ </div>
551
+ <div
552
+ v-else-if="
553
+ [
554
+ tableRows[3].name,
555
+ tableRows[4].name,
556
+ tableRows[5].name
557
+ ].includes(row.name)
558
+ "
559
+ class="expanded-row"
560
+ >
561
+ <img
562
+ src="https://popcat.click/twitter-card.jpg"
563
+ style="width: 150px; height: 150px"
564
+ >
565
+ </div>
566
+ </template>
567
+ </DlTable>
568
+ </div>
508
569
  </div>
509
570
  </template>
510
571
 
@@ -733,6 +794,78 @@ const rows = [
733
794
  }))
734
795
  ]
735
796
 
797
+ const columnsAligned = [
798
+ {
799
+ name: 'name',
800
+ required: true,
801
+ label: 'Dessert (100g serving)asdfasdfasdfasdf',
802
+ align: 'left',
803
+ field: 'name',
804
+ sortable: true,
805
+ textTransform: 'uppercase',
806
+ hint: 'test hint'
807
+ },
808
+ {
809
+ name: 'calories',
810
+ align: 'right',
811
+ label: 'Caloriesasdfasdfasdfasdfasdf',
812
+ field: 'calories',
813
+ sortable: true,
814
+ width: 100
815
+ },
816
+ {
817
+ name: 'fat',
818
+ label: 'Fat (g)',
819
+ field: 'fat',
820
+ sortable: true,
821
+ align: 'center',
822
+ width: 100
823
+ },
824
+ {
825
+ name: 'carbs',
826
+ label: 'Carbs (g)',
827
+ field: 'carbs',
828
+ align: 'right',
829
+ width: 100
830
+ },
831
+ {
832
+ name: 'protein',
833
+ label: 'Protein (g)',
834
+ field: 'protein',
835
+ align: 'left',
836
+ width: 100
837
+ },
838
+ {
839
+ name: 'sodium',
840
+ label: 'Sodium (mg)',
841
+ field: 'sodium',
842
+ align: 'right',
843
+ width: 100
844
+ },
845
+ {
846
+ name: 'calcium',
847
+ label: 'Calcium (%)',
848
+ field: 'calcium',
849
+ sortable: true,
850
+ textTransform: 'lowercase',
851
+ align: 'right',
852
+ width: 100,
853
+ sort: (a: string | number, b: string | number) =>
854
+ parseInt(a as string, 10) - parseInt(b as string, 10)
855
+ },
856
+ {
857
+ name: 'iron',
858
+ label: 'Iron (%)',
859
+ field: 'iron',
860
+ sortable: true,
861
+ textTransform: 'lowercase',
862
+ align: 'left',
863
+ width: 100,
864
+ sort: (a: string | number, b: string | number) =>
865
+ parseInt(a as string, 10) - parseInt(b as string, 10)
866
+ }
867
+ ]
868
+
736
869
  type Rows = (typeof rows)[0]
737
870
 
738
871
  interface RowsWithIndex extends Rows {
@@ -765,6 +898,7 @@ export default defineComponent({
765
898
  const tableRows = ref(cloneDeep(rows))
766
899
  const draggable = ref('both')
767
900
  const tableColumns = ref(columns)
901
+ const tableColumnsAligned = ref(columnsAligned)
768
902
  const rowsPerPageOptions = ref([10, 12, 14, 16])
769
903
 
770
904
  const infiniteLoading = ref(false)
@@ -919,7 +1053,8 @@ export default defineComponent({
919
1053
  isLastPage,
920
1054
  isFirstPage,
921
1055
  rows2,
922
- columns2
1056
+ columns2,
1057
+ tableColumnsAligned
923
1058
  }
924
1059
  },
925
1060