Skip to content

feat(workflows): extend form field library and fix outer-card suppression#105

Merged
Saiby100 merged 4 commits into
mainfrom
feat/workflows-form-fields
Jul 13, 2026
Merged

feat(workflows): extend form field library and fix outer-card suppression#105
Saiby100 merged 4 commits into
mainfrom
feat/workflows-form-fields

Conversation

@Saiby100

Copy link
Copy Markdown
Contributor

Summary

Extends the workflows form field library and fixes card rendering, unblocking migration of an existing app onto the 0.11.0 module line (its form fields broke against 0.11.0's stricter block schema).

  • New phone field component wrapping PhoneNumberInput — the form-side counterpart to the phoneNumber field type the view renderer already recognised.
  • Additive form vars: disabled + extra on text_input; disabled + theme on button_selector. No impact on existing consumers.
  • location.yaml: layout.contentGutterlayout.gap (0.11.0 promotes the deprecation to a build-failing error).
  • Outer-card suppression fix: edit/error templates now suppress the outer form_card only when the first field is a section (the sole card-owning structural component), instead of the old form[0].form != null heuristic that over-triggered for controlled_list/box/label/file_upload and left them with no card.
  • Contact selector: align action layout.
  • Demo consumers added to the field gallery; docs/workflows/reference/form-components.md updated.

Test plan

  • pnpm ldf:b from apps/demo compiles clean.
  • Field gallery renders phone, read-only text, and themed button fields.
  • A form whose first field is a ControlledList now renders inside a card.

PR Checklist

  • `/r:docs-update` - Documentation updated for behavioral changes
  • `/r:pr-review` - Self-review completed before requesting team review

Saiby100 and others added 3 commits July 13, 2026 12:58
Request: "Investigate why the workflow module doesn't render a card when the
controlledList component is used on a form" — then "apply the fix".
Motivation: A form whose first field is a ControlledList (or box/label/
file_upload) rendered with no card at all, and the comment input fell outside
any card. The edit/error templates dropped the outer form_card whenever the
first form entry declared a sub-form, on the assumption it owned its own card
chrome — but of the structural components only `section` actually renders a Card.

Decisions:
- Key on component identity, not shape: test form[0].component == section
  instead of form[0].form != null. `section` is the sole card-owning structural
  component; the old heuristic over-triggered for controlled_list/box/label/
  file_upload (none render a Card).
- Minimal right-layer change inside the existing _build.if; no new machinery.
  Rejected adding a phone-style per-component owns_outer_chrome flag as
  speculative surface.

Changes:
- templates/edit.yaml.njk: suppression test form.0.form -> form.0.component == section
- templates/error.yaml.njk: same, on form_error.0.component

Note: diverges from the completed design parts/_completed/16-page-templates/
design.md:200 (which still documents the old form[0].form heuristic); left the
_completed doc untouched as read-only history per repo rules.

Tags: workflows, form, controlled-list, outer-card-suppression, edit-template, error-template, card, section, form-fields

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Request: Enable migrating the prp-team app to reference the workflows module on
the 0.11.0 line; its form fields broke against 0.11.0's stricter block schema.
Motivation: The app authored form fields as raw blocks with a stray top-level
`key` (harvested into form_meta) — an off-spec "Shape-A trick" that only worked
because old block validation ignored the extra property. 0.11.0 rejects it. The
module's own reference mandates library components for reused fields, but the
field library lacked a phone field and the disabled/extra/theme vars those
fields needed.

Decisions:
- Contribute library components, not a resolver change: form-components.md
  mandates library components for reused fields, and makeActionsForm keeps
  emitting raw blocks verbatim. Rejected stripping `key` in the resolver — it
  would bless the off-spec Shape-A pattern.
- phone wraps PhoneNumberInput: the form-side counterpart to the `phoneNumber`
  field type SmartDescriptions' view renderer already recognised (fills a real
  half-finished gap rather than adding speculative surface).
- Additive vars only (disabled/extra on text_input, disabled/theme on
  button_selector) — no impact on existing consumers; yes_no_selector already
  carried `disabled` as precedent.
- location.yaml: contentGutter -> gap; 0.11.0 promotes the deprecation to a
  build-failing error.

Changes:
- components/fields/phone.yaml: new PhoneNumberInput field component
- components/fields/text_input.yaml: add disabled + extra vars
- components/fields/button_selector.yaml: add disabled + theme vars
- components/fields/location.yaml: layout.contentGutter -> layout.gap
- apps/workflows-test/.../field-gallery/gallery.yaml: demo consumers (phone, read-only text, themed buttons)
- docs/workflows/reference/form-components.md: document phone + the new vars

Tags: workflows, form-components, phone, phone-number, text-input, button-selector, disabled, theme, field-library, contentgutter, deprecation, form-meta

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@Saiby100 Saiby100 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: #105

Linked Issues: None found

Extends the workflows form-field library (phone field + disabled/theme/extra vars) and fixes outer-card suppression to key on section identity rather than the over-broad form[0].form heuristic. Code is clean and correct — the one gap is that the plugins change has no changeset.

Verification done:

  • PhoneNumberInput is a real block from @lowdefy/blocks-antd — no extra plugin declaration needed. ✅
  • disabled + theme on button_selector have in-module precedent in yes_no_selector.yaml. ✅
  • The view renderer already maps PhoneNumberInput → phoneNumber (SmartDescriptions/fieldTypes/blockTypeMap.js), so the new form field is the correct counterpart. ✅

🟡 Suggestions

Missing changeset for the ContactSelector fix

File: plugins/modules-mongodb-plugins/src/blocks/ContactSelector/ContactListItem.js

Both changesets target @lowdefy/modules-mongodb-workflows only. The contact-selector alignment change lives in @lowdefy/modules-mongodb-plugins, which has no changeset.

Because .changeset/config.json sets "fixed": [["@lowdefy/modules-mongodb-*"]], the plugins package will still version-bump in lockstep — so this won't block publishing. But its CHANGELOG will carry no entry describing the fix, so consumers reading the plugins changelog won't see it.

Acceptance Criteria

Criteria (from PR body) Status
New phone field wrapping PhoneNumberInput ✅ valid block, follows field pattern
Additive disabled/extra/theme vars ✅ no impact on existing consumers
location off deprecated contentGutter → layout.gap in both spots
Card suppression only for section first field ✅ both edit + error templates, well-commented
All changes have changesets ⚠️ plugins fix uncovered (see above)

What's good: Changesets use correct semver (minor for the new field, patch for the bug fix) with clear descriptions; the suppression fix keys on component identity rather than shape and documents why the other structural components fall through.

Generated by PR Review Command

The ContactSelector action-alignment fix (2cfef7d) touched
@lowdefy/modules-mongodb-plugins but shipped without a changeset, so the
plugins CHANGELOG would carry no entry describing it (the fixed version group
bumps the package regardless). Add a patch changeset covering the change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Saiby100 Saiby100 requested a review from StephanieJKS July 13, 2026 13:34
@Saiby100 Saiby100 marked this pull request as ready for review July 13, 2026 13:34
@Saiby100 Saiby100 merged commit bf8066e into main Jul 13, 2026
3 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant