Schema for Einstein Table Settings

From TableSettings.schema.yaml (einstein/TableSettings.schema)

---
$id: https://skeleton.botmd.io/einstein/TableSettings.schema
$schema: http://json-schema.org/draft-07/schema#

title: Table Settings
description: Schema for configuring the look and feel of a table.

type: object
additionalProperties: false
required: [title, columns]

properties:
  title:
    title: Title
    description: Title of the table for display to the user. Will be passed through i18n.
    type: string
    minLength: 1
  #end title

  defaultSortField:
    title: Default sort field
    description: This is used to decide the default sorting for the result set.
    type: string
    minLength: 1

  orderDesc:
    title: Order descending
    description: Result is order in descending order based on the default sort field is set to true.
    type: boolean
  #end orderDesc

  columns:
    title: Columns
    description: Settings for each column in the table. This is an ordered array of columns from left to right.

    type: array
    minItems: 1

    items:
      type: object
      additionalProperties: false
      required: [id, header]

      properties:
        id:
          title: ID
          description: Column unique identifier. This is used for sorting purposes.
          type: string
          minLength: 1

        header:
          title: Header
          description: The column header for display. Will be passed through i18n if its a string, if it is an object it will be rendered based on the component property (ie. component "TableSectionHeader, TableSubSectionHeader", componentProps "title, subtitle").
          type: [string, object]
          minLength: 1
        #end header

        is_required:
          title: Is Required
          description: Boolean flag indicating if this column is required.
          type: boolean
        #end is_required

        accessor:
          title: Accessor
          description: Accessor value to use to retrieve the data
          type: string
          minLength: 1
        #end accessor

        sticky:
          title: Sticky
          description: Make column sticky either to left or right
          enum: [left, right]
        #end sticky

        bgColor:
          title: Background color
          description: background color of the column
          type: string
          minLength: 3
        #end bgColor

        subColumns:
          title: Sub columns
          description: Define child columns within a header column. The properties of this column are similar to its parent
          type: array
          minItems: 1
          items:
            type: object
            additionalProperties: true
            required: []
        #end subColumns

        component:
          title: Component
          description: The component to render. Defaults to `Text`.
          enum: [Text, Link, Alert, Comment, BGTableCell, Badge, Status] # Frontend engineer to update list of possible components
        #end component

        width:
          title: Width
          description: Width of the column. Defaults to browser math.
          type: string
          minLength: 1
        #end width

        style:
          title: Style
          description: Styling props to pass to the component.

          type: object
          additionalProperties: true
          required: []
        #end style

        disableSortBy:
          title: Disable Sort By
          description: Make this column un-sortable. Defaults to `false`.
          type: boolean
        #end disableSortBy

        data:
          title: Data
          description: Describes how data is being formatted and rendered to the user.

          type: object
          additionalProperties: false
          required: [valueTemplate]

          properties:
            valueTemplate:
              title: Value Template
              description: |-
                Template string (include `${x}` variables) to define how cells are rendered.

                For a list of substitutable variables, refer to the corresponding Jarvis Chernobyl Provider settings.
              type: string
            #end valueTemplate

            hrefTemplate:
              title: Href Template
              description: Template string for `href` of `Link` component. The same variables set as `valueTemplate` is supported.
              type: string
            #end hrefTemplate
          #end properties
        #end data
      #end properties
    #end items
  #end columns
#end properties

[Main Page] [Schema Documentation] [Examples]