Skip to content

v0.10.0 Phase 1: object-list support in pluggable widget engine #538

@ako

Description

@ako

Parent: #529 (unified schema registry, revised phasing)
Milestone: v0.10.0

Goal

Support Type: "Object" + IsList: true properties in pluggable widget templates,
expressed in MDL as named child blocks. Headline use case is pluggable DataGrid
columns; same engine work covers Accordion groups, PopupMenu items, AreaChart
series, Maps markers.

Acceptance fixtures

  • mdl-examples/doctype-tests/32-pluggable-widget-object-lists-v010.test.mdl
    (currently fails parse — passes once this issue lands)
  • mdl-examples/doctype-tests/31-pluggable-datagrid-gallery-v010-examples.mdl
    (already parses; Phase 1 makes the BSON output correct for pluggable DataGrid)

Layered work

Layer 1 — .def.json format extension (additive)

Extend the WidgetDefinition Go struct + JSON serialization to include an
objectLists field alongside propertyMappings and childSlots:

{
  "objectLists": [
    {
      "propertyKey": "groups",
      "mdlContainer": "GROUP",
      "itemProperties": [
        { "propertyKey": "headerText", "operation": "texttemplate" },
        { "propertyKey": "headerContent", "mdlContainer": "HEADERCONTENT", "operation": "widgets" },
        { "propertyKey": "content", "mdlContainer": "CONTENT", "operation": "widgets" }
      ]
    }
  ]
}

Existing .def.json files stay valid (no objectLists field = behaves as today).

Layer 2 — mxcli widget init MPK XML parser

Extend cmd/mxcli/cmd_widget.go to recognize <property type="object" isList="true">
in widget XML and emit the objectLists block, including recursive sub-property
trees (the inner <property> elements inside <properties> / <propertyGroup>).

Validation: run mxcli widget init against a project containing Accordion, verify
the generated .mxcli/widgets/accordion.def.json includes a groups entry with
the expected sub-properties (headerText, headerContent, content, etc.).

Layer 3 — Grammar / visitor / executor

  • ANTLR grammar additions in mdl/grammar/MDLParser.g4: object-list child block
    rule that mirrors childSlot syntax (<keyword> <name> ( <props> ) { <widgets> })
  • Visitor in mdl/visitor/visitor_widgets.go: build AST nodes for object-list
    child blocks, look up the parent widget's objectLists to resolve keyword →
    property key mapping
  • Executor in mdl/executor/cmd_pages_builder_v3_widgets.go: serialize object-list
    items to BSON via the existing WidgetEngine API (extend with object-list
    builders)

Acceptance criteria

  • .def.json schema extended; existing files unchanged in shape
  • mxcli widget init extracts object-list properties from MPK XML
  • Accordion groups syntax parses, executes, opens cleanly in Studio Pro 11.x
  • PopupMenu basicItems and customItems work end-to-end
  • AreaChart series works end-to-end
  • Maps markers and dynamicMarkers work end-to-end
  • DESCRIBE round-trips object-list child blocks back to equivalent MDL
  • Fixture 32-pluggable-widget-object-lists-v010.test.mdl renamed to
    .mdl (no longer needs to skip parse) and passes mxcli check

Dependencies / blockers

None — this is the first phase. Layer 1 + 2 + 3 can land as one PR or as three
sequential PRs (Layer 1 + 2 first, Layer 3 second).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions