@dataloop-ai/components 0.17.134 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/src/App.vue +5 -227
- package/src/assets/globals.scss +4 -0
- package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
- package/src/components/basic/DlButton/DlButton.vue +2 -6
- package/src/components/basic/DlChip/DlChip.vue +1 -5
- package/src/components/basic/DlEmptyState/DlEmptyState.vue +282 -0
- package/src/components/basic/DlEmptyState/index.ts +2 -0
- package/src/components/basic/DlEmptyState/types.ts +20 -0
- package/src/components/basic/DlListItem/DlListItem.vue +96 -63
- package/src/components/basic/DlListItem/utils.ts +0 -3
- package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +35 -12
- package/src/components/basic/DlPopup/DlPopup.vue +29 -7
- package/src/components/basic/DlWidget/DlWidget.vue +32 -4
- package/src/components/basic/index.ts +2 -1
- package/src/components/basic/types.ts +2 -0
- package/src/components/compound/DlCard/DlCard.vue +796 -0
- package/src/components/compound/DlCard/components/DescriptionModal.vue +137 -0
- package/src/components/compound/DlCard/types.ts +38 -0
- package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +35 -3
- package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +51 -12
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +71 -14
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +28 -4
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +1 -1
- package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +46 -8
- package/src/components/compound/DlCharts/components/DlBrush.vue +2 -2
- package/src/components/compound/DlCharts/types/props.ts +5 -1
- package/src/components/compound/DlCharts/utils.ts +1 -1
- package/src/components/compound/DlCodeEditor/DlCodeEditor.vue +171 -0
- package/src/components/compound/DlCodeEditor/README.md +11 -0
- package/src/components/compound/DlCodeEditor/components/CodeEditor.vue +705 -0
- package/src/components/compound/DlCodeEditor/index.ts +3 -0
- package/src/components/compound/DlCodeEditor/styles/themes-base16.css +12809 -0
- package/src/components/compound/DlCodeEditor/styles/themes.css +3999 -0
- package/src/components/compound/DlCodeEditor/types.ts +21 -0
- package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
- package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +8 -8
- package/src/components/compound/DlDialogBox/DlDialogBox.vue +26 -2
- package/src/components/compound/DlInput/DlInput.vue +2 -2
- package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
- package/src/components/compound/DlRange/DlRange.vue +2 -2
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +1 -1
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +1 -1
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
- package/src/components/compound/DlSelect/DlSelect.vue +78 -70
- package/src/components/compound/DlSlider/components/DlSliderBase.vue +2 -2
- package/src/components/compound/DlSlider/useSlider.ts +2 -2
- package/src/components/compound/DlStepper/DlStepper.vue +33 -3
- package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
- package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +12 -6
- package/src/components/compound/DlTable/DlTable.vue +30 -4
- package/src/components/compound/DlTable/components/DlTd.vue +8 -8
- package/src/components/compound/DlTable/components/DlTh.vue +1 -1
- package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +35 -40
- package/src/components/compound/DlTable/hooks/tableFilter.ts +33 -21
- package/src/components/compound/DlTable/hooks/tablePagination.ts +10 -13
- package/src/components/compound/DlTable/hooks/tableRowExpand.ts +2 -1
- package/src/components/compound/DlTable/hooks/tableRowSelection.ts +0 -1
- package/src/components/compound/DlTable/hooks/tableSort.ts +52 -47
- package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +268 -0
- package/src/components/compound/DlThumbnailGallery/index.ts +2 -0
- package/src/components/compound/DlThumbnailGallery/types.ts +11 -0
- package/src/components/compound/DlTreeTable/DlTreeTable.vue +1293 -0
- package/src/components/compound/DlTreeTable/components/DlTdTree.vue +119 -0
- package/src/components/compound/DlTreeTable/components/DlTrTree.vue +52 -0
- package/src/components/compound/DlTreeTable/index.ts +3 -0
- package/src/components/compound/DlTreeTable/types.ts +1 -0
- package/src/components/compound/DlTreeTable/utils/convertToNestedObject.ts +51 -0
- package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +19 -0
- package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +39 -0
- package/src/components/compound/DlTreeTable/utils/trSpacing.ts +13 -0
- package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +184 -0
- package/src/components/compound/index.ts +5 -0
- package/src/components/compound/types.ts +2 -0
- package/src/components/essential/DlBadge/DlBadge.vue +3 -3
- package/src/components/essential/DlCheckbox/DlCheckbox.vue +6 -3
- package/src/components/essential/DlEllipsis/DlEllipsis.vue +18 -14
- package/src/components/essential/DlIcon/DlIcon.vue +1 -1
- package/src/components/essential/DlLabel/DlLabel.vue +174 -0
- package/src/components/essential/DlLabel/index.ts +2 -0
- package/src/components/essential/DlList/DlList.vue +2 -2
- package/src/components/essential/DlMenu/DlMenu.vue +26 -20
- package/src/components/essential/DlMenu/utils.ts +7 -6
- package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
- package/src/components/essential/DlPageLayout/index.ts +2 -0
- package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
- package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
- package/src/components/essential/index.ts +2 -1
- package/src/components/shared/DlTooltip/DlTooltip.vue +9 -10
- package/src/demos/BarChartDemo.vue +47 -2
- package/src/demos/ColumnChartDemo.vue +51 -2
- package/src/demos/DlAccordionDemo.vue +92 -43
- package/src/demos/DlCardDemo.vue +156 -19
- package/src/demos/DlChartDoughnutDemo.vue +49 -2
- package/src/demos/DlCheckboxDemo.vue +13 -0
- package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
- package/src/demos/DlCodeEditor/index.ts +2 -0
- package/src/demos/DlConfusionMatrixDemo.vue +51 -6
- package/src/demos/DlDemoPage.vue +235 -0
- package/src/demos/DlDialogBoxDemo.vue +56 -51
- package/src/demos/DlDropdownButtonDemo.vue +1 -1
- package/src/demos/DlEmptyStateDemo.vue +81 -0
- package/src/demos/DlLabelDemo.vue +128 -0
- package/src/demos/DlLineChartDemo.vue +50 -2
- package/src/demos/DlListDemo.vue +12 -9
- package/src/demos/DlMenuDemo.vue +13 -14
- package/src/demos/DlPageLayoutDemo.vue +146 -0
- package/src/demos/DlPanelContainerDemo.vue +113 -2
- package/src/demos/DlPopupDemo.vue +51 -0
- package/src/demos/DlSelectDemo.vue +14 -5
- package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
- package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
- package/src/demos/DlTableDemo.vue +65 -2
- package/src/demos/DlTabsDemo.vue +1 -1
- package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
- package/src/demos/DlTreeTableDemo.vue +694 -0
- package/src/demos/DlWidgetDemo.vue +48 -3
- package/src/demos/index.ts +17 -4
- package/src/hooks/use-anchor.ts +14 -16
- package/src/hooks/use-model-toggle.ts +12 -14
- package/src/hooks/use-portal.ts +2 -2
- package/src/hooks/use-scroll-target.ts +2 -4
- package/src/hooks/use-size-observer.ts +3 -2
- package/src/hooks/use-transition.ts +10 -4
- package/src/index.ts +22 -1
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetFooter.vue +78 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetHeader.vue +22 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetLeftDrawer.vue +96 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetMainContent.vue +51 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetRightDrawer.vue +88 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/ActionsMenu.vue +70 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/AutomationMenu.vue +106 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardView.vue +101 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewGallery.vue +141 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewTable.vue +193 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/LayoutEmptyState.vue +227 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/UploadData.vue +106 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentImages.vue +540 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentNav.vue +329 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarKpi.vue +84 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarSearch.vue +132 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/SearchFilterMenu.vue +19 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/filters/AddFilter.vue +212 -0
- package/src/layouts/DlDatasetBrowser/DemoComponents/types/imageMetadata.ts +28 -0
- package/src/layouts/DlDatasetBrowser/DlDatasetBrowser.vue +42 -0
- package/src/layouts/DlStudioLayout/DlStudioLayout.vue +42 -0
- package/src/layouts/DlStudioLayout/components/Demo/LeftMenuContent.vue +23 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioFooter.vue +25 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioHeader.vue +121 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioLeftDrawer.vue +245 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioMainContent.vue +31 -0
- package/src/layouts/DlStudioLayout/components/Demo/StudioTabsMenu.vue +117 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/FilterMenu.vue +62 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuAnnotations.vue +98 -0
- package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuItem.vue +66 -0
- package/src/layouts/DlStudioLayout/components/LayoutNavbar.vue +24 -0
- package/src/layouts/DlStudioLayout/components/ListAutocomplete.vue +149 -0
- package/src/layouts/DlStudioLayout/components/NavigationDrawer.vue +147 -0
- package/src/layouts/DlStudioLayout/index.ts +2 -0
- package/src/layouts/DlStudioLayout/types/HorizontalItems.ts +9 -0
- package/src/layouts/DlStudioLayout/types/VerticalItems.ts +10 -0
- package/src/simple-code-editor.d.ts +1 -0
- package/src/utils/click-outside.ts +1 -1
- package/src/utils/dom.ts +5 -5
- package/src/utils/events.ts +3 -3
- package/src/utils/global-nodes.ts +2 -2
- package/src/utils/is-ellipsis-active.ts +4 -1
- package/src/utils/portal.ts +5 -5
- package/src/utils/position-engine.ts +5 -5
- package/src/utils/render.ts +1 -1
- package/src/utils/scroll.ts +2 -2
- package/src/utils/selection.ts +3 -3
- package/vite.config.ts +9 -1
- package/src/components/basic/DlCard/DlCard.vue +0 -242
- package/src/components/basic/DlCard/types.ts +0 -20
- package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -93
- package/src/components/essential/DlTextHolder/index.ts +0 -2
- package/src/demos/DlTextHolderDemo.vue +0 -50
- /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
- /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
|
@@ -0,0 +1,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
|
+
}
|
package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue}
RENAMED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
<div class="
|
|
2
|
+
<div class="card-sidebar">
|
|
3
|
+
<div class="card-sidebar--header">
|
|
4
4
|
<span>Select by</span>
|
|
5
5
|
</div>
|
|
6
|
-
<div class="
|
|
6
|
+
<div class="card-sidebar--content">
|
|
7
7
|
<div
|
|
8
8
|
v-for="option in options"
|
|
9
9
|
:key="option.key"
|
|
10
|
-
class="
|
|
10
|
+
class="card-sidebar--item"
|
|
11
11
|
:class="{
|
|
12
|
-
'
|
|
13
|
-
|
|
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="
|
|
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
|
-
.
|
|
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
|
-
.
|
|
105
|
-
.
|
|
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
|
-
<
|
|
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
|
-
<
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
|
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
|
|
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
|
-
|
|
81
|
+
CardSidebar,
|
|
82
82
|
DlDatePicker,
|
|
83
83
|
DlTimePicker,
|
|
84
|
-
|
|
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
|
|
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
|
-
:
|
|
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
|
-
|
|
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-
|
|
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 :
|
|
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 :
|
|
264
|
+
zIndex: state.focus.value === 'max' ? 2 : null
|
|
265
265
|
}))
|
|
266
266
|
|
|
267
267
|
const minThumbRef = ref(null)
|
|
@@ -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
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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 ||
|
|
62
|
+
v-show="hasPrepend || searchable"
|
|
63
63
|
:class="[
|
|
64
64
|
...adornmentClasses,
|
|
65
65
|
'adornment-container--pos-left'
|
|
66
66
|
]"
|
|
67
67
|
>
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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="
|
|
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="
|
|
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 && !
|
|
107
|
-
(multiselect &&
|
|
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 && !
|
|
121
|
-
(!multiselect &&
|
|
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
|
-
</
|
|
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="
|
|
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
|
-
|
|
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
|
-
</
|
|
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
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
814
|
-
this
|
|
815
|
-
|
|
816
|
-
|
|
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.
|
|
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.
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
224
|
+
dragging.value = null
|
|
225
225
|
emit('pan', 'end')
|
|
226
226
|
}
|
|
227
227
|
active.value = false
|