Layout Components
Buttons
identifier: string
style: primary|dashed|danger|link|-
icon: string
https://antdv.com/components/icon/link: object
Link to other resourcehref: string
URL/URI of resourceexternal: boolean
If the link refers to a resource from another pagetarget: string
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes
display_style: scrollable|block|flex|-
options.flex: 1|-
options.justify_content: ?string
https://developer.mozilla.org/de/docs/Web/CSS/justify-contentoptions.items: ?array
array of dropdown items. button will be displayed as a dropdown-buttonoptions.items[index].identifier: string
dropdown item will be rendered as a divider if emptyoptions.items[index].icon: ?string
https://antdv.com/components/icon/
Customizing the default Buttons
There are some default buttons present in every system. These Buttons handle basic functions like saving a resource, redirecting to /create and more. You can modify the behaviour of these buttons for each module by defining custom options in the bakery plan module definition.
Code example:
The keys are:
save
for default ‘save’ button in create viewupdate
for default ‘save’ button in update/edit viewcontinue
for default ‘save and continue’ button in update/edit viewdelete
for default ‘delete’ button in show viewedit
for default ‘edit’ button in show viewcreate
for default ‘create’ button in index viewexcel
for default ‘excel’ button in index view
All buttons can take the following options:
display: Boolean
(whether to display the button at all. Default: true)title: String
(a custom title for the button. will be prefixed withbuttons.
for translations)trigger: event_identifier
(The event identifier to trigger when the button is clicked. this will change the functionality of the button and not trigger the default actions)style: primary|dashed|danger|link|-
All of these options can be used individually or combined.
A note to trigger
: if the button_key is save
, update
or contiune
(the buttons in /edit and /create) the current
value of any fields will be sent to the prototype
output of the event element.
Adding Custom Buttons
You can add custom buttons to the Buttonbar that can trigger any webhook. These Buttons will be shown before other
webhook buttons that where auto added by workflow elements using show_in_button_bar: true
.
These Buttons are defined the same way and in the same place as customising the default buttons, and they support (mostly) the same options.
There are a few quirks to look out for though:
- Custom Buttons have to use an identifier that is not one of the keys for default buttons defined above!
- The
display
option is ignored and does nothing when defined on custom buttons. Set ‘show_in’ to an empty array if you want to hide a button! - If the
trigger
option is not set, the identifier of the button will be used and treated as a webhook identifier - If the
title
option is not set, the identifier of the button will be used as the translation suffix - If
show_in
is not set, the button will show in every view. If it is set, it will respect the common module modes (e.b. “module.show”) - Using the
icon
option with a valid antd icon identifier changes the icon
Adding Buttons in Lists
You can define buttons in lists that will trigger webhooks with the current entity and field / row information of the clicked button. This enables you to get the specific tuple from the list that’s in the row where the corresponding button was pressed.
These Buttons will only show up in module.show
.
The Webhook will receive the field & row information in the selector
output.
It is an object with two keys.
fieldIdentifier <String>
: Is the identifier of the list from where the button was triggered.rowIndex <String>
: Is the index of the row from where the button was triggered.
Code example for a list field:
This Code example will create buttons in the first col of the list that will trigger the webhook webhook_identifier
.
The translation key of the th element will be buttons.custom_button
. The button will show the api
icon in the list.
Only the trigger
key is required. All other keys are optional.
- if no
title
is set, the title will bebuttons.webhook_identifier
. - if no
icon
is set, a default icon will be used. Only valid antd icon identifiers are supported. - if no
position
is set, the button col will be appended as the last col in the list.
Headline
options.identifier: string
options.size: small|-
options.align: center|-
Text
options.identifier: string
uses translation keymodule.texts.identifier
options.text: string
fallback if no identifier is set (be aware that this can not be translated)options.has_border: boolean
whether the text component itself should have an extra border. Useful when using in combination withshow_in
and in a col withoptions.borderless: true
Calendar
Option name | Type | Default | Description |
---|---|---|---|
available_views | array<ViewType> | ['year', 'month', 'week', 'day','list'] | View types (like “month”, “day”, etc.) that the user can choose from |
custom_views | array<ViewTypeDef> | [] | Definitions for custom views |
default_view | ViewType | month | Determines the view that is opened when opening the layout |
events | array<EventDef> | [] | The “event types” that this calendar will display |
editable | boolean | true | Determines if the events can be edited within the calendar by dragging and resizing |
height | string/int | 80vh | The height of the calendar |
week_numbers | boolean | false | Whether to show week numbers in day grid views (e.g. “month”) |
nav_buttons | boolean | true | Whether to show the navigation buttons |
filter_sidebar | boolean | true | Whether to show the filter sidebar |
Events
Option name | Type | Default | Description |
---|---|---|---|
identifier | string | Identifier of this event type. Used as a translation key. | |
module | module_identifier | The module containing the field defined in the field attribute | |
field | field_identifier | The field identifier of the field that contains the date of an event. This field needs to be of the types date ,datetime or dateRange | |
color | #hex | #1890ff | The event background color |
icon | Icon | An icon that will be displayed within the event element | |
quick_create | boolean | If quick creation in calendar view is possible for the event | |
pre_filters | array<PreFilter> | Filters out entities before displaying | |
recurrence | string object | Determines a pattern by which this event will reoccur within the calendar (e.g. monthly ). Reference. | |
text_color | #hex | #ffffff | The event text color |
title | string | The event title | |
recipes | Recipes | Recipes for all event attributes |
Fields
See Layout
-> Fields
Resource Table
module: module_identifier
the identifier of the module where resources will be loaded fromworkflow: webhook_identifier
the identifier of the workflow event if you want to use a workflow to fill the resource tablepre_filters: array<
PreFilterObject
>
defines prefilters for the tablehide_crud_buttons: boolean
hides the default ‘read’, ‘edit’, ‘delete’ buttons from the ‘actions’ colbuttons: array<Buttons>
contains an array with button definitions that will be rendered in the ‘actions’ colselectable: boolean
determines if the entries of the table can be selected. Defaults totrue
.columns: array<string>|
ColumnDef
array of columns to be displayed/fetched. By default, all fields (except for list fields) will be shown. Only the visible columns are fetched by default. If needed, the list of fetched columns can be expanded when using a
ColumnDef` definition.bulk_actions: array<Buttons>
array of buttons shown over the resource table that are hidden until an entry is selected.aggregates: array<
AggregateDef
>
defines which aggregates should be loaded to be available in recipes.summary: array<
SummaryDef
>
defines what the “summary”-rows at the bottom of the table should display.options: pageSize : int
default number of entities which get shown upon load
An array of IDs of the selected entries, ordered by their position in the table, will be sent to the given webhook event.
Standard actions (currently only deletions) can still be used by using the “action” property.
Options for custom Buttons
title: String
translation key. will be prefixed withbuttons.
(title: test) will be passed asbuttons.test
to the translator.icon: String
name of the antd icon typetype: primary|secondary|dashed|danger|link
antd button typeevent: String
webhook event name that will be triggered on a click. The Event gets the resource the current row represents.
Example of a table with one custom Button and no CRUD Buttons:
Example of a table with one custom bulk action and a custom “bulk-delete” button:
Pre-Filters
schema of a pre-filter Object:
Pre-filter Object using current module’s field:
Pre-filter Object using recipe:
full example of a resource table using a ColumnDef object
schema of a computed style:
AggregateDef schema
The key within the functions
object determines the key the loaded aggregate can later be
referenced in recipes by the key $.aggregates.<function_name>
.
The function
can be every aggregate function that MySQL
supports (like count
, sum
, min
, max
, avg
).
Example definition
With pre-filters:
SummaryDef schema
This definition consists of an object, whose keys are a field_identifier
that determine
under which column the defined data should be displayed.
The SummaryDef is defined within an array, every new array element means another
summary row will be appended to the table.
Use the recipe
option to calculate a fitting display of your data.
The type
allows the following values:
text
- Displays the data as text. Supports HTML.statistic
- Displays the data as an AntDesign “Statistic” component.progress
- Displays the data as a progress-bar. Needs to be a value between 0-100.
Example definition
Example definition of a progress bar summary field
Workflow resource
You can get data from your workflow and put this to your resourceTable by using an event/webhook and a response/ResourceTable. Your workflow should return data structured like this:
with the same keys as your resource_table
Differences to modules:
- No persistent data. ( No Edit / Delete or View)
- No row selection
- You have to use the input data in workflow to add searching, filtering and sorting functionalities
Example of Workflow Resource Table
What a workflow must consist of:
The event/webhook event which receives the following data:
result:
Result countpage
Current pagefilters : array
Searchfilter for columns Example: [column_key] => ( [0] => „searchstring“)sortField : string
Column to filtersortOrder : string
Sort Order ( Ascend / Descend )seach : string
Global search stringentity : array
Current Resource / Entity
you could get these by adding a variable to output like:
Key | Value data | input:
An elment to get your data Array like source/entities or a just an op/recipe with data
And at least the response/resourceTable Element which needs following data:
Resource Data
- Array of your DataCurrent Page
- Number of your Current Page (You could use $data.page if you have this set up)Entity per Page
- The number of entities per pageTotal
- The total amount of entities (Input will be ignored if you use Auto Pagination)Auto Pagination
- If it is set to True, your input array will be divided into the number of entries per page.
Collapsibles
Full example
collapsible
title: String
accordion: boolean
determine if only one panel should be open at a timeactive_key: boolean
select the open panel when the page is loadedno_padding: boolean
panels: array
the list of panels identified by their key
Panel
title: String
key: String
used to reference a panel
Affix
A component where its content is “sticky”, meaning that it will be fixed on top of the page when scrolling past it.
top: int
determines the offset from the top in pixelscomponents: array<Component>
layout components placed in the affix bar
Widgets
With the widget component, different charts can be displayed. The current chart options include: Donut, Line, Column and Progress
chart: String
determines the type of chart. This can be ‘donut’, ‘line’, ‘column’ or ‘progress’
Options for Donut
headline : String
instances : Array
labelsBelow : boolean
hideLegend : boolean
The instances array holds objects with the following values:
color : Hex
label : String
trigger: TriggerObject
(Optional)value : Int
The TriggerObject holds the following keys, all except type
are optional:
type: String
Required. Values:redirect
|webhook
target_module: String
(module identifier)target_resource: Int
(resource id)target_data: Object
Will be passed directly into the body of the webhook requesttarget_action: String
Module action (e.g.module.create
). Used for typeredirect
, default ismodule
target_anchor: String
Anchor tag, will be appended to url with leading#
when using typeredirect
Donut Example
headline : String
axis : Array
This Array stores strings. They are the labels to be displayed on the x-axis. (e.g. year numbers)lines : Array
This Array stores objects. One object stores the data for one line.
The lines Array holds objects with the following values:
label : String
The name of the linecolor : Hex
The color in which the line should be displayedvalues : Array
This Array stores Int values
Line Example
Options for Column
headline : String
axis : Array
This Array stores strings. They are the labels to be displayed on the x-axis. (e.g. year numbers)columns : Array
This Array stores objects. One object stores the data for one column.
The columns Array holds objects with the following values:
label : String
The name of the columncolor : Hex
The color in which the column should be displayedvalues : Array
This Array stores Int values
Column Example
Options for Progressbar
headline : String
max : Int
this defines which value would be 100%current : Int
defines the current number of completed steps/products/…color : Hex
ProgressBar Example
Navigation
The component navigation can calculate a route between two addresses. It has input fields and shows the arrival time. It can display an interactive map of the calculated route.
Options for Navigation
map: String
set this value to “true” if you want the map to be displayed. Otherwise the component will only show time and distance.
Map
The map component displays a single address with a marker on an interactive map. It has no input fields and shows the map only, the address data has to be set via api.
Options for Map
address: String
height: String
this is css, so values could be 30vh, 300px or something elsemode: heatmap;
heatmap shows additional heat information via a workflow response (*1)event: Workflowevent
you can use workflows to fill address data as its response