feat(admin): render mltextarea fields per locale
- MLField.vue is the one locale-switching wrapper; MLTextField, MLMarkdownField and the new MLTextareaField are shells around it - isMLFieldType replaces the inline ML type-name checks in formState, FormView and RelationChildModal - register mltextarea as a group-labelled control; rebuild dist
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
// server never sends back, so it is empty on load and after every save. The
|
||||
// permissioneditor control is a value field too: an object of permission code
|
||||
// to value, labelled as a group.
|
||||
// The ML controls (mltext, mltextarea, mlmarkdown) are thin shells over one
|
||||
// locale-switching wrapper, MLField, around the text, textarea and markdown
|
||||
// controls; each holds a locale -> text map, labelled as a group.
|
||||
import type { Component } from 'vue'
|
||||
import CheckboxField from './fields/CheckboxField.vue'
|
||||
import DatepickerField from './fields/DatepickerField.vue'
|
||||
@@ -30,6 +33,7 @@ import TextField from './fields/TextField.vue'
|
||||
import TextareaField from './fields/TextareaField.vue'
|
||||
import MarkdownField from './fields/MarkdownField.vue'
|
||||
import MLTextField from './fields/MLTextField.vue'
|
||||
import MLTextareaField from './fields/MLTextareaField.vue'
|
||||
import MLMarkdownField from './fields/MLMarkdownField.vue'
|
||||
import UnsupportedField from './fields/UnsupportedField.vue'
|
||||
import WidgetField from './fields/WidgetField.vue'
|
||||
@@ -65,6 +69,7 @@ const renderers = new Map<string, Component>([
|
||||
['permissioneditor', PermissionEditorField],
|
||||
['markdown', MarkdownField],
|
||||
['mltext', MLTextField],
|
||||
['mltextarea', MLTextareaField],
|
||||
['mlmarkdown', MLMarkdownField],
|
||||
])
|
||||
|
||||
@@ -85,7 +90,7 @@ const valueless = new Set<string>([RELATION_MANAGER, 'widget', 'partial', 'fileu
|
||||
* Types whose control is a group rather than one focusable element: the
|
||||
* visible label is a span the group points at, not a label for an input.
|
||||
*/
|
||||
const groupLabelledTypes = new Set<string>(['widget', 'partial', 'fileupload', 'permissioneditor', 'mltext', 'mlmarkdown'])
|
||||
const groupLabelledTypes = new Set<string>(['widget', 'partial', 'fileupload', 'permissioneditor', 'mltext', 'mltextarea', 'mlmarkdown'])
|
||||
|
||||
export function rendererFor(type: string): Component {
|
||||
return renderers.get(type) ?? lazyRenderers.get(type)?.() ?? UnsupportedField
|
||||
|
||||
Reference in New Issue
Block a user