import { Component, Input, inject } from '@angular/core';
import { KanbanEventService } from '../../kanban-event.service';
import { TieredMenuDirective } from '@seniorsistemas/angular-components/tiered-menu';
import { NgClass, NgTemplateOutlet } from '@angular/common';
import { FormsModule } from '@angular/forms';
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
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: "17.0.0", version: "18.2.14", type: KanbanItemComponent, isStandalone: true, selector: "s-kanban-item", inputs: { item: "item", selected: "selected", showCheckbox: "showCheckbox", headerTemplate: "headerTemplate", bodyTemplate: "bodyTemplate", footerTemplate: "footerTemplate" }, ngImport: i0, template: "<div\r\n    class=\"kanban-item\"\r\n    [ngClass]=\"{\r\n        'kanban-item--selected': selected && !item.disabled,\r\n        'kanban-item--disabled': item.disabled,\r\n        'kanban-item--frozen': !item.disabled && item.frozen,\r\n    }\"\r\n>\r\n    <div class=\"kanban-item__header\">\r\n        <div class=\"content\">\r\n            <form>\r\n                @if (showCheckbox && !item.disabled && !item.frozen) {\r\n                    <input\r\n                        type=\"checkbox\"\r\n                        name=\"checkbox\"\r\n                        [(ngModel)]=\"selected\"\r\n                        (ngModelChange)=\"onSelectedChange($event)\"\r\n                        (click)=\"$event.stopPropagation()\"\r\n                    />\r\n                }\r\n            </form>\r\n            <ng-container *ngTemplateOutlet=\"headerTemplate; context: { $implicit: item }\"></ng-container>\r\n        </div>\r\n        @if (item.options && !item.disabled) {\r\n            <button\r\n                class=\"options-button\"\r\n                (click)=\"$event.stopPropagation()\"\r\n                sTieredMenu\r\n                [items]=\"kanbanItemOptions\"\r\n            >\r\n                <i class=\"fas fa-ellipsis-v\"></i>\r\n            </button>\r\n        }\r\n    </div>\r\n    <div class=\"kanban-item__body\">\r\n        <ng-container *ngTemplateOutlet=\"bodyTemplate; context: { $implicit: item }\"></ng-container>\r\n    </div>\r\n    @if (footerTemplate) {\r\n        <div class=\"kanban-item__footer\">\r\n            <ng-container *ngTemplateOutlet=\"footerTemplate; context: { $implicit: item }\"></ng-container>\r\n        </div>\r\n    }\r\n</div>\r\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: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: 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', standalone: true, imports: [NgClass, FormsModule, NgTemplateOutlet, TieredMenuDirective], template: "<div\r\n    class=\"kanban-item\"\r\n    [ngClass]=\"{\r\n        'kanban-item--selected': selected && !item.disabled,\r\n        'kanban-item--disabled': item.disabled,\r\n        'kanban-item--frozen': !item.disabled && item.frozen,\r\n    }\"\r\n>\r\n    <div class=\"kanban-item__header\">\r\n        <div class=\"content\">\r\n            <form>\r\n                @if (showCheckbox && !item.disabled && !item.frozen) {\r\n                    <input\r\n                        type=\"checkbox\"\r\n                        name=\"checkbox\"\r\n                        [(ngModel)]=\"selected\"\r\n                        (ngModelChange)=\"onSelectedChange($event)\"\r\n                        (click)=\"$event.stopPropagation()\"\r\n                    />\r\n                }\r\n            </form>\r\n            <ng-container *ngTemplateOutlet=\"headerTemplate; context: { $implicit: item }\"></ng-container>\r\n        </div>\r\n        @if (item.options && !item.disabled) {\r\n            <button\r\n                class=\"options-button\"\r\n                (click)=\"$event.stopPropagation()\"\r\n                sTieredMenu\r\n                [items]=\"kanbanItemOptions\"\r\n            >\r\n                <i class=\"fas fa-ellipsis-v\"></i>\r\n            </button>\r\n        }\r\n    </div>\r\n    <div class=\"kanban-item__body\">\r\n        <ng-container *ngTemplateOutlet=\"bodyTemplate; context: { $implicit: item }\"></ng-container>\r\n    </div>\r\n    @if (footerTemplate) {\r\n        <div class=\"kanban-item__footer\">\r\n            <ng-container *ngTemplateOutlet=\"footerTemplate; context: { $implicit: item }\"></ng-container>\r\n        </div>\r\n    }\r\n</div>\r\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, 