Skip to content

Element Picker: Adds valueSummary display and value resolver - #23154

Merged
leekelleher merged 6 commits into
mainfrom
v18/feature/element-picker-value-summary
Jun 19, 2026
Merged

Element Picker: Adds valueSummary display and value resolver#23154
leekelleher merged 6 commits into
mainfrom
v18/feature/element-picker-value-summary

Conversation

@leekelleher

@leekelleher leekelleher commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

Following up on PRs #22871/#23027, this PR adds a valueSummary for the Element Picker (for Umbraco 18).

Kudos to @engijlr for the original code, ref: de4683f. ✌️

Summary (AI/Claude generated) 🤖

  • Adds a valueSummary extension for the Umbraco.ElementPicker property editor so picked element names are rendered in collection view columns
  • Introduces UMB_ELEMENT_PICKER_PROPERTY_EDITOR_VALUE_TYPE constant (exported from @umbraco-cms/backoffice/elements) and wires it through the standard property-editor → element-picker constants chain
  • Batch resolver deduplicates GUIDs, fetches via UmbElementItemRepository, and returns positionally-aligned Array<UmbElementItemModel> with asObservable support; element renders all names variant-aware and comma-joined

Test plan

  • Run resolver unit tests: npm test -- --files "src/packages/elements/property-editor/element-picker/value-summary/value-summary.resolver.test.ts" — all 11 cases pass
  • Manual: add an Element Picker property to a content type, pick 2+ elements, surface that property as a collection column, and verify the cell shows the element names joined by ,
  • Verify the raw value arriving at the resolver is a pre-parsed Array<string> (not a JSON string) — if it arrives as a string, the TValue and UmbValueTypeMap entry will need updating

Adds a valueSummary extension so picked element names appear in collection
view columns. Includes a value-type constant, batch resolver, variant-aware
element, and a resolver unit test (11 cases).
Copilot AI review requested due to automatic review settings June 17, 2026 14:32
@claude

This comment was marked as resolved.

@leekelleher leekelleher changed the title Elements: add value summary for Element Picker property editor Element Picker: Adds valueSummary display and value resolver Jun 17, 2026

Copilot AI 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.

Pull request overview

Adds a value-summary extension for the Element Picker property editor so collection views can render selected element names (variant-aware) instead of raw IDs, and exposes a public value-type constant for downstream consumers.

Changes:

  • Introduces UMB_ELEMENT_PICKER_PROPERTY_EDITOR_VALUE_TYPE and augments UmbValueTypeMap with the Element Picker’s value shape (Array<string>).
  • Adds a batch valueResolver that deduplicates uniques, fetches element items via UmbElementItemRepository, and supports reactive updates via asObservable.
  • Adds a valueSummary element + manifests, wires them into the Element Picker manifests, and exports constants through the @umbraco-cms/backoffice/elements barrel.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Umbraco.Web.UI.Client/src/packages/elements/property-editor/element-picker/value-type/constants.ts Adds exported value-type constant and UmbValueTypeMap typing for Element Picker values.
src/Umbraco.Web.UI.Client/src/packages/elements/property-editor/element-picker/value-summary/value-summary.ts Barrel exports for the value summary element + resolver.
src/Umbraco.Web.UI.Client/src/packages/elements/property-editor/element-picker/value-summary/value-summary.resolver.ts Batch resolver that fetches UmbElementItemModels for selected element uniques and provides reactive updates.
src/Umbraco.Web.UI.Client/src/packages/elements/property-editor/element-picker/value-summary/value-summary.resolver.test.ts Unit tests for resolver behavior (empty, multi-pick, dedupe, unknown IDs, observable).
src/Umbraco.Web.UI.Client/src/packages/elements/property-editor/element-picker/value-summary/value-summary.element.ts Value summary UI element that renders resolved element names, variant-aware and comma-joined.
src/Umbraco.Web.UI.Client/src/packages/elements/property-editor/element-picker/value-summary/manifests.ts Registers the value summary extension for the Element Picker value type.
src/Umbraco.Web.UI.Client/src/packages/elements/property-editor/element-picker/manifests.ts Includes the new value summary manifests in the Element Picker extension set.
src/Umbraco.Web.UI.Client/src/packages/elements/property-editor/element-picker/constants.ts Re-exports Element Picker property-editor constants.
src/Umbraco.Web.UI.Client/src/packages/elements/property-editor/constants.ts Re-exports property-editor constants from the elements package.
src/Umbraco.Web.UI.Client/src/packages/elements/constants.ts Exposes property-editor constants via the top-level elements constants barrel.

…mary

- Call removeUmbControllerByAlias when removing a stale resolver so the
  named observer controller is released from the element's controller list
- Call setData on existing resolvers when _value refreshes so renames are
  reflected without recreating the resolver
- Remove redundant valueResolver re-export from resolver file (barrel handles it)
@leekelleher
leekelleher enabled auto-merge (squash) June 17, 2026 14:55

@AndyButland AndyButland 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.

Looks good and works as expected @leekelleher, and I've verified that it's aligned with the document picker.

Before:

Image

After:

Image

I see a few Sonarqube recommendations - none look critical, but worth a look over and apply if you agree with them.

I also saw @madsrasmussen had his 👀 on this one, so I'll approve with comments, but you may want to check with him before merging.

@madsrasmussen

Copy link
Copy Markdown
Member

All good. Code looks fine 👍

I have just updated with the latest from main. The failing e2e test does not seem to be related at all.

- Mark #resolvers, #resolvedNames, and #repo as readonly
- Replace .find() with .some() for existence checks
- Flip negated condition in #syncResolvers to positive case first
- Remove redundant type assertions in value-summary.resolver.ts
…ummary

Extract #syncResolvers loop bodies into #removeResolver and #addOrUpdateResolver
to eliminate nested branching flagged by CodeScene's Bumpy Road Ahead metric.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants