@dataloop-ai/components 0.16.45 → 0.16.47
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/.eslintrc.js +2 -2
- package/package.json +10 -9
- package/src/App.vue +120 -58
- package/src/assets/globals.scss +2 -0
- package/src/components/basic/DlAlert/DlAlert.vue +1 -1
- package/src/components/basic/DlButton/DlButton.vue +13 -13
- package/src/components/basic/DlCard/DlCard.vue +234 -0
- package/src/components/basic/DlCard/index.ts +3 -0
- package/src/components/basic/DlCard/types.ts +20 -0
- package/src/components/basic/DlChip/DlChip.vue +1 -0
- package/src/components/basic/DlEllipsis/DlEllipsis.vue +90 -0
- package/src/components/basic/DlEllipsis/index.ts +2 -0
- package/src/components/basic/DlListItem/DlListItem.vue +11 -5
- package/src/components/basic/index.ts +2 -0
- package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +8 -1
- package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +22 -6
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +542 -0
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/index.ts +2 -0
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/utils.ts +96 -0
- package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +2 -2
- package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +22 -6
- package/src/components/compound/DlCharts/charts/index.ts +1 -0
- package/src/components/compound/DlCharts/components/DlBrush.vue +8 -1
- package/src/components/compound/DlCharts/components/DlChartScrollBar.vue +34 -21
- package/src/components/compound/DlCharts/types/DlConfusionMatrix.types.ts +19 -0
- package/src/components/compound/DlCharts/types/index.ts +2 -1
- package/src/components/compound/DlCharts/types/props.ts +14 -0
- package/src/components/compound/DlDialogBox/DlDialogBox.vue +1 -1
- package/src/components/compound/DlDialogBox/components/DlDialogBoxFooter.vue +1 -0
- package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +58 -12
- package/src/components/compound/DlInput/DlInput.vue +45 -23
- package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +13 -29
- package/src/components/compound/DlPagination/DlPagination.vue +14 -4
- package/src/components/compound/DlPagination/components/PageNavigation.vue +24 -25
- package/src/components/compound/DlPagination/components/PaginationLegend.vue +2 -1
- package/src/components/compound/DlPagination/components/QuickNavigation.vue +1 -0
- package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +86 -49
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +86 -69
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +43 -4
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +1 -55
- package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +42 -10
- package/src/components/compound/DlSearches/DlSmartSearch/utils/utils.ts +107 -0
- package/src/components/compound/DlSelect/DlSelect.vue +41 -8
- package/src/components/compound/DlTable/DlTable.vue +13 -10
- package/src/components/compound/DlTable/styles/dl-table-styles.scss +16 -4
- package/src/components/compound/DlToggleButton/DlToggleButton.vue +109 -0
- package/src/components/compound/DlToggleButton/config.ts +27 -0
- package/src/components/compound/DlToggleButton/index.ts +3 -0
- package/src/components/compound/DlToggleButton/types.ts +4 -0
- package/src/components/compound/index.ts +1 -0
- package/src/components/compound/types.ts +1 -0
- package/src/components/essential/DlColorPicker/DlColorPicker.vue +4 -1
- package/src/components/essential/DlColorPicker/components/DlColors.vue +2 -6
- package/src/components/essential/DlIcon/DlIcon.vue +5 -1
- package/src/components/essential/DlMenu/DlMenu.vue +30 -2
- package/src/components/essential/DlSeparator/DlSeparator.vue +66 -0
- package/src/components/essential/DlSeparator/index.ts +2 -0
- package/src/components/essential/DlSpinner/DlSpinner.vue +53 -217
- package/src/components/essential/DlSpinner/components/DlSpinnerCircle.vue +156 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerClock.vue +191 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerDots.vue +225 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerGrid.vue +278 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerLogo.vue +264 -0
- package/src/components/essential/DlSpinner/index.ts +14 -1
- package/src/components/essential/DlSpinner/types.ts +7 -0
- package/src/components/essential/index.ts +1 -0
- package/src/components/essential/types.ts +1 -0
- package/src/components/shared/DlItemSection/DlItemSection.vue +21 -15
- package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +36 -21
- package/src/components/shared/DlVirtualScroll/useVirtualScroll.ts +8 -10
- package/src/{demo → demos}/DlButtonDemo.vue +15 -0
- package/src/demos/DlCardDemo.vue +47 -0
- package/src/{demo → demos}/DlColorPickerDemo.vue +16 -1
- package/src/demos/DlConfusionMatrixDemo.vue +53 -0
- package/src/{demo → demos}/DlDialogBoxDemo.vue +4 -1
- package/src/demos/DlDropdownButtonDemo.vue +386 -0
- package/src/demos/DlEllipsisDemo.vue +30 -0
- package/src/{demo → demos}/DlLineChartDemo.vue +8 -8
- package/src/{demo → demos}/DlMenuDemo.vue +61 -2
- package/src/{demo → demos}/DlSearchDemo.vue +3 -2
- package/src/demos/DlSeparatorDemo.vue +44 -0
- package/src/demos/DlSpinnerDemo.vue +59 -0
- package/src/{demo → demos}/DlTableDemo.vue +117 -29
- package/src/demos/DlToggleButtonDemo.vue +55 -0
- package/src/{demo → demos}/DlTooltipDemo.vue +43 -2
- package/src/{demo → demos}/DlWidgetDemo.vue +34 -19
- package/src/{demo → demos}/SmartSearchDemo/DlSmartSearchDemo.vue +2 -50
- package/src/{demo → demos}/index.ts +14 -56
- package/src/hooks/use-arrow-navigation.ts +58 -0
- package/src/hooks/use-suggestions.ts +97 -74
- package/src/utils/colors.ts +1 -1
- package/src/utils/draggable-table.ts +2 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/parse-smart-query.ts +87 -0
- package/src/components/compound/DlCharts/types.ts +0 -1
- package/src/demo/DlDropdownButtonDemo.vue +0 -260
- package/src/demo/DlSpinnerDemo.vue +0 -20
- /package/src/{demo → demos}/BarChartDemo.vue +0 -0
- /package/src/{demo → demos}/ColumnChartDemo.vue +0 -0
- /package/src/{demo → demos}/DlAccordionDemo.vue +0 -0
- /package/src/{demo → demos}/DlAlertDemo.vue +0 -0
- /package/src/{demo → demos}/DlAvatarDemo.vue +0 -0
- /package/src/{demo → demos}/DlBadgeDemo.vue +0 -0
- /package/src/{demo → demos}/DlChartDoughnutDemo.vue +0 -0
- /package/src/{demo → demos}/DlCheckboxDemo.vue +0 -0
- /package/src/{demo → demos}/DlChipDemo.vue +0 -0
- /package/src/{demo → demos}/DlCounterDemo.vue +0 -0
- /package/src/{demo → demos}/DlDateTimeRangeDemo.vue +0 -0
- /package/src/{demo → demos}/DlIconDemo.vue +0 -0
- /package/src/{demo → demos}/DlInputDemo.vue +0 -0
- /package/src/{demo → demos}/DlKpiDemo.vue +0 -0
- /package/src/{demo → demos}/DlLinkDemo.vue +0 -0
- /package/src/{demo → demos}/DlListDemo.vue +0 -0
- /package/src/{demo → demos}/DlOptionGroupDemo.vue +0 -0
- /package/src/{demo → demos}/DlPaginationDemo.vue +0 -0
- /package/src/{demo → demos}/DlPanelContainerDemo.vue +0 -0
- /package/src/{demo → demos}/DlPopupDemo.vue +0 -0
- /package/src/{demo → demos}/DlProgressBarDemo.vue +0 -0
- /package/src/{demo → demos}/DlProgressChartDemo.vue +0 -0
- /package/src/{demo → demos}/DlRadioDemo.vue +0 -0
- /package/src/{demo → demos}/DlRangeDemo.vue +0 -0
- /package/src/{demo → demos}/DlSelectDemo.vue +0 -0
- /package/src/{demo → demos}/DlSkeletonDemo.vue +0 -0
- /package/src/{demo → demos}/DlSliderDemo.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/CenteredStepperInDialogBox.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/DlStepperDemo.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/SimpleStepper.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/StepperInDialogBox.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/index.ts +0 -0
- /package/src/{demo → demos}/DlStepperDemo/steps/AssignmentsStep.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/steps/DataStep.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/steps/GeneralStep.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/steps/InstructionStep.vue +0 -0
- /package/src/{demo → demos}/DlStepperDemo/steps/QualityStep.vue +0 -0
- /package/src/{demo → demos}/DlSwitchDemo.vue +0 -0
- /package/src/{demo → demos}/DlTabsDemo.vue +0 -0
- /package/src/{demo → demos}/DlTdDemo.vue +0 -0
- /package/src/{demo → demos}/DlTextAreaDemo.vue +0 -0
- /package/src/{demo → demos}/DlTextHolderDemo.vue +0 -0
- /package/src/{demo → demos}/DlThDemo.vue +0 -0
- /package/src/{demo → demos}/DlToastDemo.vue +0 -0
- /package/src/{demo → demos}/DlTrDemo.vue +0 -0
- /package/src/{demo → demos}/DlTrendDemo.vue +0 -0
- /package/src/{demo → demos}/DlTypographyDemo.vue +0 -0
- /package/src/{demo → demos}/SmartSearchDemo/schema.ts +0 -0
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
:style="cssVars"
|
|
4
|
+
:class="chartWrapperClasses"
|
|
5
|
+
>
|
|
3
6
|
<DlLine
|
|
4
7
|
:id="id"
|
|
5
8
|
ref="lineChart"
|
|
@@ -153,9 +156,10 @@ export default defineComponent({
|
|
|
153
156
|
size: { height: number; width: number }
|
|
154
157
|
) => {
|
|
155
158
|
if (chart?.scales?.x?.width) {
|
|
156
|
-
chartWidth.value = `${
|
|
157
|
-
chart.scales.x.width as unknown as string
|
|
158
|
-
|
|
159
|
+
chartWidth.value = `${
|
|
160
|
+
parseInt(chart.scales.x.width as unknown as string) -
|
|
161
|
+
parseInt(brushProperties.value.thumbSize) / 4
|
|
162
|
+
}px`
|
|
159
163
|
}
|
|
160
164
|
}
|
|
161
165
|
|
|
@@ -268,6 +272,13 @@ export default defineComponent({
|
|
|
268
272
|
return merge(defaultLineChartProps.legendProps, props.legendProps)
|
|
269
273
|
})
|
|
270
274
|
|
|
275
|
+
const cssVars = computed(() => {
|
|
276
|
+
return {
|
|
277
|
+
'--dl-brush-thumb-size':
|
|
278
|
+
parseInt(brushProperties.value.thumbSize) / 4 + 'px'
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
|
|
271
282
|
const replaceDataColors = (data: ChartData) =>
|
|
272
283
|
updateKeys(
|
|
273
284
|
data,
|
|
@@ -450,7 +461,10 @@ export default defineComponent({
|
|
|
450
461
|
() => chart.value?.scales?.x?.width,
|
|
451
462
|
(val: string) => {
|
|
452
463
|
if (val) {
|
|
453
|
-
chartWidth.value = `${
|
|
464
|
+
chartWidth.value = `${
|
|
465
|
+
parseInt(val as unknown as string) -
|
|
466
|
+
parseInt(brushProperties.value.thumbSize) / 4
|
|
467
|
+
}px`
|
|
454
468
|
}
|
|
455
469
|
},
|
|
456
470
|
{ deep: true }
|
|
@@ -619,7 +633,8 @@ export default defineComponent({
|
|
|
619
633
|
onLeaveLegend,
|
|
620
634
|
onChartLeave,
|
|
621
635
|
chart,
|
|
622
|
-
labelStyles
|
|
636
|
+
labelStyles,
|
|
637
|
+
cssVars
|
|
623
638
|
}
|
|
624
639
|
}
|
|
625
640
|
})
|
|
@@ -644,5 +659,6 @@ export default defineComponent({
|
|
|
644
659
|
.dl-brush,
|
|
645
660
|
.dl-legend {
|
|
646
661
|
align-self: flex-end;
|
|
662
|
+
margin-right: var(--dl-brush-thumb-size);
|
|
647
663
|
}
|
|
648
664
|
</style>
|
|
@@ -62,7 +62,7 @@ import useSlider, {
|
|
|
62
62
|
useSliderEmits,
|
|
63
63
|
dragType,
|
|
64
64
|
Dragging
|
|
65
|
-
} from '
|
|
65
|
+
} from '../../../compound/DlSlider/useSlider'
|
|
66
66
|
|
|
67
67
|
import { between, isMobileOrTablet, getColor } from '../../../../utils'
|
|
68
68
|
import BrushThumb from '../shared/BrushThumb.vue'
|
|
@@ -98,6 +98,10 @@ export default defineComponent({
|
|
|
98
98
|
type: String,
|
|
99
99
|
default: 'dl-color-panel-background'
|
|
100
100
|
},
|
|
101
|
+
maxRange: {
|
|
102
|
+
type: Number,
|
|
103
|
+
default: null
|
|
104
|
+
},
|
|
101
105
|
selectionColor: {
|
|
102
106
|
type: String,
|
|
103
107
|
default: 'dl-color-chart-brush'
|
|
@@ -387,6 +391,8 @@ export default defineComponent({
|
|
|
387
391
|
break
|
|
388
392
|
}
|
|
389
393
|
|
|
394
|
+
if (pos.max - pos.min < props.maxRange) return
|
|
395
|
+
|
|
390
396
|
model.value =
|
|
391
397
|
model.value.min === null || model.value.max === null
|
|
392
398
|
? { min: pos.min || props.min, max: pos.max || props.max }
|
|
@@ -454,6 +460,7 @@ export default defineComponent({
|
|
|
454
460
|
}
|
|
455
461
|
|
|
456
462
|
& .thumb {
|
|
463
|
+
background-color: var(--color);
|
|
457
464
|
z-index: 1;
|
|
458
465
|
outline: 0;
|
|
459
466
|
transition: transform 0.18s ease-out, fill 0.18s ease-out,
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="wrapper"
|
|
4
|
+
:style="wrapperStyles"
|
|
5
|
+
class="scroll-bar-wrapper"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
v-show="show"
|
|
9
|
+
ref="scroll"
|
|
10
|
+
:style="scrollStyles"
|
|
11
|
+
:class="scrollClasses"
|
|
12
|
+
@mousedown="startDragging"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
1
17
|
<script lang="ts">
|
|
2
18
|
import { defineComponent } from 'vue-demi'
|
|
3
19
|
|
|
4
20
|
export default defineComponent({
|
|
5
21
|
name: 'DlChartScrollBar',
|
|
6
22
|
props: {
|
|
23
|
+
show: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: true
|
|
26
|
+
},
|
|
7
27
|
itemCount: {
|
|
8
28
|
type: Number,
|
|
9
29
|
default: 0
|
|
@@ -19,6 +39,14 @@ export default defineComponent({
|
|
|
19
39
|
height: {
|
|
20
40
|
type: String,
|
|
21
41
|
default: null
|
|
42
|
+
},
|
|
43
|
+
scrollDeficit: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: 0
|
|
46
|
+
},
|
|
47
|
+
wrapperStyles: {
|
|
48
|
+
type: Object,
|
|
49
|
+
default: null
|
|
22
50
|
}
|
|
23
51
|
},
|
|
24
52
|
emits: ['position-update'],
|
|
@@ -47,7 +75,7 @@ export default defineComponent({
|
|
|
47
75
|
const space =
|
|
48
76
|
this.maxHeight -
|
|
49
77
|
(this.$refs.scroll as HTMLElement)?.offsetHeight -
|
|
50
|
-
|
|
78
|
+
this.scrollDeficit
|
|
51
79
|
return top < space ? top : space
|
|
52
80
|
},
|
|
53
81
|
scrollClasses(): string {
|
|
@@ -62,7 +90,7 @@ export default defineComponent({
|
|
|
62
90
|
}
|
|
63
91
|
},
|
|
64
92
|
maxScroll(): number {
|
|
65
|
-
return (this.$refs as
|
|
93
|
+
return (this.$refs.wrapper as HTMLElement)?.offsetHeight
|
|
66
94
|
}
|
|
67
95
|
},
|
|
68
96
|
mounted() {
|
|
@@ -93,7 +121,7 @@ export default defineComponent({
|
|
|
93
121
|
marginTop >
|
|
94
122
|
this.maxHeight -
|
|
95
123
|
(this.$refs.scroll as HTMLElement).offsetHeight -
|
|
96
|
-
|
|
124
|
+
this.scrollDeficit
|
|
97
125
|
)
|
|
98
126
|
return
|
|
99
127
|
;(
|
|
@@ -102,32 +130,17 @@ export default defineComponent({
|
|
|
102
130
|
this.updatePosition(marginTop)
|
|
103
131
|
},
|
|
104
132
|
updatePosition(top: number) {
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
this.$emit('position-update',
|
|
133
|
+
const position = Math.trunc((this.itemCount * top) / this.maxScroll)
|
|
134
|
+
if (position !== this.previousMin + 1) {
|
|
135
|
+
this.$emit('position-update', { position, top })
|
|
108
136
|
}
|
|
109
137
|
}
|
|
110
138
|
}
|
|
111
139
|
})
|
|
112
140
|
</script>
|
|
113
141
|
|
|
114
|
-
<template>
|
|
115
|
-
<div
|
|
116
|
-
ref="wrapper"
|
|
117
|
-
class="scroll-bar-wrapper"
|
|
118
|
-
>
|
|
119
|
-
<div
|
|
120
|
-
ref="scroll"
|
|
121
|
-
:style="scrollStyles"
|
|
122
|
-
:class="scrollClasses"
|
|
123
|
-
@mousedown="startDragging"
|
|
124
|
-
/>
|
|
125
|
-
</div>
|
|
126
|
-
</template>
|
|
127
|
-
|
|
128
142
|
<style scoped lang="scss">
|
|
129
143
|
.scroll-bar-wrapper {
|
|
130
|
-
margin-top: 10px;
|
|
131
144
|
width: 1%;
|
|
132
145
|
}
|
|
133
146
|
.scroll-bar {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface DlConfusionMatrixCell {
|
|
2
|
+
value: number
|
|
3
|
+
unnormalizedValue: number
|
|
4
|
+
xLabel: string | DlConfusionMatrixLabel
|
|
5
|
+
yLabel: string | DlConfusionMatrixLabel
|
|
6
|
+
x: number
|
|
7
|
+
y: number
|
|
8
|
+
link?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface DlConfusionMatrixLabel {
|
|
12
|
+
title: string
|
|
13
|
+
image: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface DlConfusionMatrixBrushState {
|
|
17
|
+
min: number
|
|
18
|
+
max: number
|
|
19
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './DlConfusionMatrix.types'
|
|
2
|
+
export * from './types'
|
|
@@ -259,6 +259,20 @@ export const defaultLineChartProps = {
|
|
|
259
259
|
alignItems: 'center'
|
|
260
260
|
},
|
|
261
261
|
options: {
|
|
262
|
+
clip: {
|
|
263
|
+
left: 4.5,
|
|
264
|
+
right: 5,
|
|
265
|
+
bottom: 5,
|
|
266
|
+
top: 0
|
|
267
|
+
},
|
|
268
|
+
layout: {
|
|
269
|
+
padding: {
|
|
270
|
+
left: 0,
|
|
271
|
+
right: 4,
|
|
272
|
+
top: 0,
|
|
273
|
+
bottom: 0
|
|
274
|
+
}
|
|
275
|
+
},
|
|
262
276
|
responsive: true,
|
|
263
277
|
maintainAspectRatio: false,
|
|
264
278
|
animation: {
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
(split === false && disableMainBtn === true) ||
|
|
30
30
|
disableDropdown === true
|
|
31
31
|
"
|
|
32
|
+
:overflow="overflow"
|
|
33
|
+
:tooltip="tooltip"
|
|
32
34
|
@click="onClickHide"
|
|
33
35
|
/>
|
|
34
36
|
<dl-button
|
|
@@ -47,6 +49,9 @@
|
|
|
47
49
|
(split === false && disableMainBtn === true) ||
|
|
48
50
|
disableDropdown === true
|
|
49
51
|
"
|
|
52
|
+
:no-wrap="noWrap"
|
|
53
|
+
:overflow="overflow"
|
|
54
|
+
:tooltip="tooltip"
|
|
50
55
|
>
|
|
51
56
|
<div
|
|
52
57
|
class="dl-btn-dropdown--separator"
|
|
@@ -111,17 +116,18 @@
|
|
|
111
116
|
"
|
|
112
117
|
:disabled="disabled === true || disableMainBtn === true"
|
|
113
118
|
:style="mainBtnStyle"
|
|
114
|
-
no-wrap
|
|
119
|
+
:no-wrap="props.noWrap"
|
|
120
|
+
:tooltip="tooltip"
|
|
121
|
+
:max-width="maxWidth"
|
|
115
122
|
@click="onClick"
|
|
116
123
|
>
|
|
117
|
-
<div
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
<span style="margin-right: 5px">
|
|
124
|
+
<div class="dl-btn-dropdown--simple__title">
|
|
125
|
+
<span
|
|
126
|
+
:class="{
|
|
127
|
+
'dl-button-no-wrap': noWrap
|
|
128
|
+
}"
|
|
129
|
+
style="margin-right: 5px"
|
|
130
|
+
>
|
|
125
131
|
{{ label }}
|
|
126
132
|
</span>
|
|
127
133
|
<dl-icon
|
|
@@ -154,10 +160,13 @@
|
|
|
154
160
|
separate-close-popup
|
|
155
161
|
:disabled="disabled"
|
|
156
162
|
:max-height="maxHeight"
|
|
163
|
+
:arrow-nav-items="arrowNavItems"
|
|
157
164
|
@before-show="onBeforeShow"
|
|
158
165
|
@show="onShow"
|
|
159
166
|
@before-hide="onBeforeHide"
|
|
160
167
|
@hide="onHide"
|
|
168
|
+
@highlightedIndex="setHighlightedIndex"
|
|
169
|
+
@handleSelectedItem="handleSelectedItem"
|
|
161
170
|
>
|
|
162
171
|
<slot />
|
|
163
172
|
</dl-menu>
|
|
@@ -231,7 +240,14 @@ export default defineComponent({
|
|
|
231
240
|
uppercase: Boolean,
|
|
232
241
|
outlined: Boolean,
|
|
233
242
|
padding: { type: String, default: '5px' },
|
|
234
|
-
fitContent: Boolean
|
|
243
|
+
fitContent: Boolean,
|
|
244
|
+
noWrap: { type: Boolean, default: false, required: false },
|
|
245
|
+
overflow: { type: Boolean, default: false, required: false },
|
|
246
|
+
tooltip: { type: String, default: null, required: false },
|
|
247
|
+
arrowNavItems: {
|
|
248
|
+
type: [String, Array, Object],
|
|
249
|
+
default: () => [] as any[]
|
|
250
|
+
}
|
|
235
251
|
},
|
|
236
252
|
emits: [
|
|
237
253
|
'update:model-value',
|
|
@@ -240,7 +256,9 @@ export default defineComponent({
|
|
|
240
256
|
'before-show',
|
|
241
257
|
'show',
|
|
242
258
|
'before-hide',
|
|
243
|
-
'hide'
|
|
259
|
+
'hide',
|
|
260
|
+
'highlightedIndex',
|
|
261
|
+
'handleSelectedItem'
|
|
244
262
|
],
|
|
245
263
|
|
|
246
264
|
setup(props, { emit }) {
|
|
@@ -352,6 +370,12 @@ export default defineComponent({
|
|
|
352
370
|
(menuRef.value as Record<string, Function>).hide(evt)
|
|
353
371
|
}
|
|
354
372
|
}
|
|
373
|
+
const setHighlightedIndex = (value: any) => {
|
|
374
|
+
emit('highlightedIndex', value)
|
|
375
|
+
}
|
|
376
|
+
const handleSelectedItem = (value: any) => {
|
|
377
|
+
emit('handleSelectedItem', value)
|
|
378
|
+
}
|
|
355
379
|
|
|
356
380
|
onMounted(() => {
|
|
357
381
|
if (props.modelValue) {
|
|
@@ -383,13 +407,22 @@ export default defineComponent({
|
|
|
383
407
|
toggle,
|
|
384
408
|
show,
|
|
385
409
|
hide,
|
|
386
|
-
menuModel
|
|
410
|
+
menuModel,
|
|
411
|
+
props,
|
|
412
|
+
setHighlightedIndex,
|
|
413
|
+
handleSelectedItem
|
|
387
414
|
}
|
|
388
415
|
}
|
|
389
416
|
})
|
|
390
417
|
</script>
|
|
391
418
|
|
|
392
419
|
<style scoped lang="scss">
|
|
420
|
+
.dl-button-no-wrap {
|
|
421
|
+
width: 100%;
|
|
422
|
+
white-space: nowrap;
|
|
423
|
+
overflow: hidden;
|
|
424
|
+
text-overflow: ellipsis;
|
|
425
|
+
}
|
|
393
426
|
.dl-btn-dropdown {
|
|
394
427
|
padding-right: var(--dl-btn-padding-right) !important;
|
|
395
428
|
&--split .dl-btn-dropdown__arrow-container {
|
|
@@ -425,6 +458,19 @@ export default defineComponent({
|
|
|
425
458
|
::v-deep .dl-button-no-wrap {
|
|
426
459
|
padding-right: 8px;
|
|
427
460
|
}
|
|
461
|
+
&__title {
|
|
462
|
+
display: flex;
|
|
463
|
+
align-items: center;
|
|
464
|
+
justify-content: space-around;
|
|
465
|
+
text-align: center;
|
|
466
|
+
padding: 0;
|
|
467
|
+
flex: 10000 1 0%;
|
|
468
|
+
flex-wrap: nowrap;
|
|
469
|
+
line-height: 1;
|
|
470
|
+
z-index: 0;
|
|
471
|
+
user-select: none !important;
|
|
472
|
+
min-width: 1.5em;
|
|
473
|
+
}
|
|
428
474
|
}
|
|
429
475
|
&__arrow {
|
|
430
476
|
transition: transform 0.28s;
|
|
@@ -121,17 +121,21 @@
|
|
|
121
121
|
:offset="[0, 3]"
|
|
122
122
|
fit-container
|
|
123
123
|
:fit-content="fitContent"
|
|
124
|
+
:arrow-nav-items="suggestItems"
|
|
124
125
|
@click="onMenuShow"
|
|
126
|
+
@highlightedIndex="setHighlightedIndex"
|
|
127
|
+
@handleSelectedItem="handleSelectedItem"
|
|
125
128
|
>
|
|
126
129
|
<dl-list
|
|
127
130
|
bordered
|
|
128
131
|
:style="{ maxWidth: suggestMenuWidth }"
|
|
129
132
|
>
|
|
130
133
|
<dl-list-item
|
|
131
|
-
v-for="item in suggestItems"
|
|
134
|
+
v-for="(item, suggestIndex) in suggestItems"
|
|
132
135
|
:key="item"
|
|
133
136
|
clickable
|
|
134
137
|
style="font-size: 12px"
|
|
138
|
+
:is-highlighted="suggestIndex === highlightedIndex"
|
|
135
139
|
@click="onClick($event, item)"
|
|
136
140
|
>
|
|
137
141
|
<span
|
|
@@ -197,7 +201,7 @@
|
|
|
197
201
|
|
|
198
202
|
<script lang="ts">
|
|
199
203
|
import { debounce } from 'lodash'
|
|
200
|
-
import { defineComponent, PropType } from 'vue-demi'
|
|
204
|
+
import { computed, defineComponent, PropType, ref } from 'vue-demi'
|
|
201
205
|
import { DlInfoErrorMessage } from '../../shared'
|
|
202
206
|
import { DlListItem } from '../../basic'
|
|
203
207
|
import { DlMenu, DlIcon, DlList, DlTooltip } from '../../essential'
|
|
@@ -297,10 +301,7 @@ export default defineComponent({
|
|
|
297
301
|
type: Boolean,
|
|
298
302
|
default: false
|
|
299
303
|
},
|
|
300
|
-
|
|
301
|
-
type: Boolean,
|
|
302
|
-
default: false
|
|
303
|
-
},
|
|
304
|
+
dense: Boolean,
|
|
304
305
|
disableClearBtn: {
|
|
305
306
|
type: Boolean,
|
|
306
307
|
default: false
|
|
@@ -328,12 +329,45 @@ export default defineComponent({
|
|
|
328
329
|
fitContent: Boolean
|
|
329
330
|
},
|
|
330
331
|
emits: ['input', 'focus', 'blur', 'clear', 'enter', 'update:model-value'],
|
|
332
|
+
setup(props, { emit }) {
|
|
333
|
+
const highlightedIndex = ref(-1)
|
|
334
|
+
const isMenuOpen = ref(false)
|
|
335
|
+
const suggestItems = computed<string[]>(() => {
|
|
336
|
+
return props.autoSuggestItems.filter((item) =>
|
|
337
|
+
item.includes(`${props.modelValue}`)
|
|
338
|
+
)
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
const setHighlightedIndex = (value: any) => {
|
|
342
|
+
highlightedIndex.value = value
|
|
343
|
+
}
|
|
344
|
+
const handleSelectedItem = (value: any) => {
|
|
345
|
+
onAutoSuggestClick(null, value)
|
|
346
|
+
}
|
|
347
|
+
const inputRef = ref<HTMLInputElement>(null)
|
|
348
|
+
const onAutoSuggestClick = (
|
|
349
|
+
e: Event,
|
|
350
|
+
item: string | HTMLInputElement
|
|
351
|
+
): void => {
|
|
352
|
+
emit('input', item, e)
|
|
353
|
+
emit('update:model-value', item)
|
|
354
|
+
inputRef.value = item as HTMLInputElement
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return {
|
|
358
|
+
suggestItems,
|
|
359
|
+
highlightedIndex,
|
|
360
|
+
onAutoSuggestClick,
|
|
361
|
+
isMenuOpen,
|
|
362
|
+
setHighlightedIndex,
|
|
363
|
+
handleSelectedItem
|
|
364
|
+
}
|
|
365
|
+
},
|
|
331
366
|
data() {
|
|
332
367
|
return {
|
|
333
368
|
uuid: `dl-text-input-${v4()}`,
|
|
334
369
|
showPass: false,
|
|
335
|
-
focused: false
|
|
336
|
-
isMenuOpen: false
|
|
370
|
+
focused: false
|
|
337
371
|
}
|
|
338
372
|
},
|
|
339
373
|
computed: {
|
|
@@ -350,8 +384,8 @@ export default defineComponent({
|
|
|
350
384
|
if (this.isSmall) {
|
|
351
385
|
classes.push('dl-text-input--s')
|
|
352
386
|
}
|
|
353
|
-
if (this.
|
|
354
|
-
classes.push('dl-text-input--
|
|
387
|
+
if (this.dense) {
|
|
388
|
+
classes.push('dl-text-input--dense')
|
|
355
389
|
}
|
|
356
390
|
return classes
|
|
357
391
|
},
|
|
@@ -429,11 +463,6 @@ export default defineComponent({
|
|
|
429
463
|
showSuggestItems(): boolean {
|
|
430
464
|
return !!this.suggestItems.length && !!this.modelValue
|
|
431
465
|
},
|
|
432
|
-
suggestItems(): string[] {
|
|
433
|
-
return this.autoSuggestItems.filter((item) =>
|
|
434
|
-
item.includes(`${this.modelValue}`)
|
|
435
|
-
)
|
|
436
|
-
},
|
|
437
466
|
debouncedBlur(): any {
|
|
438
467
|
const debounced = debounce(this.onBlur.bind(this), 50)
|
|
439
468
|
return debounced
|
|
@@ -502,13 +531,6 @@ export default defineComponent({
|
|
|
502
531
|
onPassShowClick(): void {
|
|
503
532
|
this.showPass = !this.showPass
|
|
504
533
|
},
|
|
505
|
-
onAutoSuggestClick(e: Event, item: string): void {
|
|
506
|
-
this.$emit('input', item, e)
|
|
507
|
-
this.$emit('update:model-value', item)
|
|
508
|
-
|
|
509
|
-
const inputRef = this.$refs.input as HTMLInputElement
|
|
510
|
-
inputRef.value = item
|
|
511
|
-
},
|
|
512
534
|
onMenuShow(): void {
|
|
513
535
|
this.focus()
|
|
514
536
|
},
|
|
@@ -608,7 +630,7 @@ export default defineComponent({
|
|
|
608
630
|
-moz-appearance: textfield;
|
|
609
631
|
}
|
|
610
632
|
|
|
611
|
-
&--
|
|
633
|
+
&--dense {
|
|
612
634
|
padding: 0;
|
|
613
635
|
}
|
|
614
636
|
|
|
@@ -34,13 +34,6 @@
|
|
|
34
34
|
ref="jsonEditorRef"
|
|
35
35
|
class="json-editor"
|
|
36
36
|
/>
|
|
37
|
-
<dl-typography
|
|
38
|
-
style="margin-top: 5px"
|
|
39
|
-
variant="p"
|
|
40
|
-
color="red"
|
|
41
|
-
>
|
|
42
|
-
{{ message }}
|
|
43
|
-
</dl-typography>
|
|
44
37
|
</div>
|
|
45
38
|
</template>
|
|
46
39
|
<template #footer>
|
|
@@ -57,15 +50,13 @@
|
|
|
57
50
|
</div>
|
|
58
51
|
<div class="footer-save">
|
|
59
52
|
<dl-button
|
|
60
|
-
:disabled="message !== ''"
|
|
61
53
|
outlined
|
|
62
54
|
label="Save As"
|
|
63
|
-
@click="
|
|
55
|
+
@click="handleSaveButton"
|
|
64
56
|
/>
|
|
65
57
|
<dl-button
|
|
66
|
-
:disabled="message !== ''"
|
|
67
58
|
label="Search"
|
|
68
|
-
@click="
|
|
59
|
+
@click="handleSearchButton"
|
|
69
60
|
/>
|
|
70
61
|
</div>
|
|
71
62
|
</div>
|
|
@@ -82,7 +73,6 @@ import { Query } from './types'
|
|
|
82
73
|
import { DlSelect } from '../DlSelect'
|
|
83
74
|
import { DlButton } from '../../basic'
|
|
84
75
|
import { DlDialogBox, DlDialogBoxHeader } from '../DlDialogBox'
|
|
85
|
-
import { DlTypography } from '../../essential'
|
|
86
76
|
|
|
87
77
|
interface JSONContent {
|
|
88
78
|
json: JSONValue
|
|
@@ -94,8 +84,7 @@ export default defineComponent({
|
|
|
94
84
|
DlDialogBox,
|
|
95
85
|
DlDialogBoxHeader,
|
|
96
86
|
DlSelect,
|
|
97
|
-
DlButton
|
|
98
|
-
DlTypography
|
|
87
|
+
DlButton
|
|
99
88
|
},
|
|
100
89
|
props: {
|
|
101
90
|
modelValue: { type: Boolean, default: false },
|
|
@@ -122,8 +111,7 @@ export default defineComponent({
|
|
|
122
111
|
selectedOption: {
|
|
123
112
|
label: this.query?.name,
|
|
124
113
|
value: this.query?.query
|
|
125
|
-
}
|
|
126
|
-
message: ''
|
|
114
|
+
}
|
|
127
115
|
}
|
|
128
116
|
},
|
|
129
117
|
computed: {
|
|
@@ -158,26 +146,18 @@ export default defineComponent({
|
|
|
158
146
|
},
|
|
159
147
|
query(val) {
|
|
160
148
|
this.$nextTick(() => {
|
|
161
|
-
if (val.name === 'New Query') return
|
|
162
149
|
this.selectedOption = {
|
|
163
150
|
label: val.name,
|
|
164
151
|
value: val.query
|
|
165
152
|
}
|
|
166
153
|
if (val.query && this.jsonEditor.set) {
|
|
167
|
-
this.
|
|
168
|
-
|
|
169
|
-
|
|
154
|
+
this.activeQuery = {
|
|
155
|
+
name: '',
|
|
156
|
+
query: val.query
|
|
157
|
+
}
|
|
170
158
|
}
|
|
171
159
|
this.alignText()
|
|
172
160
|
})
|
|
173
|
-
},
|
|
174
|
-
activeQuery(val) {
|
|
175
|
-
try {
|
|
176
|
-
if (val.query) JSON.parse(val.query)
|
|
177
|
-
this.message = ''
|
|
178
|
-
} catch {
|
|
179
|
-
this.message = 'Invalid Query.'
|
|
180
|
-
}
|
|
181
161
|
}
|
|
182
162
|
},
|
|
183
163
|
mounted() {
|
|
@@ -258,7 +238,7 @@ export default defineComponent({
|
|
|
258
238
|
})
|
|
259
239
|
this.alignText()
|
|
260
240
|
},
|
|
261
|
-
|
|
241
|
+
handleSaveButton() {
|
|
262
242
|
this.$emit(
|
|
263
243
|
'save',
|
|
264
244
|
this.activeQuery
|
|
@@ -268,6 +248,10 @@ export default defineComponent({
|
|
|
268
248
|
query: (this.jsonEditor?.get() as any).text || ''
|
|
269
249
|
}
|
|
270
250
|
)
|
|
251
|
+
},
|
|
252
|
+
handleSearchButton() {
|
|
253
|
+
this.$emit('search', this.activeQuery)
|
|
254
|
+
this.$emit('update:modelValue', false)
|
|
271
255
|
}
|
|
272
256
|
}
|
|
273
257
|
})
|