Element Picker: Adds valueSummary display and value resolver - #23154
Conversation
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).
This comment was marked as resolved.
This comment was marked as resolved.
valueSummary display and value resolver
There was a problem hiding this comment.
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_TYPEand augmentsUmbValueTypeMapwith the Element Picker’s value shape (Array<string>). - Adds a batch
valueResolverthat deduplicates uniques, fetches element items viaUmbElementItemRepository, and supports reactive updates viaasObservable. - Adds a
valueSummaryelement + manifests, wires them into the Element Picker manifests, and exports constants through the@umbraco-cms/backoffice/elementsbarrel.
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)
AndyButland
left a comment
There was a problem hiding this comment.
Looks good and works as expected @leekelleher, and I've verified that it's aligned with the document picker.
Before:
After:
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.
|
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.
|



Description
Following up on PRs #22871/#23027, this PR adds a
valueSummaryfor the Element Picker (for Umbraco 18).Kudos to @engijlr for the original code, ref: de4683f. ✌️
Summary (AI/Claude generated) 🤖
valueSummaryextension for theUmbraco.ElementPickerproperty editor so picked element names are rendered in collection view columnsUMB_ELEMENT_PICKER_PROPERTY_EDITOR_VALUE_TYPEconstant (exported from@umbraco-cms/backoffice/elements) and wires it through the standardproperty-editor → element-pickerconstants chainUmbElementItemRepository, and returns positionally-alignedArray<UmbElementItemModel>withasObservablesupport; element renders all names variant-aware and comma-joinedTest plan
npm test -- --files "src/packages/elements/property-editor/element-picker/value-summary/value-summary.resolver.test.ts"— all 11 cases pass,Array<string>(not a JSON string) — if it arrives as a string, theTValueandUmbValueTypeMapentry will need updating