@dataloop-ai/components 0.13.19 → 0.14.4

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.
Files changed (94) hide show
  1. package/.nvmrc +1 -0
  2. package/README.md +3 -1
  3. package/package.json +19 -17
  4. package/src/assets/globals.scss +38 -3
  5. package/src/assets/grid.scss +9 -0
  6. package/src/components/DlAccordion/DlAccordion.vue +4 -4
  7. package/src/components/DlAlert.vue +6 -6
  8. package/src/components/DlChart/BrushThumb.vue +83 -0
  9. package/src/components/DlChart/DlBarChart.vue +545 -0
  10. package/src/components/DlChart/DlBrush.vue +475 -0
  11. package/src/components/DlChart/DlChartLabels.vue +279 -0
  12. package/src/components/DlChart/DlChartLegend.vue +141 -0
  13. package/src/components/DlChart/DlColumnChart.vue +555 -0
  14. package/src/components/DlChart/DlLineChart.vue +644 -0
  15. package/src/components/DlChart/DlScrollBar.vue +147 -0
  16. package/src/components/DlChart/Doughnut/DlDoughnutChart.vue +448 -0
  17. package/src/components/DlChart/Doughnut/DlDoughnutChartLegend.vue +281 -0
  18. package/src/components/DlChart/Doughnut/DlDoughnutChartWidget.vue +64 -0
  19. package/src/components/DlChart/Doughnut/types/TDoughnutChartAnimation.ts +4 -0
  20. package/src/components/DlChart/Doughnut/types/TDoughnutChartData.ts +16 -0
  21. package/src/components/DlChart/Doughnut/types/TDoughnutChartOptions.ts +11 -0
  22. package/src/components/DlChart/Doughnut/types/TDoughnutChartProps.ts +8 -0
  23. package/src/components/DlChart/Doughnut/types/TDoughnutWithOriginalColor.ts +13 -0
  24. package/src/components/DlChart/chart.ts +122 -0
  25. package/src/components/DlChart/index.ts +36 -0
  26. package/src/components/DlChart/props.ts +348 -0
  27. package/src/components/DlChart/typedCharts.ts +88 -0
  28. package/src/components/DlChart/types.ts +63 -0
  29. package/src/components/DlChart/utils.ts +153 -0
  30. package/src/components/DlChip/DlChip.vue +40 -13
  31. package/src/components/DlCounters.vue +31 -7
  32. package/src/components/DlDatePicker/DlCalendar.vue +22 -10
  33. package/src/components/DlDatePicker/DlDatePicker.vue +8 -5
  34. package/src/components/DlDateTimeRange/types.ts +2 -2
  35. package/src/components/DlDropdownButton.vue +5 -3
  36. package/src/components/DlMenu/DlMenu.vue +4 -2
  37. package/src/components/DlPagination/RowsSelector.vue +15 -2
  38. package/src/components/DlPopup/DlPopup.vue +0 -1
  39. package/src/components/DlRange/DlRange.vue +3 -2
  40. package/src/components/DlSearch.vue +1 -1
  41. package/src/components/DlSelect/DlSelect.vue +3 -2
  42. package/src/components/DlSlider/sliderStyles.scss +4 -0
  43. package/src/components/DlSlider/useSlider.ts +39 -12
  44. package/src/components/DlSmartSearch/DlSuggestionsDropdown.vue +1 -1
  45. package/src/components/DlSpinner.vue +259 -0
  46. package/src/components/DlTable/DlTable.vue +4 -1
  47. package/src/components/DlTable/hooks/tablePagination.ts +8 -2
  48. package/src/components/DlTextArea.vue +9 -0
  49. package/src/components/DlTextInput.vue +4 -2
  50. package/src/components/DlThemeProvider.vue +22 -13
  51. package/src/components/DlToastMessage/api/useToast.ts +23 -0
  52. package/src/components/DlToastMessage/components/ToastComponent.vue +279 -0
  53. package/src/components/DlToastMessage/index.ts +5 -0
  54. package/src/components/DlToastMessage/types.ts +4 -0
  55. package/src/components/DlToastMessage/utils/config.ts +17 -0
  56. package/src/components/DlToastMessage/utils/render.ts +56 -0
  57. package/src/components/DlTypography.vue +1 -1
  58. package/src/components/DlWidget/DlGrid.vue +33 -0
  59. package/src/components/DlWidget/DlGridRow.vue +32 -0
  60. package/src/components/DlWidget/DlWidget.vue +202 -11
  61. package/src/components/DlWidget/index.ts +2 -2
  62. package/src/components/DlWidget/utils.ts +26 -19
  63. package/src/components/index.ts +8 -3
  64. package/src/demo/BarChartDemo.vue +77 -0
  65. package/src/demo/ColumnChartDemo.vue +230 -0
  66. package/src/demo/DlButtonDemo.vue +1 -1
  67. package/src/demo/DlChartDoughnutDemo.vue +229 -0
  68. package/src/demo/DlChipDemo.vue +42 -18
  69. package/src/demo/DlDialogBoxDemo.vue +4 -4
  70. package/src/demo/DlDropdownButtonDemo.vue +1 -1
  71. package/src/demo/DlLineChartDemo.vue +375 -0
  72. package/src/demo/DlMenuDemo.vue +1 -1
  73. package/src/demo/DlOptionGroupDemo.vue +1 -1
  74. package/src/demo/DlSelectDemo.vue +1 -1
  75. package/src/demo/DlSpinnerDemo.vue +20 -0
  76. package/src/demo/DlTableDemo.vue +13 -94
  77. package/src/demo/DlToastMessageDemo.vue +143 -0
  78. package/src/demo/DlWidgetDemo.vue +105 -143
  79. package/src/demo/index.ts +20 -2
  80. package/src/hooks/use-theme.ts +19 -0
  81. package/src/utils/abbreviate-to-string.ts +14 -0
  82. package/src/utils/colors.ts +47 -0
  83. package/src/utils/getRootStyles.ts +1 -1
  84. package/src/utils/index.ts +1 -0
  85. package/src/utils/position-engine.ts +11 -2
  86. package/src/utils/swapNodes.ts +30 -0
  87. package/src/utils/update-key.ts +90 -0
  88. package/tsconfig.json +0 -1
  89. package/vite.config.ts +17 -0
  90. package/Dockerfile +0 -12
  91. package/jest.config.js +0 -16
  92. package/jest.setup.js +0 -59
  93. package/src/components/DlWidget/DlWidgetGrid.vue +0 -360
  94. package/storybook.js +0 -8
@@ -0,0 +1,644 @@
1
+ <template>
2
+ <div :class="chartWrapperClasses">
3
+ <DlLine
4
+ :id="id"
5
+ ref="lineChart"
6
+ :class="chartClasses"
7
+ :style="(chartStyles, `max-height: ${wrapperHeight}`)"
8
+ :data="chartData"
9
+ :options="chartOptions"
10
+ @mouseout="onChartLeave"
11
+ />
12
+ <slot
13
+ v-if="displayLabels"
14
+ v-bind="{ ...labelStyles, labels: xLabels, chartWidth }"
15
+ name="axe-x-labels"
16
+ >
17
+ <dl-chart-labels
18
+ :font-size="labelStyles.labelSize"
19
+ :title="labelStyles.title"
20
+ :title-size="labelStyles.titleSize"
21
+ :title-color="labelStyles.titleColor"
22
+ :label-color="labelStyles.labelColor"
23
+ :width="chartWidth"
24
+ :labels="xLabels"
25
+ />
26
+ </slot>
27
+ <slot
28
+ v-if="displayBrush"
29
+ v-bind="{
30
+ chartWidth,
31
+ modelValue: brush.value,
32
+ handleBrushUpdate,
33
+ brushClasses,
34
+ ...brushProperties
35
+ }"
36
+ name="brush"
37
+ >
38
+ <dl-brush
39
+ :model-value="brush.value"
40
+ :width="chartWidth"
41
+ :min="brushProperties.min"
42
+ :max="brushProperties.max"
43
+ :class="brushClasses"
44
+ :thumb-size="brushProperties.thumbSize"
45
+ :track-size="brushProperties.trackSize"
46
+ :step="brushProperties.step"
47
+ :drag-range="brushProperties.dragRange"
48
+ @update:model-value="handleBrushUpdate"
49
+ />
50
+ </slot>
51
+ <slot
52
+ v-if="displayLegend"
53
+ v-bind="{
54
+ data: legendDatasets,
55
+ chartWidth,
56
+ onHide: hideData,
57
+ onHoverLegend,
58
+ onLeaveLegend,
59
+ ...legendProperties
60
+ }"
61
+ name="legend"
62
+ >
63
+ <dl-chart-legend
64
+ :datasets="legendDatasets"
65
+ :width="chartWidth"
66
+ :class="legendClasses"
67
+ :align-items="legendProperties.alignItems"
68
+ @hide="hideData"
69
+ @on-hover="onHoverLegend"
70
+ @on-leave="onLeaveLegend"
71
+ />
72
+ </slot>
73
+ </div>
74
+ </template>
75
+
76
+ <script lang="ts">
77
+ import { Line as DlLine } from '.'
78
+ import { CommonProps, ColumnChartProps, defaultLineChartProps } from './props'
79
+ import { defineComponent, reactive, watch, ref, computed } from 'vue-demi'
80
+ import DlBrush from './DlBrush.vue'
81
+ import DlChartLegend from './DlChartLegend.vue'
82
+ import DlChartLabels from './DlChartLabels.vue'
83
+ import { updateKeys } from '../../utils/update-key'
84
+ import { hexToRgbA } from '../../utils'
85
+ import {
86
+ Chart as ChartJS,
87
+ Title,
88
+ Tooltip,
89
+ Legend,
90
+ BarElement,
91
+ CategoryScale,
92
+ LinearScale,
93
+ PointElement,
94
+ LineElement,
95
+ BarControllerDatasetOptions,
96
+ TimeScale
97
+ } from 'chart.js'
98
+ import type {
99
+ Chart,
100
+ ChartMeta,
101
+ ChartDataset,
102
+ ActiveElement,
103
+ ChartData,
104
+ DatasetController,
105
+ LineControllerDatasetOptions
106
+ } from 'chart.js'
107
+ import { orderBy, merge, isEqual, unionBy, cloneDeep } from 'lodash'
108
+ import { useThemeVariables } from '../../hooks/use-theme'
109
+
110
+ ChartJS.register(
111
+ Title,
112
+ Tooltip,
113
+ Legend,
114
+ BarElement,
115
+ CategoryScale,
116
+ LinearScale,
117
+ PointElement,
118
+ LineElement,
119
+ TimeScale
120
+ )
121
+
122
+ export default defineComponent({
123
+ name: 'DlLineChart',
124
+ components: {
125
+ DlBrush,
126
+ DlChartLegend,
127
+ DlLine,
128
+ DlChartLabels
129
+ },
130
+ props: {
131
+ id: {
132
+ type: String,
133
+ default: null
134
+ },
135
+ ...CommonProps,
136
+ ...ColumnChartProps
137
+ },
138
+ setup(props, { slots }) {
139
+ const { variables } = useThemeVariables()
140
+
141
+ const chartWidth = ref('100%')
142
+
143
+ const chartHoverDataset: { value: null | ChartMeta } = {
144
+ value: null
145
+ }
146
+
147
+ const onResize = (
148
+ chart: Chart,
149
+ size: { height: number; width: number }
150
+ ) => {
151
+ if (chart?.scales?.x?.width) {
152
+ chartWidth.value = `${parseInt(
153
+ chart.scales.x.width as unknown as string
154
+ )}px`
155
+ }
156
+ }
157
+
158
+ const chart = computed(() => {
159
+ return lineChart.value?.chart?.value || {}
160
+ })
161
+
162
+ const replaceColor = (key: keyof typeof variables) =>
163
+ variables[key] || key
164
+
165
+ const lineChart = ref(null)
166
+
167
+ const brush = reactive({
168
+ value: {
169
+ min: 0,
170
+ max:
171
+ orderBy(props.data.datasets, (o) => o.data.length)[0].data
172
+ .length - 1
173
+ }
174
+ })
175
+
176
+ const getChartBackup = () => {
177
+ if (!chart.value) {
178
+ return {
179
+ data: {},
180
+ options: {}
181
+ }
182
+ }
183
+ const datasets: DatasetController<'line'> = updateKeys(
184
+ props.data.datasets,
185
+ [
186
+ 'backgroundColor',
187
+ 'pointBackgroundColor',
188
+ 'pointBorderColor',
189
+ 'borderColor',
190
+ 'hoverBorderColor',
191
+ 'hoverBackgroundColor',
192
+ 'pointHoverBackgroundColor',
193
+ 'pointHoverBorderColor'
194
+ ],
195
+ replaceColor
196
+ ).map((item: LineControllerDatasetOptions) => {
197
+ return {
198
+ ...item,
199
+ hoverBackgroundColor:
200
+ item.hoverBackgroundColor ||
201
+ hexToRgbA(item.backgroundColor as string, 0.2),
202
+ hoverBorderColor:
203
+ item.hoverBorderColor ||
204
+ hexToRgbA(item.backgroundColor as string, 0.2)
205
+ }
206
+ })
207
+
208
+ const chartProps = cloneDeep({
209
+ options: props.options,
210
+ data: {
211
+ ...props.data,
212
+ datasets
213
+ }
214
+ })
215
+
216
+ return chartProps
217
+ }
218
+
219
+ const chartWrapperClasses = computed(() => {
220
+ const classes = 'dl-line-chart-wrapper'
221
+
222
+ if (props.rootClass) {
223
+ classes.concat(' ', props.rootClass)
224
+ }
225
+
226
+ return classes
227
+ })
228
+
229
+ const chartClasses = computed(() => {
230
+ const classes = 'dl-line-chart'
231
+
232
+ if (props.chartClass) {
233
+ classes.concat(' ', props.chartClass)
234
+ }
235
+
236
+ return classes
237
+ })
238
+
239
+ const brushClasses = computed(() => {
240
+ const classes = 'dl-brush'
241
+
242
+ if (props.brushClass) {
243
+ classes.concat(' ', props.brushClass)
244
+ }
245
+
246
+ return classes
247
+ })
248
+
249
+ const legendClasses = computed(() => {
250
+ const classes = 'dl-legend'
251
+
252
+ if (props.legendClass) {
253
+ classes.concat(' ', props.legendClass)
254
+ }
255
+
256
+ return classes
257
+ })
258
+
259
+ const brushProperties = computed(() => {
260
+ return merge(defaultLineChartProps.brushProps, props.brushProps)
261
+ })
262
+
263
+ const legendProperties = computed(() => {
264
+ return merge(defaultLineChartProps.legendProps, props.legendProps)
265
+ })
266
+
267
+ const replaceDataColors = (data: ChartData) =>
268
+ updateKeys(
269
+ data,
270
+ [
271
+ 'backgroundColor',
272
+ 'pointBackgroundColor',
273
+ 'pointBorderColor',
274
+ 'borderColor',
275
+ 'hoverBorderColor',
276
+ 'hoverBackgroundColor',
277
+ 'pointHoverBackgroundColor',
278
+ 'pointHoverBorderColor'
279
+ ],
280
+ replaceColor
281
+ )
282
+
283
+ const chartData = ref(replaceDataColors(props.data))
284
+
285
+ const legendDatasets = ref(
286
+ unionBy(
287
+ props.legendProps?.datasets || [],
288
+ props.data?.datasets || [],
289
+ 'label'
290
+ )
291
+ )
292
+
293
+ const onChartLeave = () => {
294
+ if (chartHoverDataset.value) {
295
+ const filteredItems = chart.value.data.datasets
296
+ .map((d: ChartDataset, i: number) => ({
297
+ ...d,
298
+ index: i
299
+ }))
300
+ .filter(
301
+ (dataset: ChartDataset) =>
302
+ dataset.label !== chartHoverDataset.value.label
303
+ )
304
+
305
+ const backup = getChartBackup()
306
+
307
+ for (const dataset of filteredItems) {
308
+ chart.value.data.datasets[dataset.index].backgroundColor = (
309
+ backup.data as ChartData<'line'>
310
+ ).datasets[dataset.index].backgroundColor
311
+ chart.value.data.datasets[dataset.index].borderColor = (
312
+ backup.data as ChartData<'line'>
313
+ ).datasets[dataset.index].borderColor
314
+ }
315
+ chartHoverDataset.value = null
316
+
317
+ chart.value.update()
318
+ }
319
+ }
320
+
321
+ const onHover = (
322
+ event: Event,
323
+ items: ActiveElement[],
324
+ chartJS: Chart
325
+ ) => {
326
+ if (event.type !== 'mousemove') {
327
+ return
328
+ }
329
+ if (
330
+ items.length === 0 ||
331
+ chartJS.getElementsAtEventForMode(
332
+ event,
333
+ 'nearest',
334
+ {
335
+ intersect: true
336
+ },
337
+ true
338
+ ).length === 0
339
+ ) {
340
+ if (chartHoverDataset.value) {
341
+ const filteredItems = chartJS.data.datasets
342
+ .map((d: ChartDataset, i: number) => ({
343
+ ...d,
344
+ index: i
345
+ }))
346
+ .filter(
347
+ (dataset: ChartDataset) =>
348
+ dataset.label !== chartHoverDataset.value.label
349
+ )
350
+ const backup = getChartBackup()
351
+ for (const dataset of filteredItems) {
352
+ chartJS.data.datasets[dataset.index].backgroundColor = (
353
+ backup.data as ChartData<'line'>
354
+ ).datasets[dataset.index].backgroundColor
355
+
356
+ chartJS.data.datasets[dataset.index].borderColor = (
357
+ backup.data as ChartData<'line'>
358
+ ).datasets[dataset.index].borderColor
359
+ }
360
+
361
+ chartHoverDataset.value = null
362
+
363
+ chartJS.update()
364
+ }
365
+ return
366
+ } else {
367
+ const item = items[0]
368
+ const datasetItem = chartJS.getDatasetMeta(item.datasetIndex)
369
+ if (!chartHoverDataset.value) {
370
+ const filteredDatasets = chartJS.data.datasets
371
+ .map((d: ChartDataset, i: number) => ({
372
+ ...d,
373
+ index: i
374
+ }))
375
+ .filter(
376
+ (ds: ChartDataset) => ds.label !== datasetItem.label
377
+ )
378
+ for (const dataset of filteredDatasets) {
379
+ chartJS.data.datasets[dataset.index].backgroundColor =
380
+ hexToRgbA(dataset.backgroundColor as string, 0.2)
381
+
382
+ chart.value.data.datasets[dataset.index].borderColor =
383
+ dataset?.hoverBorderColor ||
384
+ hexToRgbA(dataset.backgroundColor as string, 0.2)
385
+ }
386
+
387
+ chartHoverDataset.value = datasetItem
388
+
389
+ chartJS.update()
390
+
391
+ return
392
+ }
393
+ if (!isEqual(chartHoverDataset.value, datasetItem)) {
394
+ const filteredItems = chartJS.data.datasets
395
+ .map((d: ChartDataset, i: number) => ({
396
+ ...d,
397
+ index: i
398
+ }))
399
+ .filter(
400
+ (dataset: ChartDataset) =>
401
+ dataset.label !== chartHoverDataset.value.label
402
+ )
403
+
404
+ const backup = getChartBackup()
405
+ for (const dataset of filteredItems) {
406
+ chartJS.data.datasets[dataset.index].backgroundColor = (
407
+ backup.data as ChartData<'line'>
408
+ ).datasets[dataset.index].backgroundColor
409
+
410
+ chartJS.data.datasets[dataset.index].borderColor = (
411
+ backup.data as ChartData<'line'>
412
+ ).datasets[dataset.index].borderColor
413
+ }
414
+ chartHoverDataset.value = datasetItem
415
+ const allFilteredItems = chartJS.data.datasets
416
+ .map((d: ChartDataset, i: number) => ({
417
+ ...d,
418
+ index: i
419
+ }))
420
+ .filter(
421
+ (dataset: ChartDataset) =>
422
+ dataset.label !== datasetItem.label
423
+ )
424
+ for (const dataset of allFilteredItems) {
425
+ chartJS.data.datasets[dataset.index].backgroundColor =
426
+ hexToRgbA(dataset.backgroundColor as string, 0.2)
427
+ }
428
+ chartJS.update()
429
+ }
430
+ }
431
+ }
432
+
433
+ const chartOptions = reactive(
434
+ updateKeys(
435
+ merge(
436
+ { onResize, onHover },
437
+ defaultLineChartProps.options,
438
+ props.options
439
+ ),
440
+ ['color'],
441
+ replaceColor
442
+ )
443
+ )
444
+
445
+ watch(
446
+ () => chart.value?.scales?.x?.width,
447
+ (val: string) => {
448
+ if (val) {
449
+ chartWidth.value = `${parseInt(val as unknown as string)}px`
450
+ }
451
+ },
452
+ { deep: true }
453
+ )
454
+
455
+ const handleBrushUpdate = (value: { min: number; max: number }) => {
456
+ brush.value.min = value.min
457
+ brush.value.max = value.max
458
+
459
+ chart.value.options.scales.x.min = value.min
460
+ chart.value.options.scales.x.max = value.max
461
+
462
+ xLabels.value = chart.value.data.labels.slice(
463
+ value.min,
464
+ value.max + brushProperties.value.step
465
+ )
466
+
467
+ chart.value.update()
468
+ }
469
+
470
+ const xLabels = ref(props.data.labels)
471
+
472
+ const onHoverLegend = (
473
+ item: BarControllerDatasetOptions,
474
+ index: number
475
+ ) => {
476
+ const filteredItems = chart.value.data.datasets
477
+ .map((d: ChartDataset, i: number) => ({
478
+ ...d,
479
+ index: i
480
+ }))
481
+ .filter(
482
+ (dataset: ChartDataset & { index: number }) =>
483
+ dataset.index! !== index
484
+ )
485
+
486
+ for (const dataset of filteredItems) {
487
+ chart.value.data.datasets[dataset.index].backgroundColor =
488
+ dataset?.hoverBackgroundColor ||
489
+ hexToRgbA(dataset.backgroundColor, 0.2)
490
+
491
+ chart.value.data.datasets[dataset.index].borderColor =
492
+ dataset?.hoverBorderColor ||
493
+ hexToRgbA(dataset.backgroundColor, 0.2)
494
+ }
495
+
496
+ chart.value.update()
497
+ }
498
+
499
+ const onLeaveLegend = (
500
+ item: BarControllerDatasetOptions,
501
+ index: number
502
+ ) => {
503
+ const filteredItems = chart.value.data.datasets
504
+ .map((d: ChartDataset, i: number) => ({
505
+ ...d,
506
+ index: i
507
+ }))
508
+ .filter(
509
+ (dataset: ChartDataset & { index: number }) =>
510
+ dataset.index !== index
511
+ )
512
+
513
+ const backup = getChartBackup()
514
+
515
+ for (const dataset of filteredItems) {
516
+ chart.value.data.datasets[dataset.index].backgroundColor = (
517
+ backup.data as ChartData<'line'>
518
+ ).datasets[dataset.index].backgroundColor
519
+
520
+ chart.value.data.datasets[dataset.index].borderColor = (
521
+ backup.data as ChartData<'line'>
522
+ ).datasets[dataset.index].borderColor
523
+ }
524
+ chart.value.update()
525
+ }
526
+
527
+ const labelStyles = computed(() => {
528
+ const options = merge(
529
+ {},
530
+ defaultLineChartProps.options,
531
+ props.options
532
+ )
533
+ return {
534
+ title: options.scales.x.title.text,
535
+ titleSize: `${options.scales.x.title.font.size}px`,
536
+ titleColor: options.scales.x.title.color.replace('--', ''),
537
+ labelColor: options.scales.x.ticks.color.replace('--', ''),
538
+ fontSize: `${options.scales.x.ticks.font.size}px`
539
+ }
540
+ })
541
+
542
+ const hideData = (item: BarControllerDatasetOptions, index: number) => {
543
+ onLeaveLegend(item, index)
544
+
545
+ chart.value.data.datasets[index].hidden = !!item.hidden
546
+
547
+ legendDatasets.value.splice(index, 1, {
548
+ ...legendDatasets.value[index],
549
+ hidden: !!item.hidden
550
+ })
551
+
552
+ chart.value.update()
553
+ }
554
+
555
+ watch(variables, () => {
556
+ merge(chart.value.data, getChartBackup().data)
557
+
558
+ merge(
559
+ chart.value.options,
560
+ updateKeys(
561
+ merge(
562
+ { onResize, onHover },
563
+ defaultLineChartProps.options,
564
+ props.options
565
+ ),
566
+ ['color'],
567
+ replaceColor
568
+ )
569
+ )
570
+
571
+ chart.value.options.scales.x.min = brush.value.min
572
+ chart.value.options.scales.x.max = brush.value.max
573
+
574
+ chart.value.update()
575
+ })
576
+
577
+ watch(
578
+ [props.data, props.options],
579
+ ([newData = {}, newOptions = {}]) => {
580
+ chartData.value = replaceDataColors(newData as ChartData)
581
+
582
+ xLabels.value = (newData as ChartData)?.labels
583
+
584
+ chartOptions.value = updateKeys(
585
+ merge(
586
+ { onResize, onHover },
587
+ defaultLineChartProps.options,
588
+ newOptions
589
+ ),
590
+ ['color'],
591
+ replaceColor
592
+ )
593
+ },
594
+ { deep: true }
595
+ )
596
+
597
+ return {
598
+ variables,
599
+ chartData,
600
+ chartOptions,
601
+ brush,
602
+ xLabels,
603
+ lineChart,
604
+ handleBrushUpdate,
605
+ chartWrapperClasses,
606
+ chartClasses,
607
+ brushClasses,
608
+ legendClasses,
609
+ brushProperties,
610
+ legendDatasets,
611
+ legendProperties,
612
+ hideData,
613
+ chartWidth,
614
+ onHoverLegend,
615
+ onLeaveLegend,
616
+ onChartLeave,
617
+ chart,
618
+ labelStyles
619
+ }
620
+ }
621
+ })
622
+ </script>
623
+
624
+ <style scoped lang="scss">
625
+ .dl-line-chart-wrapper {
626
+ display: flex;
627
+ flex-direction: column;
628
+ align-self: stretch;
629
+ }
630
+
631
+ .dl-brush {
632
+ margin-top: 10px;
633
+ }
634
+
635
+ .dl-legend {
636
+ margin-top: 16px;
637
+ margin-bottom: 16px;
638
+ }
639
+
640
+ .dl-brush,
641
+ .dl-legend {
642
+ align-self: flex-end;
643
+ }
644
+ </style>