Skip to content

Add ExpressionEditor support to LabelValueEditor and related components - #5148

Open
micanipho wants to merge 5 commits into
shesha-io:mainfrom
micanipho:nhlakanipho/feat/5077-expression-editor-kvp
Open

Add ExpressionEditor support to LabelValueEditor and related components#5148
micanipho wants to merge 5 commits into
shesha-io:mainfrom
micanipho:nhlakanipho/feat/5077-expression-editor-kvp

Conversation

@micanipho

@micanipho micanipho commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

This pull request adds support for using a mustache-aware ExpressionEditor as the value cell in the LabelValueEditor component. It introduces a new prop to control whether the value column
uses a plain text input or the expression editor, and updates several settings forms to default to the expression editor for values. The implementation ensures that the expression editor and
its associated metadata hooks are only loaded when needed, and that the expression context is built once per editor rather than once per row optimizing performance for consumers who do not
require expression editing as well as those with many value rows.

LabelValueEditor enhancements:

  • Added a valueEditor prop to LabelValueEditor and its interfaces, allowing consumers to choose between a plain input or the mustache-aware ExpressionEditor for the value column.
  • Implemented the ExpressionValueCell component for the value column. The autocomplete context is built once in an ExpressionLabelValueList wrapper (mounted only when valueEditor is
    'expression') and passed down to each cell, so adding N rows no longer rebuilds the context — including its async metadata — N times. The metadata/constants hooks stay entirely off the
    plain-input path.

Settings form updates:

  • Updated the settings forms for autocomplete (Data Source = URL → Query Param), entity reference (Dialog → Additional properties), and navigation actions (Query String Parameters) to use the
    expression editor for value cells, enabling mustache expression support in these UIs.
  • Radio and checkbox group were evaluated but intentionally left out: their "Values" items are static, literal option values that are never resolved through the mustache evaluator at runtime,
    so an expression editor there would be a false affordance.

Expression editor context support:

  • Added the useExpressionEditorContext hook to build the autocomplete context for the ExpressionEditor, merging form metadata and standard constants, and handling cases where metadata is
    unavailable.

Related to issue: #5077

Summary by CodeRabbit

  • New Features

    • Added expression-based editing for the “value” column in label-value editors.
    • Enabled mustache-aware expression editing for query parameters and additional properties.
    • Added configurable value editor modes (input or expression) with enhanced autocomplete support.
  • Bug Fixes

    • Improved password-change handling by reliably determining the current user.
    • Expression editing now degrades gracefully with missing optional autocomplete context, preventing failures.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4e3f6829-7b1b-4b98-9b7b-c55c774e1cb8

📥 Commits

Reviewing files that changed from the base of the PR and between 19e7ed0 and 7e8b9ac.

📒 Files selected for processing (2)
  • shesha-core/src/Shesha.Application/Users/UserAppService.cs
  • shesha-reactjs/src/designer-components/entityReference/settingsForm.ts

Walkthrough

Adds expression-based value editing to LabelValueEditor, including shared autocomplete context construction and settings integrations. Separately, ChangePasswordAsync changes how the current user id is retrieved.

Changes

Expression value editor

Layer / File(s) Summary
Expression context hook
shesha-reactjs/src/components/expressionEditor/useExpressionEditorContext.ts
Builds a merged autocomplete context from form metadata paths and standard application/form constants.
LabelValueEditor expression mode
shesha-reactjs/src/components/labelValueEditor/*, shesha-reactjs/src/designer-components/settingsInput/interfaces.ts
Adds the valueEditor option and switches value cells between InputPropertyEditor and ExpressionEditor, reusing one expression context across rows.
Expression-mode settings integration
shesha-reactjs/src/designer-components/autocomplete/settingsForm.ts, shesha-reactjs/src/designer-components/entityReference/settingsForm.ts, shesha-reactjs/src/providers/shaRouting/actions/navigate-arguments.ts
Enables expression editing for query parameters and additional properties.

Password session handling

Layer / File(s) Summary
Current user-id retrieval
shesha-core/src/Shesha.Application/Users/UserAppService.cs
Uses _abpSession.GetUserId() in ChangePasswordAsync.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LabelValueEditor
  participant ExpressionLabelValueList
  participant useExpressionEditorContext
  participant ExpressionEditor
  LabelValueEditor->>ExpressionLabelValueList: select expression value mode
  ExpressionLabelValueList->>useExpressionEditorContext: build shared autocomplete context
  useExpressionEditorContext->>ExpressionLabelValueList: return merged ExpressionContext
  ExpressionLabelValueList->>ExpressionEditor: render value cells with context
  ExpressionEditor->>LabelValueEditor: emit changed expression
Loading

Possibly related PRs

Suggested reviewers: james-baloyi, ivanilyichev

Poem

I’m a rabbit with expressions to parse,
With autocomplete hopping from field to field.
Values now bloom in a mustache’s grasp,
While passwords find IDs safely sealed.
Hop, hop—new editors take the yield!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding ExpressionEditor support to LabelValueEditor and related consumers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@shesha-reactjs/src/designer-components/checkboxGroup/settingsForm.ts`:
- Line 158: The items[].value editor in checkboxGroup/radioGroup settings is
currently using the expression editor, which allows unevaluated {{...}} strings
to be stored and then compared literally. Update the settingsForm configuration
for the checkboxGroup option values to use a plain text editor instead of the
expression editor, or add explicit runtime evaluation in the
checkboxGroup/radioGroup comparison path so the stored value matches what the
component compares against.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e2bbe86a-1b39-425d-abb4-e4213e0623fb

📥 Commits

Reviewing files that changed from the base of the PR and between 98d0837 and a58cffa.

📒 Files selected for processing (9)
  • shesha-reactjs/src/components/expressionEditor/useExpressionEditorContext.ts
  • shesha-reactjs/src/components/labelValueEditor/interfaces.ts
  • shesha-reactjs/src/components/labelValueEditor/labelValueEditor.tsx
  • shesha-reactjs/src/designer-components/autocomplete/settingsForm.ts
  • shesha-reactjs/src/designer-components/checkboxGroup/settingsForm.ts
  • shesha-reactjs/src/designer-components/entityReference/settingsForm.ts
  • shesha-reactjs/src/designer-components/radio/settingsForm.ts
  • shesha-reactjs/src/designer-components/settingsInput/interfaces.ts
  • shesha-reactjs/src/providers/shaRouting/actions/navigate-arguments.ts

Comment thread shesha-reactjs/src/designer-components/checkboxGroup/settingsForm.ts Outdated
@micanipho
micanipho requested a review from James-Baloyi July 10, 2026 07:22
@micanipho
micanipho requested a review from IvanIlyichev July 30, 2026 13:27
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