// #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 { Themeable } from '../../../Behaviors/Themeable';
import { InlineStyleController } from '../../../Controllers/InlineStyleController';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { ResizeElement } from '../Resize/ResizeElement';
import { tileListItemElementCosmopolitanStyle } from './Themes/TileListItemElement.Cosmopolitan';
import { tileListItemElementJoyStyle } from './Themes/TileListItemElement.Joy';
import { tileListItemElementMemphisStyle } from './Themes/TileListItemElement.Memphis';
import { tileListItemElementTemplate } from './TileListItemElementTemplate';
// #endregion
/**
 * The `TileListItemElement` element.
 *
 * @example
 * ```html
 * <mosaik-tile-list-item col="1" row="1">
 *   <img src="image.jpg" alt="Tile">
 * </mosaik-tile-list-item>
 * ```
 *
 * @public
 */
let TileListItemElement = class TileListItemElement extends Themeable(CustomElement) {
    // #region Fields
    _col;
    _colSpan;
    _order;
    _reorderable;
    _resizable;
    _row;
    _rowSpan;
    _inlineStyleController;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._col = 0;
        this._colSpan = 1;
        this._order = 0;
        this._reorderable = false;
        this._resizable = false;
        this._row = 0;
        this._rowSpan = 1;
        this._inlineStyleController = new InlineStyleController(this);
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     * The `is` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-tile-list-item';
    }
    /**
     * Gets or sets the `col` property.
     *
     * @public
     * @attr
     */
    get col() {
        return this._col;
    }
    set col(value) {
        if (this._col !== value) {
            this._col = value;
            this.requestUpdate('col');
        }
    }
    /**
     * Gets or sets the `colSpan` property.
     *
     * @public
     * @attr
     */
    get colSpan() {
        return this._colSpan;
    }
    set colSpan(value) {
        if (this._colSpan !== value) {
            this._colSpan = value;
            this.requestUpdate('colSpan');
        }
    }
    /**
     * Gets or sets the `order` property.
     *
     * @public
     * @attr
     */
    get order() {
        return this._order;
    }
    set order(value) {
        if (this._order !== value) {
            this._order = value;
            this.requestUpdate('order');
        }
    }
    /**
     * Gets or sets the `reorderable` property.
     *
     * @public
     * @attr
     */
    get reorderable() {
        return this._reorderable;
    }
    set reorderable(value) {
        if (this._reorderable !== value) {
            this._reorderable = value;
            this.requestUpdate('reorderable');
        }
    }
    /**
     * Gets or sets the `resizable` property.
     *
     * @public
     * @attr
     */
    get resizable() {
        return this._resizable;
    }
    set resizable(value) {
        if (this._resizable !== value) {
            this._resizable = value;
            this.requestUpdate('resizable');
        }
    }
    /**
     * Gets or sets the `row` property.
     *
     * @public
     * @attr
     */
    get row() {
        return this._row;
    }
    set row(value) {
        if (this._row !== value) {
            this._row = value;
            this.requestUpdate('row');
        }
    }
    /**
     * Gets or sets the `rowSpan` property.
     *
     * @public
     * @attr
     */
    get rowSpan() {
        return this._rowSpan;
    }
    set rowSpan(value) {
        if (this._rowSpan !== value) {
            this._rowSpan = value;
            this.requestUpdate('rowSpan');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @private
     */
    onResizeStart() { }
    /**
     * @private
     */
    onResize() { }
    /**
     * @private
     */
    onResizeEnd() { }
    /**
     * @private
     */
    onResizeCancel() { }
    /**
     * @private
     */
    onDragStart(event) {
        event.dataTransfer?.setData('text/plain', '');
        // event.dataTransfer?.effectAllowed = 'move';
        this.classList.add('dragging');
    }
    /**
     * @private
     */
    onDragEnd() {
        this.classList.remove('dragging');
        this.classList.remove('dragover');
    }
    /**
     * @protected
     * @override
     */
    updated(changedProperties) {
        super.updated(changedProperties);
        this._inlineStyleController.setStyle('grid-column-start', this._col > 0 ? `${this._col}` : 'auto');
        this._inlineStyleController.setStyle('grid-column-end', `span ${this._colSpan}`);
        this._inlineStyleController.setStyle('grid-row-start', this._row > 0 ? `${this._row}` : 'auto');
        this._inlineStyleController.setStyle('grid-row-end', `span ${this._rowSpan}`);
        this._inlineStyleController.setStyle('order', `${this._order}`);
    }
};
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], TileListItemElement.prototype, "col", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], TileListItemElement.prototype, "colSpan", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], TileListItemElement.prototype, "order", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], TileListItemElement.prototype, "reorderable", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], TileListItemElement.prototype, "resizable", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], TileListItemElement.prototype, "row", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], TileListItemElement.prototype, "rowSpan", null);
TileListItemElement = __decorate([
    Component({
        selector: 'mosaik-tile-list-item',
        template: tileListItemElementTemplate,
        themes: {
            joy: tileListItemElementJoyStyle,
            memphis: tileListItemElementMemphisStyle,
            cosmopolitan: tileListItemElementCosmopolitanStyle
        },
        imports: [
            ResizeElement
        ]
    }),
    __metadata("design:paramtypes", [])
], TileListItemElement);
export { TileListItemElement };
//# sourceMappingURL=TileListItemElement.js.map