'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index$1 = require('./index-df541290.js');
const model = require('./model-88c24d18.js');
const index = require('./index-b7493032.js');
require('./index-0b6f1dd9.js');
require('./_commonjsHelpers-10109b76.js');
require('./index-c12b8888.js');
require('./index-fe328b96.js');

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

function create(language) {
  return index.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) {
    index$1.registerInstance(this, hostRef);
    this.selectedChanged = index$1.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 ? (index$1.h("p", null, t("Loading") + " " + this.name + " " + t("from server..."))) : this.value.length > 0 ? ([
        index$1.h("table", null, index$1.h("thead", null, index$1.h("tr", null, this.selectable && (index$1.h("th", { class: "checkbox", color: "light" }, index$1.h("smoothly-checkbox", { "select-all": true }))), this.header.filter(model.isDefined).map(v => (index$1.h("th", { class: v.align == "right" ? "right" : "", color: "light" }, v.name))))), index$1.h("slot", null)),
      ]) : (index$1.h("p", null, t("There are no") + " " + this.name + " " + t("to display."))),
    ];
  }
  get element() { return index$1.getElement(this); }
};
IntergiroTable.style = styleCss;

exports.ig_table = IntergiroTable;
