@dataloop-ai/components 0.18.78 → 0.18.79
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/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +3 -1
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +2 -3
- package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +2 -2
- package/src/hooks/use-suggestions.ts +1 -0
- package/src/utils/parse-smart-query.ts +12 -0
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
ref="smartSearchInput"
|
|
12
12
|
v-model="queryObject"
|
|
13
13
|
style="margin-bottom: 0px"
|
|
14
|
+
:width="width"
|
|
14
15
|
:status="status"
|
|
15
16
|
:aliases="aliases"
|
|
16
17
|
:schema="schema"
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
height: '28px'
|
|
34
35
|
}"
|
|
35
36
|
:disabled="disabled"
|
|
36
|
-
@click="
|
|
37
|
+
@click="$emit('search-query', queryObject)"
|
|
37
38
|
/>
|
|
38
39
|
</div>
|
|
39
40
|
<div
|
|
@@ -138,6 +139,7 @@ export default defineComponent({
|
|
|
138
139
|
//#endregion
|
|
139
140
|
|
|
140
141
|
//#region data
|
|
142
|
+
// todo: more cleanup
|
|
141
143
|
const inputModel = ref('')
|
|
142
144
|
const jsonEditorModel = ref(false)
|
|
143
145
|
const showJSONEditor = ref(false)
|
|
@@ -901,13 +901,12 @@ export default defineComponent({
|
|
|
901
901
|
|
|
902
902
|
&__search-label {
|
|
903
903
|
font-size: 10px;
|
|
904
|
-
height:
|
|
904
|
+
height: 15px;
|
|
905
905
|
color: gray;
|
|
906
906
|
position: absolute;
|
|
907
907
|
word-break: break-all;
|
|
908
|
-
bottom: -
|
|
908
|
+
bottom: -15px;
|
|
909
909
|
max-width: 100%;
|
|
910
|
-
margin-top: 3px;
|
|
911
910
|
}
|
|
912
911
|
|
|
913
912
|
&__date-picker-wrapper {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<dl-smart-search
|
|
27
27
|
v-model="queryObject"
|
|
28
28
|
:aliases="aliases"
|
|
29
|
-
:schema="
|
|
29
|
+
:schema="schema2"
|
|
30
30
|
:color-schema="colorSchema"
|
|
31
31
|
:filters="filters"
|
|
32
32
|
:disabled="switchState"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
<dl-smart-search-input
|
|
49
49
|
v-model="queryObject2"
|
|
50
50
|
:aliases="aliases"
|
|
51
|
-
:schema="
|
|
51
|
+
:schema="schema2"
|
|
52
52
|
:color-schema="colorSchema"
|
|
53
53
|
:strict="strictState"
|
|
54
54
|
:disabled="switchState"
|
|
@@ -383,6 +383,7 @@ const isValidByDataType = (
|
|
|
383
383
|
*/
|
|
384
384
|
|
|
385
385
|
if (Array.isArray(dataType)) {
|
|
386
|
+
str = str.replace(/\'/g, '')
|
|
386
387
|
let isOneOf = !!getValueMatch(dataType, str)
|
|
387
388
|
for (const type of dataType) {
|
|
388
389
|
isOneOf = isOneOf || isValidByDataType(str, type, operator)
|
|
@@ -209,6 +209,18 @@ export const stringifySmartQuery = (query: { [key: string]: any }): string => {
|
|
|
209
209
|
continue
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
if (key === '$and') {
|
|
213
|
+
if (Array.isArray(value)) {
|
|
214
|
+
const andObject: { [key: string]: any } = {}
|
|
215
|
+
for (const subQuery of value) {
|
|
216
|
+
for (const subKey in subQuery) {
|
|
217
|
+
andObject[subKey] = subQuery[subKey]
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return stringifySmartQuery(andObject)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
212
224
|
if (result.length) {
|
|
213
225
|
result += ' AND '
|
|
214
226
|
}
|