diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/grid/document-grid-collection-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/grid/document-grid-collection-view.element.ts
index d3d11169a5..b94e2d9b85 100644
--- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/grid/document-grid-collection-view.element.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/grid/document-grid-collection-view.element.ts
@@ -1,7 +1,7 @@
import { getPropertyValueByAlias } from '../index.js';
import type { UmbCollectionColumnConfiguration } from '../../../../../core/collection/types.js';
import type { UmbDocumentCollectionFilterModel, UmbDocumentCollectionItemModel } from '../../types.js';
-import { css, html, customElement, state, repeat } from '@umbraco-cms/backoffice/external/lit';
+import { css, customElement, html, nothing, repeat, state, when } from '@umbraco-cms/backoffice/external/lit';
import { fromCamelCase } from '@umbraco-cms/backoffice/utils';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
@@ -98,26 +98,37 @@ export class UmbDocumentGridCollectionViewElement extends UmbLitElement {
}
render() {
- if (this._loading) {
- return html`
`;
- }
-
- if (this._items.length === 0) {
- return html`${this.localize.term('content_listViewNoItems')}
`;
- }
+ return this._items.length === 0 ? this.#renderEmpty() : this.#renderItems();
+ }
+ #renderEmpty() {
+ if (this._items.length > 0) return nothing;
return html`
-
- ${repeat(
- this._items,
- (item) => item.unique,
- (item) => this.#renderCard(item),
+
+ ${when(
+ this._loading,
+ () => html`
`,
+ () => html`
${this.localize.term('content_listViewNoItems')}
`,
)}
`;
}
- #renderCard(item: UmbDocumentCollectionItemModel) {
+ #renderItems() {
+ if (this._items.length === 0) return nothing;
+ return html`
+
+ ${repeat(
+ this._items,
+ (item) => item.unique,
+ (item) => this.#renderItem(item),
+ )}
+
+ ${when(this._loading, () => html`
`)}
+ `;
+ }
+
+ #renderItem(item: UmbDocumentCollectionItemModel) {
return html`
`;
default:
return html`${fromCamelCase(item.state)}`;
- }
+ }
}
#renderProperties(item: UmbDocumentCollectionItemModel) {
diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts
index 93534ff9ee..54683263d1 100644
--- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts
+++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts
@@ -2,7 +2,7 @@ import { getPropertyValueByAlias } from '../index.js';
import type { UmbCollectionColumnConfiguration } from '../../../../../core/collection/types.js';
import type { UmbDocumentCollectionItemModel } from '../../types.js';
import type { UmbDocumentCollectionContext } from '../../document-collection.context.js';
-import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
+import { css, customElement, html, nothing, state, when } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection';
@@ -193,23 +193,34 @@ export class UmbDocumentTableCollectionViewElement extends UmbLitElement {
}
render() {
- if (this._loading) {
- return html`
`;
- }
+ return this._tableItems.length === 0 ? this.#renderEmpty() : this.#renderItems();
+ }
- if (this._tableItems.length === 0) {
- return html`${this.localize.term('content_listViewNoItems')}
`;
- }
+ #renderEmpty() {
+ if (this._tableItems.length > 0) return nothing;
+ return html`
+
+ ${when(
+ this._loading,
+ () => html`
`,
+ () => html`
${this.localize.term('content_listViewNoItems')}
`,
+ )}
+
+ `;
+ }
+ #renderItems() {
+ if (this._tableItems.length === 0) return nothing;
return html`
+ @selected=${this.#handleSelect}
+ @deselected=${this.#handleDeselect}
+ @ordered=${this.#handleOrdering}>
+ ${when(this._loading, () => html``)}
`;
}