import { __decorate, __metadata } from "tslib";
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { NzModalService } from 'ng-zorro-antd/modal';
let KengicDashboardItemComponent = class KengicDashboardItemComponent {
    constructor(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
     */
    handleEdit(item) {
        this.edit.emit(item);
    }
    /**
     * Remove the item
     * @param item The item
     */
    handleRemove(item) {
        this.nzModalService.confirm({
            nzTitle: 'Confirm',
            nzContent: 'Do you want to delete this panel?',
            nzOnOk: () => {
                this.remove.emit(item);
            },
        });
    }
    /**
     * View the item
     * @param item The item
     */
    handleView(item) {
        this.view.emit(item);
    }
};
KengicDashboardItemComponent.ctorParameters = () => [
    { 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);
export { KengicDashboardItemComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2VuZ2ljLWRhc2hib2FyZC1pdGVtLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BrZW5naWMvZmUtbmcvIiwic291cmNlcyI6WyJsa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