/*
 * Copyright 2015-2024 Ritense BV, the Netherlands.
 *
 * Licensed under EUPL, Version 1.2 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { Component, Input } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@ngx-translate/core";
export class TimelineComponent {
    getSupportedActions(item, actions) {
        return (actions?.filter(action => {
            const actionId = action?.id;
            const itemSupportedActions = Array.isArray(item.supportedActionIds);
            if (actionId && itemSupportedActions) {
                return item.supportedActionIds.includes(actionId);
            }
            return true;
        }) || []);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TimelineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: TimelineComponent, selector: "valtimo-timeline", inputs: { items: "items", actions: "actions" }, ngImport: i0, template: "<!--\n  ~ Copyright 2015-2024 Ritense BV, the Netherlands.\n  ~\n  ~ Licensed under EUPL, Version 1.2 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" basis,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div id=\"no-results\" class=\"p-5\" *ngIf=\"items?.length === 0\"></div>\n\n<div class=\"pb-5\" *ngIf=\"items?.length > 0\">\n  <ul class=\"timeline mb-0 py-5\">\n    <li class=\"timeline-item status-done\" *ngFor=\"let item of items\">\n      <div class=\"timeline-date\">\n        <span>{{ item.date }}</span>\n\n        <br />\n\n        <span>{{ item.time }}</span>\n      </div>\n\n      <div\n        class=\"timeline-content mt-1\"\n        *ngIf=\"{supportedActions: getSupportedActions(item, actions)} as vars\"\n      >\n        <div class=\"timeline-header p-0\">\n          <span class=\"timeline-author\">{{ item.user }}</span>\n\n          <div class=\"dropdown actions-dropdown\" *ngIf=\"vars.supportedActions?.length > 0\">\n            <a\n              class=\"dropdown-toggle d-block\"\n              id=\"dropdownMenu\"\n              data-toggle=\"dropdown\"\n              aria-haspopup=\"true\"\n              aria-expanded=\"false\"\n            >\n              <i class=\"action-icon icon mdi mdi-dots-vertical\"></i>\n            </a>\n\n            <div class=\"dropdown-menu\" aria-labelledby=\"dropdownMenu\">\n              <a\n                *ngFor=\"let action of vars.supportedActions\"\n                (click)=\"action.callback(item, $event)\"\n                class=\"dropdown-item p-2\"\n              >\n                <ng-container *ngIf=\"action.icon !== null\">\n                  <i class=\"icon mdi\" [ngClass]=\"action.icon\"></i>\n                </ng-container>\n\n                {{ action?.label || '-' }}\n              </a>\n            </div>\n          </div>\n\n          <br />\n\n          <p class=\"timeline-activity\">{{ item.activity }}</p>\n\n          <div class=\"timeline-summary\">\n            <p>\n              {{ item.summaryTranslationKey | translate: item.summaryTranslationParams }}\n            </p>\n          </div>\n        </div>\n      </div>\n    </li>\n  </ul>\n</div>\n", styles: [".timeline-activity{font-size:100%}.timeline-summary p{font-size:.8rem;white-space:pre-line}.actions-dropdown{position:absolute;top:12px;right:12px;cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TimelineComponent, decorators: [{
            type: Component,
            args: [{ selector: 'valtimo-timeline', template: "<!--\n  ~ Copyright 2015-2024 Ritense BV, the Netherlands.\n  ~\n  ~ Licensed under EUPL, Version 1.2 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" basis,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div id=\"no-results\" class=\"p-5\" *ngIf=\"items?.length === 0\"></div>\n\n<div class=\"pb-5\" *ngIf=\"items?.length > 0\">\n  <ul class=\"timeline mb-0 py-5\">\n    <li class=\"timeline-item status-done\" *ngFor=\"let item of items\">\n      <div class=\"timeline-date\">\n        <span>{{ item.date }}</span>\n\n        <br />\n\n        <span>{{ item.time }}</span>\n      </div>\n\n      <div\n        class=\"timeline-content mt-1\"\n        *ngIf=\"{supportedActions: getSupportedActions(item, actions)} as vars\"\n      >\n        <div class=\"timeline-header p-0\">\n          <span class=\"timeline-author\">{{ item.user }}</span>\n\n          <div class=\"dropdown actions-dropdown\" *ngIf=\"vars.supportedActions?.length > 0\">\n            <a\n              class=\"dropdown-toggle d-block\"\n              id=\"dropdownMenu\"\n              data-toggle=\"dropdown\"\n              aria-haspopup=\"true\"\n              aria-expanded=\"false\"\n            >\n              <i class=\"action-icon icon mdi mdi-dots-vertical\"></i>\n            </a>\n\n            <div class=\"dropdown-menu\" aria-labelledby=\"dropdownMenu\">\n              <a\n                *ngFor=\"let action of vars.supportedActions\"\n                (click)=\"action.callback(item, $event)\"\n                class=\"dropdown-item p-2\"\n              >\n                <ng-container *ngIf=\"action.icon !== null\">\n                  <i class=\"icon mdi\" [ngClass]=\"action.icon\"></i>\n                </ng-container>\n\n                {{ action?.label || '-' }}\n              </a>\n            </div>\n          </div>\n\n          <br />\n\n          <p class=\"timeline-activity\">{{ item.activity }}</p>\n\n          <div class=\"timeline-summary\">\n            <p>\n              {{ item.summaryTranslationKey | translate: item.summaryTranslationParams }}\n            </p>\n          </div>\n        </div>\n      </div>\n    </li>\n  </ul>\n</div>\n", styles: [".timeline-activity{font-size:100%}.timeline-summary p{font-size:.8rem;white-space:pre-line}.actions-dropdown{position:absolute;top:12px;right:12px;cursor:pointer}\n"] }]
        }], propDecorators: { items: [{
                type: Input
            }], actions: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 