@dataloop-ai/components 0.18.70 → 0.18.72

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.
Files changed (35) hide show
  1. package/package.json +1 -1
  2. package/src/StateManager.ts +3 -0
  3. package/src/components/basic/DlButton/DlButton.vue +1 -1
  4. package/src/components/basic/DlButton/utils.ts +22 -11
  5. package/src/components/basic/DlPopup/DlPopup.vue +4 -2
  6. package/src/components/compound/DlDialogBox/DlDialogBox.vue +4 -1
  7. package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +11 -3
  8. package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +114 -559
  9. package/src/components/compound/DlSearches/DlSmartSearch/components/{DlSmartSearchFilters.vue → DlSmartSearchFilter/DlSmartSearchFilters.vue} +7 -6
  10. package/src/components/compound/DlSearches/DlSmartSearch/components/{FiltersQuery.vue → DlSmartSearchFilter/components/FiltersQuery.vue} +2 -2
  11. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +492 -406
  12. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchJsonEditorDialog.vue +322 -0
  13. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchQueryFilters.vue +124 -0
  14. package/src/components/compound/DlSearches/DlSmartSearch/components/{DlSuggestionsDropdown.vue → SuggestionsDropdown.vue} +0 -1
  15. package/src/components/compound/DlSearches/DlSmartSearch/components/index.ts +4 -0
  16. package/src/components/compound/DlSearches/DlSmartSearch/index.ts +2 -1
  17. package/src/components/compound/DlSearches/DlSmartSearch/types.ts +1 -0
  18. package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +16 -16
  19. package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +12 -7
  20. package/src/components/compound/DlSelect/types.ts +4 -0
  21. package/src/components/compound/DlTreeTable/components/DlTrTree.vue +2 -3
  22. package/src/components/compound/types.ts +1 -0
  23. package/src/components/essential/DlLabel/DlLabel.vue +5 -5
  24. package/src/components/shared/DlTooltip/DlTooltip.vue +1 -6
  25. package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +36 -27
  26. package/src/demos/DlButtonDemo.vue +3 -1
  27. package/src/demos/DlDialogBoxDemo.vue +163 -53
  28. package/src/demos/DlLabelDemo.vue +8 -8
  29. package/src/demos/DlPopupDemo.vue +13 -0
  30. package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +16 -6
  31. package/src/hooks/use-portal.ts +1 -7
  32. package/src/hooks/use-suggestions.ts +5 -1
  33. package/src/utils/events.ts +3 -1
  34. package/src/utils/index.ts +59 -0
  35. package/src/utils/parse-smart-query.ts +7 -3
@@ -43,7 +43,11 @@ const Operators: string[] = ['>=', '<=', '!=', '=', '>', '<', 'IN', 'NOT-IN']
43
43
  * @param { string } query DlSmartSearch query string
44
44
  * @returns Mongo based JSON
45
45
  */
46
- export const parseSmartQuery = (query: string) => {
46
+ export const parseSmartQuery = (
47
+ query: string
48
+ ): {
49
+ [key: string]: any
50
+ } => {
47
51
  const queryArr = query.split(' OR ')
48
52
  for (let i = 0; i < queryArr.length; i++) {
49
53
  const term: string = queryArr[i]
@@ -62,7 +66,7 @@ export const parseSmartQuery = (query: string) => {
62
66
  const orTerms: { [key: string]: any }[] = []
63
67
 
64
68
  for (const query of queryArr) {
65
- const andTerms = query.split(' AND ')
69
+ const andTerms = query.split(' AND ').filter((q) => !!q.length)
66
70
  for (let i = 0; i < andTerms.length; i++) {
67
71
  const term: string = andTerms[i]
68
72
  let withOperator = false
@@ -188,7 +192,7 @@ export const parseSmartQuery = (query: string) => {
188
192
  * @param { { [key: string]: any } } query Mongo based JSON that represents a query
189
193
  * @returns DlSmartSearch query string
190
194
  */
191
- export const stringifySmartQuery = (query: { [key: string]: any }) => {
195
+ export const stringifySmartQuery = (query: { [key: string]: any }): string => {
192
196
  let result = ''
193
197
 
194
198
  for (const key in query) {