@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
@@ -4,6 +4,7 @@ import { sortDate } from '../../../../utils/sort'
4
4
  import { isNumber, isDate, isObject } from '../../../../utils/is'
5
5
  import { DlTableProps, DlTableColumn, DlTableSortMethod } from '../types'
6
6
  import { TablePagination } from './tablePagination'
7
+ import { isUndefined } from 'lodash'
7
8
 
8
9
  export const useTableSortProps = {
9
10
  sortMethod: Function,
@@ -29,52 +30,56 @@ export function useTableSort(
29
30
  : null
30
31
  })
31
32
 
32
- const computedSortMethod = computed(() =>
33
- props.sortMethod !== void 0
34
- ? props.sortMethod
35
- : (((data, sortBy, descending) => {
36
- const col = colList.value.find((def) => def.name === sortBy)
37
- if (col === void 0 || col.field === void 0) {
38
- return data
39
- }
40
-
41
- const dir = descending === true ? -1 : 1
42
- const val =
43
- typeof col.field === 'function'
44
- ? (v: string) => (col.field as Function)(v)
45
- : (v: Record<string, any>) => v[col.field as string]
46
-
47
- return data.sort((a: any, b: any) => {
48
- let A = val(a)
49
- let B = val(b)
50
-
51
- if (A === null || A === void 0) {
52
- return -1 * dir
53
- }
54
- if (B === null || B === void 0) {
55
- return 1 * dir
56
- }
57
- if (col.sort !== void 0) {
58
- return col.sort(A, B, a, b) * dir
59
- }
60
- if (isNumber(A) === true && isNumber(B) === true) {
61
- return (A - B) * dir
62
- }
63
- if (isDate(A) === true && isDate(B) === true) {
64
- return sortDate(A, B) * dir
65
- }
66
- if (typeof A === 'boolean' && typeof B === 'boolean') {
67
- return (Number(A) - Number(B)) * dir
68
- }
69
-
70
- [A, B] = [A, B].map((s) =>
71
- (s + '').toLocaleString().toLowerCase()
72
- )
73
-
74
- return A < B ? -1 * dir : A === B ? 0 : dir
75
- })
76
- }) as DlTableSortMethod)
77
- )
33
+ const computedSortMethod = computed(() => {
34
+ if (props.sortMethod) {
35
+ return props.sortMethod
36
+ }
37
+
38
+ const sortMethod: DlTableSortMethod = (data, sortBy, descending) => {
39
+ const col = colList.value.find((def) => def.name === sortBy)
40
+ if (isUndefined(col) || isUndefined(col.field)) {
41
+ return data
42
+ }
43
+
44
+ const dir = descending === true ? -1 : 1
45
+ const val =
46
+ typeof col.field === 'function'
47
+ ? (v: string) => (col.field as Function)(v)
48
+ : (v: Record<string, any>) => v[col.field as string]
49
+
50
+ return data.sort((a: any, b: any) => {
51
+ let A = val(a)
52
+ let B = val(b)
53
+
54
+ if (A === null || isUndefined(A)) {
55
+ return -1 * dir
56
+ }
57
+ if (B === null || isUndefined(B)) {
58
+ return 1 * dir
59
+ }
60
+ if (col.sort) {
61
+ return col.sort(A, B, a, b) * dir
62
+ }
63
+ if (isNumber(A) === true && isNumber(B) === true) {
64
+ return (A - B) * dir
65
+ }
66
+ if (isDate(A) === true && isDate(B) === true) {
67
+ return sortDate(A, B) * dir
68
+ }
69
+ if (typeof A === 'boolean' && typeof B === 'boolean') {
70
+ return (Number(A) - Number(B)) * dir
71
+ }
72
+
73
+ [A, B] = [A, B].map((s) =>
74
+ (s + '').toLocaleString().toLowerCase()
75
+ )
76
+
77
+ return A < B ? -1 * dir : A === B ? 0 : dir
78
+ })
79
+ }
80
+
81
+ return sortMethod
82
+ })
78
83
 
79
84
  function sort(col: string | DlTableColumn) {
80
85
  let sortOrder: DlTableProps['columnSortOrder'] = props.columnSortOrder
@@ -87,7 +92,7 @@ export function useTableSort(
87
92
  col = (col as DlTableColumn).name
88
93
  } else {
89
94
  const def = colList.value.find((def) => def.name === col)
90
- if (def !== void 0 && def.sortOrder) {
95
+ if (def && def.sortOrder) {
91
96
  sortOrder = def.sortOrder
92
97
  }
93
98
  }
@@ -8,6 +8,11 @@
8
8
  border-collapse: separate;
9
9
  border-spacing: 0;
10
10
 
11
+ &__drag-icon > div {
12
+ transition: all ease-in 0.1s;
13
+ opacity: 0;
14
+ }
15
+
11
16
  //markup-table
12
17
 
13
18
  &__card {
@@ -66,6 +71,9 @@
66
71
  height: 40px;
67
72
 
68
73
  &:not(.dl-tr--no-hover):hover {
74
+ .dl-table__drag-icon > div {
75
+ opacity: 1;
76
+ }
69
77
  td:not(.dl-td--no-hover) {
70
78
  background-color: var(--dl-color-fill-hover);
71
79
  }
@@ -1,35 +1,47 @@
1
1
  <template>
2
- <tabs-wrapper
3
- :id="uuid"
4
- :is-scrollable="isOverflowing"
5
- :is-at-end="isAtEnd"
6
- :is-at-start="isAtStart"
7
- :is-vertical="vertical"
8
- @left-arrow-click="handleLeft"
9
- @right-arrow-click="handleRight"
2
+ <div
3
+ class="dl-tabs-wrapper"
4
+ :class="{ 'full-width': fullWidth }"
5
+ :style="cssVars"
10
6
  >
11
- <div
12
- ref="dlTabsRef"
13
- class="dl-tabs-container"
14
- :class="{ 'full-width': fullWidth }"
15
- role="tablist"
7
+ <tabs-wrapper
8
+ :id="uuid"
9
+ :is-scrollable="isOverflowing"
10
+ :is-at-end="isAtEnd"
11
+ :is-at-start="isAtStart"
12
+ class="dl-tabs-root"
13
+ :is-vertical="vertical"
14
+ @left-arrow-click="handleLeft"
15
+ @right-arrow-click="handleRight"
16
16
  >
17
- <dl-tab
18
- v-for="(item, index) in items"
19
- :key="index"
20
- :name="item.name"
21
- :vertical="vertical"
22
- :label="item.label"
23
- :show-tooltip="item.showTooltip"
24
- :tooltip="item.tooltip"
25
- :disabled="disabled || item.disabled"
26
- :no-caps="item.noCaps"
27
- :is-active="modelValue === item.name"
28
- :font-size="fontSize"
29
- @click="handleTabClick"
30
- />
31
- </div>
32
- </tabs-wrapper>
17
+ <div
18
+ ref="dlTabsRef"
19
+ class="dl-tabs-container"
20
+ :class="{ 'full-width': fullWidth }"
21
+ role="tablist"
22
+ >
23
+ <dl-tab
24
+ v-for="(item, index) in items"
25
+ :key="index"
26
+ :name="item.name"
27
+ :vertical="vertical"
28
+ :label="item.label"
29
+ :show-tooltip="item.showTooltip"
30
+ :tooltip="item.tooltip"
31
+ :disabled="disabled || item.disabled"
32
+ :no-caps="item.noCaps"
33
+ :is-active="modelValue === item.name"
34
+ :font-size="fontSize"
35
+ @click="handleTabClick"
36
+ />
37
+ </div>
38
+ </tabs-wrapper>
39
+ <div class="empty-space" />
40
+ <slot
41
+ name="top-right"
42
+ :styles="topRightSlotStyles"
43
+ />
44
+ </div>
33
45
  </template>
34
46
 
35
47
  <script lang="ts">
@@ -56,7 +68,8 @@ export default defineComponent({
56
68
  fullWidth: { type: Boolean, default: false },
57
69
  disabled: { type: Boolean, default: false },
58
70
  modelValue: { type: String, required: true },
59
- fontSize: { type: String, default: '12px' }
71
+ fontSize: { type: String, default: '18px' },
72
+ gap: { type: String, default: '40px' }
60
73
  },
61
74
  emits: ['update:model-value'],
62
75
  data() {
@@ -67,10 +80,28 @@ export default defineComponent({
67
80
  isAtEnd: false,
68
81
  children: [] as HTMLElement[],
69
82
  invisibleLeftIndex: 0,
70
- invisibleRightIndex: 0
83
+ invisibleRightIndex: 0,
84
+ topRightSlotWidth: 0
71
85
  }
72
86
  },
73
87
  computed: {
88
+ topRightSlotStyles(): string {
89
+ return `border-bottom: ${
90
+ this.vertical
91
+ ? 'inherit'
92
+ : '1px solid var(--dl-color-separator)'
93
+ };
94
+ padding-left: ${this.topRightSlotWidth ? this.gap : '0px'};
95
+ `
96
+ },
97
+ cssVars(): Record<string, string> {
98
+ return {
99
+ '--dl-tabs-top-right-slot-width': this.topRightSlotWidth + 'px',
100
+ '--dl-empty-space-border': this.vertical
101
+ ? 'inherit'
102
+ : '1px solid var(--dl-color-separator)'
103
+ }
104
+ },
74
105
  // @ts-ignore
75
106
  resizeObserver(): ResizeObserver | undefined {
76
107
  // @ts-ignore
@@ -96,6 +127,9 @@ export default defineComponent({
96
127
  const element = this.$refs.dlTabsRef as HTMLElement
97
128
  this.resizeObserver?.observe(element)
98
129
  element?.addEventListener('scroll', this.updatePosition)
130
+ this.topRightSlotWidth =
131
+ (this.$refs.dlTabsRef as HTMLElement)?.parentNode?.parentNode
132
+ ?.children?.[2]?.clientWidth || 0
99
133
  },
100
134
  unmounted() {
101
135
  this.unsubscribeListeners()
@@ -172,6 +206,24 @@ export default defineComponent({
172
206
  </script>
173
207
 
174
208
  <style scoped lang="scss">
209
+ .dl-tabs-wrapper {
210
+ display: flex;
211
+ flex-wrap: nowrap;
212
+ justify-content: space-between;
213
+ max-width: 100%;
214
+ }
215
+
216
+ .dl-tabs-root {
217
+ max-width: calc(100% - var(--dl-tabs-top-right-slot-width));
218
+ }
219
+
220
+ .empty-space {
221
+ display: flex;
222
+ flex-grow: 1;
223
+ border-bottom: var(--dl-empty-space-border);
224
+ max-height: calc(100% - 1px);
225
+ }
226
+
175
227
  .dl-tabs-container {
176
228
  position: relative;
177
229
  text-align: center;
@@ -14,9 +14,11 @@
14
14
  <span>
15
15
  <dl-icon
16
16
  v-if="showTooltip"
17
- size="12px"
17
+ :size="iconSize"
18
+ :inline="false"
18
19
  icon="icon-dl-info"
19
20
  class="info-icon"
21
+ color="dl-color-lighter"
20
22
  />
21
23
  <dl-tooltip v-if="showTooltip === true">
22
24
  {{ tooltip }}
@@ -25,7 +27,8 @@
25
27
  </div>
26
28
  </template>
27
29
  <script lang="ts">
28
- import { DlTooltip, DlIcon } from '../../../essential'
30
+ import { DlTooltip } from '../../../shared'
31
+ import { DlIcon } from '../../../essential'
29
32
  import { defineComponent } from 'vue-demi'
30
33
  import { stopAndPrevent } from '../../../../utils'
31
34
  import { v4 } from 'uuid'
@@ -46,7 +49,7 @@ export default defineComponent({
46
49
  showTooltip: { type: Boolean, default: false },
47
50
  tooltip: { type: String, default: null },
48
51
  tabindex: { type: String, default: '0' },
49
- fontSize: { type: String, default: '12px' }
52
+ fontSize: { type: String, default: '18px' }
50
53
  },
51
54
  emits: ['click'],
52
55
  data() {
@@ -55,6 +58,10 @@ export default defineComponent({
55
58
  }
56
59
  },
57
60
  computed: {
61
+ iconSize(): string {
62
+ const fontSize = parseInt(this.fontSize)
63
+ return `${fontSize - 2 < 0 ? 0 : fontSize - 6}px`
64
+ },
58
65
  cssFontSize(): Record<string, string> {
59
66
  return {
60
67
  '--dl-tab-font-size': this.fontSize
@@ -106,7 +113,6 @@ export default defineComponent({
106
113
  display: flex;
107
114
  align-items: center;
108
115
  justify-content: center;
109
- gap: 5px;
110
116
  &--active {
111
117
  color: var(--dl-color-secondary);
112
118
  border-color: var(--dl-color-secondary) !important;
@@ -123,6 +129,7 @@ export default defineComponent({
123
129
  padding: 5px 10px;
124
130
  font-size: var(--dl-tab-font-size);
125
131
  line-height: 14px;
132
+ border-color: var(--dl-color-separator) !important;
126
133
  &:not(:last-child) {
127
134
  border-right: 1px solid var(--dl-color-separator);
128
135
  }
@@ -142,4 +149,7 @@ export default defineComponent({
142
149
  cursor: pointer;
143
150
  flex-grow: 1;
144
151
  }
152
+ .info-icon {
153
+ margin: 0px 5px;
154
+ }
145
155
  </style>
@@ -1,12 +1,10 @@
1
1
  <template>
2
- <div
3
- :class="['tabs-wrapper', { scrollable: isScrollable }]"
4
- :style="cssVars"
5
- >
2
+ <div :class="['tabs-wrapper', { scrollable: isScrollable }]">
6
3
  <dl-button
7
4
  v-if="isScrollable"
8
- size="l"
5
+ :size="buttonSize"
9
6
  flat
7
+ padding="0"
10
8
  :disabled="isAtStart"
11
9
  data-qa="left-arrow-button"
12
10
  class="arrow-button"
@@ -21,12 +19,13 @@
21
19
  <slot class="tabs" />
22
20
  <dl-button
23
21
  v-if="isScrollable"
24
- size="l"
22
+ :size="buttonSize"
25
23
  data-qa="right-arrow-button"
26
24
  text-color="dl-color-darker"
27
25
  flat
26
+ padding="0"
28
27
  :disabled="isAtEnd"
29
- class="arrow-button"
28
+ :class="rightArrowClass"
30
29
  @click="handleRightArrowClick"
31
30
  >
32
31
  <dl-icon
@@ -54,10 +53,17 @@ export default defineComponent({
54
53
  },
55
54
  emits: ['left-arrow-click', 'right-arrow-click'],
56
55
  computed: {
57
- cssVars(): string {
58
- return `
59
- --dl-tabs-arrows-size: ${this.isVertical ? '24px' : '40px'}
60
- `
56
+ buttonSize(): string {
57
+ return this.isVertical ? 's' : 'm'
58
+ },
59
+ hasTopRightSlot(): boolean {
60
+ return !!this.$parent.$slots['top-right']
61
+ },
62
+ rightArrowClass(): string {
63
+ if (this.hasTopRightSlot && !this.isVertical) {
64
+ return 'arrow-button--right'
65
+ }
66
+ return 'arrow-button'
61
67
  }
62
68
  },
63
69
  methods: {
@@ -81,24 +87,23 @@ export default defineComponent({
81
87
  align-items: center;
82
88
  }
83
89
 
84
- .tabs {
85
- flex-grow: 1;
86
- }
87
-
88
- ::v-deep .dl-button {
89
- padding: 0px;
90
-
91
- &:disabled {
92
- pointer-events: none;
90
+ .arrow-button {
91
+ &--right {
92
+ border-bottom: 1px solid var(--dl-color-separator);
93
+ height: calc(100% - 1px);
94
+ display: flex;
93
95
  }
94
96
  }
95
97
 
96
- ::v-deep .dl-button-content {
97
- padding-top: 1px;
98
- min-height: var(--dl-tabs-arrows-size);
99
- width: var(--dl-tabs-arrows-size);
100
- display: flex;
101
- align-items: center;
102
- justify-content: center;
98
+ .tabs {
99
+ flex-grow: 1;
100
+ ::v-deep .dl-button-content {
101
+ padding-top: 1px;
102
+ min-height: var(--dl-tabs-arrows-size);
103
+ width: var(--dl-tabs-arrows-size);
104
+ display: flex;
105
+ align-items: center;
106
+ justify-content: center;
107
+ }
103
108
  }
104
109
  </style>