@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
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
>
|
|
6
6
|
<div class="dl-pagination--container">
|
|
7
7
|
<rows-selector
|
|
8
|
-
v-if="withRowsPerPage"
|
|
8
|
+
v-if="withRowsPerPage && rowsPerPageState"
|
|
9
9
|
v-model="rowsPerPageState"
|
|
10
10
|
:options="rowsPerPageOptions"
|
|
11
11
|
:items-name="itemsName"
|
|
12
12
|
:disabled="disabled"
|
|
13
13
|
/>
|
|
14
|
-
<div
|
|
14
|
+
<div
|
|
15
|
+
v-if="rowsPerPageState"
|
|
16
|
+
class="dl-pagination--navigation"
|
|
17
|
+
>
|
|
15
18
|
<page-navigation
|
|
16
19
|
:model-value="value"
|
|
17
20
|
:min="min"
|
|
@@ -95,7 +98,7 @@ export default defineComponent({
|
|
|
95
98
|
directionLinks: Boolean,
|
|
96
99
|
color: {
|
|
97
100
|
type: String,
|
|
98
|
-
default: 'dl-color-
|
|
101
|
+
default: 'dl-color-transparent'
|
|
99
102
|
},
|
|
100
103
|
textColor: {
|
|
101
104
|
type: String,
|
|
@@ -135,10 +138,17 @@ export default defineComponent({
|
|
|
135
138
|
},
|
|
136
139
|
rowTo(): number {
|
|
137
140
|
const to = this.rowsPerPageState * this.value
|
|
141
|
+
|
|
142
|
+
if (to === 0) {
|
|
143
|
+
return this.totalItems
|
|
144
|
+
}
|
|
145
|
+
|
|
138
146
|
return to > this.totalItems ? this.totalItems : to
|
|
139
147
|
},
|
|
140
148
|
max(): number {
|
|
141
|
-
return
|
|
149
|
+
return this.rowsPerPageState === 0
|
|
150
|
+
? 1
|
|
151
|
+
: Math.ceil(this.totalItems / this.rowsPerPageState)
|
|
142
152
|
}
|
|
143
153
|
},
|
|
144
154
|
watch: {
|
|
@@ -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 {
|