{"version":3,"sources":["https://lively-kernel.org/lively4/lively4-leo/src/components/widgets/input-combobox.js"],"names":["Morph","InputCombobox","initialize","lively","html","registerAttributeObservers","get","addEventListener","evt","setAttribute","value","dispatchEvent","Event","getAttribute","s","updateView","onValueChanged","newValue","setOptions","list","optionsElement","innerHTML","ea","appendChild","livelyExample"],"mappings":";;;;;;;;;;;;AAAOA,W;;;;;;;;;;;AAAAA,gD;;;;;;;;;AAEP;;;;;;AAMe,YAAMC,aAAN,SAA4BD,KAA5B,CAAkC;;AAE/CE,qBAAa;AACXC,iBAAOC,IAAP,CAAYC,0BAAZ,CAAuC,IAAvC;;AAEA,eAAKC,GAAL,CAAS,QAAT,EAAmBC,gBAAnB,CAAoC,QAApC,EAA8CC,OAAO;AACnD,iBAAKC,YAAL,CAAkB,OAAlB,EAA4B,KAAKH,GAAL,CAAS,QAAT,EAAmBI,KAA/C;AACA,iBAAKC,aAAL,CAAmB,IAAIC,KAAJ,CAAU,QAAV,CAAnB;AACD,WAHD;AAID;;AAED,YAAIF,KAAJ,GAAY;AACV,iBAAO,KAAKG,YAAL,CAAkB,OAAlB,CAAP;AACD;;AAED,YAAIH,KAAJ,CAAUI,CAAV,EAAa;AACX,eAAKL,YAAL,CAAkB,OAAlB,EAA2BK,CAA3B;AACA,eAAKC,UAAL;AACD;;AAEDC,yBAAiB;AACf,eAAKD,UAAL;AACD;;AAEDA,qBAAa;AACX,cAAIE,WAAW,KAAKJ,YAAL,CAAkB,OAAlB,CAAf;AACA,cAAI,KAAKP,GAAL,CAAS,QAAT,EAAmBI,KAAnB,IAA4BO,QAAhC,EAA0C;AACxC,iBAAKX,GAAL,CAAS,QAAT,EAAmBI,KAAnB,GAA2BO,QAA3B;AACD;AACF;;AAEDC,mBAAWC,IAAX,EAAiB;AACf,cAAIC,iBAAiB,KAAKd,GAAL,CAAS,UAAT,CAArB;AACAc,yBAAeC,SAAf,GAA2B,EAA3B;AACA,eAAI,IAAIC,EAAR,IAAcH,IAAd,EAAoB;AAClBC,2BAAeG,WAAf,8DAAoCD,EAApC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACD;AACF;;AAGD,cAAME,aAAN,GAAsB;AACpB,eAAKN,UAAL,CAAgB,CAAC,OAAD,EAAU,SAAV,EAAqB,SAArB,CAAhB;AAGD;;AA5C8C;;yBAA5BjB,a;;;;;;;;6BAAAA,8C","file":"input-combobox.js","sourcesContent":["import Morph from 'src/components/widgets/lively-morph.js';\n\n/*MD \n## Combobox Widget\n  <edit://test/templates/input-combobox-test.js>\n\nMD*/\n\nexport default class InputCombobox extends Morph {\n  \n  initialize() { \n    lively.html.registerAttributeObservers(this)  \n    \n    this.get(\"#input\").addEventListener(\"change\", evt => {\n      this.setAttribute(\"value\",  this.get(\"#input\").value )  \n      this.dispatchEvent(new Event(\"change\"))\n    })\n  }\n\n  get value() {\n    return this.getAttribute(\"value\")\n  }\n  \n  set value(s) {\n    this.setAttribute(\"value\", s)\n    this.updateView()  \n  }\n  \n  onValueChanged() {\n    this.updateView()  \n  }\n\n  updateView() {\n    var newValue = this.getAttribute(\"value\")  \n    if (this.get(\"#input\").value != newValue) {\n      this.get(\"#input\").value = newValue\n    }\n  }\n  \n  setOptions(list) {\n    var optionsElement = this.get(\"#options\")\n    optionsElement.innerHTML = \"\"\n    for(var ea of list) {\n      optionsElement.appendChild(<option>{ea}</option>)\n    }\n  }\n  \n  \n  async livelyExample() {\n    this.setOptions([\"Apple\", \"Babanna\", \"Oranges\"])\n    \n    \n  }\n  \n  \n}"]}