var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { UMB_COLLECTION_CONTEXT } from '../../../../core/collection/index.js';
import { css, html, customElement, state } from '../../../../../external/lit/index.js';
import { UmbTextStyles } from '../../../../core/style/index.js';
import { UmbLitElement } from '../../../../core/lit-element/index.js';
let UmbClipboardTableCollectionViewElement = class UmbClipboardTableCollectionViewElement extends UmbLitElement {
    #collectionContext;
    constructor() {
        super();
        this._tableConfig = {
            allowSelection: false,
        };
        this._tableColumns = [
            {
                name: 'Name',
                alias: 'name',
            },
        ];
        this._tableItems = [];
        this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => {
            this.#collectionContext = instance;
            this.#observeCollectionItems();
        });
    }
    #observeCollectionItems() {
        if (!this.#collectionContext)
            return;
        this.observe(this.#collectionContext.items, (items) => this.#createTableItems(items), 'umbCollectionItemsObserver');
    }
    #createTableItems(items) {
        this._tableItems = items.map((item) => {
            return {
                id: item.unique,
                icon: item.icon ?? 'icon-clipboard-entry',
                data: [
                    {
                        columnAlias: 'name',
                        value: html `<div>${item.name}</div>`,
                    },
                ],
            };
        });
    }
    render() {
        return html `
			<umb-table .config=${this._tableConfig} .columns=${this._tableColumns} .items=${this._tableItems}></umb-table>
		`;
    }
    static { this.styles = [
        UmbTextStyles,
        css `
			:host {
				display: flex;
				flex-direction: column;
			}
		`,
    ]; }
};
__decorate([
    state()
], UmbClipboardTableCollectionViewElement.prototype, "_tableConfig", void 0);
__decorate([
    state()
], UmbClipboardTableCollectionViewElement.prototype, "_tableColumns", void 0);
__decorate([
    state()
], UmbClipboardTableCollectionViewElement.prototype, "_tableItems", void 0);
UmbClipboardTableCollectionViewElement = __decorate([
    customElement('umb-clipboard-table-collection-view')
], UmbClipboardTableCollectionViewElement);
export { UmbClipboardTableCollectionViewElement };
export { UmbClipboardTableCollectionViewElement as element };
