-
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
Merged
leekelleher
merged 53 commits into
main
from
v17/feature/collection-view-card-and-ref-kinds
Dec 8, 2025
Merged
Changes from 44 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
cc1c99b
Add entity collection item card extension type + default elements
madsrasmussen 852a9d7
implement user collection item card
madsrasmussen 0dc90ad
fix selection events
madsrasmussen 8c047e0
map to prop
madsrasmussen f06d594
add prop/attr for href
madsrasmussen df1219a
add support for which detail properties to show
madsrasmussen 0f59c3e
update type import
madsrasmussen 2aefe5e
Update src/Umbraco.Web.UI.Client/src/packages/core/collection/item/en…
madsrasmussen 37b9df4
import card in correct file
madsrasmussen 3dbe65a
Fix event listener binding for selection events
madsrasmussen 8865403
implement disabled property for collection item cards
madsrasmussen 5c4b2b8
init commit of collection item ref extension
madsrasmussen 4450ae9
fix imports
madsrasmussen e98822e
add element interface
madsrasmussen c29817b
Implement UmbEntityCollectionItemElement interface in item cards
madsrasmussen 51f5bfc
Merge branch 'main' into v17/collection-item-ref-extension
madsrasmussen 801f4d6
Update collection item ref to use uui-ref-node
madsrasmussen d6b1caa
Refactor entity collection item elements to use shared base
madsrasmussen 3e1063c
use class instead of magic string
madsrasmussen 4d6c622
introduce ref and card collection view kinds
madsrasmussen 86485f4
Utilise card kind for user collection view
madsrasmussen f78175a
Add item-specific href support to collection views
madsrasmussen 1c8cf78
Update ManifestCollectionView import path
madsrasmussen f16d6ea
Merge branch 'main' into v17/feature/collection-view-card-and-ref-kinds
madsrasmussen 20fb3c9
use box
madsrasmussen b0a8fa7
render entity actions
madsrasmussen a476ba3
use edit path builder for user links
madsrasmussen 4df5776
rename method
madsrasmussen 55517f4
Merge branch 'main' into v17/feature/collection-view-card-and-ref-kinds
madsrasmussen 3de2bdf
Revert "rename method"
madsrasmussen c927d1b
Update collection-default.context.ts
madsrasmussen b220a69
make type lint ignore unused args with an underscore
madsrasmussen 0eceae4
temp remove unused
madsrasmussen 231477d
only make collection vie selectable if there are any registered bulk …
madsrasmussen fdc9386
don't render name link if there is no href
madsrasmussen 8e42259
fix imports
madsrasmussen 8b0f984
use selectable state
madsrasmussen 21fda07
Merge branch 'main' into v17/feature/collection-view-card-and-ref-kinds
madsrasmussen 43ee388
Update language-table-collection-view.element.ts
madsrasmussen 650dcec
Update card-collection-view.element.ts
madsrasmussen 608e338
clean up
madsrasmussen 543ef21
Refactor collection views to use shared base class
madsrasmussen 70caf83
refactor(collection): parallelize href fetching and make method private
madsrasmussen f911ce3
docs(examples): update collection example to use card and ref kinds
madsrasmussen 1ee69b2
docs(examples): add icon property to collection example data model
madsrasmussen da75061
Update src/Umbraco.Web.UI.Client/src/packages/core/collection/default…
madsrasmussen 7e31539
Update src/Umbraco.Web.UI.Client/src/packages/core/collection/default…
madsrasmussen 2af23c1
Update src/Umbraco.Web.UI.Client/src/packages/core/collection/view/ty…
madsrasmussen 7c1091f
Update collection-bulk-action.manager.test.ts
madsrasmussen fd6e616
Merge branch 'v17/feature/collection-view-card-and-ref-kinds' of http…
madsrasmussen 6d919e0
Removed duplicate and redundant '@typescript-eslint/no-unused-vars' r…
madsrasmussen a0f43ca
Handle missing user href in name column layout
madsrasmussen b1cc623
Update user-table-name-column-layout.element.ts
madsrasmussen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 0 additions & 82 deletions
82
...Umbraco.Web.UI.Client/examples/collection/collection/card-view/collection-view.element.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/Umbraco.Web.UI.Client/examples/collection/collection/ref-view/manifests.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { EXAMPLE_COLLECTION_ALIAS } from '../constants.js'; | ||
| import { UMB_COLLECTION_ALIAS_CONDITION } from '@umbraco-cms/backoffice/collection'; | ||
|
|
||
| export const manifests: Array<UmbExtensionManifest> = [ | ||
| { | ||
| type: 'collectionView', | ||
| kind: 'ref', | ||
| alias: 'Example.CollectionView.Ref', | ||
| name: 'Example Ref Collection View', | ||
| conditions: [ | ||
| { | ||
| alias: UMB_COLLECTION_ALIAS_CONDITION, | ||
| match: EXAMPLE_COLLECTION_ALIAS, | ||
| }, | ||
| ], | ||
| }, | ||
| ]; |
73 changes: 73 additions & 0 deletions
73
...UI.Client/src/packages/core/collection/bulk-action/collection-bulk-action.manager.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import { UmbCollectionBulkActionManager } from './collection-bulk-action.manager.js'; | ||
| import { umbExtensionsRegistry } from '../../extension-registry/index.js'; | ||
| import { expect } from '@open-wc/testing'; | ||
| import { Observable, first } from '@umbraco-cms/backoffice/external/rxjs'; | ||
madsrasmussen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| import { UmbControllerHostElementMixin } from '@umbraco-cms/backoffice/controller-api'; | ||
| import { customElement } from '@umbraco-cms/backoffice/external/lit'; | ||
|
|
||
| @customElement('test-bulk-action-controller-host') | ||
| class UmbTestControllerHostElement extends UmbControllerHostElementMixin(HTMLElement) {} | ||
|
|
||
| const bulkActionManifests: Array<UmbExtensionManifest> = [ | ||
| { | ||
| type: 'entityBulkAction', | ||
| alias: 'Umb.Test.EntityBulkAction.1', | ||
| name: 'Test Entity Bulk Action 1', | ||
| forEntityTypes: ['test-entity'], | ||
| }, | ||
| ]; | ||
|
|
||
| describe('UmbCollectionBulkActionManager', () => { | ||
| let hostElement: UmbTestControllerHostElement; | ||
| let manager: UmbCollectionBulkActionManager; | ||
|
|
||
| beforeEach(() => { | ||
| hostElement = new UmbTestControllerHostElement(); | ||
| manager = new UmbCollectionBulkActionManager(hostElement); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| manager.destroy(); | ||
| hostElement.destroy(); | ||
| }); | ||
|
|
||
| describe('Public API', () => { | ||
| describe('properties', () => { | ||
| it('has a hasBulkActions property', () => { | ||
| expect(manager).to.have.property('hasBulkActions').to.be.an.instanceOf(Observable); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('hasBulkActions', () => { | ||
| afterEach(() => { | ||
| umbExtensionsRegistry.clear(); | ||
| }); | ||
|
|
||
| it('it emits false if there are no actions', (done) => { | ||
| // Use first() to only get the initial emission and auto-unsubscribe | ||
| manager.hasBulkActions.subscribe((value) => { | ||
| expect(value).to.equal(false); | ||
| done(); | ||
| }); | ||
| }); | ||
|
|
||
| it('it emits true if there are actions', (done) => { | ||
| let isFirstValue = true; | ||
|
|
||
| // First, we need to add bulk action manifests to the registry | ||
| umbExtensionsRegistry.registerMany(bulkActionManifests); | ||
|
|
||
| manager.hasBulkActions.subscribe((value) => { | ||
| if (isFirstValue) { | ||
| // Skip the first emission which is false | ||
| isFirstValue = false; | ||
| return; | ||
| } | ||
|
|
||
| expect(value).to.equal(true); | ||
| done(); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
39 changes: 39 additions & 0 deletions
39
....Web.UI.Client/src/packages/core/collection/bulk-action/collection-bulk-action.manager.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api'; | ||
| import { UmbExtensionsManifestInitializer } from '@umbraco-cms/backoffice/extension-api'; | ||
| import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry'; | ||
| import { UmbBooleanState } from '@umbraco-cms/backoffice/observable-api'; | ||
| import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; | ||
|
|
||
| /** | ||
| * Manager responsible for tracking the availability of bulk actions in a collection. | ||
| */ | ||
| export class UmbCollectionBulkActionManager extends UmbControllerBase { | ||
| #hasBulkActions = new UmbBooleanState<undefined>(undefined); | ||
|
|
||
| /** | ||
| * Observable that emits `true` if bulk actions are available, `false` if none are registered, | ||
| * or `undefined` if the state has not yet been determined. | ||
| */ | ||
| public readonly hasBulkActions = this.#hasBulkActions.asObservable(); | ||
|
|
||
| /** | ||
| * Creates a new instance of the bulk action manager. | ||
| * @param {UmbControllerHost} host - The controller host that owns this manager. | ||
| */ | ||
| constructor(host: UmbControllerHost) { | ||
| super(host); | ||
| this.#observeBulkActions(); | ||
| } | ||
|
|
||
| #observeBulkActions() { | ||
| new UmbExtensionsManifestInitializer( | ||
| this, | ||
| umbExtensionsRegistry, | ||
| 'entityBulkAction', | ||
| null, | ||
| (bulkActionControllers) => { | ||
| this.#hasBulkActions.setValue(bulkActionControllers.length > 0); | ||
| }, | ||
| ); | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
...o.Web.UI.Client/src/packages/core/collection/components/collection-view-bundle.element.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/Umbraco.Web.UI.Client/src/packages/core/collection/extensions/types.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,2 @@ | ||
| export type * from './collection-action.extension.js'; | ||
| export type * from './collection-view.extension.js'; | ||
| export type * from './collection.extension.js'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.