-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Collection: Introduce Card and Ref Collection View kinds #21037
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
Collection: Introduce Card and Ref Collection View kinds #21037
Conversation
…tity-collection-item-card/entity-collection-item-card.element.ts Co-authored-by: Copilot <[email protected]>
Added the UmbEntityCollectionItemElement interface to document and user collection item card elements for improved type safety and consistency. Updated type exports to include the new interface.
Replaces the placeholder div with a uui-ref-node component, passing relevant item properties and event handlers. Adds dynamic icon rendering using umb-icon.
Introduces a new abstract base class for entity collection item elements, consolidating shared logic for card and ref variants. Updates card and ref element implementations to extend the new base, and refactors extension manifest interfaces for consistency. This improves maintainability and reduces code duplication.
Introduces a requestItemHref method to collection contexts for retrieving item-specific hrefs. Updates card, ref, and user table collection views to use these hrefs, enabling dynamic linking for collection items. Refactors user table name column layout to accept href via value prop instead of constructing it internally.
Changed the import of ManifestCollectionView from '../extensions/types.js' to '../view/types.js' to reflect its new location.
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 reusable collection view kinds (card and ref) that provide out-of-the-box collection views with built-in support for entity actions, selection, and item navigation. The PR refactors the collection architecture by adding a requestItemHref method to collection contexts, enabling centralized href generation for collection items across all views. Additionally, it introduces a bulk action manager that automatically enables collection selection when bulk actions are available.
Key changes:
- New reusable
cardandrefcollection view kinds with manifest-based configuration - Base class (
UmbCollectionViewElementBase) for collection views that handles common patterns requestItemHrefmethod on collection contexts for centralized item link generation- Bulk action manager that observes available bulk actions and automatically configures selection
Reviewed changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/umb-collection-view-element-base.ts |
New abstract base class providing shared state management and context consumption for collection views |
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/card/card-collection-view.element.ts |
New card-based collection view implementation using the base class |
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/ref/ref-collection-view.element.ts |
New list-based collection view implementation using the base class |
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/card/manifests.ts |
Manifest kind definition for card collection views |
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/ref/manifests.ts |
Manifest kind definition for ref collection views |
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/collection-view.extension.ts |
Moved type definitions for collection views from extensions folder |
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/types.ts |
New type export file for collection views |
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/manifests.ts |
Aggregates card and ref manifests |
src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.context.ts |
Adds requestItemHref method and bulk action integration with selection |
src/Umbraco.Web.UI.Client/src/packages/core/collection/bulk-action/collection-bulk-action.manager.ts |
New manager for observing bulk action availability |
src/Umbraco.Web.UI.Client/src/packages/core/collection/bulk-action/collection-bulk-action.manager.test.ts |
Unit tests for bulk action manager |
src/Umbraco.Web.UI.Client/src/packages/core/collection/types.ts |
Adds requestItemHref to collection context interface and exports view types |
src/Umbraco.Web.UI.Client/src/packages/core/collection/manifests.ts |
Registers new view manifests |
src/Umbraco.Web.UI.Client/src/packages/core/collection/extensions/types.ts |
Removes collection view type export (moved to view/types) |
src/Umbraco.Web.UI.Client/src/packages/core/collection/item/entity-collection-item-card/default-collection-item-card.element.ts |
Adds readonly property when href is undefined |
src/Umbraco.Web.UI.Client/src/packages/core/collection/item/entity-collection-item-ref/default-collection-item-ref.element.ts |
Adds readonly property when href is undefined |
src/Umbraco.Web.UI.Client/src/packages/user/user/paths.ts |
Adds parent path parameter to edit workspace path pattern for consistency |
src/Umbraco.Web.UI.Client/src/packages/user/user/collection/user-collection.context.ts |
Implements requestItemHref for user items |
src/Umbraco.Web.UI.Client/src/packages/user/user/collection/views/table/user-table-collection-view.element.ts |
Updates to use requestItemHref for generating hrefs |
src/Umbraco.Web.UI.Client/src/packages/user/user/collection/views/table/column-layouts/name/user-table-name-column-layout.element.ts |
Updates to receive href from parent instead of constructing it |
src/Umbraco.Web.UI.Client/src/packages/user/user/collection/views/manifests.ts |
Converts user grid collection view to use card kind |
src/Umbraco.Web.UI.Client/src/packages/language/collection/views/table/language-table-collection-view.element.ts |
Refactors selection observation pattern |
src/Umbraco.Web.UI.Client/examples/collection/collection/card-view/manifests.ts |
Updates example to use card kind |
src/Umbraco.Web.UI.Client/examples/collection/collection/card-view/collection-view.element.ts |
Removes custom card view implementation (now using built-in kind) |
src/Umbraco.Web.UI.Client/examples/collection/collection/ref-view/manifests.ts |
New example manifest using ref kind |
src/Umbraco.Web.UI.Client/examples/collection/collection/manifests.ts |
Registers new ref view example |
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/collection-view.manager.ts |
Updates import path for collection view types |
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/collection-view.manager.test.ts |
Updates import path for collection view types |
src/Umbraco.Web.UI.Client/src/packages/core/collection/components/collection-view-bundle.element.ts |
Updates import path for collection view types |
src/Umbraco.Web.UI.Client/eslint.config.js |
Updates ESLint configuration for unused variables and formatting |
Comments suppressed due to low confidence (2)
src/Umbraco.Web.UI.Client/src/packages/core/collection/bulk-action/collection-bulk-action.manager.test.ts:4
- Unused import first.
import { Observable, first } from '@umbraco-cms/backoffice/external/rxjs';
src/Umbraco.Web.UI.Client/eslint.config.js:89
- This property is overwritten by another property in the same object literal.
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
src/Umbraco.Web.UI.Client/src/packages/core/collection/view/types.ts
Outdated
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.context.ts
Outdated
Show resolved
Hide resolved
src/Umbraco.Web.UI.Client/src/packages/core/collection/default/collection-default.context.ts
Outdated
Show resolved
Hide resolved
...eb.UI.Client/src/packages/core/collection/bulk-action/collection-bulk-action.manager.test.ts
Outdated
Show resolved
Hide resolved
...ser/user/collection/views/table/column-layouts/name/user-table-name-column-layout.element.ts
Outdated
Show resolved
Hide resolved
…/collection-default.context.ts Co-authored-by: Copilot <[email protected]>
…/collection-default.context.ts Co-authored-by: Copilot <[email protected]>
…pes.ts Co-authored-by: Copilot <[email protected]>
…s://github.com/umbraco/Umbraco-CMS into v17/feature/collection-view-card-and-ref-kinds
…ule definitions, consolidating the configuration to use only 'argsIgnorePattern'.
Replaces the user name link with a span when the href property is not provided, preventing broken links in the user table name column layout.
leekelleher
left a comment
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.
Tested out, works as described. 🚀
This PR introduces reusable collection view kinds (
cardandref) that can be used out-of-the-box for collections. We also want to introduce atablekind, but that requires a bit more up-front work before that can happen.requestItemHrefmethod on the collection context to have a centralized place to provide the same href for an item across all views.Updates:
cardandrefview kinds.How to use
Card Manifest
Ref Manifest
How to test: