ax5ui-dialog
Advanced tools
Comparing version 1.4.39 to 1.4.40
{ | ||
"name": "ax5ui-dialog", | ||
"version": "1.4.39", | ||
"version": "1.4.40", | ||
"description": "A dialog plugin that works with Bootstrap & jQuery", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -11,4 +11,3 @@ "use strict"; | ||
UI.addClass({ | ||
className: "dialog", | ||
version: "1.4.39" | ||
className: "dialog" | ||
}, function () { | ||
@@ -15,0 +14,0 @@ /** |
@@ -1,1 +0,2 @@ | ||
"use strict";!function(){var i=ax5.ui,t=ax5.util,e=void 0;i.addClass({className:"dialog",version:"1.4.39"},function(){var n=function(){var n=this,l=void 0;this.instanceId=ax5.getGuid(),this.config={id:"ax5-dialog-"+this.instanceId,clickEventName:"click",theme:"default",width:300,title:"",msg:"",lang:{ok:"ok",cancel:"cancel"},animateTime:150,autoCloseTime:0},this.activeDialog=null,this.autoCloseTimer=null,l=this.config;var a=function(i,t){return i&&i.onStateChanged?i.onStateChanged.call(t,t):this.onStateChanged&&this.onStateChanged.call(t,t),t=null,!0},o=function(i,n){var a={dialogId:i,title:n.title||l.title||"",msg:(n.msg||l.msg||"").replace(/\n/g,"<br/>"),input:n.input,btns:n.btns,_crlf:function(){return this.replace(/\n/g,"<br/>")},additionalContent:function(i){return t.isFunction(i)?i.call(n):i}(n.additionalContent)};try{return e.tmpl.get.call(this,"dialogDisplay",a)}finally{a=null}},d=function(i,t){var e={},d=void 0;i.id=i.id||l.id,d={width:i.width},jQuery(document.body).append(o.call(this,i.id,i)),this.activeDialog=jQuery("#"+i.id),this.activeDialog.css({width:d.width}),i.height=d.height=this.activeDialog.height(),"undefined"==typeof i.position||"center"===i.position?(e.top=jQuery(window).height()/2-d.height/2,e.left=jQuery(window).width()/2-d.width/2):(e.left=i.position.left||0,e.top=i.position.top||0),l.zIndex&&(e["z-index"]=l.zIndex),this.activeDialog.css(e),"prompt"===i.dialogType?this.activeDialog.find("[data-dialog-prompt]").get(0).focus():this.activeDialog.find("[data-dialog-btn]").get(0).focus(),this.activeDialog.find("[data-dialog-btn]").on(l.clickEventName,function(e){c.call(this,e||window.event,i,t)}.bind(this)),jQuery(window).bind("keydown.ax5dialog",function(e){u.call(this,e||window.event,i,t)}.bind(this)),jQuery(window).bind("resize.ax5dialog",function(i){s.call(this,i||window.event)}.bind(this)),a.call(this,i,{self:this,state:"open"}),i.autoCloseTime&&(this.autoCloseTimer=setTimeout(function(){n.close()},i.autoCloseTime)),e=null,d=null},s=function(i){if(!this.activeDialog)return this;var t=n.dialogConfig,e={width:t.width,height:t.height};return"undefined"==typeof t.position||"center"===t.position?(e.top=window.innerHeight/2-e.height/2,e.left=window.innerWidth/2-e.width/2):(e.left=t.position.left||0,e.top=t.position.top||0),e.left<0&&(e.left=0),e.top<0&&(e.top=0),this.activeDialog.css(e),t=null,e=null,this},c=function(i,e,n,l,a){var o=void 0,d=null;if(i.srcElement&&(i.target=i.srcElement),l=t.findParentNode(i.target,function(i){if(i.getAttribute("data-dialog-btn"))return!0})){if(a=l.getAttribute("data-dialog-btn"),o={self:this,key:a,value:e.btns[a],dialogId:e.id,btnTarget:l},"prompt"===e.dialogType)for(var s in e.input)if(o[s]=this.activeDialog.find("[data-dialog-prompt="+s+"]").val(),""==o[s]||null==o[s]){d=s;break}if(e.btns[a].onClick)e.btns[a].onClick.call(o,a);else if("alert"===e.dialogType)n&&n.call(o,a),this.close({doNotCallback:!0});else if("confirm"===e.dialogType)n&&n.call(o,a),this.close({doNotCallback:!0});else if("prompt"===e.dialogType){if("ok"===a&&d)return this.activeDialog.find('[data-dialog-prompt="'+d+'"]').get(0).focus(),!1;n&&n.call(o,a),this.close({doNotCallback:!0})}}o=null,e=null,n=null,l=null,a=null},u=function(i,t,e,n,l){var a=void 0,o=null;if(i.keyCode==ax5.info.eventKeys.ESC&&this.close(),"prompt"===t.dialogType&&i.keyCode==ax5.info.eventKeys.RETURN){a={self:this,key:l,value:t.btns[l],dialogId:t.id,btnTarget:n};for(var d in t.input)if(a[d]=this.activeDialog.find("[data-dialog-prompt="+d+"]").val(),""==a[d]||null==a[d]){o=d;break}if(o)return a=null,o=null,!1;e&&e.call(a,l),this.close({doNotCallback:!0})}a=null,o=null,t=null,e=null,n=null,l=null};this.init=function(){this.onStateChanged=l.onStateChanged},this.alert=function(i,e,a){return t.isString(i)&&(i={title:l.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","alert")):setTimeout(function(){this.alert(i,e,1)}.bind(this),Number(l.animateTime)+100),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,l,i),i=n.dialogConfig,i.dialogType="alert",i.theme=i.theme||l.theme||"",i.callback=e,"undefined"==typeof i.btns&&(i.btns={ok:{label:l.lang.ok,theme:i.theme}}),d.call(this,i,e),this)},this.confirm=function(i,e,a){return t.isString(i)&&(i={title:l.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","confirm")):setTimeout(function(){this.confirm(i,e,1)}.bind(this),Number(l.animateTime)+100),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,l,i),i=n.dialogConfig,i.dialogType="confirm",i.theme=i.theme||l.theme||"",i.callback=e,"undefined"==typeof i.btns&&(i.btns={ok:{label:l.lang.ok,theme:i.theme},cancel:{label:l.lang.cancel}}),d.call(this,i,e),this)},this.prompt=function(i,e,a){return t.isString(i)&&(i={title:l.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","prompt")):setTimeout(function(){this.prompt(i,e,1)}.bind(this),Number(l.animateTime)+100),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,l,i),i=n.dialogConfig,i.dialogType="prompt",i.theme=i.theme||l.theme||"",i.callback=e,"undefined"==typeof i.input&&(i.input={value:{label:""}}),"undefined"==typeof i.btns&&(i.btns={ok:{label:l.lang.ok,theme:i.theme},cancel:{label:l.lang.cancel}}),d.call(this,i,e),this)},this.close=function(i){var t=void 0,e=void 0;return this.activeDialog&&(this.autoCloseTimer&&clearTimeout(this.autoCloseTimer),t=n.dialogConfig,this.activeDialog.addClass("destroy"),jQuery(window).unbind("keydown.ax5dialog"),jQuery(window).unbind("resize.ax5dialog"),setTimeout(function(){this.activeDialog&&(this.activeDialog.remove(),this.activeDialog=null),e={self:this,state:"close",dialogId:t.id},!t.callback||i&&i.doNotCallback||t.callback.call(e),t&&t.onStateChanged?t.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e),t=null,e=null}.bind(this),l.animateTime)),this},this.main=function(){i.dialog_instance=i.dialog_instance||[],i.dialog_instance.push(this),arguments&&t.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return n}()),e=ax5.ui.dialog}(),function(){var i=ax5.ui.dialog,t=function(i){return' \n <div id="{{dialogId}}" data-dialog-els="root" class="ax5-ui-dialog {{theme}}">\n <div class="ax-dialog-header" data-dialog-els="header">\n {{{title}}}\n </div>\n <div class="ax-dialog-body" data-dialog-els="body">\n <div class="ax-dialog-msg">{{{msg}}}</div>\n \n {{#input}}\n <div class="ax-dialog-prompt">\n {{#@each}}\n <div class="form-group">\n {{#@value.label}}\n <label>{{#_crlf}}{{{.}}}{{/_crlf}}</label>\n {{/@value.label}}\n <input type="{{@value.type}}" placeholder="{{@value.placeholder}}" class="form-control {{@value.theme}}" data-dialog-prompt="{{@key}}" style="width:100%;" value="{{@value.value}}" />\n {{#@value.help}}\n <p class="help-block">{{#_crlf}}{{.}}{{/_crlf}}</p>\n {{/@value.help}}\n </div>\n {{/@each}}\n </div>\n {{/input}}\n \n <div class="ax-dialog-buttons" data-dialog-els="buttons">\n <div class="ax-button-wrap">\n {{#btns}}\n {{#@each}}\n <button type="button" data-dialog-btn="{{@key}}" class="btn btn-{{@value.theme}}">{{@value.label}}</button>\n {{/@each}}\n {{/btns}}\n </div>\n </div>\n \n {{#additionalContent}}\n <div data-dialog-els="additional-content">{{{.}}}</div>\n {{/additionalContent}}\n </div>\n </div> \n '};i.tmpl={dialogDisplay:t,get:function(t,e,n){return ax5.mustache.render(i.tmpl[t].call(this,n),e)}}}(); | ||
"use strict";!function(){var i=ax5.ui,t=ax5.util,e=void 0;i.addClass({className:"dialog"},function(){var l=function(){var l=this,n=void 0;this.instanceId=ax5.getGuid(),this.config={id:"ax5-dialog-"+this.instanceId,clickEventName:"click",theme:"default",width:300,title:"",msg:"",lang:{ok:"ok",cancel:"cancel"},animateTime:150,autoCloseTime:0},this.activeDialog=null,this.autoCloseTimer=null,n=this.config;var a=function(i,t){return i&&i.onStateChanged?i.onStateChanged.call(t,t):this.onStateChanged&&this.onStateChanged.call(t,t),t=null,!0},o=function(i,l){var a={dialogId:i,title:l.title||n.title||"",msg:(l.msg||n.msg||"").replace(/\n/g,"<br/>"),input:l.input,btns:l.btns,_crlf:function(){return this.replace(/\n/g,"<br/>")},additionalContent:function(i){return t.isFunction(i)?i.call(l):i}(l.additionalContent)};try{return e.tmpl.get.call(this,"dialogDisplay",a)}finally{a=null}},d=function(i,t){var e={},d=void 0;i.id=i.id||n.id,d={width:i.width},jQuery(document.body).append(o.call(this,i.id,i)),this.activeDialog=jQuery("#"+i.id),this.activeDialog.css({width:d.width}),i.height=d.height=this.activeDialog.height(),"undefined"==typeof i.position||"center"===i.position?(e.top=jQuery(window).height()/2-d.height/2,e.left=jQuery(window).width()/2-d.width/2):(e.left=i.position.left||0,e.top=i.position.top||0),n.zIndex&&(e["z-index"]=n.zIndex),this.activeDialog.css(e),"prompt"===i.dialogType?this.activeDialog.find("[data-dialog-prompt]").get(0).focus():this.activeDialog.find("[data-dialog-btn]").get(0).focus(),this.activeDialog.find("[data-dialog-btn]").on(n.clickEventName,function(e){c.call(this,e||window.event,i,t)}.bind(this)),jQuery(window).bind("keydown.ax5dialog",function(e){u.call(this,e||window.event,i,t)}.bind(this)),jQuery(window).bind("resize.ax5dialog",function(i){s.call(this,i||window.event)}.bind(this)),a.call(this,i,{self:this,state:"open"}),i.autoCloseTime&&(this.autoCloseTimer=setTimeout(function(){l.close()},i.autoCloseTime)),e=null,d=null},s=function(i){if(!this.activeDialog)return this;var t=l.dialogConfig,e={width:t.width,height:t.height};return"undefined"==typeof t.position||"center"===t.position?(e.top=window.innerHeight/2-e.height/2,e.left=window.innerWidth/2-e.width/2):(e.left=t.position.left||0,e.top=t.position.top||0),e.left<0&&(e.left=0),e.top<0&&(e.top=0),this.activeDialog.css(e),t=null,e=null,this},c=function(i,e,l,n,a){var o=void 0,d=null;if(i.srcElement&&(i.target=i.srcElement),n=t.findParentNode(i.target,function(i){if(i.getAttribute("data-dialog-btn"))return!0})){if(a=n.getAttribute("data-dialog-btn"),o={self:this,key:a,value:e.btns[a],dialogId:e.id,btnTarget:n},"prompt"===e.dialogType)for(var s in e.input)if(o[s]=this.activeDialog.find("[data-dialog-prompt="+s+"]").val(),""==o[s]||null==o[s]){d=s;break}if(e.btns[a].onClick)e.btns[a].onClick.call(o,a);else if("alert"===e.dialogType)l&&l.call(o,a),this.close({doNotCallback:!0});else if("confirm"===e.dialogType)l&&l.call(o,a),this.close({doNotCallback:!0});else if("prompt"===e.dialogType){if("ok"===a&&d)return this.activeDialog.find('[data-dialog-prompt="'+d+'"]').get(0).focus(),!1;l&&l.call(o,a),this.close({doNotCallback:!0})}}o=null,e=null,l=null,n=null,a=null},u=function(i,t,e,l,n){var a=void 0,o=null;if(i.keyCode==ax5.info.eventKeys.ESC&&this.close(),"prompt"===t.dialogType&&i.keyCode==ax5.info.eventKeys.RETURN){a={self:this,key:n,value:t.btns[n],dialogId:t.id,btnTarget:l};for(var d in t.input)if(a[d]=this.activeDialog.find("[data-dialog-prompt="+d+"]").val(),""==a[d]||null==a[d]){o=d;break}if(o)return a=null,o=null,!1;e&&e.call(a,n),this.close({doNotCallback:!0})}a=null,o=null,t=null,e=null,l=null,n=null};this.init=function(){this.onStateChanged=n.onStateChanged},this.alert=function(i,e,a){return t.isString(i)&&(i={title:n.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","alert")):setTimeout(function(){this.alert(i,e,1)}.bind(this),Number(n.animateTime)+100),this):(l.dialogConfig={},jQuery.extend(!0,l.dialogConfig,n,i),i=l.dialogConfig,i.dialogType="alert",i.theme=i.theme||n.theme||"",i.callback=e,"undefined"==typeof i.btns&&(i.btns={ok:{label:n.lang.ok,theme:i.theme}}),d.call(this,i,e),this)},this.confirm=function(i,e,a){return t.isString(i)&&(i={title:n.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","confirm")):setTimeout(function(){this.confirm(i,e,1)}.bind(this),Number(n.animateTime)+100),this):(l.dialogConfig={},jQuery.extend(!0,l.dialogConfig,n,i),i=l.dialogConfig,i.dialogType="confirm",i.theme=i.theme||n.theme||"",i.callback=e,"undefined"==typeof i.btns&&(i.btns={ok:{label:n.lang.ok,theme:i.theme},cancel:{label:n.lang.cancel}}),d.call(this,i,e),this)},this.prompt=function(i,e,a){return t.isString(i)&&(i={title:n.title,msg:i}),this.activeDialog?(a?console.log(ax5.info.getError("ax5dialog","501","prompt")):setTimeout(function(){this.prompt(i,e,1)}.bind(this),Number(n.animateTime)+100),this):(l.dialogConfig={},jQuery.extend(!0,l.dialogConfig,n,i),i=l.dialogConfig,i.dialogType="prompt",i.theme=i.theme||n.theme||"",i.callback=e,"undefined"==typeof i.input&&(i.input={value:{label:""}}),"undefined"==typeof i.btns&&(i.btns={ok:{label:n.lang.ok,theme:i.theme},cancel:{label:n.lang.cancel}}),d.call(this,i,e),this)},this.close=function(i){var t=void 0,e=void 0;return this.activeDialog&&(this.autoCloseTimer&&clearTimeout(this.autoCloseTimer),t=l.dialogConfig,this.activeDialog.addClass("destroy"),jQuery(window).unbind("keydown.ax5dialog"),jQuery(window).unbind("resize.ax5dialog"),setTimeout(function(){this.activeDialog&&(this.activeDialog.remove(),this.activeDialog=null),e={self:this,state:"close",dialogId:t.id},!t.callback||i&&i.doNotCallback||t.callback.call(e),t&&t.onStateChanged?t.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e),t=null,e=null}.bind(this),n.animateTime)),this},this.main=function(){i.dialog_instance=i.dialog_instance||[],i.dialog_instance.push(this),arguments&&t.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return l}()),e=ax5.ui.dialog}(),function(){var i=ax5.ui.dialog,t=function(i){return' \n <div id="{{dialogId}}" data-dialog-els="root" class="ax5-ui-dialog {{theme}}">\n <div class="ax-dialog-header" data-dialog-els="header">\n {{{title}}}\n </div>\n <div class="ax-dialog-body" data-dialog-els="body">\n <div class="ax-dialog-msg">{{{msg}}}</div>\n \n {{#input}}\n <div class="ax-dialog-prompt">\n {{#@each}}\n <div class="form-group">\n {{#@value.label}}\n <label>{{#_crlf}}{{{.}}}{{/_crlf}}</label>\n {{/@value.label}}\n <input type="{{@value.type}}" placeholder="{{@value.placeholder}}" class="form-control {{@value.theme}}" data-dialog-prompt="{{@key}}" style="width:100%;" value="{{@value.value}}" />\n {{#@value.help}}\n <p class="help-block">{{#_crlf}}{{.}}{{/_crlf}}</p>\n {{/@value.help}}\n </div>\n {{/@each}}\n </div>\n {{/input}}\n \n <div class="ax-dialog-buttons" data-dialog-els="buttons">\n <div class="ax-button-wrap">\n {{#btns}}\n {{#@each}}\n <button type="button" data-dialog-btn="{{@key}}" class="btn btn-{{@value.theme}}">{{@value.label}}</button>\n {{/@each}}\n {{/btns}}\n </div>\n </div>\n \n {{#additionalContent}}\n <div data-dialog-els="additional-content">{{{.}}}</div>\n {{/additionalContent}}\n </div>\n </div> \n '};i.tmpl={dialogDisplay:t,get:function(t,e,l){return ax5.mustache.render(i.tmpl[t].call(this,l),e)}}}(); | ||
//# sourceMappingURL=ax5dialog.min.js.map |
{ | ||
"name": "ax5ui-dialog", | ||
"version": "1.4.39", | ||
"version": "1.4.40", | ||
"description": "A dialog plugin that works with Bootstrap & jQuery", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -9,4 +9,3 @@ // ax5.ui.dialog | ||
UI.addClass({ | ||
className: "dialog", | ||
version: "${VERSION}" | ||
className: "dialog" | ||
}, (function () { | ||
@@ -13,0 +12,0 @@ /** |
Sorry, the diff of this file is not supported yet
1450
131998