Skip to content

Conversation

@madsrasmussen
Copy link
Contributor

@madsrasmussen madsrasmussen commented Nov 28, 2025

Building of top of: #20954 . Please review first.

Following in the steps of the Collection Item Card extension point, this PR brings a Collection Item Ref extension point. The extension point follows the exact same interfaces but offers a different rendering opportunity. The PR also introduces a Base Element and Manifest Type to work for both the card and ref types.

Manifest Example

{
  type: 'entityCollectionItemRef',
  alias: 'My.EntityCollectionItemRef.CustomType',
  name: 'My Custom Type Entity Collection Item Ref',
  element: () => import('./my-custom-type-collection-item-ref.element.js'),
  forEntityTypes: ['my-custom-type'],
}

Basic Element Example

@customElement('my-custom-type-collection-item-ref')
export class MyCustomTypeCollectionItemRefElement extends UmbLitElement {
	
  @property({ type: Object })
  item = false;

  @property({ type: Boolean })
  selectable = false;

  @property({ type: Boolean })
  selected = false;

  @property({ type: Boolean })
  selectOnly = false;

  @property({ type: String })
  href?: string;

  #onSelected(event: CustomEvent) {
    if (!this.item) return;
    event.stopPropagation();
    this.dispatchEvent(new UmbSelectedEvent(this.item.unique));
  }

  #onDeselected(event: CustomEvent) {
    if (!this.item) return;
    event.stopPropagation();
    this.dispatchEvent(new UmbDeselectedEvent(this.item.unique));
  }

  override render() {
    if (!this.item) return nothing;
    return html` <div>My Ref rendering</div> `;
  }

  static override styles = [css``];
}

madsrasmussen and others added 19 commits November 25, 2025 10:10
…tity-collection-item-card/entity-collection-item-card.element.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants