diff --git a/README.md b/README.md index f87955c0..e8cd4013 100644 --- a/README.md +++ b/README.md @@ -115,20 +115,7 @@ The catalog is a YAML formatted file which tells the app what nodes are availabl #### uiSchema -The global and node parameters are edited in a form generated from the JSON schema. -To customize the look and feel of the form the uiSchema can be used. For example rendering a radio group or a text area. The [react-json-schema-form](https://react-jsonschema-form.readthedocs.io/en/latest/api-reference/uiSchema/) docs describes the uiSchema format. - -Besides the built-in react-json-schema-form uiSchema fields the workflow builder adds the following: - -```json -{ - "prop1": { - "ui:group": "" - } -} -``` - -Any property with a group uiSchema field will be grouped together with other properties with the same group in the form. The generated toml file will have the props ungrouped. +See [docs/uiSchema.md](docs/uiSchema.md). ### tomlSchema diff --git a/docs/uiSchema.md b/docs/uiSchema.md new file mode 100644 index 00000000..d1fe81e4 --- /dev/null +++ b/docs/uiSchema.md @@ -0,0 +1,98 @@ +# UI schema + +The global and node parameters are edited in a form generated from the JSON schema. +To customize the look and feel of the form the `uiSchema` can be defined in the catalog. +For example rendering a radio group or a text area can be done by filling the `uiSchema`. + +The [react-json-schema-form](https://react-jsonschema-form.readthedocs.io/en/latest/api-reference/uiSchema/) docs describes the uiSchema format and which built-in fields are avaiable. + +Besides the built-in react-json-schema-form uiSchema fields, the workflow builder adds the following: + +## ui:field: collapsible + +An property of type object can be rendered as a collapsible sub-form with + +```json +{ + "prop1": { + "ui:field": "collapsible" + } +} +``` + +This will render the children of `prop1` in a initially collapsed sub-form. +To expand press the expand icon button. + +### Initially expanded + +Render the sub-form initially expanded with + +```json +{ + "prop1": { + "ui:field": "collapsible", + "ui:collapsed": true + } +} +``` + +Or alternativly using `ui:options` with + +```json +{ + "prop1": { + "ui:field": "collapsible", + "ui:options": { + "collapsed": true + } + } +} +``` + +## ui:group + +```json +{ + "prop1": { + "ui:group": "" + } +} +``` + +Any property with a group uiSchema field will be grouped together with other properties with the same group in the form. The generated toml file will have the props ungrouped. +The group will also be collapsible and collapsed by default. + +## ui:field: table + +A property which is an array of objects can be rendered as a table with + +```json +{ + "prop1": { + "ui:field": "table" + } +} +``` + +Each array item will be a row and each object property will be a column. +The header cells show the title of the property together with a popup for the description. +The other cells show the property without any titles or descriptions. + +### Column widths + +The column widths can be customized. + +For example given an array of objects with properties `prop2` and `prop3`. To make `prop3` column have `40%` of the total table width use: + +```json +{ + "prop1": { + "ui:field": "table", + "ui:options": { + "widths": { + "prop3": "40%" + } + } + } +} +``` diff --git a/public/catalog/haddock3.expert.yaml b/public/catalog/haddock3.expert.yaml index bc87a707..bf92a6e8 100644 --- a/public/catalog/haddock3.expert.yaml +++ b/public/catalog/haddock3.expert.yaml @@ -1583,6 +1583,8 @@ nodes: nrair: ui:group: ab initio mode rair: + items: + ui:field: table ui:group: ab initio mode surfrest: ui:group: ab initio mode @@ -1612,26 +1614,32 @@ nodes: numc2sym: ui:group: symmetry c2sym: + ui:field: table ui:group: symmetry numc3sym: ui:group: symmetry c3sym: + ui:field: table ui:group: symmetry numc4sym: ui:group: symmetry c4sym: + ui:field: table ui:group: symmetry numc5sym: ui:group: symmetry c5sym: + ui:field: table ui:group: symmetry numc6sym: ui:group: symmetry c6sym: + ui:field: table ui:group: symmetry nums3sym: ui:group: symmetry s3sym: + ui:field: table ui:group: symmetry ncs_on: ui:group: symmetry @@ -1640,6 +1648,7 @@ nodes: numncs: ui:group: symmetry ncs: + ui:field: table ui:group: symmetry w_dist: ui:group: scoring @@ -4399,26 +4408,32 @@ nodes: numc2sym: ui:group: symmetry c2sym: + ui:field: table ui:group: symmetry numc3sym: ui:group: symmetry c3sym: + ui:field: table ui:group: symmetry numc4sym: ui:group: symmetry c4sym: + ui:field: table ui:group: symmetry numc5sym: ui:group: symmetry c5sym: + ui:field: table ui:group: symmetry numc6sym: ui:group: symmetry c6sym: + ui:field: table ui:group: symmetry nums3sym: ui:group: symmetry s3sym: + ui:field: table ui:group: symmetry ncs_on: ui:group: symmetry @@ -4427,6 +4442,7 @@ nodes: numncs: ui:group: symmetry ncs: + ui:field: table ui:group: symmetry w_air: ui:group: scoring @@ -4473,6 +4489,8 @@ nodes: nseg1: ui:group: flexibility seg: + items: + ui:field: table ui:group: flexibility nseg2: ui:group: flexibility @@ -4515,6 +4533,8 @@ nodes: nfle1: ui:group: flexibility fle: + items: + ui:field: table ui:group: flexibility nfle2: ui:group: flexibility @@ -6358,26 +6378,32 @@ nodes: numc2sym: ui:group: symmetry c2sym: + ui:field: table ui:group: symmetry numc3sym: ui:group: symmetry c3sym: + ui:field: table ui:group: symmetry numc4sym: ui:group: symmetry c4sym: + ui:field: table ui:group: symmetry numc5sym: ui:group: symmetry c5sym: + ui:field: table ui:group: symmetry numc6sym: ui:group: symmetry c6sym: + ui:field: table ui:group: symmetry nums3sym: ui:group: symmetry s3sym: + ui:field: table ui:group: symmetry ncs_on: ui:group: symmetry @@ -6386,6 +6412,7 @@ nodes: numncs: ui:group: symmetry ncs: + ui:field: table ui:group: symmetry w_air: ui:group: scoring @@ -6430,6 +6457,8 @@ nodes: nseg1: ui:group: flexibility seg: + items: + ui:field: table ui:group: flexibility nseg2: ui:group: flexibility @@ -6472,6 +6501,8 @@ nodes: nfle1: ui:group: flexibility fle: + items: + ui:field: table ui:group: flexibility nfle2: ui:group: flexibility @@ -8231,26 +8262,32 @@ nodes: numc2sym: ui:group: symmetry c2sym: + ui:field: table ui:group: symmetry numc3sym: ui:group: symmetry c3sym: + ui:field: table ui:group: symmetry numc4sym: ui:group: symmetry c4sym: + ui:field: table ui:group: symmetry numc5sym: ui:group: symmetry c5sym: + ui:field: table ui:group: symmetry numc6sym: ui:group: symmetry c6sym: + ui:field: table ui:group: symmetry nums3sym: ui:group: symmetry s3sym: + ui:field: table ui:group: symmetry ncs_on: ui:group: symmetry @@ -8259,6 +8296,7 @@ nodes: numncs: ui:group: symmetry ncs: + ui:field: table ui:group: symmetry w_air: ui:group: scoring @@ -8299,6 +8337,8 @@ nodes: nseg1: ui:group: flexibility seg: + items: + ui:field: table ui:group: flexibility nseg2: ui:group: flexibility @@ -8341,6 +8381,8 @@ nodes: nfle1: ui:group: flexibility fle: + items: + ui:field: table ui:group: flexibility nfle2: ui:group: flexibility diff --git a/public/catalog/haddock3.guru.yaml b/public/catalog/haddock3.guru.yaml index 06341265..ed8029cb 100644 --- a/public/catalog/haddock3.guru.yaml +++ b/public/catalog/haddock3.guru.yaml @@ -1630,6 +1630,8 @@ nodes: nrair: ui:group: ab initio mode rair: + items: + ui:field: table ui:group: ab initio mode surfrest: ui:group: ab initio mode @@ -1667,26 +1669,32 @@ nodes: numc2sym: ui:group: symmetry c2sym: + ui:field: table ui:group: symmetry numc3sym: ui:group: symmetry c3sym: + ui:field: table ui:group: symmetry numc4sym: ui:group: symmetry c4sym: + ui:field: table ui:group: symmetry numc5sym: ui:group: symmetry c5sym: + ui:field: table ui:group: symmetry numc6sym: ui:group: symmetry c6sym: + ui:field: table ui:group: symmetry nums3sym: ui:group: symmetry s3sym: + ui:field: table ui:group: symmetry ncs_on: ui:group: symmetry @@ -1695,6 +1703,7 @@ nodes: numncs: ui:group: symmetry ncs: + ui:field: table ui:group: symmetry w_dist: ui:group: scoring @@ -4719,26 +4728,32 @@ nodes: numc2sym: ui:group: symmetry c2sym: + ui:field: table ui:group: symmetry numc3sym: ui:group: symmetry c3sym: + ui:field: table ui:group: symmetry numc4sym: ui:group: symmetry c4sym: + ui:field: table ui:group: symmetry numc5sym: ui:group: symmetry c5sym: + ui:field: table ui:group: symmetry numc6sym: ui:group: symmetry c6sym: + ui:field: table ui:group: symmetry nums3sym: ui:group: symmetry s3sym: + ui:field: table ui:group: symmetry ncs_on: ui:group: symmetry @@ -4747,6 +4762,7 @@ nodes: numncs: ui:group: symmetry ncs: + ui:field: table ui:group: symmetry w_air: ui:group: scoring @@ -4827,6 +4843,8 @@ nodes: nseg1: ui:group: flexibility seg: + items: + ui:field: table ui:group: flexibility nseg2: ui:group: flexibility @@ -4869,6 +4887,8 @@ nodes: nfle1: ui:group: flexibility fle: + items: + ui:field: table ui:group: flexibility nfle2: ui:group: flexibility @@ -6748,26 +6768,32 @@ nodes: numc2sym: ui:group: symmetry c2sym: + ui:field: table ui:group: symmetry numc3sym: ui:group: symmetry c3sym: + ui:field: table ui:group: symmetry numc4sym: ui:group: symmetry c4sym: + ui:field: table ui:group: symmetry numc5sym: ui:group: symmetry c5sym: + ui:field: table ui:group: symmetry numc6sym: ui:group: symmetry c6sym: + ui:field: table ui:group: symmetry nums3sym: ui:group: symmetry s3sym: + ui:field: table ui:group: symmetry ncs_on: ui:group: symmetry @@ -6776,6 +6802,7 @@ nodes: numncs: ui:group: symmetry ncs: + ui:field: table ui:group: symmetry w_air: ui:group: scoring @@ -6828,6 +6855,8 @@ nodes: nseg1: ui:group: flexibility seg: + items: + ui:field: table ui:group: flexibility nseg2: ui:group: flexibility @@ -6870,6 +6899,8 @@ nodes: nfle1: ui:group: flexibility fle: + items: + ui:field: table ui:group: flexibility nfle2: ui:group: flexibility @@ -8657,26 +8688,32 @@ nodes: numc2sym: ui:group: symmetry c2sym: + ui:field: table ui:group: symmetry numc3sym: ui:group: symmetry c3sym: + ui:field: table ui:group: symmetry numc4sym: ui:group: symmetry c4sym: + ui:field: table ui:group: symmetry numc5sym: ui:group: symmetry c5sym: + ui:field: table ui:group: symmetry numc6sym: ui:group: symmetry c6sym: + ui:field: table ui:group: symmetry nums3sym: ui:group: symmetry s3sym: + ui:field: table ui:group: symmetry ncs_on: ui:group: symmetry @@ -8685,6 +8722,7 @@ nodes: numncs: ui:group: symmetry ncs: + ui:field: table ui:group: symmetry w_air: ui:group: scoring @@ -8731,6 +8769,8 @@ nodes: nseg1: ui:group: flexibility seg: + items: + ui:field: table ui:group: flexibility nseg2: ui:group: flexibility @@ -8773,6 +8813,8 @@ nodes: nfle1: ui:group: flexibility fle: + items: + ui:field: table ui:group: flexibility nfle2: ui:group: flexibility diff --git a/public/catalog/kitchensink.yaml b/public/catalog/kitchensink.yaml index 93967340..7a5090ce 100644 --- a/public/catalog/kitchensink.yaml +++ b/public/catalog/kitchensink.yaml @@ -40,6 +40,8 @@ categories: description: Category 1 - name: expandabletests description: Nodes with expandable parameters +- name: tabletests + description: Nodes with tables nodes: - schema: title: Test to render group11 collapsed @@ -210,4 +212,35 @@ nodes: label: Node 4 description: Description 3 category: expandabletests +- schema: + title: Test to render nested1 as a table + type: object + properties: + nested1: + type: 'array' + title: 'Array of {prop1,prop2}' + items: + type: 'object' + properties: + prop1: + title: 'Prop 1' + description: 'Description 1' + type: 'string' + prop2: + title: 'Prop 2' + description: 'Description 2' + type: 'string' + additionalProperties: false + uiSchema: + nested1: + ui:field: table + tomlSchema: + nested1: + indexed: true + items: + flatten: true + id: node5 + label: Node 5 + description: Description 5 + category: tabletests examples: {} diff --git a/src/Form.tsx b/src/Form.tsx index c2f831ca..0929e4f7 100644 --- a/src/Form.tsx +++ b/src/Form.tsx @@ -1,6 +1,7 @@ import { withTheme, utils, WidgetProps } from '@rjsf/core' import { Theme } from '@rjsf/bootstrap-4' import { CollapsibleField } from './CollapsibleField' +import { TableField } from './table/TableField' // TODO workaround for broken bootsrap-4 file widget, see https://github.com/rjsf-team/react-jsonschema-form/issues/2095 const registry = utils.getDefaultRegistry() @@ -19,6 +20,7 @@ const DefaultFileWidget = registry.widgets.FileWidget; if (Theme.fields !== undefined) { Theme.fields.collapsible = CollapsibleField + Theme.fields.table = TableField } export const Form = withTheme(Theme) diff --git a/src/table/TableCellFieldTemplate.tsx b/src/table/TableCellFieldTemplate.tsx new file mode 100644 index 00000000..d6daa22e --- /dev/null +++ b/src/table/TableCellFieldTemplate.tsx @@ -0,0 +1,3 @@ +export const TableCellFieldTemplate = ({ children }: any): JSX.Element => { + return <>{children} +} diff --git a/src/table/TableFIeld.stories.tsx b/src/table/TableFIeld.stories.tsx new file mode 100644 index 00000000..40bda4f1 --- /dev/null +++ b/src/table/TableFIeld.stories.tsx @@ -0,0 +1,306 @@ +import { ComponentMeta, ComponentStory } from '@storybook/react' +import { action } from '@storybook/addon-actions' +import { TableField } from './TableField' +import { JSONSchema7 } from 'json-schema' +import { Form } from '../Form' +import 'bootstrap/dist/css/bootstrap.min.css' +import { UiSchema } from '@rjsf/core' + +const meta: ComponentMeta = { + title: 'TableField', + component: TableField +} + +export default meta + +function render (schema: JSONSchema7, uiSchema: UiSchema, formData = {}): JSX.Element { + const fields = { + table: TableField + } + return ( +
+ ) +} + +export const ArrayOfObjectsWithoutUISchema: ComponentStory = () => { + const schema: JSONSchema7 = { + type: 'object', + properties: { + group1: { + type: 'array', + items: { + type: 'object', + properties: { + prop1: { + type: 'string' + }, + prop2: { + type: 'string' + } + }, + additionalProperties: false + } + } + }, + additionalProperties: false + } + const uiSchema = { + } + return render(schema, uiSchema) +} + +export const ArrayOfObjectsAsTable: ComponentStory = () => { + const schema: JSONSchema7 = { + type: 'object', + properties: { + nested1: { + type: 'array', + title: 'Array of {prop1,prop2}', + items: { + type: 'object', + properties: { + prop1: { + title: 'Prop 1', + description: 'Description 1', + type: 'string' + }, + prop2: { + title: 'Prop 2', + description: 'Description 2', + type: 'string' + } + }, + additionalProperties: false + } + } + }, + additionalProperties: false + } + const uiSchema = { + nested1: { + 'ui:field': 'table' + } + } + const formData = { + nested1: [{ + prop1: '11', + prop2: '22' + }, { + prop1: '33', + prop2: '44' + }] + } + return render(schema, uiSchema, formData) +} + +export const ArrayOfObjectsAsTableWithCustomWidth: ComponentStory = () => { + const schema: JSONSchema7 = { + type: 'object', + properties: { + nested1: { + type: 'array', + title: 'Array of {prop1,prop2}', + items: { + type: 'object', + properties: { + prop1: { + title: 'Prop 1', + description: 'Description 1', + type: 'string' + }, + prop2: { + title: 'Prop 2', + description: 'Description 2', + type: 'string' + } + }, + additionalProperties: false + } + } + }, + additionalProperties: false + } + const uiSchema = { + nested1: { + 'ui:field': 'table', + 'ui:options': { + widths: { + prop1: '30%' + } + } + } + } + const formData = { + nested1: [{ + prop1: '11', + prop2: '22' + }, { + prop1: '33', + prop2: '44' + }] + } + return render(schema, uiSchema, formData) +} + +export const ArrayOfObjectsOfObjectsAsTable: ComponentStory = () => { + const schema: JSONSchema7 = { + type: 'object', + properties: { + nested1: { + type: 'array', + title: 'Array of {prop1,prop2}', + items: { + type: 'object', + properties: { + prop1: { + title: 'Prop 1', + description: 'Description 1', + type: 'object', + properties: { + prop1a: { + type: 'string', + title: 'Prop 1 a', + description: 'Description 1 a' + }, + prop1b: { + type: 'string', + title: 'Prop 1 b', + description: 'Description 1 b' + } + } + } + }, + additionalProperties: false + } + } + }, + additionalProperties: false + } + const uiSchema = { + nested1: { + 'ui:field': 'table' + } + } + const formData = { + nested1: [{ + prop1: { + prop1a: '11', + prop1b: '22' + } + }, { + prop1: { + prop1a: '44', + prop1b: '55' + } + }] + } + return render(schema, uiSchema, formData) +} + +export const ArrayOfObjectsWithRequiredPropsAsTable: ComponentStory = () => { + const schema: JSONSchema7 = { + type: 'object', + properties: { + nested1: { + type: 'array', + title: 'Array of {prop1,prop2}', + items: { + type: 'object', + properties: { + prop1: { + title: 'Prop 1', + description: 'Description 1', + type: 'string' + }, + prop2: { + title: 'Prop 2', + description: 'Description 2', + type: 'string' + } + }, + required: ['prop1', 'prop2'], + additionalProperties: false + } + } + }, + additionalProperties: false + } + const uiSchema = { + nested1: { + 'ui:field': 'table' + } + } + const formData = { + nested1: [{ + prop1: '11', + prop2: '22' + }, { + prop1: '33', + prop2: '44' + }] + } + return render(schema, uiSchema, formData) +} + +export const ArrayOfObjectsOfObjectsWithRequiredPropsAsTable: ComponentStory = () => { + const schema: JSONSchema7 = { + type: 'object', + properties: { + nested1: { + type: 'array', + title: 'Array of {prop1,prop2}', + items: { + type: 'object', + properties: { + prop1: { + title: 'Prop 1', + description: 'Description 1', + type: 'object', + properties: { + prop1a: { + type: 'string', + title: 'Prop 1 a', + description: 'Description 1 a' + }, + prop1b: { + type: 'string', + title: 'Prop 1 b', + description: 'Description 1 b' + } + }, + required: ['prop1a', 'prop1b'] + } + }, + required: ['prop1'], + additionalProperties: false + } + } + }, + additionalProperties: false + } + const uiSchema = { + nested1: { + 'ui:field': 'table' + } + } + const formData = { + nested1: [{ + prop1: { + prop1a: '11', + prop1b: '22' + } + }, { + prop1: { + prop1a: '44', + prop1b: '55' + } + }] + } + return render(schema, uiSchema, formData) +} \ No newline at end of file diff --git a/src/table/TableField.tsx b/src/table/TableField.tsx new file mode 100644 index 00000000..8b6a0b51 --- /dev/null +++ b/src/table/TableField.tsx @@ -0,0 +1,16 @@ +import { FieldProps } from '@rjsf/core' + +import { TableFieldTemplate } from './TableFieldTemplate' +import { TableRowFieldTemplate } from './TableRowFieldTemplate' +import { TableCellFieldTemplate } from './TableCellFieldTemplate' + +export const TableField = (props: FieldProps): JSX.Element => { + props.uiSchema['ui:ArrayFieldTemplate'] = TableFieldTemplate + if (!('items' in props.uiSchema)) { + props.uiSchema.items = {} + } + props.uiSchema.items['ui:ObjectFieldTemplate'] = TableRowFieldTemplate + props.uiSchema.items['ui:FieldTemplate'] = TableCellFieldTemplate + const ArrayField = props.registry.fields.ArrayField + return +} diff --git a/src/table/TableFieldTemplate.css b/src/table/TableFieldTemplate.css new file mode 100644 index 00000000..f51e62fe --- /dev/null +++ b/src/table/TableFieldTemplate.css @@ -0,0 +1,19 @@ +/* Make rows compact */ +.table-field .form-group { + margin-bottom: 0px; +} + +/* Hide any label or description in cells as they are rendered in column headers */ +.table-cell-field > div > fieldset > legend, +.table-cell-field > div > fieldset > div > .field-description, +.table-cell-field > div > fieldset > .field-description, +.table-cell-field > div > .control-label, +.table-cell-field > div > .field-description, +.table-cell-field > .form-group > .form-group > .form-label, +.table-cell-field > .form-group > .form-group > div > hr, +.table-cell-field > .form-group > div > h5, /* title of object */ +.table-cell-field > .form-group .mb-3, /* description of object */ +.table-cell-field .form-text /* description of object property */ +{ + display: none; +} diff --git a/src/table/TableFieldTemplate.tsx b/src/table/TableFieldTemplate.tsx new file mode 100644 index 00000000..5f9bd75a --- /dev/null +++ b/src/table/TableFieldTemplate.tsx @@ -0,0 +1,150 @@ +import { ArrayFieldTemplateProps } from '@rjsf/core' +import { Button, Table, OverlayTrigger, Popover, Row, Container, Col } from 'react-bootstrap' +import { Dash, Plus, QuestionCircle } from 'react-bootstrap-icons' + +import './TableFieldTemplate.css' + +const btnStyle = { + flex: 1, + paddingLeft: 6, + paddingRight: 6, + fontWeight: 'bold' +} + +function isObject (value: unknown): value is object { + return value !== null && typeof value === 'object' +} + +/** + * This table field template was copied from https://github.com/iomega/paired-data-form/blob/master/app/src/fields/TableFieldTemplate.tsx + * and adjusted. + */ +export const TableFieldTemplate = (props: ArrayFieldTemplateProps): JSX.Element => { + const required = new Set((props.schema as any).items.required) + const rowSchema = (props.schema as any).items.properties + let widths: { [name: string]: string } = {} + if ( + props.uiSchema['ui:options'] !== undefined && + 'widths' in props.uiSchema['ui:options'] && + isObject(props.uiSchema['ui:options'].widths) + ) { + widths = props.uiSchema['ui:options'].widths as { [name: string]: string } + } + const headers = Object.entries(rowSchema).map( + ([key, s]: [string, any], i: number) => { + const title = required.has(key) + ? ( + + ) + : ( + + ) + let description = ( + + ) + if (s.type === 'object') { + const srequired = new Set(s.required) + const propDescs = Object.entries(s.properties) + .filter((d: any) => d[1].description) + .map(([skey, sschema]: any) => ( +
  • + +

    +

  • + )) + description = ( + <> + +
      + {propDescs} +
    + + ) + } + const width = widths[key] + return ( + + {title} + + {title} + {description} + + } + > + + + + ) + } + ) + headers.push() + let rows: JSX.Element[] = [] + if ('items' in props) { + rows = props.items.map((element: any) => { + return ( + + {element.children} + + + + + ) + }) + } + return ( +
    + {props.title} +

    {props.schema.description}

    + + + {headers} + + {rows} +
    + + + + + + + + +
    + ) +} diff --git a/src/table/TableRowFieldTemplate.tsx b/src/table/TableRowFieldTemplate.tsx new file mode 100644 index 00000000..d54fb685 --- /dev/null +++ b/src/table/TableRowFieldTemplate.tsx @@ -0,0 +1,11 @@ +import { FieldProps } from '@rjsf/core' + +export const TableRowFieldTemplate = ({ properties }: FieldProps): JSX.Element => { + return properties.map((prop: any) => { + return ( + + {prop.content} + + ) + }) +} diff --git a/util/generate_haddock3_catalog.py b/util/generate_haddock3_catalog.py index 86a775ad..8af4a150 100755 --- a/util/generate_haddock3_catalog.py +++ b/util/generate_haddock3_catalog.py @@ -234,10 +234,9 @@ def config2schema(config): obj_schemas = config2schema(v['properties']) if v['dim'] == 1: prop['items'] = obj_schemas['schema'] + prop_ui = { 'ui:field': 'table'} if obj_schemas['uiSchema']: - prop_ui = { - "items": obj_schemas['uiSchema'] - } + prop_ui['items'] = obj_schemas['uiSchema'] prop_toml = { 'indexed': True, 'items': { @@ -249,12 +248,9 @@ def config2schema(config): 'type': 'array', 'items': obj_schemas['schema'] } + prop_ui = {'items': { 'ui:field': 'table'}} if obj_schemas['uiSchema']: - prop_ui = { - "items": { - 'items': obj_schemas['uiSchema'] - } - } + prop_ui['items']['items'] = obj_schemas['uiSchema'] prop_toml = { 'indexed': True, 'items': {