UNPKG

@mescius/wijmo.input

Version:

UI library for pure JS, Angular, React, Vue and more...

14 lines (13 loc) 276 kB
/*! * * Wijmo Library 5.20252.44 * https://developer.mescius.com/wijmo * * Copyright(c) MESCIUS inc. All rights reserved. * * Licensed under the End-User License Agreement For MESCIUS Wijmo Software. * us.sales@mescius.com * https://developer.mescius.com/wijmo/licensing * */ var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)};import{_getModule,_addCultureInfo,culture,setAriaLabel,disableAutoComplete,isIE,isIE9,asBoolean,asString,asEnum,setSelectionRange,contains,getActiveElement,setAttribute,showPopup,hidePopup,hasClass,addClass,removeClass,toggleClass,removeChild,Control,Key,Event,EventArgs,CancelEventArgs,ControlStateClsNames,GlyphClsNames,ControlClsNames,InputFormElementsClsNames,isNullOrUndefined,tryCast,createElement,hasItems,isObject,isString,asArray,asFunction,asNumber,asType,asCollectionView,closest,escapeHtml,toPlainText,setCss,Binding,Rect,DateTime,assert,isFirefox,_CLS_STATE_DISABLED,UtilitesClsNames,_setAriaLabelBy,setInnerHTMLSafe,getUniqueId,isNumber,enable,isFunction,escapeRegExp,isSafari,setText,isDate,isBoolean,asDate,asInt,Globalize,_ClickRepeater,CollectionView,format,uidGenerator,moveFocus,_isMacOS,clamp,Color,roundTo,_getFocusableElements,_MaskProvider,getSpecialCharsRegex,isEmpty,isEdge,isMobile,setChecked,Point,isArray,getElementRect,getSafeUniqueId,PopupPosition,getElement,isUndefined,isiOS,_registerModule}from"@mescius/wijmo";import*as selfModule from"@mescius/wijmo.input";export var AutoCompleteClsNames={hostElement:"wj-autocomplete"};export var CalendarClsNames={buttonsOutside:"wj-btns-outside",calendarHeader:"wj-calendar-header",calendarMonth:"wj-calendar-month",calendarMultiMonth:"wj-calendar-multimonth",calendarOuter:"wj-calendar-outer",calendarYear:"wj-calendar-year",dayOtherMonth:"wj-day-othermonth",dayToday:"wj-day-today",dayWeekend:"wj-day-weekend",header:"wj-header",hostElement:"wj-calendar",monthSelect:"wj-month-select",weekAfter:"wj-week-after",weekBefore:"wj-week-before",yearPicker:"wj-yearpicker",focused:"wj-state-focus",selectedYear:"wj-select-year",confirmationButtonContainer:"wj-calendar-confirmation-button-container",button:"wj-calendar-button"};export var CollectionViewNavigatorClsNames={hostElement:"wj-collectionview-navigator",pager:"wj-pager"};export var ColorPickerClsNames={colorBox:"wj-colorbox",hostElement:"wj-colorpicker"};export var ComboBoxClsNames={hostElement:"wj-combobox",stateMatch:"wj-state-match"};export var DropDownClsNames={dropDownPanel:"wj-dropdown-panel",hostElement:"wj-dropdown"};export var InputClsNames={input:"wj-input",inputBtnVisible:"wj-input-btn-visible",inputGroup:"wj-input-group",inputGroupBtn:"wj-input-group-btn"};export var InputColorClsNames={hostElement:"wj-inputcolor",inputColorBox:"wj-inputcolorbox"};export var InputDateClsNames={hostElement:"wj-inputdate",inputDateDropDown:"wj-inputdate-dropdown",inputDateDropDownContainer:"wj-inputdate-dropdown-container"};export var InputDateRangeClsNames={hostElement:"wj-inputdaterange"};export var InputDateTimeClsNames={hostElement:"wj-inputdatetime",showDropDownButton:"wj-show-dropdown-button"};export var InputMaskClsNames={hostElement:"wj-inputmask"};export var InputNumberClsNames={hostElement:"wj-inputnumber",numeric:"wj-numeric",showSpinner:"wj-input-show-spinner"};export var InputTimeClsNames={hostElement:"wj-inputtime"};export var ListBoxClsNames={header:"wj-header",hostElement:"wj-listbox",listBoxItem:"wj-listbox-item"};export var MenuClsNames={hostElement:"wj-menu",menuItems:"wj-menu-items",subItems:"wj-subitems"};export var MultiAutoCompleteClsNames={hostElement:"wj-multi-autocomplete",token:"wj-token",tokenActive:"wj-token-active",tokenClose:"wj-token-close",tokenHelper:"wj-token-helper",tokenLabel:"wj-token-label",screenReaderOnly:"wj-sr-only"};export var MultiSelectClsNames={hostElement:"wj-multiselect"};export var MultiSelectListBoxClsNames={header:"wj-header",hostElement:"wj-multiselectlistbox",selectAll:"wj-select-all"};export var PopupClsNames={dialogHeader:"wj-dialog-header",hostElement:"wj-popup",popupBackDrop:"wj-popup-backdrop",dialogBody:"wj-dialog-body",dialogFooter:"wj-dialog-footer"};_addCultureInfo("InputNumber",{ariaLabels:{incVal:"Increase Value",decVal:"Decrease Value",inputNumberInput:"InputNumber Input",inputNumber:"Input Number"}});var InputNumber=function(e){__extends(InputNumber,e);function InputNumber(t,i){var n=e.call(this,t)||this;n._value=null;n._min=null;n._max=null;n._format="";n._step=null;n._showBtn=!0;n._readOnly=!1;n._handleWheel=!0;n._oldText="";n._fromKb=!0;n._inputElementAriaLabel=culture.InputNumber.ariaLabels.inputNumberInput;n._ariaLabelledby=null;n.textChanged=new Event;n.valueChanged=new Event;var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+InputNumberClsNames.hostElement,o,{_tbx:"input",_btnUp:"btn-inc",_btnDn:"btn-dec"},"input");var s=n.inputElement;n.hostElement;setAttribute(s,"role","spinbutton",!0);n._updateInputAriaLabel();var r=culture.InputNumber.ariaLabels;setAriaLabel(n._btnUp.querySelector("button"),r.incVal);setAriaLabel(n._btnDn.querySelector("button"),r.decVal);n._tbx.type.match(/number/i)&&(n.inputType="");var a=n._tbx;a.autocomplete="off";a.spellcheck=!1;n._updateSymbols();var l=n.addEventListener.bind(n);l(a,"keypress",n._keypress.bind(n));l(a,"keydown",n._keydown.bind(n));l(a,"input",n._input.bind(n));isMobile()&&l(a,"beforeinput",n._beforeinput.bind(n));l(a,"blur",(function(){n.text!=n._oldText&&n._setText(n.text)}));l(a,"paste",(function(){n._fromKb=!1}));l(a,"compositionstart",(function(){n._composing=!0}));l(a,"compositionend",(function(){n._composing=!1;setTimeout((function(){var e=n.text,t=n._oldText,i=n._chrPct;t&&t.indexOf(i)>-1&&e.indexOf(i)<0&&(e+=i);n._setText(e)}))}));var h=n._clickSpinner.bind(n);l(n._btnUp,"click",h);l(n._btnDn,"click",h);n._rptUp=new _ClickRepeater(n._btnUp.querySelector("button"));n._rptDn=new _ClickRepeater(n._btnDn.querySelector("button"));l(a,"wheel",(function(e){if(n.handleWheel&&!e.defaultPrevented&&!e.ctrlKey&&n._isEditable()&&n.containsFocus()){var t=clamp(-e.deltaY,-1,1);n._increment((n.step||1)*t);setTimeout((function(){return n.selectAll()}));e.preventDefault()}}));n.value=0;n.isRequired=!0;n.initialize(i);return n}Object.defineProperty(InputNumber,"controlTemplate",{get:function(){InputNumber._ctrlTemplate||(InputNumber._ctrlTemplate='<div class="'+ControlClsNames.template+'"><div class="'+InputClsNames.input+'"><div class="'+InputClsNames.inputGroup+'"><span wj-part="btn-dec" class="'+InputClsNames.inputGroupBtn+'" tabindex="-1"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1">-</button></span><input type="tel" wj-part="input" class="'+InputFormElementsClsNames.formControl+" "+InputNumberClsNames.numeric+'"/><span wj-part="btn-inc" class="'+InputClsNames.inputGroupBtn+'" tabindex="-1"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'" tabindex="-1">+</button></span></div></div></div>');return InputNumber._ctrlTemplate},set:function(e){InputNumber._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"value",{get:function(){return this._value},set:function(e){if(e!=this._value)if(null==(e=asNumber(e,!this.isRequired||null==e&&null==this._value)))this._setText("");else if(!isNaN(e)){var t=Globalize.format(e,this.format);this._setText(t)}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);this.inputElement.readOnly=this._readOnly;toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){this._handleWheel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"min",{get:function(){return this._min},set:function(e){if(e!=this._min){this._min=asNumber(e,!0);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"max",{get:function(){return this._max},set:function(e){if(e!=this._max){this._max=asNumber(e,!0);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"step",{get:function(){return this._step},set:function(e){this._step=asNumber(e,!0);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"format",{get:function(){return this._format},set:function(e){if(e!=this.format){this._format=asString(e);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"text",{get:function(){return this._tbx.value},set:function(e){if(e!=this.text){this._oldText=this.text;this._setText(e)}},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"showSpinner",{get:function(){return this._showBtn},set:function(e){this._showBtn=asBoolean(e);this._updateBtn()},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"repeatButtons",{get:function(){return!this._rptUp.disabled},set:function(e){this._rptUp.disabled=this._rptDn.disabled=!asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputNumber.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAriaLabel.bind(this))},enumerable:!0,configurable:!0});InputNumber.prototype.selectAll=function(){var e=this._tbx;setSelectionRange(e,0,e.value.length)};InputNumber.prototype.clamp=function(e){return clamp(e,this.min,this.max)};InputNumber.prototype.onTextChanged=function(e){this.textChanged.raise(this,e);this._updateState()};InputNumber.prototype.onValueChanged=function(e){this._updateAria();this.valueChanged.raise(this,e)};InputNumber.prototype.dispose=function(){this._rptUp.element=null;this._rptDn.element=null;e.prototype.dispose.call(this)};InputNumber.prototype.onGotFocus=function(t){this._oldValue=this.value;if(!this.isTouching){this._tbx.focus();this.selectAll()}e.prototype.onGotFocus.call(this,t)};InputNumber.prototype.onLostFocus=function(t){if(this._composing){this._composing=!1;this._setText(this.text)}if(this._isEditable()){var i=this.clamp(this.value);if(i==this.value||this.onInvalidInput(new CancelEventArgs)){var n=Globalize.format(i,this.format);this._setText(n)}}e.prototype.onLostFocus.call(this,t)};InputNumber.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this.hostElement){this._updateSymbols();var i=Globalize.format(this.value,this.format);this._setText(i)}};InputNumber.prototype._isEditable=function(){return!this.isReadOnly&&!this.isDisabled};InputNumber.prototype._updateSymbols=function(){var e=culture.Globalize.numberFormat,t=Globalize._parseNumericFormat(this.format);this._chrDec=e["."]||".";this._chrTho=e[","]||",";this._chrNeg=e["-"]||"-";this._chrPls=e["+"]||"+";this._chrPct=e["%"]||"%";this._chrCur=t.curr||e.currency.symbol||"$";this._fmtSpc=t.spec;this._fmtPrc=t.prec;this._rxSym=new RegExp("^[%+\\-() \\"+this._chrDec+"\\"+this._chrCur+"\\"+this._chrNeg+"\\"+this._chrPls+"\\"+this._chrPct+"]*$");this._rxNeg=new RegExp("^\\s*(\\-|\\"+this._chrNeg+")|([^e](\\-|\\"+this._chrNeg+")|\\()")};InputNumber.prototype._isNumeric=function(e,t){var i=e==this._chrDec||e>="0"&&e<="9",n="x"==this._fmtSpc;!i&&n&&(i=e>="a"&&e<="f"||e>="A"&&e<="F");i||t||n||(i=e==this._chrPls||e==this._chrNeg||"("==e||")"==e);return i};InputNumber.prototype._getInputRange=function(e){for(var t=[0,0],i=this.text,n=!1,o=0;o<i.length;o++)if(this._isNumeric(i[o],e)){if(!n){t[0]=o;n=!0}t[1]=o+1}return t};InputNumber.prototype._flipSign=function(){var e=this._getSelStartDigits();this.value*=-1;this._setSelStartDigits(e)};InputNumber.prototype._getSelStartDigits=function(){for(var e=0,t=this._tbx.selectionStart,i=this._tbx.value,n=0;n<i.length&&n<t;n++)this._isNumeric(i[n],!0)&&e++;return e};InputNumber.prototype._setSelStartDigits=function(e){for(var t=this._tbx.value,i=0;i<t.length&&e>=0;i++)if(this._isNumeric(t[i],!0)){if(!e){setSelectionRange(this._tbx,i);break}e--}else if(!e){setSelectionRange(this._tbx,i);break}};InputNumber.prototype._increment=function(e){if(e){var t=this.clamp(isNumber(this.value)?this.value+e:0),i=Globalize.format(t,this.format,!1,!1);this._setText(i)}};InputNumber.prototype._updateBtn=function(){var e=this.showSpinner&&!!this.step,t=e;setCss([this._btnUp,this._btnDn],{display:e?"":"none"});toggleClass(this.hostElement,InputNumberClsNames.showSpinner,e);enable(this._btnUp,t);enable(this._btnDn,t);this._updateAria()};InputNumber.prototype._setText=function(e,t,i){void 0===t&&(t=!1);void 0===i&&(i=!1);if(!this._composing){var n=this._tbx,o=this._chrDec,s=this._rxNeg.test(e),r=this._delKey,a=this.containsFocus();e&&this._rxSym.test(e)&&a&&(e=this.isRequired||!r?(s?"-0":"0")+(e.indexOf(o)>-1?o:""):"");this._delKey=!1;r&&0==this.value&&!this.isRequired&&(e="");if(!e){if(!this.isRequired||i){n.value="";if(this._oldText){this._oldText=e;this.onTextChanged()}if(null!=this._value){this._value=null;this.onValueChanged()}this._updateBtn();return}e="0"}var l=e.indexOf(o),h=this._format||(l>-1?"n2":"n0"),u=Globalize.parseFloat(e,h);isFinite(u)||(u=this.clamp(u));if(isNaN(u))if(this.onInvalidInput(new CancelEventArgs))n.value=this._oldText;else{n.value=e;this.focus()}else{var c=a&&l>-1?2:null,p=Globalize.format(u,h,!1,t,c);s&&u>=0&&!r&&(p=this._chrNeg+p);a&&l>-1&&"g"==this._fmtSpc&&0!=this._fmtPrc&&(p=e).indexOf(o)<0&&(p+=o);if(n.value!=p){n.value=p;u=Globalize.parseFloat(p,h)}if(this.text!=this._oldText){this._oldText=this.text;this.onTextChanged()}if(u!=this._value){this._value=u;this.onValueChanged()}this._updateBtn();this._updateState()}}};InputNumber.prototype._handleDecimalInput=function(e){if(0===this._fmtPrc){e.preventDefault();return!0}var t=this._tbx,i=t.value.indexOf(this._chrDec);if(i>-1){e.preventDefault();var n=t.selectionStart<=i?i+1:i;setSelectionRange(t,n);return!0}return!1};InputNumber.prototype._beforeinput=function(e){if(!e.defaultPrevented&&!this._composing&&this._isEditable()){switch(e.data){case".":case this._chrDec:this._handleDecimalInput(e);return;case"+":case this._chrPls:this._handlePlusSign();e.preventDefault();return;case"-":case this._chrNeg:this._handleMinusSign();e.preventDefault();return}}};InputNumber.prototype._keypress=function(e){if(!e.defaultPrevented&&!this._composing&&this._isEditable()&&e.charCode&&!e.ctrlKey&&!e.metaKey&&e.keyCode!=Key.Enter){var t=this._tbx,i=String.fromCharCode(e.charCode);if(this._isNumeric(i,!1)){var n=t.maxLength;if(n>-1&&t.value.length>=n&&t.selectionEnd==t.selectionStart){e.preventDefault();return}var o=this._getInputRange(!0),s=t.selectionStart,r=t.selectionEnd;if(s<o[0]&&r<t.value.length){r=Math.max(r,o[0]);setSelectionRange(t,o[0],r)}if(s>=o[1]){var a=null!=this._fmtPrc?this._fmtPrc:2,l=t.value.indexOf(this._chrDec);l>-1&&s-l>a&&e.preventDefault()}}else e.preventDefault();switch(i){case"-":case this._chrNeg:this._handleMinusSign();e.preventDefault();break;case"+":case this._chrPls:this._handlePlusSign();e.preventDefault();break;case".":case this._chrDec:this._handleDecimalInput(e)}if(!e.defaultPrevented&&isIE()){var h=t.value;if((s=t.selectionStart)==(r=t.selectionEnd)){t.value=h.substr(0,s)+i+h.substr(r);setSelectionRange(t,s+1);e.preventDefault();this._input()}}}};InputNumber.prototype._handlePlusSign=function(){var e=this._tbx;(this.value<0||this._rxNeg.test(e.value))&&this._flipSign()};InputNumber.prototype._handleMinusSign=function(){var e=this._tbx;if(this.clamp(-1)>=0)this.value<0&&this._flipSign();else if(this.value&&e.selectionStart===e.selectionEnd)this._flipSign();else if(this.clamp(-1)<0){e.value=this._chrNeg;setSelectionRange(e,1)}};InputNumber.prototype._keydown=function(e){var t=this;this._delKey=!1;if(!e.defaultPrevented&&!this._composing){var i=hasClass(this._tbx,"wj-grid-ime");if(!i||e.keyCode==Key.Back||e.keyCode==Key.Delete){var n=this._tbx,o=n.value,s=n.selectionStart,r=n.selectionEnd;switch(e.keyCode){case 65:if(e.ctrlKey){setTimeout((function(){t.selectAll()}));e.preventDefault()}break;case Key.Up:case Key.Down:if(this.step&&this._isEditable()){this._increment(this.step*(e.keyCode==Key.Up?1:-1));setTimeout((function(){t.selectAll()}));e.preventDefault()}break;case Key.Back:this._delKey=!0;if(r-s<2&&this._isEditable()){var a=o[r-1];if(a==this._chrDec||a==this._chrPct||a==this._chrTho||")"==a){setTimeout((function(){r=a==t._chrPct?t._getInputRange(!0)[1]:r-1;setSelectionRange(n,r)}));e.preventDefault()}}break;case Key.Delete:this._delKey=!0;if(r-s<2&&this._isEditable())if("0"==o&&1==s)setSelectionRange(n,0);else{var l=o[s];if(l==this._chrDec||l==this._chrPct){setTimeout((function(){setSelectionRange(n,s+1)}));e.preventDefault()}}break;case Key.Escape:this.value=this._oldValue;this.selectAll()}i&&this._delKey&&this._isEditable()&&this._setText(null,!1,!0)}}};InputNumber.prototype._input=function(){var e=this;this._composing?this._fromKb=!0:setTimeout((function(){var t=e._tbx,i=t.value,n=i.indexOf(e._chrDec),o=t.selectionStart,s=e._getSelStartDigits();"p"==e._fmtSpc&&i.length&&i.indexOf(e._chrPct)<0&&(i+=e._chrPct);e._setText(i,e._fromKb);e._fromKb=!0;if(e.containsFocus()){var r=t.value,a=r.indexOf(e._chrDec),l=e._getInputRange(!0);if(i==e._chrNeg+e._chrDec&&a>-1){setSelectionRange(t,a+1);return}if(i[0]==e._chrNeg&&r[0]!=e._chrNeg){if(1==r.length)setSelectionRange(t,1);else{"c"===e._fmtSpc&&e._isNegativeCurrencyByParenthesis(i)&&(s-=1);e._setSelStartDigits(s)}return}i?i==e._chrDec&&a>-1?o=a+1:o<=n&&a>-1||n<0&&a<0?o+=r.length-i.length:n<0&&a>-1&&(o=a):o=a>-1?a:l[1];o=clamp(o,l[0],l[1]);setSelectionRange(t,o)}}))};InputNumber.prototype._isNegativeCurrencyByParenthesis=function(e){return e.length>1&&e[1]===this._chrCur};InputNumber.prototype._clickSpinner=function(e){var t=this;if(!e.defaultPrevented&&this._isEditable()&&this.step){this._increment(this.step*(contains(this._btnUp,e.target)?1:-1));if(!this.isTouching){Control.sharedState.InvalidScroll=isEdge();setTimeout((function(){return t.selectAll()}))}}};InputNumber.prototype._updateAria=function(){var e=this.inputElement;if(this.hostElement){setAttribute(e,"aria-valuemin",this.min);setAttribute(e,"aria-valuemax",this.max);setAttribute(e,"aria-valuenow",this.value);setAttribute(e,"aria-valuetext",this.text);setAttribute(e,"step",this.step);enable(this._btnDn,null==this.min||this.value>this.min);enable(this._btnUp,null==this.max||this.value<this.max)}};InputNumber.prototype._updateInputAriaLabel=function(){var e=this.inputElement;this._ariaLabelledby?setAttribute(e,"aria-label",null):setAttribute(e,"aria-label",this._inputElementAriaLabel)};InputNumber.prototype.getAriaLabelForScreenReader=function(){return culture.InputNumber.ariaLabels.inputNumber};InputNumber._ctrlTemplate="";return InputNumber}(Control);export{InputNumber};_addCultureInfo("InputMask",{ariaLabels:{inputMaskInput:"InputMask Input",inputMask:"Input Mask"}});var InputMask=function(e){__extends(InputMask,e);function InputMask(t,i){var n=e.call(this,t)||this;n._fullEdit=!1;n._inputElementAriaLabel=culture.InputMask.ariaLabels.inputMaskInput;n._ariaLabelledby=null;n.valueChanged=new Event;var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+InputMaskClsNames.hostElement,o,{_tbx:"input"},"input");if("INPUT"==n._orgTag){var s=n._tbx.getAttribute("value");s&&(n.value=s)}n._msk=new _MaskProvider(n._tbx);n.isRequired=!0;n.initialize(i);n.addEventListener(n._tbx,"input",(function(){n.onValueChanged()}));n.addEventListener(n._tbx,"blur",n._commitText.bind(n));n.addEventListener(n._tbx,"keydown",(function(e){e.keyCode==Key.Enter&&n._commitText()}));n._updateInputAriaLabel();return n}Object.defineProperty(InputMask,"controlTemplate",{get:function(){InputMask._ctrlTemplate||(InputMask._ctrlTemplate='<div class="'+InputClsNames.input+'"><div class="'+InputClsNames.inputGroup+'"><input wj-part="input" class="'+InputFormElementsClsNames.formControl+'"/></div></div>');return InputMask._ctrlTemplate},set:function(e){InputMask._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"inputElement",{get:function(){return this._tbx},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"inputType",{get:function(){return this._tbx.type},set:function(e){this._tbx.type=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"value",{get:function(){return this._tbx.value},set:function(e){if(e!=this.value){this._tbx.value=asString(e);e=this._msk._applyMask();this._tbx.value=e;this.onValueChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"rawValue",{get:function(){return this._msk.getRawValue()},set:function(e){e!=this.rawValue&&(this.value=asString(e))},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"mask",{get:function(){return this._msk.mask||""},set:function(e){var t=this.value;this._msk.mask=asString(e);this.value!=t&&this.onValueChanged()},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"promptChar",{get:function(){return this._msk.promptChar},set:function(e){var t=this.value;this._msk.promptChar=e;this.value!=t&&this.onValueChanged()},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"overwriteMode",{get:function(){return this._msk.overwriteMode},set:function(e){this._msk.overwriteMode=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"placeholder",{get:function(){return this._tbx.placeholder},set:function(e){this._tbx.placeholder=e},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"maskFull",{get:function(){return this._msk.maskFull},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"isRequired",{get:function(){return this._tbx.required},set:function(e){this._tbx.required=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(InputMask.prototype,"isReadOnly",{get:function(){return this._tbx.readOnly},set:function(e){this._tbx.readOnly=asBoolean(e);toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});InputMask.prototype.selectAll=function(){var e=this._msk.getMaskRange();setSelectionRange(this._tbx,e[0],e[1]+1)};InputMask.prototype.onValueChanged=function(e){if(this.value!=this._oldValue){this._oldValue=this.value;this.valueChanged.raise(this,e)}this._updateState()};InputMask.prototype._commitText=function(){(this.rawValue||this.isRequired)&&(this.maskFull||this.onInvalidInput(new CancelEventArgs));this._updateState()};InputMask.prototype.dispose=function(){this._msk.input=null;e.prototype.dispose.call(this)};InputMask.prototype.refresh=function(t){void 0===t&&(t=!0);e.prototype.refresh.call(this,t);this.hostElement&&this._msk.refresh()};InputMask.prototype.onGotFocus=function(t){this.selectAll();e.prototype.onGotFocus.call(this,t)};Object.defineProperty(InputMask.prototype,"ariaLabelledBy",{get:function(){return this._ariaLabelledby},set:function(e){_setAriaLabelBy(this,this._tbx,e,this._updateInputAriaLabel.bind(this))},enumerable:!0,configurable:!0});InputMask.prototype._updateInputAriaLabel=function(){var e=this.inputElement;!e||e.id||this._ariaLabelledby?setAttribute(e,"aria-label",null):setAttribute(e,"aria-label",this._inputElementAriaLabel)};InputMask.prototype.getAriaLabelForScreenReader=function(){return culture.InputMask.ariaLabels.inputMask};InputMask._ctrlTemplate="";return InputMask}(Control);export{InputMask};_addCultureInfo("ColorPicker",{ariaLabels:{colorPicker:"Color Picker",satAndBrightnessPanel:"Color saturation and brightness panel",huePanel:"Color hue panel",opacityPanel:"Color opacity panel",palettePanel:"Color palette panel",saturation:"Saturation:",hue:"Hue:",opacity:"Opacity:",degrees:"degrees",brightness:"Brightness:",baseColor:"Base color:",shadeColor:"Shade color:"}});export var ColorPickerTabKeyAction;!function(e){e[e.None=0]="None";e[e.All=1]="All"}(ColorPickerTabKeyAction||(ColorPickerTabKeyAction={}));var ColorPicker=function(e){__extends(ColorPicker,e);function ColorPicker(t,i){var n=e.call(this,t)||this;n._hsb=[.5,1,1];n._alpha=1;n._ariaLabel=culture.ColorPicker.ariaLabels.colorPicker;n.valueChanged=new Event;n.hostElement.setAttribute("role","application");n.hostElement.setAttribute("aria-label",culture.ColorPicker.ariaLabels.colorPicker);var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+ColorPickerClsNames.hostElement,o,{_eSB:"div-sb",_eHue:"div-hue",_eAlpha:"div-alpha",_ePreview:"div-pv",_ePal:"div-pal",_eText:"div-text"});n._palette="#FFF,#000,#F00,#FFC000,#FFFF00,#92D050,#00B050,#00B0F0,#0070C0,#7030A0".split(",");n._updatePalette();n._eHue.style.backgroundImage="url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAD4CAIAAACi6hsPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuM4zml1AAAAGvSURBVDhPXdBPaM9xHMfxz4pWaxcmtoOhpdXSVpiyHWxqmVpDjaU5rK34XfypjTJ/p+ZPay6jhsOsRrKwaJElf9IQq03WIkv4FeMwMq221tfje1ByeFzfvd7PEKWGEKWTQRZLySWfVRRTQjmVbKWGOhLsZT+HaeY0bbTTQSfdXOcWffTzmAFeMcwoYyT5ygS/mA5hNgphip98J8kHRnnNSwZ4yH1uc4OrdHGR87RximYO0cgedlLLdqqoYAPrWMtKVrCcJSxiPmnMJUQp/Bsyk2xyyKOAQooopYwKtlDNDur5G7SBJo7RQiv/B+2hl3s84CkvGGKEOOYnxolj/mYmhBmDJ5ngCx95xxsGecYj4pB3iENeoZMO2mmlhaMcpIE4ZII6aqhmM3HMMkooopB88sghm0wySCeVlCjMCVFIYx4LWUwOeRSwhmLWU84mqqihll3sppEmjnOSs5zjEl1c4yZ99POE5wwxwns+840fTDFLFKaZZIJxkozxlmEGGSC+GF++Sy89dHOZC8Rr4lVnOMERDrCPBPXEX22jko2UEn+/mnxyWUYWC0gnNUQh/AEc0HJs6cex0gAAAABJRU5ErkJggg==)";n._eHue.style.backgroundSize="contain";if(navigator.appVersion.indexOf("MSIE 9")>-1){n._eSB.children[0].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffffff,endColorstr=#00ffffff,GradientType=1)";n._eSB.children[1].style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ff000000,GradientType=0)"}o=ColorPicker._tplCursor;n._cSB=createElement(o);n._cHue=createElement(o);n._cHue.style.width="100%";n._cAlpha=createElement(o);n._cAlpha.style.height="100%";n._eSB.appendChild(n._cSB);n._eHue.appendChild(n._cHue);n._eAlpha.appendChild(n._cAlpha);n._keyActionTab=ColorPickerTabKeyAction.None;var s=n.addEventListener.bind(n),r=n.removeEventListener.bind(n),a=document;s(n.hostElement,"mousedown",(function(e){s(a,"mousemove",mouseMove);s(a,"mouseup",mouseUp);n._mouseDown(e)}));s(n.hostElement,"touchstart",(function(e){s(a,"touchmove",mouseMove);s(a,"touchend",mouseUp);n._mouseDown(e)}));var mouseMove=function(e){n._mouseMove(e)},mouseUp=function(e){r(a,"mousemove",mouseMove);r(a,"mouseup",mouseUp);r(a,"touchmove",mouseMove);r(a,"touchend",mouseUp);n._mouseUp(e)};s(n.hostElement,"click",(function(e){if(!n.isDisabled){var t=e.target;if(t&&"DIV"==t.tagName&&contains(n._ePal,t)){var i=t.style.backgroundColor;i&&(n.value=new Color(i).toString());t.focus()}}}));s(n.hostElement,"keydown",(function(e){n.isDisabled||n._keydown(e)}));n.value="#ffffff";n.initialize(i);n._updatePanels();n._eSB.setAttribute("role","slider");n._eSB.setAttribute("aria-label",culture.ColorPicker.ariaLabels.satAndBrightnessPanel);n._eSB.setAttribute("aria-valuemin","0");n._eSB.setAttribute("aria-valuemax","100");n._eHue.setAttribute("role","slider");n._eHue.setAttribute("aria-label",culture.ColorPicker.ariaLabels.huePanel);n._eHue.setAttribute("aria-valuemin","0");n._eHue.setAttribute("aria-valuemax","360");n._eAlpha.setAttribute("role","slider");n._eAlpha.setAttribute("aria-label",culture.ColorPicker.ariaLabels.opacityPanel);n._eAlpha.setAttribute("aria-valuemin","0");n._eAlpha.setAttribute("aria-valuemax","100");n._ePal.setAttribute("role","grid");n._ePal.setAttribute("aria-label",culture.ColorPicker.ariaLabels.palettePanel);n._updateTabIndex();return n}Object.defineProperty(ColorPicker,"controlTemplate",{get:function(){ColorPicker._ctrlTemplate||(ColorPicker._ctrlTemplate='<div style="position:relative;width:100%;height:100%"><div style="float:left;width:50%;height:100%;box-sizing:border-box;padding:2px"><div wj-part="div-pal"><div style="float:left;width:10%;box-sizing:border-box;padding:2px"><div style="background-color:black;width:100%"></div><div style="height:6px"></div></div></div><div wj-part="div-text" style="position:absolute;bottom:0px;display:none"></div></div><div style="float:left;width:50%;height:100%;box-sizing:border-box;padding:2px"><div wj-part="div-sb" class="'+ColorPickerClsNames.colorBox+'" style="float:left;width:89%;height:89%"><div style="position:absolute;width:100%;height:100%;background:linear-gradient(to right, white 0%,transparent 100%)"></div><div style="position:absolute;width:100%;height:100%;background:linear-gradient(to top, black 0%,transparent 100%)"></div></div><div style="float:left;width:1%;height:89%"></div><div style="float:left;width:10%;height:89%"><div wj-part="div-hue" class="'+ColorPickerClsNames.colorBox+'"></div></div><div style="float:left;width:89%;height:1%"></div><div style="float:left;width:89%;height:10%"><div style="width:100%;height:100%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuM4zml1AAAAAcSURBVBhXY/iPBBYgAWpKQGkwgMqDAdUk/v8HAM7Mm6GatDUYAAAAAElFTkSuQmCC)"><div wj-part="div-alpha" class="'+ColorPickerClsNames.colorBox+'"></div></div></div><div style="float:left;width:1%;height:10%"></div><div style="float:left;width:10%;height:10%"><div wj-part="div-pv" class="'+ColorPickerClsNames.colorBox+'" style="position:static"></div></div></div></div>');return ColorPicker._ctrlTemplate},set:function(e){ColorPicker._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"showAlphaChannel",{get:function(){return"none"!=this._eAlpha.parentElement.style.display},set:function(e){this._eAlpha.parentElement.style.display=asBoolean(e)?"":"none"},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"showColorString",{get:function(){return"none"!=this._eText.style.display},set:function(e){this._eText.style.display=asBoolean(e)?"":"none";if(asBoolean(e)){this._eText.setAttribute("role","status");this._eText.setAttribute("aria-live","polite")}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"value",{get:function(){return this._value},set:function(e){if(e!=this.value){var t=this.value,i=(e=asString(e)).trim(),n=Color.fromString(i);if(n){var o=n.getHsb();this._value=i;this._eText.innerText=i;if(this._hsb[0]!=o[0]||this._hsb[1]!=o[1]||this._hsb[2]!=o[2]||this._alpha!=n.a){if(0==o[2]){o[0]=this._hsb[0];o[1]=this._hsb[1]}else 0==o[1]&&(o[0]=this._hsb[0]);this._hsb=o;this._alpha=n.a;this.onValueChanged()}else""===t&&this.onValueChanged()}else if(""===i){var s=new Color(e);this._hsb=s.getHsb();this._alpha=s.a;this._value=e;this._eText.innerText=i;this.onValueChanged()}}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"palette",{get:function(){return this._palette},set:function(e){if((e=(e=asArray(e)).slice(0,10)).every((function(e){return null!=Color.fromString(e)}))){this._palette=e;this._updatePalette()}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"ariaLabel",{get:function(){return this._ariaLabel},set:function(e){if(e!=this._ariaLabel){this._ariaLabel=e;setAttribute(this.hostElement,"aria-label",this._ariaLabel)}},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"keyActionTab",{get:function(){return this._keyActionTab},set:function(e){this._keyActionTab=e;if(e==ColorPickerTabKeyAction.All){this.tabOrder=0;this.hostElement.setAttribute("tabindex","-1")}this._updateTabIndex()},enumerable:!0,configurable:!0});ColorPicker.prototype._setTabOrder=function(t){e.prototype._setTabOrder.call(this,t);this.isDisabled||this._updateTabIndex()};ColorPicker.prototype.onValueChanged=function(e){this._refreshSelection();this.valueChanged.raise(this,e)};ColorPicker.prototype._mouseDown=function(e){this._htDown=this._getTargetPanel(e);if(this._htDown){e.preventDefault();this._htDown.focus();this._mouseMove(e)}};ColorPicker.prototype._mouseMove=function(e){if(!this.isDisabled){var t=e.touches?e.touches[0]:e,i=this._htDown;if(i){var n=i.getBoundingClientRect(),o=this._hsb.slice(),s=this._alpha;if(i==this._eHue)o[0]=clamp((t.clientY-n.top)/n.height,0,.99);else if(i==this._eSB){o[1]=clamp((t.clientX-n.left)/n.width,0,1);o[2]=clamp(1-(t.clientY-n.top)/n.height,0,1)}else i==this._eAlpha&&(s=clamp((t.clientX-n.left)/n.width,0,1));this._updateColor(o,s)}}};ColorPicker.prototype._mouseUp=function(e){this._htDown=null};ColorPicker.prototype._updateColor=function(e,t){void 0===e&&(e=this._hsb);void 0===t&&(t=this._alpha);var i=this._hsb[0]!==e[0]||this._hsb[1]!==e[1]||this._hsb[2]!==e[2],n=this._alpha!==t;if(i||n){this._hsb=e;this._alpha=t;var o=Color.fromHsb(e[0],e[1],e[2],t);this._value=o.toString();this._eText.innerText=this._value;this.onValueChanged()}};ColorPicker.prototype._updatePalette=function(){var e=this,t=new Color("#fff"),i=new Color("#000");this._ePal.innerHTML="";this._ePal.className="palette-grid";for(var n=Array.from({length:6},(function(){var e=document.createElement("div");e.className="palette-row";e.setAttribute("role","row");return e})),o=this.getActualTabIndex(),s=0;s<this._palette.length;s++){var r=new Color(this._palette[s]),a=r.getHsb(),l=this._makePalEntry(r);l.innerHTML="&#8203";l.setAttribute("role","columnheader");l.setAttribute("aria-label",culture.ColorPicker.ariaLabels.baseColor+" "+r.toString());if(0===s){this._ePalMainFirst=l;this._ePalMainFirst.setAttribute("tabindex",o)}else l.setAttribute("tabindex","-1");n[0].appendChild(l);for(var h=0;h<5;h++){var u=0===a[1]?Color.interpolate(t,i,.1*h+(a[2]>.5?.05:.55)):Color.fromHsb(a[0],.1+.2*h,1-.1*h),c=this._makePalEntry(u);c.setAttribute("role","gridcell");c.setAttribute("aria-label",culture.ColorPicker.ariaLabels.shadeColor+" "+u.toString());if(0===s&&0===h){this._ePalShadeFirst=c;this._ePalShadeFirst.setAttribute("tabindex",o)}else setAttribute(c,"tabindex","-1");n[h+1].appendChild(c)}}n.forEach((function(t){return e._ePal.appendChild(t)}))};ColorPicker.prototype._makePalEntry=function(e){var t=document.createElement("div");t.className="palette-gridcell";setCss(t,{backgroundColor:e.toString()});return t};ColorPicker.prototype._updatePanels=function(){var e=Color.fromHsb(this._hsb[0],1,1,1),t=Color.fromHsb(this._hsb[0],this._hsb[1],this._hsb[2],1);this._eSB.style.backgroundColor=e.toString();this._eAlpha.style.background="linear-gradient(to right, transparent 0%, "+t.toString()+" 100%)";navigator.appVersion.indexOf("MSIE 9")>-1&&(this._eAlpha.style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr="+t.toString()+", GradientType = 1)");var i=this.value.trim();this._ePreview.style.backgroundColor=i;this._cHue.style.top=(100*this._hsb[0]).toFixed(0)+"%";this._cSB.style.left=(100*this._hsb[1]).toFixed(0)+"%";this._cSB.style.top=(100-100*this._hsb[2]).toFixed(0)+"%";this._cAlpha.style.left=(100*this._alpha).toFixed(0)+"%";var n=this.getColorsDiv(),o=getActiveElement();if(this.keyActionTab===ColorPickerTabKeyAction.All&&!this.hostElement.contains(o)){if(this.isDisabled)return;for(var s=!1,r=0;r<n.length;r++){var a=n[r].style.backgroundColor;if(Color.fromString(i).equals(Color.fromString(a))){n[r].focus();s=!0;break}}s||n[0].focus()}};ColorPicker.prototype.getColorsDiv=function(){var e=Array.from(this._ePal.querySelectorAll('[role="columnheader"]')),t=Array.from(this._ePal.querySelectorAll('[role="gridcell"]'));return e.concat(t)};ColorPicker.prototype._getTargetPanel=function(e){var t=e.target;return contains(this._eSB,t)?this._eSB:contains(this._eHue,t)?this._eHue:contains(this._eAlpha,t)?this._eAlpha:null};ColorPicker.prototype.getActualTabIndex=function(){var e=this.tabOrder.toString();return this.keyActionTab===ColorPickerTabKeyAction.All&&!0!==this.isDisabled?e:"-1"};ColorPicker.prototype._updateTabIndex=function(){var e=this.getActualTabIndex();this._eSB.setAttribute("tabindex",e);this._eHue.setAttribute("tabindex",e);this._eAlpha.setAttribute("tabindex",e);this._ePalMainFirst.setAttribute("tabindex",e);this._ePalShadeFirst.setAttribute("tabindex",e)};ColorPicker.prototype._setIsDisabled=function(t){e.prototype._setIsDisabled.call(this,t);this._updateTabIndex()};ColorPicker.prototype._updateAriaValues=function(){var e=this._hsb;this._eSB.setAttribute("aria-valuenow",(100*e[1]).toString());this._eSB.setAttribute("aria-valuetext",culture.ColorPicker.ariaLabels.saturation+" "+Math.round(100*e[1])+"%, "+culture.ColorPicker.ariaLabels.brightness+" "+Math.round(100*e[2])+"%");this._eHue.setAttribute("aria-valuenow",(360*e[0]).toString());this._eHue.setAttribute("aria-valuetext",culture.ColorPicker.ariaLabels.hue+" "+Math.round(360*e[0])+" "+culture.ColorPicker.ariaLabels.degrees);this._eAlpha.setAttribute("aria-valuenow",(100*this._alpha).toString());this._eAlpha.setAttribute("aria-valuetext",culture.ColorPicker.ariaLabels.opacity+" "+Math.round(100*this._alpha)+"%")};ColorPicker.prototype._keydown=function(e){var t=e.target;this._isInColorPalette(t)?this._handleColorNavigation(e,t):t!==this._eSB?t!==this._eHue?t!==this._eAlpha||this._handleAlphaNavigation(e):this._handleHSBNavigation(e,"hue"):this._handleHSBNavigation(e,"sb")};ColorPicker.prototype._isInColorPalette=function(e){return e&&"DIV"===e.tagName&&contains(this._ePal,e)};ColorPicker.prototype._handleColorNavigation=function(e,t){var i=this.getColorsDiv(),n=this.palette.length,o=i.findIndex((function(e){return e===t})),s=null;switch(e.key){case"ArrowDown":o<i.length-1&&(s=i[o+n]);break;case"ArrowUp":o>0&&(s=i[o-n]);break;case"ArrowRight":var r=o+1;r<i.length&&(s=i[r]);break;case"ArrowLeft":var a=o-1;a>=0&&(s=i[a])}if(s){var l=s.style.backgroundColor;l&&(this.value=new Color(l).toString());s.focus();e.preventDefault()}};ColorPicker.prototype._handleHSBNavigation=function(e,t){var i=this._hsb.slice();i=i.map((function(e){return roundTo(e,2)}));var adjust=function(e,t,n){var o=Math.round(100*i[e]);i[e]=clamp((o+t)/100,0,n)};switch(e.key){case"ArrowLeft":"sb"===t&&adjust(1,-1,1);break;case"ArrowRight":"sb"===t&&adjust(1,1,1);break;case"ArrowUp":"sb"===t?adjust(2,1,1):adjust(0,-1,.99);break;case"ArrowDown":"sb"===t?adjust(2,-1,1):adjust(0,1,.99)}if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){this._updateColor(i,void 0);e.preventDefault()}};ColorPicker.prototype._refreshSelection=function(){this._updatePanels();this._updateAriaValues()};ColorPicker.prototype._handleAlphaNavigation=function(e){var t=this._alpha;switch(e.key){case"ArrowLeft":t=clamp(t-.01,0,1);break;case"ArrowRight":t=clamp(t+.01,0,1);break;default:return}this._updateColor(void 0,t);e.preventDefault()};ColorPicker._ctrlTemplate="";ColorPicker._tplCursor='<div class="wj-colorpicker-cursor"></div>';return ColorPicker}(Control);export{ColorPicker};_addCultureInfo("CollectionViewNavigator",{ariaLabels:{byPage:{btnFirst:"Navigate to first page",btnPrev:"Navigate to previous page",btnNext:"Navigate to next page",btnLast:"Navigate to last page"},byItem:{btnFirst:"Navigate to first item",btnPrev:"Navigate to previous item",btnNext:"Navigate to next item",btnLast:"Navigate to last item"}}});var CollectionViewNavigator=function(e){__extends(CollectionViewNavigator,e);function CollectionViewNavigator(t,i){var n=e.call(this,t)||this;n._view=null;n._byPage=!1;n._fmt="{current:n0} / {count:n0}";n._liveRegionON=!1;n._ariaLabel="";var o=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+CollectionViewNavigatorClsNames.pager+" "+CollectionViewNavigatorClsNames.hostElement,o,{_btnFirst:"btn-first",_btnPrev:"btn-prev",_txtCurr:"txt-curr",_btnNext:"btn-next",_btnLast:"btn-last"},"input");n.hostElement.tabIndex=-1;n._updateAriaLabels();var s=uidGenerator();n._txtCurr.id=s;[n._btnFirst,n._btnPrev,n._btnNext,n._btnLast].forEach((function(e){setAttribute(e.firstElementChild,"aria-controls",n._txtCurr.id)}));setAttribute(n.hostElement.firstElementChild,"role","group");setAttribute(n._txtCurr,"role","status");n._rptNext=new _ClickRepeater(n._btnNext.querySelector("button"));n._rptPrev=new _ClickRepeater(n._btnPrev.querySelector("button"));n.addEventListener(n.hostElement,"click",n._click.bind(n));n.addEventListener(n.hostElement,"keydown",n._keydown.bind(n));setAttribute(n.hostElement,"role","navigation");n._addA11yRelatedHandlers();n.initialize(i);n._update();return n}Object.defineProperty(CollectionViewNavigator,"controlTemplate",{get:function(){CollectionViewNavigator._ctrlTemplate||(CollectionViewNavigator._ctrlTemplate='<div class="'+InputClsNames.inputGroup+'"><span wj-part="btn-first" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.stepBackward+'"></span></button></span><span wj-part="btn-prev" class="'+InputClsNames.inputGroupBtn+'"> <button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.left+'"></span> </button></span><span wj-part="txt-curr" tabIndex="0"></span><span wj-part="btn-next" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.right+'"></span></button></span><span wj-part="btn-last" class="'+InputClsNames.inputGroupBtn+'"><button class="'+InputFormElementsClsNames.btn+" "+InputFormElementsClsNames.btnDefault+'"><span class="'+GlyphClsNames.stepForward+'"></span></button></span></div>');return CollectionViewNavigator._ctrlTemplate},set:function(e){CollectionViewNavigator._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"cv",{get:function(){return this._view},set:function(e){if(e!=this._view){var t=this._view;if(t){t.collectionChanged.removeHandler(this._collectionChanged);t.currentChanged.removeHandler(this._currentChanged)}t=this._view=asType(e,"ICollectionView",!0);this._update();if(t){t.collectionChanged.addHandler(this._collectionChanged,this);t.currentChanged.addHandler(this._currentChanged,this)}}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"byPage",{get:function(){return this._byPage},set:function(e){if(e!=this._byPage){this._byPage=asBoolean(e);this._update();this._updateAriaLabels()}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"headerFormat",{get:function(){return this._fmt},set:function(e){if(e!=this._fmt){this._fmt=asString(e);this._update()}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"repeatButtons",{get:function(){return!this._rptNext.disabled},set:function(e){this._rptNext.disabled=this._rptPrev.disabled=!asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"ariaLabel",{get:function(){if(this.hostElement){var e=this.hostElement.getAttribute("aria-label");if(e)return e}return this._ariaLabel},set:function(e){if(this.ariaLabel!==e){this._ariaLabel=e;this.hostElement&&setAttribute(this.hostElement,"aria-label",e)}},enumerable:!0,configurable:!0});Object.defineProperty(CollectionViewNavigator.prototype,"isDisabled",{get:function(){return this._isDisabled},set:function(e){this._setIsDisabled(e)},enumerable:!0,configurable:!0});CollectionViewNavigator.prototype.focus=function(){var e=this._e;e&&e.offsetHeight&&(this.isDisabled||moveFocus(e,0)||this._txtCurr.tabIndex>=0&&this._txtCurr.focus())};CollectionViewNavigator.prototype._update=function(){var e=this._view,t=this._byPage,i=e?t?e.pageIndex:e.currentPosition:0,n=e?t?e.pageCount:e.itemCount:0;if(this.isDisabled)[this._btnFirst,this._btnPrev,this._btnNext,this._btnLast].forEach((function(e){enable(e,!1)}));else{enable(this._btnFirst,e&&i>0);enable(this._btnPrev,e&&i>0);enable(this._txtCurr,null!=e);enable(this._btnNext,e&&i<n-1);enable(this._btnLast,e&&i<n-1)}this._updateTabIndex();this._txtCurr.textContent=format(this._fmt,{current:e?i+1:0,count:e?n:0,currentItem:e?e.currentPosition+1:0,itemCount:e?e.itemCount:0,currentPage:e?e.pageIndex+1:0,pageCount:e?e.pageCount:0})};CollectionViewNavigator.prototype._currentChanged=function(){this._update()};CollectionViewNavigator.prototype._collectionChanged=function(){this._update()};CollectionViewNavigator.prototype._click=function(e){var t=e.target,i=this._view,n=this._byPage;if(i){contains(this._btnFirst,t)?n?i.moveToFirstPage():i.moveCurrentToFirst():contains(this._btnPrev,t)?n?i.moveToPreviousPage():i.moveCurrentToPrevious():contains(this._btnNext,t)?n?i.moveToNextPage():i.moveCurrentToNext():contains(this._btnLast,t)&&(n?i.moveToLastPage():i.moveCurrentToLast());(this.byPage?i.pageIndex>=i.pageCount-1||i.pageIndex<=0:i.currentPosition>=i.itemCount-1||i.currentPosition<=0)&&!this.isDisabled&&this._txtCurr.tabIndex>=0&&this._txtCurr.focus();e.preventDefault()}};CollectionViewNavigator.prototype._updateAriaLabels=function(){var e=culture.CollectionViewNavigator.ariaLabels[this._byPage?"byPage":"byItem"];setAttribute(this._btnFirst.firstElementChild,"aria-label",e.btnFirst);setAttribute(this._btnPrev.firstElementChild,"aria-label",e.btnPrev);setAttribute(this._btnNext.firstElementChild,"aria-label",e.btnNext);setAttribute(this._btnLast.firstElementChild,"aria-label",e.btnLast)};CollectionViewNavigator.prototype._addA11yRelatedHandlers=function(){var e=this;this.addEventListener(this._txtCurr,"focus",(function(t){if(e._txtCurr===document.activeElement){setAttribute(e._txtCurr,"aria-live","off");setAttribute(e._txtCurr,"aria-label",e._txtCurr.textContent);e._liveRegionON=!1}}));this.addEventListener(this._txtCurr,"blur",(function(t){e._txtCurr!==document.activeElement&&e._txtCurr.removeAttribute("aria-label")}));[this._btnFirst.firstElementChild,this._btnPrev.firstElementChild,this._btnNext.firstElementChild,this._btnLast.firstElementChild].forEach((function(t){e.addEventListener(t,"focus",(function(t){setTimeout((function(){if(!e._liveRegionON){var t=_isMacOS()?"polite":"assertive";setAttribute(e._txtCurr,"aria-live",t);e._liveRegionON=!0}}))}))}))};CollectionViewNavigator.prototype._setTabOrder=function(e){var t=this._e,i=null!=this._txtCurr.getAttribute("disabled");this._orgTabIndex=e;if(this.isDisabled||i){t.tabIndex=-1;this._txtCurr.tabIndex=-1}else i||(this._txtCurr.tabIndex=this._orgTabIndex)};CollectionViewNavigator.prototype._keydown=function(e){if(contains(this._txtCurr,e.target)&&(e.ctrlKey||e.metaKey)&&("A"===e.key||"a"===e.key)){e.preventDefault();var t=document.createRange();t.selectNodeContents(this._txtCurr);var i=window.getSelection();i.removeAllRanges();i.addRange(t)}};CollectionViewNavigator.prototype._setIsDisabled=function(e){if((e=!!asBoolean(e,!0))!=this.isDisabled){var t=this._e;if(t){this._isDisabled=e;toggleClass(t,ControlStateClsNames.disabled,e);this._update();this._txtCurr.tabIndex=e?-1:this._orgTabIndex}}};CollectionViewNavigator.prototype._updateTabIndex=function(){var e=this;[this._btnFirst,this._btnPrev,this._btnNext,this._btnLast].forEach((function(t){if(e._isDisabled)t.firstElementChild.setAttribute("tabindex","-1");else{t.firstElementChild.disabled?t.firstElementChild.setAttribute("tabindex","-1"):t.firstElementChild.setAttribute("tabindex",e._orgTabIndex.toString())}}))};CollectionViewNavigator._ctrlTemplate="";return CollectionViewNavigator}(Control);export{CollectionViewNavigator};_addCultureInfo("Listbox",{ariaLabels:{listBox:"list box"}});var ListBox=function(e){__extends(ListBox,e);function ListBox(t,i){var n=e.call(this,t,null,!0)||this;n._cv=null;n._itemFormatter=null;n._pathDisplay=new Binding("");n._pathValue=new Binding("");n._pathChecked=new Binding("");n._html=!1;n._shGroups=!1;n._checkedItems=[];n._itemRole="option";n._caseSensitive=!1;n._addMode=!1;n._isShiftDown=!1;n._shouldClearOnShift=!0;n._vThreshold=ListBox._VTHRESH;n._isVirtual=!1;n._children=[];n._ignoreItemFormatterTextArray=[];n._itemFormatterHelper=document.createElement("div");n._clientHeight=-1;n._itemHeight=30;n._itemsAbove=-1;n._itemsBelow=-1;n._eSizer=document.createElement("div");n._ePadTop=document.createElement("div");n._ePadBot=document.createElement("div");n._checking=!1;n._ignoredItemChangedEvents=!1;n._search="";n._fmtItemHandlers=0;n._itemCount=0;n._oldSel=null;n._container=null;n._oldSelectedIndex=-1;n._ariaLabel=culture.Listbox.ariaLabels.listBox;n._isNeedUpdateBnd=!0;n.selectedIndexChanged=new Event;n.item