Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ax5ui-binder

Package Overview
Dependencies
Maintainers
1
Versions
250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ax5ui-binder - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

2

bower.json
{
"name": "ax5ui-binder",
"version": "1.3.4",
"version": "1.3.5",
"authors": [

@@ -5,0 +5,0 @@ "ThomasJ <tom@axisj.com>"

@@ -11,3 +11,3 @@ "use strict";

className: "binder",
version: "1.3.4"
version: "1.3.5"
}, function () {

@@ -14,0 +14,0 @@

@@ -1,1 +0,1 @@

"use strict";!function(){var t=ax5.ui,e=ax5.util;t.addClass({className:"binder",version:"1.3.4"},function(){var t=function(){var t;this.instanceId=ax5.getGuid(),this.config={},t=this.config,this.model={},this.tmpl={},this.view_target=null,this.change_trigger={},this.click_trigger={},this.update_trigger={},this.onerror=null;var a=Object.prototype.toString,i=function(t){var e;return null!=t&&t==t.window?e="window":t&&1==t.nodeType?e="element":t&&11==t.nodeType?e="fragment":"undefined"==typeof t?e="undefined":"[object Object]"==a.call(t)?e="object":"[object Array]"==a.call(t)?e="array":"[object String]"==a.call(t)?e="string":"[object Number]"==a.call(t)?e="number":"[object NodeList]"==a.call(t)?e="nodelist":"function"==typeof t&&(e="function"),e},n=function(t,e,a){return t+"["+e+"]"+("."==a?"":"."+a)},r=function(t){var e=[],a=[].concat(t.split(/[\.\[\]]/g));return a.forEach(function(t){""!==t&&e.push('["'+t.replace(/['\"]/g,"")+'"]')}),a=null,e.join("")};this.setModel=function(t,e){return this.model=t,!this.view_target&&e?(this.view_target=e,this._binding()):this._binding("update"),this},this.set=function(t,e){var a,n,h,l=this;if(Function("val","this"+r(t)+" = val;").call(this.model,e),a=i(e),"object"==a)for(var s in e)this.set(t+"."+s,e[s]);else if("array"==a)for(this.view_target.find('[data-ax-path="'+t+'"]').each(function(){h=(this.type||"").toLowerCase(),"checkbox"!=h&&"radio"!=h||l.set_els_value(this,this.tagName.toLowerCase(),h,e,t,"change")}),n=e.length;n--;)this.set(t+"["+n+"]",e[n]);else this.view_target.find('[data-ax-path="'+t+'"]').each(function(){l.set_els_value(this,this.tagName.toLowerCase(),(this.type||"").toLowerCase(),e,t,"change")});return this},this.get=function(t){return"undefined"==typeof t?this.model:Function("","return this"+r(t)+";").call(this.model)},this.onChange=function(t,e){return this.change_trigger[t||"*"]=e,this},this.onClick=function(t,e){return this.click_trigger[t]=e,this},this.add=function(t,e){var a=Function("","return this"+r(t)+";").call(this.model),i=this.tmpl[t];e["@i"]=a.length,e["@r"]=a.length,e.__ADDED__=!0,Function("val","this"+r(t)+".push(val);").call(this.model,e);for(var n in i){var h=$(ax5.mustache.render(i[n].content,e));h.attr("data-ax-repeat-path",t),h.attr("data-ax-repeat-i",e["@i"]),this.bind_event_tmpl(h,t),i[n].container.append(h)}this.change("*");var l=this.update_trigger[t];if(l){var s={repeat_path:t,tmpl:i,list:a};l.call(s,s)}return this},this.remove=function(t,e){var a=Function("","return this"+r(t)+";").call(this.model),i=this.tmpl[t];"undefined"==typeof e&&(e=a.length-1);var n=a[e];n.__ADDED__?a.splice(e,1):a[e].__DELETED__=!0;for(var h in i)i[h].container.empty(),this.print_tmpl(t,i[h]);this.change("*");var l=this.update_trigger[t];if(l){var s={repeat_path:t,tmpl:i,list:a};l.call(s,s)}return this},this.update=function(t,e,a){var i=Function("","return this"+r(t)+";").call(this.model),n=this.tmpl[t];"undefined"!=typeof e&&a&&i.splice(e,1,a);for(var h in n)n[h].container.empty(),this.print_tmpl(t,n[h]);this.change("*");var l=this.update_trigger[t];if(l){var s={repeat_path:t,tmpl:n,list:i};l.call(s,s)}return this},this.childAdd=function(t,e,a,i){var n=Function("","return this"+r(t)+";").call(this.model),h=Function("","return this"+r(t)+"["+e+"]."+a+";").call(this.model);i.__ADDED__=!0,h.push(i),this.update(t,e,n[e])},this.childRemove=function(t,e,a,i){var n=Function("","return this"+r(t)+";").call(this.model),h=Function("","return this"+r(t)+"["+e+"]."+a+";").call(this.model),l=h[i];l.__ADDED__?h.splice(i,1):h[i].__DELETED__=!0,this.update(t,e,n[e])},this.childUpdate=function(t,e,a,i,n){var h=Function("","return this"+r(t)+";").call(this.model),l=Function("","return this"+r(t)+"["+e+"]."+a+";").call(this.model);l[i]=n,this.update(t,e,h[e])},this.childSet=function(t,e,a,i){var n=this;return Function("val","this"+r(t)+"["+e+"]."+a+" = val;").call(this.model,i),this.view_target.find('[data-ax-repeat="'+t+'"]').find('[data-ax-repeat-i="'+e+'"]').find('[data-ax-item-path="'+a+'"]').each(function(){n.set_els_value(this,this.tagName.toLowerCase(),(this.type||"").toLowerCase(),i,t+"["+e+"]."+a)}),this},this.onUpdate=function(t,e){return this.update_trigger[t]=e,this},this._binding=function(t){var e=this;this.view_target.find("[data-ax-path]").each(function(){var t,a=$(this),i=a.attr("data-ax-path"),n=(this.type||"").toLowerCase();try{t=Function("","return this"+r(i)+";").call(e.model)}catch(h){e.onerror&&e.onerror("not found target [model."+r(i)+"]")}e.set_els_value(this,this.tagName.toLowerCase(),n,t||"",i)}),"undefined"==typeof t?this.view_target.find("[data-ax-repeat]").each(function(){var t=$(this),a=t.attr("data-ax-repeat"),i=t.attr("data-ax-repeat-idx");"undefined"==typeof e.tmpl[a]&&(e.tmpl[a]={}),"undefined"!=typeof i?e.tmpl[a][i]={container:t,content:t.find("script").html()}:e.tmpl[a][0]={container:t,content:t.find("script").html()},t.empty()}):this.view_target.find("[data-ax-repeat]").each(function(){var t=$(this);t.empty().show()}),this.view_target.find("[data-ax-path]").unbind("change.axbinder").bind("change.axbinder",function(t){var a,n,h=!1,l=[],s=$(t.target),o=s.attr("data-ax-path"),c=Function("","return this"+r(o)+";").call(e.model),d=(this.type||"").toLowerCase(),u=i(c),f=!0;if("object"!=u&&"array"!=u||(f=!1),"checkbox"==d){if(e.view_target.find('[data-ax-path="'+o+'"]').length>1){for("array"!=i(c)&&(c="undefined"==typeof c||""==c?[]:[].concat(c)),a=c.length,h=!1,n=this.checked;a--;)c[a]==this.value&&(h=!0);if(n)h||c.push(this.value);else{for(a=c.length;a--;)c[a]==this.value||l.push(c[a]);c=l}}else c=this.checked?this.value:"";Function("val","this"+r(o)+" = val;").call(e.model,c),e.change(o,{el:this,jquery:s,tagname:this.tagName.toLowerCase(),value:c})}else f&&(Function("val","this"+r(o)+" = val;").call(e.model,this.value),e.change(o,{el:this,jquery:s,tagname:this.tagName.toLowerCase(),value:this.value}));s.data("changedTime",(new Date).getTime())});var a;for(var n in e.tmpl){for(var h in e.tmpl[n])this.print_tmpl(n,e.tmpl[n][h],"isInit");if(a=this.update_trigger[n]){var l={repeat_path:n,tmpl:e.tmpl[n],list:Function("","return this."+n+";").call(this.model)};a.call(l,l)}}},this.set_els_value=function(t,e,a,i,n,h){i="undefined"==typeof i?[]:[].concat(i);var l,s;if("input"==e)if("checkbox"==a||"radio"==a){s=i.length;var o=!1;try{if(s>0)for(;s--;)"undefined"!=typeof i[s]&&t.value===i[s].toString()&&(o=!0)}catch(c){console.log(c)}t.checked=o}else t.value=i.join("");else if("select"==e){l=t.options,s=l.length;for(var d,u=!1;s--;){for(d=i.length;d--;)if("undefined"!=typeof i[d]&&l[s].value===i[d].toString()){l[s].selected=!0,u=!0;break}if(u)break}u||(l[0]?(l[0].selected=!0,Function("val","this"+r(n)+" = val;").call(this.model,l[0].value)):Function("val","this"+r(n)+" = val;").call(this.model,"")),window.AXSelect&&$("undefined"!=typeof i&&t).bindSelectSetValue(i[i.length-1])}else"textarea"==e?t.value=i.join("")||"":t.innerText?t.innerText=i.join(""):t.innerHTML=i.join("");return h&&this.change(n,{el:t,tagname:e,value:i}),this},this.change=function(t,e){var a=this.change_trigger[t];a&&a.call(e,e),"*"!=t&&this.change_trigger["*"]&&this.change_trigger["*"].call(e,e)},this.click=function(t,e){var a=this.click_trigger[t];a&&a.call(e,e)},this.sync_model=function(){},this.print_tmpl=function(t,e,a){var n=Function("","return this"+r(t)+";").call(this.model);if(n&&"array"==i(n))for(var h=0,l=n.length;h<l;h++){var s=n[h];if(jQuery.isPlainObject(s)?(s["@i"]=h,s["@r"]=h,0===h&&(s["@first"]=!0)):(s={"@i":h,"@value":s},0===h&&(s["@first"]=!0),console.log(s)),!s.__DELETED__){var o=$(ax5.mustache.render(e.content,s));o.attr("data-ax-repeat-path",t),o.attr("data-ax-repeat-i",s["@i"]),this.bind_event_tmpl(o,t),e.container.append(o)}}},this.bind_event_tmpl=function(t,e){var a=this,h=t.attr("data-ax-repeat-i"),l=Function("","return this"+r(e)+";").call(this.model);t.find("[data-ax-repeat-click]").unbind("click.axbinder").bind("click.axbinder",function(t){var i=ax5.util.findParentNode(t.target,function(t){return t.getAttribute("data-ax-repeat-click")});if(i){var n=$(i),r=n.attr("data-ax-repeat-click"),s=(n.attr("data-ax-repeat-path"),{el:i,jquery:n,tagname:i.tagName.toLowerCase(),value:r,repeat_path:e,item:l[h],item_index:h,item_path:e+"["+h+"]"});a.click(e,s)}}),t.find("[data-ax-item-path]").each(function(){var t,i=$(this),r=i.attr("data-ax-item-path"),l=n(e,h,r),s=(this.type||"").toLowerCase();try{t=Function("","return this."+l+";").call(a.model)}catch(o){a.onerror&&a.onerror("not found target [model."+l+"]")}a.set_els_value(this,this.tagName.toLowerCase(),s,t||"",l)}),t.find("[data-ax-item-path]").unbind("change.axbinder").bind("change.axbinder",function(r){var l,s,o=!1,c=[],d=(this.type||"").toLowerCase(),u=$(r.target),f=u.attr("data-ax-item-path"),p=n(e,h,f),g=Function("","return this."+p+";").call(a.model),v=i(g),m=!0;if("object"!=v&&"array"!=v||(m=!1),"checkbox"==d){if(t.find('[data-ax-item-path="'+f+'"]').length>1){for("array"!=i(g)&&(g="undefined"==typeof g||""==g?[]:[].concat(g)),l=g.length,o=!1,s=this.checked;l--;)g[l]==this.value&&(o=!0);if(s)o||g.push(this.value);else{for(l=g.length;l--;)g[l]==this.value||c.push(g[l]);g=c}}else g=this.checked?this.value:"";Function("val","this."+p+" = val;").call(a.model,g),a.change(p,{el:this,jquery:u,tagname:this.tagName.toLowerCase(),value:g})}else m&&(Function("val","this."+p+" = val;").call(a.model,this.value),a.change(p,{el:this,jquery:u,tagname:this.tagName.toLowerCase(),value:this.value}));u.data("changedTime",(new Date).getTime())}),t.find("[data-ax-item-path]").unbind("blur.axbinder").bind("blur.axbinder",function(t){var e=$(t.target);("undefined"==typeof e.data("changedTime")||e.data("changedTime")<(new Date).getTime()-10)&&e.trigger("change")})},this.focus=function(t){return this.view_target.find('[data-ax-path="'+t+'"]').focus(),this},this.validate=function(){var t=this,e=[];return this.view_target.find("[data-ax-path]").each(function(){var a=$(this),i=a.attr("data-ax-path"),n=a.attr("data-ax-validate");if(n){var h=Function("","return this"+r(i)+";").call(t.model);"undefined"==typeof h&&(h="");var l=h.toString(),s=!1;"required"==n&&""==l.trim()?s=!0:!/\D.?/g.test(n)&&l.trim().length<n.number()&&(s=!0),s&&e.push({type:n,dataPath:i,el:this,jquery:a,value:h})}}),this.view_target.find("[data-ax-repeat-path]").each(function(){var a=$(this),i=a.attr("data-ax-repeat-path"),n=a.attr("data-ax-repeat-i");a.find("[data-ax-validate]").each(function(){var a=$(this),h=a.attr("data-ax-validate"),l=a.attr("data-ax-item-path"),s=Function("","return this"+r(i)+"["+n+"]."+l+";").call(t.model);"undefined"==typeof s&&(s="");var o=s.toString();if(h){var c=!1;"required"==h&&""==o.trim()?c=!0:!/\D.?/g.test(h)&&o.trim().length<h.number()&&(c=!0),c&&e.push({type:h,dataPath:i,el:this,jquery:a,value:s})}})}),e.length>0?{error:e}:{}},this.main=function(){arguments&&e.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return t}())}();
"use strict";!function(){var t=ax5.ui,e=ax5.util;t.addClass({className:"binder",version:"1.3.5"},function(){var t=function(){var t;this.instanceId=ax5.getGuid(),this.config={},t=this.config,this.model={},this.tmpl={},this.view_target=null,this.change_trigger={},this.click_trigger={},this.update_trigger={},this.onerror=null;var a=Object.prototype.toString,i=function(t){var e;return null!=t&&t==t.window?e="window":t&&1==t.nodeType?e="element":t&&11==t.nodeType?e="fragment":"undefined"==typeof t?e="undefined":"[object Object]"==a.call(t)?e="object":"[object Array]"==a.call(t)?e="array":"[object String]"==a.call(t)?e="string":"[object Number]"==a.call(t)?e="number":"[object NodeList]"==a.call(t)?e="nodelist":"function"==typeof t&&(e="function"),e},n=function(t,e,a){return t+"["+e+"]"+("."==a?"":"."+a)},r=function(t){var e=[],a=[].concat(t.split(/[\.\[\]]/g));return a.forEach(function(t){""!==t&&e.push('["'+t.replace(/['\"]/g,"")+'"]')}),a=null,e.join("")};this.setModel=function(t,e){return this.model=t,!this.view_target&&e?(this.view_target=e,this._binding()):this._binding("update"),this},this.set=function(t,e){var a,n,h,l=this;if(Function("val","this"+r(t)+" = val;").call(this.model,e),a=i(e),"object"==a)for(var s in e)this.set(t+"."+s,e[s]);else if("array"==a)for(this.view_target.find('[data-ax-path="'+t+'"]').each(function(){h=(this.type||"").toLowerCase(),"checkbox"!=h&&"radio"!=h||l.set_els_value(this,this.tagName.toLowerCase(),h,e,t,"change")}),n=e.length;n--;)this.set(t+"["+n+"]",e[n]);else this.view_target.find('[data-ax-path="'+t+'"]').each(function(){l.set_els_value(this,this.tagName.toLowerCase(),(this.type||"").toLowerCase(),e,t,"change")});return this},this.get=function(t){return"undefined"==typeof t?this.model:Function("","return this"+r(t)+";").call(this.model)},this.onChange=function(t,e){return this.change_trigger[t||"*"]=e,this},this.onClick=function(t,e){return this.click_trigger[t]=e,this},this.add=function(t,e){var a=Function("","return this"+r(t)+";").call(this.model),i=this.tmpl[t];e["@i"]=a.length,e["@r"]=a.length,e.__ADDED__=!0,Function("val","this"+r(t)+".push(val);").call(this.model,e);for(var n in i){var h=$(ax5.mustache.render(i[n].content,e));h.attr("data-ax-repeat-path",t),h.attr("data-ax-repeat-i",e["@i"]),this.bind_event_tmpl(h,t),i[n].container.append(h)}this.change("*");var l=this.update_trigger[t];if(l){var s={repeat_path:t,tmpl:i,list:a};l.call(s,s)}return this},this.remove=function(t,e){var a=Function("","return this"+r(t)+";").call(this.model),i=this.tmpl[t];"undefined"==typeof e&&(e=a.length-1);var n=a[e];n.__ADDED__?a.splice(e,1):a[e].__DELETED__=!0;for(var h in i)i[h].container.empty(),this.print_tmpl(t,i[h]);this.change("*");var l=this.update_trigger[t];if(l){var s={repeat_path:t,tmpl:i,list:a};l.call(s,s)}return this},this.update=function(t,e,a){var i=Function("","return this"+r(t)+";").call(this.model),n=this.tmpl[t];"undefined"!=typeof e&&a&&i.splice(e,1,a);for(var h in n)n[h].container.empty(),this.print_tmpl(t,n[h]);this.change("*");var l=this.update_trigger[t];if(l){var s={repeat_path:t,tmpl:n,list:i};l.call(s,s)}return this},this.childAdd=function(t,e,a,i){var n=Function("","return this"+r(t)+";").call(this.model),h=Function("","return this"+r(t)+"["+e+"]."+a+";").call(this.model);i.__ADDED__=!0,h.push(i),this.update(t,e,n[e])},this.childRemove=function(t,e,a,i){var n=Function("","return this"+r(t)+";").call(this.model),h=Function("","return this"+r(t)+"["+e+"]."+a+";").call(this.model),l=h[i];l.__ADDED__?h.splice(i,1):h[i].__DELETED__=!0,this.update(t,e,n[e])},this.childUpdate=function(t,e,a,i,n){var h=Function("","return this"+r(t)+";").call(this.model),l=Function("","return this"+r(t)+"["+e+"]."+a+";").call(this.model);l[i]=n,this.update(t,e,h[e])},this.childSet=function(t,e,a,i){var n=this;return Function("val","this"+r(t)+"["+e+"]."+a+" = val;").call(this.model,i),this.view_target.find('[data-ax-repeat="'+t+'"]').find('[data-ax-repeat-i="'+e+'"]').find('[data-ax-item-path="'+a+'"]').each(function(){n.set_els_value(this,this.tagName.toLowerCase(),(this.type||"").toLowerCase(),i,t+"["+e+"]."+a)}),this},this.onUpdate=function(t,e){return this.update_trigger[t]=e,this},this._binding=function(t){var e=this;this.view_target.find("[data-ax-path]").each(function(){var t,a=$(this),i=a.attr("data-ax-path"),n=(this.type||"").toLowerCase();try{t=Function("","return this"+r(i)+";").call(e.model)}catch(h){e.onerror&&e.onerror("not found target [model."+r(i)+"]")}e.set_els_value(this,this.tagName.toLowerCase(),n,t||"",i)}),"undefined"==typeof t?this.view_target.find("[data-ax-repeat]").each(function(){var t=$(this),a=t.attr("data-ax-repeat"),i=t.attr("data-ax-repeat-idx");"undefined"==typeof e.tmpl[a]&&(e.tmpl[a]={}),"undefined"!=typeof i?e.tmpl[a][i]={container:t,content:t.find("script").html()}:e.tmpl[a][0]={container:t,content:t.find("script").html()},t.empty()}):this.view_target.find("[data-ax-repeat]").each(function(){var t=$(this);t.empty().show()}),this.view_target.find("[data-ax-path]").unbind("change.axbinder").bind("change.axbinder",function(t){var a,n,h=!1,l=[],s=$(t.target),o=s.attr("data-ax-path"),c=Function("","return this"+r(o)+";").call(e.model),d=(this.type||"").toLowerCase(),u=i(c),f=!0;if("object"!=u&&"array"!=u||(f=!1),"checkbox"==d){if(e.view_target.find('[data-ax-path="'+o+'"]').length>1){for("array"!=i(c)&&(c="undefined"==typeof c||""==c?[]:[].concat(c)),a=c.length,h=!1,n=this.checked;a--;)c[a]==this.value&&(h=!0);if(n)h||c.push(this.value);else{for(a=c.length;a--;)c[a]==this.value||l.push(c[a]);c=l}}else c=this.checked?this.value:"";Function("val","this"+r(o)+" = val;").call(e.model,c),e.change(o,{el:this,jquery:s,tagname:this.tagName.toLowerCase(),value:c})}else f&&(Function("val","this"+r(o)+" = val;").call(e.model,this.value),e.change(o,{el:this,jquery:s,tagname:this.tagName.toLowerCase(),value:this.value}));s.data("changedTime",(new Date).getTime())});var a;for(var n in e.tmpl){for(var h in e.tmpl[n])this.print_tmpl(n,e.tmpl[n][h],"isInit");if(a=this.update_trigger[n]){var l={repeat_path:n,tmpl:e.tmpl[n],list:Function("","return this."+n+";").call(this.model)};a.call(l,l)}}},this.set_els_value=function(t,e,a,i,n,h){i="undefined"==typeof i?[]:[].concat(i);var l,s;if("input"==e)if("checkbox"==a||"radio"==a){s=i.length;var o=!1;try{if(s>0)for(;s--;)"undefined"!=typeof i[s]&&t.value===i[s].toString()&&(o=!0)}catch(c){console.log(c)}t.checked=o}else t.value=i.join("");else if("select"==e){l=t.options,s=l.length;for(var d,u=!1;s--;){for(d=i.length;d--;)if("undefined"!=typeof i[d]&&l[s].value===i[d].toString()){l[s].selected=!0,u=!0;break}if(u)break}u||(l[0]?(l[0].selected=!0,Function("val","this"+r(n)+" = val;").call(this.model,l[0].value)):Function("val","this"+r(n)+" = val;").call(this.model,"")),window.AXSelect&&$("undefined"!=typeof i&&t).bindSelectSetValue(i[i.length-1])}else"textarea"==e?t.value=i.join("")||"":t.innerText?t.innerText=i.join(""):t.innerHTML=i.join("");return h&&this.change(n,{el:t,tagname:e,value:i}),this},this.change=function(t,e){var a=this.change_trigger[t];a&&a.call(e,e),"*"!=t&&this.change_trigger["*"]&&this.change_trigger["*"].call(e,e)},this.click=function(t,e){var a=this.click_trigger[t];a&&a.call(e,e)},this.sync_model=function(){},this.print_tmpl=function(t,e,a){var n=Function("","return this"+r(t)+";").call(this.model);if(n&&"array"==i(n))for(var h=0,l=n.length;h<l;h++){var s=n[h];if(jQuery.isPlainObject(s)?(s["@i"]=h,s["@r"]=h,0===h&&(s["@first"]=!0)):(s={"@i":h,"@value":s},0===h&&(s["@first"]=!0),console.log(s)),!s.__DELETED__){var o=$(ax5.mustache.render(e.content,s));o.attr("data-ax-repeat-path",t),o.attr("data-ax-repeat-i",s["@i"]),this.bind_event_tmpl(o,t),e.container.append(o)}}},this.bind_event_tmpl=function(t,e){var a=this,h=t.attr("data-ax-repeat-i"),l=Function("","return this"+r(e)+";").call(this.model);t.find("[data-ax-repeat-click]").unbind("click.axbinder").bind("click.axbinder",function(t){var i=ax5.util.findParentNode(t.target,function(t){return t.getAttribute("data-ax-repeat-click")});if(i){var n=$(i),r=n.attr("data-ax-repeat-click"),s=(n.attr("data-ax-repeat-path"),{el:i,jquery:n,tagname:i.tagName.toLowerCase(),value:r,repeat_path:e,item:l[h],item_index:h,item_path:e+"["+h+"]"});a.click(e,s)}}),t.find("[data-ax-item-path]").each(function(){var t,i=$(this),r=i.attr("data-ax-item-path"),l=n(e,h,r),s=(this.type||"").toLowerCase();try{t=Function("","return this."+l+";").call(a.model)}catch(o){a.onerror&&a.onerror("not found target [model."+l+"]")}a.set_els_value(this,this.tagName.toLowerCase(),s,t||"",l)}),t.find("[data-ax-item-path]").unbind("change.axbinder").bind("change.axbinder",function(r){var l,s,o=!1,c=[],d=(this.type||"").toLowerCase(),u=$(r.target),f=u.attr("data-ax-item-path"),p=n(e,h,f),g=Function("","return this."+p+";").call(a.model),v=i(g),m=!0;if("object"!=v&&"array"!=v||(m=!1),"checkbox"==d){if(t.find('[data-ax-item-path="'+f+'"]').length>1){for("array"!=i(g)&&(g="undefined"==typeof g||""==g?[]:[].concat(g)),l=g.length,o=!1,s=this.checked;l--;)g[l]==this.value&&(o=!0);if(s)o||g.push(this.value);else{for(l=g.length;l--;)g[l]==this.value||c.push(g[l]);g=c}}else g=this.checked?this.value:"";Function("val","this."+p+" = val;").call(a.model,g),a.change(p,{el:this,jquery:u,tagname:this.tagName.toLowerCase(),value:g})}else m&&(Function("val","this."+p+" = val;").call(a.model,this.value),a.change(p,{el:this,jquery:u,tagname:this.tagName.toLowerCase(),value:this.value}));u.data("changedTime",(new Date).getTime())}),t.find("[data-ax-item-path]").unbind("blur.axbinder").bind("blur.axbinder",function(t){var e=$(t.target);("undefined"==typeof e.data("changedTime")||e.data("changedTime")<(new Date).getTime()-10)&&e.trigger("change")})},this.focus=function(t){return this.view_target.find('[data-ax-path="'+t+'"]').focus(),this},this.validate=function(){var t=this,e=[];return this.view_target.find("[data-ax-path]").each(function(){var a=$(this),i=a.attr("data-ax-path"),n=a.attr("data-ax-validate");if(n){var h=Function("","return this"+r(i)+";").call(t.model);"undefined"==typeof h&&(h="");var l=h.toString(),s=!1;"required"==n&&""==l.trim()?s=!0:!/\D.?/g.test(n)&&l.trim().length<n.number()&&(s=!0),s&&e.push({type:n,dataPath:i,el:this,jquery:a,value:h})}}),this.view_target.find("[data-ax-repeat-path]").each(function(){var a=$(this),i=a.attr("data-ax-repeat-path"),n=a.attr("data-ax-repeat-i");a.find("[data-ax-validate]").each(function(){var a=$(this),h=a.attr("data-ax-validate"),l=a.attr("data-ax-item-path"),s=Function("","return this"+r(i)+"["+n+"]."+l+";").call(t.model);"undefined"==typeof s&&(s="");var o=s.toString();if(h){var c=!1;"required"==h&&""==o.trim()?c=!0:!/\D.?/g.test(h)&&o.trim().length<h.number()&&(c=!0),c&&e.push({type:h,dataPath:i,el:this,jquery:a,value:s})}})}),e.length>0?{error:e}:{}},this.main=function(){arguments&&e.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return t}())}();
{
"name": "ax5ui-binder",
"version": "1.3.4",
"version": "1.3.5",
"description": "Simple 2way binder plugin that works with Bootstrap & jQuery",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc