/* * * GrapeCity InputMan Library 1.0.0 * http://grapecity.com/ * * Copyright(c) GrapeCity, Inc. All rights reserved. * **/ var __extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},GCIM;(function(n){var t=function(n){function t(){n.apply(this,arguments)}return __extends(t,n),t.prototype.GetDisplayText=function(n,t){throw"Abstract method called";},t}(n.Field),u,f,i,r;n.NumberField=t,u=function(n){function t(){n.call(this,"DigitField"),this.NewText=null,this.TrueText=null,this.OldTrueText=null,this.RequiredLength=0,this.OptionalLength=0,this.minLength=0,this.maxLength=0,this.NonNunMinLength=this.RequiredLength,this.DP_STRING=".",this.DecimalPoint=null}return __extends(t,n),t.prototype.Snap=function(){var t={};return t.FieldSnapResult=n.prototype.Snap.call(this),t.NewText=this.NewText,t.TrueText=this.TrueText,t},t.prototype.Revert=function(t){this.NewText=t.NewText,this.TrueText=t.TrueText,n.prototype.Revert.call(this,t.FieldSnapResult)},t.prototype.DigitField=function(n,t){this.RequiredLength=t,this.OptionalLength=n,this.minLength=t,this.maxLength=n+t},t.prototype.GetDisplayText=function(n){var t=this.GetInnerDisplayText(n);return this.NewText!=t&&(this.NewText=t),t},t.prototype.GetInnerDisplayText=function(n){var u=n.toString(),r="",f=u.indexOf(this.DP_STRING),i,t;r=f!=-1?u.substring(f+1,u.length):"",i=15,this.RequiredLength+this.OptionalLength<15&&(i=this.RequiredLength+this.OptionalLength),t=r.toString();while(t.lengthi&&(t=t.substring(0,i)),t=this.MakeupZero(t)},t.prototype.SetValue=function(n,t){var i,f,u,r;return t==!0?this.text=this.NewText==null?"":this.NewText:(n==null?this.Clear():(i=n.toString(),i=i.replace("-",""),f=i.indexOf(this.DP_STRING),u=0,this.TrueText=null,r=this.GetLengthNow(),i=f==-1?"":i.substring(f+this.DP_STRING.length,i.length),r>0?this.Replace(u,r,i):this.Insert(u,i)),this.text=this.NewText,this.NewText)},t.prototype.Delete=function(n,t){var i=this.NewText==null?"":this.NewText,r={};return r.curPos=n,this.GetLengthNow()==0||n>=i.length?r:(t==0&&(t=1),t>i.length-n&&(t=i.length-n),i=i.substring(0,n)+i.substring(n+t,i.length),this.TrueText=i,i.lengthe.length&&(i=this.NewText.substring(0,n))),ni.length)if(t.length!=0)for(u=i.length;uthis.RequiredLength+this.OptionalLength&&(i=i.substring(0,this.RequiredLength+this.OptionalLength)),this.TrueText=i,i.lengthi.length&&(n=i.length),this.NewText=i,r={},r.temp=i,r.curPos=n,r.existInvalid=f,r},t.prototype.Replace=function(n,t,i){var r=this.TrueText==null?"":this.TrueText,f,u;t==0&&(t=1);if(nr.length-n&&(t=r.length-n),r=r.substring(0,n)+r.substring(n+t,r.length);else if(i.length!=0)for(f=r.length;fthis.RequiredLength+this.OptionalLength&&(r=r.substring(0,this.RequiredLength+this.OptionalLength)),this.TrueText=r,r.lengthr.length&&(n=r.length),this.NewText=r,u={},u.curPos=n,u.temp=r,u},t.prototype.Clear=function(){this.NewText=null,this.TrueText=null,this.text=null},t.prototype.MakeupZero=function(n){var i=this.RequiredLength-n.length,t;if(i>0)for(t=0;t0?this.PositiveText:t?this.PositiveText:this.NegativeText},i.prototype.GetDisplayTextUnformatted=function(n,t){var i;return i=n>0||n==0&&t?this._positiveTextUnformatted:this._negativeTextUnformatted,this.ParseFormat(i,this.CurrencySymbol)},i.prototype.CheckStatus=function(n){this.PromptText=n?this.PositiveText:this.NegativeText},i.prototype.Clear=function(){this.PromptText=""},i.prototype.GetLengthNow=function(){return this.PromptText.length},i.prototype.Delete=function(n,t){var i={};return i.curPos=n,i.temp=this.PromptText,i},i.prototype.SetPositiveText=function(n){this._positiveTextUnformatted=n,this.PositiveText=this.ParseFormat(n,this.CurrencySymbol)},i.prototype.GetPositiveText=function(){return this._positiveTextUnformatted},i.prototype.SetNegativeText=function(n){this._negativeTextUnformatted=n,this.NegativeText=this.ParseFormat(n,this.CurrencySymbol)},i.prototype.GetNegativeText=function(){return this._negativeTextUnformatted},i.prototype.SetCurrencySymbol=function(n){this.CurrencySymbol=n,this.PositiveText=this.ParseFormat(this.PositiveText,this.CurrencySymbol),this.NegativeText=this.ParseFormat(this.NegativeText,this.CurrencySymbol)},i.prototype.ParseFormat=function(n,t){var r,u,i;if(n==null)return"";for(r="",u=!1,i=0;ii&&(this.NewText=t)),t},t.prototype.GetInnerDisplayText=function(n){if(n==null)return null;var i=n.toString(),r=i.indexOf(this.DP_STRING),t=r==-1?i:i.substring(0,r);n<0&&(t=t.replace(this.Negative_Sign,""));while(t.length>0&&t.substring(0,1)=="0")t=t.substring(1,t.length);return t.length>this.RequiredLength+this.OptionalLength||(t=this.MakeupZero(t)),t===""&&this.RequiredLength===0&&this.NewText!=="0"?t:(t==""&&this.NewText=="0"&&(t="0"),t)},t.prototype.SetValue=function(n,t){var i,f,u,r;if(t==!0){this.text=this.NewText==null?"":this.NewText;return}t==!1&&(n==null?this.Clear():(i="",f=0,this.TrueText=null,u=this.GetLengthNow(),Math.abs(n)<1?this.NewText=this.MakeupZero(i):(i=Math.abs(n).toString(),r=i.indexOf(this.DP_STRING),r!=-1&&(i=i.substring(0,r)),u>0?this.Replace(f,u,i,!0):this.InitialInsert(f,i))),this.text=this.NewText)},t.prototype.Delete=function(n,t){var i={},r;i.newText=this.NewText==null?"":this.NewText,i.curPos=n,i.isValid=!1;if(this.GetLengthNow()==0)return i;return r=this.RealDelete(n,t),r.isValid==!1?i:(this.NewText=r.temp,i.curPos=r.curPos,i.temp=r.temp,i.isValid=!0,i)},t.prototype.InitialInsert=function(n,t){var r,i;return r=this.NewText==null?"":this.NewText,i=this.Insert(n,t,r,!1),i.result?(this.NewText=i.temp,i):(i.existInvalid=!0,i)},t.prototype.Replace=function(n,t,i,r){var f={},e,u;return f.existInvalid=!1,this.maxLength0)for(t=0;ti.length&&(t=i.length-r),f=i.length-r-t,r+t0?i.substring(0,r)+i.substring(r+t,i.length):i.substring(t,i.length);while(this.Separator!=""&&i.indexOf(this.Separator)!=-1)i=i.replace(this.Separator.toString(),"");while(i.length>this.RequiredLength&&i.substring(0,1)=="0"){e=!0;if(this.RequiredLength==0&&i.length==1)break;else i=i.substring(1,i.length)}return i=this.MakeupZero(i),n=e==!0?0:i.length-f,u.curPos=n,u.temp=i,u.isValid=!0,u},t.prototype.Insert=function(n,t,i,r){var f={},s,e;f.temp=i,f.curPos=n,f.result=!1,f.existInvalid=!1;var u=f.temp.replace(this.Separator.toString(),""),h=n,o=0;while(u.length>0&&u.substring(0,1)=="0"&&h>0)u=u.substring(1,u.length),h--,o++;if(u.length>=this.RequiredLength+this.OptionalLength)return f.existInvalid=!0,f;for(n=0;e--){u=f.temp.substring(0,n)+t.toString().substring(0,e)+f.temp.substring(n,f.temp.length),u.length>1&&u.charAt(0)=="0"&&n==0&&!r&&(f.existInvalid=!0);while(u.length>1&&u.substring(0,1)=="0")u=u.substring(1,u.length);if(u.length<=this.RequiredLength+this.OptionalLength)break}return u==""&&t.length>0&&t.charAt(0)=="0"&&(u="0"),u=this.MakeupZero(u),n=u.length-s,n=n<0?0:n,f.temp=u,f.curPos=n,f.result=!0,f.PrefixZeroCount=o,f},t}(t),n.IntegerField=i,r=function(n){function t(){n.call(this,"DpField"),this.DP_Exist=!1,this.minLength=0,this.maxLength=1,this.DP_STRING=".",this.DecimalPoint=null,this.text=this.DecimalPoint}return __extends(t,n),t.prototype.Snap=function(){var t={};return t.FieldSnapResult=n.prototype.Snap.call(this),t.DP_Exist=this.DP_Exist,t.DecimalPoint=this.DecimalPoint,t.text=this.text,t},t.prototype.Revert=function(t){n.prototype.Revert.call(this,t.FieldSnapResult),this.DP_Exist=t.DP_Exist,this.DecimalPoint=t.DecimalPoint,this.text=t.text},t.prototype.SetDecimalPoint=function(n){n!=null&&n.length==1&&(this.DecimalPoint=n)},t.prototype.GetDisplayText=function(n){return n==!0?(this.DP_Exist=!0,this.DecimalPoint):this.DP_Exist==!0?this.DecimalPoint:""},t.prototype.SetValue=function(n,t){if(this.maxLength==0){this.DP_Exist=!1;return}n==null&&t==!1?this.Clear():t==!1?this.Fill(n.toString(10)):this.DP_Exist=!0},t.prototype.Delete=function(n,t){this.Clear();var i={};return i.curPos=0,i},t.prototype.Insert=function(n,t){this.Fill(t)},t.prototype.Fill=function(n){var i=Math.abs(parseFloat(n)).toString(),t=i.indexOf(this.DP_STRING);t<0?this.Clear():this.DP_Exist=!0},t.prototype.Clear=function(){this.DP_Exist=!1},t.prototype.GetLengthNow=function(){return this.DP_Exist==!0?this.DecimalPoint.length:0},t}(t),n.DPField=r})(GCIM||(GCIM={}));var __extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},GCIM;(function(n){var i=function(){function n(){}return n.Calculator="calculator",n.NumericPad="numericpad",n}(),r,t;n.NumberDropDownType=i,r=function(r){function u(t,i){n.StringCache.SuspendSurrogateCharCheck(),this._dataFromServer=arguments[2];try{r.call(this,t,i)}finally{n.StringCache.ResumeSurrogateCharCheck()}}return __extends(u,r),u.prototype._getComponentType=function(){return n.IMControlType.Number},u.prototype._beginInit=function(){r.prototype._beginInit.call(this),this._fromNumbericPad=!1,this.CalculatorMemory="",this._hasSelectionSet=!1,this._format.Fields=new n.NumberFieldCollection,this._displayFormat.Fields=new n.NumberFieldCollection,this.PositiveColor="",this.NegativeColor="red",this.AllowDeleteToNull=!1,this.ClearMode=n.ClearModeAction.Zero,this.DropDownEnabled=!0,this.HelpID="__"+this._getId()+"_State",this.DisplayFormatIsNull=!1,this.InvalidEventInfo=null,this.IsFireEvent=!1,this.IsDrag=!1,this._IsDrop=!1,this._DropText="",this._dragStartElementID=null,this._dropDownBtnPressed=!1,this.DragExit=!1,this.CurrentPosition=0,this.Decimal=0,this.DecimalPoint=".",this.MaxValue=99999.99,this.MinValue=-99999.99,this.Separator=",",this.NegativeColor="red",this.ValueSign=n.ValueSign.NoControl,this.AdjustValueOnFocus=!1,this.AllowDeleteToNull=!1,this.AcceptsDecimal=n.DecimalMode.Cut},u.prototype._createUIProcess=function(){this._uIProcess=new n.NumberUIProcess(this._format,this._displayFormat,this.State,r.prototype.GetForeColor.call(this),this.NegativeColor,this.PositiveColor,this.HelpID,undefined,this.ClearMode),this._uIProcess._owner=this,this._uIProcess.ID=this._getId(),this._uIProcess.AllowDeleteToNull=this.AllowDeleteToNull,this._uIProcess.DisplayFormatIsNull=this.DisplayFormatIsNull},u.prototype._endInit=function(){var t={},u,i,e,f;t.ValueSign=n.ValueSign.NoControl,t.Text="0",u=this._uIUpdate.GetHideText(),i=null,isNaN(parseFloat(u))||(i=parseFloat(u)),t.Value=i,t.State=1,this.State=t.State,this.Initial(t),t.ResetData=this.GetText(),this.SetHighlightText(!1),this._uIProcess.InitMaxMinRange(),e=document.getElementById(this._getId()+"_SpinContainer"),f=document.getElementById(this._getId()+"_Button"),n.Utility.DisabledHoldVisual(e),n.Utility.DisabledHoldVisual(f),this._uIUpdate.SetImeMode("disabled"),this.SetCurrencySymbol(""),this.SetTextHAlign(n.HorizontalAlignment.NotSet),this.SetValue(0),this._uIProcess.OnFocusValue={Value:this.Value,IsPositive:this._format.Fields.IsPositive},this.SelectionStart=this.SelectionEnd=this.GetInputElement().value.length,r.prototype._endInit.call(this)},u.prototype._getDefaultDropDownVisible=function(){return!0},u.prototype._initWithServerData=function(n){var i,u,f,t;r.prototype._initWithServerData.call(this,n),n.DropDownCalculatorMemoryNumber&&(this.CalculatorMemory=n.DropDownCalculatorMemoryNumber),n.AdjustValueOnFocus!==undefined&&this.SetAdjustValueOnFocus(n.AdjustValueOnFocus),n.AllowDeleteToNull!==undefined&&this.SetAllowDeleteToNull(n.AllowDeleteToNull),n.ClearAction!==undefined&&this.SetClearAction(n.ClearAction),n.AcceptsDecimal!==undefined&&this.SetAcceptsDecimal(n.AcceptsDecimal),n.CurrencySymbol!==undefined&&this.SetCurrencySymbol(n.CurrencySymbol),n.DecimalPoint!==undefined&&this.SetDecimalPoint(n.DecimalPoint),n.DisplayFormat!==undefined&&(i=n.DisplayFormat,i.Digit!==undefined&&this.SetDisplayFormatDigit(i.Digit),i.NegativePrefix!==undefined&&this.SetDisplayNegativePrefix(i.NegativePrefix),i.NegativeSuffix!==undefined&&this.SetDisplayNegativeSuffix(i.NegativeSuffix),i.PositivePrefix!==undefined&&this.SetDisplayPositivePrefix(i.PositivePrefix),i.PositiveSuffix!==undefined&&this.SetDisplayPositiveSuffix(i.PositiveSuffix)),n.DropDown!==undefined&&n.DropDown.DropDownType!==undefined&&this.SetDropDownType(n.DropDown.DropDownType),n.DropDownCalculator!==undefined&&(u=this.GetDropDownCalculator(),u!==null&&(n.DropDownCalculator.Align&&u.SetAlign(n.DropDownCalculator.Align),u._initWithServerData(n.DropDownCalculator))),n.DropDownNumericPad!==undefined&&(f=this.GetDropDownNumericPad(),f!==null&&f._initWithServerData(n.DropDownNumericPad)),typeof n.CalculatorUrl!==undefined&&(this._calculatorDataUrl=n.CalculatorUrl),typeof n.DropDownCalculatorUrl!==undefined&&(this._dropDownCalculatorDataUrl=n.DropDownCalculatorUrl),typeof n.DropDownNumericPadUrl!==undefined&&(this._dropDownNumericPadDataUrl=n.DropDownNumericPadUrl),n.Format!==undefined&&(t=n.Format,t.Digit!==undefined&&this.SetFormatDigit(t.Digit),t.NegativePrefix!==undefined&&this.SetNegativePrefix(t.NegativePrefix),t.NegativeSuffix!==undefined&&this.SetNegativeSuffix(t.NegativeSuffix),t.PositivePrefix!==undefined&&this.SetPositivePrefix(t.PositivePrefix),t.PositiveSuffix!==undefined&&this.SetPositiveSuffix(t.PositiveSuffix)),n.HighlightText!==undefined&&this.SetHighlightText(n.HighlightText),n.MaxMinBehavior!==undefined&&this.SetMaxMinBehavior(n.MaxMinBehavior),n.MaxValue!==undefined&&this.SetMaxValue(n.MaxValue),n.MinValue!==undefined&&this.SetMinValue(n.MinValue),n.NegativeColor!==undefined&&this.SetNegativeColor(n.NegativeColor),n.Separator!==undefined&&this.SetSeparator(n.Separator),n.SpinPosition!==undefined&&this.SetRelativeSpinPosition(n.SpinPosition),n.ToolTip!==undefined&&this.SetToolTip(n.ToolTip),n.TouchDropDownScale!==undefined&&this.SetTouchDropDownScale(n.TouchDropDownScale),n.Value!==undefined&&(n.Value=="null"?this.SetValue(null):n.Value===0&&n.IsPositive!==undefined&&n.Text!==undefined?this.SetText(n.Text):this.SetValue(n.Value)),n.ValueSign!==undefined&&this.SetValueSign(n.ValueSign),n.Visible!==undefined&&this.SetVisible(n.Visible),n.ClientEvents!==undefined&&(n.ClientEvents.DropDownClose&&this.OnDropDownClose(n.ClientEvents.DropDownClose),n.ClientEvents.DropDownOpen&&this.OnDropDownOpen(n.ClientEvents.DropDownOpen),n.ClientEvents.EditStatusChanged&&this.OnEditStatusChanged(n.ClientEvents.EditStatusChanged),n.ClientEvents.InvalidInput&&this.OnInvalidInput(n.ClientEvents.InvalidInput),n.ClientEvents.InvalidRange&&this.OnInvalidRange(n.ClientEvents.InvalidRange),n.ClientEvents.KeyExit&&this.OnKeyExit(n.ClientEvents.KeyExit),n.ClientEvents.SpinDown&&this.OnSpinDown(n.ClientEvents.SpinDown),n.ClientEvents.SpinUp&&this.OnSpinUp(n.ClientEvents.SpinUp),n.ClientEvents.TextChanged&&this.OnTextChanged(n.ClientEvents.TextChanged),n.ClientEvents.ValueChanged&&this.OnValueChanged(n.ClientEvents.ValueChanged))},u.prototype._InitWatermarkWithServerData=function(n){r.prototype._InitWatermarkWithServerData.call(this,n),n!=null&&(n.Zero!=null&&(n.Zero.Text!=null&&this.SetWatermarkZeroText(n.Zero.Text),n.Zero.ForeColor!=null&&this.SetWatermarkZeroForeColor(n.Zero.ForeColor)),n.DisplayZero!=null&&(n.DisplayZero.Text!=null&&this.SetWatermarkDisplayZeroText(n.DisplayZero.Text),n.DisplayZero.ForeColor!=null&&this.SetWatermarkDisplayZeroForeColor(n.DisplayZero.ForeColor)))},u.prototype._updateServerData=function(){var f,t;r.prototype._updateServerData.call(this),f=document.getElementById(n.Utility.GetHelperId(this._getId()));if(f!=null){t={},t.InputElementValue=this._GetTemporaryControlValue();var u=this._uIUpdate.GetHideText(),i=this.GetFormatDigit(),e=i!=null&&i.length>0&&i.charAt(i.length-1)=="#";this.GetValue()!=null&&u!=this.GetValue().toString()&&e&&this.GetWatermarkZeroText()=="0"&&(u=this.GetValue().toString()),t.HelperValue=u,t.CalculatorMemory=this.CalculatorMemory,f.value=JSON.stringify(t)}},u.prototype._registInputElemnetEvent=function(){var t=this;if(this.GetInputElement()==null||this._uIUpdate==null)return;r.prototype._registInputElemnetEvent.call(this),n.Utility.IsIE10OrLater&&this._uIUpdate.AddEventForInputElement(n.PointerEvents.GetPointerUpName(),function(i){n.GlobalEventHandler.OnMSPointerUp(t,i)},!1)},u.prototype.Snap=function(){var n={};return n.BaseInputControlSnapResult=r.prototype.Snap.call(this),n.UIProcessSnapResult=this._uIProcess.Snap(),n.RealTimeText=this.GetTextboxValue(),n},u.prototype.Revert=function(n){r.prototype.Revert.call(this,n.BaseInputControlSnapResult),this._uIProcess.Revert(n.UIProcessSnapResult),this.UpdateDisplayText(n.RealTimeText)},u.prototype.RestoreString=function(n){if(n==null)return"";while(n.indexOf("@#GCD#@")!=-1)n=n.replace("@#GCD#@","'");while(n.indexOf("@#GCM#@")!=-1)n=n.replace("@#GCM#@",'"');return n},u.prototype.Initial=function(t){var f,r,u,i,e;t.iniObj={},t.iniObj.prePos="",t.iniObj.preNeg="-",t.iniObj.intOpl=4,t.iniObj.intRel=1,t.iniObj.dpMaxlength=1,t.iniObj.decOpl=2,t.iniObj.decRel=0,t.iniObj.suPos="",t.iniObj.suNeg="",t.iniObj.sepCount=0,t.iniDisplayObj={},t.iniDisplayObj.prePos="",t.iniDisplayObj.preNeg="-",t.iniDisplayObj.intOpl=4,t.iniDisplayObj.intRel=1,t.iniDisplayObj.dpMaxlength=1,t.iniDisplayObj.decOpl=2,t.iniDisplayObj.decRel=0,t.iniDisplayObj.suPos="",t.iniDisplayObj.suNeg="",t.iniDisplayObj.sepCount=0,t.Separator=",",t.DecimalPoint=".",i=new n.FixField,i.FixField(t.iniObj.prePos,t.iniObj.preNeg),this._format.Fields.Add(i),t.iniObj.intOpl==null&&(t.iniObj.intOpl=0),t.iniObj.intRel==null&&(t.iniObj.intRel=0),f=new n.IntegerField,f.IntegerField(t.iniObj.intOpl,t.iniObj.intRel,t.Separator),this._format.Fields.Add(f),r=new n.DPField,r.DecimalPoint=t.DecimalPoint,r.maxLength=t.iniObj.dpMaxlength!=null?t.iniObj.dpMaxlength:1,this._format.Fields.Add(r),t.iniObj.decOpl==null&&(t.iniObj.decOpl=0),t.iniObj.decRel==null&&(t.iniObj.decRel=0),u=new n.DigitField,u.DigitField(t.iniObj.decOpl,t.iniObj.decRel),this._format.Fields.Add(u),i=new n.FixField,i.FixField(t.iniObj.suPos,t.iniObj.suNeg),this._format.Fields.Add(i),this._displayFormat.Fields.FormatString="####0.##",this._format.Fields.FormatString="####0.##",i=new n.FixField,i.FixField(t.iniDisplayObj.prePos,t.iniDisplayObj.preNeg),this._displayFormat.Fields.Add(i),t.iniDisplayObj.intOpl==null&&(t.iniDisplayObj.intOpl=0),t.iniDisplayObj.intRel==null&&(t.iniDisplayObj.intRel=0),f=new n.IntegerField,f.IntegerField(t.iniDisplayObj.intOpl,t.iniDisplayObj.intRel,t.Separator),this._displayFormat.Fields.Add(f),r=new n.DPField,r.DecimalPoint=t.DecimalPoint,r.maxLength=1,this._displayFormat.Fields.Add(r),t.iniDisplayObj.decOpl==null&&(t.iniDisplayObj.decOpl=0),t.iniDisplayObj.decRel==null&&(t.iniDisplayObj.decRel=0),u=new n.DigitField,u.DigitField(t.iniDisplayObj.decOpl,t.iniDisplayObj.decRel),this._displayFormat.Fields.Add(u),i=new n.FixField,i.FixField(t.iniDisplayObj.suPos,t.iniDisplayObj.suNeg),this._displayFormat.Fields.Add(i),this._format.Fields.DecimalPoint=t.DecimalPoint,this._format.Fields.Separator=t.Separator,this._displayFormat.Fields.DecimalPoint=t.DecimalPoint,this._displayFormat.Fields.Separator=t.Separator,this._format.Fields.sepCount=t.iniObj.sepCount,t.iniObj.sepCount>0&&(this._format.Fields._sepArray=t.iniObj.sepArray),this._displayFormat.Fields.sepCount=t.iniDisplayObj.sepCount,t.iniDisplayObj.sepCount>0&&(this._displayFormat.Fields._sepArray=t.iniDisplayObj.sepArray),this._format.Fields.MinValue=-99999.99,this._displayFormat.Fields.MinValue=-99999.99,this.MinValue=this._format.Fields.MinValue,this._format.Fields.MaxValue=99999.99,this._displayFormat.Fields.MaxValue=99999.99,this.MaxValue=this._format.Fields.MaxValue,this._format.Fields.SetValue(t.Value,!1),this._format.Fields.SetValue(t.Value,!0),this._format.Fields.CheckFixStatus(!1),e=this._format.Fields.GetValue(),this._displayFormat.Fields.SetDisplayValue(e,!0,!1),this._displayFormat.Fields.CheckFixStatus(!1),t.RealDecLength=0,t.RealIntLength==null&&(t.RealIntLength=0),t.IsPositive=!0,t.IsDpexist=!1,this.Text=this.GetText(),this.OldText=this.Text,this.IsTextChanged=!1},u.prototype.SetMemoryNumber=function(n){this.CalculatorMemory=n!=null?n:""},u.prototype.ProcessMaxMinBehaviorForCalculator=function(t){var i=t,e=this._uIProcess._format.Fields.GetTrueMValue(),r=e.MaxValue,u=e.MinValue,f;if(t!=null)if(t>r||tr?r:u;break;case n.MaxMinBehavior.CancelInput:i=this.GetValue();break;case n.MaxMinBehavior.Clear:f=!1,(u>0||r<0)&&(f=!0),i=f?null:0;break;case n.MaxMinBehavior.Keep:i=t;break;case n.MaxMinBehavior.Restore:i=this.GetValue();break}}return i},u.prototype.SetValueForIpad=function(t){var r=this.GetValue(),i;t=this.ProcessMaxMinBehaviorForCalculator(t),this.SetValue(t),i=this.GetValue(),r!=i&&this._getAutoPostBack()&&n.Utility.DoPostBack(this._getServerUniqueId(),"TextChanged",this.CausesValidation,this.ValidationGroup,"",!1,!0)},u.prototype.SetValue=function(t,i){var f,u,o,s,e,r;if(t==null||t.toString().length==0)t=null;else{f=t.toString(),f.indexOf("e-")!==-1&&(f=n.Utility.CutTailZero(t.toFixed(20)));if(this.FilterValue(f)==!1)throw"Invalid Value!";else if(f=="NaN")throw"Invalid Value!";}u=this.ValidateFormatValue(t);if(!u.isValid)throw"Invalid Value!";return o=this._uIProcess.State==1?null:this._uIProcess._format.Fields.GetUnCheckedValue(),t==null&&(this._uIProcess.State=1),u.isValid&&(u.value!=o||this.Value!=t||this.IsTextChanged)&&(t=u.value,this.Value=t,this._uIProcess._format.Fields.SetValue(t,!1),this._uIProcess._format.Fields.SetValue(t,!0),t!=null&&(this._uIProcess.State=0,this._uIProcess._displayFormat.Fields.SetDisplayValue(t,this._format.Fields.IsPositive)),s=this._uIProcess.GetShowText2(this._focused,this._focused),this.Text=s,this.SetHideValue(),this.UpdateDisplayText(this._uIProcess.ShowDisplayText()),e=this._GetRealForeColor(this._focused,!1),this._UseWatermarkText(!this._focused)?this._uIUpdate.SetForeColor(e):this.SetForeColor(e,!1),i||this.Text==this.OldText||(this.OldText=this.Text,r=this._uIProcess.FireEvent(this,this._specialClientEvents.TextChanged,null,"TextChanged"),r!=null&&(this._focusType=r)),i||(this._oldValue=this.Value,r=this._uIProcess.FireEvent(this,this._specialClientEvents.ValueChanged,null,"ValueChanged"),r!=null&&(this._focusType=r))),this},u.prototype.ValidateFormatValue=function(t){var i={},r,f,u,e;i.isValid=!0,i.value=t;if(t==null||t.toString().length==0)return i;else r=t.toString(),r.indexOf("e-")!==-1&&(r=n.Utility.CutTailZero(t.toFixed(20))),f=this._uIProcess._format.Fields.GetTrueMValue(),r=="NaN"?i.isValid=!1:t>f.MaxValue||tthis._uIProcess._format.Fields.GetDigitField().maxLength&&(t=n.NumberFieldCollection.Round(t,this._uIProcess._format.Fields.GetDigitField().maxLength)),i.value=t);return i},u.prototype.FilterValue=function(t){var i=n.Utility.FilterText("-.0123456789",t);return t!=i?!1:!0},u.prototype.FilterText=function(t){var i=t.toString(),r=n.Utility.FilterText("-0123456789"+this._format.Fields.DecimalPoint+this._format.Fields.Separator,i);return i!=r?!1:!0},u.prototype.SetUnCheckedValue=function(t){var i=parseFloat(t.toString()),e=this.Snap(),u,o,r,f;i=parseFloat(i.toString()),u=this.ValidateFormatValue(i).isValid;if(u&&this.GetValue()!=i)this._format.Fields._maxMinBehavior==n.MaxMinBehavior.Keep&&this.AdjustValueOnFocus&&this.ProcessMaxMinBehavior(e,!0,i);else{this.SetSelection(this.SelectionStart,this.SelectionEnd);if(!u&&this.AdjustValueOnFocus){this.ProcessMaxMinBehavior(e,!0,i);return}}this._uIProcess._format.Fields.SetValue(i,!1)&&(this._uIProcess.State=0,i==0&&this._uIProcess._format.Fields.GetLengthNow()==0&&(this._uIProcess._format.Fields.GetIntegerField().NewText="0")),o=this._uIProcess.GetShowText2(this._focused,this._focused),this.Text=o,r=this.GetWatermarkZeroText(),this.SelectionStart=i==0&&r!=null&&r!=""?r.length:this._format.Fields.GetPrefixField().GetLengthNow()+this._uIProcess.RestorePosition(this._format.Fields.GetIntegerField().GetLengthNow()),this.SelectionEnd=this.SelectionStart,this.UpdateDisplayText(this.Text),f=this._GetRealForeColor(this._focused,!0),this.SetForeColor(f,!1),this.SetSelection(this.SelectionStart,this.SelectionEnd),this._format.Fields.isUndoAfterEdit=!0},u.prototype.SetText=function(n){var l,h,i,e,f,t,c,r,o,u,s;try{l=this._format.Fields.IsPositive;if(n==this._format.Fields.GetDisplayNull())return this.SetValue(null),this;else if(n==this._format.Fields.GetDisplayZero())return this.SetValue(0),this;h=n;if(n==null||n.toString().length==0)return this.SetValue(null),this;i=!1,(this._format.Fields.GetPrefixField().PositiveText!=""||this._format.Fields.GetPostFixField().PositiveText!="")&&(e=this._format.Fields.GetPrefixField().PositiveText.length,f=this._format.Fields.GetPostFixField().PositiveText.length,n.substring(0,e)==this._format.Fields.GetPrefixField().PositiveText&&n.substring(n.length-f,n.length)==this._format.Fields.GetPostFixField().PositiveText&&(n=n.substring(e,n.length-f),i=!0));if(!i)if(this._format.Fields.GetPrefixField().NegativeText!=""||this._format.Fields.GetPostFixField().NegativeText!=""){e=this._format.Fields.GetPrefixField().NegativeText.length,f=this._format.Fields.GetPostFixField().NegativeText.length;if(n.substring(0,e)==this._format.Fields.GetPrefixField().NegativeText&&n.substring(n.length-f,n.length)==this._format.Fields.GetPostFixField().NegativeText)n=n.substring(e,n.length-f);else if(this._format.Fields.GetPrefixField().PositiveText==""&&this._format.Fields.GetPostFixField().PositiveText=="")i=!0;else throw"Invalid Text";}else i=this._format.Fields.GetPrefixField().PositiveText==""&&this._format.Fields.GetPostFixField().PositiveText==""?!0:!1;if(!this.FilterText(n))throw"Invalid Text";t=n,c="",this._format.Fields.DecimalPoint!=""&&n.indexOf(this._format.Fields.DecimalPoint)!=-1&&(t=n.substring(0,n.indexOf(this._format.Fields.DecimalPoint)),c=n.substring(n.indexOf(this._format.Fields.DecimalPoint)+1,n.length));if(t.length>this._uIProcess._format.Fields.GetIntegerField().maxLength+this._format.Fields.sepCount||c.length>this._uIProcess._format.Fields.GetDigitField().maxLength)throw"Invalid Text";if(this._format.Fields.sepCount>0&&this._format.Fields.Separator!="")for(r=0;r0&&(u=0);else{this._format.Fields.DecimalPoint!=""&&n.indexOf(this._format.Fields.DecimalPoint)!=-1&&(n=n.replace(this._format.Fields.DecimalPoint,".")),s=n.indexOf(".");if(s!=-1&&n.substring(s+1,n.length).indexOf(this._format.Fields.DecimalPoint)!=-1)throw"InValid text";u=parseFloat(n),u==0&&n.indexOf("-")==0?this._format.Fields.IsPositive=!1:u==0&&n.indexOf("-")==-1&&(this._format.Fields.IsPositive=!0);if(u.toString()=="NaN")throw"InValid text";}this._format.Fields.IsPositive!=l&&(this.IsTextChanged=!0),this._format.Fields._isPositiveSet=!0;try{this.SetValue(u)}finally{this._format.Fields._isPositiveSet=!1}this.IsTextChanged=!1}catch(a){return window.status="Sorry, You have set an invalid text!",this}return this},u.prototype.SetSelectedText=function(n){var e,r,o,s,t,f,u,i;try{if(this.GetReadOnly())return this;if(n=="")return this.Delete(),this;e=this.GetValue(),r=this.GetText();if(!this.FilterText(n))throw"Invalid Text";if(n.indexOf(this._format.Fields.DecimalPoint)!=-1){o=Math.max(this.SelectionStart,this.SelectionEnd);if(this._uIProcess._format.Fields.GetDPField().DP_Exist==!0&&r.substring(o,r.length).indexOf(this._format.Fields.DecimalPoint)!=-1)throw"Invalid Text";}n==null&&(n=""),s=this.Snap(),t=this._uIProcess.Paste(this.SelectionStart,this.SelectionEnd,n,!1,!0);if(t==null)return this;t.Text!=null&&(this.RenewText(t.Text),f=this._uIProcess._format.Fields.ValidateValue(this.GetValue()),f?(this.SetHideValue(),this._uIProcess._format.Fields.SetValue(this.GetValue(),!0)):(this.Revert(s),i=this._uIProcess.FireEvent(this,this._specialClientEvents.InvalidRange,null,"InvalidRange"),i!=null&&(this._focusType=i)),this.GetValue()!=null&&(this._uIProcess.State=0),this._uIProcess._displayFormat.Fields.SetDisplayValue(this.GetValue(),!0),this.UpdateDisplayText(this._uIProcess.ShowDisplayText()),u=this._GetRealForeColor(this._focused,!1),this.SetForeColor(u,!1)),t.SelectionStart!=null&&(this.SelectionStart=t.SelectionStart),t.SelectionEnd!=null&&(this.SelectionEnd=t.SelectionEnd),t.EventInfo!=null&&this._uIProcess.FireEvent(this,t.EventInfo.Name,t.EventInfo.Args,t.EventInfo.Type),r!=this.Text&&(i=this._uIProcess.FireEvent(this,this._specialClientEvents.TextChanged,null,"TextChanged"),i!=null&&(this._focusType=i)),e!=this.GetValue()&&(i=this._uIProcess.FireEvent(this,this._specialClientEvents.ValueChanged,null,"ValueChanged"),i!=null&&(this._focusType=i))}catch(h){window.status="Sorry, You have set an invalid text!"}return this},u.prototype.RenewText=function(n){this.Text=n},u.prototype.Clear=function(){return this._clear(this.ClearMode),this},u.prototype._clear=function(t){var r,e,h,s,i;r=this._uIProcess.State==1?null:this._uIProcess._format.Fields.GetUnCheckedValue();var f=!1,c=this.Text,o=!1,u=this._format.Fields.IsPositive;t==n.ClearModeAction.Zero&&(this._format.Fields.ValidateValue(0)?(this._uIProcess.SetValue(0,!1),u=!0,this._displayFormat.Fields.ValueSign==n.ValueSign.Negative&&(u=!1),this._displayFormat.Fields.SetDisplayValue(0,u),this._uIProcess.State=0,this._format.Fields.IsPositive=u,r!=0&&(f=!0)):(e=null,this._uIProcess.SetValue(e,!1),this._uIProcess.State=1,o=!0,r!=e&&(f=!0)),this._format.Fields.DoClearAction(),this._format.Fields.IsPositive=u,this.SelectionStart=this._uIProcess._format.Fields.GetPrefixField().GetLengthNow()+this._uIProcess._format.Fields.GetIntegerField().GetLengthNow(),this.SelectionEnd=this.SelectionStart),(t==n.ClearModeAction.Null||o==!0)&&(this._uIProcess.State=1,this._uIProcess.SetValue(null),this.SelectionStart=0,this.SelectionEnd=0,this._uIUpdate.SetForeColor(this._uIProcess.PositiveColor),r!=null&&(f=!0)),this.Text=this._uIProcess.GetShowText2(this._focused,this._focused),this.UpdateDisplayText(this._uIProcess.ShowDisplayText()),t!=n.ClearModeAction.Null&&o!=!0?(h=this._GetRealForeColor(this._focused,!1),this.SetForeColor(h,!1)):t==n.ClearModeAction.Null&&this._uIProcess._format.Fields.ValueSign==n.ValueSign.NoControl&&(this._uIProcess._format.Fields.IsPositive=!0,this._uIProcess._displayFormat.Fields.IsPositive=!0),s=this.Text,c!==s&&(i=this._uIProcess.FireEvent(this,this._specialClientEvents.TextChanged,null,"TextChanged"),i!=null&&(this._focusType=i)),f&&(i=this._uIProcess.FireEvent(this,this._specialClientEvents.ValueChanged,null,"ValueChanged"),i!=null&&(this._focusType=i))},u.prototype.Drop=function(){return this.PerformDropDown(),this},u.prototype._GetSpinPosition=function(n){var t;return n<-1?n=-1:n>1&&(n=1),n==-1||n==0?n=1:n==1&&(n=3),t=this._uIProcess.GetPosByCurrentField(n).SelectionStart,t=this._uIProcess.RestorePosition(t),n==3&&this._uIProcess._format.Fields.GetDigitField().GetLengthNow()==0&&(t=-1),{Start:t,End:t}},u.prototype._protectedDoSpinFinished=function(){this._focused||(this.Value=this._uIProcess.GetValue()),this._displayFormat.Fields.SetDisplayValue(this._format.Fields.GetUnCheckedValue(),this._format.Fields.IsPositive,this.DisplayFormatIsNull),this.DisplayText=this._uIProcess.ShowDisplayText(),this.UpdateDisplayText(this.DisplayText);var n=this._GetRealForeColor(this._focused,!1);this.SetForeColor(n,!1)},u.prototype.GetSelectedText=function(){var r="",t=Math.min(this.SelectionStart,this.SelectionEnd),i=Math.max(this.SelectionStart,this.SelectionEnd),f=i-t,u;return f!=0&&(u=this._IsUseWatermarkText(!0),u.IsUseWatermarkText?r=u.WatermarkText:(r=this.Text.substring(t,i),this.GetClipContent()==n.ClipContent.ExcludeLiterals&&(t=this._uIProcess.AdjustPosition(t,0).start,i=this._uIProcess.AdjustPosition(i,0).start,r=this._uIProcess._format.Fields.GetNonLiteralsText(t,i)))),r},u.prototype.GetInteger=function(){var n=this._uIProcess._format.Fields.GetUncheckedInteger();return parseInt(n,10)},u.prototype.GetDecimal=function(){return parseFloat(this._uIProcess._format.Fields.GetUncheckedDecimal())},u.prototype.GetValue=function(){return this._uIProcess.State==1?null:this._uIProcess._format.Fields.GetUnCheckedValue()},u.prototype.GetOldValue=function(){return this._oldValue},u.prototype.GetDisplayText=function(){return this._uIProcess.ShowDisplayText2("","")},u.prototype.GetText=function(){return this._uIProcess.GetShowText2(!0,!0)},u.prototype.GetCurrentField=function(){return this._uIProcess.GetCurrentField(this.SelectionEnd)},u.prototype.GetCurrentPosition=function(){return this._uIProcess.GetCurrentPosition(this.SelectionEnd)},u.prototype.SetForeColor=function(n,t){var i,r;return t==null||t==!0?(this.PositiveColor=n,i=this._uIProcess._format.Fields.GetUnCheckedValue(),n=i<0?this.NegativeColor:i>0?this.PositiveColor:this._uIProcess._format.Fields.IsPositive?this.PositiveColor:this.Text==this._format.Fields.Null?this.PositiveColor:this.NegativeColor,this._setForeColorDirectly(n)):n=this._uIProcess._format.Fields.IsPositive?this.PositiveColor:this.Text==this._format.Fields.Null?this.PositiveColor:this.NegativeColor,this._IsUseWatermarkText().IsUseWatermarkText?(r=this._getShownWatermarkTextForeColor(this._focused),r===""&&this._uIUpdate.SetForeColor(n)):this._uIUpdate.SetForeColor(n),this},u.prototype.GetForeColor=function(){return this.PositiveColor},u.prototype.SetNegativeColor=function(t){t=n.Utility.CheckColor(t),this.NegativeColor=t,this._uIProcess.NegativeColor=t,this._uIProcess._format.Fields.IsPositive||this._uIUpdate.SetForeColor(t)},u.prototype.GetNegativeColor=function(){return this.NegativeColor},u.prototype.SetAdjustValueOnFocus=function(t){t=n.Utility.CheckBool(t),this.AdjustValueOnFocus=t},u.prototype.GetAdjustValueOnFocus=function(){return this.AdjustValueOnFocus},u.prototype.SetAllowDeleteToNull=function(t){t=n.Utility.CheckBool(t),this.AllowDeleteToNull=t,this.ClearMode=t?n.ClearModeAction.Null:n.ClearModeAction.Zero,this._uIProcess&&(this._uIProcess.ClearMode=this.ClearMode)},u.prototype.GetAllowDeleteToNull=function(){return this.AllowDeleteToNull},u.prototype.SetClearAction=function(t){t=n.Utility.CheckEnum(n.ClearModeAction,t),this.ClearMode=t},u.prototype.GetClearAction=function(){return this.ClearMode},u.prototype.SetDropDownType=function(n){if(n.toLowerCase()==="picker")return;r.prototype.SetDropDownType.call(this,n),this._loadScriptDynamic()},u.prototype.SetAcceptsDecimal=function(t){t=n.Utility.CheckEnum(n.DecimalMode,t),this.AcceptsDecimal=t},u.prototype.GetAcceptsDecimal=function(){return this.AcceptsDecimal},u.prototype.SetCurrencySymbol=function(t){t=n.Utility.CheckString(t),this.CurrencySymbol=t,t===""&&(t=n.Localization.GetString("Number.CurrencySymbol")),this.SetCurrencySymbolReal(t)},u.prototype.SetCurrencySymbolReal=function(n){this._format.Fields.GetPrefixField().SetCurrencySymbol(n),this._format.Fields.GetPostFixField().SetCurrencySymbol(n),this._format.Fields.CheckFixStatus(),this._displayFormat.Fields.GetPrefixField().SetCurrencySymbol(n),this._displayFormat.Fields.GetPostFixField().SetCurrencySymbol(n),this._displayFormat.Fields.CheckFixStatus(),this.UpdateDisplayText(this._uIProcess.ShowDisplayText())},u.prototype.GetCurrencySymbol=function(){return this.CurrencySymbol},u.prototype.SetDecimalPoint=function(t){t=n.Utility.CheckChar(t);if(t==="\x00"||t===" "||t.search(new RegExp("[0-9]"))!==-1||t==="+"||t==="-")throw"Cannot set DecimalPoint with the value "+t;t===this.GetSeparator()&&this.SetSeparator("\x00"),this.DecimalPoint=t,this._format.Fields.DecimalPoint=t,this._format.Fields.GetDPField().DecimalPoint=t,this._displayFormat.Fields.DecimalPoint=t,this._displayFormat.Fields.GetDPField().DecimalPoint=t,this.UpdateDisplayText(this._uIProcess.ShowDisplayText())},u.prototype.GetDecimalPoint=function(){return this.DecimalPoint},u.prototype.SetMaxMinBehavior=function(t){t=n.Utility.CheckEnum(n.MaxMinBehavior,t),this._format.Fields._maxMinBehavior=t,this._displayFormat.Fields._maxMinBehavior=t},u.prototype.GetMaxMinBehavior=function(){return this._format.Fields._maxMinBehavior},u.prototype.SetSeparator=function(t){t=n.Utility.CheckChar(t);if(t===this.GetDecimalPoint())throw"Cannot set Separator with the value of DecimalPoint.";if(t.search(new RegExp("[0-9]"))!==-1)throw"Cannot set Separator with the value "+t;t==="\x00"&&(t=" "),this.Separator=t,this._format.Fields.Separator=t,this._displayFormat.Fields.Separator=t,t===" "&&(this._format.Fields.Separator="",this._displayFormat.Fields.Separator=""),this.UpdateDisplayText(this._uIProcess.ShowDisplayText())},u.prototype.GetSeparator=function(){return this.Separator},u.prototype.SetMaxValue=function(n){if(nthis.GetMaxValue())throw"The MinValue should not bigger than the MaxValue.";if(n!==this.GetMinValue()){this.MinValue=n,this._format.Fields.MinValue=n,this._displayFormat.Fields.MinValue=n,this.ProcessMaxMinBehavior(this.Snap(),!0,this.GetValue(),"ForceAdjustToMaxMin");var t=this._GetRealForeColor(this._focused,!1);this.SetForeColor(t,!1)}},u.prototype.GetMinValue=function(){return this.MinValue},u.prototype.SetValueSign=function(t){var r,u,i;t=n.Utility.CheckEnum(n.ValueSign,t),r=this.GetValue(),u=this.GetText(),this.GetValue()!==null&&this.GetMaxMinBehavior()!==n.MaxMinBehavior.Keep&&(this._oldValue=this.GetValue());if(t===n.ValueSign.NoControl&&this.GetValue()!==null||t===n.ValueSign.Positive&&this.GetValue()>0||t===n.ValueSign.Negative&&this.GetValue()<0){this.ValueSign=t,this._format.Fields.SetValueSign(t),this._displayFormat.Fields.SetValueSign(t);return}this.ValueSign=t,this._format.Fields.SetValueSign(t),this._displayFormat.Fields.SetValueSign(t),this.GetValue()!==null?this._clear(n.ClearModeAction.Zero):this.SetValue(this._oldValue),this.DisplayText=this._uIProcess.ShowDisplayText(),this.UpdateDisplayText(this.DisplayText),i=this._GetRealForeColor(this._focused,!1),this.SetForeColor(i,!1),this._oldValue=this.GetValue(),this._uIProcess.OnFocusValue={Value:this.GetValue(),IsPositive:this._format.Fields.IsPositive}},u.prototype.GetValueSign=function(){return this.ValueSign},u.prototype.GetHighlightText=function(){return this._highlightText===n.HighlightText.All},u.prototype.SetHighlightText=function(t){var i=n.Utility.CheckBool(t);this._highlightText=i?n.HighlightText.All:n.HighlightText.None},u.prototype.GetTextHAlign=function(){return this._textHAlign},u.prototype.SetTextHAlign=function(t){r.prototype.SetTextHAlign.call(this,t),this._textHAlign=t,t===n.HorizontalAlignment.NotSet&&(this._uIUpdate.SetTextHAlign(n.HorizontalAlignment.Right),this._textHAlign=n.HorizontalAlignment.NotSet)},u.prototype.SetFormatDigit=function(t){var u,r,i,f;t=n.Utility.CheckString(t),u=0,r=!1,this.GetValue()!==null&&(i=this._format.Fields.GetIntegerField().GetDisplayText(this.GetValue()),i==="0"&&(r=!0),u=i.length),this._format.Fields.SetFormatString(t),this._format.Fields.SetValue(this.GetValue(),!1),(this.GetValue()===null||this.GetValue().toString().indexOf(this.GetDecimalPoint())===-1)&&(this._format.Fields.GetDPField().DP_Exist=!1),this.UpdateWatermarkRealText(!0),f=this._format.Fields.GetIntegerField().RequiredLength+this._format.Fields.GetIntegerField().OptionalLength,!r&&ft.Text.length&&(this.SelectionStart=t.Text.length,this.SelectionEnd=t.Text.length),this.UpdateDisplayText(t.Text),this._uIUpdate.SetForeColor(r.prototype.GetForeColor.call(this)),this.SetSelection(this.SelectionStart,this.SelectionEnd,!0),(this._focusType!=n.FocusType.ClientEvent&&this._focusType!=n.FocusType.SpinButton||this._focusType==n.FocusType.ClientEvent&&this._droppedDown&&this._uIProcess.IsFocus==!1)&&(this._IsDrop||(this._oldValue=this.GetValue(),this.OldText=t.ValueText,this.OldState=this.State))},u.prototype._onDropDownPropertyChanged=function(n){r.prototype._onDropDownPropertyChanged.call(this,n),n=="DropDownType"?(this._dropDownObj&&this._dropDownObj._doDispose(),this._dropDownObj=null):n=="Enabled"&&this.GetDropDownEnabled()&&this._loadScriptDynamic()},u.prototype.LoseFocus=function(){var f,o,e,i,t,u;if(n.Utility.IsPad())if(this._openDropDownByAuto)return;this.FireKeyExit(),f=this.GetDropDownObj();if(f&&f.IsMouseOver&&this._focusType!=n.FocusType.KeyExit)return;if(this.IsFireEvent)return;if((this._spinBtnPressed||this._dropDownBtnPressed)&&!this.IsDrag)return;this.IsDrag&&(this.IsDrag=!1),this._contextMenu.IsShow()&&this._contextMenu.Close(),this._touchToolBar.IsShow()&&this._touchToolBar.Close(),this._droppedDown&&this.CloseDropDown(),o=this.ProcessMaxMinBehavior(null,!0),e=this.GetTextboxValue(),this.DragExit&&(this.DragExit=!1,e=this._uIProcess.GetShowText2(!1,!1)),i=this._uIProcess.LoseFocus(e,this._oldValue,this),i.Color!=null&&this._setForeColorDirectly(i.Color),this.DisplayText=i.Text,this._uIUpdate.SetForeColor(r.prototype.GetForeColor.call(this)),this.UpdateDisplayText(this.DisplayText),this._focusType=n.FocusType.None,this.SetLastClientValues(),this.OldText!=i.ValueText&&(this.OldText=i.ValueText,this._focusType!=n.FocusType.ClientEvent&&(t={},t.Name=this._specialClientEvents.TextChanged,t.Args=null,u=this._uIProcess.FireEvent(this,t.Name,t.Args,"TextChanged"),u!=null&&(this._focusType=u))),this._oldValue!=i.Value&&(this._oldValue=i.Value,t={},t.Name=this._specialClientEvents.ValueChanged,t.Args=null,u=this._uIProcess.FireEvent(this,t.Name,t.Args,"ValueChanged"),u!=null&&(this._focusType=u),n.Utility.FireSystemEvent(this._realInputElement,"onchange",this._standardClientEvents.onchange),this._focusType=n.FocusType.None,this._getAutoPostBack()&&!n.Utility.__ignorePostBack&&n.Utility.DoPostBack(this._getServerUniqueId(),"TextChanged",this.CausesValidation,this.ValidationGroup,"",!1,!0)),this._shouldFireOnLeaveEvent=!0},u.prototype.SetHideValue=function(){this._uIProcess.SetHideValue(this.GetValue())},u.prototype.IsAllTextSelected=function(){var n=this.GetTextboxValue();return n!=null&&n.length==Math.abs(this.SelectionStart-this.SelectionEnd)?!0:!1},u.prototype.KeyDown=function(t){var f=t.keyCode,u={},o,e,i,s;return u.Shift=!1,u.Ctrl=!1,u.Alt=!1,t.shiftKey&&(u.Shift=!0),t.ctrlKey&&(u.Ctrl=!0),t.altKey&&(u.Alt=!0),this._imeMode=!1,f==229?!0:(Number(this.GetValue())===0||this.IsAllTextSelected())&&this.AllowDeleteToNull===!0&&(f==n.Key.BackSpace||f==n.Key.Delete)&&u.Alt===!1&&u.Shift===!1&&u.Ctrl===!1?(this._uIProcess.State=1,this._uIProcess.SetValue(null),this.State=1,this.Text=this._uIProcess.GetShowText2(this._focused,!0),this.UpdateDisplayText(this.Text),this.SelectionStart=this.Text==null?0:this.Text.length,this.SelectionEnd=this.SelectionStart,this.SetSelection(this.SelectionStart,this.SelectionEnd),this._uIProcess._format.Fields.ValueSign==n.ValueSign.NoControl&&(this._uIProcess._format.Fields.IsPositive=!0,this._uIProcess._displayFormat.Fields.IsPositive=!0),o=this._GetRealForeColor(this._focused,!0),this._uIUpdate.SetForeColor(o),!1):(e=this.Snap(),this._fromNumbericPad=this._droppedDown&&n.DropDownNumericPad&&this.GetDropDownObj()instanceof n.DropDownNumericPad,i=r.prototype.KeyDown.call(this,{KeyCode:f,FuncKeysPressed:u,SelectionStart:this.SelectionStart,SelectionEnd:this.SelectionEnd,EditMode:this._getEditModeInternal(),ReadOnly:this.GetReadOnly(),ClipContent:this.GetClipContent(),ExitOnLastChar:!1,ExitOnLeftRightKey:this.GetExitOnLeftRightKey(),TabAction:this._tabAction,Text:this.GetText(),DisplayText:this._uIUpdate.GetText(),ClearMode:this.ClearMode,_fromNumbericPad:this._fromNumbericPad}),this.GetReadOnly()&&(i.System=!1),this._droppedDown&&f===n.Key.Return&&this.GetDropDownType()===n.DropDownType.NumericPad&&(this.CloseDropDown(),i.System=!1),s=this.ProcessMaxMinBehavior(e),this.AdjustValueOnFocus&&this.BackupValue(!1),i.State!=null&&(this.State=i.State),i.HasSetSelection||i.System||i.FocusExit==!0||this.SetSelection(this.SelectionStart,this.SelectionEnd),(i.DecimalPoint==!0||i.System==null)&&(i.System=!0),i.System)},u.prototype.KeyPress=function(t,i){var u,f,e;t===","&&this._droppedDown&&this._dropDownObj instanceof n.DropDownNumericPad&&(t=".");if(this.GetReadOnly())return!1;if(t==this._uIProcess._format.Fields.DecimalPoint)if(this._uIProcess._format.Fields.GetDigitField().RequiredLength+this._uIProcess._format.Fields.GetDigitField().OptionalLength!=0){this._uIProcess.IsShowZeroString=!1,u={},u=this._uIProcess.KeyPress(this.SelectionStart,this.SelectionEnd,t);if(u==null)return!1;u.SelectionStart!=null&&(this.SelectionStart=u.SelectionStart),u.SelectionEnd!=null&&(this.SelectionEnd=u.SelectionEnd),u.Text!=null&&(this.Text=u.Text,this.RenewText(u.Text),this.UpdateDisplayText(this.Text),this.SetSelection(this.SelectionStart,this.SelectionEnd)),u.Color!=null&&(this._setForeColorDirectly(u.Color),this.SetForeColor(r.prototype.GetForeColor.call(this),!1)),u.FocusType!=null&&(this._focusType=u.FocusType),u.EventInfo!=null&&(e=this._uIProcess.FireEvent(this,u.EventInfo.Name,u.EventInfo.Args,u.EventInfo.Type),e!=null&&(this._focusType=e)),this._uIProcess.IsShowZeroString=!0}else f={},f.Name=this._specialClientEvents.InvalidInput,f.Args=null,e=this._uIProcess.FireEvent(this,f.Name,f.Args,"InvalidInput"),e!=null&&(this._focusType=e),this.RenewText(this.Text),this.UpdateDisplayText(this.Text),this.SetSelection(this.SelectionStart,this.SelectionEnd);else return i.keyCode!=n.Key.Return?(f={},f.Name=this._specialClientEvents.InvalidInput,f.Args=null,e=this._uIProcess.FireEvent(this,f.Name,f.Args,"InvalidInput"),e!=null&&(this._focusType=e),n.Utility.PreventDefault(i),!1):!0},u.prototype.KeyUp=function(t){if(this._imeMode==!0)return!1;var i=this._getShortcutObj();return i!=null&&(i.GetBlockKeyMessage()||(i._uiProcess.ProcessGcNumberAction(this,t),i._uiProcess.ProcessTriggerAll(this,t))),t.keyCode!=n.Key.Return?!1:!0},u.prototype.CompositionEnd=function(t){if(!(n.Utility.IsIE||n.Utility.chrome&&n.Utility.ChromeVersion>=53))return;try{this.ImeInput()}finally{var i=this._GetRealForeColor(this._focused,!1);this.SetForeColor(i,!1),this._imeMode=!1}},u.prototype.Input=function(n){try{this.ImeInput()}finally{this._imeMode=!1}},u.prototype.ImeInput=function(){var t=this._uIUpdate.GetText(),i,f,u,r,e;if(t==this.GetText()){window.event!=null&&n.Utility.PreventDefault(window.event),this._imeMode=!1;return}this.GetText()!=""?(f=Math.min(this.SelectionStart,this.SelectionEnd),u=Math.max(this.SelectionStart,this.SelectionEnd),ul?f.RangeInValid=!0:r>l?(f.greaterThanRange=!0,f.lessThanRange=!1):r0||l<0)&&i&&(w=!0),b=this._uIProcess.ClearMode,this._uIProcess.ClearMode=this.GetClearAction(),w&&(this._uIProcess.ClearMode=n.ClearModeAction.Null),this._uIProcess.Clear(),this._uIProcess.ClearMode=b,e=this.GetText(),i&&(e=this._uIProcess.GetShowText2(this._focused,this._focused)),this.UpdateDisplayText(e),this.Text=e,this.SelectionStart=this.SelectionEnd=this._uIProcess.GetDefaultSelectionStart(),i||window.setTimeout(function(){y.SetSelection(y.SelectionStart,y.SelectionEnd)},0),o=!0;break;case n.MaxMinBehavior.Keep:break;case n.MaxMinBehavior.Restore:s=this.CacheValue,s!=null?this.MaxMinUpdateValue(s):this.ForceClearToNull(),e=this.GetText(),this.UpdateDisplayText(e),this.Text=e,this.SelectionStart=this.SelectionEnd=this._uIProcess.GetDefaultSelectionStart(),i||this.SetSelection(this.SelectionStart,this.SelectionEnd),o=!0;break}}else(r>this.MaxValue||r0)},u.prototype.MouseUp=function(t){var i=this,o,s,f,u,e;r.prototype.MouseUp.call(this,t),n.Utility.IsIE10OrLater&&this.FocusedWhenMouseDown&&this.MouseDownOnClearButton&&(this._mouseUpPointerType==undefined&&(this.MouseUpHasValue=t.srcElement.value.length>0),t.srcElement==this._realInputElement&&(o=document.activeElement==t.srcElement,s=n.Utility.IsMouseDownOnClearButton(t),this.MouseUpHasValue&&o&&s&&(f=this,f._uIProcess.ClearMode=this.ClearMode,u=f._uIProcess.Clear(),e=function(){var f,t;if(u.Text!=null)if(!i.UpdateText(u))return u.System=!1,u;f=i.GetSelectionLength(),u.SelectionStart!=null&&(i.SelectionStart=u.SelectionStart),u.SelectionEnd!=null&&(i.SelectionEnd=u.SelectionEnd),t=i.GetSelectionLength(),u.System||(u.FocusExit?(i.SetHideValue(),u.System=!1):(i.UpdateDisplayText(i.Text),n.Utility.ShouldFireOnSelectStart=f==0&&t!=0?!0:!1,i.SetSelection(i.SelectionStart,i.SelectionEnd),n.Utility.ShouldFireOnSelectStart=!1,u.HasSetSelection=!0)),u.Color!=null?(i._setForeColorDirectly(u.Color),i._uIUpdate.SetForeColor(r.prototype.GetForeColor.call(i))):(i._format.Fields.IsPositive?i._setForeColorDirectly(i._uIProcess.PositiveColor):i._setForeColorDirectly(i._uIProcess.NegativeColor),i.SetForeColor(r.prototype.GetForeColor.call(i),!1)),u.State!=null&&(i.State=u.State),u.HasSetSelection||u.System||u.FocusExit==!0||i.SetSelection(i.SelectionStart,i.SelectionEnd)},setTimeout(e,0))))},u.prototype._resoreToInitialValueOnFormReset=function(){try{this.SetValue(this._initializedFormData)}catch(n){this.SetValue(null)}},u.prototype._backupInitialFormValue=function(){this._initializedFormData=this.GetValue()},u.prototype._getDisplayedText=function(){return this._focused?r.prototype._getDisplayedText.call(this):this.GetDisplayText()},u.prototype._getInitialInputPosition=function(){try{var t=this._format.Fields.GetFieldRange(n.NumberFieldIndex.INTEGER);return t.start+t.length}catch(u){return r.prototype._getInitialInputPosition.call(this)}},u.prototype._SelectAllInternal=function(n){r.prototype._SelectAllInternal.call(this,n),this._hasSelectionSet||(this._hasSelectionSet=!0)},u.prototype._CreateWatermark=function(){return new t},u.prototype._CreateDisplayWatermark=function(){return new t},u.prototype._GetWatermark=function(){return r.prototype._GetWatermark.call(this)},u.prototype._GetDisplayWatermark=function(){return r.prototype._GetDisplayWatermark.call(this)},u.prototype._OnWatermarkNullTextChanged=function(n,t){this._format.Fields.Null=t,this._GetWatermark().NullTextReal=this._format.Fields.GetDisplayNull(),this._IsValueNull()&&this._focused&&this._updateUIForeColor2(this._focused,!1)},u.prototype._OnWatermarkDisplayNullTextChanged=function(n,t){this._displayFormat.Fields.Null=t,this._GetDisplayWatermark().NullTextReal=this._displayFormat.Fields.GetDisplayNull(),this._IsValueNull()&&!this._focused&&(this.UpdateDisplayText(this._uIProcess.ShowDisplayText()),this._updateUIForeColor2(this._focused,!1))},u.prototype.GetWatermarkZeroText=function(){return this._GetWatermark().ZeroText},u.prototype.SetWatermarkZeroText=function(t){t=n.Utility.CheckString(t);if(t===this.GetWatermarkZeroText())return;var i=this._GetWatermark().ZeroText;this._GetWatermark().ZeroText=t,this._OnWatermarkZeroTextChanged(i,t)},u.prototype._OnWatermarkZeroTextChanged=function(n,t){this._format.Fields.Zero=t,this._GetWatermark().ZeroTextReal=this._format.Fields.GetDisplayZero(),this.GetValue()===0&&this._focused&&this._updateUIForeColor2(this._focused,!1)},u.prototype.GetWatermarkZeroForeColor=function(){return this._GetWatermark().ZeroTextForeColor},u.prototype.SetWatermarkZeroForeColor=function(t){t=n.Utility.CheckColor(t);if(t===this.GetWatermarkZeroForeColor())return;var i=this._GetWatermark().ZeroTextForeColor;this._GetWatermark().ZeroTextForeColor=t,this._OnWatermarkZeroForeColorChanged(i,t)},u.prototype._OnWatermarkZeroForeColorChanged=function(n,t){this.GetValue()===0&&this._focused&&this._updateUIForeColor2(this._focused,!1)},u.prototype.GetWatermarkDisplayZeroText=function(){return this._GetDisplayWatermark().ZeroText},u.prototype.SetWatermarkDisplayZeroText=function(t){t=n.Utility.CheckString(t);if(t===this.GetWatermarkDisplayZeroText())return;var i=this._GetDisplayWatermark().ZeroText;this._GetDisplayWatermark().ZeroText=t,this._OnWatermarkDisplayZeroTextChanged(i,t)},u.prototype._OnWatermarkDisplayZeroTextChanged=function(n,t){this._displayFormat.Fields.Zero=t,this._GetDisplayWatermark().ZeroTextReal=this._displayFormat.Fields.GetDisplayZero(),this.GetValue()!==0||this._focused||(this.UpdateDisplayText(this._uIProcess.ShowDisplayText()),this._updateUIForeColor2(this._focused,!1))},u.prototype.GetWatermarkDisplayZeroForeColor=function(){return this._GetDisplayWatermark().ZeroTextForeColor},u.prototype.SetWatermarkDisplayZeroForeColor=function(t){t=n.Utility.CheckColor(t);if(t===this.GetWatermarkDisplayZeroForeColor())return;var i=this._GetDisplayWatermark().ZeroTextForeColor;this._GetDisplayWatermark().ZeroTextForeColor=t,this._OnWatermarkDisplayZeroForeColorChanged(i,t)},u.prototype._OnWatermarkDisplayZeroForeColorChanged=function(n,t){this.GetValue()!==0||this._focused||this._updateUIForeColor2(this._focused,!1)},u.prototype._UseWatermarkText=function(n){var t,u,r,i;t=n?this._GetDisplayWatermark():this._GetWatermark(),u=this.GetValue();if(u===0){if(this._focused&&!n||!this._focused&&n){r=t.ZeroTextReal;if(r!=null&&r!=="")return!0}}else if(u==null)if(this._focused&&!n||!this._focused&&n){i=t.NullTextReal;if(i!=null&&i!=="")return!0}return!1},u.prototype._UseWatermarkZero=function(n){var i,r,t;i=n?this._GetDisplayWatermark():this._GetWatermark(),r=this.GetValue();if(r===0)if(this._focused&&!n||!this._focused&&n){t=i.ZeroTextReal;if(t!=null&&t!=="")return!0}return!1},u.prototype._getShownWatermarkText=function(n){var t;return t=n?this._GetWatermark():this._GetDisplayWatermark(),this.GetValue()===0?t.ZeroTextReal:r.prototype._getShownWatermarkText.call(this,n)},u.prototype._getShownWatermarkTextForeColor=function(n){var t;t=n?this._GetWatermark():this._GetDisplayWatermark();if(this.GetValue()===0)if(t.ZeroTextReal!=null&&t.ZeroTextReal!=="")return t.ZeroTextForeColor;return r.prototype._getShownWatermarkTextForeColor.call(this,n)},u.prototype._GetTextForeColor=function(){var t=this.GetValue(),n="";return n=t<0?this.NegativeColor:t>0?this.PositiveColor:this._format.Fields.IsPositive?this.PositiveColor:this.NegativeColor},u.prototype.UpdateWatermarkRealText=function(n){n?(this._updateWatermarkNullTextReal(),this._updateWatermarkZeroTextReal()):(this._updateWatermarkDisplayNullTextReal(),this._updateWatermarkDisplayZeroTextReal())},u.prototype._updateWatermarkNullTextReal=function(){this._GetWatermark().NullTextReal=this._format.Fields.GetDisplayNull()},u.prototype._updateWatermarkZeroTextReal=function(){this._GetWatermark().ZeroTextReal=this._format.Fields.GetDisplayZero()},u.prototype._updateWatermarkDisplayNullTextReal=function(){this._GetDisplayWatermark().NullTextReal=this._displayFormat.Fields.GetDisplayNull()},u.prototype._updateWatermarkDisplayZeroTextReal=function(){this._GetDisplayWatermark().ZeroTextReal=this._displayFormat.Fields.GetDisplayZero()},u}(n.BaseInputControl),n.GcNumber=r,t=function(n){function t(){n.apply(this,arguments),this.ZeroText="",this.ZeroTextReal="",this.ZeroTextForeColor=""}return __extends(t,n),t}(n.Watermark),n.NumberWatermark=t})(GCIM||(GCIM={}));var __extends=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},GCIM;(function(n){(function(n){n[n.PREFIX=0]="PREFIX",n[n.INTEGER=1]="INTEGER",n[n.DP=2]="DP",n[n.DECIMAL=3]="DECIMAL",n[n.POSTFIX=4]="POSTFIX"})(n.NumberFieldIndex||(n.NumberFieldIndex={}));var t=n.NumberFieldIndex,i=function(i){function r(){i.call(this,5),this._maxMinBehavior=n.MaxMinBehavior.Restore,this.FormatString="",this.isUndoAfterEdit=!1,this.Separator=null,this.sepCount=0,this._sepArray=new Array(this.sepCount),this.DecimalPoint=null,this.IsPositive=!0,this._insertMode=!0,this.Zero="",this.Null="",this.MaxValue=99999.99,this.MinValue=-99999,this.ValueSign=n.ValueSign.NoControl,this._firstFocus=!0,this._isPositiveSet=!1}return __extends(r,i),r.prototype.GetPrefixField=function(){return this.fieldArray[t.PREFIX]},r.prototype.GetIntegerField=function(){return this.fieldArray[t.INTEGER]},r.prototype.GetDPField=function(){return this.fieldArray[t.DP]},r.prototype.GetDigitField=function(){return this.fieldArray[t.DECIMAL]},r.prototype.GetPostFixField=function(){return this.fieldArray[t.POSTFIX]},r.prototype.Snap=function(){var n={};return n.PREFIX=this.GetPrefixField().Snap(),n.INTEGER=this.GetIntegerField().Snap(),n.DP=this.GetDPField().Snap(),n.DECIMAL=this.GetDigitField().Snap(),n.POSTFIX=this.GetPostFixField().Snap(),n.IsPositive=this.IsPositive,n.InsertMode=this._insertMode,n.Zero=this.Zero,n},r.prototype.Revert=function(n){this.GetPrefixField().Revert(n.PREFIX),this.GetIntegerField().Revert(n.INTEGER),this.GetDPField().Revert(n.DP),this.GetDigitField().Revert(n.DECIMAL),this.GetPostFixField().Revert(n.POSTFIX),this.IsPositive=n.IsPositive,this._insertMode=n.InsertMode,this.Zero=n.Zero},r.prototype.GetDecimal=function(){var n=this.GetDigitField().text;return n=n==null||n==""?n:n.toString().replace(r.SEPARATOR_STRING,""),n=n==null||n==""?"0":"0"+r.DP_STRING+n,this.IsPositive?n:r.NEGATIVESIGN_STRING+n},r.prototype.GetInteger=function(){var n=this.GetIntegerField().text;return n=n==null||n==""?n:n.toString().replace(r.SEPARATOR_STRING,""),n=n==null||n==""?"0":n,this.IsPositive?n:r.NEGATIVESIGN_STRING+n},r.prototype.GetValue=function(){var f=!1,t=this.GetDecimal()==null||this.GetDecimal()==""?0:parseFloat(this.GetDecimal()),i,u,n;return t=r.Round(t,15),i=this.GetInteger()==null||this.GetInteger()==""?0:parseFloat(this.GetInteger()),i=r.Round(i,0),t<0&&(f=!0),u=0,t.toString().indexOf(r.DP_STRING)!=-1&&(u=t.toString().length-t.toString().indexOf(r.DP_STRING)-1),n=0,t!=0?(n=Math.abs(i)+Math.abs(t),(i!=Math.abs(i)||i==0&&f)&&(n=n*-1)):n=i*1,u>0&&(n=r.Round(n,u)),n},r.prototype.GetUncheckedDecimal=function(){var n=this.GetDigitField().NewText;return n=n==null||n==""?n:n.replace(r.SEPARATOR_STRING,""),n=n==null||n==""?"0":"0"+r.DP_STRING+n,this.IsPositive==!0?n:r.NEGATIVESIGN_STRING+n},r.prototype.GetUncheckedInteger=function(){var n=this.GetIntegerField().NewText;return n=n==null||n==""?n:n.replace(r.SEPARATOR_STRING,""),n=n==null||n==""?"0":n,this.IsPositive?n:r.NEGATIVESIGN_STRING+n},r.prototype.GetUnCheckedValue=function(){var n=parseFloat(this.GetUncheckedDecimal()),i,u,t;return n=r.Round(n,15),i=parseFloat(this.GetUncheckedInteger()),i=r.Round(i,0),u=0,n.toString().indexOf(r.DP_STRING)!=-1&&(u=n.toString().length-n.toString().indexOf(r.DP_STRING)-1),t=0,n!=0?(t=Math.abs(i)+Math.abs(n),(i!=Math.abs(i)||n!=Math.abs(n))&&(t=t*-1),u>0&&(t=r.Round(t,u))):t=i*1,t},r.prototype.GetNonLiteralsText=function(t,i){var e=this.JudgeInsertPosition(t),h=e.field,c=e.offset,r,o,u;e=this.JudgeInsertPosition(i);var s=e.field,l=e.offset,f="";for(r=h;r<=s;r++)if(this.fieldArray[r]instanceof n.FixField)continue;else o=this.fieldArray[r],o instanceof n.DPField?f+=o.DP_Exist==!0?this.DecimalPoint:"":(u=o.NewText==null?"":o.NewText,f+=h==s?u.substring(c,l):r==h?u.substring(c,u.length):r==s?u.substring(0,l):u);return f},r.prototype.ValidateValue=function(n){var t=this.GetTrueMValue();return+n<=t.MaxValue-0&&+n>=t.MinValue-0?!0:!1},r.prototype.GetTrueMValue=function(){for(var t={},u="",f=this.GetIntegerField().RequiredLength+this.GetIntegerField().OptionalLength,i=0;i0&&(t.MaxValue=0),t},r.prototype.Cut=function(t,i){var u=t.toString(),e,f;return u.indexOf("e-")!==-1&&(u=n.Utility.CutTailZero(t.toFixed(20))),e=u.indexOf(r.DP_STRING),f=e+1+i,e==-1||f>u.length||(u=u.substring(0,f)),u},r.Round=function(t,i){var h,a,u,l,d,k,o,c,e,nt,y,p,v,s,f;if(t==null)return null;if(i<0||i==null)return t;h=t.toString()+"_____"+i.toString(),a=r.RoundCache[h];if(a!==undefined)return a;u=t.toString(),u.indexOf("e-")!==-1&&(u=n.Utility.CutTailZero(t.toFixed(20))),l=!0,u.substr(0,1)=="-"&&(l=!1,u=u.substr(1,u.length-1)),d=/(\d+)(?:.(\d+))?e([\-+])(\d+)/,k=d.exec(u);if(k!=null){o=parseFloat(RegExp.$4);if(RegExp.$3=="-"){for(o-=RegExp.$1.length,c="",s=0;s=5){y=parseInt(e,10),y++,e=y.toString();if(e.length>i)e="",p=parseInt(b,10),p++,b=p.toString();else if(e.length=0;e--){r=this.fieldArray[e],u=0,r instanceof n.FixField?(o=this.GetUnCheckedValue(),u=r.GetDisplayText(o,this.IsPositive).length):u=r.GetLengthNow()>r.minLength?r.GetLengthNow():r.minLength;if(t>f-u&&t<=f)return i.offset=t-f+u,i.index=e,i;f-=u}return i.offset=0,i.index=-1,i},r.prototype.GetFieldIndexToRight=function(t){for(var r={},f=0,u,i,o,e=0;ei.minLength?i.GetLengthNow():i.minLength;if(t>=f&&t5||n<0?null:this.fieldArray[n]},r.prototype.GetFieldRange=function(n){for(var u={},f=0,o,r,e,i=0;it.DP&&r.DP_Exist&&(f+=r.DecimalPoint.length),e=this.GetFieldByIndex(n),u.start=f,u.length=e.GetLengthNow(),u},r.prototype.CheckFixStatus=function(n){(this.GetUnCheckedValue()>0||n)&&(this.IsPositive=!0),this.GetPrefixField().CheckStatus(this.IsPositive),this.GetPostFixField().CheckStatus(this.IsPositive)},r.prototype.DoClearAction=function(){return this.CheckFixStatus(!0),this.GetIntegerField().Clear(),this.GetDPField().Clear(),this.GetDigitField().Clear(),!0},r.prototype.SetValue=function(t,i){var f,u,e;if(t==null)return this.DoClearAction();f=t,f>0||this.ValueSign==n.ValueSign.Positive?this.IsPositive=!0:f<0||this.ValueSign==n.ValueSign.Negative?this.IsPositive=!1:this._isPositiveSet||(this.IsPositive=!0),t=r.Round(t,this.GetDigitField().maxLength);if(i!=!1)if(!this.ValidateValue(t))return!1;return this.GetIntegerField().SetValue(t,i),this.GetDigitField().SetValue(t,i),u=!1,this.GetDigitField().RequiredLength+this.GetDigitField().OptionalLength==0&&(this.GetDigitField().maxLength=0),i==!0&&(e=this.GetDPField().DP_Exist),(this.GetDigitField().RequiredLength>0||this.GetDigitField().GetLengthNow()>0)&&(u=!0),i==!0&&(u=e==!0?!0:u),this.GetDPField().SetValue(t,u),this.CheckFixStatus(!1),!0},r.prototype.SetDisplayValue=function(t,i,u){var f,o,s,e,h;this.IsPositive=t<0?!1:t>0?!0:i!=null?i:!0,f=t.toString(),f.indexOf("e-")!==-1&&(f=n.Utility.CutTailZero(t.toFixed(20))),e=f.indexOf(r.DP_STRING),e!=-1&&f.substring(e+1,f.length).length>this.GetDigitField().maxLength&&!u&&(t=r.Round(t,this.GetDigitField().maxLength),f=t.toString(),f.indexOf("e-")!==-1&&(f=n.Utility.CutTailZero(t.toFixed(20)))),f=f.replace(r.NEGATIVESIGN_STRING,"0"),e=f.indexOf(r.DP_STRING),e!=-1?(o=f.substring(0,e),h=f.length,s=f.substring(e+1,h)):o=f,e!=-1?(this.GetIntegerField().text=o,this.GetDigitField().text=s,this.GetDigitField().NewText=s,this.GetDPField().DP_Exist=!0):(this.GetIntegerField().text=o,this.GetDigitField().text="",this.GetDigitField().NewText="",this.GetDPField().DP_Exist=this.GetDigitField().RequiredLength==0?!1:!0)},r.prototype.Insert=function(n,i,r){var w=0,o=0,u=0,h="",a="",b=!1,y=!1,f={},p,e,s,l;f.valid=!1,f.curPos=n,p=this.JudgeInsertPosition(n),o=p.field,u=p.offset,e={},s=this.GetValidText(i),f.AllTextIsSign=s.AllTextIsSign,h=s.intText,a=s.decText,b=s.hasDP,y=s.isValid,f.valid=y;if(y==!1)return f;if(b==!0&&this.GetDPField().GetLengthNow()==0&&o==t.INTEGER){if(this.GetDPField().maxLength==1){var k=a.length,v=this.GetIntegerField().NewText==null?"":this.GetIntegerField().NewText,c=v;while(c.length>0&&c.substring(0,1)=="0")c=c.substring(1,c.length),w++;l=v.substring(u,v.length);while(this.Separator!=""&&l.indexOf(this.Separator)!=-1)l.replace(this.Separator,"");a=a+l,this.GetIntegerField().Replace(u,l.length,h,!1),this.GetDPField().DP_Exist=!0,u=0,e=this.GetDigitField().Insert(u,a),u=e.curPos,o=t.DECIMAL,u=Math.min(k,u)}else e=this.GetIntegerField().InitialInsert(u,h),u=e.curPos;f.valid=!e.existInvalid,n=this.GetCurrentAnteriorLength(o)+u}else{if(h=="")return s.AllTextIsSign&&(f.curPos=this.GetCurrentAnteriorLength(o)+u),f;o==1&&(e=this.GetIntegerField().InitialInsert(u,h),u=e.curPos),o==3&&(e=this.GetDigitField().Insert(u,h),u=e.curPos),f.valid=!e.existInvalid,n=this.GetCurrentAnteriorLength(o)+u}return f.curPos=n,f.retObj=e,f.PrefixZero=w,this.isUndoAfterEdit=!0,f},r.prototype._IsSupportDecimalPart=function(){return this.GetDigitField().maxLength>0},r.prototype.Replace=function(n,i,r,u){var f,b,p,d,w;this.ResetIsPositive(n,i),f={},f.valid=!0;if(this.GetLengthNow()==0)return f=this.Insert(n,r,u),f.valid=!0,f;var s,c=0,y=0,e=0,k=0,h="",l="",tt=!1,v=!1,g=this.JudgePosition(n,i);c=g.startFieldIndex,e=g.startPosInField,y=g.endFieldIndex,k=g.endPosInField,b=this.GetValidText(r);if(b.AllTextIsSign)return f.AllTextIsSign=b.AllTextIsSign,f;h=b.intText,l=b.decText,v=b.hasDP,tt=b.isValid;if(tt==!1)return f;var o=0,a=0,nt=!1;if(c==y)switch(c){case t.DP:if(h.length>0){e=this.GetIntegerField().GetLengthNow(),f=this.GetIntegerField().InitialInsert(e,h),e=f.curPos,n=this.GetCurrentAnteriorLength(t.INTEGER)+e;if(f.result==!1)return f}v&&(this.GetDPField().DP_Exist=!0,n=this.GetCurrentAnteriorLength(t.DECIMAL)),l.length>0&&(e=0,f=this.GetDigitField().Insert(e,l),e=f.curPos,this.GetDigitField().text!=this.GetDigitField().NewText&&(n=this.GetCurrentAnteriorLength(t.DECIMAL)+e));break;case t.INTEGER:if(this.GetDPField().maxLength==1&&v&&this.GetDPField().GetLengthNow()==0){d=l.length,p=this.GetIntegerField().NewText==null?"":this.GetIntegerField().NewText,p=p.substring(k,p.length);while(this.Separator!=""&&p.indexOf(this.Separator)!=-1)p.replace(this.Separator,"");l+=p,this.GetIntegerField().Replace(e,this.GetIntegerField().GetLengthNow()-e,h),this.GetDPField().DP_Exist=!0,e=0,f=this.GetDigitField().Insert(e,l),e=f.curPos,n=this.GetCurrentAnteriorLength(t.DECIMAL)+Math.min(d,e)}else if(h.length==0)return!1;else f=this.GetIntegerField().Replace(e,k-e,h),e=f.curPos,n=this.GetCurrentAnteriorLength(t.INTEGER)+e;break;case t.DECIMAL:if(h.length==0)return!1;else f=this.GetDigitField().Replace(e,k-e,h),e=f.curPos,n=this.GetCurrentAnteriorLength(t.DECIMAL)+e;break;case t.PREFIX:if(!this._insertMode&&this.GetIntegerField().GetLengthNow()>0)e=0,f=this.GetIntegerField().Replace(e,i,h),e=f.curPos,n=this.GetCurrentAnteriorLength(t.INTEGER)+e;else{e=0,f=this.GetIntegerField().InitialInsert(e,h);if(f.existInvalid)return f.valid=!1,f;else e=f.curPos,n=this.GetCurrentAnteriorLength(t.INTEGER)+e}break;case t.POSTFIX:c=this.GetDigitField().GetLengthNow()>0||this.GetDPField().GetLengthNow()>0?t.DECIMAL:t.INTEGER,e=this.fieldArray[c].GetLengthNow(),f=c==1?this.fieldArray[c].InitialInsert(e,r):this.fieldArray[c].Insert(e,r);if(f.existInvalid)return f.valid=!1,f;else e=f.curPos,n=this.GetCurrentAnteriorLength(c)+e;break;default:return!1}else if(this.GetDPField().GetLengthNow()==0)for(s=c;s<=y;s++){s==c?(o=e,a=this.fieldArray[s].GetLengthNow()-o):(o=0,a=s!=y?this.fieldArray[s].GetLengthNow():k);if(s==t.INTEGER){d=l.length,w=this.GetIntegerField().NewText==null?"":this.GetIntegerField().NewText,w=w.substring(o+a,w.length);while(this.Separator!=""&&w.indexOf(this.Separator)!=-1)w.replace(this.Separator,"");l+=w,v&&this.GetDPField().maxLength==1?(this.GetIntegerField().Replace(o,this.GetIntegerField().GetLengthNow()-o,h),this.GetDPField().DP_Exist=!0,o=0,f=this.GetDigitField().Insert(o,l),o=f.curPos,n=this.GetCurrentAnteriorLength(t.DECIMAL)+Math.min(d,o)):(f=this.GetIntegerField().Replace(o,a,h),o=f.curPos,n=this.GetCurrentAnteriorLength(t.INTEGER)+o)}}else{for(s=c;s<=y;s++)s==t.DP&&(nt=!0);for(s=c;s<=y;s++){s==c?(o=e,a=this.fieldArray[s].GetLengthNow()-o):(o=0,a=s==y?k:this.fieldArray[s].GetLengthNow());if(nt)switch(s){case t.DP:s==c?(o=this.GetIntegerField().GetLengthNow(),f=this.GetIntegerField().InitialInsert(o,h),o=f.curPos,n=v?this.GetCurrentAnteriorLength(t.DECIMAL):this.GetCurrentAnteriorLength(t.INTEGER)+o):s==y&&(l!=""&&(o=0,f=this.GetDigitField().Insert(o,l),o=f.curPos,n=this.GetCurrentAnteriorLength(t.DECIMAL)+o),this.GetDigitField().GetLengthNow()!=0||v||this.GetDPField().Clear());break;case t.DECIMAL:l!=""?(f=this.GetDigitField().Replace(o,a,l),o=f.curPos,n=this.GetCurrentAnteriorLength(t.DECIMAL)+o):(this.GetDigitField().Delete(o,a),this.GetDigitField().GetLengthNow()!=0||v||this.GetDPField().Clear());break;case t.INTEGER:f=this.GetIntegerField().Replace(o,a,h),f.valid=!f.existInvalid,o=f.curPos,n=v?this.GetCurrentAnteriorLength(t.DECIMAL):this.GetCurrentAnteriorLength(t.INTEGER)+o;break;default:break}else if(h.length==0)return!1;else switch(s){case t.DECIMAL:case t.INTEGER:f=this.fieldArray[s].Replace(o,a,h),o=f.curPos,n=this.GetCurrentAnteriorLength(s)+o;break;default:break}}}return f.curPos=n,f.valid==null||f.valid?(this.isUndoAfterEdit=!0,f.valid=!0):(this.RollBack(this.GetValue(),!0),f.valid=!1),f},r.prototype.Delete=function(n,t){var u=0,f=0,i,r;return this.ResetIsPositive(n,t),i={},i=this.PreProcessDelete(n,t),u=i.field,f=i.offset,this.CheckFixStatus(!1),n=this.GetCurrentAnteriorLength(u)+f,r={},r.curPos=n,r.valid=!0,this.isUndoAfterEdit=!0,r},r.prototype.DealDP=function(n,i,r){var o,f,c,l,s,h;this.ResetIsPositive(n,i),i>0?(c=this.PreProcessDelete(n,i),o=c.field,f=c.offset,n=this.GetCurrentAnteriorLength(o)+f):this.GetDPField().GetLengthNow()!=0||r||(l=this.PreProcessDelete(n,1),o=l.field,f=l.offset,n=this.GetCurrentAnteriorLength(o)+f);if(this.GetDPField().DP_Exist==!1){nthis.GetCurrentAnteriorLength(t.POSTFIX)&&(n=this.GetCurrentAnteriorLength(t.POSTFIX));var e=n-this.GetPrefixField().GetLengthNow(),a=this.GetIntegerField().NewText==null?"":this.GetIntegerField().NewText,u=a.substring(e,a.length);this.GetIntegerField().Delete(e,u.length);if(a==""&&this.GetIntegerField().RequiredLength>0){for(s="0",h=0;h0&&(e=this.PreProcessDelete(i,r),o=e.field,s=e.offset),u?this.ValueSign==n.ValueSign.NoControl&&(this.IsPositive=!0,this.CheckFixStatus(!1)):this.ValueSign==n.ValueSign.NoControl&&(this.IsPositive=!this.IsPositive,this.CheckFixStatus(!1)),i=o==t.PREFIX?this.GetCurrentAnteriorLength(t.INTEGER):o==t.POSTFIX?this.GetCurrentAnteriorLength(t.POSTFIX):this.GetCurrentAnteriorLength(o)+s,this.isUndoAfterEdit=!0,i},r.prototype.PerformSpin=function(i,u,f,e){var p={},s,h,g,w,b,it,k,nt,c,tt;p.curPos=i,p.isValid=!1;if(e==!0){g=this.GetTrueMValue(),s=g.MaxValue,h=g.MinValue,w=this.MinValue>h?this.MinValue:h,b=this.MaxValue0?w:0,s=b;break;case n.ValueSign.Negative:h=w,s=b<0?b:0;break}if(u!=0)u>0?this.SetValue(h,!1):u<0&&this.SetValue(s,!1),i=this.GetCurrentAnteriorLength(2);else return p;return p.curPos=i,p.isValid=!0,p}var y=0,d=0,ut=this.JudgeSpinPosition(i);y=ut.field,d=ut.offset;if(y==t.PREFIX||y==t.POSTFIX||y==t.DP||y==-1)return p;g=this.GetTrueMValue(),s=g.MaxValue,h=g.MinValue,w=this.MinValue>h?this.MinValue:h,b=this.MaxValue0?w:0,s=b;break;case n.ValueSign.Negative:h=w,s=b<0?b:0;break}if(s0?h:s}else{a=parseFloat(this.GetUncheckedInteger()),l=rt=parseFloat(this.GetUncheckedDecimal()),o=a+l,o>s||o0||l>0)?a-l:a+l;break;case t.DECIMAL:v=v==0?1:v,l+=u*this.Power(.1,v),o=a+l,o=r.Round(o,v);break;default:break}(o>s||os&&(o=s):o>s?o=s:os?o=s:o0?s.toString().length-k-1:s.toString().length-k-1):k!=-1&&(nt=h>0?h.toString().length-k-1:h.toString().length-k-1),v=v>=nt?v:nt,l=r.Round(l,v)),rt!=l&&(ot=!0),this.ValueSign==n.ValueSign.NoControl?this.IsPositive=o.toString().indexOf(r.NEGATIVESIGN_STRING)==0?!1:!0:this.ValueSign==n.ValueSign.Positive?this.IsPositive=!0:this.ValueSign==n.ValueSign.Negative&&(this.IsPositive=!1),c=this.GetIntegerField().GetLengthNow()==0&&a==0?"":a,tt=c.toString().indexOf(r.NEGATIVESIGN_STRING),tt!=-1&&(c=c.toString().substring(1,c.toString().length)),c!=0||this.GetIntegerField().RequiredLength!=0?this.GetIntegerField().SetValue(c,!1):c.toString().length!=0&&(this.GetIntegerField().NewText="0");if(y==t.DECIMAL||ot){c=l.toString();while(c.indexOf(r.NEGATIVESIGN_STRING)!=-1)c=c.replace(r.NEGATIVESIGN_STRING,"");l==0&&v!=0&&(c="0.0"),tt=c.indexOf(r.DP_STRING),tt!=-1&&(c=c.substring(2,c.length));while(c.length0?i==0&&(e=this.GetDigitField().Delete(f,1),f=e.curPos):(e=this.fieldArray[o].Delete(f,p-f),f=e.curPos),c=o,h=f;else for(c=0,h=0,r=o;r<=v;r++)r==o?(u=f,s=this.fieldArray[r].GetLengthNow()-f):(u=0,s=r!=v?this.fieldArray[r].GetLengthNow():p),r==t.DP?this.GetDigitField().GetLengthNow()==0?this.GetDPField().Delete(u,s):w=!0:r==t.DECIMAL?(e=this.GetDigitField().Delete(u,s),u=e.curPos,w&&this.GetDigitField().GetLengthNow()==0&&this.GetDPField().Delete(u,s)):(e=this.fieldArray[r].Delete(u,s),u=e.curPos),r==t.INTEGER?(l=3,c=r,h=u):r==t.DP&&l<3?(l=2,c=r,h=u):r==t.DECIMAL&&l<2&&(l=1,c=r,h=u);return y={},y.field=c,y.offset=h,y},r.prototype.JudgePosition=function(n,i){for(var f=0,u=0,h=0,o=0,s=0,e,r=0;rn){u=r,h=n-(f-this.fieldArray[r].GetLengthNow());break}}for(f=this.GetCurrentAnteriorLength(u),o=u,s=n+i-f,r=u;r=n+i){o=r,s=n+i-(f-this.fieldArray[r].GetLengthNow());break}}return e={},e.startFieldIndex=u,e.startPosInField=h,e.endFieldIndex=o,e.endPosInField=s,e},r.prototype.JudgeSpinPosition=function(n){for(var e=0,i=-1,r=0,f,u=0;u1?f=r.length%2==0?!0:!1:r.length%2==1&&(f=!f),this.IsPositive=f),this.ValueSign==n.ValueSign.Negative?this.IsPositive=!1:this.ValueSign==n.ValueSign.Positive&&(this.IsPositive=!0),this.IsPositive?(this.GetPrefixField().PromptText=this.GetPrefixField().PositiveText,this.GetPostFixField().PromptText=this.GetPostFixField().PositiveText):(this.GetPrefixField().PromptText=this.GetPrefixField().NegativeText,this.GetPostFixField().PromptText=this.GetPostFixField().NegativeText),s="0123456789"+this.Separator+this.DecimalPoint,u=this.GetValidation(s,t);if(u.length==0)return i;e=u.indexOf(this.DecimalPoint),e!=-1?(i.intText=u.substring(0,e),i.decText=u.substring(e+1,u.length),i.hasDP=!0):i.intText=u;while(this.Separator!=""&&i.intText.indexOf(this.Separator)!=-1)i.intText=i.intText.replace(this.Separator.toString(),"");while(this.Separator!=""&&i.decText.indexOf(this.Separator)!=-1)i.decText=i.decText.replace(this.Separator.toString(),"");while(this.DecimalPoint!=""&&i.decText.indexOf(this.DecimalPoint)!=-1)i.decText=i.decText.replace(this.DecimalPoint.toString(),"");return i.isValid=!0,i},r.prototype.GetValidation=function(n,t){var u="",i,r;if(n=="")return"";for(i=0;i0)i--;if(i==0)return-1;for(i--,u=0,r=0;rr.MAX_LENGTH)throw"The Format.Digit's value is invalid.";var t=n.indexOf(r.DP_STRING);if(t==n.length-1)throw"The Format.Digit's value is invalid.";else t==-1?(this.UpdateIntegerField(n),this.GetDPField().DP_Exist=!1,this.UpdateDecimalField("")):(this.UpdateIntegerField(n.Substring(0,t)),this.GetDPField().DP_Exist=!0,this.UpdateDecimalField(n.Substring(t+1)))},r.prototype.UpdateIntegerField=function(n){var f=0,o=0,u,i,e,s,t;if(n===""){this.GetIntegerField().IntegerField(o,f,this.Separator);return}for(u=0,i=!0,t=0;t=0;t--)n.charAt(t)==r.SEPARATOR_STRING&&(e[s++]=n.length-1-t);u>0?(this._sepArray=e,this.sepCount=u):this.sepCount=0,this.GetIntegerField().IntegerField(o,f,this.Separator)},r.prototype.UpdateDecimalField=function(n){for(var r=0,i=0,t=0;t0&&(this.FormattedIntegerValue[t]=r.substr(0,n),t++),i=0,u=parseInt((f/4).toString(),10),i=0;i0?n=i.PositiveText+n+r.PositiveText:this.Value==0?t.Zero==""?(n=this.DigitData[0],n=t.IsPositive?i.PositiveText+n+r.PositiveText:i.NegativeText+n+r.NegativeText):n=t.Zero:this.Value==null&&(n=t.Null),this.Result=n},f.prototype.ToDisplayText=function(){return this.SetDefaultCharacters(),this.FormatInteger(),this.ClearInteger(),this.FormatFraction(),this.FormatInteger2OtherCharacter(),this.FormatFraction2OtherCharacter(),this.AddUnit2Integer(),this.AddUnit2Fraction(),this.Merge(),this.Result},f.NumberFormatExFactory=function(n,t){var f="[DBNum1]G",s="[DBNum2]G",e="[DBNum3]G",o="[DBNum4]G",i=null,r,u;switch(n.Fields.FormatString){case f:i=new y(n,t);break;case s:i=new a(n,t);break;case e:i=new l(n,t);break;case o:i=new v(n,t);break;default:r=/^.*\[.*\]$/,u=r.exec(n.Fields.FormatString),u!=null&&(i=new p(n,t));break}return i},f}(),y,a,l,v,p,t,r,i,u,s,o,h,c,e;n.NumberFormatExBase=f,y=function(n){function u(u,f){n.call(this,u,f),this.DigitCharacterType=(new t).JP_Simplified,this.IntegerUnitCharacterType=(new r).JP_Simplified,this.FractionUnitCharacterType=(new i).None}return __extends(u,n),u}(f),n.NumberFormatEx_DBNum1=y,a=function(n){function u(u,f){n.call(this,u,f),this.DigitCharacterType=(new t).JP_Traditional,this.IntegerUnitCharacterType=(new r).JP_Traditional,this.FractionUnitCharacterType=(new i).None}return __extends(u,n),u}(f),n.NumberFormatEx_DBNum2=a,l=function(n){function u(u,f){n.call(this,u,f),this.DigitCharacterType=(new t).SBC_Case,this.IntegerUnitCharacterType=(new r).JP_Simplified,this.FractionUnitCharacterType=(new i).None}return __extends(u,n),u}(f),n.NumberFormatEx_DBNum3=l,v=function(n){function u(u,f){n.call(this,u,f),this.DigitCharacterType=(new t).JP_Simplified,this.IntegerUnitCharacterType=(new r).JP_Simplified,this.FractionUnitCharacterType=(new i).JP_Simplified}return __extends(u,n),u}(f),n.NumberFormatEx_DBNum4=v,p=function(){function n(n,t){var e,u,r,f,i;this.Result="",this.InterceptBitsCount=0,this.Postfix="",this.IntegerStyle="",this.DecimalStyle="";if(n!=null&&t!=null){this.IntegerAbsolute=Math.abs(t.Fields.GetInteger()),this.Integer=t.Fields.GetInteger(),this.FractionAbsolute=Math.abs(t.Fields.GetDecimal()),this.Fraction=t.Fields.GetDecimal(),this.DisplayFormat=n,this.Format=t,e=this.ParseFormatPattern();if(!e)throw"The NumberDisplayFormat.Digit's value is invalid.";u=/^(.*)\[.*\:.*\]$/,r=u.exec(n.Fields.FormatString),r!=null&&(f=r[1],i=f.split("."),this.IntegerStyle=i[0],i.length==2&&(this.DecimalStyle=i[1]))}}return n.prototype.ParseFormatPattern=function(){var a,l,s,h,o,i;if(this.DisplayFormat.Fields.FormatString==null||this.DisplayFormat.Fields.FormatString=="")return!1;a=/^.*\[.+\:.*\]$/,l=a.exec(this.DisplayFormat.Fields.FormatString);if(l==null)return!1;var n=!1,w=/\:([^\[\]]*)\]$/,c=w.exec(this.DisplayFormat.Fields.FormatString);c!=null&&(this.Postfix=c[1]);var p=this.DisplayFormat.Fields.FormatString.replace(/\:[^\[\]]*\]$/,""),u=p.split("."),t=u[0],e="",r="",f="";if(u.length==2){e=u[1],s=!0,t.indexOf("[")==-1&&(s=!1,this.InterceptBitsCount=-1*e.indexOf("[")),r=/^(?:\#,?)*(?:0,?)*$/,f=/^(?:0*\[0*|0*\#*\[)\#*$/,s&&(r=/^(?:\#,?)*\[(?:\#,?)*(?:0,?)*$|^(?:\#,?)*(?:0,?)*\[(?:0,?)*$/,f=/^0*\#*/,i=t.replace(/,/g,""),this.InterceptBitsCount=i.length-i.indexOf("[")-1);var h=new RegExp(r),y=new RegExp(f),o=h.exec(t),v=y.exec(e);n=o==null||v==null?!1:!0}else u.length==1?t.split("[").length!=2?n=!1:(r=/^(?:\#,?)*(?:0,?)*$/,h=new RegExp(r),o=h.exec(t.replace(/\[/g,"")),o!=null?(i=t.replace(/,/g,""),this.InterceptBitsCount=i.length-i.indexOf("[")-1,n=!0):n=!1):n=!1;return n},n.prototype.Handle=function(){for(var u=this.IntegerAbsolute+this.FractionAbsolute,f=1,y=10,p=Math.abs(this.InterceptBitsCount),i,n,a,e,s,c,l,t=0;t=this.Result.length){n=this.IntegerStyle.substr(0,this.IntegerStyle.length-i)+n,n=n.replace(/\#,?/g,"");break}}i0&&(h=this.ShowDisplayText(),h!=null&&(o=h.length-e.SelectionStart,o<0&&(o=0),e.Text!=null&&(e.SelectionStart=e.Text.length-o,e.SelectionEnd=e.SelectionStart))),(e.SelectionStart==-1||e.SelectionStart>e.Text.length)&&(e.SelectionStart=0,e.SelectionEnd=0),t==n.FocusType.Left?(e.SelectionStart=0,e.SelectionEnd=0):t==n.FocusType.Right&&(e.SelectionStart=e.Text.length,e.SelectionEnd=e.Text.length),r==n.HighlightText.All&&(e.SelectionStart=0,e.SelectionEnd=e.Text.length,this._format.Fields._firstFocus=!1),f||t==n.FocusType.ClientEvent||t==n.FocusType.SpinButton||(this.OldState=this.State),this._format.Fields._firstFocus&&t!=n.FocusType.Click&&(e.SelectionStart=this._format.Fields.GetValue()==0&&this._format.Fields.Zero!=null&&this._format.Fields.Zero!=""?this._format.Fields.Zero.length:this._format.Fields.GetPrefixField().GetLengthNow()+this.RestorePosition(this._format.Fields.GetIntegerField().GetLengthNow()),e.SelectionEnd=e.SelectionStart),this._format.Fields._firstFocus=!1,this.IsFocus=!0,e},r.prototype.LoseFocus=function(n,t,i){var r={},e=this.JudgeInput(t),f=this._format.Fields.GetUnCheckedValue(),u;this._format.Fields._isPositiveSet=!0;try{e?(this._format.Fields.SetValue(f,!0),this._displayFormat.Fields.SetDisplayValue(f,this._format.Fields.IsPositive,this.DisplayFormatIsNull)):(this.FireEvent(i,this._owner._specialClientEvents.InvalidRange,null,"InvalidRange"),this.OldState==1?this._format.Fields.RollBack(null):this._format.Fields.ValidateValue(t)?(this._format.Fields.RollBack(t),this._format.Fields.SetValue(t,!0),this._displayFormat.Fields.SetDisplayValue(t,this._format.Fields.IsPositive,this.DisplayFormatIsNull)):(t=this._format.Fields.GetValue(),this._format.Fields.RollBack(t),this._format.Fields.SetValue(t,!0),this._displayFormat.Fields.SetDisplayValue(t,this._format.Fields.IsPositive,this.DisplayFormatIsNull)),this.State=this.OldState)}finally{this._format.Fields._isPositiveSet=!1}return u=this.State==1?null:this._format.Fields.GetValue(),this.SetHideValue(u),r.Text=this.ShowDisplayText(),r.Text==this._displayFormat.Fields.Null,r.ValueText=this.GetShowText2(!1,!0),r.Color=this._owner._GetRealForeColor(!1,!1),r.Value=this.GetValue(),this.OnFocusValue={Value:r.Value,IsPositive:this._format.Fields.IsPositive},this.OldIsPositive=this._format.Fields.IsPositive,this._format.Fields.isUndoAfterEdit=!1,this.IsFocus=!1,r},r.prototype.SetHideValue=function(t){var i;document.getElementById(this.HelpID)&&(t!=null?(t=n.NumberFieldCollection.Round(t,15),this._format.Fields.IsPositive||t!=0||(t="-"+t),i=document.getElementById(this.HelpID),i!=null&&(i.value=t)):(i=document.getElementById(this.HelpID),i!=null&&(i.value=null))),this._owner._uIUpdate.SetHideText(t)},r.prototype.JudgeInput=function(n){if(this.State==1)return!0;var i=this._format.Fields.GetUnCheckedValue();return this._format.Fields.ValidateValue(i)},r.prototype.ShowText=function(t){var i;if(this.State==1)return this._format.Fields.GetDisplayNull();i=this._format.Fields.GetUnCheckedValue(),i=n.NumberFieldCollection.Round(i,15);var r=this._format.Fields.GetDisplayDigit(i,t),f=r.Text,u=f;return r.isNull||r.isZero||(u=this._format.Fields.GetDisplayText(i,f)),this.State=r.isNull?1:0,u},r.prototype.GetShowText2=function(t,i){var f,u,r;t==null&&(t=this._owner._focused),f="",i||(f=this._owner._getShownWatermarkText(t)),u=t?this._owner._format.Fields:this._owner._displayFormat.Fields;if(f===""){if(this.State==1)return"";r=t?u.GetUnCheckedValue():u.GetValue(),r=n.NumberFieldCollection.Round(r,15);var e=u.GetDisplayDigit2(r,!1),s=e.Text,o=s;return e.isNull||(o=u.GetDisplayText(r,s)),this.State=e.isNull?1:0,o}return f},r.prototype.GetLength=function(n){var t=this._owner._IsUseWatermarkText();return t.IsUseWatermarkText?t.WatermarkText.length:this.ShowText(n).length},r.prototype.ShowDisplayText=function(){return this.ShowDisplayText2(this._displayFormat.Fields.Null,this._displayFormat.Fields.Zero)},r.prototype.ShowDisplayText2=function(t,i){var e,r,u,s,h,a;if(this.State==1){var f="",v=/[^\\]?\{(.*[^\\])\}/,l=new RegExp(v.toString()),o=l.exec(t);return o!=null?(r=o[1],r.length!=0&&(u=r.substr(0,1),r.length<2||u!="\\"||(u=r.substr(1,1)),f=this._displayFormat.Fields.FormatString.replace(/#/g,u).replace(/0/g,u).replace(/,/g,n.NumberFieldCollection.SEPARATOR_STRING).replace(/\./g,this._displayFormat.Fields.DecimalPoint))):f=t.replace(/\\(.)/g,"$1"),f}e=this.DisplayFormatIsNull?this._format.Fields.GetValue():this._displayFormat.Fields.GetValue();if(e==0&&i!=""){var f="",v=/[^\\]?\{(.*[^\\])\}/,l=new RegExp(v.toString()),o=l.exec(i);return o!=null?(r=o[1],r.length!=0&&(u=r.substr(0,1),r.length<2||u!="\\"||(u=r.substr(1,1)),f=this._displayFormat.Fields.FormatString.replace(/#/g,u).replace(/0/g,u).replace(/,/g,n.NumberFieldCollection.SEPARATOR_STRING).replace(/\./g,this._displayFormat.Fields.DecimalPoint))):f=i.replace(/\\(.)/g,"$1"),f}var c="",l=/^\[DBNum[1-4]\]G$/,o=l.exec(this._displayFormat.Fields.FormatString);return o!=null||this.ParseFormatPattern()?(s=n.NumberFormatExBase.NumberFormatExFactory(this._displayFormat,this._format),s!=null&&(c=s.ToDisplayText())):(h=this.DisplayFormatIsNull?this._format.Fields.GetDisplayDigit(e):this._displayFormat.Fields.GetDisplayDigit(e),a=h.Text,c=this._displayFormat.Fields.GetDisplayText(e,a)),c},r.prototype.ParseFormatPattern=function(){var h,s,o,e,u;if(this._displayFormat.Fields.FormatString==null||this._displayFormat.Fields.FormatString=="")return!1;h=/^.*\[.+\:[^\[\]]*\]$/,s=h.exec(this._displayFormat.Fields.FormatString);if(s==null)return!1;var n=!1,a=this._displayFormat.Fields.FormatString.replace(/\:[^\[\]]*\]$/,""),i=a.split("."),r=i[0],c="",t="",f="";if(i.length==2){c=i[1],o=!0,r.indexOf("[")==-1&&(o=!1),t=/^(?:\#,?)*(?:0,?)*$/,f=/^(0*\[0*|0*\#*\[)\#*$/,o&&(t=/^(?:\#,?)*\[(?:\#,?)*(?:0,?)*$|^(?:\#,?)*(?:0,?)*\[(?:0,?)*$/,f=/^0*\#*$/);var e=new RegExp(t),v=new RegExp(f),u=e.exec(r),l=v.exec(c);n=u==null||l==null?!1:!0}else i.length==1?r.split("[").length!=2?n=!1:(t=/^(?:\#,?)*(?:0,?)*$/,e=new RegExp(t),u=e.exec(r.replace("[","")),n=u!=null?!0:!1):n=!1;return n},r.prototype.Clear=function(){var t={};return this.ClearMode==n.ClearModeAction.Zero?(this._format.Fields.IsPositive=!0,this.SetValue(0,!1),this.State=0,this._format.Fields.GetDisplayZero()==""?(t.SelectionStart=this._format.Fields.GetPrefixField().GetLengthNow()+this.RestorePosition(this._format.Fields.GetIntegerField().GetLengthNow()),t.SelectionEnd=t.SelectionStart):(t.SelectionStart=0,t.SelectionEnd=0)):(this.State=1,this.SetValue(null),t.SelectionStart=0,t.SelectionEnd=0,t.State=1),t.Text=this.GetShowText2(this._owner._focused,!0),t.Color=this._owner._GetRealForeColor(this._owner._focused,!0),t.System=!1,this.ClearMode==n.ClearModeAction.Null&&this._format.Fields.ValueSign==n.ValueSign.NoControl&&(this._format.Fields.IsPositive=!0,this._displayFormat.Fields.IsPositive=!0),t},r.prototype.ProcessShortcutKey=function(i,r,u,f){var e=t.prototype.ProcessShortcutKey.call(this,i,r,u);if(i!=null)if(i.toLowerCase()==n.KeyActions.ThreeZero)return typeof f=="undefined"&&(f=this._owner.SelectionStart),e=this.Paste(f,u,"000"),e.System=!1,e;return e},r.prototype.ProcessCharKeyInput=function(n,t,i,r,u,f){var e={},s,o;return 950)u--,i=this._format.Fields.GetFieldRange(u);return r.SelectionStart=this.RestorePosition(i.start),r.SelectionEnd=this.RestorePosition(i.length+i.start),this._format.Fields.GetValue()==0&&this._format.Fields.Zero!=null?r.SelectionEnd=this._format.Fields.Zero.length:this._format.Fields.GetValue()==null&&this._format.Fields.Null!=null&&(r.SelectionEnd=this._format.Fields.Null.length),n.Utility.GrapeCityTimeout=!1,this.isDblClick=!0,this.isMulSelect=!0,setTimeout(function(){n.Utility.GrapeCityTimeout=!0},500),r},r.prototype.CanUndo=function(){var i=this.OldValue,u=this.OnFocusValue.Value,n=this.OldIsPositive,f=this.OnFocusValue.IsPositive,t=this._format.Fields.GetUnCheckedValue(),r;t==0&&this.State==1&&(t=null),r=this._format.Fields.IsPositive;if(this._format.Fields.isUndoAfterEdit==!0){if(i!=u||n!=f){i=u,n=f;if(i==t&&n==r)return!1}}else if(i==t&&n==r)return!1;return!0},r.prototype.Undo=function(n,t){var i={},n=this.OldValue,t=this.OldState,e=this.OnFocusValue.Value,u=this.OldIsPositive,s=this.OnFocusValue.IsPositive,r=this._format.Fields.GetUnCheckedValue(),f,o;r==0&&this.State==1&&(r=null),f=this._format.Fields.IsPositive;if(this._format.Fields.isUndoAfterEdit==!0){if(n!=e||u!=s){n=e,u=s,e==null&&(t=1);if(n==r&&u==f)return this.OldValue=e,this.OldIsPositive=s,this.OldState=t,this._format.Fields.isUndoAfterEdit=!1,i}this._format.Fields.isUndoAfterEdit=!1}else if(n==r&&u==f)return i;return t==1&&(n=null),this._format.Fields.IsPositive=u,this._format.Fields.RollBack(n),this.OldValue=r,this.OldIsPositive=f,this.OldState=this.State,this.State=t,i.Text=this.GetShowText2(this._owner._focused,!0),i.Color=this._owner._GetRealForeColor(this._owner._focused,!0),this.State==1?(i.SelectionStart=0,i.SelectionEnd=0):n===0?(o=this._owner.GetWatermarkZeroText(),o!=null&&o.length>0&&(i.SelectionStart=0,i.SelectionEnd=0)):(i.SelectionStart=this._format.Fields.GetPrefixField().GetLengthNow()+this._format.Fields.GetIntegerField().GetLengthNow(),i.SelectionEnd=i.SelectionStart),i},r.prototype.Copy=function(t,i,r){var e=null,o=Math.abs(i-r),u=Math.min(i,r),f=Math.max(i,r);if(o==0)return;t==n.ClipContent.ExcludeLiterals?(u=this.AdjustPosition(u,0).start,f=this.AdjustPosition(f,0).start,e=this._format.Fields.GetNonLiteralsText(u,f)):e=n.Utility.GetSelectionText(this._owner.GetInputElement()),n.Utility.SetCopy(e,this._owner.GetUseClipboard())},r.prototype.Paste=function(t,i,r,u,f){var e,s,g,nt,y,k,rt,ut,ft,h,p,l,w,d,o;u&&(this.OldState=this.State),f=f==null?!1:f,e={},e.SelectionStart=t,e.SelectionEnd=i,e.isValid=!0;var v=!0,c=Math.min(t,i),a=Math.abs(i-t),tt="0123456789"+this._format.Fields.DecimalPoint,it=this._format.Fields.ValueSign;it==n.ValueSign.NoControl&&(tt+="+-"),u||f||!this._owner||(r=this.UpdateCrLfString(r,this._owner.GetAcceptsCrlf()));if(r==null||r.length==0)return e;it!=n.ValueSign.NoControl&&(r=r.replace(/[\+|\-]/g,"")),this.FireClientEvent("OnBeforePaste"),s=n.Utility.FilterText(tt,r),g=this.GetValidInput(s),s=g.Text,r==s&&g.IsValid||(v=!1),c=this.AdjustPosition(c,a).start,f||(a=this.AdjustPosition(c,a).length),nt=this._format.Fields.GetUnCheckedValue(),y=this.GetCurrentPosition(c),a>0&&(k=this._format.Fields.GetFieldIndexToRight(c).index,rt=this._format.Fields.GetFieldIndexToLeft(c+a).index,k!=rt?y=1:(k==0||k==4)&&(y=-1)),nt==0&&this._format.Fields.GetDisplayZero().length>0&&(y=1);if((r==""||s!="")&&y!=-1||f){if(r=="")return e}else return this._owner._specialClientEvents.InvalidInput&&(o={},o.Name=this._owner._specialClientEvents.InvalidInput,o.Args=null,o.Type="InvalidInput",e.EventInfo=o),e;ut=this._format.Fields.GetPrefixField().GetLengthNow(),ft=this.GetShowText2(this._owner._focused,!0),h=a>0?this._format.Fields.Replace(c,a,s,!1):this._format.Fields.Insert(c,s,!1),this.State=0,h.valid?(e.SelectionStart=this.RestorePosition(h.curPos),e.SelectionEnd=e.SelectionStart):(e.SelectionStart=t,e.SelectionEnd=i),e.Text=this.GetShowText2(this._owner._focused,!0),e.Color=this._owner._GetRealForeColor(this._owner._focused,!0);if(h.valid!=!0&&h.AllTextIsSign!==!0)return this._owner._specialClientEvents.InvalidInput&&(o={},o.Name=this._owner._specialClientEvents.InvalidInput,o.Args=null,o.Type="InvalidInput",e.EventInfo=o),e;this.State=0;if(v)if(h.AllTextIsSign){var ot=Math.min(t,i),et=Math.abs(t-i),b=this.AdjustPositionIgnoreSeparator(ot,et,ut);b&&e.Text!==ft?(e.SelectionStart=b.Start,e.SelectionEnd=b.Start+b.Length):e.SelectionStart=e.SelectionEnd=undefined,v=!0}else{nt==0&&c>0&&(c=0),s=s.replace(/[\+|\-]+/g,""),p=this.RestorePosition(c),h.PrefixZero>0&&s.substring(0,this._format.Fields.DecimalPoint.length)!=this._format.Fields.DecimalPoint&&(p-=h.PrefixZero),l=e.Text,l=l.replace(this._format.Fields.GetPrefixField().PromptText,"").substring(p,e.SelectionEnd),w=0;while(this._format.Fields.Separator!=""&&l.indexOf(this._format.Fields.Separator)!=-1)w++,l=l.replace(this._format.Fields.Separator,"");e.SelectionEnd-s.length-p-w<0?(d=0,h.PrefixZeroCount!=null&&(d=h.PrefixZeroCount),e.SelectionEnd-s.length-p-w+d<0&&(v=!1)):(l=l.substring(0,s.length),l.indexOf(s)==-1&&(v=!1))}return v||(e.isValid=!1,this._owner._specialClientEvents.InvalidInput&&(o={},o.Name=this._owner._specialClientEvents.InvalidInput,o.Args=null,o.Type="InvalidInput",e.EventInfo=o)),this.FireClientEvent("OnPaste"),e},r.prototype.GetValidInput=function(t){var u,i;if(t==null||t==="")return"";var r="",e=!1,f={};for(f.IsValid=!0,u=0;u"9"){if(i===this._format.Fields.GetIntegerField().Separator)r+=i;else if(i=="+")r+=i;else if(i=="-")r+=i;else if(i.toString()===this._format.Fields.GetDPField().DecimalPoint)if(!e){e=!0;if(this._format.Fields._IsSupportDecimalPart())r+=i;else{f.IsValid=!1;if(this._owner.AcceptsDecimal===n.DecimalMode.Cut)break}}}else r+=i}return f.Text=r,f},r.prototype.UpdateCrLfString=function(t,i){return i!==n.CrLfMode.NoControl?n.BaseUIProcess.UpdateCrLfString.call(this,t,i):n.BaseUIProcess.UpdateCrLfString.call(this,t,n.CrLfMode.Filter)},r.prototype.SelectAll=function(){this._format.Fields._firstFocus=!1;var t={},n=this.GetShowText2(!0,!1),i=this._owner.GetInputElement();return i!=null&&i.value.length>n.length&&(n=i.value),t.SelectionStart=0,t.SelectionEnd=n==this._format.Fields.GetDisplayZero()||n==this._format.Fields.GetDisplayNull()?n.length:n.length,this.isMulSelected=!0,t},r.prototype.SetValue=function(n,t){this._format.Fields.SetValue(n,t);if(n!=null){var i=this._format.Fields.GetUnCheckedValue();this.SetHideValue(i)}else this.SetHideValue(null)},r.prototype.ProcessCharKey=function(t,i,r,u,f){var s={},b=this.AdjustPosition(t,0).start,d=this.AdjustPosition(i,0).start,o=Math.min(b,d),c=Math.abs(d-b),h,l,k,e;s.start=o,s.success=!1;if(this._format.Fields.GetFieldIndexToLeft(o).index==-1)return this._owner._specialClientEvents.InvalidInput&&(e={},e.Name=this._owner._specialClientEvents.InvalidInput,e.Args=null,e.Type="InvalidInput",s.EventInfo=e),s;l=r.toString();if(c!=0||this.isOverWrite)if(c==0)if(o==this._format.Fields.GetLengthNow())h=this._format.Fields.Insert(o,l,!1);else{var a=!1,w=this._format.Fields.GetFieldIndexToLeft(o),v=w.index,y=w.offset,p=this._format.Fields.GetFieldRange(v);this._format.Fields.GetFieldByIndex(v)instanceof n.FixField?o-y+p.length==this._format.Fields.GetLengthNow()?a=!1:(a=!0,c=p.length-y+1):(a=!0,c=1);if(this._format.Fields.GetFieldIndexToLeft(o+c).index==-1)return this._owner._specialClientEvents.InvalidInput&&(e={},e.Name=this._owner._specialClientEvents.InvalidInput,e.Args=null,e.Type="InvalidInput",s.EventInfo=e),s;h=a?this._format.Fields.Replace(o,c,l,!1):this._format.Fields.Insert(o,l,!1)}else h=this._format.Fields.Replace(o,c,l,!1);else k=this._owner._IsUseWatermarkText(this._owner._focused),k.IsUseWatermarkText&&this._format.Fields.DoClearAction(),h=this._format.Fields.Insert(o,l,!1);return o=h.curPos,h.valid!=!0?(this._owner._specialClientEvents.InvalidInput&&(e={},e.Name=this._owner._specialClientEvents.InvalidInput,e.Args=null,e.Type="InvalidInput",s.EventInfo=e),s.start=o,s.success=!1,s):(s.start=o,s.success=!0,s)},r.prototype.ProcessBackSpaceKey=function(t,i){var r={},b,s,l,y,c;r.SelectionStart=t,r.SelectionEnd=i;var w=this._format.Fields,p=this.AdjustPosition(Math.min(t,i),0),a=p.start,o=w.GetFieldIndexToRight(a),e=o.index,h=o.offset,p=this.AdjustPosition(Math.max(t,i),0),v=p.start,o=w.GetFieldIndexToRight(v),b=o.index,u=Math.min(a,v),f=Math.abs(a-v);if(u==0&&f==0)return r;if(e==-1)return r;if(f==0){if(u<=this._format.Fields.GetFieldRange(0).length)return r;if(e==0&&this._format.Fields.GetFieldByIndex(e)instanceof n.FixField||e==1&&h==0&&this._format.Fields.GetFieldByIndex(e-1)instanceof n.FixField)return r;h==0&&(e--,h=this._format.Fields.GetFieldByIndex(e).GetLengthNow()),this._format.Fields.GetFieldByIndex(e)instanceof n.FixField?(f=h+1,u=u-f):this._format.Fields.GetFieldByIndex(e)instanceof n.DPField?(f=2,u-=2):(f=1,u--),u=this._format.Fields.Delete(u,f).curPos,r.SelectionStart=this.RestorePosition(u),r.SelectionEnd=r.SelectionStart}else{o=this._format.Fields.GetFieldIndexToRight(u+f),b=o.index;if(b==-1)return r;s=this._format.Fields.Delete(u,f);if(!s.valid)return r;r.SelectionStart=this.RestorePosition(s.curPos),r.SelectionEnd=r.SelectionStart,c=this._format.Fields.GetFieldIndexToRight(s.curPos),y=c.index,l=c.offset,l!=0&&this._format.Fields.GetFieldByIndex(y)instanceof n.FixField&&(r.SelectionStart=r.SelectionStart-l,r.SelectionEnd=r.SelectionStart)}return r},r.prototype.ProcessDeleteKey=function(t,i){var r={},o,h,s,c;r.SelectionStart=t,r.SelectionEnd=i;var w=this._format.Fields,p=this.AdjustPosition(Math.min(t,i),0),a=p.start,v=w.GetFieldIndexToRight(a),e=v.index,p=this.AdjustPosition(Math.max(t,i),0),l=p.start,v=w.GetFieldIndexToRight(l),y=v.index,b=v.offset,u=Math.min(a,l),f=Math.abs(a-l);if(u==this.GetLength()&&f==0)return r;if(e==-1)return r;if(f==0){if(this._format.Fields.GetFieldByIndex(e)instanceof n.FixField)return r;u=this._format.Fields.Delete(u,f).curPos,r.SelectionStart=this.RestorePosition(u),r.SelectionEnd=r.SelectionStart}else{if(y<=0)return r;b==0&&y--;if(e==y&&this._format.Fields.GetFieldByIndex(e)instanceof n.FixField)return r;o=this._format.Fields.Delete(u,f);if(!o.valid)return r;r.SelectionStart=this.RestorePosition(o.curPos),r.SelectionEnd=r.SelectionStart,c=this._format.Fields.GetFieldIndexToRight(o.curPos),s=c.index,h=c.offset,h!=0&&this._format.Fields.GetFieldByIndex(s)instanceof n.FixField&&(r.SelectionStart=r.SelectionStart-h+this._format.Fields.GetFieldByIndex(s).GetLengthNow(),r.SelectionEnd=r.SelectionStart)}return r},r.prototype.PerformSpin=function(n,t,i,r,u){var e={},h=this.AdjustPosition(n,0),s=h.start,o,f;return o=this.State==1?this._format.Fields.PerformSpin(s,i,r,!0):this._format.Fields.PerformSpin(s,i,r,!1),this._displayFormat.Fields.SetValue(this._format.Fields.GetValue(),!1),this._displayFormat.Fields.IsPositive=this._format.Fields.IsPositive,o.isValid&&(this.State=0),e.SelectionStart=this.RestorePosition(o.curPos),e.Text=this.GetShowText2(this._owner._focused,!0),e.Color=this._owner._GetRealForeColor(this._owner._focused,!0),s==o.curPos&&(e.SelectionStart=n),o.isValid&&(e.SelectionEnd=e.SelectionStart),i>0||i==0&&u?this._owner._specialClientEvents.SpinUp&&(f={},f.Name=this._owner._specialClientEvents.SpinUp,f.Args=null,f.Type="SpinUp",e.EventInfo=f):(i<0||i==0&&!u)&&this._owner._specialClientEvents.SpinDown&&(f={},f.Name=this._owner._specialClientEvents.SpinDown,f.Args=null,f.Type="SpinDown",e.EventInfo=f),e},r.prototype.ProcessBackSpace=function(n,t,i){var r={};return this.State==0?i!=this._format.Fields.GetDisplayZero()?(r=this.ProcessBackSpaceKey(n,t),n==1&&t<=1&&i!=null&&i.length==1&&this._owner.AllowDeleteToNull&&(this.State=1),r.Text=this.GetShowText2(this._owner._focused,!0)):r=this.DisplayZeroText():(r.Text="",r.SelectionStart=0,r.SelectionEnd=0),r.Color=this._owner._GetRealForeColor(this._owner._focused,!0),r.SelectionStart!=null&&r.SelectionEnd!=null&&r.SelectionStart==r.SelectionEnd&&(this.isMulSelected=!1),r},r.prototype.ProcessDelete=function(n,t,i){var r={};return this.State==0?i!=this._format.Fields.GetDisplayZero()?(r=this.ProcessDeleteKey(n,t),n===0&&t===0&&i!=null&&i.length==1&&this._owner.AllowDeleteToNull&&(this.State=1),r.Text=this.GetShowText2(this._owner._focused,!0)):r=this.DisplayZeroText():(r.Text="",r.SelectionStart=0,r.SelectionEnd=0),r.Color=this._owner._GetRealForeColor(this._owner._focused,!0),this.State==1&&(r.SelectionStart=0,r.SelectionEnd=0),r.SelectionStart!=null&&r.SelectionEnd!=null&&r.SelectionStart==r.SelectionEnd&&(this.isMulSelected=!1),r},r.prototype.GetCaretPosition=function(t,i){var u=this._format.Fields,w=this.AdjustPosition(t,0),h=w.start,o={},y,p;this.IsCustomizeNullOrZeroValue()?(o.offset=0,o.index=-1):o=u.GetFieldIndexToRight(h);var r=o.index,s=o.offset,e,l,c,f=0,a=this._owner._IsUseWatermarkText(),v;a.IsUseWatermarkText?(v=a.WatermarkText.length,l=t,c=v):(y=u.GetValue(),l=u.GetPrefixField().GetDisplayText(y,this._format.Fields.IsPositive).length,c=this.GetLength()-u.GetPostFixField().GetDisplayText(y,this._format.Fields.IsPositive).length);switch(i){case n.Key.Home:case 65572:case 65574:return t>l?l:0;case n.Key.End:case 65571:case 65576:return t0?t-=s:t--:s==0&&u.GetFieldByIndex(r-1)instanceof n.FixField?t-=u.GetFieldRange(r-1).length:t--;break;case n.Key.Right:if(t==this.GetLength(!0))return t;if(u.GetFieldByIndex(r)instanceof n.FixField){e=u.GetFieldRange(r),l=e.start,c=l+e.length;if(h=0;f--)if(!(u.GetFieldByIndex(f)instanceof n.FixField))return e=u.GetFieldRange(f),e.start;return 0}else h-=s,t=this.RestorePosition(h)}break;case 196645:if(this._format.Fields.GetUnCheckedValue()==0&&this._format.Fields.Zero!=null&&this._format.Fields.Zero!="")t=0;else if(this._format.Fields.GetUnCheckedValue()==null&&this._format.Fields.Null!=null&&this._format.Fields.Null!="")t=0;else{o=u.GetFieldIndexToLeft(h),r=o.index,s=o.offset;if(t==0||r==0)return 0;s!=0&&(h-=s),t=this.RestorePosition(h)}break;case 131111:if(this._format.Fields.GetUnCheckedValue()==0&&this._format.Fields.Zero!=null&&this._format.Fields.Zero!="")t=this._format.Fields.Zero.length;else if(this._format.Fields.GetUnCheckedValue()==null&&this._format.Fields.Null!=null&&this._format.Fields.Null!="")t=this._format.Fields.Null.length;else{if(r==4)return this.GetLength();for(f=r+1;f=0;f--)if(!(u.GetFieldByIndex(f)instanceof n.FixField))return u.GetFieldByIndex(f)instanceof n.DPField&&u.GetFieldByIndex(f+1).GetLengthNow()!=0&&f--,e=u.GetFieldRange(f),this.RestorePosition(e.start);return this.RestorePosition(t)}else return this.RestorePosition(u.GetFieldRange(r).start);case 196643:case 131107:case 131112:return this.GetLength();case 196644:case 131108:case 131110:return 0;case 65573:return t==0?0:--t;case 65575:return p=a.IsUseWatermarkText?v:this.GetLength(),t==p?t:++t}return t},r.prototype.IsCustomizeNullOrZeroValue=function(){return this.GetValue()===0&&this._format.Fields.Zero!==""?!0:this.State===1&&this._format.Fields.Null!==""?!0:!1},r.prototype.ProcessLeftDirection=function(t,i,r){var u={};return this.isMulSelected&&r!=n.Key.Home&&r!=131108?(u.SelectionStart=Math.min(t,i),u.SelectionEnd=u.SelectionStart,this.isMulSelected=!1,u):(u.SelectionStart=this.GetCaretPosition(i,r),u.SelectionEnd=u.SelectionStart,u)},r.prototype.ProcessRightDirection=function(t,i,r){var u={};return this.isMulSelected&&r!=n.Key.End&&r!=131107?(u.SelectionStart=Math.max(t,i),u.SelectionEnd=u.SelectionStart,this.isMulSelected=!1,u):(u.SelectionStart=this.GetCaretPosition(i,r),u.SelectionEnd=u.SelectionStart,u)},r.prototype.GetCurrentField=function(n){return this._format.Fields.GetFieldIndexToLeft(n)},r.prototype.GetPosByCurrentField=function(n){var i={},t=this._format.Fields.GetPosByCurrentField(n);return t!=null&&t!=-1?(i.SelectionStart=t.start,i.SelectionEnd=t.start+t.length,i):i},r.prototype.AdjustPosition=function(n,t){var e={},r,u,o,s,h,f,i;e.start=n,e.length=t,r=this.ShowText(!1);if(r.length==0||this._format.Fields.Separator=="")return e;u=0,o=0,this._format.Fields.GetPrefixField().GetLengthNow()>0&&(u=this._format.Fields.GetPrefixField().GetLengthNow()),this._format.Fields.GetPostFixField().GetLengthNow()>0&&(o=this._format.Fields.GetPostFixField().GetLengthNow()),s=n>u?n>r.length-o?r.substring(u,r.length-o):r.substring(u,n):"",h=n+t>u?n+t>r.length-o?r.substring(n,r.length-o):r.substring(n,n+t):"",f=0,i=s;while(i.indexOf(this._format.Fields.Separator)!=-1)i=i.substring(i.indexOf(this._format.Fields.Separator)+1,i.length),f++;n=n-f;if(t!=0){f=0,i=h;while(i.indexOf(this._format.Fields.Separator)!=-1)i=i.substring(i.indexOf(this._format.Fields.Separator)+1,i.length),f++;t=t-f}return e.start=n,e.length=t,e},r.prototype.AdjustPositionIgnoreSeparator=function(n,t,i){var f={},u,e,r;return f.Start=n,f.Length=t,u=this.ShowText(!1),u.length==0?f:(e=0,r=0,this._format.Fields.GetPrefixField().GetLengthNow()>0&&(e=this._format.Fields.GetPrefixField().GetLengthNow()),this._format.Fields.GetPostFixField().GetLengthNow()>0&&(r=this._format.Fields.GetPostFixField().GetLengthNow()),nu.length-r&&(t=t-(n+t-(u.length-r))),(n>u.length-r||t<0)&&(n=u.length-r,t=0),f.Start=n,f.Length=t,f)},r.prototype.RestorePosition=function(n){var i=this.ShowText(!1),t,s,u,r;if(i.length==0||this._format.Fields.Separator=="")return n;var o=0,f=0,e=0;this._format.Fields.GetPrefixField().GetLengthNow()>0&&(f=this._format.Fields.GetPrefixField().GetLengthNow()),this._format.Fields.GetPostFixField().GetLengthNow()>0&&(e=this._format.Fields.GetPostFixField().GetLengthNow()),t=i.substring(f,i.length-e),s=t.length;if(t.indexOf(this._format.Fields.Separator)==-1||nt.length||(t=t.substring(0,i)),parseFloat(t)},r.GetNearestValue=function(n,t,u){var e=0,f,o;t>0&&(e=r.Truncate(n),n=parseFloat(i.ACCSub(n,e))),f=t;while(f!=0)f>0?(n*=10,f--):f<0&&(n/=10,f++);o=r.Truncate(Math.round(n)),Math.abs(n-o)>Math.pow(10,-t)&&(n=u?Math.ceil(n):Math.floor(n));while(t!=0)t>0?(n/=10,t--):t<0&&(n*=10,t++);return e!=0&&(n+=e),n},r}(n.BaseUIProcess),r,i;n.NumberUIProcess=t,r=function(){function n(n,t){this._minValue=+n,this._maxValue=+t,this._decimalDigits=-1}return n.prototype.CompareValue=function(n){return n>this._maxValue||nthis.GetDecimalDigits()?!1:this.CompareValue(i)}},n}(),n.DecimalRange=r,i=function(){function i(n,t){this._minValue=n,this._maxValue=t;if(n>t)return;this._potentialValidRangeList=[],this._lastMathcedPotentailValidRangeIndex=-1,this._isNegativeRangeOnly="NegativeAndPositiveRange",this.ResetPotentialValidRangeList(),this.DumpRangeList()}return i.prototype.DumpRangeList=function(){for(var i="",n=0;n1?e[1].length:0}catch(s){u=0}try{e=i.toString().split("."),r=e.length>1?e[1].length:0}catch(s){r=0}return u=Math.min(u,15),r=Math.min(r,15),o=Math.max(u,r),t=t*Math.pow(10,u),i=i*Math.pow(10,r),t=Math.round(t),i=Math.round(i),t.toString().length>15&&t.toString().indexOf("e")==-1&&(f=t.toString(),t=parseFloat(f.substring(0,15)+n.Utility.ToString("",f.length-15,"0"))),i.toString().length>15&&i.toString().indexOf("e")==-1&&(f=i.toString(),i=parseFloat(f.substring(0,15)+n.Utility.ToString("",f.length-15,"0"))),u=o-u,r=o-r,((t*Math.pow(10,u)-i*Math.pow(10,r))/Math.pow(10,o)).toFixed(o)},i.prototype.ResetPotentialValidRangeList=function(){var u,n,v,l,o,f,h,s,c;this._lastMathcedPotentailValidRangeIndex=0,this._isNegativeRangeOnly="NegativeAndPositiveRange",u=this._minValue,n=this._maxValue,this._isNegativeRangeOnly=u>0?"PositiveRangeOnly":n<0?"NegativeRangeOnly":"NegativeAndPositiveRange",v=Math.abs(u),l=Math.abs(n);if(n>0&&u<0){this._potentialValidRangeList.push(new r(u,n));return}else u=Math.min(v,l),n=Math.max(v,l);o=i.ACCSub(u,t.Truncate(u)),f=i.ACCSub(n,t.Truncate(n)),this._potentialValidRangeList.push(new r(u,n));if(parseFloat(o)>0||parseFloat(f)>0){var a=[],y=[],e=1;while((parseFloat(o)>0||parseFloat(f)>0)&&e<=15)h=t.RoundValue(parseFloat(o),e,"Floor"),s=t.RoundValue(parseFloat(f),e,"Floor"),h=parseFloat(h.toFixed(e)),s=parseFloat(s.toFixed(e)),a.push(h),y.push(s),o=i.ACCSub(parseFloat(o),h),f=i.ACCSub(parseFloat(f),s),e++;for(c=a.length-1;c>=0;c--)u=parseFloat(i.ACCSub(u,a[c])),n=parseFloat(i.ACCSub(n,y[c])),this._potentialValidRangeList.push(new r(u,n))}u=t.Truncate(parseFloat((+u).toFixed(0))),n=t.Truncate(parseFloat((+n).toFixed(0)));while(u>0&&n>0)u=t.Truncate(u/10),n=t.Truncate(n/10),this._potentialValidRangeList.push(new r(u,n));this._lastMathcedPotentailValidRangeIndex=this._potentialValidRangeList.length-1},i.prototype.IsInMaxMinRange=function(n){if(n!=null)if(n>this._maxValue||nthis._maxValue)return t.RangeInValid=!0,t;n=parseFloat(n.toString());if(n==0||n==null)return t.lessThanRange=!1,t.greaterThanRange=!1,t;switch(this._isNegativeRangeOnly){case"PositiveRangeOnly":if(n<0)return t.lessThanRange=!0,t.greaterThanRange=!1,t;break;case"NegativeRangeOnly":if(n>0)return t.lessThanRange=!1,t.greaterThanRange=!0,t;break;case"NegativeAndPositiveRange":break}u=n,(this._maxValue<0||this._minValue>0)&&(n=Math.abs(n)),i=this._lastMathcedPotentailValidRangeIndex;while(i>=0){r=this._potentialValidRangeList[i];if(r.IsInRange(n))return this._lastMathcedPotentailValidRangeIndex=i,t.lessThanRange=!1,t.greaterThanRange=!1,t;i--}i=this._potentialValidRangeList.length-1;while(i>this._lastMathcedPotentailValidRangeIndex){r=this._potentialValidRangeList[i];if(r.IsInRange(n))return this._lastMathcedPotentailValidRangeIndex=i,t.lessThanRange=!1,t.greaterThanRange=!1,t;i--}return t.lessThanRange=uthis._maxValue,t},i}(),n.NumberRangeValidation=i})(GCIM||(GCIM={})) if(typeof(Sys)!='undefined' && typeof(Sys.Application) != 'undefined'){Sys.Application.notifyScriptLoaded();};