@dataloop-ai/components 0.18.0 → 0.18.2

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 (277) hide show
  1. package/package.json +6 -3
  2. package/src/App.vue +5 -227
  3. package/src/assets/constants.scss +2 -1
  4. package/src/assets/globals.scss +21 -0
  5. package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
  6. package/src/components/basic/DlAccordion/components/AccordionHeader.vue +2 -1
  7. package/src/components/basic/DlAvatar/DlAvatar.vue +1 -1
  8. package/src/components/basic/DlButton/DlButton.vue +115 -25
  9. package/src/components/basic/DlButton/utils.ts +45 -2
  10. package/src/components/basic/DlChip/DlChip.vue +3 -7
  11. package/src/components/basic/DlChip/utils.ts +4 -4
  12. package/src/components/basic/DlContainer/DlContainer.vue +70 -0
  13. package/src/components/basic/DlContainer/index.ts +3 -0
  14. package/src/components/basic/DlEmptyState/DlEmptyState.vue +282 -0
  15. package/src/components/basic/DlEmptyState/index.ts +2 -0
  16. package/src/components/basic/DlEmptyState/types.ts +20 -0
  17. package/src/components/basic/DlGrid/DlGrid.vue +163 -0
  18. package/src/components/basic/DlGrid/index.ts +4 -0
  19. package/src/components/basic/DlGrid/types.ts +5 -0
  20. package/src/components/basic/DlKpi/components/KpiInfo.vue +2 -1
  21. package/src/components/basic/DlListItem/DlListItem.vue +96 -66
  22. package/src/components/basic/DlListItem/utils.ts +0 -3
  23. package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +37 -13
  24. package/src/components/basic/DlPopup/DlPopup.vue +58 -11
  25. package/src/components/basic/DlPopup/components/PopupHeader.vue +11 -6
  26. package/src/components/basic/DlProgressChart/DlProgressChart.vue +2 -1
  27. package/src/components/basic/DlWidget/DlWidget.vue +273 -141
  28. package/src/components/basic/DlWidget/index.ts +1 -3
  29. package/src/components/basic/DlWidget/utils.ts +90 -8
  30. package/src/components/basic/index.ts +4 -2
  31. package/src/components/basic/types.ts +2 -0
  32. package/src/components/compound/DlCard/DlCard.vue +796 -0
  33. package/src/components/compound/DlCard/components/DescriptionModal.vue +137 -0
  34. package/src/components/compound/DlCard/types.ts +38 -0
  35. package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +39 -4
  36. package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +128 -36
  37. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +167 -87
  38. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/utils.ts +2 -1
  39. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +44 -3
  40. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChartWidget.vue +1 -2
  41. package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +9 -18
  42. package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +48 -9
  43. package/src/components/compound/DlCharts/charts/DlScatterChart/DlScatterChart.vue +667 -0
  44. package/src/components/compound/DlCharts/charts/DlScatterChart/index.ts +2 -0
  45. package/src/components/compound/DlCharts/charts/index.ts +1 -0
  46. package/src/components/compound/DlCharts/components/DlBrush.vue +3 -2
  47. package/src/components/compound/DlCharts/components/DlChartLabels.vue +2 -1
  48. package/src/components/compound/DlCharts/components/DlChartScrollBar.vue +1 -0
  49. package/src/components/compound/DlCharts/types/props.ts +5 -1
  50. package/src/components/compound/DlCharts/utils.ts +1 -1
  51. package/src/components/compound/DlCodeEditor/DlCodeEditor.vue +173 -0
  52. package/src/components/compound/DlCodeEditor/README.md +11 -0
  53. package/src/components/compound/DlCodeEditor/components/CodeEditor.vue +705 -0
  54. package/src/components/compound/DlCodeEditor/index.ts +3 -0
  55. package/src/components/compound/DlCodeEditor/styles/themes-base16.css +12809 -0
  56. package/src/components/compound/DlCodeEditor/styles/themes.css +3999 -0
  57. package/src/components/compound/DlCodeEditor/types.ts +21 -0
  58. package/src/components/compound/DlDateTime/DlDatePicker/DlDatePicker.vue +9 -1
  59. package/src/components/compound/DlDateTime/DlDatePicker/components/DlCalendar.vue +4 -2
  60. package/src/components/compound/DlDateTime/DlDatePicker/components/DlMonthCalendar.vue +2 -1
  61. package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
  62. package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +18 -9
  63. package/src/components/compound/DlDateTime/DlTimePicker/DlTimePicker.vue +2 -2
  64. package/src/components/compound/DlDialogBox/DlDialogBox.vue +74 -15
  65. package/src/components/compound/DlDialogBox/components/DlDialogBoxFooter.vue +1 -1
  66. package/src/components/compound/DlDialogBox/components/DlDialogBoxHeader.vue +9 -7
  67. package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +13 -4
  68. package/src/components/compound/DlInput/DlInput.vue +80 -17
  69. package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +42 -219
  70. package/src/components/compound/DlOptionGroup/DlOptionGroup.vue +16 -17
  71. package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
  72. package/src/components/compound/DlPagination/DlPagination.vue +1 -1
  73. package/src/components/compound/DlPagination/components/PaginationLegend.vue +0 -2
  74. package/src/components/compound/DlPagination/components/RowsSelector.vue +0 -2
  75. package/src/components/compound/DlRange/DlRange.vue +3 -2
  76. package/src/components/compound/DlSearches/DlSearch/DlSearch.vue +12 -5
  77. package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +413 -97
  78. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchFilters.vue +4 -1
  79. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +100 -39
  80. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +12 -7
  81. package/src/components/compound/DlSearches/DlSmartSearch/components/FiltersQuery.vue +5 -6
  82. package/src/components/compound/DlSearches/DlSmartSearch/types.ts +14 -0
  83. package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
  84. package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +172 -48
  85. package/src/components/compound/DlSelect/DlSelect.vue +264 -130
  86. package/src/components/compound/DlSelect/utils.ts +4 -1
  87. package/src/components/compound/DlSlider/DlSlider.vue +10 -2
  88. package/src/components/compound/DlSlider/components/DlSliderBase.vue +3 -3
  89. package/src/components/compound/DlSlider/components/DlSliderInput.vue +17 -26
  90. package/src/components/compound/DlSlider/sliderStyles.scss +5 -1
  91. package/src/components/compound/DlSlider/useSlider.ts +2 -2
  92. package/src/components/compound/DlSlider/utils.ts +2 -2
  93. package/src/components/compound/DlStepper/DlStepper.vue +46 -4
  94. package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
  95. package/src/components/compound/DlStepper/components/DlStepperFooter.vue +12 -0
  96. package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +24 -11
  97. package/src/components/compound/DlStepper/models/Step.ts +37 -8
  98. package/src/components/compound/DlStepper/models/Stepper.ts +108 -15
  99. package/src/components/compound/DlStepper/models/interfaces.ts +2 -1
  100. package/src/components/compound/DlTable/DlTable.vue +49 -14
  101. package/src/components/compound/DlTable/components/DlTd.vue +9 -9
  102. package/src/components/compound/DlTable/components/DlTh.vue +3 -2
  103. package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +35 -40
  104. package/src/components/compound/DlTable/hooks/tableFilter.ts +33 -21
  105. package/src/components/compound/DlTable/hooks/tablePagination.ts +18 -18
  106. package/src/components/compound/DlTable/hooks/tableRowExpand.ts +2 -1
  107. package/src/components/compound/DlTable/hooks/tableRowSelection.ts +0 -1
  108. package/src/components/compound/DlTable/hooks/tableSort.ts +52 -47
  109. package/src/components/compound/DlTable/styles/dl-table-styles.scss +8 -0
  110. package/src/components/compound/DlTabs/DlTabs.vue +83 -31
  111. package/src/components/compound/DlTabs/components/DlTab.vue +14 -4
  112. package/src/components/compound/DlTabs/components/TabsWrapper.vue +32 -27
  113. package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +268 -0
  114. package/src/components/compound/DlThumbnailGallery/index.ts +2 -0
  115. package/src/components/compound/DlThumbnailGallery/types.ts +11 -0
  116. package/src/components/compound/DlToast/api/useToast.ts +42 -1
  117. package/src/components/compound/DlToast/components/ToastComponent.vue +24 -32
  118. package/src/components/compound/DlToast/types.ts +52 -0
  119. package/src/components/compound/DlTreeTable/DlTreeTable.vue +1293 -0
  120. package/src/components/compound/DlTreeTable/components/DlTdTree.vue +119 -0
  121. package/src/components/compound/DlTreeTable/components/DlTrTree.vue +52 -0
  122. package/src/components/compound/DlTreeTable/index.ts +3 -0
  123. package/src/components/compound/DlTreeTable/types.ts +1 -0
  124. package/src/components/compound/DlTreeTable/utils/convertToNestedObject.ts +51 -0
  125. package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +19 -0
  126. package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +39 -0
  127. package/src/components/compound/DlTreeTable/utils/trSpacing.ts +13 -0
  128. package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +184 -0
  129. package/src/components/compound/index.ts +14 -1
  130. package/src/components/compound/types.ts +2 -0
  131. package/src/components/essential/DlBadge/DlBadge.vue +3 -3
  132. package/src/components/essential/DlCheckbox/DlCheckbox.vue +10 -7
  133. package/src/components/essential/DlEllipsis/DlEllipsis.vue +141 -0
  134. package/src/components/essential/DlIcon/DlIcon.vue +5 -5
  135. package/src/components/essential/DlLabel/DlLabel.vue +190 -0
  136. package/src/components/essential/DlLabel/index.ts +2 -0
  137. package/src/components/essential/DlList/DlList.vue +3 -3
  138. package/src/components/essential/DlMenu/DlMenu.vue +41 -22
  139. package/src/components/essential/DlMenu/utils.ts +8 -7
  140. package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
  141. package/src/components/essential/DlPageLayout/index.ts +2 -0
  142. package/src/components/essential/DlProgressBar/DlProgressBar.vue +1 -1
  143. package/src/components/essential/DlRadio/DlRadio.vue +10 -5
  144. package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
  145. package/src/components/essential/DlSpinner/index.ts +1 -13
  146. package/src/components/essential/DlSpinner/styles/spinnerStyles.scss +7 -0
  147. package/src/components/essential/DlSwitch/DlSwitch.vue +6 -3
  148. package/src/components/essential/DlTextArea/DlTextArea.vue +212 -7
  149. package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
  150. package/src/components/essential/DlTypography/DlTypography.vue +7 -1
  151. package/src/components/essential/index.ts +3 -2
  152. package/src/components/shared/DlInfoErrorMessage/DlInfoErrorMessage.vue +1 -1
  153. package/src/components/{essential → shared}/DlTooltip/DlTooltip.vue +26 -19
  154. package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +106 -43
  155. package/src/components/shared/DlVirtualScroll/useVirtualScroll.ts +28 -4
  156. package/src/components/shared/index.ts +1 -0
  157. package/src/components/types.ts +2 -0
  158. package/src/demos/BarChartDemo.vue +59 -2
  159. package/src/demos/ColumnChartDemo.vue +67 -2
  160. package/src/demos/DlAccordionDemo.vue +92 -43
  161. package/src/demos/DlAlertDemo.vue +14 -0
  162. package/src/demos/DlButtonDemo.vue +41 -4
  163. package/src/demos/DlCardDemo.vue +156 -19
  164. package/src/demos/DlChartDoughnutDemo.vue +49 -2
  165. package/src/demos/DlCheckboxDemo.vue +28 -3
  166. package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
  167. package/src/demos/DlCodeEditor/index.ts +2 -0
  168. package/src/demos/DlConfusionMatrixDemo.vue +93 -37
  169. package/src/demos/DlDemoPage.vue +235 -0
  170. package/src/demos/DlDialogBoxDemo.vue +56 -51
  171. package/src/demos/DlDropdownButtonDemo.vue +35 -27
  172. package/src/demos/DlEmptyStateDemo.vue +81 -0
  173. package/src/demos/DlGridDemo.vue +40 -0
  174. package/src/demos/DlInputDemo.vue +21 -1
  175. package/src/demos/DlJsonEditorDemo.vue +59 -0
  176. package/src/demos/DlLabelDemo.vue +208 -0
  177. package/src/demos/DlLineChartDemo.vue +50 -2
  178. package/src/demos/DlListDemo.vue +12 -9
  179. package/src/demos/DlMenuDemo.vue +147 -20
  180. package/src/demos/DlPageLayoutDemo.vue +146 -0
  181. package/src/demos/DlPanelContainerDemo.vue +113 -2
  182. package/src/demos/DlPopupDemo.vue +82 -1
  183. package/src/demos/DlRadioDemo.vue +16 -1
  184. package/src/demos/DlScatterChartDemo.vue +161 -0
  185. package/src/demos/DlSearchDemo.vue +9 -0
  186. package/src/demos/DlSelectDemo.vue +124 -27
  187. package/src/demos/DlSpinnerDemo.vue +0 -2
  188. package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
  189. package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
  190. package/src/demos/DlStepperDemo/SimpleStepper.vue +4 -0
  191. package/src/demos/DlStepperDemo/steps/GeneralStep.vue +1 -0
  192. package/src/demos/DlSwitchDemo.vue +12 -0
  193. package/src/demos/DlTableDemo.vue +84 -5
  194. package/src/demos/DlTabsDemo.vue +92 -3
  195. package/src/demos/DlTextAreaDemo.vue +14 -17
  196. package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
  197. package/src/demos/DlToastDemo.vue +3 -9
  198. package/src/demos/DlTooltipDemo.vue +66 -2
  199. package/src/demos/DlTreeTableDemo.vue +694 -0
  200. package/src/demos/DlVirtualScrollDemo.vue +3 -12
  201. package/src/demos/DlWidgetDemo.vue +252 -61
  202. package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +151 -32
  203. package/src/demos/index.ts +23 -4
  204. package/src/hooks/use-anchor.ts +15 -17
  205. package/src/hooks/use-arrow-navigation.ts +64 -21
  206. package/src/hooks/use-model-toggle.ts +14 -16
  207. package/src/hooks/use-portal.ts +9 -3
  208. package/src/hooks/use-scroll-target.ts +2 -4
  209. package/src/hooks/use-size-observer.ts +3 -2
  210. package/src/hooks/use-suggestions.ts +239 -49
  211. package/src/hooks/use-transition.ts +10 -4
  212. package/src/index.ts +22 -1
  213. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetFooter.vue +78 -0
  214. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetHeader.vue +22 -0
  215. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetLeftDrawer.vue +96 -0
  216. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetMainContent.vue +51 -0
  217. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetRightDrawer.vue +88 -0
  218. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/ActionsMenu.vue +70 -0
  219. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/AutomationMenu.vue +106 -0
  220. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardView.vue +101 -0
  221. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewGallery.vue +141 -0
  222. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewTable.vue +193 -0
  223. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/LayoutEmptyState.vue +227 -0
  224. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/UploadData.vue +106 -0
  225. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentImages.vue +540 -0
  226. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentNav.vue +329 -0
  227. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarKpi.vue +84 -0
  228. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarSearch.vue +132 -0
  229. package/src/layouts/DlDatasetBrowser/DemoComponents/SearchFilterMenu.vue +19 -0
  230. package/src/layouts/DlDatasetBrowser/DemoComponents/filters/AddFilter.vue +212 -0
  231. package/src/layouts/DlDatasetBrowser/DemoComponents/types/imageMetadata.ts +28 -0
  232. package/src/layouts/DlDatasetBrowser/DlDatasetBrowser.vue +42 -0
  233. package/src/layouts/DlStudioLayout/DlStudioLayout.vue +42 -0
  234. package/src/layouts/DlStudioLayout/components/Demo/LeftMenuContent.vue +23 -0
  235. package/src/layouts/DlStudioLayout/components/Demo/StudioFooter.vue +25 -0
  236. package/src/layouts/DlStudioLayout/components/Demo/StudioHeader.vue +121 -0
  237. package/src/layouts/DlStudioLayout/components/Demo/StudioLeftDrawer.vue +245 -0
  238. package/src/layouts/DlStudioLayout/components/Demo/StudioMainContent.vue +31 -0
  239. package/src/layouts/DlStudioLayout/components/Demo/StudioTabsMenu.vue +117 -0
  240. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/FilterMenu.vue +62 -0
  241. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuAnnotations.vue +98 -0
  242. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuItem.vue +66 -0
  243. package/src/layouts/DlStudioLayout/components/LayoutNavbar.vue +24 -0
  244. package/src/layouts/DlStudioLayout/components/ListAutocomplete.vue +149 -0
  245. package/src/layouts/DlStudioLayout/components/NavigationDrawer.vue +147 -0
  246. package/src/layouts/DlStudioLayout/index.ts +2 -0
  247. package/src/layouts/DlStudioLayout/types/HorizontalItems.ts +9 -0
  248. package/src/layouts/DlStudioLayout/types/VerticalItems.ts +10 -0
  249. package/src/simple-code-editor.d.ts +1 -0
  250. package/src/utils/click-outside.ts +1 -1
  251. package/src/utils/dom.ts +5 -5
  252. package/src/utils/events.ts +3 -3
  253. package/src/utils/global-nodes.ts +2 -2
  254. package/src/utils/input-sizes.ts +5 -2
  255. package/src/utils/is-ellipsis-active.ts +4 -1
  256. package/src/utils/parse-smart-query.ts +209 -111
  257. package/src/utils/portal.ts +5 -5
  258. package/src/utils/position-engine.ts +7 -7
  259. package/src/utils/render.ts +1 -1
  260. package/src/utils/scroll.ts +2 -2
  261. package/src/utils/selection.ts +3 -3
  262. package/vite.config.ts +9 -1
  263. package/src/components/basic/DlCard/DlCard.vue +0 -241
  264. package/src/components/basic/DlCard/types.ts +0 -20
  265. package/src/components/basic/DlEllipsis/DlEllipsis.vue +0 -114
  266. package/src/components/basic/DlWidget/DlGrid.vue +0 -33
  267. package/src/components/basic/DlWidget/DlGridRow.vue +0 -32
  268. package/src/components/compound/DlSearches/DlSmartSearch/utils/utils.ts +0 -124
  269. package/src/components/compound/DlToast/utils/config.ts +0 -17
  270. package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -65
  271. package/src/components/essential/DlTextHolder/index.ts +0 -2
  272. package/src/demos/DlTextHolderDemo.vue +0 -42
  273. package/src/utils/swapNodes.ts +0 -30
  274. /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
  275. /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
  276. /package/src/components/{basic → essential}/DlEllipsis/index.ts +0 -0
  277. /package/src/components/{essential → shared}/DlTooltip/index.ts +0 -0
@@ -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"
@@ -61,11 +75,7 @@
61
75
  class="matrix__cell"
62
76
  :style="`background-color: ${getCellBackground(
63
77
  cell.value
64
- )}; color: var(--dl-color-text${
65
- cell.value < 0.5 ? '-darker' : ''
66
- }-buttons)`"
67
- @mouseenter="handleShowTooltip(cell, $event)"
68
- @mouseleave="handleHideTooltip"
78
+ )}; color: ${getCellTextColor(cell.value)}`"
69
79
  @mousedown="openLink(cell)"
70
80
  >
71
81
  {{
@@ -75,16 +85,52 @@
75
85
  : cell.unnormalizedValue
76
86
  : null
77
87
  }}
88
+ <dl-tooltip
89
+ id="MatrixTooltip"
90
+ class="matrix-tooltip"
91
+ background-color="dl-color-shadow"
92
+ color="dl-color-tooltip-background"
93
+ :offset="[5, 5]"
94
+ >
95
+ <div class="matrix-tooltip__body">
96
+ <span>{{ cell.xLabel }}</span>
97
+ <span>{{ cell.yLabel }}</span>
98
+ <span class="matrix-tooltip__value">
99
+ <span
100
+ v-if="cell.value"
101
+ class="matrix-tooltip__color"
102
+ :style="`background-color: ${getCellBackground(
103
+ cell.value
104
+ )}`"
105
+ />
106
+ {{
107
+ normalized
108
+ ? `Normalized ${cell.value}`
109
+ : `Unnormalized ${cell.unnormalizedValue}`
110
+ }}
111
+ </span>
112
+ </div>
113
+ </dl-tooltip>
78
114
  </div>
79
115
  </div>
80
116
  </div>
81
- <div class="x-axis">
117
+ <div
118
+ class="x-axis"
119
+ style="margin-top: 10px"
120
+ >
82
121
  <span
83
122
  v-for="(label, index) in visibleLabels"
123
+ :ref="`xAxis-${index}`"
84
124
  :key="index"
85
125
  class="x-axis__element"
86
126
  :style="`${
87
- !labelImages[0] ? 'transform: rotate(70deg);' : ''
127
+ !labelImages[0]
128
+ ? `transform: rotate(${
129
+ rotateXLabels ? '70' : '0'
130
+ }deg); line-height: ${
131
+ rotateXLabels ? 100 : 10
132
+ }px`
133
+ : ''
88
134
  }`"
89
135
  >
90
136
  <span class="x-axis__element--text">
@@ -96,8 +142,12 @@
96
142
  <span v-else>
97
143
  {{ label }}
98
144
  </span>
99
- <dl-tooltip> {{ labelStrings[index] }}</dl-tooltip>
100
145
  </span>
146
+ <dl-tooltip
147
+ self="top middle"
148
+ :offset="calculateXAxisElOffset(index)"
149
+ >
150
+ {{ labelStrings[index] }}</dl-tooltip>
101
151
  </span>
102
152
  </div>
103
153
  <dl-brush
@@ -136,32 +186,13 @@
136
186
  >
137
187
  The given props cannot create a valid matrix.
138
188
  </div>
139
- <div
140
- v-if="tooltipVisible"
141
- :style="tooltipStyles"
142
- class="tooltip"
143
- >
144
- <span class="tooltip__x">{{ tooltipState.xLabel }}</span>
145
- <span class="tooltip__y">{{ tooltipState.yLabel }}</span>
146
- <span>
147
- <span
148
- v-if="tooltipState.value"
149
- class="tooltip__color"
150
- :style="`background-color: ${getCellBackground(
151
- tooltipState.value
152
- )}`"
153
- />
154
- {{ normalized ? 'Normalized' : 'Unnormalized' }}
155
- {{ tooltipState.value }}
156
- </span>
157
- </div>
158
189
  </div>
159
190
  </template>
160
191
 
161
192
  <script lang="ts">
162
193
  import { defineComponent, PropType, ref } from 'vue-demi'
163
194
  import DlBrush from '../../components/DlBrush.vue'
164
- import DlTooltip from '../../../../essential/DlTooltip/DlTooltip.vue'
195
+ import { DlTooltip } from '../../../../shared'
165
196
  import {
166
197
  DlConfusionMatrixCell,
167
198
  DlConfusionMatrixLabel,
@@ -169,6 +200,8 @@ import {
169
200
  } from '../../types'
170
201
  import { hexToRgbA } from '../../../../../utils/colors'
171
202
  import { colorNames } from '../../../../../utils/css-color-names'
203
+ import DlEmptyState from '../../../../basic/DlEmptyState/DlEmptyState.vue'
204
+ import { DlEmptyStateProps } from '../../../../basic/DlEmptyState/types'
172
205
  import { useThemeVariables } from '../../../../../hooks/use-theme'
173
206
  import {
174
207
  getGradationValues,
@@ -181,7 +214,8 @@ import { debounce, isObject } from 'lodash'
181
214
  export default defineComponent({
182
215
  components: {
183
216
  DlBrush,
184
- DlTooltip
217
+ DlTooltip,
218
+ DlEmptyState
185
219
  },
186
220
  props: {
187
221
  labels: {
@@ -213,14 +247,22 @@ export default defineComponent({
213
247
  maxWidth: {
214
248
  type: String,
215
249
  default: '800px'
250
+ },
251
+ isEmpty: Boolean,
252
+ emptyStateProps: {
253
+ type: Object as PropType<DlEmptyStateProps>,
254
+ default: null
216
255
  }
217
256
  },
218
257
  setup(props) {
219
258
  const { variables } = useThemeVariables()
220
259
 
221
260
  const tooltipState = ref<{
222
- x: string
223
- y: string
261
+ value?: number
262
+ xLabel?: string
263
+ yLabel?: string
264
+ x?: number
265
+ y?: number
224
266
  visible?: boolean
225
267
  } | null>(null)
226
268
  const currentBrushState = ref<{ min: number; max: number }>({
@@ -228,6 +270,8 @@ export default defineComponent({
228
270
  max: props.matrix.length
229
271
  })
230
272
  const cellWidth = ref<number | null>(null)
273
+ const rotateXLabels = ref(true)
274
+ const resizeObserver = ref<ResizeObserver>(null)
231
275
 
232
276
  const getCellBackground = (value: number = 1): string => {
233
277
  const object: { [key: string]: any } = {
@@ -237,20 +281,28 @@ export default defineComponent({
237
281
  const hex = object[props.color]
238
282
  return hexToRgbA(hex, value)
239
283
  }
284
+
285
+ const getCellTextColor = (value: number) => {
286
+ const isDark =
287
+ document.documentElement.getAttribute('data-theme') ===
288
+ 'dark-mode'
289
+ if (isDark) return 'var(--dl-color-text-buttons)'
290
+ return `var(--dl-color-text${value < 0.5 ? '-darker' : ''}-buttons)`
291
+ }
292
+
240
293
  return {
294
+ resizeObserver,
241
295
  variables,
242
296
  getCellBackground,
297
+ getCellTextColor,
243
298
  cellWidth,
244
- tooltipState,
245
- currentBrushState
299
+ currentBrushState,
300
+ rotateXLabels
246
301
  }
247
302
  },
248
303
  computed: {
249
- tooltipVisible(): boolean {
250
- return this.tooltipState?.visible
251
- },
252
304
  visibleLabels(): DlConfusionMatrixLabel[] {
253
- if (isObject(this.labels[0])) {
305
+ if (this.labels[0]) {
254
306
  const arr = this.labels as DlConfusionMatrixLabel[]
255
307
  return arr.slice(
256
308
  this.currentBrushState.min,
@@ -275,33 +327,71 @@ export default defineComponent({
275
327
  flattenedMatrix(): DlConfusionMatrixCell[] {
276
328
  return flattenConfusionMatrix(this.matrix, this.labelStrings)
277
329
  },
278
- matrixStyles(): object {
330
+ matrixStyles(): Record<string, number | string> {
279
331
  return {
280
332
  '--matrix-rows': this.matrix.length,
281
333
  '--cell-dimensions': `${this.cellWidth}px`,
282
334
  '--general-color': this.getCellBackground()
283
335
  }
284
336
  },
285
- tooltipStyles(): object {
286
- return {
287
- left: `${this.tooltipState?.x + 10}px`,
288
- top: `${this.tooltipState?.y + 15}px`
289
- }
290
- },
291
337
  gradationValues(): number[] {
292
338
  return this.normalized
293
339
  ? [1, 0.8, 0.6, 0.4, 0.2, 0]
294
340
  : getGradationValues(this.matrix)
295
341
  }
296
342
  },
343
+ watch: {
344
+ matrix: {
345
+ handler(value) {
346
+ this.currentBrushState.max = value.length
347
+ this.resizeMatrix()
348
+ }
349
+ },
350
+ currentBrushState() {
351
+ const longest = Math.max(
352
+ ...this.visibleLabels.map(
353
+ (el: DlConfusionMatrixLabel) =>
354
+ (isObject(el) ? el.title : `${el}`).length
355
+ )
356
+ )
357
+ this.rotateXLabels = longest * 12 > getCellWidth()
358
+ },
359
+ isEmpty(val) {
360
+ this.handleResizeObserver({ dispose: !val })
361
+ }
362
+ },
297
363
  mounted() {
298
364
  if (!this.isValidMatrix) return
299
- this.resizeMatrix()
300
- const resizeObserver = new ResizeObserver(this.resizeMatrix)
301
- resizeObserver.observe(this.$refs.wrapper as Element)
302
- window.onresize = this.resizeMatrix
365
+ if (this.isEmpty) return
366
+
367
+ this.handleResizeObserver()
303
368
  },
304
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
+ },
305
395
  resizeMatrix() {
306
396
  const colorSpectrum = this.$refs.colorSpectrum as HTMLElement
307
397
  const verticalWrapper = this.$refs.verticalWrapper as HTMLElement
@@ -328,9 +418,9 @@ export default defineComponent({
328
418
  ctx.matrix.length / (brush.max - brush.min),
329
419
  ctx.$refs.matrix
330
420
  )
331
- const scroll = brush.min * getCellWidth() + 2
421
+ const scroll = brush.min * (getCellWidth() - 2)
332
422
  const container = ctx.$refs.matrixWrapper
333
- container.scroll(scroll, scroll)
423
+ container.scroll(scroll, 0)
334
424
  ctx.currentBrushState = brush
335
425
  ctx.resizeYAxis()
336
426
  },
@@ -340,32 +430,10 @@ export default defineComponent({
340
430
  const yAxis = this.$refs.yAxis as HTMLElement
341
431
  yAxis.style.height = `${getCellWidth() * this.matrix.length}px`
342
432
  },
343
- handleMatrixScroll(e: MouseEvent) {
433
+ handleMatrixScroll(e: MouseEvent | UIEvent) {
344
434
  const target = e.target as HTMLElement
345
435
  ;(this.$refs.yAxisOuter as HTMLElement).scroll(0, target.scrollTop)
346
436
  },
347
- handleShowTooltip(cell: DlConfusionMatrixCell, e: MouseEvent) {
348
- this.showTooltip(this, cell, e)
349
- },
350
- handleHideTooltip() {
351
- this.hideTooltip(this)
352
- },
353
- showTooltip: debounce(
354
- (ctx: any, cell: DlConfusionMatrixCell, e: MouseEvent) => {
355
- ctx.tooltipState = {
356
- value: ctx.normalized ? cell.value : cell.unnormalizedValue,
357
- xLabel: cell.xLabel,
358
- yLabel: cell.yLabel,
359
- x: e.pageX,
360
- y: e.pageY,
361
- visible: true
362
- }
363
- },
364
- 200
365
- ),
366
- hideTooltip: debounce((ctx: any) => {
367
- if (ctx?.tooltipState) ctx.tooltipState.visible = false
368
- }, 200),
369
437
  openLink(cell: DlConfusionMatrixCell) {
370
438
  if (!cell.link) return
371
439
  window.open(cell.link, '_blank')
@@ -407,15 +475,17 @@ export default defineComponent({
407
475
  .x-axis {
408
476
  width: 100%;
409
477
  display: flex;
410
- justify-content: space-between;
478
+ justify-content: space-evenly;
411
479
  margin-top: 10px;
412
480
  min-height: 100px;
413
481
  max-height: 100px;
414
482
  &__element {
415
483
  width: var(--cell-dimensions);
416
- line-height: 100px;
417
484
  overflow: hidden;
418
485
  text-overflow: ellipsis;
486
+ &--text {
487
+ font-size: 12px;
488
+ }
419
489
  }
420
490
  }
421
491
  .y-axis {
@@ -428,6 +498,7 @@ export default defineComponent({
428
498
  line-height: var(--cell-dimensions);
429
499
  overflow: hidden;
430
500
  text-overflow: ellipsis;
501
+ font-size: 12px;
431
502
  }
432
503
  }
433
504
  .y-axis-outer {
@@ -461,7 +532,7 @@ export default defineComponent({
461
532
  grid-template-columns: repeat(var(--matrix-rows), 1fr);
462
533
 
463
534
  &__cell {
464
- font-size: 80%;
535
+ font-size: 12px;
465
536
  cursor: pointer;
466
537
  border: 1px solid var(--dl-color-separator);
467
538
  box-sizing: border-box;
@@ -501,16 +572,25 @@ export default defineComponent({
501
572
  }
502
573
  }
503
574
 
504
- .tooltip {
505
- position: absolute;
506
- border: 1px solid var(--dl-color-separator);
507
- padding: 8px;
508
- font-size: 0.8em;
509
- display: flex;
510
- flex-direction: column;
511
- background-color: var(--dl-color-shadow);
512
- border-radius: 3px;
513
- animation: fadeIn 0.4s;
575
+ #MatrixTooltip {
576
+ padding: 0;
577
+ }
578
+
579
+ .matrix-tooltip {
580
+ &__body {
581
+ border: 1px solid var(--dl-color-separator);
582
+ padding: 8px;
583
+ font-size: 10px;
584
+ line-height: 12px;
585
+ display: flex;
586
+ flex-direction: column;
587
+ gap: 2px;
588
+ }
589
+
590
+ &__value {
591
+ display: flex;
592
+ align-items: center;
593
+ }
514
594
 
515
595
  &__color {
516
596
  display: inline-block;
@@ -2,7 +2,8 @@ import { isObject } from 'lodash'
2
2
  import { DlConfusionMatrixCell, DlConfusionMatrixLabel } from '../../types'
3
3
 
4
4
  export function getCellWidth() {
5
- return document.querySelector('.matrix__cell').getBoundingClientRect().width
5
+ return document.querySelector('.matrix__cell')?.getBoundingClientRect()
6
+ .width
6
7
  }
7
8
 
8
9
  export function setZoom(zoom: number, el: HTMLElement) {
@@ -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) {
@@ -269,6 +293,23 @@ export default defineComponent({
269
293
  plugins: {
270
294
  legend: {
271
295
  display: false
296
+ },
297
+ tooltip: {
298
+ yAlign: 'none',
299
+ callbacks: {
300
+ labelColor(
301
+ tooltipItem: { dataIndex: string | number },
302
+ chart: any
303
+ ) {
304
+ return {
305
+ backgroundColor:
306
+ chartRefValue.value.data.datasets[0]
307
+ .hoverBackgroundColor[
308
+ tooltipItem.dataIndex
309
+ ]
310
+ }
311
+ }
312
+ }
272
313
  }
273
314
  }
274
315
  },
@@ -26,14 +26,13 @@
26
26
  import { defineComponent, PropType } from 'vue-demi'
27
27
  import DlDoughnutChart from './DlDoughnutChart.vue'
28
28
  import { TDoughnutChartData } from './types/TDoughnutChartData'
29
- import { DlWidget, DlGridRow, DlGrid } from '../../../../basic'
29
+ import { DlWidget, DlGrid } from '../../../../basic'
30
30
 
31
31
  export default defineComponent({
32
32
  name: 'DlDoughnutChartWidget',
33
33
  components: {
34
34
  DlDoughnutChart,
35
35
  DlGrid,
36
- DlGridRow,
37
36
  DlWidget
38
37
  },
39
38
  props: {
@@ -15,12 +15,6 @@
15
15
  @mouseenter="emitMouseOverLegend(index)"
16
16
  @mouseleave="emitMouseLeaveLegend(index)"
17
17
  >
18
- <dl-tooltip
19
- self="top middle"
20
- anchor="top middle"
21
- >
22
- {{ data.labels[index] }}
23
- </dl-tooltip>
24
18
  <div class="wrapper__legend__item__label">
25
19
  <div>
26
20
  <div
@@ -28,14 +22,12 @@
28
22
  :style="{ backgroundColor: getColor(index, badge) }"
29
23
  />
30
24
  </div>
31
- <dl-typography>
32
- <div
33
- :class="legendLabelClass"
34
- :style="{ color: getColor(index, text) }"
35
- >
36
- {{ data.labels[index] }}
37
- </div>
38
- </dl-typography>
25
+ <div
26
+ :class="legendLabelClass"
27
+ :style="{ color: getColor(index, text) }"
28
+ >
29
+ <dl-ellipsis :text="data.labels[index]" />
30
+ </div>
39
31
  </div>
40
32
  <div
41
33
  class="wrapper__legend__item__counter truncate"
@@ -50,7 +42,7 @@
50
42
 
51
43
  <script lang="ts">
52
44
  import { defineComponent, PropType } from 'vue-demi'
53
- import { DlTypography, DlTooltip } from '../../../../../essential'
45
+ import { DlEllipsis } from '../../../../../essential'
54
46
  import { TDoughnutChartData } from '../types/TDoughnutChartData'
55
47
 
56
48
  enum EBadgeText {
@@ -62,8 +54,7 @@ type TBadgeText = EBadgeText.badge | EBadgeText.text
62
54
  export default defineComponent({
63
55
  name: 'DlDoughnutChartLegend',
64
56
  components: {
65
- DlTypography,
66
- DlTooltip
57
+ DlEllipsis
67
58
  },
68
59
  props: {
69
60
  data: {
@@ -108,7 +99,7 @@ export default defineComponent({
108
99
  ]
109
100
  },
110
101
  itemsCount(): number | undefined {
111
- return this.data?.datasets[0]?.data?.length
102
+ return (this.data?.datasets?.[0]?.data || []).length
112
103
  }
113
104
  },
114
105
  mounted(): void {