diff --git a/app/src/components/v-input/v-input.vue b/app/src/components/v-input/v-input.vue index d2ef5e31e1..40ebe8a558 100644 --- a/app/src/components/v-input/v-input.vue +++ b/app/src/components/v-input/v-input.vue @@ -142,7 +142,10 @@ export default defineComponent({ ...listeners, input: emitValue, keydown: processValue, - blur: trimIfEnabled, + blur: (e: Event) => { + trimIfEnabled(); + listeners.blur?.(e); + }, })); const hasClick = computed(() => { diff --git a/app/src/interfaces/input-autocomplete-api/index.ts b/app/src/interfaces/input-autocomplete-api/index.ts new file mode 100644 index 0000000000..95703ce3be --- /dev/null +++ b/app/src/interfaces/input-autocomplete-api/index.ts @@ -0,0 +1,138 @@ +import { defineInterface } from '@/interfaces/define'; +import InterfaceInputAutocompleteAPI from './input-autocomplete-api.vue'; + +export default defineInterface({ + id: 'input-autocomplete-api', + name: '$t:interfaces.input-autocomplete-api.input-autocomplete-api', + description: '$t:interfaces.input-autocomplete-api.description', + icon: 'find_in_page', + component: InterfaceInputAutocompleteAPI, + types: ['string', 'text'], + groups: ['standard'], + recommendedDisplays: ['formatted-value'], + options: [ + { + field: 'url', + name: '$t:url', + type: 'string', + meta: { + interface: 'input', + options: { + placeholder: 'https://example.com/search?q={{value}}', + font: 'monospace', + }, + width: 'full', + }, + }, + { + field: 'resultsPath', + name: '$t:interfaces.input-autocomplete-api.results_path', + type: 'string', + meta: { + interface: 'input', + options: { + placeholder: 'result.predictions', + font: 'monospace', + }, + width: 'half', + }, + }, + { + field: 'valuePath', + name: '$t:interfaces.input-autocomplete-api.value_path', + type: 'string', + meta: { + interface: 'input', + options: { + placeholder: 'structured_main_text', + font: 'monospace', + }, + width: 'half', + }, + }, + { + field: 'trigger', + name: '$t:interfaces.input-autocomplete-api.trigger', + type: 'string', + schema: { + default_value: 'throttle', + }, + meta: { + width: 'half', + interface: 'select-dropdown', + options: { + choices: [ + { + text: 'Throttle', + value: 'throttle', + }, + { + text: 'Debounce', + value: 'debounce', + }, + ], + }, + }, + }, + { + field: 'rate', + name: '$t:interfaces.input-autocomplete-api.rate', + type: 'integer', + schema: { + default_value: 500, + }, + meta: { + width: 'half', + interface: 'input', + }, + }, + { + field: 'placeholder', + name: '$t:placeholder', + meta: { + width: 'half', + interface: 'input', + options: { + placeholder: '$t:enter_a_placeholder', + }, + }, + }, + { + field: 'font', + name: '$t:font', + type: 'string', + meta: { + width: 'half', + interface: 'select-dropdown', + options: { + choices: [ + { text: '$t:sans_serif', value: 'sans-serif' }, + { text: '$t:monospace', value: 'monospace' }, + { text: '$t:serif', value: 'serif' }, + ], + }, + }, + schema: { + default_value: 'sans-serif', + }, + }, + { + field: 'iconLeft', + name: '$t:icon_left', + type: 'string', + meta: { + width: 'half', + interface: 'select-icon', + }, + }, + { + field: 'iconRight', + name: '$t:icon_right', + type: 'string', + meta: { + width: 'half', + interface: 'select-icon', + }, + }, + ], +}); diff --git a/app/src/interfaces/input-autocomplete-api/input-autocomplete-api.vue b/app/src/interfaces/input-autocomplete-api/input-autocomplete-api.vue new file mode 100644 index 0000000000..0d98381e99 --- /dev/null +++ b/app/src/interfaces/input-autocomplete-api/input-autocomplete-api.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/app/src/interfaces/input/input.vue b/app/src/interfaces/input/input.vue index f806aa0ee8..3939141806 100644 --- a/app/src/interfaces/input/input.vue +++ b/app/src/interfaces/input/input.vue @@ -9,13 +9,16 @@ :type="inputType" :class="font" :db-safe="dbSafe" - @input="$listeners.input" :slug="slug" + :min="min" + :max="max" + :step="step" + @input="$listeners.input" >