@dataloop-ai/components 0.19.95 → 0.19.97

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.95",
3
+ "version": "0.19.97",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -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[] {
@@ -19,11 +19,13 @@ function getNestedProperty(obj: Record<string, any>, propertyPath: string) {
19
19
  return obj
20
20
  }
21
21
 
22
+ const isDefined = (value: any) => value !== undefined && value !== null
23
+
22
24
  const pathArray = propertyPath.split('.')
23
25
  let value = obj
24
26
 
25
27
  for (const prop of pathArray) {
26
- if (value && value[prop]) {
28
+ if (value && isDefined(value[prop])) {
27
29
  value = value[prop]
28
30
  } else {
29
31
  return undefined
@@ -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