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

ax5ui-dialog

Package Overview
Dependencies
Maintainers
1
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ax5ui-dialog - npm Package Compare versions

Comparing version 0.6.5 to 0.6.6

deploy.sh

7

API.md
# Basic Usage
> dialog is a UI that can be used as an alternative means of window.alert, window.confirm and window.prompt
How to initialize the properties of the UI, there are two.
You can pass the property values of the UI to `setConfig`.
Using the `new` you can pass when you initialize the UI.
## setConfig()
`setConfig([options])`
You define the default settings for the dialog. Create a ax5.ui.dialog instance, using the setConfig method in that instance, you can define a default value.
`setConfig([options, callInit=true])`

@@ -8,0 +11,0 @@ ```js

{
"name": "ax5ui-dialog",
"version": "0.6.5",
"version": "0.6.6",
"authors": [

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

@@ -9,3 +9,3 @@ 'use strict';

* @classdesc
* @version 0.6.5
* @version 0.6.6
* @author tom@axisj.com

@@ -47,2 +47,4 @@ * @example

}
that = null;
return true;

@@ -64,3 +66,8 @@ },

};
return ax5.mustache.render(getContentTmpl(), data);
try {
return ax5.mustache.render(getContentTmpl(), data);
} finally {
data = null;
}
},

@@ -118,2 +125,5 @@ open = function open(opts, callBack) {

});
pos = null;
box = null;
},

@@ -136,5 +146,10 @@ align = function align(e) {

this.activeDialog.css(box);
opts = null;
box = null;
return this;
},
btnOnClick = function btnOnClick(e, opts, callBack, target, k) {
var that;
if (e.srcElement) e.target = e.srcElement;

@@ -151,3 +166,3 @@

var that = {
that = {
self: this,

@@ -187,4 +202,13 @@ key: k, value: opts.btns[k],

}
that = null;
opts = null;
callBack = null;
target = null;
k = null;
},
onKeyup = function onKeyup(e, opts, callBack, target, k) {
var that,
emptyKey = null;
if (e.keyCode == ax5.info.eventKeys.ESC) {

@@ -195,3 +219,3 @@ this.close();

if (e.keyCode == ax5.info.eventKeys.RETURN) {
var that = {
that = {
self: this,

@@ -202,3 +226,3 @@ key: k, value: opts.btns[k],

};
var emptyKey = null;
for (var oi in opts.input) {

@@ -211,3 +235,7 @@ that[oi] = this.activeDialog.find('[data-dialog-prompt=' + oi + ']').val();

}
if (emptyKey) return false;
if (emptyKey) {
that = null;
emptyKey = null;
return false;
}
if (callBack) callBack.call(that, k);

@@ -217,2 +245,9 @@ this.close();

}
that = null;
emptyKey = null;
opts = null;
callBack = null;
target = null;
k = null;
};

@@ -274,2 +309,5 @@

open.call(this, opts, callBack);
opts = null;
callBack = null;
return this;

@@ -318,2 +356,5 @@ };

open.call(this, opts, callBack);
opts = null;
callBack = null;
return this;

@@ -368,2 +409,5 @@ };

open.call(this, opts, callBack);
opts = null;
callBack = null;
return this;

@@ -400,2 +444,5 @@ };

}
opts = null;
that = null;
}.bind(this), cfg.animateTime);

@@ -402,0 +449,0 @@ }

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

"use strict";!function(t,i){var e=ax5.util,n=function(){var t,n=this;i&&i.call(this),this.activeDialog=null,this.config={clickEventName:"click",theme:"default",width:300,title:"",msg:"",lang:{ok:"ok",cancel:"cancel"},animateTime:250},t=this.config,t.id="ax5-dialog-"+ax5.getGuid();var a=function(t,i){return t&&t.onStateChanged?t.onStateChanged.call(i,i):this.onStateChanged&&this.onStateChanged.call(i,i),!0},l=function(){return'\n <div id="{{dialogId}}" data-ax5-ui="dialog" class="ax5-ui-dialog {{theme}}">\n <div class="ax-dialog-heading">\n {{{title}}}\n </div>\n <div class="ax-dialog-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">\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 </div>\n </div> \n '},o=function(i,e){var n={dialogId:i,title:e.title||t.title||"",msg:(e.msg||t.msg||"").replace(/\n/g,"<br/>"),input:e.input,btns:e.btns,_crlf:function(){return this.replace(/\n/g,"<br/>")}};return ax5.mustache.render(l(),n)},s=function(i,e){var n,l={};i.id=i.id||t.id,n={width:i.width},jQuery(document.body).append(o.call(this,i.id,i)),this.activeDialog=jQuery("#"+i.id),this.activeDialog.css({width:n.width}),i.height=n.height=this.activeDialog.height(),"undefined"==typeof i.position||"center"===i.position?(l.top=jQuery(window).height()/2-n.height/2,l.left=jQuery(window).width()/2-n.width/2):(l.left=i.position.left||0,l.top=i.position.top||0),this.activeDialog.css(l),"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(t.clickEventName,function(t){g.call(this,t||window.event,i,e)}.bind(this)),jQuery(window).bind("keydown.ax5dialog",function(t){c.call(this,t||window.event,i,e)}.bind(this)),jQuery(window).bind("resize.ax5dialog",function(t){d.call(this,t||window.event)}.bind(this)),a.call(this,i,{self:this,state:"open"})},d=function(t){if(!this.activeDialog)return this;var i=n.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),this.activeDialog.css(e),this},g=function(t,i,n,a,l){if(t.srcElement&&(t.target=t.srcElement),a=e.findParentNode(t.target,function(t){return t.getAttribute("data-dialog-btn")?!0:void 0})){l=a.getAttribute("data-dialog-btn");var o={self:this,key:l,value:i.btns[l],dialogId:i.id,btnTarget:a};if("prompt"===i.dialogType){var s=null;for(var d in i.input)if(o[d]=this.activeDialog.find("[data-dialog-prompt="+d+"]").val(),""==o[d]||null==o[d]){s=d;break}}if(i.btns[l].onClick)i.btns[l].onClick.call(o,l);else if("alert"===i.dialogType)n&&n.call(o,l),this.close();else if("confirm"===i.dialogType)n&&n.call(o,l),this.close();else if("prompt"===i.dialogType){if("ok"===l&&s)return this.activeDialog.find('[data-dialog-prompt="'+s+'"]').get(0).focus(),!1;n&&n.call(o,l),this.close()}}},c=function(t,i,e,n,a){if(t.keyCode==ax5.info.eventKeys.ESC&&this.close(),"prompt"===i.dialogType&&t.keyCode==ax5.info.eventKeys.RETURN){var l={self:this,key:a,value:i.btns[a],dialogId:i.id,btnTarget:n},o=null;for(var s in i.input)if(l[s]=this.activeDialog.find("[data-dialog-prompt="+s+"]").val(),""==l[s]||null==l[s]){o=s;break}if(o)return!1;e&&e.call(l,a),this.close()}};this.init=function(){this.onStateChanged=t.onStateChanged},this.alert=function(i,a){return e.isString(i)&&(i={title:t.title,msg:i}),this.activeDialog?(console.log(ax5.info.getError("ax5dialog","501","alert")),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,t,i),i=n.dialogConfig,i.dialogType="alert","undefined"==typeof i.btns&&(i.btns={ok:{label:t.lang.ok,theme:i.theme}}),s.call(this,i,a),this)},this.confirm=function(i,a){return e.isString(i)&&(i={title:t.title,msg:i}),this.activeDialog?(console.log(ax5.info.getError("ax5dialog","501","confirm")),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,t,i),i=n.dialogConfig,i.dialogType="confirm",i.theme=i.theme||t.theme||"","undefined"==typeof i.btns&&(i.btns={ok:{label:t.lang.ok,theme:i.theme},cancel:{label:t.lang.cancel}}),s.call(this,i,a),this)},this.prompt=function(i,a){return e.isString(i)&&(i={title:t.title,msg:i}),this.activeDialog?(console.log(ax5.info.getError("ax5dialog","501","prompt")),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,t,i),i=n.dialogConfig,i.dialogType="prompt",i.theme=i.theme||t.theme||"","undefined"==typeof i.input&&(i.input={value:{label:""}}),"undefined"==typeof i.btns&&(i.btns={ok:{label:t.lang.ok,theme:i.theme},cancel:{label:t.lang.cancel}}),s.call(this,i,a),this)},this.close=function(i,e){return this.activeDialog&&(i=n.dialogConfig,this.activeDialog.addClass("destroy"),jQuery(window).unbind("keydown.ax5dialog"),jQuery(window).unbind("resize.ax5dialog"),setTimeout(function(){this.activeDialog.remove(),this.activeDialog=null,e={self:this,state:"close"},i&&i.onStateChanged?i.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e)}.bind(this),t.animateTime)),this},this.main=function(){arguments&&e.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};t.dialog=function(){return e.isFunction(i)&&(n.prototype=new i),n}()}(ax5.ui,ax5.ui.root);
"use strict";!function(t,i){var e=ax5.util,n=function(){var t,n=this;i&&i.call(this),this.activeDialog=null,this.config={clickEventName:"click",theme:"default",width:300,title:"",msg:"",lang:{ok:"ok",cancel:"cancel"},animateTime:250},t=this.config,t.id="ax5-dialog-"+ax5.getGuid();var l=function(t,i){return t&&t.onStateChanged?t.onStateChanged.call(i,i):this.onStateChanged&&this.onStateChanged.call(i,i),i=null,!0},a=function(){return'\n <div id="{{dialogId}}" data-ax5-ui="dialog" class="ax5-ui-dialog {{theme}}">\n <div class="ax-dialog-heading">\n {{{title}}}\n </div>\n <div class="ax-dialog-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">\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 </div>\n </div> \n '},o=function(i,e){var n={dialogId:i,title:e.title||t.title||"",msg:(e.msg||t.msg||"").replace(/\n/g,"<br/>"),input:e.input,btns:e.btns,_crlf:function(){return this.replace(/\n/g,"<br/>")}};try{return ax5.mustache.render(a(),n)}finally{n=null}},s=function(i,e){var n,a={};i.id=i.id||t.id,n={width:i.width},jQuery(document.body).append(o.call(this,i.id,i)),this.activeDialog=jQuery("#"+i.id),this.activeDialog.css({width:n.width}),i.height=n.height=this.activeDialog.height(),"undefined"==typeof i.position||"center"===i.position?(a.top=jQuery(window).height()/2-n.height/2,a.left=jQuery(window).width()/2-n.width/2):(a.left=i.position.left||0,a.top=i.position.top||0),this.activeDialog.css(a),"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(t.clickEventName,function(t){g.call(this,t||window.event,i,e)}.bind(this)),jQuery(window).bind("keydown.ax5dialog",function(t){u.call(this,t||window.event,i,e)}.bind(this)),jQuery(window).bind("resize.ax5dialog",function(t){d.call(this,t||window.event)}.bind(this)),l.call(this,i,{self:this,state:"open"}),a=null,n=null},d=function(t){if(!this.activeDialog)return this;var i=n.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),this.activeDialog.css(e),i=null,e=null,this},g=function(t,i,n,l,a){var o;if(t.srcElement&&(t.target=t.srcElement),l=e.findParentNode(t.target,function(t){return t.getAttribute("data-dialog-btn")?!0:void 0})){if(a=l.getAttribute("data-dialog-btn"),o={self:this,key:a,value:i.btns[a],dialogId:i.id,btnTarget:l},"prompt"===i.dialogType){var s=null;for(var d in i.input)if(o[d]=this.activeDialog.find("[data-dialog-prompt="+d+"]").val(),""==o[d]||null==o[d]){s=d;break}}if(i.btns[a].onClick)i.btns[a].onClick.call(o,a);else if("alert"===i.dialogType)n&&n.call(o,a),this.close();else if("confirm"===i.dialogType)n&&n.call(o,a),this.close();else if("prompt"===i.dialogType){if("ok"===a&&s)return this.activeDialog.find('[data-dialog-prompt="'+s+'"]').get(0).focus(),!1;n&&n.call(o,a),this.close()}}o=null,i=null,n=null,l=null,a=null},u=function(t,i,e,n,l){var a,o=null;if(t.keyCode==ax5.info.eventKeys.ESC&&this.close(),"prompt"===i.dialogType&&t.keyCode==ax5.info.eventKeys.RETURN){a={self:this,key:l,value:i.btns[l],dialogId:i.id,btnTarget:n};for(var s in i.input)if(a[s]=this.activeDialog.find("[data-dialog-prompt="+s+"]").val(),""==a[s]||null==a[s]){o=s;break}if(o)return a=null,o=null,!1;e&&e.call(a,l),this.close()}a=null,o=null,i=null,e=null,n=null,l=null};this.init=function(){this.onStateChanged=t.onStateChanged},this.alert=function(i,l){return e.isString(i)&&(i={title:t.title,msg:i}),this.activeDialog?(console.log(ax5.info.getError("ax5dialog","501","alert")),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,t,i),i=n.dialogConfig,i.dialogType="alert","undefined"==typeof i.btns&&(i.btns={ok:{label:t.lang.ok,theme:i.theme}}),s.call(this,i,l),i=null,l=null,this)},this.confirm=function(i,l){return e.isString(i)&&(i={title:t.title,msg:i}),this.activeDialog?(console.log(ax5.info.getError("ax5dialog","501","confirm")),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,t,i),i=n.dialogConfig,i.dialogType="confirm",i.theme=i.theme||t.theme||"","undefined"==typeof i.btns&&(i.btns={ok:{label:t.lang.ok,theme:i.theme},cancel:{label:t.lang.cancel}}),s.call(this,i,l),i=null,l=null,this)},this.prompt=function(i,l){return e.isString(i)&&(i={title:t.title,msg:i}),this.activeDialog?(console.log(ax5.info.getError("ax5dialog","501","prompt")),this):(n.dialogConfig={},jQuery.extend(!0,n.dialogConfig,t,i),i=n.dialogConfig,i.dialogType="prompt",i.theme=i.theme||t.theme||"","undefined"==typeof i.input&&(i.input={value:{label:""}}),"undefined"==typeof i.btns&&(i.btns={ok:{label:t.lang.ok,theme:i.theme},cancel:{label:t.lang.cancel}}),s.call(this,i,l),i=null,l=null,this)},this.close=function(i,e){return this.activeDialog&&(i=n.dialogConfig,this.activeDialog.addClass("destroy"),jQuery(window).unbind("keydown.ax5dialog"),jQuery(window).unbind("resize.ax5dialog"),setTimeout(function(){this.activeDialog.remove(),this.activeDialog=null,e={self:this,state:"close"},i&&i.onStateChanged?i.onStateChanged.call(e,e):this.onStateChanged&&this.onStateChanged.call(e,e),i=null,e=null}.bind(this),t.animateTime)),this},this.main=function(){arguments&&e.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};t.dialog=function(){return e.isFunction(i)&&(n.prototype=new i),n}()}(ax5.ui,ax5.ui.root);
{
"name": "ax5ui-dialog",
"version": "0.6.5",
"version": "0.6.6",
"description": "A dialog plugin that works with Bootstrap & jQuery",

@@ -5,0 +5,0 @@ "license": "apache 2.0",

@@ -7,3 +7,3 @@ // ax5.ui.dialog

* @classdesc
* @version 0.6.5
* @version 0.6.6
* @author tom@axisj.com

@@ -48,2 +48,4 @@ * @example

}
that = null;
return true;

@@ -101,3 +103,9 @@ },

};
return ax5.mustache.render(getContentTmpl(), data);
try {
return ax5.mustache.render(getContentTmpl(), data);
}
finally {
data = null;
}
},

@@ -159,2 +167,5 @@ open = function (opts, callBack) {

});
pos = null;
box = null;
},

@@ -179,5 +190,10 @@ align = function (e) {

this.activeDialog.css(box);
opts = null;
box = null;
return this;
},
btnOnClick = function (e, opts, callBack, target, k) {
var that;
if (e.srcElement) e.target = e.srcElement;

@@ -194,3 +210,3 @@

var that = {
that = {
self: this,

@@ -233,4 +249,14 @@ key: k, value: opts.btns[k],

}
that = null;
opts = null;
callBack = null;
target = null;
k = null;
},
onKeyup = function (e, opts, callBack, target, k) {
var
that,
emptyKey = null;
if (e.keyCode == ax5.info.eventKeys.ESC) {

@@ -241,3 +267,3 @@ this.close();

if (e.keyCode == ax5.info.eventKeys.RETURN) {
var that = {
that = {
self: this,

@@ -248,3 +274,3 @@ key: k, value: opts.btns[k],

};
var emptyKey = null;
for (var oi in opts.input) {

@@ -257,3 +283,7 @@ that[oi] = this.activeDialog.find('[data-dialog-prompt=' + oi + ']').val();

}
if (emptyKey) return false;
if (emptyKey){
that = null;
emptyKey = null;
return false;
}
if (callBack) callBack.call(that, k);

@@ -263,2 +293,9 @@ this.close();

}
that = null;
emptyKey = null;
opts = null;
callBack = null;
target = null;
k = null;
};

@@ -321,2 +358,5 @@

open.call(this, opts, callBack);
opts = null;
callBack = null;
return this;

@@ -365,2 +405,5 @@ };

open.call(this, opts, callBack);
opts = null;
callBack = null;
return this;

@@ -415,2 +458,5 @@ };

open.call(this, opts, callBack);
opts = null;
callBack = null;
return this;

@@ -448,2 +494,5 @@ };

}
opts = null;
that = null;
}).bind(this), cfg.animateTime);

@@ -450,0 +499,0 @@ }

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