// #region Imports
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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Disableable } from '../../../Behaviors/Disableable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { TextElement } from '../../Primitives/Text/TextElement';
import { ItemsElement } from '../Abstracts/Items/ItemsElement';
import { ListElement } from '../List/ListElement';
import { dataListElementTemplate } from './DataListElementTemplate';
import { dataListElementJoyStyle } from './Themes/DataListElement.Joy';
import { dataListElementMemphisStyle } from './Themes/DataListElement.Memphis';
import { dataListElementCosmopolitanStyle } from './Themes/DataListElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * Data List - A specialized type of list used to display tabular data in rows and columns. Data lists provide a structured way to present and manage information, often with sorting and filtering options.
 *
 * @element mosaik-data-list
 *
 * @public
 */
let DataListElement = class DataListElement extends Themeable(Disableable(ItemsElement)) {
    // #region Fields
    _alternating;
    _itemDefinitions;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._alternating = false;
        this._itemDefinitions = new Array();
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-data-list';
    }
    /**
     * Gets or sets the `alternating` property.
     *
     * @public
     * @attr
     */
    get alternating() {
        return this._alternating;
    }
    set alternating(value) {
        if (this._alternating !== value) {
            this._alternating = value;
            this.requestUpdate('alternating');
        }
    }
    /**
     * Gets or sets the `itemDefinitions` property.
     *
     * @public
     */
    get itemDefinitions() {
        return this._itemDefinitions;
    }
    set itemDefinitions(value) {
        if (this._itemDefinitions !== value) {
            this._itemDefinitions = value;
            this.requestUpdate('itemDefinitions');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @template
     * @private
     */
    getItemDefinitions() {
        // let definitions;
        // if (this._autoGenerateColumns) {
        //     // TODO: find a way to get all object keys of array.
        //     // const first = this.source[0];
        //     // const firstKeys = Object.keys(first);
        //     // return firstKeys;
        //     const row = this.source[0];
        //     columns = Object.getOwnPropertyNames(row).map(x => ({
        //         key: x,
        //         path: x
        //     }));
        //     return;
        // }
        const definitions = this._itemDefinitions.map((x) => ({
            ...x,
            ...{ path: x.path ?? x.key }
        }));
        return definitions;
    }
};
__decorate([
    Attribute({ type: Boolean, useDefault: true }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], DataListElement.prototype, "alternating", null);
__decorate([
    Property({ type: Array }),
    __metadata("design:type", Array),
    __metadata("design:paramtypes", [Array])
], DataListElement.prototype, "itemDefinitions", null);
DataListElement = __decorate([
    Component({
        selector: 'mosaik-data-list',
        template: dataListElementTemplate,
        themes: {
            joy: dataListElementJoyStyle,
            memphis: dataListElementMemphisStyle,
            cosmopolitan: dataListElementCosmopolitanStyle
        },
        imports: [
            ListElement,
            TextElement
        ]
    }),
    __metadata("design:paramtypes", [])
], DataListElement);
export { DataListElement };
//# sourceMappingURL=DataListElement.js.map