@dataloop-ai/components 0.18.64 → 0.18.66
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/StateManager.ts +73 -0
- package/src/components/basic/DlButton/DlButton.vue +1 -1
- package/src/components/basic/DlButton/utils.ts +1 -1
- package/src/components/compound/DlInput/DlInput.vue +7 -0
- package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +8 -2
- package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +90 -542
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +464 -395
- package/src/components/compound/DlSearches/DlSmartSearch/index.ts +2 -1
- package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +16 -16
- package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +12 -7
- package/src/components/compound/DlSelect/types.ts +4 -0
- package/src/components/compound/types.ts +1 -0
- package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +3 -4
- package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +3 -8
- package/src/demos/DlDatasetBrowserLayoutDemo/components/MainContent/EmptyState/LayoutEmptyState.vue +4 -7
- package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +16 -6
- package/src/index.ts +1 -22
- package/src/utils/parse-smart-query.ts +7 -3
- /package/src/components/compound/DlSearches/DlSmartSearch/components/{DlSuggestionsDropdown.vue → SuggestionsDropdown.vue} +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { computed, reactive } from 'vue-demi'
|
|
2
|
+
|
|
3
|
+
export interface DlComponentsState {
|
|
4
|
+
theme: 'light' | 'dark'
|
|
5
|
+
locale: 'en' | 'es'
|
|
6
|
+
disableDebounce: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class StateManager {
|
|
10
|
+
private static _instance: StateManager | null = null
|
|
11
|
+
public static get instance(): StateManager {
|
|
12
|
+
if (StateManager._instance === null) {
|
|
13
|
+
StateManager._instance = new StateManager()
|
|
14
|
+
}
|
|
15
|
+
return StateManager._instance
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private _state: DlComponentsState = null
|
|
19
|
+
|
|
20
|
+
private constructor() {
|
|
21
|
+
this._state = reactive({
|
|
22
|
+
theme: 'light',
|
|
23
|
+
locale: 'en',
|
|
24
|
+
disableDebounce: false
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public get state(): DlComponentsState {
|
|
29
|
+
return this._state
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// public theme = computed({
|
|
33
|
+
// get: () => this._state.theme,
|
|
34
|
+
// set: (theme: 'light' | 'dark') => {
|
|
35
|
+
// this._state.theme = theme
|
|
36
|
+
// }
|
|
37
|
+
// })
|
|
38
|
+
|
|
39
|
+
// public disableDebounce = computed({
|
|
40
|
+
// get: () => this._state.disableDebounce,
|
|
41
|
+
// set: (disableDebounce: boolean) => {
|
|
42
|
+
// this._state.disableDebounce = disableDebounce
|
|
43
|
+
// }
|
|
44
|
+
// })
|
|
45
|
+
|
|
46
|
+
// public isDarkTheme = computed(() => this._state.theme === 'dark')
|
|
47
|
+
// public isLightTheme = computed(() => this._state.theme === 'light')
|
|
48
|
+
|
|
49
|
+
public get theme(): 'light' | 'dark' {
|
|
50
|
+
return this._state.theme
|
|
51
|
+
}
|
|
52
|
+
public set theme(theme: 'light' | 'dark') {
|
|
53
|
+
this._state.theme = theme
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public get disableDebounce(): boolean {
|
|
57
|
+
return this._state.disableDebounce
|
|
58
|
+
}
|
|
59
|
+
public set disableDebounce(value: boolean) {
|
|
60
|
+
this._state.disableDebounce = value
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public get isDarkTheme(): boolean {
|
|
64
|
+
return this._state.theme === 'dark'
|
|
65
|
+
}
|
|
66
|
+
public get isLightTheme(): boolean {
|
|
67
|
+
return this._state.theme === 'light'
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const stateManager = StateManager.instance
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
window.DlComponents = StateManager.instance
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import { getColor } from '../../../utils'
|
|
2
2
|
import { getLighterGradient } from '../../../utils/getLighterGradient'
|
|
3
3
|
|
|
4
|
-
export type ButtonSizes = 's' | 'm' | 'l' |
|
|
4
|
+
export type ButtonSizes = 's' | 'm' | 'l' | 'xl'
|
|
5
5
|
|
|
6
6
|
const paddings = {
|
|
7
7
|
s: '7px 16px',
|
|
@@ -256,6 +256,7 @@ import { DlMenu, DlIcon, DlList, DlEllipsis } from '../../essential'
|
|
|
256
256
|
import { DlButton } from '../../basic'
|
|
257
257
|
import { InputSizes, TInputSizes } from '../../../utils/input-sizes'
|
|
258
258
|
import { v4 } from 'uuid'
|
|
259
|
+
import { stateManager } from '../../../StateManager'
|
|
259
260
|
|
|
260
261
|
export default defineComponent({
|
|
261
262
|
name: 'DlInput',
|
|
@@ -545,6 +546,9 @@ export default defineComponent({
|
|
|
545
546
|
return !!this.suggestItems.length && !!this.modelValue
|
|
546
547
|
},
|
|
547
548
|
debouncedBlur(): any {
|
|
549
|
+
if (stateManager.disableDebounce) {
|
|
550
|
+
return this.onBlur.bind(this)
|
|
551
|
+
}
|
|
548
552
|
const debounced = debounce(this.onBlur.bind(this), 50)
|
|
549
553
|
return debounced
|
|
550
554
|
},
|
|
@@ -572,6 +576,9 @@ export default defineComponent({
|
|
|
572
576
|
return classes
|
|
573
577
|
},
|
|
574
578
|
debouncedInput(): any {
|
|
579
|
+
if (stateManager.disableDebounce) {
|
|
580
|
+
return this.onChange.bind(this)
|
|
581
|
+
}
|
|
575
582
|
const debounced = debounce(this.onChange.bind(this), this.debounce)
|
|
576
583
|
return debounced
|
|
577
584
|
}
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
TextContent
|
|
26
26
|
} from 'vanilla-jsoneditor'
|
|
27
27
|
import { debounce } from 'lodash'
|
|
28
|
+
import { stateManager } from '../../../StateManager'
|
|
28
29
|
|
|
29
30
|
export default defineComponent({
|
|
30
31
|
model: {
|
|
@@ -110,11 +111,16 @@ export default defineComponent({
|
|
|
110
111
|
emit('change', (content as TextContent).text)
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
const debouncedHandleJSONChange =
|
|
114
|
+
const debouncedHandleJSONChange = computed(() => {
|
|
115
|
+
if (stateManager.disableDebounce) {
|
|
116
|
+
return handleJSONChange
|
|
117
|
+
}
|
|
118
|
+
return debounce(handleJSONChange, 100)
|
|
119
|
+
})
|
|
114
120
|
|
|
115
121
|
const initJsonEditor = () => {
|
|
116
122
|
const initialAttrs: JSONEditorPropsOptional = {
|
|
117
|
-
onChange: debouncedHandleJSONChange,
|
|
123
|
+
onChange: debouncedHandleJSONChange.value,
|
|
118
124
|
indentation: indentation.value,
|
|
119
125
|
mode: mode.value,
|
|
120
126
|
readOnly: readonly.value || mode.value === Mode.tree,
|