@dataloop-ai/components 0.18.69 → 0.18.71

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 (39) 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/DlTreeTable.vue +14 -12
  22. package/src/components/compound/DlTreeTable/components/DlTrTree.vue +28 -1
  23. package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +1 -0
  24. package/src/components/compound/DlTreeTable/views/DlTrTreeView.vue +98 -12
  25. package/src/components/compound/types.ts +1 -0
  26. package/src/components/essential/DlLabel/DlLabel.vue +4 -4
  27. package/src/components/shared/DlTooltip/DlTooltip.vue +1 -6
  28. package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +36 -27
  29. package/src/demos/DlButtonDemo.vue +3 -1
  30. package/src/demos/DlDialogBoxDemo.vue +163 -53
  31. package/src/demos/DlLabelDemo.vue +8 -8
  32. package/src/demos/DlPopupDemo.vue +13 -0
  33. package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +16 -6
  34. package/src/hooks/use-portal.ts +1 -7
  35. package/src/hooks/use-suggestions.ts +5 -1
  36. package/src/utils/draggable-table.ts +95 -25
  37. package/src/utils/events.ts +3 -1
  38. package/src/utils/index.ts +59 -0
  39. package/src/utils/parse-smart-query.ts +7 -3
@@ -31,3 +31,62 @@ export const isMobileOrTablet = () => {
31
31
  })(navigator.userAgent || navigator.vendor || window.opera)
32
32
  return check
33
33
  }
34
+ export const registerToWindow = (params: {
35
+ key?: string
36
+ ref: any
37
+ }): (() => void) => {
38
+ let { key, ref } = params
39
+ key = !key && ref._isVue ? `${ref.$vnode.tag}-${ref._uid}` : key
40
+ const dispose = () => {
41
+ // console.log(`DISPOSING ${key}`)
42
+ // @ts-ignore
43
+ window[key] = undefined
44
+ // @ts-ignore
45
+ delete window[key]
46
+ }
47
+
48
+ const destroyRef = () => {
49
+ // console.log(`DESTROYING ${key}`)
50
+ const keys = Object.keys(ref.$data)
51
+ keys.forEach((k) => {
52
+ if (k === 'unsubscribers' && Array.isArray(ref.$data[k])) {
53
+ ref.$data[k].forEach((unsubscribe: () => void) => unsubscribe())
54
+ ref.$data[k] = []
55
+ return
56
+ }
57
+ ref.$data[k] = undefined
58
+ })
59
+ const refs = Object.keys(ref.$refs)
60
+ refs.forEach((r) => {
61
+ ref.$refs[r] = undefined
62
+ })
63
+ }
64
+ if (ref._isVue) {
65
+ ref.$once('hook:beforeDestroy', destroyRef.bind(this))
66
+ }
67
+
68
+ if (process.env.NODE_ENV !== 'production') {
69
+ // @ts-ignore
70
+ window[key] = ref
71
+ if (ref._isVue) {
72
+ ref.$once('hook:beforeDestroy', dispose.bind(this))
73
+ }
74
+ }
75
+ return dispose
76
+ }
77
+
78
+ export const setTimeInterval = (
79
+ callback: (...args: any[]) => void,
80
+ ms: number,
81
+ ref?: any
82
+ ): (() => void) => {
83
+ const intervalId = setInterval(callback, ms)
84
+ const unregister = () => {
85
+ clearInterval(intervalId)
86
+ }
87
+ const unregisterCallback = unregister.bind(this)
88
+ if (ref && ref._isVue) {
89
+ ref.$once('hook:beforeDestroy', unregisterCallback)
90
+ }
91
+ return unregisterCallback
92
+ }
@@ -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) {