import { r as registerInstance, j as createEvent, h, g as getElement } from './index-07845439.js';
import { i as isDefined } from './model-fad5c7ae.js';
import { d as dist } from './index-63517df5.js';
import './index-b6cf748e.js';
import './_commonjsHelpers-8fe71198.js';
import './index-e20749b7.js';
import './index-265fba1f.js';

const sv = {
  Loading: "Laddar",
  "from server...": "från servern...",
  "There are no": "Det finns inga",
  "to display.": "att visa.",
};

function create(language) {
  return dist.create({
    sv,
  }, language);
}

const styleCss = ".sc-ig-table-h{display:block;width:100%;max-width:90em;margin:auto;border:1px solid rgb(var(--smoothly-medium-color))}[hidden].sc-ig-table-h{display:none}.sc-ig-table-h>p.sc-ig-table{padding-left:1em}.sc-ig-table-h>table.sc-ig-table{width:100%;table-layout:fixed}.sc-ig-table-h>table.sc-ig-table>thead.sc-ig-table>tr.sc-ig-table{display:table-row;font-weight:bold;height:2em}.sc-ig-table-h>table.sc-ig-table>thead.sc-ig-table>tr.sc-ig-table>th.sc-ig-table{text-transform:capitalize}.sc-ig-table-h>table.sc-ig-table>thead.sc-ig-table>tr.sc-ig-table>*.sc-ig-table{display:table-cell;padding-right:.5em;padding-left:.3em;vertical-align:middle;position:-webkit-sticky;position:sticky;top:1.55cm;z-index:1;text-align:left}.sc-ig-table-h>table.sc-ig-table>thead.sc-ig-table>tr.sc-ig-table>th.right.sc-ig-table{text-align:right;padding-right:5.3em}.sc-ig-table-h>table.sc-ig-table>td.sc-ig-table{text-align:center}th.checkbox.sc-ig-table{width:2em}";

const IntergiroTable = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.selectedChanged = createEvent(this, "selectedChanged", 7);
    this.selectable = false;
    this.selected = {};
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  handleToggle(event) {
    const selected = this.selected;
    if (event.detail.checked)
      selected[event.detail.id] = event.detail.value;
    else
      delete selected[event.detail.id];
    this.selectedChanged.emit((this.selected = selected));
  }
  onChecked(event) {
    this.selectedChanged.emit(event.detail.selected ? { allSelected: true } : {});
  }
  render() {
    const t = this.t;
    return [
      !this.value ? (h("p", null, t("Loading") + " " + this.name + " " + t("from server..."))) : this.value.length > 0 ? ([
        h("table", null, h("thead", null, h("tr", null, this.selectable && (h("th", { class: "checkbox", color: "light" }, h("smoothly-checkbox", { "select-all": true }))), this.header.filter(isDefined).map(v => (h("th", { class: v.align == "right" ? "right" : "", color: "light" }, v.name))))), h("slot", null)),
      ]) : (h("p", null, t("There are no") + " " + this.name + " " + t("to display."))),
    ];
  }
  get element() { return getElement(this); }
};
IntergiroTable.style = styleCss;

export { IntergiroTable as ig_table };
