@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,7 +3,11 @@
3
3
  :id="uuid"
4
4
  :style="cssVars"
5
5
  class="root-container"
6
- :class="{ 'root-container--s': isSmall, [identifierClass]: true }"
6
+ :class="{
7
+ 'root-container--s': isSmall,
8
+ [identifierClass]: true,
9
+ 'fit-content': fitContent
10
+ }"
7
11
  >
8
12
  <div
9
13
  v-show="!!title.length || !!tooltip.length"
@@ -26,6 +30,7 @@
26
30
  <span v-show="!!tooltip.length">
27
31
  <dl-icon
28
32
  icon="icon-dl-info"
33
+ :inline="false"
29
34
  class="tooltip-icon"
30
35
  size="12px"
31
36
  />
@@ -54,25 +59,23 @@
54
59
  :class="selectClasses"
55
60
  >
56
61
  <div
57
- v-show="hasPrepend || search"
62
+ v-show="hasPrepend || searchable"
58
63
  :class="[
59
64
  ...adornmentClasses,
60
65
  'adornment-container--pos-left'
61
66
  ]"
62
67
  >
63
- <dl-icon
64
- v-if="search"
65
- icon="icon-dl-search"
66
- :size="iconSize"
67
- color="dl-color-lighter"
68
- />
69
- <slot
70
- v-else
71
- name="prepend"
72
- />
68
+ <slot name="prepend">
69
+ <dl-icon
70
+ v-if="searchable"
71
+ icon="icon-dl-search"
72
+ :size="iconSize"
73
+ color="dl-color-lighter"
74
+ />
75
+ </slot>
73
76
  </div>
74
77
  <input
75
- v-if="search"
78
+ v-if="searchable"
76
79
  ref="searchInput"
77
80
  class="select-search-input"
78
81
  :style="!isExpanded ? 'display: none;' : 'width: 100%;'"
@@ -82,9 +85,15 @@
82
85
  @focus="handleSearchFocus"
83
86
  @blur="handleSearchBlur"
84
87
  >
85
- <div v-if="hasSelectedSlot">
88
+ <dl-tooltip v-if="disabled && disabledTooltip">
89
+ {{ disabledTooltip }}
90
+ </dl-tooltip>
91
+ <div
92
+ v-if="hasSelectedSlot"
93
+ style="width: 100%"
94
+ >
86
95
  <slot
87
- v-if="search ? !isExpanded : true"
96
+ v-if="searchable ? !isExpanded : true"
88
97
  :opt="selectedOption"
89
98
  name="selected"
90
99
  />
@@ -92,8 +101,8 @@
92
101
  <template v-if="!hasSelectedSlot">
93
102
  <span
94
103
  v-show="
95
- (multiselect && !search) ||
96
- (multiselect && search && !isExpanded)
104
+ (multiselect && !searchable) ||
105
+ (multiselect && searchable && !isExpanded)
97
106
  "
98
107
  class="root-container--placeholder"
99
108
  >
@@ -106,8 +115,8 @@
106
115
  </span>
107
116
  <span
108
117
  v-show="
109
- (!multiselect && !search) ||
110
- (!multiselect && search && !isExpanded)
118
+ (!multiselect && !searchable) ||
119
+ (!multiselect && searchable && !isExpanded)
111
120
  "
112
121
  class="selected-label"
113
122
  >
@@ -118,7 +127,7 @@
118
127
  :class="[
119
128
  ...adornmentClasses,
120
129
  `adornment-container--pos-right${
121
- disableDropdownIconPadding
130
+ withoutDropdownIconPadding
122
131
  ? ' adornment-container--pos-right-without_padding'
123
132
  : ''
124
133
  }`
@@ -126,6 +135,7 @@
126
135
  >
127
136
  <dl-icon
128
137
  :icon="dropdownIcon"
138
+ :color="chevronIconColor"
129
139
  class="expand-icon"
130
140
  :inline="false"
131
141
  :size="withoutBorders ? '12px' : '16px'"
@@ -144,6 +154,7 @@
144
154
  style="border-radius: 0"
145
155
  :disabled="disabled || readonly"
146
156
  :arrow-nav-items="options"
157
+ :max-height="dropdownMaxHeight"
147
158
  @show="onMenuOpen"
148
159
  @hide="closeMenu"
149
160
  @highlightedIndex="setHighlightedIndex"
@@ -151,7 +162,6 @@
151
162
  >
152
163
  <dl-list
153
164
  class="select-list"
154
- :style="dropdownCSSVars"
155
165
  :padding="false"
156
166
  >
157
167
  <dl-list-item v-if="noOptions">
@@ -178,56 +188,101 @@
178
188
  @update:model-value="selectAll"
179
189
  @depth-change="handleDepthChange"
180
190
  >
181
- <slot
182
- v-if="hasAllItemsSlot"
183
- name="all-items"
184
- />
185
- <template v-else>
191
+ <slot name="all-items">
186
192
  {{ computedAllItemsLabel }}
187
- </template>
193
+ </slot>
188
194
  </dl-select-option>
189
- <dl-select-option
190
- v-for="(option, optionIndex) in options"
191
- :key="getKeyForOption(option)"
192
- clickable
193
- :multiselect="multiselect"
194
- :class="{
195
- selected:
196
- option === selectedOption && highlightSelected
197
- }"
198
- :style="
199
- optionIndex === highlightedIndex
200
- ? 'background-color: var(--dl-color-fill)'
201
- : ''
202
- "
203
- :with-wave="withWave"
204
- :model-value="modelValue"
205
- :value="getOptionValue(option)"
206
- :highlight-selected="highlightSelected"
207
- :count="getOptionCount(option)"
208
- :children="getOptionChildren(option)"
209
- :capitalized="capitalizedOptions"
210
- @update:model-value="handleModelValueUpdate"
211
- @click="selectOption(option)"
212
- @selected="handleSelected"
213
- @deselected="handleDeselected"
214
- @depth-change="handleDepthChange"
195
+
196
+ <!-- Virtual scroll -->
197
+ <dl-virtual-scroll
198
+ v-if="optionsCount > MAX_ITEMS_PER_LIST"
199
+ v-slot="{ item, index }"
200
+ :items="filteredOptions"
201
+ :virtual-scroll-item-size="28"
202
+ :virtual-scroll-sticky-size-start="28"
203
+ :virtual-scroll-sticky-size-end="20"
204
+ separator
215
205
  >
216
- <slot
217
- v-if="hasOptionSlot"
218
- :opt="option"
219
- name="option"
220
- />
221
- <template v-else>
222
- {{
223
- capitalizedOptions
224
- ? typeof getOptionLabel(option) ===
225
- 'string' &&
226
- getOptionLabel(option).toLowerCase()
227
- : getOptionLabel(option)
228
- }}
229
- </template>
230
- </dl-select-option>
206
+ <dl-select-option
207
+ :key="getKeyForOption(item)"
208
+ clickable
209
+ :multiselect="multiselect"
210
+ :class="{
211
+ selected:
212
+ item === selectedOption && highlightSelected
213
+ }"
214
+ :style="
215
+ index === highlightedIndex
216
+ ? 'background-color: var(--dl-color-fill)'
217
+ : ''
218
+ "
219
+ :with-wave="withWave"
220
+ :model-value="modelValue"
221
+ :value="getOptionValue(item)"
222
+ :highlight-selected="highlightSelected"
223
+ :count="getOptionCount(item)"
224
+ :children="getOptionChildren(item)"
225
+ :capitalized="capitalizedOptions"
226
+ @update:model-value="handleModelValueUpdate"
227
+ @click="selectOption(item)"
228
+ @selected="handleSelected"
229
+ @deselected="handleDeselected"
230
+ >
231
+ <slot
232
+ name="option"
233
+ :opt="item"
234
+ >
235
+ {{
236
+ capitalizedOptions
237
+ ? typeof getOptionLabel(item) ===
238
+ 'string' &&
239
+ getOptionLabel(item).toLowerCase()
240
+ : getOptionLabel(item)
241
+ }}
242
+ </slot>
243
+ </dl-select-option>
244
+ </dl-virtual-scroll>
245
+ <!-- Else normal list -->
246
+ <div v-else>
247
+ <dl-select-option
248
+ v-for="(option, optionIndex) in filteredOptions"
249
+ :key="getKeyForOption(option)"
250
+ clickable
251
+ :multiselect="multiselect"
252
+ :class="{
253
+ selected:
254
+ option === selectedOption &&
255
+ highlightSelected
256
+ }"
257
+ :style="
258
+ optionIndex === highlightedIndex
259
+ ? 'background-color: var(--dl-color-fill)'
260
+ : ''
261
+ "
262
+ :with-wave="withWave"
263
+ :model-value="modelValue"
264
+ :value="getOptionValue(option)"
265
+ :highlight-selected="highlightSelected"
266
+ :count="getOptionCount(option)"
267
+ :children="getOptionChildren(option)"
268
+ :capitalized="capitalizedOptions"
269
+ @update:model-value="handleModelValueUpdate"
270
+ @click="selectOption(option)"
271
+ @selected="handleSelected"
272
+ @deselected="handleDeselected"
273
+ @depth-change="handleDepthChange"
274
+ >
275
+ <slot
276
+ :opt="option"
277
+ name="option"
278
+ >
279
+ <span
280
+ class="inner-option"
281
+ v-html="getOptionHtml(option)"
282
+ />
283
+ </slot>
284
+ </dl-select-option>
285
+ </div>
231
286
  <dl-list-item v-if="hasAfterOptions && !noOptions">
232
287
  <dl-item-section>
233
288
  <slot name="after-options" />
@@ -258,9 +313,14 @@
258
313
  <script lang="ts">
259
314
  import { InputSizes, TInputSizes } from '../../../utils/input-sizes'
260
315
  import { DlListItem } from '../../basic'
261
- import { DlTooltip, DlList, DlIcon, DlMenu } from '../../essential'
262
- import { DlInfoErrorMessage, DlItemSection } from '../../shared'
263
- import { defineComponent, isVue2, PropType, ref } from 'vue-demi'
316
+ import { DlTooltip } from '../../shared'
317
+ import { DlList, DlIcon, DlMenu } from '../../essential'
318
+ import {
319
+ DlInfoErrorMessage,
320
+ DlItemSection,
321
+ DlVirtualScroll
322
+ } from '../../shared'
323
+ import { defineComponent, PropType, ref } from 'vue-demi'
264
324
  import {
265
325
  getLabel,
266
326
  getIconSize,
@@ -282,7 +342,8 @@ export default defineComponent({
282
342
  DlListItem,
283
343
  DlMenu,
284
344
  DlTooltip,
285
- DlSelectOption
345
+ DlSelectOption,
346
+ DlVirtualScroll
286
347
  },
287
348
  model: {
288
349
  prop: 'modelValue',
@@ -303,7 +364,8 @@ export default defineComponent({
303
364
  width: { type: String, default: '100%' },
304
365
  withoutBorders: { type: Boolean, default: false },
305
366
  title: { type: String, default: '' },
306
- search: { type: Boolean, default: false },
367
+ searchable: { type: Boolean, default: false },
368
+ customFilter: { type: Boolean, default: false },
307
369
  required: { type: Boolean, default: false },
308
370
  optional: { type: Boolean, default: false },
309
371
  fitContent: Boolean,
@@ -329,7 +391,8 @@ export default defineComponent({
329
391
  withoutDropdownIconPadding: { type: Boolean, default: false },
330
392
  clearButtonTooltip: { type: Boolean, default: false },
331
393
  dropdownMaxHeight: { type: String, default: '30vh' },
332
- preserveSearch: { type: Boolean, default: false }
394
+ preserveSearch: { type: Boolean, default: false },
395
+ disabledTooltip: { type: String, default: 'Disabled' }
333
396
  },
334
397
  emits: [
335
398
  'search-focus',
@@ -349,6 +412,10 @@ export default defineComponent({
349
412
  const isExpanded = ref(false)
350
413
  const selectedIndex = ref(-1)
351
414
  const highlightedIndex = ref(-1)
415
+ const isEmpty = ref(true)
416
+ const searchTerm = ref('')
417
+ const searchInputValue = ref('')
418
+ const MAX_ITEMS_PER_LIST = 100 // HARDCODED - max items per list before virtual scroll
352
419
 
353
420
  const setHighlightedIndex = (value: any) => {
354
421
  highlightedIndex.value = value
@@ -356,6 +423,7 @@ export default defineComponent({
356
423
  const handleModelValueUpdate = (val: any) => {
357
424
  emit('update:model-value', val)
358
425
  emit('change', val)
426
+ emit('selected', val)
359
427
  }
360
428
  const handleSelectedItem = (value: any) => {
361
429
  selectedIndex.value = props.options.findIndex(
@@ -367,21 +435,38 @@ export default defineComponent({
367
435
  }
368
436
 
369
437
  return {
438
+ uuid: `dl-select-${v4()}`,
439
+ MAX_ITEMS_PER_LIST,
440
+ isEmpty,
370
441
  isExpanded,
371
442
  highlightedIndex,
372
443
  selectedIndex,
373
444
  setHighlightedIndex,
374
445
  handleSelectedItem,
375
- handleModelValueUpdate
376
- }
377
- },
378
- data() {
379
- return {
380
- uuid: `dl-select-${v4()}`,
381
- isEmpty: true
446
+ handleModelValueUpdate,
447
+ searchTerm, // todo: merge this sometime
448
+ searchInputValue
382
449
  }
383
450
  },
384
451
  computed: {
452
+ filteredOptions(): DlSelectOptionType[] {
453
+ if (this.customFilter || this.searchTerm === '') {
454
+ return this.options
455
+ }
456
+
457
+ return this.options.filter((option) => {
458
+ const label = getLabel(option)
459
+ return (
460
+ label &&
461
+ label
462
+ .toLowerCase()
463
+ .includes(this.searchTerm.toLowerCase().trim())
464
+ )
465
+ })
466
+ },
467
+ optionsCount(): number {
468
+ return this.options?.length ?? 0
469
+ },
385
470
  identifierClass(): string {
386
471
  return `dl-select-${this.title}-${
387
472
  this.placeholder ?? ''
@@ -446,24 +531,12 @@ export default defineComponent({
446
531
  return getIconSize(this.size)
447
532
  },
448
533
  hasOptionSlot(): boolean {
449
- if (isVue2) {
450
- // @ts-ignore
451
- return !!this.$scopedSlots.option
452
- }
453
534
  return !!this.$slots.option
454
535
  },
455
536
  hasAllItemsSlot(): boolean {
456
- if (isVue2) {
457
- // @ts-ignore
458
- return !!this.$scopedSlots['all-items']
459
- }
460
537
  return !!this.$slots['all-items']
461
538
  },
462
539
  hasSelectedSlot(): boolean {
463
- if (isVue2) {
464
- // @ts-ignore
465
- return !!this.$scopedSlots.selected
466
- }
467
540
  return !!this.$slots.selected
468
541
  },
469
542
  computedPlaceholder(): string {
@@ -487,22 +560,18 @@ export default defineComponent({
487
560
  : this.options[this.selectedIndex]
488
561
  },
489
562
  hasBeforeOptions(): boolean {
490
- if (isVue2) {
491
- // @ts-ignore
492
- return !!this.$scopedSlots['before-options']
493
- }
494
563
  return !!this.$slots['before-options']
495
564
  },
496
565
  hasAfterOptions(): boolean {
497
- if (isVue2) {
498
- // @ts-ignore
499
- return !!this.$scopedSlots['after-options']
500
- }
501
566
  return !!this.$slots['after-options']
502
567
  },
503
568
  noOptions(): boolean {
504
569
  if (Array.isArray(this.options)) {
505
- return this.options.length === 0
570
+ if (this.customFilter) {
571
+ return this.options.length === 0
572
+ }
573
+
574
+ return this.filteredOptions.length === 0
506
575
  }
507
576
  return true
508
577
  },
@@ -524,7 +593,10 @@ export default defineComponent({
524
593
  if (this.withoutBorders) {
525
594
  classes.push('dl_select__select--without-border')
526
595
  }
527
- if (this.hasPrepend || this.search) {
596
+ if (this.withoutBorders && this.hasPrepend) {
597
+ classes.push('dl_select__select--without-border__with-prepend')
598
+ }
599
+ if (this.hasPrepend || this.searchable) {
528
600
  classes.push('dl_select__select--prepend')
529
601
  classes.push('dl_select__select--both-adornments')
530
602
  }
@@ -548,12 +620,8 @@ export default defineComponent({
548
620
  '--dl-select-width': this.width,
549
621
  '--dl-select-expand-icon-width': this.withoutDropdownIconPadding
550
622
  ? '16px'
551
- : '28px'
552
- }
553
- },
554
- dropdownCSSVars(): Record<string, string> {
555
- return {
556
- '--dl-select-dropdown-max-height': this.dropdownMaxHeight
623
+ : '28px',
624
+ '--dl-menu-scrollbar-width': '10px'
557
625
  }
558
626
  },
559
627
  asteriskClasses(): string[] {
@@ -569,19 +637,21 @@ export default defineComponent({
569
637
  return classes
570
638
  },
571
639
  isSmall(): boolean {
572
- return this.size === InputSizes.s
640
+ return (
641
+ this.size === (InputSizes.s as TInputSizes) ||
642
+ this.size === (InputSizes.small as TInputSizes)
643
+ )
573
644
  },
574
645
  hasPrepend(): boolean {
575
- if (isVue2) {
576
- // @ts-ignore
577
- return !!this.$scopedSlots.prepend && !this.isSmall
578
- }
579
646
  return !!this.$slots.prepend && !this.isSmall
647
+ },
648
+ chevronIconColor(): string {
649
+ return `${this.disabled ? 'dl-color-disabled' : null}`
580
650
  }
581
651
  },
582
652
  watch: {
583
653
  isExpanded(newVal: boolean) {
584
- if (this.search) {
654
+ if (this.searchable) {
585
655
  if (newVal) {
586
656
  const inputRef = this.$refs.searchInput as HTMLInputElement
587
657
  this.$nextTick(() => {
@@ -620,7 +690,7 @@ export default defineComponent({
620
690
  return
621
691
  }
622
692
 
623
- if (this.emitValue) {
693
+ if (this.emitValue && this.selectedIndex !== -1) {
624
694
  this.selectedIndex = this.options.findIndex(
625
695
  (
626
696
  option:
@@ -716,8 +786,9 @@ export default defineComponent({
716
786
  ? undefined
717
787
  : this.options[this.selectedIndex]
718
788
 
719
- if (this.search) {
720
- (this.$refs.searchInput as HTMLInputElement).value =
789
+ if (this.searchable) {
790
+ const searchInput = this.$refs.searchInput as HTMLInputElement
791
+ searchInput.value =
721
792
  typeof selectedOption === 'string'
722
793
  ? selectedOption
723
794
  : (selectedOption as Record<string, any>)?.label
@@ -732,22 +803,46 @@ export default defineComponent({
732
803
  this.handleModelValueUpdate(valueToEmit)
733
804
  },
734
805
  handleSearchInput(e: Event): void {
735
- if (this.search) {
736
- this.$emit(
737
- 'filter',
738
- (e.target as HTMLInputElement).value.trim()
739
- )
806
+ if (this.searchable) {
807
+ if (this.customFilter) {
808
+ this.$emit(
809
+ 'filter',
810
+ (e.target as HTMLInputElement).value.trim()
811
+ )
812
+ } else {
813
+ this.searchTerm = (
814
+ e.target as HTMLInputElement
815
+ ).value.trim()
816
+ }
817
+
740
818
  this.showAllItems =
741
819
  (e.target as HTMLInputElement).value.trim() === ''
742
820
 
743
821
  this.$nextTick(() => {
744
- (this.$refs.menu as any)?.updatePosition()
822
+ const menu = this.$refs.menu as any
823
+ menu?.updatePosition()
745
824
  })
746
825
  }
747
- this.$emit('search-input', (e.target as HTMLInputElement).value)
826
+ const searchValue = (e.target as HTMLInputElement).value
827
+ this.searchInputValue = searchValue
828
+ this.$emit('search-input', searchValue)
829
+ },
830
+ getOptionHtml(option: DlSelectOptionType) {
831
+ let label = `${this.getOptionLabel(option)}`
832
+ if (this.capitalizedOptions) {
833
+ label = label.toLowerCase()
834
+ }
835
+
836
+ const highlightedHtml = label.replace(
837
+ this.searchInputValue,
838
+ `<span style="background: var(--dl-color-warning)">${this.searchInputValue}</span>`
839
+ )
840
+ const html = `<span>${highlightedHtml}</span>`
841
+
842
+ return html
748
843
  },
749
844
  handleSearchBlur(e: Event): void {
750
- if (this.search) {
845
+ if (this.searchable) {
751
846
  const inputRef = this.$refs.searchInput as HTMLInputElement
752
847
  this.$nextTick(() => {
753
848
  inputRef?.focus({})
@@ -763,13 +858,14 @@ export default defineComponent({
763
858
  if (!this.preserveSearch) {
764
859
  const inputRef = this.$refs.searchInput as HTMLInputElement
765
860
  if (inputRef) inputRef.value = ''
861
+ this.searchTerm = ''
766
862
  this.$emit('filter', '')
767
863
  }
768
864
  },
769
865
  getLabel,
770
866
  onMenuOpen(): void {
771
867
  this.$emit('before-show')
772
- if (this.search) {
868
+ if (this.searchable) {
773
869
  const inputRef = this.$refs.searchInput as HTMLInputElement
774
870
  this.$nextTick(() => {
775
871
  inputRef?.focus({})
@@ -800,8 +896,12 @@ export default defineComponent({
800
896
  display: flex;
801
897
  align-items: center;
802
898
  }
899
+ &--small {
900
+ display: flex;
901
+ align-items: center;
902
+ }
803
903
  &--placeholder {
804
- color: var(--placeholder-color);
904
+ color: var(--dl-select-palceholder-color, --placeholder-color);
805
905
  }
806
906
 
807
907
  .dl-select__title-container {
@@ -810,14 +910,14 @@ export default defineComponent({
810
910
  align-items: center;
811
911
  color: var(--dl-color-lighter);
812
912
 
813
- &--s {
913
+ &--small {
814
914
  margin-right: 5px;
815
915
  margin-bottom: 0px;
816
916
  }
817
917
  }
818
918
 
819
919
  .selected-label {
820
- color: var(--placeholder-color);
920
+ color: var(--dl-select-palceholder-color, --placeholder-color);
821
921
  }
822
922
 
823
923
  .dl-select__title {
@@ -895,6 +995,10 @@ export default defineComponent({
895
995
  padding-top: 7px;
896
996
  padding-bottom: 7px;
897
997
  }
998
+ &--medium {
999
+ padding-top: 7px;
1000
+ padding-bottom: 7px;
1001
+ }
898
1002
 
899
1003
  &--s {
900
1004
  padding-top: 3px;
@@ -903,6 +1007,13 @@ export default defineComponent({
903
1007
  padding-right: 5px;
904
1008
  width: calc(100% - 10px);
905
1009
  }
1010
+ &--small {
1011
+ padding-top: 3px;
1012
+ padding-bottom: 3px;
1013
+ padding-left: 5px;
1014
+ padding-right: 5px;
1015
+ width: calc(100% - 10px);
1016
+ }
906
1017
 
907
1018
  &--has-selection {
908
1019
  color: var(--dl-color-medium);
@@ -920,6 +1031,13 @@ export default defineComponent({
920
1031
  height: 100%;
921
1032
  }
922
1033
  height: auto;
1034
+
1035
+ &__with-prepend {
1036
+ padding-left: 30px;
1037
+ padding-top: 10px;
1038
+ padding-bottom: 10px;
1039
+ width: calc(80% - var(--dl-select-expand-icon-width));
1040
+ }
923
1041
  }
924
1042
 
925
1043
  &::placeholder {
@@ -965,6 +1083,7 @@ export default defineComponent({
965
1083
  background-color: var(--dl-color-fill);
966
1084
  }
967
1085
 
1086
+ //todo: This doesnt work because of portal.
968
1087
  .select-list {
969
1088
  padding: 5px 0;
970
1089
  max-height: var(--dl-select-dropdown-max-height);
@@ -996,14 +1115,26 @@ export default defineComponent({
996
1115
  height: 34px;
997
1116
  }
998
1117
 
1118
+ &--large {
1119
+ height: 34px;
1120
+ }
1121
+
999
1122
  &--m {
1000
1123
  height: 28px;
1001
1124
  }
1002
1125
 
1126
+ &--medium {
1127
+ height: 28px;
1128
+ }
1129
+
1003
1130
  &--s {
1004
1131
  height: 20px;
1005
1132
  }
1006
1133
 
1134
+ &--small {
1135
+ height: 20px;
1136
+ }
1137
+
1007
1138
  &--pos-left {
1008
1139
  top: 0;
1009
1140
  left: 0;
@@ -1047,4 +1178,7 @@ export default defineComponent({
1047
1178
  padding-top: 3px;
1048
1179
  }
1049
1180
  }
1181
+ .fit-content > * {
1182
+ max-width: fit-content;
1183
+ }
1050
1184
  </style>