@dataloop-ai/components 0.17.134 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/package.json +3 -1
  2. package/src/App.vue +5 -227
  3. package/src/assets/globals.scss +4 -0
  4. package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
  5. package/src/components/basic/DlButton/DlButton.vue +2 -6
  6. package/src/components/basic/DlChip/DlChip.vue +1 -5
  7. package/src/components/basic/DlEmptyState/DlEmptyState.vue +282 -0
  8. package/src/components/basic/DlEmptyState/index.ts +2 -0
  9. package/src/components/basic/DlEmptyState/types.ts +20 -0
  10. package/src/components/basic/DlListItem/DlListItem.vue +96 -63
  11. package/src/components/basic/DlListItem/utils.ts +0 -3
  12. package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +35 -12
  13. package/src/components/basic/DlPopup/DlPopup.vue +29 -7
  14. package/src/components/basic/DlWidget/DlWidget.vue +32 -4
  15. package/src/components/basic/index.ts +2 -1
  16. package/src/components/basic/types.ts +2 -0
  17. package/src/components/compound/DlCard/DlCard.vue +796 -0
  18. package/src/components/compound/DlCard/components/DescriptionModal.vue +137 -0
  19. package/src/components/compound/DlCard/types.ts +38 -0
  20. package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +35 -3
  21. package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +51 -12
  22. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +71 -14
  23. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +28 -4
  24. package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +1 -1
  25. package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +46 -8
  26. package/src/components/compound/DlCharts/components/DlBrush.vue +2 -2
  27. package/src/components/compound/DlCharts/types/props.ts +5 -1
  28. package/src/components/compound/DlCharts/utils.ts +1 -1
  29. package/src/components/compound/DlCodeEditor/DlCodeEditor.vue +171 -0
  30. package/src/components/compound/DlCodeEditor/README.md +11 -0
  31. package/src/components/compound/DlCodeEditor/components/CodeEditor.vue +705 -0
  32. package/src/components/compound/DlCodeEditor/index.ts +3 -0
  33. package/src/components/compound/DlCodeEditor/styles/themes-base16.css +12809 -0
  34. package/src/components/compound/DlCodeEditor/styles/themes.css +3999 -0
  35. package/src/components/compound/DlCodeEditor/types.ts +21 -0
  36. package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
  37. package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +8 -8
  38. package/src/components/compound/DlDialogBox/DlDialogBox.vue +26 -2
  39. package/src/components/compound/DlInput/DlInput.vue +2 -2
  40. package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
  41. package/src/components/compound/DlRange/DlRange.vue +2 -2
  42. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +1 -1
  43. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +1 -1
  44. package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
  45. package/src/components/compound/DlSelect/DlSelect.vue +78 -70
  46. package/src/components/compound/DlSlider/components/DlSliderBase.vue +2 -2
  47. package/src/components/compound/DlSlider/useSlider.ts +2 -2
  48. package/src/components/compound/DlStepper/DlStepper.vue +33 -3
  49. package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
  50. package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +12 -6
  51. package/src/components/compound/DlTable/DlTable.vue +30 -4
  52. package/src/components/compound/DlTable/components/DlTd.vue +8 -8
  53. package/src/components/compound/DlTable/components/DlTh.vue +1 -1
  54. package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +35 -40
  55. package/src/components/compound/DlTable/hooks/tableFilter.ts +33 -21
  56. package/src/components/compound/DlTable/hooks/tablePagination.ts +10 -13
  57. package/src/components/compound/DlTable/hooks/tableRowExpand.ts +2 -1
  58. package/src/components/compound/DlTable/hooks/tableRowSelection.ts +0 -1
  59. package/src/components/compound/DlTable/hooks/tableSort.ts +52 -47
  60. package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +268 -0
  61. package/src/components/compound/DlThumbnailGallery/index.ts +2 -0
  62. package/src/components/compound/DlThumbnailGallery/types.ts +11 -0
  63. package/src/components/compound/DlTreeTable/DlTreeTable.vue +1293 -0
  64. package/src/components/compound/DlTreeTable/components/DlTdTree.vue +119 -0
  65. package/src/components/compound/DlTreeTable/components/DlTrTree.vue +52 -0
  66. package/src/components/compound/DlTreeTable/index.ts +3 -0
  67. package/src/components/compound/DlTreeTable/types.ts +1 -0
  68. package/src/components/compound/DlTreeTable/utils/convertToNestedObject.ts +51 -0
  69. package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +19 -0
  70. package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +39 -0
  71. package/src/components/compound/DlTreeTable/utils/trSpacing.ts +13 -0
  72. package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +184 -0
  73. package/src/components/compound/index.ts +5 -0
  74. package/src/components/compound/types.ts +2 -0
  75. package/src/components/essential/DlBadge/DlBadge.vue +3 -3
  76. package/src/components/essential/DlCheckbox/DlCheckbox.vue +6 -3
  77. package/src/components/essential/DlEllipsis/DlEllipsis.vue +18 -14
  78. package/src/components/essential/DlIcon/DlIcon.vue +1 -1
  79. package/src/components/essential/DlLabel/DlLabel.vue +174 -0
  80. package/src/components/essential/DlLabel/index.ts +2 -0
  81. package/src/components/essential/DlList/DlList.vue +2 -2
  82. package/src/components/essential/DlMenu/DlMenu.vue +26 -20
  83. package/src/components/essential/DlMenu/utils.ts +7 -6
  84. package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
  85. package/src/components/essential/DlPageLayout/index.ts +2 -0
  86. package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
  87. package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
  88. package/src/components/essential/index.ts +2 -1
  89. package/src/components/shared/DlTooltip/DlTooltip.vue +9 -10
  90. package/src/demos/BarChartDemo.vue +47 -2
  91. package/src/demos/ColumnChartDemo.vue +51 -2
  92. package/src/demos/DlAccordionDemo.vue +92 -43
  93. package/src/demos/DlCardDemo.vue +156 -19
  94. package/src/demos/DlChartDoughnutDemo.vue +49 -2
  95. package/src/demos/DlCheckboxDemo.vue +13 -0
  96. package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
  97. package/src/demos/DlCodeEditor/index.ts +2 -0
  98. package/src/demos/DlConfusionMatrixDemo.vue +51 -6
  99. package/src/demos/DlDemoPage.vue +235 -0
  100. package/src/demos/DlDialogBoxDemo.vue +56 -51
  101. package/src/demos/DlDropdownButtonDemo.vue +1 -1
  102. package/src/demos/DlEmptyStateDemo.vue +81 -0
  103. package/src/demos/DlLabelDemo.vue +128 -0
  104. package/src/demos/DlLineChartDemo.vue +50 -2
  105. package/src/demos/DlListDemo.vue +12 -9
  106. package/src/demos/DlMenuDemo.vue +13 -14
  107. package/src/demos/DlPageLayoutDemo.vue +146 -0
  108. package/src/demos/DlPanelContainerDemo.vue +113 -2
  109. package/src/demos/DlPopupDemo.vue +51 -0
  110. package/src/demos/DlSelectDemo.vue +14 -5
  111. package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
  112. package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
  113. package/src/demos/DlTableDemo.vue +65 -2
  114. package/src/demos/DlTabsDemo.vue +1 -1
  115. package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
  116. package/src/demos/DlTreeTableDemo.vue +694 -0
  117. package/src/demos/DlWidgetDemo.vue +48 -3
  118. package/src/demos/index.ts +17 -4
  119. package/src/hooks/use-anchor.ts +14 -16
  120. package/src/hooks/use-model-toggle.ts +12 -14
  121. package/src/hooks/use-portal.ts +2 -2
  122. package/src/hooks/use-scroll-target.ts +2 -4
  123. package/src/hooks/use-size-observer.ts +3 -2
  124. package/src/hooks/use-transition.ts +10 -4
  125. package/src/index.ts +22 -1
  126. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetFooter.vue +78 -0
  127. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetHeader.vue +22 -0
  128. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetLeftDrawer.vue +96 -0
  129. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetMainContent.vue +51 -0
  130. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetRightDrawer.vue +88 -0
  131. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/ActionsMenu.vue +70 -0
  132. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/AutomationMenu.vue +106 -0
  133. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardView.vue +101 -0
  134. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewGallery.vue +141 -0
  135. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewTable.vue +193 -0
  136. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/LayoutEmptyState.vue +227 -0
  137. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/UploadData.vue +106 -0
  138. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentImages.vue +540 -0
  139. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentNav.vue +329 -0
  140. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarKpi.vue +84 -0
  141. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarSearch.vue +132 -0
  142. package/src/layouts/DlDatasetBrowser/DemoComponents/SearchFilterMenu.vue +19 -0
  143. package/src/layouts/DlDatasetBrowser/DemoComponents/filters/AddFilter.vue +212 -0
  144. package/src/layouts/DlDatasetBrowser/DemoComponents/types/imageMetadata.ts +28 -0
  145. package/src/layouts/DlDatasetBrowser/DlDatasetBrowser.vue +42 -0
  146. package/src/layouts/DlStudioLayout/DlStudioLayout.vue +42 -0
  147. package/src/layouts/DlStudioLayout/components/Demo/LeftMenuContent.vue +23 -0
  148. package/src/layouts/DlStudioLayout/components/Demo/StudioFooter.vue +25 -0
  149. package/src/layouts/DlStudioLayout/components/Demo/StudioHeader.vue +121 -0
  150. package/src/layouts/DlStudioLayout/components/Demo/StudioLeftDrawer.vue +245 -0
  151. package/src/layouts/DlStudioLayout/components/Demo/StudioMainContent.vue +31 -0
  152. package/src/layouts/DlStudioLayout/components/Demo/StudioTabsMenu.vue +117 -0
  153. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/FilterMenu.vue +62 -0
  154. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuAnnotations.vue +98 -0
  155. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuItem.vue +66 -0
  156. package/src/layouts/DlStudioLayout/components/LayoutNavbar.vue +24 -0
  157. package/src/layouts/DlStudioLayout/components/ListAutocomplete.vue +149 -0
  158. package/src/layouts/DlStudioLayout/components/NavigationDrawer.vue +147 -0
  159. package/src/layouts/DlStudioLayout/index.ts +2 -0
  160. package/src/layouts/DlStudioLayout/types/HorizontalItems.ts +9 -0
  161. package/src/layouts/DlStudioLayout/types/VerticalItems.ts +10 -0
  162. package/src/simple-code-editor.d.ts +1 -0
  163. package/src/utils/click-outside.ts +1 -1
  164. package/src/utils/dom.ts +5 -5
  165. package/src/utils/events.ts +3 -3
  166. package/src/utils/global-nodes.ts +2 -2
  167. package/src/utils/is-ellipsis-active.ts +4 -1
  168. package/src/utils/portal.ts +5 -5
  169. package/src/utils/position-engine.ts +5 -5
  170. package/src/utils/render.ts +1 -1
  171. package/src/utils/scroll.ts +2 -2
  172. package/src/utils/selection.ts +3 -3
  173. package/vite.config.ts +9 -1
  174. package/src/components/basic/DlCard/DlCard.vue +0 -242
  175. package/src/components/basic/DlCard/types.ts +0 -20
  176. package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -93
  177. package/src/components/essential/DlTextHolder/index.ts +0 -2
  178. package/src/demos/DlTextHolderDemo.vue +0 -50
  179. /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
  180. /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
@@ -0,0 +1,21 @@
1
+ export enum DlCodeEditorTheme {
2
+ Dark = 'atom-one-dark',
3
+ Light = 'atom-one-light',
4
+ ATOM_ONE_DARK = 'atom-one-dark',
5
+ ATOM_ONE_LIGHT = 'atom-one-light',
6
+ DRACULA = 'dracula',
7
+ GITHUB = 'github',
8
+ GITHUB_DARK = 'github-dark',
9
+ VS = 'vs',
10
+ VS_DARK = 'vs2015'
11
+ }
12
+
13
+ export interface DlCodeEditorOptions {
14
+ fontSize?: number
15
+ tabSpaces?: number
16
+ textWrapping?: boolean
17
+ hideHeader?: boolean
18
+ hideCopyButton?: boolean
19
+ lineNumbers?: boolean
20
+ hideLanguage?: boolean
21
+ }
@@ -1,21 +1,20 @@
1
1
  <template>
2
- <div class="dl-card-sidebar">
3
- <div class="dl-card-sidebar--header">
2
+ <div class="card-sidebar">
3
+ <div class="card-sidebar--header">
4
4
  <span>Select by</span>
5
5
  </div>
6
- <div class="dl-card-sidebar--content">
6
+ <div class="card-sidebar--content">
7
7
  <div
8
8
  v-for="option in options"
9
9
  :key="option.key"
10
- class="dl-card-sidebar--item"
10
+ class="card-sidebar--item"
11
11
  :class="{
12
- 'dl-card-sidebar--item-active':
13
- option.key === currentOption,
14
- 'dl-card-sidebar--item-disabled': option.disabled
12
+ 'card-sidebar--item-active': option.key === currentOption,
13
+ 'card-sidebar--item-disabled': option.disabled
15
14
  }"
16
15
  @click="handleClick(option)"
17
16
  >
18
- <div class="dl-card-sidebar--focus_helper" />
17
+ <div class="card-sidebar--focus_helper" />
19
18
  {{ capitalizeFirstLetter(option.title) }}
20
19
  </div>
21
20
  </div>
@@ -49,7 +48,7 @@ export default defineComponent({
49
48
  })
50
49
  </script>
51
50
  <style lang="scss" scoped>
52
- .dl-card-sidebar {
51
+ .card-sidebar {
53
52
  display: flex;
54
53
  flex-direction: column;
55
54
  text-align: left;
@@ -101,8 +100,8 @@ export default defineComponent({
101
100
  }
102
101
  }
103
102
 
104
- .dl-card-sidebar--item:not(.dl-card-sidebar--item-disabled):hover {
105
- .dl-card-sidebar--focus_helper {
103
+ .card-sidebar--item:not(.card-sidebar--item-disabled):hover {
104
+ .card-sidebar--focus_helper {
106
105
  opacity: 0.15;
107
106
  }
108
107
  }
@@ -3,7 +3,7 @@
3
3
  :id="uuid"
4
4
  class="dl-date-time-range"
5
5
  >
6
- <dl-date-input
6
+ <date-input
7
7
  :text="dateInputText"
8
8
  :input-style="dateInputStyle"
9
9
  :disabled="disabled"
@@ -20,13 +20,13 @@
20
20
  v-if="mode === 'multi'"
21
21
  class="dl-date-time-range--card_sidebar"
22
22
  >
23
- <dl-card-sidebar
23
+ <card-sidebar
24
24
  v-if="typeState === 'day'"
25
25
  :options="sidebarDayOptions"
26
26
  :current-option="currentSidebarOption"
27
27
  @click="handleDayTypeOptionClick"
28
28
  />
29
- <dl-card-sidebar
29
+ <card-sidebar
30
30
  v-else
31
31
  :options="sidebarMonthOptions"
32
32
  :current-option="currentSidebarOption"
@@ -54,13 +54,13 @@
54
54
  </div>
55
55
  </div>
56
56
  </dl-menu>
57
- </dl-date-input>
57
+ </date-input>
58
58
  </div>
59
59
  </template>
60
60
  <script lang="ts">
61
61
  import { DlTimePicker } from '../DlTimePicker'
62
62
  import { DateInterval } from '../types'
63
- import DlCardSidebar from './DlCardSidebar.vue'
63
+ import CardSidebar from './CardSidebar.vue'
64
64
  import {
65
65
  DayTypeOption,
66
66
  DAY_SIDEBAR_OPTION,
@@ -70,7 +70,7 @@ import {
70
70
  import { CustomDate } from '../DlDatePicker/models/CustomDate'
71
71
  import DlDatePicker from '../DlDatePicker/DlDatePicker.vue'
72
72
  import { CalendarDate } from '../DlDatePicker/models/CalendarDate'
73
- import DlDateInput from './DlDateInput.vue'
73
+ import DateInput from './DateInput.vue'
74
74
  import { DlMenu } from '../../../essential'
75
75
  import { defineComponent, PropType } from 'vue-demi'
76
76
  import { isInRange } from '../DlDatePicker/utils'
@@ -78,10 +78,10 @@ import { v4 } from 'uuid'
78
78
 
79
79
  export default defineComponent({
80
80
  components: {
81
- DlCardSidebar,
81
+ CardSidebar,
82
82
  DlDatePicker,
83
83
  DlTimePicker,
84
- DlDateInput,
84
+ DateInput,
85
85
  DlMenu
86
86
  },
87
87
  model: {
@@ -49,7 +49,24 @@
49
49
  'content--fullheight': fullHeight
50
50
  }"
51
51
  >
52
- <slot name="body" />
52
+ <slot
53
+ v-if="!isEmpty"
54
+ name="body"
55
+ />
56
+ <dl-empty-state
57
+ v-if="isEmpty"
58
+ v-bind="emptyStateProps"
59
+ >
60
+ <template
61
+ v-for="(_, slot) in $slots"
62
+ #[slot]="props"
63
+ >
64
+ <slot
65
+ :name="slot"
66
+ v-bind="props"
67
+ />
68
+ </template>
69
+ </dl-empty-state>
53
70
  </div>
54
71
  <div
55
72
  v-if="hasFooter"
@@ -66,11 +83,13 @@
66
83
  import { v4 } from 'uuid'
67
84
  import { defineComponent, PropType } from 'vue-demi'
68
85
  import DlIcon from '../../essential/DlIcon/DlIcon.vue'
86
+ import { DlEmptyStateProps } from '../../basic/DlEmptyState/types'
87
+ import DlEmptyState from '../../basic/DlEmptyState/DlEmptyState.vue'
69
88
  import { throttle } from 'lodash'
70
89
 
71
90
  export default defineComponent({
72
91
  name: 'DlDialogBox',
73
- components: { DlIcon },
92
+ components: { DlIcon, DlEmptyState },
74
93
  model: {
75
94
  prop: 'modelValue',
76
95
  event: 'update:modelValue'
@@ -91,6 +110,11 @@ export default defineComponent({
91
110
  type: Boolean,
92
111
  default: false
93
112
  },
113
+ isEmpty: Boolean,
114
+ emptyStateProps: {
115
+ type: Object as PropType<DlEmptyStateProps>,
116
+ default: () => ({} as DlEmptyStateProps)
117
+ },
94
118
  zIndex: {
95
119
  type: [Number, String],
96
120
  default: 'var(--dl-z-index-dialog)'
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div
3
3
  :id="uuid"
4
- :class="rootContainerClasses"
5
4
  :style="cssVars"
5
+ :class="rootContainerClasses"
6
6
  >
7
7
  <div :class="wrapperClasses">
8
8
  <div
@@ -143,7 +143,7 @@
143
143
  :key="item"
144
144
  clickable
145
145
  style="font-size: 12px"
146
- :is-highlighted="suggestIndex === highlightedIndex"
146
+ :highlighted="suggestIndex === highlightedIndex"
147
147
  @click="onClick($event, item)"
148
148
  >
149
149
  <span
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <dl-list-item
3
- as="label"
3
+ type="label"
4
4
  clickable
5
5
  @click="emitClick"
6
6
  >
@@ -37,7 +37,7 @@ export default defineComponent({
37
37
  .menu-item-wrapper-section {
38
38
  display: flex;
39
39
  flex-direction: row-reverse;
40
- justify-content: flex-start;
40
+ justify-content: flex-end;
41
41
  align-items: center;
42
42
  }
43
43
 
@@ -250,7 +250,7 @@ export default defineComponent({
250
250
  props.disabled !== true
251
251
  ? getColor(props.color, 'dl-color-secondary')
252
252
  : 'var(--dl-color-separator)',
253
- zIndex: state.focus.value === 'min' ? 2 : void 0
253
+ zIndex: state.focus.value === 'min' ? 2 : null
254
254
  }))
255
255
 
256
256
  const maxThumbStyle = computed(() => ({
@@ -261,7 +261,7 @@ export default defineComponent({
261
261
  props.disabled !== true
262
262
  ? getColor(props.color, 'dl-color-secondary')
263
263
  : 'var(--dl-color-separator)',
264
- zIndex: state.focus.value === 'max' ? 2 : void 0
264
+ zIndex: state.focus.value === 'max' ? 2 : null
265
265
  }))
266
266
 
267
267
  const minThumbRef = ref(null)
@@ -168,7 +168,7 @@ export default defineComponent({
168
168
  },
169
169
  styleModel: {
170
170
  type: Object as PropType<SyntaxColorSchema>,
171
- default: () => {}
171
+ default: null
172
172
  },
173
173
  placeholder: {
174
174
  type: String,
@@ -22,7 +22,7 @@
22
22
  v-for="(item, suggestionIndex) in suggestions"
23
23
  :key="item"
24
24
  :clickable="true"
25
- :is-highlighted="suggestionIndex === highlightedIndex"
25
+ :highlighted="suggestionIndex === highlightedIndex"
26
26
  @click="handleOption(item)"
27
27
  >
28
28
  {{ item }}
@@ -94,12 +94,16 @@ function restoreSelection(
94
94
  function renderText(text: string) {
95
95
  const words = text?.split(/(\s+)/)
96
96
  const output = words?.map((word) => {
97
- if (styleModel.keywords.values.includes(word)) {
98
- return `<strong style='${SPAN_STYLES}; color:${styleModel.keywords.color}'>${word}</strong>`
99
- } else if (styleModel.fields.values.includes(word)) {
100
- return `<span style='color:${styleModel.fields.color}; ${SPAN_STYLES}'>${word}</span>`
101
- } else if (styleModel.operators.values.includes(word)) {
102
- return `<span style='color:${styleModel.operators.color}; ${SPAN_STYLES}'>${word}</span>`
97
+ if (styleModel) {
98
+ if (styleModel.keywords.values.includes(word)) {
99
+ return `<strong style='${SPAN_STYLES}; color:${styleModel.keywords.color}'>${word}</strong>`
100
+ } else if (styleModel.fields.values.includes(word)) {
101
+ return `<span style='color:${styleModel.fields.color}; ${SPAN_STYLES}'>${word}</span>`
102
+ } else if (styleModel.operators.values.includes(word)) {
103
+ return `<span style='color:${styleModel.operators.color}; ${SPAN_STYLES}'>${word}</span>`
104
+ } else {
105
+ return `<span style='${SPAN_STYLES}'>${word}</span>`
106
+ }
103
107
  } else {
104
108
  return `<span style='${SPAN_STYLES}'>${word}</span>`
105
109
  }
@@ -59,25 +59,23 @@
59
59
  :class="selectClasses"
60
60
  >
61
61
  <div
62
- v-show="hasPrepend || search"
62
+ v-show="hasPrepend || searchable"
63
63
  :class="[
64
64
  ...adornmentClasses,
65
65
  'adornment-container--pos-left'
66
66
  ]"
67
67
  >
68
- <dl-icon
69
- v-if="search"
70
- icon="icon-dl-search"
71
- :size="iconSize"
72
- color="dl-color-lighter"
73
- />
74
- <slot
75
- v-else
76
- name="prepend"
77
- />
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>
78
76
  </div>
79
77
  <input
80
- v-if="search"
78
+ v-if="searchable"
81
79
  ref="searchInput"
82
80
  class="select-search-input"
83
81
  :style="!isExpanded ? 'display: none;' : 'width: 100%;'"
@@ -87,7 +85,7 @@
87
85
  @focus="handleSearchFocus"
88
86
  @blur="handleSearchBlur"
89
87
  >
90
- <dl-tooltip v-if="disabled">
88
+ <dl-tooltip v-if="disabled && disabledTooltip">
91
89
  {{ disabledTooltip }}
92
90
  </dl-tooltip>
93
91
  <div
@@ -95,7 +93,7 @@
95
93
  style="width: 100%"
96
94
  >
97
95
  <slot
98
- v-if="search ? !isExpanded : true"
96
+ v-if="searchable ? !isExpanded : true"
99
97
  :opt="selectedOption"
100
98
  name="selected"
101
99
  />
@@ -103,8 +101,8 @@
103
101
  <template v-if="!hasSelectedSlot">
104
102
  <span
105
103
  v-show="
106
- (multiselect && !search) ||
107
- (multiselect && search && !isExpanded)
104
+ (multiselect && !searchable) ||
105
+ (multiselect && searchable && !isExpanded)
108
106
  "
109
107
  class="root-container--placeholder"
110
108
  >
@@ -117,8 +115,8 @@
117
115
  </span>
118
116
  <span
119
117
  v-show="
120
- (!multiselect && !search) ||
121
- (!multiselect && search && !isExpanded)
118
+ (!multiselect && !searchable) ||
119
+ (!multiselect && searchable && !isExpanded)
122
120
  "
123
121
  class="selected-label"
124
122
  >
@@ -190,20 +188,16 @@
190
188
  @update:model-value="selectAll"
191
189
  @depth-change="handleDepthChange"
192
190
  >
193
- <slot
194
- v-if="hasAllItemsSlot"
195
- name="all-items"
196
- />
197
- <template v-else>
191
+ <slot name="all-items">
198
192
  {{ computedAllItemsLabel }}
199
- </template>
193
+ </slot>
200
194
  </dl-select-option>
201
195
 
202
196
  <!-- Virtual scroll -->
203
197
  <dl-virtual-scroll
204
198
  v-if="optionsCount > MAX_ITEMS_PER_LIST"
205
199
  v-slot="{ item, index }"
206
- :items="options"
200
+ :items="filteredOptions"
207
201
  :virtual-scroll-item-size="28"
208
202
  :virtual-scroll-sticky-size-start="28"
209
203
  :virtual-scroll-sticky-size-end="20"
@@ -235,11 +229,9 @@
235
229
  @deselected="handleDeselected"
236
230
  >
237
231
  <slot
238
- v-if="hasOptionSlot"
239
- :opt="item"
240
232
  name="option"
241
- />
242
- <template v-else>
233
+ :opt="item"
234
+ >
243
235
  {{
244
236
  capitalizedOptions
245
237
  ? typeof getOptionLabel(item) ===
@@ -247,13 +239,13 @@
247
239
  getOptionLabel(item).toLowerCase()
248
240
  : getOptionLabel(item)
249
241
  }}
250
- </template>
242
+ </slot>
251
243
  </dl-select-option>
252
244
  </dl-virtual-scroll>
253
245
  <!-- Else normal list -->
254
246
  <div v-else>
255
247
  <dl-select-option
256
- v-for="(option, optionIndex) in options"
248
+ v-for="(option, optionIndex) in filteredOptions"
257
249
  :key="getKeyForOption(option)"
258
250
  clickable
259
251
  :multiselect="multiselect"
@@ -328,7 +320,7 @@ import {
328
320
  DlItemSection,
329
321
  DlVirtualScroll
330
322
  } from '../../shared'
331
- import { defineComponent, isVue2, PropType, ref } from 'vue-demi'
323
+ import { defineComponent, PropType, ref } from 'vue-demi'
332
324
  import {
333
325
  getLabel,
334
326
  getIconSize,
@@ -372,7 +364,8 @@ export default defineComponent({
372
364
  width: { type: String, default: '100%' },
373
365
  withoutBorders: { type: Boolean, default: false },
374
366
  title: { type: String, default: '' },
375
- search: { type: Boolean, default: false },
367
+ searchable: { type: Boolean, default: false },
368
+ customFilter: { type: Boolean, default: false },
376
369
  required: { type: Boolean, default: false },
377
370
  optional: { type: Boolean, default: false },
378
371
  fitContent: Boolean,
@@ -420,6 +413,7 @@ export default defineComponent({
420
413
  const selectedIndex = ref(-1)
421
414
  const highlightedIndex = ref(-1)
422
415
  const isEmpty = ref(true)
416
+ const searchTerm = ref('')
423
417
  const searchInputValue = ref('')
424
418
  const MAX_ITEMS_PER_LIST = 100 // HARDCODED - max items per list before virtual scroll
425
419
 
@@ -450,10 +444,26 @@ export default defineComponent({
450
444
  setHighlightedIndex,
451
445
  handleSelectedItem,
452
446
  handleModelValueUpdate,
447
+ searchTerm, // todo: merge this sometime
453
448
  searchInputValue
454
449
  }
455
450
  },
456
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
+ },
457
467
  optionsCount(): number {
458
468
  return this.options?.length ?? 0
459
469
  },
@@ -521,24 +531,12 @@ export default defineComponent({
521
531
  return getIconSize(this.size)
522
532
  },
523
533
  hasOptionSlot(): boolean {
524
- if (isVue2) {
525
- // @ts-ignore
526
- return !!this.$scopedSlots.option
527
- }
528
534
  return !!this.$slots.option
529
535
  },
530
536
  hasAllItemsSlot(): boolean {
531
- if (isVue2) {
532
- // @ts-ignore
533
- return !!this.$scopedSlots['all-items']
534
- }
535
537
  return !!this.$slots['all-items']
536
538
  },
537
539
  hasSelectedSlot(): boolean {
538
- if (isVue2) {
539
- // @ts-ignore
540
- return !!this.$scopedSlots.selected
541
- }
542
540
  return !!this.$slots.selected
543
541
  },
544
542
  computedPlaceholder(): string {
@@ -562,22 +560,18 @@ export default defineComponent({
562
560
  : this.options[this.selectedIndex]
563
561
  },
564
562
  hasBeforeOptions(): boolean {
565
- if (isVue2) {
566
- // @ts-ignore
567
- return !!this.$scopedSlots['before-options']
568
- }
569
563
  return !!this.$slots['before-options']
570
564
  },
571
565
  hasAfterOptions(): boolean {
572
- if (isVue2) {
573
- // @ts-ignore
574
- return !!this.$scopedSlots['after-options']
575
- }
576
566
  return !!this.$slots['after-options']
577
567
  },
578
568
  noOptions(): boolean {
579
569
  if (Array.isArray(this.options)) {
580
- return this.options.length === 0
570
+ if (this.customFilter) {
571
+ return this.options.length === 0
572
+ }
573
+
574
+ return this.filteredOptions.length === 0
581
575
  }
582
576
  return true
583
577
  },
@@ -599,7 +593,10 @@ export default defineComponent({
599
593
  if (this.withoutBorders) {
600
594
  classes.push('dl_select__select--without-border')
601
595
  }
602
- 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) {
603
600
  classes.push('dl_select__select--prepend')
604
601
  classes.push('dl_select__select--both-adornments')
605
602
  }
@@ -646,10 +643,6 @@ export default defineComponent({
646
643
  )
647
644
  },
648
645
  hasPrepend(): boolean {
649
- if (isVue2) {
650
- // @ts-ignore
651
- return !!this.$scopedSlots.prepend && !this.isSmall
652
- }
653
646
  return !!this.$slots.prepend && !this.isSmall
654
647
  },
655
648
  chevronIconColor(): string {
@@ -658,7 +651,7 @@ export default defineComponent({
658
651
  },
659
652
  watch: {
660
653
  isExpanded(newVal: boolean) {
661
- if (this.search) {
654
+ if (this.searchable) {
662
655
  if (newVal) {
663
656
  const inputRef = this.$refs.searchInput as HTMLInputElement
664
657
  this.$nextTick(() => {
@@ -793,7 +786,7 @@ export default defineComponent({
793
786
  ? undefined
794
787
  : this.options[this.selectedIndex]
795
788
 
796
- if (this.search) {
789
+ if (this.searchable) {
797
790
  const searchInput = this.$refs.searchInput as HTMLInputElement
798
791
  searchInput.value =
799
792
  typeof selectedOption === 'string'
@@ -810,11 +803,18 @@ export default defineComponent({
810
803
  this.handleModelValueUpdate(valueToEmit)
811
804
  },
812
805
  handleSearchInput(e: Event): void {
813
- if (this.search) {
814
- this.$emit(
815
- 'filter',
816
- (e.target as HTMLInputElement).value.trim()
817
- )
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
+
818
818
  this.showAllItems =
819
819
  (e.target as HTMLInputElement).value.trim() === ''
820
820
 
@@ -842,7 +842,7 @@ export default defineComponent({
842
842
  return html
843
843
  },
844
844
  handleSearchBlur(e: Event): void {
845
- if (this.search) {
845
+ if (this.searchable) {
846
846
  const inputRef = this.$refs.searchInput as HTMLInputElement
847
847
  this.$nextTick(() => {
848
848
  inputRef?.focus({})
@@ -858,13 +858,14 @@ export default defineComponent({
858
858
  if (!this.preserveSearch) {
859
859
  const inputRef = this.$refs.searchInput as HTMLInputElement
860
860
  if (inputRef) inputRef.value = ''
861
+ this.searchTerm = ''
861
862
  this.$emit('filter', '')
862
863
  }
863
864
  },
864
865
  getLabel,
865
866
  onMenuOpen(): void {
866
867
  this.$emit('before-show')
867
- if (this.search) {
868
+ if (this.searchable) {
868
869
  const inputRef = this.$refs.searchInput as HTMLInputElement
869
870
  this.$nextTick(() => {
870
871
  inputRef?.focus({})
@@ -900,7 +901,7 @@ export default defineComponent({
900
901
  align-items: center;
901
902
  }
902
903
  &--placeholder {
903
- color: var(--placeholder-color);
904
+ color: var(--dl-select-palceholder-color, --placeholder-color);
904
905
  }
905
906
 
906
907
  .dl-select__title-container {
@@ -916,7 +917,7 @@ export default defineComponent({
916
917
  }
917
918
 
918
919
  .selected-label {
919
- color: var(--placeholder-color);
920
+ color: var(--dl-select-palceholder-color, --placeholder-color);
920
921
  }
921
922
 
922
923
  .dl-select__title {
@@ -1030,6 +1031,13 @@ export default defineComponent({
1030
1031
  height: 100%;
1031
1032
  }
1032
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
+ }
1033
1041
  }
1034
1042
 
1035
1043
  &::placeholder {
@@ -350,12 +350,12 @@ export default defineComponent({
350
350
  },
351
351
  onPan(event: any): void {
352
352
  if (event.isFinal === true) {
353
- if (this.dragging !== void 0) {
353
+ if (this.dragging) {
354
354
  this.updatePosition(event.evt)
355
355
  if (event.touch === true) {
356
356
  this.updateValue(true)
357
357
  }
358
- this.dragging = void 0
358
+ this.dragging = null
359
359
  this.$emit('pan', 'end')
360
360
  }
361
361
  this.active = false
@@ -215,13 +215,13 @@ export default function ({
215
215
 
216
216
  function onPan(event: any) {
217
217
  if (event.isFinal === true) {
218
- if (dragging.value !== void 0) {
218
+ if (dragging.value) {
219
219
  updatePosition(event.evt)
220
220
  // only if touch, because we also have mousedown/up:
221
221
  if (event.touch === true) {
222
222
  updateValue(true)
223
223
  }
224
- dragging.value = void 0
224
+ dragging.value = null
225
225
  emit('pan', 'end')
226
226
  }
227
227
  active.value = false