@dataloop-ai/components 0.16.62 → 0.17.0
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 +1 -1
- package/src/components/basic/DlAlert/DlAlert.vue +7 -8
- package/src/components/basic/DlButton/DlButton.vue +33 -11
- package/src/components/basic/DlButton/utils.ts +12 -2
- package/src/components/basic/DlChip/DlChip.vue +1 -8
- package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +5 -5
- package/src/components/compound/DlCharts/charts/DlConfusionMatrix/utils.ts +6 -2
- package/src/components/compound/DlDialogBox/DlDialogBox.vue +3 -3
- package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +21 -15
- package/src/components/compound/DlDropdownButton/components/ButtonGroup.vue +11 -9
- package/src/components/compound/DlInput/DlInput.vue +7 -7
- package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +14 -14
- package/src/components/compound/DlPagination/components/PageNavigation.vue +21 -21
- package/src/components/compound/DlRange/DlRange.vue +1 -1
- package/src/components/compound/DlSearches/DlSearch/DlSearch.vue +3 -3
- package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +132 -42
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchFilters.vue +75 -0
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +183 -173
- package/src/components/compound/DlSearches/DlSmartSearch/components/FiltersQuery.vue +101 -0
- package/src/components/compound/DlSearches/DlSmartSearch/types.ts +4 -4
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +9 -4
- package/src/components/compound/DlSearches/DlSmartSearch/utils/utils.ts +18 -1
- package/src/components/compound/DlSelect/DlSelect.vue +3 -4
- package/src/components/compound/DlSlider/DlSlider.vue +1 -1
- package/src/components/compound/DlStepper/DlStepper.vue +2 -2
- package/src/components/compound/DlStepper/components/DlStepperFooter.vue +3 -3
- package/src/components/compound/DlStepper/components/DlStepperHeader.vue +2 -2
- package/src/components/compound/DlTabs/components/TabsWrapper.vue +1 -1
- package/src/components/compound/DlToggleButton/DlToggleButton.vue +14 -11
- package/src/components/essential/DlIcon/DlIcon.vue +1 -1
- package/src/components/essential/DlSpinner/styles/spinnerStyles.scss +1 -1
- package/src/components/essential/DlTypography/DlTypography.vue +18 -2
- package/src/components/shared/types.ts +7 -1
- package/src/demos/DlAlertDemo.vue +17 -3
- package/src/demos/DlDialogBoxDemo.vue +15 -1
- package/src/demos/DlDropdownButtonDemo.vue +4 -4
- package/src/demos/DlSearchDemo.vue +1 -1
- package/src/demos/DlStepperDemo/SimpleStepper.vue +1 -1
- package/src/demos/DlStepperDemo/steps/DataStep.vue +1 -1
- package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +40 -75
- package/src/hooks/use-suggestions.ts +8 -3
- package/src/utils/parse-smart-query.ts +109 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
>
|
|
6
6
|
<button
|
|
7
7
|
v-if="boundaryLinks"
|
|
8
|
-
class="dl-pagination--
|
|
8
|
+
class="dl-pagination--nav_button"
|
|
9
9
|
:disabled="disabled || isFirstPage"
|
|
10
10
|
@click="setPage(min)"
|
|
11
11
|
>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</button>
|
|
17
17
|
<button
|
|
18
18
|
v-if="directionLinks"
|
|
19
|
-
class="dl-pagination--
|
|
19
|
+
class="dl-pagination--nav_button"
|
|
20
20
|
:disabled="disabled || isFirstPage"
|
|
21
21
|
@click="setPage(value - 1)"
|
|
22
22
|
>
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
size="16px"
|
|
26
26
|
/>
|
|
27
27
|
</button>
|
|
28
|
-
<div class="dl-pagination--
|
|
28
|
+
<div class="dl-pagination--page_buttons_wrapper">
|
|
29
29
|
<button
|
|
30
30
|
v-if="boundaryNumbers"
|
|
31
|
-
class="dl-pagination--
|
|
31
|
+
class="dl-pagination--page_button"
|
|
32
32
|
:class="{ 'dl-pagination--active': isActivePage(min) }"
|
|
33
33
|
:disabled="disabled"
|
|
34
34
|
@click="setPage(min)"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
</button>
|
|
38
38
|
<button
|
|
39
39
|
v-if="ellipsesStart"
|
|
40
|
-
class="dl-pagination--
|
|
40
|
+
class="dl-pagination--page_button"
|
|
41
41
|
:disabled="disabled"
|
|
42
42
|
@click="setPage(pgFrom - 1)"
|
|
43
43
|
>
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
<button
|
|
48
48
|
v-for="page in pages"
|
|
49
49
|
:key="page"
|
|
50
|
-
class="dl-pagination--
|
|
50
|
+
class="dl-pagination--page_button"
|
|
51
51
|
:class="{
|
|
52
52
|
'dl-pagination--active': isActivePage(page),
|
|
53
53
|
active: isActivePage(page)
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
</template>
|
|
61
61
|
<button
|
|
62
62
|
v-if="ellipsesEnd"
|
|
63
|
-
class="dl-pagination--
|
|
63
|
+
class="dl-pagination--page_button"
|
|
64
64
|
:disabled="disabled"
|
|
65
65
|
@click="setPage(pgTo + 1)"
|
|
66
66
|
>
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
</button>
|
|
69
69
|
<button
|
|
70
70
|
v-if="boundaryNumbers && min !== max"
|
|
71
|
-
class="dl-pagination--
|
|
71
|
+
class="dl-pagination--page_button"
|
|
72
72
|
:class="{ 'dl-pagination--active': isActivePage(max) }"
|
|
73
73
|
:disabled="disabled"
|
|
74
74
|
@click="setPage(max)"
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
</div>
|
|
79
79
|
<button
|
|
80
80
|
v-if="directionLinks"
|
|
81
|
-
class="dl-pagination--
|
|
81
|
+
class="dl-pagination--nav_button"
|
|
82
82
|
:disabled="disabled || isLastPage"
|
|
83
83
|
@click="setPage(value + 1)"
|
|
84
84
|
>
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
</button>
|
|
90
90
|
<button
|
|
91
91
|
v-if="boundaryLinks"
|
|
92
|
-
class="dl-pagination--
|
|
92
|
+
class="dl-pagination--nav_button"
|
|
93
93
|
:disabled="disabled || isLastPage"
|
|
94
94
|
@click="setPage(max)"
|
|
95
95
|
>
|
|
@@ -172,16 +172,16 @@ export default defineComponent({
|
|
|
172
172
|
isLastPage(): boolean {
|
|
173
173
|
return this.value === this.max
|
|
174
174
|
},
|
|
175
|
-
|
|
175
|
+
buttonMinWidth(): string {
|
|
176
176
|
return `${Math.max(2, String(this.max).length)}em`
|
|
177
177
|
},
|
|
178
178
|
cssVars(): Record<string, any> {
|
|
179
179
|
return {
|
|
180
|
-
'--dl-
|
|
180
|
+
'--dl-button-bg-color': getColor(
|
|
181
181
|
this.color,
|
|
182
182
|
'dl-color-transparent'
|
|
183
183
|
),
|
|
184
|
-
'--dl-active-
|
|
184
|
+
'--dl-active-button-bg-color': getColor(
|
|
185
185
|
this.activeColor,
|
|
186
186
|
'dl-color-secondary'
|
|
187
187
|
),
|
|
@@ -190,7 +190,7 @@ export default defineComponent({
|
|
|
190
190
|
this.activeTextColor,
|
|
191
191
|
'dl-color-text-buttons'
|
|
192
192
|
),
|
|
193
|
-
'--dl-
|
|
193
|
+
'--dl-button-min-width': this.buttonMinWidth
|
|
194
194
|
}
|
|
195
195
|
},
|
|
196
196
|
pages(): number[] {
|
|
@@ -285,13 +285,13 @@ export default defineComponent({
|
|
|
285
285
|
padding: 0 16px;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
&--
|
|
288
|
+
&--page_buttons_wrapper {
|
|
289
289
|
display: flex;
|
|
290
290
|
padding-left: 10px;
|
|
291
291
|
padding-right: 10px;
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
&--
|
|
294
|
+
&--page_button {
|
|
295
295
|
text-align: center;
|
|
296
296
|
width: 20px;
|
|
297
297
|
height: 20px;
|
|
@@ -305,18 +305,18 @@ export default defineComponent({
|
|
|
305
305
|
|
|
306
306
|
&--active {
|
|
307
307
|
color: var(--dl-active-text-color) !important;
|
|
308
|
-
background-color: var(--dl-active-
|
|
308
|
+
background-color: var(--dl-active-button-bg-color) !important;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
&--
|
|
312
|
-
&--
|
|
313
|
-
min-width: var(--dl-
|
|
311
|
+
&--page_button,
|
|
312
|
+
&--nav_button {
|
|
313
|
+
min-width: var(--dl-button-min-width);
|
|
314
314
|
padding: 0;
|
|
315
315
|
cursor: pointer;
|
|
316
316
|
border: none;
|
|
317
317
|
border-radius: 2px;
|
|
318
318
|
color: var(--dl-text-color);
|
|
319
|
-
background-color: var(--dl-
|
|
319
|
+
background-color: var(--dl-button-bg-color);
|
|
320
320
|
|
|
321
321
|
&:active:not(:disabled) {
|
|
322
322
|
background-color: var(--dl-color-secondary);
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
</template>
|
|
33
33
|
</dl-input>
|
|
34
34
|
<dl-button
|
|
35
|
-
v-show="
|
|
35
|
+
v-show="withSearchButton"
|
|
36
36
|
padding="9px 16px"
|
|
37
37
|
style="width: 20%; min-width: fit-content"
|
|
38
38
|
:size="size"
|
|
@@ -82,7 +82,7 @@ export default defineComponent({
|
|
|
82
82
|
},
|
|
83
83
|
highlightMatches: { type: Boolean, default: false },
|
|
84
84
|
dense: { type: Boolean, default: false },
|
|
85
|
-
|
|
85
|
+
withSearchButton: { type: Boolean, default: false },
|
|
86
86
|
suggestMenuWidth: { type: String, default: 'auto' }
|
|
87
87
|
},
|
|
88
88
|
emits: [
|
|
@@ -107,7 +107,7 @@ export default defineComponent({
|
|
|
107
107
|
return [`button--${this.size}`]
|
|
108
108
|
},
|
|
109
109
|
rootVars(): Record<string, any> {
|
|
110
|
-
return this.
|
|
110
|
+
return this.withSearchButton
|
|
111
111
|
? {
|
|
112
112
|
'--dl-search-text-input-margin': '0 20px 0 0'
|
|
113
113
|
}
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
class="dl-smart-search"
|
|
5
5
|
:style="cssVars"
|
|
6
6
|
>
|
|
7
|
-
<div
|
|
7
|
+
<div
|
|
8
|
+
ref="inputWrapper"
|
|
9
|
+
class="dl-smart-search__input-wrapper"
|
|
10
|
+
>
|
|
8
11
|
<dl-smart-search-input
|
|
9
12
|
:status="computedStatus"
|
|
10
13
|
:style-model="defineStyleModel"
|
|
@@ -15,6 +18,8 @@
|
|
|
15
18
|
:model-value="inputModel"
|
|
16
19
|
:expanded-input-height="expandedInputHeight"
|
|
17
20
|
:suggestions="suggestions"
|
|
21
|
+
:search-bar-width="searchBarWidth"
|
|
22
|
+
:default-width="width"
|
|
18
23
|
@save="saveQueryDialogBoxModel = true"
|
|
19
24
|
@focus="setFocused"
|
|
20
25
|
@update:modelValue="handleInputModel"
|
|
@@ -22,23 +27,49 @@
|
|
|
22
27
|
/>
|
|
23
28
|
</div>
|
|
24
29
|
<div class="dl-smart-search__buttons">
|
|
25
|
-
<div
|
|
30
|
+
<div
|
|
31
|
+
style="height: 28px"
|
|
32
|
+
class="dl-smart-search__search-btn-wrapper"
|
|
33
|
+
>
|
|
26
34
|
<dl-button
|
|
27
35
|
icon="icon-dl-search"
|
|
28
|
-
|
|
36
|
+
:styles="{
|
|
37
|
+
height: '28px'
|
|
38
|
+
}"
|
|
29
39
|
:disabled="disabled"
|
|
30
40
|
@click="emitSearchQuery"
|
|
31
41
|
/>
|
|
32
42
|
</div>
|
|
43
|
+
|
|
44
|
+
<dl-button
|
|
45
|
+
class="dl-smart-search__buttons--filters"
|
|
46
|
+
shaded
|
|
47
|
+
size="s"
|
|
48
|
+
>
|
|
49
|
+
Saved Filters
|
|
50
|
+
<dl-menu
|
|
51
|
+
v-model="filtersModel"
|
|
52
|
+
:offset="[0, 5]"
|
|
53
|
+
anchor="bottom middle"
|
|
54
|
+
self="top middle"
|
|
55
|
+
>
|
|
56
|
+
<dl-smart-search-filters
|
|
57
|
+
:filters="filters"
|
|
58
|
+
@filters-select="handleFiltersSelect"
|
|
59
|
+
@filters-delete="handleFiltersDelete"
|
|
60
|
+
/>
|
|
61
|
+
</dl-menu>
|
|
62
|
+
</dl-button>
|
|
33
63
|
</div>
|
|
34
64
|
<dl-json-editor
|
|
35
65
|
:model-value="jsonEditorModel"
|
|
36
66
|
:query="activeQuery"
|
|
37
|
-
:queries="
|
|
67
|
+
:queries="filters.saved"
|
|
38
68
|
@update:modelValue="jsonEditorModel = $event"
|
|
39
69
|
@save="saveQueryDialogBoxModel = true"
|
|
40
70
|
@remove="handleQueryRemove"
|
|
41
71
|
@search="handleQuerySearchEditor"
|
|
72
|
+
@update-query="handleEditorQueryUpdate"
|
|
42
73
|
/>
|
|
43
74
|
<dl-dialog-box v-model="removeQueryDialogBoxModel">
|
|
44
75
|
<template #header>
|
|
@@ -96,10 +127,11 @@
|
|
|
96
127
|
<script lang="ts">
|
|
97
128
|
import { defineComponent, PropType, ref } from 'vue-demi'
|
|
98
129
|
import DlSmartSearchInput from './components/DlSmartSearchInput.vue'
|
|
130
|
+
import DlSmartSearchFilters from './components/DlSmartSearchFilters.vue'
|
|
99
131
|
import { DlJsonEditor } from '../../DlJsonEditor'
|
|
100
132
|
import { DlDialogBox, DlDialogBoxHeader } from '../../DlDialogBox'
|
|
101
133
|
import { DlInput } from '../../DlInput'
|
|
102
|
-
import { DlTypography } from '../../../essential'
|
|
134
|
+
import { DlTypography, DlMenu } from '../../../essential'
|
|
103
135
|
import { DlButton } from '../../../basic'
|
|
104
136
|
import {
|
|
105
137
|
useSuggestions,
|
|
@@ -107,14 +139,14 @@ import {
|
|
|
107
139
|
Alias,
|
|
108
140
|
removeBrackets
|
|
109
141
|
} from '../../../../hooks/use-suggestions'
|
|
110
|
-
import {
|
|
142
|
+
import { Filters, Query, ColorSchema, SearchStatus } from './types'
|
|
111
143
|
import {
|
|
112
144
|
replaceAliases,
|
|
113
145
|
replaceWithJsDates,
|
|
114
146
|
createColorSchema
|
|
115
147
|
} from './utils/utils'
|
|
116
148
|
import { v4 } from 'uuid'
|
|
117
|
-
import { parseSmartQuery } from '../../../../utils'
|
|
149
|
+
import { parseSmartQuery, stringifySmartQuery } from '../../../../utils'
|
|
118
150
|
|
|
119
151
|
export default defineComponent({
|
|
120
152
|
components: {
|
|
@@ -124,7 +156,9 @@ export default defineComponent({
|
|
|
124
156
|
DlJsonEditor,
|
|
125
157
|
DlButton,
|
|
126
158
|
DlTypography,
|
|
127
|
-
DlInput
|
|
159
|
+
DlInput,
|
|
160
|
+
DlSmartSearchFilters,
|
|
161
|
+
DlMenu
|
|
128
162
|
},
|
|
129
163
|
props: {
|
|
130
164
|
status: {
|
|
@@ -160,18 +194,23 @@ export default defineComponent({
|
|
|
160
194
|
default: 'saved'
|
|
161
195
|
},
|
|
162
196
|
filters: {
|
|
163
|
-
type:
|
|
164
|
-
default: () =>
|
|
197
|
+
type: Object as PropType<Filters>,
|
|
198
|
+
default: () => ({} as Filters)
|
|
165
199
|
},
|
|
166
200
|
disabled: {
|
|
167
201
|
type: Boolean,
|
|
168
202
|
default: false
|
|
203
|
+
},
|
|
204
|
+
width: {
|
|
205
|
+
type: String,
|
|
206
|
+
default: '450px'
|
|
169
207
|
}
|
|
170
208
|
},
|
|
171
209
|
emits: ['save-query', 'remove-query', 'search-query'],
|
|
172
210
|
setup(props) {
|
|
173
211
|
const inputModel = ref('')
|
|
174
212
|
const jsonEditorModel = ref(false)
|
|
213
|
+
const searchBarWidth = ref('100%')
|
|
175
214
|
|
|
176
215
|
const activeQuery = ref({
|
|
177
216
|
name: 'New Query',
|
|
@@ -183,8 +222,8 @@ export default defineComponent({
|
|
|
183
222
|
const newQueryName = ref('')
|
|
184
223
|
const isFocused = ref(false)
|
|
185
224
|
const isQuerying = ref(false)
|
|
186
|
-
|
|
187
|
-
|
|
225
|
+
const currentTab = ref('saved')
|
|
226
|
+
const oldInputQuery = ref('')
|
|
188
227
|
|
|
189
228
|
const { suggestions, error, findSuggestions } = useSuggestions(
|
|
190
229
|
props.schema,
|
|
@@ -197,7 +236,7 @@ export default defineComponent({
|
|
|
197
236
|
activeQuery.value.query = replaceAliases(json, props.aliases)
|
|
198
237
|
findSuggestions(value)
|
|
199
238
|
isQuerying.value = false
|
|
200
|
-
oldInputQuery = value
|
|
239
|
+
oldInputQuery.value = value
|
|
201
240
|
}
|
|
202
241
|
|
|
203
242
|
const toJSON = (value: string) => {
|
|
@@ -211,7 +250,7 @@ export default defineComponent({
|
|
|
211
250
|
findSuggestions(inputModel.value)
|
|
212
251
|
|
|
213
252
|
if (value) {
|
|
214
|
-
inputModel.value = oldInputQuery
|
|
253
|
+
inputModel.value = oldInputQuery.value
|
|
215
254
|
isQuerying.value = false
|
|
216
255
|
}
|
|
217
256
|
if (!value && !error) {
|
|
@@ -232,6 +271,9 @@ export default defineComponent({
|
|
|
232
271
|
newQueryName,
|
|
233
272
|
isFocused,
|
|
234
273
|
isQuerying,
|
|
274
|
+
currentTab,
|
|
275
|
+
searchBarWidth,
|
|
276
|
+
oldInputQuery,
|
|
235
277
|
handleInputModel,
|
|
236
278
|
setFocused,
|
|
237
279
|
findSuggestions,
|
|
@@ -242,25 +284,18 @@ export default defineComponent({
|
|
|
242
284
|
identifierClass(): string {
|
|
243
285
|
return `dl-smart-search`
|
|
244
286
|
},
|
|
245
|
-
savedQueries(): Query[] {
|
|
246
|
-
return (
|
|
247
|
-
this.filters.find(
|
|
248
|
-
(filter: Filter) => filter.name === this.savedFilterKey
|
|
249
|
-
) || {
|
|
250
|
-
queries: []
|
|
251
|
-
}
|
|
252
|
-
).queries
|
|
253
|
-
},
|
|
254
287
|
cssVars(): Record<string, string> {
|
|
255
288
|
return {
|
|
256
|
-
'--dl-search-max-width': this.isFocused ? '100%' :
|
|
289
|
+
'--dl-search-max-width': this.isFocused ? '100%' : this.width
|
|
257
290
|
}
|
|
258
291
|
},
|
|
259
|
-
defineStyleModel():
|
|
260
|
-
return createColorSchema(
|
|
292
|
+
defineStyleModel(): Record<string, string> {
|
|
293
|
+
return createColorSchema(
|
|
294
|
+
this.colorSchema,
|
|
295
|
+
this.aliases
|
|
296
|
+
) as any as Record<string, string>
|
|
261
297
|
},
|
|
262
298
|
computedStatus(): SearchStatus {
|
|
263
|
-
if (this.isFocused) return
|
|
264
299
|
if (this.isQuerying) return
|
|
265
300
|
if (!this.error && this.inputModel !== '') {
|
|
266
301
|
return {
|
|
@@ -279,15 +314,18 @@ export default defineComponent({
|
|
|
279
314
|
type: 'error',
|
|
280
315
|
message: this.error
|
|
281
316
|
}
|
|
317
|
+
},
|
|
318
|
+
stringQuery(): string {
|
|
319
|
+
return this.isQuerying || this.inputModel === ''
|
|
320
|
+
? this.activeQuery.name
|
|
321
|
+
: this.inputModel
|
|
282
322
|
}
|
|
283
323
|
},
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
this.
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
this.isQuerying = true
|
|
290
|
-
}
|
|
324
|
+
mounted() {
|
|
325
|
+
const observer = new ResizeObserver((entries) => {
|
|
326
|
+
this.searchBarWidth = `${entries[0].contentRect.width}px`
|
|
327
|
+
})
|
|
328
|
+
observer.observe(this.$refs.inputWrapper as HTMLElement)
|
|
291
329
|
},
|
|
292
330
|
methods: {
|
|
293
331
|
handleQueryRemove(query: Query) {
|
|
@@ -298,10 +336,11 @@ export default defineComponent({
|
|
|
298
336
|
handleQuerySearchEditor(query: Query) {
|
|
299
337
|
this.filtersModel = false
|
|
300
338
|
this.activeQuery = query
|
|
301
|
-
this
|
|
339
|
+
this.oldInputQuery = query.query
|
|
340
|
+
this.$emit('search-query', this.activeQuery, this.stringQuery)
|
|
302
341
|
},
|
|
303
342
|
handleSaveQuery(performSearch: boolean) {
|
|
304
|
-
if (performSearch) {
|
|
343
|
+
if (performSearch === true) {
|
|
305
344
|
this.emitSaveQuery()
|
|
306
345
|
this.emitSearchQuery()
|
|
307
346
|
this.jsonEditorModel = false
|
|
@@ -309,19 +348,48 @@ export default defineComponent({
|
|
|
309
348
|
this.emitSaveQuery()
|
|
310
349
|
}
|
|
311
350
|
},
|
|
351
|
+
handleEditorQueryUpdate(query: Query) {
|
|
352
|
+
this.activeQuery = query
|
|
353
|
+
try {
|
|
354
|
+
const stringQuery = stringifySmartQuery(JSON.parse(query.query))
|
|
355
|
+
this.inputModel = stringQuery
|
|
356
|
+
this.oldInputQuery = stringQuery
|
|
357
|
+
} catch (error) {
|
|
358
|
+
console.log(error)
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
handleFiltersDelete(currentTab: string, query: Query) {
|
|
362
|
+
this.activeQuery = query
|
|
363
|
+
this.currentTab = currentTab
|
|
364
|
+
this.removeQueryDialogBoxModel = true
|
|
365
|
+
this.filtersModel = false
|
|
366
|
+
},
|
|
367
|
+
handleFiltersSelect(currentTab: string, query: Query) {
|
|
368
|
+
this.activeQuery = { ...query }
|
|
369
|
+
const stringQuery = stringifySmartQuery(JSON.parse(query.query))
|
|
370
|
+
this.oldInputQuery = stringQuery
|
|
371
|
+
this.inputModel = stringQuery
|
|
372
|
+
this.currentTab = currentTab
|
|
373
|
+
this.filtersModel = false
|
|
374
|
+
},
|
|
312
375
|
emitSearchQuery() {
|
|
313
|
-
this.$emit('search-query', this.activeQuery)
|
|
376
|
+
this.$emit('search-query', this.activeQuery, this.stringQuery)
|
|
314
377
|
},
|
|
315
378
|
emitRemoveQuery() {
|
|
316
379
|
if (!this.activeQuery) return
|
|
317
|
-
this.$emit(
|
|
380
|
+
this.$emit(
|
|
381
|
+
'remove-query',
|
|
382
|
+
this.activeQuery,
|
|
383
|
+
this.currentTab,
|
|
384
|
+
this.inputModel
|
|
385
|
+
)
|
|
318
386
|
this.removeQueryDialogBoxModel = false
|
|
319
387
|
},
|
|
320
388
|
emitSaveQuery() {
|
|
321
389
|
if (!this.activeQuery) return
|
|
322
390
|
if (this.newQueryName !== '')
|
|
323
391
|
this.activeQuery.name = this.newQueryName
|
|
324
|
-
this.$emit('save-query', { ...this.activeQuery })
|
|
392
|
+
this.$emit('save-query', { ...this.activeQuery }, this.currentTab)
|
|
325
393
|
this.saveQueryDialogBoxModel = false
|
|
326
394
|
this.newQueryName = ''
|
|
327
395
|
}
|
|
@@ -333,7 +401,13 @@ export default defineComponent({
|
|
|
333
401
|
display: flex;
|
|
334
402
|
width: 100%;
|
|
335
403
|
|
|
404
|
+
&__inner {
|
|
405
|
+
display: flex;
|
|
406
|
+
height: 28px;
|
|
407
|
+
}
|
|
408
|
+
|
|
336
409
|
&__input-wrapper {
|
|
410
|
+
flex-grow: 1;
|
|
337
411
|
width: 100%;
|
|
338
412
|
max-width: var(--dl-search-max-width);
|
|
339
413
|
transition: max-width 0.3s ease-out;
|
|
@@ -341,9 +415,16 @@ export default defineComponent({
|
|
|
341
415
|
|
|
342
416
|
&__buttons {
|
|
343
417
|
display: flex;
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
418
|
+
align-items: center;
|
|
419
|
+
margin-left: 8px;
|
|
420
|
+
margin-top: 1px;
|
|
421
|
+
&--filters {
|
|
422
|
+
min-width: fit-content;
|
|
423
|
+
border-radius: 3px;
|
|
424
|
+
box-sizing: border-box;
|
|
425
|
+
display: flex;
|
|
426
|
+
margin: 0px 8px 0px 16px;
|
|
427
|
+
}
|
|
347
428
|
&--save {
|
|
348
429
|
display: flex;
|
|
349
430
|
width: 100%;
|
|
@@ -374,5 +455,14 @@ export default defineComponent({
|
|
|
374
455
|
width: 110px;
|
|
375
456
|
}
|
|
376
457
|
}
|
|
458
|
+
|
|
459
|
+
&__search-label {
|
|
460
|
+
font-size: 10px;
|
|
461
|
+
margin-left: 4px;
|
|
462
|
+
margin-top: 4px;
|
|
463
|
+
color: gray;
|
|
464
|
+
position: relative;
|
|
465
|
+
word-break: break-all;
|
|
466
|
+
}
|
|
377
467
|
}
|
|
378
468
|
</style>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:id="uuid"
|
|
4
|
+
class="dl-filters-wrapper"
|
|
5
|
+
>
|
|
6
|
+
<dl-tabs
|
|
7
|
+
v-model="currentTab"
|
|
8
|
+
volatile
|
|
9
|
+
full-width
|
|
10
|
+
:items="tabItems"
|
|
11
|
+
/>
|
|
12
|
+
<div class="dl-filters-tabs">
|
|
13
|
+
<dl-tab-panels v-model="currentTab">
|
|
14
|
+
<dl-tab-panel
|
|
15
|
+
v-for="tab in tabItems"
|
|
16
|
+
:key="tab.name"
|
|
17
|
+
>
|
|
18
|
+
<div>
|
|
19
|
+
<filters-query
|
|
20
|
+
v-for="(query, index) in filters[currentTab]"
|
|
21
|
+
:key="index"
|
|
22
|
+
:type="currentTab"
|
|
23
|
+
:name="query.name"
|
|
24
|
+
@select="$emit('filters-select', currentTab, query)"
|
|
25
|
+
@delete="$emit('filters-delete', currentTab, query)"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
</dl-tab-panel>
|
|
29
|
+
</dl-tab-panels>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script lang="ts">
|
|
35
|
+
import { defineComponent, PropType } from 'vue-demi'
|
|
36
|
+
import { DlTabs } from '../../../DlTabs'
|
|
37
|
+
import { DlTabPanels, DlTabPanel } from '../../../DlTabPanels'
|
|
38
|
+
import { Filters } from '../../../DlSearches/DlSmartSearch/types'
|
|
39
|
+
import { getTabItems } from '../utils/utils'
|
|
40
|
+
import FiltersQuery from './FiltersQuery.vue'
|
|
41
|
+
|
|
42
|
+
export default defineComponent({
|
|
43
|
+
components: {
|
|
44
|
+
DlTabs,
|
|
45
|
+
DlTabPanels,
|
|
46
|
+
DlTabPanel,
|
|
47
|
+
FiltersQuery
|
|
48
|
+
},
|
|
49
|
+
props: {
|
|
50
|
+
filters: {
|
|
51
|
+
type: Object as PropType<Filters>,
|
|
52
|
+
default: (): Filters => ({ saved: [], recent: [], suggested: [] })
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
emits: ['filters-delete', 'filters-search'],
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
currentTab: 'saved'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
computed: {
|
|
62
|
+
tabItems(): { label: string; name: string }[] {
|
|
63
|
+
return getTabItems(this.filters)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
</script>
|
|
68
|
+
<style scoped lang="scss">
|
|
69
|
+
.dl-filters-wrapper {
|
|
70
|
+
min-height: 300px;
|
|
71
|
+
}
|
|
72
|
+
.dl-filters-tabs {
|
|
73
|
+
margin-top: 5px;
|
|
74
|
+
}
|
|
75
|
+
</style>
|