@dataloop-ai/components 0.16.44 → 0.16.46
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 +116 -57
- package/src/assets/globals.scss +2 -0
- package/src/components/basic/DlAlert/DlAlert.vue +1 -1
- package/src/components/basic/DlButton/DlButton.vue +22 -10
- package/src/components/basic/DlCard/DlCard.vue +217 -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 +526 -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 +20 -13
- 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 +62 -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 +44 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerClock.vue +79 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerDots.vue +113 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerGrid.vue +166 -0
- package/src/components/essential/DlSpinner/components/DlSpinnerLogo.vue +152 -0
- package/src/components/essential/DlSpinner/index.ts +14 -1
- package/src/components/essential/DlSpinner/styles/spinnerStyles.scss +111 -0
- 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 +36 -1
- 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 +57 -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,10 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="dl-pagination--page_navigation"
|
|
4
|
+
:style="cssVars"
|
|
5
|
+
>
|
|
3
6
|
<button
|
|
4
7
|
v-if="boundaryLinks"
|
|
5
8
|
class="dl-pagination--nav_btn"
|
|
6
9
|
:disabled="disabled || isFirstPage"
|
|
7
|
-
:style="cssVars"
|
|
8
10
|
@click="setPage(min)"
|
|
9
11
|
>
|
|
10
12
|
<dl-icon
|
|
@@ -16,7 +18,6 @@
|
|
|
16
18
|
v-if="directionLinks"
|
|
17
19
|
class="dl-pagination--nav_btn"
|
|
18
20
|
:disabled="disabled || isFirstPage"
|
|
19
|
-
:style="cssVars"
|
|
20
21
|
@click="setPage(value - 1)"
|
|
21
22
|
>
|
|
22
23
|
<dl-icon
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
<button
|
|
29
30
|
v-if="boundaryNumbers"
|
|
30
31
|
class="dl-pagination--page_btn"
|
|
31
|
-
:
|
|
32
|
+
:class="{ 'dl-pagination--active': isActivePage(min) }"
|
|
32
33
|
:disabled="disabled"
|
|
33
34
|
@click="setPage(min)"
|
|
34
35
|
>
|
|
@@ -37,7 +38,6 @@
|
|
|
37
38
|
<button
|
|
38
39
|
v-if="ellipsesStart"
|
|
39
40
|
class="dl-pagination--page_btn"
|
|
40
|
-
:style="cssVars"
|
|
41
41
|
:disabled="disabled"
|
|
42
42
|
@click="setPage(pgFrom - 1)"
|
|
43
43
|
>
|
|
@@ -48,8 +48,10 @@
|
|
|
48
48
|
v-for="page in pages"
|
|
49
49
|
:key="page"
|
|
50
50
|
class="dl-pagination--page_btn"
|
|
51
|
-
:class="{
|
|
52
|
-
|
|
51
|
+
:class="{
|
|
52
|
+
'dl-pagination--active': isActivePage(page),
|
|
53
|
+
active: isActivePage(page)
|
|
54
|
+
}"
|
|
53
55
|
:disabled="disabled"
|
|
54
56
|
@click="setPage(page)"
|
|
55
57
|
>
|
|
@@ -59,7 +61,6 @@
|
|
|
59
61
|
<button
|
|
60
62
|
v-if="ellipsesEnd"
|
|
61
63
|
class="dl-pagination--page_btn"
|
|
62
|
-
:style="cssVars"
|
|
63
64
|
:disabled="disabled"
|
|
64
65
|
@click="setPage(pgTo + 1)"
|
|
65
66
|
>
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
<button
|
|
69
70
|
v-if="boundaryNumbers && min !== max"
|
|
70
71
|
class="dl-pagination--page_btn"
|
|
71
|
-
:
|
|
72
|
+
:class="{ 'dl-pagination--active': isActivePage(max) }"
|
|
72
73
|
:disabled="disabled"
|
|
73
74
|
@click="setPage(max)"
|
|
74
75
|
>
|
|
@@ -79,7 +80,6 @@
|
|
|
79
80
|
v-if="directionLinks"
|
|
80
81
|
class="dl-pagination--nav_btn"
|
|
81
82
|
:disabled="disabled || isLastPage"
|
|
82
|
-
:style="cssVars"
|
|
83
83
|
@click="setPage(value + 1)"
|
|
84
84
|
>
|
|
85
85
|
<dl-icon
|
|
@@ -91,7 +91,6 @@
|
|
|
91
91
|
v-if="boundaryLinks"
|
|
92
92
|
class="dl-pagination--nav_btn"
|
|
93
93
|
:disabled="disabled || isLastPage"
|
|
94
|
-
:style="cssVars"
|
|
95
94
|
@click="setPage(max)"
|
|
96
95
|
>
|
|
97
96
|
<dl-icon
|
|
@@ -141,7 +140,7 @@ export default defineComponent({
|
|
|
141
140
|
directionLinks: Boolean,
|
|
142
141
|
color: {
|
|
143
142
|
type: String,
|
|
144
|
-
default: 'dl-color-
|
|
143
|
+
default: 'dl-color-transparent'
|
|
145
144
|
},
|
|
146
145
|
textColor: {
|
|
147
146
|
type: String,
|
|
@@ -178,21 +177,16 @@ export default defineComponent({
|
|
|
178
177
|
},
|
|
179
178
|
cssVars(): Record<string, any> {
|
|
180
179
|
return {
|
|
181
|
-
'--dl-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
'dl-color-darker'
|
|
180
|
+
'--dl-btn-bg-color': getColor(
|
|
181
|
+
this.color,
|
|
182
|
+
'dl-color-transparent'
|
|
185
183
|
),
|
|
186
|
-
'--dl-btn-
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
activePageCssVars(): Record<string, any> {
|
|
190
|
-
return {
|
|
191
|
-
'--dl-page-bg-color': getColor(
|
|
184
|
+
'--dl-active-btn-bg-color': getColor(
|
|
192
185
|
this.activeColor,
|
|
193
186
|
'dl-color-secondary'
|
|
194
187
|
),
|
|
195
|
-
'--dl-
|
|
188
|
+
'--dl-text-color': getColor(this.textColor, 'dl-color-darker'),
|
|
189
|
+
'--dl-active-text-color': getColor(
|
|
196
190
|
this.activeTextColor,
|
|
197
191
|
'dl-color-text-buttons'
|
|
198
192
|
),
|
|
@@ -309,6 +303,11 @@ export default defineComponent({
|
|
|
309
303
|
text-overflow: ellipsis;
|
|
310
304
|
}
|
|
311
305
|
|
|
306
|
+
&--active {
|
|
307
|
+
color: var(--dl-active-text-color) !important;
|
|
308
|
+
background-color: var(--dl-active-btn-bg-color) !important;
|
|
309
|
+
}
|
|
310
|
+
|
|
312
311
|
&--page_btn,
|
|
313
312
|
&--nav_btn {
|
|
314
313
|
min-width: var(--dl-btn-min-width);
|
|
@@ -316,8 +315,8 @@ export default defineComponent({
|
|
|
316
315
|
cursor: pointer;
|
|
317
316
|
border: none;
|
|
318
317
|
border-radius: 2px;
|
|
319
|
-
color: var(--dl-
|
|
320
|
-
background-color: var(--dl-
|
|
318
|
+
color: var(--dl-text-color);
|
|
319
|
+
background-color: var(--dl-btn-bg-color);
|
|
321
320
|
|
|
322
321
|
&:active:not(:disabled) {
|
|
323
322
|
background-color: var(--dl-color-secondary);
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
:model-value="inputModel"
|
|
16
16
|
:expanded-input-height="expandedInputHeight"
|
|
17
17
|
:suggestions="suggestions"
|
|
18
|
-
@save="
|
|
18
|
+
@save="saveQueryDialogBoxModel = true"
|
|
19
19
|
@focus="setFocused"
|
|
20
20
|
@update:modelValue="handleInputModel"
|
|
21
21
|
@dql-edit="jsonEditorModel = !jsonEditorModel"
|
|
@@ -30,23 +30,13 @@
|
|
|
30
30
|
@click="emitSearchQuery"
|
|
31
31
|
/>
|
|
32
32
|
</div>
|
|
33
|
-
<!-- <div class="dl-smart-search__filters-btn-wrapper">
|
|
34
|
-
<dl-filters
|
|
35
|
-
v-model="filtersModel"
|
|
36
|
-
:filters="filters"
|
|
37
|
-
:disabled="disabled"
|
|
38
|
-
@save="handleQueryEdit"
|
|
39
|
-
@remove="handleQueryRemove"
|
|
40
|
-
@setActive="handleSetActiveQuery"
|
|
41
|
-
/>
|
|
42
|
-
</div> -->
|
|
43
33
|
</div>
|
|
44
34
|
<dl-json-editor
|
|
45
35
|
:model-value="jsonEditorModel"
|
|
46
36
|
:query="activeQuery"
|
|
47
37
|
:queries="savedQueries"
|
|
48
38
|
@update:modelValue="jsonEditorModel = $event"
|
|
49
|
-
@save="
|
|
39
|
+
@save="saveQueryDialogBoxModel = true"
|
|
50
40
|
@remove="handleQueryRemove"
|
|
51
41
|
@search="handleQuerySearchEditor"
|
|
52
42
|
/>
|
|
@@ -88,15 +78,23 @@
|
|
|
88
78
|
/>
|
|
89
79
|
</template>
|
|
90
80
|
<template #footer>
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
<div class="dl-smart-search__buttons--save">
|
|
82
|
+
<dl-button @click="handleSaveQuery">
|
|
83
|
+
Save
|
|
84
|
+
</dl-button>
|
|
85
|
+
<dl-button
|
|
86
|
+
padding="10px"
|
|
87
|
+
@click="handleSaveQuery(true)"
|
|
88
|
+
>
|
|
89
|
+
Save and Search
|
|
90
|
+
</dl-button>
|
|
91
|
+
</div>
|
|
94
92
|
</template>
|
|
95
93
|
</dl-dialog-box>
|
|
96
94
|
</div>
|
|
97
95
|
</template>
|
|
98
96
|
<script lang="ts">
|
|
99
|
-
import { defineComponent,
|
|
97
|
+
import { defineComponent, PropType, ref } from 'vue-demi'
|
|
100
98
|
import DlSmartSearchInput from './components/DlSmartSearchInput.vue'
|
|
101
99
|
import { DlJsonEditor } from '../../DlJsonEditor'
|
|
102
100
|
import { DlDialogBox, DlDialogBoxHeader } from '../../DlDialogBox'
|
|
@@ -106,11 +104,17 @@ import { DlButton } from '../../../basic'
|
|
|
106
104
|
import {
|
|
107
105
|
useSuggestions,
|
|
108
106
|
Schema,
|
|
109
|
-
Alias
|
|
107
|
+
Alias,
|
|
108
|
+
removeBrackets
|
|
110
109
|
} from '../../../../hooks/use-suggestions'
|
|
111
110
|
import { Filter, Query, ColorSchema, SearchStatus } from './types'
|
|
112
|
-
import {
|
|
111
|
+
import {
|
|
112
|
+
replaceAliases,
|
|
113
|
+
replaceWithJsDates,
|
|
114
|
+
createColorSchema
|
|
115
|
+
} from './utils/utils'
|
|
113
116
|
import { v4 } from 'uuid'
|
|
117
|
+
import { parseSmartQuery } from '../../../../utils'
|
|
114
118
|
|
|
115
119
|
export default defineComponent({
|
|
116
120
|
components: {
|
|
@@ -165,19 +169,22 @@ export default defineComponent({
|
|
|
165
169
|
}
|
|
166
170
|
},
|
|
167
171
|
emits: ['save-query', 'remove-query', 'search-query'],
|
|
168
|
-
setup(props
|
|
169
|
-
const vm = getCurrentInstance()
|
|
170
|
-
const proxy = vm!.proxy!
|
|
171
|
-
|
|
172
|
+
setup(props) {
|
|
172
173
|
const inputModel = ref('')
|
|
173
174
|
const jsonEditorModel = ref(false)
|
|
174
175
|
|
|
175
|
-
const activeQuery = ref(
|
|
176
|
+
const activeQuery = ref({
|
|
177
|
+
name: 'New Query',
|
|
178
|
+
query: ''
|
|
179
|
+
})
|
|
176
180
|
const filtersModel = ref(false)
|
|
177
181
|
const removeQueryDialogBoxModel = ref(false)
|
|
178
182
|
const saveQueryDialogBoxModel = ref(false)
|
|
179
183
|
const newQueryName = ref('')
|
|
180
184
|
const isFocused = ref(false)
|
|
185
|
+
const isQuerying = ref(false)
|
|
186
|
+
|
|
187
|
+
let oldInputQuery = ''
|
|
181
188
|
|
|
182
189
|
const { suggestions, error, findSuggestions } = useSuggestions(
|
|
183
190
|
props.schema,
|
|
@@ -186,11 +193,30 @@ export default defineComponent({
|
|
|
186
193
|
|
|
187
194
|
const handleInputModel = (value: string) => {
|
|
188
195
|
inputModel.value = value
|
|
196
|
+
const json = JSON.stringify(toJSON(removeBrackets(value)))
|
|
197
|
+
activeQuery.value.query = replaceAliases(json, props.aliases)
|
|
198
|
+
findSuggestions(value)
|
|
199
|
+
isQuerying.value = false
|
|
200
|
+
oldInputQuery = value
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const toJSON = (value: string) => {
|
|
204
|
+
return parseSmartQuery(
|
|
205
|
+
replaceWithJsDates(value) ?? inputModel.value
|
|
206
|
+
)
|
|
189
207
|
}
|
|
190
208
|
|
|
191
209
|
const setFocused = (value: boolean) => {
|
|
192
210
|
isFocused.value = value
|
|
193
211
|
findSuggestions(inputModel.value)
|
|
212
|
+
|
|
213
|
+
if (value) {
|
|
214
|
+
inputModel.value = oldInputQuery
|
|
215
|
+
isQuerying.value = false
|
|
216
|
+
}
|
|
217
|
+
if (!value && !error) {
|
|
218
|
+
toJSON(inputModel.value)
|
|
219
|
+
}
|
|
194
220
|
}
|
|
195
221
|
|
|
196
222
|
return {
|
|
@@ -205,9 +231,11 @@ export default defineComponent({
|
|
|
205
231
|
error,
|
|
206
232
|
newQueryName,
|
|
207
233
|
isFocused,
|
|
234
|
+
isQuerying,
|
|
208
235
|
handleInputModel,
|
|
209
236
|
setFocused,
|
|
210
|
-
findSuggestions
|
|
237
|
+
findSuggestions,
|
|
238
|
+
toJSON
|
|
211
239
|
}
|
|
212
240
|
},
|
|
213
241
|
computed: {
|
|
@@ -232,10 +260,21 @@ export default defineComponent({
|
|
|
232
260
|
return createColorSchema(this.colorSchema, this.aliases)
|
|
233
261
|
},
|
|
234
262
|
computedStatus(): SearchStatus {
|
|
235
|
-
if (
|
|
263
|
+
if (this.isFocused) return
|
|
264
|
+
if (this.isQuerying) return
|
|
265
|
+
if (!this.error && this.inputModel !== '') {
|
|
266
|
+
return {
|
|
267
|
+
type: 'success',
|
|
268
|
+
message: ''
|
|
269
|
+
}
|
|
270
|
+
} else if (this.error === 'warning') {
|
|
271
|
+
return {
|
|
272
|
+
type: 'warning',
|
|
273
|
+
message: 'The query is not supported technically.'
|
|
274
|
+
}
|
|
275
|
+
} else if (this.inputModel === '') {
|
|
236
276
|
return this.status
|
|
237
277
|
}
|
|
238
|
-
|
|
239
278
|
return {
|
|
240
279
|
type: 'error',
|
|
241
280
|
message: this.error
|
|
@@ -247,22 +286,10 @@ export default defineComponent({
|
|
|
247
286
|
this.inputModel = `Query "${this.activeQuery.name}" ${
|
|
248
287
|
val ? 'is running' : ''
|
|
249
288
|
}`
|
|
250
|
-
|
|
251
|
-
inputModel(val) {
|
|
252
|
-
this.findSuggestions(val)
|
|
289
|
+
this.isQuerying = true
|
|
253
290
|
}
|
|
254
291
|
},
|
|
255
292
|
methods: {
|
|
256
|
-
handleQueryEdit(query: Query) {
|
|
257
|
-
this.activeQuery = query
|
|
258
|
-
this.jsonEditorModel = true
|
|
259
|
-
},
|
|
260
|
-
handleQuerySaveEditor(query: Query) {
|
|
261
|
-
this.filtersModel = false
|
|
262
|
-
this.activeQuery = query
|
|
263
|
-
this.newQueryName = query.name
|
|
264
|
-
this.saveQueryDialogBoxModel = true
|
|
265
|
-
},
|
|
266
293
|
handleQueryRemove(query: Query) {
|
|
267
294
|
this.filtersModel = false
|
|
268
295
|
this.activeQuery = query
|
|
@@ -273,11 +300,16 @@ export default defineComponent({
|
|
|
273
300
|
this.activeQuery = query
|
|
274
301
|
this.$emit('search-query', this.activeQuery)
|
|
275
302
|
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
303
|
+
handleSaveQuery(performSearch: boolean) {
|
|
304
|
+
if (performSearch) {
|
|
305
|
+
this.emitSaveQuery()
|
|
306
|
+
this.emitSearchQuery()
|
|
307
|
+
this.jsonEditorModel = false
|
|
308
|
+
} else {
|
|
309
|
+
this.emitSaveQuery()
|
|
280
310
|
}
|
|
311
|
+
},
|
|
312
|
+
emitSearchQuery() {
|
|
281
313
|
this.$emit('search-query', this.activeQuery)
|
|
282
314
|
},
|
|
283
315
|
emitRemoveQuery() {
|
|
@@ -289,14 +321,9 @@ export default defineComponent({
|
|
|
289
321
|
if (!this.activeQuery) return
|
|
290
322
|
if (this.newQueryName !== '')
|
|
291
323
|
this.activeQuery.name = this.newQueryName
|
|
292
|
-
this.$emit('save-query', this.activeQuery)
|
|
324
|
+
this.$emit('save-query', { ...this.activeQuery })
|
|
293
325
|
this.saveQueryDialogBoxModel = false
|
|
294
326
|
this.newQueryName = ''
|
|
295
|
-
},
|
|
296
|
-
handleSetActiveQuery(query: Query) {
|
|
297
|
-
this.filtersModel = false
|
|
298
|
-
this.activeQuery = query
|
|
299
|
-
this.inputModel = `Query "${query.name}"`
|
|
300
327
|
}
|
|
301
328
|
}
|
|
302
329
|
})
|
|
@@ -316,6 +343,16 @@ export default defineComponent({
|
|
|
316
343
|
display: flex;
|
|
317
344
|
margin: 0px 5px;
|
|
318
345
|
align-items: flex-start;
|
|
346
|
+
|
|
347
|
+
&--save {
|
|
348
|
+
display: flex;
|
|
349
|
+
width: 100%;
|
|
350
|
+
justify-content: flex-end;
|
|
351
|
+
align-items: center;
|
|
352
|
+
}
|
|
353
|
+
&--save > * {
|
|
354
|
+
margin: 0px 10px;
|
|
355
|
+
}
|
|
319
356
|
}
|
|
320
357
|
|
|
321
358
|
&__search-btn-wrapper {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<div :class="searchBarClasses">
|
|
8
8
|
<div class="dl-smart-search-input__status-icon-wrapper">
|
|
9
9
|
<dl-icon
|
|
10
|
-
v-if="withSearchIcon || status"
|
|
10
|
+
v-if="withSearchIcon || (!focused && status)"
|
|
11
11
|
:icon="statusIcon"
|
|
12
12
|
:color="statusIconColor"
|
|
13
13
|
size="18px"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
icon="icon-dl-save"
|
|
66
66
|
size="16px"
|
|
67
67
|
flat
|
|
68
|
-
:disabled="
|
|
68
|
+
:disabled="saveStatus"
|
|
69
69
|
@click="save"
|
|
70
70
|
>
|
|
71
71
|
<dl-tooltip> Save Query </dl-tooltip>
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
icon="icon-dl-loop"
|
|
75
75
|
size="16px"
|
|
76
76
|
flat
|
|
77
|
+
transform="none"
|
|
77
78
|
text-color="dl-color-darker"
|
|
78
|
-
:disabled="
|
|
79
|
-
|
|
80
|
-
label="dql"
|
|
79
|
+
:disabled="saveStatus"
|
|
80
|
+
label="switch to DQL"
|
|
81
81
|
@click="edit"
|
|
82
82
|
>
|
|
83
83
|
<dl-tooltip> Switch to DQL </dl-tooltip>
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
</div>
|
|
87
87
|
</div>
|
|
88
88
|
<label
|
|
89
|
-
v-
|
|
89
|
+
v-if="status.message !== 'info'"
|
|
90
90
|
ref="label"
|
|
91
91
|
class="dl-smart-search-input__search-label"
|
|
92
92
|
for="search-input"
|
|
@@ -131,10 +131,10 @@ import { DateInterval } from '../../../DlDateTime/types'
|
|
|
131
131
|
import {
|
|
132
132
|
isEndingWithDateIntervalPattern,
|
|
133
133
|
replaceDateInterval,
|
|
134
|
-
isEligibleToChange,
|
|
135
134
|
setCaret,
|
|
136
135
|
updateEditor
|
|
137
136
|
} from '../utils'
|
|
137
|
+
import { isEligibleToChange } from '../utils/utils'
|
|
138
138
|
|
|
139
139
|
export default defineComponent({
|
|
140
140
|
components: {
|
|
@@ -312,13 +312,13 @@ export default defineComponent({
|
|
|
312
312
|
searchBarClasses(): string {
|
|
313
313
|
let classes = 'dl-smart-search-input__search-bar'
|
|
314
314
|
|
|
315
|
-
if (this.status.type === '
|
|
316
|
-
classes += ' dl-smart-search-input__search-bar--
|
|
317
|
-
} else if (this.status.type === 'warning') {
|
|
318
|
-
classes += ' dl-smart-search-input__search-bar--warning'
|
|
315
|
+
if (this.focused && this.status.type === 'info') {
|
|
316
|
+
classes += ' dl-smart-search-input__search-bar--focused'
|
|
319
317
|
} else {
|
|
320
|
-
if (this.
|
|
321
|
-
classes += ' dl-smart-search-input__search-bar--
|
|
318
|
+
if (this.status.type === 'error') {
|
|
319
|
+
classes += ' dl-smart-search-input__search-bar--error'
|
|
320
|
+
} else if (this.status.type === 'warning') {
|
|
321
|
+
classes += ' dl-smart-search-input__search-bar--warning'
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
|
|
@@ -355,6 +355,13 @@ export default defineComponent({
|
|
|
355
355
|
this.expandedInputHeight,
|
|
356
356
|
'--dl-smart-search-input-height': this.inputHeight
|
|
357
357
|
}
|
|
358
|
+
},
|
|
359
|
+
saveStatus() {
|
|
360
|
+
return (
|
|
361
|
+
this.disabled ||
|
|
362
|
+
!this.modelValue ||
|
|
363
|
+
this.status.type === 'error'
|
|
364
|
+
)
|
|
358
365
|
}
|
|
359
366
|
},
|
|
360
367
|
watch: {
|
package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue
CHANGED
|
@@ -9,14 +9,20 @@
|
|
|
9
9
|
:disabled="disabled"
|
|
10
10
|
fit-container
|
|
11
11
|
:model-value="modelValue"
|
|
12
|
-
|
|
12
|
+
:arrow-nav-items="suggestions"
|
|
13
|
+
@update:modelValue="emitModelValue($event)"
|
|
14
|
+
@show="onShow"
|
|
15
|
+
@hide="onHide"
|
|
16
|
+
@highlightedIndex="setHighlightedIndex"
|
|
17
|
+
@handleSelectedItem="handleSelectedItem"
|
|
13
18
|
>
|
|
14
19
|
<dl-list>
|
|
15
20
|
<dl-list-item
|
|
16
|
-
v-for="item in suggestions"
|
|
21
|
+
v-for="(item, suggestionIndex) in suggestions"
|
|
17
22
|
:key="item"
|
|
18
23
|
:clickable="true"
|
|
19
|
-
|
|
24
|
+
:is-highlighted="suggestionIndex === highlightedIndex"
|
|
25
|
+
@click="handleOption(item)"
|
|
20
26
|
>
|
|
21
27
|
{{ item }}
|
|
22
28
|
</dl-list-item>
|
|
@@ -25,7 +31,7 @@
|
|
|
25
31
|
</div>
|
|
26
32
|
</template>
|
|
27
33
|
<script lang="ts">
|
|
28
|
-
import { defineComponent, PropType } from 'vue-demi'
|
|
34
|
+
import { defineComponent, PropType, ref } from 'vue-demi'
|
|
29
35
|
import { DlMenu, DlList } from '../../../../essential'
|
|
30
36
|
import { DlListItem } from '../../../../basic'
|
|
31
37
|
|
|
@@ -62,6 +68,39 @@ export default defineComponent({
|
|
|
62
68
|
}
|
|
63
69
|
},
|
|
64
70
|
emits: ['set-input-value', 'update:modelValue'],
|
|
71
|
+
setup(props, { emit }) {
|
|
72
|
+
const isMenuOpen = ref(false)
|
|
73
|
+
const highlightedIndex = ref(-1)
|
|
74
|
+
const onShow = (value: any) => {
|
|
75
|
+
isMenuOpen.value = !!value
|
|
76
|
+
}
|
|
77
|
+
const onHide = (value: any) => {
|
|
78
|
+
isMenuOpen.value = !value
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const setHighlightedIndex = (value: any) => {
|
|
82
|
+
highlightedIndex.value = value
|
|
83
|
+
}
|
|
84
|
+
const handleSelectedItem = (value: any) => {
|
|
85
|
+
handleOption(value)
|
|
86
|
+
}
|
|
87
|
+
const emitModelValue = (event: any) => {
|
|
88
|
+
emit('update:modelValue', event)
|
|
89
|
+
}
|
|
90
|
+
const handleOption = (item: any) => {
|
|
91
|
+
emit('set-input-value', item)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
setHighlightedIndex,
|
|
96
|
+
handleSelectedItem,
|
|
97
|
+
highlightedIndex,
|
|
98
|
+
onShow,
|
|
99
|
+
onHide,
|
|
100
|
+
emitModelValue,
|
|
101
|
+
handleOption
|
|
102
|
+
}
|
|
103
|
+
},
|
|
65
104
|
computed: {
|
|
66
105
|
defaultTarget() {
|
|
67
106
|
return '.dl-smart-search-input__textarea'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ColorSchema, SyntaxColorSchema } from '../types'
|
|
1
|
+
import { SyntaxColorSchema } from '../types'
|
|
3
2
|
|
|
4
3
|
let editor = document.getElementById('editor')
|
|
5
4
|
let styleModel: SyntaxColorSchema
|
|
@@ -112,56 +111,3 @@ export function setCaret(target: HTMLElement) {
|
|
|
112
111
|
sel.addRange(range)
|
|
113
112
|
target.focus()
|
|
114
113
|
}
|
|
115
|
-
|
|
116
|
-
export const isEligibleToChange = (target: HTMLElement, expanded: boolean) => {
|
|
117
|
-
let childOffsetRight = 0
|
|
118
|
-
let childOffsetBottom = 20
|
|
119
|
-
|
|
120
|
-
if (target?.lastChild) {
|
|
121
|
-
const range = document.createRange()
|
|
122
|
-
range.selectNode(target?.lastChild)
|
|
123
|
-
childOffsetRight =
|
|
124
|
-
range.getBoundingClientRect().right -
|
|
125
|
-
target.getBoundingClientRect().left
|
|
126
|
-
childOffsetBottom =
|
|
127
|
-
range.getBoundingClientRect().bottom -
|
|
128
|
-
target.getBoundingClientRect().top +
|
|
129
|
-
5
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (childOffsetRight <= target.clientWidth) {
|
|
133
|
-
return [-childOffsetRight, 5]
|
|
134
|
-
} else {
|
|
135
|
-
return [-target.clientWidth, 5]
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export function createColorSchema(
|
|
140
|
-
colorSchema: ColorSchema,
|
|
141
|
-
aliases: Alias[]
|
|
142
|
-
): SyntaxColorSchema {
|
|
143
|
-
const thisFields = []
|
|
144
|
-
for (const key in aliases) {
|
|
145
|
-
thisFields.push(aliases[key].alias)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const thisOperators = []
|
|
149
|
-
for (const key in operators) {
|
|
150
|
-
thisOperators.push(operators[key])
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return {
|
|
154
|
-
fields: {
|
|
155
|
-
values: thisFields,
|
|
156
|
-
color: colorSchema.fields
|
|
157
|
-
},
|
|
158
|
-
operators: {
|
|
159
|
-
values: thisOperators,
|
|
160
|
-
color: colorSchema.operators
|
|
161
|
-
},
|
|
162
|
-
keywords: {
|
|
163
|
-
values: ['OR', 'AND'],
|
|
164
|
-
color: colorSchema.keywords
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|