UI Builder
Windows
In Anacleto each window is represented by a json object, this object contains all the info needed to render the entire window.
Below is an example
It is essential for each component to specify the id
attribute, this will allow us to interact with the control via Javascript.
For example, suppose we want to change the label of the title
input field inside the home_sample_form
panel, what we need to do is:
The id of an component is NOT the id of the html tag
Avoid DOM manipulation with Javascript
NEVER use js functions such as: document.getElementById
or document. querySelector
to modify a window.
Anacleto was developed in React and to use its full potential we must forget the existence of these methods, in React every graphic control is linked to states and to modify it you have to act on these states.
Layout
When creating a window you can choose between 2 types of layouts, using the layout
property
grid
flex
If no property is specified, the default grid
will be used.
Grid layout
When using the grid layout Anacleto is completely autonomous in arranging the panels within a window, the only thing you need to do is give the panels a weight from 1 to 12.
If a weight is not specified by default the value is 12.
The weight of a panel must be specified through the className
property using the appropriate classes col-1
, col-2
... col-12
.
If you decide to use col
without specifying a weight, the columns will be evenly distributed.
If you want to give a column a specific dimension use col-fixed
and specify the desired dimension in the style.
You can define a different weight for different screens, to do this use the prefixes:
sm
md
lg
xl
Imagine the screen divided into 12 columns, in the code below the panel width will default to 12 (the full screen width). On medium sized screens the panel will occupy 8 columns (2/3 of the screen), while on large (or very large) large screens the panel will occupy 6 columns of 12 (ie half the screen).
You can use classNames
to add the other panel class, for example col-offset-1..col-offset-12
classes allow you to define the left margin, useful if you want to add spaces or center a panel.
You can combine multiple grid layouts to create more complex layouts, an example is below.
Flex system
Flex, flex and more flex...if you don't know what we're talking use Google 😊 below some tutorial:
If you want to be free to draw a window as you like, set the window attribute layout=flex
, from now on you will be free to position the panels as you wish using the classNames property
When you use the flex
layout, Anacleto di provides some classes that can help you.
flex-row
setflex-direction: row;
flex-row-reverse
setflex-direction: row-reverse;
flex-column
setflex-direction: column;
flex-column-reverse
setflex-direction: column-reverse;
flex-wrap
setflex-wrap: wrap;
flex-wrap-reverse
setflex-wrap: wrap-reverse;
flex-nowrap
setflex-wrap: nowrap;
flex-auto
setflex: 1 1 auto;
flex-1
setflex: 1 1 0% !important;
useful when you want to give weight 1 to a panel (if you put 3 panels with flex 1 all 3 will be the same width)flex-2
setflex: 2 2 0% !important;
useful when you want to give weight 2 to a panel (it will always be twice as wide as a panel with flex 1)flex-grow-0
setflex-grow: 0;
flex-grow-1
setflex-grow: 1
flex-shrink-0
setflex-shrink: 0;
flex-shrink-1
setflex-shrink: 1;
All these classes support sm, md, lg, xl use them to create proper responsive applications
Gap
In the responsive DO NOT use margins and padding, use the gap
gap-0
setgap: 0;
gap-1
setgap: 0.25rem;
gap-2
setgap: 0.5rem;
gap-3
setgap: 1rem;
gap-4
setgap: 1.5rem;
gap-5
setgap: 2rem;
gap-6
setgap: 3rem;
gap-7
setgap: 4rem;
gap-8
setgap: 5rem;
row-gap-0
setrow-gap: 0;
row-gap-1
setrow-gap: 0.25rem;
row-gap-2
setrow-gap: 0.5rem;
row-gap-3
setrow-gap: 1rem;
row-gap-4
setrow-gap: 1.5rem;
row-gap-5
setrow-gap: 2rem;
row-gap-6
setrow-gap: 3rem;
row-gap-7
setrow-gap: 4rem;
row-gap-8
setrow-gap: 5rem;
column-gap-0
setcolumn-gap: 0;
column-gap-1
setcolumn-gap: 0.25rem;
column-gap-2
setcolumn-gap: 0.5rem;
column-gap-3
setcolumn-gap: 1rem;
column-gap-4
setcolumn-gap: 1.5rem;
column-gap-5
setcolumn-gap: 2rem;
column-gap-6
setcolumn-gap: 3rem;
column-gap-7
setcolumn-gap: 4rem;
column-gap-8
setcolumn-gap: 5rem;
Prime flex
Anacleto is based on PrimeFlex, at this link you can find many other useful classes PrimeFlex
Style
For each panel (or control) you can use the style property to define in-line styles. Use it with caution, in general it's always better to define a class!
Es:
Translations
Anacleto allows you to translate your application and will use the browser language to show the correct translation.
Docs
Components
In an Anacleto window you can insert different types of component
Last updated