@dataloop-ai/components 0.19.64 → 0.19.65
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
|
@@ -100,11 +100,7 @@
|
|
|
100
100
|
'placeholder-string': showPlaceholder,
|
|
101
101
|
'placeholder-string--disabled': disabled
|
|
102
102
|
}"
|
|
103
|
-
>{{
|
|
104
|
-
showPlaceholder
|
|
105
|
-
? placeholder
|
|
106
|
-
: modelValue
|
|
107
|
-
}}</span>
|
|
103
|
+
>{{ spanText }}</span>
|
|
108
104
|
</div>
|
|
109
105
|
<div
|
|
110
106
|
v-if="
|
|
@@ -340,10 +336,10 @@ import { debounce, cloneDeep } from 'lodash'
|
|
|
340
336
|
import {
|
|
341
337
|
computed,
|
|
342
338
|
defineComponent,
|
|
343
|
-
onMounted,
|
|
344
339
|
PropType,
|
|
345
340
|
ref,
|
|
346
341
|
toRefs,
|
|
342
|
+
nextTick,
|
|
347
343
|
watch
|
|
348
344
|
} from 'vue-demi'
|
|
349
345
|
import { DlInfoErrorMessage, DlTooltip } from '../../shared'
|
|
@@ -658,9 +654,14 @@ export default defineComponent({
|
|
|
658
654
|
autoSuggestItems,
|
|
659
655
|
maxLength,
|
|
660
656
|
files,
|
|
661
|
-
syntaxHighlightColor
|
|
657
|
+
syntaxHighlightColor,
|
|
658
|
+
placeholder,
|
|
659
|
+
readonly,
|
|
660
|
+
disabled
|
|
662
661
|
} = toRefs(props)
|
|
663
662
|
|
|
663
|
+
const isInternalChange = ref(false)
|
|
664
|
+
|
|
664
665
|
const suggestItems = computed<DlInputSuggestion[]>(() => {
|
|
665
666
|
if (!modelValue.value) return []
|
|
666
667
|
return getSuggestItems(
|
|
@@ -676,6 +677,16 @@ export default defineComponent({
|
|
|
676
677
|
const handleSelectedItem = (value: any) => {
|
|
677
678
|
onAutoSuggestClick(null, value)
|
|
678
679
|
}
|
|
680
|
+
|
|
681
|
+
const onChange = (e: KeyboardEvent) => {
|
|
682
|
+
isInternalChange.value = true
|
|
683
|
+
isMenuOpen.value = true
|
|
684
|
+
updateSyntax()
|
|
685
|
+
const target = e.target as HTMLElement
|
|
686
|
+
emit('input', target.innerText, e)
|
|
687
|
+
emit('update:model-value', target.innerText)
|
|
688
|
+
}
|
|
689
|
+
|
|
679
690
|
const onAutoSuggestClick = (e: Event, item: string): void => {
|
|
680
691
|
const newValue = clearSuggestion(modelValue.value.toString(), item)
|
|
681
692
|
if (!maxLength.value || newValue.length < maxLength.value) {
|
|
@@ -735,26 +746,42 @@ export default defineComponent({
|
|
|
735
746
|
() => !modelValue.value || !String(modelValue.value)?.length
|
|
736
747
|
)
|
|
737
748
|
|
|
738
|
-
|
|
739
|
-
if (
|
|
740
|
-
|
|
741
|
-
input.value.innerHTML = modelValue.value
|
|
742
|
-
}
|
|
743
|
-
} else {
|
|
744
|
-
input.value.innerHTML = ''
|
|
749
|
+
const spanText = computed<string>(() => {
|
|
750
|
+
if (showPlaceholder.value) {
|
|
751
|
+
return placeholder.value
|
|
745
752
|
}
|
|
753
|
+
return modelValue.value?.toString()
|
|
746
754
|
})
|
|
747
755
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
756
|
+
watch(
|
|
757
|
+
modelValue,
|
|
758
|
+
(val) => {
|
|
759
|
+
nextTick(() => {
|
|
760
|
+
if (
|
|
761
|
+
!isInternalChange.value &&
|
|
762
|
+
val !== null &&
|
|
763
|
+
val !== undefined
|
|
764
|
+
) {
|
|
765
|
+
if (readonly.value || disabled.value) {
|
|
766
|
+
return
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
input.value.innerHTML = val
|
|
770
|
+
.toString()
|
|
771
|
+
.replace(/ /g, ' ')
|
|
772
|
+
} else {
|
|
773
|
+
isInternalChange.value = false
|
|
774
|
+
}
|
|
775
|
+
})
|
|
776
|
+
},
|
|
777
|
+
{ immediate: true }
|
|
778
|
+
)
|
|
753
779
|
|
|
754
780
|
return {
|
|
755
781
|
suggestItems,
|
|
756
782
|
highlightedIndex,
|
|
757
783
|
onAutoSuggestClick,
|
|
784
|
+
onChange,
|
|
758
785
|
isMenuOpen,
|
|
759
786
|
setHighlightedIndex,
|
|
760
787
|
handleSelectedItem,
|
|
@@ -764,7 +791,8 @@ export default defineComponent({
|
|
|
764
791
|
emitRemoveFile,
|
|
765
792
|
updateSyntax,
|
|
766
793
|
stringSuggestions,
|
|
767
|
-
showPlaceholder
|
|
794
|
+
showPlaceholder,
|
|
795
|
+
spanText
|
|
768
796
|
}
|
|
769
797
|
},
|
|
770
798
|
data() {
|
|
@@ -963,13 +991,6 @@ export default defineComponent({
|
|
|
963
991
|
onClick(e: Event, item: DlInputSuggestion) {
|
|
964
992
|
this.onAutoSuggestClick(e, item.suggestion)
|
|
965
993
|
},
|
|
966
|
-
onChange(e: Event): void {
|
|
967
|
-
this.isMenuOpen = true
|
|
968
|
-
this.updateSyntax()
|
|
969
|
-
const target = e.target as HTMLElement
|
|
970
|
-
this.$emit('input', target.innerText, e)
|
|
971
|
-
this.$emit('update:model-value', target.innerText)
|
|
972
|
-
},
|
|
973
994
|
async handlePaste() {
|
|
974
995
|
const content = await readClipboard()
|
|
975
996
|
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
PropType,
|
|
14
14
|
ref,
|
|
15
15
|
toRefs,
|
|
16
|
-
watch
|
|
16
|
+
watch,
|
|
17
|
+
nextTick
|
|
17
18
|
} from 'vue-demi'
|
|
18
19
|
import {
|
|
19
20
|
Content,
|
|
@@ -26,7 +27,6 @@ import {
|
|
|
26
27
|
} from 'vanilla-jsoneditor'
|
|
27
28
|
import { debounce } from 'lodash'
|
|
28
29
|
import { stateManager } from '../../../StateManager'
|
|
29
|
-
import { nextTick } from 'process'
|
|
30
30
|
|
|
31
31
|
export default defineComponent({
|
|
32
32
|
model: {
|