YamlEditor Component Documentation
1. Overview
TheYamlEditor is a comprehensive, multi-tabbed interface for creating and managing data model schemas in YAML format. It provides a structured environment for defining different aspects of a model, including its core properties, database schema, table and form presentations, layouts, and printing templates.
The editor is divided into logical tab groups:
- Core Schema: Define the fundamental fields for
vue(data model),table,form,view, anddbcontexts. - Layouts: Visually or textually design the layout for forms and views.
- Printing: Configure document templates, print layouts, and page settings, with a live preview.
- DB Object Schema: Define database-specific object schemas, including primary keys and field mappings.
2. Props
TheYamlEditor component is configured through a set of props. They are categorized below for clarity.
Data & Configuration Props
These props are used to pass the initial data and configuration to the editor. The component uses the.sync modifier (or v-model in Vue 3) to emit updates back to the parent.
| Prop Name | Type | Required | Default | Description |
|---|---|---|---|---|
fieldConfig | Object, Array | true | - | An object defining the available properties and options for each field type in the PropertyEditor (e.g., configuration for ‘text’, ‘select’, ‘number’ fields). |
modelName | String | true | - | The name of the model being edited. Used for context, often passed to child components. |
yamlDataProp | Object | true | - | The main schema object containing keys like vue, table, form, and view. Use .sync for two-way binding. |
yamlDbDataProp | Array, Object | true | - | The array of fields for the database schema (db tab). Use .sync for two-way binding. |
dbObjectSchemaProp | Object | false | { primary_key: '', fields: {} } | The schema for the DB Object editor, defining primary keys and field details. Use .sync for two-way binding. |
printSettingProp | Object | true | - | An object containing page setup configurations for printing (margins, pagination, etc.). Use .sync for two-way binding. |
formLayoutProp | String | false | '' | The raw YML string for the form layout. Used by the text-based layout editor. Use .sync. |
viewLayoutProp | String | false | '' | The raw YML string for the view layout. Used by the text-based layout editor. Use .sync. |
formLayoutYmlProp | String | false | '' | YML output from the visual form layout editor. Use .sync. |
formLayoutHtmlProp | String | false | '' | HTML output from the visual form layout editor. Use .sync. |
formLayoutBladeProp | String | false | '' | Blade template output from the visual form layout editor. Use .sync. |
formLayoutMarkdownProp | String | false | '' | Markdown output from the visual form layout editor. Use .sync. |
viewLayoutYmlProp | String | false | '' | YML output from the visual view layout editor. Use .sync. |
viewLayoutHtmlProp | String | false | '' | HTML output from the visual view layout editor. Use .sync. |
viewLayoutBladeProp | String | false | '' | Blade template output from the visual view layout editor. Use .sync. |
viewLayoutMarkdownProp | String | false | '' | Markdown output from the visual view layout editor. Use .sync. |
Print Template Props
These props manage the content for different sections of the print template. All use the.sync modifier.
| Prop Name | Type | Default | Description |
|---|---|---|---|
printBodyProp | String | '' | The main body content of the print template. |
printHeadFirstPageProp | String | '' | Special header content only for the first page. |
printHeadLeftProp | String | '' | Content for the left side of the header. |
printHeadRightProp | String | '' | Content for the right side of the header. |
printFooterFullProp | String | '' | Content spanning the full width of the footer. |
printFooterLeftProp | String | '' | Content for the left side of the footer. |
printFooterCenterProp | String | '' | Content for the center of the footer. |
printFooterRightProp | String | '' | Content for the right side of the footer. Note: Not in component template but good to have for consistency. |
Tab Visibility Props
These boolean props control which tabs are visible in the editor interface.| Prop Name | Type | Default | Description |
|---|---|---|---|
showVueTab | Boolean | true | Toggles visibility of the ‘vue’ schema tab. |
showTableTab | Boolean | true | Toggles visibility of the ‘table’ schema tab. |
showFormTab | Boolean | true | Toggles visibility of the ‘form’ schema tab. |
showViewTab | Boolean | true | Toggles visibility of the ‘view’ schema tab. |
showDbTab | Boolean | true | Toggles visibility of the ‘db’ schema tab. |
showDbObjectSchemaTab | Boolean | true | Toggles visibility of the ‘db object schema’ tab. |
showFormLayoutTab | Boolean | true | Toggles visibility of the form layout tabs. |
showViewLayoutTab | Boolean | true | Toggles visibility of the view layout tabs. |
showDocumentTemplateTab | Boolean | true | Toggles visibility of the ‘document template’ tab. |
showPrintTemplateTab | Boolean | true | Toggles visibility of the ‘print template’ tab. |
showPageSetupTab | Boolean | true | Toggles visibility of the ‘print preview’ tab. |
showYmlTab | Boolean | true | Toggles visibility of the main ‘yml’ output tab. |
showDbYmlTab | Boolean | true | Toggles visibility of the ‘db yml’ output tab. |
showPrintYmlTab | Boolean | true | Toggles visibility of the ‘print yml’ output tab. |
showPageSetupYmlTab | Boolean | true | Toggles visibility of the ‘page setup yml’ tab. |
URL Props
These props define the API endpoints required for certain features to function.| Prop Name | Type | Required | Description |
|---|---|---|---|
formPreviewUrl | String | true | URL to fetch the rendered HTML for the form layout preview. |
viewPreviewUrl | String | true | URL to fetch the rendered HTML for the view layout preview. |
renderPreviewUrl | String | true | URL to render the print preview HTML from template and schema data. |
fileTreeUrl | String | true | URL to fetch the directory structure of available YAML files to load. |
loadYamlUrl | String | true | URL to load the content of a selected YAML file. |
3. Emitted Events (.sync)
The YamlEditor is designed to work with two-way data binding. It emits update:propName events for all data-related props. When using this component, you should use the .sync modifier (Vue 2) or v-model:propName (Vue 3) on the corresponding props to ensure data is updated in the parent component.
Example using .sync (Vue 2):
4. Usage Example
Here is a complete example of how to integrate theYamlEditor into a parent Vue component.

