Skip to main content

YamlEditor Component Documentation

1. Overview

The YamlEditor 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, and db contexts.
  • 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.
It features live previews, synchronization tools, and the ability to load schemas from files or pasted text, making it a powerful tool for rapid application development.

2. Props

The YamlEditor 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.
These props manage the content for different sections of the print template. All use the .sync modifier.

Tab Visibility Props

These boolean props control which tabs are visible in the editor interface.

URL Props

These props define the API endpoints required for certain features to function.

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 the YamlEditor into a parent Vue component.