-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Allow configuring collection no-items text via manifest or attribute #19284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow configuring collection no-items text via manifest or attribute #19284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables custom configuration of the no-items text in a collection by allowing the label to be set via the collection manifest or an element's configuration.
- Added an optional noItemsLabel property to both the collection configuration and manifest meta interfaces.
- Updated the default collection element to dynamically generate the empty state label from the manifest, config, or fallback localization key.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/Umbraco.Web.UI.Client/src/packages/core/collection/types.ts | Added the optional noItemsLabel property to the collection configuration interface. |
src/Umbraco.Web.UI.Client/src/packages/core/collection/extensions/collection.extension.ts | Extended the manifest meta interface by adding an optional noItemsLabel property. |
src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.element.ts | Introduced a helper method to determine the empty state label using manifest, config, or fallback localization. |
Comments suppressed due to low confidence (1)
src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.element.ts:73
- [nitpick] Consider checking if the noItemsLabel value starts with '#' to determine whether it should be interpreted as a localization key. If not, returning the provided custom text directly instead of passing it to this.localize.string could prevent unnecessary localization lookups.
const labelKey = this.#collectionContext?.manifest?.meta.noItemsLabel ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the ability to configure custom "no-items" text for collections using either the extension manifest or a configuration attribute, with the manifest value taking precedence over the configuration if both are provided. Key changes include:
- Adding a new noItemsLabel property to the collection configuration interface.
- Extending the manifest's metadata to include noItemsLabel.
- Implementing and using a helper method to determine and render the appropriate empty state label.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/Umbraco.Web.UI.Client/src/packages/core/collection/types.ts | Added noItemsLabel property to the collection configuration interface. |
src/Umbraco.Web.UI.Client/src/packages/core/collection/extensions/collection.extension.ts | Added noItemsLabel to the manifest metadata type. |
src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.element.ts | Introduced a helper method to generate the empty state label based on manifest or config, and updated the render method accordingly. |
This PR introduces the ability to provide custom text for the no-items message in a collection, either via the collection extension manifest or collection configuration object.
To test via manifest:
/src/packages/members/member-group/collection/manifests.ts
noItemsLabel: 'Custom text'
to themeta
propertynoItemsLabel
to#general_delete
To test via config:
/src/packages/dictionary/dashboard/dictionary-overview-dashboard-element.ts
umb-collection
element:.config=${{ noItemsLabel: 'Custom text'}}
noItemsLabel
to#general_delete
If both the manifest and element config set the
noItemsLabel
property, the manifest value is prioritised. If neither is set, we fallback to the originalNo items
text, via thecollection_noItemsTitle
localization key.