@makeform/radio 2.0.2 → 3.0.1
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 +10 -0
- package/index.html +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Change Logs
|
|
2
2
|
|
|
3
|
+
## v3.0.1
|
|
4
|
+
|
|
5
|
+
- store and use key for entry matching if key is available
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## v3.0.0
|
|
9
|
+
|
|
10
|
+
- support `@grantdash/composer` host
|
|
11
|
+
|
|
12
|
+
|
|
3
13
|
## v2.0.2
|
|
4
14
|
|
|
5
15
|
- fix bug: when using label / value pairs, value instead of label is shown in view mode
|
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
|
|
1
|
+
<div><script type="@plotdb/block">var mod;module.exports={pkg:{name:"@makeform/radio",extend:{name:"@makeform/common"},host:{name:"@grantdash/composer"},i18n:{en:{"其它":"Other",config:{other:{enabled:{name:"enable 'other' option",desc:"show an 'other' option when enabled"}}}},"zh-TW":{"其它":"其它",config:{other:{enabled:{name:"使用「其它」選項",desc:"啟用時,顯示一個額外的「其它」選項"}}}}}},init:function(e){var n=this;e.pubsub.on("inited",function(e){e==null&&(e={});return import$(n,e)});return e.pubsub.fire("subinit",{mod:mod.call(this,e)})}};mod=function(e){var t,n,r,o,i,u,a,l,d,c,f,s,v,h,m,g,p=this;t=e.root,n=e.ctx,r=e.data,o=e.parent,i=e.t,u=e.i18n,a=e.host;l=n.ldview;d={};c=function(){return p.hitf};f=function(e){if(typeof e==="string"){return e}else{return(e!=null?e.value:void 8)||c().totext(e!=null?e.label:void 8)}};s=function(n){var e;e=(d.values||(d.values=[])).filter(function(e){return g(e)===n})[0];e=(e!=null?e.label:void 8)||(e!=null?e:n!=null?n:void 8);if(typeof e==="object"){return c().totext(e)}else if(typeof e==="string"){return i(e)}else{return e||""}};v=function(e){return in$(e,(d.values||[]).map(function(e){return g(e)}))};h="_"+Math.random().toString(36).substring(2);m=function(){return Date.now()+"-"+(m.idx=(m.idx||0)+1)+"-"+Math.random().toString(36).substring(2)};g=function(e){return e.key||f(e)};this.client=function(){return{minibar:[],meta:{config:{other:{enabled:{type:"boolean",name:"config.other.enabled.name",desc:"config.other.enabled.desc"}}}},render:function(){return d.view.render()},sample:function(){var e;return{config:{values:[{key:m(),label:c().wrap((e={},e[u.language+""]="Option 1",e))},{key:m(),label:c().wrap((e={},e[u.language+""]="Option 2",e))},{key:m(),label:c().wrap((e={},e[u.language+""]="Option 3",e))}]}}}}};return{init:function(){var e,n,r=this;this.on("change",function(){return r.mod.child.view.render("option")});e=function(){return d.values=(r.mod.info.config||{}).values||[]};e();this.on(["meta"],function(){return e()});return this.mod.child.view=n=d.view=new l({root:t,text:{content:function(e){var n;n=e.node;if(r.isEmpty()){return"n/a"}else{return s(r.value())}}},action:{input:{"other-text":function(e){var n;n=e.node;return r.value(n.value)}},change:{"other-radio":function(e){var n,t;n=e.node,t=e.ctx;if(v(r.value())||!r.value()){return r.value("")}}},click:{"other-prompt":c().edit({obj:function(e){var n,t,r,o;n=e.ctx;t=(r=(o=c().get()).config||(o.config={})).other||(r.other={});return t.prompt=typeof t.prompt==="string"?{}:t.prompt||{}}}),add:function(e){var n,t,r,o,i;n=e.node,t=e.views;r={label:c().wrap((o={},o[u.language+""]="untitled",o)),key:m()};((o=(i=c().get()).config||(i.config={})).values||(o.values=[])).push(r);c().set();return t[0].render()}}},handler:{"other-prompt":c().render({obj:function(){var e,n,t,r;return(!(e=(n=c().get())!=null?(t=n.config)!=null?(r=t.other)!=null?r.prompt:void 8:void 8:void 8)?"":typeof e!=="string"?e:e)||"其它"}}),input:function(e){var n;n=e.node;return n.classList.toggle("text-danger",r.status()===2)},other:function(e){var n,t;n=e.node;return n.classList.toggle("d-none",!((t=r.mod.info.config).other||(t.other={})).enabled)},"other-radio":function(e){var n;n=e.node;n.setAttribute("name",h);if(!r.mod.info.meta.readonly){n.removeAttribute("disabled")}else{n.setAttribute("disabled",null)}return n.checked=!v(r.value())},"other-text":function(e){var n,t;n=e.node;if(!r.mod.info.meta.readonly){n.removeAttribute("readonly")}else{n.setAttribute("readonly",null)}t=r.value();return n.value=v(t)?"":t!=null?t:""},option:{list:function(){var e,n;e=((n=c().get().config)!=null?n.values:void 8)||[];if(Array.isArray(e)){return e}else if(e){return[e]}else{return[]}},key:function(e){return g(e)},view:{action:{change:{radio:function(e){var n,t;n=e.node,t=e.ctx;if(n.checked){return r.value(g(t))}}},click:{"@":function(e){var n,t,r;n=e.node,t=e.evt;if(!(n.parentNode&&(r=ld$.find(n.parentNode,"[ld=editor]",0)))){return}t.stopPropagation();return t.preventDefault()},remove:function(e){var n,t,r,o,i;n=e.node,t=e.ctx,r=e.views;o=(i=c().get()).config||(i.config={});o.values=(o.values||(o.values=[])).filter(function(e){return g(e)!==g(t)});return c().set()},text:c().edit({obj:function(e){var n;n=e.ctx;return n.label||(n.label={})}})}},handler:{"@":function(e){var n;n=e.node;return n.style.flexBasis=(r.mod.info.config||{}).layout==="block"?"100%":""},radio:function(e){var n,t;n=e.node,t=e.ctx;n.setAttribute("name",h);n.checked=r.value()===g(t);if(!r.mod.info.meta.readonly){return n.removeAttribute("disabled")}else{return n.setAttribute("disabled",null)}},text:c().render({obj:function(e){var n;n=e.ctx;return n.label||n}})}}}}})},render:function(){return this.mod.child.view.render()}}};function import$(e,n){var t={}.hasOwnProperty;for(var r in n)if(t.call(n,r))e[r]=n[r];return e}function in$(e,n){var t=-1,r=n.length>>>0;while(++t<r)if(e===n[t])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"><div class="d-flex align-items-center"><span ld="text"></span><i class="i-close text-sm ml-1 cps-hover cps-remove" ld="remove"></i></div></label><div class="clickable rounded-sm bg-dark cps-add" ld="add">+</div></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" style="flex:1 0 5em"></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":"
|
|
1
|
+
{"name":"@makeform/radio","version":"3.0.1","description":"","scripts":{},"keywords":[],"author":"zbryikt","license":"MIT","dependencies":{"@plotdb/srcbuild":"^0.0.69"},"devDependencies":{"fedep":"^1.6.0"}}
|