UNPKG

@mescius/wijmo.input

Version:

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

14 lines (13 loc) 252 kB
/*! * * Wijmo Library 5.20251.40 * 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 __)}}();import{_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,tryCast,createElement,hasItems,isObject,isString,asArray,asFunction,asNumber,asType,asCollectionView,closest,escapeHtml,toPlainText,setCss,Binding,Rect,DateTime,assert,isFirefox,_CLS_STATE_DISABLED,UtilitesClsNames,_setAriaLabelBy,getUniqueId,isNumber,enable,isFunction,escapeRegExp,isSafari,setText,isDate,isBoolean,asDate,asInt,Globalize,_ClickRepeater,CollectionView,format,uidGenerator,moveFocus,_isMacOS,clamp,Color,_MaskProvider,getSpecialCharsRegex,isEmpty,isNullOrUndefined,isEdge,setChecked,Point,isArray,getElementRect,PopupPosition,getElement,isUndefined,_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"};export var InputDateRangeClsNames={hostElement:"wj-inputdaterange"};export var InputDateTimeClsNames={hostElement:"wj-inputdatetime"};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"};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));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" inputmode="numeric" 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._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:if(this.clamp(-1)>=0)this.value<0&&this._flipSign();else if(this.value&&t.selectionStart==t.selectionEnd)this._flipSign();else if(this.clamp(-1)<0){t.value=this._chrNeg;setSelectionRange(t,1)}e.preventDefault();break;case"+":case this._chrPls:this.value<0&&this._flipSign();e.preventDefault();break;case".":case this._chrDec:if(0==this._fmtPrc)e.preventDefault();else{var h=t.value.indexOf(this._chrDec);if(h>-1){t.selectionStart<=h&&h++;setSelectionRange(t,h);e.preventDefault()}}}if(!e.defaultPrevented&&isIE()){var u=t.value;if((s=t.selectionStart)==(r=t.selectionEnd)){t.value=u.substr(0,s)+i+u.substr(r);setSelectionRange(t,s+1);e.preventDefault();this._input()}}}};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){1==r.length?setSelectionRange(t,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._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;!e||e.id||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:{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.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()}));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)};InputMask.prototype.getAriaLabelForScreenReader=function(){return culture.InputMask.ariaLabels.inputMask};InputMask._ctrlTemplate="";return InputMask}(Control);export{InputMask};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.valueChanged=new Event;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);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){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())}}));n.value="#ffffff";n.initialize(i);n._updatePanels();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%">&nbsp;</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"},enumerable:!0,configurable:!0});Object.defineProperty(ColorPicker.prototype,"value",{get:function(){return this._value},set:function(e){if(e!=this.value){e=(e=asString(e)).trim();var t=Color.fromString(e);if(t){this._value=e;this._eText.innerText=e;var i=t.getHsb();if(this._hsb[0]!=i[0]||this._hsb[1]!=i[1]||this._hsb[2]!=i[2]||this._alpha!=t.a){if(0==i[2]){i[0]=this._hsb[0];i[1]=this._hsb[1]}else 0==i[1]&&(i[0]=this._hsb[0]);this._hsb=i;this._alpha=t.a;this._updatePanels();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});ColorPicker.prototype.onValueChanged=function(e){this._updatePanels();this.valueChanged.raise(this,e)};ColorPicker.prototype._mouseDown=function(e){this._htDown=this._getTargetPanel(e);if(this._htDown){e.preventDefault();this.focus();this._mouseMove(e)}};ColorPicker.prototype._mouseMove=function(e){var t=e.touches?e.touches[0]:e,i=this._htDown;if(i){var n=i.getBoundingClientRect(),o=this._hsb;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&&(this._alpha=clamp((t.clientX-n.left)/n.width,0,1));this._updateColor()}};ColorPicker.prototype._mouseUp=function(e){this._htDown=null};ColorPicker.prototype._updateColor=function(){var e=Color.fromHsb(this._hsb[0],this._hsb[1],this._hsb[2],this._alpha);this.value=e.toString();this._updatePanels()};ColorPicker.prototype._updatePalette=function(){var e=new Color("#fff"),t=new Color("#000");this._ePal.innerHTML="";for(var i=0;i<this._palette.length;i++){var n=createElement('<div style="float:left;width:10%;box-sizing:border-box;padding:1px">'),o=new Color(this._palette[i]),s=o.getHsb();n.appendChild(this._makePalEntry(o,4));for(var r=0;r<5;r++){if(0==s[1]){var a=.1*r+(s[2]>.5?.05:.55);o=Color.interpolate(e,t,a)}else o=Color.fromHsb(s[0],.1+.2*r,1-.1*r);n.appendChild(this._makePalEntry(o,0))}this._ePal.appendChild(n)}};ColorPicker.prototype._makePalEntry=function(e,t){var i=document.createElement("div");setCss(i,{cursor:"pointer",backgroundColor:e.toString(),marginBottom:t||""});i.innerHTML="&nbsp";return i};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)");this._ePreview.style.backgroundColor=this.value;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)+"%"};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._ctrlTemplate="";ColorPicker._tplCursor='<div style="position:absolute;left:50%;top:50%;width:7px;height:7px;transform:translate(-50%,-50%);border:2px solid #f0f0f0;border-radius:50px;box-shadow:0px 0px 4px 2px #0f0f0f"></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,t=this._view,i=this._byPage,n=t?i?t.pageIndex:t.currentPosition:0,o=t?i?t.pageCount:t.itemCount:0;if(!this.isDisabled){enable(this._btnFirst,t&&n>0);enable(this._btnPrev,t&&n>0);enable(this._txtCurr,null!=t);enable(this._btnNext,t&&n<o-1);enable(this._btnLast,t&&n<o-1)}[this._btnFirst,this._btnPrev,this._btnNext,this._btnLast].forEach((function(t){t.firstElementChild.disabled?t.firstElementChild.setAttribute("tabindex","-1"):t.firstElementChild.setAttribute("tabindex",e._orgTabIndex.toString())}));this._txtCurr.textContent=format(this._fmt,{current:t?n+1:0,count:t?o:0,currentItem:t?t.currentPosition+1:0,itemCount:t?t.itemCount:0,currentPage:t?t.pageIndex+1:0,pageCount:t?t.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){var t=this;if((e=!!asBoolean(e,!0))!=this.isDisabled){var i=this._e;if(i){this._isDisabled=e;toggleClass(i,ControlStateClsNames.disabled,e);[this._btnFirst,this._btnPrev,this._btnNext,this._btnLast].forEach((function(i){if(e){i.firstElementChild.setAttribute("disabled","");i.firstElementChild.setAttribute("tabindex","-1")}else{i.firstElementChild.removeAttribute("disabled");i.firstElementChild.setAttribute("tabindex",t._orgTabIndex.toString())}toggleClass(i,ControlStateClsNames.disabled,e)}));this._txtCurr.tabIndex=e?-1:this._orgTabIndex;toggleClass(this._txtCurr,ControlStateClsNames.disabled,e)}}};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.selectedIndexChanged=new Event;n.itemsChanged=new Event;n.loadingItems=new Event;n.loadedItems=new Event;n.itemChecked=new Event;n.checkedItemsChanged=new Event;n.formatItem=new Event((function(){n.invalidate()}));n._handleKeyUp=function(e){if("Shift"===e.key){n._isShiftDown=!1;n._shouldClearOnShift=!0}};n.applyTemplate(ControlClsNames.hostElement+" "+ControlClsNames.content+" "+ListBoxClsNames.hostElement,null,null);var o=n.hostElement;setAttribute(o,"role","listbox",!0);n._updateAriaLabel();"SELECT"==n._orgTag&&n._initFromSelect(n.hostElement);n.addEventListener(o,"click",n._click.bind(n));n.addEventListener(o,"keydown",n._keydown.bind(n));n.addEventListener(o,"keypress",n._keypress.bind(n));n.addEventListener(o,"keyup",n._handleKeyUp.bind(n));n.addEventListener(o,"wheel",(function(e){if(o.scrollHeight>o.offsetHeight&&(e.deltaY<0&&0==o.scrollTop||e.deltaY>0&&o.scrollTop+o.offsetHeight>=o.scrollHeight)){e.preventDefault();e.stopPropagation();e.stopImmediatePropagation()}}));[n._eSizer,n._ePadTop,n._ePadBot].forEach((function(e){e.tabIndex=-1;setAttribute(e,"aria-hidden",!0);setCss(e,{pointerEvents:"none",opacity:"0"})}));n.initialize(i);n._updateViewRange();n.addEventListener(n.hostElement,"scroll",(function(e){n._updateViewRange()}));return n}Object.defineProperty(ListBox.prototype,"ariaLabelledBy",{get:function(){return this.hostElement.getAttribute("aria-labelledby")},set:function(e){_setAriaLabelBy(this,this.hostElement,e,this._updateAriaLabel.bind(this))},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemsSource",{get:function(){return this._items},set:function(e){if(this._items!=e){if(this._cv){this._cv.currentChanged.removeHandler(this._cvCurrentChanged,this);this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this);this._cv=null}this._items=e;this._cv=asCollectionView(e);if(null!=this._cv){this._cv.currentChanged.addHandler(this._cvCurrentChanged,this);this._cv.collectionChanged.addHandler(this._cvCollectionChanged,this)}this._populateList();this.onItemsChanged();this.onSelectedIndexChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"collectionView",{get:function(){return this._cv},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"virtualizationThreshold",{get:function(){return this._vThreshold},set:function(e){if(e!=this._vThreshold){var t=this._getVirtual();this._vThreshold=asNumber(e,!1,!0);t!=this._getVirtual()&&this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"showGroups",{get:function(){return this._shGroups},set:function(e){if(e!=this._shGroups){this._shGroups=asBoolean(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"isContentHtml",{get:function(){return this._html},set:function(e){if(e!=this._html){this._html=asBoolean(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemFormatter",{get:function(){return this._itemFormatter},set:function(e){if(e!=this._itemFormatter){this._itemFormatter=asFunction(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"displayMemberPath",{get:function(){return this._pathDisplay.path},set:function(e){if(e!=this.displayMemberPath){this._pathDisplay.path=asString(e);this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedValuePath",{get:function(){return this._pathValue.path},set:function(e){this._pathValue.path=asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"checkedMemberPath",{get:function(){return this._pathChecked.path},set:function(e){if(e!=this.checkedMemberPath){this._pathChecked.path=asString(e);setAttribute(this.hostElement,"aria-multiselectable",""!==this.checkedMemberPath?"true":"false");this._populateList()}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"caseSensitiveSearch",{get:function(){return this._caseSensitive},set:function(e){this._caseSensitive=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"itemRole",{get:function(){return this._itemRole},set:function(e){if(e!=this.itemRole){this._itemRole=asString(e);this._populateList()}},enumerable:!0,configurable:!0});ListBox.prototype.getDisplayValue=function(e,t){var i=null;if(e>-1&&hasItems(this._cv)){i=this._cv.items[e];this.displayMemberPath&&(i=this._pathDisplay.getValue(i))}var n=null!=i?i.toString():"";this._itemFormatter&&!t&&(n=this._itemFormatter(e,n));return n};ListBox.prototype.getDisplayText=function(e){return this._getDisplayText(e)};ListBox.prototype._getDisplayText=function(e,t){if(t&&this._ignoreItemFormatterTextArray[e])return this._ignoreItemFormatterTextArray[e];var i=this._getChild(e);return null!=i?i.textContent:""};ListBox.prototype.isItemEnabled=function(e){var t=this._getChild(e);return null!=t&&!t.hasAttribute("disabled")&&!hasClass(t,ControlStateClsNames.disabled)&&!hasClass(t,UtilitesClsNames.separator)};Object.defineProperty(ListBox.prototype,"selectedIndex",{get:function(){return this._cv?this._cv.currentPosition:-1},set:function(e){if(this._cv){this._oldSelectedIndex=this._cv.currentPosition;this._cv.moveCurrentToPosition(asNumber(e))}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedItem",{get:function(){return this._cv?this._cv.currentItem:null},set:function(e){this._cv&&this._cv.moveCurrentTo(e)},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"selectedValue",{get:function(){var e=this.selectedItem;e&&this.selectedValuePath&&(e=this._pathValue.getValue(e));return e},set:function(e){var t=this._cv,i=t?t.items:null,n=this.selectedValuePath,o=-1;if(i){for(var s=0;s<i.length;s++){var r=i[s],a=n?this._pathValue.getValue(r):r;if(a===e||DateTime.equals(a,e)){o=s;break}if(this.isContentHtml&&isString(a)&&a.indexOf("<")>-1&&toPlainText(a)===e){o=s;break}}this.selectedIndex=o}},enumerable:!0,configurable:!0});Object.defineProperty(ListBox.prototype,"maxHeight",{get:function(){var e=this.hostElement,t=e?parseFloat(e.style.maxHeight):null;return isNaN(t)?null:t},set:function(e){var t=this.hostElement;if(t){e=asNumber(e,!0);t.style.maxHeight=null==e?"":e+"px"}},enumerable:!0,configurable:!0});ListBox.prototype.showSelection=function(e){void 0===e&&(e=this.containsFocus());var t=this.hostElement,i=this._children,n=this._getSelectedElement(!1),o=new Rect(0,0,0,0);if(n!=this._oldSel){this._updateItemAttributes(n,!0);this._updateItemAttributes(this._oldSel,!1);this._oldSel=n}n instanceof HTMLElement?o=this._getBoundingClientRect(n):this._children.length>0&&(o=this._getBoundingClientRect(this._getChild(0)));var s=this._getBoundingClientRect(t),r=0;if(this._shGroups){r=this._itemHeight;if(!this._isVirtual){var a=i[0];a&&a.offsetHeight&&hasClass(a,ListBoxClsNames.header)&&(r=a.offsetHeight)}}o.bottom>s.bottom?t.scrollTop+=o.bottom-s.bottom:o.top<s.top+r&&(t.scrollTop-=s.top+r-o.top);this._updateViewRange();n=this._getSelectedElement(!0);setAttribute(t,"aria-activedescendant",n?n.id:null);if(e){(n&&!contains(n,getActiveElement())?n:t).focus()}t.tabIndex=n?-1:this._orgTabIndex};ListBox.prototype.loadList=function(){this._populateList()};ListBox.prototype.getItemChecked=function(e){var t=this._cv.items[e],i=this._pathChecked;return isObject(t)&&i.path?i.getValue(t):this._getCheckboxState(e)};ListBox.prototype.setItemChecked=function(e,t){this._setItemChecked(e,t,!0)};ListBox.prototype.toggleItemChecked=function(e){this.setItemChecked(e,!this.getItemChecked(e))};Object.defineProperty(ListBox.prototype,"checkedItems",{get:function(){return this._checkedItems},set:function(e){e=Array.from(new Set(e));var t=asArray(e,!1);if(!this._arrayEquals(t,this._checkedItems)){this._updateCheckedList(t);if(!this._arrayEquals(t,this._checkedItems)){this._checkedItems=t;this.onCheckedItemsChanged()}}},enumerable:!0,configurable:!0});ListBox.prototype.indexOf=function(e){return(e=closest(e,"."+ListBoxClsNames.listBoxItem))?e[ListBox._DIDX_KEY]:-1};ListBox.prototype.onSelectedIndexChanged=function(e){this.selectedIndexChanged.raise(this,e)};ListBox.prototype.onItemsChanged=function(e){this.itemsChanged.raise(this,e)};ListBox.prototype.onLoadingItems=function(e){this.loadingItems.raise(this,e)};ListBox.prototype.onLoadedItems=function(e){this.loadedItems.raise(this,e)};ListBox.prototype.onItemChecked=function(e){this.itemChecked.raise(this,e)};ListBox.prototype.onCheckedItemsChanged=function(e){this.checkedItemsChanged.raise(this,e)};ListBox.prototype