Unicat API Reference

Up - API Reference - Home


data layouts

A layout is linked to a definition or class and specifies how a record's fields are arranged in the worksheet.

The layout is a hierarchical structure, starting with a root component. It is stored as a flat list of components that reference each other, so it becomes a tree structure when parsed.

The returned dictionary with layouts uses the global identifier (gid) as a key.

You make changes to a definition's layout or a class' layout, not to a standalone layout. You'll get a working copy of the definition or class, and a working copy of the layout. These are temporary works in progress, where you make changes to a layout without committing them yet (the original layout is still active, and users will not see the work-in-progress changes yet). Once you're happy with the updated layout, you can commit it by committing the definition or class. If you're unhappy instead, you can revert the definition or class and you'll get the unmodified layout again (and the unmodified definition or class).

Layout data

{
    ,
    "data": {
        "layouts": {
            "9dace1d3-58cb-40e6-b994-d04853f37a73": {
                "gid": "9dace1d3-58cb-40e6-b994-d04853f37a73",
                "original": "1b0f4a37-b323-446d-9c7a-308725e30b83",
                "name": "group",
                "root": "72dc649a-9ab9-4197-92aa-5fca7a1a7369",
                "components": {
                    "1e10e271-eef6-4f3b-a001-eed24f9c6650": {
                        "type": "horizontal",
                        "content": [
                            "33d1d475-ba4f-4431-9ec7-502c08cd77b1",
                            "14a78672-e9c2-4ad2-94a0-34b15226ee80"
                        ]
                    },
                    "72dc649a-9ab9-4197-92aa-5fca7a1a7369": {
                        "type": "vertical",
                        "content": [
                            "f4efd06a-a376-4a70-84ca-06a9f63cbef9",
                            "1e10e271-eef6-4f3b-a001-eed24f9c6650",
                            "03af11af-be65-4a81-abb2-38bbcae66366"
                        ]
                    },
                    "33d1d475-ba4f-4431-9ec7-502c08cd77b1": {
                        "size": "grow",
                        "type": "vertical",
                        "content": [
                            "8f47642a-cc79-46ef-b25a-94584aa5c18c",
                            "76382dd2-15f7-43a4-b8a8-4e46453be27f"
                        ]
                    },
                    "f4efd06a-a376-4a70-84ca-06a9f63cbef9": {
                        "type": "field",
                        "field": "2f3dd457-b885-4c23-8490-7895ab5d683a",
                        "style": "title",
                        "placeholder": {
                            "en": "Group name, also used in the tree navigation."
                        }
                    },
                    "8f47642a-cc79-46ef-b25a-94584aa5c18c": {
                        "type": "field",
                        "field": "f39935a1-2364-4efd-a47a-7cdc595f6d21",
                        "placeholder": {
                            "en": "Full description."
                        }
                    },
                    "65ddb05a-662d-49a4-8b4f-7f1853c44ade": {
                        "type": "field",
                        "field": "8cea6beb-487a-49a1-a2c6-2258b073cc4d",
                        "style": "thumb",
                        "placeholder": {
                            "en": "Image, usable in tiles or as a hero image."
                        }
                    },
                    "03af11af-be65-4a81-abb2-38bbcae66366": {
                        "type": "divider"
                    },
                    "76382dd2-15f7-43a4-b8a8-4e46453be27f": {
                        "type": "field",
                        "field": "b1ae6775-45bd-4aaf-bdf2-21a11243bff9",
                        "placeholder": {
                            "en": "Short summary, usable in tiles or cards."
                        }
                    },
                    "14a78672-e9c2-4ad2-94a0-34b15226ee80": {
                        "size": 250,
                        "type": "vertical",
                        "content": [
                            "65ddb05a-662d-49a4-8b4f-7f1853c44ade"
                        ]
                    }
                },
                "gid_map": {
                    "1b0f4a37-b323-446d-9c7a-308725e30b83": "9dace1d3-58cb-40e6-b994-d04853f37a73",
                    "a46f33ad-c429-4381-9511-37f6172c1a4d": "1e10e271-eef6-4f3b-a001-eed24f9c6650",
                    "ddbce870-4318-400a-a6bd-f65de4afd43c": "72dc649a-9ab9-4197-92aa-5fca7a1a7369",
                    "04fa2f9c-3fb9-4aad-ba8a-0bf2ce7fede9": "33d1d475-ba4f-4431-9ec7-502c08cd77b1",
                    "dda428fd-5a37-44e1-a958-3150b979741d": "f4efd06a-a376-4a70-84ca-06a9f63cbef9",
                    "ecdb5237-822c-441a-8fae-5a952158b917": "8f47642a-cc79-46ef-b25a-94584aa5c18c",
                    "f5077f22-37c7-4ab6-819c-09441f95cb9d": "65ddb05a-662d-49a4-8b4f-7f1853c44ade",
                    "e32c0340-e052-443b-8d9b-965b89c3d9c9": "03af11af-be65-4a81-abb2-38bbcae66366",
                    "6040b0f5-eb0a-4a59-b95b-900067beb073": "76382dd2-15f7-43a4-b8a8-4e46453be27f",
                    "ec6a524f-ad28-43bd-a1bc-2dcacbaac788": "14a78672-e9c2-4ad2-94a0-34b15226ee80"
                },
                "is_new": false,
                "is_working_copy": true
            }
        }
    }
}

Layout properties

gid global identifier
original for working copies, this points to the original layout gid
name name to be used in code, should be variable-name compatible (letters, numbers, underscores - no dashes, spaces, punctuation)
root gid for the root component from the list of components
components the list of components, each has a global identifier as a key - a component has a type and options, described below
gid_map for working copies, each original component key is mapped to the corresponding working copy component key - for other layouts, it is empty
is_new indicates a newly created layout that has never been committed.
is_working_copy indicates a new or modified layout that has not been committed.

Note: the gid_map isn't updated when changes are made to the working copy - if you delete a component, its reference will still be in the gid_map.

Types

vertical a component container - components are stacked vertically
horizontal a component container - components are stacked horizontally
spacer add space between components

field an input for a field
fieldlist fields from the currently selected fieldlist

definition include the layout from a base definition
class include a class layout
autoextend automatically add all extra classes and fields from an extended definition not specified elsewhere in the layout
autogenerate automatically add all classes and fields

table show fields from the child records in a table format
rows show fields from the child records in a list format
tiles show fields from the child records in a tiled format

image a static image
text a static text
divider a visual divider between components

Options

size either a number in pixels, or grow - for vertical, horizontal, and spacer components
style should it look like a title, a subtitle, a thumb
placeholder if the field has no value, a description for the user what to enter in the field - localized for UI-languages (no relation to project-languages)

A more complete description of how layouts work and what you can achieve with them is forthcoming.