@dataloop-ai/components 0.19.96 → 0.19.98

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.96",
3
+ "version": "0.19.98",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -199,12 +199,15 @@ export default defineComponent({
199
199
  return classes
200
200
  })
201
201
 
202
+ const buttonTimeout = ref<any>(null)
203
+
202
204
  return {
203
205
  uuid: `dl-button-${v4()}`,
204
206
  buttonLabelRef,
205
207
  isOverflowing: hasEllipsis,
206
208
  buttonClass,
207
- mouseOver
209
+ mouseOver,
210
+ buttonTimeout
208
211
  }
209
212
  },
210
213
  computed: {
@@ -419,7 +422,10 @@ export default defineComponent({
419
422
  }
420
423
  }
421
424
 
422
- this.$emit('click', e)
425
+ clearTimeout(this.buttonTimeout)
426
+ this.buttonTimeout = setTimeout(() => {
427
+ this.$emit('click', e)
428
+ }, 50)
423
429
  }
424
430
  },
425
431
  onDblClick(e: Event) {
@@ -430,6 +436,7 @@ export default defineComponent({
430
436
  }
431
437
  }
432
438
 
439
+ clearTimeout(this.buttonTimeout)
433
440
  this.$emit('dblclick', e)
434
441
  }
435
442
  },
@@ -546,6 +546,10 @@ export default defineComponent({
546
546
  transform: translateX(40%);
547
547
  display: block;
548
548
  text-align: start;
549
+ width: 60px;
550
+ white-space: nowrap;
551
+ overflow: hidden;
552
+ text-overflow: ellipsis;
549
553
  }
550
554
 
551
555
  .label-tag {
@@ -3,7 +3,22 @@
3
3
  :style="cssVars"
4
4
  :class="chartWrapperClasses"
5
5
  >
6
+ <dl-empty-state
7
+ v-if="isEmpty"
8
+ v-bind="emptyStateProps"
9
+ >
10
+ <template
11
+ v-for="(_, slot) in $slots"
12
+ #[slot]="props"
13
+ >
14
+ <slot
15
+ :name="slot"
16
+ v-bind="props"
17
+ />
18
+ </template>
19
+ </dl-empty-state>
6
20
  <DLScatter
21
+ v-if="!isEmpty"
7
22
  :id="id"
8
23
  ref="scatterChart"
9
24
  :class="chartClasses"
@@ -77,6 +92,7 @@
77
92
  </template>
78
93
 
79
94
  <script lang="ts">
95
+ import { DlEmptyStateProps } from '../../../../basic/DlEmptyState/types'
80
96
  import { Scatter as DLScatter } from '../../types/typedCharts'
81
97
  import {
82
98
  CommonProps,
@@ -89,8 +105,10 @@ import {
89
105
  watch,
90
106
  ref,
91
107
  computed,
92
- toRefs
108
+ toRefs,
109
+ PropType
93
110
  } from 'vue-demi'
111
+ import DlEmptyState from '../../../../basic/DlEmptyState/DlEmptyState.vue'
94
112
  import DlBrush from '../../components/DlBrush.vue'
95
113
  import DlChartLegend from '../../components/DlChartLegend.vue'
96
114
  import DlChartLabels from '../../components/DlChartLabels.vue'
@@ -121,6 +139,11 @@ import type {
121
139
  import { orderBy, merge, isEqual, unionBy, cloneDeep } from 'lodash'
122
140
  import { useThemeVariables } from '../../../../../hooks/use-theme'
123
141
 
142
+ const scatterChartEmptyStateProps = {
143
+ subtitle:
144
+ 'There was a problem processing the request. Please refresh the page.'
145
+ }
146
+
124
147
  ChartJS.register(
125
148
  Title,
126
149
  Tooltip,
@@ -139,13 +162,19 @@ export default defineComponent({
139
162
  DlBrush,
140
163
  DlChartLegend,
141
164
  DLScatter,
142
- DlChartLabels
165
+ DlChartLabels,
166
+ DlEmptyState
143
167
  },
144
168
  props: {
145
169
  id: {
146
170
  type: String,
147
171
  default: null
148
172
  },
173
+ isEmpty: Boolean,
174
+ emptyStateProps: {
175
+ type: Object as PropType<DlEmptyStateProps>,
176
+ default: () => scatterChartEmptyStateProps
177
+ },
149
178
  ...CommonProps,
150
179
  ...ColumnChartProps
151
180
  } as { [key: string]: any },
@@ -611,11 +640,11 @@ export default defineComponent({
611
640
  replaceColor
612
641
  )
613
642
  )
614
-
615
- chart.value.options.scales.x.min = brush.value.min
616
- chart.value.options.scales.x.max = brush.value.max
617
-
618
- chart.value.update()
643
+ if (chart?.value?.options?.scales) {
644
+ chart.value.options.scales.x.min = brush.value.min
645
+ chart.value.options.scales.x.max = brush.value.max
646
+ chart.value.update()
647
+ }
619
648
  })
620
649
 
621
650
  watch(
@@ -275,7 +275,6 @@ export default defineComponent({
275
275
  to: thisMonth
276
276
  }
277
277
  },
278
- { title: 'custom by month', key: MONTH_SIDEBAR_OPTION.custom },
279
278
  {
280
279
  title: 'custom by day',
281
280
  key: MONTH_SIDEBAR_OPTION.custom_by_day,
@@ -287,7 +286,8 @@ export default defineComponent({
287
286
  .startOf('day')
288
287
  .toDate()
289
288
  }
290
- }
289
+ },
290
+ { title: 'custom by month', key: MONTH_SIDEBAR_OPTION.custom }
291
291
  ]
292
292
  },
293
293
  sidebarDayOptions(): DayTypeOption[] {
@@ -1799,12 +1799,17 @@ export default defineComponent({
1799
1799
  emit('th-click', evt, computedRows.value, name)
1800
1800
  }
1801
1801
 
1802
+ const trClickTimeout = ref<any>(null)
1803
+
1802
1804
  const onTrClick = (
1803
1805
  evt: MouseEvent,
1804
1806
  row: DlTableRow,
1805
1807
  pageIndex: number
1806
1808
  ) => {
1807
- emit('row-click', evt, row, pageIndex)
1809
+ clearTimeout(trClickTimeout.value)
1810
+ trClickTimeout.value = setTimeout(() => {
1811
+ emit('row-click', evt, row, pageIndex)
1812
+ }, 50)
1808
1813
  }
1809
1814
 
1810
1815
  const onTrDblClick = (
@@ -1812,6 +1817,7 @@ export default defineComponent({
1812
1817
  row: DlTableRow,
1813
1818
  pageIndex: number
1814
1819
  ) => {
1820
+ clearTimeout(trClickTimeout.value)
1815
1821
  emit('row-dblclick', evt, row, pageIndex)
1816
1822
  }
1817
1823
 
@@ -16,6 +16,19 @@
16
16
  :options="options"
17
17
  style="width: 100%"
18
18
  />
19
+
20
+ <dl-scatter-chart
21
+ id="example-two"
22
+ :brush-props="brushProps"
23
+ :legend-props="legendProps"
24
+ :data="data"
25
+ :options="options"
26
+ style="width: 100%"
27
+ is-empty
28
+ :display-labels="false"
29
+ :display-legend="false"
30
+ :display-brush="false"
31
+ />
19
32
  </div>
20
33
  </template>
21
34