phantasmal-world/6.4173c52cb2f49ac1ff21.js

1 line
11 KiB
JavaScript
Raw Normal View History

2020-01-07 06:37:38 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{"0Xme":function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var s=i("sDu+"),n=i("jJhE"),o=(i("x1yY"),i("4VsB")),l=i("FXpb");class r extends s.a{constructor(e,t,i,s,n){super(n),this.element=Object(l.s)({className:`${t} core_Input`}),this._value=new o.a(this,e,this.set_value),this.value=this._value,this.input_element=Object(l.m)({className:`${s} core_Input_inner`}),this.input_element.type=i,this.input_element.addEventListener("change",()=>{this._value.set_val(this.get_value(),{silent:!1})}),n&&n.readonly&&this.set_attr("readOnly",!0),this.element.append(this.input_element)}set_enabled(e){super.set_enabled(e),this.input_element.disabled=!e}set_attr(e,t,i){if(null==t)return;const s=this.input_element,o=i||(e=>e);Object(n.a)(t)?(s[e]=o(t.val),this.disposable(t.observe(({value:t})=>s[e]=o(t)))):s[e]=o(t)}}},FNQV:function(e,t,i){"use strict";i.r(t);var s=i("FXpb"),n=(i("XfQH"),i("KVVN")),o=i("Tpfs"),l=i("PE7g"),r=i("sDu+"),a=(i("rlVZ"),i("x1yY"),i("LSoc")),c=i("4VsB");class u extends r.a{constructor(e){super(e),this.element=Object(s.s)({className:"core_ComboBox core_Input"}),this.preferred_label_position="left",this.input_element=Object(s.m)(),this.to_label=e.to_label,this._selected=new c.a(this,void 0,this.set_selected),this.selected=this._selected,this.menu=this.disposable(new a.a({items:e.items,to_label:e.to_label,related_element:this.element})),this.menu.element.onmousedown=e=>e.preventDefault(),this.input_element.placeholder=e.placeholder_text||"",this.input_element.onmousedown=()=>{this.menu.visible.set_val(!0,{silent:!1})},this.input_element.onkeydown=e=>{switch(e.key){case"ArrowDown":e.preventDefault(),this.menu.hover_next();break;case"ArrowUp":e.preventDefault(),this.menu.hover_prev();break;case"Enter":this.menu.select_hovered()}};const t=e.filter;if(t){let e="";this.input_element.onkeyup=()=>{this.input_element.value!==e&&(e=this.input_element.value,t(e),(this.menu.visible.val||e)&&this.menu.hover_next())}}this.input_element.onblur=()=>{this.menu.visible.set_val(!1,{silent:!1})};const i=Object(s.k)(s.a.TriangleDown),n=Object(s.k)(s.a.TriangleUp),o=Object(s.s)({className:"core_ComboBox_button"},i,n);o.onmousedown=e=>{e.preventDefault(),this.menu.visible.set_val(!this.menu.visible.val,{silent:!1})},this.element.append(Object(s.s)({className:"core_ComboBox_inner core_Input_inner"},this.input_element,o),this.menu.element),this.disposables(this.menu.visible.observe(({value:e})=>{e&&this.menu.hover_next()}),this.menu.selected.observe(({value:e})=>{this.selected.set_val(e,{silent:!1}),this.input_element.focus()}),Object(s.c)(n,"hidden",this.menu.visible.map(e=>!e)),Object(s.c)(i,"hidden",this.menu.visible)),this.finalize_construction()}set_selected(e){this.input_element.value=e?this.to_label(e):"",this.menu.selected.val=e}}var h=i("ouMO"),d=i("rwco"),_=i("6Fug"),m=function(e,t,i,s){return new(i||(i=Promise))((function(n,o){function l(e){try{a(s.next(e))}catch(e){o(e)}}function r(e){try{a(s.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(l,r)}a((s=s.apply(e,t||[])).next())}))};const p=d.a.get("hunt_optimizer/gui/WantedItemsView");class b extends _.a{constructor(e){super(),this.hunt_optimizer_stores=e,this.tbody_element=Object(s.u)(),this.store_disposer=this.disposable(new o.a),this.element=Object(s.h)({className:"hunt_optimizer_WantedItemsView"}),this.create_row=e=>{const t=new o.a,i=t.add(new l.a(e.amount.val,{min:0,step:1}));t.add_all(i.value.bind_to(e.amount),i.value.observe(({value:t})=>e.set_amount(t)));const r=t.add(new n.a({icon_left:s.a.Remove}));return t.add(r.onclick.observe(()=>m(this,void 0,void 0,(function*(){return(yield this.hunt_optimizer_stores.current.val).remove_wanted_item(e)})))),[Object(s.A)(Object(s.v)(i.element),Object(s.v)(e.item_type.name),Object(s.v)(r.element)),t]};const t=Object(h.c)(),i=Object(h.c)(),r=this.add(new u({items:i,to_label:e=>e.name,placeholder_text:"Add an item",filter(e){const s=e.toLowerCase();i.val=t.val.filter(e=>e.name.toLowerCase().incl