@dataloop-ai/components 0.18.70 → 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 (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 +4 -4
  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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.18.70",
3
+ "version": "0.18.71",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -1,4 +1,5 @@
1
1
  import { computed, reactive } from 'vue-demi'
2
+ import { ILogger, loggerFactory } from './utils'
2
3
 
3
4
  export interface DlComponentsState {
4
5
  theme: 'light' | 'dark'
@@ -16,6 +17,7 @@ export class StateManager {
16
17
  }
17
18
 
18
19
  private _state: DlComponentsState = null
20
+ public logger: ILogger = null
19
21
 
20
22
  private constructor() {
21
23
  this._state = reactive({
@@ -23,6 +25,7 @@ export class StateManager {
23
25
  locale: 'en',
24
26
  disableDebounce: false
25
27
  })
28
+ this.logger = loggerFactory('DlComponents')
26
29
  }
27
30
 
28
31
  public get state(): DlComponentsState {
@@ -130,7 +130,7 @@ export default defineComponent({
130
130
  * The size of the button, it can be s,m,l or xl
131
131
  */
132
132
  margin: { type: String, default: '0 auto' },
133
- size: { type: String! as PropType<ButtonSizes>, default: 'm' },
133
+ size: { type: String! as PropType<ButtonSizes | string>, default: 'm' },
134
134
  /**
135
135
  * The assigned color will fill the entirety of the button
136
136
  */
@@ -1,37 +1,42 @@
1
1
  import { getColor } from '../../../utils'
2
2
  import { getLighterGradient } from '../../../utils/getLighterGradient'
3
3
 
4
- export type ButtonSizes = 's' | 'm' | 'l' | ('xl' & string)
4
+ export enum ButtonSizes {
5
+ s = 's',
6
+ m = 'm',
7
+ l = 'l',
8
+ xl = 'xl'
9
+ }
5
10
 
6
- const paddings = {
11
+ const paddings: { [key: string]: string } = {
7
12
  s: '7px 16px',
8
13
  m: '9px 16px',
9
14
  l: '10px 16px',
10
15
  xl: '12px 16px'
11
16
  }
12
17
 
13
- const iconPaddings = {
18
+ const iconPaddings: { [key: string]: string } = {
14
19
  s: '6px',
15
20
  m: '8px',
16
21
  l: '10px',
17
22
  xl: '12px'
18
23
  }
19
24
 
20
- const iconSizes = {
25
+ const iconSizes: { [key: string]: string } = {
21
26
  s: '12px',
22
27
  m: '16px',
23
28
  l: '18px',
24
29
  xl: '20px'
25
30
  }
26
31
 
27
- const maxHeights = {
32
+ const maxHeights: { [key: string]: string } = {
28
33
  s: '28px',
29
34
  m: '34px',
30
35
  l: 'auto',
31
36
  xl: 'auto'
32
37
  }
33
38
 
34
- const fontSizes = {
39
+ const fontSizes: { [key: string]: string } = {
35
40
  s: '12px',
36
41
  m: '14px',
37
42
  l: '16px',
@@ -48,15 +53,21 @@ export interface DlButtonProps {
48
53
  textColor: string
49
54
  }
50
55
 
51
- export const setIconSize = (size: ButtonSizes) => iconSizes[size] || size
56
+ export const setIconSize = (size: ButtonSizes | string): string =>
57
+ iconSizes[size] || size
52
58
 
53
- export const setPadding = (size: ButtonSizes) => paddings[size]
59
+ export const setPadding = (size: ButtonSizes | string): string | undefined =>
60
+ paddings[size]
54
61
 
55
- export const setIconPadding = (size: ButtonSizes) => iconPaddings[size]
62
+ export const setIconPadding = (
63
+ size: ButtonSizes | string
64
+ ): string | undefined => iconPaddings[size]
56
65
 
57
- export const setFontSize = (size: ButtonSizes) => fontSizes[size]
66
+ export const setFontSize = (size: ButtonSizes | string): string | undefined =>
67
+ fontSizes[size]
58
68
 
59
- export const setMaxHeight = (size: ButtonSizes) => maxHeights[size]
69
+ export const setMaxHeight = (size: ButtonSizes | string): string | undefined =>
70
+ maxHeights[size]
60
71
 
61
72
  export const setTextColor = ({
62
73
  disabled,
@@ -463,7 +463,9 @@ export default defineComponent({
463
463
  Object.assign(proxy, { focus, updatePosition })
464
464
 
465
465
  return {
466
- uuid: `dl-popup-${v4()}`,
466
+ uuid: (attrs.id as string)?.length
467
+ ? (attrs.id as string)
468
+ : `dl-popup-${v4()}`,
467
469
  portalIsAccessible,
468
470
  anchorEl,
469
471
  showing,
@@ -475,7 +477,7 @@ export default defineComponent({
475
477
  innerRef,
476
478
  portalEl: isVue2 ? 'body' : portalEl,
477
479
  portalIsActive,
478
- classes: 'dl-popup dl-position-engine scroll',
480
+ classes: ['dl-popup dl-position-engine scroll', attrs.class],
479
481
  styles: [
480
482
  isString(attrs.style)
481
483
  ? stringStyleToRecord(attrs.style)
@@ -3,6 +3,7 @@
3
3
  <div
4
4
  v-if="show"
5
5
  :id="uuid"
6
+ :class="$attrs.class"
6
7
  :style="cssVars"
7
8
  class="root-wrapper"
8
9
  >
@@ -129,7 +130,9 @@ export default defineComponent({
129
130
  visibleDragIcon: boolean
130
131
  } {
131
132
  return {
132
- uuid: `dl-dialog-box-${v4()}`,
133
+ uuid: (this.$attrs.id as string)?.length
134
+ ? (this.$attrs.id as string)
135
+ : `dl-dialog-box-${v4()}`,
133
136
  show: this.modelValue,
134
137
  draggableOptions: {
135
138
  draggableX: 0,
@@ -94,7 +94,9 @@ export default defineComponent({
94
94
  undefined
95
95
  ) {
96
96
  if (!(status.contentErrors as ContentParseError).isRepairable) {
97
- console.warn('[DlJsonEditor] Failed to parse JSON')
97
+ stateManager.logger.warn(
98
+ '[DlJsonEditor] Failed to parse JSON'
99
+ )
98
100
  return
99
101
  }
100
102
  }
@@ -163,7 +165,10 @@ export default defineComponent({
163
165
  })
164
166
  emit('align-text')
165
167
  } catch (e) {
166
- console.warn('[DlJsonEditor] Failed to format document', e)
168
+ stateManager.logger.warn(
169
+ '[DlJsonEditor] Failed to format document',
170
+ e
171
+ )
167
172
  return
168
173
  }
169
174
  }
@@ -178,7 +183,10 @@ export default defineComponent({
178
183
  const parsed = JSON.parse(modelValue.value)
179
184
  return parsed
180
185
  } catch (e) {
181
- console.warn('[DlJsonEditor] Failed to format document', e)
186
+ stateManager.logger.warn(
187
+ '[DlJsonEditor] Failed to format document',
188
+ e
189
+ )
182
190
  return null
183
191
  }
184
192
  }