
'use strict';require('earlgrey-runtime/6');let $targ$0;let $targ$1;let $targ$2;let $targ$6;let path$0;let dom$0;let jq$0;let elements$0;let BucheElement$0;let BucheTable$0;let buche__minus__install$0;if((typeof(document)==="undefined")){$targ$0=undefined;(global["document"]=$targ$0);(void 0);}if((typeof(HTMLElement)==="undefined")){$targ$1=undefined;(global["HTMLElement"]=$targ$1);(void 0);}if((typeof(customElements)==="undefined")){$targ$2=undefined;(global["custom-elements"]=$targ$2);(void 0);}path$0=require("path");dom$0=require("earlgrey-runtime/std/dom");jq$0=require("jquery");elements$0=require("../../elements");BucheElement$0=getProperty(elements$0,"BucheElement","elements");BucheTable$0=(class BucheTable extends BucheElement$0{ setup(config$0,children$0){let $targ$3;let $targ$4;let dis$0;let src$0;let __at___$0;let self$0;__at___$0=this;self$0=this;$targ$3=dom$0(ENode(["table"],({}),[]));(__at___$0["table"]=$targ$3);__at___$0._appendChild(__at___$0.table);$targ$4=(config$0.columns||null);(__at___$0["columns"]=$targ$4);dis$0=__at___$0.bucheDispatcher();src$0=config$0["data-source"];return dis$0.doc.getChannel(src$0).then((function(element$0){return __at___$0.hookOnDataSource(element$0);}));} hookOnDataSource(element$1){let __at___$1;let self$1;__at___$1=this;self$1=this;element$1.on_columns((function(cols$0){let $targ$5;$targ$5=cols$0;(__at___$1["columnInfo"]=$targ$5);(__at___$1["columns"]=(__at___$1.columns||keys(cols$0)));return __at___$1.addHeader();}));return element$1.on_row((function(row$0){return __at___$1.addRow(row$0);}));} addHeader(){let m$0;let acc$0;let temp$0;let __at___$2;let self$2;__at___$2=this;self$2=this;return __at___$2.table.appendChild(dom$0(ENode(["tr"],({}),((acc$0=[]),(temp$0=null),(m$0=null),(function(){$0:for(m$0 of __at___$2.columns){let col$0;let colname$0;colname$0=m$0;col$0=send(send(__at___$2,"columnInfo", true),colname$0);temp$0=ENode(["th"],({"class":ENode([],({}),["column-type-",col$0.type," column-name-",colname$0])}),colname$0);acc$0.push(temp$0);}})(),acc$0))));} addRow(row$1){let m$1;let acc$1;let temp$1;let __at___$3;let self$3;__at___$3=this;self$3=this;return __at___$3.table.appendChild(dom$0(ENode(["tr"],({}),((acc$1=[]),(temp$1=null),(m$1=null),(function(){$1:for(m$1 of __at___$3.columns){let col$1;let colname$1;colname$1=m$1;col$1=send(send(__at___$3,"columnInfo", true),colname$1);temp$1=ENode(["td"],({"class":ENode([],({}),["column-type-",col$1.type," column-name-",colname$1])}),send(row$1,colname$1));acc$1.push(temp$1);}})(),acc$1))));}});buche__minus__install$0=(function bucheInstall(){customElements.define("buche-table",BucheTable$0);return document.head.appendChild(dom$0(ENode(["link"],({"type":"text/css","rel":"stylesheet","href":path$0.join(__dirname,"style.css")}),[])));});$targ$6=buche__minus__install$0;(exports["bucheInstall"]=$targ$6);(void 0);
//# sourceMappingURL=index.js.map

