@dataloop-ai/components 0.20.259-new-json.1 → 0.20.259-new-json.2
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,48 +75,29 @@ 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 suppressProgrammaticFocus = ref(false)
|
|
79
78
|
|
|
80
|
-
const
|
|
79
|
+
const blurActiveEditorElement = () => {
|
|
81
80
|
const target = jsonEditorRef.value as HTMLElement | null
|
|
82
81
|
if (target?.contains(document.activeElement)) {
|
|
83
82
|
;(document.activeElement as HTMLElement)?.blur()
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
const runWithoutAutoFocus = (fn: () => void) => {
|
|
88
|
-
if (autoFocus.value) {
|
|
89
|
-
fn()
|
|
90
|
-
return
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
suppressProgrammaticFocus.value = true
|
|
94
|
-
fn()
|
|
95
|
-
nextTick(() => {
|
|
96
|
-
blurEditorIfFocused()
|
|
97
|
-
suppressProgrammaticFocus.value = false
|
|
98
|
-
})
|
|
99
|
-
}
|
|
100
|
-
|
|
101
86
|
watch(modelValue, (val) => {
|
|
102
87
|
if (innerUpdate.value) {
|
|
103
88
|
innerUpdate.value = false
|
|
104
89
|
return
|
|
105
90
|
}
|
|
106
91
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
text: val
|
|
110
|
-
})
|
|
92
|
+
jsonEditor.value?.set({
|
|
93
|
+
text: val
|
|
111
94
|
})
|
|
112
95
|
})
|
|
113
96
|
|
|
114
97
|
watch(mode, (val) => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
readOnly: val === Mode.tree
|
|
119
|
-
})
|
|
98
|
+
jsonEditor.value?.updateProps({
|
|
99
|
+
mode: val,
|
|
100
|
+
readOnly: val === Mode.tree
|
|
120
101
|
})
|
|
121
102
|
})
|
|
122
103
|
|
|
@@ -168,10 +149,6 @@ export default defineComponent({
|
|
|
168
149
|
navigationBar: false,
|
|
169
150
|
statusBar: false,
|
|
170
151
|
onFocus: () => {
|
|
171
|
-
if (suppressProgrammaticFocus.value) {
|
|
172
|
-
blurEditorIfFocused()
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
152
|
emit('focus')
|
|
176
153
|
},
|
|
177
154
|
onBlur: () => {
|
|
@@ -189,22 +166,23 @@ export default defineComponent({
|
|
|
189
166
|
props: initialAttrs
|
|
190
167
|
})
|
|
191
168
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
169
|
+
jsonEditor.value?.set({
|
|
170
|
+
text: modelValue.value
|
|
171
|
+
})
|
|
172
|
+
nextTick(() => {
|
|
173
|
+
jsonEditor.value?.refresh()
|
|
174
|
+
})
|
|
196
175
|
|
|
176
|
+
if (!autoFocus.value) {
|
|
197
177
|
nextTick(() => {
|
|
198
|
-
|
|
178
|
+
blurActiveEditorElement()
|
|
199
179
|
})
|
|
200
|
-
}
|
|
180
|
+
}
|
|
201
181
|
}
|
|
202
182
|
|
|
203
183
|
watch(readonly, (val) => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
readOnly: val || mode.value === Mode.tree
|
|
207
|
-
})
|
|
184
|
+
jsonEditor.value?.updateProps({
|
|
185
|
+
readOnly: val || mode.value === Mode.tree
|
|
208
186
|
})
|
|
209
187
|
})
|
|
210
188
|
|