Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/currency/money-editor/dist/ |
Upload File : |
this.BX=this.BX||{};(function(e,t){"use strict";var i=function(){function e(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);this.input=i.input;this.callback=i.callback;this.currency=i.currency;this.value=i.value||"";this.valueEditHandler=this.valueEdit.bind(this);t.Event.ready(this.init.bind(this))}babelHelpers.createClass(e,[{key:"init",value:function e(){this.formatValue();t.Event.bind(this.input,"bxchange",this.valueEditHandler);t.Event.unbind(this.input,"change",this.valueEditHandler)}},{key:"clean",value:function e(){t.Event.unbind(this.input,"bxchange",this.valueEditHandler);this.input=null}},{key:"valueEdit",value:function e(t){if(!!t&&t.type==="keyup"&&t.code==="Tab"){return}this.formatValue()}},{key:"setCurrency",value:function t(i){this.value=e.getUnFormattedValue(this.input.value,this.currency);this.currency=i;this.input.value=e.getFormattedValue(this.value,this.currency);this.callValueChangeCallback()}},{key:"formatValue",value:function e(){var t=BX.getCaretPosition(this.input);var i=this.input.value;this.changeValue();if(i.length>0){BX.setCaretPosition(this.input,t-i.length+this.input.value.length)}}},{key:"changeValue",value:function t(){this.value=e.getUnFormattedValue(this.input.value,this.currency);this.input.value=e.getFormattedValue(this.value,this.currency);this.callValueChangeCallback()}},{key:"callValueChangeCallback",value:function e(){if(!!this.callback){this.callback.apply(this,[this.value])}BX.onCustomEvent(this,"Currency::Editor::change",[this.value])}}],[{key:"getCurrencyFormat",value:function e(t){var i=this.getCurrencyList();if(typeof i[t]!=="undefined"){return i[t]}return this.defaultFormat}},{key:"getCurrencyList",value:function e(){if(this.currencyList===null){this.currencyList=t.Loc.getMessage("CURRENCY")}return this.currencyList}},{key:"getBaseCurrencyId",value:function e(){var t=this.getCurrencyList();for(var i in t){if(!t.hasOwnProperty(i)){continue}if(BX.prop.getString(t[i],"BASE","N")==="Y"){return i}}return""}},{key:"trimTrailingZeros",value:function e(t,i){t=String(t);var n=this.getCurrencyFormat(i);var r=BX.prop.getString(n,"DEC_POINT","");return r!==""?t.replace(new RegExp("\\"+r+"0+$"),""):t}},{key:"escapeRegExp",value:function e(t){t=String(t);return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}},{key:"getUnFormattedValue",value:function e(t,i){t=String(t);var n=this.getCurrencyFormat(i);if(n["SEPARATOR"].length===1){return t.replace(new RegExp("["+n["SEPARATOR"]+"]","g"),"").replace(n["DEC_POINT"],".").replace(new RegExp("[^0-9.]","g"),"")}else if(n["SEPARATOR"].length>1){return t.replace(new RegExp(this.escapeRegExp(n["SEPARATOR"]),"g"),"").replace(n["DEC_POINT"],".").replace(new RegExp("[^0-9.]","g"),"")}else{return t.replace(n["DEC_POINT"],".").replace(new RegExp("[^0-9.]","g"),"")}}},{key:"getFormattedValue",value:function e(t,i){t=String(t);if(t===""){return""}t=t.replace(/^0+/,"");if(t===""){t="0"}else if(t.charAt(0)==="."){t="0"+t}var n="";if(t.charAt(0)==="-"){n="-";t=t.slice(1)}var r=this.getCurrencyFormat(i);var a=r.DEC_POINT;var l=r.DECIMALS;var u=r.SEPARATOR||r.THOUSANDS_SEP;var c=a===","||a==="."?new RegExp("[.,]"):new RegExp("["+a+".,]");var s=new RegExp("D","g");var h;var g;var o;var v=t.match(c);if(v===null){h=t.replaceAll(s,"");g="";o=""}else{h=t.slice(0,v.index).replaceAll(s,"");g=t.slice(v.index+1).replaceAll(s,"");o=a}if(l===0){g="";o=""}var p=n;if(this.checkInrFormat(i)){if(h.length<=3){p=p+h}else{var f=u+h.slice(-3);var y=h.slice(0,-3);var E=y.length>2?y.length%2:0;p=p+(E?y.slice(0,E)+u:"")+y.slice(E).replace(/(\d{2})(?=\d)/g,"$1"+u)+f}}else{var d=h.length>3?h.length%3:0;p=p+(d?h.slice(0,d)+u:"")+h.slice(d).replace(/(\d{3})(?=\d)/g,"$1"+u)}if(l>0){p=p+o;if(g!==""){if(l<g.length){g=g.slice(0,l)}p=p+g}}return p}},{key:"initRegion",value:function e(){if(this.region===""){var i=t.Extension.getSettings("currency.money-editor");this.region=i.get("region")||"-"}}},{key:"checkInrFormat",value:function e(t){this.initRegion();return t==="INR"&&(this.region==="hi"||this.region==="in")}}]);return e}();babelHelpers.defineProperty(i,"currencyList",null);babelHelpers.defineProperty(i,"defaultFormat",{CURRENCY:"",NAME:"",FORMAT_STRING:"#",DEC_POINT:".",THOUSANDS_VARIANT:null,THOUSANDS_SEP:" ",DECIMALS:2,HIDE_ZERO:"N",BASE:"N",SEPARATOR:" "});babelHelpers.defineProperty(i,"region","");t.Reflection.namespace("BX.Currency").Editor=i;e.MoneyEditor=i})(this.BX.Currency=this.BX.Currency||{},BX); //# sourceMappingURL=money-editor.bundle.map.js