// #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 { Emit } from '../../../../Events/Decorators/EmitDecorator';
import { HTMLElementEventEmitter } from '@breadstone/mosaik-elements';
import { Appearanceable } from '../../../Behaviors/Appearanceable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { TextElement } from '../../Primitives/Text/TextElement';
import { tableElementTemplate } from './TableElementTemplate';
import { tableElementJoyStyle } from './Themes/TableElement.Joy';
import { tableElementRetroStyle } from './Themes/TableElement.Retro';
import { tableElementCosmopolitanStyle } from './Themes/TableElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * Table - A structured display of data in rows and columns.
 *
 * @element mosaik-table
 *
 * @fires columnsChanged - Fired when the columns of the table has changed.
 *
 * @public
 */
let TableElement = class TableElement extends Themeable(Appearanceable(CustomElement)) {
    // #region Fields
    _columnsChanged;
    _columns;
    _caption;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._columns = '';
        this._caption = '';
        this._columnsChanged = new HTMLElementEventEmitter(this, 'columnsChanged');
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     *
     * @public
     * @static
     * @readonly
    */
    static get is() {
        return 'mosaik-table';
    }
    /**
     * Gets or sets the `columns` property.
     *
     * @public
     * @attr
     */
    get columns() {
        return this._columns;
    }
    set columns(value) {
        if (this._columns !== value) {
            this._columns = value;
            this.requestUpdate('columns');
        }
    }
    /**
     * Gets or sets the `caption` property.
     *
     * @public
     * @attr
     */
    get caption() {
        return this._caption;
    }
    set caption(value) {
        if (this._caption !== value) {
            this._caption = value;
            this.requestUpdate('caption');
        }
    }
    /**
     * Called when <ACTION>.
     * Provides reference to `{@link ITableColumnsChangedEventDetail}` as event argument.
     *
     * @public
     * @readonly
     * @eventProperty
     * @type IEventEmitter<ITableColumnsChangedEventDetail>
     */
    get columnsChanged() {
        return this._columnsChanged;
    }
    // #endregion
    // #region Methods
    /**
     * @public
     * @override
     */
    attributeChangedCallback(name, oldValue, newValue) {
        super.attributeChangedCallback(name, oldValue, newValue);
        if (name === 'columns') {
            this._columnsChanged.emit({
                columns: newValue
            });
        }
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], TableElement.prototype, "columns", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], TableElement.prototype, "caption", null);
__decorate([
    Emit({ eventName: 'columnsChanged' }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [])
], TableElement.prototype, "columnsChanged", null);
TableElement = __decorate([
    Component({
        selector: 'mosaik-table',
        template: tableElementTemplate,
        themes: {
            joy: tableElementJoyStyle,
            retro: tableElementRetroStyle,
            cosmopolitan: tableElementCosmopolitanStyle
        },
        imports: [
            TextElement
        ]
    }),
    __metadata("design:paramtypes", [])
], TableElement);
export { TableElement };
//# sourceMappingURL=TableElement.js.map