import { Component, Input, inject } from "@angular/core";
import { KanbanEventService } from "../../kanban-event.service";
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/forms";
import * as i3 from "@seniorsistemas/angular-components/tiered-menu";
export class KanbanItemComponent {
    _kanbanEventService = inject(KanbanEventService);
    item;
    selected = false;
    showCheckbox = true;
    headerTemplate = null;
    bodyTemplate = null;
    footerTemplate = null;
    kanbanItemOptions = [];
    ngOnInit() {
        this._convertToTieredMenuItemData();
    }
    onSelectedChange(value) {
        if (value) {
            this._kanbanEventService.emitSelectItemEvent(this.item);
        }
        else {
            this._kanbanEventService.emitUnselectItemEvent(this.item);
        }
    }
    _convertToTieredMenuItemData() {
        if (!this.item.options)
            return;
        const options = [];
        this.item.options.forEach((option) => {
            options.push({
                ...option,
                command: () => option.command(this.item),
            });
        });
        this.kanbanItemOptions = options;
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KanbanItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: KanbanItemComponent, selector: "s-kanban-item", inputs: { item: "item", selected: "selected", showCheckbox: "showCheckbox", headerTemplate: "headerTemplate", bodyTemplate: "bodyTemplate", footerTemplate: "footerTemplate" }, ngImport: i0, template: "<div\n    class=\"kanban-item\"\n    [ngClass]=\"{\n        'kanban-item--selected': selected && !item.disabled,\n        'kanban-item--disabled': item.disabled,\n        'kanban-item--frozen': !item.disabled && item.frozen\n    }\">\n    <div class=\"kanban-item__header\">\n        <div class=\"content\">\n            <form>\n                <input\n                    *ngIf=\"showCheckbox && !item.disabled && !item.frozen\"\n                    type=\"checkbox\"\n                    name=\"checkbox\"\n                    [(ngModel)]=\"selected\"\n                    (ngModelChange)=\"onSelectedChange($event)\"\n                    (click)=\"$event.stopPropagation()\">\n            </form>\n            <ng-container *ngTemplateOutlet=\"headerTemplate; context: { $implicit: item }\"></ng-container>\n        </div>\n        <button\n            *ngIf=\"item.options && !item.disabled\"\n            class=\"options-button\"\n            (click)=\"$event.stopPropagation();\"\n            sTieredMenu\n            [items]=\"kanbanItemOptions\">\n            <i class=\"fas fa-ellipsis-v\"></i>\n        </button>\n    </div>\n    <div class=\"kanban-item__body\">\n        <ng-container *ngTemplateOutlet=\"bodyTemplate; context: { $implicit: item }\"></ng-container>\n    </div>\n    <div *ngIf=\"footerTemplate\" class=\"kanban-item__footer\">\n        <ng-container *ngTemplateOutlet=\"footerTemplate; context: { $implicit: item }\"></ng-container>     \n    </div>\n</div>\n", styles: [".kanban-item{background-color:#fff;border-radius:4px;box-shadow:0 1px 5px #00000040;cursor:pointer;display:flex;flex-direction:column;margin:16px;min-width:260px;padding:16px;-webkit-user-select:none;user-select:none}.kanban-item .kanban-item__header{display:flex;justify-content:space-between}.kanban-item .kanban-item__header .content{display:flex;gap:16px}.kanban-item .kanban-item__header .options-button{background-color:transparent;border:none;cursor:pointer;margin-right:-8px;padding:0 8px}.kanban-item .kanban-item__body{margin:16px 0}.kanban-item .kanban-item__footer{border-top:1px solid #dedce5;display:flex;justify-content:space-between}.kanban-item .kanban-item__footer .date-info{align-items:center;color:#6e7280;display:flex;font-family:\"Open Sans\" sans-serif;font-size:12px;gap:4px;line-height:150%}.kanban-item--selected{border:1px solid #428BCA}.kanban-item--disabled{opacity:50%}.kanban-item--frozen{box-shadow:none}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.TieredMenuDirective, selector: "[sTieredMenu]", inputs: ["items", "focusedItem", "triggerEvent", "ariaLabel"], outputs: ["tieredMenuOpened", "tieredMenuClosed"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KanbanItemComponent, decorators: [{
            type: Component,
            args: [{ selector: "s-kanban-item", template: "<div\n    class=\"kanban-item\"\n    [ngClass]=\"{\n        'kanban-item--selected': selected && !item.disabled,\n        'kanban-item--disabled': item.disabled,\n        'kanban-item--frozen': !item.disabled && item.frozen\n    }\">\n    <div class=\"kanban-item__header\">\n        <div class=\"content\">\n            <form>\n                <input\n                    *ngIf=\"showCheckbox && !item.disabled && !item.frozen\"\n                    type=\"checkbox\"\n                    name=\"checkbox\"\n                    [(ngModel)]=\"selected\"\n                    (ngModelChange)=\"onSelectedChange($event)\"\n                    (click)=\"$event.stopPropagation()\">\n            </form>\n            <ng-container *ngTemplateOutlet=\"headerTemplate; context: { $implicit: item }\"></ng-container>\n        </div>\n        <button\n            *ngIf=\"item.options && !item.disabled\"\n            class=\"options-button\"\n            (click)=\"$event.stopPropagation();\"\n            sTieredMenu\n            [items]=\"kanbanItemOptions\">\n            <i class=\"fas fa-ellipsis-v\"></i>\n        </button>\n    </div>\n    <div class=\"kanban-item__body\">\n        <ng-container *ngTemplateOutlet=\"bodyTemplate; context: { $implicit: item }\"></ng-container>\n    </div>\n    <div *ngIf=\"footerTemplate\" class=\"kanban-item__footer\">\n        <ng-container *ngTemplateOutlet=\"footerTemplate; context: { $implicit: item }\"></ng-container>     \n    </div>\n</div>\n", styles: [".kanban-item{background-color:#fff;border-radius:4px;box-shadow:0 1px 5px #00000040;cursor:pointer;display:flex;flex-direction:column;margin:16px;min-width:260px;padding:16px;-webkit-user-select:none;user-select:none}.kanban-item .kanban-item__header{display:flex;justify-content:space-between}.kanban-item .kanban-item__header .content{display:flex;gap:16px}.kanban-item .kanban-item__header .options-button{background-color:transparent;border:none;cursor:pointer;margin-right:-8px;padding:0 8px}.kanban-item .kanban-item__body{margin:16px 0}.kanban-item .kanban-item__footer{border-top:1px solid #dedce5;display:flex;justify-content:space-between}.kanban-item .kanban-item__footer .date-info{align-items:center;color:#6e7280;display:flex;font-family:\"Open Sans\" sans-serif;font-size:12px;gap:4px;line-height:150%}.kanban-item--selected{border:1px solid #428BCA}.kanban-item--disabled{opacity:50%}.kanban-item--frozen{box-shadow:none}\n"] }]
        }], propDecorators: { item: [{
                type: Input,
                args: [{ required: true }]
            }], selected: [{
                type: Input
            }], showCheckbox: [{
                type: Input
            }], headerTemplate: [{
                type: Input
            }], bodyTemplate: [{
                type: Input
            }], footerTemplate: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 