@dataloop-ai/components 0.20.259-wip-json.0 → 0.20.260
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
CHANGED
|
@@ -75,6 +75,14 @@ export default defineComponent({
|
|
|
75
75
|
const jsonEditorRef = ref(null)
|
|
76
76
|
const jsonEditor = ref<JSONEditor>(null as any)
|
|
77
77
|
const innerUpdate = ref(false)
|
|
78
|
+
const suppressNextFocus = ref(false)
|
|
79
|
+
|
|
80
|
+
const blurActiveEditorElement = () => {
|
|
81
|
+
const target = jsonEditorRef.value as HTMLElement | null
|
|
82
|
+
if (target?.contains(document.activeElement)) {
|
|
83
|
+
;(document.activeElement as HTMLElement)?.blur()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
78
86
|
|
|
79
87
|
watch(modelValue, (val) => {
|
|
80
88
|
if (innerUpdate.value) {
|
|
@@ -82,9 +90,18 @@ export default defineComponent({
|
|
|
82
90
|
return
|
|
83
91
|
}
|
|
84
92
|
|
|
93
|
+
if (!autoFocus.value) {
|
|
94
|
+
suppressNextFocus.value = true
|
|
95
|
+
}
|
|
85
96
|
jsonEditor.value?.set({
|
|
86
97
|
text: val
|
|
87
98
|
})
|
|
99
|
+
if (!autoFocus.value) {
|
|
100
|
+
nextTick(() => {
|
|
101
|
+
blurActiveEditorElement()
|
|
102
|
+
suppressNextFocus.value = false
|
|
103
|
+
})
|
|
104
|
+
}
|
|
88
105
|
})
|
|
89
106
|
|
|
90
107
|
watch(mode, (val) => {
|
|
@@ -132,13 +149,6 @@ export default defineComponent({
|
|
|
132
149
|
return debounce(handleJSONChange, 100)
|
|
133
150
|
})
|
|
134
151
|
|
|
135
|
-
const blurEditorIfFocused = () => {
|
|
136
|
-
const target = jsonEditorRef.value as HTMLElement | null
|
|
137
|
-
if (target?.contains(document.activeElement)) {
|
|
138
|
-
;(document.activeElement as HTMLElement)?.blur()
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
152
|
const initJsonEditor = () => {
|
|
143
153
|
const initialAttrs: JSONEditorPropsOptional = {
|
|
144
154
|
onChange: debouncedHandleJSONChange.value,
|
|
@@ -149,6 +159,10 @@ export default defineComponent({
|
|
|
149
159
|
navigationBar: false,
|
|
150
160
|
statusBar: false,
|
|
151
161
|
onFocus: () => {
|
|
162
|
+
if (suppressNextFocus.value) {
|
|
163
|
+
blurActiveEditorElement()
|
|
164
|
+
return
|
|
165
|
+
}
|
|
152
166
|
emit('focus')
|
|
153
167
|
},
|
|
154
168
|
onBlur: () => {
|
|
@@ -169,13 +183,15 @@ export default defineComponent({
|
|
|
169
183
|
jsonEditor.value?.set({
|
|
170
184
|
text: modelValue.value
|
|
171
185
|
})
|
|
172
|
-
|
|
173
186
|
nextTick(() => {
|
|
174
187
|
jsonEditor.value?.refresh()
|
|
175
|
-
if (!autoFocus.value) {
|
|
176
|
-
blurEditorIfFocused()
|
|
177
|
-
}
|
|
178
188
|
})
|
|
189
|
+
|
|
190
|
+
if (!autoFocus.value) {
|
|
191
|
+
nextTick(() => {
|
|
192
|
+
blurActiveEditorElement()
|
|
193
|
+
})
|
|
194
|
+
}
|
|
179
195
|
}
|
|
180
196
|
|
|
181
197
|
watch(readonly, (val) => {
|
|
@@ -183,11 +183,7 @@
|
|
|
183
183
|
v-else-if="showMenuList"
|
|
184
184
|
class="select-list"
|
|
185
185
|
:padding="false"
|
|
186
|
-
:style="
|
|
187
|
-
optionsCount > MAX_ITEMS_PER_LIST
|
|
188
|
-
? ''
|
|
189
|
-
: `width: 100%; max-height: calc(${calculatedDropdownMaxHeight} - 20px); overflow-y: auto;`
|
|
190
|
-
"
|
|
186
|
+
:style="dropdownListStyle"
|
|
191
187
|
>
|
|
192
188
|
<dl-select-option
|
|
193
189
|
v-if="showAllItems"
|
|
@@ -218,7 +214,7 @@
|
|
|
218
214
|
:virtual-scroll-item-size="28"
|
|
219
215
|
:virtual-scroll-sticky-size-start="28"
|
|
220
216
|
:virtual-scroll-sticky-size-end="20"
|
|
221
|
-
:style="
|
|
217
|
+
:style="virtualScrollStyle"
|
|
222
218
|
>
|
|
223
219
|
<dl-select-option
|
|
224
220
|
:key="getKeyForOption(item)"
|
|
@@ -686,6 +682,25 @@ export default defineComponent({
|
|
|
686
682
|
// :shrug: if it's not a known value, just return it
|
|
687
683
|
return `calc(${this.dropdownMaxHeight} - 20px)`
|
|
688
684
|
},
|
|
685
|
+
dropdownListStyle(): Record<string, string> {
|
|
686
|
+
if (this.optionsCount > this.MAX_ITEMS_PER_LIST) {
|
|
687
|
+
return {}
|
|
688
|
+
}
|
|
689
|
+
return {
|
|
690
|
+
...this.baseDropdownStyle,
|
|
691
|
+
overflowY: 'auto'
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
virtualScrollStyle(): Record<string, string> {
|
|
695
|
+
return this.baseDropdownStyle
|
|
696
|
+
},
|
|
697
|
+
baseDropdownStyle(): Record<string, string> {
|
|
698
|
+
return {
|
|
699
|
+
width: '100%',
|
|
700
|
+
maxHeight: `calc(${this.calculatedDropdownMaxHeight} - 20px)`,
|
|
701
|
+
overflowX: 'hidden'
|
|
702
|
+
}
|
|
703
|
+
},
|
|
689
704
|
computedMenuStyle(): string {
|
|
690
705
|
let style = this.menuStyle ?? ''
|
|
691
706
|
if (this.optionsCount > this.MAX_ITEMS_PER_LIST) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
0
|
|
1
2
|
<template>
|
|
2
3
|
<div :id="uuid" :class="identifierClass" style="width: 100%">
|
|
3
4
|
<div
|
|
@@ -440,7 +441,10 @@ export default defineComponent({
|
|
|
440
441
|
|
|
441
442
|
.counter {
|
|
442
443
|
color: var(--dl-color-lighter);
|
|
443
|
-
font-
|
|
444
|
+
font-family: var(--dl-typography-body-body3-font-family);
|
|
445
|
+
font-size: var(--dl-typography-body-body3-font-size);
|
|
446
|
+
line-height: var(--dl-typography-body-body3-line-height);
|
|
447
|
+
font-weight: var(--dl-typography-body-body3-font-weight);
|
|
444
448
|
}
|
|
445
449
|
.expand-icon {
|
|
446
450
|
display: flex !important;
|