@tarojs/components
Version:
1 lines • 3.6 kB
JavaScript
System.register(["./p-88de70df.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.handleClick=function(e){e.stopPropagation();if(r.disabled)return;if(!r.checked)r.checked=true};this.name=undefined;this.value="";this.id=undefined;this.checked=false;this.disabled=false;this.nativeProps={};this.isWillLoadCalled=false}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,c=t.disabled,u=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:c,onChange:function(e){return e.stopPropagation()}},u)),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 c=undefined&&undefined.__classPrivateFieldSet||function(e,t,i,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(e,i):n?n.value=i:t.set(e,i),i};var u=undefined&&undefined.__classPrivateFieldGet||function(e,t,i,r){if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?r:i==="a"?r.call(e):r?r.value:t.get(e)};var s;var l=e("taro_radio_group_core",function(){function e(e){t(this,e);this.onChange=i(this,"change",7);this.uniqueName=Date.now().toString(36);s.set(this,void 0);this.name=undefined}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}}));c(this,s,e.detail.value,"f");this.onChange.emit({value:u(this,s,"f")})}};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(!u(e,s,"f")){var t=e.el.querySelectorAll("taro-radio-core");c(e,s,e.getValues(t),"f")}return u(e,s,"f")},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}());s=new WeakMap}}}));