ax5ui-dialog
Advanced tools
Comparing version 1.4.108 to 1.4.109
{ | ||
"name": "ax5ui-dialog", | ||
"version": "1.4.108", | ||
"version": "1.4.109", | ||
"description": "A dialog plugin that works with Bootstrap & jQuery", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -230,5 +230,6 @@ "use strict"; | ||
if (opts.dialogType === "prompt") { | ||
that.input = {}; | ||
for (var oi in opts.input) { | ||
that[oi] = this.activeDialog.find('[data-dialog-prompt=' + oi + ']').val(); | ||
if (that[oi] == "" || that[oi] == null) { | ||
that.input[oi] = this.activeDialog.find('[data-dialog-prompt=' + oi + ']').val(); | ||
if (opts.input[oi].required && (that.input[oi] == "" || that.input[oi] == null)) { | ||
emptyKey = oi; | ||
@@ -235,0 +236,0 @@ break; |
@@ -1,2 +0,2 @@ | ||
"use strict";!function(){var t=ax5.ui,i=ax5.util,e=void 0;t.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,this.queue=[],n=this.config;var a=function(t,i){return t&&t.onStateChanged?t.onStateChanged.call(i,i):this.onStateChanged&&this.onStateChanged.call(i,i),i=null,!0},o=function(t,l){var a={dialogId:t,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(t){return i.isFunction(t)?t.call(l):t}(l.additionalContent)};try{return e.tmpl.get.call(this,"dialogDisplay",a)}finally{a=null}},d=function(t,i){var e={},d=void 0;t.id=t.id||n.id,d={width:t.width},jQuery(document.body).append(o.call(this,t.id,t)),this.dialogConfig=t,this.activeDialog=jQuery("#"+t.id),this.activeDialog.css({width:d.width}),"undefined"==typeof i&&(i=t.callback),t.height=d.height=this.activeDialog.height(),"undefined"==typeof t.position||"center"===t.position?(e.top=jQuery(window).height()/2-d.height/2,e.left=jQuery(window).width()/2-d.width/2):(e.left=t.position.left||0,e.top=t.position.top||0),n.zIndex&&(e["z-index"]=n.zIndex),this.activeDialog.css(e),"prompt"===t.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,t,i)}.bind(this)),jQuery(window).bind("keydown.ax5dialog",function(e){u.call(this,e||window.event,t,i)}.bind(this)),jQuery(window).bind("resize.ax5dialog",function(t){s.call(this,t||window.event)}.bind(this)),a.call(this,t,{self:this,state:"open"}),t.autoCloseTime&&(this.autoCloseTimer=setTimeout(function(){l.close()},t.autoCloseTime)),e=null,d=null},s=function(t){if(!this.activeDialog)return this;var i=l.dialogConfig,e={width:i.width,height:i.height};return"undefined"==typeof i.position||"center"===i.position?(e.top=window.innerHeight/2-e.height/2,e.left=window.innerWidth/2-e.width/2):(e.left=i.position.left||0,e.top=i.position.top||0),e.left<0&&(e.left=0),e.top<0&&(e.top=0),this.activeDialog.css(e),i=null,e=null,this},c=function(t,e,l,n,a){var o=void 0,d=null;if(t.srcElement&&(t.target=t.srcElement),n=i.findParentNode(t.target,function(t){if(t.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(t,i,e,l,n){var a=void 0,o=null;if(t.keyCode==ax5.info.eventKeys.ESC&&this.close(),"prompt"===i.dialogType&&t.keyCode==ax5.info.eventKeys.RETURN){a={self:this,key:n,value:i.btns[n],dialogId:i.id,btnTarget:l};for(var d in i.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,i=null,e=null,l=null,n=null};this.init=function(){this.onStateChanged=n.onStateChanged},this.alert=function(t,e,l){return i.isString(t)&&(t={title:n.title,msg:t}),t=jQuery.extend(!0,{},n,t),t.dialogType="alert",t.theme=t.theme||n.theme||"",t.callback=e,"undefined"==typeof t.btns&&(t.btns={ok:{label:n.lang.ok,theme:t.theme}}),this.activeDialog?this.queue.push(t):d.call(this,t,e),this},this.confirm=function(t,e,l){return i.isString(t)&&(t={title:n.title,msg:t}),t=jQuery.extend(!0,{},n,t),t.dialogType="confirm",t.theme=t.theme||n.theme||"",t.callback=e,"undefined"==typeof t.btns&&(t.btns={ok:{label:n.lang.ok,theme:t.theme},cancel:{label:n.lang.cancel}}),this.activeDialog?this.queue.push(t):d.call(this,t,e),this},this.prompt=function(t,e,l){return i.isString(t)&&(t={title:n.title,msg:t}),t=jQuery.extend(!0,{},n,t),t.dialogType="prompt",t.theme=t.theme||n.theme||"",t.callback=e,"undefined"==typeof t.input&&(t.input={value:{label:""}}),"undefined"==typeof t.btns&&(t.btns={ok:{label:n.lang.ok,theme:t.theme},cancel:{label:n.lang.cancel}}),this.activeDialog?this.queue.push(t):d.call(this,t,e),this},this.close=function(t){var i=void 0,e=void 0;return this.activeDialog&&(this.autoCloseTimer&&clearTimeout(this.autoCloseTimer),i=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:i.id},!i.callback||t&&t.doNotCallback||i.callback.call(e),i&&i.onStateChanged?i.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e),this.queue&&this.queue.length&&d.call(this,this.queue.shift()),i=null,e=null}.bind(this),n.animateTime)),this},this.main=function(){t.dialog_instance=t.dialog_instance||[],t.dialog_instance.push(this),arguments&&i.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return l}()),e=ax5.ui.dialog}(),function(){var t=ax5.ui.dialog,i=function(t){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 '};t.tmpl={dialogDisplay:i,get:function(i,e,l){return ax5.mustache.render(t.tmpl[i].call(this,l),e)}}}(); | ||
"use strict";!function(){var t=ax5.ui,i=ax5.util,e=void 0;t.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,this.queue=[],n=this.config;var a=function(t,i){return t&&t.onStateChanged?t.onStateChanged.call(i,i):this.onStateChanged&&this.onStateChanged.call(i,i),i=null,!0},o=function(t,l){var a={dialogId:t,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(t){return i.isFunction(t)?t.call(l):t}(l.additionalContent)};try{return e.tmpl.get.call(this,"dialogDisplay",a)}finally{a=null}},d=function(t,i){var e={},d=void 0;t.id=t.id||n.id,d={width:t.width},jQuery(document.body).append(o.call(this,t.id,t)),this.dialogConfig=t,this.activeDialog=jQuery("#"+t.id),this.activeDialog.css({width:d.width}),"undefined"==typeof i&&(i=t.callback),t.height=d.height=this.activeDialog.height(),"undefined"==typeof t.position||"center"===t.position?(e.top=jQuery(window).height()/2-d.height/2,e.left=jQuery(window).width()/2-d.width/2):(e.left=t.position.left||0,e.top=t.position.top||0),n.zIndex&&(e["z-index"]=n.zIndex),this.activeDialog.css(e),"prompt"===t.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){u.call(this,e||window.event,t,i)}.bind(this)),jQuery(window).bind("keydown.ax5dialog",function(e){c.call(this,e||window.event,t,i)}.bind(this)),jQuery(window).bind("resize.ax5dialog",function(t){s.call(this,t||window.event)}.bind(this)),a.call(this,t,{self:this,state:"open"}),t.autoCloseTime&&(this.autoCloseTimer=setTimeout(function(){l.close()},t.autoCloseTime)),e=null,d=null},s=function(t){if(!this.activeDialog)return this;var i=l.dialogConfig,e={width:i.width,height:i.height};return"undefined"==typeof i.position||"center"===i.position?(e.top=window.innerHeight/2-e.height/2,e.left=window.innerWidth/2-e.width/2):(e.left=i.position.left||0,e.top=i.position.top||0),e.left<0&&(e.left=0),e.top<0&&(e.top=0),this.activeDialog.css(e),i=null,e=null,this},u=function(t,e,l,n,a){var o=void 0,d=null;if(t.srcElement&&(t.target=t.srcElement),n=i.findParentNode(t.target,function(t){if(t.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){o.input={};for(var s in e.input)if(o.input[s]=this.activeDialog.find("[data-dialog-prompt="+s+"]").val(),e.input[s].required&&(""==o.input[s]||null==o.input[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},c=function(t,i,e,l,n){var a=void 0,o=null;if(t.keyCode==ax5.info.eventKeys.ESC&&this.close(),"prompt"===i.dialogType&&t.keyCode==ax5.info.eventKeys.RETURN){a={self:this,key:n,value:i.btns[n],dialogId:i.id,btnTarget:l};for(var d in i.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,i=null,e=null,l=null,n=null};this.init=function(){this.onStateChanged=n.onStateChanged},this.alert=function(t,e,l){return i.isString(t)&&(t={title:n.title,msg:t}),t=jQuery.extend(!0,{},n,t),t.dialogType="alert",t.theme=t.theme||n.theme||"",t.callback=e,"undefined"==typeof t.btns&&(t.btns={ok:{label:n.lang.ok,theme:t.theme}}),this.activeDialog?this.queue.push(t):d.call(this,t,e),this},this.confirm=function(t,e,l){return i.isString(t)&&(t={title:n.title,msg:t}),t=jQuery.extend(!0,{},n,t),t.dialogType="confirm",t.theme=t.theme||n.theme||"",t.callback=e,"undefined"==typeof t.btns&&(t.btns={ok:{label:n.lang.ok,theme:t.theme},cancel:{label:n.lang.cancel}}),this.activeDialog?this.queue.push(t):d.call(this,t,e),this},this.prompt=function(t,e,l){return i.isString(t)&&(t={title:n.title,msg:t}),t=jQuery.extend(!0,{},n,t),t.dialogType="prompt",t.theme=t.theme||n.theme||"",t.callback=e,"undefined"==typeof t.input&&(t.input={value:{label:""}}),"undefined"==typeof t.btns&&(t.btns={ok:{label:n.lang.ok,theme:t.theme},cancel:{label:n.lang.cancel}}),this.activeDialog?this.queue.push(t):d.call(this,t,e),this},this.close=function(t){var i=void 0,e=void 0;return this.activeDialog&&(this.autoCloseTimer&&clearTimeout(this.autoCloseTimer),i=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:i.id},!i.callback||t&&t.doNotCallback||i.callback.call(e),i&&i.onStateChanged?i.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e),this.queue&&this.queue.length&&d.call(this,this.queue.shift()),i=null,e=null}.bind(this),n.animateTime)),this},this.main=function(){t.dialog_instance=t.dialog_instance||[],t.dialog_instance.push(this),arguments&&i.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return l}()),e=ax5.ui.dialog}(),function(){var t=ax5.ui.dialog,i=function(t){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 '};t.tmpl={dialogDisplay:i,get:function(i,e,l){return ax5.mustache.render(t.tmpl[i].call(this,l),e)}}}(); | ||
//# sourceMappingURL=ax5dialog.min.js.map |
{ | ||
"name": "ax5ui-dialog", | ||
"version": "1.4.108", | ||
"version": "1.4.109", | ||
"description": "A dialog plugin that works with Bootstrap & jQuery", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -96,3 +96,3 @@ // ax5.ui.dialog | ||
else { | ||
return additionalContent; | ||
return additionalContent; | ||
} | ||
@@ -128,3 +128,3 @@ })(opts.additionalContent) | ||
if(typeof callback === "undefined"){ | ||
if (typeof callback === "undefined") { | ||
callback = opts.callback; | ||
@@ -176,3 +176,3 @@ } | ||
if(opts.autoCloseTime) { | ||
if (opts.autoCloseTime) { | ||
this.autoCloseTimer = setTimeout(function () { | ||
@@ -235,5 +235,6 @@ self.close(); | ||
if (opts.dialogType === "prompt") { | ||
that.input = {}; | ||
for (let oi in opts.input) { | ||
that[oi] = this.activeDialog.find('[data-dialog-prompt=' + oi + ']').val(); | ||
if (that[oi] == "" || that[oi] == null) { | ||
that.input[oi] = this.activeDialog.find('[data-dialog-prompt=' + oi + ']').val(); | ||
if (opts.input[oi].required && (that.input[oi] == "" || that.input[oi] == null)) { | ||
emptyKey = oi; | ||
@@ -456,3 +457,3 @@ break; | ||
this.queue.push(opts); | ||
}else{ | ||
} else { | ||
open.call(this, opts, callback); | ||
@@ -516,3 +517,3 @@ } | ||
this.queue.push(opts); | ||
}else{ | ||
} else { | ||
open.call(this, opts, callback); | ||
@@ -537,3 +538,3 @@ } | ||
if (this.activeDialog) { | ||
if(this.autoCloseTimer) clearTimeout(this.autoCloseTimer); | ||
if (this.autoCloseTimer) clearTimeout(this.autoCloseTimer); | ||
@@ -569,3 +570,3 @@ opts = self.dialogConfig; | ||
if(this.queue && this.queue.length) { | ||
if (this.queue && this.queue.length) { | ||
open.call(this, this.queue.shift()); | ||
@@ -572,0 +573,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
144390
1481