Files
directus/app/src/interfaces
Jay Cammarano e243a33cd9 Add new translations interface (#7727)
* added v-select and button to start sidebyside view

* v-chip next to field name on translations

* v-chip color changed

* add baisc logic

* finish inner workings of translation interface

* finish design

* clean up code

* remove unused prop

* small tweaks

* finish translation interface

* fix lang icon

* tweak styling

* Use v-model over separate bind+event

* Tweak margin definition

* Add class to field-name to prevent span confusion

* Rename classes to match var names

* Add limit -1, remove commented code

* Tweak toggle tooltip wording

* Add hover state to v-icons

* Use self-closing elements

* Remove unused imports

* Rename newVal->sideBySideEnabled

* Use filter + length instead of reducer

* Fix param typo

* Move dividers into main translations component

* Base initial language on fetched languages array

* Move styling to language-select, simplify component

* Don't rely on deep styling

* Tweak interactive state of chip

* Use existing form-grid for side-by-side layoutin

* Only fetch preview values when we dont have them yet

* Improve stability of edited status

* Fix hover state of v-icon

Co-authored-by: Nitwel <nitwel@arcor.de>
Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-09-15 13:03:08 -04:00
..
2021-08-30 16:54:17 -04:00
2021-09-03 09:14:49 -04:00
2021-08-30 16:54:17 -04:00
2021-06-08 15:59:55 -04:00

Interfaces

Interfaces are the individual blocks that allow editing and viewing individual pieces of data. They can be seen as the individual fields in a form, where the field is a single column in a table.

Defining interfaces

Interfaces need to be defined through the defineInterface function. This allows the interface to register things like it's name and options.

export default defineInterface({
	id: 'input',
	register: ({ i18n }) => ({
		name: i18n.global.t('input'),
		icon: 'box',
		component: InterfaceTextInput,
	}),
});

id

Unique ID for the interface within the platform. This is not shown to the end user, but is used internally to build up forms and layouts.

register

Callback function that allows the interface to register it's options and other user-facing parameters.

The one parameter that the register function gets is context. Context holds the following properties:

Property Description
i18n The internal vue-i18n instance. Can be used to return a translated name or translated interface options

name

The user-facing name of the interface. By using the i18n handler from context, you can make this localized.

icon

The icon that's shown when refering to this interface. It's most prominent usage is in the field-setup wizard.

component

The Vue component that makes up the input of the interface. This is the component that will be rendered in the edit form.