@dataloop-ai/components 0.17.134 → 0.18.1
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 +3 -1
- package/src/App.vue +5 -227
- package/src/assets/globals.scss +4 -0
- package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
- package/src/components/basic/DlButton/DlButton.vue +2 -6
- package/src/components/basic/DlChip/DlChip.vue +1 -5
- package/src/components/basic/DlEmptyState/DlEmptyState.vue +282 -0
- package/src/components/basic/DlEmptyState/index.ts +2 -0
- package/src/components/basic/DlEmptyState/types.ts +20 -0
- package/src/components/basic/DlListItem/DlListItem.vue +96 -63
- package/src/components/basic/DlListItem/utils.ts +0 -3
- package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +35 -12
- package/src/components/basic/DlPopup/DlPopup.vue +29 -7
- package/src/components/basic/DlWidget/DlWidget.vue +32 -4
- package/src/components/basic/index.ts +2 -1
- package/src/components/basic/types.ts +2 -0
- package/src/components/compound/DlCard/DlCard.vue +796 -0
- package/src/components/compound/DlCard/components/DescriptionModal.vue +137 -0
- package/src/components/compound/DlCard/types.ts +38 -0
- package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +35 -3
- package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +51 -12
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +71 -14
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +28 -4
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +1 -1
- package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +46 -8
- package/src/components/compound/DlCharts/components/DlBrush.vue +2 -2
- package/src/components/compound/DlCharts/types/props.ts +5 -1
- package/src/components/compound/DlCharts/utils.ts +1 -1
- package/src/components/compound/DlCodeEditor/DlCodeEditor.vue +171 -0
- package/src/components/compound/DlCodeEditor/README.md +11 -0
- package/src/components/compound/DlCodeEditor/components/CodeEditor.vue +705 -0
- package/src/components/compound/DlCodeEditor/index.ts +3 -0
- package/src/components/compound/DlCodeEditor/styles/themes-base16.css +12809 -0
- package/src/components/compound/DlCodeEditor/styles/themes.css +3999 -0
- package/src/components/compound/DlCodeEditor/types.ts +21 -0
- package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
- package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +8 -8
- package/src/components/compound/DlDialogBox/DlDialogBox.vue +26 -2
- package/src/components/compound/DlInput/DlInput.vue +2 -2
- package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
- package/src/components/compound/DlRange/DlRange.vue +2 -2
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +1 -1
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +1 -1
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
- package/src/components/compound/DlSelect/DlSelect.vue +78 -70
- package/src/components/compound/DlSlider/components/DlSliderBase.vue +2 -2
- package/src/components/compound/DlSlider/useSlider.ts +2 -2
- package/src/components/compound/DlStepper/DlStepper.vue +33 -3
- package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
- package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +12 -6
- package/src/components/compound/DlTable/DlTable.vue +30 -4
- package/src/components/compound/DlTable/components/DlTd.vue +8 -8
- package/src/components/compound/DlTable/components/DlTh.vue +1 -1
- package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +35 -40
- package/src/components/compound/DlTable/hooks/tableFilter.ts +33 -21
- package/src/components/compound/DlTable/hooks/tablePagination.ts +10 -13
- package/src/components/compound/DlTable/hooks/tableRowExpand.ts +2 -1
- package/src/components/compound/DlTable/hooks/tableRowSelection.ts +0 -1
- package/src/components/compound/DlTable/hooks/tableSort.ts +52 -47
- package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +268 -0
- package/src/components/compound/DlThumbnailGallery/index.ts +2 -0
- package/src/components/compound/DlThumbnailGallery/types.ts +11 -0
- package/src/components/compound/DlTreeTable/DlTreeTable.vue +1293 -0
- package/src/components/compound/DlTreeTable/components/DlTdTree.vue +119 -0
- package/src/components/compound/DlTreeTable/components/DlTrTree.vue +52 -0
- package/src/components/compound/DlTreeTable/index.ts +3 -0
- package/src/components/compound/DlTreeTable/types.ts +1 -0
- package/src/components/compound/DlTreeTable/utils/convertToNestedObject.ts +51 -0
- package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +19 -0
- package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +39 -0
- package/src/components/compound/DlTreeTable/utils/trSpacing.ts +13 -0
- package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +184 -0
- package/src/components/compound/index.ts +5 -0
- package/src/components/compound/types.ts +2 -0
- package/src/components/essential/DlBadge/DlBadge.vue +3 -3
- package/src/components/essential/DlCheckbox/DlCheckbox.vue +6 -3
- package/src/components/essential/DlEllipsis/DlEllipsis.vue +18 -14
- package/src/components/essential/DlIcon/DlIcon.vue +1 -1
- package/src/components/essential/DlLabel/DlLabel.vue +174 -0
- package/src/components/essential/DlLabel/index.ts +2 -0
- package/src/components/essential/DlList/DlList.vue +2 -2
- package/src/components/essential/DlMenu/DlMenu.vue +26 -20
- package/src/components/essential/DlMenu/utils.ts +7 -6
- package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
- package/src/components/essential/DlPageLayout/index.ts +2 -0
- package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
- package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
- package/src/components/essential/index.ts +2 -1
- package/src/components/shared/DlTooltip/DlTooltip.vue +9 -10
- package/src/demos/BarChartDemo.vue +47 -2
- package/src/demos/ColumnChartDemo.vue +51 -2
- package/src/demos/DlAccordionDemo.vue +92 -43
- package/src/demos/DlCardDemo.vue +156 -19
- package/src/demos/DlChartDoughnutDemo.vue +49 -2
- package/src/demos/DlCheckboxDemo.vue +13 -0
- package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
- package/src/demos/DlCodeEditor/index.ts +2 -0
- package/src/demos/DlConfusionMatrixDemo.vue +51 -6
- package/src/demos/DlDemoPage.vue +235 -0
- package/src/demos/DlDialogBoxDemo.vue +56 -51
- package/src/demos/DlDropdownButtonDemo.vue +1 -1
- package/src/demos/DlEmptyStateDemo.vue +81 -0
- package/src/demos/DlLabelDemo.vue +128 -0
- package/src/demos/DlLineChartDemo.vue +50 -2
- package/src/demos/DlListDemo.vue +12 -9
- package/src/demos/DlMenuDemo.vue +13 -14
- package/src/demos/DlPageLayoutDemo.vue +146 -0
- package/src/demos/DlPanelContainerDemo.vue +113 -2
- package/src/demos/DlPopupDemo.vue +51 -0
- package/src/demos/DlSelectDemo.vue +14 -5
- package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
- package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
- package/src/demos/DlTableDemo.vue +65 -2
- package/src/demos/DlTabsDemo.vue +1 -1
- package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
- package/src/demos/DlTreeTableDemo.vue +694 -0
- package/src/demos/DlWidgetDemo.vue +48 -3
- package/src/demos/index.ts +17 -4
- package/src/hooks/use-anchor.ts +14 -16
- package/src/hooks/use-model-toggle.ts +12 -14
- package/src/hooks/use-portal.ts +2 -2
- package/src/hooks/use-scroll-target.ts +2 -4
- package/src/hooks/use-size-observer.ts +3 -2
- package/src/hooks/use-transition.ts +10 -4
- package/src/index.ts +22 -1
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetFooter.vue +78 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetHeader.vue +22 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetLeftDrawer.vue +96 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetMainContent.vue +51 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetRightDrawer.vue +88 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/ActionsMenu.vue +70 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/AutomationMenu.vue +106 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardView.vue +101 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewGallery.vue +141 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewTable.vue +193 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/LayoutEmptyState.vue +227 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/UploadData.vue +106 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentImages.vue +540 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentNav.vue +329 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarKpi.vue +84 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarSearch.vue +132 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/SearchFilterMenu.vue +19 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/filters/AddFilter.vue +212 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/types/imageMetadata.ts +28 -0
- package/src/layouts/DlDatasetBrowser/DlDatasetBrowser.vue +42 -0
- package/src/layouts/DlStudioLayout/DlStudioLayout.vue +42 -0
- package/src/layouts/DlStudioLayout/components/Demo/LeftMenuContent.vue +23 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioFooter.vue +25 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioHeader.vue +121 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioLeftDrawer.vue +245 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioMainContent.vue +31 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioTabsMenu.vue +117 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/FilterMenu.vue +62 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuAnnotations.vue +98 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuItem.vue +66 -0
- package/src/layouts/DlStudioLayout/components/LayoutNavbar.vue +24 -0
- package/src/layouts/DlStudioLayout/components/ListAutocomplete.vue +149 -0
- package/src/layouts/DlStudioLayout/components/NavigationDrawer.vue +147 -0
- package/src/layouts/DlStudioLayout/index.ts +2 -0
- package/src/layouts/DlStudioLayout/types/HorizontalItems.ts +9 -0
- package/src/layouts/DlStudioLayout/types/VerticalItems.ts +10 -0
- package/src/simple-code-editor.d.ts +1 -0
- package/src/utils/click-outside.ts +1 -1
- package/src/utils/dom.ts +5 -5
- package/src/utils/events.ts +3 -3
- package/src/utils/global-nodes.ts +2 -2
- package/src/utils/is-ellipsis-active.ts +4 -1
- package/src/utils/portal.ts +5 -5
- package/src/utils/position-engine.ts +5 -5
- package/src/utils/render.ts +1 -1
- package/src/utils/scroll.ts +2 -2
- package/src/utils/selection.ts +3 -3
- package/vite.config.ts +9 -1
- package/src/components/basic/DlCard/DlCard.vue +0 -242
- package/src/components/basic/DlCard/types.ts +0 -20
- package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -93
- package/src/components/essential/DlTextHolder/index.ts +0 -2
- package/src/demos/DlTextHolderDemo.vue +0 -50
- /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
- /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div @click="stopPropagationEvent">
|
|
3
|
+
<DlButton
|
|
4
|
+
flat
|
|
5
|
+
icon-color="dl-color-darker"
|
|
6
|
+
icon="icon-dl-edit"
|
|
7
|
+
size="s"
|
|
8
|
+
round
|
|
9
|
+
@click="openModal"
|
|
10
|
+
/>
|
|
11
|
+
<dl-dialog-box
|
|
12
|
+
ref="modalOne"
|
|
13
|
+
v-model="isOpenedModal"
|
|
14
|
+
>
|
|
15
|
+
<template #header>
|
|
16
|
+
<dl-dialog-box-header
|
|
17
|
+
title="Description"
|
|
18
|
+
@onClose="closeModal"
|
|
19
|
+
/>
|
|
20
|
+
</template>
|
|
21
|
+
<template #body>
|
|
22
|
+
<dl-text-area
|
|
23
|
+
v-model="descriptionValueComputed"
|
|
24
|
+
required
|
|
25
|
+
show-counter
|
|
26
|
+
enable-resize
|
|
27
|
+
placeholder="Type an item description"
|
|
28
|
+
:max-length="1000"
|
|
29
|
+
clear-button-tooltip
|
|
30
|
+
:error-message="errorMessage"
|
|
31
|
+
@focus="onFocusTextarea"
|
|
32
|
+
@blur="textAreaFocused = false"
|
|
33
|
+
/>
|
|
34
|
+
</template>
|
|
35
|
+
<template #footer>
|
|
36
|
+
<dl-dialog-box-footer>
|
|
37
|
+
<dl-button
|
|
38
|
+
:disabled="isDisabledApplyButton"
|
|
39
|
+
@click="updateDescription"
|
|
40
|
+
>
|
|
41
|
+
Apply
|
|
42
|
+
</dl-button>
|
|
43
|
+
</dl-dialog-box-footer>
|
|
44
|
+
</template>
|
|
45
|
+
</dl-dialog-box>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script lang="ts">
|
|
50
|
+
import {
|
|
51
|
+
defineComponent,
|
|
52
|
+
ref,
|
|
53
|
+
computed,
|
|
54
|
+
onMounted,
|
|
55
|
+
watch,
|
|
56
|
+
toRef
|
|
57
|
+
} from 'vue-demi'
|
|
58
|
+
import { DlButton, DlTextArea } from '../../../../components'
|
|
59
|
+
import DlDialogBox from '../../../compound/DlDialogBox/DlDialogBox.vue'
|
|
60
|
+
import DlDialogBoxHeader from '../../../compound/DlDialogBox/components/DlDialogBoxHeader.vue'
|
|
61
|
+
import DlDialogBoxFooter from '../../../compound/DlDialogBox/components/DlDialogBoxFooter.vue'
|
|
62
|
+
|
|
63
|
+
export default defineComponent({
|
|
64
|
+
name: 'DescriptionModal',
|
|
65
|
+
components: {
|
|
66
|
+
DlButton,
|
|
67
|
+
DlDialogBox,
|
|
68
|
+
DlDialogBoxHeader,
|
|
69
|
+
DlDialogBoxFooter,
|
|
70
|
+
DlTextArea
|
|
71
|
+
},
|
|
72
|
+
props: {
|
|
73
|
+
description: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: ''
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
emits: ['onSubmit'],
|
|
79
|
+
setup(props, ctx) {
|
|
80
|
+
const isOpenedModal = ref<boolean>(false)
|
|
81
|
+
const textAreaValue = ref<string>('')
|
|
82
|
+
const textAreaFocused = ref<boolean>(false)
|
|
83
|
+
const errorMessage = ref<string>('')
|
|
84
|
+
const isDisabledApplyButton = ref<boolean>(true)
|
|
85
|
+
const MIN_LENGTH = 3
|
|
86
|
+
const descriptionRef = toRef(props, 'description')
|
|
87
|
+
|
|
88
|
+
const openModal = (): void => {
|
|
89
|
+
isOpenedModal.value = true
|
|
90
|
+
}
|
|
91
|
+
const closeModal = (): void => {
|
|
92
|
+
isOpenedModal.value = false
|
|
93
|
+
}
|
|
94
|
+
const updateDescription = (): void => {
|
|
95
|
+
ctx.emit('onSubmit', textAreaValue.value)
|
|
96
|
+
closeModal()
|
|
97
|
+
}
|
|
98
|
+
const onFocusTextarea = (): void => {
|
|
99
|
+
textAreaFocused.value = true
|
|
100
|
+
}
|
|
101
|
+
const descriptionValueComputed = computed<string>({
|
|
102
|
+
get() {
|
|
103
|
+
return descriptionRef.value
|
|
104
|
+
},
|
|
105
|
+
set(value) {
|
|
106
|
+
textAreaValue.value = value
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
const stopPropagationEvent: any = (event: MouseEvent) => {
|
|
110
|
+
event.stopPropagation()
|
|
111
|
+
}
|
|
112
|
+
watch(textAreaValue, (value) => {
|
|
113
|
+
isDisabledApplyButton.value = value.length < MIN_LENGTH
|
|
114
|
+
})
|
|
115
|
+
onMounted(() => {
|
|
116
|
+
isDisabledApplyButton.value =
|
|
117
|
+
descriptionValueComputed.value?.length <= 1
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
isOpenedModal,
|
|
122
|
+
openModal,
|
|
123
|
+
closeModal,
|
|
124
|
+
textAreaValue,
|
|
125
|
+
textAreaFocused,
|
|
126
|
+
errorMessage,
|
|
127
|
+
isDisabledApplyButton,
|
|
128
|
+
updateDescription,
|
|
129
|
+
onFocusTextarea,
|
|
130
|
+
descriptionValueComputed,
|
|
131
|
+
stopPropagationEvent
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<style scoped></style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type DlCardTagType = {
|
|
2
|
+
label: string
|
|
3
|
+
color?: string
|
|
4
|
+
textColor?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type DlCardImageType = {
|
|
8
|
+
src: string
|
|
9
|
+
styles?: string
|
|
10
|
+
alt?: string
|
|
11
|
+
link?: {
|
|
12
|
+
href: string
|
|
13
|
+
icon: string
|
|
14
|
+
color?: string
|
|
15
|
+
backgroundColor?: string
|
|
16
|
+
size?: string
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type DlCardIconType = {
|
|
21
|
+
icon: string
|
|
22
|
+
color?: string
|
|
23
|
+
size?: string
|
|
24
|
+
styles: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type DlCardHintType = {
|
|
28
|
+
icon: string
|
|
29
|
+
color?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type DlCardLinkType = {
|
|
33
|
+
title: string
|
|
34
|
+
href: string
|
|
35
|
+
icon?: string
|
|
36
|
+
newtab?: boolean
|
|
37
|
+
external?: boolean
|
|
38
|
+
}
|
|
@@ -4,7 +4,22 @@
|
|
|
4
4
|
class="canvas-container"
|
|
5
5
|
:style="`height: ${wrapperHeight}`"
|
|
6
6
|
>
|
|
7
|
+
<dl-empty-state
|
|
8
|
+
v-if="isEmpty"
|
|
9
|
+
v-bind="emptyStateProps"
|
|
10
|
+
>
|
|
11
|
+
<template
|
|
12
|
+
v-for="(_, slot) in $slots"
|
|
13
|
+
#[slot]="props"
|
|
14
|
+
>
|
|
15
|
+
<slot
|
|
16
|
+
:name="slot"
|
|
17
|
+
v-bind="props"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
20
|
+
</dl-empty-state>
|
|
7
21
|
<Bar
|
|
22
|
+
v-if="!isEmpty"
|
|
8
23
|
:id="id"
|
|
9
24
|
ref="barChart"
|
|
10
25
|
:class="chartClasses"
|
|
@@ -15,7 +30,7 @@
|
|
|
15
30
|
@wheel.native="handleChartScroll"
|
|
16
31
|
/>
|
|
17
32
|
<dl-chart-scroll-bar
|
|
18
|
-
v-if="maxItems > thisItemsInView"
|
|
33
|
+
v-if="!isEmpty || (maxItems > thisItemsInView && !isEmpty)"
|
|
19
34
|
:wrapper-styles="{
|
|
20
35
|
marginTop: '10px'
|
|
21
36
|
}"
|
|
@@ -28,10 +43,12 @@
|
|
|
28
43
|
/>
|
|
29
44
|
</div>
|
|
30
45
|
<slot
|
|
46
|
+
v-if="!isEmpty"
|
|
31
47
|
v-bind="{ labels: xLabels, chartWidth }"
|
|
32
48
|
name="axe-x-labels"
|
|
33
49
|
/>
|
|
34
50
|
<slot
|
|
51
|
+
v-if="!isEmpty"
|
|
35
52
|
v-bind="{
|
|
36
53
|
data: legendDatasets,
|
|
37
54
|
chartWidth,
|
|
@@ -62,7 +79,14 @@ import {
|
|
|
62
79
|
BarChartProps,
|
|
63
80
|
defaultBarChartProps
|
|
64
81
|
} from '../../types/props'
|
|
65
|
-
import {
|
|
82
|
+
import {
|
|
83
|
+
defineComponent,
|
|
84
|
+
reactive,
|
|
85
|
+
ref,
|
|
86
|
+
watch,
|
|
87
|
+
computed,
|
|
88
|
+
PropType
|
|
89
|
+
} from 'vue-demi'
|
|
66
90
|
import DlChartLegend from '../../components/DlChartLegend.vue'
|
|
67
91
|
import DlChartScrollBar from '../../components/DlChartScrollBar.vue'
|
|
68
92
|
import { updateKey } from '../../../../../utils/update-key'
|
|
@@ -82,6 +106,8 @@ import type { Chart, ChartMeta, ChartDataset, ActiveElement } from 'chart.js'
|
|
|
82
106
|
import { isEqual, merge } from 'lodash'
|
|
83
107
|
import { rgba2hex, hexToRgbA, revertRGBAOpacity } from '../../../../../utils'
|
|
84
108
|
import { useThemeVariables } from '../../../../../hooks/use-theme'
|
|
109
|
+
import { DlEmptyStateProps } from '../../../../basic/DlEmptyState/types'
|
|
110
|
+
import DlEmptyState from '../../../../basic/DlEmptyState/DlEmptyState.vue'
|
|
85
111
|
|
|
86
112
|
ChartJS.register(
|
|
87
113
|
CategoryScale,
|
|
@@ -98,7 +124,8 @@ export default defineComponent({
|
|
|
98
124
|
components: {
|
|
99
125
|
Bar,
|
|
100
126
|
DlChartScrollBar,
|
|
101
|
-
DlChartLegend
|
|
127
|
+
DlChartLegend,
|
|
128
|
+
DlEmptyState
|
|
102
129
|
},
|
|
103
130
|
props: {
|
|
104
131
|
...CommonProps,
|
|
@@ -110,6 +137,11 @@ export default defineComponent({
|
|
|
110
137
|
id: {
|
|
111
138
|
type: String,
|
|
112
139
|
default: null
|
|
140
|
+
},
|
|
141
|
+
isEmpty: Boolean,
|
|
142
|
+
emptyStateProps: {
|
|
143
|
+
type: Object as PropType<DlEmptyStateProps>,
|
|
144
|
+
default: null
|
|
113
145
|
}
|
|
114
146
|
},
|
|
115
147
|
setup(props) {
|
|
@@ -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
|
<Bar
|
|
21
|
+
v-if="!isEmpty"
|
|
7
22
|
:id="id"
|
|
8
23
|
ref="columnChart"
|
|
9
24
|
:class="chartClasses"
|
|
@@ -13,7 +28,7 @@
|
|
|
13
28
|
@mouseout="onChartLeave"
|
|
14
29
|
/>
|
|
15
30
|
<slot
|
|
16
|
-
v-if="displayLabels"
|
|
31
|
+
v-if="!isEmpty || displayLabels"
|
|
17
32
|
v-bind="{ ...labelStyles, labels: xLabels, chartWidth }"
|
|
18
33
|
name="axe-x-labels"
|
|
19
34
|
>
|
|
@@ -28,7 +43,7 @@
|
|
|
28
43
|
/>
|
|
29
44
|
</slot>
|
|
30
45
|
<slot
|
|
31
|
-
v-if="displayBrush"
|
|
46
|
+
v-if="displayBrush || !isEmpty"
|
|
32
47
|
v-bind="{
|
|
33
48
|
chartWidth,
|
|
34
49
|
modelValue: brush.value,
|
|
@@ -52,7 +67,7 @@
|
|
|
52
67
|
/>
|
|
53
68
|
</slot>
|
|
54
69
|
<slot
|
|
55
|
-
v-if="displayLegend"
|
|
70
|
+
v-if="displayLegend || !isEmpty"
|
|
56
71
|
v-bind="{
|
|
57
72
|
data: legendDatasets,
|
|
58
73
|
chartWidth,
|
|
@@ -81,9 +96,18 @@ import { Bar } from '../../types/typedCharts'
|
|
|
81
96
|
import {
|
|
82
97
|
CommonProps,
|
|
83
98
|
ColumnChartProps,
|
|
84
|
-
defaultColumnChartProps
|
|
99
|
+
defaultColumnChartProps,
|
|
100
|
+
CommonPropsType,
|
|
101
|
+
ColumnChartPropsType
|
|
85
102
|
} from '../../types/props'
|
|
86
|
-
import {
|
|
103
|
+
import {
|
|
104
|
+
defineComponent,
|
|
105
|
+
reactive,
|
|
106
|
+
watch,
|
|
107
|
+
ref,
|
|
108
|
+
computed,
|
|
109
|
+
PropType
|
|
110
|
+
} from 'vue-demi'
|
|
87
111
|
import DlBrush from '../../components/DlBrush.vue'
|
|
88
112
|
import DlChartLegend from '../../components/DlChartLegend.vue'
|
|
89
113
|
import DlChartLabels from '../../components/DlChartLabels.vue'
|
|
@@ -102,6 +126,8 @@ import {
|
|
|
102
126
|
DatasetController,
|
|
103
127
|
BarControllerDatasetOptions
|
|
104
128
|
} from 'chart.js'
|
|
129
|
+
import DlEmptyState from '../../../../basic/DlEmptyState/DlEmptyState.vue'
|
|
130
|
+
import { DlEmptyStateProps } from '../../../../basic/DlEmptyState/types'
|
|
105
131
|
import type {
|
|
106
132
|
Chart,
|
|
107
133
|
ChartMeta,
|
|
@@ -125,23 +151,36 @@ ChartJS.register(
|
|
|
125
151
|
LineElement
|
|
126
152
|
)
|
|
127
153
|
|
|
154
|
+
type ComponentType = {
|
|
155
|
+
id: string
|
|
156
|
+
isEmpty: boolean
|
|
157
|
+
emptyStateProps: DlEmptyStateProps
|
|
158
|
+
} & CommonPropsType &
|
|
159
|
+
ColumnChartPropsType
|
|
160
|
+
|
|
128
161
|
export default defineComponent({
|
|
129
162
|
name: 'DlColumnChart',
|
|
130
163
|
components: {
|
|
131
164
|
DlBrush,
|
|
132
165
|
DlChartLegend,
|
|
133
166
|
Bar,
|
|
134
|
-
DlChartLabels
|
|
167
|
+
DlChartLabels,
|
|
168
|
+
DlEmptyState
|
|
135
169
|
},
|
|
136
170
|
props: {
|
|
137
171
|
id: {
|
|
138
172
|
type: String,
|
|
139
173
|
default: null
|
|
140
174
|
},
|
|
175
|
+
isEmpty: Boolean,
|
|
176
|
+
emptyStateProps: {
|
|
177
|
+
type: Object as PropType<DlEmptyStateProps>,
|
|
178
|
+
default: null
|
|
179
|
+
},
|
|
141
180
|
...CommonProps,
|
|
142
181
|
...ColumnChartProps
|
|
143
|
-
},
|
|
144
|
-
setup(props
|
|
182
|
+
} as { [key: string]: any },
|
|
183
|
+
setup(props) {
|
|
145
184
|
const { variables } = useThemeVariables()
|
|
146
185
|
|
|
147
186
|
const chartWidth = ref('100%')
|
|
@@ -152,7 +191,7 @@ export default defineComponent({
|
|
|
152
191
|
|
|
153
192
|
const onResize = (
|
|
154
193
|
chart: Chart,
|
|
155
|
-
|
|
194
|
+
_size: { height: number; width: number }
|
|
156
195
|
) => {
|
|
157
196
|
if (chart?.scales?.x?.width) {
|
|
158
197
|
chartWidth.value = `${
|
|
@@ -240,7 +279,7 @@ export default defineComponent({
|
|
|
240
279
|
props.legendProps?.datasets || [],
|
|
241
280
|
props.data?.datasets || [],
|
|
242
281
|
'label'
|
|
243
|
-
)
|
|
282
|
+
) as { [key: string]: any }[]
|
|
244
283
|
)
|
|
245
284
|
|
|
246
285
|
const getChartBackup = () => {
|
|
@@ -470,7 +509,7 @@ export default defineComponent({
|
|
|
470
509
|
const xLabels = ref(props.data.labels)
|
|
471
510
|
|
|
472
511
|
const onHoverLegend = (
|
|
473
|
-
|
|
512
|
+
_item: BarControllerDatasetOptions,
|
|
474
513
|
index: number
|
|
475
514
|
) => {
|
|
476
515
|
const filteredItems = chart.value.data.datasets
|
|
@@ -498,7 +537,7 @@ export default defineComponent({
|
|
|
498
537
|
})
|
|
499
538
|
|
|
500
539
|
const onLeaveLegend = (
|
|
501
|
-
|
|
540
|
+
_item: BarControllerDatasetOptions,
|
|
502
541
|
index: number
|
|
503
542
|
) => {
|
|
504
543
|
const filteredItems = chart.value.data.datasets
|
|
@@ -3,8 +3,22 @@
|
|
|
3
3
|
:style="`max-width: ${maxWidth}`"
|
|
4
4
|
class="confusion-matrix-container"
|
|
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
|
<div
|
|
7
|
-
v-if="isValidMatrix"
|
|
21
|
+
v-else-if="isValidMatrix"
|
|
8
22
|
ref="wrapper"
|
|
9
23
|
:style="matrixStyles"
|
|
10
24
|
class="wrapper"
|
|
@@ -72,6 +86,7 @@
|
|
|
72
86
|
: null
|
|
73
87
|
}}
|
|
74
88
|
<dl-tooltip
|
|
89
|
+
id="MatrixTooltip"
|
|
75
90
|
class="matrix-tooltip"
|
|
76
91
|
background-color="dl-color-shadow"
|
|
77
92
|
color="dl-color-tooltip-background"
|
|
@@ -105,7 +120,7 @@
|
|
|
105
120
|
>
|
|
106
121
|
<span
|
|
107
122
|
v-for="(label, index) in visibleLabels"
|
|
108
|
-
ref="xAxis"
|
|
123
|
+
:ref="`xAxis-${index}`"
|
|
109
124
|
:key="index"
|
|
110
125
|
class="x-axis__element"
|
|
111
126
|
:style="`${
|
|
@@ -128,7 +143,10 @@
|
|
|
128
143
|
{{ label }}
|
|
129
144
|
</span>
|
|
130
145
|
</span>
|
|
131
|
-
<dl-tooltip
|
|
146
|
+
<dl-tooltip
|
|
147
|
+
self="top middle"
|
|
148
|
+
:offset="calculateXAxisElOffset(index)"
|
|
149
|
+
>
|
|
132
150
|
{{ labelStrings[index] }}</dl-tooltip>
|
|
133
151
|
</span>
|
|
134
152
|
</div>
|
|
@@ -182,6 +200,8 @@ import {
|
|
|
182
200
|
} from '../../types'
|
|
183
201
|
import { hexToRgbA } from '../../../../../utils/colors'
|
|
184
202
|
import { colorNames } from '../../../../../utils/css-color-names'
|
|
203
|
+
import DlEmptyState from '../../../../basic/DlEmptyState/DlEmptyState.vue'
|
|
204
|
+
import { DlEmptyStateProps } from '../../../../basic/DlEmptyState/types'
|
|
185
205
|
import { useThemeVariables } from '../../../../../hooks/use-theme'
|
|
186
206
|
import {
|
|
187
207
|
getGradationValues,
|
|
@@ -194,7 +214,8 @@ import { debounce, isObject } from 'lodash'
|
|
|
194
214
|
export default defineComponent({
|
|
195
215
|
components: {
|
|
196
216
|
DlBrush,
|
|
197
|
-
DlTooltip
|
|
217
|
+
DlTooltip,
|
|
218
|
+
DlEmptyState
|
|
198
219
|
},
|
|
199
220
|
props: {
|
|
200
221
|
labels: {
|
|
@@ -226,18 +247,23 @@ export default defineComponent({
|
|
|
226
247
|
maxWidth: {
|
|
227
248
|
type: String,
|
|
228
249
|
default: '800px'
|
|
250
|
+
},
|
|
251
|
+
isEmpty: Boolean,
|
|
252
|
+
emptyStateProps: {
|
|
253
|
+
type: Object as PropType<DlEmptyStateProps>,
|
|
254
|
+
default: null
|
|
229
255
|
}
|
|
230
256
|
},
|
|
231
257
|
setup(props) {
|
|
232
258
|
const { variables } = useThemeVariables()
|
|
233
259
|
|
|
234
260
|
const tooltipState = ref<{
|
|
235
|
-
x: string
|
|
236
|
-
y: string
|
|
237
|
-
visible?: boolean
|
|
238
261
|
value?: number
|
|
239
|
-
yLabel?: string
|
|
240
262
|
xLabel?: string
|
|
263
|
+
yLabel?: string
|
|
264
|
+
x?: number
|
|
265
|
+
y?: number
|
|
266
|
+
visible?: boolean
|
|
241
267
|
} | null>(null)
|
|
242
268
|
const currentBrushState = ref<{ min: number; max: number }>({
|
|
243
269
|
min: 0,
|
|
@@ -245,6 +271,7 @@ export default defineComponent({
|
|
|
245
271
|
})
|
|
246
272
|
const cellWidth = ref<number | null>(null)
|
|
247
273
|
const rotateXLabels = ref(true)
|
|
274
|
+
const resizeObserver = ref<ResizeObserver>(null)
|
|
248
275
|
|
|
249
276
|
const getCellBackground = (value: number = 1): string => {
|
|
250
277
|
const object: { [key: string]: any } = {
|
|
@@ -264,6 +291,7 @@ export default defineComponent({
|
|
|
264
291
|
}
|
|
265
292
|
|
|
266
293
|
return {
|
|
294
|
+
resizeObserver,
|
|
267
295
|
variables,
|
|
268
296
|
getCellBackground,
|
|
269
297
|
getCellTextColor,
|
|
@@ -327,16 +355,43 @@ export default defineComponent({
|
|
|
327
355
|
)
|
|
328
356
|
)
|
|
329
357
|
this.rotateXLabels = longest * 12 > getCellWidth()
|
|
358
|
+
},
|
|
359
|
+
isEmpty(val) {
|
|
360
|
+
this.handleResizeObserver({ dispose: !val })
|
|
330
361
|
}
|
|
331
362
|
},
|
|
332
363
|
mounted() {
|
|
333
364
|
if (!this.isValidMatrix) return
|
|
334
|
-
this.
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
window.onresize = this.resizeMatrix
|
|
365
|
+
if (this.isEmpty) return
|
|
366
|
+
|
|
367
|
+
this.handleResizeObserver()
|
|
338
368
|
},
|
|
339
369
|
methods: {
|
|
370
|
+
calculateXAxisElOffset(index: number): number[] {
|
|
371
|
+
let el = this.$refs[`xAxis-${index}`] as HTMLElement
|
|
372
|
+
if (!el) return null
|
|
373
|
+
if (Array.isArray(el)) {
|
|
374
|
+
el = el[0]
|
|
375
|
+
}
|
|
376
|
+
const height = el.clientHeight
|
|
377
|
+
const offsetHeight = -1 * (height / 2)
|
|
378
|
+
return [0, offsetHeight]
|
|
379
|
+
},
|
|
380
|
+
handleResizeObserver(options: { dispose?: boolean } = {}) {
|
|
381
|
+
const { dispose } = options
|
|
382
|
+
if (dispose && this.resizeObserver) {
|
|
383
|
+
this.resizeObserver.unobserve(this.$refs.wrapper as Element)
|
|
384
|
+
this.resizeObserver.disconnect()
|
|
385
|
+
this.resizeObserver = null
|
|
386
|
+
} else {
|
|
387
|
+
this.resizeMatrix()
|
|
388
|
+
if (!this.resizeObserver) {
|
|
389
|
+
this.resizeObserver = new ResizeObserver(this.resizeMatrix)
|
|
390
|
+
this.resizeObserver.observe(this.$refs.wrapper as Element)
|
|
391
|
+
window.onresize = this.resizeMatrix
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
},
|
|
340
395
|
resizeMatrix() {
|
|
341
396
|
const colorSpectrum = this.$refs.colorSpectrum as HTMLElement
|
|
342
397
|
const verticalWrapper = this.$refs.verticalWrapper as HTMLElement
|
|
@@ -517,9 +572,11 @@ export default defineComponent({
|
|
|
517
572
|
}
|
|
518
573
|
}
|
|
519
574
|
|
|
520
|
-
|
|
521
|
-
|
|
575
|
+
#MatrixTooltip {
|
|
576
|
+
padding: 0;
|
|
577
|
+
}
|
|
522
578
|
|
|
579
|
+
.matrix-tooltip {
|
|
523
580
|
&__body {
|
|
524
581
|
border: 1px solid var(--dl-color-separator);
|
|
525
582
|
padding: 8px;
|
|
@@ -3,8 +3,22 @@
|
|
|
3
3
|
ref="dlDoughnutChartWidgetRef"
|
|
4
4
|
class="dl_doughnut"
|
|
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
|
<div
|
|
7
|
-
v-if="itemsCount"
|
|
21
|
+
v-if="itemsCount && !isEmpty"
|
|
8
22
|
class="dl_doughnut__wrapper"
|
|
9
23
|
:class="classFlexLg"
|
|
10
24
|
>
|
|
@@ -52,7 +66,7 @@
|
|
|
52
66
|
</div>
|
|
53
67
|
</div>
|
|
54
68
|
</div>
|
|
55
|
-
<div v-else>
|
|
69
|
+
<div v-else-if="!itemsCount && !isEmpty">
|
|
56
70
|
No data
|
|
57
71
|
</div>
|
|
58
72
|
</div>
|
|
@@ -88,12 +102,15 @@ import { updateNestedArrayValues } from '../../../../../utils/update-key'
|
|
|
88
102
|
import DlDoughnutChartLegend from './components/DlDoughnutChartLegend.vue'
|
|
89
103
|
import { defaultDoughnutChartProps } from '../../types/props'
|
|
90
104
|
import { TDoughnutWithOriginalColor } from './types/TDoughnutWithOriginalColor'
|
|
105
|
+
import DlEmptyState from '../../../../basic/DlEmptyState/DlEmptyState.vue'
|
|
106
|
+
import { DlEmptyStateProps } from '../../../../basic/DlEmptyState/types'
|
|
91
107
|
|
|
92
108
|
export default defineComponent({
|
|
93
109
|
name: 'DlDoughnutChart',
|
|
94
110
|
components: {
|
|
95
111
|
Doughnut,
|
|
96
|
-
DlDoughnutChartLegend
|
|
112
|
+
DlDoughnutChartLegend,
|
|
113
|
+
DlEmptyState
|
|
97
114
|
},
|
|
98
115
|
props: {
|
|
99
116
|
data: {
|
|
@@ -112,7 +129,14 @@ export default defineComponent({
|
|
|
112
129
|
type: Object as PropType<
|
|
113
130
|
DoughnutControllerChartOptions['animation']
|
|
114
131
|
>,
|
|
132
|
+
default: () =>
|
|
133
|
+
Object as PropType<DoughnutControllerChartOptions['animation']>,
|
|
115
134
|
required: false
|
|
135
|
+
},
|
|
136
|
+
isEmpty: Boolean,
|
|
137
|
+
emptyStateProps: {
|
|
138
|
+
type: Object as PropType<DlEmptyStateProps>,
|
|
139
|
+
default: null
|
|
116
140
|
}
|
|
117
141
|
},
|
|
118
142
|
setup(props) {
|
|
@@ -273,7 +297,7 @@ export default defineComponent({
|
|
|
273
297
|
tooltip: {
|
|
274
298
|
yAlign: 'none',
|
|
275
299
|
callbacks: {
|
|
276
|
-
labelColor
|
|
300
|
+
labelColor(
|
|
277
301
|
tooltipItem: { dataIndex: string | number },
|
|
278
302
|
chart: any
|
|
279
303
|
) {
|