Appearance
Designs
Designs are the visual representation of documents.
They are identified by name which can include a namespace (colon separated as in ae:my-example
). The name signifies as what to render a document.
For example, a common design name is title
, which renders a document as a title. Usually this means render just the content of the name field of the document. Another example is card-content
, which renders a document as one would inside a card or tree-item
.
Designs are documents of type design-form
and consist of a template, style,and controller script.
Usage
In order to use a design in html you would use the following syntax:
html
<!-- Render a specific document as a title -->
<ae-design name="title" document-id="my-document-id"></ae-design>
<!-- Render a document as linked to by a reference field -->
<ae-design name="title" :document="data.myRefField"></ae-design>
Parameters
Designs can have parameters. These are passed as attributes to the design element. For example:
html
<ae-design name="title" document-id="my-document-id" :param-my-param="true" param-another="Fixed Value"></ae-design>
These parameters are available in the controller script of the design and its html template under the object params
where each attribute is camel-cased. In the above example:
javascript
// controller script (any function inside)
myFunction() {
console.log(params.myParam); // true
console.log(params.another); // Fixed Value
}
Or in the design template:
html
<div v-if="params.myParam">
<p>{{params.another}}</p>
</div>
Lookup Rules
As designs are identified by name, the lookup rules are are more complex than for layouts, but similar to controls. The lookup rules are as follows:
- If the form of the document being rendered has a child document of type
design-form
with the same name as the design, then that document is used as the design. - With the Form of the document as a starting point, we look for a folder on each level to each successive parent with the type
design-folder
and look for a child document of typedesign-form
with the same name as the design.- If the current ancestor we investigate is a
form-folder
we look through any referenceddesign-folder
from the styling section of the form. - If the current ancestor we investigate is an
application-form
we look through any referenceddesign-folder
from the styling section of the application. - If we reached the root we investigate the root form and look through any referenced
design-folder
from the styling section of the root.
- If the current ancestor we investigate is a
- At last we lookup the design in the Fallback Design folder (
id:fallback-designs
) of the system folder.
Lookup Graph
This flowchart visually represents the lookup rules for designs.