/**
 * This file is part of the MedSafe application which is commercial software created by MedVision360 B.V.
 * The source code is proprietary and confidential.
 *
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 *
 * Copyright (c) by MedVision360 B.V. All rights reserved.
 *
 * For the application name: io.medrecord.medsafe
 */
import { __decorate } from "tslib";
import { Component, Input } from '@angular/core';
import { generateModifierKeyFactory } from '../../utils/style-modifier.util';
import { DropdownBodyDirection } from '../../models';
var DropdownBodyComponent = /** @class */ (function () {
    function DropdownBodyComponent() {
        this.isOpened = false;
        this.buttonModifierPrefix = 'dropdown-body';
        this.generateModifierKey = generateModifierKeyFactory(this.buttonModifierPrefix);
        this.defaultOptions = {
            direction: DropdownBodyDirection.right
        };
        this.preparedOptions = this.defaultOptions;
    }
    Object.defineProperty(DropdownBodyComponent.prototype, "options", {
        set: function (options) {
            this.preparedOptions = Object.assign({}, this.defaultOptions, options);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DropdownBodyComponent.prototype, "modifiers", {
        get: function () {
            var _a;
            return _a = {},
                _a[this.generateModifierKey(this.preparedOptions.direction)] = true,
                _a;
        },
        enumerable: true,
        configurable: true
    });
    DropdownBodyComponent.prototype.open = function () {
        this.isOpened = true;
    };
    DropdownBodyComponent.prototype.close = function () {
        this.isOpened = false;
    };
    DropdownBodyComponent.prototype.toggle = function () {
        this.isOpened = !this.isOpened;
    };
    DropdownBodyComponent.prototype.onItemClick = function (item) {
        this.close();
        if (item.click) {
            item.click();
        }
    };
    __decorate([
        Input()
    ], DropdownBodyComponent.prototype, "itemsConfig", void 0);
    __decorate([
        Input()
    ], DropdownBodyComponent.prototype, "width", void 0);
    __decorate([
        Input()
    ], DropdownBodyComponent.prototype, "defaultItemHeight", void 0);
    __decorate([
        Input()
    ], DropdownBodyComponent.prototype, "options", null);
    DropdownBodyComponent = __decorate([
        Component({
            selector: 'app-dropdown-body',
            template: "<div class=\"dropdown-body\"\n     [ngClass]=\"modifiers\"\n     [style.width.px]=\"width\" *ngIf=\"isOpened\">\n  <div class=\"item\" *ngFor=\"let item of itemsConfig\">\n\n    <ng-container *ngIf=\"item.templateRef; else body\"\n                  [ngTemplateOutlet]=\"item.templateRef\"\n                  [ngTemplateOutletContext]=\"item.templateContext\">\n    </ng-container>\n\n    <ng-template #body>\n      <div (click)=\"onItemClick(item)\" class=\"item__default\" [style.height.px]=\"defaultItemHeight\">\n        <app-icon [icon]=\"item.icon\" type=\"primary\"></app-icon>\n        <div class=\"label\">{{item?.label}}</div>\n      </div>\n    </ng-template>\n  </div>\n</div>\n",
            styles: ["/*!\n * This file is part of the MedSafe application which is commercial software created by MedVision360 B.V.\n *  The source code is proprietary and confidential.\n *\n *  Unauthorized copying of this file, via any medium is strictly prohibited.\n *\n *  Copyright (c) by MedVision360 B.V. All rights reserved.\n *\n *  For the application name: io.medrecord.medsafe\n */.dropdown-body{position:absolute;z-index:10000;width:100%;background:var(--white-color);border:1px solid var(--geyser-color);box-shadow:0 2px 2px rgba(67,72,73,.25);border-radius:5px;margin-top:2px}.dropdown-body .item__default{display:flex;align-items:center;height:52px;overflow:hidden;cursor:pointer;border-bottom:1px solid var(--mystic-color);margin:0 14px}.dropdown-body .item__default .label{font-style:normal;font-weight:500;font-size:13px;line-height:19px;color:var(--secondary-color);margin-left:8px}.dropdown-body .item__default .label.color-gray{color:var(--hit-gray-color)}.dropdown-body .item__default .label.color-orange{color:var(--warning-color)}.dropdown-body .item__default .label.color-green{color:var(--success-color)}.dropdown-body .item:hover{background-color:var(--athens-hover-color)}.dropdown-body_direction-right{left:0}.dropdown-body_direction-left{right:0}"]
        })
    ], DropdownBodyComponent);
    return DropdownBodyComponent;
}());
export { DropdownBodyComponent };
//# sourceMappingURL=data:application/json;base64, 