import { __decorate, __metadata } from "tslib";
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { NzModalService } from 'ng-zorro-antd/modal';
var KengicDashboardItemComponent = /** @class */ (function () {
    function KengicDashboardItemComponent(nzModalService) {
        this.nzModalService = nzModalService;
        this.edit = new EventEmitter();
        this.i18n = {};
        this.item = {
            x: 0,
            y: 0,
            cols: 1,
            rows: 1,
            title: '',
        };
        this.remove = new EventEmitter();
        this.view = new EventEmitter();
    }
    /**
     * Edit the item
     * @param item The item
     */
    KengicDashboardItemComponent.prototype.handleEdit = function (item) {
        this.edit.emit(item);
    };
    /**
     * Remove the item
     * @param item The item
     */
    KengicDashboardItemComponent.prototype.handleRemove = function (item) {
        var _this = this;
        this.nzModalService.confirm({
            nzTitle: 'Confirm',
            nzContent: 'Do you want to delete this panel?',
            nzOnOk: function () {
                _this.remove.emit(item);
            },
        });
    };
    /**
     * View the item
     * @param item The item
     */
    KengicDashboardItemComponent.prototype.handleView = function (item) {
        this.view.emit(item);
    };
    KengicDashboardItemComponent.ctorParameters = function () { return [
        { type: NzModalService }
    ]; };
    __decorate([
        Output(),
        __metadata("design:type", EventEmitter)
    ], KengicDashboardItemComponent.prototype, "edit", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], KengicDashboardItemComponent.prototype, "i18n", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], KengicDashboardItemComponent.prototype, "item", void 0);
    __decorate([
        Output(),
        __metadata("design:type", EventEmitter)
    ], KengicDashboardItemComponent.prototype, "remove", void 0);
    __decorate([
        Output(),
        __metadata("design:type", EventEmitter)
    ], KengicDashboardItemComponent.prototype, "view", void 0);
    KengicDashboardItemComponent = __decorate([
        Component({
            selector: 'kengic-dashboard-item',
            template: "<nz-card [nzTitle]=\"header\">\r\n  <ng-content></ng-content>\r\n</nz-card>\r\n\r\n<ng-template #header>\r\n  <div\r\n    [nzDropdownMenu]=\"menuTpl\"\r\n    [nzOverlayStyle]=\"{\r\n      userSelect: 'none',\r\n      width: '100px',\r\n      float: 'right'\r\n    }\"\r\n    nz-dropdown\r\n    nzPlacement=\"bottomRight\"\r\n    nzTrigger=\"click\"\r\n  >\r\n    {{ item.title }}\r\n    <i nz-icon nzTheme=\"outline\" nzType=\"caret-down\"></i>\r\n  </div>\r\n\r\n  <nz-dropdown-menu #menuTpl=\"nzDropdownMenu\">\r\n    <ul nz-menu>\r\n      <li (click)=\"handleView(item)\" nz-menu-item>\r\n        <i nz-icon nzTheme=\"outline\" nzType=\"eye\"></i>\r\n        {{ i18n?.view || 'View' }}\r\n      </li>\r\n      <li (click)=\"handleEdit(item)\" nz-menu-item>\r\n        <i nz-icon nzTheme=\"outline\" nzType=\"form\"></i>\r\n        {{ i18n?.edit || 'Edit' }}\r\n      </li>\r\n      <li nz-menu-divider></li>\r\n      <li (click)=\"handleRemove(item)\" nz-menu-item>\r\n        <i nz-icon nzTheme=\"outline\" nzType=\"delete\"></i>\r\n        {{ i18n?.remove || 'Remove' }}\r\n      </li>\r\n    </ul>\r\n  </nz-dropdown-menu>\r\n</ng-template>\r\n",
            styles: [":host ::ng-deep .ant-card{margin:0;height:100%;user-select:none}:host ::ng-deep .ant-card .ant-card-head{cursor:move;text-align:center;min-height:32px;padding:0}:host ::ng-deep .ant-card .ant-card-head .ant-card-head-title{padding:0}:host ::ng-deep .ant-card .ant-card-head .ant-card-head-title div[nz-dropdown]{padding:5px 16px;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host ::ng-deep .ant-card .ant-card-head .ant-card-head-title div[nz-dropdown] .anticon{visibility:hidden}:host ::ng-deep .ant-card .ant-card-head .ant-card-head-title div[nz-dropdown]:hover .anticon{visibility:initial}:host ::ng-deep .ant-card .ant-card-body{padding:10px;height:calc(100% - 34px)}"]
        }),
        __metadata("design:paramtypes", [NzModalService])
    ], KengicDashboardItemComponent);
    return KengicDashboardItemComponent;
}());
export { KengicDashboardItemComponent };
//# sourceMappingURL=data:application/json;base64, 