Files
directus/app/src/interfaces/input-autocomplete-api/index.ts
Azri Kahar 37cbaa0be5 Add App Translation Strings in Settings (#12170)
* add migration for translation strings

* add to navigation

* WIP

* fix dialog overflow

* update translation keys

* Update logic

* add placeholder to system-language

* fix translation

* remove unused import

* reset dialog on create new

* ensure search input is visible when searching

* merge translation strings on set language

* merge translation strings on update

* hydrate

* make sure null translation do not get merged

* change dialog to drawer

* update placeholder text

* fix form value

* revert dialog style change

* rename drawer component

* Force safe key name

* Move interface to system interfaces

The saved values are Directus app proprietary, so to prevent confusion in what it's supposed to do, we'll move it to system.

* Move composable to root composables

* Use new languages input in interface/display options

* hide translation strings field in project settings

* set system true to system-input-translated-string

* use this in field detail notes

* use in list options

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-03-22 09:39:04 -04:00

155 lines
3.0 KiB
TypeScript

import { defineInterface } from '@directus/shared/utils';
import InterfaceInputAutocompleteAPI from './input-autocomplete-api.vue';
import PreviewSVG from './preview.svg?raw';
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'],
localTypes: ['standard'],
group: '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: 'full',
},
},
{
field: 'textPath',
name: '$t:interfaces.input-autocomplete-api.text_path',
type: 'string',
meta: {
interface: 'input',
options: {
placeholder: 'structured_main_text',
font: 'monospace',
},
width: 'half',
},
},
{
field: 'valuePath',
name: '$t:interfaces.input-autocomplete-api.value_path',
type: 'string',
meta: {
interface: 'input',
options: {
placeholder: 'structured_main_value',
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: 'system-input-translated-string',
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',
},
},
],
preview: PreviewSVG,
});