UNPKG

2.7 kBJavaScriptView Raw
1System.register(["./p-b2d01686.system.js"],(function(e){"use strict";var t,i,r,n,o;return{setters:[function(e){t=e.r;i=e.c;r=e.h;n=e.H;o=e.g}],execute:function(){var a=e("taro_radio_core",function(){function e(e){var r=this;t(this,e);this.onChange=i(this,"radiochange",7);this.value="";this.checked=false;this.disabled=false;this.nativeProps={};this.isWillLoadCalled=false;this.handleClick=function(){if(r.disabled)return;if(!r.checked)r.checked=true}}e.prototype.watchChecked=function(e){if(!this.isWillLoadCalled)return;e&&this.onChange.emit({value:this.value})};e.prototype.watchId=function(e){if(!this.isWillLoadCalled)return;if(e)this.inputEl.setAttribute("id",e)};e.prototype.componentDidRender=function(){this.id&&this.el.removeAttribute("id")};e.prototype.componentWillLoad=function(){this.isWillLoadCalled=true};e.prototype.render=function(){var e=this;var t=this,i=t.checked,o=t.name,a=t.value,u=t.disabled,c=t.nativeProps;return r(n,{className:"weui-cells_checkbox",onClick:this.handleClick},r("input",Object.assign({ref:function(t){if(!t)return;e.inputEl=t;if(e.id)t.setAttribute("id",e.id)},type:"radio",name:o,value:a,class:"weui-check",checked:i,disabled:u,onChange:function(e){return e.stopPropagation()}},c)),r("i",{class:"weui-icon-checked"}),r("slot",null))};Object.defineProperty(e.prototype,"el",{get:function(){return o(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{checked:["watchChecked"],id:["watchId"]}},enumerable:false,configurable:true});return e}());var u=e("taro_radio_group_core",function(){function e(e){t(this,e);this.onChange=i(this,"change",7);this.uniqueName=Date.now().toString(36)}e.prototype.function=function(e){e.stopPropagation();if(e.target.tagName!=="TARO-RADIO-CORE")return;var t=e.target;if(t.checked){var i=this.el.querySelectorAll("taro-radio-core");i.forEach((function(e){if(e!==t){e.checked=false}}));this.value=e.detail.value;this.onChange.emit({value:this.value})}};e.prototype.componentDidLoad=function(){var e=this;var t=this.el.querySelectorAll("taro-radio-core");t.forEach((function(t){t.setAttribute("name",e.name||e.uniqueName)}));Object.defineProperty(this.el,"value",{get:function(){if(!e.value){var t=e.el.querySelectorAll("taro-radio-core");e.value=e.getValues(t)}return e.value},configurable:true})};e.prototype.getValues=function(e){var t="";Array.from(e).forEach((function(e){var i=e.querySelector("input");if(i===null||i===void 0?void 0:i.checked){t=i.value||""}}));return t};e.prototype.render=function(){return r(n,{class:"weui-cells_radiogroup"})};Object.defineProperty(e.prototype,"el",{get:function(){return o(this)},enumerable:false,configurable:true});return e}())}}}));
\No newline at end of file