modal-box-message
Advanced tools
Comparing version 2.0.9 to 2.1.0
@@ -1,1 +0,1 @@ | ||
"use strict";var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();exports.__esModule=!0;var ElementoBase=function(){function t(t,e,n,i){this.nome=t,this.id=e,this.classe=n,this.parent="string"==typeof i?document.getElementById(i):i}return t.prototype.removeText=function(){for(;this.elementInstance.hasChildNodes();)this.elementInstance.removeChild(this.elementInstance.firstChild)},t.prototype.create=function(){var t=document.createElement(this.nome);return t.id=this.id,t.setAttribute("class",this.classe),this.parent.appendChild(t),this.elementInstance=t,t},t.prototype.attr=function(t,e){if(!e)return this.elementInstance.getAttribute(t);this.elementInstance.setAttribute(t,e)},t.prototype.removeAttr=function(t){this.elementInstance.removeAttribute(t)},t.prototype.removeClass=function(t){var e=[],n=this.elementInstance.getAttribute("class");if(null!=n&&void 0!=n&&n.length>0){var i=n.split(" ");if(null!=i&&void 0!=i&&i.length>0)if(-1!=t.indexOf("@")){var o=t.substring(1,t.length);e=i.filter(function(t){return-1==t.indexOf(o)})}else e=i.filter(function(e){return e!=t});var s=e.join(" ");this.elementInstance.setAttribute("class",s)}},t.prototype.setClass=function(t){var e=this.elementInstance.getAttribute("class");if(null!=e&&void 0!=e&&e.length>0){var n=e.split(" ");if(null!=n&&void 0!=n&&n.length>0){n.push(t);var i=n.join(" ");this.elementInstance.setAttribute("class",i)}else this.elementInstance.setAttribute("class",t)}else this.elementInstance.setAttribute("class",t)},t.prototype.setStyle=function(t){if(-1==t.indexOf(";"))throw new Error("Bad Format: 'name:value;' is correct.");var e=t.split(";");e.pop();var n=this.getStyle(null);if(null!=n){var i=n.split(";"),o=[];e.forEach(function(t,e,n){var s=t.split(":")[0],l=t.split(":")[1];i.forEach(function(e,n,i){var r=e.split(":")[0];e.split(":")[1];if(r==s)return e=[r,l].join(":"),i[n]=e,void o.push(t)})}),e.length!=o.length&&(o.forEach(function(t,n,i){var o=e.indexOf(t);e.splice(o,1)}),i=i.concat(e)),this.attr("style",i.join(";"))}else this.attr("style",t)},t.prototype.getStyle=function(t){if(null==t||void 0==t){var e=this.attr("style",null);return null!=e&&e.lastIndexOf(";")!=e.length-1&&(e+=";"),e}var n=this.attr("style",null);return null==n||void 0==n?null:(n.split(";").forEach(function(e,n,i){var o=e.split(":")[0];if(t==o)return e.split(":")[1]}),null)},t.prototype.removeStyle=function(t){if(null==t||void 0==t)return this.attr("style",null);var e=this.attr("style",null);if(null==e||void 0==e)return null;var n=e.split(";");n.pop();var i=[];n.forEach(function(e,n,o){var s=e.split(":")[0];t!=s&&i.push(e)}),this.attr("style",i.join(";"))},t.prototype.getInstance=function(){return this.elementInstance},t.prototype.on=function(t,e,n){void 0===n&&(n=!1),this.elementInstance.addEventListener(t,e,n)},t}(),ElementoInput=function(t){function e(e,n,i,o){var s=t.call(this,"input",n,i,o)||this;return s.name=n,s.tipo=e,s}return __extends(e,t),e.prototype.create=function(){return this.elementInstance=t.prototype.create.call(this),this.elementInstance.setAttribute("name",this.name),this.elementInstance.setAttribute("type",this.tipo),this.elementInstance},e.prototype.setValue=function(t){document.getElementById(this.id).value=t},e.prototype.getValue=function(){return document.getElementById(this.id).value},e}(ElementoBase),ElementoLabel=function(t){function e(e,n,i){var o=t.call(this,"label","","",i)||this;return o.forId=e,o.text=n,o}return __extends(e,t),e.prototype.create=function(){this.elementInstance=t.prototype.create.call(this),this.elementInstance.setAttribute("for",this.forId);var e=document.createTextNode(this.text);return this.elementInstance.appendChild(e),this.elementInstance},e}(ElementoBase),ElementoButton=function(t){function e(e,n,i,o){var s=t.call(this,"button",e,n,i)||this;return s.text=o,s}return __extends(e,t),e.prototype.create=function(){this.elementInstance=t.prototype.create.call(this);var e=document.createTextNode(this.text);return this.elementInstance.appendChild(e),this.elementInstance},e.prototype.setText=function(t){this.removeText();var e=document.createTextNode(t);this.elementInstance.appendChild(e)},e}(ElementoBase),ElementoText=function(t){function e(e,n,i,o){var s=t.call(this,"div",e,n,i)||this;return s.text=o,s}return __extends(e,t),e.prototype.create=function(){this.elementInstance=t.prototype.create.call(this);var e=document.createTextNode(this.text);return this.elementInstance.appendChild(e),this.elementInstance},e.prototype.setText=function(t){this.removeText();var e=document.createTextNode(t);this.elementInstance.appendChild(e)},e.prototype.getText=function(){return this.elementInstance.firstChild},e}(ElementoBase),ElementoInputForm=function(t){function e(e,n){var i=t.call(this,"div","MB-inlineInputBox","MBM-inlineInputBox",n)||this;return i.label=e,i}return __extends(e,t),e.prototype.create=function(){return this.elementInstance=t.prototype.create.call(this),this.labelElement=new ElementoLabel("id-"+this.label,this.label,this.elementInstance),this.inputElement=new ElementoInput("text","id-"+this.label,"MBM-inputElement",this.elementInstance),this.errorText=new ElementoText("ErrorText-"+this.label,"MBM-ErrorText",this.elementInstance,""),this.N_labelElement=this.labelElement.create(),this.N_inputElement=this.inputElement.create(),this.N_errorText=this.errorText.create(),this.errorText.setStyle("display:none;"),this.elementInstance},e.prototype.getValue=function(){return this.inputElement.getValue()},e.prototype.setValue=function(t){this.inputElement.setValue(t)},e.prototype.showErrorMessage=function(t){this.errorText.setText(t),this.errorText.setStyle("display:block;")},e.prototype.hideErrorMessage=function(){this.errorText.setText(""),this.errorText.setStyle("display:none;")},e}(ElementoBase),Overlay=function(t){function e(e){void 0===e&&(e=!1);var n=t.call(this,"div","MB-Overlay","MBM-Overlay",document.getElementsByTagName("body")[0])||this;n.visibility=!1,n.visibility=e;var i=n.visibility?"display:block;":"display:none;",o="width:"+window.innerWidth+"px;",s="height:"+window.innerHeight+"px;";return n.stileDefault=i+o+s+"position:fixed;top:0;left:0;z-index:1000;",n}return __extends(e,t),e.prototype.create=function(){return this.elementInstance=t.prototype.create.call(this),this.setStyle(this.stileDefault),this.elementInstance},e.prototype.setVisibility=function(t){this.visibility=t;var e=this.visibility?"display:block;":"display:none;",n="width:"+window.innerWidth+"px;",i="height:"+window.innerHeight+"px;";this.setStyle(e+n+i)},e}(ElementoBase),Box=function(t){function e(e,n,i){void 0===e&&(e=!1),void 0===n&&(n="400px"),void 0===i&&(i="auto");var o=t.call(this,"div","MB-Box","MBM-box",document.getElementsByTagName("body")[0])||this;o.visibility=!1,o.visibility=e;var s=o.visibility?"display:block;":"display:none;";return o.width="width:"+n+";",o.height="height:"+i+";",o.stileDefault=s+o.width+o.height+"top:0px;left:0px;position:fixed;z-index:1001;background-color:white;opacity:1;",o}return __extends(e,t),e.prototype.create=function(){return this.elementInstance=t.prototype.create.call(this),this.setStyle(this.stileDefault),this.elementInstance},e.prototype.setVisibility=function(t){this.visibility=t;var e=this.visibility?"display:block;":"display:none;";this.setStyle(e)},e}(ElementoBase),ModalBoxMessage=function(){function t(t,e,n){void 0===t&&(t=""),void 0===e&&(e=""),void 0===n&&(n="Ok"),this.overlay=new Overlay(!1),this.mainBox=new Box(!1);this.overlay.create();var i=this.mainBox.create();this.genTitolo(i,t),this.genTesto(i,e),this.genButtonBox(i,n),this.genCssReference()}return t.prototype.genTitolo=function(t,e){this.titleBox=new ElementoBase("div","MB-titleBox","MBM-titleBox",t);var n=this.titleBox.create();this.titleBox.setStyle("min-height:17px;"),this.titleText=new ElementoText("MB-Text","MBM-Text",n,e);this.titleText.create();this.titleText.setStyle("position:relative;max-width:90%;float:left;"),this.closeButton=new ElementoButton("MB-closeButton","MBM-closeButton",n,"X");this.closeButton.create();this.closeButton.setStyle("position:relative;min-width:16px;min-height:17px;padding:0;font-weight:700;float:right;");var i=this;this.closeButton.on("click",function(t){i.Close()})},t.prototype.genTesto=function(t,e){this.textBox=new ElementoBase("div","MB-TextBox","MBM-TextBox",t);var n=this.textBox.create();this.text=new ElementoText("MB-Text","MBM-Text",n,e);this.text.create()},t.prototype.genButtonBox=function(t,e){this.buttonBox=new ElementoBase("div","MB-buttonBox","MBM-buttonBox",t);var n=this.buttonBox.create();this.okButton=new ElementoButton("MB-okButton","MBM-okButton",n,e);this.okButton.create();var i=this;this.okButton.on("click",function(){i.Close()})},t.prototype.getComputed=function(t,e){var n;return n=window.getComputedStyle(t,null).getPropertyValue(e),parseInt(n.substring(0,n.length-2))},t.prototype.calculateTop=function(){var t=-1,e=window.innerHeight,n=this.getComputed(this.mainBox.getInstance(),"height");return e<=n?(this.mainBox.setStyle("overflow-y:scroll;height:"+e.toString()+"px;"),0):(this.mainBox.removeStyle("overflow-y"),t=(e-n)/2,t-=n)},t.prototype.calculateLeft=function(){var t=window.innerWidth,e=this.getComputed(this.mainBox.getInstance(),"width");return t<=e?(this.mainBox.setStyle("overflow-x:scroll;width:"+t.toString()+"px;"),0):(this.mainBox.removeStyle("overflow-x"),(t-e)/2)},t.prototype.genCssReference=function(){var t=document.getElementsByTagName("head")[0],e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href","node_modules/Modal-Box-Message/dist/ModalBoxMessage.css"),t.appendChild(e)},t.prototype.Open=function(){this.overlay.setVisibility(!0),this.mainBox.setVisibility(!0);var t=this.calculateTop(),e=this.calculateLeft();this.mainBox.setStyle("top:"+t+"px;left:"+e+"px;")},t.prototype.Close=function(){this.overlay.setVisibility(!1),this.mainBox.setVisibility(!1)},t.prototype.setTitle=function(t){this.titleText.setText(t)},t.prototype.setMessage=function(t){this.text.setText(t)},t.prototype.setOKButtonText=function(t){this.okButton.setText(t)},t}();exports.ModalBoxMessage=ModalBoxMessage; | ||
"use strict";var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();exports.__esModule=!0;var ElementoBase=function(){function t(t,e,n,i){this.nome=t,this.id=e,this.classe=n,this.parent="string"==typeof i?document.getElementById(i):i}return t.prototype.removeText=function(){for(;this.elementInstance.hasChildNodes();)this.elementInstance.removeChild(this.elementInstance.firstChild)},t.prototype.create=function(){var t=document.createElement(this.nome);return t.id=this.id,t.setAttribute("class",this.classe),this.parent.appendChild(t),this.elementInstance=t,t},t.prototype.attr=function(t,e){if(!e)return this.elementInstance.getAttribute(t);this.elementInstance.setAttribute(t,e)},t.prototype.removeAttr=function(t){this.elementInstance.removeAttribute(t)},t.prototype.removeClass=function(t){var e=[],n=this.elementInstance.getAttribute("class");if(null!=n&&void 0!=n&&n.length>0){var i=n.split(" ");if(null!=i&&void 0!=i&&i.length>0)if(-1!=t.indexOf("@")){var o=t.substring(1,t.length);e=i.filter(function(t){return-1==t.indexOf(o)})}else e=i.filter(function(e){return e!=t});var s=e.join(" ");this.elementInstance.setAttribute("class",s)}},t.prototype.setClass=function(t){var e=this.elementInstance.getAttribute("class");if(null!=e&&void 0!=e&&e.length>0){var n=e.split(" ");if(null!=n&&void 0!=n&&n.length>0){n.push(t);var i=n.join(" ");this.elementInstance.setAttribute("class",i)}else this.elementInstance.setAttribute("class",t)}else this.elementInstance.setAttribute("class",t)},t.prototype.setStyle=function(t){if(-1==t.indexOf(";"))throw new Error("Bad Format: 'name:value;' is correct.");var e=t.split(";");e.pop();var n=this.getStyle(null);if(null!=n){var i=n.split(";"),o=[];e.forEach(function(t,e,n){var s=t.split(":")[0],l=t.split(":")[1];i.forEach(function(e,n,i){var r=e.split(":")[0];e.split(":")[1];if(r==s)return e=[r,l].join(":"),i[n]=e,void o.push(t)})}),e.length!=o.length&&(o.forEach(function(t,n,i){var o=e.indexOf(t);e.splice(o,1)}),i=i.concat(e)),this.attr("style",i.join(";"))}else this.attr("style",t)},t.prototype.getStyle=function(t){if(null==t||void 0==t){var e=this.attr("style",null);return null!=e&&e.lastIndexOf(";")!=e.length-1&&(e+=";"),e}var n=this.attr("style",null);return null==n||void 0==n?null:(n.split(";").forEach(function(e,n,i){var o=e.split(":")[0];if(t==o)return e.split(":")[1]}),null)},t.prototype.removeStyle=function(t){if(null==t||void 0==t)return this.attr("style",null);var e=this.attr("style",null);if(null==e||void 0==e)return null;var n=e.split(";");n.pop();var i=[];n.forEach(function(e,n,o){var s=e.split(":")[0];t!=s&&i.push(e)}),this.attr("style",i.join(";"))},t.prototype.getInstance=function(){return this.elementInstance},t.prototype.on=function(t,e,n){void 0===n&&(n=!1),this.elementInstance.addEventListener(t,e,n)},t}(),ElementoInput=function(t){function e(e,n,i,o){var s=t.call(this,"input",n,i,o)||this;return s.name=n,s.tipo=e,s}return __extends(e,t),e.prototype.create=function(){return this.elementInstance=t.prototype.create.call(this),this.elementInstance.setAttribute("name",this.name),this.elementInstance.setAttribute("type",this.tipo),this.elementInstance},e.prototype.setValue=function(t){document.getElementById(this.id).value=t},e.prototype.getValue=function(){return document.getElementById(this.id).value},e}(ElementoBase),ElementoLabel=function(t){function e(e,n,i){var o=t.call(this,"label","","",i)||this;return o.forId=e,o.text=n,o}return __extends(e,t),e.prototype.create=function(){this.elementInstance=t.prototype.create.call(this),this.elementInstance.setAttribute("for",this.forId);var e=document.createTextNode(this.text);return this.elementInstance.appendChild(e),this.elementInstance},e}(ElementoBase),ElementoButton=function(t){function e(e,n,i,o){var s=t.call(this,"button",e,n,i)||this;return s.text=o,s}return __extends(e,t),e.prototype.create=function(){this.elementInstance=t.prototype.create.call(this);var e=document.createTextNode(this.text);return this.elementInstance.appendChild(e),this.elementInstance},e.prototype.setText=function(t){this.removeText();var e=document.createTextNode(t);this.elementInstance.appendChild(e)},e}(ElementoBase),ElementoText=function(t){function e(e,n,i,o){var s=t.call(this,"div",e,n,i)||this;return s.text=o,s}return __extends(e,t),e.prototype.create=function(){this.elementInstance=t.prototype.create.call(this);var e=document.createTextNode(this.text);return this.elementInstance.appendChild(e),this.elementInstance},e.prototype.setText=function(t){this.removeText();var e=document.createTextNode(t);this.elementInstance.appendChild(e)},e.prototype.getText=function(){return this.elementInstance.firstChild},e}(ElementoBase),ElementoInputForm=function(t){function e(e,n){var i=t.call(this,"div","MB-inlineInputBox","MBM-inlineInputBox",n)||this;return i.label=e,i}return __extends(e,t),e.prototype.create=function(){return this.elementInstance=t.prototype.create.call(this),this.labelElement=new ElementoLabel("id-"+this.label,this.label,this.elementInstance),this.inputElement=new ElementoInput("text","id-"+this.label,"MBM-inputElement",this.elementInstance),this.errorText=new ElementoText("ErrorText-"+this.label,"MBM-ErrorText",this.elementInstance,""),this.N_labelElement=this.labelElement.create(),this.N_inputElement=this.inputElement.create(),this.N_errorText=this.errorText.create(),this.errorText.setStyle("display:none;"),this.elementInstance},e.prototype.getValue=function(){return this.inputElement.getValue()},e.prototype.setValue=function(t){this.inputElement.setValue(t)},e.prototype.showErrorMessage=function(t){this.errorText.setText(t),this.errorText.setStyle("display:block;")},e.prototype.hideErrorMessage=function(){this.errorText.setText(""),this.errorText.setStyle("display:none;")},e}(ElementoBase),Overlay=function(t){function e(e){void 0===e&&(e=!1);var n=t.call(this,"div","MB-Overlay","MBM-Overlay",document.getElementsByTagName("body")[0])||this;n.visibility=!1,n.visibility=e;var i=n.visibility?"display:block;":"display:none;",o="width:"+window.innerWidth+"px;",s="height:"+window.innerHeight+"px;";return n.stileDefault=i+o+s+"position:fixed;top:0;left:0;z-index:1000;",n}return __extends(e,t),e.prototype.create=function(){return this.elementInstance=t.prototype.create.call(this),this.setStyle(this.stileDefault),this.elementInstance},e.prototype.setVisibility=function(t){this.visibility=t;var e=this.visibility?"display:block;":"display:none;",n="width:"+window.innerWidth+"px;",i="height:"+window.innerHeight+"px;";this.setStyle(e+n+i)},e}(ElementoBase),Box=function(t){function e(e,n,i){void 0===e&&(e=!1),void 0===n&&(n="400px"),void 0===i&&(i="auto");var o=t.call(this,"div","MB-Box","MBM-box",document.getElementsByTagName("body")[0])||this;o.visibility=!1,o.visibility=e;var s=o.visibility?"display:block;":"display:none;";return o.width="width:"+n+";",o.height="height:"+i+";",o.stileDefault=s+o.width+o.height+"top:0px;left:0px;position:fixed;z-index:1001;background-color:white;opacity:1;",o}return __extends(e,t),e.prototype.create=function(){return this.elementInstance=t.prototype.create.call(this),this.setStyle(this.stileDefault),this.elementInstance},e.prototype.setVisibility=function(t){this.visibility=t;var e=this.visibility?"display:block;":"display:none;";this.setStyle(e)},e}(ElementoBase),ModalBoxMessage=function(){function t(t,e,n){void 0===t&&(t=""),void 0===e&&(e=""),void 0===n&&(n="Ok"),this.overlay=new Overlay(!1),this.mainBox=new Box(!1);this.overlay.create();var i=this.mainBox.create();this.genTitolo(i,t),this.genTesto(i,e),this.genButtonBox(i,n),this.genCssReference()}return t.prototype.genTitolo=function(t,e){this.titleBox=new ElementoBase("div","MB-titleBox","MBM-titleBox",t);var n=this.titleBox.create();this.titleBox.setStyle("min-height:17px;"),this.titleText=new ElementoText("MB-Text","MBM-Text",n,e);this.titleText.create();this.titleText.setStyle("position:relative;max-width:90%;float:left;"),this.closeButton=new ElementoButton("MB-closeButton","MBM-closeButton",n,"X");this.closeButton.create();var i=this;this.closeButton.on("click",function(t){i.Close()})},t.prototype.genTesto=function(t,e){this.textBox=new ElementoBase("div","MB-TextBox","MBM-TextBox",t);var n=this.textBox.create();this.text=new ElementoText("MB-Text","MBM-Text",n,e);this.text.create()},t.prototype.genButtonBox=function(t,e){this.buttonBox=new ElementoBase("div","MB-buttonBox","MBM-buttonBox",t);var n=this.buttonBox.create();this.okButton=new ElementoButton("MB-okButton","MBM-okButton",n,e);this.okButton.create();var i=this;this.okButton.on("click",function(){i.Close()})},t.prototype.getComputed=function(t,e){var n;return n=window.getComputedStyle(t,null).getPropertyValue(e),parseInt(n.substring(0,n.length-2))},t.prototype.calculateTop=function(){var t=-1,e=window.innerHeight,n=this.getComputed(this.mainBox.getInstance(),"height");return e<=n?(this.mainBox.setStyle("overflow-y:scroll;height:"+e.toString()+"px;"),0):(this.mainBox.removeStyle("overflow-y"),t=(e-n)/2,t-=n)},t.prototype.calculateLeft=function(){var t=window.innerWidth,e=this.getComputed(this.mainBox.getInstance(),"width");return t<=e?(this.mainBox.setStyle("overflow-x:scroll;width:"+t.toString()+"px;"),0):(this.mainBox.removeStyle("overflow-x"),(t-e)/2)},t.prototype.genCssReference=function(){var t=document.getElementsByTagName("head")[0],e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("href","node_modules/Modal-Box-Message/dist/ModalBoxMessage.css"),t.appendChild(e)},t.prototype.Open=function(){this.overlay.setVisibility(!0),this.mainBox.setVisibility(!0);var t=this.calculateTop(),e=this.calculateLeft();this.mainBox.setStyle("top:"+t+"px;left:"+e+"px;")},t.prototype.Close=function(){this.overlay.setVisibility(!1),this.mainBox.setVisibility(!1)},t.prototype.setTitle=function(t){this.titleText.setText(t)},t.prototype.setMessage=function(t){this.text.setText(t)},t.prototype.setOKButtonText=function(t){this.okButton.setText(t)},t}();exports.ModalBoxMessage=ModalBoxMessage; |
{ | ||
"name": "modal-box-message", | ||
"version": "2.0.9", | ||
"version": "2.1.0", | ||
"description": "[style debugged] A modal box for display a message", | ||
@@ -5,0 +5,0 @@ "main": "./dist/ModalBoxMessage.js", |
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
315
19061