@dataloop-ai/components 0.17.77 → 0.17.79
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
|
@@ -194,14 +194,9 @@ export default defineComponent({
|
|
|
194
194
|
display: none;
|
|
195
195
|
&--visible {
|
|
196
196
|
display: block;
|
|
197
|
-
margin: 5px 0;
|
|
198
197
|
}
|
|
199
198
|
}
|
|
200
199
|
|
|
201
|
-
.dl-list-spaced {
|
|
202
|
-
margin: 5px 0;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
200
|
.dl-list-item-disabled {
|
|
206
201
|
color: var(--dl-color-disabled) !important;
|
|
207
202
|
& > div > i::before {
|
|
@@ -88,7 +88,7 @@ import DlBrush from '../../components/DlBrush.vue'
|
|
|
88
88
|
import DlChartLegend from '../../components/DlChartLegend.vue'
|
|
89
89
|
import DlChartLabels from '../../components/DlChartLabels.vue'
|
|
90
90
|
import { updateKey } from '../../../../../utils/update-key'
|
|
91
|
-
import {
|
|
91
|
+
import { hexToRgbA } from '../../../../../utils'
|
|
92
92
|
import {
|
|
93
93
|
Chart as ChartJS,
|
|
94
94
|
Title,
|
|
@@ -99,10 +99,18 @@ import {
|
|
|
99
99
|
LinearScale,
|
|
100
100
|
PointElement,
|
|
101
101
|
LineElement,
|
|
102
|
+
DatasetController,
|
|
102
103
|
BarControllerDatasetOptions
|
|
103
104
|
} from 'chart.js'
|
|
104
|
-
import type {
|
|
105
|
-
|
|
105
|
+
import type {
|
|
106
|
+
Chart,
|
|
107
|
+
ChartMeta,
|
|
108
|
+
ChartDataset,
|
|
109
|
+
ActiveElement,
|
|
110
|
+
ChartData
|
|
111
|
+
} from 'chart.js'
|
|
112
|
+
import { unionBy, orderBy, merge, isEqual, cloneDeep } from 'lodash'
|
|
113
|
+
import { updateKeys } from '../../../../../utils/update-key'
|
|
106
114
|
import { useThemeVariables } from '../../../../../hooks/use-theme'
|
|
107
115
|
import { getMaxDatasetValue } from '../../utils'
|
|
108
116
|
|
|
@@ -154,15 +162,15 @@ export default defineComponent({
|
|
|
154
162
|
}
|
|
155
163
|
}
|
|
156
164
|
|
|
157
|
-
const chart = computed(() => {
|
|
158
|
-
return columnChart.value?.chart?.value || {}
|
|
159
|
-
})
|
|
160
|
-
|
|
161
165
|
const replaceColor = (key: keyof typeof variables) =>
|
|
162
166
|
variables[key] || key
|
|
163
167
|
|
|
164
168
|
const columnChart = ref(null)
|
|
165
169
|
|
|
170
|
+
const chart = computed(() => {
|
|
171
|
+
return columnChart.value?.chart?.value || {}
|
|
172
|
+
})
|
|
173
|
+
|
|
166
174
|
const brush = reactive({
|
|
167
175
|
value: {
|
|
168
176
|
min: 0,
|
|
@@ -235,6 +243,46 @@ export default defineComponent({
|
|
|
235
243
|
)
|
|
236
244
|
)
|
|
237
245
|
|
|
246
|
+
const getChartBackup = () => {
|
|
247
|
+
if (!chart.value) {
|
|
248
|
+
return {
|
|
249
|
+
data: {},
|
|
250
|
+
options: {}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const datasets: DatasetController<'bar'> = updateKeys(
|
|
254
|
+
props.data.datasets,
|
|
255
|
+
[
|
|
256
|
+
'backgroundColor',
|
|
257
|
+
'pointBackgroundColor',
|
|
258
|
+
'pointBorderColor',
|
|
259
|
+
'borderColor',
|
|
260
|
+
'hoverBorderColor',
|
|
261
|
+
'hoverBackgroundColor',
|
|
262
|
+
'pointHoverBackgroundColor',
|
|
263
|
+
'pointHoverBorderColor'
|
|
264
|
+
],
|
|
265
|
+
replaceColor
|
|
266
|
+
).map((item: BarControllerDatasetOptions) => {
|
|
267
|
+
return {
|
|
268
|
+
...item,
|
|
269
|
+
backgroundColor:
|
|
270
|
+
item.backgroundColor ||
|
|
271
|
+
hexToRgbA(item.backgroundColor as string, 0.2)
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
const chartProps = cloneDeep({
|
|
276
|
+
options: props.options,
|
|
277
|
+
data: {
|
|
278
|
+
...props.data,
|
|
279
|
+
datasets
|
|
280
|
+
}
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
return chartProps
|
|
284
|
+
}
|
|
285
|
+
|
|
238
286
|
const onChartLeave = () => {
|
|
239
287
|
if (chartHoverDataset.value) {
|
|
240
288
|
const filteredItems = chart.value.data.datasets
|
|
@@ -247,11 +295,16 @@ export default defineComponent({
|
|
|
247
295
|
dataset.label !== chartHoverDataset.value.label
|
|
248
296
|
)
|
|
249
297
|
|
|
298
|
+
const backup = getChartBackup()
|
|
299
|
+
|
|
250
300
|
for (const dataset of filteredItems) {
|
|
251
|
-
chart.value.data.datasets[dataset.index].backgroundColor =
|
|
252
|
-
|
|
301
|
+
chart.value.data.datasets[dataset.index].backgroundColor = (
|
|
302
|
+
backup.data as ChartData<'line'>
|
|
303
|
+
).datasets[dataset.index].backgroundColor
|
|
253
304
|
}
|
|
305
|
+
|
|
254
306
|
chart.value.update()
|
|
307
|
+
|
|
255
308
|
chartHoverDataset.value = null
|
|
256
309
|
}
|
|
257
310
|
}
|
|
@@ -286,13 +339,11 @@ export default defineComponent({
|
|
|
286
339
|
dataset.label !== chartHoverDataset.value.label
|
|
287
340
|
)
|
|
288
341
|
|
|
342
|
+
const backup = getChartBackup()
|
|
289
343
|
for (const dataset of filteredItems) {
|
|
290
|
-
chartJS.data.datasets[dataset.index].backgroundColor =
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
dataset.backgroundColor as string
|
|
294
|
-
)
|
|
295
|
-
)
|
|
344
|
+
chartJS.data.datasets[dataset.index].backgroundColor = (
|
|
345
|
+
backup.data as ChartData<'bar'>
|
|
346
|
+
).datasets[dataset.index].backgroundColor
|
|
296
347
|
}
|
|
297
348
|
chartJS.update()
|
|
298
349
|
|
|
@@ -337,13 +388,12 @@ export default defineComponent({
|
|
|
337
388
|
dataset.label !== chartHoverDataset.value.label
|
|
338
389
|
)
|
|
339
390
|
|
|
391
|
+
const backup = getChartBackup()
|
|
392
|
+
|
|
340
393
|
for (const dataset of filteredItems) {
|
|
341
|
-
chartJS.data.datasets[dataset.index].backgroundColor =
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
dataset.backgroundColor as string
|
|
345
|
-
)
|
|
346
|
-
)
|
|
394
|
+
chartJS.data.datasets[dataset.index].backgroundColor = (
|
|
395
|
+
backup.data as ChartData<'bar'>
|
|
396
|
+
).datasets[dataset.index].backgroundColor
|
|
347
397
|
}
|
|
348
398
|
|
|
349
399
|
chartHoverDataset.value = datasetItem
|
|
@@ -461,9 +511,12 @@ export default defineComponent({
|
|
|
461
511
|
dataset.index !== index
|
|
462
512
|
)
|
|
463
513
|
|
|
514
|
+
const backup = getChartBackup()
|
|
515
|
+
|
|
464
516
|
for (const dataset of filteredItems) {
|
|
465
|
-
chart.value.data.datasets[dataset.index].backgroundColor =
|
|
466
|
-
|
|
517
|
+
chart.value.data.datasets[dataset.index].backgroundColor = (
|
|
518
|
+
backup.data as ChartData<'bar'>
|
|
519
|
+
).datasets[dataset.index].backgroundColor
|
|
467
520
|
}
|
|
468
521
|
chart.value.update()
|
|
469
522
|
}
|
|
@@ -38,6 +38,21 @@
|
|
|
38
38
|
<dl-avatar size="24px">
|
|
39
39
|
<img :src="url">
|
|
40
40
|
</dl-avatar>
|
|
41
|
+
<dl-tooltip>
|
|
42
|
+
<div
|
|
43
|
+
style="
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
align-items: center;
|
|
47
|
+
padding: 10px;
|
|
48
|
+
"
|
|
49
|
+
>
|
|
50
|
+
<dl-avatar size="24px">
|
|
51
|
+
<img :src="url">
|
|
52
|
+
</dl-avatar>
|
|
53
|
+
<p>rotem.shaham@dataloop.com</p>
|
|
54
|
+
</div>
|
|
55
|
+
</dl-tooltip>
|
|
41
56
|
<div />
|
|
42
57
|
</div>
|
|
43
58
|
</div>
|
|
@@ -56,7 +71,7 @@
|
|
|
56
71
|
|
|
57
72
|
<script lang="ts">
|
|
58
73
|
import { defineComponent } from 'vue-demi'
|
|
59
|
-
import { DlAvatar, DlColumnChart } from '../components'
|
|
74
|
+
import { DlAvatar, DlColumnChart, DlTooltip } from '../components'
|
|
60
75
|
|
|
61
76
|
import { orderBy } from 'lodash'
|
|
62
77
|
|
|
@@ -213,7 +228,8 @@ export default defineComponent({
|
|
|
213
228
|
name: 'DlColumnChartDemo',
|
|
214
229
|
components: {
|
|
215
230
|
DlColumnChart,
|
|
216
|
-
DlAvatar
|
|
231
|
+
DlAvatar,
|
|
232
|
+
DlTooltip
|
|
217
233
|
},
|
|
218
234
|
data() {
|
|
219
235
|
return {
|