@makeform/radio 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Logs
2
2
 
3
+ ## v2.0.2
4
+
5
+ - fix bug: when using label / value pairs, value instead of label is shown in view mode
6
+
7
+
3
8
  ## v2.0.1
4
9
 
5
10
  - fix bug: content in view mode isn't translated
package/index.html CHANGED
@@ -1 +1 @@
1
- <div><script type="@plotdb/block">var mod;module.exports={pkg:{name:"@makeform/radio",extend:{name:"@makeform/common"},i18n:{en:{"其它":"Other"},"zh-TW":{"其它":"其它"}}},init:function(e){return e.pubsub.fire("subinit",{mod:mod(e)})}};mod=function(e){var t,n,r,o,a,i,l,d,c;t=e.root,n=e.ctx,r=e.data,o=e.parent,a=e.t,i=e.i18n;l=n.ldview;d={};c="_"+Math.random().toString(36).substring(2);return{init:function(){var r,o,n,i,e,u=this;this.on("change",function(){return u.mod.child.view.render("option")});r=function(e){if(typeof e==="object"){return e.value}else{return e}};o=function(e){if(typeof e==="object"){return a(e.label)}else{return a(e)}};n=function(t){var e;e=(d.values||[]).filter(function(e){return r(e)===t})[0];e=e&&e.label?e.label:e;return e?a(e):typeof t==="string"?a(t):t};i=function(e){return in$(e,(u.mod.info.config.values||[]).map(function(e){return r(e)}))};return this.mod.child.view=e=new l({root:t,text:{content:function(e){var t;t=e.node;if(u.isEmpty()){return"n/a"}else{return n(u.content())}},"other-prompt":function(e){var t,n,r;t=e.node;if(n=((r=u.mod.info.config).other||(r.other={})).prompt){return a(n)}else{return a("其它")}}},action:{input:{"other-text":function(e){var t;t=e.node;return u.value(t.value)}},change:{"other-radio":function(e){var t,n;t=e.node,n=e.ctx;if(i(u.value())||!u.value()){return u.value("")}}}},handler:{input:function(e){var t;t=e.node;return t.classList.toggle("text-danger",u.status()===2)},other:function(e){var t,n;t=e.node;return t.classList.toggle("d-none",!((n=u.mod.info.config).other||(n.other={})).enabled)},"other-radio":function(e){var t;t=e.node;t.setAttribute("name",c);if(!u.mod.info.meta.readonly){t.removeAttribute("disabled")}else{t.setAttribute("disabled",null)}return t.checked=!i(u.value())},"other-text":function(e){var t,n;t=e.node;if(!u.mod.info.meta.readonly){t.removeAttribute("readonly")}else{t.setAttribute("readonly",null)}n=u.value();return t.value=i(n)?"":n!=null?n:""},option:{list:function(){return u.mod.info.config.values||[]},key:function(e){return r(e)},view:{action:{change:{radio:function(e){var t,n;t=e.node,n=e.ctx;if(t.checked){return u.value(r(n))}}}},handler:{"@":function(e){var t;t=e.node;return t.style.flexBasis=(u.mod.info.config||{}).layout==="block"?"100%":""},radio:function(e){var t,n;t=e.node,n=e.ctx;t.setAttribute("name",c);t.checked=u.value()===r(n);if(!u.mod.info.meta.readonly){return t.removeAttribute("disabled")}else{return t.setAttribute("disabled",null)}}},text:{text:function(e){var t,n;t=e.node,n=e.ctx;return o(n)}}}}}})},render:function(){return this.mod.child.view.render()}}};function in$(e,t){var n=-1,r=t.length>>>0;while(++n<r)if(e===t[n])return true;return false}</script><div plug="body"><div class="m-edit" ld="input"><div class="my-2 has-tips manual" ld="error-root"><div class="d-flex g-2 flex-wrap"><label class="mb-0 mr-2 clickable d-flex" ld-each="option" style="line-height:1.25em"><input class="mr-1" ld="radio" type="radio"><span ld="text"></span></label></div><div class="mt-2" ld="other"><label class="clickable d-flex align-items-center"><input class="mr-1" ld="other-radio" type="radio"><div class="mr-2 text-nowrap" ld="other-prompt"></div><input class="form-control form-control-sm" type="text" ld="other-text"></label></div><div class="hover-tip tip-sm"><div ld-each="error"></div></div></div></div><div class="m-view" ld="content"></div></div></div>
1
+ <div><script type="@plotdb/block">var mod;module.exports={pkg:{name:"@makeform/radio",extend:{name:"@makeform/common"},i18n:{en:{"其它":"Other"},"zh-TW":{"其它":"其它"}}},init:function(e){return e.pubsub.fire("subinit",{mod:mod(e)})}};mod=function(e){var a,t,n,r,l,o,d,f,c;a=e.root,t=e.ctx,n=e.data,r=e.parent,l=e.t,o=e.i18n;d=t.ldview;f={};c="_"+Math.random().toString(36).substring(2);return{init:function(){var r,o,n,i,e,t,u=this;this.on("change",function(){return u.mod.child.view.render("option")});r=function(e){if(typeof e==="object"){return e.value}else{return e}};o=function(e){if(typeof e==="object"){return l(e.label)}else{return l(e)}};n=function(t){var e;e=(f.values||[]).filter(function(e){return r(e)===t})[0];e=e&&e.label?e.label:e;return e?l(e):typeof t==="string"?l(t):t};i=function(e){return in$(e,(u.mod.info.config.values||[]).map(function(e){return r(e)}))};e=function(){return f.values=(u.mod.info.config||{}).values||[]};e();this.on("meta",function(){return e()});return this.mod.child.view=t=new d({root:a,text:{content:function(e){var t;t=e.node;if(u.isEmpty()){return"n/a"}else{return n(u.content())}},"other-prompt":function(e){var t,n,r;t=e.node;if(n=((r=u.mod.info.config).other||(r.other={})).prompt){return l(n)}else{return l("其它")}}},action:{input:{"other-text":function(e){var t;t=e.node;return u.value(t.value)}},change:{"other-radio":function(e){var t,n;t=e.node,n=e.ctx;if(i(u.value())||!u.value()){return u.value("")}}}},handler:{input:function(e){var t;t=e.node;return t.classList.toggle("text-danger",u.status()===2)},other:function(e){var t,n;t=e.node;return t.classList.toggle("d-none",!((n=u.mod.info.config).other||(n.other={})).enabled)},"other-radio":function(e){var t;t=e.node;t.setAttribute("name",c);if(!u.mod.info.meta.readonly){t.removeAttribute("disabled")}else{t.setAttribute("disabled",null)}return t.checked=!i(u.value())},"other-text":function(e){var t,n;t=e.node;if(!u.mod.info.meta.readonly){t.removeAttribute("readonly")}else{t.setAttribute("readonly",null)}n=u.value();return t.value=i(n)?"":n!=null?n:""},option:{list:function(){return u.mod.info.config.values||[]},key:function(e){return r(e)},view:{action:{change:{radio:function(e){var t,n;t=e.node,n=e.ctx;if(t.checked){return u.value(r(n))}}}},handler:{"@":function(e){var t;t=e.node;return t.style.flexBasis=(u.mod.info.config||{}).layout==="block"?"100%":""},radio:function(e){var t,n;t=e.node,n=e.ctx;t.setAttribute("name",c);t.checked=u.value()===r(n);if(!u.mod.info.meta.readonly){return t.removeAttribute("disabled")}else{return t.setAttribute("disabled",null)}}},text:{text:function(e){var t,n;t=e.node,n=e.ctx;return o(n)}}}}}})},render:function(){return this.mod.child.view.render()}}};function in$(e,t){var n=-1,r=t.length>>>0;while(++n<r)if(e===t[n])return true;return false}</script><div plug="body"><div class="m-edit" ld="input"><div class="my-2 has-tips manual" ld="error-root"><div class="d-flex g-2 flex-wrap"><label class="mb-0 mr-2 clickable d-flex" ld-each="option" style="line-height:1.25em"><input class="mr-1" ld="radio" type="radio"><span ld="text"></span></label></div><div class="mt-2" ld="other"><label class="clickable d-flex align-items-center"><input class="mr-1" ld="other-radio" type="radio"><div class="mr-2 text-nowrap" ld="other-prompt"></div><input class="form-control form-control-sm" type="text" ld="other-text"></label></div><div class="hover-tip tip-sm"><div ld-each="error"></div></div></div></div><div class="m-view" ld="content"></div></div></div>
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@makeform/radio","version":"2.0.1","description":"","scripts":{},"keywords":[],"author":"zbryikt","license":"MIT","dependencies":{"@plotdb/srcbuild":"^0.0.68"},"devDependencies":{"fedep":"^1.3.0"}}
1
+ {"name":"@makeform/radio","version":"2.0.2","description":"","scripts":{},"keywords":[],"author":"zbryikt","license":"MIT","dependencies":{"@plotdb/srcbuild":"^0.0.69"},"devDependencies":{"fedep":"^1.4.3"}}