Skip to content

Window Element ​

windowElement is the metadata box of a detail page. It holds one or more panels, and each panel holds the metadata fields, nested lists or rich text of the entity. It is also where those fields are edited.

A work order's detail page puts its metadata in a window next to a list:

graphql
column2: column {
  size(size: forty)
  elements {
    windowElement {
      label(input: "window-element-labels.work-order")
      expandButtonOptions {
        shown(input: true)
      }
      editMetadataButton(input: { hasButton: true }) {
        ...editMetadataButton
      }
      windowElementStatus(
        windowElementStatusInput: {
          label: "metadata.labels.status"
          statusMetadataKey: "status"
          statusInputFieldType: workOrderStatusField
        }
      ) {
        ...windowElementStatus
      }
      info: panels {
        panelHeaderContent(panelHeaderContentInput: { label: "panel-labels.intake" }) {
          label
        }
        isCollapsed(input: false)
        isEditable(input: true)
        title: metaData {
          label(input: "metadata.labels.title")
          inputField(type: baseTextField) { ...inputfield }
        }
        planned_date: metaData {
          label(input: "metadata.labels.planned-date")
          inputField(type: baseDateField) { ...inputfield }
        }
      }
      notes: panels {
        # ...
      }
    }
  }
}

workOrderStatusField stands for a dropdown field type the client defines itself; statusInputFieldType takes any input field type.

Window fields ​

FieldEffect
labelHeader label, an i18n key
panelsThe panels, aliased once per panel. Order follows the selection order; the alias names are free
layoutVertical (default) stacks the panels; HorizontalGrid puts them in two columns
expandButtonOptions { shown orientation }A button on the window's side that flips the page's columns to 50/50 and back. orientation is left (default) or right
editMetadataButton(input: { hasButton, readmodeLabel, editmodeLabel, hideIfMetadataNotPresent })An "edit metadata" button for logged-in users. It switches the page to edit mode and does not save. hideIfMetadataNotPresent: "<key>" hides it while that metadata is empty
contextMenuActionsA context menu in the header, for logged-in users
windowElementStatus(windowElementStatusInput: { label, statusMetadataKey, statusInputFieldType })A status field in the header, always editable. label only shows in edit mode
hideInHistoryLeaves the window out of the history viewer
lineClampIn the schema, not read. Set lineClamp on the panel's metaData instead

Hiding the expand button

shown(input: false) still shows the button, because the resolver turns a falsy input into true. Leave expandButtonOptions out to hide it. orientation: top and bottom are accepted but render no button.

Panel fields ​

FieldEffect
panelHeaderContent(panelHeaderContentInput: { label, panelStatus, libraryData })The panel header. Clicking it toggles the panel. panelStatus adds a status field like the window's; libraryData { queryName dataKey label } adds a pill with a value read from a query
isCollapsedStarting state
isEditableWhether the panel's metaData fields are saved. Leaving it out counts as editable
canBeMultipleColumnsLays the fields out in an auto-fit grid, at least 250px per field
repetitionConfig(repetitionKey: "...")Makes the panel repeatable: "add more" and delete buttons in edit mode
displayCondition { key value }Shows the panel only when metadata key equals value, or, without value, when a relation key exists
can(input: [...])Drops the panel for users without that permission; see UI Permissions
metaDataA field, aliased once per field; see Inputs & Teaser Metadata
entityListElement, wysiwygElementA list or rich text field inside the panel
relationShows the entity's relations as a list instead of the panel's metaData fields, as soon as there are any
bulkData(bulkDataSource)Replaces the fields with plain key/value pairs from that source
info, panelTypeNot rendered; panelType is deprecated

info: panels { ... } in a query is an alias for panels, not the info field.

A collapsed panel needs a header

A panel with isCollapsed(input: true) and no panelHeaderContent label has nothing to click, so it can never be opened.

Editing and saving ​

A window has no save button of its own. In edit mode its inputs are part of the entity's form, and the page's save sends only the keys registered as editable:

  • metaData fields with an inputField, in panels that are editable;
  • the window and panel status keys;
  • the metadataKey of every wysiwyg field.

A field with readOnly for the current user is dropped from that list. isEditable(input: false) does not stop a nested wysiwyg field from saving, because it registers its key itself.

The pieces ​

FileRepoRole
src/components/entityElements/EntityElementWindow.vueelody-pwathe window, header, status, expand and edit buttons
src/components/windowPanel/EntityElementWindowPanel.vueelody-pwaa panel: header, collapse, repetition
src/components/windowPanel/WindowPanelContent.vueelody-pwafields, nested lists and wysiwyg, relations
src/composables/useFormHelper.tselody-pwawhich keys are editable and saved
baseModule/baseResolver.tselody-base-graphqlWindowElement and WindowElementPanel resolvers and defaults

Powered by Elody - Open Source Semantic Data Platform