import { r as registerInstance, e as createEvent, h } from './index-ee578edf.js';
import { S as StateOfReminder } from './utils-cc62d8e2.js';

const synbeeOptionsMenuCss = ":host{display:inline-flex;position:relative}.options-container{z-index:2;position:absolute;display:flex;flex-direction:column;width:150px;height:200px;background-color:white;border-radius:10px;box-shadow:0 1px 3px rgba(0, 0, 0, 0.15);margin-top:1rem;pointer-events:none;top:4px;right:4px}.hidden{display:none}.options{cursor:pointer;padding-bottom:12px;padding-right:15px;padding-left:15px}.title-option{border-radius:10px 10px 0 0;padding:20px;font-size:16px;color:#4c4c4c;font-weight:bold;align-items:center;min-height:20px;background-color:white;box-shadow:0 1px 3px rgba(0, 0, 0, 0.15)}.options-label{font-size:14px;color:#4c4c4c;font-weight:bold;cursor:pointer;height:auto;padding-left:20px}tr:hover{background-color:#F0F3F9}table{cursor:pointer;pointer-events:auto;background-color:#F7F9FC;height:auto;min-height:50px;margin-bottom:30px}.table-view{cursor:pointer;pointer-events:auto;background-color:#F7F9FC;height:auto;min-height:90px;margin-bottom:30px}tr{margin-bottom:20px}td{padding-left:10px}";

const SynbeeOptionsMenu = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.changeStatusEmitter = createEvent(this, "changeStatusEmitter", 7);
    this.optionsInputUpdate = ['Modifica', 'Cancella'];
    this.optionInputCreate = ['Cancella'];
    this.menuIsOpen = false;
    this.menuOpened = false;
  }
  //ngOnChange()
  switchMenuIsOpen(newValue) {
    this.menuIsOpen = newValue;
  }
  componentShouldUpdate() {
    this.status = this.state;
  }
  onRowClicked(str) {
    if (str === 'Modifica') {
      this.menuOpened = false;
      this.changeStatusEmitter.emit('edit');
    }
    else {
      console.log('cancellato');
      this.changeStatusEmitter.emit('delete');
    }
  }
  render() {
    if (this.status === StateOfReminder.create) {
      return (h("div", { class: "options" }, h("svg", { width: "4", height: "16", viewBox: "0 0 4 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M2 4C3.1 4 4 3.1 4 2C4 0.9 3.1 0 2 0C0.9 0 0 0.9 0 2C0 3.1 0.9 4 2 4ZM2 6C0.9 6 0 6.9 0 8C0 9.1 0.9 10 2 10C3.1 10 4 9.1 4 8C4 6.9 3.1 6 2 6ZM2 12C0.9 12 0 12.9 0 14C0 15.1 0.9 16 2 16C3.1 16 4 15.1 4 14C4 12.9 3.1 12 2 12Z", fill: "#8C8C8C" })), h("div", { class: { 'options-container': true, 'hidden': !this.menuIsOpen } }, h("div", { class: "title-option" }, "Opzioni"), h("table", null, this.optionInputCreate.map(s => (h("tr", { class: "options-label", onClick: () => this.onRowClicked(s) }, h("td", null, s))))))));
    }
    else if (this.status === StateOfReminder.view) {
      return (h("div", { class: "options" }, h("svg", { width: "4", height: "16", viewBox: "0 0 4 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M2 4C3.1 4 4 3.1 4 2C4 0.9 3.1 0 2 0C0.9 0 0 0.9 0 2C0 3.1 0.9 4 2 4ZM2 6C0.9 6 0 6.9 0 8C0 9.1 0.9 10 2 10C3.1 10 4 9.1 4 8C4 6.9 3.1 6 2 6ZM2 12C0.9 12 0 12.9 0 14C0 15.1 0.9 16 2 16C3.1 16 4 15.1 4 14C4 12.9 3.1 12 2 12Z", fill: "#8C8C8C" })), h("div", { class: { 'options-container': true, 'hidden': !this.menuIsOpen } }, h("div", { class: "title-option" }, "Opzioni"), h("table", { class: "table-view" }, this.optionsInputUpdate.map(s => (h("tr", { class: "options-label", onClick: () => this.onRowClicked(s) }, h("td", null, s))))))));
    }
    else {
      return (h("div", { class: "options" }, h("svg", { width: "4", height: "16", viewBox: "0 0 4 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M2 4C3.1 4 4 3.1 4 2C4 0.9 3.1 0 2 0C0.9 0 0 0.9 0 2C0 3.1 0.9 4 2 4ZM2 6C0.9 6 0 6.9 0 8C0 9.1 0.9 10 2 10C3.1 10 4 9.1 4 8C4 6.9 3.1 6 2 6ZM2 12C0.9 12 0 12.9 0 14C0 15.1 0.9 16 2 16C3.1 16 4 15.1 4 14C4 12.9 3.1 12 2 12Z", fill: "#8C8C8C" })), h("div", { class: { 'options-container': true, 'hidden': !this.menuIsOpen } }, h("div", { class: "title-option" }, "Opzioni"), h("table", null, this.optionInputCreate.map(s => (h("tr", { class: "options-label", onClick: () => this.onRowClicked(s) }, h("td", null, s))))))));
    }
  }
  static get watchers() { return {
    "menuOpened": ["switchMenuIsOpen"]
  }; }
};
SynbeeOptionsMenu.style = synbeeOptionsMenuCss;

export { SynbeeOptionsMenu as synbee_options_menu };
